Remove redundant gDjuiPanelPlayerCreated

This commit is contained in:
Agent X 2024-03-19 15:05:19 -04:00
parent 17c2d9ac79
commit a826ba146b
4 changed files with 12 additions and 13 deletions

View File

@ -3,7 +3,6 @@
#include "djui_panel_main.h" #include "djui_panel_main.h"
#include "djui_panel_pause.h" #include "djui_panel_pause.h"
#include "djui_panel_join_message.h" #include "djui_panel_join_message.h"
#include "djui_panel_player.h"
#include "src/pc/debuglog.h" #include "src/pc/debuglog.h"
#include "src/pc/utils/misc.h" #include "src/pc/utils/misc.h"
#include "sounds.h" #include "sounds.h"
@ -122,7 +121,6 @@ void djui_panel_back(void) {
play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource);
gDjuiPanelJoinMessageVisible = false; gDjuiPanelJoinMessageVisible = false;
gDjuiPanelPlayerCreated = false;
} }
void djui_panel_update(void) { void djui_panel_update(void) {

View File

@ -1,13 +1,13 @@
#include "djui.h" #include "djui.h"
#include "djui_panel.h" #include "djui_panel.h"
#include "djui_panel_menu.h" #include "djui_panel_menu.h"
#include "src/pc/utils/misc.h" #include "pc/utils/misc.h"
#include "src/pc/configfile.h" #include "pc/configfile.h"
#include "data/dynos.c.h" #include "data/dynos.c.h"
#include "pc/network/network.h" #include "pc/network/network.h"
#include "djui_panel_main.h" #include "djui_panel_main.h"
#include "djui_panel_options.h" #include "djui_panel_options.h"
#include "djui_panel_player.h" #include "game/level_update.h"
void djui_panel_dynos_create(struct DjuiBase* caller); void djui_panel_dynos_create(struct DjuiBase* caller);
@ -32,7 +32,12 @@ static void djui_panel_dynos_refresh(UNUSED struct DjuiBase* base) {
djui_panel_dynos_create(NULL); djui_panel_dynos_create(NULL);
} }
static void djui_panel_dynos_destroy(UNUSED struct DjuiBase* caller) {
gInPlayerMenu = false;
}
void djui_panel_dynos_create(struct DjuiBase* caller) { void djui_panel_dynos_create(struct DjuiBase* caller) {
gInPlayerMenu = true;
int packCount = dynos_pack_get_count(); int packCount = dynos_pack_get_count();
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(DYNOS, DYNOS)); struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(DYNOS, DYNOS));
struct DjuiBase* body = djui_three_panel_get_body(panel); struct DjuiBase* body = djui_three_panel_get_body(panel);
@ -72,6 +77,6 @@ void djui_panel_dynos_create(struct DjuiBase* caller) {
panel->bodySize.value = paginated->base.height.value + 16 + 64 + 64; panel->bodySize.value = paginated->base.height.value + 16 + 64 + 64;
} }
djui_panel_add(caller, panel, NULL); struct DjuiPanel* p = djui_panel_add(caller, panel, NULL);
gDjuiPanelPlayerCreated = true; p->on_panel_destroy = djui_panel_dynos_destroy;
} }

View File

@ -20,8 +20,6 @@ static struct DjuiSelectionbox* sPalettePresetSelection;
static struct DjuiInputbox* sHexColorTextBox; static struct DjuiInputbox* sHexColorTextBox;
static struct DjuiSlider *sSliderR, *sSliderG, *sSliderB; static struct DjuiSlider *sSliderR, *sSliderG, *sSliderB;
bool gDjuiPanelPlayerCreated = false;
static void djui_panel_player_edit_palette_update_hex_code_box(void) { static void djui_panel_player_edit_palette_update_hex_code_box(void) {
char buf[7]; char buf[7];
static const char digitToChar[] = "0123456789abcdef"; static const char digitToChar[] = "0123456789abcdef";
@ -119,6 +117,8 @@ void djui_panel_player_edit_palette_destroy(struct DjuiBase* caller) {
} }
static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) { static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
gInPlayerMenu = true;
char* sPartStrings[PLAYER_PART_MAX] = { DLANG(PLAYER, OVERALLS), DLANG(PLAYER, SHIRT), DLANG(PLAYER, GLOVES), DLANG(PLAYER, SHOES), DLANG(PLAYER, HAIR), DLANG(PLAYER, SKIN), DLANG(PLAYER, CAP) }; char* sPartStrings[PLAYER_PART_MAX] = { DLANG(PLAYER, OVERALLS), DLANG(PLAYER, SHIRT), DLANG(PLAYER, GLOVES), DLANG(PLAYER, SHOES), DLANG(PLAYER, HAIR), DLANG(PLAYER, SKIN), DLANG(PLAYER, CAP) };
struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER, PALETTE)); struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(PLAYER, PALETTE));
@ -166,7 +166,6 @@ static void djui_panel_player_edit_palette_create(struct DjuiBase* caller) {
} }
djui_panel_add(caller, panel, NULL); djui_panel_add(caller, panel, NULL);
gDjuiPanelPlayerCreated = true;
} }
static bool djui_panel_player_name_valid(char* buffer) { static bool djui_panel_player_name_valid(char* buffer) {
@ -340,5 +339,4 @@ void djui_panel_player_create(struct DjuiBase* caller) {
struct DjuiPanel* p = djui_panel_add(caller, panel, NULL); struct DjuiPanel* p = djui_panel_add(caller, panel, NULL);
p->on_panel_destroy = djui_panel_player_destroy; p->on_panel_destroy = djui_panel_player_destroy;
gDjuiPanelPlayerCreated = true;
} }

View File

@ -1,6 +1,4 @@
#pragma once #pragma once
#include "djui.h" #include "djui.h"
extern bool gDjuiPanelPlayerCreated;
void djui_panel_player_create(struct DjuiBase* caller); void djui_panel_player_create(struct DjuiBase* caller);