mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-15 20:35:13 +00:00
Merge branch 'master' into doc_pause_menu
This commit is contained in:
commit
631f6d203d
130 changed files with 2747 additions and 2299 deletions
|
@ -96,17 +96,19 @@ static DbCamera* sDbCamPtr;
|
|||
static s16 D_8016110C;
|
||||
static DbCameraAnim sDbCamAnim;
|
||||
|
||||
Vec3f* DbCamera_AddVecSph(Vec3f* out, Vec3f* in, VecSph* sph) {
|
||||
Vec3f ret;
|
||||
Vec3f vec;
|
||||
Vec3f* DbCamera_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) {
|
||||
Vec3f sum;
|
||||
Vec3f b;
|
||||
|
||||
OLib_VecSphGeoToVec3f(&vec, sph);
|
||||
OLib_VecGeoToVec3f(&b, geo);
|
||||
|
||||
ret.x = in->x + vec.x;
|
||||
ret.y = in->y + vec.y;
|
||||
ret.z = in->z + vec.z;
|
||||
*out = ret;
|
||||
return out;
|
||||
sum.x = a->x + b.x;
|
||||
sum.y = a->y + b.y;
|
||||
sum.z = a->z + b.z;
|
||||
|
||||
*dest = sum;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
Vec3f* DbCamera_CalcUpFromPitchYawRoll(Vec3f* dest, s16 pitch, s16 yaw, s16 roll) {
|
||||
|
@ -224,25 +226,28 @@ void DbCamera_Vec3SToF2(Vec3s* in, Vec3f* out) {
|
|||
}
|
||||
|
||||
void func_800B3F94(PosRot* posRot, Vec3f* vec, Vec3s* out) {
|
||||
VecSph sph;
|
||||
VecGeo geo;
|
||||
Vec3f tempVec;
|
||||
OLib_Vec3fDiffToVecSphGeo(&sph, &posRot->pos, vec);
|
||||
sph.yaw -= posRot->rot.y;
|
||||
OLib_VecSphGeoToVec3f(&tempVec, &sph);
|
||||
|
||||
OLib_Vec3fDiffToVecGeo(&geo, &posRot->pos, vec);
|
||||
geo.yaw -= posRot->rot.y;
|
||||
OLib_VecGeoToVec3f(&tempVec, &geo);
|
||||
DbCamera_Vec3FToS(&tempVec, out);
|
||||
}
|
||||
|
||||
void func_800B3FF4(PosRot* posRot, Vec3f* vec, Vec3f* out) {
|
||||
VecSph sph;
|
||||
VecGeo geo;
|
||||
Vec3f tempVec;
|
||||
|
||||
DbCamera_CopyVec3f(vec, &tempVec);
|
||||
OLib_Vec3fToVecSphGeo(&sph, &tempVec);
|
||||
sph.yaw += posRot->rot.y;
|
||||
DbCamera_AddVecSph(out, &posRot->pos, &sph);
|
||||
OLib_Vec3fToVecGeo(&geo, &tempVec);
|
||||
geo.yaw += posRot->rot.y;
|
||||
DbCamera_AddVecGeoToVec3f(out, &posRot->pos, &geo);
|
||||
}
|
||||
|
||||
void func_800B404C(PosRot* posRot, Vec3s* vec, Vec3f* out) {
|
||||
Vec3f tempVec;
|
||||
|
||||
DbCamera_Vec3SToF(vec, &tempVec);
|
||||
func_800B3FF4(posRot, &tempVec, out);
|
||||
}
|
||||
|
@ -318,7 +323,7 @@ s32 func_800B42C0(DbCamera* dbCamera, Camera* cameraPtr) {
|
|||
s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) {
|
||||
CutsceneCameraPoint* lookAt = &dbCamera->sub.lookAt[idx];
|
||||
CutsceneCameraPoint* position = &dbCamera->sub.position[idx];
|
||||
VecSph sph;
|
||||
VecGeo geo;
|
||||
Vec3f at;
|
||||
|
||||
if (dbCamera->sub.mode != 1) {
|
||||
|
@ -335,10 +340,10 @@ s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) {
|
|||
}
|
||||
dbCamera->at = at;
|
||||
}
|
||||
sph.pitch = 0x2000;
|
||||
sph.yaw -= 0x7FFF;
|
||||
sph.r = 250.0f;
|
||||
DbCamera_AddVecSph(&dbCamera->eye, &dbCamera->at, &sph);
|
||||
geo.pitch = 0x2000;
|
||||
geo.yaw -= 0x7FFF;
|
||||
geo.r = 250.0f;
|
||||
DbCamera_AddVecGeoToVec3f(&dbCamera->eye, &dbCamera->at, &geo);
|
||||
dbCamera->roll = lookAt->cameraRoll;
|
||||
dbCamera->rollDegrees = dbCamera->roll * (360.0f / 256.0f);
|
||||
dbCamera->fov = lookAt->viewAngle;
|
||||
|
@ -572,9 +577,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
char sp111;
|
||||
char sp110;
|
||||
f32 temp_f2_2;
|
||||
VecSph sp104;
|
||||
VecSph spFC;
|
||||
VecSph spF4;
|
||||
VecGeo sp104;
|
||||
VecGeo spFC;
|
||||
VecGeo spF4;
|
||||
PosRot* temp_s6;
|
||||
UNUSED Vec3f* eye;
|
||||
UNUSED Vec3f* at;
|
||||
|
@ -588,7 +593,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
Vec3f spB8;
|
||||
Vec3f spAC;
|
||||
s16 spAA;
|
||||
VecSph spA0;
|
||||
VecGeo spA0;
|
||||
|
||||
sp90 = &dbCamera->unk_54;
|
||||
temp_s6 = &cam->playerPosRot;
|
||||
|
@ -671,9 +676,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
phi_s0 = sp124;
|
||||
|
||||
if (!D_80161144) {
|
||||
OLib_Vec3fDiffToVecSphGeo(&sp104, sp7C, sp80);
|
||||
OLib_Vec3fDiffToVecGeo(&sp104, sp7C, sp80);
|
||||
} else {
|
||||
OLib_Vec3fDiffToVecSphGeo(&sp104, sp80, sp7C);
|
||||
OLib_Vec3fDiffToVecGeo(&sp104, sp80, sp7C);
|
||||
}
|
||||
|
||||
if (dbCamera->unk_44 > 100) {
|
||||
|
@ -709,11 +714,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.r = temp_f2;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.pitch = -spFC.pitch;
|
||||
spFC.yaw = sp104.yaw - 0x7FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 0xB) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -737,11 +742,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.r = -temp_f2;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.pitch = -spFC.pitch;
|
||||
spFC.yaw = sp104.yaw - 0x7FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 0xC) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -760,10 +765,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.pitch = 0;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.yaw = sp104.yaw - 0x7FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
|
||||
if (dbCamera->unk_40 == 1) {
|
||||
|
@ -778,10 +783,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.pitch = 0;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.yaw = sp104.yaw - 0x7FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 2) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -795,9 +800,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.pitch = 0x3FFF;
|
||||
spFC.yaw = sp104.yaw;
|
||||
if (!D_80161144) {
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 3) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -811,9 +816,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.pitch = -0x3FFF;
|
||||
spFC.yaw = sp104.yaw;
|
||||
if (!D_80161144) {
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 4) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -828,10 +833,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.pitch = 0;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw + 0x3FFF;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.yaw = sp104.yaw - 0x3FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 5) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -846,10 +851,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.pitch = 0;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw - 0x3FFF;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.yaw = sp104.yaw + 0x3FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 6) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -873,11 +878,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.r = temp_f2;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.pitch = -spFC.pitch;
|
||||
spFC.yaw = sp104.yaw - 0x7FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 0xB) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -902,11 +907,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
spFC.r = -temp_f2;
|
||||
if (!D_80161144) {
|
||||
spFC.yaw = sp104.yaw;
|
||||
DbCamera_AddVecSph(sp7C, sp7C, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
|
||||
} else {
|
||||
spFC.pitch = -spFC.pitch;
|
||||
spFC.yaw = sp104.yaw - 0x7FFF;
|
||||
DbCamera_AddVecSph(sp80, sp80, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
|
||||
}
|
||||
if (dbCamera->unk_40 == 0xC) {
|
||||
dbCamera->unk_44++;
|
||||
|
@ -964,18 +969,18 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
if (!D_80161144) {
|
||||
sp104.pitch += (s16)((temp_f0_5 >= 0.0f) ? pitch : -pitch);
|
||||
sp104.yaw += (s16)((temp_f2_2 >= 0.0f) ? yaw : -yaw);
|
||||
DbCamera_AddVecSph(sp80, sp7C, &sp104);
|
||||
DbCamera_AddVecGeoToVec3f(sp80, sp7C, &sp104);
|
||||
dbCamera->sub.unk_104A.x = -sp104.pitch;
|
||||
dbCamera->sub.unk_104A.y = sp104.yaw - 0x7FFF;
|
||||
} else {
|
||||
sp104.pitch += (s16)((temp_f0_5 >= 0.0f) ? -pitch : pitch);
|
||||
sp104.yaw += (s16)((temp_f2_2 >= 0.0f) ? -yaw : yaw);
|
||||
DbCamera_AddVecSph(sp7C, sp80, &sp104);
|
||||
DbCamera_AddVecGeoToVec3f(sp7C, sp80, &sp104);
|
||||
dbCamera->sub.unk_104A.x = sp104.pitch;
|
||||
dbCamera->sub.unk_104A.y = sp104.yaw;
|
||||
}
|
||||
|
||||
OLib_Vec3fDiffToVecSphGeo(&spF4, sp80, sp7C);
|
||||
OLib_Vec3fDiffToVecGeo(&spF4, sp80, sp7C);
|
||||
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw,
|
||||
CAM_DEG_TO_BINANG(dbCamera->rollDegrees));
|
||||
if (dbCamera->unk_00 == 1) {
|
||||
|
@ -985,7 +990,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
cam->at = *sp7C;
|
||||
spFC = sp104;
|
||||
spFC.r = new_var2;
|
||||
DbCamera_AddVecSph(&cam->eye, &cam->at, &spFC);
|
||||
DbCamera_AddVecGeoToVec3f(&cam->eye, &cam->at, &spFC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1370,7 +1375,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
func_8006376C(0x1E, 0x19, 2, &sp110);
|
||||
} else {
|
||||
if (D_8012CEE0[0]) {}
|
||||
OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp7C);
|
||||
OLib_Vec3fDiffToVecGeo(&spFC, sp90, sp7C);
|
||||
spFC.yaw -= cam->playerPosRot.rot.y;
|
||||
func_8006376C(3, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7
|
||||
|
@ -1383,7 +1388,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
func_8006376C(3, 0x18, 3, D_8012D0F8);
|
||||
DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6);
|
||||
func_8006376C(3, 0x19, 3, D_8012D0D4);
|
||||
OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp80);
|
||||
OLib_Vec3fDiffToVecGeo(&spFC, sp90, sp80);
|
||||
spFC.yaw -= cam->playerPosRot.rot.y;
|
||||
func_8006376C(0x1E, 0x16,
|
||||
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7
|
||||
|
@ -1413,7 +1418,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
func_800B404C(temp_s6, &(dbCamera->sub.lookAt + i)->pos, &spB8);
|
||||
func_800B404C(temp_s6, &(dbCamera->sub.position + i)->pos, &spAC);
|
||||
}
|
||||
OLib_Vec3fDiffToVecSphGeo(&spFC, &spAC, &spB8);
|
||||
OLib_Vec3fDiffToVecGeo(&spFC, &spAC, &spB8);
|
||||
spAA = dbCamera->sub.lookAt[i].cameraRoll * 0xB6;
|
||||
if (i == dbCamera->sub.unkIdx) {
|
||||
DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f,
|
||||
|
@ -1481,7 +1486,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
D_8012D110++;
|
||||
D_8012D110 %= 50;
|
||||
|
||||
OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eye, &cam->at);
|
||||
OLib_Vec3fDiffToVecGeo(&spA0, &cam->eye, &cam->at);
|
||||
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, 0xFF,
|
||||
0xFF, 0x7F, 0x2D, 0, cam->play->view.gfxCtx);
|
||||
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, 0x7F,
|
||||
|
@ -1492,7 +1497,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
|
|||
0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
|
||||
DebugDisplay_AddObject(cam->at.x, cam->at.y, cam->at.z, spA0.pitch * -1, spA0.yaw, 0, 1.5f, 2.0f, 1.0f, 0xFF,
|
||||
0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
|
||||
OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eyeNext, &cam->at);
|
||||
OLib_Vec3fDiffToVecGeo(&spA0, &cam->eyeNext, &cam->at);
|
||||
DebugDisplay_AddObject(cam->eyeNext.x, cam->eyeNext.y, cam->eyeNext.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f,
|
||||
.5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->play->view.gfxCtx);
|
||||
}
|
||||
|
@ -1845,7 +1850,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
|
|||
s16 idx3;
|
||||
char sp74[(ARRAY_COUNT(sDbCameraCuts) - 1 + 4) * 2];
|
||||
DbCameraCut sp64;
|
||||
VecSph sp5C;
|
||||
VecGeo sp5C;
|
||||
s32 (*callbacks[])(char*) = { DbCamera_SaveCallback, DbCamera_LoadCallback, DbCamera_ClearCallback };
|
||||
|
||||
func_8006376C(0xE, 5, 0, D_8012CF44); // DEMO CONTROL
|
||||
|
@ -2148,7 +2153,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
|
|||
Audio_PlaySfxGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
OLib_Vec3fDiffToVecSphGeo(&sp5C, &dbCamera->eye, &dbCamera->at);
|
||||
OLib_Vec3fDiffToVecGeo(&sp5C, &dbCamera->eye, &dbCamera->at);
|
||||
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, sp5C.pitch, sp5C.yaw,
|
||||
CAM_DEG_TO_BINANG(dbCamera->rollDegrees));
|
||||
return 2;
|
||||
|
|
|
@ -84,7 +84,7 @@ void func_800C4344(GameState* gameState) {
|
|||
}
|
||||
|
||||
if (gIsCtrlr2Valid) {
|
||||
func_8006390C(&gameState->input[1]);
|
||||
Regs_UpdateEditor(&gameState->input[1]);
|
||||
}
|
||||
|
||||
gDmaMgrVerbose = HREG(60);
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
* A nice Shift-JIS codepoint table: https://uic.io/en/charset/show/shift_jis/
|
||||
* The file `kanji` contains the 'Level 1' kanji (0x889F-0x9872), and a reworked
|
||||
* version of the non-kanji section that includes extra English and Hylian glyphs.
|
||||
*
|
||||
*
|
||||
* @note This function assumes that its argument is a valid Shift-JIS codepoint;
|
||||
* there is no range protection at all.
|
||||
*
|
||||
|
@ -26,15 +26,15 @@
|
|||
* @remark Original name: "LeoGetKadr"
|
||||
*/
|
||||
LEAF(Kanji_OffsetFromShiftJIS)
|
||||
// Characters with codepoints >= 0x8800 are kanji. Arrangement is regular,
|
||||
// Characters with codepoints >= 0x8800 are kanji. Arrangement is regular,
|
||||
// so convert index directly.
|
||||
li $at, 0x8800
|
||||
slt $at, $a0, $at
|
||||
bnez $at, .nonkanji
|
||||
// 0xBC is number of glyphs in one block in the `kanji` file:
|
||||
// 0x100 possible codepoints with the same byte1
|
||||
// - 0x40 unused at beginning
|
||||
// - 1 unused at 0x7F
|
||||
// - 0x40 unused at beginning
|
||||
// - 1 unused at 0x7F
|
||||
// - 3 unused at 0xFD, 0xFE, 0xFF
|
||||
li $a2, 0xBC
|
||||
// Get byte1 and adjust so starts at 0
|
||||
|
@ -99,7 +99,7 @@ END(Kanji_OffsetFromShiftJIS)
|
|||
* if (byte2 >= 0x40) {
|
||||
* byte2--;
|
||||
* }
|
||||
*
|
||||
*
|
||||
* if (sjis >= 0x8800) {
|
||||
* byte1 -= 0x88;
|
||||
* return (0x30A + byte2 + byte1 * 0xBC) * FONT_CHAR_TEX_SIZE;
|
||||
|
@ -134,7 +134,7 @@ DATA(sNonKanjiIndices)
|
|||
/* 0x824_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092
|
||||
/* 0x825_ */ .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
/* 0x826_ */ .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB
|
||||
/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
|
||||
/* 0x828_ */ .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4
|
||||
/* 0x829_ */ .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0
|
||||
/* 0x82A_ */ .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0
|
||||
|
|
|
@ -65,7 +65,7 @@ void Main(void* arg) {
|
|||
}
|
||||
osSyncPrintf("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
|
||||
DebugArena_Init(debugHeapStart, debugHeapSize);
|
||||
func_800636C0();
|
||||
Regs_Init();
|
||||
|
||||
R_ENABLE_ARENA_DBG = 0;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "quake.h"
|
||||
#include "vt.h"
|
||||
|
||||
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
|
||||
|
@ -2179,11 +2180,11 @@ void Actor_Draw(PlayState* play, Actor* actor) {
|
|||
Lights_BindAll(lights, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos);
|
||||
Lights_Draw(lights, play->state.gfxCtx);
|
||||
|
||||
if (actor->flags & ACTOR_FLAG_12) {
|
||||
Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.skyboxOffset.x,
|
||||
if (actor->flags & ACTOR_FLAG_IGNORE_QUAKE) {
|
||||
Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.quakeOffset.x,
|
||||
actor->world.pos.y +
|
||||
((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y),
|
||||
actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot);
|
||||
((actor->shape.yOffset * actor->scale.y) + play->mainCamera.quakeOffset.y),
|
||||
actor->world.pos.z + play->mainCamera.quakeOffset.z, &actor->shape.rot);
|
||||
} else {
|
||||
Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
|
||||
actor->world.pos.z, &actor->shape.rot);
|
||||
|
@ -3505,30 +3506,29 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) {
|
|||
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8155);
|
||||
}
|
||||
|
||||
void func_80033DB8(PlayState* play, s16 arg1, s16 arg2) {
|
||||
s16 var = Quake_Add(&play->mainCamera, 3);
|
||||
void Actor_RequestQuake(PlayState* play, s16 y, s16 duration) {
|
||||
s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3);
|
||||
|
||||
Quake_SetSpeed(var, 20000);
|
||||
Quake_SetQuakeValues(var, arg1, 0, 0, 0);
|
||||
Quake_SetCountdown(var, arg2);
|
||||
Quake_SetSpeed(quakeIndex, 20000);
|
||||
Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
|
||||
Quake_SetDuration(quakeIndex, duration);
|
||||
}
|
||||
|
||||
void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3) {
|
||||
s16 var = Quake_Add(&play->mainCamera, 3);
|
||||
void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed) {
|
||||
s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3);
|
||||
|
||||
Quake_SetSpeed(var, arg3);
|
||||
Quake_SetQuakeValues(var, arg1, 0, 0, 0);
|
||||
Quake_SetCountdown(var, arg2);
|
||||
Quake_SetSpeed(quakeIndex, speed);
|
||||
Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
|
||||
Quake_SetDuration(quakeIndex, duration);
|
||||
}
|
||||
|
||||
void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3) {
|
||||
if (arg2 >= 5) {
|
||||
void Actor_RequestQuakeAndRumble(Actor* actor, PlayState* play, s16 quakeY, s16 quakeDuration) {
|
||||
if (quakeY >= 5) {
|
||||
Rumble_Request(actor->xyzDistToPlayerSq, 255, 20, 150);
|
||||
} else {
|
||||
Rumble_Request(actor->xyzDistToPlayerSq, 180, 20, 100);
|
||||
}
|
||||
|
||||
func_80033DB8(play, arg2, arg3);
|
||||
Actor_RequestQuake(play, quakeY, quakeDuration);
|
||||
}
|
||||
|
||||
f32 Rand_ZeroFloat(f32 f) {
|
||||
|
@ -3550,9 +3550,9 @@ typedef struct {
|
|||
} DoorLockInfo; // size = 0x1C
|
||||
|
||||
static DoorLockInfo sDoorLocksInfo[] = {
|
||||
/* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, gDoorChainsDL, gDoorLockDL },
|
||||
/* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, object_bdoor_DL_001530, object_bdoor_DL_001400 },
|
||||
/* DOORLOCK_NORMAL_SPIRIT */ { 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainsDL, gDoorLockDL },
|
||||
/* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, gDoorChainDL, gDoorLockDL },
|
||||
/* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, gBossDoorChainDL, gBossDoorLockDL },
|
||||
/* DOORLOCK_NORMAL_SPIRIT */ { 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainDL, gDoorLockDL },
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -4602,7 +4602,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
|
|||
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
|
||||
Flags_GetEventChkInf(EVENTCHKINF_37)) {
|
||||
retTextId = 0x7047;
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
|
||||
retTextId = 0x701A;
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_11)) {
|
||||
if (Flags_GetInfTable(INFTABLE_C6)) {
|
||||
|
@ -4911,9 +4911,10 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
|
|||
retTextId = 0x2049;
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_15)) {
|
||||
retTextId = 0x2048;
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
|
||||
retTextId = 0x2047;
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_12) && !Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_12) &&
|
||||
!Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
|
||||
retTextId = 0x2044;
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_10)) {
|
||||
if (Flags_GetEventChkInf(EVENTCHKINF_11)) {
|
||||
|
@ -4927,7 +4928,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
|
|||
break;
|
||||
case 72:
|
||||
if (!LINK_IS_ADULT) {
|
||||
if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
|
||||
if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
|
||||
retTextId = 0x2040;
|
||||
} else if (Flags_GetInfTable(INFTABLE_94)) {
|
||||
retTextId = 0x2040;
|
||||
|
@ -4935,7 +4936,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
|
|||
retTextId = 0x203F;
|
||||
}
|
||||
} else {
|
||||
if (!Flags_GetEventChkInf(EVENTCHKINF_18)) {
|
||||
if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) {
|
||||
if (!IS_DAY) {
|
||||
retTextId = 0x204E;
|
||||
} else if (Flags_GetInfTable(INFTABLE_9A)) {
|
||||
|
|
|
@ -4239,22 +4239,21 @@ s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z
|
|||
s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
|
||||
WaterBox** outWaterBox) {
|
||||
CollisionHeader* colHeader = colCtx->colHeader;
|
||||
u32 room;
|
||||
WaterBox* curWaterBox;
|
||||
s32 room;
|
||||
WaterBox* waterBox;
|
||||
|
||||
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
|
||||
curWaterBox++) {
|
||||
room = WATERBOX_ROOM(curWaterBox->properties);
|
||||
if (room == (u32)play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
|
||||
if (!(curWaterBox->properties & WATERBOX_FLAG_19)) {
|
||||
if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) {
|
||||
if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) {
|
||||
*outWaterBox = curWaterBox;
|
||||
*ySurface = curWaterBox->ySurface;
|
||||
for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) {
|
||||
room = WATERBOX_ROOM(waterBox->properties);
|
||||
if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
|
||||
if (!(waterBox->properties & WATERBOX_FLAG_19)) {
|
||||
if (waterBox->xMin < x && x < waterBox->xMin + waterBox->xLength) {
|
||||
if (waterBox->zMin < z && z < waterBox->zMin + waterBox->zLength) {
|
||||
*outWaterBox = waterBox;
|
||||
*ySurface = waterBox->ySurface;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -4287,21 +4286,18 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos,
|
|||
waterBox = &colHeader->waterBoxes[i];
|
||||
|
||||
room = WATERBOX_ROOM(waterBox->properties);
|
||||
if (!(room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL)) {
|
||||
continue;
|
||||
}
|
||||
if (waterBox->properties & WATERBOX_FLAG_19) {
|
||||
continue;
|
||||
}
|
||||
if (!(waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength)) {
|
||||
continue;
|
||||
}
|
||||
if (!(waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength)) {
|
||||
continue;
|
||||
}
|
||||
if (pos->y - surfaceChkDist < waterBox->ySurface && waterBox->ySurface < pos->y + surfaceChkDist) {
|
||||
*outWaterBox = waterBox;
|
||||
return i;
|
||||
if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
|
||||
if (!(waterBox->properties & WATERBOX_FLAG_19)) {
|
||||
if (waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength) {
|
||||
if (waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength) {
|
||||
if (pos->y - surfaceChkDist < waterBox->ySurface &&
|
||||
waterBox->ySurface < pos->y + surfaceChkDist) {
|
||||
*outWaterBox = waterBox;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4349,22 +4345,21 @@ u32 WaterBox_GetLightIndex(CollisionContext* colCtx, WaterBox* waterBox) {
|
|||
*/
|
||||
s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) {
|
||||
CollisionHeader* colHeader = colCtx->colHeader;
|
||||
u32 room;
|
||||
WaterBox* curWaterBox;
|
||||
s32 room;
|
||||
WaterBox* waterBox;
|
||||
|
||||
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
|
||||
curWaterBox++) {
|
||||
room = WATERBOX_ROOM(curWaterBox->properties);
|
||||
if ((room == (u32)play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) {
|
||||
if (curWaterBox->properties & WATERBOX_FLAG_19) {
|
||||
if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) {
|
||||
if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) {
|
||||
*outWaterBox = curWaterBox;
|
||||
*ySurface = curWaterBox->ySurface;
|
||||
for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) {
|
||||
room = WATERBOX_ROOM(waterBox->properties);
|
||||
if ((room == play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) {
|
||||
if (waterBox->properties & WATERBOX_FLAG_19) {
|
||||
if (waterBox->xMin < x && x < (waterBox->xMin + waterBox->xLength)) {
|
||||
if (waterBox->zMin < z && z < (waterBox->zMin + waterBox->zLength)) {
|
||||
*outWaterBox = waterBox;
|
||||
*ySurface = waterBox->ySurface;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -191,7 +191,7 @@ void Message_Init(PlayState* play) {
|
|||
YREG(31) = 0;
|
||||
}
|
||||
|
||||
void func_80111070(void) {
|
||||
void Regs_InitDataImpl(void) {
|
||||
YREG(8) = 10;
|
||||
YREG(14) = 0;
|
||||
R_SCENE_CAM_TYPE = SCENE_CAM_TYPE_DEFAULT;
|
||||
|
@ -603,6 +603,6 @@ void func_80111070(void) {
|
|||
R_GAME_OVER_RUMBLE_DECREASE_RATE = -63;
|
||||
}
|
||||
|
||||
void func_80112098(PlayState* play) {
|
||||
func_80111070();
|
||||
void Regs_InitData(PlayState* play) {
|
||||
Regs_InitDataImpl();
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct {
|
|||
u16 press;
|
||||
} InputCombo; // size = 0x4
|
||||
|
||||
GameInfo* gGameInfo;
|
||||
RegEditor* gRegEditor;
|
||||
|
||||
PrintTextBufferEntry sDebugPrintTextBuffer[22];
|
||||
s16 sDebugPrintTextBufferNumUsed = 0;
|
||||
|
@ -92,18 +92,17 @@ char sRegGroupChars[REG_GROUPS] = {
|
|||
'b', // bREG
|
||||
};
|
||||
|
||||
// Initialize GameInfo
|
||||
void func_800636C0(void) {
|
||||
void Regs_Init(void) {
|
||||
s32 i;
|
||||
|
||||
gGameInfo = SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 260);
|
||||
gGameInfo->regPage = 0;
|
||||
gGameInfo->regGroup = 0;
|
||||
gGameInfo->regCur = 0;
|
||||
gGameInfo->dPadInputPrev = 0;
|
||||
gGameInfo->inputRepeatTimer = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) {
|
||||
gGameInfo->data[i] = 0;
|
||||
gRegEditor = SystemArena_MallocDebug(sizeof(RegEditor), "../z_debug.c", 260);
|
||||
gRegEditor->regPage = 0;
|
||||
gRegEditor->regGroup = 0;
|
||||
gRegEditor->regCur = 0;
|
||||
gRegEditor->dPadInputPrev = 0;
|
||||
gRegEditor->inputRepeatTimer = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(gRegEditor->data); i++) {
|
||||
gRegEditor->data[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,9 +153,9 @@ void func_80063828(GfxPrint* printer) {
|
|||
}
|
||||
|
||||
// Process inputs to control the reg editor
|
||||
void func_8006390C(Input* input) {
|
||||
void Regs_UpdateEditor(Input* input) {
|
||||
s32 dPadInputCur;
|
||||
s32 pageDataStart = ((gGameInfo->regGroup * REG_PAGES) + gGameInfo->regPage - 1) * REGS_PER_PAGE;
|
||||
s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE;
|
||||
s32 increment;
|
||||
s32 i;
|
||||
|
||||
|
@ -173,16 +172,16 @@ void func_8006390C(Input* input) {
|
|||
|
||||
// If a combo corresponding to a reg group was found
|
||||
if (i < REG_GROUPS) {
|
||||
if (i == gGameInfo->regGroup) {
|
||||
if (i == gRegEditor->regGroup) {
|
||||
// Same reg group as current, advance page index
|
||||
gGameInfo->regPage = (gGameInfo->regPage + 1) % (REG_PAGES + 1);
|
||||
gRegEditor->regPage = (gRegEditor->regPage + 1) % (REG_PAGES + 1);
|
||||
} else {
|
||||
gGameInfo->regGroup = i; // Switch current reg group
|
||||
gGameInfo->regPage = 0; // Disable reg editor
|
||||
gRegEditor->regGroup = i; // Switch current reg group
|
||||
gRegEditor->regPage = 0; // Disable reg editor
|
||||
}
|
||||
}
|
||||
} else {
|
||||
switch (gGameInfo->regPage) {
|
||||
switch (gRegEditor->regPage) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
|
@ -190,16 +189,16 @@ void func_8006390C(Input* input) {
|
|||
case 5:
|
||||
case 6:
|
||||
|
||||
if (dPadInputCur == gGameInfo->dPadInputPrev) {
|
||||
gGameInfo->inputRepeatTimer--;
|
||||
if (gGameInfo->inputRepeatTimer < 0) {
|
||||
gGameInfo->inputRepeatTimer = 1;
|
||||
if (dPadInputCur == gRegEditor->dPadInputPrev) {
|
||||
gRegEditor->inputRepeatTimer--;
|
||||
if (gRegEditor->inputRepeatTimer < 0) {
|
||||
gRegEditor->inputRepeatTimer = 1;
|
||||
} else {
|
||||
dPadInputCur ^= gGameInfo->dPadInputPrev;
|
||||
dPadInputCur ^= gRegEditor->dPadInputPrev;
|
||||
}
|
||||
} else {
|
||||
gGameInfo->inputRepeatTimer = 16;
|
||||
gGameInfo->dPadInputPrev = dPadInputCur;
|
||||
gRegEditor->inputRepeatTimer = 16;
|
||||
gRegEditor->dPadInputPrev = dPadInputCur;
|
||||
}
|
||||
|
||||
increment =
|
||||
|
@ -213,17 +212,17 @@ void func_8006390C(Input* input) {
|
|||
: -1)
|
||||
: 0;
|
||||
|
||||
gGameInfo->data[gGameInfo->regCur + pageDataStart] += increment;
|
||||
gRegEditor->data[gRegEditor->regCur + pageDataStart] += increment;
|
||||
|
||||
if (CHECK_BTN_ANY(dPadInputCur, BTN_DUP)) {
|
||||
gGameInfo->regCur--;
|
||||
if (gGameInfo->regCur < 0) {
|
||||
gGameInfo->regCur = REGS_PER_PAGE - 1;
|
||||
gRegEditor->regCur--;
|
||||
if (gRegEditor->regCur < 0) {
|
||||
gRegEditor->regCur = REGS_PER_PAGE - 1;
|
||||
}
|
||||
} else if (CHECK_BTN_ANY(dPadInputCur, BTN_DDOWN)) {
|
||||
gGameInfo->regCur++;
|
||||
if (gGameInfo->regCur >= REGS_PER_PAGE) {
|
||||
gGameInfo->regCur = 0;
|
||||
gRegEditor->regCur++;
|
||||
if (gRegEditor->regCur >= REGS_PER_PAGE) {
|
||||
gRegEditor->regCur = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,28 +240,28 @@ void func_8006390C(Input* input) {
|
|||
}
|
||||
|
||||
// Draw the reg editor
|
||||
void func_80063C04(GfxPrint* printer) {
|
||||
void Regs_DrawEditor(GfxPrint* printer) {
|
||||
s32 i;
|
||||
s32 pageStart = (gGameInfo->regPage - 1) * REGS_PER_PAGE;
|
||||
s32 pageDataStart = ((gGameInfo->regGroup * REG_PAGES) + gGameInfo->regPage - 1) * REGS_PER_PAGE;
|
||||
s32 pageStart = (gRegEditor->regPage - 1) * REGS_PER_PAGE;
|
||||
s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE;
|
||||
s32 pad;
|
||||
char regGroupName[3];
|
||||
|
||||
regGroupName[0] = 'R';
|
||||
regGroupName[1] = sRegGroupChars[gGameInfo->regGroup];
|
||||
regGroupName[1] = sRegGroupChars[gRegEditor->regGroup];
|
||||
regGroupName[2] = '\0';
|
||||
|
||||
GfxPrint_SetColor(printer, 0, 128, 128, 128);
|
||||
|
||||
for (i = 0; i < REGS_PER_PAGE; i++) {
|
||||
if (i == gGameInfo->regCur) {
|
||||
if (i == gRegEditor->regCur) {
|
||||
GfxPrint_SetColor(printer, 0, 255, 255, 255);
|
||||
}
|
||||
|
||||
GfxPrint_SetPos(printer, 3, i + 5);
|
||||
GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gGameInfo->data[i + pageDataStart]);
|
||||
GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gRegEditor->data[i + pageDataStart]);
|
||||
|
||||
if (i == gGameInfo->regCur) {
|
||||
if (i == gRegEditor->regCur) {
|
||||
GfxPrint_SetColor(printer, 0, 128, 128, 128);
|
||||
}
|
||||
}
|
||||
|
@ -286,8 +285,8 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
|
|||
func_80063828(&printer);
|
||||
}
|
||||
|
||||
if (gGameInfo->regPage != 0) {
|
||||
func_80063C04(&printer);
|
||||
if (gRegEditor->regPage != 0) {
|
||||
Regs_DrawEditor(&printer);
|
||||
}
|
||||
|
||||
sDebugPrintTextBufferNumUsed = 0;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "quake.h"
|
||||
#include "z64camera.h"
|
||||
|
||||
#include "assets/scenes/indoors/tokinoma/tokinoma_scene.h"
|
||||
|
@ -60,10 +61,10 @@ EntranceCutscene sEntranceCutsceneTable[] = {
|
|||
{ ENTR_SPOT18_0, 2, EVENTCHKINF_A6, gGoronCityIntroCs },
|
||||
{ ENTR_TOKINOMA_0, 2, EVENTCHKINF_A7, gTempleOfTimeIntroCs },
|
||||
{ ENTR_YDAN_0, 2, EVENTCHKINF_A8, gDekuTreeIntroCs },
|
||||
{ ENTR_SPOT00_11, 0, EVENTCHKINF_18, gHyruleFieldSouthEponaJumpCs },
|
||||
{ ENTR_SPOT00_13, 0, EVENTCHKINF_18, gHyruleFieldEastEponaJumpCs },
|
||||
{ ENTR_SPOT00_12, 0, EVENTCHKINF_18, gHyruleFieldWestEponaJumpCs },
|
||||
{ ENTR_SPOT00_15, 0, EVENTCHKINF_18, gHyruleFieldGateEponaJumpCs },
|
||||
{ ENTR_SPOT00_11, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldSouthEponaJumpCs },
|
||||
{ ENTR_SPOT00_13, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldEastEponaJumpCs },
|
||||
{ ENTR_SPOT00_12, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldWestEponaJumpCs },
|
||||
{ ENTR_SPOT00_15, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldGateEponaJumpCs },
|
||||
{ ENTR_SPOT00_16, 1, EVENTCHKINF_A9, gHyruleFieldGetOoTCs },
|
||||
{ ENTR_SPOT06_0, 2, EVENTCHKINF_B1, gLakeHyliaIntroCs },
|
||||
{ ENTR_SPOT09_0, 2, EVENTCHKINF_B2, gGerudoValleyIntroCs },
|
||||
|
@ -311,15 +312,15 @@ void func_80064824(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
|
|||
break;
|
||||
case 16:
|
||||
if (sp3F != 0) {
|
||||
sQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
|
||||
sQuakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
|
||||
Quake_SetSpeed(sQuakeIndex, 0x7FFF);
|
||||
Quake_SetQuakeValues(sQuakeIndex, 4, 0, 1000, 0);
|
||||
Quake_SetCountdown(sQuakeIndex, 800);
|
||||
Quake_SetPerturbations(sQuakeIndex, 4, 0, 1000, 0);
|
||||
Quake_SetDuration(sQuakeIndex, 800);
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
if (sp3F != 0) {
|
||||
Quake_RemoveFromIdx(sQuakeIndex);
|
||||
Quake_RemoveRequest(sQuakeIndex);
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
|
@ -2060,7 +2061,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) {
|
|||
}
|
||||
|
||||
if ((gSaveContext.entranceIndex == entranceCutscene->entrance) &&
|
||||
(!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_18)) &&
|
||||
(!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_EPONA_OBTAINED)) &&
|
||||
(gSaveContext.cutsceneIndex < 0xFFF0) && ((u8)gSaveContext.linkAge == requiredAge) &&
|
||||
(gSaveContext.respawnFlag <= 0)) {
|
||||
Flags_SetEventChkInf(entranceCutscene->flag);
|
||||
|
|
|
@ -48,7 +48,7 @@ void func_8006D0EC(PlayState* play, Player* player) {
|
|||
{ SCENE_SPOT20, 928, 0, -2280, 0, 2 },
|
||||
};
|
||||
|
||||
if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0))) {
|
||||
if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0))) {
|
||||
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x,
|
||||
player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x,
|
||||
player->actor.shape.rot.y, player->actor.shape.rot.z, 9);
|
||||
|
@ -67,15 +67,15 @@ void func_8006D0EC(PlayState* play, Player* player) {
|
|||
gSaveContext.minigameState = 0;
|
||||
horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1);
|
||||
horseActor->room = -1;
|
||||
} else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_18)) {
|
||||
} else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
|
||||
Actor* horseActor =
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1);
|
||||
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 389);
|
||||
} else if ((play->sceneId == gSaveContext.horseData.sceneId) &&
|
||||
(Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0)) {
|
||||
(Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1) != 0)) {
|
||||
// "Set by existence of horse %d %d %d"
|
||||
osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.sceneId,
|
||||
Flags_GetEventChkInf(EVENTCHKINF_18), DREG(1));
|
||||
Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED), DREG(1));
|
||||
|
||||
if (func_8006CFC0(gSaveContext.horseData.sceneId)) {
|
||||
Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x,
|
||||
|
@ -92,10 +92,10 @@ void func_8006D0EC(PlayState* play, Player* player) {
|
|||
osSyncPrintf(VT_RST);
|
||||
func_8006D074(play);
|
||||
}
|
||||
} else if ((play->sceneId == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
|
||||
} else if ((play->sceneId == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) {
|
||||
Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1);
|
||||
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 443);
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) {
|
||||
} else if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) {
|
||||
for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) {
|
||||
HorseSpawn* horseSpawn = &horseSpawns[i];
|
||||
if (horseSpawn->sceneId == play->sceneId) {
|
||||
|
@ -110,7 +110,7 @@ void func_8006D0EC(PlayState* play, Player* player) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
} else if (!Flags_GetEventChkInf(EVENTCHKINF_18)) {
|
||||
} else if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) {
|
||||
if ((DREG(1) == 0) && (play->sceneId == SCENE_SOUKO) && !IS_DAY) {
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1);
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void func_8006D684(PlayState* play, Player* player) {
|
|||
func_8002DE74(play, player);
|
||||
gSaveContext.horseData.sceneId = play->sceneId;
|
||||
} else if ((play->sceneId == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
|
||||
!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
|
||||
!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) {
|
||||
player->rideActor =
|
||||
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5);
|
||||
ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 582);
|
||||
|
@ -252,7 +252,7 @@ void func_8006DC68(PlayState* play, Player* player) {
|
|||
gSaveContext.entranceIndex == ENTR_SPOT00_13 || gSaveContext.entranceIndex == ENTR_SPOT00_15) &&
|
||||
(gSaveContext.respawnFlag == 0)) ||
|
||||
((play->sceneId == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
|
||||
!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0))) {
|
||||
!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0))) {
|
||||
func_8006D684(play, player);
|
||||
} else {
|
||||
func_8006D0EC(play, player);
|
||||
|
|
|
@ -147,7 +147,7 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, Vec3f* vec) {
|
|||
* a light to it. Then apply color and positional/directional info for each light
|
||||
* based on the parameters supplied by the node.
|
||||
*
|
||||
* Note: Lights in a given list can only be binded to however many free slots are
|
||||
* Note: Lights in a given list can only be bound to however many free slots are
|
||||
* available in the Lights group. This is at most 7 slots for a new group, but could be less.
|
||||
*/
|
||||
void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* vec) {
|
||||
|
@ -217,7 +217,7 @@ void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 fogNear,
|
|||
}
|
||||
|
||||
/**
|
||||
* Allocate a new Lights group and initilize the ambient color with that provided by LightContext
|
||||
* Allocate a new Lights group and initialize the ambient color with that provided by LightContext
|
||||
*/
|
||||
Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) {
|
||||
return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]);
|
||||
|
|
|
@ -93,16 +93,16 @@ Vec3f* OLib_VecSphToVec3f(Vec3f* dest, VecSph* sph) {
|
|||
}
|
||||
|
||||
/**
|
||||
* Takes the geographic point `sph` and converts it into a x,y,z position
|
||||
* Takes the geographic point `geo` and converts it into a x,y,z position
|
||||
*/
|
||||
Vec3f* OLib_VecSphGeoToVec3f(Vec3f* dest, VecSph* sph) {
|
||||
VecSph geo;
|
||||
Vec3f* OLib_VecGeoToVec3f(Vec3f* dest, VecGeo* geo) {
|
||||
VecSph sph;
|
||||
|
||||
geo.r = sph->r;
|
||||
geo.pitch = 0x3FFF - sph->pitch;
|
||||
geo.yaw = sph->yaw;
|
||||
sph.r = geo->r;
|
||||
sph.pitch = 0x3FFF - geo->pitch;
|
||||
sph.yaw = geo->yaw;
|
||||
|
||||
return OLib_VecSphToVec3f(dest, &geo);
|
||||
return OLib_VecSphToVec3f(dest, &sph);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,17 +110,16 @@ Vec3f* OLib_VecSphGeoToVec3f(Vec3f* dest, VecSph* sph) {
|
|||
*/
|
||||
VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
|
||||
VecSph sph;
|
||||
f32 distXZSq = SQ(vec->x) + SQ(vec->z);
|
||||
f32 distXZ = sqrtf(distXZSq);
|
||||
|
||||
f32 distSquared = SQ(vec->x) + SQ(vec->z);
|
||||
f32 dist = sqrtf(distSquared);
|
||||
|
||||
if ((dist == 0.0f) && (vec->y == 0.0f)) {
|
||||
if ((distXZ == 0.0f) && (vec->y == 0.0f)) {
|
||||
sph.pitch = 0;
|
||||
} else {
|
||||
sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(dist, vec->y)));
|
||||
sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(distXZ, vec->y)));
|
||||
}
|
||||
|
||||
sph.r = sqrtf(SQ(vec->y) + distSquared);
|
||||
sph.r = sqrtf(SQ(vec->y) + distXZSq);
|
||||
if ((vec->x == 0.0f) && (vec->z == 0.0f)) {
|
||||
sph.yaw = 0;
|
||||
} else {
|
||||
|
@ -135,7 +134,7 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
|
|||
/**
|
||||
* Takes the point `vec`, and converts it to a geographic coordinate
|
||||
*/
|
||||
VecSph* OLib_Vec3fToVecSphGeo(VecSph* dest, Vec3f* vec) {
|
||||
VecGeo* OLib_Vec3fToVecGeo(VecGeo* dest, Vec3f* vec) {
|
||||
VecSph sph;
|
||||
|
||||
OLib_Vec3fToVecSph(&sph, vec);
|
||||
|
@ -150,26 +149,26 @@ VecSph* OLib_Vec3fToVecSphGeo(VecSph* dest, Vec3f* vec) {
|
|||
* Takes the differences of positions `a` and `b`, and converts them to spherical coordinates
|
||||
*/
|
||||
VecSph* OLib_Vec3fDiffToVecSph(VecSph* dest, Vec3f* a, Vec3f* b) {
|
||||
Vec3f sph;
|
||||
Vec3f diff;
|
||||
|
||||
sph.x = b->x - a->x;
|
||||
sph.y = b->y - a->y;
|
||||
sph.z = b->z - a->z;
|
||||
diff.x = b->x - a->x;
|
||||
diff.y = b->y - a->y;
|
||||
diff.z = b->z - a->z;
|
||||
|
||||
return OLib_Vec3fToVecSph(dest, &sph);
|
||||
return OLib_Vec3fToVecSph(dest, &diff);
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes the difference of positions `a` and `b`, and converts them to geographic coordinates
|
||||
*/
|
||||
VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* dest, Vec3f* a, Vec3f* b) {
|
||||
Vec3f sph;
|
||||
VecGeo* OLib_Vec3fDiffToVecGeo(VecGeo* dest, Vec3f* a, Vec3f* b) {
|
||||
Vec3f diff;
|
||||
|
||||
sph.x = b->x - a->x;
|
||||
sph.y = b->y - a->y;
|
||||
sph.z = b->z - a->z;
|
||||
diff.x = b->x - a->x;
|
||||
diff.y = b->y - a->y;
|
||||
diff.z = b->z - a->z;
|
||||
|
||||
return OLib_Vec3fToVecSphGeo(dest, &sph);
|
||||
return OLib_Vec3fToVecGeo(dest, &diff);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "quake.h"
|
||||
#include "vt.h"
|
||||
#include "overlays/actors/ovl_En_Sw/z_en_sw.h"
|
||||
|
||||
|
@ -8,17 +9,19 @@ static s32 sPrevFrameCs1100 = -4096;
|
|||
|
||||
#include "z_onepointdemo_data.inc.c"
|
||||
|
||||
void OnePointCutscene_AddVecSphToVec3f(Vec3f* dst, Vec3f* src, VecSph* vecSph) {
|
||||
Vec3f out;
|
||||
Vec3f vec;
|
||||
Vec3f* OnePointCutscene_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) {
|
||||
Vec3f sum;
|
||||
Vec3f b;
|
||||
|
||||
OLib_VecSphGeoToVec3f(&vec, vecSph);
|
||||
OLib_VecGeoToVec3f(&b, geo);
|
||||
|
||||
out.x = src->x + vec.x;
|
||||
out.y = src->y + vec.y;
|
||||
out.z = src->z + vec.z;
|
||||
if (dst) {}
|
||||
*dst = out;
|
||||
sum.x = a->x + b.x;
|
||||
sum.y = a->y + b.y;
|
||||
sum.z = a->z + b.z;
|
||||
|
||||
*dest = sum;
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
s16 OnePointCutscene_Vec3fYaw(Vec3f* vec1, Vec3f* vec2) {
|
||||
|
@ -61,7 +64,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
Camera* childCam = play->cameraPtrs[subCam->childCamId];
|
||||
Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN];
|
||||
Player* player = mainCam->player;
|
||||
VecSph spD0;
|
||||
VecGeo spD0;
|
||||
s32 i;
|
||||
Vec3f spC0;
|
||||
Vec3f spB4;
|
||||
|
@ -94,7 +97,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
D_80120964[0].atTargetInit = play->view.at;
|
||||
D_80120964[0].eyeTargetInit = play->view.eye;
|
||||
D_80120964[0].fovTargetInit = play->view.fovy;
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &mainCam->at, &mainCam->eye);
|
||||
OLib_Vec3fDiffToVecGeo(&spD0, &mainCam->at, &mainCam->eye);
|
||||
D_80120964[1].eyeTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw);
|
||||
D_80120964[1].timerInit = timer - 1;
|
||||
|
||||
|
@ -107,9 +110,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = play->view.at;
|
||||
D_801209B4[0].eyeTargetInit = play->view.eye;
|
||||
D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = play->view.fovy;
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &actor->focus.pos, &mainCam->at);
|
||||
OLib_Vec3fDiffToVecGeo(&spD0, &actor->focus.pos, &mainCam->at);
|
||||
spD0.r = mainCam->dist;
|
||||
OnePointCutscene_AddVecSphToVec3f(&D_801209B4[1].eyeTargetInit, &D_801209B4[1].atTargetInit, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&D_801209B4[1].eyeTargetInit, &D_801209B4[1].atTargetInit, &spD0);
|
||||
D_801209B4[1].atTargetInit.y += 20.0f;
|
||||
|
||||
csInfo->keyFrames = D_801209B4;
|
||||
|
@ -156,10 +159,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne();
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 5);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_5);
|
||||
Quake_SetSpeed(i, 400);
|
||||
Quake_SetQuakeValues(i, 4, 5, 40, 0x3C);
|
||||
Quake_SetCountdown(i, 1600);
|
||||
Quake_SetPerturbations(i, 4, 5, 40, 0x3C);
|
||||
Quake_SetDuration(i, 1600);
|
||||
break;
|
||||
case 2280:
|
||||
csInfo->keyFrames = D_80120D4C;
|
||||
|
@ -177,10 +180,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne();
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 5);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_5);
|
||||
Quake_SetSpeed(i, 400);
|
||||
Quake_SetQuakeValues(i, 2, 3, 200, 0x32);
|
||||
Quake_SetCountdown(i, 9999);
|
||||
Quake_SetPerturbations(i, 2, 3, 200, 0x32);
|
||||
Quake_SetDuration(i, 9999);
|
||||
break;
|
||||
case 2220:
|
||||
csInfo->keyFrames = D_80120E64;
|
||||
|
@ -188,10 +191,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 5);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_5);
|
||||
Quake_SetSpeed(i, 400);
|
||||
Quake_SetQuakeValues(i, 2, 2, 50, 0);
|
||||
Quake_SetCountdown(i, 280);
|
||||
Quake_SetPerturbations(i, 2, 2, 50, 0);
|
||||
Quake_SetDuration(i, 280);
|
||||
break;
|
||||
case 2230:
|
||||
if (player->actor.world.pos.z < 1000.0f) {
|
||||
|
@ -210,10 +213,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 5);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_5);
|
||||
Quake_SetSpeed(i, 400);
|
||||
Quake_SetQuakeValues(i, 2, 2, 50, 0);
|
||||
Quake_SetCountdown(i, 60);
|
||||
Quake_SetPerturbations(i, 2, 2, 50, 0);
|
||||
Quake_SetDuration(i, 60);
|
||||
break;
|
||||
case 2350:
|
||||
csInfo->keyFrames = D_8012110C;
|
||||
|
@ -297,7 +300,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
spD0.yaw = spA0.rot.y;
|
||||
spD0.pitch = 0x3E8;
|
||||
|
||||
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
|
||||
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
|
||||
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
|
||||
func_8002DF54(play, NULL, 8);
|
||||
|
@ -308,7 +311,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
}
|
||||
break;
|
||||
case 2210:
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &player->actor.world.pos, &actor->world.pos);
|
||||
OLib_Vec3fDiffToVecGeo(&spD0, &player->actor.world.pos, &actor->world.pos);
|
||||
D_801213B4[0].eyeTargetInit.y = D_801213B4[1].eyeTargetInit.y = D_801213B4[2].eyeTargetInit.y =
|
||||
D_801213B4[2].atTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw);
|
||||
if (Rand_ZeroOne() < 0.0f) {
|
||||
|
@ -397,10 +400,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 3);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(i, 22000);
|
||||
Quake_SetQuakeValues(i, 2, 0, 200, 0);
|
||||
Quake_SetCountdown(i, 10);
|
||||
Quake_SetPerturbations(i, 2, 0, 200, 0);
|
||||
Quake_SetDuration(i, 10);
|
||||
break;
|
||||
case 3080:
|
||||
csInfo->keyFrames = D_80121774;
|
||||
|
@ -435,10 +438,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
func_8002DF54(play, NULL, 8);
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 24000);
|
||||
Quake_SetQuakeValues(i, 2, 0, 0, 0);
|
||||
Quake_SetCountdown(i, 160);
|
||||
Quake_SetPerturbations(i, 2, 0, 0, 0);
|
||||
Quake_SetDuration(i, 160);
|
||||
break;
|
||||
case 3060:
|
||||
csInfo->keyFrames = D_80121904;
|
||||
|
@ -467,10 +470,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
D_8012021C[D_801202FC - 3].pos.z +=
|
||||
(D_8012021C[D_801202FC - 2].pos.z - D_8012021C[D_801202FC - 3].pos.z) / 2;
|
||||
|
||||
i = Quake_Add(mainCam, 3);
|
||||
i = Quake_Request(mainCam, QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(i, 30000);
|
||||
Quake_SetQuakeValues(i, 2, 1, 1, 0);
|
||||
Quake_SetCountdown(i, 200);
|
||||
Quake_SetPerturbations(i, 2, 1, 1, 0);
|
||||
Quake_SetDuration(i, 200);
|
||||
break;
|
||||
case 3120:
|
||||
csInfo->keyFrames = D_80121954[-(timer + 101)];
|
||||
|
@ -520,7 +523,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
spD0.r = 250.0f;
|
||||
Actor_GetWorld(&spA0, &player->actor);
|
||||
spD0.yaw = OnePointCutscene_Vec3fYaw(&spC0, &spA0.pos) - 0x7D0;
|
||||
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
|
||||
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
|
||||
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
|
||||
Play_CopyCamera(play, CAM_ID_MAIN, subCamId);
|
||||
|
@ -534,7 +537,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
spD0.pitch = 0;
|
||||
spD0.yaw = spA0.rot.y;
|
||||
spD0.r = 150.0f;
|
||||
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
|
||||
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
|
||||
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
|
||||
subCam->roll = 0;
|
||||
|
@ -548,7 +551,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
spD0.r = 300.0f;
|
||||
spD0.yaw = spA0.rot.y;
|
||||
spD0.pitch = -0xAF0;
|
||||
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
|
||||
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
|
||||
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
|
||||
subCam->roll = 0;
|
||||
|
@ -577,16 +580,16 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
spC0.x = sp8C.pos.x;
|
||||
spC0.y = sp8C.pos.y + 70.0f;
|
||||
spC0.z = sp8C.pos.z;
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &spA0.pos, &sp8C.pos);
|
||||
OLib_Vec3fDiffToVecGeo(&spD0, &spA0.pos, &sp8C.pos);
|
||||
spD0.pitch = 0x5DC;
|
||||
spD0.r = 120.0f;
|
||||
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
|
||||
Play_CameraSetAtEye(play, CAM_ID_MAIN, &spC0, &spB4);
|
||||
|
||||
i = Quake_Add(subCam, 3);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(i, 22000);
|
||||
Quake_SetQuakeValues(i, 1, 0, 0, 0);
|
||||
Quake_SetCountdown(i, 90);
|
||||
Quake_SetPerturbations(i, 1, 0, 0, 0);
|
||||
Quake_SetDuration(i, 90);
|
||||
break;
|
||||
case 6010:
|
||||
Actor_GetWorld(&spA0, actor);
|
||||
|
@ -595,7 +598,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
spC0.y += 70.0f;
|
||||
spD0.yaw = spA0.rot.y + 0x7FFF;
|
||||
spD0.r = 300.0f;
|
||||
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
|
||||
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
|
||||
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
|
||||
subCam->roll = 0;
|
||||
|
@ -607,10 +610,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
spC0 = spA0.pos;
|
||||
func_800C0808(play, subCamId, player, CAM_SET_PIVOT_VERTICAL);
|
||||
Actor_GetWorld(&spA0, &player->actor);
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &spC0, &spA0.pos);
|
||||
OLib_Vec3fDiffToVecGeo(&spD0, &spC0, &spA0.pos);
|
||||
spD0.yaw += 0x3E8;
|
||||
spD0.r = 400.0f;
|
||||
OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
|
||||
OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
|
||||
spB4.y = spA0.pos.y + 60.0f;
|
||||
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
|
||||
subCam->roll = 0;
|
||||
|
@ -637,10 +640,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
OnePointCutscene_SetCsCamPoints(subCam, D_801208E8, D_801208E4, D_801206A0, D_80120760);
|
||||
}
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 32000);
|
||||
Quake_SetQuakeValues(i, 0, 0, 20, 0);
|
||||
Quake_SetCountdown(i, D_801208E4 - 10);
|
||||
Quake_SetPerturbations(i, 0, 0, 20, 0);
|
||||
Quake_SetDuration(i, D_801208E4 - 10);
|
||||
break;
|
||||
case 3400:
|
||||
Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3);
|
||||
|
@ -649,10 +652,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos);
|
||||
OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_801204D4[D_80120694 - 2].pos);
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 0x4E20);
|
||||
Quake_SetQuakeValues(i, 1, 0, 50, 0);
|
||||
Quake_SetCountdown(i, D_80120698 - 20);
|
||||
Quake_SetPerturbations(i, 1, 0, 50, 0);
|
||||
Quake_SetDuration(i, D_80120698 - 20);
|
||||
break;
|
||||
case 3390:
|
||||
player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = -0x3FD9;
|
||||
|
@ -668,10 +671,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
func_8002DF54(play, NULL, 8);
|
||||
Play_CopyCamera(play, subCamId, CAM_ID_MAIN);
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 32000);
|
||||
Quake_SetQuakeValues(i, 2, 0, 0, 0);
|
||||
Quake_SetCountdown(i, timer);
|
||||
Quake_SetPerturbations(i, 2, 0, 0, 0);
|
||||
Quake_SetDuration(i, timer);
|
||||
break;
|
||||
case 3290:
|
||||
D_80121F1C[0].atTargetInit = play->view.at;
|
||||
|
@ -685,10 +688,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 3);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(i, 12000);
|
||||
Quake_SetQuakeValues(i, 0, 0, 1000, 0);
|
||||
Quake_SetCountdown(i, 5);
|
||||
Quake_SetPerturbations(i, 0, 0, 1000, 0);
|
||||
Quake_SetDuration(i, 5);
|
||||
break;
|
||||
case 3340:
|
||||
D_80121FBC[0].atTargetInit = play->view.at;
|
||||
|
@ -701,10 +704,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
func_8002DF54(play, NULL, 8);
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 3);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(i, 12000);
|
||||
Quake_SetQuakeValues(i, 0, 0, 1000, 0);
|
||||
Quake_SetCountdown(i, 5);
|
||||
Quake_SetPerturbations(i, 0, 0, 1000, 0);
|
||||
Quake_SetDuration(i, 5);
|
||||
break;
|
||||
case 3360:
|
||||
csInfo->keyFrames = D_8012205C;
|
||||
|
@ -746,10 +749,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
func_8002DF54(play, NULL, 8);
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 32000);
|
||||
Quake_SetQuakeValues(i, 4, 0, 0, 0);
|
||||
Quake_SetCountdown(i, 20);
|
||||
Quake_SetPerturbations(i, 4, 0, 0, 0);
|
||||
Quake_SetDuration(i, 20);
|
||||
break;
|
||||
case 3450:
|
||||
csInfo->keyFrames = D_8012237C;
|
||||
|
@ -758,10 +761,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
func_8002DF38(play, &player->actor, 8);
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 32000);
|
||||
Quake_SetQuakeValues(i, 2, 0, 0, 0);
|
||||
Quake_SetCountdown(i, 10);
|
||||
Quake_SetPerturbations(i, 2, 0, 0, 0);
|
||||
Quake_SetDuration(i, 10);
|
||||
break;
|
||||
case 3440:
|
||||
csInfo->keyFrames = D_801223CC;
|
||||
|
@ -772,10 +775,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
player->stateFlags1 |= PLAYER_STATE1_29;
|
||||
player->actor.freezeTimer = 90;
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 32000);
|
||||
Quake_SetQuakeValues(i, 2, 0, 0, 0);
|
||||
Quake_SetCountdown(i, 10);
|
||||
Quake_SetPerturbations(i, 2, 0, 0, 0);
|
||||
Quake_SetDuration(i, 10);
|
||||
break;
|
||||
case 3430:
|
||||
csInfo->keyFrames = D_801224BC;
|
||||
|
@ -784,10 +787,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
func_8002DF54(play, NULL, 8);
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 1);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_1);
|
||||
Quake_SetSpeed(i, 32000);
|
||||
Quake_SetQuakeValues(i, 1, 0, 10, 0);
|
||||
Quake_SetCountdown(i, 20);
|
||||
Quake_SetPerturbations(i, 1, 0, 10, 0);
|
||||
Quake_SetDuration(i, 20);
|
||||
break;
|
||||
case 4100:
|
||||
csInfo->keyFrames = D_801225D4;
|
||||
|
@ -867,10 +870,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
|
||||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
|
||||
i = Quake_Add(subCam, 3);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(i, 12000);
|
||||
Quake_SetQuakeValues(i, 0, 1, 100, 0);
|
||||
Quake_SetCountdown(i, timer - 80);
|
||||
Quake_SetPerturbations(i, 0, 1, 100, 0);
|
||||
Quake_SetDuration(i, timer - 80);
|
||||
break;
|
||||
case 4220:
|
||||
csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64;
|
||||
|
@ -879,10 +882,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
|
||||
func_8002DF38(play, &player->actor, 1);
|
||||
|
||||
i = Quake_Add(subCam, 3);
|
||||
i = Quake_Request(subCam, QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(i, 12000);
|
||||
Quake_SetQuakeValues(i, 0, 1, 10, 0);
|
||||
Quake_SetCountdown(i, timer - 10);
|
||||
Quake_SetPerturbations(i, 0, 1, 10, 0);
|
||||
Quake_SetDuration(i, timer - 10);
|
||||
break;
|
||||
case 4221:
|
||||
csInfo->keyFrames = D_80122C8C;
|
||||
|
@ -970,12 +973,12 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
|
|||
D_801231B4[2].atTargetInit.z = 0.0f;
|
||||
}
|
||||
Actor_GetWorldPosShapeRot(&spA0, &player->actor);
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &spA0.pos, &mainCam->at);
|
||||
OLib_Vec3fDiffToVecGeo(&spD0, &spA0.pos, &mainCam->at);
|
||||
spD0.yaw -= spA0.rot.y;
|
||||
OLib_VecSphGeoToVec3f(&D_801231B4[3].atTargetInit, &spD0);
|
||||
OLib_Vec3fDiffToVecSphGeo(&spD0, &spA0.pos, &mainCam->eye);
|
||||
OLib_VecGeoToVec3f(&D_801231B4[3].atTargetInit, &spD0);
|
||||
OLib_Vec3fDiffToVecGeo(&spD0, &spA0.pos, &mainCam->eye);
|
||||
spD0.yaw -= spA0.rot.y;
|
||||
OLib_VecSphGeoToVec3f(&D_801231B4[3].eyeTargetInit, &spD0);
|
||||
OLib_VecGeoToVec3f(&D_801231B4[3].eyeTargetInit, &spD0);
|
||||
D_801231B4[3].fovTargetInit = mainCam->fov;
|
||||
D_801231B4[3].timerInit = timer - 50;
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "quake.h"
|
||||
#include "vt.h"
|
||||
|
||||
void* D_8012D1F0 = NULL;
|
||||
|
@ -256,7 +257,7 @@ void Play_Init(GameState* thisx) {
|
|||
this->activeCamId = CAM_ID_MAIN;
|
||||
func_8005AC48(&this->mainCamera, 0xFF);
|
||||
Sram_Init(this, &this->sramCtx);
|
||||
func_80112098(this);
|
||||
Regs_InitData(this);
|
||||
Message_Init(this);
|
||||
GameOver_Init(this);
|
||||
SfxSource_InitAll(this);
|
||||
|
@ -1182,11 +1183,11 @@ void Play_Draw(PlayState* this) {
|
|||
|
||||
if ((HREG(80) != 10) || (HREG(83) != 0)) {
|
||||
if ((this->skyboxCtx.unk_140 != 0) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) {
|
||||
Vec3f sp74;
|
||||
Vec3f quakeOffset;
|
||||
|
||||
Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(this));
|
||||
SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp74.x,
|
||||
this->view.eye.y + sp74.y, this->view.eye.z + sp74.z);
|
||||
Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(this));
|
||||
SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + quakeOffset.x,
|
||||
this->view.eye.y + quakeOffset.y, this->view.eye.z + quakeOffset.z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,280 +1,362 @@
|
|||
#include "global.h"
|
||||
#include "quake.h"
|
||||
#include "vt.h"
|
||||
|
||||
QuakeRequest sQuakeRequest[4];
|
||||
s16 D_80126250 = 1;
|
||||
typedef struct {
|
||||
/* 0x00 */ s16 index;
|
||||
/* 0x02 */ s16 duration;
|
||||
/* 0x04 */ Camera* cam;
|
||||
/* 0x08 */ u32 type;
|
||||
/* 0x0C */ s16 y;
|
||||
/* 0x0E */ s16 x;
|
||||
/* 0x10 */ s16 fov;
|
||||
/* 0x12 */ s16 upPitchOffset;
|
||||
/* 0x14 */ Vec3s orientation; // alters the orientation of the xy perturbation. Only x (pitch) and y (yaw) are used
|
||||
/* 0x1A */ s16 speed;
|
||||
/* 0x1C */ s16 isRelativeToScreen; // is the quake relative to the screen or on world coordinates
|
||||
/* 0x1E */ s16 timer;
|
||||
/* 0x20 */ s16 camId;
|
||||
} QuakeRequest; // size = 0x24
|
||||
|
||||
QuakeRequest sQuakeRequests[4];
|
||||
s16 sQuakeUnused = 1;
|
||||
s16 sQuakeRequestCount = 0;
|
||||
|
||||
s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
|
||||
NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6,
|
||||
};
|
||||
Vec3f* Quake_AddVecGeoToVec3f(Vec3f* dst, Vec3f* a, VecGeo* geo) {
|
||||
Vec3f vec;
|
||||
Vec3f b;
|
||||
|
||||
Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2) {
|
||||
Vec3f vec1;
|
||||
Vec3f vec2;
|
||||
OLib_VecGeoToVec3f(&b, geo);
|
||||
vec.x = a->x + b.x;
|
||||
vec.y = a->y + b.y;
|
||||
vec.z = a->z + b.z;
|
||||
|
||||
*dst = vec;
|
||||
|
||||
OLib_VecSphGeoToVec3f(&vec2, arg2);
|
||||
vec1.x = arg1->x + vec2.x;
|
||||
vec1.y = arg1->y + vec2.y;
|
||||
vec1.z = arg1->z + vec2.z;
|
||||
*dst = vec1;
|
||||
return dst;
|
||||
}
|
||||
|
||||
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x) {
|
||||
Vec3f* unk50 = &req->cam->at;
|
||||
Vec3f* unk5C = &req->cam->eye;
|
||||
Vec3f* at = &req->cam->at;
|
||||
Vec3f* eye = &req->cam->eye;
|
||||
Vec3f offset;
|
||||
VecGeo geo;
|
||||
VecGeo eyeToAtGeo;
|
||||
|
||||
Vec3f vec;
|
||||
VecSph struc2;
|
||||
VecSph struc1;
|
||||
Vec3f vec2;
|
||||
if (req->isRelativeToScreen) {
|
||||
offset.x = 0;
|
||||
offset.y = 0;
|
||||
offset.z = 0;
|
||||
OLib_Vec3fDiffToVecGeo(&eyeToAtGeo, eye, at);
|
||||
|
||||
if (req->unk_1C) {
|
||||
vec.x = 0;
|
||||
vec.y = 0;
|
||||
vec.z = 0;
|
||||
OLib_Vec3fDiffToVecSphGeo(&struc1, unk5C, unk50);
|
||||
struc2.r = req->y * y;
|
||||
struc2.pitch = struc1.pitch + req->unk_14.unk_00 + 0x4000;
|
||||
struc2.yaw = struc1.yaw + req->unk_14.unk_02;
|
||||
Quake_AddVec(&vec, &vec, &struc2);
|
||||
struc2.r = req->x * x;
|
||||
struc2.pitch = struc1.pitch + req->unk_14.unk_00;
|
||||
struc2.yaw = struc1.yaw + req->unk_14.unk_02 + 0x4000;
|
||||
Quake_AddVec(&vec, &vec, &struc2);
|
||||
// y shake
|
||||
geo.r = req->y * y;
|
||||
// point unit vector up, then add on `req->orientation`
|
||||
geo.pitch = eyeToAtGeo.pitch + req->orientation.x + 0x4000;
|
||||
geo.yaw = eyeToAtGeo.yaw + req->orientation.y;
|
||||
// apply y shake
|
||||
Quake_AddVecGeoToVec3f(&offset, &offset, &geo);
|
||||
|
||||
// x shake
|
||||
geo.r = req->x * x;
|
||||
// point unit vector left, then add on `req->orientation`
|
||||
geo.pitch = eyeToAtGeo.pitch + req->orientation.x;
|
||||
geo.yaw = eyeToAtGeo.yaw + req->orientation.y + 0x4000;
|
||||
// apply x shake
|
||||
Quake_AddVecGeoToVec3f(&offset, &offset, &geo);
|
||||
} else {
|
||||
vec.x = 0;
|
||||
vec.y = req->y * y;
|
||||
vec.z = 0;
|
||||
struc2.r = req->x * x;
|
||||
struc2.pitch = req->unk_14.unk_00;
|
||||
struc2.yaw = req->unk_14.unk_02;
|
||||
Quake_AddVec(&vec, &vec, &struc2);
|
||||
offset.x = 0;
|
||||
offset.y = req->y * y;
|
||||
offset.z = 0;
|
||||
geo.r = req->x * x;
|
||||
geo.pitch = req->orientation.x;
|
||||
geo.yaw = req->orientation.y;
|
||||
Quake_AddVecGeoToVec3f(&offset, &offset, &geo);
|
||||
}
|
||||
|
||||
vec2 = vec;
|
||||
shake->vec2 = vec2;
|
||||
shake->vec1 = vec2;
|
||||
shake->unk_1A = (f32)0x8000 * y;
|
||||
shake->rotZ = req->rotZ * y;
|
||||
shake->zoom = req->zoom * y;
|
||||
shake->atOffset = shake->eyeOffset = offset;
|
||||
shake->upYawOffset = 0x8000 * y;
|
||||
shake->upPitchOffset = req->upPitchOffset * y;
|
||||
shake->fovOffset = req->fov * y;
|
||||
}
|
||||
|
||||
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
|
||||
s16 Quake_CallbackType1(QuakeRequest* req, ShakeInfo* shake) {
|
||||
s32 pad;
|
||||
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_SinS(req->speed * req->countdown);
|
||||
if (req->timer > 0) {
|
||||
f32 xyOffset = Math_SinS(req->speed * req->timer);
|
||||
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
req->countdown--;
|
||||
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
|
||||
req->timer--;
|
||||
}
|
||||
return req->countdown;
|
||||
return req->timer;
|
||||
}
|
||||
|
||||
s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_SinS(req->speed * req->countdown);
|
||||
s16 Quake_CallbackType5(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->timer > 0) {
|
||||
f32 xyOffset = Math_SinS(req->speed * req->timer);
|
||||
|
||||
Quake_UpdateShakeInfo(req, shake, a, a);
|
||||
req->countdown--;
|
||||
Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset);
|
||||
req->timer--;
|
||||
}
|
||||
return req->countdown;
|
||||
return req->timer;
|
||||
}
|
||||
|
||||
s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
|
||||
s16 Quake_CallbackType6(QuakeRequest* req, ShakeInfo* shake) {
|
||||
s32 pad;
|
||||
f32 a;
|
||||
f32 xyOffset;
|
||||
|
||||
req->countdown--;
|
||||
a = Math_SinS(req->speed * ((req->countdown & 0xF) + 500));
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
req->timer--;
|
||||
xyOffset = Math_SinS(req->speed * ((req->timer & 0xF) + 500));
|
||||
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
|
||||
|
||||
// Not returning the timer ensures quake type 6 continues indefinitely until manually removed
|
||||
return 1;
|
||||
}
|
||||
|
||||
s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax);
|
||||
s16 Quake_CallbackType3(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->timer > 0) {
|
||||
f32 xyOffset = Math_SinS(req->speed * req->timer) * ((f32)req->timer / req->duration);
|
||||
|
||||
Quake_UpdateShakeInfo(req, shake, a, a);
|
||||
req->countdown--;
|
||||
Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset);
|
||||
req->timer--;
|
||||
}
|
||||
return req->countdown;
|
||||
return req->timer;
|
||||
}
|
||||
|
||||
s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Rand_ZeroOne();
|
||||
s16 Quake_CallbackType2(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->timer > 0) {
|
||||
f32 xyOffset = Rand_ZeroOne();
|
||||
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
req->countdown--;
|
||||
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
|
||||
req->timer--;
|
||||
}
|
||||
return req->countdown;
|
||||
return req->timer;
|
||||
}
|
||||
|
||||
s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->countdown > 0) {
|
||||
f32 a = Rand_ZeroOne() * ((f32)req->countdown / (f32)req->countdownMax);
|
||||
s16 Quake_CallbackType4(QuakeRequest* req, ShakeInfo* shake) {
|
||||
if (req->timer > 0) {
|
||||
f32 xyOffset = Rand_ZeroOne() * ((f32)req->timer / req->duration);
|
||||
|
||||
Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
|
||||
req->countdown--;
|
||||
Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
|
||||
req->timer--;
|
||||
}
|
||||
return req->countdown;
|
||||
return req->timer;
|
||||
}
|
||||
|
||||
s16 Quake_GetFreeIndex(void) {
|
||||
s32 i;
|
||||
s32 ret;
|
||||
s32 min = 0x10000;
|
||||
s32 index;
|
||||
s32 timerMin = 0x10000; // UINT16_MAX + 1
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
|
||||
if (sQuakeRequest[i].callbackIdx == 0) {
|
||||
ret = i;
|
||||
min = 0x20000;
|
||||
for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) {
|
||||
if (sQuakeRequests[i].type == QUAKE_TYPE_NONE) {
|
||||
index = i;
|
||||
timerMin = 0x20000; // Magic Number to indicate there was an unused quake index
|
||||
break;
|
||||
}
|
||||
|
||||
if (sQuakeRequest[i].countdown < min) {
|
||||
min = sQuakeRequest[i].countdown;
|
||||
ret = i;
|
||||
if (timerMin > sQuakeRequests[i].timer) {
|
||||
timerMin = sQuakeRequests[i].timer;
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
|
||||
if (min != 0x20000) {
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: too many request %d is changed new one !!\n" VT_RST, ret);
|
||||
if (timerMin != 0x20000) {
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: too many request %d is changed new one !!\n" VT_RST, index);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return index;
|
||||
}
|
||||
|
||||
QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) {
|
||||
s16 idx = Quake_GetFreeIndex();
|
||||
QuakeRequest* req = &sQuakeRequest[idx];
|
||||
QuakeRequest* Quake_RequestImpl(Camera* camera, u32 type) {
|
||||
s16 index = Quake_GetFreeIndex();
|
||||
QuakeRequest* req = &sQuakeRequests[index];
|
||||
|
||||
__osMemset(req, 0, sizeof(QuakeRequest));
|
||||
|
||||
req->cam = camera;
|
||||
req->camPtrIdx = camera->camId;
|
||||
req->callbackIdx = callbackIdx;
|
||||
req->unk_1C = 1;
|
||||
req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
|
||||
req->camId = camera->camId;
|
||||
req->type = type;
|
||||
req->isRelativeToScreen = true;
|
||||
|
||||
// Add a unique random identifier to the upper bits of the index
|
||||
// The `~3` assumes there are only 4 requests
|
||||
req->index = index + ((s16)(Rand_ZeroOne() * 0x10000) & ~3);
|
||||
|
||||
sQuakeRequestCount++;
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
void Quake_Remove(QuakeRequest* req) {
|
||||
req->callbackIdx = 0;
|
||||
req->countdown = -1;
|
||||
req->type = QUAKE_TYPE_NONE;
|
||||
req->timer = -1;
|
||||
sQuakeRequestCount--;
|
||||
}
|
||||
|
||||
QuakeRequest* Quake_GetRequest(s16 idx) {
|
||||
QuakeRequest* req = &sQuakeRequest[idx & 3];
|
||||
QuakeRequest* Quake_GetRequest(s16 index) {
|
||||
QuakeRequest* req = &sQuakeRequests[index & 3];
|
||||
|
||||
if (req->callbackIdx == 0) {
|
||||
if (req->type == QUAKE_TYPE_NONE) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (idx != req->randIdx) {
|
||||
if (index != req->index) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
QuakeRequest* Quake_SetValue(s16 idx, s16 valueType, s16 value) {
|
||||
QuakeRequest* req = Quake_GetRequest(idx);
|
||||
#define QUAKE_SPEED (1 << 0)
|
||||
#define QUAKE_Y_OFFSET (1 << 1)
|
||||
#define QUAKE_X_OFFSET (1 << 2)
|
||||
#define QUAKE_FOV (1 << 3)
|
||||
#define QUAKE_ROLL (1 << 4)
|
||||
#define QUAKE_ORIENTATION_PITCH (1 << 5)
|
||||
#define QUAKE_ORIENTATION_YAW (1 << 6)
|
||||
#define QUAKE_ORIENTATION_ROLL (1 << 7)
|
||||
#define QUAKE_DURATION (1 << 8)
|
||||
#define QUAKE_IS_RELATIVE_TO_SCREEN (1 << 9)
|
||||
|
||||
QuakeRequest* Quake_SetValue(s16 index, s16 valueType, s16 value) {
|
||||
QuakeRequest* req = Quake_GetRequest(index);
|
||||
|
||||
if (req == NULL) {
|
||||
return NULL;
|
||||
} else {
|
||||
switch (valueType) {
|
||||
case 1:
|
||||
req->speed = value;
|
||||
break;
|
||||
case 2:
|
||||
req->y = value;
|
||||
break;
|
||||
case 4:
|
||||
req->x = value;
|
||||
break;
|
||||
case 8:
|
||||
req->zoom = value;
|
||||
break;
|
||||
case 0x10:
|
||||
req->rotZ = value;
|
||||
break;
|
||||
case 0x20:
|
||||
req->unk_14.unk_00 = value;
|
||||
break;
|
||||
case 0x40:
|
||||
req->unk_14.unk_02 = value;
|
||||
break;
|
||||
case 0x80:
|
||||
req->unk_14.unk_04 = value;
|
||||
break;
|
||||
case 0x100:
|
||||
req->countdown = value;
|
||||
req->countdownMax = req->countdown;
|
||||
break;
|
||||
case 0x200:
|
||||
req->unk_1C = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (valueType) {
|
||||
case QUAKE_SPEED:
|
||||
req->speed = value;
|
||||
break;
|
||||
|
||||
case QUAKE_Y_OFFSET:
|
||||
req->y = value;
|
||||
break;
|
||||
|
||||
case QUAKE_X_OFFSET:
|
||||
req->x = value;
|
||||
break;
|
||||
|
||||
case QUAKE_FOV:
|
||||
req->fov = value;
|
||||
break;
|
||||
|
||||
case QUAKE_ROLL:
|
||||
req->upPitchOffset = value;
|
||||
break;
|
||||
|
||||
case QUAKE_ORIENTATION_PITCH:
|
||||
req->orientation.x = value;
|
||||
break;
|
||||
|
||||
case QUAKE_ORIENTATION_YAW:
|
||||
req->orientation.y = value;
|
||||
break;
|
||||
|
||||
case QUAKE_ORIENTATION_ROLL:
|
||||
req->orientation.z = value;
|
||||
break;
|
||||
|
||||
case QUAKE_DURATION:
|
||||
req->timer = value;
|
||||
req->duration = req->timer;
|
||||
break;
|
||||
|
||||
case QUAKE_IS_RELATIVE_TO_SCREEN:
|
||||
req->isRelativeToScreen = value;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//! @bug UB: missing return. "req" is in v0 at this point, but doing an
|
||||
//! explicit return uses an additional register.
|
||||
#ifdef AVOID_UB
|
||||
return req;
|
||||
#endif
|
||||
}
|
||||
|
||||
u32 Quake_SetSpeed(s16 idx, s16 value) {
|
||||
QuakeRequest* req = Quake_GetRequest(idx);
|
||||
/**
|
||||
* @param index
|
||||
* @param speed For periodic types only, the angular frequency of the sine wave (binang / frame)
|
||||
* @return true if successfully applied, false if the request does not exist
|
||||
*/
|
||||
u32 Quake_SetSpeed(s16 index, s16 speed) {
|
||||
QuakeRequest* req = Quake_GetRequest(index);
|
||||
|
||||
if (req != NULL) {
|
||||
req->speed = value;
|
||||
req->speed = speed;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 Quake_SetCountdown(s16 idx, s16 value) {
|
||||
QuakeRequest* req = Quake_GetRequest(idx);
|
||||
/**
|
||||
* @param index quake request index to apply
|
||||
* @param duration Number of frames to apply the quake
|
||||
* @return true if successfully applied, false if the request does not exist
|
||||
*/
|
||||
u32 Quake_SetDuration(s16 index, s16 duration) {
|
||||
QuakeRequest* req = Quake_GetRequest(index);
|
||||
|
||||
if (req != NULL) {
|
||||
req->countdown = value;
|
||||
req->countdownMax = req->countdown;
|
||||
req->duration = req->timer = duration;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
s16 Quake_GetCountdown(s16 idx) {
|
||||
QuakeRequest* req = Quake_GetRequest(idx);
|
||||
/**
|
||||
* @param index quake request index to get
|
||||
* @return Number of frames until the quake is finished
|
||||
*/
|
||||
s16 Quake_GetTimeLeft(s16 index) {
|
||||
QuakeRequest* req = Quake_GetRequest(index);
|
||||
|
||||
if (req != NULL) {
|
||||
return req->countdown;
|
||||
return req->timer;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
u32 Quake_SetQuakeValues(s16 idx, s16 y, s16 x, s16 zoom, s16 rotZ) {
|
||||
QuakeRequest* req = Quake_GetRequest(idx);
|
||||
/**
|
||||
* @param index quake request index to apply
|
||||
* @param y Apply up/down shake
|
||||
* @param x Apply left/right shake
|
||||
* @param fov Apply zooming in/out shake (binang)
|
||||
* @param roll Apply rolling shake (binang)
|
||||
* @return true if successfully applied, false if the request does not exist
|
||||
*/
|
||||
u32 Quake_SetPerturbations(s16 index, s16 y, s16 x, s16 fov, s16 roll) {
|
||||
QuakeRequest* req = Quake_GetRequest(index);
|
||||
|
||||
if (req != NULL) {
|
||||
req->y = y;
|
||||
req->x = x;
|
||||
req->zoom = zoom;
|
||||
req->rotZ = rotZ;
|
||||
req->fov = fov;
|
||||
// Visual roll is indirectly achieved by offsetting the pitch in calculating the camera "Up" vector
|
||||
req->upPitchOffset = roll;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2) {
|
||||
QuakeRequest* req = Quake_GetRequest(idx);
|
||||
/**
|
||||
* @param index quake request index to apply
|
||||
* @param isRelativeToScreen Is the quake applied relative to the screen or in absolute world coordinates
|
||||
* @param orientation orient the x/y shake to a different direction
|
||||
* @return true if successfully applied, false if the request does not exist
|
||||
*/
|
||||
u32 Quake_SetOrientation(s16 index, s16 isRelativeToScreen, Vec3s orientation) {
|
||||
QuakeRequest* req = Quake_GetRequest(index);
|
||||
|
||||
if (req != NULL) {
|
||||
req->unk_1C = arg1;
|
||||
|
||||
req->unk_14 = arg2;
|
||||
req->isRelativeToScreen = isRelativeToScreen;
|
||||
req->orientation = orientation;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -283,20 +365,20 @@ u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2) {
|
|||
void Quake_Init(void) {
|
||||
s16 i;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
|
||||
sQuakeRequest[i].callbackIdx = 0;
|
||||
sQuakeRequest[i].countdown = 0;
|
||||
for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) {
|
||||
sQuakeRequests[i].type = QUAKE_TYPE_NONE;
|
||||
sQuakeRequests[i].timer = 0;
|
||||
}
|
||||
D_80126250 = 1;
|
||||
sQuakeUnused = 1;
|
||||
sQuakeRequestCount = 0;
|
||||
}
|
||||
|
||||
s16 Quake_Add(Camera* camera, u32 callbackIdx) {
|
||||
return Quake_AddImpl(camera, callbackIdx)->randIdx;
|
||||
s16 Quake_Request(Camera* camera, u32 type) {
|
||||
return Quake_RequestImpl(camera, type)->index;
|
||||
}
|
||||
|
||||
u32 Quake_RemoveFromIdx(s16 idx) {
|
||||
QuakeRequest* req = Quake_GetRequest(idx);
|
||||
u32 Quake_RemoveRequest(s16 index) {
|
||||
QuakeRequest* req = Quake_GetRequest(index);
|
||||
|
||||
if (req != NULL) {
|
||||
Quake_Remove(req);
|
||||
|
@ -305,101 +387,120 @@ u32 Quake_RemoveFromIdx(s16 idx) {
|
|||
return false;
|
||||
}
|
||||
|
||||
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
|
||||
f32 max;
|
||||
f32 max2;
|
||||
QuakeRequest* req;
|
||||
ShakeInfo shake;
|
||||
f32 absSpeedDiv;
|
||||
s16* temp;
|
||||
u32 pad2;
|
||||
s32 idx;
|
||||
s32 ret;
|
||||
u32 eq;
|
||||
Vec3f vec;
|
||||
PlayState* play;
|
||||
s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
|
||||
NULL, // QUAKE_TYPE_NONE
|
||||
Quake_CallbackType1, // QUAKE_TYPE_1
|
||||
Quake_CallbackType2, // QUAKE_TYPE_2
|
||||
Quake_CallbackType3, // QUAKE_TYPE_3
|
||||
Quake_CallbackType4, // QUAKE_TYPE_4
|
||||
Quake_CallbackType5, // QUAKE_TYPE_5
|
||||
Quake_CallbackType6, // QUAKE_TYPE_6
|
||||
};
|
||||
|
||||
play = camera->play;
|
||||
vec.x = 0.0f;
|
||||
vec.y = 0.0f;
|
||||
vec.z = 0.0f;
|
||||
camData->rotZ = 0;
|
||||
camData->unk_1A = 0;
|
||||
camData->zoom = 0;
|
||||
camData->atOffset.x = 0.0f;
|
||||
camData->atOffset.y = 0.0f;
|
||||
camData->atOffset.z = 0.0f;
|
||||
camData->eyeOffset.x = 0.0f;
|
||||
camData->eyeOffset.y = 0.0f;
|
||||
camData->eyeOffset.z = 0.0f;
|
||||
camData->unk_20 = 0.0f;
|
||||
s16 Quake_Update(Camera* camera, ShakeInfo* camShake) {
|
||||
f32 maxCurr;
|
||||
f32 maxNext;
|
||||
ShakeInfo shake;
|
||||
QuakeRequest* req;
|
||||
f32 absSpeedDiv;
|
||||
s16* camId;
|
||||
s32 index;
|
||||
s32 numQuakesApplied;
|
||||
u32 isDifferentCamId;
|
||||
Vec3f zeroVec;
|
||||
PlayState* play = camera->play;
|
||||
|
||||
zeroVec.x = 0.0f;
|
||||
zeroVec.y = 0.0f;
|
||||
zeroVec.z = 0.0f;
|
||||
|
||||
camShake->upPitchOffset = 0;
|
||||
camShake->upYawOffset = 0;
|
||||
camShake->fovOffset = 0;
|
||||
|
||||
camShake->atOffset.x = 0.0f;
|
||||
camShake->atOffset.y = 0.0f;
|
||||
camShake->atOffset.z = 0.0f;
|
||||
|
||||
camShake->eyeOffset.x = 0.0f;
|
||||
camShake->eyeOffset.y = 0.0f;
|
||||
camShake->eyeOffset.z = 0.0f;
|
||||
|
||||
camShake->maxOffset = 0.0f;
|
||||
|
||||
if (sQuakeRequestCount == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
|
||||
req = &sQuakeRequest[idx];
|
||||
if (req->callbackIdx != 0) {
|
||||
if (play->cameraPtrs[req->camPtrIdx] == NULL) {
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST,
|
||||
req->camPtrIdx);
|
||||
Quake_Remove(req);
|
||||
} else {
|
||||
temp = &camera->camId;
|
||||
eq = req->cam->camId != *temp;
|
||||
absSpeedDiv = ABS(req->speed) / (f32)0x8000;
|
||||
if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
|
||||
Quake_Remove(req);
|
||||
} else if (eq == 0) {
|
||||
if (fabsf(camData->atOffset.x) < fabsf(shake.vec1.x)) {
|
||||
camData->atOffset.x = shake.vec1.x;
|
||||
}
|
||||
if (fabsf(camData->atOffset.y) < fabsf(shake.vec1.y)) {
|
||||
camData->atOffset.y = shake.vec1.y;
|
||||
}
|
||||
if (fabsf(camData->atOffset.z) < fabsf(shake.vec1.z)) {
|
||||
camData->atOffset.z = shake.vec1.z;
|
||||
}
|
||||
if (fabsf(camData->eyeOffset.x) < fabsf(shake.vec2.x)) {
|
||||
camData->eyeOffset.x = shake.vec2.x;
|
||||
}
|
||||
if (fabsf(camData->eyeOffset.y) < fabsf(shake.vec2.y)) {
|
||||
camData->eyeOffset.y = shake.vec2.y;
|
||||
}
|
||||
if (fabsf(camData->eyeOffset.z) < fabsf(shake.vec2.z)) {
|
||||
camData->eyeOffset.z = shake.vec2.z;
|
||||
}
|
||||
if (camData->rotZ < shake.rotZ) {
|
||||
camData->rotZ = shake.rotZ;
|
||||
camData->unk_1A = shake.unk_1A;
|
||||
}
|
||||
if (camData->zoom < shake.zoom) {
|
||||
camData->zoom = shake.zoom;
|
||||
}
|
||||
|
||||
max = OLib_Vec3fDist(&shake.vec1, &vec) * absSpeedDiv;
|
||||
max2 = OLib_Vec3fDist(&shake.vec2, &vec) * absSpeedDiv;
|
||||
if (max < max2) {
|
||||
max = max2;
|
||||
}
|
||||
max2 = (camData->rotZ * 0.005f) * absSpeedDiv;
|
||||
if (max < max2) {
|
||||
max = max2;
|
||||
}
|
||||
max2 = (camData->zoom * 0.005f) * absSpeedDiv;
|
||||
if (max < max2) {
|
||||
max = max2;
|
||||
}
|
||||
if (camData->unk_20 < max) {
|
||||
camData->unk_20 = max;
|
||||
}
|
||||
|
||||
ret++;
|
||||
}
|
||||
}
|
||||
numQuakesApplied = 0;
|
||||
for (index = 0; index < ARRAY_COUNT(sQuakeRequests); index++) {
|
||||
req = &sQuakeRequests[index];
|
||||
if (req->type == QUAKE_TYPE_NONE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (play->cameraPtrs[req->camId] == NULL) {
|
||||
osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST, req->camId);
|
||||
Quake_Remove(req);
|
||||
continue;
|
||||
}
|
||||
|
||||
camId = &camera->camId;
|
||||
isDifferentCamId = req->cam->camId != *camId;
|
||||
absSpeedDiv = (f32)ABS(req->speed) / 0x8000;
|
||||
|
||||
if (sQuakeCallbacks[req->type](req, &shake) == 0) {
|
||||
// Quake has reached the end of its timer.
|
||||
Quake_Remove(req);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isDifferentCamId) {
|
||||
// Quake is attached to a different camId
|
||||
continue;
|
||||
}
|
||||
|
||||
if (fabsf(camShake->atOffset.x) < fabsf(shake.atOffset.x)) {
|
||||
camShake->atOffset.x = shake.atOffset.x;
|
||||
}
|
||||
if (fabsf(camShake->atOffset.y) < fabsf(shake.atOffset.y)) {
|
||||
camShake->atOffset.y = shake.atOffset.y;
|
||||
}
|
||||
if (fabsf(camShake->atOffset.z) < fabsf(shake.atOffset.z)) {
|
||||
camShake->atOffset.z = shake.atOffset.z;
|
||||
}
|
||||
if (fabsf(camShake->eyeOffset.x) < fabsf(shake.eyeOffset.x)) {
|
||||
camShake->eyeOffset.x = shake.eyeOffset.x;
|
||||
}
|
||||
if (fabsf(camShake->eyeOffset.y) < fabsf(shake.eyeOffset.y)) {
|
||||
camShake->eyeOffset.y = shake.eyeOffset.y;
|
||||
}
|
||||
if (fabsf(camShake->eyeOffset.z) < fabsf(shake.eyeOffset.z)) {
|
||||
camShake->eyeOffset.z = shake.eyeOffset.z;
|
||||
}
|
||||
if (camShake->upPitchOffset < shake.upPitchOffset) {
|
||||
camShake->upPitchOffset = shake.upPitchOffset;
|
||||
camShake->upYawOffset = shake.upYawOffset;
|
||||
}
|
||||
if (camShake->fovOffset < shake.fovOffset) {
|
||||
camShake->fovOffset = shake.fovOffset;
|
||||
}
|
||||
|
||||
maxCurr = OLib_Vec3fDist(&shake.atOffset, &zeroVec) * absSpeedDiv;
|
||||
maxNext = OLib_Vec3fDist(&shake.eyeOffset, &zeroVec) * absSpeedDiv;
|
||||
maxCurr = CLAMP_MIN(maxCurr, maxNext);
|
||||
|
||||
maxNext = camShake->upPitchOffset * (1.0f / 200.0f) * absSpeedDiv;
|
||||
maxCurr = CLAMP_MIN(maxCurr, maxNext);
|
||||
|
||||
maxNext = camShake->fovOffset * (1.0f / 200.0f) * absSpeedDiv;
|
||||
maxCurr = CLAMP_MIN(maxCurr, maxNext);
|
||||
|
||||
if (camShake->maxOffset < maxCurr) {
|
||||
camShake->maxOffset = maxCurr;
|
||||
}
|
||||
|
||||
numQuakesApplied++;
|
||||
}
|
||||
return ret;
|
||||
return numQuakesApplied;
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) {
|
|||
Vec3f quakeOffset;
|
||||
|
||||
gfx = POLY_OPA_DISP;
|
||||
Camera_GetSkyboxOffset(&quakeOffset, activeCam);
|
||||
Camera_GetQuakeOffset(&quakeOffset, activeCam);
|
||||
Room_DrawBackground2D(&gfx, roomShape->source, roomShape->tlut, roomShape->width, roomShape->height,
|
||||
roomShape->fmt, roomShape->siz, roomShape->tlutMode, roomShape->tlutCount,
|
||||
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,
|
||||
|
@ -487,7 +487,7 @@ void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) {
|
|||
Vec3f quakeOffset;
|
||||
|
||||
gfx = POLY_OPA_DISP;
|
||||
Camera_GetSkyboxOffset(&quakeOffset, activeCam);
|
||||
Camera_GetQuakeOffset(&quakeOffset, activeCam);
|
||||
Room_DrawBackground2D(&gfx, bgEntry->source, bgEntry->tlut, bgEntry->width, bgEntry->height,
|
||||
bgEntry->fmt, bgEntry->siz, bgEntry->tlutMode, bgEntry->tlutCount,
|
||||
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "global.h"
|
||||
#include "quake.h"
|
||||
|
||||
#include "assets/scenes/overworld/spot00/spot00_scene.h"
|
||||
#include "assets/scenes/overworld/spot00/spot00_room_0.h"
|
||||
|
@ -585,20 +586,20 @@ void Scene_DrawConfigGanonCastleExterior(PlayState* play) {
|
|||
|
||||
// Screen Shake for Ganon's Tower Collapse
|
||||
void func_8009BEEC(PlayState* play) {
|
||||
s32 var;
|
||||
s32 quakeIndex;
|
||||
|
||||
if (play->gameplayFrames % 128 == 13) {
|
||||
var = Quake_Add(GET_ACTIVE_CAM(play), 2);
|
||||
Quake_SetSpeed(var, 10000);
|
||||
Quake_SetQuakeValues(var, 4, 0, 0, 0);
|
||||
Quake_SetCountdown(var, 127);
|
||||
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_2);
|
||||
Quake_SetSpeed(quakeIndex, 10000);
|
||||
Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0);
|
||||
Quake_SetDuration(quakeIndex, 127);
|
||||
}
|
||||
|
||||
if ((play->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) {
|
||||
var = Quake_Add(GET_ACTIVE_CAM(play), 3);
|
||||
Quake_SetSpeed(var, 32000.0f + (Rand_ZeroOne() * 3000.0f));
|
||||
Quake_SetQuakeValues(var, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0);
|
||||
Quake_SetCountdown(var, 48.0f - (Rand_ZeroOne() * 15.0f));
|
||||
quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
|
||||
Quake_SetSpeed(quakeIndex, 32000.0f + (Rand_ZeroOne() * 3000.0f));
|
||||
Quake_SetPerturbations(quakeIndex, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0);
|
||||
Quake_SetDuration(quakeIndex, 48.0f - (Rand_ZeroOne() * 15.0f));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -312,7 +312,7 @@ static s16 sDungeonEntrances[] = {
|
|||
* - If health is less than 3 hearts, give 3 hearts
|
||||
* - If either scarecrow song is set, copy them from save context to the proper location
|
||||
* - Handle a case where the player saved and quit after zelda cutscene but didnt get the song
|
||||
* - Give and equip master sword if player is adult and doesnt have kokiri sword (bug?)
|
||||
* - Give and equip master sword if player is adult and doesn't have master sword
|
||||
* - Revert any trade items that spoil
|
||||
*/
|
||||
void Sram_OpenSave(SramContext* sramCtx) {
|
||||
|
|
|
@ -12,11 +12,11 @@ void View_ViewportToVp(Vp* dest, Viewport* src) {
|
|||
|
||||
dest->vp.vscale[0] = width * 2;
|
||||
dest->vp.vscale[1] = height * 2;
|
||||
dest->vp.vscale[2] = 0x01FF;
|
||||
dest->vp.vscale[2] = G_MAXZ / 2;
|
||||
dest->vp.vscale[3] = 0;
|
||||
dest->vp.vtrans[0] = ((src->leftX * 2) + width) * 2;
|
||||
dest->vp.vtrans[1] = ((src->topY * 2) + height) * 2;
|
||||
dest->vp.vtrans[2] = 0x01FF;
|
||||
dest->vp.vtrans[2] = G_MAXZ / 2;
|
||||
dest->vp.vtrans[3] = 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue