diff options
| author | Archez <Archez@users.noreply.github.com> | 2024-06-15 23:13:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-15 23:13:13 -0400 |
| commit | cd7c5ab316cb3f48bedea399e1adda2cd28f75e0 (patch) | |
| tree | 48c2f6292026171f85bfc467b2e7036d0b6244a9 /soh/src | |
| parent | 4441304dfd5706f335d2ee9418b6e4373262c752 (diff) | |
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
Diffstat (limited to 'soh/src')
| -rw-r--r-- | soh/src/code/game.c | 11 | ||||
| -rw-r--r-- | soh/src/code/z_player_lib.c | 38 | ||||
| -rw-r--r-- | soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c | 10 | ||||
| -rw-r--r-- | soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c | 4 |
4 files changed, 41 insertions, 22 deletions
diff --git a/soh/src/code/game.c b/soh/src/code/game.c index aa0670a21..e1974ed98 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -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); diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index b9ef17f6e..4b790122f 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -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)); } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index 99ba5df72..116ad0c3c 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -27,6 +27,8 @@ static Vtx sStrengthAButtonVtx[] = { static s16 sEquipTimer = 0; +extern int gPauseLinkFrameBuffer; + void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u32 height) { PauseContext* pauseCtx = &play->pauseCtx; u8* curTexture; @@ -70,13 +72,12 @@ void KaleidoScope_DrawEquipmentImage(PlayState* play, void* source, u32 width, u for (i = 0; i < textureCount; i++) { gSPVertex(POLY_KAL_DISP++, &pauseCtx->equipVtx[vtxIndex], 4, 0); - extern int fbTest; gDPSetTextureImage(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, curTexture); gDPLoadSync(POLY_KAL_DISP++); gDPLoadTile(POLY_KAL_DISP++, G_TX_LOADTILE, 0, 0, (width - 1) << 2, (textureHeight - 1) << 2); - gDPSetTextureImageFB(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, fbTest); + gDPSetTextureImageFB(POLY_KAL_DISP++, G_IM_FMT_RGBA, G_IM_SIZ_16b, width, gPauseLinkFrameBuffer); gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0); curTexture += textureSize; @@ -185,8 +186,7 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) { link_kaleido_rot.x = 0; - extern int fbTest; - gsSPSetFB(play->state.gfxCtx->polyOpa.p++, fbTest); + gsSPSetFB(play->state.gfxCtx->polyOpa.p++, gPauseLinkFrameBuffer); Player_DrawPause(play, pauseCtx->playerSegment, &pauseCtx->playerSkelAnime, &pos, &link_kaleido_rot, scale, SWORD_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)), TUNIC_EQUIP_TO_PLAYER(CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)), @@ -852,7 +852,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { //gSPSegment(POLY_KAL_DISP++, 0x0C, pauseCtx->iconItemAltSegment); Gfx_SetupDL_42Kal(play->state.gfxCtx); - KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, 64, 112); + KaleidoScope_DrawEquipmentImage(play, pauseCtx->playerSegment, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT); if (gUpgradeMasks[0]) {} diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 424c823d6..a8b7536f0 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -929,7 +929,6 @@ static void* sPromptChoiceTexs[][2] = { static u8 sButtonStatusSave[ARRAY_COUNT(gSaveContext.buttonStatus)]; static PreRender sPlayerPreRender; static void* sPreRenderCvg; -extern int fbTest; void KaleidoScope_ProcessPlayerPreRender(void) { PreRender_Calc(&sPlayerPreRender); @@ -3725,7 +3724,8 @@ void KaleidoScope_Update(PlayState* play) sPreRenderCvg = (void*)(((uintptr_t)pauseCtx->nameSegment + 0x400 + 0xA00 + 0xF) & ~0xF); PreRender_Init(&sPlayerPreRender); - PreRender_SetValuesSave(&sPlayerPreRender, 64, 112, pauseCtx->playerSegment, NULL, sPreRenderCvg); + PreRender_SetValuesSave(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, + pauseCtx->playerSegment, NULL, sPreRenderCvg); KaleidoScope_DrawPlayerWork(play); //KaleidoScope_SetupPlayerPreRender(play); |
