From 1bc8ea9c72bb13b48e1c1ac5204c7bfaa05eab05 Mon Sep 17 00:00:00 2001 From: Caroline Madsen Date: Sun, 10 Nov 2024 07:39:49 -0500 Subject: [PATCH] e_pm, e_fs, obj_sm_door, obj_smw_stone --- configure.py | 4 +- include/d/actor/d_a_alink.h | 1 + include/d/actor/d_a_e_fs.h | 61 +- include/d/actor/d_a_e_pm.h | 124 +- include/d/actor/d_a_obj_sm_door.h | 43 +- include/d/actor/d_a_obj_smw_stone.h | 27 +- include/d/d_bg_s.h | 2 +- include/f_op/f_op_actor_enemy.h | 1 - src/d/actor/d_a_e_fs.cpp | 1946 +++++------- src/d/actor/d_a_e_pm.cpp | 4357 ++++++++++++++++----------- src/d/actor/d_a_obj_sm_door.cpp | 601 ++-- src/d/actor/d_a_obj_smw_stone.cpp | 387 +-- src/d/d_bg_s.cpp | 2 +- 13 files changed, 4036 insertions(+), 3520 deletions(-) diff --git a/configure.py b/configure.py index 87108f844e8..7a85dc1ecfc 100644 --- a/configure.py +++ b/configure.py @@ -1985,12 +1985,12 @@ def MatchingFor(*versions): ActorRel(Matching, "d_a_obj_sekizo"), ActorRel(NonMatching, "d_a_obj_sekizoa"), ActorRel(NonMatching, "d_a_obj_shield"), - ActorRel(NonMatching, "d_a_obj_sm_door"), + ActorRel(Equivalent, "d_a_obj_sm_door"), ActorRel(NonMatching, "d_a_obj_smallkey"), ActorRel(NonMatching, "d_a_obj_smgdoor"), ActorRel(Matching, "d_a_obj_smoke"), ActorRel(NonMatching, "d_a_obj_smtile"), - ActorRel(NonMatching, "d_a_obj_smw_stone"), + ActorRel(Matching, "d_a_obj_smw_stone"), ActorRel(Matching, "d_a_obj_snowEffTag"), ActorRel(Matching, "d_a_obj_snow_soup"), ActorRel(NonMatching, "d_a_obj_so"), diff --git a/include/d/actor/d_a_alink.h b/include/d/actor/d_a_alink.h index 3183e85cfc5..90c6e75e456 100644 --- a/include/d/actor/d_a_alink.h +++ b/include/d/actor/d_a_alink.h @@ -3511,6 +3511,7 @@ class daAlink_c : public daPy_py_c { u32 getWolfHowlTimer() { return mZ2WolfHowlMgr.getTimer(); } s8 getOnLineNum() { return mZ2WolfHowlMgr.getOnLineNum(); } SongNote getCorrectLine(u8 param_0) { return mZ2WolfHowlMgr.getCorrectLine(param_0); } + void startWindStoneSound(s8 id, Vec* pos) { mZ2WolfHowlMgr.startWindStoneSound(id, pos); } J3DModelData* getItemModelData() { return mpItemModelData; } cXyz* getIronBallChainPos() const { return mIronBallChainPos; } diff --git a/include/d/actor/d_a_e_fs.h b/include/d/actor/d_a_e_fs.h index fd72ab15287..ffedd29c321 100644 --- a/include/d/actor/d_a_e_fs.h +++ b/include/d/actor/d_a_e_fs.h @@ -1,6 +1,11 @@ #ifndef D_A_E_FS_H #define D_A_E_FS_H + +#include "Z2AudioLib/Z2Creature.h" #include "f_op/f_op_actor_mng.h" +#include "d/d_bg_s_acch.h" +#include "d/d_cc_d.h" +#include "d/d_cc_uty.h" /** * @ingroup actors-enemies @@ -11,16 +16,64 @@ * */ class e_fs_class : public fopEn_enemy_c { -private: - /* 0x5ac */ u8 field_0x5ac[0xb9c - 0x5ac]; +public: + /* 0x5AC */ request_of_phase_process_class mPhase; + /* 0x5B4 */ u8 field_0x5b4; + /* 0x5B5 */ u8 field_0x5b5; + /* 0x5B6 */ u8 field_0x5b6; + /* 0x5B7 */ u8 field_0x5b7; + /* 0x5B8 */ cXyz mPlayerPos; + /* 0x5C4 */ s16 mTargetAngleY; + /* 0x5C6 */ s16 mPlayerAngleY; + /* 0x5C8 */ f32 mPlayerDistXZ; + /* 0x5CC */ u8 field_0x5cc[0x5D0 - 0x5CC]; + /* 0x5D0 */ mDoExt_McaMorfSO* mpMorf; + /* 0x5D4 */ Z2CreatureEnemy mCreatureSound; + /* 0x678 */ u32 mAnm; + /* 0x67C */ s16 mFrameCounter; + /* 0x67E */ s16 mAction; + /* 0x680 */ s16 mMode; + /* 0x684 */ u32 mShadowKey; + /* 0x688 */ s16 mTimer[4]; + /* 0x690 */ s16 mIFrameTimer; + /* 0x692 */ s8 field_0x692; + /* 0x694 */ dBgS_AcchCir mAcchCir; + /* 0x6D4 */ dBgS_ObjAcch mAcch; + /* 0x8AC */ dCcD_Stts mCcStts; + /* 0x8E8 */ dCcD_Cyl mCcCyl; + /* 0xA24 */ dCcD_Sph mAtSph; + /* 0xB5C */ dCcU_AtInfo mAtInfo; + /* 0xB80 */ u32 mSmokeKey1; + /* 0xB84 */ u32 mSmokeKey2; + /* 0xB88 */ u32 mParticleKey[4]; + /* 0xB98 */ bool mHIOInit; + + enum Action { + /* 0x0 */ ACT_APPEAR, + /* 0x1 */ ACT_WAIT, + /* 0x2 */ ACT_MOVE, + /* 0x3 */ ACT_ATTACK, + /* 0x4 */ ACT_DAMAGE, + /* 0x5 */ ACT_END, + /* 0xA */ ACT_DEMOWAIT = 10, + }; }; -STATIC_ASSERT(sizeof(e_fs_class) == 0xb9c); +STATIC_ASSERT(sizeof(e_fs_class) == 0xB9C); class daE_Fs_HIO_c { +public: /* 806BBACC */ daE_Fs_HIO_c(); - /* 806BDF94 */ ~daE_Fs_HIO_c(); + /* 806BDF94 */ virtual ~daE_Fs_HIO_c() {} + + /* 0x04 */ s8 field_0x4; + /* 0x08 */ f32 mScale; + /* 0x0C */ f32 mAttackRange; + /* 0x10 */ f32 mAttackDistance; + /* 0x14 */ f32 mMoveSpeedRatio; + /* 0x18 */ f32 mDeleteRange; }; +STATIC_ASSERT(sizeof(daE_Fs_HIO_c) == 0x1C); #endif /* D_A_E_FS_H */ diff --git a/include/d/actor/d_a_e_pm.h b/include/d/actor/d_a_e_pm.h index 0e603e15ffa..9355e652741 100644 --- a/include/d/actor/d_a_e_pm.h +++ b/include/d/actor/d_a_e_pm.h @@ -1,7 +1,15 @@ #ifndef D_A_E_PM_H #define D_A_E_PM_H -#include "f_op/f_op_actor_mng.h" +#include "SSystem/SComponent/c_phase.h" +#include "Z2AudioLib/Z2Creature.h" +#include "f_op/f_op_actor.h" +#include "d/d_bg_s_acch.h" +#include "d/d_cc_d.h" +#include "d/d_cc_uty.h" +#include "d/d_msg_flow.h" + +class dPath; /** * @ingroup actors-enemies @@ -14,20 +22,20 @@ class daE_PM_c : public fopEn_enemy_c { public: /* 80741FB4 */ void DemoSkip(int); - /* 80742004 */ void DemoSkipCallBack(void*, int); - /* 80742038 */ void CreateHeap(); + /* 80742004 */ static int DemoSkipCallBack(void*, int); + /* 80742038 */ int CreateHeap(); /* 80742448 */ void initCcCylinder(); /* 807424C0 */ void setCcCylinder(); - /* 80742508 */ void ctrlJoint(J3DJoint*, J3DModel*); + /* 80742508 */ int ctrlJoint(J3DJoint*, J3DModel*); /* 80742600 */ void Particle_Set(u16, cXyz); /* 80742674 */ void SetAnm(int, int, f32, f32); /* 80742810 */ void Yazirushi(); /* 807428A8 */ void SearchRndP(); /* 80742958 */ void SearchFarP(); /* 80742C94 */ void SearchNearP(); - /* 80742E1C */ void SearchNextPos(); + /* 80742E1C */ BOOL SearchNextPos(); /* 80742FB4 */ void SetGakkiEffect(); - /* 807430C4 */ void CameraSet(); + /* 807430C4 */ bool CameraSet(); /* 80743210 */ void SetStopingCam(); /* 80743294 */ void SetStopCam(cXyz, f32, f32, s16); /* 807433E8 */ void SetMoveCam2(f32, f32); @@ -52,7 +60,7 @@ class daE_PM_c : public fopEn_enemy_c { /* 80747F38 */ void BossWaitAction(); /* 807480A4 */ void BossDeathAction(); /* 80748964 */ void BossAction(); - /* 80748B18 */ void Execute(); + /* 80748B18 */ int Execute(); /* 80748D74 */ void StartAction(); /* 8074954C */ void GakkiLoopAction(cXyz, f32); /* 807499C0 */ void DemoCreateAction(); @@ -63,28 +71,116 @@ class daE_PM_c : public fopEn_enemy_c { /* 8074A210 */ void At_Check(); /* 8074A3DC */ void ObjHit(); /* 8074A644 */ void EyeMove(); - /* 8074A6CC */ void Draw(); - /* 8074AAC0 */ void Delete(); + /* 8074A6CC */ int Draw(); + /* 8074AAC0 */ int Delete(); /* 8074AB28 */ void setBaseMtx(); /* 8074ABA8 */ void setGakkiBaseMtx(); /* 8074AC10 */ void setLampBaseMtx(); /* 8074AEF8 */ void SkipChk(); - /* 8074B4DC */ void Create(); + /* 8074B4DC */ cPhs__Step Create(); void AppearSet() { mAppear = true; } + u8 ActionChk() { return mPuppetDelete; } + u8 SwitchChk() { return mStage; } + u8 DoorChk() { return mDoorAction; } private: - /* 0x5AC */ u8 field_0x5ac[0x619 - 0x5AC]; + /* 0x5AC */ fpc_ProcID mPuppetID[4]; + /* 0x5BC */ u8 field_0x5bc[0x5DC - 0x5BC]; + /* 0x5DC */ u8 mDoorAction; + /* 0x5E0 */ dPath* mpPath; + /* 0x5E4 */ cXyz mPoint; + /* 0x5F0 */ u8 mPathIndex; + /* 0x5F4 */ int mPointIndex; + /* 0x5F8 */ u8 mBossHealth; + /* 0x5FC */ f32 field_0x5fc; + /* 0x600 */ u8 mPuppetNum; + /* 0x602 */ s16 mTargetAngleY; + /* 0x604 */ s16 mHeadAngleX; + /* 0x606 */ s16 mHeadAngleZ; + /* 0x608 */ s16 mTargetHeadAngleX; + /* 0x60C */ f32 mTargetSpeed; + /* 0x610 */ u8 mAction; + /* 0x611 */ u8 mMode; + /* 0x612 */ u8 mDemoMode; + /* 0x613 */ u8 field_0x613; + /* 0x614 */ u8 mPuppetDelete; + /* 0x616 */ s16 mIFrameTimer; + /* 0x618 */ u8 field_0x618; /* 0x619 */ bool mAppear; - /* 0x61A */ u8 field_0x61a[0xb7c - 0x61a]; + /* 0x61A */ u8 mStage; + /* 0x61B */ u8 mSwBit; + /* 0x61C */ int mAnm; + /* 0x620 */ s16 mTimer[4]; + /* 0x628 */ u32 mParticleKey; + /* 0x62C */ u32 mGakkiParticleKey[3]; + /* 0x638 */ u32 mLampParticleKey; + /* 0x63C */ dMsgFlow_c mMsgFlow; + /* 0x688 */ u8 mEyeAnmTimer; + /* 0x689 */ u8 mEyeAnmFrame; + /* 0x68C */ cXyz mCamCenter; + /* 0x698 */ cXyz mCamEye; + /* 0x6A4 */ cXyz mCamCenterTarget; + /* 0x6B0 */ cXyz mCamEyeTarget; + /* 0x6BC */ cXyz mCamCenterTarget2; + /* 0x6C8 */ cXyz mCamEyeTarget2; + /* 0x6D4 */ f32 mCamFovY; + /* 0x6D8 */ bool mSecondEncounter; + /* 0x6DC */ cXyz mOldLampPosition; + /* 0x6E8 */ cXyz mLampPosition; + /* 0x6F4 */ csXyz mLampAngle; + /* 0x6FA */ s16 field_0x6fa; + /* 0x6FC */ s16 field_0x6fc; + /* 0x6FE */ bool mBossLightOn; + /* 0x6FF */ bool field_0x6ff; + /* 0x700 */ mDoExt_btpAnm* mpEyeAnm; + /* 0x704 */ mDoExt_McaMorfSO* mpMorf; + /* 0x708 */ mDoExt_McaMorf* mpTrumpetMorf; + /* 0x70C */ J3DModel* mpLampModel; + /* 0x710 */ mDoExt_McaMorf* mpGlowEffectMorf; + /* 0x714 */ request_of_phase_process_class mPhase; + /* 0x71C */ u32 mShadowKey; + /* 0x720 */ Z2CreatureEnemy mCreatureSound; + /* 0x7C4 */ dBgS_AcchCir mAcchCir; + /* 0x804 */ dBgS_ObjAcch mAcch; + /* 0x9DC */ dCcD_Stts mCcStts; + /* 0xA18 */ dCcD_Cyl mCcCyl; + /* 0xB54 */ dCcU_AtInfo mAtInfo; + /* 0xB78 */ bool mHIOInit; }; -STATIC_ASSERT(sizeof(daE_PM_c) == 0xb7c); +STATIC_ASSERT(sizeof(daE_PM_c) == 0xB7C); class daE_PM_HIO_c { +public: /* 80741EEC */ daE_PM_HIO_c(); - /* 8074BA68 */ ~daE_PM_HIO_c(); + /* 8074BA68 */ virtual ~daE_PM_HIO_c() {} + + /* 0x04 */ s8 field_0x4; + /* 0x08 */ f32 mLampParticleScale; + /* 0x0C */ f32 mGlowEffectScale; + /* 0x10 */ f32 mEscapeRange; + /* 0x14 */ s16 mGlowColor1R; + /* 0x16 */ s16 mGlowColor1G; + /* 0x18 */ s16 mGlowColor1B; + /* 0x1A */ s16 mGlowColor2R; + /* 0x1C */ s16 mGlowColor2G; + /* 0x1E */ s16 mGlowColor2B; + /* 0x20 */ s16 mGlowColor1A; + /* 0x22 */ s16 mBossEscapeTimer; + /* 0x24 */ s16 field_0x24; + /* 0x26 */ s16 mAdditionalPuppetNum; + /* 0x28 */ f32 mCreateTimer; + /* 0x2C */ f32 field_0x2c; + /* 0x30 */ f32 field_0x30; + /* 0x34 */ f32 field_0x34; + /* 0x38 */ f32 mBossLightR; + /* 0x3C */ f32 mBossLightG; + /* 0x40 */ f32 mBossLightB; + /* 0x44 */ f32 field_0x44; + /* 0x48 */ f32 field_0x48; }; +STATIC_ASSERT(sizeof(daE_PM_HIO_c) == 0x4C); #endif /* D_A_E_PM_H */ diff --git a/include/d/actor/d_a_obj_sm_door.h b/include/d/actor/d_a_obj_sm_door.h index a30f9bbfa82..9e2501ef335 100644 --- a/include/d/actor/d_a_obj_sm_door.h +++ b/include/d/actor/d_a_obj_sm_door.h @@ -1,7 +1,11 @@ #ifndef D_A_OBJ_SM_DOOR_H #define D_A_OBJ_SM_DOOR_H -#include "f_op/f_op_actor_mng.h" +#include "SSystem/SComponent/c_phase.h" +#include "d/d_bg_s_acch.h" +#include "d/d_bg_s_movebg_actor.h" +#include "d/d_cc_d.h" +#include "d/d_cc_uty.h" /** * @ingroup actors-objects @@ -11,24 +15,41 @@ * @details * */ -class daObjSM_DOOR_c : public fopAc_ac_c { +class daObjSM_DOOR_c : public dBgS_MoveBgActor { public: /* 80CD8784 */ void ChangeModel(); /* 80CD8790 */ void Action(); - /* 80CD8A40 */ void SetDzb(); - /* 80CD8A90 */ void ReleaceDzb(); + /* 80CD8A40 */ int SetDzb(); + /* 80CD8A90 */ int ReleaceDzb(); /* 80CD8AF8 */ void DrawChk1(); /* 80CD8BBC */ void DrawChk2(); /* 80CD8C80 */ void setBaseMtx(); - /* 80CD8D4C */ void create(); - /* 80CD90A4 */ void CreateHeap(); - /* 80CD9258 */ void Create(); - /* 80CD929C */ void Execute(f32 (**)[3][4]); - /* 80CD930C */ void Draw(); - /* 80CD9544 */ void Delete(); + /* 80CD8D4C */ cPhs__Step create(); + /* 80CD90A4 */ int CreateHeap(); + /* 80CD9258 */ int Create(); + /* 80CD929C */ int Execute(Mtx**); + /* 80CD930C */ int Draw(); + /* 80CD9544 */ int Delete(); private: - /* 0x568 */ u8 field_0x568[0x858 - 0x568]; + /* 0x5A0 */ bool mUseAlphaModel; + /* 0x5A1 */ u8 field_0x5a1[0x5AC - 0x5A1]; + /* 0x5AC */ s16 mMode; + /* 0x5AE */ u8 field_0x5ae[0x5B8 - 0x5AE]; + /* 0x5B8 */ u8 mAlpha; + /* 0x5B9 */ u8 mType; + /* 0x5BA */ u8 mSwType; + /* 0x5BB */ u8 mSwBit; + /* 0x5BC */ bool mActive; + /* 0x5BD */ u8 field_0x5bd[0x5CC - 0x5BD]; + /* 0x5CC */ J3DModel* mpModel; + /* 0x5D0 */ J3DModel* mpAlphaModel; + /* 0x5D4 */ request_of_phase_process_class mPhase; + /* 0x5DC */ dBgS_AcchCir mAcchCir; + /* 0x61C */ dBgS_ObjAcch mAcch; + /* 0x7F4 */ dCcD_Stts mCcStts; + /* 0x830 */ dCcU_AtInfo mAtInfo; + /* 0x854 */ u8 field_0x854[0x858 - 0x854]; }; STATIC_ASSERT(sizeof(daObjSM_DOOR_c) == 0x858); diff --git a/include/d/actor/d_a_obj_smw_stone.h b/include/d/actor/d_a_obj_smw_stone.h index ce106310a46..3d523dc46a9 100644 --- a/include/d/actor/d_a_obj_smw_stone.h +++ b/include/d/actor/d_a_obj_smw_stone.h @@ -11,24 +11,33 @@ * @details * */ -class daSmWStone_c : public fopAc_ac_c { +class daSmWStone_c : public fopAc_ac_c, public request_of_phase_process_class { public: /* 80CDE538 */ daSmWStone_c(); - /* 80CDE588 */ ~daSmWStone_c(); - /* 80CDE614 */ void create(); - /* 80CDE8D8 */ void execute(); - /* 80CDE92C */ void draw(); - /* 80CDEA2C */ void Delete(); + /* 80CDE588 */ virtual ~daSmWStone_c(); + /* 80CDE614 */ cPhs__Step create(); + /* 80CDE8D8 */ int execute(); + /* 80CDE92C */ int draw(); + /* 80CDEA2C */ int Delete(); /* 80CDEAA4 */ void exeModeHowl(); /* 80CDEBA0 */ void setModelMtx(); - /* 80CDEC04 */ void createHeap(); + /* 80CDEC04 */ int createHeap(); /* 80CDED30 */ void init(); - /* 80CDED9C */ void chkWlfInRange(); + /* 80CDED9C */ bool chkWlfInRange(); int getTuneId() { return 2; } + u8 getSwBit0() { return fopAcM_GetParamBit(this, 0, 8); } + void deleteStone() { mDelete = true; } private: - /* 0x568 */ u8 field_0x568[0x5c8 - 0x568]; + /* 0x574 */ cBgS_PolyInfo mPolyInfo; + /* 0x584 */ J3DModel* mpModel; + /* 0x588 */ dBgW* mpBgW; + /* 0x58C */ Mtx mBgMtx; + /* 0x5BC */ f32 mGroundH; + /* 0x5C0 */ u32 mShadowKey; + /* 0x5C4 */ u8 mMode; + /* 0x5C5 */ bool mDelete; }; STATIC_ASSERT(sizeof(daSmWStone_c) == 0x5c8); diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index 56a03a579b3..cecd2ee3f53 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -36,7 +36,7 @@ class cBgS { public: cBgS() {} bool Regist(dBgW_Base*, fpc_ProcID, void*); - int Release(dBgW_Base*); + bool Release(dBgW_Base*); bool LineCross(cBgS_LinChk*); f32 GroundCross(cBgS_GndChk*); static void* ConvDzb(void*); diff --git a/include/f_op/f_op_actor_enemy.h b/include/f_op/f_op_actor_enemy.h index 049f7381f38..675625559fc 100644 --- a/include/f_op/f_op_actor_enemy.h +++ b/include/f_op/f_op_actor_enemy.h @@ -8,7 +8,6 @@ #include "d/d_com_inf_game.h" #include "d/d_s_play.h" -// NONMATCHING ? static int setMidnaBindEffect(fopEn_enemy_c* i_actorP, Z2CreatureEnemy* i_creatureP, cXyz* i_effPos, cXyz* i_effSize) { static GXColor e_prim[] = { diff --git a/src/d/actor/d_a_e_fs.cpp b/src/d/actor/d_a_e_fs.cpp index b44b19beb36..6a80a2d208a 100644 --- a/src/d/actor/d_a_e_fs.cpp +++ b/src/d/actor/d_a_e_fs.cpp @@ -1,1215 +1,879 @@ /** * @file d_a_e_fs.cpp - * + * Enemy - Puppet */ #include "d/actor/d_a_e_fs.h" -#include "d/d_cc_d.h" -#include "dol2asm.h" - - - -// -// Forward References: -// - -extern "C" void __ct__12daE_Fs_HIO_cFv(); -extern "C" static void anm_init__FP10e_fs_classifUcf(); -extern "C" static void daE_Fs_Draw__FP10e_fs_class(); -extern "C" static void way_bg_check__FP10e_fs_classfs(); -extern "C" static void e_fs_appear__FP10e_fs_class(); -extern "C" static void e_fs_wait__FP10e_fs_class(); -extern "C" static void e_fs_move__FP10e_fs_class(); -extern "C" static void e_fs_attack__FP10e_fs_class(); -extern "C" static void e_fs_damage__FP10e_fs_class(); -extern "C" static void e_fs_end__FP10e_fs_class(); -extern "C" static void damage_check__FP10e_fs_class(); -extern "C" static void checkViewArea__FP4cXyz(); -extern "C" static void e_fs_demowait__FP10e_fs_class(); -extern "C" static void action__FP10e_fs_class(); -extern "C" static void daE_Fs_Execute__FP10e_fs_class(); -extern "C" static bool daE_Fs_IsDelete__FP10e_fs_class(); -extern "C" static void daE_Fs_Delete__FP10e_fs_class(); -extern "C" static void useHeapIe_fst__FP10fopAc_ac_c(); -extern "C" static void daE_Fs_Create__FP10fopAc_ac_c(); -extern "C" void __dt__8cM3dGSphFv(); -extern "C" void __dt__8cM3dGCylFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__10dCcD_GSttsFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__12dBgS_AcchCirFv(); -extern "C" void __dt__10cCcD_GSttsFv(); -extern "C" void __dt__12daE_Fs_HIO_cFv(); -extern "C" void __sinit_d_a_e_fs_cpp(); -extern "C" static void func_806BE018(); -extern "C" static void func_806BE020(); -extern "C" static void setMidnaBindEffect__FP13fopEn_enemy_cP15Z2CreatureEnemyP4cXyzP4cXyz(); -extern "C" void __dt__4cXyzFv(); -extern "C" extern char const* const d_a_e_fs__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_YrotS__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void scaleM__14mDoMtx_stack_cFfff(); -extern "C" void -__ct__16mDoExt_McaMorfSOFP12J3DModelDataP25mDoExt_McaMorfCallBack1_cP25mDoExt_McaMorfCallBack2_cP15J3DAnmTransformifiiP10Z2CreatureUlUl(); -extern "C" void setAnm__16mDoExt_McaMorfSOFP15J3DAnmTransformiffff(); -extern "C" void play__16mDoExt_McaMorfSOFUlSc(); -extern "C" void entryDL__16mDoExt_McaMorfSOFv(); -extern "C" void modelCalc__16mDoExt_McaMorfSOFv(); -extern "C" void stopZelAnime__16mDoExt_McaMorfSOFv(); -extern "C" void mDoLib_project__FP3VecP3Vec(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_SearchByID__FUiPP10fopAc_ac_c(); -extern "C" void fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_SetMin__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_SetMax__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_searchActorAngleY__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fopAcM_searchActorDistanceXZ__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fopAcM_createDisappear__FPC10fopAc_ac_cPC4cXyzUcUcUc(); -extern "C" void fopAcM_effSmokeSet1__FPUlPUlPC4cXyzPC5csXyzfPC12dKy_tevstr_ci(); -extern "C" void gndCheck__11fopAcM_gc_cFPC4cXyz(); -extern "C" void fpcSch_JudgeForPName__FPvPv(); -extern "C" void fpcSch_JudgeByID__FPvPv(); -extern "C" void getLayerNo__14dComIfG_play_cFi(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGp_getReverb__Fi(); -extern "C" void dComIfGs_onZoneSwitch__Fii(); -extern "C" void dComIfGs_isZoneSwitch__Fii(); -extern "C" void -dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj(); -extern "C" void isEventBit__11dSv_event_cCFUs(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void -set__13dPa_control_cFUlUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void LineCross__4cBgSFP11cBgS_LinChk(); -extern "C" void GroundCross__4cBgSFP11cBgS_GndChk(); -extern "C" void GetSpecialCode__4dBgSFRC13cBgS_PolyInfo(); -extern "C" void __ct__12dBgS_AcchCirFv(); -extern "C" void SetWall__12dBgS_AcchCirFff(); -extern "C" void __dt__9dBgS_AcchFv(); -extern "C" void __ct__9dBgS_AcchFv(); -extern "C" void Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz(); -extern "C" void CrrPos__9dBgS_AcchFR4dBgS(); -extern "C" void __ct__11dBgS_GndChkFv(); -extern "C" void __dt__11dBgS_GndChkFv(); -extern "C" void __ct__18dBgS_ObjGndChk_SplFv(); -extern "C" void __dt__18dBgS_ObjGndChk_SplFv(); -extern "C" void __ct__11dBgS_LinChkFv(); -extern "C" void __dt__11dBgS_LinChkFv(); -extern "C" void Set__11dBgS_LinChkFPC4cXyzPC4cXyzPC10fopAc_ac_c(); -extern "C" void SetObj__16dBgS_PolyPassChkFv(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Move__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void ChkAtHit__12dCcD_GObjInfFv(); -extern "C" void ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void GetTgHitObj__12dCcD_GObjInfFv(); -extern "C" void Set__8dCcD_CylFRC11dCcD_SrcCyl(); -extern "C" void Set__8dCcD_SphFRC11dCcD_SrcSph(); -extern "C" void StartCAt__8dCcD_SphFR4cXyz(); -extern "C" void MoveCAt__8dCcD_SphFR4cXyz(); -extern "C" void cc_at_check__FP10fopAc_ac_cP11dCcU_AtInfo(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void dKy_darkworld_check__Fv(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void __ml__4cXyzCFf(); -extern "C" void cM_atan2s__Fff(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void SetPos__11cBgS_GndChkFPC4cXyz(); -extern "C" void __dt__13cBgS_PolyInfoFv(); -extern "C" void __dt__8cM3dGCirFv(); -extern "C" void SetC__8cM3dGCylFRC4cXyz(); -extern "C" void SetC__8cM3dGSphFRC4cXyz(); -extern "C" void SetR__8cM3dGSphFf(); -extern "C" void cLib_addCalc2__FPffff(); -extern "C" void cLib_addCalc0__FPfff(); -extern "C" void cLib_addCalcAngleS2__FPssss(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -extern "C" void __ct__15Z2CreatureEnemyFv(); -extern "C" void init__15Z2CreatureEnemyFP3VecP3VecUcUc(); -extern "C" void setLinkSearch__15Z2CreatureEnemyFb(); -extern "C" void setEnemyName__15Z2CreatureEnemyFPCc(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void checkPass__12J3DFrameCtrlFf(); -extern "C" void _savegpr_19(); -extern "C" void _savegpr_23(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_19(); -extern "C" void _restgpr_23(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" u8 saveBitLabels__16dSv_event_flag_c[1644 + 4 /* padding */]; -extern "C" extern void* __vt__8dCcD_Sph[36]; -extern "C" extern void* __vt__8dCcD_Cyl[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_SphAttr[25]; -extern "C" extern void* __vt__12cCcD_CylAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" extern void* calc_mtx[1 + 1 /* padding */]; -extern "C" f32 mGroundY__11fopAcM_gc_c; -extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 806BE48C-806BE490 000000 0004+00 16/16 0/0 0/0 .rodata @3917 */ -SECTION_RODATA static f32 const lit_3917 = 100.0f; -COMPILER_STRIP_GATE(0x806BE48C, &lit_3917); - -/* 806BE490-806BE494 000004 0004+00 2/10 0/0 0/0 .rodata @3918 */ -SECTION_RODATA static u8 const lit_3918[4] = { - 0x00, - 0x00, - 0x00, - 0x00, +#include "SSystem/SComponent/c_math.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "m_Do/m_Do_lib.h" +#include "d/d_com_inf_game.h" +#include "d/actor/d_a_e_pm.h" +#include "d/actor/d_a_npc_ks.h" +#include "d/actor/d_a_player.h" +UNK_REL_DATA +#include "f_op/f_op_actor_enemy.h" +#include "Z2AudioLib/Z2Instances.h" + +enum Animation { + /* 0x4 */ ANM_APPEAR = 4, + /* 0x5 */ ANM_ATTACK01, + /* 0x6 */ ANM_DAMAGE, + /* 0x7 */ ANM_DIE, + /* 0x8 */ ANM_MOVE, + /* 0x9 */ ANM_WAIT01, }; -COMPILER_STRIP_GATE(0x806BE490, &lit_3918); -/* 806BE494-806BE49C 000008 0004+04 1/10 0/0 0/0 .rodata @3919 */ -SECTION_RODATA static f32 const lit_3919[1 + 1 /* padding */] = { - 1.0f, - /* padding */ - 0.0f, +enum Joint { + /* 0x00 */ JNT_CENTER, + /* 0x01 */ JNT_BACKBONE, + /* 0x02 */ JNT_ARM_L1, + /* 0x03 */ JNT_ARM_L2, + /* 0x04 */ JNT_HAND_L, + /* 0x05 */ JNT_ARM_R1, + /* 0x06 */ JNT_ARM_R2, + /* 0x07 */ JNT_HAND_R, + /* 0x08 */ JNT_CLOAK1, + /* 0x09 */ JNT_CLOAK2, + /* 0x0A */ JNT_CLOAK3, + /* 0x0B */ JNT_HEAD, + /* 0x0C */ JNT_NECKLESS1, + /* 0x0D */ JNT_NECKLESS2, + /* 0x0E */ JNT_WAIST, + /* 0x0F */ JNT_LEG_L1, + /* 0x10 */ JNT_LEG_L2, + /* 0x11 */ JNT_FOOT_L, + /* 0x12 */ JNT_LEG_R1, + /* 0x13 */ JNT_LEG_R2, + /* 0x14 */ JNT_FOOT_R, }; -COMPILER_STRIP_GATE(0x806BE494, &lit_3919); -/* 806BE49C-806BE4A4 000010 0008+00 0/2 0/0 0/0 .rodata @3920 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3920[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x806BE49C, &lit_3920); -#pragma pop - -/* 806BE4A4-806BE4AC 000018 0008+00 0/2 0/0 0/0 .rodata @3921 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3921[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x806BE4A4, &lit_3921); -#pragma pop - -/* 806BE4AC-806BE4B4 000020 0008+00 0/2 0/0 0/0 .rodata @3922 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3922[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x806BE4AC, &lit_3922); -#pragma pop - -/* 806BE4B4-806BE4B8 000028 0004+00 0/1 0/0 0/0 .rodata @3923 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3923 = 1.0f / 100.0f; -COMPILER_STRIP_GATE(0x806BE4B4, &lit_3923); -#pragma pop - -/* 806BE4B8-806BE4BC 00002C 0004+00 0/1 0/0 0/0 .rodata @3938 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3938 = 350.0f; -COMPILER_STRIP_GATE(0x806BE4B8, &lit_3938); -#pragma pop - -/* 806BE4BC-806BE4C0 000030 0004+00 0/1 0/0 0/0 .rodata @3939 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3939 = 170.0f; -COMPILER_STRIP_GATE(0x806BE4BC, &lit_3939); -#pragma pop - -/* 806BE4C0-806BE4C4 000034 0004+00 0/2 0/0 0/0 .rodata @3940 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3940 = 2000.0f; -COMPILER_STRIP_GATE(0x806BE4C0, &lit_3940); -#pragma pop - -/* 806BE580-806BE58C 000000 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 806BE58C-806BE5A0 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { - 0x02000201, - /* padding */ - 0x40080000, - 0x00000000, - 0x3FE00000, - 0x00000000, -}; -#pragma pop - -/* 806BE5A0-806BE5A8 000020 0008+00 0/1 0/0 0/0 .data e_prim$3796 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 e_prim[8] = { - 0xFF, 0x78, 0x00, 0x00, 0xFF, 0x64, 0x78, 0x00, -}; -#pragma pop - -/* 806BE5A8-806BE5B0 000028 0008+00 0/1 0/0 0/0 .data e_env$3797 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 e_env[8] = { - 0x5A, 0x2D, 0x2D, 0x00, 0x3C, 0x1E, 0x1E, 0x00, -}; -#pragma pop - -/* 806BE5B0-806BE5B8 000030 0006+02 0/1 0/0 0/0 .data eff_id$3805 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 eff_id[6 + 2 /* padding */] = { - 0x02, - 0x9D, - 0x02, - 0x9E, - 0x02, - 0x9F, - /* padding */ - 0x00, - 0x00, -}; -#pragma pop +UNK_BSS(1109) +UNK_BSS(1107) +UNK_BSS(1105) +UNK_BSS(1104) +UNK_BSS(1099) +UNK_BSS(1097) +UNK_BSS(1095) +UNK_BSS(1094) +UNK_BSS(1057) +UNK_BSS(1055) +UNK_BSS(1053) +UNK_BSS(1052) +UNK_BSS(1014) +UNK_BSS(1012) +UNK_BSS(1010) + +namespace { -/* 806BE5B8-806BE5C0 000038 0008+00 1/1 0/0 0/0 .data w_eff_id$4278 */ -SECTION_DATA static u8 w_eff_id[8] = { - 0x01, 0xB8, 0x01, 0xB9, 0x01, 0xBA, 0x01, 0xBB, -}; - -/* 806BE5C0-806BE5DC -00001 001C+00 1/1 0/0 0/0 .data @4449 */ -SECTION_DATA static void* lit_4449[7] = { - (void*)(((char*)e_fs_demowait__FP10e_fs_class) + 0x5C), - (void*)(((char*)e_fs_demowait__FP10e_fs_class) + 0xA8), - (void*)(((char*)e_fs_demowait__FP10e_fs_class) + 0x118), - (void*)(((char*)e_fs_demowait__FP10e_fs_class) + 0x190), - (void*)(((char*)e_fs_demowait__FP10e_fs_class) + 0x220), - (void*)(((char*)e_fs_demowait__FP10e_fs_class) + 0x1E4), - (void*)(((char*)e_fs_demowait__FP10e_fs_class) + 0x1FC), -}; - -/* 806BE5DC-806BE608 -00001 002C+00 1/1 0/0 0/0 .data @4546 */ -SECTION_DATA static void* lit_4546[11] = { - (void*)(((char*)action__FP10e_fs_class) + 0x88), - (void*)(((char*)action__FP10e_fs_class) + 0x98), - (void*)(((char*)action__FP10e_fs_class) + 0xA8), - (void*)(((char*)action__FP10e_fs_class) + 0x11C), - (void*)(((char*)action__FP10e_fs_class) + 0x12C), - (void*)(((char*)action__FP10e_fs_class) + 0x138), - (void*)(((char*)action__FP10e_fs_class) + 0x14C), - (void*)(((char*)action__FP10e_fs_class) + 0x14C), - (void*)(((char*)action__FP10e_fs_class) + 0x14C), - (void*)(((char*)action__FP10e_fs_class) + 0x14C), - (void*)(((char*)action__FP10e_fs_class) + 0x144), -}; - -/* 806BE608-806BE64C 000088 0044+00 1/1 0/0 0/0 .data cc_cyl_src$4689 */ -static dCcD_SrcCyl cc_cyl_src = { - { - {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdff, 0x43}, 0x75}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x4, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {0.0f, 0.0f, 0.0f}, // mCenter - 80.0f, // mRadius - 230.0f // mHeight - } // mCyl -}; - -/* 806BE64C-806BE68C 0000CC 0040+00 1/1 0/0 0/0 .data at_sph_src$4690 */ -static dCcD_SrcSph at_sph_src = { - { - {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0x0, 0x0}, 0x0}}, // mObj - {dCcD_SE_17, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {{0.0f, 0.0f, 0.0f}, 30.0f} // mSph - } // mSphAttr -}; - -/* 806BE68C-806BE6AC -00001 0020+00 1/0 0/0 0/0 .data l_daE_Fs_Method */ -static actor_method_class l_daE_Fs_Method = { - (process_method_func)daE_Fs_Create__FP10fopAc_ac_c, - (process_method_func)daE_Fs_Delete__FP10e_fs_class, - (process_method_func)daE_Fs_Execute__FP10e_fs_class, - (process_method_func)daE_Fs_IsDelete__FP10e_fs_class, - (process_method_func)daE_Fs_Draw__FP10e_fs_class, -}; - -/* 806BE6AC-806BE6DC -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_FS */ -extern actor_process_profile_definition g_profile_E_FS = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_E_FS, // mProcName - &g_fpcLf_Method.mBase, // sub_method - sizeof(e_fs_class), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 160, // mPriority - &l_daE_Fs_Method, // sub_method - 0x00040120, // mStatus - fopAc_ENEMY_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType -}; - -/* 806BE6DC-806BE6E8 00015C 000C+00 1/1 0/0 0/0 .data __vt__12dBgS_AcchCir */ -SECTION_DATA extern void* __vt__12dBgS_AcchCir[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_AcchCirFv, -}; - -/* 806BE6E8-806BE6F4 000168 000C+00 2/2 0/0 0/0 .data __vt__10cCcD_GStts */ -SECTION_DATA extern void* __vt__10cCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10cCcD_GSttsFv, -}; - -/* 806BE6F4-806BE700 000174 000C+00 1/1 0/0 0/0 .data __vt__10dCcD_GStts */ -SECTION_DATA extern void* __vt__10dCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10dCcD_GSttsFv, -}; - -/* 806BE700-806BE70C 000180 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGSph */ -SECTION_DATA extern void* __vt__8cM3dGSph[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGSphFv, -}; - -/* 806BE70C-806BE718 00018C 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGCyl */ -SECTION_DATA extern void* __vt__8cM3dGCyl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGCylFv, -}; +/* 806BE79C-806BE7A0 -00001 0004+00 1/1 0/0 0/0 .bss None */ +/* 806BE79C 0001+01 data_806BE79C @1009 */ +/* 806BE79E 0002+00 data_806BE79E s_AtCount__22@unnamed@d_a_e_fs_cpp@ */ +static u8 data_806BE79C[2]; +static s16 s_AtCount; -/* 806BE718-806BE724 000198 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; +} // namespace -/* 806BE724-806BE748 0001A4 0024+00 2/2 0/0 0/0 .data __vt__12dBgS_ObjAcch */ -SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_ObjAcchFv, - (void*)NULL, - (void*)NULL, - (void*)func_806BE020, - (void*)NULL, - (void*)NULL, - (void*)func_806BE018, -}; +/* 806BE7A0-806BE7A4 000048 0004+00 2/2 0/0 0/0 .bss None */ +static bool hioInit; -/* 806BE748-806BE754 0001C8 000C+00 2/2 0/0 0/0 .data __vt__12daE_Fs_HIO_c */ -SECTION_DATA extern void* __vt__12daE_Fs_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12daE_Fs_HIO_cFv, -}; +/* 806BE7B0-806BE7CC 000058 001C+00 6/6 0/0 0/0 .bss l_HIO */ +static daE_Fs_HIO_c l_HIO; /* 806BBACC-806BBB10 0000EC 0044+00 1/1 0/0 0/0 .text __ct__12daE_Fs_HIO_cFv */ daE_Fs_HIO_c::daE_Fs_HIO_c() { - // NONMATCHING + field_0x4 = -1; + mScale = 1.0f; + mAttackRange = 350.0f; + mAttackDistance = 170.0f; + mMoveSpeedRatio = 1.0f; + mDeleteRange = 2000.0f; } -/* ############################################################################################## */ -/* 806BE4C4-806BE4C8 000038 0004+00 1/1 0/0 0/0 .rodata @3954 */ -SECTION_RODATA static f32 const lit_3954 = -1.0f; -COMPILER_STRIP_GATE(0x806BE4C4, &lit_3954); - -/* 806BE564-806BE564 0000D8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_806BE564 = "E_FS"; -#pragma pop - /* 806BBB10-806BBBBC 000130 00AC+00 7/7 0/0 0/0 .text anm_init__FP10e_fs_classifUcf */ -static void anm_init(e_fs_class* param_0, int param_1, f32 param_2, u8 param_3, f32 param_4) { - // NONMATCHING +static void anm_init(e_fs_class* i_this, int i_anm, f32 i_morf, u8 i_attr, f32 i_rate) { + i_this->mpMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("E_FS", i_anm), + i_attr, i_morf, i_rate, 0.0f, -1.0f); + i_this->mAnm = i_anm; } -/* ############################################################################################## */ -/* 806BE4C8-806BE4CC 00003C 0004+00 0/3 0/0 0/0 .rodata @3984 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3984 = 1000.0f; -COMPILER_STRIP_GATE(0x806BE4C8, &lit_3984); -#pragma pop - -/* 806BE4CC-806BE4D0 000040 0004+00 0/4 0/0 0/0 .rodata @3985 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3985 = 50.0f; -COMPILER_STRIP_GATE(0x806BE4CC, &lit_3985); -#pragma pop - /* 806BBBBC-806BBCDC 0001DC 0120+00 1/0 0/0 0/0 .text daE_Fs_Draw__FP10e_fs_class */ -static void daE_Fs_Draw(e_fs_class* param_0) { - // NONMATCHING +static int daE_Fs_Draw(e_fs_class* i_this) { + J3DModel* model = i_this->mpMorf->getModel(); + g_env_light.settingTevStruct(0, &i_this->current.pos, &i_this->tevStr); + g_env_light.setLightTevColorType_MAJI(model, &i_this->tevStr); + J3DModelData* model_data = model->getModelData(); + for (u16 i = 0; i < model_data->getMaterialNum(); i++) { + model_data->getMaterialNodePointer(i)->getTevKColor(3)->a = 0xff; + } + i_this->mpMorf->entryDL(); + cXyz pos(i_this->current.pos.x, i_this->current.pos.y + 100.0f, i_this->current.pos.z); + i_this->mShadowKey = dComIfGd_setShadow(i_this->mShadowKey, 1, model, &pos, 1000.0f, 50.0f, + i_this->current.pos.y, i_this->mAcch.GetGroundH(), + i_this->mAcch.m_gnd, &i_this->tevStr, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + return 1; } /* 806BBCDC-806BBDF4 0002FC 0118+00 1/1 0/0 0/0 .text way_bg_check__FP10e_fs_classfs */ -static void way_bg_check(e_fs_class* param_0, f32 param_1, s16 param_2) { - // NONMATCHING +static BOOL way_bg_check(e_fs_class* i_this, f32 i_offset, s16 i_angle) { + fopAc_ac_c* _this = static_cast(i_this); + dBgS_LinChk lin_chk; + cXyz vec, start, end; + start = _this->current.pos; + start.y += 100.0f; + mDoMtx_YrotS(*calc_mtx, i_angle); + vec.set(0.0f, 100.0f, i_offset); + MtxPosition(&vec, &end); + end += _this->current.pos; + lin_chk.Set(&start, &end, _this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return TRUE; + } else { + return FALSE; + } } -/* ############################################################################################## */ -/* 806BE4D0-806BE4D4 000044 0004+00 0/3 0/0 0/0 .rodata @4075 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4075 = 10000.0f; -COMPILER_STRIP_GATE(0x806BE4D0, &lit_4075); -#pragma pop - -/* 806BE4D4-806BE4D8 000048 0004+00 0/4 0/0 0/0 .rodata @4076 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4076 = 10.0f; -COMPILER_STRIP_GATE(0x806BE4D4, &lit_4076); -#pragma pop - -/* 806BE4D8-806BE4DC 00004C 0004+00 0/1 0/0 0/0 .rodata @4077 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4077 = 38.0f; -COMPILER_STRIP_GATE(0x806BE4D8, &lit_4077); -#pragma pop - -/* 806BE4DC-806BE4E0 000050 0004+00 0/3 0/0 0/0 .rodata @4078 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4078 = 200.0f; -COMPILER_STRIP_GATE(0x806BE4DC, &lit_4078); -#pragma pop - -/* 806BE4E0-806BE4E4 000054 0004+00 0/4 0/0 0/0 .rodata @4079 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4079 = 7.0f / 10.0f; -COMPILER_STRIP_GATE(0x806BE4E0, &lit_4079); -#pragma pop - -/* 806BE4E4-806BE4E8 000058 0004+00 0/4 0/0 0/0 .rodata @4080 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4080 = 0.5f; -COMPILER_STRIP_GATE(0x806BE4E4, &lit_4080); -#pragma pop - /* 806BBDF4-806BC0A8 000414 02B4+00 1/1 0/0 0/0 .text e_fs_appear__FP10e_fs_class */ -static void e_fs_appear(e_fs_class* param_0) { - // NONMATCHING +static void e_fs_appear(e_fs_class* i_this) { + daE_PM_c* skullkid; + fopAcM_SearchByID(i_this->parentActorID, (fopAc_ac_c**)&skullkid); + + switch (i_this->mMode) { + case -1: + switch (i_this->field_0x5b5) { + case 1: + i_this->mTimer[0] = 40; + break; + case 2: + i_this->mTimer[0] = 50; + break; + case 3: + i_this->mTimer[0] = 160; + break; + case 4: + i_this->mTimer[0] = 150; + break; + } + + i_this->mMode = 1; + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + break; + + case 0: + i_this->mTimer[0] = (fopAcM_GetID(i_this) & 3) * 10; + i_this->mMode++; + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + // fallthrough + + case 1: + i_this->current.pos.y = i_this->home.pos.y + 10000.0f; + i_this->mIFrameTimer = 5; + + if (i_this->mTimer[0] == 0) { + i_this->current.pos.y = i_this->home.pos.y; + i_this->old.pos = i_this->current.pos; + anm_init(i_this, ANM_APPEAR, 10.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f); + i_this->mMode++; + i_this->current.angle.y = i_this->mPlayerAngleY; + i_this->attention_info.flags = 4; + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_APPEAR, 0, -1); + } + break; + + case 2: + if (i_this->mpMorf->checkFrame(38.0f)) { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_POSE, 0, -1); + } + + if (i_this->mpMorf->isStop()) { + i_this->mAction = e_fs_class::ACT_WAIT; + i_this->mMode = 0; + } + break; + } + + if (skullkid != NULL && skullkid->SwitchChk() != 0 && skullkid->SwitchChk() != 4 + && i_this->mPlayerDistXZ > 200.0f) { + i_this->current.angle.y = i_this->mPlayerAngleY; + cLib_addCalc2(&i_this->speedF, fopAcM_GetSpeedF(daPy_getPlayerActorClass()) * 0.7f, + 1.0f, 0.5f); + } } -/* ############################################################################################## */ -/* 806BE4E8-806BE4EC 00005C 0004+00 0/3 0/0 0/0 .rodata @4117 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4117 = 2.0f; -COMPILER_STRIP_GATE(0x806BE4E8, &lit_4117); -#pragma pop - -/* 806BE4EC-806BE4F0 000060 0004+00 0/1 0/0 0/0 .rodata @4118 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4118 = 60.0f; -COMPILER_STRIP_GATE(0x806BE4EC, &lit_4118); -#pragma pop - -/* 806BE4F0-806BE4F4 000064 0004+00 0/1 0/0 0/0 .rodata @4119 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4119 = 4.0f; -COMPILER_STRIP_GATE(0x806BE4F0, &lit_4119); -#pragma pop - /* 806BC0A8-806BC264 0006C8 01BC+00 1/1 0/0 0/0 .text e_fs_wait__FP10e_fs_class */ -static void e_fs_wait(e_fs_class* param_0) { - // NONMATCHING +// NONMATCHING regalloc +static void e_fs_wait(e_fs_class* i_this) { + daE_PM_c* skullkid; + fopAcM_SearchByID(i_this->parentActorID, (fopAc_ac_c**)&skullkid); + + switch (i_this->mMode) { + case -1: + i_this->mTimer[1] = 2; + // fallthrough + + case 0: + anm_init(i_this, ANM_WAIT01, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 1; + i_this->mTimer[0] = cM_rndF(60.0f) + 2.0f; + break; + + case 1: + if (i_this->mTimer[1] == 1) { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_POSE, 0, -1); + } + + if (i_this->mpMorf->checkFrame(4.0f)) { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_KUBIKASIGE, 0, -1); + } + + if (i_this->mTimer[0] == 0) { + i_this->mAction = e_fs_class::ACT_MOVE; + i_this->mMode = 0; + } + break; + } + + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mPlayerAngleY, 0x10, 0x400); + if (skullkid != NULL && skullkid->SwitchChk() != 0 && skullkid->SwitchChk() != 4 + && i_this->mPlayerDistXZ > 200.0f) { + cLib_addCalc2(&i_this->speedF, fopAcM_GetSpeedF(daPy_getPlayerActorClass()) * 0.7f, + 1.0f, 0.5f); + } } -/* ############################################################################################## */ -/* 806BE4F4-806BE4F8 000068 0004+00 0/2 0/0 0/0 .rodata @4155 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4155 = 20.0f; -COMPILER_STRIP_GATE(0x806BE4F4, &lit_4155); -#pragma pop - -/* 806BE4F8-806BE4FC 00006C 0004+00 0/1 0/0 0/0 .rodata @4156 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4156 = 4.0f / 5.0f; -COMPILER_STRIP_GATE(0x806BE4F8, &lit_4156); -#pragma pop - -/* 806BE4FC-806BE500 000070 0004+00 0/2 0/0 0/0 .rodata @4157 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4157 = 5.0f; -COMPILER_STRIP_GATE(0x806BE4FC, &lit_4157); -#pragma pop - -/* 806BE500-806BE504 000074 0004+00 0/2 0/0 0/0 .rodata @4158 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4158 = 300.0f; -COMPILER_STRIP_GATE(0x806BE500, &lit_4158); -#pragma pop - -/* 806BE504-806BE508 000078 0004+00 0/1 0/0 0/0 .rodata @4159 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4159 = 32000.0f; -COMPILER_STRIP_GATE(0x806BE504, &lit_4159); -#pragma pop - -/* 806BE760-806BE764 000008 0001+03 1/1 0/0 0/0 .bss @1109 */ -static u8 lit_1109[1 + 3 /* padding */]; - -/* 806BE764-806BE768 00000C 0001+03 0/0 0/0 0/0 .bss @1107 */ -#pragma push -#pragma force_active on -static u8 lit_1107[1 + 3 /* padding */]; -#pragma pop - -/* 806BE768-806BE76C 000010 0001+03 0/0 0/0 0/0 .bss @1105 */ -#pragma push -#pragma force_active on -static u8 lit_1105[1 + 3 /* padding */]; -#pragma pop - -/* 806BE76C-806BE770 000014 0001+03 0/0 0/0 0/0 .bss @1104 */ -#pragma push -#pragma force_active on -static u8 lit_1104[1 + 3 /* padding */]; -#pragma pop - -/* 806BE770-806BE774 000018 0001+03 0/0 0/0 0/0 .bss @1099 */ -#pragma push -#pragma force_active on -static u8 lit_1099[1 + 3 /* padding */]; -#pragma pop - -/* 806BE774-806BE778 00001C 0001+03 0/0 0/0 0/0 .bss @1097 */ -#pragma push -#pragma force_active on -static u8 lit_1097[1 + 3 /* padding */]; -#pragma pop - -/* 806BE778-806BE77C 000020 0001+03 0/0 0/0 0/0 .bss @1095 */ -#pragma push -#pragma force_active on -static u8 lit_1095[1 + 3 /* padding */]; -#pragma pop - -/* 806BE77C-806BE780 000024 0001+03 0/0 0/0 0/0 .bss @1094 */ -#pragma push -#pragma force_active on -static u8 lit_1094[1 + 3 /* padding */]; -#pragma pop - -/* 806BE780-806BE784 000028 0001+03 0/0 0/0 0/0 .bss @1057 */ -#pragma push -#pragma force_active on -static u8 lit_1057[1 + 3 /* padding */]; -#pragma pop - -/* 806BE784-806BE788 00002C 0001+03 0/0 0/0 0/0 .bss @1055 */ -#pragma push -#pragma force_active on -static u8 lit_1055[1 + 3 /* padding */]; -#pragma pop - -/* 806BE788-806BE78C 000030 0001+03 0/0 0/0 0/0 .bss @1053 */ -#pragma push -#pragma force_active on -static u8 lit_1053[1 + 3 /* padding */]; -#pragma pop - -/* 806BE78C-806BE790 000034 0001+03 0/0 0/0 0/0 .bss @1052 */ -#pragma push -#pragma force_active on -static u8 lit_1052[1 + 3 /* padding */]; -#pragma pop - -/* 806BE790-806BE794 000038 0001+03 0/0 0/0 0/0 .bss @1014 */ -#pragma push -#pragma force_active on -static u8 lit_1014[1 + 3 /* padding */]; -#pragma pop - -/* 806BE794-806BE798 00003C 0001+03 0/0 0/0 0/0 .bss @1012 */ -#pragma push -#pragma force_active on -static u8 lit_1012[1 + 3 /* padding */]; -#pragma pop - -/* 806BE798-806BE79C 000040 0001+03 0/0 0/0 0/0 .bss @1010 */ -#pragma push -#pragma force_active on -static u8 lit_1010[1 + 3 /* padding */]; -#pragma pop - -/* 806BE79C-806BE7A0 -00001 0004+00 1/1 0/0 0/0 .bss None */ -/* 806BE79C 0001+01 data_806BE79C @1009 */ -/* 806BE79E 0002+00 data_806BE79E s_AtCount__22@unnamed@d_a_e_fs_cpp@ */ -static u8 struct_806BE79C[4]; - -/* 806BE7A0-806BE7A4 000048 0004+00 2/2 0/0 0/0 .bss None */ -static u8 data_806BE7A0[4]; - -/* 806BE7A4-806BE7B0 00004C 000C+00 1/1 0/0 0/0 .bss @3933 */ -static u8 lit_3933[12]; - -/* 806BE7B0-806BE7CC 000058 001C+00 6/6 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[28]; - /* 806BC264-806BC444 000884 01E0+00 1/1 0/0 0/0 .text e_fs_move__FP10e_fs_class */ -static void e_fs_move(e_fs_class* param_0) { - // NONMATCHING +// NONMATCHING regalloc +static void e_fs_move(e_fs_class* i_this) { + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_MOVE, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode++; + // fallthrough + + case 1: + if (i_this->mPlayerDistXZ < l_HIO.mAttackRange) { + i_this->mAction = e_fs_class::ACT_ATTACK; + i_this->mMode = 0; + } + break; + } + + f32 target_speed = l_HIO.mMoveSpeedRatio + * (0.8f * fopAcM_GetSpeedF(daPy_getPlayerActorClass()) + 20.0f); + if (!daPy_py_c::i_checkNowWolf()) { + target_speed = 0.7f * (0.8f * fopAcM_GetSpeedF(daPy_getPlayerActorClass()) + 20.0f); + } + cLib_addCalc2(&i_this->speedF, target_speed, 1.0f, 0.5f); + if (i_this->speedF >= 5.0f) { + i_this->mCreatureSound.startCreatureSoundLevel(Z2SE_EN_FS_MOVE, 0, -1); + } + + if (way_bg_check(i_this, 300.0f, i_this->mTargetAngleY) && i_this->field_0x5b6 == 0) { + for (int i = 0; i < 100; i++) { + i_this->mTargetAngleY = cM_rndFX(32000.0f); + if (!way_bg_check(i_this, 300.0f, i_this->mTargetAngleY)) { + i_this->mTimer[0] = 50; + i_this->field_0x5b6 = 1; + break; + } + } + } else if (i_this->mTimer[0] == 0) { + i_this->field_0x5b6 = 0; + i_this->mTargetAngleY = i_this->mPlayerAngleY; + } + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 0x10, 0x400); } -/* ############################################################################################## */ -/* 806BE508-806BE50C 00007C 0004+00 0/1 0/0 0/0 .rodata @4237 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4237 = 9.0f; -COMPILER_STRIP_GATE(0x806BE508, &lit_4237); -#pragma pop - -/* 806BE50C-806BE510 000080 0004+00 0/1 0/0 0/0 .rodata @4238 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4238 = -10.0f; -COMPILER_STRIP_GATE(0x806BE50C, &lit_4238); -#pragma pop - /* 806BC444-806BC750 000A64 030C+00 1/1 0/0 0/0 .text e_fs_attack__FP10e_fs_class */ -static void e_fs_attack(e_fs_class* param_0) { - // NONMATCHING +static void e_fs_attack(e_fs_class* i_this) { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + int frame = i_this->mpMorf->getFrame(); + + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_ATTACK01, 5.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f); + i_this->mPlayerPos = player->current.pos; + i_this->mMode++; + break; + + case 1: + if (i_this->mpMorf->checkFrame(9.0f)) { + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_BACKSWING, 0, -1); + } + + if (frame >= 31 && frame < 36) { + if (frame == 31) { + i_this->field_0x692 = 1; + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_ATTACK, 0, -1); + } else { + i_this->field_0x692 = 2; + } + } + + if (i_this->mpMorf->isStop()) { + i_this->mAction = e_fs_class::ACT_WAIT; + i_this->mMode = -1; + } + break; + } + + cXyz delta = i_this->mPlayerPos - i_this->current.pos; + f32 target_speed = 0.0f; + f32 dist = delta.abs(); + if (dist < l_HIO.mAttackDistance - 50.0f) { + target_speed = -10.0f; + } else if (dist > l_HIO.mAttackDistance + 50.0f) { + target_speed = 10.0f; + } + cLib_addCalc2(&i_this->speedF, target_speed, 0.5f, 1.0f); + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mPlayerAngleY, 5, 0x400); } /* 806BC750-806BC818 000D70 00C8+00 1/1 0/0 0/0 .text e_fs_damage__FP10e_fs_class */ -static void e_fs_damage(e_fs_class* param_0) { - // NONMATCHING -} +static void e_fs_damage(e_fs_class* i_this) { + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_DAMAGE, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, 1.0f); + i_this->mMode++; + break; -/* ############################################################################################## */ -/* 806BE510-806BE514 000084 0004+00 0/1 0/0 0/0 .rodata @4338 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4338 = 2.0f / 5.0f; -COMPILER_STRIP_GATE(0x806BE510, &lit_4338); -#pragma pop - -/* 806BE514-806BE518 000088 0004+00 0/1 0/0 0/0 .rodata @4339 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4339 = 23.0f; -COMPILER_STRIP_GATE(0x806BE514, &lit_4339); -#pragma pop - -/* 806BE518-806BE51C 00008C 0004+00 0/1 0/0 0/0 .rodata @4340 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4340 = 15.0f; -COMPILER_STRIP_GATE(0x806BE518, &lit_4340); -#pragma pop - -/* 806BE51C-806BE520 000090 0004+00 0/1 0/0 0/0 .rodata @4341 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4341 = 1.25f; -COMPILER_STRIP_GATE(0x806BE51C, &lit_4341); -#pragma pop - -/* 806BE520-806BE524 000094 0004+00 0/1 0/0 0/0 .rodata @4342 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4342 = 13.0f / 10.0f; -COMPILER_STRIP_GATE(0x806BE520, &lit_4342); -#pragma pop - -/* 806BE564-806BE564 0000D8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_806BE569 = "F_SP117"; -#pragma pop - -/* 806BE7CC-806BE7DC 000074 000C+04 0/1 0/0 0/0 .bss @4275 */ -#pragma push -#pragma force_active on -static u8 lit_4275[12 + 4 /* padding */]; -#pragma pop - -/* 806BE7DC-806BE7E8 000084 000C+00 0/1 0/0 0/0 .bss sc$4274 */ -#pragma push -#pragma force_active on -static u8 sc[12]; -#pragma pop + case 1: + if (i_this->mpMorf->isStop()) { + i_this->mAction = e_fs_class::ACT_WAIT; + i_this->mMode = -1; + } + break; + } -/* 806BC818-806BCC30 000E38 0418+00 1/1 0/0 0/0 .text e_fs_end__FP10e_fs_class */ -static void e_fs_end(e_fs_class* param_0) { - // NONMATCHING + cLib_addCalc0(&i_this->speedF, 1.0f, 2.0f); } -/* ############################################################################################## */ -/* 806BE524-806BE528 000098 0004+00 0/1 0/0 0/0 .rodata @4380 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4380 = -40.0f; -COMPILER_STRIP_GATE(0x806BE524, &lit_4380); -#pragma pop - -/* 806BE528-806BE52C 00009C 0004+00 0/1 0/0 0/0 .rodata @4381 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4381 = -30.0f; -COMPILER_STRIP_GATE(0x806BE528, &lit_4381); -#pragma pop - -/* 806BE52C-806BE530 0000A0 0004+00 0/1 0/0 0/0 .rodata @4382 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4382 = -5.0f; -COMPILER_STRIP_GATE(0x806BE52C, &lit_4382); -#pragma pop +/* 806BC818-806BCC30 000E38 0418+00 1/1 0/0 0/0 .text e_fs_end__FP10e_fs_class */ +static void e_fs_end(e_fs_class* i_this) { + i_this->mIFrameTimer = 10; + + switch (i_this->mMode) { + case 0: + anm_init(i_this, ANM_DIE, 2.0f, J3DFrameCtrl::LOOP_ONCE_e, cM_rndF(0.4f) + 0.7f); + i_this->mMode++; + fopAcM_OffStatus(i_this, 0); + i_this->attention_info.flags = 0; + + if (i_this->mAtInfo.mHitType == 1 + && (daPy_getPlayerActorClass()->getCutType() == daPy_py_c::CUT_TYPE_TURN_RIGHT + || daPy_getPlayerActorClass()->getCutType() == daPy_py_c::CUT_TYPE_UNK_9)) + { + i_this->mTargetAngleY = cM_rndF(2000.0f) + 1000.0f; + } else { + i_this->mTargetAngleY = cM_rndFX(1000.0f); + } + break; + + case 1: + if (i_this->mpMorf->checkFrame(23.0f)) { + i_this->mTargetAngleY = 0; + } + + if (i_this->mpMorf->checkFrame(15.0f)) { + i_this->mTargetAngleY = i_this->mTargetAngleY / 2; + dBgS_GndChk gnd_chk; + dBgS_ObjGndChk_Spl spl_chk; + cXyz pos = i_this->current.pos; + pos.y += 100.0f; + gnd_chk.SetPos(&pos); + spl_chk.SetPos(&pos); + if (dComIfG_Bgsp().GroundCross(&spl_chk) - dComIfG_Bgsp().GroundCross(&gnd_chk) > 0.0f) + { + static cXyz sc(1.25, 1.25, 1.25); + static u16 w_eff_id[4] = {0x01B8, 0x01B9, 0x01BA, 0x01BB}; + for (int i = 0; i < 4; i++) { + i_this->mParticleKey[i] + = dComIfGp_particle_set(i_this->mParticleKey[i], w_eff_id[i], + &i_this->current.pos, &i_this->tevStr, + &i_this->shape_angle, &sc, 0xff, + NULL, -1, NULL, NULL, NULL); + } + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_LAND_WATER, 0, -1); + } else { + fopAcM_effSmokeSet1(&i_this->mSmokeKey1, &i_this->mSmokeKey2, &i_this->current.pos, + NULL, 1.3f, &i_this->tevStr, 1); + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_LAND, 0, -1); + } + } + + if (i_this->mpMorf->isStop()) { + cXyz pos = i_this->current.pos; + if (!strcmp("F_SP117", dComIfGp_getStartStageName()) + && dComIfG_play_c::getLayerNo(0) == 2) { + fopAcM_createDisappear(i_this, &pos, 10, i_this->field_0x565, 50); + } else { + fopAcM_createDisappear(i_this, &pos, 10, i_this->field_0x565, 13); + } + fopAcM_delete(i_this); + } + break; + } + + cLib_addCalc0(&i_this->speedF, 1.0f, 2.0f); + i_this->shape_angle.y += i_this->mTargetAngleY; +} /* 806BCC30-806BCDDC 001250 01AC+00 1/1 0/0 0/0 .text damage_check__FP10e_fs_class */ -static void damage_check(e_fs_class* param_0) { - // NONMATCHING +static void damage_check(e_fs_class* i_this) { + if (i_this->mAction != e_fs_class::ACT_END && i_this->health < 0) { + i_this->mAction = e_fs_class::ACT_END; + i_this->mMode = 0; + + } else { + i_this->mCcStts.Move(); + + if (i_this->mCcCyl.ChkTgHit()) { + i_this->mAtInfo.mpCollider = i_this->mCcCyl.GetTgHitObj(); + cc_at_check(i_this, &i_this->mAtInfo); + if (i_this->mAtInfo.mpCollider->ChkAtType(AT_TYPE_UNK)) { + i_this->mIFrameTimer = 20; + } else { + i_this->mIFrameTimer = 10; + } + i_this->current.angle.y = i_this->mAtInfo.mHitDirection; + + if (i_this->health <= 0) { + i_this->mAction = e_fs_class::ACT_END; + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_DEATH, 0, -1); + i_this->speedF = -40.0f; + } else { + i_this->mAction = e_fs_class::ACT_DAMAGE; + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_DAMAGE, 0, -1); + i_this->speedF = -30.0f; + if (daPy_getPlayerActorClass()->getCutType() == daPy_py_c::CUT_TYPE_JUMP + && daPy_getPlayerActorClass()->checkCutJumpCancelTurn()) + { + i_this->speedF = -5.0f; + i_this->mIFrameTimer = 3; + } + } + + i_this->mMode = 0; + } + + if (i_this->health <= 10) { + i_this->health = 0; + i_this->mCcCyl.SetTgHitMark(CcG_Tg_UNK_MARK_3); + } + } } -/* ############################################################################################## */ -/* 806BE530-806BE534 0000A4 0004+00 0/1 0/0 0/0 .rodata @4396 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4396 = 608.0f; -COMPILER_STRIP_GATE(0x806BE530, &lit_4396); -#pragma pop - -/* 806BE534-806BE538 0000A8 0004+00 0/1 0/0 0/0 .rodata @4397 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4397 = 448.0f; -COMPILER_STRIP_GATE(0x806BE534, &lit_4397); -#pragma pop - /* 806BCDDC-806BCE5C 0013FC 0080+00 1/1 0/0 0/0 .text checkViewArea__FP4cXyz */ -static void checkViewArea(cXyz* param_0) { - // NONMATCHING +static bool checkViewArea(cXyz* i_pos) { + Vec proj; + mDoLib_project(i_pos, &proj); + bool ret = false; + if (proj.x >= 0.0f && proj.x <= 608.0f && proj.y >= 0.0f && proj.y <= 448.0f) { + ret = true; + } + return ret; } -/* ############################################################################################## */ -/* 806BE538-806BE53C 0000AC 0004+00 0/2 0/0 0/0 .rodata @4447 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4447 = 20000.0f; -COMPILER_STRIP_GATE(0x806BE538, &lit_4447); -#pragma pop - /* 806BCE5C-806BD0A8 00147C 024C+00 2/1 0/0 0/0 .text e_fs_demowait__FP10e_fs_class */ -static void e_fs_demowait(e_fs_class* param_0) { - // NONMATCHING +// NONMATCHING regalloc +static void e_fs_demowait(e_fs_class* i_this) { + cXyz delta; + npc_ks_class* monkey = (npc_ks_class*)fopAcM_SearchByName(PROC_NPC_KS); + + switch (i_this->mMode) { + case 0: + i_this->current.pos = i_this->home.pos; + i_this->current.pos.y += 20000.0f; + i_this->old.pos = i_this->current.pos; + i_this->speed.y = 0.0f; + break; + + case 1: + anm_init(i_this, ANM_APPEAR, 0.0f, J3DFrameCtrl::LOOP_ONCE_e, 0.0f); + i_this->current.pos.y = (fopAcM_GetID(i_this) & 3) * 200.0f + 1300.0f; + i_this->mMode = 2; + i_this->field_0x566 = 1; + break; + + case 2: + delta.x = monkey->current.pos.x - i_this->current.pos.x; + delta.z = monkey->current.pos.z - i_this->current.pos.z; + i_this->mTargetAngleY = cM_atan2s(delta.x, delta.z); + if (i_this->mAcch.ChkGroundHit()) { + i_this->mpMorf->setPlaySpeed(1.0f); + i_this->mCreatureSound.startCreatureSound(Z2SE_EN_FS_APPEAR, 0, -1); + i_this->mMode = 3; + } + break; + + case 3: + if (i_this->mpMorf->isStop()) { + anm_init(i_this, ANM_WAIT01, 10.0f, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f); + i_this->mMode = 4; + } + break; + + case 5: + if (i_this->mTimer[0] == 0) { + i_this->mTargetAngleY = i_this->mPlayerAngleY; + } + break; + + case 6: + if (i_this->mTimer[0] == 0) { + i_this->mAction = e_fs_class::ACT_MOVE; + i_this->mMode = 0; + i_this->attention_info.flags = 4; + } + break; + } + + cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetAngleY, 2, 0x1000); } /* 806BD0A8-806BD3E0 0016C8 0338+00 2/1 0/0 0/0 .text action__FP10e_fs_class */ -static void action(e_fs_class* param_0) { - // NONMATCHING +static void action(e_fs_class* i_this) { + cXyz vec1, vec2; + i_this->mPlayerAngleY = fopAcM_searchPlayerAngleY(i_this); + i_this->mPlayerDistXZ = fopAcM_searchPlayerDistanceXZ(i_this); + daE_PM_c* skullkid = (daE_PM_c*)fopAcM_SearchByID(i_this->parentActorID); + s8 link_search = 0; + + switch (i_this->mAction) { + case e_fs_class::ACT_APPEAR: + e_fs_appear(i_this); + link_search = 1; + break; + case e_fs_class::ACT_WAIT: + e_fs_wait(i_this); + link_search = 1; + break; + case e_fs_class::ACT_MOVE: + if (!dComIfGp_event_runCheck()) { + e_fs_move(i_this); + daE_PM_c* skullkid = (daE_PM_c*)fopAcM_SearchByID(i_this->parentActorID); + if (i_this->field_0x5b4 == 0) { + fopAcM_OffStatus(i_this, 0x4000); + } + if (skullkid != NULL && skullkid->SwitchChk() == 4) { + fopAcM_OffStatus(i_this, 0x4000); + } + } + link_search = 1; + break; + case e_fs_class::ACT_ATTACK: + e_fs_attack(i_this); + link_search = 1; + break; + case e_fs_class::ACT_DAMAGE: + e_fs_damage(i_this); + break; + case e_fs_class::ACT_END: + e_fs_end(i_this); + break; + case e_fs_class::ACT_DEMOWAIT: + e_fs_demowait(i_this); + break; + } + + if (link_search) { + i_this->mCreatureSound.setLinkSearch(true); + } else { + i_this->mCreatureSound.setLinkSearch(false); + } + + mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); + vec1.x = 0.0f; + vec1.y = 0.0f; + vec1.z = i_this->speedF; + MtxPosition(&vec1, &vec2); + i_this->speed.x = vec2.x; + i_this->speed.z = vec2.z; + i_this->current.pos += i_this->speed; + i_this->speed.y += i_this->gravity; + i_this->gravity = -5.0f; + if (i_this->speed.y < -80.0f) { + i_this->speed.y = -80.0f; + } + i_this->shape_angle.y = i_this->current.angle.y; + if (i_this->mAcch.ChkWaterHit() + && !(i_this->mAction == e_fs_class::ACT_APPEAR && i_this->mMode < 2)) + { + i_this->current.pos.y = i_this->mAcch.m_wtr.GetHeight(); + } + + if (skullkid != NULL && skullkid->ActionChk() != 0) { + i_this->health = -10; + } + + if (i_this->mAtSph.ChkAtHit() && dComIfG_play_c::getLayerNo(0) == 0) { + s_AtCount++; + if (s_AtCount >= 3 && !dComIfGs_isZoneSwitch(0xb, fopAcM_GetRoomNo(i_this))) { + dComIfGs_onZoneSwitch(0xb, fopAcM_GetRoomNo(i_this)); + } + } + + if (!checkViewArea(&i_this->current.pos) && skullkid != NULL) { + if (i_this->mPlayerDistXZ > l_HIO.mDeleteRange && skullkid->SwitchChk() != 4) { + fopAcM_delete(i_this); + } else if (daPy_getPlayerActorClass()->current.pos.y - i_this->current.pos.y > 400.0f + && skullkid->SwitchChk() != 4) { + fopAcM_delete(i_this); + } + } } -/* ############################################################################################## */ -/* 806BE53C-806BE544 0000B0 0004+04 0/0 0/0 0/0 .rodata @4448 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4448[1 + 1 /* padding */] = { - 1300.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x806BE53C, &lit_4448); -#pragma pop - -/* 806BE544-806BE54C 0000B8 0008+00 0/0 0/0 0/0 .rodata @4451 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_4451[8] = { - 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x806BE544, &lit_4451); -#pragma pop - -/* 806BE54C-806BE550 0000C0 0004+00 0/0 0/0 0/0 .rodata @4544 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4544 = -80.0f; -COMPILER_STRIP_GATE(0x806BE54C, &lit_4544); -#pragma pop - -/* 806BE550-806BE554 0000C4 0004+00 0/0 0/0 0/0 .rodata @4545 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4545 = 400.0f; -COMPILER_STRIP_GATE(0x806BE550, &lit_4545); -#pragma pop - -/* 806BE554-806BE558 0000C8 0004+00 0/1 0/0 0/0 .rodata @4622 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4622 = 1.5f; -COMPILER_STRIP_GATE(0x806BE554, &lit_4622); -#pragma pop - -/* 806BE558-806BE55C 0000CC 0004+00 0/1 0/0 0/0 .rodata @4623 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4623 = 120.0f; -COMPILER_STRIP_GATE(0x806BE558, &lit_4623); -#pragma pop - -/* 806BE55C-806BE560 0000D0 0004+00 0/1 0/0 0/0 .rodata @4624 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4624 = 1.0f / 5.0f; -COMPILER_STRIP_GATE(0x806BE55C, &lit_4624); -#pragma pop - /* 806BD3E0-806BD6D0 001A00 02F0+00 2/1 0/0 0/0 .text daE_Fs_Execute__FP10e_fs_class */ -static void daE_Fs_Execute(e_fs_class* param_0) { - // NONMATCHING +static int daE_Fs_Execute(e_fs_class* i_this) { + cXyz zero, center; + i_this->mFrameCounter++; + for (int i = 0; i < 4; i++) { + if (i_this->mTimer[i] != 0) { + i_this->mTimer[i]--; + } + } + if (i_this->mIFrameTimer != 0) { + i_this->mIFrameTimer--; + } + + action(i_this); + + cXyz scale(1.5f, 1.5f, 1.5f); + cXyz pos(i_this->current.pos.x, i_this->current.pos.y + 120.0f, i_this->current.pos.z); + setMidnaBindEffect(i_this, &i_this->mCreatureSound, &pos, &scale); + + cXyz* move_p = i_this->mCcStts.GetCCMoveP(); + if (move_p != NULL) { + i_this->current.pos += *move_p * 0.2f; + } + + i_this->mAcch.CrrPos(dComIfG_Bgsp()); + damage_check(i_this); + + center = i_this->current.pos; + if (i_this->mIFrameTimer != 0) { + center.x += 20000.0f; + } + i_this->mCcCyl.SetC(center); + dComIfG_Ccsp()->Set(&i_this->mCcCyl); + + mDoMtx_stack_c::transS(i_this->current.pos.x, i_this->current.pos.y, i_this->current.pos.z); + mDoMtx_stack_c::YrotM(i_this->shape_angle.y); + mDoMtx_stack_c::scaleM(l_HIO.mScale, l_HIO.mScale, l_HIO.mScale); + J3DModel* model = i_this->mpMorf->getModel(); + model->setBaseTRMtx(mDoMtx_stack_c::get()); + i_this->mpMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(i_this))); + i_this->mpMorf->modelCalc(); + + MTXCopy(model->getAnmMtx(JNT_HEAD), *calc_mtx); + zero.set(0.0f, 0.0f, 0.0f); + MtxPosition(&zero, &i_this->eyePos); + i_this->attention_info.position = i_this->eyePos; + i_this->attention_info.position.y += 20.0f; + + MTXCopy(model->getAnmMtx(JNT_HAND_R), *calc_mtx); + zero.set(0.0f, 0.0f, 0.0f); + MtxPosition(&zero, ¢er); + if (i_this->field_0x692 != 0) { + if (i_this->field_0x692 == 1) { + i_this->mAtSph.StartCAt(center); + } else { + i_this->mAtSph.MoveCAt(center); + } + i_this->field_0x692 = 0; + } else { + center.x += 10000.0f; + i_this->mAtSph.SetC(center); + } + i_this->mAtSph.SetR(50.0f); + dComIfG_Ccsp()->Set(&i_this->mAtSph); + + return 1; } /* 806BD6D0-806BD6D8 001CF0 0008+00 1/0 0/0 0/0 .text daE_Fs_IsDelete__FP10e_fs_class */ -static bool daE_Fs_IsDelete(e_fs_class* param_0) { - return true; +static int daE_Fs_IsDelete(e_fs_class* i_this) { + return 1; } /* 806BD6D8-806BD740 001CF8 0068+00 1/0 0/0 0/0 .text daE_Fs_Delete__FP10e_fs_class */ -static void daE_Fs_Delete(e_fs_class* param_0) { - // NONMATCHING -} +static int daE_Fs_Delete(e_fs_class* i_this) { + dComIfG_resDelete(&i_this->mPhase, "E_FS"); -/* 806BD740-806BD838 001D60 00F8+00 1/1 0/0 0/0 .text useHeapIe_fst__FP10fopAc_ac_c */ -static void useHeapIe_fst(fopAc_ac_c* param_0) { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 806BE560-806BE564 0000D4 0004+00 0/1 0/0 0/0 .rodata @4838 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4838 = -200.0f; -COMPILER_STRIP_GATE(0x806BE560, &lit_4838); -#pragma pop - -/* 806BE564-806BE564 0000D8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_806BE571 = "F_SP108"; -SECTION_DEAD static char const* const stringBase_806BE579 = "E_fs"; -#pragma pop + if (i_this->mHIOInit) { + hioInit = false; + } -/* 806BD838-806BDD38 001E58 0500+00 1/0 0/0 0/0 .text daE_Fs_Create__FP10fopAc_ac_c */ -static void daE_Fs_Create(fopAc_ac_c* param_0) { - // NONMATCHING -} - -/* 806BDD38-806BDD80 002358 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGSphFv */ -// cM3dGSph::~cM3dGSph() { -extern "C" void __dt__8cM3dGSphFv() { - // NONMATCHING -} - -/* 806BDD80-806BDDC8 0023A0 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGCylFv */ -// cM3dGCyl::~cM3dGCyl() { -extern "C" void __dt__8cM3dGCylFv() { - // NONMATCHING -} - -/* 806BDDC8-806BDE10 0023E8 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 806BDE10-806BDE6C 002430 005C+00 1/0 0/0 0/0 .text __dt__10dCcD_GSttsFv */ -// dCcD_GStts::~dCcD_GStts() { -extern "C" void __dt__10dCcD_GSttsFv() { - // NONMATCHING -} + if (i_this->heap != NULL) { + i_this->mpMorf->stopZelAnime(); + } -/* 806BDE6C-806BDEDC 00248C 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING + return 1; } -/* 806BDEDC-806BDF4C 0024FC 0070+00 1/0 0/0 0/0 .text __dt__12dBgS_AcchCirFv */ -// dBgS_AcchCir::~dBgS_AcchCir() { -extern "C" void __dt__12dBgS_AcchCirFv() { - // NONMATCHING -} - -/* 806BDF4C-806BDF94 00256C 0048+00 1/0 0/0 0/0 .text __dt__10cCcD_GSttsFv */ -// cCcD_GStts::~cCcD_GStts() { -extern "C" void __dt__10cCcD_GSttsFv() { - // NONMATCHING -} - -/* 806BDF94-806BDFDC 0025B4 0048+00 2/1 0/0 0/0 .text __dt__12daE_Fs_HIO_cFv */ -daE_Fs_HIO_c::~daE_Fs_HIO_c() { - // NONMATCHING -} - -/* 806BDFDC-806BE018 0025FC 003C+00 0/0 1/0 0/0 .text __sinit_d_a_e_fs_cpp */ -void __sinit_d_a_e_fs_cpp() { - // NONMATCHING -} - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x806BDFDC, __sinit_d_a_e_fs_cpp); -#pragma pop - -/* 806BE018-806BE020 002638 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_806BE018() { - // NONMATCHING -} +/* 806BD740-806BD838 001D60 00F8+00 1/1 0/0 0/0 .text useHeapIe_fst__FP10fopAc_ac_c */ +static int useHeapIe_fst(fopAc_ac_c* i_this) { + e_fs_class* _this = static_cast(i_this); + _this->mpMorf = new mDoExt_McaMorfSO((J3DModelData*)dComIfG_getObjectRes("E_FS", 0xc), NULL, + NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_FS", 9), + J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1, + &_this->mCreatureSound, 0x80000, 0x11000084); + if (_this->mpMorf == NULL || _this->mpMorf->getModel() == NULL) { + return 0; + } -/* 806BE020-806BE028 002640 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_806BE020() { - // NONMATCHING + return 1; } -/* 806BE028-806BE43C 002648 0414+00 1/1 0/0 0/0 .text - * setMidnaBindEffect__FP13fopEn_enemy_cP15Z2CreatureEnemyP4cXyzP4cXyz */ -static void setMidnaBindEffect(fopEn_enemy_c* param_0, Z2CreatureEnemy* param_1, cXyz* param_2, - cXyz* param_3) { - // NONMATCHING -} +/* 806BD838-806BDD38 001E58 0500+00 1/0 0/0 0/0 .text daE_Fs_Create__FP10fopAc_ac_c */ +static cPhs__Step daE_Fs_Create(fopAc_ac_c* i_this) { + e_fs_class* _this = static_cast(i_this); + fopAcM_SetupActor(_this, e_fs_class); + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&_this->mPhase, "E_FS"); + + if (step == cPhs_COMPLEATE_e) { + _this->field_0x5b4 = fopAcM_GetParam(_this) & 0xff; + _this->field_0x5b5 = (fopAcM_GetParam(_this) >> 8) & 0xff; + _this->field_0x5b7 = (fopAcM_GetParam(_this) >> 0x18) & 0xff; + + if (dComIfGs_isEventBit(dSv_event_flag_c::saveBitLabels[522]) + && !strcmp("F_SP108", dComIfGp_getStartStageName())) + { + return cPhs_ERROR_e; + } + + if (_this->field_0x5b4 == 0) { + fopAcM_OnStatus(_this, 0x4000); + } + + daE_PM_c* skullkid; + if (fopAcM_SearchByID(_this->parentActorID, (fopAc_ac_c**)&skullkid) + && skullkid != NULL && skullkid->SwitchChk() == 4) + { + fopAcM_OnStatus(_this, 0x4000); + } + + cXyz gnd_chk_pos(_this->current.pos.x, _this->current.pos.y + 300.0f, _this->current.pos.z); + dBgS_LinChk lin_chk; + cXyz lin_end = _this->current.pos; + lin_end.y += 1000.0f; + lin_chk.Set(&i_this->current.pos, &lin_end, NULL); + + if (dComIfG_Bgsp().LineCross(&lin_chk) && dComIfG_Bgsp().GetSpecialCode(lin_chk) == 1) { + return cPhs_ERROR_e; + } + + if (fopAcM_gc_c::gndCheck(&gnd_chk_pos)) { + _this->current.pos.y = fopAcM_gc_c::getGroundY(); + } else { + return cPhs_ERROR_e; + } + + if (_this->field_0x5b5 == 0xff) { + _this->field_0x5b5 = 0; + } + + if (!fopAcM_entrySolidHeap(_this, useHeapIe_fst, 0x1E40)) { + return cPhs_ERROR_e; + } + + if (!hioInit) { + _this->mHIOInit = true; + hioInit = true; + l_HIO.field_0x4 = -1; + } + + fopAcM_SetMtx(_this, _this->mpMorf->getModel()->getBaseTRMtx()); + fopAcM_SetMin(_this, -200.0f, -200.0f, -200.0f); + fopAcM_SetMax(_this, 200.0f, 200.0f, 200.0f); + + _this->mCreatureSound.init(&_this->current.pos, &_this->eyePos, 3, 1); + _this->mCreatureSound.setEnemyName("E_fs"); + + _this->mAtInfo.mpSound = &_this->mCreatureSound; + _this->mAtInfo.field_0x18 = 0x25; + + static dCcD_SrcCyl cc_cyl_src = { + { + {0x0, {{0x0, 0x0, 0x0}, {0xd8fbfdff, 0x43}, 0x75}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x4, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {0.0f, 0.0f, 0.0f}, // mCenter + 80.0f, // mRadius + 230.0f // mHeight + } // mCyl + }; + + static dCcD_SrcSph at_sph_src = { + { + {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0x0, 0x0}, 0x0}}, // mObj + {dCcD_SE_17, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x2}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {{0.0f, 0.0f, 0.0f}, 30.0f} // mSph + } // mSphAttr + }; + + _this->mCcStts.Init(1, 0, _this); + _this->mCcCyl.Set(cc_cyl_src); + _this->mCcCyl.SetStts(&_this->mCcStts); + _this->mAtSph.Set(at_sph_src); + _this->mAtSph.SetStts(&_this->mCcStts); + + _this->mAcch.Set(fopAcM_GetPosition_p(_this), fopAcM_GetOldPosition_p(_this), _this, 1, + &_this->mAcchCir, fopAcM_GetSpeed_p(_this), NULL, NULL); + _this->mAcchCir.SetWall(50.0f, 100.0f); + _this->mAcch.ClrWaterNone(); + _this->mAcch.SetWaterCheckOffset(10000.0f); + + _this->field_0x560 = 30; + _this->health = 30; + _this->attention_info.flags = 4; + + if (_this->field_0x5b5 >= 1) { + _this->mMode = -1; + } + _this->field_0x5b6 = 0; + + daE_Fs_Execute(_this); + } + + return step; +} + +AUDIO_INSTANCES; -/* 806BE43C-806BE478 002A5C 003C+00 1/1 0/0 0/0 .text __dt__4cXyzFv */ -// cXyz::~cXyz() { -extern "C" void __dt__4cXyzFv() { - // NONMATCHING -} +/* 806BE68C-806BE6AC -00001 0020+00 1/0 0/0 0/0 .data l_daE_Fs_Method */ +static actor_method_class l_daE_Fs_Method = { + (process_method_func)daE_Fs_Create, + (process_method_func)daE_Fs_Delete, + (process_method_func)daE_Fs_Execute, + (process_method_func)daE_Fs_IsDelete, + (process_method_func)daE_Fs_Draw, +}; -/* ############################################################################################## */ -/* 806BE7E8-806BE7EC 000090 0004+00 0/0 0/0 0/0 .bss - * sInstance__40JASGlobalInstance<19JASDefaultBankTable> */ -#pragma push -#pragma force_active on -static u8 data_806BE7E8[4]; -#pragma pop - -/* 806BE7EC-806BE7F0 000094 0004+00 0/0 0/0 0/0 .bss - * sInstance__35JASGlobalInstance<14JASAudioThread> */ -#pragma push -#pragma force_active on -static u8 data_806BE7EC[4]; -#pragma pop - -/* 806BE7F0-806BE7F4 000098 0004+00 0/0 0/0 0/0 .bss sInstance__27JASGlobalInstance<7Z2SeMgr> */ -#pragma push -#pragma force_active on -static u8 data_806BE7F0[4]; -#pragma pop - -/* 806BE7F4-806BE7F8 00009C 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8Z2SeqMgr> */ -#pragma push -#pragma force_active on -static u8 data_806BE7F4[4]; -#pragma pop - -/* 806BE7F8-806BE7FC 0000A0 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SceneMgr> - */ -#pragma push -#pragma force_active on -static u8 data_806BE7F8[4]; -#pragma pop - -/* 806BE7FC-806BE800 0000A4 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2StatusMgr> - */ -#pragma push -#pragma force_active on -static u8 data_806BE7FC[4]; -#pragma pop - -/* 806BE800-806BE804 0000A8 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2DebugSys> - */ -#pragma push -#pragma force_active on -static u8 data_806BE800[4]; -#pragma pop - -/* 806BE804-806BE808 0000AC 0004+00 0/0 0/0 0/0 .bss - * sInstance__36JASGlobalInstance<15JAISoundStarter> */ -#pragma push -#pragma force_active on -static u8 data_806BE804[4]; -#pragma pop - -/* 806BE808-806BE80C 0000B0 0004+00 0/0 0/0 0/0 .bss - * sInstance__35JASGlobalInstance<14Z2SoundStarter> */ -#pragma push -#pragma force_active on -static u8 data_806BE808[4]; -#pragma pop - -/* 806BE80C-806BE810 0000B4 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12Z2SpeechMgr2> */ -#pragma push -#pragma force_active on -static u8 data_806BE80C[4]; -#pragma pop - -/* 806BE810-806BE814 0000B8 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8JAISeMgr> */ -#pragma push -#pragma force_active on -static u8 data_806BE810[4]; -#pragma pop - -/* 806BE814-806BE818 0000BC 0004+00 0/0 0/0 0/0 .bss sInstance__29JASGlobalInstance<9JAISeqMgr> */ -#pragma push -#pragma force_active on -static u8 data_806BE814[4]; -#pragma pop - -/* 806BE818-806BE81C 0000C0 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAIStreamMgr> */ -#pragma push -#pragma force_active on -static u8 data_806BE818[4]; -#pragma pop - -/* 806BE81C-806BE820 0000C4 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SoundMgr> - */ -#pragma push -#pragma force_active on -static u8 data_806BE81C[4]; -#pragma pop - -/* 806BE820-806BE824 0000C8 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAISoundInfo> */ -#pragma push -#pragma force_active on -static u8 data_806BE820[4]; -#pragma pop - -/* 806BE824-806BE828 0000CC 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13JAUSoundTable> */ -#pragma push -#pragma force_active on -static u8 data_806BE824[4]; -#pragma pop - -/* 806BE828-806BE82C 0000D0 0004+00 0/0 0/0 0/0 .bss - * sInstance__38JASGlobalInstance<17JAUSoundNameTable> */ -#pragma push -#pragma force_active on -static u8 data_806BE828[4]; -#pragma pop - -/* 806BE82C-806BE830 0000D4 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAUSoundInfo> */ -#pragma push -#pragma force_active on -static u8 data_806BE82C[4]; -#pragma pop - -/* 806BE830-806BE834 0000D8 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SoundInfo> - */ -#pragma push -#pragma force_active on -static u8 data_806BE830[4]; -#pragma pop - -/* 806BE834-806BE838 0000DC 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13Z2SoundObjMgr> */ -#pragma push -#pragma force_active on -static u8 data_806BE834[4]; -#pragma pop - -/* 806BE838-806BE83C 0000E0 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2Audience> - */ -#pragma push -#pragma force_active on -static u8 data_806BE838[4]; -#pragma pop - -/* 806BE83C-806BE840 0000E4 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2FxLineMgr> - */ -#pragma push -#pragma force_active on -static u8 data_806BE83C[4]; -#pragma pop - -/* 806BE840-806BE844 0000E8 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2EnvSeMgr> - */ -#pragma push -#pragma force_active on -static u8 data_806BE840[4]; -#pragma pop - -/* 806BE844-806BE848 0000EC 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SpeechMgr> - */ -#pragma push -#pragma force_active on -static u8 data_806BE844[4]; -#pragma pop - -/* 806BE848-806BE84C 0000F0 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13Z2WolfHowlMgr> */ -#pragma push -#pragma force_active on -static u8 data_806BE848[4]; -#pragma pop - -/* 806BE564-806BE564 0000D8 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 806BE6AC-806BE6DC -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_FS */ +extern actor_process_profile_definition g_profile_E_FS = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_E_FS, // mProcName + &g_fpcLf_Method.mBase, // sub_method + sizeof(e_fs_class), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 160, // mPriority + &l_daE_Fs_Method, // sub_method + 0x00040120, // mStatus + fopAc_ENEMY_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +}; diff --git a/src/d/actor/d_a_e_pm.cpp b/src/d/actor/d_a_e_pm.cpp index fbd70abc609..393d880a37e 100644 --- a/src/d/actor/d_a_e_pm.cpp +++ b/src/d/actor/d_a_e_pm.cpp @@ -1,2031 +1,2846 @@ /** * @file d_a_e_pm.cpp - * + * Enemy - Skull Kid */ #include "d/actor/d_a_e_pm.h" -#include "d/d_cc_d.h" -#include "dol2asm.h" +#include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "SSystem/SComponent/c_math.h" +#include "Z2AudioLib/Z2Instances.h" +#include "c/c_damagereaction.h" #include "d/d_camera.h" - - - - -// -// Forward References: -// - -extern "C" void __ct__12daE_PM_HIO_cFv(); -extern "C" void DemoSkip__8daE_PM_cFi(); -extern "C" void DemoSkipCallBack__8daE_PM_cFPvi(); -extern "C" void CreateHeap__8daE_PM_cFv(); -extern "C" void __dt__12J3DFrameCtrlFv(); -extern "C" static void useHeapInit__FP10fopAc_ac_c(); -extern "C" static void s_pm_sub__FPvPv(); -extern "C" void initCcCylinder__8daE_PM_cFv(); -extern "C" void setCcCylinder__8daE_PM_cFv(); -extern "C" void ctrlJoint__8daE_PM_cFP8J3DJointP8J3DModel(); -extern "C" static void JointCallBack__FP8J3DJointi(); -extern "C" void Particle_Set__8daE_PM_cFUs4cXyz(); -extern "C" void SetAnm__8daE_PM_cFiiff(); -extern "C" void __dt__8cM3dGPlaFv(); -extern "C" static void way_bg_check2__FP8daE_PM_c4cXyz4cXyz(); -extern "C" void Yazirushi__8daE_PM_cFv(); -extern "C" void SearchRndP__8daE_PM_cFv(); -extern "C" void SearchFarP__8daE_PM_cFv(); -extern "C" void SearchNearP__8daE_PM_cFv(); -extern "C" void SearchNextPos__8daE_PM_cFv(); -extern "C" void SetGakkiEffect__8daE_PM_cFv(); -extern "C" void CameraSet__8daE_PM_cFv(); -extern "C" void SetStopingCam__8daE_PM_cFv(); -extern "C" void SetStopCam__8daE_PM_cF4cXyzffs(); -extern "C" void SetMoveCam2__8daE_PM_cFff(); -extern "C" void SetMoveCam__8daE_PM_cFff(); -extern "C" void SetReleaseCam__8daE_PM_cFv(); -extern "C" void Ap_StartAction__8daE_PM_cFv(); -extern "C" static void s_obj_sub__FPvPv(); -extern "C" void Ap_CreateAction__8daE_PM_cFv(); -extern "C" void Ap_EscapeAction__8daE_PM_cFv(); -extern "C" void AppearAction__8daE_PM_cFv(); -extern "C" void DemoBeforeEscape__8daE_PM_cFv(); -extern "C" void DemoAfterEscape__8daE_PM_cFv(); -extern "C" void DemoMoveAction__8daE_PM_cFv(); -extern "C" void WaitAction__8daE_PM_cFv(); -extern "C" void GroundCheck__8daE_PM_cFv(); -extern "C" void __dt__14dBgS_ObjGndChkFv(); -extern "C" void EscapeAction__8daE_PM_cFv(); -extern "C" void DeathAction__8daE_PM_cFv(); -extern "C" void Action__8daE_PM_cFv(); -extern "C" void DemoBossStart2__8daE_PM_cFv(); -extern "C" void DemoBossStart__8daE_PM_cFv(); -extern "C" void BossEscapeAction__8daE_PM_cFv(); -extern "C" static void s_boss_sub__FPvPv(); -extern "C" void BossDamageAction__8daE_PM_cFv(); -extern "C" void BossWaitAction__8daE_PM_cFv(); -extern "C" void BossDeathAction__8daE_PM_cFv(); -extern "C" void BossAction__8daE_PM_cFv(); -extern "C" void Execute__8daE_PM_cFv(); -extern "C" void StartAction__8daE_PM_cFv(); -extern "C" void GakkiLoopAction__8daE_PM_cF4cXyzf(); -extern "C" void DemoCreateAction__8daE_PM_cFv(); -extern "C" void CreateAction__8daE_PM_cFv(); -extern "C" void CreateChk__8daE_PM_cFv(); -extern "C" void LampAction__8daE_PM_cFv(); -extern "C" void DamageAction__8daE_PM_cFv(); -extern "C" void At_Check__8daE_PM_cFv(); -extern "C" void ObjHit__8daE_PM_cFv(); -extern "C" void EyeMove__8daE_PM_cFv(); -extern "C" void Draw__8daE_PM_cFv(); -extern "C" void Delete__8daE_PM_cFv(); -extern "C" void setBaseMtx__8daE_PM_cFv(); -extern "C" void setGakkiBaseMtx__8daE_PM_cFv(); -extern "C" void setLampBaseMtx__8daE_PM_cFv(); -extern "C" static void daE_PM_Draw__FP8daE_PM_c(); -extern "C" static void daE_PM_Execute__FP8daE_PM_c(); -extern "C" static bool daE_PM_IsDelete__FP8daE_PM_c(); -extern "C" static void daE_PM_Delete__FP8daE_PM_c(); -extern "C" void SkipChk__8daE_PM_cFv(); -extern "C" void Create__8daE_PM_cFv(); -extern "C" void __dt__8cM3dGCylFv(); -extern "C" void __dt__8cM3dGAabFv(); -extern "C" void __dt__10dCcD_GSttsFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__12dBgS_AcchCirFv(); -extern "C" static void daE_PM_Create__FP10fopAc_ac_c(); -extern "C" void __dt__10cCcD_GSttsFv(); -extern "C" void __dt__12daE_PM_HIO_cFv(); -extern "C" void __sinit_d_a_e_pm_cpp(); -extern "C" static void func_8074BAEC(); -extern "C" static void func_8074BAF4(); -extern "C" static void func_8074BAFC(); -extern "C" static void func_8074BB04(); -extern "C" static void func_8074BB0C(); -extern "C" static void setMidnaBindEffect__FP13fopEn_enemy_cP15Z2CreatureEnemyP4cXyzP4cXyz(); -extern "C" extern char const* const d_a_e_pm__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_XrotM__FPA4_fs(); -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoMtx_ZrotM__FPA4_fs(); -extern "C" void transS__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void transM__14mDoMtx_stack_cFfff(); -extern "C" void scaleM__14mDoMtx_stack_cFfff(); -extern "C" void ZXYrotM__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void init__13mDoExt_btpAnmFP16J3DMaterialTableP16J3DAnmTexPatterniifss(); -extern "C" void entry__13mDoExt_btpAnmFP16J3DMaterialTables(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void -__ct__14mDoExt_McaMorfFP12J3DModelDataP25mDoExt_McaMorfCallBack1_cP25mDoExt_McaMorfCallBack2_cP15J3DAnmTransformifiiiPvUlUl(); -extern "C" void setAnm__14mDoExt_McaMorfFP15J3DAnmTransformiffffPv(); -extern "C" void play__14mDoExt_McaMorfFP3VecUlSc(); -extern "C" void entryDL__14mDoExt_McaMorfFv(); -extern "C" void modelCalc__14mDoExt_McaMorfFv(); -extern "C" void -__ct__16mDoExt_McaMorfSOFP12J3DModelDataP25mDoExt_McaMorfCallBack1_cP25mDoExt_McaMorfCallBack2_cP15J3DAnmTransformifiiP10Z2CreatureUlUl(); -extern "C" void setAnm__16mDoExt_McaMorfSOFP15J3DAnmTransformiffff(); -extern "C" void play__16mDoExt_McaMorfSOFUlSc(); -extern "C" void entryDL__16mDoExt_McaMorfSOFv(); -extern "C" void modelCalc__16mDoExt_McaMorfSOFv(); -extern "C" void stopZelAnime__16mDoExt_McaMorfSOFv(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void fopAc_IsActor__FPv(); -extern "C" void fopAcIt_Judge__FPFPvPv_PvPv(); -extern "C" void fopAcM_SearchByID__FUiPP10fopAc_ac_c(); -extern "C" void fopAcM_SearchByName__FsPP10fopAc_ac_c(); -extern "C" void fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_createChild__FsUiUlPC4cXyziPC5csXyzPC4cXyzScPFPv_i(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void fopAcM_SetMin__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_SetMax__FP10fopAc_ac_cfff(); -extern "C" void fopAcM_posMoveF__FP10fopAc_ac_cPC4cXyz(); -extern "C" void fopAcM_searchActorDistanceXZ__FPC10fopAc_ac_cPC10fopAc_ac_c(); -extern "C" void fopAcM_orderPotentialEvent__FP10fopAc_ac_cUsUsUs(); -extern "C" void gndCheck__11fopAcM_gc_cFPC4cXyz(); -extern "C" void fpcEx_Search__FPFPvPv_PvPv(); -extern "C" void fpcSch_JudgeByID__FPvPv(); -extern "C" void getLayerNo__14dComIfG_play_cFi(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfGp_getReverb__Fi(); -extern "C" void -dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj(); -extern "C" void onSwitch__10dSv_info_cFii(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void reset__14dEvt_control_cFv(); -extern "C" void setSkipProc__14dEvt_control_cFPvPFPvi_ii(); -extern "C" void onSkipFade__14dEvt_control_cFv(); -extern "C" void getEmitter__Q213dPa_control_c7level_cFUl(); -extern "C" void -set__13dPa_control_cFUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void -set__13dPa_control_cFUlUcUsPC4cXyzPC12dKy_tevstr_cPC5csXyzPC4cXyzUcP18dPa_levelEcallBackScPC8_GXColorPC8_GXColorPC4cXyzf(); -extern "C" void dPath_GetPnt__FPC5dPathi(); -extern "C" void dPath_GetRoomPath__Fii(); -extern "C" void StartShock__12dVibration_cFii4cXyz(); -extern "C" void StopQuake__12dVibration_cFi(); -extern "C" void LineCross__4cBgSFP11cBgS_LinChk(); -extern "C" void GroundCross__4cBgSFP11cBgS_GndChk(); -extern "C" void __ct__12dBgS_AcchCirFv(); -extern "C" void SetWall__12dBgS_AcchCirFff(); -extern "C" void __dt__9dBgS_AcchFv(); -extern "C" void __ct__9dBgS_AcchFv(); -extern "C" void Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz(); -extern "C" void CrrPos__9dBgS_AcchFR4dBgS(); -extern "C" void __ct__11dBgS_GndChkFv(); -extern "C" void __dt__11dBgS_GndChkFv(); -extern "C" void __ct__11dBgS_LinChkFv(); -extern "C" void __dt__11dBgS_LinChkFv(); -extern "C" void Set__11dBgS_LinChkFPC4cXyzPC4cXyzPC10fopAc_ac_c(); -extern "C" void SetObj__16dBgS_PolyPassChkFv(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void Move__10dCcD_GSttsFv(); -extern "C" void Init__9dCcD_SttsFiiP10fopAc_ac_c(); -extern "C" void __ct__12dCcD_GObjInfFv(); -extern "C" void ChkTgHit__12dCcD_GObjInfFv(); -extern "C" void GetTgHitObj__12dCcD_GObjInfFv(); -extern "C" void getHitSeID__12dCcD_GObjInfFUci(); -extern "C" void Set__8dCcD_CylFRC11dCcD_SrcCyl(); -extern "C" void at_power_check__FP11dCcU_AtInfo(); -extern "C" void Start__9dCamera_cFv(); -extern "C" void Stop__9dCamera_cFv(); -extern "C" void SetTrimSize__9dCamera_cFl(); -extern "C" void Set__9dCamera_cF4cXyz4cXyzfs(); -extern "C" void Reset__9dCamera_cF4cXyz4cXyz(); -extern "C" void dCam_getBody__Fv(); -extern "C" void Eye__9dCamera_cFv(); -extern "C" void Center__9dCamera_cFv(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void dKy_BossLight_set__FP4cXyzP8_GXColorfUc(); -extern "C" void dKy_darkworld_check__Fv(); -extern "C" void __ct__10dMsgFlow_cFv(); -extern "C" void init__10dMsgFlow_cFP10fopAc_ac_ciiPP10fopAc_ac_c(); -extern "C" void doFlow__10dMsgFlow_cFP10fopAc_ac_cPP10fopAc_ac_ci(); -extern "C" void Set__4cCcSFP8cCcD_Obj(); -extern "C" void __mi__4cXyzCFRC3Vec(); -extern "C" void cM_atan2s__Fff(); -extern "C" void cM_rndF__Ff(); -extern "C" void cM_rndFX__Ff(); -extern "C" void SetPos__11cBgS_GndChkFPC4cXyz(); -extern "C" void __dt__13cBgS_PolyInfoFv(); -extern "C" void __dt__8cM3dGCirFv(); -extern "C" void SetC__8cM3dGCylFRC4cXyz(); -extern "C" void cLib_addCalc2__FPffff(); -extern "C" void cLib_addCalcPos__FP4cXyzRC4cXyzfff(); -extern "C" void cLib_addCalcPos2__FP4cXyzRC4cXyzff(); -extern "C" void cLib_addCalcAngleS2__FPssss(); -extern "C" void cLib_chaseF__FPfff(); -extern "C" void cLib_chaseAngleS__FPsss(); -extern "C" void cLib_targetAngleY__FPC3VecPC3Vec(); -extern "C" void cLib_offsetPos__FP4cXyzPC4cXyzsPC4cXyz(); -extern "C" void MtxPosition__FP4cXyzP4cXyz(); -extern "C" void func_802807E0(); -extern "C" void __ct__15Z2CreatureEnemyFv(); -extern "C" void init__15Z2CreatureEnemyFP3VecP3VecUcUc(); -extern "C" void setEnemyName__15Z2CreatureEnemyFPCc(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void init__12J3DFrameCtrlFs(); -extern "C" void checkPass__12J3DFrameCtrlFf(); -extern "C" void _savegpr_19(); -extern "C" void _savegpr_24(); -extern "C" void _savegpr_25(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_27(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_19(); -extern "C" void _restgpr_24(); -extern "C" void _restgpr_25(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_27(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__8dCcD_Cyl[36]; -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__12cCcD_CylAttr[25]; -extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; -extern "C" u8 mCurrentMtx__6J3DSys[48]; -extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern u8 struct_80450C98[4]; -extern "C" f32 mGroundY__11fopAcM_gc_c; -extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" extern u8 pauseTimer__9dScnPly_c[4]; -extern "C" void __register_global_object(); - -// -// Declarations: -// - -/* ############################################################################################## */ -/* 8074BF3C-8074BF40 000000 0004+00 35/35 0/0 0/0 .rodata @3910 */ -SECTION_RODATA static f32 const lit_3910 = 100.0f; -COMPILER_STRIP_GATE(0x8074BF3C, &lit_3910); - -/* 8074BF40-8074BF44 000004 0004+00 5/35 0/0 0/0 .rodata @3911 */ -SECTION_RODATA static u8 const lit_3911[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x8074BF40, &lit_3911); - -/* 8074BF44-8074BF4C 000008 0004+04 3/28 0/0 0/0 .rodata @3912 */ -SECTION_RODATA static f32 const lit_3912[1 + 1 /* padding */] = { - 1.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x8074BF44, &lit_3912); - -/* 8074BF4C-8074BF54 000010 0008+00 0/9 0/0 0/0 .rodata @3913 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3913[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8074BF4C, &lit_3913); -#pragma pop - -/* 8074BF54-8074BF5C 000018 0008+00 0/9 0/0 0/0 .rodata @3914 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3914[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8074BF54, &lit_3914); -#pragma pop - -/* 8074BF5C-8074BF64 000020 0008+00 0/9 0/0 0/0 .rodata @3915 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3915[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8074BF5C, &lit_3915); -#pragma pop - -/* 8074BF64-8074BF68 000028 0004+00 0/2 0/0 0/0 .rodata @3916 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3916 = 1.0f / 100.0f; -COMPILER_STRIP_GATE(0x8074BF64, &lit_3916); -#pragma pop - -/* 8074BF68-8074BF6C 00002C 0004+00 0/1 0/0 0/0 .rodata @3933 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3933 = 13.0f / 10.0f; -COMPILER_STRIP_GATE(0x8074BF68, &lit_3933); -#pragma pop - -/* 8074BF6C-8074BF70 000030 0004+00 0/7 0/0 0/0 .rodata @3934 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3934 = 400.0f; -COMPILER_STRIP_GATE(0x8074BF6C, &lit_3934); -#pragma pop - -/* 8074BF70-8074BF74 000034 0004+00 0/4 0/0 0/0 .rodata @3935 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3935 = 20.0f; -COMPILER_STRIP_GATE(0x8074BF70, &lit_3935); -#pragma pop - -/* 8074BF74-8074BF78 000038 0004+00 0/6 0/0 0/0 .rodata @3936 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3936 = 300.0f; -COMPILER_STRIP_GATE(0x8074BF74, &lit_3936); -#pragma pop - -/* 8074BF78-8074BF7C 00003C 0004+00 0/2 0/0 0/0 .rodata @3937 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3937 = 180.0f; -COMPILER_STRIP_GATE(0x8074BF78, &lit_3937); -#pragma pop - -/* 8074BF7C-8074BF80 000040 0004+00 0/1 0/0 0/0 .rodata @3938 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3938 = 90.0f; -COMPILER_STRIP_GATE(0x8074BF7C, &lit_3938); -#pragma pop - -/* 8074BF80-8074BF84 000044 0004+00 0/1 0/0 0/0 .rodata @3939 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3939 = 255.0f; -COMPILER_STRIP_GATE(0x8074BF80, &lit_3939); -#pragma pop - -/* 8074BF84-8074BF88 000048 0004+00 0/1 0/0 0/0 .rodata @3940 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3940 = 85.0f; -COMPILER_STRIP_GATE(0x8074BF84, &lit_3940); -#pragma pop - -/* 8074BF88-8074BF8C 00004C 0004+00 0/1 0/0 0/0 .rodata @3941 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3941 = 4.0f; -COMPILER_STRIP_GATE(0x8074BF88, &lit_3941); -#pragma pop - -/* 8074C150-8074C15C 000000 000C+00 1/1 0/0 0/0 .data cNullVec__6Z2Calc */ -SECTION_DATA static u8 cNullVec__6Z2Calc[12] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -/* 8074C15C-8074C170 00000C 0004+10 0/0 0/0 0/0 .data @1787 */ -#pragma push -#pragma force_active on -SECTION_DATA static u32 lit_1787[1 + 4 /* padding */] = { - 0x02000201, - /* padding */ - 0x40080000, - 0x00000000, - 0x3FE00000, - 0x00000000, -}; -#pragma pop - -/* 8074C170-8074C178 000020 0008+00 0/1 0/0 0/0 .data e_prim$3789 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 e_prim[8] = { - 0xFF, 0x78, 0x00, 0x00, 0xFF, 0x64, 0x78, 0x00, -}; -#pragma pop - -/* 8074C178-8074C180 000028 0008+00 0/1 0/0 0/0 .data e_env$3790 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 e_env[8] = { - 0x5A, 0x2D, 0x2D, 0x00, 0x3C, 0x1E, 0x1E, 0x00, -}; -#pragma pop - -/* 8074C180-8074C188 000030 0006+02 0/1 0/0 0/0 .data eff_id$3798 */ -#pragma push -#pragma force_active on -SECTION_DATA static u8 eff_id[6 + 2 /* padding */] = { - 0x02, - 0x9D, - 0x02, - 0x9E, - 0x02, - 0x9F, - /* padding */ - 0x00, - 0x00, -}; -#pragma pop - -/* 8074C188-8074C190 000038 0006+02 1/1 0/0 0/0 .data gakki_eff_id$4453 */ -SECTION_DATA static u8 gakki_eff_id_4453[6 + 2 /* padding */] = { - 0x82, - 0x01, - 0x82, - 0x02, - 0x82, - 0x03, - /* padding */ - 0x00, - 0x00, -}; - -/* 8074C190-8074C1AC -00001 001C+00 1/1 0/0 0/0 .data @5539 */ -SECTION_DATA static void* lit_5539[7] = { - (void*)(((char*)Action__8daE_PM_cFv) + 0x40), (void*)(((char*)Action__8daE_PM_cFv) + 0x60), - (void*)(((char*)Action__8daE_PM_cFv) + 0x78), (void*)(((char*)Action__8daE_PM_cFv) + 0x50), - (void*)(((char*)Action__8daE_PM_cFv) + 0x90), (void*)(((char*)Action__8daE_PM_cFv) + 0xA0), - (void*)(((char*)Action__8daE_PM_cFv) + 0xA8), -}; - -/* 8074C1AC-8074C1C8 -00001 001C+00 1/1 0/0 0/0 .data @5721 */ -SECTION_DATA static void* lit_5721[7] = { - (void*)(((char*)DemoBossStart2__8daE_PM_cFv) + 0x7C), - (void*)(((char*)DemoBossStart2__8daE_PM_cFv) + 0x138), - (void*)(((char*)DemoBossStart2__8daE_PM_cFv) + 0x2D0), - (void*)(((char*)DemoBossStart2__8daE_PM_cFv) + 0x530), - (void*)(((char*)DemoBossStart2__8daE_PM_cFv) + 0x5B8), - (void*)(((char*)DemoBossStart2__8daE_PM_cFv) + 0x66C), - (void*)(((char*)DemoBossStart2__8daE_PM_cFv) + 0x6D8), -}; - -/* 8074C1C8-8074C1E8 -00001 0020+00 1/1 0/0 0/0 .data @5995 */ -SECTION_DATA static void* lit_5995[8] = { - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0x6C), - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0x11C), - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0x3D4), - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0x750), - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0x93C), - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0x9D4), - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0xA90), - (void*)(((char*)DemoBossStart__8daE_PM_cFv) + 0xB0C), -}; - -/* 8074C1E8-8074C218 -00001 0030+00 1/1 0/0 0/0 .data @6344 */ -SECTION_DATA static void* lit_6344[12] = { - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x50), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x28C), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x324), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x614), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x73C), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x880), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x880), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x880), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x880), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x880), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x818), - (void*)(((char*)BossDamageAction__8daE_PM_cFv) + 0x83C), -}; - -/* 8074C218-8074C234 -00001 001C+00 1/1 0/0 0/0 .data @6659 */ -SECTION_DATA static void* lit_6659[7] = { - (void*)(((char*)BossAction__8daE_PM_cFv) + 0x44), - (void*)(((char*)BossAction__8daE_PM_cFv) + 0xA0), - (void*)(((char*)BossAction__8daE_PM_cFv) + 0xB8), - (void*)(((char*)BossAction__8daE_PM_cFv) + 0x4C), - (void*)(((char*)BossAction__8daE_PM_cFv) + 0xC0), - (void*)(((char*)BossAction__8daE_PM_cFv) + 0xC8), - (void*)(((char*)BossAction__8daE_PM_cFv) + 0xD0), -}; - -/* 8074C234-8074C23C 0000E4 0006+02 1/1 0/0 0/0 .data gakki_eff_id$6954 */ -SECTION_DATA static u8 gakki_eff_id_6954[6 + 2 /* padding */] = { - 0x82, - 0x01, - 0x82, - 0x02, - 0x82, - 0x03, - /* padding */ - 0x00, - 0x00, -}; - -/* 8074C23C-8074C25C -00001 0020+00 1/0 0/0 0/0 .data l_daE_PM_Method */ -static actor_method_class l_daE_PM_Method = { - (process_method_func)daE_PM_Create__FP10fopAc_ac_c, - (process_method_func)daE_PM_Delete__FP8daE_PM_c, - (process_method_func)daE_PM_Execute__FP8daE_PM_c, - (process_method_func)daE_PM_IsDelete__FP8daE_PM_c, - (process_method_func)daE_PM_Draw__FP8daE_PM_c, -}; - -/* 8074C25C-8074C28C -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_PM */ -extern actor_process_profile_definition g_profile_E_PM = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_E_PM, // mProcName - &g_fpcLf_Method.mBase, // sub_method - sizeof(daE_PM_c), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 161, // mPriority - &l_daE_PM_Method, // sub_method - 0x00040100, // mStatus - fopAc_ENEMY_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType +#include "d/d_com_inf_game.h" +#include "d/d_path.h" +#include "d/actor/d_a_e_fs.h" +#include "d/actor/d_a_player.h" +#include "d/actor/d_a_obj_smw_stone.h" +UNK_REL_DATA +#include "f_op/f_op_actor_enemy.h" + +enum Action { + /* 0x0 */ ACT_START, + /* 0x1 */ ACT_WAIT, + /* 0x2 */ ACT_ESCAPE, + /* 0x3 */ ACT_CREATE, + /* 0x4 */ ACT_DAMAGE, + /* 0x5 */ ACT_DEATH, + /* 0x6 */ ACT_DEMO, }; -/* 8074C28C-8074C298 00013C 000C+00 1/1 0/0 0/0 .data __vt__12dBgS_AcchCir */ -SECTION_DATA extern void* __vt__12dBgS_AcchCir[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_AcchCirFv, +enum Animation { + /* 0x06 */ ANM_APPEAR01 = 6, + /* 0x07 */ ANM_APPEAR02, + /* 0x08 */ ANM_DAMAGE, + /* 0x09 */ ANM_DIEA, + /* 0x0A */ ANM_DIEB, + /* 0x0B */ ANM_END, + /* 0x0C */ ANM_FOGBLOW, + /* 0x0D */ ANM_FOGBLOW_EN, + /* 0x0E */ ANM_FOGBLOW_LP, + /* 0x0F */ ANM_FOGBLOW_ST, + /* 0x10 */ ANM_GLAD, + /* 0x11 */ ANM_HIDE, + /* 0x12 */ ANM_KYORO2, + /* 0x13 */ ANM_MOVE, + /* 0x14 */ ANM_OP, + /* 0x15 */ ANM_RUN, + /* 0x16 */ ANM_WAIT01, + /* 0x17 */ ANM_WAIT02, + /* 0x18 */ ANM_WALK, }; -/* 8074C298-8074C2A4 000148 000C+00 2/2 0/0 0/0 .data __vt__10cCcD_GStts */ -SECTION_DATA extern void* __vt__10cCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10cCcD_GSttsFv, +enum Joint { + /* 0x00 */ JNT_CENTER, + /* 0x01 */ JNT_BACKBONE, + /* 0x02 */ JNT_CLOAK1, + /* 0x03 */ JNT_CLOAK2, + /* 0x04 */ JNT_HEAD, + /* 0x05 */ JNT_HAT1, + /* 0x06 */ JNT_HAT2, + /* 0x07 */ JNT_HAT3, + /* 0x08 */ JNT_HAT4, + /* 0x09 */ JNT_NECKLACE1, + /* 0x0A */ JNT_NECKLACE2, + /* 0x0B */ JNT_SHOULDER_L, + /* 0x0C */ JNT_ARM_L1, + /* 0x0D */ JNT_ARM_L2, + /* 0x0E */ JNT_HAND_L, + /* 0x0F */ JNT_SHOULDER_R, + /* 0x10 */ JNT_ARM_R1, + /* 0x11 */ JNT_ARM_R2, + /* 0x12 */ JNT_HAND_R, + /* 0x13 */ JNT_WAIST, + /* 0x14 */ JNT_LEG_L1, + /* 0x15 */ JNT_LEG_L2, + /* 0x16 */ JNT_FOOT_L, + /* 0x17 */ JNT_LEG_R1, + /* 0x18 */ JNT_LEG_R2, + /* 0x19 */ JNT_FOOT_R, + /* 0x1A */ JNT_SKIRT, }; + +UNK_BSS(1109) +UNK_BSS(1107) +UNK_BSS(1105) +UNK_BSS(1104) +UNK_BSS(1099) +UNK_BSS(1097) +UNK_BSS(1095) +UNK_BSS(1094) +UNK_BSS(1057) +UNK_BSS(1055) +UNK_BSS(1053) +UNK_BSS(1052) +UNK_BSS(1014) +UNK_BSS(1012) +UNK_BSS(1010) -/* 8074C2A4-8074C2B0 000154 000C+00 1/1 0/0 0/0 .data __vt__10dCcD_GStts */ -SECTION_DATA extern void* __vt__10dCcD_GStts[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__10dCcD_GSttsFv, -}; - -/* 8074C2B0-8074C2BC 000160 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGCyl */ -SECTION_DATA extern void* __vt__8cM3dGCyl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGCylFv, -}; - -/* 8074C2BC-8074C2C8 00016C 000C+00 2/2 0/0 0/0 .data __vt__8cM3dGAab */ -SECTION_DATA extern void* __vt__8cM3dGAab[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGAabFv, -}; - -/* 8074C2C8-8074C2EC 000178 0024+00 2/2 0/0 0/0 .data __vt__12dBgS_ObjAcch */ -SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_ObjAcchFv, - (void*)NULL, - (void*)NULL, - (void*)func_8074BB0C, - (void*)NULL, - (void*)NULL, - (void*)func_8074BB04, -}; - -/* 8074C2EC-8074C31C 00019C 0030+00 2/2 0/0 0/0 .data __vt__14dBgS_ObjGndChk */ -SECTION_DATA extern void* __vt__14dBgS_ObjGndChk[12] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__14dBgS_ObjGndChkFv, - (void*)NULL, - (void*)NULL, - (void*)func_8074BAEC, - (void*)NULL, - (void*)NULL, - (void*)func_8074BAFC, - (void*)NULL, - (void*)NULL, - (void*)func_8074BAF4, -}; - -/* 8074C31C-8074C328 0001CC 000C+00 1/1 0/0 0/0 .data __vt__8cM3dGPla */ -SECTION_DATA extern void* __vt__8cM3dGPla[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__8cM3dGPlaFv, -}; - -/* 8074C328-8074C334 0001D8 000C+00 2/2 0/0 0/0 .data __vt__12J3DFrameCtrl */ -SECTION_DATA extern void* __vt__12J3DFrameCtrl[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12J3DFrameCtrlFv, -}; +/* 8074C384-8074C388 -00001 0004+00 2/2 0/0 0/0 .bss None */ +/* 8074C384 0001+00 data_8074C384 @1009 */ +/* 8074C385 0003+00 data_8074C385 None */ +static u8 struct_8074C384; +static bool hioInit; -/* 8074C334-8074C340 0001E4 000C+00 2/2 0/0 0/0 .data __vt__12daE_PM_HIO_c */ -SECTION_DATA extern void* __vt__12daE_PM_HIO_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12daE_PM_HIO_cFv, -}; +/* 8074C394-8074C3E0 000054 004C+00 11/13 0/0 0/0 .bss l_HIO */ +static daE_PM_HIO_c l_HIO; /* 80741EEC-80741FB4 0000EC 00C8+00 1/1 0/0 0/0 .text __ct__12daE_PM_HIO_cFv */ daE_PM_HIO_c::daE_PM_HIO_c() { - // NONMATCHING + field_0x4 = -1; + mLampParticleScale = 1.3f; + mGlowEffectScale = 1.0f; + mEscapeRange = 400.0f; + mGlowColor1R = 250; + mGlowColor1G = 85; + mGlowColor1B = 0; + mGlowColor1A = 100; + mGlowColor2R = 0; + mGlowColor2G = 60; + mGlowColor2B = 101; + field_0x24 = 4; + mAdditionalPuppetNum = 2; + mBossEscapeTimer = 450; + field_0x30 = 20.0f; + mCreateTimer = 300.0f; + field_0x2c = 180.0f; + field_0x34 = 90.0f; + mBossLightR = 255.0f; + mBossLightG = 85.0f; + mBossLightB = 0.0f; + field_0x44 = 0.0f; + field_0x48 = 4.0f; } /* 80741FB4-80742004 0001B4 0050+00 1/1 0/0 0/0 .text DemoSkip__8daE_PM_cFi */ void daE_PM_c::DemoSkip(int param_0) { - // NONMATCHING + cDmr_SkipInfo = 1; + dComIfGp_getVibration().StopQuake(0x1f); + SkipChk(); } /* 80742004-80742038 000204 0034+00 2/2 0/0 0/0 .text DemoSkipCallBack__8daE_PM_cFPvi */ -void daE_PM_c::DemoSkipCallBack(void* param_0, int param_1) { - // NONMATCHING +int daE_PM_c::DemoSkipCallBack(void* i_this, int param_1) { + if (i_this != NULL) { + static_cast(i_this)->DemoSkip(param_1); + return 1; + } + return 0; } -/* ############################################################################################## */ -/* 8074C148-8074C148 00020C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_8074C148 = "E_PM"; -#pragma pop - /* 80742038-80742388 000238 0350+00 1/1 0/0 0/0 .text CreateHeap__8daE_PM_cFv */ -void daE_PM_c::CreateHeap() { - // NONMATCHING -} - -/* 80742388-807423D0 000588 0048+00 1/0 0/0 0/0 .text __dt__12J3DFrameCtrlFv */ -// J3DFrameCtrl::~J3DFrameCtrl() { -extern "C" void __dt__12J3DFrameCtrlFv() { - // NONMATCHING +int daE_PM_c::CreateHeap() { + J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1d); + mpMorf = new mDoExt_McaMorfSO(model_data, NULL, NULL, + (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 0x10), + J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1, + &mCreatureSound, 0x80000, 0x11020084); + if (mpMorf == NULL || mpMorf->getModel() == NULL) { + return 0; + } + + mpEyeAnm = new mDoExt_btpAnm(); + if (mpEyeAnm == NULL) { + return 5; + } + if (!mpEyeAnm->init(mpMorf->getModel()->getModelData(), + (J3DAnmTexPattern*)dComIfG_getObjectRes("E_PM", 0x23), + TRUE, J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1)) { + return 5; + } + + model_data = (J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1e); + mpLampModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084); + if (mpLampModel == NULL) { + return 0; + } + + mpTrumpetMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1f), NULL, + NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 0x19), + J3DFrameCtrl::LOOP_ONCE_e, 0.0f, 0, -1, 1, NULL, + 0x80000, 0x11000084); + if (mpTrumpetMorf == NULL || mpTrumpetMorf->getModel() == NULL) { + return 0; + } + + mpGlowEffectMorf = new mDoExt_McaMorf((J3DModelData*)dComIfG_getObjectRes("E_PM", 0x1c), NULL, + NULL, (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 5), + J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 0, -1, 1, NULL, + 0x80000, 0x11000084); + if (mpGlowEffectMorf == NULL || mpGlowEffectMorf->getModel() == NULL) { + return 0; + } + + return 1; } /* 807423D0-807423F0 0005D0 0020+00 1/1 0/0 0/0 .text useHeapInit__FP10fopAc_ac_c */ -static void useHeapInit(fopAc_ac_c* param_0) { - // NONMATCHING +static int useHeapInit(fopAc_ac_c* i_this) { + return static_cast(i_this)->CreateHeap(); } /* 807423F0-80742448 0005F0 0058+00 2/2 0/0 0/0 .text s_pm_sub__FPvPv */ -static void s_pm_sub(void* param_0, void* param_1) { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074BF8C-8074BFD0 000050 0044+00 1/1 0/0 0/0 .rodata ccCylSrc$4052 */ -const static dCcD_SrcCyl ccCylSrc = { - { - {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0xd8fbfdff, 0x51}, 0x75}}, // mObj - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt - {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjTg - {0x0}, // mGObjCo - }, // mObjInf - { - {0.0f, 0.0f, 0.0f}, // mCenter - 40.0f, // mRadius - 130.0f // mHeight - } // mCyl -}; +static void* s_pm_sub(void* i_proc, void* i_data) { + if (fopAc_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_E_PM + && static_cast(i_proc)->SwitchChk() == 1) { + return i_proc; + } + return NULL; +} /* 80742448-807424C0 000648 0078+00 1/1 0/0 0/0 .text initCcCylinder__8daE_PM_cFv */ void daE_PM_c::initCcCylinder() { - // NONMATCHING + const static dCcD_SrcCyl ccCylSrc = { + { + {0x0, {{AT_TYPE_CSTATUE_SWING, 0x1, 0xd}, {0xd8fbfdff, 0x51}, 0x75}}, // mObj + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjAt + {dCcD_SE_NONE, 0x0, 0x0, 0x0, 0x0}, // mGObjTg + {0x0}, // mGObjCo + }, // mObjInf + { + {0.0f, 0.0f, 0.0f}, // mCenter + 40.0f, // mRadius + 130.0f // mHeight + } // mCyl + }; + + mCcStts.Init(0xff, 0xff, this); + mCcCyl.Set(ccCylSrc); + mCcCyl.SetStts(&mCcStts); + mCcCyl.SetC(current.pos); + mCcCyl.OffAtSetBit(); + mCcCyl.OnTgSetBit(); } /* 807424C0-80742508 0006C0 0048+00 1/1 0/0 0/0 .text setCcCylinder__8daE_PM_cFv */ void daE_PM_c::setCcCylinder() { - // NONMATCHING + mCcCyl.SetC(current.pos); + dComIfG_Ccsp()->Set(&mCcCyl); } /* 80742508-807425B4 000708 00AC+00 1/1 0/0 0/0 .text ctrlJoint__8daE_PM_cFP8J3DJointP8J3DModel */ -void daE_PM_c::ctrlJoint(J3DJoint* param_0, J3DModel* param_1) { - // NONMATCHING +int daE_PM_c::ctrlJoint(J3DJoint* i_joint, J3DModel* i_model) { + int jntNo = i_joint->getJntNo(); + mDoMtx_stack_c::copy(i_model->getAnmMtx(jntNo)); + if (jntNo == JNT_HEAD) { + mDoMtx_stack_c::XrotM(mHeadAngleX); + mDoMtx_stack_c::ZrotM(mHeadAngleZ); + } + i_model->setAnmMtx(jntNo, mDoMtx_stack_c::get()); + MTXCopy(mDoMtx_stack_c::get(), J3DSys::mCurrentMtx); + return 1; } /* 807425B4-80742600 0007B4 004C+00 1/1 0/0 0/0 .text JointCallBack__FP8J3DJointi */ -static void JointCallBack(J3DJoint* param_0, int param_1) { - // NONMATCHING +static int JointCallBack(J3DJoint* i_joint, int param_1) { + if (param_1 == 0) { + J3DModel* model = j3dSys.getModel(); + daE_PM_c* _this = (daE_PM_c*)model->getUserArea(); + if (_this != NULL) { + _this->ctrlJoint(i_joint, model); + } + } + return 1; } /* 80742600-80742674 000800 0074+00 6/6 0/0 0/0 .text Particle_Set__8daE_PM_cFUs4cXyz */ -void daE_PM_c::Particle_Set(u16 param_0, cXyz param_1) { - // NONMATCHING +void daE_PM_c::Particle_Set(u16 i_id, cXyz i_pos) { + dComIfGp_particle_set(i_id, &i_pos, &tevStr, &shape_angle, NULL); } -/* ############################################################################################## */ -/* 8074BFD0-8074BFD4 000094 0004+00 1/3 0/0 0/0 .rodata @4114 */ -SECTION_RODATA static f32 const lit_4114 = -1.0f; -COMPILER_STRIP_GATE(0x8074BFD0, &lit_4114); - /* 80742674-80742720 000874 00AC+00 20/20 0/0 0/0 .text SetAnm__8daE_PM_cFiiff */ -void daE_PM_c::SetAnm(int param_0, int param_1, f32 param_2, f32 param_3) { - // NONMATCHING +void daE_PM_c::SetAnm(int i_anm, int i_attr, f32 i_morf, f32 i_rate) { + J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", i_anm); + mpMorf->setAnm(bck, i_attr, i_morf, i_rate, 0.0f, -1.0f); + mAnm = i_anm; } -/* 80742720-80742768 000920 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGPlaFv */ -// cM3dGPla::~cM3dGPla() { -extern "C" void __dt__8cM3dGPlaFv() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074BFD4-8074BFD8 000098 0004+00 2/4 0/0 0/0 .rodata @4153 */ -SECTION_RODATA static f32 const lit_4153 = 30.0f; -COMPILER_STRIP_GATE(0x8074BFD4, &lit_4153); - /* 80742768-80742810 000968 00A8+00 2/2 0/0 0/0 .text way_bg_check2__FP8daE_PM_c4cXyz4cXyz */ -static void way_bg_check2(daE_PM_c* param_0, cXyz param_1, cXyz param_2) { - // NONMATCHING +static BOOL way_bg_check2(daE_PM_c* i_this, cXyz i_start, cXyz i_end) { + dBgS_LinChk lin_chk; + i_start.y += 30.0f; + lin_chk.Set(&i_start, &i_end, i_this); + if (dComIfG_Bgsp().LineCross(&lin_chk)) { + return TRUE; + } else { + return FALSE; + } } -/* ############################################################################################## */ -/* 8074BFD8-8074BFDC 00009C 0004+00 1/1 0/0 0/0 .rodata @4223 */ -SECTION_RODATA static f32 const lit_4223 = 40.0f; -COMPILER_STRIP_GATE(0x8074BFD8, &lit_4223); - /* 80742810-807428A8 000A10 0098+00 1/1 0/0 0/0 .text Yazirushi__8daE_PM_cFv */ void daE_PM_c::Yazirushi() { - // NONMATCHING + cXyz zero; + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_HEAD), *calc_mtx); + zero.set(0.0f, 0.0f, 0.0f); + MtxPosition(&zero, &eyePos); + attention_info.position = eyePos; + attention_info.position.y += 40.0f; } -/* ############################################################################################## */ -/* 8074BFDC-8074BFE4 0000A0 0008+00 3/7 0/0 0/0 .rodata @4239 */ -SECTION_RODATA static u8 const lit_4239[8] = { - 0x43, 0x30, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8074BFDC, &lit_4239); - /* 807428A8-80742958 000AA8 00B0+00 1/1 0/0 0/0 .text SearchRndP__8daE_PM_cFv */ void daE_PM_c::SearchRndP() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C348-8074C34C 000008 0001+03 3/3 0/0 0/0 .bss @1109 */ -static u8 lit_1109[1 + 3 /* padding */]; - -/* 8074C34C-8074C350 00000C 0001+03 0/0 0/0 0/0 .bss @1107 */ -#pragma push -#pragma force_active on -static u8 lit_1107[1 + 3 /* padding */]; -#pragma pop - -/* 8074C350-8074C354 000010 0001+03 0/0 0/0 0/0 .bss @1105 */ -#pragma push -#pragma force_active on -static u8 lit_1105[1 + 3 /* padding */]; -#pragma pop - -/* 8074C354-8074C358 000014 0001+03 0/0 0/0 0/0 .bss @1104 */ -#pragma push -#pragma force_active on -static u8 lit_1104[1 + 3 /* padding */]; -#pragma pop - -/* 8074C358-8074C35C 000018 0001+03 0/0 0/0 0/0 .bss @1099 */ -#pragma push -#pragma force_active on -static u8 lit_1099[1 + 3 /* padding */]; -#pragma pop - -/* 8074C35C-8074C360 00001C 0001+03 0/0 0/0 0/0 .bss @1097 */ -#pragma push -#pragma force_active on -static u8 lit_1097[1 + 3 /* padding */]; -#pragma pop - -/* 8074C360-8074C364 000020 0001+03 0/0 0/0 0/0 .bss @1095 */ -#pragma push -#pragma force_active on -static u8 lit_1095[1 + 3 /* padding */]; -#pragma pop - -/* 8074C364-8074C368 000024 0001+03 0/0 0/0 0/0 .bss @1094 */ -#pragma push -#pragma force_active on -static u8 lit_1094[1 + 3 /* padding */]; -#pragma pop - -/* 8074C368-8074C36C 000028 0001+03 0/0 0/0 0/0 .bss @1057 */ -#pragma push -#pragma force_active on -static u8 lit_1057[1 + 3 /* padding */]; -#pragma pop - -/* 8074C36C-8074C370 00002C 0001+03 0/0 0/0 0/0 .bss @1055 */ -#pragma push -#pragma force_active on -static u8 lit_1055[1 + 3 /* padding */]; -#pragma pop - -/* 8074C370-8074C374 000030 0001+03 0/0 0/0 0/0 .bss @1053 */ -#pragma push -#pragma force_active on -static u8 lit_1053[1 + 3 /* padding */]; -#pragma pop - -/* 8074C374-8074C378 000034 0001+03 0/0 0/0 0/0 .bss @1052 */ -#pragma push -#pragma force_active on -static u8 lit_1052[1 + 3 /* padding */]; -#pragma pop - -/* 8074C378-8074C37C 000038 0001+03 0/0 0/0 0/0 .bss @1014 */ -#pragma push -#pragma force_active on -static u8 lit_1014[1 + 3 /* padding */]; -#pragma pop - -/* 8074C37C-8074C380 00003C 0001+03 0/0 0/0 0/0 .bss @1012 */ -#pragma push -#pragma force_active on -static u8 lit_1012[1 + 3 /* padding */]; -#pragma pop - -/* 8074C380-8074C384 000040 0001+03 0/0 0/0 0/0 .bss @1010 */ -#pragma push -#pragma force_active on -static u8 lit_1010[1 + 3 /* padding */]; -#pragma pop - -/* 8074C384-8074C388 -00001 0004+00 2/2 0/0 0/0 .bss None */ -/* 8074C384 0001+00 data_8074C384 @1009 */ -/* 8074C385 0003+00 data_8074C385 None */ -static u8 struct_8074C384[4]; - -/* 8074C388-8074C394 000048 000C+00 1/1 0/0 0/0 .bss @3928 */ -static u8 lit_3928[12]; + int index; + do { + index = cM_rndF(mpPath->m_num - 1); + } while (mPointIndex == index); + mPointIndex = index; + mPoint = dPath_GetPnt(mpPath, mPointIndex)->m_position; +} -/* 8074C394-8074C3E0 000054 004C+00 11/13 0/0 0/0 .bss l_HIO */ -static u8 l_HIO[76]; +namespace { /* 8074C3E0-8074C3E4 0000A0 0004+00 2/5 0/0 0/0 .bss s_dis__22@unnamed@d_a_e_pm_cpp@ */ -static u8 data_8074C3E0[4]; +static f32 s_dis; /* 8074C3E4-8074C3E8 0000A4 0004+00 10/11 0/0 0/0 .bss s_LinkPos__22@unnamed@d_a_e_pm_cpp@ */ -static u8 data_8074C3E4[4]; +static cXyz* s_LinkPos; + +/* 8074C3E8-8074C3EC 0000A8 0002+02 13/16 0/0 0/0 .bss s_TargetAngle__22@unnamed@d_a_e_pm_cpp@ */ +static s16 s_TargetAngle; + +} // namespace /* 80742958-80742C94 000B58 033C+00 1/1 0/0 0/0 .text SearchFarP__8daE_PM_cFv */ +// NONMATCHING regalloc, instruction order void daE_PM_c::SearchFarP() { - // NONMATCHING + //! @bug best_distance is not initialized + f32 best_distance; + int best_index; + dStage_dPnt_c* pnt = dPath_GetPnt(mpPath, 0); + cXyz point(pnt->m_position.x, pnt->m_position.y, pnt->m_position.z); + for (int i = 0; i < mpPath->m_num; i++) { + pnt = dPath_GetPnt(mpPath, i); + point.set(pnt->m_position.x, pnt->m_position.y, pnt->m_position.z); + if (s_LinkPos->absXZ(point) > best_distance && mPointIndex != i) { + best_index = i; + best_distance = s_LinkPos->absXZ(point); + } + } + pnt = dPath_GetPnt(mpPath, best_index); + mPointIndex = best_index; + mPoint = pnt->m_position; } -/* ############################################################################################## */ -/* 8074BFE4-8074BFE8 0000A8 0004+00 0/1 0/0 0/0 .rodata @4407 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4407 = 1000000000.0f; -COMPILER_STRIP_GATE(0x8074BFE4, &lit_4407); -#pragma pop - /* 80742C94-80742E1C 000E94 0188+00 3/3 0/0 0/0 .text SearchNearP__8daE_PM_cFv */ void daE_PM_c::SearchNearP() { - // NONMATCHING + //! @bug Whatever this function is supposed to do is almost certainly not what it actually does. + dStage_dPnt_c* pnt = dPath_GetPnt(mpPath, 0); + if (current.pos.absXZ(pnt->m_position) < 1.0e9f) { + mPoint = pnt->m_position; + } } /* 80742E1C-80742FB4 00101C 0198+00 2/2 0/0 0/0 .text SearchNextPos__8daE_PM_cFv */ -void daE_PM_c::SearchNextPos() { - // NONMATCHING +BOOL daE_PM_c::SearchNextPos() { + cXyz point(mPoint.x, mPoint.y, mPoint.z); + if (current.pos.abs(point) < 100.0f) { + int index = mPointIndex + 1; + if (index >= mpPath->m_num) { + return TRUE; + } + mPointIndex = index; + mPoint = dPath_GetPnt(mpPath, mPointIndex)->m_position; + } + return FALSE; } /* 80742FB4-807430C4 0011B4 0110+00 1/1 0/0 0/0 .text SetGakkiEffect__8daE_PM_cFv */ void daE_PM_c::SetGakkiEffect() { - // NONMATCHING + static u16 gakki_eff_id[3] = {0x8201, 0x8202, 0x8203}; + for (int i = 0; i < 3; i++) { + mGakkiParticleKey[i] = dComIfGp_particle_set(mGakkiParticleKey[i], gakki_eff_id[i], + ¤t.pos, NULL, NULL); + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(mGakkiParticleKey[i]); + if (emitter != NULL) { + MTXCopy(mpTrumpetMorf->getModel()->getAnmMtx(2), *calc_mtx); + emitter->setGlobalRTMatrix(*calc_mtx); + } + } } -/* ############################################################################################## */ -/* 8074BFE8-8074BFEC 0000AC 0004+00 1/1 0/0 0/0 .rodata @4520 */ -SECTION_RODATA static f32 const lit_4520 = 65.0f; -COMPILER_STRIP_GATE(0x8074BFE8, &lit_4520); - /* 807430C4-80743210 0012C4 014C+00 4/4 0/0 0/0 .text CameraSet__8daE_PM_cFv */ -void daE_PM_c::CameraSet() { - // NONMATCHING +bool daE_PM_c::CameraSet() { + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + dCamera_c* camera_body = dCam_getBody(); + + if (!eventInfo.i_checkCommandDemoAccrpt()) { + fopAcM_orderPotentialEvent(this, 2, 0xffff, 0); + return false; + } + + camera->mCamera.Stop(); + mCamFovY = 65.0f; + mCamCenter = camera_body->Center(); + mCamCenterTarget = mCamCenter; + mCamCenterTarget2 = mCamCenter; + mCamEye = camera_body->Eye(); + mCamEyeTarget = mCamEye; + mCamEyeTarget2 = mCamEye; + camera->mCamera.SetTrimSize(1); + + return true; } /* 80743210-80743294 001410 0084+00 5/5 0/0 0/0 .text SetStopingCam__8daE_PM_cFv */ void daE_PM_c::SetStopingCam() { - // NONMATCHING + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + camera->mCamera.Set(mCamCenter, mCamEye, mCamFovY, 0); } /* 80743294-807433E8 001494 0154+00 6/6 0/0 0/0 .text SetStopCam__8daE_PM_cF4cXyzffs */ -void daE_PM_c::SetStopCam(cXyz param_0, f32 param_1, f32 param_2, s16 param_3) { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074BFEC-8074BFF0 0000B0 0004+00 0/1 0/0 0/0 .rodata @4593 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4593 = 2.0f; -COMPILER_STRIP_GATE(0x8074BFEC, &lit_4593); -#pragma pop - -/* 8074BFF0-8074BFF4 0000B4 0004+00 0/1 0/0 0/0 .rodata @4594 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4594 = 160.0f; -COMPILER_STRIP_GATE(0x8074BFF0, &lit_4594); -#pragma pop - -/* 8074BFF4-8074BFF8 0000B8 0004+00 0/2 0/0 0/0 .rodata @4595 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4595 = 80.0f; -COMPILER_STRIP_GATE(0x8074BFF4, &lit_4595); -#pragma pop +void daE_PM_c::SetStopCam(cXyz i_center, f32 i_offsetXZ, f32 i_offsetY, s16 i_angle) { + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + cXyz offset(0.0f, i_offsetY, i_offsetXZ); + cXyz eye(0.0f, 0.0f, 0.0f); + mCamCenter.set(i_center.x, i_center.y, i_center.z); + mCamCenterTarget = mCamCenter; + mCamCenterTarget2 = mCamCenter; + cLib_offsetPos(&eye, &mCamCenter, i_angle, &offset); + mCamEye = eye; + mCamEyeTarget = eye; + mCamEyeTarget2 = eye; + camera->mCamera.Set(mCamCenter, mCamEye, mCamFovY, 0); +} /* 807433E8-80743524 0015E8 013C+00 1/1 0/0 0/0 .text SetMoveCam2__8daE_PM_cFff */ -void daE_PM_c::SetMoveCam2(f32 param_0, f32 param_1) { - // NONMATCHING +void daE_PM_c::SetMoveCam2(f32 i_scale, f32 i_step) { + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + cLib_addCalcPos(&mCamCenterTarget2, mCamCenterTarget, i_scale * 2.0f, i_step * 2.0f, 0.0f); + cLib_addCalcPos(&mCamCenter, mCamCenterTarget2, i_scale, i_step, 0.0f); + cLib_addCalcPos(&mCamEyeTarget2, mCamEyeTarget, i_scale * 2.0f, 160.0f, 0.0f); + cLib_addCalcPos(&mCamEye, mCamEyeTarget2, i_scale, 80.0f, 0.0f); + camera->mCamera.Set(mCamCenter, mCamEye, mCamFovY, 0); } /* 80743524-80743600 001724 00DC+00 9/9 0/0 0/0 .text SetMoveCam__8daE_PM_cFff */ -void daE_PM_c::SetMoveCam(f32 param_0, f32 param_1) { - // NONMATCHING +void daE_PM_c::SetMoveCam(f32 i_scale, f32 i_step) { + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + cLib_addCalcPos(&mCamCenter, mCamCenterTarget, i_scale, i_step, 0.0f); + cLib_addCalcPos(&mCamEye, mCamEyeTarget, i_scale, 100.0f, 0.0f); + camera->mCamera.Set(mCamCenter, mCamEye, mCamFovY, 0); } /* 80743600-807436A4 001800 00A4+00 7/7 0/0 0/0 .text SetReleaseCam__8daE_PM_cFv */ void daE_PM_c::SetReleaseCam() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074BFF8-8074BFFC 0000BC 0004+00 0/1 0/0 0/0 .rodata @4778 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4778 = -10728.0f; -COMPILER_STRIP_GATE(0x8074BFF8, &lit_4778); -#pragma pop - -/* 8074BFFC-8074C000 0000C0 0004+00 0/1 0/0 0/0 .rodata @4779 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4779 = 17052.0f; -COMPILER_STRIP_GATE(0x8074BFFC, &lit_4779); -#pragma pop - -/* 8074C000-8074C004 0000C4 0004+00 0/2 0/0 0/0 .rodata @4780 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4780 = 800.0f; -COMPILER_STRIP_GATE(0x8074C000, &lit_4780); -#pragma pop - -/* 8074C004-8074C008 0000C8 0004+00 0/1 0/0 0/0 .rodata @4781 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4781 = -10477.0f; -COMPILER_STRIP_GATE(0x8074C004, &lit_4781); -#pragma pop - -/* 8074C008-8074C00C 0000CC 0004+00 0/1 0/0 0/0 .rodata @4782 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4782 = 17710.0f; -COMPILER_STRIP_GATE(0x8074C008, &lit_4782); -#pragma pop - -/* 8074C00C-8074C010 0000D0 0004+00 0/2 0/0 0/0 .rodata @4783 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4783 = 1500.0f; -COMPILER_STRIP_GATE(0x8074C00C, &lit_4783); -#pragma pop - -/* 8074C010-8074C014 0000D4 0004+00 0/1 0/0 0/0 .rodata @4784 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4784 = 8500.0f; -COMPILER_STRIP_GATE(0x8074C010, &lit_4784); -#pragma pop - -/* 8074C014-8074C018 0000D8 0004+00 0/1 0/0 0/0 .rodata @4785 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4785 = 600.0f; -COMPILER_STRIP_GATE(0x8074C014, &lit_4785); -#pragma pop - -/* 8074C018-8074C01C 0000DC 0004+00 0/11 0/0 0/0 .rodata @4786 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4786 = 200.0f; -COMPILER_STRIP_GATE(0x8074C018, &lit_4786); -#pragma pop - -/* 8074C01C-8074C020 0000E0 0004+00 0/2 0/0 0/0 .rodata @4787 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4787 = -5.0f; -COMPILER_STRIP_GATE(0x8074C01C, &lit_4787); -#pragma pop - -/* 8074C020-8074C024 0000E4 0004+00 0/20 0/0 0/0 .rodata @4788 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4788 = 5.0f; -COMPILER_STRIP_GATE(0x8074C020, &lit_4788); -#pragma pop - -/* 8074C024-8074C028 0000E8 0004+00 0/1 0/0 0/0 .rodata @4789 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4789 = 900.0f; -COMPILER_STRIP_GATE(0x8074C024, &lit_4789); -#pragma pop - -/* 8074C028-8074C02C 0000EC 0004+00 0/1 0/0 0/0 .rodata @4790 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4790 = 1.0f / 40.0f; -COMPILER_STRIP_GATE(0x8074C028, &lit_4790); -#pragma pop - -/* 8074C02C-8074C030 0000F0 0004+00 0/13 0/0 0/0 .rodata @4791 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4791 = 50.0f; -COMPILER_STRIP_GATE(0x8074C02C, &lit_4791); -#pragma pop - -/* 8074C030-8074C034 0000F4 0004+00 0/2 0/0 0/0 .rodata @4792 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4792 = -300.0f; -COMPILER_STRIP_GATE(0x8074C030, &lit_4792); -#pragma pop - -/* 8074C034-8074C038 0000F8 0004+00 0/1 0/0 0/0 .rodata @4793 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4793 = 3.0f / 20.0f; -COMPILER_STRIP_GATE(0x8074C034, &lit_4793); -#pragma pop - -/* 8074C038-8074C03C 0000FC 0004+00 0/8 0/0 0/0 .rodata @4794 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4794 = 1.0f / 10.0f; -COMPILER_STRIP_GATE(0x8074C038, &lit_4794); -#pragma pop + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + camera->mCamera.Reset(mCamCenter, mCamEye); + camera->mCamera.Start(); + camera->mCamera.SetTrimSize(0); + dComIfGp_event_reset(); +} /* 807436A4-80743D10 0018A4 066C+00 1/1 0/0 0/0 .text Ap_StartAction__8daE_PM_cFv */ void daE_PM_c::Ap_StartAction() { - // NONMATCHING + cXyz offset; + camera_class* camera = dComIfGp_getCamera(dComIfGp_getPlayerCameraID(0)); + cXyz player_pos(-10728.0f, s_LinkPos->y, 17052.0f); + cXyz player_offset(0.0f, 0.0f, 0.0f); + daPy_py_c* player = daPy_getPlayerActorClass(); + daSmWStone_c* stone; + bool bVar3 = false; + + switch (mMode) { + case 0: + if (mAppear) { + bVar3 = true; + } else if (mSecondEncounter && fopAcM_searchPlayerDistanceXZ(this) < 800.0f) { + bVar3 = true; + } + + if (bVar3 && CameraSet()) { + if (dComIfG_play_c::getLayerNo(0) == 2) { + player_pos.set(-10477.0f, mAcch.GetGroundH(), 17710.0f); + } else { + player_offset.set(0.0f, 0.0f, 1500.0f); + cLib_offsetPos(&player_pos, ¤t.pos, shape_angle.y, &player_offset); + player_pos.y = mAcch.GetGroundH() + 100.0f; + } + mMode++; + mTimer[0] = 1; + player->changeOriginalDemo(); + player->changeDemoMode(4, 0, 0, 0); + player->setPlayerPosAndAngle(&player_pos, shape_angle.y + 0x8000, 0); + field_0x6ff = true; + } + break; + + case 1: + if (fopAcM_SearchByName(PROC_Obj_SmWStone, (fopAc_ac_c**)&stone) && stone != NULL) { + stone->deleteStone(); + } + + if (mTimer[0] == 0) { + current.pos.y -= 8500.0f; + mMode++; + mTimer[0] = 110; + offset.set(0.0f, 100.0f, 600.0f); + cLib_offsetPos(&mCamEyeTarget, ¤t.pos, shape_angle.y, &offset); + mCamEyeTarget.y = mAcch.GetGroundH() + 100.0f; + mCamEye = mCamEyeTarget; + mCamEyeTarget2 = mCamEyeTarget; + offset.set(0.0f, 200.0f, 0.0f); + cLib_offsetPos(&mCamCenterTarget, ¤t.pos, shape_angle.y, &offset); + mCamCenterTarget.y = mAcch.GetGroundH() + 200.0f; + mCamCenter = mCamCenterTarget; + mCamCenterTarget2 = mCamCenterTarget; + camera->mCamera.Set(mCamCenter, mCamEye, mCamFovY, 0); + } + break; + + case 2: + if (mTimer[0] == 0) { + mTargetAngleY = shape_angle.y; + mMode++; + gravity = -5.0f; + SetAnm(ANM_APPEAR01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + Particle_Set(0x880D, current.pos); + } + + if (mTimer[0] < 90) { + mCamCenterTarget.y = current.pos.y - 900.0f; + SetMoveCam2(0.025f, 50.0f); + } else { + SetStopingCam(); + } + break; + + case 3: + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, ¤t.pos, &tevStr, + ¤t.angle, &scale, 0xff, NULL, -1, + NULL, NULL, NULL); + + if (mAnm == ANM_APPEAR02 && mpMorf->isStop()) { + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_LAUGH, -1); + } + + if (mCamCenter.y >= current.pos.y) { + mCamCenterTarget.y = current.pos.y; + } + + if (mAcch.ChkGroundHit() && mTimer[0] == 0) { + SetAnm(ANM_APPEAR02, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mTargetHeadAngleX = 0x2000; + mTimer[0] = 40; + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + } else if (mTimer[0] == 1) { + mTargetHeadAngleX = 0; + mMode++; + mTimer[0] = 30; + offset.set(0.0f, 0.0f, -300.0f); + cXyz eye = mCamEyeTarget; + cLib_offsetPos(&mCamEyeTarget, &eye, shape_angle.y, &offset); + mCamCenterTarget.y = current.pos.y + 100.0f; + } + + if (mCamCenterTarget.y <= mAcch.GetGroundH() + 100.0f) { + mCamCenterTarget.y = mAcch.GetGroundH() + 100.0f; + } + mCamEyeTarget.y = mAcch.GetGroundH() + 100.0f; + SetMoveCam2(0.15f, 50.0f); + break; + + case 4: + if (mTimer[0] == 0) { + mAction = ACT_CREATE; + mMode = 0; + } + SetMoveCam2(0.1f, 50.0f); + break; + } } /* 80743D10-80743D8C 001F10 007C+00 1/1 0/0 0/0 .text s_obj_sub__FPvPv */ -static void s_obj_sub(void* param_0, void* param_1) { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C03C-8074C040 000100 0004+00 0/6 0/0 0/0 .rodata @4972 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4972 = 500.0f; -COMPILER_STRIP_GATE(0x8074C03C, &lit_4972); -#pragma pop - -/* 8074C040-8074C044 000104 0004+00 0/3 0/0 0/0 .rodata @4973 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4973 = 150.0f; -COMPILER_STRIP_GATE(0x8074C040, &lit_4973); -#pragma pop - -/* 8074C044-8074C048 000108 0004+00 0/1 0/0 0/0 .rodata @4974 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4974 = -11239.0f; -COMPILER_STRIP_GATE(0x8074C044, &lit_4974); -#pragma pop - -/* 8074C048-8074C04C 00010C 0004+00 0/1 0/0 0/0 .rodata @4975 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4975 = 1850.0f; -COMPILER_STRIP_GATE(0x8074C048, &lit_4975); -#pragma pop - -/* 8074C04C-8074C050 000110 0004+00 0/1 0/0 0/0 .rodata @4976 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4976 = 16932.0f; -COMPILER_STRIP_GATE(0x8074C04C, &lit_4976); -#pragma pop - -/* 8074C050-8074C054 000114 0004+00 0/1 0/0 0/0 .rodata @4977 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4977 = -10954.0f; -COMPILER_STRIP_GATE(0x8074C050, &lit_4977); -#pragma pop - -/* 8074C054-8074C058 000118 0004+00 0/2 0/0 0/0 .rodata @4978 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4978 = 1900.0f; -COMPILER_STRIP_GATE(0x8074C054, &lit_4978); -#pragma pop - -/* 8074C058-8074C05C 00011C 0004+00 0/1 0/0 0/0 .rodata @4979 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4979 = 17025.0f; -COMPILER_STRIP_GATE(0x8074C058, &lit_4979); -#pragma pop - -/* 8074C05C-8074C060 000120 0004+00 0/2 0/0 0/0 .rodata @4980 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4980 = -500.0f; -COMPILER_STRIP_GATE(0x8074C05C, &lit_4980); -#pragma pop - -/* 8074C060-8074C064 000124 0004+00 0/1 0/0 0/0 .rodata @4981 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4981 = 120.0f; -COMPILER_STRIP_GATE(0x8074C060, &lit_4981); -#pragma pop - -/* 8074C064-8074C068 000128 0004+00 0/1 0/0 0/0 .rodata @4982 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4982 = -70.0f; -COMPILER_STRIP_GATE(0x8074C064, &lit_4982); -#pragma pop +static void* s_obj_sub(void* i_proc, void* i_data) { + for (int i = 0; i < 5; i++) { + if (fopAc_IsActor(i_proc) && fopAcM_GetName(i_proc) == PROC_E_PM && i_proc != NULL + && static_cast(i_proc)->SwitchChk() == 0) { + return i_proc; + } + } + return NULL; +} /* 80743D8C-807444F0 001F8C 0764+00 1/2 0/0 0/0 .text Ap_CreateAction__8daE_PM_cFv */ void daE_PM_c::Ap_CreateAction() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C068-8074C06C 00012C 0004+00 0/3 0/0 0/0 .rodata @5045 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5045 = 13.0f; -COMPILER_STRIP_GATE(0x8074C068, &lit_5045); -#pragma pop - -/* 8074C06C-8074C070 000130 0004+00 0/3 0/0 0/0 .rodata @5046 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5046 = 1.0f / 20.0f; -COMPILER_STRIP_GATE(0x8074C06C, &lit_5046); -#pragma pop - -/* 8074C070-8074C074 000134 0004+00 0/3 0/0 0/0 .rodata @5047 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5047 = 10.0f; -COMPILER_STRIP_GATE(0x8074C070, &lit_5047); -#pragma pop - -/* 8074C074-8074C078 000138 0004+00 0/2 0/0 0/0 .rodata @5048 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5048 = -9881.0f; -COMPILER_STRIP_GATE(0x8074C074, &lit_5048); -#pragma pop - -/* 8074C078-8074C07C 00013C 0004+00 0/2 0/0 0/0 .rodata @5049 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5049 = 1892.0f; -COMPILER_STRIP_GATE(0x8074C078, &lit_5049); -#pragma pop - -/* 8074C07C-8074C080 000140 0004+00 0/2 0/0 0/0 .rodata @5050 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5050 = 17971.0f; -COMPILER_STRIP_GATE(0x8074C07C, &lit_5050); -#pragma pop - -/* 8074C3E8-8074C3EC 0000A8 0002+02 13/16 0/0 0/0 .bss s_TargetAngle__22@unnamed@d_a_e_pm_cpp@ */ -static u8 data_8074C3E8[2 + 2 /* padding */]; + cXyz vec1; + cXyz vec2(500.0f, 150.0f, 0.0f); + cXyz vec3(500.0f, 150.0f, 300.0f); + cXyz vec4(0.0f, 0.0f, 0.0f); + cXyz vec5(0.0f, 0.0f, 0.0f); + + switch (mMode) { + case 0: + if (mAnm != ANM_FOGBLOW_ST) { + SetAnm(ANM_FOGBLOW_ST, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_FOGBLOW, -1); + } else if (mpMorf->isStop() && mAnm == ANM_FOGBLOW_ST) { + SetAnm(ANM_FOGBLOW_LP, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mTimer[0] = 80; + mMode++; + mpTrumpetMorf->setAnm((J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 0x19), + J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + vec2.set(0.0f, 0.0f, 150.0f); + vec5 = mCamEyeTarget; + cLib_offsetPos(&mCamEyeTarget, &vec5, shape_angle.y, &vec2); + } + break; + + case 1: + mCreatureSound.startCreatureSoundLevel(Z2SE_EN_PM_TRUMPET, 0, -1); + + if (mTimer[0] == 2 && mAnm == ANM_FOGBLOW_LP) { + vec2.set(500.0f, 150.0f, 0.0f); + mCamCenter.set(-11239.0f, 1850.0f, 16932.0f); + mCamCenterTarget = vec2; + mCamEye.set(-10954.0f, 1900.0f, 17025.0f); + mCamEyeTarget = mCamEye; + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(shape_angle.y); + mDoMtx_stack_c::multVec(&vec2, &vec2); + SetStopCam(vec2, 300.0f, 50.0f, shape_angle.y); + mTimer[1] = 10; + mPoint = dPath_GetPnt(mpPath, 0)->m_position; + mDoorAction = 0; + } else if (mTimer[1] == 1) { + for (int i = 0; i < 2; i++) { + vec5.set(i * 100.0f + 500.0f, 150.0f, -(i * 100.0f)); + cLib_offsetPos(&vec2, ¤t.pos, shape_angle.y, &vec5); + mPuppetID[i] = fopAcM_createChild(PROC_E_FS, fopAcM_GetID(this), 0, &vec2, + fopAcM_GetRoomNo(this), &shape_angle, + NULL, -1, NULL); + } + + mTimer[0] = 100; + mMode++; + } + + SetGakkiEffect(); + break; + + case 2: + mCreatureSound.startCreatureSoundLevel(Z2SE_EN_PM_TRUMPET, 0, -1); + + if (mTimer[0] == 1) { + vec3.set(-300.0f, 150.0f, 300.0f); + vec2.set(-300.0f, 150.0f, 0.0f); + vec4.set(200.0f, 0.0f, 0.0f); + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(shape_angle.y); + mDoMtx_stack_c::multVec(&vec2, &vec2); + mDoMtx_stack_c::multVec(&vec4, &vec4); + SetStopCam(vec2, 300.0f, 50.0f, shape_angle.y); + current.pos = vec4; + mTimer[1] = 10; + } else if (mTimer[1] == 1) { + for (int i = 2; i < 4; i++) { + vec5.set(-500.0f - (i - 2) * 100.0f, 150.0f, -((i - 2) * 100.0f)); + cLib_offsetPos(&vec2, ¤t.pos, shape_angle.y, &vec5); + mPuppetID[i] = fopAcM_createChild(PROC_E_FS, fopAcM_GetID(this), 0, &vec2, + fopAcM_GetRoomNo(this), &shape_angle, + NULL, -1, NULL); + } + + mDoorAction = 2; + current.pos.set(mPoint.x, mPoint.y, mPoint.z); + old.pos = current.pos; + mTimer[0] = 100; + mMode++; + } + + mpTrumpetMorf->setPlaySpeed(0.0f); + break; + + case 3: + if (mTimer[0] == 0) { + field_0x618 = 1; + mAction = ACT_ESCAPE; + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 1.0f, 1.0f); + current.pos.set(mPoint.x, mPoint.y, mPoint.z); + old.pos = current.pos; + vec1.set(mPoint.x, mPoint.y + 120.0f, mPoint.z); + SetStopCam(vec1, 300.0f, -70.0f, shape_angle.y + 0x1000); + shape_angle.y += -0x4000; + current.angle.y += -0x4000; + mTargetAngleY = shape_angle.y; + mTimer[0] = 50; + mMode = 0; + mDoorAction = 2; + } + break; + } + + SetMoveCam(0.1f, 50.0f); +} /* 807444F0-80744790 0026F0 02A0+00 1/1 0/0 0/0 .text Ap_EscapeAction__8daE_PM_cFv */ void daE_PM_c::Ap_EscapeAction() { - // NONMATCHING + cXyz point; + SetMoveCam(0.1f, 50.0f); + + switch (mMode) { + case 0: + mBossLightOn = true; + mTargetHeadAngleX = s_TargetAngle; + cLib_addCalcAngleS2(&mHeadAngleZ, -0x500, 4, 0x600); + + if (mTimer[0] == 0) { + SetAnm(ANM_RUN, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mMode++; + mTargetSpeed = 13.0f; + } + + mDoorAction = 0; + break; + + case 1: + if (mpMorf->getFrame() > 5.0f) { + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + } else { + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + } + + point.set(mPoint.x, mPoint.y, mPoint.z); + mTargetAngleY = cLib_targetAngleY(¤t.pos, &point); + cLib_addCalc2(&speedF, mTargetSpeed, 0.05f, 10.0f); + + if (mPointIndex == 7 && mDoorAction == 0) { + mCamCenter = *s_LinkPos; + mCamCenter.y += 200.0f; + mCamEye.set(-9881.0f, 1892.0f, 17971.0f); + SetReleaseCam(); + mDoorAction = 1; + } + + if (SearchNextPos()) { + fopAcM_delete(this); + if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this))) { + dComIfGs_onSwitch(mSwBit, fopAcM_GetRoomNo(this)); + } + } + break; + + case 2: + if (mTimer[0] == 0) { + daE_PM_c* other = (daE_PM_c*)fpcM_Search(s_pm_sub, this); + if (other != NULL) { + for (int i = 0; i < 4; i++) { + other->mPuppetID[i] = mPuppetID[i]; + } + } + fopAcM_delete(this); + } + break; + } } /* 80744790-80744878 002990 00E8+00 1/1 0/0 0/0 .text AppearAction__8daE_PM_cFv */ void daE_PM_c::AppearAction() { - // NONMATCHING + mTargetHeadAngleX = 0; + + switch (mAction) { + case ACT_START: + Ap_StartAction(); + break; + case ACT_CREATE: + Ap_CreateAction(); + break; + case ACT_ESCAPE: + Ap_EscapeAction(); + shape_angle.y = current.angle.y; + break; + } + + cLib_addCalcAngleS2(¤t.angle.y, mTargetAngleY, 5, 0x1000); + cLib_addCalcAngleS2(&mHeadAngleX, mTargetHeadAngleX, 4, 0x1000); + if (mAction != ACT_START || mMode != 0) { + dComIfGp_getEvent().onSkipFade(); + dComIfGp_getEvent().setSkipProc(this, DemoSkipCallBack, 0); + } } -/* ############################################################################################## */ -/* 8074C080-8074C084 000144 0004+00 1/2 0/0 0/0 .rodata @5216 */ -SECTION_RODATA static f32 const lit_5216 = 0.5f; -COMPILER_STRIP_GATE(0x8074C080, &lit_5216); - -/* 8074C084-8074C088 000148 0004+00 0/4 0/0 0/0 .rodata @5217 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5217 = -30.0f; -COMPILER_STRIP_GATE(0x8074C084, &lit_5217); -#pragma pop - -/* 8074C088-8074C08C 00014C 0004+00 0/1 0/0 0/0 .rodata @5218 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5218 = 15000.0f; -COMPILER_STRIP_GATE(0x8074C088, &lit_5218); -#pragma pop - /* 80744878-80744DA0 002A78 0528+00 1/1 0/0 0/0 .text DemoBeforeEscape__8daE_PM_cFv */ void daE_PM_c::DemoBeforeEscape() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C08C-8074C090 000150 0004+00 0/1 0/0 0/0 .rodata @5341 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5341 = -100.0f; -COMPILER_STRIP_GATE(0x8074C08C, &lit_5341); -#pragma pop - -/* 8074C090-8074C094 000154 0004+00 0/2 0/0 0/0 .rodata @5342 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5342 = -3.0f; -COMPILER_STRIP_GATE(0x8074C090, &lit_5342); -#pragma pop - -/* 8074C094-8074C098 000158 0004+00 0/4 0/0 0/0 .rodata @5343 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5343 = 10000.0f; -COMPILER_STRIP_GATE(0x8074C094, &lit_5343); -#pragma pop + cXyz vec1, vec2; + daPy_py_c* player = daPy_getPlayerActorClass(); + + switch (mDemoMode) { + case 0: + if (CameraSet()) { + mDemoMode++; + mDoorAction = 2; + player->onPlayerNoDraw(); + player->onPlayerShadowNoDraw(); + } + + if (mStage == 1) { + for (int i = 0; i < 4; i++) { + e_fs_class* puppet; + if (fopAcM_SearchByID(mPuppetID[i], (fopAc_ac_c**)&puppet)) { + puppet->mAction = e_fs_class::ACT_END; + puppet->mMode = 0; + } + } + } + break; + + case 1: { + fopAcM_OffStatus(this, 0); + mPuppetDelete = 1; + attention_info.flags = 0; + speedF = 0.0f; + SetAnm(ANM_DAMAGE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 0.5f); + mDemoMode++; + vec1.set(current.pos.x, current.pos.y + 100.0f, current.pos.z); + s16 angle = cLib_targetAngleY(¤t.pos, s_LinkPos); + SetStopCam(vec1, 300.0f, 50.0f, angle); + vec2.set(0.0f, 0.0f, 0.0f); + + if (way_bg_check2(this, mCamCenter, mCamEye)) { + for (int i = 0; i < 4; i++) { + //! @bug probably supposed to be angle += 0x4000, though this ends up more or less working + angle += 0x4000 * i; + SetStopCam(vec1, 300.0f, 50.0f, angle); + if (!way_bg_check2(this, mCamCenter, mCamEye)) { + break; + } + } + } + break; + } + + case 2: + if (mpMorf->isStop()) { + mDemoMode++; + SetAnm(ANM_HIDE, 0, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_FADEOUT, -1); + } + SetStopingCam(); + break; + + case 3: + SetMoveCam(0.1f, 50.0f); + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_WAIST), *calc_mtx); + vec2.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec2, &vec2); + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, &vec2, &tevStr, ¤t.angle, + &scale, 0xff, NULL, -1, NULL, NULL, NULL); + + if (mpMorf->isStop()) { + if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this))) { + dComIfGs_onSwitch(mSwBit, fopAcM_GetRoomNo(this)); + } + Particle_Set(0x880D, vec2); + mMode++; + mDemoMode = 0; + mTimer[0] = 20; + SearchNearP(); + current.pos.set(mPoint.x, mPoint.y + 15000.0f, mPoint.z); + old.pos = current.pos; + gravity = 0.0f; + mDoorAction = 2; + return; + } + + mCamCenterTarget.y = vec2.y; + break; + } + + mTargetAngleY = cLib_targetAngleY(¤t.pos, &mCamEye); +} /* 80744DA0-807453F4 002FA0 0654+00 1/1 0/0 0/0 .text DemoAfterEscape__8daE_PM_cFv */ void daE_PM_c::DemoAfterEscape() { - // NONMATCHING + cXyz vec1, vec2; + daPy_py_c* player = daPy_getPlayerActorClass(); + + switch (mDemoMode) { + case 0: + SetMoveCam(0.1f, 50.0f); + mDoorAction = 2; + if (mTimer[0] == 0) { + SearchNearP(); + mDemoMode++; + mTimer[0] = 10; + Vec pnt = dPath_GetPnt(mpPath, mPointIndex + 1)->m_position; + vec2.set(pnt.x, pnt.y, pnt.z); + vec1.set(mPoint.x, mPoint.y + 150.0f, mPoint.z); + s16 angle = cLib_targetAngleY(&vec2, &vec1); + SetStopCam(vec1, 400.0f, -100.0f, angle); + } + break; + + case 1: + if (mTimer[0] == 0) { + Vec pnt = dPath_GetPnt(mpPath, mPointIndex + 1)->m_position; + vec2.set(pnt.x, pnt.y, pnt.z); + s16 angle = cLib_targetAngleY(¤t.pos, &vec2); + shape_angle.y = angle + 0x4000; + current.angle.y = shape_angle.y; + mTargetAngleY = shape_angle.y; + current.pos.set(mPoint.x, mPoint.y + 200.0f, mPoint.z); + old.pos = current.pos; + SetAnm(ANM_APPEAR01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mDemoMode++; + gravity = -3.0f; + speed.y = 0.0f; + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FADEIN, 0, -1); + } + SetStopingCam(); + break; + + case 2: + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, ¤t.pos, &tevStr, + ¤t.angle, &scale, 0xff, NULL, + -1, NULL, NULL, NULL); + mCamCenterTarget.y = current.pos.y + 50.0f; + if (mAcch.i_ChkGroundHit()) { + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + SetAnm(ANM_APPEAR02, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mDemoMode++; + mTimer[0] = 50; + mBossLightOn = true; + } + mTargetAngleY = s_TargetAngle + 0x4000; + SetStopingCam(); + break; + + case 3: { + Vec pnt = dPath_GetPnt(mpPath, mPointIndex + 1)->m_position; + vec1.set(pnt.x, pnt.y, pnt.z); + vec2 = *s_LinkPos - vec1; + + if (mpMorf->isStop() && mAnm == ANM_APPEAR02) { + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + player->offPlayerNoDraw(); + player->offPlayerShadowNoDraw(); + } + + s16 angle = -cM_atan2s(vec2.y, JMAFastSqrt(vec2.x * vec2.x + vec2.z * vec2.z)); + cLib_addCalcAngleS2(&mHeadAngleZ, angle, 2, 0x600); + + if (mTimer[0] < 35) { + mTargetHeadAngleX = s_TargetAngle - shape_angle.y; + if (mTargetHeadAngleX > 0x4000) { + mTargetHeadAngleX = 0x4000; + } else if (mTargetHeadAngleX < -0x4000) { + mTargetHeadAngleX = -0x4000; + } + } + + if (mTimer[0] == 0) { + mDemoMode++; + mTargetSpeed = 13.0f; + SetAnm(ANM_RUN, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + + SetStopingCam(); + break; + } + + case 4: + if (mpMorf->getFrame() > 5.0f) { + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + } else { + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + } + + vec1.set(mPoint.x, mPoint.y, mPoint.z); + if (SearchNextPos()) { + fopAcM_delete(this); + } + mTargetAngleY = cLib_targetAngleY(¤t.pos, &vec1); + cLib_addCalcAngleS2(&mHeadAngleZ, 0, 4, 0x600); + cLib_addCalc2(&speedF, mTargetSpeed, 0.05f, 10.0f); + + if (mPointIndex != 4) { + SetStopingCam(); + mDoorAction = 0; + } else if (mDoorAction == 0) { + SetReleaseCam(); + mDoorAction = 1; + } + break; + } + + attention_info.position.y += 10000.0f; } /* 807453F4-80745438 0035F4 0044+00 1/1 0/0 0/0 .text DemoMoveAction__8daE_PM_cFv */ void daE_PM_c::DemoMoveAction() { - // NONMATCHING + switch (mMode) { + case 0: + DemoBeforeEscape(); + break; + case 1: + DemoAfterEscape(); + break; + } } /* 80745438-807455F4 003638 01BC+00 1/1 0/0 0/0 .text WaitAction__8daE_PM_cFv */ void daE_PM_c::WaitAction() { - // NONMATCHING + switch (mMode) { + case 0: + speedF = 0.0f; + SetAnm(ANM_GLAD, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mTimer[0] = (u8)(cM_rndFX(50.0f) + 200.0f); + mMode++; + break; + + case 1: { + s16 angle = shape_angle.y - s_TargetAngle; + if (s_dis < l_HIO.mEscapeRange && angle > -0x4000 && angle < 0x4000) { + mMode++; + mTimer[0] = 10; + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + break; + } + + case 2: + mTargetHeadAngleX = s_TargetAngle - shape_angle.y; + if (mTargetHeadAngleX > 0x4000) { + mTargetHeadAngleX = 0x4000; + } else if (mTargetHeadAngleX < -0x4000) { + mTargetHeadAngleX = -0x4000; + } + + if (mTimer[0] == 0) { + mAction = ACT_ESCAPE; + mMode = 0; + } + break; + } + + if (mAnm == ANM_GLAD) { + mCreatureSound.startCreatureSoundLevel(0x7FFFF, 0, -1); + } + + if (mTimer[2] == 20) { + mAction = ACT_CREATE; + mMode = 0; + } } -/* ############################################################################################## */ -/* 8074C098-8074C09C 00015C 0004+00 0/1 0/0 0/0 .rodata @5440 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5440 = -1000000000.0f; -COMPILER_STRIP_GATE(0x8074C098, &lit_5440); -#pragma pop - -/* 8074C09C-8074C0A0 000160 0004+00 0/1 0/0 0/0 .rodata @5441 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5441 = -50.0f; -COMPILER_STRIP_GATE(0x8074C09C, &lit_5441); -#pragma pop - /* 807455F4-807458F8 0037F4 0304+00 1/1 0/0 0/0 .text GroundCheck__8daE_PM_cFv */ void daE_PM_c::GroundCheck() { - // NONMATCHING -} - -/* 807458F8-80745970 003AF8 0078+00 4/3 0/0 0/0 .text __dt__14dBgS_ObjGndChkFv */ -// dBgS_ObjGndChk::~dBgS_ObjGndChk() { -extern "C" void __dt__14dBgS_ObjGndChkFv() { - // NONMATCHING + mTargetAngleY = s_TargetAngle + 0x8000; + + cXyz vec1(0.0f, 100.0f, 200.0f); + cXyz vec2(0.0f, 0.0f, 0.0f); + cXyz vec3(0.0f, 0.0f, 0.0f); + cXyz vec4(0.0f, 0.0f, 0.0f); + cXyz vec5(0.0f, 100.0f, 400.0f); + cXyz vec6; + + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(current.angle.y); + mDoMtx_stack_c::multVec(&vec1, &vec3); + mDoMtx_stack_c::multVec(&vec5, &vec4); + + dBgS_ObjGndChk gnd_chk; + dBgS_LinChk lin_chk; + gnd_chk.SetPos(&vec3); + vec3.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + gnd_chk.SetPos(&vec4); + vec4.y = dComIfG_Bgsp().GroundCross(&gnd_chk); + + if (vec3.y != -1.0e9f) { + if (current.pos.y - vec3.y > 50.0f) { + speedF = 0.0f; + mTargetSpeed = 0.0f; + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + for (int i = 0; i < 4; i++) { + mTargetAngleY = current.angle.y + (i + 1) * 0x4000; + vec1.set(0.0f, 50.0f, 300.0f); + vec6.set(0.0f, -50.0f, 300.0f); + cLib_offsetPos(&vec2, ¤t.pos, mTargetAngleY, &vec1); + cLib_offsetPos(&vec5, ¤t.pos, mTargetAngleY, &vec6); + lin_chk.Set(&vec2, &vec5, NULL); + if (dComIfG_Bgsp().LineCross(&lin_chk)) break; + } + mMode = 10; + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } else if (current.pos.y - vec4.y > 50.0f) { + mTargetAngleY = s_TargetAngle; + } + } else { + mTargetAngleY = s_TargetAngle; + } } -/* ############################################################################################## */ -/* 8074C0A0-8074C0A4 000164 0004+00 0/1 0/0 0/0 .rodata @5483 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5483 = 29.0f / 5.0f; -COMPILER_STRIP_GATE(0x8074C0A0, &lit_5483); -#pragma pop - -/* 8074C0A4-8074C0A8 000168 0004+00 0/1 0/0 0/0 .rodata @5484 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5484 = 5.5f; -COMPILER_STRIP_GATE(0x8074C0A4, &lit_5484); -#pragma pop - -/* 8074C0A8-8074C0AC 00016C 0004+00 0/1 0/0 0/0 .rodata @5485 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5485 = 12.0f; -COMPILER_STRIP_GATE(0x8074C0A8, &lit_5485); -#pragma pop - /* 80745970-80745C44 003B70 02D4+00 1/1 0/0 0/0 .text EscapeAction__8daE_PM_cFv */ void daE_PM_c::EscapeAction() { - // NONMATCHING + switch (mMode) { + case 0: + SetAnm(ANM_RUN, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mTargetSpeed = 13.0f; + speedF = 10.0f; + mMode++; + mTimer[0] = cM_rndF(50.0f) + 100.0f; + GroundCheck(); + break; + + case 1: + if (mpMorf->getFrame() > 5.0f) { + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + } else { + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + } + + if (mTimer[0] == 0) { + mTimer[0] = cM_rndF(30.0f) + 30.0f; + mMode++; + } + + GroundCheck(); + break; + + case 2: + mTargetHeadAngleX = 0x4000; + + if (mTimer[0] == 0) { + mTimer[0] = cM_rndF(30.0f) + 30.0f; + mMode--; + } + + GroundCheck(); + break; + + case 3: + if (mTimer[1] == 0) { + mMode = 0; + mTimer[1] = 40; + } + break; + + case 10: { + int angle = current.angle.y - mTargetAngleY; + if (angle > -0x10 && angle < 0x10) { + mMode = 0; + mTimer[1] = 100; + } + cLib_chaseAngleS(¤t.angle.y, mTargetAngleY, 0x500); + break; + } + } + + if (s_dis > l_HIO.mEscapeRange + 200.0f) { + mTargetSpeed = 5.0f; + if (speedF < 5.8f) { + mTargetAngleY = s_TargetAngle; + } + if (speedF < 5.5f) { + mAction = ACT_WAIT; + mMode = 0; + speedF = 0.0f; + } + } else { + mTargetSpeed = 12.0f; + } + + cLib_addCalc2(&speedF, mTargetSpeed, 0.05f, 10.0f); + field_0x6fa = 0x1000; + + if (mTimer[2] == 20) { + mAction = ACT_CREATE; + mMode = 0; + } } /* 80745C44-80745DBC 003E44 0178+00 1/1 0/0 0/0 .text DeathAction__8daE_PM_cFv */ void daE_PM_c::DeathAction() { - // NONMATCHING + switch (mMode) { + case 0: + attention_info.flags = 0; + speedF = 0.0f; + SetAnm(ANM_DAMAGE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mMode++; + break; + + case 1: + if (mpMorf->getFrame() > 20.0f) { + mMode++; + SetAnm(ANM_HIDE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_FADEOUT, -1); + } + break; + + case 2: + if (mpMorf->isStop()) { + if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this))) { + dComIfGs_onSwitch(mSwBit, fopAcM_GetRoomNo(this)); + } + mAction = ACT_DEMO; + mMode = 0; + mDemoMode = 0; + } + break; + } + + mTargetAngleY = s_TargetAngle; } /* 80745DBC-80745ED0 003FBC 0114+00 2/1 0/0 0/0 .text Action__8daE_PM_cFv */ void daE_PM_c::Action() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C0AC-8074C0B0 000170 0004+00 0/1 0/0 0/0 .rodata @5709 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5709 = 3.0f / 100.0f; -COMPILER_STRIP_GATE(0x8074C0AC, &lit_5709); -#pragma pop - -/* 8074C0B0-8074C0B4 000174 0004+00 0/1 0/0 0/0 .rodata @5710 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5710 = 3.0f; -COMPILER_STRIP_GATE(0x8074C0B0, &lit_5710); -#pragma pop - -/* 8074C0B4-8074C0B8 000178 0004+00 0/1 0/0 0/0 .rodata @5711 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5711 = 2500.0f; -COMPILER_STRIP_GATE(0x8074C0B4, &lit_5711); -#pragma pop + mTargetHeadAngleX = 0; + + switch (mAction) { + case ACT_START: + StartAction(); + ObjHit(); + break; + case ACT_CREATE: + CreateAction(); + ObjHit(); + break; + case ACT_WAIT: + WaitAction(); + CreateChk(); + ObjHit(); + break; + case ACT_ESCAPE: + EscapeAction(); + CreateChk(); + ObjHit(); + break; + case ACT_DAMAGE: + DamageAction(); + ObjHit(); + break; + case ACT_DEATH: + DeathAction(); + break; + case ACT_DEMO: + DemoMoveAction(); + break; + } + + if (mAction != ACT_DEMO) { + cLib_addCalcAngleS2(¤t.angle.y, mTargetAngleY, 0x10, 0x500); + } else { + cLib_addCalcAngleS2(¤t.angle.y, mTargetAngleY, 5, 0x1000); + } + cLib_addCalcAngleS2(&mHeadAngleX, mTargetHeadAngleX, 4, 0x1000); + shape_angle.y = current.angle.y; +} /* 80745ED0-80746624 0040D0 0754+00 2/1 0/0 0/0 .text DemoBossStart2__8daE_PM_cFv */ void daE_PM_c::DemoBossStart2() { - // NONMATCHING + bool bVar1 = false; + cXyz vec1, vec2; + + if (mDemoMode != 0) { + SetMoveCam(0.1f, 50.0f); + } else { + SetMoveCam(0.03f, 50.0f); + } + + mTargetAngleY = s_TargetAngle; + + switch (mDemoMode) { + case 0: + current.pos.y = 10000.0f; + old.pos.y = current.pos.y; + if (mTimer[0] < 150) { + mCamCenterTarget.y += 3.0f; + if (mTimer[0] == 0) { + mDemoMode++; + current.pos.y = 2500.0f; + old.pos = current.pos; + SetAnm(ANM_APPEAR01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + speed.y = 0.0f; + gravity = -3.0f; + Particle_Set(0x880D, current.pos); + } + } + break; + + case 1: + if (mAnm == ANM_APPEAR01) { + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, ¤t.pos, &tevStr, + ¤t.angle, &scale, 0xff, NULL, -1, + NULL, NULL, NULL); + } + mCamCenterTarget.y = current.pos.y + 100.0f; + + if (mAcch.i_ChkGroundHit() && mAnm == ANM_APPEAR01) { + SetAnm(ANM_APPEAR02, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + } else if (mpMorf->isStop() && mAnm == ANM_APPEAR02) { + SetAnm(ANM_OP, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_OP, -1); + mDemoMode++; + mBossLightOn = true; + } + break; + + case 2: + if (mpMorf->isStop()) { + mDemoMode++; + + } else { + vec1.set(0.0f, 50.0f, 300.0f); + cLib_offsetPos(&vec2, ¤t.pos, s_TargetAngle, &vec1); + cLib_addCalcPos2(&mCamEyeTarget, vec2, 0.5f, 20.0f); + + if (mpMorf->checkFrame(106.0f) || mpMorf->checkFrame(124.0f)) { + bVar1 = true; + vec1.set(50.0f, -50.0f, 0.0f); + dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } else if (mpMorf->checkFrame(115.0f) || mpMorf->checkFrame(133.0f)) { + bVar1 = true; + vec1.set(-50.0f, -50.0f, 0.0f); + dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } else if (mpMorf->checkFrame(146.0f) || mpMorf->checkFrame(159.0f) + || mpMorf->checkFrame(173.0f) || mpMorf->checkFrame(184.0f)) { + bVar1 = true; + vec1.set(0.0f, -80.0f, 0.0f); + dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } + + if (bVar1) { + cXyz pos = mCamEyeTarget; + cLib_offsetPos(&mCamEyeTarget, &pos, s_TargetAngle, &vec1); + } + } + break; + + case 3: + if (mTimer[0] == 0) { + SetAnm(ANM_FOGBLOW_ST, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_FOGBLOW, -1); + mDemoMode++; + for (int i = 0; i < mPuppetNum; i++) { + mPuppetID[i] = -1; + } + } + break; + + case 4: + vec1.set(current.pos.x, current.pos.y, current.pos.z); + GakkiLoopAction(vec1, 400.0f); + + if (mAnm == ANM_FOGBLOW_EN) { + mMode--; + mDemoMode++; + } + + if (mAnm == ANM_FOGBLOW_LP) { + vec1.set(mPoint.x, mPoint.y, mPoint.z); + vec2.set(0.0f, 100.0f, 1500.0f); + cLib_offsetPos(&mCamEyeTarget, ¤t.pos, s_TargetAngle, &vec2); + } + break; + + case 5: + if (mpMorf->isStop()) { + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mpTrumpetMorf->setPlaySpeed(0.0f); + mDemoMode++; + mTimer[0] = 70; + } + break; + + case 6: + if (mTimer[0] == 0) { + if (mDoorAction == 0) { + SetReleaseCam(); + mDoorAction = 1; + mTimer[3] = l_HIO.mBossEscapeTimer; + } + + mAction = ACT_WAIT; + mMode = 0; + mDemoMode = 0; + } + break; + } + + if (mDemoMode != 0) { + mTargetAngleY = s_TargetAngle; + } } /* 80746624-80747194 004824 0B70+00 2/1 0/0 0/0 .text DemoBossStart__8daE_PM_cFv */ void daE_PM_c::DemoBossStart() { - // NONMATCHING + bool bVar1 = false; + cXyz vec1, vec2; + if (mDemoMode > 2) { + mTargetAngleY = cLib_targetAngleY(¤t.pos, s_LinkPos); + } + + switch (mDemoMode) { + case 0: + if (mTimer[0] == 100) { + vec1.set(0.0f, 50.0f, 300.0f); + cLib_offsetPos(&mCamEyeTarget, ¤t.pos, shape_angle.y, &vec1); + } + + if (mAnm == ANM_WAIT01 && mTimer[0] == 0) { + SetAnm(ANM_OP, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_OP, -1); + mDemoMode++; + } + + SetMoveCam(0.1f, 50.0f); + break; + + case 1: + if (mpMorf->isStop()) { + SetAnm(ANM_HIDE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_FADEOUT, -1); + mCamCenterTarget.y += 100.0f; + mDemoMode++; + mBossLightOn = true; + + } else { + vec1.set(0.0f, 50.0f, 240.0f); + cLib_offsetPos(&vec2, ¤t.pos, shape_angle.y, &vec1); + cLib_addCalcPos2(&mCamEyeTarget, vec2, 0.5f, 20.0f); + + if (mpMorf->checkFrame(106.0f) || mpMorf->checkFrame(124.0f)) { + bVar1 = true; + vec1.set(50.0f, -50.0f, 0.0f); + dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } else if (mpMorf->checkFrame(115.0f) || mpMorf->checkFrame(133.0f)) { + bVar1 = true; + vec1.set(-50.0f, -50.0f, 0.0f); + dComIfGp_getVibration().StartShock(2, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } else if (mpMorf->checkFrame(146.0f) || mpMorf->checkFrame(159.0f) + || mpMorf->checkFrame(173.0f) || mpMorf->checkFrame(184.0f)) { + bVar1 = true; + vec1.set(0.0f, -80.0f, 0.0f); + dComIfGp_getVibration().StartShock(4, 0x1f, cXyz(0.0f, 1.0f, 0.0f)); + } + + if (bVar1) { + cXyz pos = mCamEyeTarget; + cLib_offsetPos(&mCamEyeTarget, &pos, shape_angle.y, &vec1); + } + } + + SetMoveCam(0.1f, 50.0f); + break; + + case 2: + if (mpMorf->isStop() && mAnm == ANM_HIDE) { + mPoint = dPath_GetPnt(mpPath, 1)->m_position; + current.pos.set(mPoint.x, mPoint.y + 10000.0f, mPoint.z); + SetAnm(ANM_APPEAR01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mTimer[1] = 15; + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_WAIST), *calc_mtx); + vec1.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec1, &vec1); + Particle_Set(0x880D, vec1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FADEIN, 0, -1); + + } else if (mAnm == ANM_HIDE) { + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_WAIST), *calc_mtx); + vec1.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec1, &vec1); + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, &vec1, &tevStr, + ¤t.angle, &scale, 0xff, NULL, -1, + NULL, NULL, NULL); + + } else if (mAnm == ANM_APPEAR01 && mTimer[1] == 0) { + mDemoMode++; + current.pos.set(mPoint.x, mPoint.y + 500.0f, mPoint.z); + cXyz pos(mPoint.x, mPoint.y + 100.0f, mPoint.z); + mCamCenterTarget = pos; + mCamCenterTarget.y += 400.0f; + gravity = -3.0f; + speed.y = 0.0f; + mTimer[1] = 30; + mCamCenter = mCamCenterTarget; + vec1.set(0.0f, 50.0f, 1000.0f); + cLib_offsetPos(&mCamEyeTarget, &pos, s_TargetAngle, &vec1); + mCamEye = mCamEyeTarget; + SetMoveCam(0.1f, 50.0f); + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_WAIST), *calc_mtx); + vec1.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec1, &vec1); + Particle_Set(0x880D, vec1); + } + + SetMoveCam(0.1f, 50.0f); + break; + + case 3: + mCamCenterTarget.y = current.pos.y + 100.0f; + + if (mAnm == ANM_APPEAR01) { + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, ¤t.pos, &tevStr, + ¤t.angle, &scale, 0xff, NULL, -1, + NULL, NULL, NULL); + } + + if (mAnm == ANM_WAIT01) { + mTimer[0] = 30; + mDemoMode++; + } + + if (mAcch.i_ChkGroundHit() && mAnm == ANM_APPEAR01) { + SetAnm(ANM_APPEAR02, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + vec1.set(mPoint.x, mPoint.y, mPoint.z); + vec2.set(0.0f, 100.0f, 250.0f); + cLib_offsetPos(&mCamEyeTarget, &vec1, shape_angle.y, &vec2); + } else if (mpMorf->isStop() && mAnm == ANM_APPEAR02) { + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + + cLib_addCalcAngleS2(¤t.angle.y, mTargetAngleY, 0x10, 0x1000); + shape_angle.y = current.angle.y; + SetMoveCam(0.08f, 50.0f); + break; + + case 4: + if (mTimer[0] == 0) { + SetAnm(ANM_FOGBLOW_ST, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_FOGBLOW, -1); + mDemoMode++; + for (int i = 0; i < mPuppetNum; i++) { + mPuppetID[i] = -1; + } + } + + SetMoveCam(0.1f, 50.0f); + break; + + case 5: + vec1.set(current.pos.x, current.pos.y, current.pos.z); + GakkiLoopAction(vec1, 400.0f); + + if (mAnm == ANM_FOGBLOW_EN) { + mMode--; + mDemoMode++; + } + + if (mAnm == ANM_FOGBLOW_LP) { + vec1.set(mPoint.x, mPoint.y, mPoint.z); + vec2.set(0.0f, 100.0f, 800.0f); + cLib_offsetPos(&mCamEyeTarget, &vec1, shape_angle.y, &vec2); + } + + SetMoveCam(0.1f, 50.0f); + break; + + case 6: + if (mpMorf->isStop()) { + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mpTrumpetMorf->setPlaySpeed(0.0f); + mDemoMode++; + mTimer[0] = 70; + } + + SetMoveCam(0.1f, 50.0f); + break; + + case 7: + if (mTimer[0] == 0) { + if (mDoorAction == 0) { + SetReleaseCam(); + mDoorAction = 1; + } + mAction = ACT_WAIT; + mMode = 0; + mDemoMode = 0; + } + + SetMoveCam(0.1f, 50.0f); + break; + } } /* 80747194-80747500 005394 036C+00 1/1 0/0 0/0 .text BossEscapeAction__8daE_PM_cFv */ void daE_PM_c::BossEscapeAction() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C0B8-8074C0BC 00017C 0004+00 0/0 0/0 0/0 .rodata @5712 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5712 = 106.0f; -COMPILER_STRIP_GATE(0x8074C0B8, &lit_5712); -#pragma pop - -/* 8074C0BC-8074C0C0 000180 0004+00 0/0 0/0 0/0 .rodata @5713 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5713 = 124.0f; -COMPILER_STRIP_GATE(0x8074C0BC, &lit_5713); -#pragma pop - -/* 8074C0C0-8074C0C4 000184 0004+00 0/0 0/0 0/0 .rodata @5714 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5714 = 115.0f; -COMPILER_STRIP_GATE(0x8074C0C0, &lit_5714); -#pragma pop - -/* 8074C0C4-8074C0C8 000188 0004+00 0/0 0/0 0/0 .rodata @5715 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5715 = 133.0f; -COMPILER_STRIP_GATE(0x8074C0C4, &lit_5715); -#pragma pop - -/* 8074C0C8-8074C0CC 00018C 0004+00 0/0 0/0 0/0 .rodata @5716 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5716 = 146.0f; -COMPILER_STRIP_GATE(0x8074C0C8, &lit_5716); -#pragma pop - -/* 8074C0CC-8074C0D0 000190 0004+00 0/0 0/0 0/0 .rodata @5717 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5717 = 159.0f; -COMPILER_STRIP_GATE(0x8074C0CC, &lit_5717); -#pragma pop - -/* 8074C0D0-8074C0D4 000194 0004+00 0/0 0/0 0/0 .rodata @5718 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5718 = 173.0f; -COMPILER_STRIP_GATE(0x8074C0D0, &lit_5718); -#pragma pop - -/* 8074C0D4-8074C0D8 000198 0004+00 0/0 0/0 0/0 .rodata @5719 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5719 = 184.0f; -COMPILER_STRIP_GATE(0x8074C0D4, &lit_5719); -#pragma pop - -/* 8074C0D8-8074C0DC 00019C 0004+00 0/0 0/0 0/0 .rodata @5720 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5720 = -80.0f; -COMPILER_STRIP_GATE(0x8074C0D8, &lit_5720); -#pragma pop - -/* 8074C0DC-8074C0E0 0001A0 0004+00 0/0 0/0 0/0 .rodata @5991 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5991 = 240.0f; -COMPILER_STRIP_GATE(0x8074C0DC, &lit_5991); -#pragma pop - -/* 8074C0E0-8074C0E4 0001A4 0004+00 0/5 0/0 0/0 .rodata @5992 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5992 = 1000.0f; -COMPILER_STRIP_GATE(0x8074C0E0, &lit_5992); -#pragma pop - -/* 8074C0E4-8074C0E8 0001A8 0004+00 0/0 0/0 0/0 .rodata @5993 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5993 = 250.0f; -COMPILER_STRIP_GATE(0x8074C0E4, &lit_5993); -#pragma pop - -/* 8074C0E8-8074C0EC 0001AC 0004+00 0/0 0/0 0/0 .rodata @5994 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_5994 = 2.0f / 25.0f; -COMPILER_STRIP_GATE(0x8074C0E8, &lit_5994); -#pragma pop - -/* 8074C0EC-8074C0F0 0001B0 0004+00 0/1 0/0 0/0 .rodata @6124 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6124 = 16000.0f; -COMPILER_STRIP_GATE(0x8074C0EC, &lit_6124); -#pragma pop + cXyz vec1; + + switch (mMode) { + case 0: + attention_info.flags = 0; + SetAnm(ANM_HIDE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_FADEOUT, -1); + mCcCyl.OnTgNoHitMark(); + mMode++; + break; + + case 1: + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_WAIST), *calc_mtx); + vec1.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec1, &vec1); + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, &vec1, &tevStr, ¤t.angle, + &scale, 0xff, NULL, -1, NULL, NULL, NULL); + + if (mpMorf->isStop()) { + SearchRndP(); + SetAnm(ANM_APPEAR01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + current.pos.set(mPoint.x, mPoint.y + 100.0f, mPoint.z); + old.pos = current.pos; + mMode++; + Particle_Set(0x880D, vec1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FADEIN, 0, -1); + } + break; + + case 2: + mTargetAngleY = s_TargetAngle; + cLib_addCalcAngleS2(¤t.angle.y, mTargetAngleY, 0x10, 0x1000); + shape_angle.y = current.angle.y; + + if (mAcch.i_ChkGroundHit()) { + SetAnm(ANM_APPEAR02, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mMode++; + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + } + break; + + case 3: + if (mpMorf->isStop()) { + attention_info.flags = 4; + mAction = ACT_WAIT; + mMode = 0; + if (mBossHealth < 3) { + mTimer[3] = l_HIO.mBossEscapeTimer; + } + } + break; + } +} /* 80747500-807476A0 005700 01A0+00 2/2 0/0 0/0 .text s_boss_sub__FPvPv */ -static void s_boss_sub(void* param_0, void* param_1) { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C0F0-8074C0F4 0001B4 0004+00 0/1 0/0 0/0 .rodata @6337 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6337 = 2000.0f; -COMPILER_STRIP_GATE(0x8074C0F0, &lit_6337); -#pragma pop - -/* 8074C0F4-8074C0F8 0001B8 0004+00 0/1 0/0 0/0 .rodata @6338 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6338 = -5355.0f; -COMPILER_STRIP_GATE(0x8074C0F4, &lit_6338); -#pragma pop - -/* 8074C0F8-8074C0FC 0001BC 0004+00 0/1 0/0 0/0 .rodata @6339 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6339 = 11060.0f; -COMPILER_STRIP_GATE(0x8074C0F8, &lit_6339); -#pragma pop - -/* 8074C0FC-8074C100 0001C0 0004+00 0/1 0/0 0/0 .rodata @6340 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6340 = -5700.0f; -COMPILER_STRIP_GATE(0x8074C0FC, &lit_6340); -#pragma pop - -/* 8074C100-8074C104 0001C4 0004+00 0/1 0/0 0/0 .rodata @6341 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6341 = 5190.0f; -COMPILER_STRIP_GATE(0x8074C100, &lit_6341); -#pragma pop - -/* 8074C104-8074C108 0001C8 0004+00 0/1 0/0 0/0 .rodata @6342 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6342 = 350.0f; -COMPILER_STRIP_GATE(0x8074C104, &lit_6342); -#pragma pop +static void* s_boss_sub(void* i_actor, void* param_1) { + daPy_py_c* player = daPy_getPlayerActorClass(); + fopAc_ac_c* actor = static_cast(i_actor); + cXyz& actor_pos = fopAcM_GetPosition(actor); + cXyz& player_pos = fopAcM_GetPosition(player); + if (fopAc_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_Obj_SM_DOOR) { + u8 prm = (fopAcM_GetParam(actor) & 0xF0) >> 4; + if (player_pos.absXZ(actor_pos) < 16000.0f && prm == 1) { + return i_actor; + } + } + return NULL; +} /* 807476A0-80747F38 0058A0 0898+00 2/1 0/0 0/0 .text BossDamageAction__8daE_PM_cFv */ void daE_PM_c::BossDamageAction() { - // NONMATCHING + cXyz vec1, vec2, vec3, vec4; + daPy_py_c* player = daPy_getPlayerActorClass(); + + switch (mMode) { + case 0: + if (CameraSet()) { + player->onPlayerNoDraw(); + player->onPlayerShadowNoDraw(); + mPuppetNum += l_HIO.mAdditionalPuppetNum; + if (mBossHealth == 0) { + fopAc_ac_c* door = (fopAc_ac_c*)fpcM_Search(s_boss_sub, this); + if (door != NULL) { + vec1 = fopAcM_GetPosition(door); + csXyz* angle = fopAcM_GetAngle_p(door); + cXyz unused(1000.0f, 0.0f, 2000.0f); + if (dComIfG_play_c::getLayerNo(0) == 2) { + vec1.set(-5355.0f, 1500.0f, 11060.0f); + } else { + vec1.set(-5700.0f, 500.0f, 5190.0f); + } + daPy_getPlayerActorClass()->setPlayerPosAndAngle(&vec1, angle->y + 0x8000, 0); + } + + mAction = ACT_DEATH; + mMode = 0; + mDemoMode = 0; + SetAnm(ANM_END, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_DEATH, -1); + mPuppetDelete = 1; + mBossLightOn = false; + vec1.set(current.pos.x, current.pos.y + 50.0f, current.pos.z); + SetStopCam(vec1, 300.0f, 0.0f, shape_angle.y); + mTargetAngleY = shape_angle.y; + mCamEyeTarget.y += 100.0f; + + } else { + SetAnm(ANM_DAMAGE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mMode++; + mPuppetDelete = 1; + vec1.set(current.pos.x, current.pos.y + 50.0f, current.pos.z); + SetStopCam(vec1, 350.0f, 50.0f, s_TargetAngle); + } + } + break; + + case 1: + if (mpMorf->isStop()) { + SetAnm(ANM_HIDE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_FADEOUT, -1); + mMode++; + mCamCenterTarget.y += 200.0f; + } + SetStopingCam(); + break; + + case 2: + if (mAnm == ANM_HIDE) { + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_WAIST), *calc_mtx); + vec4.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec4, &vec4); + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, &vec4, &tevStr, + ¤t.angle, &scale, 0xff, NULL, -1, + NULL, NULL, NULL); + } + + if (mpMorf->isStop() && mAnm == ANM_HIDE) { + SearchFarP(); + SetAnm(ANM_APPEAR01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + current.pos.set(mPoint.x, mPoint.y + 10000.0f, mPoint.z); + mTimer[1] = 20; + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_WAIST), *calc_mtx); + vec4.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec4, &vec4); + Particle_Set(0x880D, vec4); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FADEIN, 0, -1); + + } else if (mAnm == ANM_APPEAR01 && mTimer[1] == 0) { + player->offPlayerNoDraw(); + player->offPlayerShadowNoDraw(); + mMode++; + current.pos.set(mPoint.x, mPoint.y + 500.0f, mPoint.z); + old.pos = current.pos; + vec1.set(mPoint.x, mPoint.y, mPoint.z); + SetStopCam(vec1, 1000.0f, 100.0f, s_TargetAngle); + mCamCenterTarget.y += 400.0f; + mCamCenter.y = mCamCenterTarget.y; + speed.y = 0.0f; + gravity = -3.0f; + Particle_Set(0x880D, current.pos); + } + + SetMoveCam(0.1f, 50.0f); + break; + + case 3: + //! @bug vec4 is not initialized + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, &vec4, &tevStr, ¤t.angle, + &scale, 0xff, NULL, -1, NULL, NULL, NULL); + mCamCenterTarget.y = current.pos.y + 50.0f; + mTargetAngleY = s_TargetAngle; + cLib_addCalcAngleS2(¤t.angle.y, mTargetAngleY, 0x10, 0x1000); + shape_angle.y = current.angle.y; + + if (mAcch.i_ChkGroundHit()) { + SetAnm(ANM_APPEAR02, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mMode++; + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + } + + SetMoveCam(0.2f, 50.0f); + break; + + case 4: + vec2.set(0.0f, 100.0f, 300.0f); + cLib_offsetPos(&vec3, ¤t.pos, s_TargetAngle, &vec2); + mCamEyeTarget = vec3; + SetMoveCam(0.1f, 50.0f); + + if (mpMorf->isStop()) { + for (int i = 0; i < mPuppetNum; i++) { + mPuppetID[i] = -1; + } + mPuppetDelete = 0; + mAction = ACT_CREATE; + mMode = 0; + mDemoMode = 0; + field_0x613 = 1; + } + break; + + case 10: + SetAnm(ANM_DAMAGE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mMode++; + break; + + case 11: + if (mpMorf->isStop()) { + mAction = ACT_WAIT; + mMode = 0; + mDemoMode = 0; + } + break; + } } /* 80747F38-807480A4 006138 016C+00 1/1 0/0 0/0 .text BossWaitAction__8daE_PM_cFv */ void daE_PM_c::BossWaitAction() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C108-8074C10C 0001CC 0004+00 0/1 0/0 0/0 .rodata @6343 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6343 = 1.0f / 5.0f; -COMPILER_STRIP_GATE(0x8074C108, &lit_6343); -#pragma pop - -/* 8074C10C-8074C110 0001D0 0004+00 0/1 0/0 0/0 .rodata @6623 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6623 = 196.0f; -COMPILER_STRIP_GATE(0x8074C10C, &lit_6623); -#pragma pop - -/* 8074C110-8074C114 0001D4 0004+00 0/1 0/0 0/0 .rodata @6624 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6624 = 195.0f; -COMPILER_STRIP_GATE(0x8074C110, &lit_6624); -#pragma pop - -/* 8074C114-8074C118 0001D8 0004+00 0/1 0/0 0/0 .rodata @6625 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6625 = 30000.0f; -COMPILER_STRIP_GATE(0x8074C114, &lit_6625); -#pragma pop - -/* 8074C118-8074C11C 0001DC 0004+00 0/1 0/0 0/0 .rodata @6626 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6626 = 15.0f; -COMPILER_STRIP_GATE(0x8074C118, &lit_6626); -#pragma pop - -/* 8074C11C-8074C120 0001E0 0004+00 0/2 0/0 0/0 .rodata @6627 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6627 = -200.0f; -COMPILER_STRIP_GATE(0x8074C11C, &lit_6627); -#pragma pop + switch (mMode) { + case 0: + if (mSecondEncounter) { + SetAnm(ANM_GLAD, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } else { + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + mMode++; + break; + + case 1: + if (s_dis < 400.0f && dComIfG_play_c::getLayerNo(0) == 0) { + mAction = ACT_ESCAPE; + mMode = 0; + } + + if (mTimer[3] == 0 && mBossHealth < 3 && dComIfG_play_c::getLayerNo(0) == 2) { + mAction = ACT_ESCAPE; + mMode = 0; + } + + if (mAnm == ANM_GLAD) { + mCreatureSound.startCreatureSoundLevel(0x7ffff, 0, -1); + } + break; + } + + mTargetAngleY = s_TargetAngle; + if (mTimer[2] == 20) { + mCcCyl.OffTgNoHitMark(); + mAction = ACT_CREATE; + mMode = 0; + } +} /* 807480A4-80748964 0062A4 08C0+00 1/1 0/0 0/0 .text BossDeathAction__8daE_PM_cFv */ void daE_PM_c::BossDeathAction() { - // NONMATCHING + cXyz vec1, vec2, vec3; + daPy_py_c* player = daPy_getPlayerActorClass(); + + switch (mMode) { + case 0: + if (mpMorf->getFrame() < 196.0f && mAnm == ANM_END) { + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_BACKBONE), *calc_mtx); + vec3.set(0.0f, -30.0f, 0.0f); + MtxPosition(&vec3, &vec3); + vec3.x = current.pos.x; + vec3.z = current.pos.z; + mCamCenterTarget = vec3; + } else { + vec3.set(0.0f, 0.0f, mCamCenterTarget.absXZ(mCamEye) + 20.0f); + vec2.set(mCamEye.x, current.pos.y, mCamEye.z); + cLib_offsetPos(&mCamCenterTarget, &vec2, shape_angle.y + 0x8000, &vec3); + shape_angle.y += 0x40; + } + + mTargetAngleY = shape_angle.y; + + if (mpMorf->getFrame() == 195.0f && mAnm == ANM_END) { + current.pos.y += 30000.0f; + old.pos = current.pos; + gravity = 0.0f; + mTimer[2] = 10; + shape_angle.y = cLib_targetAngleY(&mCamCenterTarget, &mCamEyeTarget); + } else if (mpMorf->isStop() && mAnm == ANM_END && mTimer[2] == 0) { + mTimer[2] = 100; + if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this))) { + dComIfGs_onSwitch(mSwBit, fopAcM_GetRoomNo(this)); + } + mMode++; + } + + if (mpMorf->getFrame() > 180.0f) { + mParticleKey = dComIfGp_particle_set(mParticleKey, 0x880C, &vec3, &tevStr, + ¤t.angle, &scale, 0xff, NULL, -1, + NULL, NULL, NULL); + } + + SetMoveCam(0.2f, 15.0f); + break; + + case 1: + shape_angle.y += 0x40; + vec3.set(0.0f, 0.0f, mCamCenterTarget.absXZ(mCamEye) + 20.0f); + vec2.set(mCamEye.x, mCamCenterTarget.y, mCamEye.z); + cLib_offsetPos(&mCamCenterTarget, &vec2, shape_angle.y + 0x8000, &vec3); + + if (mTimer[2] == 0) { + if (dComIfG_play_c::getLayerNo(0) == 2) { + mMsgFlow.init(this, 0x6E, 0, NULL); + } else { + mMsgFlow.init(this, 0x6F, 0, NULL); + } + mMode++; + } + + SetMoveCam(0.2f, 15.0f); + break; + + case 2: + shape_angle.y += 0x40; + vec3.set(0.0f, 0.0f, mCamCenterTarget.absXZ(mCamEye) + 20.0f); + vec2.set(mCamEye.x, mCamCenterTarget.y, mCamEye.z); + cLib_offsetPos(&mCamCenterTarget, &vec2, shape_angle.y + 0x8000, &vec3); + + if (mMsgFlow.doFlow(this, NULL, 0)) { + player->offPlayerNoDraw(); + player->offPlayerShadowNoDraw(); + + fopAc_ac_c* door = (fopAc_ac_c*)fpcM_Search(s_boss_sub, this); + if (door != NULL) { + cXyz pos = fopAcM_GetPosition(door); + pos.y += 400.0f; + csXyz* angle = fopAcM_GetAngle_p(door); + SetStopCam(pos, 1000.0f, -200.0f, angle->y); + vec3.set(500.0f, -200.0f, 0.0f); + vec1 = mCamEye; + cLib_offsetPos(&mCamEye, &vec1, angle->y, &vec3); + mCamEyeTarget = mCamEye; + current.pos.x = pos.x; + current.pos.y = mAcch.GetGroundH() + 30000.0f; + current.pos.z = pos.z; + } + + mMode++; + mDoorAction = 2; + mTimer[1] = 100; + } + + SetMoveCam(0.2f, 15.0f); + break; + + case 3: + SetStopingCam(); + if (mTimer[1] == 0) { + SetReleaseCam(); + fopAcM_delete(this); + } + break; + } } /* 80748964-80748B18 006B64 01B4+00 2/1 0/0 0/0 .text BossAction__8daE_PM_cFv */ void daE_PM_c::BossAction() { - // NONMATCHING + mTargetHeadAngleX = 0; + + switch (mAction) { + case ACT_START: + StartAction(); + break; + + case ACT_CREATE: + DemoCreateAction(); + ObjHit(); + if (mAction == ACT_DAMAGE && mMode != 10) { + mAction = ACT_DAMAGE; + mMode = 0; + mDemoMode = 0; + field_0x613 = 0; + mCcCyl.ClrTgHit(); + } + break; + + case ACT_WAIT: + BossWaitAction(); + CreateChk(); + ObjHit(); + break; + + case ACT_ESCAPE: + BossEscapeAction(); + break; + + case ACT_DAMAGE: + BossDamageAction(); + break; + + case ACT_DEATH: + BossDeathAction(); + break; + + case ACT_DEMO: + if (mSecondEncounter) { + DemoBossStart2(); + } else { + DemoBossStart(); + } + dComIfGp_getEvent().onSkipFade(); + dComIfGp_getEvent().setSkipProc(this, DemoSkipCallBack, 1); + } + + if (mSecondEncounter && daPy_getPlayerActorClass()->checkWolfLock(this)) { + daPy_getPlayerActorClass()->cancelWolfLock(this); + } + + if (mAction != ACT_DEATH) { + cLib_addCalcAngleS2(¤t.angle.y, mTargetAngleY, 5, 0x1000); + cLib_addCalcAngleS2(&mHeadAngleX, mTargetHeadAngleX, 4, 0x1000); + shape_angle.y = current.angle.y; + } } -/* ############################################################################################## */ -/* 8074C120-8074C124 0001E4 0004+00 0/1 0/0 0/0 .rodata @6712 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6712 = 1.5f; -COMPILER_STRIP_GATE(0x8074C120, &lit_6712); -#pragma pop - /* 80748B18-80748D74 006D18 025C+00 1/1 0/0 0/0 .text Execute__8daE_PM_cFv */ -void daE_PM_c::Execute() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C124-8074C128 0001E8 0004+00 0/1 0/0 0/0 .rodata @6921 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6921 = -10000.0f; -COMPILER_STRIP_GATE(0x8074C124, &lit_6921); -#pragma pop - -/* 8074C128-8074C12C 0001EC 0004+00 0/2 0/0 0/0 .rodata @6922 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6922 = -9.0f; -COMPILER_STRIP_GATE(0x8074C128, &lit_6922); -#pragma pop - -/* 8074C12C-8074C130 0001F0 0004+00 0/1 0/0 0/0 .rodata @6923 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_6923 = -150.0f; -COMPILER_STRIP_GATE(0x8074C12C, &lit_6923); -#pragma pop +int daE_PM_c::Execute() { + s_LinkPos = &fopAcM_GetPosition(daPy_getPlayerActorClass()); + s_TargetAngle = cLib_targetAngleY(¤t.pos, s_LinkPos); + s_dis = current.pos.abs(*s_LinkPos); + + for (int i = 0; i < 4; i++) { + mTimer[i]--; + if (mTimer[i] < 0) { + mTimer[i] = 0; + } + } + + Yazirushi(); + + if (mStage == 4) { + BossAction(); + } else if (mStage == 0) { + AppearAction(); + } else { + Action(); + } + + LampAction(); + setMidnaBindEffect(this, &mCreatureSound, ¤t.pos, &cXyz(1.5f, 1.5f, 1.5f)); + EyeMove(); + mpMorf->play(0, dComIfGp_getReverb(fopAcM_GetRoomNo(this))); + setCcCylinder(); + fopAcM_posMoveF(this, mCcStts.GetCCMoveP()); + mAcch.CrrPos(dComIfG_Bgsp()); + setBaseMtx(); + setGakkiBaseMtx(); + setLampBaseMtx(); + return 1; +} /* 80748D74-8074954C 006F74 07D8+00 2/2 0/0 0/0 .text StartAction__8daE_PM_cFv */ void daE_PM_c::StartAction() { - // NONMATCHING + cXyz pos; + daPy_py_c* player = daPy_getPlayerActorClass(); + + switch (mMode) { + case 0: + mPuppetNum = 4; + if (mStage == 1) { + if (mAnm != ANM_GLAD) { + SetAnm(ANM_GLAD, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + + daE_PM_c* other = (daE_PM_c*)fpcM_Search(s_obj_sub, this); + if (other != NULL) { + for (int i = 0; i < mPuppetNum; i++) { + if (other->mPuppetID[i] != -1) { + mPuppetID[i] = other->mPuppetID[i]; + } + } + } + + if (dComIfGs_isSwitch(0x80, fopAcM_GetRoomNo(this)) + || dComIfGs_isSwitch(0xE0, fopAcM_GetRoomNo(this))) + { + mMode++; + mAction = ACT_CREATE; + mMode = 0; + } + + } else if (mStage == 2) { + if (mAnm != ANM_GLAD) { + SetAnm(ANM_GLAD, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + + if (dComIfGs_isSwitch(0x81, fopAcM_GetRoomNo(this)) + || dComIfGs_isSwitch(0xE1, fopAcM_GetRoomNo(this))) + { + mMode++; + mTimer[0] = 240; + } + + } else if (mStage == 3) { + if (mAnm != ANM_GLAD) { + SetAnm(ANM_GLAD, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + + if (dComIfGs_isSwitch(0x82, fopAcM_GetRoomNo(this)) + || dComIfGs_isSwitch(0xE2, fopAcM_GetRoomNo(this))) + { + mMode++; + mTimer[0] = 240; + } + + } else if (mStage == 4) { + SearchNearP(); + mCcStts.Init(0xFA, 0xFF, this); + SetAnm(ANM_APPEAR01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mMode += 3; + for (int i = 0; i < mPuppetNum; i++) { + mPuppetID[i] = -1; + } + } + break; + + case 1: + if (mTimer[0] == 0 && mAcch.i_ChkGroundHit()) { + SetAnm(ANM_APPEAR02, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_L, 0, -1); + mCreatureSound.startCreatureSound(Z2SE_EN_PM_FN_R, 0, -1); + J3DAnmTexPattern* btp = (J3DAnmTexPattern*)dComIfG_getObjectRes("E_PM", 0x22); + mpEyeAnm->init(mpMorf->getModel()->getModelData(), btp, TRUE, + J3DFrameCtrl::LOOP_ONCE_e, 1.0f, 0, -1); + mMode++; + } + break; + + case 2: + for (int i = 0; i < mPuppetNum; i++) { + mPuppetID[i] = -1; + } + + if (mpMorf->isStop()) { + if (mStage != 4) { + mAction = ACT_CREATE; + mMode = 0; + } else { + mMode++; + } + } + break; + + case 3: + current.angle.y = s_TargetAngle; + shape_angle.y = s_TargetAngle; + + if (mTimer[0] == 0 && mAnm != ANM_KYORO2) { + SetAnm(ANM_KYORO2, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + } + + if (mpMorf->isStop()) { + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mTimer[0] = (u8)(cM_rndFX(50.0f) + 200.0f); + } + + pos.set(current.pos.x, 10000.0f, current.pos.z); + if (mSecondEncounter) { + current.pos.y = -10000.0f; + old.pos.y = current.pos.y; + } + if (fopAcM_gc_c::gndCheck(&pos) && current.pos.absXZ(*s_LinkPos) < 1000.0f + && mAnm == ANM_WAIT01 && s_LinkPos->y <= fopAcM_gc_c::getGroundY() + 100.0f + && CameraSet()) + { + mPuppetNum = 4; + gravity = -9.0f; + mAction = ACT_DEMO; + mMode = 1; + mTimer[0] = 130; + + if (mSecondEncounter) { + mTimer[0] = 180; + pos.set(current.pos.x, 1900.0f, current.pos.z); + SetStopCam(pos, 500.0f, 0.0f, s_TargetAngle); + mCamEye = mCamEyeTarget; + fopAcM_OffStatus(this, fopAcStts_CULL_e); + } else { + pos.set(current.pos.x, current.pos.y + 80.0f, current.pos.z); + mTargetAngleY = shape_angle.y; + SetStopCam(pos, 500.0f, -150.0f, shape_angle.y); + } + + if (mSecondEncounter) { + player->changeOriginalDemo(); + player->changeDemoMode(4, 0, 0, 0); + } + } + } } /* 8074954C-807499C0 00774C 0474+00 4/4 0/0 0/0 .text GakkiLoopAction__8daE_PM_cF4cXyzf */ void daE_PM_c::GakkiLoopAction(cXyz param_0, f32 param_1) { - // NONMATCHING + cXyz vec1(0.0f, 0.0f, 0.0f); + cXyz vec2(0.0f, 0.0f, param_1); + cXyz vec3; + + if (mAnm == ANM_FOGBLOW_ST && mpMorf->isStop()) { + SetAnm(ANM_FOGBLOW_LP, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + mTimer[0] = 0; + J3DAnmTransform* bck = (J3DAnmTransform*)dComIfG_getObjectRes("E_PM", 0x19); + mpTrumpetMorf->setAnm(bck, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f, 0.0f, -1.0f, NULL); + dBgS_LinChk lin_chk; + + for (int i = 0; i < mPuppetNum; i++) { + if (mPuppetID[i] == -1) { + if (dComIfG_play_c::getLayerNo(0) == 2) { + mTimer[0] += 18; + } else { + mTimer[0] += 20; + } + } + } + + } else if (mAnm == ANM_FOGBLOW_LP) { + vec3.set(s_LinkPos->x, s_LinkPos->y + 100.0f, s_LinkPos->z); + mCreatureSound.startCreatureSoundLevel(Z2SE_EN_PM_TRUMPET, 0, -1); + + int i = 0; + dBgS_LinChk lin_chk; + f32 step = 0x10000 / mPuppetNum; + for (; i < mPuppetNum; i++) { + if (mPuppetID[i] == -1) { + s16 angle = shape_angle.y + step * i; + cLib_offsetPos(&vec1, ¶m_0, angle, &vec2); + if (!way_bg_check2(this, vec3, vec1) || mStage == 4) { + mPuppetID[i] = fopAcM_createChild(PROC_E_FS, fopAcM_GetID(this), 0xFFFFFFF, + &vec1, fopAcM_GetRoomNo(this), &shape_angle, + NULL, -1, NULL); + } + } + } + + if (mTimer[0] == 0) { + SetAnm(ANM_FOGBLOW_EN, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mMode++; + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_LAUGH, -1); + } + + static u16 gakki_eff_id[3] = {0x8201, 0x8202, 0x8203}; + for (int i = 0; i < 3; i++) { + mGakkiParticleKey[i] = dComIfGp_particle_set(mGakkiParticleKey[i], gakki_eff_id[i], + ¤t.pos, NULL); + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(mGakkiParticleKey[i]); + if (emitter != NULL) { + MTXCopy(mpTrumpetMorf->getModel()->getAnmMtx(2), *calc_mtx); + emitter->setGlobalRTMatrix(*calc_mtx); + } + } + } } /* 807499C0-80749C0C 007BC0 024C+00 1/1 0/0 0/0 .text DemoCreateAction__8daE_PM_cFv */ void daE_PM_c::DemoCreateAction() { - // NONMATCHING + cXyz vec1, vec2, vec3; + switch (mMode) { + case 0: + SetAnm(ANM_FOGBLOW_ST, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_FOGBLOW, -1); + mMode++; + speedF = 0.0f; + mPuppetDelete = 0; + break; + + case 1: + vec1.set(current.pos.x, current.pos.y, current.pos.z); + GakkiLoopAction(current.pos, 400.0f); + if (field_0x613 == 1) { + SetMoveCam(0.1f, 50.0f); + } + + if (field_0x613 == 1 && mAnm == ANM_FOGBLOW_LP) { + vec1.set(mPoint.x, mPoint.y, mPoint.z); + vec2.set(0.0f, 100.0f, 800.0f); + cLib_offsetPos(&vec3, &vec1, s_TargetAngle, &vec2); + mCamEyeTarget = vec3; + SetMoveCam(0.1f, 50.0f); + } + break; + + case 2: + if (mpMorf->isStop()) { + mCcCyl.OnTgNoHitMark(); + mpTrumpetMorf->setPlaySpeed(0.0f); + if (field_0x613 == 1) { + mTimer[3] = l_HIO.mBossEscapeTimer; + field_0x613 = 0; + mAction = ACT_WAIT; + mMode = 0; + mDemoMode = 0; + SetReleaseCam(); + } else { + mAction = ACT_WAIT; + mMode = 0; + mDemoMode = 0; + } + } + break; + } + + mTargetAngleY = s_TargetAngle; } /* 80749C0C-80749D9C 007E0C 0190+00 1/1 0/0 0/0 .text CreateAction__8daE_PM_cFv */ void daE_PM_c::CreateAction() { - // NONMATCHING + cXyz vec; + + switch (mMode) { + case 0: + SetAnm(ANM_FOGBLOW_ST, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_FOGBLOW, -1); + mMode++; + speedF = 0.0f; + break; + + case 1: { + cXyz& player_speed = fopAcM_GetSpeed(daPy_getPlayerActorClass()); + vec.set(s_LinkPos->x + player_speed.x * 20.0f, s_LinkPos->y + 200.0f, + s_LinkPos->z + player_speed.z * 20.0f); + GakkiLoopAction(vec, 200.0f); + break; + } + + case 2: + if (mpMorf->isStop()) { + mpTrumpetMorf->setPlaySpeed(0.0f); + if (field_0x613 == 1) { + field_0x613 += 2; + } + mAction = ACT_WAIT; + mMode = 0; + mDemoMode = 0; + } + break; + } + + mTargetAngleY = s_TargetAngle; } /* 80749D9C-80749ED0 007F9C 0134+00 2/2 0/0 0/0 .text CreateChk__8daE_PM_cFv */ void daE_PM_c::CreateChk() { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C130-8074C134 0001F4 0004+00 0/1 0/0 0/0 .rodata @7229 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7229 = 1280.0f; -COMPILER_STRIP_GATE(0x8074C130, &lit_7229); -#pragma pop - -/* 8074C134-8074C13C 0001F8 0004+04 0/1 0/0 0/0 .rodata @7230 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7230[1 + 1 /* padding */] = { - 556.0f, - /* padding */ - 0.0f, -}; -COMPILER_STRIP_GATE(0x8074C134, &lit_7230); -#pragma pop + for (int i = 0; i < mPuppetNum; i++) { + fopAc_ac_c* puppet = fopAcM_SearchByID(mPuppetID[i]); + if (puppet == NULL && mPuppetID[i] != -1) { + mPuppetID[i] = -1; + } + + if (mPuppetID[i] == -1 && mTimer[2] == 0) { + if (s_dis <= l_HIO.mEscapeRange) { + mTimer[2] = l_HIO.mCreateTimer * 0.5f; + } else { + mTimer[2] = l_HIO.mCreateTimer; + } + + if (mStage == 4) { + if (dComIfG_play_c::getLayerNo(0) == 2) { + mTimer[2] = 200; + } else { + mTimer[2] = 160; + } + } + } + } +} /* 80749ED0-8074A14C 0080D0 027C+00 1/1 0/0 0/0 .text LampAction__8daE_PM_cFv */ void daE_PM_c::LampAction() { - // NONMATCHING + cXyz vec = mOldLampPosition - mLampPosition; + f32 dist = vec.abs(); + cLib_addCalcAngleS2(&field_0x6fa, dist * 1280.0f, 5, 0x1000); + field_0x6fc += dist * 556.0f; + cLib_addCalcAngleS2(&mLampAngle.x, field_0x6fa * cM_ssin(field_0x6fc), 5, 0x1000); + cLib_addCalcAngleS2(&mLampAngle.z, field_0x6fa * cM_ssin(field_0x6fc), 5, 0x1000); + mOldLampPosition = mLampPosition; } /* 8074A14C-8074A210 00834C 00C4+00 1/1 0/0 0/0 .text DamageAction__8daE_PM_cFv */ void daE_PM_c::DamageAction() { - // NONMATCHING + switch (mMode) { + case 0: + speedF = 0.0f; + SetAnm(ANM_DAMAGE, J3DFrameCtrl::LOOP_ONCE_e, 5.0f, 1.0f); + mMode++; + break; + + case 1: + if (mpMorf->isStop()) { + mAction = ACT_WAIT; + mMode = 0; + } + break; + } + + mTargetAngleY = s_TargetAngle; } /* 8074A210-8074A3DC 008410 01CC+00 1/1 0/0 0/0 .text At_Check__8daE_PM_cFv */ +// NONMATCHING regalloc void daE_PM_c::At_Check() { - // NONMATCHING + mAtInfo.mpCollider = mCcCyl.GetTgHitObj(); + mAtInfo.mpActor = at_power_check(&mAtInfo); + + if (mAtInfo.mpActor != NULL) { + if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_HOOKSHOT)) { + mAtInfo.mAttackPower = 0; + } + + s16 attack_power = mAtInfo.mAttackPower; + if (attack_power > 0) { + health -= attack_power; + } + + u32 pause_timer; + if (mAtInfo.mAttackPower != 0 && health <= l_HIO.field_0x34) { + mAtInfo.mHitStatus = 2; + pause_timer = 5; + mAction = ACT_DEMO; + mMode = 0; + } else { + pause_timer = 2; + } + + if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_MIDNA_LOCK)) { + pause_timer = 0; + } + + u8 sound = ((dCcD_GObjInf*)mAtInfo.mpCollider)->GetAtSe(); + u32 var1 = 30; + if (mAtInfo.mHitStatus == 1) { + var1 = 31; + } else if (mAtInfo.mHitStatus == 2) { + var1 = 32; + } + + if (mAtInfo.mpSound != NULL) { + if (mAtInfo.field_0x18 != 0) { + mAtInfo.mpSound->startCollisionSE(dCcD_GObjInf::getHitSeID(sound, FALSE), var1); + } else { + mAtInfo.mpSound->startCollisionSE(dCcD_GObjInf::getHitSeID(sound, FALSE), var1); + } + } + + if (mAtInfo.mHitType == 1 || mAtInfo.mpCollider->ChkAtType(AT_TYPE_THROW_OBJ)) { + if (mAtInfo.mpCollider->ChkAtType(AT_TYPE_THROW_OBJ)) { + pause_timer = 4; + } + dScnPly_c::setPauseTimer(pause_timer); + } + } } /* 8074A3DC-8074A644 0085DC 0268+00 2/2 0/0 0/0 .text ObjHit__8daE_PM_cFv */ void daE_PM_c::ObjHit() { - // NONMATCHING + mIFrameTimer--; + if (mIFrameTimer <= 0) { + mIFrameTimer = 0; + } + + if (mIFrameTimer > 0) { + mCcCyl.OffTgSetBit(); + mCcCyl.ClrTgHit(); + return; + } + + mCcCyl.OnTgSetBit(); + mCcStts.Move(); + + if (mCcCyl.ChkTgHit()) { + cCcD_Obj* hit_obj = mCcCyl.GetTgHitObj(); + mAtInfo.mpCollider = mCcCyl.GetTgHitObj(); + if (dComIfG_play_c::getLayerNo(0) == 0 && mStage == 4 + && !hit_obj->ChkAtType(AT_TYPE_NORMAL_SWORD) && !hit_obj->ChkAtType(AT_TYPE_UNK)) + { + mAction = ACT_ESCAPE; + mMode = 0; + mDemoMode = 0; + } else { + At_Check(); + mCreatureSound.startCreatureVoice(Z2SE_EN_PM_V_DAMAGE, -1); + mAction = ACT_DAMAGE; + mMode = 0; + if (mStage != 4) { + if (health <= l_HIO.field_0x34) { + mAction = ACT_DEMO; + mCcCyl.ClrTgHit(); + mDemoMode = 0; + } + } else { + if (dComIfG_play_c::getLayerNo(0) == 2) { + if (hit_obj->ChkAtType(AT_TYPE_NORMAL_SWORD) + || hit_obj->ChkAtType(AT_TYPE_ARROW) || hit_obj->ChkAtType(AT_TYPE_BOMB) + || hit_obj->ChkAtType(AT_TYPE_IRON_BALL)) + { + mBossHealth--; + if (mBossHealth == 0) { + daPy_getPlayerActorClass()->onPlayerNoDraw(); + } + } else { + mAction = ACT_DAMAGE; + mMode = 10; + } + } else { + mBossHealth--; + if (mBossHealth == 0) { + daPy_getPlayerActorClass()->onPlayerNoDraw(); + } + } + } + + mIFrameTimer = 15; + } + } } /* 8074A644-8074A6CC 008844 0088+00 1/1 0/0 0/0 .text EyeMove__8daE_PM_cFv */ void daE_PM_c::EyeMove() { - // NONMATCHING + if (mEyeAnmTimer == 0) { + mEyeAnmTimer = cM_rndF(100.0f) + 30.0f; + } else { + mEyeAnmTimer--; + if (mEyeAnmTimer <= 8) { + mEyeAnmFrame = 8 - mEyeAnmTimer; + } else { + mEyeAnmFrame = 0; + } + } } /* 8074A6CC-8074AAC0 0088CC 03F4+00 1/1 0/0 0/0 .text Draw__8daE_PM_cFv */ -void daE_PM_c::Draw() { - // NONMATCHING +int daE_PM_c::Draw() { + if (mSecondEncounter && mBossLightOn) { + GXColor color; + color.r = l_HIO.mBossLightR; + color.g = l_HIO.mBossLightG; + color.b = l_HIO.mBossLightB; + cLib_chaseF(&field_0x5fc, l_HIO.field_0x48, 0.01f); + dKy_BossLight_set(&mLampPosition, &color, field_0x5fc, 1); + } + + J3DModel* model = mpMorf->getModel(); + g_env_light.settingTevStruct(0, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType_MAJI(model, &tevStr); + mpEyeAnm->entry(model->getModelData()); + mpMorf->entryDL(); + + cXyz pos; + pos.set(current.pos.x, current.pos.y + 100.0f, current.pos.z); + mShadowKey = dComIfGd_setShadow(mShadowKey, 1, model, &pos, 1000.0f, 100.0f, current.pos.y, + mAcch.GetGroundH(), mAcch.m_gnd, &tevStr, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + + g_env_light.setLightTevColorType_MAJI(mpLampModel, &tevStr); + mDoExt_modelUpdateDL(mpLampModel); + + g_env_light.setLightTevColorType_MAJI(mpGlowEffectMorf->getModel(), &tevStr); + J3DMaterial* material = mpGlowEffectMorf->getModel()->getModelData()->getMaterialNodePointer(0); + if (mSecondEncounter) { + material->getTevColor(1)->r = l_HIO.mGlowColor1R; + material->getTevColor(1)->g = l_HIO.mGlowColor1G; + material->getTevColor(1)->b = l_HIO.mGlowColor1B; + material->getTevColor(1)->a = l_HIO.mGlowColor1A; + material->getTevColor(2)->r = l_HIO.mGlowColor2R; + material->getTevColor(2)->g = l_HIO.mGlowColor2G; + material->getTevColor(2)->b = l_HIO.mGlowColor2B; + } else { + material->getTevColor(1)->r = 120; + material->getTevColor(1)->g = 150; + material->getTevColor(1)->b = 150; + material->getTevColor(1)->a = 255; + material->getTevColor(2)->r = 0; + material->getTevColor(2)->g = 60; + material->getTevColor(2)->b = 101; + } + mpGlowEffectMorf->entryDL(); + + g_env_light.setLightTevColorType_MAJI(mpTrumpetMorf->getModel(), &tevStr); + mpTrumpetMorf->entryDL(); + + return 1; } /* 8074AAC0-8074AB28 008CC0 0068+00 1/1 0/0 0/0 .text Delete__8daE_PM_cFv */ -void daE_PM_c::Delete() { - // NONMATCHING -} +int daE_PM_c::Delete() { + dComIfG_resDelete(&mPhase, "E_PM"); + + if (mHIOInit) { + hioInit = false; + } -/* ############################################################################################## */ -/* 8074C13C-8074C144 000200 0008+00 1/1 0/0 0/0 .rodata @7464 */ -SECTION_RODATA static u8 const lit_7464[8] = { - 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x8074C13C, &lit_7464); + if (heap != NULL) { + mpMorf->stopZelAnime(); + } + + return 1; +} /* 8074AB28-8074ABA8 008D28 0080+00 1/1 0/0 0/0 .text setBaseMtx__8daE_PM_cFv */ void daE_PM_c::setBaseMtx() { - // NONMATCHING + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + mpMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + mpMorf->modelCalc(); + mpEyeAnm->setFrame(mEyeAnmFrame); } /* 8074ABA8-8074AC10 008DA8 0068+00 1/1 0/0 0/0 .text setGakkiBaseMtx__8daE_PM_cFv */ void daE_PM_c::setGakkiBaseMtx() { - // NONMATCHING + mpTrumpetMorf->getModel()->setBaseTRMtx(mpMorf->getModel()->getAnmMtx(JNT_HAND_L)); + mpTrumpetMorf->play(NULL, 0, 0); + mpTrumpetMorf->modelCalc(); } -/* ############################################################################################## */ -/* 8074C144-8074C148 000208 0004+00 0/1 0/0 0/0 .rodata @7575 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_7575 = -35.0f; -COMPILER_STRIP_GATE(0x8074C144, &lit_7575); -#pragma pop - /* 8074AC10-8074AE90 008E10 0280+00 1/1 0/0 0/0 .text setLampBaseMtx__8daE_PM_cFv */ void daE_PM_c::setLampBaseMtx() { - // NONMATCHING + cXyz vec1, vec2; + MTXCopy(mpMorf->getModel()->getAnmMtx(JNT_HAND_R), *calc_mtx); + cXyz vec3(0.0f, -30.0f, -5.0f); + //! @bug vec1 is not initialized in its first two uses, which are probably supposed to be vec3 + MtxPosition(&vec1, &mLampPosition); + mDoMtx_stack_c::transS(mLampPosition); + mDoMtx_stack_c::ZXYrotM(mLampAngle); + mpLampModel->setBaseTRMtx(mDoMtx_stack_c::get()); + + mDoMtx_stack_c::transM(0.0f, -35.0f, 0.0f); + MTXCopy(mDoMtx_stack_c::get(), *calc_mtx); + MtxPosition(&vec1, &vec2); + mLampParticleKey = dComIfGp_particle_set(mLampParticleKey, 0x818C, &vec2, NULL, NULL); + JPABaseEmitter* emitter = dComIfGp_particle_getEmitter(mLampParticleKey); + if (emitter != NULL) { + cXyz scale(l_HIO.mLampParticleScale, l_HIO.mLampParticleScale, l_HIO.mLampParticleScale); + emitter->setGlobalScale(scale); + } + + mDoMtx_stack_c::transS(vec2.x, vec2.y, vec2.z); + vec1 = dComIfGp_getCamera(0)->mLookat.mEye - vec2; + mDoMtx_stack_c::YrotM(cM_atan2s(vec1.x, vec1.z)); + mDoMtx_stack_c::XrotM(-cM_atan2s(vec1.y, JMAFastSqrt(vec1.x * vec1.x + vec1.z * vec1.z))); + mDoMtx_stack_c::scaleM(l_HIO.mGlowEffectScale, l_HIO.mGlowEffectScale, l_HIO.mGlowEffectScale); + mpGlowEffectMorf->getModel()->setBaseTRMtx(mDoMtx_stack_c::get()); + mpGlowEffectMorf->play(NULL, 0, 0); + mpGlowEffectMorf->modelCalc(); } /* 8074AE90-8074AEB0 009090 0020+00 1/0 0/0 0/0 .text daE_PM_Draw__FP8daE_PM_c */ -static void daE_PM_Draw(daE_PM_c* param_0) { - // NONMATCHING +static int daE_PM_Draw(daE_PM_c* i_this) { + return i_this->Draw(); } /* 8074AEB0-8074AED0 0090B0 0020+00 2/1 0/0 0/0 .text daE_PM_Execute__FP8daE_PM_c */ -static void daE_PM_Execute(daE_PM_c* param_0) { - // NONMATCHING +static int daE_PM_Execute(daE_PM_c* i_this) { + return i_this->Execute(); } /* 8074AED0-8074AED8 0090D0 0008+00 1/0 0/0 0/0 .text daE_PM_IsDelete__FP8daE_PM_c */ -static bool daE_PM_IsDelete(daE_PM_c* param_0) { - return true; +static int daE_PM_IsDelete(daE_PM_c* i_this) { + return 1; } /* 8074AED8-8074AEF8 0090D8 0020+00 1/0 0/0 0/0 .text daE_PM_Delete__FP8daE_PM_c */ -static void daE_PM_Delete(daE_PM_c* param_0) { - // NONMATCHING +static int daE_PM_Delete(daE_PM_c* i_this) { + return i_this->Delete(); } /* 8074AEF8-8074B4DC 0090F8 05E4+00 1/1 0/0 0/0 .text SkipChk__8daE_PM_cFv */ void daE_PM_c::SkipChk() { - // NONMATCHING + fopAc_ac_c* puppet; + cXyz vec1, vec2, vec3; + + if (cDmr_SkipInfo == 0) { + return; + } + + if (mStage == 0) { + mDoorAction = 5; + if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this))) { + dComIfGs_onSwitch(mSwBit, fopAcM_GetRoomNo(this)); + } + + for (int i = 0; i < 2; i++) { + if (!fopAcM_SearchByID(mPuppetID[i], &puppet)) { + vec1.set(i * 100.0f + 500.0f, 150.0f, -(i * 100.0f)); + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(shape_angle.y); + mDoMtx_stack_c::multVec(&vec1, &vec1); + mPuppetID[i] = fopAcM_createChild(PROC_E_FS, fopAcM_GetID(this), 0, &vec1, + fopAcM_GetRoomNo(this), &shape_angle, + NULL, -1, NULL); + } + } + + for (int i = 2; i < 4; i++) { + if (!fopAcM_SearchByID(mPuppetID[i], &puppet)) { + vec1.set(-500.0f - i * 100.0f, 150.0f, -(i * 100.0f)); + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::YrotM(shape_angle.y); + mDoMtx_stack_c::multVec(&vec1, &vec1); + mPuppetID[i] = fopAcM_createChild(PROC_E_FS, fopAcM_GetID(this), 0, &vec1, + fopAcM_GetRoomNo(this), &shape_angle, + NULL, -1, NULL); + } + } + + daE_PM_c* other = (daE_PM_c*)fpcM_Search(s_pm_sub, this); + if (other != NULL) { + for (int i = 0; i < 4; i++) { + other->mPuppetID[i] = mPuppetID[i]; + } + } + + mCamCenter = *s_LinkPos; + mCamCenter.y += 200.0f; + mCamEye.set(-9881.0f, 1892.0f, 17971.0f); + SetReleaseCam(); + + if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this))) { + dComIfGs_onSwitch(mSwBit, fopAcM_GetRoomNo(this)); + } + + mAction = ACT_ESCAPE; + mMode = 2; + mTimer[0] = 10; + mPoint = dPath_GetPnt(mpPath, 0)->m_position; + current.pos.set(mPoint.x, mPoint.y + 1000.0f, mPoint.z); + old.pos = current.pos; + + } else if (mStage == 4) { + f32 step = 0x10000 / mPuppetNum; + vec3.set(0.0f, 0.0f, 400.0f); + for (int i = 0; i < mPuppetNum; i++) { + cLib_offsetPos(&vec2, ¤t.pos, shape_angle.y + step * i, &vec3); + } + + if (mSecondEncounter) { + fopAcM_OffStatus(this, fopAcStts_CULL_e); + SetReleaseCam(); + mDoorAction = 1; + mDemoMode = 0; + mCcCyl.OffTgNoHitMark(); + mAction = ACT_CREATE; + mMode = 0; + SetAnm(ANM_GLAD, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + current.pos.y = mAcch.GetGroundH(); + old.pos.y = current.pos.y; + mBossLightOn = true; + } else { + mCamCenter = *s_LinkPos; + mCamCenter.y += 200.0f; + vec3.set(0.0f, 200.0f, 500.0f); + cLib_offsetPos(&mCamEye, s_LinkPos, cLib_targetAngleY(¤t.pos, s_LinkPos), &vec3); + SetReleaseCam(); + mDoorAction = 1; + mDemoMode = 0; + mAction = ACT_CREATE; + mMode = 0; + mPoint = dPath_GetPnt(mpPath, 1)->m_position; + current.pos.set(mPoint.x, mPoint.y, mPoint.z); + old.pos = current.pos; + SetAnm(ANM_WAIT01, J3DFrameCtrl::LOOP_REPEAT_e, 5.0f, 1.0f); + } + } } /* 8074B4DC-8074B834 0096DC 0358+00 1/1 0/0 0/0 .text Create__8daE_PM_cFv */ -void daE_PM_c::Create() { - // NONMATCHING -} - -/* 8074B834-8074B87C 009A34 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGCylFv */ -// cM3dGCyl::~cM3dGCyl() { -extern "C" void __dt__8cM3dGCylFv() { - // NONMATCHING -} - -/* 8074B87C-8074B8C4 009A7C 0048+00 1/0 0/0 0/0 .text __dt__8cM3dGAabFv */ -// cM3dGAab::~cM3dGAab() { -extern "C" void __dt__8cM3dGAabFv() { - // NONMATCHING -} - -/* 8074B8C4-8074B920 009AC4 005C+00 1/0 0/0 0/0 .text __dt__10dCcD_GSttsFv */ -// dCcD_GStts::~dCcD_GStts() { -extern "C" void __dt__10dCcD_GSttsFv() { - // NONMATCHING -} - -/* 8074B920-8074B990 009B20 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING -} - -/* 8074B990-8074BA00 009B90 0070+00 1/0 0/0 0/0 .text __dt__12dBgS_AcchCirFv */ -// dBgS_AcchCir::~dBgS_AcchCir() { -extern "C" void __dt__12dBgS_AcchCirFv() { - // NONMATCHING +cPhs__Step daE_PM_c::Create() { + fopAcM_SetupActor(this, daE_PM_c); + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&mPhase, "E_PM"); + + if (step == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(this, useHeapInit, 0x45E0)) { + return cPhs_ERROR_e; + } + + if (!hioInit) { + hioInit = true; + mHIOInit = true; + l_HIO.field_0x4 = -1; + } + + mStage = fopAcM_GetParam(this) & 0xFF; + mPathIndex = (fopAcM_GetParam(this) >> 8) & 0xFF; + mpPath = dPath_GetRoomPath(mPathIndex, fopAcM_GetRoomNo(this)); + mSwBit = (fopAcM_GetParam(this) >> 0x18) & 0xFF; + + attention_info.flags = 4; + attention_info.distances[fopAc_attn_BATTLE_e] = 86; + fopAcM_SetMtx(this, mpMorf->getModel()->getBaseTRMtx()); + fopAcM_SetMin(this, -200.0f, 0.0f, -200.0f); + fopAcM_SetMax(this, 200.0f, 200.0f, 200.0f); + mAcchCir.SetWall(30.0f, 100.0f); + mAcch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, &mAcchCir, + fopAcM_GetSpeed_p(this), NULL, NULL); + mCreatureSound.init(¤t.pos, &eyePos, 3, 1); + mAtInfo.mpSound = &mCreatureSound; + mAtInfo.mPowerType = 1; + mAtInfo.mpSound = &mCreatureSound; + initCcCylinder(); + field_0x6ff = false; + gravity = -9.0f; + health = 100; + mBossHealth = 3; + field_0x5fc = 0.0f; + mCreatureSound.setEnemyName("E_PM"); + + J3DModel* model = mpMorf->getModel(); + model->setUserArea((u32)this); + model->getModelData()->getJointNodePointer(JNT_HEAD)->setCallBack(JointCallBack); + + if (dComIfG_play_c::getLayerNo(0) == 2 || dComIfG_play_c::getLayerNo(0) == 5) { + mSecondEncounter = true; + } + + if (mStage == 0) { + current.pos.y += 10000.0f; + gravity = 0.0f; + } else if (mStage == 4) { + current.pos.y += 500.0f; + } + + daE_PM_Execute(this); + } + + return step; } /* 8074BA00-8074BA20 009C00 0020+00 1/0 0/0 0/0 .text daE_PM_Create__FP10fopAc_ac_c */ -static void daE_PM_Create(fopAc_ac_c* param_0) { - // NONMATCHING -} - -/* 8074BA20-8074BA68 009C20 0048+00 1/0 0/0 0/0 .text __dt__10cCcD_GSttsFv */ -// cCcD_GStts::~cCcD_GStts() { -extern "C" void __dt__10cCcD_GSttsFv() { - // NONMATCHING -} - -/* 8074BA68-8074BAB0 009C68 0048+00 2/1 0/0 0/0 .text __dt__12daE_PM_HIO_cFv */ -daE_PM_HIO_c::~daE_PM_HIO_c() { - // NONMATCHING +static cPhs__Step daE_PM_Create(fopAc_ac_c* i_this) { + return static_cast(i_this)->Create(); } -/* 8074BAB0-8074BAEC 009CB0 003C+00 0/0 1/0 0/0 .text __sinit_d_a_e_pm_cpp */ -void __sinit_d_a_e_pm_cpp() { - // NONMATCHING -} - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x8074BAB0, __sinit_d_a_e_pm_cpp); -#pragma pop +AUDIO_INSTANCES; -/* 8074BAEC-8074BAF4 009CEC 0008+00 1/0 0/0 0/0 .text @20@__dt__14dBgS_ObjGndChkFv */ -static void func_8074BAEC() { - // NONMATCHING -} - -/* 8074BAF4-8074BAFC 009CF4 0008+00 1/0 0/0 0/0 .text @76@__dt__14dBgS_ObjGndChkFv */ -static void func_8074BAF4() { - // NONMATCHING -} - -/* 8074BAFC-8074BB04 009CFC 0008+00 1/0 0/0 0/0 .text @60@__dt__14dBgS_ObjGndChkFv */ -static void func_8074BAFC() { - // NONMATCHING -} - -/* 8074BB04-8074BB0C 009D04 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_8074BB04() { - // NONMATCHING -} - -/* 8074BB0C-8074BB14 009D0C 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_8074BB0C() { - // NONMATCHING -} - -/* 8074BB14-8074BF28 009D14 0414+00 1/1 0/0 0/0 .text - * setMidnaBindEffect__FP13fopEn_enemy_cP15Z2CreatureEnemyP4cXyzP4cXyz */ -static void setMidnaBindEffect(fopEn_enemy_c* param_0, Z2CreatureEnemy* param_1, cXyz* param_2, - cXyz* param_3) { - // NONMATCHING -} - -/* ############################################################################################## */ -/* 8074C3EC-8074C3F0 0000AC 0004+00 0/0 0/0 0/0 .bss - * sInstance__40JASGlobalInstance<19JASDefaultBankTable> */ -#pragma push -#pragma force_active on -static u8 data_8074C3EC[4]; -#pragma pop - -/* 8074C3F0-8074C3F4 0000B0 0004+00 0/0 0/0 0/0 .bss - * sInstance__35JASGlobalInstance<14JASAudioThread> */ -#pragma push -#pragma force_active on -static u8 data_8074C3F0[4]; -#pragma pop - -/* 8074C3F4-8074C3F8 0000B4 0004+00 0/0 0/0 0/0 .bss sInstance__27JASGlobalInstance<7Z2SeMgr> */ -#pragma push -#pragma force_active on -static u8 data_8074C3F4[4]; -#pragma pop - -/* 8074C3F8-8074C3FC 0000B8 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8Z2SeqMgr> */ -#pragma push -#pragma force_active on -static u8 data_8074C3F8[4]; -#pragma pop - -/* 8074C3FC-8074C400 0000BC 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SceneMgr> - */ -#pragma push -#pragma force_active on -static u8 data_8074C3FC[4]; -#pragma pop - -/* 8074C400-8074C404 0000C0 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2StatusMgr> - */ -#pragma push -#pragma force_active on -static u8 data_8074C400[4]; -#pragma pop - -/* 8074C404-8074C408 0000C4 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2DebugSys> - */ -#pragma push -#pragma force_active on -static u8 data_8074C404[4]; -#pragma pop - -/* 8074C408-8074C40C 0000C8 0004+00 0/0 0/0 0/0 .bss - * sInstance__36JASGlobalInstance<15JAISoundStarter> */ -#pragma push -#pragma force_active on -static u8 data_8074C408[4]; -#pragma pop - -/* 8074C40C-8074C410 0000CC 0004+00 0/0 0/0 0/0 .bss - * sInstance__35JASGlobalInstance<14Z2SoundStarter> */ -#pragma push -#pragma force_active on -static u8 data_8074C40C[4]; -#pragma pop - -/* 8074C410-8074C414 0000D0 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12Z2SpeechMgr2> */ -#pragma push -#pragma force_active on -static u8 data_8074C410[4]; -#pragma pop - -/* 8074C414-8074C418 0000D4 0004+00 0/0 0/0 0/0 .bss sInstance__28JASGlobalInstance<8JAISeMgr> */ -#pragma push -#pragma force_active on -static u8 data_8074C414[4]; -#pragma pop - -/* 8074C418-8074C41C 0000D8 0004+00 0/0 0/0 0/0 .bss sInstance__29JASGlobalInstance<9JAISeqMgr> */ -#pragma push -#pragma force_active on -static u8 data_8074C418[4]; -#pragma pop - -/* 8074C41C-8074C420 0000DC 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAIStreamMgr> */ -#pragma push -#pragma force_active on -static u8 data_8074C41C[4]; -#pragma pop - -/* 8074C420-8074C424 0000E0 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2SoundMgr> - */ -#pragma push -#pragma force_active on -static u8 data_8074C420[4]; -#pragma pop - -/* 8074C424-8074C428 0000E4 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAISoundInfo> */ -#pragma push -#pragma force_active on -static u8 data_8074C424[4]; -#pragma pop - -/* 8074C428-8074C42C 0000E8 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13JAUSoundTable> */ -#pragma push -#pragma force_active on -static u8 data_8074C428[4]; -#pragma pop - -/* 8074C42C-8074C430 0000EC 0004+00 0/0 0/0 0/0 .bss - * sInstance__38JASGlobalInstance<17JAUSoundNameTable> */ -#pragma push -#pragma force_active on -static u8 data_8074C42C[4]; -#pragma pop - -/* 8074C430-8074C434 0000F0 0004+00 0/0 0/0 0/0 .bss - * sInstance__33JASGlobalInstance<12JAUSoundInfo> */ -#pragma push -#pragma force_active on -static u8 data_8074C430[4]; -#pragma pop - -/* 8074C434-8074C438 0000F4 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SoundInfo> - */ -#pragma push -#pragma force_active on -static u8 data_8074C434[4]; -#pragma pop - -/* 8074C438-8074C43C 0000F8 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13Z2SoundObjMgr> */ -#pragma push -#pragma force_active on -static u8 data_8074C438[4]; -#pragma pop - -/* 8074C43C-8074C440 0000FC 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2Audience> - */ -#pragma push -#pragma force_active on -static u8 data_8074C43C[4]; -#pragma pop - -/* 8074C440-8074C444 000100 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2FxLineMgr> - */ -#pragma push -#pragma force_active on -static u8 data_8074C440[4]; -#pragma pop - -/* 8074C444-8074C448 000104 0004+00 0/0 0/0 0/0 .bss sInstance__31JASGlobalInstance<10Z2EnvSeMgr> - */ -#pragma push -#pragma force_active on -static u8 data_8074C444[4]; -#pragma pop +/* 8074C23C-8074C25C -00001 0020+00 1/0 0/0 0/0 .data l_daE_PM_Method */ +static actor_method_class l_daE_PM_Method = { + (process_method_func)daE_PM_Create, + (process_method_func)daE_PM_Delete, + (process_method_func)daE_PM_Execute, + (process_method_func)daE_PM_IsDelete, + (process_method_func)daE_PM_Draw, +}; -/* 8074C448-8074C44C 000108 0004+00 0/0 0/0 0/0 .bss sInstance__32JASGlobalInstance<11Z2SpeechMgr> - */ -#pragma push -#pragma force_active on -static u8 data_8074C448[4]; -#pragma pop - -/* 8074C44C-8074C450 00010C 0004+00 0/0 0/0 0/0 .bss - * sInstance__34JASGlobalInstance<13Z2WolfHowlMgr> */ -#pragma push -#pragma force_active on -static u8 data_8074C44C[4]; -#pragma pop - -/* 8074C148-8074C148 00020C 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 8074C25C-8074C28C -00001 0030+00 0/0 0/0 1/0 .data g_profile_E_PM */ +extern actor_process_profile_definition g_profile_E_PM = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_E_PM, // mProcName + &g_fpcLf_Method.mBase, // sub_method + sizeof(daE_PM_c), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 161, // mPriority + &l_daE_PM_Method, // sub_method + 0x00040100, // mStatus + fopAc_ENEMY_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +}; diff --git a/src/d/actor/d_a_obj_sm_door.cpp b/src/d/actor/d_a_obj_sm_door.cpp index 5b699f30283..b64078c0936 100644 --- a/src/d/actor/d_a_obj_sm_door.cpp +++ b/src/d/actor/d_a_obj_sm_door.cpp @@ -1,413 +1,332 @@ /** * @file d_a_obj_sm_door.cpp - * + * Object - Sacred Meadow Door */ #include "d/actor/d_a_obj_sm_door.h" -#include "dol2asm.h" - - -// -// Forward References: -// - -extern "C" static void daObjSM_DOOR_Create__FP10fopAc_ac_c(); -extern "C" static void daObjSM_DOOR_Delete__FP14daObjSM_DOOR_c(); -extern "C" static void s_obj_sub__FPvPv(); -extern "C" void ChangeModel__14daObjSM_DOOR_cFv(); -extern "C" void Action__14daObjSM_DOOR_cFv(); -extern "C" void SetDzb__14daObjSM_DOOR_cFv(); -extern "C" void ReleaceDzb__14daObjSM_DOOR_cFv(); -extern "C" void DrawChk1__14daObjSM_DOOR_cFv(); -extern "C" void DrawChk2__14daObjSM_DOOR_cFv(); -extern "C" void setBaseMtx__14daObjSM_DOOR_cFv(); -extern "C" static void daObjSM_DOOR_Draw__FP14daObjSM_DOOR_c(); -extern "C" static void daObjSM_DOOR_Execute__FP14daObjSM_DOOR_c(); -extern "C" void create__14daObjSM_DOOR_cFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" static bool daObjSM_DOOR_IsDelete__FP14daObjSM_DOOR_c(); -extern "C" void CreateHeap__14daObjSM_DOOR_cFv(); -extern "C" void Create__14daObjSM_DOOR_cFv(); -extern "C" void Execute__14daObjSM_DOOR_cFPPA3_A4_f(); -extern "C" void Draw__14daObjSM_DOOR_cFv(); -extern "C" void Delete__14daObjSM_DOOR_cFv(); -extern "C" static void func_80CD9578(); -extern "C" static void func_80CD9580(); -extern "C" extern char const* const d_a_obj_sm_door__stringBase0; - -// -// External References: -// - -extern "C" void transS__14mDoMtx_stack_cFRC4cXyz(); -extern "C" void ZXYrotM__14mDoMtx_stack_cFRC5csXyz(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void fopAc_IsActor__FPv(); -extern "C" void fopAcM_delete__FP10fopAc_ac_c(); -extern "C" void fopAcM_setCullSizeBox__FP10fopAc_ac_cffffff(); -extern "C" void gndCheck__11fopAcM_gc_cFPC4cXyz(); -extern "C" void fpcEx_Search__FPFPvPv_PvPv(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCcPCcP11dRes_info_ci(); -extern "C" void getObjectResName2Index__14dRes_control_cFPCcPCc(); -extern "C" void Release__4cBgSFP9dBgW_Base(); -extern "C" void Regist__4dBgSFP9dBgW_BaseP10fopAc_ac_c(); -extern "C" void dBgS_MoveBGProc_TypicalRotY__FP4dBgWPvRC13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz(); -extern "C" void __ct__12dBgS_AcchCirFv(); -extern "C" void __dt__9dBgS_AcchFv(); -extern "C" void __ct__9dBgS_AcchFv(); -extern "C" void __ct__16dBgS_MoveBgActorFv(); -extern "C" bool IsDelete__16dBgS_MoveBgActorFv(); -extern "C" bool ToFore__16dBgS_MoveBgActorFv(); -extern "C" bool ToBack__16dBgS_MoveBgActorFv(); -extern "C" void -MoveBGCreate__16dBgS_MoveBgActorFPCciPFP4dBgWPvRC13cBgS_PolyInfobP4cXyzP5csXyzP5csXyz_vUlPA3_A4_f(); -extern "C" void MoveBGDelete__16dBgS_MoveBgActorFv(); -extern "C" void MoveBGExecute__16dBgS_MoveBgActorFv(); -extern "C" void SetObj__16dBgS_PolyPassChkFv(); -extern "C" void __ct__10dCcD_GSttsFv(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void ChkUsed__9cBgW_BgIdCFv(); -extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void __dl__FPv(); -extern "C" void _savegpr_28(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_28(); -extern "C" void _restgpr_29(); -extern "C" extern void* __vt__9dCcD_Stts[11]; -extern "C" extern void* __vt__9cCcD_Stts[8]; -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" f32 mGroundY__11fopAcM_gc_c; -extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; - -// -// Declarations: -// +#include "JSystem/J3DGraphBase/J3DMaterial.h" +#include "f_op/f_op_actor_mng.h" +#include "d/d_bg_w.h" +#include "d/d_com_inf_game.h" +#include "d/actor/d_a_e_pm.h" + +/* 80CD968C-80CD9690 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ +static char* l_arcName = "sm_door"; /* 80CD85B8-80CD85D8 000078 0020+00 1/0 0/0 0/0 .text daObjSM_DOOR_Create__FP10fopAc_ac_c */ -static void daObjSM_DOOR_Create(fopAc_ac_c* param_0) { - // NONMATCHING +static cPhs__Step daObjSM_DOOR_Create(fopAc_ac_c* i_this) { + return static_cast(i_this)->create(); } /* 80CD85D8-80CD85FC 000098 0024+00 1/0 0/0 0/0 .text daObjSM_DOOR_Delete__FP14daObjSM_DOOR_c */ -static void daObjSM_DOOR_Delete(daObjSM_DOOR_c* param_0) { - // NONMATCHING +static int daObjSM_DOOR_Delete(daObjSM_DOOR_c* i_this) { + i_this->MoveBGDelete(); + return 1; } -/* ############################################################################################## */ -/* 80CD9590-80CD9598 000000 0004+04 4/4 0/0 0/0 .rodata @3697 */ -SECTION_RODATA static u8 const lit_3697[4 + 4 /* padding */] = { - 0x00, - 0x00, - 0x00, - 0x00, - /* padding */ - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80CD9590, &lit_3697); - -/* 80CD9598-80CD95A0 000008 0008+00 0/2 0/0 0/0 .rodata @3698 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3698[8] = { - 0x3F, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80CD9598, &lit_3698); -#pragma pop - -/* 80CD95A0-80CD95A8 000010 0008+00 0/2 0/0 0/0 .rodata @3699 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3699[8] = { - 0x40, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80CD95A0, &lit_3699); -#pragma pop - -/* 80CD95A8-80CD95B0 000018 0008+00 0/2 0/0 0/0 .rodata @3700 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3700[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80CD95A8, &lit_3700); -#pragma pop - -/* 80CD95B0-80CD95B4 000020 0004+00 0/1 0/0 0/0 .rodata @3701 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3701 = 800.0f; -COMPILER_STRIP_GATE(0x80CD95B0, &lit_3701); -#pragma pop - /* 80CD85FC-80CD8784 0000BC 0188+00 1/1 0/0 0/0 .text s_obj_sub__FPvPv */ -static void s_obj_sub(void* param_0, void* param_1) { - // NONMATCHING +static void* s_obj_sub(void* i_actor, void* i_this) { + fopAc_ac_c* actor = static_cast(i_actor); + fopAc_ac_c* _this = static_cast(i_this); + cXyz& actor_pos = fopAcM_GetPosition(actor); + cXyz& pos = fopAcM_GetPosition(_this); + if (fopAcM_IsActor(i_actor) && fopAcM_GetName(i_actor) == PROC_E_PM + && actor_pos.absXZ(pos) < 800.0f) + { + return i_actor; + } + return NULL; } /* 80CD8784-80CD8790 000244 000C+00 1/1 0/0 0/0 .text ChangeModel__14daObjSM_DOOR_cFv */ void daObjSM_DOOR_c::ChangeModel() { - // NONMATCHING + mUseAlphaModel = true; } -/* ############################################################################################## */ -/* 80CD95B4-80CD95B8 000024 0004+00 0/2 0/0 0/0 .rodata @3753 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3753 = 1000.0f; -COMPILER_STRIP_GATE(0x80CD95B4, &lit_3753); -#pragma pop - -/* 80CD95B8-80CD95BC 000028 0004+00 0/1 0/0 0/0 .rodata @3829 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3829 = 600.0f; -COMPILER_STRIP_GATE(0x80CD95B8, &lit_3829); -#pragma pop - -/* 80CD95BC-80CD95C0 00002C 0004+00 0/1 0/0 0/0 .rodata @3830 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3830 = 1.0f; -COMPILER_STRIP_GATE(0x80CD95BC, &lit_3830); -#pragma pop - -/* 80CD95C0-80CD95C4 000030 0004+00 0/1 0/0 0/0 .rodata @3831 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3831 = -1.0f; -COMPILER_STRIP_GATE(0x80CD95C0, &lit_3831); -#pragma pop - -/* 80CD95C4-80CD95C8 000034 0004+00 0/1 0/0 0/0 .rodata @3832 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_3832 = 3.0f; -COMPILER_STRIP_GATE(0x80CD95C4, &lit_3832); -#pragma pop - -/* 80CD95C8-80CD95D0 000038 0008+00 0/1 0/0 0/0 .rodata @3834 */ -#pragma push -#pragma force_active on -SECTION_RODATA static u8 const lit_3834[8] = { - 0x43, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -COMPILER_STRIP_GATE(0x80CD95C8, &lit_3834); -#pragma pop +f32 dummy_literal() { + return 1000.0f; +} /* 80CD8790-80CD8A40 000250 02B0+00 1/1 0/0 0/0 .text Action__14daObjSM_DOOR_cFv */ void daObjSM_DOOR_c::Action() { - // NONMATCHING + switch (mMode) { + case 0: { + daE_PM_c* skullkid = (daE_PM_c*)fpcM_Search(s_obj_sub, this); + if (skullkid != NULL) { + if (skullkid->DoorChk() == 2) { + ChangeModel(); + mMode++; + } + if (skullkid->DoorChk() == 5) { + fopAcM_delete(this); + fopAcM_delete(skullkid); + } + } + break; + } + + case 1: { + daE_PM_c* skullkid = (daE_PM_c*)fpcM_Search(s_obj_sub, this); + if (skullkid != NULL) { + if (current.pos.absXZ(fopAcM_GetPosition(skullkid)) < 600.0f) { + Z2GetAudioMgr()->seStart(Z2SE_OBJ_PM_WALL_FADEAWAY, ¤t.pos, + 0, 0, 1.0f, 1.0f, -1.0f, -1.0f, 0); + mMode++; + ReleaceDzb(); + } + if (skullkid->DoorChk() == 5) { + fopAcM_delete(this); + fopAcM_delete(skullkid); + } + } + break; + } + + case 2: + mAlpha -= 3.0f; + if (mAlpha < 4) { + fopAcM_delete(this); + } + break; + } } /* 80CD8A40-80CD8A90 000500 0050+00 2/2 0/0 0/0 .text SetDzb__14daObjSM_DOOR_cFv */ -void daObjSM_DOOR_c::SetDzb() { - // NONMATCHING +int daObjSM_DOOR_c::SetDzb() { + if (mpBgW != NULL && dComIfG_Bgsp().Regist(mpBgW, this)) { + return 0; + } + return 1; } /* 80CD8A90-80CD8AF8 000550 0068+00 3/3 0/0 0/0 .text ReleaceDzb__14daObjSM_DOOR_cFv */ -void daObjSM_DOOR_c::ReleaceDzb() { - // NONMATCHING +int daObjSM_DOOR_c::ReleaceDzb() { + if (mpBgW != NULL && mpBgW->ChkUsed() && dComIfG_Bgsp().Release(mpBgW)) { + return 0; + } + return 1; } /* 80CD8AF8-80CD8BBC 0005B8 00C4+00 1/1 0/0 0/0 .text DrawChk1__14daObjSM_DOOR_cFv */ void daObjSM_DOOR_c::DrawChk1() { - // NONMATCHING + if (mSwBit != 0xff && dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this)) && mActive == false) { + if (SetDzb()) { + mActive = true; + } + } else if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this)) + && mActive == true) { + if (ReleaceDzb()) { + mActive = false; + } + } } /* 80CD8BBC-80CD8C80 00067C 00C4+00 1/1 0/0 0/0 .text DrawChk2__14daObjSM_DOOR_cFv */ void daObjSM_DOOR_c::DrawChk2() { - // NONMATCHING + if (mSwBit != 0xff && !dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this)) && mActive == false) { + if (SetDzb()) { + mActive = true; + } + } else if (mSwBit != 0xff && dComIfGs_isSwitch(mSwBit, fopAcM_GetRoomNo(this)) + && mActive == true) { + if (ReleaceDzb()) { + mActive = false; + } + } } /* 80CD8C80-80CD8D00 000740 0080+00 1/1 0/0 0/0 .text setBaseMtx__14daObjSM_DOOR_cFv */ void daObjSM_DOOR_c::setBaseMtx() { - // NONMATCHING + mDoMtx_stack_c::transS(current.pos); + mDoMtx_stack_c::ZXYrotM(shape_angle); + if (!mUseAlphaModel) { + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); + } else { + mpAlphaModel->setBaseTRMtx(mDoMtx_stack_c::get()); + } + MTXCopy(mDoMtx_stack_c::get(), mBgMtx); } /* 80CD8D00-80CD8D2C 0007C0 002C+00 1/0 0/0 0/0 .text daObjSM_DOOR_Draw__FP14daObjSM_DOOR_c */ -static void daObjSM_DOOR_Draw(daObjSM_DOOR_c* param_0) { - // NONMATCHING +static int daObjSM_DOOR_Draw(daObjSM_DOOR_c* i_this) { + return i_this->MoveBGDraw(); } /* 80CD8D2C-80CD8D4C 0007EC 0020+00 2/1 0/0 0/0 .text daObjSM_DOOR_Execute__FP14daObjSM_DOOR_c */ -static void daObjSM_DOOR_Execute(daObjSM_DOOR_c* param_0) { - // NONMATCHING +static int daObjSM_DOOR_Execute(daObjSM_DOOR_c* i_this) { + return i_this->MoveBGExecute(); } -/* ############################################################################################## */ -/* 80CD95D0-80CD95D4 000040 0004+00 0/1 0/0 0/0 .rodata @4060 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4060 = -9.0f; -COMPILER_STRIP_GATE(0x80CD95D0, &lit_4060); -#pragma pop - -/* 80CD95D4-80CD95D8 000044 0004+00 0/1 0/0 0/0 .rodata @4061 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4061 = 100.0f; -COMPILER_STRIP_GATE(0x80CD95D4, &lit_4061); -#pragma pop - -/* 80CD95D8-80CD95DC 000048 0004+00 0/2 0/0 0/0 .rodata @4062 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4062 = -1000.0f; -COMPILER_STRIP_GATE(0x80CD95D8, &lit_4062); -#pragma pop - -/* 80CD95DC-80CD95E0 00004C 0004+00 0/2 0/0 0/0 .rodata @4063 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4063 = -500.0f; -COMPILER_STRIP_GATE(0x80CD95DC, &lit_4063); -#pragma pop - -/* 80CD95E0-80CD95E4 000050 0004+00 0/2 0/0 0/0 .rodata @4064 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4064 = 500.0f; -COMPILER_STRIP_GATE(0x80CD95E0, &lit_4064); -#pragma pop - -/* 80CD95E4-80CD95E4 000054 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80CD95E4 = "sm_door"; -SECTION_DEAD static char const* const stringBase_80CD95EC = "A_SM_DoorA.dzb"; -SECTION_DEAD static char const* const stringBase_80CD95FB = "A_SM_DoorBl.dzb"; -SECTION_DEAD static char const* const stringBase_80CD960B = "A_SM_DoorWo.dzb"; -#pragma pop - -/* 80CD968C-80CD9690 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName = (void*)&d_a_obj_sm_door__stringBase0; - -/* 80CD9690-80CD96B0 -00001 0020+00 1/0 0/0 0/0 .data l_daObjSM_DOOR_Method */ -static actor_method_class l_daObjSM_DOOR_Method = { - (process_method_func)daObjSM_DOOR_Create__FP10fopAc_ac_c, - (process_method_func)daObjSM_DOOR_Delete__FP14daObjSM_DOOR_c, - (process_method_func)daObjSM_DOOR_Execute__FP14daObjSM_DOOR_c, - (process_method_func)daObjSM_DOOR_IsDelete__FP14daObjSM_DOOR_c, - (process_method_func)daObjSM_DOOR_Draw__FP14daObjSM_DOOR_c, -}; - -/* 80CD96B0-80CD96E0 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_SM_DOOR */ -extern actor_process_profile_definition g_profile_Obj_SM_DOOR = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_Obj_SM_DOOR, // mProcName - &g_fpcLf_Method.mBase, // sub_method - sizeof(daObjSM_DOOR_c), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 476, // mPriority - &l_daObjSM_DOOR_Method, // sub_method - 0x00044100, // mStatus - fopAc_ACTOR_e, // mActorType - fopAc_CULLBOX_CUSTOM_e, // cullType -}; - -/* 80CD96E0-80CD9704 000054 0024+00 2/2 0/0 0/0 .data __vt__12dBgS_ObjAcch */ -SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_ObjAcchFv, - (void*)NULL, - (void*)NULL, - (void*)func_80CD9580, - (void*)NULL, - (void*)NULL, - (void*)func_80CD9578, -}; - -/* 80CD9704-80CD972C 000078 0028+00 1/1 0/0 0/0 .data __vt__14daObjSM_DOOR_c */ -SECTION_DATA extern void* __vt__14daObjSM_DOOR_c[10] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)CreateHeap__14daObjSM_DOOR_cFv, - (void*)Create__14daObjSM_DOOR_cFv, - (void*)Execute__14daObjSM_DOOR_cFPPA3_A4_f, - (void*)Draw__14daObjSM_DOOR_cFv, - (void*)Delete__14daObjSM_DOOR_cFv, - (void*)IsDelete__16dBgS_MoveBgActorFv, - (void*)ToFore__16dBgS_MoveBgActorFv, - (void*)ToBack__16dBgS_MoveBgActorFv, -}; - /* 80CD8D4C-80CD902C 00080C 02E0+00 1/1 0/0 0/0 .text create__14daObjSM_DOOR_cFv */ -void daObjSM_DOOR_c::create() { - // NONMATCHING -} - -/* 80CD902C-80CD909C 000AEC 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING +cPhs__Step daObjSM_DOOR_c::create() { + fopAcM_SetupActor(this, daObjSM_DOOR_c); + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(&mPhase, l_arcName); + + if (step == cPhs_COMPLEATE_e) { + gravity = -9.0f; + mActive = true; + mType = fopAcM_GetParam(this) & 0xF; + mSwType = (fopAcM_GetParam(this) >> 4) & 0xF; + mUseAlphaModel = false; + + int dzb_id; + if (mType == 0) { + mType = 0; + dzb_id = dComIfG_getObjctResName2Index(l_arcName, "A_SM_DoorA.dzb"); + } else if (mType == 1) { + mType = 1; + dzb_id = dComIfG_getObjctResName2Index(l_arcName, "A_SM_DoorBl.dzb"); + } else if (mType == 2) { + mType = 2; + dzb_id = dComIfG_getObjctResName2Index(l_arcName, "A_SM_DoorWo.dzb"); + } else { + mType = 0; + dzb_id = dComIfG_getObjctResName2Index(l_arcName, "A_SM_DoorA.dzb"); + } + + mSwBit = fopAcM_GetParam(this) >> 8; + + step = (cPhs__Step)MoveBGCreate(l_arcName, dzb_id, dBgS_MoveBGProc_TypicalRotY, + 0x1F20, NULL); + if (step == cPhs_ERROR_e) { + return step; + } + + fopAcM_SetMtx(this, mpAlphaModel->getBaseTRMtx()); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); + mAlpha = 0xff; + cXyz pos(current.pos.x, current.pos.y + 100.0f, current.pos.z); + if (fopAcM_gc_c::gndCheck(&pos)) { + current.pos.y = fopAcM_gc_c::getGroundY(); + } + fopAcM_setCullSizeBox(this, -1000.0f, -500.0f, -1000.0f, 1000.0f, 500.0f, 1000.0f); + + daObjSM_DOOR_Execute(this); + } + + return step; } /* 80CD909C-80CD90A4 000B5C 0008+00 1/0 0/0 0/0 .text daObjSM_DOOR_IsDelete__FP14daObjSM_DOOR_c */ -static bool daObjSM_DOOR_IsDelete(daObjSM_DOOR_c* param_0) { - return true; +static int daObjSM_DOOR_IsDelete(daObjSM_DOOR_c* i_this) { + return 1; } -/* ############################################################################################## */ -/* 80CD95E4-80CD95E4 000054 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80CD961B = "A_SM_DoorA.bmd"; -SECTION_DEAD static char const* const stringBase_80CD962A = "A_SM_DoorA_Alpha.bmd"; -SECTION_DEAD static char const* const stringBase_80CD963F = "A_SM_DoorBl.bmd"; -SECTION_DEAD static char const* const stringBase_80CD964F = "A_SM_DoorBl_Alpha.bmd"; -SECTION_DEAD static char const* const stringBase_80CD9665 = "A_SM_DoorWo.bmd"; -SECTION_DEAD static char const* const stringBase_80CD9675 = "A_SM_DoorWo_Alpha.bmd"; -#pragma pop - /* 80CD90A4-80CD9258 000B64 01B4+00 1/0 0/0 0/0 .text CreateHeap__14daObjSM_DOOR_cFv */ -void daObjSM_DOOR_c::CreateHeap() { - // NONMATCHING +int daObjSM_DOOR_c::CreateHeap() { + J3DModelData* model_data; + J3DModelData* alpha_model_data; + + if (mType == 0) { + model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, "A_SM_DoorA.bmd"); + alpha_model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, "A_SM_DoorA_Alpha.bmd"); + } else if (mType == 1) { + model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, "A_SM_DoorBl.bmd"); + alpha_model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, "A_SM_DoorBl_Alpha.bmd"); + } else if (mType == 2) { + model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, "A_SM_DoorWo.bmd"); + alpha_model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, "A_SM_DoorWo_Alpha.bmd"); + } + + mpAlphaModel = mDoExt_J3DModel__create(alpha_model_data, 0x80000, 0x11000084); + if (mpAlphaModel == NULL) { + return 0; + } + + mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084); + if (mpModel == NULL) { + return 0; + } + + return 1; } /* 80CD9258-80CD929C 000D18 0044+00 1/0 0/0 0/0 .text Create__14daObjSM_DOOR_cFv */ -void daObjSM_DOOR_c::Create() { - // NONMATCHING +int daObjSM_DOOR_c::Create() { + fopAcM_setCullSizeBox(this, -1000.0f, -500.0f, -1000.0f, 1000.0f, 500.0f, 1000.0f); + return cPhs_COMPLEATE_e; } /* 80CD929C-80CD930C 000D5C 0070+00 1/0 0/0 0/0 .text Execute__14daObjSM_DOOR_cFPPA3_A4_f */ -void daObjSM_DOOR_c::Execute(f32 (**param_0)[3][4]) { - // NONMATCHING +int daObjSM_DOOR_c::Execute(Mtx** i_mtxP) { + if (mSwType == 0xF) { + DrawChk1(); + } else if (mSwType == 0) { + DrawChk2(); + } + + Action(); + *i_mtxP = &mBgMtx; + setBaseMtx(); + return 1; } /* 80CD930C-80CD9544 000DCC 0238+00 1/0 0/0 0/0 .text Draw__14daObjSM_DOOR_cFv */ -void daObjSM_DOOR_c::Draw() { - // NONMATCHING +int daObjSM_DOOR_c::Draw() { + if (mActive) { + g_env_light.settingTevStruct(0x10, ¤t.pos, &tevStr); + + if (!mUseAlphaModel) { + g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr); + dComIfGd_setListDarkBG(); + J3DModelData* model_data = mpModel->getModelData(); + for (u16 i = 0; i < model_data->getMaterialNum(); i++) { + model_data->getMaterialNodePointer(i)->getTevKColor(3)->a = mAlpha; + } + mDoExt_modelUpdateDL(mpModel); + for (u16 i = 0; i < model_data->getMaterialNum(); i++) { + model_data->getMaterialNodePointer(i)->getTevKColor(0)->a = 0xFF; + } + } else { + g_env_light.setLightTevColorType_MAJI(mpAlphaModel, &tevStr); + dComIfGd_setListDarkBG(); + J3DModelData* model_data = mpAlphaModel->getModelData(); + for (u16 i = 0; i < model_data->getMaterialNum(); i++) { + model_data->getMaterialNodePointer(i)->getTevKColor(3)->a = mAlpha; + } + mDoExt_modelUpdateDL(mpAlphaModel); + for (u16 i = 0; i < model_data->getMaterialNum(); i++) { + model_data->getMaterialNodePointer(i)->getTevKColor(0)->a = 0xFF; + } + } + + dComIfGd_setList(); + } + + return 1; } /* 80CD9544-80CD9578 001004 0034+00 1/0 0/0 0/0 .text Delete__14daObjSM_DOOR_cFv */ -void daObjSM_DOOR_c::Delete() { - // NONMATCHING -} - -/* 80CD9578-80CD9580 001038 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_80CD9578() { - // NONMATCHING +int daObjSM_DOOR_c::Delete() { + dComIfG_resDelete(&mPhase, l_arcName); + return 1; } -/* 80CD9580-80CD9588 001040 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_80CD9580() { - // NONMATCHING -} +/* 80CD9690-80CD96B0 -00001 0020+00 1/0 0/0 0/0 .data l_daObjSM_DOOR_Method */ +static actor_method_class l_daObjSM_DOOR_Method = { + (process_method_func)daObjSM_DOOR_Create, + (process_method_func)daObjSM_DOOR_Delete, + (process_method_func)daObjSM_DOOR_Execute, + (process_method_func)daObjSM_DOOR_IsDelete, + (process_method_func)daObjSM_DOOR_Draw, +}; -/* 80CD95E4-80CD95E4 000054 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 80CD96B0-80CD96E0 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_SM_DOOR */ +extern actor_process_profile_definition g_profile_Obj_SM_DOOR = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_Obj_SM_DOOR, // mProcName + &g_fpcLf_Method.mBase, // sub_method + sizeof(daObjSM_DOOR_c), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 476, // mPriority + &l_daObjSM_DOOR_Method, // sub_method + 0x00044100, // mStatus + fopAc_ACTOR_e, // mActorType + fopAc_CULLBOX_CUSTOM_e, // cullType +}; diff --git a/src/d/actor/d_a_obj_smw_stone.cpp b/src/d/actor/d_a_obj_smw_stone.cpp index a7d5bf52ba4..d5c00ed7c19 100644 --- a/src/d/actor/d_a_obj_smw_stone.cpp +++ b/src/d/actor/d_a_obj_smw_stone.cpp @@ -1,295 +1,234 @@ /** * @file d_a_obj_smw_stone.cpp - * + * Object - Sacred Meadow Howling Stone */ #include "d/actor/d_a_obj_smw_stone.h" -#include "dolphin/types.h" -#include "dol2asm.h" +#include "d/actor/d_a_alink.h" +#include "d/d_bg_w.h" +#include "d/d_com_inf_game.h" - - -// -// Forward References: -// - -extern "C" static void daSmWStone_c_createHeap__FP10fopAc_ac_c(); -extern "C" void __ct__12daSmWStone_cFv(); -extern "C" void __dt__12daSmWStone_cFv(); -extern "C" void create__12daSmWStone_cFv(); -extern "C" void __dt__12dBgS_ObjAcchFv(); -extern "C" void __dt__12dBgS_AcchCirFv(); -extern "C" void execute__12daSmWStone_cFv(); -extern "C" void draw__12daSmWStone_cFv(); -extern "C" void Delete__12daSmWStone_cFv(); -extern "C" void exeModeHowl__12daSmWStone_cFv(); -extern "C" void setModelMtx__12daSmWStone_cFv(); -extern "C" void createHeap__12daSmWStone_cFv(); -extern "C" void init__12daSmWStone_cFv(); -extern "C" void chkWlfInRange__12daSmWStone_cFv(); -extern "C" static void daSmWStone_create__FP12daSmWStone_c(); -extern "C" static void daSmWStone_Delete__FP12daSmWStone_c(); -extern "C" static void daSmWStone_execute__FP12daSmWStone_c(); -extern "C" static void daSmWStone_draw__FP12daSmWStone_c(); -extern "C" static void func_80CDEEDC(); -extern "C" static void func_80CDEEE4(); -extern "C" extern char const* const d_a_obj_smw_stone__stringBase0; - -// -// External References: -// - -extern "C" void mDoMtx_YrotM__FPA4_fs(); -extern "C" void mDoExt_modelUpdateDL__FP8J3DModel(); -extern "C" void mDoExt_J3DModel__create__FP12J3DModelDataUlUl(); -extern "C" void __ct__10fopAc_ac_cFv(); -extern "C" void __dt__10fopAc_ac_cFv(); -extern "C" void fopAcM_entrySolidHeap__FP10fopAc_ac_cPFP10fopAc_ac_c_iUl(); -extern "C" void dComIfG_resLoad__FP30request_of_phase_process_classPCc(); -extern "C" void dComIfG_resDelete__FP30request_of_phase_process_classPCc(); -extern "C" void -dComIfGd_setShadow__FUlScP8J3DModelP4cXyzffffR13cBgS_PolyInfoP12dKy_tevstr_csfP9_GXTexObj(); -extern "C" void isSwitch__10dSv_info_cCFii(); -extern "C" void getRes__14dRes_control_cFPCclP11dRes_info_ci(); -extern "C" void Release__4cBgSFP9dBgW_Base(); -extern "C" void Regist__4dBgSFP9dBgW_BaseP10fopAc_ac_c(); -extern "C" void __ct__12dBgS_AcchCirFv(); -extern "C" void SetWall__12dBgS_AcchCirFff(); -extern "C" void __dt__9dBgS_AcchFv(); -extern "C" void __ct__9dBgS_AcchFv(); -extern "C" void Set__9dBgS_AcchFP4cXyzP4cXyzP10fopAc_ac_ciP12dBgS_AcchCirP4cXyzP5csXyzP5csXyz(); -extern "C" void CrrPos__9dBgS_AcchFR4dBgS(); -extern "C" void SetObj__16dBgS_PolyPassChkFv(); -extern "C" void Set__4cBgWFP6cBgD_tUlPA3_A4_f(); -extern "C" void __ct__4dBgWFv(); -extern "C" void settingTevStruct__18dScnKy_env_light_cFiP4cXyzP12dKy_tevstr_c(); -extern "C" void setLightTevColorType_MAJI__18dScnKy_env_light_cFP12J3DModelDataP12dKy_tevstr_c(); -extern "C" void __ct__13cBgS_PolyInfoFv(); -extern "C" void __dt__13cBgS_PolyInfoFv(); -extern "C" void ChkUsed__9cBgW_BgIdCFv(); -extern "C" void __dt__8cM3dGCirFv(); -extern "C" void startWindStoneSound__13Z2WolfHowlMgrFScP3Vec(); -extern "C" void* __nw__FUl(); -extern "C" void __dl__FPv(); -extern "C" void _savegpr_26(); -extern "C" void _savegpr_29(); -extern "C" void _restgpr_26(); -extern "C" void _restgpr_29(); -extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; -extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; - -// -// Declarations: -// +/* 80CDEF1C-80CDEF20 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ +static char* l_arcName = "WStoneF"; /* 80CDE518-80CDE538 000078 0020+00 1/1 0/0 0/0 .text daSmWStone_c_createHeap__FP10fopAc_ac_c */ -static void daSmWStone_c_createHeap(fopAc_ac_c* param_0) { - // NONMATCHING +static int daSmWStone_c_createHeap(fopAc_ac_c* i_this) { + return static_cast(i_this)->createHeap(); } -/* ############################################################################################## */ -/* 80CDEF14-80CDEF14 000020 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_80CDEF14 = "WStoneF"; -#pragma pop - -/* 80CDEF1C-80CDEF20 -00001 0004+00 3/3 0/0 0/0 .data l_arcName */ -SECTION_DATA static void* l_arcName = (void*)&d_a_obj_smw_stone__stringBase0; - -/* 80CDEF20-80CDEF40 -00001 0020+00 1/0 0/0 0/0 .data daSmWStone_METHODS */ -static actor_method_class daSmWStone_METHODS = { - (process_method_func)daSmWStone_create__FP12daSmWStone_c, - (process_method_func)daSmWStone_Delete__FP12daSmWStone_c, - (process_method_func)daSmWStone_execute__FP12daSmWStone_c, - 0, - (process_method_func)daSmWStone_draw__FP12daSmWStone_c, -}; - -/* 80CDEF40-80CDEF70 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_SmWStone */ -extern actor_process_profile_definition g_profile_Obj_SmWStone = { - fpcLy_CURRENT_e, // mLayerID - 7, // mListID - fpcPi_CURRENT_e, // mListPrio - PROC_Obj_SmWStone, // mProcName - &g_fpcLf_Method.mBase, // sub_method - sizeof(daSmWStone_c), // mSize - 0, // mSizeOther - 0, // mParameters - &g_fopAc_Method.base, // sub_method - 735, // mPriority - &daSmWStone_METHODS, // sub_method - 0x00044100, // mStatus - fopAc_ENV_e, // mActorType - fopAc_CULLBOX_0_e, // cullType -}; - -/* 80CDEF70-80CDEF7C 000054 000C+00 2/2 0/0 0/0 .data __vt__12dBgS_AcchCir */ -SECTION_DATA extern void* __vt__12dBgS_AcchCir[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_AcchCirFv, -}; - -/* 80CDEF7C-80CDEFA0 000060 0024+00 2/2 0/0 0/0 .data __vt__12dBgS_ObjAcch */ -SECTION_DATA extern void* __vt__12dBgS_ObjAcch[9] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12dBgS_ObjAcchFv, - (void*)NULL, - (void*)NULL, - (void*)func_80CDEEE4, - (void*)NULL, - (void*)NULL, - (void*)func_80CDEEDC, -}; - -/* 80CDEFA0-80CDEFAC 000084 000C+00 2/2 0/0 0/0 .data __vt__12daSmWStone_c */ -SECTION_DATA extern void* __vt__12daSmWStone_c[3] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)__dt__12daSmWStone_cFv, -}; - /* 80CDE538-80CDE588 000098 0050+00 2/2 0/0 0/0 .text __ct__12daSmWStone_cFv */ daSmWStone_c::daSmWStone_c() { - // NONMATCHING + mpBgW = NULL; + mMode = 0; } /* 80CDE588-80CDE614 0000E8 008C+00 1/0 0/0 0/0 .text __dt__12daSmWStone_cFv */ daSmWStone_c::~daSmWStone_c() { - // NONMATCHING + dComIfG_resDelete(this, l_arcName); } -/* ############################################################################################## */ /* 80CDEEF4-80CDEF00 000000 000C+00 1/1 0/0 0/0 .rodata @3776 */ -SECTION_RODATA static u8 const lit_3776[12] = { +static u8 const lit_3776[12] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -COMPILER_STRIP_GATE(0x80CDEEF4, &lit_3776); -/* 80CDEF00-80CDEF04 00000C 0004+00 1/2 0/0 0/0 .rodata @4191 */ -SECTION_RODATA static u8 const lit_4191[4] = { - 0x00, - 0x00, - 0x00, - 0x00, -}; -COMPILER_STRIP_GATE(0x80CDEF00, &lit_4191); +/* 80CDE614-80CDE7F8 000174 01E4+00 1/1 0/0 0/0 .text create__12daSmWStone_cFv */ +cPhs__Step daSmWStone_c::create() { + fopAcM_SetupActor(this, daSmWStone_c); + cPhs__Step step = (cPhs__Step)dComIfG_resLoad(this, l_arcName); -/* 80CDEF04-80CDEF08 000010 0004+00 1/1 0/0 0/0 .rodata @4192 */ -SECTION_RODATA static f32 const lit_4192 = 10.0f; -COMPILER_STRIP_GATE(0x80CDEF04, &lit_4192); + if (step == cPhs_COMPLEATE_e) { + if (!fopAcM_entrySolidHeap(this, daSmWStone_c_createHeap, 0x1000)) { + return cPhs_ERROR_e; + } -/* 80CDE614-80CDE7F8 000174 01E4+00 1/1 0/0 0/0 .text create__12daSmWStone_cFv */ -void daSmWStone_c::create() { - // NONMATCHING -} + if (dComIfG_Bgsp().Regist(mpBgW, this)) { + return cPhs_ERROR_e; + } -/* 80CDE7F8-80CDE868 000358 0070+00 3/2 0/0 0/0 .text __dt__12dBgS_ObjAcchFv */ -// dBgS_ObjAcch::~dBgS_ObjAcch() { -extern "C" void __dt__12dBgS_ObjAcchFv() { - // NONMATCHING -} + init(); + setModelMtx(); + fopAcM_SetMtx(this, mpModel->getBaseTRMtx()); -/* 80CDE868-80CDE8D8 0003C8 0070+00 1/0 0/0 0/0 .text __dt__12dBgS_AcchCirFv */ -// dBgS_AcchCir::~dBgS_AcchCir() { -extern "C" void __dt__12dBgS_AcchCirFv() { - // NONMATCHING -} + dBgS_AcchCir acch_cir; + dBgS_ObjAcch acch; + acch_cir.SetWall(0.0f, 10.0f); + acch.Set(fopAcM_GetPosition_p(this), fopAcM_GetOldPosition_p(this), this, 1, + &acch_cir, fopAcM_GetSpeed_p(this), NULL, NULL); + acch.CrrPos(dComIfG_Bgsp()); + mGroundH = acch.GetGroundH(); + mPolyInfo = acch.m_gnd; + } -/* 80CDE8D8-80CDE92C 000438 0054+00 1/1 0/0 0/0 .text execute__12daSmWStone_cFv */ -void daSmWStone_c::execute() { - // NONMATCHING + return step; } -/* ############################################################################################## */ -/* 80CDEF08-80CDEF0C 000014 0004+00 0/1 0/0 0/0 .rodata @4238 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4238 = 500.0f; -COMPILER_STRIP_GATE(0x80CDEF08, &lit_4238); -#pragma pop +/* 80CDE8D8-80CDE92C 000438 0054+00 1/1 0/0 0/0 .text execute__12daSmWStone_cFv */ +int daSmWStone_c::execute() { + switch (mMode) { + case 0: + exeModeHowl(); + // fallthrough + case 1: + default: + setModelMtx(); + break; + } -/* 80CDEF0C-80CDEF10 000018 0004+00 0/1 0/0 0/0 .rodata @4239 */ -#pragma push -#pragma force_active on -SECTION_RODATA static f32 const lit_4239 = 1.0f; -COMPILER_STRIP_GATE(0x80CDEF0C, &lit_4239); -#pragma pop + return 1; +} /* 80CDE92C-80CDEA2C 00048C 0100+00 1/1 0/0 0/0 .text draw__12daSmWStone_cFv */ -void daSmWStone_c::draw() { - // NONMATCHING +int daSmWStone_c::draw() { + g_env_light.settingTevStruct(8, ¤t.pos, &tevStr); + g_env_light.setLightTevColorType_MAJI(mpModel, &tevStr); + dComIfGd_setListBG(); + mDoExt_modelUpdateDL(mpModel); + dComIfGd_setList(); + cXyz pos(current.pos.x, current.pos.y, current.pos.z); + mShadowKey = dComIfGd_setShadow(mShadowKey, 1, mpModel, &pos, 500.0f, 0.0f, pos.y, + mGroundH, mPolyInfo, &tevStr, 0, 1.0f, + dDlst_shadowControl_c::getSimpleTex()); + return 1; } /* 80CDEA2C-80CDEAA4 00058C 0078+00 1/1 0/0 0/0 .text Delete__12daSmWStone_cFv */ -void daSmWStone_c::Delete() { - // NONMATCHING +int daSmWStone_c::Delete() { + attention_info.flags = 0; + if (mpBgW != NULL && mpBgW->ChkUsed()) { + dComIfG_Bgsp().Release(mpBgW); + } + this->~daSmWStone_c(); + return 1; } /* 80CDEAA4-80CDEBA0 000604 00FC+00 1/1 0/0 0/0 .text exeModeHowl__12daSmWStone_cFv */ void daSmWStone_c::exeModeHowl() { - // NONMATCHING + u8 swbit; + if (mDelete || (swbit = getSwBit0(), fopAcM_isSwitch(this, swbit))) { + attention_info.flags = 0; + mMode = 1; + } else { + if (!dComIfGp_event_runCheck()) { + daAlink_getAlinkActorClass()->startWindStoneSound(2, ¤t.pos); + } + attention_info.flags = 0; + if (chkWlfInRange()) { + attention_info.flags |= 0x80; + attention_info.distances[fopAc_attn_ETC_e] = 0x41; + daAlink_c* link = daAlink_getAlinkActorClass(); + if (link != NULL && link->checkWolfHowlSuccessAnime()) { + attention_info.flags = 0; + mMode = 1; + } + } + } } /* 80CDEBA0-80CDEC04 000700 0064+00 2/2 0/0 0/0 .text setModelMtx__12daSmWStone_cFv */ void daSmWStone_c::setModelMtx() { - // NONMATCHING + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::YrotM(shape_angle.y); + mpModel->setBaseTRMtx(mDoMtx_stack_c::get()); } /* 80CDEC04-80CDED30 000764 012C+00 1/1 0/0 0/0 .text createHeap__12daSmWStone_cFv */ -void daSmWStone_c::createHeap() { - // NONMATCHING +int daSmWStone_c::createHeap() { + J3DModelData* model_data = (J3DModelData*)dComIfG_getObjectRes(l_arcName, 4); + mpModel = mDoExt_J3DModel__create(model_data, 0x80000, 0x11000084); + if (mpModel == NULL) { + return 0; + } + + mpBgW = new dBgW(); + if (mpBgW == NULL) { + return 0; + } + mDoMtx_stack_c::transS(current.pos.x, current.pos.y, current.pos.z); + mDoMtx_stack_c::YrotM(shape_angle.y); + MTXCopy(mDoMtx_stack_c::get(), mBgMtx); + cBgD_t* dzb = (cBgD_t*)dComIfG_getObjectRes(l_arcName, 7); + if (mpBgW->Set(dzb, 1, &mBgMtx) == 1) { + return 0; + } + + return 1; } /* 80CDED30-80CDED9C 000890 006C+00 1/1 0/0 0/0 .text init__12daSmWStone_cFv */ void daSmWStone_c::init() { - // NONMATCHING + u8 swbit = getSwBit0(); + if (fopAcM_isSwitch(this, swbit)) { + mMode = 1; + } else { + mMode = 0; + } + mDelete = false; + mShadowKey = 0; } -/* ############################################################################################## */ -/* 80CDEF10-80CDEF14 00001C 0004+00 1/1 0/0 0/0 .rodata @4350 */ -SECTION_RODATA static f32 const lit_4350 = 40000.0f; -COMPILER_STRIP_GATE(0x80CDEF10, &lit_4350); - /* 80CDED9C-80CDEE28 0008FC 008C+00 1/1 0/0 0/0 .text chkWlfInRange__12daSmWStone_cFv */ -void daSmWStone_c::chkWlfInRange() { - // NONMATCHING +bool daSmWStone_c::chkWlfInRange() { + fopAc_ac_c* player = dComIfGp_getPlayer(0); + if (player == NULL) { + return false; + } + if (daPy_py_c::i_checkNowWolf()) { + cXyz pos = player->current.pos; + if (pos.abs2(current.pos) < 40000.0f) { + return true; + } + } + return false; } /* 80CDEE28-80CDEE7C 000988 0054+00 1/0 0/0 0/0 .text daSmWStone_create__FP12daSmWStone_c */ -static void daSmWStone_create(daSmWStone_c* param_0) { - // NONMATCHING +static cPhs__Step daSmWStone_create(daSmWStone_c* i_this) { + fopAcM_SetupActor(i_this, daSmWStone_c); + return i_this->create(); } /* 80CDEE7C-80CDEE9C 0009DC 0020+00 1/0 0/0 0/0 .text daSmWStone_Delete__FP12daSmWStone_c */ -static void daSmWStone_Delete(daSmWStone_c* param_0) { - // NONMATCHING +static int daSmWStone_Delete(daSmWStone_c* i_this) { + return i_this->Delete(); } /* 80CDEE9C-80CDEEBC 0009FC 0020+00 1/0 0/0 0/0 .text daSmWStone_execute__FP12daSmWStone_c */ -static void daSmWStone_execute(daSmWStone_c* param_0) { - // NONMATCHING +static int daSmWStone_execute(daSmWStone_c* i_this) { + return i_this->execute(); } /* 80CDEEBC-80CDEEDC 000A1C 0020+00 1/0 0/0 0/0 .text daSmWStone_draw__FP12daSmWStone_c */ -static void daSmWStone_draw(daSmWStone_c* param_0) { - // NONMATCHING -} - -/* 80CDEEDC-80CDEEE4 000A3C 0008+00 1/0 0/0 0/0 .text @36@__dt__12dBgS_ObjAcchFv */ -static void func_80CDEEDC() { - // NONMATCHING +static int daSmWStone_draw(daSmWStone_c* i_this) { + return i_this->draw(); } -/* 80CDEEE4-80CDEEEC 000A44 0008+00 1/0 0/0 0/0 .text @20@__dt__12dBgS_ObjAcchFv */ -static void func_80CDEEE4() { - // NONMATCHING -} +/* 80CDEF20-80CDEF40 -00001 0020+00 1/0 0/0 0/0 .data daSmWStone_METHODS */ +static actor_method_class daSmWStone_METHODS = { + (process_method_func)daSmWStone_create, + (process_method_func)daSmWStone_Delete, + (process_method_func)daSmWStone_execute, + NULL, + (process_method_func)daSmWStone_draw, +}; -/* 80CDEF14-80CDEF14 000020 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ \ No newline at end of file +/* 80CDEF40-80CDEF70 -00001 0030+00 0/0 0/0 1/0 .data g_profile_Obj_SmWStone */ +extern actor_process_profile_definition g_profile_Obj_SmWStone = { + fpcLy_CURRENT_e, // mLayerID + 7, // mListID + fpcPi_CURRENT_e, // mListPrio + PROC_Obj_SmWStone, // mProcName + &g_fpcLf_Method.mBase, // sub_method + sizeof(daSmWStone_c), // mSize + 0, // mSizeOther + 0, // mParameters + &g_fopAc_Method.base, // sub_method + 735, // mPriority + &daSmWStone_METHODS, // sub_method + 0x00044100, // mStatus + fopAc_ENV_e, // mActorType + fopAc_CULLBOX_0_e, // cullType +}; diff --git a/src/d/d_bg_s.cpp b/src/d/d_bg_s.cpp index 139e15393c8..6d574ba4882 100644 --- a/src/d/d_bg_s.cpp +++ b/src/d/d_bg_s.cpp @@ -70,7 +70,7 @@ bool cBgS::Regist(dBgW_Base* p_data, fpc_ProcID actor_id, void* p_actor) { } /* 80074250-800742E4 06EB90 0094+00 0/0 2/2 187/187 .text Release__4cBgSFP9dBgW_Base */ -int cBgS::Release(dBgW_Base* p_data) { +bool cBgS::Release(dBgW_Base* p_data) { if (p_data == NULL) { return 1; }