From ee967c30963f6893486154ff29a7bc817406373a Mon Sep 17 00:00:00 2001 From: Isaac <62234577+Isaac0-dev@users.noreply.github.com> Date: Sun, 13 Mar 2022 10:06:18 +1000 Subject: [PATCH] Added an option to disable Popups for deaths and level exit/entry (#20) --- src/pc/configfile.c | 2 ++ src/pc/configfile.h | 1 + src/pc/djui/djui_panel_display.c | 6 +++++- src/pc/network/network_player.c | 4 +++- src/pc/network/packets/packet_player.c | 4 +++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/pc/configfile.c b/src/pc/configfile.c index 479de8ba5..5733a029c 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -113,6 +113,7 @@ bool configCameraMouse = false; bool configSkipIntro = 0; bool configShareLives = 0; bool configEnableCheats = 0; +bool configDisablePopups = 0; bool configBubbleDeath = true; unsigned int configAmountofPlayers = 16; bool configHUD = true; @@ -186,6 +187,7 @@ static const struct ConfigOption options[] = { {.name = "bettercam_degrade", .type = CONFIG_TYPE_UINT, .uintValue = &configCameraDegrade}, #endif {.name = "skip_intro", .type = CONFIG_TYPE_BOOL, .boolValue = &configSkipIntro}, + {.name = "enable_popups", .type = CONFIG_TYPE_BOOL, .boolValue = &configDisablePopups}, {.name = "enable_cheats", .type = CONFIG_TYPE_BOOL, .boolValue = &configEnableCheats}, #ifdef DISCORDRPC {.name = "discordrpc_enable", .type = CONFIG_TYPE_BOOL, .boolValue = &configDiscordRPC}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 4bc21f469..b27490e7c 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -71,6 +71,7 @@ extern bool configHUD; extern bool configSkipIntro; extern bool configShareLives; extern bool configEnableCheats; +extern bool configDisablePopups; extern bool configBubbleDeath; extern unsigned int configAmountofPlayers; #ifdef DISCORDRPC diff --git a/src/pc/djui/djui_panel_display.c b/src/pc/djui/djui_panel_display.c index 51247b95e..d9d3df256 100644 --- a/src/pc/djui/djui_panel_display.c +++ b/src/pc/djui/djui_panel_display.c @@ -7,7 +7,7 @@ static void djui_panel_display_apply(UNUSED struct DjuiBase* caller) { } void djui_panel_display_create(struct DjuiBase* caller) { - f32 bodyHeight = 32 * 7 + 64 * 2 + 16 * 7; + f32 bodyHeight = 32 * 7 + 64 * 2 + 32 * 7; struct DjuiBase* defaultBase = NULL; struct DjuiThreePanel* panel = djui_panel_menu_create(bodyHeight, "\\#ff0800\\D\\#1be700\\I\\#00b3ff\\S\\#ffef00\\P\\#ff0800\\L\\#1be700\\A\\#00b3ff\\Y"); @@ -29,6 +29,10 @@ void djui_panel_display_create(struct DjuiBase* caller) { djui_base_set_size_type(&checkbox4->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); djui_base_set_size(&checkbox4->base, 1.0f, 32); + struct DjuiCheckbox* checkbox5 = djui_checkbox_create(&body->base, "Disable Popups", &configDisablePopups); + djui_base_set_size_type(&checkbox5->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); + djui_base_set_size(&checkbox5->base, 1.0f, 32); + char* filterChoices[3] = { "Nearest", "Linear", "Tripoint" }; struct DjuiSelectionbox* selectionbox1 = djui_selectionbox_create(&body->base, "Filtering", filterChoices, 3, &configFiltering); djui_base_set_size_type(&selectionbox1->base, DJUI_SVT_RELATIVE, DJUI_SVT_ABSOLUTE); diff --git a/src/pc/network/network_player.c b/src/pc/network/network_player.c index 8e41b6b32..ca077e8b0 100644 --- a/src/pc/network/network_player.c +++ b/src/pc/network/network_player.c @@ -327,7 +327,9 @@ void network_player_update_course_level(struct NetworkPlayer* np, s16 courseNum, } else { snprintf(popupMsg, 128, "%s%s\\#dcdcdc\\ entered\n%s", playerColorString, np->name, get_level_name(courseNum, levelNum, areaIndex)); } - djui_popup_create(popupMsg, 1); + if (configDisablePopups == 0) { + djui_popup_create(popupMsg, 1); + } } np->currCourseNum = courseNum; diff --git a/src/pc/network/packets/packet_player.c b/src/pc/network/packets/packet_player.c index 8f66ff0c5..37108f7ef 100644 --- a/src/pc/network/packets/packet_player.c +++ b/src/pc/network/packets/packet_player.c @@ -344,7 +344,9 @@ void network_receive_player(struct Packet* p) { char* playerColorString = network_get_player_text_color_string(np->localIndex); char popupMsg[128] = { 0 }; snprintf(popupMsg, 128, "%s%s\\#dcdcdc\\ died", playerColorString, np->name); - djui_popup_create(popupMsg, 1); + if (configDisablePopups == 0) { + djui_popup_create(popupMsg, 1); + } } // action changed, reset timer