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

matched Math3D_CylVsLineSeg and fixed a Math_ error (#564)

* matched cylvsline

* slight name adjustment

* format

* and asm

* comment cleanup

* fixed misspelling and added mathfixer tool

* formatting

Co-authored-by: petrie911 <pmontag@DESKTOP-LG8A167.localdomain>
This commit is contained in:
petrie911 2020-12-27 10:13:38 -06:00 committed by GitHub
parent b95643b397
commit 3727cc38b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
36 changed files with 382 additions and 1048 deletions

View file

@ -196,7 +196,7 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C1A0(BgBdanObjects* this, GlobalContext* globalCtx) {
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 500.0f, 0.5f, 7.5f,
1.0f) < 0.1f) {
1.0f) < 0.1f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
this->actionFunc = func_8086C29C;
this->unk_16A = 0x1E;
@ -331,7 +331,7 @@ void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) {
void func_8086C7D0(BgBdanObjects* this, GlobalContext* globalCtx) {
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y + 965.0f, 0.5f, 15.0f,
0.2f) < 0.01f) {
0.2f) < 0.01f) {
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_A);
this->actionFunc = BgBdanObjects_DoNothing;
} else {

View file

@ -120,8 +120,8 @@ void BgDdanKd_LowerStairs(BgDdanKd* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->dyna.actor.speedXZ, 4.0f, 0.5f, 0.025f, 0.0f);
func_800AA000(500.0f, 0x78, 0x14, 0xA);
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (this->dyna.actor.initPosRot.pos.y - 200.0f) - 20.0f,
0.075f, this->dyna.actor.speedXZ, 0.0075f) == 0.0f) {
if (Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (this->dyna.actor.initPosRot.pos.y - 200.0f) - 20.0f, 0.075f,
this->dyna.actor.speedXZ, 0.0075f) == 0.0f) {
Flags_SetSwitch(globalCtx, this->dyna.actor.params);
BgDdanKd_SetupAction(this, func_80871838);
} else {

View file

@ -417,8 +417,7 @@ void func_80880AE8(BgHakaTrap* this, GlobalContext* globalCtx) {
this->actionFunc = func_808809B0;
}
} else {
if (Math_ScaledStepToS(&this->dyna.actor.posRot.rot.z, 0x3A00,
this->dyna.actor.posRot.rot.z * 0.03f + 5.0f)) {
if (Math_ScaledStepToS(&this->dyna.actor.posRot.rot.z, 0x3A00, this->dyna.actor.posRot.rot.z * 0.03f + 5.0f)) {
this->timer = 100;
this->actionFunc = func_80880C0C;
}

View file

@ -168,8 +168,8 @@ void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx) {
void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) {
if (!Player_InCsMode(globalCtx)) {
if (Math_ScaledStepToS(&this->actor.shape.rot.y,
this->actor.initPosRot.rot.y + (this->direction * 0x6390), 0x20)) {
if (Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.initPosRot.rot.y + (this->direction * 0x6390),
0x20)) {
this->moveState = FWBIG_RESET;
this->actionFunc = BgHidanFwbig_Lower;
} else {

View file

@ -149,7 +149,7 @@ void BgJya1flift_Move(BgJya1flift* this, GlobalContext* globalCtx) {
tempVelocity = this->dyna.actor.velocity.y;
}
if (fabsf(Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, (sFinalPositions[this->isMovingDown]), 0.5f,
tempVelocity, 1.0f)) < 0.001f) {
tempVelocity, 1.0f)) < 0.001f) {
this->dyna.actor.posRot.pos.y = sFinalPositions[this->isMovingDown];
BgJya1flift_ResetMoveDelay(this);
Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND);

View file

@ -91,8 +91,7 @@ void func_809937B4(DemoTreLgt* this, GlobalContext* globalCtx, f32 currentFrame)
this->action = DEMO_TRE_LGT_ACTION_ANIMATE;
SkelCurve_SetAnim(skelCurve, sTransformUpdIdx[gSaveContext.linkAge], 1.0f,
sDemoTreLgtInfo[gSaveContext.linkAge].endFrame +
sDemoTreLgtInfo[gSaveContext.linkAge].unk_08,
sDemoTreLgtInfo[gSaveContext.linkAge].endFrame + sDemoTreLgtInfo[gSaveContext.linkAge].unk_08,
currentFrame, 1.0f);
SkelCurve_Update(globalCtx, skelCurve);
}
@ -103,8 +102,8 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
if (currentFrame < sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame) {
this->unk_170 = 255;
} else {
if (currentFrame <= (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame +
sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08)) {
if (currentFrame <=
(sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame + sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08)) {
this->unk_170 = ((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].endFrame - currentFrame) /
sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_08) *
255.0f) +
@ -117,8 +116,7 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
this->unk_174 = 255;
} else if (currentFrame < (sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C + 10.0f)) {
this->unk_174 =
((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) +
255.0f);
((((sDemoTreLgtInfo[(0, gSaveContext.linkAge)].unk_0C - currentFrame) / 10.0f) * 255.0f) + 255.0f);
} else {
this->unk_174 = 0;
}
@ -135,7 +133,7 @@ void func_80993848(DemoTreLgt* this, GlobalContext* globalCtx) {
void DemoTreLgt_Update(Actor* thisx, GlobalContext* globalCtx) {
DemoTreLgt* this = THIS;
sActionFuncs[this->action](this, globalCtx);
sActionFuncs[this->action](this, globalCtx);
}
s32 DemoTreLgt_PostLimbDraw(GlobalContext* globalCtx, SkelAnimeCurve* skelCurve, s32 limbIndex, void* thisx) {

View file

@ -106,8 +106,8 @@ void func_809C1E40(EnBird* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->actor.speedXZ, this->unk_1A8, 0.1f, this->unk_1AC, 0.0f);
if (this->unk_1B0 < Math_Vec3f_DistXZ(&this->actor.posRot.pos, &this->actor.initPosRot.pos) || this->unk_198 < 4) {
Math_StepToAngleS(&this->actor.posRot.rot.y, Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos),
this->unk_1C0);
Math_StepToAngleS(&this->actor.posRot.rot.y,
Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->actor.initPosRot.pos), this->unk_1C0);
} else {
fVar4 = sinf(this->unk_1B4);
this->actor.posRot.rot.y += (s16)(fVar4 * this->unk_1A4);

View file

@ -216,7 +216,7 @@ void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) {
this->actor.initPosRot.pos.z);
func_809CD56C(this);
Math_SmoothStepToF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
flightParams->speedXZStep, 0.0f);
flightParams->speedXZStep, 0.0f);
if (this->unk_257 == 1) {
maxDistSqFromHome = SQ(100.0f);
@ -290,7 +290,7 @@ void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) {
func_809CD634(this);
Math_SmoothStepToF(&this->actor.speedXZ, flightParams->speedXZTarget, flightParams->speedXZScale,
flightParams->speedXZStep, 0.0f);
flightParams->speedXZStep, 0.0f);
minAnimSpeed = 0.0f;
if ((this->flightParamsIdx != 0) && (this->timer < 12)) {

View file

@ -268,10 +268,9 @@ s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) {
this->actor.speedXZ *= distFromHome;
}
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
0x300);
Math_ScaledStepToS(&this->actor.shape.rot.x,
func_8002DB28(&this->actor, &this->actor.initPosRot.pos) + 0x1554, 0x100);
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x300);
Math_ScaledStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &this->actor.initPosRot.pos) + 0x1554,
0x100);
return 1;
}
@ -308,8 +307,7 @@ s32 EnFirefly_SeekTorch(EnFirefly* this, GlobalContext* globalCtx) {
EnFirefly_Ignite(this);
return 1;
} else {
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DA78(&this->actor, &closestTorch->actor),
0x300);
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DA78(&this->actor, &closestTorch->actor), 0x300);
Math_ScaledStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &flamePos) + 0x1554, 0x100);
return 1;
}
@ -332,8 +330,8 @@ void EnFirefly_FlyIdle(EnFirefly* this, GlobalContext* globalCtx) {
if (skelanimeUpdated) {
rand = Rand_ZeroOne();
if (rand < 0.5f) {
Math_ScaledStepToS(&this->actor.shape.rot.y,
func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x300);
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
0x300);
} else if (rand < 0.8f) {
this->actor.shape.rot.y += Rand_CenteredFloat(1536.0f);
}
@ -424,8 +422,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) {
preyPos.x = player->actor.posRot.pos.x;
preyPos.y = player->actor.posRot.pos.y + 20.0f;
preyPos.z = player->actor.posRot.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &preyPos) + 0x1554, 2, 0x400,
0x100);
Math_SmoothStepToS(&this->actor.shape.rot.x, func_8002DB28(&this->actor, &preyPos) + 0x1554, 2, 0x400, 0x100);
} else {
this->skelAnime.animPlaybackSpeed = 1.5f;
if (this->actor.xzDistFromLink > 80.0f) {
@ -483,8 +480,7 @@ void EnFirefly_FlyAway(EnFirefly* this, GlobalContext* globalCtx) {
if (this->actor.bgCheckFlags & 8) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallPolyRot, 2, 0xC00, 0x300);
} else {
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
0x300);
Math_ScaledStepToS(&this->actor.shape.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x300);
}
Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100);
}

