Fix King Bobomb dialog softlock

Fixes #45
This commit is contained in:
MysterD 2020-09-10 21:26:17 -07:00
parent 975f78cc5e
commit a1d21a9602
7 changed files with 27 additions and 30 deletions

View File

@ -1,8 +1,8 @@
set -e
if [ $# -eq 0 ]; then
make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 -j
else
make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 STRICT=1 -j
else
make BETTERCAMERA=1 NODRAWINGDISTANCE=1 DEBUG=1 IMMEDIATELOAD=1 -j
fi
# find file

View File

@ -733,12 +733,8 @@ static void (*sBooGivingStarActions[])(void) = {
big_boo_act_4
};
u8 big_boo_ignore_update(struct Object* obj) {
struct Object* tmp = gCurrentObject;
gCurrentObject = obj;
u8 rc = cur_obj_has_behavior(bhvGhostHuntBigBoo) && !bigBooActivated;
gCurrentObject = tmp;
return rc;
u8 big_boo_ignore_update(void) {
return cur_obj_has_behavior(bhvGhostHuntBigBoo) && !bigBooActivated;
}
void bhv_big_boo_loop(void) {

View File

@ -146,9 +146,9 @@ u8 unused0EA1FC[] = { 2, 0, 0, 0, 0, 0, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0
63, 128, 0, 0, 2, 0, 0, 0, 65, 160, 0, 0, 63, 128, 0, 0, 2, 0, 0, 0,
65, 160, 0, 0, 63, 128, 0, 0, 8, 0, 0, 0, 65, 32, 0, 0, 63, 128, 0, 0 };
u8 cannon_ignore_remote_updates(struct Object* object) {
u8 cannon_ignore_remote_updates(void) {
// two-player hack
return ((gNetworkType == NT_SERVER) && object->oCannonIsLocal);
return ((gNetworkType == NT_SERVER) && o->oCannonIsLocal);
}
static void cannon_on_received(void) {

View File

@ -215,7 +215,16 @@ u8 king_bobomb_act_7_continue_dialog(void) { return o->oAction == 7; }
void king_bobomb_act_7(void) {
cur_obj_init_animation_with_sound(2);
if (nearest_mario_state_to_object(o) == &gMarioStates[0] && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 2, CUTSCENE_DIALOG, DIALOG_116, king_bobomb_act_7_continue_dialog)) {
u8 updateDialog = (nearest_mario_state_to_object(o) == &gMarioStates[0]) || (gMarioStates[0].pos[1] >= o->oPosY - 100.0f);
if (updateDialog && cur_obj_update_dialog_with_cutscene(&gMarioStates[0], 2, 2, CUTSCENE_DIALOG, DIALOG_116, king_bobomb_act_7_continue_dialog)) {
o->oAction = 8;
network_send_object(o);
}
}
void king_bobomb_act_8(void) {
if (!(o->header.gfx.node.flags & GRAPH_RENDER_INVISIBLE)) {
create_sound_spawner(SOUND_OBJ_KING_WHOMP_DEATH);
cur_obj_hide();
cur_obj_become_intangible();
@ -228,11 +237,7 @@ void king_bobomb_act_7(void) {
o->oPosY += 100.0f;
spawn_default_star(2000.0f, 4500.0f, -4500.0f);
#endif
o->oAction = 8;
}
}
void king_bobomb_act_8(void) {
if (o->oTimer == 60)
stop_background_music(SEQUENCE_ARGS(4, SEQ_EVENT_BOSS));
}
@ -354,14 +359,15 @@ void king_bobomb_move(void) {
#endif
}
u8 king_bobomb_ignore_if_true(void) { return o->oAction == 8; }
void bhv_king_bobomb_loop(void) {
if (!network_sync_object_initialized(o)) {
network_init_object(o, 4000.0f);
struct SyncObject* so = network_init_object(o, 4000.0f);
so->ignore_if_true = &king_bobomb_ignore_if_true;
network_init_object_field(o, &o->oKingBobombUnk88);
network_init_object_field(o, &o->oFlags);
network_init_object_field(o, &o->oHealth);
network_init_object_field(o, &o->oDialogState);
network_init_object_field(o, &o->oDialogResponse);
}
f32 sp34 = 20.0f;

View File

@ -360,17 +360,7 @@ void set_mario_initial_action(struct MarioState *m, u32 spawnType, u32 actionArg
set_mario_initial_cap_powerup(m);
}
#include <stdio.h>
void init_mario_after_warp(void) {
printf("===== init mario =====\n");
printf("areaIdx = %d\n", sWarpDest.areaIdx);
printf("arg = %d\n", sWarpDest.arg);
printf("levelNum = %d\n", sWarpDest.levelNum);
printf("nodeId = %d\n", sWarpDest.nodeId);
printf("type = %d\n", sWarpDest.type);
fflush(stdout);
struct ObjectWarpNode *spawnNode = area_get_warp_node(sWarpDest.nodeId);
u32 marioSpawnType = get_mario_spawn_type(spawnNode->object);

View File

@ -61,7 +61,7 @@ struct SyncObject {
bool syncDeathEvent;
bool hasStandardFields;
float maxUpdateRate;
u8 (*ignore_if_true)(struct Object*);
u8 (*ignore_if_true)(void);
void (*on_received)(void);
void* extraFields[MAX_SYNC_OBJECT_FIELDS];
};

View File

@ -152,9 +152,14 @@ static struct SyncObject* packet_read_object_header(struct Packet* p) {
// retrieve SyncObject, check if we should update using callback
struct SyncObject* so = &gSyncObjects[syncId];
if (so->ignore_if_true != NULL && (*so->ignore_if_true)(so->o)) {
extern struct Object* gCurrentObject;
struct Object* tmp = gCurrentObject;
gCurrentObject = o;
if ((so->ignore_if_true != NULL) && ((*so->ignore_if_true)() != FALSE)) {
gCurrentObject = tmp;
return NULL;
}
gCurrentObject = tmp;
so->clockSinceUpdate = clock();
// make sure this is the newest event possible