mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2025-10-30 08:03:03 +00:00
Misc in-game HUD fixes (#571)
* Fix float value used to calculate clock angle to prevent overshooting every hour * Change addressing mode on title card rect to prevent wrapping on the left edge when HD textures are in use * Center the moon fall countdown timer
This commit is contained in:
parent
d766cf328f
commit
c27300e6c8
2 changed files with 22 additions and 2 deletions
|
|
@ -2,6 +2,7 @@
|
|||
#include "misc_funcs.h"
|
||||
#include "transform_ids.h"
|
||||
#include "loadfragment.h"
|
||||
#include "libc/math.h"
|
||||
|
||||
void Main_ClearMemory(void* begin, void* end);
|
||||
void Main_InitMemory(void);
|
||||
|
|
@ -40,6 +41,13 @@ RECOMP_PATCH void Main_Init(void) {
|
|||
gDmaMgrDmaBuffSize = prevSize;
|
||||
|
||||
Main_ClearMemory(SEGMENT_BSS_START(code), SEGMENT_BSS_END(code));
|
||||
|
||||
// @recomp Patch a float that's used to render the clock into the correct value.
|
||||
// This is done this way instead of patching the function to avoid conflicts with mods that need to patch the function.
|
||||
// The original code is `Matrix_RotateZF(-(timeInSeconds * 0.0175f) / 10.0f, MTXMODE_APPLY);`, where 0.0175f is being used
|
||||
// to convert degrees to radians. However, the correct value is PI/180 which is approximately 0.0174533f, and the difference is enough
|
||||
// to cause the clock to overshoot when reaching an hour mark.
|
||||
*(f32*)0x801DDBBC = ((f32)M_PI) / 180.0f;
|
||||
}
|
||||
|
||||
void Overlay_Relocate(void* allocatedRamAddr, OverlayRelocationSection* ovlRelocs, uintptr_t vramStart);
|
||||
|
|
|
|||
|
|
@ -633,6 +633,16 @@ RECOMP_PATCH void Interface_Draw(PlayState* play) {
|
|||
Interface_SetOrthoView(interfaceCtx);
|
||||
|
||||
Interface_DrawMinigameIcons(play);
|
||||
|
||||
// @recomp If the moon crash timer is running, center align timers and shift down.
|
||||
bool moon_crash_timer_running = gSaveContext.timerStates[TIMER_ID_MOON_CRASH] != TIMER_STATE_OFF;
|
||||
if (moon_crash_timer_running) {
|
||||
// @recomp Use normal alignment and shift down for clock
|
||||
gEXSetRectAlign(OVERLAY_DISP++, G_EX_ORIGIN_NONE, G_EX_ORIGIN_NONE, 0, margin_reduction * 4, 0, margin_reduction * 4);
|
||||
gEXSetViewportAlign(OVERLAY_DISP++, G_EX_ORIGIN_NONE, 0, margin_reduction * 4);
|
||||
Interface_SetOrthoView(interfaceCtx);
|
||||
}
|
||||
|
||||
Interface_DrawTimers(play);
|
||||
|
||||
// @recomp Restore normal alignment and shift down for minigame countdown or clock
|
||||
|
|
@ -1201,8 +1211,10 @@ RECOMP_PATCH void Message_DrawSceneTitleCard(PlayState* play, Gfx** gfxP) {
|
|||
gDPSetAlphaDither(gfx++, G_AD_NOTPATTERN);
|
||||
gDPSetPrimColor(gfx++, 0, 0, 0, 0, 0, msgCtx->textboxColorAlphaCurrent);
|
||||
gDPSetEnvColor(gfx++, 140, 40, 160, 255);
|
||||
gDPLoadTextureBlock(gfx++, gSceneTitleCardGradientTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 1, 0, G_TX_NOMIRROR | G_TX_WRAP,
|
||||
G_TX_NOMIRROR | G_TX_WRAP, 6, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
// @recomp Use clamp as the addressing mode to prevent the texture from wrapping on the left edge, which can be visible
|
||||
// if HD textures are in use.
|
||||
gDPLoadTextureBlock(gfx++, gSceneTitleCardGradientTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 1, 0, G_TX_NOMIRROR | G_TX_CLAMP,
|
||||
G_TX_NOMIRROR | G_TX_CLAMP, 6, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD);
|
||||
// @recomp Decrease dsdx from the original 204 to 200 in order to hide the glitching on the right edge.
|
||||
gSPTextureRectangle(gfx++, 0, XREG(77) << 2, 320 << 2, (XREG(77) + XREG(76)) << 2, G_TX_RENDERTILE, 0, 0, 200,
|
||||
1 << 10);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue