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

@ -135,7 +135,7 @@ void func_80B534CC(EnZl3* this) {
s16* unk_246 = &this->unk_246;
if (DECR(*unk_246) == 0) {
*unk_246 = Math_Rand_S16Offset(0x3C, 0x3C);
*unk_246 = Rand_S16Offset(0x3C, 0x3C);
}
*unk_244 = *unk_246;
if (*unk_244 >= 3) {
@ -155,9 +155,9 @@ void func_80B5357C(EnZl3* this, GlobalContext* globalCtx) {
Vec3f* thisPos = &this->actor.posRot.pos;
Vec3f sp20;
sp20.x = thisPos->x + ((Math_Rand_ZeroOne() - 0.5f) * 10.0f);
sp20.x = thisPos->x + ((Rand_ZeroOne() - 0.5f) * 10.0f);
sp20.y = thisPos->y;
sp20.z = thisPos->z + ((Math_Rand_ZeroOne() - 0.5f) * 10.0f);
sp20.z = thisPos->z + ((Rand_ZeroOne() - 0.5f) * 10.0f);
Item_DropCollectible(globalCtx, &sp20, 3);
}
@ -178,10 +178,10 @@ void func_80B536C4(EnZl3* this) {
Vec3s* vec1 = &this->unk_3F8.unk_08;
Vec3s* vec2 = &this->unk_3F8.unk_0E;
Math_SmoothScaleMaxMinS(&vec1->x, 0, 20, 6200, 100);
Math_SmoothScaleMaxMinS(&vec1->y, 0, 20, 6200, 100);
Math_SmoothScaleMaxMinS(&vec2->x, 0, 20, 6200, 100);
Math_SmoothScaleMaxMinS(&vec2->y, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec1->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec1->y, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec2->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100);
}
void func_80B53764(EnZl3* this, GlobalContext* globalCtx) {
@ -198,8 +198,8 @@ s32 func_80B537E8(EnZl3* this) {
s16* unk_3D0 = &this->unk_3D0;
s16 pad[3];
Math_SmoothScaleMaxMinS(unk_3D0, ABS((s16)(yawTowardsLink - *rotY)), 5, 6200, 100);
Math_SmoothScaleMaxMinS(rotY, yawTowardsLink, 5, *unk_3D0, 100);
Math_SmoothStepToS(unk_3D0, ABS((s16)(yawTowardsLink - *rotY)), 5, 6200, 100);
Math_SmoothStepToS(rotY, yawTowardsLink, 5, *unk_3D0, 100);
this->actor.shape.rot.y = *rotY;
// no return statement despite being of type s32
// the function directly below needs this to not be void I guess
@ -1062,8 +1062,8 @@ void func_80B558A8(EnZl3* this) {
this->unk_32C = thisPos;
*unk_338 = thisPos;
unk_338->z += ((-1.6073999404907227f) * Math_Coss(thisRotY)) - (3.1620006561279297f * Math_Sins(thisRotY));
unk_338->x += ((-1.6073999404907227f) * Math_Sins(thisRotY)) + (3.1620006561279297f * Math_Coss(thisRotY));
unk_338->z += ((-1.6073999404907227f) * Math_CosS(thisRotY)) - (3.1620006561279297f * Math_SinS(thisRotY));
unk_338->x += ((-1.6073999404907227f) * Math_SinS(thisRotY)) + (3.1620006561279297f * Math_CosS(thisRotY));
unk_338->y += -0.01219940185546875f;
}
@ -1639,7 +1639,7 @@ s32 func_80B57034(EnZl3* this, s32 arg1, s32 arg2) {
f32 xDiff = vec2->x - vec1->x;
f32 zDiff = vec2->z - vec1->z;
return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : (s16)(Math_atan2f(xDiff, zDiff) * 10430.3779296875f);
return ((xDiff == 0.0f) && (zDiff == 0.0f)) ? 0 : (s16)(Math_FAtan2F(xDiff, zDiff) * 10430.3779296875f);
}
return 0;
}
@ -1652,7 +1652,7 @@ s16 func_80B57104(EnZl3* this, s32 arg1) {
f32 zDiff = point->z - this->actor.posRot.pos.z;
if ((xDiff != 0.0f) || (zDiff != 0.0f)) {
return Math_atan2f(xDiff, zDiff) * (0x8000 / M_PI);
return Math_FAtan2F(xDiff, zDiff) * (0x8000 / M_PI);
}
}
return 0;
@ -1685,7 +1685,7 @@ void func_80B57240(EnZl3* this) {
s32 temp_a1 = func_80B571FC(this);
s16* rotY = &this->actor.posRot.rot.y;
Math_SmoothScaleMaxMinS(rotY, temp_a1, 2, 6400, 1000);
Math_SmoothStepToS(rotY, temp_a1, 2, 6400, 1000);
this->actor.shape.rot.y = *rotY;
}
@ -1693,7 +1693,7 @@ void func_80B57298(EnZl3* this) {
s16* rotY = &this->actor.posRot.rot.y;
s16 temp_a1 = func_80B571A8(this);
Math_SmoothScaleMaxMinS(rotY, temp_a1, 2, 6400, 1000);
Math_SmoothStepToS(rotY, temp_a1, 2, 6400, 1000);
this->actor.shape.rot.y = *rotY;
}
@ -1766,7 +1766,7 @@ s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) {
return 1;
}
temp_v0 = (s16)(temp_v1 - (s16)(Math_atan2f(temp_f12, temp_f13) * 10430.3779296875f));
temp_v0 = (s16)(temp_v1 - (s16)(Math_FAtan2F(temp_f12, temp_f13) * 10430.3779296875f));
if (temp_v0 < 0x1555) {
return 1;
@ -1853,7 +1853,7 @@ void func_80B577BC(GlobalContext* globalCtx, Vec3f* vec) {
f32 posZ = vec->z;
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_TEST, posX, posY, posZ, 0,
(Math_atan2f(playerPos->x - posX, playerPos->z - posZ) * 10430.3779296875f), 0, 5);
(Math_FAtan2F(playerPos->x - posX, playerPos->z - posZ) * 10430.3779296875f), 0, 5);
}
void func_80B57858(GlobalContext* globalCtx) {
@ -1952,9 +1952,9 @@ void func_80B57AE0(EnZl3* this, GlobalContext* globalCtx) {
unk_354->y = temp_v0->y;
unk_354->z = temp_v0->z;
} else {
unk_354->x = unk_348->x + (Math_Sins(shapeRotY) * 200.0f);
unk_354->x = unk_348->x + (Math_SinS(shapeRotY) * 200.0f);
unk_354->y = unk_348->y;
unk_354->z = unk_348->z + (Math_Coss(shapeRotY) * 200.0f);
unk_354->z = unk_348->z + (Math_CosS(shapeRotY) * 200.0f);
}
xDiff = unk_354->x - unk_348->x;
@ -2005,8 +2005,8 @@ s32 func_80B57D80(EnZl3* this, GlobalContext* globalCtx) {
s16 phi_v1;
unk_3F8->unk_18.y = player->actor.posRot.pos.y;
unk_3F8->unk_18.x = (Math_Sins(temp_v0) * this->actor.xzDistFromLink) + this->actor.posRot.pos.x;
unk_3F8->unk_18.z = (Math_Coss(temp_v0) * this->actor.xzDistFromLink) + this->actor.posRot.pos.z;
unk_3F8->unk_18.x = (Math_SinS(temp_v0) * this->actor.xzDistFromLink) + this->actor.posRot.pos.x;
unk_3F8->unk_18.z = (Math_CosS(temp_v0) * this->actor.xzDistFromLink) + this->actor.posRot.pos.z;
unk_3F8->unk_14 = kREG(16) - 16.0f;
func_80034A14(&this->actor, unk_3F8, kREG(17) + 0xC, 4);