mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2026-06-23 16:23:12 +00:00
Fix up king bobom
This commit is contained in:
parent
7924b3057a
commit
cf4df98fc5
2 changed files with 9 additions and 15 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue