From 180227e7bb15bbaed77de95715ea103ac473480b Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 19 May 2023 00:29:50 +1000 Subject: [PATCH] Quake & Distortion Docs (Again) + Math Cleanup (Camera Prep) (#1129) * more quake docs * more docs * more distortion docs * math cleanup * fix header * cleanup * only partial PR review * PR Suggestions * fix master merge * reverb angle change macros * more revert * fix enum --- include/functions.h | 20 +- include/z64actor.h | 4 +- include/z64camera.h | 14 +- include/z64math.h | 30 +- include/z64quake.h | 90 ++- src/code/cutscene_camera.c | 40 +- src/code/z_actor.c | 25 +- src/code/z_camera.c | 4 +- src/code/z_camera_data.inc.c | 4 +- src/code/z_demo.c | 18 +- src/code/z_olib.c | 104 +-- src/code/z_play.c | 28 +- src/code/z_quake.c | 654 ++++++++++-------- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c | 18 +- .../ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c | 6 +- .../z_bg_ikana_rotaryroom.c | 18 +- .../ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c | 6 +- .../ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c | 21 +- .../ovl_Bg_Open_Shutter/z_bg_open_shutter.c | 6 +- src/overlays/actors/ovl_Boss_03/z_boss_03.c | 4 +- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 6 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 6 +- src/overlays/actors/ovl_En_Bat/z_en_bat.c | 2 +- .../actors/ovl_En_Bigpamet/z_en_bigpamet.c | 6 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 2 +- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 6 +- src/overlays/actors/ovl_En_Bom/z_en_bom.c | 7 +- src/overlays/actors/ovl_En_Crow/z_en_crow.c | 2 +- src/overlays/actors/ovl_En_Death/z_en_death.c | 2 +- src/overlays/actors/ovl_En_Egol/z_en_egol.c | 46 +- .../actors/ovl_En_Firefly/z_en_firefly.c | 2 +- .../actors/ovl_En_Firefly2/z_en_firefly2.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 10 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 6 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 40 +- src/overlays/actors/ovl_En_Gs/z_en_gs.h | 4 +- src/overlays/actors/ovl_En_Ishi/z_en_ishi.c | 6 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 8 +- .../actors/ovl_En_Minislime/z_en_minislime.c | 16 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 14 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 3 +- .../ovl_En_Stop_heishi/z_en_stop_heishi.c | 2 +- .../actors/ovl_En_Tanron5/z_en_tanron5.c | 2 +- src/overlays/actors/ovl_En_Test6/z_en_test6.c | 16 +- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 2 +- src/overlays/actors/ovl_En_Twig/z_en_twig.c | 1 + src/overlays/actors/ovl_En_Wiz/z_en_wiz.c | 4 +- src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c | 6 +- .../actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c | 6 +- .../actors/ovl_Obj_Dhouse/z_obj_dhouse.c | 18 +- src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c | 2 +- .../actors/ovl_Obj_Hariko/z_obj_hariko.c | 2 +- .../ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c | 12 +- src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 6 +- .../ovl_Obj_Tokei_Step/z_obj_tokei_step.c | 10 +- .../actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c | 4 +- tools/disasm/functions.txt | 56 +- tools/disasm/variables.txt | 8 +- tools/namefixer.py | 23 +- tools/sizes/code_functions.csv | 46 +- 62 files changed, 811 insertions(+), 729 deletions(-) diff --git a/include/functions.h b/include/functions.h index 7e548e742f..b170462882 100644 --- a/include/functions.h +++ b/include/functions.h @@ -739,9 +739,9 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 s32 Actor_IsTargeted(PlayState* play, Actor* actor); s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor); void func_800BC620(Vec3f* pos, Vec3f* scale, u8 alpha, PlayState* play); -void Actor_AddQuake(PlayState* play, s16 verticalMag, s16 countdown); -void Actor_AddQuakeWithSpeed(PlayState* play, s16 verticalMag, s16 countdown, s16 speed); -void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown); +void Actor_RequestQuake(PlayState* play, s16 y, s16 duration); +void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed); +void Actor_RequestQuakeAndRumble(Actor* actor, PlayState* play, s16 quakeY, s16 quakeDuration); void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type); void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 bufFlag, u16 duration); Hilite* func_800BCBF4(Vec3f* arg0, PlayState* play); @@ -833,7 +833,7 @@ s16 Camera_ClearFlags(Camera* camera, s16 flags); s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 bgCamIndex, f32 arg3, s16 timer1, s16 timer2, s16 timer3); s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera); // UNK_TYPE4 func_800E01AC(void); -Vec3f* Camera_GetQuakeOffset(Vec3f* dst, Camera* camera); +Vec3f* Camera_GetQuakeOffset(Vec3f* quakeOffset, Camera* camera); // void func_800E01DC(s32 param_1, u32 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); // UNK_TYPE4 func_800E0228(void); void func_800E0238(Camera* camera); @@ -1462,17 +1462,17 @@ f32 OLib_ClampMinDist(f32 val, f32 min); f32 OLib_ClampMaxDist(f32 val, f32 max); Vec3f* OLib_Vec3fDistNormalize(Vec3f* dest, Vec3f* a, Vec3f* b); Vec3f* OLib_VecSphToVec3f(Vec3f* dest, VecSph* sph); -Vec3f* OLib_VecSphGeoToVec3f(Vec3f* dest, VecSph* sph); +Vec3f* OLib_VecGeoToVec3f(Vec3f* dest, VecGeo* geo); VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec); -VecSph* OLib_Vec3fToVecSphGeo(VecSph* dest, Vec3f* vec); +VecGeo* OLib_Vec3fToVecGeo(VecGeo* dest, Vec3f* vec); VecSph* OLib_Vec3fDiffToVecSph(VecSph* dest, Vec3f* a, Vec3f* b); -VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* dest, Vec3f* a, Vec3f* b); -Vec3f* OLib_VecSphAddToVec3f(Vec3f* dest, Vec3f* a, VecSph* sph); +VecGeo* OLib_Vec3fDiffToVecGeo(VecGeo* dest, Vec3f* a, Vec3f* b); +Vec3f* OLib_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo); Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b); Vec3f* OLib_Vec3fDiffDegF(Vec3f* dest, Vec3f* a, Vec3f* b); Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b); -void OLib_DbCameraVec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); -void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); +void OLib_Vec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); +void OLib_Vec3fAdd(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode); Gfx* Gfx_DrawTexRectRGBA16(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); Gfx* Gfx_DrawTexRectIA8(Gfx* gfx, TexturePtr texture, s16 textureWidth, s16 textureHeight, s16 rectLeft, s16 rectTop, s16 rectWidth, s16 rectHeight, u16 dsdx, u16 dtdy); diff --git a/include/z64actor.h b/include/z64actor.h index 4722e84657..3a646fe8fd 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -532,8 +532,8 @@ typedef enum { #define ACTOR_FLAG_400 (1 << 10) // #define ACTOR_FLAG_800 (1 << 11) -// -#define ACTOR_FLAG_1000 (1 << 12) +// Actor will not shake when a quake occurs +#define ACTOR_FLAG_IGNORE_QUAKE (1 << 12) // #define ACTOR_FLAG_2000 (1 << 13) // diff --git a/include/z64camera.h b/include/z64camera.h index 3205496e73..d0a3ac1ce4 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -374,7 +374,7 @@ typedef struct { /* 0x00 */ Vec3f pos; /* 0x0C */ Vec3f norm; /* 0x18 */ CollisionPoly* poly; - /* 0x1C */ VecSph sphNorm; + /* 0x1C */ VecGeo geoNorm; /* 0x24 */ s32 bgId; } CameraCollision; // size = 0x28 @@ -1244,8 +1244,8 @@ typedef struct { typedef struct { /* 0x00 */ Vec3f unk_00; - /* 0x0C */ VecSph unk_0C; - /* 0x14 */ VecSph unk_14; + /* 0x0C */ VecGeo unk_0C; + /* 0x14 */ VecGeo unk_14; /* 0x1C */ s16 unk_1C; } Demo1ReadWriteData; // size = 0x20 @@ -1319,7 +1319,7 @@ typedef struct { /* 0x0C */ f32 unk_0C; /* 0x10 */ f32 unk_10; /* 0x14 */ f32 unk_14; - /* 0x18 */ VecSph unk_18; + /* 0x18 */ VecGeo unk_18; /* 0x20 */ s16 unk_20; /* 0x22 */ s16 timer; } Demo4ReadWriteData; // size = 0x24 @@ -1345,7 +1345,7 @@ typedef struct { /* 0x10 */ f32 unk_10; /* 0x14 */ f32 unk_14; /* 0x18 */ f32 unk_18; - /* 0x1C */ VecSph unk_1C; + /* 0x1C */ VecGeo unk_1C; /* 0x24 */ s16 unk_24; /* 0x26 */ s16 timer; } Demo5ReadWriteData; // size = 0x28 @@ -1367,8 +1367,8 @@ typedef struct { typedef struct { /* 0x00 */ f32 unk_00; - /* 0x04 */ VecSph subAtToEye; - /* 0x0C */ VecSph atToEye; + /* 0x04 */ VecGeo subAtToEye; + /* 0x0C */ VecGeo atToEye; /* 0x14 */ s16 unk_14; /* 0x16 */ s16 unk_16; /* 0x18 */ s16 unk_18; diff --git a/include/z64math.h b/include/z64math.h index d47a01a647..8df81454ad 100644 --- a/include/z64math.h +++ b/include/z64math.h @@ -87,12 +87,32 @@ typedef struct { /* 0x0C */ Vec3f b; } LineSegment; // size = 0x18 -// Defines a point in the spherical coordinate system typedef struct { - /* 0x0 */ f32 r; // radius - /* 0x4 */ s16 pitch; // polar (zenith) angle - /* 0x6 */ s16 yaw; // azimuthal angle -} VecSph; // size = 0x8 + /* 0x0 */ f32 r; // radius + /* 0x4 */ s16 pitch; // depends on coordinate system. See below. + /* 0x6 */ s16 yaw; // azimuthal angle +} VecSphGeo; // size = 0x8 + +// Defines a point in the spherical coordinate system. +// Pitch is 0 along the positive y-axis (up) +typedef VecSphGeo VecSph; + +// Defines a point in the geographic coordinate system. +// Pitch is 0 along the xz-plane (horizon) +typedef VecSphGeo VecGeo; + +// To be used with OLib_Vec3fAdd() +typedef enum { + /* 0 */ OLIB_ADD_COPY, // Copy `b` to dest + /* 1 */ OLIB_ADD_OFFSET, // Add `a` and `b` to dest, and also add the yaw of `a` to the dest + /* 2 */ OLIB_ADD, // Add `a` and `b` to dest +} OlibVec3fAdd; + +typedef enum { + /* 0 */ OLIB_DIFF_COPY, // Copy `b` to dest + /* 1 */ OLIB_DIFF_OFFSET, // Sub `a` and `b` to dest, and also subs the yaw of `a` to the dest + /* 2 */ OLIB_DIFF, // Sub `a` and `b` to dest +} OlibVec3fDiff; #define LERPIMP(v0, v1, t) ((v0) + (((v1) - (v0)) * (t))) #define F32_LERP(v0, v1, t) ((1.0f - (t)) * (f32)(v0) + (t) * (f32)(v1)) diff --git a/include/z64quake.h b/include/z64quake.h index f0bd401fc3..0150b54047 100644 --- a/include/z64quake.h +++ b/include/z64quake.h @@ -1,68 +1,64 @@ #ifndef Z64QUAKE_H #define Z64QUAKE_H +#include "z64camera.h" #include "z64math.h" struct PlayState; -struct Camera; typedef struct { /* 0x00 */ Vec3f atOffset; /* 0x0C */ Vec3f eyeOffset; - /* 0x18 */ s16 rollOffset; - /* 0x1A */ s16 zoom; - /* 0x1C */ f32 max; // Set to scaled max data of struct (mag for Vec3f), never used -} QuakeCamCalc; // size = 0x20 - -#define QUAKE_SPEED (1 << 0) -#define QUAKE_VERTICAL_MAG (1 << 1) -#define QUAKE_HORIZONTAL_MAG (1 << 2) -#define QUAKE_ZOOM (1 << 3) -#define QUAKE_ROLL_OFFSET (1 << 4) -#define QUAKE_SHAKE_PLANE_OFFSET_X (1 << 5) -#define QUAKE_SHAKE_PLANE_OFFSET_Y (1 << 6) -#define QUAKE_SHAKE_PLANE_OFFSET_Z (1 << 7) -#define QUAKE_COUNTDOWN (1 << 8) -#define QUAKE_IS_SHAKE_PERPENDICULAR (1 << 9) + /* 0x18 */ s16 upRollOffset; + /* 0x1A */ s16 fovOffset; + /* 0x1C */ f32 maxOffset; // Set to scaled max data of struct (mag for Vec3f), never used +} ShakeInfo; // size = 0x20 typedef enum { - /* 1 */ QUAKE_TYPE_1 = 1, - /* 2 */ QUAKE_TYPE_2, - /* 3 */ QUAKE_TYPE_3, - /* 4 */ QUAKE_TYPE_4, - /* 5 */ QUAKE_TYPE_5, - /* 6 */ QUAKE_TYPE_6 + /* 0 */ QUAKE_TYPE_NONE, + /* 1 */ QUAKE_TYPE_1, // Periodic, sustaining, random X perturbations + /* 2 */ QUAKE_TYPE_2, // Aperiodic, sustaining, random X perturbations + /* 3 */ QUAKE_TYPE_3, // Periodic, decaying + /* 4 */ QUAKE_TYPE_4, // Aperiodic, decaying, random X perturbations + /* 5 */ QUAKE_TYPE_5, // Periodic, sustaining + /* 6 */ QUAKE_TYPE_6 // See below } QuakeType; -u32 Quake_SetValue(s16 quakeIndex, s16 valueType, s16 value); -u32 Quake_SetSpeed(s16 quakeIndex, s16 speed); -u32 Quake_SetCountdown(s16 quakeIndex, s16 countdown); -s16 Quake_GetCountdown(s16 quakeIndex); -u32 Quake_SetQuakeValues(s16 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset); -u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset); -s16 Quake_Add(Camera* camera, u32 type); -s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData); -u32 Quake_Remove(s16 index); -s32 Quake_NumActiveQuakes(void); +s16 Quake_Request(Camera* camera, u32 type); + +u32 Quake_SetSpeed(s16 index, s16 speed); +u32 Quake_SetPerturbations(s16 index, s16 y, s16 x, s16 fov, s16 roll); +u32 Quake_SetDuration(s16 index, s16 duration); +u32 Quake_SetOrientation(s16 index, s16 isRelativeToScreen, Vec3s orientation); + +s16 Quake_GetTimeLeft(s16 index); +s32 Quake_GetNumActiveQuakes(void); +u32 Quake_RemoveRequest(s16 index); + void Quake_Init(void); +s16 Quake_Update(Camera* camera, ShakeInfo* camShake); -#define DISTORTION_TYPE_0 (1 << 0) -#define DISTORTION_TYPE_NON_ZORA_SWIMMING (1 << 2) -#define DISTORTION_TYPE_ZORA_SWIMMING (1 << 3) -#define DISTORTION_TYPE_UNDERWATER_ENTRY (1 << 4) -#define DISTORTION_TYPE_5 (1 << 5) -#define DISTORTION_TYPE_6 (1 << 6) -#define DISTORTION_TYPE_7 (1 << 7) -#define DISTORTION_TYPE_8 (1 << 8) -#define DISTORTION_TYPE_9 (1 << 9) -#define DISTORTION_TYPE_A (1 << 10) -#define DISTORTION_TYPE_B (1 << 11) +#define DISTORTION_TYPE_HOT_ROOM (1 << 0) // Hot Room +#define DISTORTION_TYPE_NON_ZORA_SWIMMING (1 << 2) // Non-Zora swimming +#define DISTORTION_TYPE_ZORA_SWIMMING (1 << 3) // Zora swimming, also used for boss warp pad part 1 -void Distortion_SetCountdown(s16 countdown); -s16 Distortion_GetCountdown(void); +#define DISTORTION_TYPE_UNDERWATER_ENTRY (1 << 4) // Entering water, also used for boss warp pad part 2 +#define DISTORTION_TYPE_SONG_OF_TIME (1 << 5) // Song of Time effects +#define DISTORTION_TYPE_ZORA_KICK (1 << 6) // PLAYER_MWA_ZORA_PUNCH_KICK +#define DISTORTION_TYPE_UNK_ATTACK (1 << 7) // Impossible to achieve, inferred to be another `PLAYER_MWA_`, + +#define DISTORTION_TYPE_GORON_BUTT (1 << 8) // PLAYER_MWA_GORON_PUNCH_BUTT +#define DISTORTION_TYPE_MASK_TRANSFORM_1 (1 << 9) // Mask transformation part 1 +#define DISTORTION_TYPE_BOSS_WARP (1 << 10) // Boss warp pad part 3 +#define DISTORTION_TYPE_MASK_TRANSFORM_2 (1 << 11) // Mask transformation part 2 + +void Distortion_Request(s32 type); +void Distortion_SetDuration(s16 duration); + +s16 Distortion_GetTimeLeft(void); s16 Distortion_GetType(void); -void Distortion_SetType(s32 type); -void Distortion_ClearType(s32 type); +void Distortion_RemoveRequest(s32 type); + void Distortion_Init(PlayState* play); void Distortion_Update(void); diff --git a/src/code/cutscene_camera.c b/src/code/cutscene_camera.c index d5f028b947..d92d119ddd 100644 --- a/src/code/cutscene_camera.c +++ b/src/code/cutscene_camera.c @@ -119,23 +119,23 @@ u8 CutsceneCamera_ProcessSpline(CutsceneCamera* csCamera) { switch (csCamera->atCmd[csCamera->eyeInterp.curPoint].relativeTo) { case CS_CAM_REL_2: - OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 2); + OLib_Vec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, OLIB_DIFF); break; case CS_CAM_REL_3: - OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + OLib_Vec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, OLIB_DIFF_OFFSET); break; case CS_CAM_REL_1: - OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + OLib_Vec3fDiff(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, OLIB_DIFF_OFFSET); break; case CS_CAM_REL_4: - OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, 1); + OLib_Vec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, OLIB_DIFF_OFFSET); break; case CS_CAM_REL_5: - OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, 2); + OLib_Vec3fDiff(&target->world, &csCamera->camera->at, &csCamera->camera->at, OLIB_DIFF); break; default: // CS_CAM_REL_0 @@ -147,24 +147,24 @@ u8 CutsceneCamera_ProcessSpline(CutsceneCamera* csCamera) { switch (csCamera->atCmd[csCamera->eyeInterp.curPoint].relativeTo) { case CS_CAM_REL_2: - OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 2); + OLib_Vec3fAdd(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, OLIB_ADD); break; case CS_CAM_REL_3: - OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + OLib_Vec3fAdd(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, OLIB_ADD_OFFSET); csCamera->camera->at.y += func_80163660(&player->actor); break; case CS_CAM_REL_1: - OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, 1); + OLib_Vec3fAdd(&player->actor.world, &csCamera->camera->at, &csCamera->camera->at, OLIB_ADD_OFFSET); break; case CS_CAM_REL_4: - OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->at, &csCamera->camera->at, 1); + OLib_Vec3fAdd(&target->world, &csCamera->camera->at, &csCamera->camera->at, OLIB_ADD_OFFSET); break; case CS_CAM_REL_5: - OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->at, &csCamera->camera->at, 2); + OLib_Vec3fAdd(&target->world, &csCamera->camera->at, &csCamera->camera->at, OLIB_ADD); break; default: // CS_CAM_REL_0 @@ -189,23 +189,23 @@ u8 CutsceneCamera_ProcessSpline(CutsceneCamera* csCamera) { switch (csCamera->eyeCmd[csCamera->atInterp.curPoint].relativeTo) { case CS_CAM_REL_2: - OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + OLib_Vec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_DIFF); break; case CS_CAM_REL_3: - OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + OLib_Vec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_DIFF_OFFSET); break; case CS_CAM_REL_1: - OLib_DbCameraVec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + OLib_Vec3fDiff(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_DIFF_OFFSET); break; case CS_CAM_REL_4: - OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + OLib_Vec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_DIFF_OFFSET); break; case CS_CAM_REL_5: - OLib_DbCameraVec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + OLib_Vec3fDiff(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_DIFF); break; default: // CS_CAM_REL_0 @@ -217,24 +217,24 @@ u8 CutsceneCamera_ProcessSpline(CutsceneCamera* csCamera) { switch (csCamera->eyeCmd[csCamera->atInterp.curPoint].relativeTo) { case CS_CAM_REL_2: - OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + OLib_Vec3fAdd(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_ADD); break; case CS_CAM_REL_3: - OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + OLib_Vec3fAdd(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_ADD_OFFSET); csCamera->camera->eye.y += func_80163660(&player->actor); break; case CS_CAM_REL_1: - OLib_DbCameraVec3fSum(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + OLib_Vec3fAdd(&player->actor.world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_ADD_OFFSET); break; case CS_CAM_REL_4: - OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 1); + OLib_Vec3fAdd(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_ADD_OFFSET); break; case CS_CAM_REL_5: - OLib_DbCameraVec3fSum(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, 2); + OLib_Vec3fAdd(&target->world, &csCamera->camera->eye, &csCamera->camera->eye, OLIB_ADD); break; default: // CS_CAM_REL_0 diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 6ede10773f..a5ca767dcd 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2574,7 +2574,7 @@ void Actor_Draw(PlayState* play, Actor* actor) { (actor->flags & (ACTOR_FLAG_10000000 | ACTOR_FLAG_400000)) ? NULL : &actor->world.pos, play); Lights_Draw(light, play->state.gfxCtx); - if (actor->flags & ACTOR_FLAG_1000) { + 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.quakeOffset.y), @@ -3791,30 +3791,29 @@ void func_800BC620(Vec3f* pos, Vec3f* scale, u8 alpha, PlayState* play) { CLOSE_DISPS(play->state.gfxCtx); } -void Actor_AddQuake(PlayState* play, s16 verticalMag, s16 countdown) { - s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3); +void Actor_RequestQuake(PlayState* play, s16 y, s16 duration) { + s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); - Quake_SetCountdown(quakeIndex, countdown); + Quake_SetPerturbations(quakeIndex, y, 0, 0, 0); + Quake_SetDuration(quakeIndex, duration); } -void Actor_AddQuakeWithSpeed(PlayState* play, s16 verticalMag, s16 countdown, s16 speed) { - s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3); +void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed) { + s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, speed); - Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); - Quake_SetCountdown(quakeIndex, countdown); + Quake_SetPerturbations(quakeIndex, y, 0, 0, 0); + Quake_SetDuration(quakeIndex, duration); } -// Actor_RequestRumble? -void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown) { - if (y >= 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); } - Actor_AddQuake(play, y, countdown); + Actor_RequestQuake(play, quakeY, quakeDuration); } typedef struct { diff --git a/src/code/z_camera.c b/src/code/z_camera.c index f54fc93daf..6cfd65702b 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -699,7 +699,7 @@ f32 D_801B9E60 = 0.0f; #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_Demo1.s") // Data for opening chests (default) -VecSph D_801B9E64[] = { +VecGeo D_801B9E64[] = { { 50.0f, 0xEE3A, 0xD558 }, { 75.0f, 0x0000, 0x8008 }, { 80.0f, 0xEE3A, 0x8008 }, @@ -713,7 +713,7 @@ Vec3f D_801B9E84[] = { }; // Data for opening chests (goron) -VecSph D_801B9EB4[] = { +VecGeo D_801B9EB4[] = { { 60.0f, 0xEE3A, 0xD558 }, { 95.0f, 0x0000, 0x8008 }, { 90.0f, 0xEE3A, 0x8008 }, diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 3df77c0c41..6e1501fd8b 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -3795,12 +3795,12 @@ s32 sCameraHudVisibility = 2; s32 sCameraLetterboxSize = 32; s32 sCameraNegOne = -1; -// VecSph yaw data +// VecGeo yaw data s16 D_801B9E18[] = { 0x0AAA, 0xF556, 0x1555, 0xEAAB, 0x2AAA, 0xD556, 0x3FFF, 0xC001, 0x5555, 0xAAAB, 0x6AAA, 0x9556, 0x7FFF, 0x0000, }; -// VecSph pitch data +// VecGeo pitch data s16 D_801B9E34[] = { 0x0000, 0x02C6, 0x058C, 0x0000, 0x0000, 0xFD3A, 0x0000, 0x0852, 0x0000, 0x0000, 0x0B18, 0x02C6, 0xFA74, 0x0000, }; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 79270adce5..da965969f9 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -202,10 +202,10 @@ void CutsceneCmd_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdMisc* cmd) { case CS_MISC_EARTHQUAKE_MEDIUM: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); if (isFirstFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); + sCutsceneQuakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); - Quake_SetQuakeValues(sCutsceneQuakeIndex, 6, 4, 0, 0); - Quake_SetCountdown(sCutsceneQuakeIndex, 800); + Quake_SetPerturbations(sCutsceneQuakeIndex, 6, 4, 0, 0); + Quake_SetDuration(sCutsceneQuakeIndex, 800); } break; @@ -310,10 +310,10 @@ void CutsceneCmd_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdMisc* cmd) { case CS_MISC_EARTHQUAKE_STRONG: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG); if (isFirstFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); + sCutsceneQuakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 30000); - Quake_SetQuakeValues(sCutsceneQuakeIndex, 20, 10, 0, 0); - Quake_SetCountdown(sCutsceneQuakeIndex, 800); + Quake_SetPerturbations(sCutsceneQuakeIndex, 20, 10, 0, 0); + Quake_SetDuration(sCutsceneQuakeIndex, 800); } break; @@ -372,10 +372,10 @@ void CutsceneCmd_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdMisc* cmd) { case CS_MISC_EARTHQUAKE_WEAK: func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG); if (isFirstFrame) { - sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); + sCutsceneQuakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(sCutsceneQuakeIndex, 22000); - Quake_SetQuakeValues(sCutsceneQuakeIndex, 2, 1, 0, 0); - Quake_SetCountdown(sCutsceneQuakeIndex, 800); + Quake_SetPerturbations(sCutsceneQuakeIndex, 2, 1, 0, 0); + Quake_SetDuration(sCutsceneQuakeIndex, 800); } break; diff --git a/src/code/z_olib.c b/src/code/z_olib.c index ad0c2b35c1..754857014b 100644 --- a/src/code/z_olib.c +++ b/src/code/z_olib.c @@ -100,16 +100,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 = 0x4000 - sph->pitch; - geo.yaw = sph->yaw; + sph.r = geo->r; + sph.pitch = 0x4000 - geo->pitch; + sph.yaw = geo->yaw; - return OLib_VecSphToVec3f(dest, &geo); + return OLib_VecSphToVec3f(dest, &sph); } /** @@ -117,16 +117,16 @@ Vec3f* OLib_VecSphGeoToVec3f(Vec3f* dest, VecSph* sph) { */ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) { VecSph sph; - f32 distSquared = SQ(vec->x) + SQ(vec->z); - f32 dist = sqrtf(distSquared); + f32 distXZSq = SQ(vec->x) + SQ(vec->z); + f32 distXZ = sqrtf(distXZSq); - 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(func_80086B30(dist, vec->y))); + sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(func_80086B30(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 { @@ -141,7 +141,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); @@ -156,42 +156,42 @@ 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); } /** - * Takes the sum of positions `a` (x,y,z coordinates) and `sph` (geographic coordinates), result is in x,y,z position + * Takes the sum of positions `a` (x,y,z coordinates) and `geo` (geographic coordinates), result is in x,y,z position * Identical to Quake_AddVec from OoT */ -Vec3f* OLib_VecSphAddToVec3f(Vec3f* dest, Vec3f* a, VecSph* sph) { - Vec3f vec; +Vec3f* OLib_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) { + Vec3f sum; Vec3f b; - OLib_VecSphGeoToVec3f(&b, sph); - vec.x = a->x + b.x; - vec.y = a->y + b.y; - vec.z = a->z + b.z; + OLib_VecGeoToVec3f(&b, geo); + sum.x = a->x + b.x; + sum.y = a->y + b.y; + sum.z = a->z + b.z; - *dest = vec; + *dest = sum; return dest; } @@ -248,46 +248,50 @@ Vec3s* OLib_Vec3fDiffBinAng(Vec3s* dest, Vec3f* a, Vec3f* b) { } /** - * Gets a x,y,z position diff depending on the dbCamera mode + * Gets a x,y,z position diff depending on the mode */ -void OLib_DbCameraVec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode) { - VecSph sph; +void OLib_Vec3fDiff(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode) { + VecGeo geo; switch (mode) { - case 1: - OLib_Vec3fDiffToVecSphGeo(&sph, &a->pos, b); - sph.yaw -= a->rot.y; - OLib_VecSphGeoToVec3f(dest, &sph); + case OLIB_DIFF_OFFSET: + OLib_Vec3fDiffToVecGeo(&geo, &a->pos, b); + geo.yaw -= a->rot.y; + OLib_VecGeoToVec3f(dest, &geo); break; - case 2: + + case OLIB_DIFF: dest->x = b->x - a->pos.x; dest->y = b->y - a->pos.y; dest->z = b->z - a->pos.z; break; - default: + + default: // OLIB_DIFF_COPY *dest = *b; break; } } /** - * Gets a x,y,z position sum depending on the dbCamera mode + * Gets a x,y,z position sum depending on the mode */ -void OLib_DbCameraVec3fSum(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode) { - VecSph sph; +void OLib_Vec3fAdd(PosRot* a, Vec3f* b, Vec3f* dest, s16 mode) { + VecGeo geo; switch (mode) { - case 1: - OLib_Vec3fToVecSphGeo(&sph, b); - sph.yaw += a->rot.y; - OLib_VecSphAddToVec3f(dest, &a->pos, &sph); + case OLIB_ADD_OFFSET: + OLib_Vec3fToVecGeo(&geo, b); + geo.yaw += a->rot.y; + OLib_AddVecGeoToVec3f(dest, &a->pos, &geo); break; - case 2: + + case OLIB_ADD: dest->x = a->pos.x + b->x; dest->y = a->pos.y + b->y; dest->z = a->pos.z + b->z; break; - default: + + default: // OLIB_ADD_COPY *dest = *b; break; } diff --git a/src/code/z_play.c b/src/code/z_play.c index ca0ebcbae1..1b5c046c66 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -507,39 +507,39 @@ void Play_UpdateWaterCamera(PlayState* this, Camera* camera) { if (!sIsCameraUnderwater) { Camera_SetFlags(camera, CAM_STATE_UNDERWATER); sQuakeIndex = -1; - Distortion_SetType(DISTORTION_TYPE_UNDERWATER_ENTRY); - Distortion_SetCountdown(80); + Distortion_Request(DISTORTION_TYPE_UNDERWATER_ENTRY); + Distortion_SetDuration(80); } func_801A3EC0(0x20); func_800F6834(this, lightIndex); - if ((sQuakeIndex == -1) || (Quake_GetCountdown(sQuakeIndex) == 10)) { - s16 quakeIndex = Quake_Add(camera, QUAKE_TYPE_5); + if ((sQuakeIndex == -1) || (Quake_GetTimeLeft(sQuakeIndex) == 10)) { + s16 quakeIndex = Quake_Request(camera, QUAKE_TYPE_5); sQuakeIndex = quakeIndex; if (quakeIndex != 0) { Quake_SetSpeed(sQuakeIndex, 550); - Quake_SetQuakeValues(sQuakeIndex, 1, 1, 180, 0); - Quake_SetCountdown(sQuakeIndex, 1000); + Quake_SetPerturbations(sQuakeIndex, 1, 1, 180, 0); + Quake_SetDuration(sQuakeIndex, 1000); } } if (player->stateFlags3 & PLAYER_STATE3_8000) { - Distortion_SetType(DISTORTION_TYPE_ZORA_SWIMMING); - Distortion_ClearType(DISTORTION_TYPE_NON_ZORA_SWIMMING); + Distortion_Request(DISTORTION_TYPE_ZORA_SWIMMING); + Distortion_RemoveRequest(DISTORTION_TYPE_NON_ZORA_SWIMMING); } else { - Distortion_SetType(DISTORTION_TYPE_NON_ZORA_SWIMMING); - Distortion_ClearType(DISTORTION_TYPE_ZORA_SWIMMING); + Distortion_Request(DISTORTION_TYPE_NON_ZORA_SWIMMING); + Distortion_RemoveRequest(DISTORTION_TYPE_ZORA_SWIMMING); } } else { if (sIsCameraUnderwater) { Camera_ClearFlags(camera, CAM_STATE_UNDERWATER); } - Distortion_ClearType(DISTORTION_TYPE_NON_ZORA_SWIMMING); - Distortion_ClearType(DISTORTION_TYPE_UNDERWATER_ENTRY); - Distortion_ClearType(DISTORTION_TYPE_ZORA_SWIMMING); + Distortion_RemoveRequest(DISTORTION_TYPE_NON_ZORA_SWIMMING); + Distortion_RemoveRequest(DISTORTION_TYPE_UNDERWATER_ENTRY); + Distortion_RemoveRequest(DISTORTION_TYPE_ZORA_SWIMMING); if (sQuakeIndex != 0) { - Quake_Remove(sQuakeIndex); + Quake_RemoveRequest(sQuakeIndex); } func_800F694C(this); func_801A3EC0(0); diff --git a/src/code/z_quake.c b/src/code/z_quake.c index d8d526ca37..c5115375c3 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -3,35 +3,28 @@ #include "z64view.h" typedef struct { - /* 0x00 */ s16 randIndex; - /* 0x02 */ s16 countdownMax; + /* 0x00 */ s16 index; + /* 0x02 */ s16 duration; /* 0x04 */ Camera* camera; /* 0x08 */ u32 type; - /* 0x0C */ s16 verticalMag; - /* 0x0E */ s16 horizontalMag; - /* 0x10 */ s16 zoom; - /* 0x12 */ s16 rollOffset; - /* 0x14 */ Vec3s shakePlaneOffset; // angle deviations from shaking in the perpendicular plane + /* 0x0C */ s16 y; + /* 0x0E */ s16 x; + /* 0x10 */ s16 fov; + /* 0x12 */ s16 upRollOffset; + /* 0x14 */ Vec3s orientation; // alters the orientation of the xy perturbation. Only x (pitch) and y (yaw) are used /* 0x1A */ s16 speed; - /* 0x1C */ s16 isShakePerpendicular; - /* 0x1E */ s16 countdown; + /* 0x1C */ s16 isRelativeToScreen; // is the quake relative to the screen or on world coordinates + /* 0x1E */ s16 timer; /* 0x20 */ s16 camId; } QuakeRequest; // size = 0x24 typedef struct { /* 0x0 */ PlayState* play; /* 0x4 */ s32 type; // bitfield, highest set bit determines type - /* 0x8 */ s16 countdown; + /* 0x8 */ s16 timer; /* 0xA */ s16 state; } DistortionRequest; // size = 0xC -typedef struct { - /* 0x00 */ Vec3f atOffset; - /* 0x0C */ Vec3f eyeOffset; - /* 0x18 */ s16 rollOffset; - /* 0x1A */ s16 zoom; -} ShakeInfo; // size = 0x1C - typedef s16 (*QuakeCallbackFunc)(QuakeRequest*, ShakeInfo*); typedef enum { @@ -40,230 +33,257 @@ typedef enum { /* 2 */ DISTORTION_SETUP } DistortionState; -QuakeRequest sQuakeRequest[4]; +QuakeRequest sQuakeRequests[4]; DistortionRequest sDistortionRequest; -static s16 sIsQuakeInitialized = true; +static s16 sQuakeUnused = 1; static s16 sQuakeRequestCount = 0; f32 Quake_Random(void) { return 2.0f * (Rand_ZeroOne() - 0.5f); } -void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPertubation, f32 horizontalPertubation) { +void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 yOffset, f32 xOffset) { Vec3f* at = &req->camera->at; Vec3f* eye = &req->camera->eye; Vec3f atEyeOffset; - VecSph atEyeOffsetSph2; - VecSph eyeAtAngle; + VecSph geo; + VecSph eyeToAtGeo; - // isShakePerpendicular is always set to 1 before reaching this conditional - // alternative is an unused fixed vertical shake - if (req->isShakePerpendicular) { + if (req->isRelativeToScreen) { atEyeOffset.x = 0; atEyeOffset.y = 0; atEyeOffset.z = 0; - OLib_Vec3fDiffToVecSphGeo(&eyeAtAngle, eye, at); + OLib_Vec3fDiffToVecGeo(&eyeToAtGeo, eye, at); - atEyeOffsetSph2.r = req->verticalMag * verticalPertubation; - atEyeOffsetSph2.pitch = eyeAtAngle.pitch + req->shakePlaneOffset.x + 0x4000; - atEyeOffsetSph2.yaw = eyeAtAngle.yaw + req->shakePlaneOffset.y; - OLib_VecSphAddToVec3f(&atEyeOffset, &atEyeOffset, &atEyeOffsetSph2); + // y shake + geo.r = req->y * yOffset; + // 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 + OLib_AddVecGeoToVec3f(&atEyeOffset, &atEyeOffset, &geo); - atEyeOffsetSph2.r = req->horizontalMag * horizontalPertubation; - atEyeOffsetSph2.pitch = eyeAtAngle.pitch + req->shakePlaneOffset.x; - atEyeOffsetSph2.yaw = eyeAtAngle.yaw + req->shakePlaneOffset.y + 0x4000; - OLib_VecSphAddToVec3f(&atEyeOffset, &atEyeOffset, &atEyeOffsetSph2); + // x shake + geo.r = req->x * xOffset; + // 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 + OLib_AddVecGeoToVec3f(&atEyeOffset, &atEyeOffset, &geo); } else { atEyeOffset.x = 0; - atEyeOffset.y = req->verticalMag * verticalPertubation; + atEyeOffset.y = req->y * yOffset; atEyeOffset.z = 0; - atEyeOffsetSph2.r = req->horizontalMag * horizontalPertubation; - atEyeOffsetSph2.pitch = req->shakePlaneOffset.x; - atEyeOffsetSph2.yaw = req->shakePlaneOffset.y; + geo.r = req->x * xOffset; + geo.pitch = req->orientation.x; + geo.yaw = req->orientation.y; - OLib_VecSphAddToVec3f(&atEyeOffset, &atEyeOffset, &atEyeOffsetSph2); + OLib_AddVecGeoToVec3f(&atEyeOffset, &atEyeOffset, &geo); } shake->atOffset = shake->eyeOffset = atEyeOffset; - shake->rollOffset = req->rollOffset * verticalPertubation; - shake->zoom = req->zoom * verticalPertubation; + shake->upRollOffset = req->upRollOffset * yOffset; + shake->fovOffset = req->fov * yOffset; } s16 Quake_CallbackType1(QuakeRequest* req, ShakeInfo* shake) { - if (req->countdown > 0) { - f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown); + if (req->timer > 0) { + f32 xyOffset = Math_SinS(req->speed * req->timer); - Quake_UpdateShakeInfo(req, shake, perpendicularPertubation, Rand_ZeroOne() * perpendicularPertubation); - req->countdown--; + Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset); + req->timer--; } - return req->countdown; + return req->timer; } s16 Quake_CallbackType5(QuakeRequest* req, ShakeInfo* shake) { - if (req->countdown > 0) { - f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown); + if (req->timer > 0) { + f32 xyOffset = Math_SinS(req->speed * req->timer); - Quake_UpdateShakeInfo(req, shake, perpendicularPertubation, perpendicularPertubation); - req->countdown--; + Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset); + req->timer--; } - return req->countdown; + return req->timer; } s16 Quake_CallbackType6(QuakeRequest* req, ShakeInfo* shake) { - f32 perpendicularPertubation; + f32 xyOffset; - req->countdown--; - perpendicularPertubation = Math_SinS(req->speed * ((req->countdown & 0xF) + 500)); - Quake_UpdateShakeInfo(req, shake, perpendicularPertubation, Rand_ZeroOne() * perpendicularPertubation); + 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_CallbackType3(QuakeRequest* req, ShakeInfo* shake) { - if (req->countdown > 0) { - f32 perpendicularPertubation = - Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax); + if (req->timer > 0) { + f32 xyOffset = Math_SinS(req->speed * req->timer) * ((f32)req->timer / req->duration); - Quake_UpdateShakeInfo(req, shake, perpendicularPertubation, perpendicularPertubation); - req->countdown--; + Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset); + req->timer--; } - return req->countdown; + return req->timer; } s16 Quake_CallbackType2(QuakeRequest* req, ShakeInfo* shake) { - if (req->countdown > 0) { - f32 perpendicularPertubation = Quake_Random(); + if (req->timer > 0) { + f32 xyOffset = Quake_Random(); - Quake_UpdateShakeInfo(req, shake, perpendicularPertubation, Rand_ZeroOne() * perpendicularPertubation); - req->countdown--; + Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset); + req->timer--; } - return req->countdown; + return req->timer; } s16 Quake_CallbackType4(QuakeRequest* req, ShakeInfo* shake) { - if (req->countdown > 0) { - f32 perpendicularPertubation = Quake_Random() * ((f32)req->countdown / (f32)req->countdownMax); + if (req->timer > 0) { + f32 xyOffset = Quake_Random() * ((f32)req->timer / req->duration); - Quake_UpdateShakeInfo(req, shake, perpendicularPertubation, Rand_ZeroOne() * perpendicularPertubation); - 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 = 0; - s32 min = 0x10000; + s32 index = 0; + s32 timerMin = UINT16_MAX + 1; // timer is a short, so start with a value beyond its range - for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) { - if (sQuakeRequest[i].type == 0) { - ret = i; + for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) { + if (sQuakeRequests[i].type == QUAKE_TYPE_NONE) { + index = i; break; } - if (sQuakeRequest[i].countdown < min) { - min = sQuakeRequest[i].countdown; - ret = i; + if (timerMin > sQuakeRequests[i].timer) { + timerMin = sQuakeRequests[i].timer; + index = i; } } - return ret; + return index; } -QuakeRequest* Quake_AddImpl(Camera* camera, u32 type) { +QuakeRequest* Quake_RequestImpl(Camera* camera, u32 type) { s16 index = Quake_GetFreeIndex(); - QuakeRequest* req = &sQuakeRequest[index]; + QuakeRequest* req = &sQuakeRequests[index]; __osMemset(req, 0, sizeof(QuakeRequest)); + req->camera = camera; req->camId = camera->camId; req->type = type; - req->isShakePerpendicular = true; - req->randIndex = ((s16)(Rand_ZeroOne() * 0x10000) & ~3) + index; + 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_RemoveRequest(QuakeRequest* req) { - req->type = 0; - req->countdown = -1; +void Quake_Remove(QuakeRequest* req) { + req->type = QUAKE_TYPE_NONE; + req->timer = -1; sQuakeRequestCount--; } -QuakeRequest* Quake_GetRequest(s16 quakeIndex) { - QuakeRequest* req = &sQuakeRequest[quakeIndex & 3]; +QuakeRequest* Quake_GetRequest(s16 index) { + QuakeRequest* req = &sQuakeRequests[index & 3]; - if (req->type == 0) { + if (req->type == QUAKE_TYPE_NONE) { return NULL; } - if (quakeIndex != req->randIndex) { + if (index != req->index) { return NULL; } return req; } -u32 Quake_SetValue(s16 quakeIndex, s16 valueType, s16 value) { - QuakeRequest* req = Quake_GetRequest(quakeIndex); +// valueType for Quake_SetValue() +#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) + +u32 Quake_SetValue(s16 index, s16 valueType, s16 value) { + QuakeRequest* req = Quake_GetRequest(index); if (req == NULL) { return false; - } else { - switch (valueType) { - case QUAKE_SPEED: - req->speed = value; - break; - - case QUAKE_VERTICAL_MAG: - req->verticalMag = value; - break; - - case QUAKE_HORIZONTAL_MAG: - req->horizontalMag = value; - break; - - case QUAKE_ZOOM: - req->zoom = value; - break; - - case QUAKE_ROLL_OFFSET: - req->rollOffset = value; - break; - - case QUAKE_SHAKE_PLANE_OFFSET_X: - req->shakePlaneOffset.x = value; - break; - - case QUAKE_SHAKE_PLANE_OFFSET_Y: - req->shakePlaneOffset.y = value; - break; - - case QUAKE_SHAKE_PLANE_OFFSET_Z: - req->shakePlaneOffset.z = value; - break; - - case QUAKE_COUNTDOWN: - req->countdown = value; - req->countdownMax = req->countdown; - break; - - case QUAKE_IS_SHAKE_PERPENDICULAR: - req->isShakePerpendicular = value; - break; - - default: - break; - } - - return true; } + + 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->upRollOffset = 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; + } + + return true; } -u32 Quake_SetSpeed(s16 quakeIndex, s16 speed) { - QuakeRequest* req = Quake_GetRequest(quakeIndex); +/** + * @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 = speed; @@ -272,45 +292,67 @@ u32 Quake_SetSpeed(s16 quakeIndex, s16 speed) { return false; } -u32 Quake_SetCountdown(s16 quakeIndex, s16 countdown) { - QuakeRequest* req = Quake_GetRequest(quakeIndex); +/** + * @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 = countdown; - req->countdownMax = req->countdown; + req->duration = req->timer = duration; return true; } return false; } -s16 Quake_GetCountdown(s16 quakeIndex) { - QuakeRequest* req = Quake_GetRequest(quakeIndex); +/** + * @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 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset) { - QuakeRequest* req = Quake_GetRequest(quakeIndex); +/** + * @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->verticalMag = verticalMag; - req->horizontalMag = horizontalMag; - req->zoom = zoom; - req->rollOffset = rollOffset; + req->y = y; + req->x = x; + req->fov = fov; + req->upRollOffset = roll; return true; } return false; } -u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset) { - QuakeRequest* req = Quake_GetRequest(quakeIndex); +/** + * @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->isShakePerpendicular = isShakePerpendicular; - req->shakePlaneOffset = shakePlaneOffset; + req->isRelativeToScreen = isRelativeToScreen; + req->orientation = orientation; return true; } return false; @@ -319,156 +361,167 @@ u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakeP void Quake_Init(void) { s16 i; - for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) { - sQuakeRequest[i].type = 0; - sQuakeRequest[i].countdown = 0; + for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) { + sQuakeRequests[i].type = QUAKE_TYPE_NONE; + sQuakeRequests[i].timer = 0; } - sIsQuakeInitialized = true; + sQuakeUnused = 1; sQuakeRequestCount = 0; } -s16 Quake_Add(Camera* camera, u32 type) { - return Quake_AddImpl(camera, type)->randIndex; +s16 Quake_Request(Camera* camera, u32 type) { + return Quake_RequestImpl(camera, type)->index; } -u32 Quake_Remove(s16 index) { +u32 Quake_RemoveRequest(s16 index) { QuakeRequest* req = Quake_GetRequest(index); if (req != NULL) { - Quake_RemoveRequest(req); + Quake_Remove(req); return true; } return false; } static QuakeCallbackFunc sQuakeCallbacks[] = { - NULL, - Quake_CallbackType1, - Quake_CallbackType2, - Quake_CallbackType3, - Quake_CallbackType4, - Quake_CallbackType5, - Quake_CallbackType6, + 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 }; -s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { - s32 pad; - QuakeRequest* req; - ShakeInfo shake; +s16 Quake_Update(Camera* camera, ShakeInfo* camShake) { f32 absSpeedDiv; + ShakeInfo shake; + QuakeRequest* req; f32 maxCurr; f32 maxNext; s32 index; - s32 ret; - u32 eq; - Vec3f originVec; + s32 numQuakesApplied; + u32 isDifferentCamId; + Vec3f zeroVec; PlayState* play = camera->play; - originVec.x = 0.0f; - originVec.y = 0.0f; - originVec.z = 0.0f; - 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->rollOffset = 0; - camData->zoom = 0; - camData->max = 0.0f; + zeroVec.x = 0.0f; + zeroVec.y = 0.0f; + zeroVec.z = 0.0f; + + 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->upRollOffset = 0; + camShake->fovOffset = 0; + camShake->maxOffset = 0.0f; if (sQuakeRequestCount == 0) { return 0; } - ret = 0; - for (index = 0; index < ARRAY_COUNT(sQuakeRequest); index++) { - req = &sQuakeRequest[index]; - if (req->type != 0) { - if (play->cameraPtrs[req->camId] == NULL) { - Quake_RemoveRequest(req); - } else { - eq = (camera->camId != req->camera->camId); - absSpeedDiv = ABS(req->speed) / (f32)0x8000; - if (sQuakeCallbacks[req->type](req, &shake) == 0) { - Quake_RemoveRequest(req); - } else if (eq == 0) { - if (fabsf(camData->atOffset.x) < fabsf(shake.atOffset.x)) { - camData->atOffset.x = shake.atOffset.x; - } - if (fabsf(camData->atOffset.y) < fabsf(shake.atOffset.y)) { - camData->atOffset.y = shake.atOffset.y; - } - if (fabsf(camData->atOffset.z) < fabsf(shake.atOffset.z)) { - camData->atOffset.z = shake.atOffset.z; - } - if (fabsf(camData->eyeOffset.x) < fabsf(shake.eyeOffset.x)) { - camData->eyeOffset.x = shake.eyeOffset.x; - } - if (fabsf(camData->eyeOffset.y) < fabsf(shake.eyeOffset.y)) { - camData->eyeOffset.y = shake.eyeOffset.y; - } - if (fabsf(camData->eyeOffset.z) < fabsf(shake.eyeOffset.z)) { - camData->eyeOffset.z = shake.eyeOffset.z; - } - if (camData->rollOffset < shake.rollOffset) { - camData->rollOffset = shake.rollOffset; - } - if (camData->zoom < shake.zoom) { - camData->zoom = shake.zoom; - } - - maxCurr = OLib_Vec3fDist(&shake.atOffset, &originVec) * absSpeedDiv; - - maxNext = OLib_Vec3fDist(&shake.eyeOffset, &originVec) * absSpeedDiv; - maxCurr = CLAMP_MIN(maxCurr, maxNext); - - maxNext = (camData->rollOffset * (7.0f / 2500.0f)) * absSpeedDiv; - maxCurr = CLAMP_MIN(maxCurr, maxNext); - - maxNext = (camData->zoom * (7.0f / 2500.0f)) * absSpeedDiv; - maxCurr = CLAMP_MIN(maxCurr, maxNext); - - if (camData->max < maxCurr) { - camData->max = maxCurr; - } - - 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) { + Quake_Remove(req); + continue; + } + + isDifferentCamId = (camera->camId != req->camera->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->upRollOffset < shake.upRollOffset) { + camShake->upRollOffset = shake.upRollOffset; + } + 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->upRollOffset * (7.0f / 2500.0f)) * absSpeedDiv; + maxCurr = CLAMP_MIN(maxCurr, maxNext); + + maxNext = (camShake->fovOffset * (7.0f / 2500.0f)) * absSpeedDiv; + maxCurr = CLAMP_MIN(maxCurr, maxNext); + + if (camShake->maxOffset < maxCurr) { + camShake->maxOffset = maxCurr; + } + + numQuakesApplied++; } - return ret; + return numQuakesApplied; } void Distortion_Init(PlayState* play) { sDistortionRequest.play = play; View_ClearDistortion(&play->view); sDistortionRequest.type = 0; - sDistortionRequest.countdown = 0; + sDistortionRequest.timer = 0; sDistortionRequest.state = DISTORTION_INACTIVE; } -void Distortion_SetCountdown(s16 countdown) { - sDistortionRequest.countdown = countdown; +void Distortion_SetDuration(s16 duration) { + sDistortionRequest.timer = duration; sDistortionRequest.state = DISTORTION_SETUP; } -s16 Distortion_GetCountdown(void) { - return sDistortionRequest.countdown; +s16 Distortion_GetTimeLeft(void) { + return sDistortionRequest.timer; } s16 Distortion_GetType(void) { return sDistortionRequest.type; } -void Distortion_SetType(s32 type) { +void Distortion_Request(s32 type) { if (sDistortionRequest.type < type) { sDistortionRequest.type = type; } } -void Distortion_ClearType(s32 type) { +void Distortion_RemoveRequest(s32 type) { if (sDistortionRequest.type == type) { sDistortionRequest.type = 0; } @@ -489,7 +542,7 @@ ConveyorSpeed Distortion_GetUnderwaterCurrentSpeed(Player* player) { void Distortion_Update(void) { static s16 depthPhase = 0x3F0; static s16 screenPlanePhase = 0x156; - static s16 countdownMax = 1; + static s16 duration = 1; f32 xyScaleFactor; f32 zScaleFactor; f32 speedScaleFactor; @@ -511,8 +564,8 @@ void Distortion_Update(void) { f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f); if (sDistortionRequest.type != 0) { - if (sDistortionRequest.type & DISTORTION_TYPE_B) { - sDistortionRequest.countdown = 2; + if (sDistortionRequest.type & DISTORTION_TYPE_MASK_TRANSFORM_2) { + sDistortionRequest.timer = 2; depthPhase = 0x3F0; screenPlanePhase = 0x156; @@ -528,17 +581,17 @@ void Distortion_Update(void) { zScale = 0.0f; speed = 0.6f; - xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / 60.0f; + xyScaleFactor = zScaleFactor = sDistortionRequest.timer / 60.0f; speedScaleFactor = 1.0f; - } else if (sDistortionRequest.type & DISTORTION_TYPE_A) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_BOSS_WARP) { if (sDistortionRequest.state == DISTORTION_SETUP) { - countdownMax = sDistortionRequest.countdown; + duration = sDistortionRequest.timer; depthPhase = 0x3F0; screenPlanePhase = 0x156; } depthPhaseStep = 0.0f; - screenPlanePhaseStep = 50.0f / countdownMax; + screenPlanePhaseStep = 50.0f / duration; rotX = 0.0f; rotY = 0.0f; @@ -549,11 +602,11 @@ void Distortion_Update(void) { zScale = 0.0f; speed = 0.4f; - xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax; + xyScaleFactor = zScaleFactor = ((f32)duration - sDistortionRequest.timer) / (f32)duration; speedScaleFactor = 0.5f; - } else if (sDistortionRequest.type & DISTORTION_TYPE_9) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_MASK_TRANSFORM_1) { if (sDistortionRequest.state == DISTORTION_SETUP) { - countdownMax = sDistortionRequest.countdown; + duration = sDistortionRequest.timer; depthPhase = 0x1FC; screenPlanePhase = 0x156; } @@ -570,11 +623,11 @@ void Distortion_Update(void) { zScale = 0.0f; speed = 0.1f; - xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax; + xyScaleFactor = zScaleFactor = ((f32)duration - sDistortionRequest.timer) / (f32)duration; speedScaleFactor = 1.0f; - } else if (sDistortionRequest.type & DISTORTION_TYPE_8) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_GORON_BUTT) { if (sDistortionRequest.state == DISTORTION_SETUP) { - countdownMax = sDistortionRequest.countdown; + duration = sDistortionRequest.timer; depthPhase = 0x2710; screenPlanePhase = 0x3E8; } @@ -591,15 +644,15 @@ void Distortion_Update(void) { zScale = 0.01f; speed = 1.5f; - if (sDistortionRequest.countdown < 5) { - xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax; + if (sDistortionRequest.timer < 5) { + xyScaleFactor = zScaleFactor = ((f32)duration - sDistortionRequest.timer) / (f32)duration; } else { xyScaleFactor = zScaleFactor = 0.0f; } speedScaleFactor = 1.0f; - } else if (sDistortionRequest.type & DISTORTION_TYPE_7) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_UNK_ATTACK) { if (sDistortionRequest.state == DISTORTION_SETUP) { - countdownMax = sDistortionRequest.countdown; + duration = sDistortionRequest.timer; depthPhase = 0x4B0; screenPlanePhase = 0x7D0; } @@ -616,11 +669,11 @@ void Distortion_Update(void) { zScale = 0.01f; speed = 1.5f; - xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax; + xyScaleFactor = zScaleFactor = sDistortionRequest.timer / (f32)duration; speedScaleFactor = 1.0f; - } else if (sDistortionRequest.type & DISTORTION_TYPE_6) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_ZORA_KICK) { if (sDistortionRequest.state == DISTORTION_SETUP) { - countdownMax = sDistortionRequest.countdown; + duration = sDistortionRequest.timer; depthPhase = 0x9C4; screenPlanePhase = 0xBB8; } @@ -637,14 +690,14 @@ void Distortion_Update(void) { zScale = 0.01f; speed = 1.3f; - if (sDistortionRequest.countdown < 4) { - xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax; + if (sDistortionRequest.timer < 4) { + xyScaleFactor = zScaleFactor = sDistortionRequest.timer / (f32)duration; } else { xyScaleFactor = zScaleFactor = 0.0f; } speedScaleFactor = 1.0f; - } else if (sDistortionRequest.type & DISTORTION_TYPE_5) { - sDistortionRequest.countdown = 2; + } else if (sDistortionRequest.type & DISTORTION_TYPE_SONG_OF_TIME) { + sDistortionRequest.timer = 2; if (sDistortionRequest.state == DISTORTION_SETUP) { depthPhase = 0x9C4; screenPlanePhase = 0xBB8; @@ -670,7 +723,7 @@ void Distortion_Update(void) { speedScaleFactor = 1.0f; } else if (sDistortionRequest.type & DISTORTION_TYPE_UNDERWATER_ENTRY) { if (sDistortionRequest.state == DISTORTION_SETUP) { - countdownMax = sDistortionRequest.countdown; + duration = sDistortionRequest.timer; depthPhase = 0x760; screenPlanePhase = 0x1BC; } @@ -687,14 +740,14 @@ void Distortion_Update(void) { zScale = 0.2f; speed = 0.25f; - countdownRatio = sDistortionRequest.countdown / (f32)countdownMax; + countdownRatio = sDistortionRequest.timer / (f32)duration; zScaleFactor = xyScaleFactor = countdownRatio; speedScaleFactor = 1.0f; } else if (sDistortionRequest.type & DISTORTION_TYPE_ZORA_SWIMMING) { depthPhase = 0x3F0; screenPlanePhase = 0x156; - sDistortionRequest.countdown = 2; + sDistortionRequest.timer = 2; player = GET_PLAYER(play); if (player != NULL) { @@ -749,7 +802,7 @@ void Distortion_Update(void) { depthPhase = 0x3F0; screenPlanePhase = 0x156; - sDistortionRequest.countdown = 2; + sDistortionRequest.timer = 2; player = GET_PLAYER(play); depthPhaseStep = 359.2f; @@ -796,12 +849,12 @@ void Distortion_Update(void) { xyScaleFactor = speedScaleFactor = (waterYScaleFactor * 0.15f) + 0.35f + (speedRatio * 0.4f); zScaleFactor = 0.9f - xyScaleFactor; - } else if (sDistortionRequest.type & DISTORTION_TYPE_0) { + } else if (sDistortionRequest.type & DISTORTION_TYPE_HOT_ROOM) { // Gives a small mirage-like appearance depthPhase = 0x3F0; screenPlanePhase = 0x156; - sDistortionRequest.countdown = 2; + sDistortionRequest.timer = 2; depthPhaseStep = 0.0f; screenPlanePhaseStep = 150.0f; @@ -840,32 +893,25 @@ void Distortion_Update(void) { View_ClearDistortion(&play->view); sDistortionRequest.state = DISTORTION_INACTIVE; - sDistortionRequest.countdown = 0; + sDistortionRequest.timer = 0; } - if (sDistortionRequest.countdown != 0) { - sDistortionRequest.countdown--; - if (sDistortionRequest.countdown == 0) { + if (sDistortionRequest.timer != 0) { + sDistortionRequest.timer--; + if (sDistortionRequest.timer == 0) { sDistortionRequest.type = 0; } } } -s32 Quake_NumActiveQuakes(void) { - QuakeRequest* req = sQuakeRequest; +s32 Quake_GetNumActiveQuakes(void) { s32 numActiveQuakes = 0; + s32 i; - if (req[0].type != 0) { - numActiveQuakes++; - } - if (req[1].type != 0) { - numActiveQuakes++; - } - if (req[2].type != 0) { - numActiveQuakes++; - } - if (req[3].type != 0) { - numActiveQuakes++; + for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) { + if (sQuakeRequests[i].type != QUAKE_TYPE_NONE) { + numActiveQuakes++; + } } return numActiveQuakes; diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index a8b6ce702a..c784c1318f 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -522,10 +522,10 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* sp44.z = this->dyna.actor.home.pos.z + unkStruct1->unk_14.z; Rumble_Request(Math3D_Vec3fDistSq(&sp44, &GET_PLAYER(play)->actor.world.pos), 255, 20, 150); - quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 12); + Quake_SetPerturbations(quakeIndex, 7, 0, 0, 0); + Quake_SetDuration(quakeIndex, 12); if (this->unk_179 <= 0) { func_8019F128(NA_SE_EV_STONEDOOR_STOP); @@ -537,7 +537,7 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* } } -void func_80A9C18C(BgHakuginPost* this, PlayState* play) { +void BgHakuginPost_RequestQuakeAndRumble(BgHakuginPost* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); Camera* activeCam = GET_ACTIVE_CAM(play); @@ -547,10 +547,10 @@ void func_80A9C18C(BgHakuginPost* this, PlayState* play) { this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.z), 255, 20, 150); - quakeIndex = Quake_Add(activeCam, QUAKE_TYPE_3); + quakeIndex = Quake_Request(activeCam, QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 17232); - Quake_SetQuakeValues(quakeIndex, 6, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 20); + Quake_SetPerturbations(quakeIndex, 6, 0, 0, 0); + Quake_SetDuration(quakeIndex, 20); } void func_80A9C228(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) { @@ -798,7 +798,7 @@ void func_80A9CD14(BgHakuginPost* this, PlayState* play) { temp_f12 = CLAMP_MAX(temp_f12, 40.0f); this->unk_16C += temp_f12; if (this->unk_168 <= this->unk_16C) { - func_80A9C18C(this, play); + BgHakuginPost_RequestQuakeAndRumble(this, play); func_8019F128(NA_SE_EV_STONEDOOR_STOP); func_80A9CE00(this); } else { @@ -876,7 +876,7 @@ void func_80A9D0B4(BgHakuginPost* this, PlayState* play) { func_80A9C634(this, play); func_80A9B160(&D_80A9E028, play); this->unk_16C = this->unk_164; - func_80A9C18C(this, play); + BgHakuginPost_RequestQuakeAndRumble(this, play); func_8019F128(NA_SE_EV_STONEDOOR_STOP); func_80A9CC84(this); } else { diff --git a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c index 44f81da9cd..f853fdfc5d 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c @@ -228,11 +228,11 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) { Actor_MoveWithGravity(&this->dyna.actor); Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_4); if (this->dyna.actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 21536); - Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 12); + Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0); + Quake_SetDuration(quakeIndex, 12); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c index 7398dbfd9e..8a90a68093 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c @@ -832,11 +832,11 @@ void func_80B81A80(Actor* thisx, PlayState* play) { func_80B81B84(this); } else if (this->unk_584 == 15) { - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 31536); - Quake_SetQuakeValues(quakeIndex, 6, 0, 100, 0); - Quake_SetCountdown(quakeIndex, 22); + Quake_SetPerturbations(quakeIndex, 6, 0, 100, 0); + Quake_SetDuration(quakeIndex, 22); } } @@ -859,11 +859,11 @@ void func_80B81BA0(Actor* thisx, PlayState* play) { thisx->shape.rot.x += 0x1F4; if (!(this->unk_584 & 7)) { - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 31536); - Quake_SetQuakeValues(quakeIndex, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0); - Quake_SetCountdown(quakeIndex, 15); + Quake_SetPerturbations(quakeIndex, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0); + Quake_SetDuration(quakeIndex, 15); } if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) { @@ -929,11 +929,11 @@ void func_80B81DC8(Actor* thisx, PlayState* play) { CutsceneManager_Stop(this->dyna.actor.csId); func_80B818B4(this); } else if (this->unk_584 == 19) { - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 5, 0, 40, 60); - Quake_SetCountdown(quakeIndex, 17); + Quake_SetPerturbations(quakeIndex, 5, 0, 40, 60); + Quake_SetDuration(quakeIndex, 17); } } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c index f39ca3b8c0..4a0abb4727 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c @@ -151,10 +151,10 @@ void func_80BD5A18(BgIkanaShutter* this, PlayState* play) { this->dyna.actor.velocity.y *= 0.978f; this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 21536); - Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 12); + Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0); + Quake_SetDuration(quakeIndex, 12); func_80BD5828(this); } diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index 5a69e3ca7a..48045527f5 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -69,19 +69,20 @@ void func_80C0A838(BgIkninSusceil* this, PlayState* play) { DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); } -void func_80C0A86C(BgIkninSusceil* this, PlayState* play, s16 verticalMag, s16 countdown, s32 arg4) { +void BgIkninSusceil_RequestQuakeAndRumble(BgIkninSusceil* this, PlayState* play, s16 quakeY, s16 quakeDuration, + s32 rumbleType) { s32 pad; - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 31536); - Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); - Quake_SetCountdown(quakeIndex, countdown); + Quake_SetPerturbations(quakeIndex, quakeY, 0, 0, 0); + Quake_SetDuration(quakeIndex, quakeDuration); - if (arg4 == 1) { + if (rumbleType == 1) { Rumble_Request(SQ(100.0f), 255, 20, 150); - } else if (arg4 == 2) { + } else if (rumbleType == 2) { Rumble_Request(SQ(100.0f), 180, 20, 100); - } else if (arg4 == 3) { + } else if (rumbleType == 3) { Rumble_Request(SQ(100.0f), 120, 20, 10); } } @@ -154,7 +155,7 @@ void func_80C0ABA8(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.velocity.y *= 0.93f; this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { - func_80C0A86C(this, play, 4, 14, 1); + BgIkninSusceil_RequestQuakeAndRumble(this, play, 4, 14, 1); Flags_UnsetSwitch(play, SUSCEIL_GET_SWITCHFLAG(&this->dyna.actor)); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); func_80C0AC74(this); @@ -197,7 +198,7 @@ void func_80C0AD64(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.velocity.y *= 0.98f; if (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 365.0f, 0.5f, this->dyna.actor.velocity.y, 1.0f) < 0.1f) { - func_80C0A86C(this, play, 1, 14, 3); + BgIkninSusceil_RequestQuakeAndRumble(this, play, 1, 14, 3); CutsceneManager_Stop(this->dyna.actor.csId); func_80C0AB14(this); } else { @@ -216,7 +217,7 @@ void func_80C0AE5C(BgIkninSusceil* this, PlayState* play) { this->dyna.actor.velocity.y = CLAMP_MIN(this->dyna.actor.velocity.y, 1.0f); this->dyna.actor.world.pos.y = this->dyna.actor.world.pos.y + this->dyna.actor.velocity.y; if ((this->dyna.actor.home.pos.y + 365.0f) < this->dyna.actor.world.pos.y) { - func_80C0A86C(this, play, 3, 14, 2); + BgIkninSusceil_RequestQuakeAndRumble(this, play, 3, 14, 2); func_80C0AB14(this); } } diff --git a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c index 6acbc8aa8d..9a3bbabdfa 100644 --- a/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c +++ b/src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c @@ -151,10 +151,10 @@ void func_80ACAEF0(BgOpenShutter* this, PlayState* play) { Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 60.0f, 10, 8.0f, 500, 10, true); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND); - quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); + quakeIndex = Quake_Request(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, -32536); - Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 10); + Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0); + Quake_SetDuration(quakeIndex, 10); Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100); diff --git a/src/overlays/actors/ovl_Boss_03/z_boss_03.c b/src/overlays/actors/ovl_Boss_03/z_boss_03.c index c4c38982ea..054b612bc2 100644 --- a/src/overlays/actors/ovl_Boss_03/z_boss_03.c +++ b/src/overlays/actors/ovl_Boss_03/z_boss_03.c @@ -1050,7 +1050,7 @@ void Boss03_Charge(Boss03* this, PlayState* play) { // Attack platform if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); - func_800BC848(&this->actor, play, 20, 15); + Actor_RequestQuakeAndRumble(&this->actor, play, 20, 15); Actor_Spawn(&play->actorCtx, play, ACTOR_EN_WATER_EFFECT, 0.0f, this->waterHeight, 0.0f, 0, 0, 0x96, ENWATEREFFECT_TYPE_GYORG_SHOCKWAVE); @@ -1773,7 +1773,7 @@ void Boss03_Stunned(Boss03* this, PlayState* play) { Actor_MoveWithGravity(&this->actor); if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { play_sound(NA_SE_IT_WALL_HIT_HARD); - func_800BC848(&this->actor, play, 10, 10); + Actor_RequestQuakeAndRumble(&this->actor, play, 10, 10); } } else { Math_ApproachS(&this->actor.shape.rot.z, -0x6000, 0xA, 0x900); diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index a39b101431..80fc52a228 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -481,7 +481,7 @@ void func_809ECF58(Boss04* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { play_sound(NA_SE_IT_BIG_BOMB_EXPLOSION); - func_800BC848(&this->actor, play, 15, 10); + Actor_RequestQuakeAndRumble(&this->actor, play, 15, 10); this->unk_6F4 = 15; sp3C.x = this->actor.focus.pos.x; sp3C.y = this->actor.focus.pos.y; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index f8fef514d8..fcc183ef98 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -610,10 +610,10 @@ void func_808A1B48(DoorShutter* this, PlayState* play) { } Actor_PlaySfx(&this->actor, NA_SE_EV_BIGWALL_BOUND); - quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); + quakeIndex = Quake_Request(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, -32536); - Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 10); + Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0); + Quake_SetDuration(quakeIndex, 10); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index d4c9800558..34bae262db 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -220,10 +220,10 @@ void EnAni_FallToGround(EnAni* this, PlayState* play) { Animation_Change(&this->skelAnime, &gAniLandingThenStandingUpAnim, 1.0f, 0.0f, 16.0f, ANIMMODE_ONCE, 0.0f); this->stateFlags |= ANI_STATE_WRITHING; - quakeIndex = Quake_Add(play->cameraPtrs[CAM_ID_MAIN], QUAKE_TYPE_3); + quakeIndex = Quake_Request(play->cameraPtrs[CAM_ID_MAIN], QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 27000); - Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 20); + Quake_SetPerturbations(quakeIndex, 7, 0, 0, 0); + Quake_SetDuration(quakeIndex, 20); Actor_PlaySfx(&this->actor, NA_SE_IT_HAMMER_HIT); } diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index 702e07f32e..138b7287b0 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -7,7 +7,7 @@ #include "z_en_bat.h" #include "objects/object_bat/object_bat.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_1000 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnBat*)thisx) diff --git a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c index a78731e297..915bf85ba6 100644 --- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c +++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c @@ -540,13 +540,13 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) { } if (this->actor.bgCheckFlags & BGCHECKFLAG_WALL) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); this->actor.velocity.y = this->unk_29E * 0.375f; Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 10); + Quake_SetPerturbations(quakeIndex, 15, 0, 0, 0); + Quake_SetDuration(quakeIndex, 10); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index c360681e89..f6061d096f 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -8,7 +8,7 @@ #include "objects/object_bigpo/object_bigpo.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_200 | ACTOR_FLAG_1000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE) #define THIS ((EnBigpo*)thisx) diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index c9b31571f5..3992cd02a9 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -742,11 +742,11 @@ void EnBigslime_EndThrowMinislime(EnBigslime* this) { void EnBigslime_BreakIntoMinislime(EnBigslime* this, PlayState* play) { s32 i; - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 15); + Quake_SetPerturbations(quakeIndex, 15, 0, 0, 0); + Quake_SetDuration(quakeIndex, 15); Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100); diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 4ebdbe9166..17ebe10f7d 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -423,8 +423,8 @@ void EnBom_Explode(EnBom* this, PlayState* play) { } } -static s16 D_80872E98[] = { 3, 5 }; -static s16 D_80872E9C[] = { 10, 15 }; +static s16 sQuakeY[] = { 3, 5 }; +static s16 sQuakeDurations[] = { 10, 15 }; void EnBom_Update(Actor* thisx, PlayState* play) { Vec3f effVelocity = { 0.0f, 0.0f, 0.0f }; @@ -545,7 +545,8 @@ void EnBom_Update(Actor* thisx, PlayState* play) { } Actor_Spawn(&play->actorCtx, play, ACTOR_EN_CLEAR_TAG, effPos.x, effPos.y - 10.0f, effPos.z, 0, 0, 0, this->isPowderKeg); - func_800BC848(thisx, play, D_80872E98[this->isPowderKeg], D_80872E9C[this->isPowderKeg]); + Actor_RequestQuakeAndRumble(thisx, play, sQuakeY[this->isPowderKeg], + sQuakeDurations[this->isPowderKeg]); play->envCtx.lightSettings.diffuseColor1[0] = play->envCtx.lightSettings.diffuseColor1[1] = play->envCtx.lightSettings.diffuseColor1[2] = 250; play->envCtx.lightSettings.ambientColor[0] = play->envCtx.lightSettings.ambientColor[1] = diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 623d12f0ed..3238069cce 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -6,7 +6,7 @@ #include "z_en_crow.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_1000 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnCrow*)thisx) diff --git a/src/overlays/actors/ovl_En_Death/z_en_death.c b/src/overlays/actors/ovl_En_Death/z_en_death.c index dd05c2d483..de02f44ade 100644 --- a/src/overlays/actors/ovl_En_Death/z_en_death.c +++ b/src/overlays/actors/ovl_En_Death/z_en_death.c @@ -7,7 +7,7 @@ #include "z_en_death.h" #include "z64rumble.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_1000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_IGNORE_QUAKE) #define THIS ((EnDeath*)thisx) diff --git a/src/overlays/actors/ovl_En_Egol/z_en_egol.c b/src/overlays/actors/ovl_En_Egol/z_en_egol.c index 6f9c0e73a7..2c7fdc030b 100644 --- a/src/overlays/actors/ovl_En_Egol/z_en_egol.c +++ b/src/overlays/actors/ovl_En_Egol/z_en_egol.c @@ -328,19 +328,19 @@ void EnEgol_FootstepEffects(EnEgol* this, PlayState* play, f32 leftFootFrame, f3 if (Animation_OnFrame(&this->skelAnime, leftFootFrame) || Animation_OnFrame(&this->skelAnime, rightFootFrame)) { Vec3f spawnPos; Player* player = GET_PLAYER(play); - s32 quakeSize; + s32 quakeYOffset; s32 pad; Actor_PlaySfx(&this->actor, NA_SE_EN_EYEGOLE_WALK); - quakeSize = 4 - (s32)(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) * 0.02f); - if (quakeSize > 4) { - quakeSize = 4; - } else if (quakeSize < 1) { - quakeSize = 1; + quakeYOffset = 4 - (s32)(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) * 0.02f); + if (quakeYOffset > 4) { + quakeYOffset = 4; + } else if (quakeYOffset < 1) { + quakeYOffset = 1; } if (player->stateFlags3 != PLAYER_STATE3_1000000) { - func_800BC848(&this->actor, play, quakeSize, 2); + Actor_RequestQuakeAndRumble(&this->actor, play, quakeYOffset, 2); } if (Animation_OnFrame(&this->skelAnime, leftFootFrame)) { Math_Vec3f_Copy(&spawnPos, &this->leftFootPos); @@ -755,7 +755,7 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) { f32 nz; s32 pad3; s32 i; - s32 quakeSize; + s32 quakeYOffset; Player* player = GET_PLAYER(play); nx = COLPOLY_GET_NORMAL(colPoly->normal.x); @@ -773,14 +773,14 @@ void EnEgol_Laser(EnEgol* this, PlayState* play) { if ((this->actor.world.pos.y - 50.0f) <= player->actor.world.pos.y) { EnEgol_SpawnEffect(this, &hitPos, &rotToNorm, 100, 0.02f, EYEGORE_EFFECT_IMPACT); } - quakeSize = 4 - (s32)(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) * 0.02f); - if (quakeSize > 4) { - quakeSize = 4; - } else if (quakeSize < 1) { - quakeSize = 1; + quakeYOffset = 4 - (s32)(fabsf(player->actor.world.pos.y - this->actor.world.pos.y) * 0.02f); + if (quakeYOffset > 4) { + quakeYOffset = 4; + } else if (quakeYOffset < 1) { + quakeYOffset = 1; } if (player->stateFlags3 != PLAYER_STATE3_1000000) { - func_800BC848(&this->actor, play, quakeSize, 2); + Actor_RequestQuakeAndRumble(&this->actor, play, quakeYOffset, 2); } Actor_PlaySfx(&this->actor, NA_SE_EV_EXPLOSION); func_800B31BC(play, &hitPos, 40, -2, 255, 20); @@ -880,16 +880,16 @@ void EnEgol_Slam(EnEgol* this, PlayState* play) { Player* player = GET_PLAYER(play); Vec3f spawnPos; f32 dyToPlayer = fabsf(player->actor.world.pos.y - this->actor.world.pos.y); - s32 quakeSize; + s32 quakeYOffset; Actor_PlaySfx(&this->actor, NA_SE_EV_EXPLOSION); - quakeSize = 4 - (s32)(dyToPlayer * 0.02f); - if (quakeSize > 4) { - quakeSize = 4; - } else if (quakeSize < 1) { - quakeSize = 1; + quakeYOffset = 4 - (s32)(dyToPlayer * 0.02f); + if (quakeYOffset > 4) { + quakeYOffset = 4; + } else if (quakeYOffset < 1) { + quakeYOffset = 1; } - func_800BC848(&this->actor, play, quakeSize, 2); + Actor_RequestQuakeAndRumble(&this->actor, play, quakeYOffset, 2); if (this->actor.floorBgId == BGCHECK_SCENE) { Math_Vec3f_Copy(&spawnPos, &this->actor.world.pos); spawnPos.x += Math_SinS(this->actor.world.rot.y) * 60.0f; @@ -1064,7 +1064,7 @@ void EnEgol_Death(EnEgol* this, PlayState* play) { this->subCamAt.y = 60.0f; this->subCamAt.z = 260.0f; Math_Vec3f_Copy(&atOffset, &this->subCamAt); - OLib_DbCameraVec3fSum(&this->actor.world, &atOffset, &this->subCamAt, 1); + OLib_Vec3fAdd(&this->actor.world, &atOffset, &this->subCamAt, OLIB_ADD_OFFSET); this->subCamEye.x = this->actor.world.pos.x; this->subCamEye.y = this->actor.world.pos.y + 70.0f; this->subCamEye.z = this->actor.world.pos.z; @@ -1080,7 +1080,7 @@ void EnEgol_Death(EnEgol* this, PlayState* play) { } else { if (Animation_OnFrame(&this->skelAnime, 46.0f)) { Actor_PlaySfx(&this->actor, NA_SE_EV_EXPLOSION); - func_800BC848(&this->actor, play, 10, 5); + Actor_RequestQuakeAndRumble(&this->actor, play, 10, 5); } if ((curFrame >= this->animEndFrame) && (this->action != EYEGORE_ACTION_DEAD)) { s32 i; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index bc4e3d743e..434ee1b866 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" #include "objects/object_firefly/object_firefly.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_1000 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnFirefly*)thisx) diff --git a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c index 6c105caa2c..00a0d4d9d0 100644 --- a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c +++ b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c @@ -6,7 +6,7 @@ #include "z_en_firefly2.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_1000 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnFirefly2*)thisx) diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index a0c7e31801..3f993ae3a4 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1046,16 +1046,16 @@ s32 func_80A13564(EnGo* this, f32 arg1, f32 arg2, s32 arg3) { return ret; } -void func_80A136B8(PlayState* play, s16 speed, s16 verticalMag, s16 countdown) { - s16 quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); +void EnGo_RequestQuake(PlayState* play, s16 speed, s16 y, s16 duration) { + s16 quakeIndex = Quake_Request(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3); - Quake_SetCountdown(quakeIndex, countdown); + Quake_SetDuration(quakeIndex, duration); Quake_SetSpeed(quakeIndex, speed); - Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0); + Quake_SetPerturbations(quakeIndex, y, 0, 0, 0); } void func_80A13728(EnGo* this, PlayState* play) { - func_80A136B8(play, 27767, 7, 20); + EnGo_RequestQuake(play, 27767, 7, 20); play->actorCtx.unk2 = 4; Actor_Spawn(&play->actorCtx, play, ACTOR_EN_TEST, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index b07d1f2c79..c947d33348 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -451,11 +451,11 @@ s32 func_8093F6F8(EnGoroiwa* this, PlayState* play) { if ((this->actor.velocity.y < 0.0f) && (this->actor.world.pos.y <= sp7C)) { if (this->unk_1CA == 0) { if (this->actor.xzDistToPlayer < 400.0f) { - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 17232); - Quake_SetQuakeValues(quakeIndex, 3, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 7); + Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0); + Quake_SetDuration(quakeIndex, 7); } this->unk_1C4 = 0.0f; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 2f4257347a..6d8e649319 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -523,8 +523,8 @@ s32 func_80998A48(EnGs* this, PlayState* play) { this->unk_1D4 = 0; this->unk_19A |= 1; - this->unk_21C = 5; - this->unk_21E = 40; + this->quakeY = 5; + this->quakeDuration = 40; this->unk_197++; this->unk_197 &= 0xF; this->unk_19D = 1; @@ -558,8 +558,8 @@ s32 func_80998BBC(EnGs* this, PlayState* play) { this->unk_1D4 = 0; this->unk_19A |= 1; - this->unk_21C = 5; - this->unk_21E = 40; + this->quakeY = 5; + this->quakeDuration = 40; this->unk_197--; this->unk_197 &= 0xF; this->unk_19D = 1; @@ -585,8 +585,8 @@ s32 func_80998D44(EnGs* this, PlayState* play) { this->unk_1E0 = -0.8f; Actor_PlaySfx(&this->actor, NA_SE_EV_G_STONE_CRUSH); this->unk_19A |= 1; - this->unk_21C = 40; - this->unk_21E = 11; + this->quakeY = 40; + this->quakeDuration = 11; this->unk_19D++; } else if (this->unk_19D == 1) { step = Math_SmoothStepToF(&this->unk_1DC, this->unk_1E0, 1.0f, 0.4f, 0.001f); @@ -611,8 +611,8 @@ s32 func_80998D44(EnGs* this, PlayState* play) { this->unk_216 = 0; this->unk_1E0 = 0.0f; this->unk_1D4 = 0; - this->unk_21C = 10; - this->unk_21E = 10; + this->quakeY = 10; + this->quakeDuration = 10; this->unk_1DC = 0.5f; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); this->unk_19D += 1; @@ -641,8 +641,8 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { this->unk_1EC = 0.0f; this->unk_19D = 1; - this->unk_21C = 2; - this->unk_21E = 40; + this->quakeY = 2; + this->quakeDuration = 40; this->unk_216 = 200; } @@ -714,8 +714,8 @@ s32 func_80998F9C(EnGs* this, PlayState* play) { this->unk_1F0 = 0.0f; this->unk_1EC = 0.5f; Actor_PlaySfx(&this->actor, NA_SE_EN_STALKID_ATTACK); - this->unk_21C = 20; - this->unk_21E = 2; + this->quakeY = 20; + this->quakeDuration = 2; this->unk_19D = 6; } } @@ -800,8 +800,8 @@ s32 func_809995A4(EnGs* this, PlayState* play) { if (this->unk_1D4 <= 0) { this->unk_19A &= ~4; - this->unk_21C = 3; - this->unk_21E = 40; + this->quakeY = 3; + this->quakeDuration = 40; this->unk_1D4 = 0; this->unk_19D++; } @@ -834,8 +834,8 @@ s32 func_809995A4(EnGs* this, PlayState* play) { this->unk_1DC = 0.0f; this->unk_19D++; - this->unk_21C = 5; - this->unk_21E = 20; + this->quakeY = 5; + this->quakeDuration = 20; this->unk_19A |= 1; this->unk_216 = 200; this->unk_1E0 = (this->unk_197 >> 2) * 0x444; @@ -1028,8 +1028,8 @@ void EnGs_Update(Actor* thisx, PlayState* play) { if ((this->actor.xyzDistToPlayerSq > SQ(400.0f)) || (sp2E < 0) || (sp2E > SCREEN_WIDTH) || (sp2C < 0) || (sp2C > SCREEN_HEIGHT)) { this->unk_216 = 0; - } else if (this->unk_21C > 0) { - func_800BC848(&this->actor, play, this->unk_21C, this->unk_21E); + } else if (this->quakeY > 0) { + Actor_RequestQuakeAndRumble(&this->actor, play, this->quakeY, this->quakeDuration); } } else { this->unk_216 = 0; @@ -1048,8 +1048,8 @@ void EnGs_Update(Actor* thisx, PlayState* play) { } } - if (this->unk_21C > 0) { - this->unk_21C = 0; + if (this->quakeY > 0) { + this->quakeY = 0; } func_80999B34(this); diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.h b/src/overlays/actors/ovl_En_Gs/z_en_gs.h index fb2d62816a..abb4a5b865 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.h +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.h @@ -53,8 +53,8 @@ typedef struct EnGs { /* 0x216 */ s16 unk_216; /* 0x218 */ s16 unk_218; /* 0x21A */ s16 unk_21A; - /* 0x21C */ s16 unk_21C; - /* 0x21E */ s16 unk_21E; + /* 0x21C */ s16 quakeY; + /* 0x21E */ s16 quakeDuration; } EnGs; // size = 0x220 #endif // Z_EN_GS_H diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index 254c9ad679..22ef1282af 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -597,11 +597,11 @@ void func_8095EBDC(EnIshi* this, PlayState* play) { } if (sp70 == 1) { - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 17232); - Quake_SetQuakeValues(quakeIndex, 3, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 7); + Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0); + Quake_SetDuration(quakeIndex, 7); Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); } diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 19fd2c19f6..0eac608d9f 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -609,7 +609,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, PlayState* play) { this->subCamEyeNext.z = D_80971DCC[this->unk190].z; Math_Vec3f_Copy(&tempVec, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->picto.actor.home, &tempVec, &this->subCamEyeNext, 1); + OLib_Vec3fAdd(&this->picto.actor.home, &tempVec, &this->subCamEyeNext, OLIB_ADD_OFFSET); Math_Vec3f_Copy(&this->subCamAtNext, &this->unk22C); Math_Vec3f_Copy(&this->subCamEye, &this->subCamEyeNext); Math_Vec3f_Copy(&this->subCamAt, &this->subCamAtNext); @@ -722,7 +722,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, PlayState* play) { this->subCamEyeNext.y = D_80971FA0[this->unk190].y; this->subCamEyeNext.z = D_80971FA0[this->unk190].z; Math_Vec3f_Copy(&vec3fCopy, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->picto.actor.home, &vec3fCopy, &this->subCamEyeNext, 1); + OLib_Vec3fAdd(&this->picto.actor.home, &vec3fCopy, &this->subCamEyeNext, OLIB_ADD_OFFSET); this->subCamAtNext.x = D_80971FE8[this->unk190].x + this->unk22C.x; this->subCamAtNext.y = D_80971FE8[this->unk190].y + this->unk22C.y; this->subCamAtNext.z = D_80971FE8[this->unk190].z + this->unk22C.z; @@ -831,7 +831,7 @@ void EnKakasi_DancingNightAway(EnKakasi* this, PlayState* play) { this->subCamEyeNext.y = D_80971E38[this->unk190].y; this->subCamEyeNext.z = D_80971E38[this->unk190].z; Math_Vec3f_Copy(&localVec3f, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->picto.actor.home, &localVec3f, &this->subCamEyeNext, 1); + OLib_Vec3fAdd(&this->picto.actor.home, &localVec3f, &this->subCamEyeNext, OLIB_ADD_OFFSET); if (1) {} this->subCamAtNext.x = D_80971EEC[this->unk190].x + this->unk22C.x; @@ -978,7 +978,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, PlayState* play) { this->subCamEyeNext.z = D_80972030.z; Math_Vec3f_Copy(&tempunk238, &this->subCamEyeNext); - OLib_DbCameraVec3fSum(&this->picto.actor.home, &tempunk238, &this->subCamEyeNext, 1); + OLib_Vec3fAdd(&this->picto.actor.home, &tempunk238, &this->subCamEyeNext, OLIB_ADD_OFFSET); this->subCamAtNext.x = ((f32)D_8097203C.x) + this->unk22C.x; // cast req this->subCamAtNext.y = ((f32)D_8097203C.y) + this->unk22C.y; this->subCamAtNext.z = ((f32)D_8097203C.z) + this->unk22C.z; diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 4aa052549f..3b6cbaf869 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -174,20 +174,20 @@ void EnMinislime_CheckBackgroundCollision(EnMinislime* this) { } void EnMinislime_AddIceShardEffect(EnMinislime* this) { + s32 pad; EnBigslime* bigslime = (EnBigslime*)this->actor.parent; EnBigslimeIceShardEffect* iceShardEffect; s32 i = 10 * this->id + BIGSLIME_NUM_VTX; s32 i_end = i + 10; - VecSph vecSph; - - vecSph.yaw = 0; + s16 pitch; + s16 yaw = 0; for (; i < i_end; i++) { iceShardEffect = &bigslime->iceShardEffect[i]; - vecSph.pitch = Rand_S16Offset(0x1000, 0x3000); - iceShardEffect->velocity.x = Math_CosS(vecSph.pitch) * Math_SinS(vecSph.yaw); - iceShardEffect->velocity.y = Math_SinS(vecSph.pitch); - iceShardEffect->velocity.z = Math_CosS(vecSph.pitch) * Math_CosS(vecSph.yaw); + pitch = Rand_S16Offset(0x1000, 0x3000); + iceShardEffect->velocity.x = Math_CosS(pitch) * Math_SinS(yaw); + iceShardEffect->velocity.y = Math_SinS(pitch); + iceShardEffect->velocity.z = Math_CosS(pitch) * Math_CosS(yaw); iceShardEffect->pos.x = this->actor.world.pos.x + (400.0f * this->actor.scale.x) * iceShardEffect->velocity.x; iceShardEffect->pos.y = this->actor.world.pos.y + (((iceShardEffect->velocity.y * 2.0f) - 1.0f) * 400.0f * this->actor.scale.y); @@ -198,7 +198,7 @@ void EnMinislime_AddIceShardEffect(EnMinislime* this) { iceShardEffect->isEnabled = true; Math_Vec3f_ScaleAndStore(&iceShardEffect->velocity, Rand_ZeroFloat(3.0f) + 7.0f, &iceShardEffect->velocity); iceShardEffect->scale = (Rand_ZeroFloat(6.0f) + 2.0f) * 0.001f; - vecSph.yaw += 0x1999; + yaw += 0x1999; } this->frozenAlpha = 0; diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 62dff4188e..850442bad9 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -1224,10 +1224,10 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play) { // Zooms in on Snapper spawn point Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye); - this->quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); + this->quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_6); Quake_SetSpeed(this->quakeIndex, 18000); - Quake_SetQuakeValues(this->quakeIndex, 2, 0, 0, 0); - Quake_SetCountdown(this->quakeIndex, 15); + Quake_SetPerturbations(this->quakeIndex, 2, 0, 0, 0); + Quake_SetDuration(this->quakeIndex, 15); Rumble_Request(this->actor.xyzDistToPlayerSq, 120, 20, 10); @@ -1249,12 +1249,12 @@ void EnPametfrog_SnapperSpawn(EnPametfrog* this, PlayState* play) { void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, PlayState* play) { this->actor.params = GEKKO_GET_SNAPPER; - Quake_Remove(this->quakeIndex); + Quake_RemoveRequest(this->quakeIndex); - this->quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + this->quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(this->quakeIndex, 20000); - Quake_SetQuakeValues(this->quakeIndex, 17, 0, 0, 0); - Quake_SetCountdown(this->quakeIndex, 12); + Quake_SetPerturbations(this->quakeIndex, 17, 0, 0, 0); + Quake_SetDuration(this->quakeIndex, 12); Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 35a972dfc9..53ae734795 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -7,7 +7,7 @@ #include "z_en_po_sisters.h" #include "objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_1000 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) #define THIS ((EnPoSisters*)thisx) diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 95bd2d4746..c8da2f1ee0 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -4,10 +4,11 @@ * Description: Poe */ +#include "prevent_bss_reordering.h" #include "z_en_poh.h" #include "objects/object_po/object_po.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200 | ACTOR_FLAG_1000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE) #define THIS ((EnPoh*)thisx) diff --git a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c index 3716f18d05..dd82ef6828 100644 --- a/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c +++ b/src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c @@ -195,7 +195,7 @@ void EnStopHeishi_UpdateHeadThirdDay(EnStopheishi* this) { this->headTurnTimer1 = 50; } } - } else if ((this->headTurnTimer1 == 0) && (Quake_NumActiveQuakes() != 0) && (this->headTurnTimer2 >= 6)) { + } else if ((this->headTurnTimer1 == 0) && (Quake_GetNumActiveQuakes() != 0) && (this->headTurnTimer2 >= 6)) { this->headTurnTimer2 = 0; } } diff --git a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c index 0e5b8a0f5d..24d036bee6 100644 --- a/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c +++ b/src/overlays/actors/ovl_En_Tanron5/z_en_tanron5.c @@ -350,7 +350,7 @@ void EnTanron5_Update(Actor* thisx, PlayState* play2) { this->actor.shape.rot.y += phi_v0; Actor_PlaySfx(&this->actor, NA_SE_IT_BIG_BOMB_EXPLOSION); - func_800BC848(&this->actor, play, 4, 4); + Actor_RequestQuakeAndRumble(&this->actor, play, 4, 4); this->unk_1A0++; } else { Vec3f sp90; diff --git a/src/overlays/actors/ovl_En_Test6/z_en_test6.c b/src/overlays/actors/ovl_En_Test6/z_en_test6.c index 42ff16ccf8..70ab37232d 100644 --- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c +++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c @@ -425,7 +425,7 @@ void func_80A916F0(EnTest6* this, PlayState* play) { CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); func_800B7298(play, NULL, PLAYER_CSMODE_END); EnTest6_DisableMotionBlur(); - Distortion_ClearType(DISTORTION_TYPE_5); + Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); Actor_Kill(&this->actor); } @@ -491,8 +491,8 @@ void func_80A91760(EnTest6* this, PlayState* play) { } } EnTest6_EnableMotionBlur(120); - Distortion_SetType(DISTORTION_TYPE_5); - Distortion_SetCountdown(80); + Distortion_Request(DISTORTION_TYPE_SONG_OF_TIME); + Distortion_SetDuration(80); play->unk_18844 = true; this->cueId = 95; } @@ -546,7 +546,7 @@ void func_80A91760(EnTest6* this, PlayState* play) { if (this->unk_27A == 10) { this->unk_14C = 0.1f; EnTest6_DisableMotionBlur(); - Distortion_ClearType(DISTORTION_TYPE_5); + Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); play->unk_18844 = false; if (this->unk_254 != NULL) { ZeldaArena_Free(this->unk_254); @@ -646,7 +646,7 @@ void func_80A92118(EnTest6* this, PlayState* play) { CutsceneManager_Stop(play->playerCsIds[PLAYER_CS_ID_SONG_WARP]); func_800B7298(play, NULL, PLAYER_CSMODE_END); EnTest6_DisableMotionBlur(); - Distortion_ClearType(DISTORTION_TYPE_5); + Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); Actor_Kill(&this->actor); } @@ -713,8 +713,8 @@ void func_80A92188(EnTest6* this, PlayState* play) { case 115: EnTest6_EnableMotionBlur(20); - Distortion_SetType(DISTORTION_TYPE_5); - Distortion_SetCountdown(90); + Distortion_Request(DISTORTION_TYPE_SONG_OF_TIME); + Distortion_SetDuration(90); this->cueId = 2; break; @@ -744,7 +744,7 @@ void func_80A92188(EnTest6* this, PlayState* play) { case 14: case 15: EnTest6_EnableMotionBlur(50); - Distortion_ClearType(DISTORTION_TYPE_5); + Distortion_RemoveRequest(DISTORTION_TYPE_SONG_OF_TIME); this->cueId = 0; break; diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index d472077ec9..a26095bc74 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -7,7 +7,7 @@ #include "prevent_bss_reordering.h" #include "z_en_thiefbird.h" -#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200 | ACTOR_FLAG_1000 | ACTOR_FLAG_80000000) +#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_200 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_80000000) #define THIS ((EnThiefbird*)thisx) diff --git a/src/overlays/actors/ovl_En_Twig/z_en_twig.c b/src/overlays/actors/ovl_En_Twig/z_en_twig.c index a863596101..b756d0f923 100644 --- a/src/overlays/actors/ovl_En_Twig/z_en_twig.c +++ b/src/overlays/actors/ovl_En_Twig/z_en_twig.c @@ -4,6 +4,7 @@ * Description: Beaver Race Ring */ +#include "prevent_bss_reordering.h" #include "z_en_twig.h" #include "objects/object_twig/object_twig.h" diff --git a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c index d6cc0e9e6f..2092181638 100644 --- a/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c +++ b/src/overlays/actors/ovl_En_Wiz/z_en_wiz.c @@ -8,8 +8,8 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "overlays/actors/ovl_En_Wiz_Brock/z_en_wiz_brock.h" -#define FLAGS \ - (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_1000 | ACTOR_FLAG_100000 | \ +#define FLAGS \ + (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_100000 | \ ACTOR_FLAG_CANT_LOCK_ON | ACTOR_FLAG_80000000) #define THIS ((EnWiz*)thisx) diff --git a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c index 66c927f1d9..facd8de41d 100644 --- a/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c +++ b/src/overlays/actors/ovl_Obj_Chan/z_obj_chan.c @@ -117,16 +117,16 @@ u32 func_80BB9A1C(ObjChan* this, f32 arg1) { f32 sp20; sp20 = Math_SinS(this->unk1D4) * this->unk1D0; - temp_f6 = (Math_CosS(this->unk1D4) * 0.03834952f * this->unk1D0) + arg1; + temp_f6 = (Math_CosS(this->unk1D4) * (400 * M_PI / 0x8000) * this->unk1D0) + arg1; if (temp_f6 != 0.0f) { - this->unk1D4 = RAD_TO_BINANG(func_80086B30(sp20 * 0.03834952f, temp_f6)); + this->unk1D4 = RAD_TO_BINANG(func_80086B30(sp20 * (400 * M_PI / 0x8000), temp_f6)); } else if (sp20 >= 0.0f) { this->unk1D4 = 0x4000; } else { this->unk1D4 = -0x4000; } if (Math_CosS(this->unk1D4) != 0.0f) { - this->unk1D0 = (temp_f6 / (Math_CosS(this->unk1D4) * 0.03834952f)); + this->unk1D0 = (temp_f6 / (Math_CosS(this->unk1D4) * (400 * M_PI / 0x8000))); } else { this->unk1D0 = sp20; } diff --git a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c index b4b27784e5..79007175d0 100644 --- a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c +++ b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c @@ -174,7 +174,7 @@ void ObjChikuwa_Update(Actor* thisx, PlayState* play) { func_809B17D0(play, this, &temp->unk_00); temp_fs0 = Math3D_Vec3fDistSq(&temp->unk_00, &GET_PLAYER(play)->actor.world.pos); if (temp_fs0 < SQ(240.0f)) { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); if (temp_fs0 < SQ(120.0f)) { quakeVerticalMag = 4; } else { @@ -182,8 +182,8 @@ void ObjChikuwa_Update(Actor* thisx, PlayState* play) { } Quake_SetSpeed(quakeIndex, 17232); - Quake_SetQuakeValues(quakeIndex, quakeVerticalMag, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 7); + Quake_SetPerturbations(quakeIndex, quakeVerticalMag, 0, 0, 0); + Quake_SetDuration(quakeIndex, 7); } } } diff --git a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c index c942f622be..0dba9a21fb 100644 --- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c +++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c @@ -458,20 +458,20 @@ void func_80B139F4(ObjDhouse* this, PlayState* play) { s16 quakeIndex; if (this->unk_1370 == 117) { - quakeIndex = Quake_Add(camera, QUAKE_TYPE_3); + quakeIndex = Quake_Request(camera, QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 8, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 17); + Quake_SetPerturbations(quakeIndex, 8, 0, 0, 0); + Quake_SetDuration(quakeIndex, 17); } else if (this->unk_1370 == 105) { - quakeIndex = Quake_Add(camera, QUAKE_TYPE_3); + quakeIndex = Quake_Request(camera, QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 20); + Quake_SetPerturbations(quakeIndex, 7, 0, 0, 0); + Quake_SetDuration(quakeIndex, 20); } else if (this->unk_1370 == 90) { - quakeIndex = Quake_Add(camera, QUAKE_TYPE_3); + quakeIndex = Quake_Request(camera, QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 62); + Quake_SetPerturbations(quakeIndex, 5, 0, 0, 0); + Quake_SetDuration(quakeIndex, 62); } this->unk_1370--; diff --git a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c index 836a70ba99..f3c271c698 100644 --- a/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c +++ b/src/overlays/actors/ovl_Obj_Dora/z_obj_dora.c @@ -281,7 +281,7 @@ void ObjDora_UpdateCollision(ObjDora* this, PlayState* play) { this->lastGongHitType = DORA_HIT_STRONG; } - func_800BC848(&this->actor, play, 5, 10); + Actor_RequestQuakeAndRumble(&this->actor, play, 5, 10); ObjDora_SetupMoveGong(this); if ((ObjDora_IsHalfHour(time) == true) && (this->rupeeDropTimer == 0)) { diff --git a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c index 1c33af7fe4..a2007ad9bc 100644 --- a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c +++ b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c @@ -74,7 +74,7 @@ void ObjHariko_BobHead(ObjHariko* this, PlayState* play) { } void ObjHariko_CheckForQuakes(ObjHariko* this) { - if (Quake_NumActiveQuakes() != 0) { + if (Quake_GetNumActiveQuakes() != 0) { ObjHariko_SetupBobHead(this); } } diff --git a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c index e69729b92f..692fa84483 100644 --- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c +++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c @@ -293,13 +293,13 @@ void func_80A54600(PlayState* play, Vec3f* arg1, f32 arg2, f32 arg3) { } } -void ObjHugebombiwa_AddQuake(ObjHugebombiwa* this, PlayState* play, s32 quakeVerticalMag) { +void ObjHugebombiwa_RequestQuakeAndRumble(ObjHugebombiwa* this, PlayState* play, s32 quakeVerticalMag) { s32 pad[2]; - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, quakeVerticalMag, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 7); + Quake_SetPerturbations(quakeIndex, quakeVerticalMag, 0, 0, 0); + Quake_SetDuration(quakeIndex, 7); Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150); } @@ -516,7 +516,7 @@ void func_80A55064(ObjHugebombiwa* this, PlayState* play) { ptr->unk_24 = 1; func_80A53E60(play, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 9.8f); if ((play->gameplayFrames % 4) == 0) { - ObjHugebombiwa_AddQuake(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); + ObjHugebombiwa_RequestQuakeAndRumble(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); } } } @@ -612,7 +612,7 @@ void func_80A55564(ObjHugebombiwa* this, PlayState* play) { ptr->unk_24 = 1; func_80A54600(play, &ptr->unk_0C, ptr->unk_18, ptr->unk_00.y * 10.1f); if ((play->gameplayFrames % 4) == 0) { - ObjHugebombiwa_AddQuake(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); + ObjHugebombiwa_RequestQuakeAndRumble(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1); } } } diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index a82c9ceeae..88d04b780f 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -134,10 +134,10 @@ void func_8093D7A0(ObjLift* this, PlayState* play) { if (OBJLIFT_GET_7(&this->dyna.actor) == 7) { func_8093D9C0(this); } else { - quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); + quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1); Quake_SetSpeed(quakeIndex, 10000); - Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 20); + Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0); + Quake_SetDuration(quakeIndex, 20); func_8093D88C(this); } diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 6cdada70be..d5aeffd8f2 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -61,13 +61,13 @@ void ObjTokeiStep_SetSysMatrix(ObjTokeiStepPanel* panel) { mtx->zw = panel->pos.z; } -void ObjTokeiStep_AddQuake(ObjTokeiStep* this, PlayState* play) { +void ObjTokeiStep_RequestQuakeAndRumble(ObjTokeiStep* this, PlayState* play) { s32 pad[2]; - s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); + s16 quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3); Quake_SetSpeed(quakeIndex, 20000); - Quake_SetQuakeValues(quakeIndex, 1, 0, 0, 0); - Quake_SetCountdown(quakeIndex, 7); + Quake_SetPerturbations(quakeIndex, 1, 0, 0, 0); + Quake_SetDuration(quakeIndex, 7); Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10); } @@ -180,7 +180,7 @@ s32 ObjTokeiStep_OpenProcess(ObjTokeiStep* this, PlayState* play) { } if (panel->numBounces == 1) { ObjTokeiStep_SpawnDust(this2, panel, play); - ObjTokeiStep_AddQuake(this2, play); + ObjTokeiStep_RequestQuakeAndRumble(this2, play); } } } diff --git a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c index 93caeb33db..f869b95ac5 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c +++ b/src/overlays/actors/ovl_Oceff_Wipe5/z_oceff_wipe5.c @@ -72,7 +72,7 @@ void OceffWipe5_Draw(Actor* thisx, PlayState* play) { s32 i; s32 pad2; Vec3f activeCamEye = GET_ACTIVE_CAM(play)->eye; - Camera* cam = GET_ACTIVE_CAM(play); + Camera* activeCam = GET_ACTIVE_CAM(play); Vec3f quakeOffset; u8 alpha; s32 colorIndex = OCEFF_WIPE5_GET_SONG_TYPE(thisx) * 3; @@ -88,7 +88,7 @@ void OceffWipe5_Draw(Actor* thisx, PlayState* play) { colorIndex = 0; } - Camera_GetQuakeOffset(&quakeOffset, cam); + Camera_GetQuakeOffset(&quakeOffset, activeCam); if (this->counter < 32) { z = Math_SinS(this->counter << 9) * phi_fv1; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index ebffa7548f..b399de9d34 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -859,9 +859,9 @@ 0x800BC5B8:("Actor_IsTargeted",), 0x800BC5EC:("Actor_OtherIsTargeted",), 0x800BC620:("func_800BC620",), - 0x800BC770:("Actor_AddQuake",), - 0x800BC7D8:("Actor_AddQuakeWithSpeed",), - 0x800BC848:("func_800BC848",), + 0x800BC770:("Actor_RequestQuake",), + 0x800BC7D8:("Actor_RequestQuakeWithSpeed",), + 0x800BC848:("Actor_RequestQuakeAndRumble",), 0x800BC8B8:("Actor_DrawDoorLock",), 0x800BCB50:("Actor_SpawnShieldParticlesMetal",), 0x800BCB70:("Actor_SetColorFilter",), @@ -2072,17 +2072,17 @@ 0x8010C36C:("OLib_ClampMaxDist",), 0x8010C3D4:("OLib_Vec3fDistNormalize",), 0x8010C484:("OLib_VecSphToVec3f",), - 0x8010C530:("OLib_VecSphGeoToVec3f",), + 0x8010C530:("OLib_VecGeoToVec3f",), 0x8010C574:("OLib_Vec3fToVecSph",), - 0x8010C6C8:("OLib_Vec3fToVecSphGeo",), + 0x8010C6C8:("OLib_Vec3fToVecGeo",), 0x8010C710:("OLib_Vec3fDiffToVecSph",), - 0x8010C764:("OLib_Vec3fDiffToVecSphGeo",), - 0x8010C7B8:("OLib_VecSphAddToVec3f",), + 0x8010C764:("OLib_Vec3fDiffToVecGeo",), + 0x8010C7B8:("OLib_AddVecGeoToVec3f",), 0x8010C838:("OLib_Vec3fDiffRad",), 0x8010C8C8:("OLib_Vec3fDiffDegF",), 0x8010C930:("OLib_Vec3fDiffBinAng",), - 0x8010C9C8:("OLib_DbCameraVec3fDiff",), - 0x8010CAA0:("OLib_DbCameraVec3fSum",), + 0x8010C9C8:("OLib_Vec3fDiff",), + 0x8010CAA0:("OLib_Vec3fAdd",), 0x8010CB80:("Gfx_DrawTexRectRGBA16",), 0x8010CD98:("Gfx_DrawTexRectIA8",), 0x8010CFBC:("Gfx_DrawTexRectIA8_DropShadow",), @@ -2289,28 +2289,28 @@ 0x8012A4D0:("Quake_CallbackType2",), 0x8012A540:("Quake_CallbackType4",), 0x8012A5D8:("Quake_GetFreeIndex",), - 0x8012A638:("Quake_AddImpl",), - 0x8012A6F0:("Quake_RemoveRequest",), + 0x8012A638:("Quake_RequestImpl",), + 0x8012A6F0:("Quake_Remove",), 0x8012A718:("Quake_GetRequest",), 0x8012A774:("Quake_SetValue",), 0x8012A8A8:("Quake_SetSpeed",), - 0x8012A8F0:("Quake_SetCountdown",), - 0x8012A940:("Quake_GetCountdown",), - 0x8012A978:("Quake_SetQuakeValues",), - 0x8012A9E0:("Quake_SetQuakeValues2",), + 0x8012A8F0:("Quake_SetDuration",), + 0x8012A940:("Quake_GetTimeLeft",), + 0x8012A978:("Quake_SetPerturbations",), + 0x8012A9E0:("Quake_SetOrientation",), 0x8012AA48:("Quake_Init",), - 0x8012AA9C:("Quake_Add",), - 0x8012AAC0:("Quake_Remove",), - 0x8012AB08:("Quake_Calc",), + 0x8012AA9C:("Quake_Request",), + 0x8012AAC0:("Quake_RemoveRequest",), + 0x8012AB08:("Quake_Update",), 0x8012AE68:("Distortion_Init",), - 0x8012AEAC:("Distortion_SetCountdown",), - 0x8012AED4:("Distortion_GetCountdown",), + 0x8012AEAC:("Distortion_SetDuration",), + 0x8012AED4:("Distortion_GetTimeLeft",), 0x8012AEE4:("Distortion_GetType",), - 0x8012AEF4:("Distortion_SetType",), - 0x8012AF18:("Distortion_ClearType",), + 0x8012AEF4:("Distortion_Request",), + 0x8012AF18:("Distortion_RemoveRequest",), 0x8012AF38:("Distortion_GetUnderwaterCurrentSpeed",), 0x8012AF9C:("Distortion_Update",), - 0x8012BBE8:("Quake_NumActiveQuakes",), + 0x8012BBE8:("Quake_GetNumActiveQuakes",), 0x8012BC50:("Gfx_SetFog",), 0x8012BD8C:("Gfx_SetFogWithSync",), 0x8012BF08:("Gfx_SetFog2",), @@ -9710,7 +9710,7 @@ 0x80A134B0:("func_80A134B0",), 0x80A134F4:("func_80A134F4",), 0x80A13564:("func_80A13564",), - 0x80A136B8:("func_80A136B8",), + 0x80A136B8:("EnGo_RequestQuake",), 0x80A13728:("func_80A13728",), 0x80A137C0:("func_80A137C0",), 0x80A139E4:("func_80A139E4",), @@ -10620,7 +10620,7 @@ 0x80A53E60:("func_80A53E60",), 0x80A541F4:("func_80A541F4",), 0x80A54600:("func_80A54600",), - 0x80A54980:("ObjHugebombiwa_AddQuake",), + 0x80A54980:("ObjHugebombiwa_RequestQuakeAndRumble",), 0x80A54A0C:("func_80A54A0C",), 0x80A54AC0:("ObjHugebombiwa_Init",), 0x80A54BC4:("ObjHugebombiwa_Destroy",), @@ -11433,7 +11433,7 @@ 0x80A9BC0C:("func_80A9BC0C",), 0x80A9BD24:("func_80A9BD24",), 0x80A9C058:("func_80A9C058",), - 0x80A9C18C:("func_80A9C18C",), + 0x80A9C18C:("BgHakuginPost_RequestQuakeAndRumble",), 0x80A9C228:("func_80A9C228",), 0x80A9C634:("func_80A9C634",), 0x80A9C854:("func_80A9C854",), @@ -12211,7 +12211,7 @@ 0x80AD566C:("EnTrt2_TransformLimbDraw",), 0x80AD56E8:("func_80AD56E8",), 0x80AD5BB0:("ObjTokeiStep_SetSysMatrix",), - 0x80AD5BE8:("ObjTokeiStep_AddQuake",), + 0x80AD5BE8:("ObjTokeiStep_RequestQuakeAndRumble",), 0x80AD5C70:("ObjTokeiStep_SpawnDust",), 0x80AD5DFC:("ObjTokeiStep_InitSteps",), 0x80AD5EB8:("ObjTokeiStep_InitStepsOpen",), @@ -16662,7 +16662,7 @@ 0x80C0A740:("func_80C0A740",), 0x80C0A804:("func_80C0A804",), 0x80C0A838:("func_80C0A838",), - 0x80C0A86C:("func_80C0A86C",), + 0x80C0A86C:("BgIkninSusceil_RequestQuakeAndRumble",), 0x80C0A95C:("func_80C0A95C",), 0x80C0AA70:("BgIkninSusceil_Init",), 0x80C0AAE0:("BgIkninSusceil_Destroy",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 6abc9a1a84..68b421ddb2 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -1326,7 +1326,7 @@ 0x801C0EA0:("D_801C0EA0","UNK_TYPE1","",0x1), 0x801C0EAC:("sSheathLimbModelShieldOnBackPos","Vec3f","",0xC), 0x801C0EB8:("sSheathLimbModelShieldOnBackZyxRot","Vec3s","",0x6), - 0x801C0EC0:("sIsQuakeInitialized","UNK_TYPE2","",0x2), + 0x801C0EC0:("sQuakeUnused","UNK_TYPE2","",0x2), 0x801C0EC4:("sQuakeRequestCount","s16","",0x2), 0x801C0EC8:("sQuakeCallbacks","quake_callback_func","[7]",0x1c), 0x801C0EE4:("D_801C0EE4","s16","",0x2), @@ -4006,7 +4006,7 @@ 0x801F59E8:("sPlayerGetItemRefPos","Vec3f","",0xC), 0x801F59F4:("sPlayerLeftHandType","s32","",0x4), 0x801F59F8:("sPlayerRightHandType","s32","",0x4), - 0x801F5A00:("sQuakeRequest","QuakeRequest","[4]",0x90), + 0x801F5A00:("sQuakeRequests","QuakeRequest","[4]",0x90), 0x801F5A90:("sDistortionRequest","DistortionRequest","",0xc), 0x801F5AA0:("sMatAnimStep","s32","",0x4), 0x801F5AA4:("sMatAnimFlags","u32","",0x4), @@ -5679,8 +5679,8 @@ 0x80872E8C:("D_80872E8C","UNK_TYPE1","",0x1), 0x80872E90:("D_80872E90","UNK_TYPE4","",0x4), 0x80872E94:("D_80872E94","UNK_TYPE4","",0x4), - 0x80872E98:("D_80872E98","UNK_TYPE1","",0x1), - 0x80872E9C:("D_80872E9C","UNK_TYPE1","",0x1), + 0x80872E98:("sQuakeY","UNK_TYPE1","",0x1), + 0x80872E9C:("sQuakeDurations","UNK_TYPE1","",0x1), 0x80872EA0:("D_80872EA0","UNK_TYPE4","",0x4), 0x80872EAC:("D_80872EAC","UNK_TYPE4","",0x4), 0x80872EB8:("D_80872EB8","UNK_TYPE4","",0x4), diff --git a/tools/namefixer.py b/tools/namefixer.py index 219785c056..45a128574f 100755 --- a/tools/namefixer.py +++ b/tools/namefixer.py @@ -321,7 +321,10 @@ wordReplace = { "func_800B86C8": "Actor_ChangeFocus", "func_800DF840": "Camera_ChangeMode", "func_800B90F4": "Actor_DeactivateLens", - "func_800BC770": "Actor_AddQuake", + "Actor_AddQuake": "Actor_RequestQuake", + "func_800BC770": "Actor_RequestQuake", + "Actor_AddQuakeWithSpeed": "Actor_RequestQuakeWithSpeed", + "func_800BC848": "Actor_RequestQuakeAndRumble", "func_800DF840": "Camera_ChangeMode", "zelda_malloc": "ZeldaArena_Malloc", "zelda_mallocR": "ZeldaArena_MallocR", @@ -635,12 +638,22 @@ wordReplace = { "func_80114E90": "Inventory_HasEmptyBottle", "func_80114F2C": "Inventory_HasItemInBottle", "func_80123C90": "Player_SetEquipmentData", - "Quake2_ClearType": "Distortion_ClearType", - "Quake2_SetType": "Distortion_SetType", - "Quake2_SetCountdown": "Distortion_SetCountdown", + "Quake2_SetType": "Distortion_Request", + "Distortion_SetType": "Distortion_Request", + "Quake2_SetCountdown": "Distortion_SetDuration", + "Distortion_SetCountdown": "Distortion_SetDuration", + "Distortion_GetCountdown": "Distortion_GetTimeLeft", + "Quake2_ClearType": "Distortion_RemoveRequest", + "Distortion_ClearType": "Distortion_RemoveRequest", "func_800BE680": "Actor_DrawDamageEffects", "func_8012F22C": "Inventory_GetSkullTokenCount", - "Quake_RemoveFromIdx": "Quake_Remove", + "Quake_Add": "Quake_Request", + "Quake_SetQuakeValues": "Quake_SetPerturbations", + "Quake_SetCountdown": "Quake_SetDuration", + "Quake_GetCountdown": "Quake_GetTimeLeft", + "Quake_NumActiveQuakes": "Quake_GetNumActiveQuakes", + "Quake_RemoveFromIdx": "Quake_RemoveRequest", + "OLib_DbCameraVec3fSum":"OLib_Vec3fAdd", "func_8013AB00": "SubS_DrawTransformFlex", "func_8013A860": "SubS_DrawTransformFlexLimb", diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index a2cbcfe763..916349686a 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -373,9 +373,9 @@ asm/non_matchings/code/z_actor/Actor_TestFloorInDirection.s,Actor_TestFloorInDir asm/non_matchings/code/z_actor/Actor_IsTargeted.s,Actor_IsTargeted,0x800BC5B8,0xD asm/non_matchings/code/z_actor/Actor_OtherIsTargeted.s,Actor_OtherIsTargeted,0x800BC5EC,0xD asm/non_matchings/code/z_actor/func_800BC620.s,func_800BC620,0x800BC620,0x54 -asm/non_matchings/code/z_actor/Actor_AddQuake.s,Actor_AddQuake,0x800BC770,0x1A -asm/non_matchings/code/z_actor/Actor_AddQuakeWithSpeed.s,Actor_AddQuakeWithSpeed,0x800BC7D8,0x1C -asm/non_matchings/code/z_actor/func_800BC848.s,func_800BC848,0x800BC848,0x1C +asm/non_matchings/code/z_actor/Actor_RequestQuake.s,Actor_RequestQuake,0x800BC770,0x1A +asm/non_matchings/code/z_actor/Actor_RequestQuakeWithSpeed.s,Actor_RequestQuakeWithSpeed,0x800BC7D8,0x1C +asm/non_matchings/code/z_actor/Actor_RequestQuakeAndRumble.s,Actor_RequestQuakeAndRumble,0x800BC848,0x1C asm/non_matchings/code/z_actor/Actor_DrawDoorLock.s,Actor_DrawDoorLock,0x800BC8B8,0xA6 asm/non_matchings/code/z_actor/Actor_SpawnShieldParticlesMetal.s,Actor_SpawnShieldParticlesMetal,0x800BCB50,0x8 asm/non_matchings/code/z_actor/Actor_SetColorFilter.s,Actor_SetColorFilter,0x800BCB70,0x21 @@ -1586,17 +1586,17 @@ asm/non_matchings/code/z_olib/OLib_ClampMinDist.s,OLib_ClampMinDist,0x8010C304,0 asm/non_matchings/code/z_olib/OLib_ClampMaxDist.s,OLib_ClampMaxDist,0x8010C36C,0x1A asm/non_matchings/code/z_olib/OLib_Vec3fDistNormalize.s,OLib_Vec3fDistNormalize,0x8010C3D4,0x2C asm/non_matchings/code/z_olib/OLib_VecSphToVec3f.s,OLib_VecSphToVec3f,0x8010C484,0x2B -asm/non_matchings/code/z_olib/OLib_VecSphGeoToVec3f.s,OLib_VecSphGeoToVec3f,0x8010C530,0x11 +asm/non_matchings/code/z_olib/OLib_VecGeoToVec3f.s,OLib_VecGeoToVec3f,0x8010C530,0x11 asm/non_matchings/code/z_olib/OLib_Vec3fToVecSph.s,OLib_Vec3fToVecSph,0x8010C574,0x55 -asm/non_matchings/code/z_olib/OLib_Vec3fToVecSphGeo.s,OLib_Vec3fToVecSphGeo,0x8010C6C8,0x12 +asm/non_matchings/code/z_olib/OLib_Vec3fToVecGeo.s,OLib_Vec3fToVecGeo,0x8010C6C8,0x12 asm/non_matchings/code/z_olib/OLib_Vec3fDiffToVecSph.s,OLib_Vec3fDiffToVecSph,0x8010C710,0x15 -asm/non_matchings/code/z_olib/OLib_Vec3fDiffToVecSphGeo.s,OLib_Vec3fDiffToVecSphGeo,0x8010C764,0x15 -asm/non_matchings/code/z_olib/OLib_VecSphAddToVec3f.s,OLib_VecSphAddToVec3f,0x8010C7B8,0x20 +asm/non_matchings/code/z_olib/OLib_Vec3fDiffToVecGeo.s,OLib_Vec3fDiffToVecGeo,0x8010C764,0x15 +asm/non_matchings/code/z_olib/OLib_AddVecGeoToVec3f.s,OLib_AddVecGeoToVec3f,0x8010C7B8,0x20 asm/non_matchings/code/z_olib/OLib_Vec3fDiffRad.s,OLib_Vec3fDiffRad,0x8010C838,0x24 asm/non_matchings/code/z_olib/OLib_Vec3fDiffDegF.s,OLib_Vec3fDiffDegF,0x8010C8C8,0x1A asm/non_matchings/code/z_olib/OLib_Vec3fDiffBinAng.s,OLib_Vec3fDiffBinAng,0x8010C930,0x26 -asm/non_matchings/code/z_olib/OLib_DbCameraVec3fDiff.s,OLib_DbCameraVec3fDiff,0x8010C9C8,0x36 -asm/non_matchings/code/z_olib/OLib_DbCameraVec3fSum.s,OLib_DbCameraVec3fSum,0x8010CAA0,0x34 +asm/non_matchings/code/z_olib/OLib_Vec3fDiff.s,OLib_Vec3fDiff,0x8010C9C8,0x36 +asm/non_matchings/code/z_olib/OLib_Vec3fAdd.s,OLib_Vec3fAdd,0x8010CAA0,0x34 asm/non_matchings/code/z_parameter/Gfx_DrawTexRectRGBA16.s,Gfx_DrawTexRectRGBA16,0x8010CB80,0x86 asm/non_matchings/code/z_parameter/Gfx_DrawTexRectIA8.s,Gfx_DrawTexRectIA8,0x8010CD98,0x89 asm/non_matchings/code/z_parameter/Gfx_DrawTexRectIA8_DropShadow.s,Gfx_DrawTexRectIA8_DropShadow,0x8010CFBC,0xC6 @@ -1803,28 +1803,28 @@ asm/non_matchings/code/z_quake/Quake_CallbackType3.s,Quake_CallbackType3,0x8012A asm/non_matchings/code/z_quake/Quake_CallbackType2.s,Quake_CallbackType2,0x8012A4D0,0x1C asm/non_matchings/code/z_quake/Quake_CallbackType4.s,Quake_CallbackType4,0x8012A540,0x26 asm/non_matchings/code/z_quake/Quake_GetFreeIndex.s,Quake_GetFreeIndex,0x8012A5D8,0x18 -asm/non_matchings/code/z_quake/Quake_AddImpl.s,Quake_AddImpl,0x8012A638,0x2E -asm/non_matchings/code/z_quake/Quake_RemoveRequest.s,Quake_RemoveRequest,0x8012A6F0,0xA +asm/non_matchings/code/z_quake/Quake_RequestImpl.s,Quake_RequestImpl,0x8012A638,0x2E +asm/non_matchings/code/z_quake/Quake_Remove.s,Quake_Remove,0x8012A6F0,0xA asm/non_matchings/code/z_quake/Quake_GetRequest.s,Quake_GetRequest,0x8012A718,0x17 asm/non_matchings/code/z_quake/Quake_SetValue.s,Quake_SetValue,0x8012A774,0x4D asm/non_matchings/code/z_quake/Quake_SetSpeed.s,Quake_SetSpeed,0x8012A8A8,0x12 -asm/non_matchings/code/z_quake/Quake_SetCountdown.s,Quake_SetCountdown,0x8012A8F0,0x14 -asm/non_matchings/code/z_quake/Quake_GetCountdown.s,Quake_GetCountdown,0x8012A940,0xE -asm/non_matchings/code/z_quake/Quake_SetQuakeValues.s,Quake_SetQuakeValues,0x8012A978,0x1A -asm/non_matchings/code/z_quake/Quake_SetQuakeValues2.s,Quake_SetQuakeValues2,0x8012A9E0,0x1A +asm/non_matchings/code/z_quake/Quake_SetDuration.s,Quake_SetDuration,0x8012A8F0,0x14 +asm/non_matchings/code/z_quake/Quake_GetTimeLeft.s,Quake_GetTimeLeft,0x8012A940,0xE +asm/non_matchings/code/z_quake/Quake_SetPerturbations.s,Quake_SetPerturbations,0x8012A978,0x1A +asm/non_matchings/code/z_quake/Quake_SetOrientation.s,Quake_SetOrientation,0x8012A9E0,0x1A asm/non_matchings/code/z_quake/Quake_Init.s,Quake_Init,0x8012AA48,0x15 -asm/non_matchings/code/z_quake/Quake_Add.s,Quake_Add,0x8012AA9C,0x9 -asm/non_matchings/code/z_quake/Quake_Remove.s,Quake_Remove,0x8012AAC0,0x12 -asm/non_matchings/code/z_quake/Quake_Calc.s,Quake_Calc,0x8012AB08,0xD8 +asm/non_matchings/code/z_quake/Quake_Request.s,Quake_Request,0x8012AA9C,0x9 +asm/non_matchings/code/z_quake/Quake_RemoveRequest.s,Quake_RemoveRequest,0x8012AAC0,0x12 +asm/non_matchings/code/z_quake/Quake_Update.s,Quake_Update,0x8012AB08,0xD8 asm/non_matchings/code/z_quake/Distortion_Init.s,Distortion_Init,0x8012AE68,0x11 -asm/non_matchings/code/z_quake/Distortion_SetCountdown.s,Distortion_SetCountdown,0x8012AEAC,0xA -asm/non_matchings/code/z_quake/Distortion_GetCountdown.s,Distortion_GetCountdown,0x8012AED4,0x4 +asm/non_matchings/code/z_quake/Distortion_SetDuration.s,Distortion_SetDuration,0x8012AEAC,0xA +asm/non_matchings/code/z_quake/Distortion_GetTimeLeft.s,Distortion_GetTimeLeft,0x8012AED4,0x4 asm/non_matchings/code/z_quake/Distortion_GetType.s,Distortion_GetType,0x8012AEE4,0x4 -asm/non_matchings/code/z_quake/Distortion_SetType.s,Distortion_SetType,0x8012AEF4,0x9 -asm/non_matchings/code/z_quake/Distortion_ClearType.s,Distortion_ClearType,0x8012AF18,0x8 +asm/non_matchings/code/z_quake/Distortion_Request.s,Distortion_Request,0x8012AEF4,0x9 +asm/non_matchings/code/z_quake/Distortion_RemoveRequest.s,Distortion_RemoveRequest,0x8012AF18,0x8 asm/non_matchings/code/z_quake/Distortion_GetUnderwaterCurrentSpeed.s,Distortion_GetUnderwaterCurrentSpeed,0x8012AF38,0x19 asm/non_matchings/code/z_quake/Distortion_Update.s,Distortion_Update,0x8012AF9C,0x313 -asm/non_matchings/code/z_quake/Quake_NumActiveQuakes.s,Quake_NumActiveQuakes,0x8012BBE8,0x1A +asm/non_matchings/code/z_quake/Quake_GetNumActiveQuakes.s,Quake_GetNumActiveQuakes,0x8012BBE8,0x1A asm/non_matchings/code/z_rcp/Gfx_SetFog.s,Gfx_SetFog,0x8012BC50,0x4F asm/non_matchings/code/z_rcp/Gfx_SetFogWithSync.s,Gfx_SetFogWithSync,0x8012BD8C,0x5F asm/non_matchings/code/z_rcp/Gfx_SetFog2.s,Gfx_SetFog2,0x8012BF08,0xD