From d7afad9389eceb49d76972bacf2132a7920d18a2 Mon Sep 17 00:00:00 2001 From: EmeraldLockdown Date: Tue, 30 Sep 2025 18:00:23 -0500 Subject: [PATCH 1/4] Allow clients to view server settings --- .../djui/djui_panel_client_server_settings.c | 70 +++++++++++++++++++ .../djui/djui_panel_client_server_settings.h | 4 ++ src/pc/djui/djui_panel_host_settings.c | 2 +- src/pc/djui/djui_panel_pause.c | 4 ++ 4 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 src/pc/djui/djui_panel_client_server_settings.c create mode 100644 src/pc/djui/djui_panel_client_server_settings.h diff --git a/src/pc/djui/djui_panel_client_server_settings.c b/src/pc/djui/djui_panel_client_server_settings.c new file mode 100644 index 000000000..54222a977 --- /dev/null +++ b/src/pc/djui/djui_panel_client_server_settings.c @@ -0,0 +1,70 @@ +#include +#include "djui.h" +#include "djui_panel.h" +#include "djui_panel_menu.h" +#include "game/save_file.h" +#include "pc/network/network.h" +#include "pc/utils/misc.h" +#include "pc/configfile.h" +#include "djui_inputbox.h" + +void djui_panel_client_server_settings_create(struct DjuiBase* caller) { + struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(HOST_SETTINGS, SETTINGS), false); + struct DjuiBase* body = djui_three_panel_get_body(panel); + { + char* iChoices[3] = { DLANG(HOST_SETTINGS, NONSOLID), DLANG(HOST_SETTINGS, SOLID), DLANG(HOST_SETTINGS, FRIENDLY_FIRE) }; + struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PLAYER_INTERACTION), iChoices, 3, &gServerSettings.playerInteractions, NULL); + djui_base_set_enabled(&selectionbox1->base, false); + + unsigned int sKnockbackIndex = (gServerSettings.playerKnockbackStrength <= 20) + ? 0 + : ((gServerSettings.playerKnockbackStrength <= 40) ? 1 : 2); + char* kChoices[3] = { DLANG(HOST_SETTINGS, WEAK), DLANG(HOST_SETTINGS, NORMAL), DLANG(HOST_SETTINGS, TOO_MUCH) }; + struct DjuiSelectionbox* selectionbox2 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, KNOCKBACK_STRENGTH), kChoices, 3, &sKnockbackIndex, NULL); + djui_base_set_enabled(&selectionbox2->base, false); + + char* pChoices[2] = { DLANG(HOST_SETTINGS, CLASSIC_PVP), DLANG(HOST_SETTINGS, REVAMPED_PVP) }; + struct DjuiSelectionbox* selectionbox3 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PVP_MODE), pChoices, 2, &gServerSettings.pvpType, NULL); + djui_base_set_enabled(&selectionbox3->base, false); + + unsigned int sStayInLevelAfterStar = gServerSettings.stayInLevelAfterStar; + char* lChoices[3] = { DLANG(HOST_SETTINGS, LEAVE_LEVEL), DLANG(HOST_SETTINGS, STAY_IN_LEVEL), DLANG(HOST_SETTINGS, NONSTOP) }; + struct DjuiSelectionbox* selectionbox4 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &sStayInLevelAfterStar, NULL); + djui_base_set_enabled(&selectionbox4->base, false); + + char* bChoices[3] = { DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_OFF), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON_CAP) }; + struct DjuiSelectionbox* selectionbox5 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, BOUNCY_LEVEL_BOUNDS), bChoices, 3, &gServerSettings.bouncyLevelBounds, NULL); + djui_base_set_enabled(&selectionbox5->base, false); + + struct DjuiCheckbox* checkbox1 = djui_checkbox_create(body, DLANG(HOST_SETTINGS, SKIP_INTRO_CUTSCENE), (bool*)&gServerSettings.skipIntro, NULL); + djui_base_set_enabled(&checkbox1->base, false); + struct DjuiCheckbox* checkbox2 = djui_checkbox_create(body, DLANG(HOST_SETTINGS, PAUSE_ANYWHERE), (bool*)&gServerSettings.pauseAnywhere, NULL); + djui_base_set_enabled(&checkbox2->base, false); + struct DjuiCheckbox* checkbox3 = djui_checkbox_create(body, DLANG(HOST_SETTINGS, BUBBLE_ON_DEATH), (bool*)&gServerSettings.bubbleDeath, NULL); + djui_base_set_enabled(&checkbox3->base, false); + struct DjuiCheckbox* checkbox4 = djui_checkbox_create(body, DLANG(HOST_SETTINGS, NAMETAGS), (bool*)&gServerSettings.nametags, NULL); + djui_base_set_enabled(&checkbox4->base, false); + + struct DjuiRect* rect1 = djui_rect_container_create(body, 32); + { + struct DjuiText* text1 = djui_text_create(&rect1->base, DLANG(HOST_SETTINGS, AMOUNT_OF_PLAYERS)); + djui_base_set_size_type(&text1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_color(&text1->base, 220, 220, 220, 255); + djui_base_set_size(&text1->base, 0.585f, 64); + djui_base_set_alignment(&text1->base, DJUI_HALIGN_LEFT, DJUI_VALIGN_TOP); + djui_text_set_drop_shadow(text1, 64, 64, 64, 100); + + struct DjuiInputbox* inputbox1 = djui_inputbox_create(&rect1->base, 32); + djui_base_set_size_type(&inputbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&inputbox1->base, 0.45f, 32); + djui_base_set_alignment(&inputbox1->base, DJUI_HALIGN_RIGHT, DJUI_VALIGN_TOP); + char limitString[32] = { 0 }; + snprintf(limitString, 32, "%d", gServerSettings.maxPlayers); + djui_inputbox_set_text(inputbox1, limitString); + djui_base_set_enabled(&inputbox1->base, false); + } + + djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); + } + djui_panel_add(caller, panel, NULL); +} \ No newline at end of file diff --git a/src/pc/djui/djui_panel_client_server_settings.h b/src/pc/djui/djui_panel_client_server_settings.h new file mode 100644 index 000000000..b49d647c7 --- /dev/null +++ b/src/pc/djui/djui_panel_client_server_settings.h @@ -0,0 +1,4 @@ +#pragma once +#include "djui.h" + +void djui_panel_client_server_settings_create(struct DjuiBase* caller); \ No newline at end of file diff --git a/src/pc/djui/djui_panel_host_settings.c b/src/pc/djui/djui_panel_host_settings.c index 068a3b319..59837e116 100644 --- a/src/pc/djui/djui_panel_host_settings.c +++ b/src/pc/djui/djui_panel_host_settings.c @@ -92,4 +92,4 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) { djui_button_create(body, DLANG(MENU, BACK), DJUI_BUTTON_STYLE_BACK, djui_panel_menu_back); } djui_panel_add(caller, panel, NULL); -} +} \ No newline at end of file diff --git a/src/pc/djui/djui_panel_pause.c b/src/pc/djui/djui_panel_pause.c index 9c993053d..01250066c 100644 --- a/src/pc/djui/djui_panel_pause.c +++ b/src/pc/djui/djui_panel_pause.c @@ -5,6 +5,8 @@ #include "djui_panel_dynos.h" #include "djui_panel_options.h" #include "djui_panel_host.h" +#include "djui_panel_host_settings.h" +#include "djui_panel_client_server_settings.h" #include "djui_panel_menu.h" #include "djui_panel_confirm.h" #include "djui_panel_mod_menu.h" @@ -70,6 +72,8 @@ void djui_panel_pause_create(struct DjuiBase* caller) { if (gNetworkType == NT_SERVER) { djui_button_create(body, DLANG(PAUSE, SERVER_SETTINGS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_host_create); + } else { + djui_button_create(body, DLANG(PAUSE, SERVER_SETTINGS), DJUI_BUTTON_STYLE_NORMAL, djui_panel_client_server_settings_create); } struct Mod* addedMods[MAX_HOOKED_MOD_MENU_ELEMENTS] = { 0 }; From f87c1c8b749f6b0cda0908be03ea7b5f3bb4c5f8 Mon Sep 17 00:00:00 2001 From: EmeraldLockdown Date: Tue, 30 Sep 2025 18:02:44 -0500 Subject: [PATCH 2/4] Remove unecessary include --- src/pc/djui/djui_panel_pause.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pc/djui/djui_panel_pause.c b/src/pc/djui/djui_panel_pause.c index 01250066c..6a4c2ef9c 100644 --- a/src/pc/djui/djui_panel_pause.c +++ b/src/pc/djui/djui_panel_pause.c @@ -5,7 +5,6 @@ #include "djui_panel_dynos.h" #include "djui_panel_options.h" #include "djui_panel_host.h" -#include "djui_panel_host_settings.h" #include "djui_panel_client_server_settings.h" #include "djui_panel_menu.h" #include "djui_panel_confirm.h" From a170f75ae0686aa44e3b6e6e8576ee675afd0796 Mon Sep 17 00:00:00 2001 From: EmeraldLockdown <86802223+EmeraldLoc@users.noreply.github.com> Date: Sat, 14 Mar 2026 20:58:59 -0500 Subject: [PATCH 3/4] Address review --- src/pc/djui/djui_panel_client_server_settings.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/pc/djui/djui_panel_client_server_settings.c b/src/pc/djui/djui_panel_client_server_settings.c index 54222a977..02ab34e4f 100644 --- a/src/pc/djui/djui_panel_client_server_settings.c +++ b/src/pc/djui/djui_panel_client_server_settings.c @@ -8,6 +8,8 @@ #include "pc/configfile.h" #include "djui_inputbox.h" +static unsigned int sKnockbackIndex = 0; + void djui_panel_client_server_settings_create(struct DjuiBase* caller) { struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(HOST_SETTINGS, SETTINGS), false); struct DjuiBase* body = djui_three_panel_get_body(panel); @@ -16,9 +18,7 @@ void djui_panel_client_server_settings_create(struct DjuiBase* caller) { struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PLAYER_INTERACTION), iChoices, 3, &gServerSettings.playerInteractions, NULL); djui_base_set_enabled(&selectionbox1->base, false); - unsigned int sKnockbackIndex = (gServerSettings.playerKnockbackStrength <= 20) - ? 0 - : ((gServerSettings.playerKnockbackStrength <= 40) ? 1 : 2); + sKnockbackIndex = (gServerSettings.playerKnockbackStrength <= 20) ? 0 : ((gServerSettings.playerKnockbackStrength <= 40) ? 1 : 2); char* kChoices[3] = { DLANG(HOST_SETTINGS, WEAK), DLANG(HOST_SETTINGS, NORMAL), DLANG(HOST_SETTINGS, TOO_MUCH) }; struct DjuiSelectionbox* selectionbox2 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, KNOCKBACK_STRENGTH), kChoices, 3, &sKnockbackIndex, NULL); djui_base_set_enabled(&selectionbox2->base, false); @@ -27,9 +27,8 @@ void djui_panel_client_server_settings_create(struct DjuiBase* caller) { struct DjuiSelectionbox* selectionbox3 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PVP_MODE), pChoices, 2, &gServerSettings.pvpType, NULL); djui_base_set_enabled(&selectionbox3->base, false); - unsigned int sStayInLevelAfterStar = gServerSettings.stayInLevelAfterStar; char* lChoices[3] = { DLANG(HOST_SETTINGS, LEAVE_LEVEL), DLANG(HOST_SETTINGS, STAY_IN_LEVEL), DLANG(HOST_SETTINGS, NONSTOP) }; - struct DjuiSelectionbox* selectionbox4 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &sStayInLevelAfterStar, NULL); + struct DjuiSelectionbox* selectionbox4 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &gServerSettings.stayInLevelAfterStar, NULL); djui_base_set_enabled(&selectionbox4->base, false); char* bChoices[3] = { DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_OFF), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON_CAP) }; From 5913152ccb868d54e091768962178bd479de7386 Mon Sep 17 00:00:00 2001 From: EmeraldLockdown <86802223+EmeraldLoc@users.noreply.github.com> Date: Sun, 15 Mar 2026 14:42:41 -0500 Subject: [PATCH 4/4] Address reviews --- src/pc/djui/djui_panel_client_server_settings.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/pc/djui/djui_panel_client_server_settings.c b/src/pc/djui/djui_panel_client_server_settings.c index 02ab34e4f..a30d09b86 100644 --- a/src/pc/djui/djui_panel_client_server_settings.c +++ b/src/pc/djui/djui_panel_client_server_settings.c @@ -8,14 +8,19 @@ #include "pc/configfile.h" #include "djui_inputbox.h" +static unsigned int sPlayerInteractions = 0; static unsigned int sKnockbackIndex = 0; +static unsigned int sPvpType = 0; +static unsigned int sStayInLevelAfterStar = 0; +static unsigned int sBouncyLevelBounds = 0; void djui_panel_client_server_settings_create(struct DjuiBase* caller) { struct DjuiThreePanel* panel = djui_panel_menu_create(DLANG(HOST_SETTINGS, SETTINGS), false); struct DjuiBase* body = djui_three_panel_get_body(panel); { + sPlayerInteractions = gServerSettings.playerInteractions; char* iChoices[3] = { DLANG(HOST_SETTINGS, NONSOLID), DLANG(HOST_SETTINGS, SOLID), DLANG(HOST_SETTINGS, FRIENDLY_FIRE) }; - struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PLAYER_INTERACTION), iChoices, 3, &gServerSettings.playerInteractions, NULL); + struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PLAYER_INTERACTION), iChoices, 3, &sPlayerInteractions, NULL); djui_base_set_enabled(&selectionbox1->base, false); sKnockbackIndex = (gServerSettings.playerKnockbackStrength <= 20) ? 0 : ((gServerSettings.playerKnockbackStrength <= 40) ? 1 : 2); @@ -23,16 +28,19 @@ void djui_panel_client_server_settings_create(struct DjuiBase* caller) { struct DjuiSelectionbox* selectionbox2 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, KNOCKBACK_STRENGTH), kChoices, 3, &sKnockbackIndex, NULL); djui_base_set_enabled(&selectionbox2->base, false); + sPvpType = gServerSettings.pvpType; char* pChoices[2] = { DLANG(HOST_SETTINGS, CLASSIC_PVP), DLANG(HOST_SETTINGS, REVAMPED_PVP) }; - struct DjuiSelectionbox* selectionbox3 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PVP_MODE), pChoices, 2, &gServerSettings.pvpType, NULL); + struct DjuiSelectionbox* selectionbox3 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, PVP_MODE), pChoices, 2, &sPvpType, NULL); djui_base_set_enabled(&selectionbox3->base, false); + sStayInLevelAfterStar = gServerSettings.stayInLevelAfterStar; char* lChoices[3] = { DLANG(HOST_SETTINGS, LEAVE_LEVEL), DLANG(HOST_SETTINGS, STAY_IN_LEVEL), DLANG(HOST_SETTINGS, NONSTOP) }; - struct DjuiSelectionbox* selectionbox4 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &gServerSettings.stayInLevelAfterStar, NULL); + struct DjuiSelectionbox* selectionbox4 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &sStayInLevelAfterStar, NULL); djui_base_set_enabled(&selectionbox4->base, false); + sBouncyLevelBounds = gServerSettings.bouncyLevelBounds; char* bChoices[3] = { DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_OFF), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON), DLANG(HOST_SETTINGS, BOUNCY_BOUNDS_ON_CAP) }; - struct DjuiSelectionbox* selectionbox5 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, BOUNCY_LEVEL_BOUNDS), bChoices, 3, &gServerSettings.bouncyLevelBounds, NULL); + struct DjuiSelectionbox* selectionbox5 = djui_selectionbox_create(body, DLANG(HOST_SETTINGS, BOUNCY_LEVEL_BOUNDS), bChoices, 3, &sBouncyLevelBounds, NULL); djui_base_set_enabled(&selectionbox5->base, false); struct DjuiCheckbox* checkbox1 = djui_checkbox_create(body, DLANG(HOST_SETTINGS, SKIP_INTRO_CUTSCENE), (bool*)&gServerSettings.skipIntro, NULL);