From 0fc5f0d768d8364238bb6307031c08491efdbe85 Mon Sep 17 00:00:00 2001 From: Prince Frizzy Date: Sat, 26 Feb 2022 05:46:08 -0500 Subject: [PATCH 1/2] Proper NULL check for this in water_ring.c The water ring index should NOT increment if a water ring fails to spawn. --- src/game/behaviors/water_ring.inc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/game/behaviors/water_ring.inc.c b/src/game/behaviors/water_ring.inc.c index f36bdf70..d0db20f2 100644 --- a/src/game/behaviors/water_ring.inc.c +++ b/src/game/behaviors/water_ring.inc.c @@ -170,10 +170,11 @@ void water_ring_spawner_act_inactive(void) { waterRing = spawn_object(o, MODEL_WATER_RING, bhvJetStreamWaterRing); if (waterRing != NULL) { waterRing->oWaterRingIndex = currentObj->oWaterRingMgrNextRingIndex; + currentObj->oWaterRingMgrNextRingIndex++; + if (currentObj->oWaterRingMgrNextRingIndex >= 10001) { + currentObj->oWaterRingMgrNextRingIndex = 0; + } } - currentObj->oWaterRingMgrNextRingIndex++; - if (currentObj->oWaterRingMgrNextRingIndex >= 10001) - currentObj->oWaterRingMgrNextRingIndex = 0; } } From 169cd9fa44bc658212199b35ab6ec49c1347e20e Mon Sep 17 00:00:00 2001 From: Prince Frizzy Date: Sat, 26 Feb 2022 05:50:45 -0500 Subject: [PATCH 2/2] Revise this fix in mario_actions_automatic.c Have Mario drop off the pole if it doesn't exist instead of just returning POLE_NONE. --- src/game/mario_actions_automatic.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 6b70202e..abca6f3d 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -65,7 +65,14 @@ void play_climbing_sounds(struct MarioState *m, s32 b) { s32 set_pole_position(struct MarioState *m, f32 offsetY) { if (m->usedObj == NULL) { m->usedObj = cur_obj_find_nearest_pole(); } - if (m->usedObj == NULL) { return POLE_NONE; } + + // This is here so if somehow a pole despawns while you are on it. + // You will just drop from it. + if (m->usedObj == NULL) { + // If Mario is no longer interacting with the pole, stop the pole holding action. + set_mario_action(m, ACT_FREEFALL, 0); + return POLE_FELL_OFF; + } UNUSED s32 unused1; UNUSED s32 unused2;