diff --git a/network.sh b/network.sh index 71d232d3..ec2677d1 100755 --- a/network.sh +++ b/network.sh @@ -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 diff --git a/src/game/behaviors/boo.inc.c b/src/game/behaviors/boo.inc.c index d697c8d6..d2c5fb7d 100644 --- a/src/game/behaviors/boo.inc.c +++ b/src/game/behaviors/boo.inc.c @@ -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) { diff --git a/src/game/behaviors/cannon.inc.c b/src/game/behaviors/cannon.inc.c index 22a5ff6f..8e9c16b5 100644 --- a/src/game/behaviors/cannon.inc.c +++ b/src/game/behaviors/cannon.inc.c @@ -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) { diff --git a/src/game/behaviors/king_bobomb.inc.c b/src/game/behaviors/king_bobomb.inc.c index f4019b45..c5d31251 100644 --- a/src/game/behaviors/king_bobomb.inc.c +++ b/src/game/behaviors/king_bobomb.inc.c @@ -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; diff --git a/src/game/level_update.c b/src/game/level_update.c index b679dad6..66d9b3a1 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -360,17 +360,7 @@ void set_mario_initial_action(struct MarioState *m, u32 spawnType, u32 actionArg set_mario_initial_cap_powerup(m); } -#include - 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); diff --git a/src/pc/network/network.h b/src/pc/network/network.h index dbf35d5f..3e32e386 100644 --- a/src/pc/network/network.h +++ b/src/pc/network/network.h @@ -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]; }; diff --git a/src/pc/network/packets/packet_object.c b/src/pc/network/packets/packet_object.c index c3fd7957..73b28f82 100644 --- a/src/pc/network/packets/packet_object.c +++ b/src/pc/network/packets/packet_object.c @@ -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