diff --git a/src/audio/lib/heap.c b/src/audio/lib/heap.c index e4412bc94f..4101ab7b72 100644 --- a/src/audio/lib/heap.c +++ b/src/audio/lib/heap.c @@ -1401,8 +1401,8 @@ void AudioHeap_ChangeStorage(StorageChange* change, Sample* sample) { uintptr_t startAddr = change->oldAddr; uintptr_t endAddr = change->oldAddr + change->size; - if (startAddr <= (uintptr_t)sample->sampleAddr && (uintptr_t)sample->sampleAddr < endAddr) { - sample->sampleAddr = sample->sampleAddr - startAddr + change->newAddr; + if (((uintptr_t)sample->sampleAddr >= startAddr) && ((uintptr_t)sample->sampleAddr < endAddr)) { + sample->sampleAddr += -startAddr + change->newAddr; if (D_801FD120 == 0) { sample->medium = change->newMedium; } else { diff --git a/src/audio/lib/load.c b/src/audio/lib/load.c index d4e23a86a7..37a68ff4c7 100644 --- a/src/audio/lib/load.c +++ b/src/audio/lib/load.c @@ -1726,7 +1726,7 @@ void AudioLoad_ProcessAsyncLoad(AudioAsyncLoad* asyncLoad, s32 resetStatus) { asyncLoad->bytesRemaining -= asyncLoad->chunkSize; asyncLoad->curDevAddr += asyncLoad->chunkSize; - asyncLoad->curRamAddr = asyncLoad->curRamAddr + asyncLoad->chunkSize; + asyncLoad->curRamAddr += asyncLoad->chunkSize; } void AudioLoad_AsyncDma(AudioAsyncLoad* asyncLoad, size_t size) { diff --git a/src/boot/yaz0.c b/src/boot/yaz0.c index 7d33f8309b..8626628f8d 100644 --- a/src/boot/yaz0.c +++ b/src/boot/yaz0.c @@ -85,7 +85,7 @@ s32 Yaz0_DecompressImpl(u8* src, u8* dst) { } dstEnd = dst + ((Yaz0Header*)src)->decSize; - src = src + sizeof(Yaz0Header); + src += sizeof(Yaz0Header); do { if (bitIdx == 0) { diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 399b1db267..0bfcafed06 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -2041,10 +2041,10 @@ s32 Camera_Normal1(Camera* camera) { spD8.y -= focalActorHeight + roData->unk_00; spC4 = Camera_Vec3fMagnitude(&spD8); - if ((roData->unk_04 + roData->unk_08) < spC4) { + if (spC4 > (roData->unk_04 + roData->unk_08)) { spC4 = 1.0f; } else { - spC4 = spC4 / (roData->unk_04 + roData->unk_08); + spC4 /= roData->unk_04 + roData->unk_08; } spD0 = 0.2f; diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index f93b5bcbaa..88509bc01a 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -329,7 +329,7 @@ void func_800A640C(EnItem00* this, PlayState* play) { if ((this->actor.params <= ITEM00_RUPEE_RED) || ((this->actor.params == ITEM00_RECOVERY_HEART) && (this->unk152 < 0)) || (this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) { - this->actor.shape.rot.y = this->actor.shape.rot.y + 960; + this->actor.shape.rot.y += 0x3C0; } else if ((this->actor.params >= ITEM00_SHIELD_HERO) && (this->actor.params != ITEM00_DEKU_NUTS_10) && (this->actor.params < ITEM00_BOMBS_0)) { if (this->unk152 == -1) { @@ -343,7 +343,7 @@ void func_800A640C(EnItem00* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.x, 0, 2, 2500, 500); } else if ((this->actor.params == ITEM00_MAP) || (this->actor.params == ITEM00_COMPASS)) { this->unk152 = -1; - this->actor.shape.rot.y = this->actor.shape.rot.y + 960; + this->actor.shape.rot.y += 0x3C0; } if ((this->actor.params == ITEM00_HEART_PIECE) || (this->actor.params == ITEM00_HEART_CONTAINER)) { @@ -381,7 +381,7 @@ void func_800A6650(EnItem00* this, PlayState* play) { Vec3f pos; if (this->actor.params <= ITEM00_RUPEE_RED) { - this->actor.shape.rot.y = this->actor.shape.rot.y + 960; + this->actor.shape.rot.y += 0x3C0; } if ((play->gameplayFrames & 1) != 0) { @@ -395,7 +395,7 @@ void func_800A6650(EnItem00* this, PlayState* play) { if (this->actor.velocity.y > -2.0f) { this->actionFunc = func_800A640C; } else { - this->actor.velocity.y = this->actor.velocity.y * -0.8f; + this->actor.velocity.y *= -0.8f; this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } } @@ -1430,7 +1430,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP spawnedActor->actor.world.rot.y = Rand_ZeroOne() * 40000.0f; Actor_SetScale(&spawnedActor->actor, 0.0f); spawnedActor->actionFunc = func_800A6780; - spawnedActor->actor.flags = spawnedActor->actor.flags | ACTOR_FLAG_10; + spawnedActor->actor.flags |= ACTOR_FLAG_10; if ((spawnedActor->actor.params != ITEM00_SMALL_KEY) && (spawnedActor->actor.params != ITEM00_HEART_PIECE) && (spawnedActor->actor.params != ITEM00_HEART_CONTAINER)) { diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index de4ad150ab..98fdc84fb6 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -690,7 +690,7 @@ void Environment_Init(PlayState* play2, EnvironmentContext* envCtx, s32 arg2) { envCtx->lightBlendRateOverride = LIGHT_BLENDRATE_OVERRIDE_NONE; R_TIME_SPEED = envCtx->sceneTimeSpeed = 0; - R_TIME_SPEED = R_TIME_SPEED; + R_TIME_SPEED = R_TIME_SPEED; // Set to itself R_ENV_DISABLE_DBG = false; CREG(64) = 0; diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 12bf959fcf..0d4d00626d 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -691,10 +691,10 @@ f32 Math_Vec3f_StepTo(Vec3f* start, Vec3f* target, f32 speed) { f0 = Math3D_Vec3fMagnitude(&diff); if (speed < f0) { f2 = speed / f0; - f0 = f0 - speed; - start->x = start->x + f2 * diff.x; - start->y = start->y + f2 * diff.y; - start->z = start->z + f2 * diff.z; + f0 -= speed; + start->x += f2 * diff.x; + start->y += f2 * diff.y; + start->z += f2 * diff.z; } else { Math_Vec3f_Copy(start, target); f0 = 0.0f; diff --git a/src/code/z_message.c b/src/code/z_message.c index 37588bd132..eb2d0d8cbc 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -2284,7 +2284,7 @@ void Message_Decode(PlayState* play) { } else if (curChar == 0x203) { msgCtx->unk11F18 = 1; msgCtx->choiceNum = 3; - msgCtx->unk11FF8 = msgCtx->unk11FF8 + 0x16; + msgCtx->unk11FF8 += 0x16; } else if (curChar == 0x204) { Message_GetTimerDigits(((void)0, gSaveContext.timerCurTimes[curChar - 0x204]), spAC); diff --git a/src/code/z_message_nes.c b/src/code/z_message_nes.c index 86a644849d..0bd3c99a34 100644 --- a/src/code/z_message_nes.c +++ b/src/code/z_message_nes.c @@ -1098,7 +1098,7 @@ void Message_DecodeNES(PlayState* play) { } else if (curChar == 0xC3) { msgCtx->unk11F18 = 0; msgCtx->choiceNum = 3; - msgCtx->unk11FF8 = msgCtx->unk11FF8 + 0x16; + msgCtx->unk11FF8 += 0x16; } else if (curChar == 0xC4) { Message_GetTimerDigitsNES(((void)0, gSaveContext.timerCurTimes[curChar - 0xC4]), spA8); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index a8e8dd38b7..ec051f1fb3 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -3177,7 +3177,7 @@ void func_80127DA4(PlayState* play, struct_801F58B0 arg1[], struct_80128388_arg1 if (play->actorCtx.flags & ACTORCTX_FLAG_3) { phi_s1->unk_0C.y = CLAMP(phi_s1->unk_0C.y, -0.8f, 0.8f); } else { - phi_s1->unk_0C.y = phi_s1->unk_0C.y; + phi_s1->unk_0C.y = phi_s1->unk_0C.y; // Set to itself f20 = Math_SinS(arg1->unk_1A); phi_s1->unk_0C.y += (((f22 * Math_CosS(arg1->unk_1A)) + (f24 * f20)) * 0.2f); phi_s1->unk_0C.y = CLAMP(phi_s1->unk_0C.y, -2.0f, 4.0f); diff --git a/src/code/z_sub_s.c b/src/code/z_sub_s.c index 9e19c1dadd..d36f65b346 100644 --- a/src/code/z_sub_s.c +++ b/src/code/z_sub_s.c @@ -569,7 +569,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) { if (index == 0) { diffX = points[1].x - points[0].x; diffZ = points[1].z - points[0].z; - } else if (index == count - 1) { + } else if (index == (count - 1)) { diffX = points[count - 1].x - points[count - 2].x; diffZ = points[count - 1].z - points[count - 2].z; } else { @@ -578,6 +578,7 @@ s32 SubS_HasReachedPoint(Actor* actor, Path* path, s32 pointIndex) { } func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); + if (((px * actor->world.pos.x) + (pz * actor->world.pos.z) + d) > 0.0f) { reached = true; } diff --git a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c index 0cfdb1500e..b96d40e6e3 100644 --- a/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c +++ b/src/overlays/actors/ovl_Bg_Dblue_Waterfall/z_bg_dblue_waterfall.c @@ -288,9 +288,9 @@ void func_80B84568(BgDblueWaterfall* this, PlayState* play) { } void func_80B84610(BgDblueWaterfall* this, PlayState* play) { - s32 pad[2]; - Vec3f sp34; + s32 pad; Player* player = GET_PLAYER(play); + Vec3f sp34; if (this->unk_1A7 <= 0) { this->unk_1A7 = 16; @@ -300,18 +300,10 @@ void func_80B84610(BgDblueWaterfall* this, PlayState* play) { if (this->unk_1A7 >= 6) { this->unk_1A8 += Rand_ZeroOne() * 0.1f; - if (this->unk_1A8 > 0.5f) { - this->unk_1A8 = 0.5f; - } else { - this->unk_1A8 = this->unk_1A8; - } + this->unk_1A8 = CLAMP_MAX(this->unk_1A8, 0.5f); } else { this->unk_1A8 -= Rand_ZeroOne() * 0.2f; - if (this->unk_1A8 > -0.5f) { - this->unk_1A8 = -0.5f; - } else { - this->unk_1A8 = this->unk_1A8; - } + this->unk_1A8 = CLAMP_MAX(this->unk_1A8, -0.5f); } Matrix_Push(); @@ -321,10 +313,13 @@ void func_80B84610(BgDblueWaterfall* this, PlayState* play) { player->actor.world.pos.x += sp34.x; player->actor.world.pos.z += sp34.z; - //! FAKE: - if (this && this && this) {} - player->pushedSpeed = 8.0f; - player->pushedYaw = this->actor.yawTowardsPlayer; + + { + s32 requiredScopeTemp; + + player->pushedSpeed = 8.0f; + player->pushedYaw = this->actor.yawTowardsPlayer; + } } static InitChainEntry sInitChain[] = { diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index ab1bf7d302..82242ecb07 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -77,7 +77,7 @@ void BgIcicle_Init(Actor* thisx, PlayState* play) { paramsHigh = (thisx->params >> 8) & 0xFF; paramsMid = (thisx->params >> 2) & 0x3F; this->unk_161 = (thisx->params >> 8) & 0xFF; - thisx->params = thisx->params & 3; + thisx->params &= 3; if (thisx->params == ICICLE_STALAGMITE_RANDOM_DROP || thisx->params == ICICLE_STALAGMITE_FIXED_DROP) { this->unk_160 = ((thisx->params == ICICLE_STALAGMITE_RANDOM_DROP) ? paramsHigh : paramsMid); diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index ecc6a718c8..302eb6f5b9 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -598,8 +598,8 @@ void func_80B81234(BgIkanaRotaryroom* this, PlayState* play) { sp64 &= Math_ScaledStepToS(&player->actor.shape.rot.y, ptr->unk_40.y, 2000); sp64 &= Math_ScaledStepToS(&player->actor.shape.rot.z, ptr->unk_40.z, 2000); - ptr->unk_48 = ptr->unk_48 - 2.1f; - ptr->unk_48 = ptr->unk_48 * 0.98f; + ptr->unk_48 -= 2.1f; + ptr->unk_48 *= 0.98f; if (ptr->unk_48 < -30.0f) { ptr->unk_48 = -30.0f; } diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index a8f5dbd514..ecc1adb5ef 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -218,7 +218,7 @@ void func_80C0AE5C(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.velocity.y += -0.1f; this->dyna.actor.velocity.y *= 0.95f; this->dyna.actor.velocity.y = CLAMP_MIN(this->dyna.actor.velocity.y, 1.0f); - this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y + this->dyna.actor.velocity.y; + this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if ((this->dyna.actor.home.pos.y + 365.0f) < this->dyna.actor.world.pos.y) { BgIkninSusceil_RequestQuakeAndRumble(this, play, 3, 14, 2); func_80C0AB14(this); diff --git a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c index 16c6dd0395..5673573d43 100644 --- a/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c +++ b/src/overlays/actors/ovl_Bg_Spout_Fire/z_bg_spout_fire.c @@ -74,6 +74,7 @@ void BgSpoutFire_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); this->collider.dim.pos.y = this->actor.world.pos.y; CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(sFlameTextures); i++) { sFlameTextures[i] = Lib_SegmentedToVirtual(sFlameTextures[i]); diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index 1e9736b5ff..5e6618e4cf 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -572,7 +572,7 @@ void func_809ED45C(Boss04* this, PlayState* play) { this->collider1.elements[0].info.bumperFlags &= ~BUMP_HIT; Actor_PlaySfx(&this->actor, NA_SE_EN_ME_DAMAGE); damage = this->actor.colChkInfo.damage; - this->actor.colChkInfo.health = this->actor.colChkInfo.health - damage; + this->actor.colChkInfo.health -= damage; if ((s8)this->actor.colChkInfo.health <= 0) { func_809ED224(this); this->unk_1FE = 100; diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c index bdae31ac98..6ffd93ace3 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.c @@ -141,10 +141,10 @@ void func_80C16760(DemoSyoten* this, PlayState* play) { Vec3f sp2C; this->unk_3EC = 0; - if (DEMOSYOTEN_GET_7E00(&this->actor) != DEMOSYOTEN_7E00_3F) { - this->unk_3E8 = &play->setupPathList[DEMOSYOTEN_GET_7E00(&this->actor)]; - if (this->unk_3E8 != NULL) { - points = Lib_SegmentedToVirtual(this->unk_3E8->points); + if (DEMOSYOTEN_GET_PATH_INDEX(&this->actor) != DEMOSYOTEN_PATH_INDEX_NONE) { + this->path = &play->setupPathList[DEMOSYOTEN_GET_PATH_INDEX(&this->actor)]; + if (this->path != NULL) { + points = Lib_SegmentedToVirtual(this->path->points); Math_Vec3s_ToVec3f(&this->actor.world.pos, &points[0]); this->unk_3EC++; points++; @@ -153,13 +153,13 @@ void func_80C16760(DemoSyoten* this, PlayState* play) { this->actor.world.rot.x = Math_Vec3f_Pitch(&this->actor.world.pos, &sp2C); } } else { - this->unk_3E8 = NULL; + this->path = NULL; } } s32 func_80C16818(DemoSyoten* this) { s32 pad; - Path* path = this->unk_3E8; + Path* path = this->path; Vec3s* points; Vec3f sp28; @@ -167,7 +167,7 @@ s32 func_80C16818(DemoSyoten* this) { return true; } - points = Lib_SegmentedToVirtual(this->unk_3E8->points); + points = Lib_SegmentedToVirtual(this->path->points); points += this->unk_3EC; Math_Vec3s_ToVec3f(&sp28, points); this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp28); @@ -181,14 +181,14 @@ s32 func_80C16818(DemoSyoten* this) { void func_80C168D0(DemoSyoten* this, PlayState* play) { s32 pad; - Path* path = this->unk_3E8; + Path* path = this->path; Vec3s* points; Vec3f worldPos; Vec3f projectedPos; f32 invW; if (path != NULL) { - points = Lib_SegmentedToVirtual(this->unk_3E8->points); + points = Lib_SegmentedToVirtual(this->path->points); points += this->unk_3EC; Math_Vec3s_ToVec3f(&worldPos, points); Actor_GetProjectedPos(play, &worldPos, &projectedPos, &invW); @@ -248,6 +248,9 @@ void func_80C16A74(DemoSyoten* this, PlayState* play) { case 4: this->actor.draw = NULL; break; + + default: + break; } } @@ -315,7 +318,7 @@ void func_80C16BD4(DemoSyoten* this, PlayState* play) { case 4: this->actor.speed = play->csCtx.actorCues[Cutscene_GetCueChannel(play, this->cueType)]->rot.z * 0.005493164f; - if (this->unk_3EC < this->unk_3E8->count) { + if (this->unk_3EC < this->path->count) { if (func_80C16818(this)) { this->unk_3EC++; } diff --git a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h index 19f99bf2f3..d5caa19209 100644 --- a/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h +++ b/src/overlays/actors/ovl_Demo_Syoten/z_demo_syoten.h @@ -8,9 +8,9 @@ struct DemoSyoten; typedef void (*DemoSyotenActionFunc)(struct DemoSyoten*, PlayState*); #define DEMOSYOTEN_GET_F(thisx) ((thisx)->params & 0xF) -#define DEMOSYOTEN_GET_7E00(thisx) (((thisx)->params & 0x7E00) >> 9) +#define DEMOSYOTEN_GET_PATH_INDEX(thisx) (((thisx)->params & 0x7E00) >> 9) -#define DEMOSYOTEN_7E00_3F 0x3F +#define DEMOSYOTEN_PATH_INDEX_NONE 0x3F typedef enum { /* 0 */ DEMOSYOTEN_F_0, @@ -30,7 +30,7 @@ typedef struct DemoSyoten { /* 0x3E0 */ AnimatedMaterial* unk_3E0; /* 0x3E4 */ u16 unk_3E4; /* 0x3E6 */ s16 unk_3E6; - /* 0x3E8 */ Path* unk_3E8; + /* 0x3E8 */ Path* path; /* 0x3EC */ s32 unk_3EC; /* 0x3F0 */ u16 cueType; /* 0x3F2 */ u16 cueId; diff --git a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c index 4aee77c832..1165f34335 100644 --- a/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c +++ b/src/overlays/actors/ovl_Dm_Char02/z_dm_char02.c @@ -146,8 +146,11 @@ void DmChar02_Update(Actor* thisx, PlayState* play) { DmChar02* this = THIS; SkelAnime_Update(&this->skelAnime); - this->unk_2F0 = this->unk_2F0; + + this->unk_2F0 = this->unk_2F0; // Set to itself + this->actionFunc(this, play); + if (!Actor_HasParent(&this->actor, play)) { Actor_OfferGetItem(&this->actor, play, GI_OCARINA_OF_TIME, 30.0f, 80.0f); } else { diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c index 3ac3f2947a..430f047947 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.c @@ -71,7 +71,7 @@ void DmChar09_Destroy(Actor* thisx, PlayState* play) { } void func_80AB1FA0(DmChar09* this, s32 arg1) { - Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->unk_224[arg1]); + Math_Vec3s_ToVec3f(&this->actor.world.pos, &this->pathPoints[arg1]); } void func_80AB1FDC(DmChar09* this, PlayState* play) { @@ -85,7 +85,7 @@ void func_80AB1FDC(DmChar09* this, PlayState* play) { Vec3s* temp_v1; Math_Vec3f_Copy(&sp40, &thisx->world.pos); - Math_Vec3s_ToVec3f(&sp58, this->unk_224 + this->unk_21C + this->unk_220); + Math_Vec3s_ToVec3f(&sp58, this->pathPoints + this->unk_21C + this->unk_220); Math_Vec3f_Diff(&sp58, &thisx->world.pos, &thisx->velocity); sp54 = Math3D_Vec3fMagnitude(&thisx->velocity); if ((sp54 < (this->speed * 8.0f)) && (this->speed > 2.0f)) { @@ -107,9 +107,9 @@ void func_80AB1FDC(DmChar09* this, PlayState* play) { phi_a1 = true; if (((this->unk_21C >= this->unk_218) && (this->unk_220 > 0)) || ((this->unk_21C <= 0) && (this->unk_220 < 0))) { - temp_v1 = this->unk_224 + this->unk_218; - if (((this->unk_224->x == temp_v1->x) && (this->unk_224->y == temp_v1->y)) && - (this->unk_224->z == temp_v1->z)) { + temp_v1 = &this->pathPoints[this->unk_218]; + if (((this->pathPoints[0].x == temp_v1->x) && (this->pathPoints[0].y == temp_v1->y)) && + (this->pathPoints[0].z == temp_v1->z)) { this->unk_21C = 0; this->unk_220 = 1; } else { @@ -179,7 +179,7 @@ void DmChar09_HandleCutscene(DmChar09* this, PlayState* play) { path = &play->setupPathList[pathIndex]; } - this->unk_224 = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); this->unk_214 = path->count; this->unk_21C = 0; this->unk_218 = path->count - 1; diff --git a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h index cca08d0795..2d1f6c2aba 100644 --- a/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h +++ b/src/overlays/actors/ovl_Dm_Char09/z_dm_char09.h @@ -26,7 +26,7 @@ typedef struct DmChar09 { /* 0x218 */ s32 unk_218; /* 0x21C */ s32 unk_21C; /* 0x220 */ s32 unk_220; - /* 0x224 */ Vec3s* unk_224; + /* 0x224 */ Vec3s* pathPoints; /* 0x228 */ s16 unk_228; /* 0x22A */ s16 unk_22A; /* 0x22C */ UNK_TYPE1 pad22C[2]; diff --git a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c index 2e0c125a93..0cf2a8cfe6 100644 --- a/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c +++ b/src/overlays/actors/ovl_Dm_Stk/z_dm_stk.c @@ -1166,7 +1166,7 @@ void DmStk_Init(Actor* thisx, PlayState* play) { this->fadeInState = SK_FADE_IN_STATE_NONE; this->fadeOutState = SK_FADE_OUT_STATE_NONE; this->fadeOutTimer = 0; - this->alpha = this->alpha; + this->alpha = this->alpha; // Set to itself this->actor.targetArrowOffset = 1100.0f; this->cueId = 99; ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 24.0f); @@ -1824,7 +1824,7 @@ void DmStk_Update(Actor* thisx, PlayState* play) { SkelAnime_Update(&this->skelAnime); } - this->alpha = this->alpha; + this->alpha = this->alpha; // Set to itself this->actionFunc(this, play); @@ -2098,7 +2098,7 @@ void DmStk_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - this->alpha = this->alpha; + this->alpha = this->alpha; // Set to itself Gfx_SetupDL25_Opa(play->state.gfxCtx); if (this->alpha < 255) { diff --git a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c index 2c2c40451a..78f8b161b5 100644 --- a/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c +++ b/src/overlays/actors/ovl_En_Akindonuts/z_en_akindonuts.c @@ -182,47 +182,48 @@ void func_80BECC7C(EnAkindonuts* this, PlayState* play) { } } -s32 func_80BECD10(EnAkindonuts* this, Path* path, s32 arg2) { - Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; - s32 idx = arg2; - s32 sp50 = false; - f32 phi_f12; - f32 phi_f14; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnAkindonuts_HasReachedPoint(EnAkindonuts* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &sp5C[idx]); + Math_Vec3s_ToVec3f(&point, &points[index]); - if (idx == 0) { - phi_f12 = sp5C[1].x - sp5C[0].x; - phi_f14 = sp5C[1].z - sp5C[0].z; - } else if (idx == (sp58 - 1)) { - phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x; - phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z; + if (index == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - phi_f12 = sp5C[idx + 1].x - sp5C[idx - 1].x; - phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); - if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - sp50 = true; + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); + + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return sp50; + return reached; } f32 func_80BECEAC(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) { - Vec3s* temp; + Vec3s* points; Vec3f sp20; Vec3s* point; if (path != NULL) { - temp = Lib_SegmentedToVirtual(path->points); - point = &temp[arg1]; + points = Lib_SegmentedToVirtual(path->points); + point = &points[arg1]; sp20.x = point->x; sp20.y = point->y; @@ -236,12 +237,12 @@ f32 func_80BECEAC(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) { } s16 func_80BECF6C(Path* path) { - Vec3s* sp34 = Lib_SegmentedToVirtual(path->points); + Vec3s* points = Lib_SegmentedToVirtual(path->points); Vec3f sp28; Vec3f sp1C; - Math_Vec3s_ToVec3f(&sp28, &sp34[0]); - Math_Vec3s_ToVec3f(&sp1C, &sp34[1]); + Math_Vec3s_ToVec3f(&sp28, &points[0]); + Math_Vec3s_ToVec3f(&sp1C, &points[1]); return Math_Vec3f_Yaw(&sp28, &sp1C); } @@ -1639,7 +1640,7 @@ void func_80BEFAF0(EnAkindonuts* this, PlayState* play) { this->unk_352 += this->unk_362; this->actor.world.rot.x = -sp38.x; - if (func_80BECD10(this, this->path, this->unk_334) && (sp34 < 10.0f)) { + if (EnAkindonuts_HasReachedPoint(this, this->path, this->unk_334) && (sp34 < 10.0f)) { if (this->unk_334 >= (this->path->count - 1)) { CutsceneManager_Stop(this->csId); this->actionFunc = func_80BEFD74; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.c b/src/overlays/actors/ovl_En_Az/z_en_az.c index 1eaf1c9a50..d9872defec 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.c +++ b/src/overlays/actors/ovl_En_Az/z_en_az.c @@ -346,8 +346,8 @@ void EnAz_Init(Actor* thisx, PlayState* play2) { } } if (this->unk_374 & 1) { - SubS_CopyPointFromPathList(play->setupPathList, BEAVER_GET_PARAM_FF(thisx), - play->setupPathList[BEAVER_GET_PARAM_FF(thisx)].count - 1, &D_80A99E80); + SubS_CopyPointFromPathList(play->setupPathList, BEAVER_GET_PATH_INDEX(thisx), + play->setupPathList[BEAVER_GET_PATH_INDEX(thisx)].count - 1, &D_80A99E80); } if (CHECK_WEEKEVENTREG(WEEKEVENTREG_24_04)) { if (this->unk_374 & 2) { @@ -622,7 +622,7 @@ void func_80A95DA0(EnAz* this, PlayState* play) { ActorPathing* sp40 = &this->unk_300; SubS_ActorPathing_Init(play, &this->actor.world.pos, &this->actor, sp40, play->setupPathList, - BEAVER_GET_PARAM_FF(&this->actor), 0, 0, 1, 1); + BEAVER_GET_PATH_INDEX(&this->actor), 0, 0, 1, 1); this->unk_36C = 4.0f; this->actor.speed = 4.0f; this->actor.gravity = 0.0f; @@ -1614,7 +1614,7 @@ void func_80A97E48(EnAz* this, PlayState* play) { void func_80A97EAC(EnAz* this, PlayState* play) { SubS_ActorPathing_Init(play, &this->actor.world.pos, &this->actor, &this->unk_300, play->setupPathList, - BEAVER_GET_PARAM_FF(&this->actor), 0, 0, 1, 0); + BEAVER_GET_PATH_INDEX(&this->actor), 0, 0, 1, 0); this->unk_36C = 8.0f; this->actor.speed = 8.0f; this->actor.gravity = 0.0f; @@ -1974,6 +1974,7 @@ s32 EnAz_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po *dList = NULL; } if (limbIndex == BEAVER_OLDER_BROTHER_LIMB_NONE) { + // Set to itself rot->x = rot->x; rot->y = rot->y; rot->z = rot->z; diff --git a/src/overlays/actors/ovl_En_Az/z_en_az.h b/src/overlays/actors/ovl_En_Az/z_en_az.h index 486257286e..286dc853a4 100644 --- a/src/overlays/actors/ovl_En_Az/z_en_az.h +++ b/src/overlays/actors/ovl_En_Az/z_en_az.h @@ -9,7 +9,7 @@ struct EnAz; typedef void (*EnAzActionFunc)(struct EnAz*, PlayState*); #define BEAVER_GET_PARAM_F00(thisx) (((thisx)->params >> 8) & 0xF) -#define BEAVER_GET_PARAM_FF(thisx) ((thisx)->params & 0xFF) +#define BEAVER_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) typedef struct EnAz { /* 0x000 */ Actor actor; diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index ae1f9e3fbd..15231aae4e 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -130,7 +130,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_U8(targetMode, TARGET_MODE_5, ICHAIN_STOP), }; -s32 D_80A29778 = 0; +static s32 sTexturesDesegmented = false; Vec3f D_80A2977C = { 0.0f, 1.0f, 0.0f }; Color_RGBA8 D_80A29788 = { 250, 250, 250, 255 }; Color_RGBA8 D_80A2978C = { 180, 180, 180, 255 }; @@ -151,11 +151,11 @@ void EnBigpamet_Init(Actor* thisx, PlayState* play) { Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit); - if (!D_80A29778) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(D_80A29754); i++) { D_80A29754[i] = Lib_SegmentedToVirtual(D_80A29754[i]); } - D_80A29778 = true; + sTexturesDesegmented = true; } this->actor.params = ENBIGPAMET_1; @@ -532,9 +532,9 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if ((s16)(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0) { - this->actor.world.rot.y = this->actor.world.rot.y - 0x300; + this->actor.world.rot.y -= 0x300; } else { - this->actor.world.rot.y = this->actor.world.rot.y + 0x300; + this->actor.world.rot.y += 0x300; } } diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index cbf2e64ab9..551a10e246 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -1067,7 +1067,7 @@ void EnBigpo_FlameCircleCutscene(EnBigpo* this, PlayState* play) { if (magnitude > 0.0001f) { Math_Vec3f_Scale(&posDiff, 1.0f / magnitude); } - magnitude = magnitude / this->idleTimer; + magnitude /= this->idleTimer; this->actor.world.pos.x -= magnitude * posDiff.x; this->actor.world.pos.y -= magnitude * posDiff.y; this->actor.world.pos.z -= magnitude * posDiff.z; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 7ef4eb8912..a19c789095 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -447,10 +447,12 @@ s32 EnBji01_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* *dList = NULL; } if (limbIndex == SHIKASHI_LIMB_NONE) { + // Set to itself rot->x = rot->x; rot->y = rot->y; rot->z = rot->z; } + switch (limbIndex) { case SHIKASHI_LIMB_TORSO: rot->x += this->torsoXRotStep; diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index aa67e2e6a5..f7794b767c 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -290,7 +290,7 @@ void EnBom_Move(EnBom* this, PlayState* play) { if ((floorType == FLOOR_TYPE_4) || (floorType == FLOOR_TYPE_14) || (floorType == FLOOR_TYPE_15)) { this->actor.velocity.y = 0.0f; } else { - this->actor.velocity.y = this->actor.velocity.y * sp58->z; + this->actor.velocity.y *= sp58->z; } this->actor.bgCheckFlags &= ~BGCHECKFLAG_GROUND; } diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 75852a9d93..2f4e22c515 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -389,7 +389,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) { } if ((this->timer == 3) || (this->timer == 30) || (this->timer == 50) || (this->timer == 70)) { - this->unk_1FE = this->unk_1FE >> 1; + this->unk_1FE >>= 1; } if ((this->timer < 100) && (this->timer & (this->unk_1FE + 1))) { diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index e08ed2bdf2..72f9236e59 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -537,11 +537,7 @@ void EnCrow_Update(Actor* thisx, PlayState* play) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffFrozenSteamScale = (this->drawDmgEffAlpha + 1.0f) * 0.25f; - if (this->drawDmgEffFrozenSteamScale > 0.5f) { - this->drawDmgEffFrozenSteamScale = 0.5f; - } else { - this->drawDmgEffFrozenSteamScale = this->drawDmgEffFrozenSteamScale; - } + this->drawDmgEffFrozenSteamScale = CLAMP_MAX(this->drawDmgEffFrozenSteamScale, 0.5f); } else if (!Math_StepToF(&this->drawDmgEffScale, 0.5f, 0.5f * 0.025f)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index ddc7db8c75..340b859070 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -266,8 +266,8 @@ void EnDg_GetFloorRot(EnDg* this, Vec3f* floorRot) { s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) { Vec3s* points = Lib_SegmentedToVirtual(path->points); - s32 pathCount = path->count; - s32 currentPoint = pointIndex; + s32 count = path->count; + s32 index = pointIndex; s32 reached = false; f32 diffX; f32 diffZ; @@ -276,21 +276,22 @@ s32 EnDg_HasReachedPoint(EnDg* this, Path* path, s32 pointIndex) { f32 d; Vec3f point; - Math_Vec3s_ToVec3f(&point, &points[currentPoint]); - if (currentPoint == 0) { + Math_Vec3s_ToVec3f(&point, &points[index]); + + if (index == 0) { diffX = points[1].x - points[0].x; diffZ = points[1].z - points[0].z; - } else if (currentPoint == pathCount - 1) { - diffX = points[pathCount - 1].x - points[pathCount - 2].x; - diffZ = points[pathCount - 1].z - points[pathCount - 2].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - diffX = points[currentPoint + 1].x - points[currentPoint - 1].x; - diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 4d8156a5f4..2fafba14bc 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -259,7 +259,7 @@ static InitChainEntry sInitChain[] = { }; void EnDinofos_Init(Actor* thisx, PlayState* play) { - static s32 D_8089E364 = 0; + static s32 sTexturesDesegmented = false; static EffectBlureInit2 D_8089E368 = { 0, 8, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, { 255, 255, 255, 0 }, { 255, 255, 255, 0 }, 8, 0, 2, 0, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, @@ -277,11 +277,11 @@ void EnDinofos_Init(Actor* thisx, PlayState* play) { SkelAnime_InitFlex(play, &this->skelAnime, &gDinolfosSkel, &gDinolfosIdleAnim, this->jointTable, this->morphTable, DINOLFOS_LIMB_MAX); - if (D_8089E364 == 0) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) { sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); } - D_8089E364 = 1; + sTexturesDesegmented = true; } this->unk_288 = 255; diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index ac05fc9a1d..af7b4311f4 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -499,7 +499,7 @@ void func_80876DC4(EnDodongo* this, PlayState* play) { sp68.x = this->bodyPartsPos[DODONGO_BODYPART_0].x + (temp_f20 * 6.0f * this->unk_334); sp68.z = this->bodyPartsPos[DODONGO_BODYPART_0].z - (temp_f22 * 6.0f * this->unk_334); sp80.x *= -1.0f; - sp80.z = sp80.z * -1.0f; + sp80.z *= -1.0f; sp74.x = (Rand_ZeroFloat(0.1f) + 0.15f) * -temp_f20 * this->unk_334; sp74.z = (Rand_ZeroFloat(0.1f) + 0.15f) * temp_f22 * this->unk_334; func_800B0EB0(play, &sp68, &sp80, &sp74, &this->unk_32C, &this->unk_330, sp64, sp62, 0x14); diff --git a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c index f04714bb22..909a004fad 100644 --- a/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c +++ b/src/overlays/actors/ovl_En_Encount3/z_en_encount3.c @@ -150,7 +150,7 @@ void EnEncount3_Update(Actor* thisx, PlayState* play2) { func_800B8D50(play, &this->actor, 10.0f, Math_Atan2S_XY(sp38, sp3C), 0.0f, 1); } } - this->child->colChkInfo = this->child->colChkInfo; + this->child->colChkInfo = this->child->colChkInfo; // Set to itself } this->unk168 = this->unk16C; diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 7c906e7397..7df5498e74 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -730,7 +730,7 @@ void func_8091EFE8(Actor* thisx, PlayState* play) { temp_v0_2 = BINANG_SUB(this->unk_268, this->actor.shape.rot.x); temp_v0_2 = ABS_ALT(temp_v0_2); - temp_v0_2 = temp_v0_2 / 11; + temp_v0_2 /= 11; if (temp_v0_2 > 800) { temp_v0_2 = 800; } else if (temp_v0_2 < 100) { diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 4cbca2f2d2..9e92690349 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -135,13 +135,13 @@ void func_809616E0(EnFu* this, PlayState* play) { this->unk_54C = 0; for (i = 0; i < this->unk_520; i++) { - temp_f20 = this->actor.world.pos.x - this->unk_538[i].x; - temp_f22 = this->actor.world.pos.z - this->unk_538[i].z; + temp_f20 = this->actor.world.pos.x - this->pathPoints[i].x; + temp_f22 = this->actor.world.pos.z - this->pathPoints[i].z; atan = Math_Atan2S_XY(temp_f22, temp_f20); if (!spA0 || ((i % 2) != 0)) { - Actor_Spawn(&play->actorCtx, play, this->unk_544, this->unk_538[i].x, this->unk_538[i].y, - this->unk_538[i].z, 0, atan, 0, i); + Actor_Spawn(&play->actorCtx, play, this->unk_544, this->pathPoints[i].x, this->pathPoints[i].y, + this->pathPoints[i].z, 0, atan, 0, i); this->unk_54C++; } @@ -151,9 +151,9 @@ void func_809616E0(EnFu* this, PlayState* play) { Color_RGBA8 sp78 = { 255, 255, 255, 255 }; Color_RGBA8 sp74 = { 198, 198, 198, 255 }; - sp94.x = this->unk_538[i].x; - sp94.y = this->unk_538[i].y; - sp94.z = this->unk_538[i].z; + sp94.x = this->pathPoints[i].x; + sp94.y = this->pathPoints[i].y; + sp94.z = this->pathPoints[i].z; func_800B0EB0(play, &sp94, &sp88, &sp7C, &sp78, &sp74, 100, 150, 10); sp94.x -= 0.1f * temp_f20; sp94.z -= 0.1f * temp_f22; @@ -164,7 +164,7 @@ void func_809616E0(EnFu* this, PlayState* play) { void func_809619D0(EnFu* this, PlayState* play) { s32 i; - Path* path = &play->setupPathList[ENFU_GET_FF00(&this->actor)]; + Path* path = &play->setupPathList[ENFU_GET_PATH_INDEX(&this->actor)]; switch (CURRENT_DAY) { case 1: @@ -193,7 +193,7 @@ void func_809619D0(EnFu* this, PlayState* play) { } this->unk_520 = path->count; - this->unk_538 = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); func_809616E0(this, play); } diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.h b/src/overlays/actors/ovl_En_Fu/z_en_fu.h index ecd4878c21..70a0aa3126 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.h +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.h @@ -9,7 +9,7 @@ struct EnFu; typedef void (*EnFuActionFunc)(struct EnFu*, PlayState*); -#define ENFU_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) +#define ENFU_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF) typedef struct { /* 0x00 */ f32 unk_00; @@ -38,7 +38,7 @@ typedef struct EnFu { /* 0x524 */ s16 unk_524[3]; /* 0x52A */ s16 unk_52A[3]; /* 0x530 */ UNK_TYPE1 unk530[0x8]; - /* 0x538 */ Vec3s* unk_538; + /* 0x538 */ Vec3s* pathPoints; /* 0x53C */ s16 unk_53C; /* 0x53E */ s16 unk_53E; /* 0x540 */ s16 unk_540; diff --git a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c index 397b877da1..20128aaf21 100644 --- a/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c +++ b/src/overlays/actors/ovl_En_Fu_Mato/z_en_fu_mato.c @@ -102,7 +102,7 @@ void EnFuMato_Init(Actor* thisx, PlayState* play) { this->collider.dim.worldSphere.radius = 30; } else { this->collider.dim.worldSphere.radius = 17; - this->unk_2F8 = fu->unk_538; + this->unk_2F8 = fu->pathPoints; this->unk_2F4 = fu->unk_520; this->unk_2F0 = ENFUMATO_GET(&this->dyna.actor); } @@ -312,11 +312,7 @@ void func_80ACECFC(EnFuMato* this, PlayState* play) { ptr->unk_24.z += ptr->unk_2A.z; if ((this->unk_302 == 2) && (ptr->unk_30 == 1) && (ptr->unk_00.y < (this->dyna.actor.floorHeight + 10.0f))) { - if (ptr->unk_0C.y < 0.0f) { - ptr->unk_0C.y = -ptr->unk_0C.y; - } else { - ptr->unk_0C.y = ptr->unk_0C.y; - } + ptr->unk_0C.y = ABS_ALT(ptr->unk_0C.y); ptr->unk_0C.y *= 0.5f; ptr->unk_0C.x *= (Rand_Centered() * 1.5f) + 2.0f; ptr->unk_0C.z *= (Rand_Centered() * 1.5f) + 2.0f; diff --git a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c index 1add324962..70eaf95530 100644 --- a/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c +++ b/src/overlays/actors/ovl_En_Gg2/z_en_gg2.c @@ -23,7 +23,7 @@ void func_80B3B120(EnGg2* this, PlayState* play); void func_80B3B21C(EnGg2* this, PlayState* play); void func_80B3B294(EnGg2* this, PlayState* play); void func_80B3B5D4(EnGg2* this, PlayState* play); -s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_); +s32 EnGg2_HasReachedPoint(EnGg2* this, Path* path, s32 pointIndex); f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3); ActorInit En_Gg2_InitVars = { @@ -217,7 +217,7 @@ void func_80B3B120(EnGg2* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1); this->actor.world.rot.x = -this->actor.shape.rot.x; - if (func_80B3B648(this, this->path, this->unk_1DC) != 0) { + if (EnGg2_HasReachedPoint(this, this->path, this->unk_1DC)) { if (this->unk_1DC >= (this->path->count - 2)) { this->actionFunc = func_80B3AE60; this->actor.speed = 0.0f; @@ -262,7 +262,7 @@ void func_80B3B294(EnGg2* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 0x3E8, 1); this->actor.world.rot.x = -this->actor.shape.rot.x; - if (func_80B3B648(this, this->path, this->unk_1DC)) { + if (EnGg2_HasReachedPoint(this, this->path, this->unk_1DC)) { if (this->unk_1DC < (this->path->count - 1)) { this->unk_1DC++; } else { @@ -313,37 +313,38 @@ void func_80B3B5D4(EnGg2* this, PlayState* play) { } } -s32 func_80B3B648(EnGg2* this, Path* path, s32 arg2_) { +s32 EnGg2_HasReachedPoint(EnGg2* this, Path* path, s32 pointIndex) { Vec3s* points = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; - s32 arg2 = arg2_; - s32 ret = false; - f32 phi_f12; - f32 phi_f14; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &points[arg2]); + Math_Vec3s_ToVec3f(&point, &points[index]); - if (arg2 == 0) { - phi_f12 = points[1].x - points[0].x; - phi_f14 = points[1].z - points[0].z; - } else if ((sp58 - 1) == arg2) { - phi_f12 = points[sp58 - 1].x - points[sp58 - 2].x; - phi_f14 = points[sp58 - 1].z - points[sp58 - 2].z; + if (index == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - phi_f12 = points[arg2 + 1].x - points[arg2 - 1].x; - phi_f14 = points[arg2 + 1].z - points[arg2 - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - ret = true; + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return ret; + + return reached; } f32 func_80B3B7E4(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { diff --git a/src/overlays/actors/ovl_En_Gk/z_en_gk.c b/src/overlays/actors/ovl_En_Gk/z_en_gk.c index 1efede8f95..32946818ac 100644 --- a/src/overlays/actors/ovl_En_Gk/z_en_gk.c +++ b/src/overlays/actors/ovl_En_Gk/z_en_gk.c @@ -389,36 +389,38 @@ void func_80B50B38(EnGk* this, PlayState* play) { } } -s32 func_80B50C78(EnGk* this, Path* path, s32 arg2_) { - Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; - s32 arg2 = arg2_; - s32 ret = false; - f32 phi_f12; - f32 phi_f14; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnGk_HasReachedPoint(EnGk* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &sp5C[arg2]); - if (arg2 == 0) { - phi_f12 = sp5C[1].x - sp5C[0].x; - phi_f14 = sp5C[1].z - sp5C[0].z; - } else if ((sp58 - 1) == arg2) { - phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x; - phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z; + Math_Vec3s_ToVec3f(&point, &points[index]); + + if (index == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - phi_f12 = sp5C[arg2 + 1].x - sp5C[arg2 - 1].x; - phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - ret = true; + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return ret; + + return reached; } f32 func_80B50E14(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { @@ -854,7 +856,7 @@ void func_80B51EA4(EnGk* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, sp38.y, 5, 0x1000, 0x100); this->actor.shape.rot.y = this->actor.world.rot.y; sp36 = this->actor.shape.rot.y - sp38.y; - if (func_80B50C78(this, this->path, this->unk_1EC)) { + if (EnGk_HasReachedPoint(this, this->path, this->unk_1EC)) { if (this->unk_1EC >= (this->path->count - 1)) { CutsceneManager_Stop(this->csId); Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index fd3deb557b..2f1839ebd1 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -189,17 +189,17 @@ void func_8093EB58(EnGoroiwa* this, PlayState* play) { f32 func_8093EB74(EnGoroiwa* this, PlayState* play) { s32 i; - Path* path = &play->setupPathList[ENGOROIWA_GET_FF(&this->actor)]; + Path* path = &play->setupPathList[ENGOROIWA_GET_PATH_INDEX(&this->actor)]; s32 temp_s4 = path->count; f32 temp_f20 = 0.0f; Vec3f sp54; Vec3f sp48; - Math_Vec3s_ToVec3f(&sp48, &this->unk_1D0[0]); + Math_Vec3s_ToVec3f(&sp48, &this->pathPoints[0]); for (i = 1; i < temp_s4; i++) { Math_Vec3f_Copy(&sp54, &sp48); - Math_Vec3s_ToVec3f(&sp48, &this->unk_1D0[i]); + Math_Vec3s_ToVec3f(&sp48, &this->pathPoints[i]); temp_f20 += Math3D_Distance(&sp54, &sp48); } @@ -207,7 +207,7 @@ f32 func_8093EB74(EnGoroiwa* this, PlayState* play) { } void func_8093EC50(EnGoroiwa* this) { - Vec3s* var = &this->unk_1D0[this->unk_1D8]; + Vec3s* var = &this->pathPoints[this->unk_1D8]; Vec3f sp18; sp18.x = var->x; @@ -255,21 +255,21 @@ void func_8093EDB0(EnGoroiwa* this) { } void func_8093EDD8(EnGoroiwa* this, PlayState* play) { - this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; + this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_PATH_INDEX(&this->actor)].count - 1; this->unk_1D6 = 0; this->unk_1D8 = 1; this->unk_1DA = 1; } void func_8093EE18(EnGoroiwa* this, PlayState* play) { - this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_FF(&this->actor)].count - 1; + this->unk_1D4 = play->setupPathList[ENGOROIWA_GET_PATH_INDEX(&this->actor)].count - 1; this->unk_1D6 = this->actor.home.rot.y; this->unk_1D8 = this->unk_1D6 + 1; this->unk_1DA = 1; } void func_8093EE64(EnGoroiwa* this, s32 arg1) { - Vec3s* temp_v0 = &this->unk_1D0[arg1]; + Vec3s* temp_v0 = &this->pathPoints[arg1]; this->actor.world.pos.x = temp_v0->x; this->actor.world.pos.y = temp_v0->y; @@ -283,8 +283,8 @@ void func_8093EEBC(EnGoroiwa* this) { } s32 func_8093EEDC(EnGoroiwa* this) { - Vec3s* temp_v1 = &this->unk_1D0[this->unk_1D8]; - Vec3s* temp_v0 = &this->unk_1D0[this->unk_1D6]; + Vec3s* temp_v1 = &this->pathPoints[this->unk_1D8]; + Vec3s* temp_v0 = &this->pathPoints[this->unk_1D6]; if ((temp_v1->x == temp_v0->x) && (temp_v1->z == temp_v0->z)) { if (temp_v0->y < temp_v1->y) { @@ -360,7 +360,7 @@ s32 func_8093F34C(EnGoroiwa* this) { Math_StepToF(&this->actor.speed, D_80942DFC[this->unk_1E4], 0.3f); Actor_UpdateVelocityWithGravity(&this->actor); - temp_v0 = &this->unk_1D0[this->unk_1D8]; + temp_v0 = &this->pathPoints[this->unk_1D8]; this->actor.velocity.y *= 0.97f; x = temp_v0->x; z = temp_v0->z; @@ -387,7 +387,7 @@ s32 func_8093F498(EnGoroiwa* this) { s32 pad; f32 temp_f0; Vec3f sp2C; - Vec3s* temp_v0 = &this->unk_1D0[this->unk_1D8]; + Vec3s* temp_v0 = &this->pathPoints[this->unk_1D8]; sp2C.x = temp_v0->x; sp2C.y = temp_v0->y; @@ -415,7 +415,7 @@ s32 func_8093F498(EnGoroiwa* this) { s32 func_8093F5EC(EnGoroiwa* this) { s32 pad; - Vec3s* sp18 = &this->unk_1D0[this->unk_1D8]; + Vec3s* sp18 = &this->pathPoints[this->unk_1D8]; if (this->actor.velocity.y < 0.0f) { this->actor.velocity.y = 0.0f; @@ -436,7 +436,7 @@ s32 func_8093F5EC(EnGoroiwa* this) { s32 func_8093F6F8(EnGoroiwa* this, PlayState* play) { f32 temp_f14; - Vec3s* sp80 = &this->unk_1D0[this->unk_1D8]; + Vec3s* sp80 = &this->pathPoints[this->unk_1D8]; f32 sp7C = sp80->y; f32 sp78; f32 temp_f2; @@ -948,11 +948,11 @@ void func_80941274(EnGoroiwa* this, PlayState* play) { } void EnGoroiwa_Init(Actor* thisx, PlayState* play) { + s32 pad; EnGoroiwa* this = THIS; f32 temp_f0; - s32 params = ENGOROIWA_GET_FF(&this->actor); - s32 sp28 = params * 8; - Path* sp2C = &play->setupPathList[params]; + s32 pathIndex = ENGOROIWA_GET_PATH_INDEX(&this->actor); + Path* path = &play->setupPathList[pathIndex]; Actor_ProcessInitChain(&this->actor, sInitChain); this->actor.world.rot.x = 0; @@ -965,17 +965,17 @@ void EnGoroiwa_Init(Actor* thisx, PlayState* play) { func_8093E91C(this); func_8093E9B0(this, play); - if (sp28 == 0x7F8) { + if (pathIndex == ENGOROIWA_PATH_INDEX_NONE) { Actor_Kill(&this->actor); return; } - if (sp2C->count < 2) { + if (path->count < 2) { Actor_Kill(&this->actor); return; } - if ((this->actor.home.rot.y >= (sp2C->count - 1)) && (this->actor.home.rot.y < 0)) { + if ((this->actor.home.rot.y >= (path->count - 1)) && (this->actor.home.rot.y < 0)) { this->actor.home.rot.y = 0; } @@ -984,7 +984,7 @@ void EnGoroiwa_Init(Actor* thisx, PlayState* play) { this->actor.shape.shadowAlpha = 200; func_8093EB58(this, play); - this->unk_1D0 = Lib_SegmentedToVirtual(sp2C->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); func_8093EE18(this, play); func_8093EE64(this, this->actor.home.rot.y); diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h index 2ace5ff851..ed2568b5db 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.h @@ -12,7 +12,9 @@ typedef s32 (*EnGoroiwaUnkFunc)(struct EnGoroiwa*); #define ENGOROIWA_GET_3000(thisx) (((thisx)->params >> 0xC) & 3) #define ENGOROIWA_GET_400(thisx) (((thisx)->params >> 0xA) & 1) #define ENGOROIWA_GET_300(thisx) (((thisx)->params >> 0x8) & 3) -#define ENGOROIWA_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENGOROIWA_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) + +#define ENGOROIWA_PATH_INDEX_NONE 0xFF typedef enum { /* 0 */ ENGOROIWA_300_0, @@ -66,7 +68,7 @@ typedef struct EnGoroiwa { /* 0x1CA */ s16 unk_1CA; /* 0x1CC */ s16 unk_1CC; /* 0x1CE */ s16 unk_1CE; - /* 0x1D0 */ Vec3s* unk_1D0; + /* 0x1D0 */ Vec3s* pathPoints; /* 0x1D4 */ s16 unk_1D4; /* 0x1D6 */ s16 unk_1D6; /* 0x1D8 */ s16 unk_1D8; diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index e1be146e21..d5e0e98d05 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -71,7 +71,7 @@ static TexturePtr sSilverEyeTextures[HONOTRAP_EYE_MAX] = { gEyeSwitchSilverClosedTex, }; -static s32 sIsFirstInitEye = true; +static s32 sTexturesNotDesegmented = true; ActorInit En_Honotrap_InitVars = { /**/ ACTOR_EN_HONOTRAP, @@ -187,8 +187,8 @@ void EnHonotrap_InitEye(EnHonotrap* this, PlayState* play) { Actor_SetScale(&this->actor, 0.1f); - if (sIsFirstInitEye) { - sIsFirstInitEye = false; + if (sTexturesNotDesegmented) { + sTexturesNotDesegmented = false; for (k = 0; k < HONOTRAP_EYE_MAX; k++) { sSilverEyeTextures[k] = Lib_SegmentedToVirtual(sSilverEyeTextures[k]); } diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 419e640826..f7f2cb1a2e 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -314,7 +314,7 @@ void EnHorse_RotateToPoint(EnHorse* this, PlayState* play, Vec3f* pos, s16 turnY void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { s32 spA4; - Vec3s* spA0; + Vec3s* pathPoints; f32 phi_f12; f32 phi_f14; Vec3f sp8C; @@ -331,18 +331,18 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { Vec3f sp50; spA4 = path->count; - spA0 = Lib_SegmentedToVirtual(path->points); - Math_Vec3s_ToVec3f(&sp8C, &spA0[this->curRaceWaypoint]); + pathPoints = Lib_SegmentedToVirtual(path->points); + Math_Vec3s_ToVec3f(&sp8C, &pathPoints[this->curRaceWaypoint]); if (this->curRaceWaypoint == 0) { - phi_f12 = spA0[1].x - spA0[0].x; - phi_f14 = spA0[1].z - spA0[0].z; + phi_f12 = pathPoints[1].x - pathPoints[0].x; + phi_f14 = pathPoints[1].z - pathPoints[0].z; } else if ((this->curRaceWaypoint + 1) == path->count) { - phi_f12 = spA0[path->count - 1].x - spA0[path->count - 2].x; - phi_f14 = spA0[path->count - 1].z - spA0[path->count - 2].z; + phi_f12 = pathPoints[path->count - 1].x - pathPoints[path->count - 2].x; + phi_f14 = pathPoints[path->count - 1].z - pathPoints[path->count - 2].z; } else { - phi_f12 = spA0[this->curRaceWaypoint + 1].x - spA0[this->curRaceWaypoint - 1].x; - phi_f14 = spA0[this->curRaceWaypoint + 1].z - spA0[this->curRaceWaypoint - 1].z; + phi_f12 = pathPoints[this->curRaceWaypoint + 1].x - pathPoints[this->curRaceWaypoint - 1].x; + phi_f14 = pathPoints[this->curRaceWaypoint + 1].z - pathPoints[this->curRaceWaypoint - 1].z; } func_8017B7F8(&sp8C, Math_Atan2S(phi_f12, phi_f14), &sp7C, &sp78, &sp74); @@ -352,13 +352,13 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { if (this->curRaceWaypoint >= spA4) { this->curRaceWaypoint = spA4 - 1; } - Math_Vec3s_ToVec3f(&sp8C, &spA0[this->curRaceWaypoint]); + Math_Vec3s_ToVec3f(&sp8C, &pathPoints[this->curRaceWaypoint]); } if (this->curRaceWaypoint == 0) { - Math_Vec3s_ToVec3f(&sp80, &spA0[1]); + Math_Vec3s_ToVec3f(&sp80, &pathPoints[1]); } else { - Math_Vec3s_ToVec3f(&sp80, &spA0[this->curRaceWaypoint - 1]); + Math_Vec3s_ToVec3f(&sp80, &pathPoints[this->curRaceWaypoint - 1]); } func_8017D7C0(this->actor.world.pos.x, this->actor.world.pos.z, sp80.x, sp80.z, sp8C.x, sp8C.z, &sp70); @@ -398,12 +398,12 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { sp64 = 1.0e+38; sp60 = sp68 + 5; - if (path->count < sp60) { + if (sp60 > path->count) { sp60 = path->count; } for (i = sp68; i < sp60; i++) { - Math_Vec3s_ToVec3f(&sp50, &spA0[i]); + Math_Vec3s_ToVec3f(&sp50, &pathPoints[i]); temp_f0 = Math3D_Distance(&this->actor.world.pos, &sp50); if (temp_f0 < sp64) { sp64 = temp_f0; @@ -411,7 +411,7 @@ void func_8087B7C0(EnHorse* this, PlayState* play, Path* path) { } } - this->unk_398 = spA0[this->curRaceWaypoint].y * 0.01f; + this->unk_398 = pathPoints[this->curRaceWaypoint].y * 0.01f; if ((this->unk_1EC & 0x100) && !(this->stateFlags & ENHORSE_JUMPING) && ((this->colliderCylinder1.base.acFlags & AC_HIT) || (this->colliderCylinder2.base.acFlags & AC_HIT) || (this->unk_58C > 0))) { @@ -836,8 +836,8 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) { Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements); if (this->type == HORSE_TYPE_2) { - this->colliderCylinder1.dim.radius = this->colliderCylinder1.dim.radius * 0.8f; - this->colliderCylinder2.dim.radius = this->colliderCylinder2.dim.radius * 0.8f; + this->colliderCylinder1.dim.radius *= 0.8f; + this->colliderCylinder2.dim.radius *= 0.8f; this->colliderJntSph.elements[0].dim.modelSphere.radius *= 0.6f; } else if (this->type == HORSE_TYPE_DONKEY) { this->colliderCylinder1.dim.radius = 50; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 4de7cf85bd..9a6c697c1c 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -916,11 +916,7 @@ void EnIk_Update(Actor* thisx, PlayState* play2) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.325f; - if ((this->drawDmgEffAlpha + 1.0f) * 0.325f > 0.65f) { - this->drawDmgEffScale = 0.65f; - } else { - this->drawDmgEffScale = this->drawDmgEffScale; - } + this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.65f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.65f, 0.01625f)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index b62f5225c0..56d322575d 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -218,10 +218,10 @@ s16 EnJg_GetWalkingYRotation(Path* path, s32 pointIndex, Vec3f* pos, f32* distSQ return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); } -s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) { +s32 EnJg_HasReachedPoint(EnJg* this, Path* path, s32 pointIndex) { Vec3s* points = Lib_SegmentedToVirtual(path->points); - s32 pathCount = path->count; - s32 currentPoint = pointIndex; + s32 count = path->count; + s32 index = pointIndex; s32 reached = false; f32 diffX; f32 diffZ; @@ -230,21 +230,22 @@ s32 EnJg_ReachedPoint(EnJg* this, Path* path, s32 pointIndex) { f32 d; Vec3f point; - Math_Vec3s_ToVec3f(&point, &points[pointIndex]); - if (currentPoint == 0) { + Math_Vec3s_ToVec3f(&point, &points[index]); + + if (index == 0) { diffX = points[1].x - points[0].x; diffZ = points[1].z - points[0].z; - } else if (currentPoint == (pathCount - 1)) { - diffX = points[pathCount - 1].x - points[pathCount - 2].x; - diffZ = points[pathCount - 1].z - points[pathCount - 2].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - diffX = points[currentPoint + 1].x - points[currentPoint - 1].x; - diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } @@ -456,7 +457,7 @@ void EnJg_Walk(EnJg* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, yRotation, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - if (EnJg_ReachedPoint(this, this->path, this->currentPoint)) { + if (EnJg_HasReachedPoint(this, this->path, this->currentPoint)) { if (this->currentPoint >= (this->path->count - 1)) { // Force the elder to walk in place this->animIndex = EN_JG_ANIM_WALK; diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c index 72a3e174d0..1f3c675a54 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.c @@ -116,7 +116,7 @@ void EnJgameTsn_Init(Actor* thisx, PlayState* play) { } void func_80C13A2C(EnJgameTsn* this, PlayState* play) { - Path* path = &play->setupPathList[ENJGAMETSN_GET_FF(&this->actor)]; + Path* path = &play->setupPathList[ENJGAMETSN_GET_PATH_INDEX(&this->actor)]; s32 i; if (path == NULL) { diff --git a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h index c32a51565f..2cb22b2d5a 100644 --- a/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h +++ b/src/overlays/actors/ovl_En_Jgame_Tsn/z_en_jgame_tsn.h @@ -8,7 +8,7 @@ struct EnJgameTsn; typedef void (*EnJgameTsnActionFunc)(struct EnJgameTsn*, PlayState*); -#define ENJGAMETSN_GET_FF(thisx) ((thisx)->params & 0xFF) +#define ENJGAMETSN_GET_PATH_INDEX(thisx) ((thisx)->params & 0xFF) typedef struct { /* 0x00 */ Vec3s* points; diff --git a/src/overlays/actors/ovl_En_Kame/z_en_kame.c b/src/overlays/actors/ovl_En_Kame/z_en_kame.c index bf865545b1..1167cb88ba 100644 --- a/src/overlays/actors/ovl_En_Kame/z_en_kame.c +++ b/src/overlays/actors/ovl_En_Kame/z_en_kame.c @@ -887,11 +887,7 @@ void EnKame_Update(Actor* thisx, PlayState* play) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.3f; - if (this->drawDmgEffScale > 0.6f) { - this->drawDmgEffScale = 0.6f; - } else { - this->drawDmgEffScale = this->drawDmgEffScale; - } + this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.6f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.6f, 15.0f * 0.001f)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index cfdb2bda94..3648b0d0c9 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -590,11 +590,7 @@ void EnKarebaba_Update(Actor* thisx, PlayState* play2) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.375f; - if (this->drawDmgEffScale > 0.75f) { - this->drawDmgEffScale = 0.75f; - } else { - this->drawDmgEffScale = this->drawDmgEffScale; - } + this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.75f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.75f / 40)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index c6ec9bd2d2..f488007763 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -136,9 +136,9 @@ void EnKendoJs_Init(Actor* thisx, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (ENKENDOJS_GET_FF(&this->actor) != ENKENDOJS_FF_1) { - Path* path = &play->setupPathList[ENKENDOJS_GET_FF00(&this->actor)]; + Path* path = &play->setupPathList[ENKENDOJS_GET_PATH_INDEX(&this->actor)]; - this->unk_274 = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); } this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; @@ -749,9 +749,9 @@ void func_80B279AC(EnKendoJs* this, PlayState* play) { } void func_80B279F0(EnKendoJs* this, PlayState* play, s32 arg2) { - f32 x = this->unk_274[arg2].x; - f32 y = this->unk_274[arg2].y; - f32 z = this->unk_274[arg2].z; + f32 x = this->pathPoints[arg2].x; + f32 y = this->pathPoints[arg2].y; + f32 z = this->pathPoints[arg2].z; Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, ACTOR_EN_MARUTA, x, y, z, 0, 0, 0, 0); this->unk_28C++; diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h index 8602550e0d..b15e3f9a1c 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.h @@ -9,7 +9,7 @@ struct EnKendoJs; typedef void (*EnKendoJsActionFunc)(struct EnKendoJs*, PlayState*); #define ENKENDOJS_GET_FF(thisx) ((thisx)->params & 0xFF) -#define ENKENDOJS_GET_FF00(thisx) (((thisx)->params & 0xFF00) >> 8) +#define ENKENDOJS_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFF00) >> 8) #define ENKENDOJS_FF_1 1 @@ -20,7 +20,7 @@ typedef struct EnKendoJs { /* 0x1D4 */ EnKendoJsActionFunc actionFunc; /* 0x1D8 */ Vec3s jointTable[OBJECT_JS_LIMB_MAX]; /* 0x226 */ Vec3s morphTable[OBJECT_JS_LIMB_MAX]; - /* 0x274 */ Vec3s* unk_274; + /* 0x274 */ Vec3s* pathPoints; /* 0x278 */ Vec3s unk_278; /* 0x27E */ Vec3s unk_27E; /* 0x284 */ s16 unk_284; diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 2913e636b5..92ed943648 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -72,7 +72,7 @@ static u16 sIsFrogReturnedFlags[] = { WEEKEVENTREG_33_02, // FROG_WHITE }; -static s32 sIsInitialized = false; +static s32 sTexturesDesegmented = false; static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -800, ICHAIN_STOP), @@ -89,11 +89,11 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (!sIsInitialized) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) { sEyeTextures[i] = Lib_SegmentedToVirtual(sEyeTextures[i]); } - sIsInitialized = true; + sTexturesDesegmented = true; } this->frogIndex = (this->actor.params & 0xF); diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index a3d5655db9..71dac42b52 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -569,7 +569,7 @@ void func_80B5C910(EnOt* this, PlayState* play) { this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - // This is weird + // Set to itself this->actor.world.rot.x = this->actor.world.rot.x; this->actor.world.rot.y = this->actor.world.rot.y; this->actor.world.rot.z = this->actor.world.rot.z; @@ -595,7 +595,7 @@ void func_80B5C9D0(EnOt* this, PlayState* play) { this->actor.shape.rot.x = 0; this->actor.shape.rot.z = 0; this->actor.shape.rot.y = this->actor.yawTowardsPlayer; - // This is weird + // Set to itself this->actor.world.rot.x = this->actor.world.rot.x; this->actor.world.rot.y = this->actor.world.rot.y; this->actor.world.rot.z = this->actor.world.rot.z; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 6bff76bd72..a786f9179d 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -87,13 +87,13 @@ static InitChainEntry sInitChain[] = { }; void func_8095A510(EnOwl* this, PlayState* play) { - this->unk_3FC = ENOWL_GET_F000(&this->actor); - if (this->unk_3FC == 15) { - this->unk_3FC = -1; + this->pathIndex = ENOWL_GET_PATH_INDEX(&this->actor); + if (this->pathIndex == ENOWL_PATH_INDEX_NONE) { + this->pathIndex = PATH_INDEX_NONE; this->path = NULL; } else { this->unk_3F8 = 0; - this->path = &play->setupPathList[this->unk_3FC]; + this->path = &play->setupPathList[this->pathIndex]; } } diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h index 4beee5f4b0..e1521de2d0 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -9,10 +9,11 @@ struct EnOwl; typedef void (*EnOwlActionFunc)(struct EnOwl*, PlayState*); typedef void (*EnOwlFunc)(struct EnOwl*); -#define ENOWL_GET_F000(thisx) (((thisx)->params & 0xF000) >> 0xC) +#define ENOWL_GET_PATH_INDEX(thisx) (((thisx)->params & 0xF000) >> 0xC) #define ENOWL_GET_TYPE(thisx) (((thisx)->params & 0xF80) >> 7) #define ENOWL_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) +#define ENOWL_PATH_INDEX_NONE 0xF #define ENOWL_SWITCH_FLAG_NONE 0x7F typedef enum { @@ -46,7 +47,7 @@ typedef struct EnOwl { /* 0x3F0 */ f32 unk_3F0; /* 0x3F4 */ Path* path; /* 0x3F8 */ s32 unk_3F8; - /* 0x3FC */ s32 unk_3FC; + /* 0x3FC */ s32 pathIndex; /* 0x400 */ s16 csIdList[3]; /* 0x406 */ s16 csIdIndex; /* 0x408 */ u8 unk_408; diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index a1f830ffdd..44736ce56a 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -73,8 +73,8 @@ void func_808654C4(EnPart* this, PlayState* play) { this->unk146--; if (this->unk146 > 0) { this->actor.shape.rot.x += 0x3A98; - this->actor.shape.rot.y = this->actor.shape.rot.y; - this->actor.shape.rot.z = this->actor.shape.rot.z; + this->actor.shape.rot.y = this->actor.shape.rot.y; // Set to itself + this->actor.shape.rot.z = this->actor.shape.rot.z; // Set to itself if (BgCheck_SphVsFirstPoly(&play->colCtx, &this->actor.world.pos, 20.0f)) { this->unk146 = 0; } diff --git a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c index 2466fa751e..1301215dbd 100644 --- a/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c +++ b/src/overlays/actors/ovl_En_Racedog/z_en_racedog.c @@ -224,15 +224,23 @@ typedef enum { /* 16 */ RACEDOG_ANIM_MAX } RacedogAnimation; -static AnimationInfoS sAnimationInfo[] = { - { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, - { &gDogRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, { &gDogBarkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, - { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 }, - { &gDogLyingDownAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, { &gDogLyingDownLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, - { &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, { &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, - { &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, { &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, - { &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, - { &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, +static AnimationInfoS sAnimationInfo[RACEDOG_ANIM_MAX] = { + { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // RACEDOG_ANIM_IDLE + { &gDogWalkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_WALK_1 + { &gDogRunAnim, 1.0f, 0, -1, ANIMMODE_LOOP, 0 }, // RACEDOG_ANIM_RUN + { &gDogBarkAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_BARK + { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_SIT_DOWN_ONCE + { &gDogSitAnim, 1.0f, 0, -1, ANIMMODE_LOOP_PARTIAL, -6 }, // RACEDOG_ANIM_SIT_DOWN + { &gDogLyingDownAnim, 1.0f, 0, -1, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_1 + { &gDogLyingDownLoopAnim, 1.0f, 0, -1, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_LYING_DOWN_LOOP + { &gDogLyingDownAnim, 1.0f, 0, 27, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_2 + { &gDogLyingDownAnim, 1.0f, 28, -1, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_3 + { &gDogLyingDownAnim, 1.0f, 54, 54, ANIMMODE_ONCE, -6 }, // RACEDOG_ANIM_LYING_DOWN_START_4 + { &gDogWalkAnim, -1.5f, -1, 0, ANIMMODE_LOOP, -6 }, // RACEDOG_ANIM_WALK_BACKWARDS + { &gDogJumpAnim, 1.0f, 0, -1, ANIMMODE_ONCE, 0 }, // RACEDOG_ANIM_JUMP + { &gDogLongJumpAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, // RACEDOG_ANIM_LONG_JUMP + { &gDogJumpAttackAnim, 1.2f, 0, -1, ANIMMODE_ONCE, 0 }, // RACEDOG_ANIM_JUMP_ATTACK + { &gDogWalkAnim, 0.5f, 0, -1, ANIMMODE_LOOP, 0 }, // RACEDOG_ANIM_SWIM }; static InitChainEntry sInitChain[] = { @@ -240,17 +248,17 @@ static InitChainEntry sInitChain[] = { }; void EnRacedog_ChangeAnim(SkelAnime* skelAnime, AnimationInfoS* animationInfo, s32 animIndex) { - f32 frameCount; + f32 endFrame; animationInfo += animIndex; if (animationInfo->frameCount < 0) { - frameCount = Animation_GetLastFrame(animationInfo->animation); + endFrame = Animation_GetLastFrame(animationInfo->animation); } else { - frameCount = animationInfo->frameCount; + endFrame = animationInfo->frameCount; } Animation_Change(skelAnime, animationInfo->animation, animationInfo->playSpeed + (BREG(88) * 0.1f), - animationInfo->startFrame, frameCount, animationInfo->mode, animationInfo->morphFrames); + animationInfo->startFrame, endFrame, animationInfo->mode, animationInfo->morphFrames); } void EnRacedog_UpdateCollision(EnRacedog* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.c b/src/overlays/actors/ovl_En_Raf/z_en_raf.c index 7476a9b18e..90b23d53ec 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.c +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.c @@ -35,38 +35,29 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc void EnRaf_UpdateEffects(EnRaf* this, PlayState* play); void EnRaf_DrawEffects(EnRaf* this, PlayState* play); -typedef enum { - /* 0 */ EN_RAF_ANIM_IDLE, - /* 1 */ EN_RAF_ANIM_CLOSE, - /* 2 */ EN_RAF_ANIM_CHEW, - /* 3 */ EN_RAF_ANIM_SPIT, - /* 4 */ EN_RAF_ANIM_CONVULSE, - /* 5 */ EN_RAF_ANIM_DEATH -} EnRafAnimation; +typedef enum CarnivorousLilyAction { + /* 0 */ CARNIVOROUS_LILY_ACTION_IDLE, + /* 1 */ CARNIVOROUS_LILY_ACTION_GRAB, + /* 2 */ CARNIVOROUS_LILY_ACTION_CHEW, + /* 3 */ CARNIVOROUS_LILY_ACTION_THROW, + /* 4 */ CARNIVOROUS_LILY_ACTION_EXPLODE, + /* 5 */ CARNIVOROUS_LILY_ACTION_CONVULSE, + /* 6 */ CARNIVOROUS_LILY_ACTION_DISSOLVE, + /* 7 */ CARNIVOROUS_LILY_ACTION_DORMANT +} CarnivorousLilyAction; -typedef enum { - /* 0 */ EN_RAF_ACTION_IDLE, - /* 1 */ EN_RAF_ACTION_GRAB, - /* 2 */ EN_RAF_ACTION_CHEW, - /* 3 */ EN_RAF_ACTION_THROW, - /* 4 */ EN_RAF_ACTION_EXPLODE, - /* 5 */ EN_RAF_ACTION_CONVULSE, - /* 6 */ EN_RAF_ACTION_DISSOLVE, - /* 7 */ EN_RAF_ACTION_DORMANT -} EnRafAction; +typedef enum CarnivorousLilyGrabTarget { + /* 0 */ CARNIVOROUS_LILY_GRAB_TARGET_PLAYER, + /* 1 */ CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE, + /* 2 */ CARNIVOROUS_LILY_GRAB_TARGET_GORON_PLAYER +} CarnivorousLilyGrabTarget; -typedef enum { - /* 0 */ EN_RAF_GRAB_TARGET_PLAYER, - /* 1 */ EN_RAF_GRAB_TARGET_EXPLOSIVE, - /* 2 */ EN_RAF_GRAB_TARGET_GORON_PLAYER -} EnRafGrabTarget; - -typedef enum { - /* 0 */ EN_RAF_PETAL_SCALE_TYPE_DEAD, - /* 1 */ EN_RAF_PETAL_SCALE_TYPE_GRAB, - /* 2 */ EN_RAF_PETAL_SCALE_TYPE_CHEW, - /* 3 */ EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW -} EnRafPetalScaleType; +typedef enum CarnivorousLilyPetalScaleType { + /* 0 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_DEAD, + /* 1 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_GRAB, + /* 2 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW, + /* 3 */ CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW +} CarnivorousLilyPetalScaleType; ActorInit En_Raf_InitVars = { /**/ ACTOR_EN_RAF, @@ -222,10 +213,10 @@ void EnRaf_Init(Actor* thisx, PlayState* play) { this->dyna.actor.colChkInfo.damageTable = &sDamageTable; this->dyna.actor.colChkInfo.health = BREG(1) + 2; - this->mainType = EN_RAF_GET_TYPE(&this->dyna.actor); - this->reviveTimer = EN_RAF_GET_REVIVE_TIMER(&this->dyna.actor); - this->switchFlag = EN_RAF_GET_SWITCH_FLAG(&this->dyna.actor); - if (this->switchFlag == EN_RAF_SWITCH_FLAG_NONE) { + this->mainType = CARNIVOROUS_LILY_GET_TYPE(&this->dyna.actor); + this->reviveTimer = CARNIVOROUS_LILY_GET_REVIVE_TIMER(&this->dyna.actor); + this->switchFlag = CARNIVOROUS_LILY_GET_SWITCH_FLAG(&this->dyna.actor); + if (this->switchFlag == CARNIVOROUS_LILY_SWITCH_FLAG_NONE) { this->switchFlag = SWITCH_FLAG_NONE; } @@ -235,9 +226,9 @@ void EnRaf_Init(Actor* thisx, PlayState* play) { this->reviveTimer = 30; } - if (((this->switchFlag > SWITCH_FLAG_NONE) || (this->mainType == EN_RAF_TYPE_DORMANT) || + if (((this->switchFlag > SWITCH_FLAG_NONE) || (this->mainType == CARNIVOROUS_LILY_TYPE_DORMANT) || CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) && - (Flags_GetSwitch(play, this->switchFlag) || (this->mainType == EN_RAF_TYPE_DORMANT))) { + (Flags_GetSwitch(play, this->switchFlag) || (this->mainType == CARNIVOROUS_LILY_TYPE_DORMANT))) { s32 i; for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; @@ -261,25 +252,46 @@ void EnRaf_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyCylinder(play, &this->collider); } +typedef enum CarnivorousLilyAnimation { + /* 0 */ CARNIVOROUS_LILY_ANIM_IDLE, + /* 1 */ CARNIVOROUS_LILY_ANIM_CLOSE, + /* 2 */ CARNIVOROUS_LILY_ANIM_CHEW, + /* 3 */ CARNIVOROUS_LILY_ANIM_SPIT, + /* 4 */ CARNIVOROUS_LILY_ANIM_CONVULSE, + /* 5 */ CARNIVOROUS_LILY_ANIM_DEATH, + /* 6 */ CARNIVOROUS_LILY_ANIM_MAX +} CarnivorousLilyAnimation; + +static AnimationHeader* sAnimations[CARNIVOROUS_LILY_ANIM_MAX] = { + &gCarnivorousLilyPadSpitAnim, // CARNIVOROUS_LILY_ANIM_IDLE + &gCarnivorousLilyPadCloseAnim, // CARNIVOROUS_LILY_ANIM_CLOSE + &gCarnivorousLilyPadChewAnim, // CARNIVOROUS_LILY_ANIM_CHEW + &gCarnivorousLilyPadSpitAnim, // CARNIVOROUS_LILY_ANIM_SPIT + &gCarnivorousLilyPadConvulseAnim, // CARNIVOROUS_LILY_ANIM_CONVULSE + &gCarnivorousLilyPadDeathAnim, // CARNIVOROUS_LILY_ANIM_DEATH +}; + +static u8 sAnimationModes[CARNIVOROUS_LILY_ANIM_MAX] = { + ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_IDLE + ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_CLOSE + ANIMMODE_LOOP, // CARNIVOROUS_LILY_ANIM_CHEW + ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_SPIT + ANIMMODE_LOOP, // CARNIVOROUS_LILY_ANIM_CONVULSE + ANIMMODE_ONCE, // CARNIVOROUS_LILY_ANIM_DEATH +}; + void EnRaf_ChangeAnim(EnRaf* this, s32 animIndex) { - static AnimationHeader* sAnimations[] = { - &gCarnivorousLilyPadSpitAnim, &gCarnivorousLilyPadCloseAnim, &gCarnivorousLilyPadChewAnim, - &gCarnivorousLilyPadSpitAnim, &gCarnivorousLilyPadConvulseAnim, &gCarnivorousLilyPadDeathAnim, - }; - static u8 sAnimationModes[] = { - ANIMMODE_ONCE, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, ANIMMODE_LOOP, ANIMMODE_ONCE, - }; f32 startFrame = 0.0f; f32 playSpeed = 1.0f; - this->endFrame = Animation_GetLastFrame(sAnimations[animIndex]); - if (animIndex == EN_RAF_ANIM_IDLE) { - startFrame = this->endFrame; - } else if (animIndex == EN_RAF_ANIM_CLOSE) { + this->animEndFrame = Animation_GetLastFrame(sAnimations[animIndex]); + if (animIndex == CARNIVOROUS_LILY_ANIM_IDLE) { + startFrame = this->animEndFrame; + } else if (animIndex == CARNIVOROUS_LILY_ANIM_CLOSE) { playSpeed = 2.0f; } - Animation_Change(&this->skelAnime, sAnimations[animIndex], playSpeed, startFrame, this->endFrame, + Animation_Change(&this->skelAnime, sAnimations[animIndex], playSpeed, startFrame, this->animEndFrame, sAnimationModes[animIndex], -4.0f); } @@ -287,14 +299,14 @@ void EnRaf_SetupIdle(EnRaf* this) { Vec3f targetLimbScale = { 1.0f, 1.0f, 1.0f }; s32 i; - EnRaf_ChangeAnim(this, EN_RAF_ANIM_IDLE); + EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_IDLE); for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; i++) { Math_Vec3f_Copy(&this->targetLimbScale[i], &targetLimbScale); } - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW; - this->action = EN_RAF_ACTION_IDLE; + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW; + this->action = CARNIVOROUS_LILY_ACTION_IDLE; this->actionFunc = EnRaf_Idle; } @@ -314,10 +326,10 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) { DynaPolyActor_IsPlayerOnTop(&this->dyna) && !(player->stateFlags1 & PLAYER_STATE1_8000000) && play->grabPlayer(play, player))) { player->actor.parent = &this->dyna.actor; - this->grabTarget = EN_RAF_GRAB_TARGET_PLAYER; + this->grabTarget = CARNIVOROUS_LILY_GRAB_TARGET_PLAYER; if (player->transformation == PLAYER_FORM_GORON) { - this->grabTarget = EN_RAF_GRAB_TARGET_GORON_PLAYER; + this->grabTarget = CARNIVOROUS_LILY_GRAB_TARGET_GORON_PLAYER; } else { player->av2.actionVar2 = 50; } @@ -345,7 +357,7 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) { if ((fabsf(xDiff) < 80.0f) && (fabsf(yDiff) < 30.0f) && (fabsf(zDiff) < 80.0f) && (explosive->update != NULL) && (explosive->velocity.y != 0.0f)) { Actor_Kill(explosive); - this->grabTarget = EN_RAF_GRAB_TARGET_EXPLOSIVE; + this->grabTarget = CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE; this->collider.dim.radius = 30; this->collider.dim.height = 90; this->collider.dim.yShift = -10; @@ -359,10 +371,10 @@ void EnRaf_Idle(EnRaf* this, PlayState* play) { } void EnRaf_SetupGrab(EnRaf* this) { - EnRaf_ChangeAnim(this, EN_RAF_ANIM_CLOSE); - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_GRAB; + EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_CLOSE); + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_GRAB; Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_DRINK); - this->action = EN_RAF_ACTION_GRAB; + this->action = CARNIVOROUS_LILY_ACTION_GRAB; this->actionFunc = EnRaf_Grab; } @@ -373,14 +385,14 @@ void EnRaf_Grab(EnRaf* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 curFrame = this->skelAnime.curFrame; - if ((this->grabTarget != EN_RAF_GRAB_TARGET_EXPLOSIVE) && (player->stateFlags2 & PLAYER_STATE2_80) && + if ((this->grabTarget != CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) && (player->stateFlags2 & PLAYER_STATE2_80) && (&this->dyna.actor == player->actor.parent)) { Math_ApproachF(&player->actor.world.pos.x, this->dyna.actor.world.pos.x, 0.3f, 10.0f); Math_ApproachF(&player->actor.world.pos.y, this->dyna.actor.world.pos.y, 0.3f, 10.0f); Math_ApproachF(&player->actor.world.pos.z, this->dyna.actor.world.pos.z, 0.3f, 10.0f); } - if (this->endFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { EnRaf_SetupChew(this); } } @@ -388,7 +400,7 @@ void EnRaf_Grab(EnRaf* this, PlayState* play) { void EnRaf_SetupChew(EnRaf* this) { s32 i; - EnRaf_ChangeAnim(this, EN_RAF_ANIM_CHEW); + EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_CHEW); this->chewCount = 0; for (i = 0; i < ARRAY_COUNT(this->chewLimbRot); i++) { this->chewLimbRot[i].x = Rand_S16Offset(8, 8) << 8; @@ -396,8 +408,8 @@ void EnRaf_SetupChew(EnRaf* this) { this->chewLimbRot[i].z = Rand_S16Offset(8, 8) << 8; } - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_CHEW; - this->action = EN_RAF_ACTION_CHEW; + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW; + this->action = CARNIVOROUS_LILY_ACTION_CHEW; this->actionFunc = EnRaf_Chew; } @@ -415,21 +427,21 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) { targetChewScale = (BREG(51) / 100.0f) + 0.2f; Math_ApproachF(&this->chewScale, targetChewScale, 0.2f, 0.03f); - if ((player->stateFlags2 & PLAYER_STATE2_80) && (this->grabTarget != EN_RAF_GRAB_TARGET_EXPLOSIVE) && + if ((player->stateFlags2 & PLAYER_STATE2_80) && (this->grabTarget != CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) && (&this->dyna.actor == player->actor.parent)) { Math_ApproachF(&player->actor.world.pos.x, this->dyna.actor.world.pos.x, 0.3f, 10.0f); Math_ApproachF(&player->actor.world.pos.y, this->dyna.actor.world.pos.y, 0.3f, 10.0f); Math_ApproachF(&player->actor.world.pos.z, this->dyna.actor.world.pos.z, 0.3f, 10.0f); } - if (this->endFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { if (BREG(52) == 0) { this->chewCount++; } Actor_PlaySfx(&this->dyna.actor, NA_SE_EN_SUISEN_EAT); switch (this->grabTarget) { - case EN_RAF_GRAB_TARGET_PLAYER: + case CARNIVOROUS_LILY_GRAB_TARGET_PLAYER: play->damagePlayer(play, -2); //! @bug: This function should only pass Player*: it uses *(this + 0x153), which is meant to be @@ -444,7 +456,7 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) { } break; - case EN_RAF_GRAB_TARGET_EXPLOSIVE: + case CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE: Actor_ApplyDamage(&this->dyna.actor); if (this->chewCount > (BREG(54) + 4)) { EnRaf_Explode(this, play); @@ -452,13 +464,16 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) { } break; - case EN_RAF_GRAB_TARGET_GORON_PLAYER: + case CARNIVOROUS_LILY_GRAB_TARGET_GORON_PLAYER: if (this->chewCount > (BREG(54) + 4)) { player->actor.parent = NULL; player->av2.actionVar2 = 1000; EnRaf_Explode(this, play); } break; + + default: + break; } } } @@ -466,10 +481,10 @@ void EnRaf_Chew(EnRaf* this, PlayState* play) { void EnRaf_SetupThrow(EnRaf* this, PlayState* play) { Player* player = GET_PLAYER(play); - EnRaf_ChangeAnim(this, EN_RAF_ANIM_SPIT); + EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_SPIT); player->actor.freezeTimer = 10; - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW; - this->action = EN_RAF_ACTION_THROW; + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW; + this->action = CARNIVOROUS_LILY_ACTION_THROW; this->actionFunc = EnRaf_Throw; } @@ -490,9 +505,9 @@ void EnRaf_Throw(EnRaf* this, PlayState* play) { player->actor.freezeTimer = 10; } - if (this->endFrame <= curFrame) { - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW; - this->action = EN_RAF_ACTION_IDLE; + if (curFrame >= this->animEndFrame) { + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW; + this->action = CARNIVOROUS_LILY_ACTION_IDLE; this->timer = 20; this->actionFunc = EnRaf_Idle; } @@ -508,7 +523,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) { s32 i; s32 pad; - this->action = EN_RAF_ACTION_EXPLODE; + this->action = CARNIVOROUS_LILY_ACTION_EXPLODE; Math_Vec3f_Copy(&explosionPos, &this->dyna.actor.world.pos); explosionPos.y += 10.0f; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, explosionPos.x, explosionPos.y, explosionPos.z, 0, 0, 0, @@ -519,7 +534,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) { Flags_SetSwitch(play, this->switchFlag); } - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD; + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_DEAD; for (i = 0; i < BREG(57) + 30; i++) { accel.x = (Rand_ZeroOne() - 0.5f) * 0.5f; accel.y = -0.3f; @@ -536,7 +551,7 @@ void EnRaf_Explode(EnRaf* this, PlayState* play) { } this->timer = 5; - if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) { + if (this->grabTarget == CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) { Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_ENEMY); this->dyna.actor.flags |= (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); } @@ -554,7 +569,7 @@ void EnRaf_PostDetonation(EnRaf* this, PlayState* play) { Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_PROP); this->dyna.actor.flags &= ~(ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_UNFRIENDLY); EnRaf_SetupDormant(this); - } else if (this->grabTarget == EN_RAF_GRAB_TARGET_EXPLOSIVE) { + } else if (this->grabTarget == CARNIVOROUS_LILY_GRAB_TARGET_EXPLOSIVE) { this->collider.dim.radius = 80; this->collider.dim.height = 50; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); @@ -562,9 +577,9 @@ void EnRaf_PostDetonation(EnRaf* this, PlayState* play) { } void EnRaf_SetupConvulse(EnRaf* this) { - EnRaf_ChangeAnim(this, EN_RAF_ANIM_CONVULSE); + EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_CONVULSE); this->chewCount = 0; - this->action = EN_RAF_ACTION_CONVULSE; + this->action = CARNIVOROUS_LILY_ACTION_CONVULSE; this->actionFunc = EnRaf_Convulse; } @@ -576,7 +591,7 @@ void EnRaf_SetupConvulse(EnRaf* this) { void EnRaf_Convulse(EnRaf* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; - if (this->endFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { this->chewCount++; if (this->chewCount > (BREG(2) + 2)) { if (this->switchFlag > SWITCH_FLAG_NONE) { @@ -589,8 +604,8 @@ void EnRaf_Convulse(EnRaf* this, PlayState* play) { } void EnRaf_SetupDissolve(EnRaf* this) { - EnRaf_ChangeAnim(this, EN_RAF_ANIM_DEATH); - this->action = EN_RAF_ACTION_DISSOLVE; + EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_DEATH); + this->action = CARNIVOROUS_LILY_ACTION_DISSOLVE; this->dissolveTimer = 0; this->actionFunc = EnRaf_Dissolve; } @@ -604,7 +619,7 @@ void EnRaf_Dissolve(EnRaf* this, PlayState* play) { f32 curFrame = this->skelAnime.curFrame; s32 i; - if (this->endFrame <= curFrame) { + if (curFrame >= this->animEndFrame) { this->dissolveTimer++; if (this->dissolveTimer < (BREG(3) + 105)) { for (i = 0; i < (BREG(4) + 5); i++) { @@ -651,10 +666,10 @@ void EnRaf_Dissolve(EnRaf* this, PlayState* play) { } void EnRaf_SetupDormant(EnRaf* this) { - if (this->action == EN_RAF_ACTION_EXPLODE) { + if (this->action == CARNIVOROUS_LILY_ACTION_EXPLODE) { this->timer = 90; } else { - this->action = EN_RAF_ACTION_DORMANT; + this->action = CARNIVOROUS_LILY_ACTION_DORMANT; } this->actionFunc = EnRaf_Dormant; @@ -669,23 +684,23 @@ void EnRaf_Dormant(EnRaf* this, PlayState* play) { s32 i; if (this->timer == 0) { - this->action = EN_RAF_ACTION_DORMANT; + this->action = CARNIVOROUS_LILY_ACTION_DORMANT; } if (this->reviveTimer >= 0) { DECR(this->reviveTimer); if (this->reviveTimer == 0) { - EnRaf_ChangeAnim(this, EN_RAF_ANIM_SPIT); + EnRaf_ChangeAnim(this, CARNIVOROUS_LILY_ANIM_SPIT); for (i = CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_LOWER_SEGMENT; i <= CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_UPPER_SEGMENT; i++) { Math_Vec3f_Copy(&this->targetLimbScale[i], &targetLimbScale); } - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW; - this->action = EN_RAF_ACTION_IDLE; - this->reviveTimer = EN_RAF_GET_REVIVE_TIMER(&this->dyna.actor); + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW; + this->action = CARNIVOROUS_LILY_ACTION_IDLE; + this->reviveTimer = CARNIVOROUS_LILY_GET_REVIVE_TIMER(&this->dyna.actor); this->reviveTimer += 30; this->actionFunc = EnRaf_Idle; } @@ -705,8 +720,8 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { DECR(this->timer); this->actionFunc(this, play); - if ((this->action == EN_RAF_ACTION_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) { - this->petalScaleType = EN_RAF_PETAL_SCALE_TYPE_DEAD; + if ((this->action == CARNIVOROUS_LILY_ACTION_IDLE) && CHECK_WEEKEVENTREG(WEEKEVENTREG_12_01)) { + this->petalScaleType = CARNIVOROUS_LILY_PETAL_SCALE_TYPE_DEAD; EnRaf_SetupConvulse(this); return; } @@ -723,7 +738,8 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { this->bobPhase += 3000.0f; this->bobOffset = 2.0f * Math_SinS(this->bobPhase); - if (this->mainType != EN_RAF_TYPE_NO_WATER_INTERACTIONS) { + + if (this->mainType != CARNIVOROUS_LILY_TYPE_NO_WATER_INTERACTIONS) { ySurface = BREG(60) + (this->dyna.actor.world.pos.y - 60.0f); if (WaterBox_GetSurface1(play, &play->colCtx, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.z, &ySurface, &waterBox)) { @@ -731,7 +747,7 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { Math_ApproachF(&this->dyna.actor.world.pos.y, this->heightDiffFromPlayer + ySurface, 0.5f, 40.0f); if (this->rippleTimer == 0) { this->rippleTimer = 30; - if (this->petalScaleType == EN_RAF_PETAL_SCALE_TYPE_CHEW) { + if (this->petalScaleType == CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW) { this->rippleTimer = 10; } @@ -746,12 +762,13 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { } Math_ApproachZeroF(&this->heightDiffFromPlayer, 0.3f, 2.0f); - if (this->action == EN_RAF_ACTION_EXPLODE) { + + if (this->action == CARNIVOROUS_LILY_ACTION_EXPLODE) { EnRaf_UpdateEffects(this, play); } for (i = 0; i < ARRAY_COUNT(this->limbScale); i++) { - if (this->action < EN_RAF_ACTION_EXPLODE) { + if (this->action < CARNIVOROUS_LILY_ACTION_EXPLODE) { Math_ApproachF(&this->limbScale[i].x, this->targetLimbScale[i].x, 0.4f, 0.5f); Math_ApproachF(&this->limbScale[i].y, this->targetLimbScale[i].y, 0.4f, 0.5f); Math_ApproachF(&this->limbScale[i].z, this->targetLimbScale[i].z, 0.4f, 0.5f); @@ -763,7 +780,7 @@ void EnRaf_Update(Actor* thisx, PlayState* play) { } Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - if (this->action < EN_RAF_ACTION_EXPLODE) { + if (this->action < CARNIVOROUS_LILY_ACTION_EXPLODE) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } } @@ -798,7 +815,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) { s32 i; switch (this->petalScaleType) { - case EN_RAF_PETAL_SCALE_TYPE_GRAB: + case CARNIVOROUS_LILY_PETAL_SCALE_TYPE_GRAB: if ((limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_MIDDLE_SEGMENT) || (limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) || (limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) { @@ -820,7 +837,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) { } break; - case EN_RAF_PETAL_SCALE_TYPE_CHEW: + case CARNIVOROUS_LILY_PETAL_SCALE_TYPE_CHEW: if ((limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_MIDDLE_SEGMENT) || (limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) || (limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) { @@ -844,7 +861,7 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) { } break; - case EN_RAF_PETAL_SCALE_TYPE_IDLE_OR_THROW: + case CARNIVOROUS_LILY_PETAL_SCALE_TYPE_IDLE_OR_THROW: if ((limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_1_MIDDLE_SEGMENT) || (limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_3_MIDDLE_SEGMENT) || (limbIndex == CARNIVOROUS_LILY_PAD_LIMB_TRAP_2_MIDDLE_SEGMENT)) { @@ -865,6 +882,9 @@ void EnRaf_TransformLimbDraw(PlayState* play2, s32 limbIndex, Actor* thisx) { } } break; + + default: + break; } Matrix_Scale(this->limbScale[limbIndex].x, this->limbScale[limbIndex].y, this->limbScale[limbIndex].z, @@ -879,14 +899,14 @@ void EnRaf_Draw(Actor* thisx, PlayState* play) { SkelAnime_DrawTransformFlexOpa(play, this->skelAnime.skeleton, this->skelAnime.jointTable, this->skelAnime.dListCount, NULL, NULL, EnRaf_TransformLimbDraw, &this->dyna.actor); - if (this->action == EN_RAF_ACTION_EXPLODE) { + if (this->action == CARNIVOROUS_LILY_ACTION_EXPLODE) { EnRaf_DrawEffects(this, play); } } void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* accel, f32 scale, s16 timer) { s16 i; - EnRafEffect* effect = this->effects; + CarnivorousLilyEffect* effect = this->effects; for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { if (!effect->isEnabled) { @@ -906,7 +926,7 @@ void EnRaf_InitializeEffect(EnRaf* this, Vec3f* pos, Vec3f* velocity, Vec3f* acc void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) { s32 i; - EnRafEffect* effect = this->effects; + CarnivorousLilyEffect* effect = this->effects; for (i = 0; i < ARRAY_COUNT(this->effects); i++, effect++) { if (effect->isEnabled) { @@ -920,7 +940,7 @@ void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) { effect->velocity.y += effect->accel.y; effect->velocity.z += effect->accel.z; - if (this->mainType != EN_RAF_TYPE_NO_WATER_INTERACTIONS) { + if (this->mainType != CARNIVOROUS_LILY_TYPE_NO_WATER_INTERACTIONS) { if (effect->pos.y < (this->dyna.actor.world.pos.y - 10.0f)) { EffectSsGSplash_Spawn(play, &effect->pos, NULL, NULL, 0, effect->scale * 200000.0f); SoundSource_PlaySfxAtFixedWorldPos(play, &effect->pos, 50, NA_SE_EV_BOMB_DROP_WATER); @@ -944,7 +964,7 @@ void EnRaf_UpdateEffects(EnRaf* this, PlayState* play) { void EnRaf_DrawEffects(EnRaf* this, PlayState* play) { s16 i; - EnRafEffect* effect = this->effects; + CarnivorousLilyEffect* effect = this->effects; GraphicsContext* gfxCtx = play->state.gfxCtx; OPEN_DISPS(gfxCtx); diff --git a/src/overlays/actors/ovl_En_Raf/z_en_raf.h b/src/overlays/actors/ovl_En_Raf/z_en_raf.h index ca60912330..3a157ff041 100644 --- a/src/overlays/actors/ovl_En_Raf/z_en_raf.h +++ b/src/overlays/actors/ovl_En_Raf/z_en_raf.h @@ -4,17 +4,17 @@ #include "global.h" #include "objects/object_raf/object_raf.h" -#define EN_RAF_GET_TYPE(thisx) (((thisx)->params >> 12) & 0xF) -#define EN_RAF_GET_REVIVE_TIMER(thisx) (((thisx)->params >> 7) & 0x1F) -#define EN_RAF_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) +#define CARNIVOROUS_LILY_GET_TYPE(thisx) (((thisx)->params >> 12) & 0xF) +#define CARNIVOROUS_LILY_GET_REVIVE_TIMER(thisx) (((thisx)->params >> 7) & 0x1F) +#define CARNIVOROUS_LILY_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0x7F) -#define EN_RAF_SWITCH_FLAG_NONE 0x7F +#define CARNIVOROUS_LILY_SWITCH_FLAG_NONE 0x7F -typedef enum { - /* 0 */ EN_RAF_TYPE_NORMAL, - /* 1 */ EN_RAF_TYPE_DORMANT, // Spawns without trap, so it can't eat bombs/player - /* 2 */ EN_RAF_TYPE_NO_WATER_INTERACTIONS // Won't produce ripples, and effects won't produce splashes -} EnRafType; +typedef enum CarnivorousLilyType { + /* 0 */ CARNIVOROUS_LILY_TYPE_NORMAL, + /* 1 */ CARNIVOROUS_LILY_TYPE_DORMANT, // Spawns without trap, so it can't eat bombs/player + /* 2 */ CARNIVOROUS_LILY_TYPE_NO_WATER_INTERACTIONS // Won't produce ripples, and effects won't produce splashes +} CarnivorousLilyType; struct EnRaf; @@ -28,9 +28,9 @@ typedef struct { /* 0x28 */ Vec3s rot; /* 0x30 */ f32 scale; /* 0x34 */ s16 timer; -} EnRafEffect; // size = 0x38 +} CarnivorousLilyEffect; // size = 0x38 -#define EN_RAF_EFFECT_COUNT 31 +#define CARNIVOROUS_LILY_EFFECT_COUNT 31 typedef struct EnRaf { /* 0x000 */ DynaPolyActor dyna; @@ -43,7 +43,7 @@ typedef struct EnRaf { /* 0x354 */ Vec3s chewLimbRot[CARNIVOROUS_LILY_PAD_LIMB_MAX]; /* 0x39C */ s16 grabTarget; /* 0x39E */ u8 isCurrentlyInRidingMovingState; - /* 0x3A0 */ f32 endFrame; + /* 0x3A0 */ f32 animEndFrame; /* 0x3A4 */ f32 chewScale; /* 0x3A8 */ f32 bobOffset; /* 0x3AC */ f32 heightDiffFromPlayer; @@ -63,7 +63,7 @@ typedef struct EnRaf { /* 0x3CC */ s16 petalClearPixelSecondPassIndex; /* 0x3CE */ s16 teethClearPixelSecondPassIndex; /* 0x3D0 */ ColliderCylinder collider; - /* 0x41C */ EnRafEffect effects[EN_RAF_EFFECT_COUNT]; + /* 0x41C */ CarnivorousLilyEffect effects[CARNIVOROUS_LILY_EFFECT_COUNT]; } EnRaf; // size = 0xAE4 #endif // Z_EN_RAF_H diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c index 46a4b6ab70..51482ed9a6 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.c @@ -63,20 +63,38 @@ ActorInit En_Rail_Skb_InitVars = { /**/ EnRailSkb_Draw, }; -static AnimationInfo sAnimationInfo[] = { - { &gStalchildWalkAnim, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, - { &gStalchildAttackAnim, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, - { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &gStalchildCollapseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, - { &gStalchildSitLaughAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gStalchildSitTapToesAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gStalchildSwingOnBranchAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, - { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, - { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gStalchildSaluteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, - { &gStalchildIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, +typedef enum EnRailSkbAnimation { + /* -1 */ ENRAILSKB_ANIM_NONE = -1, + /* 0 */ ENRAILSKB_ANIM_0, + /* 1 */ ENRAILSKB_ANIM_1, + /* 2 */ ENRAILSKB_ANIM_2, + /* 3 */ ENRAILSKB_ANIM_3, + /* 4 */ ENRAILSKB_ANIM_4, + /* 5 */ ENRAILSKB_ANIM_5, + /* 6 */ ENRAILSKB_ANIM_6, + /* 7 */ ENRAILSKB_ANIM_7, + /* 8 */ ENRAILSKB_ANIM_8, + /* 9 */ ENRAILSKB_ANIM_9, + /* 10 */ ENRAILSKB_ANIM_10, + /* 11 */ ENRAILSKB_ANIM_11, + /* 12 */ ENRAILSKB_ANIM_12, + /* 13 */ ENRAILSKB_ANIM_MAX +} EnRailSkbAnimation; + +static AnimationInfo sAnimationInfo[ENRAILSKB_ANIM_MAX] = { + { &gStalchildWalkAnim, 0.96f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_0 + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -1.0f }, // ENRAILSKB_ANIM_1 + { &gStalchildAttackAnim, 0.6f, 0.0f, 0.0f, ANIMMODE_ONCE_INTERP, 4.0f }, // ENRAILSKB_ANIM_2 + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENRAILSKB_ANIM_3 + { &gStalchildCollapseAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -4.0f }, // ENRAILSKB_ANIM_4 + { &gStalchildSitLaughAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_5 + { &gStalchildSitTapToesAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_6 + { &gStalchildSwingOnBranchAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -4.0f }, // ENRAILSKB_ANIM_7 + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENRAILSKB_ANIM_8 + { &gStalchildStandUpAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -16.0f }, // ENRAILSKB_ANIM_9 + { &gStalchildStaggerAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENRAILSKB_ANIM_10 + { &gStalchildSaluteAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -8.0f }, // ENRAILSKB_ANIM_11 + { &gStalchildIdleAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_LOOP, -8.0f }, // ENRAILSKB_ANIM_12 }; static ColliderJntSphElementInit sJntSphElementsInit[2] = { @@ -156,11 +174,11 @@ static DamageTable sDamageTable = { void func_80B708C0(EnRailSkb* this, PlayState* play) { static s32 D_80B7348C = 0; - Path* path = &play->setupPathList[ENRAILSKB_GET_FF00(&this->actor)]; + Path* path = &play->setupPathList[ENRAILSKB_GET_PATH_INDEX(&this->actor)]; Vec3f sp70; s32 phi_a3; - this->unk_230 = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); this->unk_2E0 = D_80B7348C; this->unk_2E8 = path->count; @@ -175,9 +193,9 @@ void func_80B708C0(EnRailSkb* this, PlayState* play) { D_80B7348C = 0; } - this->actor.world.pos.x = this->unk_230[this->unk_2E0].x; - this->actor.world.pos.y = this->unk_230[this->unk_2E0].y; - this->actor.world.pos.z = this->unk_230[this->unk_2E0].z; + this->actor.world.pos.x = this->pathPoints[this->unk_2E0].x; + this->actor.world.pos.y = this->pathPoints[this->unk_2E0].y; + this->actor.world.pos.z = this->pathPoints[this->unk_2E0].z; if (this->unk_2E0 < (this->unk_2E8 - 1)) { phi_a3 = this->unk_2E0 + 1; @@ -185,9 +203,9 @@ void func_80B708C0(EnRailSkb* this, PlayState* play) { phi_a3 = 0; } - sp70.x = this->unk_230[phi_a3].x; - sp70.y = this->unk_230[phi_a3].y; - sp70.z = this->unk_230[phi_a3].z; + sp70.x = this->pathPoints[phi_a3].x; + sp70.y = this->pathPoints[phi_a3].y; + sp70.z = this->pathPoints[phi_a3].z; this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp70); } @@ -213,10 +231,10 @@ s32 func_80B70B04(EnRailSkb* this, Vec3f pos) { s32 i = 0; s32 j; - sp60.x = this->unk_230[0].z - pos.z; - sp60.z = this->unk_230[0].x - pos.x; - sp58.x = this->unk_230[1].z - pos.z; - sp58.z = this->unk_230[1].x - pos.x; + sp60.x = this->pathPoints[0].z - pos.z; + sp60.z = this->pathPoints[0].x - pos.x; + sp58.x = this->pathPoints[1].z - pos.z; + sp58.z = this->pathPoints[1].x - pos.x; j = 1; temp_s3 = func_80B70AB4(sp60, sp58); @@ -229,10 +247,10 @@ s32 func_80B70B04(EnRailSkb* this, Vec3f pos) { j = 0; } - sp60.x = this->unk_230[i].z - pos.z; - sp60.z = this->unk_230[i].x - pos.x; - sp58.x = this->unk_230[j].z - pos.z; - sp58.z = this->unk_230[j].x - pos.x; + sp60.x = this->pathPoints[i].z - pos.z; + sp60.z = this->pathPoints[i].x - pos.x; + sp58.x = this->pathPoints[j].z - pos.z; + sp58.z = this->pathPoints[j].x - pos.x; if (func_80B70AB4(sp60, sp58) != temp_s3) { ret = false; @@ -313,7 +331,7 @@ void EnRailSkb_Destroy(Actor* thisx, PlayState* play) { void func_80B70FA0(EnRailSkb* this) { this->unk_3F2 = 0; if (this->actionFunc != func_80B716A8) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0); } this->actionFunc = func_80B70FF8; } @@ -357,7 +375,7 @@ void func_80B7114C(EnRailSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_402 |= 1; func_80B712FC(this); @@ -381,7 +399,7 @@ void func_80B7123C(EnRailSkb* this, PlayState* play) { this->drawDmgEffAlpha = 0.0f; if (this->actor.colChkInfo.health != 0) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); this->unk_402 |= 1; func_80B712FC(this); @@ -407,7 +425,7 @@ void func_80B71314(EnRailSkb* this, PlayState* play) { void func_80B71354(EnRailSkb* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2); this->actionFunc = func_80B713A4; } @@ -416,7 +434,7 @@ void func_80B713A4(EnRailSkb* this, PlayState* play) { if ((this->actor.xzDistToPlayer > 65.0f) || (Player_GetMask(play) == PLAYER_MASK_CAPTAIN)) { func_80B70FA0(this); } else { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2); } } @@ -457,7 +475,7 @@ void func_80B7151C(EnRailSkb* this) { this->actor.draw = EnRailSkb_Draw; this->actor.shape.shadowAlpha = 0; this->actor.shape.rot.y = this->actor.world.rot.y; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 1); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_1); this->actionFunc = func_80B715AC; } @@ -480,7 +498,7 @@ void func_80B715AC(EnRailSkb* this, PlayState* play) { void func_80B71650(EnRailSkb* this) { this->unk_3FE = 0; if (this->actionFunc != func_80B70FF8) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0); } this->actionFunc = func_80B716A8; } @@ -497,7 +515,7 @@ void func_80B716A8(EnRailSkb* this, PlayState* play) { Message_StartTextbox(play, 0x13F5, &this->actor); this->unk_400 = 0x13F5; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 12); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_12); func_80B717C8(this); } else if ((this->actor.xzDistToPlayer < 100.0f) && !(this->collider.base.acFlags & AC_HIT)) { Actor_OfferTalk(&this->actor, play, 100.0f); @@ -559,7 +577,7 @@ void func_80B718C4(EnRailSkb* this, PlayState* play) { } void func_80B71910(EnRailSkb* this) { - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0); this->actionFunc = func_80B71954; } @@ -577,7 +595,7 @@ void func_80B71954(EnRailSkb* this, PlayState* play) { void func_80B71A08(EnRailSkb* this) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2); this->actionFunc = func_80B71A58; } @@ -586,7 +604,7 @@ void func_80B71A58(EnRailSkb* this, PlayState* play) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 2); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_2); if (this->unk_2E8 < this->unk_22C->dyna.actor.colChkInfo.health) { this->unk_22C->dyna.actor.colChkInfo.health--; } else { @@ -609,7 +627,7 @@ void func_80B71A58(EnRailSkb* this, PlayState* play) { void func_80B71B6C(EnRailSkb* this) { this->unk_3F2 = 10; - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 0); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_0); this->actionFunc = func_80B71BB8; } @@ -642,7 +660,7 @@ void func_80B71BB8(EnRailSkb* this, PlayState* play) { if ((sp34 < 50.0f) && (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 9); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_9); this->actor.velocity.y = 10.0f; for (i = 0; i < 4; i++) { @@ -675,7 +693,7 @@ void func_80B71DF0(EnRailSkb* this) { this->drawDmgEffTimer = 0; } - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 11); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_11); this->actionFunc = func_80B71EA8; } @@ -806,9 +824,9 @@ void func_80B72190(EnRailSkb* this, PlayState* play) { if ((this->actionFunc != func_80B71EA8) && (this->actionFunc != func_80B71954) && (this->actionFunc != func_80B71A58) && (this->actionFunc != func_80B71BB8)) { - sp38.x = this->unk_230[this->unk_2E0].x; - sp38.y = this->unk_230[this->unk_2E0].y; - sp38.z = this->unk_230[this->unk_2E0].z; + sp38.x = this->pathPoints[this->unk_2E0].x; + sp38.y = this->pathPoints[this->unk_2E0].y; + sp38.z = this->pathPoints[this->unk_2E0].z; sp32 = Math_Vec3f_Yaw(&this->actor.world.pos, &sp38); if (Math_Vec3f_DistXZ(&this->actor.world.pos, &sp38) > 100.0f) { @@ -1001,7 +1019,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffScale = 0.0f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3); this->unk_402 |= 1; func_80B712FC(this); break; @@ -1027,7 +1045,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { this->drawDmgEffScale = 0.5f; Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3); func_80B71228(this); break; @@ -1046,7 +1064,7 @@ void func_80B72970(EnRailSkb* this, PlayState* play) { case 13: Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 8); Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_DAMAGE); - Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, 3); + Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, ENRAILSKB_ANIM_3); func_80B712FC(this); break; diff --git a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h index 8feff7d5de..046ce39b60 100644 --- a/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h +++ b/src/overlays/actors/ovl_En_Rail_Skb/z_en_rail_skb.h @@ -9,7 +9,7 @@ struct EnRailSkb; typedef void (*EnRailSkbActionFunc)(struct EnRailSkb*, PlayState*); typedef void (*EnRailSkbUnkFunc)(struct EnRailSkb*); -#define ENRAILSKB_GET_FF00(thisx) (((thisx)->params >> 8) & 0xFF) +#define ENRAILSKB_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0xFF) #define ENRAILSKB_GET_SWITCH_FLAG(thisx) ((thisx)->params & 0xFF) typedef enum EnRailSkbBodyPart { @@ -37,7 +37,7 @@ typedef struct EnRailSkb { /* 0x1E4 */ SkelAnime skelAnime; /* 0x228 */ EnRailSkbActionFunc actionFunc; /* 0x22C */ ObjHakaisi* unk_22C; - /* 0x230 */ Vec3s* unk_230; + /* 0x230 */ Vec3s* pathPoints; /* 0x234 */ Vec3f bodyPartsPos[ENRAILSKB_BODYPART_MAX]; /* 0x2DC */ s32 bodyPartsCount; /* 0x2E0 */ s32 unk_2E0; diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index 7d0cfdc4b9..036a074c13 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -198,7 +198,7 @@ void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, Pl Vec3f targetPos; Path* path = &play->setupPathList[ENRAILGIBUD_GET_PATH_INDEX(&this->actor)]; - this->points = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); this->currentPoint = currentGibdoIndex; this->pathCount = path->count; @@ -218,18 +218,18 @@ void EnRailgibud_SpawnOtherGibdosAndSetPositionAndRotation(EnRailgibud* this, Pl currentGibdoIndex = 0; } - this->actor.world.pos.x = this->points[this->currentPoint].x; - this->actor.world.pos.y = this->points[this->currentPoint].y; - this->actor.world.pos.z = this->points[this->currentPoint].z; + this->actor.world.pos.x = this->pathPoints[this->currentPoint].x; + this->actor.world.pos.y = this->pathPoints[this->currentPoint].y; + this->actor.world.pos.z = this->pathPoints[this->currentPoint].z; if (this->currentPoint < (this->pathCount - 1)) { nextPoint = this->currentPoint + 1; } else { nextPoint = 0; } - targetPos.x = this->points[nextPoint].x; - targetPos.y = this->points[nextPoint].y; - targetPos.z = this->points[nextPoint].z; + targetPos.x = this->pathPoints[nextPoint].x; + targetPos.y = this->pathPoints[nextPoint].y; + targetPos.z = this->pathPoints[nextPoint].z; this->actor.world.rot.y = this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &targetPos); this->actor.home = this->actor.world; @@ -296,9 +296,9 @@ void EnRailgibud_WalkInCircles(EnRailgibud* this, PlayState* play) { s32 pad; s16 yRotation; - targetPos.x = this->points[this->currentPoint].x; - targetPos.y = this->points[this->currentPoint].y; - targetPos.z = this->points[this->currentPoint].z; + targetPos.x = this->pathPoints[this->currentPoint].x; + targetPos.y = this->pathPoints[this->currentPoint].y; + targetPos.z = this->pathPoints[this->currentPoint].z; if ((this->actor.xzDistToPlayer <= 100.0f) && func_800B715C(play) && (Player_GetMask(play) != PLAYER_MASK_GIBDO)) { this->actor.home = this->actor.world; @@ -311,8 +311,7 @@ void EnRailgibud_WalkInCircles(EnRailgibud* this, PlayState* play) { // If we're not supposed to walk forward, then stop here; // don't rotate the Gibdo or move it around. if (this->actor.parent == NULL) { - if (this->shouldWalkForward) { - } else { + if (!this->shouldWalkForward) { return; } } else { @@ -482,6 +481,9 @@ void EnRailgibud_Grab(EnRailgibud* this, PlayState* play) { Math_SmoothStepToF(&this->actor.shape.yOffset, 0.0f, 1.0f, 400.0f, 0.0f); } break; + + default: + break; } } @@ -844,6 +846,9 @@ void EnRailgibud_UpdateDamage(EnRailgibud* this, PlayState* play) { EnRailgibud_SetupStunned(this); } break; + + default: + break; } } } @@ -990,6 +995,7 @@ void EnRailgibud_CheckIfTalkingToPlayer(EnRailgibud* this, PlayState* play) { case TEXT_STATE_CLOSING: case TEXT_STATE_3: case TEXT_STATE_CHOICE: + default: break; } } @@ -1240,6 +1246,9 @@ s32 EnRailgibud_PerformCutsceneActions(EnRailgibud* this, PlayState* play) { } } break; + + default: + break; } Cutscene_ActorTranslateAndYaw(&this->actor, play, cueChannel); diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h index c9536d2351..1c3304ee08 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.h @@ -39,7 +39,7 @@ typedef struct EnRailgibud { /* 0x1D8 */ Vec3f bodyPartsPos[ENRAILGIBUD_BODYPART_MAX]; /* 0x28C */ s32 bodyPartIndex; /* 0x290 */ UNK_TYPE1 unk290[0x4]; - /* 0x294 */ Vec3s* points; + /* 0x294 */ Vec3s* pathPoints; /* 0x298 */ s32 currentPoint; /* 0x29C */ s32 pathCount; /* 0x2A0 */ f32 drawDmgEffAlpha; diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index bd5beb3885..0eeda231de 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -141,11 +141,11 @@ void EnRr_Init(Actor* thisx, PlayState* play) { this->actor.scale.y = 0.022499999f; this->actor.scale.x = 0.028499998f; this->actor.scale.z = 0.028499998f; - this->collider1.dim.radius = this->collider1.dim.radius * 1.5f; - this->collider1.dim.height = this->collider1.dim.height * 1.5f; - this->collider2.dim.radius = this->collider2.dim.radius * 1.5f; - this->collider2.dim.height = this->collider2.dim.height * 1.5f; - this->collider2.dim.yShift = this->collider2.dim.yShift * 1.5f; + this->collider1.dim.radius *= 1.5f; + this->collider1.dim.height *= 1.5f; + this->collider2.dim.radius *= 1.5f; + this->collider2.dim.height *= 1.5f; + this->collider2.dim.yShift *= 1.5f; } Collider_UpdateCylinder(&this->actor, &this->collider2); diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 3203730036..9301d344ee 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -31,8 +31,8 @@ void EnRuppecrow_ShatterIce(EnRuppecrow*, PlayState*); void EnRuppecrow_UpdatePosition(EnRuppecrow*, PlayState*); s32 EnRuppecrow_CheckPlayedMatchingSong(PlayState*); void EnRuppecrow_HandleSongCutscene(EnRuppecrow*, PlayState*); -s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow*, Path*, s32); -s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow*, Path*, s32); +s32 EnRuppecrow_HasReachedPointClockwise(EnRuppecrow*, Path*, s32); +s32 EnRuppecrow_HasReachedPointCounterClockwise(EnRuppecrow*, Path*, s32); f32 EnRuppecrow_GetPointDirection(Path*, s32, PosRot*, Vec3s*); s32 EnRuppecrow_CanSpawnBlueRupees(PlayState*); void EnRuppecrow_SpawnRupee(EnRuppecrow*, PlayState*); @@ -136,10 +136,10 @@ s32 EnRuppecrow_UpdateCollision(EnRuppecrow* this, PlayState* play) { return true; } -s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) { +s32 EnRuppecrow_HasReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) { Vec3s* points = Lib_SegmentedToVirtual(path->points); - s32 pathCount = path->count; - s32 currentPoint = pointIndex; + s32 count = path->count; + s32 index = pointIndex; s32 reached = false; f32 diffX; f32 diffZ; @@ -148,31 +148,32 @@ s32 EnRuppecrow_ReachedPointClockwise(EnRuppecrow* this, Path* path, s32 pointIn f32 d; Vec3f point; - Math_Vec3s_ToVec3f(&point, &points[currentPoint]); + Math_Vec3s_ToVec3f(&point, &points[index]); - if (currentPoint == 0) { + if (index == 0) { diffX = points[1].x - points[0].x; diffZ = points[1].z - points[0].z; - } else if (currentPoint == (pathCount - 1)) { - diffX = points[pathCount - 1].x - points[pathCount - 2].x; - diffZ = points[pathCount - 1].z - points[pathCount - 2].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - diffX = points[currentPoint + 1].x - points[currentPoint - 1].x; - diffZ = points[currentPoint + 1].z - points[currentPoint - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } return reached; } -s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) { +s32 EnRuppecrow_HasReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 pointIndex) { Vec3s* points = Lib_SegmentedToVirtual(path->points); - s32 pathCount = path->count; - s32 currentPoint = pointIndex; + s32 count = path->count; + s32 index = pointIndex; s32 reached = false; f32 diffX; f32 diffZ; @@ -181,21 +182,22 @@ s32 EnRuppecrow_ReachedPointCounterClockwise(EnRuppecrow* this, Path* path, s32 f32 d; Vec3f point; - Math_Vec3s_ToVec3f(&point, &points[currentPoint]); + Math_Vec3s_ToVec3f(&point, &points[index]); - if (currentPoint == 0) { + if (index == 0) { diffX = points[0].x - points[1].x; diffZ = points[0].z - points[1].z; - } else if (currentPoint == (pathCount - 1)) { - diffX = points[pathCount - 2].x - points[pathCount - 1].x; - diffZ = points[pathCount - 2].z - points[pathCount - 1].z; + } else if (index == (count - 1)) { + diffX = points[count - 2].x - points[count - 1].x; + diffZ = points[count - 2].z - points[count - 1].z; } else { - diffX = points[currentPoint - 1].x - points[currentPoint + 1].x; - diffZ = points[currentPoint - 1].z - points[currentPoint + 1].z; + diffX = points[index - 1].x - points[index + 1].x; + diffZ = points[index - 1].z - points[index + 1].z; } func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * px) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { reached = true; } @@ -339,7 +341,7 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.x, -nextPointDirection.x, 0x4, 0x3E8, 0x1); if (this->isGoingCounterClockwise & 1) { - if (EnRuppecrow_ReachedPointCounterClockwise(this, this->path, this->currentPoint)) { + if (EnRuppecrow_HasReachedPointCounterClockwise(this, this->path, this->currentPoint)) { if (this->currentPoint <= 0) { this->currentPoint = this->path->count - 1; } else { @@ -351,7 +353,7 @@ void EnRuppecrow_UpdatePosition(EnRuppecrow* this, PlayState* play) { EnRuppecrow_SpawnRupee(this, play); } } - } else if (EnRuppecrow_ReachedPointClockwise(this, this->path, this->currentPoint)) { + } else if (EnRuppecrow_HasReachedPointClockwise(this, this->path, this->currentPoint)) { if (this->currentPoint >= this->path->count - 1) { this->currentPoint = 0; } else { diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 179b91e388..436fb6af9a 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -167,10 +167,10 @@ void EnSb_SetupWaitOpen(EnSb* this) { } void EnSb_SetupLunge(EnSb* this) { - f32 frameCount = Animation_GetLastFrame(&object_sb_Anim_000124); + f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_000124); f32 playbackSpeed = this->actor.depthInWater > 0.0f ? 1.0f : 0.0f; - Animation_Change(&this->skelAnime, &object_sb_Anim_000124, playbackSpeed, 0.0f, frameCount, ANIMMODE_ONCE, 0); + Animation_Change(&this->skelAnime, &object_sb_Anim_000124, playbackSpeed, 0.0f, endFrame, ANIMMODE_ONCE, 0); this->state = SHELLBLADE_LUNGE; this->actionFunc = EnSb_Lunge; Actor_PlaySfx(&this->actor, NA_SE_EN_KUSAMUSHI_VIBE); @@ -184,10 +184,10 @@ void EnSb_SetupBounce(EnSb* this) { } void EnSb_SetupIdle(EnSb* this, s32 changeSpeed) { - f32 frameCount = Animation_GetLastFrame(&object_sb_Anim_00004C); + f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_00004C); if (this->state != SHELLBLADE_WAIT_CLOSED) { - Animation_Change(&this->skelAnime, &object_sb_Anim_00004C, 1.0f, 0, frameCount, ANIMMODE_ONCE, 0.0f); + Animation_Change(&this->skelAnime, &object_sb_Anim_00004C, 1.0f, 0, endFrame, ANIMMODE_ONCE, 0.0f); } this->state = SHELLBLADE_WAIT_CLOSED; if (changeSpeed) { @@ -215,9 +215,10 @@ void EnSb_Idle(EnSb* this, PlayState* play) { } void EnSb_Open(EnSb* this, PlayState* play) { - f32 currentFrame = this->skelAnime.curFrame; + f32 curFrame = this->skelAnime.curFrame; + f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_000194); - if (Animation_GetLastFrame(&object_sb_Anim_000194) <= currentFrame) { + if (curFrame >= endFrame) { this->vulnerableTimer = 20; EnSb_SetupWaitOpen(this); } else { @@ -280,11 +281,11 @@ void EnSb_Lunge(EnSb* this, PlayState* play) { void EnSb_Bounce(EnSb* this, PlayState* play) { s32 pad; - f32 currentFrame = currentFrame = this->skelAnime.curFrame; - f32 frameCount = frameCount = Animation_GetLastFrame(&object_sb_Anim_0000B4); + f32 curFrame = this->skelAnime.curFrame; + f32 endFrame = Animation_GetLastFrame(&object_sb_Anim_0000B4); Math_StepToF(&this->actor.speed, 0.0f, 0.2f); - if (currentFrame == frameCount) { + if (curFrame == endFrame) { if (this->bounceCounter != 0) { this->bounceCounter--; this->attackTimer = 1; diff --git a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c index 2117c48781..534c7842b2 100644 --- a/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c +++ b/src/overlays/actors/ovl_En_Scopecrow/z_en_scopecrow.c @@ -169,35 +169,38 @@ void func_80BCD2BC(EnScopecrow* this, PlayState* play) { this->actor.csId, this->actor.halfDaysBits, NULL); } -s32 func_80BCD334(EnScopecrow* this, Path* path, s32 pointIndex) { +s32 EnScopecrow_HasReachedPoint(EnScopecrow* this, Path* path, s32 pointIndex) { Vec3s* points = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; + s32 count = path->count; s32 index = pointIndex; - s32 ret = false; - f32 phi_fa0; - f32 phi_fa1; - Vec3f sp3C; - Vec3f sp30; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &points[index]); + Math_Vec3s_ToVec3f(&point, &points[index]); if (index == 0) { - phi_fa0 = points[1].x - points[0].x; - phi_fa1 = points[1].z - points[0].z; - } else if ((sp58 - 1) == index) { - phi_fa0 = points[sp58 - 1].x - points[sp58 - 2].x; - phi_fa1 = points[sp58 - 1].z - points[sp58 - 2].z; + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - phi_fa0 = points[index + 1].x - points[index - 1].x; - phi_fa1 = points[index + 1].z - points[index - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_fa0, phi_fa1)), &sp3C.z, &sp3C.y, &sp3C.x); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * sp3C.z) + (sp3C.y * this->actor.world.pos.z) + sp3C.x) > 0.0f) { - ret = true; + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return ret; + + return reached; } f32 func_80BCD4D0(Path* path, s32 count, Vec3f* arg2, Vec3s* arg3) { @@ -244,7 +247,7 @@ void func_80BCD640(EnScopecrow* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; Math_SmoothStepToS(&this->actor.world.rot.x, -sp30.x, 4, 0x3E8, 1); - if (func_80BCD334(this, this->path, this->unk_1FC)) { + if (EnScopecrow_HasReachedPoint(this, this->path, this->unk_1FC)) { if ((this->unk_1FC == this->unk_262) && func_80BCD1AC(this->unk_260)) { func_80BCD2BC(this, play); } diff --git a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c index 0373571805..f1a3dc763a 100644 --- a/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c +++ b/src/overlays/actors/ovl_En_Scopenuts/z_en_scopenuts.c @@ -30,7 +30,7 @@ void func_80BCBD28(EnScopenuts* this, PlayState* play); void func_80BCBF0C(EnScopenuts* this, PlayState* play); void func_80BCBFFC(EnScopenuts* this, PlayState* play); void func_80BCC288(EnScopenuts* this, PlayState* play); -s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_); +s32 EnScopenuts_HasReachedPoint(EnScopenuts* this, Path* path, s32 pointIndex); f32 func_80BCC448(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3); ActorInit En_Scopenuts_InitVars = { @@ -100,12 +100,12 @@ static InitChainEntry sInitChain[] = { }; s16 func_80BCABF0(Path* path) { - Vec3s* sp34 = Lib_SegmentedToVirtual(path->points); + Vec3s* points = Lib_SegmentedToVirtual(path->points); Vec3f sp28; Vec3f sp1C; - Math_Vec3s_ToVec3f(&sp28, &sp34[0]); - Math_Vec3s_ToVec3f(&sp1C, &sp34[1]); + Math_Vec3s_ToVec3f(&sp28, &points[0]); + Math_Vec3s_ToVec3f(&sp1C, &points[1]); return Math_Vec3f_Yaw(&sp28, &sp1C); } @@ -216,7 +216,7 @@ void func_80BCB078(EnScopenuts* this, PlayState* play) { this->unk_33E = 0x1000; this->unk_340 += 0x1C71; this->actor.world.rot.x = -sp30.x; - if (func_80BCC2AC(this, this->path, this->unk_334)) { + if (EnScopenuts_HasReachedPoint(this, this->path, this->unk_334)) { if (this->unk_334 >= (this->path->count - 1)) { this->actionFunc = func_80BCB1C8; this->actor.speed = 0.0f; @@ -579,7 +579,7 @@ void func_80BCBFFC(EnScopenuts* this, PlayState* play) { this->unk_340 += this->unk_34C; this->actor.world.rot.x = -sp38.x; - if (func_80BCC2AC(this, this->path, this->unk_334)) { + if (EnScopenuts_HasReachedPoint(this, this->path, this->unk_334)) { sp32 = 1; } @@ -629,49 +629,50 @@ void func_80BCC288(EnScopenuts* this, PlayState* play) { Actor_Kill(&this->actor); } -s32 func_80BCC2AC(EnScopenuts* this, Path* path, s32 arg2_) { - Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; - s32 arg2 = arg2_; - s32 sp50 = false; - f32 phi_f12; - f32 phi_f14; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnScopenuts_HasReachedPoint(EnScopenuts* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &sp5C[arg2]); + Math_Vec3s_ToVec3f(&point, &points[index]); - if (arg2 == 0) { - phi_f12 = sp5C[1].x - sp5C[0].x; - phi_f14 = sp5C[1].z - sp5C[0].z; - } else if ((sp58 - 1) == arg2) { - phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x; - phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z; + if (index == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - phi_f12 = sp5C[arg2 + 1].x - sp5C[arg2 - 1].x; - phi_f14 = sp5C[arg2 + 1].z - sp5C[arg2 - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - sp50 = true; + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return sp50; + + return reached; } f32 func_80BCC448(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { - Vec3s* temp_v1; + Vec3s* points; Vec3f sp20; if (path != NULL) { - temp_v1 = Lib_SegmentedToVirtual(path->points); - temp_v1 = &temp_v1[arg1]; - sp20.x = temp_v1[0].x; - sp20.y = temp_v1[0].y; - sp20.z = temp_v1[0].z; + points = Lib_SegmentedToVirtual(path->points); + points = &points[arg1]; + sp20.x = points[0].x; + sp20.y = points[0].y; + sp20.z = points[0].z; } arg3->y = Math_Vec3f_Yaw(arg2, &sp20); diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 3374292659..838c96f01e 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -32,7 +32,7 @@ void func_80ADC6D0(EnSellnuts* this, PlayState* play); void func_80ADC7B4(EnSellnuts* this, PlayState* play); void func_80ADC8C4(EnSellnuts* this, PlayState* play); void func_80ADCA64(EnSellnuts* this, PlayState* play); -s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2); +s32 EnSellnuts_HasReachedPoint(EnSellnuts* this, Path* path, s32 pointIndex); f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3); static u16 D_80ADD910[] = { 0x0614, 0x060E, 0x0628 }; @@ -657,7 +657,7 @@ void func_80ADC37C(EnSellnuts* this, PlayState* play) { this->unk_342 = 0x1000; this->unk_344 += this->unk_364; this->actor.world.rot.x = -sp30.x; - if (func_80ADCE4C(this, this->path, this->unk_334) && (sp2C < 500.0f)) { + if (EnSellnuts_HasReachedPoint(this, this->path, this->unk_334) && (sp2C < 500.0f)) { if (this->unk_334 >= (this->path->count - 1)) { CutsceneManager_Stop(this->csId); this->actionFunc = func_80ADC580; @@ -788,7 +788,7 @@ void func_80ADC8C4(EnSellnuts* this, PlayState* play) { this->unk_342 = 0x1000; this->unk_344 += 0x1C71; this->actor.world.rot.x = -sp30.x; - if (func_80ADCE4C(this, this->path, this->unk_334)) { + if (EnSellnuts_HasReachedPoint(this, this->path, this->unk_334)) { if (this->unk_334 >= (this->path->count - 1)) { this->unk_34C = 22; this->actor.gravity = -1.0f; @@ -892,36 +892,38 @@ void func_80ADCD3C(EnSellnuts* this, PlayState* play) { } } -s32 func_80ADCE4C(EnSellnuts* this, Path* path, s32 arg2) { +s32 EnSellnuts_HasReachedPoint(EnSellnuts* this, Path* path, s32 pointIndex) { Vec3s* points = Lib_SegmentedToVirtual(path->points); s32 count = path->count; - s32 var = arg2; - s32 ret = false; - f32 pointX; - f32 pointY; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &points[var]); - if (var == 0) { - pointX = points[1].x - points[0].x; - pointY = points[1].z - points[0].z; - } else if ((u32)count == (u32)(var + 1)) { - pointX = points[count - 1].x - points[count - 2].x; - pointY = points[count - 1].z - points[count - 2].z; + Math_Vec3s_ToVec3f(&point, &points[index]); + + if (index == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - pointX = points[var + 1].x - points[var - 1].x; - pointY = points[var + 1].z - points[var - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(pointX, pointY)), &sp44, &sp40, &sp3C); - if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - ret = true; + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); + + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return ret; + return reached; } f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) { diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index b2770d93aa..6ddcf13a03 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -600,64 +600,72 @@ s16 EnSuttari_GetDistSqAndOrient(Path* path, s32 index, Vec3f* pos, f32* distSq) return RAD_TO_BINANG(Math_Atan2F_XY(diffZ, diffX)); } -s32 func_80BAB758(EnSuttari* this, Path* path, s32 arg2) { - Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; - s32 index = arg2; - s32 ret = false; - f32 sp54; - f32 sp48; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnSuttari_HasReachedPointForward(EnSuttari* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; + + Math_Vec3s_ToVec3f(&point, &points[index]); - Math_Vec3s_ToVec3f(&sp30, &sp5C[index]); if (index == 0) { - sp54 = sp5C[1].x - sp5C[0].x; - sp48 = sp5C[1].z - sp5C[0].z; - } else if (index == sp58 - 1) { - sp54 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x; - sp48 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z; + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - sp54 = sp5C[index + 1].x - sp5C[index - 1].x; - sp48 = sp5C[index + 1].z - sp5C[index - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(sp54, sp48)), &sp44, &sp40, &sp3C); - if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - ret = true; + + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); + + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return ret; + + return reached; } -s32 func_80BAB8F4(EnSuttari* this, Path* path, s32 arg2) { - Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; - s32 index = arg2; - s32 ret = false; - f32 sp54; - f32 sp48; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnSuttari_HasReachedPointReverse(EnSuttari* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; + + Math_Vec3s_ToVec3f(&point, &points[index]); - Math_Vec3s_ToVec3f(&sp30, &sp5C[index]); if (index == 0) { - sp54 = sp5C[0].x - sp5C[1].x; - sp48 = sp5C[0].z - sp5C[1].z; - } else if (index == sp58 - 1) { - sp54 = sp5C[sp58 - 2].x - sp5C[sp58 - 1].x; - sp48 = sp5C[sp58 - 2].z - sp5C[sp58 - 1].z; + diffX = points[0].x - points[1].x; + diffZ = points[0].z - points[1].z; + } else if (index == (count - 1)) { + diffX = points[count - 2].x - points[count - 1].x; + diffZ = points[count - 2].z - points[count - 1].z; } else { - sp54 = sp5C[index - 1].x - sp5C[index + 1].x; - sp48 = sp5C[index - 1].z - sp5C[index + 1].z; + diffX = points[index - 1].x - points[index + 1].x; + diffZ = points[index - 1].z - points[index + 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(sp54, sp48)), &sp44, &sp40, &sp3C); - if (((sp44 * this->actor.world.pos.x) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - ret = true; + + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); + + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return ret; + + return reached; } void func_80BABA90(EnSuttari* this, s32 arg1, u8 arg2) { @@ -675,7 +683,7 @@ void func_80BABA90(EnSuttari* this, s32 arg1, u8 arg2) { } Math_SmoothStepToS(&this->actor.world.rot.y, target, 4, 0x3E8, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - if (func_80BAB758(this, this->paths[arg1], this->unk1F4[arg1])) { + if (EnSuttari_HasReachedPointForward(this, this->paths[arg1], this->unk1F4[arg1])) { if (this->unk1F4[arg1] >= (this->paths[arg1]->count - 1)) { if (arg2 == 0) { this->unk1F4[arg1] = 0; @@ -700,7 +708,7 @@ void func_80BABB90(EnSuttari* this, s32 arg1) { } Math_SmoothStepToS(&this->actor.world.rot.y, target, 1, 0xBB8, 0); this->actor.shape.rot.y = this->actor.world.rot.y; - if (func_80BAB8F4(this, this->paths[arg1], this->unk1F4[arg1])) { + if (EnSuttari_HasReachedPointReverse(this, this->paths[arg1], this->unk1F4[arg1])) { if (this->unk1F4[arg1] <= 0) { this->unk1F4[arg1] = -0x63; } else { diff --git a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c index 31c650470b..3e4e5074e7 100644 --- a/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c +++ b/src/overlays/actors/ovl_En_Syateki_Wf/z_en_syateki_wf.c @@ -311,7 +311,7 @@ void EnSyatekiWf_Run(EnSyatekiWf* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; if (distToTarget < 50.0f) { if (this->actor.speed > 3.0f) { - this->actor.speed = this->actor.speed - 0.5f; + this->actor.speed -= 0.5f; } else { this->actor.speed = this->actor.speed; } diff --git a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c index d174175af0..f4d6ec9534 100644 --- a/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c +++ b/src/overlays/actors/ovl_En_Takaraya/z_en_takaraya.c @@ -62,7 +62,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32(targetArrowOffset, 1000, ICHAIN_STOP), }; -u32 sTexturesDesegmented = false; +static s32 sTexturesDesegmented = false; u16 D_80ADFB2C[PLAYER_FORM_MAX] = { 0x76D, // PLAYER_FORM_FIERCE_DEITY @@ -106,6 +106,7 @@ void EnTakaraya_Init(Actor* thisx, PlayState* play) { this->morphTable, TREASURE_CHEST_SHOP_GAL_LIMB_MAX); this->switchFlag = EN_TAKARAYA_GET_SWITCH_FLAG(thisx); thisx->params &= 0xFF; + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(sEyesDownTextures); i++) { sEyesUpTextures[i] = Lib_SegmentedToVirtual(sEyesUpTextures[i]); @@ -113,6 +114,7 @@ void EnTakaraya_Init(Actor* thisx, PlayState* play) { } sTexturesDesegmented = true; } + this->eyeTexIndex = 2; if (gSaveContext.save.entrance == ENTRANCE(TREASURE_CHEST_SHOP, 1)) { Audio_StopSubBgm(); diff --git a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c index e018a0c060..c401c4b4cf 100644 --- a/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c +++ b/src/overlays/actors/ovl_En_Tanron2/z_en_tanron2.c @@ -223,7 +223,7 @@ void func_80BB6BD8(EnTanron2* this, PlayState* play) { this->actor.world.pos.x += this->actor.velocity.x; this->actor.world.pos.y += this->actor.velocity.y; this->actor.world.pos.z += this->actor.velocity.z; - this->actor.velocity.y = this->actor.velocity.y - 2.0f; + this->actor.velocity.y -= 2.0f; if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; @@ -316,7 +316,7 @@ void func_80BB6F78(EnTanron2* this, PlayState* play) { case 1: if (this->unk_14E == 0) { this->actor.world.pos.y += this->actor.velocity.y; - this->actor.velocity.y = this->actor.velocity.y - 2.0f; + this->actor.velocity.y -= 2.0f; if (this->actor.world.pos.y <= this->actor.floorHeight) { this->actor.world.pos.y = this->actor.floorHeight; diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index c4a566eaab..3fa739f616 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -132,7 +132,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -1000, ICHAIN_STOP), }; -static s32 D_80896B60 = 0; +static s32 sTexturesDesegmented = false; static Vec3f D_80896B64 = { 0.0f, 0.3f, 0.0f }; void EnTite_Init(Actor* thisx, PlayState* play) { @@ -151,13 +151,13 @@ void EnTite_Init(Actor* thisx, PlayState* play) { this->updBgCheckInfoFlags = UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4 | UPDBGCHECKINFO_FLAG_8 | UPDBGCHECKINFO_FLAG_10; - if (!D_80896B60) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(D_80896B24); i++) { for (j = 0; j < ARRAY_COUNT(D_80896B24[0]); j++) { D_80896B24[i][j] = Lib_SegmentedToVirtual(D_80896B24[i][j]); } } - D_80896B60 = true; + sTexturesDesegmented = true; } if (this->actor.params == ENTITE_MINUS_3) { @@ -452,7 +452,7 @@ void func_80894638(EnTite* this, PlayState* play) { temp_v1 = (s32)(temp_v0 * (1.0f / 42.0f)) - 10; } - this->actor.shape.rot.y = this->actor.shape.rot.y + (temp_v1 * 2); + this->actor.shape.rot.y += temp_v1 * 2; this->actor.world.rot.y = this->actor.shape.rot.y; this->skelAnime.playSpeed = temp_v1 * 0.01f; SkelAnime_Update(&this->skelAnime); diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index 72bdec4a10..3092bc0468 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -1406,7 +1406,7 @@ void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) { } void EnTrt_TalkToShopkeeper(EnTrt* this, PlayState* play) { - u8 talkState = talkState = Message_GetState(&play->msgCtx); + u8 talkState = Message_GetState(&play->msgCtx); Player* player = GET_PLAYER(play); PlayerItemAction itemAction; diff --git a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c index 4ededea246..f7a316b49d 100644 --- a/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c +++ b/src/overlays/actors/ovl_En_Trt2/z_en_trt2.c @@ -16,7 +16,7 @@ void EnTrt2_Destroy(Actor* thisx, PlayState* play); void EnTrt2_Update(Actor* thisx, PlayState* play); void func_80AD46F8(EnTrt2* this); -s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2); +s32 EnTrt2_HasReachedPoint(EnTrt2* this, Path* path, s32 pointIndex); s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3); f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3); void func_80AD4A78(EnTrt2* this, PlayState* play); @@ -170,7 +170,7 @@ void func_80AD3530(EnTrt2* this, PlayState* play) { } Math_SmoothStepToS(&this->actor.world.rot.y, phi_a1, 4, 1000, 1); this->actor.shape.rot.y = this->actor.world.rot.y; - if (func_80AD475C(this, this->path, this->unk_1E4)) { + if (EnTrt2_HasReachedPoint(this, this->path, this->unk_1E4)) { if (this->unk_1E4 >= (this->path->count - 1)) { this->unk_1E4 = 0; } else { @@ -261,7 +261,7 @@ void func_80AD38B8(EnTrt2* this, PlayState* play) { this->actor.shape.rot.y = this->actor.world.rot.y; Math_SmoothStepToS(&this->actor.shape.rot.x, sp30.x, 4, 1000, 1); this->actor.world.rot.x = -this->actor.shape.rot.x; - if (func_80AD475C(this, this->path, this->unk_1E4)) { + if (EnTrt2_HasReachedPoint(this, this->path, this->unk_1E4)) { if (this->unk_1E4 >= (this->path->count - 1)) { CutsceneManager_Stop(this->csId); this->unk_3D9 = 2; @@ -565,40 +565,38 @@ void func_80AD46F8(EnTrt2* this) { } } -s32 func_80AD475C(EnTrt2* this, Path* path, s32 arg2) { - Vec3s* points; - s32 count; - f32 phi_f12; - s32 ret; - f32 phi_f14; - s32 arg = arg2; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnTrt2_HasReachedPoint(EnTrt2* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - points = Lib_SegmentedToVirtual(path->points); - count = path->count; - ret = false; - Math_Vec3s_ToVec3f(&sp30, &points[arg]); + Math_Vec3s_ToVec3f(&point, &points[index]); - if (arg == 0) { - phi_f12 = points[1].x - points[0].x; - phi_f14 = points[1].z - points[0].z; - } else if ((count - 1) == arg) { - phi_f12 = points[count - 1].x - points[count - 2].x; - phi_f14 = points[count - 1].z - points[count - 2].z; + if (index == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - phi_f12 = points[arg + 1].x - points[arg - 1].x; - phi_f14 = points[arg + 1].z - points[arg - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); - if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - ret = true; + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return ret; + + return reached; } s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3) { @@ -622,15 +620,15 @@ s16 func_80AD48F8(Path* path, s32 arg1, Vec3f* arg2, f32* arg3) { f32 func_80AD49B8(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { s32 pad; Vec3f sp20; - Vec3s* temp_v1; + Vec3s* points; if (path != NULL) { - temp_v1 = Lib_SegmentedToVirtual(path->points); - temp_v1 = &temp_v1[arg1]; + points = Lib_SegmentedToVirtual(path->points); + points = &points[arg1]; - sp20.x = temp_v1->x; - sp20.y = temp_v1->y; - sp20.z = temp_v1->z; + sp20.x = points->x; + sp20.y = points->y; + sp20.z = points->z; } arg3->y = Math_Vec3f_Yaw(arg2, &sp20); arg3->x = Math_Vec3f_Pitch(arg2, &sp20); diff --git a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c index 176db5e606..8ecc2a1ddf 100644 --- a/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c +++ b/src/overlays/actors/ovl_En_Tru_Mt/z_en_tru_mt.c @@ -263,12 +263,12 @@ f32 func_80B76540(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { Vec3f sp20; if (path != NULL) { - Vec3s* temp_v1 = Lib_SegmentedToVirtual(path->points); + Vec3s* points = Lib_SegmentedToVirtual(path->points); - temp_v1 = &temp_v1[arg1]; - sp20.x = temp_v1->x; - sp20.y = temp_v1->y; - sp20.z = temp_v1->z; + points = &points[arg1]; + sp20.x = points->x; + sp20.y = points->y; + sp20.z = points->z; } arg3->y = Math_Vec3f_Yaw(arg2, &sp20); arg3->x = Math_Vec3f_Pitch(arg2, &sp20); @@ -276,37 +276,38 @@ f32 func_80B76540(Path* path, s32 arg1, Vec3f* arg2, Vec3s* arg3) { return sp20.y - arg2->y; } -s32 func_80B76600(EnTruMt* this, Path* path, s32 arg2) { - Vec3s* sp5C = Lib_SegmentedToVirtual(path->points); - s32 sp58 = path->count; - s32 idx = arg2; - s32 sp50 = false; - f32 phi_f12; - f32 phi_f14; - f32 sp44; - f32 sp40; - f32 sp3C; - Vec3f sp30; +s32 EnTruMt_HasReachedPoint(EnTruMt* this, Path* path, s32 pointIndex) { + Vec3s* points = Lib_SegmentedToVirtual(path->points); + s32 count = path->count; + s32 index = pointIndex; + s32 reached = false; + f32 diffX; + f32 diffZ; + f32 px; + f32 pz; + f32 d; + Vec3f point; - Math_Vec3s_ToVec3f(&sp30, &sp5C[idx]); + Math_Vec3s_ToVec3f(&point, &points[index]); - if (idx == 0) { - phi_f12 = sp5C[1].x - sp5C[0].x; - phi_f14 = sp5C[1].z - sp5C[0].z; - } else if (idx == (sp58 - 1)) { - phi_f12 = sp5C[sp58 - 1].x - sp5C[sp58 - 2].x; - phi_f14 = sp5C[sp58 - 1].z - sp5C[sp58 - 2].z; + if (index == 0) { + diffX = points[1].x - points[0].x; + diffZ = points[1].z - points[0].z; + } else if (index == (count - 1)) { + diffX = points[count - 1].x - points[count - 2].x; + diffZ = points[count - 1].z - points[count - 2].z; } else { - phi_f12 = sp5C[idx + 1].x - sp5C[idx - 1].x; - phi_f14 = sp5C[idx + 1].z - sp5C[idx - 1].z; + diffX = points[index + 1].x - points[index - 1].x; + diffZ = points[index + 1].z - points[index - 1].z; } - func_8017B7F8(&sp30, RAD_TO_BINANG(Math_FAtan2F(phi_f12, phi_f14)), &sp44, &sp40, &sp3C); - if (((this->actor.world.pos.x * sp44) + (sp40 * this->actor.world.pos.z) + sp3C) > 0.0f) { - sp50 = true; + func_8017B7F8(&point, RAD_TO_BINANG(Math_FAtan2F(diffX, diffZ)), &px, &pz, &d); + + if (((px * this->actor.world.pos.x) + (pz * this->actor.world.pos.z) + d) > 0.0f) { + reached = true; } - return sp50; + return reached; } void func_80B7679C(EnTruMt* this, PlayState* play) { @@ -375,7 +376,7 @@ void func_80B76A64(EnTruMt* this, PlayState* play) { this->actor.shape.rot.z = CLAMP(this->actor.world.rot.y, -0x1770, 0x1770); this->actor.world.rot.z = this->actor.shape.rot.z; - if (func_80B76600(this, this->path, this->unk_36C)) { + if (EnTruMt_HasReachedPoint(this, this->path, this->unk_36C)) { if (this->unk_36C >= (this->path->count - 1)) { this->actionFunc = func_80B76C38; this->actor.speed = 0.0f; diff --git a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c index fc794c45a0..5740b90f9e 100644 --- a/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c +++ b/src/overlays/actors/ovl_En_Tsn/z_en_tsn.c @@ -117,7 +117,10 @@ void func_80ADFCEC(EnTsn* this, PlayState* play) { if (this->unk_1D8 == NULL) { Actor_Kill(&this->actor); - } else if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_1) { + return; + } + + if ((ENTSN_GET_F(&this->actor)) == ENTSN_F_1) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_PROP); } } diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index 644b72098c..fad445ea42 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -154,7 +154,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_S8(hintId, TATL_HINT_ID_BEAMOS, ICHAIN_STOP), }; -s32 D_808CD5B8 = false; +static s32 sTexturesDesegmented = false; Color_RGBA8 D_808CD5BC = { 0, 0, 255, 0 }; @@ -181,11 +181,11 @@ void EnVm_Init(Actor* thisx, PlayState* play) { thisx->params &= 0xFF; this->actor.bgCheckFlags |= BGCHECKFLAG_PLAYER_400; - if (!D_808CD5B8) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(D_808CD58C); i++) { D_808CD58C[i] = Lib_SegmentedToVirtual(D_808CD58C[i]); } - D_808CD5B8 = true; + sTexturesDesegmented = true; } func_808CC420(this); } diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index 4c3c6a315f..83b9e965ac 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -438,7 +438,7 @@ void func_80A59C04(Actor* thisx, PlayState* play2) { ptr->unk_04.x += ptr->unk_10.x; ptr->unk_04.y += ptr->unk_10.y; ptr->unk_04.z += ptr->unk_10.z; - ptr->unk_10.y = ptr->unk_10.y + ptr->unk_1C.y; + ptr->unk_10.y += ptr->unk_1C.y; if (ptr->unk_00 == 4) { if (ptr->unk_2A > 0) { diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 768ba05ab6..2e537812ec 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -58,7 +58,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { EnWeatherTag* this = THIS; s32 pad; Path* path; - s32 pathID; + s32 pathIndex; // flag: is targetable. Should do nothing as not set by default above this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; @@ -100,8 +100,8 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) { break; case WEATHERTAG_TYPE_WATERMURK: - pathID = WEATHER_TAG_PATHID(&this->actor); - path = &play->setupPathList[pathID]; + pathIndex = WEATHER_TAG_GET_PATH_INDEX(&this->actor); + path = &play->setupPathList[pathIndex]; this->pathPoints = Lib_SegmentedToVirtual(path->points); this->pathCount = path->count; EnWeatherTag_SetupAction(this, func_809672DC); diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h index dece04414b..9ff746708e 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.h @@ -20,7 +20,7 @@ typedef struct EnWeatherTag { } EnWeatherTag; // size = 0x15C #define WEATHER_TAG_TYPE(thisx) ((thisx)->params & 0xF) -#define WEATHER_TAG_PATHID(thisx) (((thisx)->params >> 4) & 0xF) +#define WEATHER_TAG_GET_PATH_INDEX(thisx) (((thisx)->params >> 4) & 0xF) #define WEATHER_TAG_RANGE100(thisx) ((u8)(((thisx)->params >> 8) & 0xFF) * 100.0f) #define WEATHER_TAG_GET_SKYBOX_NUM_STARS(thisx) ((u8)(((thisx)->params >> 8) & 0xFF) * 100) diff --git a/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 6160cc15a7..7580d01af8 100644 --- a/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -259,7 +259,7 @@ static InitChainEntry sInitChain[] = { ICHAIN_F32_DIV1000(gravity, -2000, ICHAIN_STOP), }; -static s32 D_809942D8 = 0; +static s32 sTexturesDesegmented = false; void EnWf_Init(Actor* thisx, PlayState* play) { EnWf* this = THIS; @@ -341,12 +341,12 @@ void EnWf_Init(Actor* thisx, PlayState* play) { Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ENEMY); - if (D_809942D8 == 0) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(sNormalEyeTextures); i++) { sNormalEyeTextures[i] = Lib_SegmentedToVirtual(sNormalEyeTextures[i]); sWhiteEyeTextures[i] = Lib_SegmentedToVirtual(sWhiteEyeTextures[i]); } - D_809942D8 = 1; + sTexturesDesegmented = true; } this->unk_2A2 = Rand_ZeroFloat(96.0f); } @@ -1529,11 +1529,7 @@ void EnWf_Update(Actor* thisx, PlayState* play) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_StepToF(&this->drawDmgEffAlpha, 0.0f, 0.05f); this->drawDmgEffScale = (this->drawDmgEffAlpha + 1.0f) * 0.375f; - if (this->drawDmgEffScale > 0.75f) { - this->drawDmgEffScale = 0.75f; - } else { - this->drawDmgEffScale = this->drawDmgEffScale; - } + this->drawDmgEffScale = CLAMP_MAX(this->drawDmgEffScale, 0.75f); } else if (!Math_StepToF(&this->drawDmgEffFrozenSteamScale, 0.75f, 0.01875f)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EV_ICE_FREEZE - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.c b/src/overlays/actors/ovl_En_Zog/z_en_zog.c index 7bfcf5935f..f5aa9f3fc4 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.c +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.c @@ -31,7 +31,7 @@ void func_80B94E34(EnZog* this, PlayState* play); void func_80B95128(EnZog* this, PlayState* play); void func_80B95240(EnZog* this, PlayState* play); -static u8 D_80B95E10; +static u8 sTexturesDesegmented; ActorInit En_Zog_InitVars = { /**/ ACTOR_EN_ZOG, @@ -140,9 +140,9 @@ void func_80B93310(Actor* thisx, Lights* mapper, PlayState* play) { void func_80B93468(EnZog* this, PlayState* play) { Vec3s* points; - this->unk_2E8 = &play->setupPathList[ENZOG_GET_FC00(&this->actor)]; - if (this->unk_2E8 != NULL) { - points = &((Vec3s*)Lib_SegmentedToVirtual(this->unk_2E8->points))[this->unk_2EC]; + this->path = &play->setupPathList[ENZOG_GET_PATH_INDEX(&this->actor)]; + if (this->path != NULL) { + points = &((Vec3s*)Lib_SegmentedToVirtual(this->path->points))[this->unk_2EC]; points++; this->actor.world.pos.x = points[-1].x; @@ -158,7 +158,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { s32 i; s16 csId; - if (!D_80B95E10) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(D_80B958AC); i++) { D_80B958AC[i] = Lib_SegmentedToVirtual(D_80B958AC[i]); } @@ -167,7 +167,7 @@ void EnZog_Init(Actor* thisx, PlayState* play) { D_80B958B8[i] = Lib_SegmentedToVirtual(D_80B958B8[i]); } - D_80B95E10 = true; + sTexturesDesegmented = true; } ActorShape_Init(&this->actor.shape, 0.0f, func_80B93310, 24.0f); @@ -208,10 +208,10 @@ void EnZog_Init(Actor* thisx, PlayState* play) { } this->unk_2EC = 0; - if (ENZOG_GET_FC00(&this->actor) != ENZOG_FC00_63) { + if (ENZOG_GET_PATH_INDEX(&this->actor) != ENZOG_FC00_63) { func_80B93468(this, play); } else { - this->unk_2E8 = NULL; + this->path = NULL; } this->unk_2FC = 0; @@ -321,11 +321,11 @@ void func_80B93BA8(EnZog* this, s16 csIdIndex) { } s32 func_80B93BE0(EnZog* this, PlayState* play) { - Path* path = this->unk_2E8; + Path* path = this->path; s16 temp_v0; Vec3s* points; - if (this->unk_2E8 == 0) { + if (this->path == NULL) { return false; } @@ -343,7 +343,7 @@ s32 func_80B93BE0(EnZog* this, PlayState* play) { if (ABS_ALT(temp_v0 - this->actor.world.rot.y) > 0x4000) { this->unk_2EC++; func_80B93468(this, play); - if ((this->unk_2EC + 1) >= this->unk_2E8->count) { + if ((this->unk_2EC + 1) >= this->path->count) { this->unk_30A |= 1; return true; } diff --git a/src/overlays/actors/ovl_En_Zog/z_en_zog.h b/src/overlays/actors/ovl_En_Zog/z_en_zog.h index 7371682504..6c1c1d4655 100644 --- a/src/overlays/actors/ovl_En_Zog/z_en_zog.h +++ b/src/overlays/actors/ovl_En_Zog/z_en_zog.h @@ -8,7 +8,7 @@ struct EnZog; typedef void (*EnZogActionFunc)(struct EnZog*, PlayState*); #define ENZOG_GET_F(thisx) ((thisx)->params & 0xF) -#define ENZOG_GET_FC00(thisx) (((thisx)->params & 0xFC00) >> 0xA) +#define ENZOG_GET_PATH_INDEX(thisx) (((thisx)->params & 0xFC00) >> 0xA) #define ENZOG_F_2 2 #define ENZOG_FC00_63 63 @@ -19,7 +19,7 @@ typedef struct EnZog { /* 0x190 */ SkelAnime skelAnime; /* 0x1D4 */ Vec3s jointTable[23]; /* 0x25E */ Vec3s morphTable[23]; - /* 0x2E8 */ Path* unk_2E8; + /* 0x2E8 */ Path* path; /* 0x2EC */ s32 unk_2EC; /* 0x2F0 */ Vec3f unk_2F0; /* 0x2FC */ s16 unk_2FC; diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index bb084a14ea..292e3aa47b 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -213,13 +213,13 @@ void func_80937238(ObjBean* this) { } void func_80937268(ObjBean* this, PlayState* play) { - this->unk_1D8 = play->setupPathList[OBJBEAN_GET_3F00(&this->dyna.actor)].count - 1; + this->unk_1D8 = play->setupPathList[OBJBEAN_GET_PATH_INDEX(&this->dyna.actor)].count - 1; this->unk_1DA = 0; this->unk_1DC = 1; } void func_809372A8(ObjBean* this) { - Math_Vec3s_ToVec3f(&this->unk_1BC, this->unk_1D4); + Math_Vec3s_ToVec3f(&this->unk_1BC, this->pathPoints); } void func_809372D0(ObjBean* this) { @@ -229,7 +229,7 @@ void func_809372D0(ObjBean* this) { f32 temp_f2; f32 temp_f12; - Math_Vec3s_ToVec3f(&sp38, &this->unk_1D4[this->unk_1DC]); + Math_Vec3s_ToVec3f(&sp38, &this->pathPoints[this->unk_1DC]); Math_Vec3f_Diff(&sp38, &this->unk_1BC, &actor->velocity); sp34 = Math3D_Vec3fMagnitude(&actor->velocity); @@ -385,8 +385,8 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Actor_ChangeCategory(play, &play->actorCtx, &this->dyna.actor, ACTORCAT_ITEMACTION); func_80937DD8(this); } else { - s32 params2 = OBJBEAN_GET_3F00(&this->dyna.actor); - Path* path = &play->setupPathList[params2]; + s32 pathIndex = OBJBEAN_GET_PATH_INDEX(&this->dyna.actor); + Path* path = &play->setupPathList[pathIndex]; this->unk_1DE = OBJBEAN_GET_3(&this->dyna.actor); this->dyna.actor.world.rot.z = 0; @@ -398,7 +398,7 @@ void ObjBean_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->collider, &this->dyna.actor, &sCylinderInit1); Collider_UpdateCylinder(&this->dyna.actor, &this->collider); - this->unk_1D4 = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); func_80937268(this, play); func_809372A8(this); diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h index f21610891f..f8704dbe5d 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.h @@ -10,7 +10,7 @@ typedef void (*ObjBeanUnkFunc)(struct ObjBean*); #define OBJBEAN_GET_SWITCH_FLAG_1(thisx, offset) (((thisx)->params + (offset)) & 0x7F) #define OBJBEAN_GET_80(thisx) (((thisx)->params >> 7) & 1) -#define OBJBEAN_GET_3F00(thisx) (((thisx)->params >> 8) & 0x3F) +#define OBJBEAN_GET_PATH_INDEX(thisx) (((thisx)->params >> 8) & 0x3F) #define OBJBEAN_GET_SWITCH_FLAG_2(thisx, offset) ((((thisx)->params >> 7) + (offset)) & 0x7F) #define OBJBEAN_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) @@ -36,7 +36,7 @@ typedef struct ObjBean { /* 0x1C8 */ f32 unk_1C8; /* 0x1CC */ f32 unk_1CC; /* 0x1D0 */ f32 unk_1D0; - /* 0x1D4 */ Vec3s* unk_1D4; + /* 0x1D4 */ Vec3s* pathPoints; /* 0x1D8 */ s16 unk_1D8; /* 0x1DA */ s16 unk_1DA; /* 0x1DC */ s16 unk_1DC; diff --git a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c index db8df4f27c..1584634e6d 100644 --- a/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c +++ b/src/overlays/actors/ovl_Obj_Bigicicle/z_obj_bigicicle.c @@ -116,14 +116,14 @@ void ObjBigicicle_Init(Actor* thisx, PlayState* play) { sp30 = sp28 * (1.0f / 60.0f); Collider_InitAndSetCylinder(play, &this->collider1, &this->actor, &sCylinderInit1); - this->collider1.dim.radius = this->collider1.dim.radius * sp30; - this->collider1.dim.height = this->collider1.dim.height * sp30; - this->collider1.dim.yShift = this->collider1.dim.yShift * sp30; + this->collider1.dim.radius *= sp30; + this->collider1.dim.height *= sp30; + this->collider1.dim.yShift *= sp30; Collider_InitAndSetCylinder(play, &this->collider2, &this->actor, &sCylinderInit2); - this->collider2.dim.radius = this->collider2.dim.radius * sp30; - this->collider2.dim.height = this->collider2.dim.height * sp30; - this->collider2.dim.yShift = this->collider2.dim.yShift * sp30; + this->collider2.dim.radius *= sp30; + this->collider2.dim.height *= sp30; + this->collider2.dim.yShift *= sp30; if (Flags_GetSwitch(play, OBJBIGICLE_GET_SWITCH_FLAG(&this->actor))) { Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c index b5a358f886..c701706a86 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.c @@ -46,7 +46,7 @@ static InitChainEntry sInitChain[] = { */ s16 ObjBoat_GetNextPoint(ObjBoat* this, Vec3f* nextPoint) { s16 yaw; - Vec3s* curPoint = &this->points[(s32)this->curPointIndex]; + Vec3s* curPoint = &this->pathPoints[(s32)this->curPointIndex]; Math_Vec3s_ToVec3f(nextPoint, &curPoint[this->direction]); yaw = Math_Vec3f_Yaw(&this->dyna.actor.world.pos, nextPoint); @@ -68,10 +68,10 @@ void ObjBoat_Init(Actor* thisx, PlayState* play) { } else { path = &play->setupPathList[OBJBOAT_GET_PATH_INDEX(thisx)]; this->maxPointIndex = path->count - 1; - this->points = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); this->direction = 1; - this->dyna.actor.world.pos.x = this->points[this->curPointIndex].x; - this->dyna.actor.world.pos.z = this->points[this->curPointIndex].z; + this->dyna.actor.world.pos.x = this->pathPoints[this->curPointIndex].x; + this->dyna.actor.world.pos.z = this->pathPoints[this->curPointIndex].z; this->dyna.actor.shape.rot.y = ObjBoat_GetNextPoint(this, &sp24); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y; this->direction = -this->direction; @@ -164,10 +164,10 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) { } this->maxPointIndex = path->count; - this->points = Lib_SegmentedToVirtual(path->points); - Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, this->pathPoints); this->dyna.actor.speed = cue->rot.z * (45.0f / 0x2000); - this->points++; + this->pathPoints++; this->curPointIndex = 1; } @@ -177,10 +177,10 @@ void ObjBoat_UpdateCutscene(Actor* thisx, PlayState* play2) { Vec3f posTarget; f32 distRemaining; - Math_Vec3s_ToVec3f(&posTarget, this->points); + Math_Vec3s_ToVec3f(&posTarget, this->pathPoints); distRemaining = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &posTarget, this->dyna.actor.speed); if ((this->curPointIndex < this->maxPointIndex) && (distRemaining < this->dyna.actor.speed)) { - this->points++; + this->pathPoints++; this->curPointIndex++; } } diff --git a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h index 00cb936d71..2699d2d703 100644 --- a/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h +++ b/src/overlays/actors/ovl_Obj_Boat/z_obj_boat.h @@ -20,7 +20,7 @@ typedef struct ObjBoat { /* 0x160 */ s16 angle; // Angle used to set rotations /* 0x162 */ UNK_TYPE1 pad_162; /* 0x163 */ u8 maxPointIndex; // point at the other end from 0 - /* 0x164 */ Vec3s* points; + /* 0x164 */ Vec3s* pathPoints; } ObjBoat; // size = 0x168 #endif // Z_OBJ_BOAT_H diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index b632b0fa84..ab256b676d 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -223,9 +223,9 @@ void ObjChan_ChandelierAction(ObjChan* this, PlayState* play) { if (this->unk1D0 > 0.0f) { this->unk1D4 += 0x190; if (this->unk1D0 <= 400.0f) { - this->unk1D0 = this->unk1D0 * 0.99f; + this->unk1D0 *= 0.99f; } else { - this->unk1D0 = this->unk1D0 - 1.0f; + this->unk1D0 -= 1.0f; } if (this->unk1D0 < 0.0f) { this->unk1D4 = 0; diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c index fd6a88fb26..11814ebaf2 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.c @@ -41,7 +41,7 @@ static InitChainEntry sInitChain[] = { }; void ObjDanpeilift_UpdatePosition(ObjDanpeilift* this, s32 index) { - Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[index]); + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->pathPoints[index]); } void ObjDanpeilift_Init(Actor* thisx, PlayState* play) { @@ -72,7 +72,7 @@ void ObjDanpeilift_Init(Actor* thisx, PlayState* play) { this->curPoint = OBJDANPEILIFT_GET_STARTING_POINT(thisx); this->endPoint = path->count - 1; this->direction = 1; - this->points = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); ObjDanpeilift_UpdatePosition(this, this->curPoint); this->actionFunc = ObjDanpeilift_Move; } @@ -96,7 +96,7 @@ void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) { s32 isPosUpdated; Vec3s* endPoint; - Math_Vec3s_ToVec3f(&nextPoint, this->points + this->curPoint + this->direction); + Math_Vec3s_ToVec3f(&nextPoint, this->pathPoints + this->curPoint + this->direction); Math_Vec3f_Diff(&nextPoint, &thisx->world.pos, &thisx->velocity); speed = Math3D_Vec3fMagnitude(&thisx->velocity); if ((speed < (this->speed * 8.0f)) && (this->speed > 2.0f)) { @@ -125,10 +125,10 @@ void ObjDanpeilift_Move(ObjDanpeilift* this, PlayState* play) { this->waitTimer = 10; this->actionFunc = ObjDanpeilift_Wait; } else { - endPoint = &this->points[this->endPoint]; + endPoint = &this->pathPoints[this->endPoint]; this->curPoint = this->direction > 0 ? 0 : this->endPoint; - if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || - (this->points[0].z != endPoint->z)) { + if ((this->pathPoints[0].x != endPoint->x) || (this->pathPoints[0].y != endPoint->y) || + (this->pathPoints[0].z != endPoint->z)) { this->actionFunc = ObjDanpeilift_Teleport; DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); isPosUpdated = false; diff --git a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h index 8ad582dd48..986a85769b 100644 --- a/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h +++ b/src/overlays/actors/ovl_Obj_Danpeilift/z_obj_danpeilift.h @@ -22,7 +22,7 @@ typedef struct ObjDanpeilift { /* 0x164 */ s32 endPoint; /* 0x168 */ s32 curPoint; /* 0x16C */ s32 direction; - /* 0x170 */ Vec3s* points; + /* 0x170 */ Vec3s* pathPoints; /* 0x174 */ s32 isPlayerOnTop; /* 0x178 */ s32 isPlayerOnTopPrev; /* 0x17C */ f32 cycleSpeed; diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c index c019fedac0..14a30cd058 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.c @@ -77,7 +77,7 @@ static InitChainEntry sInitChain[] = { }; void func_80A66570(ObjDriftice* this, s32 arg1) { - Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->unk_16C[arg1]); + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->pathPoints[arg1]); } void func_80A665AC(s16* arg0, s16 arg1) { @@ -308,12 +308,12 @@ void ObjDriftice_Init(Actor* thisx, PlayState* play) { } else { this->dyna.actor.flags |= ACTOR_FLAG_10; - path = &play->setupPathList[OBJDRIFTICE_GET_1FC(&this->dyna.actor)]; + path = &play->setupPathList[OBJDRIFTICE_GET_PATH_INDEX(&this->dyna.actor)]; this->unk_164 = 0; this->unk_160 = path->count - 1; this->unk_168 = 1; - this->unk_16C = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); func_80A66570(this, this->unk_164); func_80A671CC(this); } @@ -345,7 +345,7 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) { s32 sp30; Actor* thisx = &this->dyna.actor; - Math_Vec3s_ToVec3f(&sp40, &(&this->unk_16C[this->unk_164])[this->unk_168]); + Math_Vec3s_ToVec3f(&sp40, &(&this->pathPoints[this->unk_164])[this->unk_168]); Math_Vec3f_Diff(&sp40, &this->dyna.actor.world.pos, &thisx->velocity); sp3C = Math3D_Vec3fMagnitude(&thisx->velocity); @@ -377,7 +377,7 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) { this->unk_168 = -this->unk_168; func_80A674A8(this); } else { - points = &this->unk_16C[this->unk_160]; + points = &this->pathPoints[this->unk_160]; if (this->unk_168 > 0) { this->unk_164 = 0; @@ -385,8 +385,8 @@ void func_80A671E0(ObjDriftice* this, PlayState* play) { this->unk_164 = this->unk_160; } - if ((this->unk_16C[0].x != points->x) || (this->unk_16C[0].y != points->y) || - (this->unk_16C[0].z != points->z)) { + if ((this->pathPoints[0].x != points->x) || (this->pathPoints[0].y != points->y) || + (this->pathPoints[0].z != points->z)) { func_80A6743C(this); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); sp30 = false; diff --git a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h index f77e95effd..dac0cc22de 100644 --- a/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h +++ b/src/overlays/actors/ovl_Obj_Driftice/z_obj_driftice.h @@ -8,7 +8,7 @@ struct ObjDriftice; typedef void (*ObjDrifticeActionFunc)(struct ObjDriftice*, PlayState*); #define OBJDRIFTICE_GET_3(thisx) ((thisx)->params & 3) -#define OBJDRIFTICE_GET_1FC(thisx) (((thisx)->params >> 2) & 0x7F) +#define OBJDRIFTICE_GET_PATH_INDEX(thisx) (((thisx)->params >> 2) & 0x7F) #define OBJDRIFTICE_GET_E00(thisx) (((thisx)->params >> 9) & 7) #define OBJDRIFTICE_GET_1000(thisx) (((thisx)->params >> 0xC) & 1) #define OBJDRIFTICE_GET_ROT(thisx) ((thisx)->home.rot.x & 3) @@ -49,7 +49,7 @@ typedef struct ObjDriftice { /* 0x160 */ s32 unk_160; /* 0x164 */ s32 unk_164; /* 0x168 */ s32 unk_168; - /* 0x16C */ Vec3s* unk_16C; + /* 0x16C */ Vec3s* pathPoints; /* 0x170 */ ObjDrifticeStruct unk_170; /* 0x23C */ f32 unk_23C; /* 0x240 */ f32 unk_240; diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c index 9feb70c1df..efe0c5fe3a 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.c @@ -71,7 +71,7 @@ void ObjLupygamelift_Init(Actor* thisx, PlayState* play) { if (this->pointIndex >= this->count) { this->pointIndex = 0; } - this->points = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); Actor_SpawnAsChild(&play->actorCtx, &this->dyna.actor, play, ACTOR_OBJ_ETCETERA, this->dyna.actor.world.pos.x, this->dyna.actor.world.pos.y, this->dyna.actor.world.pos.z, this->dyna.actor.shape.rot.x, this->dyna.actor.shape.rot.y, this->dyna.actor.shape.rot.z, 0); @@ -138,9 +138,9 @@ void func_80AF0530(ObjLupygamelift* this, PlayState* play) { f32 distRemaining; Vec3f target; - target.x = this->points[this->pointIndex].x; - target.y = this->points[this->pointIndex].y; - target.z = this->points[this->pointIndex].z; + target.x = this->pathPoints[this->pointIndex].x; + target.y = this->pathPoints[this->pointIndex].y; + target.z = this->pathPoints[this->pointIndex].z; distRemaining = Math_Vec3f_StepTo(&this->dyna.actor.world.pos, &target, this->dyna.actor.speed); if (distRemaining > 30.0f) { Math_SmoothStepToF(&this->dyna.actor.speed, this->targetSpeedXZ, 0.5f, 5.0f, 0.1f); diff --git a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h index a1928c473d..19d0e617dc 100644 --- a/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h +++ b/src/overlays/actors/ovl_Obj_Lupygamelift/z_obj_lupygamelift.h @@ -17,7 +17,7 @@ typedef struct ObjLupygamelift { /* 0x160 */ f32 targetSpeedXZ; /* 0x164 */ s32 count; /* 0x168 */ s32 pointIndex; - /* 0x16C */ Vec3s* points; + /* 0x16C */ Vec3s* pathPoints; /* 0x170 */ s16 timer; } ObjLupygamelift; /* size = 0x174 */ diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c index 6072e76777..6ca02f903c 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.c @@ -50,7 +50,7 @@ static InitChainEntry sInitChain[] = { }; void func_80AC94C0(ObjOcarinalift* this, s32 arg1) { - Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->unk170[arg1]); + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->pathPoints[arg1]); } void ObjOcarinalift_Init(Actor* thisx, PlayState* play) { @@ -68,11 +68,11 @@ void ObjOcarinalift_Init(Actor* thisx, PlayState* play) { if (this->unk160 < 0.01f) { func_80AC9680(this); } else { - path = &play->setupPathList[OBJOCARINALIFT_GET_7F(&this->dyna.actor)]; + path = &play->setupPathList[OBJOCARINALIFT_GET_PATH_INDEX(&this->dyna.actor)]; this->unk168 = OBJOCARINALIFT_GET_1F(&this->dyna.actor); this->unk164 = path->count - 1; this->unk16C = 1; - this->unk170 = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); func_80AC94C0(this, this->unk168); if ((OBJOCARINALIFT_GET_C(&this->dyna.actor) != OBJOCARINALIFT_PARAM_1) && Flags_GetSwitch(play, OBJOCARINALIFT_GET_SWITCH_FLAG(&this->dyna.actor))) { @@ -113,7 +113,7 @@ void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { Vec3s* temp_v1_2; Actor_PlaySfx_Flagged(thisx, NA_SE_EV_PLATE_LIFT_LEVEL - SFX_FLAG); - Math_Vec3s_ToVec3f(&sp48, this->unk170 + this->unk168 + this->unk16C); + Math_Vec3s_ToVec3f(&sp48, this->pathPoints + this->unk168 + this->unk16C); Math_Vec3f_Diff(&sp48, &thisx->world.pos, &thisx->velocity); magnitude = Math3D_Vec3fMagnitude(&thisx->velocity); @@ -142,7 +142,7 @@ void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { this->timer = 10; func_80AC9A68(this); } else { - temp_v1_2 = this->unk170 + this->unk164; + temp_v1_2 = &this->pathPoints[this->unk164]; if (this->unk16C > 0) { this->unk168 = 0; @@ -150,8 +150,8 @@ void func_80AC96D0(ObjOcarinalift* this, PlayState* play) { this->unk168 = this->unk164; } - if (((this->unk170->x != temp_v1_2->x) || (this->unk170->y != temp_v1_2->y)) || - (this->unk170->z != temp_v1_2->z)) { + if (((this->pathPoints[0].x != temp_v1_2->x) || (this->pathPoints[0].y != temp_v1_2->y)) || + (this->pathPoints[0].z != temp_v1_2->z)) { func_80AC99C0(this); DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); sp34 = false; diff --git a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h index abb1e440b3..30821bc1e3 100644 --- a/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h +++ b/src/overlays/actors/ovl_Obj_Ocarinalift/z_obj_ocarinalift.h @@ -4,7 +4,7 @@ #include "global.h" #define OBJOCARINALIFT_GET_C(thisx) (((thisx)->params >> 0xC) & 3) -#define OBJOCARINALIFT_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJOCARINALIFT_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) #define OBJOCARINALIFT_GET_1F(thisx) (((thisx)->params >> 7) & 0x1F) #define OBJOCARINALIFT_GET_SWITCH_FLAG(thisx) ((thisx)->home.rot.x & 0x7F) @@ -19,7 +19,7 @@ typedef struct ObjOcarinalift { /* 0x164 */ s32 unk164; /* 0x168 */ s32 unk168; /* 0x16C */ s32 unk16C; - /* 0x170 */ Vec3s* unk170; + /* 0x170 */ Vec3s* pathPoints; /* 0x174 */ s16 timer; /* 0x176 */ s16 cutsceneTimer; } ObjOcarinalift; // size = 0x178 diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c index 799ad6b1de..91e5370e8d 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.c @@ -50,7 +50,7 @@ static InitChainEntry sInitChain[] = { static CollisionHeader* sColHeaders[] = { &object_raillift_Colheader_004FF8, &object_raillift_Colheader_0048D0 }; void ObjRaillift_UpdatePosition(ObjRaillift* this, s32 index) { - Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->points[index]); + Math_Vec3s_ToVec3f(&this->dyna.actor.world.pos, &this->pathPoints[index]); } void ObjRaillift_Init(Actor* thisx, PlayState* play) { @@ -90,7 +90,7 @@ void ObjRaillift_Init(Actor* thisx, PlayState* play) { this->curPoint = OBJRAILLIFT_GET_STARTING_POINT(thisx); this->endPoint = path->count - 1; this->direction = 1; - this->points = Lib_SegmentedToVirtual(path->points); + this->pathPoints = Lib_SegmentedToVirtual(path->points); ObjRaillift_UpdatePosition(this, this->curPoint); if (OBJRAILLIFT_HAS_FLAG(thisx) && !Flags_GetSwitch(play, OBJRAILLIFT_GET_SWITCH_FLAG(thisx))) { this->actionFunc = ObjRaillift_Idle; @@ -130,7 +130,7 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { } } - Math_Vec3s_ToVec3f(&nextPoint, this->points + this->curPoint + this->direction); + Math_Vec3s_ToVec3f(&nextPoint, this->pathPoints + this->curPoint + this->direction); Math_Vec3f_Diff(&nextPoint, &thisx->world.pos, &thisx->velocity); speed = Math3D_Vec3fMagnitude(&thisx->velocity); if ((speed < (this->speed * 8.0f)) && (this->speed > 2.0f)) { @@ -159,10 +159,10 @@ void ObjRaillift_Move(ObjRaillift* this, PlayState* play) { this->waitTimer = 10; this->actionFunc = ObjRaillift_Wait; } else { - endPoint = &this->points[this->endPoint]; + endPoint = &this->pathPoints[this->endPoint]; this->curPoint = this->direction > 0 ? 0 : this->endPoint; - if ((this->points[0].x != endPoint->x) || (this->points[0].y != endPoint->y) || - (this->points[0].z != endPoint->z)) { + if ((this->pathPoints[0].x != endPoint->x) || (this->pathPoints[0].y != endPoint->y) || + (this->pathPoints[0].z != endPoint->z)) { this->actionFunc = ObjRaillift_Teleport; DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); isPosUpdated = false; diff --git a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h index 64aa011305..748c1147fd 100644 --- a/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h +++ b/src/overlays/actors/ovl_Obj_Raillift/z_obj_raillift.h @@ -28,7 +28,7 @@ typedef struct ObjRaillift { /* 0x164 */ s32 endPoint; /* 0x168 */ s32 curPoint; /* 0x16C */ s32 direction; // +1 for forward, -1 for backward - /* 0x170 */ Vec3s* points; + /* 0x170 */ Vec3s* pathPoints; /* 0x174 */ s32 isPlayerOnTop; /* 0x178 */ s32 isPlayerOnTopPrev; /* 0x17C */ f32 cycleSpeed; diff --git a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c index fe44795c79..264fd76d3a 100644 --- a/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c +++ b/src/overlays/actors/ovl_Obj_Snowball2/z_obj_snowball2.c @@ -531,7 +531,7 @@ void func_80B3A498(ObjSnowball2* this) { this->actor.flags |= ACTOR_FLAG_10; this->actor.home.pos.y = this->actor.world.pos.y + this->actor.depthInWater; this->actor.home.pos.z = this->actor.world.pos.z; - this->actor.world.pos.y = this->actor.world.pos.y + (this->actor.shape.yOffset * this->actor.scale.y); + this->actor.world.pos.y += this->actor.shape.yOffset * this->actor.scale.y; this->actor.shape.yOffset = 0.0f; this->actor.speed = 0.0f; this->actionFunc = func_80B3A500; diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c index 220d6ededd..7bfcfad605 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.c @@ -475,7 +475,7 @@ void ObjSpinyroll_Init(Actor* thisx, PlayState* play) { Collider_InitTris(play, &this->collider); Collider_SetTris(play, &this->collider, &this->dyna.actor, &sTrisInit, this->colliderElements); - if (OBJSPINYROLL_GET_7F(&this->dyna.actor) == OBJSPINYROLL_GET_7F_7F) { + if (OBJSPINYROLL_GET_PATH_INDEX(&this->dyna.actor) == OBJSPINYROLL_PATH_INDEX_NONE) { func_80A1E9C4(this); return; } @@ -484,7 +484,7 @@ void ObjSpinyroll_Init(Actor* thisx, PlayState* play) { func_80A1DFA0(this); this->unk_4A4 = D_80A1F1C4[OBJSPINYROLL_GET_380(thisx)]; - path = &play->setupPathList[OBJSPINYROLL_GET_7F(&this->dyna.actor)]; + path = &play->setupPathList[OBJSPINYROLL_GET_PATH_INDEX(&this->dyna.actor)]; points = Lib_SegmentedToVirtual(path->points); sp34 = &points[0]; diff --git a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h index 36d8e644a1..de3f94678b 100644 --- a/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h +++ b/src/overlays/actors/ovl_Obj_Spinyroll/z_obj_spinyroll.h @@ -8,12 +8,12 @@ struct ObjSpinyroll; typedef void (*ObjSpinyrollActionFunc)(struct ObjSpinyroll*, PlayState*); typedef s32 (*ObjSpinyrollColFunc)(CollisionContext*, f32*, CollisionPoly**, s32*, Vec3f*, struct ObjSpinyroll*); -#define OBJSPINYROLL_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJSPINYROLL_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) #define OBJSPINYROLL_GET_380(thisx) (((thisx)->params >> 7) & 7) #define OBJSPINYROLL_GET_1C00(thisx) (((thisx)->params >> 0xA) & 7) #define OBJSPINYROLL_GET_C000(thisx) (((thisx)->params >> 0xE) & 3) -#define OBJSPINYROLL_GET_7F_7F 0x7F +#define OBJSPINYROLL_PATH_INDEX_NONE 0x7F #define OBJSPINYROLL_GET_C000_0 0 #define OBJSPINYROLL_GET_C000_1 1 diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index bebbd6e6a6..5acb3458aa 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -69,7 +69,7 @@ static TexturePtr sEyeSwitchTextures[][4] = { { gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, gEyeSwitchSilverClosedTex, gEyeSwitchSilverClosedTex }, }; -static s32 sIsSegmentTableInit = false; +static s32 sTexturesDesegmented = false; ActorInit Obj_Switch_InitVars = { /**/ ACTOR_OBJ_SWITCH, @@ -397,11 +397,11 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { this->dyna.actor.flags |= 0x80; } if (type == OBJSWITCH_TYPE_EYE) { - if (!sIsSegmentTableInit) { + if (!sTexturesDesegmented) { s32 i; s32 j; - sIsSegmentTableInit = true; + sTexturesDesegmented = true; for (i = 0; i < ARRAY_COUNT(sEyeSwitchTextures); i++) { for (j = 0; j < ARRAY_COUNT(*sEyeSwitchTextures); j++) { diff --git a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c index f248f5777f..e5a7bde0f0 100644 --- a/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c +++ b/src/overlays/actors/ovl_Obj_Toge/z_obj_toge.c @@ -119,7 +119,7 @@ void ObjToge_Init(Actor* thisx, PlayState* play) { s32 pad; ObjToge* this = THIS; Path* path; - Vec3s* sp40; + Vec3s* points; s16 sp3E; s32 sp38 = OBJTOGE_GET_4000(thisx); @@ -142,9 +142,9 @@ void ObjToge_Init(Actor* thisx, PlayState* play) { return; } - sp40 = Lib_SegmentedToVirtual(path->points); - Math_Vec3s_ToVec3f(&this->unk_198[0], &sp40[0]); - Math_Vec3s_ToVec3f(&this->unk_198[1], &sp40[1]); + points = Lib_SegmentedToVirtual(path->points); + Math_Vec3s_ToVec3f(&this->unk_198[0], &points[0]); + Math_Vec3s_ToVec3f(&this->unk_198[1], &points[1]); Math_Vec3f_Copy(&thisx->world.pos, &this->unk_198[0]); thisx->world.rot.y = Math_Vec3f_Yaw(&this->unk_198[0], &this->unk_198[1]); this->unk_194 = 0; diff --git a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c index 3ffb3b1586..4137d5f057 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -352,7 +352,7 @@ s32 func_80B781DC(ObjUm* this, EnHorse* bandit1, EnHorse* bandit2, PlayState* pl // ObjUm_Bandit_UpdatePosition? s32 func_80B783E0(ObjUm* this, PlayState* play, s32 banditIndex, EnHorse* bandit) { - Path* sp6C = &play->setupPathList[this->pathIndex]; + Path* path = &play->setupPathList[this->pathIndex]; s32 sp68; Vec3s* sp64; f32 phi_f12; @@ -365,8 +365,8 @@ s32 func_80B783E0(ObjUm* this, PlayState* play, s32 banditIndex, EnHorse* bandit f32 sp3C; f32 phi_f14; - sp68 = sp6C->count; - sp64 = Lib_SegmentedToVirtual(sp6C->points); + sp68 = path->count; + sp64 = Lib_SegmentedToVirtual(path->points); if (sp68 == 0) { return 0; @@ -389,14 +389,12 @@ s32 func_80B783E0(ObjUm* this, PlayState* play, s32 banditIndex, EnHorse* bandit if (bandit->curRaceWaypoint == 0) { phi_f12 = sp64[1].x - sp64[0].x; phi_f14 = sp64[1].z - sp64[0].z; + } else if ((bandit->curRaceWaypoint + 1) == path->count) { + phi_f12 = sp64[path->count - 1].x - sp64[path->count - 2].x; + phi_f14 = sp64[path->count - 1].z - sp64[path->count - 2].z; } else { - if ((bandit->curRaceWaypoint + 1) == sp6C->count) { - phi_f12 = sp64[sp6C->count - 1].x - sp64[sp6C->count - 2].x; - phi_f14 = sp64[sp6C->count - 1].z - sp64[sp6C->count - 2].z; - } else { - phi_f12 = sp64[bandit->curRaceWaypoint + 1].x - sp64[bandit->curRaceWaypoint - 1].x; - phi_f14 = sp64[bandit->curRaceWaypoint + 1].z - sp64[bandit->curRaceWaypoint - 1].z; - } + phi_f12 = sp64[bandit->curRaceWaypoint + 1].x - sp64[bandit->curRaceWaypoint - 1].x; + phi_f14 = sp64[bandit->curRaceWaypoint + 1].z - sp64[bandit->curRaceWaypoint - 1].z; } temp_a1 = Math_Atan2S(phi_f12, phi_f14); @@ -433,7 +431,7 @@ s32 func_80B783E0(ObjUm* this, PlayState* play, s32 banditIndex, EnHorse* bandit phi_v1_2 = -0x190; } - bandit->actor.shape.rot.y = bandit->actor.shape.rot.y + phi_v1_2; + bandit->actor.shape.rot.y += phi_v1_2; return 0; } @@ -1105,17 +1103,17 @@ ObjUmPathState ObjUm_UpdatePath(ObjUm* this, PlayState* play) { if (fabsf(yawDiff) < 100.0f) { this->dyna.actor.shape.rot.y = this->donkey->actor.shape.rot.y; } else if (yawDiff > 0) { - this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y + 0x64; + this->dyna.actor.shape.rot.y += 0x64; yawDiff = 0x64; } else if (yawDiff < 0) { - this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y - 0x64; + this->dyna.actor.shape.rot.y -= 0x64; yawDiff = -0x64; } } else if (yawDiff > 0) { - this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y + 0x190; + this->dyna.actor.shape.rot.y += 0x190; yawDiff = 0x190; } else if (yawDiff < 0) { - this->dyna.actor.shape.rot.y = this->dyna.actor.shape.rot.y - 0x190; + this->dyna.actor.shape.rot.y -= 0x190; yawDiff = -0x190; } diff --git a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c index d74073d65f..d379070476 100644 --- a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c +++ b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.c @@ -290,7 +290,7 @@ void ObjVspinyroll_Init(Actor* thisx, PlayState* play) { this->collider.dim.height = 240; } - if (OBJVSPINYROLL_GET_7F(&this->dyna.actor) == OBJVSPINYROLL_7F_7F) { + if (OBJVSPINYROLL_GET_PATH_INDEX(&this->dyna.actor) == OBJVSPINYROLL_PATH_INDEX_NONE) { func_80A3CEC4(this); return; } @@ -299,7 +299,7 @@ void ObjVspinyroll_Init(Actor* thisx, PlayState* play) { func_80A3C7E8(this); this->unk_394 = D_80A3D458[OBJVSPINYROLL_GET_380(thisx)]; - path = &play->setupPathList[OBJVSPINYROLL_GET_7F(&this->dyna.actor)]; + path = &play->setupPathList[OBJVSPINYROLL_GET_PATH_INDEX(&this->dyna.actor)]; points = Lib_SegmentedToVirtual(path->points); point1 = &points[0]; point2 = &points[1]; diff --git a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h index 09a91b4374..ba75f048d6 100644 --- a/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h +++ b/src/overlays/actors/ovl_Obj_Vspinyroll/z_obj_vspinyroll.h @@ -7,12 +7,12 @@ struct ObjVspinyroll; typedef void (*ObjVspinyrollActionFunc)(struct ObjVspinyroll*, PlayState*); -#define OBJVSPINYROLL_GET_7F(thisx) ((thisx)->params & 0x7F) +#define OBJVSPINYROLL_GET_PATH_INDEX(thisx) ((thisx)->params & 0x7F) #define OBJVSPINYROLL_GET_380(thisx) (((thisx)->params >> 7) & 7) #define OBJVSPINYROLL_GET_1C00(thisx) (((thisx)->params >> 0xA) & 7) #define OBJVSPINYROLL_GET_4000(thisx) (((thisx)->params >> 0xE) & 1) -#define OBJVSPINYROLL_7F_7F 0x7F +#define OBJVSPINYROLL_PATH_INDEX_NONE 0x7F #define OBJVSPINYROLL_4000_1 1 typedef struct { diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index 7414effc3b..812c28b65d 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -140,7 +140,7 @@ void OceffSpot_Update(Actor* thisx, PlayState* play) { this->actor.scale.x = (scale * 0.42f) * temp; this->actor.world.pos = player->actor.world.pos; - this->actor.world.pos.y = this->actor.world.pos.y + 5.0f; + this->actor.world.pos.y += 5.0f; temp = (2.0f - this->unk16C) * this->unk16C; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index a4768d6ec8..c00bf45a43 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -6742,7 +6742,7 @@ s32 func_80836F10(PlayState* play, Player* this) { // Tiny fall, won't damage player if (fallDistance > 200) { - fallDistance = fallDistance * 2; + fallDistance *= 2; fallDistance = CLAMP_MAX(fallDistance, 255); Player_RequestRumble(play, this, fallDistance, fallDistance * 0.1f, fallDistance, SQ(0)); @@ -7913,14 +7913,14 @@ void func_80839CD8(Player* this, PlayState* play) { if (var_fv0 < 0.0f) { var_fv0 = -var_fv0 * 1.375f; } - var_fv0 = var_fv0 / 11.0f; + var_fv0 /= 11.0f; } else { anim = D_8085BE84[PLAYER_ANIMGROUP_walk_endR][this->modelAnimType]; var_fv0 = 26.0f - var_fv0; if (var_fv0 < 0.0f) { var_fv0 = -var_fv0 * 2; } - var_fv0 = var_fv0 / 12.0f; + var_fv0 /= 12.0f; } PlayerAnimation_Change(play, &this->skelAnime, anim, PLAYER_ANIM_NORMAL_SPEED, 0.0f, Animation_GetLastFrame(anim), @@ -12325,7 +12325,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->cylinder.dim.yShift = 0; this->cylinder.dim.height = this->shieldCylinder.dim.height; } else { - this->cylinder.dim.height = this->cylinder.dim.height * 0.8f; + this->cylinder.dim.height *= 0.8f; } } @@ -12893,7 +12893,7 @@ void func_808477D0(PlayState* play, Player* this, Input* input, f32 arg3) { var_fv0 = 0.5f; } - var_fv0 = var_fv0 * arg3; + var_fv0 *= arg3; var_fv0 = CLAMP(var_fv0, 1.0f, 2.5f); this->skelAnime.playSpeed = var_fv0; @@ -18249,7 +18249,7 @@ void Player_Action_92(Player* this, PlayState* play) { var_fv0 = this->actor.world.pos.y - this->actor.floorHeight; var_fv0 = CLAMP_MAX(var_fv0, 20.0f); - this->actor.world.pos.y = this->actor.world.pos.y - var_fv0; + this->actor.world.pos.y -= var_fv0; this->actor.shape.rot.x = 0; this->linearVelocity = 1.0f; this->actor.velocity.y = 0.0f; @@ -18564,7 +18564,7 @@ void Player_Action_94(Player* this, PlayState* play) { temp_a0 = this->actor.shape.rot.y - var_a1; if (ABS_ALT(temp_a0) > 0x4000) { this->linearVelocity = -this->linearVelocity; - var_a1 = var_a1 + 0x8000; + var_a1 += 0x8000; } this->currentYaw = var_a1; } diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index 139568f3b5..bc3020ed94 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -36,7 +36,7 @@ EffectSsInit Effect_Ss_Lightning_InitVars = { EffectSsLightning_Init, }; -static s32 sIsDesegmented = false; +static s32 sTexturesDesegmented = false; u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* initParamsx) { EffectSsLightningInitParams* initParams = PARAMS; @@ -60,11 +60,11 @@ u32 EffectSsLightning_Init(PlayState* play, u32 index, EffectSs* this, void* ini this->rYaw = initParams->yaw; this->rLifespan = initParams->life; - if (!sIsDesegmented) { + if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(sLightningTextures); i++) { sLightningTextures[i] = Lib_SegmentedToVirtual(sLightningTextures[i]); } - sIsDesegmented = true; + sTexturesDesegmented = true; } return 1; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index bf421506cb..d956be2d4d 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -12191,7 +12191,7 @@ 0x80AD4608:("func_80AD4608",), 0x80AD469C:("func_80AD469C",), 0x80AD46F8:("func_80AD46F8",), - 0x80AD475C:("func_80AD475C",), + 0x80AD475C:("EnTrt2_HasReachedPoint",), 0x80AD48F8:("func_80AD48F8",), 0x80AD49B8:("func_80AD49B8",), 0x80AD4A78:("func_80AD4A78",), @@ -12321,7 +12321,7 @@ 0x80ADCA64:("func_80ADCA64",), 0x80ADCC04:("func_80ADCC04",), 0x80ADCD3C:("func_80ADCD3C",), - 0x80ADCE4C:("func_80ADCE4C",), + 0x80ADCE4C:("EnSellnuts_HasReachedPoint",), 0x80ADCFE8:("func_80ADCFE8",), 0x80ADD0A8:("EnSellnuts_Init",), 0x80ADD3D4:("EnSellnuts_Destroy",), @@ -13595,7 +13595,7 @@ 0x80B3B294:("func_80B3B294",), 0x80B3B4B0:("func_80B3B4B0",), 0x80B3B5D4:("func_80B3B5D4",), - 0x80B3B648:("func_80B3B648",), + 0x80B3B648:("EnGg2_HasReachedPoint",), 0x80B3B7E4:("func_80B3B7E4",), 0x80B3B8A4:("func_80B3B8A4",), 0x80B3B958:("EnGg2_Init",), @@ -13975,7 +13975,7 @@ 0x80B50954:("func_80B50954",), 0x80B509A8:("func_80B509A8",), 0x80B50B38:("func_80B50B38",), - 0x80B50C78:("func_80B50C78",), + 0x80B50C78:("EnGk_HasReachedPoint",), 0x80B50E14:("func_80B50E14",), 0x80B50ED4:("func_80B50ED4",), 0x80B5100C:("func_80B5100C",), @@ -14410,7 +14410,7 @@ 0x80B73A90:("EnJg_GetShrineGoronToFocusOn",), 0x80B73AE4:("EnJg_UpdateCollision",), 0x80B73B98:("EnJg_GetWalkingYRotation",), - 0x80B73C58:("EnJg_ReachedPoint",), + 0x80B73C58:("EnJg_HasReachedPoint",), 0x80B73DF4:("EnJg_GetCsIdForTeachingLullabyIntro",), 0x80B73E3C:("EnJg_SetupGoronShrineCheer",), 0x80B73F1C:("EnJg_SetupTalk",), @@ -14445,7 +14445,7 @@ 0x80B763C4:("func_80B763C4",), 0x80B76440:("func_80B76440",), 0x80B76540:("func_80B76540",), - 0x80B76600:("func_80B76600",), + 0x80B76600:("EnTruMt_HasReachedPoint",), 0x80B7679C:("func_80B7679C",), 0x80B768F0:("func_80B768F0",), 0x80B76924:("func_80B76924",), @@ -15212,8 +15212,8 @@ 0x80BAB490:("EnSuttari_GetPaths",), 0x80BAB4F0:("func_80BAB4F0",), 0x80BAB698:("EnSuttari_GetDistSqAndOrient",), - 0x80BAB758:("func_80BAB758",), - 0x80BAB8F4:("func_80BAB8F4",), + 0x80BAB758:("EnSuttari_HasReachedPointForward",), + 0x80BAB8F4:("EnSuttari_HasReachedPointReverse",), 0x80BABA90:("func_80BABA90",), 0x80BABB90:("func_80BABB90",), 0x80BABC48:("func_80BABC48",), @@ -15636,7 +15636,7 @@ 0x80BCBF0C:("func_80BCBF0C",), 0x80BCBFFC:("func_80BCBFFC",), 0x80BCC288:("func_80BCC288",), - 0x80BCC2AC:("func_80BCC2AC",), + 0x80BCC2AC:("EnScopenuts_HasReachedPoint",), 0x80BCC448:("func_80BCC448",), 0x80BCC508:("EnScopenuts_Init",), 0x80BCC77C:("EnScopenuts_Destroy",), @@ -15649,7 +15649,7 @@ 0x80BCD09C:("func_80BCD09C",), 0x80BCD1AC:("func_80BCD1AC",), 0x80BCD2BC:("func_80BCD2BC",), - 0x80BCD334:("func_80BCD334",), + 0x80BCD334:("EnScopecrow_HasReachedPoint",), 0x80BCD4D0:("func_80BCD4D0",), 0x80BCD590:("func_80BCD590",), 0x80BCD640:("func_80BCD640",), @@ -16233,7 +16233,7 @@ 0x80BECA80:("BgIkanaDharma_Draw",), 0x80BECBE0:("func_80BECBE0",), 0x80BECC7C:("func_80BECC7C",), - 0x80BECD10:("func_80BECD10",), + 0x80BECD10:("EnAkindonuts_HasReachedPoint",), 0x80BECEAC:("func_80BECEAC",), 0x80BECF6C:("func_80BECF6C",), 0x80BECFBC:("func_80BECFBC",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 2acc10f21e..5f75a9f206 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -5957,7 +5957,7 @@ 0x80896B40:("D_80896B40","UNK_TYPE1","",0x1), 0x80896B44:("D_80896B44","UNK_TYPE1","",0x1), 0x80896B50:("D_80896B50","UNK_TYPE1","",0x1), - 0x80896B60:("D_80896B60","UNK_TYPE4","",0x4), + 0x80896B60:("sTexturesDesegmented","UNK_TYPE4","",0x4), 0x80896B64:("D_80896B64","UNK_TYPE1","",0x1), 0x80896B70:("D_80896B70","UNK_TYPE1","",0x1), 0x80896B8C:("D_80896B8C","UNK_TYPE1","",0x1), @@ -6048,7 +6048,7 @@ 0x8089E34C:("sCsId","UNK_TYPE2","",0x2), 0x8089E350:("D_8089E350","UNK_TYPE4","",0x4), 0x8089E354:("D_8089E354","UNK_TYPE1","",0x1), - 0x8089E364:("D_8089E364","UNK_TYPE4","",0x4), + 0x8089E364:("sTexturesDesegmented","UNK_TYPE4","",0x4), 0x8089E368:("D_8089E368","EffectBlureInit2","",0x24), 0x8089E38C:("D_8089E38C","UNK_TYPE1","",0x1), 0x8089E398:("D_8089E398","UNK_TYPE1","",0x1), @@ -6604,7 +6604,7 @@ 0x808CD584:("D_808CD584","UNK_TYPE1","",0x1), 0x808CD58C:("D_808CD58C","UNK_TYPE4","",0x4), 0x808CD5AC:("D_808CD5AC","UNK_TYPE1","",0x1), - 0x808CD5B8:("D_808CD5B8","UNK_TYPE4","",0x4), + 0x808CD5B8:("sTexturesDesegmented","UNK_TYPE4","",0x4), 0x808CD5BC:("D_808CD5BC","UNK_TYPE1","",0x1), 0x808CD5C0:("D_808CD5C0","UNK_TYPE1","",0x1), 0x808CD5D0:("D_808CD5D0","f32","",0x4), @@ -9096,7 +9096,7 @@ 0x809942B0:("D_809942B0","UNK_TYPE4","",0x4), 0x809942C0:("D_809942C0","UNK_PTR","",0x4), 0x809942D0:("D_809942D0","UNK_TYPE1","",0x1), - 0x809942D8:("D_809942D8","UNK_TYPE4","",0x4), + 0x809942D8:("sTexturesDesegmented","UNK_TYPE4","",0x4), 0x809942DC:("D_809942DC","UNK_TYPE1","",0x1), 0x809942E8:("D_809942E8","UNK_TYPE1","",0x1), 0x809942EC:("D_809942EC","UNK_TYPE1","",0x1), @@ -10890,7 +10890,7 @@ 0x80A29734:("D_80A29734","UNK_TYPE1","",0x1), 0x80A29754:("D_80A29754","UNK_TYPE4","",0x4), 0x80A29764:("D_80A29764","UNK_TYPE1","",0x1), - 0x80A29778:("D_80A29778","UNK_TYPE4","",0x4), + 0x80A29778:("sTexturesDesegmented","UNK_TYPE4","",0x4), 0x80A2977C:("D_80A2977C","UNK_TYPE1","",0x1), 0x80A29788:("D_80A29788","UNK_TYPE1","",0x1), 0x80A2978C:("D_80A2978C","UNK_TYPE1","",0x1), @@ -15099,7 +15099,7 @@ 0x80B95A14:("jtbl_80B95A14","UNK_PTR","",0x4), 0x80B95A50:("D_80B95A50","f32","",0x4), 0x80B95A54:("D_80B95A54","f32","",0x4), - 0x80B95E10:("D_80B95E10","UNK_TYPE1","",0x1), + 0x80B95E10:("sTexturesDesegmented","UNK_TYPE1","",0x1), 0x80B96140:("Obj_Rotlift_InitVars","UNK_TYPE1","",0x1), 0x80B96160:("D_80B96160","UNK_PTR","",0x4), 0x80B96178:("D_80B96178","UNK_TYPE1","",0x1),