Clear the framebuffer for the pause menu link texture (#4213)

* clear pause menu link framebuffer

* cache bust

* Add enums for pause menu link width/height and rename the framebuffer

* revert cache bust
This commit is contained in:
Archez 2024-06-15 23:13:13 -04:00 committed by GitHub
commit cd7c5ab316
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 45 additions and 23 deletions

View file

@ -239,16 +239,15 @@ void GameState_ReqPadData(GameState* gameState) {
PadMgr_RequestPadData(&gPadMgr, &gameState->input[0], 1);
}
// OTRTODO
int fbTest = -1;
// Framebuffer for the Link preview on the pause menu equipment sub-screen
int gPauseLinkFrameBuffer = -1;
void GameState_Update(GameState* gameState) {
GraphicsContext* gfxCtx = gameState->gfxCtx;
if (fbTest == -1)
{
fbTest = gfx_create_framebuffer(64, 112, SCREEN_WIDTH, SCREEN_HEIGHT, true);
//fbTest = gfx_create_framebuffer(256, 512);
if (gPauseLinkFrameBuffer == -1) {
gPauseLinkFrameBuffer = gfx_create_framebuffer(PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT,
PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, true);
}
GameState_SetFrameBuffer(gfxCtx);

View file

@ -2075,10 +2075,12 @@ void Pause_DrawTriforceSpot(PlayState* play, s32 showLightColumn) {
rotation += 0x03E8;
}
void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime* skelAnime, Vec3f* pos, Vec3s* rot,
f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height, Vec3f* eye, Vec3f* at,
f32 fovy, void* img1, void* img2) {
static Vp viewport = { 128, 224, 511, 0, 128, 224, 511, 0 };
void Player_DrawPauseImpl(PlayState* play, void* gameplayKeep, void* linkObject, SkelAnime* skelAnime, Vec3f* pos,
Vec3s* rot, f32 scale, s32 sword, s32 tunic, s32 shield, s32 boots, s32 width, s32 height,
Vec3f* eye, Vec3f* at, f32 fovy, void* colorFrameBuffer, void* depthFrameBuffer) {
// Note: the viewport x and y values are overwritten below, before usage
static Vp viewport = { (PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0,
(PAUSE_EQUIP_PLAYER_WIDTH / 2) << 2, (PAUSE_EQUIP_PLAYER_HEIGHT / 2) << 2, G_MAXZ / 2, 0 };
static Lights1 lights1 = gdSPDefLights1(80, 80, 80, 255, 255, 255, 84, 84, 172);
static Vec3f lightDir = { 89.8f, 0.0f, 89.8f };
u8 playerSwordAndShield[2];
@ -2106,6 +2108,24 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime*
gDPSetScissor(POLY_OPA_DISP++, G_SC_NON_INTERLACE, 0, 0, width, height);
gSPClipRatio(POLY_OPA_DISP++, FRUSTRATIO_1);
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, depthFrameBuffer);
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, 0, width - 1, height - 1);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetColorImage(POLY_OPA_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, colorFrameBuffer);
gDPSetCycleType(POLY_OPA_DISP++, G_CYC_FILL);
gDPSetRenderMode(POLY_OPA_DISP++, G_RM_NOOP, G_RM_NOOP2);
gDPSetFillColor(POLY_OPA_DISP++, (GPACK_RGBA5551(0, 0, 0, 1) << 16) | GPACK_RGBA5551(0, 0, 0, 1));
gDPFillRectangle(POLY_OPA_DISP++, 0, 0, width - 1, height - 1);
gDPPipeSync(POLY_OPA_DISP++);
gDPSetDepthImage(POLY_OPA_DISP++, depthFrameBuffer);
viewport.vp.vscale[0] = viewport.vp.vtrans[0] = width * 2;
viewport.vp.vscale[1] = viewport.vp.vtrans[1] = height * 2;
gSPViewport(POLY_OPA_DISP++, &viewport);
@ -2126,8 +2146,8 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime*
pos->y - (CVarGetInteger(CVAR_GENERAL("PauseTriforce"), 0) ? 16 : 0), pos->z, rot);
Matrix_Scale(scale * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), scale, scale, MTXMODE_APPLY);
gSPSegment(POLY_OPA_DISP++, 0x04, seg04);
gSPSegment(POLY_OPA_DISP++, 0x06, seg06);
gSPSegment(POLY_OPA_DISP++, 0x04, gameplayKeep);
gSPSegment(POLY_OPA_DISP++, 0x06, linkObject);
gSPSetLights1(POLY_OPA_DISP++, lights1);
@ -2401,8 +2421,8 @@ void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f*
}
}
Player_DrawPauseImpl(play, segment + 0x3800, segment + 0x8800, skelAnime, pos, rot, scale, sword, tunic, shield,
boots, 64, 112, &eye, &at, 60.0f, play->state.gfxCtx->curFrameBuffer,
play->state.gfxCtx->curFrameBuffer + 0x1C00);
boots, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, &eye, &at, 60.0f,
play->state.gfxCtx->curFrameBuffer,
play->state.gfxCtx->curFrameBuffer + (PAUSE_EQUIP_PLAYER_WIDTH * PAUSE_EQUIP_PLAYER_HEIGHT));
}