mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
View & Shrink_Window Docs (#1049)
* view and shrink_window docs * cleanup * move func declaration to header * move struct to local * PR Suggestions * g to s
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "global.h"
|
||||
#include "z64quake.h"
|
||||
#include "z64shrink_window.h"
|
||||
#include "z64view.h"
|
||||
|
||||
/**
|
||||
* Returns the absolute value for floats
|
||||
|
||||
+5
-4
@@ -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++;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "global.h"
|
||||
#include "z64shrink_window.h"
|
||||
|
||||
#pragma GLOBAL_ASM("asm/non_matchings/code/z_eventmgr/func_800F1460.s")
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
+5
-4
@@ -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,
|
||||
|
||||
+50
-43
@@ -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++;
|
||||
|
||||
+142
-105
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user