mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-11 17:30:25 +00:00
some changes, waiting on prs for the rest
This commit is contained in:
parent
4159b83cf1
commit
9dc6860e62
4 changed files with 49 additions and 6 deletions
|
@ -66,3 +66,23 @@ f32 __floatundisf(u32 c) {
|
|||
f64 __floatundidf(u32 c) {
|
||||
return (f64)c;
|
||||
}
|
||||
|
||||
f32 __powisf2(f32 a, s32 b) {
|
||||
const s32 recip = b < 0;
|
||||
f32 r = 1;
|
||||
|
||||
while (1) {
|
||||
if (b & 1) {
|
||||
r *= a;
|
||||
}
|
||||
|
||||
b /= 2;
|
||||
|
||||
if (b == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
a *= a;
|
||||
}
|
||||
return recip ? 1/r : r;
|
||||
}
|
|
@ -452,9 +452,15 @@ s16 EnZf_FindNextPlatformAwayFromPlayer(Vec3f* pos, s16 curPlatform, s16 arg2, G
|
|||
}
|
||||
}
|
||||
|
||||
// These functions have no side effects, so these two calls do nothing
|
||||
//! @bug `altNextPlatform` can be -1 in certain conditions and cause an out of bounds access.
|
||||
//! Under normal conditions, this doesn't cause problems because the data before `sPlatformPositions`
|
||||
//! is section padding between .text and .data, so 0 gets read as a float.
|
||||
//! Other compilers can shift things and result in a crash. Defining `AVOID_UB` will remove these function calls
|
||||
//! entirely as they are dead code and do not have any effect.
|
||||
#ifndef AVOID_UB
|
||||
Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[nextPlatform]);
|
||||
Math_Vec3f_DistXYZ(&player->actor.world.pos, &sPlatformPositions[altNextPlatform]);
|
||||
#endif
|
||||
|
||||
if (altNextPlatform > 0) {
|
||||
s16 nextPlatformToPlayerYaw =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue