From 92da90bf3f8c941472eb12659b0f2403be863ba5 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Thu, 20 Apr 2023 07:02:00 -0400 Subject: [PATCH] Remove Share Lives (#351) it's a leftover from the very early betas, it isn't needed and isn't even fully functional anyway. Also potentially fixed mario_get_floor_class crash --- autogen/lua_definitions/structs.lua | 1 - docs/lua/structs.md | 1 - src/game/mario.c | 5 +---- src/pc/configfile.c | 2 -- src/pc/configfile.h | 1 - src/pc/djui/djui_panel_host_settings.c | 1 - src/pc/lua/smlua_cobject_autogen.c | 3 +-- src/pc/network/network.c | 2 -- src/pc/network/network.h | 1 - src/pc/network/packets/packet_join.c | 2 -- 10 files changed, 2 insertions(+), 17 deletions(-) diff --git a/autogen/lua_definitions/structs.lua b/autogen/lua_definitions/structs.lua index fe37b4720..81b5f76d5 100644 --- a/autogen/lua_definitions/structs.lua +++ b/autogen/lua_definitions/structs.lua @@ -1725,7 +1725,6 @@ --- @field public maxPlayers integer --- @field public playerInteractions PlayerInteractions --- @field public playerKnockbackStrength integer ---- @field public shareLives integer --- @field public skipIntro integer --- @field public stayInLevelAfterStar integer diff --git a/docs/lua/structs.md b/docs/lua/structs.md index 9a80c9bfe..b7295a573 100644 --- a/docs/lua/structs.md +++ b/docs/lua/structs.md @@ -2185,7 +2185,6 @@ | maxPlayers | `integer` | | | playerInteractions | [enum PlayerInteractions](constants.md#enum-PlayerInteractions) | | | playerKnockbackStrength | `integer` | | -| shareLives | `integer` | | | skipIntro | `integer` | | | stayInLevelAfterStar | `integer` | | diff --git a/src/game/mario.c b/src/game/mario.c index d1cdb75ea..beda5e912 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -428,9 +428,6 @@ void mario_set_bubbled(struct MarioState* m) { set_mario_action(m, ACT_BUBBLED, 0); if (m->numLives != -1) { m->numLives--; - if (gServerSettings.shareLives) { - network_send_death(); - } } m->healCounter = 0; m->hurtCounter = 31; @@ -503,7 +500,7 @@ s32 mario_get_floor_class(struct MarioState *m) { } // Crawling allows Mario to not slide on certain steeper surfaces. - if (m->action == ACT_CRAWLING && m->floor->normal.y > 0.5f && floorClass == SURFACE_CLASS_DEFAULT) { + if (m->action == ACT_CRAWLING && m->floor && m->floor->normal.y > 0.5f && floorClass == SURFACE_CLASS_DEFAULT) { floorClass = SURFACE_CLASS_NOT_SLIPPERY; } diff --git a/src/pc/configfile.c b/src/pc/configfile.c index dc3259052..ac7be1aa7 100644 --- a/src/pc/configfile.c +++ b/src/pc/configfile.c @@ -115,7 +115,6 @@ bool configCameraAnalog = true; bool configCameraMouse = false; #endif bool configSkipIntro = 0; -bool configShareLives = 0; bool configEnableCheats = 0; bool configBubbleDeath = true; unsigned int configAmountofPlayers = 16; @@ -249,7 +248,6 @@ static const struct ConfigOption options[] = { {.name = "coop_custom_palette_cap", .type = CONFIG_TYPE_COLOR , .colorValue = &configCustomPalette.parts[CAP]}, {.name = "coop_stay_in_level_after_star", .type = CONFIG_TYPE_UINT , .uintValue = &configStayInLevelAfterStar}, {.name = "coop_singleplayer_pause", .type = CONFIG_TYPE_BOOL , .boolValue = &configSingleplayerPause}, - {.name = "share_lives", .type = CONFIG_TYPE_BOOL , .boolValue = &configShareLives}, {.name = "disable_popups", .type = CONFIG_TYPE_BOOL , .boolValue = &configDisablePopups}, #if defined(DEVELOPMENT) {.name = "lua_profiler", .type = CONFIG_TYPE_BOOL , .boolValue = &configLuaProfiler}, diff --git a/src/pc/configfile.h b/src/pc/configfile.h index 54b0bb6a2..eabde56a2 100644 --- a/src/pc/configfile.h +++ b/src/pc/configfile.h @@ -76,7 +76,6 @@ extern bool configCameraAnalog; #endif extern bool configHUD; extern bool configSkipIntro; -extern bool configShareLives; extern bool configEnableCheats; extern bool configBubbleDeath; extern unsigned int configAmountofPlayers; diff --git a/src/pc/djui/djui_panel_host_settings.c b/src/pc/djui/djui_panel_host_settings.c index a2ff31163..c355e1d14 100644 --- a/src/pc/djui/djui_panel_host_settings.c +++ b/src/pc/djui/djui_panel_host_settings.c @@ -60,7 +60,6 @@ void djui_panel_host_settings_create(struct DjuiBase* caller) { djui_selectionbox_create(body, DLANG(HOST_SETTINGS, ON_STAR_COLLECTION), lChoices, 3, &configStayInLevelAfterStar, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, SKIP_INTRO_CUTSCENE), &configSkipIntro, NULL); - djui_checkbox_create(body, DLANG(HOST_SETTINGS, SHARE_LIVES), &configShareLives, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, ENABLE_CHEATS), &configEnableCheats, NULL); djui_checkbox_create(body, DLANG(HOST_SETTINGS, BUBBLE_ON_DEATH), &configBubbleDeath, NULL); diff --git a/src/pc/lua/smlua_cobject_autogen.c b/src/pc/lua/smlua_cobject_autogen.c index 68eb961a1..8dc731185 100644 --- a/src/pc/lua/smlua_cobject_autogen.c +++ b/src/pc/lua/smlua_cobject_autogen.c @@ -1888,7 +1888,7 @@ static struct LuaObjectField sRayIntersectionInfoFields[LUA_RAY_INTERSECTION_INF { "surface", LVT_COBJECT_P, offsetof(struct RayIntersectionInfo, surface), false, LOT_SURFACE }, }; -#define LUA_SERVER_SETTINGS_FIELD_COUNT 11 +#define LUA_SERVER_SETTINGS_FIELD_COUNT 10 static struct LuaObjectField sServerSettingsFields[LUA_SERVER_SETTINGS_FIELD_COUNT] = { { "bubbleDeath", LVT_U8, offsetof(struct ServerSettings, bubbleDeath), false, LOT_NONE }, { "enableCheats", LVT_U8, offsetof(struct ServerSettings, enableCheats), false, LOT_NONE }, @@ -1898,7 +1898,6 @@ static struct LuaObjectField sServerSettingsFields[LUA_SERVER_SETTINGS_FIELD_COU { "maxPlayers", LVT_U8, offsetof(struct ServerSettings, maxPlayers), false, LOT_NONE }, { "playerInteractions", LVT_S32, offsetof(struct ServerSettings, playerInteractions), false, LOT_NONE }, { "playerKnockbackStrength", LVT_U8, offsetof(struct ServerSettings, playerKnockbackStrength), false, LOT_NONE }, - { "shareLives", LVT_U8, offsetof(struct ServerSettings, shareLives), false, LOT_NONE }, { "skipIntro", LVT_U8, offsetof(struct ServerSettings, skipIntro), false, LOT_NONE }, { "stayInLevelAfterStar", LVT_U8, offsetof(struct ServerSettings, stayInLevelAfterStar), false, LOT_NONE }, }; diff --git a/src/pc/network/network.c b/src/pc/network/network.c index 1d268c98a..11fe939c3 100644 --- a/src/pc/network/network.c +++ b/src/pc/network/network.c @@ -71,7 +71,6 @@ struct ServerSettings gServerSettings = { .playerInteractions = PLAYER_INTERACTIONS_SOLID, .playerKnockbackStrength = 25, .skipIntro = 0, - .shareLives = 0, .enableCheats = 0, .bubbleDeath = 1, .enablePlayersInLevelDisplay = 1, @@ -112,7 +111,6 @@ bool network_init(enum NetworkType inNetworkType, bool reconnecting) { gServerSettings.playerKnockbackStrength = configPlayerKnockbackStrength; gServerSettings.stayInLevelAfterStar = configStayInLevelAfterStar; gServerSettings.skipIntro = configSkipIntro; - gServerSettings.shareLives = configShareLives; gServerSettings.enableCheats = configEnableCheats; gServerSettings.bubbleDeath = configBubbleDeath; gServerSettings.maxPlayers = configAmountofPlayers; diff --git a/src/pc/network/network.h b/src/pc/network/network.h index 7f12e95e1..851564f92 100644 --- a/src/pc/network/network.h +++ b/src/pc/network/network.h @@ -68,7 +68,6 @@ struct ServerSettings { u8 playerKnockbackStrength; u8 stayInLevelAfterStar; u8 skipIntro; - u8 shareLives; u8 enableCheats; u8 bubbleDeath; u8 enablePlayersInLevelDisplay; diff --git a/src/pc/network/packets/packet_join.c b/src/pc/network/packets/packet_join.c index 4cc4f321a..59fca59ec 100644 --- a/src/pc/network/packets/packet_join.c +++ b/src/pc/network/packets/packet_join.c @@ -115,7 +115,6 @@ void network_send_join(struct Packet* joinRequestPacket) { packet_write(&p, &gServerSettings.playerKnockbackStrength, sizeof(u8)); packet_write(&p, &gServerSettings.stayInLevelAfterStar, sizeof(u8)); packet_write(&p, &gServerSettings.skipIntro, sizeof(u8)); - packet_write(&p, &gServerSettings.shareLives, sizeof(u8)); packet_write(&p, &gServerSettings.enableCheats, sizeof(u8)); packet_write(&p, &gServerSettings.bubbleDeath, sizeof(u8)); packet_write(&p, &gServerSettings.headlessServer, sizeof(u8)); @@ -180,7 +179,6 @@ void network_receive_join(struct Packet* p) { packet_read(p, &gServerSettings.playerKnockbackStrength, sizeof(u8)); packet_read(p, &gServerSettings.stayInLevelAfterStar, sizeof(u8)); packet_read(p, &gServerSettings.skipIntro, sizeof(u8)); - packet_read(p, &gServerSettings.shareLives, sizeof(u8)); packet_read(p, &gServerSettings.enableCheats, sizeof(u8)); packet_read(p, &gServerSettings.bubbleDeath, sizeof(u8)); packet_read(p, &gServerSettings.headlessServer, sizeof(u8));