1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-08 07:20:16 +00:00

Consistent naming for Math_ functions (#542)

* Darkmeiro decompilation

Bg_Gnd_Darkmeiro decompiled, matched, and documented.

* give this a shot

* fix conflict

* one more try

* could be useful

* whoops

* ZAP2 stuff

* ZAP why

* ZAP again

* maths

* Factoriali -> Factorial

* soon, soon

* renames

* rand

* docs

* merged

* formatting

* little more cleanup

* asm crept back in

* changes to MathF

* smooth criminal

* functions.h
This commit is contained in:
petrie911 2020-12-26 04:44:53 -06:00 committed by GitHub
parent 81c269b417
commit 8fa6cb6ff9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1329 changed files with 8413 additions and 8374 deletions

View file

@ -173,7 +173,7 @@ void func_80AE269C(EnRd* this) {
}
this->unk_31B = 0;
this->unk_30C = (Math_Rand_ZeroOne() * 10.0f) + 5.0f;
this->unk_30C = (Rand_ZeroOne() * 10.0f) + 5.0f;
this->actor.speedXZ = 0.0f;
this->actor.posRot.rot.y = this->actor.shape.rot.y;
EnRd_SetupAction(this, func_80AE2744);
@ -181,11 +181,11 @@ void func_80AE269C(EnRd* this) {
void func_80AE2744(EnRd* this, GlobalContext* globalCtx) {
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
Math_SmoothScaleMaxMinS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothScaleMaxMinS(&this->unk_310, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0);
if ((this->actor.params == 2) && (0.0f == this->skelAnime.animCurrentFrame)) {
if (Math_Rand_ZeroOne() >= 0.5f) {
if (Rand_ZeroOne() >= 0.5f) {
SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06005D98);
} else {
SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060057AC);
@ -193,7 +193,7 @@ void func_80AE2744(EnRd* this, GlobalContext* globalCtx) {
} else {
this->unk_30C--;
if (this->unk_30C == 0) {
this->unk_30C = (Math_Rand_ZeroOne() * 10.0f) + 10.0f;
this->unk_30C = (Rand_ZeroOne() * 10.0f) + 10.0f;
this->skelAnime.animCurrentFrame = 0.0f;
}
}
@ -244,8 +244,8 @@ void func_80AE2970(EnRd* this) {
// Rising out of coffin
void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) {
if (this->actor.shape.rot.x != -0x4000) {
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0);
if (Math_SmoothScaleMaxMinF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f, 2.0f, 0.3f) ==
Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0);
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f, 2.0f, 0.3f) ==
0.0f) {
this->actor.gravity = -3.5f;
func_80AE269C(this);
@ -254,13 +254,13 @@ void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) {
if (this->actor.posRot.pos.y == this->actor.initPosRot.pos.y) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_CRY);
}
if (Math_SmoothScaleMaxMinF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 50.0f, 0.3f, 2.0f,
if (Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 50.0f, 0.3f, 2.0f,
0.3f) == 0.0f) {
if (this->unk_30C != 0) {
this->unk_30C--;
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 6.0f, 0.3f, 1.0f, 0.3f);
} else if (Math_SmoothScaleMaxMinF(&this->actor.speedXZ, 0.0f, 0.3f, 1.0f, 0.3f) == 0.0f) {
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0);
Math_SmoothStepToF(&this->actor.speedXZ, 6.0f, 0.3f, 1.0f, 0.3f);
} else if (Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 0.3f, 1.0f, 0.3f) == 0.0f) {
Math_SmoothStepToS(&this->actor.shape.rot.x, 0, 1, 0x7D0, 0);
}
}
}
@ -282,9 +282,9 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) {
s16 sp32 = this->actor.yawTowardsLink - this->actor.shape.rot.y - this->unk_30E - this->unk_310;
this->skelAnime.animPlaybackSpeed = this->actor.speedXZ;
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 1, 0xFA, 0);
Math_SmoothScaleMaxMinS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothScaleMaxMinS(&this->unk_310, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsLink, 1, 0xFA, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0);
this->actor.posRot.rot.y = this->actor.shape.rot.y;
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
@ -345,10 +345,10 @@ void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) {
s16 targetY = func_8002DAC0(&this->actor, &this->actor.initPosRot.pos);
if (func_8002DB6C(&this->actor, &this->actor.initPosRot.pos) >= 5.0f) {
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, targetY, 1, 0x1C2, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, targetY, 1, 0x1C2, 0);
} else {
this->actor.speedXZ = 0.0f;
if (Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, this->actor.initPosRot.rot.y, 1, 0x1C2, 0) == 0) {
if (Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.initPosRot.rot.y, 1, 0x1C2, 0) == 0) {
if (this->actor.params != 2) {
func_80AE269C(this);
} else {
@ -357,8 +357,8 @@ void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) {
}
}
Math_SmoothScaleMaxMinS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothScaleMaxMinS(&this->unk_310, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0);
this->actor.posRot.rot.y = this->actor.shape.rot.y;
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
@ -396,7 +396,7 @@ void func_80AE3260(EnRd* this, GlobalContext* globalCtx) {
targetY = func_8002DAC0(&this->actor, &thisPos);
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, targetY, 1, 0xFA, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, targetY, 1, 0xFA, 0);
if (func_8002DB6C(&this->actor, &thisPos) >= 45.0f) {
this->actor.speedXZ = 0.4f;
@ -410,8 +410,8 @@ void func_80AE3260(EnRd* this, GlobalContext* globalCtx) {
}
}
Math_SmoothScaleMaxMinS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothScaleMaxMinS(&this->unk_310, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x64, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x64, 0);
} else {
func_80AE2B90(this, globalCtx);
}
@ -451,8 +451,8 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
func_800AA000(this->actor.xzDistFromLink, 0xFF, 1, 0xC);
this->unk_319 = 0x14;
case 0:
Math_SmoothScaleMaxMinS(&this->unk_30E, 0, 1, 0x5DC, 0);
Math_SmoothScaleMaxMinS(&this->unk_310, 0, 1, 0x5DC, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x5DC, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x5DC, 0);
case 2:
if (!(player->stateFlags2 & 0x80)) {
SkelAnime_ChangeAnim(&this->skelAnime, &D_060046F8, 0.5f, 0.0f, SkelAnime_GetFrameCount(&D_060046F8), 3,
@ -463,17 +463,17 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
}
if (LINK_IS_CHILD) {
Math_SmoothScaleMaxMinF(&this->actor.shape.unk_08, -1500.0f, 1.0f, 150.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.unk_08, -1500.0f, 1.0f, 150.0f, 0.0f);
}
Math_SmoothScaleMaxMinF(&this->actor.posRot.pos.x,
(Math_Sins(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.x, 1.0f,
Math_SmoothStepToF(&this->actor.posRot.pos.x,
(Math_SinS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.x, 1.0f,
10.0f, 0.0f);
Math_SmoothScaleMaxMinF(&this->actor.posRot.pos.y, player->actor.posRot.pos.y, 1.0f, 10.0f, 0.0f);
Math_SmoothScaleMaxMinF(&this->actor.posRot.pos.z,
(Math_Coss(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.z, 1.0f,
Math_SmoothStepToF(&this->actor.posRot.pos.y, player->actor.posRot.pos.y, 1.0f, 10.0f, 0.0f);
Math_SmoothStepToF(&this->actor.posRot.pos.z,
(Math_CosS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.z, 1.0f,
10.0f, 0.0f);
Math_SmoothScaleMaxMinS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0);
Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0);
if (this->skelAnime.animCurrentFrame == 0.0f) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_ATTACK);
@ -489,12 +489,12 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
break;
case 3:
if (LINK_IS_CHILD) {
Math_SmoothScaleMaxMinF(&this->actor.shape.unk_08, 0, 1.0f, 400.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.unk_08, 0, 1.0f, 400.0f, 0.0f);
}
break;
case 4:
if (LINK_IS_CHILD) {
Math_SmoothScaleMaxMinF(&this->actor.shape.unk_08, 0, 1.0f, 400.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.unk_08, 0, 1.0f, 400.0f, 0.0f);
}
this->actor.unk_1F = 0;
this->actor.flags |= 1;
@ -578,8 +578,8 @@ void func_80AE3B18(EnRd* this, GlobalContext* globalCtx) {
}
this->actor.posRot.rot.y = this->actor.yawTowardsLink;
Math_SmoothScaleMaxMinS(&this->unk_30E, 0, 1, 0x12C, 0);
Math_SmoothScaleMaxMinS(&this->unk_310, 0, 1, 0x12C, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x12C, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x12C, 0);
if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
this->actor.posRot.rot.y = this->actor.shape.rot.y;
@ -610,8 +610,8 @@ void func_80AE3C98(EnRd* this, GlobalContext* globalCtx) {
Actor_ChangeType(globalCtx, &globalCtx->actorCtx, &this->actor, ACTORTYPE_PROP);
}
Math_SmoothScaleMaxMinS(&this->unk_30E, 0, 1, 0x7D0, 0);
Math_SmoothScaleMaxMinS(&this->unk_310, 0, 1, 0x7D0, 0);
Math_SmoothStepToS(&this->unk_30E, 0, 1, 0x7D0, 0);
Math_SmoothStepToS(&this->unk_310, 0, 1, 0x7D0, 0);
if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) {
if (this->unk_30C == 0) {