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

@ -125,7 +125,7 @@ void EnKusa_DropCollectible(EnKusa* this, GlobalContext* globalCtx) {
Item_DropCollectibleRandom(globalCtx, NULL, &this->actor.posRot.pos, dropParams << 4);
break;
case 1:
if (Math_Rand_ZeroOne() < 0.5f) {
if (Rand_ZeroOne() < 0.5f) {
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, ITEM00_SEEDS);
} else {
Item_DropCollectible(globalCtx, &this->actor.posRot.pos, ITEM00_HEART);
@ -143,7 +143,7 @@ void EnKusa_Fall(EnKusa* this) {
}
void func_80A9B174(Vec3f* vec, f32 arg1) {
arg1 += ((Math_Rand_ZeroOne() * 0.2f) - 0.1f) * arg1;
arg1 += ((Rand_ZeroOne() * 0.2f) - 0.1f) * arg1;
vec->x -= vec->x * arg1;
vec->y -= vec->y * arg1;
vec->z -= vec->z * arg1;
@ -170,11 +170,11 @@ void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) {
pos.y = this->actor.posRot.pos.y + (scale->y * this->actor.scale.y * 20.0f) + 10.0f;
pos.z = this->actor.posRot.pos.z + (scale->z * this->actor.scale.z * 20.0f);
velocity.x = (Math_Rand_ZeroOne() - 0.5f) * 8.0f;
velocity.y = Math_Rand_ZeroOne() * 10.0f;
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * 8.0f;
velocity.x = (Rand_ZeroOne() - 0.5f) * 8.0f;
velocity.y = Rand_ZeroOne() * 10.0f;
velocity.z = (Rand_ZeroOne() - 0.5f) * 8.0f;
index = (s32)(Math_Rand_ZeroOne() * 111.1f) & 7;
index = (s32)(Rand_ZeroOne() * 111.1f) & 7;
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -100, 64, 40, 3, 0, D_80A9C26C[index], 0, 0, 80,
KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, D_040355E0);
@ -183,11 +183,11 @@ void EnKusa_SpawnFragments(EnKusa* this, GlobalContext* globalCtx) {
pos.y = this->actor.posRot.pos.y + (scale->y * this->actor.scale.y * 40.0f) + 10.0f;
pos.z = this->actor.posRot.pos.z + (scale->z * this->actor.scale.z * 40.0f);
velocity.x = (Math_Rand_ZeroOne() - 0.5f) * 6.0f;
velocity.y = Math_Rand_ZeroOne() * 10.0f;
velocity.z = (Math_Rand_ZeroOne() - 0.5f) * 6.0f;
velocity.x = (Rand_ZeroOne() - 0.5f) * 6.0f;
velocity.y = Rand_ZeroOne() * 10.0f;
velocity.z = (Rand_ZeroOne() - 0.5f) * 6.0f;
index = (s32)(Math_Rand_ZeroOne() * 111.1f) % 7;
index = (s32)(Rand_ZeroOne() * 111.1f) % 7;
EffectSsKakera_Spawn(globalCtx, &pos, &velocity, &pos, -100, 64, 40, 3, 0, D_80A9C26C[index], 0, 0, 80,
KAKERA_COLOR_NONE, OBJECT_GAMEPLAY_KEEP, D_040356A0);
@ -198,9 +198,8 @@ void EnKusa_SpawnBugs(EnKusa* this, GlobalContext* globalCtx) {
s32 i;
for (i = 0; i < 3; i++) {
Actor* bug =
Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.posRot.pos.x,
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, Math_Rand_ZeroOne() * 0xFFFF, 0, 1);
Actor* bug = Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_INSECT, this->actor.posRot.pos.x,
this->actor.posRot.pos.y, this->actor.posRot.pos.z, 0, Rand_ZeroOne() * 0xFFFF, 0, 1);
if (bug == NULL) {
break;
@ -229,7 +228,7 @@ void EnKusa_Init(Actor* thisx, GlobalContext* globalCtx) {
func_80061ED4(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
if (this->actor.shape.rot.y == 0) {
s16 rand = Math_Rand_ZeroFloat(0x10000);
s16 rand = Rand_ZeroFloat(0x10000);
this->actor.posRot.rot.y = rand;
this->actor.initPosRot.rot.y = rand;
@ -335,8 +334,8 @@ void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) {
if (Actor_HasNoParent(&this->actor, globalCtx)) {
this->actor.room = globalCtx->roomCtx.curRoom.num;
func_80A9BBB0(this);
this->actor.velocity.x = this->actor.speedXZ * Math_Sins(this->actor.posRot.rot.y);
this->actor.velocity.z = this->actor.speedXZ * Math_Coss(this->actor.posRot.rot.y);
this->actor.velocity.x = this->actor.speedXZ * Math_SinS(this->actor.posRot.rot.y);
this->actor.velocity.z = this->actor.speedXZ * Math_CosS(this->actor.posRot.rot.y);
this->actor.colChkInfo.mass = 240;
this->actor.gravity = -0.1f;
EnKusa_Fall(this);
@ -350,7 +349,7 @@ void EnKusa_LiftedUp(EnKusa* this, GlobalContext* globalCtx) {
void func_80A9BBB0(EnKusa* this) {
EnKusa_SetupAction(this, func_80A9BC1C);
D_80A9C1D0 = -0xBB8;
D_80A9C1D8 = ((Math_Rand_ZeroOne() - 0.5f) * 1600.0f);
D_80A9C1D8 = ((Rand_ZeroOne() - 0.5f) * 1600.0f);
D_80A9C1D4 = 0;
D_80A9C1DC = 0;
}
@ -393,8 +392,8 @@ void func_80A9BC1C(EnKusa* this, GlobalContext* globalCtx) {
Audio_PlaySoundAtPosition(globalCtx, &this->actor.posRot.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L);
}
EnKusa_Fall(this);
Math_ApproxS(&D_80A9C1D4, D_80A9C1D0, 0x1F4);
Math_ApproxS(&D_80A9C1DC, D_80A9C1D8, 0xAA);
Math_StepToS(&D_80A9C1D4, D_80A9C1D0, 0x1F4);
Math_StepToS(&D_80A9C1DC, D_80A9C1D8, 0xAA);
this->actor.shape.rot.x += D_80A9C1D4;
this->actor.shape.rot.y += D_80A9C1DC;
func_80A9B174(&this->actor.velocity, 0.05f);
@ -436,7 +435,7 @@ void func_80A9BF3C(EnKusa* this) {
void func_80A9BFA8(EnKusa* this, GlobalContext* globalCtx) {
if (this->timer > 120) {
if ((Math_ApproxF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.6f)) && (this->timer >= 170)) {
if ((Math_StepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.6f)) && (this->timer >= 170)) {
func_80A9C00C(this);
}
}
@ -452,8 +451,8 @@ void func_80A9C00C(EnKusa* this) {
void func_80A9C068(EnKusa* this, GlobalContext* globalCtx) {
s32 sp24;
sp24 = Math_ApproxF(&this->actor.scale.y, 0.4f, 0.014f) & 1;
sp24 &= Math_ApproxF(&this->actor.scale.x, 0.4f, 0.011f);
sp24 = Math_StepToF(&this->actor.scale.y, 0.4f, 0.014f) & 1;
sp24 &= Math_StepToF(&this->actor.scale.x, 0.4f, 0.011f);
this->actor.scale.z = this->actor.scale.x;
if (sp24) {