EnTuboTrap and EnWeatherTag OK (#220)

This commit is contained in:
engineer124 2021-07-22 11:42:58 +10:00 committed by GitHub
parent 8e0359289c
commit 39eeb67200
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 48 additions and 93 deletions

View File

@ -2163,7 +2163,7 @@ SECTIONS
build/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.o(.text)
build/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.o(.data)
build/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.o(.rodata)
build/asm/overlays/ovl_En_Tubo_Trap_rodata.o(.rodata)
build/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap_overlay.o(.ovl)
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;
@ -2629,11 +2629,7 @@ SECTIONS
build/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.o(.text)
build/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.o(.data)
build/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.o(.rodata)
#ifdef NON_MATCHING
build/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag_overlay.o(.ovl)
#else
build/asm/overlays/ovl_En_Weather_Tag_rodata.o(.rodata)
#endif
}
SegmentEnd = .;
SegmentSize = SegmentEnd - SegmentStart;

View File

@ -8,9 +8,9 @@ void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx);
void EnTuboTrap_Draw(Actor* thisx, GlobalContext* globalCtx);
void func_80931004(EnTuboTrap* this, GlobalContext* globalCtx);
void func_80931138(EnTuboTrap* this, GlobalContext* globalCtx);
void func_809311C4(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_Idle(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx);
void EnTuboTrap_FlyAtPlayer(EnTuboTrap* this, GlobalContext* globalCtx);
static ColliderCylinderInit sCylinderInit = {
{
@ -51,12 +51,6 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 100, ICHAIN_STOP),
};
// used in WaitForProximity
s8 D_8093146C[] = {
0x28, 0x28, 0x28, 0x19, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx) {
EnTuboTrap* this = THIS;
@ -66,7 +60,7 @@ void EnTuboTrap_Init(Actor* thisx, GlobalContext* globalCtx) {
ActorShape_Init(&this->actor.shape, 0.0f, func_800B3FC0, 1.8f);
Collider_InitCylinder(globalCtx, &this->collider);
Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit);
this->actionFunc = func_80931004; // idle
this->actionFunc = EnTuboTrap_Idle;
}
void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) {
@ -75,8 +69,7 @@ void EnTuboTrap_Destroy(Actor* thisx, GlobalContext* globalCtx) {
Collider_DestroyCylinder(globalCtx, &this->collider);
}
// drop collectable
void func_8093089C(EnTuboTrap* this, GlobalContext* globalCtx) {
void EnTuboTrap_DropCollectible(EnTuboTrap* this, GlobalContext* globalCtx) {
s32 itemParam = ((this->actor.params >> 8) & 0x3F);
s32 dropCount = func_800A8150(itemParam);
@ -85,19 +78,15 @@ void func_8093089C(EnTuboTrap* this, GlobalContext* globalCtx) {
}
}
// EnTuboTrap_SpawnEffectsOnLand
void func_809308F4(EnTuboTrap* this, GlobalContext* globalCtx) {
void EnTuboTrap_SpawnEffectsOnLand(EnTuboTrap* this, GlobalContext* globalCtx) {
f32 rand;
f32 sin;
f32 cos;
Vec3f pos;
Vec3f vel;
s32 arg5;
s16 var;
s32 i;
Vec3f* actorPos = &this->actor.world.pos;
for (i = 0, var = 0; i < 15; i++, var += 20000) {
@ -130,15 +119,12 @@ void func_809308F4(EnTuboTrap* this, GlobalContext* globalCtx) {
func_800BBFB0(globalCtx, actorPos, 30.0f, 4, 0x14, 0x32, 0);
}
// EnTuboTrap_SpawnEffectsInWater
void func_80930B60(EnTuboTrap* this, GlobalContext* globalCtx) {
void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) {
f32 rand;
f32 sin;
f32 cos;
Vec3f pos;
Vec3f vel;
s16 var;
s32 arg5;
s32 i;
@ -176,37 +162,36 @@ void func_80930B60(EnTuboTrap* this, GlobalContext* globalCtx) {
}
}
// EnTuboTrap_HandleImpact
void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) {
void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Player* player2 = PLAYER;
// in oot func_800F0568 is Audio_PlaySoundAtPosition
if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) {
func_80930B60(this, globalCtx);
EnTuboTrap_SpawnEffectsInWater(this, globalCtx);
func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER);
func_8093089C(this, globalCtx);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_MarkForDeath(&this->actor);
return;
}
if (this->collider.base.atFlags & AT_BOUNCED) {
this->collider.base.atFlags &= ~AT_BOUNCED;
func_809308F4(this, globalCtx);
EnTuboTrap_SpawnEffectsOnLand(this, globalCtx);
func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW);
func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN);
func_8093089C(this, globalCtx);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_MarkForDeath(&this->actor);
return;
}
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
func_809308F4(this, globalCtx);
EnTuboTrap_SpawnEffectsOnLand(this, globalCtx);
func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION);
func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN);
func_8093089C(this, globalCtx);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_MarkForDeath(&this->actor);
return;
}
@ -215,74 +200,65 @@ void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) {
this->collider.base.atFlags &= ~AT_HIT;
if (&player->actor == this->collider.base.at) {
func_809308F4(this, globalCtx);
EnTuboTrap_SpawnEffectsOnLand(this, globalCtx);
func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN);
func_800F0568(globalCtx, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT);
func_8093089C(this, globalCtx);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_MarkForDeath(&this->actor);
return;
}
}
if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) {
func_809308F4(this, globalCtx);
EnTuboTrap_SpawnEffectsOnLand(this, globalCtx);
func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN);
func_8093089C(this, globalCtx);
EnTuboTrap_DropCollectible(this, globalCtx);
Actor_MarkForDeath(&this->actor);
}
}
#ifdef NON_MATCHING
// Wait For Proximity (idle)
// NON-MATCHING: wrong register used, v instead of t for the weirdValues[] pointer
void func_80931004(EnTuboTrap* this, GlobalContext* globalCtx) {
void EnTuboTrap_Idle(EnTuboTrap* this, GlobalContext* globalCtx) {
static s8 sTransformationHeight[] = {
40, 40, 40, 25, 28,
};
Player* player = PLAYER;
f32 currentHeight;
s8 weirdvalue;
f32 transformationHeight;
s16 startingRotation;
static s8 D_8093146C[] = {
0x28, 0x28, 0x28, 0x19, 0x1C, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.world.pos.y <= player->actor.world.pos.y)) {
startingRotation = this->actor.home.rot.z;
if ((startingRotation == 0) || (this->actor.yDistToPlayer <= ((f32)startingRotation * 10.0f))) {
func_800BC154(globalCtx, &globalCtx->actorCtx, this, ACTORCAT_ENEMY);
if ((startingRotation == 0) || (this->actor.yDistToPlayer <= (startingRotation * 10.0f))) {
func_800BC154(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORCAT_ENEMY);
currentHeight = this->actor.world.pos.y;
this->actor.flags |= 0x11; // always update and can target
weirdvalue = D_8093146C[player->transformation & 0xFF];
transformationHeight = sTransformationHeight[player->transformation];
this->targetHeight = player->actor.world.pos.y + (f32)weirdvalue;
this->targetHeight = player->actor.world.pos.y + transformationHeight;
if (this->targetHeight < currentHeight) {
this->targetHeight = currentHeight;
this->targetHeight += weirdvalue;
this->targetHeight += transformationHeight;
}
this->originPos = this->actor.world.pos;
Audio_PlayActorSound2(&this->actor, NA_SE_EV_POT_MOVE_START);
this->actionFunc = func_80931138;
this->actionFunc = EnTuboTrap_Levitate;
}
}
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Tubo_Trap_0x809307E0/func_80931004.asm")
#endif
// levitate
void func_80931138(EnTuboTrap* this, GlobalContext* globalCtx) {
void EnTuboTrap_Levitate(EnTuboTrap* this, GlobalContext* globalCtx) {
this->actor.shape.rot.y += 5000;
Math_ApproachF(&this->actor.world.pos.y, this->targetHeight, 0.8f, 3.0f);
if (fabsf(this->actor.world.pos.y - this->targetHeight) < 10.0f) {
this->actor.speedXZ = 10.0f;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actionFunc = func_809311C4; // flying at link
this->actionFunc = EnTuboTrap_FlyAtPlayer;
}
}
// flying at link
void func_809311C4(EnTuboTrap* this, GlobalContext* globalCtx) {
void EnTuboTrap_FlyAtPlayer(EnTuboTrap* this, GlobalContext* globalCtx) {
f32 dX = this->originPos.x - this->actor.world.pos.x;
f32 dY = this->originPos.y - this->actor.world.pos.y;
f32 dZ = this->originPos.z - this->actor.world.pos.z;
@ -299,7 +275,7 @@ void func_809311C4(EnTuboTrap* this, GlobalContext* globalCtx) {
}
this->actor.shape.rot.y += 5000;
func_80930DDC(this, globalCtx); // "handle impact"
EnTuboTrap_HandleImpact(this, globalCtx);
}
void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx) {
@ -313,10 +289,10 @@ void EnTuboTrap_Update(Actor* thisx, GlobalContext* globalCtx) {
if (this->actor.projectedPos.z < 811.0f) {
if (this->actor.projectedPos.z > 300.0f) {
this->actor.shape.shadowAlpha = (u8)((0x32B - (s32)this->actor.projectedPos.z) >> 1);
this->actor.shape.shadowAlpha = (u8)((811 - (s32)this->actor.projectedPos.z) >> 1);
this->actor.shape.shadowDraw = func_800B3FC0;
} else if (this->actor.projectedPos.z > -10.0f) {
this->actor.shape.shadowAlpha = 0xFF;
this->actor.shape.shadowAlpha = 255;
this->actor.shape.shadowDraw = func_800B3FC0;
} else {
this->actor.shape.shadowDraw = NULL;

View File

@ -355,8 +355,6 @@ void func_80966FEC(EnWeatherTag* this, GlobalContext* globalCtx) {
}
}
#ifdef NON_MATCHING
// non-matching: two instructions are swapped
// type 4_2 pirates fortres only?
void func_80967060(EnWeatherTag* this, GlobalContext* globalCtx) {
Vec3f vec1;
@ -368,16 +366,12 @@ void func_80967060(EnWeatherTag* this, GlobalContext* globalCtx) {
func_80169474(globalCtx, &vec1, &vec2);
// 0x428C0000 = 70.0f
// ca4: lwc1 $f0,0x18(sp) | ca4: lui at,0x428c
// ca8: lui at,0x428c | ca8: lwc1 $f0,0x18(sp)
if (globalCtx->view.fovy < 25.0f && (vec2.x >= 70.0f && vec2.x < 250.0f) && (vec2.y >= 30.0f && vec2.y < 210.0f)) {
if (globalCtx->view.fovy < 25.0f) {
if ((vec2.x >= 70.0f) && (vec2.x < 250.0f) && (vec2.y >= 30.0f) && (vec2.y < 210.0f)) {
EnWeatherTag_SetupAction(this, func_80967148);
}
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Weather_Tag_0x80966410/func_80967060.asm")
#endif
}
// type 4_3, start cutscene then die?
void func_80967148(EnWeatherTag* this, GlobalContext* globalCtx) {
@ -415,8 +409,6 @@ void EnWeatherTag_Unused_80967250(EnWeatherTag* this, GlobalContext* globalCtx)
}
}
#ifdef NON_MATCHING
// non_matching: the parameters for func_800BCCDC are correct, but out of order
// WEATHERTAG_TYPE_WATERMURK: (pinnacle rock, zora cape, zora coast)
void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
@ -425,13 +417,7 @@ void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) {
f32 range;
f32 strength = 0.0f;
// the parameters here are correct but loaded in the wrong order
// eec: addiu a3,s0,0x24 | eec: lw a0,0x150(s0) 4
// ef0: sw v0,0x3c(sp) | ef0: lbu a1,0x14c(s0) 3
// ef4: lbu a1,0x14c(s0) | ef4: sw zero,0x10(sp) 5
// ef8: lw a0,0x150(s0) | ef8: addiu a3,s0,0x24 1
// efc: sw zero,0x10(sp) | efc: sw v0,0x3c(sp) 2
func_800BCCDC(this->pathPoints, this->pathCount, &player->actor.world.pos, &this->actor.world.pos, 0);
func_800BCCDC(this->pathPoints, this->pathCount, &PLAYER->actor.world.pos, &this->actor.world.pos, 0);
distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor);
range = WEATHER_TAG_RANGE100(this);
@ -452,9 +438,6 @@ void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) {
Math_SmoothStepToS(&globalCtx->envCtx.unk_8C.fogNear, (s16)(-40.0f * strength), 1, 1, 1);
}
#else
#pragma GLOBAL_ASM("./asm/non_matchings/overlays/ovl_En_Weather_Tag_0x80966410/func_809672DC.asm")
#endif
// WEATHERTAG_TYPE_LOCALDAY2RAIN: rain proximity as approaching rainy scene
// (milk road day 2 approaching ranch it rains, walking away towards termfield no rain)

View File

@ -7208,13 +7208,13 @@
0x80930190:("func_80930190",),
0x809307E0:("EnTuboTrap_Init",),
0x80930870:("EnTuboTrap_Destroy",),
0x8093089C:("func_8093089C",),
0x809308F4:("func_809308F4",),
0x80930B60:("func_80930B60",),
0x80930DDC:("func_80930DDC",),
0x80931004:("func_80931004",),
0x80931138:("func_80931138",),
0x809311C4:("func_809311C4",),
0x8093089C:("EnTuboTrap_DropCollectible",),
0x809308F4:("EnTuboTrap_SpawnEffectsOnLand",),
0x80930B60:("EnTuboTrap_SpawnEffectsInWater",),
0x80930DDC:("EnTuboTrap_HandleImpact",),
0x80931004:("EnTuboTrap_Idle",),
0x80931138:("EnTuboTrap_Levitate",),
0x809311C4:("EnTuboTrap_FlyAtPlayer",),
0x80931290:("EnTuboTrap_Update",),
0x809313D8:("EnTuboTrap_Draw",),
0x80931560:("ObjIcePoly_Init",),