View file

@ -275,8 +275,7 @@ void EnFw_Run(EnFw* this, GlobalContext* globalCtx) {
} else {
Vec3f sp48;
EnFw_GetPosAdjAroundCircle(&sp48, this, this->runRadius, this->runDirection);
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(sp48.x, sp48.z) * (0x8000 / M_PI)), 4, 0xFA0,
1);
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(sp48.x, sp48.z) * (0x8000 / M_PI)), 4, 0xFA0, 1);
}
this->actor.posRot.rot = this->actor.shape.rot;

View file

@ -305,10 +305,8 @@ void EnGSwitch_GalleryRupee(EnGSwitch* this, GlobalContext* globalCtx) {
if (this->waitTimer == 0) {
if ((fabsf(this->actor.posRot.pos.x - this->actor.initPosRot.pos.x) > 5.0f) ||
(fabsf(this->actor.posRot.pos.y - this->actor.initPosRot.pos.y) > 5.0f)) {
Math_ApproachF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 0.3f,
30.0f);
Math_ApproachF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f,
30.0f);
Math_ApproachF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 0.3f, 30.0f);
Math_ApproachF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 0.3f, 30.0f);
} else {
gallery = ((EnSyatekiItm*)this->actor.parent);
if (gallery->actor.update != NULL) {

View file

@ -1258,8 +1258,7 @@ void func_80A391D8(EnGeldB* this, GlobalContext* globalCtx) {
this->headRot.y = Math_SinS(this->lookTimer * 0x1068) * 8920.0f;
} else if (this->actionState != GELDB_STUNNED) {
if ((this->actionState != GELDB_SLASH) && (this->actionState != GELDB_SPIN_ATTACK)) {
Math_SmoothStepToS(&this->headRot.y, this->actor.yawTowardsLink - this->actor.shape.rot.y, 1, 0x1F4,
0);
Math_SmoothStepToS(&this->headRot.y, this->actor.yawTowardsLink - this->actor.shape.rot.y, 1, 0x1F4, 0);
this->headRot.y = CLAMP(this->headRot.y, -0x256F, 0x256F);
} else {
this->headRot.y = 0;

View file

@ -176,7 +176,7 @@ void EnHeishi1_Walk(EnHeishi1* this, GlobalContext* globalCtx) {
pathDiffX = pointPos->x - this->actor.posRot.pos.x;
pathDiffZ = pointPos->z - this->actor.posRot.pos.z;
Math_SmoothStepToS(&this->actor.shape.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * 10430.378f), 3,
this->bodyTurnSpeed, 0);
this->bodyTurnSpeed, 0);
Math_ApproachF(&this->bodyTurnSpeed, this->bodyTurnSpeedTarget, 1.0f, this->bodyTurnSpeedMax);
@ -309,7 +309,7 @@ void EnHeishi1_Wait(EnHeishi1* this, GlobalContext* globalCtx) {
break;
}
Math_ApproachF(&this->headAngle, this->headAngleTarget, this->headTurnSpeedScale,
this->headTurnSpeedMax + this->headTurnSpeedMax);
this->headTurnSpeedMax + this->headTurnSpeedMax);
if ((this->path == BREG(1)) && (BREG(0) != 0)) {
osSyncPrintf(VT_FGCOL(GREEN) " 種類 %d\n" VT_RST, this->path);

View file

@ -268,8 +268,8 @@ s32 EnKz_FollowPath(EnKz* this, GlobalContext* globalCtx) {
pathDiffX = pointPos->x - this->actor.posRot.pos.x;
pathDiffZ = pointPos->z - this->actor.posRot.pos.z;
Math_SmoothStepToS(&this->actor.posRot.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * 10430.3779296875f), 0xA,
0x3E8, 1);
Math_SmoothStepToS(&this->actor.posRot.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * 10430.3779296875f), 0xA, 0x3E8,
1);
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f) {
this->waypoint++;

View file

@ -676,8 +676,7 @@ void func_80AA7938(EnMb* this, GlobalContext* globalCtx) {
s16 sp54[] = { 20, 40, 0 };
s16 sp4C[] = { -2500, 0, 3500 };
Math_SmoothStepToS(&this->actor.shape.rot.y, sp4C[this->attackParams - 1] + this->actor.posRot.rot.y, 1, 0x2EE,
0);
Math_SmoothStepToS(&this->actor.shape.rot.y, sp4C[this->attackParams - 1] + this->actor.posRot.rot.y, 1, 0x2EE, 0);
if (this->collider2.base.atFlags & 2) {
this->collider2.base.atFlags &= ~2;

View file

@ -540,8 +540,8 @@ u8 EnMd_FollowPath(EnMd* this, GlobalContext* globalCtx) {
pathDiffX = pointPos->x - this->actor.posRot.pos.x;
pathDiffZ = pointPos->z - this->actor.posRot.pos.z;
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(pathDiffX, pathDiffZ) * (65536.0f / (2 * M_PI)), 4,
4000, 1);
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(pathDiffX, pathDiffZ) * (65536.0f / (2 * M_PI)), 4, 4000,
1);
if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 100.0f) {
this->waypoint++;

View file

@ -556,8 +556,7 @@ void func_80AB6570(EnNiw* this, GlobalContext* globalCtx) {
this->unk_29E = 7;
}
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(posY, posZ) * (0x8000 / M_PI), 3, this->unk_300,
0);
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(posY, posZ) * (0x8000 / M_PI), 3, this->unk_300, 0);
Math_ApproachF(&this->unk_300, 10000.0f, 1.0f, 1000.0f);
}
@ -819,7 +818,7 @@ void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) {
this->actionFunc = EnNiw_ResetAction;
} else {
this->unk_2E4 = Math_FAtan2F(this->actor.posRot.pos.x - player->actor.posRot.pos.x,
this->actor.posRot.pos.z - player->actor.posRot.pos.z) *
this->actor.posRot.pos.z - player->actor.posRot.pos.z) *
(0x8000 / M_PI);
func_80AB6100(this, globalCtx, 0);
func_80AB5BF8(this, globalCtx, 2);

View file

@ -119,7 +119,7 @@ void func_80AB9210(EnNiwGirl* this, GlobalContext* globalCtx) {
// Change her angle so that she is always facing the cuckoo
Math_SmoothStepToS(&this->actor.shape.rot.y, Math_FAtan2F(xDistBetween, zDistBetween) * 10430.378f, 3,
this->unk_27C, 0);
this->unk_27C, 0);
Math_ApproachF(&this->unk_27C, 5000.0f, 30.0f, 150.0f);
this->actor.posRot.rot.y = this->actor.shape.rot.y;

View file

@ -223,8 +223,7 @@ void func_80ACE7E8(EnPart* this, GlobalContext* globalCtx) {
}
if (this->timer == 0) {
f32 diffsSum =
Math_SmoothStepToF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 1.0f, 5.0f, 0.0f);
f32 diffsSum = Math_SmoothStepToF(&this->actor.posRot.pos.x, this->actor.initPosRot.pos.x, 1.0f, 5.0f, 0.0f);
diffsSum += Math_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y, 1.0f, 5.0f, 0.0f);
diffsSum += Math_SmoothStepToF(&this->actor.posRot.pos.z, this->actor.initPosRot.pos.z, 1.0f, 5.0f, 0.0f);
diffsSum += Math_SmoothStepToF(&this->rotZ, 0.0f, 1.0f, 0.25f, 0.0f);

