mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2024-10-20 04:02:39 +00:00
efa1600ad0
Reported by somario360: After I (Luigi) gave the baby penguin to the mother, the start spawned, but I was stuck in the looking up animation. My friend (Mario) talked to Bowser after defeating him, Bowser turned into a key, but he was stuck in the looking up animation after (I was able to grab the key though, but Bowser was slightly visible) (Also don't mind 0 stars, he loves doing the lobby BLJ) The issue is the state machine moved on without removing the reading dialog action. There was no straight forward way to deal with this. Custom functions were written for each call to dialog to ensure that we should stay reading the dialog.
47 lines
2 KiB
C
47 lines
2 KiB
C
// sl_snowman_wind.c.inc
|
|
|
|
u8 bhv_sl_snowman_wind_loop_continue_dialog(void) { return o->oSubAction == SL_SNOWMAN_WIND_ACT_TALKING; }
|
|
|
|
void bhv_sl_snowman_wind_loop(void) {
|
|
UNUSED s32 unusedVar = 0;
|
|
s16 marioAngleFromWindSource;
|
|
Vec3f tempPos;
|
|
|
|
if (o->oTimer == 0)
|
|
o->oSLSnowmanWindOriginalYaw = o->oMoveAngleYaw;
|
|
|
|
// Waiting for Mario to approach.
|
|
if (o->oSubAction == SL_SNOWMAN_WIND_ACT_IDLE) {
|
|
o->oDistanceToMario = 0;
|
|
|
|
// Check if Mario is within 1000 units of the center of the bridge, and ready to speak.
|
|
vec3f_copy_2(tempPos, &o->oPosX);
|
|
obj_set_pos(o, 1100, 3328, 1164); // Position is in the middle of the ice bridge
|
|
if (cur_obj_can_mario_activate_textbox(&gMarioStates[0], 1000.0f, 30.0f, 0x7FFF))
|
|
o->oSubAction++;
|
|
vec3f_copy_2(&o->oPosX, tempPos);
|
|
|
|
// Mario has come close, begin dialog.
|
|
} else if (o->oSubAction == SL_SNOWMAN_WIND_ACT_TALKING) {
|
|
if (cur_obj_update_dialog(&gMarioStates[0], 2, 2, DIALOG_153, 0, bhv_sl_snowman_wind_loop_continue_dialog))
|
|
o->oSubAction++;
|
|
|
|
// Blowing, spawn wind particles (SL_SNOWMAN_WIND_ACT_BLOWING)
|
|
} else if (o->oDistanceToMario < 1500.0f && absf(gMarioObject->oPosY - o->oHomeY) < 500.0f) {
|
|
// Point towards Mario, but only within 0x1500 angle units of the original angle.
|
|
if ((marioAngleFromWindSource = o->oAngleToMario - o->oSLSnowmanWindOriginalYaw) > 0) {
|
|
if (marioAngleFromWindSource < 0x1500)
|
|
o->oMoveAngleYaw = o->oAngleToMario;
|
|
else
|
|
o->oMoveAngleYaw = o->oSLSnowmanWindOriginalYaw + 0x1500;
|
|
} else {
|
|
if (marioAngleFromWindSource > -0x1500)
|
|
o->oMoveAngleYaw = o->oAngleToMario;
|
|
else
|
|
o->oMoveAngleYaw = o->oSLSnowmanWindOriginalYaw - 0x1500;
|
|
}
|
|
// Spawn wind and play wind sound
|
|
cur_obj_spawn_strong_wind_particles(12, 3.0f, 0, 0, 0);
|
|
cur_obj_play_sound_1(SOUND_AIR_BLOW_WIND);
|
|
}
|
|
}
|