mirror of
https://github.com/zeldaret/tww.git
synced 2026-06-27 10:02:58 -04:00
kt almost matches
This commit is contained in:
+103
-89
@@ -14,11 +14,10 @@
|
||||
#include "m_Do/m_Do_controller_pad.h"
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
|
||||
float kt_scale = 1.5f;
|
||||
static f32 kt_scale = 1.5f;
|
||||
|
||||
/* 00000078-000001BC .text kotori_draw__FP8kt_class */
|
||||
void kotori_draw(kt_class* i_this) {
|
||||
/* Nonmatching */
|
||||
kt_scale = g_regHIO.mChild[0].mFloatRegs[0] + 1.0f;
|
||||
MtxTrans(i_this->current.pos.x, i_this->current.pos.y + i_this->mLiftY, i_this->current.pos.z, false);
|
||||
cMtx_YrotM(*calc_mtx, i_this->current.angle.y);
|
||||
@@ -45,66 +44,75 @@ static BOOL daKt_Draw(kt_class* i_this) {
|
||||
|
||||
/* 000001E0-000011D4 .text kotori_move__FP8kt_class */
|
||||
void kotori_move(kt_class* i_this) {
|
||||
/* Nonmatching */
|
||||
/* Nonmatching - regalloc */
|
||||
f32* r28;
|
||||
f32* r27;
|
||||
f32* r26;
|
||||
|
||||
daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0);
|
||||
bool dispWing = false;
|
||||
u8 ret = 0;
|
||||
dBgS_GndChk gndChk;
|
||||
|
||||
f32 dx = player->current.pos.x - i_this->current.pos.x;
|
||||
f32 dz = player->current.pos.z - i_this->current.pos.z;
|
||||
f32 dx = player->current.pos.x - *(r28 = &i_this->current.pos.x);
|
||||
f32 dz = player->current.pos.z - *(r27 = &i_this->current.pos.z);
|
||||
f32 dist_xz = sqrtf(dx*dx + dz*dz);
|
||||
cLib_addCalcAngleS2(&i_this->mAngleRoll, 0, 2, g_regHIO.mChild[0].mShortRegs[4] + 0x1000);
|
||||
|
||||
f32 vx = i_this->mTargetPos.x - i_this->current.pos.x;
|
||||
f32 vy = i_this->mTargetPos.y - i_this->current.pos.y;
|
||||
f32 vz = i_this->mTargetPos.z - i_this->current.pos.z;
|
||||
f32 vx = i_this->mTargetPos.x - *r28;
|
||||
f32 vy = i_this->mTargetPos.y - *(r26 = &i_this->current.pos.y);
|
||||
f32 vz = i_this->mTargetPos.z - *r27;
|
||||
s16 angleX = cM_atan2s(vx, vz);
|
||||
s16 angleY = -cM_atan2s(vy, sqrtf(vx*vx + vz*vz));
|
||||
|
||||
cXyz headTopPos = player->getHeadTopPos();
|
||||
f32 dist;
|
||||
cXyz offs;
|
||||
cXyz pt;
|
||||
cXyz headTopPos = player->getHeadTopPos();
|
||||
f32 dist;
|
||||
|
||||
s16* r18;
|
||||
s16* r17;
|
||||
s16* r16;
|
||||
|
||||
switch (i_this->mState) {
|
||||
case 0:
|
||||
i_this->mSpeedFwd = kt_scale * 20.0f + 30.0f;
|
||||
if (CPad_CHECK_TRIG_LEFT(0) && fopAcM_GetParam(i_this) == 1000) {
|
||||
i_this->mTargetPos.x = i_this->current.pos.x;
|
||||
i_this->mTargetPos.y = i_this->current.pos.y + 500.0f;
|
||||
i_this->mTargetPos.z = i_this->current.pos.z;
|
||||
i_this->mTargetPos.x = player->current.pos.x;
|
||||
i_this->mTargetPos.y = player->current.pos.y + 500.0f;
|
||||
i_this->mTargetPos.z = player->current.pos.z;
|
||||
i_this->mState = 2;
|
||||
i_this->mSpeedLerp = 0.0f;
|
||||
} else {
|
||||
if (i_this->mTimer[2] == 0) {
|
||||
i_this->mState = 1;
|
||||
offs.x = 0.0f;
|
||||
offs.y = 0.0f;
|
||||
offs.z = g_regHIO.mChild[0].mFloatRegs[13] * 100.0f + 3000.0f;
|
||||
cMtx_YrotS(*calc_mtx, i_this->shape_angle.y);
|
||||
|
||||
MtxPosition(&offs, &pt);
|
||||
i_this->mTargetPosHome.x = player->current.pos.x + pt.x + cM_rndFX(g_regHIO.mChild[0].mFloatRegs[14] + 200.0f);
|
||||
i_this->mTargetPosHome.y = player->current.pos.y + 1000.0f;
|
||||
i_this->mTargetPosHome.z = player->current.pos.z + pt.z + cM_rndFX(g_regHIO.mChild[0].mFloatRegs[14] + 200.0f);
|
||||
|
||||
gndChk.SetPos(&i_this->mTargetPosHome);
|
||||
i_this->mTargetPosHome.y = dComIfG_Bgsp()->GroundCross(&gndChk);
|
||||
if (i_this->mTargetPosHome.y == -100000000.0f)
|
||||
i_this->mTargetPosHome = player->current.pos;
|
||||
i_this->mTargetPos = i_this->mTargetPosHome;
|
||||
i_this->mSpeedLerp = 0.0f;
|
||||
} else if (i_this->mTimer[0] == 0) {
|
||||
i_this->mTimer[0] = cM_rndF(250.0f) + 60.0f;
|
||||
i_this->mTargetPos.x = i_this->mTargetPosHome.x + cM_rndFX(2000.0f);
|
||||
i_this->mTargetPos.z = i_this->mTargetPosHome.z + cM_rndFX(2000.0f);
|
||||
i_this->mTargetPos.y = i_this->mTargetPosHome.y + cM_rndFX(1000.0f);
|
||||
i_this->mSpeedLerp = 0.0f;
|
||||
}
|
||||
|
||||
cLib_addCalc2(&i_this->mSpeedLerp, 1.0f, 1.0f, 0.1f);
|
||||
break;
|
||||
}
|
||||
|
||||
if (i_this->mTimer[2] == 0) {
|
||||
i_this->mState = 1;
|
||||
offs.x = 0.0f;
|
||||
offs.y = 0.0f;
|
||||
offs.z = g_regHIO.mChild[0].mFloatRegs[13] * 100.0f + 3000.0f;
|
||||
cMtx_YrotS(*calc_mtx, player->shape_angle.y);
|
||||
|
||||
MtxPosition(&offs, &pt);
|
||||
i_this->mTargetPosHome.x = player->current.pos.x + pt.x + cM_rndFX(g_regHIO.mChild[0].mFloatRegs[14] + 200.0f);
|
||||
i_this->mTargetPosHome.y = player->current.pos.y + 1000.0f;
|
||||
i_this->mTargetPosHome.z = player->current.pos.z + pt.z + cM_rndFX(g_regHIO.mChild[0].mFloatRegs[14] + 200.0f);
|
||||
|
||||
gndChk.SetPos(&i_this->mTargetPosHome);
|
||||
i_this->mTargetPosHome.y = dComIfG_Bgsp()->GroundCross(&gndChk);
|
||||
if (i_this->mTargetPosHome.y == -1e9f)
|
||||
i_this->mTargetPosHome = player->current.pos;
|
||||
i_this->mTargetPos = i_this->mTargetPosHome;
|
||||
i_this->mSpeedLerp = 0.0f;
|
||||
} else if (i_this->mTimer[0] == 0) {
|
||||
i_this->mTimer[0] = cM_rndF(250.0f) + 60.0f;
|
||||
i_this->mTargetPos.x = i_this->mTargetPosHome.x + cM_rndFX(2000.0f);
|
||||
i_this->mTargetPos.z = i_this->mTargetPosHome.z + cM_rndFX(2000.0f);
|
||||
i_this->mTargetPos.y = i_this->mTargetPosHome.y + cM_rndF(1000.0f);
|
||||
i_this->mSpeedLerp = 0.0f;
|
||||
}
|
||||
|
||||
cLib_addCalc2(&i_this->mSpeedLerp, 1.0f, 1.0f, 0.1f);
|
||||
goto calc_012;
|
||||
case 1:
|
||||
dist = sqrtf(vx*vx + vy*vy + vz*vz);
|
||||
@@ -113,35 +121,38 @@ void kotori_move(kt_class* i_this) {
|
||||
}
|
||||
cLib_addCalc2(&i_this->mSpeedLerp, 3.0f, 1.0f, 0.1f);
|
||||
calc_012:
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, angleX, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[0] * 10.0f + 500.0f) * i_this->mSpeedLerp));
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.x, angleY, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[0] * 10.0f + 500.0f) * i_this->mSpeedLerp));
|
||||
r18 = &i_this->current.angle.y;
|
||||
cLib_addCalcAngleS2(r18, angleX, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[2] * 10.0f + 500.0f) * i_this->mSpeedLerp));
|
||||
r17 = &i_this->current.angle.x;
|
||||
cLib_addCalcAngleS2(r17, angleY, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[2] * 10.0f + 500.0f) * i_this->mSpeedLerp));
|
||||
offs.x = 0.0f;
|
||||
offs.y = 0.0f;
|
||||
offs.z = i_this->mSpeedFwd;
|
||||
mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
|
||||
mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x);
|
||||
mDoMtx_YrotS(*calc_mtx, *r18);
|
||||
mDoMtx_XrotM(*calc_mtx, *r17);
|
||||
MtxPosition(&offs, &i_this->mSpeedVel);
|
||||
i_this->current.pos.x += i_this->mSpeedVel.x;
|
||||
i_this->current.pos.y += i_this->mSpeedVel.y;
|
||||
i_this->current.pos.z += i_this->mSpeedVel.z;
|
||||
*r28 += i_this->mSpeedVel.x;
|
||||
*r26 += i_this->mSpeedVel.y;
|
||||
*r27 += i_this->mSpeedVel.z;
|
||||
if (i_this->mLiftYTimer >= 0.0f)
|
||||
dispWing = true;
|
||||
ret = 2;
|
||||
break;
|
||||
case 8:
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, angleX, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[0] * 10.0f + 1500.0f) * i_this->mSpeedLerp));
|
||||
cLib_addCalc0(&i_this->mSpeedLerp, g_regHIO.mChild[0].mFloatRegs[4], 1.0f);
|
||||
cLib_addCalc0(&i_this->mSpeedFwd, g_regHIO.mChild[0].mFloatRegs[5], 1.0f);
|
||||
r16 = &i_this->current.angle.y;
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, angleX, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[3] * 10.0f + 1500.0f) * i_this->mSpeedLerp));
|
||||
cLib_addCalc0(&i_this->mSpeedLerp, 1.0f, g_regHIO.mChild[0].mFloatRegs[4] + 0.05f);
|
||||
cLib_addCalc0(&i_this->mSpeedFwd, 1.0f, g_regHIO.mChild[0].mFloatRegs[5] + 1.0f);
|
||||
offs.x = 0.0f;
|
||||
offs.y = 0.0f;
|
||||
offs.z = i_this->mSpeedFwd;
|
||||
mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
|
||||
MtxPosition(&offs, &i_this->mSpeedVel);
|
||||
i_this->current.pos.x += i_this->mSpeedVel.x;
|
||||
i_this->current.pos.z += i_this->mSpeedVel.z;
|
||||
cLib_addCalc2(&i_this->current.pos.y, i_this->mGroundY, g_regHIO.mChild[0].mFloatRegs[6] + 0.3f, g_regHIO.mChild[0].mFloatRegs[7] + 20.0f);
|
||||
if (fabsf(i_this->current.pos.y - i_this->mGroundY) < 1.0f) {
|
||||
i_this->current.pos.y = i_this->mGroundY;
|
||||
mDoMtx_YrotS(*calc_mtx, *r16);
|
||||
MtxPosition(&offs, &pt);
|
||||
*r28 += pt.x;
|
||||
*r27 += pt.z;
|
||||
cLib_addCalc2(&*r26, i_this->mGroundY, g_regHIO.mChild[0].mFloatRegs[6] + 0.3f, g_regHIO.mChild[0].mFloatRegs[7] + 20.0f);
|
||||
if (fabsf(*r26 - i_this->mGroundY) < 1.0f) {
|
||||
*r26 = i_this->mGroundY;
|
||||
i_this->mState = 10;
|
||||
}
|
||||
dispWing = true;
|
||||
@@ -160,32 +171,33 @@ calc_012:
|
||||
case 9:
|
||||
i_this->mTargetPos = headTopPos;
|
||||
i_this->mTargetPos.y += 100.0f;
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, angleX, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[0] * 10.0f + 1500.0f) * i_this->mSpeedLerp));
|
||||
cLib_addCalc0(&i_this->mSpeedLerp, g_regHIO.mChild[0].mFloatRegs[4], 1.0f);
|
||||
cLib_addCalc0(&i_this->mSpeedFwd, g_regHIO.mChild[0].mFloatRegs[5], 1.0f);
|
||||
r16 = &i_this->current.angle.y;
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, angleX, 10, (s16)((g_regHIO.mChild[0].mFloatRegs[3] * 10.0f + 1500.0f) * i_this->mSpeedLerp));
|
||||
cLib_addCalc0(&i_this->mSpeedLerp, 1.0f, g_regHIO.mChild[0].mFloatRegs[4] + 0.05f);
|
||||
cLib_addCalc0(&i_this->mSpeedFwd, 1.0f, g_regHIO.mChild[0].mFloatRegs[5] + 1.0f);
|
||||
offs.x = 0.0f;
|
||||
offs.y = 0.0f;
|
||||
offs.z = i_this->mSpeedFwd;
|
||||
mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
|
||||
MtxPosition(&offs, &i_this->mSpeedVel);
|
||||
i_this->current.pos.x += i_this->mSpeedVel.x;
|
||||
i_this->current.pos.z += i_this->mSpeedVel.z;
|
||||
cLib_addCalc2(&i_this->current.pos.y, i_this->mGroundY, g_regHIO.mChild[0].mFloatRegs[6] + 0.3f, g_regHIO.mChild[0].mFloatRegs[7] + 20.0f);
|
||||
if (fabsf(i_this->current.pos.y - i_this->mGroundY) < 1.0f) {
|
||||
i_this->current.pos.y = i_this->mGroundY;
|
||||
mDoMtx_YrotS(*calc_mtx, *r16);
|
||||
MtxPosition(&offs, &pt);
|
||||
*r28 += pt.x;
|
||||
*r27 += pt.z;
|
||||
cLib_addCalc2(&*r26, i_this->mTargetPos.y, g_regHIO.mChild[0].mFloatRegs[6] + 0.5f, g_regHIO.mChild[0].mFloatRegs[7] + 20.0f);
|
||||
if (fabsf(*r26 - i_this->mTargetPos.y) < 1.0f) {
|
||||
i_this->mState = 20;
|
||||
i_this->mSpeedLerp = 0.0f;
|
||||
}
|
||||
dispWing = true;
|
||||
ret = 1;
|
||||
break;
|
||||
case 20:
|
||||
i_this->mTargetPos = headTopPos;
|
||||
cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 1.0f, i_this->mSpeedLerp);
|
||||
cLib_addCalc2(&i_this->current.pos.y, i_this->mTargetPos.y, 1.0f, i_this->mSpeedLerp / 2.0f);
|
||||
cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 1.0f, i_this->mSpeedLerp);
|
||||
cLib_addCalc2(&*r28, i_this->mTargetPos.x, 1.0f, i_this->mSpeedLerp);
|
||||
cLib_addCalc2(&*r26, i_this->mTargetPos.y, 1.0f, i_this->mSpeedLerp * 0.5f);
|
||||
cLib_addCalc2(&*r27, i_this->mTargetPos.z, 1.0f, i_this->mSpeedLerp);
|
||||
cLib_addCalc2(&i_this->mSpeedLerp, 1000.0f, 1.0f, g_regHIO.mChild[0].mFloatRegs[16] + 10.0f);
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, player->shape_angle.y, 2, 0x1000);
|
||||
if (fabsf(i_this->current.pos.y - i_this->mTargetPos.y) > 1.0f)
|
||||
if (fabsf(*r26 - i_this->mTargetPos.y) > 1.0f)
|
||||
dispWing = true;
|
||||
if (CPad_CHECK_TRIG_LEFT(0)) {
|
||||
i_this->mState = 0;
|
||||
@@ -198,12 +210,13 @@ calc_012:
|
||||
break;
|
||||
case 10:
|
||||
i_this->mLiftY += i_this->mLiftYTimer;
|
||||
i_this->mLiftYTimer -= g_regHIO.mChild[0].mFloatRegs[9] * 0.1f + 5.0f;
|
||||
i_this->mLiftYTimer -= g_regHIO.mChild[0].mFloatRegs[8] * 0.1f + 5.0f;
|
||||
if (i_this->mLiftY <= 0.0f) {
|
||||
i_this->mLiftYTimer = g_regHIO.mChild[0].mFloatRegs[9] + 15.0f;
|
||||
i_this->mLiftY = 0.0f;
|
||||
}
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, angleX, 10, (s16)(g_regHIO.mChild[0].mFloatRegs[0] * 10.0f + 500.0f));
|
||||
s16* r16_2 = &i_this->current.angle.y;
|
||||
cLib_addCalcAngleS2(&i_this->current.angle.y, angleX, 10, (s16)(g_regHIO.mChild[0].mFloatRegs[10] * 10.0f + 500.0f));
|
||||
if (i_this->mTimer[1] == 0 && i_this->mLiftY <= 0.0f) {
|
||||
i_this->mTimer[1] = 20.0f + cM_rndF(20.0f);
|
||||
i_this->mState = 11;
|
||||
@@ -211,28 +224,28 @@ calc_012:
|
||||
offs.x = 0.0f;
|
||||
offs.y = 0.0f;
|
||||
offs.z = g_regHIO.mChild[0].mFloatRegs[11] + 10.0f;
|
||||
mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y);
|
||||
mDoMtx_YrotS(*calc_mtx, *r16_2);
|
||||
MtxPosition(&offs, &i_this->mSpeedVel);
|
||||
i_this->current.pos.x += i_this->mSpeedVel.x;
|
||||
i_this->current.pos.z += i_this->mSpeedVel.z;
|
||||
*r28 += i_this->mSpeedVel.x;
|
||||
*r27 += i_this->mSpeedVel.z;
|
||||
goto calc_11;
|
||||
break;
|
||||
case 11:
|
||||
if (i_this->mTimer[0] == 0) {
|
||||
i_this->mTimer[0] = cM_rndF(2.0f) + 10.0f + g_regHIO.mChild[0].mFloatRegs[12];
|
||||
}
|
||||
if (i_this->mTimer[0] > g_regHIO.mChild[0].mShortRegs[1] + 8) {
|
||||
if (i_this->mTimer[0] > (s16)(g_regHIO.mChild[0].mShortRegs[1] + 8)) {
|
||||
cLib_addCalcAngleS2(&i_this->mAngleRoll, g_regHIO.mChild->mShortRegs[2] + 0x3000, 2, g_regHIO.mChild->mShortRegs[3] + 0x2000);
|
||||
}
|
||||
if (i_this->mTimer[1] == 0) {
|
||||
i_this->mTimer[1] = 20.0f + cM_rndF(50.0f);
|
||||
i_this->mState = 10;
|
||||
i_this->mTargetPos.x += cM_rndFX(1000.0f);
|
||||
i_this->mTargetPos.y += cM_rndFX(1000.0f);
|
||||
i_this->mTargetPos.x = i_this->mTargetPosHome.x + cM_rndFX(1000.0f);
|
||||
i_this->mTargetPos.z = i_this->mTargetPosHome.z + cM_rndFX(1000.0f);
|
||||
}
|
||||
calc_11:
|
||||
i_this->current.pos.y -= 5.0f;
|
||||
if (!i_this->mHitGround || dx < (g_regHIO.mChild[0].mFloatRegs[15] * 100.0f + 1500.0f)) {
|
||||
*r26 -= 5.0f;
|
||||
if (!i_this->mHitGround || dist_xz < (g_regHIO.mChild[0].mFloatRegs[15] * 100.0f + 1500.0f)) {
|
||||
i_this->mState = 0;
|
||||
i_this->mTimer[0] = 0;
|
||||
i_this->mLiftYTimer = 10.0f + cM_rndFX(10.0f);
|
||||
@@ -246,25 +259,26 @@ calc_11:
|
||||
i_this->mHitGround = false;
|
||||
if (i_this->mState >= 8) {
|
||||
Vec pos;
|
||||
pos.x = i_this->current.pos.x;
|
||||
pos.y = i_this->current.pos.y + 1000.0f;
|
||||
pos.z = i_this->current.pos.z;
|
||||
pos.x = *r28;
|
||||
pos.y = *r26;
|
||||
pos.z = *r27;
|
||||
pos.y += 1000.0f;
|
||||
gndChk.SetPos(&pos);
|
||||
i_this->mGroundY = dComIfG_Bgsp()->GroundCross(&gndChk);
|
||||
if (i_this->current.pos.y <= i_this->mGroundY) {
|
||||
i_this->current.pos.y = i_this->mGroundY;
|
||||
if (*r26 <= i_this->mGroundY) {
|
||||
*r26 = i_this->mGroundY;
|
||||
i_this->mHitGround = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == 2) {
|
||||
i_this->mLiftY += i_this->mLiftYTimer;
|
||||
i_this->mLiftYTimer -= 1.0f;
|
||||
i_this->mLiftYTimer -= 1.5f;
|
||||
if (i_this->mLiftY <= 0.0f) {
|
||||
i_this->mLiftYTimer = cM_rndF(5.0f) + 15.0f;
|
||||
}
|
||||
} else if (ret == 1) {
|
||||
cLib_addCalc0(&i_this->mLiftY, 0.0f, 1.0f);
|
||||
cLib_addCalc0(&i_this->mLiftY, 1.0f, 2.0f);
|
||||
i_this->mLiftYTimer = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user