Quake & Distortion Cleanup (#1102)

* quake cleanup

* cleanup

* more cleanup

* remove cast

* q comes before r...

* unname goron function, leave it to another PR

* PR Suggestions
This commit is contained in:
engineer124
2022-09-30 22:01:39 -04:00
committed by GitHub
parent b080fb3700
commit ab5fd663cc
40 changed files with 496 additions and 389 deletions
+3 -34
View File
@@ -745,8 +745,8 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16
s32 Actor_IsTargeted(PlayState* play, Actor* actor);
s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor);
void func_800BC620(Vec3f* arg0, Vec3f* arg1, u8 alpha, PlayState* play);
void func_800BC770(PlayState* play, s16 y, s16 countdown);
void func_800BC7D8(PlayState* play, s16 y, s16 countdown, s16 speed);
void Actor_AddQuake(PlayState* play, s16 verticalMag, s16 countdown);
void Actor_AddQuakeWithSpeed(PlayState* play, s16 verticalMag, s16 countdown, s16 speed);
void func_800BC848(Actor* actor, PlayState* play, s16 y, s16 countdown);
void Actor_DrawDoorLock(PlayState* play, s32 frame, s32 type);
void Actor_SetColorFilter(Actor* actor, u16 colorFlag, u16 colorIntensityMax, u16 xluFlag, u16 duration);
@@ -923,7 +923,7 @@ u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId)
u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsIgnoredByEntities(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsIgnoredByProjectiles(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_GetConveyorType(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 SurfaceType_IsFloorConveyor(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
s32 func_800C9DDC(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetConveyorSpeed(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
u32 SurfaceType_GetConveyorDirection(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId);
@@ -1958,37 +1958,6 @@ s32 func_80128640(PlayState* play, Player* player, Gfx* dlist);
void func_80128B74(PlayState* play, Player* player, s32 limbIndex);
void func_80128BD0(PlayState* play, s32 limbIndex, Gfx** dList1, Gfx** dList2, Vec3s* rot, Actor* actor);
f32 Quake_Random(void);
void Quake_UpdateShakeInfo(QuakeRequest* req, ShakeInfo* shake, f32 verticalPertubation, f32 horizontalPertubation);
s16 Quake_Callback1(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback5(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback6(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback3(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback2(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_Callback4(QuakeRequest* req, ShakeInfo* shake);
s16 Quake_GetFreeIndex(void);
QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx);
void Quake_Remove(QuakeRequest* req);
QuakeRequest* Quake_GetRequest(s16 idx);
u32 Quake_SetValue(s16 idx, s16 valueType, s16 value);
u32 Quake_SetSpeed(s16 idx, s16 value);
u32 Quake_SetCountdown(s16 idx, s16 value);
s16 Quake_GetCountdown(s16 idx);
u32 Quake_SetQuakeValues(s16 idx, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset);
u32 Quake_SetQuakeValues2(s16 idx, s16 isShakePerpendicular, Vec3s shakePlaneOffset);
void Quake_Init(void);
s16 Quake_Add(Camera* camera, u32 callbackIdx);
u32 Quake_RemoveFromIdx(s16 idx);
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData);
void Distortion_Init(PlayState* play);
void Distortion_SetCountdown(s16 countdown);
s16 Distortion_GetCountdown(void);
s16 Distortion_GetType(void);
void Distortion_SetType(s32 type);
void Distortion_ClearType(s32 type);
s32 Distortion_GetUnderwaterCurrentSpeed(Player* player);
void Distortion_Update(void);
s32 Quake_NumActiveQuakes(void);
Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f);
Gfx* Gfx_SetFogWithSync(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f);
Gfx* Gfx_SetFog2(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f);
-57
View File
@@ -896,63 +896,6 @@ typedef s32 (*ColChkLineFunc)(PlayState*, CollisionCheckContext*, Collider*, Vec
typedef void(*room_draw_func)(PlayState* play, Room* room, u32 flags);
typedef struct {
/* 0x00 */ Vec3f atOffset;
/* 0x0C */ Vec3f eyeOffset;
/* 0x18 */ s16 rollOffset;
/* 0x1A */ s16 zoom;
} ShakeInfo; // size = 0x1C
typedef struct {
/* 0x00 */ s16 randIdx;
/* 0x02 */ s16 countdownMax;
/* 0x04 */ Camera* camera;
/* 0x08 */ u32 callbackIdx;
/* 0x0C */ s16 verticalMag;
/* 0x0E */ s16 horizontalMag;
/* 0x10 */ s16 zoom;
/* 0x12 */ s16 rollOffset;
/* 0x14 */ Vec3s shakePlaneOffset; // angle deviations from shaking in the perpendicular plane
/* 0x1A */ s16 speed;
/* 0x1C */ s16 isShakePerpendicular;
/* 0x1E */ s16 countdown;
/* 0x20 */ s16 camId;
} QuakeRequest; // size = 0x24
typedef struct {
/* 0x00 */ Vec3f atOffset;
/* 0x0C */ Vec3f eyeOffset;
/* 0x18 */ s16 rollOffset;
/* 0x1A */ s16 zoom;
/* 0x1C */ f32 max; // Set to scaled max data of struct (mag for Vec3f), never used
} QuakeCamCalc; // size = 0x20
typedef s16 (*QuakeCallbackFunc)(QuakeRequest*, ShakeInfo*);
#define QUAKE_SPEED (1 << 0)
#define QUAKE_VERTICAL_MAG (1 << 1)
#define QUAKE_HORIZONTAL_MAG (1 << 2)
#define QUAKE_ZOOM (1 << 3)
#define QUAKE_ROLL_OFFSET (1 << 4)
#define QUAKE_SHAKE_PLANE_OFFSET_X (1 << 5)
#define QUAKE_SHAKE_PLANE_OFFSET_Y (1 << 6)
#define QUAKE_SHAKE_PLANE_OFFSET_Z (1 << 7)
#define QUAKE_COUNTDOWN (1 << 8)
#define QUAKE_IS_SHAKE_PERPENDICULAR (1 << 9)
typedef struct {
/* 0x0 */ PlayState* play;
/* 0x4 */ s32 type; // bitfield, highest set bit determines type
/* 0x8 */ s16 countdown;
/* 0xA */ s16 state;
} DistortionContext; // size = 0xC
typedef enum {
/* 0 */ DISTORTION_INACTIVE,
/* 1 */ DISTORTION_ACTIVE,
/* 2 */ DISTORTION_SETUP
} DistortionState;
typedef struct {
/* 0x000 */ u8 controllers; // bit 0 is set if controller 1 is plugged in, etc.
/* 0x001 */ UNK_TYPE1 pad1[0x13];
-5
View File
@@ -56,11 +56,6 @@ struct DynaPolyActor;
// CollisionContext flags
#define BGCHECK_FLAG_REVERSE_CONVEYOR_FLOW 1
typedef enum {
/* 0 */ CONVEYOR_WATER,
/* 1 */ CONVEYOR_FLOOR
} ConveyorType;
typedef struct {
/* 0x0 */ Vec3s pos;
} BgVertex; // size = 0x6
+69
View File
@@ -0,0 +1,69 @@
#ifndef Z64QUAKE_H
#define Z64QUAKE_H
#include "z64math.h"
struct PlayState;
struct Camera;
typedef struct {
/* 0x00 */ Vec3f atOffset;
/* 0x0C */ Vec3f eyeOffset;
/* 0x18 */ s16 rollOffset;
/* 0x1A */ s16 zoom;
/* 0x1C */ f32 max; // Set to scaled max data of struct (mag for Vec3f), never used
} QuakeCamCalc; // size = 0x20
#define QUAKE_SPEED (1 << 0)
#define QUAKE_VERTICAL_MAG (1 << 1)
#define QUAKE_HORIZONTAL_MAG (1 << 2)
#define QUAKE_ZOOM (1 << 3)
#define QUAKE_ROLL_OFFSET (1 << 4)
#define QUAKE_SHAKE_PLANE_OFFSET_X (1 << 5)
#define QUAKE_SHAKE_PLANE_OFFSET_Y (1 << 6)
#define QUAKE_SHAKE_PLANE_OFFSET_Z (1 << 7)
#define QUAKE_COUNTDOWN (1 << 8)
#define QUAKE_IS_SHAKE_PERPENDICULAR (1 << 9)
typedef enum {
/* 1 */ QUAKE_TYPE_1 = 1,
/* 2 */ QUAKE_TYPE_2,
/* 3 */ QUAKE_TYPE_3,
/* 4 */ QUAKE_TYPE_4,
/* 5 */ QUAKE_TYPE_5,
/* 6 */ QUAKE_TYPE_6
} QuakeType;
u32 Quake_SetValue(s16 quakeIndex, s16 valueType, s16 value);
u32 Quake_SetSpeed(s16 quakeIndex, s16 speed);
u32 Quake_SetCountdown(s16 quakeIndex, s16 countdown);
s16 Quake_GetCountdown(s16 quakeIndex);
u32 Quake_SetQuakeValues(s16 quakeIndex, s16 verticalMag, s16 horizontalMag, s16 zoom, s16 rollOffset);
u32 Quake_SetQuakeValues2(s16 quakeIndex, s16 isShakePerpendicular, Vec3s shakePlaneOffset);
s16 Quake_Add(Camera* camera, u32 type);
s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData);
u32 Quake_Remove(s16 quakeIndex);
s32 Quake_NumActiveQuakes(void);
void Quake_Init(void);
#define DISTORTION_TYPE_0 (1 << 0)
#define DISTORTION_TYPE_2 (1 << 2)
#define DISTORTION_TYPE_3 (1 << 3)
#define DISTORTION_TYPE_4 (1 << 4)
#define DISTORTION_TYPE_5 (1 << 5)
#define DISTORTION_TYPE_6 (1 << 6)
#define DISTORTION_TYPE_7 (1 << 7)
#define DISTORTION_TYPE_8 (1 << 8)
#define DISTORTION_TYPE_9 (1 << 9)
#define DISTORTION_TYPE_A (1 << 10)
#define DISTORTION_TYPE_B (1 << 11)
void Distortion_SetCountdown(s16 countdown);
s16 Distortion_GetCountdown(void);
s16 Distortion_GetType(void);
void Distortion_SetType(s32 type);
void Distortion_ClearType(s32 type);
void Distortion_Init(PlayState* play);
void Distortion_Update(void);
#endif