diff --git a/include/functions.h b/include/functions.h index 41f3308ebb..c79fc333f5 100644 --- a/include/functions.h +++ b/include/functions.h @@ -2261,35 +2261,6 @@ void SkinMatrix_SetYRotation(MtxF* mf, s16 a); void SkinMatrix_MulYRotation(MtxF* mf, s16 a); void SkinMatrix_SetZRotation(MtxF* mf, s16 a); -void View_ViewportToVp(Vp* dest, Viewport* src); -void View_Init(View* view, GraphicsContext* gfxCtx); -void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); -void func_8013F050(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); -void View_SetScale(View* view, f32 scale); -void View_GetScale(View* view, f32* scale); -void func_8013F0D0(View* view, f32 fovy, f32 zNear, f32 zFar); -void func_8013F100(View* view, f32* fovy, f32* zNear, f32* zFar); -void func_8013F120(View* view, f32 fovy, f32 zNear, f32 zFar); -void func_8013F15C(View* view, f32* fovy, f32* zNear, f32* zFar); -void View_SetViewport(View* view, Viewport* viewport); -void View_GetViewport(View* view, Viewport* viewport); -void View_WriteScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry); -void View_SyncAndWriteScissor(View* view, Gfx** gfx); -void View_SetScissorForLetterbox(View* view); -s32 View_SetDistortionDirRot(View* view, f32 dirRotX, f32 dirRotY, f32 dirRotZ); -s32 View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ); -s32 View_SetDistortionSpeed(View* view, f32 speed); -s32 View_InitDistortion(View* view); -s32 View_ClearDistortion(View* view); -s32 View_SetDistortion(View* view, Vec3f dirRot, Vec3f scale, f32 speed); -s32 View_StepDistortion(View* view, Mtx* projectionMtx); -void View_RenderView(View* view, s32 uParm2); -s32 View_RenderToPerspectiveMatrix(View* view); -s32 View_RenderToOrthographicMatrix(View* view); -s32 func_8013FBC8(View* view); -s32 func_8013FD74(View* view); -s32 func_80140024(View* view); -s32 func_801400CC(View* view, Gfx** gfxp); void func_80140260(OSViMode* vimode); // void func_8014026C(OSViMode* param_1, UNK_TYPE1 param_2, s32 param_3, s32 param_4, s32 param_5, s32 param_6, s32 param_7, s32 param_8, UNK_TYPE4 param_9, s32 param_10, s16 param_11, u32 param_12, UNK_TYPE4 param_13); // void func_80140730(void); @@ -2399,18 +2370,6 @@ void Message_FindCreditsMessage(PlayState* play, u16 textId); void func_8015E7EC(PlayState* play, UNK_PTR puParm2); // void func_8015F8A8(UNK_TYPE4 ctxt); -void ShrinkWindow_SetLetterboxTarget(s32 target); -s32 ShrinkWindow_GetLetterboxTarget(void); -void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude); -s32 ShrinkWindow_GetLetterboxMagnitude(void); -void ShrinkWindow_SetPillarboxTarget(s32 target); -s32 ShrinkWindow_GetPillarboxTarget(void); -void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude); -s32 ShrinkWindow_GetPillarboxMagnitude(void); -void ShrinkWindow_Init(void); -void ShrinkWindow_Destroy(void); -void ShrinkWindow_Update(s32 framerateDivisor); -void ShrinkWindow_Draw(GraphicsContext* gfxCtx); // void func_80161180(void); s32 func_8016119C(Camera* camera, DbCameraUnkStruct* arg1); // void func_8016122C(void); diff --git a/include/variables.h b/include/variables.h index c7ea263f2a..ae97a6c51e 100644 --- a/include/variables.h +++ b/include/variables.h @@ -3181,8 +3181,6 @@ extern s16 D_801F4E7A; // extern UNK_TYPE1 D_801F6B1E; // extern UNK_TYPE1 D_801F6B20; // extern UNK_TYPE1 D_801F6B22; -extern ShrinkWindowContext gShrinkWindowContext; -extern ShrinkWindowContext* gShrinkWindowContextPtr; // extern UNK_TYPE4 D_801F6B50; // extern UNK_TYPE1 D_801F6B58; extern void (*sKaleidoScopeUpdateFunc)(PlayState* play); diff --git a/include/z64.h b/include/z64.h index ceb91bfb80..d038790729 100644 --- a/include/z64.h +++ b/include/z64.h @@ -286,13 +286,6 @@ typedef struct { /* 0x10 */ OSTime resetTime; } NmiBuff; // size >= 0x18 -typedef struct { - /* 0x0 */ s8 letterboxTarget; - /* 0x1 */ s8 letterboxMagnitude; - /* 0x2 */ s8 pillarboxTarget; - /* 0x3 */ s8 pillarboxMagnitude; -} ShrinkWindowContext; // size = 0x4 - typedef void(*osCreateThread_func)(void*); typedef enum { diff --git a/include/z64shrink_window.h b/include/z64shrink_window.h new file mode 100644 index 0000000000..2742fb602e --- /dev/null +++ b/include/z64shrink_window.h @@ -0,0 +1,23 @@ +#ifndef Z64SHRINK_WINDOW_H +#define Z64SHRINK_WINDOW_H + +#include "PR/ultratypes.h" + +struct GraphicsContext; + +void ShrinkWindow_Letterbox_SetSizeTarget(s32 target); +s32 ShrinkWindow_Letterbox_GetSizeTarget(void); +void ShrinkWindow_Letterbox_SetSize(s32 size); +s32 ShrinkWindow_Letterbox_GetSize(void); + +void ShrinkWindow_Pillarbox_SetSizeTarget(s32 target); +s32 ShrinkWindow_Pillarbox_GetSizeTarget(void); +void ShrinkWindow_Pillarbox_SetSize(s32 size); +s32 ShrinkWindow_Pillarbox_GetSize(void); + +void ShrinkWindow_Init(void); +void ShrinkWindow_Destroy(void); +void ShrinkWindow_Update(s32 framerateDivisor); +void ShrinkWindow_Draw(GraphicsContext* gfxCtx); + +#endif diff --git a/include/z64view.h b/include/z64view.h index 98ca1ab19f..f0661d9471 100644 --- a/include/z64view.h +++ b/include/z64view.h @@ -33,16 +33,27 @@ typedef struct View { /* 0x0E0 */ Mtx unkE0; /* 0x120 */ Mtx* projectionPtr; /* 0x124 */ Mtx* viewingPtr; - /* 0x128 */ Vec3f distortionDirRot; + /* 0x128 */ Vec3f distortionOrientation; /* 0x134 */ Vec3f distortionScale; /* 0x140 */ f32 distortionSpeed; - /* 0x144 */ Vec3f curDistortionDirRot; + /* 0x144 */ Vec3f curDistortionOrientation; /* 0x150 */ Vec3f curDistortionScale; - /* 0x15C */ u16 normal; // used to normalize the projection matrix + /* 0x15C */ u16 perspNorm; // used to normalize the projection matrix /* 0x160 */ u32 flags; // bit 3: Render to an orthographic perspective /* 0x164 */ s32 unk164; } View; // size = 0x168 +#define VIEW_VIEWING (1 << 0) +#define VIEW_VIEWPORT (1 << 1) +#define VIEW_PROJECTION_PERSPECTIVE (1 << 2) +#define VIEW_PROJECTION_ORTHO (1 << 3) +#define VIEW_ALL (VIEW_VIEWING | VIEW_VIEWPORT | VIEW_PROJECTION_PERSPECTIVE | VIEW_PROJECTION_ORTHO) + +#define VIEW_FORCE_VIEWING (VIEW_VIEWING << 4) +#define VIEW_FORCE_VIEWPORT (VIEW_VIEWPORT << 4) +#define VIEW_FORCE_PROJECTION_PERSPECTIVE (VIEW_PROJECTION_PERSPECTIVE << 4) +#define VIEW_FORCE_PROJECTION_ORTHO (VIEW_PROJECTION_ORTHO << 4) + #define SET_FULLSCREEN_VIEWPORT(view) \ { \ Viewport viewport; \ @@ -54,4 +65,28 @@ typedef struct View { } \ (void)0 +void View_Init(View* view, struct GraphicsContext* gfxCtx); +void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up); +void View_SetScale(View* view, f32 scale); +void View_GetScale(View* view, f32* scale); +void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar); +void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar); +void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar); +void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar); +void View_SetViewport(View* view, Viewport* viewport); +void View_GetViewport(View* view, Viewport* viewport); + +s32 View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ); +s32 View_SetDistortionScale(View* view, f32 scaleX, f32 scaleY, f32 scaleZ); +s32 View_SetDistortionSpeed(View* view, f32 speed); +s32 View_InitDistortion(View* view); +s32 View_ClearDistortion(View* view); +s32 View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed); + +void View_Apply(View* view, s32 mask); +s32 View_ApplyOrthoToOverlay(View* view); +s32 View_ApplyPerspectiveToOverlay(View* view); +s32 View_UpdateViewingMatrix(View* view); +s32 View_ApplyTo(View* view, Gfx** gfxp); + #endif diff --git a/src/code/speed_meter.c b/src/code/speed_meter.c index 9f04de110c..5ad1cdbe0e 100644 --- a/src/code/speed_meter.c +++ b/src/code/speed_meter.c @@ -1,4 +1,5 @@ #include "global.h" +#include "z64view.h" #include "system_malloc.h" #pragma GLOBAL_ASM("asm/non_matchings/code/speed_meter/func_80177390.s") diff --git a/src/code/z_camera.c b/src/code/z_camera.c index c26947b218..da8a5f35aa 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -1,5 +1,7 @@ #include "global.h" #include "z64quake.h" +#include "z64shrink_window.h" +#include "z64view.h" /** * Returns the absolute value for floats diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 6c83e83915..1fa041be18 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1,6 +1,7 @@ #include "global.h" #include "z64quake.h" #include "z64rumble.h" +#include "z64shrink_window.h" #include "overlays/gamestates/ovl_daytelop/z_daytelop.h" void Cutscene_DoNothing(PlayState* play, CutsceneContext* csCtx); @@ -107,7 +108,7 @@ s32 func_800EA220(PlayState* play, CutsceneContext* csCtx, f32 target) { void func_800EA258(PlayState* play, CutsceneContext* csCtx) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); - ShrinkWindow_SetLetterboxTarget(32); + ShrinkWindow_Letterbox_SetSizeTarget(32); if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); csCtx->state++; @@ -117,7 +118,7 @@ void func_800EA258(PlayState* play, CutsceneContext* csCtx) { void func_800EA2B8(PlayState* play, CutsceneContext* csCtx) { func_800ED980(play, csCtx); Interface_SetHudVisibility(HUD_VISIBILITY_NONE); - ShrinkWindow_SetLetterboxTarget(32); + ShrinkWindow_Letterbox_SetSizeTarget(32); if (func_800EA220(play, csCtx, 1.0f)) { Audio_SetCutsceneFlag(true); csCtx->state++; @@ -1449,8 +1450,8 @@ void func_800EDA84(PlayState* play, CutsceneContext* csCtx) { if (gSaveContext.cutsceneTrigger == 0) { Interface_SetHudVisibility(HUD_VISIBILITY_NONE); - ShrinkWindow_SetLetterboxTarget(32); - ShrinkWindow_SetLetterboxMagnitude(0x20); + ShrinkWindow_Letterbox_SetSizeTarget(32); + ShrinkWindow_Letterbox_SetSize(32); csCtx->state++; } diff --git a/src/code/z_eventmgr.c b/src/code/z_eventmgr.c index 7128368aca..5b8b8dce37 100644 --- a/src/code/z_eventmgr.c +++ b/src/code/z_eventmgr.c @@ -1,4 +1,5 @@ #include "global.h" +#include "z64shrink_window.h" #pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F1460.s") diff --git a/src/code/z_game_over.c b/src/code/z_game_over.c index 776dc75d76..857250eecf 100644 --- a/src/code/z_game_over.c +++ b/src/code/z_game_over.c @@ -1,5 +1,6 @@ #include "global.h" #include "z64rumble.h" +#include "z64shrink_window.h" void GameOver_Init(PlayState* play) { play->gameOverCtx.state = GAMEOVER_INACTIVE; @@ -86,7 +87,7 @@ void GameOver_Update(PlayState* play) { gameOverCtx->state++; sGameOverTimer = 0; Kankyo_InitGameOverLights(play); - ShrinkWindow_SetLetterboxTarget(32); + ShrinkWindow_Letterbox_SetSizeTarget(32); break; case GAMEOVER_REVIVE_RUMBLE: sGameOverTimer = 50; diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index d7905e4dd7..9cea42691e 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,5 +1,6 @@ #include "prevent_bss_reordering.h" #include "global.h" +#include "z64shrink_window.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" void (*sKaleidoScopeUpdateFunc)(PlayState* play); @@ -36,7 +37,7 @@ void KaleidoScopeCall_Update(PlayState* play) { if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugEditor != DEBUG_EDITOR_NONE)) { if (pauseCtx->state == 1 || pauseCtx->state == 19) { - if (ShrinkWindow_GetLetterboxMagnitude() == 0) { + if (ShrinkWindow_Letterbox_GetSize() == 0) { R_PAUSE_MENU_MODE = 1; pauseCtx->unk_200 = 0; pauseCtx->unk_208 = 0; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 1135f2de97..0109dc4ab6 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -1,5 +1,7 @@ #include "global.h" #include "z64rumble.h" +#include "z64shrink_window.h" +#include "z64view.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" s16 D_801BDB00[] = { PAUSE_MAP, PAUSE_QUEST, PAUSE_MASK, PAUSE_ITEM }; @@ -91,8 +93,8 @@ void KaleidoSetup_Update(PlayState* play) { if (pauseCtx->state == 1) { Game_SetFramerateDivisor(&play->state, 2); - if (ShrinkWindow_GetLetterboxTarget() != 0) { - ShrinkWindow_SetLetterboxTarget(0); + if (ShrinkWindow_Letterbox_GetSizeTarget() != 0) { + ShrinkWindow_Letterbox_SetSizeTarget(0); } func_801A3AEC(1); } diff --git a/src/code/z_message.c b/src/code/z_message.c index cb00d8cd2e..94f1e59925 100644 --- a/src/code/z_message.c +++ b/src/code/z_message.c @@ -1,4 +1,6 @@ #include "global.h" +#include "z64shrink_window.h" +#include "z64view.h" #include "message_data_static.h" #include "overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope.h" @@ -489,7 +491,7 @@ u8 Message_GetState(MessageContext* msgCtx) { void func_80152C64(View* view) { SET_FULLSCREEN_VIEWPORT(view); - func_8013FBC8(view); + View_ApplyOrthoToOverlay(view); } #pragma GLOBAL_ASM("asm/non_matchings/code/z_message/func_80152CAC.s") diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 3a2da402c7..4620dd8169 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -1,5 +1,5 @@ #include "global.h" - +#include "z64view.h" #include "interface/parameter_static/parameter_static.h" #include "interface/do_action_static/do_action_static.h" #include "misc/story_static/story_static.h" diff --git a/src/code/z_play.c b/src/code/z_play.c index 06ec9c21e9..47bb97a604 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -1,5 +1,7 @@ #include "global.h" #include "z64quake.h" +#include "z64shrink_window.h" +#include "z64view.h" #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80165460.s") diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 2b66a39f8a..964935ea1f 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -1,5 +1,6 @@ #include "global.h" #include "z64quake.h" +#include "z64view.h" typedef struct { /* 0x00 */ s16 randIndex; @@ -823,10 +824,10 @@ void Distortion_Update(void) { depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep); screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep); - View_SetDistortionDirRot(&sDistortionRequest.play->view, - Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor), - Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor), - Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor)); + View_SetDistortionOrientation(&sDistortionRequest.play->view, + Math_CosS(depthPhase) * (DEGF_TO_RADF(rotX) * xyScaleFactor), + Math_SinS(depthPhase) * (DEGF_TO_RADF(rotY) * xyScaleFactor), + Math_SinS(screenPlanePhase) * (DEGF_TO_RADF(rotZ) * zScaleFactor)); View_SetDistortionScale(&sDistortionRequest.play->view, (Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f, (Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f, diff --git a/src/code/z_shrink_window.c b/src/code/z_shrink_window.c index 5bfca86d92..acbdb5c5bc 100644 --- a/src/code/z_shrink_window.c +++ b/src/code/z_shrink_window.c @@ -4,70 +4,78 @@ */ #include "prevent_bss_reordering.h" #include "global.h" +#include "z64shrink_window.h" -ShrinkWindowContext gShrinkWindowContext; -ShrinkWindowContext* gShrinkWindowContextPtr; +typedef struct { + /* 0x0 */ s8 letterboxTarget; + /* 0x1 */ s8 letterboxSize; + /* 0x2 */ s8 pillarboxTarget; + /* 0x3 */ s8 pillarboxSize; +} ShrinkWindow; // size = 0x4 -void ShrinkWindow_SetLetterboxTarget(s32 target) { - gShrinkWindowContextPtr->letterboxTarget = target; +ShrinkWindow sShrinkWindow; +ShrinkWindow* sShrinkWindowPtr; + +void ShrinkWindow_Letterbox_SetSizeTarget(s32 target) { + sShrinkWindowPtr->letterboxTarget = target; } -s32 ShrinkWindow_GetLetterboxTarget(void) { - return gShrinkWindowContextPtr->letterboxTarget; +s32 ShrinkWindow_Letterbox_GetSizeTarget(void) { + return sShrinkWindowPtr->letterboxTarget; } -void ShrinkWindow_SetLetterboxMagnitude(s32 magnitude) { - gShrinkWindowContextPtr->letterboxMagnitude = magnitude; +void ShrinkWindow_Letterbox_SetSize(s32 size) { + sShrinkWindowPtr->letterboxSize = size; } -s32 ShrinkWindow_GetLetterboxMagnitude(void) { - return gShrinkWindowContextPtr->letterboxMagnitude; +s32 ShrinkWindow_Letterbox_GetSize(void) { + return sShrinkWindowPtr->letterboxSize; } -void ShrinkWindow_SetPillarboxTarget(s32 target) { - gShrinkWindowContextPtr->pillarboxTarget = target; +void ShrinkWindow_Pillarbox_SetSizeTarget(s32 target) { + sShrinkWindowPtr->pillarboxTarget = target; } -s32 ShrinkWindow_GetPillarboxTarget(void) { - return gShrinkWindowContextPtr->pillarboxTarget; +s32 ShrinkWindow_Pillarbox_GetSizeTarget(void) { + return sShrinkWindowPtr->pillarboxTarget; } -void ShrinkWindow_SetPillarboxMagnitude(s32 magnitude) { - gShrinkWindowContextPtr->pillarboxMagnitude = magnitude; +void ShrinkWindow_Pillarbox_SetSize(s32 size) { + sShrinkWindowPtr->pillarboxSize = size; } -s32 ShrinkWindow_GetPillarboxMagnitude(void) { - return gShrinkWindowContextPtr->pillarboxMagnitude; +s32 ShrinkWindow_Pillarbox_GetSize(void) { + return sShrinkWindowPtr->pillarboxSize; } void ShrinkWindow_Init(void) { - gShrinkWindowContextPtr = &gShrinkWindowContext; - bzero(gShrinkWindowContextPtr, sizeof(gShrinkWindowContext)); + sShrinkWindowPtr = &sShrinkWindow; + bzero(sShrinkWindowPtr, sizeof(sShrinkWindow)); } void ShrinkWindow_Destroy(void) { - gShrinkWindowContextPtr = NULL; + sShrinkWindowPtr = NULL; } void ShrinkWindow_Update(s32 framerateDivisor) { - s32 step = ((framerateDivisor == 3) ? 10 : 30 / framerateDivisor); - s32 nextMagnitude; + s32 step = (framerateDivisor == 3) ? 10 : (30 / framerateDivisor); + s32 nextSize; - nextMagnitude = gShrinkWindowContextPtr->letterboxMagnitude; - Math_StepToIGet(&nextMagnitude, gShrinkWindowContextPtr->letterboxTarget, step); - gShrinkWindowContextPtr->letterboxMagnitude = nextMagnitude; + nextSize = sShrinkWindowPtr->letterboxSize; + Math_StepToIGet(&nextSize, sShrinkWindowPtr->letterboxTarget, step); + sShrinkWindowPtr->letterboxSize = nextSize; - nextMagnitude = gShrinkWindowContextPtr->pillarboxMagnitude; - Math_StepToIGet(&nextMagnitude, gShrinkWindowContextPtr->pillarboxTarget, step); - gShrinkWindowContextPtr->pillarboxMagnitude = nextMagnitude; + nextSize = sShrinkWindowPtr->pillarboxSize; + Math_StepToIGet(&nextSize, sShrinkWindowPtr->pillarboxTarget, step); + sShrinkWindowPtr->pillarboxSize = nextSize; } void ShrinkWindow_Draw(GraphicsContext* gfxCtx) { Gfx* gfx; - s8 letterboxMagnitude = gShrinkWindowContextPtr->letterboxMagnitude; - s8 pillarboxMagnitude = gShrinkWindowContextPtr->pillarboxMagnitude; + s8 letterboxSize = sShrinkWindowPtr->letterboxSize; + s8 pillarboxSize = sShrinkWindowPtr->pillarboxSize; - if (letterboxMagnitude > 0) { + if (letterboxSize > 0) { OPEN_DISPS(gfxCtx); gfx = OVERLAY_DISP; @@ -76,23 +84,23 @@ void ShrinkWindow_Draw(GraphicsContext* gfxCtx) { gDPSetCycleType(gfx++, G_CYC_FILL); gDPSetRenderMode(gfx++, G_RM_NOOP, G_RM_NOOP2); gDPSetFillColor(gfx++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1)); - gDPFillRectangle(gfx++, 0, 0, gScreenWidth - 1, letterboxMagnitude - 1); - gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxMagnitude, gScreenWidth - 1, gScreenHeight - 1); + gDPFillRectangle(gfx++, 0, 0, gScreenWidth - 1, letterboxSize - 1); + gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxSize, gScreenWidth - 1, gScreenHeight - 1); gDPPipeSync(gfx++); gDPSetCycleType(gfx++, G_CYC_1CYCLE); gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 0); - gDPFillRectangle(gfx++, 0, letterboxMagnitude, gScreenWidth, letterboxMagnitude + 1); - gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxMagnitude - 1, gScreenWidth, - gScreenHeight - letterboxMagnitude); + gDPFillRectangle(gfx++, 0, letterboxSize, gScreenWidth, letterboxSize + 1); + gDPFillRectangle(gfx++, 0, gScreenHeight - letterboxSize - 1, gScreenWidth, gScreenHeight - letterboxSize); gDPPipeSync(gfx++); OVERLAY_DISP = gfx++; CLOSE_DISPS(gfxCtx); } - if (pillarboxMagnitude > 0) { + + if (pillarboxSize > 0) { OPEN_DISPS(gfxCtx); gfx = OVERLAY_DISP; @@ -102,17 +110,16 @@ void ShrinkWindow_Draw(GraphicsContext* gfxCtx) { gDPSetRenderMode(gfx++, G_RM_NOOP, G_RM_NOOP2); gDPSetFillColor(gfx++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1)); - gDPFillRectangle(gfx++, 0, 0, pillarboxMagnitude - 1, gScreenHeight - 1); - gDPFillRectangle(gfx++, gScreenWidth - pillarboxMagnitude, 0, gScreenWidth - 1, gScreenHeight - 1); + gDPFillRectangle(gfx++, 0, 0, pillarboxSize - 1, gScreenHeight - 1); + gDPFillRectangle(gfx++, gScreenWidth - pillarboxSize, 0, gScreenWidth - 1, gScreenHeight - 1); gDPPipeSync(gfx++); gDPSetCycleType(gfx++, G_CYC_1CYCLE); gDPSetRenderMode(gfx++, G_RM_XLU_SURF, G_RM_XLU_SURF2); gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, 0); - gDPFillRectangle(gfx++, pillarboxMagnitude, 0, pillarboxMagnitude + 2, gScreenHeight); - gDPFillRectangle(gfx++, gScreenWidth - pillarboxMagnitude - 2, 0, gScreenWidth - pillarboxMagnitude, - gScreenHeight); + gDPFillRectangle(gfx++, pillarboxSize, 0, pillarboxSize + 2, gScreenHeight); + gDPFillRectangle(gfx++, gScreenWidth - pillarboxSize - 2, 0, gScreenWidth - pillarboxSize, gScreenHeight); gDPPipeSync(gfx++); OVERLAY_DISP = gfx++; diff --git a/src/code/z_view.c b/src/code/z_view.c index 915c196b72..105e6643a9 100644 --- a/src/code/z_view.c +++ b/src/code/z_view.c @@ -1,4 +1,9 @@ #include "global.h" +#include "z64shrink_window.h" +#include "z64view.h" + +s32 View_ApplyPerspective(View* view); +s32 View_ApplyOrtho(View* view); void View_ViewportToVp(Vp* dest, Viewport* src) { s32 width = src->rightX - src->leftX; @@ -13,41 +18,45 @@ void View_ViewportToVp(Vp* dest, Viewport* src) { dest->vp.vtrans[2] = 0x01FF; dest->vp.vtrans[3] = 0; - if (src->leftX == 0 && src->rightX == 576 && src->topY == 0 && src->bottomY) {} + if ((src->leftX == 0) && (src->rightX == SCREEN_WIDTH_HIGH_RES) && (src->topY == 0) && + (src->bottomY == SCREEN_HEIGHT_HIGH_RES)) {} } void View_Init(View* view, GraphicsContext* gfxCtx) { view->gfxCtx = gfxCtx; + view->viewport.topY = 0; - view->viewport.bottomY = 240; + view->viewport.bottomY = SCREEN_HEIGHT; view->viewport.leftX = 0; - view->viewport.rightX = 320; + view->viewport.rightX = SCREEN_WIDTH; + view->magic = 0x56494557; // "VIEW" - view->unk164 = 0; - view->flags = 1 | 2 | 4; - - if (1) { - ; - } + if (1) {} view->scale = 1.0f; - view->up.y = 1.0f; view->fovy = 60.0f; - view->eye.x = 0.0f; - view->eye.y = 0.0f; - view->at.x = 0.0f; - view->up.x = 0.0f; - view->up.z = 0.0f; view->zNear = 10.0f; view->zFar = 12800.0f; + + view->eye.x = 0.0f; + view->eye.y = 0.0f; view->eye.z = -1.0f; + view->at.x = 0.0f; + + view->up.x = 0.0f; + view->up.y = 1.0f; + view->up.z = 0.0f; + + view->unk164 = 0; + view->flags = VIEW_VIEWING | VIEW_VIEWPORT | VIEW_PROJECTION_PERSPECTIVE; + View_InitDistortion(view); } -void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) { - if (eye->x == at->x && eye->z == at->z) { +void View_LookAt(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) { + if ((eye->x == at->x) && (eye->z == at->z)) { eye->z += 0.1f; up->z = 0.0f; up->x = 0.0f; @@ -57,17 +66,21 @@ void View_SetViewOrientation(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) { view->eye = *eye; view->at = *at; view->up = *up; - view->flags |= 1; + view->flags |= VIEW_VIEWING; } -void func_8013F050(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) { +/* + * Unused. View_LookAt is always used instead. This version is similar but + * is missing the input sanitization and the update to the flags. + */ +void View_LookAtUnsafe(View* view, Vec3f* eye, Vec3f* at, Vec3f* up) { view->eye = *eye; view->at = *at; view->up = *up; } void View_SetScale(View* view, f32 scale) { - view->flags |= 4; + view->flags |= VIEW_PROJECTION_PERSPECTIVE; view->scale = scale; } @@ -75,28 +88,32 @@ void View_GetScale(View* view, f32* scale) { *scale = view->scale; } -void func_8013F0D0(View* view, f32 fovy, f32 zNear, f32 zFar) { +void View_SetPerspective(View* view, f32 fovy, f32 zNear, f32 zFar) { view->fovy = fovy; view->zNear = zNear; view->zFar = zFar; - view->flags |= 4; + view->flags |= VIEW_PROJECTION_PERSPECTIVE; } -void func_8013F100(View* view, f32* fovy, f32* zNear, f32* zFar) { +void View_GetPerspective(View* view, f32* fovy, f32* zNear, f32* zFar) { *fovy = view->fovy; *zNear = view->zNear; *zFar = view->zFar; } -void func_8013F120(View* view, f32 fovy, f32 zNear, f32 zFar) { +void View_SetOrtho(View* view, f32 fovy, f32 zNear, f32 zFar) { view->fovy = fovy; view->zNear = zNear; view->zFar = zFar; - view->flags |= 8; + view->flags |= VIEW_PROJECTION_ORTHO; view->scale = 1.0f; } -void func_8013F15C(View* view, f32* fovy, f32* zNear, f32* zFar) { +/* + * Identical to View_GetPerspective, and never called. + * Named as it seems to fit the "set, get" pattern. + */ +void View_GetOrtho(View* view, f32* fovy, f32* zNear, f32* zFar) { *fovy = view->fovy; *zNear = view->zNear; *zFar = view->zFar; @@ -104,14 +121,14 @@ void func_8013F15C(View* view, f32* fovy, f32* zNear, f32* zFar) { void View_SetViewport(View* view, Viewport* viewport) { view->viewport = *viewport; - view->flags |= 2; + view->flags |= VIEW_VIEWPORT; } void View_GetViewport(View* view, Viewport* viewport) { *viewport = view->viewport; } -void View_WriteScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry) { +void View_SetScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry) { Gfx* gfxp = *gfx; gDPSetScissor(gfxp++, G_SC_NON_INTERLACE, ulx, uly, lrx, lry); @@ -119,7 +136,7 @@ void View_WriteScissor(Gfx** gfx, s32 ulx, s32 uly, s32 lrx, s32 lry) { *gfx = gfxp; } -void View_SyncAndWriteScissor(View* view, Gfx** gfx) { +void View_ClearScissor(View* view, Gfx** gfx) { Gfx* gfxp = *gfx; s32 ulx = view->viewport.leftX; s32 uly = view->viewport.topY; @@ -127,12 +144,12 @@ void View_SyncAndWriteScissor(View* view, Gfx** gfx) { s32 lry = view->viewport.bottomY; gDPPipeSync(gfxp++); - View_WriteScissor(&gfxp, ulx, uly, lrx, lry); + View_SetScissor(&gfxp, ulx, uly, lrx, lry); *gfx = gfxp; } -void View_SetScissorForLetterbox(View* view) { +void View_ApplyLetterbox(View* view) { s32 letterboxY; s32 letterboxX; s32 pad1; @@ -143,20 +160,21 @@ void View_SetScissorForLetterbox(View* view) { OPEN_DISPS(view->gfxCtx); - letterboxY = ShrinkWindow_GetLetterboxMagnitude(); + letterboxY = ShrinkWindow_Letterbox_GetSize(); + letterboxX = -1; // The following is optimized to varX = 0 but affects codegen if (letterboxX < 0) { letterboxX = 0; } - if (letterboxX > 160) { - letterboxX = 160; + if (letterboxX > (SCREEN_WIDTH / 2)) { + letterboxX = SCREEN_WIDTH / 2; } if (letterboxY < 0) { letterboxY = 0; - } else if (letterboxY > 120) { - letterboxY = 120; + } else if (letterboxY > (SCREEN_HEIGHT / 2)) { + letterboxY = SCREEN_HEIGHT / 2; } ulx = view->viewport.leftX + letterboxX; @@ -166,31 +184,31 @@ void View_SetScissorForLetterbox(View* view) { gDPPipeSync(POLY_OPA_DISP++); { - s32 pad3; + s32 pad2; Gfx* polyOpa; polyOpa = POLY_OPA_DISP; - View_WriteScissor(&polyOpa, ulx, uly, lrx, lry); + View_SetScissor(&polyOpa, ulx, uly, lrx, lry); POLY_OPA_DISP = polyOpa; } gDPPipeSync(POLY_XLU_DISP++); { Gfx* polyXlu; - s32 pad4; + s32 pad3; polyXlu = POLY_XLU_DISP; - View_WriteScissor(&polyXlu, ulx, uly, lrx, lry); + View_SetScissor(&polyXlu, ulx, uly, lrx, lry); POLY_XLU_DISP = polyXlu; } CLOSE_DISPS(view->gfxCtx); } -s32 View_SetDistortionDirRot(View* view, f32 dirRotX, f32 dirRotY, f32 dirRotZ) { - view->distortionDirRot.x = dirRotX; - view->distortionDirRot.y = dirRotY; - view->distortionDirRot.z = dirRotZ; +s32 View_SetDistortionOrientation(View* view, f32 rotX, f32 rotY, f32 rotZ) { + view->distortionOrientation.x = rotX; + view->distortionOrientation.y = rotY; + view->distortionOrientation.z = rotZ; return 1; } @@ -207,22 +225,22 @@ s32 View_SetDistortionSpeed(View* view, f32 speed) { } s32 View_InitDistortion(View* view) { - view->distortionDirRot.x = 0.0f; - view->distortionDirRot.y = 0.0f; - view->distortionDirRot.z = 0.0f; + view->distortionOrientation.x = 0.0f; + view->distortionOrientation.y = 0.0f; + view->distortionOrientation.z = 0.0f; view->distortionScale.x = 1.0f; view->distortionScale.y = 1.0f; view->distortionScale.z = 1.0f; - view->curDistortionDirRot = view->distortionDirRot; + view->curDistortionOrientation = view->distortionOrientation; view->curDistortionScale = view->distortionScale; view->distortionSpeed = 0.0f; return 1; } s32 View_ClearDistortion(View* view) { - view->distortionDirRot.x = 0.0f; - view->distortionDirRot.y = 0.0f; - view->distortionDirRot.z = 0.0f; + view->distortionOrientation.x = 0.0f; + view->distortionOrientation.y = 0.0f; + view->distortionOrientation.z = 0.0f; view->distortionScale.x = 1.0f; view->distortionScale.y = 1.0f; view->distortionScale.z = 1.0f; @@ -230,8 +248,8 @@ s32 View_ClearDistortion(View* view) { return 1; } -s32 View_SetDistortion(View* view, Vec3f dirRot, Vec3f scale, f32 speed) { - view->distortionDirRot = dirRot; +s32 View_SetDistortion(View* view, Vec3f orientation, Vec3f scale, f32 speed) { + view->distortionOrientation = orientation; view->distortionScale = scale; view->distortionSpeed = speed; return 1; @@ -242,17 +260,19 @@ s32 View_StepDistortion(View* view, Mtx* projectionMtx) { if (view->distortionSpeed == 0.0f) { return false; - } else if (view->distortionSpeed == 1.0f) { - view->curDistortionDirRot = view->distortionDirRot; + } + + if (view->distortionSpeed == 1.0f) { + view->curDistortionOrientation = view->distortionOrientation; view->curDistortionScale = view->distortionScale; view->distortionSpeed = 0.0f; } else { - view->curDistortionDirRot.x = - F32_LERPIMP(view->curDistortionDirRot.x, view->distortionDirRot.x, view->distortionSpeed); - view->curDistortionDirRot.y = - F32_LERPIMP(view->curDistortionDirRot.y, view->distortionDirRot.y, view->distortionSpeed); - view->curDistortionDirRot.z = - F32_LERPIMP(view->curDistortionDirRot.z, view->distortionDirRot.z, view->distortionSpeed); + view->curDistortionOrientation.x = + F32_LERPIMP(view->curDistortionOrientation.x, view->distortionOrientation.x, view->distortionSpeed); + view->curDistortionOrientation.y = + F32_LERPIMP(view->curDistortionOrientation.y, view->distortionOrientation.y, view->distortionSpeed); + view->curDistortionOrientation.z = + F32_LERPIMP(view->curDistortionOrientation.z, view->distortionOrientation.z, view->distortionSpeed); view->curDistortionScale.x = F32_LERPIMP(view->curDistortionScale.x, view->distortionScale.x, view->distortionSpeed); @@ -264,29 +284,32 @@ s32 View_StepDistortion(View* view, Mtx* projectionMtx) { Matrix_MtxToMtxF(projectionMtx, &projectionMtxF); Matrix_Put(&projectionMtxF); - Matrix_RotateXFApply(view->curDistortionDirRot.x); - Matrix_RotateYF(view->curDistortionDirRot.y, MTXMODE_APPLY); - Matrix_RotateZF(view->curDistortionDirRot.z, MTXMODE_APPLY); + Matrix_RotateXFApply(view->curDistortionOrientation.x); + Matrix_RotateYF(view->curDistortionOrientation.y, MTXMODE_APPLY); + Matrix_RotateZF(view->curDistortionOrientation.z, MTXMODE_APPLY); Matrix_Scale(view->curDistortionScale.x, view->curDistortionScale.y, view->curDistortionScale.z, MTXMODE_APPLY); - Matrix_RotateZF(-view->curDistortionDirRot.z, MTXMODE_APPLY); - Matrix_RotateYF(-view->curDistortionDirRot.y, MTXMODE_APPLY); - Matrix_RotateXFApply(-view->curDistortionDirRot.x); + Matrix_RotateZF(-view->curDistortionOrientation.z, MTXMODE_APPLY); + Matrix_RotateYF(-view->curDistortionOrientation.y, MTXMODE_APPLY); + Matrix_RotateXFApply(-view->curDistortionOrientation.x); Matrix_ToMtx(projectionMtx); return true; } -void View_RenderView(View* view, s32 uParm2) { - uParm2 = (view->flags & uParm2) | uParm2 >> 4; +/** + * Apply view to POLY_OPA_DISP, POLY_XLU_DISP (and OVERLAY_DISP if ortho) + */ +void View_Apply(View* view, s32 mask) { + mask = (view->flags & mask) | (mask >> 4); - if (uParm2 & 8) { - View_RenderToOrthographicMatrix(view); + if (mask & VIEW_PROJECTION_ORTHO) { + View_ApplyOrtho(view); } else { - View_RenderToPerspectiveMatrix(view); + View_ApplyPerspective(view); } } -s32 View_RenderToPerspectiveMatrix(View* view) { +s32 View_ApplyPerspective(View* view) { f32 aspect; s32 width; s32 height; @@ -297,36 +320,39 @@ s32 View_RenderToPerspectiveMatrix(View* view) { OPEN_DISPS(gfxCtx); - vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp)); + // Viewport + vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp)); View_ViewportToVp(vp, &view->viewport); view->vp = *vp; - View_SetScissorForLetterbox(view); + View_ApplyLetterbox(view); gSPViewport(POLY_OPA_DISP++, vp); gSPViewport(POLY_XLU_DISP++, vp); - projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection)); + // Perspective projection + projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); view->projectionPtr = projection; width = view->viewport.rightX - view->viewport.leftX; height = view->viewport.bottomY - view->viewport.topY; aspect = (f32)width / (f32)height; - guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale); + guPerspective(projection, &view->perspNorm, view->fovy, aspect, view->zNear, view->zFar, view->scale); view->projection = *projection; View_StepDistortion(view, projection); - gSPPerspNormalize(POLY_OPA_DISP++, view->normal); + gSPPerspNormalize(POLY_OPA_DISP++, view->perspNorm); gSPMatrix(POLY_OPA_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - gSPPerspNormalize(POLY_XLU_DISP++, view->normal); + gSPPerspNormalize(POLY_XLU_DISP++, view->perspNorm); gSPMatrix(POLY_XLU_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - viewing = GRAPH_ALLOC(gfxCtx, sizeof(*viewing)); + // View matrix (look-at) + viewing = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); view->viewingPtr = viewing; - if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) { + if ((view->eye.x == view->at.x) && (view->eye.y == view->at.y) && (view->eye.z == view->at.z)) { view->eye.z += 2.0f; } @@ -343,24 +369,24 @@ s32 View_RenderToPerspectiveMatrix(View* view) { return 1; } -s32 View_RenderToOrthographicMatrix(View* view) { +s32 View_ApplyOrtho(View* view) { Vp* vp; Mtx* projection; GraphicsContext* gfxCtx = view->gfxCtx; OPEN_DISPS(gfxCtx); - vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp)); + vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp)); View_ViewportToVp(vp, &view->viewport); view->vp = *vp; - View_SetScissorForLetterbox(view); + View_ApplyLetterbox(view); gSPViewport(POLY_OPA_DISP++, vp); gSPViewport(POLY_XLU_DISP++, vp); gSPViewport(OVERLAY_DISP++, vp); - projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection)); + projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); view->projectionPtr = projection; guOrtho(projection, gScreenWidth * -0.5f, gScreenWidth * 0.5f, gScreenHeight * -0.5f, gScreenHeight * 0.5f, @@ -376,7 +402,10 @@ s32 View_RenderToOrthographicMatrix(View* view) { return 1; } -s32 func_8013FBC8(View* view) { +/** + * Apply scissor, viewport and projection (ortho) to OVERLAY_DISP. + */ +s32 View_ApplyOrthoToOverlay(View* view) { Vp* vp; Mtx* projection; GraphicsContext* gfxCtx; @@ -385,7 +414,7 @@ s32 func_8013FBC8(View* view) { OPEN_DISPS(gfxCtx); - vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp)); + vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp)); View_ViewportToVp(vp, &view->viewport); view->vp = *vp; @@ -395,26 +424,29 @@ s32 func_8013FBC8(View* view) { s32 pad; overlay = OVERLAY_DISP; - View_WriteScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, - view->viewport.bottomY); + View_SetScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, + view->viewport.bottomY); OVERLAY_DISP = overlay; } gSPViewport(OVERLAY_DISP++, vp); - projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection)); + projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); view->projectionPtr = projection; guOrtho(projection, gScreenWidth * -0.5f, gScreenWidth * 0.5f, gScreenHeight * -0.5f, gScreenHeight * 0.5f, view->zNear, view->zFar, view->scale); view->projection = *projection; - gSPMatrix(OVERLAY_DISP++, projection, G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(OVERLAY_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); CLOSE_DISPS(gfxCtx); return 1; } -s32 func_8013FD74(View* view) { +/** + * Apply scissor, viewport, view and projection (perspective) to OVERLAY_DISP. + */ +s32 View_ApplyPerspectiveToOverlay(View* view) { f32 aspect; s32 width; s32 height; @@ -428,7 +460,7 @@ s32 func_8013FD74(View* view) { OPEN_DISPS(gfxCtx); - vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp)); + vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp)); View_ViewportToVp(vp, &view->viewport); view->vp = *vp; @@ -438,28 +470,30 @@ s32 func_8013FD74(View* view) { Gfx* overlay; overlay = OVERLAY_DISP; - View_WriteScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, - view->viewport.bottomY); + View_SetScissor(&overlay, view->viewport.leftX, view->viewport.topY, view->viewport.rightX, + view->viewport.bottomY); OVERLAY_DISP = overlay; } gSPViewport(OVERLAY_DISP++, vp); - projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection)); + projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); view->projectionPtr = projection; width = view->viewport.rightX - view->viewport.leftX; height = view->viewport.bottomY - view->viewport.topY; aspect = (f32)width / (f32)height; - guPerspective(projection, &view->normal, view->fovy, aspect, view->zNear, view->zFar, view->scale); + guPerspective(projection, &view->perspNorm, view->fovy, aspect, view->zNear, view->zFar, view->scale); + view->projection = *projection; - gSPPerspNormalize(OVERLAY_DISP++, view->normal); + gSPPerspNormalize(OVERLAY_DISP++, view->perspNorm); gSPMatrix(OVERLAY_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); - viewing = GRAPH_ALLOC(gfxCtx, sizeof(*viewing)); + viewing = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); view->viewingPtr = viewing; + // This check avoids a divide-by-zero in guLookAt if eye == at if (view->eye.x == view->at.x && view->eye.y == view->at.y && view->eye.z == view->at.z) { view->eye.z += 2.0f; } @@ -476,7 +510,10 @@ s32 func_8013FD74(View* view) { return 1; } -s32 func_80140024(View* view) { +/** + * Just updates view's view matrix from its eye/at/up vectors. + */ +s32 View_UpdateViewingMatrix(View* view) { guLookAt(view->viewingPtr, view->eye.x, view->eye.y, view->eye.z, view->at.x, view->at.y, view->at.z, view->up.x, view->up.y, view->up.z); @@ -486,22 +523,22 @@ s32 func_80140024(View* view) { return 1; } -s32 func_801400CC(View* view, Gfx** gfxp) { +s32 View_ApplyTo(View* view, Gfx** gfxp) { Gfx* gfx = *gfxp; GraphicsContext* gfxCtx = view->gfxCtx; Viewport* viewport = &view->viewport; Mtx* projection; Vp* vp; - vp = GRAPH_ALLOC(gfxCtx, sizeof(*vp)); + vp = GRAPH_ALLOC(gfxCtx, sizeof(Vp)); View_ViewportToVp(vp, viewport); view->vp = *vp; - View_SyncAndWriteScissor(view, &gfx); + View_ClearScissor(view, &gfx); gSPViewport(gfx++, vp); - projection = GRAPH_ALLOC(gfxCtx, sizeof(*projection)); + projection = GRAPH_ALLOC(gfxCtx, sizeof(Mtx)); view->projectionPtr = projection; guOrtho(projection, gScreenWidth * -0.5f, gScreenWidth * 0.5f, gScreenHeight * -0.5f, gScreenHeight * 0.5f, @@ -509,7 +546,7 @@ s32 func_801400CC(View* view, Gfx** gfxp) { view->projection = *projection; - gSPMatrix(gfx++, projection, G_MTX_LOAD | G_MTX_PROJECTION); + gSPMatrix(gfx++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); *gfxp = gfx; return 1; diff --git a/src/overlays/actors/ovl_Boss_01/z_boss_01.c b/src/overlays/actors/ovl_Boss_01/z_boss_01.c index 11790f3776..40800569fc 100644 --- a/src/overlays/actors/ovl_Boss_01/z_boss_01.c +++ b/src/overlays/actors/ovl_Boss_01/z_boss_01.c @@ -6,6 +6,7 @@ #include "z_boss_01.h" #include "z64rumble.h" +#include "z64shrink_window.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index 9808e68a40..b3ab79b201 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -6,6 +6,7 @@ #include "z_boss_02.h" #include "z64rumble.h" +#include "z64shrink_window.h" #include "overlays/actors/ovl_Door_Warp1/z_door_warp1.h" #include "overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h" #include "objects/gameplay_keep/gameplay_keep.h" @@ -2033,7 +2034,7 @@ void func_809DD934(Boss02* this, PlayState* play) { Matrix_RotateZF(this->unk_1D54, MTXMODE_APPLY); Matrix_MultVecY(1.0f, &this->subCamUp); Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); - ShrinkWindow_SetLetterboxTarget(27); + ShrinkWindow_Letterbox_SetSizeTarget(27); } } @@ -2241,6 +2242,6 @@ void func_809DEAC4(Boss02* this, PlayState* play) { Play_SetCameraAtEyeUp(play, this->subCamId, &this->subCamAt, &subCamEye, &this->subCamUp); this->subCamUp.z = this->subCamUp.x = 0.0f; this->subCamUp.y = 1.0f; - ShrinkWindow_SetLetterboxTarget(27); + ShrinkWindow_Letterbox_SetSizeTarget(27); } } diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index f26bc505f5..8eb73d84d2 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -5,6 +5,7 @@ */ #include "z_boss_04.h" +#include "z64shrink_window.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) @@ -399,7 +400,7 @@ void func_809EC568(Boss04* this, PlayState* play) { if (this->subCamId != SUB_CAM_ID_DONE) { Vec3f subCamAt; - ShrinkWindow_SetLetterboxTarget(27); + ShrinkWindow_Letterbox_SetSizeTarget(27); if (this->subCamAtOscillator != 0) { this->subCamAtOscillator--; } diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 045a769953..3aadce42cb 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -6,6 +6,7 @@ #include "prevent_bss_reordering.h" #include "z_boss_06.h" +#include "z64shrink_window.h" #include "overlays/actors/ovl_En_Knight/z_en_knight.h" #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/object_knight/object_knight.h" @@ -339,7 +340,7 @@ void func_809F24C8(Boss06* this, PlayState* play) { } if (this->subCamId != SUB_CAM_ID_DONE) { - ShrinkWindow_SetLetterboxTarget(27); + ShrinkWindow_Letterbox_SetSizeTarget(27); Play_SetCameraAtEye(play, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_Boss_07/z_boss_07.c b/src/overlays/actors/ovl_Boss_07/z_boss_07.c index 9b988da18a..923c838fc9 100644 --- a/src/overlays/actors/ovl_Boss_07/z_boss_07.c +++ b/src/overlays/actors/ovl_Boss_07/z_boss_07.c @@ -5,6 +5,7 @@ */ #include "z_boss_07.h" +#include "z64shrink_window.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) diff --git a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c index 5a3ce9cf87..4ad558a0a0 100644 --- a/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c +++ b/src/overlays/actors/ovl_En_Bsb/z_en_bsb.c @@ -6,6 +6,7 @@ #include "z_en_bsb.h" #include "z64rumble.h" +#include "z64shrink_window.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_2000000) diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 8bd1b7e0ec..baa65bfa3e 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -6,6 +6,7 @@ #include "z_en_fishing.h" #include "z64rumble.h" +#include "z64shrink_window.h" #include "objects/object_fish/object_fish.h" #include "overlays/actors/ovl_En_Kanban/z_en_kanban.h" @@ -5170,7 +5171,7 @@ void EnFishing_UpdateOwner(Actor* thisx, PlayState* play2) { sSubCamVelFactor = 0.0f; // fallthrough case 2: - ShrinkWindow_SetLetterboxTarget(27); + ShrinkWindow_Letterbox_SetSizeTarget(27); spFC.x = sLurePos.x - player->actor.world.pos.x; spFC.z = sLurePos.z - player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Knight/z_en_knight.c b/src/overlays/actors/ovl_En_Knight/z_en_knight.c index 095ca5a98a..17d0e37526 100644 --- a/src/overlays/actors/ovl_En_Knight/z_en_knight.c +++ b/src/overlays/actors/ovl_En_Knight/z_en_knight.c @@ -5,6 +5,7 @@ */ #include "z_en_knight.h" +#include "z64shrink_window.h" #define FLAGS (ACTOR_FLAG_1 | ACTOR_FLAG_4 | ACTOR_FLAG_10 | ACTOR_FLAG_20) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 681438463a..1f92e8825e 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -7,6 +7,7 @@ #include "global.h" #include "z64quake.h" #include "z64rumble.h" +#include "z64shrink_window.h" #define THIS ((Player*)thisx) diff --git a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c index ad5230253a..2010308627 100644 --- a/src/overlays/gamestates/ovl_daytelop/z_daytelop.c +++ b/src/overlays/gamestates/ovl_daytelop/z_daytelop.c @@ -5,6 +5,8 @@ */ #include "z_daytelop.h" +#include "z64shrink_window.h" +#include "z64view.h" #include "misc/daytelop_static/daytelop_static.h" #include "interface/icon_item_gameover_static/icon_item_gameover_static.h" diff --git a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c index 657a2530f0..da9144e7c6 100644 --- a/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c +++ b/src/overlays/gamestates/ovl_file_choose/z_file_choose_NES.c @@ -6,6 +6,8 @@ #include "z_file_choose.h" #include "z64rumble.h" +#include "z64shrink_window.h" +#include "z64view.h" extern UNK_TYPE D_01002800; extern UNK_TYPE D_01007980; diff --git a/src/overlays/gamestates/ovl_opening/z_opening.c b/src/overlays/gamestates/ovl_opening/z_opening.c index 42336b9bca..fc5d05be24 100644 --- a/src/overlays/gamestates/ovl_opening/z_opening.c +++ b/src/overlays/gamestates/ovl_opening/z_opening.c @@ -5,6 +5,8 @@ */ #include "z_opening.h" +#include "z64shrink_window.h" +#include "z64view.h" void TitleSetup_SetupTitleScreen(TitleSetupState* this) { static s32 sOpeningEntrances[] = { ENTRANCE(CUTSCENE, 0), ENTRANCE(CUTSCENE, 1) }; diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 6ae0f5b6c3..2e8bbb802b 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -5,6 +5,8 @@ */ #include "z_select.h" +#include "z64shrink_window.h" +#include "z64view.h" #include "libc/alloca.h" #include "overlays/gamestates/ovl_title/z_title.h" @@ -1026,7 +1028,7 @@ void MapSelect_Draw(MapSelectState* this) { func_8012CF0C(gfxCtx, true, true, 0, 0, 0); SET_FULLSCREEN_VIEWPORT(&this->view); - View_RenderView(&this->view, 0xF); + View_Apply(&this->view, VIEW_ALL); if (!this->state.running) { MapSelect_DrawLoadingScreen(this); } else { diff --git a/src/overlays/gamestates/ovl_title/z_title.c b/src/overlays/gamestates/ovl_title/z_title.c index 62d2a36d06..2b23bf565e 100644 --- a/src/overlays/gamestates/ovl_title/z_title.c +++ b/src/overlays/gamestates/ovl_title/z_title.c @@ -5,6 +5,8 @@ */ #include "z_title.h" +#include "z64shrink_window.h" +#include "z64view.h" #include "overlays/gamestates/ovl_opening/z_opening.h" #include "misc/nintendo_rogo_static/nintendo_rogo_static.h" @@ -44,9 +46,9 @@ void ConsoleLogo_RenderView(ConsoleLogoState* this, f32 x, f32 y, f32 z) { up.x = up.z = 0.0f; at.x = at.y = at.z = 0.0f; up.y = 1.0f; - func_8013F0D0(view, 30.0f, 10.0f, 12800.0f); - View_SetViewOrientation(view, &eye, &at, &up); - View_RenderView(view, 0xF); + View_SetPerspective(view, 30.0f, 10.0f, 12800.0f); + View_LookAt(view, &eye, &at, &up); + View_Apply(view, VIEW_ALL); } void ConsoleLogo_Draw(GameState* thisx) { diff --git a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c index c02ebcad28..3b3de5937a 100644 --- a/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c +++ b/src/overlays/kaleido_scope/ovl_kaleido_scope/z_kaleido_scope_NES.c @@ -5,6 +5,7 @@ */ #include "z_kaleido_scope.h" +#include "z64view.h" extern UNK_TYPE D_02001360; extern UNK_TYPE D_020044A0; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 594ce3427b..8a146996da 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -2721,33 +2721,33 @@ 0x8013EE48:("Rumble_SetUpdateEnabled",), 0x8013EE60:("View_ViewportToVp",), 0x8013EEF4:("View_Init",), - 0x8013EF9C:("View_SetViewOrientation",), - 0x8013F050:("func_8013F050",), + 0x8013EF9C:("View_LookAt",), + 0x8013F050:("View_LookAtUnsafe",), 0x8013F0A0:("View_SetScale",), 0x8013F0C0:("View_GetScale",), - 0x8013F0D0:("func_8013F0D0",), - 0x8013F100:("func_8013F100",), - 0x8013F120:("func_8013F120",), - 0x8013F15C:("func_8013F15C",), + 0x8013F0D0:("View_SetPerspective",), + 0x8013F100:("View_GetPerspective",), + 0x8013F120:("View_SetOrtho",), + 0x8013F15C:("View_GetOrtho",), 0x8013F17C:("View_SetViewport",), 0x8013F1B0:("View_GetViewport",), - 0x8013F1D8:("View_WriteScissor",), - 0x8013F28C:("View_SyncAndWriteScissor",), - 0x8013F2F8:("View_SetScissorForLetterbox",), - 0x8013F3F8:("View_SetDistortionDirRot",), + 0x8013F1D8:("View_SetScissor",), + 0x8013F28C:("View_ClearScissor",), + 0x8013F2F8:("View_ApplyLetterbox",), + 0x8013F3F8:("View_SetDistortionOrientation",), 0x8013F420:("View_SetDistortionScale",), 0x8013F448:("View_SetDistortionSpeed",), 0x8013F45C:("View_InitDistortion",), 0x8013F4C0:("View_ClearDistortion",), 0x8013F4F4:("View_SetDistortion",), 0x8013F54C:("View_StepDistortion",), - 0x8013F6FC:("View_RenderView",), - 0x8013F748:("View_RenderToPerspectiveMatrix",), - 0x8013FA1C:("View_RenderToOrthographicMatrix",), - 0x8013FBC8:("func_8013FBC8",), - 0x8013FD74:("func_8013FD74",), - 0x80140024:("func_80140024",), - 0x801400CC:("func_801400CC",), + 0x8013F6FC:("View_Apply",), + 0x8013F748:("View_ApplyPerspective",), + 0x8013FA1C:("View_ApplyOrtho",), + 0x8013FBC8:("View_ApplyOrthoToOverlay",), + 0x8013FD74:("View_ApplyPerspectiveToOverlay",), + 0x80140024:("View_UpdateViewingMatrix",), + 0x801400CC:("View_ApplyTo",), 0x80140260:("func_80140260",), 0x8014026C:("func_8014026C",), 0x80140730:("func_80140730",), @@ -2892,14 +2892,14 @@ 0x80160B40:("PlayerCall_Destroy",), 0x80160B80:("PlayerCall_Update",), 0x80160BC0:("PlayerCall_Draw",), - 0x80160C00:("ShrinkWindow_SetLetterboxTarget",), - 0x80160C14:("ShrinkWindow_GetLetterboxTarget",), - 0x80160C28:("ShrinkWindow_SetLetterboxMagnitude",), - 0x80160C3C:("ShrinkWindow_GetLetterboxMagnitude",), - 0x80160C50:("ShrinkWindow_SetPillarboxTarget",), - 0x80160C64:("ShrinkWindow_GetPillarboxTarget",), - 0x80160C78:("ShrinkWindow_SetPillarboxMagnitude",), - 0x80160C8C:("ShrinkWindow_GetPillarboxMagnitude",), + 0x80160C00:("ShrinkWindow_Letterbox_SetSizeTarget",), + 0x80160C14:("ShrinkWindow_Letterbox_GetSizeTarget",), + 0x80160C28:("ShrinkWindow_Letterbox_SetSize",), + 0x80160C3C:("ShrinkWindow_Letterbox_GetSize",), + 0x80160C50:("ShrinkWindow_Pillarbox_SetSizeTarget",), + 0x80160C64:("ShrinkWindow_Pillarbox_GetSizeTarget",), + 0x80160C78:("ShrinkWindow_Pillarbox_SetSize",), + 0x80160C8C:("ShrinkWindow_Pillarbox_GetSize",), 0x80160CA0:("ShrinkWindow_Init",), 0x80160CD4:("ShrinkWindow_Destroy",), 0x80160CE4:("ShrinkWindow_Update",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 97cf77e76c..a0b3692644 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -4046,8 +4046,8 @@ 0x801F6B34:("sPlayerCallDestroyFunc","UNK_TYPE1","",0x1), 0x801F6B38:("sPlayerCallUpdateFunc","UNK_TYPE1","",0x1), 0x801F6B3C:("sPlayerCallDrawFunc","UNK_TYPE1","",0x1), - 0x801F6B40:("gShrinkWindowContext","ShrinkWindowContext","",0x4), - 0x801F6B44:("gShrinkWindowContextPtr","ShrinkWindowContext*","",0x4), + 0x801F6B40:("sShrinkWindow","ShrinkWindow","",0x4), + 0x801F6B44:("sShrinkWindowPtr","ShrinkWindow*","",0x4), 0x801F6B50:("D_801F6B50","UNK_TYPE4","",0x4), 0x801F6B58:("D_801F6B58","UNK_TYPE1","",0x1), 0x801F6BF0:("sKaleidoAreaFaultClient","FaultAddrConvClient","",0xC), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 33b82cef00..f64c45241e 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -2235,33 +2235,33 @@ asm/non_matchings/code/code_8013EC10/Rumble_StateWipeRequests.s,Rumble_StateWipe asm/non_matchings/code/code_8013EC10/Rumble_SetUpdateEnabled.s,Rumble_SetUpdateEnabled,0x8013EE48,0x6 asm/non_matchings/code/z_view/View_ViewportToVp.s,View_ViewportToVp,0x8013EE60,0x25 asm/non_matchings/code/z_view/View_Init.s,View_Init,0x8013EEF4,0x2A -asm/non_matchings/code/z_view/View_SetViewOrientation.s,View_SetViewOrientation,0x8013EF9C,0x2D -asm/non_matchings/code/z_view/func_8013F050.s,func_8013F050,0x8013F050,0x14 +asm/non_matchings/code/z_view/View_LookAt.s,View_LookAt,0x8013EF9C,0x2D +asm/non_matchings/code/z_view/View_LookAtUnsafe.s,View_LookAtUnsafe,0x8013F050,0x14 asm/non_matchings/code/z_view/View_SetScale.s,View_SetScale,0x8013F0A0,0x8 asm/non_matchings/code/z_view/View_GetScale.s,View_GetScale,0x8013F0C0,0x4 -asm/non_matchings/code/z_view/func_8013F0D0.s,func_8013F0D0,0x8013F0D0,0xC -asm/non_matchings/code/z_view/func_8013F100.s,func_8013F100,0x8013F100,0x8 -asm/non_matchings/code/z_view/func_8013F120.s,func_8013F120,0x8013F120,0xF -asm/non_matchings/code/z_view/func_8013F15C.s,func_8013F15C,0x8013F15C,0x8 +asm/non_matchings/code/z_view/View_SetPerspective.s,View_SetPerspective,0x8013F0D0,0xC +asm/non_matchings/code/z_view/View_GetPerspective.s,View_GetPerspective,0x8013F100,0x8 +asm/non_matchings/code/z_view/View_SetOrtho.s,View_SetOrtho,0x8013F120,0xF +asm/non_matchings/code/z_view/View_GetOrtho.s,View_GetOrtho,0x8013F15C,0x8 asm/non_matchings/code/z_view/View_SetViewport.s,View_SetViewport,0x8013F17C,0xD asm/non_matchings/code/z_view/View_GetViewport.s,View_GetViewport,0x8013F1B0,0xA -asm/non_matchings/code/z_view/View_WriteScissor.s,View_WriteScissor,0x8013F1D8,0x2D -asm/non_matchings/code/z_view/View_SyncAndWriteScissor.s,View_SyncAndWriteScissor,0x8013F28C,0x1B -asm/non_matchings/code/z_view/View_SetScissorForLetterbox.s,View_SetScissorForLetterbox,0x8013F2F8,0x40 -asm/non_matchings/code/z_view/View_SetDistortionDirRot.s,View_SetDistortionDirRot,0x8013F3F8,0xA +asm/non_matchings/code/z_view/View_SetScissor.s,View_SetScissor,0x8013F1D8,0x2D +asm/non_matchings/code/z_view/View_ClearScissor.s,View_ClearScissor,0x8013F28C,0x1B +asm/non_matchings/code/z_view/View_ApplyLetterbox.s,View_ApplyLetterbox,0x8013F2F8,0x40 +asm/non_matchings/code/z_view/View_SetDistortionOrientation.s,View_SetDistortionOrientation,0x8013F3F8,0xA asm/non_matchings/code/z_view/View_SetDistortionScale.s,View_SetDistortionScale,0x8013F420,0xA asm/non_matchings/code/z_view/View_SetDistortionSpeed.s,View_SetDistortionSpeed,0x8013F448,0x5 asm/non_matchings/code/z_view/View_InitDistortion.s,View_InitDistortion,0x8013F45C,0x19 asm/non_matchings/code/z_view/View_ClearDistortion.s,View_ClearDistortion,0x8013F4C0,0xD asm/non_matchings/code/z_view/View_SetDistortion.s,View_SetDistortion,0x8013F4F4,0x16 asm/non_matchings/code/z_view/View_StepDistortion.s,View_StepDistortion,0x8013F54C,0x6C -asm/non_matchings/code/z_view/View_RenderView.s,View_RenderView,0x8013F6FC,0x13 -asm/non_matchings/code/z_view/View_RenderToPerspectiveMatrix.s,View_RenderToPerspectiveMatrix,0x8013F748,0xB5 -asm/non_matchings/code/z_view/View_RenderToOrthographicMatrix.s,View_RenderToOrthographicMatrix,0x8013FA1C,0x6B -asm/non_matchings/code/z_view/func_8013FBC8.s,func_8013FBC8,0x8013FBC8,0x6B -asm/non_matchings/code/z_view/func_8013FD74.s,func_8013FD74,0x8013FD74,0xAC -asm/non_matchings/code/z_view/func_80140024.s,func_80140024,0x80140024,0x2A -asm/non_matchings/code/z_view/func_801400CC.s,func_801400CC,0x801400CC,0x65 +asm/non_matchings/code/z_view/View_Apply.s,View_Apply,0x8013F6FC,0x13 +asm/non_matchings/code/z_view/View_ApplyPerspective.s,View_ApplyPerspective,0x8013F748,0xB5 +asm/non_matchings/code/z_view/View_ApplyOrtho.s,View_ApplyOrtho,0x8013FA1C,0x6B +asm/non_matchings/code/z_view/View_ApplyOrthoToOverlay.s,View_ApplyOrthoToOverlay,0x8013FBC8,0x6B +asm/non_matchings/code/z_view/View_ApplyPerspectiveToOverlay.s,View_ApplyPerspectiveToOverlay,0x8013FD74,0xAC +asm/non_matchings/code/z_view/View_UpdateViewingMatrix.s,View_UpdateViewingMatrix,0x80140024,0x2A +asm/non_matchings/code/z_view/View_ApplyTo.s,View_ApplyTo,0x801400CC,0x65 asm/non_matchings/code/z_vimode/func_80140260.s,func_80140260,0x80140260,0x3 asm/non_matchings/code/z_vimode/func_8014026C.s,func_8014026C,0x8014026C,0x131 asm/non_matchings/code/z_vimode/func_80140730.s,func_80140730,0x80140730,0x38 @@ -2406,14 +2406,14 @@ asm/non_matchings/code/z_player_call/PlayerCall_Init.s,PlayerCall_Init,0x80160AF asm/non_matchings/code/z_player_call/PlayerCall_Destroy.s,PlayerCall_Destroy,0x80160B40,0x10 asm/non_matchings/code/z_player_call/PlayerCall_Update.s,PlayerCall_Update,0x80160B80,0x10 asm/non_matchings/code/z_player_call/PlayerCall_Draw.s,PlayerCall_Draw,0x80160BC0,0x10 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxTarget.s,ShrinkWindow_SetLetterboxTarget,0x80160C00,0x5 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetLetterboxTarget.s,ShrinkWindow_GetLetterboxTarget,0x80160C14,0x5 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetLetterboxMagnitude.s,ShrinkWindow_SetLetterboxMagnitude,0x80160C28,0x5 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetLetterboxMagnitude.s,ShrinkWindow_GetLetterboxMagnitude,0x80160C3C,0x5 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetPillarboxTarget.s,ShrinkWindow_SetPillarboxTarget,0x80160C50,0x5 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetPillarboxTarget.s,ShrinkWindow_GetPillarboxTarget,0x80160C64,0x5 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_SetPillarboxMagnitude.s,ShrinkWindow_SetPillarboxMagnitude,0x80160C78,0x5 -asm/non_matchings/code/z_shrink_window/ShrinkWindow_GetPillarboxMagnitude.s,ShrinkWindow_GetPillarboxMagnitude,0x80160C8C,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Letterbox_SetSizeTarget.s,ShrinkWindow_Letterbox_SetSizeTarget,0x80160C00,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Letterbox_GetSizeTarget.s,ShrinkWindow_Letterbox_GetSizeTarget,0x80160C14,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Letterbox_SetSize.s,ShrinkWindow_Letterbox_SetSize,0x80160C28,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Letterbox_GetSize.s,ShrinkWindow_Letterbox_GetSize,0x80160C3C,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Pillarbox_SetSizeTarget.s,ShrinkWindow_Pillarbox_SetSizeTarget,0x80160C50,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Pillarbox_GetSizeTarget.s,ShrinkWindow_Pillarbox_GetSizeTarget,0x80160C64,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Pillarbox_SetSize.s,ShrinkWindow_Pillarbox_SetSize,0x80160C78,0x5 +asm/non_matchings/code/z_shrink_window/ShrinkWindow_Pillarbox_GetSize.s,ShrinkWindow_Pillarbox_GetSize,0x80160C8C,0x5 asm/non_matchings/code/z_shrink_window/ShrinkWindow_Init.s,ShrinkWindow_Init,0x80160CA0,0xD asm/non_matchings/code/z_shrink_window/ShrinkWindow_Destroy.s,ShrinkWindow_Destroy,0x80160CD4,0x4 asm/non_matchings/code/z_shrink_window/ShrinkWindow_Update.s,ShrinkWindow_Update,0x80160CE4,0x2D