mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-14 11:54:39 +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
|
@ -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++);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue