From e48670a2ef902d1d6c960ac8dafe855479018c56 Mon Sep 17 00:00:00 2001 From: Agent X <44549182+Agent-11@users.noreply.github.com> Date: Sun, 17 Mar 2024 18:05:44 -0400 Subject: [PATCH] Fix red coin, secret, caps, WF platforms and goomba bhv overrides being broken --- src/engine/level_script.c | 4 ++-- src/game/behaviors/tower_platform.inc.c | 2 +- src/game/interaction.c | 10 +++++----- src/pc/network/packets/packet_level_macro.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/engine/level_script.c b/src/engine/level_script.c index 29621ff4a..200e1f2fc 100644 --- a/src/engine/level_script.c +++ b/src/engine/level_script.c @@ -132,9 +132,9 @@ static void area_check_red_coin_or_secret(void *arg, bool isMacroObject) { } else { bhv = (const BehaviorScript *) arg; } - if (bhv == bhvRedCoin) { + if (bhv == smlua_override_behavior(bhvRedCoin)) { gAreas[sCurrAreaIndex].numRedCoins++; - } else if (bhv == bhvHiddenStarTrigger) { + } else if (bhv == smlua_override_behavior(bhvHiddenStarTrigger)) { gAreas[sCurrAreaIndex].numSecrets++; } } diff --git a/src/game/behaviors/tower_platform.inc.c b/src/game/behaviors/tower_platform.inc.c index 5856e1f7b..3fa9f045c 100644 --- a/src/game/behaviors/tower_platform.inc.c +++ b/src/game/behaviors/tower_platform.inc.c @@ -102,7 +102,7 @@ void spawn_and_init_wf_platforms(s16 a, const BehaviorScript *bhv) { o->oPlatformSpawnerUnkF4++; if (platform != NULL) { - if (bhv == bhvWfSolidTowerPlatform || bhv == bhvWfSlidingTowerPlatform) { + if (bhv == smlua_override_behavior(bhvWfSolidTowerPlatform) || bhv == smlua_override_behavior(bhvWfSlidingTowerPlatform)) { u32 loopTime = 1 + (platform->oPlatformUnk110 / platform->oPlatformUnk10C); loopTime *= 2; loopTime += 1; diff --git a/src/game/interaction.c b/src/game/interaction.c index ef1fca3e1..cf72ed674 100644 --- a/src/game/interaction.c +++ b/src/game/interaction.c @@ -130,13 +130,13 @@ u32 get_mario_cap_flag(struct Object *capObject) { if (!capObject) { return 0; } const BehaviorScript *script = virtual_to_segmented(0x13, capObject->behavior); - if (script == bhvNormalCap) { + if (script == smlua_override_behavior(bhvNormalCap)) { return MARIO_NORMAL_CAP; - } else if (script == bhvMetalCap) { + } else if (script == smlua_override_behavior(bhvMetalCap)) { return MARIO_METAL_CAP; - } else if (script == bhvWingCap) { + } else if (script == smlua_override_behavior(bhvWingCap)) { return MARIO_WING_CAP; - } else if (script == bhvVanishCap) { + } else if (script == smlua_override_behavior(bhvVanishCap)) { return MARIO_VANISH_CAP; } @@ -914,7 +914,7 @@ u32 interact_star_or_key(struct MarioState *m, UNUSED u32 interactType, struct O u8 stayInLevelCommon = !(gCurrLevelNum == LEVEL_BOWSER_1 || gCurrLevelNum == LEVEL_BOWSER_2 || gCurrLevelNum == LEVEL_BOWSER_3); if (stayInLevelCommon && gServerSettings.stayInLevelAfterStar) { noExit = TRUE; } - gLastCollectedStarOrKey = o->behavior == bhvBowserKey; + gLastCollectedStarOrKey = o->behavior == smlua_override_behavior(bhvBowserKey); if (m->health >= 0x100) { diff --git a/src/pc/network/packets/packet_level_macro.c b/src/pc/network/packets/packet_level_macro.c index f858a0572..5020748f1 100644 --- a/src/pc/network/packets/packet_level_macro.c +++ b/src/pc/network/packets/packet_level_macro.c @@ -207,7 +207,7 @@ void network_receive_level_macro(struct Packet* p) { } } LOG_INFO("rx macro special: coin formation"); - } else if (behavior == bhvGoombaTripletSpawner) { + } else if (behavior == smlua_override_behavior(bhvGoombaTripletSpawner)) { for (s32 i = 0; i < OBJECT_POOL_CAPACITY; i++) { struct Object* o2 = &gObjectPool[i]; if (o2->parentObj != o) { continue; }