mirror of
https://github.com/MonsterDruide1/OdysseyDecomp
synced 2026-04-23 09:04:21 +00:00
all: Replace custom impl with sead::Mathf::floor (#776)
This commit is contained in:
parent
79ab80f6bb
commit
000c3aadd7
|
|
@ -503,9 +503,8 @@ f32 calcFourthOrderRate(f32 t, f32 scale) {
|
|||
|
||||
f32 calcTriangleWave01(f32 t, f32 period) {
|
||||
f32 val = t / (2 * period);
|
||||
s32 rounded = (s32)val + (((s32)val == val) ? 0 : -!(val >= 0.0f));
|
||||
|
||||
val = sead::Mathf::abs(val - rounded - 0.5f);
|
||||
val = sead::Mathf::abs(val - sead::Mathf::floor(val) - 0.5f);
|
||||
return 1.0f - (2 * val);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,15 +45,10 @@ void BigBirdStateWait::appear() {
|
|||
al::setNerve(this, getWaitInitNerve());
|
||||
}
|
||||
|
||||
// TODO: might be a `sead` function?
|
||||
static s32 floorToInt(f32 x) {
|
||||
s32 r = static_cast<s32>(x);
|
||||
return r == x ? r : r + (x >= 0 ? 0 : -1);
|
||||
}
|
||||
|
||||
static void setRandomFrame(al::LiveActor* actor) {
|
||||
al::setActionFrame(actor, floorToInt(al::getActionFrameMax(actor, al::getActionName(actor)) *
|
||||
al::getRandom(0.25f, 0.75f)));
|
||||
al::setActionFrame(actor,
|
||||
sead::Mathf::floor(al::getActionFrameMax(actor, al::getActionName(actor)) *
|
||||
al::getRandom(0.25f, 0.75f)));
|
||||
}
|
||||
|
||||
static f32 getTurnFrameRate(f32 angle) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue