Desync fixes for hoot, piranha, spiny

This commit is contained in:
MysterD 2020-10-14 23:25:59 -07:00
parent 53c8ce18ec
commit 5375ad4d5b
4 changed files with 14 additions and 3 deletions

View File

@ -2,6 +2,10 @@
static u8 localTalkToHoot = 0;
static u8 bhv_hoot_ignore_if_true(void) {
return (gMarioStates[0].action == ACT_RIDING_HOOT) && (gMarioStates[0].usedObj == o);
}
void bhv_hoot_init(void) {
cur_obj_init_animation(0);
@ -13,9 +17,11 @@ void bhv_hoot_init(void) {
cur_obj_become_intangible();
localTalkToHoot = 0;
network_init_object(o, 4000.0f);
struct SyncObject* so = network_init_object(o, 4000.0f);
so->ignore_if_true = bhv_hoot_ignore_if_true;
network_init_object_field(o, &o->oHootAvailability);
network_init_object_field(o, &o->oMoveAnglePitch);
network_init_object_field(o, &o->header.gfx.unk38.animFrame);
}
// sp28 = arg0

View File

@ -312,6 +312,8 @@ s32 mario_moving_fast_enough_to_make_piranha_plant_bite(void) {
* Plant start biting again. Otherwise, make it go back to sleep.
*/
void piranha_plant_act_stopped_biting(void) {
struct Object* player = nearest_player_to_object(o);
int distanceToPlayer = dist_between_objects(o, player);
cur_obj_become_intangible();
cur_obj_init_animation_with_sound(6);
@ -326,7 +328,7 @@ void piranha_plant_act_stopped_biting(void) {
* of the Piranha Plant during the short time the Piranha Plant's nod
* animation plays.
*/
if (o->oDistanceToMario < 400.0f) {
if (distanceToPlayer < 400.0f) {
if (mario_moving_fast_enough_to_make_piranha_plant_bite()) {
o->oAction = PIRANHA_PLANT_ACT_BITING;
}

View File

@ -212,6 +212,8 @@ void bhv_spiny_update(void) {
}
}
obj_set_hitbox(o, &sSpinyHitbox);
switch (o->oAction) {
case SPINY_ACT_WALK:
spiny_act_walk();

View File

@ -320,7 +320,8 @@ static void wiggler_act_jumped_on(void) {
if (should_start_or_continue_dialog(marioState, o) && cur_obj_update_dialog_with_cutscene(marioState, 2, 0, CUTSCENE_DIALOG, attackText[o->oHealth - 2], wiggler_act_jumped_on_continue_dialog) != 0) {
// Because we don't want the wiggler to disappear after being
// defeated, we leave its health at 1
if (--o->oHealth == 1) {
if (--o->oHealth <= 1) {
o->oHealth = 1;
o->oAction = WIGGLER_ACT_SHRINK;
cur_obj_become_intangible();
} else {