diff options
| author | Caroline Madsen <69010899+randomsalience@users.noreply.github.com> | 2024-04-17 10:47:22 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-17 17:47:22 +0300 |
| commit | d253deb2b95e96323d9b8fddd3e4aa629203ebd4 (patch) | |
| tree | d43c2777a249a14c0b1212d83f8f3f916dfe359f /rel | |
| parent | ddb1f42c699bbe9792066e8936b5f534d240a6ef (diff) | |
d_a_do done but nonmatching, d_a_obj_food OK (#2135)
Diffstat (limited to 'rel')
| -rw-r--r-- | rel/d/a/d_a_do/d_a_do.cpp | 538 | ||||
| -rw-r--r-- | rel/d/a/d_a_do/d_a_do_NONMATCHING.cpp | 2827 | ||||
| -rw-r--r-- | rel/d/a/obj/d_a_obj_food/d_a_obj_food.cpp | 1247 |
3 files changed, 3589 insertions, 1023 deletions
diff --git a/rel/d/a/d_a_do/d_a_do.cpp b/rel/d/a/d_a_do/d_a_do.cpp index dfd2f4c990..4d5bb07a61 100644 --- a/rel/d/a/d_a_do/d_a_do.cpp +++ b/rel/d/a/d_a_do/d_a_do.cpp @@ -3,9 +3,12 @@ // Translation Unit: d_a_do // +// See d_a_do_NONMATCHING.cpp + #include "rel/d/a/d_a_do/d_a_do.h" #include "SSystem/SComponent/c_math.h" #include "d/com/d_com_inf_game.h" +#include "d/a/d_a_player.h" #include "dol2asm.h" #include "f_op/f_op_actor_mng.h" @@ -393,8 +396,8 @@ daDo_HIO_c::daDo_HIO_c() { mWalkSpeed = FLOAT_LABEL(lit_3663); mRunSpeed = FLOAT_LABEL(lit_3664); mSwimSpeed = FLOAT_LABEL(lit_3665); - mPlayerRecogniztionDist = FLOAT_LABEL(lit_3666); - field_0x1c = 0; + mPlayerRecognitionDist = FLOAT_LABEL(lit_3666); + mWaitType = 0; mSwimming = 1; mWaterHuntAnimType = 0; } @@ -445,15 +448,15 @@ static int nodeCallBack(J3DJoint* i_jntP, int param_1) { MTXCopy(model->getAnmMtx(joint_num), *calc_mtx); if (joint_num == 9 || joint_num == 10) { - cMtx_YrotM(*calc_mtx, user_area->field_0x60e.y + user_area->field_0x626.y); - cMtx_XrotM(*calc_mtx, user_area->field_0x60e.z + user_area->field_0x626.z); - cMtx_ZrotM(*calc_mtx, user_area->field_0x60e.x); + cMtx_YrotM(*calc_mtx, user_area->mHeadAngle.y + user_area->mHeadBob.y); + cMtx_XrotM(*calc_mtx, user_area->mHeadAngle.z + user_area->mHeadBob.z); + cMtx_ZrotM(*calc_mtx, user_area->mHeadAngle.x); } else if (joint_num == 22) { - cMtx_YrotM(*calc_mtx, user_area->field_0x63e.y << 1); - cMtx_ZrotM(*calc_mtx, user_area->field_0x63e.x << 1); + cMtx_YrotM(*calc_mtx, user_area->mTailAngle.y << 1); + cMtx_ZrotM(*calc_mtx, user_area->mTailAngle.x << 1); } else { - cMtx_YrotM(*calc_mtx, user_area->field_0x63e.y); - cMtx_ZrotM(*calc_mtx, user_area->field_0x63e.x); + cMtx_YrotM(*calc_mtx, user_area->mTailAngle.y); + cMtx_ZrotM(*calc_mtx, user_area->mTailAngle.x); } model->setAnmMtx(joint_num, *calc_mtx); @@ -749,7 +752,7 @@ static u32 search_food(do_class* i_this) { i++; pos_check += 100.0f; - } while (pos_check <= i_this->field_0x674.z * 240.0f); + } while (pos_check <= i_this->mScale.z * 240.0f); } else { ret = -1; } @@ -773,7 +776,7 @@ static void food_check(do_class* i_this) { if (fopAcM_SearchByID(i_this->mFoodActorID)) { i_this->mAction = ACT_FOOD; - i_this->mStayStatus = 0; + i_this->mMode = 0; } } @@ -781,7 +784,7 @@ static void food_check(do_class* i_this) { static int do_carry_check(do_class* i_this) { if (i_this->mAction != ACT_CARRY && fopAcM_checkCarryNow(i_this)) { i_this->mAction = ACT_CARRY; - i_this->mStayStatus = 0; + i_this->mMode = 0; return 1; } @@ -819,7 +822,7 @@ static BOOL depth_check(do_class* i_this, cXyz i_pos, f32 param_2) { sub_res = f_gnd_chk_spl - f_gnd_chk; mul_res = FLOAT_LABEL(lit_3665) * param_2 * FLOAT_LABEL(lit_3981); - f_res = mul_res * i_this->field_0x674.z; + f_res = mul_res * i_this->mScale.z; if (sub_res > f_res) { return 1; @@ -846,9 +849,9 @@ static bool water_check(do_class* i_this) { dBgS_ObjGndChk_Spl gnd_chk_spl; gnd_chk_spl.SetPos(&pos); - i_this->field_0x65c = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); - f32 sub_res = i_this->field_0x65c - f_gnd_chk; - f32 mul_res = FLOAT_LABEL(lit_3994) * i_this->field_0x674.z; + i_this->mWaterY = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + f32 sub_res = i_this->mWaterY - f_gnd_chk; + f32 mul_res = FLOAT_LABEL(lit_3994) * i_this->mScale.z; if (sub_res > mul_res) { return 1; @@ -955,7 +958,7 @@ static bool dansa_check2(do_class* i_this, f32 param_1) { mDoMtx_YrotS((MtxP)calc_mtx, i_this->current.angle.y); pos.x = FLOAT_LABEL(lit_3682); pos.y = FLOAT_LABEL(lit_4057); - f32 tmp = i_this->field_0x674.z; + f32 tmp = i_this->mScale.z; pos.z = tmp * (FLOAT_LABEL(lit_3981) * param_1) + tmp * (FLOAT_LABEL(lit_3981) * i_this->speedF) * FLOAT_LABEL(lit_4058); @@ -989,9 +992,9 @@ static int move_dansa_check(do_class* i_this, f32 i_speed) { i_this->mAction = ACT_WAIT_1; if (i_speed > FLOAT_LABEL(lit_4069)) { - i_this->mStayStatus = 10; + i_this->mMode = 10; } else { - i_this->mStayStatus = 0; + i_this->mMode = 0; } return 1; @@ -1047,8 +1050,8 @@ static void area_check(do_class* i_this) { if ((i_this->field_0x5b6 * FLOAT_LABEL(lit_3772) * FLOAT_LABEL(lit_3665)) > pos_delta.abs()) { i_this->mAction = ACT_WALK; - i_this->mStayStatus = -1; - i_this->field_0x5fc[2] = cM_rndF(FLOAT_LABEL(lit_3772)) + + i_this->mMode = -1; + i_this->mTimer[2] = cM_rndF(FLOAT_LABEL(lit_3772)) + FLOAT_LABEL(lit_3772); // random value between 100 and 200 } } @@ -1139,22 +1142,22 @@ COMPILER_STRIP_GATE(0x8066EE84, &lit_4339); #ifdef NONMATCHING // regalloc and float literals static void do_stay(do_class* i_this) { - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 0: { if (i_this->field_0x5b4 == 0) { anm_init(i_this, ANM_DOWN_WT, FLOAT_LABEL(lit_4069), 2, FLOAT_LABEL(lit_3662)); - i_this->mStayStatus++; - i_this->field_0x5fc[0] = 10; + i_this->mMode++; + i_this->mTimer[0] = 10; } else { i_this->mAction = ACT_WALK; - i_this->mStayStatus = 0; + i_this->mMode = 0; return; } } case 1: { - if (i_this->field_0x5fc[0] == 0 && i_this->mDistFromPlayer < l_HIO.mRunSpeed) { - i_this->mStayStatus++; - i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_3816)) + + if (i_this->mTimer[0] == 0 && i_this->mDistFromPlayer < l_HIO.mRunSpeed) { + i_this->mMode++; + i_this->mTimer[0] = cM_rndF(FLOAT_LABEL(lit_3816)) + FLOAT_LABEL(lit_4189); // random number between 20 and 70 } break; @@ -1162,66 +1165,66 @@ static void do_stay(do_class* i_this) { case 2: { i_this->field_0x616 = 1; i_this->field_0x614 = 0xe764; - i_this->field_0x648 = FLOAT_LABEL(lit_4190); - if (i_this->field_0x5fc[0] == 0) { + i_this->mTailWagTarget = FLOAT_LABEL(lit_4190); + if (i_this->mTimer[0] == 0) { anm_init(i_this, ANM_DOWN, FLOAT_LABEL(lit_4027), 0, FLOAT_LABEL(lit_3662)); - i_this->mStayStatus++; + i_this->mMode++; } break; } case 3: { i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4191); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4191); if (i_this->mpMorf->isStop()) { i_this->mAction = ACT_WALK_RUN; - i_this->mStayStatus = 0; + i_this->mMode = 0; } break; } case 10: { anm_init(i_this, ANM_DOWN_WT, FLOAT_LABEL(lit_4069), 2, FLOAT_LABEL(lit_3662)); - i_this->mStayStatus++; + i_this->mMode++; } case 11: { i_this->field_0x616 = 1; i_this->field_0x614 = 0xe764; - i_this->field_0x648 = FLOAT_LABEL(lit_4190); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4190); if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { - i_this->mStayStatus++; - i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + + i_this->mMode++; + i_this->mTimer[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); // random number between 10 and 20 } - if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3772) + l_HIO.mPlayerRecogniztionDist) { + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3772) + l_HIO.mPlayerRecognitionDist) { i_this->field_0x5f4 = 0; - i_this->mStayStatus = 0; + i_this->mMode = 0; } break; } case 12: { i_this->field_0x616 = 1; i_this->field_0x614 = 0xe764; - i_this->field_0x648 = FLOAT_LABEL(lit_4193); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4193); if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_3846)) { - if (i_this->field_0x5fc[0] == 0) { + if (i_this->mTimer[0] == 0) { anm_init(i_this, ANM_DOWN, FLOAT_LABEL(lit_4194), 0, FLOAT_LABEL(lit_3662)); - i_this->mStayStatus = 13; + i_this->mMode = 13; } } else { - i_this->mStayStatus = 11; + i_this->mMode = 11; } break; } case 13: { i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4193); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4193); if (i_this->mpMorf->isStop()) { i_this->mAction = ACT_WAIT_1; - i_this->mStayStatus = 0; + i_this->mMode = 0; } } } @@ -1289,16 +1292,16 @@ COMPILER_STRIP_GATE(0x8066EE9C, &lit_4345); // float literals + regalloc static void do_walk(do_class* i_this) { cXyz local_5c; - i_this->field_0x648 = 1000.0; + i_this->mTailWagTarget = 1000.0; - switch (i_this->mStayStatus + 1) { + switch (i_this->mMode + 1) { case 12: { - i_this->field_0x5b8 = i_this->home.pos; - i_this->speedF >= l_HIO.mRunSpeed ? i_this->field_0x5e8 = 1.7 : i_this->field_0x5e8 = 4.0; + i_this->mTargetPos = i_this->home.pos; + i_this->speedF >= l_HIO.mRunSpeed ? i_this->mAnmSpeed = 1.7 : i_this->mAnmSpeed = 4.0; - i_this->field_0x5ec = 1.7; - anm_init(i_this, ANM_WALK, 0.0, 2, i_this->field_0x5e8); - i_this->mStayStatus = 3; + i_this->mTargetAnmSpeed = 1.7; + anm_init(i_this, ANM_WALK, 0.0, 2, i_this->mAnmSpeed); + i_this->mMode = 3; break; } case 0: { @@ -1308,13 +1311,13 @@ static void do_walk(do_class* i_this) { anm_init(i_this, ANM_DOWN, 0.0, 0, 1.0); } - i_this->mStayStatus++; + i_this->mMode++; break; } case 1: { if (i_this->mpMorf->isStop()) { - i_this->mStayStatus++; + i_this->mMode++; ; } break; @@ -1328,12 +1331,12 @@ static void do_walk(do_class* i_this) { mDoMtx_YrotS((MtxP)calc_mtx, cM_rndF(65536.0)); local_5c.z = cM_rndF(100.0f * i_this->field_0x5b6); - MtxPosition(&local_5c, &i_this->field_0x5b8); + MtxPosition(&local_5c, &i_this->mTargetPos); - i_this->field_0x5b8 += i_this->home.pos; + i_this->mTargetPos += i_this->home.pos; - if (dansa_check(i_this, i_this->field_0x5b8, 0.0) == 0) { - local_5c = i_this->field_0x5b8 - i_this->current.pos; + if (dansa_check(i_this, i_this->mTargetPos, 0.0) == 0) { + local_5c = i_this->mTargetPos - i_this->current.pos; if (local_5c.abs() > 300.0f) break; @@ -1341,31 +1344,31 @@ static void do_walk(do_class* i_this) { } f32 rnd_number = cM_rndF(0.6); - i_this->field_0x5ec = rnd_number + 1.3; - i_this->field_0x5e8 = rnd_number + 1.3; + i_this->mTargetAnmSpeed = rnd_number + 1.3; + i_this->mAnmSpeed = rnd_number + 1.3; - anm_init(i_this, ANM_WALK, 0.0, 2, i_this->field_0x5e8); + anm_init(i_this, ANM_WALK, 0.0, 2, i_this->mAnmSpeed); - i_this->mStayStatus++; + i_this->mMode++; } case 3: { - local_5c = i_this->field_0x5b8 - i_this->current.pos; + local_5c = i_this->mTargetPos - i_this->current.pos; cLib_addCalcAngleS2(&i_this->current.angle.y, (s16)cM_atan2s(local_5c.x, local_5c.z), 0x10, 0x100); - cLib_addCalc2(&i_this->speedF, i_this->field_0x5e8 * l_HIO.mWalkSpeed, 1.0, + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, 1.0, l_HIO.mWalkSpeed * 0.2); if (local_5c.abs() < 150.0) { if (i_this->field_0x5b4 == 0) { i_this->mAction = ACT_STAY; - i_this->mStayStatus = 0; + i_this->mMode = 0; } else { anm_init(i_this, ANM_WAIT, 0.0, 2, 1.0); - i_this->field_0x5fc[0] = cM_rndF(50.0) + 20.0; - i_this->field_0x5ec = 1.0; - i_this->mStayStatus++; + i_this->mTimer[0] = cM_rndF(50.0) + 20.0; + i_this->mTargetAnmSpeed = 1.0; + i_this->mMode++; } } @@ -1375,8 +1378,8 @@ static void do_walk(do_class* i_this) { case 4: { cLib_addCalc0(&i_this->speedF, 1.0, 1.0); - if (i_this->field_0x5fc[0] == 0) { - i_this->mStayStatus = 2; + if (i_this->mTimer[0] == 0) { + i_this->mMode = 2; } break; @@ -1384,22 +1387,22 @@ static void do_walk(do_class* i_this) { case 10: { cLib_addCalc0(&i_this->speedF, 1.0, 1.0); - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mAngleYFromPlayer, 4, 0x400); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 4, 0x400); i_this->field_0x616 = 1; - i_this->field_0x648 = 2000.0; + i_this->mTailWagTarget = 2000.0; - s16 angle_diff = i_this->current.angle.y - i_this->mAngleYFromPlayer; + s16 angle_diff = i_this->current.angle.y - i_this->mTargetAngleY; if (angle_diff < 0) { angle_diff *= -1; } if (angle_diff < 0x800) { - i_this->mStayStatus++; + i_this->mMode++; anm_init(i_this, ANM_WAIT, 0.0, 2, 1.0); - i_this->field_0x5ec = 1.0; - i_this->field_0x5fc[0] = cM_rndF(10.0) + 10.0; + i_this->mTargetAnmSpeed = 1.0; + i_this->mTimer[0] = cM_rndF(10.0) + 10.0; } break; @@ -1407,24 +1410,24 @@ static void do_walk(do_class* i_this) { case 11: { i_this->field_0x616 = 1; - i_this->field_0x648 = 3000.0; - if (i_this->field_0x5fc[0] == 0) { + i_this->mTailWagTarget = 3000.0; + if (i_this->mTimer[0] == 0) { i_this->mAction = ACT_WALK_RUN; - i_this->mStayStatus = 0; + i_this->mMode = 0; return; } break; } } - cLib_addCalc2(&i_this->field_0x5e8, i_this->field_0x5ec, 1.0, 0.05); - i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); + cLib_addCalc2(&i_this->mAnmSpeed, i_this->mTargetAnmSpeed, 1.0, 0.05); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); - if (i_this->field_0x5fc[2] == 0 && i_this->mStayStatus < 10 && - i_this->mDistFromPlayer < l_HIO.mPlayerRecogniztionDist) + if (i_this->mTimer[2] == 0 && i_this->mMode < 10 && + i_this->mDistFromPlayer < l_HIO.mPlayerRecognitionDist) { anm_init(i_this, ANM_STEP_2, 0.0, 2, 1.0); - i_this->mStayStatus = 10; + i_this->mMode = 10; } move_dansa_check(i_this, i_this->speedF); @@ -1458,33 +1461,33 @@ COMPILER_STRIP_GATE(0x8066EEA4, &lit_4378); /* 8066973C-806698D0 001ADC 0194+00 1/1 0/0 0/0 .text do_walk_run__FP8do_class */ static void do_walk_run(do_class* i_this) { i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4344); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4344); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 0: { - i_this->field_0x5e8 = FLOAT_LABEL(lit_4377); - anm_init(i_this, 22, FLOAT_LABEL(lit_4192), 2, i_this->field_0x5e8); - i_this->mStayStatus++; + i_this->mAnmSpeed = FLOAT_LABEL(lit_4377); + anm_init(i_this, 22, FLOAT_LABEL(lit_4192), 2, i_this->mAnmSpeed); + i_this->mMode++; } case 1: { - cLib_addCalc2(&i_this->field_0x5e8, FLOAT_LABEL(lit_3665), FLOAT_LABEL(lit_3662), + cLib_addCalc2(&i_this->mAnmSpeed, FLOAT_LABEL(lit_3665), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4345)); - i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); - if (i_this->field_0x5e8 >= FLOAT_LABEL(lit_3665)) { + if (i_this->mAnmSpeed >= FLOAT_LABEL(lit_3665)) { i_this->mAction = ACT_RUN; - i_this->mStayStatus = 0; + i_this->mMode = 0; i_this->mSound.startSound(Z2SE_DOG_BARK, 0, -1); } } default: { - cLib_addCalc2(&i_this->speedF, i_this->field_0x5e8 * l_HIO.mWalkSpeed, + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mWalkSpeed); - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mAngleYFromPlayer, 8, 0x400); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 8, 0x400); - if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->field_0x674.z) { - l_HIO.field_0x1c != 0 ? i_this->mAction = ACT_WAIT_2 : i_this->mAction = ACT_WAIT_1; - i_this->mStayStatus = 0; + if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->mScale.z) { + l_HIO.mWaitType != 0 ? i_this->mAction = ACT_WAIT_2 : i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; } area_check(i_this); @@ -1546,30 +1549,30 @@ COMPILER_STRIP_GATE(0x8066EEC0, &lit_4406); /* 806698D0-80669A1C 001C70 014C+00 1/1 0/0 0/0 .text do_run__FP8do_class */ static void do_run(do_class* i_this) { i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4400); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4400); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 0: { - i_this->field_0x5e8 = FLOAT_LABEL(lit_3662); - i_this->field_0x5ec = cM_rndF(FLOAT_LABEL(lit_4402)) + FLOAT_LABEL(lit_4401); - anm_init(i_this, 14, FLOAT_LABEL(lit_3665), 2, FLOAT_LABEL(lit_4403) * i_this->field_0x5e8); - i_this->mStayStatus++; + i_this->mAnmSpeed = FLOAT_LABEL(lit_3662); + i_this->mTargetAnmSpeed = cM_rndF(FLOAT_LABEL(lit_4402)) + FLOAT_LABEL(lit_4401); + anm_init(i_this, 14, FLOAT_LABEL(lit_3665), 2, FLOAT_LABEL(lit_4403) * i_this->mAnmSpeed); + i_this->mMode++; } case 1: { - cLib_addCalc2(&i_this->field_0x5e8, i_this->field_0x5ec, FLOAT_LABEL(lit_3662), + cLib_addCalc2(&i_this->mAnmSpeed, i_this->mTargetAnmSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4404)); - i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); - if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4405) * i_this->field_0x674.z) { + if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4405) * i_this->mScale.z) { i_this->mAction = ACT_RUN_WALK; - i_this->mStayStatus = 0; + i_this->mMode = 0; } } default: { cLib_addCalc2(&i_this->speedF, - i_this->field_0x5e8 * l_HIO.mRunSpeed * FLOAT_LABEL(lit_4406), + i_this->mAnmSpeed * l_HIO.mRunSpeed * FLOAT_LABEL(lit_4406), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4342) * l_HIO.mRunSpeed); - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mAngleYFromPlayer, 8, 0x800); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 8, 0x800); area_check(i_this); move_dansa_check(i_this, i_this->speedF); } @@ -1587,31 +1590,31 @@ COMPILER_STRIP_GATE(0x8066EEC4, &lit_4435); /* 80669A1C-80669B80 001DBC 0164+00 1/1 0/0 0/0 .text do_run_walk__FP8do_class */ static void do_run_walk(do_class* i_this) { i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4344); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4344); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 0: { - i_this->field_0x5e8 = FLOAT_LABEL(lit_4336); - anm_init(i_this, 22, FLOAT_LABEL(lit_4194), 2, i_this->field_0x5e8); - i_this->mStayStatus++; + i_this->mAnmSpeed = FLOAT_LABEL(lit_4336); + anm_init(i_this, 22, FLOAT_LABEL(lit_4194), 2, i_this->mAnmSpeed); + i_this->mMode++; } case 1: { - cLib_addCalc2(&i_this->field_0x5e8, FLOAT_LABEL(lit_4401), FLOAT_LABEL(lit_3662), + cLib_addCalc2(&i_this->mAnmSpeed, FLOAT_LABEL(lit_4401), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4345)); - i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); } default: { - cLib_addCalc2(&i_this->speedF, i_this->field_0x5e8 * l_HIO.mWalkSpeed, + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mAngleYFromPlayer, 8, 0x400); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 8, 0x400); - if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->field_0x674.z) { - l_HIO.field_0x1c != 0 ? i_this->mAction = ACT_WAIT_2 : i_this->mAction = ACT_WAIT_1; - i_this->mStayStatus = 0; + if (i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->mScale.z) { + l_HIO.mWaitType != 0 ? i_this->mAction = ACT_WAIT_2 : i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; } else { - if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_4435) * i_this->field_0x674.z) { + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_4435) * i_this->mScale.z) { i_this->mAction = ACT_RUN; - i_this->mStayStatus = 0; + i_this->mMode = 0; } } @@ -1626,9 +1629,9 @@ static void do_run_walk(do_class* i_this) { static void do_wait_1(do_class* i_this) { fopAc_ac_c* player = dComIfGp_getPlayer(0); i_this->field_0x616 = 1; - i_this->field_0x648 = 2000.0; + i_this->mTailWagTarget = 2000.0; - s16 player_angle = i_this->mAngleYFromPlayer; + s16 player_angle = i_this->mTargetAngleY; s16 angle_diff = i_this->current.angle.y - player_angle; if (angle_diff < 0) { @@ -1641,14 +1644,14 @@ static void do_wait_1(do_class* i_this) { some_val = 0x1000; } - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 0: { - if (i_this->mDistFromPlayer <= i_this->field_0x674.z * 320.0) { + if (i_this->mDistFromPlayer <= i_this->mScale.z * 320.0) { anm_init(i_this, ANM_WAIT, 0.0, 2, 0.0); - i_this->mStayStatus++; + i_this->mMode++; } else { anm_init(i_this, ANM_JOYFUL, 0.0, 2, cM_rndFX(0.1) + 0.6); - i_this->mStayStatus = -1; + i_this->mMode = -1; } // goto default; } @@ -1656,55 +1659,55 @@ static void do_wait_1(do_class* i_this) { cLib_addCalcAngleS2(&i_this->current.angle.y, player_angle, 4, 0x400); if (angle_diff < 0x800) { - i_this->mStayStatus = 0; + i_this->mMode = 0; } break; } case 3: { if (75.0 <= i_this->mEyePosYDistFromPlayer) { - i_this->mStayStatus = 1; - } else if (i_this->field_0x5fc[0] == 0) { + i_this->mMode = 1; + } else if (i_this->mTimer[0] == 0) { if (30.0 <= i_this->mEyePosYDistFromPlayer) { i_this->mAction = ACT_SIT; - i_this->mStayStatus = 0; + i_this->mMode = 0; } else { i_this->mAction = ACT_STAY; - i_this->mStayStatus = 10; + i_this->mMode = 10; } } break; } case 5: { - cLib_addCalcAngleS2(&i_this->current.angle.y, player_angle + i_this->field_0x654, 4, 0x800); - cLib_addCalcAngleS2(&i_this->field_0x654, i_this->field_0x656, 4, 0x1000); - cLib_addCalc2(&i_this->current.pos.x, i_this->field_0x5b8.x, 0.2, 3.5); - cLib_addCalc2(&i_this->current.pos.z, i_this->field_0x5b8.z, 0.2, 3.5); + cLib_addCalcAngleS2(&i_this->current.angle.y, player_angle + i_this->mRandomAngleY, 4, 0x800); + cLib_addCalcAngleS2(&i_this->mRandomAngleY, i_this->mRandomTargetAngleY, 4, 0x1000); + cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.2, 3.5); + cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.2, 3.5); - if (i_this->field_0x5fc[0] == 0) { - i_this->mStayStatus = 0; + if (i_this->mTimer[0] == 0) { + i_this->mMode = 0; } break; } case 6: { - i_this->field_0x648 = 4000.0; + i_this->mTailWagTarget = 4000.0; - if (i_this->field_0x674.z * 176.0 < i_this->mDistFromPlayer) { - i_this->mStayStatus = 0; + if (i_this->mScale.z * 176.0 < i_this->mDistFromPlayer) { + i_this->mMode = 0; } } default: { if (some_val < angle_diff) { anm_init(i_this, ANM_STEP_2, 0.0, 2, 0.0); - i_this->mStayStatus = 2; + i_this->mMode = 2; } else if (75.0 <= i_this->mEyePosYDistFromPlayer) { - // i_this->field_0x674.z might be a store in a variable - if (i_this->field_0x674.z * 96.0 <= i_this->mDistFromPlayer) { - if ((i_this->mStayStatus != 6) && - (i_this->mDistFromPlayer < i_this->field_0x674.z * 120.0)) + // i_this->mScale.z might be a store in a variable + if (i_this->mScale.z * 96.0 <= i_this->mDistFromPlayer) { + if ((i_this->mMode != 6) && + (i_this->mDistFromPlayer < i_this->mScale.z * 120.0)) { anm_init(i_this, ANM_JOYFUL, 0.0, 2, cM_rndFX(0.1) + 1.0); - i_this->mStayStatus = 6; + i_this->mMode = 6; } } else { cXyz local_68; @@ -1717,51 +1720,51 @@ static void do_wait_1(do_class* i_this) { for (int i = 0; i < 20; i++) { if (i < 10) { - mDoMtx_YrotS((MtxP)calc_mtx, i_this->mAngleYFromPlayer + cM_rndFX(5000.0)); + mDoMtx_YrotS((MtxP)calc_mtx, i_this->mTargetAngleY + cM_rndFX(5000.0)); } else { mDoMtx_YrotS((MtxP)calc_mtx, cM_rndF(65536.0)); } - local_68.z = dVar11 * i_this->field_0x674.z; + local_68.z = dVar11 * i_this->mScale.z; - MtxPosition(&local_68, &i_this->field_0x5b8); - i_this->field_0x5b8 += player->current.pos; + MtxPosition(&local_68, &i_this->mTargetPos); + i_this->mTargetPos += player->current.pos; if (cM_rndF(1.0) < dVar12) break; // local_74 = i_this->field6_0x5b8; - if (dansa_check(i_this, i_this->field_0x5b8, 0.0) == 0) + if (dansa_check(i_this, i_this->mTargetPos, 0.0) == 0) break; - i_this->mUnkPos = i_this->field_0x5b8; + i_this->mUnkPos = i_this->mTargetPos; i_this->field_0x624 = dVar10 + cM_rndF(10.0); } - i_this->mStayStatus = 5; - i_this->field_0x656 = cM_rndFX(10000.0); + i_this->mMode = 5; + i_this->mRandomTargetAngleY = cM_rndFX(10000.0); anm_init(i_this, ANM_WALK, 0.0, 2, 0.0); - i_this->field_0x5fc[0] = cM_rndF(10.0) + 15.0; + i_this->mTimer[0] = cM_rndF(10.0) + 15.0; } } else { - i_this->mStayStatus = 3; - i_this->field_0x5fc[0] = cM_rndF(10.0) + 10.0; + i_this->mMode = 3; + i_this->mTimer[0] = cM_rndF(10.0) + 10.0; } break; } case 10: { - i_this->field_0x5e8 = 5.0; - anm_init(i_this, ANM_WALK, 0.0, 2, i_this->field_0x5e8); + i_this->mAnmSpeed = 5.0; + anm_init(i_this, ANM_WALK, 0.0, 2, i_this->mAnmSpeed); - i_this->mStayStatus++; + i_this->mMode++; } case 11: { - cLib_addCalc2(&i_this->field_0x5e8, 2.0, 1.0, 0.2); - i_this->mpMorf->setPlaySpeed(i_this->field_0x5e8); + cLib_addCalc2(&i_this->mAnmSpeed, 2.0, 1.0, 0.2); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); - if (i_this->field_0x5e8 <= 2.2) { - i_this->mStayStatus = 0; + if (i_this->mAnmSpeed <= 2.2) { + i_this->mMode = 0; } break; @@ -1775,19 +1778,19 @@ static void do_wait_1(do_class* i_this) { cLib_addCalc0(&i_this->speedF, 1.0, 1.0); - if (i_this->field_0x674.z * 240.0 < i_this->mDistFromPlayer && !dansa_check2(i_this, 0.0) && - i_this->mStayStatus < 10) + if (i_this->mScale.z * 240.0 < i_this->mDistFromPlayer && !dansa_check2(i_this, 0.0) && + i_this->mMode < 10) { i_this->mAction = ACT_WALK_RUN; - i_this->field_0x5e8 = 1.5; - anm_init(i_this, ANM_WALK, 0.0, 2, i_this->field_0x5e8); - i_this->mStayStatus = 1; + i_this->mAnmSpeed = 1.5; + anm_init(i_this, ANM_WALK, 0.0, 2, i_this->mAnmSpeed); + i_this->mMode = 1; } // might be a seperate variable for link if (daPy_getLinkPlayerActorClass()->checkCanoeRide() && i_this->mDistFromPlayer < 1000.0) { i_this->mAction = ACT_HELP; - i_this->mStayStatus = 0; + i_this->mMode = 0; } if (i_this->field_0x5b4 == 2) { @@ -1915,22 +1918,22 @@ static void do_wait_2(do_class* i_this) { fopAc_ac_c* player = dComIfGp_getPlayer(0); i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4400); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4400); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 0: { - i_this->mStayStatus++; + i_this->mMode++; } case 1: { - if (i_this->field_0x5fc[0] == 0) { - i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4189)) + FLOAT_LABEL(lit_4192); - i_this->field_0x656 = cM_rndFX(FLOAT_LABEL(lit_4587)); + if (i_this->mTimer[0] == 0) { + i_this->mTimer[0] = cM_rndF(FLOAT_LABEL(lit_4189)) + FLOAT_LABEL(lit_4192); + i_this->mRandomTargetAngleY = cM_rndFX(FLOAT_LABEL(lit_4587)); cM_rndF(FLOAT_LABEL(lit_3662)) < FLOAT_LABEL(lit_4588) ? - i_this->field_0x5e8 = cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665) : - i_this->field_0x5e8 = -(cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665)); + i_this->mAnmSpeed = cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665) : + i_this->mAnmSpeed = -(cM_rndF(FLOAT_LABEL(lit_4342)) + FLOAT_LABEL(lit_3665)); - anm_init(i_this, ANM_STEP, FLOAT_LABEL(lit_4194), 2, i_this->field_0x5e8); + anm_init(i_this, ANM_STEP, FLOAT_LABEL(lit_4194), 2, i_this->mAnmSpeed); mDoMtx_YrotS((MtxP)calc_mtx, player->shape_angle.y); Vec local_38; @@ -1939,26 +1942,26 @@ static void do_wait_2(do_class* i_this) { local_38.y = FLOAT_LABEL(lit_3682); local_38.z = cM_rndF(FLOAT_LABEL(lit_3816)) + FLOAT_LABEL(lit_4551); - MtxPosition((cXyz*)&local_38, &i_this->field_0x5b8); - i_this->field_0x5b8 += player->current.pos; + MtxPosition((cXyz*)&local_38, &i_this->mTargetPos); + i_this->mTargetPos += player->current.pos; } break; } } - cLib_addCalc2(&i_this->current.pos.x, i_this->field_0x5b8.x, FLOAT_LABEL(lit_4342), + cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, FLOAT_LABEL(lit_4342), FLOAT_LABEL(lit_3665)); - cLib_addCalc2(&i_this->current.pos.z, i_this->field_0x5b8.z, FLOAT_LABEL(lit_4342), + cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, FLOAT_LABEL(lit_4342), FLOAT_LABEL(lit_3665)); cLib_addCalc0(&i_this->speedF, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_3665)); - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mAngleYFromPlayer + i_this->field_0x654, + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY + i_this->mRandomAngleY, 4, 0x800); - cLib_addCalcAngleS2(&i_this->field_0x654, i_this->field_0x656, 4, 0x1000); + cLib_addCalcAngleS2(&i_this->mRandomAngleY, i_this->mRandomTargetAngleY, 4, 0x1000); - if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3923) * i_this->field_0x674.z) { + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3923) * i_this->mScale.z) { i_this->mAction = ACT_RUN; - i_this->mStayStatus = 0; + i_this->mMode = 0; } area_check(i_this); @@ -1969,22 +1972,22 @@ static void do_wait_2(do_class* i_this) { // matches except float literal in inline static void do_sit(do_class* i_this) { i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4190); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4190); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 0: { anm_init(i_this, ANM_SIT_WAIT, FLOAT_LABEL(lit_4192), 2, FLOAT_LABEL(lit_3662)); - i_this->mStayStatus++; + i_this->mMode++; } case 1: { if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { - i_this->mStayStatus = 3; - i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); + i_this->mMode = 3; + i_this->mTimer[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); } else { if (i_this->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846)) { - i_this->mStayStatus = 2; - i_this->field_0x5fc[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); + i_this->mMode = 2; + i_this->mTimer[0] = cM_rndF(FLOAT_LABEL(lit_4192)) + FLOAT_LABEL(lit_4192); } } break; @@ -1992,24 +1995,24 @@ static void do_sit(do_class* i_this) { case 2: { if (i_this->mEyePosYDistFromPlayer < FLOAT_LABEL(lit_3846)) { - if (i_this->field_0x5fc[0] == 0) { + if (i_this->mTimer[0] == 0) { i_this->mAction = ACT_STAY; - i_this->mStayStatus = 10; + i_this->mMode = 10; } } else { - i_this->mStayStatus = 1; + i_this->mMode = 1; } break; } case 3: { if (i_this->mEyePosYDistFromPlayer > FLOAT_LABEL(lit_4545)) { - if (i_this->field_0x5fc[0] == 0) { + if (i_this->mTimer[0] == 0) { anm_init(i_this, ANM_SIT, FLOAT_LABEL(lit_4194), 0, FLOAT_LABEL(lit_3662)); - i_this->mStayStatus++; + i_this->mMode++; } } else { - i_this->mStayStatus = 1; + i_this->mMode = 1; } break; @@ -2018,7 +2021,7 @@ static void do_sit(do_class* i_this) { case 4: { if (i_this->mpMorf->isStop()) { i_this->mAction = ACT_WAIT_1; - i_this->mStayStatus = 0; + i_this->mMode = 0; } break; } @@ -2026,10 +2029,10 @@ static void do_sit(do_class* i_this) { cLib_addCalc0(&i_this->speedF, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_3665)); - if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3773) * i_this->field_0x674.z) { + if (i_this->mDistFromPlayer > FLOAT_LABEL(lit_3773) * i_this->mScale.z) { i_this->mAction = ACT_STAY; i_this->field_0x5f4 = 8; - i_this->mStayStatus = 0; + i_this->mMode = 0; } area_check(i_this); @@ -2200,34 +2203,34 @@ static void do_swim(do_class* i_this) { Vec pos; // this is probably cXyz but defining it as such moves ~cXyz to right after this // function, breaking the TU match i_this->field_0x616 = 1; - i_this->field_0x648 = FLOAT_LABEL(lit_4191); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4191); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 1: { break; } case 0: { anm_init(i_this, 19, FLOAT_LABEL(lit_4027), 2, cM_rndF(FLOAT_LABEL(lit_4991)) + FLOAT_LABEL(lit_4340)); - i_this->mStayStatus++; + i_this->mMode++; break; } } cLib_addCalc2(&i_this->speedF, l_HIO.mSwimSpeed, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4588) * l_HIO.mSwimSpeed); - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mAngleYFromPlayer, 16, 0x100); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 16, 0x100); i_this->speed.y = FLOAT_LABEL(lit_3682); i_this->gravity = FLOAT_LABEL(lit_3682); - cLib_addCalc2(&i_this->current.pos.y, i_this->field_0x65c - FLOAT_LABEL(lit_4992), + cLib_addCalc2(&i_this->current.pos.y, i_this->mWaterY - FLOAT_LABEL(lit_4992), FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_4027)); pos = i_this->eyePos; - pos.y = i_this->field_0x65c; + pos.y = i_this->mWaterY; - fopAcM_effHamonSet(&i_this->field_0xbcc, (cXyz*)&pos, FLOAT_LABEL(lit_4993), + fopAcM_effHamonSet(&i_this->mRippleKey, (cXyz*)&pos, FLOAT_LABEL(lit_4993), FLOAT_LABEL(lit_4402)); } @@ -2343,10 +2346,10 @@ COMPILER_STRIP_GATE(0x8066EF5C, &lit_5407); /* 8066C894-8066CAA8 004C34 0214+00 1/1 0/0 0/0 .text do_a_swim__FP8do_class */ #ifdef NONMATCHING static void do_a_swim(do_class* i_this) { - i_this->field_0x648 = 2000.0; + i_this->mTailWagTarget = 2000.0; cLib_addCalc0(&i_this->speedF, 1.0, 1.0); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 2: { l_HIO.mWaterHuntAnimType == 1 ? i_this->mpMorf->setPlaySpeed(i_this->field46_0x634 * 5.0) : i_this->mpMorf->setPlaySpeed(i_this->field46_0x634 * 5.0); @@ -2357,13 +2360,13 @@ static void do_a_swim(do_class* i_this) { i_this->field_0x634 = 0.0; i_this->mAction = ACT_WAIT_1; - i_this->mStayStatus = 0; + i_this->mMode = 0; break; } case 0: { l_HIO.mWaterHuntAnimType == 1 ? anm_init(param_1, ANM_JOYFUL, 0.0, 2, 0.0) : anm_init(param_1, ANM_BULBUL, 0.0, 2, 0.0); - i_this->mStayStatus = 1; + i_this->mMode = 1; i_this->field32_0x5fc[0] = 0x14; JPABaseEmitter* emitter = dComIfGp_particle_set(0x2a3, &i_this->.current.pos, 0, 0); @@ -2376,8 +2379,8 @@ static void do_a_swim(do_class* i_this) { } } - if (i_this->field_0x5fc[0] == 0) { - i_this->mStayStatus = 2; + if (i_this->mTimer[0] == 0) { + i_this->mMode = 2; i_this->field_0x634 = 0.1; i_this->field_0x638 = 1.0; } @@ -2430,26 +2433,26 @@ static asm u8 do_carry(do_class* i_this) { /* 8066CDEC-8066CEC4 00518C 00D8+00 1/1 0/0 0/0 .text do_message__FP8do_class */ static void do_message(do_class* i_this) { - i_this->field_0x648 = FLOAT_LABEL(lit_4191); + i_this->mTailWagTarget = FLOAT_LABEL(lit_4191); - switch (i_this->mStayStatus) { + switch (i_this->mMode) { case 1: { break; } case 0: { anm_init(i_this, 21, FLOAT_LABEL(lit_4027), 2, FLOAT_LABEL(lit_3662)); - i_this->mStayStatus++; + i_this->mMode++; break; } } cLib_addCalc0(&i_this->speedF, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_3665)); i_this->field_0x616 = 1; - cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mAngleYFromPlayer, 2, 0x1000); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 2, 0x1000); if (dComIfGp_event_runCheck() == 0 && i_this->mDistFromPlayer > FLOAT_LABEL(lit_3773)) { i_this->mAction = ACT_STAY; - i_this->mStayStatus = 0; + i_this->mMode = 0; } } @@ -2558,7 +2561,7 @@ static void action(do_class* i_this) { i_this->mDistFromPlayer -= FLOAT_LABEL(lit_3772); } - i_this->mAngleYFromPlayer = fopAcM_searchPlayerAngleY(i_this); + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(i_this); i_this->mEyePosYDistFromPlayer = fabsf(i_this->eyePos.y - player->current.pos.y); if (!mDoCPd_c::getHoldR(PAD_1) || @@ -2576,60 +2579,60 @@ static void action(do_class* i_this) { i_this->mCcD_GObjInf1.OnCoSetBit(); if (i_this->field_0x608 < FLOAT_LABEL(lit_3662)) { - i_this->field_0xc05 = 0; + i_this->mMessageState = 0; switch (i_this->mAction) { case ACT_STAY: { do_stay(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_WALK: { do_walk(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_WALK_RUN: { do_walk_run(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_RUN: { do_run(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_RUN_WALK: { do_run_walk(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_FOOD: { do_food(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_WAIT_1: { do_wait_1(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_WAIT_2: { do_wait_2(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_SIT: { do_sit(i_this); food_check(i_this); - i_this->field_0xc05 = 1; + i_this->mMessageState = 1; break; } case ACT_A_SWIM: { @@ -2663,13 +2666,13 @@ static void action(do_class* i_this) { } case ACT_MESSAGE: { do_message(i_this); - i_this->field_0xc05 = 2; + i_this->mMessageState = 2; } } } if (i_this->mItemPcId != -1 && - i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->field_0x674.z) + i_this->mDistFromPlayer < FLOAT_LABEL(lit_4378) * i_this->mScale.z) { daItem_c* item = (daItem_c*)fopAcM_SearchByID(i_this->mItemPcId); @@ -2688,11 +2691,11 @@ static void action(do_class* i_this) { } } - if (i_this->field_0xc05 == 1 && daPy_py_c::i_checkNowWolf() && + if (i_this->mMessageState == 1 && daPy_py_c::i_checkNowWolf() && i_this->mDistFromPlayer < FLOAT_LABEL(lit_4339)) { i_this->mAction = ACT_MESSAGE; - i_this->mStayStatus = 0; + i_this->mMode = 0; } if (tmp2 != 0 && player->mSpeedF < FLOAT_LABEL(lit_3665)) { @@ -2713,7 +2716,7 @@ static void action(do_class* i_this) { pos1.x = FLOAT_LABEL(lit_3682); pos1.y = FLOAT_LABEL(lit_3682); pos1.z = FLOAT_LABEL(lit_3981) * i_this->speedF; - pos1.z *= i_this->field_0x674.z; + pos1.z *= i_this->mScale.z; MtxPosition(&pos1, &pos2); @@ -2764,7 +2767,7 @@ static void action(do_class* i_this) { pos1.x = FLOAT_LABEL(lit_3682); pos1.y = FLOAT_LABEL(lit_3682); - pos1.z = FLOAT_LABEL(lit_5950) * i_this->field_0x674.z; + pos1.z = FLOAT_LABEL(lit_5950) * i_this->mScale.z; MtxPosition(&pos1, &pos2); pos2 += i_this->current.pos; @@ -2794,7 +2797,7 @@ static void action(do_class* i_this) { if (i_this->field_0x660 == 0xdcf) { i_this->mAction = ACT_HANG; - i_this->mStayStatus = 0; + i_this->mMode = 0; i_this->field_0x63c = 0; } } @@ -2807,30 +2810,30 @@ static void action(do_class* i_this) { if (i_this->mAction == ACT_CARRY) { if (i_this->field_0x63c != 0 && i_this->field_0x63c--, i_this->field_0x63c == 0) { i_this->mAction = ACT_A_SWIM; - i_this->mStayStatus = 0; + i_this->mMode = 0; } - if (45.0f < i_this->field_0x65c - i_this->current.pos.y) { + if (45.0f < i_this->mWaterY - i_this->current.pos.y) { i_this->mAction = ACT_SWIM; - i_this->mStayStatus = 0; + i_this->mMode = 0; i_this->field_0x608 = FLOAT_LABEL(lit_3682); if (i_this->field_0x606 == 0) { i_this->field_0x606 = 0x14; cXyz pos = i_this->current.pos; - pos.y = i_this->field_0x65c; + pos.y = i_this->mWaterY; if (l_HIO.mRunSpeed == 0) { scc[0] = 0; // fix later l_HIO.mWalkSpeed = FLOAT_LABEL(lit_3682); l_HIO.mRunSpeed = FLOAT_LABEL(lit_3682); - l_HIO.field_0x1c = 1; + l_HIO.mWaitType = 1; } for (int i = 0; i < 4; i++) { // wrong i_this->mMsg.setMsg(dComIfGp_particle_set( - (u32)0, (u16)l_HIO.field_0x1c, &pos, &i_this->tevStr, (csXyz*)0, + (u32)0, (u16)l_HIO.mWaitType, &pos, &i_this->tevStr, (csXyz*)0, (cXyz*)&scc, (u8)0xFF, (dPa_levelEcallBack*)0, (s8)-1, (GXColor*)0, (GXColor*)0, (cXyz*)0)); } @@ -2842,9 +2845,9 @@ static void action(do_class* i_this) { } else { i_this->field_0x63c = cM_rndF(FLOAT_LABEL(lit_4025)) + FLOAT_LABEL(lit_3846); - if (i_this->field_0x65c - i_this->current.pos.y < FLOAT_LABEL(lit_5951)) { + if (i_this->mWaterY - i_this->current.pos.y < FLOAT_LABEL(lit_5951)) { i_this->mAction = ACT_WAIT_1; - i_this->mStayStatus = 0; + i_this->mMode = 0; } } @@ -2869,7 +2872,7 @@ static void action(do_class* i_this) { eyePosDiff = i_this->mUnkPos - i_this->eyePos; } - eyePosDiff.y += i_this->field_0x674.z * FLOAT_LABEL(lit_5952); + eyePosDiff.y += i_this->mScale.z * FLOAT_LABEL(lit_5952); s16 some_angle = cM_atan2s(eyePosDiff.x, eyePosDiff.z) - i_this->shape_angle.y; s16 some_angle2 = cM_atan2s(eyePosDiff.y, JMAFastSqrt(eyePosDiff.x * eyePosDiff.x + @@ -2903,7 +2906,7 @@ static void action(do_class* i_this) { } cLib_addCalcAngleS2(&i_this->field_0x610, tmp4 / 2, 4, 0x2000); - cLib_addCalcAngleS2(&i_this->field_0x60e, tmp5 / 2, 4, 0x2000); + cLib_addCalcAngleS2(&i_this->mHeadAngle, tmp5 / 2, 4, 0x2000); cLib_addCalcAngleS2(&i_this->field_0x614, 0, 2, 0x300); cLib_addCalcAngleS2(&i_this->field_0x628, i_this->field_0x62e, 4, 0x400); cLib_addCalcAngleS2(&i_this->field_0x62a, i_this->field_0x630, 4, 0x400); @@ -2927,7 +2930,7 @@ static void action(do_class* i_this) { } if (0.025 <= i_this->field_0x634) { - if (l_HIO.field_0x1c == 0) { + if (l_HIO.mWaitType == 0) { i_this->field_0x612 = 0; i_this->field_0x610 = 0; } else { @@ -2940,23 +2943,23 @@ static void action(do_class* i_this) { FLOAT_LABEL(lit_5407)); cLib_addCalc0(&i_this->field_0x638, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_5954)); - i_this->field_0x640 = cM_ssin(i_this->field_0x648 * i_this->field_0x64c); - i_this->field_0x63e = cM_ssin(i_this->field_0x648 * i_this->field_0x650); - i_this->field_0x64c += i_this->field_0x648 * FLOAT_LABEL(lit_3682); + i_this->field_0x640 = cM_ssin(i_this->mTailWagTarget * i_this->field_0x64c); + i_this->mTailAngle = cM_ssin(i_this->mTailWagTarget * i_this->field_0x650); + i_this->field_0x64c += i_this->mTailWagTarget * FLOAT_LABEL(lit_3682); if (65536.0 < i_this->field_0x64c) { i_this->field_0x64c -= FLOAT_LABEL(lit_4338); } - i_this->field_0x650 += i_this->field_0x648 * FLOAT_LABEL(lit_4401); + i_this->field_0x650 += i_this->mTailWagTarget * FLOAT_LABEL(lit_4401); if (65536.0 < i_this->field_0x650) { i_this->field_0x650 -= FLOAT_LABEL(lit_4338); } - cLib_addCalc2(&i_this->field_0x648, i_this->field_0x648, FLOAT_LABEL(lit_3662), + cLib_addCalc2(&i_this->mTailWagTarget, i_this->mTailWagTarget, FLOAT_LABEL(lit_3662), FLOAT_LABEL(lit_3772)); - i_this->field_0x648 = FLOAT_LABEL(lit_3682); + i_this->mTailWagTarget = FLOAT_LABEL(lit_3682); if (i_this->field_0x5e2 == 0) { if (i_this->field_0x5e0 == 0) { @@ -2985,21 +2988,21 @@ static asm void action(do_class* i_this) { /* 8066DD48-8066DE64 0060E8 011C+00 1/1 0/0 0/0 .text message__FP8do_class */ static void message(do_class* i_this) { - if (i_this->field_0xc06 != 0) { - i_this->field_0x604 = 10; + if (i_this->mIsTalking != 0) { + i_this->mCcDisableTimer = 10; if (i_this->mMsg.doFlow(i_this, 0, 0)) { dComIfGp_event_reset(); - i_this->field_0xc06 = 0; + i_this->mIsTalking = 0; } } else { if (dComIfGp_event_runCheck() && i_this->eventInfo.checkCommandTalk()) { - i_this->mMsg.init(i_this, i_this->field_0xc08, 0, 0); - i_this->field_0xc06 = 1; + i_this->mMsg.init(i_this, i_this->mFlowID, 0, 0); + i_this->mIsTalking = 1; } - if (i_this->field_0xc05 == 2 && i_this->field_0xc08 != -1 && daPy_py_c::i_checkNowWolf()) { + if (i_this->mMessageState == 2 && i_this->mFlowID != -1 && daPy_py_c::i_checkNowWolf()) { fopAcM_OnStatus(i_this, 0); cLib_onBit<u32>(i_this->attention_info.flags, 0xa); i_this->eventInfo.i_onCondition(dEvtCnd_CANTALK_e); @@ -3179,7 +3182,8 @@ do_class::do_class() {} #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm do_class::do_class() { +// asm do_class::do_class() { +extern "C" asm void __ct__8do_classFv() { nofralloc #include "asm/rel/d/a/d_a_do/d_a_do/__ct__8do_classFv.s" } diff --git a/rel/d/a/d_a_do/d_a_do_NONMATCHING.cpp b/rel/d/a/d_a_do/d_a_do_NONMATCHING.cpp new file mode 100644 index 0000000000..bd1a968797 --- /dev/null +++ b/rel/d/a/d_a_do/d_a_do_NONMATCHING.cpp @@ -0,0 +1,2827 @@ +/** + * d_a_do.cpp + * Dog + */ + +// Every function matches, but a Z2SoundObjSimple dtor is generated that should not exist + +#include "rel/d/a/d_a_do/d_a_do.h" +#include "JSystem/JGeometry.h" +#include "SSystem/SComponent/c_math.h" +#include "m_Do/m_Do_controller_pad.h" +#include "c/c_damagereaction.h" +#include "d/com/d_com_inf_game.h" +#include "d/a/d_a_player.h" +#include "d/a/d_a_item_static.h" +#include "d/d_procname.h" +#include "f_op/f_op_actor_mng.h" +#include "rel/d/a/d_a_canoe/d_a_canoe.h" +#include "rel/d/a/obj/d_a_obj_food/d_a_obj_food.h" + +/* 8066F278-8066F27C 000008 0001+03 3/3 0/0 0/0 .bss @1109 */ +static u8 lit_1109[1 + 3 /* padding */]; + +/* 8066F27C-8066F280 00000C 0001+03 0/0 0/0 0/0 .bss @1107 */ +#pragma push +#pragma force_active on +static u8 lit_1107[1 + 3 /* padding */]; +#pragma pop + +/* 8066F280-8066F284 000010 0001+03 0/0 0/0 0/0 .bss @1105 */ +#pragma push +#pragma force_active on +static u8 lit_1105[1 + 3 /* padding */]; +#pragma pop + +/* 8066F284-8066F288 000014 0001+03 0/0 0/0 0/0 .bss @1104 */ +#pragma push +#pragma force_active on +static u8 lit_1104[1 + 3 /* padding */]; +#pragma pop + +/* 8066F288-8066F28C 000018 0001+03 0/0 0/0 0/0 .bss @1099 */ +#pragma push +#pragma force_active on +static u8 lit_1099[1 + 3 /* padding */]; +#pragma pop + +/* 8066F28C-8066F290 00001C 0001+03 0/0 0/0 0/0 .bss @1097 */ +#pragma push +#pragma force_active on +static u8 lit_1097[1 + 3 /* padding */]; +#pragma pop + +/* 8066F290-8066F294 000020 0001+03 0/0 0/0 0/0 .bss @1095 */ +#pragma push +#pragma force_active on +static u8 lit_1095[1 + 3 /* padding */]; +#pragma pop + +/* 8066F294-8066F298 000024 0001+03 0/0 0/0 0/0 .bss @1094 */ +#pragma push +#pragma force_active on +static u8 lit_1094[1 + 3 /* padding */]; +#pragma pop + +/* 8066F298-8066F29C 000028 0001+03 0/0 0/0 0/0 .bss @1057 */ +#pragma push +#pragma force_active on +static u8 lit_1057[1 + 3 /* padding */]; +#pragma pop + +/* 8066F29C-8066F2A0 00002C 0001+03 0/0 0/0 0/0 .bss @1055 */ +#pragma push +#pragma force_active on +static u8 lit_1055[1 + 3 /* padding */]; +#pragma pop + +/* 8066F2A0-8066F2A4 000030 0001+03 0/0 0/0 0/0 .bss @1053 */ +#pragma push +#pragma force_active on +static u8 lit_1053[1 + 3 /* padding */]; +#pragma pop + +/* 8066F2A4-8066F2A8 000034 0001+03 0/0 0/0 0/0 .bss @1052 */ +#pragma push +#pragma force_active on +static u8 lit_1052[1 + 3 /* padding */]; +#pragma pop + +/* 8066F2A8-8066F2AC 000038 0001+03 0/0 0/0 0/0 .bss @1014 */ +#pragma push +#pragma force_active on +static u8 lit_1014[1 + 3 /* padding */]; +#pragma pop + +/* 8066F2AC-8066F2B0 00003C 0001+03 0/0 0/0 0/0 .bss @1012 */ +#pragma push +#pragma force_active on +static u8 lit_1012[1 + 3 /* padding */]; +#pragma pop + +/* 8066F2B0-8066F2B4 000040 0001+03 0/0 0/0 0/0 .bss @1010 */ +#pragma push +#pragma force_active on +static u8 lit_1010[1 + 3 /* padding */]; +#pragma pop + +/* 8066F2B4-8066F2B8 -00001 0004+00 1/2 0/0 0/0 .bss None */ +/* 8066F2B4 0001+01 data_8066F2B4 @1009 */ +/* 8066F2B6 0002+00 data_8066F2B6 None */ +static u8 data_8066F2B4; +static bool noFallCheck; +static bool hioInit; + +/* 8066F2C4-8066F2E4 000054 0020+00 11/12 0/0 0/0 .bss l_HIO */ +static daDo_HIO_c l_HIO; + +/* 80667D4C-80667DA8 0000EC 005C+00 1/1 0/0 0/0 .text __ct__10daDo_HIO_cFv */ +daDo_HIO_c::daDo_HIO_c() { + field_0x04 = -1; + mBaseSize = 1.0f; + mWalkSpeed = 2.5f; + mRunSpeed = 12.0f; + mSwimSpeed = 2.0f; + mPlayerRecognitionDist = 600.0f; + mWaitType = 0; + mSwimming = 1; + mWaterHuntAnimType = 0; +} + +/* 80667DA8-80667E68 000148 00C0+00 16/16 0/0 0/0 .text anm_init__FP8do_classifUcf */ +static void anm_init(do_class* i_this, int i_resIdx, f32 i_morf, u8 i_mode, f32 i_speed) { + if (!(i_this->field_0x608 > 1.0f)) { + i_this->mpMorf->setAnm(static_cast<J3DAnmTransform*>(dComIfG_getObjectRes("Do", i_resIdx)), + i_mode, i_morf, i_speed, 0.0f, -1.0f, 0); + i_this->mAnmID = i_resIdx; + } +} + +/* 80667E68-80667FE4 000208 017C+00 1/1 0/0 0/0 .text nodeCallBack__FP8J3DJointi */ +static int nodeCallBack(J3DJoint* i_jntP, int param_1) { + if (param_1 == 0) { + int joint_num = i_jntP->getJntNo(); + J3DModel* model = j3dSys.getModel(); + do_class* _this = (do_class*)model->getUserArea(); + + if (_this != NULL) { + MTXCopy(model->getAnmMtx(joint_num), *calc_mtx); + + if (joint_num == 9 || joint_num == 10) { + cMtx_YrotM(*calc_mtx, _this->mHeadAngle.y + _this->mHeadBob.y); + cMtx_XrotM(*calc_mtx, _this->mHeadAngle.z + _this->mHeadBob.z); + cMtx_ZrotM(*calc_mtx, _this->mHeadAngle.x); + } else if (joint_num == 22) { + cMtx_YrotM(*calc_mtx, _this->mTailAngle.y << 1); + cMtx_ZrotM(*calc_mtx, _this->mTailAngle.x << 1); + } else { + cMtx_YrotM(*calc_mtx, _this->mTailAngle.y); + cMtx_ZrotM(*calc_mtx, _this->mTailAngle.x); + } + + model->setAnmMtx(joint_num, *calc_mtx); + MTXCopy(*calc_mtx, j3dSys.mCurrentMtx); + } + } + return 1; +} + +/* 80667FE4-80668134 000384 0150+00 1/0 0/0 0/0 .text daDo_Draw__FP8do_class */ +static int daDo_Draw(do_class* i_this) { + if (i_this->mNoDraw != 0) { + i_this->mNoDraw = 0; + return 1; + } + + if (daPy_py_c::linkGrabSubjectNoDraw(i_this)) { + return 1; + } + + J3DModel* model = i_this->mpMorf->getModel(); + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType_MAJI(model, &i_this->tevStr); + i_this->mpBtk->entry(model->getModelData()); + i_this->mpBtp->entry(model->getModelData()); + i_this->mpMorf->entryDL(); + + if (!fopAcM_checkCarryNow(i_this) && i_this->mAction != ACT_BOAT) { + cXyz pos; + pos.set(i_this->current.pos.x, i_this->current.pos.y + 100.0f, i_this->current.pos.z); + i_this->mShadowKey = + dComIfGd_setShadow(i_this->mShadowKey, 1, model, &pos, 400.0f, 0.0f, + i_this->current.pos.y, i_this->mBgS_Acch.GetGroundH(), + i_this->mBgS_Acch.m_gnd, &i_this->tevStr, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + } + + return 1; +} + +/* 80668170-80668264 000510 00F4+00 1/1 0/0 0/0 .text + * daDo_other_bg_check__FP8do_classP10fopAc_ac_c */ +static BOOL daDo_other_bg_check(do_class* i_this, fopAc_ac_c* i_actor) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + cXyz dog_pos; + cXyz actor_pos; + dBgS_LinChk lin_chk; + + if (i_actor != NULL) { + actor_pos = i_actor->current.pos; + actor_pos.y += 50.0f; + + dog_pos = _this->current.pos; + dog_pos.y = _this->eyePos.y; + + lin_chk.Set(&dog_pos, &actor_pos, _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return true; + } else { + return false; + } + } else { + return true; + } +} + +/* 80668264-8066833C 000604 00D8+00 1/1 0/0 0/0 .text daDo_other_bg_check2__FP8do_classP4cXyz */ +static BOOL daDo_other_bg_check2(do_class* i_this, cXyz* i_pos) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + cXyz dog_pos; + cXyz pos; + dBgS_LinChk lin_chk; + + pos = *i_pos; + pos.y += 30.0f; + + dog_pos = _this->current.pos; + dog_pos.y += 30.0f; + + lin_chk.Set(&dog_pos, &pos, _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return true; + } else { + return false; + } +} + +/* 8066F2E4-8066F2F8 000074 0014+00 1/2 0/0 0/0 .bss target_info */ +static fopAc_ac_c* target_info[5]; + +/* 8066F2F8-8066F2FC 000088 0004+00 1/2 0/0 0/0 .bss target_info_count */ +static int target_info_count; + +/* 8066F2FC-8066F310 00008C 0014+00 0/1 0/0 0/0 .bss target_bgc */ +static BOOL target_bgc[5]; + +/* 8066833C-806683C0 0006DC 0084+00 1/1 0/0 0/0 .text s_w_sub__FPvPv */ +static void* s_w_sub(void* i_proc, void* i_this) { + if (fopAcM_IsActor(i_proc) && + (fopAcM_GetName(i_proc) == PROC_OBJ_FOOD || fopAcM_GetName(i_proc) == PROC_OBJ_KANBAN2) && + fopAcM_checkCarryNow(static_cast<fopAc_ac_c*>(i_proc)) && target_info_count < 5) + { + target_info[target_info_count] = static_cast<fopAc_ac_c*>(i_proc); + target_info_count++; + } + return NULL; +} + +/* 806683C0-8066858C 000760 01CC+00 1/1 0/0 0/0 .text search_food__FP8do_class */ +static u32 search_food(do_class* i_this) { + target_info_count = 0; + + for (int i = 0; i < 5; i++) { + target_info[i] = NULL; + target_bgc[i] = false; + } + + fpcM_Search(s_w_sub, i_this); + f32 pos_check = 200.0f; + + if (target_info_count != 0) { + fopAc_ac_c* actor; + int i = 0; + while (i < target_info_count) { + actor = target_info[i]; + cXyz delta; + delta.x = actor->current.pos.x - i_this->eyePos.x; + delta.y = actor->current.pos.y + 50.0f - i_this->eyePos.y; + delta.z = actor->current.pos.z - i_this->eyePos.z; + f32 dist_xz = JMAFastSqrt(delta.x * delta.x + delta.z * delta.z); + + if (dist_xz < pos_check) { + if (target_bgc[i] || daDo_other_bg_check(i_this, actor)) { + target_bgc[i] = true; + } else { + return fopAcM_GetID(actor); + } + } + + i++; + if (i == target_info_count) { + i = 0; + pos_check += 100.0f; + if (pos_check > i_this->mScale.z * 240.0f) { + return -1; + } + } + } + } else { + return -1; + } + return -1; +} + +/* 8066858C-806685EC 00092C 0060+00 1/1 0/0 0/0 .text food_check__FP8do_class */ +static void food_check(do_class* i_this) { + i_this->mFoodActorID = search_food(i_this); + + if (fopAcM_SearchByID(i_this->mFoodActorID)) { + i_this->mAction = ACT_FOOD; + i_this->mMode = 0; + } +} + +/* 806685EC-80668624 00098C 0038+00 1/1 0/0 0/0 .text do_carry_check__FP8do_class */ +static BOOL do_carry_check(do_class* i_this) { + if (i_this->mAction != ACT_CARRY && fopAcM_checkCarryNow(i_this)) { + i_this->mAction = ACT_CARRY; + i_this->mMode = 0; + return true; + } + + return false; +} + +/* 80668624-80668754 0009C4 0130+00 1/1 0/0 0/0 .text depth_check__FP8do_class4cXyzf */ +static BOOL depth_check(do_class* i_this, cXyz i_pos, f32 param_2) { + dBgS_GndChk gnd_chk; + Vec pos; + f32 f_gnd_chk; + f32 f_gnd_chk_spl; + + pos.x = i_pos.x; + pos.y = i_pos.y + 200.0f; + pos.z = i_pos.z; + + gnd_chk.SetPos(&pos); + f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); + + dBgS_ObjGndChk_Spl gnd_chk_spl; + gnd_chk_spl.SetPos(&pos); + f_gnd_chk_spl = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + + if (f_gnd_chk_spl - f_gnd_chk > 2.0f * param_2 * 0.8f * i_this->mScale.z) { + return 1; + } else { + return 0; + } +} + +/* 80668754-8066886C 000AF4 0118+00 1/1 0/0 0/0 .text water_check__FP8do_class */ +static bool water_check(do_class* i_this) { + dBgS_GndChk gnd_chk; + Vec pos; + + pos = i_this->current.pos; + pos.y += 200.0f; + + gnd_chk.SetPos(&pos); + f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); + + dBgS_ObjGndChk_Spl gnd_chk_spl; + gnd_chk_spl.SetPos(&pos); + i_this->mWaterY = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + + if (i_this->mWaterY - f_gnd_chk > 8.0f * i_this->mScale.z) { + return true; + } else { + return false; + } +} + +/* 8066886C-80668A30 000C0C 01C4+00 4/4 0/0 0/0 .text dansa_check__FP8do_class4cXyzf */ +static int dansa_check(do_class* i_this, cXyz i_pos, f32 param_2) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + i_pos.y += 25.0f; + dBgS_GndChk gnd_chk; + + Vec pos; + pos.x = i_pos.x; + pos.y = i_pos.y + 25.0f; + pos.z = i_pos.z; + + gnd_chk.SetPos(&pos); + f32 f_gnd_chk = dComIfG_Bgsp().GroundCross(&gnd_chk); + + if (i_this->current.pos.y - f_gnd_chk > param_2) { + return 1; + } else { + dBgS_LinChk lin_chk; + cXyz pos2; + + pos2 = _this->current.pos; + pos2.y += 60.0f; + + lin_chk.Set(&pos2, &i_pos, _this); + + if (dComIfG_Bgsp().LineCross(&lin_chk) != 0) { + return -1; + } else if (depth_check(i_this, i_pos, 5.0f) && l_HIO.mSwimming == 0) { + return -100; + } else { + return 0; + } + } +} + +/* 80668A30-80668B18 000DD0 00E8+00 3/3 0/0 0/0 .text dansa_check2__FP8do_classf */ +static BOOL dansa_check2(do_class* i_this, f32 param_1) { + cXyz pos, pos2; + + cMtx_YrotS(*calc_mtx, i_this->current.angle.y); + pos.x = 0.0f; + pos.y = 70.0f; + pos.z = 0.8f * param_1 * i_this->mScale.z + + 0.8f * i_this->speedF * i_this->mScale.z * 9.0f; + + MtxPosition(&pos, &pos2); + pos2 += i_this->current.pos; + return dansa_check(i_this, pos2, 100.0f) != 0 ? TRUE : FALSE; +} + +/* 80668B18-80668BA0 000EB8 0088+00 4/4 0/0 0/0 .text move_dansa_check__FP8do_classf */ +static BOOL move_dansa_check(do_class* i_this, f32 i_speed) { + if (dansa_check2(i_this, 130.0f)) { + i_this->mAction = ACT_WAIT_1; + + if (i_speed > 15.0f) { + i_this->mMode = 10; + } else { + i_this->mMode = 0; + } + + return true; + } else { + return false; + } +} + +/* 80668BA0-80668D5C 000F40 01BC+00 5/5 0/0 0/0 .text area_check__FP8do_class */ +static void area_check(do_class* i_this) { + cXyz pos_delta = i_this->home.pos - i_this->current.pos; + + if (i_this->mParam2 != 0xff) { + if (pos_delta.abs() > i_this->mParam2 * 100.0f * 2.0f) { + i_this->mAction = ACT_WALK; + i_this->mMode = -1; + i_this->mTimer[2] = cM_rndF(100.0f) + 100.0f; + } + } +} + +/* 80668D5C-80669050 0010FC 02F4+00 2/1 0/0 0/0 .text do_stay__FP8do_class */ +static void do_stay(do_class* i_this) { + switch (i_this->mMode) { + case 0: + if (i_this->mParam0 == 0) { + anm_init(i_this, ANM_DOWN_WT, 15.0f, 2, 1.0f); + i_this->mMode++; + i_this->mTimer[0] = 10; + } else { + i_this->mAction = ACT_WALK; + i_this->mMode = 0; + return; + } + // fallthrough + + case 1: + if (i_this->mTimer[0] == 0 && i_this->mDistFromPlayer < l_HIO.mPlayerRecognitionDist) { + i_this->mMode++; + i_this->mTimer[0] = cM_rndF(50.0f) + 20.0f; + } + break; + + case 2: + i_this->field_0x616 = 1; + i_this->mHeadTilt = -6300; + i_this->mTailWagTarget = 1000.0f; + if (i_this->mTimer[0] == 0) { + anm_init(i_this, ANM_DOWN, 5.0f, 0, 1.0f); + i_this->mMode++; + } + break; + + case 3: + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 2000.0f; + + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_WALK_RUN; + i_this->mMode = 0; + } + break; + + case 10: + anm_init(i_this, ANM_DOWN_WT, 15.0f, 2, 1.0f); + i_this->mMode++; + // fallthrough + + case 11: + i_this->field_0x616 = 1; + i_this->mHeadTilt = -6300; + i_this->mTailWagTarget = 1000.0f; + + if (i_this->field_0x658 > 30.0f) { + i_this->mMode++; + i_this->mTimer[0] = cM_rndF(10.0f) + 10.0f; + } + + if (i_this->mDistFromPlayer > 100.0f + l_HIO.mPlayerRecognitionDist) { + i_this->field_0x5f4 = 0; + i_this->mMode = 0; + } + break; + + case 12: + i_this->field_0x616 = 1; + i_this->mHeadTilt = -6300; + i_this->mTailWagTarget = 1500.0f; + + if (i_this->field_0x658 > 30.0f) { + if (i_this->mTimer[0] == 0) { + anm_init(i_this, ANM_DOWN, 3.0f, 0, 1.0f); + i_this->mMode = 13; + } + } else { + i_this->mMode = 11; + } + break; + + case 13: + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 1500.0f; + + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + } + break; + } + + cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); +} + +/* 80669050-8066973C 0013F0 06EC+00 2/1 0/0 0/0 .text do_walk__FP8do_class */ +static void do_walk(do_class* i_this) { + cXyz local_5c; + s16 angle_diff; + i_this->mTailWagTarget = 1000.0f; + + switch (i_this->mMode) { + case 11: + i_this->mTargetPos = i_this->home.pos; + if (i_this->speedF >= l_HIO.mRunSpeed) { + i_this->mAnmSpeed = 4.0f; + } else { + i_this->mAnmSpeed = 1.7f; + } + + i_this->mTargetAnmSpeed = 1.7f; + anm_init(i_this, ANM_WALK, 3.0f, 2, i_this->mAnmSpeed); + i_this->mMode = 3; + break; + + case -1: + if (i_this->field_0x5f4 == 8) { + anm_init(i_this, ANM_SIT, 5.0f, 0, 1.0f); + } else { + anm_init(i_this, ANM_DOWN, 5.0f, 0, 1.0f); + } + + i_this->mMode++; + break; + + case 0: + if (i_this->mpMorf->isStop()) { + i_this->mMode++; + } + break; + + case 1: + local_5c.x = 0.0f; + local_5c.y = 20.0f; + + for (int i = 0; i < 100; i++) { + cMtx_YrotS(*calc_mtx, cM_rndF(65536.0f)); + + local_5c.z = cM_rndF(100.0f * i_this->mParam2); + MtxPosition(&local_5c, &i_this->mTargetPos); + + i_this->mTargetPos += i_this->home.pos; + + if (dansa_check(i_this, i_this->mTargetPos, 100.0f) == 0) { + local_5c = i_this->mTargetPos - i_this->current.pos; + + if (local_5c.abs() > 300.0f) + break; + } + } + + i_this->mAnmSpeed = i_this->mTargetAnmSpeed = 1.3f + cM_rndF(0.6f); + anm_init(i_this, ANM_WALK, 5.0f, 2, i_this->mAnmSpeed); + i_this->mMode++; + + case 2: + local_5c = i_this->mTargetPos - i_this->current.pos; + + cLib_addCalcAngleS2(&i_this->current.angle.y, (s16)cM_atan2s(local_5c.x, local_5c.z), 0x10, + 0x100); + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, 1.0f, + l_HIO.mWalkSpeed * 0.2f); + + if (local_5c.abs() < 150.0f) { + if (i_this->mParam0 == 0) { + i_this->mAction = ACT_STAY; + i_this->mMode = 0; + } else { + anm_init(i_this, ANM_WAIT, 5.0f, 2, 1.0f); + i_this->mTimer[0] = cM_rndF(50.0f) + 20.0f; + i_this->mTargetAnmSpeed = 1.0f; + i_this->mMode++; + } + } + + break; + + case 3: + cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); + + if (i_this->mTimer[0] == 0) { + i_this->mMode = 2; + } + + break; + + case 9: + cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 4, 0x400); + + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 2000.0f; + + angle_diff = i_this->current.angle.y - i_this->mTargetAngleY; + + if (angle_diff < 0) { + angle_diff *= -1; + } + + if (angle_diff < 0x800) { + i_this->mMode++; + anm_init(i_this, ANM_WAIT, 5.0f, 2, 1.0f); + i_this->mTargetAnmSpeed = 1.0f; + i_this->mTimer[0] = cM_rndF(10.0f) + 10.0f; + } + + break; + + case 10: + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 3000.0f; + if (i_this->mTimer[0] == 0) { + i_this->mAction = ACT_WALK_RUN; + i_this->mMode = 0; + return; + } + break; + } + + cLib_addCalc2(&i_this->mAnmSpeed, i_this->mTargetAnmSpeed, 1.0f, 0.05f); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); + + if (i_this->mTimer[2] == 0 && i_this->mMode < 10 && + i_this->mDistFromPlayer < l_HIO.mPlayerRecognitionDist) + { + anm_init(i_this, ANM_STEP_2, 2.0f, 2, 3.0f); + i_this->mMode = 10; + } + + move_dansa_check(i_this, i_this->speedF); +} + +/* 8066973C-806698D0 001ADC 0194+00 1/1 0/0 0/0 .text do_walk_run__FP8do_class */ +static void do_walk_run(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 3000.0f; + + switch (i_this->mMode) { + case 0: + i_this->mAnmSpeed = 0.25f; + anm_init(i_this, 22, 10.0f, 2, i_this->mAnmSpeed); + i_this->mMode++; + // fallthrough + + case 1: + cLib_addCalc2(&i_this->mAnmSpeed, 2.0f, 1.0f, 0.05f); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); + + if (i_this->mAnmSpeed >= 2.0f) { + i_this->mAction = ACT_RUN; + i_this->mMode = 0; + i_this->mSound.startSound(Z2SE_DOG_BARK, 0, -1); + } + // fallthrough + + default: + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, + 1.0f, 0.2f * l_HIO.mWalkSpeed); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 8, 0x400); + + if (i_this->mDistFromPlayer < 160.0f * i_this->mScale.z) { + if (l_HIO.mWaitType != 0) { + i_this->mAction = ACT_WAIT_2; + } else { + i_this->mAction = ACT_WAIT_1; + } + i_this->mMode = 0; + } + + area_check(i_this); + move_dansa_check(i_this, i_this->speedF); + break; + } +} + +/* 806698D0-80669A1C 001C70 014C+00 1/1 0/0 0/0 .text do_run__FP8do_class */ +static void do_run(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 4000.0f; + + switch (i_this->mMode) { + case 0: + i_this->mAnmSpeed = 1.0f; + i_this->mTargetAnmSpeed = cM_rndF(0.1f) + 1.5f; + anm_init(i_this, 14, 2.0f, 2, 1.2f * i_this->mAnmSpeed); + i_this->mMode++; + // fallthrough + + case 1: + cLib_addCalc2(&i_this->mAnmSpeed, i_this->mTargetAnmSpeed, 1.0f, 0.02f); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); + + if (i_this->mDistFromPlayer < 320.0f * i_this->mScale.z) { + i_this->mAction = ACT_RUN_WALK; + i_this->mMode = 0; + } + // fallthrough + + default: + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mRunSpeed * 1.4f, + 1.0f, 0.2f * l_HIO.mRunSpeed); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 8, 0x800); + area_check(i_this); + move_dansa_check(i_this, i_this->speedF); + break; + } +} + +/* 80669A1C-80669B80 001DBC 0164+00 1/1 0/0 0/0 .text do_run_walk__FP8do_class */ +static void do_run_walk(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 3000.0f; + + switch (i_this->mMode) { + case 0: + i_this->mAnmSpeed = 4.0f; + anm_init(i_this, 22, 3.0f, 2, i_this->mAnmSpeed); + i_this->mMode++; + // fallthrough + + case 1: + cLib_addCalc2(&i_this->mAnmSpeed, 1.5f, 1.0f, 0.05f); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); + // fallthrough + + default: + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, 1.0f, 5.0f); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 8, 0x400); + + if (i_this->mDistFromPlayer < 160.0f * i_this->mScale.z) { + if (l_HIO.mWaitType != 0) { + i_this->mAction = ACT_WAIT_2; + } else { + i_this->mAction = ACT_WAIT_1; + } + i_this->mMode = 0; + } else { + if (i_this->mDistFromPlayer > 360.0f * i_this->mScale.z) { + i_this->mAction = ACT_RUN; + i_this->mMode = 0; + } + } + + area_check(i_this); + move_dansa_check(i_this, i_this->speedF); + } +} + +/* 80669B80-8066A1C4 001F20 0644+00 2/1 0/0 0/0 .text do_wait_1__FP8do_class */ +static void do_wait_1(do_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 2000.0f; + + s16 angle_diff = i_this->current.angle.y - i_this->mTargetAngleY; + + if (angle_diff < 0) { + angle_diff *= -1; + } + + s16 angle_check = 0x3000; + if ((i_this->mCounter & 0x7fU) == 0) { + angle_check = 0x1000; + } + + switch (i_this->mMode) { + case 0: + if (i_this->mDistFromPlayer > i_this->mScale.z * 320.0f) { + anm_init(i_this, ANM_JOYFUL, 5.0f, 2, cM_rndFX(0.1f) + 0.6f); + i_this->mMode = -1; + } else { + anm_init(i_this, ANM_WAIT, 10.0f, 2, 1.0f); + i_this->mMode++; + } + // fallthrough + + case -1: + case 1: +case1: + if (angle_diff > angle_check) { + anm_init(i_this, ANM_STEP_2, 2.0f, 2, 3.0f); + i_this->mMode = 2; + } else if (i_this->field_0x658 < 75.0f) { + i_this->mMode = 3; + i_this->mTimer[0] = cM_rndF(10.0f) + 10.0f; + } else { + if (i_this->mDistFromPlayer < i_this->mScale.z * 96.0f) { + cXyz local_68; + local_68.x = 0.0f; + local_68.y = 20.0f; + + for (int i = 0; i < 20; i++) { + if (i < 10) { + cMtx_YrotS(*calc_mtx, i_this->mTargetAngleY + (s16)cM_rndFX(5000.0f)); + } else { + cMtx_YrotS(*calc_mtx, cM_rndF(65536.0f)); + } + + local_68.z = -176.0f * i_this->mScale.z; + + MtxPosition(&local_68, &i_this->mTargetPos); + i_this->mTargetPos += player->current.pos; + + if (cM_rndF(1.0f) < 0.2f) + break; + + if (dansa_check(i_this, i_this->mTargetPos, 100.0f) == 0) + break; + + i_this->mLookPos = i_this->mTargetPos; + i_this->mLookTimer = 20.0f + cM_rndF(10.0f); + } + + i_this->mMode = 5; + i_this->mRandomTargetAngleY = cM_rndFX(10000.0f); + + anm_init(i_this, ANM_WALK, 2.0f, 2, -3.0f); + i_this->mTimer[0] = cM_rndF(10.0f) + 15.0f; + } else { + if (i_this->mMode != 6 && i_this->mDistFromPlayer < i_this->mScale.z * 120.0f) + { + anm_init(i_this, ANM_JOYFUL, 3.0f, 2, cM_rndFX(0.1f) + 1.0f); + i_this->mMode = 6; + } + } + } + break; + + case 2: + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 4, 0x400); + + if (angle_diff < 0x800) { + i_this->mMode = 0; + } + + break; + + case 3: + if (i_this->field_0x658 < 75.0f) { + if (i_this->mTimer[0] == 0) { + if (i_this->field_0x658 < 30.0f) { + i_this->mAction = ACT_STAY; + i_this->mMode = 10; + } else { + i_this->mAction = ACT_SIT; + i_this->mMode = 0; + } + } + } else { + i_this->mMode = 1; + } + break; + + case 5: + cLib_addCalcAngleS2(&i_this->current.angle.y, + i_this->mTargetAngleY + i_this->mRandomAngleY, 4, 0x800); + cLib_addCalcAngleS2(&i_this->mRandomAngleY, i_this->mRandomTargetAngleY, 4, 0x1000); + cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.2f, 3.5f); + cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.2f, 3.5f); + + if (i_this->mTimer[0] == 0) { + i_this->mMode = 0; + } + break; + + case 6: + i_this->mTailWagTarget = 4000.0f; + + if (i_this->mDistFromPlayer > i_this->mScale.z * 176.0f) { + i_this->mMode = 0; + } + goto case1; + + case 10: + i_this->mAnmSpeed = 5.0f; + anm_init(i_this, ANM_WALK, 2.0f, 2, i_this->mAnmSpeed); + + i_this->mMode++; + // fallthrough + + case 11: + cLib_addCalc2(&i_this->mAnmSpeed, 2.0f, 1.0f, 0.2f); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); + + if (i_this->mAnmSpeed <= 2.2f) { + i_this->mMode = 0; + } + + break; + } + + cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); + + if (i_this->mDistFromPlayer > i_this->mScale.z * 240.0f && !dansa_check2(i_this, 130.0f) && + i_this->mMode < 10) + { + i_this->mAction = ACT_WALK_RUN; + i_this->mAnmSpeed = 1.5f; + anm_init(i_this, ANM_WALK, 5.0f, 2, i_this->mAnmSpeed); + i_this->mMode = 1; + } + + if (daPy_getLinkPlayerActorClass()->checkCanoeRide() && i_this->mDistFromPlayer < 1000.0f) { + i_this->mAction = ACT_HELP; + i_this->mMode = 0; + } + + if (i_this->mParam0 == 2) { + f32 distance = i_this->mDistFromPlayer * 0.0215f; + + if (distance > 127.0f) { + distance = 127.0f; + } + + i_this->mSound.startLevelSound(Z2SE_DOG_V_CALL_HELP, (u8)distance, -1); + } +} + +/* 8066A1C4-8066A3D0 002564 020C+00 1/1 0/0 0/0 .text do_wait_2__FP8do_class */ +static void do_wait_2(do_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 4000.0f; + + switch (i_this->mMode) { + case 0: + i_this->mMode++; + // fallthrough + + case 1: + if (i_this->mTimer[0] == 0) { + i_this->mTimer[0] = cM_rndF(20.0f) + 10.0f; + i_this->mRandomTargetAngleY = cM_rndFX(15000.0f); + + if (cM_rndF(1.0f) < 0.5f) { + i_this->mAnmSpeed = cM_rndF(0.2f) + 2.0f; + } else { + i_this->mAnmSpeed = -(cM_rndF(0.2f) + 2.0f); + } + + anm_init(i_this, ANM_STEP, 3.0f, 2, i_this->mAnmSpeed); + cMtx_YrotS(*calc_mtx, player->shape_angle.y); + + cXyz local_38; + + local_38.x = cM_rndFX(100.0f); + local_38.y = 0.0f; + local_38.z = cM_rndF(50.0f) + 120.0f; + + MtxPosition(&local_38, &i_this->mTargetPos); + i_this->mTargetPos += player->current.pos; + } + + break; + } + + cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.2f, 2.0f); + cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.2f, 2.0f); + cLib_addCalc0(&i_this->speedF, 1.0f, 2.0f); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY + i_this->mRandomAngleY, + 4, 0x800); + cLib_addCalcAngleS2(&i_this->mRandomAngleY, i_this->mRandomTargetAngleY, 4, 0x1000); + + if (i_this->mDistFromPlayer > 240.0f * i_this->mScale.z) { + i_this->mAction = ACT_RUN; + i_this->mMode = 0; + } + + area_check(i_this); +} + +/* 8066A3D0-8066A5DC 002770 020C+00 1/1 0/0 0/0 .text do_sit__FP8do_class */ +static void do_sit(do_class* i_this) { + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 1000.0f; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_SIT_WAIT, 10.0f, 2, 1.0f); + i_this->mMode++; + // fallthrough + + case 1: + if (i_this->field_0x658 > 75.0f) { + i_this->mMode = 3; + i_this->mTimer[0] = cM_rndF(10.0f) + 10.0f; + } else { + if (i_this->field_0x658 < 30.0f) { + i_this->mMode = 2; + i_this->mTimer[0] = cM_rndF(10.0f) + 10.0f; + } + } + break; + + case 2: + if (i_this->field_0x658 < 30.0f) { + if (i_this->mTimer[0] == 0) { + i_this->mAction = ACT_STAY; + i_this->mMode = 10; + } + } else { + i_this->mMode = 1; + } + break; + + case 3: + if (i_this->field_0x658 > 75.0f) { + if (i_this->mTimer[0] == 0) { + anm_init(i_this, ANM_SIT, 3.0f, 0, 1.0f); + i_this->mMode++; + } + } else { + i_this->mMode = 1; + } + + break; + + case 4: + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + } + break; + } + + cLib_addCalc0(&i_this->speedF, 1.0f, 2.0f); + + if (i_this->mDistFromPlayer > 400.0f * i_this->mScale.z) { + i_this->mAction = ACT_STAY; + i_this->field_0x5f4 = 8; + i_this->mMode = 0; + } + + area_check(i_this); +} + +/* 8066A5DC-8066A80C 00297C 0230+00 1/1 0/0 0/0 .text hang_set__FP8do_class */ +static s16 hang_set(do_class* i_this) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + dBgS_LinChk lin_chk; + cXyz vec1, vec2, vec3[2]; + vec1 = _this->old.pos - _this->current.pos; + cMtx_YrotS(*calc_mtx, cM_atan2s(vec1.x, vec1.z)); + + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = -100.0f; + MtxPosition(&vec1, &vec2); + vec2 += _this->current.pos; + vec2.y = _this->old.pos.y - 5.0f; + + vec1.x = 10.0f; + vec1.y = 0.0f; + vec1.z = 250.0f; + + for (int i = 0; i < 2; i++) { + MtxPosition(&vec1, &vec3[i]); + vec1.x *= -1.0f; + vec3[i] += vec2; + lin_chk.Set(&vec2, &vec3[i], _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + vec3[i] = lin_chk.i_GetCross(); + } else { + return 0xDCF; + } + } + + i_this->mHangPos = vec3[0] + (vec3[1] - vec3[0]) * 0.5f; + i_this->mHangPos.y = _this->old.pos.y; + + vec1 = vec3[1] - vec3[0]; + return cM_atan2s(vec1.x, vec1.z) + 0x4000; +} + +/* 8066A80C-8066AB78 002BAC 036C+00 1/1 0/0 0/0 .text do_hang__FP8do_class */ +static void do_hang(do_class* i_this) { + i_this->mTailWagTarget = 3000.0f; + i_this->field_0x616 = 2; + cXyz vec1, vec2; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_CLIFF_WT, 3.0f, 2, 1.0f); + i_this->mMode++; + i_this->speedF = 0.0f; + i_this->mHangSpeed = 0.0f; + i_this->mTimer[0] = cM_rndF(30.0f) + 30.0f; + // fallthrough + + case 1: + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mHangAngleY, 1, 0x1000); + + if (i_this->mTimer[0] == 0) { + if (cM_rndF(1.0f) < 0.5f) { + i_this->speed.y = 0.0f; + i_this->mMode = 5; + i_this->mTimer[0] = 3; + anm_init(i_this, ANM_RUN, 5.0f, 2, 3.0f); + } else { + anm_init(i_this, ANM_CLIFF, 2.0f, 0, 1.0f); + i_this->mMode = 2; + } + } + + cMtx_YrotS(*calc_mtx, i_this->mHangAngleY); + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = i_this->mScale.z * 28.0f; + MtxPosition(&vec1, &vec2); + cLib_addCalc2(&i_this->current.pos.x, i_this->mHangPos.x + vec2.x, 1.0f, + i_this->mHangSpeed); + cLib_addCalc2(&i_this->current.pos.y, i_this->mHangPos.y + vec2.y, 1.0f, + i_this->mHangSpeed); + cLib_addCalc2(&i_this->current.pos.z, i_this->mHangPos.z + vec2.z, 1.0f, + i_this->mHangSpeed); + cLib_addCalc2(&i_this->mHangSpeed, 100.0f, 1.0f, 20.0f); + break; + + case 2: + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_STAY; + i_this->mMode = 13; + } + break; + + case 5: + cMtx_YrotS(*calc_mtx, i_this->mHangAngleY); + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = i_this->mScale.z * -60.0f; + MtxPosition(&vec1, &vec2); + cLib_addCalc2(&i_this->current.pos.x, i_this->mHangPos.x + vec2.x, 1.0f, 15.0f); + cLib_addCalc2(&i_this->current.pos.z, i_this->mHangPos.z + vec2.z, 1.0f, 15.0f); + i_this->current.pos.y += i_this->speed.y; + i_this->speed.y += i_this->gravity; + + if (i_this->mTimer[0] == 0) { + i_this->mBgS_Acch.CrrPos(dComIfG_Bgsp()); + if (i_this->mBgS_Acch.i_ChkGroundHit()) { + i_this->current.angle.x = 0; + anm_init(i_this, ANM_DOWN, 2.0f, 0, 2.0f); + i_this->mMode = 6; + } + } + break; + + case 6: + if (i_this->mpMorf->isStop()) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + } + break; + } +} + +/* 8066AB78-8066B650 002F18 0AD8+00 2/1 0/0 0/0 .text do_food__FP8do_class */ +static void do_food(do_class* i_this) { + fopAc_ac_c* food = fopAcM_SearchByID(i_this->mFoodActorID); + fopAc_ac_c* player = dComIfGp_getPlayer(0); + cXyz vec; + s16 angle_step; + + BOOL end = false; + if (food == NULL) { + end = true; + } + + if (i_this->mBgS_Acch.ChkWallHit()) { + i_this->mFoodEndTimer += 2; + if (i_this->mFoodEndTimer >= 60) { + end = true; + } + } else if (i_this->mFoodEndTimer != 0) { + i_this->mFoodEndTimer--; + } + + if (end) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + return; + } + + i_this->mTailWagTarget = 4000.0f; + + switch (i_this->mMode) { + case 0: + i_this->mMode++; + i_this->mTimer[1] = cM_rndF(10.0f) + 10.0f; + i_this->mTimer[0] = 0; + // fallthrough + + case 1: + i_this->speedF = 0.0f; + + if (i_this->mTimer[1] == 0) { + if (i_this->mTimer[0] == 0) { + if (cM_rndF(1.0f) < 0.5f) { + anm_init(i_this, ANM_JOYFUL, 3.0f, 2, 1.0f + cM_rndFX(0.1f)); + i_this->mMode = 2; + i_this->mTimer[0] = cM_rndF(20.0f) + 10.0f; + } else { + i_this->mTimer[0] = cM_rndF(20.0f) + 10.0f; + i_this->mRandomTargetAngleY = cM_rndFX(15000.0f); + i_this->mAnmSpeed = cM_rndF(0.2f) + 2.0f; + anm_init(i_this, ANM_STEP, 3.0f, 2, i_this->mAnmSpeed); + + cMtx_YrotS(*calc_mtx, player->shape_angle.y); + vec.x = cM_rndFX(100.0f); + vec.y = 0.0f; + vec.z = cM_rndF(50.0f) + 120.0f; + MtxPosition(&vec, &i_this->mTargetPos); + i_this->mTargetPos += player->current.pos; + } + } + + cLib_addCalc2(&i_this->current.pos.x, i_this->mTargetPos.x, 0.2f, 1.5f); + cLib_addCalc2(&i_this->current.pos.z, i_this->mTargetPos.z, 0.2f, 1.5f); + cLib_addCalcAngleS2(&i_this->current.angle.y, + i_this->mTargetAngleY + i_this->mRandomAngleY, 4, 0x800); + cLib_addCalcAngleS2(&i_this->mRandomAngleY, i_this->mRandomTargetAngleY, 4, 0x1000); + } + +case1and2: + i_this->field_0x616 = 1; + + if (fopAcM_CheckFoodStatus(food, fopAcM_FOOD_1)) { + i_this->mMode = 10; + i_this->mTimer[0] = cM_rndF(20.0f); + i_this->mTimer[2] = cM_rndF(50.0f) + 70.0f; + } else if (fopAcM_CheckFoodStatus(food, fopAcM_FOOD_0)) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + } else if (i_this->mDistFromPlayer > 240.0f * i_this->mScale.z) { + i_this->mAction = ACT_RUN; + i_this->mMode = 0; + } + break; + + case 2: + if (i_this->mTimer[0] == 0) { + i_this->mMode = 1; + } + goto case1and2; + + case 10: + if (i_this->mTimer[0] == 0) { + i_this->mAnmSpeed = 1.0f; + i_this->mTargetAnmSpeed = cM_rndF(0.1f) + 1.5f; + anm_init(i_this, ANM_RUN, 2.0f, 2, 1.2f * i_this->mAnmSpeed); + i_this->mMode++; + } else { + i_this->mLookPos = food->current.pos; + i_this->mLookTimer = 10; + break; + } + // fallthrough + + case 11: + i_this->mLookPos = food->current.pos; + i_this->mLookTimer = 10; + + cLib_addCalc2(&i_this->mAnmSpeed, i_this->mTargetAnmSpeed, 1.0f, 0.02f); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mRunSpeed, 1.0f, + 0.2f * l_HIO.mRunSpeed); + + vec = food->current.pos - i_this->current.pos; + angle_step = 0x1000; + if (vec.abs() < 120.0f * i_this->mScale.z) { + angle_step = 0x2000; + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mRunSpeed * 0.75f, 1.0f, + 0.2f * l_HIO.mRunSpeed * 1.5f); + } + cLib_addCalcAngleS2(&i_this->current.angle.y, cM_atan2s(vec.x, vec.z), 8, angle_step); + + if (fopAcM_CheckFoodStatus(food, fopAcM_FOOD_2) + || fopAcM_CheckFoodStatus(food, fopAcM_FOOD_3) + || fopAcM_CheckFoodStatus(food, fopAcM_FOOD_4)) + { + i_this->mMode = 25; + i_this->mTimer[0] = cM_rndF(20.0f) + 5.0f; + } else if (vec.abs() < 50.0f * i_this->mScale.z) { + bool get_item = false; + if (i_this->mDistFromPlayer > 400.0f + && !strcmp(dComIfGp_getStartStageName(), "F_SP116")) + { + if (fopAcM_GetRoomNo(i_this) == 4) { + if (i_this->current.pos.z < -1050.f) { + get_item = true; + } + } else if (fopAcM_GetRoomNo(i_this) == 2) { + vec.x = -4314.0f - i_this->current.pos.x; + vec.z = 728.0f - i_this->current.pos.z; + if (JMAFastSqrt(vec.x * vec.x + vec.z * vec.z) < 300.0f) { + get_item = true; + } + } + } + + if (get_item) { + int item_no; + if (dComIfGs_getLife() <= 4) { + item_no = HEART; + } else { + int rnd = cM_rndF(11.0f); + if (rnd <= 5) { + item_no = HEART; + } else if (rnd <= 9) { + item_no = GREEN_RUPEE; + } else { + item_no = BLUE_RUPEE; + } + } + + i_this->mItemActorID = + fopAcM_createItem(&i_this->eyePos, item_no, -1, -1, NULL, NULL, 0); + i_this->mMode = 25; + i_this->mTimer[0] = cM_rndF(10.0f) + 5.0f; + } else { + i_this->mMode = 20; + i_this->mFoodInMouth = 1; + i_this->mAnmSpeed = 4.0f; + anm_init(i_this, ANM_JOYFUL, 3.0f, 2, 0.3f); + } + } + break; + + case 20: + i_this->mLookPos = player->current.pos; + i_this->mLookTimer = 10; + cLib_addCalc2(&i_this->mAnmSpeed, 1.5f, 1.0f, 0.2f); + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, 1.0f, 5.0f); + + if (i_this->mAnmSpeed <= 1.6f) { + i_this->mTargetAnmSpeed = cM_rndF(0.1f) + 1.5f; + anm_init(i_this, ANM_RUN, 2.0f, 2, 1.2f * i_this->mAnmSpeed); + i_this->mMode++; + } + + i_this->mFoodInMouth = 1; + break; + + case 21: + i_this->field_0x616 = 1; + cLib_addCalc2(&i_this->mAnmSpeed, i_this->mTargetAnmSpeed, 1.0f, 0.02f); + i_this->mpMorf->setPlaySpeed(i_this->mAnmSpeed); + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mRunSpeed, 1.0f, + 0.2f * l_HIO.mRunSpeed); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 8, 0x1000); + i_this->mFoodInMouth = 1; + + if (i_this->mDistFromPlayer < 120.0f * i_this->mScale.z) { + i_this->mAction = ACT_RUN_WALK; + i_this->mMode = 0; + food->speedF = 0.0f; + } + break; + + case 25: + if (i_this->mTimer[0] != 0) { + if (i_this->mTimer[0] == 1) { + i_this->mAnmSpeed = cM_rndFX(1.0f) + 3.0f; + anm_init(i_this, ANM_JOYFUL, 3.0f, 2, 0.3f); + } + } else { + i_this->mLookPos = player->current.pos; + i_this->mLookTimer = 10; + cLib_addCalc2(&i_this->mAnmSpeed, 1.5f, 1.0f, 0.1f); + cLib_addCalc2(&i_this->speedF, i_this->mAnmSpeed * l_HIO.mWalkSpeed, 1.0f, 5.0f); + + if (i_this->mAnmSpeed <= 1.6f) { + i_this->mAction = ACT_RUN; + i_this->mMode = 0; + } + } + break; + } +} + +/* 8066B650-8066B774 0039F0 0124+00 1/1 0/0 0/0 .text do_swim__FP8do_class */ +static void do_swim(do_class* i_this) { + cXyz pos; + i_this->field_0x616 = 1; + i_this->mTailWagTarget = 2000.0f; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, 19, 5.0f, 2, cM_rndF(0.15f) + 1.3f); + i_this->mMode++; + break; + + case 1: + break; + } + + cLib_addCalc2(&i_this->speedF, l_HIO.mSwimSpeed, 1.0f, 0.5f * l_HIO.mSwimSpeed); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 16, 0x100); + + i_this->speed.y = 0.0f; + i_this->gravity = 0.0f; + + cLib_addCalc2(&i_this->current.pos.y, i_this->mWaterY - 45.0f, 1.0f, 5.0f); + + pos = i_this->eyePos; + pos.y = i_this->mWaterY; + + fopAcM_effHamonSet(&i_this->mRippleKey, &pos, 0.7f, 0.1f); +} + +/* 8066B774-8066B7C0 003B14 004C+00 2/2 0/0 0/0 .text s_c_sub__FPvPv */ +static void* s_c_sub(void* param_0, void* param_1) { + if (fopAcM_IsActor(param_0) && fopAcM_GetName(param_0) == PROC_CANOE) { + return param_0; + } + return 0; +} + +/* 8066B7C0-8066BD3C 003B60 057C+00 1/1 0/0 0/0 .text do_help__FP8do_class */ +static void do_help(do_class* i_this) { + f32 target_speed = 0.0f; + i_this->field_0x616 = 1; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_WALK, 3.0f, 2, 2.0f); + i_this->mMode++; + break; + + case 1: + target_speed = 5.0f; + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 2, 0x800); + if (dansa_check2(i_this, 50.0f)) { + anm_init(i_this, ANM_WAIT, 5.0f, 2, 1.0f); + i_this->mMode++; + } + break; + + case 2: + if (i_this->mDistFromPlayer < 800.0f) { + i_this->mTailWagTarget = 1000.0f; + } + if (i_this->mDistFromPlayer < 500.0f) { + i_this->mMode++; + anm_init(i_this, ANM_JOYFUL, 3.0f, 2, 1.0f); + } + break; + + case 3: + i_this->mTailWagTarget = 2000.0f; + if (i_this->mDistFromPlayer > 550.0f) { + anm_init(i_this, ANM_WAIT, 5.0f, 2, 1.0f); + i_this->mMode = 2; + } + + if (i_this->mTimer[2] == 0 && daPy_getLinkPlayerActorClass()->checkCanoeRide()) { + cXyz vec1, vec2, vec3; + daCanoe_c* canoe = (daCanoe_c*)fpcM_Search(s_c_sub, i_this); + if (canoe != NULL) { + vec3 = i_this->field_0x68c; + MTXCopy(canoe->getModelMtx(), *calc_mtx); + vec1.set(0.0f, 52.0f, 150.0f); + MtxPosition(&vec1, &i_this->field_0x68c); + i_this->mLookPos = i_this->field_0x68c; + i_this->mLookTimer = 20; + vec2 = i_this->field_0x68c - i_this->current.pos; + vec2.y = 0.0f; + if ((i_this->field_0x68c - vec3).abs() <= 5.0f && vec2.abs() < 230.0f) { + i_this->mParam0 = 0; + i_this->mAction = ACT_BOAT; + i_this->mMode = 0; + anm_init(i_this, ANM_DEFEND, 10.0f, 0, 1.0f); + i_this->mTimer[0] = 20; + } + } + i_this->mTargetAngleY = cM_atan2s(vec2.x, vec2.z); + } + + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 4, 0x400); + break; + } + + cLib_addCalc2(&i_this->speedF, target_speed, 1.0f, 2.0f); + + if (!daPy_getLinkPlayerActorClass()->checkCanoeRide() && i_this->mDistFromPlayer < 200.0f) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + } + + if (i_this->mParam0 == 2) { + f32 fvar2 = i_this->mDistFromPlayer * 0.0215f; + if (fvar2 > 127.0f) { + fvar2 = 127.0f; + } + i_this->mSound.startLevelSound(Z2SE_DOG_V_CALL_HELP, (u8)fvar2, -1); + } +} + +/* 8066BD3C-8066C894 0040DC 0B58+00 2/1 0/0 0/0 .text do_boat__FP8do_class */ +static s8 do_boat(do_class* i_this) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + s8 ret = 1; + i_this->mCcDisableTimer = 10; + f32 fvar3; + + daCanoe_c* canoe = (daCanoe_c*)fpcM_Search(s_c_sub, i_this); + if (canoe == NULL) { + return 1; + } + + cXyz vec1, vec2; + s16 canoe_angle = canoe->shape_angle.y; + vec2 = i_this->field_0x68c; + MTXCopy(canoe->getModelMtx(), *calc_mtx); + vec1.set(0.0f, 52.0f, 150.0f); + MtxPosition(&vec1, &i_this->field_0x68c); + f32 fvar4 = (i_this->field_0x68c - vec2).abs(); + if (!daPy_getLinkPlayerActorClass()->checkCanoeRide() && (i_this->mCounter & 0x200) != 0) { + fvar4 = 5.0f; + } + s8 bvar2 = false; + + switch (i_this->mMode) { + case 0: + if (daDo_other_bg_check2(i_this, &i_this->field_0x68c)) { + i_this->mAction = ACT_HELP; + i_this->mMode = 0; + _this->speedF = 0.0f; + i_this->mTimer[2] = 50; + break; + } + + if (i_this->mTimer[0] == 2) { + anm_init(i_this, ANM_RUN, 2.0f, 0, 2.0f); + } + + if (i_this->mTimer[0] != 0) { + break; + } + + i_this->mMode++; + _this->speed.y = 30.0f; + _this->speedF = 0.0f; + i_this->mSound.startSound(Z2SE_DOG_V_JUMP, 0, -1); + i_this->mTimer[1] = 7; + // fallthrough + + case 1: + if (i_this->mTimer[1] != 0) { + ret = 0; + } + + vec1 = i_this->field_0x68c - _this->current.pos; + fvar3 = vec1.abs(); + cMtx_YrotS(*calc_mtx, cM_atan2s(vec1.x, vec1.z)); + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = fvar3 * 0.075f + 10.0f; + MtxPosition(&vec1, &i_this->field_0x698); + + cLib_addCalc2(&i_this->current.pos.x, i_this->field_0x68c.x, 1.0f, + fabsf(i_this->field_0x698.x) + 2.0f); + cLib_addCalc2(&i_this->current.pos.z, i_this->field_0x68c.z, 1.0f, + fabsf(i_this->field_0x698.z) + 2.0f); + + if (_this->speed.y <= -80.0f) { + _this->speed.y = -80.0f; + } + + if (_this->current.pos.y <= i_this->field_0x68c.y) { + _this->current.pos.y = i_this->field_0x68c.y; + _this->speed.y = 0.0f; + } + + if ((i_this->field_0x68c - _this->current.pos).abs() <= 5.0f) { + i_this->mMode = 2; + anm_init(i_this, ANM_STEP_2, 3.0f, 2, 3.0f); + } else { + break; + } + // fallthrough + + case 2: + ret = 0; + + i_this->field_0x616 = 1; + _this->speed.y = 0.0f; + _this->gravity = 0.0f; + _this->current.pos = i_this->field_0x68c; + cLib_addCalcAngleS2(&_this->current.angle.y, i_this->mTargetAngleY, 2, 0x800); + _this->current.angle.x = 2700; + + if (i_this->mAnmID == ANM_STEP_2) { + s16 angle = i_this->mTargetAngleY - _this->current.angle.y; + if (angle < 0x800 && angle > -0x800) { + anm_init(i_this, ANM_JOYFUL, 3.0f, 2, 1.0f); + } + } else if (i_this->mAnmID == ANM_JOYFUL && fvar4 > 3.0f) { + i_this->mMode = 3; + anm_init(i_this, ANM_STEP_2, 3.0f, 2, 4.0f); + } + break; + + case 3: + ret = 0; + + if (i_this->mTimer[0] == 0) { + i_this->mTimer[0] = cM_rndF(70.0f) + 50.0f; + cMtx_YrotS(*calc_mtx, _this->shape_angle.y); + vec1.x = cM_rndFX(2000.0f); + vec1.y = cM_rndF(50.0f) + 50.0f; + vec1.z = 2000.0f; + MtxPosition(&vec1, &i_this->mLookPos); + i_this->mLookPos += _this->current.pos; + } + + i_this->mLookTimer = 2; + _this->speed.y = 0.0f; + _this->gravity = 0.0f; + _this->current.pos = i_this->field_0x68c; + cLib_addCalcAngleS2(&_this->current.angle.y, canoe_angle, 2, 0x800); + _this->current.angle.x = -2700; + + if (i_this->mAnmID == ANM_STEP_2) { + s16 angle = canoe_angle - _this->current.angle.y; + if (angle < 0x800 && angle > -0x800) { + anm_init(i_this, ANM_WAIT, 3.0f, 2, 1.0f); + } + } else if (i_this->mAnmID == ANM_WAIT && fvar4 < 10.0f) { + bvar2 = 1; + if (fvar4 < 1.0f) { + i_this->mMode = 2; + anm_init(i_this, ANM_STEP_2, 3.0f, 2, 4.0f); + } + } + break; + + case 5: + anm_init(i_this, ANM_DEFEND, 10.0f, 0, 1.0f); + i_this->mTimer[0] = 20; + i_this->mMode++; + // fallthrough + + case 6: + ret = 0; + i_this->mLookPos = i_this->mTargetPos; + i_this->mLookTimer = 2; + _this->speed.y = 0.0f; + _this->gravity = 0.0f; + _this->current.pos = i_this->field_0x68c; + vec1 = i_this->mTargetPos - _this->current.pos; + cLib_addCalcAngleS2(&_this->current.angle.y, cM_atan2s(vec1.x, vec1.z), 2, 0x800); + + if (i_this->mTimer[0] == 2) { + anm_init(i_this, ANM_RUN, 2.0f, 0, 2.0f); + } + + if (i_this->mTimer[0] == 0) { + i_this->mMode++; + _this->speed.y = 30.0f; + _this->speedF = 30.0f; + _this->current.angle.x = 0; + i_this->mSound.startSound(Z2SE_DOG_V_JUMP, 0, -1); + } + break; + + case 7: + if (i_this->mBgS_Acch.i_ChkGroundHit()) { + i_this->mAction = ACT_HELP; + i_this->mMode = 0; + _this->speedF = 0.0f; + i_this->mTimer[2] = 100; + } + break; + } + + if (bvar2) { + i_this->field_0xc84 = _this->current.pos; + i_this->field_0xc84.y += 40.0f; + cMtx_YrotS(*calc_mtx, canoe->shape_angle.y); + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = 250.0f; + MtxPosition(&vec1, &i_this->field_0xc90); + i_this->field_0xc90 += i_this->field_0xc84; + i_this->field_0xc9c = i_this->field_0xc90; + i_this->field_0xc9c.y += -100.0f; + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = 180.0f; + MtxPosition(&vec1, &i_this->field_0xca8); + i_this->field_0xca8 += i_this->field_0xc84; + i_this->field_0xcb4 = i_this->field_0xca8; + i_this->field_0xcb4.y += -100.0f; + + dBgS_LinChk lin_chk; + lin_chk.Set(&i_this->field_0xc84, &i_this->field_0xc90, _this); + i_this->field_0xc80 = true; + if (!dComIfG_Bgsp().LineCross(&lin_chk)) { + lin_chk.Set(&i_this->field_0xca8, &i_this->field_0xcb4, _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + lin_chk.Set(&i_this->field_0xc90, &i_this->field_0xc9c, _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + i_this->field_0xc80 = false; + i_this->mTargetPos = lin_chk.i_GetCross(); + i_this->mMode = 5; + } + } + } + } + + return ret; +} + +/* 8066C894-8066CAA8 004C34 0214+00 1/1 0/0 0/0 .text do_a_swim__FP8do_class */ +static void do_a_swim(do_class* i_this) { + i_this->mTailWagTarget = 2000.0f; + cLib_addCalc0(&i_this->speedF, 1.0f, 1.0f); + JPABaseEmitter* emitter; + + switch (i_this->mMode) { + case 0: + if (l_HIO.mWaterHuntAnimType == 1) { + anm_init(i_this, ANM_JOYFUL, 5.0f, 2, 1.0f); + } else { + anm_init(i_this, ANM_BULBUL, 5.0f, 2, 1.0f); + } + + i_this->mMode = 1; + i_this->mTimer[0] = 20; + + emitter = dComIfGp_particle_set(0x2a3, &i_this->current.pos, 0, 0); + + if (emitter) { + emitter->setGlobalRTMatrix(i_this->mpMorf->getModel()->getAnmMtx(2)); + cXyz _pos(0.6f, 0.6f, 0.6f); + JGeometry::TVec3<f32> pos; + JGeometry::setTVec3f(&_pos.x, &pos.x); + emitter->setGlobalScale(pos); + } + // fallthrough + + case 1: + if (i_this->mTimer[0] == 0) { + i_this->mMode = 2; + i_this->mShakeSpeed = 0.1f; + i_this->mShakeTargetSpeed = 1.0f; + } + break; + + case 2: + if (l_HIO.mWaterHuntAnimType == 1) { + i_this->mpMorf->setPlaySpeed(i_this->mShakeSpeed * 5.0f); + } else { + i_this->mpMorf->setPlaySpeed(i_this->mShakeSpeed * 5.0f); + } + + if (i_this->mShakeSpeed <= 0.025f) { + i_this->mShakeSpeed = 0.0f; + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + } + break; + } +} + +/* 8066CAA8-8066CDEC 004E48 0344+00 1/1 0/0 0/0 .text do_carry__FP8do_class */ +static s8 do_carry(do_class* i_this) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + s8 ret = 0; + i_this->mCcDisableTimer = 5; + _this->speed.y = 0.0f; + _this->speedF = 0.0f; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_TO_CARRY_B, 1.0f, 0, + daPy_getLinkPlayerActorClass()->getBaseAnimeFrameRate()); + i_this->mpMorf->setFrame(daPy_getLinkPlayerActorClass()->getBaseAnimeFrame()); + i_this->mTimer[0] = 20; + i_this->mMode++; + break; + + case 1: + if (i_this->mpMorf->checkFrame(10.0f)) { + i_this->mSound.startSound(Z2SE_DOG_CARRIED, 0, -1); + } + + if (daPy_getLinkPlayerActorClass()->getGrabPutStart()) { + anm_init(i_this, ANM_TO_CARRY_B, 1.0f, 0, + daPy_getLinkPlayerActorClass()->getBaseAnimeFrameRate()); + i_this->mpMorf->setFrame(daPy_getLinkPlayerActorClass()->getBaseAnimeFrame()); + i_this->mMode++; + } + break; + } + + if (!fopAcM_checkCarryNow(_this)) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + + dBgS_GndChk gnd_chk; + cXyz vec = _this->current.pos; + vec.y += 50.0f; + gnd_chk.SetPos(&vec); + if (fabsf(_this->current.pos.y - dComIfG_Bgsp().GroundCross(&gnd_chk)) < 30.0f) { + _this->current.pos.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + _this->gravity = 0.0f; + } + } + + i_this->mTailWagTarget = 1000.0f; + _this->speedF = 0.0f; + + if (i_this->mTimer[0] != 0) { + ret = 1; + _this->speed.y = -0.1f; + } else { + _this->speed.y = 0.0f; + } + + fopAc_ac_c* player = dComIfGp_getPlayer(0); + dBgS_LinChk lin_chk; + cXyz vec = _this->current.pos; + vec.y += 2.0f; + lin_chk.Set(&player->eyePos, &vec, _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + _this->current.pos = lin_chk.i_GetCross(); + } + + return ret; +} + +/* 8066CDEC-8066CEC4 00518C 00D8+00 1/1 0/0 0/0 .text do_message__FP8do_class */ +static void do_message(do_class* i_this) { + i_this->mTailWagTarget = 2000.0f; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, 21, 5.0f, 2, 1.0f); + i_this->mMode++; + break; + + case 1: + break; + } + + cLib_addCalc0(&i_this->speedF, 1.0f, 2.0f); + i_this->field_0x616 = 1; + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 2, 0x1000); + + if (!dComIfGp_event_runCheck() && i_this->mDistFromPlayer > 400.0f) { + i_this->mAction = ACT_STAY; + i_this->mMode = 0; + } +} + +/* 8066CEC4-8066DD48 005264 0E84+00 2/1 0/0 0/0 .text action__FP8do_class */ +static void action(do_class* i_this) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + cXyz vec1, vec2; + daPy_py_c* player = static_cast<daPy_py_c*>(dComIfGp_getPlayer(0)); + + _this->gravity = -7.0f; + + i_this->mDistFromPlayer = fopAcM_searchPlayerDistance(_this); + if (daPy_getPlayerActorClass()->checkHorseRide()) { + i_this->mDistFromPlayer -= 100.0f; + } + + i_this->mTargetAngleY = fopAcM_searchPlayerAngleY(_this); + + i_this->field_0x658 = fabsf(player->eyePos.y - player->current.pos.y); + if (!mDoCPd_c::getHoldR(PAD_1) || fabsf(_this->current.pos.y - player->current.pos.y) > 50.0f) { + i_this->field_0x658 = 300.0f; + } + i_this->field_0x658 *= 0.6f; + + s8 ground_check = 1; + s8 carry_check = 1; + s8 swim_check = 1; + + i_this->mCcSph.OnCoSetBit(); + + if (i_this->field_0x608 < 1.0f) { + i_this->mMessageState = 0; + + switch (i_this->mAction) { + case ACT_STAY: + do_stay(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_WALK: + do_walk(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_WALK_RUN: + do_walk_run(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_RUN: + do_run(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_RUN_WALK: + do_run_walk(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_FOOD: + do_food(i_this); + i_this->mMessageState = 1; + break; + case ACT_WAIT_1: + do_wait_1(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_WAIT_2: + do_wait_2(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_SIT: + do_sit(i_this); + food_check(i_this); + i_this->mMessageState = 1; + break; + case ACT_A_SWIM: + do_a_swim(i_this); + break; + case ACT_SWIM: + do_swim(i_this); + swim_check = 0; + fopAcM_riverStream(&_this->current.pos, &i_this->field_0x6b0, &i_this->field_0x6b4, + 0.5f); + break; + case ACT_HELP: + do_help(i_this); + break; + case ACT_BOAT: + ground_check = do_boat(i_this); + break; + case ACT_HANG: + do_hang(i_this); + break; + case ACT_CARRY: + ground_check = do_carry(i_this); + i_this->mCcSph.OffCoSetBit(); + carry_check = 0; + break; + case ACT_MESSAGE: + do_message(i_this); + i_this->mMessageState = 2; + } + } + + if (i_this->mItemActorID != -1 && i_this->mDistFromPlayer < 160.0f * i_this->mScale.z) { + daItem_c* item = static_cast<daItem_c*>(fopAcM_SearchByID(i_this->mItemActorID)); + + if (item) { + item->endControl(); + } + + i_this->mItemControlTimer = 0; + i_this->mItemActorID = -1; + } + + if (i_this->mRunningSoundTimer != 0) { + i_this->mRunningSoundTimer--; + if (i_this->mRunningSoundTimer == 0) { + i_this->mSound.startSound(Z2SE_M007_DOG_COME_RUNNING, 0, -1); + } + } + + if (i_this->mMessageState == 1 && daPy_py_c::i_checkNowWolf() + && i_this->mDistFromPlayer < 300.0f) + { + i_this->mAction = ACT_MESSAGE; + i_this->mMode = 0; + } + + if (carry_check && player->speedF < 2.0f) { + cLib_onBit<u32>(_this->attention_info.flags, 0x10); + + if (do_carry_check(i_this)) { + return; + } + } else { + cLib_offBit<u32>(_this->attention_info.flags, 0x10); + } + + cLib_addCalcAngleS2(&_this->current.angle.x, 0, 1, 0x400); + + if (i_this->mAction != ACT_HANG) { + cMtx_YrotS(*calc_mtx, _this->current.angle.y); + + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = _this->speedF * 0.8f * i_this->mScale.z * l_HIO.mBaseSize; + + MtxPosition(&vec1, &vec2); + + _this->speed.x = vec2.x; + _this->speed.z = vec2.z; + _this->speed.y += _this->gravity; + + _this->current.pos += _this->speed; + + if (_this->speed.y < -80.0f) { + _this->speed.y = -80.0f; + } + + if (!fopAcM_checkCarryNow(_this)) { + cXyz* cc_move = i_this->mStts.GetCCMoveP(); + if (cc_move != NULL) { + _this->current.pos.x += 0.3f * cc_move->x; + _this->current.pos.z += 0.3f * cc_move->z; + } + } + + if (i_this->field_0x608 > 1.0f) { + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = -i_this->field_0x608; + + cMtx_YrotS(*calc_mtx, i_this->field_0x60c); + MtxPosition(&vec1, &vec2); + + _this->current.pos += vec2; + cLib_addCalc0(&i_this->field_0x608, 1.0f, 6.0f); + + _this->speedF = 0.0f; + ground_check = 1; + } + + if (ground_check) { + i_this->mBgS_AcchCir.SetWall(30.0f, + fabsf(_this->speedF) + fabsf(i_this->field_0x608) + 30.0f); + i_this->mBgS_Acch.CrrPos(dComIfG_Bgsp()); + + if (i_this->mBgS_Acch.ChkGroundHit() && !noFallCheck && !fopAcM_checkCarryNow(_this)) + { + dBgS_GndChk gnd_chk; + + cMtx_YrotS(*calc_mtx, _this->shape_angle.y); + + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = -25.0f * i_this->mScale.z; + + MtxPosition(&vec1, &vec2); + vec2 += _this->current.pos; + + Vec pos; + pos.x = vec2.x; + pos.y = vec2.y + 100.0f; + pos.z = vec2.z; + + gnd_chk.SetPos(&pos); + vec2.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + + vec1 = vec2 - _this->current.pos; + + if (fabsf(vec1.y) < 50.0f) { + _this->current.angle.x = + cM_atan2s(vec1.y, JMAFastSqrt(vec1.x * vec1.x + vec1.z * vec1.z)); + } + } + } + } else { + if (i_this->field_0x608 < 1.0f && dansa_check(i_this, _this->current.pos, 100.0f) > 0) { + i_this->mHangAngleY = hang_set(i_this); + + if (i_this->mHangAngleY != 0xdcf) { + i_this->mAction = ACT_HANG; + i_this->mMode = 0; + i_this->mASwimTimer = 0; + } + } + } + + water_check(i_this); + + if (swim_check) { + if (i_this->mAction != ACT_CARRY) { + if (i_this->mASwimTimer != 0) { + i_this->mASwimTimer--; + if (i_this->mASwimTimer == 0) { + i_this->mAction = ACT_A_SWIM; + i_this->mMode = 0; + } + } + + if (i_this->mWaterY - _this->current.pos.y > 45.0f) { + i_this->mAction = ACT_SWIM; + i_this->mMode = 0; + i_this->field_0x608 = 0.0f; + + if (i_this->mSwimEffectTimer == 0) { + i_this->mSwimEffectTimer = 20; + cXyz pos = _this->current.pos; + pos.y = i_this->mWaterY; + + static cXyz scc(0.7f, 0.7f, 0.7f); + static u16 w_eff_id[4] = {0x1B8, 0x1B9, 0x1BA, 0x1BB}; + + for (int i = 0; i < 4; i++) { + i_this->mParticleKey[i] = + dComIfGp_particle_set(i_this->mParticleKey[i], w_eff_id[i], &pos, + &_this->tevStr, NULL, &scc, 0xff, NULL, -1, + NULL, NULL, NULL); + } + + i_this->mSound.startSound(Z2SE_CM_BODYFALL_WATER_S, 0, -1); + } + } + } + } else { + i_this->mASwimTimer = cM_rndF(25.0f) + 30.0f; + + if (i_this->mWaterY - _this->current.pos.y < 35.0f) { + i_this->mAction = ACT_WAIT_1; + i_this->mMode = 0; + } + } + + cLib_addCalcAngleS2(&_this->shape_angle.y, _this->current.angle.y, 2, 0x2000); + cLib_addCalcAngleS2(&_this->shape_angle.x, _this->current.angle.x, 4, 0x1000); + _this->shape_angle.z = _this->current.angle.z; + + s16 head_angle_y = 0; + s16 head_angle_x = 0; + + if (i_this->field_0x616 != 0 || i_this->mLookTimer != 0) { + if (i_this->field_0x616 == 2) { + if (i_this->mCounter & 8) { + head_angle_y = 10000; + } else { + head_angle_y = -10000; + } + } else { + if (i_this->mLookTimer != 0) { + i_this->mLookTimer--; + vec1 = i_this->mLookPos - _this->eyePos; + } else { + vec1 = player->eyePos - _this->eyePos; + } + + vec1.y += i_this->mScale.z * -16.0f; + + head_angle_y = cM_atan2s(vec1.x, vec1.z) - _this->shape_angle.y; + head_angle_x = _this->shape_angle.x + + cM_atan2s(vec1.y, JMAFastSqrt(vec1.x * vec1.x + vec1.z * vec1.z)); + + if (i_this->mLookTimer == 0 && (head_angle_y > 24000 || head_angle_y < -24000)) { + head_angle_y = 0; + } + + if (head_angle_y > 12000) { + head_angle_y = 12000; + } else if (head_angle_y < -12000) { + head_angle_y = -12000; + } + + if (head_angle_x > 12000) { + head_angle_x = 12000; + } else if (head_angle_x < -12000) { + head_angle_x = -12000; + } + + head_angle_y += i_this->mHeadTilt; + } + + i_this->field_0x616 = 0; + } + + cLib_addCalcAngleS2(&i_this->mHeadAngle.y, head_angle_y / 2, 4, 0x2000); + cLib_addCalcAngleS2(&i_this->mHeadAngle.x, head_angle_x / 2, 4, 0x2000); + cLib_addCalcAngleS2(&i_this->mHeadTilt, 0, 2, 0x300); + cLib_addCalcAngleS2(&i_this->mHeadBob.y, i_this->mHeadBobTarget.y, 4, 0x400); + cLib_addCalcAngleS2(&i_this->mHeadBob.z, i_this->mHeadBobTarget.z, 4, 0x400); + + if (fabsf(player->speedF) < 2.0f && fabsf(_this->speedF) < 2.0f) { + if (i_this->mHeadBobTimer != 0) { + i_this->mHeadBobTimer--; + if (i_this->mHeadBobTimer == 0) { + i_this->mHeadBobTimer = cM_rndF(100.0f) + 20.0f; + + if (cM_rndF(1.0f) < 0.5f) { + i_this->mHeadBobTarget.y = cM_rndFX(2000.0f); + } + + if (cM_rndF(1.0f) < 0.5f) { + i_this->mHeadBobTarget.z = cM_rndFX(2000.0f); + } + } + } + } else { + i_this->mHeadBobTarget.z = 0; + i_this->mHeadBobTarget.y = 0; + i_this->mHeadBobTimer = cM_rndF(60.0f) + 80.0f; + } + + if (i_this->mShakeSpeed >= 0.025f) { + if (l_HIO.mWaterHuntAnimType != 0) { + f32 fvar17 = i_this->mShakeSpeed * 3000.0f; + i_this->mHeadAngle.y = fvar17 * cM_ssin(i_this->mCounter * 22000) * 0.5f; + i_this->mHeadAngle.z = fvar17 * cM_ssin(i_this->mCounter * 25000); + } else { + i_this->mHeadAngle.z = 0; + i_this->mHeadAngle.y = 0; + } + } + + cLib_addCalc2(&i_this->mShakeSpeed, i_this->mShakeTargetSpeed, 1.0f, 0.15f); + cLib_addCalc0(&i_this->mShakeTargetSpeed, 1.0f, 0.04f); + + i_this->mTailAngle.y = i_this->mTailWag * cM_ssin(i_this->mTailPhaseY); + i_this->mTailAngle.x = i_this->mTailWag * cM_ssin(i_this->mTailPhaseX) * 0.5f; + + i_this->mTailPhaseY += i_this->mTailWag * 2.0f; + if (i_this->mTailPhaseY > 65536.0f) { + i_this->mTailPhaseY -= 65536.0f; + } + + i_this->mTailPhaseX += i_this->mTailWag * 1.5f; + if (i_this->mTailPhaseX > 65536.0f) { + i_this->mTailPhaseX -= 65536.0f; + } + + cLib_addCalc2(&i_this->mTailWag, i_this->mTailWagTarget, 1.0f, 100.0f); + i_this->mTailWagTarget = 0.0f; + + if (i_this->mBtpReset != 0) { + cLib_addCalcAngleS2(&i_this->mBtpFrame, 3, 1, 1); + i_this->mBtpReset = 0; + i_this->mBtpTimer = 60; + } else { + if (i_this->mBtpTimer == 0) { + i_this->mBtpTimer = cM_rndF(100.0f) + 30.0f; + } else { + i_this->mBtpTimer--; + if (i_this->mBtpTimer <= 5) { + i_this->mBtpFrame = 5 - i_this->mBtpTimer; + } else { + i_this->mBtpFrame = 0; + } + } + } +} + +/* 8066DD48-8066DE64 0060E8 011C+00 1/1 0/0 0/0 .text message__FP8do_class */ +static void message(do_class* i_this) { + if (i_this->mIsTalking) { + i_this->mCcDisableTimer = 10; + + if (i_this->mMsg.doFlow(i_this, 0, 0)) { + dComIfGp_event_reset(); + i_this->mIsTalking = 0; + } + + } else { + if (dComIfGp_event_runCheck() && i_this->eventInfo.checkCommandTalk()) { + i_this->mMsg.init(i_this, i_this->mFlowID, 0, 0); + i_this->mIsTalking = 1; + } + + if (i_this->mMessageState == 2 && i_this->mFlowID != -1 && daPy_py_c::i_checkNowWolf()) { + fopAcM_OnStatus(i_this, 0); + cLib_onBit<u32>(i_this->attention_info.flags, 0xa); + i_this->eventInfo.i_onCondition(dEvtCnd_CANTALK_e); + } else { + fopAcM_OffStatus(i_this, 0); + cLib_offBit<u32>(i_this->attention_info.flags, 0xa); + } + } +} + +/* 8066DE64-8066E494 006204 0630+00 2/1 0/0 0/0 .text daDo_Execute__FP8do_class */ +static int daDo_Execute(do_class* i_this) { + if (cDmrNowMidnaTalk() && !fopAcM_checkCarryNow(i_this)) { + return 1; + } + + i_this->mCounter++; + + for (int i = 0; i < 4; i++) { + if (i_this->mTimer[i] != 0) { + i_this->mTimer[i]--; + } + } + + if (i_this->mCcDisableTimer != 0) { + i_this->mCcDisableTimer--; + } + + if (i_this->mSwimEffectTimer != 0) { + i_this->mSwimEffectTimer--; + } + + action(i_this); + + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::XrotM(i_this->shape_angle.x); + mDoMtx_stack_c::ZrotM(i_this->shape_angle.z); + i_this->scale.set(i_this->mScale.x * l_HIO.mBaseSize, + i_this->mScale.y * l_HIO.mBaseSize, + i_this->mScale.z * l_HIO.mBaseSize); + mDoMtx_stack_c::scaleM(i_this->scale.x, i_this->scale.y, i_this->scale.z); + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpMorf->play(&i_this->eyePos, 0, 0); + + if (i_this->mAnmID == ANM_JOYFUL) { + if (i_this->mpMorf->checkFrame(16.0f)) { + i_this->mpMorf->setFrame(0.0f); + } + } else if (i_this->mAnmID == ANM_RUN) { + if (i_this->mpMorf->checkFrame(15.0f)) { + i_this->mpMorf->setFrame(0.0f); + } + } + + if ((i_this->mAnmID == ANM_JOYFUL || i_this->mAnmID == ANM_STEP) && i_this->mTimer[3] == 0) { + i_this->mTimer[3] = cM_rndF(4.0f) + 13.0f; + i_this->mSound.startSound(Z2SE_DOG_BREATH, 0, -1); + } + + i_this->mpBtk->setFrame(i_this->mBtkFrame); + i_this->mpBtp->setFrame(i_this->mBtpFrame); + i_this->mpMorf->modelCalc(); + + cXyz vec, center; + MTXCopy(model->getAnmMtx(10), *calc_mtx); + vec.set(5.0f, 5.0f, 0.0f); + MtxPosition(&vec, &i_this->eyePos); + i_this->attention_info.position = i_this->eyePos; + i_this->attention_info.position.y += i_this->mScale.y * 16.0f; + + vec.set(-15.0f, -15.0f, 0.0f); + MtxPosition(&vec, ¢er); + if (i_this->mCcDisableTimer != 0) { + center.y += 13000.0f; + } + i_this->mCcSph.SetC(center); + + if (i_this->mAction == ACT_A_SWIM) { + i_this->mCcSph.SetR(i_this->mScale.z * 45.0f); + } else { + i_this->mCcSph.SetR(i_this->mScale.z * 30.0f); + } + + dComIfG_Ccsp()->Set(&i_this->mCcSph); + + if (i_this->mItemActorID != -1) { + daItem_c* item = static_cast<daItem_c*>(fopAcM_SearchByID(i_this->mItemActorID)); + if (item != NULL) { + if (i_this->mItemControlTimer < 10) { + i_this->mItemControlTimer++; + if (i_this->mItemControlTimer == 10) { + item->startControl(); + i_this->mItemControlTimer = 20; + } + } + + MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(10), *calc_mtx); + cMtx_YrotM(*calc_mtx, 0); + cMtx_XrotM(*calc_mtx, 0); + cMtx_ZrotM(*calc_mtx, 0); + MtxTrans(20.0f, -24.0f, 0.0f, 1); + vec.set(0.0f, 0.0f, 0.0f); + MtxPosition(&vec, &item->current.pos); + + item->shape_angle = i_this->shape_angle; + item->current.angle = item->shape_angle; + item->speed.zero(); + item->speedF = 0.0f; + } + } + + if (i_this->mFoodInMouth) { + obj_food_class* food = + static_cast<obj_food_class*>(fopAcM_SearchByID(i_this->mFoodActorID)); + if (food != NULL) { + if (fopAcM_GetName(food) == PROC_OBJ_FOOD) { + MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(10), *calc_mtx); + cMtx_YrotM(*calc_mtx, 0x4000); + MtxTrans(0.0f, -7.0f, 25.0f, 1); + food->mpModel->setBaseTRMtx(*calc_mtx); + vec.set(0.0f, 0.0f, 0.0f); + MtxPosition(&vec, &food->current.pos); + fopAcM_SetFoodStatus(food, fopAcM_FOOD_3); + } + } else { + //!@bug: the last two lines will fail because this path only executes if food is null + MTXCopy(i_this->mpMorf->getModel()->getAnmMtx(10), *calc_mtx); + cMtx_YrotM(*calc_mtx, 0x4000); + MtxTrans(0.0f, -7.0f, 25.0f, 1); + vec.set(0.0f, 0.0f, 0.0f); + MtxPosition(&vec, &food->current.pos); + fopAcM_SetFoodStatus(food, fopAcM_FOOD_3); + } + i_this->mFoodInMouth = 0; + } + + i_this->mSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + message(i_this); + return 1; +} + +/* 8066E494-8066E49C 006834 0008+00 1/0 0/0 0/0 .text daDo_IsDelete__FP8do_class */ +static int daDo_IsDelete(do_class* i_this) { + return 1; +} + +/* 8066E49C-8066E504 00683C 0068+00 1/0 0/0 0/0 .text daDo_Delete__FP8do_class */ +static int daDo_Delete(do_class* i_this) { + u32 actor_id = fopAcM_GetID(i_this); + dComIfG_resDelete(&i_this->mPhase, "Do"); + if (i_this->mHIOInit) { + hioInit = false; + } + if (i_this->heap) { + i_this->mSound.deleteObject(); + } + return 1; +} + +/* 8066E504-8066E7D4 0068A4 02D0+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ +static int useHeapInit(fopAc_ac_c* i_this) { + do_class* _this = (do_class*)i_this; + + _this->mpMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("Do", 25), NULL, NULL, + (J3DAnmTransform*)dComIfG_getObjectRes("Do", 14), 2, + 1.0f, 0, -1, 1, NULL, 0x80000, 0x11020284); + + if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { + return 0; + } + + J3DModel* model = _this->mpMorf->getModel(); + _this->model = model; + model->setUserArea((u32)i_this); + + for (u16 jnt_no = 0; jnt_no < model->getModelData()->getJointNum(); jnt_no++) { + if (jnt_no == 9 || jnt_no == 10 || jnt_no == 22 || jnt_no == 23) { + model->getModelData()->getJointNodePointer(jnt_no)->setCallBack(nodeCallBack); + } + } + + _this->mpBtk = new mDoExt_btkAnm(); + if (_this->mpBtk == NULL) { + return 0; + } + + if (!_this->mpBtk->init(_this->mpMorf->getModel()->getModelData(), + (J3DAnmTextureSRTKey*)dComIfG_getObjectRes("Do", 29), TRUE, 0, + 1.0f, 0, -1)) + { + return 0; + } + + _this->mpBtp = new mDoExt_btpAnm(); + if (_this->mpBtp == NULL) { + return 0; + } + + if (!_this->mpBtp->init(_this->mpMorf->getModel()->getModelData(), + (J3DAnmTexPattern*)dComIfG_getObjectRes("Do", 32), TRUE, 0, + 1.0f, 0, -1)) + { + return 0; + } + + _this->mSound.init(&_this->current.pos, 1); + return 1; +} + +/* 8066E81C-8066EAE4 006BBC 02C8+00 1/0 0/0 0/0 .text daDo_Create__FP10fopAc_ac_c */ +static cPhs__Step daDo_Create(fopAc_ac_c* i_this) { + do_class* _this = static_cast<do_class*>(i_this); + fopAcM_SetupActor(i_this, do_class); + + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&_this->mPhase, "Do"); + + if (step == cPhs_COMPLEATE_e) { + _this->mParam0 = fopAcM_GetParam(i_this) & 7; + _this->mParam1 = fopAcM_GetParam(i_this) >> 4 & 0xf; + _this->mParam2 = (u8)(fopAcM_GetParam(i_this) >> 8); + if (_this->mParam0 != 2) { + _this->mParam0 = 0; + } + + _this->mFlowID = i_this->current.angle.x; + i_this->shape_angle.x = 0; + i_this->current.angle.x = 0; + + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x2120)) { + return cPhs_ERROR_e; + } + + if (!hioInit) { + _this->mHIOInit = true; + hioInit = 1; + l_HIO.field_0x04 = -1; + } + + fopAcM_OnStatus(i_this, fopAcStts_CULL_e); + fopAcM_OnCarryType(i_this, fopAcM_CARRY_TYPE_8); + i_this->attention_info.flags = 0; + i_this->attention_info.field_0x0[4] = 7; + fopAcM_SetMtx(i_this, _this->mpMorf->getModel()->getBaseTRMtx()); + _this->mBgS_Acch.Set(fopAcM_GetPosition_p(i_this), fopAcM_GetOldPosition_p(i_this), i_this, + 1, &_this->mBgS_AcchCir, fopAcM_GetSpeed_p(i_this), NULL, NULL); + _this->mBgS_AcchCir.SetWall(30.0f, 30.0f); + i_this->health = 1; + _this->field_0x560 = 1; + _this->mStts.Init(100, 0, i_this); + + static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{0x0, 0x0, 0x0}, {0x0, 0x0}, 0x75}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 20.0f} // mSph + } // mSphAttr + }; + _this->mCcSph.Set(cc_sph_src); + _this->mCcSph.SetStts(&_this->mStts); + _this->mCcSph.OnTgNoHitMark(); + + if (_this->mParam1 == 0xff) { + _this->mBtkFrame = cM_rndF(3.999f); + } else { + _this->mBtkFrame = _this->mParam1; + if (_this->mBtkFrame > 3) { + _this->mBtkFrame = 3; + } + } + + _this->mTailPhaseY = cM_rndF(0x10000); + _this->mTailPhaseX = cM_rndF(0x10000); + _this->mCounter = cM_rndF(0x10000); + _this->mScale.set(1.0f, 1.0f, 1.0f); + + if (_this->mParam0 == 2) { + _this->mAction = ACT_HELP; + i_this->current.pos.set(7216.0f, 220.0f, -4808.0f); + } + + noFallCheck = false; + if (dStage_stagInfo_GetSTType(dComIfGp_getStage()->getStagInfo()) != ST_FIELD) { + noFallCheck = true; + _this->mParam2 = 200; + } + + _this->mItemActorID = -1; + daDo_Execute(_this); + } + + return step; +} + +/* 8066F32C-8066F330 0000BC 0004+00 0/0 0/0 0/0 .bss + * sInstance__40JASGlobalInstance<19JASDefaultBankTable> */ +#pragma push +#pragma force_active on +static u8 data_8066F32C[4]; +#pragma pop + +/* 8066F330-8066F334 0000C0 0004+00 0/0 0/0 0/0 .bss + * sInstance__35JASGlobalInstance<14JASAudioThread> */ +#pragma push +#pragma force_active on +static u8 data_8066F330[4]; +#pragma pop + +/* 8066F334-8066F338 0000C4 0004+00 0/0 0/0 0/0 .bss sInstance__27JASGlobalInstance<7Z2SeMgr> */ +#pragma push +#pragma force_active on +static u8 data_8066F334[4]; +#pragma pop + +/* 8066F338-8066F33C 0000C8 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8Z2SeqMgr> */ +#pragma push +#pragma force_active on +static u8 data_8066F338[4]; +#pragma pop + +/* 8066F33C-8066F340 0000CC 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SceneMgr> + */ +#pragma push +#pragma force_active on +static u8 data_8066F33C[4]; +#pragma pop + +/* 8066F340-8066F344 0000D0 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2StatusMgr> + */ +#pragma push +#pragma force_active on +static u8 data_8066F340[4]; +#pragma pop + +/* 8066F344-8066F348 0000D4 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2DebugSys> + */ +#pragma push +#pragma force_active on +static u8 data_8066F344[4]; +#pragma pop + +/* 8066F348-8066F34C 0000D8 0004+00 0/0 0/0 0/0 .bss + * sInstance__36JASGlobalInstance<15JAISoundStarter> */ +#pragma push +#pragma force_active on +static u8 data_8066F348[4]; +#pragma pop + +/* 8066F34C-8066F350 0000DC 0004+00 0/0 0/0 0/0 .bss + * sInstance__35JASGlobalInstance<14Z2SoundStarter> */ +#pragma push +#pragma force_active on +static u8 data_8066F34C[4]; +#pragma pop + +/* 8066F350-8066F354 0000E0 0004+00 0/0 0/0 0/0 .bss + * sInstance__33JASGlobalInstance<12Z2SpeechMgr2> */ +#pragma push +#pragma force_active on +static u8 data_8066F350[4]; +#pragma pop + +/* 8066F354-8066F358 0000E4 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8JAISeMgr> */ +#pragma push +#pragma force_active on +static u8 data_8066F354[4]; +#pragma pop + +/* 8066F358-8066F35C 0000E8 0004+00 0/0 0/0 0/0 .bss sInstance__29JASGlobalInstance<9JAISeqMgr> */ +#pragma push +#pragma force_active on +static u8 data_8066F358[4]; +#pragma pop + +/* 8066F35C-8066F360 0000EC 0004+00 0/0 0/0 0/0 .bss + * sInstance__33JASGlobalInstance<12JAIStreamMgr> */ +#pragma push +#pragma force_active on +static u8 data_8066F35C[4]; +#pragma pop + +/* 8066F360-8066F364 0000F0 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SoundMgr> + */ +#pragma push +#pragma force_active on +static u8 data_8066F360[4]; +#pragma pop + +/* 8066F364-8066F368 0000F4 0004+00 0/0 0/0 0/0 .bss + * sInstance__33JASGlobalInstance<12JAISoundInfo> */ +#pragma push +#pragma force_active on +static u8 data_8066F364[4]; +#pragma pop + +/* 8066F368-8066F36C 0000F8 0004+00 0/0 0/0 0/0 .bss + * sInstance__34JASGlobalInstance<13JAUSoundTable> */ +#pragma push +#pragma force_active on +static u8 data_8066F368[4]; +#pragma pop + +/* 8066F36C-8066F370 0000FC 0004+00 0/0 0/0 0/0 .bss + * sInstance__38JASGlobalInstance<17JAUSoundNameTable> */ +#pragma push +#pragma force_active on +static u8 data_8066F36C[4]; +#pragma pop + +/* 8066F370-8066F374 000100 0004+00 0/0 0/0 0/0 .bss + * sInstance__33JASGlobalInstance<12JAUSoundInfo> */ +#pragma push +#pragma force_active on +static u8 data_8066F370[4]; +#pragma pop + +/* 8066F374-8066F378 000104 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SoundInfo> + */ +#pragma push +#pragma force_active on +static u8 data_8066F374[4]; +#pragma pop + +/* 8066F378-8066F37C 000108 0004+00 0/0 0/0 0/0 .bss + * sInstance__34JASGlobalInstance<13Z2SoundObjMgr> */ +#pragma push +#pragma force_active on +static u8 data_8066F378[4]; +#pragma pop + +/* 8066F37C-8066F380 00010C 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2Audience> + */ +#pragma push +#pragma force_active on +static u8 data_8066F37C[4]; +#pragma pop + +/* 8066F380-8066F384 000110 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2FxLineMgr> + */ +#pragma push +#pragma force_active on +static u8 data_8066F380[4]; +#pragma pop + +/* 8066F384-8066F388 000114 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2EnvSeMgr> + */ +#pragma push +#pragma force_active on +static u8 data_8066F384[4]; +#pragma pop + +/* 8066F388-8066F38C 000118 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SpeechMgr> + */ +#pragma push +#pragma force_active on +static u8 data_8066F388[4]; +#pragma pop + +/* 8066F38C-8066F390 00011C 0004+00 0/0 0/0 0/0 .bss + * sInstance__34JASGlobalInstance<13Z2WolfHowlMgr> */ +#pragma push +#pragma force_active on +static u8 data_8066F38C[4]; +#pragma pop + +/* 8066F1CC-8066F1EC -00001 0020+00 1/0 0/0 0/0 .data l_daDo_Method */ +static actor_method_class l_daDo_Method = { + (process_method_func)daDo_Create, + (process_method_func)daDo_Delete, + (process_method_func)daDo_Execute, + (process_method_func)daDo_IsDelete, + (process_method_func)daDo_Draw, +}; + +/* 8066F1EC-8066F21C -00001 0030+00 0/0 0/0 1/0 .data g_profile_DO */ +extern actor_process_profile_definition g_profile_DO = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_DO, + &g_fpcLf_Method.mBase, + sizeof(do_class), + 0, + 0, + &g_fopAc_Method.base, + 0x2BB, + &l_daDo_Method, + 0x8044000, + fopAc_NPC_e, + fopAc_CULLBOX_0_e, +}; diff --git a/rel/d/a/obj/d_a_obj_food/d_a_obj_food.cpp b/rel/d/a/obj/d_a_obj_food/d_a_obj_food.cpp index 907582bde9..9da817fce7 100644 --- a/rel/d/a/obj/d_a_obj_food/d_a_obj_food.cpp +++ b/rel/d/a/obj/d_a_obj_food/d_a_obj_food.cpp @@ -1,804 +1,539 @@ -// -// Generated By: dol2asm -// Translation Unit: d_a_obj_food -// +/** + * d_a_obj_food.cpp + * Object - Bone / Ball + */ #include "rel/d/a/obj/d_a_obj_food/d_a_obj_food.h" -#include "d/cc/d_cc_d.h" -#include "dol2asm.h" - -// -// Types: -// - -struct request_of_phase_process_class {}; - -struct obj_food_class {}; - -struct mDoMtx_stack_c { - /* 8000CD9C */ void transM(f32, f32, f32); - /* 8000CE38 */ void scaleM(f32, f32, f32); - - static u8 now[48]; -}; - -struct fopAc_ac_c { - /* 80018B64 */ fopAc_ac_c(); -}; - -struct daPy_py_c { - /* 8015F60C */ void wolfGrabSubjectNoDraw(fopAc_ac_c*); -}; - -struct daObj_Food_HIO_c { - /* 80BF070C */ daObj_Food_HIO_c(); - /* 80BF1CE8 */ ~daObj_Food_HIO_c(); -}; - -struct dKy_tevstr_c {}; - -struct J3DModelData {}; - -struct dScnKy_env_light_c { - /* 801A37C4 */ void settingTevStruct(int, cXyz*, dKy_tevstr_c*); - /* 801A4DA0 */ void setLightTevColorType_MAJI(J3DModelData*, dKy_tevstr_c*); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct dPa_levelEcallBack {}; - -struct csXyz {}; - -struct _GXColor {}; - -struct dPa_control_c { - /* 8004D4CC */ void set(u32, u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, - cXyz const*, u8, dPa_levelEcallBack*, s8, _GXColor const*, - _GXColor const*, cXyz const*, f32); -}; - -struct dDlst_shadowControl_c { - static u8 mSimpleTexObj[32]; -}; - -struct dBgS_PolyPassChk { - /* 80078E68 */ void SetObj(); -}; - -struct dBgS_ObjAcch { - /* 80BF1C78 */ ~dBgS_ObjAcch(); -}; - -struct dBgS_LinChk { - /* 80077C68 */ dBgS_LinChk(); - /* 80077CDC */ ~dBgS_LinChk(); - /* 80077D64 */ void Set(cXyz const*, cXyz const*, fopAc_ac_c const*); -}; - -struct dBgS_GndChk { - /* 8007757C */ dBgS_GndChk(); - /* 800775F0 */ ~dBgS_GndChk(); -}; - -struct dBgS_AcchCir { - /* 80075EAC */ dBgS_AcchCir(); - /* 80075F58 */ void SetWall(f32, f32); -}; - -struct dBgS {}; - -struct dBgS_Acch { - /* 80075F94 */ ~dBgS_Acch(); - /* 800760A0 */ dBgS_Acch(); - /* 80076248 */ void Set(cXyz*, cXyz*, fopAc_ac_c*, int, dBgS_AcchCir*, cXyz*, csXyz*, csXyz*); - /* 80076AAC */ void CrrPos(dBgS&); -}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - -struct cBgS_PolyInfo {}; - -struct cBgS_LinChk {}; - -struct cBgS_GndChk { - /* 80267D0C */ void SetPos(Vec const*); -}; - -struct cBgS { - /* 800743B4 */ void LineCross(cBgS_LinChk*); - /* 800744A0 */ void GroundCross(cBgS_GndChk*); -}; +#include "SSystem/SComponent/c_math.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "f_op/f_op_actor_mng.h" +#include "d/cc/d_cc_uty.h" +#include "d/com/d_com_inf_game.h" +#include "d/a/d_a_player.h" +#include "d/d_procname.h" -struct _GXTexObj {}; - -struct Z2SoundObjSimple { - /* 802BE844 */ Z2SoundObjSimple(); -}; - -struct Z2SoundObjBase { - /* 802BDFF8 */ void deleteObject(); -}; - -struct JMath { - static u8 sincosTable_[65536]; -}; - -struct J3DModel {}; - -// -// Forward References: -// - -extern "C" void __ct__16daObj_Food_HIO_cFv(); -extern "C" static void daObj_Food_Draw__FP14obj_food_class(); -extern "C" static void ground_ang_set__FP14obj_food_class(); -extern "C" static void food_carry__FP14obj_food_class(); -extern "C" static void wall_angle_get__FP14obj_food_class(); -extern "C" static void food_normal__FP14obj_food_class(); -extern "C" static void ball_move__FP14obj_food_class(); -extern "C" static void action__FP14obj_food_class(); -extern "C" static void daObj_Food_Execute__FP14obj_food_class(); -extern "C" static bool daObj_Food_IsDelete__FP14obj_food_class(); -extern "C" static void daObj_Food_Delete__FP14obj_food_class(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" static void daObj_Food_Create__FP10fopAc_ac_c(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__16daObj_Food_HIO_cFv(); -extern "C" void __sinit_d_a_obj_food_cpp(); -extern "C" static void func_80BF1D6C(); -extern "C" static void func_80BF1D74(); -extern "C" extern char const* const d_a_obj_food__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotS__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoMtx_ZrotM__FPA4_fs(); -extern "C" void transM__14mDoMtx_stack_cFfff(); -extern "C" void scaleM__14mDoMtx_stack_cFfff(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_carryOffRevise__FP10fopAc_ac_c(); -extern "C" void fopAcM_getWaterY__FPC4cXyzPf(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGp_getReverb__Fi(); -extern "C" void dComIfGd_setSimpleShadow__FP4cXyzffR13cBgS_PolyInfosfP9_GXTexObj(); -extern "C" void -dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void -set__13dPa_control_cFUlUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void LineCross__4cBgSFP11cBgS_LinChk(); -extern "C" void GroundCross__4cBgSFP11cBgS_GndChk(); -extern "C" void __ct__12dBgS_AcchCirFv(); -extern "C" void SetWall__12dBgS_AcchCirFff(); -extern "C" void __dt__9dBgS_AcchFv(); -extern "C" void __ct__9dBgS_AcchFv(); -extern "C" void Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz(); -extern "C" void CrrPos__9dBgS_AcchFR4dBgS(); -extern "C" void __ct__11dBgS_GndChkFv(); -extern "C" void __dt__11dBgS_GndChkFv(); -extern "C" void __ct__11dBgS_LinChkFv(); -extern "C" void __dt__11dBgS_LinChkFv(); -extern "C" void Set__11dBgS_LinChkFPC4cXyzPC4cXyzPC10fopAc_ac_c(); -extern "C" void SetObj__16dBgS_PolyPassChkFv(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void GetTgHitObj__12dCcD_GObjInfFv(); -extern "C" void ChkCoHit__12dCcD_GObjInfFv(); -extern "C" void GetCoHitObj__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -extern "C" void wolfGrabSubjectNoDraw__9daPy_py_cFP10fopAc_ac_c(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void GetAc__8cCcD_ObjFv(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void __pl__4cXyzCFRC3Vec(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void cM_atan2s__Fff(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void SetPos__11cBgS_GndChkFPC3Vec(); -extern "C" void SetC__8cM3dGSphFRC4cXyz(); -extern "C" void SetR__8cM3dGSphFf(); -extern "C" void cLib_addCalc0__FPfff(); -extern "C" void cLib_addCalcAngleS2__FPssss(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void deleteObject__14Z2SoundObjBaseFv(); -extern "C" void __ct__16Z2SoundObjSimpleFv(); -extern "C" void __dl__FPv(); -extern "C" void PSMTXCopy(); -extern "C" void PSMTXTrans(); -extern "C" void __cvt_fp2unsigned(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* g_fopAc_Method[8]; -extern "C" extern void* g_fpcLf_Method[5 + 1 /* padding */]; -extern "C" extern void* __vt__8dCcD_Sph[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_SphAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" extern u8 g_env_light[4880]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 80BF1D90-80BF1D94 000000 0004+00 9/9 0/0 0/0 .rodata @3647 */ -SECTION_RODATA static f32 const lit_3647 = 1.0f; -COMPILER_STRIP_GATE(0x80BF1D90, &lit_3647); - -/* 80BF1E18-80BF1E20 000000 0008+00 1/1 0/0 0/0 .data w_eff_id$3948 */ -SECTION_DATA static u8 w_eff_id[8] = { - 0x01, 0xB8, 0x01, 0xB9, 0x01, 0xBA, 0x01, 0xBB, -}; - -/* 80BF1E20-80BF1E60 000008 0040+00 1/1 0/0 0/0 .data cc_sph_src$4146 */ -static dCcD_SrcSph cc_sph_src = { - { - {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdff, 0x3}, 0x75}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 20.0f} // mSph - } // mSphAttr -}; - -/* 80BF1E60-80BF1EA0 000048 0040+00 1/1 0/0 0/0 .data at_sph_src$4147 */ -static dCcD_SrcSph at_sph_src = { - { - {0x0, {{AT_TYPE_THROW_OBJ, 0x0, 0x1f}, {0x0, 0x0}, 0x0}}, // mObj - {dCcD_SE_NONE, 0x1, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 15.0f} // mSph - } // mSphAttr -}; - -/* 80BF1EA0-80BF1EC0 -00001 0020+00 1/0 0/0 0/0 .data l_daObj_Food_Method */ -SECTION_DATA static void* l_daObj_Food_Method[8] = { - (void*)daObj_Food_Create__FP10fopAc_ac_c, - (void*)daObj_Food_Delete__FP14obj_food_class, - (void*)daObj_Food_Execute__FP14obj_food_class, - (void*)daObj_Food_IsDelete__FP14obj_food_class, - (void*)daObj_Food_Draw__FP14obj_food_class, - (void*)NULL, - (void*)NULL, - (void*)NULL, -}; - -/* 80BF1EC0-80BF1EF0 -00001 0030+00 0/0 0/0 1/0 .data g_profile_OBJ_FOOD */ -SECTION_DATA extern void* g_profile_OBJ_FOOD[12] = { - (void*)0xFFFFFFFD, (void*)0x0007FFFD, - (void*)0x01100000, (void*)&g_fpcLf_Method, - (void*)0x00000A90, (void*)NULL, - (void*)NULL, (void*)&g_fopAc_Method, - (void*)0x02C80000, (void*)&l_daObj_Food_Method, - (void*)0x00044100, (void*)NULL, -}; - -/* 80BF1EF0-80BF1EFC 0000D8 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 80BF1EFC-80BF1F08 0000E4 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; - -/* 80BF1F08-80BF1F2C 0000F0 0024+00 2/2 0/0 0/0 .data __vt__12dBgS_ObjAcch */ -SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_ObjAcchFv, - (void*)NULL, - (void*)NULL, - (void*)func_80BF1D74, - (void*)NULL, - (void*)NULL, - (void*)func_80BF1D6C, -}; +/* 80BF1F40-80BF1F44 000008 0004+00 2/2 0/0 0/0 .bss None */ +static bool hioInit; -/* 80BF1F2C-80BF1F38 000114 000C+00 2/2 0/0 0/0 .data __vt__16daObj_Food_HIO_c */ -SECTION_DATA extern void* __vt__16daObj_Food_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__16daObj_Food_HIO_cFv, -}; +/* 80BF1F50-80BF1F5C 000018 000C+00 3/3 0/0 0/0 .bss l_HIO */ +static daObj_Food_HIO_c l_HIO; /* 80BF070C-80BF0730 0000EC 0024+00 1/1 0/0 0/0 .text __ct__16daObj_Food_HIO_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm daObj_Food_HIO_c::daObj_Food_HIO_c() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/__ct__16daObj_Food_HIO_cFv.s" +daObj_Food_HIO_c::daObj_Food_HIO_c() { + field_0x4 = -1; + mBoneScale = 1.0f; } -#pragma pop - -/* ############################################################################################## */ -/* 80BF1D94-80BF1D98 000004 0004+00 0/3 0/0 0/0 .rodata @3679 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3679 = 50.0f; -COMPILER_STRIP_GATE(0x80BF1D94, &lit_3679); -#pragma pop - -/* 80BF1D98-80BF1D9C 000008 0004+00 0/1 0/0 0/0 .rodata @3680 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3680 = 200.0f; -COMPILER_STRIP_GATE(0x80BF1D98, &lit_3680); -#pragma pop - -/* 80BF1D9C-80BF1DA0 00000C 0004+00 0/5 0/0 0/0 .rodata @3681 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3681[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80BF1D9C, &lit_3681); -#pragma pop - -/* 80BF1DA0-80BF1DA4 000010 0004+00 0/1 0/0 0/0 .rodata @3682 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3682 = 19.0f; -COMPILER_STRIP_GATE(0x80BF1DA0, &lit_3682); -#pragma pop /* 80BF0730-80BF0854 000110 0124+00 1/0 0/0 0/0 .text daObj_Food_Draw__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObj_Food_Draw(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/daObj_Food_Draw__FP14obj_food_class.s" +static int daObj_Food_Draw(obj_food_class* i_this) { + if (daPy_py_c::wolfGrabSubjectNoDraw(i_this)) { + return 1; + } + + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType_MAJI(i_this->mpModel, &i_this->tevStr); + mDoExt_modelUpdateDL(i_this->mpModel); + + if (!fopAcM_checkCarryNow(i_this)) { + if (i_this->mType != obj_food_class::TYPE_BALL) { + cXyz pos; + pos.set(i_this->current.pos.x, i_this->current.pos.y + 50.0f, i_this->current.pos.z); + i_this->mShadowKey = + dComIfGd_setShadow(i_this->mShadowKey, 1, i_this->mpModel, &pos, 200.0f, 0.0f, + i_this->current.pos.y, i_this->mAcch.GetGroundH(), + i_this->mAcch.m_gnd, &i_this->tevStr, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + } else { + dComIfGd_setSimpleShadow(&i_this->current.pos, i_this->mAcch.GetGroundH(), + 19.0f, i_this->mAcch.m_gnd, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + } + } + + return 1; } -#pragma pop - -/* ############################################################################################## */ -/* 80BF1DA4-80BF1DA8 000014 0004+00 0/1 0/0 0/0 .rodata @3707 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3707 = 10.0f; -COMPILER_STRIP_GATE(0x80BF1DA4, &lit_3707); -#pragma pop - -/* 80BF1DA8-80BF1DAC 000018 0004+00 0/1 0/0 0/0 .rodata @3708 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3708 = -1000000000.0f; -COMPILER_STRIP_GATE(0x80BF1DA8, &lit_3708); -#pragma pop /* 80BF0854-80BF09A4 000234 0150+00 1/1 0/0 0/0 .text ground_ang_set__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void ground_ang_set(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/ground_ang_set__FP14obj_food_class.s" +static void ground_ang_set(obj_food_class* i_this) { + dBgS_GndChk gnd_chk; + Vec vec1; + cXyz vec2 = i_this->current.pos; + vec2.y = i_this->mAcch.GetGroundH(); + + vec1.x = vec2.x; + vec1.y = vec2.y + 50.0f; + vec1.z = vec2.z + 10.0f; + gnd_chk.SetPos(&vec1); + vec1.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + if (vec1.y != -1e9f) { + i_this->mGroundAngleX = -cM_atan2s(vec1.y - vec2.y, vec1.z - vec2.z); + } + + vec1.x = vec2.x + 10.0f; + vec1.y = vec2.y + 50.0f; + vec1.z = vec2.z; + gnd_chk.SetPos(&vec1); + vec1.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + if (vec1.y != -1e9f) { + i_this->mGroundAngleZ = cM_atan2s(vec1.y - vec2.y, vec1.x - vec2.x); + } } -#pragma pop - -/* ############################################################################################## */ -/* 80BF1DAC-80BF1DB0 00001C 0004+00 0/1 0/0 0/0 .rodata @3727 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3727 = 70.0f; -COMPILER_STRIP_GATE(0x80BF1DAC, &lit_3727); -#pragma pop - -/* 80BF1DB0-80BF1DB4 000020 0004+00 0/4 0/0 0/0 .rodata @3728 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3728 = -1.0f; -COMPILER_STRIP_GATE(0x80BF1DB0, &lit_3728); -#pragma pop /* 80BF09A4-80BF0AD0 000384 012C+00 1/1 0/0 0/0 .text food_carry__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void food_carry(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/food_carry__FP14obj_food_class.s" + +static void food_carry(obj_food_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + i_this->speed.y = 0.0f; + + if (!fopAcM_checkCarryNow(i_this)) { + i_this->mCcSph.OnCoSetBit(); + if (i_this->speedF > 0.0f) { + i_this->speedF = 70.0f; + i_this->speed.y = 50.0f; + fopAcM_SetFoodStatus(i_this, fopAcM_FOOD_1); + i_this->mRotSpeed.z = -0x1200; + i_this->mRotSpeed.y = 0; + i_this->current.angle.y = player->shape_angle.y; + i_this->shape_angle.y = player->shape_angle.y + 0x4000; + i_this->mBounces = 0; + } else { + fopAcM_SetFoodStatus(i_this, fopAcM_FOOD_0); + Z2GetAudioMgr()->seStart(Z2SE_OBJ_TOY_BONE_PUT, &i_this->current.pos, + 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + i_this->mBounces = 3; + } + fopAcM_carryOffRevise(i_this); + } + + cLib_addCalcAngleS2(&i_this->mGroundAngleX, 0, 1, 0x800); + cLib_addCalcAngleS2(&i_this->mGroundAngleZ, 0, 1, 0x800); } -#pragma pop - -/* ############################################################################################## */ -/* 80BF1DB4-80BF1DB8 000024 0004+00 0/1 0/0 0/0 .rodata @3782 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3782 = 2.0f; -COMPILER_STRIP_GATE(0x80BF1DB4, &lit_3782); -#pragma pop - -/* 80BF1DB8-80BF1DBC 000028 0004+00 0/2 0/0 0/0 .rodata @3783 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3783 = -20.0f; -COMPILER_STRIP_GATE(0x80BF1DB8, &lit_3783); -#pragma pop - -/* 80BF1DBC-80BF1DC0 00002C 0004+00 0/2 0/0 0/0 .rodata @3784 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3784 = 15.0f; -COMPILER_STRIP_GATE(0x80BF1DBC, &lit_3784); -#pragma pop - -/* 80BF1DC0-80BF1DC4 000030 0004+00 0/2 0/0 0/0 .rodata @3785 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3785 = 100.0f; -COMPILER_STRIP_GATE(0x80BF1DC0, &lit_3785); -#pragma pop /* 80BF0AD0-80BF0C74 0004B0 01A4+00 2/2 0/0 0/0 .text wall_angle_get__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void wall_angle_get(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/wall_angle_get__FP14obj_food_class.s" +static s16 wall_angle_get(obj_food_class* i_this) { + fopAc_ac_c* _this = static_cast<fopAc_ac_c*>(i_this); + dBgS_LinChk lin_chk; + cXyz vec1[2], vec2, vec3; + cMtx_YrotS(*calc_mtx, _this->current.angle.y); + + vec2.x = 0.0f; + vec2.y = 2.0f; + vec2.z = -20.0f; + MtxPosition(&vec2, &vec3); + vec3 += _this->current.pos; + + vec2.x = 15.0f; + vec2.y = 2.0f; + vec2.z = 100.0f; + + for (int i = 0; i < 2; i++) { + MtxPosition(&vec2, &vec1[i]); + vec2.x *= -1.0f; + vec1[i] += vec3; + + lin_chk.Set(&vec3, &vec1[i], _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + vec1[i] = lin_chk.i_GetCross(); + } else { + return 0x23; + } + } + + vec2 = vec1[1] - vec1[0]; + return cM_atan2s(vec2.x, vec2.z) + 0x4000; } -#pragma pop - -/* ############################################################################################## */ -/* 80BF1DC4-80BF1DC8 000034 0004+00 0/2 0/0 0/0 .rodata @3875 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3875 = 3.0f / 5.0f; -COMPILER_STRIP_GATE(0x80BF1DC4, &lit_3875); -#pragma pop - -/* 80BF1DC8-80BF1DCC 000038 0004+00 0/1 0/0 0/0 .rodata @3876 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3876 = -40.0f; -COMPILER_STRIP_GATE(0x80BF1DC8, &lit_3876); -#pragma pop - -/* 80BF1DCC-80BF1DD0 00003C 0004+00 0/2 0/0 0/0 .rodata @3877 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3877 = -0.5f; -COMPILER_STRIP_GATE(0x80BF1DCC, &lit_3877); -#pragma pop - -/* 80BF1DD0-80BF1DD4 000040 0004+00 0/2 0/0 0/0 .rodata @3878 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3878 = 8000.0f; -COMPILER_STRIP_GATE(0x80BF1DD0, &lit_3878); -#pragma pop - -/* 80BF1DD4-80BF1DD8 000044 0004+00 0/2 0/0 0/0 .rodata @3879 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3879 = 0.5f; -COMPILER_STRIP_GATE(0x80BF1DD4, &lit_3879); -#pragma pop - -/* 80BF1DD8-80BF1DDC 000048 0004+00 0/1 0/0 0/0 .rodata @3880 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3880 = 1.0f / 5.0f; -COMPILER_STRIP_GATE(0x80BF1DD8, &lit_3880); -#pragma pop - -/* 80BF1DDC-80BF1DE0 00004C 0004+00 0/2 0/0 0/0 .rodata @3881 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3881 = 20.0f; -COMPILER_STRIP_GATE(0x80BF1DDC, &lit_3881); -#pragma pop - -/* 80BF1DE0-80BF1DE4 000050 0004+00 0/1 0/0 0/0 .rodata @3882 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3882 = 20000.0f; -COMPILER_STRIP_GATE(0x80BF1DE0, &lit_3882); -#pragma pop - -/* 80BF1DE4-80BF1DE8 000054 0004+00 0/2 0/0 0/0 .rodata @3883 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3883 = 30.0f; -COMPILER_STRIP_GATE(0x80BF1DE4, &lit_3883); -#pragma pop /* 80BF0C74-80BF0FC0 000654 034C+00 1/1 0/0 0/0 .text food_normal__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void food_normal(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/food_normal__FP14obj_food_class.s" +static void food_normal(obj_food_class* i_this) { + if (i_this->mAcch.ChkGroundHit()) { + fopAcM_SetFoodStatus(i_this, fopAcM_FOOD_0); + if (i_this->mBounces >= 3) { + cLib_onBit<u32>(i_this->attention_info.flags, 0x10); + i_this->speedF = 0.0f; + + if (fopAcM_checkCarryNow(i_this)) { + fopAcM_SetFoodStatus(i_this, fopAcM_FOOD_2); + i_this->mBounces = 0; + i_this->mCcSph.OffCoSetBit(); + } + + s16 target_angle; + if (i_this->shape_angle.z < 0x4000 && i_this->shape_angle.z > -0x4000) { + target_angle = 0; + } else { + target_angle = -0x8000; + } + cLib_addCalcAngleS2(&i_this->shape_angle.z, target_angle, 1, 0x1000); + } else { + i_this->mBounces++; + + if (i_this->speedF > 1.0f) { + i_this->speedF *= 0.6f; + } else if (i_this->mOldSpeedY < -40.0f) { + i_this->speedF = cM_rndF(15.0f); + } + i_this->speed.y = i_this->mOldSpeedY * -0.5f; + + Z2GetAudioMgr()->seStart(Z2SE_OBJ_TOY_BONE_BOUND, &i_this->current.pos, + fabsf(i_this->mOldSpeedY), 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + + i_this->current.angle.y += (s16)cM_rndFX(8000.0f); + + if (i_this->mBounces == 3) { + i_this->mRotSpeed.z = 0; + i_this->mRotSpeed.y = 0; + } else { + i_this->mRotSpeed.y = cM_rndFX(8000.0f); + i_this->mRotSpeed.z = cM_rndFX(8000.0f); + } + } + } else { + if (i_this->mTimer[1] == 0 && i_this->mAcch.ChkWallHit()) { + s16 wall_angle = wall_angle_get(i_this); + if (wall_angle != 0x23) { + s16 refl_angle = 0x8000 - (s16)(i_this->current.angle.y - wall_angle) * 2; + i_this->current.angle.y += refl_angle; + i_this->speedF *= (f32)fabs(cM_scos(refl_angle / 2) * 0.5f) + 0.2f; + i_this->speed.y = 0.0f; + i_this->mTimer[1] = 10; + Z2GetAudioMgr()->seStart(Z2SE_OBJ_TOY_BONE_BOUND, &i_this->current.pos, + i_this->speedF, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + } + } + + i_this->shape_angle.y += i_this->mRotSpeed.y; + i_this->shape_angle.z += i_this->mRotSpeed.z; + + cXyz pos = i_this->current.pos; + if (i_this->mBounces != 0 || i_this->speedF < 20.0f) { + pos.z += 20000.0f; + } + i_this->mAtSph.SetC(pos); + i_this->mAtSph.SetR(30.0f); + dComIfG_Ccsp()->Set(&i_this->mAtSph); + } } -#pragma pop - -/* ############################################################################################## */ -/* 80BF1DE8-80BF1DEC 000058 0004+00 0/2 0/0 0/0 .rodata @3922 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3922 = 3.0f; -COMPILER_STRIP_GATE(0x80BF1DE8, &lit_3922); -#pragma pop - -/* 80BF1DEC-80BF1DF0 00005C 0004+00 0/2 0/0 0/0 .rodata @3923 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3923 = 6.0f; -COMPILER_STRIP_GATE(0x80BF1DEC, &lit_3923); -#pragma pop - -/* 80BF1DF0-80BF1DF4 000060 0004+00 0/1 0/0 0/0 .rodata @3924 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3924 = 2.5f; -COMPILER_STRIP_GATE(0x80BF1DF0, &lit_3924); -#pragma pop /* 80BF0FC0-80BF1168 0009A0 01A8+00 1/1 0/0 0/0 .text ball_move__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void ball_move(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/ball_move__FP14obj_food_class.s" +static void ball_move(obj_food_class* i_this) { + if (i_this->mTimer[0] == 0 && (i_this->mCcSph.ChkTgHit() || i_this->mCcSph.ChkCoHit())) { + cCcD_Obj* hit_obj; + if (i_this->mCcSph.ChkTgHit()) { + hit_obj = i_this->mCcSph.GetTgHitObj(); + } else { + hit_obj = i_this->mCcSph.GetCoHitObj(); + } + fopAc_ac_c* actor = dCc_GetAc(hit_obj->GetAc()); + + cXyz vec = i_this->current.pos - actor->current.pos; + i_this->current.angle.y = cM_atan2s(vec.x, vec.z) + (s16)cM_rndFX(8000.0f); + i_this->mTimer[0] = 10; + if (actor->field_0x560 == 0x23) { + i_this->speedF = cM_rndF(1.0f) + 3.0f; + } else { + i_this->speedF = cM_rndF(2.5f) + 6.0f; + } + } + + if (i_this->mAcch.ChkWallHit() && i_this->mTimer[1] == 0) { + i_this->mTimer[1] = 10; + s16 wall_angle = wall_angle_get(i_this); + if (wall_angle != 0x23) { + s16 refl_angle = 0x8000 - (s16)(i_this->current.angle.y - wall_angle) * 2; + i_this->current.angle.y += refl_angle; + i_this->speedF *= 0.5f; + } + } + + if (i_this->mAcch.ChkGroundHit()) { + cLib_addCalc0(&i_this->speedF, 1.0f, 0.5f); + } } -#pragma pop - -/* ############################################################################################## */ -/* 80BF1DF4-80BF1DF8 000064 0004+00 0/1 0/0 0/0 .rodata @4085 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4085 = 700.0f; -COMPILER_STRIP_GATE(0x80BF1DF4, &lit_4085); -#pragma pop - -/* 80BF1DF8-80BF1DFC 000068 0004+00 0/1 0/0 0/0 .rodata @4086 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4086 = 12.0f; -COMPILER_STRIP_GATE(0x80BF1DF8, &lit_4086); -#pragma pop - -/* 80BF1DFC-80BF1E00 00006C 0004+00 0/1 0/0 0/0 .rodata @4087 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4087 = 7.0f / 10.0f; -COMPILER_STRIP_GATE(0x80BF1DFC, &lit_4087); -#pragma pop - -/* 80BF1E00-80BF1E04 000070 0004+00 0/1 0/0 0/0 .rodata @4088 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4088 = -8.0f; -COMPILER_STRIP_GATE(0x80BF1E00, &lit_4088); -#pragma pop - -/* 80BF1E04-80BF1E08 000074 0004+00 0/2 0/0 0/0 .rodata @4089 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4089 = -5.0f; -COMPILER_STRIP_GATE(0x80BF1E04, &lit_4089); -#pragma pop - -/* 80BF1E08-80BF1E0C 000078 0004+00 0/2 0/0 0/0 .rodata @4090 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4090 = -90.0f; -COMPILER_STRIP_GATE(0x80BF1E08, &lit_4090); -#pragma pop - -/* 80BF1E0C-80BF1E10 00007C 0004+00 0/1 0/0 0/0 .rodata @4091 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4091 = 5.0f; -COMPILER_STRIP_GATE(0x80BF1E0C, &lit_4091); -#pragma pop - -/* 80BF1F40-80BF1F44 000008 0004+00 2/2 0/0 0/0 .bss None */ -static u8 data_80BF1F40[4]; - -/* 80BF1F44-80BF1F50 00000C 000C+00 1/1 0/0 0/0 .bss @3642 */ -static u8 lit_3642[12]; - -/* 80BF1F50-80BF1F5C 000018 000C+00 3/3 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[12]; /* 80BF1168-80BF1700 000B48 0598+00 1/1 0/0 0/0 .text action__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void action(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/action__FP14obj_food_class.s" +static void action(obj_food_class* i_this) { + cXyz vec1, vec2; + + switch (i_this->field_0x567) { + case fopAcM_FOOD_0: + food_normal(i_this); + break; + case fopAcM_FOOD_1: + food_normal(i_this); + cLib_offBit<u32>(i_this->attention_info.flags, 0x10); + break; + case fopAcM_FOOD_2: + food_carry(i_this); + cLib_offBit<u32>(i_this->attention_info.flags, 0x10); + break; + case fopAcM_FOOD_3: + cLib_offBit<u32>(i_this->attention_info.flags, 0x10); + break; + case fopAcM_FOOD_4: + fopAcM_SetFoodStatus(i_this, fopAcM_FOOD_0); + i_this->mBounces = 0; + break; + case fopAcM_FOOD_5: + ball_move(i_this); + break; + } + + if (i_this->mType == obj_food_class::TYPE_BALL) { + i_this->current.angle.x += (s16)(i_this->speedF * 700.0f); + cMtx_YrotS(*calc_mtx, i_this->current.angle.y); + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = i_this->speedF; + MtxPosition(&vec1, &vec2); + i_this->speed.x = vec2.x; + i_this->speed.z = vec2.z; + i_this->current.pos += i_this->speed; + i_this->speed.y -= 3.0f; + + i_this->current.pos.y -= 12.0f; + i_this->old.pos.y -= 12.0f; + i_this->mAcch.CrrPos(dComIfG_Bgsp()); + i_this->current.pos.y += 12.0f; + i_this->old.pos.y += 12.0f; + + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->current.angle.y); + mDoMtx_stack_c::XrotM(i_this->current.angle.x); + mDoMtx_stack_c::scaleM(0.6f, 0.6f, 0.6f); + mDoMtx_stack_c::transM(0.0f, -20.0f, 0.0f); + i_this->mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + + cXyz vec3(0.0f, 12.0f, 0.0f); + i_this->mCcSph.SetC(i_this->current.pos + vec3); + i_this->mCcSph.SetR(6.0f); + dComIfG_Ccsp()->Set(&i_this->mCcSph); + } else if (!fopAcM_CheckFoodStatus(i_this, fopAcM_FOOD_3)) { + cMtx_YrotS(*calc_mtx, i_this->current.angle.y); + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = i_this->speedF; + MtxPosition(&vec1, &vec2); + i_this->speed.x = vec2.x; + i_this->speed.z = vec2.z; + i_this->speed.y += i_this->gravity; + i_this->current.pos += i_this->speed; + if (i_this->speed.y < i_this->maxFallSpeed) { + i_this->speed.y = i_this->maxFallSpeed; + } + i_this->mOldSpeedY = i_this->speed.y; + + cXyz vec3 = i_this->current.pos; + vec3.y += 100.0f; + f32 water_y; + fopAcM_getWaterY(&vec3, &water_y); + + if (i_this->speed.y <= -20.0f + && i_this->current.pos.y < water_y && i_this->old.pos.y >= water_y) + { + cXyz scale(0.7f, 0.7f, 0.7f); + cXyz pos = i_this->current.pos; + pos.y = water_y; + static u16 w_eff_id[4] = {0x1B8, 0x1B9, 0x1BA, 0x1BB}; + for (int i = 0; i < 4; i++) { + i_this->mParticleKey[i] = + dComIfGp_particle_set(i_this->mParticleKey[i], w_eff_id[i], &pos, + &i_this->tevStr, NULL, &scale, 0xff, NULL, -1, + NULL, NULL, NULL); + } + i_this->mSound.startSound(Z2SE_CM_BODYFALL_WATER_S, 0, -1); + i_this->speed.y = -1.0f; + i_this->mRotSpeed.z = 0; + i_this->mRotSpeed.y = 0; + i_this->speedF = 0.0f; + } + + if (i_this->current.pos.y <= water_y) { + i_this->gravity = -0.5f; + i_this->maxFallSpeed = -8.0f; + } else { + i_this->gravity = -5.0f; + i_this->maxFallSpeed = -90.0f; + } + + i_this->mAcch.CrrPos(dComIfG_Bgsp()); + if (i_this->mAcch.ChkGroundHit()) { + ground_ang_set(i_this); + } + + mDoMtx_stack_c::transS(i_this->current.pos.x, + i_this->current.pos.y + 5.0f, + i_this->current.pos.z); + mDoMtx_stack_c::XrotM(i_this->mGroundAngleX); + mDoMtx_stack_c::ZrotM(i_this->mGroundAngleZ); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::XrotM(i_this->shape_angle.x); + mDoMtx_stack_c::ZrotM(i_this->shape_angle.z); + mDoMtx_stack_c::transM(0.0f, 0.0f, -5.0f); + mDoMtx_stack_c::scaleM(l_HIO.mBoneScale, l_HIO.mBoneScale, l_HIO.mBoneScale); + i_this->mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + } else { + fopAcM_SetFoodStatus(i_this, fopAcM_FOOD_4); + } + + i_this->attention_info.position = i_this->eyePos = i_this->current.pos; } -#pragma pop /* 80BF1700-80BF1794 0010E0 0094+00 2/1 0/0 0/0 .text daObj_Food_Execute__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObj_Food_Execute(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/daObj_Food_Execute__FP14obj_food_class.s" +static int daObj_Food_Execute(obj_food_class* i_this) { + i_this->mCounter++; + for (int i = 0; i < 4; i++) { + if (i_this->mTimer[i] != 0) { + i_this->mTimer[i]--; + } + } + action(i_this); + i_this->mSound.framework(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + return 1; } -#pragma pop /* 80BF1794-80BF179C 001174 0008+00 1/0 0/0 0/0 .text daObj_Food_IsDelete__FP14obj_food_class */ -static bool daObj_Food_IsDelete(obj_food_class* param_0) { - return true; +static int daObj_Food_IsDelete(obj_food_class* i_this) { + return 1; } -/* ############################################################################################## */ -/* 80BF1E10-80BF1E10 000080 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80BF1E10 = "Obj_fd"; -#pragma pop - /* 80BF179C-80BF1804 00117C 0068+00 1/0 0/0 0/0 .text daObj_Food_Delete__FP14obj_food_class */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObj_Food_Delete(obj_food_class* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/daObj_Food_Delete__FP14obj_food_class.s" +static int daObj_Food_Delete(obj_food_class* i_this) { + dComIfG_resDelete(&i_this->mPhase, "Obj_fd"); + if (i_this->mHIOInit) { + hioInit = false; + } + if (i_this->heap != NULL) { + i_this->mSound.deleteObject(); + } + return 1; } -#pragma pop /* 80BF1804-80BF18CC 0011E4 00C8+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void useHeapInit(fopAc_ac_c* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/useHeapInit__FP10fopAc_ac_c.s" +static int useHeapInit(fopAc_ac_c* i_this) { + obj_food_class* _this = static_cast<obj_food_class*>(i_this); + + J3DModelData* model_data; + if (_this->mType == obj_food_class::TYPE_BALL) { + model_data = static_cast<J3DModelData*>(dComIfG_getObjectRes("Obj_fd", 3)); + } else { + model_data = static_cast<J3DModelData*>(dComIfG_getObjectRes("Obj_fd", 4)); + } + + _this->mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084); + if (_this->mpModel == NULL) { + return 0; + } + + _this->mSound.init(&_this->current.pos, 1); + return 1; } -#pragma pop /* 80BF18CC-80BF1BE8 0012AC 031C+00 1/0 0/0 0/0 .text daObj_Food_Create__FP10fopAc_ac_c */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void daObj_Food_Create(fopAc_ac_c* param_0) { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/daObj_Food_Create__FP10fopAc_ac_c.s" +static cPhs__Step daObj_Food_Create(fopAc_ac_c* i_this) { + obj_food_class* _this = static_cast<obj_food_class*>(i_this); + fopAcM_SetupActor(i_this, obj_food_class); + + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&_this->mPhase, "Obj_fd"); + if (step == cPhs_COMPLEATE_e) { + _this->mType = (u8)fopAcM_GetParam(_this); + _this->mParam1 = (u8)(fopAcM_GetParam(_this) >> 8); + _this->mParam2 = (u8)(fopAcM_GetParam(_this) >> 0x10); + if (_this->mType == 0xff) { + _this->mType = obj_food_class::TYPE_BONE; + } + + if (!fopAcM_entrySolidHeap(_this, useHeapInit, 0x810)) { + return cPhs_ERROR_e; + } + + if (!hioInit) { + _this->mHIOInit = true; + hioInit = true; + l_HIO.field_0x4 = -1; + } + + fopAcM_SetMtx(_this, _this->mpModel->getBaseTRMtx()); + _this->mCcStts.Init(10, 0, _this); + + static dCcD_SrcSph cc_sph_src = { + { + {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdff, 0x3}, 0x75}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 20.0f} // mSph + } // mSphAttr + }; + _this->mCcSph.Set(cc_sph_src); + _this->mCcSph.SetStts(&_this->mCcStts); + + _this->mAcch.Set(fopAcM_GetPosition_p(_this), fopAcM_GetOldPosition_p(_this), _this, 1, + &_this->mAcchCir, fopAcM_GetSpeed_p(_this), NULL, NULL); + + if (_this->mType == obj_food_class::TYPE_BALL) { + _this->mAcchCir.SetWall(20.0f, 20.0f); + fopAcM_SetFoodStatus(_this, fopAcM_FOOD_5); + } else { + _this->mAcchCir.SetWall(30.0f, 30.0f); + _this->attention_info.field_0x0[4] = 7; + _this->gravity = -5.0f; + fopAcM_SetFoodStatus(_this, fopAcM_FOOD_0); + fopAcM_OnCarryType(_this, fopAcM_CARRY_UNK_30); + + static dCcD_SrcSph at_sph_src = { + { + {0x0, {{AT_TYPE_THROW_OBJ, 0x0, 0x1f}, {0x0, 0x0}, 0x0}}, // mObj + {dCcD_SE_NONE, 0x1, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 15.0f} // mSph + } // mSphAttr + }; + _this->mAtSph.Set(at_sph_src); + _this->mAtSph.SetStts(&_this->mCcStts); + _this->mAtSph.OffAtVsPlayerBit(); + } + + _this->gravity = -5.0f; + _this->maxFallSpeed = -90.0f; + + daObj_Food_Execute(_this); + } + + return step; } -#pragma pop - -/* 80BF1BE8-80BF1C30 0015C8 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -// asm cM3dGSph::~cM3dGSph() { -extern "C" asm void __dt__8cM3dGSphFv() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/__dt__8cM3dGSphFv.s" -} -#pragma pop - -/* 80BF1C30-80BF1C78 001610 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -// asm cM3dGAab::~cM3dGAab() { -extern "C" asm void __dt__8cM3dGAabFv() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/__dt__8cM3dGAabFv.s" -} -#pragma pop - -/* 80BF1C78-80BF1CE8 001658 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm dBgS_ObjAcch::~dBgS_ObjAcch() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/__dt__12dBgS_ObjAcchFv.s" -} -#pragma pop - -/* 80BF1CE8-80BF1D30 0016C8 0048+00 2/1 0/0 0/0 .text __dt__16daObj_Food_HIO_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm daObj_Food_HIO_c::~daObj_Food_HIO_c() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/__dt__16daObj_Food_HIO_cFv.s" -} -#pragma pop - -/* 80BF1D30-80BF1D6C 001710 003C+00 0/0 1/0 0/0 .text __sinit_d_a_obj_food_cpp */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void __sinit_d_a_obj_food_cpp() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/__sinit_d_a_obj_food_cpp.s" -} -#pragma pop - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x80BF1D30, __sinit_d_a_obj_food_cpp); -#pragma pop - -/* 80BF1D6C-80BF1D74 00174C 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void func_80BF1D6C() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/func_80BF1D6C.s" -} -#pragma pop - -/* 80BF1D74-80BF1D7C 001754 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -static asm void func_80BF1D74() { - nofralloc -#include "asm/rel/d/a/obj/d_a_obj_food/d_a_obj_food/func_80BF1D74.s" -} -#pragma pop -/* 80BF1E10-80BF1E10 000080 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ +/* 80BF1EA0-80BF1EC0 -00001 0020+00 1/0 0/0 0/0 .data l_daObj_Food_Method */ +static actor_method_class l_daObj_Food_Method = { + (process_method_func)daObj_Food_Create, + (process_method_func)daObj_Food_Delete, + (process_method_func)daObj_Food_Execute, + (process_method_func)daObj_Food_IsDelete, + (process_method_func)daObj_Food_Draw, +}; + +/* 80BF1EC0-80BF1EF0 -00001 0030+00 0/0 0/0 1/0 .data g_profile_OBJ_FOOD */ +extern actor_process_profile_definition g_profile_OBJ_FOOD = { + fpcLy_CURRENT_e, + 7, + fpcPi_CURRENT_e, + PROC_OBJ_FOOD, + &g_fpcLf_Method.mBase, + sizeof(obj_food_class), + 0, + 0, + &g_fopAc_Method.base, + 0x2C8, + &l_daObj_Food_Method, + 0x44100, + fopAc_ACTOR_e, + fopAc_CULLBOX_0_e, +}; |
