diff --git a/config/D44J01/config.yml b/config/D44J01/config.yml index 6d053dba1..8053424bd 100644 --- a/config/D44J01/config.yml +++ b/config/D44J01/config.yml @@ -2771,3 +2771,32 @@ extract: - symbol: l_toonMat1DL binary: assets/l_toonMat1DL.bin header: assets/l_toonMat1DL.h + +- symbol: l_matDL$4443 + binary: assets/l_matDL__clearAlphaBuffer__FP10view_class.bin + header: assets/l_matDL__clearAlphaBuffer__FP10view_class.h + rename: l_matDL +- symbol: l_DL$4444 + binary: assets/l_DL__clearAlphaBuffer__FP10view_class.bin + header: assets/l_DL__clearAlphaBuffer__FP10view_class.h + rename: l_DL +- symbol: l_matDL$4454 + binary: assets/l_matDL__4454.bin + header: assets/l_matDL__4454.h + rename: l_matDL +- symbol: l_DL$4455 + binary: assets/l_DL__4455.bin + header: assets/l_DL__4455.h + rename: l_DL +- symbol: l_matDL$4465 + binary: assets/l_matDL__drawAlphaBuffer__FP10view_class8_GXColor.bin + header: assets/l_matDL__drawAlphaBuffer__FP10view_class8_GXColor.h + rename: l_matDL +- symbol: l_DL$4466 + binary: assets/l_DL__drawAlphaBuffer__FP10view_class8_GXColor.bin + header: assets/l_DL__drawAlphaBuffer__FP10view_class8_GXColor.h + rename: l_DL +- symbol: l_DL$4479 + binary: assets/l_DL__drawSpot__FP10view_class.bin + header: assets/l_DL__drawSpot__FP10view_class.h + rename: l_DL diff --git a/configure.py b/configure.py index 164035394..070546d7f 100755 --- a/configure.py +++ b/configure.py @@ -406,7 +406,7 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_op/f_op_scene_pause.cpp"), # f_pc - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_base.cpp"), + Object(Matching, "f_pc/f_pc_base.cpp"), Object(Matching, "f_pc/f_pc_create_iter.cpp"), Object(Matching, "f_pc/f_pc_create_req.cpp"), Object(Matching, "f_pc/f_pc_create_tag.cpp"), @@ -414,7 +414,7 @@ config.libs = [ Object(Matching, "f_pc/f_pc_delete_tag.cpp"), Object(Matching, "f_pc/f_pc_deletor.cpp"), Object(Matching, "f_pc/f_pc_draw_priority.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_executor.cpp"), + Object(Matching, "f_pc/f_pc_executor.cpp"), Object(Matching, "f_pc/f_pc_layer.cpp"), Object(Matching, "f_pc/f_pc_leaf.cpp"), Object(Matching, "f_pc/f_pc_layer_iter.cpp"), @@ -427,12 +427,12 @@ config.libs = [ Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_node_req.cpp"), Object(Matching, "f_pc/f_pc_priority.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_profile.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_searcher.cpp"), + Object(Matching, "f_pc/f_pc_searcher.cpp"), Object(Matching, "f_pc/f_pc_line_tag.cpp"), Object(Matching, "f_pc/f_pc_line_iter.cpp"), Object(Matching, "f_pc/f_pc_method_iter.cpp"), Object(Matching, "f_pc/f_pc_method_tag.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "f_pc/f_pc_pause.cpp"), + Object(Matching, "f_pc/f_pc_pause.cpp"), Object(Matching, "f_pc/f_pc_draw.cpp"), Object(Matching, "f_pc/f_pc_fstcreate_req.cpp"), Object(Matching, "f_pc/f_pc_stdcreate_req.cpp"), @@ -505,7 +505,7 @@ config.libs = [ Object(Matching, "d/d_bg_w_hf.cpp"), Object(Matching, "d/d_bg_w_sv.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_d.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_mass_s.cpp"), + Object(Matching, "d/d_cc_mass_s.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_s.cpp"), Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d/d_cc_uty.cpp"), Object(NonMatching, "d/d_cam_param.cpp"), @@ -627,8 +627,8 @@ config.libs = [ Object(Matching, "SSystem/SComponent/c_malloc.cpp"), Object(Matching, "SSystem/SComponent/c_API.cpp"), Object(Matching, "SSystem/SComponent/c_API_graphic.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_cc_d.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_cc_s.cpp"), + Object(Matching, "SSystem/SComponent/c_cc_d.cpp"), + Object(Matching, "SSystem/SComponent/c_cc_s.cpp"), Object(Matching, "SSystem/SComponent/c_counter.cpp"), Object(Matching, "SSystem/SComponent/c_list.cpp"), Object(Matching, "SSystem/SComponent/c_list_iter.cpp"), @@ -642,15 +642,15 @@ config.libs = [ Object(Matching, "SSystem/SComponent/c_tag_iter.cpp"), Object(Matching, "SSystem/SComponent/c_xyz.cpp"), Object(Matching, "SSystem/SComponent/c_sxyz.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_math.cpp"), + Object(Matching, "SSystem/SComponent/c_math.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_chk.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_gnd_chk.cpp"), Object(Matching, "SSystem/SComponent/c_bg_s_lin_chk.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_bg_w.cpp"), + Object(Matching, "SSystem/SComponent/c_bg_w.cpp"), Object(Matching, "SSystem/SComponent/c_m2d.cpp"), Object(Matching, "SSystem/SComponent/c_m2d_g_box.cpp"), - Object(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "SSystem/SComponent/c_m3d.cpp"), + Object(Matching, "SSystem/SComponent/c_m3d.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_aab.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_cyl.cpp"), Object(Matching, "SSystem/SComponent/c_m3d_g_pla.cpp"), @@ -947,7 +947,7 @@ config.libs = [ Object(Matching, "JSystem/JUtility/JUTDirectPrint.cpp"), Object(Matching, "JSystem/JUtility/JUTAssert.cpp"), Object(Matching, "JSystem/JUtility/JUTVideo.cpp"), - Object(Equivalent, "JSystem/JUtility/JUTXfb.cpp"), + Object(Equivalent, "JSystem/JUtility/JUTXfb.cpp"), # Nondeterministic compiler bug, do not link Object(Matching, "JSystem/JUtility/JUTFader.cpp"), Object(Matching, "JSystem/JUtility/JUTProcBar.cpp"), Object(Matching, "JSystem/JUtility/JUTConsole.cpp"), @@ -1370,11 +1370,11 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kui"), ActorRel(Matching, "d_a_kytag00"), ActorRel(Matching, "d_a_kytag01"), - ActorRel(NonMatching, "d_a_kytag02"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kytag03"), + ActorRel(Matching, "d_a_kytag02"), + ActorRel(Matching, "d_a_kytag03"), ActorRel(Matching, "d_a_kytag04"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kytag05"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_kytag06"), + ActorRel(Matching, "d_a_kytag05"), + ActorRel(Matching, "d_a_kytag06"), ActorRel(Matching, "d_a_kytag07"), ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_lamp" , extra_cflags=['-sym off']), ActorRel(NonMatching, "d_a_lod_bg"), @@ -1436,7 +1436,7 @@ config.libs = [ ActorRel(NonMatching, "d_a_ssk"), ActorRel(NonMatching, "d_a_stone"), ActorRel(NonMatching, "d_a_stone2"), - ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_swc00"), + ActorRel(Matching, "d_a_swc00"), ActorRel(Equivalent, "d_a_swhit0", extra_cflags=['-pragma "nosyminline on"']), # weak func order ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_swtdoor"), ActorRel(NonMatching, "d_a_tag_attention"), @@ -1473,7 +1473,7 @@ config.libs = [ ActorRel(MatchingFor("GZLJ01", "GZLE01", "GZLP01"), "d_a_demo_item", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_door12"), ActorRel(NonMatching, "d_a_fallrock"), - ActorRel(NonMatching, "d_a_ff"), + ActorRel(Matching, "d_a_ff", extra_cflags=['-pragma "nosyminline on"']), ActorRel(NonMatching, "d_a_gy_ctrl"), ActorRel(NonMatching, "d_a_himo3"), ActorRel(NonMatching, "d_a_hmlif"), diff --git a/include/JSystem/JAudio/JAIAnimation.h b/include/JSystem/JAudio/JAIAnimation.h index 9df256417..8fef132c1 100644 --- a/include/JSystem/JAudio/JAIAnimation.h +++ b/include/JSystem/JAudio/JAIAnimation.h @@ -31,7 +31,7 @@ struct JAIAnimeSoundData { /* 0x02 */ u16 field_0x02; /* 0x04 */ void* field_0x04; /* 0x08 */ JAIAnimeFrameSoundData mAfsData[]; -}; // Size: 0x20 +}; struct JAIAnimeSound__Slot { /* 0x0 */ u8 mbIsPlaying; diff --git a/include/SSystem/SComponent/c_bg_s.h b/include/SSystem/SComponent/c_bg_s.h index c71b33184..63aa41390 100644 --- a/include/SSystem/SComponent/c_bg_s.h +++ b/include/SSystem/SComponent/c_bg_s.h @@ -45,6 +45,13 @@ public: cM3dGPla* GetTriPla(cBgS_PolyInfo& polyInfo) const { return GetTriPla(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); } + s32 GetTriGrp(cBgS_PolyInfo& polyInfo) const { + return GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + } + fopAc_ac_c* GetActorPointer(cBgS_PolyInfo& i_poly) const { + return GetActorPointer(i_poly.GetBgIndex()); + } + bool Regist(cBgW*, fpc_ProcID, void*); bool Release(cBgW*); bool LineCross(cBgS_LinChk*); diff --git a/include/SSystem/SComponent/c_cc_d.h b/include/SSystem/SComponent/c_cc_d.h index f4dffa200..5bc85e93e 100644 --- a/include/SSystem/SComponent/c_cc_d.h +++ b/include/SSystem/SComponent/c_cc_d.h @@ -340,7 +340,15 @@ public: virtual cCcD_GStts* GetGStts(); void Init(int, int, void*, fpc_ProcID); virtual void Ct(); +#if VERSION == VERSION_DEMO + void PlusCcMove(f32 x, f32 y, f32 z) { + m_cc_move.x += x; + m_cc_move.y += y; + m_cc_move.z += z; + } +#else void PlusCcMove(f32, f32, f32); +#endif void ClrCcMove() { m_cc_move.x = m_cc_move.y = m_cc_move.z = 0.0f; } diff --git a/include/SSystem/SComponent/c_cc_s.h b/include/SSystem/SComponent/c_cc_s.h index a81c87d7f..72616f537 100644 --- a/include/SSystem/SComponent/c_cc_s.h +++ b/include/SSystem/SComponent/c_cc_s.h @@ -51,15 +51,15 @@ public: void Move(); void DrawClear(); virtual void SetCoGObjInf(bool, bool, cCcD_GObjInf*, cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, - cCcD_GStts*, cCcD_GStts*); + cCcD_GStts*, cCcD_GStts*) {} virtual void SetAtTgGObjInf(bool, bool, cCcD_Obj*, cCcD_Obj*, cCcD_GObjInf*, cCcD_GObjInf*, - cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*, cXyz*); - virtual bool ChkNoHitGAtTg(cCcD_GObjInf const*, cCcD_GObjInf const*, cCcD_GStts*, cCcD_GStts*); + cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*, cXyz*) {} + virtual bool ChkNoHitGAtTg(cCcD_GObjInf const*, cCcD_GObjInf const*, cCcD_GStts*, cCcD_GStts*) { return false; } virtual bool ChkAtTgHitAfterCross(bool, bool, cCcD_GObjInf const*, cCcD_GObjInf const*, - cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*); - virtual bool ChkNoHitGCo(cCcD_Obj*, cCcD_Obj*); + cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*) { return false; } + virtual bool ChkNoHitGCo(cCcD_Obj*, cCcD_Obj*) { return false; } virtual ~cCcS() {} - virtual void MoveAfterCheck(); + virtual void MoveAfterCheck() {} virtual void SetCoGCorrectProc(cCcD_Obj*, cCcD_Obj*); }; // Size = 0x2850 diff --git a/include/d/actor/d_a_ff.h b/include/d/actor/d_a_ff.h index 4bea48ec7..c6309e5ee 100644 --- a/include/d/actor/d_a_ff.h +++ b/include/d/actor/d_a_ff.h @@ -31,7 +31,7 @@ public: /* 0x306 */ s16 mTargetRotY; /* 0x308 */ s16 mTimers[5]; /* 0x312 */ s16 mLiveTimer; - /* 0x314 */ u8 mState; + /* 0x314 */ s8 mMode; /* 0x315 */ u8 m315[0x317 - 0x315]; /* 0x317 */ u8 mbNotVisibleZ; /* 0x318 */ dCcD_Stts mStts; diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 757d2700c..22c4b78b6 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -1835,7 +1835,7 @@ public: BOOL allTrigger() const { return mItemTrigger & (BTN_A | BTN_B | BTN_X | BTN_Y | BTN_Z); } void otherWeaponTrigger() const {} - BOOL checkPlayerDemoMode() const { return mDemo.getDemoType(); } + BOOL checkPlayerDemoMode() const { return mDemo.getDemoType() != 0; } void checkSpecialDemoMode() const {} void checkAttentionLock() {} diff --git a/include/d/actor/d_a_swc00.h b/include/d/actor/d_a_swc00.h index bd1bab20a..e0ad2c3ba 100644 --- a/include/d/actor/d_a_swc00.h +++ b/include/d/actor/d_a_swc00.h @@ -6,8 +6,8 @@ class swc00_class : public fopAc_ac_c {}; -static inline s32 daSwc00_getSw1No(swc00_class* i_this) { return fopAcM_GetParam(i_this) & 0xFF; } -static inline s32 daSwc00_getSw2No(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 8) & 0xFF; } -static inline s32 daSwc00_getType(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 0x10) & 0x3; } +static inline int daSwc00_getSw1No(swc00_class* i_this) { return fopAcM_GetParam(i_this) & 0xFF; } +static inline int daSwc00_getSw2No(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 8) & 0xFF; } +static inline int daSwc00_getType(swc00_class* i_this) { return (fopAcM_GetParam(i_this) >> 0x10) & 0x3; } #endif /* D_A_SWC00_H */ diff --git a/include/d/d_bg_s.h b/include/d/d_bg_s.h index 42680cf25..74e222217 100644 --- a/include/d/d_bg_s.h +++ b/include/d/d_bg_s.h @@ -65,6 +65,22 @@ public: dBgS() {} virtual ~dBgS() {} + bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); } + fopAc_ac_c* GetActorPointer(cBgS_PolyInfo& i_poly) const { + return cBgS::GetActorPointer(i_poly); + } + + // void CaptPoly(dBgS_CaptPoly&) {} + // void ChkDeleteActorRegist(fopAc_ac_c*) {} + // void DebugDrawPoly(dBgW&) {} + // void Draw() {} + // void DrawPoly(cBgS_PolyInfo&, _GXColor&) {} + // void GetBgWPointer(cBgS_PolyInfo&) {} + // void GetPolyCamId(cBgS_PolyInfo&) {} + // void GroundCross(cBgS_GndChk*) {} + // void LineCross(cBgS_LinChk*) {} + // void ShdwDraw(cBgS_ShdwDraw*) {} + virtual void Ct(); virtual void Dt(); virtual void Move(); @@ -106,8 +122,6 @@ public: void MoveBgMatrixCrrPos(cBgS_PolyInfo&, bool, cXyz*, csXyz*, csXyz*); void RideCallBack(cBgS_PolyInfo&, fopAc_ac_c*); fopAc_ac_c* PushPullCallBack(cBgS_PolyInfo&, fopAc_ac_c*, short, dBgW::PushPullLabel); - - bool WaterChk(dBgS_SplGrpChk* chk) { return SplGrpChk(chk); } }; // Size: 0x1404 class dBgS_CrrPos : public cBgS_PolyInfo, public dBgS_Chk, public cBgS_Chk { diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index b0c494fdb..be49a5276 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -1618,7 +1618,7 @@ inline void dComIfGs_onVisitedRoom(int i_no) { g_dComIfG_gameInfo.save.getMemory().getBit().onVisitedRoom(i_no); } -inline bool dComIfGs_isVisitedRoom(int i_no) { +inline BOOL dComIfGs_isVisitedRoom(int i_no) { return g_dComIfG_gameInfo.save.getMemory().getBit().isVisitedRoom(i_no); } diff --git a/include/d/d_stage.h b/include/d/d_stage.h index 737a1726c..f20c09881 100644 --- a/include/d/d_stage.h +++ b/include/d/d_stage.h @@ -935,7 +935,7 @@ public: void set(const char*, s8, s16, s8); const char* getName() const { return mName; } s16 getPoint() const { return mPoint; } - int getRoomNo() const { return mRoomNo; } + s8 getRoomNo() const { return mRoomNo; } s8 getLayer() const { return mLayer; } void setLayer(s8 layer) { mLayer = layer; } diff --git a/include/dolphin/gf/GF.h b/include/dolphin/gf/GF.h new file mode 100644 index 000000000..38d0cdbef --- /dev/null +++ b/include/dolphin/gf/GF.h @@ -0,0 +1,10 @@ +#ifndef GF_H +#define GF_H + +#include "dolphin/gf/GFGeometry.h" // IWYU pragma: export +#include "dolphin/gf/GFLight.h" // IWYU pragma: export +#include "dolphin/gf/GFPixel.h" // IWYU pragma: export +#include "dolphin/gf/GFTev.h" // IWYU pragma: export +#include "dolphin/gf/GFTransform.h" // IWYU pragma: export + +#endif /* GF_H */ diff --git a/include/dolphin/gf/GFPixel.h b/include/dolphin/gf/GFPixel.h index 662a76b43..95e309b3b 100644 --- a/include/dolphin/gf/GFPixel.h +++ b/include/dolphin/gf/GFPixel.h @@ -6,5 +6,6 @@ void GFSetFog(GXFogType type, f32 startZ, f32 endZ, f32 nearZ, f32 farZ, GXColor color); void GFSetBlendModeEtc(GXBlendMode, GXBlendFactor, GXBlendFactor, GXLogicOp, u8, u8, u8); +void GFSetDstAlpha(u8, u8); #endif /* GFPIXEL_H */ diff --git a/include/f_op/f_op_actor_mng.h b/include/f_op/f_op_actor_mng.h index f53f67623..54e6af379 100644 --- a/include/f_op/f_op_actor_mng.h +++ b/include/f_op/f_op_actor_mng.h @@ -401,18 +401,23 @@ inline BOOL fopAcM_isItem(fopAc_ac_c* item, int bitNo) { return dComIfGs_isItem(bitNo, fopAcM_GetHomeRoomNo(item)); } +inline BOOL dComIfGs_isVisitedRoom(int i_no); inline BOOL dComIfGs_isSaveSwitch(int i_stageNo, int i_no); inline BOOL fopAcM_isItemForIb(int itemBitNo, u8 itemNo, s8 roomNo) { if (itemNo == dItem_BLUE_JELLY_e) { +#if VERSION == VERSION_DEMO + return dComIfGs_isVisitedRoom(itemBitNo); +#else // Blue Chu Jelly uses itemBitNo as if it was a switch in stageNo 0xE. return dComIfGs_isSaveSwitch(dSv_save_c::STAGE_BLUE_CHU_JELLY, itemBitNo); +#endif } else { return dComIfGs_isItem(itemBitNo, roomNo); } } -inline void dComIfGs_onSaveSwitch(int i_stageNo, int i_no); inline void dComIfGs_onVisitedRoom(int i_no); +inline void dComIfGs_onSaveSwitch(int i_stageNo, int i_no); inline void fopAcM_onItemForIb(int itemBitNo, u8 itemNo, s8 roomNo) { if (itemNo == dItem_BLUE_JELLY_e) { #if VERSION == VERSION_DEMO diff --git a/include/f_op/f_op_overlap.h b/include/f_op/f_op_overlap.h index 87aafefe0..d68789a83 100644 --- a/include/f_op/f_op_overlap.h +++ b/include/f_op/f_op_overlap.h @@ -3,7 +3,12 @@ #define F_F_OP_OVERLAP_H_ #include "f_pc/f_pc_leaf.h" +#include "f_pc/f_pc_manager.h" extern leafdraw_method_class g_fopOvlp_Method; +inline s16 fopOvlpM_GetName(void* ovlp) { + return fpcM_GetName(ovlp); +} + #endif diff --git a/include/global.h b/include/global.h index d7b4a30ee..2ee40b945 100644 --- a/include/global.h +++ b/include/global.h @@ -41,12 +41,11 @@ #define WEAKFUNC #endif -#ifndef __MWERKS__ +// Intrinsics extern int __cntlzw(uint); extern int __rlwimi(int, int, int, int, int); extern void __dcbz(void*, int); extern void __sync(); -#endif #define VERSION_DEMO 0 #define VERSION_JPN 1 diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h index f03205578..fc14edc32 100644 --- a/include/m_Do/m_Do_mtx.h +++ b/include/m_Do/m_Do_mtx.h @@ -361,6 +361,10 @@ inline MtxP mDoMtx_getIdentity() { return g_mDoMtx_identity; } +inline MtxP cMtx_getIdentity() { + return mDoMtx_getIdentity(); +} + class mDoMtx_quatStack_c { public: mDoMtx_quatStack_c() { diff --git a/src/JSystem/JUtility/JUTXfb.cpp b/src/JSystem/JUtility/JUTXfb.cpp index 60b508450..be23708d7 100644 --- a/src/JSystem/JUtility/JUTXfb.cpp +++ b/src/JSystem/JUtility/JUTXfb.cpp @@ -72,12 +72,18 @@ JUTXfb* JUTXfb::createManager(const GXRenderModeObj* pObj, JKRHeap* pHeap, JUTXf /* 802C8410-802C8468 .text destroyManager__6JUTXfbFv */ void JUTXfb::destroyManager() { - /* Nondeterministically nonmatching */ - // MWCC randomly picks between two different possible codegen patterns for converting sManager - // to a bool for this JUT_CONFIRM call. It usually picks the longer pattern, which is required - // to match on all 3 retail versions. But it sometimes picks the shorter pattern, which is - // required to match on the demo version. There seems to be no consistent way to get it to pick - // one or the other. + /* Compiler bug: Nondeterministically nonmatching */ + // sManager (a pointer) gets passed to a bool parameter in JUTAssertion::setConfirmMessage. + // MWCC is supposed to implicitly convert the pointer to a boolean (0 or 1) value, but due to a + // compiler bug (in RemoveRedundantMonadicOp), it sometimes removes the implicit conversion and + // incorrectly passes the sManager pointer as-is to the bool. This can result in incorrect + // behavior as setConfirmMessage actually checks if the bool is exactly equal to 1, not just + // that it's nonzero. + // Whether the compiler bug occurs or not depends on the exact memory layout of the compiler's + // internal state, and so it's effectively random. + // The kiosk demo version of TWW had the bug occur during compilation, while the three retail + // versions of the game did not have the bug occur. + // There's no consistent way to get it to pick one or the other, so this TU cannot be linked. JUT_CONFIRM(VERSION_SELECT(339, 339, 344, 344), sManager); delete sManager; sManager = NULL; diff --git a/src/SSystem/SComponent/c_bg_w.cpp b/src/SSystem/SComponent/c_bg_w.cpp index d76fb77e8..3c59ebda2 100644 --- a/src/SSystem/SComponent/c_bg_w.cpp +++ b/src/SSystem/SComponent/c_bg_w.cpp @@ -16,6 +16,10 @@ #include "dolphin/mtx/mtxvec.h" #include "dolphin/types.h" +#if VERSION == VERSION_DEMO +#pragma nosyminline on +#endif + /* 80247500-8024754C .text ASSERT_SOLDHEAP__Fv */ void ASSERT_SOLDHEAP() { if (JKRHeap::sCurrentHeap->getHeapType() != 'SLID') @@ -467,7 +471,7 @@ bool cBgW::LineCheckGrpRp(cBgS_LinChk* chk, int grp_id, int depth) { bool cBgW::RwgGroundCheckCommon(f32 y, u16 poly_index, cBgS_GndChk* chk) { if (y < chk->GetPointP()->y && y > chk->GetNowY()) { cBgD_Tri_t* tri = &pm_bgd->m_t_tbl[poly_index]; - if (cM3d_CrossY_Tri_Front(pm_vtx_tbl[tri->vtx0], pm_vtx_tbl[tri->vtx1], pm_vtx_tbl[tri->vtx2], &chk->m_pos) && !ChkPolyThrough(poly_index, chk->GetPolyPassChk())) { + if (cM3d_CrossY_Tri_Front(pm_vtx_tbl[tri->vtx0], pm_vtx_tbl[tri->vtx1], pm_vtx_tbl[tri->vtx2], chk->GetPointP()) && !ChkPolyThrough(poly_index, chk->GetPolyPassChk())) { chk->SetNowY(y); chk->SetPolyIndex(poly_index); return true; @@ -653,7 +657,7 @@ void cBgW::RwgShdwDraw(int index, cBgS_ShdwDraw* shdw) { if (rwg->next == 0xFFFF) break; index = rwg->next; - JUT_ASSERT(0xbc6, 0 <= index && index < pm_bgd->m_t_num); + JUT_ASSERT(VERSION_SELECT(3013, 3014, 3014, 3014), 0 <= index && index < pm_bgd->m_t_num); } } @@ -726,7 +730,7 @@ bool cBgW::ChkGrpThrough(int, cBgS_GrpPassChk*, int) { /* 80249940-80249A18 .text GetGrpToRoomIndex__4cBgWCFi */ u32 cBgW::GetGrpToRoomIndex(int grp_index) const { - JUT_ASSERT(0xc77, 0 <= grp_index && grp_index < pm_bgd->m_g_num); + JUT_ASSERT(VERSION_SELECT(3190, 3191, 3191, 3191), 0 <= grp_index && grp_index < pm_bgd->m_g_num); cBgD_Grp_t * g_tbl = pm_bgd->m_g_tbl; if (g_tbl[grp_index].m_parent == 0xFFFF || g_tbl[g_tbl[grp_index].m_parent].m_parent == 0xFFFF) return 0xFFFF; @@ -742,7 +746,7 @@ void cBgW::GetTrans(cXyz* dst) const { /* 80249A58-80249B64 .text GetTriPnt__4cBgWCFiP4cXyzP4cXyzP4cXyz */ void cBgW::GetTriPnt(int i_no, cXyz* p0, cXyz* p1, cXyz* p2) const { - JUT_ASSERT(0xcb3, pm_bgd != NULL); + JUT_ASSERT(VERSION_SELECT(3250, 3251, 3251, 3251), pm_bgd != NULL); cBgD_Tri_t * tri = &pm_bgd->m_t_tbl[i_no]; p0->set(pm_vtx_tbl[tri->vtx0]); diff --git a/src/SSystem/SComponent/c_cc_d.cpp b/src/SSystem/SComponent/c_cc_d.cpp index af277ef0c..83db4ba56 100644 --- a/src/SSystem/SComponent/c_cc_d.cpp +++ b/src/SSystem/SComponent/c_cc_d.cpp @@ -204,6 +204,7 @@ void cCcD_Stts::Ct() { m_dmg = 0; } +#if VERSION > VERSION_DEMO /* 802419C4-80241C5C .text PlusCcMove__9cCcD_SttsFfff */ void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) { m_cc_move.x += x; @@ -214,6 +215,7 @@ void cCcD_Stts::PlusCcMove(f32 x, f32 y, f32 z) { CHECK_FLOAT_CLASS(0x1bd, m_cc_move.z); CHECK_VEC3_RANGE(0x1c1, m_cc_move); } +#endif /* 80241C5C-80241C98 .text Set__8cCcD_ObjFRC11cCcD_SrcObj */ void cCcD_Obj::Set(const cCcD_SrcObj& src) { diff --git a/src/SSystem/SComponent/c_cc_s.cpp b/src/SSystem/SComponent/c_cc_s.cpp index 3f7319978..fd89e6903 100644 --- a/src/SSystem/SComponent/c_cc_s.cpp +++ b/src/SSystem/SComponent/c_cc_s.cpp @@ -6,6 +6,10 @@ #include "SSystem/SComponent/c_cc_s.h" #include "JSystem/JUtility/JUTAssert.h" +#if VERSION == VERSION_DEMO +#pragma nosyminline on +#endif + #define CHECK_FLOAT_CLASS(line, x) JUT_ASSERT(line, !(fpclassify(x) == 1)); #define CHECK_FLOAT_RANGE(line, x) JUT_ASSERT(line, -1.0e32f < x && x < 1.0e32f); #define CHECK_VEC3_RANGE(line, v) JUT_ASSERT(line, -1.0e32f < v.x && v.x < 1.0e32f && -1.0e32f < v.y && v.y < 1.0e32f && -1.0e32f < v.z && v.z < 1.0e32f) @@ -185,7 +189,10 @@ void cCcS::ChkCo() { cCcD_ShapeAttr* co2ShapeAttr = (*objCo2)->GetShapeAttr(); if (objCo2 == NULL) continue; - f32 cross_len = 0.0f; + f32 cross_len; +#if VERSION > VERSION_DEMO + cross_len = 0.0f; +#endif if (co1ShapeAttr->CrossCo(*co2ShapeAttr, &cross_len)) { SetCoCommonHitInf(*objCo1, co1ShapeAttr->GetCoCP(), *objCo2, co2ShapeAttr->GetCoCP(), cross_len); } @@ -249,7 +256,9 @@ void cCcS::SetCoCommonHitInf(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* /* 8024388C-80244750 .text SetPosCorrect__4cCcSFP8cCcD_ObjP4cXyzP8cCcD_ObjP4cXyzf */ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos2, f32 cross_len) { CHECK_FLOAT_CLASS(604, cross_len); +#if VERSION > VERSION_DEMO CHECK_FLOAT_RANGE(605, cross_len); +#endif if (obj1->ChkCoNoCrr() || obj2->ChkCoNoCrr()) { return; @@ -260,9 +269,15 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos if (obj1->GetStts()->GetActor() != NULL && obj1->GetStts()->GetActor() == obj2->GetStts()->GetActor()) { return; } +#if VERSION == VERSION_DEMO + if (std::fabsf(cross_len) < G_CM3D_F_ABS_MIN) { + return; + } +#else if (std::fabsf(cross_len) < (1.0f / 125.0f)) { return; } +#endif SetCoGCorrectProc(obj1, obj2); @@ -362,6 +377,7 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos } } +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(794, vec1.x); CHECK_FLOAT_CLASS(795, vec1.y); CHECK_FLOAT_CLASS(796, vec1.z); @@ -370,12 +386,14 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos CHECK_FLOAT_CLASS(800, vec2.z); CHECK_VEC3_RANGE(804, vec1); CHECK_VEC3_RANGE(808, vec2); +#endif obj1->GetStts()->PlusCcMove(vec1.x, vec1.y, vec1.z); obj2->GetStts()->PlusCcMove(vec2.x, vec2.y, vec2.z); (*ppos1) += vec1; (*ppos2) += vec2; +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(817, ppos1->x); CHECK_FLOAT_CLASS(818, ppos1->y); CHECK_FLOAT_CLASS(819, ppos1->z); @@ -384,6 +402,7 @@ void cCcS::SetPosCorrect(cCcD_Obj* obj1, cXyz* ppos1, cCcD_Obj* obj2, cXyz* ppos CHECK_FLOAT_CLASS(823, ppos2->z); CHECK_PVEC3_RANGE(827, ppos1); CHECK_PVEC3_RANGE(831, ppos2); +#endif } /* 80244750-80244894 .text CalcArea__4cCcSFv */ @@ -447,25 +466,3 @@ void cCcS::DrawClear() { /* 8024498C-80244990 .text SetCoGCorrectProc__4cCcSFP8cCcD_ObjP8cCcD_Obj */ void cCcS::SetCoGCorrectProc(cCcD_Obj*, cCcD_Obj*) { } - -/* 80244990-80244998 .text ChkNoHitGCo__4cCcSFP8cCcD_ObjP8cCcD_Obj */ -bool cCcS::ChkNoHitGCo(cCcD_Obj*, cCcD_Obj*) { - return false; -} - -/* 80244998-8024499C .text SetAtTgGObjInf__4cCcSFbbP8cCcD_ObjP8cCcD_ObjP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GSttsP4cXyz */ -void cCcS::SetAtTgGObjInf(bool, bool, cCcD_Obj*, cCcD_Obj*, cCcD_GObjInf*, cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*, cXyz*) { -} - -/* 8024499C-802449A4 .text ChkAtTgHitAfterCross__4cCcSFbbPC12cCcD_GObjInfPC12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts */ -bool cCcS::ChkAtTgHitAfterCross(bool, bool, const cCcD_GObjInf*, const cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*) { - return false; -} - -/* 802449A4-802449A8 .text SetCoGObjInf__4cCcSFbbP12cCcD_GObjInfP12cCcD_GObjInfP9cCcD_SttsP9cCcD_SttsP10cCcD_GSttsP10cCcD_GStts */ -void cCcS::SetCoGObjInf(bool, bool, cCcD_GObjInf*, cCcD_GObjInf*, cCcD_Stts*, cCcD_Stts*, cCcD_GStts*, cCcD_GStts*) { -} - -/* 802449A8-802449AC .text MoveAfterCheck__4cCcSFv */ -void cCcS::MoveAfterCheck() { -} diff --git a/src/SSystem/SComponent/c_m3d.cpp b/src/SSystem/SComponent/c_m3d.cpp index 994537c71..0e790ca7a 100644 --- a/src/SSystem/SComponent/c_m3d.cpp +++ b/src/SSystem/SComponent/c_m3d.cpp @@ -107,7 +107,12 @@ f32 cM3d_SignedLenPlaAndPos(const cM3dGPla* plane, const Vec* pos) { void cM3d_CalcPla(const Vec* p0, const Vec* p1, const Vec* p2, Vec* pDst, f32* pT) { cM3d_VectorProduct(p0, p1, p2, pDst); f32 t = VECMag(pDst); - if (std::fabsf(t) >= 0.02f) { +#if VERSION == VERSION_DEMO + if (!cM3d_IsZero(t)) +#else + if (std::fabsf(t) >= 0.02f) +#endif + { VECScale(pDst, pDst, 1.0f / t); *pT = -VECDotProduct(pDst, p0); } else { @@ -1372,16 +1377,16 @@ int cM3d_Cross_LinSph_CrossPos(const cM3dGSph& sph, const cM3dGLin& line, Vec* p /* 8024D378-8024DB34 .text cM3d_Cross_CylSph__FPC8cM3dGCylPC8cM3dGSphP3VecPf */ bool cM3d_Cross_CylSph(const cM3dGCyl* pcyl, const cM3dGSph* psph, Vec* param_2, f32* pcross_len) { const Vec* pnow_sph_center = psph->GetCP(); - CHECK_FLOAT_CLASS(2498, pnow_sph_center->x); - CHECK_FLOAT_CLASS(2499, pnow_sph_center->y); - CHECK_FLOAT_CLASS(2500, pnow_sph_center->z); - CHECK_FLOAT_CLASS(2501, psph->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2499, 2498, 2498, 2498), pnow_sph_center->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2500, 2499, 2499, 2499), pnow_sph_center->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2501, 2500, 2500, 2500), pnow_sph_center->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2502, 2501, 2501, 2501), psph->GetR()); const Vec* pnow_cyl_center = pcyl->GetCP(); - CHECK_FLOAT_CLASS(2503, pnow_cyl_center->x); - CHECK_FLOAT_CLASS(2504, pnow_cyl_center->y); - CHECK_FLOAT_CLASS(2505, pnow_cyl_center->z); - CHECK_FLOAT_CLASS(2506, pcyl->GetH()); - CHECK_FLOAT_CLASS(2507, pcyl->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2504, 2503, 2503, 2503), pnow_cyl_center->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2505, 2504, 2504, 2504), pnow_cyl_center->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2506, 2505, 2505, 2505), pnow_cyl_center->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2507, 2506, 2506, 2506), pcyl->GetH()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2508, 2507, 2507, 2507), pcyl->GetR()); f32 radius_sum = pcyl->GetR() + psph->GetR(); f32 dist = std::sqrtf(cM3d_Len2dSq(pnow_sph_center->x, pnow_sph_center->z, pnow_cyl_center->x, pnow_cyl_center->z)); @@ -1406,7 +1411,9 @@ bool cM3d_Cross_CylSph(const cM3dGCyl* pcyl, const cM3dGSph* psph, Vec* param_2, } else { *param_2 = *pnow_sph_center; } +#if VERSION > VERSION_DEMO CHECK_FLOAT_CLASS(2539, *pcross_len); +#endif return true; } @@ -1415,26 +1422,26 @@ bool cM3d_Cross_CylSph(const cM3dGCyl* pcyl, const cM3dGSph* psph, Vec* param_2, /* 8024DB34-8024E1B4 .text cM3d_Cross_SphSph__FPC8cM3dGSphPC8cM3dGSphPfPf */ bool cM3d_Cross_SphSph(const cM3dGSph* i_a, const cM3dGSph* i_b, f32* param_2, f32* i_pcc_crosslen) { - CHECK_FLOAT_CLASS(2565, i_a->GetCP()->x); - CHECK_FLOAT_CLASS(2566, i_a->GetCP()->y); - CHECK_FLOAT_CLASS(2567, i_a->GetCP()->z); - CHECK_FLOAT_CLASS(2568, i_a->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2566, 2565, 2565, 2565), i_a->GetCP()->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2567, 2566, 2566, 2566), i_a->GetCP()->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2568, 2567, 2567, 2567), i_a->GetCP()->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2569, 2568, 2568, 2568), i_a->GetR()); - CHECK_FLOAT_CLASS(2569, i_b->GetCP()->x); - CHECK_FLOAT_CLASS(2570, i_b->GetCP()->y); - CHECK_FLOAT_CLASS(2571, i_b->GetCP()->z); - CHECK_FLOAT_CLASS(2572, i_b->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2570, 2569, 2569, 2569), i_b->GetCP()->x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2571, 2570, 2570, 2570), i_b->GetCP()->y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2572, 2571, 2571, 2571), i_b->GetCP()->z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2573, 2572, 2572, 2572), i_b->GetR()); Vec delta; VECSubtract(i_a->GetCP(), i_b->GetCP(), &delta); *param_2 = VECMag(&delta); *i_pcc_crosslen = i_a->GetR() + i_b->GetR() - *param_2; if (*i_pcc_crosslen > G_CM3D_F_ABS_MIN) { - CHECK_FLOAT_CLASS(2582, *i_pcc_crosslen); + CHECK_FLOAT_CLASS(VERSION_SELECT(2583, 2582, 2582, 2582), *i_pcc_crosslen); return true; } else { *i_pcc_crosslen = 0.0f; - CHECK_FLOAT_CLASS(2587, *i_pcc_crosslen); + CHECK_FLOAT_CLASS(VERSION_SELECT(2588, 2587, 2587, 2587), *i_pcc_crosslen); return false; } } @@ -1547,17 +1554,17 @@ bool cM3d_Cross_SphTri(const cM3dGSph* sph, const cM3dGTri* tri, Vec* param_2) { /* 8024E694-8024EF80 .text cM3d_Cross_CylCyl__FPC8cM3dGCylPC8cM3dGCylPf */ bool cM3d_Cross_CylCyl(const cM3dGCyl* i_cyl1, const cM3dGCyl* i_cyl2, f32* i_pcross_len) { const Vec& c1 = i_cyl1->GetC(); - CHECK_FLOAT_CLASS(2826, c1.x); - CHECK_FLOAT_CLASS(2827, c1.y); - CHECK_FLOAT_CLASS(2828, c1.z); - CHECK_FLOAT_CLASS(2829, i_cyl1->GetR()); - CHECK_FLOAT_CLASS(2830, i_cyl1->GetH()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2827, 2826, 2826, 2826), c1.x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2828, 2827, 2827, 2827), c1.y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2829, 2828, 2828, 2828), c1.z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2830, 2829, 2829, 2829), i_cyl1->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2831, 2830, 2830, 2830), i_cyl1->GetH()); const Vec& c2 = i_cyl2->GetC(); - CHECK_FLOAT_CLASS(2832, c2.x); - CHECK_FLOAT_CLASS(2833, c2.y); - CHECK_FLOAT_CLASS(2834, c2.z); - CHECK_FLOAT_CLASS(2835, i_cyl2->GetR()); - CHECK_FLOAT_CLASS(2836, i_cyl2->GetH()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2833, 2832, 2832, 2832), c2.x); + CHECK_FLOAT_CLASS(VERSION_SELECT(2834, 2833, 2833, 2833), c2.y); + CHECK_FLOAT_CLASS(VERSION_SELECT(2835, 2834, 2834, 2834), c2.z); + CHECK_FLOAT_CLASS(VERSION_SELECT(2836, 2835, 2835, 2835), i_cyl2->GetR()); + CHECK_FLOAT_CLASS(VERSION_SELECT(2837, 2836, 2836, 2836), i_cyl2->GetH()); f32 delta_x = c1.x - c2.x; f32 delta_z = c1.z - c2.z; @@ -1566,18 +1573,18 @@ bool cM3d_Cross_CylCyl(const cM3dGCyl* i_cyl1, const cM3dGCyl* i_cyl2, f32* i_pc if (dist_sq > radius_sum * radius_sum) { *i_pcross_len = 0.0f; - CHECK_FLOAT_CLASS(2849, *i_pcross_len); + CHECK_FLOAT_CLASS(VERSION_SELECT(2850, 2849, 2849, 2849), *i_pcross_len); return false; } if (c1.y + i_cyl1->GetH() < c2.y || c1.y > c2.y + i_cyl2->GetH()) { *i_pcross_len = 0.0f; - CHECK_FLOAT_CLASS(2857, *i_pcross_len); + CHECK_FLOAT_CLASS(VERSION_SELECT(2858, 2857, 2857, 2857), *i_pcross_len); return false; } *i_pcross_len = radius_sum - std::sqrtf(dist_sq); - CHECK_FLOAT_CLASS(2864, *i_pcross_len); + CHECK_FLOAT_CLASS(VERSION_SELECT(2865, 2864, 2864, 2864), *i_pcross_len); return true; } @@ -1632,7 +1639,7 @@ bool cM3d_Cross_CylTri(const cM3dGCyl* cyl, const cM3dGTri* tri, Vec* param_2) { } Vec vec1, vec2; - f32 min_len_sq = 1.0e9f; + f32 min_len_sq = G_CM3D_F_INF; if (cM3d_Cross_CylPntPnt(cyl, &tri->mA, &tri->mB, &vec1, &vec2)) { min_len_sq = cM3d_LenSq(&vec1, &tri->mA); *param_2 = vec1; @@ -1652,7 +1659,7 @@ bool cM3d_Cross_CylTri(const cM3dGCyl* cyl, const cM3dGTri* tri, Vec* param_2) { } } - if (min_len_sq != 1.0e9f) { + if (min_len_sq != G_CM3D_F_INF) { return true; } diff --git a/src/SSystem/SComponent/c_math.cpp b/src/SSystem/SComponent/c_math.cpp index ddfffd9de..363b8647b 100644 --- a/src/SSystem/SComponent/c_math.cpp +++ b/src/SSystem/SComponent/c_math.cpp @@ -199,3 +199,16 @@ void cM_initRnd2(int p0, int p1, int p2) { r12 = p1; r22 = p2; } + +#if VERSION == VERSION_DEMO +float cM_rnd2(void) { + r02 = (r02 * 0xAB) % 0x763D; + r12 = (r12 * 0xAC) % 0x7663; + r22 = (r22 * 0xAA) % 0x7673; + return std::fabsf(std::fmodf(r02 / 30269.0f + r12 / 30307.0f + r22 / 30323.0f, 1.0)); +} + +float cM_rndFX2(float f) { + return f * (cM_rnd2() - 0.5f) * 2.0f; +} +#endif diff --git a/src/c/c_damagereaction.cpp b/src/c/c_damagereaction.cpp index ccf0bf55f..4f33e1c7a 100644 --- a/src/c/c_damagereaction.cpp +++ b/src/c/c_damagereaction.cpp @@ -183,7 +183,7 @@ BOOL enemy_ice(enemyice* ei) { ei->mCyl.SetStts(&ei->mStts); ei->mCyl.SetR(ei->mWallRadius); ei->mCyl.SetH(ei->mCylHeight); - ei->mBgAcch.Set(&ac->current.pos, &ac->old.pos, ac, 1, &ei->mBgAcchCir, &ei->mSpeed); + ei->mBgAcch.Set(fopAcM_GetPosition_p(ac), fopAcM_GetOldPosition_p(ac), ac, 1, &ei->mBgAcchCir, &ei->mSpeed); ei->mBgAcchCir.SetWall(40.0f, ei->mWallRadius); if (ei->mParticleScale < 0.1f) { @@ -227,6 +227,11 @@ BOOL enemy_ice(enemyice* ei) { case 2: // Frozen frozen = TRUE; moveAndCollide = TRUE; +#if VERSION == VERSION_DEMO + if (ei->mSpeedF > 19.0f) { + ac->shape_angle.x -= 0x300; + } +#endif if (ei->m00C != 1) { cLib_onBit(ac->attention_info.flags, fopAc_Attn_ACTION_CARRY_e); ac->attention_info.distances[fopAc_Attn_TYPE_CARRY_e] = 0x12; @@ -442,37 +447,41 @@ void enemy_fire(enemyfire* ef) { switch (ef->mMode) { case 0: // Not on fire. - if (ef->mFireDuration == 0) { - return; + if (ef->mFireDuration != 0) { + // The enemy has signaled that it wants to be lit on fire for some length of time. + ef->mFireTimer = ef->mFireDuration; + ef->mFireDuration = 0; + + ef->mMode = 1; // On fire + + dKy_plight_set(&ef->mLight); + + for (int i = 0; i < 10; i++) { + if (ef->mFlameJntIdxs[i] < 0) { + continue; + } + if (ef->mpFlameEmitters[i]) { + continue; + } + cXyz scale; + scale.setall(ef->mParticleScale[i]); + ef->mpFlameEmitters[i] = dComIfGp_particle_set(dPa_name::ID_COMMON_03F1, &ac->current.pos, NULL, &scale); + ef->mFlameTimers[i] = ef->mFireTimer - (s16)cM_rndF(60.0f); + if (ef->mFlameTimers[i] < 10) { + ef->mFlameTimers[i] = 10; + } + ef->mFlameScaleY = 2.0f; + } + + ef->mStts.Init(250, 0xFF, ac); + ef->mSph.Set(fire_at_sph_src); + ef->mSph.SetStts(&ef->mStts); } - // The enemy has signaled that it wants to be lit on fire for some length of time. - ef->mFireTimer = ef->mFireDuration; - ef->mFireDuration = 0; - - ef->mMode = 1; // On fire - - dKy_plight_set(&ef->mLight); - - for (int i = 0; i < 10; i++) { - if (ef->mFlameJntIdxs[i] < 0) { - continue; - } - if (ef->mpFlameEmitters[i]) { - continue; - } - cXyz scale; - scale.setall(ef->mParticleScale[i]); - ef->mpFlameEmitters[i] = dComIfGp_particle_set(dPa_name::ID_COMMON_03F1, &ac->current.pos, NULL, &scale); - ef->mFlameTimers[i] = ef->mFireTimer - (s16)cM_rndF(60.0f); - if (ef->mFlameTimers[i] < 10) { - ef->mFlameTimers[i] = 10; - } - ef->mFlameScaleY = 2.0f; +#if VERSION == VERSION_DEMO + else { + ef->mLight.mPower = 0.0f; } - - ef->mStts.Init(250, 0xFF, ac); - ef->mSph.Set(fire_at_sph_src); - ef->mSph.SetStts(&ef->mStts); +#endif break; case 1: // On fire. ef->mLight.mPos = ac->current.pos; @@ -529,7 +538,7 @@ void enemy_fire(enemyfire* ef) { } else { ef->mFlameTimers[i]--; - cMtx_copy(ef->mpMcaMorf->getModel()->getAnmMtx(ef->mFlameJntIdxs[i]), *calc_mtx); + MTXCopy(ef->mpMcaMorf->getModel()->getAnmMtx(ef->mFlameJntIdxs[i]), *calc_mtx); MtxPosition(&offset, &pos); ef->mpFlameEmitters[i]->setGlobalTranslation(pos.x, pos.y, pos.z); @@ -563,7 +572,9 @@ void enemy_fire(enemyfire* ef) { if (ef->mFireTimer == 0) { ef->mMode = 0; // Not on fire +#if VERSION > VERSION_DEMO dKy_plight_cut(&ef->mLight); +#endif ef->mSph.SetC(non_pos); dComIfG_Ccsp()->Set(&ef->mSph); } else { @@ -684,8 +695,7 @@ void dr_body_bg_check(damagereaction* dr) { bk_class* bk = (bk_class*)dr->mpEnemy; u8 switch_no = bk->m02B8; if (switch_no != 0) { - s8 roomNo = fopAcM_GetRoomNo(bk); - dComIfGs_onSwitch(switch_no, roomNo); + dComIfGs_onSwitch(switch_no, fopAcM_GetRoomNo(dr->mpEnemy)); } } } diff --git a/src/d/actor/d_a_andsw2.cpp b/src/d/actor/d_a_andsw2.cpp index 99a8d515e..de91c9701 100644 --- a/src/d/actor/d_a_andsw2.cpp +++ b/src/d/actor/d_a_andsw2.cpp @@ -31,18 +31,18 @@ u8 daAndsw2_c::getEventNo() { /* 00000084-00000090 .text getSwbit__10daAndsw2_cFv */ u8 daAndsw2_c::getSwbit() { // Switch to set. - return (base.mParameters & 0x00FF0000) >> 16; + return (fopAcM_GetParam(this) & 0x00FF0000) >> 16; } /* 00000090-0000009C .text getSwbit2__10daAndsw2_cFv */ u8 daAndsw2_c::getSwbit2() { // First switch to check. - return (base.mParameters & 0xFF000000) >> 24; + return (fopAcM_GetParam(this) & 0xFF000000) >> 24; } /* 0000009C-000000A8 .text getType__10daAndsw2_cFv */ u8 daAndsw2_c::getType() { - return (base.mParameters & 0x0000FF00) >> 8; + return (fopAcM_GetParam(this) & 0x0000FF00) >> 8; } /* 000000A8-000000B4 .text getTimer__10daAndsw2_cFv */ @@ -53,7 +53,7 @@ u8 daAndsw2_c::getTimer() { /* 000000B4-000000C0 .text getNum__10daAndsw2_cFv */ u8 daAndsw2_c::getNum() { // Number of switches to check. - return (base.mParameters & 0x000000FF) >> 0; + return (fopAcM_GetParam(this) & 0x000000FF) >> 0; } /* 000000C0-00000130 .text getTopSw__10daAndsw2_cFv */ diff --git a/src/d/actor/d_a_branch.cpp b/src/d/actor/d_a_branch.cpp index 8cd6fba9b..04cbd74ea 100644 --- a/src/d/actor/d_a_branch.cpp +++ b/src/d/actor/d_a_branch.cpp @@ -190,16 +190,16 @@ static BOOL daBranch_Delete(daBranch_c* i_this) { } inline cPhs_State daBranch_c::create() { -#if VERSION == VERSION_DEMO - cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname); - if (phase_state == cPhs_COMPLEATE_e) { - fopAcM_SetupActor(this, daBranch_c); -#else +#if VERSION > VERSION_DEMO fopAcM_SetupActor(this, daBranch_c); +#endif cPhs_State phase_state = dComIfG_resLoad(&mPhase, daBranch_c::m_arcname); if (phase_state == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(this, daBranch_c); #endif + if (!fopAcM_entrySolidHeap(this, daBranch_c::solidHeapCB, 0x4000)) { for (int i = 0; i < (s32)ARRAY_SIZE(mAnims); i++) { mAnims[i] = NULL; diff --git a/src/d/actor/d_a_bwdg.cpp b/src/d/actor/d_a_bwdg.cpp index 86d970444..9b17f9b50 100644 --- a/src/d/actor/d_a_bwdg.cpp +++ b/src/d/actor/d_a_bwdg.cpp @@ -11,9 +11,7 @@ #include "d/d_priority.h" #include "d/actor/d_a_bwd.h" #include "f_op/f_op_actor_mng.h" -#include "dolphin/gf/GFGeometry.h" -#include "dolphin/gf/GFTev.h" -#include "dolphin/gf/GFTransform.h" +#include "dolphin/gf/GF.h" static bwd_class* boss; diff --git a/src/d/actor/d_a_dr.cpp b/src/d/actor/d_a_dr.cpp index fe1e3de28..9710e7b66 100644 --- a/src/d/actor/d_a_dr.cpp +++ b/src/d/actor/d_a_dr.cpp @@ -245,17 +245,17 @@ static BOOL createHeap(fopAc_ac_c* i_actor) { /* 00000C08-00000CE4 .text daDr_Create__FP10fopAc_ac_c */ static cPhs_State daDr_Create(fopAc_ac_c* i_this) { dr_class* a_this = (dr_class*)i_this; - -#if VERSION == VERSION_DEMO - cPhs_State phase_state = dComIfG_resLoad(&a_this->mPhs, "Dr"); - if (phase_state == cPhs_COMPLEATE_e) { - fopAcM_SetupActor(a_this, dr_class); -#else + +#if VERSION > VERSION_DEMO fopAcM_SetupActor(a_this, dr_class); - +#endif + cPhs_State phase_state = dComIfG_resLoad(&a_this->mPhs, "Dr"); if (phase_state == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(a_this, dr_class); #endif + if (!fopAcM_entrySolidHeap(a_this, createHeap, 0xF000)) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_ff.cpp b/src/d/actor/d_a_ff.cpp index c33fc0da7..e01607217 100644 --- a/src/d/actor/d_a_ff.cpp +++ b/src/d/actor/d_a_ff.cpp @@ -26,7 +26,7 @@ static void fire_fly_draw(ff_class* i_this) { dComIfGd_setListMaskOff(); mDoExt_modelUpdate(i_this->mpModel[0]); if (i_this->mGlowScale > 0.01f) { - mDoMtx_YrotM(*calc_mtx, i_this->mLiveTimer * 0x100); + cMtx_YrotM(*calc_mtx, i_this->mLiveTimer * 0x100); MtxScale(i_this->mGlowScale, i_this->mGlowScale * i_this->mGlowScaleY, i_this->mGlowScale, true); i_this->mpModel[1]->setBaseTRMtx(*calc_mtx); @@ -78,18 +78,11 @@ static BOOL daFf_Draw(ff_class* i_this) { /* 0000037C-00000D18 .text fire_fly_move__FP8ff_class */ static void fire_fly_move(ff_class* i_this) { - /* Nonmatching - regalloc */ - s8 cVar1; - f32 fVar2; - f32 fVar3; - f32 dVar7; - f32 dVar8; - f32 dVar9; - f32 fVar10; - cXyz local_cc; - daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); dBgS_GndChk chk; + f32 step; + cXyz local_cc; + i_this->mLiveTimer++; if (i_this->mTimers[2] == 0) { i_this->mTimers[1] = cM_rndF(50.0f) + 40.0f; @@ -100,95 +93,93 @@ static void fire_fly_move(ff_class* i_this) { } else { i_this->mScaleTarget = 0.0f; } + cLib_addCalc2(&i_this->mScale, i_this->mScaleTarget, 0.1f, 0.05f); - cVar1 = i_this->mState; - switch (cVar1) { + switch (i_this->mMode) { case 0: Vec pos; pos = i_this->current.pos; pos.y += 250.0f; chk.SetPos(&pos); - fVar10 = dComIfG_Bgsp()->GroundCross(&chk); - i_this->mGroundY = fVar10 + 12.5f; + i_this->mGroundY = dComIfG_Bgsp()->GroundCross(&chk) + 12.5f; if (i_this->mbNoUseGroundY == 0) { i_this->current.pos.y = i_this->mGroundY; } i_this->mHomePos = i_this->current.pos; - i_this->mState++; + i_this->mMode++; + // Fall-through + case 1: { cLib_addCalc2(&i_this->current.pos.x, i_this->mHomePos.x, 0.1f, std::abs(i_this->speed.x)); cLib_addCalc2(&i_this->current.pos.y, i_this->mHomePos.y, 0.1f, std::abs(i_this->speed.y)); cLib_addCalc2(&i_this->current.pos.z, i_this->mHomePos.z, 0.1f, std::abs(i_this->speed.z)); - fVar10 = player->current.pos.x - i_this->current.pos.x; - fVar2 = player->current.pos.y - i_this->current.pos.y; - fVar3 = player->current.pos.z - i_this->current.pos.z; - fVar10 = std::sqrtf(fVar3 * fVar3 + fVar10 * fVar10 + fVar2 * fVar2); - if (fVar10 < 250.0f) { - i_this->mState++; - fVar10 = cM_rndF(100.0f); - i_this->mTimers[3] = (fVar10 + 1000.0f); + f32 xd = player->current.pos.x - i_this->current.pos.x; + f32 yd = player->current.pos.y - i_this->current.pos.y; + f32 zd = player->current.pos.z - i_this->current.pos.z; + xd = std::sqrtf(xd * xd + yd * yd + zd * zd); + if (xd < 250.0f) { + i_this->mMode++; + xd = cM_rndF(100.0f); + i_this->mTimers[3] = (xd + 1000.0f); i_this->current.angle.x = -0x3000; i_this->speedF = 10.0f; } - break; - case 2: + goto label_870; + } + case 2: { if (i_this->mTimers[0] == 0) { i_this->mScatterPos.x = i_this->mHomePos.x + cM_rndFX(750.0f); i_this->mScatterPos.z = i_this->mHomePos.z + cM_rndFX(750.0f); i_this->mScatterPos.y = i_this->mHomePos.y + cM_rndFX(225.0f) + 137.5f; i_this->mRotVel = 0.0f; i_this->mVelocityFwdTarget = cM_rndF(20.0f) + 10.0f; - fVar2 = i_this->mScatterPos.x - i_this->current.pos.x; - dVar7 = i_this->mScatterPos.y - i_this->current.pos.y; - fVar3 = i_this->mScatterPos.z - i_this->current.pos.z; - dVar9 = fVar3 * fVar3; - dVar8 = fVar2 * fVar2; - fVar10 = std::sqrtf(dVar9 + (dVar8 + (dVar7 * dVar7))); - i_this->mTimers[0] = fVar10 / i_this->mVelocityFwdTarget; - i_this->mTargetRotY = cM_atan2s(fVar2, fVar3); - fVar10 = std::sqrtf(dVar8 + dVar9); - i_this->mTargetRotX = -cM_atan2s(dVar7, fVar10); + f32 xd = i_this->mScatterPos.x - i_this->current.pos.x; + f32 yd = i_this->mScatterPos.y - i_this->current.pos.y; + f32 zd = i_this->mScatterPos.z - i_this->current.pos.z; + f32 dist = std::sqrtf(xd * xd + yd * yd + zd * zd); + i_this->mTimers[0] = dist / i_this->mVelocityFwdTarget; + i_this->mTargetRotY = cM_atan2s(xd, zd); + f32 xz_dist = std::sqrtf(xd * xd + zd * zd); + i_this->mTargetRotX = -cM_atan2s(yd, xz_dist); } if (i_this->mTimers[3] == 0) { - i_this->mState++; + i_this->mMode++; i_this->mScatterPos.x = i_this->mHomePos.x; i_this->mScatterPos.y = i_this->mHomePos.y; i_this->mScatterPos.z = i_this->mHomePos.z; i_this->mRotVel = 0.0f; } break; - case 4: - /* attacked */ - fVar10 = i_this->mScatterPos.x - i_this->current.pos.x; - dVar8 = fVar10; - dVar7 = i_this->mScatterPos.y - i_this->current.pos.y; - fVar2 = i_this->mScatterPos.z - i_this->current.pos.z; - dVar9 = fVar2; - i_this->mTargetRotY = cM_atan2s(fVar10, fVar2); - dVar8 = dVar8 * dVar8; - dVar9 = dVar9 * dVar9; - fVar10 = std::sqrtf(dVar8 + dVar9); - i_this->mTargetRotX = -cM_atan2s(dVar7, fVar10); - if ((dVar9 + (dVar8 + (dVar7 * dVar7))) < 2500.0f) { - i_this->mState = 1; + } + case 3: { + f32 xd = i_this->mScatterPos.x - i_this->current.pos.x; + f32 yd = i_this->mScatterPos.y - i_this->current.pos.y; + f32 zd = i_this->mScatterPos.z - i_this->current.pos.z; + i_this->mTargetRotY = cM_atan2s(xd, zd); + f32 xz_dist = std::sqrtf(xd * xd + zd * zd); + i_this->mTargetRotX = -cM_atan2s(yd, xz_dist); + if (((xd * xd) + (yd * yd) + (zd * zd)) < 2500.0f) { + i_this->mMode = 1; } cLib_addCalc2(&i_this->mRotVel, 10.0f, 1.0f, 0.15f); break; - default: + } + case 4: + f32 f30; if (i_this->mTimers[4] == 0) { - i_this->mState = 2; - fVar10 = cM_rndF(100.0f); - i_this->mTimers[3] = (fVar10 + 1000.0f); + i_this->mMode = 2; + f30 = cM_rndF(100.0f); + i_this->mTimers[3] = (f30 + 1000.0f); } else { i_this->mVelImpulse += i_this->m2C0; - fVar10 = cM_rndF(1.0f); - if (fVar10 < REG13_F(0) + 0.1f) { - fVar10 = cM_rndFX(REG13_F(1) + 1.0f); - i_this->m2C0.x = fVar10; + f30 = cM_rndF(1.0f); + if (f30 < REG13_F(0) + 0.1f) { + f30 = cM_rndFX(REG13_F(1) + 1.0f); + i_this->m2C0.x = f30; } - fVar10 = cM_rndF(1.0f); - if (fVar10 < REG13_F(0) + 0.1f) { - fVar10 = cM_rndFX(REG13_F(1) + 1.0f); - i_this->m2C0.z = fVar10; + f30 = cM_rndF(1.0f); + if (f30 < REG13_F(0) + 0.1f) { + f30 = cM_rndFX(REG13_F(1) + 1.0f); + i_this->m2C0.z = f30; } i_this->m2C0.y = REG13_F(2) + 2.0f; if (i_this->mVelImpulse.y > REG13_F(3) + 10.0f) { @@ -196,23 +187,29 @@ static void fire_fly_move(ff_class* i_this) { } } break; + default: + goto label_870; } + + step = 500.0f; cLib_addCalcAngleS2(&i_this->current.angle.y, i_this->mTargetRotY, 10, - i_this->mRotVel * 500.0f); + step * i_this->mRotVel); cLib_addCalcAngleS2(&i_this->current.angle.x, i_this->mTargetRotX, 10, - i_this->mRotVel * 500.0f); + step * i_this->mRotVel); cLib_addCalc2(&i_this->mRotVel, 1.0f, 1.0f, 0.1f); cLib_addCalc2(&i_this->speedF, i_this->mVelocityFwdTarget, 1.0f, 3.0f); local_cc.x = 0.0f; local_cc.y = 0.0f; local_cc.z = i_this->speedF * 0.25f; - mDoMtx_YrotS(*calc_mtx, i_this->current.angle.y); - mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); + cMtx_YrotS(*calc_mtx, i_this->current.angle.y); + cMtx_XrotM(*calc_mtx, i_this->current.angle.x); MtxPosition(&local_cc, &i_this->speed); i_this->current.pos += (i_this->speed + i_this->mVelImpulse); cLib_addCalc0(&i_this->mVelImpulse.x, 1.0f, 0.1f); cLib_addCalc0(&i_this->mVelImpulse.y, 1.0f, 0.1f); cLib_addCalc0(&i_this->mVelImpulse.z, 1.0f, 0.1f); + +label_870: if (i_this->current.pos.y < i_this->mGroundY + 12.5f) { if (i_this->current.pos.y < i_this->mGroundY) { i_this->current.pos.y = i_this->mGroundY; @@ -225,18 +222,14 @@ static void fire_fly_move(ff_class* i_this) { /* 00001098-00001168 .text daFf_Execute__FP8ff_class */ static BOOL daFf_Execute(ff_class* i_this) { - s16 sVar1; - int iVar3; - - for (iVar3 = 0; iVar3 < 5; iVar3++) { - sVar1 = i_this->mTimers[iVar3]; - if (sVar1 != 0) { - i_this->mTimers[iVar3]--; + for (int i = 0; i < 5; i++) { + if (i_this->mTimers[i] != 0) { + i_this->mTimers[i]--; } } fire_fly_move(i_this); if (i_this->mSph.ChkTgHit() != 0) { - i_this->mState = 4; + i_this->mMode = 4; i_this->mTimers[4] = REG13_F(9) + (cM_rndF(20.0f) + 30.0f); } i_this->mSph.SetC(i_this->current.pos); @@ -251,7 +244,7 @@ static BOOL daFf_IsDelete(ff_class*) { /* 00001170-000011AC .text daFf_Delete__FP8ff_class */ static BOOL daFf_Delete(ff_class* i_this) { - dComIfG_resDelete(&i_this->mPhs, "Ff"); + dComIfG_resDeleteDemo(&i_this->mPhs, "Ff"); ff_count = 0; return TRUE; } @@ -264,10 +257,12 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) { for (int i = 0; i < 2; i++) { J3DModelData* modelData = (J3DModelData*)dComIfG_getObjectRes("Ff", ho_bmd[i]); - JUT_ASSERT(719, modelData != NULL); + JUT_ASSERT(VERSION_SELECT(717, 719, 719, 719), modelData != NULL); +#if VERSION > VERSION_DEMO if (modelData == NULL) { return FALSE; } +#endif a_this->mpModel[i] = mDoExt_J3DModel__create(modelData, 0x10000, 0x11020203); if (a_this->mpModel[i] == NULL) { return FALSE; @@ -276,13 +271,16 @@ static BOOL useHeapInit(fopAc_ac_c* i_this) { if (a_this->mBrkAnm[i] == NULL) { return FALSE; } - J3DAnmTevRegKey* pJVar5 = (J3DAnmTevRegKey*)dComIfG_getObjectRes("Ff", ho_brk[i]); - modelData = a_this->mpModel[i]->getModelData(); - int iVar6 = a_this->mBrkAnm[i]->init(modelData, pJVar5, true, J3DFrameCtrl::EMode_LOOP, - 0.9f + cM_rndF(0.15f), 0, -1, false, 0); + int iVar6 = a_this->mBrkAnm[i]->init( + a_this->mpModel[i]->getModelData(), + (J3DAnmTevRegKey*)dComIfG_getObjectRes("Ff", ho_brk[i]), + true, J3DFrameCtrl::EMode_LOOP, 0.9f + cM_rndF(0.15f), 0, -1, false, 0 + ); +#if VERSION > VERSION_DEMO if (iVar6 == 0) { return FALSE; } +#endif } return TRUE; } @@ -297,7 +295,7 @@ static cPhs_State daFf_Create(fopAc_ac_c* i_this) { if (fopAcM_entrySolidHeap(a_this, useHeapInit, 0x2320)) { int uVar1 = fopAcM_GetParam(a_this) & 0xFF; if (uVar1 != 0) { - a_this->base.mParameters = fopAcM_GetParam(a_this) & 0xFF00; + fopAcM_SetParam(a_this, fopAcM_GetParam(a_this) & 0xFF00); for (int iVar7 = 0; iVar7 < uVar1; iVar7 = iVar7 + 1) { fopAcM_prm_class* pfVar4 = fopAcM_CreateAppend(); pfVar4->base.position.x = a_this->current.pos.x + cM_rndFX(500.0f); diff --git a/src/d/actor/d_a_kytag02.cpp b/src/d/actor/d_a_kytag02.cpp index 3795b99dc..c3148a6b8 100644 --- a/src/d/actor/d_a_kytag02.cpp +++ b/src/d/actor/d_a_kytag02.cpp @@ -25,10 +25,14 @@ dPath* set_next_path_info(kytag02_class* i_this, dPath* path) { /* 000000F0-0000017C .text get_railwind_vec__FP5dPathi */ cXyz get_railwind_vec(dPath* path, int i_no) { - /* Nonmatching */ - dPnt* pnt = path->m_points; - cXyz p0 = pnt[i_no].m_position; - cXyz p1 = pnt[i_no + 1].m_position; + cXyz p0; + p0.x = path->m_points[i_no].m_position.x; + p0.y = path->m_points[i_no].m_position.y; + p0.z = path->m_points[i_no].m_position.z; + cXyz p1; + p1.x = path->m_points[i_no + 1].m_position.x; + p1.y = path->m_points[i_no + 1].m_position.y; + p1.z = path->m_points[i_no + 1].m_position.z; cXyz ret; dKyr_get_vectle_calc(&p0, &p1, &ret); return ret; diff --git a/src/d/actor/d_a_kytag03.cpp b/src/d/actor/d_a_kytag03.cpp index 718b13bb8..88c6420d8 100644 --- a/src/d/actor/d_a_kytag03.cpp +++ b/src/d/actor/d_a_kytag03.cpp @@ -90,7 +90,7 @@ static BOOL daKytag03_Execute(kytag03_class* i_this) { if (!i_this->mbIsActive && dKy_contrast_flg_get()) { if (!i_this->mbVisible) { cXyz pos; - s16 y = player->shape_angle.y; + const s16 y = player->shape_angle.y; pos.x = cM_scos(0) * cM_ssin(y); pos.y = cM_ssin(0); pos.z = cM_scos(0) * cM_scos(y); @@ -124,15 +124,17 @@ static BOOL daKytag03_Delete(kytag03_class* i_this) { /* 00000544-00000604 .text daKytag03_Create__FP10fopAc_ac_c */ static cPhs_State daKytag03_Create(fopAc_ac_c* i_ac) { kytag03_class* i_this = (kytag03_class*)i_ac; -#if VERSION == VERSION_DEMO - cPhs_State ret = dComIfG_resLoad(&i_this->mPhs, "M_DOOR"); - if (ret == cPhs_COMPLEATE_e) { - fopAcM_SetupActor(i_this, kytag03_class); -#else + +#if VERSION > VERSION_DEMO fopAcM_SetupActor(i_this, kytag03_class); +#endif + cPhs_State ret = dComIfG_resLoad(&i_this->mPhs, "M_DOOR"); if (ret == cPhs_COMPLEATE_e) { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, kytag03_class); #endif + if (!fopAcM_entrySolidHeap(i_this, useHeapInit, 0x4c30)) { return cPhs_ERROR_e; } diff --git a/src/d/actor/d_a_kytag04.cpp b/src/d/actor/d_a_kytag04.cpp index 348330f40..05edbc668 100644 --- a/src/d/actor/d_a_kytag04.cpp +++ b/src/d/actor/d_a_kytag04.cpp @@ -50,8 +50,8 @@ static cPhs_State daKytag04_Create(fopAc_ac_c* i_this) { fopAcM_SetupActor(i_this, kytag04_class); kytag04_class* a_this = (kytag04_class*)i_this; a_this->mState = 0; - a_this->mOffColPat = a_this->base.mParameters; - a_this->mOnColPat = a_this->base.mParameters >> 8; + a_this->mOffColPat = fopAcM_GetParam(a_this) & 0xFF; + a_this->mOnColPat = (fopAcM_GetParam(a_this) >> 8) & 0xFF; a_this->mSwitchNo = a_this->current.angle.x; a_this->mScaleX = a_this->scale.x * 100.0f; a_this->mScaleY = a_this->scale.y * 100.0f; diff --git a/src/d/actor/d_a_kytag05.cpp b/src/d/actor/d_a_kytag05.cpp index 15d094f99..b9222e3c6 100644 --- a/src/d/actor/d_a_kytag05.cpp +++ b/src/d/actor/d_a_kytag05.cpp @@ -43,26 +43,26 @@ static BOOL daKytag05_Execute(kytag05_class* a_this) { camera_process_class *camera = dComIfGp_getCamera(0); fopAc_ac_c *player = dComIfGp_getPlayer(0); f32 windPow = dKyw_get_wind_pow(); - f32 i_blend = 1.0f; + f32 blend = 1.0f; if (g_env_light.mWind.mEvtWindSet == 0xFF) { return TRUE; } - if (dComIfGp_event_runCheck() && dComIfGp_evmng_startCheck("demo41") && dComIfGp_demo_get()) { + if (dComIfGp_event_runCheck() != FALSE && dComIfGp_evmng_startCheck("demo41") && dComIfGp_demo_get()) { u32 demoFrame = dComIfGp_demo_get()->getFrame(); if(demoFrame >= 0x186) { f32 fVar7 = ((f32)demoFrame - 390.0f) / 100.0f; - if(fVar7 > i_blend) { - fVar7 = i_blend; + if(fVar7 > 1.0f) { + fVar7 = 1.0f; } - i_blend = 1.0f - fVar7; - g_env_light.mSnowCount = (int)(200.0f * i_blend); + blend = 1.0f - fVar7; + g_env_light.mSnowCount = (int)(200.0f * blend); } else if (demoFrame == 0x187) { daYkgr_c::stop(); } } - dKy_custom_colset(0, 7, i_blend); + dKy_custom_colset(0, 7, blend); if((a_this->mIndex & 1) == 0) { if (a_this->mTimer >= fuu_timer[a_this->mIndex >> 1]) { @@ -78,7 +78,8 @@ static BOOL daKytag05_Execute(kytag05_class* a_this) { if(a_this->mIndex >> 1 >= 4) { a_this->mIndex = 0; } - dKyw_evt_wind_set(0, wind_table[a_this->mIndex >> 1]); + s16 windY = wind_table[a_this->mIndex >> 1]; + dKyw_evt_wind_set(0, windY); a_this->mTimer = 0; g_env_light.mWind.mEvtWindSet = 1; } else { @@ -120,14 +121,21 @@ static BOOL daKytag05_Delete(kytag05_class*) { /* 00000404-000004C0 .text daKytag05_Create__FP10fopAc_ac_c */ static cPhs_State daKytag05_Create(fopAc_ac_c* i_this) { +#if VERSION > VERSION_DEMO fopAcM_SetupActor(i_this, kytag05_class); +#endif kytag05_class *a_this = (kytag05_class*)i_this; if (dComIfGs_isSymbol(1) != 0) { return cPhs_STOP_e; } + +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, kytag05_class); +#endif + a_this->mIndex = 0; a_this->mTimer = 0; - a_this->mUnknownParam = i_this->base.mParameters & 0xff; + a_this->mUnknownParam = fopAcM_GetParam(i_this) & 0xff; dKyw_evt_wind_set_go(); dKyw_evt_wind_set(0, 0); g_env_light.mSnowCount = 200; diff --git a/src/d/actor/d_a_kytag06.cpp b/src/d/actor/d_a_kytag06.cpp index 544e0fd5b..e2596aae5 100644 --- a/src/d/actor/d_a_kytag06.cpp +++ b/src/d/actor/d_a_kytag06.cpp @@ -22,7 +22,7 @@ static BOOL daKytag06_Execute(kytag06_class* i_this) { f32 time; int date; - if (!dComIfGp_event_runCheck()) { + if (dComIfGp_event_runCheck() == FALSE) { return TRUE; } if(!dComIfGp_evmng_startCheck("ARRIVAL_BRK")) { @@ -59,13 +59,18 @@ static BOOL daKytag06_Delete(kytag06_class*) { /* 000001A4-00000224 .text daKytag06_Create__FP10fopAc_ac_c */ static cPhs_State daKytag06_Create(fopAc_ac_c* i_this) { +#if VERSION > VERSION_DEMO fopAcM_SetupActor(i_this, kytag06_class); +#endif kytag06_class* a_this = (kytag06_class*)i_this; cPhs_State phase_state; if(dComIfGs_isSymbol(0)) { phase_state = cPhs_ERROR_e; } else { +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, kytag06_class); +#endif a_this->field_0x294 = 0; phase_state = cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_kytag07.cpp b/src/d/actor/d_a_kytag07.cpp index c4d9262d2..ca14c3af2 100644 --- a/src/d/actor/d_a_kytag07.cpp +++ b/src/d/actor/d_a_kytag07.cpp @@ -84,15 +84,18 @@ static BOOL daKytag07_Delete(kytag07_class*) { static cPhs_State daKytag07_Create(fopAc_ac_c* i_this) { kytag07_class* a_this = (kytag07_class*)i_this; dScnKy_env_light_c& env_light = dKy_getEnvlight(); -#if VERSION == VERSION_DEMO - if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0) - env_light.mbDayNightTactStop = true; + +#if VERSION > VERSION_DEMO fopAcM_SetupActor(a_this, kytag07_class); -#else - fopAcM_SetupActor(a_this, kytag07_class); - if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0) - env_light.mbDayNightTactStop = true; #endif + + if (strcmp(dComIfGp_getStartStageName(), "GTower") != 0) + env_light.mbDayNightTactStop = true; + +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(a_this, kytag07_class); +#endif + return cPhs_COMPLEATE_e; } diff --git a/src/d/actor/d_a_obj_figure.cpp b/src/d/actor/d_a_obj_figure.cpp index c9eefb35d..da835ce14 100644 --- a/src/d/actor/d_a_obj_figure.cpp +++ b/src/d/actor/d_a_obj_figure.cpp @@ -514,7 +514,7 @@ cPhs_State daObjFigure_c::createInit() { attention_info.flags = fopAc_Attn_LOCKON_TALK_e | fopAc_Attn_ACTION_SPEAK_e | fopAc_Attn_TALKFLAG_CHECK_e; shape_angle = current.angle; dKy_tevstr_init(&mTevStrBG2, fopAcM_GetHomeRoomNo(this), 0xFF); - cMtx_copy(mDoMtx_getIdentity(), mMtx); + cMtx_copy(cMtx_getIdentity(), mMtx); setMtx(); return cPhs_COMPLEATE_e; diff --git a/src/d/actor/d_a_obj_movebox.cpp b/src/d/actor/d_a_obj_movebox.cpp index de96ffe47..f1aa22034 100644 --- a/src/d/actor/d_a_obj_movebox.cpp +++ b/src/d/actor/d_a_obj_movebox.cpp @@ -132,7 +132,7 @@ namespace daObjMovebox { M_gnd_work[i].SetActorPid(movebox->base.mBsPcId); mGroundY[i] = dComIfG_Bgsp()->GroundCross(&M_gnd_work[i]); if (mGroundY[i] > maxGroundY) { - fopAc_ac_c* groundActor = dComIfG_Bgsp()->GetActorPointer(M_gnd_work[i].GetBgIndex()); + fopAc_ac_c* groundActor = dComIfG_Bgsp()->GetActorPointer(M_gnd_work[i]); if (!(groundActor && fopAcM_GetName(groundActor) == PROC_Obj_Movebox && ((Act_c*)groundActor)->mMode == Act_c::MODE_AFLOAT)) { maxGroundY = mGroundY[i]; mMaxGroundIdx = i; diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index 5cc86e824..bb9d9ec44 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -6907,7 +6907,7 @@ BOOL daPy_lk_c::procFrontRollCrash_init() { dKy_Sound_set(current.pos, 100, fopAcM_GetID(this), 5); if ((mAcch.ChkWallHit()) && (mAcchCir[0].ChkWallHit())) { daObjMovebox::Act_c* iVar1 = - (daObjMovebox::Act_c*)dComIfG_Bgsp()->GetActorPointer(mAcchCir[0].GetBgIndex()); + (daObjMovebox::Act_c*)dComIfG_Bgsp()->GetActorPointer(mAcchCir[0]); if ((iVar1 != 0) && (fopAcM_GetName(iVar1) == PROC_Obj_Movebox) && ((iVar1->mType == 0) || (iVar1->mType == 5))) { @@ -11167,7 +11167,7 @@ void daPy_lk_c::checkRoofRestart() { { if ((dStage_stagInfo_GetSTType(dComIfGp_getStageStagInfo()) != dStageType_BOSS_e && ((!dComIfG_Bgsp()->ChkMoveBG(mAcch.m_roof) || - (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_roof.GetBgIndex())) != + (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_roof)) != PROC_BRIDGE))))) { f32 dVar9 = mAcch.m_roof_y; @@ -12460,14 +12460,14 @@ cPhs_State daPy_lk_c::makeBgWait() { mAcch.CrrPos(*dComIfG_Bgsp()); if ((-G_CM3D_F_INF == mAcch.GetGroundH()) || (((m352E != 0 && (dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd))) && - (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd.GetBgIndex())) == + (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd)) == PROC_TBOX)))) { return cPhs_INIT_e; } if (((fopAcM_GetParam(this) & 0x80) != 0) && (m352E != 0)) { if (!(dComIfG_Bgsp()->ChkMoveBG(mAcch.m_gnd)) || - (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd.GetBgIndex())) != + (fopAcM_GetName(dComIfG_Bgsp()->GetActorPointer(mAcch.m_gnd)) != PROC_OBJ_IKADA)) { return cPhs_INIT_e; diff --git a/src/d/actor/d_a_sail.cpp b/src/d/actor/d_a_sail.cpp index 9315b4c65..54fd49f1e 100644 --- a/src/d/actor/d_a_sail.cpp +++ b/src/d/actor/d_a_sail.cpp @@ -489,7 +489,7 @@ static BOOL daSail_Draw(sail_class* i_this) { mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z); - mDoMtx_concat(j3dSys.mViewMtx, *calc_mtx, *i_this->mSailPacket.getMtx()); + mDoMtx_concat(j3dSys.getViewMtx(), *calc_mtx, *i_this->mSailPacket.getMtx()); cXyz* vtxPos = i_this->mSailPacket.getPos(); MtxTrans( @@ -503,7 +503,7 @@ static BOOL daSail_Draw(sail_class* i_this) { mDoMtx_XrotM(*calc_mtx, i_this->current.angle.x); mDoMtx_ZrotM(*calc_mtx, i_this->current.angle.z); - mDoMtx_concat(j3dSys.mViewMtx, *calc_mtx, *i_this->mSailPacket.getStickMtx()); + mDoMtx_concat(j3dSys.getViewMtx(), *calc_mtx, *i_this->mSailPacket.getStickMtx()); i_this->mSailPacket.mStickModel->setBaseTRMtx(*calc_mtx); MtxTrans(0.0f, 0.0f, 0.0f, 0); diff --git a/src/d/actor/d_a_shand.cpp b/src/d/actor/d_a_shand.cpp index 015aa326b..358d098df 100644 --- a/src/d/actor/d_a_shand.cpp +++ b/src/d/actor/d_a_shand.cpp @@ -250,16 +250,17 @@ void hand_move(shand_class* i_this) { case 1: if((fopAcM_GetParam(actor) & 0xFF) != 1){ dBgS_GndChk local_ac; - float chk_pos_x = actor->current.pos.x, chk_pos_y = actor->current.pos.y, chk_pos_z = actor->current.pos.z; - chk_pos_y -= 100.0f; - local_ac.GetPointP()->set(chk_pos_x, chk_pos_y, chk_pos_z); + Vec chk_pos; + chk_pos = actor->current.pos; + chk_pos.y -= 100.0f; + local_ac.SetPos(&chk_pos); i_this->ground_y = dComIfG_Bgsp()->GroundCross(&local_ac); dBgS_ObjGndChk_Spl local_100; - chk_pos_x = actor->current.pos.x, chk_pos_y = actor->current.pos.y, chk_pos_z = actor->current.pos.z; - chk_pos_y += 200.0f; - local_100.GetPointP()->set(chk_pos_x, chk_pos_y, chk_pos_z); - float spl_ground_y = dComIfG_Bgsp()->GroundCross(&local_100) + 10.0f; + chk_pos = actor->current.pos; + chk_pos.y += 200.0f; + local_100.SetPos(&chk_pos); + f32 spl_ground_y = dComIfG_Bgsp()->GroundCross(&local_100) + 10.0f; if(spl_ground_y != -G_CM3D_F_INF){ i_this->ground_y = spl_ground_y; } diff --git a/src/d/actor/d_a_swc00.cpp b/src/d/actor/d_a_swc00.cpp index a27ae5a4c..5d3dc10f1 100644 --- a/src/d/actor/d_a_swc00.cpp +++ b/src/d/actor/d_a_swc00.cpp @@ -11,22 +11,22 @@ /* 00000078-00000180 .text daSwc00_Execute__FP11swc00_class */ static BOOL daSwc00_Execute(swc00_class* i_this) { - s32 enable_sw = daSwc00_getSw2No(i_this); fopAc_ac_c* actor = i_this; - if(enable_sw == 0xFF || dComIfGs_isSwitch(enable_sw, fopAcM_GetRoomNo(i_this))) { - s32 swBit = daSwc00_getSw1No(i_this); + int enable_sw = daSwc00_getSw2No(i_this); + if(enable_sw == 0xFF || dComIfGs_isSwitch(enable_sw, fopAcM_GetRoomNo(actor))) { + int swBit = daSwc00_getSw1No(i_this); - f32 xz_dist2 = fopAcM_searchPlayerDistanceXZ2(i_this); - f32 y_diff = fopAcM_searchPlayerDistanceY(i_this); - if(xz_dist2 < i_this->scale.x && (-100.0f < y_diff && y_diff < i_this->scale.y)) { - dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(i_this)); + f32 xz_dist2 = fopAcM_searchPlayerDistanceXZ2(actor); + f32 y_diff = fopAcM_searchPlayerDistanceY(actor); + if(xz_dist2 < actor->scale.x && (-100.0f < y_diff && y_diff < actor->scale.y)) { + dComIfGs_onSwitch(swBit, fopAcM_GetRoomNo(actor)); if(daSwc00_getType(i_this) != 0) { - fopAcM_delete(actor); + fopAcM_delete(i_this); } } else if(daSwc00_getType(i_this) == 0) { - dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(i_this)); + dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(actor)); } } @@ -44,21 +44,27 @@ static BOOL daSwc00_Delete(swc00_class* i_this) { } /* 00000190-00000274 .text daSwc00_Create__FP10fopAc_ac_c */ -static cPhs_State daSwc00_Create(fopAc_ac_c* i_actor) { - fopAcM_SetupActor(i_actor, swc00_class); +static cPhs_State daSwc00_Create(fopAc_ac_c* i_this) { +#if VERSION > VERSION_DEMO + fopAcM_SetupActor(i_this, swc00_class); +#endif - swc00_class* i_this = (swc00_class*)i_actor; + swc00_class* a_this = (swc00_class*)i_this; - if(dComIfGs_isSwitch(daSwc00_getSw1No(i_this), fopAcM_GetRoomNo(i_this))) { - if(daSwc00_getType(i_this) == 0) { - s32 swBit = daSwc00_getSw1No(i_this); - dComIfGs_offSwitch(swBit, fopAcM_GetRoomNo(i_this)); + u8 swBit = daSwc00_getSw1No(a_this); + if(dComIfGs_isSwitch(swBit, fopAcM_GetRoomNo(i_this))) { + if(daSwc00_getType(a_this) == 0) { + dComIfGs_offSwitch(daSwc00_getSw1No(a_this), fopAcM_GetRoomNo(i_this)); } else { return cPhs_ERROR_e; } } +#if VERSION == VERSION_DEMO + fopAcM_SetupActor(i_this, swc00_class); +#endif + i_this->scale.x *= 100.0f; i_this->scale.x += 30.0f; i_this->scale.x *= i_this->scale.x; diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index 322fff5f9..376cd4327 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -17,22 +17,22 @@ static u8 msg_mode; /* 00000078-00000084 .text getEventNo__11daTag_Msg_cFv */ u32 daTag_Msg_c::getEventNo() { - return base.mParameters >> 0x18; + return fopAcM_GetParam(this) >> 0x18; } /* 00000084-00000090 .text getSwbit__11daTag_Msg_cFv */ u32 daTag_Msg_c::getSwbit() { - return base.mParameters >> 8 & 0xff; + return (fopAcM_GetParam(this) >> 8) & 0xff; } /* 00000090-0000009C .text getSwbit2__11daTag_Msg_cFv */ u32 daTag_Msg_c::getSwbit2() { - return base.mParameters >> 0x10 & 0xff; + return (fopAcM_GetParam(this) >> 0x10) & 0xff; } /* 0000009C-000000A8 .text getType2__11daTag_Msg_cFv */ u32 daTag_Msg_c::getType2() { - return base.mParameters >> 6 & 3; + return (fopAcM_GetParam(this) >> 6) & 3; } /* 000000A8-0000015C .text myDemoName__11daTag_Msg_cFv */ diff --git a/src/d/d_a_bomb_static.cpp b/src/d/d_a_bomb_static.cpp index 1de8baf05..c799d8086 100644 --- a/src/d/d_a_bomb_static.cpp +++ b/src/d/d_a_bomb_static.cpp @@ -109,7 +109,9 @@ bool daBomb_c::chk_state(daBomb_c::State_e state) const { /* 800682C0-800682F0 .text change_state__8daBomb_cFQ28daBomb_c7State_e */ void daBomb_c::change_state(daBomb_c::State_e new_state) { - base.mParameters = (base.mParameters & ~(((1 << PRM_STATE_W) - 1) << PRM_STATE_S)) | (new_state << PRM_STATE_S); // & 0xFF000000 + u32 params = fopAcM_GetParam(this) & ~(((1 << PRM_STATE_W) - 1) << PRM_STATE_S); + params |= (new_state << PRM_STATE_S); + fopAcM_SetParam(this, params); _prm_chk_version(); } diff --git a/src/d/d_bg_s.cpp b/src/d/d_bg_s.cpp index 1eca3ff9a..e2907ed3e 100644 --- a/src/d/d_bg_s.cpp +++ b/src/d/d_bg_s.cpp @@ -130,7 +130,7 @@ int dBgS::GetGrpRoomInfId(cBgS_PolyInfo& polyInfo) { if (inf != 0xFF) return inf; - s32 grp_id = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp_id = GetTriGrp(polyInfo); if (grp_id == -1) return 0xFF; return GetGrpInf(polyInfo, grp_id) & 0xFF; @@ -138,7 +138,7 @@ int dBgS::GetGrpRoomInfId(cBgS_PolyInfo& polyInfo) { /* 800A07F4-800A0858 .text GetGrpSoundId__4dBgSFR13cBgS_PolyInfo */ s32 dBgS::GetGrpSoundId(cBgS_PolyInfo& polyInfo) { - s32 grp_id = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp_id = GetTriGrp(polyInfo); if (grp_id == -1) return -1; return (GetGrpInf(polyInfo, grp_id) >> 11) & 0xFF; @@ -146,7 +146,7 @@ s32 dBgS::GetGrpSoundId(cBgS_PolyInfo& polyInfo) { /* 800A0858-800A08C0 .text ChkGrpInf__4dBgSFR13cBgS_PolyInfoUl */ u32 dBgS::ChkGrpInf(cBgS_PolyInfo& polyInfo, u32 mask) { - s32 grp_id = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp_id = GetTriGrp(polyInfo); if (grp_id == -1) return 0; @@ -289,7 +289,7 @@ s32 dBgS::GetRoomId(cBgS_PolyInfo& polyInfo) { dBgW* bgwp = (dBgW*)m_chk_element[id].m_bgw_base_ptr; s32 roomNo = bgwp->mRoomNo; if (roomNo == 0xFFFF) { - s32 grp = GetTriGrp(polyInfo.GetBgIndex(), polyInfo.GetPolyIndex()); + s32 grp = GetTriGrp(polyInfo); roomNo = GetGrpToRoomId(polyInfo.GetBgIndex(), grp); if (roomNo == 0xFFFF) return -1; diff --git a/src/d/d_bg_s_acch.cpp b/src/d/d_bg_s_acch.cpp index c8cc4ee10..c442ed504 100644 --- a/src/d/d_bg_s_acch.cpp +++ b/src/d/d_bg_s_acch.cpp @@ -128,7 +128,7 @@ void dBgS_Acch::GroundCheck(dBgS& i_bgs) { pos.y += m_ground_up_h_diff + (m_ground_check_offset - m_ground_up_h); m_ground_up_h_diff = 0.0f; - m_gnd.m_pos = pos; + m_gnd.SetPos(&pos); m_ground_h = i_bgs.GroundCross(&m_gnd); if (m_ground_h != -G_CM3D_F_INF) { diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp index e20e26241..4111056f3 100644 --- a/src/d/d_camera.cpp +++ b/src/d/d_camera.cpp @@ -2521,7 +2521,7 @@ void dCamera_c::checkGroundInfo() { m33C = 0; if (dComIfG_Bgsp()->ChkMoveBG(mBG.m5C.m04)) { - m33C = dComIfG_Bgsp()->GetActorPointer(mBG.m5C.m04.GetBgIndex()); + m33C = dComIfG_Bgsp()->GetActorPointer(mBG.m5C.m04); if (m33C) { cXyz pos = positionOf(m33C); cSAngle angle = directionOf(m33C); diff --git a/src/d/d_cc_mass_s.cpp b/src/d/d_cc_mass_s.cpp index 4ae8ac42c..d4f0d8a51 100644 --- a/src/d/d_cc_mass_s.cpp +++ b/src/d/d_cc_mass_s.cpp @@ -32,25 +32,23 @@ void dCcMassS_Mng::Ct() { void dCcMassS_Mng::Prepare() { cM3dGAab area; area.ClearForMinMax(); - cCcD_ShapeAttr* attr; for (dCcMassS_Obj* mass = mMassObjs; mass < mMassObjs + mMassObjCount; mass++) { cCcD_Obj* pobj = mass->GetObj(); JUT_ASSERT(61, pobj != NULL); - attr = pobj->GetShapeAttr(); + cCcD_ShapeAttr* attr = pobj->GetShapeAttr(); attr->CalcAabBox(); area.SetMinMax(attr->GetWorkAab()); } for (dCcMassS_Obj* mass = mMassAreas; mass < mMassAreas + mMassAreaCount; mass++) { cCcD_Obj* parea = mass->GetObj(); JUT_ASSERT(73, parea != NULL); - attr = parea->GetShapeAttr(); + cCcD_ShapeAttr* attr = parea->GetShapeAttr(); attr->CalcAabBox(); area.SetMinMax(attr->GetWorkAab()); } if (mFlag & 1) { mCpsAttr.CalcAabBox(); - attr = &mCpsAttr; - area.SetMinMax(attr->GetWorkAab()); + area.SetMinMax(mCpsAttr.GetWorkAab()); } mDivideArea.SetArea(area); for (dCcMassS_Obj* mass = mMassObjs; mass < mMassObjs + mMassObjCount; mass++) { diff --git a/src/d/d_cc_s.cpp b/src/d/d_cc_s.cpp index 61b2b2ba7..4a1fee476 100644 --- a/src/d/d_cc_s.cpp +++ b/src/d/d_cc_s.cpp @@ -479,8 +479,3 @@ bool dCcS::ChkNoHitGCo(cCcD_Obj* obj1, cCcD_Obj* obj2) { } return false; } - -/* 800AE930-800AE938 .text ChkNoHitGAtTg__4cCcSFPC12cCcD_GObjInfPC12cCcD_GObjInfP10cCcD_GSttsP10cCcD_GStts */ -bool cCcS::ChkNoHitGAtTg(const cCcD_GObjInf*, const cCcD_GObjInf*, cCcD_GStts*, cCcD_GStts*) { - return false; -} diff --git a/src/d/d_cc_uty.cpp b/src/d/d_cc_uty.cpp index f55c485f3..a0c3d1e40 100644 --- a/src/d/d_cc_uty.cpp +++ b/src/d/d_cc_uty.cpp @@ -86,7 +86,7 @@ void def_se_set_p(fopAc_ac_c* actor, cXyz* sePos, cCcD_Obj* obj, unsigned long r /* 800AEBCC-800AEEF8 .text at_power_check__FP8CcAtInfo */ fopAc_ac_c* at_power_check(CcAtInfo* atInfo) { - daPy_py_c* player = daPy_getPlayerActorClass(); + daPy_py_c* player = (daPy_py_c*)dComIfGp_getPlayer(0); if (atInfo->mpObj == NULL) { return NULL; } @@ -209,7 +209,7 @@ fopAc_ac_c* cc_at_check(fopAc_ac_c* tgActor, CcAtInfo* atInfo) { if (fopAcM_GetName(atInfo->mpActor) == PROC_HIMO2 && tgActor->stealItemLeft != 0) { tgActor->stealItemLeft--; - fopAcM_createStealItem(&tgActor->current.pos, tgActor->itemTableIdx, tgActor->current.roomNo, NULL, tgActor->stealItemBitNo); + fopAcM_createStealItem(&tgActor->current.pos, tgActor->itemTableIdx, fopAcM_GetRoomNo(tgActor), NULL, tgActor->stealItemBitNo); tgActor->stealItemBitNo++; atInfo->mDamage = 0; } diff --git a/src/d/d_drawlist.cpp b/src/d/d_drawlist.cpp index c680ca1f4..bd1955a95 100644 --- a/src/d/d_drawlist.cpp +++ b/src/d/d_drawlist.cpp @@ -7,10 +7,7 @@ #include "d/d_com_inf_game.h" #include "d/d_kankyo_rain.h" #include "d/actor/d_a_sea.h" -#include "dolphin/gf/GFGeometry.h" -#include "dolphin/gf/GFLight.h" -#include "dolphin/gf/GFPixel.h" -#include "dolphin/gf/GFTransform.h" +#include "dolphin/gf/GF.h" #include "f_op/f_op_camera.h" #include "m_Do/m_Do_graphic.h" #include "m_Do/m_Do_lib.h" @@ -177,7 +174,7 @@ void dDlst_2DT2_c::draw() { GXSetCullMode(GX_CULL_NONE); GXSetDither(GX_TRUE); GXSetClipMode(GX_CLIP_DISABLE); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); f32 x0 = mX, x1 = x0 + mW; @@ -561,7 +558,7 @@ void dDlst_2Dm_c::draw() { GXSetAlphaCompare(GX_GREATER, 0, GX_AOP_OR, GX_GREATER, 0); GXSetBlendMode(GX_BM_BLEND, GX_BL_SRC_ALPHA, GX_BL_INV_SRC_ALPHA, GX_LO_SET); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXBegin(GX_QUADS, GX_VTXFMT0, 4); diff --git a/src/d/d_gameover.cpp b/src/d/d_gameover.cpp index 22d9753ed..b1ee77cfb 100644 --- a/src/d/d_gameover.cpp +++ b/src/d/d_gameover.cpp @@ -45,7 +45,7 @@ void dDlst_Gameover_CAPTURE_c::draw() { Mtx44 mtx; C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); diff --git a/src/d/d_grass.cpp b/src/d/d_grass.cpp index e70904deb..91ec58e76 100644 --- a/src/d/d_grass.cpp +++ b/src/d/d_grass.cpp @@ -15,8 +15,7 @@ #include "m_Do/m_Do_lib.h" #include "m_Do/m_Do_graphic.h" #include "SSystem/SComponent/c_counter.h" -#include "dolphin/gf/GFGeometry.h" -#include "dolphin/gf/GFTev.h" +#include "dolphin/gf/GF.h" #include "weak_data_1811.h" // IWYU pragma: keep diff --git a/src/d/d_kankyo.cpp b/src/d/d_kankyo.cpp index cc0b00662..03e26305c 100644 --- a/src/d/d_kankyo.cpp +++ b/src/d/d_kankyo.cpp @@ -13,7 +13,7 @@ #include "d/d_procname.h" #include "d/d_s_play.h" #include "d/d_stage.h" -#include "dolphin/gf/GFPixel.h" +#include "dolphin/gf/GF.h" #include "f_op/f_op_actor_mng.h" #include "f_op/f_op_camera.h" #include "f_op/f_op_kankyo.h" diff --git a/src/d/d_ovlp_fade2.cpp b/src/d/d_ovlp_fade2.cpp index a11d5f1ee..ea1abbb34 100644 --- a/src/d/d_ovlp_fade2.cpp +++ b/src/d/d_ovlp_fade2.cpp @@ -40,7 +40,7 @@ void dOvlpFd2_dlst_c::draw() { GXSetCullMode(GX_CULL_NONE); GXSetDither(GX_TRUE); GXSetClipMode(GX_CLIP_DISABLE); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXBegin(GX_QUADS, GX_VTXFMT0, 4); diff --git a/src/d/d_ovlp_fade4.cpp b/src/d/d_ovlp_fade4.cpp index 6aa6d5a94..ddf455f47 100644 --- a/src/d/d_ovlp_fade4.cpp +++ b/src/d/d_ovlp_fade4.cpp @@ -138,7 +138,7 @@ void dDlst_2Dt_Sp_c::draw() { GXSetCullMode(GX_CULL_NONE); GXSetDither(GX_FALSE); GXSetClipMode(GX_CLIP_DISABLE); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); f32 x1, y1; @@ -185,7 +185,7 @@ dOvlpFd4_c::dOvlpFd4_c() { first = true; setExecute(&dOvlpFd4_c::execFirstSnap); setDraw(&dOvlpFd4_c::drawFadeOut); - if (base.mProcName == PROC_OVERLAP4) { + if (fopOvlpM_GetName(this) == PROC_OVERLAP4) { fadeOutComposite_dlst.init(mDoGph_gInf_c::getFrameBufferTimg(), 0.0f, 0.0f, 640.0f, 480.0f, g_saftyWhiteColor); } else { fadeOutComposite_dlst.init(mDoGph_gInf_c::getFrameBufferTimg(), 0.0f, 0.0f, 640.0f, 480.0f, (GXColor){ 0x00, 0x00, 0x00, 0x00 }); diff --git a/src/d/d_s_actor_data_mng.cpp b/src/d/d_s_actor_data_mng.cpp index 0683c7201..8f3ac628e 100644 --- a/src/d/d_s_actor_data_mng.cpp +++ b/src/d/d_s_actor_data_mng.cpp @@ -65,11 +65,10 @@ void dADM_CharTbl::SetUpIndex() { /* 800C2B40-800C2BC8 .text GetNameIndex2__12dADM_CharTblCFPCci */ int dADM_CharTbl::GetNameIndex2(const char* pName, int index) const { for (int start = 0; ; start++) { - int col = GetNameIndex(pName, start); - if (col == -1) + start = GetNameIndex(pName, start); + if (start == -1) return -1; - start = col; int inf = GetInf(mIndex_ARG, start); if (index == inf) return start; @@ -117,7 +116,7 @@ void dADM::SetData(void* pData) { } if (FindTag('ACFN', &row, &rowOffs) && FindTag('ACNA', &name, &nameOffs) && FindTag('ACDS', &dat_size, &dataOffs)) { - JUT_ASSERT(0xca, row * name == dat_size); + JUT_ASSERT(202, row * name == dat_size); mCharTbl.SetData((u32)pData, row, rowOffs, name, nameOffs, dat_size, dataOffs); } } diff --git a/src/d/d_snap.cpp b/src/d/d_snap.cpp index 82ac5ae88..f36bf744a 100644 --- a/src/d/d_snap.cpp +++ b/src/d/d_snap.cpp @@ -1919,7 +1919,7 @@ void dSnap_packet::ClearAlphaBuffer() { GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_S16, 0); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXBegin(GX_QUADS, GX_VTXFMT0, 4); diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp index f760b716e..fcc19831e 100644 --- a/src/d/d_stage.cpp +++ b/src/d/d_stage.cpp @@ -194,7 +194,7 @@ int stayRoomCheck(int roomCount, u8* rooms, int roomNo) { /* 80040DDC-80040E38 .text createRoomScene__Fi */ int createRoomScene(int param_0) { - int* ptr = (int*)JKRHeap::alloc(4, -4, NULL); + int* ptr = (int*)JKRAlloc(4, -4); if (ptr == NULL) { return 0; } @@ -1387,7 +1387,7 @@ stage_actor_data_class* dStage_decodeSearchIkada(void* i_file, int ikadaShipId) /* 8004184C-800419D0 .text dStage_playerInitIkada__FP16fopAcM_prm_classPv */ void dStage_playerInitIkada(fopAcM_prm_class* player_prm, void* i_file) { stage_actor_data_class* ikada_data = dStage_decodeSearchIkada(i_file, dComIfGp_getIkadaShipId()); - JUT_ASSERT(1590, ikada_data != NULL); + JUT_ASSERT(VERSION_SELECT(1560, 1590, 1590, 1590), ikada_data != NULL); u8 roomNo = dComIfGp_getIkadaShipBeforeRoomId(); player_prm->base.parameters = 0xFF000000 | roomNo; @@ -1419,7 +1419,7 @@ bool dStage_chkPlayerId(int playerId, int room_no) { if (room_no == -1) { player = dComIfGp_getStage().getPlayer(); } else { - JUT_ASSERT(0x689, 0 <= room_no && room_no < 64); + JUT_ASSERT(VERSION_SELECT(1643, 1673, 1673, 1673), 0 <= room_no && room_no < 64); player = dComIfGp_roomControl_getStatusRoomDt(room_no)->getPlayer(); } @@ -1447,7 +1447,7 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) i_stage->setPlayerNum(num); fopAcM_prm_class* appen = fopAcM_CreateAppend(); - JUT_ASSERT(1735, appen != NULL); + JUT_ASSERT(VERSION_SELECT(1705, 1735, 1735, 1735), appen != NULL); int point = dComIfGp_getStartStagePoint(); u32 roomParam = dComIfGs_getRestartRoomParam(); @@ -1470,7 +1470,7 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) player_data++; } - JUT_ASSERT(1787, i != num); + JUT_ASSERT(VERSION_SELECT(1757, 1787, 1787, 1787), i != num); appen->base.parameters = player_data->base.parameters; appen->base.position = player_data->base.position; @@ -1494,16 +1494,21 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) dStage_actorCreate(player_data, appen); scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID()); - JUT_ASSERT(1842, stageProc != NULL); + JUT_ASSERT(VERSION_SELECT(1812, 1842, 1842, 1842), stageProc != NULL); if (stageProc->base.base.mProcName != PROC_PLAY_SCENE) { fopAcM_create(PROC_TITLE, 0); } +#if VERSION == VERSION_DEMO + else +#endif + { + fopMsgM_Create(PROC_METER, NULL, NULL); - fopMsgM_Create(PROC_METER, NULL, NULL); + cXyz agb_pos(appen->base.position.x, appen->base.position.y + 10.0f, appen->base.position.z); + fopAcM_create(PROC_AGB, 0, &agb_pos); + } - cXyz agb_pos(appen->base.position.x, appen->base.position.y + 10.0f, appen->base.position.z); - fopAcM_create(PROC_AGB, 0, &agb_pos); dComIfGp_setAgb(NULL); return 1; } @@ -1511,20 +1516,23 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file) /* 80041E84-80041ED4 .text dStage_cameraInit__FP11dStage_dt_cPviPv */ int dStage_cameraInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { stage_camera_class* camera = (stage_camera_class*)((char*)i_data + 4); + int entryIdx = 0; i_stage->setCamera(camera); - dStage_cameraCreate(camera->m_entries, 0, 0); + dStage_cameraCreate(&camera->m_entries[entryIdx], 0, 0); return 1; } /* 80041ED4-80041F08 .text dStage_RoomCameraInit__FP11dStage_dt_cPviPv */ int dStage_RoomCameraInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setCamera((stage_camera_class*)((char*)i_data + 4)); + stage_camera_class* camera = (stage_camera_class*)((char*)i_data + 4); + i_stage->setCamera(camera); return 1; } /* 80041F08-80041F3C .text dStage_arrowInit__FP11dStage_dt_cPviPv */ int dStage_arrowInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setArrow((stage_arrow_class*)((char*)i_data + 4)); + stage_arrow_class* arrow = (stage_arrow_class*)((char*)i_data + 4); + i_stage->setArrow(arrow); return 1; } @@ -1681,7 +1689,8 @@ int dStage_stagInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 8004238C-800423C0 .text dStage_sclsInfoInit__FP11dStage_dt_cPviPv */ int dStage_sclsInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setSclsInfo((stage_scls_info_dummy_class*)((char*)i_data + 4)); + stage_scls_info_dummy_class* scls_info = (stage_scls_info_dummy_class*)((char*)i_data + 4); + i_stage->setSclsInfo(scls_info); return 1; } @@ -1755,7 +1764,8 @@ s8 dStage_roomRead_dt_c_GetReverbStage(roomRead_class& room, int index) { /* 80042658-8004268C .text dStage_ppntInfoInit__FP11dStage_dt_cPviPv */ int dStage_ppntInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setPntInfo((dStage_dPnt_c*)((char*)i_data + 4)); + dStage_dPnt_c* pStagePnt = (dStage_dPnt_c*)((char*)i_data + 4); + i_stage->setPntInfo(pStagePnt); return 1; } @@ -1772,7 +1782,8 @@ int dStage_pathInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 8004271C-80042750 .text dStage_rppnInfoInit__FP11dStage_dt_cPviPv */ int dStage_rppnInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setPnt2Info((dStage_dPnt_c*)((char*)i_data + 4)); + dStage_dPnt_c* pStagePnt = (dStage_dPnt_c*)((char*)i_data + 4); + i_stage->setPnt2Info(pStagePnt); return 1; } @@ -1789,19 +1800,22 @@ int dStage_rpatInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 800427E0-80042814 .text dStage_soundInfoInit__FP11dStage_dt_cPviPv */ int dStage_soundInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setSoundInfo((dStage_SoundInfo_c*)((char*)i_data + 4)); + dStage_SoundInfo_c* soundInfo = (dStage_SoundInfo_c*)((char*)i_data + 4); + i_stage->setSoundInfo(soundInfo); return 1; } /* 80042814-80042848 .text dStage_eventInfoInit__FP11dStage_dt_cPviPv */ int dStage_eventInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setEventInfo((dStage_EventInfo_c*)((char*)i_data + 4)); + dStage_EventInfo_c* eventInfo = (dStage_EventInfo_c*)((char*)i_data + 4); + i_stage->setEventInfo(eventInfo); return 1; } /* 80042848-8004287C .text dStage_floorInfoInit__FP11dStage_dt_cPviPv */ int dStage_floorInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setFloorInfo((dStage_FloorInfo_c*)((char*)i_data + 4)); + dStage_FloorInfo_c* floorInfo = (dStage_FloorInfo_c*)((char*)i_data + 4); + i_stage->setFloorInfo(floorInfo); return 1; } @@ -1815,7 +1829,7 @@ int dStage_memaInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { for (int i = 0; i < pd->num; i++) { JKRExpHeap* heap = dStage_roomControl_c::createMemoryBlock(i, *entry_p + 0x300); - JUT_ASSERT(2932, heap != NULL); + JUT_ASSERT(VERSION_SELECT(2903, 2932, 2932, 2932), heap != NULL); entry_p++; } } @@ -1842,10 +1856,14 @@ int dStage_mecoInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { #if VERSION == VERSION_DEMO bool dStage_setShipPos(int param_0, int i_roomNo) { - /* Nonmatching */ - i_roomNo = i_roomNo == 0xFF ? dComIfGp_roomControl_getStayNo() : i_roomNo; + int roomNo; + if (i_roomNo == 0xFF) { + roomNo = dComIfGp_roomControl_getStayNo(); + } else { + roomNo = i_roomNo; + } if (param_0 != 0xFF) { - dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(i_roomNo, param_0); + dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(roomNo, param_0); if (ship_data_p != NULL) { daShip_c* ship_p = (daShip_c*)fopAcM_SearchByName(PROC_SHIP); if (ship_p != NULL) { @@ -1885,8 +1903,13 @@ bool dStage_setShipPos(int param_0, int i_roomNo) { } if (param_0 != 0xFF) { - i_roomNo = i_roomNo == 0xFF ? dComIfGp_roomControl_getStayNo() : i_roomNo; - dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(i_roomNo, param_0); + int roomNo; + if (i_roomNo == 0xFF) { + roomNo = dComIfGp_roomControl_getStayNo(); + } else { + roomNo = i_roomNo; + } + dStage_Ship_dt_c* ship_data_p = dComIfGp_getShip(roomNo, param_0); if (ship_data_p != NULL) { daShip_c* ship_p = (daShip_c*)fopAcM_SearchByName(PROC_SHIP); if (ship_p != NULL) { @@ -1944,13 +1967,15 @@ int dStage_shipInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { /* 80042C38-80042C6C .text dStage_multInfoInit__FP11dStage_dt_cPviPv */ int dStage_multInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setMulti((dStage_Multi_c*)((char*)i_data + 4)); + dStage_Multi_c* multi = (dStage_Multi_c*)((char*)i_data + 4); + i_stage->setMulti(multi); return 1; } /* 80042C6C-80042CA0 .text dStage_lbnkInfoInit__FP11dStage_dt_cPviPv */ int dStage_lbnkInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setLbnk((dStage_Lbnk_c*)((char*)i_data + 4)); + dStage_Lbnk_c* lbnk = (dStage_Lbnk_c*)((char*)i_data + 4); + i_stage->setLbnk(lbnk); return 1; } @@ -1977,7 +2002,8 @@ int dStage_layerTresureInit(dStage_dt_c* i_stage, void* i_data, int i_num, void* /* 80042DA4-80042DD8 .text dStage_dmapInfoInit__FP11dStage_dt_cPviPv */ int dStage_dmapInfoInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) { - i_stage->setDMap((dStage_DMap_c*)((char*)i_data + 4)); + dStage_DMap_c* dmap = (dStage_DMap_c*)((char*)i_data + 4); + i_stage->setDMap(dmap); return 1; } @@ -2043,8 +2069,8 @@ void dStage_dt_c_offsetToPtr(void* i_data) { void dStage_dt_c_stageInitLoader(void* i_data, dStage_dt_c* i_stage) { static FuncTable l_funcTable[] = {"STAG", dStage_stagInfoInit}; - JUT_ASSERT(3557, i_data != NULL); - JUT_ASSERT(3558, i_stage != NULL); + JUT_ASSERT(VERSION_SELECT(3529, 3557, 3557, 3557), i_data != NULL); + JUT_ASSERT(VERSION_SELECT(3530, 3558, 3558, 3558), i_stage != NULL); dStage_dt_c_offsetToPtr(i_data); i_stage->init(); @@ -2197,7 +2223,7 @@ void dStage_dt_c_roomReLoader(void* i_data, dStage_dt_c* i_stage, int param_2) { /* 8004324C-800432EC .text dStage_infoCreate__Fv */ void dStage_infoCreate() { void* stageRsrc = dComIfG_getStageRes("Stage", "stage.dzs"); - JUT_ASSERT(3834, stageRsrc != NULL) + JUT_ASSERT(VERSION_SELECT(3806, 3834, 3834, 3834), stageRsrc != NULL) dStage_dt_c_stageInitLoader(stageRsrc, &dComIfGp_getStage()); } @@ -2207,14 +2233,14 @@ void dStage_Create() { dKankyo_create(); void* stageRsrc = dComIfG_getStageRes("Stage", "stage.dzs"); - JUT_ASSERT(3862, stageRsrc != NULL) + JUT_ASSERT(VERSION_SELECT(3834, 3862, 3862, 3862), stageRsrc != NULL) dComIfGp_roomControl_init(); dStage_dt_c_stageLoader(stageRsrc, &dComIfGp_getStage()); if (dComIfGp_getStartStageRoomNo() >= 0) { int status = dStage_roomInit(dComIfGp_getStartStageRoomNo()); - JUT_ASSERT(3873, status); + JUT_ASSERT(VERSION_SELECT(3845, 3873, 3873, 3873), status); } dMap_c::create(); @@ -2282,9 +2308,11 @@ void dStage_roomControl_c::SetTimePass(int i_timepass) { int dStage_changeSceneExitId(cBgS_PolyInfo& i_poly, f32 i_speed, u32 i_mode, s8 i_roomNo) { int exit_id = dComIfG_Bgsp()->GetExitId(i_poly); if (exit_id == 0x3E || exit_id == 0x3B) { - fopAc_ac_c* actor_p = dComIfG_Bgsp()->GetActorPointer(i_poly.GetBgIndex()); - s8 roomNo = IkadaGetRoomNoArg0(actor_p); - s16 point = IkadaGetLinkIdArg1(actor_p); + fopAc_ac_c* actor_p = dComIfG_Bgsp()->GetActorPointer(i_poly); + int arg0 = IkadaGetRoomNoArg0(actor_p); + s8 roomNo = arg0; + int arg1 = IkadaGetLinkIdArg1(actor_p); + u8 point = arg1; if (exit_id == 0x3E) { dComIfGp_setNextStage("Obshop", point, roomNo, -1, i_speed, i_mode); @@ -2297,7 +2325,7 @@ int dStage_changeSceneExitId(cBgS_PolyInfo& i_poly, f32 i_speed, u32 i_mode, s8 dComIfGp_setIkadaShipBeforePos(actor_p->current.pos); return 1; } else if (exit_id == 0x3D) { - JUT_ASSERT(4134, dComIfGp_getIkadaShipBeforeRoomId() >= 0 && + JUT_ASSERT(VERSION_SELECT(4106, 4134, 4134, 4134), dComIfGp_getIkadaShipBeforeRoomId() >= 0 && dComIfGp_getIkadaShipBeforeRoomId() < 64); dComIfGp_setNextStage("sea", -2, dComIfGp_getIkadaShipBeforeRoomId(), -1, i_speed, i_mode); return 1; @@ -2328,7 +2356,7 @@ int dStage_changeScene(int i_exitId, f32 speed, u32 mode, s8 room_no) { if (room_no == -1) { scls = dComIfGp_getStageSclsInfo(); } else { - JUT_ASSERT(4192, 0 <= room_no && room_no < 64); + JUT_ASSERT(VERSION_SELECT(4164, 4192, 4192, 4192), 0 <= room_no && room_no < 64); scls = dComIfGp_roomControl_getStatusRoomDt(room_no)->getSclsInfo(); } @@ -2336,7 +2364,7 @@ int dStage_changeScene(int i_exitId, f32 speed, u32 mode, s8 room_no) { return 0; } - JUT_ASSERT(4202, 0 <= i_exitId && i_exitId < scls->num); + JUT_ASSERT(VERSION_SELECT(4174, 4202, 4202, 4202), 0 <= i_exitId && i_exitId < scls->num); stage_scls_info_class* scls_info = &scls->m_entries[i_exitId]; s32 wipe = dStage_sclsInfo_getWipe(scls_info); diff --git a/src/d/d_wood.cpp b/src/d/d_wood.cpp index f80b62c92..e90a93b75 100644 --- a/src/d/d_wood.cpp +++ b/src/d/d_wood.cpp @@ -14,9 +14,7 @@ #include "d/d_procname.h" #include "d/d_tree.h" #include "d/d_cc_d.h" -#include "dolphin/gf/GFGeometry.h" -#include "dolphin/gf/GFTev.h" -#include "dolphin/gf/GFTransform.h" +#include "dolphin/gf/GF.h" #include "dolphin/gx/GXAttr.h" #include "dolphin/gx/GXDisplayList.h" #include "dolphin/gx/GXStruct.h" diff --git a/src/f_op/f_op_actor_mng.cpp b/src/f_op/f_op_actor_mng.cpp index c4ed54183..cf3253286 100644 --- a/src/f_op/f_op_actor_mng.cpp +++ b/src/f_op/f_op_actor_mng.cpp @@ -30,12 +30,12 @@ #include "weak_bss_3569.h" // IWYU pragma: keep #define MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action) \ - ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 0x8 | switchNo2 << 0x10 | (type & 0x3) << 0x18 | (action & 0x3F) << 0x1A) + ((itemNo & 0xFF) << 0 | (itemBitNo & 0xFF) << 8 | (switchNo2 & 0xFF) << 16 | (type & 0x3) << 24 | (action & 0x3F) << 26) /* 80024060-80024104 .text fopAcM_setStageLayer__FPv */ void fopAcM_setStageLayer(void* pProc) { scene_class* stageProc = fopScnM_SearchByID(dStage_roomControl_c::getProcID()); - JUT_ASSERT(0xee, stageProc != NULL); + JUT_ASSERT(238, stageProc != NULL); fpcM_ChangeLayerID(pProc, fopScnM_LayerID(stageProc)); } @@ -43,7 +43,7 @@ void fopAcM_setStageLayer(void* pProc) { void fopAcM_setRoomLayer(void* pProc, int room_no) { if (room_no >= 0) { scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(room_no)); - JUT_ASSERT(0x105, roomProc != NULL); + JUT_ASSERT(261, roomProc != NULL); fpcM_ChangeLayerID(pProc, fopScnM_LayerID(roomProc)); } } @@ -269,8 +269,8 @@ fpc_ProcID fopAcM_createChildFromOffset(char* pProcNameString, fpc_ProcID parent /* 80024B78-80024CA0 .text fopAcM_createHeap__FP10fopAc_ac_cUlUl */ s32 fopAcM_createHeap(fopAc_ac_c* i_this, u32 size, u32 align) { - JUT_ASSERT(0x33b, i_this); - JUT_ASSERT(0x33c, i_this->heap == NULL); + JUT_ASSERT(827, i_this); + JUT_ASSERT(828, i_this->heap == NULL); fopAcM_Log(i_this, "アクターのヒープの生成"); if (align == 0) align = 0x20; @@ -317,8 +317,11 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 heap = mDoExt_createSolidHeapFromGameToCurrent(estimatedHeapSize, 0x20); if (heap != NULL) { bool result = createHeapCB(i_this); + +#if VERSION > VERSION_DEMO if (heap->getFreeSize() >= 0x20) - JKRHeap::alloc(0x20, 0, NULL); + JKRAlloc(0x20, 0); +#endif mDoExt_restoreCurrentHeap(); @@ -352,7 +355,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 if (heap == NULL) { heap = mDoExt_createSolidHeapFromGameToCurrent(-1, 0x20); - JUT_ASSERT(0x453, heap); + JUT_ASSERT(VERSION_SELECT(1103, 1107, 1107, 1107), heap); bool result = createHeapCB(i_this); mDoExt_restoreCurrentHeap(); @@ -389,7 +392,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 heap = NULL; bool result = createHeapCB(i_this); mDoExt_restoreCurrentHeap(); - JUT_ASSERT(0x48d, result != FALSE); + JUT_ASSERT(VERSION_SELECT(1161, 1165, 1165, 1165), result != FALSE); if (result == FALSE) { // "Entry failed with the exact size heap? (Bug)\n" OSReport_Error("ぴったりサイズで、登録失敗?(バグ)\n"); @@ -417,7 +420,7 @@ bool fopAcM_entrySolidHeap(fopAc_ac_c* i_this, heapCallbackFunc createHeapCB, u3 // "Buggy!\n" OSReport_Error("ばぐばぐです\n"); - JUT_ASSERT(0x4b5, FALSE); + JUT_ASSERT(VERSION_SELECT(1201, 1205, 1205, 1205), FALSE); } // "fopAcM_entrySolidHeap failed. [%s]\n" @@ -445,7 +448,7 @@ void fopAcM_setCullSizeSphere(fopAc_ac_c* i_this, f32 x, f32 y, f32 z, f32 r) { /* 80025114-80025144 .text fopAcM_addAngleY__FP10fopAc_ac_css */ bool fopAcM_addAngleY(fopAc_ac_c* i_this, short target, short step) { - return cLib_chaseAngleS(&i_this->current.angle.y, target, step); + return cLib_chaseAngleS(&fopAcM_GetAngle_p(i_this)->y, target, step); } /* 80025144-800251A0 .text fopAcM_calcSpeed__FP10fopAc_ac_c */ @@ -483,24 +486,24 @@ void fopAcM_posMoveF(fopAc_ac_c* i_this, const cXyz* move) { /* 80025250-80025278 .text fopAcM_searchActorAngleY__FP10fopAc_ac_cP10fopAc_ac_c */ s16 fopAcM_searchActorAngleY(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - return cLib_targetAngleY(&i_this->current.pos, &i_other->current.pos); + return cLib_targetAngleY(fopAcM_GetPosition_p(i_this), fopAcM_GetPosition_p(i_other)); } /* 80025278-800252BC .text fopAcM_seenActorAngleY__FP10fopAc_ac_cP10fopAc_ac_c */ s32 fopAcM_seenActorAngleY(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - s16 angleY = cLib_targetAngleY(&i_this->current.pos, &i_other->current.pos); + s16 angleY = cLib_targetAngleY(fopAcM_GetPosition_p(i_this), fopAcM_GetPosition_p(i_other)); return abs((s16)(angleY - i_this->shape_angle.y)); } /* 800252BC-80025370 .text fopAcM_searchActorDistance__FP10fopAc_ac_cP10fopAc_ac_c */ f32 fopAcM_searchActorDistance(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - cXyz delta = i_other->current.pos - i_this->current.pos; + cXyz delta = *fopAcM_GetPosition_p(i_other) - *fopAcM_GetPosition_p(i_this); return delta.abs(); } /* 80025370-800253C0 .text fopAcM_searchActorDistance2__FP10fopAc_ac_cP10fopAc_ac_c */ f32 fopAcM_searchActorDistance2(fopAc_ac_c* i_this, fopAc_ac_c* i_other) { - cXyz delta = i_other->current.pos - i_this->current.pos; + cXyz delta = *fopAcM_GetPosition_p(i_other) - *fopAcM_GetPosition_p(i_this); return delta.abs2(); } @@ -541,7 +544,7 @@ s32 fopAcM_checkCullingBox(Mtx pMtx, f32 x0, f32 y0, f32 z0, f32 x1, f32 y1, f32 Vec p0 = { x0, y0, z0 }; Vec p1 = { x1, y1, z1 }; Mtx viewMtx; - MTXConcat(j3dSys.mViewMtx, pMtx, viewMtx); + MTXConcat(j3dSys.getViewMtx(), pMtx, viewMtx); return mDoLib_clipper::clip(viewMtx, &p1, &p0) != 0; } @@ -608,14 +611,14 @@ s32 fopAcM_cullingCheck(fopAc_ac_c* i_this) { return mDoLib_clipper::clip(pMtx, fopAcM_getCullSizeBoxMax(i_this), fopAcM_getCullSizeBoxMin(i_this)); } } else { - fopAc_cullSizeBox& cullBox = l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_this))]; + fopAc_cullSizeBox* cullBox = &l_cullSizeBox[fopAcM_CULLSIZE_IDX(fopAcM_GetCullSize(i_this))]; if (fopAcM_getCullSizeFar(i_this) > 0.0f) { mDoLib_clipper::changeFar(cullFar * mDoLib_clipper::getFar()); - s32 ret = mDoLib_clipper::clip(pMtx, &cullBox.max, &cullBox.min); + s32 ret = mDoLib_clipper::clip(pMtx, &cullBox->max, &cullBox->min); mDoLib_clipper::resetFar(); return ret; } else { - return mDoLib_clipper::clip(pMtx, &cullBox.max, &cullBox.min); + return mDoLib_clipper::clip(pMtx, &cullBox->max, &cullBox->min); } } } else { // Sphere @@ -632,17 +635,16 @@ s32 fopAcM_cullingCheck(fopAc_ac_c* i_this) { return mDoLib_clipper::clip(pMtx, *fopAcM_getCullSizeSphereCenter(i_this), radius); } } else { - fopAc_cullSizeSphere& cullSphere = l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_this))]; + fopAc_cullSizeSphere* cullSphere = &l_cullSizeSphere[fopAcM_CULLSIZE_Q_IDX(fopAcM_GetCullSize(i_this))]; if (fopAcM_getCullSizeFar(i_this) > 0.0f) { mDoLib_clipper::changeFar(cullFar * mDoLib_clipper::getFar()); - f32 radius = cullSphere.radius; - Vec center = cullSphere.center; + f32 radius = cullSphere->radius; + Vec center = cullSphere->center; s32 ret = mDoLib_clipper::clip(pMtx, center, radius); mDoLib_clipper::resetFar(); return ret; } else { - f32 radius = cullSphere.radius; - return mDoLib_clipper::clip(pMtx, cullSphere.center, radius); + return mDoLib_clipper::clip(pMtx, cullSphere->center, cullSphere->radius); } } } @@ -777,7 +779,7 @@ fopAc_ac_c* fopAcM_getEventPartner(fopAc_ac_c* i_this) { /* 80026118-800261E8 .text fopAcM_createItemForPresentDemo__FP4cXyziUciiP5csXyzP4cXyz */ fpc_ProcID fopAcM_createItemForPresentDemo(cXyz* pos, int i_itemNo, u8 argFlag, int roomNo, int param_5, csXyz* angle, cXyz* scale) { - JUT_ASSERT(2413, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(2409, 2413, 2413, 2413), 0 <= i_itemNo && i_itemNo < 256); dComIfGp_event_setGtItm(i_itemNo); @@ -790,7 +792,7 @@ fpc_ProcID fopAcM_createItemForPresentDemo(cXyz* pos, int i_itemNo, u8 argFlag, /* 800261E8-800262B4 .text fopAcM_createItemForTrBoxDemo__FP4cXyziiiP5csXyzP4cXyz */ fpc_ProcID fopAcM_createItemForTrBoxDemo(cXyz* pos, int i_itemNo, int roomNo, int param_5, csXyz* angle, cXyz* scale) { - JUT_ASSERT(2458, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(2454, 2458, 2458, 2458), 0 <= i_itemNo && i_itemNo < 256); dComIfGp_event_setGtItm(i_itemNo); @@ -803,7 +805,7 @@ fpc_ProcID fopAcM_createItemForTrBoxDemo(cXyz* pos, int i_itemNo, int roomNo, in /* 800262B4-80026694 .text fopAcM_createItemFromTable__FP4cXyziiiiP5csXyziP4cXyz */ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* p_angle, int action, cXyz* p_scale) { - JUT_ASSERT(2514, 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2510, 2514, 2514, 2514), 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); static cXyz fairy_offset_tbl[3] = { cXyz(40.0f, 0.0f, 0.0f), @@ -822,9 +824,13 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo case 0x02: case 0x03: case 0x04: { - int life = dComIfGs_getLife() * 100; + int life = dComIfGs_getLife(); +#if VERSION == VERSION_DEMO + int max = dComIfGs_getMaxLife(); +#else int max = dComIfGs_getMaxLife() & 0xFC; - u8 lifePercent = life / max; +#endif + u8 lifePercent = (100 * life) / max; if (lifePercent != 0 && lifePercent <= 20) { tableIdx = 4; } else if (lifePercent > 20 && lifePercent <= 40) { @@ -896,13 +902,13 @@ fpc_ProcID fopAcM_createItemFromTable(cXyz* p_pos, int i_itemNo, int i_itemBitNo /* 80026694-800267C8 .text fopAcM_createRaceItemFromTable__FP4cXyziiiP5csXyzP4cXyzi */ fpc_ProcID fopAcM_createRaceItemFromTable(cXyz* pos, int i_itemNo, int i_itemBitNo, int i_roomNo, csXyz* angle, cXyz* scale, int param_7) { - JUT_ASSERT(2660, 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2654, 2660, 2660, 2660), 0 <= i_itemNo && i_itemNo < 64 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo >= 0x20 && i_itemNo <= 0x3E) { + i_itemNo -= 0x20; ItemTableList* itemTableList = dComIfGp_getItemTable(); int itemIdx = (int)cM_rndF(15.9999f); - int tableIdx = i_itemNo - 0x20; - i_itemNo = itemTableList->mItemTables[tableIdx][itemIdx]; + i_itemNo = itemTableList->mItemTables[i_itemNo][itemIdx]; } if (i_itemNo == 0x3F || i_itemNo == 0xFF) { @@ -917,7 +923,7 @@ fpc_ProcID fopAcM_createRaceItemFromTable(cXyz* pos, int i_itemNo, int i_itemBit /* 800267C8-8002688C .text fopAcM_createShopItem__FP4cXyziP5csXyziP4cXyzPFPv_i */ fpc_ProcID fopAcM_createShopItem(cXyz* pos, int i_itemNo, csXyz* angle, int roomNo, cXyz* scale, createFunc createFunc) { - JUT_ASSERT(2716, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(2710, 2716, 2716, 2716), 0 <= i_itemNo && i_itemNo < 256); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; } @@ -927,24 +933,24 @@ fpc_ProcID fopAcM_createShopItem(cXyz* pos, int i_itemNo, csXyz* angle, int room /* 8002688C-80026980 .text fopAcM_createRaceItem__FP4cXyziiP5csXyziP4cXyzi */ fpc_ProcID fopAcM_createRaceItem(cXyz* pos, int i_itemNo, int i_itemBitNo, csXyz* angle, int roomNo, cXyz* scale, int param_7) { - JUT_ASSERT(2763, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2757, 2763, 2763, 2763), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; } i_itemNo = check_itemno(i_itemNo); - u32 params = (i_itemBitNo & 0x7F) << 0x08 | (i_itemNo & 0xFF) | (param_7 & 0xF) << 0xF; + u32 params = (i_itemBitNo & 0x7F) << 8 | (i_itemNo & 0xFF) << 0 | (param_7 & 0xF) << 15; return fopAcM_create(PROC_RACEITEM, params, pos, roomNo, angle, scale); } /* 80026980-80026A68 .text fopAcM_createDemoItem__FP4cXyziiP5csXyziP4cXyzUc */ fpc_ProcID fopAcM_createDemoItem(cXyz* pos, int i_itemNo, int i_itemBitNo, csXyz* i_angle, int i_roomNo, cXyz* i_scale, u8 i_argFlag) { - JUT_ASSERT(2813, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2807, 2813, 2813, 2813), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; } - u32 params = (i_itemNo & 0xFF) | (i_itemBitNo & 0x7F) << 0x08 | (i_argFlag & 0xFF) << 0x10; + u32 params = (i_itemNo & 0xFF) << 0 | (i_itemBitNo & 0x7F) << 8 | (i_argFlag & 0xFF) << 16; return fopAcM_create(PROC_Demo_Item, params, pos, i_roomNo, i_angle, i_scale); } @@ -961,10 +967,7 @@ fpc_ProcID fopAcM_createItemForBoss(cXyz* pos, int unused, int roomNo, csXyz* an /* 80026ADC-80026C90 .text fopAcM_createItem__FP4cXyziiiiP5csXyziP4cXyz */ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* angle, int action, cXyz* scale) { - int switchNo = 0xFF; - int switchNo2 = 0xFF; - - JUT_ASSERT(2915, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + JUT_ASSERT(VERSION_SELECT(2909, 2915, 2915, 2915), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); if (i_itemNo == dItem_NONE_e) { return fpcM_ERROR_PROCESS_ID_e; @@ -974,9 +977,11 @@ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN if (angle) { prmAngle = *angle; } + int switchNo = 0xFF; prmAngle.z = switchNo; u8 itemNo = check_itemno(i_itemNo); + int switchNo2 = -1; u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action); switch (i_itemNo) { @@ -997,10 +1002,8 @@ fpc_ProcID fopAcM_createItem(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomNo, int type, csXyz* angle, int action, cXyz* scale) { - int switchNo = 0xFF; - int switchNo2 = 0xFF; - - JUT_ASSERT(2995, 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); + + JUT_ASSERT(VERSION_SELECT(2989, 2995, 2995, 2995), 0 <= i_itemNo && i_itemNo < 256 && (-1 <= i_itemBitNo && i_itemBitNo <= 79) || i_itemBitNo == 127); int i; @@ -1013,9 +1016,11 @@ void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN if (angle) { prmAngle = *angle; } + int switchNo = 0xFF; prmAngle.z = switchNo; u8 itemNo = check_itemno(i_itemNo); + int switchNo2 = -1; u32 params = MAKE_ITEM_PARAMS(itemNo, i_itemBitNo, switchNo2, type, action); switch (i_itemNo) { @@ -1034,11 +1039,12 @@ void* fopAcM_fastCreateItem2(cXyz* pos, int i_itemNo, int i_itemBitNo, int roomN /* 80026E5C-80026F5C .text fopAcM_createItemForKP2__FP4cXyziiP5csXyzP4cXyzfffUs */ fopAc_ac_c* fopAcM_createItemForKP2(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, cXyz* scale, f32 speedF, f32 speedY, f32 gravity, u16 i_itemBitNo) { - JUT_ASSERT(0xc25, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(3103, 3109, 3109, 3109), 0 <= i_itemNo && i_itemNo < 256); if (i_itemNo == dItem_NONE_e) return NULL; - fopAc_ac_c* ac = (fopAc_ac_c*)fopAcM_fastCreate(PROC_SPC_ITEM01, i_itemNo | (i_itemBitNo & 0xFFFF) << 8, pos, roomNo, angle, scale); + u32 params = i_itemNo | (i_itemBitNo & 0xFFFF) << 8; + fopAc_ac_c* ac = (fopAc_ac_c*)fopAcM_fastCreate(PROC_SPC_ITEM01, params, pos, roomNo, angle, scale); if (ac != NULL) { fopAcM_SetSpeedF(ac, speedF); ac->speed.y = speedY; @@ -1058,12 +1064,7 @@ daItem_c* fopAcM_createItemForSimpleDemo(cXyz* pos, int i_itemNo, int roomNo, cs /* 80026F98-80027254 .text fopAcM_fastCreateItem__FP4cXyziiP5csXyzP4cXyzfffiPFPv_i */ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, cXyz* scale, f32 speedF, f32 speedY, f32 gravity, int i_itemBitNo, createFunc createFunc) { - int type = daItemType_0_e; - int action = daItemAct_A_e; - int switchNo = 0xFF; - int switchNo2 = 0xFF; - - JUT_ASSERT(3201, 0 <= i_itemNo && i_itemNo < 256); + JUT_ASSERT(VERSION_SELECT(3195, 3201, 3201, 3201), 0 <= i_itemNo && i_itemNo < 256); if (i_itemNo == dItem_NONE_e) { return NULL; } @@ -1071,6 +1072,9 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c int i; u8 itemNo = check_itemno(i_itemNo); + int type = daItemType_0_e; + int action = daItemAct_A_e; + int switchNo2 = -1; u8 itemBitNo = i_itemBitNo; u32 params = MAKE_ITEM_PARAMS(itemNo, itemBitNo, switchNo2, type, action); @@ -1092,6 +1096,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c } else { prmAngle = csXyz::Zero; } + int switchNo = 0xFF; prmAngle.z = switchNo; prmAngle.y += (int)cM_rndFX(0x2000); @@ -1121,6 +1126,7 @@ void* fopAcM_fastCreateItem(cXyz* pos, int i_itemNo, int roomNo, csXyz* angle, c } } +#if VERSION > VERSION_DEMO /* 80027254-80027280 .text stealItem_CB__FPv */ BOOL stealItem_CB(void* actor) { if (actor) { @@ -1130,6 +1136,7 @@ BOOL stealItem_CB(void* actor) { } return TRUE; } +#endif /* 80027280-800273D4 .text fopAcM_createStealItem__FP4cXyziiP5csXyzi */ void* fopAcM_createStealItem(cXyz* p_pos, int i_tblNo, int i_roomNo, csXyz* p_angle, int i_itemBitNo) { @@ -1158,7 +1165,16 @@ void* fopAcM_createStealItem(cXyz* p_pos, int i_tblNo, int i_roomNo, csXyz* p_an i_itemBitNo = -1; } +#if VERSION == VERSION_DEMO + daItem_c* item = (daItem_c*)fopAcM_fastCreateItem(p_pos, itemNo, i_roomNo, p_angle, NULL, 0.0f, 0.0f, -6.0f, i_itemBitNo); + if (item != NULL) { + item->scale.setall(1.0f); + item->setFlag(daItem_c::FLAG_HOOK); + } + return item; +#else return fopAcM_fastCreateItem(p_pos, itemNo, i_roomNo, p_angle, NULL, 0.0f, 0.0f, -6.0f, i_itemBitNo, stealItem_CB); +#endif } /* 800273D4-8002777C .text fopAcM_createItemFromEnemyTable__FUsiiP4cXyzP5csXyz */ @@ -1207,7 +1223,11 @@ void* fopAcM_createItemFromEnemyTable(u16 itemTableIdx, int i_itemBitNo, int i_r items[itemIdx] = getItemNoByLife(items[itemIdx]); return fopAcM_fastCreateItem( +#if VERSION == VERSION_DEMO + p_pos, items[itemIdx], i_roomNo, p_angle, &scale, +#else p_pos, items[itemIdx], i_roomNo, NULL, &scale, +#endif cM_rndFX(5.0f), 50.0f + cM_rndFX(10.0f), -6.0f, i_itemBitNo ); } @@ -1226,11 +1246,13 @@ fpc_ProcID fopAcM_createIball(cXyz* p_pos, int itemTableIdx, int i_roomNo, csXyz } if (dropChance > randPercent) { + u32 params = (u16)itemTableIdx | (i_itemBitNo & 0xFF) << 16; daIball_c::remove_old(); - void* item = fopAcM_fastCreate( - PROC_Iball, (u16)itemTableIdx | (i_itemBitNo & 0xFF) << 0x10, - p_pos, i_roomNo - ); +#if VERSION == VERSION_DEMO + void* item = fopAcM_fastCreate(PROC_Iball, params, p_pos, i_roomNo, p_angle); +#else + void* item = fopAcM_fastCreate(PROC_Iball, params, p_pos, i_roomNo); +#endif return fopAcM_GetID(item); } else { void* item = fopAcM_createItemFromEnemyTable( @@ -1259,10 +1281,10 @@ fopAc_ac_c * enemySearchJugge(void* ptr, void*) { /* 80027970-80027A9C .text fopAcM_myRoomSearchEnemy__FSc */ fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { - JUT_ASSERT(0xe07, roomNo >= 0); + JUT_ASSERT(VERSION_SELECT(3569, 3591, 3591, 3591), roomNo >= 0); scene_class* roomProc = fopScnM_SearchByID(dStage_roomControl_c::getStatusProcID(roomNo)); - JUT_ASSERT(0xe0a, roomProc != NULL); + JUT_ASSERT(VERSION_SELECT(3572, 3594, 3594, 3594), roomProc != NULL); fpc_ProcID grabProcID = daPy_getPlayerActorClass()->getGrabActorID(); fopAc_ac_c* enemy = fopAcM_SearchByID(grabProcID); @@ -1274,8 +1296,12 @@ fopAc_ac_c* fopAcM_myRoomSearchEnemy(s8 roomNo) { /* 80027A9C-80027B24 .text fopAcM_createDisappear__FP10fopAc_ac_cP4cXyzUcUcUc */ fpc_ProcID fopAcM_createDisappear(fopAc_ac_c* i_actor, cXyz* p_pos, u8 i_scale, u8 i_dropType, u8 i_itemBitNo) { - u32 params = (i_itemBitNo & 0xFF) << 0x10 | (i_scale & 0xFF) << 0x08 | (i_dropType & 0xFF); + u32 params = (i_itemBitNo & 0xFF) << 16 | (i_scale & 0xFF) << 8 | (i_dropType & 0xFF) << 0; +#if VERSION == VERSION_DEMO + fopAc_ac_c* disappear = (fopAc_ac_c*)fopAcM_fastCreate(PROC_DISAPPEAR, params, p_pos, fopAcM_GetRoomNo(i_actor)); +#else fopAc_ac_c* disappear = (fopAc_ac_c*)fopAcM_fastCreate(PROC_DISAPPEAR, params, p_pos, fopAcM_GetRoomNo(i_actor), fopAcM_GetAngle_p(i_actor)); +#endif if (disappear) { disappear->itemTableIdx = i_actor->itemTableIdx; } @@ -1294,25 +1320,26 @@ BOOL fopAcM_getGroundAngle(fopAc_ac_c* actor, csXyz* p_angle) { s16 targetAngleX; int targetAngleZ; if (pos.y != -G_CM3D_F_INF) { - f32 origY = pos.y + 50.0f; - gndChk.GetPointP()->set(pos.x, origY, pos.z + 10.0f); - f32 origX = gndChk.GetPointP()->x; - f32 origZ = gndChk.GetPointP()->z; + Vec chk_pos; + chk_pos.x = pos.x; + chk_pos.y = pos.y + 50.0f; + chk_pos.z = pos.z + 10.0f; + gndChk.SetPos(&chk_pos); f32 groundY = dComIfG_Bgsp()->GroundCross(&gndChk); if (groundY != -G_CM3D_F_INF) { - targetAngleX = -cM_atan2s(groundY - pos.y, origZ - pos.z); + targetAngleX = -cM_atan2s(groundY - pos.y, chk_pos.z - pos.z); } else { pos.y = pos.y; // ?? fakematch? ret = FALSE; } - origX = pos.x + 10.0f; - origY = pos.y + 50.0f; - f32 tempZ = pos.z; - gndChk.GetPointP()->set(origX, origY, tempZ); + chk_pos.x = pos.x + 10.0f; + chk_pos.y = pos.y + 50.0f; + chk_pos.z = pos.z; + gndChk.SetPos(&chk_pos); groundY = dComIfG_Bgsp()->GroundCross(&gndChk); if (groundY != -G_CM3D_F_INF) { - targetAngleZ = cM_atan2s(groundY - pos.y, origX - pos.x); + targetAngleZ = cM_atan2s(groundY - pos.y, chk_pos.x - pos.x); } else { ret = FALSE; } @@ -1386,7 +1413,7 @@ const char * fopAcM_getProcNameString(fopAc_ac_c* i_this) { /* 8002833C-80028410 .text fopAcM_findObjectCB__FP10fopAc_ac_cPv */ fopAc_ac_c* fopAcM_findObjectCB(fopAc_ac_c* it, void* i_prm) { fopAcM_search_prm* Prm = (fopAcM_search_prm*)i_prm; - JUT_ASSERT(4095, Prm); + JUT_ASSERT(VERSION_SELECT(4071, 4095, 4095, 4095), Prm); dStage_objectNameInf *inf = dStage_searchName(Prm->procname); if (inf == NULL) diff --git a/src/f_pc/f_pc_base.cpp b/src/f_pc/f_pc_base.cpp index 9bbad4888..2c210f3d1 100644 --- a/src/f_pc/f_pc_base.cpp +++ b/src/f_pc/f_pc_base.cpp @@ -41,11 +41,13 @@ fpc_ProcID fpcBs_MakeOfId() { /* 8003C904-8003C960 .text fpcBs_Execute__FP18base_process_class */ BOOL fpcBs_Execute(base_process_class* i_proc) { - BOOL result; - layer_class* savedLayer = fpcLy_CurrentLayer(); - fpcLy_SetCurrentLayer(i_proc->mLyTg.mpLayer); - result = fpcMtd_Execute(i_proc->mpPcMtd, i_proc); - fpcLy_SetCurrentLayer(savedLayer); + BOOL result = TRUE; + if (result == TRUE) { + layer_class* savedLayer = fpcLy_CurrentLayer(); + fpcLy_SetCurrentLayer(i_proc->mLyTg.mpLayer); + result = fpcMtd_Execute(i_proc->mpPcMtd, i_proc); + fpcLy_SetCurrentLayer(savedLayer); + } return result; } @@ -69,13 +71,16 @@ BOOL fpcBs_IsDelete(base_process_class* i_proc) { /* 8003C9FC-8003CA60 .text fpcBs_Delete__FP18base_process_class */ BOOL fpcBs_Delete(base_process_class* i_proc) { - BOOL deleteResult = fpcMtd_Delete(i_proc->mpPcMtd, i_proc); - if (deleteResult == TRUE) { - fpcBs_DeleteAppend(i_proc); - i_proc->mBsType = 0; - cMl::free(i_proc); + BOOL result = TRUE; + if (result == TRUE) { + result = fpcMtd_Delete(i_proc->mpPcMtd, i_proc); + if (result == TRUE) { + fpcBs_DeleteAppend(i_proc); + i_proc->mBsType = 0; + cMl::free(i_proc); + } } - return deleteResult; + return result; } /* 8003CA60-8003CB5C .text fpcBs_Create__FsUiPv */ diff --git a/src/f_pc/f_pc_executor.cpp b/src/f_pc/f_pc_executor.cpp index 9716c7dd7..5729114bd 100644 --- a/src/f_pc/f_pc_executor.cpp +++ b/src/f_pc/f_pc_executor.cpp @@ -39,7 +39,8 @@ s32 fpcEx_ToLineQ(base_process_class* i_proc) { base_process_class* pLayerPcNode = &pLayer->mpPcNode->base; if (pLayer->mLayerID == 0 || cTg_IsUse(&pLayerPcNode->mLnTg.base) == TRUE) { - s32 ret = fpcLnTg_ToQueue(&i_proc->mLnTg, i_proc->mPi.mInfoCurr.mListID); + u16 listID = i_proc->mPi.mInfoCurr.mListID; + s32 ret = fpcLnTg_ToQueue(&i_proc->mLnTg, listID); if (ret == 0) { fpcLyTg_QueueTo(&i_proc->mLyTg); return 0; diff --git a/src/f_pc/f_pc_pause.cpp b/src/f_pc/f_pc_pause.cpp index 32f1ca122..79d697788 100644 --- a/src/f_pc/f_pc_pause.cpp +++ b/src/f_pc/f_pc_pause.cpp @@ -33,7 +33,8 @@ s32 fpcPause_Enable(void* i_proc, u8 i_flag) { /* 800403AC-80040420 .text fpcPause_Disable__FPvUc */ s32 fpcPause_Disable(void* i_proc, u8 i_flag) { base_process_class* pProc = (base_process_class*)i_proc; - pProc->mPauseFlag &= (0xFF - i_flag) & 0xFF; + u8 mask = 0xFF - i_flag; + pProc->mPauseFlag &= mask; if (fpcBs_Is_JustOfType(g_fpcNd_type, pProc->mSubType)) { process_node_class* pNode = (process_node_class*)pProc; diff --git a/src/f_pc/f_pc_searcher.cpp b/src/f_pc/f_pc_searcher.cpp index 0464d4349..76a952e45 100644 --- a/src/f_pc/f_pc_searcher.cpp +++ b/src/f_pc/f_pc_searcher.cpp @@ -7,18 +7,14 @@ /* 80040050-80040068 .text fpcSch_JudgeForPName__FPvPv */ void* fpcSch_JudgeForPName(void* i_proc, void* i_data) { - s16 proc_name = *(s16*)i_data; - - if (((base_process_class*)i_proc)->mProcName == proc_name) + if (((base_process_class*)i_proc)->mProcName == *(s16*)i_data) return i_proc; return NULL; } /* 80040068-80040080 .text fpcSch_JudgeByID__FPvPv */ void* fpcSch_JudgeByID(void* i_proc, void* i_data) { - fpc_ProcID process_id = *(fpc_ProcID*)i_data; - - if (((base_process_class*)i_proc)->mBsPcId == process_id) + if (((base_process_class*)i_proc)->mBsPcId == *(fpc_ProcID*)i_data) return i_proc; return NULL; } diff --git a/src/m_Do/m_Do_MemCardRWmng.cpp b/src/m_Do/m_Do_MemCardRWmng.cpp index 521462655..60596c219 100644 --- a/src/m_Do/m_Do_MemCardRWmng.cpp +++ b/src/m_Do/m_Do_MemCardRWmng.cpp @@ -306,8 +306,7 @@ u32 mDoMemCdRWm_CalcCheckSum(void* p_, u32 size) { u16 mDoMemCdRWm_CalcCheckSumPictData(void* p, u32 size) { u16 csum = 0; for (int i = 0; i < size; i++) { - u8 v = ((u8*)p)[i]; - csum += v; + csum += ((u8*)p)[i]; } return csum; } diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp index 18b981d38..8ab347566 100644 --- a/src/m_Do/m_Do_ext.cpp +++ b/src/m_Do/m_Do_ext.cpp @@ -14,7 +14,7 @@ #include "SSystem/SComponent/c_m3d.h" #include "d/d_com_inf_game.h" #include "d/d_s_play.h" -#include "dolphin/gf/GFPixel.h" +#include "dolphin/gf/GF.h" #include "m_Do/m_Do_mtx.h" #include "m_Do/m_Do_printf.h" @@ -1856,7 +1856,7 @@ void mDoExt_3DlineMat0_c::setMaterial() { GXCallDisplayList(l_matDL, 0x80); } GXLoadPosMtxImm(j3dSys.getViewMtx(), GX_PNMTX0); - GXLoadNrmMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadNrmMtxImm(cMtx_getIdentity(), GX_PNMTX0); } /* 80014798-800148B4 .text draw__19mDoExt_3DlineMat0_cFv */ @@ -2119,7 +2119,7 @@ void mDoExt_3DlineMat1_c::setMaterial() { GXCallDisplayList(l_mat1DL, 0x80); } GXLoadPosMtxImm(j3dSys.getViewMtx(), GX_PNMTX0); - GXLoadNrmMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadNrmMtxImm(cMtx_getIdentity(), GX_PNMTX0); } /* 800155DC-80015764 .text draw__19mDoExt_3DlineMat1_cFv */ diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index cd14a4128..13b0e74ba 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -9,6 +9,7 @@ #include "d/d_drawlist.h" #include "d/d_meter.h" #include "d/d_s_play.h" +#include "dolphin/gf/GF.h" #include "f_ap/f_ap_game.h" #include "f_op/f_op_camera.h" #include "m_Do/m_Do_machine.h" @@ -31,6 +32,9 @@ #include "JSystem/JUtility/JUTXfb.h" #include "dolphin/base/PPCArch.h" +#include "weak_bss_936_to_1036.h" // IWYU pragma: keep +#include "weak_data_1811.h" // IWYU pragma: keep + JUTFader * mDoGph_gInf_c::mFader; ResTIMG * mDoGph_gInf_c::mFrameBufferTimg; GXTexObj mDoGph_gInf_c::mFrameBufferTexObj; @@ -52,9 +56,13 @@ s16 mDoGph_gInf_c::mMonotoneRateSpeed; mDoGph_gInf_c g_mDoGph_graphicInfo; OSThread mCaptureThread; +#if VERSION > VERSION_DEMO OSAlarm mCaptureTimeOutAlarm; +#endif s16 mCaptureStep; +#if VERSION > VERSION_DEMO bool mCaptureCansel; +#endif bool mCaptureEnableGXSetCopyFilter; u8* mCaptureThreadStackHead; u8* mCaptureCaptureBuffer; @@ -71,10 +79,15 @@ GXColor mDoGph_gInf_c::mFadeColor = {}; /* 80007BBC-80007DDC .text create__13mDoGph_gInf_cFv */ void mDoGph_gInf_c::create() { - JFWDisplay::createManager(JKRHeap::getCurrentHeap(), JUTXfb::Double, true); +#if VERSION == VERSION_DEMO + JKRHeap* heap = mDoExt_getZeldaHeap(); +#else + JKRHeap* heap = JKRHeap::getCurrentHeap(); +#endif + JFWDisplay::createManager(heap, JUTXfb::Double, true); JFWDisplay::getManager()->setDrawDoneMethod(JFWDisplay::Async); JUTFader* faderPtr = new JUTFader(0, 0, JUTVideo::getManager()->getRenderMode()->fb_width, JUTVideo::getManager()->getRenderMode()->efb_height, JUtility::TColor(0, 0, 0, 0)); - JUT_ASSERT(0x1a0, faderPtr != NULL); + JUT_ASSERT(VERSION_SELECT(414, 416, 416, 416), faderPtr != NULL); setFader(faderPtr); JFWDisplay::getManager()->setFader(faderPtr); JUTProcBar::getManager()->setVisibleHeapBar(false); @@ -108,13 +121,17 @@ void mDoGph_gInf_c::create() { /* 80007DDC-80007EA8 .text createHeap__13mDoGph_gInf_cFv */ void mDoGph_gInf_c::createHeap() { +#if VERSION == VERSION_DEMO + JKRHeap* parentHeap = mDoExt_getZeldaHeap(); +#else JKRHeap* parentHeap = JKRHeap::getCurrentHeap(); +#endif mHeap[0] = JKRSolidHeap::create(0x10000, parentHeap, false); - JUT_ASSERT(0x1eb, mHeap[0] != NULL); + JUT_ASSERT(VERSION_SELECT(488, 491, 491, 491), mHeap[0] != NULL); mHeap[1] = JKRSolidHeap::create(0x10000, parentHeap, false); - JUT_ASSERT(0x1ed, mHeap[1] != NULL); + JUT_ASSERT(VERSION_SELECT(490, 493, 493, 493), mHeap[1] != NULL); mCurrentHeap = 0; } @@ -139,7 +156,7 @@ void mDoGph_gInf_c::fadeOut(f32 speed, GXColor& color) { /* 80007F6C-80007F94 .text onBlure__13mDoGph_gInf_cFv */ void mDoGph_gInf_c::onBlure() { - onBlure(mDoMtx_getIdentity()); + onBlure(cMtx_getIdentity()); } /* 80007F94-80007FC4 .text onBlure__13mDoGph_gInf_cFPA4_Cf */ @@ -176,6 +193,7 @@ void mDoGph_gInf_c::calcFade() { } } +#if VERSION > VERSION_DEMO if (mFadeColor.a != 0) { GXSetNumChans(1); GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_NONE, GX_AF_NONE); @@ -199,7 +217,7 @@ void mDoGph_gInf_c::calcFade() { Mtx44 mtx; C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -211,6 +229,7 @@ void mDoGph_gInf_c::calcFade() { GXPosition3s8(0, 1, -5); GXEnd(); } +#endif } /* 800082D8-80008314 .text onMonotone__13mDoGph_gInf_cFv */ @@ -259,6 +278,10 @@ bool mDoGph_AfterOfDraw() { JUTProcBar::getManager()->setVisibleHeapBar(false); JUTDbPrint::getManager()->setVisible(true); } else { +#if VERSION == VERSION_DEMO + BOOL procVisible = false; + BOOL printVisible = false; +#else BOOL consoleVisible = JFWSystem::getSystemConsole()->isVisible(); BOOL pad3Connected = JUTGamePad::getPortStatus(JUTGamePad::Port_3).error == 0; BOOL procVisible = pad3Connected && fapGmHIO_getMeter() && !consoleVisible; @@ -267,6 +290,7 @@ bool mDoGph_AfterOfDraw() { procVisible = FALSE; printVisible = FALSE; } +#endif JUTProcBar::getManager()->setVisible(procVisible); JUTProcBar::getManager()->setVisibleHeapBar(procVisible); JUTDbPrint::getManager()->setVisible(printVisible); @@ -280,7 +304,11 @@ bool mDoGph_AfterOfDraw() { GXSetFogRangeAdj(GX_FALSE, 0, NULL); GXSetCoPlanar(GX_FALSE); GXSetZTexture(GX_ZT_DISABLE, GX_TF_Z8, 0); +#if VERSION == VERSION_DEMO + GXSetDither(GX_FALSE); +#else GXSetDither(GX_TRUE); +#endif GXSetClipMode(GX_CLIP_ENABLE); GXSetCullMode(GX_CULL_NONE); mDoMch_render_c::setFbWidth(fapGmHIO_getFbWidth()); @@ -291,6 +319,38 @@ bool mDoGph_AfterOfDraw() { return true; } +#if VERSION == VERSION_DEMO +void clearAlphaBuffer(view_class* view) { + #include "assets/l_matDL__clearAlphaBuffer__FP10view_class.h" + #include "assets/l_DL__clearAlphaBuffer__FP10view_class.h" + static s8 l_pos[][3] = { + {0x00, 0x00, 0xFB}, + {0x01, 0x00, 0xFB}, + {0x01, 0x01, 0xFB}, + {0x00, 0x01, 0xFB}, + }; + static GXVtxDescList l_vtxDescList[] = { + {GX_VA_POS, GX_INDEX8}, + {GX_VA_NULL, GX_NONE}, + }; + static GXVtxAttrFmtList l_vtxAttrFmtList[] = { + {GX_VA_POS, GX_POS_XYZ, GX_S8, 0x00}, + {GX_VA_NULL, GX_POS_XYZ, GX_F32, 0x00}, + }; + + GXCallDisplayList(l_matDL, 0x80); + Mtx44 mtx; + C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); + GXSetProjection(mtx, GX_ORTHOGRAPHIC); + GFSetVtxDescv(l_vtxDescList); + GFSetVtxAttrFmtv(GX_VTXFMT0, l_vtxAttrFmtList); + GFSetArray(GX_VA_POS, l_pos, sizeof(*l_pos)); + GFLoadPosMtxImm(cMtx_getIdentity(), 0); + GXCallDisplayList(l_DL, 0x20); + GFSetBlendModeEtc(GX_BM_NONE, GX_BL_ZERO, GX_BL_ZERO, GX_LO_CLEAR, 1, 0, 1); + GXSetProjection(view->mProjMtx, GX_PERSPECTIVE); +} +#else /* 80008600-80008880 .text clearAlphaBuffer__FP10view_classUc */ void clearAlphaBuffer(view_class* view, u8 alpha) { GXSetNumChans(1); @@ -319,7 +379,7 @@ void clearAlphaBuffer(view_class* view, u8 alpha) { Mtx44 mtx; C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -334,9 +394,64 @@ void clearAlphaBuffer(view_class* view, u8 alpha) { GXSetAlphaUpdate(GX_FALSE); GXSetProjection(view->mProjMtx, GX_PERSPECTIVE); } +#endif + +#if VERSION == VERSION_DEMO +static void dummy() { + #include "assets/l_matDL__4454.h" + #include "assets/l_DL__4455.h" + static s8 l_pos[][3] = { + {0x00, 0x00, 0x9C}, + {0x01, 0x00, 0x9C}, + {0x01, 0x01, 0x9C}, + {0x00, 0x01, 0x9C}, + }; + static GXVtxDescList l_vtxDescList[] = { + {GX_VA_POS, GX_INDEX8}, + {GX_VA_NULL, GX_NONE}, + }; + static GXVtxAttrFmtList l_vtxAttrFmtList[] = { + {GX_VA_POS, GX_POS_XYZ, GX_S8, 0x00}, + {GX_VA_NULL, GX_POS_XYZ, GX_F32, 0x00}, + }; +} +#endif /* 80008880-80008B0C .text drawAlphaBuffer__FP10view_class8_GXColor */ void drawAlphaBuffer(view_class* view, GXColor color) { +#if VERSION == VERSION_DEMO + #include "assets/l_matDL__drawAlphaBuffer__FP10view_class8_GXColor.h" + #include "assets/l_DL__drawAlphaBuffer__FP10view_class8_GXColor.h" + static s8 l_pos[][3] = { + {0x00, 0x00, 0xFB}, + {0x01, 0x00, 0xFB}, + {0x01, 0x01, 0xFB}, + {0x00, 0x01, 0xFB}, + }; + static GXVtxDescList l_vtxDescList[] = { + {GX_VA_POS, GX_INDEX8}, + {GX_VA_NULL, GX_NONE}, + }; + static GXVtxAttrFmtList l_vtxAttrFmtList[] = { + {GX_VA_POS, GX_POS_XYZ, GX_S8, 0x00}, + {GX_VA_NULL, GX_POS_XYZ, GX_F32, 0x00}, + }; + + GXCallDisplayList(l_matDL, 0x80); + GFSetChanMatColor(GX_COLOR0, color); + GFSetDstAlpha(GX_TRUE, 0); + Mtx44 mtx; + C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); + GXSetProjection(mtx, GX_ORTHOGRAPHIC); + GFSetVtxDescv(l_vtxDescList); + GFSetVtxAttrFmtv(GX_VTXFMT0, l_vtxAttrFmtList); + GFSetArray(GX_VA_POS, l_pos, sizeof(*l_pos)); + GFLoadPosMtxImm(cMtx_getIdentity(), 0); + GXCallDisplayList(l_DL, 0x20); + GFSetBlendModeEtc(GX_BM_NONE, GX_BL_ZERO, GX_BL_ZERO, GX_LO_CLEAR, 1, 0, 1); + GFSetDstAlpha(GX_FALSE, 0); + GXSetProjection(view->mProjMtx, GX_PERSPECTIVE); +#else GXSetNumChans(1); GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_NONE, GX_AF_NONE); GXSetChanMatColor(GX_COLOR0, color); @@ -362,7 +477,7 @@ void drawAlphaBuffer(view_class* view, GXColor color) { Mtx44 mtx; C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -377,10 +492,38 @@ void drawAlphaBuffer(view_class* view, GXColor color) { GXSetAlphaUpdate(GX_FALSE); GXSetDstAlpha(GX_FALSE, 0); GXSetProjection(view->mProjMtx, GX_PERSPECTIVE); +#endif } /* 80008B0C-80008F34 .text drawSpot__FP10view_class */ void drawSpot(view_class* view) { +#if VERSION == VERSION_DEMO + #include "assets/l_DL__drawSpot__FP10view_class.h" + static s8 l_pos[][3] = { + {0x00, 0x00, 0xFB}, + {0x01, 0x00, 0xFB}, + {0x01, 0x01, 0xFB}, + {0x00, 0x01, 0xFB}, + }; + static GXVtxDescList l_vtxDescList[] = { + {GX_VA_POS, GX_INDEX8}, + {GX_VA_NULL, GX_NONE}, + }; + static GXVtxAttrFmtList l_vtxAttrFmtList[] = { + {GX_VA_POS, GX_POS_XYZ, GX_S8, 0x00}, + {GX_VA_NULL, GX_POS_XYZ, GX_F32, 0x00}, + }; + + GFSetVtxDescv(l_vtxDescList); + GFSetVtxAttrFmtv(GX_VTXFMT0, l_vtxAttrFmtList); + GFSetArray(GX_VA_POS, l_pos, sizeof(*l_pos)); + Mtx44 mtx; + C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); + GXSetProjection(mtx, GX_ORTHOGRAPHIC); + GFLoadPosMtxImm(cMtx_getIdentity(), 0); + GXCallDisplayList(l_DL, 0xE0); + GXSetProjection(view->mProjMtx, GX_PERSPECTIVE); +#else GXSetNumChans(1); GXSetChanCtrl(GX_COLOR0A0, false, GX_SRC_REG, GX_SRC_REG, 0, GX_DF_NONE, GX_AF_NONE); GXSetChanAmbColor(GX_COLOR0A0, g_clearColor); @@ -406,7 +549,7 @@ void drawSpot(view_class* view) { Mtx44 mtx; C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -443,6 +586,7 @@ void drawSpot(view_class* view) { GXPosition3s8(0, 1, -5); GXEnd(); GXSetProjection(view->mProjMtx, GX_PERSPECTIVE); +#endif } /* 80008F34-8000990C .text drawDepth__FP10view_classP15view_port_classi */ @@ -525,12 +669,18 @@ void drawDepth(view_class* view, view_port_class* viewport, int depth) { GXPixModeSync(); GXLoadTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), GX_TEXMAP1); GXLoadTexObj(mDoGph_gInf_c::getZbufferTexObj(), GX_TEXMAP0); +#if VERSION == VERSION_DEMO + mDoGph_gInf_c::calcFade(); +#endif GXSetNumChans(0); GXSetNumTexGens(2); GXSetTexCoordGen(GX_TEXCOORD0, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GXSetTexCoordGen(GX_TEXCOORD1, GX_TG_MTX2x4, GX_TG_TEX0, GX_IDENTITY); GXSetNumTevStages(3); GXSetTevColorS10(GX_TEVREG0, l_tevColor0); +#if VERSION == VERSION_DEMO + GXSetTevColor(GX_TEVREG2, mDoGph_gInf_c::getFadeColor()); +#endif GXSetTevSwapModeTable(GX_TEV_SWAP3, GX_CH_ALPHA, GX_CH_GREEN, GX_CH_BLUE, GX_CH_RED); GXSetTevSwapMode(GX_TEVSTAGE0, GX_TEV_SWAP0, GX_TEV_SWAP3); GXSetTevKAlphaSel(GX_TEVSTAGE0, GX_TEV_KASEL_1); @@ -546,9 +696,17 @@ void drawDepth(view_class* view, view_port_class* viewport, int depth) { GXSetTevAlphaIn(GX_TEVSTAGE1, GX_CA_ZERO, GX_CA_APREV, GX_CA_TEXA, GX_CA_A0); GXSetTevAlphaOp(GX_TEVSTAGE1, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_4, GX_TRUE, GX_TEVPREV); GXSetTevOrder(GX_TEVSTAGE2, GX_TEXCOORD1, GX_TEXMAP1, GX_COLOR_NULL); +#if VERSION == VERSION_DEMO + GXSetTevColorIn(GX_TEVSTAGE2, GX_CC_TEXC, GX_CC_C2, GX_CC_A2, GX_CC_ZERO); +#else GXSetTevColorIn(GX_TEVSTAGE2, GX_CC_ZERO, GX_CC_ZERO, GX_CC_ZERO, GX_CC_TEXC); +#endif GXSetTevColorOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); +#if VERSION == VERSION_DEMO + GXSetTevAlphaIn(GX_TEVSTAGE2, GX_CA_APREV, GX_CA_KONST, GX_CA_A2, GX_CA_ZERO); +#else GXSetTevAlphaIn(GX_TEVSTAGE2, GX_CA_ZERO, GX_CA_ZERO, GX_CA_ZERO, GX_CA_APREV); +#endif GXSetTevAlphaOp(GX_TEVSTAGE2, GX_TEV_ADD, GX_TB_ZERO, GX_CS_SCALE_1, GX_TRUE, GX_TEVPREV); GXSetZCompLoc(GX_TRUE); GXSetZMode(GX_FALSE, GX_ALWAYS, GX_FALSE); @@ -558,10 +716,15 @@ void drawDepth(view_class* view, view_port_class* viewport, int depth) { GXSetCullMode(GX_CULL_NONE); GXSetDither(GX_TRUE); GXSetNumIndStages(0); +#if VERSION == VERSION_DEMO + GXSetTevDirect(GX_TEVSTAGE0); + GXSetTevDirect(GX_TEVSTAGE1); + GXSetTevDirect(GX_TEVSTAGE2); +#endif Mtx44 mtx; C_MTXOrtho(mtx, viewport->mYOrig, viewport->mYOrig + viewport->mHeight, viewport->mXOrig, viewport->mXOrig + viewport->mWidth, 0.0, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -648,7 +811,7 @@ void motionBlure(view_class* view) { Mtx44 mtx; C_MTXOrtho(mtx, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -711,6 +874,7 @@ void mDoGph_setCaptureCaptureFormat(u8 fmt) { mCaptureCaptureFormat = fmt; } +#if VERSION > VERSION_DEMO /* 80009C08-80009C38 .text mDoGph_CaptureCansel__Fv */ void mDoGph_CaptureCansel() { if (mCaptureStep < 0) { @@ -720,6 +884,7 @@ void mDoGph_CaptureCansel() { mCaptureCansel = true; } } +#endif #define COLOR_SQUARE_MAG(r0, g0, b0, r1, g1, b1) (r0 - r1)*(r0 - r1) + (g0 - g1)*(g0 - g1) + (b0 - b1)*(b0 - b1) @@ -997,7 +1162,7 @@ void setUpRectangle() { Mtx44 mtx; C_MTXOrtho(mtx, -21.0f, 503.0f, -9.0f, 650.0f, 0.0f, 10.0f); GXSetProjection(mtx, GX_ORTHOGRAPHIC); - GXLoadPosMtxImm(mDoMtx_getIdentity(), GX_PNMTX0); + GXLoadPosMtxImm(cMtx_getIdentity(), GX_PNMTX0); GXSetCurrentMtx(GX_PNMTX0); GXClearVtxDesc(); GXSetVtxDesc(GX_VA_POS, GX_DIRECT); @@ -1020,6 +1185,7 @@ void drawRectangle(int x0, int y0, int x1, int y1) { GXEnd(); } +#if VERSION > VERSION_DEMO /* 8000A7F0-8000A8B8 .text mDoGph_allocFromAny__FUli */ u8* mDoGph_allocFromAny(u32 size, int align) { void* mem = JKRAllocFromHeap(mDoExt_getZeldaHeap(), size, align); @@ -1034,6 +1200,7 @@ u8* mDoGph_allocFromAny(u32 size, int align) { memset(mem, 0, size); return (u8*)mem; } +#endif /* 8000A8B8-8000AAC4 .text mDoGph_screenCaptureDraw__Fv */ void mDoGph_screenCaptureDraw() { @@ -1090,24 +1257,31 @@ out: /* 8000AAC4-8000AB1C .text mCaptureProc__FPv */ u32 mCaptureProc(void* dummy) { u32 bytesCopied = encode_s3tc(mCaptureCaptureBuffer, mCaptureTextureBuffer, mCaptureSizeWidth, mCaptureSizeHeight, (GXTexFmt)mCaptureCaptureFormat); +#if VERSION > VERSION_DEMO DCStoreRange(mCaptureTextureBuffer, mCaptureTextureSize); +#endif OSExitThread((void*)bytesCopied); return bytesCopied; } /* 8000AB1C-8000ABC4 .text mCaptureGXDrawSyncCallback__FUs */ void mCaptureGXDrawSyncCallback(u16) { +#if VERSION > VERSION_DEMO OSCancelAlarm(&mCaptureTimeOutAlarm); BOOL interrupt = OSDisableInterrupts(); if (mCaptureStep == 2) { +#endif void* oldcb = (void*)GXSetDrawSyncCallback(mCaptureOldCB); - JUT_ASSERT(0xa5f, oldcb == mCaptureGXDrawSyncCallback); + JUT_ASSERT(VERSION_SELECT(2580, 2655, 2655, 2655), oldcb == mCaptureGXDrawSyncCallback); mCaptureOldCB = NULL; mCaptureStep++; +#if VERSION > VERSION_DEMO } OSRestoreInterrupts(interrupt); +#endif } +#if VERSION > VERSION_DEMO /* 8000ABC4-8000AC3C .text mCaptureGXDrawSyncTimeOut__FP7OSAlarmP9OSContext */ void mCaptureGXDrawSyncTimeOut(OSAlarm*, OSContext*) { OSReport_Error("キャプチャタイムアウト\n"); @@ -1122,6 +1296,7 @@ void mCaptureGXDrawSyncTimeOut(OSAlarm*, OSContext*) { } mCaptureStep = -1; } +#endif /* 8000AC3C-8000AEA4 .text mDoGph_screenCapture__Fv */ bool mDoGph_screenCapture() { @@ -1137,7 +1312,11 @@ bool mDoGph_screenCapture() { u32 left, top, width, height; mCaptureTextureSize = GXGetTexBufferSize(sizeW, sizeH, mCaptureTextureFormat, GX_FALSE, 0); +#if VERSION == VERSION_DEMO + mCaptureTextureBuffer = (u8*)JKRAlloc(mCaptureTextureSize, 0x20); +#else mCaptureTextureBuffer = mDoGph_allocFromAny(mCaptureTextureSize, 0x20); +#endif if (mCaptureTextureBuffer == NULL) { mCaptureStep = -1; return false; @@ -1145,7 +1324,11 @@ bool mDoGph_screenCapture() { if (mCaptureTextureFormat == GX_TF_CMPR) { mCaptureCaptureSize = GXGetTexBufferSize(sizeW, sizeH, mCaptureCaptureFormat, GX_FALSE, 0); +#if VERSION == VERSION_DEMO + mCaptureCaptureBuffer = (u8*)JKRAlloc(mCaptureCaptureSize, 0x20); +#else mCaptureCaptureBuffer = mDoGph_allocFromAny(mCaptureCaptureSize, 0x20); +#endif if (mCaptureCaptureBuffer == NULL) { JKRFreeToHeap(NULL, mCaptureTextureBuffer); mCaptureTextureBuffer = NULL; @@ -1168,14 +1351,18 @@ bool mDoGph_screenCapture() { setUpRectangle(); GXSetTexCopySrc(centerX - sizeW, centerY - sizeH, sizeW2, sizeH2); GXSetTexCopyDst(sizeW, sizeH, (GXTexFmt)mCaptureCaptureFormat, GX_TRUE); +#if VERSION > VERSION_DEMO DCInvalidateRange(mCaptureCaptureBuffer, mCaptureCaptureSize); +#endif GXCopyTex(mCaptureCaptureBuffer, GX_FALSE); GXPixModeSync(); - JUT_ASSERT(0xac1, mCaptureOldCB == NULL); + JUT_ASSERT(VERSION_SELECT(2657, 2753, 2753, 2753), mCaptureOldCB == NULL); mCaptureOldCB = GXSetDrawSyncCallback(mCaptureGXDrawSyncCallback); +#if VERSION > VERSION_DEMO OSCreateAlarm(&mCaptureTimeOutAlarm); OSSetAlarm(&mCaptureTimeOutAlarm, mCaptureTimeOutTicks, mCaptureGXDrawSyncTimeOut); +#endif mCaptureStep++; GXSetDrawSync(GX_FALSE); GXSetProjectionv(projv); @@ -1198,19 +1385,25 @@ void setLight() { /* 8000AF2C-8000BC38 .text mDoGph_Painter__Fv */ bool mDoGph_Painter() { +#if VERSION > VERSION_DEMO JFWDisplay::getManager()->setFader(mDoGph_gInf_c::mFader); +#endif mDoGph_gInf_c::setClearColor(mDoGph_gInf_c::getBackColor()); mDoGph_gInf_c::beginRender(); GXSetAlphaUpdate(GX_FALSE); +#if VERSION > VERSION_DEMO mDoGph_gInf_c::setBackColor(g_clearColor); +#endif mDoGph_gInf_c::free(); if (mCaptureEnableGXSetCopyFilter) GXSetCopyFilter(GX_FALSE, NULL, GX_FALSE, NULL); j3dSys.drawInit(); +#if VERSION > VERSION_DEMO GXSetDither(GX_TRUE); +#endif J2DOrthoGraph graf(0.0f, 0.0f, 640.0f, 480.0f, -1.0f, 1.0f); graf.setOrtho(JGeometry::TBox2(-9.0f, -21.0f, 650.0f, 503.0f), -1.0f, 1.0f); @@ -1246,9 +1439,11 @@ bool mDoGph_Painter() { jpaDrawInfo.setFovy(camera->mFovy); jpaDrawInfo.setAspect(camera->mAspect); +#if VERSION > VERSION_DEMO BOOL isTower9 = FALSE; if (strcmp(dComIfGp_getStartStageName(), "GTower") == 0 && dComIfGp_getStartStageLayer() == 9) isTower9 = TRUE; +#endif dComIfGp_setCurrentWindow(window); dComIfGp_setCurrentView(camera); dComIfGp_setCurrentViewport(viewport_p); @@ -1268,7 +1463,11 @@ bool mDoGph_Painter() { dComIfGd_drawAlphaModel(camera->mViewMtx); drawAlphaBuffer(camera, dComIfGd_getAlphaModelColor()); if (dComIfGd_getLightModelNum() != 0) { +#if VERSION == VERSION_DEMO + clearAlphaBuffer(camera); +#else clearAlphaBuffer(camera, 0); +#endif dComIfGd_drawLightModel(camera->mViewMtx); drawAlphaBuffer(camera, dComIfGd_getLightModelColor()); } @@ -1282,7 +1481,11 @@ bool mDoGph_Painter() { dComIfGd_drawXluListBG(); if (dComIfGd_getSpotModelNum() != 0) +#if VERSION == VERSION_DEMO + clearAlphaBuffer(camera); +#else clearAlphaBuffer(camera, dComIfGd_getSpotModelColor().a); +#endif if (!dMenu_flag() && !dPa_control_c::isStatus(0x01)) dComIfGp_particle_drawShipTail(&jpaDrawInfo); @@ -1313,8 +1516,10 @@ bool mDoGph_Painter() { dComIfGd_drawOpaListFilter(); +#if VERSION > VERSION_DEMO j3dSys.reinitGX(); GXSetNumIndStages(0); +#endif if (dComIfGd_getSpotModelNum() != 0) { dComIfGd_drawAlphaModel(camera->mViewMtx); @@ -1322,6 +1527,10 @@ bool mDoGph_Painter() { drawSpot(camera); } +#if VERSION == VERSION_DEMO + j3dSys.reinitGX(); +#endif + GXSetClipMode(GX_CLIP_ENABLE); dComIfGd_drawOpaListMaskOff(); dComIfGd_drawXluListMaskOff(); @@ -1335,14 +1544,19 @@ bool mDoGph_Painter() { dComIfGd_drawOpaListInvisible(); dComIfGd_drawXluListInvisible(); +#if VERSION > VERSION_DEMO j3dSys.reinitGX(); GXSetNumIndStages(0); - if (isTower9) dComIfGp_particle_draw(&jpaDrawInfo); +#endif if (mDoGph_gInf_c::isMonotone()) { +#if VERSION == VERSION_DEMO + clearAlphaBuffer(camera); +#else clearAlphaBuffer(camera, 0); +#endif dComIfGd_drawOpaListP0(); dComIfGd_drawOpaListP1(); dComIfGd_drawXluListP1(); @@ -1350,6 +1564,13 @@ bool mDoGph_Painter() { dComIfGp_particle_drawToonP1(&jpaDrawInfo); } +#if VERSION == VERSION_DEMO + if (mCaptureStep == 1) { + mDoGph_screenCapture(); + } +#endif + +#if VERSION > VERSION_DEMO mDoGph_gInf_c::calcFade(); if (mCaptureStep == 1) { if (!mCaptureCansel) @@ -1357,11 +1578,13 @@ bool mDoGph_Painter() { else mCaptureStep = 0; } +#endif } } } if (mCaptureStep == 3) { +#if VERSION > VERSION_DEMO if (mCaptureCansel) { if (mCaptureCaptureBuffer != NULL) { JKRFreeToHeap(NULL, mCaptureCaptureBuffer); @@ -1372,18 +1595,28 @@ bool mDoGph_Painter() { mCaptureTextureBuffer = NULL; } mCaptureStep = 0; - } else { + } else +#endif + { if (mCaptureTextureFormat == GX_TF_CMPR) { +#if VERSION == VERSION_DEMO + mCaptureThreadStackHead = (u8*)JKRAlloc(mCaptureThreadStackSize, 0x20); +#else mCaptureThreadStackHead = mDoGph_allocFromAny(mCaptureThreadStackSize, 0x20); +#endif if (mCaptureThreadStackHead == NULL) { mCaptureProc(NULL); - if (mCaptureCaptureBuffer != NULL) { +#if VERSION > VERSION_DEMO + if (mCaptureCaptureBuffer != NULL) +#endif + { JKRFreeToHeap(NULL, mCaptureCaptureBuffer); mCaptureCaptureBuffer = NULL; } mCaptureStep = 5; } else { - OSCreateThread(&mCaptureThread, (void*)mCaptureProc, NULL, mCaptureThreadStackHead + mCaptureThreadStackSize, mCaptureThreadStackSize, mCaptureThreadPriority, 0); + u8* captureThreadStackBase = mCaptureThreadStackHead + mCaptureThreadStackSize; + OSCreateThread(&mCaptureThread, (void*)mCaptureProc, NULL, captureThreadStackBase, mCaptureThreadStackSize, mCaptureThreadPriority, 0); OSResumeThread(&mCaptureThread); mCaptureStep++; } @@ -1395,17 +1628,25 @@ bool mDoGph_Painter() { } if (mCaptureStep == 4) { +#if VERSION > VERSION_DEMO if (mCaptureCansel) { OSCancelThread(&mCaptureThread); } +#endif if (OSIsThreadTerminated(&mCaptureThread)) { - if (mCaptureCaptureBuffer != NULL) { +#if VERSION > VERSION_DEMO + if (mCaptureCaptureBuffer != NULL) +#endif + { JKRFreeToHeap(NULL, mCaptureCaptureBuffer); mCaptureCaptureBuffer = NULL; } - if (mCaptureThreadStackHead != NULL) { +#if VERSION > VERSION_DEMO + if (mCaptureThreadStackHead != NULL) +#endif + { JKRFreeToHeap(NULL, mCaptureThreadStackHead); mCaptureThreadStackHead = NULL; } @@ -1415,36 +1656,55 @@ bool mDoGph_Painter() { mCaptureStep++; } else { OSAlarm alarm; +#if VERSION == VERSION_DEMO + OSCreateAlarm(&alarm); + OSInitThreadQueue(&mCaptureThreadQueue); + OSSetAlarm(&alarm, OSMillisecondsToTicks(3), mCaptureAlarmHandler); +#else u64 tickNum = OSMillisecondsToTicks(10); OSCreateAlarm(&alarm); OSInitThreadQueue(&mCaptureThreadQueue); OSSetAlarm(&alarm, tickNum, mCaptureAlarmHandler); +#endif OSSleepThread(&mCaptureThreadQueue); OSCancelAlarm(&alarm); } } - if ((mCaptureStep == 3 || mCaptureStep == 4 || mCaptureStep == 5) && mCaptureDraw != 0 && !mCaptureCansel) { + if ((mCaptureStep == 3 || mCaptureStep == 4 || mCaptureStep == 5) && mCaptureDraw != 0 +#if VERSION > VERSION_DEMO + && !mCaptureCansel +#endif + ) { mDoGph_screenCaptureDraw(); } +#if VERSION > VERSION_DEMO if (mCaptureStep == 5 && mCaptureCansel) { mCaptureStep = 6; } +#endif if (mCaptureStep == 6) { - if (mCaptureTextureBuffer != NULL) { +#if VERSION > VERSION_DEMO + if (mCaptureTextureBuffer != NULL) +#endif + { JKRFreeToHeap(NULL, mCaptureTextureBuffer); mCaptureTextureBuffer = NULL; } mCaptureStep = 0; +#if VERSION > VERSION_DEMO mCaptureCansel = false; +#endif } dDlst_list_c::calcWipe(); j3dSys.reinitGX(); +#if VERSION > VERSION_DEMO GXSetNumIndStages(0); +#endif graf.setOrtho(JGeometry::TBox2(-9.0f, -21.0f, 650.0f, 503.0f), 100000.0f, -100000.0f); graf.setPort(); @@ -1466,7 +1726,9 @@ bool mDoGph_Painter() { j3dSys.setViewMtx(mDoMtx_stack_c::get()); dComIfGd_drawOpaList2D(); j3dSys.reinitGX(); +#if VERSION > VERSION_DEMO GXSetNumIndStages(0); +#endif j3dSys.setViewMtx(viewMtx); } @@ -1485,11 +1747,15 @@ bool mDoGph_Painter() { /* 8000BC94-8000BD08 .text mDoGph_Create__Fv */ bool mDoGph_Create() { +#if VERSION > VERSION_DEMO JKRSolidHeap * solidHeap = mDoExt_createSolidHeapToCurrent(0, NULL, 0); +#endif mDoGph_gInf_c::create(); dComIfGd_init(); +#if VERSION > VERSION_DEMO mDoExt_adjustSolidHeap(solidHeap); mDoExt_restoreCurrentHeap(); JFWAutoAbortGfx = mDoMain::developmentMode ? 0x02 : 0x01; +#endif return true; }