From 511e7c5028c4509d50101dc9b0527cc3a67957c3 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 15 Jan 2022 21:50:35 -0800 Subject: [PATCH] Prevent bubble softlock by halting bubble popping for half a second after being bubbled --- developer/network.sh | 8 ++++---- src/game/mario.c | 5 +++++ src/game/mario.h | 2 ++ src/game/mario_actions_automatic.c | 4 +++- src/pc/controller/controller_keyboard_debug.c | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/developer/network.sh b/developer/network.sh index 0d095ced..b274aefe 100644 --- a/developer/network.sh +++ b/developer/network.sh @@ -18,10 +18,10 @@ fi #exit # no debug, direct -#$FILE --server 27015 --configfile sm64config_server.txt & -#sleep 7 -#$FILE --client 127.0.0.1 27015 --configfile sm64config_client.txt & -#exit +$FILE --server 27015 --configfile sm64config_server.txt & +sleep 7 +$FILE --client 127.0.0.1 27015 --configfile sm64config_client.txt & +exit # debug on server #$FILE --client 127.0.0.1 27015 --configfile sm64config_client.txt & diff --git a/src/game/mario.c b/src/game/mario.c index 21f5d937..18c86d6b 100644 --- a/src/game/mario.c +++ b/src/game/mario.c @@ -49,6 +49,8 @@ u32 unused80339F10; s8 filler80339F1C[20]; +u16 gLocalBubbleCounter = 0; + /************************************************** * ANIMATIONS * @@ -391,6 +393,9 @@ void play_mario_sound(struct MarioState *m, s32 actionSound, s32 marioSound) { void mario_set_bubbled(struct MarioState* m) { if (m->playerIndex != 0) { return; } if (m->action == ACT_BUBBLED) { return; } + + gLocalBubbleCounter = 20; + set_mario_action(m, ACT_BUBBLED, 0); if (m->numLives != -1) { m->numLives--; diff --git a/src/game/mario.h b/src/game/mario.h index 1683ecda..964d51f0 100644 --- a/src/game/mario.h +++ b/src/game/mario.h @@ -6,6 +6,8 @@ #include "macros.h" #include "types.h" +extern u16 gLocalBubbleCounter; + s32 is_anim_at_end(struct MarioState *m); s32 is_anim_past_end(struct MarioState *m); s16 set_mario_animation(struct MarioState *m, s32 targetAnimID); diff --git a/src/game/mario_actions_automatic.c b/src/game/mario_actions_automatic.c index 0aee87bf..d7797f4f 100644 --- a/src/game/mario_actions_automatic.c +++ b/src/game/mario_actions_automatic.c @@ -1008,8 +1008,10 @@ s32 act_bubbled(struct MarioState* m) { } } + if (gLocalBubbleCounter > 0) { gLocalBubbleCounter--; } + // pop bubble - if (m->playerIndex == 0 && distanceToPlayer < 120 && is_player_active(targetMarioState) && m->numLives != -1) { + if (m->playerIndex == 0 && distanceToPlayer < 120 && is_player_active(targetMarioState) && m->numLives != -1 && gLocalBubbleCounter <= 0) { m->marioObj->activeFlags &= ~ACTIVE_FLAG_MOVE_THROUGH_GRATE; m->hurtCounter = 0; m->healCounter = 31; diff --git a/src/pc/controller/controller_keyboard_debug.c b/src/pc/controller/controller_keyboard_debug.c index bb2ebb7b..0ba62e73 100644 --- a/src/pc/controller/controller_keyboard_debug.c +++ b/src/pc/controller/controller_keyboard_debug.c @@ -13,7 +13,7 @@ #ifdef DEBUG -static u8 warpToLevel = LEVEL_RR; +static u8 warpToLevel = LEVEL_SSL; static u8 warpToArea = 27; // warpToArea: 26 = basement // warpToArea: 27 = upstairs