diff --git a/src/pc/djui/djui_panel.c b/src/pc/djui/djui_panel.c index 9d3ab5ba..e29f8de0 100644 --- a/src/pc/djui/djui_panel.c +++ b/src/pc/djui/djui_panel.c @@ -3,7 +3,6 @@ #include "djui_panel_main.h" #include "djui_panel_pause.h" #include "djui_panel_join_message.h" -#include "djui_panel_player.h" #include "src/pc/debuglog.h" #include "src/pc/utils/misc.h" #include "sounds.h" @@ -122,7 +121,6 @@ void djui_panel_back(void) { play_sound(SOUND_MENU_CLICK_FILE_SELECT, gGlobalSoundSource); gDjuiPanelJoinMessageVisible = false; - gDjuiPanelPlayerCreated = false; } void djui_panel_update(void) { diff --git a/src/pc/djui/djui_panel_dynos.c b/src/pc/djui/djui_panel_dynos.c index b4e81b17..31eb4a26 100644 --- a/src/pc/djui/djui_panel_dynos.c +++ b/src/pc/djui/djui_panel_dynos.c @@ -1,13 +1,13 @@ #include "djui.h" #include "djui_panel.h" #include "djui_panel_menu.h" -#include "src/pc/utils/misc.h" -#include "src/pc/configfile.h" +#include "pc/utils/misc.h" +#include "pc/configfile.h" #include "data/dynos.c.h" #include "pc/network/network.h" #include "djui_panel_main.h" #include "djui_panel_options.h" -#include "djui_panel_player.h" +#include "game/level_update.h" 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); } +static void djui_panel_dynos_destroy(UNUSED struct DjuiBase* caller) { + gInPlayerMenu = false; +} + void djui_panel_dynos_create(struct DjuiBase* caller) { + gInPlayerMenu = true; int packCount = dynos_pack_get_count(); struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(DYNOS, DYNOS)); 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; } - djui_panel_add(caller, panel, NULL); - gDjuiPanelPlayerCreated = true; + struct DjuiPanel* p = djui_panel_add(caller, panel, NULL); + p->on_panel_destroy = djui_panel_dynos_destroy; } diff --git a/src/pc/djui/djui_panel_player.c b/src/pc/djui/djui_panel_player.c index 5e5f0897..a2bbbfc3 100644 --- a/src/pc/djui/djui_panel_player.c +++ b/src/pc/djui/djui_panel_player.c @@ -20,8 +20,6 @@ static struct DjuiSelectionbox* sPalettePresetSelection; static struct DjuiInputbox* sHexColorTextBox; static struct DjuiSlider *sSliderR, *sSliderG, *sSliderB; -bool gDjuiPanelPlayerCreated = false; - static void djui_panel_player_edit_palette_update_hex_code_box(void) { char buf[7]; 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) { + 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) }; 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); - gDjuiPanelPlayerCreated = true; } 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); p->on_panel_destroy = djui_panel_player_destroy; - gDjuiPanelPlayerCreated = true; } diff --git a/src/pc/djui/djui_panel_player.h b/src/pc/djui/djui_panel_player.h index 4ad66e8d..0a84adba 100644 --- a/src/pc/djui/djui_panel_player.h +++ b/src/pc/djui/djui_panel_player.h @@ -1,6 +1,4 @@ #pragma once #include "djui.h" -extern bool gDjuiPanelPlayerCreated; - void djui_panel_player_create(struct DjuiBase* caller);