From 30ac9238613ab6d44287b9cfac60b99fbb6720a6 Mon Sep 17 00:00:00 2001 From: MysterD Date: Sat, 10 Oct 2020 15:49:17 -0700 Subject: [PATCH] Synchronize burning player smoke + misc version improvements --- src/game/behaviors/bbh_tilting_trap.inc.c | 2 +- src/game/behaviors/dorrie.inc.c | 8 ++++---- src/game/behaviors/exclamation_box.inc.c | 3 ++- src/game/behaviors/flame_mario.inc.c | 22 ++++++++++++++++------ 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/game/behaviors/bbh_tilting_trap.inc.c b/src/game/behaviors/bbh_tilting_trap.inc.c index c3223b76..2c84b2ad 100644 --- a/src/game/behaviors/bbh_tilting_trap.inc.c +++ b/src/game/behaviors/bbh_tilting_trap.inc.c @@ -53,7 +53,7 @@ void bhv_bbh_tilting_trap_platform_loop(void) { if (o->oAction == BBH_TILTING_TRAP_PLATFORM_ACT_MARIO_ON) { #else - if (gMarioObject->platform == o) { + if (cur_obj_is_any_player_on_platform()) { #endif o->oAngleVelPitch = (s32)(distanceToPlayer * coss(angleToPlayer)); o->oFaceAnglePitch += o->oAngleVelPitch; diff --git a/src/game/behaviors/dorrie.inc.c b/src/game/behaviors/dorrie.inc.c index db0c135d..5f1a3d73 100644 --- a/src/game/behaviors/dorrie.inc.c +++ b/src/game/behaviors/dorrie.inc.c @@ -93,17 +93,17 @@ void dorrie_act_lower_head(void) { if (cur_obj_init_anim_check_frame(2, 35)) { cur_obj_reverse_animation(); -#ifdef VERSION_JP +/*#ifdef VERSION_JP if (o->oTimer > 150) { dorrie_begin_head_raise(FALSE); - } else if (gMarioObject->platform == o) { + } else if (cur_obj_is_any_player_on_platform()) { if (o->oDorrieForwardDistToMario > 830.0f && set_mario_npc_dialog(&gMarioStates[0], 2, dorrie_act_lower_head_continue_dialog) == 1) { dorrie_begin_head_raise(TRUE); } else if (o->oDorrieForwardDistToMario > 320.0f) { o->oTimer = 0; } } -#else +#else*/ if (cur_obj_is_any_player_on_platform()) { if (gMarioStates[0].marioObj->platform == o && o->oDorrieOffsetY == -17.0f && distanceToLocalPlayer > 780.0f @@ -116,7 +116,7 @@ void dorrie_act_lower_head(void) { } else if (o->oTimer > 150) { dorrie_begin_head_raise(FALSE); } -#endif +//#endif } else { o->oDorrieNeckAngle += 0x115; diff --git a/src/game/behaviors/exclamation_box.inc.c b/src/game/behaviors/exclamation_box.inc.c index 7682a5a0..9e861e75 100644 --- a/src/game/behaviors/exclamation_box.inc.c +++ b/src/game/behaviors/exclamation_box.inc.c @@ -112,6 +112,7 @@ void exclamation_box_act_3(void) { } void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) { + struct Object* player = nearest_player_to_object(o); struct Object *sp1C = NULL; if (o->oExclamationBoxForce) { @@ -123,7 +124,7 @@ void exclamation_box_spawn_contents(struct Struct802C0DF0 *a0, u8 a1) { sp1C = spawn_object(o, a0->model, a0->behavior); sp1C->oVelY = 20.0f; sp1C->oForwardVel = 3.0f; - sp1C->oMoveAngleYaw = gMarioObject->oMoveAngleYaw; + sp1C->oMoveAngleYaw = player->oMoveAngleYaw; o->oBehParams |= a0->unk2 << 24; if (a0->model == 122) o->oFlags |= 0x4000; diff --git a/src/game/behaviors/flame_mario.inc.c b/src/game/behaviors/flame_mario.inc.c index 52e4bae6..63f82c01 100644 --- a/src/game/behaviors/flame_mario.inc.c +++ b/src/game/behaviors/flame_mario.inc.c @@ -16,10 +16,15 @@ void bhv_black_smoke_bowser_loop(void) { } void bhv_black_smoke_mario_loop(void) { + if (o->parentObj == NULL) { + obj_mark_for_deletion(o); + return; + } + if (o->oTimer == 0) { - cur_obj_set_pos_relative(gMarioObject, 0, 0, -30.0f); + cur_obj_set_pos_relative(o->parentObj, 0, 0, -30.0f); o->oForwardVel = random_float() * 2 + 0.5; - o->oMoveAngleYaw = (gMarioObject->oMoveAngleYaw + 0x7000) + random_float() * 8192.0f; + o->oMoveAngleYaw = (o->parentObj->oMoveAngleYaw + 0x7000) + random_float() * 8192.0f; o->oVelY = 8; } o->oMoveAngleYaw += o->oAngleVelYaw; @@ -27,15 +32,20 @@ void bhv_black_smoke_mario_loop(void) { } void bhv_flame_mario_loop(void) { + if (o->parentObj == NULL || o->parentObj->behavior != bhvMario) { + obj_mark_for_deletion(o); + return; + } + cur_obj_scale(2.0f); if (o->oTimer != 0) if (o->oTimer & 1) - spawn_object(o, MODEL_BURN_SMOKE, bhvBlackSmokeMario); - gMarioObject->prevObj = o; // weird? + spawn_object(o->parentObj, MODEL_BURN_SMOKE, bhvBlackSmokeMario); + o->parentObj->prevObj = o; // weird? obj_set_parent_relative_pos(o, 40, -120, 0); - if (!(gMarioObject->oMarioParticleFlags & 0x800)) { + if (!(o->parentObj->oMarioParticleFlags & 0x800)) { o->parentObj->oActiveParticleFlags &= ~0x800; obj_mark_for_deletion(o); - gMarioObject->prevObj = NULL; + o->parentObj->prevObj = NULL; } }