View file

@ -574,11 +574,9 @@ void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) {
func_80AD9368(this);
}
if (this->actor.bgCheckFlags & 8) {
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
0x71C);
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x71C);
} else if (func_8002DBB0(&this->actor, &this->actor.initPosRot.pos) > 300.0f) {
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
0x71C);
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 0x71C);
}
}
@ -670,7 +668,7 @@ void func_80ADAAA4(EnPoSisters* this, GlobalContext* globalCtx) {
}
if (this->unk_195 != 0) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.parent->shape.rot.y,
(this->unk_195 == 2) ? 0x800 : 0x400);
(this->unk_195 == 2) ? 0x800 : 0x400);
this->unk_22E.a = ((this->skelAnime.animFrameCount - this->skelAnime.animCurrentFrame) * 255.0f) /
this->skelAnime.animFrameCount;
this->actor.posRot.pos.y = this->actor.parent->posRot.pos.y;
@ -880,7 +878,7 @@ void func_80ADB51C(EnPoSisters* this, GlobalContext* globalCtx) {
phi_a2 *= 2;
}
Math_ScaledStepToS(&this->actor.shape.rot.y,
this->actor.parent->shape.rot.y + (this->unk_195 * 0x4000) * phi_v0, phi_a2);
this->actor.parent->shape.rot.y + (this->unk_195 * 0x4000) * phi_v0, phi_a2);
} else if (this->unk_19A == 70 || this->unk_19A == 40) {
Audio_PlayActorSound2(&this->actor, NA_SE_EN_PO_LAUGH2);
}
@ -975,8 +973,7 @@ void func_80ADBB6C(EnPoSisters* this, GlobalContext* globalCtx) {
if (func_8002DBB0(&this->actor, &this->actor.initPosRot.pos) < 10.0f) {
func_80ADA028(this);
} else {
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos),
1820);
Math_ScaledStepToS(&this->actor.posRot.rot.y, func_8002DAC0(&this->actor, &this->actor.initPosRot.pos), 1820);
}
}

View file

@ -245,8 +245,7 @@ void func_80AE2970(EnRd* this) {
void func_80AE2A10(EnRd* this, GlobalContext* globalCtx) {
if (this->actor.shape.rot.x != -0x4000) {
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) {
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,8 +253,8 @@ 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_SmoothStepToF(&this->actor.posRot.pos.y, this->actor.initPosRot.pos.y + 50.0f, 0.3f, 2.0f,
0.3f) == 0.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_SmoothStepToF(&this->actor.speedXZ, 6.0f, 0.3f, 1.0f, 0.3f);
@ -467,12 +466,12 @@ void func_80AE3454(EnRd* this, GlobalContext* globalCtx) {
}
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_SinS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.x, 1.0f,
10.0f, 0.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_CosS(player->actor.shape.rot.y) * -25.0f) + player->actor.posRot.pos.z, 1.0f,
10.0f, 0.0f);
Math_SmoothStepToS(&this->actor.shape.rot.y, player->actor.shape.rot.y, 1, 0x1770, 0);
if (this->skelAnime.animCurrentFrame == 0.0f) {

View file

@ -763,15 +763,13 @@ void EnRr_Update(Actor* thisx, GlobalContext* globalCtx) {
Math_ApproachF(&this->pulseSize, this->pulseSizeTarget, 1.0f, 0.0015f);
Math_ApproachF(&this->wobbleSize, this->wobbleSizeTarget, 1.0f, 20.0f);
for (i = 0; i < 5; i++) {
Math_SmoothStepToS(&this->bodySegs[i].rot.x, this->bodySegs[i].rotTarget.x, 5,
this->segMoveRate * 1000.0f, 0);
Math_SmoothStepToS(&this->bodySegs[i].rot.z, this->bodySegs[i].rotTarget.z, 5,
this->segMoveRate * 1000.0f, 0);
Math_ApproachF(&this->bodySegs[i].scale.x, this->bodySegs[i].scaleTarget.x, 1.0f,
this->segMoveRate * 0.2f);
Math_SmoothStepToS(&this->bodySegs[i].rot.x, this->bodySegs[i].rotTarget.x, 5, this->segMoveRate * 1000.0f,
0);
Math_SmoothStepToS(&this->bodySegs[i].rot.z, this->bodySegs[i].rotTarget.z, 5, this->segMoveRate * 1000.0f,
0);
Math_ApproachF(&this->bodySegs[i].scale.x, this->bodySegs[i].scaleTarget.x, 1.0f, this->segMoveRate * 0.2f);
this->bodySegs[i].scale.z = this->bodySegs[i].scale.x;
Math_ApproachF(&this->bodySegs[i].height, this->bodySegs[i].heightTarget, 1.0f,
this->segMoveRate * 300.0f);
Math_ApproachF(&this->bodySegs[i].height, this->bodySegs[i].heightTarget, 1.0f, this->segMoveRate * 300.0f);
}
Math_ApproachF(&this->segMoveRate, 1.0f, 1.0f, 0.2f);
}

View file

@ -301,8 +301,7 @@ void EnSsh_Turn(EnSsh* this, GlobalContext* globalCtx) {
void EnSsh_Stunned(EnSsh* this, GlobalContext* globalCtx) {
if ((this->swayTimer == 0) && (this->stunTimer == 0)) {
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink ^ 0x8000, 4, this->maxTurnRate,
1);
Math_SmoothStepToS(&this->actor.posRot.rot.y, this->actor.yawTowardsLink ^ 0x8000, 4, this->maxTurnRate, 1);
}
this->actor.shape.rot.y = this->actor.posRot.rot.y;
if (this->stunTimer < 30) {

View file

@ -320,8 +320,7 @@ void func_80B11E78(EnSyatekiNiw* this, GlobalContext* globalCtx) {
this->unk_294 = 7;
}
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(tmpf1, tmpf2) * 10430.378f, 3, this->unk_2C8.z,
0);
Math_SmoothStepToS(&this->actor.posRot.rot.y, Math_FAtan2F(tmpf1, tmpf2) * 10430.378f, 3, this->unk_2C8.z, 0);
Math_ApproachF(&this->unk_2C8.z, 10000.0f, 1.0f, 1000.0f);
}
@ -466,11 +465,11 @@ void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) {
}
Math_SmoothStepToS(&this->actor.posRot.rot.y,
(s16)(Math_FAtan2F(player->actor.posRot.pos.x - this->actor.posRot.pos.x,
player->actor.posRot.pos.z - this->actor.posRot.pos.z) *
10430.378f) +
phi_f16,
5, this->unk_2C8.y, 0);
(s16)(Math_FAtan2F(player->actor.posRot.pos.x - this->actor.posRot.pos.x,
player->actor.posRot.pos.z - this->actor.posRot.pos.z) *
10430.378f) +
phi_f16,
5, this->unk_2C8.y, 0);
Math_ApproachF(&this->unk_2C8.y, 3000.0f, 1.0f, 500.0f);
if (this->unk_296 == 2) {
this->unk_256 = 10;

View file

@ -157,7 +157,7 @@ void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) {
this->actor.yDistFromLink <= 80.0f && this->actor.yDistFromLink >= -160.0f) {
Math_SmoothStepToS(&this->beamRot, pitch, 10, 0xFA0, 0);
if (Math_SmoothStepToS(&this->headRotY, this->actor.yawTowardsLink - this->actor.shape.rot.y, 1,
(ABS((s16)(dist * 180.0f)) / 3) + 0xFA0, 0) <= 5460) {
(ABS((s16)(dist * 180.0f)) / 3) + 0xFA0, 0) <= 5460) {
this->timer--;
if (this->timer == 0) {
this->unk_25E++;

View file

@ -1,7 +1,7 @@
#include "z_magic_dark.h"
static u64 sDiamondTexture[] = {
#include "assets/overlays/ovl_Magic_Dark/diamond_texture.i8.inc.c"
#include "assets/overlays/ovl_Magic_Dark/diamond_texture.i8.inc.c"
};
extern UNK_TYPE D_04032490[];

View file

@ -129,7 +129,7 @@ void func_80B93E38(ObjHsblock* this) {
void func_80B93E5C(ObjHsblock* this, GlobalContext* globalCtx) {
Math_SmoothStepToF(&this->dyna.actor.velocity.y, 16.0f, 0.1f, 0.8f, 0.0f);
if (fabsf(Math_SmoothStepToF(&this->dyna.actor.posRot.pos.y, this->dyna.actor.initPosRot.pos.y, 0.3f,
this->dyna.actor.velocity.y, 0.3f)) < 0.001f) {
this->dyna.actor.velocity.y, 0.3f)) < 0.001f) {
this->dyna.actor.posRot.pos.y = this->dyna.actor.initPosRot.pos.y;
func_80B93D90(this);
this->dyna.actor.flags &= ~0x10;

View file

@ -2957,7 +2957,7 @@ void func_808368EC(Player* this, GlobalContext* globalCtx) {
if ((this->unk_664 != NULL) &&
((globalCtx->actorCtx.targetCtx.unk_4B != 0) || (this->actor.type != ACTORTYPE_PLAYER))) {
Math_ScaledStepToS(&this->actor.shape.rot.y,
Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->unk_664->posRot2.pos), 4000);
Math_Vec3f_Yaw(&this->actor.posRot.pos, &this->unk_664->posRot2.pos), 4000);
} else if ((this->stateFlags1 & 0x20000) && !(this->stateFlags2 & 0x60)) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 4000);
}
@ -5777,7 +5777,7 @@ void func_8083DDC8(Player* this, GlobalContext* globalCtx) {
}
void func_8083DF68(Player* this, f32 arg1, s16 arg2) {
Math_AymStepToF(&this->linearVelocity, arg1, REG(19) / 100.0f, 1.5f);
Math_AsymStepToF(&this->linearVelocity, arg1, REG(19) / 100.0f, 1.5f);
Math_ScaledStepToS(&this->currentYaw, arg2, REG(27));
}
@ -5793,7 +5793,7 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) {
this->currentYaw = *arg2;
}
} else {
Math_AymStepToF(&this->linearVelocity, *arg1, 0.05f, 0.1f);
Math_AsymStepToF(&this->linearVelocity, *arg1, 0.05f, 0.1f);
Math_ScaledStepToS(&this->currentYaw, *arg2, 200);
}
}
@ -6672,7 +6672,7 @@ void func_80840450(Player* this, GlobalContext* globalCtx) {
return;
}
Math_AymStepToF(&this->linearVelocity, sp44 * 0.3f, 2.0f, 1.5f);
Math_AsymStepToF(&this->linearVelocity, sp44 * 0.3f, 2.0f, 1.5f);
if (!(this->stateFlags3 & 8)) {
Math_ScaledStepToS(&this->currentYaw, sp42, temp4 * 0.1f);
@ -6939,7 +6939,7 @@ void func_80840DE4(Player* this, GlobalContext* globalCtx) {
return;
}
Math_AymStepToF(&this->linearVelocity, sp44 * 0.4f, 1.5f, 1.5f);
Math_AsymStepToF(&this->linearVelocity, sp44 * 0.4f, 1.5f, 1.5f);
Math_ScaledStepToS(&this->currentYaw, sp42, temp3 * 0.1f);
}
}
@ -7034,7 +7034,7 @@ void func_808414F8(Player* this, GlobalContext* globalCtx) {
} else {
sp2A = sp32 - this->currentYaw;
Math_AymStepToF(&this->linearVelocity, sp34 * 1.5f, 1.5f, 2.0f);
Math_AsymStepToF(&this->linearVelocity, sp34 * 1.5f, 1.5f, 2.0f);
Math_ScaledStepToS(&this->currentYaw, sp32, sp2A * 0.1f);
if ((sp34 == 0.0f) && (this->linearVelocity == 0.0f)) {
@ -7159,7 +7159,7 @@ void func_8084193C(Player* this, GlobalContext* globalCtx) {
}
sp3C *= 0.9f;
Math_AymStepToF(&this->linearVelocity, sp3C, 2.0f, 3.0f);
Math_AsymStepToF(&this->linearVelocity, sp3C, 2.0f, 3.0f);
Math_ScaledStepToS(&this->currentYaw, sp3A, temp3 * 0.1f);
}
}
@ -8400,7 +8400,7 @@ void func_80845000(Player* this, GlobalContext* globalCtx) {
return;
}
Math_AymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f);
if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f)) {
@ -8468,7 +8468,7 @@ void func_80845308(Player* this, GlobalContext* globalCtx) {
return;
}
Math_AymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f);
Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f);
if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) {
@ -10080,7 +10080,7 @@ void Player_UpdateCommon(Player* this, GlobalContext* globalCtx, Input* input) {
Math_StepToF(&this->windSpeed, sp48, sp48 * 0.1f);
Math_ScaledStepToS(&this->windDirection, D_808535FC,
((this->stateFlags1 & 0x8000000) ? 400.0f : 800.0f) * sp48);
((this->stateFlags1 & 0x8000000) ? 400.0f : 800.0f) * sp48);
} else if (this->windSpeed != 0.0f) {
Math_StepToF(&this->windSpeed, 0.0f, (this->stateFlags1 & 0x8000000) ? 0.5f : 1.0f);
}
@ -10556,7 +10556,7 @@ void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) {
arg2 = 0.0f;
}
Math_AymStepToF(arg1, arg2 * 0.8f, temp1, (fabsf(*arg1) * 0.02f) + 0.05f);
Math_AsymStepToF(arg1, arg2 * 0.8f, temp1, (fabsf(*arg1) * 0.02f) + 0.05f);
Math_ScaledStepToS(&this->currentYaw, arg3, 1600);
}
@ -12341,7 +12341,7 @@ void func_8084F390(Player* this, GlobalContext* globalCtx) {
sp4C = 1.0f;
}
if (Math_AymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) {
if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) {
LinkAnimationHeader* anim;
if (this->unk_84F == 0) {
anim = D_80853D04[this->modelAnimType];