Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc FAKE fixes #1783

Open
wants to merge 40 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
95d4aee
CutsceneCamera_UpdateSplines fake match
hensldm Jan 5, 2025
6750247
CutsceneCamera_Init -1 splineIndex
hensldm Jan 5, 2025
37c446e
Eye Point comment
hensldm Jan 5, 2025
e96e94f
func_80B781DC better fake
hensldm Jan 5, 2025
baac7c4
func_80B32F04
hensldm Jan 5, 2025
8557576
ObjSwitch_Update
hensldm Jan 5, 2025
2a9beb6
ObjSwitch_InitTrisCollider
hensldm Jan 5, 2025
1a8be38
ObjAqua_Init
hensldm Jan 5, 2025
fcbfd33
EnTrt_ItemGiven
hensldm Jan 5, 2025
f959f47
func_80C10E98 partly
hensldm Jan 5, 2025
93178d8
EnTest7_WarpCsWarp this to 1
hensldm Jan 5, 2025
0f37123
EnTest6_InvertedSoTCutscene better fake
hensldm Jan 5, 2025
6202c60
EnTest6_DrawAmmoDropRupee
hensldm Jan 5, 2025
51c96b7
EnPoSisters_MatchPlayerY
hensldm Jan 5, 2025
ba87caa
func_8095B76C
hensldm Jan 5, 2025
9fce856
EnMinifrog_Init
hensldm Jan 5, 2025
d2f7cb2
func_80A5C0B8
hensldm Jan 5, 2025
28f6980
EnKnight_UpdateEffects
hensldm Jan 5, 2025
cdc46b9
EnKnight_FlyingHeadAttack
hensldm Jan 5, 2025
3f97d7d
EnKakasi_Init
hensldm Jan 5, 2025
bafbbe6
EnInvadepoh_ModelInfo_GetNextFaceAnim
hensldm Jan 5, 2025
66bb87f
BgAstrBombwall_InitCollider like func_809CE068
hensldm Jan 5, 2025
719fd15
Player_UpdateInterface
hensldm Jan 5, 2025
480ab55
Player_CsAction_TranslateReverse
hensldm Jan 5, 2025
e3c796d
DynaPoly_AddBgActorToLookup better fake
hensldm Jan 6, 2025
37324e5
CutsceneManager_FindEntranceCsId
hensldm Jan 6, 2025
ee694d7
func_800AE930 better fake
hensldm Jan 6, 2025
3bfd942
Math3D_CylVsLineSeg better fake
hensldm Jan 6, 2025
dbf3fd4
MapDisp_InitBossRoomStorey
hensldm Jan 6, 2025
4e3cddf
Play_Init
hensldm Jan 6, 2025
ef60542
EnTimeTag_Diary_Wait better fake
hensldm Jan 6, 2025
698f171
Remove fake label from Player_SwordFromIA
hensldm Jan 7, 2025
244e323
Player_PostLimbDrawGameplay partly
hensldm Jan 7, 2025
bec3dfd
EffectBlure_AddVertex prev temp
hensldm Jan 7, 2025
04268f3
Player_PostLimbDrawGameplay attempt 2
hensldm Jan 7, 2025
59034c2
AudioMgr_StopAllSfxExceptSystem
hensldm Jan 7, 2025
d025cdb
Camera_Normal0
hensldm Jan 7, 2025
6e2e36c
Camera_Jump2
hensldm Jan 7, 2025
923a140
Camera_Normal3
hensldm Jan 7, 2025
1a0198c
PR review
hensldm Jan 8, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/z64player.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
14 changes: 10 additions & 4 deletions src/code/audio_stop_all_sfx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
}
10 changes: 4 additions & 6 deletions src/code/cutscene_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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));

Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/code/sys_math3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_actor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_bgcheck.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
195 changes: 90 additions & 105 deletions src/code/z_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);

Expand All @@ -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);
Expand All @@ -2365,54 +2363,58 @@ 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;

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;
}
switch (camera->animState) {
case 0:
case 10:
case 20:
rwData->isZero = 0;
rwData->curPitch = 0;
rwData->yPosOffset = camera->focalActorFloorHeight;

camera->animState = 1;
D_801EDC30[camera->camId].timer = 0;
rwData->flag = NORMAL3_RW_FLAG;
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;
}

camera->animState = 1;
D_801EDC30[camera->camId].timer = 0;
rwData->flag = NORMAL3_RW_FLAG;
break;

default:
break;
}

if (rwData->distTimer != 0) {
rwData->distTimer--;
}

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);
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
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;
if (bgCamFuncData->fov == -1) {
rwData->unk_1C = roData->unk_14;
} else {
phi_f0 = bgCamFuncData->fov;
if (bgCamFuncData->fov > 360) {
phi_f0 = CAM_RODATA_UNSCALE(bgCamFuncData->fov);
} else {
phi_f0 = bgCamFuncData->fov;
}
rwData->unk_1C = phi_f0;
}
rwData->unk_1C = phi_f0;
}

if (bgCamFuncData->unk_0E == -1) {
rwData->unk_2C = 0;
} else {
rwData->unk_2C = bgCamFuncData->unk_0E;
}
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;
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)) {
rwData->unk_24 = focalActorPosRot->pos.y;
}
//! FAKE:
if (1) {}
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);
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading