1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-06 06:10:21 +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

@ -104,13 +104,13 @@ void EnSt_SpawnDust(EnSt* this, GlobalContext* globalCtx, s32 dustCnt) {
s16 yAngle;
s32 i;
yAngle = (Math_Rand_ZeroOne() - 0.5f) * 65536.0f;
yAngle = (Rand_ZeroOne() - 0.5f) * 65536.0f;
dustPos.y = this->actor.groundY;
for (i = dustCnt; i >= 0; i--, yAngle += (s16)(0x10000 / dustCnt)) {
dustAccel.x = (Math_Rand_ZeroOne() - 0.5f) * 4.0f;
dustAccel.z = (Math_Rand_ZeroOne() - 0.5f) * 4.0f;
dustPos.x = this->actor.posRot.pos.x + (Math_Sins(yAngle) * 22.0f);
dustPos.z = this->actor.posRot.pos.z + (Math_Coss(yAngle) * 22.0f);
dustAccel.x = (Rand_ZeroOne() - 0.5f) * 4.0f;
dustAccel.z = (Rand_ZeroOne() - 0.5f) * 4.0f;
dustPos.x = this->actor.posRot.pos.x + (Math_SinS(yAngle) * 22.0f);
dustPos.z = this->actor.posRot.pos.z + (Math_CosS(yAngle) * 22.0f);
func_8002836C(globalCtx, &dustPos, &dustVel, &dustAccel, &primColor, &envColor, 120, 40, 10);
}
}
@ -130,9 +130,9 @@ void EnSt_SpawnDeadEffect(EnSt* this, GlobalContext* globalCtx) {
Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
Vec3f firePos;
firePos.x = this->actor.posRot.pos.x + ((Math_Rand_ZeroOne() - 0.5f) * 60.0f);
firePos.y = (this->actor.posRot.pos.y + 10.0f) + ((Math_Rand_ZeroOne() - 0.5f) * 45.0f);
firePos.z = this->actor.posRot.pos.z + ((Math_Rand_ZeroOne() - 0.5f) * 60.0f);
firePos.x = this->actor.posRot.pos.x + ((Rand_ZeroOne() - 0.5f) * 60.0f);
firePos.y = (this->actor.posRot.pos.y + 10.0f) + ((Rand_ZeroOne() - 0.5f) * 45.0f);
firePos.z = this->actor.posRot.pos.z + ((Rand_ZeroOne() - 0.5f) * 60.0f);
EffectSsDeadDb_Spawn(globalCtx, &firePos, &zeroVec, &zeroVec, 100, 0, 255, 255, 255, 255, 255, 0, 0, 1, 9, true);
}
@ -506,9 +506,9 @@ s32 EnSt_SetTeethColor(EnSt* this, s16 redTarget, s16 greenTarget, s16 blueTarge
minMaxStep = 1;
}
Math_SmoothScaleMaxMinS(&red, redTarget, 1, minMaxStep, minMaxStep);
Math_SmoothScaleMaxMinS(&green, greenTarget, 1, minMaxStep, minMaxStep);
Math_SmoothScaleMaxMinS(&blue, blueTarget, 1, minMaxStep, minMaxStep);
Math_SmoothStepToS(&red, redTarget, 1, minMaxStep, minMaxStep);
Math_SmoothStepToS(&green, greenTarget, 1, minMaxStep, minMaxStep);
Math_SmoothStepToS(&blue, blueTarget, 1, minMaxStep, minMaxStep);
this->teethR = red;
this->teethG = green;
this->teethB = blue;
@ -582,7 +582,7 @@ void EnSt_UpdateYaw(EnSt* this, GlobalContext* globalCtx) {
yawTarget = (this->actionFunc == EnSt_WaitOnGround ? this->actor.yawTowardsLink : this->initalYaw);
yawDiff = rot.y - (yawTarget ^ yawDir);
if (ABS(yawDiff) <= 0x4000) {
Math_SmoothScaleMaxMinS(&rot.y, yawTarget ^ yawDir, 4, 0x2000, 1);
Math_SmoothStepToS(&rot.y, yawTarget ^ yawDir, 4, 0x2000, 1);
} else {
rot.y += 0x2000;
}
@ -641,7 +641,7 @@ void EnSt_Bob(EnSt* this, GlobalContext* globalCtx) {
if ((globalCtx->state.frames & 8) != 0) {
ySpeedTarget *= -1.0f;
}
Math_SmoothScaleMaxMinF(&this->actor.velocity.y, ySpeedTarget, 0.4f, 1000.0f, 0.0f);
Math_SmoothStepToF(&this->actor.velocity.y, ySpeedTarget, 0.4f, 1000.0f, 0.0f);
}
s32 EnSt_IsCloseToPlayer(EnSt* this, GlobalContext* globalCtx) {
@ -710,7 +710,7 @@ void EnSt_Sway(EnSt* this) {
}
swayAmt = this->swayTimer * (7.0f / 15.0f);
rotAngle = Math_Sins(this->swayAngle) * (swayAmt * (65536.0f / 360.0f));
rotAngle = Math_SinS(this->swayAngle) * (swayAmt * (65536.0f / 360.0f));
if (this->absPrevSwayAngle >= ABS(rotAngle) && this->playSwayFlag == 0) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_WAVE);
@ -722,8 +722,8 @@ void EnSt_Sway(EnSt* this) {
}
this->absPrevSwayAngle = ABS(rotAngle);
amtToTranslate.x = Math_Sins(rotAngle) * -200.0f;
amtToTranslate.y = Math_Coss(rotAngle) * -200.0f;
amtToTranslate.x = Math_SinS(rotAngle) * -200.0f;
amtToTranslate.y = Math_CosS(rotAngle) * -200.0f;
amtToTranslate.z = 0.0f;
Matrix_Push();
Matrix_Translate(this->ceilingPos.x, this->ceilingPos.y, this->ceilingPos.z, MTXMODE_NEW);
@ -844,7 +844,7 @@ void EnSt_LandOnGround(EnSt* this, GlobalContext* globalCtx) {
this->sfxTimer = 0;
EnSt_SetupAction(this, EnSt_WaitOnGround);
} else {
Math_SmoothScaleMaxMinF(&this->actor.velocity.y, 2.0f, 0.3f, 1.0f, 0.0f);
Math_SmoothStepToF(&this->actor.velocity.y, 2.0f, 0.3f, 1.0f, 0.0f);
}
}
@ -907,7 +907,7 @@ void EnSt_BounceAround(EnSt* this, GlobalContext* globalCtx) {
this->actor.gravity = -2.0f;
EnSt_SetupAction(this, EnSt_FinishBouncing);
} else {
Math_SmoothScaleMaxMinF(&this->actor.shape.unk_08, 400.0f, 0.4f, 10000.0f, 0.0f);
Math_SmoothStepToF(&this->actor.shape.unk_08, 400.0f, 0.4f, 10000.0f, 0.0f);
}
}
@ -929,9 +929,9 @@ void EnSt_FinishBouncing(EnSt* this, GlobalContext* globalCtx) {
this->setTargetYawTimer = 8;
}
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.x, 0x3FFC, 4, 0x2710, 1);
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.z, 0, 4, 0x2710, 1);
Math_SmoothScaleMaxMinS(&this->actor.posRot.rot.y, this->deathYawTarget, 0xA, 0x2710, 1);
Math_SmoothStepToS(&this->actor.posRot.rot.x, 0x3FFC, 4, 0x2710, 1);
Math_SmoothStepToS(&this->actor.posRot.rot.z, 0, 4, 0x2710, 1);
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->deathYawTarget, 0xA, 0x2710, 1);
this->actor.shape.rot = this->actor.posRot.rot;