Camera Functions

This commit is contained in:
Derek Hensley
2022-10-05 19:16:14 -07:00
parent 56600ee4fc
commit 6cb774232d
7 changed files with 42 additions and 42 deletions
+3 -3
View File
@@ -2458,12 +2458,12 @@ Gfx* Play_SetFog(PlayState* this, Gfx* gfx);
void Play_Destroy(GameState* thisx);
// void func_801663C4(void);
// void func_80166644(void);
// void func_801668B4(void);
void func_80166968(PlayState* this, Camera* camera);
// void Play_GetWaterSurface(void);
void Play_UpdateWaterCamera(PlayState* this, Camera* camera);
void Play_UpdateTransition(PlayState* this);
void Play_Update(PlayState* this);
void Play_SetupUpdate(PlayState* this);
// void Play_DrawOverlayElements(void);
// void Play_PostWorldDraw(void);
void Play_Draw(PlayState* this);
void Play_SetupDraw(PlayState* this);
void Play_Main(GameState* thisx);
+1 -1
View File
@@ -426,7 +426,7 @@ typedef struct struct_80122744_arg1 {
#define PLAYER_STATE3_2000 (1 << 13)
//
#define PLAYER_STATE3_4000 (1 << 14)
//
// Swimming Zora
#define PLAYER_STATE3_8000 (1 << 15)
//
#define PLAYER_STATE3_10000 (1 << 16)
+3 -3
View File
@@ -47,9 +47,9 @@ 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_NON_ZORA_SWIMMING (1 << 2)
#define DISTORTION_TYPE_ZORA_SWIMMING (1 << 3)
#define DISTORTION_TYPE_UNDERWATER_ENTRY (1 << 4)
#define DISTORTION_TYPE_5 (1 << 5)
#define DISTORTION_TYPE_6 (1 << 6)
#define DISTORTION_TYPE_7 (1 << 7)
+26 -26
View File
@@ -516,45 +516,45 @@ void func_80166644(u8* srcI5, s8* destI8, size_t size) {
}
}
f32 func_801668B4(PlayState* this, Vec3f* arg1, s32* arg2) {
f32 Play_GetWaterSurface(PlayState* this, Vec3f* pos, s32* lightIndex) {
Player* player = GET_PLAYER(this);
f32 sp38 = player->actor.world.pos.y;
f32 waterSurfaceY = player->actor.world.pos.y;
WaterBox* waterBox;
s32 bgId;
if (!WaterBox_GetSurfaceImpl(this, &this->colCtx, arg1->x, arg1->z, &sp38, &waterBox, &bgId)) {
if (!WaterBox_GetSurfaceImpl(this, &this->colCtx, pos->x, pos->z, &waterSurfaceY, &waterBox, &bgId)) {
return BGCHECK_Y_MIN;
}
if (sp38 < arg1->y) {
if (waterSurfaceY < pos->y) {
return BGCHECK_Y_MIN;
}
*arg2 = WaterBox_GetLightSettingIndex(&this->colCtx, waterBox);
return sp38;
*lightIndex = WaterBox_GetLightSettingIndex(&this->colCtx, waterBox);
return waterSurfaceY;
}
void func_80166968(PlayState* this, Camera* camera) {
void Play_UpdateWaterCamera(PlayState* this, Camera* camera) {
static s16 sQuakeIndex = -1;
static s16 sIsCameraUnderwater = false;
s32 pad;
s32 sp28;
s32 lightIndex;
Player* player = GET_PLAYER(this);
sIsCameraUnderwater = camera->stateFlags & CAM_STATE_UNDERWATER;
if (func_801668B4(this, &camera->eye, &sp28) != BGCHECK_Y_MIN) {
if (Play_GetWaterSurface(this, &camera->eye, &lightIndex) != BGCHECK_Y_MIN) {
if (!sIsCameraUnderwater) {
Camera_SetFlags(camera, CAM_STATE_UNDERWATER);
sQuakeIndex = -1;
Distortion_SetType(0x10);
Distortion_SetType(DISTORTION_TYPE_UNDERWATER_ENTRY);
Distortion_SetCountdown(80);
}
func_801A3EC0(0x20);
func_800F6834(this, sp28);
func_800F6834(this, lightIndex);
if ((sQuakeIndex == -1) || (Quake_GetCountdown(sQuakeIndex) == 0xA)) {
s16 quakeIndex = Quake_Add(camera, 5);
if ((sQuakeIndex == -1) || (Quake_GetCountdown(sQuakeIndex) == 10)) {
s16 quakeIndex = Quake_Add(camera, QUAKE_TYPE_5);
sQuakeIndex = quakeIndex;
if (quakeIndex != 0) {
@@ -564,19 +564,19 @@ void func_80166968(PlayState* this, Camera* camera) {
}
}
if (player->stateFlags3 & PLAYER_STATE3_8000) {
Distortion_SetType(8);
Distortion_ClearType(4);
Distortion_SetType(DISTORTION_TYPE_ZORA_SWIMMING);
Distortion_ClearType(DISTORTION_TYPE_NON_ZORA_SWIMMING);
} else {
Distortion_SetType(4);
Distortion_ClearType(8);
Distortion_SetType(DISTORTION_TYPE_NON_ZORA_SWIMMING);
Distortion_ClearType(DISTORTION_TYPE_ZORA_SWIMMING);
}
} else {
if (sIsCameraUnderwater) {
Camera_ClearFlags(camera, CAM_STATE_UNDERWATER);
}
Distortion_ClearType(4);
Distortion_ClearType(0x10);
Distortion_ClearType(8);
Distortion_ClearType(DISTORTION_TYPE_NON_ZORA_SWIMMING);
Distortion_ClearType(DISTORTION_TYPE_UNDERWATER_ENTRY);
Distortion_ClearType(DISTORTION_TYPE_ZORA_SWIMMING);
if (sQuakeIndex != 0) {
Quake_Remove(sQuakeIndex);
}
@@ -1050,7 +1050,7 @@ void Play_Update(PlayState* this) {
}
if (!sp5C) {
func_80166968(this, this->cameraPtrs[this->nextCamera]);
Play_UpdateWaterCamera(this, this->cameraPtrs[this->nextCamera]);
Distortion_Update();
}
@@ -1097,7 +1097,7 @@ void Play_SetupUpdate(PlayState* this) {
}
}
void Play_DrawOverlayElements(PlayState* this) {
void Play_PostWorldDraw(PlayState* this) {
if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) {
KaleidoScopeCall_Draw(this);
}
@@ -1262,7 +1262,7 @@ void Play_Draw(PlayState* this) {
TransitionUnk_Draw(&sTrnsnUnk, &sp90);
POLY_OPA_DISP = sp90;
sp25B = true;
goto Play_Draw_DrawOverlayElements;
goto Play_Draw_PostWorldDraw;
}
PreRender_SetValues(&this->pauseBgPreRender, D_801FBBCC, D_801FBBCE, gfxCtx->curFrameBuffer, gfxCtx->zbuffer);
@@ -1287,7 +1287,7 @@ void Play_Draw(PlayState* this) {
gSPDisplayList(sp8C++, D_0E000000.syncSegments);
POLY_OPA_DISP = sp8C;
sp25B = true;
goto Play_Draw_DrawOverlayElements;
goto Play_Draw_PostWorldDraw;
}
if (!this->unk_18844) {
@@ -1411,8 +1411,8 @@ void Play_Draw(PlayState* this) {
this->unk_18B49 = 2;
SREG(33) |= 1;
} else {
Play_Draw_DrawOverlayElements:
Play_DrawOverlayElements(this);
Play_Draw_PostWorldDraw:
Play_PostWorldDraw(this);
}
}
+3 -3
View File
@@ -668,7 +668,7 @@ void Distortion_Update(void) {
zScaleFactor = 1.0f;
xyScaleFactor = 1.0f;
speedScaleFactor = 1.0f;
} else if (sDistortionRequest.type & DISTORTION_TYPE_4) {
} else if (sDistortionRequest.type & DISTORTION_TYPE_UNDERWATER_ENTRY) {
if (sDistortionRequest.state == DISTORTION_SETUP) {
countdownMax = sDistortionRequest.countdown;
depthPhase = 0x760;
@@ -690,7 +690,7 @@ void Distortion_Update(void) {
countdownRatio = sDistortionRequest.countdown / (f32)countdownMax;
zScaleFactor = xyScaleFactor = countdownRatio;
speedScaleFactor = 1.0f;
} else if (sDistortionRequest.type & DISTORTION_TYPE_3) {
} else if (sDistortionRequest.type & DISTORTION_TYPE_ZORA_SWIMMING) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
@@ -745,7 +745,7 @@ void Distortion_Update(void) {
}
zScaleFactor = -xyScaleFactor;
speedScaleFactor = 1.0f;
} else if (sDistortionRequest.type & DISTORTION_TYPE_2) {
} else if (sDistortionRequest.type & DISTORTION_TYPE_NON_ZORA_SWIMMING) {
depthPhase = 0x3F0;
screenPlanePhase = 0x156;
+3 -3
View File
@@ -2989,12 +2989,12 @@
0x8016613C:("Play_Destroy",),
0x801663C4:("func_801663C4",),
0x80166644:("func_80166644",),
0x801668B4:("func_801668B4",),
0x80166968:("func_80166968",),
0x801668B4:("Play_GetWaterSurface",),
0x80166968:("Play_UpdateWaterCamera",),
0x80166B30:("Play_UpdateTransition",),
0x80167814:("Play_Update",),
0x80167DE4:("Play_SetupUpdate",),
0x80167F0C:("Play_DrawOverlayElements",),
0x80167F0C:("Play_PostWorldDraw",),
0x80168090:("Play_Draw",),
0x80168DAC:("Play_SetupDraw",),
0x80168F64:("Play_Main",),
+3 -3
View File
@@ -2503,12 +2503,12 @@ asm/non_matchings/code/z_play/Play_SetFog.s,Play_SetFog,0x801660B8,0x21
asm/non_matchings/code/z_play/Play_Destroy.s,Play_Destroy,0x8016613C,0xA2
asm/non_matchings/code/z_play/func_801663C4.s,func_801663C4,0x801663C4,0xA0
asm/non_matchings/code/z_play/func_80166644.s,func_80166644,0x80166644,0x9C
asm/non_matchings/code/z_play/func_801668B4.s,func_801668B4,0x801668B4,0x2D
asm/non_matchings/code/z_play/func_80166968.s,func_80166968,0x80166968,0x72
asm/non_matchings/code/z_play/Play_GetWaterSurface.s,Play_GetWaterSurface,0x801668B4,0x2D
asm/non_matchings/code/z_play/Play_UpdateWaterCamera.s,Play_UpdateWaterCamera,0x80166968,0x72
asm/non_matchings/code/z_play/Play_UpdateTransition.s,Play_UpdateTransition,0x80166B30,0x339
asm/non_matchings/code/z_play/Play_Update.s,Play_Update,0x80167814,0x174
asm/non_matchings/code/z_play/Play_SetupUpdate.s,Play_SetupUpdate,0x80167DE4,0x4A
asm/non_matchings/code/z_play/Play_DrawOverlayElements.s,Play_DrawOverlayElements,0x80167F0C,0x61
asm/non_matchings/code/z_play/Play_PostWorldDraw.s,Play_PostWorldDraw,0x80167F0C,0x61
asm/non_matchings/code/z_play/Play_Draw.s,Play_Draw,0x80168090,0x347
asm/non_matchings/code/z_play/Play_SetupDraw.s,Play_SetupDraw,0x80168DAC,0x6E
asm/non_matchings/code/z_play/Play_Main.s,Play_Main,0x80168F64,0x5A
1 asm/non_matchings/code/z_en_a_keep/EnAObj_Init.s EnAObj_Init 0x800A5AC0 0x2B
2503 asm/non_matchings/code/z_play/Play_Destroy.s Play_Destroy 0x8016613C 0xA2
2504 asm/non_matchings/code/z_play/func_801663C4.s func_801663C4 0x801663C4 0xA0
2505 asm/non_matchings/code/z_play/func_80166644.s func_80166644 0x80166644 0x9C
2506 asm/non_matchings/code/z_play/func_801668B4.s asm/non_matchings/code/z_play/Play_GetWaterSurface.s func_801668B4 Play_GetWaterSurface 0x801668B4 0x2D
2507 asm/non_matchings/code/z_play/func_80166968.s asm/non_matchings/code/z_play/Play_UpdateWaterCamera.s func_80166968 Play_UpdateWaterCamera 0x80166968 0x72
2508 asm/non_matchings/code/z_play/Play_UpdateTransition.s Play_UpdateTransition 0x80166B30 0x339
2509 asm/non_matchings/code/z_play/Play_Update.s Play_Update 0x80167814 0x174
2510 asm/non_matchings/code/z_play/Play_SetupUpdate.s Play_SetupUpdate 0x80167DE4 0x4A
2511 asm/non_matchings/code/z_play/Play_DrawOverlayElements.s asm/non_matchings/code/z_play/Play_PostWorldDraw.s Play_DrawOverlayElements Play_PostWorldDraw 0x80167F0C 0x61
2512 asm/non_matchings/code/z_play/Play_Draw.s Play_Draw 0x80168090 0x347
2513 asm/non_matchings/code/z_play/Play_SetupDraw.s Play_SetupDraw 0x80168DAC 0x6E
2514 asm/non_matchings/code/z_play/Play_Main.s Play_Main 0x80168F64 0x5A