mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-21 22:41:14 +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:
parent
81c269b417
commit
8fa6cb6ff9
1329 changed files with 8413 additions and 8374 deletions
|
@ -72,7 +72,7 @@ extern SkeletonHeader D_050036F0;
|
|||
|
||||
void EnButte_SelectFlightParams(EnButte* this, EnButteFlightParams* flightParams) {
|
||||
if (this->flightParamsIdx == 0) {
|
||||
if (Math_Rand_ZeroOne() < 0.6f) {
|
||||
if (Rand_ZeroOne() < 0.6f) {
|
||||
this->flightParamsIdx = 1;
|
||||
} else {
|
||||
this->flightParamsIdx = 2;
|
||||
|
@ -81,7 +81,7 @@ void EnButte_SelectFlightParams(EnButte* this, EnButteFlightParams* flightParams
|
|||
this->flightParamsIdx = 0;
|
||||
}
|
||||
|
||||
this->timer = Math_Rand_S16Offset(flightParams->minTime, flightParams->maxTime);
|
||||
this->timer = Rand_S16Offset(flightParams->minTime, flightParams->maxTime);
|
||||
}
|
||||
|
||||
static f32 sTransformationEffectScale = 0.0f;
|
||||
|
@ -107,7 +107,7 @@ void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) {
|
|||
|
||||
func_80093C14(globalCtx->state.gfxCtx);
|
||||
|
||||
alpha = Math_Sins(sTransformationEffectAlpha) * 250;
|
||||
alpha = Math_SinS(sTransformationEffectAlpha) * 250;
|
||||
alpha = CLAMP(alpha, 0, 255);
|
||||
|
||||
Camera_GetCamDir(&camDir, ACTIVE_CAM);
|
||||
|
@ -152,9 +152,9 @@ void EnButte_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Collider_InitJntSph(globalCtx, &this->collider);
|
||||
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sColliderInit, this->colliderItems);
|
||||
this->actor.colChkInfo.mass = 0;
|
||||
this->unk_25C = Math_Rand_ZeroOne() * 0xFFFF;
|
||||
this->unk_25E = Math_Rand_ZeroOne() * 0xFFFF;
|
||||
this->unk_260 = Math_Rand_ZeroOne() * 0xFFFF;
|
||||
this->unk_25C = Rand_ZeroOne() * 0xFFFF;
|
||||
this->unk_25E = Rand_ZeroOne() * 0xFFFF;
|
||||
this->unk_260 = Rand_ZeroOne() * 0xFFFF;
|
||||
SkelAnime_ChangeAnim(&this->skelAnime, &D_05002470, 1.0f, 0.0f, 0.0f, 1, 0.0f);
|
||||
EnButte_SetupFlyAround(this);
|
||||
this->actor.shape.rot.x -= 0x2320;
|
||||
|
@ -174,8 +174,8 @@ void func_809CD56C(EnButte* this) {
|
|||
static f32 D_809CE3E0[] = { 50.0f, 80.0f, 100.0f };
|
||||
static f32 D_809CE3EC[] = { 30.0f, 40.0f, 50.0f };
|
||||
|
||||
this->actor.shape.unk_08 += Math_Sins(this->unk_25C) * D_809CE3E0[this->flightParamsIdx] +
|
||||
Math_Sins(this->unk_25E) * D_809CE3EC[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 += Math_SinS(this->unk_25C) * D_809CE3E0[this->flightParamsIdx] +
|
||||
Math_SinS(this->unk_25E) * D_809CE3EC[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 = CLAMP(this->actor.shape.unk_08, -2000.0f, 2000.0f);
|
||||
}
|
||||
|
||||
|
@ -183,8 +183,8 @@ void func_809CD634(EnButte* this) {
|
|||
static f32 D_809CE3F8[] = { 15.0f, 20.0f, 25.0f };
|
||||
static f32 D_809CE404[] = { 7.5f, 10.0f, 12.5f };
|
||||
|
||||
this->actor.shape.unk_08 += Math_Sins(this->unk_25C) * D_809CE3F8[this->flightParamsIdx] +
|
||||
Math_Sins(this->unk_25E) * D_809CE404[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 += Math_SinS(this->unk_25C) * D_809CE3F8[this->flightParamsIdx] +
|
||||
Math_SinS(this->unk_25E) * D_809CE404[this->flightParamsIdx];
|
||||
this->actor.shape.unk_08 = CLAMP(this->actor.shape.unk_08, -500.0f, 500.0f);
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ void EnButte_Turn(EnButte* this) {
|
|||
s16 target = this->actor.posRot.rot.y + 0x8000;
|
||||
s16 diff = target - this->actor.shape.rot.y;
|
||||
|
||||
Math_ApproxUpdateScaledS(&this->actor.shape.rot.y, target, ABS(diff) >> 3);
|
||||
Math_ScaledStepToS(&this->actor.shape.rot.y, target, ABS(diff) >> 3);
|
||||
this->actor.shape.rot.x = (s16)(sinf(this->unk_260) * 600.0f) - 0x2320;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
|||
distSqFromHome = Math3D_Dist2DSq(this->actor.posRot.pos.x, this->actor.posRot.pos.z, this->actor.initPosRot.pos.x,
|
||||
this->actor.initPosRot.pos.z);
|
||||
func_809CD56C(this);
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
|
||||
if (this->unk_257 == 1) {
|
||||
|
@ -230,17 +230,17 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
|||
|
||||
if ((this->flightParamsIdx != 0) && ((distSqFromHome > maxDistSqFromHome) || (this->timer < 4))) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, flightParams->rotYStep) == 0) {
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, flightParams->rotYStep) == 0) {
|
||||
minAnimSpeed = 0.5f;
|
||||
}
|
||||
} else if ((this->unk_257 == 0) && (this->actor.child != NULL) && (this->actor.child != &this->actor)) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.child->posRot.pos);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
minAnimSpeed = 0.3f;
|
||||
}
|
||||
} else if (this->unk_257 == 1) {
|
||||
yaw = this->actor.yawTowardsLink + 0x8000 + (s16)((Math_Rand_ZeroOne() - 0.5f) * 0x6000);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
yaw = this->actor.yawTowardsLink + 0x8000 + (s16)((Rand_ZeroOne() - 0.5f) * 0x6000);
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, rotStep) == 0) {
|
||||
minAnimSpeed = 0.4f;
|
||||
}
|
||||
} else {
|
||||
|
@ -249,8 +249,8 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
|
|||
|
||||
EnButte_Turn(this);
|
||||
|
||||
animSpeed = this->actor.speedXZ / 2.0f + Math_Rand_ZeroOne() * 0.2f + (1.0f - Math_Sins(this->unk_260)) * 0.15f +
|
||||
(1.0f - Math_Sins(this->unk_25E)) * 0.3f + minAnimSpeed;
|
||||
animSpeed = this->actor.speedXZ / 2.0f + Rand_ZeroOne() * 0.2f + (1.0f - Math_SinS(this->unk_260)) * 0.15f +
|
||||
(1.0f - Math_SinS(this->unk_25E)) * 0.3f + minAnimSpeed;
|
||||
this->skelAnime.animPlaybackSpeed = CLAMP(animSpeed, 0.2f, 1.5f);
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
|
||||
|
@ -288,17 +288,17 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) {
|
|||
s16 yaw;
|
||||
|
||||
func_809CD634(this);
|
||||
Math_SmoothScaleMaxMinF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
Math_SmoothStepToF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
|
||||
flightParams->speedXZStep, 0.0f);
|
||||
minAnimSpeed = 0.0f;
|
||||
|
||||
if ((this->flightParamsIdx != 0) && (this->timer < 12)) {
|
||||
swordTip.x = player->swordInfo[0].tip.x + Math_Sins(player->actor.shape.rot.y) * 10.0f;
|
||||
swordTip.x = player->swordInfo[0].tip.x + Math_SinS(player->actor.shape.rot.y) * 10.0f;
|
||||
swordTip.y = player->swordInfo[0].tip.y;
|
||||
swordTip.z = player->swordInfo[0].tip.z + Math_Coss(player->actor.shape.rot.y) * 10.0f;
|
||||
swordTip.z = player->swordInfo[0].tip.z + Math_CosS(player->actor.shape.rot.y) * 10.0f;
|
||||
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &swordTip) + (s16)(Math_Rand_ZeroOne() * D_809CE410);
|
||||
if (Math_ApproxUpdateScaledS(&this->actor.posRot.rot.y, yaw, 2000) != 0) {
|
||||
yaw = Math_Vec3f_Yaw(&this->actor.posRot.pos, &swordTip) + (s16)(Rand_ZeroOne() * D_809CE410);
|
||||
if (Math_ScaledStepToS(&this->actor.posRot.rot.y, yaw, 2000) != 0) {
|
||||
if (globalCtx->gameplayFrames % 2) {
|
||||
this->actor.posRot.rot.y += (s16)(sinf(this->unk_25C) * 60.0f);
|
||||
}
|
||||
|
@ -311,8 +311,8 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) {
|
|||
|
||||
EnButte_Turn(this);
|
||||
|
||||
animSpeed = this->actor.speedXZ / 2.0f + Math_Rand_ZeroOne() * 0.2f + (1.0f - Math_Sins(this->unk_260)) * 0.15f +
|
||||
(1.0f - Math_Sins(this->unk_25E)) * 0.3f + minAnimSpeed;
|
||||
animSpeed = this->actor.speedXZ / 2.0f + Rand_ZeroOne() * 0.2f + (1.0f - Math_SinS(this->unk_260)) * 0.15f +
|
||||
(1.0f - Math_SinS(this->unk_25E)) * 0.3f + minAnimSpeed;
|
||||
this->skelAnime.animPlaybackSpeed = CLAMP(animSpeed, 0.2f, 1.5f);
|
||||
SkelAnime_FrameUpdateMatrix(&this->skelAnime);
|
||||
|
||||
|
@ -399,7 +399,7 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
if (this->actor.update != NULL) {
|
||||
Actor_MoveForward(&this->actor);
|
||||
Math_ApproxF(&this->actor.posRot.pos.y, this->posYTarget, 0.6f);
|
||||
Math_StepToF(&this->actor.posRot.pos.y, this->posYTarget, 0.6f);
|
||||
if (this->actor.xyzDistFromLinkSq < 5000.0f) {
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue