diff --git a/include/d/actor/d_a_npc_ks.h b/include/d/actor/d_a_npc_ks.h index da08da68e12..ba14540735d 100644 --- a/include/d/actor/d_a_npc_ks.h +++ b/include/d/actor/d_a_npc_ks.h @@ -83,29 +83,29 @@ public: /* 0x000 */ fopEn_enemy_c actor; /* 0x5AC */ request_of_phase_process_class mPhase; - /* 0x5B4 */ u8 mRoomMonkeyID; + /* 0x5B4 */ u8 monkey_room_no; /* 0x5B5 */ u8 field_0x5b5; - /* 0x5B6 */ u8 field_0x5b6; + /* 0x5B6 */ u8 set_id; /* 0x5B7 */ u8 field_0x5b7; - /* 0x5B8 */ int field_0x5b8; + /* 0x5B8 */ int order; /* 0x5BC */ int bitTRB; - /* 0x5C0 */ char* mResName; - /* 0x5C4 */ f32 field_0x5c4; - /* 0x5C8 */ s16 field_0x5c8; - /* 0x5CC */ mDoExt_McaMorfSO* mpModelMorf; - /* 0x5D0 */ int field_0x5d0; + /* 0x5C0 */ char* res_name; + /* 0x5C4 */ f32 dis; + /* 0x5C8 */ s16 target_angle; + /* 0x5CC */ mDoExt_McaMorfSO* model; + /* 0x5D0 */ int res_id; /* 0x5D4 */ f32 field_0x5d4; - /* 0x5D8 */ mDoExt_btpAnm* mBtp1; - /* 0x5DC */ mDoExt_btpAnm* mBtp2; + /* 0x5D8 */ mDoExt_btpAnm* btp; + /* 0x5DC */ mDoExt_btpAnm* btp2; /* 0x5E0 */ s16 field_0x5e0; /* 0x5E2 */ s16 field_0x5e2; /* 0x5E4 */ s8 field_0x5e4; /* 0x5E5 */ u8 field_0x5e5; - /* 0x5E6 */ s16 field_0x5e6; - /* 0x5E8 */ s16 mActionID; - /* 0x5EA */ s16 mMode; - /* 0x5EC */ u32 mShadowKey; - /* 0x5F0 */ s16 mTimers[4]; + /* 0x5E6 */ s16 count; + /* 0x5E8 */ s16 action; + /* 0x5EA */ s16 mode; + /* 0x5EC */ u32 shadow_key; + /* 0x5F0 */ s16 timer[4]; /* 0x5F8 */ s16 field_0x5f8; /* 0x5FA */ s16 field_0x5fa; /* 0x5FC */ s8 field_0x5fc; @@ -127,15 +127,15 @@ public: /* 0x630 */ int field_0x630; /* 0x634 */ f32 field_0x634; /* 0x638 */ f32 field_0x638; - /* 0x63C */ f32 field_0x63c; - /* 0x640 */ dBgS_AcchCir mAcchCir; - /* 0x680 */ dBgS_ObjAcch mObjAcch; + /* 0x63C */ f32 waterY; + /* 0x640 */ dBgS_AcchCir AcchCir; + /* 0x680 */ dBgS_ObjAcch ObjAcch; /* 0x858 */ u32 field_0x858; /* 0x85C */ u32 field_0x85c; - /* 0x860 */ Z2Creature mSound; - /* 0x8F0 */ cXyz field_0x8f0; - /* 0x8FC */ csXyz field_0x8fc; - /* 0x904 */ int field_0x904; + /* 0x860 */ Z2Creature sound; + /* 0x8F0 */ cXyz guide_path; + /* 0x8FC */ csXyz current_angle; + /* 0x904 */ int path_no; /* 0x908 */ f32 field_0x908; /* 0x90C */ s8 field_0x90c; /* 0x910 */ cXyz field_0x910; @@ -143,27 +143,27 @@ public: /* 0x928 */ f32 field_0x928; /* 0x92C */ s8 field_0x92c; /* 0x930 */ void* field_0x930; - /* 0x934 */ obj_sw_class* field_0x934; - /* 0x938 */ fpc_ProcID field_0x938; - /* 0x93C */ int field_0x93c; - /* 0x940 */ cXyz field_0x940; - /* 0x94C */ s16 field_0x94c; - /* 0x94E */ s16 field_0x94e; - /* 0x950 */ dCcD_Stts mStts; - /* 0x98C */ dCcD_Cyl field_0x98c; + /* 0x934 */ obj_sw_class* child_no; + /* 0x938 */ fpc_ProcID search_id; + /* 0x93C */ int search_time; + /* 0x940 */ cXyz find_pos; + /* 0x94C */ s16 anm_time; + /* 0x94E */ s16 hang_time; + /* 0x950 */ dCcD_Stts stts; + /* 0x98C */ dCcD_Cyl cc_cyl; /* 0xAC8 */ dCcU_AtInfo mAtInfo; // unused /* 0xAEC */ s8 field_0xaec; /* 0xAED */ s8 field_0xaed; /* 0xAEE */ s16 field_0xaee; /* 0xAF0 */ s16 field_0xaf0; - /* 0xAF4 */ dMsgFlow_c mMsgFlow; + /* 0xAF4 */ dMsgFlow_c msg_flow; /* 0xB40 */ u8 field_0xb40; /* 0xB41 */ u8 field_0xb41; - /* 0xB42 */ s16 field_0xb42; - /* 0xB44 */ s16 field_0xb44; - /* 0xB48 */ cXyz field_0xb48; + /* 0xB42 */ s16 demo_mode; + /* 0xB44 */ s16 demo_camera_no; + /* 0xB48 */ cXyz demo_way; /* 0xB54 */ cXyz field_0xb54; - /* 0xB60 */ cXyz field_0xb60; + /* 0xB60 */ cXyz demo_eye; /* 0xB6C */ cXyz field_0xb6c; /* 0xB78 */ cXyz field_0xb78; /* 0xB84 */ cXyz field_0xb84; @@ -171,14 +171,14 @@ public: /* 0xB90 */ cXyz field_0xb9c; // unused /* 0xBA8 */ cXyz field_0xba8; /* 0xBB4 */ f32 field_0xbb4; - /* 0xBB8 */ f32 field_0xbb8; + /* 0xBB8 */ f32 target_speed; /* 0xBBC */ u8 field_0xbbc[0xbc0 - 0xbbc]; /* 0xBC0 */ npc_ks_class* field_0xbc0; /* 0xBC4 */ f32 field_0xbc4; /* 0xBC8 */ cXyz field_0xbc8; /* 0xBD4 */ s16 field_0xbd4; /* 0xBD6 */ u8 field_0xbd6; - /* 0xBD7 */ s8 field_0xbd7; + /* 0xBD7 */ s8 no_draw; /* 0xBD8 */ s8 field_0xbd8; /* 0xBD9 */ s8 field_0xbd9; /* 0xBDA */ u8 field_0xbda; @@ -187,18 +187,18 @@ public: /* 0xBDD */ s8 field_0xbdd; /* 0xBDE */ s16 field_0xbde; /* 0xBE0 */ s8 field_0xbe0; - /* 0xBE4 */ u32 field_0xbe4[4]; - /* 0xBF4 */ u32 field_0xbf4; + /* 0xBE4 */ u32 w_eff[4]; + /* 0xBF4 */ u32 hammonPrtcl; /* 0xBF8 */ u8 field_0xbf8[0xbfc - 0xbf8]; - /* 0xBFC */ J3DModel* mpRoseModel; - /* 0xC00 */ J3DModel* mpStickModel; + /* 0xBFC */ J3DModel* bara_model; + /* 0xC00 */ J3DModel* stick_model; /* 0xC04 */ cXyz field_0xc04; /* 0xC10 */ f32 field_0xc10; /* 0xC14 */ s16 field_0xc14; /* 0xC16 */ s8 field_0xc16; /* 0xC17 */ s8 field_0xc17; /* 0xC18 */ dPath* field_0xc18; - /* 0xC1C */ u8 field_0xc1c; + /* 0xC1C */ u8 hio_init; }; STATIC_ASSERT(sizeof(npc_ks_class) == 0xc20); diff --git a/src/d/actor/d_a_e_mk.cpp b/src/d/actor/d_a_e_mk.cpp index 4f2b71e450e..602b8fb8127 100644 --- a/src/d/actor/d_a_e_mk.cpp +++ b/src/d/actor/d_a_e_mk.cpp @@ -1944,7 +1944,7 @@ static void demo_camera_end(e_mk_class* i_this) { static void* s_ks_sub(void* i_actor, void* i_data) { i_data; - if ((fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) && static_cast(i_actor)->field_0x5b6 == 0) { + if ((fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) && static_cast(i_actor)->set_id == 0) { return i_actor; } @@ -2026,7 +2026,7 @@ static void demo_camera_r04(e_mk_class* i_this) { cLib_addCalc2(&i_this->camStepScale1, 1.0f, 1.0f, NREG_F(4) + 0.01f); if (i_this->demoCamCounter == ZREG_S(1) + 258) { - monkey_p->mMode = 2; + monkey_p->mode = 2; pos.set(110.0f, 3300.0f, 4326.0f); player->setPlayerPosAndAngle(&pos, (s16)0xFFFF8000, 0); player->changeDemoMode(1, 1, 0, 0); @@ -2070,7 +2070,7 @@ static void demo_camera_r04(e_mk_class* i_this) { i_this->demoSubMode = 4; i_this->demoCamCounter = 0; i_this->mode = 2; - monkey_p->mMode = 20; + monkey_p->mode = 20; return; case 4: @@ -2149,7 +2149,7 @@ static void demo_camera_r04(e_mk_class* i_this) { case 6: if (i_this->demoCamCounter == ZREG_S(6) + 3) { - monkey_p->mMode = 4; + monkey_p->mode = 4; } if (i_this->demoCamCounter != ZREG_S(5) + 25) { @@ -2178,7 +2178,7 @@ static void demo_camera_r04(e_mk_class* i_this) { i_this->demoSubMode = 8; i_this->demoCamCounter = 0; - monkey_p->mMode++; + monkey_p->mode++; i_this->camEye.set(-282.0f, 2534.0f, 3147.0f); i_this->camCenter = monkey_p->actor.current.pos; i_this->camCenter.y += ZREG_F(19); @@ -2189,7 +2189,7 @@ static void demo_camera_r04(e_mk_class* i_this) { if (i_this->demoCamCounter == (s16)(XREG_S(0) + 65)) { monkey_p->actor.current.pos.set(0.0f, 3310.0f, 3427.0f); - monkey_p->mMode++; + monkey_p->mode++; i_this->demoSubMode = 9; i_this->demoCamCounter = 0; fpcM_Search(s_brg_sub2, i_this); @@ -2212,7 +2212,7 @@ static void demo_camera_r04(e_mk_class* i_this) { return; case 10: - cLib_addCalcAngleS2(&i_this->prevPlShapeAngle, monkey_p->field_0x5c8 + (u16)-0x8000, 4, 0x800); + cLib_addCalcAngleS2(&i_this->prevPlShapeAngle, monkey_p->target_angle + (u16)-0x8000, 4, 0x800); player->setPlayerPosAndAngle(&player->current.pos, i_this->prevPlShapeAngle, 0); if (i_this->demoCamCounter != 60) { diff --git a/src/d/actor/d_a_npc_ks.cpp b/src/d/actor/d_a_npc_ks.cpp index f495a1cb3d5..6e745d74c90 100644 --- a/src/d/actor/d_a_npc_ks.cpp +++ b/src/d/actor/d_a_npc_ks.cpp @@ -29,7 +29,7 @@ public: void genMessage(JORMContext*); - /* 0x04 */ s8 field_0x4; + /* 0x04 */ s8 no; /* 0x08 */ f32 basic_size; /* 0x0C */ f32 pull_distance; /* 0x10 */ f32 holding_speed_l; @@ -61,7 +61,7 @@ struct path { }; daNpc_Ks_HIO_c::daNpc_Ks_HIO_c() { - field_0x4 = -1; + no = -1; basic_size = 0.8f; pull_distance = 200.0f; holding_speed_l = 10.0f; @@ -128,16 +128,16 @@ static BOOL checkDoorDemo() { return FALSE; } -static BOOL otherBgCheck(fopAc_ac_c* p_actor, fopAc_ac_c* p_actor2) { +static BOOL otherBgCheck(fopAc_ac_c* actor, fopAc_ac_c* actor2) { dBgS_LinChk p_line; cXyz unused_cxyz, pi_start, pi_end; - pi_end = p_actor2->current.pos; + pi_end = actor2->current.pos; pi_end.y += 100.0f + KREG_F(18); - pi_start = p_actor->current.pos; + pi_start = actor->current.pos; pi_start.y += 120.0f + KREG_F(19); - p_line.Set(&pi_start, &pi_end, p_actor); + p_line.Set(&pi_start, &pi_end, actor); if (dComIfG_Bgsp().LineCross(&p_line) != 0) { return TRUE; @@ -147,7 +147,7 @@ static BOOL otherBgCheck(fopAc_ac_c* p_actor, fopAc_ac_c* p_actor2) { } static void anm_init(npc_ks_class* i_this, int param_2, f32 i_morf, u8 i_attr, f32 i_rate) { - if (i_this->field_0x94c != 0 && (param_2 == 51 || param_2 == 53)) { + if (i_this->anm_time != 0 && (param_2 == 51 || param_2 == 53)) { if (cM_rndF(1.0f) < 0.5f) { param_2 = 11; } else { @@ -182,57 +182,57 @@ static void anm_init(npc_ks_class* i_this, int param_2, f32 i_morf, u8 i_attr, f } } - i_this->mpModelMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes(i_this->mResName, param_2), i_attr, i_morf, i_rate, 0.0f, -1.0f); - i_this->field_0x5d0 = i_index; + i_this->model->setAnm((J3DAnmTransform*)dComIfG_getObjectRes(i_this->res_name, param_2), i_attr, i_morf, i_rate, 0.0f, -1.0f); + i_this->res_id = i_index; } static int nodeCallBack(J3DJoint* i_joint, int param_2) { if (param_2 == 0) { J3DJoint* my_joint = i_joint; - int jointNo = my_joint->getJntNo(); + int jnt_no = my_joint->getJntNo(); J3DModel* model = j3dSys.getModel(); - npc_ks_class* npc_ks_p = (npc_ks_class*)model->getUserArea(); - fopEn_enemy_c* base_ks_p = &npc_ks_p->actor; + npc_ks_class* i_this = (npc_ks_class*)model->getUserArea(); + fopEn_enemy_c* actor = &i_this->actor; - if (npc_ks_p != NULL) { - if (npc_ks_p->field_0x5fc == 1 && jointNo == 3) { - MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); - cMtx_YrotM(*calc_mtx, -npc_ks_p->field_0x5fe); - cMtx_XrotM(*calc_mtx, -(npc_ks_p->field_0x5fe / 2)); - cMtx_ZrotM(*calc_mtx, s16(npc_ks_p->field_0x600)); - model->setAnmMtx(jointNo, *calc_mtx); + if (i_this != NULL) { + if (i_this->field_0x5fc == 1 && jnt_no == 3) { + MTXCopy(model->getAnmMtx(jnt_no), *calc_mtx); + cMtx_YrotM(*calc_mtx, -i_this->field_0x5fe); + cMtx_XrotM(*calc_mtx, -(i_this->field_0x5fe / 2)); + cMtx_ZrotM(*calc_mtx, s16(i_this->field_0x600)); + model->setAnmMtx(jnt_no, *calc_mtx); MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); - } else if (npc_ks_p->field_0x5fc >= 2 && (jointNo == 3 || jointNo == 4)) { - MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); - if (jointNo == 3) { - cMtx_YrotM(*calc_mtx, -(npc_ks_p->field_0x5fe / 2)); - cMtx_XrotM(*calc_mtx, -(npc_ks_p->field_0x5fe / 2)); + } else if (i_this->field_0x5fc >= 2 && (jnt_no == 3 || jnt_no == 4)) { + MTXCopy(model->getAnmMtx(jnt_no), *calc_mtx); + if (jnt_no == 3) { + cMtx_YrotM(*calc_mtx, -(i_this->field_0x5fe / 2)); + cMtx_XrotM(*calc_mtx, -(i_this->field_0x5fe / 2)); } else { - cMtx_YrotM(*calc_mtx, -npc_ks_p->field_0x5fe); + cMtx_YrotM(*calc_mtx, -i_this->field_0x5fe); } - model->setAnmMtx(jointNo, *calc_mtx); + model->setAnmMtx(jnt_no, *calc_mtx); MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); } - if (npc_ks_p->field_0x5fc >= 2 && (jointNo == 1 || jointNo == 2)) { - MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); - if (jointNo == 2) { - cMtx_YrotM(*calc_mtx, npc_ks_p->field_0x602 / 2); + if (i_this->field_0x5fc >= 2 && (jnt_no == 1 || jnt_no == 2)) { + MTXCopy(model->getAnmMtx(jnt_no), *calc_mtx); + if (jnt_no == 2) { + cMtx_YrotM(*calc_mtx, i_this->field_0x602 / 2); } else { - cMtx_YrotM(*calc_mtx, npc_ks_p->field_0x602); + cMtx_YrotM(*calc_mtx, i_this->field_0x602); } - cMtx_XrotM(*calc_mtx, -npc_ks_p->field_0x5fe); - model->setAnmMtx(jointNo, *calc_mtx); + cMtx_XrotM(*calc_mtx, -i_this->field_0x5fe); + model->setAnmMtx(jnt_no, *calc_mtx); MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); } - if (jointNo == 15) { - MTXCopy(model->getAnmMtx(jointNo), *calc_mtx); - cMtx_ZrotM(*calc_mtx, npc_ks_p->field_0x606); - model->setAnmMtx(jointNo, *calc_mtx); + if (jnt_no == 15) { + MTXCopy(model->getAnmMtx(jnt_no), *calc_mtx); + cMtx_ZrotM(*calc_mtx, i_this->field_0x606); + model->setAnmMtx(jnt_no, *calc_mtx); MTXCopy(*calc_mtx, J3DSys::mCurrentMtx); } } @@ -241,46 +241,46 @@ static int nodeCallBack(J3DJoint* i_joint, int param_2) { return 1; } -static int daNpc_Ks_Draw(npc_ks_class* npc_ks) { - if (npc_ks->field_0xbd7 != 0) { - npc_ks->field_0xbd7 = 0; +static int daNpc_Ks_Draw(npc_ks_class* i_this) { + if (i_this->no_draw != 0) { + i_this->no_draw = 0; return 1; } - fopAc_ac_c* a_this = &npc_ks->actor; - J3DModel* model = npc_ks->mpModelMorf->getModel(); - if (npc_ks->mResName == "Npc_kst") { - g_env_light.settingTevStruct(4, &a_this->current.pos, &a_this->tevStr); + fopAc_ac_c* actor = &i_this->actor; + J3DModel* model = i_this->model->getModel(); + if (i_this->res_name == "Npc_kst") { + g_env_light.settingTevStruct(4, &actor->current.pos, &actor->tevStr); } else { - g_env_light.settingTevStruct(0, &a_this->current.pos, &a_this->tevStr); + g_env_light.settingTevStruct(0, &actor->current.pos, &actor->tevStr); } - g_env_light.setLightTevColorType_MAJI(model, &a_this->tevStr); + g_env_light.setLightTevColorType_MAJI(model, &actor->tevStr); - if (npc_ks->field_0x5e4 != 0) { - npc_ks->mBtp2->entry(model->getModelData()); + if (i_this->field_0x5e4 != 0) { + i_this->btp2->entry(model->getModelData()); } else { - npc_ks->mBtp1->entry(model->getModelData()); + i_this->btp->entry(model->getModelData()); } - npc_ks->mpModelMorf->entryDL(); + i_this->model->entryDL(); - if (npc_ks->field_0xc17 != 0) { - g_env_light.setLightTevColorType_MAJI(npc_ks->mpStickModel, &a_this->tevStr); - mDoExt_modelUpdateDL(npc_ks->mpStickModel); + if (i_this->field_0xc17 != 0) { + g_env_light.setLightTevColorType_MAJI(i_this->stick_model, &actor->tevStr); + mDoExt_modelUpdateDL(i_this->stick_model); } - if (npc_ks->mpRoseModel != NULL) { - g_env_light.setLightTevColorType_MAJI(npc_ks->mpRoseModel, &a_this->tevStr); - mDoExt_modelUpdateDL(npc_ks->mpRoseModel); + if (i_this->bara_model != NULL) { + g_env_light.setLightTevColorType_MAJI(i_this->bara_model, &actor->tevStr); + mDoExt_modelUpdateDL(i_this->bara_model); } - cXyz sp28; - sp28.set(a_this->current.pos.x, a_this->current.pos.y + 100.0f, a_this->current.pos.z); - npc_ks->mShadowKey = dComIfGd_setShadow(npc_ks->mShadowKey, 1, model, &sp28, 1000.0f, 0.0f, a_this->current.pos.y, - npc_ks->mObjAcch.GetGroundH(), npc_ks->mObjAcch.m_gnd, &npc_ks->actor.tevStr, + cXyz pos; + pos.set(actor->current.pos.x, actor->current.pos.y + 100.0f, actor->current.pos.z); + i_this->shadow_key = dComIfGd_setShadow(i_this->shadow_key, 1, model, &pos, 1000.0f, 0.0f, actor->current.pos.y, + i_this->ObjAcch.GetGroundH(), i_this->ObjAcch.m_gnd, &i_this->actor.tevStr, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); - if (npc_ks->field_0xc17 != 0) { - dComIfGd_addRealShadow(npc_ks->mShadowKey, npc_ks->mpStickModel); + if (i_this->field_0xc17 != 0) { + dComIfGd_addRealShadow(i_this->shadow_key, i_this->stick_model); } return 1; @@ -289,7 +289,7 @@ static int daNpc_Ks_Draw(npc_ks_class* npc_ks) { static void* s_resq_sub(void* i_actor, void* i_data) { (void) i_data; if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) { - ((npc_ks_class*)i_actor)->field_0x94c = cM_rndF(50.0f) + 220.0f; + ((npc_ks_class*)i_actor)->anm_time = cM_rndF(50.0f) + 220.0f; } return NULL; }; @@ -352,7 +352,7 @@ static int target_bgc[10]; #endif static fopAc_ac_c* search_bomb(npc_ks_class* i_this, int param_2) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* actor_p; target_info_count = 0; @@ -369,19 +369,19 @@ static fopAc_ac_c* search_bomb(npc_ks_class* i_this, int param_2) { int i = 0; while (i < target_info_count) { actor_p = (fopAc_ac_c*)target_info[i]; - sp4c.x = actor_p->current.pos.x - a_this->eyePos.x; - sp4c.y = (actor_p->current.pos.y + 50.0f) - a_this->eyePos.y; - sp4c.z = actor_p->current.pos.z - a_this->eyePos.z; + sp4c.x = actor_p->current.pos.x - actor->eyePos.x; + sp4c.y = (actor_p->current.pos.y + 50.0f) - actor->eyePos.y; + sp4c.z = actor_p->current.pos.z - actor->eyePos.z; f32 sq_rt = JMAFastSqrt(sp4c.x * sp4c.x + sp4c.z * sp4c.z); if (sq_rt < fVar1) { if (param_2 == 0) { return actor_p; } - if (target_bgc[i] != 0 || fopAcM_otherBgCheck(a_this, actor_p)) { + if (target_bgc[i] != 0 || fopAcM_otherBgCheck(actor, actor_p)) { target_bgc[i] = 1; } else if (NPC_KS_FABSF(sp4c.y) <= 300.0f) { - s16 sVar1 = a_this->shape_angle.y - cM_atan2s(sp4c.x, sp4c.z); + s16 sVar1 = actor->shape_angle.y - cM_atan2s(sp4c.x, sp4c.z); if (sVar1 < 0) { sVar1 = -1 * sVar1; } @@ -409,12 +409,12 @@ static fopAc_ac_c* search_bomb(npc_ks_class* i_this, int param_2) { } static fopAc_ac_c* bomb_view_check(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; return search_bomb(i_this, 1); } static fopAc_ac_c* bomb_check(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; return search_bomb(i_this, 0); } @@ -428,7 +428,7 @@ static void* s_e_sub(void* i_actor, void* i_data) { } static fopAc_ac_c* search_enemy(npc_ks_class* i_this, int param_2, f32 param_3) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* enemy_p; if (dComIfGp_event_runCheck()) { if (fopAcM_getTalkEventPartner(daPy_getLinkPlayerActorClass()) != (fopAc_ac_c *)daPy_py_c::getMidnaActor()) { @@ -446,28 +446,28 @@ static fopAc_ac_c* search_enemy(npc_ks_class* i_this, int param_2, f32 param_3) f32 fVar1 = 50.0f; f32 fVar2 = 300.0f; // boss key room - if (fopAcM_GetRoomNo(a_this) == 1) { + if (fopAcM_GetRoomNo(actor) == 1) { fVar2 = 800.0f; } if (target_info_count != 0) { - cXyz sp68, unused_cxyz; + cXyz mae, unused_cxyz; int i = 0; while (i < target_info_count) { enemy_p = (fopAc_ac_c*)target_info[i]; - sp68.x = enemy_p->current.pos.x - a_this->eyePos.x; - sp68.y = (enemy_p->current.pos.y + 50.0f) - a_this->eyePos.y; - sp68.z = enemy_p->current.pos.z - a_this->eyePos.z; - f32 square_root = JMAFastSqrt(sp68.x * sp68.x + sp68.z * sp68.z); + mae.x = enemy_p->current.pos.x - actor->eyePos.x; + mae.y = (enemy_p->current.pos.y + 50.0f) - actor->eyePos.y; + mae.z = enemy_p->current.pos.z - actor->eyePos.z; + f32 square_root = JMAFastSqrt(mae.x * mae.x + mae.z * mae.z); if (square_root < fVar1) { if (param_2 == 0) { return enemy_p; } - if (target_bgc[i] != 0 || fopAcM_otherBgCheck(a_this, enemy_p)) { + if (target_bgc[i] != 0 || fopAcM_otherBgCheck(actor, enemy_p)) { target_bgc[i] = 1; - } else if (NPC_KS_FABSF(sp68.y) <= fVar2) { - s16 sVar1 = a_this->shape_angle.y - cM_atan2s(sp68.x, sp68.z); + } else if (NPC_KS_FABSF(mae.y) <= fVar2) { + s16 sVar1 = actor->shape_angle.y - cM_atan2s(mae.x, mae.z); if (sVar1 < 0) { sVar1 = -1 * sVar1; } @@ -495,12 +495,12 @@ static fopAc_ac_c* search_enemy(npc_ks_class* i_this, int param_2, f32 param_3) } static fopAc_ac_c* enemy_view_check(npc_ks_class* i_this, f32 param_2) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; return search_enemy(i_this, 1, param_2); } static fopAc_ac_c* enemy_check(npc_ks_class* i_this, f32 param_2) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; return search_enemy(i_this, 0, param_2); } @@ -514,7 +514,7 @@ static void* s_en_sub(void* i_actor, void* i_data) { } static fopAc_ac_c* en_search_test(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; target_info_count = 0; for (int i = 0; i < 10; i++) { target_info[i] = NULL; @@ -524,12 +524,12 @@ static fopAc_ac_c* en_search_test(npc_ks_class* i_this) { f32 fVar1 = 50.0f; if (target_info_count != 0) { - cXyz sp4c; + cXyz mae; int i = 0; while (i < target_info_count) { fopAc_ac_c* actor_p = (fopAc_ac_c*)target_info[i]; - sp4c = actor_p->current.pos - a_this->current.pos; - f32 abs = sp4c.abs(); + mae = actor_p->current.pos - actor->current.pos; + f32 abs = mae.abs(); if (abs < fVar1) { return actor_p; } @@ -559,40 +559,40 @@ static void* s_ori_sub(void* i_actor, void* i_data) { } static void npc_ks_pole_ori(npc_ks_class* i_this) { - obj_so_class* monkeycage_p; + obj_so_class* cage; if (leader != NULL) { - fopAc_ac_c* a_this = &i_this->actor; - if (i_this->mMode == 0) { - monkeycage_p = (obj_so_class*)fpcM_Search(s_ori_sub, i_this); - if (monkeycage_p != NULL) { - a_this->parentActorID = fopAcM_GetID(monkeycage_p); + fopAc_ac_c* actor = &i_this->actor; + if (i_this->mode == 0) { + cage = (obj_so_class*)fpcM_Search(s_ori_sub, i_this); + if (cage != NULL) { + actor->parentActorID = fopAcM_GetID(cage); anm_init(i_this, 20, 5.0f, 2, 1.0f); - i_this->mMode++; - i_this->mMode = 1; + i_this->mode++; + i_this->mode = 1; } else { return; } } - monkeycage_p = (obj_so_class*) fopAcM_SearchByID(a_this->parentActorID); - if (monkeycage_p != NULL) { - if (monkeycage_p->actor.health == 0) { - i_this->mActionID = 201; - i_this->mMode = 10; + cage = (obj_so_class*) fopAcM_SearchByID(actor->parentActorID); + if (cage != NULL) { + if (cage->actor.health == 0) { + i_this->action = 201; + i_this->mode = 10; dComIfGs_onTbox(i_this->bitTRB); } else { - if (i_this->mMode < 10 && monkeycage_p->field_0xdae != 0) { - i_this->mMode = 10; - i_this->mpModelMorf->setPlaySpeed(0.0f); + if (i_this->mode < 10 && cage->field_0xdae != 0) { + i_this->mode = 10; + i_this->model->setPlaySpeed(0.0f); } - switch (i_this->mMode) { + switch (i_this->mode) { case 1: { - if (i_this->mpModelMorf->checkFrame(5.0f) || i_this->mpModelMorf->checkFrame(20.0f)) { - monkeycage_p->field_0xdc8 += 400.0f + KREG_F(9); - monkeycage_p->field_0xdac = 0; - i_this->mSound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_PRISONED, -1); + if (i_this->model->checkFrame(5.0f) || i_this->model->checkFrame(20.0f)) { + cage->field_0xdc8 += 400.0f + KREG_F(9); + cage->field_0xdac = 0; + i_this->sound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_PRISONED, -1); } break; @@ -603,19 +603,19 @@ static void npc_ks_pole_ori(npc_ks_class* i_this) { } } - a_this->current.angle.y = monkeycage_p->actor.shape_angle.y; - a_this->current.angle.x = monkeycage_p->actor.shape_angle.x; - a_this->current.pos = monkeycage_p->actor.current.pos; - a_this->current.pos.y += TREG_F(3); + actor->current.angle.y = cage->actor.shape_angle.y; + actor->current.angle.x = cage->actor.shape_angle.x; + actor->current.pos = cage->actor.current.pos; + actor->current.pos.y += TREG_F(3); - if (leader->field_0xb42 == 0) { - if (!dComIfGs_isSwitch(20, fopAcM_GetRoomNo(a_this))) { - cXyz sp2c(11497.0f, 3764.0f, 3810.0f); + if (leader->demo_mode == 0) { + if (!dComIfGs_isSwitch(20, fopAcM_GetRoomNo(actor))) { + cXyz ato(11497.0f, 3764.0f, 3810.0f); daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - sp2c -= player->current.pos; - sp2c.y = 0.0f; - if (sp2c.abs() < 300.0f) { - leader->field_0xb42 = 110; + ato -= player->current.pos; + ato.y = 0.0f; + if (ato.abs() < 300.0f) { + leader->demo_mode = 110; } } } @@ -625,33 +625,33 @@ static void npc_ks_pole_ori(npc_ks_class* i_this) { } static int npc_ks_ori(npc_ks_class* i_this) { - fopAc_ac_c* a_this = (fopAc_ac_c*)i_this; - cXyz sp30, sp3c; + fopAc_ac_c* actor = (fopAc_ac_c*)i_this; + cXyz mae, ato; int rv = 0; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 21, 10.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->mTimers[0] = cM_rndF(200.0f) + 100.0f; + i_this->mode = 1; + i_this->timer[0] = cM_rndF(200.0f) + 100.0f; break; case 1: - if (i_this->mpModelMorf->checkFrame(5.0f) || i_this->mpModelMorf->checkFrame(20.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_PRISONED, -1); - i_this->mSound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); + if (i_this->model->checkFrame(5.0f) || i_this->model->checkFrame(20.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_PRISONED, -1); + i_this->sound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); } - if (i_this->mTimers[0] == 0 && i_this->mpModelMorf->checkFrame(99.0f)) { - i_this->mMode = 2; + if (i_this->timer[0] == 0 && i_this->model->checkFrame(99.0f)) { + i_this->mode = 2; anm_init(i_this, 7, 5.0f, 0, 1.0f); - i_this->mTimers[0] = cM_rndF(60.0f) + 40.0f; + i_this->timer[0] = cM_rndF(60.0f) + 40.0f; } break; case 2: - if (i_this->mpModelMorf->isStop()) { - if (i_this->mTimers[0] == 0) { - i_this->mMode = 0; + if (i_this->model->isStop()) { + if (i_this->timer[0] == 0) { + i_this->mode = 0; } else { anm_init(i_this, 7, 5.0f, 0, 1.0f); } @@ -659,99 +659,99 @@ static int npc_ks_ori(npc_ks_class* i_this) { break; case 10: - cMtx_YrotS(*calc_mtx, a_this->current.angle.y); - sp30.x = 0.0f; - sp30.y = 0.0f; - sp30.z = a_this->speedF; - MtxPosition(&sp30, &sp3c); - a_this->current.pos += sp3c; + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = actor->speedF; + MtxPosition(&mae, &ato); + actor->current.pos += ato; - if (i_this->mTimers[1] == 1) { - a_this->speedF = 0.0f; + if (i_this->timer[1] == 1) { + actor->speedF = 0.0f; anm_init(i_this, 51, 5.0f, 2, 1.0f); } - if (i_this->mTimers[0] == 0) { - a_this->health = 0; - i_this->mActionID = 100; - i_this->mTimers[0] = 20; - i_this->mMode = 11; - i_this->field_0x8fc.y = i_this->field_0x5c8; - fopAcM_setStageLayer(a_this); + if (i_this->timer[0] == 0) { + actor->health = 0; + i_this->action = 100; + i_this->timer[0] = 20; + i_this->mode = 11; + i_this->current_angle.y = i_this->target_angle; + fopAcM_setStageLayer(actor); fpcM_Search(s_resq_sub, i_this); } break; case 11: rv = 1; - if (i_this->mTimers[1] != 0) { - a_this->speedF = -20.0f + NREG_F(11); + if (i_this->timer[1] != 0) { + actor->speedF = -20.0f + NREG_F(11); } else { - a_this->speedF = 0.0f; + actor->speedF = 0.0f; } - if (i_this->mTimers[0] == 50) { + if (i_this->timer[0] == 50) { anm_init(i_this, 11, 3.0f, 2, 1.0f); } - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mTimers[0] = 15; - i_this->mMode++; + i_this->timer[0] = 15; + i_this->mode++; } break; case 12: rv = 1; - if (i_this->mTimers[0] == 1) { + if (i_this->timer[0] == 1) { anm_init(i_this, 32, 2.0f, 0, 1.0f); - if (fopAcM_GetRoomNo(a_this) == 11) { - a_this->current.angle.y += NPC_KS_36DEG_ROT; + if (fopAcM_GetRoomNo(actor) == 11) { + actor->current.angle.y += NPC_KS_36DEG_ROT; } } - if (i_this->field_0x5d0 == 26) { - a_this->speedF = 20.0f; + if (i_this->res_id == 26) { + actor->speedF = 20.0f; } - if (i_this->field_0x5d0 == 32 && i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 32 && i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f; - a_this->speed.y = 35.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f; + actor->speed.y = 35.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; - i_this->mMode++; - i_this->mTimers[0] = 50; + i_this->mode++; + i_this->timer[0] = 50; } break; case 13: rv = 1; - a_this->gravity = -5.0f; - if (i_this->mTimers[0] == 0 || !dComIfGp_event_runCheck()) { - fopAcM_delete(a_this); + actor->gravity = -5.0f; + if (i_this->timer[0] == 0 || !dComIfGp_event_runCheck()) { + fopAcM_delete(actor); } } - if (i_this->mMode < 10) { - int swBit = (fopAcM_GetParam(a_this) & 0xFF000000) >> 24; + if (i_this->mode < 10) { + int swBit = (fopAcM_GetParam(actor) & 0xFF000000) >> 24; if (swBit != 0xFF) { - if (dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(a_this))) { + if (dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(actor))) { dComIfGs_onTbox(i_this->bitTRB); - if (i_this->field_0x5b6 >= 5) { - i_this->mMode = 11; - i_this->mTimers[0] = 80; + if (i_this->set_id >= 5) { + i_this->mode = 11; + i_this->timer[0] = 80; anm_init(i_this, 51 ,5.0f, 2, 1.0f); - if (fopAcM_GetRoomNo(a_this) == 11) { - i_this->mTimers[1] = 10; + if (fopAcM_GetRoomNo(actor) == 11) { + i_this->timer[1] = 10; } } else { - i_this->mMode = 10; - a_this->speedF = -10.0f + NREG_F(11); - i_this->mTimers[0] = 110 + nREG_S(2); - i_this->mTimers[1] = 15; + i_this->mode = 10; + actor->speedF = -10.0f + NREG_F(11); + i_this->timer[0] = 110 + nREG_S(2); + i_this->timer[1] = 15; } } } @@ -767,8 +767,8 @@ static void* shot_bo_sub(void* i_actor, void* i_data) { fopAc_ac_c* player = dComIfGp_getPlayer(0); if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_BOOMERANG && dComIfGp_checkPlayerStatus0(0, 0x80000) == 0 && fopAcM_GetParam(i_actor) == 1) { - cXyz sp28(((daBoomerang_c*)i_actor)->current.pos - ((fopAc_ac_c*)i_data)->current.pos); - if (sp28.abs() < 1000.0f) { + cXyz ato(((daBoomerang_c*)i_actor)->current.pos - ((fopAc_ac_c*)i_data)->current.pos); + if (ato.abs() < 1000.0f) { return i_actor; } } @@ -787,61 +787,61 @@ static path guide_path_04[7] = { }; static int npc_ks_ori2(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; obj_so_class* cage_p; int rv = 1; - if (i_this->mMode == 0) { + if (i_this->mode == 0) { cage_p = (obj_so_class*)fpcM_Search(s_ori_sub, i_this); if (cage_p != NULL) { - a_this->parentActorID = fopAcM_GetID(cage_p); + actor->parentActorID = fopAcM_GetID(cage_p); anm_init(i_this, 20, 5.0f, 2, 1.0f); - i_this->mMode = 1; - a_this->home.angle.y = cage_p->actor.shape_angle.y; - i_this->field_0xbde = i_this->field_0x5c8 - a_this->home.angle.y; + i_this->mode = 1; + actor->home.angle.y = cage_p->actor.shape_angle.y; + i_this->field_0xbde = i_this->target_angle - actor->home.angle.y; } return rv; } - cage_p = (obj_so_class*)fopAcM_SearchByID(a_this->parentActorID); + cage_p = (obj_so_class*)fopAcM_SearchByID(actor->parentActorID); if (cage_p == NULL) { return rv; } - a_this->home.angle.y = cage_p->actor.shape_angle.y; + actor->home.angle.y = cage_p->actor.shape_angle.y; - if (i_this->mMode <= 2 && cage_p->field_0x1054 != 0) { - i_this->mMode = 3; - i_this->mTimers[0] = 90; - int swBit = (fopAcM_GetParam(a_this) & 0xFF000000) >> 24; - dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(a_this)); + if (i_this->mode <= 2 && cage_p->field_0x1054 != 0) { + i_this->mode = 3; + i_this->timer[0] = 90; + int swBit = (fopAcM_GetParam(actor) & 0xFF000000) >> 24; + dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(actor)); dComIfGs_onTbox(i_this->bitTRB); - if (fopAcM_GetRoomNo(a_this) == 4) { - i_this->field_0xb42 = 70; - } else if (fopAcM_GetRoomNo(a_this) == 19) { - i_this->field_0xb42 = 75; - } else if (fopAcM_GetRoomNo(a_this) == 22) { - i_this->field_0xb42 = 72; + if (fopAcM_GetRoomNo(actor) == 4) { + i_this->demo_mode = 70; + } else if (fopAcM_GetRoomNo(actor) == 19) { + i_this->demo_mode = 75; + } else if (fopAcM_GetRoomNo(actor) == 22) { + i_this->demo_mode = 72; } return rv; } - cXyz sp40; - s16 sVar1 = i_this->field_0xbde - 1000 + TREG_S(8) + a_this->home.angle.y; + cXyz mae; + s16 sVar1 = i_this->field_0xbde - 1000 + TREG_S(8) + actor->home.angle.y; f32 fVar1 = 0.0f; - switch (i_this->mMode) { + switch (i_this->mode) { case 1: - if (i_this->mpModelMorf->checkFrame(46.0f + TREG_F(11))) { - i_this->field_0xbde = i_this->field_0x5c8 - a_this->home.angle.y & -0x2000 + TREG_S(7); + if (i_this->model->checkFrame(46.0f + TREG_F(11))) { + i_this->field_0xbde = i_this->target_angle - actor->home.angle.y & -0x2000 + TREG_S(7); } - if (i_this->mpModelMorf->checkFrame(5.0f) || i_this->mpModelMorf->checkFrame(20.0f)) { + if (i_this->model->checkFrame(5.0f) || i_this->model->checkFrame(20.0f)) { cage_p->field_0xdc8 += 100.0f + KREG_F(9); cage_p->field_0xdac = 0; - i_this->mSound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); + i_this->sound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); } if (enemy_check(i_this, 400.0f) == NULL) { @@ -849,69 +849,69 @@ static int npc_ks_ori2(npc_ks_class* i_this) { } anm_init(i_this, 41, 5.0f, 2, 1.0f); - i_this->mMode = 2; - i_this->mTimers[0] = cM_rndF(20.0f) + 40.0f; + i_this->mode = 2; + i_this->timer[0] = cM_rndF(20.0f) + 40.0f; break; case 2: sVar1 += NPC_KS_NEG_180DEG_ROT; - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if (cage_p->partBreak()) { anm_init(i_this, 22, 5.0f, 2, 1.0f); } else { anm_init(i_this, 20, 5.0f, 2, 1.0f); } - i_this->mMode = 1; + i_this->mode = 1; } else { if (enemy_check(i_this, 400.0f) == NULL) { if (daPy_getPlayerActorClass()->getCutAtFlg() == 0) break; } - i_this->mTimers[0] = cM_rndF(20.0f) + 40.0f; + i_this->timer[0] = cM_rndF(20.0f) + 40.0f; } break; case 3: fVar1 = -20.0f; - if (i_this->mTimers[0] == 50) { + if (i_this->timer[0] == 50) { anm_init(i_this, 51, 3.0f, 2, 1.0f); } - if (i_this->mTimers[0] < 50) { - cMtx_YrotS(*calc_mtx, a_this->shape_angle.y); - if (i_this->mTimers[0] < 25) { - sp40.x = 200.0f; + if (i_this->timer[0] < 50) { + cMtx_YrotS(*calc_mtx, actor->shape_angle.y); + if (i_this->timer[0] < 25) { + mae.x = 200.0f; } else { - sp40.x = -200.0f; + mae.x = -200.0f; } - sp40.y = 50.0f + KREG_F(11); - sp40.z = 50.0f; - MtxPosition(&sp40, &i_this->field_0x940); - i_this->field_0x940 += a_this->current.pos; - i_this->field_0x93c = 20; + mae.y = 50.0f + KREG_F(11); + mae.z = 50.0f; + MtxPosition(&mae, &i_this->find_pos); + i_this->find_pos += actor->current.pos; + i_this->search_time = 20; } - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { anm_init(i_this, 30, 5.0f, 2, 1.0f); - i_this->mMode = 4; - i_this->mTimers[0] = 60; - i_this->field_0x93c = 0; + i_this->mode = 4; + i_this->timer[0] = 60; + i_this->search_time = 0; } break; case 4: fVar1 = -20.0f; i_this->field_0x5fc = 0; - if (i_this->mTimers[0] == 0) { - if (fopAcM_GetRoomNo(a_this) == 22) { - i_this->mActionID = 116; - i_this->mMode = 0; + if (i_this->timer[0] == 0) { + if (fopAcM_GetRoomNo(actor) == 22) { + i_this->action = 116; + i_this->mode = 0; i_this->field_0xaec = 1; - } else if (fopAcM_GetRoomNo(a_this) == 4) { - i_this->mMode = 10; + } else if (fopAcM_GetRoomNo(actor) == 4) { + i_this->mode = 10; } else { - i_this->mMode = 5; + i_this->mode = 5; } } break; @@ -920,53 +920,53 @@ static int npc_ks_ori2(npc_ks_class* i_this) { i_this->field_0x5fc = 0; fVar1 = -20.0f; anm_init(i_this, 32, 2.0f, 0, 1.0f); - i_this->mMode++; + i_this->mode++; break; case 6: i_this->field_0x5fc = 0; fVar1 = -20.0f; sVar1 += NPC_KS_45DEG_ROT; - if (i_this->mpModelMorf->isStop()) { + if (i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f; - a_this->speed.y = 35.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f; + actor->speed.y = 35.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; - i_this->mMode++; + i_this->mode++; } break; case 7: i_this->field_0x5fc = 0; sVar1 += NPC_KS_90DEG_ROT; - a_this->gravity = -5.0f; + actor->gravity = -5.0f; break; case 10: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 11; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 11; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 11: - if (guide_path_04[i_this->field_0x904].field_0x0 != 0) { - i_this->field_0x8f0.x = guide_path_04[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.y = guide_path_04[i_this->field_0x904].field_0x8; - i_this->field_0x8f0.z = guide_path_04[i_this->field_0x904].field_0xc; - i_this->field_0x910 = a_this->current.pos; - i_this->field_0x91c = i_this->field_0x8f0; - i_this->mMode = 12; + if (guide_path_04[i_this->path_no].field_0x0 != 0) { + i_this->guide_path.x = guide_path_04[i_this->path_no].field_0x4; + i_this->guide_path.y = guide_path_04[i_this->path_no].field_0x8; + i_this->guide_path.z = guide_path_04[i_this->path_no].field_0xc; + i_this->field_0x910 = actor->current.pos; + i_this->field_0x91c = i_this->guide_path; + i_this->mode = 12; anm_init(i_this, 32, 2.0f, 0, 1.0f); - a_this->speedF = 0.0f; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_04[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_04[i_this->field_0x904].field_0xc; - i_this->mMode = 15; - a_this->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + i_this->guide_path.x = guide_path_04[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_04[i_this->path_no].field_0xc; + i_this->mode = 15; + actor->speedF = l_HIO.demo_speed_2; + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } @@ -974,62 +974,62 @@ static int npc_ks_ori2(npc_ks_class* i_this) { case 12: rv = 2; - if (i_this->field_0x5d0 == 32 && i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 32 && i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f + TREG_F(9); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f + TREG_F(9); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; } - sp40 = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp40.x, sp40.z); - i_this->field_0x8fc.x = -cM_atan2s(sp40.y, JMAFastSqrt(sp40.x * sp40.x + sp40.z * sp40.z)); - if (sp40.abs() < a_this->speedF * 1.2f) { - a_this->current.pos = i_this->field_0x8f0; - i_this->mMode = 11; + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); + if (mae.abs() < actor->speedF * 1.2f) { + actor->current.pos = i_this->guide_path; + i_this->mode = 11; i_this->field_0xbe0 = 1; - i_this->field_0x904++; - if (guide_path_04[i_this->field_0x904].field_0x0 < 0) { - fopAcM_delete(a_this); + i_this->path_no++; + if (guide_path_04[i_this->path_no].field_0x0 < 0) { + fopAcM_delete(actor); } } break; case 15: - sp40.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp40.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp40.x, sp40.z); - if (JMAFastSqrt(sp40.x * sp40.x + sp40.z * sp40.z) < (a_this->speedF * 1.2f)) { - i_this->field_0x904++; - i_this->mMode = 11; + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < (actor->speedF * 1.2f)) { + i_this->path_no++; + i_this->mode = 11; } } - if (i_this->mMode >= 10) { + if (i_this->mode >= 10) { i_this->field_0x5fc = 0; - sVar1 = i_this->field_0x8fc.y; - if (a_this->speedF > 25.0f) { + sVar1 = i_this->current_angle.y; + if (actor->speedF > 25.0f) { i_this->field_0x90c = 1; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, sVar1, 2, 0x2000); + cLib_addCalcAngleS2(&actor->current.angle.y, sVar1, 2, 0x2000); - if (i_this->mMode < 7) { - a_this->current.angle.x = cage_p->actor.shape_angle.x; - a_this->current.pos = cage_p->actor.current.pos; - a_this->current.pos.y += fVar1; + if (i_this->mode < 7) { + actor->current.angle.x = cage_p->actor.shape_angle.x; + actor->current.pos = cage_p->actor.current.pos; + actor->current.pos.y += fVar1; } return rv; } static void npc_ks_home(npc_ks_class* i_this) { - fopAc_ac_c* a_this = (fopAc_ac_c*)i_this; - cXyz sp2c, sp38; - switch (i_this->mMode) { + fopAc_ac_c* actor = (fopAc_ac_c*)i_this; + cXyz mae, ato; + switch (i_this->mode) { case 0: if (cM_rndF(1.0f) < 0.5f) { anm_init(i_this, 30, 3.0f, 0, 1.0f); @@ -1037,40 +1037,40 @@ static void npc_ks_home(npc_ks_class* i_this) { anm_init(i_this, 5, 3.0f, 0, 1.0f); } - i_this->mMode = 1; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_WAIT, -1); + i_this->mode = 1; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WAIT, -1); break; case 1: - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 0; + if (i_this->model->isStop()) { + i_this->mode = 0; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x5c8, 2, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->target_angle, 2, 0x800); if (checkDoorDemo() != 0) { - int roomNo = fopAcM_GetRoomNo(a_this); - int nextStayNo = dStage_roomControl_c::getNextStayNo(); - if (roomNo == 0 && nextStayNo == 4) { - i_this->mActionID = 100; - i_this->mMode = 0; - i_this->field_0x904 = 0; + int room_no = fopAcM_GetRoomNo(actor); + int stay_no = dStage_roomControl_c::getNextStayNo(); + if (room_no == 0 && stay_no == 4) { + i_this->action = 100; + i_this->mode = 0; + i_this->path_no = 0; i_this->field_0xaec = 1; - if (fopAcM_CheckCondition(a_this, 4) != 0) { + if (fopAcM_CheckCondition(actor, 4) != 0) { camera_class* camera = dComIfGp_getCamera(0); - sp2c.x = camera->lookat.eye.x - camera->lookat.center.x; - sp2c.z = camera->lookat.eye.z - camera->lookat.center.z; - cMtx_YrotS(*calc_mtx, cM_atan2s(sp2c.x, sp2c.z)); - if ((i_this->field_0x5b6 & 1) != 0) { - sp2c.x = 100.0f; + mae.x = camera->lookat.eye.x - camera->lookat.center.x; + mae.z = camera->lookat.eye.z - camera->lookat.center.z; + cMtx_YrotS(*calc_mtx, cM_atan2s(mae.x, mae.z)); + if ((i_this->set_id & 1) != 0) { + mae.x = 100.0f; } else { - sp2c.x = -100.0f; + mae.x = -100.0f; } - sp2c.y = -50.0f; - sp2c.z = 200.0f; - MtxPosition(&sp2c, &sp38); - a_this->current.pos = camera->lookat.eye + sp38; - a_this->old = a_this->current; + mae.y = -50.0f; + mae.z = 200.0f; + MtxPosition(&mae, &ato); + actor->current.pos = camera->lookat.eye + ato; + actor->old = actor->current; } } } @@ -1079,7 +1079,7 @@ static void npc_ks_home(npc_ks_class* i_this) { static void* s_sw_sub(void* i_actor, void* i_data) { if ((fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_OBJ_SW)) { if (fopAcM_GetRoomNo((fopAc_ac_c*)i_data) == 0) { - if (((npc_ks_class*)i_data)->field_0x5b6 == ((obj_sw_class*)i_actor)->field_0x570) { + if (((npc_ks_class*)i_data)->set_id == ((obj_sw_class*)i_actor)->field_0x570) { return i_actor; } } else { @@ -1099,7 +1099,7 @@ static void* s_ha_sub(void* i_actor, void* i_data) { static void* s_01_sub(void* i_actor, void* i_data) { (void) i_data; - if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS && ((npc_ks_class*)i_actor)->mActionID == 4) { + if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS && ((npc_ks_class*)i_actor)->action == 4) { return i_actor; } return NULL; @@ -1114,10 +1114,10 @@ static path move_path_02[5] = { }; static int npc_ks_demo_02(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* unused_p = dComIfGp_getPlayer(0); - cXyz sp3c, sp48; - f32 fVar1 = 0.0f; + cXyz mae, ato; + f32 speed = 0.0f; int rv = 1; int iVar1 = 0; @@ -1126,99 +1126,99 @@ static int npc_ks_demo_02(npc_ks_class* i_this) { return 0; } - if (cage_p->field_0xdae != 0 && i_this->mMode < 17) { - i_this->mActionID = 201; - i_this->mMode = 0; + if (cage_p->field_0xdae != 0 && i_this->mode < 17) { + i_this->action = 201; + i_this->mode = 0; return 0; } - daPillar_c* pillar_p = (daPillar_c*)fpcM_Search(s_ha_sub, i_this); - if (pillar_p == NULL) { + daPillar_c* hasira_p = (daPillar_c*)fpcM_Search(s_ha_sub, i_this); + if (hasira_p == NULL) { return 0; } - fopAc_ac_c* a_pill_p = pillar_p; + fopAc_ac_c* hasira_actor = hasira_p; - switch (i_this->mMode) { + switch (i_this->mode) { int _; case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; + i_this->mode = 1; + i_this->path_no = 0; // fallthrough case 1: - i_this->field_0x8f0.x = move_path_02[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.y = move_path_02[i_this->field_0x904].field_0x8; - i_this->field_0x8f0.z = move_path_02[i_this->field_0x904].field_0xc; - i_this->mMode = 2; + i_this->guide_path.x = move_path_02[i_this->path_no].field_0x4; + i_this->guide_path.y = move_path_02[i_this->path_no].field_0x8; + i_this->guide_path.z = move_path_02[i_this->path_no].field_0xc; + i_this->mode = 2; // fallthrough case 2: - fVar1 = l_HIO.demo_speed; - sp3c = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp3c.x, sp3c.z); - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 2, 0x1000); - sp3c.y = 0.0f; - if (sp3c.abs() <= a_this->speedF * 2.0f) { - i_this->field_0x904++; - if (i_this->field_0x904 < 5) { - i_this->mMode = 1; + speed = l_HIO.demo_speed; + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 2, 0x1000); + mae.y = 0.0f; + if (mae.abs() <= actor->speedF * 2.0f) { + i_this->path_no++; + if (i_this->path_no < 5) { + i_this->mode = 1; } else { - i_this->mMode = 10; + i_this->mode = 10; anm_init(i_this, 25, 5.0f, 2, 1.0f); - i_this->mTimers[0] = 35; + i_this->timer[0] = 35; } } break; case 10: - cLib_addCalcAngleS2(&a_this->current.angle.y, cage_p->actor.shape_angle.y + 0x8000, 2, 0x1000); - if (i_this->mTimers[0] == 0) { - i_this->mMode = 11; + cLib_addCalcAngleS2(&actor->current.angle.y, cage_p->actor.shape_angle.y + 0x8000, 2, 0x1000); + if (i_this->timer[0] == 0) { + i_this->mode = 11; anm_init(i_this, 26, 5.0f, 2, 1.0f); } break; case 11: rv = 0; - fVar1 = l_HIO.demo_speed; + speed = l_HIO.demo_speed; cMtx_YrotS(*calc_mtx, cage_p->actor.shape_angle.y); - sp3c.x = 0.0f; - sp3c.y = 0.0f; - sp3c.z = (90.0f + NREG_F(1)) * cage_p->actor.scale.x; - MtxPosition(&sp3c, &sp48); - sp48 += cage_p->actor.current.pos; - cLib_addCalc2(&a_this->current.pos.x, sp48.x, 1.0f, a_this->speedF); - cLib_addCalc2(&a_this->current.pos.z, sp48.z, 1.0f, a_this->speedF); - sp3c.x = sp48.x - a_this->current.pos.x; - sp3c.z = sp48.z - a_this->current.pos.z; - sp3c.y = JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z); - if (sp3c.y < 55.0f && i_this->field_0x5d0 != 12) { + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = (90.0f + NREG_F(1)) * cage_p->actor.scale.x; + MtxPosition(&mae, &ato); + ato += cage_p->actor.current.pos; + cLib_addCalc2(&actor->current.pos.x, ato.x, 1.0f, actor->speedF); + cLib_addCalc2(&actor->current.pos.z, ato.z, 1.0f, actor->speedF); + mae.x = ato.x - actor->current.pos.x; + mae.z = ato.z - actor->current.pos.z; + mae.y = JMAFastSqrt(mae.x * mae.x + mae.z * mae.z); + if (mae.y < 55.0f && i_this->res_id != 12) { anm_init(i_this, 12, 3.0f, 2, 1.0f); } - if (sp3c.y < 1.0f + NREG_F(0)) { - i_this->mMode = 12; - a_this->current.angle.y = cage_p->actor.shape_angle.y + 0x8000; + if (mae.y < 1.0f + NREG_F(0)) { + i_this->mode = 12; + actor->current.angle.y = cage_p->actor.shape_angle.y + 0x8000; } break; case 12: rv = 0; iVar1 = 1; - fVar1 = l_HIO.demo_speed; + speed = l_HIO.demo_speed; cMtx_YrotS(*calc_mtx, cage_p->actor.shape_angle.y); - sp3c.x = 0.0f; - sp3c.y = 0.0f; - sp3c.z = 90.0f + NREG_F(1); - MtxPosition(&sp3c, &sp48); - sp48 += cage_p->actor.current.pos; - cLib_addCalc2(&a_this->current.pos.x, sp48.x, 1.0f, a_this->speedF); - cLib_addCalc2(&a_this->current.pos.y, sp48.y, 1.0f, a_this->speedF); - cLib_addCalc2(&a_this->current.pos.z, sp48.z, 1.0f, a_this->speedF); - sp3c = sp48 - a_this->current.pos; - if (sp3c.abs() < 1.0f + NREG_F(0)) { - i_this->mMode = 13; + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = 90.0f + NREG_F(1); + MtxPosition(&mae, &ato); + ato += cage_p->actor.current.pos; + cLib_addCalc2(&actor->current.pos.x, ato.x, 1.0f, actor->speedF); + cLib_addCalc2(&actor->current.pos.y, ato.y, 1.0f, actor->speedF); + cLib_addCalc2(&actor->current.pos.z, ato.z, 1.0f, actor->speedF); + mae = ato - actor->current.pos; + if (mae.abs() < 1.0f + NREG_F(0)) { + i_this->mode = 13; anm_init(i_this, 23, 2.0f, 2, 1.0f); - i_this->mTimers[0] = 60; + i_this->timer[0] = 60; } break; @@ -1226,22 +1226,22 @@ static int npc_ks_demo_02(npc_ks_class* i_this) { rv = 0; iVar1 = 1; cMtx_YrotS(*calc_mtx, cage_p->actor.shape_angle.y); - sp3c.x = 0.0f; - sp3c.y = 0.0f; - sp3c.z = (90.0f + NREG_F(1)) * cage_p->actor.scale.x; - MtxPosition(&sp3c, &sp48); - sp48 += cage_p->actor.current.pos; - cLib_addCalc2(&a_this->current.pos.x, sp48.x, 1.0f, 10.0f); - cLib_addCalc2(&a_this->current.pos.z, sp48.z, 1.0f, 10.0f); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = (90.0f + NREG_F(1)) * cage_p->actor.scale.x; + MtxPosition(&mae, &ato); + ato += cage_p->actor.current.pos; + cLib_addCalc2(&actor->current.pos.x, ato.x, 1.0f, 10.0f); + cLib_addCalc2(&actor->current.pos.z, ato.z, 1.0f, 10.0f); - if (i_this->mpModelMorf->checkFrame(10.0f) || i_this->mpModelMorf->checkFrame(20.0f)) { + if (i_this->model->checkFrame(10.0f) || i_this->model->checkFrame(20.0f)) { cage_p->field_0xdc8 += 200.0f; - i_this->mSound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); + i_this->sound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_CREAK, 0, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); } - if (i_this->mTimers[0] == 0) { - i_this->mMode = 14; + if (i_this->timer[0] == 0) { + i_this->mode = 14; anm_init(i_this, 15, 2.0f, 2, 1.0f); } break; @@ -1250,28 +1250,28 @@ static int npc_ks_demo_02(npc_ks_class* i_this) { rv = 0; iVar1 = 1; cMtx_YrotS(*calc_mtx, cage_p->actor.shape_angle.y); - sp3c.x = 0.0f; - sp3c.y = 0.0f; - sp3c.z = 90.0f + NREG_F(1); - MtxPosition(&sp3c, &sp48); - sp48 += cage_p->actor.current.pos; - cLib_addCalc2(&a_this->current.pos.x, sp48.x, 1.0f, 10.0f); - cLib_addCalc2(&a_this->current.pos.z, sp48.z, 1.0f, 10.0f); - cLib_addCalc2(&a_this->current.pos.y, i_this->mObjAcch.GetGroundH(), 1.0f, l_HIO.demo_speed); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = 90.0f + NREG_F(1); + MtxPosition(&mae, &ato); + ato += cage_p->actor.current.pos; + cLib_addCalc2(&actor->current.pos.x, ato.x, 1.0f, 10.0f); + cLib_addCalc2(&actor->current.pos.z, ato.z, 1.0f, 10.0f); + cLib_addCalc2(&actor->current.pos.y, i_this->ObjAcch.GetGroundH(), 1.0f, l_HIO.demo_speed); - if (NPC_KS_FABSF(a_this->current.pos.y - i_this->mObjAcch.GetGroundH()) < 1.0f) { + if (NPC_KS_FABSF(actor->current.pos.y - i_this->ObjAcch.GetGroundH()) < 1.0f) { anm_init(i_this, 26, 5.0f, 2, 1.0f); - a_this->speedF = 0.0f; - i_this->mTimers[0] = 20; - i_this->mMode = 15; + actor->speedF = 0.0f; + i_this->timer[0] = 20; + i_this->mode = 15; } break; case 15: - fVar1 = l_HIO.demo_speed; - cLib_addCalcAngleS2(&a_this->current.angle.y, s16(cage_p->actor.shape_angle.y), 2, 0x2000); - if (i_this->mTimers[0] == 0) { - i_this->mMode = 16; + speed = l_HIO.demo_speed; + cLib_addCalcAngleS2(&actor->current.angle.y, s16(cage_p->actor.shape_angle.y), 2, 0x2000); + if (i_this->timer[0] == 0) { + i_this->mode = 16; anm_init(i_this, 25, 5.0f, 2, 1.0f); } break; @@ -1279,132 +1279,132 @@ static int npc_ks_demo_02(npc_ks_class* i_this) { case 16: { i_this->field_0xaec = 2; i_this->field_0x5fc = 1; - if (i_this->mTimers[0] == 0) { - if (i_this->field_0x5d0 != 25) { + if (i_this->timer[0] == 0) { + if (i_this->res_id != 25) { anm_init(i_this, 25, 5.0f, 2, 1.0f); - i_this->mTimers[0] = 25; + i_this->timer[0] = 25; } else { anm_init(i_this, 50, 5.0f, 2, 1.0f); - i_this->mTimers[0] = cM_rndF(30.0f) + 30.0f; + i_this->timer[0] = cM_rndF(30.0f) + 30.0f; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, cage_p->actor.shape_angle.y + 0x8000, 2, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, cage_p->actor.shape_angle.y + 0x8000, 2, 0x1000); if (dComIfGp_checkPlayerStatus0(0, 0x40) != 0 || dComIfGp_checkPlayerStatus0(0, 0x2000) != 0) { - i_this->mTimers[2] = 20; + i_this->timer[2] = 20; } - if (i_this->mTimers[2] == 0 && cage_p->field_0xdc4 == 0) { - fopAcM_OnStatus(a_this, 0); - cLib_onBit(a_this->attention_info.flags, fopAc_AttnFlag_TALKCHECK_e | fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); - a_this->eventInfo.onCondition(dEvtCnd_CANTALK_e); - a_this->attention_info.distances[fopAc_attn_TALK_e] = 2; - a_this->attention_info.distances[fopAc_attn_SPEAK_e] = 2; + if (i_this->timer[2] == 0 && cage_p->field_0xdc4 == 0) { + fopAcM_OnStatus(actor, 0); + cLib_onBit(actor->attention_info.flags, fopAc_AttnFlag_TALKCHECK_e | fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); + actor->eventInfo.onCondition(dEvtCnd_CANTALK_e); + actor->attention_info.distances[fopAc_attn_TALK_e] = 2; + actor->attention_info.distances[fopAc_attn_SPEAK_e] = 2; } dAttention_c* attention_p = dComIfGp_getAttention(); - if (a_this == attention_p->LockonTarget(0) && i_this->mTimers[2] == 0 + if (actor == attention_p->LockonTarget(0) && i_this->timer[2] == 0 && mDoCPd_c::getTrigA(PAD_1) != 0) { - i_this->mMode = 17; + i_this->mode = 17; anm_init(i_this, 25, 2.0f, 0, 1.0f); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - a_this->speedF = 0.0f; - leader->field_0xb42 = 60; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + actor->speedF = 0.0f; + leader->demo_mode = 60; } break; } case 17: rv = 0; - if (i_this->field_0x5d0 == 25) { - if (i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 25) { + if (i_this->model->isStop()) { anm_init(i_this, 49, 3.0f, 0, 1.0f); } } else { - fVar1 = 30.0f; + speed = 30.0f; } - if (i_this->field_0x5d0 == 49 && i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 49 && i_this->model->isStop()) { anm_init(i_this, 38, 1.0f, 2, 1.0f); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_ROLL, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_ROLL, 0, -1); } - sp3c = a_pill_p->current.pos - a_this->current.pos; - a_this->current.angle.y = cM_atan2s(sp3c.x, sp3c.z); - cMtx_YrotS(*calc_mtx, a_this->current.angle.y); - sp3c.x = 0.0f; - sp3c.y = 0.0f; - sp3c.z = a_this->speedF; - MtxPosition(&sp3c, &sp48); - a_this->current.pos += sp48; - sp3c.x = a_pill_p->current.pos.x - a_this->current.pos.x; - sp3c.z = a_pill_p->current.pos.z - a_this->current.pos.z; - if (JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z) < 90.0f + NREG_F(7)) { - pillar_p->setShake(daPillar_c::SHAKE_STRONG); + mae = hasira_actor->current.pos - actor->current.pos; + actor->current.angle.y = cM_atan2s(mae.x, mae.z); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = actor->speedF; + MtxPosition(&mae, &ato); + actor->current.pos += ato; + mae.x = hasira_actor->current.pos.x - actor->current.pos.x; + mae.z = hasira_actor->current.pos.z - actor->current.pos.z; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 90.0f + NREG_F(7)) { + hasira_p->setShake(daPillar_c::SHAKE_STRONG); anm_init(i_this, 6, 5.0f, 0, 1.0f); - i_this->mMode = 18; - a_this->speedF = -20.0f + NREG_F(4); - a_this->speed.y = 30.0f + NREG_F(5); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_ATTACK_POLL, 0, -1); + i_this->mode = 18; + actor->speedF = -20.0f + NREG_F(4); + actor->speed.y = 30.0f + NREG_F(5); + i_this->sound.startCreatureSound(Z2SE_KOSARU_ATTACK_POLL, 0, -1); if (cage_p != NULL) { cage_p->field_0xdc8 = 1500.0f + NREG_F(8); - i_this->mSound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_SHAKE, 0, -1); + i_this->sound.startCreatureSound(Z2SE_OBJ_MONKEYJAIL_SHAKE, 0, -1); } } break; case 18: - fVar1 = -20.0f + NREG_F(4); - cLib_addCalcAngleS2(&a_this->current.angle.x, ZREG_S(7) - 0x3830, 1, 0x600); - if (a_this->speed.y <= 0.0f && i_this->mObjAcch.ChkGroundHit()) { - i_this->mMode = 19; - a_this->speed.y = 20.0f + NREG_F(6); - a_this->current.angle.x = ZREG_S(7) - 0x3830; - i_this->mTimers[0] = 40; - i_this->mTimers[1] = 10; - fopAcM_effSmokeSet1(&i_this->field_0x858, &i_this->field_0x85c, &a_this->eyePos, NULL, 1.7f + TREG_F(18), &a_this->tevStr, 1); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_CRUSHED, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_FALL_GROUND, 0, -1); + speed = -20.0f + NREG_F(4); + cLib_addCalcAngleS2(&actor->current.angle.x, ZREG_S(7) - 0x3830, 1, 0x600); + if (actor->speed.y <= 0.0f && i_this->ObjAcch.ChkGroundHit()) { + i_this->mode = 19; + actor->speed.y = 20.0f + NREG_F(6); + actor->current.angle.x = ZREG_S(7) - 0x3830; + i_this->timer[0] = 40; + i_this->timer[1] = 10; + fopAcM_effSmokeSet1(&i_this->field_0x858, &i_this->field_0x85c, &actor->eyePos, NULL, 1.7f + TREG_F(18), &actor->tevStr, 1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_CRUSHED, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_FALL_GROUND, 0, -1); anm_init(i_this, 13, 2.0f, 2, 1.0f); } break; case 19: - if (i_this->mTimers[1] != 0) { - fVar1 = a_this->speedF = -15.0f + NREG_F(14); + if (i_this->timer[1] != 0) { + speed = actor->speedF = -15.0f + NREG_F(14); } else { - fVar1 = a_this->speedF = 0.0f; + speed = actor->speedF = 0.0f; } - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { anm_init(i_this, 35, 3.0f, 0, 1.0f); - i_this->mMode = 20; + i_this->mode = 20; } break; case 20: - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 16; + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); + if (i_this->model->isStop()) { + i_this->mode = 16; anm_init(i_this, 25, 5.0f, 2, 1.0f); - if (leader->field_0xb42 != 0) { - leader->field_0xb42 = 100; + if (leader->demo_mode != 0) { + leader->demo_mode = 100; } - i_this->mTimers[2] = 30; + i_this->timer[2] = 30; } break; } - cLib_addCalc2(&a_this->speedF, fVar1, 1.0f, 4.0f); + cLib_addCalc2(&actor->speedF, speed, 1.0f, 4.0f); if (checkDoorDemo() != 0) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } else if (iVar1 != 0 && cage_p->actor.shape_angle.x > 0x200) { anm_init(i_this, 6, 5.0f, 0, 1.0f); - i_this->mMode = 18; - a_this->speedF = -8.0f + NREG_F(4); - a_this->speed.y = 10.0f + NREG_F(5); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_PRISONED, -1); + i_this->mode = 18; + actor->speedF = -8.0f + NREG_F(4); + actor->speed.y = 10.0f + NREG_F(5); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_PRISONED, -1); } return rv; @@ -1419,39 +1419,39 @@ static void* s_dn_sub(void* i_actor, void* i_data) { } static int npc_ks_demo_022(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; cXyz unused_cxyz_0, unused_cxyz_1; - f32 reg_f31 = 0.0f; // doesn't change - BOOL retval = TRUE; // doesn't change + f32 speed = 0.0f; // doesn't change + BOOL rt = TRUE; // doesn't change daE_OC_c* bokoblin_p = (daE_OC_c*)fpcM_Search(s_dn_sub, i_this); - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); - switch(i_this->mMode) { + switch(i_this->mode) { case 0: anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->mTimers[0] = 100; + i_this->mode = 1; + i_this->timer[0] = 100; // fallthrough case 1: i_this->field_0x5fc = 1; - if (i_this->mTimers[0] == 0) { - i_this->mMode = 20; + if (i_this->timer[0] == 0) { + i_this->mode = 20; anm_init(i_this, 30, 3.0f, 2, 1.0f); - i_this->mTimers[0] = 90; + i_this->timer[0] = 90; fpcM_Search(s_resq_sub, i_this); } break; case 10: anm_init(i_this, 13, 2.0f, 2, 1.0f); - i_this->mTimers[0] = 30; - i_this->mMode = 11; - a_this->current.angle.x = ZREG_S(7) - 0x3830; + i_this->timer[0] = 30; + i_this->mode = 11; + actor->current.angle.x = ZREG_S(7) - 0x3830; // fallthrough case 11: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { anm_init(i_this, 35, 3.0f, 0, 1.0f); - i_this->mMode = 12; + i_this->mode = 12; mDoAud_seStart(12, 0, 0, 0); Z2GetAudioMgr()->muteSceneBgm(120, 0.0f); Z2GetAudioMgr()->setBattleBgmOff(true); @@ -1459,110 +1459,110 @@ static int npc_ks_demo_022(npc_ks_class* i_this) { break; case 12: - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 20; + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); + if (i_this->model->isStop()) { + i_this->mode = 20; anm_init(i_this, 30, 3.0f, 2, 1.0f); - i_this->mTimers[0] = 90; + i_this->timer[0] = 90; fpcM_Search(s_resq_sub, i_this); } break; case 20: - if (i_this->mTimers[0] == 0) { - i_this->mMode = 21; + if (i_this->timer[0] == 0) { + i_this->mode = 21; } break; case 21: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 22; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 22; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; i_this->field_0xaec = 1; break; case 22: - if (((i_this->field_0x5d0 == 39 || i_this->field_0x5d0 == 43 && frame < 7) || + if (((i_this->res_id == 39 || i_this->res_id == 43 && frame < 7) || (frame > 40 && frame < 48) || frame > 65)) { i_this->field_0x5e0 = 4; } - if ((i_this->mTimers[0] == 0) && (i_this->field_0x5d0 == 39)) { + if ((i_this->timer[0] == 0) && (i_this->res_id == 39)) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43) { - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 21; + if (i_this->res_id == 43) { + if (i_this->model->isStop()) { + i_this->mode = 21; } } if (bokoblin_p == NULL) { - i_this->mTimers[0] = cM_rndF(10.0f) + 30.0f; - i_this->mMode = 23; - int swBit = (fopAcM_GetParam(a_this) & 0xFF000000) >> 24; - dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(a_this)); + i_this->timer[0] = cM_rndF(10.0f) + 30.0f; + i_this->mode = 23; + int swBit = (fopAcM_GetParam(actor) & 0xFF000000) >> 24; + dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(actor)); } break; case 23: - if (i_this->mTimers[0] == 0) { - if (i_this->field_0x5b6 == 0) { + if (i_this->timer[0] == 0) { + if (i_this->set_id == 0) { anm_init(i_this, 56, 3.0f, 2, 1.0f); } else { anm_init(i_this, 11, 3.0f, 2, 1.0f); } - i_this->mTimers[0] = cM_rndF(25.0f) + 70.0f; - i_this->mMode = 24; + i_this->timer[0] = cM_rndF(25.0f) + 70.0f; + i_this->mode = 24; } break; case 24: - if (i_this->mTimers[0] == 0) { - i_this->mActionID = 114; - i_this->mMode = 0; - i_this->mTimers[2] = 60; + if (i_this->timer[0] == 0) { + i_this->action = 114; + i_this->mode = 0; + i_this->timer[2] = 60; } } - cLib_addCalc2(&a_this->speedF, reg_f31, 1.0f, 4.0f); - return retval; + cLib_addCalc2(&actor->speedF, speed, 1.0f, 4.0f); + return rt; } static void npc_ks_demo_04(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; cXyz unused_cxyz_0, unused_cxyz_1; - f32 fVar1 = 0.0f; - f32 fVar2 = 10.0f; - switch(i_this->mMode) { + f32 speed = 0.0f; + f32 step_speed = 10.0f; + switch(i_this->mode) { case 0: anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mMode = 1; + i_this->mode = 1; break; case 2: - a_this->current.pos.set(0.0f, 3300.0f, 4393.0f); - a_this->current.angle.y = -0x8000; + actor->current.pos.set(0.0f, 3300.0f, 4393.0f); + actor->current.angle.y = -0x8000; anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 3; + i_this->mode = 3; break; case 3: - fVar1 = l_HIO.demo_speed; - if (a_this->field_0x567 != 0) { - a_this->field_0x567 = 0; + speed = l_HIO.demo_speed; + if (actor->field_0x567 != 0) { + actor->field_0x567 = 0; anm_init(i_this, 45, 3.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 45) { - if (i_this->mpModelMorf->checkFrame(20.0f)) { + if (i_this->res_id == 45) { + if (i_this->model->checkFrame(20.0f)) { mDoAud_seStart(0x5001a, 0, 0, 0); } - fVar1 = 0.0f; - fVar2 = 4.0f; - if (i_this->mpModelMorf->getFrame() >= 37.0f + AREG_F(17)) { + speed = 0.0f; + step_speed = 4.0f; + if (i_this->model->getFrame() >= 37.0f + AREG_F(17)) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } @@ -1570,195 +1570,195 @@ static void npc_ks_demo_04(npc_ks_class* i_this) { break; case 4: - i_this->mMode = 5; + i_this->mode = 5; anm_init(i_this, 33, 5.0f, 0, 1.0f); mDoAud_seStart(0x5001a, 0, 0, 0); - a_this->speed.y = 0.0f; + actor->speed.y = 0.0f; break; case 5: - fVar1 = l_HIO.demo_speed; - a_this->gravity = -2.0f + KREG_F(7); + speed = l_HIO.demo_speed; + actor->gravity = -2.0f + KREG_F(7); break; case 6: anm_init(i_this, 12, 3.0f, 2, 1.0f); - i_this->mMode = 7; + i_this->mode = 7; // fallthrough case 7: - a_this->gravity = 0.0f; - a_this->speed.y = 10.0f; - if ((i_this->field_0x5e6 & 31) == 0) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_WAIT, -1); + actor->gravity = 0.0f; + actor->speed.y = 10.0f; + if ((i_this->count & 31) == 0) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WAIT, -1); } break; case 8: anm_init(i_this, 26, 5.0f, 2, 1.0f); - i_this->mTimers[0] = 35; - i_this->mMode = 9; + i_this->timer[0] = 35; + i_this->mode = 9; break; case 9: - fVar1 = l_HIO.demo_speed; - fVar2 = 4.0f; - if (i_this->mTimers[0] == 0) { + speed = l_HIO.demo_speed; + step_speed = 4.0f; + if (i_this->timer[0] == 0) { anm_init(i_this, 37, 3.0f, 0, 1.0f); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_RELEIEF, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_RELEIEF, -1); i_this->field_0x5e4 = 1; - i_this->mMode = 10; + i_this->mode = 10; } break; case 10: i_this->field_0x5fc = 1; - if (i_this->mpModelMorf->isStop()) { + if (i_this->model->isStop()) { i_this->field_0x5e4 = 0; anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 11; - i_this->mTimers[0] = 25 + KREG_S(7); + i_this->mode = 11; + i_this->timer[0] = 25 + KREG_S(7); } break; case 11: - fVar1 = l_HIO.demo_speed; - fVar2 = 4.0f; - if (i_this->mTimers[0] == 0) { + speed = l_HIO.demo_speed; + step_speed = 4.0f; + if (i_this->timer[0] == 0) { anm_init(i_this, 7, 5.0f, 2, 1.0f); - i_this->mTimers[0] = 120; - i_this->mMode = 12; + i_this->timer[0] = 120; + i_this->mode = 12; } break; case 12: - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x5c8, 2, 0x1000); - if (i_this->mTimers[0] == 0) { - i_this->mActionID = 100; - i_this->mMode = 0; + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->target_angle, 2, 0x1000); + if (i_this->timer[0] == 0) { + i_this->action = 100; + i_this->mode = 0; } break; case 20: anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mMode = 21; + i_this->mode = 21; // fallthrough case 21: - if (a_this->field_0x567 != 0) { - a_this->field_0x567 = 0; - i_this->mMode = 22; + if (actor->field_0x567 != 0) { + actor->field_0x567 = 0; + i_this->mode = 22; anm_init(i_this, 45, 3.0f, 0, 1.0f); } break; case 22: - if (i_this->mpModelMorf->isStop()) { + if (i_this->model->isStop()) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } - if (i_this->field_0x5d0 == 26) { - cLib_addCalcAngleS2(&a_this->current.angle.y, 0, 2, 0x1000); - if (a_this->current.angle.y < 0x1000 && a_this->current.angle.y > -0x1000) { - fVar1 = l_HIO.demo_speed; - fVar2 = 10.0f; + if (i_this->res_id == 26) { + cLib_addCalcAngleS2(&actor->current.angle.y, 0, 2, 0x1000); + if (actor->current.angle.y < 0x1000 && actor->current.angle.y > -0x1000) { + speed = l_HIO.demo_speed; + step_speed = 10.0f; } } } - cLib_addCalc2(&a_this->speedF, fVar1, 1.0f, fVar2); + cLib_addCalc2(&actor->speedF, speed, 1.0f, step_speed); } static void npc_ks_to_hang(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - cXyz sp24, sp30; + fopAc_ac_c* actor = &i_this->actor; + cXyz mae, ato; cXyz sp3c(i_this->field_0xbc8); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: - i_this->field_0x8f0 = sp3c; - i_this->field_0x910 = a_this->current.pos; - i_this->field_0x91c = i_this->field_0x8f0; + i_this->guide_path = sp3c; + i_this->field_0x910 = actor->current.pos; + i_this->field_0x91c = i_this->guide_path; anm_init(i_this, 32, 2.0f, 0, 1.0f); - a_this->speedF = 0.0f; - i_this->mMode++; + actor->speedF = 0.0f; + i_this->mode++; break; case 1: - sp24 = i_this->field_0x8f0 - a_this->current.pos; - if (i_this->field_0x5d0 == 32) { - a_this->speedF = 0.0f; - if (i_this->mpModelMorf->isStop()) { + mae = i_this->guide_path - actor->current.pos; + if (i_this->res_id == 32) { + actor->speedF = 0.0f; + if (i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; } } - i_this->field_0x8fc.y = cM_atan2s(sp24.x, sp24.z); - i_this->field_0x8fc.x = -cM_atan2s(sp24.y, JMAFastSqrt(sp24.x * sp24.x + sp24.z * sp24.z)); - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x2000); - if (sp24.abs() <= a_this->speedF * 1.1f) { - i_this->mMode = 10; - obj_sw_class* sw_p = i_this->field_0x934; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x2000); + if (mae.abs() <= actor->speedF * 1.1f) { + i_this->mode = 10; + obj_sw_class* sw_p = i_this->child_no; if (sw_p != NULL) { if (sw_p->field_0x91c == 1) { i_this->field_0x630 = sw_p->field_0xd8c / 2; } else { - i_this->field_0x630 = ((i_this->field_0x5b6 + 1) * (sw_p->field_0xd8c / (sw_p->field_0x91c + 1)) - 1); + i_this->field_0x630 = ((i_this->set_id + 1) * (sw_p->field_0xd8c / (sw_p->field_0x91c + 1)) - 1); } - a_this->parentActorID = fopAcM_GetID(sw_p); + actor->parentActorID = fopAcM_GetID(sw_p); - a_this->current.pos = i_this->field_0x8f0; - i_this->field_0x910 = a_this->current.pos; + actor->current.pos = i_this->guide_path; + i_this->field_0x910 = actor->current.pos; anm_init(i_this, 32, 2.0f, 0, 1.0f); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); } } break; case 2: - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 0; + if (i_this->model->isStop()) { + i_this->mode = 0; } break; case 10: - obj_sw_class* sw_p = (obj_sw_class*)fopAcM_SearchByID(a_this->parentActorID); - i_this->field_0x8f0 = sw_p->field_0x920[i_this->field_0x630]; - i_this->field_0x91c = i_this->field_0x8f0; - sp24 = i_this->field_0x8f0 - a_this->current.pos; - if (i_this->field_0x5d0 == 32) { - a_this->speedF = 0.0f; - if (i_this->mpModelMorf->isStop()) { + obj_sw_class* sw_p = (obj_sw_class*)fopAcM_SearchByID(actor->parentActorID); + i_this->guide_path = sw_p->field_0x920[i_this->field_0x630]; + i_this->field_0x91c = i_this->guide_path; + mae = i_this->guide_path - actor->current.pos; + if (i_this->res_id == 32) { + actor->speedF = 0.0f; + if (i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 30.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 30.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; } } - i_this->field_0x8fc.y = cM_atan2s(sp24.x, sp24.z); - i_this->field_0x8fc.x = -cM_atan2s(sp24.y, JMAFastSqrt(sp24.x * sp24.x + sp24.z * sp24.z)); - if (sp24.abs() <= a_this->speedF* 1.1f) { - a_this->current.pos = i_this->field_0x8f0; - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); - if (i_this->field_0x934->field_0x91c == 1) { - i_this->mActionID = 11; - i_this->mMode = 0; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); + if (mae.abs() <= actor->speedF* 1.1f) { + actor->current.pos = i_this->guide_path; + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + if (i_this->child_no->field_0x91c == 1) { + i_this->action = 11; + i_this->mode = 0; } else { - i_this->mActionID = 21; - i_this->mMode = 0; - i_this->mTimers[2] = 15; + i_this->action = 21; + i_this->mode = 0; + i_this->timer[2] = 15; } } } - if (a_this->speedF> 25.0f) { + if (actor->speedF> 25.0f) { i_this->field_0x90c= 1; } } @@ -1767,8 +1767,8 @@ static void* s_next_do_sub(void* i_actor, void* i_data) { if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) { npc_ks_class* mon_data = (npc_ks_class*) i_data; npc_ks_class* monkey_actor = (npc_ks_class*) i_actor; - if (monkey_actor->field_0x5b5 != 0 && mon_data->field_0x5b8 == (monkey_actor->field_0x5b8 - 1 & 0xFF)) { - monkey_actor->mMode++; + if (monkey_actor->field_0x5b5 != 0 && mon_data->order == (monkey_actor->order - 1 & 0xFF)) { + monkey_actor->mode++; return i_actor; } } @@ -1776,19 +1776,19 @@ static void* s_next_do_sub(void* i_actor, void* i_data) { return NULL; } -static void* s_next_get_sub(void* i_actor, void* i_data) { - if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) { +static void* s_next_get_sub(void* actor, void* i_data) { + if (fopAcM_IsActor(actor) && fopAcM_GetName(actor) == PROC_NPC_KS) { npc_ks_class* mon_data = (npc_ks_class*) i_data; - npc_ks_class* monkey_actor = (npc_ks_class*) i_actor; + npc_ks_class* monkey_actor = (npc_ks_class*) actor; if (monkey_actor->field_0x5b5 != 0 && - monkey_actor->field_0x5b8 != mon_data->field_0x5b8 && monkey_actor->field_0x620 != 0) { + monkey_actor->order != mon_data->order && monkey_actor->field_0x620 != 0) { monkey_actor->field_0x620 = 0; anm_init(monkey_actor, 24, 1.0f, 2, 1.0f); mon_data->field_0x620 = 1; mon_data->field_0x624 = mon_data->field_0x614 - monkey_actor->field_0x614; mon_data->field_0x624 *= (0.1f + BREG_F(5)); mon_data->field_0x634 = 10.0f + BREG_F(10); - return i_actor; + return actor; } } @@ -1796,55 +1796,55 @@ static void* s_next_get_sub(void* i_actor, void* i_data) { } static void order_set(int param_1) { - if (saru_p[0]->field_0x5c4 < saru_p[param_1 - 1]->field_0x5c4) { + if (saru_p[0]->dis < saru_p[param_1 - 1]->dis) { for (int i = 0; i < param_1; i++) { - saru_p[i]->field_0x5b8 = i; + saru_p[i]->order = i; } } else { for (int i = 0; i < param_1; i++) { - saru_p[i]->field_0x5b8 = (param_1 - 1) - i; + saru_p[i]->order = (param_1 - 1) - i; } } } static void all_carry_finish(int param_1) { for (int i = 0; i < param_1; i++) { - saru_p[i]->mActionID = 10; - saru_p[i]->mMode = 0; + saru_p[i]->action = 10; + saru_p[i]->mode = 0; } } static void hang_end_check(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp30, sp3c; - if (i_this->mRoomMonkeyID > 3 || !dComIfGs_isStageMiddleBoss()) { - if ((fopAcM_GetRoomNo(a_this) != 4 || !(player->current.pos.z < 2500.0f)) && checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; - i_this->field_0x904 = 0; + cXyz mae, ato; + if (i_this->monkey_room_no > 3 || !dComIfGs_isStageMiddleBoss()) { + if ((fopAcM_GetRoomNo(actor) != 4 || !(player->current.pos.z < 2500.0f)) && checkDoorDemo()) { + i_this->action = 100; + i_this->mode = 0; + i_this->path_no = 0; i_this->field_0xaec = 1; - a_this->current.angle.x = 0; - if (fopAcM_CheckCondition(a_this, 4) != 0) { + actor->current.angle.x = 0; + if (fopAcM_CheckCondition(actor, 4) != 0) { camera_class* camera = dComIfGp_getCamera(0); if (checkDoorDemo()) { cMtx_YrotS(*calc_mtx, player->shape_angle.y + 0x8000); } else { - sp30.x = camera->lookat.eye.x - camera->lookat.center.x; - sp30.z = camera->lookat.eye.z - camera->lookat.center.z; - cMtx_YrotS(*calc_mtx, cM_atan2s(sp30.x, sp30.z)); + mae.x = camera->lookat.eye.x - camera->lookat.center.x; + mae.z = camera->lookat.eye.z - camera->lookat.center.z; + cMtx_YrotS(*calc_mtx, cM_atan2s(mae.x, mae.z)); } - if ((i_this->field_0x5b6 & 1) != 0) { - sp30.x = 100.0f; + if ((i_this->set_id & 1) != 0) { + mae.x = 100.0f; } else { - sp30.x = -100.0f; + mae.x = -100.0f; } - sp30.y = -50.0f; - sp30.z = 100.0f; - MtxPosition(&sp30, &sp3c); - a_this->current.pos = camera->lookat.eye + sp3c; - a_this->old = a_this->current; + mae.y = -50.0f; + mae.z = 100.0f; + MtxPosition(&mae, &ato); + actor->current.pos = camera->lookat.eye + ato; + actor->old = actor->current; } } } @@ -1856,8 +1856,8 @@ static void npc_ks_hang(npc_ks_class* i_this) { } daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - fopAc_ac_c* a_this = &i_this->actor; - if (fopAcM_GetRoomNo(a_this) == 4) { + fopAc_ac_c* actor = &i_this->actor; + if (fopAcM_GetRoomNo(actor) == 4) { for (int i = 0; i < 4; i++) { if (saru_p[i] == NULL) { return; @@ -1872,17 +1872,17 @@ static void npc_ks_hang(npc_ks_class* i_this) { fopAc_ac_c* actor_p; #if VERSION == VERSION_SHIELD_DEBUG // FIXME: fakematch? - actor_p = fopAcM_SearchByID(a_this->parentActorID); + actor_p = fopAcM_SearchByID(actor->parentActorID); if (actor_p == NULL) #else - if ((actor_p = fopAcM_SearchByID(a_this->parentActorID)) == NULL) + if ((actor_p = fopAcM_SearchByID(actor->parentActorID)) == NULL) #endif { actor_p = (fopAc_ac_c*) fpcM_Search(s_sw_sub, i_this); if (actor_p != NULL) { - a_this->parentActorID = fopAcM_GetID(actor_p); - i_this->field_0x934 = (obj_sw_class*) actor_p; - i_this->field_0x630 = (i_this->field_0x5b6 + 1) * (i_this->field_0x934->field_0xd8c / (i_this->field_0x934->field_0x91c + 1)) - 1; + actor->parentActorID = fopAcM_GetID(actor_p); + i_this->child_no = (obj_sw_class*) actor_p; + i_this->field_0x630 = (i_this->set_id + 1) * (i_this->child_no->field_0xd8c / (i_this->child_no->field_0x91c + 1)) - 1; } else { return; } @@ -1890,34 +1890,34 @@ static void npc_ks_hang(npc_ks_class* i_this) { obj_sw_class* sw_p = (obj_sw_class*) actor_p; sw_p->field_0x900 += 5.0f; - cXyz sp2c, sp38; + cXyz mae, ato; int iVar1 = 0; - cLib_addCalcAngleS2(&a_this->current.angle.y, a_this->home.angle.y + 0x4000, 2, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.y, actor->home.angle.y + 0x4000, 2, 0x800); static s16 start_pya = 0; if (!daPy_getPlayerActorClass()->checkAutoJumpStart()) { - start_pya = i_this->field_0x5c8; + start_pya = i_this->target_angle; } s16 sVar1; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: - i_this->mTimers[0] = 0; - i_this->mMode++; + i_this->timer[0] = 0; + i_this->mode++; i_this->field_0x604 = 0; // fallthrough case 1: - if (i_this->field_0x5b6 == 0 && leader->field_0xb42 == 0) { + if (i_this->set_id == 0 && leader->demo_mode == 0) { order_set(sw_p->field_0x91c); } - if (i_this->field_0x5b8 == 0 && i_this->field_0x5d0 != 16 && i_this->field_0x5c4 < 550.0f + YREG_F(9)) { + if (i_this->order == 0 && i_this->res_id != 16 && i_this->dis < 550.0f + YREG_F(9)) { anm_init(i_this, 16, 5.0f, 2, 1.0f); - i_this->mTimers[0] = cM_rndF(50.0f) + 200.0f; + i_this->timer[0] = cM_rndF(50.0f) + 200.0f; } - if (i_this->mTimers[0] == 0) { - i_this->mTimers[0] = cM_rndF(30.0f) + 50.0f; + if (i_this->timer[0] == 0) { + i_this->timer[0] = cM_rndF(30.0f) + 50.0f; if (cM_rndF(1.0f) < 0.3f) { anm_init(i_this, 17, 5.0f, 2, 1.0f); } else if (cM_rndF(1.0f) < 0.3f) { @@ -1928,22 +1928,22 @@ static void npc_ks_hang(npc_ks_class* i_this) { } leader->field_0x92c = 0; - if (i_this->field_0x5b8 == 0 && !dComIfGp_event_runCheck() && i_this->field_0x94e == 0 && i_this->field_0x5c4 < 150.0f + YREG_F(0)) { - leader->field_0xb42 = 1; + if (i_this->order == 0 && !dComIfGp_event_runCheck() && i_this->hang_time == 0 && i_this->dis < 150.0f + YREG_F(0)) { + leader->demo_mode = 1; i_this->field_0x620 = 1; i_this->field_0x610 = 0; obj_pos = player->current.pos; - cMtx_YrotS(*calc_mtx, a_this->home.angle.y); - sp2c.x = 0.0f; - sp2c.y = -150.0f + WREG_F(0); - sp2c.z = -400.0f + WREG_F(1); - MtxPosition(&sp2c, &obj_pos); - obj_pos += a_this->current.pos; + cMtx_YrotS(*calc_mtx, actor->home.angle.y); + mae.x = 0.0f; + mae.y = -150.0f + WREG_F(0); + mae.z = -400.0f + WREG_F(1); + MtxPosition(&mae, &obj_pos); + obj_pos += actor->current.pos; i_this->field_0x624 = obj_pos - i_this->field_0x614; i_this->field_0x624 *= (0.075f + WREG_F(2)); - i_this->mMode = 4; - i_this->mTimers[0] = 17 + WREG_S(8); - i_this->mTimers[1] = 25 + WREG_S(9); + i_this->mode = 4; + i_this->timer[0] = 17 + WREG_S(8); + i_this->timer[1] = 25 + WREG_S(9); i_this->field_0x5fa = 0x4000; i_this->field_0x60c = 8000.0f; i_this->field_0x604 = 0; @@ -1952,64 +1952,64 @@ static void npc_ks_hang(npc_ks_class* i_this) { sVar1 = start_pya - sw_p->actor.current.angle.y; if (sVar1 < 0x4000 && sVar1 > -0x4000) { - a_this->home.angle.y = sw_p->actor.current.angle.y + 0x8000; + actor->home.angle.y = sw_p->actor.current.angle.y + 0x8000; } else { - a_this->home.angle.y = sw_p->actor.current.angle.y; + actor->home.angle.y = sw_p->actor.current.angle.y; } break; case 2: - i_this->mMode++; - i_this->mTimers[0] = 10 + BREG_S(6); + i_this->mode++; + i_this->timer[0] = 10 + BREG_S(6); // fallthrough case 3: i_this->field_0x5fa = 0x4000; i_this->field_0x60c = 8000.0f; - if (i_this->mTimers[0] == s16(8 + BREG_S(7))) { + if (i_this->timer[0] == s16(8 + BREG_S(7))) { fpcM_Search(s_next_get_sub, i_this); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); } - if (i_this->mTimers[0] == s16(2 + ZREG_S(6))) { - i_this->mTimers[2] = 15 + ZREG_S(7); + if (i_this->timer[0] == s16(2 + ZREG_S(6))) { + i_this->timer[2] = 15 + ZREG_S(7); } - if (i_this->mTimers[0] == 0) { - i_this->mMode++; - i_this->mTimers[0] = 10 + BREG_S(8); - i_this->mTimers[1] = 18 + BREG_S(4); + if (i_this->timer[0] == 0) { + i_this->mode++; + i_this->timer[0] = 10 + BREG_S(8); + i_this->timer[1] = 18 + BREG_S(4); } break; case 4: - if (i_this->mTimers[0] > s16(8 + BREG_S(5))) { + if (i_this->timer[0] > s16(8 + BREG_S(5))) { i_this->field_0x5fa = 0x4000; i_this->field_0x60c = 8000.0f; } - if (i_this->mTimers[0] == s16(8 + BREG_S(5))) { + if (i_this->timer[0] == s16(8 + BREG_S(5))) { anm_init(i_this, 48, 2.0f, 2, 1.0f); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_CATCH, -1); - i_this->mSound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_CATCH, -1); + i_this->sound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); sw_p->field_0x8fc = 20.0f + XREG_F(0); sw_p->field_0xd10[i_this->field_0x630] = 10; } if (mDoCPd_c::getTrigA(0) != 0) { - if (i_this->mTimers[1] <= 9 && i_this->field_0x604 < 0 && i_this->field_0x602 < 0) { + if (i_this->timer[1] <= 9 && i_this->field_0x604 < 0 && i_this->field_0x602 < 0) { leader->field_0x92c = 1; fpcM_Search(s_next_do_sub, i_this); - if (i_this->field_0x5b8 == sw_p->field_0x91c -1) { - i_this->mMode = 5; + if (i_this->order == sw_p->field_0x91c -1) { + i_this->mode = 5; } else { - i_this->mMode = 10; + i_this->mode = 10; anm_init(i_this, 24, 1.0f, 2, 1.0f); } } else { - leader->field_0xb42 = 100; + leader->demo_mode = 100; i_this->field_0x620 = 0; iVar1 = 1; - i_this->field_0x94e = 20; + i_this->hang_time = 20; } } break; @@ -2018,19 +2018,19 @@ static void npc_ks_hang(npc_ks_class* i_this) { if (i_this->field_0x602 >= 0 || i_this->field_0x604 >= 0) break; i_this->field_0x620 = 0; - i_this->mTimers[0] = 15 + BREG_S(3); - i_this->mMode = 6; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); + i_this->timer[0] = 15 + BREG_S(3); + i_this->mode = 6; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); player->changeDemoMode(24, 0, 0, 0); anm_init(i_this, 24, 1.0f, 2, 1.0f); // fallthrough case 6: - if (i_this->mTimers[0] == 8) { - leader->field_0xb42 = 3; - leader->field_0xb44 = 0; + if (i_this->timer[0] == 8) { + leader->demo_mode = 3; + leader->demo_camera_no = 0; } - if (i_this->mTimers[0] == 1) { + if (i_this->timer[0] == 1) { iVar1 = 1; } break; @@ -2039,40 +2039,40 @@ static void npc_ks_hang(npc_ks_class* i_this) { break; } - a_this->current.pos = sw_p->field_0x920[i_this->field_0x630]; + actor->current.pos = sw_p->field_0x920[i_this->field_0x630]; s16 sVar2 = i_this->field_0x602; cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000); i_this->field_0x604 = i_this->field_0x602 - sVar2; i_this->field_0x5fa += (s16) 0x800; - a_this->current.angle.z = -(i_this->field_0x602 / 4); + actor->current.angle.z = -(i_this->field_0x602 / 4); - if (i_this->mMode != 4) { + if (i_this->mode != 4) { cLib_addCalc0(&i_this->field_0x60c, 0.5f, 100.0f + TREG_F(3)); } hang_end_check(i_this); if (iVar1 != 0) { i_this->field_0x620 = 0; - i_this->mMode = 0; + i_this->mode = 0; all_carry_finish(sw_p->field_0x91c); } } static void npc_ks_hang_s(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* base_sw_p; #if VERSION == VERSION_SHIELD_DEBUG // FIXME: fakematch? - base_sw_p = fopAcM_SearchByID(a_this->parentActorID); + base_sw_p = fopAcM_SearchByID(actor->parentActorID); if (base_sw_p == NULL) #else - if ((base_sw_p = fopAcM_SearchByID(a_this->parentActorID)) == NULL) + if ((base_sw_p = fopAcM_SearchByID(actor->parentActorID)) == NULL) #endif { base_sw_p = (fopAc_ac_c*) fpcM_Search(s_sw_sub, i_this); if (base_sw_p != NULL) { - a_this->parentActorID = fopAcM_GetID(base_sw_p); - i_this->field_0x934 = (obj_sw_class*) base_sw_p; + actor->parentActorID = fopAcM_GetID(base_sw_p); + i_this->child_no = (obj_sw_class*) base_sw_p; } else { return; } @@ -2081,28 +2081,28 @@ static void npc_ks_hang_s(npc_ks_class* i_this) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); obj_sw_class* sw_p = (obj_sw_class*) base_sw_p; sw_p->field_0x900 += 5.0f; - cXyz sp34, sp40; - cLib_addCalcAngleS2(&a_this->current.angle.y, a_this->home.angle.y + 0x4000, 2, 0x800); + cXyz mae, ato; + cLib_addCalcAngleS2(&actor->current.angle.y, actor->home.angle.y + 0x4000, 2, 0x800); s16 sVar1; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: int asdf; - i_this->mMode++; - i_this->mSound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); + i_this->mode++; + i_this->sound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); sw_p->field_0x8fc = 20.0f + XREG_F(0); sw_p->field_0xd10[i_this->field_0x630] = 10; i_this->field_0x92c = 0; break; case 1: - if (i_this->field_0x5d0 != 16 && i_this->field_0x5c4 < 550.0f + YREG_F(9)) { + if (i_this->res_id != 16 && i_this->dis < 550.0f + YREG_F(9)) { anm_init(i_this, 16, 5.0f, 2, 1.0f); - i_this->mTimers[0] = cM_rndF(50.0f) + 200.0f; + i_this->timer[0] = cM_rndF(50.0f) + 200.0f; } - if (i_this->mTimers[0] == 0) { - i_this->mTimers[0] = cM_rndF(30.0f) + 50.0f; + if (i_this->timer[0] == 0) { + i_this->timer[0] = cM_rndF(30.0f) + 50.0f; if (cM_rndF(1.0f) < 0.3f) { anm_init(i_this, 17, 5.0f, 2, 1.0f); } else if (cM_rndF(1.0f) < 0.3f) { @@ -2112,45 +2112,45 @@ static void npc_ks_hang_s(npc_ks_class* i_this) { } } - if (i_this->field_0x94e == 0 && !dComIfGp_event_runCheck() && i_this->field_0x5c4 < 300.0f + YREG_F(10)) { - leader->field_0xb42 = 1; + if (i_this->hang_time == 0 && !dComIfGp_event_runCheck() && i_this->dis < 300.0f + YREG_F(10)) { + leader->demo_mode = 1; i_this->field_0x620 = 1; i_this->field_0x610 = 0; - cMtx_YrotS(*calc_mtx, a_this->home.angle.y); - sp34.x = 0.0f; - sp34.y = -150.0f + WREG_F(0); - sp34.z = -400.0f + WREG_F(1); - MtxPosition(&sp34, &obj_pos); - obj_pos += a_this->current.pos; + cMtx_YrotS(*calc_mtx, actor->home.angle.y); + mae.x = 0.0f; + mae.y = -150.0f + WREG_F(0); + mae.z = -400.0f + WREG_F(1); + MtxPosition(&mae, &obj_pos); + obj_pos += actor->current.pos; i_this->field_0x624 = obj_pos - i_this->field_0x614; i_this->field_0x624 *= (0.075f + WREG_F(2)); - i_this->mMode = 2; - i_this->mTimers[0] = 17 + WREG_S(8); - i_this->mTimers[1] = 25 + WREG_S(9); + i_this->mode = 2; + i_this->timer[0] = 17 + WREG_S(8); + i_this->timer[1] = 25 + WREG_S(9); i_this->field_0x5fa = 0x4000; i_this->field_0x60c = 8000.0f; anm_init(i_this, 24, 3.0f, 2, 1.0f); } - sVar1 = i_this->field_0x5c8 - sw_p->actor.current.angle.y; + sVar1 = i_this->target_angle - sw_p->actor.current.angle.y; if (sVar1 < 0x4000 && sVar1 > -0x4000) { - a_this->home.angle.y = sw_p->actor.current.angle.y + 0x8000; + actor->home.angle.y = sw_p->actor.current.angle.y + 0x8000; } else { - a_this->home.angle.y = sw_p->actor.current.angle.y; + actor->home.angle.y = sw_p->actor.current.angle.y; } break; case 2: - if (i_this->mTimers[0] > s16(8 + BREG_S(5))) { + if (i_this->timer[0] > s16(8 + BREG_S(5))) { i_this->field_0x5fa = 0x4000; i_this->field_0x60c = 8000.0f; } - if (i_this->mTimers[0] == s16(8 + BREG_S(5))) { + if (i_this->timer[0] == s16(8 + BREG_S(5))) { anm_init(i_this, 48, 2.0f, 2, 1.0f); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_CATCH, -1); - i_this->mSound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_CATCH, -1); + i_this->sound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); sw_p->field_0x8fc = 20.0f + XREG_F(0); sw_p->field_0xd10[i_this->field_0x630] = 10; } @@ -2159,36 +2159,36 @@ static void npc_ks_hang_s(npc_ks_class* i_this) { if (i_this->field_0x604 < 0 && i_this->field_0x602 < 0) { i_this->field_0x92c = 1; i_this->field_0x620 = 0; - i_this->mTimers[0] = 15 + BREG_S(3); - i_this->mMode = 5; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); + i_this->timer[0] = 15 + BREG_S(3); + i_this->mode = 5; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); player->changeDemoMode(24, 0, 0, 0); anm_init(i_this, 24, 1.0f, 2, 1.0f); - leader->field_0xb42 = 3; + leader->demo_mode = 3; } else { - leader->field_0xb42 = 100; + leader->demo_mode = 100; i_this->field_0x620 = 0; - i_this->mTimers[0] = 15 + BREG_S(3); - i_this->mMode = 5; - i_this->field_0x94e = 20; + i_this->timer[0] = 15 + BREG_S(3); + i_this->mode = 5; + i_this->hang_time = 20; } } break; case 5: - if (i_this->mTimers[0] == 1) { - leader->field_0xb42 = 100; + if (i_this->timer[0] == 1) { + leader->demo_mode = 100; i_this->field_0x620 = 0; - i_this->mMode = 0; + i_this->mode = 0; } } - a_this->current.pos = sw_p->field_0x920[i_this->field_0x630]; + actor->current.pos = sw_p->field_0x920[i_this->field_0x630]; s16 sVar2 = i_this->field_0x602; cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000); i_this->field_0x604 = i_this->field_0x602 - sVar2; i_this->field_0x5fa += NPC_KS_18DEG_ROT; - a_this->current.angle.z = -(i_this->field_0x602 / 4); + actor->current.angle.z = -(i_this->field_0x602 / 4); if (i_this->field_0x620 != 2) { cLib_addCalc0(&i_this->field_0x60c, 0.5f, 100.0f + TREG_F(3)); @@ -2198,53 +2198,53 @@ static void npc_ks_hang_s(npc_ks_class* i_this) { } static void npc_ks_e_hang(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - fopAc_ac_c* base_sw_p = fopAcM_SearchByID(a_this->parentActorID); + fopAc_ac_c* actor = &i_this->actor; + fopAc_ac_c* base_sw_p = fopAcM_SearchByID(actor->parentActorID); fopAc_ac_c* player = dComIfGp_getPlayer(0); obj_sw_class* sw_p = (obj_sw_class*) base_sw_p; sw_p->field_0x900 += 5.0f; cXyz unused_cxyz; int unused_sp10 = 0; - cLib_addCalcAngleS2(&a_this->current.angle.y, a_this->home.angle.y + 0x4000, 2, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.y, actor->home.angle.y + 0x4000, 2, 0x800); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: - i_this->mMode = 20; - i_this->mSound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); + i_this->mode = 20; + i_this->sound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); sw_p->field_0x8fc = 20.0f + XREG_F(0); sw_p->field_0xd10[i_this->field_0x630] = 10; - a_this->home.angle.y = sw_p->actor.current.angle.y; + actor->home.angle.y = sw_p->actor.current.angle.y; i_this->field_0x5fa = -0x4000; i_this->field_0x60c = 4000.0f; - if (i_this->field_0x5b6 == 0) { + if (i_this->set_id == 0) { anm_init(i_this, 24, 3.0f, 2, 1.0f); - i_this->mTimers[0] = 10000; - i_this->mTimers[1] = 15; + i_this->timer[0] = 10000; + i_this->timer[1] = 15; } break; case 2: anm_init(i_this, 48, 2.0f, 2, 1.0f); - i_this->mSound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); + i_this->sound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); sw_p->field_0x8fc = 20.0f + XREG_F(0); sw_p->field_0xd10[i_this->field_0x630] = 10; i_this->field_0x5fa = -0x8000; i_this->field_0x60c = 8000.0f; - i_this->mMode++; + i_this->mode++; break; case 3: if (i_this->field_0x5fa == s16(YREG_S(7) - 0x3800)) { - a_this->health = 10; - i_this->mMode = 20; - i_this->mTimers[0] = 0; + actor->health = 10; + i_this->mode = 20; + i_this->timer[0] = 0; } break; case 20: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if (cM_rndF(1.0f) < 0.3f) { anm_init(i_this, 17, 10.0f, 2, 1.0f); } else if (cM_rndF(1.0f) < 0.3f) { @@ -2253,22 +2253,22 @@ static void npc_ks_e_hang(npc_ks_class* i_this) { anm_init(i_this, 19, 10.0f, 2, 1.0f); } - i_this->mTimers[0] = 10000; - i_this->mTimers[1] = 35; + i_this->timer[0] = 10000; + i_this->timer[1] = 35; } - if (i_this->mTimers[1] == 1) { + if (i_this->timer[1] == 1) { anm_init(i_this, 24, 7.0f, 2, 1.0f); - } else if (i_this->mTimers[1] == 0) { + } else if (i_this->timer[1] == 0) { i_this->field_0x5fa = 0x4000; i_this->field_0x60c = 8000.0f; } } - a_this->current.pos = sw_p->field_0x920[i_this->field_0x630]; + actor->current.pos = sw_p->field_0x920[i_this->field_0x630]; cLib_addCalcAngleS2(&i_this->field_0x602, i_this->field_0x60c * cM_ssin(i_this->field_0x5fa), 4, 0x1000); i_this->field_0x5fa += NPC_KS_18DEG_ROT; - a_this->current.angle.z = -(i_this->field_0x602 / 4); + actor->current.angle.z = -(i_this->field_0x602 / 4); cLib_addCalc0(&i_this->field_0x60c, 0.5f, 100.0f + TREG_F(3)); } @@ -2279,7 +2279,7 @@ static int all_move_check(int param_1, int param_2) { int unused; if (saru_p[iVar1] == NULL) return 0; - if (param_1 != saru_p[iVar1]->field_0x5b6 && (saru_p[iVar1]->mActionID != 21 || saru_p[iVar1]->mMode != 20)) { + if (param_1 != saru_p[iVar1]->set_id && (saru_p[iVar1]->action != 21 || saru_p[iVar1]->mode != 20)) { return 0; } @@ -2294,7 +2294,7 @@ static int go_jump_check(int param_1) { while (reg_r30 >= 0) { // the following forces dbg stack reg to use r31: int unused; - if (saru_p[reg_r30]->mActionID != 21 || saru_p[reg_r30]->mTimers[2] != 0) { + if (saru_p[reg_r30]->action != 21 || saru_p[reg_r30]->timer[2] != 0) { return 0; } @@ -2305,127 +2305,127 @@ static int go_jump_check(int param_1) { } static int npc_ks_e_jump(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - cXyz sp28, unused_cxyz; - obj_sw_class* sw_p2 = i_this->field_0x934; + fopAc_ac_c* actor = &i_this->actor; + cXyz mae, unused_cxyz; + obj_sw_class* sw_p2 = i_this->child_no; npc_ks_class* ks_p = (npc_ks_class*)i_this->field_0x930; int rv = 2; - switch(i_this->mMode) { + switch(i_this->mode) { case 0: i_this->field_0xaec = 1; - if (i_this->field_0x5c4 > l_HIO.pull_distance) { + if (i_this->dis > l_HIO.pull_distance) { anm_init(i_this, 28, 5.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->mTimers[0] = 20; + i_this->mode = 1; + i_this->timer[0] = 20; } else { anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mMode = 5; - a_this->speedF = 0.0f; + i_this->mode = 5; + actor->speedF = 0.0f; } - if (fopAcM_GetRoomNo(a_this) == 4) { - a_this->current.pos.y = 3300.0f; - if (a_this->current.pos.x > 180.0f) { - a_this->current.pos.x = 180.0f; - } else if (a_this->current.pos.x < -180.0f) { - a_this->current.pos.x = -180.0f; + if (fopAcM_GetRoomNo(actor) == 4) { + actor->current.pos.y = 3300.0f; + if (actor->current.pos.x > 180.0f) { + actor->current.pos.x = 180.0f; + } else if (actor->current.pos.x < -180.0f) { + actor->current.pos.x = -180.0f; } } break; case 1: - a_this->speedF = l_HIO.holding_speed_h; - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x5c8, 1, 0x2000); + actor->speedF = l_HIO.holding_speed_h; + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->target_angle, 1, 0x2000); rv = 1; - if (i_this->mTimers[0] == 0 || i_this->field_0x5c4 < l_HIO.pull_distance - 20.0f) { + if (i_this->timer[0] == 0 || i_this->dis < l_HIO.pull_distance - 20.0f) { anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mMode = 5; - a_this->speedF = 0.0f; + i_this->mode = 5; + actor->speedF = 0.0f; } break; case 5: i_this->field_0x5fd = 1; - sp28 = ks_p->field_0x614 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp28.x, sp28.z); - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x2000); + mae = ks_p->field_0x614 - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x2000); - if (go_jump_check(i_this->field_0x5b6) != 0) { + if (go_jump_check(i_this->set_id) != 0) { anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mTimers[0] = 10; - i_this->mMode = 6; + i_this->timer[0] = 10; + i_this->mode = 6; i_this->field_0xaec = 0; } break; case 6: i_this->field_0x5fd = 1; - a_this->speedF = 20.0f; + actor->speedF = 20.0f; rv = 1; - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { anm_init(i_this, 32, 2.0f, 0, 1.0f); - i_this->mMode = 7; + i_this->mode = 7; } break; case 7: // bVar1 = true; i_this->field_0x5fd = 1; - if (i_this->field_0x5d0 == 32) { - a_this->speedF = 0.0f; - if (i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 32) { + actor->speedF = 0.0f; + if (i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + actor->speedF = 40.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->field_0x910 = a_this->current.pos; + i_this->field_0x910 = actor->current.pos; i_this->field_0xbe0 = 1; } } - i_this->field_0x8f0 = ks_p->field_0x614; - i_this->field_0x91c = i_this->field_0x8f0; - sp28 = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp28.x, sp28.z); - i_this->field_0x8fc.x = -cM_atan2s(sp28.y, JMAFastSqrt(sp28.x * sp28.x + sp28.z * sp28.z)); - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x2000); + i_this->guide_path = ks_p->field_0x614; + i_this->field_0x91c = i_this->guide_path; + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x2000); - if (a_this->speedF >= 40.0f) { + if (actor->speedF >= 40.0f) { i_this->field_0x90c = 1; cLib_addCalc2(&i_this->field_0x928, -183.0f + XREG_F(11), 1.0f, 15.0f + XREG_F(12)); - cLib_addCalcAngleS2(&a_this->current.angle.x, 0x1800, 4, 0x1800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0x1800, 4, 0x1800); } - if (sp28.abs() <= a_this->speedF * 1.2f) { - a_this->speedF = 0.0f; - i_this->mMode = 10; + if (mae.abs() <= actor->speedF * 1.2f) { + actor->speedF = 0.0f; + i_this->mode = 10; anm_init(i_this, 48, 2.0f, 2, 1.0f); - ks_p->mMode = 2; + ks_p->mode = 2; } break; case 10: - a_this->home.angle.y = sw_p2->actor.current.angle.y; - a_this->current.angle.y = a_this->home.angle.y; - a_this->current.pos = ks_p->field_0x614; - a_this->current.angle.x = (s16)((int)ks_p->field_0x602 << 1); + actor->home.angle.y = sw_p2->actor.current.angle.y; + actor->current.angle.y = actor->home.angle.y; + actor->current.pos = ks_p->field_0x614; + actor->current.angle.x = (s16)((int)ks_p->field_0x602 << 1); if (ks_p->actor.health != 10) break; ks_p->actor.health = 0; - i_this->field_0x910 = a_this->current.pos; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); + i_this->field_0x910 = actor->current.pos; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_THROW, -1); - if (fopAcM_GetRoomNo(a_this) == 2) { - a_this->speedF = 25.0f + NREG_F(16); + if (fopAcM_GetRoomNo(actor) == 2) { + actor->speedF = 25.0f + NREG_F(16); } else { - a_this->speedF = 40.0f + NREG_F(15); + actor->speedF = 40.0f + NREG_F(15); } - if (ks_p->field_0x5b6 == i_this->field_0x5b6 - 1) { - i_this->mMode = 11; + if (ks_p->set_id == i_this->set_id - 1) { + i_this->mode = 11; } else { - i_this->mMode = 20; - i_this->field_0x930 = saru_p[ks_p->field_0x5b6 + 1]; + i_this->mode = 20; + i_this->field_0x930 = saru_p[ks_p->set_id + 1]; } anm_init(i_this, 33, 1.0f, 0, 1.0f); @@ -2433,73 +2433,73 @@ static int npc_ks_e_jump(npc_ks_class* i_this) { // fallthrough case 11: i_this->field_0x90c = 1; - i_this->field_0x630 = (i_this->field_0x5b6 + 1) * (sw_p2->field_0xd8c / (sw_p2->field_0x91c + 1)) - 1; - i_this->field_0x8f0 = sw_p2->field_0x920[i_this->field_0x630]; + i_this->field_0x630 = (i_this->set_id + 1) * (sw_p2->field_0xd8c / (sw_p2->field_0x91c + 1)) - 1; + i_this->guide_path = sw_p2->field_0x920[i_this->field_0x630]; - a_this->parentActorID = fopAcM_GetID(sw_p2); - i_this->field_0x91c = i_this->field_0x8f0; - sp28 = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp28.x, sp28.z); - i_this->field_0x8fc.x = -cM_atan2s(sp28.y, JMAFastSqrt(sp28.x * sp28.x + sp28.z * sp28.z)); + actor->parentActorID = fopAcM_GetID(sw_p2); + i_this->field_0x91c = i_this->guide_path; + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); - if (sp28.abs() <= a_this->speedF * 1.2f) { - a_this->speedF = 0.0f; - i_this->mMode = 12; + if (mae.abs() <= actor->speedF * 1.2f) { + actor->speedF = 0.0f; + i_this->mode = 12; anm_init(i_this, 24, 2.0f, 2, 1.0f); - i_this->mSound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); + i_this->sound.startCreatureSound(Z2SE_FN_ROPE_CREAK, 0, -1); sw_p2->field_0x8fc = 20.0f + XREG_F(0); sw_p2->field_0xd10[i_this->field_0x630] = 10; } // fallthrough case 12: cLib_addCalc0(&i_this->field_0x928, 1.0f, 15.0f + NREG_F(17)); - cLib_addCalcAngleS2(&a_this->current.angle.x, -0x8000, 1, 0x700 + NREG_S(7)); - if (i_this->mMode == 12 && i_this->field_0x928 == 0.0f) { - if (all_move_check(i_this->field_0x5b6, sw_p2->field_0x91c) != 0) { + cLib_addCalcAngleS2(&actor->current.angle.x, -0x8000, 1, 0x700 + NREG_S(7)); + if (i_this->mode == 12 && i_this->field_0x928 == 0.0f) { + if (all_move_check(i_this->set_id, sw_p2->field_0x91c) != 0) { all_carry_finish(sw_p2->field_0x91c); } else { - i_this->mActionID = 21; - i_this->mMode = 0; - i_this->mTimers[2] = 15; + i_this->action = 21; + i_this->mode = 0; + i_this->timer[2] = 15; } } break; case 20: i_this->field_0x90c = 1; - cLib_addCalcAngleS2(&a_this->current.angle.x, 0x1800, 4, 0x1800); - i_this->field_0x8f0 = ks_p->field_0x614; - i_this->field_0x91c = i_this->field_0x8f0; - sp28 = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp28.x, sp28.z); - i_this->field_0x8fc.x = -cM_atan2s(sp28.y, JMAFastSqrt(sp28.x * sp28.x + sp28.z * sp28.z)); + cLib_addCalcAngleS2(&actor->current.angle.x, 0x1800, 4, 0x1800); + i_this->guide_path = ks_p->field_0x614; + i_this->field_0x91c = i_this->guide_path; + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); - if (sp28.abs() <= a_this->speedF * 1.2f) { - a_this->speedF = 0.0f; - i_this->mMode = 10; + if (mae.abs() <= actor->speedF * 1.2f) { + actor->speedF = 0.0f; + i_this->mode = 10; anm_init(i_this, 48, 2.0f, 2, 1.0f); - ks_p->mMode = 2; + ks_p->mode = 2; } } - if (i_this->mMode != 11 && i_this->mMode != 12) { - i_this->field_0x608 = (s16)((int)a_this->current.angle.x << 1); + if (i_this->mode != 11 && i_this->mode != 12) { + i_this->field_0x608 = (s16)((int)actor->current.angle.x << 1); } return rv; } static npc_ks_class* get_move_saru(npc_ks_class* i_this, int param_2) { - fopAc_ac_c* a_this = &i_this->actor; - if (fopAcM_GetRoomNo(a_this) == 0) { + fopAc_ac_c* actor = &i_this->actor; + if (fopAcM_GetRoomNo(actor) == 0) { for (int i = 0; i < 2; i++) { - if (saru_p[i] != NULL && (saru_p[i]->mActionID == 20 || saru_p[i]->mActionID == 22) && i_this->field_0xb40 == saru_p[i]->field_0x934->field_0x570) { + if (saru_p[i] != NULL && (saru_p[i]->action == 20 || saru_p[i]->action == 22) && i_this->field_0xb40 == saru_p[i]->child_no->field_0x570) { return saru_p[i]; } } } else { for (int i = 0; i < param_2; i++) { - if (i_this->field_0xb40 == saru_p[i]->field_0x934->field_0x570 && ((saru_p[i]->mActionID == 20 || saru_p[i]->mActionID == 22) || saru_p[i]->mTimers[2] != 0)) { + if (i_this->field_0xb40 == saru_p[i]->child_no->field_0x570 && ((saru_p[i]->action == 20 || saru_p[i]->action == 22) || saru_p[i]->timer[2] != 0)) { return saru_p[i]; } } @@ -2509,10 +2509,10 @@ static npc_ks_class* get_move_saru(npc_ks_class* i_this, int param_2) { } static int all_hang_check(npc_ks_class* i_this, int param_2) { - fopAc_ac_c* a_this = &i_this->actor; - if (fopAcM_GetRoomNo(a_this) == 0) { + fopAc_ac_c* actor = &i_this->actor; + if (fopAcM_GetRoomNo(actor) == 0) { for (int i = 0; i < 2; i++) { - if (saru_p[i] != NULL && saru_p[i]->field_0x5b5 != 0 && i_this->field_0xb40 == saru_p[i]->field_0x934->field_0x570) { + if (saru_p[i] != NULL && saru_p[i]->field_0x5b5 != 0 && i_this->field_0xb40 == saru_p[i]->child_no->field_0x570) { return 1; } } @@ -2530,12 +2530,12 @@ static int all_hang_check(npc_ks_class* i_this, int param_2) { } static void cam_3d_morf(npc_ks_class* i_this, f32 param_2) { - cLib_addCalc2(&i_this->field_0xb60.x, i_this->field_0xb6c.x, param_2, i_this->field_0xb84.x * i_this->field_0xbc4); - cLib_addCalc2(&i_this->field_0xb60.y, i_this->field_0xb6c.y, param_2, i_this->field_0xb84.y * i_this->field_0xbc4); - cLib_addCalc2(&i_this->field_0xb60.z, i_this->field_0xb6c.z, param_2, i_this->field_0xb84.z * i_this->field_0xbc4); - cLib_addCalc2(&i_this->field_0xb48.x, i_this->field_0xb54.x, param_2, i_this->field_0xb78.x * i_this->field_0xbc4); - cLib_addCalc2(&i_this->field_0xb48.y, i_this->field_0xb54.y, param_2, i_this->field_0xb78.y * i_this->field_0xbc4); - cLib_addCalc2(&i_this->field_0xb48.z, i_this->field_0xb54.z, param_2, i_this->field_0xb78.z * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_eye.x, i_this->field_0xb6c.x, param_2, i_this->field_0xb84.x * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_eye.y, i_this->field_0xb6c.y, param_2, i_this->field_0xb84.y * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_eye.z, i_this->field_0xb6c.z, param_2, i_this->field_0xb84.z * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_way.x, i_this->field_0xb54.x, param_2, i_this->field_0xb78.x * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_way.y, i_this->field_0xb54.y, param_2, i_this->field_0xb78.y * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_way.z, i_this->field_0xb54.z, param_2, i_this->field_0xb78.z * i_this->field_0xbc4); } static void* s_fs_sub(void* i_actor, void* i_data) { @@ -2557,66 +2557,66 @@ static void* s_fsdown_sub(void* i_actor, void* i_data) { } static void demo_camera(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); camera_class* unused_cam_p = dComIfGp_getCamera(0); - obj_sw_class* sw_p = i_this->field_0x934; - fopAc_ac_c* base_cage_p = &sw_p->actor; - cXyz sp44, sp50; + obj_sw_class* sw_p = i_this->child_no; + fopAc_ac_c* base_sw_p = &sw_p->actor; + cXyz mae, ato; f32 fVar1, fVar2; npc_ks_class* npc_ks_p; obj_brg_class* brg_p; daMidna_c* midna_p; - switch (i_this->field_0xb42) { + switch (i_this->demo_mode) { case 0: break; case 1: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 2; + i_this->demo_mode = 2; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; + i_this->demo_camera_no = 0; player->changeOriginalDemo(); player->changeDemoMode(19, 0, 0, 0); player->changeDemoParam0(0); - i_this->field_0xb60 = player->current.pos; + i_this->demo_eye = player->current.pos; i_this->field_0xba8.z = 500.0f + AREG_F(0); i_this->field_0xba8.x = 500.0f + AREG_F(1); i_this->field_0xba8.y = 0.0f + AREG_F(2); // fallthrough case 2: - i_this->field_0xbb8 = 55.0f; - cLib_addCalc2(&i_this->field_0xb60.x, player->current.pos.x, 0.2f, 50.0f + AREG_F(16)); - cLib_addCalc2(&i_this->field_0xb60.y, base_cage_p->current.pos.y + AREG_F(4) - 250.0f, 0.2f, 50.0f + AREG_F(16)); - cLib_addCalc2(&i_this->field_0xb60.z, player->current.pos.z, 0.2f, 50.0f + AREG_F(16)); - if (fopAcM_GetRoomNo(a_this) == 2) { - cMtx_YrotS(*calc_mtx, base_cage_p->current.angle.y); + i_this->target_speed = 55.0f; + cLib_addCalc2(&i_this->demo_eye.x, player->current.pos.x, 0.2f, 50.0f + AREG_F(16)); + cLib_addCalc2(&i_this->demo_eye.y, base_sw_p->current.pos.y + AREG_F(4) - 250.0f, 0.2f, 50.0f + AREG_F(16)); + cLib_addCalc2(&i_this->demo_eye.z, player->current.pos.z, 0.2f, 50.0f + AREG_F(16)); + if (fopAcM_GetRoomNo(actor) == 2) { + cMtx_YrotS(*calc_mtx, base_sw_p->current.angle.y); } else { cMtx_YrotS(*calc_mtx, player->shape_angle.y); } - sp44.x = i_this->field_0xba8.x; - sp44.y = i_this->field_0xba8.y; - sp44.z = i_this->field_0xba8.z; - MtxPosition(&sp44,&sp50); + mae.x = i_this->field_0xba8.x; + mae.y = i_this->field_0xba8.y; + mae.z = i_this->field_0xba8.z; + MtxPosition(&mae,&ato); - sp50.x = sp50.x + player->current.pos.x; - sp50.y = sp50.y + (base_cage_p->current.pos.y + AREG_F(5) - 250.0f); - sp50.z = sp50.z + player->current.pos.z; - if (i_this->field_0xb44 == 0) { - i_this->field_0xb48 = sp50; + ato.x = ato.x + player->current.pos.x; + ato.y = ato.y + (base_sw_p->current.pos.y + AREG_F(5) - 250.0f); + ato.z = ato.z + player->current.pos.z; + if (i_this->demo_camera_no == 0) { + i_this->demo_way = ato; } else { - cLib_addCalc2(&i_this->field_0xb48.x, sp50.x, 0.1f, 200.0f); - cLib_addCalc2(&i_this->field_0xb48.y, sp50.y, 0.1f, 200.0f); - cLib_addCalc2(&i_this->field_0xb48.z, sp50.z, 0.1f, 200.0f); + cLib_addCalc2(&i_this->demo_way.x, ato.x, 0.1f, 200.0f); + cLib_addCalc2(&i_this->demo_way.y, ato.y, 0.1f, 200.0f); + cLib_addCalc2(&i_this->demo_way.z, ato.z, 0.1f, 200.0f); } if (i_this->field_0x92c != 0) { @@ -2625,447 +2625,447 @@ static void demo_camera(npc_ks_class* i_this) { break; case 3: - cLib_addCalc2(&i_this->field_0xb60.x, player->current.pos.x, 0.4f, 100.0f); - cLib_addCalc2(&i_this->field_0xb60.y, player->current.pos.y + BREG_F(19) + 70.0f, 0.4f, 100.0f ); - cLib_addCalc2(&i_this->field_0xb60.z, player->current.pos.z, 0.4f, 100.0f); + cLib_addCalc2(&i_this->demo_eye.x, player->current.pos.x, 0.4f, 100.0f); + cLib_addCalc2(&i_this->demo_eye.y, player->current.pos.y + BREG_F(19) + 70.0f, 0.4f, 100.0f ); + cLib_addCalc2(&i_this->demo_eye.z, player->current.pos.z, 0.4f, 100.0f); cMtx_YrotS(*calc_mtx, player->shape_angle.y); fVar1 = 50.0f; - if (fopAcM_GetRoomNo(a_this) == 4 && i_this->field_0xbdb == 0) { - sp44.x = 100.0f + BREG_F(10); - sp44.y = 100.0f + BREG_F(11); - sp44.z = 300.0f + BREG_F(12); + if (fopAcM_GetRoomNo(actor) == 4 && i_this->field_0xbdb == 0) { + mae.x = 100.0f + BREG_F(10); + mae.y = 100.0f + BREG_F(11); + mae.z = 300.0f + BREG_F(12); - if (i_this->field_0xb44 == 10 + NREG_S(6)) { + if (i_this->demo_camera_no == 10 + NREG_S(6)) { player->changeDemoMode(40, 0, 0, 0); } - if (i_this->field_0xb44 == 28 + NREG_S(7)) { + if (i_this->demo_camera_no == 28 + NREG_S(7)) { player->changeDemoMode(41, 0, 0, 0); } - if (i_this->field_0xb44 == 40 + NREG_S(8)) { - i_this->field_0xb42 = 100; + if (i_this->demo_camera_no == 40 + NREG_S(8)) { + i_this->demo_mode = 100; i_this->field_0xbdb = 1; } fVar1 = 200.0f; } else { - sp44.x = 0.0f; - sp44.y = 0.0f; - sp44.z = -400.0f; + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = -400.0f; - if (i_this->field_0xb44 == 8) { - i_this->field_0xb42 = 100; + if (i_this->demo_camera_no == 8) { + i_this->demo_mode = 100; } } - MtxPosition(&sp44, &sp50); - sp50.x = sp50.x + player->current.pos.x; - sp50.y = sp50.y + player->current.pos.y; - sp50.z = sp50.z + player->current.pos.z; - cLib_addCalc2(&i_this->field_0xb48.x, sp50.x, 0.2f, fVar1); - cLib_addCalc2(&i_this->field_0xb48.y, sp50.y, 0.2f, fVar1); - cLib_addCalc2(&i_this->field_0xb48.z, sp50.z, 0.2f, fVar1); + MtxPosition(&mae, &ato); + ato.x = ato.x + player->current.pos.x; + ato.y = ato.y + player->current.pos.y; + ato.z = ato.z + player->current.pos.z; + cLib_addCalc2(&i_this->demo_way.x, ato.x, 0.2f, fVar1); + cLib_addCalc2(&i_this->demo_way.y, ato.y, 0.2f, fVar1); + cLib_addCalc2(&i_this->demo_way.z, ato.z, 0.2f, fVar1); break; case 10: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 11; + i_this->demo_mode = 11; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; i_this->field_0xba8.z = 500.0f + AREG_F(0); i_this->field_0xba8.x = 500.0f + AREG_F(1); i_this->field_0xba8.y = AREG_F(2); i_this->field_0xbc0 = NULL; // fallthrough case 11: - sp50 = i_this->field_0xbc8; - sp50.y = player->current.pos.y; - setPlayerPosAndAngle(&sp50, player->shape_angle.y); + ato = i_this->field_0xbc8; + ato.y = player->current.pos.y; + setPlayerPosAndAngle(&ato, player->shape_angle.y); npc_ks_p = i_this->field_0xbc0; i_this->field_0xbc0 = get_move_saru(i_this,sw_p->field_0x91c);; - i_this->field_0xb6c.y = base_cage_p->current.pos.y + AREG_F(4) - 200.0f; + i_this->field_0xb6c.y = base_sw_p->current.pos.y + AREG_F(4) - 200.0f; if (i_this->field_0xbc0 != NULL) { - base_cage_p = (fopAc_ac_c*) i_this->field_0xbc0->field_0x934; + base_sw_p = (fopAc_ac_c*) i_this->field_0xbc0->child_no; cMtx_YrotS(*calc_mtx, i_this->field_0xbd4); - sp44.x = i_this->field_0xba8.x; - sp44.y = i_this->field_0xba8.y; - sp44.z = i_this->field_0xba8.z; - MtxPosition(&sp44, &i_this->field_0xb54); + mae.x = i_this->field_0xba8.x; + mae.y = i_this->field_0xba8.y; + mae.z = i_this->field_0xba8.z; + MtxPosition(&mae, &i_this->field_0xb54); i_this->field_0xb54.x += i_this->field_0xbc0->actor.current.pos.x; - i_this->field_0xb54.y += base_cage_p->current.pos.y + AREG_F(5) - 250.0f; + i_this->field_0xb54.y += base_sw_p->current.pos.y + AREG_F(5) - 250.0f; i_this->field_0xb54.z += i_this->field_0xbc0->actor.current.pos.z; i_this->field_0xb6c.x = i_this->field_0xbc0->actor.current.pos.x; - i_this->field_0xb6c.y = base_cage_p->current.pos.y + AREG_F(4) - 200.0f; + i_this->field_0xb6c.y = base_sw_p->current.pos.y + AREG_F(4) - 200.0f; - if (i_this->field_0xbc0->mActionID == 20 && i_this->field_0xb6c.y < i_this->field_0xbc0->actor.current.pos.y + AREG_F(8)) { + if (i_this->field_0xbc0->action == 20 && i_this->field_0xb6c.y < i_this->field_0xbc0->actor.current.pos.y + AREG_F(8)) { i_this->field_0xb6c.y = i_this->field_0xbc0->actor.current.pos.y + AREG_F(8); } i_this->field_0xb6c.z = i_this->field_0xbc0->actor.current.pos.z; if (npc_ks_p != i_this->field_0xbc0) { - i_this->field_0xb48 = i_this->field_0xb54; - i_this->field_0xb60 = i_this->field_0xb6c; + i_this->demo_way = i_this->field_0xb54; + i_this->demo_eye = i_this->field_0xb6c; } i_this->field_0xb84.set(200.0f, 200.0f, 200.0f); i_this->field_0xbc4 = 1.0f; } else { if (all_hang_check(i_this, sw_p->field_0x91c) != 0) { - i_this->field_0xb42 = 12; - if (fopAcM_GetRoomNo(a_this) == 0) { - i_this->field_0xb44 = 45; + i_this->demo_mode = 12; + if (fopAcM_GetRoomNo(actor) == 0) { + i_this->demo_camera_no = 45; } else if (sw_p->field_0x91c >= 3) { i_this->field_0xb6c.x = saru_p[sw_p->field_0x91c - 2]->actor.current.pos.x; i_this->field_0xb6c.y = saru_p[sw_p->field_0x91c - 2]->actor.current.pos.y; i_this->field_0xb6c.y = i_this->field_0xb6c.y - 150.0f; i_this->field_0xb6c.z = saru_p[sw_p->field_0x91c - 2]->actor.current.pos.z; - i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->field_0xb60.x); - i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->field_0xb60.y); - i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->field_0xb60.z); + i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x); + i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y); + i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z); i_this->field_0xbc4 = 0.0f; - i_this->field_0xb44 = 5; + i_this->demo_camera_no = 5; } else { - i_this->field_0xb44 = 45 + AREG_S(4); + i_this->demo_camera_no = 45 + AREG_S(4); } } } // fallthrough case 12: - cLib_addCalc2(&i_this->field_0xb48.x, i_this->field_0xb54.x, 0.2f, i_this->field_0xbc4 * 200.0f); - cLib_addCalc2(&i_this->field_0xb48.y, i_this->field_0xb54.y, 0.2f, i_this->field_0xbc4 * 200.0f); - cLib_addCalc2(&i_this->field_0xb48.z, i_this->field_0xb54.z, 0.2f, i_this->field_0xbc4 * 200.0f); - cLib_addCalc2(&i_this->field_0xb60.x, i_this->field_0xb6c.x, 0.2f, i_this->field_0xb84.x * i_this->field_0xbc4); - cLib_addCalc2(&i_this->field_0xb60.y, i_this->field_0xb6c.y, 0.2f, i_this->field_0xb84.y * i_this->field_0xbc4); - cLib_addCalc2(&i_this->field_0xb60.z, i_this->field_0xb6c.z, 0.2f, i_this->field_0xb84.z * i_this->field_0xbc4); - if (i_this->field_0xb42 == 12) { - cLib_addCalc2(&i_this->field_0xbb8, 40.0f, 0.2f, i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_way.x, i_this->field_0xb54.x, 0.2f, i_this->field_0xbc4 * 200.0f); + cLib_addCalc2(&i_this->demo_way.y, i_this->field_0xb54.y, 0.2f, i_this->field_0xbc4 * 200.0f); + cLib_addCalc2(&i_this->demo_way.z, i_this->field_0xb54.z, 0.2f, i_this->field_0xbc4 * 200.0f); + cLib_addCalc2(&i_this->demo_eye.x, i_this->field_0xb6c.x, 0.2f, i_this->field_0xb84.x * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_eye.y, i_this->field_0xb6c.y, 0.2f, i_this->field_0xb84.y * i_this->field_0xbc4); + cLib_addCalc2(&i_this->demo_eye.z, i_this->field_0xb6c.z, 0.2f, i_this->field_0xb84.z * i_this->field_0xbc4); + if (i_this->demo_mode == 12) { + cLib_addCalc2(&i_this->target_speed, 40.0f, 0.2f, i_this->field_0xbc4); cLib_addCalc2(&i_this->field_0xbc4, 0.1f, 1.0f, 0.005f); - if (85 < i_this->field_0xb44) { - i_this->field_0xb42 = 100; - sp44.x = saru_p[i_this->field_0xb40]->actor.current.pos.x - i_this->field_0xbc8.x; - sp44.z = saru_p[i_this->field_0xb40]->actor.current.pos.z - i_this->field_0xbc8.z; - s16 angle = cM_atan2s(sp44.x, sp44.z); + if (85 < i_this->demo_camera_no) { + i_this->demo_mode = 100; + mae.x = saru_p[i_this->field_0xb40]->actor.current.pos.x - i_this->field_0xbc8.x; + mae.z = saru_p[i_this->field_0xb40]->actor.current.pos.z - i_this->field_0xbc8.z; + s16 angle = cM_atan2s(mae.x, mae.z); cMtx_YrotS(*calc_mtx, angle); - sp44.x = 0.0f; - sp44.y = 0.0f; - if (fopAcM_GetRoomNo(a_this) == 4) { - sp44.z = -250.0f + JREG_F(0); + mae.x = 0.0f; + mae.y = 0.0f; + if (fopAcM_GetRoomNo(actor) == 4) { + mae.z = -250.0f + JREG_F(0); } else { - sp44.z = -150.0f + JREG_F(0); + mae.z = -150.0f + JREG_F(0); } - MtxPosition(&sp44,&sp50); - sp50.x = sp50.x + i_this->field_0xbc8.x; - sp50.z = sp50.z + i_this->field_0xbc8.z; + MtxPosition(&mae,&ato); + ato.x = ato.x + i_this->field_0xbc8.x; + ato.z = ato.z + i_this->field_0xbc8.z; - if (fopAcM_GetRoomNo(a_this) == 2) { - sp50.y = 3764.0f; + if (fopAcM_GetRoomNo(actor) == 2) { + ato.y = 3764.0f; } else { - sp50.y = player->current.pos.y; + ato.y = player->current.pos.y; } - setPlayerPosAndAngle(&sp50, angle); - sp44.x = 0.0f; - sp44.y = 100.0f + JREG_F(1); - sp44.z = -250.0f + JREG_F(2); - MtxPosition(&sp44, &i_this->field_0xb48); - i_this->field_0xb48 += player->current.pos; - i_this->field_0xb60 = player->current.pos; - i_this->field_0xb60.y += 120.0f; - i_this->field_0xbb8 = 55.0f; + setPlayerPosAndAngle(&ato, angle); + mae.x = 0.0f; + mae.y = 100.0f + JREG_F(1); + mae.z = -250.0f + JREG_F(2); + MtxPosition(&mae, &i_this->demo_way); + i_this->demo_way += player->current.pos; + i_this->demo_eye = player->current.pos; + i_this->demo_eye.y += 120.0f; + i_this->target_speed = 55.0f; } } break; case 60: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 61; + i_this->demo_mode = 61; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - cMtx_YrotS(*calc_mtx, s16(a_this->shape_angle.y)); - sp44.x = 300.0f + WREG_F(11); - sp44.y = 100.0f + WREG_F(12); - sp44.z = WREG_F(13); - MtxPosition(&sp44, &i_this->field_0xb48); - i_this->field_0xb48 += a_this->current.pos; + i_this->demo_camera_no = 0; + cMtx_YrotS(*calc_mtx, s16(actor->shape_angle.y)); + mae.x = 300.0f + WREG_F(11); + mae.y = 100.0f + WREG_F(12); + mae.z = WREG_F(13); + MtxPosition(&mae, &i_this->demo_way); + i_this->demo_way += actor->current.pos; - sp44.x = i_this->field_0xb48.x - player->current.pos.x; - sp44.z = i_this->field_0xb48.z - player->current.pos.z; - if (sp44.x * sp44.x + sp44.z * sp44.z < 10000.0f) { + mae.x = i_this->demo_way.x - player->current.pos.x; + mae.z = i_this->demo_way.z - player->current.pos.z; + if (mae.x * mae.x + mae.z * mae.z < 10000.0f) { OS_REPORT("////////KS PL REVISED \n"); - i_this->field_0xb48.x += + 200.0f + JREG_F(7); - i_this->field_0xb48.z += JREG_F(8); + i_this->demo_way.x += + 200.0f + JREG_F(7); + i_this->demo_way.z += JREG_F(8); } - i_this->field_0xb60 = a_this->eyePos; - i_this->field_0xb60.y += WREG_F(10); + i_this->demo_eye = actor->eyePos; + i_this->demo_eye.y += WREG_F(10); player->changeOriginalDemo(); player->changeDemoMode(1, 1, 0, 0); // fallthrough case 61: - sp50 = player->old.pos; - sp50.y = 3150.0f; - setPlayerPosAndAngle(&sp50, player->shape_angle.y); - i_this->field_0xbb8 = 65.0f + WREG_F(8); - cLib_addCalc2(&i_this->field_0xb60.x, a_this->eyePos.x, 0.1f + WREG_F(9), 50.0f); - cLib_addCalc2(&i_this->field_0xb60.y, a_this->eyePos.y + WREG_F(10), 0.1f + WREG_F(9), 50.0f); - cLib_addCalc2(&i_this->field_0xb60.z, a_this->eyePos.z, 0.1f + WREG_F(9), 50.0f); + ato = player->old.pos; + ato.y = 3150.0f; + setPlayerPosAndAngle(&ato, player->shape_angle.y); + i_this->target_speed = 65.0f + WREG_F(8); + cLib_addCalc2(&i_this->demo_eye.x, actor->eyePos.x, 0.1f + WREG_F(9), 50.0f); + cLib_addCalc2(&i_this->demo_eye.y, actor->eyePos.y + WREG_F(10), 0.1f + WREG_F(9), 50.0f); + cLib_addCalc2(&i_this->demo_eye.z, actor->eyePos.z, 0.1f + WREG_F(9), 50.0f); break; case 70: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 71; + i_this->demo_mode = 71; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); player->changeDemoMode(1, 1, 0, 0); // fallthrough case 71: - if (i_this->field_0xb44 == 0) { - i_this->field_0xb60 = a_this->current.pos; - i_this->field_0xb60.y = a_this->current.pos.y + 120.0f + VREG_F(6); - i_this->field_0xb48.set(-4786.0f, 3982.0f, -1843.0f); - } else if (i_this->field_0xb44 == 210 + WREG_S(0)) { - i_this->field_0xb48.set(-3232.0f, 4137.0f, -1425.0f); - } else if (i_this->field_0xb44 == 240 + WREG_S(1)) { - i_this->field_0xb48.set(-2459.0f, 4199.0f, -2752.0f); - } else if (i_this->field_0xb44 == 290 + WREG_S(2)) { - i_this->field_0xb48.set(103.0f, 4025.0f, -1930.0f); + if (i_this->demo_camera_no == 0) { + i_this->demo_eye = actor->current.pos; + i_this->demo_eye.y = actor->current.pos.y + 120.0f + VREG_F(6); + i_this->demo_way.set(-4786.0f, 3982.0f, -1843.0f); + } else if (i_this->demo_camera_no == 210 + WREG_S(0)) { + i_this->demo_way.set(-3232.0f, 4137.0f, -1425.0f); + } else if (i_this->demo_camera_no == 240 + WREG_S(1)) { + i_this->demo_way.set(-2459.0f, 4199.0f, -2752.0f); + } else if (i_this->demo_camera_no == 290 + WREG_S(2)) { + i_this->demo_way.set(103.0f, 4025.0f, -1930.0f); } - cLib_addCalc2(&i_this->field_0xb60.x, a_this->current.pos.x, 0.2f, 60.0f); - cLib_addCalc2(&i_this->field_0xb60.y, a_this->current.pos.y + 120.0f + VREG_F(6), 0.1f, 30.0f); - cLib_addCalc2(&i_this->field_0xb60.z, a_this->current.pos.z, 0.2f, 60.0f); + cLib_addCalc2(&i_this->demo_eye.x, actor->current.pos.x, 0.2f, 60.0f); + cLib_addCalc2(&i_this->demo_eye.y, actor->current.pos.y + 120.0f + VREG_F(6), 0.1f, 30.0f); + cLib_addCalc2(&i_this->demo_eye.z, actor->current.pos.z, 0.2f, 60.0f); - if (i_this->field_0xb44 == 358) { - i_this->field_0xb42 = 99; + if (i_this->demo_camera_no == 358) { + i_this->demo_mode = 99; } break; case 72: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 73; + i_this->demo_mode = 73; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); player->changeDemoMode(1, 1, 0, 0); // fallthrough case 73: - if (i_this->field_0xb44 == 0) { - i_this->field_0xb60 = a_this->current.pos; - i_this->field_0xb60.y = a_this->current.pos.y + 120.0f + VREG_F(6); - i_this->field_0xb48.set(-112.0f, 2420.0f, 13414.0f); + if (i_this->demo_camera_no == 0) { + i_this->demo_eye = actor->current.pos; + i_this->demo_eye.y = actor->current.pos.y + 120.0f + VREG_F(6); + i_this->demo_way.set(-112.0f, 2420.0f, 13414.0f); } - sp50.set(145.0f, 2354.0f, 13179.0f); - setPlayerPosAndAngle(&sp50, -0x691B); - cLib_addCalc2(&i_this->field_0xb60.x, a_this->current.pos.x, 0.1f, 20.0f); - cLib_addCalc2(&i_this->field_0xb60.y, a_this->current.pos.y + 120.0f + VREG_F(6), 0.1f, 10.0f); - cLib_addCalc2(&i_this->field_0xb60.z, a_this->current.pos.z, 0.12f, 20.0f); + ato.set(145.0f, 2354.0f, 13179.0f); + setPlayerPosAndAngle(&ato, -0x691B); + cLib_addCalc2(&i_this->demo_eye.x, actor->current.pos.x, 0.1f, 20.0f); + cLib_addCalc2(&i_this->demo_eye.y, actor->current.pos.y + 120.0f + VREG_F(6), 0.1f, 10.0f); + cLib_addCalc2(&i_this->demo_eye.z, actor->current.pos.z, 0.12f, 20.0f); - if (i_this->field_0xb44 == 280) { - i_this->field_0xb42 = 100; + if (i_this->demo_camera_no == 280) { + i_this->demo_mode = 100; } break; case 75: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 76; + i_this->demo_mode = 76; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); player->changeDemoMode(1,1,0,0); // fallthrough case 76: - setPlayerPosAndAngle(&player->current.pos, i_this->field_0x5c8 + 0x8000); - if (i_this->field_0xb44 == 0) { - cMtx_YrotS(*calc_mtx,a_this->shape_angle.y); - sp44.x = 0.0f; - sp44.y = 100.0f + JREG_F(1); - sp44.z = 400.0f + JREG_F(2); - MtxPosition(&sp44, &i_this->field_0xb48); - i_this->field_0xb48 += a_this->current.pos; - i_this->field_0xb60 = a_this->current.pos; - i_this->field_0xb60.y = a_this->current.pos.y + 120.0f + VREG_F(6); + setPlayerPosAndAngle(&player->current.pos, i_this->target_angle + 0x8000); + if (i_this->demo_camera_no == 0) { + cMtx_YrotS(*calc_mtx,actor->shape_angle.y); + mae.x = 0.0f; + mae.y = 100.0f + JREG_F(1); + mae.z = 400.0f + JREG_F(2); + MtxPosition(&mae, &i_this->demo_way); + i_this->demo_way += actor->current.pos; + i_this->demo_eye = actor->current.pos; + i_this->demo_eye.y = actor->current.pos.y + 120.0f + VREG_F(6); } - cLib_addCalc2(&i_this->field_0xb60.x, a_this->current.pos.x, 0.2f, 60.0f); - cLib_addCalc2(&i_this->field_0xb60.y, a_this->current.pos.y + 120.0f + VREG_F(6), 0.1f, 30.0f); - cLib_addCalc2(&i_this->field_0xb60.z, a_this->current.pos.z, 0.2f, 60.0f); - if (i_this->field_0xb44 == 180) { - i_this->field_0xb42 = 99; + cLib_addCalc2(&i_this->demo_eye.x, actor->current.pos.x, 0.2f, 60.0f); + cLib_addCalc2(&i_this->demo_eye.y, actor->current.pos.y + 120.0f + VREG_F(6), 0.1f, 30.0f); + cLib_addCalc2(&i_this->demo_eye.z, actor->current.pos.z, 0.2f, 60.0f); + if (i_this->demo_camera_no == 180) { + i_this->demo_mode = 99; } break; case 77: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 78; + i_this->demo_mode = 78; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); player->changeDemoMode(1, 1, 0, 0); - i_this->field_0xbb8 = 65.0f; - i_this->field_0xb60.set(8486.0f, 4143.0f, -10114.0f); - i_this->field_0xb48.set(8364.0f, 4325.0f, -9756.0f); + i_this->target_speed = 65.0f; + i_this->demo_eye.set(8486.0f, 4143.0f, -10114.0f); + i_this->demo_way.set(8364.0f, 4325.0f, -9756.0f); // fallthrough case 78: - cLib_addCalc2(&i_this->field_0xbb8, 55.0f, 0.05f, 0.2f); - if (i_this->field_0xb44 != 80) break; - i_this->field_0xb42 = 79; - i_this->field_0xb44 = 0; + cLib_addCalc2(&i_this->target_speed, 55.0f, 0.05f, 0.2f); + if (i_this->demo_camera_no != 80) break; + i_this->demo_mode = 79; + i_this->demo_camera_no = 0; // fallthrough case 79: - if (i_this->field_0xb44 == 0) { - i_this->field_0xb60 = a_this->current.pos; - i_this->field_0xb60.y = a_this->current.pos.y + 120.0f + VREG_F(6); - i_this->field_0xb48.set(6899.0f, 3867.0f, -8870.0f); - } else if (i_this->field_0xb44 == 60) { - i_this->field_0xb48.set(8222.0f, 3896.0f, -9579.0f); + if (i_this->demo_camera_no == 0) { + i_this->demo_eye = actor->current.pos; + i_this->demo_eye.y = actor->current.pos.y + 120.0f + VREG_F(6); + i_this->demo_way.set(6899.0f, 3867.0f, -8870.0f); + } else if (i_this->demo_camera_no == 60) { + i_this->demo_way.set(8222.0f, 3896.0f, -9579.0f); } - cLib_addCalc2(&i_this->field_0xb60.x, a_this->current.pos.x, 0.2f, 60.0f); - cLib_addCalc2(&i_this->field_0xb60.y, a_this->current.pos.y + 120.0f + VREG_F(6), 0.1f, 30.0f); - cLib_addCalc2(&i_this->field_0xb60.z, a_this->current.pos.z, 0.2f, 60.0f); - if (i_this->field_0xb44 >= 130) { - cLib_addCalc2(&i_this->field_0xbb8, 40.0f, 0.05f, 0.3f); + cLib_addCalc2(&i_this->demo_eye.x, actor->current.pos.x, 0.2f, 60.0f); + cLib_addCalc2(&i_this->demo_eye.y, actor->current.pos.y + 120.0f + VREG_F(6), 0.1f, 30.0f); + cLib_addCalc2(&i_this->demo_eye.z, actor->current.pos.z, 0.2f, 60.0f); + if (i_this->demo_camera_no >= 130) { + cLib_addCalc2(&i_this->target_speed, 40.0f, 0.05f, 0.3f); } - if (i_this->field_0xb44 == 200) { - i_this->field_0xb42 = 100; - dComIfGs_onSwitch(83, fopAcM_GetRoomNo(a_this)); + if (i_this->demo_camera_no == 200) { + i_this->demo_mode = 100; + dComIfGs_onSwitch(83, fopAcM_GetRoomNo(actor)); } break; case 80: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 81; + i_this->demo_mode = 81; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); player->changeDemoMode(1, 1, 0, 0); // fallthrough case 81: - if (i_this->field_0xb44 == 0) { + if (i_this->demo_camera_no == 0) { saru_p[3]->actor.current.pos.x = -500.0f; saru_p[3]->actor.current.pos.y = 3681.0f; saru_p[3]->actor.current.pos.z = 7485.0f; } - if (i_this->field_0xb44 == 30) { + if (i_this->demo_camera_no == 30) { saru_p[0]->actor.current.pos.x = player->current.pos.x; saru_p[0]->actor.current.pos.y = player->current.pos.y + 500.0f; saru_p[0]->actor.current.pos.z = player->current.pos.z - 100.0f; } - if (i_this->field_0xb44 == 60) { + if (i_this->demo_camera_no == 60) { saru_p[1]->actor.current.pos.x = player->current.pos.x + 200.0f; saru_p[1]->actor.current.pos.y = player->current.pos.y + 500.0f; saru_p[1]->actor.current.pos.z = player->current.pos.z; } - if (i_this->field_0xb44 == 90) { - saru_p[2]->actor.current.pos.x = i_this->field_0xb48.x - 250.0f; - saru_p[2]->actor.current.pos.y = i_this->field_0xb48.y + 200.0f; - saru_p[2]->actor.current.pos.z = i_this->field_0xb48.z - 100.0f; + if (i_this->demo_camera_no == 90) { + saru_p[2]->actor.current.pos.x = i_this->demo_way.x - 250.0f; + saru_p[2]->actor.current.pos.y = i_this->demo_way.y + 200.0f; + saru_p[2]->actor.current.pos.z = i_this->demo_way.z - 100.0f; } - if (i_this->field_0xb44 < 80) { - i_this->field_0xb60.set(-333.0f,3316.0f,7149.0f); - i_this->field_0xb48.set(-531.0f,3295.0f,7381.0f); + if (i_this->demo_camera_no < 80) { + i_this->demo_eye.set(-333.0f,3316.0f,7149.0f); + i_this->demo_way.set(-531.0f,3295.0f,7381.0f); } else { - i_this->field_0xb60.set(162.0f,3354.0f,6881.0f); - i_this->field_0xb48.set(263.0f,3374.0f,7168.0f); + i_this->demo_eye.set(162.0f,3354.0f,6881.0f); + i_this->demo_way.set(263.0f,3374.0f,7168.0f); } - if (i_this->field_0xb44 == 170) { - i_this->field_0xb42 = 100; - i_this->field_0xb60.set(-333.0f,3316.0f,7149.0f); - i_this->field_0xb48.set(-531.0f,3295.0f,7381.0f); + if (i_this->demo_camera_no == 170) { + i_this->demo_mode = 100; + i_this->demo_eye.set(-333.0f,3316.0f,7149.0f); + i_this->demo_way.set(-531.0f,3295.0f,7381.0f); } break; case 110: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 111; + i_this->demo_mode = 111; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 59.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 59.0f; player->changeOriginalDemo(); player->changeDemoMode(3, 0, 0, 0); - sp50.set(12899.0f, 3767.0f, 3364.0f); - player->changeDemoPos0(&sp50); + ato.set(12899.0f, 3767.0f, 3364.0f); + player->changeDemoPos0(&ato); - i_this->field_0xb60.set(11821.0f, 3889.0f, 4033.0f); - i_this->field_0xb48.set(11710.0f, 3936.0f, 4253.0f); + i_this->demo_eye.set(11821.0f, 3889.0f, 4033.0f); + i_this->demo_way.set(11710.0f, 3936.0f, 4253.0f); i_this->field_0xb6c.set(12772.0f, 3940.0f, 3565.0f); i_this->field_0xb54.set(13003.0f, 4022.0f, 3613.0f); - i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->field_0xb48.x); - i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->field_0xb48.y); - i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->field_0xb48.z); - i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->field_0xb60.x); - i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->field_0xb60.y); - i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->field_0xb60.z); + i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x); + i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y); + i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z); + i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x); + i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y); + i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z); i_this->field_0xbc4 = 0.0f; // fallthrough case 111: case 112: - if (i_this->field_0xb44 < 10) { - sp50.set(11497.0f, 3764.0f, 3810.0f); - setPlayerPosAndAngle(&sp50, 0x4D5A); + if (i_this->demo_camera_no < 10) { + ato.set(11497.0f, 3764.0f, 3810.0f); + setPlayerPosAndAngle(&ato, 0x4D5A); } - if (i_this->field_0xb44 > 5) { + if (i_this->demo_camera_no > 5) { cam_3d_morf(i_this, 0.1f + BREG_F(17)); f32 tgt = 0.04f + BREG_F(17); cLib_addCalc2(&i_this->field_0xbc4, tgt, 1.0f, 0.001f + BREG_F(19)); @@ -3084,140 +3084,140 @@ static void demo_camera(npc_ks_class* i_this) { if (i_this->field_0xbdc == 1 && player->current.pos.x >= 12714.0f) { i_this->field_0xbdc = 2; - i_this->field_0xb42 = 112; + i_this->demo_mode = 112; daPy_getPlayerActorClass()->changeDemoMode(25, 0, 0, 0); - i_this->field_0xb44 = 20; + i_this->demo_camera_no = 20; } - if (i_this->field_0xb42 == 112 && i_this->field_0xb44 >= 53 + BREG_S(9)) { - i_this->field_0xb42 = 100; + if (i_this->demo_mode == 112 && i_this->demo_camera_no >= 53 + BREG_S(9)) { + i_this->demo_mode = 100; cMtx_YrotS(*calc_mtx, player->shape_angle.y); - sp44.x = 0.0f; - sp44.y = 100.0f + JREG_F(1); - sp44.z = -250.0f + JREG_F(2); - MtxPosition(&sp44, &i_this->field_0xb48); - i_this->field_0xb48 += player->current.pos; - i_this->field_0xb60 = player->current.pos; - i_this->field_0xb60.y += 120.0f; + mae.x = 0.0f; + mae.y = 100.0f + JREG_F(1); + mae.z = -250.0f + JREG_F(2); + MtxPosition(&mae, &i_this->demo_way); + i_this->demo_way += player->current.pos; + i_this->demo_eye = player->current.pos; + i_this->demo_eye.y += 120.0f; } break; case 200: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 201; + i_this->demo_mode = 201; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); player->changeDemoMode(2, 0, 0, 0); - sp50.set(-23451.0f,262.0f,-15980.0f); - player->changeDemoPos0(&sp50); - i_this->field_0xb60.set(-22325.0f, 275.0f, -15119.0f); - i_this->field_0xb48.set(-22672.0f, 311.0f, -15080.0f); + ato.set(-23451.0f,262.0f,-15980.0f); + player->changeDemoPos0(&ato); + i_this->demo_eye.set(-22325.0f, 275.0f, -15119.0f); + i_this->demo_way.set(-22672.0f, 311.0f, -15080.0f); i_this->field_0xb6c.set(-22343.0f, 273.0f, -15017.0f); i_this->field_0xb78.set(0.0f, 0.0f, 0.0f); - i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->field_0xb60.x); - i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->field_0xb60.y); - i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->field_0xb60.z); + i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x); + i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y); + i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z); i_this->field_0xbc4 = 0.0f; /* dSv_event_flag_c::F_0224 - Faron Woods - Flag for lantern guide monkey cutscene */ dComIfGs_onEventBit(u16(dSv_event_flag_c::saveBitLabels[0xE0])); // fallthrough case 201: - if (i_this->field_0xb44 < 30) { - sp50.set(-22177.0f, 213.0f, -14705.0f); - setPlayerPosAndAngle(&sp50, -0x5FFD); + if (i_this->demo_camera_no < 30) { + ato.set(-22177.0f, 213.0f, -14705.0f); + setPlayerPosAndAngle(&ato, -0x5FFD); player->speedF = 0.0f; } cam_3d_morf(i_this, 0.05f + BREG_F(17)); cLib_addCalc2(&i_this->field_0xbc4, 0.02f + BREG_F(18), 1.0f, 0.0001f + BREG_F(19)); - if (i_this->field_0xb44 == 110 + AREG_S(5)) { - i_this->mMode = 2; + if (i_this->demo_camera_no == 110 + AREG_S(5)) { + i_this->mode = 2; i_this->field_0xbb4 = 500.0f; } - if (i_this->field_0xb44 == 132 + AREG_S(6)) { + if (i_this->demo_camera_no == 132 + AREG_S(6)) { i_this->field_0xc17 = 2; mDoAud_seStart(0x5001A, NULL, 0, 0); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); dComIfGs_setItem(1, 0xFF); dMeter2Info_setOilGaugeBackUp(dComIfGs_getOil()); dComIfGp_getVibration().StartShock(2, 31, cXyz(0.0f, 1.0f, 0.0f)); } - if (i_this->field_0xb44 == 139 + AREG_S(6)) { + if (i_this->demo_camera_no == 139 + AREG_S(6)) { player->changeDemoMode(1, 1, 0, 0); } - if (i_this->field_0xb44 == 144) { + if (i_this->demo_camera_no == 144) { cMtx_YrotS(*calc_mtx, player->shape_angle.y); - sp44.x = 0.0f; - sp44.y = AREG_F(1); - sp44.z = 100.0f + AREG_F(2); - MtxPosition(&sp44, &sp50); - a_this->current.pos = player->current.pos + sp50; - a_this->current.angle.y = s16(player->shape_angle.y); - i_this->field_0x8fc.y = player->shape_angle.y; + mae.x = 0.0f; + mae.y = AREG_F(1); + mae.z = 100.0f + AREG_F(2); + MtxPosition(&mae, &ato); + actor->current.pos = player->current.pos + ato; + actor->current.angle.y = s16(player->shape_angle.y); + i_this->current_angle.y = player->shape_angle.y; anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 230; - i_this->mTimers[0] = 65 + JREG_S(7); + i_this->mode = 230; + i_this->timer[0] = 65 + JREG_S(7); } - if (i_this->field_0xb44 == 145) { - i_this->field_0xb42 = 202; - i_this->field_0xb44 = 0; - i_this->field_0xb60.set(-22613.0f, 350.0f, -15097.0f); - i_this->field_0xb48.set(-22275.0f, 350.0f, -15092.0f); + if (i_this->demo_camera_no == 145) { + i_this->demo_mode = 202; + i_this->demo_camera_no = 0; + i_this->demo_eye.set(-22613.0f, 350.0f, -15097.0f); + i_this->demo_way.set(-22275.0f, 350.0f, -15092.0f); } break; case 202: - if (i_this->field_0xb44 == 30) { - i_this->field_0xb60.set(-23371.0f, 380.0f, -15901.0f); - i_this->field_0xb48.set(-23163.0f, 474.0f, -15653.0f); + if (i_this->demo_camera_no == 30) { + i_this->demo_eye.set(-23371.0f, 380.0f, -15901.0f); + i_this->demo_way.set(-23163.0f, 474.0f, -15653.0f); player->changeDemoMode(1, 1, 0, 0); } - if (i_this->field_0xb44 >= 120) { - cLib_addCalc2(&i_this->field_0xbb8, 80.0f, 0.05f, 0.2f + YREG_F(9)); + if (i_this->demo_camera_no >= 120) { + cLib_addCalc2(&i_this->target_speed, 80.0f, 0.05f, 0.2f + YREG_F(9)); } - if (i_this->field_0xb44 == 270) { - i_this->field_0xb42 = 203; - i_this->field_0xb44 = 0; + if (i_this->demo_camera_no == 270) { + i_this->demo_mode = 203; + i_this->demo_camera_no = 0; } break; case 203: - i_this->field_0xb60.set(-22650.0f, 334.0f, -15147.0f); - i_this->field_0xb48.set(-22277.0f, 355.0f, -15077.0f); - i_this->field_0xbb8 = 55.0f; - if (i_this->field_0xb44 == 10) { + i_this->demo_eye.set(-22650.0f, 334.0f, -15147.0f); + i_this->demo_way.set(-22277.0f, 355.0f, -15077.0f); + i_this->target_speed = 55.0f; + if (i_this->demo_camera_no == 10) { midna_p = daPy_py_c::getMidnaActor(); midna_p->changeOriginalDemo(); midna_p->changeDemoMode(2); } - if (i_this->field_0xb44 >= 100) { - i_this->field_0xb44 = 100; + if (i_this->demo_camera_no >= 100) { + i_this->demo_camera_no = 100; } - if (i_this->field_0xb44 >= 70) { - if (i_this->field_0xb44 == 70) { - i_this->mMsgFlow.init(a_this, 2015, 0, NULL); + if (i_this->demo_camera_no >= 70) { + if (i_this->demo_camera_no == 70) { + i_this->msg_flow.init(actor, 2015, 0, NULL); } - if (i_this->mMsgFlow.doFlow(a_this, NULL, 0) != 0) { - i_this->field_0xb42 = 204; + if (i_this->msg_flow.doFlow(actor, NULL, 0) != 0) { + i_this->demo_mode = 204; daMidna_c* midna_p = daPy_py_c::getMidnaActor(); midna_p->changeDemoMode(5); } @@ -3227,35 +3227,35 @@ static void demo_camera(npc_ks_class* i_this) { case 204: { daMidna_c* midna_p = daPy_py_c::getMidnaActor(); if (midna_p->checkShadowReturnEnd() != 0) { - i_this->field_0xb42 = 100; + i_this->demo_mode = 100; } break; } case 300: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 301; + i_this->demo_mode = 301; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 60.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 60.0f; player->changeOriginalDemo(); - i_this->field_0xb60.set(-30827.0f, 411.0f, -17200.0f); - i_this->field_0xb48.set(-30601.0f, 388.0f, -17465.0f); + i_this->demo_eye.set(-30827.0f, 411.0f, -17200.0f); + i_this->demo_way.set(-30601.0f, 388.0f, -17465.0f); // fallthrough case 301: - sp50.set(-30496.0f, 300.0f, -17449.0f); - setPlayerPosAndAngle(&sp50, -0x18B4); - if (i_this->field_0xb44 == 60) { - i_this->field_0xb42 = 302; - i_this->field_0xb44 = 0; - i_this->field_0xb60.set(-30844.0f, 298.0f, -17007.0f); - i_this->field_0xb48.set(-30653.0f, 357.0f, -17289.0f); + ato.set(-30496.0f, 300.0f, -17449.0f); + setPlayerPosAndAngle(&ato, -0x18B4); + if (i_this->demo_camera_no == 60) { + i_this->demo_mode = 302; + i_this->demo_camera_no = 0; + i_this->demo_eye.set(-30844.0f, 298.0f, -17007.0f); + i_this->demo_way.set(-30653.0f, 357.0f, -17289.0f); anm_init(i_this, 51, 5.0f, 2, 1.0f); i_this->field_0xc17 = 3; mDoAud_seStart(0x600AC, &i_this->field_0xc04, 0, 0); @@ -3263,104 +3263,104 @@ static void demo_camera(npc_ks_class* i_this) { break; case 302: - if (i_this->field_0xb44 == 30) { + if (i_this->demo_camera_no == 30) { dComIfGp_setItemOilCount(-int(dComIfGs_getMaxOil())); } - if (i_this->field_0xb44 == 80) { - i_this->field_0xb42 = 303; - i_this->field_0xb44 = 0; - i_this->field_0xb60.set(-30887.0f, 429.0f, -17181.0f); - i_this->field_0xb48.set(-30870.0f, 471.0f, -17527.0f); + if (i_this->demo_camera_no == 80) { + i_this->demo_mode = 303; + i_this->demo_camera_no = 0; + i_this->demo_eye.set(-30887.0f, 429.0f, -17181.0f); + i_this->demo_way.set(-30870.0f, 471.0f, -17527.0f); } break; case 303: - if (i_this->field_0xb44 == 10) { + if (i_this->demo_camera_no == 10) { anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 301; - a_this->speedF = l_HIO.demo_speed_2; + i_this->mode = 301; + actor->speedF = l_HIO.demo_speed_2; } - if (i_this->field_0xb44 == 0x50) { - i_this->field_0xb42 = 100; - i_this->mMode = 302; + if (i_this->demo_camera_no == 0x50) { + i_this->demo_mode = 100; + i_this->mode = 302; anm_init(i_this, 51, 5.0f, 2, 1.0f); /* dSv_event_flag_c::F_0225 - Faron Woods - Lanter guide monkey doesn't come out a second time */ dComIfGs_onEventBit(u16(dSv_event_flag_c::saveBitLabels[0xE1])); - dComIfGs_offSwitch(61, fopAcM_GetRoomNo(a_this)); + dComIfGs_offSwitch(61, fopAcM_GetRoomNo(actor)); } break; case 350: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 351; + i_this->demo_mode = 351; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); - i_this->field_0xb60 = a_this->current.pos; - i_this->field_0xb48.set(-37509.0f, 805.0f, -22416.0f); + i_this->demo_eye = actor->current.pos; + i_this->demo_way.set(-37509.0f, 805.0f, -22416.0f); // fallthrough case 351: - sp44.set(-36523.0f, 335.0f, -20500.0f); - daPy_getPlayerActorClass()->setPlayerPosAndAngle(&sp44, 0xffff8000, 0); - sp44 = a_this->current.pos; - cLib_addCalc2(&i_this->field_0xb60.x, sp44.x, 0.2f, 50.0f); - cLib_addCalc2(&i_this->field_0xb60.y, sp44.y + 100.0f + nREG_F(0), 0.2f, 50.0f); - cLib_addCalc2(&i_this->field_0xb60.z, sp44.z, 0.2f, 50.0f); + mae.set(-36523.0f, 335.0f, -20500.0f); + daPy_getPlayerActorClass()->setPlayerPosAndAngle(&mae, 0x8000, 0); + mae = actor->current.pos; + cLib_addCalc2(&i_this->demo_eye.x, mae.x, 0.2f, 50.0f); + cLib_addCalc2(&i_this->demo_eye.y, mae.y + 100.0f + nREG_F(0), 0.2f, 50.0f); + cLib_addCalc2(&i_this->demo_eye.z, mae.z, 0.2f, 50.0f); - if (i_this->field_0xb44 == 105) { - i_this->field_0xb48.set(-37817.0f, 800.0f, -21442.0f); + if (i_this->demo_camera_no == 105) { + i_this->demo_way.set(-37817.0f, 800.0f, -21442.0f); } - if (i_this->field_0xb44 == 178) { + if (i_this->demo_camera_no == 178) { fpcM_Search(s_fsdown_sub, i_this); } - if (i_this->field_0xb44 == 180) { - i_this->field_0xb60.set(-36666.0f, 600.0f, -22213.0f); - i_this->field_0xb48.set(-36489.0f, 399.0f, -20932.0f); + if (i_this->demo_camera_no == 180) { + i_this->demo_eye.set(-36666.0f, 600.0f, -22213.0f); + i_this->demo_way.set(-36489.0f, 399.0f, -20932.0f); i_this->field_0xb6c.set(-36574.0f, 421.0f, -21554.0f); i_this->field_0xb54.set(-36397.0f, 374.0f, -20263.0f); - i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->field_0xb48.x); - i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->field_0xb48.y); - i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->field_0xb48.z); - i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->field_0xb60.x); - i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->field_0xb60.y); - i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->field_0xb60.z); + i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x); + i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y); + i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z); + i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x); + i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y); + i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z); i_this->field_0xbc4 = 0.0f; - i_this->field_0xb42 = 352; - i_this->field_0xb44 = 0; - i_this->field_0xb60.y = 1500.0f + nREG_F(1); + i_this->demo_mode = 352; + i_this->demo_camera_no = 0; + i_this->demo_eye.y = 1500.0f + nREG_F(1); } break; case 352: - if (i_this->field_0xb44 == 40) { - i_this->mMode = 40; + if (i_this->demo_camera_no == 40) { + i_this->mode = 40; } - if (i_this->field_0xb44 == 110) { + if (i_this->demo_camera_no == 110) { fpcM_Search(s_fsdown_sub, i_this); } - if (i_this->field_0xb44 > 160) { + if (i_this->demo_camera_no > 160) { cam_3d_morf(i_this, 0.1f + BREG_F(17)); cLib_addCalc2(&i_this->field_0xbc4, 0.2f + BREG_F(18), 1.0f, 0.005f + BREG_F(19)); - } else if (i_this->field_0xb44 > 25 + nREG_S(0)) { - cLib_addCalc2(&i_this->field_0xb60.y, 600.0f, 0.5f, 100.0f + nREG_F(2)); + } else if (i_this->demo_camera_no > 25 + nREG_S(0)) { + cLib_addCalc2(&i_this->demo_eye.y, 600.0f, 0.5f, 100.0f + nREG_F(2)); } - if (i_this->field_0xb44 == 230) { - i_this->field_0xb42 = 100; + if (i_this->demo_camera_no == 230) { + i_this->demo_mode = 100; fpcM_Search(s_fsdown_sub, i_this); /* dSv_event_flag_c::F_0544 - Faron Woods - Watched cutscene of monkey girl running away after being attacked by puppet */ dComIfGs_onEventBit(u16(dSv_event_flag_c::saveBitLabels[0x220])); @@ -3368,124 +3368,124 @@ static void demo_camera(npc_ks_class* i_this) { break; case 360: - if (!a_this->eventInfo.checkCommandDemoAccrpt()) { - fopAcM_orderPotentialEvent(a_this, 2, 0xFFFF, 0); - a_this->eventInfo.onCondition(dEvtCnd_CANDEMO_e); + if (!actor->eventInfo.checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(actor, 2, 0xFFFF, 0); + actor->eventInfo.onCondition(dEvtCnd_CANDEMO_e); return; } - i_this->field_0xb42 = 361; + i_this->demo_mode = 361; camera->mCamera.Stop(); camera->mCamera.SetTrimSize(3); - i_this->field_0xb44 = 0; - i_this->field_0xbb8 = 55.0f; + i_this->demo_camera_no = 0; + i_this->target_speed = 55.0f; player->changeOriginalDemo(); - i_this->field_0xb60.set(-36581.0f, 412.0f, -21418.0f); - i_this->field_0xb48.set(-36509.0f, 412.0f, -21127.0f); + i_this->demo_eye.set(-36581.0f, 412.0f, -21418.0f); + i_this->demo_way.set(-36509.0f, 412.0f, -21127.0f); i_this->field_0xb6c.set(-38113.0f, 1234.0f, -22897.0f); i_this->field_0xb54.set(-37882.0f, 1182.0f, -22713.0f); - i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->field_0xb48.x); - i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->field_0xb48.y); - i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->field_0xb48.z); - i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->field_0xb60.x); - i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->field_0xb60.y); - i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->field_0xb60.z); + i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x); + i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y); + i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z); + i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x); + i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y); + i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z); i_this->field_0xbc4 = 0.0f; anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = 30; + i_this->mode = 41; + i_this->timer[0] = 30; // fallthrough case 361: - sp44.set(-36540.0f, 335.0f, -20870.0f); - daPy_getPlayerActorClass()->setPlayerPosAndAngle(&sp44, -32768, 0); - if (i_this->field_0xb44 >= 105) { - if (i_this->field_0xb44 == 105) { - i_this->mMsgFlow.init(a_this, 116, 0, NULL); + mae.set(-36540.0f, 335.0f, -20870.0f); + daPy_getPlayerActorClass()->setPlayerPosAndAngle(&mae, -32768, 0); + if (i_this->demo_camera_no >= 105) { + if (i_this->demo_camera_no == 105) { + i_this->msg_flow.init(actor, 116, 0, NULL); } - if (i_this->mMsgFlow.getNowMsgNo() == 0x1421) { - i_this->field_0xb42 = 362; - i_this->field_0xb44 = 0; + if (i_this->msg_flow.getNowMsgNo() == 0x1421) { + i_this->demo_mode = 362; + i_this->demo_camera_no = 0; } - i_this->mMsgFlow.doFlow(a_this, NULL, 0); + i_this->msg_flow.doFlow(actor, NULL, 0); } break; case 362: - if (i_this->field_0xb44 == 15) { - i_this->mTimers[2] = 30; + if (i_this->demo_camera_no == 15) { + i_this->timer[2] = 30; } - if (i_this->field_0xb44 >= 30) { + if (i_this->demo_camera_no >= 30) { cam_3d_morf(i_this, 0.2f + BREG_F(17)); cLib_addCalc2(&i_this->field_0xbc4, 0.3f + BREG_F(18), 1.0f, 0.01f + BREG_F(19)); } - if (i_this->mMsgFlow.getNowMsgNo() == 0x1423) { - i_this->field_0xb42 = 363; - i_this->field_0xb44 = 0; + if (i_this->msg_flow.getNowMsgNo() == 0x1423) { + i_this->demo_mode = 363; + i_this->demo_camera_no = 0; i_this->field_0xb6c.set(-36467.0f, 426.0f, -20914.0f); i_this->field_0xb54.set(-36244.0f, 409.0f, -20714.0f); - i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->field_0xb48.x); - i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->field_0xb48.y); - i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->field_0xb48.z); - i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->field_0xb60.x); - i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->field_0xb60.y); - i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->field_0xb60.z); + i_this->field_0xb78.x = NPC_KS_FABSF(i_this->field_0xb54.x - i_this->demo_way.x); + i_this->field_0xb78.y = NPC_KS_FABSF(i_this->field_0xb54.y - i_this->demo_way.y); + i_this->field_0xb78.z = NPC_KS_FABSF(i_this->field_0xb54.z - i_this->demo_way.z); + i_this->field_0xb84.x = NPC_KS_FABSF(i_this->field_0xb6c.x - i_this->demo_eye.x); + i_this->field_0xb84.y = NPC_KS_FABSF(i_this->field_0xb6c.y - i_this->demo_eye.y); + i_this->field_0xb84.z = NPC_KS_FABSF(i_this->field_0xb6c.z - i_this->demo_eye.z); i_this->field_0xbc4 = 0.0f; } - i_this->mMsgFlow.doFlow(a_this, NULL, 0); + i_this->msg_flow.doFlow(actor, NULL, 0); break; case 363: cam_3d_morf(i_this, 0.1f + BREG_F(17)); cLib_addCalc2(&i_this->field_0xbc4, 0.3f + BREG_F(18), 1.0f, 0.01f + BREG_F(19)); - if (i_this->mMsgFlow.doFlow(a_this, NULL, 0) != 0) { - i_this->field_0xb42 = 100; + if (i_this->msg_flow.doFlow(actor, NULL, 0) != 0) { + i_this->demo_mode = 100; } break; } - if (i_this->field_0xb42 == 99 || i_this->field_0xb42 == 98) { - if (i_this->field_0xb42 == 99) { - fopAcM_delete(a_this); + if (i_this->demo_mode == 99 || i_this->demo_mode == 98) { + if (i_this->demo_mode == 99) { + fopAcM_delete(actor); } cMtx_YrotS(*calc_mtx, player->shape_angle.y); - sp44.x = 0.0f; - sp44.y = 100.0f + JREG_F(1); - sp44.z = -250.0f + JREG_F(2); - MtxPosition(&sp44, &i_this->field_0xb48); - i_this->field_0xb48 += player->current.pos; - i_this->field_0xb60 = player->current.pos; - i_this->field_0xb60.y += 120.0f; - i_this->field_0xb42 = 100; + mae.x = 0.0f; + mae.y = 100.0f + JREG_F(1); + mae.z = -250.0f + JREG_F(2); + MtxPosition(&mae, &i_this->demo_way); + i_this->demo_way += player->current.pos; + i_this->demo_eye = player->current.pos; + i_this->demo_eye.y += 120.0f; + i_this->demo_mode = 100; } - if (i_this->field_0xb42 == 100) { - camera->mCamera.Reset(i_this->field_0xb60, i_this->field_0xb48, i_this->field_0xbb8, 0); + if (i_this->demo_mode == 100) { + camera->mCamera.Reset(i_this->demo_eye, i_this->demo_way, i_this->target_speed, 0); camera->mCamera.Start(); camera->mCamera.SetTrimSize(0); dComIfGp_event_reset(); daPy_getPlayerActorClass()->cancelOriginalDemo(); - i_this->field_0xb42 = 0; + i_this->demo_mode = 0; } - if (i_this->field_0xb42 != 0) { - camera->mCamera.Set(i_this->field_0xb60, i_this->field_0xb48, i_this->field_0xbb8, 0); - i_this->field_0xb44++; + if (i_this->demo_mode != 0) { + camera->mCamera.Set(i_this->demo_eye, i_this->demo_way, i_this->target_speed, 0); + i_this->demo_camera_no++; } } static int saru_count_check(npc_ks_class* i_this) { - i_this->field_0x934 = (obj_sw_class*)fpcM_Search(s_sw_sub, i_this); - if (i_this->field_0x934 == NULL) { + i_this->child_no = (obj_sw_class*)fpcM_Search(s_sw_sub, i_this); + if (i_this->child_no == NULL) { return 0; } else { - for (int i = 0; i < i_this->field_0x934->field_0x91c; i++) { + for (int i = 0; i < i_this->child_no->field_0x91c; i++) { if (saru_p[i] == NULL) { return 0; } @@ -3496,33 +3496,33 @@ static int saru_count_check(npc_ks_class* i_this) { } static void action_check(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz spd4; + cXyz mae; - switch (fopAcM_GetRoomNo(a_this)) { + switch (fopAcM_GetRoomNo(actor)) { case 0: - if (!dComIfGp_event_runCheck() && i_this->field_0x5b6 == 0) { + if (!dComIfGp_event_runCheck() && i_this->set_id == 0) { if (saru_p[1] == NULL) { - if (dComIfGs_isSwitch(22, fopAcM_GetRoomNo(a_this))) { - spd4.x = a_this->current.pos.x - 5.0f; - spd4.z = a_this->current.pos.z - 5274.0f; - if (JMAFastSqrt(spd4.x * spd4.x + spd4.z * spd4.z) < 500.0f) { - i_this->mActionID = 110; - i_this->mMode = 0; + if (dComIfGs_isSwitch(22, fopAcM_GetRoomNo(actor))) { + mae.x = actor->current.pos.x - 5.0f; + mae.z = actor->current.pos.z - 5274.0f; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 500.0f) { + i_this->action = 110; + i_this->mode = 0; i_this->field_0xaec = 1; return; } } else { - dBgS_GndChk dStack_74; - spd4.set(0.0f, 3250.0f, 6500.0f); - dStack_74.SetPos(&spd4); - if (dComIfG_Bgsp().GroundCross(&dStack_74) > 3000.0f) { - i_this->mActionID = 112; - i_this->mMode = 0; - if (a_this->current.pos.y < 3000.0f) { - a_this->current.pos = player->current.pos; - a_this->old.pos = a_this->current.pos; + dBgS_GndChk gnd_chk; + mae.set(0.0f, 3250.0f, 6500.0f); + gnd_chk.SetPos(&mae); + if (dComIfG_Bgsp().GroundCross(&gnd_chk) > 3000.0f) { + i_this->action = 112; + i_this->mode = 0; + if (actor->current.pos.y < 3000.0f) { + actor->current.pos = player->current.pos; + actor->old.pos = actor->current.pos; } i_this->field_0xaec = 1; @@ -3531,44 +3531,44 @@ static void action_check(npc_ks_class* i_this) { } } else if (saru_p[1] != NULL && saru_p[2] != NULL && saru_p[3] != NULL) { if (player->current.pos.y < 3000.0f) { - dComIfGs_onSwitch(82, fopAcM_GetRoomNo(a_this)); + dComIfGs_onSwitch(82, fopAcM_GetRoomNo(actor)); } - if (!dComIfGs_isSwitch(82, fopAcM_GetRoomNo(a_this))) { - spd4.x = player->current.pos.x - -500.0f; - spd4.z = player->current.pos.z - 7211.0f; - if (JMAFastSqrt(spd4.x * spd4.x + spd4.z * spd4.z) < 200.0f) { - dComIfGs_onSwitch(82, fopAcM_GetRoomNo(a_this)); + if (!dComIfGs_isSwitch(82, fopAcM_GetRoomNo(actor))) { + mae.x = player->current.pos.x - -500.0f; + mae.z = player->current.pos.z - 7211.0f; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 200.0f) { + dComIfGs_onSwitch(82, fopAcM_GetRoomNo(actor)); for (int i = 0; i < 4; i++) { - saru_p[i]->mActionID = 111; - saru_p[i]->mMode = 0; + saru_p[i]->action = 111; + saru_p[i]->mode = 0; saru_p[i]->field_0xaec = 1; } - i_this->field_0xb42 = 80; + i_this->demo_mode = 80; } } } } - if (!dComIfGs_isSwitch(82, fopAcM_GetRoomNo(a_this)) && saru_count_check(i_this) != 0) { - if (dComIfGs_isSwitch(22, fopAcM_GetRoomNo(a_this))) { + if (!dComIfGs_isSwitch(82, fopAcM_GetRoomNo(actor)) && saru_count_check(i_this) != 0) { + if (dComIfGs_isSwitch(22, fopAcM_GetRoomNo(actor))) { for (int i = 0; i < 2; i++) { - spd4.x = player->current.pos.x - i_this->field_0x934->field_0x904[i].x; - spd4.y = player->current.pos.y - (i_this->field_0x934->field_0x904[i].y - 450.0f); - spd4.z = player->current.pos.z - i_this->field_0x934->field_0x904[i].z; - if (spd4.abs() < 300.0f + YREG_F(11)) { + mae.x = player->current.pos.x - i_this->child_no->field_0x904[i].x; + mae.y = player->current.pos.y - (i_this->child_no->field_0x904[i].y - 450.0f); + mae.z = player->current.pos.z - i_this->child_no->field_0x904[i].z; + if (mae.abs() < 300.0f + YREG_F(11)) { i_this->field_0xbd9 = 0; - i_this->mActionID = 20; - i_this->mMode = 0; + i_this->action = 20; + i_this->mode = 0; i_this->field_0xaec = 0; - i_this->field_0xbc8 = i_this->field_0x934->field_0x904[i]; - spd4 = i_this->field_0x934->field_0x904[1 - i] - i_this->field_0xbc8; - leader->field_0xbd4 = cM_atan2s(spd4.x, spd4.z); - leader->field_0xb42 = 10; - leader->field_0xb40 = i_this->field_0x934->field_0x570; + i_this->field_0xbc8 = i_this->child_no->field_0x904[i]; + mae = i_this->child_no->field_0x904[1 - i] - i_this->field_0xbc8; + leader->field_0xbd4 = cM_atan2s(mae.x, mae.z); + leader->demo_mode = 10; + leader->field_0xb40 = i_this->child_no->field_0x570; - if (i_this->field_0x5b6 != 0) { - leader->field_0x934 = i_this->field_0x934; + if (i_this->set_id != 0) { + leader->child_no = i_this->child_no; leader->field_0xbc8 = i_this->field_0xbc8; } } @@ -3578,14 +3578,14 @@ static void action_check(npc_ks_class* i_this) { break; case 1: - if (!dComIfGp_event_runCheck() && i_this->field_0x5b6 == 0 && saru_p[1] == NULL && a_this->field_0x567 == 0) { - spd4.x = a_this->current.pos.x - 5334.0f; - spd4.z = a_this->current.pos.z - 7609.0f; - if (JMAFastSqrt(spd4.x * spd4.x + spd4.z * spd4.z) < 700.0f) { - i_this->mActionID = 113; - i_this->mMode = 0; + if (!dComIfGp_event_runCheck() && i_this->set_id == 0 && saru_p[1] == NULL && actor->field_0x567 == 0) { + mae.x = actor->current.pos.x - 5334.0f; + mae.z = actor->current.pos.z - 7609.0f; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 700.0f) { + i_this->action = 113; + i_this->mode = 0; i_this->field_0xaec = 1; - a_this->field_0x567 = 1; + actor->field_0x567 = 1; } } break; @@ -3594,56 +3594,56 @@ static void action_check(npc_ks_class* i_this) { case 4: if (saru_count_check(i_this) != 0) { int iVar1 = 1; - if (fopAcM_GetRoomNo(a_this) == 2) { - for (int i = 0; i < i_this->field_0x934->field_0x91c; i++) { - spd4 = player->current.pos - saru_p[i]->actor.current.pos; - if (spd4.abs() > 400.0f) { + if (fopAcM_GetRoomNo(actor) == 2) { + for (int i = 0; i < i_this->child_no->field_0x91c; i++) { + mae = player->current.pos - saru_p[i]->actor.current.pos; + if (mae.abs() > 400.0f) { iVar1 = 0; } } } if (iVar1 != 0) { - spd4.x = player->current.pos.x - i_this->field_0x934->field_0x904[0].x; - spd4.y = player->current.pos.y - (i_this->field_0x934->field_0x904[0].y - 450.0f); - spd4.z = player->current.pos.z - i_this->field_0x934->field_0x904[0].z; - if (spd4.abs() < 300.0f) { - i_this->field_0xbc8 = i_this->field_0x934->field_0x904[0]; - if (i_this->field_0x5b6 == 0) { + mae.x = player->current.pos.x - i_this->child_no->field_0x904[0].x; + mae.y = player->current.pos.y - (i_this->child_no->field_0x904[0].y - 450.0f); + mae.z = player->current.pos.z - i_this->child_no->field_0x904[0].z; + if (mae.abs() < 300.0f) { + i_this->field_0xbc8 = i_this->child_no->field_0x904[0]; + if (i_this->set_id == 0) { i_this->field_0xbd9 = 0; - i_this->mActionID = 20; - i_this->mMode = 0; + i_this->action = 20; + i_this->mode = 0; i_this->field_0xaec = 0; - leader->field_0xb42 = 10; + leader->demo_mode = 10; leader->field_0xb40 = 0; leader->field_0xbc8 = i_this->field_0xbc8; - spd4 = i_this->field_0x934->field_0x904[1] - i_this->field_0xbc8; - leader->field_0xbd4 = cM_atan2s(spd4.x, spd4.z); + mae = i_this->child_no->field_0x904[1] - i_this->field_0xbc8; + leader->field_0xbd4 = cM_atan2s(mae.x, mae.z); } else { - i_this->mActionID = 22; - i_this->mMode = 0; + i_this->action = 22; + i_this->mode = 0; i_this->field_0x930 = leader; } } } - } else if (!checkDoorDemo() && fopAcM_GetRoomNo(a_this) == 4 && i_this->field_0x5b6 == 0) { - if (!dComIfGs_isSwitch(22, fopAcM_GetRoomNo(a_this))) { - i_this->mActionID = 203; - i_this->mMode = 0; + } else if (!checkDoorDemo() && fopAcM_GetRoomNo(actor) == 4 && i_this->set_id == 0) { + if (!dComIfGs_isSwitch(22, fopAcM_GetRoomNo(actor))) { + i_this->action = 203; + i_this->mode = 0; } } break; case 9: - if (!dComIfGp_event_runCheck() && i_this->field_0x5b6 == 4 && player->current.pos.z < -3900.0f) { - if (!dComIfGs_isSwitch(81, fopAcM_GetRoomNo(a_this))) { - dBgS_GndChk dStack_c8; - spd4.set(7275.0f, 3373.0f, -4790.0f); - dStack_c8.SetPos(&spd4); - if (dComIfG_Bgsp().GroundCross(&dStack_c8) > 3000.0f) { - i_this->mActionID = 115; - i_this->mMode = 0; - dComIfGs_onSwitch(81, fopAcM_GetRoomNo(a_this)); + if (!dComIfGp_event_runCheck() && i_this->set_id == 4 && player->current.pos.z < -3900.0f) { + if (!dComIfGs_isSwitch(81, fopAcM_GetRoomNo(actor))) { + dBgS_GndChk gnd_chk; + mae.set(7275.0f, 3373.0f, -4790.0f); + gnd_chk.SetPos(&mae); + if (dComIfG_Bgsp().GroundCross(&gnd_chk) > 3000.0f) { + i_this->action = 115; + i_this->mode = 0; + dComIfGs_onSwitch(81, fopAcM_GetRoomNo(actor)); i_this->field_0xaec = 1; } } @@ -3651,39 +3651,39 @@ static void action_check(npc_ks_class* i_this) { break; case 12: - if (!dComIfGp_event_runCheck() && i_this->field_0x5b6 == 4) { - if (!dComIfGs_isSwitch(83, fopAcM_GetRoomNo(a_this))) { - i_this->mActionID = 204; - i_this->mMode = 0; - fopAcM_setRoomLayer(a_this, 12); - i_this->field_0xb42 = 77; + if (!dComIfGp_event_runCheck() && i_this->set_id == 4) { + if (!dComIfGs_isSwitch(83, fopAcM_GetRoomNo(actor))) { + i_this->action = 204; + i_this->mode = 0; + fopAcM_setRoomLayer(actor, 12); + i_this->demo_mode = 77; i_this->field_0xaec = 1; } } } } -static BOOL water_check(npc_ks_class* i_this, cXyz param_2, f32 param_3) { - fopAc_ac_c* a_this = &i_this->actor; - cXyz sp154; - dBgS_GndChk dStack_80; - dBgS_LinChk dStack_f0; - sp154.x = param_2.x; - sp154.y = param_2.y + 3000.0f; - sp154.z = param_2.z; - dStack_f0.Set(&a_this->current.pos, &sp154, a_this); - if (dComIfG_Bgsp().LineCross(&dStack_f0)) { - sp154.y = dStack_f0.GetCross().y - 10.0f;; +static BOOL water_check(npc_ks_class* i_this, cXyz param_2, f32 water_lvl) { + fopAc_ac_c* actor = &i_this->actor; + cXyz pos; + dBgS_GndChk gnd_chk; + dBgS_LinChk lin_chk; + pos.x = param_2.x; + pos.y = param_2.y + 3000.0f; + pos.z = param_2.z; + lin_chk.Set(&actor->current.pos, &pos, actor); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + pos.y = lin_chk.GetCross().y - 10.0f;; } - dBgS_ObjGndChk_Spl cStack_148; - cStack_148.SetPos(&sp154); - i_this->field_0x63c = dComIfG_Bgsp().GroundCross(&cStack_148); - sp154.y = i_this->field_0x63c + 60.0f; + dBgS_ObjGndChk_Spl gnd_chk_spl; + gnd_chk_spl.SetPos(&pos); + i_this->waterY = dComIfG_Bgsp().GroundCross(&gnd_chk_spl); + pos.y = i_this->waterY + 60.0f; - dStack_80.SetPos(&sp154); - f32 gnd_cross = dComIfG_Bgsp().GroundCross(&dStack_80); - if ((i_this->field_0x63c - gnd_cross) > param_3) { + gnd_chk.SetPos(&pos); + f32 gnd_cross = dComIfG_Bgsp().GroundCross(&gnd_chk); + if ((i_this->waterY - gnd_cross) > water_lvl) { return TRUE; } @@ -3693,23 +3693,23 @@ static BOOL water_check(npc_ks_class* i_this, cXyz param_2, f32 param_3) { static f32 yuka_jump_x = 80.0f; static int npc_ks_option(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = (fopAc_ac_c*) dComIfGp_getPlayer(0); fopAc_ac_c* actor_p; - cXyz sp140, sp14c; - f32 fVar3 = 0.0f; - f32 fVar4 = 5.0f; + cXyz mae, ato; + f32 target_speed = 0.0f; + f32 step_speed = 5.0f; int unused_0x58 = 0; (void) unused_0x58; - u32 i_soundID = Z2SE_SY_DUMMY; - int retval = 1; + u32 soundID = Z2SE_SY_DUMMY; + int rt = 1; int iVar2 = 1; int iVar1 = 1; s16 sVar1 = 0x800; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); f32 fVar2; f32 fVar1 = 0.0f; - if (fopAcM_GetRoomNo(a_this) == 7 || fopAcM_GetRoomNo(a_this) == 8) { + if (fopAcM_GetRoomNo(actor) == 7 || fopAcM_GetRoomNo(actor) == 8) { fVar1 = 10000.0f; } @@ -3717,28 +3717,28 @@ static int npc_ks_option(npc_ks_class* i_this) { i_this->field_0xbd8++; } - if (i_this->mMode >= 30 && i_this->mMode < 40) { + if (i_this->mode >= 30 && i_this->mode < 40) { actor_p = bomb_check(i_this); if (actor_p == NULL) { - i_this->mMode = 0; + i_this->mode = 0; } else { - a_this->health = 0; - sp140.x = actor_p->current.pos.x - a_this->current.pos.x; - sp140.z = actor_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp140.x, sp140.z); - fVar2 = JMAFastSqrt(sp140.x * sp140.x + sp140.z * sp140.z); + actor->health = 0; + mae.x = actor_p->current.pos.x - actor->current.pos.x; + mae.z = actor_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + fVar2 = JMAFastSqrt(mae.x * mae.x + mae.z * mae.z); } - } else if (i_this->mMode >= 40 && i_this->mMode < 50) { + } else if (i_this->mode >= 40 && i_this->mode < 50) { actor_p = enemy_check(i_this, fVar1 + 700.0f); if (actor_p == NULL) { - i_this->mMode = 0; + i_this->mode = 0; } else { - a_this->health = 0; - if (i_this->mMode == 40) { - sp140.x = actor_p->current.pos.x - a_this->current.pos.x; - sp140.z = actor_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp140.x, sp140.z); - fVar2 = JMAFastSqrt(sp140.x * sp140.x + sp140.z * sp140.z); + actor->health = 0; + if (i_this->mode == 40) { + mae.x = actor_p->current.pos.x - actor->current.pos.x; + mae.z = actor_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + fVar2 = JMAFastSqrt(mae.x * mae.x + mae.z * mae.z); } } } @@ -3748,372 +3748,372 @@ static int npc_ks_option(npc_ks_class* i_this) { dbg_f30 -= 70.0f; } - switch (i_this->mMode) { + switch (i_this->mode) { case 0: - i_this->mMode = 1; + i_this->mode = 1; anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mTimers[0] = cM_rndF(100.0f) + 100.0f; - fopAcM_setStageLayer(a_this); - a_this->health = 0; + i_this->timer[0] = cM_rndF(100.0f) + 100.0f; + fopAcM_setStageLayer(actor); + actor->health = 0; // fallthrough case 1: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if (cM_rndF(1.0f) < 0.5f) { - if (i_this->field_0x5d0 != 51) { + if (i_this->res_id != 51) { anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mTimers[0] = cM_rndF(100.0f) + 80.0f; - i_soundID = Z2SE_KOSARU_V_WAIT; + i_this->timer[0] = cM_rndF(100.0f) + 80.0f; + soundID = Z2SE_KOSARU_V_WAIT; } - } else if (i_this->field_0x5d0 != 53) { + } else if (i_this->res_id != 53) { anm_init(i_this, 53, 8.0f, 2, 1.0f); - i_this->mTimers[0] = cM_rndF(30.0f) + 40.0f; - i_soundID = Z2SE_KOSARU_V_WAIT; + i_this->timer[0] = cM_rndF(30.0f) + 40.0f; + soundID = Z2SE_KOSARU_V_WAIT; } } - if (i_this->mTimers[1] == 0 && i_this->field_0x5c4 > (dbg_f30 + 20.0f)) { + if (i_this->timer[1] == 0 && i_this->dis > (dbg_f30 + 20.0f)) { anm_init(i_this, 28, 5.0f, 2, 1.0f); - i_this->mMode = 2; - i_soundID = Z2SE_KOSARU_V_JUMP; + i_this->mode = 2; + soundID = Z2SE_KOSARU_V_JUMP; } break; case 2: - fVar3 = l_HIO.holding_speed_l; - if (i_this->field_0x5c4 < (dbg_f30 - 20.0f)) { - i_this->mMode = 0; - } else if (i_this->field_0x5c4 > dbg_f30 + 200.0f) { + target_speed = l_HIO.holding_speed_l; + if (i_this->dis < (dbg_f30 - 20.0f)) { + i_this->mode = 0; + } else if (i_this->dis > dbg_f30 + 200.0f) { anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 3; - i_soundID = Z2SE_KOSARU_V_WALK; + i_this->mode = 3; + soundID = Z2SE_KOSARU_V_WALK; } - if (i_this->mObjAcch.ChkWallHit() && i_this->mObjAcch.ChkGroundHit() && !otherBgCheck(a_this, player)) { - a_this->speed.y = 30.0f; + if (i_this->ObjAcch.ChkWallHit() && i_this->ObjAcch.ChkGroundHit() && !otherBgCheck(actor, player)) { + actor->speed.y = 30.0f; } break; case 3: - fVar3 = l_HIO.holding_speed_h; - if (i_this->mpModelMorf->checkFrame(1.0f)) { - i_soundID = Z2SE_KOSARU_V_WALK; + target_speed = l_HIO.holding_speed_h; + if (i_this->model->checkFrame(1.0f)) { + soundID = Z2SE_KOSARU_V_WALK; } - if (i_this->field_0x5c4 < (dbg_f30 + 130.0f)) { + if (i_this->dis < (dbg_f30 + 130.0f)) { anm_init(i_this, 28, 3.0f, 2, 1.0f); - i_this->mMode = 2; + i_this->mode = 2; } - if (i_this->mObjAcch.ChkWallHit() && i_this->mObjAcch.ChkGroundHit() && !otherBgCheck(a_this, player)) { - a_this->speed.y = 30.0f; + if (i_this->ObjAcch.ChkWallHit() && i_this->ObjAcch.ChkGroundHit() && !otherBgCheck(actor, player)) { + actor->speed.y = 30.0f; } break; case 5: - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; if (frame >= 11) { - i_this->mMode = 0; + i_this->mode = 0; } break; case 7: anm_init(i_this, 47, 3.0f, 2, i_this->field_0x5d4); - i_this->mMode = 8; + i_this->mode = 8; // fallthrough case 8: - if (i_this->mpModelMorf->checkFrame(1.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_SWIM, 0, -1); + if (i_this->model->checkFrame(1.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_SWIM, 0, -1); } iVar1 = 0; - a_this->gravity = 0.0f; - cLib_addCalc0(&a_this->speed.y, 1.0f, 1.0f); - cLib_addCalc2(&a_this->current.pos.y, i_this->field_0x63c, 0.1f, 10.0f); + actor->gravity = 0.0f; + cLib_addCalc0(&actor->speed.y, 1.0f, 1.0f); + cLib_addCalc2(&actor->current.pos.y, i_this->waterY, 0.1f, 10.0f); - if (i_this->field_0x5c4 > (dbg_f30 + 50.0f)) { - fVar3 = 5.0f + JREG_F(8); + if (i_this->dis > (dbg_f30 + 50.0f)) { + target_speed = 5.0f + JREG_F(8); } else { - fVar3 = 0.0f; + target_speed = 0.0f; } - cLib_addCalc2(&i_this->field_0x5d4, fVar3 * 0.1f + 0.5f, 1.0f, 0.1f); - i_this->mpModelMorf->setPlaySpeed(i_this->field_0x5d4); + cLib_addCalc2(&i_this->field_0x5d4, target_speed * 0.1f + 0.5f, 1.0f, 0.1f); + i_this->model->setPlaySpeed(i_this->field_0x5d4); - fVar4 = 0.1f; + step_speed = 0.1f; sVar1 = 0x100; - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; - if (i_this->mTimers[0] == 0) { - i_this->mTimers[0] = cM_rndF(30.0f) + 20.0f; - i_soundID = Z2SE_KOSARU_V_WAIT; + if (i_this->timer[0] == 0) { + i_this->timer[0] = cM_rndF(30.0f) + 20.0f; + soundID = Z2SE_KOSARU_V_WAIT; } break; case 10: - i_this->mTimers[0] = cM_rndF(30.0f) + 20.0f; - i_this->mMode = 11; - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->timer[0] = cM_rndF(30.0f) + 20.0f; + i_this->mode = 11; + i_this->current_angle.y = i_this->target_angle; // fallthrough case 11: i_this->field_0x5fc = 1; - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if (cM_rndF(1.0f) < 0.5f) { anm_init(i_this, 30, 3.0f, 0, 1.0f); } else { anm_init(i_this, 5, 3.0f, 0, 1.0f); } - i_this->mMode = 12; + i_this->mode = 12; } break; case 12: i_this->field_0x5fc = 1; - if (i_this->mpModelMorf->isStop()) { + if (i_this->model->isStop()) { if (cM_rndF(1.0f) < 0.5f) { anm_init(i_this, 30, 3.0f, 0, 1.0f); } else { anm_init(i_this, 5, 3.0f, 0, 1.0f); } - i_this->mMode = 13; + i_this->mode = 13; } break; case 13: - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 0; + if (i_this->model->isStop()) { + i_this->mode = 0; } break; case 20: iVar2 = 0; - if (i_this->mTimers[0] == 0) { - i_this->mActionID = 200; - i_this->mMode = 0; + if (i_this->timer[0] == 0) { + i_this->action = 200; + i_this->mode = 0; i_this->field_0xaec = 0; - return retval; + return rt; } break; case 30: - fVar3 = l_HIO.holding_speed_h; - i_this->field_0x8fc.y += NPC_KS_180DEG_ROT; + target_speed = l_HIO.holding_speed_h; + i_this->current_angle.y += NPC_KS_180DEG_ROT; if (fVar2 > 400.0f) { - i_this->mMode = 31; + i_this->mode = 31; anm_init(i_this, 51, 5.0f, 2, 1.0f); } break; case 31: - i_this->field_0x8fc.y = i_this->field_0x5c8; - i_this->field_0x938 = fopAcM_GetID(actor_p); + i_this->current_angle.y = i_this->target_angle; + i_this->search_id = fopAcM_GetID(actor_p); i_this->field_0x5fc = 1; if (fVar2 < 350.0f) { - i_this->mMode = 30; + i_this->mode = 30; anm_init(i_this, 26, 3.0f, 2, 1.0f); } break; case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; // ditto. - i_this->field_0x8fc.y += NPC_KS_180DEG_ROT; + i_this->current_angle.y += NPC_KS_180DEG_ROT; break; case 41: sVar1 = 0x1000; - if ((i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7)) || ((frame > 40 && frame < 48) || frame > 65)) { + if ((i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7)) || ((frame > 40 && frame < 48) || frame > 65)) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43) { - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43) { + if (i_this->model->isStop()) { + i_this->mode = 40; } } break; case 50: - retval = 2; - a_this->speedF = 0.0f; - if (i_this->mTimers[0] == 0) { - fopAc_ac_c* player_p2 = (fopAc_ac_c*) dComIfGp_getPlayer(0); - cMtx_YrotS(*calc_mtx, (s16) player_p2->shape_angle.y); - sp140.y = 50.0f; - sp140.z = 0.0f; + rt = 2; + actor->speedF = 0.0f; + if (i_this->timer[0] == 0) { + fopAc_ac_c* player = (fopAc_ac_c*) dComIfGp_getPlayer(0); + cMtx_YrotS(*calc_mtx, (s16) player->shape_angle.y); + mae.y = 50.0f; + mae.z = 0.0f; int i = 0; for (; i < 2; i++) { - dBgS_GndChk dStack_e0; - sp140.x = yuka_jump_x; - MtxPosition(&sp140, &sp14c); - sp14c += player_p2->current.pos; - dStack_e0.SetPos(&sp14c); - sp14c.y = dComIfG_Bgsp().GroundCross(&dStack_e0); + dBgS_GndChk gnd_chk; + mae.x = yuka_jump_x; + MtxPosition(&mae, &ato); + ato += player->current.pos; + gnd_chk.SetPos(&ato); + ato.y = dComIfG_Bgsp().GroundCross(&gnd_chk); yuka_jump_x *= -1.0f; - if (NPC_KS_FABSF(sp14c.y - player_p2->current.pos.y) < 20.0f) { - i_this->mMode = 51; - i_this->field_0x8f0 = sp14c; - i_this->field_0x910 = a_this->current.pos; - i_this->field_0x91c = i_this->field_0x8f0; + if (NPC_KS_FABSF(ato.y - player->current.pos.y) < 20.0f) { + i_this->mode = 51; + i_this->guide_path = ato; + i_this->field_0x910 = actor->current.pos; + i_this->field_0x91c = i_this->guide_path; anm_init(i_this, 32, 2.0f, 0, 1.0f); break; } } if (i == 2) { - i_this->mMode = 0; + i_this->mode = 0; } } - i_this->field_0x8fc.y = i_this->field_0x5c8; - fVar3 = 4096.0f; + i_this->current_angle.y = i_this->target_angle; + target_speed = 4096.0f; break; case 51: - retval = 2; - if (i_this->field_0x5d0 == 32 && i_this->mpModelMorf->isStop()) { + rt = 2; + if (i_this->res_id == 32 && i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f + TREG_F(9); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + actor->speedF = 40.0f + TREG_F(9); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); i_this->field_0xbe0 = 1; } - sp140 = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp140.x, sp140.z); - i_this->field_0x8fc.x = -cM_atan2s(sp140.y, JMAFastSqrt(sp140.x * sp140.x + sp140.z * sp140.z)); - i_this->field_0x8fc.y = i_this->field_0x8fc.y; + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); + i_this->current_angle.y = i_this->current_angle.y; sVar1 = 0x2000; - if (a_this->speedF > 25.0f) { + if (actor->speedF > 25.0f) { i_this->field_0x90c = 1; } - if (sp140.abs() <= a_this->speedF * 1.2f) { - i_this->mMode = 0; - a_this->speedF *= 0.5f; + if (mae.abs() <= actor->speedF * 1.2f) { + i_this->mode = 0; + actor->speedF *= 0.5f; i_this->field_0xbe0 = 1; - return retval; + return rt; } - fVar3 = a_this->speedF; + target_speed = actor->speedF; } - cLib_addCalc2(&a_this->speedF, fVar3, 1.0f, fVar4); - if (i_this->mMode < 7) { + cLib_addCalc2(&actor->speedF, target_speed, 1.0f, step_speed); + if (i_this->mode < 7) { i_this->field_0x5fc = 1; - if (fVar3 > 1.0f) { - i_this->field_0x8fc.y = i_this->field_0x5c8; + if (target_speed > 1.0f) { + i_this->current_angle.y = i_this->target_angle; } else { - s16 sVar2 = a_this->current.angle.y - i_this->field_0x5c8; - if ((sVar2 > 0x3000 || sVar2 < -0x3000) && i_this->mMode < 5) { + s16 range = actor->current.angle.y - i_this->target_angle; + if ((range > 0x3000 || range < -0x3000) && i_this->mode < 5) { anm_init(i_this, 28, 3.0f, 0, 1.0f); - i_this->mMode = 5; - i_soundID = Z2SE_KOSARU_V_WALK; + i_this->mode = 5; + soundID = Z2SE_KOSARU_V_WALK; } } - if (a_this->health != 0) { - a_this->health = 0; - i_this->mMode = 10; - return retval; + if (actor->health != 0) { + actor->health = 0; + i_this->mode = 10; + return rt; } if (!checkDoorDemo()) { if ((actor_p = (fopAc_ac_c*)fpcM_Search(s_01_sub, i_this)) != NULL) { - sp140 = actor_p->current.pos - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp140.x, sp140.z); - i_this->mMode = 20; - i_this->mTimers[0] = 60; - return retval; + mae = actor_p->current.pos - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->mode = 20; + i_this->timer[0] = 60; + return rt; } } - if (i_this->mTimers[3] == 0) { + if (i_this->timer[3] == 0) { if (cM_rndF(1.0f) < 0.5f) { - i_this->field_0x938 = fopAcM_GetID(en_search_test(i_this)); + i_this->search_id = fopAcM_GetID(en_search_test(i_this)); } else { - i_this->field_0x938 = -1; + i_this->search_id = -1; } - i_this->mTimers[3] = cM_rndF(30.0f) + 30.0f; + i_this->timer[3] = cM_rndF(30.0f) + 30.0f; } - if ((i_this->field_0x5e6 & 15) == 0 && bomb_view_check(i_this) != NULL) { - i_this->mMode = 30; + if ((i_this->count & 15) == 0 && bomb_view_check(i_this) != NULL) { + i_this->mode = 30; anm_init(i_this, 26, 3.0f, 2, 1.0f); - return retval; + return rt; } - if ((i_this->field_0x5e6 + 2 & 15) == 0 && enemy_view_check(i_this, fVar1 + 600.0f) != NULL) { - i_this->mMode = 40; - return retval; + if ((i_this->count + 2 & 15) == 0 && enemy_view_check(i_this, fVar1 + 600.0f) != NULL) { + i_this->mode = 40; + return rt; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 2, sVar1); - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 2, sVar1); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); - fopAc_ac_c* player_p3 = (fopAc_ac_c*) dComIfGp_getPlayer(0); + fopAc_ac_c* player3 = (fopAc_ac_c*) dComIfGp_getPlayer(0); if (iVar2 != 0) { - if (NPC_KS_FABSF(player_p3->current.pos.y - a_this->current.pos.y) > 3000.0f || - (fopAcM_CheckCondition(a_this, 4) != 0 && fopAcM_otherBgCheck(a_this, dComIfGp_getPlayer(0)))) { - if (iVar1 != 0 && player_p3->speedF > 2.0f) { + if (NPC_KS_FABSF(player3->current.pos.y - actor->current.pos.y) > 3000.0f || + (fopAcM_CheckCondition(actor, 4) != 0 && fopAcM_otherBgCheck(actor, dComIfGp_getPlayer(0)))) { + if (iVar1 != 0 && player3->speedF > 2.0f) { camera_class* camera = (camera_class*) dComIfGp_getCamera(0); - sp140.x = camera->lookat.eye.x - camera->lookat.center.x; - sp140.z = camera->lookat.eye.z - camera->lookat.center.z; - cMtx_YrotS(*calc_mtx, cM_atan2s(sp140.x, sp140.z)); - sp140.x = 0.0f; - sp140.y = -50.0f; - sp140.z = 100.0f; - MtxPosition(&sp140, &sp14c); - sp14c += camera->lookat.eye; + mae.x = camera->lookat.eye.x - camera->lookat.center.x; + mae.z = camera->lookat.eye.z - camera->lookat.center.z; + cMtx_YrotS(*calc_mtx, cM_atan2s(mae.x, mae.z)); + mae.x = 0.0f; + mae.y = -50.0f; + mae.z = 100.0f; + MtxPosition(&mae, &ato); + ato += camera->lookat.eye; - dBgS_GndChk dStack_134; - dStack_134.SetPos(&sp14c); - if (NPC_KS_FABSF(sp14c.y - dComIfG_Bgsp().GroundCross(&dStack_134)) < 500.0f) { - a_this->current.pos = sp14c; - a_this->old = a_this->current; + dBgS_GndChk gnd_chk; + gnd_chk.SetPos(&ato); + if (NPC_KS_FABSF(ato.y - dComIfG_Bgsp().GroundCross(&gnd_chk)) < 500.0f) { + actor->current.pos = ato; + actor->old = actor->current; OS_REPORT("////////KS OP RESET \n"); } else { OS_REPORT("////////KS OP NO FLOOR・NONRESET \n"); - i_soundID = Z2SE_SY_DUMMY; + soundID = Z2SE_SY_DUMMY; } } else { - i_soundID = Z2SE_SY_DUMMY; + soundID = Z2SE_SY_DUMMY; } } } - if (i_soundID != Z2SE_SY_DUMMY) { - i_this->mSound.startCreatureVoice(i_soundID, -1); + if (soundID != Z2SE_SY_DUMMY) { + i_this->sound.startCreatureVoice(soundID, -1); } - if (i_this->field_0x94c != 0 && (i_this->field_0x5d0 == 26 || i_this->field_0x5d0 == 28)) { + if (i_this->anm_time != 0 && (i_this->res_id == 26 || i_this->res_id == 28)) { anm_init(i_this, 55, 3.0f, 2, 1.0f); - } else if (i_this->field_0x94c == 0 && i_this->field_0x5d0 == 55) { + } else if (i_this->anm_time == 0 && i_this->res_id == 55) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } if (iVar1 != 0) { - if (i_this->field_0xbdd != 0 && a_this->current.pos.y < i_this->field_0x63c) { - if (a_this->speed.y < -10.0f) { - a_this->speed.y = -10.0f; + if (i_this->field_0xbdd != 0 && actor->current.pos.y < i_this->waterY) { + if (actor->speed.y < -10.0f) { + actor->speed.y = -10.0f; } - i_this->mMode = 7; - a_this->speedF = 0.0f; + i_this->mode = 7; + actor->speedF = 0.0f; i_this->field_0x5d4 = 0.0f; - cXyz sp158 = a_this->current.pos; - sp158.y = i_this->field_0x63c; + cXyz water_pos = actor->current.pos; + water_pos.y = i_this->waterY; f32 sc_load_val = 1.0f; static cXyz sc(sc_load_val, sc_load_val, sc_load_val); @@ -4122,67 +4122,67 @@ static int npc_ks_option(npc_ks_class* i_this) { }; for (int i = 0; i < 4; i++) { - i_this->field_0xbe4[i] = dComIfGp_particle_set(i_this->field_0xbe4[i], w_eff_id[i], &sp158, &a_this->tevStr, NULL, + i_this->w_eff[i] = dComIfGp_particle_set(i_this->w_eff[i], w_eff_id[i], &water_pos, &actor->tevStr, NULL, &sc, 0xFF, NULL, -1, NULL, NULL, NULL); } - i_this->mSound.startCreatureSound(Z2SE_AL_INTO_WATER, 0, -1); - return retval; + i_this->sound.startCreatureSound(Z2SE_AL_INTO_WATER, 0, -1); + return rt; } - if (i_this->mMode < 50 && i_this->field_0xbd8 != 0) { + if (i_this->mode < 50 && i_this->field_0xbd8 != 0) { i_this->field_0xbd8--; - i_this->mMode = 50; - i_this->mTimers[0] = 20 + YREG_S(3); + i_this->mode = 50; + i_this->timer[0] = 20 + YREG_S(3); } } else { - f32 dbg_f25; - if (a_this->speedF >= 3.0f) { - dbg_f25 = 0.2f + KREG_F(1); + f32 sc; + if (actor->speedF >= 3.0f) { + sc = 0.2f + KREG_F(1); } else { - dbg_f25 = 0.05f + KREG_F(0); + sc = 0.05f + KREG_F(0); } - cXyz sp164 = a_this->current.pos; - sp164.y = i_this->field_0x63c; - fopAcM_effHamonSet(&i_this->field_0xbf4, &sp164, 1.5f + KREG_F(2), dbg_f25); + cXyz water_pos = actor->current.pos; + water_pos.y = i_this->waterY; + fopAcM_effHamonSet(&i_this->hammonPrtcl, &water_pos, 1.5f + KREG_F(2), sc); if (i_this->field_0xbdd == 0) { - i_this->mMode = 0; + i_this->mode = 0; } } action_check(i_this); - return retval; + return rt; } static void npc_ks_awaydoor(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->mTimers[0] = 30; + i_this->mode = 1; + i_this->timer[0] = 30; break; case 1: - if (i_this->mTimers[0] == 0) { - fopAcM_delete(a_this); + if (i_this->timer[0] == 0) { + fopAcM_delete(actor); } } - cXyz sp1c, sp28; + cXyz mae, ato; fopAc_ac_c* player = dComIfGp_getPlayer(0); cMtx_YrotS(*calc_mtx, player->shape_angle.y); - sp1c.x = 0.0f; - sp1c.y = 0.0f; - sp1c.z = 150.0f; - MtxPosition(&sp1c, &sp28); - sp28 += player->current.pos; - sp1c.x = a_this->current.pos.x - sp28.x; - sp1c.z = a_this->current.pos.z - sp28.z; - cLib_addCalcAngleS2(&a_this->current.angle.y, cM_atan2s(sp1c.x, sp1c.z), 1, 0x2000); - cLib_addCalc2(&a_this->speedF, l_HIO.holding_speed_h, 1.0f, 4.0f); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = 150.0f; + MtxPosition(&mae, &ato); + ato += player->current.pos; + mae.x = actor->current.pos.x - ato.x; + mae.z = actor->current.pos.z - ato.z; + cLib_addCalcAngleS2(&actor->current.angle.y, cM_atan2s(mae.x, mae.z), 1, 0x2000); + cLib_addCalc2(&actor->speedF, l_HIO.holding_speed_h, 1.0f, 4.0f); } static path guide_path_00[10] = { @@ -4233,21 +4233,21 @@ static path guide_path_01[12] = { }; static int npc_ks_guide_00(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp2c, sp38; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 1; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 1: - if (i_this->field_0x5c4 > 700.0f || guide_path_00[i_this->field_0x904].field_0x0 < 0) { + if (i_this->dis > 700.0f || guide_path_00[i_this->path_no].field_0x0 < 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4255,64 +4255,64 @@ static int npc_ks_guide_00(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; + i_this->mode = 10; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_00[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_00[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + i_this->guide_path.x = guide_path_00[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_00[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } break; case 5: - sp2c.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp2c.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp2c.x, sp2c.z); - if (JMAFastSqrt(sp2c.x * sp2c.x + sp2c.z * sp2c.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 8) { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + if (i_this->res_id == 8) { + i_this->current_angle.y = i_this->target_angle + 0x8000; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; } - if (i_this->field_0x5c4 < 550.0f && guide_path_00[i_this->field_0x904].field_0x0 >= 0) { - i_this->mMode = 1; + if (i_this->dis < 550.0f && guide_path_00[i_this->path_no].field_0x0 >= 0) { + i_this->mode = 1; } else { - if (i_this->field_0x5c4 < 150.0f && i_this->field_0x5d0 != 51) { + if (i_this->dis < 150.0f && i_this->res_id != 51) { anm_init(i_this, 51, 5.0f, 2, 1.0f); } - if (i_this->field_0x5d0 == 51) { + if (i_this->res_id == 51) { i_this->field_0x5fc = 1; } - if (guide_path_00[i_this->field_0x904].field_0x0 < 0 && saru_count_check(i_this) != 0) { - sp2c.x = player->current.pos.x - i_this->field_0x934->field_0x904[0].x; - sp2c.y = player->current.pos.y - (i_this->field_0x934->field_0x904[0].y - 450.0f); - sp2c.z = player->current.pos.z - i_this->field_0x934->field_0x904[0].z; + if (guide_path_00[i_this->path_no].field_0x0 < 0 && saru_count_check(i_this) != 0) { + mae.x = player->current.pos.x - i_this->child_no->field_0x904[0].x; + mae.y = player->current.pos.y - (i_this->child_no->field_0x904[0].y - 450.0f); + mae.z = player->current.pos.z - i_this->child_no->field_0x904[0].z; - if (sp2c.abs() < 300.0f) { + if (mae.abs() < 300.0f) { i_this->field_0xbd9 = 1; - i_this->mActionID = 20; - i_this->mMode = 0; + i_this->action = 20; + i_this->mode = 0; i_this->field_0xaec = 0; - i_this->field_0xbc8 = i_this->field_0x934->field_0x904[0]; - sp2c = i_this->field_0x934->field_0x904[1] - i_this->field_0xbc8; - leader->field_0xbd4 = cM_atan2s(sp2c.x, sp2c.z); - leader->field_0xb42 = 10; - leader->field_0xb40 = i_this->field_0x934->field_0x570; - if (i_this->field_0x5b6 != 0) { - leader->field_0x934 = i_this->field_0x934; + i_this->field_0xbc8 = i_this->child_no->field_0x904[0]; + mae = i_this->child_no->field_0x904[1] - i_this->field_0xbc8; + leader->field_0xbd4 = cM_atan2s(mae.x, mae.z); + leader->demo_mode = 10; + leader->field_0xb40 = i_this->child_no->field_0x570; + if (i_this->set_id != 0) { + leader->child_no = i_this->child_no; leader->field_0xbc8 = i_this->field_0xbc8; } } @@ -4322,28 +4322,28 @@ static int npc_ks_guide_00(npc_ks_class* i_this) { case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; break; case 41: - if ((i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { + if ((i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43) { - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43) { + if (i_this->model->isStop()) { + i_this->mode = 40; } } break; case 42: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4351,37 +4351,37 @@ static int npc_ks_guide_00(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; + i_this->mode = 10; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } - if (i_this->mMode >= 40 && i_this->mMode <= 41) { + if (i_this->mode >= 40 && i_this->mode <= 41) { fopAc_ac_c* enemy_p = enemy_check(i_this, 800.0f); if (enemy_p == NULL) { - i_this->mMode = 42; - i_this->mTimers[0] = 30; + i_this->mode = 42; + i_this->timer[0] = 30; } else { - sp2c.x = enemy_p->current.pos.x - a_this->current.pos.x; - sp2c.z = enemy_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp2c.x, sp2c.z) + 0x8000; + mae.x = enemy_p->current.pos.x - actor->current.pos.x; + mae.z = enemy_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z) + 0x8000; } } else { if (enemy_view_check(i_this, 700.0f) != NULL) { - i_this->mMode = 40; - a_this->speedF = 0.0f; + i_this->mode = 40; + actor->speedF = 0.0f; } } @@ -4389,20 +4389,20 @@ static int npc_ks_guide_00(npc_ks_class* i_this) { } static int npc_ks_guide_00_2(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - cXyz sp34, sp40; + fopAc_ac_c* actor = &i_this->actor; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 1; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 1: - if (i_this->field_0x5c4 > 900.0f || guide_path_00_2[i_this->field_0x904].field_0x0 < 0) { + if (i_this->dis > 900.0f || guide_path_00_2[i_this->path_no].field_0x0 < 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4410,77 +4410,77 @@ static int npc_ks_guide_00_2(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; + i_this->mode = 10; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_00_2[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_00_2[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + i_this->guide_path.x = guide_path_00_2[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_00_2[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } break; case 5: - sp34.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp34.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp34.x, sp34.z); - if (JMAFastSqrt(sp34.x * sp34.x + sp34.z * sp34.z) < a_this->speedF * 1.2f) { - if (i_this->field_0x5b6 == 0 || i_this->field_0x5b6 == 1) { - i_this->field_0x904++; + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + if (i_this->set_id == 0 || i_this->set_id == 1) { + i_this->path_no++; } - i_this->field_0x904++; - i_this->mMode = 1; + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 7) { - i_this->field_0x8fc.y = i_this->field_0x5c8; + if (i_this->res_id == 7) { + i_this->current_angle.y = i_this->target_angle; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + i_this->current_angle.y = i_this->target_angle + 0x8000; } - if (i_this->field_0x5c4 < 750.0f && guide_path_00_2[i_this->field_0x904].field_0x0 >= 0) { - i_this->mMode = 1; + if (i_this->dis < 750.0f && guide_path_00_2[i_this->path_no].field_0x0 >= 0) { + i_this->mode = 1; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } return rv; } static int npc_ks_guide_00_3(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - cXyz sp2c, sp38; + fopAc_ac_c* actor = &i_this->actor; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 1; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 1: - if (i_this->field_0x5c4 > 500.0f || guide_path_00_3[i_this->field_0x904].field_0x0 < 0) { + if (i_this->dis > 500.0f || guide_path_00_3[i_this->path_no].field_0x0 < 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4488,44 +4488,44 @@ static int npc_ks_guide_00_3(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; + i_this->mode = 10; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_00_3[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_00_3[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + i_this->guide_path.x = guide_path_00_3[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_00_3[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } break; case 5: - sp2c.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp2c.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp2c.x, sp2c.z); - if (JMAFastSqrt(sp2c.x * sp2c.x + sp2c.z * sp2c.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 8) { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + if (i_this->res_id == 8) { + i_this->current_angle.y = i_this->target_angle + 0x8000; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; } - if (i_this->field_0x5c4 < 400.0f && guide_path_00_3[i_this->field_0x904].field_0x0 >= 0) { - i_this->mMode = 1; + if (i_this->dis < 400.0f && guide_path_00_3[i_this->path_no].field_0x0 >= 0) { + i_this->mode = 1; } else { - if (i_this->field_0x5c4 < 150.0f && i_this->field_0x5d0 != 51) { + if (i_this->dis < 150.0f && i_this->res_id != 51) { anm_init(i_this, 51, 5.0f, 2, 1.0f); } - if (i_this->field_0x5d0 == 51) { + if (i_this->res_id == 51) { i_this->field_0x5fc = 1; } } @@ -4533,28 +4533,28 @@ static int npc_ks_guide_00_3(npc_ks_class* i_this) { case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; break; case 41: - if (i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7) || ((frame > 40 && frame < 48) || frame > 65)) { + if (i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7) || ((frame > 40 && frame < 48) || frame > 65)) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43) { - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43) { + if (i_this->model->isStop()) { + i_this->mode = 40; } } break; case 42: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4562,62 +4562,62 @@ static int npc_ks_guide_00_3(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; + i_this->mode = 10; } } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } - if (i_this->mMode >= 40 && i_this->mMode <= 41) { + if (i_this->mode >= 40 && i_this->mode <= 41) { fopAc_ac_c* enemy_p = enemy_check(i_this, 700.0f); if (enemy_p == NULL) { - i_this->mMode = 42; - i_this->mTimers[0] = 30; + i_this->mode = 42; + i_this->timer[0] = 30; } else { - sp2c.x = enemy_p->current.pos.x - a_this->current.pos.x; - sp2c.z = enemy_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp2c.x, sp2c.z) + 0x8000; + mae.x = enemy_p->current.pos.x - actor->current.pos.x; + mae.z = enemy_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z) + 0x8000; } } else if (enemy_view_check(i_this, 600.0f) != NULL) { - i_this->mMode = 40; - a_this->speedF = 0.0f; + i_this->mode = 40; + actor->speedF = 0.0f; } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); return rv; } static int npc_ks_guide_01(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - cXyz sp3c, sp48; + fopAc_ac_c* actor = &i_this->actor; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); f32 fVar1 = 0.0f; - if (fopAcM_GetRoomNo(a_this) == 1 && i_this->field_0x904 >= 5) { + if (fopAcM_GetRoomNo(actor) == 1 && i_this->path_no >= 5) { fVar1 = 300.0f; } - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 1; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 1: case 101: - if (i_this->mMode == 1 && (i_this->field_0x5c4 > 900.0f || guide_path_01[i_this->field_0x904].field_0x0 < 0)) { + if (i_this->mode == 1 && (i_this->dis > 900.0f || guide_path_01[i_this->path_no].field_0x0 < 0)) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4625,23 +4625,23 @@ static int npc_ks_guide_01(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; - } else if (guide_path_01[i_this->field_0x904].field_0x0 != 0) { - i_this->field_0x8f0.x = guide_path_01[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.y = guide_path_01[i_this->field_0x904].field_0x8; - i_this->field_0x8f0.z = guide_path_01[i_this->field_0x904].field_0xc; - i_this->field_0x910 = a_this->current.pos; - i_this->field_0x91c = i_this->field_0x8f0; - i_this->mMode = 2; + i_this->mode = 10; + actor->speedF = 0.0f; + } else if (guide_path_01[i_this->path_no].field_0x0 != 0) { + i_this->guide_path.x = guide_path_01[i_this->path_no].field_0x4; + i_this->guide_path.y = guide_path_01[i_this->path_no].field_0x8; + i_this->guide_path.z = guide_path_01[i_this->path_no].field_0xc; + i_this->field_0x910 = actor->current.pos; + i_this->field_0x91c = i_this->guide_path; + i_this->mode = 2; anm_init(i_this, 32, 2.0f, 0, 1.0f); - a_this->speedF = 0.0f; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_01[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_01[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + i_this->guide_path.x = guide_path_01[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_01[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } @@ -4649,86 +4649,86 @@ static int npc_ks_guide_01(npc_ks_class* i_this) { case 2: rv = 2; - if (i_this->field_0x5d0 == 32 && i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 32 && i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; } - sp3c = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp3c.x, sp3c.z); - i_this->field_0x8fc.x = -cM_atan2s(sp3c.y, JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z)); - if (sp3c.abs() < a_this->speedF * 1.2f) { - a_this->current.pos = i_this->field_0x8f0; - i_this->mMode = 1; + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); + if (mae.abs() < actor->speedF * 1.2f) { + actor->current.pos = i_this->guide_path; + i_this->mode = 1; i_this->field_0xbe0 = 1; - i_this->field_0x904++; + i_this->path_no++; } break; case 5: - sp3c.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp3c.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp3c.x, sp3c.z); - if (JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 8) { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + if (i_this->res_id == 8) { + i_this->current_angle.y = i_this->target_angle + 0x8000; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; } - if (guide_path_01[i_this->field_0x904].field_0x0 >= 0) { - if (i_this->field_0x5c4 < 600.0f) { - i_this->mMode = 1; + if (guide_path_01[i_this->path_no].field_0x0 >= 0) { + if (i_this->dis < 600.0f) { + i_this->mode = 1; } fopAc_ac_c* player = dComIfGp_getPlayer(0); - sp3c.x = player->current.pos.x - 9200.0f; - sp3c.z = player->current.pos.z - 4839.0f; - sp48.x = a_this->current.pos.x - 9200.0f; - sp48.z = a_this->current.pos.z - 4839.0f; + mae.x = player->current.pos.x - 9200.0f; + mae.z = player->current.pos.z - 4839.0f; + ato.x = actor->current.pos.x - 9200.0f; + ato.z = actor->current.pos.z - 4839.0f; - if ((sp3c.x * sp3c.x + sp3c.z * sp3c.z) < (sp48.x * sp48.x + sp48.z * sp48.z)) { - i_this->mMode = 101; + if ((mae.x * mae.x + mae.z * mae.z) < (ato.x * ato.x + ato.z * ato.z)) { + i_this->mode = 101; } - } else if (i_this->field_0x5c4 < 150.0f) { - i_this->mActionID = 100; - i_this->mMode = 0; + } else if (i_this->dis < 150.0f) { + i_this->action = 100; + i_this->mode = 0; return 1; } break; case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; break; case 41: - if (i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7) || ((frame > 40 && frame < 48) ) || frame > 65) { + if (i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7) || ((frame > 40 && frame < 48) ) || frame > 65) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43 && i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43 && i_this->model->isStop()) { + i_this->mode = 40; } break; case 42: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4736,44 +4736,44 @@ static int npc_ks_guide_01(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; + i_this->mode = 10; } break; } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } - if (a_this->speedF > 30.0f) { + if (actor->speedF > 30.0f) { i_this->field_0x90c = 1; } else { - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } } - if (i_this->mMode >= 40 && i_this->mMode <= 41) { + if (i_this->mode >= 40 && i_this->mode <= 41) { fopAc_ac_c* enemy_p = enemy_check(i_this, fVar1 + 700.0f); if (enemy_p == NULL) { - i_this->mMode = 42; - i_this->mTimers[0] = 30; + i_this->mode = 42; + i_this->timer[0] = 30; } else { - sp3c.x = enemy_p->current.pos.x - a_this->current.pos.x; + mae.x = enemy_p->current.pos.x - actor->current.pos.x; - sp3c.z = enemy_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp3c.x, sp3c.z) + 0x8000; + mae.z = enemy_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z) + 0x8000; } } else if (enemy_view_check(i_this, fVar1 + 600.0f) != NULL) { - i_this->mMode = 40; - a_this->speedF = 0.0f; + i_this->mode = 40; + actor->speedF = 0.0f; } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); return rv; } @@ -4803,33 +4803,33 @@ static path guide_path_02[21] = { }; static int npc_ks_guide_02(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp3c, sp48; + cXyz mae, ato; int rv = 1; f32 fVar1; - int frame_int = i_this->mpModelMorf->getFrame(); - if (i_this->field_0x5b6 == 0) { + int frame_int = i_this->model->getFrame(); + if (i_this->set_id == 0) { fVar1 = 1000.0f + YREG_F(5); } else { fVar1 = 700.0f + YREG_F(6); } - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - if (i_this->field_0x5b6 == 0) { - i_this->field_0x904 = 0; + i_this->mode = 1; + if (i_this->set_id == 0) { + i_this->path_no = 0; } else { - i_this->field_0x904 = 11; + i_this->path_no = 11; } - a_this->speedF = 0.0f; + actor->speedF = 0.0f; // fallthrough case 1: - if (i_this->mTimers[2] == 0 && (((player->current.pos.y - a_this->current.pos.y) < 10.0f && i_this->field_0x5c4 > fVar1) || - guide_path_02[i_this->field_0x904].field_0x0 < 0)) { + if (i_this->timer[2] == 0 && (((player->current.pos.y - actor->current.pos.y) < 10.0f && i_this->dis > fVar1) || + guide_path_02[i_this->path_no].field_0x0 < 0)) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4837,90 +4837,90 @@ static int npc_ks_guide_02(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; + i_this->mode = 10; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_02[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_02[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + i_this->guide_path.x = guide_path_02[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_02[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } break; case 5: - if (i_this->mObjAcch.ChkWallHit() != 0) { - a_this->speed.y = 20.0f; + if (i_this->ObjAcch.ChkWallHit() != 0) { + actor->speed.y = 20.0f; } - sp3c.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp3c.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp3c.x, sp3c.z); - if (JMAFastSqrt(sp3c.x * sp3c.x + sp3c.z * sp3c.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 7) { - i_this->field_0x8fc.y = i_this->field_0x5c8; + if (i_this->res_id == 7) { + i_this->current_angle.y = i_this->target_angle; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + i_this->current_angle.y = i_this->target_angle + 0x8000; } - if (((player->current.pos.y - a_this->current.pos.y) > 10.0f || i_this->field_0x5c4 < (fVar1 - 150.0f)) && guide_path_02[i_this->field_0x904].field_0x0 >= 0) { - i_this->mMode = 1; + if (((player->current.pos.y - actor->current.pos.y) > 10.0f || i_this->dis < (fVar1 - 150.0f)) && guide_path_02[i_this->path_no].field_0x0 >= 0) { + i_this->mode = 1; } - if (guide_path_02[i_this->field_0x904].field_0x0 < 0 && i_this->field_0x5b6 == 0 && saru_count_check(i_this) != 0) { + if (guide_path_02[i_this->path_no].field_0x0 < 0 && i_this->set_id == 0 && saru_count_check(i_this) != 0) { fopAc_ac_c* player_2 = (fopAc_ac_c*) dComIfGp_getPlayer(0); int iVar1 = 0; - for (int i = 0; i < i_this->field_0x934->field_0x91c; i++) { - sp3c = player_2->current.pos - saru_p[i]->actor.current.pos; - if (sp3c.abs() > 400.0f) { + for (int i = 0; i < i_this->child_no->field_0x91c; i++) { + mae = player_2->current.pos - saru_p[i]->actor.current.pos; + if (mae.abs() > 400.0f) { iVar1 = 1; } } - sp3c.x = player->current.pos.x - i_this->field_0x934->field_0x904[0].x; - sp3c.y = player->current.pos.y - (i_this->field_0x934->field_0x904[0].y - 450.0f); - sp3c.z = player->current.pos.z - i_this->field_0x934->field_0x904[0].z; + mae.x = player->current.pos.x - i_this->child_no->field_0x904[0].x; + mae.y = player->current.pos.y - (i_this->child_no->field_0x904[0].y - 450.0f); + mae.z = player->current.pos.z - i_this->child_no->field_0x904[0].z; - if (iVar1 == 0 && sp3c.abs() < 300.0f) { + if (iVar1 == 0 && mae.abs() < 300.0f) { i_this->field_0xbd9 = 1; - i_this->field_0xbc8 = i_this->field_0x934->field_0x904[0]; - i_this->mActionID = 20; - i_this->mMode = 0; + i_this->field_0xbc8 = i_this->child_no->field_0x904[0]; + i_this->action = 20; + i_this->mode = 0; i_this->field_0xaec = 0; - leader->field_0xb42 = 10; + leader->demo_mode = 10; leader->field_0xb40 = 0; leader->field_0xbc8 = i_this->field_0xbc8; - sp3c = i_this->field_0x934->field_0x904[1] - i_this->field_0xbc8; - leader->field_0xbd4 = cM_atan2s(sp3c.x, sp3c.z); + mae = i_this->child_no->field_0x904[1] - i_this->field_0xbc8; + leader->field_0xbd4 = cM_atan2s(mae.x, mae.z); saru_count_check(saru_p[1]); - saru_p[1]->mActionID = 22; - saru_p[1]->mMode = 0; + saru_p[1]->action = 22; + saru_p[1]->mode = 0; saru_p[1]->field_0x930 = leader; } } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } return rv; @@ -4936,21 +4936,21 @@ static path guide_path_22[6] = { }; static int npc_ks_guide_22(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - i_this->field_0x5c4 = fopAcM_searchPlayerDistance(a_this); - cXyz sp28, sp34; + fopAc_ac_c* actor = &i_this->actor; + i_this->dis = fopAcM_searchPlayerDistance(actor); + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 1; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 1: - if (i_this->field_0x5c4 > 500.0f || guide_path_22[i_this->field_0x904].field_0x0 < 0) { + if (i_this->dis > 500.0f || guide_path_22[i_this->path_no].field_0x0 < 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -4958,22 +4958,22 @@ static int npc_ks_guide_22(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; - } else if (guide_path_22[i_this->field_0x904].field_0x0 != 0) { + i_this->mode = 10; + actor->speedF = 0.0f; + } else if (guide_path_22[i_this->path_no].field_0x0 != 0) { anm_init(i_this, 12, 3.0f, 2, 1.0f); - i_this->field_0x8f0.x = guide_path_22[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.y = guide_path_22[i_this->field_0x904].field_0x8; - i_this->field_0x8f0.z = guide_path_22[i_this->field_0x904].field_0xc; - i_this->mMode = 2; - a_this->speedF = 0.0f; + i_this->guide_path.x = guide_path_22[i_this->path_no].field_0x4; + i_this->guide_path.y = guide_path_22[i_this->path_no].field_0x8; + i_this->guide_path.z = guide_path_22[i_this->path_no].field_0xc; + i_this->mode = 2; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_22[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_22[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; + i_this->guide_path.x = guide_path_22[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_22[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } @@ -4982,80 +4982,80 @@ static int npc_ks_guide_22(npc_ks_class* i_this) { case 2: rv = 0; - sp28.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp28.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp28.x, sp28.z); - cLib_addCalc2(&a_this->current.pos.y, i_this->field_0x8f0.y, 1.0f, 15.0f); + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + cLib_addCalc2(&actor->current.pos.y, i_this->guide_path.y, 1.0f, 15.0f); - if (a_this->current.pos.y >= (i_this->field_0x8f0.y - 110.0f) && i_this->field_0x5d0 != 26) { + if (actor->current.pos.y >= (i_this->guide_path.y - 110.0f) && i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } - if (a_this->current.pos.y >= (i_this->field_0x8f0.y - 50.0f)) { - cLib_addCalc2(&a_this->current.pos.x, i_this->field_0x8f0.x, 1.0f, 20.0f); - cLib_addCalc2(&a_this->current.pos.z, i_this->field_0x8f0.z, 1.0f, 20.0f); + if (actor->current.pos.y >= (i_this->guide_path.y - 50.0f)) { + cLib_addCalc2(&actor->current.pos.x, i_this->guide_path.x, 1.0f, 20.0f); + cLib_addCalc2(&actor->current.pos.z, i_this->guide_path.z, 1.0f, 20.0f); } - if (a_this->current.pos.y >= i_this->field_0x8f0.y) { - a_this->current.pos = i_this->field_0x8f0; - i_this->field_0x904++; - i_this->mMode = 1; + if (actor->current.pos.y >= i_this->guide_path.y) { + actor->current.pos = i_this->guide_path; + i_this->path_no++; + i_this->mode = 1; } break; case 5: - sp28.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp28.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp28.x, sp28.z); + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); - if (JMAFastSqrt(sp28.x * sp28.x + sp28.z * sp28.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 8) { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + if (i_this->res_id == 8) { + i_this->current_angle.y = i_this->target_angle + 0x8000; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; } - if (i_this->field_0x5c4 < 300.0f && guide_path_22[i_this->field_0x904].field_0x0 >= 0) { - i_this->mMode = 1; + if (i_this->dis < 300.0f && guide_path_22[i_this->path_no].field_0x0 >= 0) { + i_this->mode = 1; } - if (i_this->field_0x5c4 < 150.0f && i_this->field_0x5d0 != 51) { + if (i_this->dis < 150.0f && i_this->res_id != 51) { anm_init(i_this, 51, 5.0f, 2, 1.0f); } - if (i_this->field_0x5d0 == 51) { + if (i_this->res_id == 51) { i_this->field_0x5fc = 1; } break; case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; break; case 41: - if ((i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { + if ((i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43 && i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43 && i_this->model->isStop()) { + i_this->mode = 40; } break; case 42: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -5063,42 +5063,42 @@ static int npc_ks_guide_22(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; + i_this->mode = 10; } } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } - if (a_this->speedF > 30.0f) { + if (actor->speedF > 30.0f) { i_this->field_0x90c = 1; } else { - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } } - if (i_this->mMode >= 40 && i_this->mMode <= 41) { + if (i_this->mode >= 40 && i_this->mode <= 41) { fopAc_ac_c* enemy_p = enemy_check(i_this, 700.0f); if (enemy_p == NULL) { - i_this->mMode = 42; - i_this->mTimers[0] = 30; + i_this->mode = 42; + i_this->timer[0] = 30; } else { - sp28.x = enemy_p->current.pos.x - a_this->current.pos.x; - sp28.z = enemy_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp28.x, sp28.z) + 0x8000; + mae.x = enemy_p->current.pos.x - actor->current.pos.x; + mae.z = enemy_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z) + 0x8000; } } else if (enemy_view_check(i_this, 600.0f) != NULL) { - i_this->mMode = 40; - a_this->speedF = 0.0f; + i_this->mode = 40; + actor->speedF = 0.0f; } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); return rv; } @@ -5116,22 +5116,22 @@ static path guide_path_09[9] = { }; static int npc_ks_guide_09(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp40, sp4c; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); f32 fVar1 = 0.0f; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 1; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 1: - if (i_this->field_0x5c4 > 900.0f || guide_path_09[i_this->field_0x904].field_0x0 < 0) { + if (i_this->dis > 900.0f || guide_path_09[i_this->path_no].field_0x0 < 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -5139,24 +5139,24 @@ static int npc_ks_guide_09(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; - } else if (guide_path_09[i_this->field_0x904].field_0x0 != 0) { - i_this->field_0x8f0.x = guide_path_09[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.y = guide_path_09[i_this->field_0x904].field_0x8; - i_this->field_0x8f0.z = guide_path_09[i_this->field_0x904].field_0xc; - i_this->field_0x910 = a_this->current.pos; - i_this->field_0x91c = i_this->field_0x8f0; - i_this->mMode = 2; + i_this->mode = 10; + actor->speedF = 0.0f; + } else if (guide_path_09[i_this->path_no].field_0x0 != 0) { + i_this->guide_path.x = guide_path_09[i_this->path_no].field_0x4; + i_this->guide_path.y = guide_path_09[i_this->path_no].field_0x8; + i_this->guide_path.z = guide_path_09[i_this->path_no].field_0xc; + i_this->field_0x910 = actor->current.pos; + i_this->field_0x91c = i_this->guide_path; + i_this->mode = 2; anm_init(i_this, 32, 2.0f, 0, 1.0f); - a_this->speedF = 0.0f; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_09[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_09[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; + i_this->guide_path.x = guide_path_09[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_09[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } @@ -5164,53 +5164,53 @@ static int npc_ks_guide_09(npc_ks_class* i_this) { case 2: rv = 2; - if (i_this->field_0x5d0 == 32 && i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 32 && i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); } - sp40 = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp40.x, sp40.z); - i_this->field_0x8fc.x = -cM_atan2s(sp40.y, JMAFastSqrt(sp40.x * sp40.x + sp40.z * sp40.z)); + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); - if (sp40.abs() < a_this->speedF * 1.2f) { - a_this->current.pos = i_this->field_0x8f0; - i_this->mMode = 1; - i_this->field_0x904++; + if (mae.abs() < actor->speedF * 1.2f) { + actor->current.pos = i_this->guide_path; + i_this->mode = 1; + i_this->path_no++; } break; case 5: - sp40.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp40.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp40.x, sp40.z); + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); - if (JMAFastSqrt(sp40.x * sp40.x + sp40.z * sp40.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 8) { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + if (i_this->res_id == 8) { + i_this->current_angle.y = i_this->target_angle + 0x8000; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; } - if (guide_path_09[i_this->field_0x904].field_0x0 >= 0) { - if (i_this->field_0x5c4 < 600.0f) { - i_this->mMode = 1; + if (guide_path_09[i_this->path_no].field_0x0 >= 0) { + if (i_this->dis < 600.0f) { + i_this->mode = 1; } } else { - if (i_this->field_0x5c4 < 150.0f && i_this->field_0x5d0 != 51) { + if (i_this->dis < 150.0f && i_this->res_id != 51) { anm_init(i_this, 51, 5.0f, 2, 1.0f); } - if (i_this->field_0x5d0 == 51) { + if (i_this->res_id == 51) { i_this->field_0x5fc = 1; } } @@ -5218,26 +5218,26 @@ static int npc_ks_guide_09(npc_ks_class* i_this) { case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; break; case 41: - if ((i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { + if ((i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43 && i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43 && i_this->model->isStop()) { + i_this->mode = 40; } break; case 42: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -5245,42 +5245,42 @@ static int npc_ks_guide_09(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; + i_this->mode = 10; } } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } - if (a_this->speedF > 30.0f) { + if (actor->speedF > 30.0f) { i_this->field_0x90c = 1; } else { - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } } - if (i_this->mMode >= 40 && i_this->mMode <= 41) { + if (i_this->mode >= 40 && i_this->mode <= 41) { fopAc_ac_c* enemy_p = enemy_check(i_this, 700.0f); if (enemy_p == NULL) { - i_this->mMode = 42; - i_this->mTimers[0] = 30; + i_this->mode = 42; + i_this->timer[0] = 30; } else { - sp40.x = enemy_p->current.pos.x - a_this->current.pos.x; - sp40.z = enemy_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp40.x, sp40.z) + 0x8000; + mae.x = enemy_p->current.pos.x - actor->current.pos.x; + mae.z = enemy_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z) + 0x8000; } } else if (enemy_view_check(i_this, 600.0f) != NULL) { - i_this->mMode = 40; - a_this->speedF = 0.0f; + i_this->mode = 40; + actor->speedF = 0.0f; } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); return rv; } @@ -5294,40 +5294,40 @@ static path guide_path_12[5] = { }; static int npc_ks_demo_12(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp48, sp54; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: - if (i_this->field_0xb42 >= 79) { + if (i_this->demo_mode >= 79) { anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; + i_this->mode = 1; + i_this->path_no = 0; } - a_this->speedF = 0.0f; + actor->speedF = 0.0f; break; case 1: - if (guide_path_12[i_this->field_0x904].field_0x0 != 0) { - i_this->field_0x8f0.x = guide_path_12[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.y = guide_path_12[i_this->field_0x904].field_0x8; - i_this->field_0x8f0.z = guide_path_12[i_this->field_0x904].field_0xc; - i_this->field_0x910 = a_this->current.pos; - i_this->field_0x91c = i_this->field_0x8f0; - i_this->mMode = 2; + if (guide_path_12[i_this->path_no].field_0x0 != 0) { + i_this->guide_path.x = guide_path_12[i_this->path_no].field_0x4; + i_this->guide_path.y = guide_path_12[i_this->path_no].field_0x8; + i_this->guide_path.z = guide_path_12[i_this->path_no].field_0xc; + i_this->field_0x910 = actor->current.pos; + i_this->field_0x91c = i_this->guide_path; + i_this->mode = 2; anm_init(i_this, 32, 2.0f, 0, 1.0f); - a_this->speedF = 0.0f; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_12[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_12[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; + i_this->guide_path.x = guide_path_12[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_12[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } @@ -5335,54 +5335,54 @@ static int npc_ks_demo_12(npc_ks_class* i_this) { case 2: rv = 2; - if (i_this->field_0x5d0 == 32 && i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 32 && i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; } - sp48 = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp48.x, sp48.z); - i_this->field_0x8fc.x = -cM_atan2s(sp48.y, JMAFastSqrt(sp48.x * sp48.x + sp48.z * sp48.z)); + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); - if (sp48.abs() < a_this->speedF * 1.2f) { - a_this->current.pos = i_this->field_0x8f0; - i_this->mMode = 1; + if (mae.abs() < actor->speedF * 1.2f) { + actor->current.pos = i_this->guide_path; + i_this->mode = 1; i_this->field_0xbe0 = 1; - i_this->field_0x904++; + i_this->path_no++; } break; case 5: - sp48.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp48.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp48.x, sp48.z); + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); - if (JMAFastSqrt(sp48.x * sp48.x + sp48.z * sp48.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); - if (a_this->speedF > 30.0f) { + if (actor->speedF > 30.0f) { i_this->field_0x90c = 1; } else { - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); - if (guide_path_12[i_this->field_0x904].field_0x0 < 0) { - i_this->mActionID = 8; - a_this->speedF = 0.0f; + if (guide_path_12[i_this->path_no].field_0x0 < 0) { + i_this->action = 8; + actor->speedF = 0.0f; } return rv; @@ -5397,21 +5397,21 @@ static path guide_path_0409[5] = { }; static int npc_ks_guide_0409(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp50; + cXyz mae; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->mMode = 1; - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; + i_this->mode = 1; + i_this->path_no = 0; + actor->speedF = 0.0f; // fallthrough case 1: - if (player->current.pos.z > a_this->current.pos.z && (i_this->field_0x5c4 > 700.0f || guide_path_0409[i_this->field_0x904].field_0x0 < 0)) { + if (player->current.pos.z > actor->current.pos.z && (i_this->dis > 700.0f || guide_path_0409[i_this->path_no].field_0x0 < 0)) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -5419,67 +5419,67 @@ static int npc_ks_guide_0409(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; + i_this->mode = 10; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_0409[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_0409[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; + i_this->guide_path.x = guide_path_0409[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_0409[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } break; case 5: - sp50.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp50.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp50.x, sp50.z); + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); - if (JMAFastSqrt(sp50.x * sp50.x + sp50.z * sp50.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; } break; case 10: - if (i_this->field_0x5d0 == 8) { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + if (i_this->res_id == 8) { + i_this->current_angle.y = i_this->target_angle + 0x8000; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; } - if ((i_this->field_0x5c4 < 550.0f || player->current.pos.z < a_this->current.pos.z) - && guide_path_0409[i_this->field_0x904].field_0x0 >= 0) { - i_this->mMode = 1; + if ((i_this->dis < 550.0f || player->current.pos.z < actor->current.pos.z) + && guide_path_0409[i_this->path_no].field_0x0 >= 0) { + i_this->mode = 1; } else { - if (i_this->field_0x5c4 < 150.0f && i_this->field_0x5d0 != 51) { + if (i_this->dis < 150.0f && i_this->res_id != 51) { anm_init(i_this, 51, 5.0f, 2, 1.0f); } - if (i_this->field_0x5d0 == 51) { + if (i_this->res_id == 51) { i_this->field_0x5fc = 1; } } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 1, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 1, 0x1000); - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } - cLib_addCalcAngleS2(&a_this->current.angle.x, 0, 1, 0x800); + cLib_addCalcAngleS2(&actor->current.angle.x, 0, 1, 0x800); if (checkDoorDemo()) { f32 fVar1 = 7280.0f - player->current.pos.x; f32 fVar2 = -2709.0f - player->current.pos.z; if (JMAFastSqrt(fVar1 * fVar1 + fVar2 * fVar2) < 500.0f) { - i_this->mActionID = 100; - i_this->mMode = 0; + i_this->action = 100; + i_this->mode = 0; } } @@ -5487,12 +5487,12 @@ static int npc_ks_guide_0409(npc_ks_class* i_this) { } static int path_search(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; int path_index = 0; while (path_index < 255) { - dPath* path_p = dPath_GetRoomPath(path_index, fopAcM_GetRoomNo(a_this)); + dPath* path_p = dPath_GetRoomPath(path_index, fopAcM_GetRoomNo(actor)); if (path_p != NULL) { - cXyz sp28 = a_this->current.pos - path_p->m_points->m_position; + cXyz sp28 = actor->current.pos - path_p->m_points->m_position; if (sp28.abs() < 200.0f) { OS_REPORT(" サルがが%d番のレール発見しました。\n", path_index); i_this->field_0xc18 = path_p; @@ -5508,21 +5508,21 @@ static int path_search(npc_ks_class* i_this) { } static int npc_ks_mori(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp44, sp50; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); f32 fVar2 = 1.25f + TREG_F(17); f32 fVar1 = l_HIO.link_approach_distance; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: /* dSv_event_flag_c::F_0225 - Faron Woods - Lanter guide monkey doesn't come out a second time */ if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[225])) { /* dSv_event_flag_c::F_0226 - Faron Woods - Get lantern back from monkey */ if (!dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[226])) { - i_this->mMode = 302; + i_this->mode = 302; i_this->field_0xc17 = 3; dComIfGp_setItemOilCount(-(dComIfGs_getMaxOil() & 0xFFFF)); } @@ -5530,81 +5530,81 @@ static int npc_ks_mori(npc_ks_class* i_this) { i_this->field_0xaec = 1; /* dSv_event_flag_c::F_0224 - Faron Woods - Flag for lantern guide monkey cutscene */ if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[224])) { - i_this->mMode = 3; + i_this->mode = 3; call_pt = 0; i_this->field_0xc17 = 2; - a_this->current.angle.y = player->shape_angle.y + 0x8000; - i_this->field_0x8fc.y = a_this->current.angle.y; + actor->current.angle.y = player->shape_angle.y + 0x8000; + i_this->current_angle.y = actor->current.angle.y; } else { - a_this->current.pos.y = a_this->home.pos.y + 10000.0f; - a_this->speed.y = 0.0f; + actor->current.pos.y = actor->home.pos.y + 10000.0f; + actor->speed.y = 0.0f; if (!daPy_getPlayerActorClass()->checkKandelaarSwing(1)) { if (!daPy_getPlayerActorClass()->getKandelaarFlamePos()) break; if (!daPy_getPlayerActorClass()->checkUseKandelaar(0)) break; } - sp44.set(-27426.0f, player->current.pos.y, -20000.0f); - sp44 -= player->current.pos; - if (sp44.abs() < 7500.0f) { - i_this->mMode = 1; - i_this->mTimers[0] = 10; + mae.set(-27426.0f, player->current.pos.y, -20000.0f); + mae -= player->current.pos; + if (mae.abs() < 7500.0f) { + i_this->mode = 1; + i_this->timer[0] = 10; } } } break; case 1: - a_this->current.pos.y = a_this->home.pos.y + 10000.0f; - a_this->speed.y = 0.0f; - if (i_this->mTimers[0] != 1) break; + actor->current.pos.y = actor->home.pos.y + 10000.0f; + actor->speed.y = 0.0f; + if (i_this->timer[0] != 1) break; if (daPy_getPlayerActorClass()->checkKandelaarSwing(1) || (daPy_getPlayerActorClass()->getKandelaarFlamePos() != NULL && daPy_getPlayerActorClass()->checkUseKandelaar(0))) { - i_this->field_0xb42 = 200; + i_this->demo_mode = 200; anm_init(i_this, 44, 0.0f, 2, 1.0f); } else { - i_this->mMode = 0; + i_this->mode = 0; } break; case 2: cMtx_YrotS(*calc_mtx, player->shape_angle.y); - sp44.x = i_this->field_0xbb4; - sp44.y = 0.0f; - sp44.z = 100.0f; - MtxPosition(&sp44, &sp50); - a_this->current.pos = player->current.pos + sp50; - a_this->current.angle.y = player->shape_angle.y - 0x4000; - i_this->field_0x8fc.y = a_this->current.angle.y; + mae.x = i_this->field_0xbb4; + mae.y = 0.0f; + mae.z = 100.0f; + MtxPosition(&mae, &ato); + actor->current.pos = player->current.pos + ato; + actor->current.angle.y = player->shape_angle.y - 0x4000; + i_this->current_angle.y = actor->current.angle.y; cLib_addCalc2(&i_this->field_0xbb4, -500.0f, 1.0f, 20.0f); break; case 230: - a_this->speedF = 20.0f; - if (i_this->mTimers[0] == 0) { - i_this->mMode = 231; - a_this->speedF = 0.0f; + actor->speedF = 20.0f; + if (i_this->timer[0] == 0) { + i_this->mode = 231; + actor->speedF = 0.0f; anm_init(i_this, 51, 5.0f, 2, 1.0f); - i_this->mTimers[0] = 30; + i_this->timer[0] = 30; } break; case 231: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { anm_init(i_this, 44, 3.0f, 2, 1.0f); - i_this->mTimers[0] = 110; - i_this->mMode = 232; + i_this->timer[0] = 110; + i_this->mode = 232; } break; case 232: - if (i_this->mTimers[0] == 40) { + if (i_this->timer[0] == 40) { anm_init(i_this, 51, 5.0f, 2, 1.0f); } - if (i_this->mTimers[0] == 0) { - i_this->mMode = 3; + if (i_this->timer[0] == 0) { + i_this->mode = 3; call_pt = 1; } break; @@ -5612,20 +5612,20 @@ static int npc_ks_mori(npc_ks_class* i_this) { case 3: if (path_search(i_this) != 0) { anm_init(i_this, 28, 6.0f, 2, 1.0f); - i_this->mMode = 4; - i_this->field_0x904 = 1; - a_this->speedF = 0.0f; - i_this->mTimers[3] = l_HIO.lantern_swing_interval * 30.0f; + i_this->mode = 4; + i_this->path_no = 1; + actor->speedF = 0.0f; + i_this->timer[3] = l_HIO.lantern_swing_interval * 30.0f; } break; case 4: - if (i_this->field_0x904 >= i_this->field_0xc18->m_num) { + if (i_this->path_no >= i_this->field_0xc18->m_num) { anm_init(i_this, 7, 5.0f, 2, 1.0f); - i_this->mMode = 11; - a_this->speedF = 0.0f; + i_this->mode = 11; + actor->speedF = 0.0f; } else { - if (i_this->field_0x5c4 > (fVar1 + 150.0f)) { + if (i_this->dis > (fVar1 + 150.0f)) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -5633,18 +5633,18 @@ static int npc_ks_mori(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - a_this->speedF = 0.0f; + i_this->mode = 10; + actor->speedF = 0.0f; } else { dPnt* pnt_p = i_this->field_0xc18->m_points; - pnt_p = &pnt_p[i_this->field_0x904]; - i_this->field_0x8f0.x = pnt_p->m_position.x; - i_this->field_0x8f0.y = pnt_p->m_position.y; - i_this->field_0x8f0.z = pnt_p->m_position.z; - i_this->mMode = 5; - a_this->speedF = l_HIO.guided_movement_speed * fVar2; + pnt_p = &pnt_p[i_this->path_no]; + i_this->guide_path.x = pnt_p->m_position.x; + i_this->guide_path.y = pnt_p->m_position.y; + i_this->guide_path.z = pnt_p->m_position.z; + i_this->mode = 5; + actor->speedF = l_HIO.guided_movement_speed * fVar2; - if (i_this->field_0x5d0 != 28) { + if (i_this->res_id != 28) { anm_init(i_this, 28, 6.0f, 2, 1.0f); } } @@ -5652,89 +5652,89 @@ static int npc_ks_mori(npc_ks_class* i_this) { break; case 5: - sp44.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp44.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp44.x, sp44.z); + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); - if (JMAFastSqrt(sp44.x * sp44.x + sp44.z * sp44.z) < 100.0f) { - i_this->field_0x904++; - i_this->mMode = 4; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 100.0f) { + i_this->path_no++; + i_this->mode = 4; } break; case 10: - if (i_this->field_0x5d0 == 7) { - i_this->field_0x8fc.y = i_this->field_0x5c8; + if (i_this->res_id == 7) { + i_this->current_angle.y = i_this->target_angle; } else { - i_this->field_0x8fc.y = i_this->field_0x5c8 + 0x8000; + i_this->current_angle.y = i_this->target_angle + 0x8000; } - if (i_this->field_0x5c4 < fVar1) { - i_this->mMode = 4; + if (i_this->dis < fVar1) { + i_this->mode = 4; } break; case 11: - if (i_this->field_0x5d0 == 7) { - i_this->field_0x8fc.y = i_this->field_0x5c8; + if (i_this->res_id == 7) { + i_this->current_angle.y = i_this->target_angle; } - sp44.x = -30900.0f - player->current.pos.x; - sp44.z = -15756.0f - player->current.pos.z; - if (JMAFastSqrt(sp44.x * sp44.x + sp44.z * sp44.z) < 1300.0f || i_this->field_0x5c4 < fVar1) { - i_this->field_0xb42 = 300; - i_this->mMode = 300; + mae.x = -30900.0f - player->current.pos.x; + mae.z = -15756.0f - player->current.pos.z; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < 1300.0f || i_this->dis < fVar1) { + i_this->demo_mode = 300; + i_this->mode = 300; } break; case 300: - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; break; case 301: - sp44.x = -31872.0f - a_this->current.pos.x; - sp44.z = -15490.0f - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp44.x, sp44.z); + mae.x = -31872.0f - actor->current.pos.x; + mae.z = -15490.0f - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); break; case 302: - a_this->current.pos.y = a_this->home.pos.y + 10000.0f; - a_this->speed.y = 0.0f; + actor->current.pos.y = actor->home.pos.y + 10000.0f; + actor->speed.y = 0.0f; break; case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; break; case 41: - if ((i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { + if ((i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43 && i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43 && i_this->model->isStop()) { + i_this->mode = 40; } break; case 50: anm_init(i_this, 46, 3.0f, 0, 1.0f); - i_this->mMode = 51; + i_this->mode = 51; break; case 51: - if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->model->isStop()) { + i_this->mode = 40; } break; case 53: - if (i_this->mTimers[0] == 0) { + if (i_this->timer[0] == 0) { if ((call_pt & 1) != 0) { anm_init(i_this, 8, 5.0f, 2, 1.0f); } else { @@ -5742,50 +5742,50 @@ static int npc_ks_mori(npc_ks_class* i_this) { } call_pt++; - i_this->mMode = 10; - i_this->mTimers[3] = 0; + i_this->mode = 10; + i_this->timer[3] = 0; } break; case 100: anm_init(i_this, 44, 3.0f, 2, 1.0f); - i_this->mMode = 101; - i_this->mTimers[0] = 80; + i_this->mode = 101; + i_this->timer[0] = 80; break; case 101: - if (i_this->mTimers[0] == 0) { - i_this->mMode = 4; - i_this->mTimers[3] = l_HIO.lantern_swing_interval * 30.0f; + if (i_this->timer[0] == 0) { + i_this->mode = 4; + i_this->timer[3] = l_HIO.lantern_swing_interval * 30.0f; } break; } - if (i_this->mMode != 11 && i_this->mMode > 3 && i_this->mMode < 40 && (i_this->mTimers[3] == 0 || dComIfGs_shake_kandelaar_check() == 1)) { - i_this->mMode = 100; - a_this->speedF = 0.0f; + if (i_this->mode != 11 && i_this->mode > 3 && i_this->mode < 40 && (i_this->timer[3] == 0 || dComIfGs_shake_kandelaar_check() == 1)) { + i_this->mode = 100; + actor->speedF = 0.0f; } - if (i_this->mMode >= 40 && i_this->mMode <= 52) { + if (i_this->mode >= 40 && i_this->mode <= 52) { fopAc_ac_c* enemy_p = enemy_check(i_this, 800.0f); if (enemy_p == NULL) { - i_this->mMode = 53; - i_this->mTimers[0] = 30; + i_this->mode = 53; + i_this->timer[0] = 30; } } else { fopAc_ac_c* enemy_p = enemy_view_check(i_this, 400.0f); if (enemy_p != NULL) { - i_this->mMode = 50; - a_this->speedF = 0.0f; - sp44.x = enemy_p->current.pos.x - a_this->current.pos.x; - sp44.z = enemy_p->current.pos.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp44.x, sp44.z) + 0x8000; + i_this->mode = 50; + actor->speedF = 0.0f; + mae.x = enemy_p->current.pos.x - actor->current.pos.x; + mae.z = enemy_p->current.pos.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z) + 0x8000; } } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 2, 0x1000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 2, 0x1000); - s16 sVar1 = a_this->current.angle.y - i_this->field_0x8fc.y; + s16 sVar1 = actor->current.angle.y - i_this->current_angle.y; if (sVar1 > 0x1000 || sVar1 < -0x1000) { rv = 0; } @@ -5804,56 +5804,56 @@ static path guide_path_fs[7] = { }; static int npc_ks_fsdemo(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = (fopAc_ac_c*) dComIfGp_getPlayer(0); - cXyz sp2c, sp38; + cXyz mae, ato; int rv = 1; - int frame = i_this->mpModelMorf->getFrame(); + int frame = i_this->model->getFrame(); int iVar1 = 0; s16 sVar1 = 0x1000; - s16 sVar2; + s16 range; i_this->field_0x5fc = 0; i_this->field_0xaec = 1; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[0x220])) { - i_this->mMode = 40; + i_this->mode = 40; } else { fpcM_Search(s_fs_sub, i_this); - a_this->current.pos.set(-39906.0f, 21962.0f, -24243.0f); + actor->current.pos.set(-39906.0f, 21962.0f, -24243.0f); rv = 0; if (player->current.pos.z < -21000.0f) { - i_this->mMode = 1; - a_this->current.pos.set(-39906.0f, 1962.0f, -24243.0f); + i_this->mode = 1; + actor->current.pos.set(-39906.0f, 1962.0f, -24243.0f); anm_init(i_this, 26, 3.0f, 2, 1.0f); - i_this->field_0x904 = 0; - a_this->speedF = 0.0f; - i_this->field_0xb42 = 350; + i_this->path_no = 0; + actor->speedF = 0.0f; + i_this->demo_mode = 350; mDoAud_seStart(Z2SE_KOSARU_V_PRISONED, 0, 0, 0); } } break; case 1: - if (guide_path_fs[i_this->field_0x904].field_0x0 != 0) { - i_this->field_0x8f0.x = guide_path_fs[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.y = guide_path_fs[i_this->field_0x904].field_0x8; - i_this->field_0x8f0.z = guide_path_fs[i_this->field_0x904].field_0xc; - i_this->field_0x910 = a_this->current.pos; - i_this->field_0x91c = i_this->field_0x8f0; - i_this->mMode = 2; + if (guide_path_fs[i_this->path_no].field_0x0 != 0) { + i_this->guide_path.x = guide_path_fs[i_this->path_no].field_0x4; + i_this->guide_path.y = guide_path_fs[i_this->path_no].field_0x8; + i_this->guide_path.z = guide_path_fs[i_this->path_no].field_0xc; + i_this->field_0x910 = actor->current.pos; + i_this->field_0x91c = i_this->guide_path; + i_this->mode = 2; anm_init(i_this, 32, 2.0f, 0, 1.0f); - a_this->speedF = 0.0f; + actor->speedF = 0.0f; } else { - i_this->field_0x8f0.x = guide_path_fs[i_this->field_0x904].field_0x4; - i_this->field_0x8f0.z = guide_path_fs[i_this->field_0x904].field_0xc; - i_this->mMode = 5; - a_this->speedF = l_HIO.demo_speed_2; + i_this->guide_path.x = guide_path_fs[i_this->path_no].field_0x4; + i_this->guide_path.z = guide_path_fs[i_this->path_no].field_0xc; + i_this->mode = 5; + actor->speedF = l_HIO.demo_speed_2; - if (i_this->field_0x5d0 != 26) { + if (i_this->res_id != 26) { anm_init(i_this, 26, 3.0f, 2, 1.0f); } } @@ -5861,86 +5861,86 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) { case 2: rv = 2; - if (i_this->field_0x5d0 == 32 && i_this->mpModelMorf->isStop()) { + if (i_this->res_id == 32 && i_this->model->isStop()) { anm_init(i_this, 33, 1.0f, 0, 1.0f); - a_this->speedF = 40.0f + TREG_F(9); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); + actor->speedF = 40.0f + TREG_F(9); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_WIND, 0, -1); i_this->field_0xbe0 = 1; } - sp2c = i_this->field_0x8f0 - a_this->current.pos; - i_this->field_0x8fc.y = cM_atan2s(sp2c.x, sp2c.z); - i_this->field_0x8fc.x = -cM_atan2s(sp2c.y, JMAFastSqrt(sp2c.x * sp2c.x + sp2c.z * sp2c.z)); + mae = i_this->guide_path - actor->current.pos; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); + i_this->current_angle.x = -cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); - if (sp2c.abs() < a_this->speedF * 1.2f) { - a_this->current.pos = i_this->field_0x8f0; + if (mae.abs() < actor->speedF * 1.2f) { + actor->current.pos = i_this->guide_path; - if (i_this->field_0x904 == 0) { + if (i_this->path_no == 0) { anm_init(i_this, 45, 3.0f, 0, 1.0f); - i_this->mMode = 3; - i_this->field_0x8fc.y += 0x8000; - a_this->speedF = 0.0f; + i_this->mode = 3; + i_this->current_angle.y += 0x8000; + actor->speedF = 0.0f; } else { - i_this->mMode = 1; + i_this->mode = 1; } i_this->field_0xbe0 = 1; - i_this->field_0x904++; + i_this->path_no++; } break; case 3: - if (i_this->mpModelMorf->isStop()) { - i_this->field_0x8fc.y += 0x8000; - i_this->mMode = 1; + if (i_this->model->isStop()) { + i_this->current_angle.y += 0x8000; + i_this->mode = 1; } break; case 5: - sp2c.x = i_this->field_0x8f0.x - a_this->current.pos.x; - sp2c.z = i_this->field_0x8f0.z - a_this->current.pos.z; - i_this->field_0x8fc.y = cM_atan2s(sp2c.x, sp2c.z); + mae.x = i_this->guide_path.x - actor->current.pos.x; + mae.z = i_this->guide_path.z - actor->current.pos.z; + i_this->current_angle.y = cM_atan2s(mae.x, mae.z); - if (JMAFastSqrt(sp2c.x * sp2c.x + sp2c.z * sp2c.z) < a_this->speedF * 1.2f) { - i_this->field_0x904++; - i_this->mMode = 1; + if (JMAFastSqrt(mae.x * mae.x + mae.z * mae.z) < actor->speedF * 1.2f) { + i_this->path_no++; + i_this->mode = 1; - if (guide_path_fs[i_this->field_0x904].field_0x0 < 0) { - i_this->mMode = 10; - a_this->speedF = 0.0f; + if (guide_path_fs[i_this->path_no].field_0x0 < 0) { + i_this->mode = 10; + actor->speedF = 0.0f; anm_init(i_this, 51, 5.0f, 2, 1.0f); } } break; case 10: - a_this->speedF = 0.0f; + actor->speedF = 0.0f; break; case 20: - i_this->mMode = 21; + i_this->mode = 21; anm_init(i_this, 51, 10.0f, 2, 1.0f); // fallthrough case 21: { - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; sVar1 = 0; i_this->field_0x5fc = 1; - if (i_this->mTimers[2] != 0) { - i_this->field_0x93c = 10; - i_this->field_0x940.set(-37799.0f, 815.0f, -22323.0f); - i_this->field_0x8fc.y -= (s16) 0x3000; + if (i_this->timer[2] != 0) { + i_this->search_time = 10; + i_this->find_pos.set(-37799.0f, 815.0f, -22323.0f); + i_this->current_angle.y -= (s16) 0x3000; sVar1 = 0x800; } iVar1 = 1; - sVar2 = a_this->current.angle.y - i_this->field_0x5c8; - if ((sVar2 > 0x3000 || sVar2 < -0x3000) && i_this->mMode < 22) { + range = actor->current.angle.y - i_this->target_angle; + if ((range > 0x3000 || range < -0x3000) && i_this->mode < 22) { anm_init(i_this, 28, 3.0f, 0, 1.0f); - i_this->mMode = 22; - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); + i_this->mode = 22; + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); } break; @@ -5948,68 +5948,68 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) { case 22: sVar1 = 0x800; - i_this->field_0x8fc.y = i_this->field_0x5c8; + i_this->current_angle.y = i_this->target_angle; if (frame >= 11) { - i_this->mMode = 20; + i_this->mode = 20; } break; case 40: anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mMode = 41; - i_this->mTimers[0] = cM_rndF(80.0f) + 100.0f; + i_this->mode = 41; + i_this->timer[0] = cM_rndF(80.0f) + 100.0f; break; case 41: - if ((i_this->field_0x5d0 == 39 || (i_this->field_0x5d0 == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { + if ((i_this->res_id == 39 || (i_this->res_id == 43 && frame < 7) || (frame > 40 && frame < 48)) || frame > 65) { i_this->field_0x5e0 = 4; } - if (i_this->mTimers[0] == 0 && i_this->field_0x5d0 == 39) { + if (i_this->timer[0] == 0 && i_this->res_id == 39) { anm_init(i_this, 43, 5.0f, 0, 1.0f); } - if (i_this->field_0x5d0 == 43) { - if (i_this->field_0xb42 >= 360 && i_this->mpModelMorf->checkFrame(57.0f)) { - i_this->mMode = 20; - } else if (i_this->mpModelMorf->isStop()) { - i_this->mMode = 40; + if (i_this->res_id == 43) { + if (i_this->demo_mode >= 360 && i_this->model->checkFrame(57.0f)) { + i_this->mode = 20; + } else if (i_this->model->isStop()) { + i_this->mode = 40; } } break; case 42: - if (i_this->mTimers[1] == 1) { - i_this->field_0xb42 = 360; + if (i_this->timer[1] == 1) { + i_this->demo_mode = 360; } } - if ((i_this->mMode == 40 || i_this->mMode == 41) && fopAcM_SearchByName(PROC_E_FS) == NULL && i_this->field_0xb42 == 0) { - i_this->mMode = 42; - i_this->mTimers[1] = 30; + if ((i_this->mode == 40 || i_this->mode == 41) && fopAcM_SearchByName(PROC_E_FS) == NULL && i_this->demo_mode == 0) { + i_this->mode = 42; + i_this->timer[1] = 30; } - if (a_this->speedF > 25.0f) { + if (actor->speedF > 25.0f) { i_this->field_0x90c = 1; } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x8fc.y, 2, sVar1); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->current_angle.y, 2, sVar1); if (iVar1 != 0) { - fopAcM_OnStatus(a_this, 0); - cLib_onBit(a_this->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); - a_this->eventInfo.onCondition(dEvtCnd_CANTALK_e); + fopAcM_OnStatus(actor, 0); + cLib_onBit(actor->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); + actor->eventInfo.onCondition(dEvtCnd_CANTALK_e); // TODO: gameInfo fake match to force reuse of pointer dComIfG_play_c* play = &g_dComIfG_gameInfo.play; if (play->getEvent().runCheck()) { - if (a_this->eventInfo.checkCommandTalk()) { + if (actor->eventInfo.checkCommandTalk()) { if (i_this->field_0xaee == 0) { - i_this->mMsgFlow.init(a_this, 0x74, 0, NULL); + i_this->msg_flow.init(actor, 0x74, 0, NULL); i_this->field_0xaee = 1; } - if (i_this->mMsgFlow.doFlow(a_this, NULL, 0)) { + if (i_this->msg_flow.doFlow(actor, NULL, 0)) { play->getEvent().reset(); i_this->field_0xaee = 0; } @@ -6018,8 +6018,8 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) { i_this->field_0xaee = 0; } } else { - fopAcM_OffStatus(a_this, 0); - cLib_offBit(a_this->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); + fopAcM_OffStatus(actor, 0); + cLib_offBit(actor->attention_info.flags, fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); i_this->field_0xaee = 0; } @@ -6027,196 +6027,196 @@ static int npc_ks_fsdemo(npc_ks_class* i_this) { } static void npc_ks_kago(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; i_this->field_0x5fc = 0; - switch (i_this->mMode) { + switch (i_this->mode) { case 0: anm_init(i_this, 34, 3.0f, 2, 1.0f); - i_this->mMode = 1; + i_this->mode = 1; // fallthrough case 1: break; } - cLib_addCalcAngleS2(&a_this->current.angle.y, i_this->field_0x5c8, 2, 0x2000); + cLib_addCalcAngleS2(&actor->current.angle.y, i_this->target_angle, 2, 0x2000); i_this->field_0xaec = 0; /* dSv_event_flag_c::F_0577 - Ordon Village - 2nd Day - Retrieved basket from monkey (hit hawk) */ if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[0x241])) { - fopAcM_delete(a_this); + fopAcM_delete(actor); } } static void anm_se_set(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; - if (i_this->field_0x5d0 == 17) { - if (i_this->mpModelMorf->checkFrame(1.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_WAIT, -1); + if (i_this->res_id == 17) { + if (i_this->model->checkFrame(1.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WAIT, -1); } - if (i_this->mpModelMorf->checkFrame(5.0f) || i_this->mpModelMorf->checkFrame(16.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); + if (i_this->model->checkFrame(5.0f) || i_this->model->checkFrame(16.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); } - } else if (i_this->field_0x5d0 == 55) { - if (i_this->mpModelMorf->checkFrame(9.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); + } else if (i_this->res_id == 55) { + if (i_this->model->checkFrame(9.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); } - } else if (i_this->field_0x5d0 == 11) { - if (i_this->mpModelMorf->checkFrame(10.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); + } else if (i_this->res_id == 11) { + if (i_this->model->checkFrame(10.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); } - } else if (i_this->field_0x5d0 == 56) { - if (i_this->mpModelMorf->checkFrame(1.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_DELIGHT, -1); + } else if (i_this->res_id == 56) { + if (i_this->model->checkFrame(1.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_DELIGHT, -1); } - if (i_this->mpModelMorf->checkFrame(24.0f) || i_this->mpModelMorf->checkFrame(11.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); + if (i_this->model->checkFrame(24.0f) || i_this->model->checkFrame(11.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_HAND_CLAP, 0, -1); } - } else if (i_this->field_0x5d0 == 12) { - if (i_this->mpModelMorf->checkFrame(3.0f) || i_this->mpModelMorf->checkFrame(10.0f)) { - if (fopAcM_GetRoomNo(a_this) == 22) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_FT_TSUTA, 0, -1); + } else if (i_this->res_id == 12) { + if (i_this->model->checkFrame(3.0f) || i_this->model->checkFrame(10.0f)) { + if (fopAcM_GetRoomNo(actor) == 22) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_FT_TSUTA, 0, -1); } else { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_CLIMB, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_CLIMB, 0, -1); } } - } else if (i_this->field_0x5d0 == 15) { - if (i_this->mpModelMorf->checkFrame(3.0f) || i_this->mpModelMorf->checkFrame(10.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_CLIMB, 0, -1); + } else if (i_this->res_id == 15) { + if (i_this->model->checkFrame(3.0f) || i_this->model->checkFrame(10.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_CLIMB, 0, -1); } - } else if (i_this->field_0x5d0 == 25) { - if (i_this->mpModelMorf->checkFrame(19.0f) || i_this->mpModelMorf->checkFrame(36.0f) || i_this->mpModelMorf->checkFrame(54.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); + } else if (i_this->res_id == 25) { + if (i_this->model->checkFrame(19.0f) || i_this->model->checkFrame(36.0f) || i_this->model->checkFrame(54.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); } - } else if (i_this->field_0x5d0 == 26) { - if (i_this->mpModelMorf->checkFrame(1.0f) && i_this->field_0xc17 == 2) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); + } else if (i_this->res_id == 26) { + if (i_this->model->checkFrame(1.0f) && i_this->field_0xc17 == 2) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); } - if (i_this->mpModelMorf->checkFrame(2.0f)) { - if (i_this->mActionID == 203 && i_this->mMode <= 3) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_FT_BRIDGE, 0, -1); + if (i_this->model->checkFrame(2.0f)) { + if (i_this->action == 203 && i_this->mode <= 3) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_FT_BRIDGE, 0, -1); } else { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_FOOTNOTE, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_FOOTNOTE, 0, -1); if (i_this->field_0xc17 == 2) { mDoAud_seStart(Z2SE_KOSARU_KANTERA_SWING, &i_this->field_0xc04, 0, 0); } } } - } else if (i_this->field_0x5d0 == 28) { - if (i_this->mpModelMorf->checkFrame(1.0f) && i_this->field_0xc17 == 2) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); + } else if (i_this->res_id == 28) { + if (i_this->model->checkFrame(1.0f) && i_this->field_0xc17 == 2) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); } - if (i_this->mpModelMorf->checkFrame(2.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_FOOTNOTE, 0, -1); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); + if (i_this->model->checkFrame(2.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_FOOTNOTE, 0, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_WALK, -1); if (i_this->field_0xc17 == 2) { mDoAud_seStart(Z2SE_KOSARU_KANTERA_SWING, &i_this->field_0xc04, 0, 0); } } - } else if (i_this->field_0x5d0 == 43) { - if (i_this->mpModelMorf->checkFrame(5.0f) || i_this->mpModelMorf->checkFrame(47.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_SCARED, -1); + } else if (i_this->res_id == 43) { + if (i_this->model->checkFrame(5.0f) || i_this->model->checkFrame(47.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_SCARED, -1); } - } else if (i_this->field_0x5d0 == 39) { - if (i_this->mpModelMorf->checkFrame(1.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_SCARED, -1); + } else if (i_this->res_id == 39) { + if (i_this->model->checkFrame(1.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_SCARED, -1); } - } else if (i_this->field_0x5d0 == 30) { - if (i_this->mpModelMorf->checkFrame(4.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - } else if (i_this->mpModelMorf->checkFrame(22.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + } else if (i_this->res_id == 30) { + if (i_this->model->checkFrame(4.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + } else if (i_this->model->checkFrame(22.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); } - } else if (i_this->field_0x5d0 == 5) { - if (i_this->mpModelMorf->checkFrame(4.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - } else if (i_this->mpModelMorf->checkFrame(22.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + } else if (i_this->res_id == 5) { + if (i_this->model->checkFrame(4.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + } else if (i_this->model->checkFrame(22.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); } - } else if (i_this->field_0x5d0 == 7) { - if (i_this->mpModelMorf->checkFrame(8.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); - } else if (i_this->mpModelMorf->checkFrame(17.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + } else if (i_this->res_id == 7) { + if (i_this->model->checkFrame(8.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_START, 0, -1); + } else if (i_this->model->checkFrame(17.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); if (i_this->field_0xc17 == 2) { mDoAud_seStart(Z2SE_KOSARU_KANTERA_ADD, &i_this->field_0xc04, 0, 0); } } - } else if (i_this->field_0x5d0 == 8) { - if (i_this->mpModelMorf->checkFrame(1.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_CALL, -1); + } else if (i_this->res_id == 8) { + if (i_this->model->checkFrame(1.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_CALL, -1); } - } else if (i_this->field_0x5d0 == 44) { - if (i_this->mpModelMorf->checkFrame(9.0f) || i_this->mpModelMorf->checkFrame(19.0f)) { + } else if (i_this->res_id == 44) { + if (i_this->model->checkFrame(9.0f) || i_this->model->checkFrame(19.0f)) { mDoAud_seStart(Z2SE_KOSARU_KANTERA_SWING, &i_this->field_0xc04, 0, 0); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_SWING_KANTERA, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_SWING_KANTERA, -1); } - } else if (i_this->field_0x5d0 == 35) { - if (i_this->mpModelMorf->checkFrame(40.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_SLAPPED_HIP, -1); + } else if (i_this->res_id == 35) { + if (i_this->model->checkFrame(40.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_SLAPPED_HIP, -1); } - } else if (i_this->field_0x5d0 == 16) { - if (i_this->mpModelMorf->checkFrame(1.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_CALL, -1); + } else if (i_this->res_id == 16) { + if (i_this->model->checkFrame(1.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_CALL, -1); } - } else if (i_this->field_0x5d0 == 46) { - if (i_this->mpModelMorf->checkFrame(4.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP_SURPRISE, -1); - } else if (i_this->mpModelMorf->checkFrame(18.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); - } else if ((i_this->mpModelMorf->checkFrame(25.0f) || i_this->mpModelMorf->checkFrame(38.0f)) || i_this->mpModelMorf->checkFrame(51.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); + } else if (i_this->res_id == 46) { + if (i_this->model->checkFrame(4.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP_SURPRISE, -1); + } else if (i_this->model->checkFrame(18.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + } else if ((i_this->model->checkFrame(25.0f) || i_this->model->checkFrame(38.0f)) || i_this->model->checkFrame(51.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_POINT, -1); mDoAud_seStart(Z2SE_KOSARU_KANTERA_SWING, &i_this->field_0xc04, 0, 0); } - } else if (i_this->field_0x5d0 == 34) { - if (i_this->mpModelMorf->checkFrame(1.0f)) { - f32 fVar1 = i_this->field_0x5c4 * 0.0215f; + } else if (i_this->res_id == 34) { + if (i_this->model->checkFrame(1.0f)) { + f32 fVar1 = i_this->dis * 0.0215f; if (fVar1 > 127.0f) { fVar1 = 127.0f; } - i_this->mSound.startCreatureSound(Z2SE_KOSARU_V_KAGO_WAIT, fVar1, -1); - } else if (i_this->mpModelMorf->checkFrame(16.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + i_this->sound.startCreatureSound(Z2SE_KOSARU_V_KAGO_WAIT, fVar1, -1); + } else if (i_this->model->checkFrame(16.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); } - } else if (i_this->field_0x5d0 == 45) { - if (i_this->mpModelMorf->checkFrame(4.0f)) { - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP_SURPRISE, -1); - } else if (i_this->mpModelMorf->checkFrame(16.0f)) { - i_this->mSound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); + } else if (i_this->res_id == 45) { + if (i_this->model->checkFrame(4.0f)) { + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP_SURPRISE, -1); + } else if (i_this->model->checkFrame(16.0f)) { + i_this->sound.startCreatureSound(Z2SE_KOSARU_JUMP_END, 0, -1); } } } static void action(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); - cXyz sp44, sp50; + cXyz mae, ato; - fopAcM_OffStatus(a_this, 0); - cLib_offBit(a_this->attention_info.flags, fopAc_AttnFlag_TALKCHECK_e | fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); + fopAcM_OffStatus(actor, 0); + cLib_offBit(actor->attention_info.flags, fopAc_AttnFlag_TALKCHECK_e | fopAc_AttnFlag_SPEAK_e | fopAc_AttnFlag_TALK_e); if (i_this->field_0x5b5 != 0) { - sp44 = player->eyePos - i_this->field_0x614; - i_this->field_0x5c4 = sp44.abs(); - cLib_addCalcAngleS2(&a_this->current.angle.x, -0x8000, 1, 0x1000); + mae = player->eyePos - i_this->field_0x614; + i_this->dis = mae.abs(); + cLib_addCalcAngleS2(&actor->current.angle.x, -0x8000, 1, 0x1000); } else { - i_this->field_0x5c4 = fopAcM_searchPlayerDistanceXZ(a_this); + i_this->dis = fopAcM_searchPlayerDistanceXZ(actor); } - i_this->field_0x5c8 = fopAcM_searchPlayerAngleY(a_this); + i_this->target_angle = fopAcM_searchPlayerAngleY(actor); i_this->field_0x5fc = 0; i_this->field_0xaed = 0; i_this->field_0x5b5 = 0; @@ -6226,11 +6226,11 @@ static void action(npc_ks_class* i_this) { int int_0x2c = 1; int iVar3 = 0; - a_this->gravity = -5.0f; + actor->gravity = -5.0f; - switch (i_this->mActionID) { + switch (i_this->action) { case 4: - a_this->gravity = 0.0f; + actor->gravity = 0.0f; npc_ks_pole_ori(i_this); i_this->field_0x5fc = 1; iVar1 = 0; @@ -6245,7 +6245,7 @@ static void action(npc_ks_class* i_this) { break; case 6: - a_this->gravity = 0.0f; + actor->gravity = 0.0f; i_this->field_0x5fc = 1; iVar2 = npc_ks_ori2(i_this); break; @@ -6256,7 +6256,7 @@ static void action(npc_ks_class* i_this) { break; case 10: - a_this->gravity = 0.0f; + actor->gravity = 0.0f; npc_ks_hang(i_this); i_this->field_0x5fc = 2; i_this->field_0x5b5 = 1; @@ -6265,7 +6265,7 @@ static void action(npc_ks_class* i_this) { break; case 11: - a_this->gravity = 0.0f; + actor->gravity = 0.0f; npc_ks_hang_s(i_this); i_this->field_0x5fc = 2; i_this->field_0x5b5 = 1; @@ -6274,13 +6274,13 @@ static void action(npc_ks_class* i_this) { break; case 20: - a_this->gravity = 0.0f; + actor->gravity = 0.0f; npc_ks_to_hang(i_this); iVar2 = 2; break; case 21: - a_this->gravity = 0.0f; + actor->gravity = 0.0f; npc_ks_e_hang(i_this); i_this->field_0x5fc = 3; i_this->field_0x5b5 = 1; @@ -6293,47 +6293,47 @@ static void action(npc_ks_class* i_this) { break; case 100: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar3 = 1; if (checkDoorDemo()) { - if (i_this->mMode >= 7) { - i_this->mMode = 0; + if (i_this->mode >= 7) { + i_this->mode = 0; } - cLib_addCalc2(&a_this->current.pos.y, player->current.pos.y, 1.0f, 100.0f); + cLib_addCalc2(&actor->current.pos.y, player->current.pos.y, 1.0f, 100.0f); - if (i_this->field_0x5c4 > 400.0f) { - cMtx_YrotS(*calc_mtx, i_this->field_0x5c8); - sp44.x = 0.0f; - sp44.y = 0.0f; - sp44.z = -300.0f; - MtxPosition(&sp44, &sp50); - a_this->current.pos.x = player->current.pos.x + sp50.x; - a_this->current.pos.z = player->current.pos.z + sp50.z; + if (i_this->dis > 400.0f) { + cMtx_YrotS(*calc_mtx, i_this->target_angle); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = -300.0f; + MtxPosition(&mae, &ato); + actor->current.pos.x = player->current.pos.x + ato.x; + actor->current.pos.z = player->current.pos.z + ato.z; } iVar1 = 0; - a_this->speed.y = 0.0f; - int roomNo = fopAcM_GetRoomNo(a_this); + actor->speed.y = 0.0f; + int room_no = fopAcM_GetRoomNo(actor); #if VERSION == VERSION_SHIELD_DEBUG - int nextStayNo = dStage_roomControl_c::getNextStayNo(); + int stay_no = dStage_roomControl_c::getNextStayNo(); #else // FIXME: fakematch. dbg asm implies that return value of getNextStayNo() must be int. // However, changing its return from s8 to int causes regalloc issue here. // Thus, use mNextStayNo directly here. - int nextStayNo = dStage_roomControl_c::mNextStayNo; + int stay_no = dStage_roomControl_c::mNextStayNo; #endif - if (roomNo != nextStayNo) { - if ( (roomNo == 0 && nextStayNo == 3) - || (roomNo == 3 && nextStayNo == 4) - || (dComIfGs_isSwitch(0x52, fopAcM_GetRoomNo(a_this)) && roomNo == 4 && nextStayNo == 0) - || ((i_this->field_0x5b6 == 2 || i_this->field_0x5b6 == 3) && roomNo == 0 && nextStayNo == 15) - || (roomNo == 1 && nextStayNo == 4) - || (roomNo == 0 && nextStayNo == 1 && i_this->field_0x5b6 >= 2) - || (roomNo == 9 && nextStayNo != 12) + if (room_no != stay_no) { + if ( (room_no == 0 && stay_no == 3) + || (room_no == 3 && stay_no == 4) + || (dComIfGs_isSwitch(0x52, fopAcM_GetRoomNo(actor)) && room_no == 4 && stay_no == 0) + || ((i_this->set_id == 2 || i_this->set_id == 3) && room_no == 0 && stay_no == 15) + || (room_no == 1 && stay_no == 4) + || (room_no == 0 && stay_no == 1 && i_this->set_id >= 2) + || (room_no == 9 && stay_no != 12) ) { - i_this->mActionID = 101; - i_this->mMode = 0; + i_this->action = 101; + i_this->mode = 0; break; } } @@ -6342,59 +6342,59 @@ static void action(npc_ks_class* i_this) { } iVar2 = npc_ks_option(i_this); - fopAcM_SetRoomNo(a_this, fopAcM_GetRoomNo(player)); - a_this->tevStr.room_no = fopAcM_GetRoomNo(a_this); + fopAcM_SetRoomNo(actor, fopAcM_GetRoomNo(player)); + actor->tevStr.room_no = fopAcM_GetRoomNo(actor); break; case 101: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; npc_ks_awaydoor(i_this); break; case 110: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_00(i_this); iVar3 = 1; break; case 111: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_00_2(i_this); iVar3 = 1; break; case 112: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_00_3(i_this); iVar3 = 1; break; case 113: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_01(i_this); iVar3 = 1; break; case 114: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_02(i_this); iVar3 = 1; break; case 115: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_09(i_this); iVar3 = 1; break; case 116: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_22(i_this); iVar3 = 1; break; case 117: - a_this->gravity = -5.0f; + actor->gravity = -5.0f; iVar2 = npc_ks_guide_0409(i_this); iVar3 = 1; break; @@ -6437,83 +6437,83 @@ static void action(npc_ks_class* i_this) { i_this->field_0xbdd = 0; if (iVar3 != 0) { - if (water_check(i_this, a_this->current.pos, 60.0f + TREG_F(19))) { - if (a_this->current.pos.y <= i_this->field_0x63c) { + if (water_check(i_this, actor->current.pos, 60.0f + TREG_F(19))) { + if (actor->current.pos.y <= i_this->waterY) { i_this->field_0xbdd = 1; - if (i_this->mActionID != 100) { - i_this->mActionID = 100; - i_this->mMode = 0; + if (i_this->action != 100) { + i_this->action = 100; + i_this->mode = 0; } } } } - if (int_0x2c && i_this->field_0x5c4 < 500.0f + KREG_F(15) && NPC_KS_FABSF(a_this->current.pos.y - player->current.pos.y) < 1000.0f) { - daPy_py_c::setLookPos(&a_this->eyePos); + if (int_0x2c && i_this->dis < 500.0f + KREG_F(15) && NPC_KS_FABSF(actor->current.pos.y - player->current.pos.y) < 1000.0f) { + daPy_py_c::setLookPos(&actor->eyePos); } - if (i_this->field_0xaed == 1 && i_this->field_0x5c4 < 300.0f) { - i_this->mActionID = 1000; - i_this->mMode = 0; + if (i_this->field_0xaed == 1 && i_this->dis < 300.0f) { + i_this->action = 1000; + i_this->mode = 0; } - cLib_addCalcAngleS2(&a_this->shape_angle.y, a_this->current.angle.y, 2, 0x2000); - cLib_addCalcAngleS2(&a_this->shape_angle.x, a_this->current.angle.x, 2, 0x2000); - cLib_addCalcAngleS2(&a_this->shape_angle.z, a_this->current.angle.z, 2, 0x2000); + cLib_addCalcAngleS2(&actor->shape_angle.y, actor->current.angle.y, 2, 0x2000); + cLib_addCalcAngleS2(&actor->shape_angle.x, actor->current.angle.x, 2, 0x2000); + cLib_addCalcAngleS2(&actor->shape_angle.z, actor->current.angle.z, 2, 0x2000); if (iVar2 == 1) { f32 fVar1 = 1.0f; - if (i_this->field_0x5d0 == 47 && fopAcM_CheckCondition(a_this, 4) != 0) { + if (i_this->res_id == 47 && fopAcM_CheckCondition(actor, 4) != 0) { fVar1 = 10.0f + KREG_F(13); } - cMtx_YrotS(*calc_mtx, a_this->current.angle.y); - sp44.x = 0.0f; - sp44.y = 0.0f; - sp44.z = a_this->speedF * fVar1; - MtxPosition(&sp44, &sp50); + cMtx_YrotS(*calc_mtx, actor->current.angle.y); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = actor->speedF * fVar1; + MtxPosition(&mae, &ato); - a_this->speed.x = sp50.x; - a_this->speed.z = sp50.z; - a_this->current.pos += a_this->speed; - a_this->speed.y += a_this->gravity; + actor->speed.x = ato.x; + actor->speed.z = ato.z; + actor->current.pos += actor->speed; + actor->speed.y += actor->gravity; - if (a_this->speed.y < -90.0f) { - a_this->speed.y = -90.0f; + if (actor->speed.y < -90.0f) { + actor->speed.y = -90.0f; } } else if (iVar2 == 2) { - cMtx_YrotS(*calc_mtx, i_this->field_0x8fc.y); - cMtx_XrotM(*calc_mtx, i_this->field_0x8fc.x); - sp44.x = 0.0f; - sp44.y = 0.0f; - sp44.z = a_this->speedF; - MtxPosition(&sp44, &a_this->speed); - a_this->current.pos += a_this->speed; + cMtx_YrotS(*calc_mtx, i_this->current_angle.y); + cMtx_XrotM(*calc_mtx, i_this->current_angle.x); + mae.x = 0.0f; + mae.y = 0.0f; + mae.z = actor->speedF; + MtxPosition(&mae, &actor->speed); + actor->current.pos += actor->speed; iVar1 = 0; } if (i_this->field_0xaec == 1) { - cXyz* move_p = i_this->mStts.GetCCMoveP(); + cXyz* move_p = i_this->stts.GetCCMoveP(); if (move_p != NULL) { - a_this->current.pos.x += move_p->x * 0.5f; - a_this->current.pos.y += move_p->y * 0.5f; - a_this->current.pos.z += move_p->z * 0.5f; + actor->current.pos.x += move_p->x * 0.5f; + actor->current.pos.y += move_p->y * 0.5f; + actor->current.pos.z += move_p->z * 0.5f; } } if (iVar1 != 0) { - if (a_this->shape_angle.x < -1000) { - f32 fVar2 = (30.0f + ZREG_F(3)) * cM_ssin(a_this->shape_angle.x); - a_this->current.pos.y += fVar2; - a_this->old.pos.y += fVar2; + if (actor->shape_angle.x < -1000) { + f32 fVar2 = (30.0f + ZREG_F(3)) * cM_ssin(actor->shape_angle.x); + actor->current.pos.y += fVar2; + actor->old.pos.y += fVar2; - i_this->mObjAcch.CrrPos(dComIfG_Bgsp()); + i_this->ObjAcch.CrrPos(dComIfG_Bgsp()); - a_this->current.pos.y -= fVar2; - a_this->old.pos.y -= fVar2; + actor->current.pos.y -= fVar2; + actor->old.pos.y -= fVar2; } else { - i_this->mObjAcch.CrrPos(dComIfG_Bgsp()); + i_this->ObjAcch.CrrPos(dComIfG_Bgsp()); } } @@ -6521,39 +6521,39 @@ static void action(npc_ks_class* i_this) { s16 sVar2 = 0; if (i_this->field_0x5fc != 0) { - if (i_this->field_0x93c == 0) { - if ((i_this->field_0x5e6 & 7U) == 0 && fopAcM_otoCheck(a_this, 2000.0f)) { + if (i_this->search_time == 0) { + if ((i_this->count & 7U) == 0 && fopAcM_otoCheck(actor, 2000.0f)) { SND_INFLUENCE* sound = dKy_Sound_get(); - i_this->field_0x940 = sound->position; - i_this->field_0x93c = cM_rndF(20.0f) + 30.0f; + i_this->find_pos = sound->position; + i_this->search_time = cM_rndF(20.0f) + 30.0f; } - fopAc_ac_c* player_o_p = (fopAc_ac_c*) dComIfGp_getPlayer(0); - if (i_this->field_0x938 != -1) { - fopAc_ac_c* actor_p = fopAcM_SearchByID(i_this->field_0x938); + fopAc_ac_c* player = (fopAc_ac_c*) dComIfGp_getPlayer(0); + if (i_this->search_id != -1) { + fopAc_ac_c* actor_p = fopAcM_SearchByID(i_this->search_id); if (actor_p != NULL) { - sp44 = actor_p->eyePos - a_this->current.pos; + mae = actor_p->eyePos - actor->current.pos; } else { - sp44 = player_o_p->eyePos - a_this->current.pos; + mae = player->eyePos - actor->current.pos; } } else { - sp44 = player_o_p->eyePos - a_this->current.pos; - sp44.y += TREG_F(1) - 70.0f; + mae = player->eyePos - actor->current.pos; + mae.y += TREG_F(1) - 70.0f; } } else { - i_this->field_0x93c--; - if (i_this->field_0x93c < 40) { - sp44 = i_this->field_0x940 - a_this->current.pos; - sp44.y += 100.0f; + i_this->search_time--; + if (i_this->search_time < 40) { + mae = i_this->find_pos - actor->current.pos; + mae.y += 100.0f; } else { - sp44 = player->eyePos - a_this->current.pos; - sp44.y += TREG_F(1) -70.0f; + mae = player->eyePos - actor->current.pos; + mae.y += TREG_F(1) -70.0f; } } - sVar1 = cM_atan2s(sp44.x, sp44.z) - a_this->shape_angle.y; + sVar1 = cM_atan2s(mae.x, mae.z) - actor->shape_angle.y; sVar1 *= -1; - sVar2 = a_this->shape_angle.x + cM_atan2s(sp44.y, JMAFastSqrt(sp44.x * sp44.x + sp44.z * sp44.z)); + sVar2 = actor->shape_angle.x + cM_atan2s(mae.y, JMAFastSqrt(mae.x * mae.x + mae.z * mae.z)); if (sVar1 > 8000) { sVar1 = 8000; @@ -6595,8 +6595,8 @@ static void action(npc_ks_class* i_this) { cLib_addCalcAngleS2(&i_this->field_0x606, i_this->field_0x608, 2, 5000); i_this->field_0x608 = 0; if (i_this->field_0xbe0 != 0) { - fopAcM_effSmokeSet1(&i_this->field_0x858, &i_this->field_0x85c, &a_this->current.pos, NULL, - 0.75f + TREG_F(18), &a_this->tevStr, 1); + fopAcM_effSmokeSet1(&i_this->field_0x858, &i_this->field_0x85c, &actor->current.pos, NULL, + 0.75f + TREG_F(18), &actor->tevStr, 1); i_this->field_0xbe0 = 0; } } @@ -6612,21 +6612,21 @@ static void* s_kago_sub(void* i_actor, void* i_data) { } static void kantera_sub(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; - MTXCopy(i_this->mpModelMorf->getModel()->getAnmMtx(14), mDoMtx_stack_c::get()); - i_this->mpStickModel->setBaseTRMtx(mDoMtx_stack_c::get()); + fopAc_ac_c* actor = &i_this->actor; + MTXCopy(i_this->model->getModel()->getAnmMtx(14), mDoMtx_stack_c::get()); + i_this->stick_model->setBaseTRMtx(mDoMtx_stack_c::get()); if (i_this->field_0xc17 == 2) { mDoMtx_stack_c::transM(44.0f + KREG_F(7), 144.5f + KREG_F(8), 11.0f + KREG_F(9)); mDoMtx_multVecZero(mDoMtx_stack_c::get(), &i_this->field_0xc04); - f32 dbg_f31 = l_HIO.lantern_size; - mDoMtx_stack_c::scaleM(dbg_f31, dbg_f31, dbg_f31); + f32 model_size = l_HIO.lantern_size; + mDoMtx_stack_c::scaleM(model_size, model_size, model_size); daPy_getPlayerActorClass()->setKandelaarMtx(mDoMtx_stack_c::get(), 1, 1); } else if (i_this->field_0xc17 == 3) { daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - if (fopAcM_checkCarryNow(a_this) != 0 && player->getGrabUpStart()) { - fopAcM_cancelCarryNow(a_this); - cLib_offBit(a_this->attention_info.flags, fopAc_AttnFlag_CARRY_e); + if (fopAcM_checkCarryNow(actor) != 0 && player->getGrabUpStart()) { + fopAcM_cancelCarryNow(actor); + cLib_offBit(actor->attention_info.flags, fopAc_AttnFlag_CARRY_e); i_this->field_0xc17 = 0; dComIfGs_onEventBit(dSv_event_flag_c::saveBitLabels[0xE2]); } else { @@ -6655,13 +6655,13 @@ static void kantera_sub(npc_ks_class* i_this) { mDoMtx_stack_c::ZrotM(res); mDoMtx_stack_c::YrotM(5000); daPy_getPlayerActorClass()->setKandelaarMtx(mDoMtx_stack_c::get(), 0, 0); - fopAcM_OnCarryType(a_this, fopAcM_CARRY_ITEM); - cLib_onBit(a_this->attention_info.flags, fopAc_AttnFlag_CARRY_e); - a_this->attention_info.distances[fopAc_attn_CARRY_e] = 6; - a_this->attention_info.position.x = i_this->field_0xc04.x; - a_this->attention_info.position.y = i_this->field_0xc04.y + 30.0f; - a_this->attention_info.position.z = i_this->field_0xc04.z; - a_this->eyePos = a_this->attention_info.position; + fopAcM_OnCarryType(actor, fopAcM_CARRY_ITEM); + cLib_onBit(actor->attention_info.flags, fopAc_AttnFlag_CARRY_e); + actor->attention_info.distances[fopAc_attn_CARRY_e] = 6; + actor->attention_info.position.x = i_this->field_0xc04.x; + actor->attention_info.position.y = i_this->field_0xc04.y + 30.0f; + actor->attention_info.position.z = i_this->field_0xc04.z; + actor->eyePos = actor->attention_info.position; } } } @@ -6669,8 +6669,8 @@ static void kantera_sub(npc_ks_class* i_this) { static int c_start; static int daNpc_Ks_Execute(npc_ks_class* i_this) { - if (i_this->mActionID == 300) { - if (c_start == 0 && i_this->field_0xb42 == 0 && dComIfGp_event_runCheck()) { + if (i_this->action == 300) { + if (c_start == 0 && i_this->demo_mode == 0 && dComIfGp_event_runCheck()) { kantera_sub(i_this); return 1; } @@ -6680,22 +6680,22 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) { } } - fopAc_ac_c* a_this = &i_this->actor; - cXyz sp60, sp6c; + fopAc_ac_c* actor = &i_this->actor; + cXyz mae, ato; - if (i_this->field_0x5b6 == 2) { - if (fopAcM_GetRoomNo(a_this) == 0) { - dComIfGs_onSwitch(0x4F, fopAcM_GetRoomNo(a_this)); + if (i_this->set_id == 2) { + if (fopAcM_GetRoomNo(actor) == 0) { + dComIfGs_onSwitch(0x4F, fopAcM_GetRoomNo(actor)); } - } else if (i_this->field_0x5b6 == 3 && fopAcM_GetRoomNo(a_this) == 0) { - dComIfGs_onSwitch(0x50, fopAcM_GetRoomNo(a_this)); + } else if (i_this->set_id == 3 && fopAcM_GetRoomNo(actor) == 0) { + dComIfGs_onSwitch(0x50, fopAcM_GetRoomNo(actor)); } - i_this->field_0x5e6++; + i_this->count++; for (int i = 0; i < 4; i++) { - if (i_this->mTimers[i] != 0) { - i_this->mTimers[i]--; + if (i_this->timer[i] != 0) { + i_this->timer[i]--; } } @@ -6703,21 +6703,21 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) { i_this->field_0x5f8--; } - if (i_this->field_0x94c != 0) { - i_this->field_0x94c--; + if (i_this->anm_time != 0) { + i_this->anm_time--; } - if (i_this->field_0x94e != 0) { - i_this->field_0x94e--; + if (i_this->hang_time != 0) { + i_this->hang_time--; } action(i_this); if (i_this->field_0x90c != 0) { - sp60 = i_this->field_0x91c - i_this->field_0x910; - f32 fVar1 = sp60.abs(); - sp60 = i_this->field_0x91c - a_this->current.pos; - f32 fVar2 = sp60.abs(); + mae = i_this->field_0x91c - i_this->field_0x910; + f32 fVar1 = mae.abs(); + mae = i_this->field_0x91c - actor->current.pos; + f32 fVar2 = mae.abs(); f32 fVar3 = fVar1 * 0.2f; if (fVar3 > 200.0f) { fVar3 = 200.0f; @@ -6728,30 +6728,30 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) { cLib_addCalc0(&i_this->field_0x908, 1.0f, 5.0f); } - mDoMtx_stack_c::transS(a_this->current.pos.x, a_this->current.pos.y + i_this->field_0x908, a_this->current.pos.z); - mDoMtx_stack_c::YrotM(a_this->shape_angle.y); - mDoMtx_stack_c::XrotM(a_this->shape_angle.x); - mDoMtx_stack_c::ZrotM(a_this->shape_angle.z); + mDoMtx_stack_c::transS(actor->current.pos.x, actor->current.pos.y + i_this->field_0x908, actor->current.pos.z); + mDoMtx_stack_c::YrotM(actor->shape_angle.y); + mDoMtx_stack_c::XrotM(actor->shape_angle.x); + mDoMtx_stack_c::ZrotM(actor->shape_angle.z); mDoMtx_stack_c::transM(0.0f, i_this->field_0x928, 0.0f); mDoMtx_stack_c::scaleM(l_HIO.basic_size, l_HIO.basic_size, l_HIO.basic_size); - J3DModel* model = i_this->mpModelMorf->getModel(); + J3DModel* model = i_this->model->getModel(); model->setBaseTRMtx(mDoMtx_stack_c::get()); - i_this->mpModelMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(a_this))); + i_this->model->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(actor))); anm_se_set(i_this); if (i_this->field_0x5e4 != 0) { - i_this->mBtp2->play(); + i_this->btp2->play(); } else { - i_this->mBtp1->setFrame(i_this->field_0x5e2); + i_this->btp->setFrame(i_this->field_0x5e2); } - i_this->mpModelMorf->modelCalc(); + i_this->model->modelCalc(); - if (i_this->field_0x5d0 == 34) { - daObj_Kago_c* basket_p = (daObj_Kago_c*)fpcM_Search(s_kago_sub, i_this); - if (basket_p != NULL) { - MTXCopy(i_this->mpModelMorf->getModel()->getAnmMtx(14), mDoMtx_stack_c::get()); + if (i_this->res_id == 34) { + daObj_Kago_c* kago = (daObj_Kago_c*)fpcM_Search(s_kago_sub, i_this); + if (kago != NULL) { + MTXCopy(i_this->model->getModel()->getAnmMtx(14), mDoMtx_stack_c::get()); mDoMtx_stack_c::YrotM(-2000); mDoMtx_stack_c::XrotM(-0x3638); mDoMtx_stack_c::ZrotM(-0x2E68); @@ -6760,45 +6760,45 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) { mDoMtx_stack_c::XrotM(0); mDoMtx_stack_c::ZrotM(0); - basket_p->setMtx(mDoMtx_stack_c::get()); - if (fopAcM_checkHawkCarryNow(basket_p) != 0) { + kago->setMtx(mDoMtx_stack_c::get()); + if (fopAcM_checkHawkCarryNow(kago) != 0) { anm_init(i_this, 39, 5.0f, 2, 1.0f); - i_this->mSound.startCreatureVoice(Z2SE_KOSARU_V_JUMP_SURPRISE, -1); + i_this->sound.startCreatureVoice(Z2SE_KOSARU_V_JUMP_SURPRISE, -1); } } } - if (i_this->mpRoseModel != NULL) { - i_this->mpRoseModel->setBaseTRMtx(i_this->mpModelMorf->getModel()->getAnmMtx(4)); + if (i_this->bara_model != NULL) { + i_this->bara_model->setBaseTRMtx(i_this->model->getModel()->getAnmMtx(4)); } kantera_sub(i_this); MTXCopy(model->getAnmMtx(4), *calc_mtx); - sp60.set(0.0f, 0.0f, 0.0f); + mae.set(0.0f, 0.0f, 0.0f); if (i_this->field_0xc17 != 3) { - MtxPosition(&sp60, &a_this->eyePos); - a_this->attention_info.position = a_this->eyePos; - a_this->attention_info.position.y += 30.0f; + MtxPosition(&mae, &actor->eyePos); + actor->attention_info.position = actor->eyePos; + actor->attention_info.position.y += 30.0f; } MTXCopy(model->getAnmMtx(10), *calc_mtx); - sp60.set(30.0f, 0.0f, 0.0f); - MtxPosition(&sp60, &i_this->field_0x614); + mae.set(30.0f, 0.0f, 0.0f); + MtxPosition(&mae, &i_this->field_0x614); MTXCopy(model->getAnmMtx(14), *calc_mtx); - sp60.set(30.0f, -0.0f, 0.0f); - MtxPosition(&sp60, &sp6c); - i_this->field_0x614 += (sp6c - i_this->field_0x614) * 0.5f; + mae.set(30.0f, -0.0f, 0.0f); + MtxPosition(&mae, &ato); + i_this->field_0x614 += (ato - i_this->field_0x614) * 0.5f; if (i_this->field_0x620 != 0) { if (i_this->field_0x620 == 1) { cLib_addCalc2(&obj_pos.x, i_this->field_0x614.x, 1.0f, NPC_KS_FABSF(i_this->field_0x624.x) + 4.0f); cLib_addCalc2(&obj_pos.y, i_this->field_0x614.y, 1.0f, NPC_KS_FABSF(i_this->field_0x624.y) + 4.0f); cLib_addCalc2(&obj_pos.z, i_this->field_0x614.z, 1.0f, NPC_KS_FABSF(i_this->field_0x624.z) + 4.0f); - sp60.x = obj_pos.x - i_this->field_0x614.x; - sp60.z = obj_pos.z - i_this->field_0x614.z; - if ((sp60.x * sp60.x + sp60.z * sp60.z) <= 15.0f) { + mae.x = obj_pos.x - i_this->field_0x614.x; + mae.z = obj_pos.z - i_this->field_0x614.z; + if ((mae.x * mae.x + mae.z * mae.z) <= 15.0f) { i_this->field_0x620 = 2; i_this->field_0x621 = 10; leader->field_0x92c = 0; @@ -6818,11 +6818,11 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) { } daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); - cXyz sp78; - sp78.x = obj_pos.x; - sp78.z = obj_pos.z; - sp78.y = obj_pos.y + i_this->field_0x638; - setPlayerPosAndAngle(&sp78, a_this->home.angle.y); + cXyz ato; + ato.x = obj_pos.x; + ato.z = obj_pos.z; + ato.y = obj_pos.y + i_this->field_0x638; + setPlayerPosAndAngle(&ato, actor->home.angle.y); if (i_this->field_0x620 == 2) { if (i_this->field_0x604 < 0 && i_this->field_0x602 < 0) { @@ -6846,22 +6846,22 @@ static int daNpc_Ks_Execute(npc_ks_class* i_this) { i_this->field_0x621--; } - sp6c = a_this->current.pos; + ato = actor->current.pos; if (i_this->field_0xaec == 0) { - i_this->field_0x98c.OffCoSetBit(); + i_this->cc_cyl.OffCoSetBit(); } else { - i_this->field_0x98c.OnCoSetBit(); + i_this->cc_cyl.OnCoSetBit(); } - i_this->field_0x98c.SetC(sp6c); - i_this->field_0x98c.SetR(l_HIO.basic_size * 50.0f); - i_this->field_0x98c.SetH(l_HIO.basic_size * 130.0f); - dComIfG_Ccsp()->Set(&i_this->field_0x98c); + i_this->cc_cyl.SetC(ato); + i_this->cc_cyl.SetR(l_HIO.basic_size * 50.0f); + i_this->cc_cyl.SetH(l_HIO.basic_size * 130.0f); + dComIfG_Ccsp()->Set(&i_this->cc_cyl); - if (i_this->field_0x5b6 == 0) { + if (i_this->set_id == 0) { demo_camera(leader); - } else if (i_this->field_0x5b6 >= 4) { + } else if (i_this->set_id >= 4) { demo_camera(i_this); } @@ -6873,68 +6873,68 @@ static int daNpc_Ks_IsDelete(npc_ks_class* i_this) { } static int daNpc_Ks_Delete(npc_ks_class* i_this) { - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAcM_RegisterDeleteID(i_this, "Npc_Ks"); - dComIfG_resDelete(&i_this->mPhase, i_this->mResName); + dComIfG_resDelete(&i_this->mPhase, i_this->res_name); - if (i_this->field_0xc1c != 0) { + if (i_this->hio_init != 0) { l_HIOInit = 0; - mDoHIO_DELETE_CHILD(l_HIO.field_0x4); + mDoHIO_DELETE_CHILD(l_HIO.no); } - if (a_this->heap != NULL) { - i_this->mpModelMorf->stopZelAnime(); + if (actor->heap != NULL) { + i_this->model->stopZelAnime(); } return 1; } -static int useHeapInit(fopAc_ac_c* a_this) { - npc_ks_class* i_this = (npc_ks_class*)a_this; +static int useHeapInit(fopAc_ac_c* actor) { + npc_ks_class* i_this = (npc_ks_class*)actor; - i_this->mpModelMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->mResName, npc_ks_class::BMDR_SARU), NULL, NULL, - (J3DAnmTransform*)dComIfG_getObjectRes(i_this->mResName, npc_ks_class::BCK_SARU_WAIT_A), 0, 1.0f, 0, -1, - &i_this->mSound, 0x80000, 0x11020084); - if (i_this->mpModelMorf == NULL || i_this->mpModelMorf->getModel() == NULL) { + i_this->model = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BMDR_SARU), NULL, NULL, + (J3DAnmTransform*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BCK_SARU_WAIT_A), 0, 1.0f, 0, -1, + &i_this->sound, 0x80000, 0x11020084); + if (i_this->model == NULL || i_this->model->getModel() == NULL) { return 0; } - J3DModel* model = i_this->mpModelMorf->getModel(); + J3DModel* model = i_this->model->getModel(); model->setUserArea((uintptr_t)i_this); for (u16 i = 0; i < model->getModelData()->getJointNum(); i++) { model->getModelData()->getJointNodePointer(i)->setCallBack(nodeCallBack); } - i_this->mBtp1 = new mDoExt_btpAnm(); - if (i_this->mBtp1 == NULL) { + i_this->btp = new mDoExt_btpAnm(); + if (i_this->btp == NULL) { return 0; } - if (i_this->mBtp1->init(i_this->mpModelMorf->getModel()->getModelData(), - (J3DAnmTexPattern*)dComIfG_getObjectRes(i_this->mResName, npc_ks_class::BTP_SARU), 1, 0, 1.0f, 0, -1) == 0) { + if (i_this->btp->init(i_this->model->getModel()->getModelData(), + (J3DAnmTexPattern*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BTP_SARU), 1, 0, 1.0f, 0, -1) == 0) { return 0; } - i_this->mBtp2 = new mDoExt_btpAnm(); - if (i_this->mBtp2 == NULL) { + i_this->btp2 = new mDoExt_btpAnm(); + if (i_this->btp2 == NULL) { return 0; } - if (i_this->mBtp2->init(i_this->mpModelMorf->getModel()->getModelData(), - (J3DAnmTexPattern*)dComIfG_getObjectRes(i_this->mResName, npc_ks_class::BTP_SARU_RELIEF), 1, 2, 1.0f, 0, -1) == 0) { + if (i_this->btp2->init(i_this->model->getModel()->getModelData(), + (J3DAnmTexPattern*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BTP_SARU_RELIEF), 1, 2, 1.0f, 0, -1) == 0) { return 0; } - J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, npc_ks_class::BMDR_SARU_STICK); + J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BMDR_SARU_STICK); JUT_ASSERT(10232, modelData != NULL); - i_this->mpStickModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); - if (i_this->mpStickModel == NULL) { + i_this->stick_model = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->stick_model == NULL) { return 0; } - if (i_this->mRoomMonkeyID == 0 || i_this->mRoomMonkeyID == 10 || i_this->mRoomMonkeyID == 20 || i_this->mRoomMonkeyID == 21 || i_this->mRoomMonkeyID == 22) { - modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->mResName, npc_ks_class::BMDR_SARU_BARA); + if (i_this->monkey_room_no == 0 || i_this->monkey_room_no == 10 || i_this->monkey_room_no == 20 || i_this->monkey_room_no == 21 || i_this->monkey_room_no == 22) { + modelData = (J3DModelData*)dComIfG_getObjectRes(i_this->res_name, npc_ks_class::BMDR_SARU_BARA); JUT_ASSERT(10249, modelData != NULL); - i_this->mpRoseModel = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); - if (i_this->mpRoseModel == NULL) { + i_this->bara_model = mDoExt_J3DModel__create(modelData, 0x80000, 0x11000084); + if (i_this->bara_model == NULL) { return 0; } } @@ -6955,13 +6955,13 @@ static BOOL start_check(npc_ks_class* i_this) { -3389.0f, -5327.0f, -5323.0f, }; - fopAc_ac_c* a_this = &i_this->actor; + fopAc_ac_c* actor = &i_this->actor; fopAc_ac_c* player = dComIfGp_getPlayer(0); BOOL rv = TRUE; f32 fVar1; f32 fVar2; - if (i_this->mRoomMonkeyID <= 3 && fopAcM_GetRoomNo(a_this) == 4) { + if (i_this->monkey_room_no <= 3 && fopAcM_GetRoomNo(actor) == 4) { if (dComIfGs_isStageMiddleBoss()) { return FALSE; } @@ -6974,105 +6974,105 @@ static BOOL start_check(npc_ks_class* i_this) { if (cDmr_SkipInfo != 0) { cDmr_SkipInfo--; - a_this->current.angle.y = a_this->home.angle.y + 0x4000; - a_this->shape_angle.y = a_this->current.angle.y; - a_this->current.angle.x = -0x8000; - a_this->shape_angle.x = -0x8000; - i_this->field_0x630 = i_this->mRoomMonkeyID * 6 + 6; - i_this->mActionID = 10; - i_this->field_0x94e = 30; + actor->current.angle.y = actor->home.angle.y + 0x4000; + actor->shape_angle.y = actor->current.angle.y; + actor->current.angle.x = -0x8000; + actor->shape_angle.x = -0x8000; + i_this->field_0x630 = i_this->monkey_room_no * 6 + 6; + i_this->action = 10; + i_this->hang_time = 30; return rv; } } - int iVar1 = (fopAcM_GetParam(a_this) & 0xFF000000) >> 24; + int bitSw = (fopAcM_GetParam(actor) & 0xFF000000) >> 24; int iVar2 = 0; - switch (i_this->mRoomMonkeyID) { + switch (i_this->monkey_room_no) { case 0: - if (fopAcM_GetRoomNo(a_this) == 22) { - if (iVar1 != 0xFF) { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { - i_this->mActionID = 6; + if (fopAcM_GetRoomNo(actor) == 22) { + if (bitSw != 0xFF) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { + i_this->action = 6; break; } } - } else if (fopAcM_GetRoomNo(a_this) == 12) { - i_this->mActionID = 8; + } else if (fopAcM_GetRoomNo(actor) == 12) { + i_this->action = 8; break; } if (dComIfGs_isStageMiddleBoss()) { - if (fopAcM_GetRoomNo(a_this) == 0) { - a_this->current.angle.y = a_this->home.angle.y + 0x4000; - a_this->shape_angle.y = a_this->current.angle.y; - a_this->current.angle.x = -0x8000; - a_this->shape_angle.x = -0x8000; + if (fopAcM_GetRoomNo(actor) == 0) { + actor->current.angle.y = actor->home.angle.y + 0x4000; + actor->shape_angle.y = actor->current.angle.y; + actor->current.angle.x = -0x8000; + actor->shape_angle.x = -0x8000; i_this->field_0x630 = 3; - i_this->mActionID = 11; + i_this->action = 11; return rv; } - if (fopAcM_GetRoomNo(a_this) == 2) { - a_this->current.angle.y = a_this->home.angle.y + 0x4000; - a_this->shape_angle.y = a_this->current.angle.y; - a_this->current.angle.x = -0x8000; - a_this->shape_angle.x = -0x8000; - i_this->mActionID = 10; - i_this->field_0x94e = 30; + if (fopAcM_GetRoomNo(actor) == 2) { + actor->current.angle.y = actor->home.angle.y + 0x4000; + actor->shape_angle.y = actor->current.angle.y; + actor->current.angle.x = -0x8000; + actor->shape_angle.x = -0x8000; + i_this->action = 10; + i_this->hang_time = 30; return rv; } rv = FALSE; } else { - if (fopAcM_GetRoomNo(a_this) == 0) { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 0) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } } } - i_this->mActionID = 100; + i_this->action = 100; break; case 1: - if (fopAcM_GetRoomNo(a_this) == 12) { - i_this->mActionID = 8; + if (fopAcM_GetRoomNo(actor) == 12) { + i_this->action = 8; } else { if (dComIfGs_isStageMiddleBoss()) { - if (fopAcM_GetRoomNo(a_this) == 0) { - a_this->current.angle.y = a_this->home.angle.y + 0x4000; - a_this->shape_angle.y = a_this->current.angle.y; - a_this->current.angle.x = -0x8000; - a_this->shape_angle.x = -0x8000; + if (fopAcM_GetRoomNo(actor) == 0) { + actor->current.angle.y = actor->home.angle.y + 0x4000; + actor->shape_angle.y = actor->current.angle.y; + actor->current.angle.x = -0x8000; + actor->shape_angle.x = -0x8000; i_this->field_0x630 = 3; - i_this->mActionID = 11; + i_this->action = 11; return rv; } - if (fopAcM_GetRoomNo(a_this) == 2) { - a_this->current.angle.y = a_this->home.angle.y + 0x4000; - a_this->shape_angle.y = a_this->current.angle.y; - a_this->current.angle.x = -0x8000; - a_this->shape_angle.x = -0x8000; - i_this->mActionID = 10; - i_this->field_0x94e = 30; + if (fopAcM_GetRoomNo(actor) == 2) { + actor->current.angle.y = actor->home.angle.y + 0x4000; + actor->shape_angle.y = actor->current.angle.y; + actor->current.angle.x = -0x8000; + actor->shape_angle.x = -0x8000; + i_this->action = 10; + i_this->hang_time = 30; return rv; } rv = FALSE; } else { - if (fopAcM_GetRoomNo(a_this) == 2) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { - i_this->mActionID = 100; + if (fopAcM_GetRoomNo(actor) == 2) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { + i_this->action = 100; } else { - i_this->mActionID = 4; + i_this->action = 4; } } else { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 100; + i_this->action = 100; } } } @@ -7080,34 +7080,34 @@ static BOOL start_check(npc_ks_class* i_this) { break; case 2: - if (fopAcM_GetRoomNo(a_this) == 12) { - i_this->mActionID = 8; + if (fopAcM_GetRoomNo(actor) == 12) { + i_this->action = 8; } else { if (dComIfGs_isStageMiddleBoss()) { rv = FALSE; } - if (fopAcM_GetRoomNo(a_this) == 7) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 7) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 5; + i_this->action = 5; } } else { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - if (fopAcM_GetRoomNo(a_this) == 0) { - i_this->mActionID = 8; + if (fopAcM_GetRoomNo(actor) == 0) { + i_this->action = 8; } else { - if (fopAcM_GetRoomNo(a_this) == 3 || fopAcM_GetRoomNo(a_this) == 5 || fopAcM_GetRoomNo(a_this) == 7) { - if (dComIfGs_isSwitch(79, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 3 || fopAcM_GetRoomNo(actor) == 5 || fopAcM_GetRoomNo(actor) == 7) { + if (dComIfGs_isSwitch(79, fopAcM_GetRoomNo(actor))) { rv = FALSE; break; } } - i_this->mActionID = 100; + i_this->action = 100; } } } @@ -7115,34 +7115,34 @@ static BOOL start_check(npc_ks_class* i_this) { break; case 3: - if (fopAcM_GetRoomNo(a_this) == 12) { - i_this->mActionID = 8; + if (fopAcM_GetRoomNo(actor) == 12) { + i_this->action = 8; } else { if (dComIfGs_isStageMiddleBoss()) { rv = FALSE; } - if (fopAcM_GetRoomNo(a_this) == 5) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 5) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 5; + i_this->action = 5; } } else { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - if (fopAcM_GetRoomNo(a_this) == 0) { - i_this->mActionID = 8; + if (fopAcM_GetRoomNo(actor) == 0) { + i_this->action = 8; } else { - if (fopAcM_GetRoomNo(a_this) == 3 || fopAcM_GetRoomNo(a_this) == 5 || fopAcM_GetRoomNo(a_this) == 7) { - if (dComIfGs_isSwitch(80, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 3 || fopAcM_GetRoomNo(actor) == 5 || fopAcM_GetRoomNo(actor) == 7) { + if (dComIfGs_isSwitch(80, fopAcM_GetRoomNo(actor))) { rv = FALSE; break; } } - i_this->mActionID = 100; + i_this->action = 100; } } } @@ -7150,40 +7150,40 @@ static BOOL start_check(npc_ks_class* i_this) { break; case 4: - if (fopAcM_GetRoomNo(a_this) == 12) { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 12) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 8; + i_this->action = 8; } } else { - if (dComIfGs_isSwitch(83, fopAcM_GetRoomNo(a_this))) { + if (dComIfGs_isSwitch(83, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - if (fopAcM_GetRoomNo(a_this) == 4) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { - i_this->mActionID = 117; - i_this->mMode = 0; - a_this->current.pos.set(6854.0f, 3458.0f, 440.0f); - a_this->current.angle.y = 0; - a_this->old = a_this->current; + if (fopAcM_GetRoomNo(actor) == 4) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { + i_this->action = 117; + i_this->mode = 0; + actor->current.pos.set(6854.0f, 3458.0f, 440.0f); + actor->current.angle.y = 0; + actor->old = actor->current; } else { - i_this->mActionID = 6; + i_this->action = 6; } } else { - if (fopAcM_GetRoomNo(a_this) == 9) { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 9) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { return FALSE; } - i_this->mActionID = 100; + i_this->action = 100; for (int i = 0; i < 3; i++) { f32 pos_x = dx[i] - player->current.pos.x; f32 pos_y = dz[i] - player->current.pos.z; if (JMAFastSqrt(pos_x * pos_x + pos_y * pos_y) < 700.0f) { - a_this->current.pos.set(dx[i], dy[i], dz[i]); - a_this->old = a_this->current; + actor->current.pos.set(dx[i], dy[i], dz[i]); + actor->old = actor->current; OS_REPORT("////////KS R09 SET %d\n", i); return rv; } @@ -7195,66 +7195,66 @@ static BOOL start_check(npc_ks_class* i_this) { break; case 5: - if (fopAcM_GetRoomNo(a_this) == 12) { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 12) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 8; + i_this->action = 8; } } else { - if (fopAcM_GetRoomNo(a_this) == 10) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 10) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 5; + i_this->action = 5; } } } break; case 6: - if (fopAcM_GetRoomNo(a_this) == 12) { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 12) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 8; + i_this->action = 8; } } else { - if (fopAcM_GetRoomNo(a_this) == 19) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 19) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 6; + i_this->action = 6; } } } break; case 7: - if (fopAcM_GetRoomNo(a_this) == 12) { - if (!dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 12) { + if (!dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 8; + i_this->action = 8; } } else { - if (fopAcM_GetRoomNo(a_this) == 11) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (fopAcM_GetRoomNo(actor) == 11) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } else { - i_this->mActionID = 5; + i_this->action = 5; } } } break; case 10: - i_this->mActionID = 100; + i_this->action = 100; break; case 20: - fopAcM_OnStatus(a_this, 0x20000); - i_this->mActionID = 300; + fopAcM_OnStatus(actor, 0x20000); + i_this->action = 300; i_this->field_0xc17 = 1; iVar2 = 1; break; @@ -7263,7 +7263,7 @@ static BOOL start_check(npc_ks_class* i_this) { if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[0x20A])) { rv = FALSE; } else { - i_this->mActionID = 301; + i_this->action = 301; } break; @@ -7271,36 +7271,36 @@ static BOOL start_check(npc_ks_class* i_this) { if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[0x241])) { rv = FALSE; } else { - i_this->mActionID = 302; + i_this->action = 302; } break; default: - i_this->mActionID = 100; - i_this->mRoomMonkeyID &= (u8) 0xF; - i_this->field_0x5b6 = i_this->mRoomMonkeyID; + i_this->action = 100; + i_this->monkey_room_no &= (u8) 0xF; + i_this->set_id = i_this->monkey_room_no; break; } - if (i_this->mActionID == 100) { - fopAcM_setStageLayer(a_this); - if (fopAcM_GetRoomNo(a_this) == 1) { + if (i_this->action == 100) { + fopAcM_setStageLayer(actor); + if (fopAcM_GetRoomNo(actor) == 1) { f32 x_pos = 6836.0f - player->current.pos.x; f32 y_pos = 3585.0f - player->current.pos.z; if (JMAFastSqrt(x_pos * x_pos + y_pos * y_pos) < 500.0f) { - a_this->home.pos.set(7025.0f, 3355.0f, 4500.0f); - a_this->home.angle.y = -0x7343; - a_this->old = a_this->current = a_this->home; + actor->home.pos.set(7025.0f, 3355.0f, 4500.0f); + actor->home.angle.y = -0x7343; + actor->old = actor->current = actor->home; } - i_this->mTimers[1] = cM_rndF(20.0f) + 80.0f; + i_this->timer[1] = cM_rndF(20.0f) + 80.0f; } else { - i_this->mTimers[1] = cM_rndF(20.0f) + 40.0f; + i_this->timer[1] = cM_rndF(20.0f) + 40.0f; } } if (iVar2 != 0) { - if (dComIfGs_isSwitch(iVar1, fopAcM_GetRoomNo(a_this))) { + if (dComIfGs_isSwitch(bitSw, fopAcM_GetRoomNo(actor))) { rv = FALSE; } } @@ -7310,7 +7310,7 @@ static BOOL start_check(npc_ks_class* i_this) { static void* s_check_sub(void* i_actor, void* i_data) { if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_NPC_KS) { - if (fopAcM_GetID(i_actor) != fopAcM_GetID(i_data) && ((npc_ks_class*)i_actor)->field_0x5b6 == ((npc_ks_class*)i_data)->field_0x5b6) { + if (fopAcM_GetID(i_actor) != fopAcM_GetID(i_data) && ((npc_ks_class*)i_actor)->set_id == ((npc_ks_class*)i_data)->set_id) { return i_actor; } } @@ -7318,7 +7318,7 @@ static void* s_check_sub(void* i_actor, void* i_data) { return NULL; } -static int daNpc_Ks_Create(fopAc_ac_c* a_this) { +static int daNpc_Ks_Create(fopAc_ac_c* actor) { static dCcD_SrcCyl cc_cyl_src = { { {0x0, {{0x0, 0x0, 0x0}, {0xd8fafd3f, 0x3}, 0x79}}, // mObj @@ -7333,28 +7333,28 @@ static int daNpc_Ks_Create(fopAc_ac_c* a_this) { } // mCyl }; - npc_ks_class* i_this = (npc_ks_class*)a_this; + npc_ks_class* i_this = (npc_ks_class*)actor; fopAcM_ct(&i_this->actor, npc_ks_class); stage_stag_info_class* stag_info = dComIfGp_getStage()->getStagInfo(); // unused if (dKy_darkworld_check()) { - i_this->mResName = "Npc_kst"; + i_this->res_name = "Npc_kst"; } else { - i_this->mResName = "Npc_ks"; + i_this->res_name = "Npc_ks"; } - int phase = dComIfG_resLoad(&i_this->mPhase, i_this->mResName); + int phase = dComIfG_resLoad(&i_this->mPhase, i_this->res_name); if (phase == cPhs_COMPLEATE_e) { - OS_REPORT("NPC_KS PARAM %x\n", fopAcM_GetParam(a_this)); - i_this->mRoomMonkeyID = fopAcM_GetParam(a_this); + OS_REPORT("NPC_KS PARAM %x\n", fopAcM_GetParam(actor)); + i_this->monkey_room_no = fopAcM_GetParam(actor); - u8 uVar1 = (fopAcM_GetParam(a_this) & 0xFF00) >> 8; + u8 arg0 = (fopAcM_GetParam(actor) & 0xFF00) >> 8; - if (i_this->mRoomMonkeyID == 0xFF) { - i_this->mRoomMonkeyID = 0; + if (i_this->monkey_room_no == 0xFF) { + i_this->monkey_room_no = 0; } - if (i_this->mRoomMonkeyID == 20 + if (i_this->monkey_room_no == 20 /* dSv_event_flag_c::F_0225 - Faron Woods - Lanter guide monkey doesn't come out a second time */ && dComIfGs_isEventBit(u16(dSv_event_flag_c::saveBitLabels[0xE1])) /* dSv_event_flag_c::F_0226 - Faron Woods - Get lantern back from monkey */ @@ -7362,88 +7362,88 @@ static int daNpc_Ks_Create(fopAc_ac_c* a_this) { return cPhs_ERROR_e; } - if (uVar1 == 0xFF) { - uVar1 = 0; + if (arg0 == 0xFF) { + arg0 = 0; } - if (fopAcM_GetRoomNo(a_this) == 4 && i_this->mRoomMonkeyID == 4) { - a_this->current.pos.set(-5370.0f, 3950.0f, -2330.0f); + if (fopAcM_GetRoomNo(actor) == 4 && i_this->monkey_room_no == 4) { + actor->current.pos.set(-5370.0f, 3950.0f, -2330.0f); } if (strcmp(dComIfGp_getStartStageName(), "D_MN05") == 0 && dComIfGs_isStageBossEnemy() != 0) { return cPhs_ERROR_e; } - i_this->field_0x5b6 = i_this->mRoomMonkeyID & 15; + i_this->set_id = i_this->monkey_room_no & 15; if (fpcM_Search(s_check_sub, i_this) != NULL) { return cPhs_ERROR_e; } - OS_REPORT("////////SET ID %d\n", i_this->field_0x5b6); + OS_REPORT("////////SET ID %d\n", i_this->set_id); - if (i_this->field_0x5b6 == 0) { + if (i_this->set_id == 0) { leader = i_this; OS_REPORT("////////0 \n"); } else { OS_REPORT("////////1 \n"); } - i_this->field_0xaf0 = a_this->current.angle.x; - a_this->current.angle.x = a_this->shape_angle.x = 0; - i_this->bitTRB = a_this->current.angle.z & 63; - a_this->current.angle.z = a_this->shape_angle.z = 0; + i_this->field_0xaf0 = actor->current.angle.x; + actor->current.angle.x = actor->shape_angle.x = 0; + i_this->bitTRB = actor->current.angle.z & 63; + actor->current.angle.z = actor->shape_angle.z = 0; OS_REPORT("NPC_KS bitTRB %x\n", i_this->bitTRB); obj_pos.set(0.0f, 0.0f, 0.0f); OS_REPORT("NPC_KS//////////////NPC_KS SET 1 !!\n"); - if (!fopAcM_entrySolidHeap(a_this, useHeapInit, 0x38A0)) { + if (!fopAcM_entrySolidHeap(actor, useHeapInit, 0x38A0)) { OS_REPORT("//////////////NPC_KS SET NON !!\n"); return cPhs_ERROR_e; } OS_REPORT("//////////////NPC_KS SET 2 !!\n"); if (l_HIOInit == 0) { - i_this->field_0xc1c = 1; + i_this->hio_init = 1; l_HIOInit = 1; - l_HIO.field_0x4 = mDoHIO_CREATE_CHILD("コザル", &l_HIO); // Kozaru + l_HIO.no = mDoHIO_CREATE_CHILD("コザル", &l_HIO); // Kozaru } - fopAcM_SetMtx(a_this, i_this->mpModelMorf->getModel()->getBaseTRMtx()); - fopAcM_SetMin(a_this, -200.0f, -200.0f, -200.0f); - fopAcM_SetMax(a_this, 200.0f, 200.0f, 200.0f); - i_this->mObjAcch.Set(fopAcM_GetPosition_p(a_this), fopAcM_GetOldPosition_p(a_this), a_this, 1, - &i_this->mAcchCir, fopAcM_GetSpeed_p(a_this), NULL, NULL); - i_this->mAcchCir.SetWall(50.0f, 50.0f); - i_this->field_0x5e6 = cM_rndF(65536.0f); - saru_p[i_this->field_0x5b6] = i_this; + fopAcM_SetMtx(actor, i_this->model->getModel()->getBaseTRMtx()); + fopAcM_SetMin(actor, -200.0f, -200.0f, -200.0f); + fopAcM_SetMax(actor, 200.0f, 200.0f, 200.0f); + i_this->ObjAcch.Set(fopAcM_GetPosition_p(actor), fopAcM_GetOldPosition_p(actor), actor, 1, + &i_this->AcchCir, fopAcM_GetSpeed_p(actor), NULL, NULL); + i_this->AcchCir.SetWall(50.0f, 50.0f); + i_this->count = cM_rndF(65536.0f); + saru_p[i_this->set_id] = i_this; - if (uVar1 != 0 && i_this->mRoomMonkeyID < 8) { - a_this->current.angle.y = a_this->home.angle.y + 0x4000; - a_this->shape_angle.y = a_this->current.angle.y; - a_this->current.angle.x = -0x8000; - a_this->shape_angle.x = -0x8000; - i_this->field_0x630 = (fopAcM_GetParam(a_this) & 0xFF0000) >> 16; + if (arg0 != 0 && i_this->monkey_room_no < 8) { + actor->current.angle.y = actor->home.angle.y + 0x4000; + actor->shape_angle.y = actor->current.angle.y; + actor->current.angle.x = -0x8000; + actor->shape_angle.x = -0x8000; + i_this->field_0x630 = (fopAcM_GetParam(actor) & 0xFF0000) >> 16; - i_this->field_0x934 = (obj_sw_class*)fopAcM_SearchByID(a_this->parentActorID); - if (i_this->field_0x934 != NULL && i_this->field_0x934->field_0x91c == 1) { - i_this->mActionID = 11; + i_this->child_no = (obj_sw_class*)fopAcM_SearchByID(actor->parentActorID); + if (i_this->child_no != NULL && i_this->child_no->field_0x91c == 1) { + i_this->action = 11; } else { - i_this->mActionID = 10; + i_this->action = 10; } - i_this->field_0x94e = 30; + i_this->hang_time = 30; } else { if (!start_check(i_this)) { - saru_p[i_this->field_0x5b6] = NULL; + saru_p[i_this->set_id] = NULL; return cPhs_ERROR_e; } } - i_this->mSound.init(&a_this->current.pos, &a_this->eyePos, 2, 1); - i_this->mStts.Init(100, 0, a_this); - i_this->field_0x98c.Set(cc_cyl_src); - i_this->field_0x98c.SetStts(&i_this->mStts); - i_this->field_0x98c.OnTgNoHitMark(); + i_this->sound.init(&actor->current.pos, &actor->eyePos, 2, 1); + i_this->stts.Init(100, 0, actor); + i_this->cc_cyl.Set(cc_cyl_src); + i_this->cc_cyl.SetStts(&i_this->stts); + i_this->cc_cyl.OnTgNoHitMark(); OS_REPORT("//////////////NPC_KS SET 3 !!\n"); c_start = 1;