mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-29 03:34:07 +00:00
Doc shrink_window, rename system to Letterbox (#1341)
* docs * missed some hex * document Gfx_SetupFrame * review
This commit is contained in:
parent
dda78f9e2c
commit
fec5cd84af
24 changed files with 134 additions and 107 deletions
|
@ -1159,7 +1159,7 @@ Gfx* Gfx_TwoTexScroll(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 wi
|
|||
Gfx* Gfx_TwoTexScrollEnvColor(GraphicsContext* gfxCtx, s32 tile1, u32 x1, u32 y1, s32 width1, s32 height1, s32 tile2,
|
||||
u32 x2, u32 y2, s32 width2, s32 height2, s32 r, s32 g, s32 b, s32 a);
|
||||
Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a);
|
||||
void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b);
|
||||
void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b);
|
||||
void func_80095974(GraphicsContext* gfxCtx);
|
||||
void func_80095AA0(PlayState* play, Room* room, Input* arg2, UNK_TYPE arg3);
|
||||
void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 height, u8 fmt, u8 siz, u16 mode0,
|
||||
|
@ -1415,13 +1415,13 @@ void TransitionFade_Draw(void* thisx, Gfx** gfxP);
|
|||
s32 TransitionFade_IsDone(void* thisx);
|
||||
void TransitionFade_SetColor(void* thisx, u32 color);
|
||||
void TransitionFade_SetType(void* thisx, s32 type);
|
||||
void ShrinkWindow_SetVal(s32 value);
|
||||
u32 ShrinkWindow_GetVal(void);
|
||||
void ShrinkWindow_SetCurrentVal(s32 currentVal);
|
||||
u32 ShrinkWindow_GetCurrentVal(void);
|
||||
void ShrinkWindow_Init(void);
|
||||
void ShrinkWindow_Destroy(void);
|
||||
void ShrinkWindow_Update(s32 updateRate);
|
||||
void Letterbox_SetSizeTarget(s32 target);
|
||||
u32 Letterbox_GetSizeTarget(void);
|
||||
void Letterbox_SetSize(s32 size);
|
||||
u32 Letterbox_GetSize(void);
|
||||
void Letterbox_Init(void);
|
||||
void Letterbox_Destroy(void);
|
||||
void Letterbox_Update(s32 updateRate);
|
||||
// ? DbCamera_AddVecSph(?);
|
||||
// ? DbCamera_CalcUpFromPitchYawRoll(?);
|
||||
// ? DbCamera_SetTextValue(?);
|
||||
|
|
|
@ -2135,14 +2135,14 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
|
|||
} else if (CHECK_BTN_ALL(sPlay->state.input[2].press.button, BTN_CLEFT)) {
|
||||
sDbCamAnim.unk_0A = 0;
|
||||
Interface_ChangeAlpha(2);
|
||||
ShrinkWindow_SetVal(0);
|
||||
Letterbox_SetSizeTarget(0);
|
||||
D_8016110C = 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (func_800B91B0(cam, dbCamera) == 0) {
|
||||
Interface_ChangeAlpha(2);
|
||||
ShrinkWindow_SetVal(0);
|
||||
Letterbox_SetSizeTarget(0);
|
||||
Audio_PlaySfxGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
}
|
||||
|
@ -2301,7 +2301,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
|
|||
sDbCamAnim.unk_0A = 1;
|
||||
sDbCamAnim.unk_0C = 0;
|
||||
Interface_ChangeAlpha(50);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
D_8016110C = 0;
|
||||
Audio_PlaySfxGeneral(NA_SE_SY_HP_RECOVER, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
|
||||
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
|
||||
|
|
|
@ -1,79 +1,89 @@
|
|||
#include "global.h"
|
||||
|
||||
s32 D_8012CED0 = 0;
|
||||
typedef enum {
|
||||
/* 0 */ LETTERBOX_STATE_IDLE,
|
||||
/* 1 */ LETTERBOX_STATE_GROWING,
|
||||
/* 2 */ LETTERBOX_STATE_SHRINKING
|
||||
} LetterboxState;
|
||||
|
||||
s32 sShrinkWindowVal = 0;
|
||||
s32 sShrinkWindowCurrentVal = 0;
|
||||
s32 sLetterboxState = LETTERBOX_STATE_IDLE;
|
||||
|
||||
void ShrinkWindow_SetVal(s32 value) {
|
||||
s32 sLetterboxSizeTarget = 0;
|
||||
s32 sLetterboxSize = 0;
|
||||
|
||||
void Letterbox_SetSizeTarget(s32 target) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_setval(%d)\n", value);
|
||||
osSyncPrintf("shrink_window_setval(%d)\n", target);
|
||||
}
|
||||
sShrinkWindowVal = value;
|
||||
|
||||
sLetterboxSizeTarget = target;
|
||||
}
|
||||
|
||||
u32 ShrinkWindow_GetVal(void) {
|
||||
return sShrinkWindowVal;
|
||||
u32 Letterbox_GetSizeTarget(void) {
|
||||
return sLetterboxSizeTarget;
|
||||
}
|
||||
|
||||
void ShrinkWindow_SetCurrentVal(s32 currentVal) {
|
||||
void Letterbox_SetSize(s32 size) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_setnowval(%d)\n", currentVal);
|
||||
osSyncPrintf("shrink_window_setnowval(%d)\n", size);
|
||||
}
|
||||
sShrinkWindowCurrentVal = currentVal;
|
||||
|
||||
sLetterboxSize = size;
|
||||
}
|
||||
|
||||
u32 ShrinkWindow_GetCurrentVal(void) {
|
||||
return sShrinkWindowCurrentVal;
|
||||
u32 Letterbox_GetSize(void) {
|
||||
return sLetterboxSize;
|
||||
}
|
||||
|
||||
void ShrinkWindow_Init(void) {
|
||||
void Letterbox_Init(void) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_init()\n");
|
||||
}
|
||||
D_8012CED0 = 0;
|
||||
sShrinkWindowVal = 0;
|
||||
sShrinkWindowCurrentVal = 0;
|
||||
|
||||
sLetterboxState = LETTERBOX_STATE_IDLE;
|
||||
sLetterboxSizeTarget = 0;
|
||||
sLetterboxSize = 0;
|
||||
}
|
||||
|
||||
void ShrinkWindow_Destroy(void) {
|
||||
void Letterbox_Destroy(void) {
|
||||
if (HREG(80) == 0x13 && HREG(81) == 1) {
|
||||
osSyncPrintf("shrink_window_cleanup()\n");
|
||||
}
|
||||
sShrinkWindowCurrentVal = 0;
|
||||
|
||||
sLetterboxSize = 0;
|
||||
}
|
||||
|
||||
void ShrinkWindow_Update(s32 updateRate) {
|
||||
s32 off;
|
||||
void Letterbox_Update(s32 updateRate) {
|
||||
s32 step;
|
||||
|
||||
if (updateRate == 3) {
|
||||
off = 10;
|
||||
step = 10;
|
||||
} else {
|
||||
off = 30 / updateRate;
|
||||
step = 30 / updateRate;
|
||||
}
|
||||
|
||||
if (sShrinkWindowCurrentVal < sShrinkWindowVal) {
|
||||
if (D_8012CED0 != 1) {
|
||||
D_8012CED0 = 1;
|
||||
if (sLetterboxSize < sLetterboxSizeTarget) {
|
||||
if (sLetterboxState != LETTERBOX_STATE_GROWING) {
|
||||
sLetterboxState = LETTERBOX_STATE_GROWING;
|
||||
}
|
||||
|
||||
if (sShrinkWindowCurrentVal + off < sShrinkWindowVal) {
|
||||
sShrinkWindowCurrentVal += off;
|
||||
if (sLetterboxSize + step < sLetterboxSizeTarget) {
|
||||
sLetterboxSize += step;
|
||||
} else {
|
||||
sShrinkWindowCurrentVal = sShrinkWindowVal;
|
||||
sLetterboxSize = sLetterboxSizeTarget;
|
||||
}
|
||||
} else if (sShrinkWindowVal < sShrinkWindowCurrentVal) {
|
||||
if (D_8012CED0 != 2) {
|
||||
D_8012CED0 = 2;
|
||||
} else if (sLetterboxSizeTarget < sLetterboxSize) {
|
||||
if (sLetterboxState != LETTERBOX_STATE_SHRINKING) {
|
||||
sLetterboxState = LETTERBOX_STATE_SHRINKING;
|
||||
}
|
||||
|
||||
if (sShrinkWindowVal < sShrinkWindowCurrentVal - off) {
|
||||
sShrinkWindowCurrentVal -= off;
|
||||
if (sLetterboxSizeTarget < sLetterboxSize - step) {
|
||||
sLetterboxSize -= step;
|
||||
} else {
|
||||
sShrinkWindowCurrentVal = sShrinkWindowVal;
|
||||
sLetterboxSize = sLetterboxSizeTarget;
|
||||
}
|
||||
} else {
|
||||
D_8012CED0 = 0;
|
||||
sLetterboxState = LETTERBOX_STATE_IDLE;
|
||||
}
|
||||
|
||||
if (HREG(80) == 0x13) {
|
||||
|
@ -89,9 +99,10 @@ void ShrinkWindow_Update(s32 updateRate) {
|
|||
HREG(88) = 0;
|
||||
HREG(89) = 0;
|
||||
}
|
||||
HREG(83) = D_8012CED0;
|
||||
HREG(84) = sShrinkWindowCurrentVal;
|
||||
HREG(85) = sShrinkWindowVal;
|
||||
HREG(86) = off;
|
||||
|
||||
HREG(83) = sLetterboxState;
|
||||
HREG(84) = sLetterboxSize;
|
||||
HREG(85) = sLetterboxSizeTarget;
|
||||
HREG(86) = step;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -749,34 +749,34 @@ s32 Camera_CopyPREGToModeValues(Camera* camera) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#define SHRINKWIN_MASK (0xF000)
|
||||
#define SHRINKWINVAL_MASK (0x7000)
|
||||
#define SHRINKWIN_CURVAL (0x8000)
|
||||
#define LETTERBOX_MASK (0xF000)
|
||||
#define LETTERBOX_SIZE_MASK (0x7000)
|
||||
#define LETTERBOX_INSTANT (0x8000)
|
||||
#define IFACE_ALPHA_MASK (0x0F00)
|
||||
|
||||
void Camera_UpdateInterface(s16 flags) {
|
||||
s16 interfaceAlpha;
|
||||
|
||||
if ((flags & SHRINKWIN_MASK) != SHRINKWIN_MASK) {
|
||||
switch (flags & SHRINKWINVAL_MASK) {
|
||||
if ((flags & LETTERBOX_MASK) != LETTERBOX_MASK) {
|
||||
switch (flags & LETTERBOX_SIZE_MASK) {
|
||||
case 0x1000:
|
||||
sCameraShrinkWindowVal = 0x1A;
|
||||
sCameraLetterboxSize = 26;
|
||||
break;
|
||||
case 0x2000:
|
||||
sCameraShrinkWindowVal = 0x1B;
|
||||
sCameraLetterboxSize = 27;
|
||||
break;
|
||||
case 0x3000:
|
||||
sCameraShrinkWindowVal = 0x20;
|
||||
sCameraLetterboxSize = 32;
|
||||
break;
|
||||
default:
|
||||
sCameraShrinkWindowVal = 0;
|
||||
sCameraLetterboxSize = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (flags & SHRINKWIN_CURVAL) {
|
||||
ShrinkWindow_SetCurrentVal(sCameraShrinkWindowVal);
|
||||
if (flags & LETTERBOX_INSTANT) {
|
||||
Letterbox_SetSize(sCameraLetterboxSize);
|
||||
} else {
|
||||
ShrinkWindow_SetVal(sCameraShrinkWindowVal);
|
||||
Letterbox_SetSizeTarget(sCameraLetterboxSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6941,7 +6941,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState
|
|||
camera->xzOffsetUpdateRate = CAM_DATA_SCALED(OREG(2));
|
||||
camera->yOffsetUpdateRate = CAM_DATA_SCALED(OREG(3));
|
||||
camera->fovUpdateRate = CAM_DATA_SCALED(OREG(4));
|
||||
sCameraShrinkWindowVal = 0x20;
|
||||
sCameraLetterboxSize = 32;
|
||||
sCameraInterfaceAlpha = 0;
|
||||
camera->unk_14C = 0;
|
||||
camera->setting = camera->prevSetting = CAM_SET_FREE0;
|
||||
|
|
|
@ -2227,7 +2227,7 @@ s16 sNextUID = 0;
|
|||
s32 sCameraInterfaceFlags = 1;
|
||||
|
||||
s32 sCameraInterfaceAlpha = 0x02;
|
||||
s32 sCameraShrinkWindowVal = 0x20;
|
||||
s32 sCameraLetterboxSize = 32;
|
||||
s32 D_8011D3AC = -1;
|
||||
|
||||
s16 D_8011D3B0[] = {
|
||||
|
|
|
@ -188,7 +188,7 @@ u32 func_8006472C(PlayState* play, CutsceneContext* csCtx, f32 target) {
|
|||
|
||||
void func_80064760(PlayState* play, CutsceneContext* csCtx) {
|
||||
Interface_ChangeAlpha(1);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
|
||||
if (func_8006472C(play, csCtx, 1.0f)) {
|
||||
Audio_SetCutsceneFlag(1);
|
||||
|
@ -199,7 +199,7 @@ void func_80064760(PlayState* play, CutsceneContext* csCtx) {
|
|||
void func_800647C0(PlayState* play, CutsceneContext* csCtx) {
|
||||
func_80068C3C(play, csCtx);
|
||||
Interface_ChangeAlpha(1);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
|
||||
if (func_8006472C(play, csCtx, 1.0f)) {
|
||||
Audio_SetCutsceneFlag(1);
|
||||
|
@ -2018,8 +2018,8 @@ void func_80068ECC(PlayState* play, CutsceneContext* csCtx) {
|
|||
|
||||
if (gSaveContext.cutsceneTrigger == 0) {
|
||||
Interface_ChangeAlpha(1);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
ShrinkWindow_SetCurrentVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
Letterbox_SetSize(32);
|
||||
csCtx->state++;
|
||||
}
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ void GameOver_Update(PlayState* play) {
|
|||
gameOverCtx->state++;
|
||||
gGameOverTimer = 0;
|
||||
Environment_InitGameOverLights(play);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
return;
|
||||
|
||||
case GAMEOVER_REVIVE_RUMBLE:
|
||||
|
|
|
@ -58,7 +58,7 @@ void KaleidoScopeCall_Update(PlayState* play) {
|
|||
|
||||
if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) {
|
||||
if (pauseCtx->state == 1) {
|
||||
if (ShrinkWindow_GetCurrentVal() == 0) {
|
||||
if (Letterbox_GetSize() == 0) {
|
||||
HREG(80) = 7;
|
||||
HREG(82) = 3;
|
||||
R_PAUSE_MENU_MODE = 1;
|
||||
|
|
|
@ -53,8 +53,8 @@ void KaleidoSetup_Update(PlayState* play) {
|
|||
WREG(2) = -6240;
|
||||
R_UPDATE_RATE = 2;
|
||||
|
||||
if (ShrinkWindow_GetVal()) {
|
||||
ShrinkWindow_SetVal(0);
|
||||
if (Letterbox_GetSizeTarget() != 0) {
|
||||
Letterbox_SetSizeTarget(0);
|
||||
}
|
||||
|
||||
func_800F64E0(1);
|
||||
|
|
|
@ -196,7 +196,7 @@ void Play_Destroy(GameState* thisx) {
|
|||
this->transitionMode = TRANS_MODE_OFF;
|
||||
}
|
||||
|
||||
ShrinkWindow_Destroy();
|
||||
Letterbox_Destroy();
|
||||
TransitionFade_Destroy(&this->transitionFade);
|
||||
VisMono_Destroy(&D_80161498);
|
||||
|
||||
|
@ -383,7 +383,7 @@ void Play_Init(GameState* thisx) {
|
|||
this->transitionType = TRANS_TYPE_FADE_BLACK_SLOW;
|
||||
}
|
||||
|
||||
ShrinkWindow_Init();
|
||||
Letterbox_Init();
|
||||
TransitionFade_Init(&this->transitionFade);
|
||||
TransitionFade_SetType(&this->transitionFade, 3);
|
||||
TransitionFade_SetColor(&this->transitionFade, RGBA8(160, 160, 160, 255));
|
||||
|
@ -962,7 +962,7 @@ void Play_Update(PlayState* this) {
|
|||
SfxSource_UpdateAll(this);
|
||||
|
||||
PLAY_LOG(3777);
|
||||
ShrinkWindow_Update(R_UPDATE_RATE);
|
||||
Letterbox_Update(R_UPDATE_RATE);
|
||||
|
||||
PLAY_LOG(3783);
|
||||
TransitionFade_Update(&this->transitionFade, R_UPDATE_RATE);
|
||||
|
@ -1044,7 +1044,7 @@ void Play_Draw(PlayState* this) {
|
|||
gSPSegment(POLY_XLU_DISP++, 0x02, this->sceneSegment);
|
||||
gSPSegment(OVERLAY_DISP++, 0x02, this->sceneSegment);
|
||||
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
|
||||
if ((HREG(80) != 10) || (HREG(82) != 0)) {
|
||||
POLY_OPA_DISP = Play_SetFog(this, POLY_OPA_DISP);
|
||||
|
|
|
@ -33,7 +33,7 @@ void PreNMI_Draw(PreNMIState* this) {
|
|||
OPEN_DISPS(gfxCtx, "../z_prenmi.c", 96);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupDL_36Opa(gfxCtx);
|
||||
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(255, 255, 255, 1) << 16) | GPACK_RGBA5551(255, 255, 255, 1));
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, this->timer + 100, SCREEN_WIDTH - 1, this->timer + 100);
|
||||
|
|
|
@ -1438,28 +1438,39 @@ Gfx* Gfx_EnvColor(GraphicsContext* gfxCtx, s32 r, s32 g, s32 b, s32 a) {
|
|||
return displayList;
|
||||
}
|
||||
|
||||
void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
||||
/**
|
||||
* Sets up the frame for drawing.
|
||||
* Initializes the scissor region to full screen.
|
||||
* Set up the framebuffer and z-buffer.
|
||||
* The whole screen is filled with the color supplied as arguments.
|
||||
* Letterbox is also applied here, and will share the color of the screen base.
|
||||
*/
|
||||
void Gfx_SetupFrame(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
||||
OPEN_DISPS(gfxCtx, "../z_rcp.c", 2386);
|
||||
|
||||
// Set up the RDP render state for rectangles in FILL mode
|
||||
gSPDisplayList(POLY_OPA_DISP++, sFillSetupDL);
|
||||
gSPDisplayList(POLY_XLU_DISP++, sFillSetupDL);
|
||||
gSPDisplayList(OVERLAY_DISP++, sFillSetupDL);
|
||||
|
||||
// Set the scissor region to the full screen
|
||||
gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth, gScreenHeight);
|
||||
gDPSetScissor(POLY_XLU_DISP++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth, gScreenHeight);
|
||||
gDPSetScissor(OVERLAY_DISP++, G_SC_NON_INTERLACE, 0, 0, gScreenWidth, gScreenHeight);
|
||||
|
||||
// Set up the framebuffer, primitives will be drawn here
|
||||
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer);
|
||||
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer);
|
||||
gDPSetColorImage(POLY_XLU_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer);
|
||||
gDPSetColorImage(OVERLAY_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer);
|
||||
|
||||
// Set up the z-buffer
|
||||
gDPSetDepthImage(POLY_OPA_DISP++, gZBuffer);
|
||||
gDPSetDepthImage(POLY_XLU_DISP++, gZBuffer);
|
||||
gDPSetDepthImage(OVERLAY_DISP++, gZBuffer);
|
||||
|
||||
if ((R_PAUSE_MENU_MODE < 2) && (gTrnsnUnkState < 2)) {
|
||||
s32 ret = ShrinkWindow_GetCurrentVal();
|
||||
s32 letterboxSize = Letterbox_GetSize();
|
||||
|
||||
if (HREG(80) == 16) {
|
||||
if (HREG(95) != 16) {
|
||||
|
@ -1481,7 +1492,7 @@ void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
|||
}
|
||||
|
||||
if (HREG(81) & 1) {
|
||||
HREG(83) = ret;
|
||||
HREG(83) = letterboxSize;
|
||||
}
|
||||
|
||||
if (HREG(81) & 2) {
|
||||
|
@ -1491,7 +1502,7 @@ void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
|||
}
|
||||
|
||||
if (HREG(82) & 1) {
|
||||
ret = HREG(83);
|
||||
letterboxSize = HREG(83);
|
||||
}
|
||||
|
||||
if (HREG(82) & 2) {
|
||||
|
@ -1501,27 +1512,32 @@ void func_80095248(GraphicsContext* gfxCtx, u8 r, u8 g, u8 b) {
|
|||
}
|
||||
}
|
||||
|
||||
// Set the whole z buffer to maximum depth
|
||||
// Don't bother with pixels that are being covered by the letterbox
|
||||
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gZBuffer);
|
||||
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
|
||||
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_ZDZ(G_MAXFBZ, 0) << 16) | GPACK_ZDZ(G_MAXFBZ, 0));
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1);
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, letterboxSize, gScreenWidth - 1, gScreenHeight - letterboxSize - 1);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
// Fill the whole screen with the base color
|
||||
// Don't bother with pixels that are being covered by the letterbox
|
||||
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gScreenWidth, gfxCtx->curFrameBuffer);
|
||||
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
|
||||
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1));
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, ret, gScreenWidth - 1, gScreenHeight - ret - 1);
|
||||
gDPFillRectangle(POLY_OPA_DISP++, 0, letterboxSize, gScreenWidth - 1, gScreenHeight - letterboxSize - 1);
|
||||
gDPPipeSync(POLY_OPA_DISP++);
|
||||
|
||||
if (ret > 0) {
|
||||
// Draw the letterbox if applicable (uses the same color as the screen base)
|
||||
if (letterboxSize > 0) {
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
gDPSetCycleType(OVERLAY_DISP++, G_CYC_FILL);
|
||||
gDPSetRenderMode(OVERLAY_DISP++, G_RM_NOOP, G_RM_NOOP2);
|
||||
gDPSetFillColor(OVERLAY_DISP++, (GPACK_RGBA5551(r, g, b, 1) << 16) | GPACK_RGBA5551(r, g, b, 1));
|
||||
gDPFillRectangle(OVERLAY_DISP++, 0, 0, gScreenWidth - 1, ret - 1);
|
||||
gDPFillRectangle(OVERLAY_DISP++, 0, gScreenHeight - ret, gScreenWidth - 1, gScreenHeight - 1);
|
||||
gDPFillRectangle(OVERLAY_DISP++, 0, 0, gScreenWidth - 1, letterboxSize - 1);
|
||||
gDPFillRectangle(OVERLAY_DISP++, 0, gScreenHeight - letterboxSize, gScreenWidth - 1, gScreenHeight - 1);
|
||||
gDPPipeSync(OVERLAY_DISP++);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ void Sample_Draw(SampleState* this) {
|
|||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x01, this->staticSegment);
|
||||
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
|
||||
view->flags = VIEW_VIEWING | VIEW_VIEWPORT | VIEW_PROJECTION_PERSPECTIVE;
|
||||
View_Apply(view, VIEW_ALL);
|
||||
|
|
|
@ -135,7 +135,7 @@ void View_GetViewport(View* view, Viewport* viewport) {
|
|||
*viewport = view->viewport;
|
||||
}
|
||||
|
||||
void View_ApplyShrinkWindow(View* view) {
|
||||
void View_ApplyLetterbox(View* view) {
|
||||
s32 varY;
|
||||
s32 varX;
|
||||
s32 pad;
|
||||
|
@ -145,7 +145,7 @@ void View_ApplyShrinkWindow(View* view) {
|
|||
s32 lry;
|
||||
GraphicsContext* gfxCtx = view->gfxCtx;
|
||||
|
||||
varY = ShrinkWindow_GetCurrentVal();
|
||||
varY = Letterbox_GetSize();
|
||||
|
||||
varX = -1; // The following is optimized to varX = 0 but affects codegen
|
||||
|
||||
|
@ -296,7 +296,7 @@ s32 View_ApplyPerspective(View* view) {
|
|||
View_ViewportToVp(vp, &view->viewport);
|
||||
view->vp = *vp;
|
||||
|
||||
View_ApplyShrinkWindow(view);
|
||||
View_ApplyLetterbox(view);
|
||||
|
||||
gSPViewport(POLY_OPA_DISP++, vp);
|
||||
gSPViewport(POLY_XLU_DISP++, vp);
|
||||
|
@ -398,7 +398,7 @@ s32 View_ApplyOrtho(View* view) {
|
|||
View_ViewportToVp(vp, &view->viewport);
|
||||
view->vp = *vp;
|
||||
|
||||
View_ApplyShrinkWindow(view);
|
||||
View_ApplyLetterbox(view);
|
||||
|
||||
gSPViewport(POLY_OPA_DISP++, vp);
|
||||
gSPViewport(POLY_XLU_DISP++, vp);
|
||||
|
|
|
@ -790,7 +790,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) {
|
|||
tent_shake:
|
||||
case MO_TENT_SHAKE:
|
||||
if (this->timers[0] == 138) {
|
||||
ShrinkWindow_SetVal(0);
|
||||
Letterbox_SetSizeTarget(0);
|
||||
Interface_ChangeAlpha(0xB);
|
||||
}
|
||||
if ((this->timers[0] % 8) == 0) {
|
||||
|
|
|
@ -470,7 +470,7 @@ void func_80A79C78(EnIn* this, PlayState* play) {
|
|||
}
|
||||
player->actor.freezeTimer = 10;
|
||||
this->actor.flags &= ~ACTOR_FLAG_0;
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
Interface_ChangeAlpha(2);
|
||||
}
|
||||
|
||||
|
@ -791,7 +791,7 @@ void func_80A7AA40(EnIn* this, PlayState* play) {
|
|||
this->unk_308.unk_00 = 1;
|
||||
this->unk_1FC = 0;
|
||||
play->csCtx.frames = 0;
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
Interface_ChangeAlpha(2);
|
||||
this->actionFunc = func_80A7ABD4;
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ void func_80B4B010(EnZl1* this, PlayState* play) {
|
|||
play->envCtx.fillScreen = true;
|
||||
Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye);
|
||||
Play_CameraSetFov(play, this->subCamId, 30.0f);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
Interface_ChangeAlpha(2);
|
||||
player->actor.world.pos = playerPos;
|
||||
player->actor.speedXZ = 0.0f;
|
||||
|
|
|
@ -329,7 +329,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, PlayState* play) {
|
|||
player->linearVelocity = playerx->speedXZ = 0.0f;
|
||||
|
||||
EnZl4_SetActiveCamMove(play, 5);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
Interface_ChangeAlpha(2);
|
||||
this->talkTimer2 = 0;
|
||||
return true;
|
||||
|
@ -1151,7 +1151,7 @@ void EnZl4_Cutscene(EnZl4* this, PlayState* play) {
|
|||
Audio_PlayFanfare(NA_BGM_APPEAR);
|
||||
EnZl4_SetActiveCamDir(play, 0);
|
||||
Interface_ChangeAlpha(2);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
this->talkState = 0;
|
||||
this->csState++;
|
||||
break;
|
||||
|
|
|
@ -5246,7 +5246,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) {
|
|||
}
|
||||
|
||||
case 2:
|
||||
ShrinkWindow_SetVal(0x1B);
|
||||
Letterbox_SetSizeTarget(27);
|
||||
|
||||
spFC.x = sLurePos.x - player->actor.world.pos.x;
|
||||
spFC.z = sLurePos.z - player->actor.world.pos.z;
|
||||
|
|
|
@ -2972,7 +2972,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) {
|
|||
}
|
||||
|
||||
OnePointCutscene_Init(play, 9806, cond ? 120 : 60, &this->actor, CAM_ID_MAIN);
|
||||
ShrinkWindow_SetVal(0x20);
|
||||
Letterbox_SetSizeTarget(32);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1606,7 +1606,7 @@ void FileSelect_Main(GameState* thisx) {
|
|||
gSPSegment(POLY_OPA_DISP++, 0x01, this->staticSegment);
|
||||
gSPSegment(POLY_OPA_DISP++, 0x02, this->parameterSegment);
|
||||
|
||||
func_80095248(this->state.gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(this->state.gfxCtx, 0, 0, 0);
|
||||
|
||||
this->stickRelX = input->rel.stick_x;
|
||||
this->stickRelY = input->rel.stick_y;
|
||||
|
@ -1825,7 +1825,7 @@ void FileSelect_InitContext(GameState* thisx) {
|
|||
this->unk_1CAD6[3] = 8;
|
||||
this->unk_1CAD6[4] = 10;
|
||||
|
||||
ShrinkWindow_SetVal(0);
|
||||
Letterbox_SetSizeTarget(0);
|
||||
|
||||
gSaveContext.skyboxTime = CLOCK_TIME(0, 0);
|
||||
gSaveContext.dayTime = CLOCK_TIME(0, 0);
|
||||
|
|
|
@ -22,7 +22,7 @@ void func_80803C5C(TitleSetupState* this) {
|
|||
void TitleSetup_Main(GameState* thisx) {
|
||||
TitleSetupState* this = (TitleSetupState*)thisx;
|
||||
|
||||
func_80095248(this->state.gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(this->state.gfxCtx, 0, 0, 0);
|
||||
TitleSetup_SetupTitleScreen(this);
|
||||
func_80803C5C(this);
|
||||
}
|
||||
|
|
|
@ -650,7 +650,7 @@ void MapSelect_DrawMenu(MapSelectState* this) {
|
|||
OPEN_DISPS(gfxCtx, "../z_select.c", 930);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
SET_FULLSCREEN_VIEWPORT(&this->view);
|
||||
View_Apply(&this->view, VIEW_ALL);
|
||||
Gfx_SetupDL_28Opa(gfxCtx);
|
||||
|
@ -674,7 +674,7 @@ void MapSelect_DrawLoadingScreen(MapSelectState* this) {
|
|||
OPEN_DISPS(gfxCtx, "../z_select.c", 977);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
SET_FULLSCREEN_VIEWPORT(&this->view);
|
||||
View_Apply(&this->view, VIEW_ALL);
|
||||
Gfx_SetupDL_28Opa(gfxCtx);
|
||||
|
@ -695,7 +695,7 @@ void MapSelect_Draw(MapSelectState* this) {
|
|||
OPEN_DISPS(gfxCtx, "../z_select.c", 1013);
|
||||
|
||||
gSPSegment(POLY_OPA_DISP++, 0x00, NULL);
|
||||
func_80095248(gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(gfxCtx, 0, 0, 0);
|
||||
SET_FULLSCREEN_VIEWPORT(&this->view);
|
||||
View_Apply(&this->view, VIEW_ALL);
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ void ConsoleLogo_Main(GameState* thisx) {
|
|||
|
||||
gSPSegment(POLY_OPA_DISP++, 0, NULL);
|
||||
gSPSegment(POLY_OPA_DISP++, 1, this->staticSegment);
|
||||
func_80095248(this->state.gfxCtx, 0, 0, 0);
|
||||
Gfx_SetupFrame(this->state.gfxCtx, 0, 0, 0);
|
||||
ConsoleLogo_Calc(this);
|
||||
ConsoleLogo_Draw(this);
|
||||
|
||||
|
|
Loading…
Reference in a new issue