From cf4df98fc50756d2f8a2ba838af50a44c2fc522a Mon Sep 17 00:00:00 2001 From: EmeraldLockdown <86802223+EmeraldLoc@users.noreply.github.com> Date: Sun, 10 May 2026 15:39:14 -0500 Subject: [PATCH] Fix up king bobom --- src/game/behaviors/king_bobomb.inc.c | 23 +++++++++-------------- src/game/behaviors/treasure_chest.inc.c | 1 - 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c index 41a5890a4..49b1e397d 100644 --- a/src/game/behaviors/king_bobomb.inc.c +++ b/src/game/behaviors/king_bobomb.inc.c @@ -60,6 +60,7 @@ void king_bobomb_act_0(void) { if (marioState && should_start_or_continue_dialog(marioState, o) && cur_obj_can_mario_activate_textbox_2(marioState, 500.0f, 100.0f)) { o->oSubAction++; o->globalPlayerIndex = network_global_index_from_local(marioState->playerIndex); + network_send_object(o); seq_player_lower_volume(SEQ_PLAYER_LEVEL, 60, 40); } } else { @@ -75,7 +76,7 @@ void king_bobomb_act_0(void) { if (marioState && should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(marioState, 2, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingBobombIntroDialog, king_bobomb_act_0_continue_dialog)) { o->oAction = 2; o->oFlags |= OBJ_FLAG_HOLDABLE; - network_send_object(o); // force send + network_send_object(o); } } } @@ -241,12 +242,8 @@ void king_bobomb_act_7(void) { if (o->globalPlayerIndex >= MAX_PLAYERS) o->globalPlayerIndex = 0; struct MarioState *marioState = &gMarioStates[network_local_index_from_global(o->globalPlayerIndex)]; - if (!is_player_active(marioState)) { - // use player with the smallest global index instead - marioState = &gMarioStates[get_network_player_smallest_global()->localIndex]; - } // update dialog if we are within king bobomb's area - bool canUpdateDialog = (marioState->pos[1] >= o->oPosY - 100.0f && marioState->visibleToEnemies); + bool canUpdateDialog = (marioState->pos[1] >= o->oPosY - 100.0f && is_player_active(marioState) && marioState->visibleToEnemies); if (!canUpdateDialog) { // iterate through players via global index until we find someone who can for (int i = 0; i < MAX_PLAYERS; i++) { @@ -254,9 +251,10 @@ void king_bobomb_act_7(void) { if (!np) continue; marioState = &gMarioStates[np->localIndex]; - if (!is_player_active(marioState)) continue; - canUpdateDialog = (marioState->pos[1] >= o->oPosY - 100.0f && marioState->visibleToEnemies); + canUpdateDialog = (marioState->pos[1] >= o->oPosY - 100.0f && is_player_active(marioState) && marioState->visibleToEnemies); if (!canUpdateDialog) continue; + o->globalPlayerIndex = np->globalIndex; + network_send_object(o); break; } @@ -374,17 +372,15 @@ void king_bobomb_act_5(void) { // bobomb returns home if (marioState && should_start_or_continue_dialog(marioState, o) && cur_obj_can_mario_activate_textbox_2(marioState, 500.0f, 100.0f)) { o->oSubAction++; o->globalPlayerIndex = network_global_index_from_local(marioState->playerIndex); + network_send_object(o); } break; case 4: if (o->globalPlayerIndex >= MAX_PLAYERS) o->globalPlayerIndex = 0; marioState = &gMarioStates[network_local_index_from_global(o->globalPlayerIndex)]; if (!is_player_active(marioState) || !marioState->visibleToEnemies) { - // use player with the smallest global index instead - struct NetworkPlayer *np = get_network_player_smallest_global(); - marioState = &gMarioStates[np->localIndex]; - o->globalPlayerIndex = np->globalIndex; - network_send_object(o); + // go back to sub action 3 and look for a new player + o->oSubAction = 3; } if (marioState && should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(marioState, 2, 1, CUTSCENE_DIALOG, gBehaviorValues.dialogs.KingBobombCheatDialog, king_bobomb_act_5_continue_dialog)) { o->oAction = 2; @@ -440,7 +436,6 @@ void bhv_king_bobomb_override_ownership(u8 *shouldOverride, u8 *shouldOwn) { if (o->oAction == 0 || o->oAction == 5 || o->oAction == 7) { // dialog actions if (o->globalPlayerIndex >= MAX_PLAYERS) o->globalPlayerIndex = 0; struct MarioState *marioState = &gMarioStates[network_local_index_from_global(o->globalPlayerIndex)]; - if (!is_player_active(marioState)) marioState = &gMarioStates[get_network_player_smallest_global()->localIndex]; *shouldOverride = TRUE; *shouldOwn = (marioState->playerIndex == 0); return; diff --git a/src/game/behaviors/treasure_chest.inc.c b/src/game/behaviors/treasure_chest.inc.c index 33869cac5..dcdd53e6c 100644 --- a/src/game/behaviors/treasure_chest.inc.c +++ b/src/game/behaviors/treasure_chest.inc.c @@ -15,7 +15,6 @@ static struct ObjectHitbox sTreasureChestBottomHitbox = { .hurtboxHeight = 310, }; - void bhv_treasure_chest_top_loop(void) { if (!o->parentObj || !o->parentObj->parentObj) { obj_mark_for_deletion(o);