diff --git a/assets/xml/objects/gameplay_dangeon_keep.xml b/assets/xml/objects/gameplay_dangeon_keep.xml
index d16eb4c41c..2670b752d5 100644
--- a/assets/xml/objects/gameplay_dangeon_keep.xml
+++ b/assets/xml/objects/gameplay_dangeon_keep.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/assets/xml/objects/object_bdoor.xml b/assets/xml/objects/object_bdoor.xml
index eb22cfea35..e926ae40bd 100644
--- a/assets/xml/objects/object_bdoor.xml
+++ b/assets/xml/objects/object_bdoor.xml
@@ -1,15 +1,22 @@
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_tw.xml b/assets/xml/objects/object_tw.xml
index bb471aee51..ac05ccd0aa 100644
--- a/assets/xml/objects/object_tw.xml
+++ b/assets/xml/objects/object_tw.xml
@@ -1,17 +1,18 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -38,37 +39,40 @@
+
-
-
-
-
+
+
+
+
+
-
+
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
@@ -115,8 +119,8 @@
-
-
+
+
@@ -135,51 +139,96 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -206,127 +255,150 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/docs/tutorial/helper_scripts.md b/docs/tutorial/helper_scripts.md
index efdb31d47c..49ca3925cd 100644
--- a/docs/tutorial/helper_scripts.md
+++ b/docs/tutorial/helper_scripts.md
@@ -160,15 +160,15 @@ on the address from the `D_address` containing the cutscene data.
## regconvert
-This converts the direct memory references, of the form `gGameInfo->data[index]` or `gGameInfo + 0x`, into the corresponding REG macros defined in [regs.h](../include/regs.h). Run
+This converts the direct memory references, of the form `gRegEditor->data[index]` or `gRegEditor + 0x`, into the corresponding REG macros defined in [regs.h](../include/regs.h). Run
```sh
./tools/regconvert.py
```
-if you have it in the form `gGameInfo->data[index]`, or
+if you have it in the form `gRegEditor->data[index]`, or
```sh
./tools/regconvert.py --offset
```
-if you have it in the form `gGameInfo + 0x`. You can also run it on a whole file using `--file `.
+if you have it in the form `gRegEditor + 0x`. You can also run it on a whole file using `--file `.
## assist
diff --git a/include/functions.h b/include/functions.h
index 62bf420465..dd3b19ea93 100644
--- a/include/functions.h
+++ b/include/functions.h
@@ -488,9 +488,9 @@ s32 Actor_IsTargeted(PlayState* play, Actor* actor);
s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor);
f32 func_80033AEC(Vec3f* arg0, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5);
void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play);
-void func_80033DB8(PlayState* play, s16 arg1, s16 arg2);
-void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3);
-void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3);
+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);
f32 Rand_ZeroFloat(f32 f);
f32 Rand_CenteredFloat(f32 f);
void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type);
@@ -666,7 +666,7 @@ s16 Camera_GetInputDirYaw(Camera* camera);
Vec3s* Camera_GetCamDir(Vec3s* dst, Camera* camera);
s16 Camera_GetCamDirPitch(Camera* camera);
s16 Camera_GetCamDirYaw(Camera* camera);
-s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown);
+s32 Camera_RequestQuake(Camera* camera, s32 unused, s16 y, s32 duration);
s32 Camera_SetParam(Camera* camera, s32 param, void* value);
s32 func_8005AC48(Camera* camera, s16 arg1);
s16 func_8005ACFC(Camera* camera, s16 arg1);
@@ -677,7 +677,7 @@ s32 Camera_SetCSParams(Camera* camera, CutsceneCameraPoint* atPoints, CutsceneCa
s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 bgCamIndex, f32 arg3, s16 timer1, s16 timer2,
s16 timer3);
s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera);
-Vec3f* Camera_GetSkyboxOffset(Vec3f* dst, Camera* camera);
+Vec3f* Camera_GetQuakeOffset(Vec3f* quakeOffset, Camera* camera);
void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3,
UNK_TYPE arg6);
s32 func_8005B198(void);
@@ -774,12 +774,10 @@ s32 CollisionCheck_CylSideVsLineSeg(f32 radius, f32 height, f32 offset, Vec3f* a
u8 CollisionCheck_GetSwordDamage(s32 dmgFlags);
void SaveContext_Init(void);
s32 func_800635D0(s32);
-void func_800636C0(void);
+void Regs_Init(void);
void func_8006375C(s32 arg0, s32 arg1, const char* text);
void func_8006376C(u8 x, u8 y, u8 colorIndex, const char* text);
-// ? func_80063828(?);
-void func_8006390C(Input* input);
-// ? func_80063C04(?);
+void Regs_UpdateEditor(Input* input);
void func_80063D7C(GraphicsContext* gfxCtx);
void DebugDisplay_Init(void);
DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX,
@@ -952,10 +950,10 @@ f32 OLib_Vec3fDistXZ(Vec3f* a, Vec3f* b);
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_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);
-VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* dest, Vec3f* a, Vec3f* b);
+VecGeo* OLib_Vec3fToVecGeo(VecGeo* dest, Vec3f* vec);
+VecGeo* OLib_Vec3fDiffToVecGeo(VecGeo* dest, Vec3f* a, Vec3f* b);
Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b);
s16 OnePointCutscene_Init(PlayState* play, s16 csId, s16 timer, Actor* actor, s16 parentCamId);
s16 OnePointCutscene_EndCutscene(PlayState* play, s16 subCamId);
@@ -1061,28 +1059,6 @@ u32 Player_InitDrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime);
void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot, f32 scale,
s32 sword, s32 tunic, s32 shield, s32 boots);
void PreNMI_Init(GameState* thisx);
-Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2);
-void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x);
-s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake);
-s16 Quake_Callback6(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);
-QuakeRequest* 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 y, s16 x, s16 zoom, s16 rotZ);
-u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2);
-void Quake_Init(void);
-s16 Quake_Add(Camera* camera, u32 callbackIdx);
-u32 Quake_RemoveFromIdx(s16 idx);
-s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData);
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 near, s32 far);
@@ -1384,7 +1360,7 @@ u32 Letterbox_GetSize(void);
void Letterbox_Init(void);
void Letterbox_Destroy(void);
void Letterbox_Update(s32 updateRate);
-// ? DbCamera_AddVecSph(?);
+// ? DbCamera_AddVecGeoToVec3f(?);
// ? DbCamera_CalcUpFromPitchYawRoll(?);
// ? DbCamera_SetTextValue(?);
// ? DbCamera_Vec3SToF(?);
@@ -1522,11 +1498,9 @@ void AudioMgr_Unlock(AudioMgr* audioMgr);
void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, Scheduler* sched, IrqMgr* irqMgr);
void GameState_FaultPrint(void);
void GameState_SetFBFilter(Gfx** gfx);
-// ? func_800C4344(?);
void GameState_DrawInputDisplay(u16 input, Gfx** gfx);
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx);
void GameState_SetFrameBuffer(GraphicsContext* gfxCtx);
-// ? func_800C49F4(?);
void GameState_ReqPadData(GameState* gameState);
void GameState_Update(GameState* gameState);
void GameState_InitArena(GameState* gameState, size_t size);
@@ -2191,7 +2165,7 @@ void GameOver_Update(PlayState* play);
void Interface_Destroy(PlayState* play);
void Interface_Init(PlayState* play);
void Message_Init(PlayState* play);
-void func_80112098(PlayState* play);
+void Regs_InitData(PlayState* play);
void Setup_Init(GameState* thisx);
void Setup_Destroy(GameState* thisx);
diff --git a/include/quake.h b/include/quake.h
new file mode 100644
index 0000000000..a9a33b5288
--- /dev/null
+++ b/include/quake.h
@@ -0,0 +1,44 @@
+#ifndef QUAKE_H
+#define QUAKE_H
+
+#include "z64camera.h"
+#include "z64math.h"
+
+typedef struct {
+ /* 0x00 */ Vec3f atOffset;
+ /* 0x0C */ Vec3f eyeOffset;
+ /* 0x18 */ s16 upPitchOffset; // gives a "roll" effect by offsetting the Up vector
+ /* 0x1A */ s16 upYawOffset; // gives a "roll" effect by offsetting the Up vector
+ /* 0x1C */ s16 fovOffset; // binary angle
+ /* 0x20 */ f32 maxOffset;
+} ShakeInfo; // size = 0x24
+
+typedef enum {
+ /* 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;
+
+// Quake type 6 is Jump-Periodic, sustaining, random X perturbations,
+// resets period every 16 frames (jumps, similar to sawtooth),
+// continues indefinitely i.e. does not terminate when the timer reaches 0
+// must be manually removed
+
+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);
+u32 Quake_RemoveRequest(s16 index);
+
+void Quake_Init(void);
+s16 Quake_Update(Camera* camera, ShakeInfo* camShake);
+
+#endif
diff --git a/include/regs.h b/include/regs.h
index c1fdd6bf87..b6869cbbcf 100644
--- a/include/regs.h
+++ b/include/regs.h
@@ -6,7 +6,7 @@
#define REGS_PER_PAGE 16
#define REGS_PER_GROUP (REG_PAGES * REGS_PER_PAGE)
-#define BASE_REG(n, r) gGameInfo->data[(n) * REGS_PER_GROUP + (r)]
+#define BASE_REG(n, r) gRegEditor->data[(n) * REGS_PER_GROUP + (r)]
#define REG(r) BASE_REG(0, (r))
#define SREG(r) BASE_REG(1, (r))
diff --git a/include/tables/dmadata_table_mqdbg.h b/include/tables/dmadata_table_mqdbg.h
index 9f621e058b..9d07de8863 100644
--- a/include/tables/dmadata_table_mqdbg.h
+++ b/include/tables/dmadata_table_mqdbg.h
@@ -1,6 +1,6 @@
/**
* Matching dmadata layout for PAL MQ Debug
- *
+ *
* DEFINE_DMA_ENTRY should be used for all dmadata entries
* - Argument 1: Name of the spec segment
* - Argument 2: String matching the original name of the segment
diff --git a/include/tables/entrance_table.h b/include/tables/entrance_table.h
index 17abdad340..b8d37f5e7a 100644
--- a/include/tables/entrance_table.h
+++ b/include/tables/entrance_table.h
@@ -7,7 +7,7 @@
* - Argument 3: Spawn number for this entrance
* - Argument 4: Toggle if bgm should continue during the transition using this entrance (true or false)
* NOTE: For non-cutscene layers, this field is only read from the `SCENE_LAYER_CHILD_DAY` layer.
- * Meaning, the setting only matters for the first entry within a group of layers and that
+ * Meaning, the setting only matters for the first entry within a group of layers and that
* setting will apply to the other 3 non-cutscene layers.
* - Argument 5: Toggle if a title card should display when using this entrance (true or false)
* - Argument 6: Transition type when entering using this entrance (second half of a scene transition)
diff --git a/include/ultra64/rdb.h b/include/ultra64/rdb.h
index b9e6a52816..31442b587c 100644
--- a/include/ultra64/rdb.h
+++ b/include/ultra64/rdb.h
@@ -28,7 +28,7 @@
#define RDB_TYPE_HtoG_DEBUG 14
#define RDB_TYPE_HtoG_DEBUG_CT 15
#define RDB_TYPE_HtoG_DATA 16
-#define RDB_TYPE_HtoG_DATA_DONE 17
+#define RDB_TYPE_HtoG_DATA_DONE 17
#define RDB_TYPE_HtoG_REQ_RAMROM 18
#define RDB_TYPE_HtoG_FREE_RAMROM 19
#define RDB_TYPE_HtoG_KDEBUG 20
diff --git a/include/ultra64/ucode.h b/include/ultra64/ucode.h
index c39fa938a6..a525b24839 100644
--- a/include/ultra64/ucode.h
+++ b/include/ultra64/ucode.h
@@ -9,7 +9,7 @@
#define SP_UCODE_SIZE 0x1000
#define SP_UCODE_DATA_SIZE 0x800
-
+
extern u64 rspbootTextStart[], rspbootTextEnd[];
extern u64 aspMainTextStart[], aspMainTextEnd[];
diff --git a/include/variables.h b/include/variables.h
index f04847e12c..59b1d7c8e0 100644
--- a/include/variables.h
+++ b/include/variables.h
@@ -173,7 +173,7 @@ extern u8 gSequenceTable[];
extern u8 gSampleBankTable[];
extern SaveContext gSaveContext;
-extern GameInfo* gGameInfo;
+extern RegEditor* gRegEditor;
extern u16 D_8015FCC0;
extern u16 D_8015FCC2;
extern u16 D_8015FCC4;
diff --git a/include/z64.h b/include/z64.h
index de9379f12d..0200cbeafb 100644
--- a/include/z64.h
+++ b/include/z64.h
@@ -94,7 +94,7 @@ typedef struct {
/* 0x0C */ s32 dPadInputPrev;
/* 0x10 */ s32 inputRepeatTimer;
/* 0x14 */ s16 data[REG_GROUPS * REGS_PER_GROUP]; // Accessed through *REG macros, see regs.h
-} GameInfo; // size = 0x15D4
+} RegEditor; // size = 0x15D4
typedef struct {
/* 0x00000 */ u16 headMagic; // GFXPOOL_HEAD_MAGIC
@@ -1037,7 +1037,7 @@ typedef enum {
/* 6 */ TRANS_TYPE_FADE_BLACK_SLOW,
/* 7 */ TRANS_TYPE_FADE_WHITE_SLOW,
/* 8 */ TRANS_TYPE_WIPE_FAST,
- /* 9 */ TRANS_TYPE_FILL_WHITE2,
+ /* 9 */ TRANS_TYPE_FILL_WHITE2,
/* 10 */ TRANS_TYPE_FILL_WHITE,
/* 11 */ TRANS_TYPE_INSTANT,
/* 12 */ TRANS_TYPE_FILL_BROWN,
@@ -1688,46 +1688,6 @@ typedef struct {
/* 0x10 */ OSTime resetTime;
} PreNmiBuff; // size = 0x18 (actually osAppNMIBuffer is 0x40 bytes large but the rest is unused)
-typedef struct {
- /* 0x00 */ s16 unk_00;
- /* 0x02 */ s16 unk_02;
- /* 0x04 */ s16 unk_04;
-} SubQuakeRequest14;
-
-typedef struct {
- /* 0x00 */ s16 randIdx;
- /* 0x02 */ s16 countdownMax;
- /* 0x04 */ Camera* cam;
- /* 0x08 */ u32 callbackIdx;
- /* 0x0C */ s16 y;
- /* 0x0E */ s16 x;
- /* 0x10 */ s16 zoom;
- /* 0x12 */ s16 rotZ;
- /* 0x14 */ SubQuakeRequest14 unk_14;
- /* 0x1A */ s16 speed;
- /* 0x1C */ s16 unk_1C;
- /* 0x1E */ s16 countdown;
- /* 0x20 */ s16 camPtrIdx;
-} QuakeRequest; // size = 0x24
-
-typedef struct {
- /* 0x00 */ Vec3f vec1;
- /* 0x0C */ Vec3f vec2;
- /* 0x18 */ s16 rotZ;
- /* 0x1A */ s16 unk_1A;
- /* 0x1C */ s16 zoom;
-} ShakeInfo; // size = 0x1E
-
-typedef struct {
- /* 0x00 */ Vec3f atOffset;
- /* 0x0C */ Vec3f eyeOffset;
- /* 0x18 */ s16 rotZ;
- /* 0x1A */ s16 unk_1A;
- /* 0x1C */ s16 zoom;
- /* 0x20 */ f32 unk_20;
-} QuakeCamCalc; // size = 0x24
-
-
#define UCODE_NULL 0
#define UCODE_F3DZEX 1
#define UCODE_UNK 2
diff --git a/include/z64actor.h b/include/z64actor.h
index e717fdfa10..7088919f44 100644
--- a/include/z64actor.h
+++ b/include/z64actor.h
@@ -151,7 +151,7 @@ typedef struct {
#define ACTOR_FLAG_9 (1 << 9)
#define ACTOR_FLAG_10 (1 << 10)
#define ACTOR_FLAG_ENKUSA_CUT (1 << 11)
-#define ACTOR_FLAG_12 (1 << 12)
+#define ACTOR_FLAG_IGNORE_QUAKE (1 << 12) // actor will not shake when a quake occurs
#define ACTOR_FLAG_13 (1 << 13)
#define ACTOR_FLAG_14 (1 << 14)
#define ACTOR_FLAG_15 (1 << 15)
diff --git a/include/z64audio.h b/include/z64audio.h
index 4f1f0a5543..fe63f75702 100644
--- a/include/z64audio.h
+++ b/include/z64audio.h
@@ -607,7 +607,7 @@ typedef struct {
/**
* The high-level audio specifications requested when initializing or resetting the audio heap.
* The audio heap can be reset on various occasions, including on most scene transitions.
- */
+ */
typedef struct {
/* 0x00 */ u32 samplingFrequency; // Target sampling rate in Hz
/* 0x04 */ u8 unk_04;
@@ -909,7 +909,7 @@ typedef struct {
/* 0x2990 */ AudioAllocPool sessionPool; // A sub-pool to main pool, contains all sub-pools and data that changes every audio reset
/* 0x29A0 */ AudioAllocPool externalPool; // pool allocated externally to the audio heap. Never used in game
/* 0x29B0 */ AudioAllocPool initPool;// A sub-pool to the main pool, contains all sub-pools and data that persists every audio reset
- /* 0x29C0 */ AudioAllocPool miscPool; // A sub-pool to the session pool.
+ /* 0x29C0 */ AudioAllocPool miscPool; // A sub-pool to the session pool.
/* 0x29D0 */ char unk_29D0[0x20]; // probably two unused pools
/* 0x29F0 */ AudioAllocPool cachePool; // The common pool for cache entries
/* 0x2A00 */ AudioAllocPool persistentCommonPool; // A sub-pool to the cache pool, contains caches for data stored persistently
diff --git a/include/z64camera.h b/include/z64camera.h
index 5ea1d97599..9550ee11b0 100644
--- a/include/z64camera.h
+++ b/include/z64camera.h
@@ -27,7 +27,7 @@
#define PARENT_CAM(cam) ((cam)->play->cameraPtrs[(cam)->parentCamId])
#define CHILD_CAM(cam) ((cam)->play->cameraPtrs[(cam)->childCamId])
-// All scenes using `SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT` or `SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT` are expected
+// All scenes using `SCENE_CAM_TYPE_FIXED_SHOP_VIEWPOINT` or `SCENE_CAM_TYPE_FIXED_TOGGLE_VIEWPOINT` are expected
// to have their first two bgCamInfo entries be the following:
#define BGCAM_INDEX_TOGGLE_LOCKED 0
#define BGCAM_INDEX_TOGGLE_PIVOT 1
@@ -102,7 +102,7 @@ typedef enum {
/* 0x3A */ CAM_SET_NORMAL2,
/* 0x3B */ CAM_SET_FISHING, // Fishing pond by the lake
/* 0x3C */ CAM_SET_CS_C, // Various cutscenes "DEMOC"
- /* 0x3D */ CAM_SET_JABU_TENTACLE, // Jabu-Jabu Parasitic Tenticle Rooms "UO_FIBER"
+ /* 0x3D */ CAM_SET_JABU_TENTACLE, // Jabu-Jabu Parasitic Tentacle Rooms "UO_FIBER"
/* 0x3E */ CAM_SET_DUNGEON2,
/* 0x3F */ CAM_SET_DIRECTED_YAW, // Does not auto-update yaw, tends to keep the camera pointed at a certain yaw (used by biggoron and final spirit lowering platform) "TEPPEN"
/* 0x40 */ CAM_SET_PIVOT_FROM_SIDE, // Fixed side view, allows rotation of camera (eg. Potion Shop, Meadow at fairy grotto) "CIRCLE7"
@@ -439,7 +439,9 @@ typedef struct {
typedef struct {
/* 0x00 */ SwingAnimation swing;
/* 0x1C */ f32 unk_1C;
- /* 0x20 */ VecSph unk_20;
+ /* 0x20 */ f32 unk_20;
+ /* 0x24 */ s16 unk_24;
+ /* 0x26 */ s16 unk_26;
} Jump1ReadWriteData; // size = 0x28
typedef struct {
@@ -670,7 +672,9 @@ typedef struct {
} KeepOn3ReadOnlyData; // size = 0x2C
typedef struct {
- /* 0x00 */ Vec3f eyeToAtTarget; // esentially a VecSph, but all floats.
+ /* 0x00 */ f32 eyeToAtTargetR;
+ /* 0x08 */ f32 eyeToAtTargetYaw;
+ /* 0x04 */ f32 eyeToAtTargetPitch;
/* 0x0C */ Actor* target;
/* 0x10 */ Vec3f atTarget;
/* 0x1C */ s16 animTimer;
@@ -1098,7 +1102,7 @@ typedef struct {
/* 0x10 */ Vec3f eyeTarget;
/* 0x1C */ Vec3f playerPos;
/* 0x28 */ f32 fovTarget;
- /* 0x2C */ VecSph atEyeOffsetTarget;
+ /* 0x2C */ VecGeo atEyeOffsetTarget;
/* 0x34 */ s16 rollTarget;
/* 0x36 */ s16 curKeyFrameIdx;
/* 0x38 */ s16 unk_38;
@@ -1344,17 +1348,17 @@ typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f norm;
/* 0x18 */ CollisionPoly* poly;
- /* 0x1C */ VecSph sphNorm;
+ /* 0x1C */ VecGeo geoNorm;
/* 0x24 */ s32 bgId;
} CamColChk; // size = 0x28
-typedef struct {
+typedef struct Camera {
/* 0x000 */ CamParamData paramData;
/* 0x050 */ Vec3f at;
/* 0x05C */ Vec3f eye;
/* 0x068 */ Vec3f up;
/* 0x074 */ Vec3f eyeNext;
- /* 0x080 */ Vec3f skyboxOffset;
+ /* 0x080 */ Vec3f quakeOffset;
/* 0x08C */ struct PlayState* play;
/* 0x090 */ struct Player* player;
/* 0x094 */ PosRot playerPosRot;
@@ -1378,7 +1382,7 @@ typedef struct {
/* 0x114 */ f32 waterYPos;
/* 0x118 */ s32 bgCamIndexBeforeUnderwater;
/* 0x11C */ s32 waterCamSetting;
- /* 0x120 */ s32 waterQuakeId;
+ /* 0x120 */ s32 waterQuakeIndex;
/* 0x124 */ void* data0;
/* 0x128 */ void* data1;
/* 0x12C */ s16 data2;
diff --git a/include/z64environment.h b/include/z64environment.h
index 3bfaf00823..5944607b88 100644
--- a/include/z64environment.h
+++ b/include/z64environment.h
@@ -26,12 +26,12 @@
#define LIGHT_BLEND_OVERRIDE_NONE 0
#define LIGHT_BLEND_OVERRIDE_ON 1
-// This mode disables the light system's automatic blending between
+// This mode disables the light system's automatic blending between
// light settings for `LIGHT_MODE_SETTINGS` (or using a light setting override).
// This is a bit of a hack used only by bosses in the original game.
#define LIGHT_BLEND_OVERRIDE_FULL_CONTROL 2
-typedef enum {
+typedef enum {
/* 0 */ LIGHT_MODE_TIME, // environment lights use `lightConfig` and change based on time of day
/* 1 */ LIGHT_MODE_SETTINGS // environment lights use `lightSetting`
} LightMode;
@@ -76,7 +76,7 @@ typedef enum {
typedef enum {
/* 0 */ PRECIP_RAIN_MAX, // max number of raindrops that can draw; uses this or SOS_MAX, whichever is larger
- /* 1 */ PRECIP_RAIN_CUR, // current number of rain drops being drawn on screen
+ /* 1 */ PRECIP_RAIN_CUR, // current number of rain drops being drawn on screen
/* 2 */ PRECIP_SNOW_CUR, // current number of snowflakes being drawn on screen
/* 3 */ PRECIP_SNOW_MAX, // max number of snowflakes that can draw
/* 4 */ PRECIP_SOS_MAX, // max number of rain drops requested from song of storms specifically
diff --git a/include/z64math.h b/include/z64math.h
index e3cb441bd2..083fedb96b 100644
--- a/include/z64math.h
+++ b/include/z64math.h
@@ -69,12 +69,19 @@ typedef struct {
/* 0x000C */ Vec3f b;
} Linef; // size = 0x18
-// Defines a point in the spherical coordinate system
typedef struct {
- /* 0x00 */ f32 r; // radius
- /* 0x04 */ s16 pitch; // polar (zenith) angle
- /* 0x06 */ s16 yaw; // azimuthal angle
-} VecSph; // size = 0x08
+ /* 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;
#define LERP(x, y, scale) (((y) - (x)) * (scale) + (x))
#define LERP32(x, y, scale) ((s32)(((y) - (x)) * (scale)) + (x))
diff --git a/include/z64ocarina.h b/include/z64ocarina.h
index 71e3352692..7dc1a4b331 100644
--- a/include/z64ocarina.h
+++ b/include/z64ocarina.h
@@ -148,14 +148,14 @@ typedef enum {
/**
* bFlat4Flag Note:
- * Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4)
+ * Flag for resolving whether (pitch = OCARINA_PITCH_BFLAT4)
* gets mapped to either C_RIGHT and C_LEFT
- *
+ *
* This is required as C_RIGHT and C_LEFT are the only notes
* that map to two semitones apart (OCARINA_PITCH_A4 and OCARINA_PITCH_B4)
* 0x40 - BTN_Z is pressed to lower note by a semitone
* 0x80 - BTN_R is pressed to raise note by a semitone
- */
+ */
typedef struct {
/* 0x0 */ u8 pitch; // number of semitones above middle C
diff --git a/include/z64save.h b/include/z64save.h
index ffa2232100..5a0e9103ea 100644
--- a/include/z64save.h
+++ b/include/z64save.h
@@ -12,7 +12,7 @@ typedef enum {
/* 0x4 */ MAGIC_STATE_METER_FLASH_2, // Flashes border and draws yellow magic to preview target consumption
/* 0x5 */ MAGIC_STATE_RESET, // Reset colors and return to idle
/* 0x6 */ MAGIC_STATE_METER_FLASH_3, // Flashes border with no additional behaviour
- /* 0x7 */ MAGIC_STATE_CONSUME_LENS, // Magic slowly consumed by lens.
+ /* 0x7 */ MAGIC_STATE_CONSUME_LENS, // Magic slowly consumed by lens.
/* 0x8 */ MAGIC_STATE_STEP_CAPACITY, // Step `magicCapacity` to full capacity
/* 0x9 */ MAGIC_STATE_FILL, // Add magic until magicFillTarget is reached.
/* 0xA */ MAGIC_STATE_ADD // Add requested magic
@@ -257,7 +257,7 @@ typedef enum {
/* 1 */ SCENE_LAYER_CHILD_NIGHT,
/* 2 */ SCENE_LAYER_ADULT_DAY,
/* 3 */ SCENE_LAYER_ADULT_NIGHT,
- /* 4 */ SCENE_LAYER_CUTSCENE_FIRST
+ /* 4 */ SCENE_LAYER_CUTSCENE_FIRST
} SceneLayer;
#define IS_CUTSCENE_LAYER (gSaveContext.sceneLayer >= SCENE_LAYER_CUTSCENE_FIRST)
@@ -293,11 +293,11 @@ typedef enum {
#define EVENTCHKINF_10 0x10
#define EVENTCHKINF_11 0x11
#define EVENTCHKINF_12 0x12
-#define EVENTCHKINF_13 0x13
-#define EVENTCHKINF_14 0x14
+#define EVENTCHKINF_TALON_WOKEN_IN_CASTLE 0x13
+#define EVENTCHKINF_TALON_RETURNED_FROM_CASTLE 0x14
#define EVENTCHKINF_15 0x15
#define EVENTCHKINF_16 0x16
-#define EVENTCHKINF_18 0x18
+#define EVENTCHKINF_EPONA_OBTAINED 0x18
#define EVENTCHKINF_1B 0x1B
#define EVENTCHKINF_1C 0x1C
#define EVENTCHKINF_1D 0x1D
@@ -354,13 +354,13 @@ typedef enum {
#define EVENTCHKINF_67 0x67
#define EVENTCHKINF_68 0x68
#define EVENTCHKINF_69 0x69
-#define EVENTCHKINF_6A 0x6A
+#define EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO 0x6A
// 0x6B
-#define EVENTCHKINF_6B_INDEX 6
-#define EVENTCHKINF_6B_SHIFT 11
-#define EVENTCHKINF_6B_MASK (1 << EVENTCHKINF_6B_SHIFT)
-#define EVENTCHKINF_6B ((EVENTCHKINF_6B_INDEX << 4) | EVENTCHKINF_6B_SHIFT)
+#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_INDEX 6
+#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_SHIFT 11
+#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK (1 << EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_SHIFT)
+#define EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO ((EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_INDEX << 4) | EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_SHIFT)
#define EVENTCHKINF_6E 0x6E
#define EVENTCHKINF_6F 0x6F
@@ -473,7 +473,7 @@ typedef enum {
* SaveContext.itemGetInf
*/
-#define ITEMGETINF_02 0x02
+#define ITEMGETINF_TALON_BOTTLE 0x02
#define ITEMGETINF_03 0x03
#define ITEMGETINF_04 0x04
#define ITEMGETINF_05 0x05
@@ -563,7 +563,7 @@ typedef enum {
#define INFTABLE_71 0x71
#define INFTABLE_76 0x76
#define INFTABLE_77 0x77
-#define INFTABLE_7E 0x7E
+#define INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE 0x7E
#define INFTABLE_84 0x84
#define INFTABLE_85 0x85
#define INFTABLE_8B 0x8B
@@ -709,8 +709,13 @@ typedef enum {
#define EVENTINF_HORSES_0F_MASK (1 << EVENTINF_HORSES_0F_SHIFT)
#define EVENTINF_HORSES_05 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_05_SHIFT)
#define EVENTINF_HORSES_06 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_06_SHIFT)
+// Used in z_en_ta (Talon) to store Cucco game winning status
+// and in z_en_ge1 (Gerudo) to store archery in-progress status
#define EVENTINF_HORSES_08 ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_08_SHIFT)
+#define EVENTINF_CUCCO_GAME_WON EVENTINF_HORSES_08
+// Used in z_en_ta (Talon) and z_en_ma3 (Malon) to store minigame finishing status
#define EVENTINF_HORSES_0A ((EVENTINF_HORSES_INDEX << 4) | EVENTINF_HORSES_0A_SHIFT)
+#define EVENTINF_CUCCO_GAME_FINISHED EVENTINF_HORSES_0A
typedef enum {
/* 0 */ EVENTINF_HORSES_STATE_0,
diff --git a/src/code/db_camera.c b/src/code/db_camera.c
index a514f92dea..1018ba21cf 100644
--- a/src/code/db_camera.c
+++ b/src/code/db_camera.c
@@ -96,17 +96,19 @@ static DbCamera* sDbCamPtr;
static s16 D_8016110C;
static DbCameraAnim sDbCamAnim;
-Vec3f* DbCamera_AddVecSph(Vec3f* out, Vec3f* in, VecSph* sph) {
- Vec3f ret;
- Vec3f vec;
+Vec3f* DbCamera_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) {
+ Vec3f sum;
+ Vec3f b;
- OLib_VecSphGeoToVec3f(&vec, sph);
+ OLib_VecGeoToVec3f(&b, geo);
- ret.x = in->x + vec.x;
- ret.y = in->y + vec.y;
- ret.z = in->z + vec.z;
- *out = ret;
- return out;
+ sum.x = a->x + b.x;
+ sum.y = a->y + b.y;
+ sum.z = a->z + b.z;
+
+ *dest = sum;
+
+ return dest;
}
Vec3f* DbCamera_CalcUpFromPitchYawRoll(Vec3f* dest, s16 pitch, s16 yaw, s16 roll) {
@@ -224,25 +226,28 @@ void DbCamera_Vec3SToF2(Vec3s* in, Vec3f* out) {
}
void func_800B3F94(PosRot* posRot, Vec3f* vec, Vec3s* out) {
- VecSph sph;
+ VecGeo geo;
Vec3f tempVec;
- OLib_Vec3fDiffToVecSphGeo(&sph, &posRot->pos, vec);
- sph.yaw -= posRot->rot.y;
- OLib_VecSphGeoToVec3f(&tempVec, &sph);
+
+ OLib_Vec3fDiffToVecGeo(&geo, &posRot->pos, vec);
+ geo.yaw -= posRot->rot.y;
+ OLib_VecGeoToVec3f(&tempVec, &geo);
DbCamera_Vec3FToS(&tempVec, out);
}
void func_800B3FF4(PosRot* posRot, Vec3f* vec, Vec3f* out) {
- VecSph sph;
+ VecGeo geo;
Vec3f tempVec;
+
DbCamera_CopyVec3f(vec, &tempVec);
- OLib_Vec3fToVecSphGeo(&sph, &tempVec);
- sph.yaw += posRot->rot.y;
- DbCamera_AddVecSph(out, &posRot->pos, &sph);
+ OLib_Vec3fToVecGeo(&geo, &tempVec);
+ geo.yaw += posRot->rot.y;
+ DbCamera_AddVecGeoToVec3f(out, &posRot->pos, &geo);
}
void func_800B404C(PosRot* posRot, Vec3s* vec, Vec3f* out) {
Vec3f tempVec;
+
DbCamera_Vec3SToF(vec, &tempVec);
func_800B3FF4(posRot, &tempVec, out);
}
@@ -318,7 +323,7 @@ s32 func_800B42C0(DbCamera* dbCamera, Camera* cameraPtr) {
s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) {
CutsceneCameraPoint* lookAt = &dbCamera->sub.lookAt[idx];
CutsceneCameraPoint* position = &dbCamera->sub.position[idx];
- VecSph sph;
+ VecGeo geo;
Vec3f at;
if (dbCamera->sub.mode != 1) {
@@ -335,10 +340,10 @@ s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) {
}
dbCamera->at = at;
}
- sph.pitch = 0x2000;
- sph.yaw -= 0x7FFF;
- sph.r = 250.0f;
- DbCamera_AddVecSph(&dbCamera->eye, &dbCamera->at, &sph);
+ geo.pitch = 0x2000;
+ geo.yaw -= 0x7FFF;
+ geo.r = 250.0f;
+ DbCamera_AddVecGeoToVec3f(&dbCamera->eye, &dbCamera->at, &geo);
dbCamera->roll = lookAt->cameraRoll;
dbCamera->rollDegrees = dbCamera->roll * (360.0f / 256.0f);
dbCamera->fov = lookAt->viewAngle;
@@ -572,9 +577,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
char sp111;
char sp110;
f32 temp_f2_2;
- VecSph sp104;
- VecSph spFC;
- VecSph spF4;
+ VecGeo sp104;
+ VecGeo spFC;
+ VecGeo spF4;
PosRot* temp_s6;
UNUSED Vec3f* eye;
UNUSED Vec3f* at;
@@ -588,7 +593,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
Vec3f spB8;
Vec3f spAC;
s16 spAA;
- VecSph spA0;
+ VecGeo spA0;
sp90 = &dbCamera->unk_54;
temp_s6 = &cam->playerPosRot;
@@ -671,9 +676,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
phi_s0 = sp124;
if (!D_80161144) {
- OLib_Vec3fDiffToVecSphGeo(&sp104, sp7C, sp80);
+ OLib_Vec3fDiffToVecGeo(&sp104, sp7C, sp80);
} else {
- OLib_Vec3fDiffToVecSphGeo(&sp104, sp80, sp7C);
+ OLib_Vec3fDiffToVecGeo(&sp104, sp80, sp7C);
}
if (dbCamera->unk_44 > 100) {
@@ -709,11 +714,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.r = temp_f2;
if (!D_80161144) {
spFC.yaw = sp104.yaw;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.pitch = -spFC.pitch;
spFC.yaw = sp104.yaw - 0x7FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 0xB) {
dbCamera->unk_44++;
@@ -737,11 +742,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.r = -temp_f2;
if (!D_80161144) {
spFC.yaw = sp104.yaw;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.pitch = -spFC.pitch;
spFC.yaw = sp104.yaw - 0x7FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 0xC) {
dbCamera->unk_44++;
@@ -760,10 +765,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.pitch = 0;
if (!D_80161144) {
spFC.yaw = sp104.yaw;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.yaw = sp104.yaw - 0x7FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 1) {
@@ -778,10 +783,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.pitch = 0;
if (!D_80161144) {
spFC.yaw = sp104.yaw;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.yaw = sp104.yaw - 0x7FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 2) {
dbCamera->unk_44++;
@@ -795,9 +800,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.pitch = 0x3FFF;
spFC.yaw = sp104.yaw;
if (!D_80161144) {
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 3) {
dbCamera->unk_44++;
@@ -811,9 +816,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.pitch = -0x3FFF;
spFC.yaw = sp104.yaw;
if (!D_80161144) {
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 4) {
dbCamera->unk_44++;
@@ -828,10 +833,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.pitch = 0;
if (!D_80161144) {
spFC.yaw = sp104.yaw + 0x3FFF;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.yaw = sp104.yaw - 0x3FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 5) {
dbCamera->unk_44++;
@@ -846,10 +851,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.pitch = 0;
if (!D_80161144) {
spFC.yaw = sp104.yaw - 0x3FFF;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.yaw = sp104.yaw + 0x3FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 6) {
dbCamera->unk_44++;
@@ -873,11 +878,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.r = temp_f2;
if (!D_80161144) {
spFC.yaw = sp104.yaw;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.pitch = -spFC.pitch;
spFC.yaw = sp104.yaw - 0x7FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 0xB) {
dbCamera->unk_44++;
@@ -902,11 +907,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
spFC.r = -temp_f2;
if (!D_80161144) {
spFC.yaw = sp104.yaw;
- DbCamera_AddVecSph(sp7C, sp7C, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp7C, &spFC);
} else {
spFC.pitch = -spFC.pitch;
spFC.yaw = sp104.yaw - 0x7FFF;
- DbCamera_AddVecSph(sp80, sp80, &spFC);
+ DbCamera_AddVecGeoToVec3f(sp80, sp80, &spFC);
}
if (dbCamera->unk_40 == 0xC) {
dbCamera->unk_44++;
@@ -964,18 +969,18 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
if (!D_80161144) {
sp104.pitch += (s16)((temp_f0_5 >= 0.0f) ? pitch : -pitch);
sp104.yaw += (s16)((temp_f2_2 >= 0.0f) ? yaw : -yaw);
- DbCamera_AddVecSph(sp80, sp7C, &sp104);
+ DbCamera_AddVecGeoToVec3f(sp80, sp7C, &sp104);
dbCamera->sub.unk_104A.x = -sp104.pitch;
dbCamera->sub.unk_104A.y = sp104.yaw - 0x7FFF;
} else {
sp104.pitch += (s16)((temp_f0_5 >= 0.0f) ? -pitch : pitch);
sp104.yaw += (s16)((temp_f2_2 >= 0.0f) ? -yaw : yaw);
- DbCamera_AddVecSph(sp7C, sp80, &sp104);
+ DbCamera_AddVecGeoToVec3f(sp7C, sp80, &sp104);
dbCamera->sub.unk_104A.x = sp104.pitch;
dbCamera->sub.unk_104A.y = sp104.yaw;
}
- OLib_Vec3fDiffToVecSphGeo(&spF4, sp80, sp7C);
+ OLib_Vec3fDiffToVecGeo(&spF4, sp80, sp7C);
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw,
CAM_DEG_TO_BINANG(dbCamera->rollDegrees));
if (dbCamera->unk_00 == 1) {
@@ -985,7 +990,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
cam->at = *sp7C;
spFC = sp104;
spFC.r = new_var2;
- DbCamera_AddVecSph(&cam->eye, &cam->at, &spFC);
+ DbCamera_AddVecGeoToVec3f(&cam->eye, &cam->at, &spFC);
}
}
}
@@ -1370,7 +1375,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
func_8006376C(0x1E, 0x19, 2, &sp110);
} else {
if (D_8012CEE0[0]) {}
- OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp7C);
+ OLib_Vec3fDiffToVecGeo(&spFC, sp90, sp7C);
spFC.yaw -= cam->playerPosRot.rot.y;
func_8006376C(3, 0x16,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7
@@ -1383,7 +1388,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
func_8006376C(3, 0x18, 3, D_8012D0F8);
DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6);
func_8006376C(3, 0x19, 3, D_8012D0D4);
- OLib_Vec3fDiffToVecSphGeo(&spFC, sp90, sp80);
+ OLib_Vec3fDiffToVecGeo(&spFC, sp90, sp80);
spFC.yaw -= cam->playerPosRot.rot.y;
func_8006376C(0x1E, 0x16,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7
@@ -1413,7 +1418,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
func_800B404C(temp_s6, &(dbCamera->sub.lookAt + i)->pos, &spB8);
func_800B404C(temp_s6, &(dbCamera->sub.position + i)->pos, &spAC);
}
- OLib_Vec3fDiffToVecSphGeo(&spFC, &spAC, &spB8);
+ OLib_Vec3fDiffToVecGeo(&spFC, &spAC, &spB8);
spAA = dbCamera->sub.lookAt[i].cameraRoll * 0xB6;
if (i == dbCamera->sub.unkIdx) {
DebugDisplay_AddObject(spAC.x, spAC.y, spAC.z, spFC.pitch * -1, spFC.yaw, spAA, .5f, .5f, .5f,
@@ -1481,7 +1486,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
D_8012D110++;
D_8012D110 %= 50;
- OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eye, &cam->at);
+ OLib_Vec3fDiffToVecGeo(&spA0, &cam->eye, &cam->at);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f, 0xFF,
0xFF, 0x7F, 0x2D, 0, cam->play->view.gfxCtx);
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 2.0f, 0.02f, 0.02f, 0x7F,
@@ -1492,7 +1497,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
0x7F, 0x7F, 0x80, 5, cam->play->view.gfxCtx);
DebugDisplay_AddObject(cam->at.x, cam->at.y, cam->at.z, spA0.pitch * -1, spA0.yaw, 0, 1.5f, 2.0f, 1.0f, 0xFF,
0x7F, 0x7F, 0x80, 4, cam->play->view.gfxCtx);
- OLib_Vec3fDiffToVecSphGeo(&spA0, &cam->eyeNext, &cam->at);
+ OLib_Vec3fDiffToVecGeo(&spA0, &cam->eyeNext, &cam->at);
DebugDisplay_AddObject(cam->eyeNext.x, cam->eyeNext.y, cam->eyeNext.z, spA0.pitch * -1, spA0.yaw, 0, .5f, .5f,
.5f, 0xFF, 0xC0, 0x7F, 0x50, 5, cam->play->view.gfxCtx);
}
@@ -1845,7 +1850,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
s16 idx3;
char sp74[(ARRAY_COUNT(sDbCameraCuts) - 1 + 4) * 2];
DbCameraCut sp64;
- VecSph sp5C;
+ VecGeo sp5C;
s32 (*callbacks[])(char*) = { DbCamera_SaveCallback, DbCamera_LoadCallback, DbCamera_ClearCallback };
func_8006376C(0xE, 5, 0, D_8012CF44); // DEMO CONTROL
@@ -2148,7 +2153,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
Audio_PlaySfxGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
- OLib_Vec3fDiffToVecSphGeo(&sp5C, &dbCamera->eye, &dbCamera->at);
+ OLib_Vec3fDiffToVecGeo(&sp5C, &dbCamera->eye, &dbCamera->at);
DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, sp5C.pitch, sp5C.yaw,
CAM_DEG_TO_BINANG(dbCamera->rollDegrees));
return 2;
diff --git a/src/code/game.c b/src/code/game.c
index 23e1a9ef42..271012655b 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -84,7 +84,7 @@ void func_800C4344(GameState* gameState) {
}
if (gIsCtrlr2Valid) {
- func_8006390C(&gameState->input[1]);
+ Regs_UpdateEditor(&gameState->input[1]);
}
gDmaMgrVerbose = HREG(60);
diff --git a/src/code/kanread.s b/src/code/kanread.s
index 70a884870e..8f35b713bd 100644
--- a/src/code/kanread.s
+++ b/src/code/kanread.s
@@ -16,7 +16,7 @@
* A nice Shift-JIS codepoint table: https://uic.io/en/charset/show/shift_jis/
* The file `kanji` contains the 'Level 1' kanji (0x889F-0x9872), and a reworked
* version of the non-kanji section that includes extra English and Hylian glyphs.
- *
+ *
* @note This function assumes that its argument is a valid Shift-JIS codepoint;
* there is no range protection at all.
*
@@ -26,15 +26,15 @@
* @remark Original name: "LeoGetKadr"
*/
LEAF(Kanji_OffsetFromShiftJIS)
- // Characters with codepoints >= 0x8800 are kanji. Arrangement is regular,
+ // Characters with codepoints >= 0x8800 are kanji. Arrangement is regular,
// so convert index directly.
li $at, 0x8800
slt $at, $a0, $at
bnez $at, .nonkanji
// 0xBC is number of glyphs in one block in the `kanji` file:
// 0x100 possible codepoints with the same byte1
- // - 0x40 unused at beginning
- // - 1 unused at 0x7F
+ // - 0x40 unused at beginning
+ // - 1 unused at 0x7F
// - 3 unused at 0xFD, 0xFE, 0xFF
li $a2, 0xBC
// Get byte1 and adjust so starts at 0
@@ -99,7 +99,7 @@ END(Kanji_OffsetFromShiftJIS)
* if (byte2 >= 0x40) {
* byte2--;
* }
- *
+ *
* if (sjis >= 0x8800) {
* byte1 -= 0x88;
* return (0x30A + byte2 + byte1 * 0xBC) * FONT_CHAR_TEX_SIZE;
@@ -134,7 +134,7 @@ DATA(sNonKanjiIndices)
/* 0x824_ */ .half 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0092
/* 0x825_ */ .half 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
/* 0x826_ */ .half 0x009C, 0x009D, 0x009E, 0x009F, 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB
-/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
+/* 0x827_ */ .half 0x00AC, 0x00AD, 0x00AE, 0x00AF, 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
/* 0x828_ */ .half 0x0000, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4
/* 0x829_ */ .half 0x00C5, 0x00C6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, 0x0000, 0x0000, 0x0000, 0x0000, 0x00D0
/* 0x82A_ */ .half 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00D8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00DE, 0x00DF, 0x00E0
diff --git a/src/code/main.c b/src/code/main.c
index c8d78ccca6..e32ce6e6a0 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -65,7 +65,7 @@ void Main(void* arg) {
}
osSyncPrintf("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
DebugArena_Init(debugHeapStart, debugHeapSize);
- func_800636C0();
+ Regs_Init();
R_ENABLE_ARENA_DBG = 0;
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index ef5748d594..e1f9390296 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_Arms_Hook/z_arms_hook.h"
@@ -2179,11 +2180,11 @@ void Actor_Draw(PlayState* play, Actor* actor) {
Lights_BindAll(lights, play->lightCtx.listHead, (actor->flags & ACTOR_FLAG_22) ? NULL : &actor->world.pos);
Lights_Draw(lights, play->state.gfxCtx);
- if (actor->flags & ACTOR_FLAG_12) {
- Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.skyboxOffset.x,
+ if (actor->flags & ACTOR_FLAG_IGNORE_QUAKE) {
+ Matrix_SetTranslateRotateYXZ(actor->world.pos.x + play->mainCamera.quakeOffset.x,
actor->world.pos.y +
- ((actor->shape.yOffset * actor->scale.y) + play->mainCamera.skyboxOffset.y),
- actor->world.pos.z + play->mainCamera.skyboxOffset.z, &actor->shape.rot);
+ ((actor->shape.yOffset * actor->scale.y) + play->mainCamera.quakeOffset.y),
+ actor->world.pos.z + play->mainCamera.quakeOffset.z, &actor->shape.rot);
} else {
Matrix_SetTranslateRotateYXZ(actor->world.pos.x, actor->world.pos.y + (actor->shape.yOffset * actor->scale.y),
actor->world.pos.z, &actor->shape.rot);
@@ -3505,30 +3506,29 @@ void func_80033C30(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play) {
CLOSE_DISPS(play->state.gfxCtx, "../z_actor.c", 8155);
}
-void func_80033DB8(PlayState* play, s16 arg1, s16 arg2) {
- s16 var = Quake_Add(&play->mainCamera, 3);
+void Actor_RequestQuake(PlayState* play, s16 y, s16 duration) {
+ s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3);
- Quake_SetSpeed(var, 20000);
- Quake_SetQuakeValues(var, arg1, 0, 0, 0);
- Quake_SetCountdown(var, arg2);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, duration);
}
-void func_80033E1C(PlayState* play, s16 arg1, s16 arg2, s16 arg3) {
- s16 var = Quake_Add(&play->mainCamera, 3);
+void Actor_RequestQuakeWithSpeed(PlayState* play, s16 y, s16 duration, s16 speed) {
+ s16 quakeIndex = Quake_Request(&play->mainCamera, QUAKE_TYPE_3);
- Quake_SetSpeed(var, arg3);
- Quake_SetQuakeValues(var, arg1, 0, 0, 0);
- Quake_SetCountdown(var, arg2);
+ Quake_SetSpeed(quakeIndex, speed);
+ Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, duration);
}
-void func_80033E88(Actor* actor, PlayState* play, s16 arg2, s16 arg3) {
- if (arg2 >= 5) {
+void Actor_RequestQuakeAndRumble(Actor* actor, PlayState* play, s16 quakeY, s16 quakeDuration) {
+ if (quakeY >= 5) {
Rumble_Request(actor->xyzDistToPlayerSq, 255, 20, 150);
} else {
Rumble_Request(actor->xyzDistToPlayerSq, 180, 20, 100);
}
-
- func_80033DB8(play, arg2, arg3);
+ Actor_RequestQuake(play, quakeY, quakeDuration);
}
f32 Rand_ZeroFloat(f32 f) {
@@ -3550,9 +3550,9 @@ typedef struct {
} DoorLockInfo; // size = 0x1C
static DoorLockInfo sDoorLocksInfo[] = {
- /* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, gDoorChainsDL, gDoorLockDL },
- /* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, object_bdoor_DL_001530, object_bdoor_DL_001400 },
- /* DOORLOCK_NORMAL_SPIRIT */ { 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainsDL, gDoorLockDL },
+ /* DOORLOCK_NORMAL */ { 0.54f, 6000.0f, 5000.0f, 1.0f, 0.0f, gDoorChainDL, gDoorLockDL },
+ /* DOORLOCK_BOSS */ { 0.644f, 12000.0f, 8000.0f, 1.0f, 0.0f, gBossDoorChainDL, gBossDoorLockDL },
+ /* DOORLOCK_NORMAL_SPIRIT */ { 0.64000005f, 8500.0f, 8000.0f, 1.75f, 0.1f, gDoorChainDL, gDoorLockDL },
};
/**
@@ -4602,7 +4602,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
if (Flags_GetEventChkInf(EVENTCHKINF_09) && Flags_GetEventChkInf(EVENTCHKINF_25) &&
Flags_GetEventChkInf(EVENTCHKINF_37)) {
retTextId = 0x7047;
- } else if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
+ } else if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
retTextId = 0x701A;
} else if (Flags_GetEventChkInf(EVENTCHKINF_11)) {
if (Flags_GetInfTable(INFTABLE_C6)) {
@@ -4911,9 +4911,10 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
retTextId = 0x2049;
} else if (Flags_GetEventChkInf(EVENTCHKINF_15)) {
retTextId = 0x2048;
- } else if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
+ } else if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
retTextId = 0x2047;
- } else if (Flags_GetEventChkInf(EVENTCHKINF_12) && !Flags_GetEventChkInf(EVENTCHKINF_14)) {
+ } else if (Flags_GetEventChkInf(EVENTCHKINF_12) &&
+ !Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
retTextId = 0x2044;
} else if (Flags_GetEventChkInf(EVENTCHKINF_10)) {
if (Flags_GetEventChkInf(EVENTCHKINF_11)) {
@@ -4927,7 +4928,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
break;
case 72:
if (!LINK_IS_ADULT) {
- if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
+ if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
retTextId = 0x2040;
} else if (Flags_GetInfTable(INFTABLE_94)) {
retTextId = 0x2040;
@@ -4935,7 +4936,7 @@ u32 func_80035BFC(PlayState* play, s16 arg1) {
retTextId = 0x203F;
}
} else {
- if (!Flags_GetEventChkInf(EVENTCHKINF_18)) {
+ if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) {
if (!IS_DAY) {
retTextId = 0x204E;
} else if (Flags_GetInfTable(INFTABLE_9A)) {
diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c
index 2ded6b8f79..a30500efd1 100644
--- a/src/code/z_bgcheck.c
+++ b/src/code/z_bgcheck.c
@@ -4239,22 +4239,21 @@ s32 WaterBox_GetSurface1(PlayState* play, CollisionContext* colCtx, f32 x, f32 z
s32 WaterBox_GetSurfaceImpl(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface,
WaterBox** outWaterBox) {
CollisionHeader* colHeader = colCtx->colHeader;
- u32 room;
- WaterBox* curWaterBox;
+ s32 room;
+ WaterBox* waterBox;
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
return false;
}
- for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
- curWaterBox++) {
- room = WATERBOX_ROOM(curWaterBox->properties);
- if (room == (u32)play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
- if (!(curWaterBox->properties & WATERBOX_FLAG_19)) {
- if (curWaterBox->xMin < x && x < curWaterBox->xMin + curWaterBox->xLength) {
- if (curWaterBox->zMin < z && z < curWaterBox->zMin + curWaterBox->zLength) {
- *outWaterBox = curWaterBox;
- *ySurface = curWaterBox->ySurface;
+ for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) {
+ room = WATERBOX_ROOM(waterBox->properties);
+ if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
+ if (!(waterBox->properties & WATERBOX_FLAG_19)) {
+ if (waterBox->xMin < x && x < waterBox->xMin + waterBox->xLength) {
+ if (waterBox->zMin < z && z < waterBox->zMin + waterBox->zLength) {
+ *outWaterBox = waterBox;
+ *ySurface = waterBox->ySurface;
return true;
}
}
@@ -4287,21 +4286,18 @@ s32 WaterBox_GetSurface2(PlayState* play, CollisionContext* colCtx, Vec3f* pos,
waterBox = &colHeader->waterBoxes[i];
room = WATERBOX_ROOM(waterBox->properties);
- if (!(room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL)) {
- continue;
- }
- if (waterBox->properties & WATERBOX_FLAG_19) {
- continue;
- }
- if (!(waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength)) {
- continue;
- }
- if (!(waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength)) {
- continue;
- }
- if (pos->y - surfaceChkDist < waterBox->ySurface && waterBox->ySurface < pos->y + surfaceChkDist) {
- *outWaterBox = waterBox;
- return i;
+ if (room == play->roomCtx.curRoom.num || room == WATERBOX_ROOM_ALL) {
+ if (!(waterBox->properties & WATERBOX_FLAG_19)) {
+ if (waterBox->xMin < pos->x && pos->x < waterBox->xMin + waterBox->xLength) {
+ if (waterBox->zMin < pos->z && pos->z < waterBox->zMin + waterBox->zLength) {
+ if (pos->y - surfaceChkDist < waterBox->ySurface &&
+ waterBox->ySurface < pos->y + surfaceChkDist) {
+ *outWaterBox = waterBox;
+ return i;
+ }
+ }
+ }
+ }
}
}
@@ -4349,22 +4345,21 @@ u32 WaterBox_GetLightIndex(CollisionContext* colCtx, WaterBox* waterBox) {
*/
s32 func_800425B0(PlayState* play, CollisionContext* colCtx, f32 x, f32 z, f32* ySurface, WaterBox** outWaterBox) {
CollisionHeader* colHeader = colCtx->colHeader;
- u32 room;
- WaterBox* curWaterBox;
+ s32 room;
+ WaterBox* waterBox;
if (colHeader->numWaterBoxes == 0 || colHeader->waterBoxes == SEGMENTED_TO_VIRTUAL(NULL)) {
return false;
}
- for (curWaterBox = colHeader->waterBoxes; curWaterBox < colHeader->waterBoxes + colHeader->numWaterBoxes;
- curWaterBox++) {
- room = WATERBOX_ROOM(curWaterBox->properties);
- if ((room == (u32)play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) {
- if (curWaterBox->properties & WATERBOX_FLAG_19) {
- if (curWaterBox->xMin < x && x < (curWaterBox->xMin + curWaterBox->xLength)) {
- if (curWaterBox->zMin < z && z < (curWaterBox->zMin + curWaterBox->zLength)) {
- *outWaterBox = curWaterBox;
- *ySurface = curWaterBox->ySurface;
+ for (waterBox = colHeader->waterBoxes; waterBox < colHeader->waterBoxes + colHeader->numWaterBoxes; waterBox++) {
+ room = WATERBOX_ROOM(waterBox->properties);
+ if ((room == play->roomCtx.curRoom.num) || (room == WATERBOX_ROOM_ALL)) {
+ if (waterBox->properties & WATERBOX_FLAG_19) {
+ if (waterBox->xMin < x && x < (waterBox->xMin + waterBox->xLength)) {
+ if (waterBox->zMin < z && z < (waterBox->zMin + waterBox->zLength)) {
+ *outWaterBox = waterBox;
+ *ySurface = waterBox->ySurface;
return true;
}
}
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index c9477d147b..8baf648b0b 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -1,5 +1,6 @@
#include "ultra64.h"
#include "global.h"
+#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Horse/z_en_horse.h"
@@ -182,16 +183,18 @@ Vec3f* Camera_Vec3sToVec3f(Vec3f* dest, Vec3s* src) {
return dest;
}
-Vec3f* Camera_Vec3fVecSphGeoAdd(Vec3f* dest, Vec3f* a, VecSph* b) {
- Vec3f copy;
- Vec3f vecB;
- OLib_VecSphGeoToVec3f(&vecB, b);
+Vec3f* Camera_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) {
+ Vec3f sum;
+ Vec3f b;
- copy.x = a->x + vecB.x;
- copy.y = a->y + vecB.y;
- copy.z = a->z + vecB.z;
+ OLib_VecGeoToVec3f(&b, geo);
+
+ sum.x = a->x + b.x;
+ sum.y = a->y + b.y;
+ sum.z = a->z + b.z;
+
+ *dest = sum;
- *dest = copy;
return dest;
}
@@ -217,11 +220,11 @@ s32 Camera_BGCheckInfo(Camera* camera, Vec3f* from, CamColChk* to) {
f32 floorPolyY;
CollisionPoly* floorPoly;
s32 floorBgId;
- VecSph fromToOffset;
+ VecGeo fromToOffset;
- OLib_Vec3fDiffToVecSphGeo(&fromToOffset, from, &to->pos);
+ OLib_Vec3fDiffToVecGeo(&fromToOffset, from, &to->pos);
fromToOffset.r += 8.0f;
- Camera_Vec3fVecSphGeoAdd(&toPoint, from, &fromToOffset);
+ Camera_AddVecGeoToVec3f(&toPoint, from, &fromToOffset);
if (!BgCheck_CameraLineTest1(colCtx, from, &toPoint, &toNewPos, &to->poly, 1, 1, 1, -1, &to->bgId)) {
// no poly in path.
@@ -281,11 +284,11 @@ s32 func_80043F94(Camera* camera, Vec3f* from, CamColChk* to) {
f32 floorY;
CollisionPoly* floorPoly;
s32 bgId;
- VecSph fromToGeo;
+ VecGeo fromToGeo;
- OLib_Vec3fDiffToVecSphGeo(&fromToGeo, from, &to->pos);
+ OLib_Vec3fDiffToVecGeo(&fromToGeo, from, &to->pos);
fromToGeo.r += 8.0f;
- Camera_Vec3fVecSphGeoAdd(&toPos, from, &fromToGeo);
+ Camera_AddVecGeoToVec3f(&toPos, from, &fromToGeo);
if (!BgCheck_CameraLineTest1(colCtx, from, &toPos, &toNewPos, &to->poly, 1, 1, 1, -1, &to->bgId)) {
OLib_Vec3fDistNormalize(&fromToNorm, from, &to->pos);
to->norm.x = -fromToNorm.x;
@@ -821,7 +824,7 @@ Vec3f* Camera_BGCheckCorner(Vec3f* dst, Vec3f* linePointA, Vec3f* linePointB, Ca
* 3 ?
* 6 if the angle between the polys is greater than 120 degrees
*/
-s32 func_80045508(Camera* camera, VecSph* diffSph, CamColChk* eyeChk, CamColChk* atChk, s16 checkEye) {
+s32 func_80045508(Camera* camera, VecGeo* diffGeo, CamColChk* eyeChk, CamColChk* atChk, s16 checkEye) {
Vec3f* at = &camera->at;
Vec3f* eye = &camera->eye;
Vec3f* eyeNext = &camera->eyeNext;
@@ -840,10 +843,10 @@ s32 func_80045508(Camera* camera, VecSph* diffSph, CamColChk* eyeChk, CamColChk*
// collision found between at->eye
atChk->pos = camera->at;
- OLib_Vec3fToVecSphGeo(&eyeChk->sphNorm, &eyeChk->norm);
+ OLib_Vec3fToVecGeo(&eyeChk->geoNorm, &eyeChk->norm);
- if (eyeChk->sphNorm.pitch >= 0x2EE1) {
- eyeChk->sphNorm.yaw = diffSph->yaw;
+ if (eyeChk->geoNorm.pitch >= 0x2EE1) {
+ eyeChk->geoNorm.yaw = diffGeo->yaw;
}
eyeAtBgId = Camera_BGCheckInfo(camera, eyeNext, atChk);
@@ -870,10 +873,10 @@ s32 func_80045508(Camera* camera, VecSph* diffSph, CamColChk* eyeChk, CamColChk*
return 3;
}
- OLib_Vec3fToVecSphGeo(&atChk->sphNorm, &atChk->norm);
+ OLib_Vec3fToVecGeo(&atChk->geoNorm, &atChk->norm);
- if (atChk->sphNorm.pitch >= 0x2EE1) {
- atChk->sphNorm.yaw = diffSph->yaw - 0x7FFF;
+ if (atChk->geoNorm.pitch >= 0x2EE1) {
+ atChk->geoNorm.yaw = diffGeo->yaw - 0x7FFF;
}
if (atEyeBgId != eyeAtBgId) {
@@ -898,18 +901,18 @@ s32 func_80045508(Camera* camera, VecSph* diffSph, CamColChk* eyeChk, CamColChk*
*/
f32 Camera_CalcSlopeYAdj(Vec3f* floorNorm, s16 playerYRot, s16 eyeAtYaw, f32 adjAmt) {
f32 tmp;
- VecSph floorNormSph;
+ VecGeo floorNormGeo;
- OLib_Vec3fToVecSphGeo(&floorNormSph, floorNorm);
+ OLib_Vec3fToVecGeo(&floorNormGeo, floorNorm);
- tmp = Math_CosS(floorNormSph.pitch) * Math_CosS(playerYRot - floorNormSph.yaw);
+ tmp = Math_CosS(floorNormGeo.pitch) * Math_CosS(playerYRot - floorNormGeo.yaw);
return (fabsf(tmp) * adjAmt) * Math_CosS(playerYRot - eyeAtYaw);
}
/**
* Calculates new at vector for the camera pointing in `eyeAtDir`
*/
-s32 Camera_CalcAtDefault(Camera* camera, VecSph* eyeAtDir, f32 extraYOffset, s16 calcSlope) {
+s32 Camera_CalcAtDefault(Camera* camera, VecGeo* eyeAtDir, f32 extraYOffset, s16 calcSlope) {
Vec3f* at = &camera->at;
Vec3f posOffsetTarget;
Vec3f atTarget;
@@ -940,7 +943,7 @@ s32 Camera_CalcAtDefault(Camera* camera, VecSph* eyeAtDir, f32 extraYOffset, s16
return true;
}
-s32 func_800458D4(Camera* camera, VecSph* eyeAtDir, f32 arg2, f32* arg3, s16 arg4) {
+s32 func_800458D4(Camera* camera, VecGeo* eyeAtDir, f32 arg2, f32* arg3, s16 arg4) {
f32 phi_f2;
Vec3f posOffsetTarget;
Vec3f atTarget;
@@ -982,7 +985,7 @@ s32 func_800458D4(Camera* camera, VecSph* eyeAtDir, f32 arg2, f32* arg3, s16 arg
return 1;
}
-s32 func_80045B08(Camera* camera, VecSph* eyeAtDir, f32 yExtra, s16 arg3) {
+s32 func_80045B08(Camera* camera, VecGeo* eyeAtDir, f32 yExtra, s16 arg3) {
f32 phi_f2;
Vec3f posOffsetTarget;
Vec3f atTarget;
@@ -1017,7 +1020,7 @@ s32 func_80045B08(Camera* camera, VecSph* eyeAtDir, f32 yExtra, s16 arg3) {
/**
* Adjusts the camera's at position for Camera_Parallel1
*/
-s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 yOffset, f32* arg3, s16 arg4) {
+s32 Camera_CalcAtForParallel(Camera* camera, VecGeo* arg1, f32 yOffset, f32* arg3, s16 arg4) {
Vec3f* at = &camera->at;
Vec3f posOffsetTarget;
Vec3f atTarget;
@@ -1087,14 +1090,14 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 yOffset, f32* arg
/**
* Adjusts at position for Camera_Battle1 and Camera_KeepOn1
*/
-s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f32 yOffset, f32 distance,
- f32* yPosOffset, VecSph* outPlayerToTargetDir, s16 flags) {
+s32 Camera_CalcAtForLockOn(Camera* camera, VecGeo* eyeAtDir, Vec3f* targetPos, f32 yOffset, f32 distance,
+ f32* yPosOffset, VecGeo* outPlayerToTargetDir, s16 flags) {
Vec3f* at = &camera->at;
Vec3f tmpPos0;
Vec3f tmpPos1;
Vec3f lookFromOffset;
Vec3f* floorNorm = &camera->floorNorm;
- VecSph playerToTargetDir;
+ VecGeo playerToTargetDir;
PosRot* playerPosRot = &camera->playerPosRot;
f32 yPosDelta;
f32 phi_f16;
@@ -1113,7 +1116,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f
// tmpPos1 is player's head
tmpPos1 = playerPosRot->pos;
tmpPos1.y += playerHeight;
- OLib_Vec3fDiffToVecSphGeo(outPlayerToTargetDir, &tmpPos1, targetPos);
+ OLib_Vec3fDiffToVecGeo(outPlayerToTargetDir, &tmpPos1, targetPos);
playerToTargetDir = *outPlayerToTargetDir;
if (distance < playerToTargetDir.r) {
playerToTargetDir.r = playerToTargetDir.r * CAM_DATA_SCALED(OREG(38));
@@ -1131,7 +1134,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f
camera->xzOffsetUpdateRate = camera->yOffsetUpdateRate = .01f;
}
- OLib_VecSphGeoToVec3f(&lookFromOffset, &playerToTargetDir);
+ OLib_VecGeoToVec3f(&lookFromOffset, &playerToTargetDir);
if (PREG(89)) {
osSyncPrintf("%f (%f %f %f) %f\n", playerToTargetDir.r / distance, lookFromOffset.x, lookFromOffset.y,
@@ -1189,7 +1192,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f
return 1;
}
-s32 Camera_CalcAtForHorse(Camera* camera, VecSph* eyeAtDir, f32 yOffset, f32* yPosOffset, s16 calcSlope) {
+s32 Camera_CalcAtForHorse(Camera* camera, VecGeo* eyeAtDir, f32 yOffset, f32* yPosOffset, s16 calcSlope) {
Vec3f* at = &camera->at;
Vec3f posOffsetTarget;
Vec3f atTarget;
@@ -1325,7 +1328,7 @@ s16 Camera_CalcDefaultYaw(Camera* camera, s16 cur, s16 target, f32 arg3, f32 acc
return cur + (s16)(angDelta * velocity * velFactor * yawUpdRate);
}
-void func_80046E20(Camera* camera, VecSph* eyeAdjustment, f32 minDist, f32 arg3, f32* arg4, SwingAnimation* anim) {
+void func_80046E20(Camera* camera, VecGeo* eyeAdjustment, f32 minDist, f32 arg3, f32* arg4, SwingAnimation* anim) {
static CamColChk atEyeColChk;
static CamColChk eyeAtColChk;
static CamColChk newEyeColChk;
@@ -1335,8 +1338,8 @@ void func_80046E20(Camera* camera, VecSph* eyeAdjustment, f32 minDist, f32 arg3,
Vec3f peekAroundPoint;
Vec3f* eyeNext = &camera->eyeNext;
f32 temp_f0;
- VecSph newEyeAdjustment;
- VecSph sp40;
+ VecGeo newEyeAdjustment;
+ VecGeo sp40;
temp_v0 = func_80045508(camera, eyeAdjustment, &atEyeColChk, &eyeAtColChk, !anim->unk_18);
@@ -1355,17 +1358,17 @@ void func_80046E20(Camera* camera, VecSph* eyeAdjustment, f32 minDist, f32 arg3,
anim->swingUpdateRate = CAM_DATA_SCALED(OREG(10));
anim->unk_18 = 1;
anim->atEyePoly = eyeAtColChk.poly;
- OLib_Vec3fDiffToVecSphGeo(&newEyeAdjustment, at, &peekAroundPoint);
+ OLib_Vec3fDiffToVecGeo(&newEyeAdjustment, at, &peekAroundPoint);
newEyeAdjustment.r = eyeAdjustment->r;
- Camera_Vec3fVecSphGeoAdd(eye, at, &newEyeAdjustment);
+ Camera_AddVecGeoToVec3f(eye, at, &newEyeAdjustment);
newEyeColChk.pos = *eye;
if (Camera_BGCheckInfo(camera, at, &newEyeColChk) == 0) {
// no collision found between at->newEyePos
newEyeAdjustment.yaw += (s16)(eyeAdjustment->yaw - newEyeAdjustment.yaw) >> 1;
newEyeAdjustment.pitch += (s16)(eyeAdjustment->pitch - newEyeAdjustment.pitch) >> 1;
- Camera_Vec3fVecSphGeoAdd(eye, at, &newEyeAdjustment);
- if (atEyeColChk.sphNorm.pitch < 0x2AA8) {
+ Camera_AddVecGeoToVec3f(eye, at, &newEyeAdjustment);
+ if (atEyeColChk.geoNorm.pitch < 0x2AA8) {
// ~ 60 degrees
anim->unk_16 = newEyeAdjustment.yaw;
anim->unk_14 = newEyeAdjustment.pitch;
@@ -1376,9 +1379,9 @@ void func_80046E20(Camera* camera, VecSph* eyeAdjustment, f32 minDist, f32 arg3,
peekAroundPoint.x = anim->collisionClosePoint.x - (atEyeColChk.norm.x + eyeAtColChk.norm.x);
peekAroundPoint.y = anim->collisionClosePoint.y - (atEyeColChk.norm.y + eyeAtColChk.norm.y);
peekAroundPoint.z = anim->collisionClosePoint.z - (atEyeColChk.norm.z + eyeAtColChk.norm.z);
- OLib_Vec3fDiffToVecSphGeo(&newEyeAdjustment, at, &peekAroundPoint);
+ OLib_Vec3fDiffToVecGeo(&newEyeAdjustment, at, &peekAroundPoint);
newEyeAdjustment.r = eyeAdjustment->r;
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &newEyeAdjustment);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &newEyeAdjustment);
break;
}
@@ -1402,9 +1405,9 @@ void func_80046E20(Camera* camera, VecSph* eyeAdjustment, f32 minDist, f32 arg3,
anim->atEyePoly = NULL;
if (temp_f0 < OREG(21)) {
sp40.yaw = eyeAdjustment->yaw;
- sp40.pitch = Math_SinS(atEyeColChk.sphNorm.pitch + 0x3FFF) * 16380.0f;
+ sp40.pitch = Math_SinS(atEyeColChk.geoNorm.pitch + 0x3FFF) * 16380.0f;
sp40.r = (OREG(21) - temp_f0) * CAM_DATA_SCALED(OREG(22));
- Camera_Vec3fVecSphGeoAdd(eye, eye, &sp40);
+ Camera_AddVecGeoToVec3f(eye, eye, &sp40);
}
break;
default:
@@ -1437,9 +1440,9 @@ s32 Camera_Normal1(Camera* camera) {
Vec3f sp88;
s16 wiggleAdj;
s16 t;
- VecSph eyeAdjustment;
- VecSph atEyeGeo;
- VecSph atEyeNextGeo;
+ VecGeo eyeAdjustment;
+ VecGeo atEyeGeo;
+ VecGeo atEyeNextGeo;
PosRot* playerPosRot = &camera->playerPosRot;
Normal1ReadOnlyData* roData = &camera->paramData.norm1.roData;
Normal1ReadWriteData* rwData = &camera->paramData.norm1.rwData;
@@ -1472,8 +1475,8 @@ s32 Camera_Normal1(Camera* camera) {
sCameraInterfaceFlags = roData->interfaceFlags;
- OLib_Vec3fDiffToVecSphGeo(&atEyeGeo, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&atEyeNextGeo, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&atEyeGeo, at, eye);
+ OLib_Vec3fDiffToVecGeo(&atEyeNextGeo, at, eyeNext);
switch (camera->animState) {
case 20:
@@ -1577,7 +1580,7 @@ s32 Camera_Normal1(Camera* camera) {
Camera_CalcAtDefault(camera, &atEyeNextGeo, spA0, roData->interfaceFlags & 1);
}
- OLib_Vec3fDiffToVecSphGeo(&eyeAdjustment, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeAdjustment, at, eyeNext);
camera->dist = eyeAdjustment.r =
Camera_ClampDist(camera, eyeAdjustment.r, roData->distMin, roData->distMax, rwData->unk_28);
@@ -1607,7 +1610,7 @@ s32 Camera_Normal1(Camera* camera) {
eyeAdjustment.pitch = -0x3C8C;
}
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeAdjustment);
if ((camera->status == CAM_STAT_ACTIVE) && !(roData->interfaceFlags & 0x10)) {
rwData->swingYawTarget = camera->playerPosRot.rot.y - 0x7FFF;
if (rwData->startSwingTimer > 0) {
@@ -1635,7 +1638,7 @@ s32 Camera_Normal1(Camera* camera) {
camera->inputDir.y = atEyeGeo.yaw - 0x7FFF;
camera->inputDir.z = 0;
} else {
- OLib_Vec3fDiffToVecSphGeo(&eyeAdjustment, eye, at);
+ OLib_Vec3fDiffToVecGeo(&eyeAdjustment, eye, at);
camera->inputDir.x = eyeAdjustment.pitch;
camera->inputDir.y = eyeAdjustment.yaw;
camera->inputDir.z = 0;
@@ -1669,11 +1672,11 @@ s32 Camera_Normal2(Camera* camera) {
s16 phi_a1;
f32 spA4;
f32 spA0;
- VecSph adjSph;
- VecSph sp90;
- VecSph sp88;
- VecSph atToEyeDir;
- VecSph atToEyeNextDir;
+ VecGeo adjGeo;
+ VecGeo sp90;
+ VecGeo sp88;
+ VecGeo atToEyeDir;
+ VecGeo atToEyeNextDir;
PosRot* playerPosRot = &camera->playerPosRot;
Normal2ReadOnlyData* roData = &camera->paramData.norm2.roData;
Normal2ReadWriteData* rwData = &camera->paramData.norm2.rwData;
@@ -1732,7 +1735,7 @@ s32 Camera_Normal2(Camera* camera) {
sp88.pitch = rwData->unk_20;
sp88.yaw = rwData->unk_22 + 0x3FFF;
sp88.r = 100.0f;
- OLib_VecSphGeoToVec3f(&rwData->unk_0C, &sp88);
+ OLib_VecGeoToVec3f(&rwData->unk_0C, &sp88);
}
camera->animState = 1;
@@ -1745,8 +1748,8 @@ s32 Camera_Normal2(Camera* camera) {
break;
}
- OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&atToEyeDir, at, eye);
+ OLib_Vec3fDiffToVecGeo(&atToEyeNextDir, at, eyeNext);
camera->speedRatio *= 0.5f;
spA4 = CAM_DATA_SCALED(OREG(25)) * camera->speedRatio;
@@ -1774,8 +1777,8 @@ s32 Camera_Normal2(Camera* camera) {
rwData->unk_00.y = playerPosRot->pos.y;
- OLib_Vec3fDiffToVecSphGeo(&sp88, &rwData->unk_00, at);
- OLib_Vec3fDiffToVecSphGeo(&sp90, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&sp88, &rwData->unk_00, at);
+ OLib_Vec3fDiffToVecGeo(&sp90, at, eyeNext);
phi_a1 = (rwData->unk_28 & 2 ? rwData->unk_22 : roData->unk_1C);
phi_a0 = sp90.yaw - sp88.yaw;
@@ -1783,30 +1786,30 @@ s32 Camera_Normal2(Camera* camera) {
phi_a0 = (phi_a0 < 0 ? -phi_a1 : phi_a1);
phi_a0 += sp88.yaw;
- adjSph.yaw =
+ adjGeo.yaw =
Camera_LERPCeilS(phi_a0, atToEyeDir.yaw, (1.0f / camera->yawUpdateRateInv) * camera->speedRatio, 0xA);
if (rwData->unk_28 & 1) {
- adjSph.pitch = Camera_CalcDefaultPitch(camera, atToEyeNextDir.pitch, rwData->unk_20, 0);
+ adjGeo.pitch = Camera_CalcDefaultPitch(camera, atToEyeNextDir.pitch, rwData->unk_20, 0);
} else {
- adjSph.pitch = atToEyeDir.pitch;
+ adjGeo.pitch = atToEyeDir.pitch;
}
} else {
- adjSph = sp90;
+ adjGeo = sp90;
}
- camera->dist = adjSph.r = Camera_ClampDist(camera, sp90.r, roData->unk_04, roData->unk_08, 0);
+ camera->dist = adjGeo.r = Camera_ClampDist(camera, sp90.r, roData->unk_04, roData->unk_08, 0);
if (!(rwData->unk_28 & 1)) {
- if (adjSph.pitch >= 0xE39) {
- adjSph.pitch += ((s16)(0xE38 - adjSph.pitch) >> 2);
+ if (adjGeo.pitch >= 0xE39) {
+ adjGeo.pitch += ((s16)(0xE38 - adjGeo.pitch) >> 2);
}
- if (adjSph.pitch < 0) {
- adjSph.pitch += ((s16)(-0x38E - adjSph.pitch) >> 2);
+ if (adjGeo.pitch < 0) {
+ adjGeo.pitch += ((s16)(-0x38E - adjGeo.pitch) >> 2);
}
}
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &adjSph);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &adjGeo);
if (camera->status == CAM_STAT_ACTIVE) {
bgChk.pos = *eyeNext;
@@ -1816,9 +1819,9 @@ s32 Camera_Normal2(Camera* camera) {
} else {
func_80043F94(camera, at, &bgChk);
*eye = bgChk.pos;
- OLib_Vec3fDiffToVecSphGeo(&adjSph, eye, at);
- camera->inputDir.x = adjSph.pitch;
- camera->inputDir.y = adjSph.yaw;
+ OLib_Vec3fDiffToVecGeo(&adjGeo, eye, at);
+ camera->inputDir.x = adjGeo.pitch;
+ camera->inputDir.y = adjGeo.yaw;
camera->inputDir.z = 0;
}
}
@@ -1838,9 +1841,9 @@ s32 Camera_Normal3(Camera* camera) {
f32 sp94;
f32 sp90;
f32 sp8C;
- VecSph sp84;
- VecSph sp7C;
- VecSph sp74;
+ VecGeo sp84;
+ VecGeo sp7C;
+ VecGeo sp74;
PosRot* playerPosRot = &camera->playerPosRot;
f32 temp_f0;
f32 temp_f6;
@@ -1869,8 +1872,8 @@ s32 Camera_Normal3(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&sp7C, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&sp74, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&sp7C, at, eye);
+ OLib_Vec3fDiffToVecGeo(&sp74, at, eyeNext);
sUpdateCameraDirection = true;
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -1925,7 +1928,7 @@ s32 Camera_Normal3(Camera* camera) {
Camera_CalcAtForHorse(camera, &sp74, roData->yOffset, &rwData->unk_20, 1);
sp90 = (roData->distMax + roData->distMin) * 0.5f;
- OLib_Vec3fDiffToVecSphGeo(&sp84, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&sp84, at, eyeNext);
camera->dist = sp84.r = Camera_ClampDist(camera, sp84.r, roData->distMin, roData->distMax, rwData->distTimer);
if (camera->xzSpeed > 0.001f) {
sp84.r += (sp90 - sp84.r) * 0.002f;
@@ -1963,7 +1966,7 @@ s32 Camera_Normal3(Camera* camera) {
rwData->yawTimer--;
}
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &sp84);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &sp84);
if (camera->status == CAM_STAT_ACTIVE) {
func_80046E20(camera, &sp84, roData->distMin, roData->yawUpdateSpeed, &sp8C, &rwData->swing);
@@ -1992,9 +1995,9 @@ s32 Camera_Parallel1(Camera* camera) {
f32 spB8;
f32 spB4;
s16 tangle;
- VecSph spA8;
- VecSph atToEyeDir;
- VecSph atToEyeNextDir;
+ VecGeo spA8;
+ VecGeo atToEyeDir;
+ VecGeo atToEyeNextDir;
PosRot* playerPosRot = &camera->playerPosRot;
CamColChk sp6C;
s16 sp6A;
@@ -2028,8 +2031,8 @@ s32 Camera_Parallel1(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&atToEyeDir, at, eye);
+ OLib_Vec3fDiffToVecGeo(&atToEyeNextDir, at, eyeNext);
switch (camera->animState) {
case 0:
@@ -2122,7 +2125,7 @@ s32 Camera_Parallel1(Camera* camera) {
} else {
rwData->unk_16 = 0;
camera->dist = Camera_LERPCeilF(roData->distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, 2.0f);
- OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&spA8, at, eyeNext);
spA8.r = camera->dist;
if (roData->interfaceFlags & 0x40) {
@@ -2147,7 +2150,7 @@ s32 Camera_Parallel1(Camera* camera) {
spA8.pitch = R_CAM_MIN_PITCH_1;
}
}
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spA8);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &spA8);
if (camera->status == CAM_STAT_ACTIVE) {
sp6C.pos = *eyeNext;
if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 0x10) {
@@ -2156,7 +2159,7 @@ s32 Camera_Parallel1(Camera* camera) {
} else {
func_80043F94(camera, at, &sp6C);
*eye = sp6C.pos;
- OLib_Vec3fDiffToVecSphGeo(&spA8, eye, at);
+ OLib_Vec3fDiffToVecGeo(&spA8, eye, at);
camera->inputDir.x = spA8.pitch;
camera->inputDir.y = spA8.yaw;
camera->inputDir.z = 0;
@@ -2205,10 +2208,10 @@ s32 Camera_Jump1(Camera* camera) {
s32 pad2;
f32 spA4;
Vec3f newEye;
- VecSph eyeAtOffset;
- VecSph eyeNextAtOffset;
- VecSph eyeDiffSph;
- VecSph eyeDiffTarget;
+ VecGeo eyeAtOffset;
+ VecGeo eyeNextAtOffset;
+ VecGeo eyeDiffGeo;
+ VecGeo eyeDiffTarget;
PosRot* playerPosRot = &camera->playerPosRot;
PosRot playerhead;
s16 tangle;
@@ -2240,20 +2243,20 @@ s32 Camera_Jump1(Camera* camera) {
// playerhead never gets used.
Actor_GetFocus(&playerhead, &camera->player->actor);
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, at, eye);
+ OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
sCameraInterfaceFlags = roData->interfaceFlags;
if (RELOAD_PARAMS(camera)) {
rwData->swing.unk_16 = rwData->swing.unk_18 = 0;
rwData->swing.atEyePoly = NULL;
- rwData->unk_20.pitch = 0;
- rwData->unk_20.yaw = 0xC8;
+ rwData->unk_24 = 0;
+ rwData->unk_26 = 200;
rwData->swing.swingUpdateRateTimer = 0;
rwData->swing.swingUpdateRate = roData->yawUpateRateTarget;
rwData->unk_1C = playerPosRot->pos.y - camera->playerPosDelta.y;
- rwData->unk_20.r = eyeAtOffset.r;
+ rwData->unk_20 = eyeAtOffset.r;
camera->posOffset.y -= camera->playerPosDelta.y;
camera->xzOffsetUpdateRate = (1.0f / 10000.0f);
camera->animState++;
@@ -2281,51 +2284,51 @@ s32 Camera_Jump1(Camera* camera) {
func_800458D4(camera, &eyeNextAtOffset, roData->atYOffset, &rwData->unk_1C, 0);
- eyeDiffSph = eyeAtOffset;
+ eyeDiffGeo = eyeAtOffset;
- OLib_Vec3fDiffToVecSphGeo(&eyeDiffTarget, at, eye);
+ OLib_Vec3fDiffToVecGeo(&eyeDiffTarget, at, eye);
- eyeDiffSph.r = Camera_LERPCeilF(eyeDiffTarget.r, eyeAtOffset.r, CAM_DATA_SCALED(OREG(29)), 1.0f);
- eyeDiffSph.pitch = Camera_LERPCeilS(eyeDiffTarget.pitch, eyeAtOffset.pitch, CAM_DATA_SCALED(OREG(29)), 0xA);
+ eyeDiffGeo.r = Camera_LERPCeilF(eyeDiffTarget.r, eyeAtOffset.r, CAM_DATA_SCALED(OREG(29)), 1.0f);
+ eyeDiffGeo.pitch = Camera_LERPCeilS(eyeDiffTarget.pitch, eyeAtOffset.pitch, CAM_DATA_SCALED(OREG(29)), 0xA);
if (rwData->swing.unk_18) {
- eyeDiffSph.yaw =
+ eyeDiffGeo.yaw =
Camera_LERPCeilS(rwData->swing.unk_16, eyeNextAtOffset.yaw, 1.0f / camera->yawUpdateRateInv, 0xA);
- eyeDiffSph.pitch =
+ eyeDiffGeo.pitch =
Camera_LERPCeilS(rwData->swing.unk_14, eyeNextAtOffset.pitch, 1.0f / camera->yawUpdateRateInv, 0xA);
} else {
- eyeDiffSph.yaw =
+ eyeDiffGeo.yaw =
Camera_CalcDefaultYaw(camera, eyeNextAtOffset.yaw, camera->playerPosRot.rot.y, roData->maxYawUpdate, 0.0f);
}
- // Clamp the eye->at distance to roData->distMin < eyeDiffSph.r < roData->distMax
- if (eyeDiffSph.r < roData->distMin) {
- eyeDiffSph.r = roData->distMin;
- } else if (eyeDiffSph.r > roData->distMax) {
- eyeDiffSph.r = roData->distMax;
+ // Clamp the eye->at distance to roData->distMin < eyeDiffGeo.r < roData->distMax
+ if (eyeDiffGeo.r < roData->distMin) {
+ eyeDiffGeo.r = roData->distMin;
+ } else if (eyeDiffGeo.r > roData->distMax) {
+ eyeDiffGeo.r = roData->distMax;
}
// Clamp the phi rotation at R_CAM_MAX_PITCH AND R_CAM_MIN_PITCH_2
- if (eyeDiffSph.pitch > R_CAM_MAX_PITCH) {
- eyeDiffSph.pitch = R_CAM_MAX_PITCH;
- } else if (eyeDiffSph.pitch < R_CAM_MIN_PITCH_2) {
- eyeDiffSph.pitch = R_CAM_MIN_PITCH_2;
+ if (eyeDiffGeo.pitch > R_CAM_MAX_PITCH) {
+ eyeDiffGeo.pitch = R_CAM_MAX_PITCH;
+ } else if (eyeDiffGeo.pitch < R_CAM_MIN_PITCH_2) {
+ eyeDiffGeo.pitch = R_CAM_MIN_PITCH_2;
}
- Camera_Vec3fVecSphGeoAdd(&newEye, at, &eyeDiffSph);
+ Camera_AddVecGeoToVec3f(&newEye, at, &eyeDiffGeo);
eyeNext->x = newEye.x;
eyeNext->z = newEye.z;
eyeNext->y += (newEye.y - eyeNext->y) * CAM_DATA_SCALED(OREG(31));
if ((camera->status == CAM_STAT_ACTIVE) && !(roData->interfaceFlags & 0x10)) {
- func_80046E20(camera, &eyeDiffSph, roData->distMin, roData->yawUpateRateTarget, &spA4, &rwData->swing);
+ func_80046E20(camera, &eyeDiffGeo, roData->distMin, roData->yawUpateRateTarget, &spA4, &rwData->swing);
if (roData->interfaceFlags & 4) {
camera->inputDir.x = -eyeAtOffset.pitch;
camera->inputDir.y = eyeAtOffset.yaw - 0x7FFF;
camera->inputDir.z = 0;
} else {
- OLib_Vec3fDiffToVecSphGeo(&eyeDiffSph, eye, at);
- camera->inputDir.x = eyeDiffSph.pitch;
- camera->inputDir.y = eyeDiffSph.yaw;
+ OLib_Vec3fDiffToVecGeo(&eyeDiffGeo, eye, at);
+ camera->inputDir.x = eyeDiffGeo.pitch;
+ camera->inputDir.y = eyeDiffGeo.yaw;
camera->inputDir.z = 0;
}
if (rwData->swing.unk_18) {
@@ -2353,10 +2356,10 @@ s32 Camera_Jump2(Camera* camera) {
Vec3f* eyeNext = &camera->eyeNext;
Vec3f bgChkPos;
Vec3f floorNorm;
- VecSph adjAtToEyeDir;
- VecSph bgChkPara;
- VecSph atToEyeNextDir;
- VecSph atToEyeDir;
+ VecGeo adjAtToEyeDir;
+ VecGeo bgChkPara;
+ VecGeo atToEyeNextDir;
+ VecGeo atToEyeDir;
f32 temp_f14;
f32 temp_f16;
f32 sp90;
@@ -2395,8 +2398,8 @@ s32 Camera_Jump2(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&atToEyeDir, at, eye);
+ OLib_Vec3fDiffToVecGeo(&atToEyeNextDir, at, eyeNext);
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -2443,7 +2446,7 @@ s32 Camera_Jump2(Camera* camera) {
camera->rUpdateRateInv = OREG(27);
Camera_CalcAtDefault(camera, &atToEyeNextDir, roData->atYOffset, 0);
- OLib_Vec3fDiffToVecSphGeo(&adjAtToEyeDir, at, eye);
+ OLib_Vec3fDiffToVecGeo(&adjAtToEyeDir, at, eye);
temp_f16 = roData->minDist;
sp90 = roData->maxDist + (roData->maxDist * roData->minMaxDistFactor);
@@ -2501,7 +2504,7 @@ s32 Camera_Jump2(Camera* camera) {
adjAtToEyeDir.pitch = -0x2AF8;
}
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &adjAtToEyeDir);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &adjAtToEyeDir);
camBgChk.pos = *eyeNext;
if (Camera_BGCheckInfo(camera, at, &camBgChk)) {
// Collision detected between at->eyeNext, Check if collision between
@@ -2510,7 +2513,7 @@ s32 Camera_Jump2(Camera* camera) {
bgChkPara.r = adjAtToEyeDir.r;
bgChkPara.pitch = 0;
bgChkPara.yaw = adjAtToEyeDir.yaw;
- Camera_Vec3fVecSphGeoAdd(&camBgChk.pos, at, &bgChkPara);
+ Camera_AddVecGeoToVec3f(&camBgChk.pos, at, &bgChkPara);
if (Camera_BGCheckInfo(camera, at, &camBgChk)) {
// Collision found between parallel at->eyeNext, set eye position to
// first collsion point.
@@ -2518,7 +2521,7 @@ s32 Camera_Jump2(Camera* camera) {
} else {
// no collision found with the parallel at->eye, animate to be parallel
adjAtToEyeDir.pitch = Camera_LERPCeilS(0, adjAtToEyeDir.pitch, 0.2f, 0xA);
- Camera_Vec3fVecSphGeoAdd(eye, at, &adjAtToEyeDir);
+ Camera_AddVecGeoToVec3f(eye, at, &adjAtToEyeDir);
// useless?
Camera_BGCheck(camera, at, eye);
}
@@ -2543,11 +2546,11 @@ s32 Camera_Jump3(Camera* camera) {
f32 spC0;
f32 spBC;
UNUSED Vec3f spB0;
- VecSph eyeDiffSph;
+ VecGeo eyeDiffGeo;
PosRot* playerPosRot = &camera->playerPosRot;
Jump3ReadOnlyData* roData = &camera->paramData.jump3.roData;
- VecSph eyeAtOffset;
- VecSph eyeNextAtOffset;
+ VecGeo eyeAtOffset;
+ VecGeo eyeNextAtOffset;
s32 pad;
s32 pad2;
CameraModeValue* values;
@@ -2576,8 +2579,8 @@ s32 Camera_Jump3(Camera* camera) {
modeSwitch = true;
}
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, at, eye);
+ OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
if (RELOAD_PARAMS(camera) || modeSwitch || R_RELOAD_CAM_PARAMS) {
values = sCameraSettings[camera->setting].cameraModes[rwData->mode].values;
@@ -2650,10 +2653,10 @@ s32 Camera_Jump3(Camera* camera) {
Camera_LERPCeilF(CAM_DATA_SCALED(OREG(4)), camera->yOffsetUpdateRate, camera->speedRatio * 0.05f, 0.1f);
Camera_CalcAtDefault(camera, &eyeNextAtOffset, roData->yOffset, roData->interfaceFlags);
- OLib_Vec3fDiffToVecSphGeo(&eyeDiffSph, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeDiffGeo, at, eyeNext);
- camera->dist = eyeDiffSph.r =
- Camera_ClampDist(camera, eyeDiffSph.r, roData->distMin, roData->distMax, rwData->animTimer);
+ camera->dist = eyeDiffGeo.r =
+ Camera_ClampDist(camera, eyeDiffGeo.r, roData->distMin, roData->distMax, rwData->animTimer);
if (camera->playerGroundY <= playerPosRot->pos.y) {
phi_f0 = playerPosRot->pos.y - camera->playerGroundY;
@@ -2672,34 +2675,34 @@ s32 Camera_Jump3(Camera* camera) {
}
}
if (rwData->swing.unk_18 != 0) {
- eyeDiffSph.yaw =
+ eyeDiffGeo.yaw =
Camera_LERPCeilS(rwData->swing.unk_16, eyeNextAtOffset.yaw, 1.0f / camera->yawUpdateRateInv, 0xA);
- eyeDiffSph.pitch =
+ eyeDiffGeo.pitch =
Camera_LERPCeilS(rwData->swing.unk_14, eyeNextAtOffset.pitch, 1.0f / camera->yawUpdateRateInv, 0xA);
} else {
- eyeDiffSph.yaw = Camera_CalcDefaultYaw(camera, eyeNextAtOffset.yaw, playerPosRot->rot.y, roData->unk_14, 0.0f);
- eyeDiffSph.pitch = Camera_CalcDefaultPitch(camera, eyeNextAtOffset.pitch, roData->pitchTarget, 0);
+ eyeDiffGeo.yaw = Camera_CalcDefaultYaw(camera, eyeNextAtOffset.yaw, playerPosRot->rot.y, roData->unk_14, 0.0f);
+ eyeDiffGeo.pitch = Camera_CalcDefaultPitch(camera, eyeNextAtOffset.pitch, roData->pitchTarget, 0);
}
- if (eyeDiffSph.pitch > R_CAM_MAX_PITCH) {
- eyeDiffSph.pitch = R_CAM_MAX_PITCH;
+ if (eyeDiffGeo.pitch > R_CAM_MAX_PITCH) {
+ eyeDiffGeo.pitch = R_CAM_MAX_PITCH;
}
- if (eyeDiffSph.pitch < R_CAM_MIN_PITCH_1) {
- eyeDiffSph.pitch = R_CAM_MIN_PITCH_1;
+ if (eyeDiffGeo.pitch < R_CAM_MIN_PITCH_1) {
+ eyeDiffGeo.pitch = R_CAM_MIN_PITCH_1;
}
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeDiffSph);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeDiffGeo);
if ((camera->status == CAM_STAT_ACTIVE) && !(roData->interfaceFlags & 0x10)) {
- func_80046E20(camera, &eyeDiffSph, roData->distMin, roData->swingUpdateRate, &spBC, &rwData->swing);
+ func_80046E20(camera, &eyeDiffGeo, roData->distMin, roData->swingUpdateRate, &spBC, &rwData->swing);
if (roData->interfaceFlags & 4) {
camera->inputDir.x = -eyeAtOffset.pitch;
camera->inputDir.y = eyeAtOffset.yaw - 0x7FFF;
camera->inputDir.z = 0;
} else {
- OLib_Vec3fDiffToVecSphGeo(&eyeDiffSph, eye, at);
- camera->inputDir.x = eyeDiffSph.pitch;
- camera->inputDir.y = eyeDiffSph.yaw;
+ OLib_Vec3fDiffToVecGeo(&eyeDiffGeo, eye, at);
+ camera->inputDir.x = eyeDiffGeo.pitch;
+ camera->inputDir.y = eyeDiffGeo.yaw;
camera->inputDir.z = 0;
}
@@ -2747,11 +2750,11 @@ s32 Camera_Battle1(Camera* camera) {
s32 skipEyeAtCalc;
f32 distRatio;
CamColChk spBC;
- VecSph spB4;
- VecSph atToTargetDir;
- VecSph playerToTargetDir;
- VecSph atToEyeDir;
- VecSph atToEyeNextDir;
+ VecGeo spB4;
+ VecGeo atToTargetDir;
+ VecGeo playerToTargetDir;
+ VecGeo atToEyeDir;
+ VecGeo atToEyeNextDir;
PosRot* playerPosRot = &camera->playerPosRot;
s16 tmpAng1;
s16 tmpAng2;
@@ -2832,8 +2835,8 @@ s32 Camera_Battle1(Camera* camera) {
camera->fovUpdateRate =
Camera_LERPCeilF(CAM_DATA_SCALED(OREG(4)), camera->fovUpdateRate, camera->speedRatio * 0.05f, 0.1f);
playerHeight += roData->yOffset;
- OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&atToEyeDir, at, eye);
+ OLib_Vec3fDiffToVecGeo(&atToEyeNextDir, at, eyeNext);
if (camera->target == NULL || camera->target->update == NULL) {
if (camera->target == NULL) {
osSyncPrintf(
@@ -2899,10 +2902,10 @@ s32 Camera_Battle1(Camera* camera) {
tmpAng2 = playerToTargetDir.yaw;
playerHead = playerPosRot->pos;
playerHead.y += playerHeight;
- OLib_Vec3fDiffToVecSphGeo(&playerToTargetDir, &playerHead, &camera->targetPosRot.pos);
+ OLib_Vec3fDiffToVecGeo(&playerToTargetDir, &playerHead, &camera->targetPosRot.pos);
distRatio = playerToTargetDir.r > distance ? 1 : playerToTargetDir.r / distance;
targetPos = camera->targetPosRot.pos;
- OLib_Vec3fDiffToVecSphGeo(&atToTargetDir, at, &targetPos);
+ OLib_Vec3fDiffToVecGeo(&atToTargetDir, at, &targetPos);
atToTargetDir.r = distance - ((atToTargetDir.r <= distance ? atToTargetDir.r : distance) * 0.5f);
swingAngle = roData->swingYawInitial + ((roData->swingYawFinal - roData->swingYawInitial) * (1.1f - distRatio));
spF8 = OREG(13) + swingAngle;
@@ -2913,7 +2916,7 @@ s32 Camera_Battle1(Camera* camera) {
if (rwData->animTimer != 0) {
if (rwData->animTimer >= OREG(24)) {
sp86 = rwData->animTimer - OREG(24);
- OLib_Vec3fDiffToVecSphGeo(&playerToTargetDir, at, eye);
+ OLib_Vec3fDiffToVecGeo(&playerToTargetDir, at, eye);
playerToTargetDir.yaw = tmpAng2 - 0x7FFF;
var2 = 1.0f / R_CAM_DEFAULT_ANIM_TIME;
@@ -2959,7 +2962,7 @@ s32 Camera_Battle1(Camera* camera) {
}
spB4.pitch = Camera_LERPCeilS(tmpAng1, atToEyeNextDir.pitch, rwData->unk_10, 0xA);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spB4);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &spB4);
spBC.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if (!camera->play->envCtx.skyboxDisabled || roData->flags & 1) {
@@ -3003,9 +3006,9 @@ s32 Camera_Battle4(Camera* camera) {
Vec3f* eye = &camera->eye;
Vec3f* at = &camera->at;
Vec3f* eyeNext = &camera->eyeNext;
- VecSph eyeNextOffset;
- VecSph eyeAtOffset;
- VecSph eyeNextAtOffset;
+ VecGeo eyeNextOffset;
+ VecGeo eyeAtOffset;
+ VecGeo eyeNextAtOffset;
Battle4ReadOnlyData* roData = &camera->paramData.batt4.roData;
Battle4ReadWriteData* rwData = &camera->paramData.batt4.rwData;
s32 pad;
@@ -3030,8 +3033,8 @@ s32 Camera_Battle4(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, at, eye);
+ OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -3063,7 +3066,7 @@ s32 Camera_Battle4(Camera* camera) {
eyeNextOffset.pitch = Camera_LERPCeilS(roData->pitchTarget, eyeAtOffset.pitch, roData->lerpUpdateRate, 2);
eyeNextOffset.r = Camera_LERPCeilF(roData->rTarget, eyeAtOffset.r, roData->lerpUpdateRate, 0.001f);
}
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeNextOffset);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeNextOffset);
*eye = *eyeNext;
camera->dist = eyeNextOffset.r;
camera->fov = Camera_LERPCeilF(roData->fovTarget, camera->fov, roData->lerpUpdateRate, 1.0f);
@@ -3095,11 +3098,11 @@ s32 Camera_KeepOn1(Camera* camera) {
f32 t2;
s16 spE2;
s16 spE0;
- VecSph spD8;
- VecSph spD0;
- VecSph spC8;
- VecSph spC0;
- VecSph spB8;
+ VecGeo spD8;
+ VecGeo spD0;
+ VecGeo spC8;
+ VecGeo spC0;
+ VecGeo spB8;
PosRot* playerPosRot = &camera->playerPosRot;
CamColChk sp8C;
s32 sp88;
@@ -3147,8 +3150,8 @@ s32 Camera_KeepOn1(Camera* camera) {
}
playerHeight += roData->unk_00;
- OLib_Vec3fDiffToVecSphGeo(&spC0, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&spB8, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&spC0, at, eye);
+ OLib_Vec3fDiffToVecGeo(&spB8, at, eyeNext);
sCameraInterfaceFlags = roData->interfaceFlags;
if (RELOAD_PARAMS(camera)) {
camera->animState++;
@@ -3179,7 +3182,7 @@ s32 Camera_KeepOn1(Camera* camera) {
spC8.r = 60.0f;
spC8.yaw = camera->playerPosRot.rot.y;
spC8.pitch = 0x2EE0;
- Camera_Vec3fVecSphGeoAdd(&camera->targetPosRot.pos, &sp54.pos, &spC8);
+ Camera_AddVecGeoToVec3f(&camera->targetPosRot.pos, &sp54.pos, &spC8);
} else {
Actor_GetFocus(&camera->targetPosRot, camera->target);
}
@@ -3210,7 +3213,7 @@ s32 Camera_KeepOn1(Camera* camera) {
sp104, &rwData->unk_08, &spC8, (sp80 ? 0x80 : 0) | roData->interfaceFlags);
sp114 = playerPosRot->pos;
sp114.y += playerHeight;
- OLib_Vec3fDiffToVecSphGeo(&spC8, &sp114, &camera->targetPosRot.pos);
+ OLib_Vec3fDiffToVecGeo(&spC8, &sp114, &camera->targetPosRot.pos);
sp84 = spC8.r > sp104 ? 1.0f : spC8.r / sp104;
break;
default:
@@ -3219,7 +3222,7 @@ s32 Camera_KeepOn1(Camera* camera) {
rwData->unk_0C = NULL;
break;
}
- OLib_Vec3fDiffToVecSphGeo(&spD8, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&spD8, at, eyeNext);
if (spD8.r < roData->unk_04) {
sp104 = roData->unk_04;
spE8 = OREG(6);
@@ -3234,7 +3237,7 @@ s32 Camera_KeepOn1(Camera* camera) {
camera->rUpdateRateInv = Camera_LERPCeilF(spE8, camera->rUpdateRateInv, CAM_DATA_SCALED(OREG(25)), 0.1f);
spD8.r = spE8 = camera->dist = Camera_LERPCeilF(sp104, camera->dist, 1.0f / camera->rUpdateRateInv, 0.2f);
sp108 = camera->targetPosRot.pos;
- OLib_Vec3fDiffToVecSphGeo(&spD0, at, &sp108);
+ OLib_Vec3fDiffToVecGeo(&spD0, at, &sp108);
spD0.r = spE8 - ((spD0.r <= spE8 ? spD0.r : spE8) * 0.5f);
spEC = roData->unk_0C + ((roData->unk_10 - roData->unk_0C) * (1.1f - sp84));
spF0 = OREG(13) + spEC;
@@ -3245,7 +3248,7 @@ s32 Camera_KeepOn1(Camera* camera) {
if (rwData->unk_16 >= OREG(24)) {
sp82 = rwData->unk_16 - OREG(24);
spE2 = spC8.yaw;
- OLib_Vec3fDiffToVecSphGeo(&spC8, at, eye);
+ OLib_Vec3fDiffToVecGeo(&spC8, at, eye);
spC8.yaw = spE2 - 0x7FFF;
t2 = 1.0f / R_CAM_DEFAULT_ANIM_TIME;
@@ -3288,7 +3291,7 @@ s32 Camera_KeepOn1(Camera* camera) {
}
spD8.pitch = Camera_LERPCeilS(spE2, spB8.pitch, CAM_DATA_SCALED(OREG(12)), 0xA);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spD8);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &spD8);
sp8C.pos = *eyeNext;
if (camera->status == CAM_STAT_ACTIVE) {
if (!camera->play->envCtx.skyboxDisabled || roData->interfaceFlags & 1) {
@@ -3332,10 +3335,10 @@ s32 Camera_KeepOn3(Camera* camera) {
f32 prevTargetPlayerDist;
f32 swingAngle;
Actor* colChkActors[2];
- VecSph targetToPlayerDir;
- VecSph atToEyeAdj;
- VecSph atToEyeDir;
- VecSph atToEyeNextDir;
+ VecGeo targetToPlayerDir;
+ VecGeo atToEyeAdj;
+ VecGeo atToEyeDir;
+ VecGeo atToEyeNextDir;
s32 i;
s32 angleCnt;
s16 sp82;
@@ -3389,13 +3392,13 @@ s32 Camera_KeepOn3(Camera* camera) {
}
playerHeight += roData->yOffset;
- OLib_Vec3fDiffToVecSphGeo(&atToEyeDir, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&atToEyeNextDir, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&atToEyeDir, at, eye);
+ OLib_Vec3fDiffToVecGeo(&atToEyeNextDir, at, eyeNext);
Actor_GetFocus(&camera->targetPosRot, camera->target);
Actor_GetFocus(&playerPosRot, &camera->player->actor);
playerHeadPos = camPlayerPosRot->pos;
playerHeadPos.y += playerHeight;
- OLib_Vec3fDiffToVecSphGeo(&targetToPlayerDir, &playerHeadPos, &camera->targetPosRot.pos);
+ OLib_Vec3fDiffToVecGeo(&targetToPlayerDir, &playerHeadPos, &camera->targetPosRot.pos);
sCameraInterfaceFlags = roData->flags;
if (RELOAD_PARAMS(camera)) {
colChkActors[0] = camera->target;
@@ -3440,12 +3443,12 @@ s32 Camera_KeepOn3(Camera* camera) {
sp82 = atToEyeAdj.pitch;
playerHeadPos = camPlayerPosRot->pos;
playerHeadPos.y += playerHeight;
- Camera_Vec3fVecSphGeoAdd(&rwData->atTarget, &playerHeadPos, &targetToPlayerDir);
+ Camera_AddVecGeoToVec3f(&rwData->atTarget, &playerHeadPos, &targetToPlayerDir);
angleCnt = ARRAY_COUNT(D_8011D3B0);
i = 0;
targetToPlayerDir.r = prevTargetPlayerDist;
atToEyeAdj.r = roData->minDist + (targetToPlayerDir.r * (1 - 0.5f)) - atToEyeNextDir.r + atToEyeNextDir.r;
- Camera_Vec3fVecSphGeoAdd(&lineChkPointB, &rwData->atTarget, &atToEyeAdj);
+ Camera_AddVecGeoToVec3f(&lineChkPointB, &rwData->atTarget, &atToEyeAdj);
if (!(roData->flags & 0x80)) {
while (i < angleCnt) {
if (!CollisionCheck_LineOCCheck(camera->play, &camera->play->colChkCtx, &rwData->atTarget,
@@ -3455,16 +3458,16 @@ s32 Camera_KeepOn3(Camera* camera) {
}
atToEyeAdj.yaw = sp80 + D_8011D3B0[i];
atToEyeAdj.pitch = sp82 + D_8011D3CC[i];
- Camera_Vec3fVecSphGeoAdd(&lineChkPointB, &rwData->atTarget, &atToEyeAdj);
+ Camera_AddVecGeoToVec3f(&lineChkPointB, &rwData->atTarget, &atToEyeAdj);
i++;
}
}
osSyncPrintf("camera: talk: BG&collision check %d time(s)\n", i);
camera->unk_14C &= ~0xC;
pad = ((rwData->animTimer + 1) * rwData->animTimer) >> 1;
- rwData->eyeToAtTarget.y = (f32)(s16)(atToEyeAdj.yaw - atToEyeNextDir.yaw) / pad;
- rwData->eyeToAtTarget.z = (f32)(s16)(atToEyeAdj.pitch - atToEyeNextDir.pitch) / pad;
- rwData->eyeToAtTarget.x = (atToEyeAdj.r - atToEyeNextDir.r) / pad;
+ rwData->eyeToAtTargetYaw = (f32)(s16)(atToEyeAdj.yaw - atToEyeNextDir.yaw) / pad;
+ rwData->eyeToAtTargetPitch = (f32)(s16)(atToEyeAdj.pitch - atToEyeNextDir.pitch) / pad;
+ rwData->eyeToAtTargetR = (atToEyeAdj.r - atToEyeNextDir.r) / pad;
return 1;
}
@@ -3474,10 +3477,10 @@ s32 Camera_KeepOn3(Camera* camera) {
at->z += (rwData->atTarget.z - at->z) / rwData->animTimer;
// needed to match
if (!prevTargetPlayerDist) {}
- atToEyeAdj.r = ((rwData->eyeToAtTarget.x * rwData->animTimer) + atToEyeNextDir.r) + 1.0f;
- atToEyeAdj.yaw = atToEyeNextDir.yaw + (s16)(rwData->eyeToAtTarget.y * rwData->animTimer);
- atToEyeAdj.pitch = atToEyeNextDir.pitch + (s16)(rwData->eyeToAtTarget.z * rwData->animTimer);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &atToEyeAdj);
+ atToEyeAdj.r = ((rwData->eyeToAtTargetR * rwData->animTimer) + atToEyeNextDir.r) + 1.0f;
+ atToEyeAdj.yaw = atToEyeNextDir.yaw + (s16)(rwData->eyeToAtTargetYaw * rwData->animTimer);
+ atToEyeAdj.pitch = atToEyeNextDir.pitch + (s16)(rwData->eyeToAtTargetPitch * rwData->animTimer);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &atToEyeAdj);
*eye = *eyeNext;
camera->fov = Camera_LERPCeilF(roData->fovTarget, camera->fov, 0.5, 1.0f);
camera->roll = Camera_LERPCeilS(0, camera->roll, 0.5, 0xA);
@@ -3519,9 +3522,9 @@ s32 Camera_KeepOn4(Camera* camera) {
f32 t = -0.5f;
f32 temp_f0_2;
CollisionPoly* spC0;
- VecSph spB8;
- VecSph spB0;
- VecSph spA8;
+ VecGeo spB8;
+ VecGeo spB0;
+ VecGeo spA8;
s16* temp_s0 = &camera->data2;
s16 spA2;
s16 spA0;
@@ -3667,8 +3670,8 @@ s32 Camera_KeepOn4(Camera* camera) {
sUpdateCameraDirection = 1;
sCameraInterfaceFlags = roData->unk_1C;
- OLib_Vec3fDiffToVecSphGeo(&spB0, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&spA8, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&spB0, at, eye);
+ OLib_Vec3fDiffToVecGeo(&spA8, at, eyeNext);
D_8015BD50 = playerPosRot->pos;
D_8015BD50.y += playerHeight;
temp_f0_2 = BgCheck_CameraRaycastDown2(&camera->play->colCtx, &spC0, &i, &D_8015BD50);
@@ -3727,7 +3730,7 @@ s32 Camera_KeepOn4(Camera* camera) {
spB8.pitch = spA2;
spB8.yaw = spA0;
spB8.r = roData->unk_04;
- Camera_Vec3fVecSphGeoAdd(&D_8015BD70, &D_8015BD50, &spB8);
+ Camera_AddVecGeoToVec3f(&D_8015BD70, &D_8015BD50, &spB8);
if (!(roData->unk_1C & 1)) {
angleCnt = ARRAY_COUNT(D_8011D3B0);
for (i = 0; i < angleCnt; i++) {
@@ -3738,7 +3741,7 @@ s32 Camera_KeepOn4(Camera* camera) {
}
spB8.yaw = D_8011D3B0[i] + spA0;
spB8.pitch = D_8011D3CC[i] + spA2;
- Camera_Vec3fVecSphGeoAdd(&D_8015BD70, &D_8015BD50, &spB8);
+ Camera_AddVecGeoToVec3f(&D_8015BD70, &D_8015BD50, &spB8);
}
osSyncPrintf("camera: item: BG&collision check %d time(s)\n", i);
}
@@ -3762,7 +3765,7 @@ s32 Camera_KeepOn4(Camera* camera) {
spB8.r = roData->unk_10;
spB8.pitch = 0;
spB8.yaw = playerPosRot->rot.y;
- Camera_Vec3fVecSphGeoAdd(at, at, &spB8);
+ Camera_AddVecGeoToVec3f(at, at, &spB8);
}
camera->atLERPStepScale = 0.0f;
camera->dist = Camera_LERPCeilF(roData->unk_04, camera->dist, 0.25f, 2.0f);
@@ -3795,7 +3798,7 @@ s32 Camera_KeepOn4(Camera* camera) {
}
spB8.yaw = Camera_LERPCeilS(rwData->unk_0C, spA8.yaw, roData->unk_14, 4);
spB8.pitch = Camera_LERPCeilS(rwData->unk_0E, spA8.pitch, roData->unk_14, 4);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &spB8);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &spB8);
*eye = *eyeNext;
Camera_BGCheck(camera, at, eye);
camera->fov = Camera_LERPCeilF(roData->unk_18, camera->fov, camera->fovUpdateRate, 1.0f);
@@ -3809,8 +3812,8 @@ s32 Camera_KeepOn0(Camera* camera) {
Vec3f* eye = &camera->eye;
Vec3f* eyeNext = &camera->eyeNext;
Vec3f* at = &camera->at;
- VecSph eyeTargetPosOffset;
- VecSph eyeAtOffset;
+ VecGeo eyeTargetPosOffset;
+ VecGeo eyeAtOffset;
KeepOn0ReadOnlyData* roData = &camera->paramData.keep0.roData;
KeepOn0ReadWriteData* rwData = &camera->paramData.keep0.rwData;
s32 pad;
@@ -3855,8 +3858,8 @@ s32 Camera_KeepOn0(Camera* camera) {
Actor_GetFocus(&camera->targetPosRot, camera->target);
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, eye, at);
- OLib_Vec3fDiffToVecSphGeo(&eyeTargetPosOffset, eye, &camera->targetPosRot.pos);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, eye, at);
+ OLib_Vec3fDiffToVecGeo(&eyeTargetPosOffset, eye, &camera->targetPosRot.pos);
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -3871,7 +3874,7 @@ s32 Camera_KeepOn0(Camera* camera) {
if (rwData->animTimer != 0) {
eyeAtOffset.yaw += ((s16)(eyeTargetPosOffset.yaw - eyeAtOffset.yaw) / rwData->animTimer) * roData->yawScale;
- Camera_Vec3fVecSphGeoAdd(at, eye, &eyeAtOffset);
+ Camera_AddVecGeoToVec3f(at, eye, &eyeAtOffset);
rwData->animTimer--;
} else {
camera->unk_14C |= (0x400 | 0x10);
@@ -3884,8 +3887,8 @@ s32 Camera_Fixed1(Camera* camera) {
Fixed1ReadOnlyData* roData = &camera->paramData.fixd1.roData;
Fixed1ReadWriteData* rwData = &camera->paramData.fixd1.rwData;
s32 pad;
- VecSph eyeOffset;
- VecSph eyeAtOffset;
+ VecGeo eyeOffset;
+ VecGeo eyeAtOffset;
s32 pad2;
Vec3f adjustedPos;
BgCamFuncData* bgCamFuncData;
@@ -3928,7 +3931,7 @@ s32 Camera_Fixed1(Camera* camera) {
}
}
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, eye, at);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, eye, at);
Camera_LERPCeilVec3f(&rwData->eyePosRotTarget.pos, eye, 0.1f, 0.1f, 0.2f);
adjustedPos = playerPosRot->pos;
@@ -3939,7 +3942,7 @@ s32 Camera_Fixed1(Camera* camera) {
eyeOffset.pitch = Camera_LERPCeilS(-rwData->eyePosRotTarget.rot.x, eyeAtOffset.pitch, roData->lerpStep, 5);
eyeOffset.yaw = Camera_LERPCeilS(rwData->eyePosRotTarget.rot.y, eyeAtOffset.yaw, roData->lerpStep, 5);
- Camera_Vec3fVecSphGeoAdd(at, eye, &eyeOffset);
+ Camera_AddVecGeoToVec3f(at, eye, &eyeOffset);
camera->eyeNext = *eye;
@@ -4040,16 +4043,16 @@ s32 Camera_Fixed3(Camera* camera) {
Vec3f* eye = &camera->eye;
Vec3f* at = &camera->at;
Vec3f* eyeNext = &camera->eyeNext;
- VecSph atSph;
+ VecGeo atGeo;
BgCamFuncData* bgCamFuncData;
- VecSph eyeAtOffset;
+ VecGeo eyeAtOffset;
Fixed3ReadOnlyData* roData = &camera->paramData.fixd3.roData;
Fixed3ReadWriteData* rwData = &camera->paramData.fixd3.rwData;
s32 pad;
bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamFuncData(camera);
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, eye, at);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, eye, at);
if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) {
CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
@@ -4091,11 +4094,11 @@ s32 Camera_Fixed3(Camera* camera) {
sUpdateCameraDirection = false;
}
- atSph.r = 150.0f;
- atSph.yaw = rwData->rot.y;
- atSph.pitch = -rwData->rot.x;
+ atGeo.r = 150.0f;
+ atGeo.yaw = rwData->rot.y;
+ atGeo.pitch = -rwData->rot.x;
- Camera_Vec3fVecSphGeoAdd(at, eye, &atSph);
+ Camera_AddVecGeoToVec3f(at, eye, &atGeo);
sCameraInterfaceFlags = roData->interfaceFlags;
rwData->fov = R_CAM_DATA(CAM_DATA_FOV);
camera->roll = 0;
@@ -4115,8 +4118,8 @@ s32 Camera_Fixed4(Camera* camera) {
Vec3f playerPosWithCamOffset;
Vec3f atTarget;
Vec3f posOffsetTarget;
- VecSph atEyeNextOffset;
- VecSph atTargetEyeNextOffset;
+ VecGeo atEyeNextOffset;
+ VecGeo atTargetEyeNextOffset;
PosRot* playerPosRot = &camera->playerPosRot;
BgCamFuncData* bgCamFuncData;
Vec3f* posOffset = &camera->posOffset;
@@ -4169,15 +4172,15 @@ s32 Camera_Fixed4(Camera* camera) {
playerPosWithCamOffset.z = playerPosRot->pos.z + camera->posOffset.z;
VEC3F_LERPIMPDST(&atTarget, at, &playerPosWithCamOffset, 0.5f);
- OLib_Vec3fDiffToVecSphGeo(&atEyeNextOffset, eyeNext, at);
- OLib_Vec3fDiffToVecSphGeo(&atTargetEyeNextOffset, eyeNext, &atTarget);
+ OLib_Vec3fDiffToVecGeo(&atEyeNextOffset, eyeNext, at);
+ OLib_Vec3fDiffToVecGeo(&atTargetEyeNextOffset, eyeNext, &atTarget);
atEyeNextOffset.r += (atTargetEyeNextOffset.r - atEyeNextOffset.r) * rwData->followSpeed;
atEyeNextOffset.pitch = Camera_LERPCeilS(atTargetEyeNextOffset.pitch, atEyeNextOffset.pitch,
rwData->followSpeed * camera->speedRatio, 0xA);
atEyeNextOffset.yaw =
Camera_LERPCeilS(atTargetEyeNextOffset.yaw, atEyeNextOffset.yaw, rwData->followSpeed * camera->speedRatio, 0xA);
- Camera_Vec3fVecSphGeoAdd(at, eyeNext, &atEyeNextOffset);
+ Camera_AddVecGeoToVec3f(at, eyeNext, &atEyeNextOffset);
camera->dist = OLib_Vec3fDist(at, eye);
camera->roll = 0;
camera->fov = roData->fov;
@@ -4206,9 +4209,9 @@ s32 Camera_Subj3(Camera* camera) {
Vec3f* eyeNext = &camera->eyeNext;
Vec3f sp98;
Vec3f sp8C;
- VecSph sp84;
- VecSph sp7C;
- VecSph tsph;
+ VecGeo sp84;
+ VecGeo sp7C;
+ VecGeo tGeo;
PosRot sp60;
PosRot* playerPosRot = &camera->playerPosRot;
f32 sp58;
@@ -4247,8 +4250,8 @@ s32 Camera_Subj3(Camera* camera) {
sp98 = sp60.pos;
sp98.y += roData->eyeNextYOffset;
- Camera_Vec3fVecSphGeoAdd(&sp8C, &sp98, &sp84);
- OLib_Vec3fDiffToVecSphGeo(&sp7C, at, eye);
+ Camera_AddVecGeoToVec3f(&sp8C, &sp98, &sp84);
+ OLib_Vec3fDiffToVecGeo(&sp7C, at, eye);
sCameraInterfaceFlags = roData->interfaceFlags;
if (RELOAD_PARAMS(camera)) {
@@ -4262,9 +4265,9 @@ s32 Camera_Subj3(Camera* camera) {
camera->dist = roData->eyeNextDist;
}
- tsph.r = rwData->r;
- tsph.yaw = rwData->yaw;
- tsph.pitch = rwData->pitch;
+ tGeo.r = rwData->r;
+ tGeo.yaw = rwData->yaw;
+ tGeo.pitch = rwData->pitch;
if (rwData->animTimer != 0) {
temp_f0_3 = (1.0f / rwData->animTimer);
pad2 = at;
@@ -4273,15 +4276,15 @@ s32 Camera_Subj3(Camera* camera) {
at->z = at->z + (sp98.z - pad2->z) * temp_f0_3;
temp_f0_3 = (1.0f / R_CAM_DEFAULT_ANIM_TIME);
- sp58 = (tsph.r - sp84.r) * temp_f0_3;
- sp52 = (s16)(tsph.yaw - sp84.yaw) * temp_f0_3;
- sp50 = (s16)(tsph.pitch - sp84.pitch) * temp_f0_3;
+ sp58 = (tGeo.r - sp84.r) * temp_f0_3;
+ sp52 = (s16)(tGeo.yaw - sp84.yaw) * temp_f0_3;
+ sp50 = (s16)(tGeo.pitch - sp84.pitch) * temp_f0_3;
sp7C.r = Camera_LERPCeilF(sp84.r + (sp58 * rwData->animTimer), sp7C.r, CAM_DATA_SCALED(OREG(28)), 1.0f);
sp7C.yaw = Camera_LERPCeilS(sp84.yaw + (sp52 * rwData->animTimer), sp7C.yaw, CAM_DATA_SCALED(OREG(28)), 0xA);
sp7C.pitch =
Camera_LERPCeilS(sp84.pitch + (sp50 * rwData->animTimer), sp7C.pitch, CAM_DATA_SCALED(OREG(28)), 0xA);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &sp7C);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &sp7C);
*eye = *eyeNext;
rwData->animTimer--;
@@ -4308,9 +4311,9 @@ s32 Camera_Subj3(Camera* camera) {
sp7C.r = roData->eyeNextDist;
sp7C.yaw = sp60.rot.y - 0x7FFF;
sp7C.pitch = sp60.rot.x;
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &sp7C);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &sp7C);
sp7C.r = roData->eyeDist;
- Camera_Vec3fVecSphGeoAdd(eye, at, &sp7C);
+ Camera_AddVecGeoToVec3f(eye, at, &sp7C);
}
camera->posOffset.x = camera->at.x - playerPosRot->pos.x;
@@ -4347,8 +4350,8 @@ s32 Camera_Subj4(Camera* camera) {
s16 pad2;
f32 temp_f16;
PosRot sp6C;
- VecSph sp64;
- VecSph sp5C;
+ VecGeo sp64;
+ VecGeo sp5C;
s16 temp_a0;
f32 tx;
Player* player;
@@ -4374,7 +4377,7 @@ s32 Camera_Subj4(Camera* camera) {
Actor_GetWorldPosShapeRot(&sp6C, &camera->player->actor);
- OLib_Vec3fDiffToVecSphGeo(&sp5C, at, eye);
+ OLib_Vec3fDiffToVecGeo(&sp5C, at, eye);
sCameraInterfaceFlags = roData->interfaceFlags;
if (camera->animState == 0) {
crawlspacePoints = (Vec3s*)Camera_GetBgCamFuncDataUnderPlayer(camera, &crawlspaceNumPoints);
@@ -4409,7 +4412,7 @@ s32 Camera_Subj4(Camera* camera) {
sp64.r = 10.0f;
sp64.pitch = 0x238C;
sp64.yaw = rwData->unk_30;
- Camera_Vec3fVecSphGeoAdd(&sp8C, &sp6C.pos, &sp64);
+ Camera_AddVecGeoToVec3f(&sp8C, &sp6C.pos, &sp64);
sp88 = (rwData->unk_32 + 1.0f);
at->x += (sp8C.x - at->x) / sp88;
at->y += (sp8C.y - at->y) / sp88;
@@ -4417,7 +4420,7 @@ s32 Camera_Subj4(Camera* camera) {
sp5C.r -= (sp5C.r / sp88);
sp5C.yaw = BINANG_LERPIMPINV(sp5C.yaw, (s16)(sp6C.rot.y - 0x7FFF), rwData->unk_32);
sp5C.pitch = BINANG_LERPIMPINV(sp5C.pitch, sp6C.rot.x, rwData->unk_32);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &sp5C);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &sp5C);
*eye = *eyeNext;
rwData->unk_32--;
return false;
@@ -4434,7 +4437,7 @@ s32 Camera_Subj4(Camera* camera) {
sp64.yaw = rwData->unk_30;
sp64.r = 5.0f;
sp64.pitch = 0x238C;
- Camera_Vec3fVecSphGeoAdd(&sp98, eyeNext, &sp64);
+ Camera_AddVecGeoToVec3f(&sp98, eyeNext, &sp64);
rwData->unk_2C += 0xBB8;
temp_f16 = Math_CosS(rwData->unk_2C);
eye->x += (sp98.x - eye->x) * fabsf(temp_f16);
@@ -4486,9 +4489,9 @@ s32 Camera_Data3(Camera* camera) {
s32 Camera_Data4(Camera* camera) {
s32 pad2[2];
Data4ReadOnlyData* roData = &camera->paramData.data4.roData;
- VecSph eyeAtOffset;
- VecSph atOffset;
- VecSph eyeNextAtOffset;
+ VecGeo eyeAtOffset;
+ VecGeo atOffset;
+ VecGeo eyeNextAtOffset;
f32 yNormal;
s16 fov;
Vec3f* eyeNext = &camera->eyeNext;
@@ -4535,16 +4538,16 @@ s32 Camera_Data4(Camera* camera) {
func_80043B60(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
Camera_CalcAtDefault(camera, &eyeNextAtOffset, roData->yOffset, false);
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, eye, at);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, eye, at);
atOffset.r = eyeAtOffset.r;
atOffset.yaw = (rwData->flags & 1) ? (CAM_DEG_TO_BINANG(camera->data2) + rwData->eyePosRot.rot.y) : eyeAtOffset.yaw;
atOffset.pitch =
(rwData->flags & 2) ? (CAM_DEG_TO_BINANG(camera->data3) + rwData->eyePosRot.rot.x) : eyeAtOffset.pitch;
- Camera_Vec3fVecSphGeoAdd(at, eye, &atOffset);
+ Camera_AddVecGeoToVec3f(at, eye, &atOffset);
lookAt = camera->playerPosRot.pos;
lookAt.y += playerHeight;
@@ -4566,10 +4569,10 @@ s32 Camera_Unique1(Camera* camera) {
Vec3f* eyeNext = &camera->eyeNext;
Vec3f playerWaistPos;
s16 phiTarget;
- VecSph sp8C;
- VecSph unk908PlayerPosOffset;
- VecSph eyeAtOffset;
- VecSph eyeNextAtOffset;
+ VecGeo sp8C;
+ VecGeo unk908PlayerPosOffset;
+ VecGeo eyeAtOffset;
+ VecGeo eyeNextAtOffset;
PosRot* playerPosRot = &camera->playerPosRot;
PosRot playerhead;
Unique1ReadOnlyData* roData = &camera->paramData.uniq1.roData;
@@ -4599,8 +4602,8 @@ s32 Camera_Unique1(Camera* camera) {
sUpdateCameraDirection = 1;
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, at, eye);
+ OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -4609,7 +4612,7 @@ s32 Camera_Unique1(Camera* camera) {
rwData->yawTarget = eyeNextAtOffset.yaw;
rwData->unk_00 = 0.0f;
playerWaistPos = camera->player->bodyPartsPos[PLAYER_BODYPART_WAIST];
- OLib_Vec3fDiffToVecSphGeo(&unk908PlayerPosOffset, &playerPosRot->pos, &playerWaistPos);
+ OLib_Vec3fDiffToVecGeo(&unk908PlayerPosOffset, &playerPosRot->pos, &playerWaistPos);
rwData->timer = R_CAM_DEFAULT_ANIM_TIME;
rwData->yawTargetAdj = ABS((s16)(unk908PlayerPosOffset.yaw - eyeAtOffset.yaw)) < 0x3A98
? 0
@@ -4626,7 +4629,7 @@ s32 Camera_Unique1(Camera* camera) {
camera->fovUpdateRate = Camera_LERPCeilF(OREG(4) * 0.01f, camera->fovUpdateRate, 0.05f, 0.1f);
Camera_CalcAtDefault(camera, &eyeNextAtOffset, roData->yOffset, 1);
- OLib_Vec3fDiffToVecSphGeo(&sp8C, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&sp8C, at, eyeNext);
camera->dist = Camera_LERPClampDist(camera, sp8C.r, roData->distMin, roData->distMax);
@@ -4646,7 +4649,7 @@ s32 Camera_Unique1(Camera* camera) {
}
sp8C.yaw = Camera_LERPFloorS(rwData->yawTarget, eyeNextAtOffset.yaw, 0.5f, 0x2710);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &sp8C);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &sp8C);
*eye = *eyeNext;
Camera_BGCheck(camera, at, eye);
camera->fov = Camera_LERPCeilF(roData->fovTarget, camera->fov, camera->fovUpdateRate, 1.0f);
@@ -4660,8 +4663,8 @@ s32 Camera_Unique2(Camera* camera) {
Vec3f* at = &camera->at;
Vec3f* eyeNext = &camera->eyeNext;
Vec3f playerPos;
- VecSph eyeOffset;
- VecSph eyeAtOffset;
+ VecGeo eyeOffset;
+ VecGeo eyeAtOffset;
s32 pad;
f32 lerpRateFactor;
Unique2ReadOnlyData* roData = &camera->paramData.uniq2.roData;
@@ -4671,7 +4674,7 @@ s32 Camera_Unique2(Camera* camera) {
playerHeight = Player_GetHeight(camera->player);
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, at, eye);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, at, eye);
if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) {
CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
@@ -4711,17 +4714,17 @@ s32 Camera_Unique2(Camera* camera) {
rwData->unk_00 = F32_LERPIMP(rwData->unk_00, 2.0f, 0.05f); // unused.
if (roData->interfaceFlags & 1) {
- OLib_Vec3fDiffToVecSphGeo(&eyeOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeOffset, at, eyeNext);
eyeOffset.r = roData->distTarget;
- Camera_Vec3fVecSphGeoAdd(&playerPos, at, &eyeOffset);
+ Camera_AddVecGeoToVec3f(&playerPos, at, &eyeOffset);
Camera_LERPCeilVec3f(&playerPos, eye, 0.25f, 0.25f, 0.2f);
} else if (roData->interfaceFlags & 2) {
if (OLib_Vec3fDistXZ(at, eyeNext) < roData->distTarget) {
- OLib_Vec3fDiffToVecSphGeo(&eyeOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyeOffset, at, eyeNext);
eyeOffset.yaw = Camera_LERPCeilS(eyeOffset.yaw, eyeAtOffset.yaw, 0.1f, 0xA);
eyeOffset.r = roData->distTarget;
eyeOffset.pitch = 0;
- Camera_Vec3fVecSphGeoAdd(eye, at, &eyeOffset);
+ Camera_AddVecGeoToVec3f(eye, at, &eyeOffset);
eye->y = eyeNext->y;
} else {
Camera_LERPCeilVec3f(eyeNext, eye, 0.25f, 0.25f, 0.2f);
@@ -4737,7 +4740,7 @@ s32 Camera_Unique2(Camera* camera) {
}
s32 Camera_Unique3(Camera* camera) {
- VecSph sp60;
+ VecGeo sp60;
f32 playerHeight;
DoorParams* doorParams = &camera->paramData.doorParams;
BgCamFuncData* bgCamFuncData;
@@ -4784,7 +4787,7 @@ s32 Camera_Unique3(Camera* camera) {
sp60.yaw = bgCamRot.y;
sp60.pitch = -bgCamRot.x;
- Camera_Vec3fVecSphGeoAdd(at, &camera->eye, &sp60);
+ Camera_AddVecGeoToVec3f(at, &camera->eye, &sp60);
camera->animState++;
FALLTHROUGH;
case 2:
@@ -4828,9 +4831,9 @@ s32 Camera_Unique3(Camera* camera) {
FALLTHROUGH;
case 5:
camera->fov = Camera_LERPCeilF(rwData->initialFov, camera->fov, 0.4f, 0.1f);
- OLib_Vec3fDiffToVecSphGeo(&sp60, at, &camera->eye);
+ OLib_Vec3fDiffToVecGeo(&sp60, at, &camera->eye);
sp60.r = Camera_LERPCeilF(100.0f, sp60.r, 0.4f, 0.1f);
- Camera_Vec3fVecSphGeoAdd(&camera->eyeNext, at, &sp60);
+ Camera_AddVecGeoToVec3f(&camera->eyeNext, at, &sp60);
camera->eye = camera->eyeNext;
if (doorParams->timer3-- > 0) {
break;
@@ -4861,7 +4864,7 @@ s32 Camera_Unique0(Camera* camera) {
CameraModeValue* values;
Player* player;
Vec3f playerPosWithOffset;
- VecSph atPlayerOffset;
+ VecGeo atPlayerOffset;
BgCamFuncData* bgCamFuncData;
Vec3s bgCamRot;
PosRot* playerPosRot = &camera->playerPosRot;
@@ -4908,7 +4911,7 @@ s32 Camera_Unique0(Camera* camera) {
atPlayerOffset.r = OLib_Vec3fDist(&playerPosWithOffset, eye);
atPlayerOffset.yaw = bgCamRot.y;
atPlayerOffset.pitch = -bgCamRot.x;
- OLib_VecSphGeoToVec3f(&rwData->eyeAndDirection.dir, &atPlayerOffset);
+ OLib_VecGeoToVec3f(&rwData->eyeAndDirection.dir, &atPlayerOffset);
Math3D_LineClosestToPoint(&rwData->eyeAndDirection, &playerPosRot->pos, &camera->at);
rwData->initalPos = playerPosRot->pos;
camera->animState++;
@@ -5036,7 +5039,7 @@ s32 Camera_Unique7(Camera* camera) {
s32 pad;
Unique7ReadOnlyData* roData = &camera->paramData.uniq7.roData;
CameraModeValue* values;
- VecSph playerPosEyeOffset;
+ VecGeo playerPosEyeOffset;
s16 fov;
BgCamFuncData* bgCamFuncData;
UNUSED Vec3s bgCamRot;
@@ -5061,7 +5064,7 @@ s32 Camera_Unique7(Camera* camera) {
*eye = *eyeNext;
bgCamRot = bgCamFuncData->rot;
- OLib_Vec3fDiffToVecSphGeo(&playerPosEyeOffset, eye, &playerPosRot->pos);
+ OLib_Vec3fDiffToVecGeo(&playerPosEyeOffset, eye, &playerPosRot->pos);
// fov actually goes unused since it's hard set later on.
fov = bgCamFuncData->fov;
@@ -5088,7 +5091,7 @@ s32 Camera_Unique7(Camera* camera) {
// 0x7D0 ~ 10.98 degres.
rwData->unk_00.x = Camera_LERPFloorS(playerPosEyeOffset.yaw, rwData->unk_00.x, 0.4f, 0x7D0);
playerPosEyeOffset.pitch = -bgCamFuncData->rot.x * Math_CosS(playerPosEyeOffset.yaw - bgCamFuncData->rot.y);
- Camera_Vec3fVecSphGeoAdd(at, eye, &playerPosEyeOffset);
+ Camera_AddVecGeoToVec3f(at, eye, &playerPosEyeOffset);
camera->unk_14C |= 0x400;
return true;
}
@@ -5103,9 +5106,9 @@ s32 Camera_Unique9(Camera* camera) {
Unique9ReadOnlyData* roData = &camera->paramData.uniq9.roData;
Unique9ReadWriteData* rwData = &camera->paramData.uniq9.rwData;
f32 invKeyFrameTimer;
- VecSph eyeNextAtOffset;
- VecSph scratchSph;
- VecSph playerTargetOffset;
+ VecGeo eyeNextAtOffset;
+ VecGeo scratchGeo;
+ VecGeo playerTargetOffset;
s16 action;
s16 atInitFlags;
s16 eyeInitFlags;
@@ -5206,17 +5209,17 @@ s32 Camera_Unique9(Camera* camera) {
Actor_GetFocus(&playerhead, &camera->player->actor);
playerhead.pos.x = playerPosRot.pos.x;
playerhead.pos.z = playerPosRot.pos.z;
- OLib_Vec3fDiffToVecSphGeo(&playerTargetOffset, &targethead.pos, &playerhead.pos);
+ OLib_Vec3fDiffToVecGeo(&playerTargetOffset, &targethead.pos, &playerhead.pos);
if (atInitFlags & (s16)0x8080) {
- scratchSph.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.x);
- scratchSph.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.y);
- scratchSph.r = rwData->curKeyFrame->atTargetInit.z;
+ scratchGeo.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.x);
+ scratchGeo.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.y);
+ scratchGeo.r = rwData->curKeyFrame->atTargetInit.z;
} else {
- OLib_Vec3fToVecSphGeo(&scratchSph, &rwData->curKeyFrame->atTargetInit);
+ OLib_Vec3fToVecGeo(&scratchGeo, &rwData->curKeyFrame->atTargetInit);
}
- scratchSph.yaw += playerTargetOffset.yaw;
- scratchSph.pitch += playerTargetOffset.pitch;
- Camera_Vec3fVecSphGeoAdd(&rwData->atTarget, &targethead.pos, &scratchSph);
+ scratchGeo.yaw += playerTargetOffset.yaw;
+ scratchGeo.pitch += playerTargetOffset.pitch;
+ Camera_AddVecGeoToVec3f(&rwData->atTarget, &targethead.pos, &scratchGeo);
} else {
if (camera->target == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: warning: demo C: actor is not valid\n" VT_RST);
@@ -5246,16 +5249,16 @@ s32 Camera_Unique9(Camera* camera) {
}
if (atInitFlags & (s16)0x8080) {
- scratchSph.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.x);
- scratchSph.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.y);
- scratchSph.r = rwData->curKeyFrame->atTargetInit.z;
+ scratchGeo.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.x);
+ scratchGeo.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->atTargetInit.y);
+ scratchGeo.r = rwData->curKeyFrame->atTargetInit.z;
} else {
- OLib_Vec3fToVecSphGeo(&scratchSph, &rwData->curKeyFrame->atTargetInit);
+ OLib_Vec3fToVecGeo(&scratchGeo, &rwData->curKeyFrame->atTargetInit);
}
- scratchSph.yaw += atFocusPosRot.rot.y;
- scratchSph.pitch -= atFocusPosRot.rot.x;
- Camera_Vec3fVecSphGeoAdd(&rwData->atTarget, &atFocusPosRot.pos, &scratchSph);
+ scratchGeo.yaw += atFocusPosRot.rot.y;
+ scratchGeo.pitch -= atFocusPosRot.rot.x;
+ Camera_AddVecGeoToVec3f(&rwData->atTarget, &atFocusPosRot.pos, &scratchGeo);
} else {
if (camera->target == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: warning: demo C: actor is not valid\n" VT_RST);
@@ -5289,7 +5292,7 @@ s32 Camera_Unique9(Camera* camera) {
Actor_GetFocus(&playerhead, &camera->player->actor);
playerhead.pos.x = playerPosRot.pos.x;
playerhead.pos.z = playerPosRot.pos.z;
- OLib_Vec3fDiffToVecSphGeo(&playerTargetOffset, &targethead.pos, &playerhead.pos);
+ OLib_Vec3fDiffToVecGeo(&playerTargetOffset, &targethead.pos, &playerhead.pos);
if (eyeInitFlags == 0x400 || eyeInitFlags == (s16)0x8400) {
eyeLookAtPos = targethead.pos;
} else {
@@ -5297,16 +5300,16 @@ s32 Camera_Unique9(Camera* camera) {
}
if (eyeInitFlags & (s16)0x8080) {
- scratchSph.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.x);
- scratchSph.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.y);
- scratchSph.r = rwData->curKeyFrame->eyeTargetInit.z;
+ scratchGeo.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.x);
+ scratchGeo.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.y);
+ scratchGeo.r = rwData->curKeyFrame->eyeTargetInit.z;
} else {
- OLib_Vec3fToVecSphGeo(&scratchSph, &rwData->curKeyFrame->eyeTargetInit);
+ OLib_Vec3fToVecGeo(&scratchGeo, &rwData->curKeyFrame->eyeTargetInit);
}
- scratchSph.yaw += playerTargetOffset.yaw;
- scratchSph.pitch += playerTargetOffset.pitch;
- Camera_Vec3fVecSphGeoAdd(&rwData->eyeTarget, &eyeLookAtPos, &scratchSph);
+ scratchGeo.yaw += playerTargetOffset.yaw;
+ scratchGeo.pitch += playerTargetOffset.pitch;
+ Camera_AddVecGeoToVec3f(&rwData->eyeTarget, &eyeLookAtPos, &scratchGeo);
} else {
if (camera->target == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: warning: demo C: actor is not valid\n" VT_RST);
@@ -5338,16 +5341,16 @@ s32 Camera_Unique9(Camera* camera) {
}
if (eyeInitFlags & (s16)0x8080) {
- scratchSph.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.x);
- scratchSph.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.y);
- scratchSph.r = rwData->curKeyFrame->eyeTargetInit.z;
+ scratchGeo.pitch = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.x);
+ scratchGeo.yaw = CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.y);
+ scratchGeo.r = rwData->curKeyFrame->eyeTargetInit.z;
} else {
- OLib_Vec3fToVecSphGeo(&scratchSph, &rwData->curKeyFrame->eyeTargetInit);
+ OLib_Vec3fToVecGeo(&scratchGeo, &rwData->curKeyFrame->eyeTargetInit);
}
- scratchSph.yaw += eyeFocusPosRot.rot.y;
- scratchSph.pitch -= eyeFocusPosRot.rot.x;
- Camera_Vec3fVecSphGeoAdd(&rwData->eyeTarget, &eyeFocusPosRot.pos, &scratchSph);
+ scratchGeo.yaw += eyeFocusPosRot.rot.y;
+ scratchGeo.pitch -= eyeFocusPosRot.rot.x;
+ Camera_AddVecGeoToVec3f(&rwData->eyeTarget, &eyeFocusPosRot.pos, &scratchGeo);
} else {
if (camera->target == NULL) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: warning: demo C: actor is not valid\n" VT_RST);
@@ -5408,16 +5411,16 @@ s32 Camera_Unique9(Camera* camera) {
camera->roll = rwData->rollTarget;
break;
case 1:
- // linear interpolation of eye/at using the spherical coordinates
- OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext);
- OLib_Vec3fDiffToVecSphGeo(&rwData->atEyeOffsetTarget, &rwData->atTarget, &rwData->eyeTarget);
+ // linear interpolation of eye/at using the geographic coordinates
+ OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&rwData->atEyeOffsetTarget, &rwData->atTarget, &rwData->eyeTarget);
invKeyFrameTimer = 1.0f / rwData->keyFrameTimer;
- scratchSph.r = F32_LERPIMP(eyeNextAtOffset.r, rwData->atEyeOffsetTarget.r, invKeyFrameTimer);
- scratchSph.pitch = eyeNextAtOffset.pitch +
+ scratchGeo.r = F32_LERPIMP(eyeNextAtOffset.r, rwData->atEyeOffsetTarget.r, invKeyFrameTimer);
+ scratchGeo.pitch = eyeNextAtOffset.pitch +
((s16)(rwData->atEyeOffsetTarget.pitch - eyeNextAtOffset.pitch) * invKeyFrameTimer);
- scratchSph.yaw =
+ scratchGeo.yaw =
eyeNextAtOffset.yaw + ((s16)(rwData->atEyeOffsetTarget.yaw - eyeNextAtOffset.yaw) * invKeyFrameTimer);
- Camera_Vec3fVecSphGeoAdd(&eyeTarget, at, &scratchSph);
+ Camera_AddVecGeoToVec3f(&eyeTarget, at, &scratchGeo);
goto setEyeNext;
case 2:
// linear interpolation of eye/at using the eyeTarget
@@ -5451,15 +5454,15 @@ s32 Camera_Unique9(Camera* camera) {
break;
case 4:
// linear interpolation of eye/at/fov/roll using the step scale, and spherical coordinates
- OLib_Vec3fDiffToVecSphGeo(&eyeNextAtOffset, at, eyeNext);
- OLib_Vec3fDiffToVecSphGeo(&rwData->atEyeOffsetTarget, &rwData->atTarget, &rwData->eyeTarget);
- scratchSph.r = Camera_LERPCeilF(rwData->atEyeOffsetTarget.r, eyeNextAtOffset.r,
+ OLib_Vec3fDiffToVecGeo(&eyeNextAtOffset, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&rwData->atEyeOffsetTarget, &rwData->atTarget, &rwData->eyeTarget);
+ scratchGeo.r = Camera_LERPCeilF(rwData->atEyeOffsetTarget.r, eyeNextAtOffset.r,
rwData->curKeyFrame->lerpStepScale, 0.1f);
- scratchSph.pitch = Camera_LERPCeilS(rwData->atEyeOffsetTarget.pitch, eyeNextAtOffset.pitch,
+ scratchGeo.pitch = Camera_LERPCeilS(rwData->atEyeOffsetTarget.pitch, eyeNextAtOffset.pitch,
rwData->curKeyFrame->lerpStepScale, 1);
- scratchSph.yaw = Camera_LERPCeilS(rwData->atEyeOffsetTarget.yaw, eyeNextAtOffset.yaw,
+ scratchGeo.yaw = Camera_LERPCeilS(rwData->atEyeOffsetTarget.yaw, eyeNextAtOffset.yaw,
rwData->curKeyFrame->lerpStepScale, 1);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &scratchSph);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &scratchGeo);
goto setAtFOVRoll;
case 3:
// linear interplation of eye/at/fov/roll using the step scale using eyeTarget
@@ -5485,26 +5488,26 @@ s32 Camera_Unique9(Camera* camera) {
camera->at.x = Camera_LERPCeilF(rwData->atTarget.x, camera->at.x, rwData->curKeyFrame->lerpStepScale, 1.0f);
camera->at.y += camera->playerPosDelta.y * rwData->curKeyFrame->lerpStepScale;
camera->at.z = Camera_LERPCeilF(rwData->atTarget.z, camera->at.z, rwData->curKeyFrame->lerpStepScale, 1.0f);
- OLib_Vec3fDiffToVecSphGeo(&scratchSph, at, eyeNext);
- scratchSph.yaw += CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.y);
+ OLib_Vec3fDiffToVecGeo(&scratchGeo, at, eyeNext);
+ scratchGeo.yaw += CAM_DEG_TO_BINANG(rwData->curKeyFrame->eyeTargetInit.y);
// 3A98 ~ 82.40 degrees
- if (scratchSph.pitch >= 0x3A99) {
- scratchSph.pitch = 0x3A98;
+ if (scratchGeo.pitch >= 0x3A99) {
+ scratchGeo.pitch = 0x3A98;
}
- if (scratchSph.pitch < -0x3A98) {
- scratchSph.pitch = -0x3A98;
+ if (scratchGeo.pitch < -0x3A98) {
+ scratchGeo.pitch = -0x3A98;
}
- spB4 = scratchSph.r;
+ spB4 = scratchGeo.r;
if (1) {}
- scratchSph.r = !(spB4 < rwData->curKeyFrame->eyeTargetInit.z)
+ scratchGeo.r = !(spB4 < rwData->curKeyFrame->eyeTargetInit.z)
? Camera_LERPCeilF(rwData->curKeyFrame->eyeTargetInit.z, spB4,
rwData->curKeyFrame->lerpStepScale, 1.0f)
- : scratchSph.r;
+ : scratchGeo.r;
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &scratchSph);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &scratchGeo);
camera->fov =
Camera_LERPCeilF(F32_LERPIMPINV(camera->fov, rwData->curKeyFrame->fovTargetInit, rwData->keyFrameTimer),
camera->fov, rwData->curKeyFrame->lerpStepScale, 1.0f);
@@ -5602,13 +5605,13 @@ void Camera_Vec3fCopy(Vec3f* src, Vec3f* dst) {
* Name from AC map: Camera2_CalcPos_Demo
*/
void Camera_RotateAroundPoint(PosRot* at, Vec3f* pos, Vec3f* dst) {
- VecSph posSph;
+ VecGeo posGeo;
Vec3f posCopy;
Camera_Vec3fCopy(pos, &posCopy);
- OLib_Vec3fToVecSphGeo(&posSph, &posCopy);
- posSph.yaw += at->rot.y;
- Camera_Vec3fVecSphGeoAdd(dst, &at->pos, &posSph);
+ OLib_Vec3fToVecGeo(&posGeo, &posCopy);
+ posGeo.yaw += at->rot.y;
+ Camera_AddVecGeoToVec3f(dst, &at->pos, &posGeo);
}
/**
@@ -5698,9 +5701,9 @@ s32 Camera_Demo3(Camera* camera) {
Vec3f* at = &camera->at;
Vec3f* eyeNext = &camera->eyeNext;
PosRot* camPlayerPosRot = &camera->playerPosRot;
- VecSph eyeAtOffset;
- VecSph eyeOffset;
- VecSph atOffset;
+ VecGeo eyeAtOffset;
+ VecGeo eyeOffset;
+ VecGeo atOffset;
Vec3f sp74;
Vec3f sp68;
Vec3f sp5C;
@@ -5727,7 +5730,7 @@ s32 Camera_Demo3(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, at, eye);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, at, eye);
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -5758,9 +5761,9 @@ s32 Camera_Demo3(Camera* camera) {
if (Camera_BGCheck(camera, &sp68, &sp74)) {
rwData->yawDir = -rwData->yawDir;
}
- OLib_Vec3fToVecSphGeo(&atOffset, &D_8011D678[0]);
+ OLib_Vec3fToVecGeo(&atOffset, &D_8011D678[0]);
atOffset.yaw += camPlayerPosRot->rot.y;
- Camera_Vec3fVecSphGeoAdd(at, &rwData->initialAt, &atOffset);
+ Camera_AddVecGeoToVec3f(at, &rwData->initialAt, &atOffset);
eyeOffset.r = D_8011D658[0].r;
eyeOffset.pitch = D_8011D658[0].pitch;
eyeOffset.yaw = (D_8011D658[0].yaw * rwData->yawDir) + camPlayerPosRot->rot.y;
@@ -5773,9 +5776,9 @@ s32 Camera_Demo3(Camera* camera) {
sp5C.y = F32_LERPIMP(D_8011D678[0].y, D_8011D678[1].y, temp_f0);
sp5C.z = F32_LERPIMP(D_8011D678[0].z, D_8011D678[1].z, temp_f0);
- OLib_Vec3fToVecSphGeo(&atOffset, &sp5C);
+ OLib_Vec3fToVecGeo(&atOffset, &sp5C);
atOffset.yaw = (atOffset.yaw * rwData->yawDir) + camPlayerPosRot->rot.y;
- Camera_Vec3fVecSphGeoAdd(at, &rwData->initialAt, &atOffset);
+ Camera_AddVecGeoToVec3f(at, &rwData->initialAt, &atOffset);
atOffset.r = F32_LERPIMP(D_8011D658[0].r, D_8011D658[1].r, temp_f0);
atOffset.pitch = BINANG_LERPIMP(D_8011D658[0].pitch, D_8011D658[1].pitch, temp_f0);
@@ -5795,9 +5798,9 @@ s32 Camera_Demo3(Camera* camera) {
sp5C.y += yOffset;
sp5C.z = F32_LERPIMP(D_8011D678[1].z, D_8011D678[2].z, temp_f0);
- OLib_Vec3fToVecSphGeo(&atOffset, &sp5C);
+ OLib_Vec3fToVecGeo(&atOffset, &sp5C);
atOffset.yaw = (atOffset.yaw * rwData->yawDir) + camPlayerPosRot->rot.y;
- Camera_Vec3fVecSphGeoAdd(at, &rwData->initialAt, &atOffset);
+ Camera_AddVecGeoToVec3f(at, &rwData->initialAt, &atOffset);
atOffset.r = F32_LERPIMP(D_8011D658[1].r, D_8011D658[2].r, temp_f0);
atOffset.pitch = BINANG_LERPIMP(D_8011D658[1].pitch, D_8011D658[2].pitch, temp_f0);
@@ -5816,9 +5819,9 @@ s32 Camera_Demo3(Camera* camera) {
sp5C.y += yOffset;
sp5C.z = F32_LERPIMP(D_8011D678[2].z, D_8011D678[3].z, temp_f0);
- OLib_Vec3fToVecSphGeo(&atOffset, &sp5C);
+ OLib_Vec3fToVecGeo(&atOffset, &sp5C);
atOffset.yaw = (atOffset.yaw * rwData->yawDir) + camPlayerPosRot->rot.y;
- Camera_Vec3fVecSphGeoAdd(at, &rwData->initialAt, &atOffset);
+ Camera_AddVecGeoToVec3f(at, &rwData->initialAt, &atOffset);
atOffset.r = F32_LERPIMP(D_8011D658[2].r, D_8011D658[3].r, temp_f0);
atOffset.pitch = BINANG_LERPIMP(D_8011D658[2].pitch, D_8011D658[3].pitch, temp_f0);
@@ -5896,7 +5899,7 @@ s32 Camera_Demo3(Camera* camera) {
eyeOffset.r = Camera_LERPCeilF(eyeOffset.r, eyeAtOffset.r, rwData->unk_0C, 2.0f);
eyeOffset.pitch = Camera_LERPCeilS(eyeOffset.pitch, eyeAtOffset.pitch, rwData->unk_0C, 0xA);
eyeOffset.yaw = Camera_LERPCeilS(eyeOffset.yaw, eyeAtOffset.yaw, rwData->unk_0C, 0xA);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeOffset);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeOffset);
*eye = *eyeNext;
}
@@ -5918,8 +5921,8 @@ s32 Camera_Demo4(Camera* camera) {
s32 Camera_Demo5(Camera* camera) {
f32 eyeTargetDist;
f32 sp90;
- VecSph playerTargetGeo;
- VecSph eyePlayerGeo;
+ VecGeo playerTargetGeo;
+ VecGeo eyePlayerGeo;
s16 targetScreenPosX;
s16 targetScreenPosY;
s32 pad1;
@@ -5943,11 +5946,11 @@ s32 Camera_Demo5(Camera* camera) {
return true;
}
Actor_GetFocus(&camera->targetPosRot, camera->target);
- OLib_Vec3fDiffToVecSphGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos);
+ OLib_Vec3fDiffToVecGeo(&playerTargetGeo, &camera->targetPosRot.pos, &camera->playerPosRot.pos);
D_8011D3AC = camera->target->category;
Actor_GetScreenPos(camera->play, camera->target, &targetScreenPosX, &targetScreenPosY);
eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye);
- OLib_Vec3fDiffToVecSphGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext);
+ OLib_Vec3fDiffToVecGeo(&eyePlayerGeo, &playerhead.pos, &camera->eyeNext);
sp4A = eyePlayerGeo.yaw - playerTargetGeo.yaw;
if (camera->target->category == ACTORCAT_PLAYER) {
// camera is targeting a(the) player actor
@@ -6151,7 +6154,7 @@ s32 Camera_Demo6(Camera* camera) {
Demo6ReadOnlyData* roData = &camera->paramData.demo6.roData;
Vec3f* eyeNext = &camera->eyeNext;
CameraModeValue* values;
- VecSph eyeOffset;
+ VecGeo eyeOffset;
Actor* camFocus;
PosRot focusPosRot;
s16 stateTimers[4];
@@ -6186,7 +6189,7 @@ s32 Camera_Demo6(Camera* camera) {
eyeOffset.yaw = Camera_XZAngle(&focusPosRot.pos, &mainCam->playerPosRot.pos) + 0x7D0;
// -0x3E8 ~5.49 degrees
eyeOffset.pitch = -0x3E8;
- Camera_Vec3fVecSphGeoAdd(eyeNext, &camera->at, &eyeOffset);
+ Camera_AddVecGeoToVec3f(eyeNext, &camera->at, &eyeOffset);
camera->eye = *eyeNext;
camera->animState++;
FALLTHROUGH;
@@ -6489,10 +6492,10 @@ s32 Camera_Special5(Camera* camera) {
s16 pad;
s16 spA4;
CamColChk sp7C;
- VecSph sp74;
- VecSph sp6C;
- VecSph sp64;
- VecSph sp5C;
+ VecGeo sp74;
+ VecGeo sp6C;
+ VecGeo sp64;
+ VecGeo sp5C;
PosRot* playerPosRot = &camera->playerPosRot;
Special5ReadOnlyData* roData = &camera->paramData.spec5.roData;
Special5ReadWriteData* rwData = &camera->paramData.spec5.rwData;
@@ -6519,8 +6522,8 @@ s32 Camera_Special5(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&sp64, at, eye);
- OLib_Vec3fDiffToVecSphGeo(&sp5C, at, eyeNext);
+ OLib_Vec3fDiffToVecGeo(&sp64, at, eye);
+ OLib_Vec3fDiffToVecGeo(&sp5C, at, eyeNext);
Actor_GetWorld(&spA8, camera->target);
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -6543,9 +6546,9 @@ s32 Camera_Special5(Camera* camera) {
sp6C.yaw = playerPosRot->rot.y;
sp6C.pitch = -playerPosRot->rot.x;
sp6C.r = 20.0f;
- Camera_Vec3fVecSphGeoAdd(&sp7C.pos, &spA8.pos, &sp6C);
+ Camera_AddVecGeoToVec3f(&sp7C.pos, &spA8.pos, &sp6C);
Camera_BGCheckInfo(camera, at, &sp7C);
- OLib_Vec3fToVecSphGeo(&sp6C, &sp7C.norm);
+ OLib_Vec3fToVecGeo(&sp6C, &sp7C.norm);
spA4 = playerPosRot->rot.y - sp6C.yaw;
sp74.r = roData->eyeDist;
temp_f0_2 = Rand_ZeroOne();
@@ -6553,7 +6556,7 @@ s32 Camera_Special5(Camera* camera) {
(s16)(playerPosRot->rot.y - 0x7FFF) + (s16)(spA4 < 0 ? -(s16)(0x1553 + (s16)(temp_f0_2 * 2730.0f))
: (s16)(0x1553 + (s16)(temp_f0_2 * 2730.0f)));
sp74.pitch = roData->pitch;
- Camera_Vec3fVecSphGeoAdd(eyeNext, &spA8.pos, &sp74);
+ Camera_AddVecGeoToVec3f(eyeNext, &spA8.pos, &sp74);
*eye = *eyeNext;
Camera_BGCheck(camera, &spA8.pos, eye);
}
@@ -6630,12 +6633,12 @@ s32 Camera_Special6(Camera* camera) {
Vec3f* eye = &camera->eye;
Vec3f* at = &camera->at;
Vec3f* eyeNext = &camera->eyeNext;
- VecSph atOffset;
+ VecGeo atOffset;
Vec3f bgCamPos;
Vec3f eyePosCalc;
Vec3f eyeAnim;
Vec3f atAnim;
- VecSph eyeAtOffset;
+ VecGeo eyeAtOffset;
PosRot* playerPosRot = &camera->playerPosRot;
BgCamFuncData* bgCamFuncData;
Vec3s bgCamRot;
@@ -6657,7 +6660,7 @@ s32 Camera_Special6(Camera* camera) {
Camera_CopyPREGToModeValues(camera);
}
- OLib_Vec3fDiffToVecSphGeo(&eyeAtOffset, eye, at);
+ OLib_Vec3fDiffToVecGeo(&eyeAtOffset, eye, at);
bgCamFuncData = (BgCamFuncData*)Camera_GetBgCamFuncData(camera);
Camera_Vec3sToVec3f(&bgCamPos, &bgCamFuncData->pos);
@@ -6700,7 +6703,7 @@ s32 Camera_Special6(Camera* camera) {
atOffset.r = 100.0f;
atOffset.yaw = bgCamRot.y;
atOffset.pitch = -bgCamRot.x;
- Camera_Vec3fVecSphGeoAdd(&atAnim, &eyeAnim, &atOffset);
+ Camera_AddVecGeoToVec3f(&atAnim, &eyeAnim, &atOffset);
timerDivisor = 1.0f / timerF;
eye->x += (eyeAnim.x - eye->x) * timerDivisor;
eye->y += (eyeAnim.y - eye->y) * timerDivisor;
@@ -6724,7 +6727,7 @@ s32 Camera_Special6(Camera* camera) {
atOffset.r = 100.0f;
atOffset.yaw = bgCamRot.y;
atOffset.pitch = -bgCamRot.x;
- Camera_Vec3fVecSphGeoAdd(at, eye, &atOffset);
+ Camera_AddVecGeoToVec3f(at, eye, &atOffset);
}
return true;
}
@@ -6739,8 +6742,8 @@ s32 Camera_Special9(Camera* camera) {
Vec3f* at = &camera->at;
Vec3f* eyeNext = &camera->eyeNext;
Vec3f spAC;
- VecSph eyeAdjustment;
- VecSph atEyeOffsetGeo;
+ VecGeo eyeAdjustment;
+ VecGeo atEyeOffsetGeo;
f32 playerYOffset;
s32 pad3;
PosRot* playerPosRot = &camera->playerPosRot;
@@ -6777,7 +6780,7 @@ s32 Camera_Special9(Camera* camera) {
adjustedPlayerPosRot.rot.x = 0;
}
- OLib_Vec3fDiffToVecSphGeo(&atEyeOffsetGeo, at, eye);
+ OLib_Vec3fDiffToVecGeo(&atEyeOffsetGeo, at, eye);
sCameraInterfaceFlags = roData->interfaceFlags;
@@ -6808,12 +6811,12 @@ s32 Camera_Special9(Camera* camera) {
yaw = 0xAAA * ((camera->play->state.frames & 1) ? 1 : -1);
eyeAdjustment.yaw = rwData->targetYaw + yaw;
eyeAdjustment.r = 200.0f * yNormal;
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeAdjustment);
spAC = *eye = *eyeNext;
if (Camera_CheckOOB(camera, &spAC, &playerPosRot->pos)) {
yaw = -yaw;
eyeAdjustment.yaw = rwData->targetYaw + yaw;
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeAdjustment);
*eye = *eyeNext;
}
}
@@ -6841,7 +6844,7 @@ s32 Camera_Special9(Camera* camera) {
eyeAdjustment.pitch = Camera_LERPCeilS(0xAAA, atEyeOffsetGeo.pitch, 0.3f, 0xA);
eyeAdjustment.yaw = Camera_LERPCeilS(rwData->targetYaw, atEyeOffsetGeo.yaw, 0.3f, 0xA);
eyeAdjustment.r = Camera_LERPCeilF(60.0f, atEyeOffsetGeo.r, 0.3f, 1.0f);
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeAdjustment);
*eye = *eyeNext;
doorParams->timer3--;
if (doorParams->timer3 <= 0) {
@@ -6972,7 +6975,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState
camera->up.y = 1.0f;
camera->up.z = camera->up.x = 0.0f;
- camera->skyboxOffset.x = camera->skyboxOffset.y = camera->skyboxOffset.z = 0;
+ camera->quakeOffset.x = camera->quakeOffset.y = camera->quakeOffset.z = 0;
camera->atLERPStepScale = 1;
sCameraInterfaceFlags = 0xFF00;
sDbgModeIdx = -1;
@@ -7014,7 +7017,7 @@ void Camera_Stub80058140(Camera* camera) {
void Camera_InitPlayerSettings(Camera* camera, Player* player) {
PosRot playerPosShape;
- VecSph eyeNextAtOffset;
+ VecGeo eyeNextAtOffset;
s32 bgId;
Vec3f floorPos;
s32 upXZ;
@@ -7042,7 +7045,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) {
camera->posOffset.y = playerYOffset;
camera->posOffset.z = 0;
- Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeNextAtOffset);
+ Camera_AddVecGeoToVec3f(eyeNext, at, &eyeNextAtOffset);
*eye = *eyeNext;
camera->roll = 0;
@@ -7185,11 +7188,11 @@ void Camera_PrintSettings(Camera* camera) {
s32 Camera_UpdateWater(Camera* camera) {
f32 waterY;
- s16 newQuakeId;
+ s16 quakeIndex;
s32 waterLightsIndex;
s32* waterCamSetting = &camera->waterCamSetting;
s16 waterBgCamIndex;
- s16* quakeId = (s16*)&camera->waterQuakeId;
+ s16* waterQuakeIndex = (s16*)&camera->waterQuakeIndex;
Player* player = camera->player;
s16 prevBgId;
@@ -7213,7 +7216,7 @@ s32 Camera_UpdateWater(Camera* camera) {
camera->unk_14C |= 0x200;
camera->waterYPos = waterY;
camera->bgCamIndexBeforeUnderwater = camera->bgCamIndex;
- *quakeId = -1;
+ *waterQuakeIndex = -1;
}
if (camera->playerGroundY != camera->playerPosRot.pos.y) {
prevBgId = camera->bgId;
@@ -7229,7 +7232,7 @@ s32 Camera_UpdateWater(Camera* camera) {
camera->unk_14C |= 0x200;
camera->waterYPos = waterY;
camera->bgCamIndexBeforeUnderwater = camera->bgCamIndex;
- *quakeId = -1;
+ *waterQuakeIndex = -1;
}
if (camera->playerGroundY != camera->playerPosRot.pos.y) {
prevBgId = camera->bgId;
@@ -7266,16 +7269,19 @@ s32 Camera_UpdateWater(Camera* camera) {
Audio_SetExtraFilter(0x20);
if (PREG(81)) {
- Quake_RemoveFromIdx(*quakeId);
- *quakeId = -1;
+ Quake_RemoveRequest(*waterQuakeIndex);
+ *waterQuakeIndex = -1;
PREG(81) = 0;
}
- if ((*quakeId == -1) || (Quake_GetCountdown(*quakeId) == 0xA)) {
- if (*quakeId = newQuakeId = Quake_Add(camera, 5U), newQuakeId != 0) {
- Quake_SetSpeed(*quakeId, 550);
- Quake_SetQuakeValues(*quakeId, 1, 1, 180, 0);
- Quake_SetCountdown(*quakeId, 1000);
+ if ((*waterQuakeIndex == -1) || (Quake_GetTimeLeft(*waterQuakeIndex) == 10)) {
+ quakeIndex = Quake_Request(camera, QUAKE_TYPE_5);
+
+ *waterQuakeIndex = quakeIndex;
+ if (quakeIndex != 0) {
+ Quake_SetSpeed(*waterQuakeIndex, 550);
+ Quake_SetPerturbations(*waterQuakeIndex, 1, 1, 180, 0);
+ Quake_SetDuration(*waterQuakeIndex, 1000);
}
}
@@ -7292,8 +7298,8 @@ s32 Camera_UpdateWater(Camera* camera) {
camera->unk_14C &= ~0x100;
osSyncPrintf("kankyo changed water off, sound off\n");
Environment_DisableUnderwaterLights(camera->play);
- if (*quakeId != 0) {
- Quake_RemoveFromIdx(*quakeId);
+ if (*waterQuakeIndex != 0) {
+ Quake_RemoveRequest(*waterQuakeIndex);
}
camera->waterDistortionTimer = 0;
camera->distortionFlags = 0;
@@ -7436,10 +7442,11 @@ Vec3s Camera_Update(Camera* camera) {
s32 bgId;
f32 playerGroundY;
f32 playerXZSpeed;
- VecSph eyeAtAngle;
+ VecGeo eyeAtAngle;
s16 bgCamIndex;
+ s16 numQuakesApplied;
PosRot curPlayerPosRot;
- QuakeCamCalc quake;
+ ShakeInfo camShake;
Player* player;
player = camera->play->cameraPtrs[CAM_ID_MAIN]->player;
@@ -7541,7 +7548,7 @@ Vec3s Camera_Update(Camera* camera) {
if (sOOBTimer < 200) {
sCameraFunctions[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx](camera);
} else if (camera->player != NULL) {
- OLib_Vec3fDiffToVecSphGeo(&eyeAtAngle, &camera->at, &camera->eye);
+ OLib_Vec3fDiffToVecGeo(&eyeAtAngle, &camera->at, &camera->eye);
Camera_CalcAtDefault(camera, &eyeAtAngle, 0.0f, 0);
}
@@ -7602,23 +7609,27 @@ Vec3s Camera_Update(Camera* camera) {
return camera->inputDir;
}
- // setting bgId to the ret of Quake_Calc, and checking that
- // is required, it doesn't make too much sense though.
- if ((bgId = Quake_Calc(camera, &quake), bgId != 0) && (camera->setting != CAM_SET_TURN_AROUND)) {
- viewAt.x = camera->at.x + quake.atOffset.x;
- viewAt.y = camera->at.y + quake.atOffset.y;
- viewAt.z = camera->at.z + quake.atOffset.z;
- viewEye.x = camera->eye.x + quake.eyeOffset.x;
- viewEye.y = camera->eye.y + quake.eyeOffset.y;
- viewEye.z = camera->eye.z + quake.eyeOffset.z;
- OLib_Vec3fDiffToVecSphGeo(&eyeAtAngle, &viewEye, &viewAt);
- Camera_CalcUpFromPitchYawRoll(&viewUp, eyeAtAngle.pitch + quake.rotZ, eyeAtAngle.yaw + quake.unk_1A,
- camera->roll);
- viewFov = camera->fov + CAM_BINANG_TO_DEG(quake.zoom);
+ numQuakesApplied = Quake_Update(camera, &camShake);
+
+ bgId = numQuakesApplied; // required to match
+
+ if ((numQuakesApplied != 0) && (camera->setting != CAM_SET_TURN_AROUND)) {
+ viewAt.x = camera->at.x + camShake.atOffset.x;
+ viewAt.y = camera->at.y + camShake.atOffset.y;
+ viewAt.z = camera->at.z + camShake.atOffset.z;
+
+ viewEye.x = camera->eye.x + camShake.eyeOffset.x;
+ viewEye.y = camera->eye.y + camShake.eyeOffset.y;
+ viewEye.z = camera->eye.z + camShake.eyeOffset.z;
+
+ OLib_Vec3fDiffToVecGeo(&eyeAtAngle, &viewEye, &viewAt);
+ Camera_CalcUpFromPitchYawRoll(&viewUp, eyeAtAngle.pitch + camShake.upPitchOffset,
+ eyeAtAngle.yaw + camShake.upYawOffset, camera->roll);
+ viewFov = camera->fov + CAM_BINANG_TO_DEG(camShake.fovOffset);
} else {
viewAt = camera->at;
viewEye = camera->eye;
- OLib_Vec3fDiffToVecSphGeo(&eyeAtAngle, &viewEye, &viewAt);
+ OLib_Vec3fDiffToVecGeo(&eyeAtAngle, &viewEye, &viewAt);
Camera_CalcUpFromPitchYawRoll(&viewUp, eyeAtAngle.pitch, eyeAtAngle.yaw, camera->roll);
viewFov = camera->fov;
}
@@ -7630,7 +7641,7 @@ Vec3s Camera_Update(Camera* camera) {
camera->up = viewUp;
}
- camera->skyboxOffset = quake.eyeOffset;
+ camera->quakeOffset = camShake.eyeOffset;
Camera_UpdateDistortion(camera);
@@ -8010,17 +8021,17 @@ s16 Camera_GetCamDirYaw(Camera* camera) {
return camDir.y;
}
-s32 Camera_AddQuake(Camera* camera, s32 arg1, s16 y, s32 countdown) {
- s16 quakeIdx;
+s32 Camera_RequestQuake(Camera* camera, s32 unused, s16 y, s32 duration) {
+ s16 quakeIndex;
- quakeIdx = Quake_Add(camera, 3);
- if (quakeIdx == 0) {
- return 0;
+ quakeIndex = Quake_Request(camera, QUAKE_TYPE_3);
+ if (quakeIndex == 0) {
+ return false;
}
- Quake_SetSpeed(quakeIdx, 0x61A8);
- Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0);
- Quake_SetCountdown(quakeIdx, countdown);
- return 1;
+ Quake_SetSpeed(quakeIndex, 0x61A8);
+ Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, duration);
+ return true;
}
s32 Camera_SetParam(Camera* camera, s32 param, void* value) {
@@ -8187,9 +8198,9 @@ s32 Camera_GetDbgCamEnabled(void) {
return gDbgCamEnabled;
}
-Vec3f* Camera_GetSkyboxOffset(Vec3f* dst, Camera* camera) {
- *dst = camera->skyboxOffset;
- return dst;
+Vec3f* Camera_GetQuakeOffset(Vec3f* quakeOffset, Camera* camera) {
+ *quakeOffset = camera->quakeOffset;
+ return quakeOffset;
}
void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3,
diff --git a/src/code/z_construct.c b/src/code/z_construct.c
index d7e7e7d0b6..c54c57b1c5 100644
--- a/src/code/z_construct.c
+++ b/src/code/z_construct.c
@@ -191,7 +191,7 @@ void Message_Init(PlayState* play) {
YREG(31) = 0;
}
-void func_80111070(void) {
+void Regs_InitDataImpl(void) {
YREG(8) = 10;
YREG(14) = 0;
R_SCENE_CAM_TYPE = SCENE_CAM_TYPE_DEFAULT;
@@ -603,6 +603,6 @@ void func_80111070(void) {
R_GAME_OVER_RUMBLE_DECREASE_RATE = -63;
}
-void func_80112098(PlayState* play) {
- func_80111070();
+void Regs_InitData(PlayState* play) {
+ Regs_InitDataImpl();
}
diff --git a/src/code/z_debug.c b/src/code/z_debug.c
index f654b0d69b..ac4de7bf9d 100644
--- a/src/code/z_debug.c
+++ b/src/code/z_debug.c
@@ -12,7 +12,7 @@ typedef struct {
u16 press;
} InputCombo; // size = 0x4
-GameInfo* gGameInfo;
+RegEditor* gRegEditor;
PrintTextBufferEntry sDebugPrintTextBuffer[22];
s16 sDebugPrintTextBufferNumUsed = 0;
@@ -92,18 +92,17 @@ char sRegGroupChars[REG_GROUPS] = {
'b', // bREG
};
-// Initialize GameInfo
-void func_800636C0(void) {
+void Regs_Init(void) {
s32 i;
- gGameInfo = SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 260);
- gGameInfo->regPage = 0;
- gGameInfo->regGroup = 0;
- gGameInfo->regCur = 0;
- gGameInfo->dPadInputPrev = 0;
- gGameInfo->inputRepeatTimer = 0;
- for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) {
- gGameInfo->data[i] = 0;
+ gRegEditor = SystemArena_MallocDebug(sizeof(RegEditor), "../z_debug.c", 260);
+ gRegEditor->regPage = 0;
+ gRegEditor->regGroup = 0;
+ gRegEditor->regCur = 0;
+ gRegEditor->dPadInputPrev = 0;
+ gRegEditor->inputRepeatTimer = 0;
+ for (i = 0; i < ARRAY_COUNT(gRegEditor->data); i++) {
+ gRegEditor->data[i] = 0;
}
}
@@ -154,9 +153,9 @@ void func_80063828(GfxPrint* printer) {
}
// Process inputs to control the reg editor
-void func_8006390C(Input* input) {
+void Regs_UpdateEditor(Input* input) {
s32 dPadInputCur;
- s32 pageDataStart = ((gGameInfo->regGroup * REG_PAGES) + gGameInfo->regPage - 1) * REGS_PER_PAGE;
+ s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE;
s32 increment;
s32 i;
@@ -173,16 +172,16 @@ void func_8006390C(Input* input) {
// If a combo corresponding to a reg group was found
if (i < REG_GROUPS) {
- if (i == gGameInfo->regGroup) {
+ if (i == gRegEditor->regGroup) {
// Same reg group as current, advance page index
- gGameInfo->regPage = (gGameInfo->regPage + 1) % (REG_PAGES + 1);
+ gRegEditor->regPage = (gRegEditor->regPage + 1) % (REG_PAGES + 1);
} else {
- gGameInfo->regGroup = i; // Switch current reg group
- gGameInfo->regPage = 0; // Disable reg editor
+ gRegEditor->regGroup = i; // Switch current reg group
+ gRegEditor->regPage = 0; // Disable reg editor
}
}
} else {
- switch (gGameInfo->regPage) {
+ switch (gRegEditor->regPage) {
case 1:
case 2:
case 3:
@@ -190,16 +189,16 @@ void func_8006390C(Input* input) {
case 5:
case 6:
- if (dPadInputCur == gGameInfo->dPadInputPrev) {
- gGameInfo->inputRepeatTimer--;
- if (gGameInfo->inputRepeatTimer < 0) {
- gGameInfo->inputRepeatTimer = 1;
+ if (dPadInputCur == gRegEditor->dPadInputPrev) {
+ gRegEditor->inputRepeatTimer--;
+ if (gRegEditor->inputRepeatTimer < 0) {
+ gRegEditor->inputRepeatTimer = 1;
} else {
- dPadInputCur ^= gGameInfo->dPadInputPrev;
+ dPadInputCur ^= gRegEditor->dPadInputPrev;
}
} else {
- gGameInfo->inputRepeatTimer = 16;
- gGameInfo->dPadInputPrev = dPadInputCur;
+ gRegEditor->inputRepeatTimer = 16;
+ gRegEditor->dPadInputPrev = dPadInputCur;
}
increment =
@@ -213,17 +212,17 @@ void func_8006390C(Input* input) {
: -1)
: 0;
- gGameInfo->data[gGameInfo->regCur + pageDataStart] += increment;
+ gRegEditor->data[gRegEditor->regCur + pageDataStart] += increment;
if (CHECK_BTN_ANY(dPadInputCur, BTN_DUP)) {
- gGameInfo->regCur--;
- if (gGameInfo->regCur < 0) {
- gGameInfo->regCur = REGS_PER_PAGE - 1;
+ gRegEditor->regCur--;
+ if (gRegEditor->regCur < 0) {
+ gRegEditor->regCur = REGS_PER_PAGE - 1;
}
} else if (CHECK_BTN_ANY(dPadInputCur, BTN_DDOWN)) {
- gGameInfo->regCur++;
- if (gGameInfo->regCur >= REGS_PER_PAGE) {
- gGameInfo->regCur = 0;
+ gRegEditor->regCur++;
+ if (gRegEditor->regCur >= REGS_PER_PAGE) {
+ gRegEditor->regCur = 0;
}
}
@@ -241,28 +240,28 @@ void func_8006390C(Input* input) {
}
// Draw the reg editor
-void func_80063C04(GfxPrint* printer) {
+void Regs_DrawEditor(GfxPrint* printer) {
s32 i;
- s32 pageStart = (gGameInfo->regPage - 1) * REGS_PER_PAGE;
- s32 pageDataStart = ((gGameInfo->regGroup * REG_PAGES) + gGameInfo->regPage - 1) * REGS_PER_PAGE;
+ s32 pageStart = (gRegEditor->regPage - 1) * REGS_PER_PAGE;
+ s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE;
s32 pad;
char regGroupName[3];
regGroupName[0] = 'R';
- regGroupName[1] = sRegGroupChars[gGameInfo->regGroup];
+ regGroupName[1] = sRegGroupChars[gRegEditor->regGroup];
regGroupName[2] = '\0';
GfxPrint_SetColor(printer, 0, 128, 128, 128);
for (i = 0; i < REGS_PER_PAGE; i++) {
- if (i == gGameInfo->regCur) {
+ if (i == gRegEditor->regCur) {
GfxPrint_SetColor(printer, 0, 255, 255, 255);
}
GfxPrint_SetPos(printer, 3, i + 5);
- GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gGameInfo->data[i + pageDataStart]);
+ GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gRegEditor->data[i + pageDataStart]);
- if (i == gGameInfo->regCur) {
+ if (i == gRegEditor->regCur) {
GfxPrint_SetColor(printer, 0, 128, 128, 128);
}
}
@@ -286,8 +285,8 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
func_80063828(&printer);
}
- if (gGameInfo->regPage != 0) {
- func_80063C04(&printer);
+ if (gRegEditor->regPage != 0) {
+ Regs_DrawEditor(&printer);
}
sDebugPrintTextBufferNumUsed = 0;
diff --git a/src/code/z_demo.c b/src/code/z_demo.c
index 9af0c6f930..9aba6c7fec 100644
--- a/src/code/z_demo.c
+++ b/src/code/z_demo.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "quake.h"
#include "z64camera.h"
#include "assets/scenes/indoors/tokinoma/tokinoma_scene.h"
@@ -60,10 +61,10 @@ EntranceCutscene sEntranceCutsceneTable[] = {
{ ENTR_SPOT18_0, 2, EVENTCHKINF_A6, gGoronCityIntroCs },
{ ENTR_TOKINOMA_0, 2, EVENTCHKINF_A7, gTempleOfTimeIntroCs },
{ ENTR_YDAN_0, 2, EVENTCHKINF_A8, gDekuTreeIntroCs },
- { ENTR_SPOT00_11, 0, EVENTCHKINF_18, gHyruleFieldSouthEponaJumpCs },
- { ENTR_SPOT00_13, 0, EVENTCHKINF_18, gHyruleFieldEastEponaJumpCs },
- { ENTR_SPOT00_12, 0, EVENTCHKINF_18, gHyruleFieldWestEponaJumpCs },
- { ENTR_SPOT00_15, 0, EVENTCHKINF_18, gHyruleFieldGateEponaJumpCs },
+ { ENTR_SPOT00_11, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldSouthEponaJumpCs },
+ { ENTR_SPOT00_13, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldEastEponaJumpCs },
+ { ENTR_SPOT00_12, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldWestEponaJumpCs },
+ { ENTR_SPOT00_15, 0, EVENTCHKINF_EPONA_OBTAINED, gHyruleFieldGateEponaJumpCs },
{ ENTR_SPOT00_16, 1, EVENTCHKINF_A9, gHyruleFieldGetOoTCs },
{ ENTR_SPOT06_0, 2, EVENTCHKINF_B1, gLakeHyliaIntroCs },
{ ENTR_SPOT09_0, 2, EVENTCHKINF_B2, gGerudoValleyIntroCs },
@@ -311,15 +312,15 @@ void func_80064824(PlayState* play, CutsceneContext* csCtx, CsCmdBase* cmd) {
break;
case 16:
if (sp3F != 0) {
- sQuakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 6);
+ sQuakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_6);
Quake_SetSpeed(sQuakeIndex, 0x7FFF);
- Quake_SetQuakeValues(sQuakeIndex, 4, 0, 1000, 0);
- Quake_SetCountdown(sQuakeIndex, 800);
+ Quake_SetPerturbations(sQuakeIndex, 4, 0, 1000, 0);
+ Quake_SetDuration(sQuakeIndex, 800);
}
break;
case 17:
if (sp3F != 0) {
- Quake_RemoveFromIdx(sQuakeIndex);
+ Quake_RemoveRequest(sQuakeIndex);
}
break;
case 18:
@@ -2060,7 +2061,7 @@ void Cutscene_HandleEntranceTriggers(PlayState* play) {
}
if ((gSaveContext.entranceIndex == entranceCutscene->entrance) &&
- (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_18)) &&
+ (!Flags_GetEventChkInf(entranceCutscene->flag) || (entranceCutscene->flag == EVENTCHKINF_EPONA_OBTAINED)) &&
(gSaveContext.cutsceneIndex < 0xFFF0) && ((u8)gSaveContext.linkAge == requiredAge) &&
(gSaveContext.respawnFlag <= 0)) {
Flags_SetEventChkInf(entranceCutscene->flag);
diff --git a/src/code/z_horse.c b/src/code/z_horse.c
index 27cca3d2e9..e1b316dffc 100644
--- a/src/code/z_horse.c
+++ b/src/code/z_horse.c
@@ -48,7 +48,7 @@ void func_8006D0EC(PlayState* play, Player* player) {
{ SCENE_SPOT20, 928, 0, -2280, 0, 2 },
};
- if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0))) {
+ if ((AREG(6) != 0) && (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0))) {
player->rideActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, player->actor.world.pos.x,
player->actor.world.pos.y, player->actor.world.pos.z, player->actor.shape.rot.x,
player->actor.shape.rot.y, player->actor.shape.rot.z, 9);
@@ -67,15 +67,15 @@ void func_8006D0EC(PlayState* play, Player* player) {
gSaveContext.minigameState = 0;
horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 3586.0f, 1413.0f, -402.0f, 0, 0x4000, 0, 1);
horseActor->room = -1;
- } else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ } else if ((gSaveContext.entranceIndex == ENTR_SPOT20_7) && GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
Actor* horseActor =
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, -25.0f, 0.0f, -1600.0f, 0, -0x4000, 0, 1);
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 389);
} else if ((play->sceneId == gSaveContext.horseData.sceneId) &&
- (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0)) {
+ (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1) != 0)) {
// "Set by existence of horse %d %d %d"
osSyncPrintf("馬存在によるセット %d %d %d\n", gSaveContext.horseData.sceneId,
- Flags_GetEventChkInf(EVENTCHKINF_18), DREG(1));
+ Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED), DREG(1));
if (func_8006CFC0(gSaveContext.horseData.sceneId)) {
Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, gSaveContext.horseData.pos.x,
@@ -92,10 +92,10 @@ void func_8006D0EC(PlayState* play, Player* player) {
osSyncPrintf(VT_RST);
func_8006D074(play);
}
- } else if ((play->sceneId == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
+ } else if ((play->sceneId == SCENE_SPOT20) && !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) {
Actor* horseActor = Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -500.0f, 0, 0, 0, 1);
ASSERT(horseActor != NULL, "horse_actor != NULL", "../z_horse.c", 443);
- } else if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) {
+ } else if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) {
for (i = 0; i < ARRAY_COUNT(horseSpawns); i++) {
HorseSpawn* horseSpawn = &horseSpawns[i];
if (horseSpawn->sceneId == play->sceneId) {
@@ -110,7 +110,7 @@ void func_8006D0EC(PlayState* play, Player* player) {
break;
}
}
- } else if (!Flags_GetEventChkInf(EVENTCHKINF_18)) {
+ } else if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) {
if ((DREG(1) == 0) && (play->sceneId == SCENE_SOUKO) && !IS_DAY) {
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 0.0f, 0.0f, -60.0f, 0, 0x7360, 0, 1);
}
@@ -158,7 +158,7 @@ void func_8006D684(PlayState* play, Player* player) {
func_8002DE74(play, player);
gSaveContext.horseData.sceneId = play->sceneId;
} else if ((play->sceneId == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
- !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
+ !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) {
player->rideActor =
Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, 894.0f, 0.0f, -2084.0f, 0, -0x7FFF, 0, 5);
ASSERT(player->rideActor != NULL, "player->ride.actor != NULL", "../z_horse.c", 582);
@@ -252,7 +252,7 @@ void func_8006DC68(PlayState* play, Player* player) {
gSaveContext.entranceIndex == ENTR_SPOT00_13 || gSaveContext.entranceIndex == ENTR_SPOT00_15) &&
(gSaveContext.respawnFlag == 0)) ||
((play->sceneId == SCENE_SPOT20) && (GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6) &&
- !Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0))) {
+ !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0))) {
func_8006D684(play, player);
} else {
func_8006D0EC(play, player);
diff --git a/src/code/z_lights.c b/src/code/z_lights.c
index 4557b63342..d0679c56f5 100644
--- a/src/code/z_lights.c
+++ b/src/code/z_lights.c
@@ -147,7 +147,7 @@ void Lights_BindDirectional(Lights* lights, LightParams* params, Vec3f* vec) {
* a light to it. Then apply color and positional/directional info for each light
* based on the parameters supplied by the node.
*
- * Note: Lights in a given list can only be binded to however many free slots are
+ * Note: Lights in a given list can only be bound to however many free slots are
* available in the Lights group. This is at most 7 slots for a new group, but could be less.
*/
void Lights_BindAll(Lights* lights, LightNode* listHead, Vec3f* vec) {
@@ -217,7 +217,7 @@ void LightContext_SetFog(LightContext* lightCtx, u8 r, u8 g, u8 b, s16 fogNear,
}
/**
- * Allocate a new Lights group and initilize the ambient color with that provided by LightContext
+ * Allocate a new Lights group and initialize the ambient color with that provided by LightContext
*/
Lights* LightContext_NewLights(LightContext* lightCtx, GraphicsContext* gfxCtx) {
return Lights_New(gfxCtx, lightCtx->ambientColor[0], lightCtx->ambientColor[1], lightCtx->ambientColor[2]);
diff --git a/src/code/z_olib.c b/src/code/z_olib.c
index 0bfb0d2f22..e89a0b348d 100644
--- a/src/code/z_olib.c
+++ b/src/code/z_olib.c
@@ -93,16 +93,16 @@ Vec3f* OLib_VecSphToVec3f(Vec3f* dest, VecSph* sph) {
}
/**
- * Takes the geographic point `sph` and converts it into a x,y,z position
+ * Takes the geographic point `geo` and converts it into a x,y,z position
*/
-Vec3f* OLib_VecSphGeoToVec3f(Vec3f* dest, VecSph* sph) {
- VecSph geo;
+Vec3f* OLib_VecGeoToVec3f(Vec3f* dest, VecGeo* geo) {
+ VecSph sph;
- geo.r = sph->r;
- geo.pitch = 0x3FFF - sph->pitch;
- geo.yaw = sph->yaw;
+ sph.r = geo->r;
+ sph.pitch = 0x3FFF - geo->pitch;
+ sph.yaw = geo->yaw;
- return OLib_VecSphToVec3f(dest, &geo);
+ return OLib_VecSphToVec3f(dest, &sph);
}
/**
@@ -110,17 +110,16 @@ Vec3f* OLib_VecSphGeoToVec3f(Vec3f* dest, VecSph* sph) {
*/
VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
VecSph sph;
+ f32 distXZSq = SQ(vec->x) + SQ(vec->z);
+ f32 distXZ = sqrtf(distXZSq);
- f32 distSquared = SQ(vec->x) + SQ(vec->z);
- f32 dist = sqrtf(distSquared);
-
- if ((dist == 0.0f) && (vec->y == 0.0f)) {
+ if ((distXZ == 0.0f) && (vec->y == 0.0f)) {
sph.pitch = 0;
} else {
- sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(dist, vec->y)));
+ sph.pitch = CAM_DEG_TO_BINANG(RAD_TO_DEG(Math_FAtan2F(distXZ, vec->y)));
}
- sph.r = sqrtf(SQ(vec->y) + distSquared);
+ sph.r = sqrtf(SQ(vec->y) + distXZSq);
if ((vec->x == 0.0f) && (vec->z == 0.0f)) {
sph.yaw = 0;
} else {
@@ -135,7 +134,7 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec) {
/**
* Takes the point `vec`, and converts it to a geographic coordinate
*/
-VecSph* OLib_Vec3fToVecSphGeo(VecSph* dest, Vec3f* vec) {
+VecGeo* OLib_Vec3fToVecGeo(VecGeo* dest, Vec3f* vec) {
VecSph sph;
OLib_Vec3fToVecSph(&sph, vec);
@@ -150,26 +149,26 @@ VecSph* OLib_Vec3fToVecSphGeo(VecSph* dest, Vec3f* vec) {
* Takes the differences of positions `a` and `b`, and converts them to spherical coordinates
*/
VecSph* OLib_Vec3fDiffToVecSph(VecSph* dest, Vec3f* a, Vec3f* b) {
- Vec3f sph;
+ Vec3f diff;
- sph.x = b->x - a->x;
- sph.y = b->y - a->y;
- sph.z = b->z - a->z;
+ diff.x = b->x - a->x;
+ diff.y = b->y - a->y;
+ diff.z = b->z - a->z;
- return OLib_Vec3fToVecSph(dest, &sph);
+ return OLib_Vec3fToVecSph(dest, &diff);
}
/**
* Takes the difference of positions `a` and `b`, and converts them to geographic coordinates
*/
-VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* dest, Vec3f* a, Vec3f* b) {
- Vec3f sph;
+VecGeo* OLib_Vec3fDiffToVecGeo(VecGeo* dest, Vec3f* a, Vec3f* b) {
+ Vec3f diff;
- sph.x = b->x - a->x;
- sph.y = b->y - a->y;
- sph.z = b->z - a->z;
+ diff.x = b->x - a->x;
+ diff.y = b->y - a->y;
+ diff.z = b->z - a->z;
- return OLib_Vec3fToVecSphGeo(dest, &sph);
+ return OLib_Vec3fToVecGeo(dest, &diff);
}
/**
diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c
index e28448f3b3..dc3a67531f 100644
--- a/src/code/z_onepointdemo.c
+++ b/src/code/z_onepointdemo.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Sw/z_en_sw.h"
@@ -8,17 +9,19 @@ static s32 sPrevFrameCs1100 = -4096;
#include "z_onepointdemo_data.inc.c"
-void OnePointCutscene_AddVecSphToVec3f(Vec3f* dst, Vec3f* src, VecSph* vecSph) {
- Vec3f out;
- Vec3f vec;
+Vec3f* OnePointCutscene_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) {
+ Vec3f sum;
+ Vec3f b;
- OLib_VecSphGeoToVec3f(&vec, vecSph);
+ OLib_VecGeoToVec3f(&b, geo);
- out.x = src->x + vec.x;
- out.y = src->y + vec.y;
- out.z = src->z + vec.z;
- if (dst) {}
- *dst = out;
+ sum.x = a->x + b.x;
+ sum.y = a->y + b.y;
+ sum.z = a->z + b.z;
+
+ *dest = sum;
+
+ return dest;
}
s16 OnePointCutscene_Vec3fYaw(Vec3f* vec1, Vec3f* vec2) {
@@ -61,7 +64,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
Camera* childCam = play->cameraPtrs[subCam->childCamId];
Camera* mainCam = play->cameraPtrs[CAM_ID_MAIN];
Player* player = mainCam->player;
- VecSph spD0;
+ VecGeo spD0;
s32 i;
Vec3f spC0;
Vec3f spB4;
@@ -94,7 +97,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
D_80120964[0].atTargetInit = play->view.at;
D_80120964[0].eyeTargetInit = play->view.eye;
D_80120964[0].fovTargetInit = play->view.fovy;
- OLib_Vec3fDiffToVecSphGeo(&spD0, &mainCam->at, &mainCam->eye);
+ OLib_Vec3fDiffToVecGeo(&spD0, &mainCam->at, &mainCam->eye);
D_80120964[1].eyeTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw);
D_80120964[1].timerInit = timer - 1;
@@ -107,9 +110,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = play->view.at;
D_801209B4[0].eyeTargetInit = play->view.eye;
D_801209B4[0].fovTargetInit = D_801209B4[2].fovTargetInit = play->view.fovy;
- OLib_Vec3fDiffToVecSphGeo(&spD0, &actor->focus.pos, &mainCam->at);
+ OLib_Vec3fDiffToVecGeo(&spD0, &actor->focus.pos, &mainCam->at);
spD0.r = mainCam->dist;
- OnePointCutscene_AddVecSphToVec3f(&D_801209B4[1].eyeTargetInit, &D_801209B4[1].atTargetInit, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&D_801209B4[1].eyeTargetInit, &D_801209B4[1].atTargetInit, &spD0);
D_801209B4[1].atTargetInit.y += 20.0f;
csInfo->keyFrames = D_801209B4;
@@ -156,10 +159,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne();
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 5);
+ i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
- Quake_SetQuakeValues(i, 4, 5, 40, 0x3C);
- Quake_SetCountdown(i, 1600);
+ Quake_SetPerturbations(i, 4, 5, 40, 0x3C);
+ Quake_SetDuration(i, 1600);
break;
case 2280:
csInfo->keyFrames = D_80120D4C;
@@ -177,10 +180,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne();
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 5);
+ i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
- Quake_SetQuakeValues(i, 2, 3, 200, 0x32);
- Quake_SetCountdown(i, 9999);
+ Quake_SetPerturbations(i, 2, 3, 200, 0x32);
+ Quake_SetDuration(i, 9999);
break;
case 2220:
csInfo->keyFrames = D_80120E64;
@@ -188,10 +191,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 5);
+ i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
- Quake_SetQuakeValues(i, 2, 2, 50, 0);
- Quake_SetCountdown(i, 280);
+ Quake_SetPerturbations(i, 2, 2, 50, 0);
+ Quake_SetDuration(i, 280);
break;
case 2230:
if (player->actor.world.pos.z < 1000.0f) {
@@ -210,10 +213,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 5);
+ i = Quake_Request(subCam, QUAKE_TYPE_5);
Quake_SetSpeed(i, 400);
- Quake_SetQuakeValues(i, 2, 2, 50, 0);
- Quake_SetCountdown(i, 60);
+ Quake_SetPerturbations(i, 2, 2, 50, 0);
+ Quake_SetDuration(i, 60);
break;
case 2350:
csInfo->keyFrames = D_8012110C;
@@ -297,7 +300,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
spD0.yaw = spA0.rot.y;
spD0.pitch = 0x3E8;
- OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
func_8002DF54(play, NULL, 8);
@@ -308,7 +311,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
}
break;
case 2210:
- OLib_Vec3fDiffToVecSphGeo(&spD0, &player->actor.world.pos, &actor->world.pos);
+ OLib_Vec3fDiffToVecGeo(&spD0, &player->actor.world.pos, &actor->world.pos);
D_801213B4[0].eyeTargetInit.y = D_801213B4[1].eyeTargetInit.y = D_801213B4[2].eyeTargetInit.y =
D_801213B4[2].atTargetInit.y = CAM_BINANG_TO_DEG(spD0.yaw);
if (Rand_ZeroOne() < 0.0f) {
@@ -397,10 +400,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 3);
+ i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 22000);
- Quake_SetQuakeValues(i, 2, 0, 200, 0);
- Quake_SetCountdown(i, 10);
+ Quake_SetPerturbations(i, 2, 0, 200, 0);
+ Quake_SetDuration(i, 10);
break;
case 3080:
csInfo->keyFrames = D_80121774;
@@ -435,10 +438,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 24000);
- Quake_SetQuakeValues(i, 2, 0, 0, 0);
- Quake_SetCountdown(i, 160);
+ Quake_SetPerturbations(i, 2, 0, 0, 0);
+ Quake_SetDuration(i, 160);
break;
case 3060:
csInfo->keyFrames = D_80121904;
@@ -467,10 +470,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
D_8012021C[D_801202FC - 3].pos.z +=
(D_8012021C[D_801202FC - 2].pos.z - D_8012021C[D_801202FC - 3].pos.z) / 2;
- i = Quake_Add(mainCam, 3);
+ i = Quake_Request(mainCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 30000);
- Quake_SetQuakeValues(i, 2, 1, 1, 0);
- Quake_SetCountdown(i, 200);
+ Quake_SetPerturbations(i, 2, 1, 1, 0);
+ Quake_SetDuration(i, 200);
break;
case 3120:
csInfo->keyFrames = D_80121954[-(timer + 101)];
@@ -520,7 +523,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
spD0.r = 250.0f;
Actor_GetWorld(&spA0, &player->actor);
spD0.yaw = OnePointCutscene_Vec3fYaw(&spC0, &spA0.pos) - 0x7D0;
- OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
Play_CopyCamera(play, CAM_ID_MAIN, subCamId);
@@ -534,7 +537,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
spD0.pitch = 0;
spD0.yaw = spA0.rot.y;
spD0.r = 150.0f;
- OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
subCam->roll = 0;
@@ -548,7 +551,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
spD0.r = 300.0f;
spD0.yaw = spA0.rot.y;
spD0.pitch = -0xAF0;
- OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
subCam->roll = 0;
@@ -577,16 +580,16 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
spC0.x = sp8C.pos.x;
spC0.y = sp8C.pos.y + 70.0f;
spC0.z = sp8C.pos.z;
- OLib_Vec3fDiffToVecSphGeo(&spD0, &spA0.pos, &sp8C.pos);
+ OLib_Vec3fDiffToVecGeo(&spD0, &spA0.pos, &sp8C.pos);
spD0.pitch = 0x5DC;
spD0.r = 120.0f;
- OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
Play_CameraSetAtEye(play, CAM_ID_MAIN, &spC0, &spB4);
- i = Quake_Add(subCam, 3);
+ i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 22000);
- Quake_SetQuakeValues(i, 1, 0, 0, 0);
- Quake_SetCountdown(i, 90);
+ Quake_SetPerturbations(i, 1, 0, 0, 0);
+ Quake_SetDuration(i, 90);
break;
case 6010:
Actor_GetWorld(&spA0, actor);
@@ -595,7 +598,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
spC0.y += 70.0f;
spD0.yaw = spA0.rot.y + 0x7FFF;
spD0.r = 300.0f;
- OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2);
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
subCam->roll = 0;
@@ -607,10 +610,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
spC0 = spA0.pos;
func_800C0808(play, subCamId, player, CAM_SET_PIVOT_VERTICAL);
Actor_GetWorld(&spA0, &player->actor);
- OLib_Vec3fDiffToVecSphGeo(&spD0, &spC0, &spA0.pos);
+ OLib_Vec3fDiffToVecGeo(&spD0, &spC0, &spA0.pos);
spD0.yaw += 0x3E8;
spD0.r = 400.0f;
- OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0);
+ OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0);
spB4.y = spA0.pos.y + 60.0f;
Play_CameraSetAtEye(play, subCamId, &spC0, &spB4);
subCam->roll = 0;
@@ -637,10 +640,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
OnePointCutscene_SetCsCamPoints(subCam, D_801208E8, D_801208E4, D_801206A0, D_80120760);
}
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
- Quake_SetQuakeValues(i, 0, 0, 20, 0);
- Quake_SetCountdown(i, D_801208E4 - 10);
+ Quake_SetPerturbations(i, 0, 0, 20, 0);
+ Quake_SetDuration(i, D_801208E4 - 10);
break;
case 3400:
Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3);
@@ -649,10 +652,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos);
OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_801204D4[D_80120694 - 2].pos);
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 0x4E20);
- Quake_SetQuakeValues(i, 1, 0, 50, 0);
- Quake_SetCountdown(i, D_80120698 - 20);
+ Quake_SetPerturbations(i, 1, 0, 50, 0);
+ Quake_SetDuration(i, D_80120698 - 20);
break;
case 3390:
player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = -0x3FD9;
@@ -668,10 +671,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
Play_CopyCamera(play, subCamId, CAM_ID_MAIN);
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
- Quake_SetQuakeValues(i, 2, 0, 0, 0);
- Quake_SetCountdown(i, timer);
+ Quake_SetPerturbations(i, 2, 0, 0, 0);
+ Quake_SetDuration(i, timer);
break;
case 3290:
D_80121F1C[0].atTargetInit = play->view.at;
@@ -685,10 +688,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 3);
+ i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
- Quake_SetQuakeValues(i, 0, 0, 1000, 0);
- Quake_SetCountdown(i, 5);
+ Quake_SetPerturbations(i, 0, 0, 1000, 0);
+ Quake_SetDuration(i, 5);
break;
case 3340:
D_80121FBC[0].atTargetInit = play->view.at;
@@ -701,10 +704,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 3);
+ i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
- Quake_SetQuakeValues(i, 0, 0, 1000, 0);
- Quake_SetCountdown(i, 5);
+ Quake_SetPerturbations(i, 0, 0, 1000, 0);
+ Quake_SetDuration(i, 5);
break;
case 3360:
csInfo->keyFrames = D_8012205C;
@@ -746,10 +749,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
- Quake_SetQuakeValues(i, 4, 0, 0, 0);
- Quake_SetCountdown(i, 20);
+ Quake_SetPerturbations(i, 4, 0, 0, 0);
+ Quake_SetDuration(i, 20);
break;
case 3450:
csInfo->keyFrames = D_8012237C;
@@ -758,10 +761,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF38(play, &player->actor, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
- Quake_SetQuakeValues(i, 2, 0, 0, 0);
- Quake_SetCountdown(i, 10);
+ Quake_SetPerturbations(i, 2, 0, 0, 0);
+ Quake_SetDuration(i, 10);
break;
case 3440:
csInfo->keyFrames = D_801223CC;
@@ -772,10 +775,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
player->stateFlags1 |= PLAYER_STATE1_29;
player->actor.freezeTimer = 90;
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
- Quake_SetQuakeValues(i, 2, 0, 0, 0);
- Quake_SetCountdown(i, 10);
+ Quake_SetPerturbations(i, 2, 0, 0, 0);
+ Quake_SetDuration(i, 10);
break;
case 3430:
csInfo->keyFrames = D_801224BC;
@@ -784,10 +787,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_8002DF54(play, NULL, 8);
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 1);
+ i = Quake_Request(subCam, QUAKE_TYPE_1);
Quake_SetSpeed(i, 32000);
- Quake_SetQuakeValues(i, 1, 0, 10, 0);
- Quake_SetCountdown(i, 20);
+ Quake_SetPerturbations(i, 1, 0, 10, 0);
+ Quake_SetDuration(i, 20);
break;
case 4100:
csInfo->keyFrames = D_801225D4;
@@ -867,10 +870,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
- i = Quake_Add(subCam, 3);
+ i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
- Quake_SetQuakeValues(i, 0, 1, 100, 0);
- Quake_SetCountdown(i, timer - 80);
+ Quake_SetPerturbations(i, 0, 1, 100, 0);
+ Quake_SetDuration(i, timer - 80);
break;
case 4220:
csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64;
@@ -879,10 +882,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
func_800C0808(play, subCamId, player, CAM_SET_CS_C);
func_8002DF38(play, &player->actor, 1);
- i = Quake_Add(subCam, 3);
+ i = Quake_Request(subCam, QUAKE_TYPE_3);
Quake_SetSpeed(i, 12000);
- Quake_SetQuakeValues(i, 0, 1, 10, 0);
- Quake_SetCountdown(i, timer - 10);
+ Quake_SetPerturbations(i, 0, 1, 10, 0);
+ Quake_SetDuration(i, timer - 10);
break;
case 4221:
csInfo->keyFrames = D_80122C8C;
@@ -970,12 +973,12 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act
D_801231B4[2].atTargetInit.z = 0.0f;
}
Actor_GetWorldPosShapeRot(&spA0, &player->actor);
- OLib_Vec3fDiffToVecSphGeo(&spD0, &spA0.pos, &mainCam->at);
+ OLib_Vec3fDiffToVecGeo(&spD0, &spA0.pos, &mainCam->at);
spD0.yaw -= spA0.rot.y;
- OLib_VecSphGeoToVec3f(&D_801231B4[3].atTargetInit, &spD0);
- OLib_Vec3fDiffToVecSphGeo(&spD0, &spA0.pos, &mainCam->eye);
+ OLib_VecGeoToVec3f(&D_801231B4[3].atTargetInit, &spD0);
+ OLib_Vec3fDiffToVecGeo(&spD0, &spA0.pos, &mainCam->eye);
spD0.yaw -= spA0.rot.y;
- OLib_VecSphGeoToVec3f(&D_801231B4[3].eyeTargetInit, &spD0);
+ OLib_VecGeoToVec3f(&D_801231B4[3].eyeTargetInit, &spD0);
D_801231B4[3].fovTargetInit = mainCam->fov;
D_801231B4[3].timerInit = timer - 50;
diff --git a/src/code/z_play.c b/src/code/z_play.c
index d9713f4767..5377c932fb 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "quake.h"
#include "vt.h"
void* D_8012D1F0 = NULL;
@@ -256,7 +257,7 @@ void Play_Init(GameState* thisx) {
this->activeCamId = CAM_ID_MAIN;
func_8005AC48(&this->mainCamera, 0xFF);
Sram_Init(this, &this->sramCtx);
- func_80112098(this);
+ Regs_InitData(this);
Message_Init(this);
GameOver_Init(this);
SfxSource_InitAll(this);
@@ -1182,11 +1183,11 @@ void Play_Draw(PlayState* this) {
if ((HREG(80) != 10) || (HREG(83) != 0)) {
if ((this->skyboxCtx.unk_140 != 0) && (GET_ACTIVE_CAM(this)->setting != CAM_SET_PREREND_FIXED)) {
- Vec3f sp74;
+ Vec3f quakeOffset;
- Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(this));
- SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + sp74.x,
- this->view.eye.y + sp74.y, this->view.eye.z + sp74.z);
+ Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(this));
+ SkyboxDraw_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x + quakeOffset.x,
+ this->view.eye.y + quakeOffset.y, this->view.eye.z + quakeOffset.z);
}
}
diff --git a/src/code/z_quake.c b/src/code/z_quake.c
index 02fb8e63d4..0f50b598b4 100644
--- a/src/code/z_quake.c
+++ b/src/code/z_quake.c
@@ -1,280 +1,362 @@
#include "global.h"
+#include "quake.h"
#include "vt.h"
-QuakeRequest sQuakeRequest[4];
-s16 D_80126250 = 1;
+typedef struct {
+ /* 0x00 */ s16 index;
+ /* 0x02 */ s16 duration;
+ /* 0x04 */ Camera* cam;
+ /* 0x08 */ u32 type;
+ /* 0x0C */ s16 y;
+ /* 0x0E */ s16 x;
+ /* 0x10 */ s16 fov;
+ /* 0x12 */ s16 upPitchOffset;
+ /* 0x14 */ Vec3s orientation; // alters the orientation of the xy perturbation. Only x (pitch) and y (yaw) are used
+ /* 0x1A */ s16 speed;
+ /* 0x1C */ s16 isRelativeToScreen; // is the quake relative to the screen or on world coordinates
+ /* 0x1E */ s16 timer;
+ /* 0x20 */ s16 camId;
+} QuakeRequest; // size = 0x24
+
+QuakeRequest sQuakeRequests[4];
+s16 sQuakeUnused = 1;
s16 sQuakeRequestCount = 0;
-s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
- NULL, Quake_Callback1, Quake_Callback2, Quake_Callback3, Quake_Callback4, Quake_Callback5, Quake_Callback6,
-};
+Vec3f* Quake_AddVecGeoToVec3f(Vec3f* dst, Vec3f* a, VecGeo* geo) {
+ Vec3f vec;
+ Vec3f b;
-Vec3f* Quake_AddVec(Vec3f* dst, Vec3f* arg1, VecSph* arg2) {
- Vec3f vec1;
- Vec3f vec2;
+ OLib_VecGeoToVec3f(&b, geo);
+ vec.x = a->x + b.x;
+ vec.y = a->y + b.y;
+ vec.z = a->z + b.z;
+
+ *dst = vec;
- OLib_VecSphGeoToVec3f(&vec2, arg2);
- vec1.x = arg1->x + vec2.x;
- vec1.y = arg1->y + vec2.y;
- vec1.z = arg1->z + vec2.z;
- *dst = vec1;
return dst;
}
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 y, f32 x) {
- Vec3f* unk50 = &req->cam->at;
- Vec3f* unk5C = &req->cam->eye;
+ Vec3f* at = &req->cam->at;
+ Vec3f* eye = &req->cam->eye;
+ Vec3f offset;
+ VecGeo geo;
+ VecGeo eyeToAtGeo;
- Vec3f vec;
- VecSph struc2;
- VecSph struc1;
- Vec3f vec2;
+ if (req->isRelativeToScreen) {
+ offset.x = 0;
+ offset.y = 0;
+ offset.z = 0;
+ OLib_Vec3fDiffToVecGeo(&eyeToAtGeo, eye, at);
- if (req->unk_1C) {
- vec.x = 0;
- vec.y = 0;
- vec.z = 0;
- OLib_Vec3fDiffToVecSphGeo(&struc1, unk5C, unk50);
- struc2.r = req->y * y;
- struc2.pitch = struc1.pitch + req->unk_14.unk_00 + 0x4000;
- struc2.yaw = struc1.yaw + req->unk_14.unk_02;
- Quake_AddVec(&vec, &vec, &struc2);
- struc2.r = req->x * x;
- struc2.pitch = struc1.pitch + req->unk_14.unk_00;
- struc2.yaw = struc1.yaw + req->unk_14.unk_02 + 0x4000;
- Quake_AddVec(&vec, &vec, &struc2);
+ // y shake
+ geo.r = req->y * y;
+ // point unit vector up, then add on `req->orientation`
+ geo.pitch = eyeToAtGeo.pitch + req->orientation.x + 0x4000;
+ geo.yaw = eyeToAtGeo.yaw + req->orientation.y;
+ // apply y shake
+ Quake_AddVecGeoToVec3f(&offset, &offset, &geo);
+
+ // x shake
+ geo.r = req->x * x;
+ // point unit vector left, then add on `req->orientation`
+ geo.pitch = eyeToAtGeo.pitch + req->orientation.x;
+ geo.yaw = eyeToAtGeo.yaw + req->orientation.y + 0x4000;
+ // apply x shake
+ Quake_AddVecGeoToVec3f(&offset, &offset, &geo);
} else {
- vec.x = 0;
- vec.y = req->y * y;
- vec.z = 0;
- struc2.r = req->x * x;
- struc2.pitch = req->unk_14.unk_00;
- struc2.yaw = req->unk_14.unk_02;
- Quake_AddVec(&vec, &vec, &struc2);
+ offset.x = 0;
+ offset.y = req->y * y;
+ offset.z = 0;
+ geo.r = req->x * x;
+ geo.pitch = req->orientation.x;
+ geo.yaw = req->orientation.y;
+ Quake_AddVecGeoToVec3f(&offset, &offset, &geo);
}
- vec2 = vec;
- shake->vec2 = vec2;
- shake->vec1 = vec2;
- shake->unk_1A = (f32)0x8000 * y;
- shake->rotZ = req->rotZ * y;
- shake->zoom = req->zoom * y;
+ shake->atOffset = shake->eyeOffset = offset;
+ shake->upYawOffset = 0x8000 * y;
+ shake->upPitchOffset = req->upPitchOffset * y;
+ shake->fovOffset = req->fov * y;
}
-s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake) {
+s16 Quake_CallbackType1(QuakeRequest* req, ShakeInfo* shake) {
s32 pad;
- if (req->countdown > 0) {
- f32 a = Math_SinS(req->speed * req->countdown);
+ if (req->timer > 0) {
+ f32 xyOffset = Math_SinS(req->speed * req->timer);
- Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
- req->countdown--;
+ Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
+ req->timer--;
}
- return req->countdown;
+ return req->timer;
}
-s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake) {
- if (req->countdown > 0) {
- f32 a = Math_SinS(req->speed * req->countdown);
+s16 Quake_CallbackType5(QuakeRequest* req, ShakeInfo* shake) {
+ if (req->timer > 0) {
+ f32 xyOffset = Math_SinS(req->speed * req->timer);
- Quake_UpdateShakeInfo(req, shake, a, a);
- req->countdown--;
+ Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset);
+ req->timer--;
}
- return req->countdown;
+ return req->timer;
}
-s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake) {
+s16 Quake_CallbackType6(QuakeRequest* req, ShakeInfo* shake) {
s32 pad;
- f32 a;
+ f32 xyOffset;
- req->countdown--;
- a = Math_SinS(req->speed * ((req->countdown & 0xF) + 500));
- Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
+ req->timer--;
+ xyOffset = Math_SinS(req->speed * ((req->timer & 0xF) + 500));
+ Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
+
+ // Not returning the timer ensures quake type 6 continues indefinitely until manually removed
return 1;
}
-s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake) {
- if (req->countdown > 0) {
- f32 a = Math_SinS(req->speed * req->countdown) * ((f32)req->countdown / (f32)req->countdownMax);
+s16 Quake_CallbackType3(QuakeRequest* req, ShakeInfo* shake) {
+ if (req->timer > 0) {
+ f32 xyOffset = Math_SinS(req->speed * req->timer) * ((f32)req->timer / req->duration);
- Quake_UpdateShakeInfo(req, shake, a, a);
- req->countdown--;
+ Quake_UpdateShakeInfo(req, shake, xyOffset, xyOffset);
+ req->timer--;
}
- return req->countdown;
+ return req->timer;
}
-s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake) {
- if (req->countdown > 0) {
- f32 a = Rand_ZeroOne();
+s16 Quake_CallbackType2(QuakeRequest* req, ShakeInfo* shake) {
+ if (req->timer > 0) {
+ f32 xyOffset = Rand_ZeroOne();
- Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
- req->countdown--;
+ Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
+ req->timer--;
}
- return req->countdown;
+ return req->timer;
}
-s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake) {
- if (req->countdown > 0) {
- f32 a = Rand_ZeroOne() * ((f32)req->countdown / (f32)req->countdownMax);
+s16 Quake_CallbackType4(QuakeRequest* req, ShakeInfo* shake) {
+ if (req->timer > 0) {
+ f32 xyOffset = Rand_ZeroOne() * ((f32)req->timer / req->duration);
- Quake_UpdateShakeInfo(req, shake, a, Rand_ZeroOne() * a);
- req->countdown--;
+ Quake_UpdateShakeInfo(req, shake, xyOffset, Rand_ZeroOne() * xyOffset);
+ req->timer--;
}
- return req->countdown;
+ return req->timer;
}
s16 Quake_GetFreeIndex(void) {
s32 i;
- s32 ret;
- s32 min = 0x10000;
+ s32 index;
+ s32 timerMin = 0x10000; // UINT16_MAX + 1
- for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
- if (sQuakeRequest[i].callbackIdx == 0) {
- ret = i;
- min = 0x20000;
+ for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) {
+ if (sQuakeRequests[i].type == QUAKE_TYPE_NONE) {
+ index = i;
+ timerMin = 0x20000; // Magic Number to indicate there was an unused quake index
break;
}
- if (sQuakeRequest[i].countdown < min) {
- min = sQuakeRequest[i].countdown;
- ret = i;
+ if (timerMin > sQuakeRequests[i].timer) {
+ timerMin = sQuakeRequests[i].timer;
+ index = i;
}
}
- if (min != 0x20000) {
- osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: too many request %d is changed new one !!\n" VT_RST, ret);
+ if (timerMin != 0x20000) {
+ osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: too many request %d is changed new one !!\n" VT_RST, index);
}
- return ret;
+ return index;
}
-QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) {
- s16 idx = Quake_GetFreeIndex();
- QuakeRequest* req = &sQuakeRequest[idx];
+QuakeRequest* Quake_RequestImpl(Camera* camera, u32 type) {
+ s16 index = Quake_GetFreeIndex();
+ QuakeRequest* req = &sQuakeRequests[index];
__osMemset(req, 0, sizeof(QuakeRequest));
+
req->cam = camera;
- req->camPtrIdx = camera->camId;
- req->callbackIdx = callbackIdx;
- req->unk_1C = 1;
- req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx;
+ req->camId = camera->camId;
+ req->type = type;
+ req->isRelativeToScreen = true;
+
+ // Add a unique random identifier to the upper bits of the index
+ // The `~3` assumes there are only 4 requests
+ req->index = index + ((s16)(Rand_ZeroOne() * 0x10000) & ~3);
+
sQuakeRequestCount++;
return req;
}
void Quake_Remove(QuakeRequest* req) {
- req->callbackIdx = 0;
- req->countdown = -1;
+ req->type = QUAKE_TYPE_NONE;
+ req->timer = -1;
sQuakeRequestCount--;
}
-QuakeRequest* Quake_GetRequest(s16 idx) {
- QuakeRequest* req = &sQuakeRequest[idx & 3];
+QuakeRequest* Quake_GetRequest(s16 index) {
+ QuakeRequest* req = &sQuakeRequests[index & 3];
- if (req->callbackIdx == 0) {
+ if (req->type == QUAKE_TYPE_NONE) {
return NULL;
}
- if (idx != req->randIdx) {
+ if (index != req->index) {
return NULL;
}
return req;
}
-QuakeRequest* Quake_SetValue(s16 idx, s16 valueType, s16 value) {
- QuakeRequest* req = Quake_GetRequest(idx);
+#define QUAKE_SPEED (1 << 0)
+#define QUAKE_Y_OFFSET (1 << 1)
+#define QUAKE_X_OFFSET (1 << 2)
+#define QUAKE_FOV (1 << 3)
+#define QUAKE_ROLL (1 << 4)
+#define QUAKE_ORIENTATION_PITCH (1 << 5)
+#define QUAKE_ORIENTATION_YAW (1 << 6)
+#define QUAKE_ORIENTATION_ROLL (1 << 7)
+#define QUAKE_DURATION (1 << 8)
+#define QUAKE_IS_RELATIVE_TO_SCREEN (1 << 9)
+
+QuakeRequest* Quake_SetValue(s16 index, s16 valueType, s16 value) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req == NULL) {
return NULL;
- } else {
- switch (valueType) {
- case 1:
- req->speed = value;
- break;
- case 2:
- req->y = value;
- break;
- case 4:
- req->x = value;
- break;
- case 8:
- req->zoom = value;
- break;
- case 0x10:
- req->rotZ = value;
- break;
- case 0x20:
- req->unk_14.unk_00 = value;
- break;
- case 0x40:
- req->unk_14.unk_02 = value;
- break;
- case 0x80:
- req->unk_14.unk_04 = value;
- break;
- case 0x100:
- req->countdown = value;
- req->countdownMax = req->countdown;
- break;
- case 0x200:
- req->unk_1C = value;
- break;
- }
}
+
+ switch (valueType) {
+ case QUAKE_SPEED:
+ req->speed = value;
+ break;
+
+ case QUAKE_Y_OFFSET:
+ req->y = value;
+ break;
+
+ case QUAKE_X_OFFSET:
+ req->x = value;
+ break;
+
+ case QUAKE_FOV:
+ req->fov = value;
+ break;
+
+ case QUAKE_ROLL:
+ req->upPitchOffset = value;
+ break;
+
+ case QUAKE_ORIENTATION_PITCH:
+ req->orientation.x = value;
+ break;
+
+ case QUAKE_ORIENTATION_YAW:
+ req->orientation.y = value;
+ break;
+
+ case QUAKE_ORIENTATION_ROLL:
+ req->orientation.z = value;
+ break;
+
+ case QUAKE_DURATION:
+ req->timer = value;
+ req->duration = req->timer;
+ break;
+
+ case QUAKE_IS_RELATIVE_TO_SCREEN:
+ req->isRelativeToScreen = value;
+ break;
+
+ default:
+ break;
+ }
+
+ //! @bug UB: missing return. "req" is in v0 at this point, but doing an
+ //! explicit return uses an additional register.
+#ifdef AVOID_UB
+ return req;
+#endif
}
-u32 Quake_SetSpeed(s16 idx, s16 value) {
- QuakeRequest* req = Quake_GetRequest(idx);
+/**
+ * @param index
+ * @param speed For periodic types only, the angular frequency of the sine wave (binang / frame)
+ * @return true if successfully applied, false if the request does not exist
+ */
+u32 Quake_SetSpeed(s16 index, s16 speed) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
- req->speed = value;
+ req->speed = speed;
return true;
}
return false;
}
-u32 Quake_SetCountdown(s16 idx, s16 value) {
- QuakeRequest* req = Quake_GetRequest(idx);
+/**
+ * @param index quake request index to apply
+ * @param duration Number of frames to apply the quake
+ * @return true if successfully applied, false if the request does not exist
+ */
+u32 Quake_SetDuration(s16 index, s16 duration) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
- req->countdown = value;
- req->countdownMax = req->countdown;
+ req->duration = req->timer = duration;
return true;
}
return false;
}
-s16 Quake_GetCountdown(s16 idx) {
- QuakeRequest* req = Quake_GetRequest(idx);
+/**
+ * @param index quake request index to get
+ * @return Number of frames until the quake is finished
+ */
+s16 Quake_GetTimeLeft(s16 index) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
- return req->countdown;
+ return req->timer;
}
return 0;
}
-u32 Quake_SetQuakeValues(s16 idx, s16 y, s16 x, s16 zoom, s16 rotZ) {
- QuakeRequest* req = Quake_GetRequest(idx);
+/**
+ * @param index quake request index to apply
+ * @param y Apply up/down shake
+ * @param x Apply left/right shake
+ * @param fov Apply zooming in/out shake (binang)
+ * @param roll Apply rolling shake (binang)
+ * @return true if successfully applied, false if the request does not exist
+ */
+u32 Quake_SetPerturbations(s16 index, s16 y, s16 x, s16 fov, s16 roll) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
req->y = y;
req->x = x;
- req->zoom = zoom;
- req->rotZ = rotZ;
+ req->fov = fov;
+ // Visual roll is indirectly achieved by offsetting the pitch in calculating the camera "Up" vector
+ req->upPitchOffset = roll;
return true;
}
return false;
}
-u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2) {
- QuakeRequest* req = Quake_GetRequest(idx);
+/**
+ * @param index quake request index to apply
+ * @param isRelativeToScreen Is the quake applied relative to the screen or in absolute world coordinates
+ * @param orientation orient the x/y shake to a different direction
+ * @return true if successfully applied, false if the request does not exist
+ */
+u32 Quake_SetOrientation(s16 index, s16 isRelativeToScreen, Vec3s orientation) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
- req->unk_1C = arg1;
-
- req->unk_14 = arg2;
+ req->isRelativeToScreen = isRelativeToScreen;
+ req->orientation = orientation;
return true;
}
return false;
@@ -283,20 +365,20 @@ u32 Quake_SetUnkValues(s16 idx, s16 arg1, SubQuakeRequest14 arg2) {
void Quake_Init(void) {
s16 i;
- for (i = 0; i < ARRAY_COUNT(sQuakeRequest); i++) {
- sQuakeRequest[i].callbackIdx = 0;
- sQuakeRequest[i].countdown = 0;
+ for (i = 0; i < ARRAY_COUNT(sQuakeRequests); i++) {
+ sQuakeRequests[i].type = QUAKE_TYPE_NONE;
+ sQuakeRequests[i].timer = 0;
}
- D_80126250 = 1;
+ sQuakeUnused = 1;
sQuakeRequestCount = 0;
}
-s16 Quake_Add(Camera* camera, u32 callbackIdx) {
- return Quake_AddImpl(camera, callbackIdx)->randIdx;
+s16 Quake_Request(Camera* camera, u32 type) {
+ return Quake_RequestImpl(camera, type)->index;
}
-u32 Quake_RemoveFromIdx(s16 idx) {
- QuakeRequest* req = Quake_GetRequest(idx);
+u32 Quake_RemoveRequest(s16 index) {
+ QuakeRequest* req = Quake_GetRequest(index);
if (req != NULL) {
Quake_Remove(req);
@@ -305,101 +387,120 @@ u32 Quake_RemoveFromIdx(s16 idx) {
return false;
}
-s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) {
- f32 max;
- f32 max2;
- QuakeRequest* req;
- ShakeInfo shake;
- f32 absSpeedDiv;
- s16* temp;
- u32 pad2;
- s32 idx;
- s32 ret;
- u32 eq;
- Vec3f vec;
- PlayState* play;
+s16 (*sQuakeCallbacks[])(QuakeRequest*, ShakeInfo*) = {
+ NULL, // QUAKE_TYPE_NONE
+ Quake_CallbackType1, // QUAKE_TYPE_1
+ Quake_CallbackType2, // QUAKE_TYPE_2
+ Quake_CallbackType3, // QUAKE_TYPE_3
+ Quake_CallbackType4, // QUAKE_TYPE_4
+ Quake_CallbackType5, // QUAKE_TYPE_5
+ Quake_CallbackType6, // QUAKE_TYPE_6
+};
- play = camera->play;
- vec.x = 0.0f;
- vec.y = 0.0f;
- vec.z = 0.0f;
- camData->rotZ = 0;
- camData->unk_1A = 0;
- camData->zoom = 0;
- camData->atOffset.x = 0.0f;
- camData->atOffset.y = 0.0f;
- camData->atOffset.z = 0.0f;
- camData->eyeOffset.x = 0.0f;
- camData->eyeOffset.y = 0.0f;
- camData->eyeOffset.z = 0.0f;
- camData->unk_20 = 0.0f;
+s16 Quake_Update(Camera* camera, ShakeInfo* camShake) {
+ f32 maxCurr;
+ f32 maxNext;
+ ShakeInfo shake;
+ QuakeRequest* req;
+ f32 absSpeedDiv;
+ s16* camId;
+ s32 index;
+ s32 numQuakesApplied;
+ u32 isDifferentCamId;
+ Vec3f zeroVec;
+ PlayState* play = camera->play;
+
+ zeroVec.x = 0.0f;
+ zeroVec.y = 0.0f;
+ zeroVec.z = 0.0f;
+
+ camShake->upPitchOffset = 0;
+ camShake->upYawOffset = 0;
+ camShake->fovOffset = 0;
+
+ camShake->atOffset.x = 0.0f;
+ camShake->atOffset.y = 0.0f;
+ camShake->atOffset.z = 0.0f;
+
+ camShake->eyeOffset.x = 0.0f;
+ camShake->eyeOffset.y = 0.0f;
+ camShake->eyeOffset.z = 0.0f;
+
+ camShake->maxOffset = 0.0f;
if (sQuakeRequestCount == 0) {
return 0;
}
- ret = 0;
- for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) {
- req = &sQuakeRequest[idx];
- if (req->callbackIdx != 0) {
- if (play->cameraPtrs[req->camPtrIdx] == NULL) {
- osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST,
- req->camPtrIdx);
- Quake_Remove(req);
- } else {
- temp = &camera->camId;
- eq = req->cam->camId != *temp;
- absSpeedDiv = ABS(req->speed) / (f32)0x8000;
- if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) {
- Quake_Remove(req);
- } else if (eq == 0) {
- if (fabsf(camData->atOffset.x) < fabsf(shake.vec1.x)) {
- camData->atOffset.x = shake.vec1.x;
- }
- if (fabsf(camData->atOffset.y) < fabsf(shake.vec1.y)) {
- camData->atOffset.y = shake.vec1.y;
- }
- if (fabsf(camData->atOffset.z) < fabsf(shake.vec1.z)) {
- camData->atOffset.z = shake.vec1.z;
- }
- if (fabsf(camData->eyeOffset.x) < fabsf(shake.vec2.x)) {
- camData->eyeOffset.x = shake.vec2.x;
- }
- if (fabsf(camData->eyeOffset.y) < fabsf(shake.vec2.y)) {
- camData->eyeOffset.y = shake.vec2.y;
- }
- if (fabsf(camData->eyeOffset.z) < fabsf(shake.vec2.z)) {
- camData->eyeOffset.z = shake.vec2.z;
- }
- if (camData->rotZ < shake.rotZ) {
- camData->rotZ = shake.rotZ;
- camData->unk_1A = shake.unk_1A;
- }
- if (camData->zoom < shake.zoom) {
- camData->zoom = shake.zoom;
- }
-
- max = OLib_Vec3fDist(&shake.vec1, &vec) * absSpeedDiv;
- max2 = OLib_Vec3fDist(&shake.vec2, &vec) * absSpeedDiv;
- if (max < max2) {
- max = max2;
- }
- max2 = (camData->rotZ * 0.005f) * absSpeedDiv;
- if (max < max2) {
- max = max2;
- }
- max2 = (camData->zoom * 0.005f) * absSpeedDiv;
- if (max < max2) {
- max = max2;
- }
- if (camData->unk_20 < max) {
- camData->unk_20 = max;
- }
-
- ret++;
- }
- }
+ numQuakesApplied = 0;
+ for (index = 0; index < ARRAY_COUNT(sQuakeRequests); index++) {
+ req = &sQuakeRequests[index];
+ if (req->type == QUAKE_TYPE_NONE) {
+ continue;
}
+
+ if (play->cameraPtrs[req->camId] == NULL) {
+ osSyncPrintf(VT_COL(YELLOW, BLACK) "quake: stopped! 'coz camera [%d] killed!!\n" VT_RST, req->camId);
+ Quake_Remove(req);
+ continue;
+ }
+
+ camId = &camera->camId;
+ isDifferentCamId = req->cam->camId != *camId;
+ absSpeedDiv = (f32)ABS(req->speed) / 0x8000;
+
+ if (sQuakeCallbacks[req->type](req, &shake) == 0) {
+ // Quake has reached the end of its timer.
+ Quake_Remove(req);
+ continue;
+ }
+
+ if (isDifferentCamId) {
+ // Quake is attached to a different camId
+ continue;
+ }
+
+ if (fabsf(camShake->atOffset.x) < fabsf(shake.atOffset.x)) {
+ camShake->atOffset.x = shake.atOffset.x;
+ }
+ if (fabsf(camShake->atOffset.y) < fabsf(shake.atOffset.y)) {
+ camShake->atOffset.y = shake.atOffset.y;
+ }
+ if (fabsf(camShake->atOffset.z) < fabsf(shake.atOffset.z)) {
+ camShake->atOffset.z = shake.atOffset.z;
+ }
+ if (fabsf(camShake->eyeOffset.x) < fabsf(shake.eyeOffset.x)) {
+ camShake->eyeOffset.x = shake.eyeOffset.x;
+ }
+ if (fabsf(camShake->eyeOffset.y) < fabsf(shake.eyeOffset.y)) {
+ camShake->eyeOffset.y = shake.eyeOffset.y;
+ }
+ if (fabsf(camShake->eyeOffset.z) < fabsf(shake.eyeOffset.z)) {
+ camShake->eyeOffset.z = shake.eyeOffset.z;
+ }
+ if (camShake->upPitchOffset < shake.upPitchOffset) {
+ camShake->upPitchOffset = shake.upPitchOffset;
+ camShake->upYawOffset = shake.upYawOffset;
+ }
+ if (camShake->fovOffset < shake.fovOffset) {
+ camShake->fovOffset = shake.fovOffset;
+ }
+
+ maxCurr = OLib_Vec3fDist(&shake.atOffset, &zeroVec) * absSpeedDiv;
+ maxNext = OLib_Vec3fDist(&shake.eyeOffset, &zeroVec) * absSpeedDiv;
+ maxCurr = CLAMP_MIN(maxCurr, maxNext);
+
+ maxNext = camShake->upPitchOffset * (1.0f / 200.0f) * absSpeedDiv;
+ maxCurr = CLAMP_MIN(maxCurr, maxNext);
+
+ maxNext = camShake->fovOffset * (1.0f / 200.0f) * absSpeedDiv;
+ maxCurr = CLAMP_MIN(maxCurr, maxNext);
+
+ if (camShake->maxOffset < maxCurr) {
+ camShake->maxOffset = maxCurr;
+ }
+
+ numQuakesApplied++;
}
- return ret;
+ return numQuakesApplied;
}
diff --git a/src/code/z_room.c b/src/code/z_room.c
index add5101380..953739f2a7 100644
--- a/src/code/z_room.c
+++ b/src/code/z_room.c
@@ -389,7 +389,7 @@ void Room_DrawImageSingle(PlayState* play, Room* room, u32 flags) {
Vec3f quakeOffset;
gfx = POLY_OPA_DISP;
- Camera_GetSkyboxOffset(&quakeOffset, activeCam);
+ Camera_GetQuakeOffset(&quakeOffset, activeCam);
Room_DrawBackground2D(&gfx, roomShape->source, roomShape->tlut, roomShape->width, roomShape->height,
roomShape->fmt, roomShape->siz, roomShape->tlutMode, roomShape->tlutCount,
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,
@@ -487,7 +487,7 @@ void Room_DrawImageMulti(PlayState* play, Room* room, u32 flags) {
Vec3f quakeOffset;
gfx = POLY_OPA_DISP;
- Camera_GetSkyboxOffset(&quakeOffset, activeCam);
+ Camera_GetQuakeOffset(&quakeOffset, activeCam);
Room_DrawBackground2D(&gfx, bgEntry->source, bgEntry->tlut, bgEntry->width, bgEntry->height,
bgEntry->fmt, bgEntry->siz, bgEntry->tlutMode, bgEntry->tlutCount,
(quakeOffset.x + quakeOffset.z) * 1.2f + quakeOffset.y * 0.6f,
diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c
index 67d071ece8..a951314200 100644
--- a/src/code/z_scene_table.c
+++ b/src/code/z_scene_table.c
@@ -1,4 +1,5 @@
#include "global.h"
+#include "quake.h"
#include "assets/scenes/overworld/spot00/spot00_scene.h"
#include "assets/scenes/overworld/spot00/spot00_room_0.h"
@@ -585,20 +586,20 @@ void Scene_DrawConfigGanonCastleExterior(PlayState* play) {
// Screen Shake for Ganon's Tower Collapse
void func_8009BEEC(PlayState* play) {
- s32 var;
+ s32 quakeIndex;
if (play->gameplayFrames % 128 == 13) {
- var = Quake_Add(GET_ACTIVE_CAM(play), 2);
- Quake_SetSpeed(var, 10000);
- Quake_SetQuakeValues(var, 4, 0, 0, 0);
- Quake_SetCountdown(var, 127);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_2);
+ Quake_SetSpeed(quakeIndex, 10000);
+ Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 127);
}
if ((play->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) {
- var = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(var, 32000.0f + (Rand_ZeroOne() * 3000.0f));
- Quake_SetQuakeValues(var, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0);
- Quake_SetCountdown(var, 48.0f - (Rand_ZeroOne() * 15.0f));
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 32000.0f + (Rand_ZeroOne() * 3000.0f));
+ Quake_SetPerturbations(quakeIndex, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 48.0f - (Rand_ZeroOne() * 15.0f));
}
}
diff --git a/src/code/z_sram.c b/src/code/z_sram.c
index 4ce0b5d3a2..4e79b22144 100644
--- a/src/code/z_sram.c
+++ b/src/code/z_sram.c
@@ -312,7 +312,7 @@ static s16 sDungeonEntrances[] = {
* - If health is less than 3 hearts, give 3 hearts
* - If either scarecrow song is set, copy them from save context to the proper location
* - Handle a case where the player saved and quit after zelda cutscene but didnt get the song
- * - Give and equip master sword if player is adult and doesnt have kokiri sword (bug?)
+ * - Give and equip master sword if player is adult and doesn't have master sword
* - Revert any trade items that spoil
*/
void Sram_OpenSave(SramContext* sramCtx) {
diff --git a/src/code/z_view.c b/src/code/z_view.c
index 044e5603e7..7205f789b8 100644
--- a/src/code/z_view.c
+++ b/src/code/z_view.c
@@ -12,11 +12,11 @@ void View_ViewportToVp(Vp* dest, Viewport* src) {
dest->vp.vscale[0] = width * 2;
dest->vp.vscale[1] = height * 2;
- dest->vp.vscale[2] = 0x01FF;
+ dest->vp.vscale[2] = G_MAXZ / 2;
dest->vp.vscale[3] = 0;
dest->vp.vtrans[0] = ((src->leftX * 2) + width) * 2;
dest->vp.vtrans[1] = ((src->topY * 2) + height) * 2;
- dest->vp.vtrans[2] = 0x01FF;
+ dest->vp.vtrans[2] = G_MAXZ / 2;
dest->vp.vtrans[3] = 0;
}
diff --git a/src/elf_message/elf_message_field.c b/src/elf_message/elf_message_field.c
index 57736c5a3b..cd48f53ff3 100644
--- a/src/elf_message/elf_message_field.c
+++ b/src/elf_message/elf_message_field.c
@@ -5,7 +5,7 @@ ElfMessage gOverworldNaviMsgs[] = {
ELF_MSG_FLAG(CHECK, 0x40, false, EVENTCHKINF_05),
ELF_MSG_FLAG(CHECK, 0x41, false, EVENTCHKINF_09),
ELF_MSG_FLAG(CHECK, 0x42, false, EVENTCHKINF_12),
- ELF_MSG_FLAG(CHECK, 0x43, false, EVENTCHKINF_14),
+ ELF_MSG_FLAG(CHECK, 0x43, false, EVENTCHKINF_TALON_RETURNED_FROM_CASTLE),
ELF_MSG_FLAG(CHECK, 0x44, false, EVENTCHKINF_40),
ELF_MSG_SONG(CHECK, 0x45, false, ITEM_SONG_SARIA),
ELF_MSG_STRENGTH_UPG(CHECK, 0x46, true, 0),
diff --git a/src/libultra/gu/perspective.c b/src/libultra/gu/perspective.c
index 4418a61222..21b0e1a0a6 100644
--- a/src/libultra/gu/perspective.c
+++ b/src/libultra/gu/perspective.c
@@ -33,6 +33,7 @@ void guPerspectiveF(f32 mf[4][4], u16* perspNorm, f32 fovy, f32 aspect, f32 near
}
}
}
+
void guPerspective(Mtx* m, u16* perspNorm, f32 fovy, f32 aspect, f32 near, f32 far, f32 scale) {
f32 mf[4][4];
diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c
index 798a717e0c..12bbb3a36b 100644
--- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c
+++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c
@@ -5,6 +5,7 @@
*/
#include "z_bg_bdan_objects.h"
+#include "quake.h"
#include "assets/objects/object_bdan_objects/object_bdan_objects.h"
#define FLAGS ACTOR_FLAG_4
@@ -221,15 +222,15 @@ void func_8086C1A0(BgBdanObjects* this, PlayState* play) {
}
void func_8086C29C(BgBdanObjects* this, PlayState* play) {
- s32 temp;
+ s32 quakeIndex;
if (this->timer != 0) {
this->timer--;
if (this->timer == 0) {
- temp = Quake_Add(GET_ACTIVE_CAM(play), 1);
- Quake_SetSpeed(temp, 0x3A98);
- Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1);
- Quake_SetCountdown(temp, 0xA);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
+ Quake_SetSpeed(quakeIndex, 0x3A98);
+ Quake_SetPerturbations(quakeIndex, 0, 1, 250, 1);
+ Quake_SetDuration(quakeIndex, 10);
}
}
diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c
index 122359fb68..a27997bda0 100644
--- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c
+++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c
@@ -8,6 +8,7 @@
#include "overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.h"
#include "overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.h"
#include "assets/objects/object_bowl/object_bowl.h"
+#include "quake.h"
#include "vt.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
@@ -151,10 +152,10 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, PlayState* play) {
EffectSsHahen_SpawnBurst(play, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION);
}
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 0x7FFF);
- Quake_SetQuakeValues(quakeIndex, 300, 0, 0, 0);
- Quake_SetCountdown(quakeIndex, 30);
+ Quake_SetPerturbations(quakeIndex, 300, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 30);
this->timer = 20;
this->actionFunc = BgBowlWall_FinishFall;
}
diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c
index 6241a90f01..f9407b73c3 100644
--- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c
+++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c
@@ -169,7 +169,7 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, PlayState* play) {
func_80033480(play, &pos1, 20.0f, 1, effectStrength * 135.0f, 60, 1);
func_8003555C(play, &pos1, &velocity, &accel);
}
- Camera_AddQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3);
+ Camera_RequestQuake(&play->mainCamera, 0, effectStrength * 0.6f, 3);
Audio_PlaySfxGeneral(NA_SE_EV_PILLAR_SINK - SFX_FLAG, &this->dyna.actor.projectedPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c
index 8c9338b6c0..6a9af76455 100644
--- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c
+++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c
@@ -211,7 +211,7 @@ void BgGanonOtyuka_Fall(BgGanonOtyuka* this, PlayState* play) {
(s16)Rand_ZeroFloat(100.0f) + 250, 5, (s16)Rand_ZeroFloat(5.0f) + 15);
}
- func_80033DB8(play, 10, 15);
+ Actor_RequestQuake(play, 10, 15);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_BOX_BREAK);
}
Actor_Kill(&this->dyna.actor);
diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c
index 598ef2c117..8af91598fe 100644
--- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c
+++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c
@@ -7,6 +7,7 @@
#include "z_bg_haka_huta.h"
#include "assets/objects/object_hakach_objects/object_hakach_objects.h"
#include "overlays/actors/ovl_En_Rd/z_en_rd.h"
+#include "quake.h"
#define FLAGS ACTOR_FLAG_4
@@ -179,10 +180,10 @@ void func_8087D720(BgHakaHuta* this, PlayState* play) {
this->counter++;
if (this->counter == 6) {
this->actionFunc = BgHakaHuta_DoNothing;
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 0x7530);
- Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0);
- Quake_SetCountdown(quakeIndex, 2);
+ Quake_SetPerturbations(quakeIndex, 4, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 2);
} else if (this->counter == 0) {
this->counter = 6;
this->actionFunc = BgHakaHuta_DoNothing;
diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c
index 269e99dc6c..bed22e6ab4 100644
--- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c
+++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c
@@ -6,6 +6,7 @@
#include "z_bg_heavy_block.h"
#include "assets/objects/object_heavy_object/object_heavy_object.h"
+#include "quake.h"
#include "vt.h"
#define FLAGS 0
@@ -331,10 +332,10 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play) {
break;
}
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 25000);
- Quake_SetQuakeValues(quakeIndex, 1, 1, 5, 0);
- Quake_SetCountdown(quakeIndex, 10);
+ Quake_SetPerturbations(quakeIndex, 1, 1, 5, 0);
+ Quake_SetDuration(quakeIndex, 10);
this->actionFunc = BgHeavyBlock_LiftedUp;
}
}
@@ -398,25 +399,25 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) {
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
Actor_Kill(&this->dyna.actor);
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
- Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
- Quake_SetCountdown(quakeIndex, 30);
+ Quake_SetPerturbations(quakeIndex, 14, 2, 100, 0);
+ Quake_SetDuration(quakeIndex, 30);
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 2);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_2);
Quake_SetSpeed(quakeIndex, 12000);
- Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0);
- Quake_SetCountdown(quakeIndex, 999);
+ Quake_SetPerturbations(quakeIndex, 5, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 999);
SfxSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 30, NA_SE_EV_ELECTRIC_EXPLOSION);
return;
case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE:
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
- Quake_SetQuakeValues(quakeIndex, 16, 2, 120, 0);
- Quake_SetCountdown(quakeIndex, 40);
+ Quake_SetPerturbations(quakeIndex, 16, 2, 120, 0);
+ Quake_SetDuration(quakeIndex, 40);
this->actionFunc = BgHeavyBlock_Land;
Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F);
@@ -424,18 +425,18 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) {
case HEAVYBLOCK_UNBREAKABLE:
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U);
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
- Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
- Quake_SetCountdown(quakeIndex, 40);
+ Quake_SetPerturbations(quakeIndex, 14, 2, 100, 0);
+ Quake_SetDuration(quakeIndex, 40);
this->actionFunc = BgHeavyBlock_Land;
break;
default:
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, 28000);
- Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0);
- Quake_SetCountdown(quakeIndex, 40);
+ Quake_SetPerturbations(quakeIndex, 14, 2, 100, 0);
+ Quake_SetDuration(quakeIndex, 40);
this->actionFunc = BgHeavyBlock_Land;
}
diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c
index d3a0bf9edb..87a845e664 100644
--- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c
+++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c
@@ -6,6 +6,7 @@
#include "z_bg_hidan_hamstep.h"
#include "assets/objects/object_hidan_objects/object_hidan_objects.h"
+#include "quake.h"
#define FLAGS 0
@@ -308,10 +309,10 @@ void func_80888860(BgHidanHamstep* this, PlayState* play) {
if (1) {}
if (this->unk_244 == 1) {
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -15536);
- Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0);
- Quake_SetCountdown(quakeIndex, 20);
+ Quake_SetPerturbations(quakeIndex, 0, 0, 500, 0);
+ Quake_SetDuration(quakeIndex, 20);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 255, 20, 150);
func_80888638(this, play);
@@ -367,10 +368,10 @@ void func_80888A58(BgHidanHamstep* this, PlayState* play) {
if (1) {}
if (this->unk_244 == 1) {
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 3);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
Quake_SetSpeed(quakeIndex, -15536);
- Quake_SetQuakeValues(quakeIndex, 20, 1, 0, 0);
- Quake_SetCountdown(quakeIndex, 7);
+ Quake_SetPerturbations(quakeIndex, 20, 1, 0, 0);
+ Quake_SetDuration(quakeIndex, 7);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);
Rumble_Request(SQ(100.0f), 255, 20, 150);
diff --git a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
index df0cdd482c..b21671614e 100644
--- a/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
+++ b/src/overlays/actors/ovl_Bg_Ingate/z_bg_ingate.c
@@ -45,7 +45,7 @@ void BgInGate_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if ((play->sceneId != SCENE_SPOT20 || !LINK_IS_ADULT) ||
- (GET_EVENTCHKINF(EVENTCHKINF_18) && (gSaveContext.cutsceneIndex != 0xFFF0))) {
+ (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (gSaveContext.cutsceneIndex != 0xFFF0))) {
Actor_Kill(&this->dyna.actor);
return;
}
diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c
index 44b4d7428f..6c4ac3dbac 100644
--- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c
+++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c
@@ -6,6 +6,7 @@
#include "z_bg_jya_kanaami.h"
#include "assets/objects/object_jya_obj/object_jya_obj.h"
+#include "quake.h"
#define FLAGS 0
@@ -96,16 +97,17 @@ void func_8089993C(BgJyaKanaami* this) {
void func_80899950(BgJyaKanaami* this, PlayState* play) {
s32 pad[2];
- s32 quakeId;
+ s32 quakeIndex;
this->unk_168 += 0x20;
if (Math_ScaledStepToS(&this->dyna.actor.world.rot.x, 0x4000, this->unk_168)) {
func_80899A08(this);
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_TRAP_BOUND);
- quakeId = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quakeId, 25000);
- Quake_SetQuakeValues(quakeId, 2, 0, 0, 0);
- Quake_SetCountdown(quakeId, 16);
+
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 25000);
+ Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 16);
}
}
diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c
index f332ea8c5b..0f66fbe4b6 100644
--- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c
+++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c
@@ -6,6 +6,7 @@
#include "z_bg_mori_bigst.h"
#include "assets/objects/object_mori_objects/object_mori_objects.h"
+#include "quake.h"
#define FLAGS ACTOR_FLAG_4
@@ -169,14 +170,15 @@ void BgMoriBigst_Fall(BgMoriBigst* this, PlayState* play) {
void BgMoriBigst_SetupLanding(BgMoriBigst* this, PlayState* play) {
s32 pad;
- s32 quake;
+ s32 quakeIndex;
BgMoriBigst_SetupAction(this, BgMoriBigst_Landing);
this->waitTimer = 18;
- quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quake, 25000);
- Quake_SetQuakeValues(quake, 5, 0, 0, 0);
- Quake_SetCountdown(quake, 16);
+
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 25000);
+ Quake_SetPerturbations(quakeIndex, 5, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 16);
}
void BgMoriBigst_Landing(BgMoriBigst* this, PlayState* play) {
diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c
index 8d8494d1bd..ce4b68a8d5 100644
--- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c
+++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c
@@ -6,6 +6,7 @@
#include "z_bg_mori_rakkatenjo.h"
#include "assets/objects/object_mori_objects/object_mori_objects.h"
+#include "quake.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5)
@@ -146,7 +147,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play) {
static f32 bounceVel[] = { 4.0f, 1.5f, 0.4f, 0.1f };
s32 pad;
Actor* thisx = &this->dyna.actor;
- s32 quake;
+ s32 quakeIndex;
Actor_MoveForward(thisx);
if ((thisx->velocity.y < 0.0f) && (thisx->world.pos.y <= 403.0f)) {
@@ -162,10 +163,11 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, PlayState* play) {
403.0f - (thisx->world.pos.y - 403.0f) * bounceVel[this->bounceCount] / fabsf(thisx->velocity.y);
thisx->velocity.y = bounceVel[this->bounceCount];
this->bounceCount++;
- quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quake, 50000);
- Quake_SetQuakeValues(quake, 5, 0, 0, 0);
- Quake_SetCountdown(quake, 5);
+
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, 50000);
+ Quake_SetPerturbations(quakeIndex, 5, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 5);
}
}
}
diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c
index 9d2184349a..2e2ce1f359 100644
--- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c
+++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c
@@ -315,7 +315,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, PlayState* play) {
BgPoEvent_CheckBlock(this);
} else {
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
- func_80033E88(&this->dyna.actor, play, 5, 5);
+ Actor_RequestQuakeAndRumble(&this->dyna.actor, play, 5, 5);
func_80088B34(this->timer);
if (firstFall == 0) {
firstFall = 1;
diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c
index dbe09013cd..e56ed7e0c2 100644
--- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c
+++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c
@@ -6,6 +6,7 @@
#include "z_bg_spot12_gate.h"
#include "assets/objects/object_spot12_obj/object_spot12_obj.h"
+#include "quake.h"
#define FLAGS 0
@@ -104,16 +105,18 @@ void func_808B317C(BgSpot12Gate* this) {
void func_808B318C(BgSpot12Gate* this, PlayState* play) {
s32 pad;
- s32 var;
+ s32 quakeIndex;
Math_StepToF(&this->dyna.actor.velocity.y, 1.6f, 0.03f);
if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f,
this->dyna.actor.velocity.y)) {
func_808B3274(this);
- var = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(var, -0x3CB0);
- Quake_SetQuakeValues(var, 3, 0, 0, 0);
- Quake_SetCountdown(var, 0xC);
+
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, -0x3CB0);
+ Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 12);
+
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_BRIDGE_OPEN_STOP);
} else {
func_8002F974(&this->dyna.actor, NA_SE_EV_METALGATE_OPEN - SFX_FLAG);
diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c
index 2c89f5a6bb..1ecfeca0cf 100644
--- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c
+++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c
@@ -110,7 +110,7 @@ s32 func_808B3AAC(BgSpot15Rrbox* this, PlayState* play) {
}
if (rotY < 0x2000 && rotY > -0x6000) {
- return GET_EVENTCHKINF(EVENTCHKINF_14);
+ return GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE);
}
return true;
}
diff --git a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c
index d02ffbbf22..bb907e07c0 100644
--- a/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c
+++ b/src/overlays/actors/ovl_Bg_Umajump/z_bg_umajump.c
@@ -41,7 +41,7 @@ void BgUmaJump_Init(Actor* thisx, PlayState* play) {
this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader);
if (this->dyna.actor.params == 1) {
- if (!Flags_GetEventChkInf(EVENTCHKINF_18) && (DREG(1) == 0)) {
+ if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && (DREG(1) == 0)) {
Actor_Kill(&this->dyna.actor);
return;
}
diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c
index ace123bcfd..3dccccfbc0 100644
--- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c
+++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c
@@ -552,7 +552,7 @@ void BossDodongo_Explode(BossDodongo* this, PlayState* play) {
this->actionFunc = BossDodongo_LayDown;
Audio_PlayActorSfx2(&this->actor, NA_SE_IT_BOMB_EXPLOSION);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_DAMAGE);
- func_80033E88(&this->actor, play, 4, 10);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 4, 10);
this->health -= 2;
// make sure not to die from the bomb explosion
@@ -677,7 +677,7 @@ void BossDodongo_Walk(BossDodongo* this, PlayState* play) {
}
if (this->subCamId == SUB_CAM_ID_DONE) {
- func_80033E88(&this->actor, play, 4, 10);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 4, 10);
} else {
this->unk_1B6 = 10;
Rumble_Override(0.0f, 180, 20, 100);
@@ -758,7 +758,7 @@ void BossDodongo_Roll(BossDodongo* this, PlayState* play) {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG);
if ((this->unk_19E & 7) == 0) {
- Camera_AddQuake(&play->mainCamera, 2, 1, 8);
+ Camera_RequestQuake(&play->mainCamera, 2, 1, 8);
}
if (!(this->unk_19E & 1)) {
@@ -787,12 +787,12 @@ void BossDodongo_Roll(BossDodongo* this, PlayState* play) {
this->unk_228 = 9200.0f;
this->actor.velocity.y = 20.0f;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_COLI);
- Camera_AddQuake(&play->mainCamera, 2, 6, 8);
+ Camera_RequestQuake(&play->mainCamera, 2, 6, 8);
sp50.x = this->actor.world.pos.x;
sp50.y = this->actor.world.pos.y + 60.0f;
sp50.z = this->actor.world.pos.z;
func_80033480(play, &sp50, 250.0f, 40, 800, 10, 0);
- func_80033E88(&this->actor, play, 6, 15);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 6, 15);
} else {
this->actor.velocity.y = 15.0f;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_COLI2);
@@ -1395,7 +1395,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, PlayState* play) {
Math_SmoothStepToF(&this->actor.world.pos.z, cornerPos->z + sp184.z, 1.0f, this->unk_1E4, 0.0f);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DODO_K_ROLL - SFX_FLAG);
if ((this->unk_19E & 7) == 0) {
- Camera_AddQuake(&play->mainCamera, 2, 1, 8);
+ Camera_RequestQuake(&play->mainCamera, 2, 1, 8);
}
if (!(this->unk_19E & 1)) {
Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, 40.0f, 3, 8.0f, 500, 10,
diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c
index 477b3a2186..da3722c2fd 100644
--- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c
+++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c
@@ -629,7 +629,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
this->holePosition.x = this->targetPosition.x;
this->holePosition.z = this->targetPosition.z;
- func_80033E1C(play, 1, 0x50, 0x5000);
+ Actor_RequestQuakeWithSpeed(play, 1, 80, 0x5000);
if (this->introState != BFD_CS_NONE) {
this->timers[0] = 50;
} else {
@@ -673,7 +673,7 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
this->timers[1] = 10;
Audio_PlaySfxGeneral(NA_SE_EV_EXPLOSION, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
- func_80033E1C(play, 3, 0xA, 0x7530);
+ Actor_RequestQuakeWithSpeed(play, 3, 10, 0x7530);
this->work[BFD_ROCK_TIMER] = 300;
}
} else {
@@ -979,14 +979,14 @@ void BossFd_Fly(BossFd* this, PlayState* play) {
if (this->work[BFD_ACTION_STATE] < BOSSFD_SKULL_FALL) {
if ((this->actor.prevPos.y < 90.0f) && (90.0f <= this->actor.world.pos.y)) {
this->timers[4] = 80;
- func_80033E1C(play, 1, 80, 0x5000);
+ Actor_RequestQuakeWithSpeed(play, 1, 80, 0x5000);
this->work[BFD_ROAR_TIMER] = 40;
this->work[BFD_MANE_EMBERS_TIMER] = 30;
this->work[BFD_SPLASH_TIMER] = 10;
}
if ((this->actor.prevPos.y > 90.0f) && (90.0f >= this->actor.world.pos.y)) {
this->timers[4] = 80;
- func_80033E1C(play, 1, 80, 0x5000);
+ Actor_RequestQuakeWithSpeed(play, 1, 80, 0x5000);
this->work[BFD_MANE_EMBERS_TIMER] = 30;
this->work[BFD_SPLASH_TIMER] = 10;
}
diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c
index 43afbefc9b..a4cd5f56ea 100644
--- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c
+++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c
@@ -243,7 +243,7 @@ void BossFd2_Emerge(BossFd2* this, PlayState* play) {
bossFd->faceExposed = 0;
bossFd->holePosition.x = this->actor.world.pos.x;
bossFd->holePosition.z = this->actor.world.pos.z;
- func_80033E1C(play, 1, 0x32, 0x5000);
+ Actor_RequestQuakeWithSpeed(play, 1, 50, 0x5000);
this->work[FD2_ACTION_STATE] = 1;
this->work[FD2_HOLE_COUNTER]++;
this->actor.world.pos.y = -200.0f;
diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
index b44e7191b2..79e1999f3a 100644
--- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
+++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c
@@ -1897,7 +1897,7 @@ void BossGanon_PoundFloor(BossGanon* this, PlayState* play) {
this->actor.world.pos.y = 60.0f;
this->unk_1C2 = 2;
this->timers[0] = 10;
- func_80033E88(&this->actor, play, 0xA, 0x14); // rumble
+ Actor_RequestQuakeAndRumble(&this->actor, play, 10, 20);
this->unk_19C = 35;
this->unk_19E = 0;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GANON_HIT_GND_IMP);
diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
index cce407735a..06ce4c4f73 100644
--- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
+++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c
@@ -170,7 +170,7 @@ void func_808FD4D4(BossGanon2* this, PlayState* play, s16 arg2, s16 arg3) {
}
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_MGANON_WALK);
- func_80033E88(&this->actor, play, 2, 0xA);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 2, 10);
}
void func_808FD5C4(BossGanon2* this, PlayState* play) {
@@ -2004,7 +2004,7 @@ void BossGanon2_Update(Actor* thisx, PlayState* play) {
UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
if (this->actor.velocity.y < -5.0f) {
- func_80033E88(&this->actor, play, 5, 20);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 5, 20);
func_80078884(NA_SE_IT_BOMB_EXPLOSION);
}
this->actor.velocity.y = 0.0f;
diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c
index e2c6bd4d06..ae4b8e1cd3 100644
--- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c
+++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c
@@ -1309,7 +1309,7 @@ void BossGoma_FloorAttack(BossGoma* this, PlayState* play) {
if (Animation_OnFrame(&this->skelanime, 10.0f)) {
BossGoma_PlayEffectsAndSfx(this, play, 3, 5);
- func_80033E88(&this->actor, play, 5, 15);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 5, 15);
}
if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaAttackAnim))) {
@@ -1434,7 +1434,7 @@ void BossGoma_FallJump(BossGoma* this, PlayState* play) {
BossGoma_SetupFloorLand(this);
this->actor.velocity.y = 0.0f;
BossGoma_PlayEffectsAndSfx(this, play, 0, 8);
- func_80033E88(&this->actor, play, 5, 0xF);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 5, 15);
}
}
@@ -1451,7 +1451,7 @@ void BossGoma_FallStruckDown(BossGoma* this, PlayState* play) {
BossGoma_SetupFloorLandStruckDown(this);
this->actor.velocity.y = 0.0f;
BossGoma_PlayEffectsAndSfx(this, play, 0, 8);
- func_80033E88(&this->actor, play, 0xA, 0xF);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 10, 15);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GOMA_DAM1);
}
}
@@ -1847,7 +1847,7 @@ void BossGoma_UpdateHit(BossGoma* this, PlayState* play) {
}
this->timer = 4;
- func_80033E88(&this->actor, play, 4, 0xC);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 4, 12);
}
}
}
diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c
index d1085f3a18..041f3ead7c 100644
--- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c
+++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c
@@ -550,8 +550,8 @@ void BossTw_Init(Actor* thisx, PlayState* play2) {
this->actor.colChkInfo.health = 24;
this->actor.update = BossTw_TwinrovaUpdate;
this->actor.draw = BossTw_TwinrovaDraw;
- SkelAnime_InitFlex(play, &this->skelAnime, &object_tw_Skel_032020, &object_tw_Anim_0244B4, NULL, NULL, 0);
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_0244B4, -3.0f);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gTwinrovaSkel, &gTwinrovaTPoseAnim, NULL, NULL, 0);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaTPoseAnim, -3.0f);
if (GET_EVENTCHKINF(EVENTCHKINF_75)) {
// began twinrova battle
@@ -807,7 +807,7 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) {
this->beamDist = sqrtf(SQ(offset.x) + SQ(offset.y) + SQ(offset.z));
func_8002F6D4(play, &this->actor, 3.0f, this->actor.shape.rot.y, 0.0f, 0x20);
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
if (sFreezeState == 0) {
sFreezeState = 1;
}
@@ -1038,7 +1038,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) {
Math_ApproachF(&this->spawnPortalAlpha, 0, 1.0f, 30.0f);
} else {
Math_ApproachF(&this->flameAlpha, 255.0f, 1.0f, 10.0f);
- if (this->actor.params == 1) {
+ if (this->actor.params == TW_KOUME) {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_TWINROBA_MS_FIRE - SFX_FLAG);
} else {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_TWINROBA_MS_FREEZE - SFX_FLAG);
@@ -1132,7 +1132,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) {
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->beamReflectionOrigin, &this->unk_54C,
&this->actor.projectedW);
- if (this->actor.params == 1) {
+ if (this->actor.params == TW_KOUME) {
Audio_PlaySfxGeneral(NA_SE_EN_TWINROBA_SHOOT_FIRE - SFX_FLAG, &this->unk_54C, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else {
@@ -1162,7 +1162,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) {
SkinMatrix_Vec3fMtxFMultXYZW(&play->viewProjectionMtxF, &this->unk_530, &this->unk_558,
&this->actor.projectedW);
- if (this->actor.params == 1) {
+ if (this->actor.params == TW_KOUME) {
Audio_PlaySfxGeneral(NA_SE_EN_TWINROBA_SHOOT_FIRE - SFX_FLAG, &this->unk_558, 4U,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
Audio_PlaySfxGeneral(NA_SE_EN_TWINROBA_REFL_FIRE - SFX_FLAG, &this->unk_558, 4,
@@ -1344,7 +1344,7 @@ void BossTw_SetupHitByBeam(BossTw* this, PlayState* play) {
this->timers[0] = 53;
this->actor.speedXZ = 0.0f;
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
this->work[FOG_TIMER] = 20;
}
}
@@ -1369,11 +1369,11 @@ void BossTw_HitByBeam(BossTw* this, PlayState* play) {
accel.y = 0.1f;
accel.z = 0.0f;
- BossTw_AddDmgCloud(play, this->actor.params + 2, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 15.0f, 0, 0,
- 150);
+ BossTw_AddDmgCloud(play, this->actor.params + TWEFF_2, &pos, &velocity, &accel, Rand_ZeroFloat(10.0f) + 15.0f,
+ 0, 0, 150);
}
- if (this->actor.params == 1) {
+ if (this->actor.params == TW_KOUME) {
Math_ApproachF(&this->fogR, 255.0f, 1.0f, 30.0f);
Math_ApproachF(&this->fogG, 255.0f, 1.0f, 30.0f);
Math_ApproachF(&this->fogB, 255.0f, 1.0f, 30.0f);
@@ -1636,8 +1636,8 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) {
BossTw_SetupWait(sKotakePtr, play);
BossTw_SetupWait(sKoumePtr, play);
Actor_SetScale(&this->actor, 0.0f);
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_038E2C, 0.0f);
- this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_038E2C);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaIntroAnim, 0.0f);
+ this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaIntroAnim);
this->timers[0] = 50;
func_8002DF54(play, &this->actor, 2);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_TWINROBA_TRANSFORM);
@@ -1651,7 +1651,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, PlayState* play) {
case 1:
if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) {
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -15.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaHoverAnim, -15.0f);
}
sEnvType = -1;
@@ -2214,7 +2214,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, PlayState* play) {
play->envCtx.prevLightSetting = 1;
play->envCtx.lightSetting = 1;
play->envCtx.lightBlend = 0.0f;
- TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(object_tw_Blob_02E170),
+ TitleCard_InitBossName(play, &play->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gTwinrovaTitleCardTex),
0xA0, 0xB4, 0x80, 0x28);
SET_EVENTCHKINF(EVENTCHKINF_75);
SEQCMD_PLAY_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0, 0, NA_BGM_BOSS);
@@ -2337,7 +2337,7 @@ void BossTw_DeathBall(BossTw* this, PlayState* play) {
}
}
- if (this->actor.params == 0x69) {
+ if (this->actor.params == TW_DEATHBALL_KOUME) {
this->targetPos.x = sKoumePtr->actor.world.pos.x;
this->targetPos.z = sKoumePtr->actor.world.pos.z;
} else {
@@ -2369,7 +2369,7 @@ void BossTw_DeathBall(BossTw* this, PlayState* play) {
void BossTw_TwinrovaSetupDeathCS(BossTw* this, PlayState* play) {
this->actionFunc = BossTw_TwinrovaDeathCS;
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_024374, -3.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaDamageAnim, -3.0f);
this->actor.world.rot.y = this->actor.shape.rot.y;
this->actor.flags &= ~ACTOR_FLAG_0;
this->csState2 = this->csState1 = 0;
@@ -2622,7 +2622,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, PlayState* play) {
switch (this->csState1) {
case 0:
if (this->work[CS_TIMER_1] == 15) {
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_0216DC, -3.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaDeathAnim, -3.0f);
}
if (this->work[CS_TIMER_1] >= 15) {
@@ -2910,7 +2910,7 @@ void BossTw_Update(Actor* thisx, PlayState* play) {
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);
}
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
this->workf[OUTR_CRWN_TX_X2] += 1.0f;
this->workf[OUTR_CRWN_TX_Y2] -= 7.0f;
this->workf[INNR_CRWN_TX_Y1] += 1.0f;
@@ -3180,7 +3180,7 @@ s32 BossTw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (limbIndex == 21) {
if (this->unk_5F8 == 0) {
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
*dList = object_tw_DL_012CE0;
} else {
*dList = object_tw_DL_0134B8;
@@ -3192,7 +3192,7 @@ s32 BossTw_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
if (this->actionFunc == BossTw_DeathCS) {
*dList = NULL;
} else if (this->scepterAlpha == 0.0f) {
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
*dList = object_tw_DL_012B38;
} else {
*dList = object_tw_DL_013310;
@@ -3222,7 +3222,7 @@ void BossTw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
if (this->unk_5F8 != 0) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6190),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_013AE8));
} else {
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_013D68));
@@ -3239,7 +3239,7 @@ void BossTw_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot
if (this->scepterAlpha > 0.0f) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6221),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 225, 255, (s16)this->scepterAlpha);
gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_013E98));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s16)this->scepterAlpha);
@@ -3270,7 +3270,7 @@ void func_80941BC0(BossTw* this, PlayState* play) {
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->workf[UNK_F11]);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 40, 30, 80);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01BC00));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIcePoolDL));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 215, 215, 215, (s16)this->workf[UNK_F11] * this->workf[UNK_F14]);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 255, 128);
gSPSegment(POLY_XLU_DISP++, 8,
@@ -3280,7 +3280,7 @@ void func_80941BC0(BossTw* this, PlayState* play) {
Matrix_RotateY(this->workf[UNK_F15], MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6423),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01C1C0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIcePoolShineDL));
Matrix_Pop();
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6427),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
@@ -3295,7 +3295,7 @@ void func_80941BC0(BossTw* this, PlayState* play) {
GBL_c1(G_BL_CLR_FOG, G_BL_A_SHADE, G_BL_CLR_IN, G_BL_1MA),
G_RM_ZB_OVL_SURF2);
gSPSetGeometryMode(POLY_XLU_DISP++, G_CULL_BACK | G_FOG);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A790));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaEffectHaloDL));
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 6461);
@@ -3319,7 +3319,7 @@ void func_80942180(BossTw* this, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 40, 00, (s16)this->workf[KM_GRND_CRTR_A]);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, 128);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_019D40));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaFirePoolDL));
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6514),
@@ -3331,7 +3331,7 @@ void func_80942180(BossTw* this, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 80, 0, 0, (s16)this->workf[KM_GD_SMOKE_A]);
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 0, 100);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_018FC0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaFireSmokeDL));
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (-this->work[CS_TIMER_1] * 3) & 0x7F, 0, 0x20,
@@ -3342,7 +3342,7 @@ void func_80942180(BossTw* this, PlayState* play) {
Matrix_Scale(this->workf[KM_GD_FLM_SCL], this->workf[KM_GD_FLM_SCL], this->workf[KM_GD_FLM_SCL], MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6575),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_019938));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaBigFlameDL));
Matrix_Pop();
@@ -3366,19 +3366,19 @@ void func_809426F0(BossTw* this, PlayState* play) {
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6614),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 135, 175, 165, (s16)this->spawnPortalAlpha);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01CEE0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaKotakeMagicSigilDL));
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (s16)this->spawnPortalAlpha);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DBE8));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaKoumeMagicSigilDL));
}
Matrix_Pop();
- if (this->actor.params == 0) {
+ if (this->actor.params == TW_KOTAKE) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s16)this->flameAlpha);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceMaterialDL));
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, (s16)this->flameAlpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128);
@@ -3397,7 +3397,7 @@ void func_809426F0(BossTw* this, PlayState* play) {
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6751),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaFireDL));
Matrix_Pop();
}
@@ -3416,7 +3416,7 @@ void func_80942C70(Actor* thisx, PlayState* play) {
Gfx_TexScroll(play->state.gfxCtx, 0, (u8)(this->work[CS_TIMER_1] * -0xF), 0x20, 0x40));
alpha = this->beamScale * 100.0f * 255.0f;
- if (this->actor.params == 1) {
+ if (this->actor.params == TW_KOUME) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 60, alpha);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128);
} else {
@@ -3431,7 +3431,7 @@ void func_80942C70(Actor* thisx, PlayState* play) {
Matrix_Scale(this->beamScale, this->beamScale, (this->beamDist * 0.01f * 98.0f) / 20000.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6846),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DDF0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaBeamDL));
if (this->beamReflectionDist > 10.0f) {
Matrix_Translate(this->beamReflectionOrigin.x, this->beamReflectionOrigin.y, this->beamReflectionOrigin.z,
@@ -3443,7 +3443,7 @@ void func_80942C70(Actor* thisx, PlayState* play) {
MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6870),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DDF0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaBeamDL));
}
Matrix_Pop();
@@ -3463,7 +3463,7 @@ void func_80943028(Actor* thisx, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 6908),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F608));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaHaloDL));
Gfx_SetupDL_44Xlu(play->state.gfxCtx);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, 200);
Matrix_Translate(this->actor.world.pos.x, 240.0f, this->actor.world.pos.z, MTXMODE_NEW);
@@ -3564,10 +3564,10 @@ void BossTw_Draw(Actor* thisx, PlayState* play2) {
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7123);
}
-void* D_8094A9B0[] = {
- object_tw_Tex_02A9B0,
- object_tw_Tex_02A070,
- object_tw_Tex_02A470,
+void* sTwinrovaEyeTextures[] = {
+ gTwinrovaEyeOpenTex,
+ gTwinrovaEyeHalfTex,
+ gTwinrovaEyeClosedTex,
};
s32 BossTw_TwinrovaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
@@ -3576,53 +3576,53 @@ s32 BossTw_TwinrovaOverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList,
OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7139);
switch (limbIndex) {
- case 21:
+ case TWINROVA_LIMB_HEAD:
gSPSegment(POLY_OPA_DISP++, 0xC,
Gfx_TexScroll(play->state.gfxCtx, 0, (s16)(f32)this->work[CS_TIMER_1], 8, 8));
- gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(D_8094A9B0[this->eyeTexIdx]));
- gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(D_8094A9B0[this->leftEyeTexIdx]));
+ gSPSegment(POLY_OPA_DISP++, 8, SEGMENTED_TO_VIRTUAL(sTwinrovaEyeTextures[this->eyeTexIdx]));
+ gSPSegment(POLY_OPA_DISP++, 9, SEGMENTED_TO_VIRTUAL(sTwinrovaEyeTextures[this->leftEyeTexIdx]));
gDPSetEnvColor(POLY_OPA_DISP++, 255, 255, 255, this->work[UNK_S8]);
break;
- case 17:
- case 41:
+ case TWINROVA_LIMB_HAIR_FIRE_JET:
+ case TWINROVA_LIMB_BROOM_FIRE_JET:
*dList = NULL;
gSPSegment(POLY_XLU_DISP++, 0xA,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, 0,
-this->work[CS_TIMER_1] * 0xF, 0x20, 0x40));
break;
- case 18:
- case 42:
+ case TWINROVA_LIMB_HAIR_FIRE_TRAIL:
+ case TWINROVA_LIMB_BROOM_FIRE_TRAIL:
*dList = NULL;
gSPSegment(POLY_XLU_DISP++, 0xB,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1, 0,
-this->work[CS_TIMER_1] * 0xA, 0x20, 0x40));
break;
- case 16:
- case 32:
+ case TWINROVA_LIMB_HAIR_ICE_JET:
+ case TWINROVA_LIMB_BROOM_ICE_JET:
*dList = NULL;
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, 0, 0x20, 0x20, 1,
this->work[CS_TIMER_1], -this->work[CS_TIMER_1] * 7, 0x20, 0x40));
break;
- case 15:
- case 31:
+ case TWINROVA_LIMB_HAIR_ICE_TRAIL:
+ case TWINROVA_LIMB_BROOM_ICE_TRAIL:
*dList = NULL;
gSPSegment(POLY_XLU_DISP++, 9, Gfx_TexScroll(play->state.gfxCtx, 0, this->work[CS_TIMER_1], 0x20, 0x40));
break;
- case 19:
+ case TWINROVA_LIMB_LEFT_HAIR_BUN:
if (this->unk_5F8 != 0) {
- *dList = object_tw_DL_02D940;
+ *dList = gTwinrovaLeftHairBunDL;
}
break;
- case 20:
+ case TWINROVA_LIMB_RIGHT_HAIR_BUN:
if (this->unk_5F8 != 0) {
- *dList = object_tw_DL_02D890;
+ *dList = gTwinrovaRightHairBunDL;
}
break;
}
- if (this->unk_5F8 != 0 && ((limbIndex == 34) || (limbIndex == 40))) {
+ if ((this->unk_5F8 != 0) && ((limbIndex == TWINROVA_LIMB_LEFT_BROOM) || (limbIndex == TWINROVA_LIMB_RIGHT_BROOM))) {
*dList = NULL;
}
@@ -3642,24 +3642,24 @@ void BossTw_TwinrovaPostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Ve
OPEN_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7262);
switch (limbIndex) {
- case 34:
+ case TWINROVA_LIMB_LEFT_BROOM:
Matrix_MultVec3f(&D_8094A9D4, &this->leftScepterPos);
break;
- case 40:
+ case TWINROVA_LIMB_RIGHT_BROOM:
Matrix_MultVec3f(&D_8094A9E0, &this->rightScepterPos);
break;
- case 21:
+ case TWINROVA_LIMB_HEAD:
Matrix_MultVec3f(&D_8094A9BC, &this->actor.focus.pos);
Matrix_MultVec3f(&D_8094A9C8, &this->crownPos);
break;
- case 15:
- case 16:
- case 17:
- case 18:
- case 31:
- case 32:
- case 41:
- case 42:
+ case TWINROVA_LIMB_HAIR_ICE_TRAIL:
+ case TWINROVA_LIMB_HAIR_ICE_JET:
+ case TWINROVA_LIMB_HAIR_FIRE_JET:
+ case TWINROVA_LIMB_HAIR_FIRE_TRAIL:
+ case TWINROVA_LIMB_BROOM_ICE_TRAIL:
+ case TWINROVA_LIMB_BROOM_ICE_JET:
+ case TWINROVA_LIMB_BROOM_FIRE_JET:
+ case TWINROVA_LIMB_BROOM_FIRE_TRAIL:
Matrix_Push();
Matrix_Scale(this->workf[UNK_F12], this->workf[UNK_F12], this->workf[UNK_F12], MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7295),
@@ -3718,21 +3718,21 @@ void BossTw_ShieldChargeDraw(BossTw* this, PlayState* play) {
temp_a0 = (Math_SinS(this->work[CS_TIMER_1] * 2730 * temp_t0) * D_8094C854 * 0.5f) + (D_8094C854 * 0.5f);
if (sShieldFireCharge != 0) {
gDPSetEnvColor(POLY_XLU_DISP++, 255, 245, 255, temp_a0);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E0E0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaMirrorShieldFireChargeSidesDL));
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, (this->work[CS_TIMER_1] * 2) * temp_t0,
0, 0x20, 0x20, 1, (-this->work[CS_TIMER_1] * 2) * temp_t0, 0, 0x20, 0x20));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 100, 20, 0, (s16)D_8094C854);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E020));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaMirrorShieldFireChargeCenterDL));
} else {
gDPSetEnvColor(POLY_XLU_DISP++, 225, 255, 255, temp_a0);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E3A0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaMirrorShieldIceChargeSidesDL));
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0,
(-this->work[CS_TIMER_1] * 5) * temp_t0, 0x20, 0x40, 1,
(this->work[CS_TIMER_1] * 4) * temp_t0, 0, 0x20, 0x20));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 175, 205, 195, (s16)D_8094C854);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E2C0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaMirrorShieldIceChargeCenterDL));
}
}
}
@@ -3767,7 +3767,7 @@ void BossTw_ShieldChargeDraw(BossTw* this, PlayState* play) {
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, 0, this->work[CS_TIMER_1] * D_8094C872, 0x20,
0x40, 1, 0, this->work[CS_TIMER_1] * D_8094C872, 0x20, 0x20));
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01E9F0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaShieldAbsorbAndReflectEffectDL));
}
Matrix_Pop();
@@ -3792,28 +3792,28 @@ void BossTw_SpawnPortalDraw(BossTw* this, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s16)this->spawnPortalAlpha);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7582),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EC68));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaSpawnPortalShadowDL));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 135, 175, 165, (s16)this->spawnPortalAlpha);
Matrix_Translate(0.0f, 2.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7596),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01CEE0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaKotakeMagicSigilDL));
Matrix_Translate(0.0f, 232.0f, 600.0f, MTXMODE_NEW);
Matrix_Scale(this->spawnPortalScale, this->spawnPortalScale, this->spawnPortalScale, MTXMODE_APPLY);
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, 0, 0, (s16)this->spawnPortalAlpha);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7617),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EC68));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaSpawnPortalShadowDL));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 0, (s16)this->spawnPortalAlpha);
Matrix_Translate(0.0f, 2.0f, 0.0f, MTXMODE_APPLY);
Matrix_RotateX(M_PI / 2.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7631),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01DBE8));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaKoumeMagicSigilDL));
Matrix_Pop();
@@ -3833,7 +3833,7 @@ void func_80944C50(BossTw* this, PlayState* play) {
Matrix_Scale(this->workf[UNK_F19], this->workf[UNK_F19], this->workf[UNK_F19], MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7671),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F390));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaLightCircleDL));
Matrix_Pop();
gSPSegment(POLY_XLU_DISP++, 8,
@@ -3842,7 +3842,7 @@ void func_80944C50(BossTw* this, PlayState* play) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->workf[UNK_F18] / 2);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7694),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01F238));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaLightRaysDL));
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(play->state.gfxCtx, G_TX_RENDERTILE, -sKoumePtr->work[CS_TIMER_1] * 5,
@@ -3856,7 +3856,7 @@ void func_80944C50(BossTw* this, PlayState* play) {
Matrix_Scale(scale, 1.0f, scale, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 7728),
G_MTX_LOAD | G_MTX_MODELVIEW | G_MTX_NOPUSH);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01EEB0));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaLightPillarDL));
Matrix_Pop();
CLOSE_DISPS(play->state.gfxCtx, "../z_boss_tw.c", 7732);
@@ -4253,13 +4253,14 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) {
accel.x = 0.0f;
accel.y = 0.13f;
accel.z = 0.0f;
- BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20.0f, 0, 0, 80);
+ BossTw_AddDmgCloud(play, TWEFF_3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20.0f, 0, 0, 80);
velocity.x = Rand_CenteredFloat(10.0f);
velocity.z = Rand_CenteredFloat(10.0f);
velocity.y = Rand_ZeroFloat(3.0f) + 3.0f;
pos.x = sKotakePtr->groundBlastPos2.x + (velocity.x * 0.5f);
pos.z = sKotakePtr->groundBlastPos2.z + (velocity.z * 0.5f);
- BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 15.0f, 255, 2, 130);
+ BossTw_AddDmgCloud(play, TWEFF_3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 15.0f, 255, 2,
+ 130);
}
Math_ApproachF(&sKotakePtr->workf[UNK_F9], 80.0f, 1.0f, 3.0f);
@@ -4292,7 +4293,8 @@ void BossTw_BlastIce(BossTw* this, PlayState* play) {
accel.x = 0.0f;
accel.y = 0.13f;
accel.z = 0.0f;
- BossTw_AddDmgCloud(play, 3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20, 0, 0, 80);
+ BossTw_AddDmgCloud(play, TWEFF_3, &pos, &velocity, &accel, Rand_ZeroFloat(5.0f) + 20, 0, 0,
+ 80);
}
}
sp80 = 3.0f;
@@ -4456,7 +4458,7 @@ void BossTw_BlastDraw(Actor* thisx, PlayState* play2) {
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 8865),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaFireDL));
}
break;
@@ -4465,7 +4467,7 @@ void BossTw_BlastDraw(Actor* thisx, PlayState* play2) {
case TW_ICE_BLAST:
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s8)this->workf[TAIL_ALPHA]);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceMaterialDL));
for (i = 9; i >= 0; i--) {
gSPSegment(POLY_XLU_DISP++, 8,
Gfx_TwoTexScroll(
@@ -4480,7 +4482,7 @@ void BossTw_BlastDraw(Actor* thisx, PlayState* play2) {
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 9004),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceModelDL));
}
break;
@@ -4520,11 +4522,11 @@ void BossTw_DrawDeathBall(Actor* thisx, PlayState* play2) {
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 9071),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaFireDL));
}
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, (s8)this->workf[TAIL_ALPHA]);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceMaterialDL));
for (i = 9; i >= 0; i--) {
gSPSegment(POLY_XLU_DISP++, 8,
@@ -4540,7 +4542,7 @@ void BossTw_DrawDeathBall(Actor* thisx, PlayState* play2) {
Matrix_ReplaceRotation(&play->billboardMtxF);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_boss_tw.c", 9107),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceModelDL));
}
}
@@ -4573,7 +4575,7 @@ void BossTw_UpdateEffects(PlayState* play) {
Actor* unk44;
for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
- if (eff->type != 0) {
+ if (eff->type != TWEFF_NONE) {
eff->pos.x += eff->curSpeed.x;
eff->pos.y += eff->curSpeed.y;
eff->pos.z += eff->curSpeed.z;
@@ -4582,7 +4584,7 @@ void BossTw_UpdateEffects(PlayState* play) {
eff->curSpeed.y += eff->accel.y;
eff->curSpeed.z += eff->accel.z;
- if (eff->type == 1) {
+ if (eff->type == TWEFF_DOT) {
colorIdx = eff->frame % 4;
if (eff->work[EFF_ARGS] == 0) {
@@ -4599,7 +4601,7 @@ void BossTw_UpdateEffects(PlayState* play) {
eff->type = TWEFF_NONE;
}
- } else if ((eff->type == 3) || (eff->type == 2)) {
+ } else if ((eff->type == TWEFF_3) || (eff->type == TWEFF_2)) {
if (eff->work[EFF_ARGS] == 2) {
eff->alpha -= 20;
if (eff->alpha <= 0) {
@@ -4763,7 +4765,7 @@ void BossTw_UpdateEffects(PlayState* play) {
}
BossTw_AddFlameEffect(play, &eff->pos, &sZeroVector, &sZeroVector, 10, eff->work[EFF_ARGS]);
- } else if (eff->type == 4) {
+ } else if (eff->type == TWEFF_RING) {
if (eff->work[EFF_UNKS1] == 0) {
Math_ApproachF(&eff->workf[EFF_SCALE], eff->workf[EFF_DIST], 0.05f, 1.0f);
@@ -4851,8 +4853,8 @@ void BossTw_UpdateEffects(PlayState* play) {
spA8.y = 0.1f;
spA8.z = 0.0f;
- BossTw_AddDmgCloud(play, 3, &spC0, &spB4, &spA8, phi_f22 + Rand_ZeroFloat(phi_f22 * 0.5f), 0, 0,
- 150);
+ BossTw_AddDmgCloud(play, TWEFF_3, &spC0, &spB4, &spA8, phi_f22 + Rand_ZeroFloat(phi_f22 * 0.5f),
+ 0, 0, 150);
}
}
}
@@ -4905,9 +4907,9 @@ void BossTw_DrawEffects(PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
- if (currentEffect->type == 1) {
+ if (currentEffect->type == TWEFF_DOT) {
if (materialFlag == 0) {
- gSPDisplayList(POLY_XLU_DISP++, object_tw_DL_01A528);
+ gSPDisplayList(POLY_XLU_DISP++, gTwinrovaMagicParticleMaterialDL);
materialFlag++;
}
@@ -4918,7 +4920,7 @@ void BossTw_DrawEffects(PlayState* play) {
Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9617),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, object_tw_DL_01A5A8);
+ gSPDisplayList(POLY_XLU_DISP++, gTwinrovaMagicParticleModelDL);
}
currentEffect++;
@@ -4928,9 +4930,9 @@ void BossTw_DrawEffects(PlayState* play) {
currentEffect = effectHead;
for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
- if (currentEffect->type == 3) {
+ if (currentEffect->type == TWEFF_3) {
if (materialFlag == 0) {
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceMaterialDL));
materialFlag++;
}
@@ -4943,7 +4945,7 @@ void BossTw_DrawEffects(PlayState* play) {
Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9660),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceModelDL));
}
currentEffect++;
}
@@ -4952,7 +4954,7 @@ void BossTw_DrawEffects(PlayState* play) {
currentEffect = effectHead;
for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
- if (currentEffect->type == 2) {
+ if (currentEffect->type == TWEFF_2) {
if (materialFlag == 0) {
gDPPipeSync(POLY_XLU_DISP++);
gDPSetEnvColor(POLY_XLU_DISP++, 255, 215, 255, 128);
@@ -4968,7 +4970,7 @@ void BossTw_DrawEffects(PlayState* play) {
Matrix_Scale(currentEffect->workf[EFF_SCALE], currentEffect->workf[EFF_SCALE], 1.0f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9709),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaFireDL));
}
currentEffect++;
@@ -4978,7 +4980,7 @@ void BossTw_DrawEffects(PlayState* play) {
currentEffect = effectHead;
for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
- if (currentEffect->type == 4) {
+ if (currentEffect->type == TWEFF_RING) {
if (materialFlag == 0) {
materialFlag++;
}
@@ -5013,7 +5015,7 @@ void BossTw_DrawEffects(PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gDPSetRenderMode(POLY_XLU_DISP++, G_RM_PASS, G_RM_AA_ZB_XLU_SURF2);
gSPClearGeometryMode(POLY_XLU_DISP++, G_CULL_BACK | G_FOG);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A790));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaEffectHaloDL));
}
currentEffect++;
@@ -5028,7 +5030,7 @@ void BossTw_DrawEffects(PlayState* play) {
if (currentEffect->type == TWEFF_PLYR_FRZ) {
if (materialFlag == 0) {
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AA50));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceSurroundingPlayerMaterialDL));
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, 255);
gSPSegment(
POLY_XLU_DISP++, 8,
@@ -5059,7 +5061,7 @@ void BossTw_DrawEffects(PlayState* play) {
Matrix_RotateX((BossTw_RandZeroOne() - 0.5f) * M_PI * 0.5f, MTXMODE_APPLY);
gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(gfxCtx, "../z_boss_tw.c", 9855),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceModelDL));
}
}
@@ -5070,10 +5072,10 @@ void BossTw_DrawEffects(PlayState* play) {
currentEffect = effectHead;
for (i = 0; i < BOSS_TW_EFFECT_COUNT; i++) {
- if (currentEffect->type >= 6) {
+ if (currentEffect->type >= TWEFF_FLAME) {
if (currentEffect->work[EFF_ARGS] == 0) {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 195, 225, 235, currentEffect->alpha);
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A998));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceMaterialDL));
} else {
gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 200, 20, 0, currentEffect->alpha);
gDPPipeSync(POLY_XLU_DISP++);
@@ -5090,9 +5092,9 @@ void BossTw_DrawEffects(PlayState* play) {
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
if (currentEffect->work[EFF_ARGS] == 0) {
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01AB00));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaIceModelDL));
} else {
- gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(object_tw_DL_01A430));
+ gSPDisplayList(POLY_XLU_DISP++, SEGMENTED_TO_VIRTUAL(gTwinrovaFireDL));
}
}
@@ -5104,7 +5106,7 @@ void BossTw_DrawEffects(PlayState* play) {
void BossTw_TwinrovaSetupArriveAtTarget(BossTw* this, PlayState* play) {
this->actionFunc = BossTw_TwinrovaArriveAtTarget;
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -3.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaHoverAnim, -3.0f);
this->work[CS_TIMER_1] = Rand_ZeroFloat(100.0f);
this->timers[1] = 25;
this->rotateSpeed = 0.0f;
@@ -5127,8 +5129,8 @@ void BossTw_TwinrovaArriveAtTarget(BossTw* this, PlayState* play) {
void BossTw_TwinrovaSetupChargeBlast(BossTw* this, PlayState* play) {
this->actionFunc = BossTw_TwinrovaChargeBlast;
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_036FBC, -5.0f);
- this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_036FBC);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaWindUpAnim, -5.0f);
+ this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaWindUpAnim);
this->csState1 = 0;
}
@@ -5160,12 +5162,12 @@ void BossTw_TwinrovaSetupShootBlast(BossTw* this, PlayState* play) {
this->actionFunc = BossTw_TwinrovaShootBlast;
if (sTwinrovaBlastType == 0) {
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_022700, 0.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaIceAttackAnim, 0.0f);
} else {
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_023750, 0.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaFireAttackAnim, 0.0f);
}
- this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_023750);
+ this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaFireAttackAnim);
}
void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play) {
@@ -5222,7 +5224,7 @@ void BossTw_TwinrovaShootBlast(BossTw* this, PlayState* play) {
void BossTw_TwinrovaSetupDoneBlastShoot(BossTw* this, PlayState* play) {
this->actionFunc = BossTw_TwinrovaDoneBlastShoot;
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaHoverAnim, -10.0f);
this->timers[1] = 60;
}
@@ -5243,7 +5245,7 @@ void BossTw_TwinrovaDoneBlastShoot(BossTw* this, PlayState* play) {
void BossTw_TwinrovaDamage(BossTw* this, PlayState* play, u8 damage) {
if (this->actionFunc != BossTw_TwinrovaStun) {
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_0338F0, -15.0f);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaChargedAttackHitAnim, -15.0f);
this->timers[0] = 150;
this->timers[1] = 20;
this->csState1 = 0;
@@ -5251,8 +5253,8 @@ void BossTw_TwinrovaDamage(BossTw* this, PlayState* play, u8 damage) {
} else {
this->work[FOG_TIMER] = 10;
this->work[INVINC_TIMER] = 20;
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_024374, -3.0f);
- this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_024374);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaDamageAnim, -3.0f);
+ this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaDamageAnim);
this->csState1 = 1;
if ((s8)(this->actor.colChkInfo.health -= damage) < 0) {
@@ -5279,7 +5281,7 @@ void BossTw_TwinrovaStun(BossTw* this, PlayState* play) {
this->unk_5F8 = 1;
this->actor.flags |= ACTOR_FLAG_10;
- cloudType = sTwinrovaBlastType == 0 ? 3 : 2;
+ cloudType = sTwinrovaBlastType == 0 ? TWEFF_3 : TWEFF_2;
if ((this->work[CS_TIMER_1] % 8) == 0) {
Vec3f pos;
@@ -5314,12 +5316,12 @@ void BossTw_TwinrovaStun(BossTw* this, PlayState* play) {
if (this->csState1 == 0) {
if (this->timers[1] == 0) {
this->csState1 = 1;
- this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_0343B4);
- Animation_Change(&this->skelAnime, &object_tw_Anim_0343B4, 1.0f, 0.0f, this->workf[ANIM_SW_TGT], 3, 0.0f);
+ this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaStunStartAnim);
+ Animation_Change(&this->skelAnime, &gTwinrovaStunStartAnim, 1.0f, 0.0f, this->workf[ANIM_SW_TGT], 3, 0.0f);
}
} else if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) {
this->workf[ANIM_SW_TGT] = 1000.0f;
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_035030, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaStunLoopAnim, 0.0f);
}
if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) {
@@ -5332,8 +5334,8 @@ void BossTw_TwinrovaStun(BossTw* this, PlayState* play) {
}
void BossTw_TwinrovaSetupGetUp(BossTw* this, PlayState* play) {
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_035988, 0.0f);
- this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_035988);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaStunEndAnim, 0.0f);
+ this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaStunEndAnim);
this->actionFunc = BossTw_TwinrovaGetUp;
this->timers[0] = 50;
}
@@ -5344,7 +5346,7 @@ void BossTw_TwinrovaGetUp(BossTw* this, PlayState* play) {
if (Animation_OnFrame(&this->skelAnime, this->workf[ANIM_SW_TGT])) {
this->workf[ANIM_SW_TGT] = 1000.0f;
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaHoverAnim, 0.0f);
}
if (this->timers[0] == 0) {
@@ -5378,7 +5380,7 @@ void BossTw_TwinrovaSetupFly(BossTw* this, PlayState* play) {
this->actor.world.rot.y = RAD_TO_BINANG(Math_FAtan2F(xDiff, zDiff));
xzDist = sqrtf(SQ(xDiff) + SQ(zDiff));
this->actor.world.rot.x = RAD_TO_BINANG(Math_FAtan2F(yDiff, xzDist));
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, -10.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaHoverAnim, -10.0f);
}
void BossTw_TwinrovaFly(BossTw* this, PlayState* play) {
@@ -5414,7 +5416,7 @@ void BossTw_TwinrovaFly(BossTw* this, PlayState* play) {
void BossTw_TwinrovaSetupSpin(BossTw* this, PlayState* play) {
this->actionFunc = BossTw_TwinrovaSpin;
- Animation_MorphToLoop(&this->skelAnime, &object_tw_Anim_032BF8, 0.0f);
+ Animation_MorphToLoop(&this->skelAnime, &gTwinrovaHoverAnim, 0.0f);
this->timers[0] = 20;
this->actor.speedXZ = 0.0f;
}
@@ -5435,8 +5437,8 @@ void BossTw_TwinrovaSpin(BossTw* this, PlayState* play) {
void BossTw_TwinrovaSetupLaugh(BossTw* this, PlayState* play) {
this->actionFunc = BossTw_TwinrovaLaugh;
- Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_03A2D0, 0.0f);
- this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&object_tw_Anim_03A2D0);
+ Animation_MorphToPlayOnce(&this->skelAnime, &gTwinrovaLaughAnim, 0.0f);
+ this->workf[ANIM_SW_TGT] = Animation_GetLastFrame(&gTwinrovaLaughAnim);
this->actor.speedXZ = 0.0f;
}
diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h
index ebffaaeafa..9007ea93b4 100644
--- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h
+++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h
@@ -55,6 +55,54 @@ typedef enum {
/* 26 */ FWORK_MAX
} TwFwork;
+typedef enum {
+ /* 0 */ TWINROVA_LIMB_NONE,
+ /* 1 */ TWINROVA_LIMB_PELVIS,
+ /* 2 */ TWINROVA_LIMB_SASH_1,
+ /* 3 */ TWINROVA_LIMB_SASH_2,
+ /* 4 */ TWINROVA_LIMB_SASH_3,
+ /* 5 */ TWINROVA_LIMB_SASH_4,
+ /* 6 */ TWINROVA_LIMB_LEFT_THIGH,
+ /* 7 */ TWINROVA_LIMB_LEFT_SHIN,
+ /* 8 */ TWINROVA_LIMB_LEFT_FOOT,
+ /* 9 */ TWINROVA_LIMB_RIGHT_THIGH,
+ /* 10 */ TWINROVA_LIMB_RIGHT_SHIN,
+ /* 11 */ TWINROVA_LIMB_RIGHT_FOOT,
+ /* 12 */ TWINROVA_LIMB_TORSO,
+ /* 13 */ TWINROVA_LIMB_LEFT_BREAST,
+ /* 14 */ TWINROVA_LIMB_RIGHT_BREAST,
+ /* 15 */ TWINROVA_LIMB_HAIR_ICE_TRAIL,
+ /* 16 */ TWINROVA_LIMB_HAIR_ICE_JET,
+ /* 17 */ TWINROVA_LIMB_HAIR_FIRE_JET,
+ /* 18 */ TWINROVA_LIMB_HAIR_FIRE_TRAIL,
+ /* 19 */ TWINROVA_LIMB_LEFT_HAIR_BUN,
+ /* 20 */ TWINROVA_LIMB_RIGHT_HAIR_BUN,
+ /* 21 */ TWINROVA_LIMB_HEAD,
+ /* 22 */ TWINROVA_LIMB_RIGHT_BRAID_START,
+ /* 23 */ TWINROVA_LIMB_RIGHT_BRAID_END,
+ /* 24 */ TWINROVA_LIMB_LEFT_BRAID_START,
+ /* 25 */ TWINROVA_LIMB_LEFT_BRAID_END,
+ /* 26 */ TWINROVA_LIMB_LEFT_SHOULDER,
+ /* 27 */ TWINROVA_LIMB_LEFT_UPPER_ARM,
+ /* 28 */ TWINROVA_LIMB_LEFT_FOREARM,
+ /* 29 */ TWINROVA_LIMB_LEFT_SLEEVE_START,
+ /* 30 */ TWINROVA_LIMB_LEFT_SLEEVE_END,
+ /* 31 */ TWINROVA_LIMB_BROOM_ICE_TRAIL,
+ /* 32 */ TWINROVA_LIMB_BROOM_ICE_JET,
+ /* 33 */ TWINROVA_LIMB_LEFT_HAND,
+ /* 34 */ TWINROVA_LIMB_LEFT_BROOM,
+ /* 35 */ TWINROVA_LIMB_RIGHT_SHOULDER,
+ /* 36 */ TWINROVA_LIMB_RIGHT_UPPER_ARM,
+ /* 37 */ TWINROVA_LIMB_RIGHT_FOREARM,
+ /* 38 */ TWINROVA_LIMB_RIGHT_SLEEVE_START,
+ /* 39 */ TWINROVA_LIMB_RIGHT_SLEEVE_END,
+ /* 40 */ TWINROVA_LIMB_RIGHT_BROOM,
+ /* 41 */ TWINROVA_LIMB_BROOM_FIRE_JET,
+ /* 42 */ TWINROVA_LIMB_BROOM_FIRE_TRAIL,
+ /* 43 */ TWINROVA_LIMB_RIGHT_HAND,
+ /* 44 */ TWINROVA_LIMB_MAX
+} TwinrovaLimb;
+
typedef struct BossTw {
/* 0x0000 */ Actor actor;
/* 0x014C */ BossTwActionFunc actionFunc;
diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c
index 5426855675..267b6cc1cb 100644
--- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c
+++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c
@@ -1758,7 +1758,7 @@ void BossVa_SetupSupportCut(BossVa* this, PlayState* play) {
sFightPhase++;
Actor_Spawn(&play->actorCtx, play, ACTOR_BOSS_VA, this->armTip.x, this->armTip.y + 20.0f, this->armTip.z, 0,
this->actor.shape.rot.y, 0, stumpParams);
- Camera_AddQuake(&play->mainCamera, 2, 11, 8);
+ Camera_RequestQuake(&play->mainCamera, 2, 11, 8);
this->burst = false;
this->timer2 = 0;
BossVa_SetupAction(this, BossVa_SupportCut);
diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c
index 2256ef7e55..f2a98dd55e 100644
--- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c
+++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c
@@ -730,26 +730,29 @@ void DemoKankyo_Vec3fCopy(Vec3f* src, Vec3f* dst) {
dst->z = src->z;
}
-Vec3f* DemoKankyo_Vec3fAddVecSph(Vec3f* dst, Vec3f* vec, VecSph* sph) {
- Vec3f result;
- Vec3f sphVec;
+Vec3f* DemoKankyo_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) {
+ Vec3f sum;
+ Vec3f b;
- OLib_VecSphGeoToVec3f(&sphVec, sph);
- result.x = vec->x + sphVec.x;
- result.y = vec->y + sphVec.y;
- result.z = vec->z + sphVec.z;
- *dst = result;
- return dst;
+ OLib_VecGeoToVec3f(&b, geo);
+
+ sum.x = a->x + b.x;
+ sum.y = a->y + b.y;
+ sum.z = a->z + b.z;
+
+ *dest = sum;
+
+ return dest;
}
void DemoKankyo_Vec3fAddPosRot(PosRot* posRot, Vec3f* vec, Vec3f* dst) {
- VecSph sph;
+ VecGeo geo;
Vec3f vecCopy;
DemoKankyo_Vec3fCopy(vec, &vecCopy);
- OLib_Vec3fToVecSphGeo(&sph, &vecCopy);
- sph.yaw += posRot->rot.y;
- DemoKankyo_Vec3fAddVecSph(dst, &posRot->pos, &sph);
+ OLib_Vec3fToVecGeo(&geo, &vecCopy);
+ geo.yaw += posRot->rot.y;
+ DemoKankyo_AddVecGeoToVec3f(dst, &posRot->pos, &geo);
}
void DemoKankyo_DrawWarpSparkles(Actor* thisx, PlayState* play) {
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 71b60a7e60..e65ca80d88 100644
--- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
+++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
@@ -6,6 +6,7 @@
#include "z_door_shutter.h"
#include "overlays/actors/ovl_Boss_Goma/z_boss_goma.h"
+#include "quake.h"
#include "assets/objects/object_gnd/object_gnd.h"
#include "assets/objects/object_goma/object_goma.h"
@@ -31,7 +32,7 @@ void DoorShutter_Destroy(Actor* thisx, PlayState* play);
void DoorShutter_Update(Actor* thisx, PlayState* play);
void DoorShutter_Draw(Actor* thisx, PlayState* play);
-void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 camId);
+void DoorShutter_RequestQuakeAndRumble(PlayState* play, s16 quakeY, s16 quakeDuration, s16 camId);
void DoorShutter_SetupType(DoorShutter* this, PlayState* play);
void func_80996A54(DoorShutter* this, PlayState* play);
void func_80996B00(DoorShutter* this, PlayState* play);
@@ -102,7 +103,7 @@ static ShutterInfo sShutterInfo[] = {
{ gPhantomGanonBarsDL, NULL, 130, 12, 50, 15 },
{ gGohmaDoorDL, NULL, 130, 12, 50, 15 },
{ gSpiritDoorDL, gJyaDoorMetalBarsDL, 240, 14, 50, 15 },
- { object_bdoor_DL_0010C0, NULL, 130, 12, 50, 15 },
+ { gBossDoorDL, NULL, 130, 12, 50, 15 },
{ gDungeonDoorDL, gDoorMetalBarsDL, 130, 12, 20, 15 },
{ gFireTempleDoorFrontDL, gDoorMetalBarsDL, 130, 12, 20, 15 },
{ gFireTempleDoorBackDL, gDoorMetalBarsDL, 130, 12, 20, 15 },
@@ -164,8 +165,8 @@ static Gfx* sJabuDoorDLists[] = {
};
static void* D_809982D4[] = {
- object_bdoor_Tex_0065C0, object_bdoor_Tex_0035C0, object_bdoor_Tex_0055C0, object_bdoor_Tex_0045C0,
- object_bdoor_Tex_000000, object_bdoor_Tex_0025C0, object_bdoor_Tex_0015C0,
+ gBossDoorDefaultTex, gBossDoorFireTex, gBossDoorWaterTex, gBossDoorShadowTex,
+ gBossDoorGanonsCastleTex, gBossDoorForestTex, gBossDoorSpiritTex,
};
void DoorShutter_SetupAction(DoorShutter* this, DoorShutterActionFunc actionFunc) {
@@ -560,7 +561,7 @@ void func_80997220(DoorShutter* this, PlayState* play) {
}
void func_809973E8(DoorShutter* this, PlayState* play) {
- s32 quakeId;
+ s32 quakeIndex;
if (this->dyna.actor.velocity.y < 20.0f) {
Math_StepToF(&this->dyna.actor.velocity.y, 20.0f, 8.0f);
@@ -572,10 +573,10 @@ void func_809973E8(DoorShutter* this, PlayState* play) {
false);
}
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
- quakeId = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
- Quake_SetSpeed(quakeId, -32536);
- Quake_SetQuakeValues(quakeId, 2, 0, 0, 0);
- Quake_SetCountdown(quakeId, 10);
+ quakeIndex = Quake_Request(Play_GetCamera(play, CAM_ID_MAIN), 3);
+ Quake_SetSpeed(quakeIndex, -32536);
+ Quake_SetPerturbations(quakeIndex, 2, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 10);
Rumble_Request(this->dyna.actor.xyzDistToPlayerSq, 180, 20, 100);
func_80997220(this, play);
}
@@ -604,7 +605,7 @@ void func_809975C0(DoorShutter* this, PlayState* play) {
this->unk_164 = 10;
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_STONE_BOUND);
- func_8099803C(play, 2, 10, parent->subCamId);
+ DoorShutter_RequestQuakeAndRumble(play, 2, 10, parent->subCamId);
Actor_SpawnFloorDustRing(play, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, 10,
true);
}
@@ -766,11 +767,11 @@ void DoorShutter_Draw(Actor* thisx, PlayState* play) {
}
}
-void func_8099803C(PlayState* play, s16 y, s16 countdown, s16 camId) {
- s16 quakeId = Quake_Add(Play_GetCamera(play, camId), 3);
+void DoorShutter_RequestQuakeAndRumble(PlayState* play, s16 quakeY, s16 quakeDuration, s16 camId) {
+ s16 quakeIndex = Quake_Request(Play_GetCamera(play, camId), QUAKE_TYPE_3);
Rumble_Override(0.0f, 180, 20, 100);
- Quake_SetSpeed(quakeId, 20000);
- Quake_SetQuakeValues(quakeId, y, 0, 0, 0);
- Quake_SetCountdown(quakeId, countdown);
+ Quake_SetSpeed(quakeIndex, 20000);
+ Quake_SetPerturbations(quakeIndex, quakeY, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, quakeDuration);
}
diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c
index 66e27db961..f1085c5df6 100644
--- a/src/overlays/actors/ovl_En_Am/z_en_am.c
+++ b/src/overlays/actors/ovl_En_Am/z_en_am.c
@@ -114,10 +114,10 @@ static ColliderQuadInit sQuadInit = {
typedef enum {
/* 00 */ AM_DMGEFF_NONE, // used by anything that cant kill the armos
/* 01 */ AM_DMGEFF_NUT,
- /* 06 */ AM_DMGEFF_STUN = 6, // doesnt include deku nuts
+ /* 06 */ AM_DMGEFF_STUN = 6, // doesn't include deku nuts
/* 13 */ AM_DMGEFF_ICE = 13,
/* 14 */ AM_DMGEFF_MAGIC_FIRE_LIGHT,
- /* 15 */ AM_DMGEFF_KILL // any damage source that can kill the armos (and isnt a special case)
+ /* 15 */ AM_DMGEFF_KILL // any damage source that can kill the armos (and isn't a special case)
} ArmosDamageEffect;
static DamageTable sDamageTable = {
@@ -246,7 +246,7 @@ void EnAm_Destroy(Actor* thisx, PlayState* play) {
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
Collider_DestroyCylinder(play, &this->hurtCollider);
Collider_DestroyCylinder(play, &this->blockCollider);
- //! @bug Quad collider is not destroyed (though destroy doesnt really do anything anyway)
+ //! @bug Quad collider is not destroyed (though destroy doesn't really do anything anyway)
}
void EnAm_SpawnEffects(EnAm* this, PlayState* play) {
diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
index 9c2f3dc7a5..201276fd4c 100644
--- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
+++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c
@@ -262,7 +262,7 @@ void func_809BD1C8(EnBigokuta* this, PlayState* play) {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_DAIOCTA_LAND_WATER);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_GOLON_LAND_BIG);
- func_80033E88(&this->actor, play, 0xA, 8);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 10, 8);
}
void func_809BD2E4(EnBigokuta* this) {
diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c
index 6c49419a9c..baed701b84 100644
--- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c
+++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c
@@ -7,7 +7,7 @@
#include "z_en_bili.h"
#include "assets/objects/object_bl/object_bl.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnBili_Init(Actor* thisx, PlayState* play);
void EnBili_Destroy(Actor* thisx, PlayState* play);
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 445250e8d5..f844b3892a 100644
--- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c
+++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c
@@ -272,7 +272,7 @@ void EnBom_Update(Actor* thisx, PlayState* play2) {
thisx->shape.rot.z = 0;
} else {
// if a lit stick touches the bomb, set timer to 100
- // these bombs never have a timer over 70, so this isnt used
+ // these bombs never have a timer over 70, so this isn't used
if ((this->timer > 100) && Player_IsBurningStickInRange(play, &thisx->world.pos, 30.0f, 50.0f)) {
this->timer = 100;
}
@@ -319,7 +319,7 @@ void EnBom_Update(Actor* thisx, PlayState* play2) {
play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] = 250;
- Camera_AddQuake(&play->mainCamera, 2, 0xB, 8);
+ Camera_RequestQuake(&play->mainCamera, 2, 11, 8);
thisx->params = BOMB_EXPLOSION;
this->timer = 10;
thisx->flags |= ACTOR_FLAG_5;
diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c
index b7ca309528..c72c4f6e99 100644
--- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c
+++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c
@@ -90,7 +90,7 @@ void EnBombf_Init(Actor* thisx, PlayState* play) {
EnBombf* this = (EnBombf*)thisx;
Actor_SetScale(thisx, 0.01f);
- this->unk_200 = 1;
+ this->isFuseEnabled = true;
Collider_InitCylinder(play, &this->bombCollider);
Collider_InitJntSph(play, &this->explosionCollider);
Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit);
@@ -172,7 +172,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) {
bombFlower = (EnBombf*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOMBF, this->actor.world.pos.x,
this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0);
if (bombFlower != NULL) {
- bombFlower->unk_200 = 1;
+ bombFlower->isFuseEnabled = true;
bombFlower->timer = 0;
this->timer = 180;
this->actor.flags &= ~ACTOR_FLAG_0;
@@ -320,7 +320,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
s32 pad[2];
EnBombf* this = (EnBombf*)thisx;
- if ((this->unk_200 != 0) && (this->timer != 0)) {
+ if ((this->isFuseEnabled) && (this->timer != 0)) {
this->timer--;
}
@@ -369,7 +369,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
if ((this->bombCollider.base.acFlags & AC_HIT) || ((this->bombCollider.base.ocFlags1 & OC1_HIT) &&
(this->bombCollider.base.oc->category == ACTORCAT_ENEMY))) {
- this->unk_200 = 1;
+ this->isFuseEnabled = true;
this->timer = 0;
} else {
// if a lit stick touches the bomb, set timer to 100
@@ -378,7 +378,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
}
}
- if (this->unk_200 != 0) {
+ if (this->isFuseEnabled) {
dustAccel.y = 0.2f;
effPos = thisx->world.pos;
effPos.y += 25.0f;
@@ -428,7 +428,7 @@ void EnBombf_Update(Actor* thisx, PlayState* play) {
play->envCtx.adjLight1Color[0] = play->envCtx.adjLight1Color[1] = play->envCtx.adjLight1Color[2] = 250;
play->envCtx.adjAmbientColor[0] = play->envCtx.adjAmbientColor[1] = play->envCtx.adjAmbientColor[2] =
250;
- Camera_AddQuake(&play->mainCamera, 2, 0xB, 8);
+ Camera_RequestQuake(&play->mainCamera, 2, 11, 8);
thisx->params = BOMBFLOWER_EXPLOSION;
this->timer = 10;
thisx->flags |= ACTOR_FLAG_5;
diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h
index 7822098d0a..02d10b7c45 100644
--- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h
+++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.h
@@ -15,7 +15,7 @@ typedef struct EnBombf {
/* 0x01B8 */ ColliderJntSphElement explosionColliderItems[1];
/* 0x01F8 */ s16 timer;
/* 0x01FC */ EnBombfActionFunc actionFunc;
- /* 0x0200 */ s32 unk_200;
+ /* 0x0200 */ s32 isFuseEnabled; // enables the ability to ignite and tick down to explode
/* 0x0204 */ u8 bumpOn;
/* 0x0206 */ s16 flashSpeedScale;
/* 0x0208 */ f32 flashIntensity;
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 ab67053149..44630e6909 100644
--- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c
+++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c
@@ -1,7 +1,7 @@
#include "z_en_crow.h"
#include "assets/objects/object_crow/object_crow.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnCrow_Init(Actor* thisx, PlayState* play);
void EnCrow_Destroy(Actor* thisx, PlayState* play);
diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c
index ddbdd5ed5b..1983c86d07 100644
--- a/src/overlays/actors/ovl_En_Door/z_en_door.c
+++ b/src/overlays/actors/ovl_En_Door/z_en_door.c
@@ -197,7 +197,7 @@ void EnDoor_SetupType(EnDoor* this, PlayState* play) {
}
} else if (doorType == DOOR_CHECKABLE) {
this->actor.textId = ENDOOR_GET_CHECKABLE_TEXT_ID(&this->actor) + 0x0200;
- if (this->actor.textId == 0x0229 && !GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if (this->actor.textId == 0x0229 && !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
// Talon's house door. If Talon has not been woken up at Hyrule Castle
// this door should be openable at any time of day.
// Note that there is no check for time of day, as the night layers for Lon Lon
diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c
index d1c4ee79f5..5a43ab49ec 100644
--- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c
+++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c
@@ -200,7 +200,7 @@ void EnEiyer_SetupAppearFromGround(EnEiyer* this) {
this->collider.base.atFlags &= ~AT_ON;
this->collider.base.acFlags &= ~AC_ON;
- this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_12);
+ this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_IGNORE_QUAKE);
this->actor.shape.shadowScale = 0.0f;
this->actor.shape.yOffset = 0.0f;
this->actionFunc = EnEiyer_AppearFromGround;
@@ -231,7 +231,7 @@ void EnEiyer_SetupAmbush(EnEiyer* this, PlayState* play) {
this->collider.info.bumper.dmgFlags = DMG_DEFAULT;
this->basePos = this->actor.world.pos;
this->actor.world.rot.y = this->actor.shape.rot.y;
- this->actor.flags |= ACTOR_FLAG_12;
+ this->actor.flags |= ACTOR_FLAG_IGNORE_QUAKE;
this->collider.base.acFlags &= ~AC_ON;
this->actor.shape.shadowScale = 65.0f;
this->actor.shape.yOffset = 600.0f;
diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
index 0cb0eb0df0..38e0e84530 100644
--- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
+++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c
@@ -1,5 +1,6 @@
#include "z_en_encount2.h"
#include "overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.h"
+#include "quake.h"
#include "vt.h"
#include "assets/objects/object_efc_star_field/object_efc_star_field.h"
@@ -91,11 +92,11 @@ void EnEncount2_Wait(EnEncount2* this, PlayState* play) {
}
break;
case ENCOUNT2_ACTIVE_DEATH_MOUNTAIN:
- if ((this->deathMountainSpawnerTimer == 1) || (!this->isQuaking)) {
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
+ if ((this->deathMountainSpawnerTimer == 1) || !this->isQuaking) {
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 0x7FFF);
- Quake_SetQuakeValues(quakeIndex, 50, 0, 0, 0);
- Quake_SetCountdown(quakeIndex, 300);
+ Quake_SetPerturbations(quakeIndex, 50, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 300);
this->isQuaking = true;
}
FALLTHROUGH;
diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c
index d9fb15c80f..8d17373f66 100644
--- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c
+++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c
@@ -212,7 +212,7 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, PlayState* play) {
(s16)(Rand_ZeroOne() * 100.0f) + 240, FHGFLASH_LIGHTBALL_GREEN);
}
}
- func_80033E88(&this->actor, play, 4, 10);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 4, 10);
}
break;
diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c
index 232aeb9fc9..e22128e519 100644
--- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c
+++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c
@@ -198,7 +198,7 @@ void EnFireRock_Fall(EnFireRock* this, PlayState* play) {
switch (this->type) {
case FIRE_ROCK_SPAWNED_FALLING1:
case FIRE_ROCK_SPAWNED_FALLING2:
- func_80033E88(&this->actor, play, 5, 2);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 5, 2);
FALLTHROUGH;
case FIRE_ROCK_BROKEN_PIECE1:
Actor_SpawnFloorDustRing(play, &this->actor, &this->actor.world.pos, this->actor.shape.shadowScale, 1,
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 6c93d2052b..d88e8bc63e 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 "assets/objects/object_firefly/object_firefly.h"
#include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnFirefly_Init(Actor* thisx, PlayState* play);
void EnFirefly_Destroy(Actor* thisx, PlayState* play);
diff --git a/src/overlays/actors/ovl_En_Fz/z_en_fz.c b/src/overlays/actors/ovl_En_Fz/z_en_fz.c
index 74907881be..46eed1d212 100644
--- a/src/overlays/actors/ovl_En_Fz/z_en_fz.c
+++ b/src/overlays/actors/ovl_En_Fz/z_en_fz.c
@@ -341,11 +341,11 @@ void EnFz_ApplyDamage(EnFz* this, PlayState* play) {
this->collider1.base.acFlags &= ~AC_HIT;
} else if (this->collider1.base.acFlags & AC_HIT) {
this->collider1.base.acFlags &= ~AC_HIT;
- if (this->actor.colChkInfo.damageEffect != 2) {
- if (this->actor.colChkInfo.damageEffect == 0xF) {
+ switch (this->actor.colChkInfo.damageEffect) {
+ case 0xF:
Actor_ApplyDamage(&this->actor);
Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8);
- if (this->actor.colChkInfo.health) {
+ if (this->actor.colChkInfo.health != 0) {
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DAMAGE);
vec.x = this->actor.world.pos.x;
vec.y = this->actor.world.pos.y;
@@ -361,16 +361,21 @@ void EnFz_ApplyDamage(EnFz* this, PlayState* play) {
EnFz_Damaged(this, play, &vec, 30, 10.0f);
EnFz_SetupDespawn(this, play);
}
- }
- } else {
- Actor_ApplyDamage(&this->actor);
- Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8);
- if (this->actor.colChkInfo.health == 0) {
- Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DEAD);
- EnFz_SetupMelt(this);
- } else {
- Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DAMAGE);
- }
+ break;
+
+ case 2:
+ Actor_ApplyDamage(&this->actor);
+ Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0x2000, 8);
+ if (this->actor.colChkInfo.health == 0) {
+ Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DEAD);
+ EnFz_SetupMelt(this);
+ } else {
+ Audio_PlayActorSfx2(&this->actor, NA_SE_EN_FREEZAD_DAMAGE);
+ }
+ break;
+
+ default:
+ break;
}
}
}
diff --git a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c
index d1243950b1..c617960412 100644
--- a/src/overlays/actors/ovl_En_GirlA/z_en_girla.c
+++ b/src/overlays/actors/ovl_En_GirlA/z_en_girla.c
@@ -316,7 +316,7 @@ void EnGirlA_SetupAction(EnGirlA* this, EnGirlAActionFunc func) {
s32 EnGirlA_TryChangeShopItem(EnGirlA* this) {
switch (this->actor.params) {
case SI_MILK_BOTTLE:
- if (GET_ITEMGETINF(ITEMGETINF_02)) {
+ if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) {
this->actor.params = SI_RECOVERY_HEART;
return true;
}
diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c
index de374fa169..c7736ba151 100644
--- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c
+++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c
@@ -2,6 +2,7 @@
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_oF1d_map/object_oF1d_map.h"
+#include "quake.h"
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_5)
@@ -1628,14 +1629,14 @@ void EnGo2_Destroy(Actor* thisx, PlayState* play) {
void EnGo2_CurledUp(EnGo2* this, PlayState* play) {
u8 index = this->actor.params & 0x1F;
s16 height;
- s32 quake;
+ s32 quakeIndex;
if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) {
if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) {
- quake = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quake, -0x3CB0);
- Quake_SetQuakeValues(quake, 8, 0, 0, 0);
- Quake_SetCountdown(quake, 16);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, -0x3CB0);
+ Quake_SetPerturbations(quakeIndex, 8, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 16);
} else {
EnGo2_GetDustData(this, 1);
}
diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c
index 13eb480d56..e2c7c297b3 100644
--- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c
+++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c
@@ -791,7 +791,7 @@ void EnGoma_Draw(Actor* thisx, PlayState* play) {
this->actor.naviEnemyId = NAVI_ENEMY_GOHMA_LARVA;
Matrix_Translate(this->actor.world.pos.x,
this->actor.world.pos.y +
- ((this->actor.shape.yOffset * this->actor.scale.y) + play->mainCamera.skyboxOffset.y),
+ ((this->actor.shape.yOffset * this->actor.scale.y) + play->mainCamera.quakeOffset.y),
this->actor.world.pos.z, MTXMODE_NEW);
Matrix_RotateX(BINANG_TO_RAD_ALT(this->slopePitch), MTXMODE_APPLY);
Matrix_RotateZ(BINANG_TO_RAD_ALT(this->slopeRoll), MTXMODE_APPLY);
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 0f931ea560..e71402cbe5 100644
--- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c
+++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c
@@ -8,6 +8,7 @@
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_goroiwa/object_goroiwa.h"
+#include "quake.h"
#include "vt.h"
#define FLAGS ACTOR_FLAG_4
@@ -358,7 +359,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, PlayState* play) {
f32 nextPointY;
f32 thisY;
f32 yDistToFloor;
- s32 quakeIdx;
+ s32 quakeIndex;
CollisionPoly* floorPoly;
Vec3f checkPos;
f32 floorY;
@@ -379,10 +380,10 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, PlayState* play) {
if (this->actor.velocity.y < 0.0f && this->actor.world.pos.y <= nextPointY) {
if (this->bounceCount == 0) {
if (this->actor.xzDistToPlayer < 600.0f) {
- quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quakeIdx, -0x3CB0);
- Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
- Quake_SetCountdown(quakeIdx, 7);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, -0x3CB0);
+ Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 7);
}
this->rollRotSpeed = 0.0f;
if (!(this->stateFlags & ENGOROIWA_IN_WATER)) {
diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c
index be46befc8e..22064e62a5 100644
--- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c
+++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c
@@ -451,7 +451,7 @@ void EnHeishi1_Update(Actor* thisx, PlayState* play) {
// sidehops onto the next screen and prevent getting caught.
if (!(player->actor.velocity.y > -3.9f)) {
this->linkDetected = false;
- // this 60 unit height check is so the player doesnt get caught when on the upper path
+ // this 60 unit height check is so the player doesn't get caught when on the upper path
if (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 60.0f) {
func_80078884(NA_SE_SY_FOUND);
// "Discovered!"
diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h
index 631c71551a..b4f6ea5e7b 100644
--- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h
+++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h
@@ -18,7 +18,7 @@ typedef struct EnHeishi2 {
/* 0x0260 */ Vec3s unk_260;
/* 0x0266 */ char unk_266[0x06];
/* 0x026C */ Vec3s unk_26C; // padding inbetween these
- /* 0x0274 */ Vec3f unk_274;
+ /* 0x0274 */ Vec3f unk_274;
/* 0x0280 */ Vec3f subCamEye;
/* 0x028C */ Vec3f subCamAt;
/* 0x0298 */ Vec3f subCamAtInit;
diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c
index 5f703ff8cb..ccfcb39775 100644
--- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c
+++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c
@@ -682,8 +682,9 @@ s32 EnHorse_Spawn(EnHorse* this, PlayState* play) {
player = GET_PLAYER(play);
if (play->sceneId != SCENE_SPOT20 ||
//! Same flag checked twice
- (Flags_GetEventChkInf(EVENTCHKINF_18) &&
- (GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6 || Flags_GetEventChkInf(EVENTCHKINF_18))) ||
+ (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) &&
+ (GET_EVENTINF_HORSES_STATE() != EVENTINF_HORSES_STATE_6 ||
+ Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED))) ||
// always load two spawns inside lon lon
((sHorseSpawns[i].pos.x == 856 && sHorseSpawns[i].pos.y == 0 && sHorseSpawns[i].pos.z == -918) ||
(sHorseSpawns[i].pos.x == -1003 && sHorseSpawns[i].pos.y == 0 && sHorseSpawns[i].pos.z == -755))) {
@@ -794,7 +795,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
this->stateFlags = ENHORSE_FLAG_19 | ENHORSE_CANT_JUMP | ENHORSE_UNRIDEABLE;
} else if (this->actor.params == 6) {
this->stateFlags = ENHORSE_FLAG_19 | ENHORSE_CANT_JUMP;
- if (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0) {
+ if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1) != 0) {
this->stateFlags &= ~ENHORSE_CANT_JUMP;
this->stateFlags |= ENHORSE_FLAG_26;
} else if (GET_EVENTINF(EVENTINF_HORSES_06) && this->type == HORSE_HNI) {
@@ -808,7 +809,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
}
if (play->sceneId == SCENE_SPOT20 && GET_EVENTINF_HORSES_STATE() == EVENTINF_HORSES_STATE_6 &&
- !Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) {
+ !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && !DREG(1)) {
this->stateFlags |= ENHORSE_FLAG_25;
}
@@ -834,7 +835,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
Actor_Kill(&this->actor);
return;
}
- if (Flags_GetEventChkInf(EVENTCHKINF_18)) {
+ if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) {
Actor_Kill(&this->actor);
return;
}
@@ -842,12 +843,12 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
Actor_Kill(&this->actor);
return;
}
- } else if (!Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1) && !IS_DAY) {
+ } else if (!Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && !DREG(1) && !IS_DAY) {
Actor_Kill(&this->actor);
return;
}
} else if (play->sceneId == SCENE_MALON_STABLE) {
- if (IS_DAY || Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1) != 0 || !LINK_IS_ADULT) {
+ if (IS_DAY || Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1) != 0 || !LINK_IS_ADULT) {
Actor_Kill(&this->actor);
return;
}
@@ -882,7 +883,7 @@ void EnHorse_Init(Actor* thisx, PlayState* play2) {
} else if (this->actor.params == 8) {
EnHorse_InitHorsebackArchery(this);
Interface_InitHorsebackArchery(play);
- } else if (play->sceneId == SCENE_SPOT20 && !Flags_GetEventChkInf(EVENTCHKINF_18) && !DREG(1)) {
+ } else if (play->sceneId == SCENE_SPOT20 && !Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) && !DREG(1)) {
EnHorse_InitFleePlayer(this);
} else {
if (play->sceneId == SCENE_SOUKO) {
@@ -3598,7 +3599,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) {
this->cyl1.base.atFlags &= ~AT_ON;
}
- if (gSaveContext.entranceIndex != 343 || gSaveContext.sceneLayer != 9) {
+ if (gSaveContext.entranceIndex != ENTR_SPOT20_0 || gSaveContext.sceneLayer != 9) {
if (this->dustFlags & 1) {
this->dustFlags &= ~1;
func_800287AC(play, &this->frontRightHoof, &dustVel, &dustAcc, EnHorse_RandInt(100) + 200,
diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c
index 933c71617e..2aad608dbb 100644
--- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c
+++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c
@@ -444,7 +444,7 @@ void EnHorseGameCheck_Init(Actor* thisx, PlayState* play) {
s32 pad;
EnHorseGameCheckBase* this = (EnHorseGameCheckBase*)thisx;
- if ((play->sceneId == SCENE_SPOT20) && (Flags_GetEventChkInf(EVENTCHKINF_18) || DREG(1))) {
+ if ((play->sceneId == SCENE_SPOT20) && (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || DREG(1))) {
this->actor.params = HORSEGAME_MALON_RACE;
}
if (sInitFuncs[this->actor.params] != NULL) {
diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c
index fcd84eb335..64101df33b 100644
--- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c
+++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c
@@ -165,7 +165,7 @@ void EnHorseLinkChild_Init(Actor* thisx, PlayState* play) {
if (IS_CUTSCENE_LAYER) {
func_80A69EC0(this);
} else if (play->sceneId == SCENE_SPOT20) {
- if (!Flags_GetEventChkInf(EVENTCHKINF_14)) {
+ if (!Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
Actor_Kill(&this->actor);
return;
}
diff --git a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c
index a61df481d4..f9596531c7 100644
--- a/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c
+++ b/src/overlays/actors/ovl_En_Horse_Normal/z_en_horse_normal.c
@@ -207,7 +207,7 @@ void EnHorseNormal_Init(Actor* thisx, PlayState* play) {
return;
}
if (!LINK_IS_ADULT) {
- if (Flags_GetEventChkInf(EVENTCHKINF_14)) {
+ if (Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
if (this->actor.world.rot.z != 3) {
Actor_Kill(&this->actor);
return;
@@ -216,7 +216,7 @@ void EnHorseNormal_Init(Actor* thisx, PlayState* play) {
Actor_Kill(&this->actor);
return;
}
- } else if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) {
+ } else if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) {
if (this->actor.world.rot.z != 7) {
Actor_Kill(&this->actor);
return;
diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c
index c8161c3a9e..f4c16cae63 100644
--- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c
+++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c
@@ -429,7 +429,9 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) {
switch (this->actor.params & 0x7F) {
case ENHY_TYPE_AOB:
if (play->sceneId == SCENE_KAKARIKO) {
- return (this->unk_330 & EVENTCHKINF_6B_MASK) ? 0x508D : (GET_INFTABLE(INFTABLE_CB) ? 0x508C : 0x508B);
+ return (this->unk_330 & EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK)
+ ? 0x508D
+ : (GET_INFTABLE(INFTABLE_CB) ? 0x508C : 0x508B);
} else if (play->sceneId == SCENE_MARKET_DAY) {
return GET_EVENTINF(EVENTINF_30) ? 0x709B : 0x709C;
} else if (gSaveContext.dogIsLost) {
@@ -457,7 +459,7 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) {
return 0x5085;
} else if (GET_EVENTCHKINF(EVENTCHKINF_80)) {
return GET_INFTABLE(INFTABLE_C3) ? 0x701A : 0x7047;
- } else if (GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ } else if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 0x701A;
} else if (GET_EVENTCHKINF(EVENTCHKINF_10)) {
return 0x701B;
@@ -537,7 +539,9 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) {
if (!LINK_IS_ADULT) {
return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x505F : (GET_INFTABLE(INFTABLE_163) ? 0x505E : 0x505D);
} else {
- return (this->unk_330 & EVENTCHKINF_6B_MASK) ? 0x5062 : (GET_INFTABLE(INFTABLE_164) ? 0x5061 : 0x5060);
+ return (this->unk_330 & EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_MASK)
+ ? 0x5062
+ : (GET_INFTABLE(INFTABLE_164) ? 0x5061 : 0x5060);
}
case ENHY_TYPE_BJI_19:
return 0x7120;
@@ -909,7 +913,7 @@ void EnHy_InitImpl(EnHy* this, PlayState* play) {
}
if (play->sceneId == SCENE_KAKARIKO) {
- this->unk_330 = gSaveContext.eventChkInf[EVENTCHKINF_6B_INDEX];
+ this->unk_330 = gSaveContext.eventChkInf[EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO_INDEX];
}
EnHy_InitSetProperties(this);
diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c
index 31b3acf0ce..bbeb6c4de0 100644
--- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c
+++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c
@@ -427,7 +427,7 @@ void func_80A74EBC(EnIk* this, PlayState* play) {
sp2C.z = this->actor.world.pos.z + Math_CosS(this->actor.shape.rot.y + 0x6A4) * 70.0f;
sp2C.y = this->actor.world.pos.y;
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_IRONNACK_HIT_GND);
- Camera_AddQuake(&play->mainCamera, 2, 0x19, 5);
+ Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150);
CollisionCheck_SpawnShieldParticles(play, &sp2C);
}
diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c
index 33a2e33f1f..64849d8551 100644
--- a/src/overlays/actors/ovl_En_In/z_en_in.c
+++ b/src/overlays/actors/ovl_En_In/z_en_in.c
@@ -110,7 +110,7 @@ static Gfx* sAdultEraDLs[] = {
};
u16 func_80A78FB0(PlayState* play) {
- if (GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
if (GET_INFTABLE(INFTABLE_97)) {
return 0x2046;
} else {
@@ -131,7 +131,7 @@ u16 func_80A79010(PlayState* play) {
if (temp_v0 != 0) {
return temp_v0;
}
- if (GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
if (IS_DAY) {
return 0x205F;
} else {
@@ -364,34 +364,34 @@ s32 func_80A7975C(EnIn* this, PlayState* play) {
s32 func_80A79830(EnIn* this, PlayState* play) {
if (play->sceneId == SCENE_SPOT20 && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 1 &&
- !GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
}
if (play->sceneId == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_DAY && this->actor.shape.rot.z == 3 &&
- GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
}
if (play->sceneId == SCENE_MALON_STABLE && LINK_IS_CHILD && IS_NIGHT) {
- if ((this->actor.shape.rot.z == 2) && !GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if ((this->actor.shape.rot.z == 2) && !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
}
- if ((this->actor.shape.rot.z == 4) && GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if ((this->actor.shape.rot.z == 4) && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
}
}
if (play->sceneId == SCENE_SPOT20 && LINK_IS_ADULT && IS_DAY) {
- if ((this->actor.shape.rot.z == 5) && !GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if ((this->actor.shape.rot.z == 5) && !GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
return 2;
}
- if ((this->actor.shape.rot.z == 7) && GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if ((this->actor.shape.rot.z == 7) && GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
return 4;
}
}
if (play->sceneId == SCENE_SOUKO && LINK_IS_ADULT && IS_NIGHT) {
- if (this->actor.shape.rot.z == 6 && !GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (this->actor.shape.rot.z == 6 && !GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
return 3;
}
- if (this->actor.shape.rot.z == 8 && GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (this->actor.shape.rot.z == 8 && GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
return 3;
}
}
@@ -530,7 +530,7 @@ void func_80A79FB0(EnIn* this, PlayState* play) {
case 3:
EnIn_ChangeAnim(this, ENIN_ANIM_7);
this->actionFunc = func_80A7A4BC;
- if (!GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
this->actor.params = 5;
}
break;
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 6fda0facc8..4c361c8c5b 100644
--- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c
+++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c
@@ -8,7 +8,7 @@
#include "overlays/actors/ovl_En_Insect/z_en_insect.h"
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
#include "assets/objects/gameplay_field_keep/gameplay_field_keep.h"
-
+#include "quake.h"
#include "vt.h"
#define FLAGS ACTOR_FLAG_23
@@ -420,7 +420,7 @@ void EnIshi_Fly(EnIshi* this, PlayState* play) {
s32 pad;
s16 type = this->actor.params & 1;
s32 pad2;
- s32 quakeIdx;
+ s32 quakeIndex;
Vec3f contactPos;
if (this->actor.bgCheckFlags & (BGCHECKFLAG_GROUND | BGCHECKFLAG_WALL)) {
@@ -432,10 +432,10 @@ void EnIshi_Fly(EnIshi* this, PlayState* play) {
sDustSpawnFuncs[type](this, play);
}
if (type == ROCK_LARGE) {
- quakeIdx = Quake_Add(GET_ACTIVE_CAM(play), 3);
- Quake_SetSpeed(quakeIdx, -0x3CB0);
- Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
- Quake_SetCountdown(quakeIdx, 7);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_3);
+ Quake_SetSpeed(quakeIndex, -0x3CB0);
+ Quake_SetPerturbations(quakeIndex, 3, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 7);
Rumble_Request(this->actor.xyzDistToPlayerSq, 255, 20, 150);
}
Actor_Kill(&this->actor);
diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c
index 6248a77dde..dc75f79ff2 100644
--- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c
+++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c
@@ -107,7 +107,7 @@ u16 EnMa1_GetText(PlayState* play, Actor* thisx) {
return 0x2048;
}
}
- if (GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 0x2047;
}
if (GET_EVENTCHKINF(EVENTCHKINF_12)) {
@@ -188,10 +188,10 @@ s32 func_80AA08C4(EnMa1* this, PlayState* play) {
return 0;
}
if (((play->sceneId == SCENE_MARKET_NIGHT) || (play->sceneId == SCENE_MARKET_DAY)) &&
- !GET_EVENTCHKINF(EVENTCHKINF_14) && !GET_INFTABLE(INFTABLE_8B)) {
+ !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) && !GET_INFTABLE(INFTABLE_8B)) {
return 1;
}
- if ((play->sceneId == SCENE_SPOT15) && !GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if ((play->sceneId == SCENE_SPOT15) && !GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
if (GET_INFTABLE(INFTABLE_8B)) {
return 1;
} else {
@@ -199,13 +199,13 @@ s32 func_80AA08C4(EnMa1* this, PlayState* play) {
return 0;
}
}
- if ((play->sceneId == SCENE_SOUKO) && IS_NIGHT && GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if ((play->sceneId == SCENE_SOUKO) && IS_NIGHT && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
}
if (play->sceneId != SCENE_SPOT20) {
return 0;
}
- if ((this->actor.shape.rot.z == 3) && IS_DAY && GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if ((this->actor.shape.rot.z == 3) && IS_DAY && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
return 1;
}
return 0;
@@ -282,7 +282,7 @@ void EnMa1_Init(Actor* thisx, PlayState* play) {
this->actor.targetMode = 6;
this->unk_1E8.unk_00 = 0;
- if (!GET_EVENTCHKINF(EVENTCHKINF_14) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
this->actionFunc = func_80AA0D88;
EnMa1_ChangeAnim(this, ENMA1_ANIM_2);
} else {
@@ -309,9 +309,9 @@ void func_80AA0D88(EnMa1* this, PlayState* play) {
}
}
- if ((play->sceneId == SCENE_SPOT15) && GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if ((play->sceneId == SCENE_SPOT15) && GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
Actor_Kill(&this->actor);
- } else if (!GET_EVENTCHKINF(EVENTCHKINF_14) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
+ } else if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE) || CHECK_QUEST_ITEM(QUEST_SONG_EPONA)) {
if (this->unk_1E8.unk_00 == 2) {
this->actionFunc = func_80AA0EA0;
play->msgCtx.stateTimer = 4;
diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c
index 8c34610a44..8fbcac0f10 100644
--- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c
+++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c
@@ -74,7 +74,7 @@ u16 func_80AA19A0(PlayState* play, Actor* thisx) {
if (faceReaction != 0) {
return faceReaction;
}
- if (GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
return 0x2056;
}
if (IS_NIGHT) {
@@ -141,15 +141,15 @@ u16 func_80AA1B58(EnMa2* this, PlayState* play) {
if (LINK_IS_CHILD) {
return 0;
}
- if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (play->sceneId == SCENE_MALON_STABLE) && IS_DAY &&
+ if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (play->sceneId == SCENE_MALON_STABLE) && IS_DAY &&
(this->actor.shape.rot.z == 5)) {
return 1;
}
- if (!GET_EVENTCHKINF(EVENTCHKINF_18) && (play->sceneId == SCENE_SPOT20) && IS_NIGHT &&
+ if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) && (play->sceneId == SCENE_SPOT20) && IS_NIGHT &&
(this->actor.shape.rot.z == 6)) {
return 2;
}
- if (!GET_EVENTCHKINF(EVENTCHKINF_18) || (play->sceneId != SCENE_SPOT20)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED) || (play->sceneId != SCENE_SPOT20)) {
return 0;
}
if ((this->actor.shape.rot.z == 7) && IS_DAY) {
diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c
index bf3110892e..1d83f2016e 100644
--- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c
+++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c
@@ -201,7 +201,7 @@ s32 func_80AA2EC8(EnMa3* this, PlayState* play) {
if (LINK_IS_CHILD) {
return 2;
}
- if (!GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
return 2;
}
if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c
index 195ed29bd2..c103703efc 100644
--- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c
+++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c
@@ -862,7 +862,7 @@ void EnMb_ClubAttack(EnMb* this, PlayState* play) {
EffectSsBlast_SpawnWhiteShockwave(play, &effSpawnPos, &effWhiteShockwaveDynamics,
&effWhiteShockwaveDynamics);
func_80033480(play, &effSpawnPos, 2.0f, 3, 0x12C, 0xB4, 1);
- Camera_AddQuake(&play->mainCamera, 2, 0x19, 5);
+ Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, play, -1,
NULL);
EnMb_SetupClubWaitAfterAttack(this);
@@ -1044,7 +1044,7 @@ void EnMb_ClubDamaged(EnMb* this, PlayState* play) {
Animation_PlayOnce(&this->skelAnime, &gEnMbClubStandUpAnim);
this->timer3 = 0;
Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150);
- Camera_AddQuake(&play->mainCamera, 2, 25, 5);
+ Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
} else {
EnMb_SetupClubWaitPlayerNear(this);
}
@@ -1105,7 +1105,7 @@ void EnMb_ClubDead(EnMb* this, PlayState* play) {
Rumble_Request(this->actor.xzDistToPlayer, 255, 20, 150);
Actor_SpawnFloorDustRing(play, &this->actor, &effPos, 50.0f, 10, 3.0f, 400, 60, false);
Audio_PlayActorSfx2(&this->actor, NA_SE_EN_RIZA_DOWN);
- Camera_AddQuake(&play->mainCamera, 2, 25, 5);
+ Camera_RequestQuake(&play->mainCamera, 2, 25, 5);
}
}
diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
index 06abff8ec4..9b624f9fe4 100644
--- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c
+++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c
@@ -188,22 +188,22 @@ void EnNiw_Init(Actor* thisx, PlayState* play) {
}
break;
case 1:
- if (GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
Actor_Kill(&this->actor);
}
break;
case 3:
- if (!GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
Actor_Kill(&this->actor);
}
break;
case 5:
- if (GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
Actor_Kill(&this->actor);
}
break;
case 7:
- if (!GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
Actor_Kill(&this->actor);
}
break;
diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c
index 05276ddf1e..0c1e47c7b9 100644
--- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c
+++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c
@@ -342,7 +342,7 @@ void func_80ABA778(EnNiwLady* this, PlayState* play) {
this->unk_27A = 2;
if (!GET_ITEMGETINF(ITEMGETINF_2E)) {
this->unk_27A = 3;
- if (GET_EVENTCHKINF(EVENTCHKINF_6A)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) {
this->unk_27A = 9;
if (this->unk_277 != 0) {
this->unk_27A = 10;
@@ -365,7 +365,7 @@ void func_80ABA878(EnNiwLady* this, PlayState* play) {
}
if (Actor_ProcessTalkRequest(&this->actor, play)) {
playerExchangeItemId = func_8002F368(play);
- if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_6A)) {
+ if ((playerExchangeItemId == EXCH_ITEM_POCKET_CUCCO) && GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) {
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
player->actor.textId = sTradeItemTextIds[5];
this->unk_26E = this->unk_27A + 21;
diff --git a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c
index 4dae5a2910..3f650fb36b 100644
--- a/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c
+++ b/src/overlays/actors/ovl_En_Po_Desert/z_en_po_desert.c
@@ -7,7 +7,7 @@
#include "z_en_po_desert.h"
#include "assets/objects/object_po_field/object_po_field.h"
-#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_7 | ACTOR_FLAG_12)
+#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_7 | ACTOR_FLAG_IGNORE_QUAKE)
void EnPoDesert_Init(Actor* thisx, PlayState* play);
void EnPoDesert_Destroy(Actor* thisx, PlayState* play);
diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c
index cd803523d4..b1fc21258c 100644
--- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c
+++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c
@@ -8,7 +8,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_po_field/object_po_field.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_12)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_IGNORE_QUAKE)
void EnPoField_Init(Actor* thisx, PlayState* play);
void EnPoField_Destroy(Actor* thisx, PlayState* play);
diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c
index 737399be6b..d51900d708 100644
--- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c
+++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c
@@ -8,7 +8,7 @@
#include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h"
#include "assets/objects/object_tk/object_tk.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_12 | ACTOR_FLAG_16)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_16)
void EnPoRelay_Init(Actor* thisx, PlayState* play);
void EnPoRelay_Destroy(Actor* thisx, PlayState* play);
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 1ea543a43d..99d7f0ed36 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
@@ -8,7 +8,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_po_sisters/object_po_sisters.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_12 | ACTOR_FLAG_14)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_14)
void EnPoSisters_Init(Actor* thisx, PlayState* play);
void EnPoSisters_Destroy(Actor* thisx, PlayState* play);
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 93e7a7857e..d3ed737cc8 100644
--- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c
+++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c
@@ -8,7 +8,7 @@
#include "assets/objects/object_poh/object_poh.h"
#include "assets/objects/object_po_composer/object_po_composer.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE)
void EnPoh_Init(Actor* thisx, PlayState* play);
void EnPoh_Destroy(Actor* thisx, PlayState* play);
diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c
index 1476a9e032..e9f5f2f520 100644
--- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c
+++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c
@@ -579,8 +579,8 @@ s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play) {
if (!((this->unk_2D3 == 0) || (D_80B01EA0 != 0) || !(this->collider.base.acFlags & AC_HIT))) {
this->collider.base.acFlags &= ~AC_HIT;
- if (this->actor.colChkInfo.damageEffect != 0) {
- if (this->actor.colChkInfo.damageEffect == 0xF) {
+ switch (this->actor.colChkInfo.damageEffect) {
+ case 0xF:
effectPos.x = this->collider.info.bumper.hitPos.x;
effectPos.y = this->collider.info.bumper.hitPos.y;
effectPos.z = this->collider.info.bumper.hitPos.z;
@@ -612,11 +612,14 @@ s32 EnSkj_CollisionCheck(EnSkj* this, PlayState* play) {
}
EnSkj_SetupDie(this);
return 1;
- }
- } else {
- this->backflipFlag = 1;
- EnSkj_Backflip(this);
- return 1;
+
+ case 0:
+ this->backflipFlag = 1;
+ EnSkj_Backflip(this);
+ return 1;
+
+ default:
+ break;
}
}
return 0;
diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c
index b6b9e2c054..26c1d6e98c 100644
--- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c
+++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c
@@ -10,26 +10,54 @@
#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3)
+#define TALON_STATE_FLAG_TRACKING_PLAYER (1 << 0)
+#define TALON_STATE_FLAG_GIVING_MILK_REFILL (1 << 1)
+#define TALON_STATE_FLAG_SUPPRESS_BLINK (1 << 2)
+// This has no effect, see EnTa_OverrideLimbDraw for details
+#define TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM (1 << 3)
+#define TALON_STATE_FLAG_ANIMATION_FINISHED (1 << 4)
+#define TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED (1 << 5)
+#define TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE (1 << 7)
+#define TALON_STATE_FLAG_RAISING_HANDS (1 << 8)
+#define TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY (1 << 9)
+
+#define TALON_FACE_REACTION_SET 24
+
+typedef enum {
+ /* 0 */ TALON_EYE_INDEX_OPEN,
+ /* 1 */ TALON_EYE_INDEX_HALF,
+ /* 2 */ TALON_EYE_INDEX_CLOSED,
+ /* 3 */ TALON_EYE_INDEX_MAX
+} TalonEyeIndex;
+
+typedef enum {
+ /* 0 */ TALON_CANBUYMILK_NOT_ENOUGH_RUPEES,
+ /* 1 */ TALON_CANBUYMILK_NO_EMPTY_BOTTLE,
+ /* 2 */ TALON_CANBUYMILK_SUCCESS
+} TalonCanBuyMilkResult;
+
void EnTa_Init(Actor* thisx, PlayState* play2);
void EnTa_Destroy(Actor* thisx, PlayState* play);
void EnTa_Update(Actor* thisx, PlayState* play);
void EnTa_Draw(Actor* thisx, PlayState* play);
-void func_80B14634(EnTa* this, PlayState* play);
-void func_80B146F8(EnTa* this, PlayState* play);
-void func_80B14754(EnTa* this, PlayState* play);
-void func_80B14C18(EnTa* this, PlayState* play);
-void func_80B14CAC(EnTa* this, PlayState* play);
-void func_80B14D98(EnTa* this, PlayState* play);
-void func_80B154FC(EnTa* this, PlayState* play);
-void func_80B16504(EnTa* this, PlayState* play);
-void func_80B16608(EnTa* this, PlayState* play);
-void func_80B166CC(EnTa* this);
-void func_80B16700(EnTa* this);
-void func_80B167C0(EnTa* this);
-void func_80B167FC(EnTa* this);
-void func_80B16854(EnTa* this);
-void func_80B16938(EnTa* this);
+void EnTa_IdleAsleepInCastle(EnTa* this, PlayState* play);
+void EnTa_IdleAsleepInLonLonHouse(EnTa* this, PlayState* play);
+void EnTa_IdleAsleepInKakariko(EnTa* this, PlayState* play);
+void EnTa_IdleAwakeInCastle(EnTa* this, PlayState* play);
+void EnTa_IdleAwakeInKakariko(EnTa* this, PlayState* play);
+void EnTa_IdleAtRanch(EnTa* this, PlayState* play);
+void EnTa_RunCuccoGame(EnTa* this, PlayState* play);
+void EnTa_IdleSittingInLonLonHouse(EnTa* this, PlayState* play);
+void EnTa_IdleAfterCuccoGameFinished(EnTa* this, PlayState* play);
+
+void EnTa_BlinkWaitUntilNext(EnTa* this);
+void EnTa_BlinkAdvanceState(EnTa* this);
+
+void EnTa_AnimRepeatCurrent(EnTa* this);
+void EnTa_AnimSleeping(EnTa* this);
+void EnTa_AnimSitSleeping(EnTa* this);
+void EnTa_AnimRunToEnd(EnTa* this);
const ActorInit En_Ta_InitVars = {
ACTOR_EN_TA,
@@ -63,33 +91,41 @@ static ColliderCylinderInit sCylinderInit = {
{ 30, 40, 0, { 0, 0, 0 } },
};
-void func_80B13AA0(EnTa* this, EnTaActionFunc arg1, EnTaUnkFunc arg2) {
- this->actionFunc = arg1;
- this->unk_260 = arg2;
+void EnTa_SetupAction(EnTa* this, EnTaActionFunc actionFunc, EnTaAnimFunc animFunc) {
+ this->actionFunc = actionFunc;
+ this->animFunc = animFunc;
}
-void func_80B13AAC(EnTa* this, PlayState* play) {
- u16 faceReaction = Text_GetFaceReaction(play, 24);
+void EnTa_SetTextForTalkInLonLonHouse(EnTa* this, PlayState* play) {
+ u16 faceReaction = Text_GetFaceReaction(play, TALON_FACE_REACTION_SET);
- if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
- if (GET_EVENTINF(EVENTINF_HORSES_08)) {
- if (GET_ITEMGETINF(ITEMGETINF_02)) {
+ // Check if cucco game was just finished
+ if (GET_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED)) {
+ // Check if the game was won
+ if (GET_EVENTINF(EVENTINF_CUCCO_GAME_WON)) {
+ if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) {
+ // Game won already before
this->actor.textId = 0x2088;
} else {
+ // First time winning
this->actor.textId = 0x2086;
}
} else {
+ // Try again
this->actor.textId = 0x2085;
}
- CLEAR_EVENTINF(EVENTINF_HORSES_08);
+ CLEAR_EVENTINF(EVENTINF_CUCCO_GAME_WON);
} else if (faceReaction == 0) {
- if (GET_INFTABLE(INFTABLE_7E)) {
- if (GET_ITEMGETINF(ITEMGETINF_02)) {
+ if (GET_INFTABLE(INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE)) {
+ if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) {
+ // Play cucco game or buy milk
this->actor.textId = 0x208B;
} else {
+ // Play cucco game?
this->actor.textId = 0x207F;
}
} else {
+ // First time talking to Talon in Lon Lon house
this->actor.textId = 0x207E;
}
} else {
@@ -102,16 +138,17 @@ void EnTa_Init(Actor* thisx, PlayState* play2) {
PlayState* play = play2;
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 36.0f);
- SkelAnime_InitFlex(play, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable, 17);
+ SkelAnime_InitFlex(play, &this->skelAnime, &gTalonSkel, &gTalonStandAnim, this->jointTable, this->morphTable,
+ ENTA_LIMB_MAX);
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
- this->unk_2E0 = 0;
- this->unk_2CE = 0;
- this->unk_2E2 = 0;
+ this->stateFlags = 0;
+ this->rapidBlinks = 0;
+ this->nodOffTimer = 0;
this->blinkTimer = 20;
- this->unk_2B0 = func_80B166CC;
+ this->blinkFunc = EnTa_BlinkWaitUntilNext;
Actor_SetScale(&this->actor, 0.01f);
this->actor.targetMode = 6;
this->actor.velocity.y = -4.0f;
@@ -119,28 +156,31 @@ void EnTa_Init(Actor* thisx, PlayState* play2) {
this->actor.gravity = -1.0f;
switch (this->actor.params) {
- case 1:
+ case ENTA_IN_KAKARIKO:
+ // "Exile Talon"
osSyncPrintf(VT_FGCOL(CYAN) " 追放タロン \n" VT_RST);
- if (GET_EVENTCHKINF(EVENTCHKINF_6B)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO)) {
Actor_Kill(&this->actor);
} else if (!LINK_IS_ADULT) {
Actor_Kill(&this->actor);
- } else if (GET_EVENTCHKINF(EVENTCHKINF_6A)) {
- func_80B13AA0(this, func_80B14CAC, func_80B167C0);
- this->eyeIndex = 0;
+ } else if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) {
+ EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent);
+ this->eyeIndex = TALON_EYE_INDEX_OPEN;
Animation_PlayOnce(&this->skelAnime, &gTalonStandAnim);
this->currentAnimation = &gTalonStandAnim;
} else {
- func_80B13AA0(this, func_80B14754, func_80B167FC);
- this->eyeIndex = 2;
+ EnTa_SetupAction(this, EnTa_IdleAsleepInKakariko, EnTa_AnimSleeping);
+ this->eyeIndex = TALON_EYE_INDEX_CLOSED;
Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim);
this->currentAnimation = &gTalonSleepAnim;
this->actor.shape.shadowScale = 54.0f;
}
break;
- case 2:
+
+ case ENTA_RETURNED_FROM_KAKARIKO:
+ // "Return Talon"
osSyncPrintf(VT_FGCOL(CYAN) " 出戻りタロン \n" VT_RST);
- if (!GET_EVENTCHKINF(EVENTCHKINF_6B)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO)) {
Actor_Kill(&this->actor);
} else if (!LINK_IS_ADULT) {
Actor_Kill(&this->actor);
@@ -148,39 +188,41 @@ void EnTa_Init(Actor* thisx, PlayState* play2) {
Actor_Kill(&this->actor);
osSyncPrintf(VT_FGCOL(CYAN) " 夜はいない \n" VT_RST);
} else {
- func_80B13AA0(this, func_80B14D98, func_80B167C0);
- this->eyeIndex = 0;
+ EnTa_SetupAction(this, EnTa_IdleAtRanch, EnTa_AnimRepeatCurrent);
+ this->eyeIndex = TALON_EYE_INDEX_OPEN;
Animation_PlayOnce(&this->skelAnime, &gTalonStandAnim);
this->currentAnimation = &gTalonStandAnim;
}
break;
- default:
+
+ default: // Child era Talon
+ // "Other Talon"
osSyncPrintf(VT_FGCOL(CYAN) " その他のタロン \n" VT_RST);
if (play->sceneId == SCENE_SPOT15) {
- if (GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
Actor_Kill(&this->actor);
- } else if (GET_EVENTCHKINF(EVENTCHKINF_13)) {
- func_80B13AA0(this, func_80B14C18, func_80B167C0);
- this->eyeIndex = 0;
+ } else if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_CASTLE)) {
+ EnTa_SetupAction(this, EnTa_IdleAwakeInCastle, EnTa_AnimRepeatCurrent);
+ this->eyeIndex = TALON_EYE_INDEX_OPEN;
Animation_PlayOnce(&this->skelAnime, &gTalonStandAnim);
this->currentAnimation = &gTalonStandAnim;
} else {
- func_80B13AA0(this, func_80B14634, func_80B167FC);
- this->eyeIndex = 2;
+ EnTa_SetupAction(this, EnTa_IdleAsleepInCastle, EnTa_AnimSleeping);
+ this->eyeIndex = TALON_EYE_INDEX_CLOSED;
Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim);
this->currentAnimation = &gTalonSleepAnim;
this->actor.shape.shadowScale = 54.0f;
}
} else if (play->sceneId == SCENE_SOUKO) {
osSyncPrintf(VT_FGCOL(CYAN) " ロンロン牧場の倉庫 の タロン\n" VT_RST);
- if (!GET_EVENTCHKINF(EVENTCHKINF_14)) {
+ if (!GET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE)) {
Actor_Kill(&this->actor);
} else if (LINK_IS_ADULT) {
Actor_Kill(&this->actor);
} else {
if (IS_DAY) {
this->actor.flags |= ACTOR_FLAG_4;
- this->unk_2C4[0] = this->unk_2C4[1] = this->unk_2C4[2] = 7;
+ this->superCuccoTimers[0] = this->superCuccoTimers[1] = this->superCuccoTimers[2] = 7;
this->superCuccos[0] = (EnNiw*)Actor_Spawn(
&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 5.0f,
this->actor.world.pos.y + 3.0f, this->actor.world.pos.z + 26.0f, 0, 0, 0, 0xD);
@@ -190,31 +232,31 @@ void EnTa_Init(Actor* thisx, PlayState* play2) {
this->superCuccos[2] = (EnNiw*)Actor_Spawn(
&play->actorCtx, play, ACTOR_EN_NIW, this->actor.world.pos.x + 20.0f,
this->actor.world.pos.y + 40.0f, this->actor.world.pos.z - 30.0f, 0, 0, 0, 0xD);
- func_80B13AAC(this, play);
+ EnTa_SetTextForTalkInLonLonHouse(this, play);
- if (GET_EVENTINF(EVENTINF_HORSES_0A)) {
- func_80B13AA0(this, func_80B16608, func_80B16938);
+ if (GET_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED)) {
+ EnTa_SetupAction(this, EnTa_IdleAfterCuccoGameFinished, EnTa_AnimRunToEnd);
Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 0.0f);
- CLEAR_EVENTINF(EVENTINF_HORSES_0A);
+ CLEAR_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED);
} else {
- func_80B13AA0(this, func_80B16504, func_80B16854);
- this->eyeIndex = 0;
+ EnTa_SetupAction(this, EnTa_IdleSittingInLonLonHouse, EnTa_AnimSitSleeping);
+ this->eyeIndex = TALON_EYE_INDEX_OPEN;
Animation_PlayOnce(&this->skelAnime, &gTalonSitSleepingAnim);
this->currentAnimation = &gTalonSitSleepingAnim;
}
} else {
- func_80B13AA0(this, func_80B146F8, func_80B167FC);
- this->eyeIndex = 2;
+ EnTa_SetupAction(this, EnTa_IdleAsleepInLonLonHouse, EnTa_AnimSleeping);
+ this->eyeIndex = TALON_EYE_INDEX_CLOSED;
Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim);
this->currentAnimation = &gTalonSleepAnim;
this->actor.shape.shadowScale = 54.0f;
}
}
} else {
- func_80B13AA0(this, func_80B14634, func_80B167FC);
- this->eyeIndex = 2;
+ EnTa_SetupAction(this, EnTa_IdleAsleepInCastle, EnTa_AnimSleeping);
+ this->eyeIndex = TALON_EYE_INDEX_CLOSED;
Animation_PlayOnce(&this->skelAnime, &gTalonSleepAnim);
this->currentAnimation = &gTalonSleepAnim;
this->actor.shape.shadowScale = 54.0f;
@@ -223,7 +265,7 @@ void EnTa_Init(Actor* thisx, PlayState* play2) {
}
}
-void func_80B14248(EnTa* this) {
+void EnTa_DecreaseShadowSize(EnTa* this) {
if (this->actor.shape.shadowScale > 36.0f) {
this->actor.shape.shadowScale -= 0.8f;
}
@@ -234,16 +276,17 @@ void EnTa_Destroy(Actor* thisx, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
- if (this->actor.params != 1 && this->actor.params != 2 && play->sceneId == SCENE_SOUKO) {
+ if (this->actor.params != ENTA_IN_KAKARIKO && this->actor.params != ENTA_RETURNED_FROM_KAKARIKO &&
+ play->sceneId == SCENE_SOUKO) {
gSaveContext.timer1State = 0;
}
- if (this->unk_2E0 & 0x200) {
+ if (this->stateFlags & TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY) {
func_800F5B58();
}
}
-s32 func_80B142F4(EnTa* this, PlayState* play, u16 textId) {
+s32 EnTa_RequestTalk(EnTa* this, PlayState* play, u16 textId) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
return true;
}
@@ -252,77 +295,78 @@ s32 func_80B142F4(EnTa* this, PlayState* play, u16 textId) {
if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) &&
(this->actor.xzDistToPlayer < 100.0f)) {
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
func_8002F2CC(&this->actor, play, 100.0f);
}
return false;
}
-void func_80B14398(EnTa* this, PlayState* play) {
+void EnTa_SleepTalkInKakariko(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B13AA0(this, func_80B14754, func_80B167FC);
+ EnTa_SetupAction(this, EnTa_IdleAsleepInKakariko, EnTa_AnimSleeping);
}
}
-void func_80B143D4(EnTa* this, PlayState* play) {
+void EnTa_SleepTalkInLonLonHouse(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B13AA0(this, func_80B146F8, func_80B167FC);
+ EnTa_SetupAction(this, EnTa_IdleAsleepInLonLonHouse, EnTa_AnimSleeping);
}
}
-void func_80B14410(EnTa* this) {
+void EnTa_SetupAwake(EnTa* this) {
if (!LINK_IS_ADULT) {
- func_80B13AA0(this, func_80B14C18, func_80B167C0);
- SET_EVENTCHKINF(EVENTCHKINF_13);
+ EnTa_SetupAction(this, EnTa_IdleAwakeInCastle, EnTa_AnimRepeatCurrent);
+ SET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_CASTLE);
} else {
- func_80B13AA0(this, func_80B14CAC, func_80B167C0);
- SET_EVENTCHKINF(EVENTCHKINF_6A);
+ EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent);
+ SET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO);
}
}
-void func_80B1448C(EnTa* this, PlayState* play) {
+void EnTa_TalkWakingUp2(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B14410(this);
+ EnTa_SetupAwake(this);
}
- func_80B14248(this);
- this->unk_2E0 |= 0x4;
+ EnTa_DecreaseShadowSize(this);
+ this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK;
}
-void func_80B144D8(EnTa* this, PlayState* play) {
+void EnTa_TalkWakingUp1(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B14410(this);
+ EnTa_SetupAwake(this);
this->blinkTimer = 1;
- this->unk_2B0 = func_80B16700;
+ this->blinkFunc = EnTa_BlinkAdvanceState;
}
if (Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) {
- this->eyeIndex = 1;
- func_80B13AA0(this, func_80B1448C, func_80B167C0);
+ // Half-open eyes once the textbox reaches its end
+ this->eyeIndex = TALON_EYE_INDEX_HALF;
+ EnTa_SetupAction(this, EnTa_TalkWakingUp2, EnTa_AnimRepeatCurrent);
}
- func_80B14248(this);
- this->unk_2E0 |= 4;
+ EnTa_DecreaseShadowSize(this);
+ this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK;
}
-void func_80B14570(EnTa* this, PlayState* play) {
- this->unk_2E0 |= 4;
+void EnTa_WakeUp(EnTa* this, PlayState* play) {
+ this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK;
- if (this->unk_2CC == 0) {
- func_80B13AA0(this, func_80B144D8, func_80B167C0);
- this->unk_2CE = 3;
- this->unk_2CC = 60;
+ if (this->timer == 0) {
+ EnTa_SetupAction(this, EnTa_TalkWakingUp1, EnTa_AnimRepeatCurrent);
+ this->rapidBlinks = 3;
+ this->timer = 60;
Animation_PlayOnce(&this->skelAnime, &gTalonWakeUpAnim);
this->currentAnimation = &gTalonStandAnim;
Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SURPRISE);
}
}
-void func_80B145F8(EnTa* this, PlayState* play) {
+void EnTa_SleepTalkInCastle(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B13AA0(this, func_80B14634, func_80B167FC);
+ EnTa_SetupAction(this, EnTa_IdleAsleepInCastle, EnTa_AnimSleeping);
}
}
-void func_80B14634(EnTa* this, PlayState* play) {
+void EnTa_IdleAsleepInCastle(EnTa* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (Actor_ProcessTalkRequest(&this->actor, play)) {
@@ -331,14 +375,15 @@ void func_80B14634(EnTa* this, PlayState* play) {
switch (exchangeItemId) {
case EXCH_ITEM_CHICKEN:
player->actor.textId = 0x702B;
- func_80B13AA0(this, func_80B14570, func_80B167C0);
- this->unk_2CC = 40;
+ EnTa_SetupAction(this, EnTa_WakeUp, EnTa_AnimRepeatCurrent);
+ this->timer = 40;
break;
+
default:
if (exchangeItemId != EXCH_ITEM_NONE) {
player->actor.textId = 0x702A;
}
- func_80B13AA0(this, func_80B145F8, func_80B167FC);
+ EnTa_SetupAction(this, EnTa_SleepTalkInCastle, EnTa_AnimSleeping);
break;
}
} else {
@@ -347,15 +392,16 @@ void func_80B14634(EnTa* this, PlayState* play) {
}
}
-void func_80B146F8(EnTa* this, PlayState* play) {
+void EnTa_IdleAsleepInLonLonHouse(EnTa* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
- func_80B13AA0(this, func_80B143D4, func_80B167FC);
+ EnTa_SetupAction(this, EnTa_SleepTalkInLonLonHouse, EnTa_AnimSleeping);
}
+
this->actor.textId = 0x204B;
func_8002F2CC(&this->actor, play, 100.0f);
}
-void func_80B14754(EnTa* this, PlayState* play) {
+void EnTa_IdleAsleepInKakariko(EnTa* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if (Actor_ProcessTalkRequest(&this->actor, play)) {
@@ -364,14 +410,15 @@ void func_80B14754(EnTa* this, PlayState* play) {
switch (exchangeItemId) {
case EXCH_ITEM_POCKET_CUCCO:
player->actor.textId = 0x702B;
- func_80B13AA0(this, func_80B14570, func_80B167C0);
- this->unk_2CC = 40;
+ EnTa_SetupAction(this, EnTa_WakeUp, EnTa_AnimRepeatCurrent);
+ this->timer = 40;
break;
+
default:
if (exchangeItemId != EXCH_ITEM_NONE) {
player->actor.textId = 0x5015;
}
- func_80B13AA0(this, func_80B14398, func_80B167FC);
+ EnTa_SetupAction(this, EnTa_SleepTalkInKakariko, EnTa_AnimSleeping);
break;
}
} else {
@@ -380,7 +427,7 @@ void func_80B14754(EnTa* this, PlayState* play) {
}
}
-void func_80B14818(EnTa* this, PlayState* play) {
+void EnTa_RunWithAccelerationAndSfx(EnTa* this, PlayState* play) {
s32 framesMod12 = (s32)play->state.frames % 12;
if (framesMod12 == 0 || framesMod12 == 6) {
@@ -392,132 +439,137 @@ void func_80B14818(EnTa* this, PlayState* play) {
Actor_MoveForward(&this->actor);
}
-void func_80B14898(EnTa* this, PlayState* play) {
+void EnTa_RunAwayRunOutOfGate(EnTa* this, PlayState* play) {
+ // Spawn dust particles
func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1);
- func_80B14818(this, play);
+ EnTa_RunWithAccelerationAndSfx(this, play);
- if (this->unk_2CC == 0) {
+ if (this->timer == 0) {
Actor_Kill(&this->actor);
}
}
-void func_80B1490C(EnTa* this, PlayState* play) {
+void EnTa_RunAwayTurnTowardsGate(EnTa* this, PlayState* play) {
this->actor.world.rot.y += 0xC00;
this->actor.shape.rot.y += 0xC00;
- if (this->unk_2CC == 0) {
- func_80B13AA0(this, func_80B14898, func_80B167C0);
- this->unk_2CC = 60;
+ if (this->timer == 0) {
+ EnTa_SetupAction(this, EnTa_RunAwayRunOutOfGate, EnTa_AnimRepeatCurrent);
+ this->timer = 60;
}
}
-void func_80B1496C(EnTa* this, PlayState* play) {
+void EnTa_RunAwayRunWest(EnTa* this, PlayState* play) {
+ // Spawn dust particles
func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1);
- func_80B14818(this, play);
+ EnTa_RunWithAccelerationAndSfx(this, play);
- if (this->unk_2CC == 0) {
- func_80B13AA0(this, func_80B1490C, func_80B167C0);
- this->unk_2CC = 5;
+ if (this->timer == 0) {
+ EnTa_SetupAction(this, EnTa_RunAwayTurnTowardsGate, EnTa_AnimRepeatCurrent);
+ this->timer = 5;
}
}
-void func_80B149F4(EnTa* this, PlayState* play) {
+void EnTa_RunAwayTurnWest(EnTa* this, PlayState* play) {
this->actor.world.rot.y -= 0xD00;
this->actor.shape.rot.y -= 0xD00;
- if (this->unk_2CC == 0) {
- func_80B13AA0(this, func_80B1496C, func_80B167C0);
- this->unk_2CC = 65;
+ if (this->timer == 0) {
+ EnTa_SetupAction(this, EnTa_RunAwayRunWest, EnTa_AnimRepeatCurrent);
+ this->timer = 65;
}
}
-void func_80B14A54(EnTa* this, PlayState* play) {
+void EnTa_RunAwayRunSouth(EnTa* this, PlayState* play) {
+ // Spawn dust particles
func_80033480(play, &this->actor.world.pos, 50.0f, 2, 250, 20, 1);
- func_80B14818(this, play);
- if (this->unk_2CC == 20) {
+ EnTa_RunWithAccelerationAndSfx(this, play);
+
+ if (this->timer == 20) {
Message_CloseTextbox(play);
}
- if (this->unk_2CC == 0) {
- this->unk_2CC = 5;
- func_80B13AA0(this, func_80B149F4, func_80B167C0);
+ if (this->timer == 0) {
+ this->timer = 5;
+ EnTa_SetupAction(this, EnTa_RunAwayTurnWest, EnTa_AnimRepeatCurrent);
}
}
-void func_80B14AF4(EnTa* this, PlayState* play) {
+void EnTa_RunAwayStart(EnTa* this, PlayState* play) {
this->actor.world.rot.y -= 0xC00;
this->actor.shape.rot.y -= 0xC00;
- if (this->unk_2CC == 0) {
+ if (this->timer == 0) {
Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_CRY_1);
- func_80B13AA0(this, func_80B14A54, func_80B167C0);
- this->unk_2CC = 65;
+ EnTa_SetupAction(this, EnTa_RunAwayRunSouth, EnTa_AnimRepeatCurrent);
+ this->timer = 65;
this->actor.flags |= ACTOR_FLAG_4;
}
}
-void func_80B14B6C(EnTa* this, PlayState* play) {
+void EnTa_TalkAwakeInCastle(EnTa* this, PlayState* play) {
if (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) {
+ // Start the running away cutscene
OnePointCutscene_Init(play, 4175, -99, &this->actor, CAM_ID_MAIN);
- func_80B13AA0(this, func_80B14AF4, func_80B167C0);
- this->unk_2CC = 5;
- SET_EVENTCHKINF(EVENTCHKINF_14);
+ EnTa_SetupAction(this, EnTa_RunAwayStart, EnTa_AnimRepeatCurrent);
+ this->timer = 5;
+ SET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE);
Animation_PlayOnce(&this->skelAnime, &gTalonRunTransitionAnim);
this->currentAnimation = &gTalonRunAnim;
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B14C18(EnTa* this, PlayState* play) {
- if (func_80B142F4(this, play, 0x702C)) {
- func_80B13AA0(this, func_80B14B6C, func_80B167C0);
+void EnTa_IdleAwakeInCastle(EnTa* this, PlayState* play) {
+ if (EnTa_RequestTalk(this, play, 0x702C)) {
+ EnTa_SetupAction(this, EnTa_TalkAwakeInCastle, EnTa_AnimRepeatCurrent);
}
- func_80B14248(this);
+ EnTa_DecreaseShadowSize(this);
}
-void func_80B14C60(EnTa* this, PlayState* play) {
+void EnTa_TalkAwakeInKakariko(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B13AA0(this, func_80B14CAC, func_80B167C0);
+ EnTa_SetupAction(this, EnTa_IdleAwakeInKakariko, EnTa_AnimRepeatCurrent);
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B14CAC(EnTa* this, PlayState* play) {
- if (GET_EVENTCHKINF(EVENTCHKINF_18)) {
- if (func_80B142F4(this, play, 0x5017)) {
- func_80B13AA0(this, func_80B14C60, func_80B167C0);
- SET_EVENTCHKINF(EVENTCHKINF_6B);
+void EnTa_IdleAwakeInKakariko(EnTa* this, PlayState* play) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
+ if (EnTa_RequestTalk(this, play, 0x5017)) {
+ EnTa_SetupAction(this, EnTa_TalkAwakeInKakariko, EnTa_AnimRepeatCurrent);
+ SET_EVENTCHKINF(EVENTCHKINF_TALON_RETURNED_FROM_KAKARIKO);
}
- } else if (func_80B142F4(this, play, 0x5016)) {
- func_80B13AA0(this, func_80B14C60, func_80B167C0);
+ } else if (EnTa_RequestTalk(this, play, 0x5016)) {
+ EnTa_SetupAction(this, EnTa_TalkAwakeInKakariko, EnTa_AnimRepeatCurrent);
}
- func_80B14248(this);
+ EnTa_DecreaseShadowSize(this);
}
-void func_80B14D4C(EnTa* this, PlayState* play) {
+void EnTa_TalkAtRanch(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B13AA0(this, func_80B14D98, func_80B167C0);
+ EnTa_SetupAction(this, EnTa_IdleAtRanch, EnTa_AnimRepeatCurrent);
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B14D98(EnTa* this, PlayState* play) {
- if (func_80B142F4(this, play, 0x2055)) {
- func_80B13AA0(this, func_80B14D4C, func_80B167C0);
+void EnTa_IdleAtRanch(EnTa* this, PlayState* play) {
+ if (EnTa_RequestTalk(this, play, 0x2055)) {
+ EnTa_SetupAction(this, EnTa_TalkAtRanch, EnTa_AnimRepeatCurrent);
}
}
-s32 func_80B14DD8(void) {
+s32 EnTa_CheckCanBuyMilk(void) {
if (gSaveContext.rupees < 30) {
- return 0;
+ return TALON_CANBUYMILK_NOT_ENOUGH_RUPEES;
} else if (!Inventory_HasEmptyBottle()) {
- return 1;
+ return TALON_CANBUYMILK_NO_EMPTY_BOTTLE;
} else {
- return 2;
+ return TALON_CANBUYMILK_SUCCESS;
}
}
-void func_80B14E28(EnTa* this, PlayState* play) {
+void EnTa_CreateFloorCamera(EnTa* this, PlayState* play) {
Vec3f subCamEye;
Vec3f subCamAt;
@@ -537,89 +589,92 @@ void func_80B14E28(EnTa* this, PlayState* play) {
Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye);
}
-void func_80B14EDC(EnTa* this, PlayState* play) {
+void EnTa_RemoveFloorCamera(EnTa* this, PlayState* play) {
Play_ChangeCameraStatus(play, this->returnToCamId, CAM_STAT_ACTIVE);
Play_ClearCamera(play, this->subCamId);
}
-void func_80B14F20(EnTa* this, EnTaActionFunc arg1) {
- func_80B13AA0(this, arg1, func_80B16854);
- this->eyeIndex = 2;
+void EnTa_SetupActionWithSleepAnimation(EnTa* this, EnTaActionFunc actionFunc) {
+ EnTa_SetupAction(this, actionFunc, EnTa_AnimSitSleeping);
+ this->eyeIndex = TALON_EYE_INDEX_CLOSED;
Animation_Change(&this->skelAnime, &gTalonSitSleepingAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gTalonSitSleepingAnim), ANIMMODE_ONCE, -5.0f);
- this->unk_2E2 = 0;
+ this->nodOffTimer = 0;
this->currentAnimation = &gTalonSitSleepingAnim;
}
-void func_80B14FAC(EnTa* this, EnTaActionFunc arg1) {
- this->eyeIndex = 1;
- func_80B13AA0(this, arg1, func_80B16938);
- this->unk_2E0 &= ~0x10;
+void EnTa_SetupActionWithWakeUpAnimation(EnTa* this, EnTaActionFunc actionFunc) {
+ this->eyeIndex = TALON_EYE_INDEX_HALF;
+ EnTa_SetupAction(this, actionFunc, EnTa_AnimRunToEnd);
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gTalonSitWakeUpAnim),
ANIMMODE_ONCE, -5.0f);
}
-void func_80B15034(EnTa* this, PlayState* play) {
+void EnTa_TalkNotEnoughRupees(EnTa* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
- func_80B14F20(this, func_80B16504);
- func_80B13AAC(this, play);
+ EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse);
+ EnTa_SetTextForTalkInLonLonHouse(this, play);
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-s32 func_80B150AC(EnTa* this, PlayState* play, s32 idx) {
+s32 EnTa_IsPlayerHoldingSuperCucco(EnTa* this, PlayState* play, s32 cuccoIdx) {
Player* player = GET_PLAYER(play);
Actor* interactRangeActor;
if (player->stateFlags1 & PLAYER_STATE1_11) {
interactRangeActor = player->interactRangeActor;
if (interactRangeActor != NULL && interactRangeActor->id == ACTOR_EN_NIW &&
- interactRangeActor == &this->superCuccos[idx]->actor) {
+ interactRangeActor == &this->superCuccos[cuccoIdx]->actor) {
return true;
}
}
return false;
}
-void func_80B15100(EnTa* this, PlayState* play) {
+void EnTa_TalkFoundSuperCucco(EnTa* this, PlayState* play) {
Player* player = GET_PLAYER(play);
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
- s32 unk_2CA;
+ s32 lastFoundSuperCuccoIdx;
Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f);
- this->unk_2E0 &= ~0x10;
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
Message_CloseTextbox(play);
- unk_2CA = this->unk_2CA;
- this->actionFunc = func_80B154FC;
- this->superCuccos[unk_2CA]->actor.gravity = 0.1f;
- this->superCuccos[unk_2CA]->actor.velocity.y = 0.0f;
- this->superCuccos[unk_2CA]->actor.speedXZ = 0.0f;
- this->superCuccos[unk_2CA]->actor.parent = NULL;
+ lastFoundSuperCuccoIdx = this->lastFoundSuperCuccoIdx;
+ this->actionFunc = EnTa_RunCuccoGame;
- if (player->interactRangeActor == &this->superCuccos[unk_2CA]->actor) {
+ // Make the found cucco fly directly upwards and then forget about it
+ this->superCuccos[lastFoundSuperCuccoIdx]->actor.gravity = 0.1f;
+ this->superCuccos[lastFoundSuperCuccoIdx]->actor.velocity.y = 0.0f;
+ this->superCuccos[lastFoundSuperCuccoIdx]->actor.speedXZ = 0.0f;
+ this->superCuccos[lastFoundSuperCuccoIdx]->actor.parent = NULL;
+
+ if (player->interactRangeActor == &this->superCuccos[lastFoundSuperCuccoIdx]->actor) {
player->interactRangeActor = NULL;
}
- if (player->heldActor == &this->superCuccos[unk_2CA]->actor) {
+ if (player->heldActor == &this->superCuccos[lastFoundSuperCuccoIdx]->actor) {
player->heldActor = NULL;
}
player->stateFlags1 &= ~PLAYER_STATE1_11;
- this->superCuccos[unk_2CA] = NULL;
+ this->superCuccos[lastFoundSuperCuccoIdx] = NULL;
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B15260(EnTa* this, PlayState* play) {
+void EnTa_IdleFoundSuperCucco(EnTa* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
- this->actionFunc = func_80B15100;
+ this->actionFunc = EnTa_TalkFoundSuperCucco;
+ // Unset auto-talking
this->actor.flags &= ~ACTOR_FLAG_16;
} else {
func_8002F2CC(&this->actor, play, 1000.0f);
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
s32 EnTa_GetSuperCuccosCount(EnTa* this, PlayState* play) {
@@ -634,37 +689,37 @@ s32 EnTa_GetSuperCuccosCount(EnTa* this, PlayState* play) {
return count;
}
-void func_80B15308(EnTa* this) {
- if (this->unk_2E0 & 0x10) {
- if (this->unk_2E0 & 0x100) {
+void EnTa_AnimateHandsUpDown(EnTa* this) {
+ if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) {
+ if (this->stateFlags & TALON_STATE_FLAG_RAISING_HANDS) {
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 17.0f, 22.0f, ANIMMODE_ONCE, 0.0f);
- this->unk_2E0 &= ~0x100;
+ this->stateFlags &= ~TALON_STATE_FLAG_RAISING_HANDS;
} else {
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, -1.0f, 21.0f, 16.0f, ANIMMODE_ONCE, 3.0f);
- this->unk_2E0 |= 0x100;
+ this->stateFlags |= TALON_STATE_FLAG_RAISING_HANDS;
}
- this->unk_2E0 &= ~0x10;
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
}
}
-void func_80B153D4(EnTa* this, PlayState* play) {
- func_80B15308(this);
+void EnTa_TransitionToPostCuccoGame(EnTa* this, PlayState* play) {
+ EnTa_AnimateHandsUpDown(this);
- if (this->unk_2CC == 0) {
- if (this->unk_2E0 & 0x80) {
- this->unk_2E0 &= ~0x80;
- func_80B14EDC(this, play);
+ if (this->timer == 0) {
+ if (this->stateFlags & TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE) {
+ this->stateFlags &= ~TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE;
+ EnTa_RemoveFloorCamera(this, play);
}
}
}
-void func_80B15424(EnTa* this, PlayState* play) {
- func_80B15308(this);
+void EnTa_TalkCuccoGameEnd(EnTa* this, PlayState* play) {
+ EnTa_AnimateHandsUpDown(this);
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
play->nextEntranceIndex = ENTR_SOUKO_2;
- if (GET_EVENTINF(EVENTINF_HORSES_08)) {
+ if (GET_EVENTINF(EVENTINF_CUCCO_GAME_WON)) {
play->transitionType = TRANS_TYPE_CIRCLE(TCA_STARBURST, TCC_WHITE, TCS_FAST);
gSaveContext.nextTransitionType = TRANS_TYPE_FADE_WHITE;
} else {
@@ -673,13 +728,13 @@ void func_80B15424(EnTa* this, PlayState* play) {
}
play->transitionTrigger = TRANS_TRIGGER_START;
- SET_EVENTINF(EVENTINF_HORSES_0A);
- this->actionFunc = func_80B153D4;
- this->unk_2CC = 22;
+ SET_EVENTINF(EVENTINF_CUCCO_GAME_FINISHED);
+ this->actionFunc = EnTa_TransitionToPostCuccoGame;
+ this->timer = 22;
}
}
-void func_80B154FC(EnTa* this, PlayState* play) {
+void EnTa_RunCuccoGame(EnTa* this, PlayState* play) {
s32 i;
for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) {
@@ -688,46 +743,55 @@ void func_80B154FC(EnTa* this, PlayState* play) {
this->superCuccos[i]->actor.gravity -= 0.03f;
}
- if (func_80B150AC(this, play, i)) {
- if (this->unk_2C4[i] > 0) {
- this->unk_2C4[i]--;
+ if (EnTa_IsPlayerHoldingSuperCucco(this, play, i)) {
+ if (this->superCuccoTimers[i] > 0) {
+ // Wait until the cucco's timer runs out after
+ // acknowledging that the player picked it up.
+ this->superCuccoTimers[i]--;
} else {
- this->unk_2CA = i;
+ this->lastFoundSuperCuccoIdx = i;
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f);
- this->unk_2E0 &= ~0x10;
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
switch (EnTa_GetSuperCuccosCount(this, play)) {
case 1:
+ // Last cucco found, end the game
gSaveContext.timer1State = 0;
func_8002DF54(play, &this->actor, 1);
Message_StartTextbox(play, 0x2084, &this->actor);
- this->actionFunc = func_80B15424;
+ this->actionFunc = EnTa_TalkCuccoGameEnd;
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE,
-10.0f);
- this->unk_2E0 &= ~0x10;
- this->unk_2E0 &= ~0x100;
- SET_EVENTINF(EVENTINF_HORSES_08);
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
+ this->stateFlags &= ~TALON_STATE_FLAG_RAISING_HANDS;
+ SET_EVENTINF(EVENTINF_CUCCO_GAME_WON);
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
- this->unk_2E0 &= ~0x200;
+ this->stateFlags &= ~TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY;
Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET);
return;
+
case 2:
+ // One cucco remaining
this->actor.textId = 0x2083;
Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_CRY_1);
break;
+
case 3:
+ // Two cuccos remaining
this->actor.textId = 0x2082;
Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SURPRISE);
break;
}
- this->actionFunc = func_80B15260;
+ this->actionFunc = EnTa_IdleFoundSuperCucco;
+
+ // Automatically talk to player
this->actor.flags |= ACTOR_FLAG_16;
func_8002F2CC(&this->actor, play, 1000.0f);
return;
}
} else {
- this->unk_2C4[i] = 7;
+ this->superCuccoTimers[i] = 7;
}
}
}
@@ -738,47 +802,57 @@ void func_80B154FC(EnTa* this, PlayState* play) {
if (gSaveContext.timer1Value == 0 && !Play_InCsMode(play)) {
SEQCMD_STOP_SEQUENCE(SEQ_PLAYER_BGM_MAIN, 0);
- this->unk_2E0 &= ~0x200;
+ this->stateFlags &= ~TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY;
func_80078884(NA_SE_SY_FOUND);
gSaveContext.timer1State = 0;
func_8002DF54(play, &this->actor, 1);
+
+ // Time's up text
Message_StartTextbox(play, 0x2081, &this->actor);
- this->actionFunc = func_80B15424;
- func_80B14E28(this, play);
- CLEAR_EVENTINF(EVENTINF_HORSES_08);
- this->unk_2E0 |= 0x80;
+ this->actionFunc = EnTa_TalkCuccoGameEnd;
+ EnTa_CreateFloorCamera(this, play);
+ CLEAR_EVENTINF(EVENTINF_CUCCO_GAME_WON);
+ this->stateFlags |= TALON_STATE_FLAG_FLOOR_CAMERA_ACTIVE;
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f);
- this->unk_2E0 &= ~0x10;
- this->unk_2E0 &= ~0x100;
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
+ this->stateFlags &= ~TALON_STATE_FLAG_RAISING_HANDS;
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B1585C(EnTa* this, PlayState* play) {
+void EnTa_ThrowSuperCuccos(EnTa* this, PlayState* play) {
s32 i;
- if (this->unk_2CC > 35) {
+ if (this->timer > 35) {
+ // During the first part of the throw animation,
+ // just turn them (on the table or the floor)
for (i = 1; i < ARRAY_COUNT(this->superCuccos); i++) {
if (this->superCuccos[i] != NULL) {
Math_SmoothStepToS(&this->superCuccos[i]->actor.world.rot.y, i * -10000 - 3000, 2, 0x800, 0x100);
this->superCuccos[i]->actor.shape.rot.y = this->superCuccos[i]->actor.world.rot.y;
}
}
- } else if (this->unk_2CC == 35) {
+ } else if (this->timer == 35) {
+ // At this point, prepare each super cucco for flight
for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) {
- this->unk_2C4[i] = (s32)(Rand_CenteredFloat(6.0f) + 10.0f);
+ // Set a 7-12 frame zero-gravity time for each super cucco
+ this->superCuccoTimers[i] = (s32)(Rand_CenteredFloat(6.0f) + 10.0f);
if (this->superCuccos[i] != NULL) {
EnNiw* niw = this->superCuccos[i];
+ // Mark the cucco as a super cucco, this will cause the cucco
+ // to set random xz and y velocities
niw->unk_308 = 1;
niw->actor.gravity = 0.0f;
}
}
} else {
for (i = 0; i < ARRAY_COUNT(this->superCuccos); i++) {
- if (this->unk_2CC < 35 - this->unk_2C4[i]) {
+ // If the zero-gravity time of the cucco is over,
+ // add gravity to it
+ if (this->timer < 35 - this->superCuccoTimers[i]) {
if (this->superCuccos[i] != NULL) {
if (this->superCuccos[i]->actor.gravity > -2.0f) {
this->superCuccos[i]->actor.gravity -= 0.03f;
@@ -788,9 +862,9 @@ void func_80B1585C(EnTa* this, PlayState* play) {
}
}
- if (this->unk_2CC == 0) {
- func_80B13AA0(this, func_80B154FC, func_80B16938);
- this->unk_2E0 &= ~0x10;
+ if (this->timer == 0) {
+ EnTa_SetupAction(this, EnTa_RunCuccoGame, EnTa_AnimRunToEnd);
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
Animation_Change(&this->skelAnime, &gTalonSitWakeUpAnim, 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim) - 1.0f,
Animation_GetLastFrame(&gTalonSitWakeUpAnim), ANIMMODE_ONCE, 10.0f);
@@ -798,138 +872,145 @@ void func_80B1585C(EnTa* this, PlayState* play) {
}
}
-void func_80B15AD4(EnTa* this, PlayState* play) {
- if (this->unk_2CC == 0 && this->unk_2E0 & 0x20) {
- func_80B13AA0(this, func_80B1585C, func_80B16938);
- this->unk_2E0 &= ~0x10;
+void EnTa_StartingCuccoGame3(EnTa* this, PlayState* play) {
+ if (this->timer == 0 && this->stateFlags & TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED) {
+ EnTa_SetupAction(this, EnTa_ThrowSuperCuccos, EnTa_AnimRunToEnd);
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
+ // Play hand raise animation again so that it looks like Talon throws the cuccos
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 1.0f,
Animation_GetLastFrame(&gTalonSitHandsUpAnim), ANIMMODE_ONCE, 0.0f);
- this->unk_2CC = 50;
- func_80088B34(0x1E);
+ this->timer = 50;
+
+ func_80088B34(30);
func_800F5ACC(NA_BGM_TIMED_MINI_GAME);
- this->unk_2E0 |= 0x200;
+ this->stateFlags |= TALON_STATE_FLAG_RESTORE_BGM_ON_DESTROY;
Message_CloseTextbox(play);
func_8002DF54(play, &this->actor, 1);
}
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
- this->unk_2E0 |= 0x20;
+ this->stateFlags |= TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED;
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B15BF8(EnTa* this, PlayState* play) {
- if (this->unk_2E0 & 0x10) {
- func_80B13AA0(this, func_80B15AD4, func_80B16938);
- this->unk_2E0 &= ~0x10;
+void EnTa_StartingCuccoGame2(EnTa* this, PlayState* play) {
+ if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) {
+ EnTa_SetupAction(this, EnTa_StartingCuccoGame3, EnTa_AnimRunToEnd);
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 0.0f, 1.0f, ANIMMODE_ONCE, 0.0f);
- this->unk_2CC = 5;
+ this->timer = 5;
}
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
- this->unk_2E0 |= 0x20;
+ this->stateFlags |= TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED;
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B15CC8(EnTa* this, PlayState* play) {
- if (this->unk_2E0 & 0x10) {
- func_80B13AA0(this, func_80B15BF8, func_80B16938);
- this->unk_2E0 &= ~0x10;
+void EnTa_StartingCuccoGame1(EnTa* this, PlayState* play) {
+ if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) {
+ EnTa_SetupAction(this, EnTa_StartingCuccoGame2, EnTa_AnimRunToEnd);
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, -1.0f, 29.0f, 0.0f, ANIMMODE_ONCE, 10.0f);
}
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
- this->unk_2E0 |= 0x20;
+ this->stateFlags |= TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED;
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B15D90(EnTa* this, PlayState* play) {
- func_80B13AA0(this, func_80B15CC8, func_80B16938);
- this->unk_2E0 &= ~0x10;
+void EnTa_StartCuccoGame(EnTa* this, PlayState* play) {
+ EnTa_SetupAction(this, EnTa_StartingCuccoGame1, EnTa_AnimRunToEnd);
+ this->stateFlags &= ~TALON_STATE_FLAG_ANIMATION_FINISHED;
Animation_Change(&this->skelAnime, &gTalonSitHandsUpAnim, 1.0f, 8.0f, 29.0f, ANIMMODE_ONCE, -10.0f);
Message_ContinueTextbox(play, 0x2080);
- this->unk_2E0 &= ~0x20;
+ this->stateFlags &= ~TALON_STATE_FLAG_CUCCO_GAME_START_EVENT_TRIGGERED;
}
-void func_80B15E28(EnTa* this, PlayState* play) {
+void EnTa_TalkGeneralInLonLonHouse(EnTa* this, PlayState* play) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
- func_80B14F20(this, func_80B16504);
- func_80B13AAC(this, play);
+ EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse);
+ EnTa_SetTextForTalkInLonLonHouse(this, play);
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B15E80(EnTa* this, PlayState* play) {
+void EnTa_GiveItemInLonLonHouse(EnTa* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
- this->actionFunc = func_80B15E28;
- if (!(this->unk_2E0 & 0x2)) {
- SET_ITEMGETINF(ITEMGETINF_02);
+ this->actionFunc = EnTa_TalkGeneralInLonLonHouse;
+ if (!(this->stateFlags & TALON_STATE_FLAG_GIVING_MILK_REFILL)) {
+ SET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE);
}
- this->unk_2E0 &= ~0x2;
- } else if (this->unk_2E0 & 2) {
+ this->stateFlags &= ~TALON_STATE_FLAG_GIVING_MILK_REFILL;
+ } else if (this->stateFlags & TALON_STATE_FLAG_GIVING_MILK_REFILL) {
func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f);
} else {
func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f);
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B15F54(EnTa* this, PlayState* play) {
+void EnTa_TalkAfterCuccoGameFirstWon(EnTa* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
- this->unk_2E0 &= ~0x2;
- func_80B13AA0(this, func_80B15E80, func_80B16938);
+ this->stateFlags &= ~TALON_STATE_FLAG_GIVING_MILK_REFILL;
+ EnTa_SetupAction(this, EnTa_GiveItemInLonLonHouse, EnTa_AnimRunToEnd);
func_8002F434(&this->actor, play, GI_MILK_BOTTLE, 10000.0f, 50.0f);
}
}
-void func_80B15FE8(EnTa* this, PlayState* play) {
+void EnTa_WaitBuyMilkOrPlayCuccoGameResponse(EnTa* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
switch (play->msgCtx.choiceIndex) {
- case 0:
- switch (func_80B14DD8()) {
- case 0:
+ case 0: // Buy milk
+ switch (EnTa_CheckCanBuyMilk()) {
+ case TALON_CANBUYMILK_NOT_ENOUGH_RUPEES:
Message_ContinueTextbox(play, 0x85);
- func_80B13AA0(this, func_80B15034, func_80B16938);
+ EnTa_SetupAction(this, EnTa_TalkNotEnoughRupees, EnTa_AnimRunToEnd);
break;
- case 1:
+
+ case TALON_CANBUYMILK_NO_EMPTY_BOTTLE:
Message_ContinueTextbox(play, 0x208A);
- func_80B13AA0(this, func_80B15E28, func_80B16938);
+ EnTa_SetupAction(this, EnTa_TalkGeneralInLonLonHouse, EnTa_AnimRunToEnd);
break;
- case 2:
- this->unk_2E0 |= 2;
- func_80B13AA0(this, func_80B15E80, func_80B16938);
+
+ case TALON_CANBUYMILK_SUCCESS:
+ this->stateFlags |= TALON_STATE_FLAG_GIVING_MILK_REFILL;
+ EnTa_SetupAction(this, EnTa_GiveItemInLonLonHouse, EnTa_AnimRunToEnd);
Rupees_ChangeBy(-30);
func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f);
break;
}
break;
- case 1:
+
+ case 1: // Play cucco game
if (gSaveContext.rupees < 10) {
Message_ContinueTextbox(play, 0x85);
- func_80B13AA0(this, func_80B15034, func_80B16938);
+ EnTa_SetupAction(this, EnTa_TalkNotEnoughRupees, EnTa_AnimRunToEnd);
} else {
Rupees_ChangeBy(-10);
- func_80B15D90(this, play);
+ EnTa_StartCuccoGame(this, play);
}
break;
- case 2:
- func_80B14F20(this, func_80B16504);
- func_80B13AAC(this, play);
+
+ case 2: // Cancel
+ EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse);
+ EnTa_SetTextForTalkInLonLonHouse(this, play);
break;
}
}
- if (this->unk_2E0 & 0x10) {
- this->unk_2E0 |= 1;
+ if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) {
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
}
-void func_80B161C0(EnTa* this, PlayState* play) {
+void EnTa_WaitForPlayCuccoGameResponse(EnTa* this, PlayState* play) {
s32 price;
+ // Check if this is a retry
if (this->actor.textId == 0x2085) {
price = 5;
} else {
@@ -941,107 +1022,114 @@ void func_80B161C0(EnTa* this, PlayState* play) {
case 0:
if (gSaveContext.rupees < price) {
Message_ContinueTextbox(play, 0x85);
- func_80B13AA0(this, func_80B15034, func_80B16938);
+ EnTa_SetupAction(this, EnTa_TalkNotEnoughRupees, EnTa_AnimRunToEnd);
} else {
Rupees_ChangeBy(-price);
- func_80B15D90(this, play);
+ EnTa_StartCuccoGame(this, play);
}
break;
+
case 1:
- func_80B14F20(this, func_80B16504);
- func_80B13AAC(this, play);
+ EnTa_SetupActionWithSleepAnimation(this, EnTa_IdleSittingInLonLonHouse);
+ EnTa_SetTextForTalkInLonLonHouse(this, play);
break;
}
}
- if (this->unk_2E0 & 0x10) {
- this->unk_2E0 |= 1;
+ if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) {
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
}
-void func_80B162E8(EnTa* this, PlayState* play) {
+void EnTa_WaitForMarryMalonResponse(EnTa* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(play)) {
Message_ContinueTextbox(play, 0x2087);
- func_80B13AA0(this, func_80B15F54, func_80B16938);
+ EnTa_SetupAction(this, EnTa_TalkAfterCuccoGameFirstWon, EnTa_AnimRunToEnd);
}
- if (this->unk_2E0 & 0x10) {
- this->unk_2E0 |= 1;
+ if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) {
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
}
-void func_80B16364(EnTa* this, PlayState* play) {
+void EnTa_ContinueTalkInLonLonHouse(EnTa* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
- SET_INFTABLE(INFTABLE_7E);
- if (GET_ITEMGETINF(ITEMGETINF_02)) {
+ SET_INFTABLE(INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE);
+ if (GET_ITEMGETINF(ITEMGETINF_TALON_BOTTLE)) {
+ // Play cucco game or buy milk
Message_ContinueTextbox(play, 0x208B);
- func_80B13AA0(this, func_80B15FE8, func_80B16938);
+ EnTa_SetupAction(this, EnTa_WaitBuyMilkOrPlayCuccoGameResponse, EnTa_AnimRunToEnd);
} else {
+ // Play cucco game?
Message_ContinueTextbox(play, 0x207F);
- func_80B13AA0(this, func_80B161C0, func_80B16938);
+ EnTa_SetupAction(this, EnTa_WaitForPlayCuccoGameResponse, EnTa_AnimRunToEnd);
}
}
- if (this->unk_2E0 & 0x10) {
- this->unk_2E0 |= 1;
+ if (this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED) {
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
}
-void func_80B1642C(EnTa* this, PlayState* play) {
+void EnTa_TalkAfterCuccoGameWon(EnTa* this, PlayState* play) {
if ((Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play)) {
if (Inventory_HasEmptyBottle()) {
Message_CloseTextbox(play);
- this->unk_2E0 |= 2;
- func_80B13AA0(this, func_80B15E80, func_80B16938);
+ this->stateFlags |= TALON_STATE_FLAG_GIVING_MILK_REFILL;
+ EnTa_SetupAction(this, EnTa_GiveItemInLonLonHouse, EnTa_AnimRunToEnd);
func_8002F434(&this->actor, play, GI_MILK, 10000.0f, 50.0f);
} else {
Message_ContinueTextbox(play, 0x208A);
- func_80B13AA0(this, func_80B15E28, func_80B16938);
+ EnTa_SetupAction(this, EnTa_TalkGeneralInLonLonHouse, EnTa_AnimRunToEnd);
}
}
}
-void func_80B16504(EnTa* this, PlayState* play) {
- u16 faceReaction = Text_GetFaceReaction(play, 0x18);
+void EnTa_IdleSittingInLonLonHouse(EnTa* this, PlayState* play) {
+ u16 faceReaction = Text_GetFaceReaction(play, TALON_FACE_REACTION_SET);
- func_80B13AAC(this, play);
+ EnTa_SetTextForTalkInLonLonHouse(this, play);
- if (func_80B142F4(this, play, this->actor.textId)) {
+ if (EnTa_RequestTalk(this, play, this->actor.textId)) {
Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SURPRISE);
if (faceReaction != 0) {
- func_80B14FAC(this, func_80B15E28);
+ EnTa_SetupActionWithWakeUpAnimation(this, EnTa_TalkGeneralInLonLonHouse);
} else {
- SET_INFTABLE(INFTABLE_7E);
+ SET_INFTABLE(INFTABLE_TALKED_TO_TALON_IN_RANCH_HOUSE);
switch (this->actor.textId) {
- case 0x207E:
- case 0x207F:
- func_80B14FAC(this, func_80B161C0);
+ case 0x207E: // First time talking in Lon Lon House
+ case 0x207F: // Play cucco game
+ EnTa_SetupActionWithWakeUpAnimation(this, EnTa_WaitForPlayCuccoGameResponse);
break;
- case 0x208B:
- func_80B14FAC(this, func_80B15FE8);
+
+ case 0x208B: // Play cucco game or buy milk
+ EnTa_SetupActionWithWakeUpAnimation(this, EnTa_WaitBuyMilkOrPlayCuccoGameResponse);
break;
+
default:
- func_80B14FAC(this, func_80B16364);
+ EnTa_SetupActionWithWakeUpAnimation(this, EnTa_ContinueTalkInLonLonHouse);
break;
}
}
}
- this->unk_2E0 &= ~1;
+ this->stateFlags &= ~TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B16608(EnTa* this, PlayState* play) {
+void EnTa_IdleAfterCuccoGameFinished(EnTa* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
switch (this->actor.textId) {
- case 0x2085:
- this->actionFunc = func_80B161C0;
+ case 0x2085: // Retry?
+ this->actionFunc = EnTa_WaitForPlayCuccoGameResponse;
break;
- case 0x2086:
- this->actionFunc = func_80B162E8;
+
+ case 0x2086: // Initial win
+ this->actionFunc = EnTa_WaitForMarryMalonResponse;
break;
- case 0x2088:
- this->actionFunc = func_80B1642C;
+
+ case 0x2088: // Later win
+ this->actionFunc = EnTa_TalkAfterCuccoGameWon;
break;
}
this->actor.flags &= ~ACTOR_FLAG_16;
@@ -1049,38 +1137,41 @@ void func_80B16608(EnTa* this, PlayState* play) {
this->actor.flags |= ACTOR_FLAG_16;
func_8002F2CC(&this->actor, play, 1000.0f);
}
- this->unk_2E0 |= 1;
+ this->stateFlags |= TALON_STATE_FLAG_TRACKING_PLAYER;
}
-void func_80B166CC(EnTa* this) {
- s16 temp_v0 = this->blinkTimer - 1;
-
- if (temp_v0 != 0) {
- this->blinkTimer = temp_v0;
- } else {
- this->unk_2B0 = func_80B16700;
- }
-}
-
-void func_80B16700(EnTa* this) {
+void EnTa_BlinkWaitUntilNext(EnTa* this) {
s16 blinkTimer = this->blinkTimer - 1;
if (blinkTimer != 0) {
this->blinkTimer = blinkTimer;
} else {
- s16 nextEyeIndex = this->eyeIndex + 1;
- s16 blinkTimer = 3;
+ this->blinkFunc = EnTa_BlinkAdvanceState;
+ }
+}
- if (nextEyeIndex >= blinkTimer) {
- this->eyeIndex = 0;
- if (this->unk_2CE > 0) {
- this->unk_2CE--;
+void EnTa_BlinkAdvanceState(EnTa* this) {
+ s16 blinkTimer = this->blinkTimer - 1;
+
+ if (blinkTimer != 0) {
+ this->blinkTimer = blinkTimer;
+ } else {
+ // Next towards closed eyes: open -> half, half -> closed
+ s16 nextEyeIndex = this->eyeIndex + 1;
+
+ // If the eyes were already closed, set the eyes open and set a new blink timer.
+ // If just woken up (rapidBlinks > 0), blink a few times
+ // in quick succession before starting the normal blink cycle.
+ if (nextEyeIndex >= TALON_EYE_INDEX_MAX) {
+ this->eyeIndex = TALON_EYE_INDEX_OPEN;
+ if (this->rapidBlinks > 0) {
+ this->rapidBlinks--;
blinkTimer = 1;
} else {
blinkTimer = (s32)(Rand_ZeroOne() * 60.0f) + 20;
}
this->blinkTimer = blinkTimer;
- this->unk_2B0 = func_80B166CC;
+ this->blinkFunc = EnTa_BlinkWaitUntilNext;
} else {
this->eyeIndex = nextEyeIndex;
this->blinkTimer = 1;
@@ -1088,45 +1179,50 @@ void func_80B16700(EnTa* this) {
}
}
-void func_80B167C0(EnTa* this) {
+void EnTa_AnimRepeatCurrent(EnTa* this) {
if (SkelAnime_Update(&this->skelAnime)) {
Animation_PlayOnce(&this->skelAnime, this->currentAnimation);
}
}
-void func_80B167FC(EnTa* this) {
+void EnTa_AnimSleeping(EnTa* this) {
if (SkelAnime_Update(&this->skelAnime)) {
Animation_PlayOnce(&this->skelAnime, this->currentAnimation);
Audio_PlayActorSfx2(&this->actor, NA_SE_VO_TA_SLEEP);
}
- this->unk_2E0 |= 0xC;
+ this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM | TALON_STATE_FLAG_SUPPRESS_BLINK;
}
-void func_80B16854(EnTa* this) {
- if (this->unk_2E2 > 0) {
- this->unk_2E2--;
+void EnTa_AnimSitSleeping(EnTa* this) {
+ if (this->nodOffTimer > 0) {
+ // Pause the sleep animation until the nodding timer is at zero.
+ // The torso and arms will still do the rocking movement because of EnTa_OverrideLimbDraw
+ this->nodOffTimer--;
} else {
if (SkelAnime_Update(&this->skelAnime)) {
Animation_PlayOnce(&this->skelAnime, this->currentAnimation);
- this->unk_2E2 = Rand_ZeroFloat(100.0f) + 100.0f;
+ this->nodOffTimer = Rand_ZeroFloat(100.0f) + 100.0f;
}
if (this->skelAnime.curFrame < 96.0f && this->skelAnime.curFrame >= 53.0f) {
- this->eyeIndex = 1;
+ // Half-open eyes during the part of the sleeping animation where Talon
+ // raises his head after nodding off
+ this->eyeIndex = TALON_EYE_INDEX_HALF;
} else {
- this->eyeIndex = 2;
+ // Otherwise keep the eyes closed
+ this->eyeIndex = TALON_EYE_INDEX_CLOSED;
}
- this->unk_2E0 |= 8;
+ this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM;
}
- this->unk_2E0 |= 4;
+ this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_BLINK;
}
-void func_80B16938(EnTa* this) {
- if (!(this->unk_2E0 & 0x10)) {
+void EnTa_AnimRunToEnd(EnTa* this) {
+ if (!(this->stateFlags & TALON_STATE_FLAG_ANIMATION_FINISHED)) {
if (SkelAnime_Update(&this->skelAnime)) {
- this->unk_2E0 |= 0x10;
+ this->stateFlags |= TALON_STATE_FLAG_ANIMATION_FINISHED;
}
- this->unk_2E0 |= 8;
+ this->stateFlags |= TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM;
}
}
@@ -1138,46 +1234,56 @@ void EnTa_Update(Actor* thisx, PlayState* play) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
Actor_MoveForward(&this->actor);
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
- this->unk_260(this);
+ this->animFunc(this);
this->actionFunc(this, play);
- if (!(this->unk_2E0 & 4)) {
- this->unk_2B0(this);
+ if (!(this->stateFlags & TALON_STATE_FLAG_SUPPRESS_BLINK)) {
+ this->blinkFunc(this);
}
- if (this->unk_2E0 & 1) {
- Actor_TrackPlayer(play, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos);
+ if (this->stateFlags & TALON_STATE_FLAG_TRACKING_PLAYER) {
+ Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos);
} else {
- Math_SmoothStepToS(&this->unk_2D4.x, 0, 6, 6200, 100);
- Math_SmoothStepToS(&this->unk_2D4.y, 0, 6, 6200, 100);
- Math_SmoothStepToS(&this->unk_2DA.x, 0, 6, 6200, 100);
- Math_SmoothStepToS(&this->unk_2DA.y, 0, 6, 6200, 100);
+ Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100);
+ Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100);
+ Math_SmoothStepToS(&this->torsoRot.x, 0, 6, 6200, 100);
+ Math_SmoothStepToS(&this->torsoRot.y, 0, 6, 6200, 100);
}
- this->unk_2E0 &= ~0x5;
+ this->stateFlags &= ~(TALON_STATE_FLAG_TRACKING_PLAYER | TALON_STATE_FLAG_SUPPRESS_BLINK);
- if (this->unk_2CC > 0) {
- this->unk_2CC--;
+ if (this->timer > 0) {
+ this->timer--;
}
}
s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {
EnTa* this = (EnTa*)thisx;
+ // Turn head and chest towards the target (the rotation steps are calculated in EnTa_Update)
switch (limbIndex) {
- case 8:
- rot->x += this->unk_2DA.y;
- rot->y -= this->unk_2DA.x;
+ case ENTA_LIMB_CHEST:
+ rot->x += this->torsoRot.y;
+ rot->y -= this->torsoRot.x;
break;
- case 15:
- rot->x += this->unk_2D4.y;
- rot->z += this->unk_2D4.x;
+
+ case ENTA_LIMB_HEAD:
+ rot->x += this->headRot.y;
+ rot->z += this->headRot.x;
break;
}
- if (this->unk_2E0 & 0x8) {
- this->unk_2E0 &= ~0x8;
- } else if ((limbIndex == 8) || (limbIndex == 10) || (limbIndex == 13)) {
+ // Rocking/wobbling animation for the torso and arms
+ if (this->stateFlags & TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM) {
+ // TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM might have been supposed to prevent
+ // the rocking in some situations, (e.g. while sleeping).
+ // But because this function is run first for the root limb (limbIndex 1),
+ // and the flag is immediately unset, all subsequent calls end up
+ // in the else if branch below and rocking always occurs.
+ // So this flag has no effect.
+ this->stateFlags &= ~TALON_STATE_FLAG_SUPPRESS_ROCKING_ANIM;
+ } else if ((limbIndex == ENTA_LIMB_CHEST) || (limbIndex == ENTA_LIMB_LEFT_ARM) ||
+ (limbIndex == ENTA_LIMB_RIGHT_ARM)) {
s32 limbIdx50 = limbIndex * 50;
rot->y += Math_SinS(play->state.frames * (limbIdx50 + 0x814)) * 200.0f;
@@ -1188,15 +1294,11 @@ s32 EnTa_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* po
}
void EnTa_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot, void* thisx) {
- static Vec3f D_80B16E7C = {
- 1100.0f,
- 1000.0f,
- 0.0f,
- };
+ static Vec3f headOffset = { 1100.0f, 1000.0f, 0.0f };
EnTa* this = (EnTa*)thisx;
- if (limbIndex == 15) {
- Matrix_MultVec3f(&D_80B16E7C, &this->actor.focus.pos);
+ if (limbIndex == ENTA_LIMB_HEAD) {
+ Matrix_MultVec3f(&headOffset, &this->actor.focus.pos);
}
}
diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.h b/src/overlays/actors/ovl_En_Ta/z_en_ta.h
index ebb3823b5a..d5bd5c49a3 100644
--- a/src/overlays/actors/ovl_En_Ta/z_en_ta.h
+++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.h
@@ -9,31 +9,60 @@
struct EnTa;
typedef void (*EnTaActionFunc)(struct EnTa*, PlayState*);
-typedef void (*EnTaUnkFunc)(struct EnTa*);
+typedef void (*EnTaBlinkFunc)(struct EnTa*);
+typedef void (*EnTaAnimFunc)(struct EnTa*);
+
+typedef enum {
+ /* 0xFFFF */ ENTA_CHILD_ERA = -1,
+ /* 0x0001 */ ENTA_IN_KAKARIKO = 1,
+ /* 0x0002 */ ENTA_RETURNED_FROM_KAKARIKO
+ } EnTaType;
+
+typedef enum {
+ /* 0x00 */ ENTA_LIMB_NONE,
+ /* 0x01 */ ENTA_LIMB_ROOT,
+ /* 0x02 */ ENTA_LIMB_LEFT_THIGH,
+ /* 0x03 */ ENTA_LIMB_LEFT_LEG,
+ /* 0x04 */ ENTA_LIMB_LEFT_FOOT,
+ /* 0x05 */ ENTA_LIMB_RIGHT_THIGH,
+ /* 0x06 */ ENTA_LIMB_RIGHT_LEG,
+ /* 0x07 */ ENTA_LIMB_RIGHT_FOOT,
+ /* 0x08 */ ENTA_LIMB_CHEST,
+ /* 0x09 */ ENTA_LIMB_LEFT_SHOULDER,
+ /* 0x0A */ ENTA_LIMB_LEFT_ARM,
+ /* 0x0B */ ENTA_LIMB_LEFT_HAND,
+ /* 0x0C */ ENTA_LIMB_RIGHT_SHOULDER,
+ /* 0x0D */ ENTA_LIMB_RIGHT_ARM,
+ /* 0x0E */ ENTA_LIMB_RIGHT_HAND,
+ /* 0x0F */ ENTA_LIMB_HEAD,
+ /* 0x10 */ ENTA_LIMB_TORSO,
+ /* 0x11 */ ENTA_LIMB_MAX
+} EnTaLimb;
typedef struct EnTa {
/* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime;
- /* 0x0190 */ Vec3s jointTable[17];
- /* 0x01F6 */ Vec3s morphTable[17];
+ /* 0x0190 */ Vec3s jointTable[ENTA_LIMB_MAX];
+ /* 0x01F6 */ Vec3s morphTable[ENTA_LIMB_MAX];
/* 0x025C */ EnTaActionFunc actionFunc;
- /* 0x0260 */ EnTaUnkFunc unk_260;
+ /* 0x0260 */ EnTaAnimFunc animFunc;
/* 0x0264 */ ColliderCylinder collider;
- /* 0x02B0 */ EnTaUnkFunc unk_2B0;
+ /* 0x02B0 */ EnTaBlinkFunc blinkFunc;
/* 0x02B4 */ s16 eyeIndex;
/* 0x02B6 */ s16 blinkTimer;
/* 0x02B8 */ EnNiw* superCuccos[3];
- /* 0x02C4 */ s16 unk_2C4[3];
- /* 0x02CA */ u8 unk_2CA;
- /* 0x02CC */ s16 unk_2CC;
- /* 0x02CE */ s16 unk_2CE;
+ /* 0x02C4 */ s16 superCuccoTimers[3]; // This is used to time animations and actions for super-cuccos
+ /* 0x02CA */ u8 lastFoundSuperCuccoIdx;
+ /* 0x02CC */ s16 timer;
+ /* 0x02CE */ s16 rapidBlinks;
/* 0x02D0 */ s16 subCamId;
/* 0x02D2 */ s16 returnToCamId;
- /* 0x02D4 */ Vec3s unk_2D4;
- /* 0x02DA */ Vec3s unk_2DA;
- /* 0x02E0 */ u16 unk_2E0;
- /* 0x02E2 */ s16 unk_2E2;
+ /* 0x02D4 */ Vec3s headRot;
+ /* 0x02DA */ Vec3s torsoRot;
+ /* 0x02E0 */ u16 stateFlags;
+ /* 0x02E2 */ s16 nodOffTimer;
/* 0x02E4 */ AnimationHeader* currentAnimation;
} EnTa; // size = 0x02E8
+
#endif
diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c
index 697b31d86c..60e54f99d1 100644
--- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c
+++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c
@@ -7,7 +7,7 @@
#include "z_en_vali.h"
#include "assets/objects/object_vali/object_vali.h"
-#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_12)
+#define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_4 | ACTOR_FLAG_IGNORE_QUAKE)
void EnVali_Init(Actor* thisx, PlayState* play);
void EnVali_Destroy(Actor* thisx, PlayState* play);
diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c
index 88f4976e31..cd444c9132 100644
--- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c
+++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c
@@ -191,7 +191,7 @@ void EnVbBall_Update(Actor* thisx, PlayState* play2) {
if ((this->actor.params == 100) || (this->actor.params == 101)) {
Actor_Kill(&this->actor);
if (this->actor.params == 100) {
- func_80033E88(&this->actor, play, 5, 0xA);
+ Actor_RequestQuakeAndRumble(&this->actor, play, 5, 10);
}
if (this->actor.params == 100) {
spawnNum = 2;
diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c
index feb1141a72..cf97c6ca7d 100644
--- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c
+++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c
@@ -5,6 +5,7 @@
*/
#include "z_en_wall_tubo.h"
+#include "quake.h"
#include "vt.h"
#include "overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.h"
#include "overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.h"
@@ -91,10 +92,10 @@ void EnWallTubo_DetectChu(EnWallTubo* this, PlayState* play) {
func_80078884(NA_SE_SY_TRE_BOX_APPEAR);
this->timer = 60;
EffectSsBomb2_SpawnLayered(play, &this->explosionCenter, &effVelocity, &effAccel, 200, 40);
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 1);
+ quakeIndex = Quake_Request(GET_ACTIVE_CAM(play), QUAKE_TYPE_1);
Quake_SetSpeed(quakeIndex, 0x7FFF);
- Quake_SetQuakeValues(quakeIndex, 100, 0, 0, 0);
- Quake_SetCountdown(quakeIndex, 100);
+ Quake_SetPerturbations(quakeIndex, 100, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, 100);
this->actionFunc = EnWallTubo_SetWallFall;
break;
}
diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c
index 9d03e485d2..bae3874c58 100644
--- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c
+++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c
@@ -66,7 +66,7 @@ void EnWeatherTag_Init(Actor* thisx, PlayState* play) {
osSyncPrintf("\n\n");
// "☆☆☆☆☆ Cloudy (._.) Ah Melancholy ☆☆☆☆☆"
osSyncPrintf(VT_FGCOL(YELLOW) "☆☆☆☆☆ くもり (._.) あーあ 憂鬱 ☆☆☆☆☆ \n" VT_RST);
- if (Flags_GetEventChkInf(EVENTCHKINF_18)) {
+ if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED)) {
Actor_Kill(&this->actor);
}
EnWeatherTag_SetupAction(this, EnWeatherTag_DisabledCloudyLonLonRanch);
diff --git a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c
index 97d85a32fa..cb8bc106e8 100644
--- a/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c
+++ b/src/overlays/actors/ovl_En_Yukabyun/z_en_yukabyun.c
@@ -80,7 +80,7 @@ void func_80B43A94(EnYukabyun* this, PlayState* play) {
this->unk_150--;
}
if (this->unk_150 == 0) {
- this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_12;
+ this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_2 | ACTOR_FLAG_IGNORE_QUAKE;
this->actionfunc = func_80B43AD4;
}
}
diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
index 98bd3f0480..79c9eee758 100644
--- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c
+++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c
@@ -506,7 +506,7 @@ void EnZo_Dialog(EnZo* this, PlayState* play) {
this->unk_194.unk_18 = player->actor.world.pos;
if (this->actionFunc == EnZo_Standing) {
- // Look down at link if young, look up if old
+ // Look down at link if child, look up if adult
this->unk_194.unk_14 = !LINK_IS_ADULT ? 10.0f : -10.0f;
} else {
this->unk_194.unk_18.y = this->actor.world.pos.y;
diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c
index e163fb1101..5240403a51 100644
--- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c
+++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c
@@ -375,7 +375,6 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection*
MtxF* shieldMtx;
Vec3f vecA;
Vec3f vecC;
- MirRayShieldReflection* currentReflection;
shieldMtx = &player->shieldMf;
@@ -402,25 +401,24 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection*
Collider_SetQuadVertices(&this->shieldRay, &vecA, &vecB, &vecC, &vecD);
for (i = 0; i < 6; i++) {
- currentReflection = &reflection[i];
- if (currentReflection->reflectionPoly != NULL) {
- polyNormal[0] = COLPOLY_GET_NORMAL(currentReflection->reflectionPoly->normal.x);
- polyNormal[1] = COLPOLY_GET_NORMAL(currentReflection->reflectionPoly->normal.y);
- polyNormal[2] = COLPOLY_GET_NORMAL(currentReflection->reflectionPoly->normal.z);
+ if (reflection[i].reflectionPoly != NULL) {
+ polyNormal[0] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.x);
+ polyNormal[1] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.y);
+ polyNormal[2] = COLPOLY_GET_NORMAL(reflection[i].reflectionPoly->normal.z);
- if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2],
- currentReflection->reflectionPoly->dist, &vecB, &vecD, &sp118, 1)) {
+ if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2], reflection[i].reflectionPoly->dist,
+ &vecB, &vecD, &sp118, 1)) {
- currentReflection->pos.x = sp118.x;
- currentReflection->pos.y = sp118.y;
- currentReflection->pos.z = sp118.z;
+ reflection[i].pos.x = sp118.x;
+ reflection[i].pos.y = sp118.y;
+ reflection[i].pos.z = sp118.z;
temp_f0 = sqrtf(SQ(sp118.x - vecB.x) + SQ(sp118.y - vecB.y) + SQ(sp118.z - vecB.z));
if (temp_f0 < (this->reflectIntensity * 600.0f)) {
- currentReflection->opacity = 200;
+ reflection[i].opacity = 200;
} else {
- currentReflection->opacity = (s32)(800.0f - temp_f0);
+ reflection[i].opacity = (s32)(800.0f - temp_f0);
}
sp10C.x = (shieldMtx->xx * 100.0f) + vecB.x;
@@ -431,25 +429,18 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection*
sp100.y = (spE8[1] * 4.0f) + sp10C.y;
sp100.z = (spE8[2] * 4.0f) + sp10C.z;
- currentReflection->mtx.zw = 0.0f;
+ reflection[i].mtx.zw = 0.0f;
- if (1) {}
- if (1) {}
- if (1) {}
- if (1) {} // All four required to match
-
- currentReflection->mtx.xx = currentReflection->mtx.yy = currentReflection->mtx.zz =
- currentReflection->mtx.ww = 1.0f;
- currentReflection->mtx.yx = currentReflection->mtx.zx = currentReflection->mtx.wx =
- currentReflection->mtx.xy = currentReflection->mtx.zy = currentReflection->mtx.wy =
- currentReflection->mtx.xz = currentReflection->mtx.yz = currentReflection->mtx.wz =
- currentReflection->mtx.xw = currentReflection->mtx.yw = currentReflection->mtx.zw;
+ reflection[i].mtx.xx = reflection[i].mtx.yy = reflection[i].mtx.zz = reflection[i].mtx.ww = 1.0f;
+ reflection[i].mtx.yx = reflection[i].mtx.zx = reflection[i].mtx.wx = reflection[i].mtx.xy =
+ reflection[i].mtx.zy = reflection[i].mtx.wy = reflection[i].mtx.xz = reflection[i].mtx.yz =
+ reflection[i].mtx.wz = reflection[i].mtx.xw = reflection[i].mtx.yw = reflection[i].mtx.zw;
if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2],
- currentReflection->reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) {
- currentReflection->mtx.xx = intersection.x - sp118.x;
- currentReflection->mtx.yx = intersection.y - sp118.y;
- currentReflection->mtx.zx = intersection.z - sp118.z;
+ reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) {
+ reflection[i].mtx.xx = intersection.x - sp118.x;
+ reflection[i].mtx.yx = intersection.y - sp118.y;
+ reflection[i].mtx.zx = intersection.z - sp118.z;
}
sp10C.x = (shieldMtx->xy * 100.0f) + vecB.x;
@@ -461,13 +452,13 @@ void MirRay_ReflectedBeam(MirRay* this, PlayState* play, MirRayShieldReflection*
sp100.z = (spE8[2] * 4.0f) + sp10C.z;
if (Math3D_LineSegVsPlane(polyNormal[0], polyNormal[1], polyNormal[2],
- currentReflection->reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) {
- currentReflection->mtx.xy = intersection.x - sp118.x;
- currentReflection->mtx.yy = intersection.y - sp118.y;
- currentReflection->mtx.zy = intersection.z - sp118.z;
+ reflection[i].reflectionPoly->dist, &sp10C, &sp100, &intersection, 1)) {
+ reflection[i].mtx.xy = intersection.x - sp118.x;
+ reflection[i].mtx.yy = intersection.y - sp118.y;
+ reflection[i].mtx.zy = intersection.z - sp118.z;
}
} else {
- currentReflection->reflectionPoly = NULL;
+ reflection[i].reflectionPoly = NULL;
}
}
}
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 2ac90b1cb1..c7da7d11bf 100644
--- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c
+++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c
@@ -7,6 +7,7 @@
#include "z_obj_lift.h"
#include "assets/objects/object_d_lift/object_d_lift.h"
#include "overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.h"
+#include "quake.h"
#define FLAGS ACTOR_FLAG_4
@@ -142,10 +143,10 @@ void func_80B96560(ObjLift* this, PlayState* play) {
if (((this->dyna.actor.params >> 8) & 7) == 7) {
func_80B967C0(this);
} else {
- quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 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_80B9664C(this);
}
}
diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c
index 9dee92928c..2a50b793c2 100644
--- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c
+++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c
@@ -10,10 +10,11 @@
#define FLAGS ACTOR_FLAG_4
-// type: (this->dyna.actor.params & 7)
-// subtype: (this->dyna.actor.params >> 4 & 7)
-// switch flag: (this->dyna.actor.params >> 8 & 0x3F)
-// frozen: this->dyna.actor.params >> 7 & 1
+#define OBJSWITCH_TYPE(thisx) ((thisx)->params & 7)
+#define OBJSWITCH_SUBTYPE(thisx) (((thisx)->params >> 4) & 7)
+#define OBJSWITCH_SWITCH_FLAG(thisx) (((thisx)->params >> 8) & 0x3F)
+#define OBJSWITCH_FROZEN(thisx) (((thisx)->params >> 7) & 1)
+#define OBJSWITCH_FROZEN_FLAG (1 << 7)
void ObjSwitch_Init(Actor* thisx, PlayState* play);
void ObjSwitch_Destroy(Actor* thisx, PlayState* play);
@@ -61,9 +62,15 @@ const ActorInit Obj_Switch_InitVars = {
(ActorFunc)ObjSwitch_Draw,
};
-static f32 sHeights[] = { 10, 10, 0, 30, 30 };
+static f32 sFocusHeights[] = {
+ 10, // OBJSWITCH_TYPE_FLOOR
+ 10, // OBJSWITCH_TYPE_FLOOR_RUSTY
+ 0, // OBJSWITCH_TYPE_EYE
+ 30, // OBJSWITCH_TYPE_CRYSTAL
+ 30, // OBJSWITCH_TYPE_CRYSTAL_TARGETABLE
+};
-static ColliderTrisElementInit D_80B9EC34[2] = {
+static ColliderTrisElementInit sRustyFloorTrisElementsInit[2] = {
{
{
ELEMTYPE_UNK0,
@@ -97,11 +104,11 @@ static ColliderTrisInit sRustyFloorTrisInit = {
OC2_NONE,
COLSHAPE_TRIS,
},
- ARRAY_COUNT(D_80B9EC34),
- D_80B9EC34,
+ ARRAY_COUNT(sRustyFloorTrisElementsInit),
+ sRustyFloorTrisElementsInit,
};
-static ColliderTrisElementInit D_80B9ECBC[2] = {
+static ColliderTrisElementInit sEyeTrisElementsInit[2] = {
{
{
ELEMTYPE_UNK4,
@@ -126,7 +133,7 @@ static ColliderTrisElementInit D_80B9ECBC[2] = {
},
};
-static ColliderTrisInit trisColliderEye = {
+static ColliderTrisInit sEyeTrisInit = {
{
COLTYPE_NONE,
AT_NONE,
@@ -135,11 +142,11 @@ static ColliderTrisInit trisColliderEye = {
OC2_NONE,
COLSHAPE_TRIS,
},
- ARRAY_COUNT(D_80B9ECBC),
- D_80B9ECBC,
+ ARRAY_COUNT(sEyeTrisElementsInit),
+ sEyeTrisElementsInit,
};
-static ColliderJntSphElementInit D_80B9ED44[1] = {
+static ColliderJntSphElementInit sCrystalJntSphElementInit[1] = {
{
{
ELEMTYPE_UNK0,
@@ -153,7 +160,7 @@ static ColliderJntSphElementInit D_80B9ED44[1] = {
},
};
-static ColliderJntSphInit sCrystalJntSphereInit = {
+static ColliderJntSphInit sCrystalJntSphInit = {
{
COLTYPE_METAL,
AT_NONE,
@@ -162,8 +169,8 @@ static ColliderJntSphInit sCrystalJntSphereInit = {
OC2_TYPE_2,
COLSHAPE_JNTSPH,
},
- ARRAY_COUNT(D_80B9ED44),
- D_80B9ED44,
+ ARRAY_COUNT(sCrystalJntSphElementInit),
+ sCrystalJntSphElementInit,
};
static InitChainEntry sInitChain[] = {
@@ -173,9 +180,9 @@ static InitChainEntry sInitChain[] = {
ICHAIN_F32(uncullZoneDownward, 2000, ICHAIN_STOP),
};
-void ObjSwitch_RotateY(Vec3f* dest, Vec3f* src, s16 angle) {
- f32 s = Math_SinS(angle);
- f32 c = Math_CosS(angle);
+void ObjSwitch_RotateY(Vec3f* dest, Vec3f* src, s16 rotY) {
+ f32 s = Math_SinS(rotY);
+ f32 c = Math_CosS(rotY);
dest->x = src->z * s + src->x * c;
dest->y = src->y;
@@ -235,18 +242,18 @@ Actor* ObjSwitch_SpawnIce(ObjSwitch* this, PlayState* play) {
return Actor_SpawnAsChild(&play->actorCtx, thisx, play, ACTOR_OBJ_ICE_POLY, thisx->world.pos.x, thisx->world.pos.y,
thisx->world.pos.z, thisx->world.rot.x, thisx->world.rot.y, thisx->world.rot.z,
- (this->dyna.actor.params >> 8 & 0x3F) << 8);
+ OBJSWITCH_SWITCH_FLAG(&this->dyna.actor) << 8);
}
void ObjSwitch_SetOn(ObjSwitch* this, PlayState* play) {
s32 pad;
s32 subType;
- if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) {
+ if (Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) {
this->cooldownOn = false;
} else {
- subType = (this->dyna.actor.params >> 4 & 7);
- Flags_SetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F));
+ subType = OBJSWITCH_SUBTYPE(&this->dyna.actor);
+ Flags_SetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor));
if (subType == OBJSWITCH_SUBTYPE_ONCE || subType == OBJSWITCH_SUBTYPE_SYNC) {
OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_CORRECT_CHIME);
@@ -261,10 +268,10 @@ void ObjSwitch_SetOn(ObjSwitch* this, PlayState* play) {
void ObjSwitch_SetOff(ObjSwitch* this, PlayState* play) {
this->cooldownOn = false;
- if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) {
- Flags_UnsetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F));
+ if (Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) {
+ Flags_UnsetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor));
- if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_TOGGLE) {
+ if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_TOGGLE) {
OnePointCutscene_AttentionSetSfx(play, &this->dyna.actor, NA_SE_SY_TRE_BOX_APPEAR);
this->cooldownOn = true;
}
@@ -280,11 +287,11 @@ void ObjSwitch_UpdateTwoTexScrollXY(ObjSwitch* this) {
void ObjSwitch_Init(Actor* thisx, PlayState* play) {
ObjSwitch* this = (ObjSwitch*)thisx;
- s32 switchFlagSet;
+ s32 isSwitchFlagSet;
s32 type;
- switchFlagSet = Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F));
- type = (this->dyna.actor.params & 7);
+ isSwitchFlagSet = Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor));
+ type = OBJSWITCH_TYPE(&this->dyna.actor);
if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_RUSTY) {
ObjSwitch_InitDynaPoly(this, play, &gFloorSwitchCol, DYNA_TRANSFORM_POS);
@@ -296,14 +303,14 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + 1.0f;
}
- Actor_SetFocus(&this->dyna.actor, sHeights[type]);
+ Actor_SetFocus(&this->dyna.actor, sFocusHeights[type]);
if (type == OBJSWITCH_TYPE_FLOOR_RUSTY) {
ObjSwitch_InitTrisCollider(this, play, &sRustyFloorTrisInit);
} else if (type == OBJSWITCH_TYPE_EYE) {
- ObjSwitch_InitTrisCollider(this, play, &trisColliderEye);
+ ObjSwitch_InitTrisCollider(this, play, &sEyeTrisInit);
} else if (type == OBJSWITCH_TYPE_CRYSTAL || type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) {
- ObjSwitch_InitJntSphCollider(this, play, &sCrystalJntSphereInit);
+ ObjSwitch_InitJntSphCollider(this, play, &sCrystalJntSphInit);
}
if (type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) {
@@ -313,31 +320,31 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) {
this->dyna.actor.colChkInfo.mass = MASS_IMMOVABLE;
- if ((this->dyna.actor.params >> 7 & 1) && (ObjSwitch_SpawnIce(this, play) == NULL)) {
+ if (OBJSWITCH_FROZEN(&this->dyna.actor) && (ObjSwitch_SpawnIce(this, play) == NULL)) {
osSyncPrintf(VT_FGCOL(RED));
osSyncPrintf("Error : 氷発生失敗 (%s %d)\n", "../z_obj_switch.c", 732);
osSyncPrintf(VT_RST);
- this->dyna.actor.params &= ~0x80;
+ this->dyna.actor.params &= ~OBJSWITCH_FROZEN_FLAG;
}
- if (this->dyna.actor.params >> 7 & 1) {
+ if (OBJSWITCH_FROZEN(&this->dyna.actor)) {
ObjSwitch_EyeFrozenInit(this);
} else if (type == OBJSWITCH_TYPE_FLOOR || type == OBJSWITCH_TYPE_FLOOR_RUSTY) {
//! @bug This condition does not account for OBJSWITCH_SUBTYPE_HOLD_INVERTED which expects
//! the relationship between the switch position and the switch flag to be inverted
- if (switchFlagSet) {
+ if (isSwitchFlagSet) {
ObjSwitch_FloorDownInit(this);
} else {
ObjSwitch_FloorUpInit(this);
}
} else if (type == OBJSWITCH_TYPE_EYE) {
- if (switchFlagSet) {
+ if (isSwitchFlagSet) {
ObjSwitch_EyeClosedInit(this);
} else {
ObjSwitch_EyeOpenInit(this);
}
} else if (type == OBJSWITCH_TYPE_CRYSTAL || type == OBJSWITCH_TYPE_CRYSTAL_TARGETABLE) {
- if (switchFlagSet) {
+ if (isSwitchFlagSet) {
ObjSwitch_CrystalOnInit(this);
} else {
ObjSwitch_CrystalOffInit(this);
@@ -350,18 +357,19 @@ void ObjSwitch_Init(Actor* thisx, PlayState* play) {
void ObjSwitch_Destroy(Actor* thisx, PlayState* play) {
ObjSwitch* this = (ObjSwitch*)thisx;
- switch (this->dyna.actor.params & 7) {
+ switch (OBJSWITCH_TYPE(&this->dyna.actor)) {
case OBJSWITCH_TYPE_FLOOR:
case OBJSWITCH_TYPE_FLOOR_RUSTY:
DynaPoly_DeleteBgActor(play, &play->colCtx.dyna, this->dyna.bgId);
break;
}
- switch (this->dyna.actor.params & 7) {
+ switch (OBJSWITCH_TYPE(&this->dyna.actor)) {
case OBJSWITCH_TYPE_FLOOR_RUSTY:
case OBJSWITCH_TYPE_EYE:
Collider_DestroyTris(play, &this->tris.col);
break;
+
case OBJSWITCH_TYPE_CRYSTAL:
case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE:
Collider_DestroyJntSph(play, &this->jntSph.col);
@@ -375,7 +383,7 @@ void ObjSwitch_FloorUpInit(ObjSwitch* this) {
}
void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play) {
- if ((this->dyna.actor.params & 7) == OBJSWITCH_TYPE_FLOOR_RUSTY) {
+ if (OBJSWITCH_TYPE(&this->dyna.actor) == OBJSWITCH_TYPE_FLOOR_RUSTY) {
if (this->tris.col.base.acFlags & AC_HIT) {
ObjSwitch_FloorPressInit(this);
ObjSwitch_SetOn(this, play);
@@ -384,26 +392,29 @@ void ObjSwitch_FloorUp(ObjSwitch* this, PlayState* play) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base);
}
} else {
- switch (this->dyna.actor.params >> 4 & 7) {
+ switch (OBJSWITCH_SUBTYPE(&this->dyna.actor)) {
case OBJSWITCH_SUBTYPE_ONCE:
if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) {
ObjSwitch_FloorPressInit(this);
ObjSwitch_SetOn(this, play);
}
break;
+
case OBJSWITCH_SUBTYPE_TOGGLE:
if ((this->dyna.interactFlags & DYNA_INTERACT_PLAYER_ON_TOP) &&
- !(this->unk_17F & DYNA_INTERACT_PLAYER_ON_TOP)) {
+ !(this->prevColFlags & DYNA_INTERACT_PLAYER_ON_TOP)) {
ObjSwitch_FloorPressInit(this);
ObjSwitch_SetOn(this, play);
}
break;
+
case OBJSWITCH_SUBTYPE_HOLD:
if (func_800435B4(&this->dyna)) {
ObjSwitch_FloorPressInit(this);
ObjSwitch_SetOn(this, play);
}
break;
+
case OBJSWITCH_SUBTYPE_HOLD_INVERTED:
if (func_800435B4(&this->dyna)) {
ObjSwitch_FloorPressInit(this);
@@ -420,7 +431,7 @@ void ObjSwitch_FloorPressInit(ObjSwitch* this) {
}
void ObjSwitch_FloorPress(ObjSwitch* this, PlayState* play) {
- if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_HOLD_INVERTED || !this->cooldownOn ||
+ if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_HOLD_INVERTED || !this->cooldownOn ||
func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) {
this->dyna.actor.scale.y -= 99.0f / 2000.0f;
if (this->dyna.actor.scale.y <= 33.0f / 2000.0f) {
@@ -438,25 +449,27 @@ void ObjSwitch_FloorDownInit(ObjSwitch* this) {
}
void ObjSwitch_FloorDown(ObjSwitch* this, PlayState* play) {
- switch (this->dyna.actor.params >> 4 & 7) {
+ switch (OBJSWITCH_SUBTYPE(&this->dyna.actor)) {
case OBJSWITCH_SUBTYPE_ONCE:
- if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) {
+ if (!Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) {
ObjSwitch_FloorReleaseInit(this);
}
break;
+
case OBJSWITCH_SUBTYPE_TOGGLE:
if ((this->dyna.interactFlags & DYNA_INTERACT_PLAYER_ON_TOP) &&
- !(this->unk_17F & DYNA_INTERACT_PLAYER_ON_TOP)) {
+ !(this->prevColFlags & DYNA_INTERACT_PLAYER_ON_TOP)) {
ObjSwitch_FloorReleaseInit(this);
ObjSwitch_SetOff(this, play);
}
break;
+
case OBJSWITCH_SUBTYPE_HOLD:
case OBJSWITCH_SUBTYPE_HOLD_INVERTED:
if (!func_800435B4(&this->dyna) && !Player_InCsMode(play)) {
if (this->releaseTimer <= 0) {
ObjSwitch_FloorReleaseInit(this);
- if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_HOLD) {
+ if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_HOLD) {
ObjSwitch_SetOff(this, play);
} else {
ObjSwitch_SetOn(this, play);
@@ -475,10 +488,11 @@ void ObjSwitch_FloorReleaseInit(ObjSwitch* this) {
}
void ObjSwitch_FloorRelease(ObjSwitch* this, PlayState* play) {
- s16 subType = (this->dyna.actor.params >> 4 & 7);
+ s16 subType = OBJSWITCH_SUBTYPE(&this->dyna.actor);
if (((subType != OBJSWITCH_SUBTYPE_TOGGLE) && (subType != OBJSWITCH_SUBTYPE_HOLD_INVERTED)) || !this->cooldownOn ||
func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) {
+
this->dyna.actor.scale.y += 99.0f / 2000.0f;
if (this->dyna.actor.scale.y >= 33.0f / 200.0f) {
ObjSwitch_FloorUpInit(this);
@@ -494,16 +508,16 @@ s32 ObjSwitch_EyeIsHit(ObjSwitch* this) {
Actor* collidingActor;
s16 yawDiff;
- if ((this->tris.col.base.acFlags & AC_HIT) && !(this->unk_17F & AC_HIT)) {
+ if ((this->tris.col.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT)) {
collidingActor = this->tris.col.base.ac;
if (collidingActor != NULL) {
yawDiff = collidingActor->world.rot.y - this->dyna.actor.shape.rot.y;
if (ABS(yawDiff) > 0x5000) {
- return 1;
+ return true;
}
}
}
- return 0;
+ return false;
}
void ObjSwitch_EyeFrozenInit(ObjSwitch* this) {
@@ -511,7 +525,7 @@ void ObjSwitch_EyeFrozenInit(ObjSwitch* this) {
}
void ObjSwitch_EyeInit(ObjSwitch* this, PlayState* play) {
- if (Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) {
+ if (Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) {
ObjSwitch_EyeClosedInit(this);
} else {
ObjSwitch_EyeOpenInit(this);
@@ -524,10 +538,10 @@ void ObjSwitch_EyeOpenInit(ObjSwitch* this) {
}
void ObjSwitch_EyeOpen(ObjSwitch* this, PlayState* play) {
- if (ObjSwitch_EyeIsHit(this) || (this->dyna.actor.params >> 7 & 1)) {
+ if (ObjSwitch_EyeIsHit(this) || OBJSWITCH_FROZEN(&this->dyna.actor)) {
ObjSwitch_EyeClosingInit(this);
ObjSwitch_SetOn(this, play);
- this->dyna.actor.params &= ~0x80;
+ this->dyna.actor.params &= ~OBJSWITCH_FROZEN_FLAG;
}
}
@@ -552,18 +566,19 @@ void ObjSwitch_EyeClosedInit(ObjSwitch* this) {
}
void ObjSwitch_EyeClosed(ObjSwitch* this, PlayState* play) {
- switch (this->dyna.actor.params >> 4 & 7) {
+ switch (OBJSWITCH_SUBTYPE(&this->dyna.actor)) {
case OBJSWITCH_SUBTYPE_ONCE:
- if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) {
+ if (!Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) {
ObjSwitch_EyeOpeningInit(this);
- this->dyna.actor.params &= ~0x80;
+ this->dyna.actor.params &= ~OBJSWITCH_FROZEN_FLAG;
}
break;
+
case OBJSWITCH_SUBTYPE_TOGGLE:
- if (ObjSwitch_EyeIsHit(this) || (this->dyna.actor.params >> 7 & 1)) {
+ if (ObjSwitch_EyeIsHit(this) || OBJSWITCH_FROZEN(&this->dyna.actor)) {
ObjSwitch_EyeOpeningInit(this);
ObjSwitch_SetOff(this, play);
- this->dyna.actor.params &= ~0x80;
+ this->dyna.actor.params &= ~OBJSWITCH_FROZEN_FLAG;
}
break;
}
@@ -575,8 +590,9 @@ void ObjSwitch_EyeOpeningInit(ObjSwitch* this) {
}
void ObjSwitch_EyeOpening(ObjSwitch* this, PlayState* play) {
- if ((this->dyna.actor.params >> 4 & 7) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn ||
+ if (OBJSWITCH_SUBTYPE(&this->dyna.actor) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn ||
func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) {
+
this->eyeTexIndex--;
if (this->eyeTexIndex <= 0) {
ObjSwitch_EyeOpenInit(this);
@@ -594,7 +610,7 @@ void ObjSwitch_CrystalOffInit(ObjSwitch* this) {
}
void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) {
- switch (this->dyna.actor.params >> 4 & 7) {
+ switch (OBJSWITCH_SUBTYPE(&this->dyna.actor)) {
case OBJSWITCH_SUBTYPE_ONCE:
if ((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) {
this->disableAcTimer = 10;
@@ -602,16 +618,20 @@ void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) {
ObjSwitch_CrystalTurnOnInit(this);
}
break;
+
case OBJSWITCH_SUBTYPE_SYNC:
if (((this->jntSph.col.base.acFlags & AC_HIT) && this->disableAcTimer <= 0) ||
- Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) {
+ Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) {
+
this->disableAcTimer = 10;
ObjSwitch_SetOn(this, play);
ObjSwitch_CrystalTurnOnInit(this);
}
break;
+
case OBJSWITCH_SUBTYPE_TOGGLE:
- if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & AC_HIT) && this->disableAcTimer <= 0) {
+ if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT) &&
+ this->disableAcTimer <= 0) {
this->disableAcTimer = 10;
ObjSwitch_SetOn(this, play);
ObjSwitch_CrystalTurnOnInit(this);
@@ -629,7 +649,7 @@ void ObjSwitch_CrystalTurnOnInit(ObjSwitch* this) {
void ObjSwitch_CrystalTurnOn(ObjSwitch* this, PlayState* play) {
if (!this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) {
ObjSwitch_CrystalOnInit(this);
- if ((this->dyna.actor.params >> 4 & 7) == OBJSWITCH_SUBTYPE_TOGGLE) {
+ if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_TOGGLE) {
ObjSwitch_UpdateTwoTexScrollXY(this);
}
Audio_PlayActorSfx2(&this->dyna.actor, NA_SE_EV_DIAMOND_SWITCH);
@@ -645,15 +665,17 @@ void ObjSwitch_CrystalOnInit(ObjSwitch* this) {
}
void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play) {
- switch (this->dyna.actor.params >> 4 & 7) {
+ switch (OBJSWITCH_SUBTYPE(&this->dyna.actor)) {
case OBJSWITCH_SUBTYPE_ONCE:
case OBJSWITCH_SUBTYPE_SYNC:
- if (!Flags_GetSwitch(play, (this->dyna.actor.params >> 8 & 0x3F))) {
+ if (!Flags_GetSwitch(play, OBJSWITCH_SWITCH_FLAG(&this->dyna.actor))) {
ObjSwitch_CrystalTurnOffInit(this);
}
break;
+
case OBJSWITCH_SUBTYPE_TOGGLE:
- if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & AC_HIT) && this->disableAcTimer <= 0) {
+ if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->prevColFlags & AC_HIT) &&
+ this->disableAcTimer <= 0) {
this->disableAcTimer = 10;
play = play;
ObjSwitch_CrystalTurnOffInit(this);
@@ -670,7 +692,7 @@ void ObjSwitch_CrystalTurnOffInit(ObjSwitch* this) {
}
void ObjSwitch_CrystalTurnOff(ObjSwitch* this, PlayState* play) {
- if ((this->dyna.actor.params >> 4 & 7) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn ||
+ if (OBJSWITCH_SUBTYPE(&this->dyna.actor) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn ||
func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) {
ObjSwitch_CrystalOffInit(this);
ObjSwitch_UpdateTwoTexScrollXY(this);
@@ -690,22 +712,24 @@ void ObjSwitch_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
- switch (this->dyna.actor.params & 7) {
+ switch (OBJSWITCH_TYPE(&this->dyna.actor)) {
case OBJSWITCH_TYPE_FLOOR:
case OBJSWITCH_TYPE_FLOOR_RUSTY:
- this->unk_17F = this->dyna.interactFlags;
+ this->prevColFlags = this->dyna.interactFlags;
break;
+
case OBJSWITCH_TYPE_EYE:
- this->unk_17F = this->tris.col.base.acFlags;
+ this->prevColFlags = this->tris.col.base.acFlags;
this->tris.col.base.acFlags &= ~AC_HIT;
CollisionCheck_SetAC(play, &play->colChkCtx, &this->tris.col.base);
break;
+
case OBJSWITCH_TYPE_CRYSTAL:
case OBJSWITCH_TYPE_CRYSTAL_TARGETABLE:
if (!Player_InCsMode(play) && this->disableAcTimer > 0) {
this->disableAcTimer--;
}
- this->unk_17F = this->jntSph.col.base.acFlags;
+ this->prevColFlags = this->jntSph.col.base.acFlags;
this->jntSph.col.base.acFlags &= ~AC_HIT;
if (this->disableAcTimer <= 0) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->jntSph.col.base);
@@ -716,9 +740,14 @@ void ObjSwitch_Update(Actor* thisx, PlayState* play) {
}
void ObjSwitch_DrawFloor(ObjSwitch* this, PlayState* play) {
- static Gfx* floorSwitchDLists[] = { gFloorSwitch1DL, gFloorSwitch3DL, gFloorSwitch2DL, gFloorSwitch2DL };
+ static Gfx* floorSwitchDLists[] = {
+ gFloorSwitch1DL, // OBJSWITCH_SUBTYPE_ONCE
+ gFloorSwitch3DL, // OBJSWITCH_SUBTYPE_TOGGLE
+ gFloorSwitch2DL, // OBJSWITCH_SUBTYPE_HOLD
+ gFloorSwitch2DL, // OBJSWITCH_SUBTYPE_HOLD_INVERTED
+ };
- Gfx_DrawDListOpa(play, floorSwitchDLists[(this->dyna.actor.params >> 4 & 7)]);
+ Gfx_DrawDListOpa(play, floorSwitchDLists[OBJSWITCH_SUBTYPE(&this->dyna.actor)]);
}
void ObjSwitch_DrawFloorRusty(ObjSwitch* this, PlayState* play) {
@@ -727,12 +756,17 @@ void ObjSwitch_DrawFloorRusty(ObjSwitch* this, PlayState* play) {
void ObjSwitch_DrawEye(ObjSwitch* this, PlayState* play) {
static void* eyeTextures[][4] = {
+ // OBJSWITCH_SUBTYPE_ONCE
{ gEyeSwitchGoldOpenTex, gEyeSwitchGoldOpeningTex, gEyeSwitchGoldClosingTex, gEyeSwitchGoldClosedTex },
+ // OBJSWITCH_SUBTYPE_TOGGLE
{ gEyeSwitchSilverOpenTex, gEyeSwitchSilverHalfTex, gEyeSwitchSilverClosedTex, gEyeSwitchSilverClosedTex },
};
- static Gfx* eyeDlists[] = { gEyeSwitch1DL, gEyeSwitch2DL };
+ static Gfx* eyeSwitchDLs[] = {
+ gEyeSwitch1DL, // OBJSWITCH_SUBTYPE_ONCE
+ gEyeSwitch2DL, // OBJSWITCH_SUBTYPE_TOGGLE
+ };
s32 pad;
- s32 subType = (this->dyna.actor.params >> 4 & 7);
+ s32 subType = OBJSWITCH_SUBTYPE(&this->dyna.actor);
OPEN_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1459);
@@ -740,21 +774,31 @@ void ObjSwitch_DrawEye(ObjSwitch* this, PlayState* play) {
gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, "../z_obj_switch.c", 1462),
G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW);
gSPSegment(POLY_OPA_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(eyeTextures[subType][this->eyeTexIndex]));
- gSPDisplayList(POLY_OPA_DISP++, eyeDlists[subType]);
+ gSPDisplayList(POLY_OPA_DISP++, eyeSwitchDLs[subType]);
CLOSE_DISPS(play->state.gfxCtx, "../z_obj_switch.c", 1471);
}
void ObjSwitch_DrawCrystal(ObjSwitch* this, PlayState* play) {
- static Gfx* xluDLists[] = { gCrystalSwitchCoreXluDL, gCrystalSwitchDiamondXluDL, NULL, NULL,
- gCrystalSwitchCoreXluDL };
- static Gfx* opaDLists[] = { gCrystalSwitchCoreOpaDL, gCrystalSwitchDiamondOpaDL, NULL, NULL,
- gCrystalSwitchCoreOpaDL };
+ static Gfx* xluDLists[] = {
+ gCrystalSwitchCoreXluDL, // OBJSWITCH_SUBTYPE_ONCE
+ gCrystalSwitchDiamondXluDL, // OBJSWITCH_SUBTYPE_TOGGLE
+ NULL, // OBJSWITCH_SUBTYPE_HOLD
+ NULL, // OBJSWITCH_SUBTYPE_HOLD_INVERTED
+ gCrystalSwitchCoreXluDL, // OBJSWITCH_SUBTYPE_SYNC
+ };
+ static Gfx* opaDLists[] = {
+ gCrystalSwitchCoreOpaDL, // OBJSWITCH_SUBTYPE_ONCE
+ gCrystalSwitchDiamondOpaDL, // OBJSWITCH_SUBTYPE_TOGGLE
+ NULL, // OBJSWITCH_SUBTYPE_HOLD
+ NULL, // OBJSWITCH_SUBTYPE_HOLD_INVERTED
+ gCrystalSwitchCoreOpaDL // OBJSWITCH_SUBTYPE_SYNC
+ };
s32 pad1;
s32 pad2;
s32 subType;
- subType = (this->dyna.actor.params >> 4 & 7);
+ subType = OBJSWITCH_SUBTYPE(&this->dyna.actor);
func_8002ED80(&this->dyna.actor, play, 0);
if (1) {}
@@ -788,11 +832,15 @@ void ObjSwitch_DrawCrystal(ObjSwitch* this, PlayState* play) {
}
static ObjSwitchActionFunc sDrawFuncs[] = {
- ObjSwitch_DrawFloor, ObjSwitch_DrawFloorRusty, ObjSwitch_DrawEye, ObjSwitch_DrawCrystal, ObjSwitch_DrawCrystal,
+ ObjSwitch_DrawFloor, // OBJSWITCH_TYPE_FLOOR
+ ObjSwitch_DrawFloorRusty, // OBJSWITCH_TYPE_FLOOR_RUSTY
+ ObjSwitch_DrawEye, // OBJSWITCH_TYPE_EYE
+ ObjSwitch_DrawCrystal, // OBJSWITCH_TYPE_CRYSTAL
+ ObjSwitch_DrawCrystal, // OBJSWITCH_TYPE_CRYSTAL_TARGETABLE
};
void ObjSwitch_Draw(Actor* thisx, PlayState* play) {
ObjSwitch* this = (ObjSwitch*)thisx;
- sDrawFuncs[(this->dyna.actor.params & 7)](this, play);
+ sDrawFuncs[OBJSWITCH_TYPE(&this->dyna.actor)](this, play);
}
diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h
index f5c12673eb..8c12a9c85c 100644
--- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h
+++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h
@@ -48,7 +48,7 @@ typedef struct ObjSwitch {
/* 0x017A */ u8 x2TexScroll;
/* 0x017B */ u8 y2TexScroll;
/* 0x017C */ Color_RGB8 crystalColor;
- /* 0x017F */ u8 unk_17F;
+ /* 0x017F */ u8 prevColFlags; // Either dynapoly interact flags or AC flags, of the previous frame
union {
/* 0x0180 */ ObjSwitchJntSph jntSph;
/* 0x0180 */ ObjSwitchTris tris;
diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c
index 09247455a2..441084b0cc 100644
--- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c
+++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c
@@ -72,9 +72,9 @@ u32 ObjTimeblock_CalculateIsVisible(ObjTimeblock* this) {
if (this->unk_177 == 1) {
return this->unk_174 ^ temp;
} else {
- u8 linkIsYoung = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? true : false;
+ u8 linkIsChild = (LINK_AGE_IN_YEARS == YEARS_CHILD) ? true : false;
- return this->unk_174 ^ temp ^ linkIsYoung;
+ return this->unk_174 ^ temp ^ linkIsChild;
}
}
} else {
diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c
index 06ce3449fe..145d13f358 100644
--- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c
+++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c
@@ -72,10 +72,10 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) {
s32 i;
Vec3f eye;
Vtx* vtxPtr;
- Vec3f vec;
+ Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
- Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
+ Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
OPEN_DISPS(play->state.gfxCtx, "../z_oceff_wipe.c", 346);
@@ -103,7 +103,7 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
- Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
+ Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c
index 2bb9247696..dd32aa46c3 100644
--- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c
+++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c
@@ -66,10 +66,10 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
s32 pad[2];
Vec3f eye;
Vtx* vtxPtr;
- Vec3f vec;
+ Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
- Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
+ Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
if (this->timer < 32) {
z = Math_SinS(this->timer << 9) * 1330;
} else {
@@ -91,7 +91,7 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
- Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
+ Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c
index 3a05b14d07..db7f545cae 100644
--- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c
+++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c
@@ -67,10 +67,10 @@ void OceffWipe3_Draw(Actor* thisx, PlayState* play) {
s32 pad[2];
Vec3f eye;
Vtx* vtxPtr;
- Vec3f vec;
+ Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
- Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
+ Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
if (this->counter < 32) {
z = Math_SinS(this->counter << 9) * 1330;
} else {
@@ -92,7 +92,7 @@ void OceffWipe3_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
- Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
+ Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c
index 69e79ad1a4..bfdbac149e 100644
--- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c
+++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c
@@ -65,10 +65,10 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
s32 pad[2];
Vec3f eye;
Vtx* vtxPtr;
- Vec3f vec;
+ Vec3f quakeOffset;
eye = GET_ACTIVE_CAM(play)->eye;
- Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play));
+ Camera_GetQuakeOffset(&quakeOffset, GET_ACTIVE_CAM(play));
if (this->timer < 16) {
z = Math_SinS(this->timer * 1024) * 1330.0f;
} else {
@@ -90,7 +90,7 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Xlu(play->state.gfxCtx);
- Matrix_Translate(eye.x + vec.x, eye.y + vec.y, eye.z + vec.z, MTXMODE_NEW);
+ Matrix_Translate(eye.x + quakeOffset.x, eye.y + quakeOffset.y, eye.z + quakeOffset.z, MTXMODE_NEW);
Matrix_Scale(0.1f, 0.1f, 0.1f, MTXMODE_APPLY);
Matrix_ReplaceRotation(&play->billboardMtxF);
Matrix_Translate(0.0f, 0.0f, -z, MTXMODE_APPLY);
diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c
index 5905d18a17..04dea8f5f1 100644
--- a/src/overlays/actors/ovl_player_actor/z_player.c
+++ b/src/overlays/actors/ovl_player_actor/z_player.c
@@ -6,6 +6,7 @@
#include "ultra64.h"
#include "global.h"
+#include "quake.h"
#include "overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.h"
#include "overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.h"
@@ -7690,16 +7691,16 @@ s32 func_80842964(Player* this, PlayState* play) {
return func_8083B040(this, play) || func_8083B644(this, play) || func_8083E5A8(this, play);
}
-void func_808429B4(PlayState* play, s32 speed, s32 y, s32 countdown) {
- s32 quakeIdx = Quake_Add(Play_GetCamera(play, CAM_ID_MAIN), 3);
+void Player_RequestQuake(PlayState* play, s32 speed, s32 y, s32 duration) {
+ s32 quakeIndex = Quake_Request(Play_GetCamera(play, CAM_ID_MAIN), QUAKE_TYPE_3);
- Quake_SetSpeed(quakeIdx, speed);
- Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0);
- Quake_SetCountdown(quakeIdx, countdown);
+ Quake_SetSpeed(quakeIndex, speed);
+ Quake_SetPerturbations(quakeIndex, y, 0, 0, 0);
+ Quake_SetDuration(quakeIndex, duration);
}
void func_80842A28(PlayState* play, Player* this) {
- func_808429B4(play, 27767, 7, 20);
+ Player_RequestQuake(play, 27767, 7, 20);
play->actorCtx.unk_02 = 4;
Player_RequestRumble(this, 255, 20, 150, 0);
func_8002F7DC(&this->actor, NA_SE_IT_HAMMER_HIT);
@@ -8209,7 +8210,7 @@ s32 func_80843E64(PlayState* play, Player* this) {
}
func_80837AE0(this, 40);
- func_808429B4(play, 32967, 2, 30);
+ Player_RequestQuake(play, 32967, 2, 30);
Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration,
impactInfo->rumbleDecreaseRate, 0);
func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT);
@@ -8415,7 +8416,7 @@ void func_80844708(Player* this, PlayState* play) {
func_80832264(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_17, this->modelAnimType));
this->linearVelocity = -this->linearVelocity;
- func_808429B4(play, 33267, 3, 12);
+ Player_RequestQuake(play, 33267, 3, 12);
Player_RequestRumble(this, 255, 20, 150, 0);
func_8002F7DC(&this->actor, NA_SE_PL_BODY_HIT);
func_80832698(this, NA_SE_VO_LI_CLIMB_END);
@@ -11839,7 +11840,7 @@ void func_8084D3E4(Player* this, PlayState* play) {
this->actor.parent = NULL;
AREG(6) = 0;
- if (Flags_GetEventChkInf(EVENTCHKINF_18) || (DREG(1) != 0)) {
+ if (Flags_GetEventChkInf(EVENTCHKINF_EPONA_OBTAINED) || (DREG(1) != 0)) {
gSaveContext.horseData.pos.x = rideActor->actor.world.pos.x;
gSaveContext.horseData.pos.y = rideActor->actor.world.pos.y;
gSaveContext.horseData.pos.z = rideActor->actor.world.pos.z;
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
index f52760d2e0..9a05a353f4 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose.c
@@ -346,7 +346,7 @@ void FileSelect_RotateToMain(GameState* thisx) {
}
}
-static void (*gConfigModeUpdateFuncs[])(GameState*) = {
+static void (*sConfigModeUpdateFuncs[])(GameState*) = {
FileSelect_StartFadeIn, FileSelect_FinishFadeIn,
FileSelect_UpdateMainMenu, FileSelect_SetupCopySource,
FileSelect_SelectCopySource, FileSelect_SetupCopyDest1,
@@ -441,7 +441,7 @@ void FileSelect_PulsateCursor(GameState* thisx) {
void FileSelect_ConfigModeUpdate(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
- gConfigModeUpdateFuncs[this->configMode](&this->state);
+ sConfigModeUpdateFuncs[this->configMode](&this->state);
}
void FileSelect_SetWindowVtx(GameState* thisx) {
@@ -1517,7 +1517,7 @@ void FileSelect_LoadGame(GameState* thisx) {
}
}
-static void (*gSelectModeUpdateFuncs[])(GameState*) = {
+static void (*sSelectModeUpdateFuncs[])(GameState*) = {
FileSelect_FadeMainToSelect, FileSelect_MoveSelectedFileToTop, FileSelect_FadeInFileInfo, FileSelect_ConfirmFile,
FileSelect_FadeOutFileInfo, FileSelect_MoveSelectedFileToSlot, FileSelect_FadeOut, FileSelect_LoadGame,
};
@@ -1525,7 +1525,7 @@ static void (*gSelectModeUpdateFuncs[])(GameState*) = {
void FileSelect_SelectModeUpdate(GameState* thisx) {
FileSelectState* this = (FileSelectState*)thisx;
- gSelectModeUpdateFuncs[this->selectMode](&this->state);
+ sSelectModeUpdateFuncs[this->selectMode](&this->state);
}
void FileSelect_SelectModeDraw(GameState* thisx) {
@@ -1580,13 +1580,13 @@ void FileSelect_SelectModeDraw(GameState* thisx) {
CLOSE_DISPS(this->state.gfxCtx, "../z_file_choose.c", 2834);
}
-static void (*gFileSelectDrawFuncs[])(GameState*) = {
+static void (*sFileSelectDrawFuncs[])(GameState*) = {
FileSelect_InitModeDraw,
FileSelect_ConfigModeDraw,
FileSelect_SelectModeDraw,
};
-static void (*gFileSelectUpdateFuncs[])(GameState*) = {
+static void (*sFileSelectUpdateFuncs[])(GameState*) = {
FileSelect_InitModeUpdate,
FileSelect_ConfigModeUpdate,
FileSelect_SelectModeUpdate,
@@ -1673,8 +1673,8 @@ void FileSelect_Main(GameState* thisx) {
this->emptyFileTextAlpha = 0;
FileSelect_PulsateCursor(&this->state);
- gFileSelectUpdateFuncs[this->menuMode](&this->state);
- gFileSelectDrawFuncs[this->menuMode](&this->state);
+ sFileSelectUpdateFuncs[this->menuMode](&this->state);
+ sFileSelectDrawFuncs[this->menuMode](&this->state);
// do not draw controls text in the options menu
if ((this->configMode <= CM_NAME_ENTRY_TO_MAIN) || (this->configMode >= CM_UNUSED_DELAY)) {
diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c
index e951eddf70..36f385a2ec 100644
--- a/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c
+++ b/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c
@@ -734,7 +734,7 @@ typedef struct {
/* 0x12 */ u16 height;
} OptionsMenuTextureInfo; // size = 0x14
-static OptionsMenuTextureInfo gOptionsMenuHeaders[] = {
+static OptionsMenuTextureInfo sOptionsMenuHeaders[] = {
{
{ gFileSelOptionsENGTex, gFileSelOptionsGERTex, gFileSelOptionsENGTex },
{ 128, 128, 128 },
@@ -757,7 +757,7 @@ static OptionsMenuTextureInfo gOptionsMenuHeaders[] = {
},
};
-static OptionsMenuTextureInfo gOptionsMenuSettings[] = {
+static OptionsMenuTextureInfo sOptionsMenuSettings[] = {
{
{ gFileSelStereoENGTex, gFileSelStereoENGTex, gFileSelStereoFRATex },
{ 48, 48, 48 },
@@ -890,9 +890,9 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
for (i = 0, vtx = 0; i < 4; i++, vtx += 4) {
- gDPLoadTextureBlock(POLY_OPA_DISP++, gOptionsMenuHeaders[i].texture[gSaveContext.language], G_IM_FMT_IA,
- G_IM_SIZ_8b, gOptionsMenuHeaders[i].width[gSaveContext.language],
- gOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
+ gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuHeaders[i].texture[gSaveContext.language], G_IM_FMT_IA,
+ G_IM_SIZ_8b, sOptionsMenuHeaders[i].width[gSaveContext.language],
+ sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
@@ -919,9 +919,9 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
- gDPLoadTextureBlock(POLY_OPA_DISP++, gOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
- G_IM_SIZ_8b, gOptionsMenuSettings[i].width[gSaveContext.language],
- gOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
+ gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
+ G_IM_SIZ_8b, sOptionsMenuSettings[i].width[gSaveContext.language],
+ sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
@@ -943,9 +943,9 @@ void FileSelect_DrawOptionsImpl(GameState* thisx) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 255);
}
- gDPLoadTextureBlock(POLY_OPA_DISP++, gOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
- G_IM_SIZ_8b, gOptionsMenuSettings[i].width[gSaveContext.language],
- gOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
+ gDPLoadTextureBlock(POLY_OPA_DISP++, sOptionsMenuSettings[i].texture[gSaveContext.language], G_IM_FMT_IA,
+ G_IM_SIZ_8b, sOptionsMenuSettings[i].width[gSaveContext.language],
+ sOptionsMenuHeaders[i].height, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,
G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
gSP1Quadrangle(POLY_OPA_DISP++, vtx, vtx + 2, vtx + 3, vtx + 1, 0);
}
diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
index aa92e4a1fc..7abc6b0a56 100644
--- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
+++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c
@@ -3442,11 +3442,11 @@ void KaleidoScope_Update(PlayState* play) {
pauseCtx->worldMapPoints[4] = 1;
}
- if (GET_EVENTCHKINF(EVENTCHKINF_6A)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_TALON_WOKEN_IN_KAKARIKO)) {
pauseCtx->worldMapPoints[4] = 2;
}
- if (GET_EVENTCHKINF(EVENTCHKINF_18)) {
+ if (GET_EVENTCHKINF(EVENTCHKINF_EPONA_OBTAINED)) {
pauseCtx->worldMapPoints[4] = 1;
}
diff --git a/tools/regconvert.py b/tools/regconvert.py
index 747b6a8473..21f376220a 100755
--- a/tools/regconvert.py
+++ b/tools/regconvert.py
@@ -29,7 +29,7 @@ def read_file(filename):
file_contents = src_file.read()
src_file.close()
- pattern = re.compile("gGameInfo->data\[((0[xX])?[0-9a-fA-F]+)\]")
+ pattern = re.compile("gRegEditor->data\[((0[xX])?[0-9a-fA-F]+)\]")
match = pattern.search(file_contents)
while match:
@@ -57,19 +57,19 @@ def check_valid_offset(offset):
return 0x14 <= offset <= 0x15D2
def main():
- parser = argparse.ArgumentParser(description="Converts a gGameInfo->data index to a REG macro.")
+ parser = argparse.ArgumentParser(description="Converts a gRegEditor->data index to a REG macro.")
# TODO: Add a description and a better title
# index_group = parser.add_argument_group(title="index", description="")
index_group = parser.add_argument_group()
- index_group.add_argument("index", help="index of gGameInfo->data in decimal (or hexadecimal if starts with 0x)")
- index_group.add_argument("--offset", help="treat index argument as an offset to gGameInfo instead", action="store_true")
+ index_group.add_argument("index", help="index of gRegEditor->data in decimal (or hexadecimal if starts with 0x)")
+ index_group.add_argument("--offset", help="treat index argument as an offset to gRegEditor instead", action="store_true")
index_group.add_argument("--hex", help="treat index argument as hexadecimal, even without the 0x", action="store_true")
# TODO: Add a description and a better title
# file_group = parser.add_argument_group(title="file", description="")
file_group = parser.add_argument_group()
- file_group.add_argument("--file", help="use the parameter as a filepath, then replace every occurrence of `gGameInfo->data[number]` in that file a REG macro", action="store_true")
+ file_group.add_argument("--file", help="use the parameter as a filepath, then replace every occurrence of `gRegEditor->data[number]` in that file a REG macro", action="store_true")
file_group.add_argument("--stdout", help="print the processed file to stdout instead of overwriting the original", action="store_true")
args = parser.parse_args()