diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index e314681b6..a0d23c161 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -541,7 +541,7 @@ inline u16 calcZModeID(u8 param_0, u8 param_1, u8 param_2) { return (param_1 * 2) + (param_0 * 0x10) + param_2; } -extern J3DZModeInfo j3dZModeTable[2]; +extern J3DZModeInfo j3dZModeTable[0x20]; struct J3DZMode { J3DZMode() { mZModeID = j3dDefaultZModeID; } diff --git a/include/JSystem/J3DGraphBase/J3DMaterial.h b/include/JSystem/J3DGraphBase/J3DMaterial.h index 7ecda53ce..fbfb7f73f 100644 --- a/include/JSystem/J3DGraphBase/J3DMaterial.h +++ b/include/JSystem/J3DGraphBase/J3DMaterial.h @@ -65,6 +65,8 @@ public: J3DGXColor* getTevKColor(u32 param_0) { return mTevBlock->getTevKColor(param_0); } J3DGXColorS10* getTevColor(u32 param_0) { return mTevBlock->getTevColor(param_0); } J3DFog* getFog() { return mPEBlock->getFog(); } + J3DZMode* getZMode() { return mPEBlock->getZMode(); } + J3DBlend* getBlend() { return mPEBlock->getBlend(); } J3DTexMtx* getTexMtx(u32 idx) { return mTexGenBlock->getTexMtx(idx); } u16 getIndex() { return mIndex; } bool isDrawModeOpaTexEdge() { return (mMaterialMode & 3) == 0; } diff --git a/include/d/actor/d_a_player.h b/include/d/actor/d_a_player.h index 33a123e0f..d7d2f945c 100644 --- a/include/d/actor/d_a_player.h +++ b/include/d/actor/d_a_player.h @@ -87,6 +87,7 @@ public: daPyFlg0_UNK4 = 0x00000004, daPyFlg0_UNK10 = 0x00000010, daPyFlg0_CUT_AT_FLG = 0x00000040, + daPyFlg0_UNK100 = 0x00000100, daPyFlg0_PUSH_PULL_KEEP = 0x00000800, daPyFlg0_UNK1000 = 0x00001000, daPyFlg0_UNK4000 = 0x00004000, @@ -100,7 +101,7 @@ public: enum daPy_FLG1 { daPyFlg1_EQUIP_DRAGON_SHIELD = 0x00000001, daPyFlg1_NPC_CALL_COMMAND = 0x00000002, - daPyFlg1_UNK8 = 0x00000008, + daPyFlg1_CASUAL_CLOTHES = 0x00000008, daPyFlg1_FORCE_VOMIT_JUMP = 0x00000010, daPyFlg1_NPC_NOT_CHANGE = 0x00000040, daPyFlg1_UNK80 = 0x00000080, @@ -150,7 +151,7 @@ public: /* 0x2A0 */ u32 mNoResetFlg1; /* 0x2A4 */ u32 mResetFlg0; /* 0x2A8 */ f32 field_0x2a8; - /* 0x2AC */ u8 field_0x2AC[0x2B0 - 0x2AC]; + /* 0x2AC */ f32 field_0x2ac; /* 0x2B0 */ f32 field_0x2b0; /* 0x2B4 */ csXyz mBodyAngle; /* 0x2BA */ u8 field_0x2BA[0x2BC - 0x2BA]; diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index b00c25131..02adb6077 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -16,7 +16,8 @@ class daPy_anmHeap_c { public: /* 0x0 */ u16 mIdx; /* 0x2 */ u16 field_0x2; - /* 0x4 */ u32 field_0x4; + /* 0x4 */ u16 field_0x4; + /* 0x6 */ u16 field_0x6; /* 0x8 */ void* m_buffer; /* 0xC */ JKRSolidHeap* mpAnimeHeap; }; @@ -37,6 +38,9 @@ public: void onLockFlg() { mLockFlag = true; } void offLockFlg() { mLockFlag = false; } void setPos(const cXyz* i_pos) { mPos = *i_pos; } + void setSightTex(void* sightTex) { mSightTex = sightTex; } + void setLockTex(void* lockTex) { mpLockTex = lockTex; } + void setImage(ResTIMG* image) { mpImg = image; } private: /* 0x04 */ bool mDrawFlag; @@ -45,8 +49,8 @@ private: /* 0x08 */ cXyz mPos; /* 0x14 */ Mtx field_0x14; /* 0x44 */ ResTIMG* mpImg; - /* 0x48 */ u8* mpData; - /* 0x4C */ void* field_0x4c; + /* 0x48 */ void* mpLockTex; + /* 0x4C */ void* mSightTex; }; class daPy_actorKeep_c { @@ -174,7 +178,7 @@ public: void draw(); ~daPy_swBlur_c() {} - /* 0x010 */ u8 field_0x010[0x014 - 0x010]; + /* 0x010 */ ResTIMG* mpBlurTex; /* 0x014 */ int field_0x014; /* 0x018 */ int field_0x018; /* 0x01C */ int mBlurColorType; @@ -1189,7 +1193,12 @@ public: DPROC_ICE_SLIP_e = 0xDA, }; - enum daPy_HEAP_TYPE {}; + enum daPy_HEAP_TYPE { + HEAP_TYPE_UNDER_UPPER_e = 0, + HEAP_TYPE_TEXTURE_ANIME_e = 1, + HEAP_TYPE_TEXTURE_SCROLL_e = 2, + HEAP_TYPE_UNK3_e = 3, + }; enum daPy_ANM {}; @@ -1220,8 +1229,8 @@ public: void checkGroupItem(int, int); void checkSetItemTrigger(int, int); void auraJointCB0(int); - void jointBeforeCB(int, J3DTransformInfo*, Quaternion*); - void jointAfterCB(int, J3DTransformInfo*, Quaternion*); + BOOL jointBeforeCB(int, J3DTransformInfo*, Quaternion*); + BOOL jointAfterCB(int, J3DTransformInfo*, Quaternion*); void jointCB0(int); void jointCB1(); void setAnimeHeap(JKRSolidHeap*); @@ -1290,7 +1299,7 @@ public: void setAnimeUnequipSword(); void setAnimeUnequipItem(u16); void setAnimeUnequip(); - void checkBossGomaStage(); + BOOL checkBossGomaStage(); BOOL checkSingleItemEquipAnime() const; BOOL checkItemEquipAnime() const; BOOL checkEquipAnime() const; @@ -1467,7 +1476,7 @@ public: void setStickData(); void setBgCheckParam(); u32 setParamData(int, int, int, int); - void checkLavaFace(cXyz*, int); + BOOL checkLavaFace(cXyz*, int); void checkFallCode(); BOOL startRestartRoom(u32, int, f32, int); void checkSuccessGuard(int); @@ -2040,7 +2049,12 @@ public: s16 checkTinkleShield() const { return mTinkleShieldTimer; } void setTinkleShield(s16 time) { mTinkleShieldTimer = time; } bool checkNoDamageMode() const { return checkEquipDragonShield() || checkTinkleShield() != 0; } - + + int getStartRoomNo() { return fopAcM_GetParam(this) & 0x3F; } + int getStartMode() { return (fopAcM_GetParam(this) >> 0x0C) & 0xF; } + int getStartEvent() { return (fopAcM_GetParam(this) >> 0x18) & 0xFF; } + int getPhase() { return 0; } // TODO + virtual MtxP getLeftHandMatrix() { return mpCLModel->getAnmMtx(0x08); } // cl_LhandA joint virtual MtxP getRightHandMatrix() { return mpCLModel->getAnmMtx(0x0C); } // cl_RhandA joint virtual f32 getGroundY() { return mAcch.GetGroundH(); } @@ -2084,8 +2098,8 @@ public: /* 0x032C */ J3DModel* mpCLModel; /* 0x0330 */ J3DModel* mpKatsuraModel; /* 0x0334 */ J3DModel* mpYamuModel; - /* 0x0338 */ ResTIMG* m0338; - /* 0x033C */ ResTIMG m033C; + /* 0x0338 */ ResTIMG* mpCurrLinktex; + /* 0x033C */ ResTIMG mOtherLinktex; /* 0x035C */ J3DAnmTexPattern* m035C; /* 0x0360 */ J3DTexNoAnm* mpTexNoAnm; /* 0x0364 */ J3DAnmTextureSRTKey* mpTexScrollResData; @@ -2186,16 +2200,16 @@ public: /* 0x31AC */ fopAc_ac_c* mpAttnActorY; /* 0x31B0 */ fopAc_ac_c* mpAttnActorZ; /* 0x31B4 */ mDoExt_MtxCalcOldFrame* m_old_fdata; - /* 0x31B8 */ s16 mTexAnimeResIdx; - /* 0x31BA */ s16 m31BA; - /* 0x31BC */ s16 m31BC; + /* 0x31B8 */ u16 mTexAnimeResIdx; + /* 0x31BA */ u16 m31BA; + /* 0x31BC */ u16 m31BC; /* 0x31BE */ u16 m31BE; /* 0x31C0 */ void* mpTextureAnimeResData; /* 0x31C4 */ JKRSolidHeap* mpTextureAnimeResHeap; /* 0x31C8 */ u16 mTexScrollResIdx; - /* 0x31CA */ s16 m31CA; - /* 0x31CC */ s16 m31CC; - /* 0x31CE */ s16 m31CE; + /* 0x31CA */ u16 m31CA; + /* 0x31CC */ u16 m31CC; + /* 0x31CE */ u16 m31CE; /* 0x31D0 */ void* mpTextureScrollResData; /* 0x31D4 */ JKRSolidHeap* mpTextureScrollResHeap; /* 0x31D8 */ int mCurProcID; @@ -2228,7 +2242,7 @@ public: /* 0x348C */ dAttList_c* mpAttnEntryY; /* 0x3490 */ dAttList_c* mpAttnEntryZ; /* 0x3494 */ char* m3494; - /* 0x3498 */ LIGHT_INFLUENCE m3498; + /* 0x3498 */ LIGHT_INFLUENCE mLightInfluence; /* 0x34B8 */ u8 m34B8; /* 0x34B9 */ u8 mFrontWallType; /* 0x34BA */ u8 m34BA; @@ -2313,7 +2327,8 @@ public: /* 0x3548 */ u8 m3548[0x354C - 0x3548]; /* 0x354C */ s16 m354C; /* 0x354E */ s16 mTinkleShieldTimer; - /* 0x3550 */ u8 m3550[0x3554 - 0x3550]; + /* 0x3550 */ u8 m3550[0x3552 - 0x3550]; + /* 0x3552 */ u16 mKeepItemType; /* 0x3554 */ s16 m3554; /* 0x3556 */ u8 m3556[0x355E - 0x3556]; /* 0x355E */ u16 m355E; @@ -2331,7 +2346,7 @@ public: /* 0x3584 */ int mCurrentGroundAttributeCode; /* 0x3588 */ u8 m3588[0x358C - 0x3588]; /* 0x358C */ int mStaffIdx; - /* 0x3590 */ int m3590; + /* 0x3590 */ int mEventIdx; /* 0x3594 */ int m3594; /* 0x3598 */ f32 m3598; /* 0x359C */ u8 m359C[0x35A0 - 0x359C]; @@ -2344,7 +2359,7 @@ public: /* 0x35C8 */ f32 m35C8; /* 0x35CC */ u8 m35CC[0x35D0 - 0x35CC]; /* 0x35D0 */ f32 m35D0; - /* 0x35D4 */ u8 m35D4[0x35D8 - 0x35D4]; + /* 0x35D4 */ f32 m35D4; /* 0x35D8 */ f32 m35D8; /* 0x35DC */ u8 m35DC[0x35E4 - 0x35DC]; /* 0x35E4 */ f32 m35E4; @@ -2365,13 +2380,15 @@ public: /* 0x3620 */ u32 m3620; /* 0x3624 */ int m3624; /* 0x3628 */ int m3628; - /* 0x362C */ u8 m362C[0x3630 - 0x362C]; + /* 0x362C */ int m362C; /* 0x3630 */ int m3630; /* 0x3634 */ int m3634; /* 0x3638 */ int mMsgId; /* 0x363C */ u8 m363C[0x3644 - 0x363C]; /* 0x3644 */ f32 m3644; - /* 0x3648 */ u8 m3648[0x3668 - 0x3648]; + /* 0x3648 */ u8 m3648[0x3654 - 0x3648]; + /* 0x3654 */ f32 m3654; + /* 0x3658 */ u8 m3658[0x3668 - 0x3658]; /* 0x3668 */ J3DTransformInfo m3668; /* 0x3688 */ cXyz m3688; /* 0x3694 */ cXyz mOldSpeed; @@ -2394,14 +2411,14 @@ public: /* 0x37E4 */ daPy_swBlur_c mSwBlur; /* 0x3DB8 */ daPy_footData_c mFootData[2]; /* 0x3FE8 */ dCcD_Stts mStts; - /* 0x4024 */ dCcD_Cyl m4024; - /* 0x4154 */ dCcD_Cyl m4154; - /* 0x4284 */ dCcD_Cyl m4284; - /* 0x43B4 */ dCcD_Cyl m43B4; - /* 0x44E4 */ dCcD_Cps m44E4[3]; - /* 0x488C */ dCcD_Cps m488C; - /* 0x49C4 */ dCcD_Sph m49C4; - /* 0x4AF0 */ dCcD_Cps m4AF0; + /* 0x4024 */ dCcD_Cyl mCyl; + /* 0x4154 */ dCcD_Cyl mWindCyl1; + /* 0x4284 */ dCcD_Cyl mAtCyl; + /* 0x43B4 */ dCcD_Cyl mWindCyl2; + /* 0x44E4 */ dCcD_Cps mAtCps[3]; + /* 0x488C */ dCcD_Cps mFanWindCps1; + /* 0x49C4 */ dCcD_Sph mFanWindSph; + /* 0x4AF0 */ dCcD_Cps mFanWindCps2; struct ProcInitTableEntry { /* 0x00 */ daPy_ProcFunc mProcFunc; diff --git a/include/d/d_bg_s_acch.h b/include/d/d_bg_s_acch.h index 63e772633..029665354 100644 --- a/include/d/d_bg_s_acch.h +++ b/include/d/d_bg_s_acch.h @@ -155,11 +155,13 @@ public: const u32 MaskWaterHit() { return m_flags & WATER_HIT; } const bool ChkWaterHit() { return MaskWaterHit(); } void ClrWaterNone() { m_flags &= ~WATER_NONE; } + void SetWaterCheckOffset(f32 offset) { m_water_check_offset = offset; } void OnLineCheck() { m_flags |= LINE_CHECK; } void ClrRoofNone() { m_flags &= ~ROOF_NONE; } void SetRoofCrrHeight(f32 height) { m_roof_crr_height = height; } void SetGrndNone() { m_flags |= GRND_NONE; } void ClrGrndNone() { m_flags &= ~GRND_NONE; } + void SetGroundCheckOffset(f32 offset) { m_ground_check_offset = offset; } bool ChkMoveBGOnly() const { return m_flags & MOVE_BG_ONLY; } void SetWallHit() { m_flags |= WALL_HIT; } void ClrWallNone() { m_flags &= ~WALL_NONE; } @@ -188,7 +190,7 @@ public: /* 0x08C */ f32 m_ground_up_h; /* 0x090 */ f32 m_ground_up_h_diff; /* 0x094 */ f32 m_ground_h; - /* 0x098 */ f32 field_0x98; + /* 0x098 */ f32 m_ground_check_offset; /* 0x09C */ cM3dGPla m_pla; /* 0x0B0 */ u8 field_0xb0; /* 0x0B4 */ f32 field_0xb4; @@ -196,7 +198,7 @@ public: /* 0x0BC */ f32 m_roof_y; /* 0x0C0 */ f32 m_roof_crr_height; /* 0x0C4 */ f32 m_roof_height; - /* 0x0C8 */ f32 field_0xc8; + /* 0x0C8 */ f32 m_water_check_offset; /* 0x0CC */ cBgS_PolyInfo* pm_out_poly_info; /* 0x0D0 */ f32 m_sea_height; /* 0x0D4 */ dBgS_GndChk m_gnd; diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 885bfdb5a..67af9b24f 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -906,6 +906,10 @@ inline s16 dComIfGs_getRestartOptionAngleY() { return g_dComIfG_gameInfo.save.getRestart().getRestartOptionAngleY(); } +inline u32 dComIfGs_getLastSceneMode() { + return g_dComIfG_gameInfo.save.getRestart().getLastMode(); +} + inline void dComIfGs_setRestartOption(s8 i_option) { g_dComIfG_gameInfo.save.getRestart().setRestartOption(i_option); } @@ -2034,6 +2038,10 @@ inline void dComIfGp_evmng_setGoal(cXyz* pos) { dComIfGp_getPEvtManager()->setGoal(pos); } +inline int dComIfGp_evmng_startDemo(int eventInfoIdx) { + return dComIfGp_getPEvtManager()->setStartDemo(eventInfoIdx); +} + /** * === DRAWLIST === */ diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h index 58dd205f0..e65b82b44 100644 --- a/include/d/d_event_manager.h +++ b/include/d/d_event_manager.h @@ -10,6 +10,7 @@ class fopAc_ac_c; class dEvent_exception_c { public: dEvent_exception_c() { mEventInfoIdx = -1; } + int setStartDemo(int eventInfoIdx); /* 0x0 */ s32 mEventInfoIdx; /* 0x4 */ u8 field_0x4; @@ -65,6 +66,8 @@ public: void CancelPresent(); void checkStartDemo(); + int setStartDemo(int eventInfoIdx) { return mException.setStartDemo(eventInfoIdx); } + /* 0x000 */ dEvDtBase_c mList; /* 0x020 */ int mCameraPlay; /* 0x024 */ dEvent_exception_c mException; diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index 702c74ce6..632a141be 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -288,23 +288,25 @@ struct mDoExt_MtxCalcAnmBlendTbl : public J3DMtxCalcMaya { }; struct mDoExt_MtxCalcAnmBlendTblOld : public mDoExt_MtxCalcAnmBlendTbl { + typedef int (*CalcCallback)(u32, u16, J3DTransformInfo*, Quaternion*); + mDoExt_MtxCalcAnmBlendTblOld(mDoExt_MtxCalcOldFrame* oldFrame, int num, mDoExt_AnmRatioPack* anmRatio) : mDoExt_MtxCalcAnmBlendTbl(num, anmRatio) { mOldFrame = oldFrame; mBeforeCallback = NULL; mAfterCallback = NULL; - field_0x58 = 0; + mUserArea = 0; } virtual ~mDoExt_MtxCalcAnmBlendTblOld(); virtual void calc(u16); - void setAfterCalc(int (*)(u32, u16, J3DTransformInfo*, Quaternion*)); - void setBeforeCalc(int (*)(u32, u16, J3DTransformInfo*, Quaternion*)); - void setUserArea(u32); + void setUserArea(u32 area) { mUserArea = area; } + void setBeforeCalc(CalcCallback callback) { mBeforeCallback = callback; } + void setAfterCalc(CalcCallback callback) { mAfterCallback = callback; } - /* 0x58 */ u32 field_0x58; + /* 0x58 */ u32 mUserArea; /* 0x5C */ mDoExt_MtxCalcOldFrame* mOldFrame; - /* 0x60 */ void (*mBeforeCallback)(u32, u16, J3DTransformInfo*, Quaternion*); - /* 0x64 */ void (*mAfterCallback)(u32, u16, J3DTransformInfo*, Quaternion*); + /* 0x60 */ CalcCallback mBeforeCallback; + /* 0x64 */ CalcCallback mAfterCallback; }; // Size: 0x90 class mDoExt_McaMorfCallBack1_c { diff --git a/src/SSystem/SComponent/c_bg_s.cpp b/src/SSystem/SComponent/c_bg_s.cpp index f3063b024..7c68320e9 100644 --- a/src/SSystem/SComponent/c_bg_s.cpp +++ b/src/SSystem/SComponent/c_bg_s.cpp @@ -126,15 +126,19 @@ void* cBgS::ConvDzb(void* work) { JUT_ASSERT(0x219, ((int)pbgd->m_ti_tbl % 4) == 0); if (pbgd->m_v_tbl != NULL) - pbgd->m_v_tbl = (cBgD_Vtx_t*)((u32)pbgd + (u32)pbgd->m_v_tbl); - pbgd->m_t_tbl = (cBgD_Tri_t*)((u32)pbgd + (u32)pbgd->m_t_tbl); - pbgd->m_b_tbl = (cBgD_Blk_t*)((u32)pbgd + (u32)pbgd->m_b_tbl); - pbgd->m_tree_tbl = (void*)((u32)pbgd + (u32)pbgd->m_tree_tbl); - pbgd->m_g_tbl = (cBgD_Grp_t*)((u32)pbgd + (u32)pbgd->m_g_tbl); - pbgd->m_ti_tbl = (void*)((u32)pbgd + (u32)pbgd->m_ti_tbl); + pbgd->m_v_tbl = (cBgD_Vtx_t*)((u32)pbgd->m_v_tbl + (u32)pbgd); - for (s32 i = 0; i < pbgd->m_g_num; i++) + pbgd->m_t_tbl = (cBgD_Tri_t*)((u32)pbgd->m_t_tbl + (u32)pbgd); + pbgd->m_b_tbl = (cBgD_Blk_t*)((u32)pbgd->m_b_tbl + (u32)pbgd); + pbgd->m_tree_tbl = (void*)((u32)pbgd->m_tree_tbl + (u32)pbgd); + pbgd->m_g_tbl = (cBgD_Grp_t*)((u32)pbgd->m_g_tbl + (u32)pbgd); + pbgd->m_ti_tbl = (void*)((u32)pbgd->m_ti_tbl + (u32)pbgd); + + for (s32 i = 0; i < pbgd->m_g_num; i++) { pbgd->m_g_tbl[i].m_name = (char*)((u32)pbgd + (u32)pbgd->m_g_tbl[i].m_name); + } + + return pbgd; } /* 80246C98-80246D24 .text GetActorPointer__4cBgSCFi */ diff --git a/src/d/actor/d_a_player_HIO.inc b/src/d/actor/d_a_player_HIO.inc index 9173b2ab0..78145bce3 100644 --- a/src/d/actor/d_a_player_HIO.inc +++ b/src/d/actor/d_a_player_HIO.inc @@ -2036,3 +2036,48 @@ public: const daPy_HIO_warp_c1 daPy_HIO_warp_c0::m = { 53, 12, 28, 4, 1.2f, 1.6f, 0.5f, 0.1f, 1.35f, }; + +class daPy_HIO_battle_c1 { +public: + /* 0x00 */ f32 field_0x0; + /* 0x04 */ f32 field_0x4; +}; + +class daPy_HIO_battle_c0 { +public: + static daPy_HIO_battle_c1 const m; +}; + +const daPy_HIO_battle_c1 daPy_HIO_battle_c0::m = { + 0.0f, 1.5f, +}; + +class daPy_HIO_dam_c1 { +public: + /* 0x00 */ s16 field_0x0; + /* 0x02 */ s16 field_0x2; +}; + +class daPy_HIO_dam_c0 { +public: + static daPy_HIO_dam_c1 const m; +}; + +const daPy_HIO_dam_c1 daPy_HIO_dam_c0::m = { + 30, 20, +}; + +class daPy_HIO_magicShield_c1 { +public: + /* 0x00 */ s16 field_0x0; + /* 0x02 */ s16 field_0x2; +}; + +class daPy_HIO_magicShield_c0 { +public: + static daPy_HIO_magicShield_c1 const m; +}; + +const daPy_HIO_magicShield_c1 daPy_HIO_magicShield_c0::m = { + 60, 0, +}; diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 4b5541d1f..8a756c72c 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -21,8 +21,196 @@ #include "d/actor/d_a_player_HIO.inc" +// Needed for the .data section to match. +static f32 dummy1[3] = {1.0f, 1.0f, 1.0f}; +static f32 dummy2[3] = {1.0f, 1.0f, 1.0f}; + char l_arcName[] = "Link"; +char l_tact_event_label[] = "OPTION_CHAR_START"; +char l_tact_night_event_label[] = "TIMEWARP"; +char l_tact_wind_change_event_label[] = "TACT_WINDOW2"; +char l_tact_wind_change_event_label2[] = "TACT_WINDOW2_SHIP"; + +static dCcD_SrcCyl l_cyl_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ 0, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0, + /* SrcObjTg Type */ ~(AT_TYPE_WATER | AT_TYPE_UNK20000 | AT_TYPE_LEAF_WIND | AT_TYPE_UNK400000 | AT_TYPE_LIGHT), + /* SrcObjTg SPrm */ 0x05, + /* SrcObjCo SPrm */ 0x73, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0x25, + /* SrcGObjTg HitMark */ 0x0C, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCylS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 30.0f, + /* Height */ 125.0f, + }, +}; + +static dCcD_SrcCyl l_wind_cyl_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ 0, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0, + /* SrcObjTg Type */ AT_TYPE_LEAF_WIND, + /* SrcObjTg SPrm */ 0x05, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0x02, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCylS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 30.0f, + /* Height */ 125.0f, + }, +}; + +static dCcD_SrcCyl l_at_cyl_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_SWORD, + /* SrcObjAt Atp */ 0x02, + /* SrcObjAt SPrm */ 0x0B, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ 0, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0x0F, + /* SrcGObjAt Spl */ 0x01, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCylS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 180.0f, + /* Height */ 75.0f, + }, +}; + +static dCcD_SrcCps l_at_cps_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_SWORD, + /* SrcObjAt Atp */ 0x01, + /* SrcObjAt SPrm */ 0x0B, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ 0, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0x01, + /* SrcGObjAt HitMark */ 0x0D, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCpsS + { + /* Start */ 0.0f, 0.0f, 0.0f, + /* End */ 0.0f, 0.0f, 0.0f, + /* Radius */ 20.0f, + }, +}; + +static dCcD_SrcCps l_fan_wind_cps_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_LEAF_WIND, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0x0B, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ 0, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0x02, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGCpsS + { + /* Start */ 0.0f, 0.0f, 0.0f, + /* End */ 0.0f, 0.0f, 0.0f, + /* Radius */ 70.0f, + }, +}; + +static dCcD_SrcSph l_fan_wind_sph_src = { + // dCcD_SrcGObjInf + { + /* Flags */ 0, + /* SrcObjAt Type */ AT_TYPE_LEAF_WIND, + /* SrcObjAt Atp */ 0, + /* SrcObjAt SPrm */ 0x0B, + /* SrcObjTg Type */ 0, + /* SrcObjTg SPrm */ 0, + /* SrcObjCo SPrm */ 0, + /* SrcGObjAt Se */ 0, + /* SrcGObjAt HitMark */ 0, + /* SrcGObjAt Spl */ 0, + /* SrcGObjAt Mtrl */ 0, + /* SrcGObjAt GFlag */ 0, + /* SrcGObjTg Se */ 0, + /* SrcGObjTg HitMark */ 0, + /* SrcGObjTg Spl */ 0, + /* SrcGObjTg Mtrl */ 0, + /* SrcGObjTg GFlag */ 0, + /* SrcGObjCo GFlag */ 0, + }, + // cM3dGSphS + { + /* Center */ 0.0f, 0.0f, 0.0f, + /* Radius */ 150.0f, + }, +}; + daPy_lk_c::ProcInitTableEntry daPy_lk_c::mProcInitTable[0xDB] = { /* 0x00 */ {&daPy_lk_c::procScope, 0x00000001}, /* 0x01 */ {&daPy_lk_c::procSubjectivity, 0x20001005}, @@ -325,7 +513,7 @@ daPy_lk_c::daPy_ProcFunc daPy_lk_c::mDemoProcInitFuncTable[0x4B] = { /* 80102E8C-80102EAC .text daPy_createHeap__FP10fopAc_ac_c */ static BOOL daPy_createHeap(fopAc_ac_c* i_this) { - return ((daPy_lk_c*)i_this)->createHeap(); + return static_cast(i_this)->createHeap(); } /* 80102F64-80103074 .text calc__13daPy_matAnm_cCFP11J3DMaterial */ @@ -407,23 +595,23 @@ static BOOL daPy_auraCallback(J3DNode*, int) { } /* 80103494-80103A88 .text jointBeforeCB__9daPy_lk_cFiP16J3DTransformInfoP10Quaternion */ -void daPy_lk_c::jointBeforeCB(int, J3DTransformInfo*, Quaternion*) { +BOOL daPy_lk_c::jointBeforeCB(int, J3DTransformInfo*, Quaternion*) { /* Nonmatching */ } /* 80103A88-80103AAC .text daPy_jointBeforeCallback__FUlUsP16J3DTransformInfoP10Quaternion */ -static BOOL daPy_jointBeforeCallback(u32 i_this, u16 param_1, J3DTransformInfo* param_2, Quaternion* param_3) { - ((daPy_lk_c*)i_this)->jointBeforeCB(param_1, param_2, param_3); +static BOOL daPy_jointBeforeCallback(u32 userArea, u16 param_1, J3DTransformInfo* param_2, Quaternion* param_3) { + return reinterpret_cast(userArea)->jointBeforeCB(param_1, param_2, param_3); } /* 80103AAC-80103C1C .text jointAfterCB__9daPy_lk_cFiP16J3DTransformInfoP10Quaternion */ -void daPy_lk_c::jointAfterCB(int, J3DTransformInfo*, Quaternion*) { +BOOL daPy_lk_c::jointAfterCB(int, J3DTransformInfo*, Quaternion*) { /* Nonmatching */ } /* 80103C1C-80103C40 .text daPy_jointAfterCallback__FUlUsP16J3DTransformInfoP10Quaternion */ -static BOOL daPy_jointAfterCallback(u32 i_this, u16 param_1, J3DTransformInfo* param_2, Quaternion* param_3) { - ((daPy_lk_c*)i_this)->jointAfterCB(param_1, param_2, param_3); +static BOOL daPy_jointAfterCallback(u32 userArea, u16 param_1, J3DTransformInfo* param_2, Quaternion* param_3) { + return reinterpret_cast(userArea)->jointAfterCB(param_1, param_2, param_3); } /* 80103C40-80103EE4 .text jointCB0__9daPy_lk_cFi */ @@ -633,7 +821,7 @@ BOOL daPy_lk_c::draw() { /* 80108204-80108224 .text daPy_Draw__FP9daPy_lk_c */ static BOOL daPy_Draw(daPy_lk_c* i_this) { - return ((daPy_lk_c*)i_this)->draw(); + return static_cast(i_this)->draw(); } /* 80108224-8010841C .text setAtnList__9daPy_lk_cFv */ @@ -812,7 +1000,7 @@ void daPy_lk_c::setAnimeUnequip() { } /* 8010C430-8010C4A4 .text checkBossGomaStage__9daPy_lk_cFv */ -void daPy_lk_c::checkBossGomaStage() { +BOOL daPy_lk_c::checkBossGomaStage() { /* Nonmatching */ } @@ -842,13 +1030,37 @@ void daPy_lk_c::setFallVoice() { } /* 8010C7F4-8010C854 .text keepItemData__9daPy_lk_cFv */ +/* Saves which item the player was holding in their hand so it can be restored later. */ void daPy_lk_c::keepItemData() { - /* Nonmatching */ + mKeepItemType = mHeldItemType; + + deleteEquipItem(0); + + if (mKeepItemType == 0x101) { + mKeepItemType = 0x100; + } else if (mKeepItemType == 0x100) { + mKeepItemType = 0x10B; + } } /* 8010C854-8010C8D4 .text returnKeepItemData__9daPy_lk_cFv */ +/* Restores which item the player was holding in their hand. */ void daPy_lk_c::returnKeepItemData() { - /* Nonmatching */ + if (mKeepItemType == 0x100) { + return; + } + + deleteEquipItem(0); + mHeldItemType = mKeepItemType; + mKeepItemType = 0x100; + + if (mHeldItemType == 0x10B) { + mHeldItemType = 0x100; + } else if (mHeldItemType == 0x103) { + setSwordModel(1); + } else { + makeItemType(); + } } /* 8010C8D4-8010CB70 .text makeItemType__9daPy_lk_cFv */ @@ -1914,13 +2126,44 @@ void daPy_lk_c::setBgCheckParam() { } /* 801200F8-8012010C .text setParamData__9daPy_lk_cFiiii */ -u32 daPy_lk_c::setParamData(int roomNo, int spawnType, int evntIdx, int extraParams) { - return roomNo & 0x3F | (spawnType & 0xF) << 0xC | evntIdx << 0x18 | extraParams; +u32 daPy_lk_c::setParamData(int roomNo, int spawnType, int eventInfoIdx, int extraParams) { + return roomNo & 0x3F | (spawnType & 0xF) << 0xC | eventInfoIdx << 0x18 | extraParams; } /* 8012010C-8012024C .text checkLavaFace__9daPy_lk_cFP4cXyzi */ -void daPy_lk_c::checkLavaFace(cXyz*, int) { - /* Nonmatching */ +BOOL daPy_lk_c::checkLavaFace(cXyz* param_1, int attributeCode) { + if (mDemo.getDemoType() == 5) { + return FALSE; + } + + if (param_1) { + cXyz temp(current.pos.x, param_1->y + 20.0f, current.pos.z); + m08EC.SetPos(&temp); + m35D4 = dComIfG_Bgsp()->GroundCross(&m08EC); + if (mAcch.GetGroundH() > m35D4) { + m35D4 = -1000000000.0f; + } + if (m35D4 > current.pos.y) { + attributeCode = dComIfG_Bgsp()->GetAttributeCode(m08EC); + } else { + return FALSE; + } + } + + if (attributeCode == 6) { + if (param_1) { + current.pos.y = m35D4; + } + if (checkBossGomaStage()) { + return procLavaDamage_init(); + } else { + return dProcLavaDamage_init(); + } + } else if (attributeCode == 8) { + startRestartRoom(5, 0xC9, -1.0f, 0); + } + + return FALSE; } /* 8012024C-80120724 .text checkFallCode__9daPy_lk_cFv */ @@ -1929,7 +2172,7 @@ void daPy_lk_c::checkFallCode() { } /* 80120724-80120BBC .text startRestartRoom__9daPy_lk_cFUlifi */ -BOOL daPy_lk_c::startRestartRoom(u32 param_1, int param_2, f32 param_3, int i_point) { +BOOL daPy_lk_c::startRestartRoom(u32 param_1, int eventInfoIdx, f32 param_3, int i_point) { /* Nonmatching - npc_sarace */ if (!checkNoResetFlg0(daPyFlg0_UNK4000) && (i_point != 0 || dComIfGp_event_compulsory(this, NULL, -1))) { mDemo.setOriginalDemoType(); @@ -1952,7 +2195,7 @@ BOOL daPy_lk_c::startRestartRoom(u32 param_1, int param_2, f32 param_3, int i_po if (stageType == 7 && !dComIfGs_isEventBit(0x2A08) && (current.roomNo == 11 || current.roomNo == 44) && dStage_chkPlayerId(0x80, current.roomNo)) { dComIfGp_setNextStage(dComIfGp_getStartStageName(), 0x80, current.roomNo, -1, 0.0f, param_1, 1, 0); - u32 roomParam = setParamData(-1, 0, param_2, 0); + u32 roomParam = setParamData(-1, 0, eventInfoIdx, 0); dComIfGs_setRestartRoomParam(roomParam); mDoAud_seStart(JA_SE_FORCE_BACK, NULL, 0, 0); return TRUE; @@ -2002,7 +2245,7 @@ BOOL daPy_lk_c::startRestartRoom(u32 param_1, int param_2, f32 param_3, int i_po dStage_changeScene(0, 0.0f, param_1, -1); } else { int roomNo = dComIfGs_getRestartRoomNo(); - u32 roomParam = setParamData(roomNo, 0, param_2, 0); + u32 roomParam = setParamData(roomNo, 0, eventInfoIdx, 0); dStage_restartRoom(roomParam, param_1); mDoAud_seStart(JA_SE_FORCE_BACK, NULL, 0, 0); } @@ -2015,7 +2258,7 @@ BOOL daPy_lk_c::startRestartRoom(u32 param_1, int param_2, f32 param_3, int i_po } if (mCurProcID != DPROC_DEAD_e) { - u32 roomParam = setParamData(-1, 0, param_2, 0); + u32 roomParam = setParamData(-1, 0, eventInfoIdx, 0); dComIfGs_setRestartRoomParam(roomParam); mDoAud_seStart(JA_SE_FORCE_BACK, NULL, 0, 0); } @@ -2064,7 +2307,7 @@ BOOL daPy_lk_c::execute() { /* 80122D30-80122D50 .text daPy_Execute__FP9daPy_lk_c */ static BOOL daPy_Execute(daPy_lk_c* i_this) { - return ((daPy_lk_c*)i_this)->execute(); + return static_cast(i_this)->execute(); } /* 80122D50-80122D58 .text daPy_IsDelete__FP9daPy_lk_c */ @@ -2107,11 +2350,11 @@ BOOL daPy_lk_c::playerDelete() { m3460[1].end(); endDamageEmitter(); - dKy_plight_cut(&m3498); + dKy_plight_cut(&mLightInfluence); mDoAud_seDeleteObject(&mSwordTopPos); mDoAud_seDeleteObject(&mRopePos); mDoAud_seDeleteObject(&m338C.field_0x08); - mDoAud_seDeleteObject(&m488C.GetEndP()); + mDoAud_seDeleteObject(&mFanWindCps1.GetEndP()); for (i = 0; i < (int)ARRAY_SIZE(m_anm_heap_under); i++) { mDoExt_destroySolidHeap(m_anm_heap_under[i].mpAnimeHeap); @@ -2128,8 +2371,8 @@ BOOL daPy_lk_c::playerDelete() { mJAIZelAnime.stop(); - if (checkNoResetFlg1(daPyFlg1_UNK8)) { - *m0338 = m033C; + if (checkNoResetFlg1(daPyFlg1_CASUAL_CLOTHES)) { + *mpCurrLinktex = mOtherLinktex; } dComIfGp_clearPlayerStatus0(0, 0x00400000); // Waiting for the boomerang to come back @@ -2143,7 +2386,7 @@ BOOL daPy_lk_c::playerDelete() { /* 80123058-80123078 .text daPy_Delete__FP9daPy_lk_c */ static BOOL daPy_Delete(daPy_lk_c* i_this) { - return ((daPy_lk_c*)i_this)->playerDelete(); + return static_cast(i_this)->playerDelete(); } /* 80123078-80123360 .text initTextureAnime__9daPy_lk_cFv */ @@ -2308,7 +2551,274 @@ J3DAnmTevRegKey* daPy_lk_c::entryBrk(J3DModelData*, int) { /* 80124C98-80125CC8 .text playerInit__9daPy_lk_cFv */ void daPy_lk_c::playerInit() { - /* Nonmatching */ + if (!fopAcM_entrySolidHeap(this, (heapCallbackFunc)&daPy_createHeap, 0xB0000)) { + JUT_ASSERT(0x53B6, 0); + } + + fopAcM_SetMtx(this, mpCLModel->getBaseTRMtx()); + + mpCLModel->setUserArea(reinterpret_cast(this)); + mpYmgcs00Model->setUserArea(reinterpret_cast(this)); + for (u16 i = 0; i < mpYmgcs00Model->getModelData()->getJointNum(); i++) { + mpYmgcs00Model->getModelData()->getJointNodePointer(i)->setCallBack(daPy_auraCallback); + } + + mpCLModelData->getJointNodePointer(0x01)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x0D)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x04)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x08)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x0C)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x1C)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x0F)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x00)->setCallBack(daPy_jointCallback0); + mpCLModelData->getJointNodePointer(0x28)->setCallBack(daPy_jointCallback1); + + m_pbCalc[0]->setUserArea(reinterpret_cast(this)); + m_pbCalc[0]->setBeforeCalc(daPy_jointBeforeCallback); + m_pbCalc[0]->setAfterCalc(daPy_jointAfterCallback); + m_pbCalc[1]->setUserArea(reinterpret_cast(this)); + m_pbCalc[1]->setBeforeCalc(daPy_jointBeforeCallback); + m_pbCalc[1]->setAfterCalc(daPy_jointAfterCallback); + + int i; + J3DMaterial* mat = mpCLModelData->getJointNodePointer(0x13)->getMesh(); + int zoff_blend_cnt = 0; + int zoff_none_cnt = 0; + int zon_cnt = 0; + for (i = 0; i < 2; i++) { + while (mat) { + mat->setMaterialMode(1); + if (j3dZModeTable[mat->getZMode()->mZModeID].mCompareEnable == 0) { + if (mat->getBlend()->mBlendMode == 1) { + mpZOffBlendShape[zoff_blend_cnt] = mat->getShape(); + zoff_blend_cnt++; + JUT_ASSERT(0x53EE, zoff_blend_cnt <= 4); + } else { + mpZOffNoneShape[zoff_none_cnt] = mat->getShape(); + zoff_none_cnt++; + JUT_ASSERT(0x53F2, zoff_none_cnt <= 4); + } + } else { + mpZOnShape[zon_cnt] = mat->getShape(); + zon_cnt++; + JUT_ASSERT(0x53F6, zon_cnt <= 4); + } + mat = mat->getNext(); + } + mat = mpCLModelData->getJointNodePointer(0x15)->getMesh(); + } + JUT_ASSERT(0x53FD, zon_cnt == 4); + JUT_ASSERT(0x53FE, zoff_none_cnt == 4); + JUT_ASSERT(0x53FF, zoff_blend_cnt == 4); + + m03A4 = mpCLModelData->getJointNodePointer(0x08)->getMesh()->getShape(); + m03A8 = mpCLModelData->getJointNodePointer(0x0C)->getMesh()->getShape(); + J3DModelData* handsModelData = mpHandsModel->getModelData(); + for (u16 i = 0x01; i < 0x0B; i++) { + handsModelData->getJointNodePointer(i)->getMesh()->getShape()->hide(); + } + + u32 buffer_start = reinterpret_cast(m_anm_heap_under[0].m_buffer) + 0x2400; + m_anm_heap_under[1].m_buffer = reinterpret_cast(buffer_start); + buffer_start = reinterpret_cast(m_anm_heap_under[0].m_buffer) + 0x4800; + m_anm_heap_upper[0].m_buffer = reinterpret_cast(buffer_start); + for (int i = 1; i <= 2; i++) { + buffer_start = reinterpret_cast(m_anm_heap_upper[0].m_buffer) + i*0x2400; + m_anm_heap_upper[i].m_buffer = reinterpret_cast(buffer_start); + } + + mAcch.Set(¤t.pos, &next.pos, this, ARRAY_SIZE(mAcchCir), mAcchCir, &speed, ¤t.angle, &shape_angle); + mAcch.ClrWaterNone(); + mAcch.SetWaterCheckOffset(500.0f); + mAcch.OnLineCheck(); + mAcch.ClrRoofNone(); + mAcch.SetRoofCrrHeight(125.0f); + field_0x2a8 = daPy_HIO_move_c0::m.field_0x18; + mGravity = daPy_HIO_autoJump_c0::m.field_0xC; + mMaxFallSpeed = daPy_HIO_autoJump_c0::m.field_0x10; + mAcchCir[0].SetWall(30.1f, 35.0f); + mAcchCir[1].SetWall(89.9f, 35.0f); + mAcchCir[2].SetWall(125.0f, 35.0f); + mHeadTopPos.setall(0.0f); + field_0x2ac = 125.0f; + mHeldItemType = 0x100; + mKeepItemType = 0x100; + mCameraInfoIdx = dComIfGp_getPlayerCameraID(0); + mpAttention = &dComIfGp_getAttention(); + + mStts.Init(0x78, 0xFF, this); + mCyl.Set(l_cyl_src); + mCyl.SetStts(&mStts); + mCyl.OnTgShieldFrontRange(); + mShieldFrontRangeYAngle = shape_angle.y + mBodyAngle.y; + mCyl.SetTgShieldFrontRangeYAngle(&mShieldFrontRangeYAngle); + mWindCyl1.Set(l_wind_cyl_src); + mWindCyl1.SetStts(&mStts); + mWindCyl2.Set(l_wind_cyl_src); + mWindCyl2.SetStts(&mStts); + mWindCyl2.SetTgType(AT_TYPE_LIGHT); + mAtCps[0].Set(l_at_cps_src); + mAtCps[0].SetStts(&mStts); + mAtCps[1].Set(l_at_cps_src); + mAtCps[1].SetStts(&mStts); + mAtCps[2].Set(l_at_cps_src); + mAtCps[2].SetStts(&mStts); + mAtCyl.Set(l_at_cyl_src); + mAtCyl.SetStts(&mStts); + mFanWindCps1.Set(l_fan_wind_cps_src); + mFanWindCps1.SetR(70.0f); + mFanWindCps1.SetStts(&mStts); + mFanWindSph.Set(l_fan_wind_sph_src); + mFanWindSph.SetStts(&mStts); + mFanWindCps2.Set(l_fan_wind_cps_src); + mFanWindCps2.SetStts(&mStts); + mFanWindCps2.SetAtType(AT_TYPE_LIGHT); + mFanWindCps2.SetR(20.0f); + + for (int i = 0; i < (int)ARRAY_SIZE(m_anm_heap_under); i++) { + createAnimeHeap(&m_anm_heap_under[i].mpAnimeHeap, HEAP_TYPE_UNDER_UPPER_e); + m_anm_heap_under[i].mIdx = -1; + m_anm_heap_under[i].field_0x2 = -1; + m_anm_heap_under[i].field_0x4 = -1; + } + for (int i = 0; i < (int)ARRAY_SIZE(m_anm_heap_upper); i++) { + createAnimeHeap(&m_anm_heap_upper[i].mpAnimeHeap, HEAP_TYPE_UNDER_UPPER_e); + m_anm_heap_upper[i].mIdx = -1; + m_anm_heap_upper[i].field_0x2 = -1; + m_anm_heap_upper[i].field_0x4 = -1; + } + createAnimeHeap(&mpTextureAnimeResHeap, HEAP_TYPE_TEXTURE_ANIME_e); + mTexAnimeResIdx = -1; + m31BA = -1; + m31BC = -1; + m31BE = -1; + createAnimeHeap(&mpTextureScrollResHeap, HEAP_TYPE_TEXTURE_SCROLL_e); + mTexScrollResIdx = -1; + m31CA = -1; + m31CC = -1; + m31CE = -1; + m34EE = -1; + m34F0 = -1; + + mpItemHeaps[0] = mDoExt_createSolidHeapFromGameToCurrent(0xE600, 0x20); + u8* dummy_data = new u8[0xE600]; + JUT_ASSERT(0x5493, dummy_data != 0); + mDoExt_restoreCurrentHeap(); + mDoExt_adjustSolidHeap(mpItemHeaps[0]); + + mpItemHeaps[1] = mDoExt_createSolidHeapFromGameToCurrent(0xE600, 0x20); + dummy_data = new u8[0xE600]; + JUT_ASSERT(0x5499, dummy_data != 0); + mDoExt_restoreCurrentHeap(); + mDoExt_adjustSolidHeap(mpItemHeaps[1]); + + createAnimeHeap(&m2ECC, HEAP_TYPE_UNK3_e); + + mActorKeepEquip.clearData(); + mActorKeepThrow.clearData(); + mActorKeepGrab.clearData(); + mActorKeepRope.clearData(); + m3628 = -1; + m3634 = -1; + m362C = -1; + m3630 = -1; + + ResTIMG* blur_img = (ResTIMG*)dComIfG_getObjectRes(l_arcName, LINK_BTI_BLUR); + mSwBlur.mpBlurTex = blur_img; + + current.angle.z = 0; + shape_angle.z = 0; + m3526 = 8; + m3654 = 1.0f; + resetSeAnime(); + + ResTIMG* tmp_tex = (ResTIMG*)dComIfG_getObjectRes("Always", ALWAYS_I4_BALL128B); + JUT_ASSERT(0x54B7, tmp_tex != 0); + mSightPacket.setSightTex(tmp_tex); + ResTIMG* tmp_img = (ResTIMG*)dComIfG_getObjectRes(l_arcName, LINK_BTI_ROCK_MARK); + JUT_ASSERT(0x54BD, tmp_img != 0); + void* tmp_img_data = reinterpret_cast(reinterpret_cast(tmp_img) + tmp_img->imageOffset); + mSightPacket.setLockTex(tmp_img_data); + mSightPacket.setImage(tmp_img); + + int startMode = getStartMode(); + u8 lastMode = dComIfGs_getLastSceneMode(); + if (startMode == 0xE) { + mEventIdx = dComIfGp_evmng_startDemo(0xD4); + } else if (startMode == 0xC) { + mEventIdx = dComIfGp_evmng_startDemo(0xD0); + } else if (startMode == 0x6) { + mEventIdx = dComIfGp_evmng_startDemo(0xCF); + } else if (startMode == 0xA) { + mEventIdx = dComIfGp_evmng_startDemo(0xD2); + } else if (startMode == 0xB) { + mEventIdx = dComIfGp_evmng_startDemo(0xD3); + } else if (startMode == 0x9 || lastMode == 0x6) { + mEventIdx = dComIfGp_evmng_startDemo(0xCB); + } else if (startMode == 0x2 && (lastMode == 0x4 || lastMode == 0x5)) { + mEventIdx = dComIfGp_evmng_startDemo(0xC9); + } else if (startMode == 0xF) { + mEventIdx = dComIfGp_evmng_startDemo(0xD5); + } else { + mEventIdx = dComIfGp_evmng_startDemo(getStartEvent()); + } + + onNoResetFlg0(daPyFlg0_UNK100); + m08EC.OffWaterGrp(); + mDemo.setStick(1.0f); + endDamageEmitter(); + mMirrorPacket.init(NULL); + + mLightInfluence.mColor.r = 600; + mLightInfluence.mColor.g = 400; + mLightInfluence.mColor.b = 120; + mLightInfluence.mFluctuation = 250.0f; + mLightInfluence.mPos = current.pos; + mLightInfluence.mPower = 0.0f; + dKy_plight_set(&mLightInfluence); + + m352E = 900; + field_0x298 = 0xAD; + m34DE = shape_angle.y; + + ResTIMG* linktex_casual = (ResTIMG*)dComIfG_getObjectRes(l_arcName, LINK_BTI_LINKTEXBCI4); + int num_linktex_headers_seen = 0; + J3DTexture* texture = mpCLModelData->getTexture(); + JUT_ASSERT(0x5504, texture != 0); + JUTNameTab* textureName = mpCLModelData->getTextureName(); + JUT_ASSERT(0x5506, textureName != 0); + for (u16 i = 0; i < texture->getNum(); i++) { + const char* texName = textureName->getName(i); + if (strcmp(texName, "linktexS3TC") != 0) { + continue; + } + if (num_linktex_headers_seen == 0) { + // Link's model's TEX1 section has two headers for the linktexS3TC texture. + // They seem identical except the first has alpha enabled and the second does not. + // The second is the one that is actually used, so we have to skip over the first one. + num_linktex_headers_seen += 1; + continue; + } + + mpCurrLinktex = texture->getResTIMG(i); + mOtherLinktex = *mpCurrLinktex; + + // Modify the linktexS3TC texture in Link's model to be the casual clothes texture. + texture->setResTIMG(i, *linktex_casual); + + if (!dComIfGs_isEventBit(0x2A80) || dComIfGs_getClearCount() != 0) { + onNoResetFlg1(daPyFlg1_CASUAL_CLOTHES); + } + if (checkNoResetFlg1(daPyFlg1_CASUAL_CLOTHES)) { + break; + } + + // If Link isn't wearing the casual clothes, then load the hero's clothes texture from the backup and swap them. + ResTIMG casualLinktex = *mpCurrLinktex; + *mpCurrLinktex = mOtherLinktex; + mOtherLinktex = casualLinktex; + break; + } } int phase_1(daPy_lk_c* i_this) { diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index f0c4edb3e..fbd019fd7 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -53,7 +53,7 @@ dBgS_Acch::dBgS_Acch() { pm_speed = NULL; m_ground_h = -1000000000.0f; m_ground_up_h = 0.0f; - field_0x98 = 60.0f; + m_ground_check_offset = 60.0f; m_ground_up_h_diff = 0.0f; field_0xb0 = 0; field_0xb4 = 0.0f; @@ -63,7 +63,7 @@ dBgS_Acch::dBgS_Acch() { m_roof_y = 0.0f; m_roof_crr_height = 0.0f; m_roof_height = 0.0f; - field_0xc8 = 200.0f; + m_water_check_offset = 200.0f; pm_angle = NULL; pm_shape_angle = NULL; m_my_ac = NULL; @@ -157,12 +157,12 @@ void dBgS_Acch::CrrPos(dBgS& i_bgs) { field_0xb4 = pm_pos->y; f32 oldY = pm_old_pos->y; f32 temp7 = lowH + oldY; - f32 temp8 = field_0x98 + pm_pos->y; + f32 temp8 = m_ground_check_offset + pm_pos->y; bool ranLineCheck = false; OffLineCheckHit(); if (!ChkLineCheckNone() && !cM3d_IsZero(lowH_R)) { - if (distXZ2 > lowH_R*lowH_R || temp7 > temp8 || distY > field_0x98 || ChkLineCheck()) { + if (distXZ2 > lowH_R*lowH_R || temp7 > temp8 || distY > m_ground_check_offset || ChkLineCheck()) { ranLineCheck = true; LineCheck(i_bgs); } diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 1b622b09d..1cef9e1e2 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -1096,12 +1096,12 @@ void mDoExt_MtxCalcAnmBlendTblOld::calc(u16 param_0) { } Mtx mtx; if (mBeforeCallback) { - mBeforeCallback(field_0x58, param_0, &info1, &quat3); + mBeforeCallback(mUserArea, param_0, &info1, &quat3); } mDoMtx_quat(mtx, &quat3); mDoExt_setJ3DData(mtx, &info1, param_0); if (mAfterCallback) { - mAfterCallback(field_0x58, param_0, &info1, &quat3); + mAfterCallback(mUserArea, param_0, &info1, &quat3); } *oldQuat = quat3; *oldTransInfo = info1;