From 4780abbfd8e141b41807609aae80ae98f3090d1e Mon Sep 17 00:00:00 2001 From: Derek Hensley Date: Sun, 16 Feb 2025 09:30:27 -0800 Subject: [PATCH] Misc FAKE fixes (#1783) * CutsceneCamera_UpdateSplines fake match * CutsceneCamera_Init -1 splineIndex * Eye Point comment * func_80B781DC better fake * func_80B32F04 * ObjSwitch_Update * ObjSwitch_InitTrisCollider * ObjAqua_Init * EnTrt_ItemGiven * func_80C10E98 partly * EnTest7_WarpCsWarp this to 1 * EnTest6_InvertedSoTCutscene better fake * EnTest6_DrawAmmoDropRupee * EnPoSisters_MatchPlayerY * func_8095B76C * EnMinifrog_Init * func_80A5C0B8 * EnKnight_UpdateEffects * EnKnight_FlyingHeadAttack * EnKakasi_Init * EnInvadepoh_ModelInfo_GetNextFaceAnim * BgAstrBombwall_InitCollider like func_809CE068 * Player_UpdateInterface * Player_CsAction_TranslateReverse * DynaPoly_AddBgActorToLookup better fake * CutsceneManager_FindEntranceCsId * func_800AE930 better fake * Math3D_CylVsLineSeg better fake * MapDisp_InitBossRoomStorey * Play_Init * EnTimeTag_Diary_Wait better fake * Remove fake label from Player_SwordFromIA * Player_PostLimbDrawGameplay partly * EffectBlure_AddVertex prev temp * Player_PostLimbDrawGameplay attempt 2 * AudioMgr_StopAllSfxExceptSystem * Camera_Normal0 * Camera_Jump2 * Camera_Normal3 * PR review --- include/z64player.h | 2 +- src/code/audio_stop_all_sfx.c | 14 +- src/code/cutscene_camera.c | 10 +- src/code/sys_math3d.c | 6 +- src/code/z_actor.c | 2 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 199 ++++++++---------- src/code/z_eff_blure.c | 7 +- src/code/z_eff_tire_mark.c | 7 +- src/code/z_eventmgr.c | 14 +- src/code/z_map_disp.c | 17 +- src/code/z_play.c | 10 +- src/code/z_player_lib.c | 21 +- .../ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c | 4 +- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 4 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 6 +- .../actors/ovl_En_Knight/z_en_knight.c | 28 +-- src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c | 8 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 31 ++- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 42 ++-- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 4 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 10 +- src/overlays/actors/ovl_En_Test7/z_en_test7.c | 2 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 7 +- .../actors/ovl_En_Time_Tag/z_en_time_tag.c | 6 +- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 5 +- .../actors/ovl_En_Zoraegg/z_en_zoraegg.c | 12 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 13 +- .../actors/ovl_Obj_Switch/z_obj_switch.c | 21 +- src/overlays/actors/ovl_Obj_Um/z_obj_um.c | 5 +- .../actors/ovl_player_actor/z_player.c | 34 +-- tools/disasm/functions.txt | 2 +- 32 files changed, 245 insertions(+), 310 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index 1d5244d286..dcc89903e7 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -1371,7 +1371,7 @@ s32 Player_IsFacingActor(Actor* actor, s16 maxAngleDiff, struct PlayState* play) PlayerItemAction Player_GetExchangeItemAction(struct PlayState* play); -void func_800B8D10(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); +void func_800B8D10(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, s32 arg5, u32 arg6); void func_800B8D50(struct PlayState* play, Actor* actor, f32 arg2, s16 yaw, f32 arg4, u32 arg5); void func_800B8D98(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); void func_800B8DD4(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); diff --git a/src/code/audio_stop_all_sfx.c b/src/code/audio_stop_all_sfx.c index 94b55d4df7..f4f6942f26 100644 --- a/src/code/audio_stop_all_sfx.c +++ b/src/code/audio_stop_all_sfx.c @@ -5,11 +5,17 @@ const u8 sSfxBankIds[] = { }; void AudioMgr_StopAllSfxExceptSystem(void) { - volatile const u8* bankIdPtr; + const u8* bankIdPtr; + s32 dbgVar; - for (bankIdPtr = sSfxBankIds; bankIdPtr < (sSfxBankIds + ARRAY_COUNT(sSfxBankIds)); bankIdPtr++) { - if (*bankIdPtr != BANK_SYSTEM) { - AudioSfx_StopByBank(*bankIdPtr); + // Remnant of debug + dbgVar = 0; + + if (dbgVar != 2) { + for (bankIdPtr = &sSfxBankIds[0]; bankIdPtr < (sSfxBankIds + ARRAY_COUNT(sSfxBankIds)); bankIdPtr++) { + if ((dbgVar != 0) || (*bankIdPtr != BANK_SYSTEM)) { + AudioSfx_StopByBank(*bankIdPtr); + } } } } diff --git a/src/code/cutscene_camera.c b/src/code/cutscene_camera.c index b560e9c954..8c7d5538ba 100644 --- a/src/code/cutscene_camera.c +++ b/src/code/cutscene_camera.c @@ -42,7 +42,7 @@ s32 CutsceneCamera_Init(Camera* camera, CutsceneCamera* csCamera) { csCamera->nextSplineTimer = csCamera->updateSplineTimer = 0; csCamera->cmdIndex = 0; - csCamera->splineIndex = 0xFFFF; + csCamera->splineIndex = -1; csCamera->splineNeedsInit = true; csCamera->state = CS_CAM_STATE_UPDATE_ALL; @@ -298,7 +298,7 @@ s32 CutsceneCamera_UpdateSplines(u8* script, CutsceneCamera* csCamera) { csCamera->atCmd = (CsCmdCamPoint*)&script[csCamera->cmdIndex]; csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamPoint)); - // Misc Point + // Eye Point csCamera->eyeCmd = (CsCmdCamPoint*)&script[csCamera->cmdIndex]; csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamPoint)); @@ -307,12 +307,10 @@ s32 CutsceneCamera_UpdateSplines(u8* script, CutsceneCamera* csCamera) { csCamera->cmdIndex += (s16)(csCamera->eyeInterp.numEntries * sizeof(CsCmdCamMisc)); // Other Params - csCamera->eyeInterp.curPoint = 0; - csCamera->atInterp.curPoint = 0; + csCamera->eyeInterp.curPoint = csCamera->atInterp.curPoint = 0; csCamera->splineNeedsInit = false; - //! FAKE: csCamera->splineIndex++; - csCamera->splineIndex = (csCamera->splineIndex & 0xFFFF) + 1; + csCamera->splineIndex++; csCamera->state = CS_CAM_STATE_UPDATE_ALL; csCamera->nextSplineTimer = csCamera->updateSplineTimer = 0; csCamera->eyeInterp.type = csCamera->atInterp.type = CS_CAM_INTERP_OFF; diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index d770a0d73c..69435f663c 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -1900,12 +1900,12 @@ s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, V fracA = 0.0f; fracB = 0.0f; -//! FAKE: -dummy:; - zero = 0.0f; intFlags = 0; + //! FAKE: + if (1) {} + if (Math3D_PointInCyl(cyl, linePointA) && Math3D_PointInCyl(cyl, linePointB)) { // both points are in the cylinder *intersectA = *linePointA; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 9b1d38d0e0..7a21566ba1 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2323,7 +2323,7 @@ s32 Actor_HasNoRider(PlayState* play, Actor* horse) { return false; } -void func_800B8D10(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { +void func_800B8D10(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, s32 arg5, u32 arg6) { Player* player = GET_PLAYER(play); player->unk_B74 = arg6; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index b297143315..89dfaf5bed 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -2873,7 +2873,7 @@ void DynaPoly_AddBgActorToLookup(PlayState* play, DynaCollisionContext* dyna, s3 pos.y += actor->shape.yOffset * actor->scale.y; //! FAKE: - if (pbgdata && pbgdata) {} + if (1) {} ScaleRotPos_SetValue(&dyna->bgActors[bgId].curTransform, &actor->scale, &actor->shape.rot, &pos); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 4be0ae9a67..c3fe078303 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -2318,11 +2318,11 @@ s32 Camera_Normal2(Camera* camera) { * Riding Epona and Zora */ s32 Camera_Normal3(Camera* camera) { - Normal3ReadOnlyData* roData = &camera->paramData.norm3.roData; - Normal3ReadWriteData* rwData = &camera->paramData.norm3.rwData; - f32 sp8C; + Vec3f* eye = &camera->eye; + Vec3f* at = &camera->at; + f32 sp94; f32 sp90; - f32 temp_f2; // multi-use temp + f32 temp_f2; f32 sp88; VecGeo sp80; VecGeo sp78; @@ -2332,10 +2332,10 @@ s32 Camera_Normal3(Camera* camera) { s16 sp62; s16 phi_v1_2; Player* player = (Player*)camera->focalActor; - Vec3f* eye = &camera->eye; - Vec3f* at = &camera->at; Vec3f* eyeNext = &camera->eyeNext; PosRot* focalActorPosRot = &camera->focalActorPosRot; + Normal3ReadOnlyData* roData = &camera->paramData.norm3.roData; + Normal3ReadWriteData* rwData = &camera->paramData.norm3.rwData; temp_f2 = Camera_GetFocalActorHeight(camera); @@ -2347,11 +2347,9 @@ s32 Camera_Normal3(Camera* camera) { if (RELOAD_PARAMS(camera)) { CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; - temp_f2 = CAM_RODATA_UNSCALE(temp_f2); - - roData->yOffset = GET_NEXT_RO_DATA(values) * temp_f2; - roData->distMin = GET_NEXT_RO_DATA(values) * temp_f2; - roData->distMax = GET_NEXT_RO_DATA(values) * temp_f2; + roData->yOffset = GET_NEXT_RO_DATA(values) * CAM_RODATA_UNSCALE(temp_f2); + roData->distMin = GET_NEXT_RO_DATA(values) * CAM_RODATA_UNSCALE(temp_f2); + roData->distMax = GET_NEXT_RO_DATA(values) * CAM_RODATA_UNSCALE(temp_f2); roData->pitchTarget = CAM_DEG_TO_BINANG(GET_NEXT_RO_DATA(values)); roData->yawUpdateRateInv = GET_NEXT_RO_DATA(values); roData->pitchUpdateRateInv = GET_NEXT_RO_DATA(values); @@ -2365,30 +2363,34 @@ s32 Camera_Normal3(Camera* camera) { sUpdateCameraDirection = true; sCameraInterfaceFlags = roData->interfaceFlags; - //! FAKE: fake temp - phi_v1_2 = camera->animState; - if (!((phi_v1_2 == 0) || (phi_v1_2 == 10) || (phi_v1_2 == 20))) { - } else { - rwData->isZero = 0; - rwData->curPitch = 0; - rwData->yPosOffset = camera->focalActorFloorHeight; + switch (camera->animState) { + case 0: + case 10: + case 20: + rwData->isZero = 0; + rwData->curPitch = 0; + rwData->yPosOffset = camera->focalActorFloorHeight; - D_801EDC30[camera->camId].yaw = D_801EDC30[camera->camId].pitch = D_801EDC30[camera->camId].unk_64 = 0; - D_801EDC30[camera->camId].swingUpdateRate = roData->yawUpdateRateInv; - rwData->yawUpdateRate = BINANG_SUB(BINANG_ROT180(camera->focalActorPosRot.rot.y), sp70.yaw) * (1.0f / 6.0f); - rwData->distTimer = 0; - rwData->is1200 = 1200; + D_801EDC30[camera->camId].yaw = D_801EDC30[camera->camId].pitch = D_801EDC30[camera->camId].unk_64 = 0; + D_801EDC30[camera->camId].swingUpdateRate = roData->yawUpdateRateInv; + rwData->yawUpdateRate = BINANG_SUB(BINANG_ROT180(camera->focalActorPosRot.rot.y), sp70.yaw) * (1.0f / 6.0f); + rwData->distTimer = 0; + rwData->is1200 = 1200; - if (roData->interfaceFlags & NORMAL3_FLAG_1) { - rwData->yawTimer = 6; - Camera_SetStateFlag(camera, CAM_STATE_DISABLE_MODE_CHANGE); - } else { - rwData->yawTimer = 0; - } + if (roData->interfaceFlags & NORMAL3_FLAG_1) { + rwData->yawTimer = 6; + Camera_SetStateFlag(camera, CAM_STATE_DISABLE_MODE_CHANGE); + } else { + rwData->yawTimer = 0; + } - camera->animState = 1; - D_801EDC30[camera->camId].timer = 0; - rwData->flag = NORMAL3_RW_FLAG; + camera->animState = 1; + D_801EDC30[camera->camId].timer = 0; + rwData->flag = NORMAL3_RW_FLAG; + break; + + default: + break; } if (rwData->distTimer != 0) { @@ -2396,23 +2398,23 @@ s32 Camera_Normal3(Camera* camera) { } sp90 = ((camera->speedRatio * 3.0f) + 1.0f) * 0.25f * 0.5f; - sp8C = temp_f2 = camera->speedRatio * 0.2f; + sp94 = temp_f2 = camera->speedRatio * 0.2f; if (D_801EDC30[camera->camId].timer != 0) { camera->yawUpdateRateInv = Camera_ScaledStepToCeilF( (D_801EDC30[camera->camId].timer * 2) + roData->yawUpdateRateInv, camera->yawUpdateRateInv, sp90, 0.1f); camera->pitchUpdateRateInv = Camera_ScaledStepToCeilF((D_801EDC30[camera->camId].timer * 2) + 16.0f, - camera->pitchUpdateRateInv, sp8C, 0.1f); + camera->pitchUpdateRateInv, sp94, 0.1f); D_801EDC30[camera->camId].timer--; } else { camera->yawUpdateRateInv = Camera_ScaledStepToCeilF(roData->yawUpdateRateInv, camera->yawUpdateRateInv, sp90, 0.1f); - camera->pitchUpdateRateInv = Camera_ScaledStepToCeilF(16.0f, camera->pitchUpdateRateInv, sp8C, 0.1f); + camera->pitchUpdateRateInv = Camera_ScaledStepToCeilF(16.0f, camera->pitchUpdateRateInv, sp94, 0.1f); } camera->yOffsetUpdateRate = Camera_ScaledStepToCeilF(0.05f, camera->yOffsetUpdateRate, sp90, 0.001f); - camera->xzOffsetUpdateRate = Camera_ScaledStepToCeilF(0.05f, camera->xzOffsetUpdateRate, sp8C, 0.0001f); - camera->fovUpdateRate = Camera_ScaledStepToCeilF(0.05f, camera->fovUpdateRate, sp8C, 0.0001f); + camera->xzOffsetUpdateRate = Camera_ScaledStepToCeilF(0.05f, camera->xzOffsetUpdateRate, sp94, 0.0001f); + camera->fovUpdateRate = Camera_ScaledStepToCeilF(0.05f, camera->fovUpdateRate, sp94, 0.0001f); phi_v1_2 = Camera_GetPitchAdjFromFloorHeightDiffs(camera, BINANG_ROT180(sp70.yaw), rwData->flag & NORMAL3_RW_FLAG); temp_f2 = ((1.0f / roData->pitchUpdateRateInv) * 0.5f) * (1.0f - camera->speedRatio); @@ -2538,9 +2540,9 @@ s32 Camera_Normal0(Camera* camera) { s16 phi_a1; s16 phi_a0; BgCamFuncData* bgCamFuncData; - f32 new_var; Normal0ReadOnlyData* roData = &camera->paramData.norm0.roData; Normal0ReadWriteData* rwData = &camera->paramData.norm0.rwData; + s32 pad2; if (!RELOAD_PARAMS(camera)) { } else { @@ -2559,46 +2561,50 @@ s32 Camera_Normal0(Camera* camera) { sCameraInterfaceFlags = roData->interfaceFlags; - if (RELOAD_PARAMS(camera)) { - bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamOrActorCsCamFuncData(camera, camera->bgCamIndex); - rwData->unk_00 = Camera_Vec3sToVec3f(&bgCamFuncData->pos); - rwData->unk_20 = bgCamFuncData->rot.x; - rwData->unk_22 = bgCamFuncData->rot.y; - rwData->unk_24 = focalActorPosRot->pos.y; - if (bgCamFuncData->fov == -1) { - rwData->unk_1C = roData->unk_14; - } else { - if (bgCamFuncData->fov > 360) { - phi_f0 = CAM_RODATA_UNSCALE(bgCamFuncData->fov); - } else { - phi_f0 = bgCamFuncData->fov; - } - rwData->unk_1C = phi_f0; - } - - if (bgCamFuncData->unk_0E == -1) { - rwData->unk_2C = 0; - } else { - rwData->unk_2C = bgCamFuncData->unk_0E; - } - - rwData->unk_18 = 0.0f; - rwData->unk_28 = 120.0f; - - if (roData->interfaceFlags & NORMAL0_FLAG_2) { - sp88.pitch = rwData->unk_20; - sp88.yaw = rwData->unk_22; - sp88.r = 100.0f; - rwData->unk_0C = OLib_VecGeoToVec3f(&sp88); - } - camera->animState = 1; - camera->yawUpdateRateInv = 50.0f; - } else { - if (func_800CB950(camera)) { + switch (camera->animState) { + case 0: + case 10: + case 20: + bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamOrActorCsCamFuncData(camera, camera->bgCamIndex); + rwData->unk_00 = Camera_Vec3sToVec3f(&bgCamFuncData->pos); + rwData->unk_20 = bgCamFuncData->rot.x; + rwData->unk_22 = bgCamFuncData->rot.y; rwData->unk_24 = focalActorPosRot->pos.y; - } - //! FAKE: - if (1) {} + if (bgCamFuncData->fov == -1) { + rwData->unk_1C = roData->unk_14; + } else { + if (bgCamFuncData->fov > 360) { + phi_f0 = CAM_RODATA_UNSCALE(bgCamFuncData->fov); + } else { + phi_f0 = bgCamFuncData->fov; + } + rwData->unk_1C = phi_f0; + } + + if (bgCamFuncData->unk_0E == -1) { + rwData->unk_2C = 0; + } else { + rwData->unk_2C = bgCamFuncData->unk_0E; + } + + rwData->unk_18 = 0.0f; + rwData->unk_28 = 120.0f; + + if (roData->interfaceFlags & NORMAL0_FLAG_2) { + sp88.pitch = rwData->unk_20; + sp88.yaw = rwData->unk_22; + sp88.r = 100.0f; + rwData->unk_0C = OLib_VecGeoToVec3f(&sp88); + } + camera->animState = 1; + camera->yawUpdateRateInv = 50.0f; + break; + + default: + if (func_800CB950(camera)) { + rwData->unk_24 = focalActorPosRot->pos.y; + } + break; } sp80 = OLib_Vec3fDiffToVecGeo(at, eye); @@ -2634,32 +2640,13 @@ s32 Camera_Normal0(Camera* camera) { sp88 = OLib_Vec3fDiffToVecGeo(&rwData->unk_00, at); sp90 = OLib_Vec3fDiffToVecGeo(at, eyeNext); - if (rwData->unk_2C & 2) { - phi_a1 = rwData->unk_22; - } else { - phi_a1 = roData->unk_1C; - } - - temp_v1_2 = sp90.yaw - sp88.yaw; - if (((phi_a1 <= 0x4000) && (phi_a1 < ABS(temp_v1_2))) || ((phi_a1 > 0x4000) && (ABS(temp_v1_2) < phi_a1))) { - //! FAKE: Needed to swap v0/v1 - if (1) {} - if (1) {} - if (1) {} - if (1) {} - - //! FAKE: Needed because the *1.0f isn't being multiplied - new_var = 1.0f; - - if (temp_v1_2 < 0) { - phi_a0 = -phi_a1; - } else { - phi_a0 = phi_a1; - } - + phi_a1 = (rwData->unk_2C & 2) ? rwData->unk_22 : roData->unk_1C; + phi_a0 = sp90.yaw - sp88.yaw; + if (((phi_a1 <= 0x4000) && (phi_a1 < ABS(phi_a0))) || ((phi_a1 > 0x4000) && (ABS(phi_a0) < phi_a1))) { + phi_a0 = (phi_a0 < 0) ? -phi_a1 : phi_a1; phi_a0 += sp88.yaw; - sp98.yaw = Camera_ScaledStepToCeilS(phi_a0, sp80.yaw, - (1.0f / camera->yawUpdateRateInv) * new_var * camera->speedRatio, 5); + sp98.yaw = + Camera_ScaledStepToCeilS(phi_a0, sp80.yaw, (1 / camera->yawUpdateRateInv) * 1 * camera->speedRatio, 5); if (rwData->unk_2C & 1) { sp98.pitch = Camera_CalcDefaultPitch(camera, sp78.pitch, rwData->unk_20, 0); } else { @@ -3085,7 +3072,7 @@ s32 Camera_Jump2(Camera* camera) { VecGeo sp9C; s16 temp_t2; s16 yawDiff; - s32 pad; + f32 tmp; f32 sp90; f32 sp8C; s32 sp88; @@ -3170,11 +3157,9 @@ s32 Camera_Jump2(Camera* camera) { Camera_CalcAtDefault(camera, &spA4, roData->unk_00, 0); spB4 = OLib_Vec3fDiffToVecGeo(at, eye); - //! FAKE: Unused - yNormal = roData->unk_04; - + tmp = roData->unk_04; phi_f2 = roData->unk_08 + (roData->unk_08 * roData->unk_0C); - temp_f16 = roData->unk_04 - (roData->unk_04 * roData->unk_0C); + temp_f16 = tmp - (roData->unk_04 * roData->unk_0C); if (spB4.r > phi_f2) { spB4.r = phi_f2; diff --git a/src/code/z_eff_blure.c b/src/code/z_eff_blure.c index e050d41839..d31155042e 100644 --- a/src/code/z_eff_blure.c +++ b/src/code/z_eff_blure.c @@ -43,10 +43,11 @@ void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { MtxF sp50; Vec3f sp44; Vec3f sp38; + EffectBlureElement* prev = elem - 1; - sp16C.x = ((f32)(elem - 1)->p2.x + (f32)(elem - 1)->p1.x) / 2.0f; - sp16C.y = ((f32)(elem - 1)->p2.y + (f32)(elem - 1)->p1.y) / 2.0f; - sp16C.z = ((f32)(elem - 1)->p2.z + (f32)(elem - 1)->p1.z) / 2.0f; + sp16C.x = ((f32)prev->p2.x + (f32)prev->p1.x) / 2.0f; + sp16C.y = ((f32)prev->p2.y + (f32)prev->p1.y) / 2.0f; + sp16C.z = ((f32)prev->p2.z + (f32)prev->p1.z) / 2.0f; sp160.x = (p1->x + p2->x) / 2.0f; sp160.y = (p1->y + p2->y) / 2.0f; sp160.z = (p1->z + p2->z) / 2.0f; diff --git a/src/code/z_eff_tire_mark.c b/src/code/z_eff_tire_mark.c index f7d6c152bd..09a152883e 100644 --- a/src/code/z_eff_tire_mark.c +++ b/src/code/z_eff_tire_mark.c @@ -74,6 +74,10 @@ void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f spA8->p2.y = sp78.y; spA8->p2.z = sp78.z; spA8->life = this->elemDuration; + + //! FAKE: + if (1) {} + spA8->colPoly = NULL; this->numElements++; @@ -82,9 +86,6 @@ void func_800AE930(CollisionContext* colCtx, EffectTireMark* this, Vec3f* pos, f spAC->flags |= EFFECT_TIRE_MARK_ELEMENT_FLAG_1; } - //! FAKE: - if (spA8) {} - spA8 = &this->elements[this->numElements]; spA8->flags = 0; spA8->p1 = spB0; diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index 218ebadc50..2d467cdccc 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -518,12 +518,14 @@ s16 CutsceneManager_FindEntranceCsId(void) { s32 csId; for (csId = 0; csId < sSceneCutsceneCount; csId++) { - //! FAKE: - if ((sSceneCutsceneList[csId].scriptIndex != CS_SCRIPT_ID_NONE) && - (sSceneCutsceneList[csId].scriptIndex < (play = sCutsceneMgr.play)->csCtx.scriptListCount) && - (sCutsceneMgr.play->curSpawn == - sCutsceneMgr.play->csCtx.scriptList[sSceneCutsceneList[csId].scriptIndex].spawn)) { - return csId; + if (sSceneCutsceneList[csId].scriptIndex != CS_SCRIPT_ID_NONE) { + PlayState* play = sCutsceneMgr.play; + + if ((sSceneCutsceneList[csId].scriptIndex < play->csCtx.scriptListCount) && + (sCutsceneMgr.play->curSpawn == + sCutsceneMgr.play->csCtx.scriptList[sSceneCutsceneList[csId].scriptIndex].spawn)) { + return csId; + } } } diff --git a/src/code/z_map_disp.c b/src/code/z_map_disp.c index 2718160ece..c356c9f433 100644 --- a/src/code/z_map_disp.c +++ b/src/code/z_map_disp.c @@ -659,17 +659,14 @@ void MapDisp_InitBossRoomStorey(PlayState* play) { s32 i; for (i = 0; i < transitionActors->count; i++) { - if (MapDisp_IsBossDoor(sTransitionActors[i].params)) { - if (ABS_ALT(sTransitionActors[i].id) != ACTOR_EN_HOLL) { - for (storey = 0; storey < sMapDisp.numStoreys; storey++) { - //! FAKE: needed for matching - s32 temp = (sMapDisp.storeyYList[storey] - 5); + TransitionActorEntry* entry = &sTransitionActors[i]; - if (((storey == sMapDisp.numStoreys - 1) && - (sTransitionActors[i].pos.y >= (sMapDisp.storeyYList[storey] - 5))) || - ((storey != sMapDisp.numStoreys - 1) && - (sTransitionActors[i].pos.y >= (sMapDisp.storeyYList[storey] - 5)) && - (sTransitionActors[i].pos.y < (sMapDisp.storeyYList[storey + 1] - 5)))) { + if (MapDisp_IsBossDoor(entry->params)) { + if (ABS_ALT(entry->id) != ACTOR_EN_HOLL) { + for (storey = 0; storey < sMapDisp.numStoreys; storey++) { + if (((storey == sMapDisp.numStoreys - 1) && (entry->pos.y >= (sMapDisp.storeyYList[storey] - 5))) || + ((storey != sMapDisp.numStoreys - 1) && (entry->pos.y >= (sMapDisp.storeyYList[storey] - 5)) && + (entry->pos.y < (sMapDisp.storeyYList[storey + 1] - 5)))) { sMapDisp.bossRoomStorey = storey; return; } diff --git a/src/code/z_play.c b/src/code/z_play.c index 9ed00afb16..52ec6c122e 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -2076,9 +2076,9 @@ void Play_Init(GameState* thisx) { s32 zAllocSize; Player* player; s32 i; - s32 spawn; - u8 sceneLayer; s32 scene; + u8 sceneLayer; + s32 pad2; if ((gSaveContext.respawnFlag == -4) || (gSaveContext.respawnFlag == -0x63)) { if (CHECK_EVENTINF(EVENTINF_TRIGGER_DAYTELOP)) { @@ -2105,7 +2105,6 @@ void Play_Init(GameState* thisx) { if ((gSaveContext.nextCutsceneIndex == 0xFFEF) || (gSaveContext.nextCutsceneIndex == 0xFFF0)) { scene = ((void)0, gSaveContext.save.entrance) >> 9; - spawn = (((void)0, gSaveContext.save.entrance) >> 4) & 0x1F; if (CHECK_WEEKEVENTREG(WEEKEVENTREG_CLEARED_SNOWHEAD_TEMPLE)) { if (scene == ENTR_SCENE_MOUNTAIN_VILLAGE_WINTER) { @@ -2145,9 +2144,8 @@ void Play_Init(GameState* thisx) { gSaveContext.nextCutsceneIndex = 0xFFF4; } } - //! FAKE: - gSaveContext.save.entrance = - Entrance_Create(((void)0, scene), spawn, ((void)0, gSaveContext.save.entrance) & 0xF); + gSaveContext.save.entrance = Entrance_Create(scene, (((void)0, gSaveContext.save.entrance) >> 4) & 0x1F, + ((void)0, gSaveContext.save.entrance) & 0xF); } GameState_Realloc(&this->state, 0); diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 8a7a622daa..483d371c9a 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -1698,9 +1698,8 @@ PlayerExplosive Player_GetExplosiveHeld(Player* player) { PlayerSword Player_SwordFromIA(Player* player, PlayerItemAction itemAction) { PlayerSword sword = PLAYER_SWORD_KOKIRI; - //! FAKE: if ((itemAction == PLAYER_IA_LAST_USED) || - ((sword = GET_SWORD_FROM_IA(itemAction), (sword > PLAYER_SWORD_NONE)) && (sword < PLAYER_SWORD_MAX))) { + (sword = GET_SWORD_FROM_IA(itemAction), ((sword > PLAYER_SWORD_NONE) && (sword < PLAYER_SWORD_MAX)))) { return sword; } @@ -3817,29 +3816,28 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G } } } else if (limbIndex == PLAYER_LIMB_HEAD) { - //! FAKE: - if (((*dList1 != NULL) && ((((void)0, player->currentMask)) != (((void)0, PLAYER_MASK_NONE)))) && + if (((*dList1 != NULL) && ((u32)player->currentMask != PLAYER_MASK_NONE)) && (((player->transformation == PLAYER_FORM_HUMAN) && ((player->skelAnime.animation != &gPlayerAnim_cl_setmask) || (player->skelAnime.curFrame >= 12.0f))) || ((((player->transformation != PLAYER_FORM_HUMAN) && (player->currentMask >= PLAYER_MASK_FIERCE_DEITY)) && ((player->transformation + PLAYER_MASK_FIERCE_DEITY) != player->currentMask)) && (player->skelAnime.curFrame >= 10.0f)))) { if (func_80127438(play, player, player->currentMask)) { - s32 maskMinusOne = ((void)0, player->currentMask) - 1; + s32 maskMinusOne = player->currentMask - 1; OPEN_DISPS(play->state.gfxCtx); - if (((void)0, player->currentMask) == PLAYER_MASK_COUPLE) { + if (player->currentMask == PLAYER_MASK_COUPLE) { Player_DrawCouplesMask(play, player); - } else if (((void)0, player->currentMask) == PLAYER_MASK_CIRCUS_LEADER) { + } else if (player->currentMask == PLAYER_MASK_CIRCUS_LEADER) { Player_DrawCircusLeadersMask(play, player); - } else if (((void)0, player->currentMask) == PLAYER_MASK_BLAST) { + } else if (player->currentMask == PLAYER_MASK_BLAST) { Player_DrawBlastMask(play, player); - } else if (((void)0, player->currentMask) == PLAYER_MASK_BUNNY) { + } else if (player->currentMask == PLAYER_MASK_BUNNY) { Player_DrawBunnyHood(play); - } else if (((void)0, player->currentMask) == PLAYER_MASK_GREAT_FAIRY) { + } else if (player->currentMask == PLAYER_MASK_GREAT_FAIRY) { Player_DrawGreatFairysMask(play, player); - } else if (((void)0, player->currentMask) >= PLAYER_MASK_FIERCE_DEITY) { + } else if (player->currentMask >= PLAYER_MASK_FIERCE_DEITY) { static Vec2f D_801C0E04[PLAYER_FORM_MAX] = { { 140.0f, -130.0f }, // PLAYER_FORM_FIERCE_DEITY { 0.0f, -200.0f }, // PLAYER_FORM_GORON @@ -4013,6 +4011,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList1, G } else if ((limbIndex == PLAYER_LIMB_HAT) && (player->stateFlags3 & PLAYER_STATE3_100000)) { Vec3f sp5C; Vec3f sp50; + s32 pad; Matrix_MultVecX(3000.0f, &sp5C); Matrix_MultVecX(2300.0f, &sp50); diff --git a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c index 534421e617..cbac0f7ed7 100644 --- a/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c +++ b/src/overlays/actors/ovl_Bg_Astr_Bombwall/z_bg_astr_bombwall.c @@ -86,9 +86,7 @@ void BgAstrBombwall_InitCollider(ColliderTrisInit* init, Vec3f* pos, Vec3s* rot, for (i = 0; i < init->count; i++) { for (j = 0; j < 3; j++) { - //! FAKE: - // https://decomp.me/scratch/JrEnl - Matrix_MultVec3f(&(init->elements + i)->dim.vtx[j], &sp54[j]); + Matrix_MultVec3f(init->elements[i].dim.vtx + j, &sp54[j]); Math_Vec3f_Sum(&sp54[j], pos, &sp54[j]); } Collider_SetTrisVertices(collider, i, &sp54[0], &sp54[1], &sp54[2]); diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 8f9ee02f9d..7a92ad8910 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -1684,8 +1684,8 @@ s8 EnInvadepoh_ModelInfo_GetNextFaceAnim(EnInvadepohFaceAnimNext* nextAnims, s32 } } - //! FAKE: - return (nextAnims + nextIndex)->index; + nextAnim = &nextAnims[nextIndex]; + return nextAnim->index; } void EnInvadepoh_ModelInfo_SetNextFaceAnim(EnInvadepohFaceAnimInfo* faceInfo, EnInvadepohFaceAnimBase* faceAnim) { diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 1bc073417b..1e2a471682 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -188,8 +188,10 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) { i = 0; csId = this->picto.actor.csId; while (csId != CS_ID_NONE) { - //! FAKE: - csId = CutsceneManager_GetAdditionalCsId(this->csIdList[i] = csId); + // clang-format off + this->csIdList[i] = csId; \ + csId = CutsceneManager_GetAdditionalCsId(csId); + // clang-format on i++; } diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.c b/src/overlays/actors/ovl_En_Knight/z_en_knight.c index 14715da6cb..accb347db9 100644 --- a/src/overlays/actors/ovl_En_Knight/z_en_knight.c +++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.c @@ -3465,27 +3465,11 @@ void EnKnight_FlyingHeadAttack(EnKnight* this, PlayState* play) { if (CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_A) || CHECK_BTN_ALL(CONTROLLER1(&play->state)->press.button, BTN_B)) { - if (1) {} //! FAKE: - if (this->timers[0] != 0) { - this->timers[0]--; - if (1) {} - } - - if (this->timers[0] != 0) { - this->timers[0]--; - } - - if (this->timers[0] != 0) { - this->timers[0]--; - } - - if (this->timers[0] != 0) { - this->timers[0]--; - } - - if (this->timers[0] != 0) { - this->timers[0]--; - } + DECR(this->timers[0]); + DECR(this->timers[0]); + DECR(this->timers[0]); + DECR(this->timers[0]); + DECR(this->timers[0]); } Math_ApproachF(&this->actor.world.pos.x, player->actor.world.pos.x + targetHeight.x, 1.0f, @@ -4342,7 +4326,7 @@ void EnKnight_UpdateEffects(EnKnight* this, PlayState* play) { eff->accel.y = BREG(56) * 0.01f + 1.0f; - if (eff->active == (u32) true) { //! FAKE: + if (eff->active == true) { Math_ApproachF(&eff->scale, (KREG(59) * 0.01f + 1.0f) * eff->scaleTarget, 0.1f, eff->scaleTarget * 0.1f); diff --git a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c index ce84c9055f..13f71541c0 100644 --- a/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c +++ b/src/overlays/actors/ovl_En_Kusa2/z_en_kusa2.c @@ -406,10 +406,10 @@ EnKusa2UnkBssSubStruct2* func_80A5C0B8(EnKusa2UnkBssStruct* arg0) { EnKusa2UnkBssSubStruct2* phi_v1 = &arg0->unk_0480[0]; for (i = 1; i < ARRAY_COUNT(D_80A5F1C0.unk_0480); i++) { - if (phi_v1->unk_2C > arg0->unk_0480[i].unk_2C) { - phi_v1 = &arg0->unk_0480[i]; - //! FAKE: - if (1) {} + EnKusa2UnkBssSubStruct2* iter = &arg0->unk_0480[i]; + + if (iter->unk_2C < phi_v1->unk_2C) { + phi_v1 = iter; if (phi_v1->unk_2C <= 0) { break; 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 81c31e9b16..153f9bb1c8 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -80,12 +80,12 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { EnMinifrog* this = (EnMinifrog*)thisx; s32 i; - Actor_ProcessInitChain(&this->actor, sInitChain); - ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 15.0f); + Actor_ProcessInitChain(thisx, sInitChain); + ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 15.0f); SkelAnime_InitFlex(play, &this->skelAnime, &gFrogSkel, &gFrogIdleAnim, this->jointTable, this->morphTable, FROG_LIMB_MAX); - CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); - Collider_InitAndSetCylinder(play, &this->collider, &this->actor, &sCylinderInit); + CollisionCheck_SetInfo(&thisx->colChkInfo, NULL, &sColChkInfoInit); + Collider_InitAndSetCylinder(play, &this->collider, thisx, &sCylinderInit); if (!sTexturesDesegmented) { for (i = 0; i < ARRAY_COUNT(sEyeTextures); i++) { @@ -94,20 +94,17 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { sTexturesDesegmented = true; } - this->frogIndex = (this->actor.params & 0xF); + this->frogIndex = (thisx->params & 0xF); if (this->frogIndex >= 5) { this->frogIndex = FROG_YELLOW; } - this->actor.speed = 0.0f; + thisx->speed = 0.0f; this->actionFunc = EnMinifrog_Idle; this->jumpState = FROG_STATE_GROUND; this->flags = 0; this->timer = 0; - //! FAKE: - if (1) {} - if (!EN_FROG_IS_RETURNED(&this->actor)) { if ((this->frogIndex == FROG_YELLOW) || CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex])) { Actor_Kill(&this->actor); @@ -116,29 +113,29 @@ void EnMinifrog_Init(Actor* thisx, PlayState* play) { this->timer = 30; this->actionFunc = EnMinifrog_SpawnGrowAndShrink; - this->actor.textId = 0xD81; - this->actor.colChkInfo.mass = 30; + thisx->textId = 0xD81; + thisx->colChkInfo.mass = 30; } else { // Frogs in mountain village if (this->frogIndex == FROG_YELLOW) { - this->actor.textId = 0; + thisx->textId = 0; this->actionFunc = EnMinifrog_SetupYellowFrogDialog; if (!CHECK_WEEKEVENTREG(WEEKEVENTREG_34_01)) { - this->actor.flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; + thisx->flags |= ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED; } - this->actor.home.rot.x = this->actor.home.rot.z = 0; + thisx->home.rot.x = thisx->home.rot.z = 0; this->frog = NULL; } else { this->frog = EnMinifrog_GetFrog(play); - this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; + thisx->flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; // Frog has been returned if (CHECK_WEEKEVENTREG(sIsFrogReturnedFlags[this->frogIndex])) { this->actionFunc = EnMinifrog_SetupNextFrogInit; } else { - this->actor.draw = NULL; - this->actor.update = EnMinifrog_UpdateMissingFrog; + thisx->draw = NULL; + thisx->update = EnMinifrog_UpdateMissingFrog; } } } 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 2887aa3aa5..51ee34ff2c 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -539,23 +539,19 @@ void func_8095B6C8(EnOwl* this, PlayState* play) { } void func_8095B76C(EnOwl* this, PlayState* play) { - s32 pad; + Actor* thisx = &this->actor; s16 sp4A; - f32 sp44 = Path_OrientAndGetDistSq(&this->actor, this->path, this->unk_3F8, &sp4A); - Vec3s* points; + f32 sp44 = Path_OrientAndGetDistSq(thisx, this->path, this->unk_3F8, &sp4A); + Vec3s* point; - Math_SmoothStepToS(&this->actor.world.rot.y, sp4A, 6, 0x800, 0x200); - this->actor.shape.rot.y = this->actor.world.rot.y; - if (sp44 < SQ(this->actor.speed)) { - this->actor.speed = 0.0f; - points = Lib_SegmentedToVirtual(this->path->points); - points += this->unk_3F8; + Math_SmoothStepToS(&thisx->world.rot.y, sp4A, 6, 0x800, 0x200); + thisx->shape.rot.y = thisx->world.rot.y; + if (sp44 < SQ(thisx->speed)) { + thisx->speed = 0.0f; + point = &((Vec3s*)Lib_SegmentedToVirtual(this->path->points))[this->unk_3F8]; - //! FAKE: - if (1) { - this->actor.world.pos.x = points->x; - this->actor.world.pos.z = points->z; - } + thisx->world.pos.x = point->x; + thisx->world.pos.z = point->z; this->unk_3F8++; if (this->unk_3F8 >= this->path->count) { @@ -563,21 +559,21 @@ void func_8095B76C(EnOwl* this, PlayState* play) { return; } - Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OWL, this->actor.world.pos.x, this->actor.world.pos.y, - this->actor.world.pos.z, 0, 0, 0, 0xF00); - this->actor.home.rot.x++; - if (this->actor.home.rot.x >= 3) { + Actor_Spawn(&play->actorCtx, play, ACTOR_EN_OWL, thisx->world.pos.x, thisx->world.pos.y, thisx->world.pos.z, 0, + 0, 0, 0xF00); + thisx->home.rot.x++; + if (thisx->home.rot.x >= 3) { func_8095ACEC(this); } func_8095B0C8(this); } else if (sp44 < SQ(21.0f)) { - if (this->actor.speed > 1.0f) { - this->actor.speed -= 1.0f; + if (thisx->speed > 1.0f) { + thisx->speed -= 1.0f; } else { - this->actor.speed = 1.0f; + thisx->speed = 1.0f; } - } else if (this->actor.speed < 6.0f) { - this->actor.speed += 1.0f; + } else if (thisx->speed < 6.0f) { + thisx->speed += 1.0f; } func_8095B06C(this); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 536cae676e..8f8eca94c4 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -263,10 +263,8 @@ void EnPoSisters_MatchPlayerY(EnPoSisters* this, PlayState* play) { // equalize to player height Math_ApproachF(&this->actor.world.pos.y, player->actor.world.pos.y + 5.0f, 0.5f, 3.0f); - if (this->floatingBobbingTimer == 0) { + if ((u32)this->floatingBobbingTimer == 0) { this->floatingBobbingTimer = 32; - //! FAKE: - if (this->floatingBobbingTimer) {} } DECR(this->floatingBobbingTimer); diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 64f65c2858..38fabd4fc6 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -305,9 +305,7 @@ void EnTest6_DrawAmmoDropRupee(EnTest6* this, PlayState* play, SoTCsAmmoDrops* a if (gfxHead != NULL) { Gfx_SetupDL25_Opa(play->state.gfxCtx); - //! FAKE: & 0xFFFF - gDPSetTileSize(gfx++, 1, hilite->h.x1 & 0xFFFF, hilite->h.y1 & 0xFFFF, (hilite->h.x1 + 60) & 0xFFFF, - (hilite->h.y1 + 60) & 0xFFFF); + gDPSetHilite1Tile(gfx++, 1, hilite, 0x10, 0x10); gSPEndDisplayList(gfx++); gSPSegment(POLY_OPA_DISP++, 0x07, gfxHead); @@ -565,9 +563,6 @@ void EnTest6_InvertedSoTCutscene(EnTest6* this, PlayState* play) { } for (i = 0; i < SOTCS_INV_NUM_CLOCKS; i++) { - //! FAKE: - if (player != NULL) {} - clockYaw += 0x10000 / SOTCS_INV_NUM_CLOCKS; this->invSoTClockPos[i].x = player->actor.world.pos.x + (Math_SinS(clockYaw) * this->clockDist); this->invSoTClockPos[i].y = player->actor.world.pos.y; @@ -669,6 +664,9 @@ void EnTest6_InvertedSoTCutscene(EnTest6* this, PlayState* play) { // Update white screen if (this->screenFillAlpha != 0) { + //! FAKE: + if (1) {} + EnTest6_EnableWhiteFillScreen(play, this->screenFillAlpha * 0.05f); subCam->fov += (mainCam->fov - subCam->fov) * 0.05f; this->screenFillAlpha++; diff --git a/src/overlays/actors/ovl_En_Test7/z_en_test7.c b/src/overlays/actors/ovl_En_Test7/z_en_test7.c index a18a5f8986..c8c28a91a2 100644 --- a/src/overlays/actors/ovl_En_Test7/z_en_test7.c +++ b/src/overlays/actors/ovl_En_Test7/z_en_test7.c @@ -646,7 +646,7 @@ void EnTest7_WarpCsWarp(EnTest7* this, PlayState* play) { Vec3f featherPos; //! FAKE: - if (this) {} + if (1) {} Math_Vec3f_Copy(&featherPos, &this->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index 9ad580cc82..6c96f39f29 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -361,9 +361,6 @@ s32 func_80C10E98(PlayState* play) { i = sp5C - phi_s0_2; - //! FAKE: - if (i) {} - sp5C = phi_s0_2 * 50; sp98 -= sp5C; @@ -393,9 +390,7 @@ s32 func_80C10E98(PlayState* play) { func_80C10DE8(dropItem00Ids, spA8, ITEM00_RUPEE_GREEN); if ((spB0 + spAC + phi_s0_2 + spA0 + phi_s2 + spA8) == 0) { return false; - } - - { + } else { Vec3f sp64; for (i = 0; i < ARRAY_COUNT(dropItem00Ids); i++) { diff --git a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c index eedaa27f99..99f902e445 100644 --- a/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c +++ b/src/overlays/actors/ovl_En_Time_Tag/z_en_time_tag.c @@ -262,13 +262,13 @@ void EnTimeTag_Diary_Wait(EnTimeTag* this, PlayState* play) { Message_StartTextbox(play, 0x122B, &this->actor); } TIMETAG_DIARY_TIMER(&this->actor) = 1; + + //! FAKE: + if (1) {} } else { // unable to read Zora script Message_StartTextbox(play, 0x122A, &this->actor); - //! FAKE: https://decomp.me/scratch/AHRNe - if (0) {} - ((EnElf*)GET_PLAYER(play)->tatlActor)->unk_264 |= 4; Actor_ChangeFocus(&this->actor, play, GET_PLAYER(play)->tatlActor); TIMETAG_DIARY_TIMER(&this->actor) = 0; 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 b99262783e..17f8b76297 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -1053,10 +1053,9 @@ void EnTrt_ItemGiven(EnTrt* this, PlayState* play) { break; default: - //! FAKE: - if (1) {} this->textId = 0x849; - break; + // note break is missing + // break; } Message_ContinueTextbox(play, this->textId); } else { diff --git a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c index 9f1e5659d9..3220b4823a 100644 --- a/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c +++ b/src/overlays/actors/ovl_En_Zoraegg/z_en_zoraegg.c @@ -665,10 +665,10 @@ void func_80B32F04(Actor* thisx, PlayState* play) { f32 sp78; f32 sp74; EnZoraegg* this = (EnZoraegg*)thisx; - s32 pad[3]; + Vec3f pos; s16 sp62; s16 sp60; - f32 temp_f2; + s32 pad; Gfx* gfx; Vec3f sp4C; s32 pad2; @@ -684,9 +684,11 @@ void func_80B32F04(Actor* thisx, PlayState* play) { sp78 = -(15.0f * Math_SinS(sp60)); sp7C = -((15.0f * Math_CosS(sp62)) * Math_CosS(sp60)); - //! FAKE: temp_f2 = - Matrix_Translate(this->actor.world.pos.x + sp74, this->actor.world.pos.y + sp78 + 6.0f, - temp_f2 = this->actor.world.pos.z + sp7C, MTXMODE_NEW); + pos.x = this->actor.world.pos.x + sp74; + pos.y = this->actor.world.pos.y + sp78 + 6.0f; + pos.z = this->actor.world.pos.z + sp7C; + + Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_NEW); sp7C = Math_SinS(play->gameplayFrames * 0x4000); diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 3913ca2eac..7deb602c84 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -145,22 +145,19 @@ void ObjAqua_Init(Actor* thisx, PlayState* play) { ObjAqua* this = (ObjAqua*)thisx; s32 i; - Actor_ProcessInitChain(&this->actor, sInitChain); + Actor_ProcessInitChain(thisx, sInitChain); this->actor.scale.x = 0.0009f; this->actor.scale.y = 0.0005f; this->actor.scale.z = 0.0009f; Collider_InitCylinder(play, &this->collider); - Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 60.0f); + Collider_SetCylinder(play, &this->collider, thisx, &sCylinderInit); + ActorShape_Init(&thisx->shape, 0.0f, ActorShadow_DrawCircle, 60.0f); - //! FAKE: - if (1) {} - - this->actor.shape.shadowAlpha = 140; + thisx->shape.shadowAlpha = 140; this->alpha = 255; if (ObjAqua_IsUnderwater(this, play)) { for (i = 0; i < 8; i++) { - EffectSsBubble_Spawn(play, &this->actor.world.pos, -4.0f, 4.0f, 4.0f, (Rand_ZeroOne() * 0.09f) + 0.03f); + EffectSsBubble_Spawn(play, &thisx->world.pos, -4.0f, 4.0f, 4.0f, (Rand_ZeroOne() * 0.09f) + 0.03f); } func_80ACBDCC(this); } else { 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 b79ef56338..3bc32560ce 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -203,8 +203,8 @@ static Gfx* sEyeSwitchDL[] = { gEyeSwitchGoldDL, gEyeSwitchSilverDL }; static AnimatedMaterial* sCrystalSwitchAnimatedMat; -void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntSphInit* init) { - s32 pad; +void ObjSwitch_InitJntSphCollider(Actor* thisx, PlayState* play, ColliderJntSphInit* init) { + ObjSwitch* this = (ObjSwitch*)thisx; Collider_InitJntSph(play, &this->colliderJntSph); Collider_SetJntSph(play, &this->colliderJntSph, &this->dyna.actor, init, this->colliderJntSphElements); @@ -216,8 +216,8 @@ void ObjSwitch_InitJntSphCollider(ObjSwitch* this, PlayState* play, ColliderJntS Collider_UpdateSpheres(0, &this->colliderJntSph); } -void ObjSwitch_InitTrisCollider(ObjSwitch* this, PlayState* play, ColliderTrisInit* init) { - s32 pad; +void ObjSwitch_InitTrisCollider(Actor* thisx, PlayState* play, ColliderTrisInit* init) { + ObjSwitch* this = (ObjSwitch*)thisx; s32 i; s32 j; Vec3f vtx[3]; @@ -231,9 +231,6 @@ void ObjSwitch_InitTrisCollider(ObjSwitch* this, PlayState* play, ColliderTrisIn this->dyna.actor.world.pos.z, &this->dyna.actor.shape.rot); for (i = 0; i < ARRAY_COUNT(this->colliderTrisElements); i++) { - //! FAKE: - if (this) {} - for (j = 0; j < ARRAY_COUNT(vtx); j++) { Matrix_MultVec3f(&init->elements[i].dim.vtx[j], &vtx[j]); } @@ -375,11 +372,11 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) { Actor_SetFocus(&this->dyna.actor, sHeights[type]); if (type == OBJSWITCH_TYPE_FLOOR_RUSTY) { - ObjSwitch_InitTrisCollider(this, play, &sRustyFloorTrisInit); + ObjSwitch_InitTrisCollider(&this->dyna.actor, play, &sRustyFloorTrisInit); } else if (type == OBJSWITCH_TYPE_EYE) { - ObjSwitch_InitTrisCollider(this, play, &sEyeSwitchTrisInit); + ObjSwitch_InitTrisCollider(&this->dyna.actor, play, &sEyeSwitchTrisInit); } else if (type == OBJSWITCH_TYPE_CRYSTAL || type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { - ObjSwitch_InitJntSphCollider(this, play, &sJntSphInit); + ObjSwitch_InitJntSphCollider(&this->dyna.actor, play, &sJntSphInit); } if (type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) { this->dyna.actor.attentionRangeType = ATTENTION_RANGE_4; @@ -936,10 +933,8 @@ void ObjSwitch_Update(Actor* thisx, PlayState* play) { } this->actionFunc(this, play); if (this->floorSwitchPlayerSnapState != 0) { - s32 pad; + s32 requiredScopeTemp; - //! FAKE: - dummy: ObjSwitch_FloorSwitchSnapPlayerToSwitchEdge(this, play); if (this->floorSwitchPlayerSnapState == 2) { this->floorSwitchPlayerSnapState = 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 7b1aec6232..20a19f28b9 100644 --- a/src/overlays/actors/ovl_Obj_Um/z_obj_um.c +++ b/src/overlays/actors/ovl_Obj_Um/z_obj_um.c @@ -319,9 +319,10 @@ s32 func_80B781DC(ObjUm* this, EnHorse* bandit1, EnHorse* bandit2, PlayState* pl phi_f20 *= -1.0f; } phi_s2 = D_80B7C164[i].unk_10; + + //! FAKE: + if (1) {} } - //! FAKE: - ; } } } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 96e096fe22..62ff276224 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -280,7 +280,7 @@ void Player_CsAction_20(PlayState* play, Player* this, CsCmdActorCue* cue); void Player_CsAction_21(PlayState* play, Player* this, CsCmdActorCue* cue); void Player_CsAction_22(PlayState* play, Player* this, CsCmdActorCue* cue); void Player_CsAction_23(PlayState* play, Player* this, CsCmdActorCue* cue); -void Player_CsAction_TranslateReverse(PlayState* play, Player* this, CsCmdActorCue* cue); +void Player_CsAction_TranslateReverse(PlayState* play, Player* this, CsCmdActorCue* cue2); void Player_CsAction_25(PlayState* play, Player* this, CsCmdActorCue* cue); void Player_CsAction_26(PlayState* play, Player* this, CsCmdActorCue* cue); void Player_CsAction_27(PlayState* play, Player* this, CsCmdActorCue* cue); @@ -11475,7 +11475,6 @@ void Player_UpdateInterface(PlayState* play, Player* this) { doActionA = DO_ACTION_RETURN; } else if ((this->heldItemAction == PLAYER_IA_FISHING_ROD) && (this->unk_B28 != 0)) { doActionA = (this->unk_B28 == 2) ? DO_ACTION_REEL : DO_ACTION_NONE; - doActionA = (this->unk_B28 == 2) ? DO_ACTION_REEL : DO_ACTION_NONE; //! FAKE: duplicated statement } else if (this->stateFlags3 & PLAYER_STATE3_2000) { doActionA = DO_ACTION_DOWN; } else if ((this->doorType != PLAYER_DOORTYPE_NONE) && (this->doorType != PLAYER_DOORTYPE_STAIRCASE) && @@ -20651,28 +20650,15 @@ void Player_CsAction_23(PlayState* play, Player* this, CsCmdActorCue* cue) { } } -void Player_CsAction_TranslateReverse(PlayState* play, Player* this, CsCmdActorCue* cue) { - s32 pad; - f32 xEnd; - f32 yEnd; - f32 zEnd; - f32 xDiff; - f32 yDiff; - f32 zDiff; - f32 progress; - - xEnd = cue->endPos.x; - yEnd = cue->endPos.y; - zEnd = cue->endPos.z; - - xDiff = cue->startPos.x - xEnd; - yDiff = cue->startPos.y - yEnd; - zDiff = cue->startPos.z - zEnd; - - //! FAKE: - if (1) {} - - progress = ((f32)(cue->endFrame - play->csCtx.curFrame)) / ((f32)(cue->endFrame - cue->startFrame)); +void Player_CsAction_TranslateReverse(PlayState* play, Player* this, CsCmdActorCue* cue2) { + CsCmdActorCue* cue = cue2; + f32 xEnd = cue->endPos.x; + f32 yEnd = cue->endPos.y; + f32 zEnd = cue->endPos.z; + f32 xDiff = cue->startPos.x - xEnd; + f32 yDiff = cue->startPos.y - yEnd; + f32 zDiff = cue->startPos.z - zEnd; + f32 progress = (f32)(cue->endFrame - play->csCtx.curFrame) / (f32)(cue->endFrame - cue->startFrame); this->actor.world.pos.x = (xDiff * progress) + xEnd; this->actor.world.pos.y = (yDiff * progress) + yEnd; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index c4a25bd36c..2155bc78ba 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -16647,7 +16647,7 @@ 0x80C09C74:("EnKitan_OverrideLimbDraw",), 0x80C09C90:("EnKitan_PostLimbDraw",), 0x80C09CD0:("EnKitan_Draw",), - 0x80C09ED0:("func_80C09ED0",), + 0x80C09ED0:("BgAstrBombwall_InitCollider",), 0x80C09FEC:("BgAstrBombwall_Init",), 0x80C0A0EC:("BgAstrBombwall_Destroy",), 0x80C0A120:("func_80C0A120",),