Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Sets up the frame for drawing.
- * <some explanation here of the first part>
- * 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);
- gSPDisplayList(POLY_OPA_DISP++, sFillSetupDL);
- gSPDisplayList(POLY_XLU_DISP++, sFillSetupDL);
- gSPDisplayList(OVERLAY_DISP++, sFillSetupDL);
- // whats this doing?
- 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);
- // whats this doing?
- 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);
- // whats this doing?
- gDPSetDepthImage(POLY_OPA_DISP++, gZBuffer);
- gDPSetDepthImage(POLY_XLU_DISP++, gZBuffer);
- gDPSetDepthImage(OVERLAY_DISP++, gZBuffer);
- if ((R_PAUSE_MENU_MODE < 2) && (gTrnsnUnkState < 2)) {
- s32 letterboxSize = Letterbox_GetSize();
- if (HREG(80) == 16) {
- if (HREG(95) != 16) {
- HREG(81) = 3;
- HREG(82) = 3;
- HREG(83) = 0;
- HREG(84) = 0;
- HREG(85) = 0;
- HREG(86) = 0;
- HREG(87) = 0;
- HREG(88) = 0;
- HREG(89) = 0;
- HREG(90) = 0;
- HREG(91) = 0;
- HREG(92) = 0;
- HREG(93) = 0;
- HREG(94) = 0;
- HREG(95) = 16;
- }
- if (HREG(81) & 1) {
- HREG(83) = letterboxSize;
- }
- if (HREG(81) & 2) {
- HREG(84) = r;
- HREG(85) = g;
- HREG(86) = b;
- }
- if (HREG(82) & 1) {
- letterboxSize = HREG(83);
- }
- if (HREG(82) & 2) {
- r = HREG(84);
- g = HREG(85);
- b = HREG(86);
- }
- }
- // Set the whole z buffer to maximum depth.
- // Dont 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, letterboxSize, gScreenWidth - 1, gScreenHeight - letterboxSize - 1);
- gDPPipeSync(POLY_OPA_DISP++);
- // Fill the whole screen with the base color.
- // Dont 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, letterboxSize, gScreenWidth - 1, gScreenHeight - letterboxSize - 1);
- gDPPipeSync(POLY_OPA_DISP++);
- // Draw the letterbox if applicable.
- // Use 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, letterboxSize - 1);
- gDPFillRectangle(OVERLAY_DISP++, 0, gScreenHeight - letterboxSize, gScreenWidth - 1, gScreenHeight - 1);
- gDPPipeSync(OVERLAY_DISP++);
- }
- }
- CLOSE_DISPS(gfxCtx, "../z_rcp.c", 2497);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement