mirror of
https://github.com/zeldaret/oot.git
synced 2025-05-10 19:13:42 +00:00
Document EnGoroiwa and BgJyaGoroiwa (#860)
* Document EnGoroiwa and BgJyaGoroiwa * Run format.sh * Add renamed functions to actorfixer script * no more calling out "the devs" for bad code * `EnGoroiwa#flags` -> `stateFlags` * `Matrix_MtxFToRotS` -> `Matrix_MtxFToYXZRotS` (and not ZXY oops), `func_800D2264` -> `Matrix_MtxFToZYXRotS`
This commit is contained in:
parent
18c84b0be7
commit
743f42f651
29 changed files with 425 additions and 394 deletions
|
@ -1774,11 +1774,11 @@ void Matrix_MultVec3f(Vec3f* src, Vec3f* dest);
|
|||
void Matrix_MtxFCopy(MtxF* dest, MtxF* src);
|
||||
void Matrix_MtxToMtxF(Mtx* src, MtxF* dest);
|
||||
void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf);
|
||||
void Matrix_Reverse(MtxF* mf);
|
||||
void Matrix_Transpose(MtxF* mf);
|
||||
void func_800D1FD4(MtxF* mf);
|
||||
void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag);
|
||||
void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag);
|
||||
void func_800D23FC(f32 f, Vec3f* vec, u8 mode);
|
||||
void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag);
|
||||
void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag);
|
||||
void Matrix_RotateAxis(f32 f, Vec3f* vec, u8 mode);
|
||||
MtxF* Matrix_CheckFloats(MtxF* mf, char* file, s32 line);
|
||||
void func_800D2CEC(Mtx* mtx, f32 arg1, f32 arg2, f32 arg3, f32 arg4, f32 arg5, f32 arg6);
|
||||
u32 SysUcode_GetUCodeBoot(void);
|
||||
|
|
|
@ -108,6 +108,7 @@
|
|||
#define R_ITEM_ICON_WIDTH(i) VREG(76 + i)
|
||||
#define R_ITEM_BTN_WIDTH(i) VREG(80 + i)
|
||||
#define R_DISABLE_INPUT_DISPLAY HREG(47)
|
||||
#define R_EN_GOROIWA_SPEED mREG(12)
|
||||
#define R_NAVI_MSG_REGION_ALPHA nREG(87)
|
||||
|
||||
#endif
|
||||
|
|
|
@ -680,7 +680,7 @@ void Matrix_MultVec3fExt(Vec3f* src, Vec3f* dest, MtxF* mf) {
|
|||
dest->z = mf->wz + (mf->xz * src->x + mf->yz * src->y + mf->zz * src->z);
|
||||
}
|
||||
|
||||
void Matrix_Reverse(MtxF* mf) {
|
||||
void Matrix_Transpose(MtxF* mf) {
|
||||
f32 temp;
|
||||
|
||||
temp = mf->xy;
|
||||
|
@ -739,7 +739,11 @@ void func_800D1FD4(MtxF* mf) {
|
|||
cmf->zz = mf->zz * temp3;
|
||||
}
|
||||
|
||||
void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
/**
|
||||
* Gets the rotation the specified matrix represents, using Euler YXZ.
|
||||
* The flag value doesn't matter for a rotation matrix. Not 0 does extra calculation.
|
||||
*/
|
||||
void Matrix_MtxFToYXZRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
|
||||
f32 temp;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
|
@ -748,17 +752,17 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
|||
temp = mf->zx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->zz);
|
||||
vec->x = Math_FAtan2F(-mf->zy, sqrtf(temp)) * (32768 / M_PI);
|
||||
rotDest->x = Math_FAtan2F(-mf->zy, sqrtf(temp)) * (0x8000 / M_PI);
|
||||
|
||||
if ((vec->x == 0x4000) || (vec->x == -0x4000)) {
|
||||
vec->z = 0;
|
||||
if ((rotDest->x == 0x4000) || (rotDest->x == -0x4000)) {
|
||||
rotDest->z = 0;
|
||||
|
||||
vec->y = Math_FAtan2F(-mf->xz, mf->xx) * (32768 / M_PI);
|
||||
rotDest->y = Math_FAtan2F(-mf->xz, mf->xx) * (0x8000 / M_PI);
|
||||
} else {
|
||||
vec->y = Math_FAtan2F(mf->zx, mf->zz) * (32768 / M_PI);
|
||||
rotDest->y = Math_FAtan2F(mf->zx, mf->zz) * (0x8000 / M_PI);
|
||||
|
||||
if (!flag) {
|
||||
vec->z = Math_FAtan2F(mf->xy, mf->yy) * (32768 / M_PI);
|
||||
rotDest->z = Math_FAtan2F(mf->xy, mf->yy) * (0x8000 / M_PI);
|
||||
} else {
|
||||
temp = mf->xx;
|
||||
temp2 = mf->xz;
|
||||
|
@ -768,6 +772,7 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
|||
temp += SQ(temp2);
|
||||
temp2 = mf->xy;
|
||||
temp += SQ(temp2);
|
||||
/* temp = xx^2+xz^2+xy^2 == 1 for a rotation matrix */
|
||||
temp = sqrtf(temp);
|
||||
temp = temp2 / temp;
|
||||
|
||||
|
@ -776,15 +781,22 @@ void func_800D20CC(MtxF* mf, Vec3s* vec, s32 flag) {
|
|||
temp2 += SQ(temp3);
|
||||
temp3 = mf->yy;
|
||||
temp2 += SQ(temp3);
|
||||
/* temp2 = yx^2+yz^2+yy^2 == 1 for a rotation matrix */
|
||||
temp2 = sqrtf(temp2);
|
||||
temp2 = temp3 / temp2;
|
||||
|
||||
vec->z = Math_FAtan2F(temp, temp2) * (32768 / M_PI);
|
||||
/* for a rotation matrix, temp == xy and temp2 == yy
|
||||
* which is the same as in the !flag branch */
|
||||
rotDest->z = Math_FAtan2F(temp, temp2) * (0x8000 / M_PI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) {
|
||||
/**
|
||||
* Gets the rotation the specified matrix represents, using Euler ZYX.
|
||||
* The flag value doesn't matter for a rotation matrix. Not 0 does extra calculation.
|
||||
*/
|
||||
void Matrix_MtxFToZYXRotS(MtxF* mf, Vec3s* rotDest, s32 flag) {
|
||||
f32 temp;
|
||||
f32 temp2;
|
||||
f32 temp3;
|
||||
|
@ -793,43 +805,47 @@ void func_800D2264(MtxF* mf, Vec3s* vec, s32 flag) {
|
|||
temp = mf->xx;
|
||||
temp *= temp;
|
||||
temp += SQ(mf->xy);
|
||||
vec->y = Math_FAtan2F(-mf->xz, sqrtf(temp)) * (32768 / M_PI);
|
||||
rotDest->y = Math_FAtan2F(-mf->xz, sqrtf(temp)) * (0x8000 / M_PI);
|
||||
|
||||
if ((vec->y == 0x4000) || (vec->y == -0x4000)) {
|
||||
vec->x = 0;
|
||||
vec->z = Math_FAtan2F(-mf->yx, mf->yy) * (32768 / M_PI);
|
||||
return;
|
||||
}
|
||||
|
||||
vec->z = Math_FAtan2F(mf->xy, mf->xx) * (32768 / M_PI);
|
||||
|
||||
if (!flag) {
|
||||
vec->x = Math_FAtan2F(mf->yz, mf->zz) * (32768 / M_PI);
|
||||
if ((rotDest->y == 0x4000) || (rotDest->y == -0x4000)) {
|
||||
rotDest->x = 0;
|
||||
rotDest->z = Math_FAtan2F(-mf->yx, mf->yy) * (0x8000 / M_PI);
|
||||
} else {
|
||||
temp = mf->yx;
|
||||
temp2 = mf->yy;
|
||||
temp3 = mf->zy;
|
||||
rotDest->z = Math_FAtan2F(mf->xy, mf->xx) * (0x8000 / M_PI);
|
||||
|
||||
temp *= temp;
|
||||
temp += SQ(temp2);
|
||||
temp2 = mf->yz;
|
||||
temp += SQ(temp2);
|
||||
temp = sqrtf(temp);
|
||||
temp = temp2 / temp;
|
||||
if (!flag) {
|
||||
rotDest->x = Math_FAtan2F(mf->yz, mf->zz) * (0x8000 / M_PI);
|
||||
} else {
|
||||
// see Matrix_MtxFToYXZRotS
|
||||
temp = mf->yx;
|
||||
temp2 = mf->yy;
|
||||
temp3 = mf->zy;
|
||||
|
||||
temp2 = mf->zx;
|
||||
temp2 *= temp2;
|
||||
temp2 += SQ(temp3);
|
||||
temp3 = mf->zz;
|
||||
temp2 += SQ(temp3);
|
||||
temp2 = sqrtf(temp2);
|
||||
temp2 = temp3 / temp2;
|
||||
temp *= temp;
|
||||
temp += SQ(temp2);
|
||||
temp2 = mf->yz;
|
||||
temp += SQ(temp2);
|
||||
temp = sqrtf(temp);
|
||||
temp = temp2 / temp;
|
||||
|
||||
vec->x = Math_FAtan2F(temp, temp2) * (32768 / M_PI);
|
||||
temp2 = mf->zx;
|
||||
temp2 *= temp2;
|
||||
temp2 += SQ(temp3);
|
||||
temp3 = mf->zz;
|
||||
temp2 += SQ(temp3);
|
||||
temp2 = sqrtf(temp2);
|
||||
temp2 = temp3 / temp2;
|
||||
|
||||
rotDest->x = Math_FAtan2F(temp, temp2) * (0x8000 / M_PI);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void func_800D23FC(f32 f, Vec3f* vec, u8 mode) {
|
||||
/*
|
||||
* Rotate the matrix by `f` radians around a unit vector `vec`.
|
||||
* NB: vec is assumed to be a unit vector.
|
||||
*/
|
||||
void Matrix_RotateAxis(f32 f, Vec3f* vec, u8 mode) {
|
||||
MtxF* cmf;
|
||||
f32 sin;
|
||||
f32 cos;
|
||||
|
|
|
@ -3150,7 +3150,7 @@ s32 BodyBreak_SpawnParts(Actor* actor, BodyBreak* bodyBreak, GlobalContext* glob
|
|||
mtx->wy, mtx->wz, 0, 0, objBankIndex, type);
|
||||
|
||||
if (spawnedEnPart != NULL) {
|
||||
func_800D20CC(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&bodyBreak->matrices[bodyBreak->count], &spawnedEnPart->actor.shape.rot, 0);
|
||||
spawnedEnPart->displayList = bodyBreak->dLists[bodyBreak->count];
|
||||
spawnedEnPart->actor.scale = actor->scale;
|
||||
}
|
||||
|
|
|
@ -1094,7 +1094,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
globalCtx->mf_11DA0.mf[2][3] = 0.0f;
|
||||
globalCtx->mf_11DA0.mf[1][3] = 0.0f;
|
||||
globalCtx->mf_11DA0.mf[0][3] = 0.0f;
|
||||
Matrix_Reverse(&globalCtx->mf_11DA0);
|
||||
Matrix_Transpose(&globalCtx->mf_11DA0);
|
||||
globalCtx->unk_11DE0 = Matrix_MtxFToMtx(Matrix_CheckFloats(&globalCtx->mf_11DA0, "../z_play.c", 4005),
|
||||
Graph_Alloc(gfxCtx, sizeof(Mtx)));
|
||||
|
||||
|
|
|
@ -1244,13 +1244,13 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||
Matrix_MultVec3f(&D_80126128, &hookedActor->world.pos);
|
||||
Matrix_RotateRPY(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp14C);
|
||||
func_800D20CC(&sp14C, &hookedActor->world.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0);
|
||||
hookedActor->shape.rot = hookedActor->world.rot;
|
||||
} else if (this->stateFlags1 & 0x800) {
|
||||
Vec3s spB8;
|
||||
|
||||
Matrix_Get(&sp14C);
|
||||
func_800D20CC(&sp14C, &spB8, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp14C, &spB8, 0);
|
||||
|
||||
if (hookedActor->flags & 0x20000) {
|
||||
hookedActor->world.rot.x = hookedActor->shape.rot.x = spB8.x - this->unk_3BC.x;
|
||||
|
@ -1260,7 +1260,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||
}
|
||||
} else {
|
||||
Matrix_Get(&this->mf_9E0);
|
||||
func_800D20CC(&this->mf_9E0, &this->unk_3BC, 0);
|
||||
Matrix_MtxFToYXZRotS(&this->mf_9E0, &this->unk_3BC, 0);
|
||||
}
|
||||
}
|
||||
} else if (limbIndex == PLAYER_LIMB_R_HAND) {
|
||||
|
@ -1326,7 +1326,7 @@ void func_80090D20(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3s*
|
|||
Matrix_MultVec3f(&D_80126190, &heldActor->world.pos);
|
||||
Matrix_RotateRPY(0, -0x4000, -0x4000, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp44);
|
||||
func_800D20CC(&sp44, &heldActor->world.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp44, &heldActor->world.rot, 0);
|
||||
heldActor->shape.rot = heldActor->world.rot;
|
||||
|
||||
if (func_8002DD78(this) != 0) {
|
||||
|
|
|
@ -194,13 +194,13 @@ void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) {
|
|||
D_8087D958.x = 30.0f;
|
||||
}
|
||||
Matrix_RotateY(this->dyna.actor.world.rot.y * (M_PI / 0x8000), 0);
|
||||
func_800D23FC(this->counter * (191 * M_PI / 3750), &D_8087D964, 1);
|
||||
Matrix_RotateAxis(this->counter * (191 * M_PI / 3750), &D_8087D964, 1);
|
||||
Matrix_MultVec3f(&D_8087D958, &vec);
|
||||
this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + vec.x;
|
||||
this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + vec.y;
|
||||
this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + vec.z;
|
||||
Matrix_Get(&mtx);
|
||||
func_800D20CC(&mtx, &this->dyna.actor.shape.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0);
|
||||
}
|
||||
|
||||
void BgHakaHuta_DoNothing(BgHakaHuta* this, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -17,13 +17,13 @@ void BgJyaGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
|||
void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void BgJyaGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_80897DF0(BgJyaGoroiwa* this, GlobalContext* globalCtx);
|
||||
void func_80897B48(BgJyaGoroiwa* this, GlobalContext* globalCtx);
|
||||
void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx);
|
||||
void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx);
|
||||
|
||||
void func_80897DDC(BgJyaGoroiwa* this);
|
||||
void func_80897B1C(BgJyaGoroiwa* this);
|
||||
void func_80897A2C(BgJyaGoroiwa* this);
|
||||
void func_80897970(BgJyaGoroiwa* this);
|
||||
void BgJyaGoroiwa_SetupWait(BgJyaGoroiwa* this);
|
||||
void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this);
|
||||
void BgJyaGoroiwa_UpdateRotation(BgJyaGoroiwa* this);
|
||||
void BgJyaGoroiwa_UpdateCollider(BgJyaGoroiwa* this);
|
||||
|
||||
const ActorInit Bg_Jya_Goroiwa_InitVars = {
|
||||
ACTOR_BG_JYA_GOROIWA,
|
||||
|
@ -73,39 +73,39 @@ static InitChainEntry sInitChain[] = {
|
|||
ICHAIN_F32(uncullZoneDownward, 1000, ICHAIN_STOP),
|
||||
};
|
||||
|
||||
void func_80897970(BgJyaGoroiwa* this) {
|
||||
void BgJyaGoroiwa_UpdateCollider(BgJyaGoroiwa* this) {
|
||||
Sphere16* worldSphere = &this->collider.elements[0].dim.worldSphere;
|
||||
|
||||
worldSphere->center.x = this->actor.world.pos.x;
|
||||
worldSphere->center.y = (s32)(this->actor.world.pos.y + 59.5f);
|
||||
worldSphere->center.y = this->actor.world.pos.y + 59.5f;
|
||||
worldSphere->center.z = this->actor.world.pos.z;
|
||||
}
|
||||
|
||||
void func_808979C0(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void BgJyaGoroiwa_InitCollider(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
Collider_InitJntSph(globalCtx, &this->collider);
|
||||
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, &this->colliderItem);
|
||||
func_80897970(this);
|
||||
BgJyaGoroiwa_UpdateCollider(this);
|
||||
this->collider.elements[0].dim.worldSphere.radius = 58;
|
||||
}
|
||||
|
||||
void func_80897A2C(BgJyaGoroiwa* this) {
|
||||
f32 posDiff = this->actor.world.pos.x - this->actor.prevPos.x;
|
||||
void BgJyaGoroiwa_UpdateRotation(BgJyaGoroiwa* this) {
|
||||
f32 xDiff = this->actor.world.pos.x - this->actor.prevPos.x;
|
||||
|
||||
this->actor.shape.rot.z -= 0x10000 / (119 * M_PI) * posDiff;
|
||||
this->actor.shape.rot.z -= 0x10000 / (119 * M_PI) * xDiff;
|
||||
}
|
||||
|
||||
void BgJyaGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgJyaGoroiwa* this = THIS;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
func_808979C0(this, globalCtx);
|
||||
BgJyaGoroiwa_InitCollider(this, globalCtx);
|
||||
this->actor.shape.rot.x = this->actor.shape.rot.y = this->actor.shape.rot.z = 0;
|
||||
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
|
||||
ActorShape_Init(&this->actor.shape, 595.0f, ActorShadow_DrawCircle, 9.0f);
|
||||
this->actor.shape.shadowAlpha = 128;
|
||||
func_80897B1C(this);
|
||||
BgJyaGoroiwa_SetupMove(this);
|
||||
}
|
||||
|
||||
void BgJyaGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
||||
|
@ -114,64 +114,63 @@ void BgJyaGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx) {
|
|||
Collider_DestroyJntSph(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
void func_80897B1C(BgJyaGoroiwa* this) {
|
||||
this->actionFunc = func_80897B48;
|
||||
void BgJyaGoroiwa_SetupMove(BgJyaGoroiwa* this) {
|
||||
this->actionFunc = BgJyaGoroiwa_Move;
|
||||
this->collider.base.atFlags |= AT_ON;
|
||||
this->unk_1B4 = 0;
|
||||
this->unk_1B0 = 1.0f;
|
||||
this->hasHit = false;
|
||||
this->speedFactor = 1.0f;
|
||||
}
|
||||
|
||||
void func_80897B48(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
Actor* thisx = &this->actor;
|
||||
f32 tmpf2;
|
||||
s16 tmp16;
|
||||
f32 tmpf1 = (-100.0f - thisx->world.pos.y) * 2.5f;
|
||||
s16 relYawTowardsPlayer;
|
||||
f32 speedXZsqBase = (-100.0f - thisx->world.pos.y) * 2.5f;
|
||||
f32 posYfac;
|
||||
|
||||
if (tmpf1 < 0.01f) {
|
||||
tmpf1 = 0.01f;
|
||||
if (speedXZsqBase < 0.01f) {
|
||||
speedXZsqBase = 0.01f;
|
||||
}
|
||||
|
||||
thisx->speedXZ = (sqrtf(tmpf1) * this->unk_1B0);
|
||||
thisx->velocity.x = (Math_SinS(thisx->world.rot.y) * thisx->speedXZ);
|
||||
thisx->speedXZ = sqrtf(speedXZsqBase) * this->speedFactor;
|
||||
thisx->velocity.x = Math_SinS(thisx->world.rot.y) * thisx->speedXZ;
|
||||
thisx->velocity.z = Math_CosS(thisx->world.rot.y) * thisx->speedXZ;
|
||||
|
||||
tmpf2 = Math_CosS(thisx->world.rot.y) * thisx->speedXZ;
|
||||
thisx->velocity.z = tmpf2;
|
||||
thisx->world.pos.x = thisx->world.pos.x + thisx->velocity.x;
|
||||
thisx->world.pos.z = thisx->world.pos.z + tmpf2;
|
||||
thisx->world.pos.z = thisx->world.pos.z + thisx->velocity.z;
|
||||
|
||||
if ((1466.0f < thisx->world.pos.x) && (thisx->world.pos.x < 1673.0f)) {
|
||||
if ((thisx->world.pos.x > 1466.0f) && (thisx->world.pos.x < 1673.0f)) {
|
||||
thisx->world.pos.y = -129.5f;
|
||||
} else {
|
||||
tmpf2 = 1569.0f - thisx->world.pos.x;
|
||||
tmpf1 = fabsf(tmpf2) - 103.0f;
|
||||
thisx->world.pos.y = ((35.0f / 92.0f) * tmpf1) - 129.5f;
|
||||
posYfac = 1569.0f - thisx->world.pos.x;
|
||||
posYfac = fabsf(posYfac) - 103.0f;
|
||||
thisx->world.pos.y = ((35.0f / 92.0f) * posYfac) - 129.5f;
|
||||
}
|
||||
|
||||
if (this->collider.base.atFlags & AT_HIT) {
|
||||
this->collider.base.atFlags &= ~AT_HIT & ~AT_ON;
|
||||
|
||||
tmp16 = thisx->yawTowardsPlayer - thisx->world.rot.y;
|
||||
if ((tmp16 > -0x4000) && (tmp16 < 0x4000)) {
|
||||
relYawTowardsPlayer = thisx->yawTowardsPlayer - thisx->world.rot.y;
|
||||
if ((relYawTowardsPlayer > -0x4000) && (relYawTowardsPlayer < 0x4000)) {
|
||||
thisx->world.rot.y += 0x8000;
|
||||
}
|
||||
|
||||
func_8002F6D4(globalCtx, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0);
|
||||
func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT);
|
||||
|
||||
this->unk_1B8 = 10.0f;
|
||||
this->unk_1B0 = 0.5f;
|
||||
this->unk_1B4 = 1;
|
||||
this->yOffsetSpeed = 10.0f;
|
||||
this->speedFactor = 0.5f;
|
||||
this->hasHit = true;
|
||||
}
|
||||
|
||||
if (this->unk_1B4) {
|
||||
this->unk_1B8 -= 1.5f;
|
||||
thisx->shape.yOffset += this->unk_1B8 * 10.0f;
|
||||
if (this->hasHit) {
|
||||
this->yOffsetSpeed -= 1.5f;
|
||||
thisx->shape.yOffset += this->yOffsetSpeed * 10.0f;
|
||||
if (thisx->shape.yOffset < 595.0f) {
|
||||
thisx->shape.yOffset = 595.0f;
|
||||
func_80897DDC(this);
|
||||
BgJyaGoroiwa_SetupWait(this);
|
||||
}
|
||||
} else {
|
||||
Math_StepToF(&this->unk_1B0, 1.0f, 0.04f);
|
||||
Math_StepToF(&this->speedFactor, 1.0f, 0.04f);
|
||||
}
|
||||
|
||||
if (thisx->world.pos.x > 1745.0f) {
|
||||
|
@ -183,16 +182,16 @@ void func_80897B48(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
|||
Audio_PlayActorSound2(thisx, NA_SE_EV_BIGBALL_ROLL - SFX_FLAG);
|
||||
}
|
||||
|
||||
void func_80897DDC(BgJyaGoroiwa* this) {
|
||||
this->actionFunc = func_80897DF0;
|
||||
this->unk_1B6 = 0;
|
||||
void BgJyaGoroiwa_SetupWait(BgJyaGoroiwa* this) {
|
||||
this->actionFunc = BgJyaGoroiwa_Wait;
|
||||
this->waitTimer = 0;
|
||||
}
|
||||
|
||||
void func_80897DF0(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
this->unk_1B6++;
|
||||
if (this->unk_1B6 >= 0x3D) {
|
||||
func_80897B1C(this);
|
||||
this->unk_1B0 = 0.1f;
|
||||
void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx) {
|
||||
this->waitTimer++;
|
||||
if (this->waitTimer > 60) {
|
||||
BgJyaGoroiwa_SetupMove(this);
|
||||
this->speedFactor = 0.1f;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,13 +204,13 @@ void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
|
||||
if (!(player->stateFlags1 & 0x300000C0)) {
|
||||
this->actionFunc(this, globalCtx);
|
||||
func_80897A2C(this);
|
||||
BgJyaGoroiwa_UpdateRotation(this);
|
||||
pos.x = this->actor.world.pos.x;
|
||||
pos.y = this->actor.world.pos.y + 59.5f;
|
||||
pos.z = this->actor.world.pos.z;
|
||||
this->actor.floorHeight =
|
||||
BgCheck_EntityRaycastFloor4(&globalCtx->colCtx, &this->actor.floorPoly, &bgId, &this->actor, &pos);
|
||||
func_80897970(this);
|
||||
BgJyaGoroiwa_UpdateCollider(this);
|
||||
if (this->collider.base.atFlags & AT_ON) {
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
|
@ -220,7 +219,5 @@ void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
void BgJyaGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx) {
|
||||
BgJyaGoroiwa* this = THIS;
|
||||
|
||||
Gfx_DrawDListOpa(globalCtx, gRollingRockDL);
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ typedef struct BgJyaGoroiwa {
|
|||
/* 0x014C */ BgJyaGoroiwaFunc actionFunc;
|
||||
/* 0x0150 */ ColliderJntSph collider;
|
||||
/* 0x0170 */ ColliderJntSphElement colliderItem;
|
||||
/* 0x01B0 */ f32 unk_1B0;
|
||||
/* 0x01B4 */ s16 unk_1B4;
|
||||
/* 0x01B6 */ s16 unk_1B6;
|
||||
/* 0x01B8 */ f32 unk_1B8;
|
||||
/* 0x01B0 */ f32 speedFactor;
|
||||
/* 0x01B4 */ s16 hasHit;
|
||||
/* 0x01B6 */ s16 waitTimer;
|
||||
/* 0x01B8 */ f32 yOffsetSpeed;
|
||||
} BgJyaGoroiwa; // size = 0x01BC
|
||||
|
||||
extern const ActorInit Bg_Jya_Goroiwa_InitVars;
|
||||
|
|
|
@ -246,10 +246,11 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, GlobalContext* globalCtx) {
|
|||
}
|
||||
|
||||
// Rotation by the angle between surfaceNormal and the vertical about rotationAxis
|
||||
func_800D23FC(Math_FAcosF(Math3D_Cos(&sVerticalVector, &this->surfaceNormal)), &this->rotationAxis, MTXMODE_NEW);
|
||||
Matrix_RotateAxis(Math_FAcosF(Math3D_Cos(&sVerticalVector, &this->surfaceNormal)), &this->rotationAxis,
|
||||
MTXMODE_NEW);
|
||||
Matrix_RotateY(this->dyna.actor.shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_Get(&mtx);
|
||||
func_800D20CC(&mtx, &this->dyna.actor.shape.rot, MTXMODE_NEW);
|
||||
Matrix_MtxFToYXZRotS(&mtx, &this->dyna.actor.shape.rot, 0);
|
||||
}
|
||||
|
||||
void BgSpot08Iceblock_SpawnTwinFloe(BgSpot08Iceblock* this, GlobalContext* globalCtx) {
|
||||
|
|
|
@ -1911,7 +1911,7 @@ void BossFd_DrawBody(GlobalContext* globalCtx, BossFd* this) {
|
|||
this->bodyFallApart[i] = 2;
|
||||
Matrix_MultVec3f(&spF0, &spE4);
|
||||
Matrix_Get(&spFC);
|
||||
func_800D20CC(&spFC, &spDC, 0);
|
||||
Matrix_MtxFToYXZRotS(&spFC, &spDC, 0);
|
||||
bones =
|
||||
(EnVbBall*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_VB_BALL,
|
||||
spE4.x, spE4.y, spE4.z, spDC.x, spDC.y, spDC.z, i + 200);
|
||||
|
|
|
@ -2070,7 +2070,7 @@ void BossGoma_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList,
|
|||
this->deadLimbsState[limbIndex] = 2;
|
||||
Matrix_MultVec3f(&zero, &childPos);
|
||||
Matrix_Get(&mtx);
|
||||
func_800D20CC(&mtx, &childRot, 0);
|
||||
Matrix_MtxFToYXZRotS(&mtx, &childRot, 0);
|
||||
// These are the pieces of Gohma as it falls apart. It appears to use the same actor as the baby gohmas.
|
||||
babyGohma = (EnGoma*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_GOMA,
|
||||
childPos.x, childPos.y, childPos.z, childRot.x, childRot.y, childRot.z,
|
||||
|
|
|
@ -2539,7 +2539,7 @@ void BossMo_DrawTentacle(BossMo* this, GlobalContext* globalCtx) {
|
|||
Matrix_MultVec3f(&sp8C, &this->grabPosRot.pos);
|
||||
Matrix_RotateX(-35 * M_PI / 64, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp98);
|
||||
func_800D20CC(&sp98, &sp84, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp98, &sp84, 0);
|
||||
this->grabPosRot.rot.x = sp84.x;
|
||||
this->grabPosRot.rot.y = sp84.y;
|
||||
this->grabPosRot.rot.z = sp84.z;
|
||||
|
|
|
@ -1179,7 +1179,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) {
|
|||
|
||||
this->beamShootState = 1;
|
||||
func_80078914(&player->actor.projectedPos, NA_SE_IT_SHIELD_REFLECT_MG);
|
||||
func_800D20CC(&player->shieldMf, &sp128, 0);
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &sp128, 0);
|
||||
sp128.y += 0x8000;
|
||||
sp128.x = -sp128.x;
|
||||
this->magicDir.x = sp128.x;
|
||||
|
@ -1285,7 +1285,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) {
|
|||
|
||||
if (this->beamShootState == 1) {
|
||||
if (this->csState1 == 0) {
|
||||
func_800D20CC(&player->shieldMf, &sp128, 0);
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &sp128, 0);
|
||||
sp128.y += 0x8000;
|
||||
sp128.x = -sp128.x;
|
||||
Math_ApproachS(&this->magicDir.x, sp128.x, 5, 0x2000);
|
||||
|
@ -4019,7 +4019,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) {
|
|||
|
||||
this->actor.world.pos = player2->bodyPartsPos[15];
|
||||
this->actor.world.pos.y = -2000.0f;
|
||||
func_800D20CC(&player2->shieldMf, &blastDir, MTXMODE_NEW);
|
||||
Matrix_MtxFToYXZRotS(&player2->shieldMf, &blastDir, MTXMODE_NEW);
|
||||
blastDir.x = -blastDir.x;
|
||||
blastDir.y = blastDir.y + 0x8000;
|
||||
Math_ApproachS(&this->magicDir.x, blastDir.x, 0xA, 0x800);
|
||||
|
@ -4209,7 +4209,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) {
|
|||
|
||||
this->actor.world.pos = player2->bodyPartsPos[15];
|
||||
this->actor.world.pos.y = -2000.0f;
|
||||
func_800D20CC(&player2->shieldMf, &reflDir, 0);
|
||||
Matrix_MtxFToYXZRotS(&player2->shieldMf, &reflDir, 0);
|
||||
reflDir.x = -reflDir.x;
|
||||
reflDir.y += 0x8000;
|
||||
Math_ApproachS(&this->magicDir.x, reflDir.x, 0xA, 0x800);
|
||||
|
@ -4434,7 +4434,7 @@ s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) {
|
|||
if ((sShieldIceCharge >= 3) || (sShieldFireCharge >= 3)) {
|
||||
this->timers[0] = 80;
|
||||
this->csState1 = 10;
|
||||
func_800D20CC(&player->shieldMf, &this->magicDir, 0);
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &this->magicDir, 0);
|
||||
this->magicDir.y += 0x8000;
|
||||
this->magicDir.x = -this->magicDir.x;
|
||||
D_8094C86F = 8;
|
||||
|
|
|
@ -3032,7 +3032,7 @@ s32 BossVa_ZapperOverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx**
|
|||
case 7:
|
||||
Matrix_Translate(pos->x, pos->y, pos->z, MTXMODE_APPLY);
|
||||
Matrix_Get(&zapperMtx);
|
||||
func_800D2264(&zapperMtx, &sZapperRot, false);
|
||||
Matrix_MtxFToZYXRotS(&zapperMtx, &sZapperRot, false);
|
||||
Matrix_RotateX(-sZapperRot.x * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_RotateY(-sZapperRot.y * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(-sZapperRot.z * (M_PI / 0x8000), MTXMODE_APPLY);
|
||||
|
|
|
@ -662,7 +662,7 @@ void DemoGt_Draw1(DemoGt* this, GlobalContext* globalCtx) {
|
|||
|
||||
Matrix_Push();
|
||||
|
||||
func_800D23FC(spC0, &spA8, 1);
|
||||
Matrix_RotateAxis(spC0, &spA8, 1);
|
||||
Matrix_Translate(sp9C.x, sp9C.y, sp9C.z, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(spB4, "../z_demo_gt_part1.c", 474);
|
||||
unk198 = this->unk_198;
|
||||
|
@ -1284,7 +1284,7 @@ void DemoGt_Draw4(DemoGt* this, GlobalContext* globalCtx2) {
|
|||
|
||||
Matrix_Push();
|
||||
|
||||
func_800D23FC(sp70, &sp54, 1);
|
||||
Matrix_RotateAxis(sp70, &sp54, 1);
|
||||
Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(sp60, "../z_demo_gt_part4_1.c", 232);
|
||||
|
||||
|
@ -1403,7 +1403,7 @@ void DemoGt_Draw5(DemoGt* this, GlobalContext* globalCtx) {
|
|||
|
||||
Matrix_Push();
|
||||
|
||||
func_800D23FC(sp70, &sp54, 1);
|
||||
Matrix_RotateAxis(sp70, &sp54, 1);
|
||||
Matrix_Translate(sp48.x, sp48.y, sp48.z, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(sp60, "../z_demo_gt_part4_2.c", 227);
|
||||
|
||||
|
@ -1499,7 +1499,7 @@ void DemoGt_Draw6(DemoGt* this, GlobalContext* globalCtx) {
|
|||
|
||||
Matrix_Push();
|
||||
|
||||
func_800D23FC(sp74, &sp58, 1);
|
||||
Matrix_RotateAxis(sp74, &sp58, 1);
|
||||
Matrix_Translate(sp4C.x, sp4C.y, sp4C.z, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(sp64, "../z_demo_gt_part4_3.c", 291);
|
||||
|
||||
|
@ -1591,7 +1591,7 @@ void DemoGt_Draw7(DemoGt* this, GlobalContext* globalCtx) {
|
|||
|
||||
Matrix_Push();
|
||||
|
||||
func_800D23FC(sp68, &sp50, MTXMODE_APPLY);
|
||||
Matrix_RotateAxis(sp68, &sp50, MTXMODE_APPLY);
|
||||
Matrix_Translate(sp44.x, sp44.y, sp44.z, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(sp5C, "../z_demo_gt_part5.c", 152);
|
||||
|
||||
|
@ -1682,7 +1682,7 @@ void DemoGt_Draw8(DemoGt* this, GlobalContext* globalCtx) {
|
|||
|
||||
Matrix_Push();
|
||||
|
||||
func_800D23FC(sp68, &sp50, 1);
|
||||
Matrix_RotateAxis(sp68, &sp50, 1);
|
||||
Matrix_Translate(sp44.x, sp44.y, sp44.z, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(sp5C, "../z_demo_gt_part6.c", 153);
|
||||
|
||||
|
|
|
@ -150,7 +150,7 @@ void func_809C5BA8(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* glob
|
|||
|
||||
if (!(sp74 < 0.001f)) {
|
||||
EnBomChu_CrossProduct(&this->unk_160, &sp84, &sp78);
|
||||
func_800D23FC(sp74, &sp78, 0);
|
||||
Matrix_RotateAxis(sp74, &sp78, 0);
|
||||
Matrix_MultVec3f(&this->unk_16C, &sp78);
|
||||
this->unk_16C = sp78;
|
||||
EnBomChu_CrossProduct(&this->unk_16C, &sp84, &this->unk_154);
|
||||
|
@ -182,7 +182,7 @@ void func_809C5BA8(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* glob
|
|||
mf.zy = this->unk_154.y;
|
||||
mf.zz = this->unk_154.z;
|
||||
|
||||
func_800D20CC(&mf, &this->actor.world.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&mf, &this->actor.world.rot, 0);
|
||||
|
||||
this->actor.world.rot.x = -this->actor.world.rot.x;
|
||||
}
|
||||
|
|
|
@ -17,21 +17,32 @@
|
|||
typedef s32 (*EnGoroiwaUnkFunc1)(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
typedef void (*EnGoroiwaUnkFunc2)(EnGoroiwa* this);
|
||||
|
||||
#define ENGOROIWA_ENABLE_AT (1 << 0)
|
||||
#define ENGOROIWA_ENABLE_OC (1 << 1)
|
||||
#define ENGOROIWA_PLAYER_IN_THE_WAY (1 << 2)
|
||||
#define ENGOROIWA_RETAIN_ROT_SPEED (1 << 3)
|
||||
#define ENGOROIWA_IN_WATER (1 << 4)
|
||||
|
||||
#define ENGOROIWA_LOOPMODE_ONEWAY 0
|
||||
/* same as ENGOROIWA_LOOPMODE_ONEWAY but display rock fragments as if the boulder broke at the end of the path*/
|
||||
#define ENGOROIWA_LOOPMODE_ONEWAY_BREAK 1
|
||||
#define ENGOROIWA_LOOPMODE_ROUNDTRIP 3
|
||||
|
||||
void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_Draw(Actor* thisx, GlobalContext* globalCtx);
|
||||
|
||||
void func_80A4D5E0(EnGoroiwa* this);
|
||||
void func_80A4D624(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void func_80A4D8CC(EnGoroiwa* this);
|
||||
void func_80A4D944(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void func_80A4D9DC(EnGoroiwa* this);
|
||||
void func_80A4DA3C(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void func_80A4DA7C(EnGoroiwa* this);
|
||||
void func_80A4DAD0(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void func_80A4DB90(EnGoroiwa* this);
|
||||
void func_80A4DC00(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_SetupRoll(EnGoroiwa* this);
|
||||
void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_SetupMoveAndFallToGround(EnGoroiwa* this);
|
||||
void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_SetupWait(EnGoroiwa* this);
|
||||
void EnGoroiwa_Wait(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_SetupMoveUp(EnGoroiwa* this);
|
||||
void EnGoroiwa_MoveUp(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
void EnGoroiwa_SetupMoveDown(EnGoroiwa* this);
|
||||
void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx);
|
||||
|
||||
const ActorInit En_Goroiwa_InitVars = {
|
||||
ACTOR_EN_GOROIWA,
|
||||
|
@ -74,30 +85,29 @@ static ColliderJntSphInit sJntSphInit = {
|
|||
|
||||
static CollisionCheckInfoInit sColChkInfoInit = { 0, 12, 60, MASS_HEAVY };
|
||||
|
||||
// Unused
|
||||
static f32 D_80A4DEBC[] = { 10.0f, 9.2f };
|
||||
static f32 sUnused[] = { 10.0f, 9.2f };
|
||||
|
||||
void func_80A4BCA0(EnGoroiwa* this) {
|
||||
static f32 colliderHeightOffset[] = { 0.0f, 59.5f };
|
||||
void EnGoroiwa_UpdateCollider(EnGoroiwa* this) {
|
||||
static f32 yOffsets[] = { 0.0f, 59.5f };
|
||||
Sphere16* worldSphere = &this->collider.elements[0].dim.worldSphere;
|
||||
|
||||
worldSphere->center.x = this->actor.world.pos.x;
|
||||
worldSphere->center.y = this->actor.world.pos.y + colliderHeightOffset[(this->actor.params >> 10) & 1];
|
||||
worldSphere->center.y = this->actor.world.pos.y + yOffsets[(this->actor.params >> 10) & 1];
|
||||
worldSphere->center.z = this->actor.world.pos.z;
|
||||
}
|
||||
|
||||
void func_80A4BD04(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void EnGoroiwa_InitCollider(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
|
||||
Collider_InitJntSph(globalCtx, &this->collider);
|
||||
Collider_SetJntSph(globalCtx, &this->collider, &this->actor, &sJntSphInit, this->colliderItems);
|
||||
func_80A4BCA0(this);
|
||||
EnGoroiwa_UpdateCollider(this);
|
||||
this->collider.elements[0].dim.worldSphere.radius = 58;
|
||||
}
|
||||
|
||||
void func_80A4BD70(EnGoroiwa* this, u8 arg1) {
|
||||
this->unk_1D3 &= ~3;
|
||||
this->unk_1D3 |= arg1;
|
||||
void EnGoroiwa_UpdateFlags(EnGoroiwa* this, u8 setFlags) {
|
||||
this->stateFlags &= ~(ENGOROIWA_ENABLE_AT | ENGOROIWA_ENABLE_OC);
|
||||
this->stateFlags |= setFlags;
|
||||
}
|
||||
|
||||
s32 EnGoroiwa_Vec3fNormalize(Vec3f* ret, Vec3f* a) {
|
||||
|
@ -120,14 +130,14 @@ s32 EnGoroiwa_Vec3fNormalize(Vec3f* ret, Vec3f* a) {
|
|||
void EnGoroiwa_SetSpeed(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
if (globalCtx->sceneNum == SCENE_SPOT04) {
|
||||
this->isInKokiri = true;
|
||||
mREG(12) = 920;
|
||||
R_EN_GOROIWA_SPEED = 920;
|
||||
} else {
|
||||
this->isInKokiri = false;
|
||||
mREG(12) = 1000;
|
||||
R_EN_GOROIWA_SPEED = 1000;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A4BE54(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void EnGoroiwa_FaceNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
Vec3s* nextPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint;
|
||||
Vec3f nextPosF;
|
||||
|
@ -139,53 +149,53 @@ void func_80A4BE54(EnGoroiwa* this, GlobalContext* globalCtx) {
|
|||
this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &nextPosF);
|
||||
}
|
||||
|
||||
void func_80A4BF28(EnGoroiwa* this, GlobalContext* globalCtx, Vec3f* arg2) {
|
||||
s16 temp_v0 = (this->actor.params >> 8) & 3;
|
||||
void EnGoroiwa_GetPrevWaypointDiff(EnGoroiwa* this, GlobalContext* globalCtx, Vec3f* dest) {
|
||||
s16 loopMode = (this->actor.params >> 8) & 3;
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
s16 temp_t0 = this->currentWaypoint - this->pathDirection;
|
||||
Vec3s* pointPos;
|
||||
s16 prevWaypoint = this->currentWaypoint - this->pathDirection;
|
||||
Vec3s* prevPointPos;
|
||||
Vec3s* currentPointPos;
|
||||
|
||||
if (temp_t0 < 0) {
|
||||
if (temp_v0 == 0 || temp_v0 == 1) {
|
||||
temp_t0 = this->endWaypoint;
|
||||
} else if (temp_v0 == 3) {
|
||||
temp_t0 = 1;
|
||||
if (prevWaypoint < 0) {
|
||||
if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) {
|
||||
prevWaypoint = this->endWaypoint;
|
||||
} else if (loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) {
|
||||
prevWaypoint = 1;
|
||||
}
|
||||
} else if (this->endWaypoint < temp_t0) {
|
||||
if (temp_v0 == 0 || temp_v0 == 1) {
|
||||
temp_t0 = 0;
|
||||
} else if (temp_v0 == 3) {
|
||||
temp_t0 = this->endWaypoint - 1;
|
||||
} else if (prevWaypoint > this->endWaypoint) {
|
||||
if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) {
|
||||
prevWaypoint = 0;
|
||||
} else if (loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) {
|
||||
prevWaypoint = this->endWaypoint - 1;
|
||||
}
|
||||
}
|
||||
|
||||
currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint;
|
||||
pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + temp_t0;
|
||||
arg2->x = currentPointPos->x - pointPos->x;
|
||||
arg2->y = currentPointPos->x - pointPos->y;
|
||||
arg2->z = currentPointPos->x - pointPos->z;
|
||||
prevPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + prevWaypoint;
|
||||
dest->x = currentPointPos->x - prevPointPos->x;
|
||||
dest->y = currentPointPos->x - prevPointPos->y;
|
||||
dest->z = currentPointPos->x - prevPointPos->z;
|
||||
}
|
||||
|
||||
void func_80A4C080(EnGoroiwa* this) {
|
||||
s16 temp_v0 = (this->actor.params >> 8) & 3;
|
||||
void EnGoroiw_CheckEndOfPath(EnGoroiwa* this) {
|
||||
s16 loopMode = (this->actor.params >> 8) & 3;
|
||||
|
||||
if (this->nextWaypoint < 0) {
|
||||
if (temp_v0 == 0 || temp_v0 == 1) {
|
||||
if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) {
|
||||
this->currentWaypoint = this->endWaypoint;
|
||||
this->nextWaypoint = this->endWaypoint - 1;
|
||||
this->pathDirection = -1;
|
||||
} else if (temp_v0 == 3) {
|
||||
} else if (loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) {
|
||||
this->currentWaypoint = 0;
|
||||
this->nextWaypoint = 1;
|
||||
this->pathDirection = 1;
|
||||
}
|
||||
} else if (this->nextWaypoint > this->endWaypoint) {
|
||||
if (temp_v0 == 0 || temp_v0 == 1) {
|
||||
if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) {
|
||||
this->currentWaypoint = 0;
|
||||
this->nextWaypoint = 1;
|
||||
this->pathDirection = 1;
|
||||
} else if (temp_v0 == 3) {
|
||||
} else if (loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) {
|
||||
this->currentWaypoint = this->endWaypoint;
|
||||
this->nextWaypoint = this->endWaypoint - 1;
|
||||
this->pathDirection = -1;
|
||||
|
@ -193,26 +203,26 @@ void func_80A4C080(EnGoroiwa* this) {
|
|||
}
|
||||
}
|
||||
|
||||
void func_80A4C134(EnGoroiwa* this) {
|
||||
void EnGoroiwa_SetNextWaypoint(EnGoroiwa* this) {
|
||||
this->currentWaypoint = this->nextWaypoint;
|
||||
this->nextWaypoint += this->pathDirection;
|
||||
func_80A4C080(this);
|
||||
EnGoroiw_CheckEndOfPath(this);
|
||||
}
|
||||
|
||||
void func_80A4C164(EnGoroiwa* this) {
|
||||
void EnGoroiwa_ReverseDirection(EnGoroiwa* this) {
|
||||
this->pathDirection *= -1;
|
||||
this->currentWaypoint = this->nextWaypoint;
|
||||
this->nextWaypoint += this->pathDirection;
|
||||
}
|
||||
|
||||
void func_80A4C188(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void EnGoroiwa_InitPath(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
this->endWaypoint = globalCtx->setupPathList[this->actor.params & 0xFF].count - 1;
|
||||
this->currentWaypoint = 0;
|
||||
this->nextWaypoint = 1;
|
||||
this->pathDirection = 1;
|
||||
}
|
||||
|
||||
void func_80A4C1C4(EnGoroiwa* this, GlobalContext* globalCtx, s32 waypoint) {
|
||||
void EnGoroiwa_TeleportToWaypoint(EnGoroiwa* this, GlobalContext* globalCtx, s32 waypoint) {
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
Vec3s* pointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + waypoint;
|
||||
|
||||
|
@ -221,12 +231,12 @@ void func_80A4C1C4(EnGoroiwa* this, GlobalContext* globalCtx, s32 waypoint) {
|
|||
this->actor.world.pos.z = pointPos->z;
|
||||
}
|
||||
|
||||
void func_80A4C264(EnGoroiwa* this) {
|
||||
this->unk_1B0.x = 1.0f;
|
||||
this->unk_1C0 = 1.0f;
|
||||
void EnGoroiwa_InitRotation(EnGoroiwa* this) {
|
||||
this->prevUnitRollAxis.x = 1.0f;
|
||||
this->rollRotSpeed = 1.0f;
|
||||
}
|
||||
|
||||
s32 func_80A4C27C(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 EnGoroiwa_GetAscendDirection(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint;
|
||||
|
@ -258,9 +268,9 @@ void EnGoroiwa_SpawnDust(GlobalContext* globalCtx, Vec3f* pos) {
|
|||
|
||||
for (i = 0; i < 8; i++) {
|
||||
angle += 0x4E20;
|
||||
randPos.x = pos->x + ((47.0f * ((Rand_ZeroOne() * 0.5f) + 0.5f)) * Math_SinS(angle));
|
||||
randPos.y = pos->y + ((Rand_ZeroOne() - 0.5f) * 40.0f);
|
||||
randPos.z = pos->z + ((47.0f * ((Rand_ZeroOne() * 0.5f) + 0.5f))) * Math_CosS(angle);
|
||||
randPos.x = pos->x + (47.0f * (Rand_ZeroOne() * 0.5f + 0.5f)) * Math_SinS(angle);
|
||||
randPos.y = pos->y + (Rand_ZeroOne() - 0.5f) * 40.0f;
|
||||
randPos.z = pos->z + ((47.0f * (Rand_ZeroOne() * 0.5f + 0.5f))) * Math_CosS(angle);
|
||||
func_800286CC(globalCtx, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 30.0f) + 100, 80);
|
||||
func_800286CC(globalCtx, &randPos, &velocity, &accel, (s16)(Rand_ZeroOne() * 20.0f) + 80, 80);
|
||||
}
|
||||
|
@ -284,13 +294,13 @@ void EnGoroiwa_SpawnWaterEffects(GlobalContext* globalCtx, Vec3f* contactPos) {
|
|||
EffectSsGRipple_Spawn(globalCtx, contactPos, 500, 1300, 8);
|
||||
}
|
||||
|
||||
s32 func_80A4C6C8(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 EnGoroiwa_MoveAndFall(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
Path* path;
|
||||
s32 result;
|
||||
s32 pad;
|
||||
Vec3s* nextPointPos;
|
||||
|
||||
Math_StepToF(&this->actor.speedXZ, mREG(12) * 0.01f, 0.3f);
|
||||
Math_StepToF(&this->actor.speedXZ, R_EN_GOROIWA_SPEED * 0.01f, 0.3f);
|
||||
func_8002D868(&this->actor);
|
||||
path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint;
|
||||
|
@ -300,20 +310,20 @@ s32 func_80A4C6C8(EnGoroiwa* this, GlobalContext* globalCtx) {
|
|||
return result;
|
||||
}
|
||||
|
||||
s32 func_80A4C814(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 EnGoroiwa_Move(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
s32 pad;
|
||||
Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint;
|
||||
Vec3s* currentPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->currentWaypoint;
|
||||
s32 result;
|
||||
s32 nextPointReached;
|
||||
Vec3f posDiff;
|
||||
Vec3f nextPointPosF;
|
||||
|
||||
nextPointPosF.x = nextPointPos->x;
|
||||
nextPointPosF.y = nextPointPos->y;
|
||||
nextPointPosF.z = nextPointPos->z;
|
||||
Math_StepToF(&this->actor.speedXZ, mREG(12) * 0.01f, 0.3f);
|
||||
if (Math3D_Vec3fDistSq(&nextPointPosF, &this->actor.world.pos) < 25.0f) {
|
||||
Math_StepToF(&this->actor.speedXZ, R_EN_GOROIWA_SPEED * 0.01f, 0.3f);
|
||||
if (Math3D_Vec3fDistSq(&nextPointPosF, &this->actor.world.pos) < SQ(5.0f)) {
|
||||
Math_Vec3f_Diff(&nextPointPosF, &this->actor.world.pos, &posDiff);
|
||||
} else {
|
||||
posDiff.x = nextPointPosF.x - currentPointPos->x;
|
||||
|
@ -324,40 +334,40 @@ s32 func_80A4C814(EnGoroiwa* this, GlobalContext* globalCtx) {
|
|||
this->actor.velocity.x *= this->actor.speedXZ;
|
||||
this->actor.velocity.y *= this->actor.speedXZ;
|
||||
this->actor.velocity.z *= this->actor.speedXZ;
|
||||
result = Math_StepToF(&this->actor.world.pos.x, nextPointPosF.x, fabsf(this->actor.velocity.x)) & 1;
|
||||
result &= Math_StepToF(&this->actor.world.pos.y, nextPointPosF.y, fabsf(this->actor.velocity.y));
|
||||
result &= Math_StepToF(&this->actor.world.pos.z, nextPointPosF.z, fabsf(this->actor.velocity.z));
|
||||
return result;
|
||||
nextPointReached = Math_StepToF(&this->actor.world.pos.x, nextPointPosF.x, fabsf(this->actor.velocity.x)) & 1;
|
||||
nextPointReached &= Math_StepToF(&this->actor.world.pos.y, nextPointPosF.y, fabsf(this->actor.velocity.y));
|
||||
nextPointReached &= Math_StepToF(&this->actor.world.pos.z, nextPointPosF.z, fabsf(this->actor.velocity.z));
|
||||
return nextPointReached;
|
||||
}
|
||||
|
||||
s32 func_80A4CA50(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 EnGoroiwa_MoveUpToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint;
|
||||
|
||||
Math_StepToF(&this->actor.velocity.y, (mREG(12) * 0.01f) * 0.5f, 0.18f);
|
||||
Math_StepToF(&this->actor.velocity.y, (R_EN_GOROIWA_SPEED * 0.01f) * 0.5f, 0.18f);
|
||||
this->actor.world.pos.x = nextPointPos->x;
|
||||
this->actor.world.pos.z = nextPointPos->z;
|
||||
return Math_StepToF(&this->actor.world.pos.y, nextPointPos->y, fabsf(this->actor.velocity.y));
|
||||
}
|
||||
|
||||
s32 func_80A4CB78(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 pad;
|
||||
Path* path = &globalCtx->setupPathList[this->actor.params & 0xFF];
|
||||
Vec3s* nextPointPos = (Vec3s*)SEGMENTED_TO_VIRTUAL(path->points) + this->nextWaypoint;
|
||||
f32 nextPointY;
|
||||
f32 thisY;
|
||||
f32 temp;
|
||||
f32 yDistToFloor;
|
||||
s32 quakeIdx;
|
||||
CollisionPoly* sp68;
|
||||
Vec3f sp5C;
|
||||
f32 temp_f0_2;
|
||||
CollisionPoly* floorPoly;
|
||||
Vec3f raycastFrom;
|
||||
f32 floorY;
|
||||
s32 pad2;
|
||||
s32 sp50;
|
||||
Vec3f sp44;
|
||||
s32 floorBgId;
|
||||
Vec3f dustPos;
|
||||
WaterBox* waterBox;
|
||||
f32 ySurface;
|
||||
Vec3f sp30;
|
||||
Vec3f waterHitPos;
|
||||
|
||||
nextPointY = nextPointPos->y;
|
||||
Math_StepToF(&this->actor.velocity.y, -14.0f, 1.0f);
|
||||
|
@ -367,47 +377,46 @@ s32 func_80A4CB78(EnGoroiwa* this, GlobalContext* globalCtx) {
|
|||
if (1) {}
|
||||
this->actor.world.pos.y += this->actor.velocity.y;
|
||||
if (this->actor.velocity.y < 0.0f && this->actor.world.pos.y <= nextPointY) {
|
||||
if (this->unk_1C6 == 0) {
|
||||
if (this->bounceCount == 0) {
|
||||
if (this->actor.xzDistToPlayer < 600.0f) {
|
||||
quakeIdx = Quake_Add(ACTIVE_CAM, 3);
|
||||
Quake_SetSpeed(quakeIdx, -0x3CB0);
|
||||
Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0);
|
||||
Quake_SetCountdown(quakeIdx, 7);
|
||||
}
|
||||
this->unk_1C0 = 0.0f;
|
||||
if (!(this->unk_1D3 & 0x10)) {
|
||||
sp5C.x = this->actor.world.pos.x;
|
||||
sp5C.y = this->actor.world.pos.y + 50.0f;
|
||||
sp5C.z = this->actor.world.pos.z;
|
||||
temp_f0_2 =
|
||||
BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &sp68, &sp50, &this->actor, &sp5C);
|
||||
// temp needed to match
|
||||
temp = temp_f0_2 - (this->actor.world.pos.y - 59.5f);
|
||||
if (fabsf(temp) < 15.0f) {
|
||||
sp44.x = this->actor.world.pos.x;
|
||||
sp44.y = temp_f0_2 + 10.0f;
|
||||
sp44.z = this->actor.world.pos.z;
|
||||
EnGoroiwa_SpawnDust(globalCtx, &sp44);
|
||||
this->rollRotSpeed = 0.0f;
|
||||
if (!(this->stateFlags & ENGOROIWA_IN_WATER)) {
|
||||
raycastFrom.x = this->actor.world.pos.x;
|
||||
raycastFrom.y = this->actor.world.pos.y + 50.0f;
|
||||
raycastFrom.z = this->actor.world.pos.z;
|
||||
floorY = BgCheck_EntityRaycastFloor5(globalCtx, &globalCtx->colCtx, &floorPoly, &floorBgId,
|
||||
&this->actor, &raycastFrom);
|
||||
yDistToFloor = floorY - (this->actor.world.pos.y - 59.5f);
|
||||
if (fabsf(yDistToFloor) < 15.0f) {
|
||||
dustPos.x = this->actor.world.pos.x;
|
||||
dustPos.y = floorY + 10.0f;
|
||||
dustPos.z = this->actor.world.pos.z;
|
||||
EnGoroiwa_SpawnDust(globalCtx, &dustPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->unk_1C6 > 0) {
|
||||
if (this->bounceCount >= 1) {
|
||||
return true;
|
||||
}
|
||||
this->unk_1C6 += 1;
|
||||
this->bounceCount++;
|
||||
this->actor.velocity.y *= -0.3f;
|
||||
this->actor.world.pos.y = nextPointY - ((this->actor.world.pos.y - nextPointY) * 0.3f);
|
||||
}
|
||||
if (this->unk_1C6 == 0 &&
|
||||
if (this->bounceCount == 0 &&
|
||||
WaterBox_GetSurfaceImpl(globalCtx, &globalCtx->colCtx, this->actor.world.pos.x, this->actor.world.pos.z,
|
||||
&ySurface, &waterBox) &&
|
||||
this->actor.world.pos.y <= ySurface) {
|
||||
this->unk_1D3 |= 0x10;
|
||||
this->stateFlags |= ENGOROIWA_IN_WATER;
|
||||
if (ySurface < thisY) {
|
||||
sp30.x = this->actor.world.pos.x;
|
||||
sp30.y = ySurface;
|
||||
sp30.z = this->actor.world.pos.z;
|
||||
EnGoroiwa_SpawnWaterEffects(globalCtx, &sp30);
|
||||
waterHitPos.x = this->actor.world.pos.x;
|
||||
waterHitPos.y = ySurface;
|
||||
waterHitPos.z = this->actor.world.pos.z;
|
||||
EnGoroiwa_SpawnWaterEffects(globalCtx, &waterHitPos);
|
||||
this->actor.velocity.y *= 0.2f;
|
||||
}
|
||||
if (this->actor.velocity.y < -8.0f) {
|
||||
|
@ -417,93 +426,96 @@ s32 func_80A4CB78(EnGoroiwa* this, GlobalContext* globalCtx) {
|
|||
return false;
|
||||
}
|
||||
|
||||
void func_80A4CED8(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void EnGoroiwa_UpdateRotation(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
static Vec3f unitY = { 0.0f, 1.0f, 0.0f };
|
||||
s32 pad;
|
||||
Vec3f* temp;
|
||||
f32 sp8C;
|
||||
Vec3f sp80;
|
||||
Vec3f sp74;
|
||||
Vec3f* rollAxisPtr;
|
||||
f32 rollAngleDiff;
|
||||
Vec3f rollAxis;
|
||||
Vec3f unitRollAxis;
|
||||
MtxF mtx;
|
||||
Vec3f sp28;
|
||||
Vec3f unusedDiff;
|
||||
|
||||
if (this->unk_1D3 & 8) {
|
||||
sp8C = this->unk_1BC;
|
||||
if (this->stateFlags & ENGOROIWA_RETAIN_ROT_SPEED) {
|
||||
rollAngleDiff = this->prevRollAngleDiff;
|
||||
} else {
|
||||
this->unk_1BC = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.prevPos) * (1.0f / 59.5f);
|
||||
sp8C = this->unk_1BC;
|
||||
this->prevRollAngleDiff = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.prevPos) * (1.0f / 59.5f);
|
||||
rollAngleDiff = this->prevRollAngleDiff;
|
||||
}
|
||||
sp8C *= this->unk_1C0;
|
||||
// temp assignment needed to match
|
||||
temp = &sp80;
|
||||
if (this->unk_1D3 & 8) {
|
||||
func_80A4BF28(this, globalCtx, &sp28);
|
||||
Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, temp);
|
||||
rollAngleDiff *= this->rollRotSpeed;
|
||||
rollAxisPtr = &rollAxis;
|
||||
if (this->stateFlags & ENGOROIWA_RETAIN_ROT_SPEED) {
|
||||
/*
|
||||
* EnGoroiwa_GetPrevWaypointDiff has no side effects and its result goes unused,
|
||||
* its result was probably meant to be used instead of the actor's velocity in the
|
||||
* Math3D_Vec3f_Cross call.
|
||||
*/
|
||||
EnGoroiwa_GetPrevWaypointDiff(this, globalCtx, &unusedDiff);
|
||||
Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, rollAxisPtr);
|
||||
} else {
|
||||
Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, temp);
|
||||
Math3D_Vec3f_Cross(&unitY, &this->actor.velocity, rollAxisPtr);
|
||||
}
|
||||
|
||||
if (EnGoroiwa_Vec3fNormalize(&sp74, temp)) {
|
||||
this->unk_1B0 = sp74;
|
||||
if (EnGoroiwa_Vec3fNormalize(&unitRollAxis, rollAxisPtr)) {
|
||||
this->prevUnitRollAxis = unitRollAxis;
|
||||
} else {
|
||||
sp74 = this->unk_1B0;
|
||||
unitRollAxis = this->prevUnitRollAxis;
|
||||
}
|
||||
|
||||
func_800D23FC(sp8C, &sp74, 0);
|
||||
Matrix_RotateY(this->actor.shape.rot.y * (2.0f * M_PI / 0x10000), 1);
|
||||
Matrix_RotateX(this->actor.shape.rot.x * (2.0f * M_PI / 0x10000), 1);
|
||||
Matrix_RotateZ(this->actor.shape.rot.z * (2.0f * M_PI / 0x10000), 1);
|
||||
Matrix_RotateAxis(rollAngleDiff, &unitRollAxis, MTXMODE_NEW);
|
||||
Matrix_RotateY(this->actor.shape.rot.y * (2.0f * M_PI / 0x10000), MTXMODE_APPLY);
|
||||
Matrix_RotateX(this->actor.shape.rot.x * (2.0f * M_PI / 0x10000), MTXMODE_APPLY);
|
||||
Matrix_RotateZ(this->actor.shape.rot.z * (2.0f * M_PI / 0x10000), MTXMODE_APPLY);
|
||||
Matrix_Get(&mtx);
|
||||
func_800D20CC(&mtx, &this->actor.shape.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&mtx, &this->actor.shape.rot, 0);
|
||||
}
|
||||
|
||||
void func_80A4D074(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s16 temp_v0 = (this->actor.params >> 8) & 3;
|
||||
void EnGoroiwa_NextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s16 loopMode = (this->actor.params >> 8) & 3;
|
||||
|
||||
func_80A4C134(this);
|
||||
EnGoroiwa_SetNextWaypoint(this);
|
||||
|
||||
if (temp_v0 == 0 || temp_v0 == 1) {
|
||||
if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY || loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK) {
|
||||
if (this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint) {
|
||||
func_80A4C1C4(this, globalCtx, this->currentWaypoint);
|
||||
EnGoroiwa_TeleportToWaypoint(this, globalCtx, this->currentWaypoint);
|
||||
}
|
||||
}
|
||||
|
||||
func_80A4BE54(this, globalCtx);
|
||||
EnGoroiwa_FaceNextWaypoint(this, globalCtx);
|
||||
}
|
||||
|
||||
void func_80A4D0FC(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
static f32 colliderHeightOffset[] = { 0.0f, 59.5f };
|
||||
void EnGoroiwa_SpawnFragments(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
static f32 yOffsets[] = { 0.0f, 59.5f };
|
||||
s16 angle1;
|
||||
s16 angle2;
|
||||
s32 pad;
|
||||
Vec3f* thisPos = &this->actor.world.pos;
|
||||
Vec3f effectPos;
|
||||
Vec3f fragmentVelocity;
|
||||
f32 temp_f24;
|
||||
f32 temp_f22;
|
||||
f32 temp_f20;
|
||||
f32 temp_f20_2;
|
||||
s16 temp_v0 = (this->actor.params >> 10) & 1;
|
||||
f32 cos1;
|
||||
f32 sin1;
|
||||
f32 sin2;
|
||||
s16 yOffsetIdx = (this->actor.params >> 10) & 1;
|
||||
s32 i;
|
||||
|
||||
for (i = 0, angle1 = 0; i < 16; i++, angle1 += 0x4E20) {
|
||||
temp_f22 = Math_SinS(angle1);
|
||||
temp_f24 = Math_CosS(angle1);
|
||||
sin1 = Math_SinS(angle1);
|
||||
cos1 = Math_CosS(angle1);
|
||||
angle2 = Rand_ZeroOne() * 0xFFFF;
|
||||
effectPos.x = ((Rand_ZeroOne() * 50.0f) * temp_f22) * Math_SinS(angle2);
|
||||
temp_f20_2 = Math_SinS(angle2);
|
||||
effectPos.y = (((Rand_ZeroOne() - 0.5f) * 100.0f) * temp_f20_2) + colliderHeightOffset[temp_v0];
|
||||
effectPos.z = ((Rand_ZeroOne() * 50.0f) * temp_f24) * Math_SinS(angle2);
|
||||
effectPos.x = Rand_ZeroOne() * 50.0f * sin1 * Math_SinS(angle2);
|
||||
sin2 = Math_SinS(angle2);
|
||||
effectPos.y = (Rand_ZeroOne() - 0.5f) * 100.0f * sin2 + yOffsets[yOffsetIdx];
|
||||
effectPos.z = Rand_ZeroOne() * 50.0f * cos1 * Math_SinS(angle2);
|
||||
fragmentVelocity.x = effectPos.x * 0.2f;
|
||||
fragmentVelocity.y = (Rand_ZeroOne() * 15.0f) + 2.0f;
|
||||
fragmentVelocity.y = Rand_ZeroOne() * 15.0f + 2.0f;
|
||||
fragmentVelocity.z = effectPos.z * 0.2f;
|
||||
Math_Vec3f_Sum(&effectPos, thisPos, &effectPos);
|
||||
EffectSsKakera_Spawn(globalCtx, &effectPos, &fragmentVelocity, &effectPos, -340, 33, 28, 2, 0,
|
||||
(Rand_ZeroOne() * 7.0f) + 1.0f, 1, 0, 70, KAKERA_COLOR_NONE, 1, gBoulderFragmentsDL);
|
||||
Rand_ZeroOne() * 7.0f + 1.0f, 1, 0, 70, KAKERA_COLOR_NONE, 1, gBoulderFragmentsDL);
|
||||
}
|
||||
|
||||
effectPos.x = thisPos->x;
|
||||
effectPos.y = thisPos->y + colliderHeightOffset[temp_v0];
|
||||
effectPos.y = thisPos->y + yOffsets[yOffsetIdx];
|
||||
effectPos.z = thisPos->z;
|
||||
func_80033480(globalCtx, &effectPos, 80.0f, 5, 70, 110, 1);
|
||||
func_80033480(globalCtx, &effectPos, 90.0f, 5, 110, 160, 1);
|
||||
|
@ -516,12 +528,12 @@ static InitChainEntry sInitChain[] = {
|
|||
};
|
||||
|
||||
void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
|
||||
static f32 D_80A4DF10[] = { 0.0f, 595.0f };
|
||||
static f32 yOffsets[] = { 0.0f, 595.0f };
|
||||
EnGoroiwa* this = THIS;
|
||||
s32 pathIdx;
|
||||
|
||||
Actor_ProcessInitChain(&this->actor, sInitChain);
|
||||
func_80A4BD04(this, globalCtx);
|
||||
EnGoroiwa_InitCollider(this, globalCtx);
|
||||
pathIdx = this->actor.params & 0xFF;
|
||||
if (pathIdx == 0xFF) {
|
||||
// Translation: Error: Invalid arg_data
|
||||
|
@ -537,14 +549,14 @@ void EnGoroiwa_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
return;
|
||||
}
|
||||
CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit);
|
||||
ActorShape_Init(&this->actor.shape, D_80A4DF10[(this->actor.params >> 10) & 1], ActorShadow_DrawCircle, 9.4f);
|
||||
ActorShape_Init(&this->actor.shape, yOffsets[(this->actor.params >> 10) & 1], ActorShadow_DrawCircle, 9.4f);
|
||||
this->actor.shape.shadowAlpha = 200;
|
||||
EnGoroiwa_SetSpeed(this, globalCtx);
|
||||
func_80A4C188(this, globalCtx);
|
||||
func_80A4C1C4(this, globalCtx, 0);
|
||||
func_80A4C264(this);
|
||||
func_80A4BE54(this, globalCtx);
|
||||
func_80A4D5E0(this);
|
||||
EnGoroiwa_InitPath(this, globalCtx);
|
||||
EnGoroiwa_TeleportToWaypoint(this, globalCtx, 0);
|
||||
EnGoroiwa_InitRotation(this);
|
||||
EnGoroiwa_FaceNextWaypoint(this, globalCtx);
|
||||
EnGoroiwa_SetupRoll(this);
|
||||
// Translation: (Goroiwa)
|
||||
osSyncPrintf("(ごろ岩)(arg 0x%04x)(rail %d)(end %d)(bgc %d)(hit %d)\n", this->actor.params,
|
||||
this->actor.params & 0xFF, (this->actor.params >> 8) & 3, (this->actor.params >> 10) & 1,
|
||||
|
@ -558,29 +570,29 @@ void EnGoroiwa_Destroy(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
Collider_DestroyJntSph(globalCtx, &this->collider);
|
||||
}
|
||||
|
||||
void func_80A4D5E0(EnGoroiwa* this) {
|
||||
this->actionFunc = func_80A4D624;
|
||||
func_80A4BD70(this, 3);
|
||||
this->unk_1C0 = 1.0f;
|
||||
void EnGoroiwa_SetupRoll(EnGoroiwa* this) {
|
||||
this->actionFunc = EnGoroiwa_Roll;
|
||||
EnGoroiwa_UpdateFlags(this, ENGOROIWA_ENABLE_AT | ENGOROIWA_ENABLE_OC);
|
||||
this->rollRotSpeed = 1.0f;
|
||||
}
|
||||
|
||||
static EnGoroiwaUnkFunc1 D_80A4DF18[] = { func_80A4C814, func_80A4C6C8 };
|
||||
static EnGoroiwaUnkFunc2 D_80A4DF20[] = { func_80A4D9DC, func_80A4D8CC };
|
||||
void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
static EnGoroiwaUnkFunc1 moveFuncs[] = { EnGoroiwa_Move, EnGoroiwa_MoveAndFall };
|
||||
static EnGoroiwaUnkFunc2 onHitSetupFuncs[] = { EnGoroiwa_SetupWait, EnGoroiwa_SetupMoveAndFallToGround };
|
||||
|
||||
void func_80A4D624(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
s32 temp_v0_5;
|
||||
s32 ascendDirection;
|
||||
s16 yawDiff;
|
||||
s16 temp_v1_2;
|
||||
s16 loopMode;
|
||||
|
||||
if (this->collider.base.atFlags & AT_HIT) {
|
||||
this->collider.base.atFlags &= ~AT_HIT;
|
||||
this->unk_1D3 &= ~4;
|
||||
this->stateFlags &= ~ENGOROIWA_PLAYER_IN_THE_WAY;
|
||||
yawDiff = this->actor.yawTowardsPlayer - this->actor.world.rot.y;
|
||||
if (yawDiff > -0x4000 && yawDiff < 0x4000) {
|
||||
this->unk_1D3 |= 4;
|
||||
if ((this->actor.params >> 10) & 1 || (this->actor.home.rot.z & 1) != 1) {
|
||||
func_80A4C164(this);
|
||||
func_80A4BE54(this, globalCtx);
|
||||
this->stateFlags |= ENGOROIWA_PLAYER_IN_THE_WAY;
|
||||
if (((this->actor.params >> 10) & 1) || (this->actor.home.rot.z & 1) != 1) {
|
||||
EnGoroiwa_ReverseDirection(this);
|
||||
EnGoroiwa_FaceNextWaypoint(this, globalCtx);
|
||||
}
|
||||
}
|
||||
func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0);
|
||||
|
@ -588,122 +600,122 @@ void func_80A4D624(EnGoroiwa* this, GlobalContext* globalCtx) {
|
|||
// Translation: Player knocked down
|
||||
osSyncPrintf("Player ぶっ飛ばし\n");
|
||||
osSyncPrintf(VT_RST);
|
||||
D_80A4DF20[(this->actor.params >> 10) & 1](this);
|
||||
onHitSetupFuncs[(this->actor.params >> 10) & 1](this);
|
||||
func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT);
|
||||
if ((this->actor.home.rot.z & 1) == 1) {
|
||||
this->collisionTimer = 50;
|
||||
this->collisionDisabledTimer = 50;
|
||||
}
|
||||
} else if (D_80A4DF18[(this->actor.params >> 10) & 1](this, globalCtx)) {
|
||||
temp_v1_2 = (this->actor.params >> 8) & 3;
|
||||
if (temp_v1_2 == 1) {
|
||||
if (this->nextWaypoint == 0 || this->nextWaypoint == this->endWaypoint) {
|
||||
func_80A4D0FC(this, globalCtx);
|
||||
}
|
||||
} else if (moveFuncs[(this->actor.params >> 10) & 1](this, globalCtx)) {
|
||||
loopMode = (this->actor.params >> 8) & 3;
|
||||
if (loopMode == ENGOROIWA_LOOPMODE_ONEWAY_BREAK &&
|
||||
(this->nextWaypoint == 0 || this->nextWaypoint == this->endWaypoint)) {
|
||||
EnGoroiwa_SpawnFragments(this, globalCtx);
|
||||
}
|
||||
func_80A4D074(this, globalCtx);
|
||||
if ((temp_v1_2 == 3) && (this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint)) {
|
||||
func_80A4D9DC(this);
|
||||
EnGoroiwa_NextWaypoint(this, globalCtx);
|
||||
if ((loopMode == ENGOROIWA_LOOPMODE_ROUNDTRIP) &&
|
||||
(this->currentWaypoint == 0 || this->currentWaypoint == this->endWaypoint)) {
|
||||
EnGoroiwa_SetupWait(this);
|
||||
} else if (!((this->actor.params >> 10) & 1) && this->currentWaypoint != 0 &&
|
||||
this->currentWaypoint != this->endWaypoint) {
|
||||
temp_v0_5 = func_80A4C27C(this, globalCtx);
|
||||
if (temp_v0_5 > 0) {
|
||||
func_80A4DA7C(this);
|
||||
} else if (temp_v0_5 < 0) {
|
||||
func_80A4DB90(this);
|
||||
ascendDirection = EnGoroiwa_GetAscendDirection(this, globalCtx);
|
||||
if (ascendDirection > 0) {
|
||||
EnGoroiwa_SetupMoveUp(this);
|
||||
} else if (ascendDirection < 0) {
|
||||
EnGoroiwa_SetupMoveDown(this);
|
||||
} else {
|
||||
func_80A4D5E0(this);
|
||||
EnGoroiwa_SetupRoll(this);
|
||||
}
|
||||
} else {
|
||||
func_80A4D5E0(this);
|
||||
EnGoroiwa_SetupRoll(this);
|
||||
}
|
||||
}
|
||||
Audio_PlayActorSound2(&this->actor, NA_SE_EV_BIGBALL_ROLL - SFX_FLAG);
|
||||
}
|
||||
|
||||
void func_80A4D8CC(EnGoroiwa* this) {
|
||||
this->actionFunc = func_80A4D944;
|
||||
func_80A4BD70(this, 2);
|
||||
void EnGoroiwa_SetupMoveAndFallToGround(EnGoroiwa* this) {
|
||||
this->actionFunc = EnGoroiwa_MoveAndFallToGround;
|
||||
EnGoroiwa_UpdateFlags(this, ENGOROIWA_ENABLE_OC);
|
||||
this->actor.gravity = -0.86f;
|
||||
this->actor.minVelocityY = -15.0f;
|
||||
this->actor.speedXZ *= 0.15f;
|
||||
this->actor.velocity.y = 5.0f;
|
||||
this->unk_1C0 = 1.0f;
|
||||
this->rollRotSpeed = 1.0f;
|
||||
}
|
||||
|
||||
void func_80A4D944(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
func_80A4C6C8(this, globalCtx);
|
||||
if (this->actor.bgCheckFlags & 1 && this->actor.velocity.y < 0.0f) {
|
||||
if (this->unk_1D3 & 4 && (this->actor.home.rot.z & 1) == 1) {
|
||||
func_80A4C164(this);
|
||||
func_80A4BE54(this, globalCtx);
|
||||
void EnGoroiwa_MoveAndFallToGround(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
EnGoroiwa_MoveAndFall(this, globalCtx);
|
||||
if ((this->actor.bgCheckFlags & 1) && this->actor.velocity.y < 0.0f) {
|
||||
if ((this->stateFlags & ENGOROIWA_PLAYER_IN_THE_WAY) && (this->actor.home.rot.z & 1) == 1) {
|
||||
EnGoroiwa_ReverseDirection(this);
|
||||
EnGoroiwa_FaceNextWaypoint(this, globalCtx);
|
||||
}
|
||||
func_80A4D9DC(this);
|
||||
EnGoroiwa_SetupWait(this);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A4D9DC(EnGoroiwa* this) {
|
||||
void EnGoroiwa_SetupWait(EnGoroiwa* this) {
|
||||
static s16 waitDurations[] = { 20, 6 };
|
||||
|
||||
this->actionFunc = func_80A4DA3C;
|
||||
this->actionFunc = EnGoroiwa_Wait;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
func_80A4BD70(this, 2);
|
||||
EnGoroiwa_UpdateFlags(this, ENGOROIWA_ENABLE_OC);
|
||||
this->waitTimer = waitDurations[this->actor.home.rot.z & 1];
|
||||
this->unk_1C0 = 0.0f;
|
||||
this->rollRotSpeed = 0.0f;
|
||||
}
|
||||
|
||||
void func_80A4DA3C(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void EnGoroiwa_Wait(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
if (this->waitTimer > 0) {
|
||||
this->waitTimer--;
|
||||
} else {
|
||||
this->collider.base.atFlags &= ~AT_HIT;
|
||||
func_80A4D5E0(this);
|
||||
EnGoroiwa_SetupRoll(this);
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A4DA7C(EnGoroiwa* this) {
|
||||
this->actionFunc = func_80A4DAD0;
|
||||
func_80A4BD70(this, 3);
|
||||
this->unk_1C0 = 0.0f;
|
||||
void EnGoroiwa_SetupMoveUp(EnGoroiwa* this) {
|
||||
this->actionFunc = EnGoroiwa_MoveUp;
|
||||
EnGoroiwa_UpdateFlags(this, ENGOROIWA_ENABLE_AT | ENGOROIWA_ENABLE_OC);
|
||||
this->rollRotSpeed = 0.0f;
|
||||
this->actor.velocity.y = fabsf(this->actor.speedXZ) * 0.1f;
|
||||
}
|
||||
|
||||
void func_80A4DAD0(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void EnGoroiwa_MoveUp(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
if (this->collider.base.atFlags & AT_HIT) {
|
||||
this->collider.base.atFlags &= ~AT_HIT;
|
||||
func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4);
|
||||
func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT);
|
||||
if ((this->actor.home.rot.z & 1) == 1) {
|
||||
this->collisionTimer = 50;
|
||||
this->collisionDisabledTimer = 50;
|
||||
}
|
||||
} else if (func_80A4CA50(this, globalCtx)) {
|
||||
func_80A4D074(this, globalCtx);
|
||||
func_80A4D5E0(this);
|
||||
} else if (EnGoroiwa_MoveUpToNextWaypoint(this, globalCtx)) {
|
||||
EnGoroiwa_NextWaypoint(this, globalCtx);
|
||||
EnGoroiwa_SetupRoll(this);
|
||||
this->actor.speedXZ = 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
void func_80A4DB90(EnGoroiwa* this) {
|
||||
this->actionFunc = func_80A4DC00;
|
||||
func_80A4BD70(this, 3);
|
||||
this->unk_1C0 = 0.3f;
|
||||
this->unk_1C6 = 0;
|
||||
void EnGoroiwa_SetupMoveDown(EnGoroiwa* this) {
|
||||
this->actionFunc = EnGoroiwa_MoveDown;
|
||||
EnGoroiwa_UpdateFlags(this, ENGOROIWA_ENABLE_AT | ENGOROIWA_ENABLE_OC);
|
||||
this->rollRotSpeed = 0.3f;
|
||||
this->bounceCount = 0;
|
||||
this->actor.velocity.y = fabsf(this->actor.speedXZ) * -0.3f;
|
||||
this->unk_1D3 |= 8;
|
||||
this->unk_1D3 &= ~0x10;
|
||||
this->stateFlags |= ENGOROIWA_RETAIN_ROT_SPEED;
|
||||
this->stateFlags &= ~ENGOROIWA_IN_WATER;
|
||||
}
|
||||
|
||||
void func_80A4DC00(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx) {
|
||||
if (this->collider.base.atFlags & AT_HIT) {
|
||||
this->collider.base.atFlags &= ~AT_HIT;
|
||||
func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4);
|
||||
func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT);
|
||||
if ((this->actor.home.rot.z & 1) == 1) {
|
||||
this->collisionTimer = 50;
|
||||
this->collisionDisabledTimer = 50;
|
||||
}
|
||||
} else if (func_80A4CB78(this, globalCtx)) {
|
||||
func_80A4D074(this, globalCtx);
|
||||
func_80A4D5E0(this);
|
||||
this->unk_1D3 &= ~8;
|
||||
} else if (EnGoroiwa_MoveDownToNextWaypoint(this, globalCtx)) {
|
||||
EnGoroiwa_NextWaypoint(this, globalCtx);
|
||||
EnGoroiwa_SetupRoll(this);
|
||||
this->stateFlags &= ~ENGOROIWA_RETAIN_ROT_SPEED;
|
||||
this->actor.speedXZ = 0.0f;
|
||||
}
|
||||
}
|
||||
|
@ -715,8 +727,8 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
UNK_TYPE sp30;
|
||||
|
||||
if (!(player->stateFlags1 & 0x300000C0)) {
|
||||
if (this->collisionTimer > 0) {
|
||||
this->collisionTimer--;
|
||||
if (this->collisionDisabledTimer > 0) {
|
||||
this->collisionDisabledTimer--;
|
||||
}
|
||||
this->actionFunc(this, globalCtx);
|
||||
switch ((this->actor.params >> 10) & 1) {
|
||||
|
@ -728,13 +740,13 @@ void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) {
|
|||
&this->actor, &this->actor.world.pos);
|
||||
break;
|
||||
}
|
||||
func_80A4CED8(this, globalCtx);
|
||||
EnGoroiwa_UpdateRotation(this, globalCtx);
|
||||
if (this->actor.xzDistToPlayer < 300.0f) {
|
||||
func_80A4BCA0(this);
|
||||
if (this->unk_1D3 & 1 && this->collisionTimer <= 0) {
|
||||
EnGoroiwa_UpdateCollider(this);
|
||||
if ((this->stateFlags & ENGOROIWA_ENABLE_AT) && this->collisionDisabledTimer <= 0) {
|
||||
CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
if (this->unk_1D3 & 2 && this->collisionTimer <= 0) {
|
||||
if ((this->stateFlags & ENGOROIWA_ENABLE_OC) && this->collisionDisabledTimer <= 0) {
|
||||
CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,18 +13,18 @@ typedef struct EnGoroiwa {
|
|||
/* 0x014C */ EnGoroiwaActionFunc actionFunc;
|
||||
/* 0x0150 */ ColliderJntSph collider;
|
||||
/* 0x0170 */ ColliderJntSphElement colliderItems[1];
|
||||
/* 0x01B0 */ Vec3f unk_1B0;
|
||||
/* 0x01BC */ f32 unk_1BC;
|
||||
/* 0x01C0 */ f32 unk_1C0;
|
||||
/* 0x01B0 */ Vec3f prevUnitRollAxis;
|
||||
/* 0x01BC */ f32 prevRollAngleDiff;
|
||||
/* 0x01C0 */ f32 rollRotSpeed;
|
||||
/* 0x01C4 */ s16 waitTimer;
|
||||
/* 0x01C6 */ s16 unk_1C6;
|
||||
/* 0x01C8 */ s16 collisionTimer;
|
||||
/* 0x01C6 */ s16 bounceCount;
|
||||
/* 0x01C8 */ s16 collisionDisabledTimer;
|
||||
/* 0x01CA */ s16 endWaypoint;
|
||||
/* 0x01CC */ s16 currentWaypoint;
|
||||
/* 0x01CE */ s16 nextWaypoint;
|
||||
/* 0x01D0 */ s16 pathDirection;
|
||||
/* 0x01D2 */ u8 isInKokiri;
|
||||
/* 0x01D3 */ u8 unk_1D3;
|
||||
/* 0x01D3 */ u8 stateFlags;
|
||||
} EnGoroiwa; // size = 0x01D4
|
||||
|
||||
extern const ActorInit En_Goroiwa_InitVars;
|
||||
|
|
|
@ -424,7 +424,7 @@ void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) {
|
|||
Player* player = PLAYER;
|
||||
Vec3s shieldRot;
|
||||
|
||||
func_800D20CC(&player->shieldMf, &shieldRot, false);
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &shieldRot, false);
|
||||
this->actor.world.rot.y = ((shieldRot.y * 2) - this->actor.world.rot.y) + 0x8000;
|
||||
EnHonotrap_SetupFlameVanish(this);
|
||||
} else if (this->collider.cyl.base.atFlags & AT_HIT) {
|
||||
|
|
|
@ -116,7 +116,7 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) {
|
|||
this->collider.base.atFlags |= AT_TYPE_PLAYER;
|
||||
|
||||
this->collider.info.toucher.dmgFlags = 2;
|
||||
func_800D20CC(&player->shieldMf, &sp4C, 0);
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &sp4C, 0);
|
||||
this->actor.world.rot.y = sp4C.y + 0x8000;
|
||||
this->timer = 30;
|
||||
return;
|
||||
|
|
|
@ -493,7 +493,7 @@ void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) {
|
|||
this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED | AT_TYPE_ENEMY);
|
||||
this->collider.base.atFlags |= AT_TYPE_PLAYER;
|
||||
this->collider.info.toucher.dmgFlags = 2;
|
||||
func_800D20CC(&player->shieldMf, &sp40, 0);
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &sp40, 0);
|
||||
this->actor.world.rot.y = sp40.y + 0x8000;
|
||||
this->timer = 30;
|
||||
} else {
|
||||
|
|
|
@ -307,7 +307,7 @@ void func_80AF95C4(EnSda* this, u8* shadowTexture, Player* player, GlobalContext
|
|||
}
|
||||
osSyncPrintf("SDA CONT 3\n");
|
||||
if (this->actor.params != 1) {
|
||||
func_800D20CC(&player->shieldMf, &sp178, false);
|
||||
Matrix_MtxFToYXZRotS(&player->shieldMf, &sp178, false);
|
||||
sp178.y += (KREG(87) << 0xF) + 0x8000;
|
||||
sp178.x *= (KREG(88) - 1);
|
||||
Matrix_Mult(&player->shieldMf, MTXMODE_NEW);
|
||||
|
|
|
@ -89,7 +89,7 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) {
|
|||
sp44.z = COLPOLY_GET_NORMAL(poly->normal.z);
|
||||
sp34 = Math_FAcosF(DOTXYZ(sp44, this->unk_364));
|
||||
EnSw_CrossProduct(&this->unk_364, &sp44, &sp38);
|
||||
func_800D23FC(sp34, &sp38, MTXMODE_NEW);
|
||||
Matrix_RotateAxis(sp34, &sp38, MTXMODE_NEW);
|
||||
Matrix_MultVec3f(&this->unk_370, &sp38);
|
||||
this->unk_370 = sp38;
|
||||
EnSw_CrossProduct(&this->unk_370, &sp44, &this->unk_37C);
|
||||
|
@ -117,7 +117,7 @@ s32 func_80B0BE20(EnSw* this, CollisionPoly* poly) {
|
|||
this->unk_3D8.wy = 0.0f;
|
||||
this->unk_3D8.wz = 0.0f;
|
||||
this->unk_3D8.ww = 1.0f;
|
||||
func_800D20CC(&this->unk_3D8, &this->actor.world.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&this->unk_3D8, &this->actor.world.rot, 0);
|
||||
//! @bug: Does not return.
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ s32 func_80B0CCF4(EnSw* this, f32* arg1) {
|
|||
sp6C.x = COLPOLY_GET_NORMAL(temp_v1->normal.x);
|
||||
sp6C.y = COLPOLY_GET_NORMAL(temp_v1->normal.y);
|
||||
sp6C.z = COLPOLY_GET_NORMAL(temp_v1->normal.z);
|
||||
func_800D23FC(*arg1, &sp6C, MTXMODE_NEW);
|
||||
Matrix_RotateAxis(*arg1, &sp6C, MTXMODE_NEW);
|
||||
Matrix_MultVec3f(&this->unk_370, &sp6C);
|
||||
this->unk_370 = sp6C;
|
||||
EnSw_CrossProduct(&this->unk_370, &this->unk_364, &this->unk_37C);
|
||||
|
@ -432,7 +432,7 @@ s32 func_80B0CCF4(EnSw* this, f32* arg1) {
|
|||
sp2C.wy = 0.0f;
|
||||
sp2C.wz = 0.0f;
|
||||
sp2C.ww = 1.0f;
|
||||
func_800D20CC(&sp2C, &this->actor.world.rot, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp2C, &this->actor.world.rot, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -454,7 +454,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Push();
|
||||
Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp34);
|
||||
func_800D20CC(&sp34, &sp2C, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B4EE38(this, sp2C.y, 0);
|
||||
func_80B4F230(this, sp2C.x, 1);
|
||||
|
@ -464,7 +464,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-188.0f, -184.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp74[0], "../z_en_zl2.c", 1056);
|
||||
Matrix_Get(&sp34);
|
||||
func_800D20CC(&sp34, &sp2C, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B4EE38(this, sp2C.y, 3);
|
||||
func_80B4F230(this, sp2C.x, 4);
|
||||
|
@ -473,7 +473,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-410.0f, -184.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp74[1], "../z_en_zl2.c", 1100);
|
||||
Matrix_Get(&sp34);
|
||||
func_800D20CC(&sp34, &sp2C, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B4EE38(this, sp2C.y, 6);
|
||||
func_80B4F230(this, sp2C.x, 7);
|
||||
|
@ -485,7 +485,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Push();
|
||||
Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp34);
|
||||
func_800D20CC(&sp34, &sp2C, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B4EE38(this, sp2C.y, 9);
|
||||
func_80B4F230(this, sp2C.x, 10);
|
||||
|
@ -495,7 +495,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-427.0f, -1.0f, -3.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp74[3], "../z_en_zl2.c", 1145);
|
||||
Matrix_Get(&sp34);
|
||||
func_800D20CC(&sp34, &sp2C, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B4EE38(this, sp2C.y, 12);
|
||||
func_80B4F230(this, sp2C.x, 13);
|
||||
|
@ -508,7 +508,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Push();
|
||||
Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp34);
|
||||
func_800D20CC(&sp34, &sp2C, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B4EE38(this, sp2C.y, 15);
|
||||
func_80B4F230(this, sp2C.x, 16);
|
||||
|
@ -518,7 +518,7 @@ s32 func_80B4F45C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-427.0f, -1.0f, 3.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp74[5], "../z_en_zl2.c", 1189);
|
||||
Matrix_Get(&sp34);
|
||||
func_800D20CC(&sp34, &sp2C, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp34, &sp2C, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B4EE38(this, sp2C.y, 18);
|
||||
func_80B4F230(this, sp2C.x, 19);
|
||||
|
|
|
@ -620,7 +620,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Push();
|
||||
Matrix_Translate(362.0f, -133.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp38);
|
||||
func_800D20CC(&sp38, &sp30, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp38, &sp30, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B53980(this, sp30.y, 0);
|
||||
func_80B54360(this, sp30.x, 1);
|
||||
|
@ -630,7 +630,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-188.0f, -184.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp78[0], "../z_en_zl3.c", 1490);
|
||||
Matrix_Get(&sp38);
|
||||
func_800D20CC(&sp38, &sp30, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp38, &sp30, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B53980(this, sp30.y, 3);
|
||||
}
|
||||
|
@ -638,7 +638,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-410.0f, -184.0f, 0.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp78[1], "../z_en_zl3.c", 1534);
|
||||
Matrix_Get(&sp38);
|
||||
func_800D20CC(&sp38, &sp30, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp38, &sp30, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B54360(this, sp30.x, 7);
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Push();
|
||||
Matrix_Translate(467.0f, 265.0f, 389.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp38);
|
||||
func_800D20CC(&sp38, &sp30, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp38, &sp30, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B53980(this, sp30.y, 9);
|
||||
func_80B54360(this, sp30.x, 10);
|
||||
|
@ -659,7 +659,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-427.0f, -1.0f, -3.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp78[3], "../z_en_zl3.c", 1579);
|
||||
Matrix_Get(&sp38);
|
||||
func_800D20CC(&sp38, &sp30, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp38, &sp30, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B53980(this, sp30.y, 12);
|
||||
func_80B54360(this, sp30.x, 13);
|
||||
|
@ -672,7 +672,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Push();
|
||||
Matrix_Translate(467.0f, 265.0f, -389.0f, MTXMODE_APPLY);
|
||||
Matrix_Get(&sp38);
|
||||
func_800D20CC(&sp38, &sp30, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp38, &sp30, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B53980(this, sp30.y, 15);
|
||||
func_80B54360(this, sp30.x, 16);
|
||||
|
@ -682,7 +682,7 @@ s32 func_80B5458C(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Vec3f* p
|
|||
Matrix_Translate(-427.0f, -1.0f, 3.0f, MTXMODE_APPLY);
|
||||
Matrix_ToMtx(&sp78[5], "../z_en_zl3.c", 1623);
|
||||
Matrix_Get(&sp38);
|
||||
func_800D20CC(&sp38, &sp30, 0);
|
||||
Matrix_MtxFToYXZRotS(&sp38, &sp30, 0);
|
||||
if (!FrameAdvance_IsEnabled(globalCtx)) {
|
||||
func_80B53980(this, sp30.y, 18);
|
||||
func_80B54360(this, sp30.x, 19);
|
||||
|
|
|
@ -1638,7 +1638,7 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u
|
|||
|
||||
Matrix_MultVec3f(&sZeroVec, &effect->pos);
|
||||
Matrix_Get(&mf);
|
||||
func_800D20CC(&mf, &sEffOwnerHatRot, 0);
|
||||
Matrix_MtxFToYXZRotS(&mf, &sEffOwnerHatRot, 0);
|
||||
|
||||
D_80B7A690 = 0;
|
||||
D_80B7A68C = 0;
|
||||
|
|
|
@ -87,7 +87,7 @@ void EffectSsDeadDs_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) {
|
|||
}
|
||||
}
|
||||
|
||||
func_800D2264(&mf, &rpy, 0);
|
||||
Matrix_MtxFToZYXRotS(&mf, &rpy, 0);
|
||||
this->rRoll = rpy.x;
|
||||
this->rPitch = rpy.y;
|
||||
this->rYaw = rpy.z;
|
||||
|
|
|
@ -99,6 +99,10 @@ wordReplace = {
|
|||
"func_80032C7C": "Enemy_StartFinishingBlow",
|
||||
"actorCtx.unk_00": "actorCtx.freezeFlashTimer",
|
||||
"func_800339B8": "Actor_TestFloorInDirection",
|
||||
"Matrix_Reverse": "Matrix_Transpose",
|
||||
"func_800D20CC": "Matrix_MtxFToYXZRotS",
|
||||
"func_800D2264": "Matrix_MtxFToZYXRotS",
|
||||
"func_800D23FC": "Matrix_RotateAxis",
|
||||
}
|
||||
|
||||
# [a-zA-Z0-9_]
|
||||
|
|
Loading…
Add table
Reference in a new issue