mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2026-01-18 04:32:40 +00:00
Fix float value used to calculate clock angle to prevent overshooting every hour
This commit is contained in:
parent
d766cf328f
commit
00d0d06fa7
1 changed files with 8 additions and 0 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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue