summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2022-09-30 22:01:39 -0400
committerGitHub <noreply@github.com>2022-09-30 23:01:39 -0300
commitab5fd663ccddc0670773a047f4a30bf014a7dad4 (patch)
tree37011a91071e4acd136aa2e587b2dcb0a2b6dfcd
parentb080fb370032738769467242c7a1a7945f972836 (diff)
Quake & Distortion Cleanup (#1102)
* quake cleanup * cleanup * more cleanup * remove cast * q comes before r... * unname goron function, leave it to another PR * PR Suggestions
-rw-r--r--include/functions.h37
-rw-r--r--include/z64.h57
-rw-r--r--include/z64bgcheck.h5
-rw-r--r--include/z64quake.h69
-rw-r--r--src/code/z_actor.c23
-rw-r--r--src/code/z_bgcheck.c18
-rw-r--r--src/code/z_camera.c1
-rw-r--r--src/code/z_demo.c7
-rw-r--r--src/code/z_play.c1
-rw-r--r--src/code/z_quake.c298
-rw-r--r--src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c24
-rw-r--r--src/overlays/actors/ovl_Bg_Ikana_Dharma/z_bg_ikana_dharma.c10
-rw-r--r--src/overlays/actors/ovl_Bg_Ikana_Rotaryroom/z_bg_ikana_rotaryroom.c25
-rw-r--r--src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c12
-rw-r--r--src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c10
-rw-r--r--src/overlays/actors/ovl_Bg_Open_Shutter/z_bg_open_shutter.c22
-rw-r--r--src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c1
-rw-r--r--src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c14
-rw-r--r--src/overlays/actors/ovl_En_Ani/z_en_ani.c13
-rw-r--r--src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c15
-rw-r--r--src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c11
-rw-r--r--src/overlays/actors/ovl_En_Go/z_en_go.c13
-rw-r--r--src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c10
-rw-r--r--src/overlays/actors/ovl_En_Ishi/z_en_ishi.c10
-rw-r--r--src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c26
-rw-r--r--src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h2
-rw-r--r--src/overlays/actors/ovl_En_Stop_heishi/z_en_stop_heishi.c1
-rw-r--r--src/overlays/actors/ovl_En_Test6/z_en_test6.c13
-rw-r--r--src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c17
-rw-r--r--src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c27
-rw-r--r--src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c1
-rw-r--r--src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c16
-rw-r--r--src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c12
-rw-r--r--src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c10
-rw-r--r--src/overlays/actors/ovl_player_actor/z_player.c1
-rw-r--r--src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c2
-rw-r--r--tools/disasm/functions.txt24
-rw-r--r--tools/disasm/variables.txt2
-rwxr-xr-xtools/namefixer.py5
-rw-r--r--tools/sizes/code_functions.csv22
40 files changed, 497 insertions, 390 deletions
diff --git a/include/functions.h b/include/functions.h
index 67ad8ec3c..b19b75af9 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -745,8 +745,8 @@ 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* arg0, Vec3f* arg1, u8 alpha, PlayState* play);
-void func_800BC770(PlayState* play, s16 y, s16 countdown);
-void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed);
+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_DrawDoorLock(PlayState* play, s32 frame, s32 type);
void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 xluFlag, u16 duration);
@@ -923,7 +923,7 @@ u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId)
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
-s32 SurfaceType_GetConveyorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
+s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
@@ -1958,37 +1958,6 @@ s32 func_80128640(PlayState* play, Player* player, Gfx* dlist);
void func_80128B74(PlayState* play, Player* player, s32 limbIndex);
void func_80128BD0(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor);
-f32 Quake_Random(void);
-void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPertubation, f32 horizontalPertubation);
-s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_GetFreeIndex(void);
-QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx);
-void Quake_Remove(QuakeRequest* req);
-QuakeRequest* Quake_GetRequest(s16 idx);
-u32 Quake_SetValue(s16 idx, s16 valueType, s16 value);
-u32 Quake_SetSpeed(s16 idx, s16 value);
-u32 Quake_SetCountdown(s16 idx, s16 value);
-s16 Quake_GetCountdown(s16 idx);
-u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset);
-u32 Quake_SetQuakeValues2(s16 idx, s16 isShakePerpendicular, Vec3s shakePlaneOffset);
-void Quake_Init(void);
-s16 Quake_Add(Camera* camera, u32 callbackIdx);
-u32 Quake_RemoveFromIdx(s16 idx);
-s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData);
-void Distortion_Init(PlayState* play);
-void Distortion_SetCountdown(s16 countdown);
-s16 Distortion_GetCountdown(void);
-s16 Distortion_GetType(void);
-void Distortion_SetType(s32 type);
-void Distortion_ClearType(s32 type);
-s32 Distortion_GetUnderwaterCurrentSpeed(Player* player);
-void Distortion_Update(void);
-s32 Quake_NumActiveQuakes(void);
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f);
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f);
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f);
diff --git a/include/z64.h b/include/z64.h
index 96302ed0c..ceb91bfb8 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -897,63 +897,6 @@ typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec
typedef void(*room_draw_func)(PlayState* play, Room* room, u32 flags);
typedef struct {
- /* 0x00 */ Vec3f atOffset;
- /* 0x0C */ Vec3f eyeOffset;
- /* 0x18 */ s16 rollOffset;
- /* 0x1A */ s16 zoom;
-} ShakeInfo; // size = 0x1C
-
-typedef struct {
- /* 0x00 */ s16 randIdx;
- /* 0x02 */ s16 countdownMax;
- /* 0x04 */ Camera* camera;
- /* 0x08 */ u32 callbackIdx;
- /* 0x0C */ s16 verticalMag;
- /* 0x0E */ s16 horizontalMag;
- /* 0x10 */ s16 zoom;
- /* 0x12 */ s16 rollOffset;
- /* 0x14 */ Vec3s shakePlaneOffset; // angle deviations from shaking in the perpendicular plane
- /* 0x1A */ s16 speed;
- /* 0x1C */ s16 isShakePerpendicular;
- /* 0x1E */ s16 countdown;
- /* 0x20 */ s16 camId;
-} QuakeRequest; // size = 0x24
-
-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
-
-typedef s16 (*QuakeCallbackFunc)(QuakeRequest*, ShakeInfo*);
-
-#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)
-
-typedef struct {
- /* 0x0 */ PlayState* play;
- /* 0x4 */ s32 type; // bitfield, highest set bit determines type
- /* 0x8 */ s16 countdown;
- /* 0xA */ s16 state;
-} DistortionContext; // size = 0xC
-
-typedef enum {
- /* 0 */ DISTORTION_INACTIVE,
- /* 1 */ DISTORTION_ACTIVE,
- /* 2 */ DISTORTION_SETUP
-} DistortionState;
-
-typedef struct {
/* 0x000 */ u8 controllers; // bit 0 is set if controller 1 is plugged in, etc.
/* 0x001 */ UNK_TYPE1 pad1[0x13];
/* 0x014 */ OSContStatus statuses[4];
diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h
index b42938354..c2a9bab7c 100644
--- a/include/z64bgcheck.h
+++ b/include/z64bgcheck.h
@@ -56,11 +56,6 @@ struct DynaPolyActor;
// CollisionContext flags
#define BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW 1
-typedef enum {
- /* 0 */ CONVEYOR_WATER,
- /* 1 */ CONVEYOR_FLOOR
-} ConveyorType;
-
typedef struct {
/* 0x0 */ Vec3s pos;
} BgVertex; // size = 0x6
diff --git a/include/z64quake.h b/include/z64quake.h
new file mode 100644
index 000000000..468f56793
--- /dev/null
+++ b/include/z64quake.h
@@ -0,0 +1,69 @@
+#ifndef Z64QUAKE_H
+#define Z64QUAKE_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)
+
+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
+} 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 quakeIndex);
+s32 Quake_NumActiveQuakes(void);
+void Quake_Init(void);
+
+#define DISTORTION_TYPE_0 (1 << 0)
+#define DISTORTION_TYPE_2 (1 << 2)
+#define DISTORTION_TYPE_3 (1 << 3)
+#define DISTORTION_TYPE_4 (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)
+
+void Distortion_SetCountdown(s16 countdown);
+s16 Distortion_GetCountdown(void);
+s16 Distortion_GetType(void);
+void Distortion_SetType(s32 type);
+void Distortion_ClearType(s32 type);
+void Distortion_Init(PlayState* play);
+void Distortion_Update(void);
+
+#endif
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index e82e5d2b9..389f7a051 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -5,6 +5,7 @@
#include "global.h"
#include "z64load.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
#include "overlays/actors/ovl_En_Part/z_en_part.h"
@@ -3777,20 +3778,20 @@ void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx);
}
-void func_800BC770(PlayState* play, s16 y, s16 countdown) {
- s16 idx = Quake_Add(&play->mainCamera, 3);
+void Actor_AddQuake(PlayState* play, s16 verticalMag, s16 countdown) {
+ s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3);
- Quake_SetSpeed(idx, 20000);
- Quake_SetQuakeValues(idx, y, 0, 0, 0);
- Quake_SetCountdown(idx, countdown);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, countdown);
}
-void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed) {
- s16 idx = Quake_Add(&play->mainCamera, 3);
+void Actor_AddQuakeWithSpeed(PlayState* play, s16 verticalMag, s16 countdown, s16 speed) {
+ s16 quakeIndex = Quake_Add(&play->mainCamera, QUAKE_TYPE_3);
- Quake_SetSpeed(idx, speed);
- Quake_SetQuakeValues(idx, y, 0, 0, 0);
- Quake_SetCountdown(idx, countdown);
+ Quake_SetSpeed(quakeIndex, speed);
+ Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, countdown);
}
// Actor_RequestRumble?
@@ -3800,7 +3801,7 @@ void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown) {
} else {
Rumble_Request(actor->xyzDistToPlayerSq, 180, 20, 100);
}
- func_800BC770(play, y, countdown);
+ Actor_AddQuake(play, y, countdown);
}
typedef struct {
diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c
index 130fdc970..7f4247b0d 100644
--- a/src/code/z_bgcheck.c
+++ b/src/code/z_bgcheck.c
@@ -4331,18 +4331,22 @@ s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly*
}
/**
- * SurfaceType Get Conveyor Surface Type
- * Return type 0 (CONVEYOR_WATER) if 'poly' is a surface that will only move player underwater
- * Return type 1 (CONVEYOR_FLOOR) if `poly` is a surface that must be stood on to move player
- */
-s32 SurfaceType_GetConveyorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
+ * Checks if poly is a floor conveyor
+ *
+ * A conveyor surface is enabled with non-zero speed.
+ * When enabled, the conveyor will exhibit two types of behaviour depending on the return value:
+ *
+ * If true, then it is a floor conveyor and will push player only while being stood on
+ * If false, then it is a water conveyor and will push player only while in water
+ */
+s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) {
u32 flags;
if (BgCheck_GetCollisionHeader(colCtx, bgId) == NULL) {
- return CONVEYOR_FLOOR;
+ return true;
}
if (poly == NULL) {
- return CONVEYOR_WATER;
+ return false;
}
flags = poly->flags_vIB & 0x2000;
return !!flags;
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index 027b78a4a..c26947b21 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "z64quake.h"
/**
* Returns the absolute value for floats
diff --git a/src/code/z_demo.c b/src/code/z_demo.c
index 69995db16..7dd357fbd 100644
--- a/src/code/z_demo.c
+++ b/src/code/z_demo.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/gamestates/ovl_daytelop/z_daytelop.h"
@@ -191,7 +192,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
case 0x8:
func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG);
if (isStartFrame) {
- sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
+ sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sCutsceneQuakeIndex, 22000);
Quake_SetQuakeValues(sCutsceneQuakeIndex, 6, 4, 0, 0);
Quake_SetCountdown(sCutsceneQuakeIndex, 800);
@@ -281,7 +282,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
case 0x1A:
func_8019F128(NA_SE_EV_EARTHQUAKE_LAST2 - SFX_FLAG);
if (isStartFrame) {
- sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
+ sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sCutsceneQuakeIndex, 30000);
Quake_SetQuakeValues(sCutsceneQuakeIndex, 20, 10, 0, 0);
Quake_SetCountdown(sCutsceneQuakeIndex, 800);
@@ -333,7 +334,7 @@ void Cutscene_Command_Misc(PlayState* play, CutsceneContext* csCtx, CsCmdBase* c
case 0x24:
func_8019F128(NA_SE_EV_EARTHQUAKE_LAST - SFX_FLAG);
if (isStartFrame) {
- sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
+ sCutsceneQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sCutsceneQuakeIndex, 22000);
Quake_SetQuakeValues(sCutsceneQuakeIndex, 2, 1, 0, 0);
Quake_SetCountdown(sCutsceneQuakeIndex, 800);
diff --git a/src/code/z_play.c b/src/code/z_play.c
index bb04f23c0..06ec9c21e 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "z64quake.h"
#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165460.s")
diff --git a/src/code/z_quake.c b/src/code/z_quake.c
index 7caa0f426..2b66a39f8 100644
--- a/src/code/z_quake.c
+++ b/src/code/z_quake.c
@@ -1,7 +1,46 @@
#include "global.h"
+#include "z64quake.h"
+
+typedef struct {
+ /* 0x00 */ s16 randIndex;
+ /* 0x02 */ s16 countdownMax;
+ /* 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
+ /* 0x1A */ s16 speed;
+ /* 0x1C */ s16 isShakePerpendicular;
+ /* 0x1E */ s16 countdown;
+ /* 0x20 */ s16 camId;
+} QuakeRequest; // size = 0x24
+
+typedef struct {
+ /* 0x0 */ PlayState* play;
+ /* 0x4 */ s32 type; // bitfield, highest set bit determines type
+ /* 0x8 */ s16 countdown;
+ /* 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 {
+ /* 0 */ DISTORTION_INACTIVE,
+ /* 1 */ DISTORTION_ACTIVE,
+ /* 2 */ DISTORTION_SETUP
+} DistortionState;
QuakeRequest sQuakeRequest[4];
-DistortionContext sDistortionContext;
+DistortionRequest sDistortionRequest;
static s16 sIsQuakeInitialized = true;
static s16 sQuakeRequestCount = 0;
@@ -51,7 +90,7 @@ void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPert
shake->zoom = req->zoom * verticalPertubation;
}
-s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
+s16 Quake_CallbackType1(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown);
@@ -61,7 +100,7 @@ s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
-s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
+s16 Quake_CallbackType5(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Math_SinS(req->speed * req->countdown);
@@ -71,7 +110,7 @@ s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
-s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
+s16 Quake_CallbackType6(QuakeRequest* req, ShakeInfo* shake) {
f32 perpendicularPertubation;
req->countdown--;
@@ -80,7 +119,7 @@ s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
return 1;
}
-s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
+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);
@@ -91,7 +130,7 @@ s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
-s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
+s16 Quake_CallbackType2(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Quake_Random();
@@ -101,7 +140,7 @@ s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
return req->countdown;
}
-s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) {
+s16 Quake_CallbackType4(QuakeRequest* req, ShakeInfo* shake) {
if (req->countdown > 0) {
f32 perpendicularPertubation = Quake_Random() * ((f32)req->countdown / (f32)req->countdownMax);
@@ -117,7 +156,7 @@ s16 Quake_GetFreeIndex(void) {
s32 min = 0x10000;
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
- if (sQuakeRequest[i].callbackIdx == 0) {
+ if (sQuakeRequest[i].type == 0) {
ret = i;
break;
}
@@ -131,43 +170,43 @@ s16 Quake_GetFreeIndex(void) {
return ret;
}
-QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) {
- s16 idx = Quake_GetFreeIndex();
- QuakeRequest* req = &sQuakeRequest[idx];
+QuakeRequest* Quake_AddImpl(Camera* camera, u32 type) {
+ s16 index = Quake_GetFreeIndex();
+ QuakeRequest* req = &sQuakeRequest[index];
__osMemset(req, 0, sizeof(QuakeRequest));
req->camera = camera;
req->camId = camera->camId;
- req->callbackIdx = callbackIdx;
+ req->type = type;
req->isShakePerpendicular = true;
- req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
+ req->randIndex = ((s16)(Rand_ZeroOne() * 0x10000) & ~3) + index;
sQuakeRequestCount++;
return req;
}
-void Quake_Remove(QuakeRequest* req) {
- req->callbackIdx = 0;
+void Quake_RemoveRequest(QuakeRequest* req) {
+ req->type = 0;
req->countdown = -1;
sQuakeRequestCount--;
}
-QuakeRequest* Quake_GetRequest(s16 idx) {
- QuakeRequest* req = &sQuakeRequest[idx & 3];
+QuakeRequest* Quake_GetRequest(s16 quakeIndex) {
+ QuakeRequest* req = &sQuakeRequest[quakeIndex & 3];
- if (req->callbackIdx == 0) {
+ if (req->type == 0) {
return NULL;
}
- if (idx != req->randIdx) {
+ if (quakeIndex != req->randIndex) {
return NULL;
}
return req;
}
-u32 Quake_SetValue(s16 idx, s16 valueType, s16 value) {
- QuakeRequest* req = Quake_GetRequest(idx);
+u32 Quake_SetValue(s16 quakeIndex, s16 valueType, s16 value) {
+ QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req == NULL) {
return false;
@@ -176,62 +215,75 @@ u32 Quake_SetValue(s16 idx, s16 valueType, s16 value) {
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;
}
}
-u32 Quake_SetSpeed(s16 idx, s16 value) {
- QuakeRequest* req = Quake_GetRequest(idx);
+u32 Quake_SetSpeed(s16 quakeIndex, s16 speed) {
+ QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
- req->speed = value;
+ req->speed = speed;
return true;
}
return false;
}
-u32 Quake_SetCountdown(s16 idx, s16 value) {
- QuakeRequest* req = Quake_GetRequest(idx);
+u32 Quake_SetCountdown(s16 quakeIndex, s16 countdown) {
+ QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
- req->countdown = value;
+ req->countdown = countdown;
req->countdownMax = req->countdown;
return true;
}
return false;
}
-s16 Quake_GetCountdown(s16 idx) {
- QuakeRequest* req = Quake_GetRequest(idx);
+s16 Quake_GetCountdown(s16 quakeIndex) {
+ QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
return req->countdown;
@@ -239,8 +291,8 @@ s16 Quake_GetCountdown(s16 idx) {
return 0;
}
-u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset) {
- QuakeRequest* req = Quake_GetRequest(idx);
+u32 Quake_SetQuakeValues(s16 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset) {
+ QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
req->verticalMag = verticalMag;
@@ -252,8 +304,8 @@ u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom,
return false;
}
-u32 Quake_SetQuakeValues2(s16 idx, s16 isShakePerpendicular, Vec3s shakePlaneOffset) {
- QuakeRequest* req = Quake_GetRequest(idx);
+u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset) {
+ QuakeRequest* req = Quake_GetRequest(quakeIndex);
if (req != NULL) {
req->isShakePerpendicular = isShakePerpendicular;
@@ -267,29 +319,35 @@ void Quake_Init(void) {
s16 i;
for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
- sQuakeRequest[i].callbackIdx = 0;
+ sQuakeRequest[i].type = 0;
sQuakeRequest[i].countdown = 0;
}
sIsQuakeInitialized = true;
sQuakeRequestCount = 0;
}
-s16 Quake_Add(Camera* camera, u32 callbackIdx) {
- return Quake_AddImpl(camera, callbackIdx)->randIdx;
+s16 Quake_Add(Camera* camera, u32 type) {
+ return Quake_AddImpl(camera, type)->randIndex;
}
-u32 Quake_RemoveFromIdx(s16 idx) {
- QuakeRequest* req = Quake_GetRequest(idx);
+u32 Quake_Remove(s16 index) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
- Quake_Remove(req);
+ Quake_RemoveRequest(req);
return true;
}
return false;
}
static QuakeCallbackFunc sQuakeCallbacks[] = {
- NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6,
+ NULL,
+ Quake_CallbackType1,
+ Quake_CallbackType2,
+ Quake_CallbackType3,
+ Quake_CallbackType4,
+ Quake_CallbackType5,
+ Quake_CallbackType6,
};
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
@@ -299,7 +357,7 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
f32 absSpeedDiv;
f32 maxCurr;
f32 maxNext;
- s32 idx;
+ s32 index;
s32 ret;
u32 eq;
Vec3f originVec;
@@ -323,16 +381,16 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
}
ret = 0;
- for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
- req = &sQuakeRequest[idx];
- if (req->callbackIdx != 0) {
+ for (index = 0; index < ARRAY_COUNT(sQuakeRequest); index++) {
+ req = &sQuakeRequest[index];
+ if (req->type != 0) {
if (play->cameraPtrs[req->camId] == NULL) {
- Quake_Remove(req);
+ Quake_RemoveRequest(req);
} else {
eq = (camera->camId != req->camera->camId);
absSpeedDiv = ABS(req->speed) / (f32)0x8000;
- if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
- Quake_Remove(req);
+ 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;
@@ -383,35 +441,35 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
}
void Distortion_Init(PlayState* play) {
- sDistortionContext.play = play;
+ sDistortionRequest.play = play;
View_ClearDistortion(&play->view);
- sDistortionContext.type = 0;
- sDistortionContext.countdown = 0;
- sDistortionContext.state = DISTORTION_INACTIVE;
+ sDistortionRequest.type = 0;
+ sDistortionRequest.countdown = 0;
+ sDistortionRequest.state = DISTORTION_INACTIVE;
}
void Distortion_SetCountdown(s16 countdown) {
- sDistortionContext.countdown = countdown;
- sDistortionContext.state = DISTORTION_SETUP;
+ sDistortionRequest.countdown = countdown;
+ sDistortionRequest.state = DISTORTION_SETUP;
}
s16 Distortion_GetCountdown(void) {
- return sDistortionContext.countdown;
+ return sDistortionRequest.countdown;
}
s16 Distortion_GetType(void) {
- return sDistortionContext.type;
+ return sDistortionRequest.type;
}
void Distortion_SetType(s32 type) {
- if (sDistortionContext.type < type) {
- sDistortionContext.type = type;
+ if (sDistortionRequest.type < type) {
+ sDistortionRequest.type = type;
}
}
void Distortion_ClearType(s32 type) {
- if (sDistortionContext.type == type) {
- sDistortionContext.type = 0;
+ if (sDistortionRequest.type == type) {
+ sDistortionRequest.type = 0;
}
}
@@ -419,9 +477,9 @@ void Distortion_ClearType(s32 type) {
* Checks that the bg surface is an underwater conveyor type and if so, returns the conveyor speed
*/
s32 Distortion_GetUnderwaterCurrentSpeed(Player* player) {
- if (SurfaceType_GetConveyorType(&sDistortionContext.play->colCtx, player->actor.floorPoly,
- player->actor.floorBgId) == CONVEYOR_WATER) {
- return SurfaceType_GetConveyorSpeed(&sDistortionContext.play->colCtx, player->actor.floorPoly,
+ if (!SurfaceType_IsFloorConveyor(&sDistortionRequest.play->colCtx, player->actor.floorPoly,
+ player->actor.floorBgId)) {
+ return SurfaceType_GetConveyorSpeed(&sDistortionRequest.play->colCtx, player->actor.floorPoly,
player->actor.floorBgId);
}
return 0;
@@ -446,14 +504,14 @@ void Distortion_Update(void) {
f32 zScale;
f32 speed;
Player* player;
- PlayState* play = sDistortionContext.play;
+ PlayState* play = sDistortionRequest.play;
PosRot playerPosRot;
Camera* camera = GET_ACTIVE_CAM(play);
f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f);
- if (sDistortionContext.type != 0) {
- if (sDistortionContext.type & 0x800) {
- sDistortionContext.countdown = 2;
+ if (sDistortionRequest.type != 0) {
+ if (sDistortionRequest.type & DISTORTION_TYPE_B) {
+ sDistortionRequest.countdown = 2;
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
@@ -469,11 +527,11 @@ void Distortion_Update(void) {
zScale = 0.0f;
speed = 0.6f;
- xyScaleFactor = zScaleFactor = sDistortionContext.countdown / 60.0f;
+ xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / 60.0f;
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 0x400) {
- if (sDistortionContext.state == DISTORTION_SETUP) {
- countdownMax = sDistortionContext.countdown;
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_A) {
+ if (sDistortionRequest.state == DISTORTION_SETUP) {
+ countdownMax = sDistortionRequest.countdown;
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
}
@@ -490,11 +548,11 @@ void Distortion_Update(void) {
zScale = 0.0f;
speed = 0.4f;
- xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax;
+ xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax;
speedScaleFactor = 0.5f;
- } else if (sDistortionContext.type & 0x200) {
- if (sDistortionContext.state == DISTORTION_SETUP) {
- countdownMax = sDistortionContext.countdown;
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_9) {
+ if (sDistortionRequest.state == DISTORTION_SETUP) {
+ countdownMax = sDistortionRequest.countdown;
depthPhase = 0x1FC;
screenPlanePhase = 0x156;
}
@@ -511,11 +569,11 @@ void Distortion_Update(void) {
zScale = 0.0f;
speed = 0.1f;
- xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax;
+ xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax;
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 0x100) {
- if (sDistortionContext.state == DISTORTION_SETUP) {
- countdownMax = sDistortionContext.countdown;
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_8) {
+ if (sDistortionRequest.state == DISTORTION_SETUP) {
+ countdownMax = sDistortionRequest.countdown;
depthPhase = 0x2710;
screenPlanePhase = 0x3E8;
}
@@ -532,15 +590,15 @@ void Distortion_Update(void) {
zScale = 0.01f;
speed = 1.5f;
- if (sDistortionContext.countdown < 5) {
- xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionContext.countdown) / (f32)countdownMax;
+ if (sDistortionRequest.countdown < 5) {
+ xyScaleFactor = zScaleFactor = ((f32)countdownMax - sDistortionRequest.countdown) / (f32)countdownMax;
} else {
xyScaleFactor = zScaleFactor = 0.0f;
}
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 0x80) {
- if (sDistortionContext.state == DISTORTION_SETUP) {
- countdownMax = sDistortionContext.countdown;
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_7) {
+ if (sDistortionRequest.state == DISTORTION_SETUP) {
+ countdownMax = sDistortionRequest.countdown;
depthPhase = 0x4B0;
screenPlanePhase = 0x7D0;
}
@@ -557,11 +615,11 @@ void Distortion_Update(void) {
zScale = 0.01f;
speed = 1.5f;
- xyScaleFactor = zScaleFactor = sDistortionContext.countdown / (f32)countdownMax;
+ xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax;
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 0x40) {
- if (sDistortionContext.state == DISTORTION_SETUP) {
- countdownMax = sDistortionContext.countdown;
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_6) {
+ if (sDistortionRequest.state == DISTORTION_SETUP) {
+ countdownMax = sDistortionRequest.countdown;
depthPhase = 0x9C4;
screenPlanePhase = 0xBB8;
}
@@ -578,15 +636,15 @@ void Distortion_Update(void) {
zScale = 0.01f;
speed = 1.3f;
- if (sDistortionContext.countdown < 4) {
- xyScaleFactor = zScaleFactor = sDistortionContext.countdown / (f32)countdownMax;
+ if (sDistortionRequest.countdown < 4) {
+ xyScaleFactor = zScaleFactor = sDistortionRequest.countdown / (f32)countdownMax;
} else {
xyScaleFactor = zScaleFactor = 0.0f;
}
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 0x20) {
- sDistortionContext.countdown = 2;
- if (sDistortionContext.state == DISTORTION_SETUP) {
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_5) {
+ sDistortionRequest.countdown = 2;
+ if (sDistortionRequest.state == DISTORTION_SETUP) {
depthPhase = 0x9C4;
screenPlanePhase = 0xBB8;
}
@@ -609,9 +667,9 @@ void Distortion_Update(void) {
zScaleFactor = 1.0f;
xyScaleFactor = 1.0f;
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 0x10) {
- if (sDistortionContext.state == DISTORTION_SETUP) {
- countdownMax = sDistortionContext.countdown;
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_4) {
+ if (sDistortionRequest.state == DISTORTION_SETUP) {
+ countdownMax = sDistortionRequest.countdown;
depthPhase = 0x760;
screenPlanePhase = 0x1BC;
}
@@ -628,14 +686,14 @@ void Distortion_Update(void) {
zScale = 0.2f;
speed = 0.25f;
- countdownRatio = sDistortionContext.countdown / (f32)countdownMax;
+ countdownRatio = sDistortionRequest.countdown / (f32)countdownMax;
zScaleFactor = xyScaleFactor = countdownRatio;
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 8) {
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_3) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
- sDistortionContext.countdown = 2;
+ sDistortionRequest.countdown = 2;
player = GET_PLAYER(play);
if (player != NULL) {
@@ -656,18 +714,21 @@ void Distortion_Update(void) {
zScale = 0.03f;
speed = 0.33f;
break;
+
case 2:
xScale = -0.06f;
yScale = 0.1f;
zScale = 0.03f;
speed = 0.33f;
break;
+
case 1:
xScale = -0.06f;
yScale = 0.1f;
zScale = 0.03f;
speed = 0.33f;
break;
+
default:
xScale = -0.06f;
yScale = 0.1f;
@@ -683,11 +744,11 @@ void Distortion_Update(void) {
}
zScaleFactor = -xyScaleFactor;
speedScaleFactor = 1.0f;
- } else if (sDistortionContext.type & 4) {
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_2) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
- sDistortionContext.countdown = 2;
+ sDistortionRequest.countdown = 2;
player = GET_PLAYER(play);
depthPhaseStep = 359.2f;
@@ -703,18 +764,21 @@ void Distortion_Update(void) {
zScale = 0.08f;
speed = 0.18f;
break;
+
case 2:
xScale = 0.12f;
yScale = 0.12f;
zScale = 0.08f;
speed = 0.12f;
break;
+
case 1:
xScale = 0.12f;
yScale = 0.12f;
zScale = 0.08f;
speed = 0.08f;
break;
+
default:
xScale = 0.12f;
yScale = 0.12f;
@@ -731,12 +795,12 @@ void Distortion_Update(void) {
xyScaleFactor = speedScaleFactor = (waterYScaleFactor * 0.15f) + 0.35f + (speedRatio * 0.4f);
zScaleFactor = 0.9f - xyScaleFactor;
- } else if (sDistortionContext.type & 1) {
+ } else if (sDistortionRequest.type & DISTORTION_TYPE_0) {
// Gives a small mirage-like appearance
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
- sDistortionContext.countdown = 2;
+ sDistortionRequest.countdown = 2;
depthPhaseStep = 0.0f;
screenPlanePhaseStep = 150.0f;
@@ -759,29 +823,29 @@ void Distortion_Update(void) {
depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep);
screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep);
- View_SetDistortionDirRot(&sDistortionContext.play->view,
+ View_SetDistortionDirRot(&sDistortionRequest.play->view,
Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor),
Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor),
Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor));
- View_SetDistortionScale(&sDistortionContext.play->view,
+ View_SetDistortionScale(&sDistortionRequest.play->view,
(Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f,
(Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f,
(Math_CosS(depthPhase) * (zScale * zScaleFactor)) + 1.0f);
- View_SetDistortionSpeed(&sDistortionContext.play->view, speed * speedScaleFactor);
+ View_SetDistortionSpeed(&sDistortionRequest.play->view, speed * speedScaleFactor);
- sDistortionContext.state = DISTORTION_ACTIVE;
+ sDistortionRequest.state = DISTORTION_ACTIVE;
- } else if (sDistortionContext.state != DISTORTION_INACTIVE) {
+ } else if (sDistortionRequest.state != DISTORTION_INACTIVE) {
View_ClearDistortion(&play->view);
- sDistortionContext.state = DISTORTION_INACTIVE;
- sDistortionContext.countdown = 0;
+ sDistortionRequest.state = DISTORTION_INACTIVE;
+ sDistortionRequest.countdown = 0;
}
- if (sDistortionContext.countdown != 0) {
- sDistortionContext.countdown--;
- if (sDistortionContext.countdown == 0) {
- sDistortionContext.type = 0;
+ if (sDistortionRequest.countdown != 0) {
+ sDistortionRequest.countdown--;
+ if (sDistortionRequest.countdown == 0) {
+ sDistortionRequest.type = 0;
}
}
}
@@ -790,16 +854,16 @@ s32 Quake_NumActiveQuakes(void) {
QuakeRequest* req = sQuakeRequest;
s32 numActiveQuakes = 0;
- if (req[0].callbackIdx != 0) {
+ if (req[0].type != 0) {
numActiveQuakes++;
}
- if (req[1].callbackIdx != 0) {
+ if (req[1].type != 0) {
numActiveQuakes++;
}
- if (req[2].callbackIdx != 0) {
+ if (req[2].type != 0) {
numActiveQuakes++;
}
- if (req[3].callbackIdx != 0) {
+ if (req[3].type != 0) {
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 0c273c739..ec2fd9e9c 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
@@ -6,6 +6,7 @@
#include "prevent_bss_reordering.h"
#include "z_bg_hakugin_post.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "objects/object_hakugin_obj/object_hakugin_obj.h"
@@ -509,7 +510,7 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct*
s32 pad;
Vec3f sp44;
s32 pad2[2];
- s16 quake;
+ s16 quakeIndex;
if (this->unk_170 == 0) {
for (i = 0; i < unkStruct->count; i++) {
@@ -520,10 +521,12 @@ void func_80A9C058(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct*
sp44.y = this->unk_16C + unkStruct1->unk_14.y;
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);
- quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quake, 20000);
- Quake_SetQuakeValues(quake, 7, 0, 0, 0);
- Quake_SetCountdown(quake, 12);
+
+ quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 12);
+
if (this->unk_179 <= 0) {
func_8019F128(NA_SE_EV_STONEDOOR_STOP);
this->unk_179 = 40;
@@ -538,15 +541,16 @@ void func_80A9C18C(BgHakuginPost* this, PlayState* play) {
s32 pad;
Player* player = GET_PLAYER(play);
Camera* activeCam = GET_ACTIVE_CAM(play);
- s16 quake;
+ s16 quakeIndex;
Rumble_Request(Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z,
this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.z),
255, 20, 150);
- quake = Quake_Add(activeCam, 3);
- Quake_SetSpeed(quake, 17232);
- Quake_SetQuakeValues(quake, 6, 0, 0, 0);
- Quake_SetCountdown(quake, 20);
+
+ quakeIndex = Quake_Add(activeCam, QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 17232);
+ Quake_SetQuakeValues(quakeIndex, 6, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 20);
}
void func_80A9C228(BgHakuginPost* this, PlayState* play, BgHakuginPostUnkStruct* unkStruct) {
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 e619aa7e0..4f1434dc2 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
@@ -5,6 +5,7 @@
*/
#include "z_bg_ikana_dharma.h"
+#include "z64quake.h"
#include "assets/objects/object_ikana_obj/object_ikana_obj.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -226,11 +227,12 @@ void BgIkanaDharma_Update(Actor* thisx, PlayState* play) {
Actor_MoveWithGravity(&this->dyna.actor);
Actor_UpdateBgCheckInfo(play, &this->dyna.actor, 0.0f, 0.0f, 0.0f, 4);
if (this->dyna.actor.bgCheckFlags & 2) {
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
+ Quake_SetSpeed(quakeIndex, 21536);
+ Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 12);
- Quake_SetSpeed(quake, 21536);
- Quake_SetQuakeValues(quake, 4, 0, 0, 0);
- Quake_SetCountdown(quake, 12);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
}
} else {
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 77bf92531..fb29ca2bb 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
@@ -5,6 +5,7 @@
*/
#include "z_bg_ikana_rotaryroom.h"
+#include "z64quake.h"
#include "overlays/actors/ovl_Bg_Ikana_Block/z_bg_ikana_block.h"
#include "overlays/actors/ovl_En_Torch2/z_en_torch2.h"
#include "overlays/actors/ovl_En_Water_Effect/z_en_water_effect.h"
@@ -831,11 +832,11 @@ void func_80B81A80(Actor* thisx, PlayState* play) {
func_80B81B84(this);
} else if (this->unk_584 == 15) {
- s16 sp26 = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
- Quake_SetSpeed(sp26, 0x7B30);
- Quake_SetQuakeValues(sp26, 6, 0, 100, 0);
- Quake_SetCountdown(sp26, 22);
+ Quake_SetSpeed(quakeIndex, 31536);
+ Quake_SetQuakeValues(quakeIndex, 6, 0, 100, 0);
+ Quake_SetCountdown(quakeIndex, 22);
}
}
@@ -858,11 +859,11 @@ void func_80B81BA0(Actor* thisx, PlayState* play) {
thisx->shape.rot.x += 0x1F4;
if (!(this->unk_584 & 7)) {
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
- Quake_SetSpeed(quake, 0x7B30);
- Quake_SetQuakeValues(quake, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0);
- Quake_SetCountdown(quake, 15);
+ Quake_SetSpeed(quakeIndex, 31536);
+ Quake_SetQuakeValues(quakeIndex, (s32)(Rand_ZeroOne() * 2.5f) + 3, 0, 10, 0);
+ Quake_SetCountdown(quakeIndex, 15);
}
if (Flags_GetSwitch(play, BGIKANAROTARYROOM_GET_FE(&this->dyna.actor))) {
@@ -928,11 +929,11 @@ void func_80B81DC8(Actor* thisx, PlayState* play) {
ActorCutscene_Stop(this->dyna.actor.cutscene);
func_80B818B4(this);
} else if (this->unk_584 == 19) {
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
- Quake_SetSpeed(quake, 0x4E20);
- Quake_SetQuakeValues(quake, 5, 0, 40, 60);
- Quake_SetCountdown(quake, 17);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 5, 0, 40, 60);
+ Quake_SetCountdown(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 ec17965c6..b3da7b2bf 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
@@ -5,6 +5,7 @@
*/
#include "z_bg_ikana_shutter.h"
+#include "z64quake.h"
#include "objects/object_ikana_obj/object_ikana_obj.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -144,16 +145,17 @@ void func_80BD59F8(BgIkanaShutter* this) {
void func_80BD5A18(BgIkanaShutter* this, PlayState* play) {
s32 pad[2];
- s16 quake;
+ s16 quakeIndex;
this->dyna.actor.velocity.y += -5.0f;
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) {
- quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quake, 0x5420);
- Quake_SetQuakeValues(quake, 4, 0, 0, 0);
- Quake_SetCountdown(quake, 12);
+ quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 21536);
+ Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0);
+ Quake_SetCountdown(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 0bc385cb7..017f9ef04 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
@@ -5,6 +5,7 @@
*/
#include "z_bg_iknin_susceil.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "objects/object_ikninside_obj/object_ikninside_obj.h"
@@ -70,11 +71,12 @@ void func_80C0A838(BgIkninSusceil* this, PlayState* play) {
void func_80C0A86C(BgIkninSusceil* this, PlayState* play, s16 verticalMag, s16 countdown, s32 arg4) {
s32 pad;
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
+ Quake_SetSpeed(quakeIndex, 31536);
+ Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, countdown);
- Quake_SetSpeed(quake, 0x7B30);
- Quake_SetQuakeValues(quake, verticalMag, 0, 0, 0);
- Quake_SetCountdown(quake, countdown);
if (arg4 == 1) {
Rumble_Request(SQ(100.0f), 255, 20, 150);
} else if (arg4 == 2) {
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 b54e7a583..22cf4968f 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
@@ -6,6 +6,7 @@
#include "z_bg_open_shutter.h"
#include "objects/object_open_obj/object_open_obj.h"
+#include "z64quake.h"
#include "z64rumble.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -105,7 +106,7 @@ void BgOpenShutter_Destroy(Actor* thisx, PlayState* play) {
}
void func_80ACAD88(BgOpenShutter* this, PlayState* play) {
- s32 quake;
+ s32 doorDirection;
if (this->unk_15C != 0) {
Player* player = GET_PLAYER(play);
@@ -118,10 +119,10 @@ void func_80ACAD88(BgOpenShutter* this, PlayState* play) {
} else {
Player* player = GET_PLAYER(play);
- quake = func_80ACABA8(this, play);
- if (quake > 0) {
+ doorDirection = func_80ACABA8(this, play);
+ if (doorDirection > 0) {
player->doorType = 2;
- player->doorDirection = quake;
+ player->doorDirection = doorDirection;
player->doorActor = &this->dyna.actor;
func_80122F28(player);
}
@@ -142,18 +143,21 @@ void func_80ACAE5C(BgOpenShutter* this, PlayState* play) {
void func_80ACAEF0(BgOpenShutter* this, PlayState* play) {
s32 pad;
- s16 quake;
+ s16 quakeIndex;
Math_StepToF(&this->dyna.actor.velocity.y, 20.0f, 8.0f);
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, this->dyna.actor.velocity.y)) {
this->dyna.actor.floorHeight = this->dyna.actor.home.pos.y;
Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 60.0f, 10, 8.0f, 500, 10, true);
Actor_PlaySfxAtPos(&this->dyna.actor, NA_SE_EV_BIGWALL_BOUND);
- quake = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
- Quake_SetSpeed(quake, -0x7F18);
- Quake_SetQuakeValues(quake, 2, 0, 0, 0);
- Quake_SetCountdown(quake, 10);
+
+ quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, -32536);
+ Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 10);
+
Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100);
+
this->unk_15C = 0;
this->actionFunc = func_80ACAD88;
}
diff --git a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
index 75f530c48..efb46a892 100644
--- a/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
+++ b/src/overlays/actors/ovl_Boss_Hakugin/z_boss_hakugin.c
@@ -5,6 +5,7 @@
*/
#include "z_boss_hakugin.h"
+#include "z64quake.h"
#include "z64rumble.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20)
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 65df579ce..b2ffe1dcb 100644
--- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
+++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
@@ -5,6 +5,7 @@
*/
#include "z_door_shutter.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#include "objects/object_bdoor/object_bdoor.h"
@@ -599,7 +600,7 @@ s32 func_808A1A70(DoorShutter* this) {
}
void func_808A1B48(DoorShutter* this, PlayState* play) {
- s16 quake;
+ s16 quakeIndex;
if (func_808A1A70(this)) {
if (this->actor.velocity.y > 20.0f) {
@@ -607,11 +608,14 @@ void func_808A1B48(DoorShutter* this, PlayState* play) {
Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 45.0f, 10, 8.0f, 500, 10, 0);
}
Actor_PlaySfxAtPos(&this->actor, NA_SE_EV_BIGWALL_BOUND);
- quake = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
- Quake_SetSpeed(quake, -32536);
- Quake_SetQuakeValues(quake, 2, 0, 0, 0);
- Quake_SetCountdown(quake, 10);
+
+ quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, -32536);
+ Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 10);
+
Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100);
+
func_808A1884(this, play);
}
}
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 88ddcd0f8..ec464815e 100644
--- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c
+++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c
@@ -6,6 +6,7 @@
*/
#include "z_en_ani.h"
+#include "z64quake.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8)
@@ -209,7 +210,7 @@ void EnAni_LandOnFoot(EnAni* this, PlayState* play) {
void EnAni_FallToGround(EnAni* this, PlayState* play) {
s32 pad;
- s16 quakeValue;
+ s16 quakeIndex;
if (this->actor.bgCheckFlags & 1) { // hit the ground
this->actor.flags &= ~ACTOR_FLAG_10;
@@ -219,10 +220,12 @@ void EnAni_FallToGround(EnAni* this, PlayState* play) {
// the animation gets cut short, (first 16 frames only) only the landing part is seen
Animation_Change(&this->skelAnime, &gAniLandingThenStandingUpAnim, 1.0f, 0.0f, 16.0f, ANIMMODE_ONCE, 0.0f);
this->stateFlags |= ANI_STATE_WRITHING;
- quakeValue = Quake_Add(play->cameraPtrs[CAM_ID_MAIN], 3);
- Quake_SetSpeed(quakeValue, 0x6978);
- Quake_SetQuakeValues(quakeValue, 7, 0, 0, 0);
- Quake_SetCountdown(quakeValue, 0x14);
+
+ quakeIndex = Quake_Add(play->cameraPtrs[CAM_ID_MAIN], QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 27000);
+ Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 20);
+
Actor_PlaySfxAtPos(&this->actor, NA_SE_IT_HAMMER_HIT);
}
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 d24b2df49..bf6e46e36 100644
--- a/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c
+++ b/src/overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.c
@@ -5,6 +5,7 @@
*/
#include "z_en_bigpamet.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -518,7 +519,7 @@ void func_80A28760(EnBigpamet* this) {
}
void func_80A287E8(EnBigpamet* this, PlayState* play) {
- s16 quake;
+ s16 quakeIndex;
this->actor.shape.rot.y += 0x3B00;
func_800B9010(&this->actor, NA_SE_EN_B_PAMET_ROLL - SFX_FLAG);
@@ -538,12 +539,16 @@ void func_80A287E8(EnBigpamet* this, PlayState* play) {
}
if (this->actor.bgCheckFlags & 8) {
- quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
this->actor.velocity.y = this->unk_29E * 0.375f;
- Quake_SetSpeed(quake, 0x4E20);
- Quake_SetQuakeValues(quake, 15, 0, 0, 0);
- Quake_SetCountdown(quake, 10);
+
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 10);
+
Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100);
+
func_80A27B58(this);
func_80A27DD8(this, play);
func_80A28970(this);
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 98212382b..e56997051 100644
--- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c
+++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c
@@ -5,6 +5,7 @@
*/
#include "z_en_bigslime.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "objects/object_bigslime/object_bigslime.h"
@@ -743,12 +744,14 @@ void EnBigslime_EndThrowMinislime(EnBigslime* this) {
void EnBigslime_BreakIntoMinislime(EnBigslime* this, PlayState* play) {
s32 i;
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 15, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 15);
- Quake_SetSpeed(quake, 20000);
- Quake_SetQuakeValues(quake, 15, 0, 0, 0);
- Quake_SetCountdown(quake, 15);
Rumble_Request(this->actor.xyzDistToPlayerSq, 180, 20, 100);
+
this->bigslimeCollider[0].base.atFlags &= ~AT_ON;
this->gekkoCollider.base.acFlags &= ~(AC_ON | AC_HIT);
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 5fc1d4c70..2b855edab 100644
--- a/src/overlays/actors/ovl_En_Go/z_en_go.c
+++ b/src/overlays/actors/ovl_En_Go/z_en_go.c
@@ -5,6 +5,7 @@
*/
#include "z_en_go.h"
+#include "z64quake.h"
#include "objects/object_oF1d_map/object_oF1d_map.h"
#include "objects/object_hakugin_demo/object_hakugin_demo.h"
#include "objects/object_taisou/object_taisou.h"
@@ -1045,16 +1046,16 @@ s32 func_80A13564(EnGo* this, f32 arg1, f32 arg2, s32 arg3) {
return ret;
}
-void func_80A136B8(PlayState* play, s16 arg1, s16 arg2, s16 arg3) {
- s16 sp26 = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
+void func_80A136B8(PlayState* play, s16 speed, s16 verticalMag, s16 countdown) {
+ s16 quakeIndex = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3);
- Quake_SetCountdown(sp26, arg3);
- Quake_SetSpeed(sp26, arg1);
- Quake_SetQuakeValues(sp26, arg2, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, countdown);
+ Quake_SetSpeed(quakeIndex, speed);
+ Quake_SetQuakeValues(quakeIndex, verticalMag, 0, 0, 0);
}
void func_80A13728(EnGo* this, PlayState* play) {
- func_80A136B8(play, 0x6C77, 7, 20);
+ func_80A136B8(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 df491dd22..1f173114d 100644
--- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c
+++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c
@@ -5,6 +5,7 @@
*/
#include "z_en_goroiwa.h"
+#include "z64quake.h"
#include "objects/object_goroiwa/object_goroiwa.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -450,10 +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 sp72 = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(sp72, 0x4350);
- Quake_SetQuakeValues(sp72, 3, 0, 0, 0);
- Quake_SetCountdown(sp72, 7);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
+ Quake_SetSpeed(quakeIndex, 17232);
+ Quake_SetQuakeValues(quakeIndex, 3, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 7);
}
this->unk_1C4 = 0.0f;
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 26c5bbbbc..57c18ad7b 100644
--- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c
+++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c
@@ -5,6 +5,7 @@
*/
#include "z_en_ishi.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "objects/gameplay_field_keep/gameplay_field_keep.h"
#include "objects/gameplay_keep/gameplay_keep.h"
@@ -594,11 +595,12 @@ void func_8095EBDC(EnIshi* this, PlayState* play) {
}
if (sp70 == 1) {
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
+ Quake_SetSpeed(quakeIndex, 17232);
+ Quake_SetQuakeValues(quakeIndex, 3, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 7);
- Quake_SetSpeed(quake, 0x4350);
- Quake_SetQuakeValues(quake, 3, 0, 0, 0);
- Quake_SetCountdown(quake, 7);
Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150);
}
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 4be8ad3c1..0582b7ca8 100644
--- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c
+++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c
@@ -5,6 +5,7 @@
*/
#include "z_en_pametfrog.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "overlays/actors/ovl_En_Bigpamet/z_en_bigpamet.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
@@ -1222,11 +1223,14 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, PlayState* play) {
// Zooms in on Snapper spawn point
Play_SetCameraAtEye(play, this->subCamId, &subCamAt, &subCamEye);
- this->quake = Quake_Add(GET_ACTIVE_CAM(play), 6);
- Quake_SetSpeed(this->quake, 18000);
- Quake_SetQuakeValues(this->quake, 2, 0, 0, 0);
- Quake_SetCountdown(this->quake, 15);
+
+ this->quakeIndex = Quake_Add(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);
+
Rumble_Request(this->actor.xyzDistToPlayerSq, 120, 20, 10);
+
this->timer = 40;
this->actionFunc = EnPametfrog_SnapperSpawn;
}
@@ -1244,12 +1248,16 @@ void EnPametfrog_SnapperSpawn(EnPametfrog* this, PlayState* play) {
void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, PlayState* play) {
this->actor.params = GEKKO_GET_SNAPPER;
- Quake_RemoveFromIdx(this->quake);
- this->quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(this->quake, 20000);
- Quake_SetQuakeValues(this->quake, 17, 0, 0, 0);
- Quake_SetCountdown(this->quake, 12);
+
+ Quake_Remove(this->quakeIndex);
+
+ this->quakeIndex = Quake_Add(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);
+
Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150);
+
this->actionFunc = EnPametfrog_TransitionGekkoSnapper;
}
diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h
index 3f3e82165..81af17129 100644
--- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h
+++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h
@@ -32,7 +32,7 @@ typedef struct EnPametfrog {
/* 0x2AE */ u8 unk_2AE; // True/False
/* 0x2B0 */ s16 cutscene;
/* 0x2B2 */ s16 params;
- /* 0x2B4 */ s16 quake;
+ /* 0x2B4 */ s16 quakeIndex;
/* 0x2B6 */ s16 timer;
/* 0x2B8 */ s16 spinYaw;
/* 0x2BA */ s16 subCamId;
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 ec412ce79..062422026 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
@@ -5,6 +5,7 @@
*/
#include "z_en_stop_heishi.h"
+#include "z64quake.h"
#define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_8)
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 c0f0a3e89..23dccca0f 100644
--- a/src/overlays/actors/ovl_En_Test6/z_en_test6.c
+++ b/src/overlays/actors/ovl_En_Test6/z_en_test6.c
@@ -5,6 +5,7 @@
*/
#include "z_en_test6.h"
+#include "z64quake.h"
#include "objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_200000 | ACTOR_FLAG_2000000)
@@ -396,7 +397,7 @@ void func_80A916F0(EnTest6* this, PlayState* play) {
ActorCutscene_Stop(play->playerActorCsIds[8]);
func_800B7298(play, NULL, 6);
func_80A90C34();
- Distortion_ClearType(0x20);
+ Distortion_ClearType(DISTORTION_TYPE_5);
Actor_MarkForDeath(&this->actor);
}
@@ -462,7 +463,7 @@ void func_80A91760(EnTest6* this, PlayState* play) {
}
}
func_80A90C08(0x78);
- Distortion_SetType(0x20);
+ Distortion_SetType(DISTORTION_TYPE_5);
Distortion_SetCountdown(80);
play->unk_18844 = 1;
this->unk_274 = 95;
@@ -517,7 +518,7 @@ void func_80A91760(EnTest6* this, PlayState* play) {
if (this->unk_27A == 10) {
this->unk_14C = 0.1f;
func_80A90C34();
- Distortion_ClearType(0x20);
+ Distortion_ClearType(DISTORTION_TYPE_5);
play->unk_18844 = 0;
if (this->unk_254 != NULL) {
ZeldaArena_Free(this->unk_254);
@@ -617,7 +618,7 @@ void func_80A92118(EnTest6* this, PlayState* play) {
ActorCutscene_Stop(play->playerActorCsIds[8]);
func_800B7298(play, NULL, 6);
func_80A90C34();
- Distortion_ClearType(0x20);
+ Distortion_ClearType(DISTORTION_TYPE_5);
Actor_MarkForDeath(&this->actor);
}
@@ -684,7 +685,7 @@ void func_80A92188(EnTest6* this, PlayState* play) {
case 115:
func_80A90C08(0x14);
- Distortion_SetType(0x20);
+ Distortion_SetType(DISTORTION_TYPE_5);
Distortion_SetCountdown(90);
this->unk_274 = 2;
break;
@@ -715,7 +716,7 @@ void func_80A92188(EnTest6* this, PlayState* play) {
case 14:
case 15:
func_80A90C08(0x32);
- Distortion_ClearType(0x20);
+ Distortion_ClearType(DISTORTION_TYPE_5);
this->unk_274 = 0;
break;
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 769266e97..5fc5d6b31 100644
--- a/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c
+++ b/src/overlays/actors/ovl_Obj_Chikuwa/z_obj_chikuwa.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_chikuwa.h"
+#include "z64quake.h"
#include "objects/object_d_lift/object_d_lift.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -158,9 +159,9 @@ void ObjChikuwa_Update(Actor* thisx, PlayState* play) {
ObjChikuwa* this = THIS;
ObjChikuwaStruct* temp;
f32 temp_fs0;
- s16 var_s2;
+ s16 quakeVerticalMag;
s32 i;
- s32 quake;
+ s32 quakeIndex;
this->unk_29E++;
@@ -173,16 +174,16 @@ 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)) {
- quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
if (temp_fs0 < SQ(120.0f)) {
- var_s2 = 4;
+ quakeVerticalMag = 4;
} else {
- var_s2 = 3;
+ quakeVerticalMag = 3;
}
- Quake_SetSpeed(quake, 0x4350);
- Quake_SetQuakeValues(quake, var_s2, 0, 0, 0);
- Quake_SetCountdown(quake, 7);
+ Quake_SetSpeed(quakeIndex, 17232);
+ Quake_SetQuakeValues(quakeIndex, quakeVerticalMag, 0, 0, 0);
+ Quake_SetCountdown(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 050207492..77b704a6c 100644
--- a/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c
+++ b/src/overlays/actors/ovl_Obj_Dhouse/z_obj_dhouse.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_dhouse.h"
+#include "z64quake.h"
#include "objects/object_dhouse/object_dhouse.h"
#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_400000)
@@ -454,23 +455,23 @@ void func_80B139D8(ObjDhouse* this) {
void func_80B139F4(ObjDhouse* this, PlayState* play) {
Camera* camera = GET_ACTIVE_CAM(play);
- s16 quake;
+ s16 quakeIndex;
if (this->unk_1370 == 117) {
- quake = Quake_Add(camera, 3);
- Quake_SetSpeed(quake, 20000);
- Quake_SetQuakeValues(quake, 8, 0, 0, 0);
- Quake_SetCountdown(quake, 17);
+ quakeIndex = Quake_Add(camera, QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 8, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 17);
} else if (this->unk_1370 == 105) {
- quake = Quake_Add(camera, 3);
- Quake_SetSpeed(quake, 20000);
- Quake_SetQuakeValues(quake, 7, 0, 0, 0);
- Quake_SetCountdown(quake, 20);
+ quakeIndex = Quake_Add(camera, QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 7, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 20);
} else if (this->unk_1370 == 90) {
- quake = Quake_Add(camera, 3);
- Quake_SetSpeed(quake, 20000);
- Quake_SetQuakeValues(quake, 5, 0, 0, 0);
- Quake_SetCountdown(quake, 62);
+ quakeIndex = Quake_Add(camera, QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 62);
}
this->unk_1370--;
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 c0537940c..467dfa8b8 100644
--- a/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c
+++ b/src/overlays/actors/ovl_Obj_Hariko/z_obj_hariko.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_hariko.h"
+#include "z64quake.h"
#include "assets/objects/object_hariko/object_hariko.h"
#define FLAGS (ACTOR_FLAG_20 | ACTOR_FLAG_2000000)
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 19d35ffff..38f3164e3 100644
--- a/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c
+++ b/src/overlays/actors/ovl_Obj_Hugebombiwa/z_obj_hugebombiwa.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_hugebombiwa.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "objects/object_bombiwa/object_bombiwa.h"
@@ -292,13 +293,14 @@ void func_80A54600(PlayState* play, Vec3f* arg1, f32 arg2, f32 arg3) {
}
}
-void func_80A54980(ObjHugebombiwa* this, PlayState* play, s32 arg2) {
+void ObjHugebombiwa_AddQuake(ObjHugebombiwa* this, PlayState* play, s32 quakeVerticalMag) {
s32 pad[2];
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, quakeVerticalMag, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 7);
- Quake_SetSpeed(quake, 0x4E20);
- Quake_SetQuakeValues(quake, arg2, 0, 0, 0);
- Quake_SetCountdown(quake, 7);
Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150);
}
@@ -514,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) {
- func_80A54980(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1);
+ ObjHugebombiwa_AddQuake(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1);
}
}
}
@@ -610,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) {
- func_80A54980(this, play, (s32)(Rand_ZeroOne() * 5.5f) + 1);
+ ObjHugebombiwa_AddQuake(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 f7056b147..4668bfffd 100644
--- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c
+++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c
@@ -5,6 +5,7 @@
*/
#include "z_obj_lift.h"
+#include "z64quake.h"
#include "objects/object_d_lift/object_d_lift.h"
#define FLAGS (ACTOR_FLAG_10)
@@ -125,17 +126,18 @@ void func_8093D760(ObjLift* this) {
void func_8093D7A0(ObjLift* this, PlayState* play) {
s32 pad;
- s16 quake;
+ s16 quakeIndex;
if (DynaPolyActor_IsInRidingMovingState(&this->dyna)) {
if (this->timer <= 0) {
if (OBJLIFT_GET_7(&this->dyna.actor) == 7) {
func_8093D9C0(this);
} else {
- quake = Quake_Add(GET_ACTIVE_CAM(play), 1);
- Quake_SetSpeed(quake, 10000);
- Quake_SetQuakeValues(quake, 2, 0, 0, 0);
- Quake_SetCountdown(quake, 20);
+ quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
+ Quake_SetSpeed(quakeIndex, 10000);
+ Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0);
+ Quake_SetCountdown(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 62cb40275..2c8e42c7d 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
@@ -5,6 +5,7 @@
*/
#include "z_obj_tokei_step.h"
+#include "z64quake.h"
#include "z64rumble.h"
#include "objects/object_tokei_step/object_tokei_step.h"
@@ -62,11 +63,12 @@ void ObjTokeiStep_SetSysMatrix(ObjTokeiStepPanel* panel) {
void ObjTokeiStep_AddQuake(ObjTokeiStep* this, PlayState* play) {
s32 pad[2];
- s16 quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ s16 quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetQuakeValues(quakeIndex, 1, 0, 0, 0);
+ Quake_SetCountdown(quakeIndex, 7);
- Quake_SetSpeed(quake, 20000);
- Quake_SetQuakeValues(quake, 1, 0, 0, 0);
- Quake_SetCountdown(quake, 7);
Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 120, 20, 10);
}
diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c
index e8a872802..681438463 100644
--- a/src/overlays/actors/ovl_player_actor/z_player.c
+++ b/src/overlays/actors/ovl_player_actor/z_player.c
@@ -5,6 +5,7 @@
*/
#include "global.h"
+#include "z64quake.h"
#include "z64rumble.h"
#define THIS ((Player*)thisx)
diff --git a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
index 9dab9c61a..bd8a40ed8 100644
--- a/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
+++ b/src/overlays/effects/ovl_Effect_Ss_Bubble/z_eff_ss_bubble.c
@@ -91,7 +91,7 @@ void EffectSsBubble_Update(PlayState* play2, u32 index, EffectSs* this) {
BgCheck_EntityRaycastFloor2_1(play, &play->colCtx, &colPoly, &this->pos);
speed = SurfaceType_GetConveyorSpeed(&play->colCtx, colPoly, BGCHECK_SCENE);
- if ((speed != 0) && !SurfaceType_GetConveyorType(&play->colCtx, colPoly, BGCHECK_SCENE)) {
+ if ((speed != 0) && !SurfaceType_IsFloorConveyor(&play->colCtx, colPoly, BGCHECK_SCENE)) {
direction = SurfaceType_GetConveyorDirection(&play->colCtx, colPoly, BGCHECK_SCENE) << 0xA;
rVecAdjMax = sVecAdjMaximums[speed - 1];
this->rVecAdjX = Math_SinS(direction) * rVecAdjMax;
diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt
index 4bcf89f80..3b949a49c 100644
--- a/tools/disasm/functions.txt
+++ b/tools/disasm/functions.txt
@@ -859,8 +859,8 @@
0x800BC5B8:("Actor_IsTargeted",),
0x800BC5EC:("Actor_OtherIsTargeted",),
0x800BC620:("func_800BC620",),
- 0x800BC770:("func_800BC770",),
- 0x800BC7D8:("func_800BC7D8",),
+ 0x800BC770:("Actor_AddQuake",),
+ 0x800BC7D8:("Actor_AddQuakeWithSpeed",),
0x800BC848:("func_800BC848",),
0x800BC8B8:("Actor_DrawDoorLock",),
0x800BCB50:("Actor_SpawnShieldParticlesMetal",),
@@ -1075,7 +1075,7 @@
0x800C9CEC:("SurfaceType_IsHookshotSurface",),
0x800C9D14:("SurfaceType_IsIgnoredByEntities",),
0x800C9D50:("SurfaceType_IsIgnoredByProjectiles",),
- 0x800C9D8C:("SurfaceType_GetConveyorType",),
+ 0x800C9D8C:("SurfaceType_IsFloorConveyor",),
0x800C9DDC:("func_800C9DDC",),
0x800C9E18:("SurfaceType_GetConveyorSpeed",),
0x800C9E40:("SurfaceType_GetConveyorDirection",),
@@ -2282,15 +2282,15 @@
0x8012A038:("PreNMI_Init",),
0x8012A080:("Quake_Random",),
0x8012A0AC:("Quake_UpdateShakeInfo",),
- 0x8012A2B8:("Quake_Callback1",),
- 0x8012A340:("Quake_Callback5",),
- 0x8012A3B4:("Quake_Callback6",),
- 0x8012A438:("Quake_Callback3",),
- 0x8012A4D0:("Quake_Callback2",),
- 0x8012A540:("Quake_Callback4",),
+ 0x8012A2B8:("Quake_CallbackType1",),
+ 0x8012A340:("Quake_CallbackType5",),
+ 0x8012A3B4:("Quake_CallbackType6",),
+ 0x8012A438:("Quake_CallbackType3",),
+ 0x8012A4D0:("Quake_CallbackType2",),
+ 0x8012A540:("Quake_CallbackType4",),
0x8012A5D8:("Quake_GetFreeIndex",),
0x8012A638:("Quake_AddImpl",),
- 0x8012A6F0:("Quake_Remove",),
+ 0x8012A6F0:("Quake_RemoveRequest",),
0x8012A718:("Quake_GetRequest",),
0x8012A774:("Quake_SetValue",),
0x8012A8A8:("Quake_SetSpeed",),
@@ -2300,7 +2300,7 @@
0x8012A9E0:("Quake_SetQuakeValues2",),
0x8012AA48:("Quake_Init",),
0x8012AA9C:("Quake_Add",),
- 0x8012AAC0:("Quake_RemoveFromIdx",),
+ 0x8012AAC0:("Quake_Remove",),
0x8012AB08:("Quake_Calc",),
0x8012AE68:("Distortion_Init",),
0x8012AEAC:("Distortion_SetCountdown",),
@@ -10620,7 +10620,7 @@
0x80A53E60:("func_80A53E60",),
0x80A541F4:("func_80A541F4",),
0x80A54600:("func_80A54600",),
- 0x80A54980:("func_80A54980",),
+ 0x80A54980:("ObjHugebombiwa_AddQuake",),
0x80A54A0C:("func_80A54A0C",),
0x80A54AC0:("ObjHugebombiwa_Init",),
0x80A54BC4:("ObjHugebombiwa_Destroy",),
diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt
index ff7987c6f..9e02cf981 100644
--- a/tools/disasm/variables.txt
+++ b/tools/disasm/variables.txt
@@ -4015,7 +4015,7 @@
0x801F59F4:("D_801F59F4","UNK_TYPE1","",0x1),
0x801F59F8:("D_801F59F8","UNK_TYPE1","",0x1),
0x801F5A00:("sQuakeRequest","QuakeRequest","[4]",0x90),
- 0x801F5A90:("sDistortionContext","DistortionContext","",0xc),
+ 0x801F5A90:("sDistortionRequest","DistortionRequest","",0xc),
0x801F5AA0:("sMatAnimStep","s32","",0x4),
0x801F5AA4:("sMatAnimFlags","u32","",0x4),
0x801F5AA8:("sMatAnimAlphaRatio","f32","",0x4),
diff --git a/tools/namefixer.py b/tools/namefixer.py
index f78717d40..b43287971 100755
--- a/tools/namefixer.py
+++ b/tools/namefixer.py
@@ -295,6 +295,7 @@ wordReplace = {
"func_800BC8B8": "Actor_DrawDoorLock",
"func_800B86C8": "Actor_ChangeFocus",
"func_800B90F4": "Actor_DeactivateLens",
+ "func_800BC770": "Actor_AddQuake",
"zelda_malloc": "ZeldaArena_Malloc",
"zelda_mallocR": "ZeldaArena_MallocR",
"zelda_realloc": "ZeldaArena_Realloc",
@@ -411,6 +412,7 @@ wordReplace = {
"BgCheck_RelocateMeshHeader": "CollisionHeader_GetVirtual",
"BgCheck_RelocateAllMeshHeaders": "BgCheck_InitCollisionHeaders",
"BgCheck_GetPolygonAttributes": "SurfaceType_GetData",
+ "SurfaceType_GetConveyorType": "SurfaceType_IsFloorConveyor",
"func_800C9704": "SurfaceType_GetBgCamIndex",
"func_800C9924": "BgCheck_GetBgCamFuncData",
"func_800C99AC": "SurfaceType_GetSceneExitIndex",
@@ -422,7 +424,7 @@ wordReplace = {
"func_800C9CEC": "SurfaceType_IsHookshotSurface",
"func_800C9D14": "SurfaceType_IsIgnoredByEntities",
"func_800C9D50": "SurfaceType_IsIgnoredByProjectiles",
- "func_800C9D8C": "SurfaceType_GetConveyorType",
+ "func_800C9D8C": "SurfaceType_IsFloorConveyor",
"func_800C9E18": "SurfaceType_GetConveyorSpeed",
"func_800C9E40": "SurfaceType_GetConveyorDirection",
"func_800C9E88": "SurfaceType_IsWallDamage",
@@ -545,6 +547,7 @@ wordReplace = {
"Quake2_SetCountdown": "Distortion_SetCountdown",
"func_800BE680": "Actor_DrawDamageEffects",
"func_8012F22C": "Inventory_GetSkullTokenCount",
+ "Quake_RemoveFromIdx": "Quake_Remove",
"func_8013AB00": "SubS_DrawTransformFlex",
"func_8013A860": "SubS_DrawTransformFlexLimb",
diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv
index dcb030e31..968fa65d3 100644
--- a/tools/sizes/code_functions.csv
+++ b/tools/sizes/code_functions.csv
@@ -373,8 +373,8 @@ 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/func_800BC770.s,func_800BC770,0x800BC770,0x1A
-asm/non_matchings/code/z_actor/func_800BC7D8.s,func_800BC7D8,0x800BC7D8,0x1C
+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_DrawDoorLock.s,Actor_DrawDoorLock,0x800BC8B8,0xA6
asm/non_matchings/code/z_actor/Actor_SpawnShieldParticlesMetal.s,Actor_SpawnShieldParticlesMetal,0x800BCB50,0x8
@@ -589,7 +589,7 @@ asm/non_matchings/code/z_bgcheck/SurfaceType_GetEcho.s,SurfaceType_GetEcho,0x800
asm/non_matchings/code/z_bgcheck/SurfaceType_IsHookshotSurface.s,SurfaceType_IsHookshotSurface,0x800C9CEC,0xA
asm/non_matchings/code/z_bgcheck/SurfaceType_IsIgnoredByEntities.s,SurfaceType_IsIgnoredByEntities,0x800C9D14,0xF
asm/non_matchings/code/z_bgcheck/SurfaceType_IsIgnoredByProjectiles.s,SurfaceType_IsIgnoredByProjectiles,0x800C9D50,0xF
-asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorType.s,SurfaceType_GetConveyorType,0x800C9D8C,0x14
+asm/non_matchings/code/z_bgcheck/SurfaceType_IsFloorConveyor.s,SurfaceType_IsFloorConveyor,0x800C9D8C,0x14
asm/non_matchings/code/z_bgcheck/func_800C9DDC.s,func_800C9DDC,0x800C9DDC,0xF
asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorSpeed.s,SurfaceType_GetConveyorSpeed,0x800C9E18,0xA
asm/non_matchings/code/z_bgcheck/SurfaceType_GetConveyorDirection.s,SurfaceType_GetConveyorDirection,0x800C9E40,0x12
@@ -1796,15 +1796,15 @@ asm/non_matchings/code/z_prenmi/PreNMI_Destroy.s,PreNMI_Destroy,0x8012A02C,0x3
asm/non_matchings/code/z_prenmi/PreNMI_Init.s,PreNMI_Init,0x8012A038,0x12
asm/non_matchings/code/z_quake/Quake_Random.s,Quake_Random,0x8012A080,0xB
asm/non_matchings/code/z_quake/Quake_UpdateShakeInfo.s,Quake_UpdateShakeInfo,0x8012A0AC,0x83
-asm/non_matchings/code/z_quake/Quake_Callback1.s,Quake_Callback1,0x8012A2B8,0x22
-asm/non_matchings/code/z_quake/Quake_Callback5.s,Quake_Callback5,0x8012A340,0x1D
-asm/non_matchings/code/z_quake/Quake_Callback6.s,Quake_Callback6,0x8012A3B4,0x21
-asm/non_matchings/code/z_quake/Quake_Callback3.s,Quake_Callback3,0x8012A438,0x26
-asm/non_matchings/code/z_quake/Quake_Callback2.s,Quake_Callback2,0x8012A4D0,0x1C
-asm/non_matchings/code/z_quake/Quake_Callback4.s,Quake_Callback4,0x8012A540,0x26
+asm/non_matchings/code/z_quake/Quake_CallbackType1.s,Quake_CallbackType1,0x8012A2B8,0x22
+asm/non_matchings/code/z_quake/Quake_CallbackType5.s,Quake_CallbackType5,0x8012A340,0x1D
+asm/non_matchings/code/z_quake/Quake_CallbackType6.s,Quake_CallbackType6,0x8012A3B4,0x21
+asm/non_matchings/code/z_quake/Quake_CallbackType3.s,Quake_CallbackType3,0x8012A438,0x26
+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_Remove.s,Quake_Remove,0x8012A6F0,0xA
+asm/non_matchings/code/z_quake/Quake_RemoveRequest.s,Quake_RemoveRequest,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
@@ -1814,7 +1814,7 @@ asm/non_matchings/code/z_quake/Quake_SetQuakeValues.s,Quake_SetQuakeValues,0x801
asm/non_matchings/code/z_quake/Quake_SetQuakeValues2.s,Quake_SetQuakeValues2,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_RemoveFromIdx.s,Quake_RemoveFromIdx,0x8012AAC0,0x12
+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/Distortion_Init.s,Distortion_Init,0x8012AE68,0x11
asm/non_matchings/code/z_quake/Distortion_SetCountdown.s,Distortion_SetCountdown,0x8012AEAC,0xA