Added hacks for fire spitter and skeeter to prevent glitching through the floor on water level change

This commit is contained in:
MysterD 2021-08-14 20:17:57 -07:00
parent d911c09c25
commit efd22a81ab
3 changed files with 15 additions and 2 deletions

View file

@ -481,7 +481,8 @@
#define /*0x0F4*/ oFallingPillarPitchAcceleration OBJECT_FIELD_F32(0x1B)
/* Fire Spitter */
#define /*0x0F4*/ oFireSpitterScaleVel OBJECT_FIELD_F32(0x1B)
#define /*0x0F4*/ oFireSpitterScaleVel OBJECT_FIELD_F32(0x1B)
#define /*0x0F8*/ oFireSpitterLastWaterY OBJECT_FIELD_F32(0x1C)
/* Blue Fish */
#define /*0x0F4*/ oBlueFishRandomVel OBJECT_FIELD_F32(0x1B)
@ -867,6 +868,7 @@
#define /*0x0F8*/ oSkeeterUnkF8 OBJECT_FIELD_S32(0x1C)
#define /*0x0FC*/ oSkeeterUnkFC OBJECT_FIELD_F32(0x1D)
#define /*0x100*/ oSkeeterWaitTime OBJECT_FIELD_S32(0x1E)
#define /*0x0F8*/ oSkeeterLastWaterY OBJECT_FIELD_F32(0x1F)
#define /*0x1AC*/ oSkeeterUnk1AC OBJECT_FIELD_S16(0x49, 0)
/* Jrb Sliding Box */

View file

@ -2,7 +2,6 @@
static void fire_spitter_act_idle(void) {
struct Object* player = nearest_player_to_object(o);
int distanceToPlayer = dist_between_objects(o, player);
approach_f32_ptr(&o->header.gfx.scale[0], 0.2f, 0.002f);
if (o->oTimer > 150 && distanceToPlayer < 800.0f && !(o->oMoveFlags & OBJ_MOVE_MASK_IN_WATER)) {
o->oAction = FIRE_SPITTER_ACT_SPIT_FIRE;
@ -70,5 +69,11 @@ void bhv_fire_spitter_update(void) {
break;
}
// HACK: when water level suddenly changes, the fire spitter can disappear into the floor
f32 waterLevel = find_water_level(o->oPosX, o->oPosZ);
if (fabs(o->oFireSpitterLastWaterY - waterLevel) > 100) {
o->oMoveFlags = OBJ_MOVE_IN_AIR;
}
o->oFireSpitterLastWaterY = waterLevel;
cur_obj_move_standard(78);
}

View file

@ -172,6 +172,12 @@ void bhv_skeeter_update(void) {
}
obj_check_attacks(&sSkeeterHitbox, o->oAction);
// HACK: when water level suddenly changes, the skeeter can disappear into the floor
f32 waterLevel = find_water_level(o->oPosX, o->oPosZ);
if (fabs(o->oSkeeterLastWaterY - waterLevel) > 100) {
o->oMoveFlags = OBJ_MOVE_IN_AIR;
}
o->oSkeeterLastWaterY = waterLevel;
cur_obj_move_standard(-78);
}