From efc33c5fc400aad29d8483411804ca8a3588997d Mon Sep 17 00:00:00 2001 From: LagoLunatic Date: Thu, 19 Jun 2025 19:03:11 -0400 Subject: [PATCH] Various inline cleanup --- .vscode/tasks.json | 2 +- .../JSystem/J3DGraphAnimator/J3DAnimation.h | 20 +- include/JSystem/J3DGraphAnimator/J3DCluster.h | 7 +- .../JSystem/J3DGraphAnimator/J3DShapeTable.h | 1 + include/JSystem/J3DGraphBase/J3DMatBlock.h | 343 +++++++++--------- include/JSystem/J3DGraphBase/J3DShapeMtx.h | 7 +- include/JSystem/J3DGraphBase/J3DSys.h | 5 +- include/JSystem/J3DGraphBase/J3DTexture.h | 6 +- include/JSystem/JUtility/JUTAssert.h | 4 + include/d/actor/d_a_obj_movebox.h | 9 +- include/d/actor/d_a_player_main.h | 8 +- include/d/actor/d_a_salvage.h | 8 +- include/d/d_attention.h | 6 +- include/d/d_com_inf_game.h | 12 +- include/d/d_map.h | 63 ++-- include/m_Do/m_Do_MemCard.h | 3 +- .../J3DGraphAnimator/J3DMaterialAttach.cpp | 18 +- src/d/actor/d_a_player_main.cpp | 49 +-- src/d/actor/d_a_tag_msg.cpp | 2 +- src/d/d_event.cpp | 6 +- src/d/d_event_manager.cpp | 8 +- src/d/d_file_select.cpp | 6 +- src/d/d_map.cpp | 23 +- src/m_Do/m_Do_graphic.cpp | 3 +- 24 files changed, 341 insertions(+), 278 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 63dec1f94..1a1f9e7a2 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -11,7 +11,7 @@ "GZLJ01", "GZLE01", "GZLP01", - "D44J01 --debug", + "D44J01 --debug --map", ], "default": "GZLE01", "description": "Game version to build." diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h index b75788d3c..c25b79968 100644 --- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h +++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h @@ -424,7 +424,10 @@ public: calcTransform(getFrame(), idx, pSRTInfo); } - u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; } + u16 getUpdateMaterialID(u16 idx) const { + J3D_ASSERT(1029, idx < mTrackNum / 3, "Error : range over."); + return mUpdateMaterialID[idx]; + } u16 getUpdateMaterialNum() const { return mTrackNum / 3; } JUTNameTab * getUpdateMaterialName() { return &mUpdateMaterialName; } u16 getUpdateTexMtxID(u16 idx) const { @@ -515,7 +518,10 @@ public: void searchUpdateMaterialID(J3DMaterialTable*); void searchUpdateMaterialID(J3DModelData*); - u16 getUpdateMaterialID(u16 idx) const { return mUpdateMaterialID[idx]; } + u16 getUpdateMaterialID(u16 idx) const { + J3D_ASSERT(2288, idx < mUpdateMaterialNum, "Error : range over."); + return mUpdateMaterialID[idx]; + } u16 getUpdateMaterialNum() const { return mUpdateMaterialNum; } JUTNameTab * getUpdateMaterialName() { return &mUpdateMaterialName; } @@ -570,8 +576,14 @@ public: u16 getCRegUpdateMaterialNum() const { return mCRegUpdateMaterialNum; } u16 getKRegUpdateMaterialNum() const { return mKRegUpdateMaterialNum; } - u16 getCRegUpdateMaterialID(u16 idx) const { return mCRegUpdateMaterialID[idx]; } - u16 getKRegUpdateMaterialID(u16 idx) const { return mKRegUpdateMaterialID[idx]; } + u16 getCRegUpdateMaterialID(u16 idx) const { + J3D_ASSERT(2100, idx < mCRegUpdateMaterialNum, "Error : range over."); + return mCRegUpdateMaterialID[idx]; + } + u16 getKRegUpdateMaterialID(u16 idx) const { + J3D_ASSERT(2140, idx < mKRegUpdateMaterialNum, "Error : range over."); + return mKRegUpdateMaterialID[idx]; + } JUTNameTab * getCRegUpdateMaterialName() { return &mCRegUpdateMaterialName; } JUTNameTab * getKRegUpdateMaterialName() { return &mKRegUpdateMaterialName; } diff --git a/include/JSystem/J3DGraphAnimator/J3DCluster.h b/include/JSystem/J3DGraphAnimator/J3DCluster.h index 00038a877..1720e073c 100644 --- a/include/JSystem/J3DGraphAnimator/J3DCluster.h +++ b/include/JSystem/J3DGraphAnimator/J3DCluster.h @@ -71,10 +71,13 @@ public: u16 getClusterNum() const { return mClusterNum; } u16 getClusterKeyNum() const { return mClusterKeyNum; } J3DCluster* getClusterPointer(u16 index) { - J3D_ASSERT(186, (index < mClusterNum),"Error : range over."); + J3D_ASSERT(186, (index < mClusterNum), "Error : range over."); return &mClusterPointer[index]; } - J3DClusterKey* getClusterKeyPointer(u16 i) { return &mClusterKeyPointer[i]; } + J3DClusterKey* getClusterKeyPointer(u16 i) { + J3D_ASSERT(199, (i < mClusterKeyNum), "Error : range over."); + return &mClusterKeyPointer[i]; + } f32* getVtxPos() { return mVtxPos; } f32* getVtxNrm() { return mVtxNrm; } diff --git a/include/JSystem/J3DGraphAnimator/J3DShapeTable.h b/include/JSystem/J3DGraphAnimator/J3DShapeTable.h index 55c7cab73..426866afe 100644 --- a/include/JSystem/J3DGraphAnimator/J3DShapeTable.h +++ b/include/JSystem/J3DGraphAnimator/J3DShapeTable.h @@ -6,6 +6,7 @@ class JUTNameTab; +// TODO: This class doesn't seem to exist in the debug maps, probably copied from TP. Remove? class J3DShapeTable { public: inline void clear() { diff --git a/include/JSystem/J3DGraphBase/J3DMatBlock.h b/include/JSystem/J3DGraphBase/J3DMatBlock.h index 67434e804..41a98e0b3 100644 --- a/include/JSystem/J3DGraphBase/J3DMatBlock.h +++ b/include/JSystem/J3DGraphBase/J3DMatBlock.h @@ -82,10 +82,10 @@ public: virtual void setTexGenNum(u32 const* pNum) { mTexGenNum = *pNum; } virtual void setTexGenNum(u32 num) { mTexGenNum = num; } virtual u32 getTexGenNum() const { return mTexGenNum; } - virtual void setTexCoord(u32 i, J3DTexCoord const* pCoord) { mTexCoord[i] = *pCoord; } - virtual J3DTexCoord* getTexCoord(u32 i) { return &mTexCoord[i]; } - virtual void setTexMtx(u32 i, J3DTexMtx* pMtx) { mTexMtx[i] = pMtx; } - virtual J3DTexMtx* getTexMtx(u32 i) { return mTexMtx[i]; } + virtual void setTexCoord(u32 idx, J3DTexCoord const* pCoord) { mTexCoord[idx] = *pCoord; } + virtual J3DTexCoord* getTexCoord(u32 idx) { return &mTexCoord[idx]; } + virtual void setTexMtx(u32 idx, J3DTexMtx* pMtx) { mTexMtx[idx] = pMtx; } + virtual J3DTexMtx* getTexMtx(u32 idx) { return mTexMtx[idx]; } virtual u32 getTexMtxOffset() const { return mTexMtxOffset; } virtual void setTexMtxOffset(u32 offs) { mTexMtxOffset = offs; } virtual ~J3DTexGenBlockPatched() {} @@ -177,10 +177,10 @@ public: virtual void setTevKColor(u32, J3DGXColor const*) {} virtual void setTevKColor(u32, J3DGXColor) {} virtual J3DGXColor* getTevKColor(u32) { return NULL; } - virtual void setTevKColorSel(u32 i, const u8* pNum) {} + virtual void setTevKColorSel(u32 idx, const u8* pNum) {} virtual void setTevKColorSel(u32, u8) {} virtual u8 getTevKColorSel(u32) { return 0; } - virtual void setTevKAlphaSel(u32 i, const u8* pNum) {} + virtual void setTevKAlphaSel(u32 idx, const u8* pNum) {} virtual void setTevKAlphaSel(u32, u8) {} virtual u8 getTevKAlphaSel(u32) { return 0; } virtual void setTevStageNum(u8 const*) {} @@ -189,9 +189,9 @@ public: virtual void setTevStage(u32, J3DTevStage const*) {} virtual void setTevStage(u32, J3DTevStage) {} virtual J3DTevStage* getTevStage(u32) { return NULL; } - virtual void setTevSwapModeInfo(u32 i, const J3DTevSwapModeInfo* pInfo) {} - virtual void setTevSwapModeInfo(u32 i, J3DTevSwapModeInfo info) {} - virtual void setTevSwapModeTable(u32 i, const J3DTevSwapModeTable* pTable) {} + virtual void setTevSwapModeInfo(u32 idx, const J3DTevSwapModeInfo* pInfo) {} + virtual void setTevSwapModeInfo(u32 idx, J3DTevSwapModeInfo info) {} + virtual void setTevSwapModeTable(u32 idx, const J3DTevSwapModeTable* pTable) {} virtual void setTevSwapModeTable(u32, J3DTevSwapModeTable) {} virtual J3DTevSwapModeTable* getTevSwapModeTable(u32) { return NULL; } virtual void setIndTevStage(u32, J3DIndTevStage const*) {} @@ -232,27 +232,30 @@ public: virtual void setTevStageNum(const u8* pNum) { mTevStageNum = *pNum; } virtual void setTevStageNum(u8 num) { mTevStageNum = num; } virtual u8 getTevStageNum() const { return mTevStageNum; } - virtual void setTexNo(u32 i, const u16* pNo) { mTexNo[i] = *pNo; } - virtual void setTexNo(u32 i, u16 no) { mTexNo[i] = no; } - virtual u16 getTexNo(u32 i) const { return mTexNo[i]; } - virtual void setTevOrder(u32 i, const J3DTevOrder* pOrder) { mTevOrder[i] = *pOrder; } - virtual void setTevOrder(u32 i, J3DTevOrder order) { mTevOrder[i] = order; } - virtual J3DTevOrder* getTevOrder(u32 i) { return &mTevOrder[i]; } - virtual void setTevStage(u32 i, const J3DTevStage* pStage) { mTevStage[i] = *pStage; } - virtual void setTevStage(u32 i, J3DTevStage stage) { mTevStage[i] = stage; } - virtual J3DTevStage* getTevStage(u32 i) { return &mTevStage[i]; } - virtual void setIndTevStage(u32 i, const J3DIndTevStage* pStage) { mIndTevStage[i] = *pStage; } - virtual void setIndTevStage(u32 i, J3DIndTevStage stage) { mIndTevStage[i] = stage; } - virtual J3DIndTevStage* getIndTevStage(u32 i) { return &mIndTevStage[i]; } - virtual void setTevColor(u32 i, const J3DGXColorS10* pColor) { mTevColor[i] = *pColor; } - virtual void setTevColor(u32 i, J3DGXColorS10 color) { mTevColor[i] = color; } - virtual J3DGXColorS10* getTevColor(u32 i) { return &mTevColor[i]; } - virtual void setTevKColor(u32 i, const J3DGXColor* pColor) { mTevKColor[i] = *pColor; } - virtual void setTevKColor(u32 i, J3DGXColor color) { mTevKColor[i] = color; } - virtual J3DGXColor* getTevKColor(u32 i) { return &mTevKColor[i]; } - virtual void setTevKColorSel(u32 i, const u8* pSel) { mTevKColorSel[i] = *pSel; } - virtual void setTevKColorSel(u32 i, u8 sel) { mTevKColorSel[i] = sel; } - virtual u8 getTevKColorSel(u32 i) { return mTevKColorSel[i]; } + virtual void setTexNo(u32 idx, const u16* pNo) { mTexNo[idx] = *pNo; } + virtual void setTexNo(u32 idx, u16 no) { mTexNo[idx] = no; } + virtual u16 getTexNo(u32 idx) const { + J3D_ASSERT(1353, idx < 8, "Error : range over."); + return mTexNo[idx]; + } + virtual void setTevOrder(u32 idx, const J3DTevOrder* pOrder) { mTevOrder[idx] = *pOrder; } + virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; } + virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; } + virtual void setTevStage(u32 idx, const J3DTevStage* pStage) { mTevStage[idx] = *pStage; } + virtual void setTevStage(u32 idx, J3DTevStage stage) { mTevStage[idx] = stage; } + virtual J3DTevStage* getTevStage(u32 idx) { return &mTevStage[idx]; } + virtual void setIndTevStage(u32 idx, const J3DIndTevStage* pStage) { mIndTevStage[idx] = *pStage; } + virtual void setIndTevStage(u32 idx, J3DIndTevStage stage) { mIndTevStage[idx] = stage; } + virtual J3DIndTevStage* getIndTevStage(u32 idx) { return &mIndTevStage[idx]; } + virtual void setTevColor(u32 idx, const J3DGXColorS10* pColor) { mTevColor[idx] = *pColor; } + virtual void setTevColor(u32 idx, J3DGXColorS10 color) { mTevColor[idx] = color; } + virtual J3DGXColorS10* getTevColor(u32 idx) { return &mTevColor[idx]; } + virtual void setTevKColor(u32 idx, const J3DGXColor* pColor) { mTevKColor[idx] = *pColor; } + virtual void setTevKColor(u32 idx, J3DGXColor color) { mTevKColor[idx] = color; } + virtual J3DGXColor* getTevKColor(u32 idx) { return &mTevKColor[idx]; } + virtual void setTevKColorSel(u32 idx, const u8* pSel) { mTevKColorSel[idx] = *pSel; } + virtual void setTevKColorSel(u32 idx, u8 sel) { mTevKColorSel[idx] = sel; } + virtual u8 getTevKColorSel(u32 idx) { return mTevKColorSel[idx]; } virtual u32 getTexNoOffset() const { return mTexNoOffset; } virtual u32 getTevRegOffset() const { return mTevRegOffset; } @@ -303,42 +306,45 @@ public: virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } virtual u32 getType() { return 'TVB4'; } virtual s32 countDLSize(); - virtual void setTexNo(u32 i, const u16* pNo) { mTexNo[i] = *pNo; } - virtual void setTexNo(u32 i, u16 no) { mTexNo[i] = no; } - virtual u16 getTexNo(u32 i) const { return mTexNo[i]; } - virtual void setTevOrder(u32 i, const J3DTevOrder* pOrder) { mTevOrder[i] = *pOrder; } - virtual void setTevOrder(u32 i, J3DTevOrder order) { mTevOrder[i] = order; } - virtual J3DTevOrder* getTevOrder(u32 i) { return &mTevOrder[i]; } - virtual void setTevColor(u32 i, const J3DGXColorS10* pColor) { mTevColor[i] = *pColor; } - virtual void setTevColor(u32 i, J3DGXColorS10 color) { mTevColor[i] = color; } - virtual J3DGXColorS10* getTevColor(u32 i) { return &mTevColor[i]; } - virtual void setTevKColor(u32 i, const J3DGXColor* pColor) { mTevKColor[i] = *pColor; } - virtual void setTevKColor(u32 i, J3DGXColor color) { mTevKColor[i] = color; } - virtual J3DGXColor* getTevKColor(u32 i) { return &mTevKColor[i]; } - virtual void setTevKColorSel(u32 i, const u8* pNum) { mTevKColorSel[i] = *pNum; } - virtual void setTevKColorSel(u32 i, u8 num) { mTevKColorSel[i] = num; } - virtual u8 getTevKColorSel(u32 i) { return mTevKColorSel[i]; } - virtual void setTevKAlphaSel(u32 i, const u8* pNum) { mTevKAlphaSel[i] = *pNum; } - virtual void setTevKAlphaSel(u32 i, u8 num) { mTevKAlphaSel[i] = num; } - virtual u8 getTevKAlphaSel(u32 i) { return mTevKAlphaSel[i]; } + virtual void setTexNo(u32 idx, const u16* pNo) { mTexNo[idx] = *pNo; } + virtual void setTexNo(u32 idx, u16 no) { mTexNo[idx] = no; } + virtual u16 getTexNo(u32 idx) const { + J3D_ASSERT(2019, idx < 4, "Error : range over."); + return mTexNo[idx]; + } + virtual void setTevOrder(u32 idx, const J3DTevOrder* pOrder) { mTevOrder[idx] = *pOrder; } + virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; } + virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; } + virtual void setTevColor(u32 idx, const J3DGXColorS10* pColor) { mTevColor[idx] = *pColor; } + virtual void setTevColor(u32 idx, J3DGXColorS10 color) { mTevColor[idx] = color; } + virtual J3DGXColorS10* getTevColor(u32 idx) { return &mTevColor[idx]; } + virtual void setTevKColor(u32 idx, const J3DGXColor* pColor) { mTevKColor[idx] = *pColor; } + virtual void setTevKColor(u32 idx, J3DGXColor color) { mTevKColor[idx] = color; } + virtual J3DGXColor* getTevKColor(u32 idx) { return &mTevKColor[idx]; } + virtual void setTevKColorSel(u32 idx, const u8* pNum) { mTevKColorSel[idx] = *pNum; } + virtual void setTevKColorSel(u32 idx, u8 num) { mTevKColorSel[idx] = num; } + virtual u8 getTevKColorSel(u32 idx) { return mTevKColorSel[idx]; } + virtual void setTevKAlphaSel(u32 idx, const u8* pNum) { mTevKAlphaSel[idx] = *pNum; } + virtual void setTevKAlphaSel(u32 idx, u8 num) { mTevKAlphaSel[idx] = num; } + virtual u8 getTevKAlphaSel(u32 idx) { return mTevKAlphaSel[idx]; } virtual void setTevStageNum(const u8* pNum) { mTevStageNum = *pNum; } virtual void setTevStageNum(u8 num) { mTevStageNum = num; } virtual u8 getTevStageNum() const { return mTevStageNum; } - virtual void setTevStage(u32 i, const J3DTevStage* pStage) { mTevStage[i] = *pStage; } - virtual void setTevStage(u32 i, J3DTevStage stage) { mTevStage[i] = stage; } - virtual J3DTevStage* getTevStage(u32 i) { return &mTevStage[i]; } - virtual void setTevSwapModeInfo(u32 i, const J3DTevSwapModeInfo* pInfo) { mTevStage[i].setTevSwapModeInfo(*pInfo); } - virtual void setTevSwapModeInfo(u32 i, J3DTevSwapModeInfo info) { mTevStage[i].setTevSwapModeInfo(info); } - virtual void setTevSwapModeTable(u32 i, const J3DTevSwapModeTable* pTable) { - mTevSwapModeTable[i] = *pTable; + virtual void setTevStage(u32 idx, const J3DTevStage* pStage) { mTevStage[idx] = *pStage; } + virtual void setTevStage(u32 idx, J3DTevStage stage) { mTevStage[idx] = stage; } + virtual J3DTevStage* getTevStage(u32 idx) { return &mTevStage[idx]; } + virtual void setTevSwapModeInfo(u32 idx, const J3DTevSwapModeInfo* pInfo) { mTevStage[idx].setTevSwapModeInfo(*pInfo); } + virtual void setTevSwapModeInfo(u32 idx, J3DTevSwapModeInfo info) { mTevStage[idx].setTevSwapModeInfo(info); } + virtual void setTevSwapModeTable(u32 idx, const J3DTevSwapModeTable* pTable) { + mTevSwapModeTable[idx] = *pTable; } - virtual void setTevSwapModeTable(u32 i, J3DTevSwapModeTable table) { - mTevSwapModeTable[i] = table; + virtual void setTevSwapModeTable(u32 idx, J3DTevSwapModeTable table) { + mTevSwapModeTable[idx] = table; } - virtual J3DTevSwapModeTable* getTevSwapModeTable(u32 i) { return &mTevSwapModeTable[i]; } - virtual void setIndTevStage(u32 i, const J3DIndTevStage* pStage) { mIndTevStage[i] = *pStage; } - virtual void setIndTevStage(u32 i, J3DIndTevStage stage) { mIndTevStage[i] = stage; } - virtual J3DIndTevStage* getIndTevStage(u32 i) { return &mIndTevStage[i]; } + virtual J3DTevSwapModeTable* getTevSwapModeTable(u32 idx) { return &mTevSwapModeTable[idx]; } + virtual void setIndTevStage(u32 idx, const J3DIndTevStage* pStage) { mIndTevStage[idx] = *pStage; } + virtual void setIndTevStage(u32 idx, J3DIndTevStage stage) { mIndTevStage[idx] = stage; } + virtual J3DIndTevStage* getIndTevStage(u32 idx) { return &mIndTevStage[idx]; } virtual u32 getTexNoOffset() const { return mTexNoOffset; } virtual u32 getTevRegOffset() const { return mTevRegOffset; } virtual void setTevRegOffset(u32 offs) { mTevRegOffset = offs; } @@ -378,42 +384,45 @@ public: virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } virtual u32 getType() { return 'TVB2'; } virtual s32 countDLSize(); - virtual void setTexNo(u32 i, const u16* pNo) { mTexNo[i] = *pNo; } - virtual void setTexNo(u32 i, u16 no) { mTexNo[i] = no; } - virtual u16 getTexNo(u32 i) const { return mTexNo[i]; } - virtual void setTevOrder(u32 i, const J3DTevOrder* pOrder) { mTevOrder[i] = *pOrder; } - virtual void setTevOrder(u32 i, J3DTevOrder order) { mTevOrder[i] = order; } - virtual J3DTevOrder* getTevOrder(u32 i) { return &mTevOrder[i]; } - virtual void setTevColor(u32 i, const J3DGXColorS10* pColor) { mTevColor[i] = *pColor; } - virtual void setTevColor(u32 i, J3DGXColorS10 color) { mTevColor[i] = color; } - virtual J3DGXColorS10* getTevColor(u32 i) { return &mTevColor[i]; } - virtual void setTevKColor(u32 i, const J3DGXColor* pColor) { mTevKColor[i] = *pColor; } - virtual void setTevKColor(u32 i, J3DGXColor color) { mTevKColor[i] = color; } - virtual J3DGXColor* getTevKColor(u32 i) { return &mTevKColor[i]; } - virtual void setTevKColorSel(u32 i, const u8* pNum) { mTevKColorSel[i] = *pNum; } - virtual void setTevKColorSel(u32 i, u8 num) { mTevKColorSel[i] = num; } - virtual u8 getTevKColorSel(u32 i) { return mTevKColorSel[i]; } - virtual void setTevKAlphaSel(u32 i, const u8* pNum) { mTevKAlphaSel[i] = *pNum; } - virtual void setTevKAlphaSel(u32 i, u8 num) { mTevKAlphaSel[i] = num; } - virtual u8 getTevKAlphaSel(u32 i) { return mTevKAlphaSel[i]; } + virtual void setTexNo(u32 idx, const u16* pNo) { mTexNo[idx] = *pNo; } + virtual void setTexNo(u32 idx, u16 no) { mTexNo[idx] = no; } + virtual u16 getTexNo(u32 idx) const { + J3D_ASSERT(1730, idx < 2, "Error : range over."); + return mTexNo[idx]; + } + virtual void setTevOrder(u32 idx, const J3DTevOrder* pOrder) { mTevOrder[idx] = *pOrder; } + virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; } + virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; } + virtual void setTevColor(u32 idx, const J3DGXColorS10* pColor) { mTevColor[idx] = *pColor; } + virtual void setTevColor(u32 idx, J3DGXColorS10 color) { mTevColor[idx] = color; } + virtual J3DGXColorS10* getTevColor(u32 idx) { return &mTevColor[idx]; } + virtual void setTevKColor(u32 idx, const J3DGXColor* pColor) { mTevKColor[idx] = *pColor; } + virtual void setTevKColor(u32 idx, J3DGXColor color) { mTevKColor[idx] = color; } + virtual J3DGXColor* getTevKColor(u32 idx) { return &mTevKColor[idx]; } + virtual void setTevKColorSel(u32 idx, const u8* pNum) { mTevKColorSel[idx] = *pNum; } + virtual void setTevKColorSel(u32 idx, u8 num) { mTevKColorSel[idx] = num; } + virtual u8 getTevKColorSel(u32 idx) { return mTevKColorSel[idx]; } + virtual void setTevKAlphaSel(u32 idx, const u8* pNum) { mTevKAlphaSel[idx] = *pNum; } + virtual void setTevKAlphaSel(u32 idx, u8 num) { mTevKAlphaSel[idx] = num; } + virtual u8 getTevKAlphaSel(u32 idx) { return mTevKAlphaSel[idx]; } virtual void setTevStageNum(const u8* pNum) { mTevStageNum = *pNum; } virtual void setTevStageNum(u8 num) { mTevStageNum = num; } virtual u8 getTevStageNum() const { return mTevStageNum; } - virtual void setTevStage(u32 i, const J3DTevStage* pStage) { mTevStage[i] = *pStage; } - virtual void setTevStage(u32 i, J3DTevStage stage) { mTevStage[i] = stage; } - virtual J3DTevStage* getTevStage(u32 i) { return &mTevStage[i]; } - virtual void setTevSwapModeInfo(u32 i, const J3DTevSwapModeInfo* pInfo) { mTevStage[i].setTevSwapModeInfo(*pInfo); } - virtual void setTevSwapModeInfo(u32 i, J3DTevSwapModeInfo info) { mTevStage[i].setTevSwapModeInfo(info); } - virtual void setTevSwapModeTable(u32 i, const J3DTevSwapModeTable* pTable) { - mTevSwapModeTable[i] = *pTable; + virtual void setTevStage(u32 idx, const J3DTevStage* pStage) { mTevStage[idx] = *pStage; } + virtual void setTevStage(u32 idx, J3DTevStage stage) { mTevStage[idx] = stage; } + virtual J3DTevStage* getTevStage(u32 idx) { return &mTevStage[idx]; } + virtual void setTevSwapModeInfo(u32 idx, const J3DTevSwapModeInfo* pInfo) { mTevStage[idx].setTevSwapModeInfo(*pInfo); } + virtual void setTevSwapModeInfo(u32 idx, J3DTevSwapModeInfo info) { mTevStage[idx].setTevSwapModeInfo(info); } + virtual void setTevSwapModeTable(u32 idx, const J3DTevSwapModeTable* pTable) { + mTevSwapModeTable[idx] = *pTable; } - virtual void setTevSwapModeTable(u32 i, J3DTevSwapModeTable table) { - mTevSwapModeTable[i] = table; + virtual void setTevSwapModeTable(u32 idx, J3DTevSwapModeTable table) { + mTevSwapModeTable[idx] = table; } - virtual J3DTevSwapModeTable* getTevSwapModeTable(u32 i) { return &mTevSwapModeTable[i]; } - virtual void setIndTevStage(u32 i, const J3DIndTevStage* pStage) { mIndTevStage[i] = *pStage; } - virtual void setIndTevStage(u32 i, J3DIndTevStage stage) { mIndTevStage[i] = stage; } - virtual J3DIndTevStage* getIndTevStage(u32 i) { return &mIndTevStage[i]; } + virtual J3DTevSwapModeTable* getTevSwapModeTable(u32 idx) { return &mTevSwapModeTable[idx]; } + virtual void setIndTevStage(u32 idx, const J3DIndTevStage* pStage) { mIndTevStage[idx] = *pStage; } + virtual void setIndTevStage(u32 idx, J3DIndTevStage stage) { mIndTevStage[idx] = stage; } + virtual J3DIndTevStage* getIndTevStage(u32 idx) { return &mIndTevStage[idx]; } virtual u32 getTexNoOffset() const { return mTexNoOffset; } virtual u32 getTevRegOffset() const { return mTevRegOffset; } virtual void setTevRegOffset(u32 offs) { mTevRegOffset = offs; } @@ -453,42 +462,45 @@ public: virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } virtual u32 getType() { return 'TV16'; } virtual s32 countDLSize(); - virtual void setTexNo(u32 i, const u16* pNo) { mTexNo[i] = *pNo; } - virtual void setTexNo(u32 i, u16 no) { mTexNo[i] = no; } - virtual u16 getTexNo(u32 i) const { return mTexNo[i]; } - virtual void setTevOrder(u32 i, const J3DTevOrder* pOrder) { mTevOrder[i] = *pOrder; } - virtual void setTevOrder(u32 i, J3DTevOrder order) { mTevOrder[i] = order; } - virtual J3DTevOrder* getTevOrder(u32 i) { return &mTevOrder[i]; } - virtual void setTevColor(u32 i, const J3DGXColorS10* pColor) { mTevColor[i] = *pColor; } - virtual void setTevColor(u32 i, J3DGXColorS10 color) { mTevColor[i] = color; } - virtual J3DGXColorS10* getTevColor(u32 i) { return &mTevColor[i]; } - virtual void setTevKColor(u32 i, const J3DGXColor* pColor) { mTevKColor[i] = *pColor; } - virtual void setTevKColor(u32 i, J3DGXColor color) { mTevKColor[i] = color; } - virtual J3DGXColor* getTevKColor(u32 i) { return &mTevKColor[i]; } - virtual void setTevKColorSel(u32 i, const u8* pNum) { mTevKColorSel[i] = *pNum; } - virtual void setTevKColorSel(u32 i, u8 num) { mTevKColorSel[i] = num; } - virtual u8 getTevKColorSel(u32 i) { return mTevKColorSel[i]; } - virtual void setTevKAlphaSel(u32 i, const u8* pNum) { mTevKAlphaSel[i] = *pNum; } - virtual void setTevKAlphaSel(u32 i, u8 num) { mTevKAlphaSel[i] = num; } - virtual u8 getTevKAlphaSel(u32 i) { return mTevKAlphaSel[i]; } + virtual void setTexNo(u32 idx, const u16* pNo) { mTexNo[idx] = *pNo; } + virtual void setTexNo(u32 idx, u16 no) { mTexNo[idx] = no; } + virtual u16 getTexNo(u32 idx) const { + J3D_ASSERT(2308, idx < 8, "Error : range over."); + return mTexNo[idx]; + } + virtual void setTevOrder(u32 idx, const J3DTevOrder* pOrder) { mTevOrder[idx] = *pOrder; } + virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; } + virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; } + virtual void setTevColor(u32 idx, const J3DGXColorS10* pColor) { mTevColor[idx] = *pColor; } + virtual void setTevColor(u32 idx, J3DGXColorS10 color) { mTevColor[idx] = color; } + virtual J3DGXColorS10* getTevColor(u32 idx) { return &mTevColor[idx]; } + virtual void setTevKColor(u32 idx, const J3DGXColor* pColor) { mTevKColor[idx] = *pColor; } + virtual void setTevKColor(u32 idx, J3DGXColor color) { mTevKColor[idx] = color; } + virtual J3DGXColor* getTevKColor(u32 idx) { return &mTevKColor[idx]; } + virtual void setTevKColorSel(u32 idx, const u8* pNum) { mTevKColorSel[idx] = *pNum; } + virtual void setTevKColorSel(u32 idx, u8 num) { mTevKColorSel[idx] = num; } + virtual u8 getTevKColorSel(u32 idx) { return mTevKColorSel[idx]; } + virtual void setTevKAlphaSel(u32 idx, const u8* pNum) { mTevKAlphaSel[idx] = *pNum; } + virtual void setTevKAlphaSel(u32 idx, u8 num) { mTevKAlphaSel[idx] = num; } + virtual u8 getTevKAlphaSel(u32 idx) { return mTevKAlphaSel[idx]; } virtual void setTevStageNum(const u8* pNum) { mTevStageNum = *pNum; } virtual void setTevStageNum(u8 num) { mTevStageNum = num; } virtual u8 getTevStageNum() const { return mTevStageNum; } - virtual void setTevStage(u32 i, const J3DTevStage* pStage) { mTevStage[i] = *pStage; } - virtual void setTevStage(u32 i, J3DTevStage stage) { mTevStage[i] = stage; } - virtual J3DTevStage* getTevStage(u32 i) { return &mTevStage[i]; } - virtual void setTevSwapModeInfo(u32 i, const J3DTevSwapModeInfo* pInfo) { mTevStage[i].setTevSwapModeInfo(*pInfo); } - virtual void setTevSwapModeInfo(u32 i, J3DTevSwapModeInfo info) { mTevStage[i].setTevSwapModeInfo(info); } - virtual void setTevSwapModeTable(u32 i, const J3DTevSwapModeTable* pTable) { - mTevSwapModeTable[i] = *pTable; + virtual void setTevStage(u32 idx, const J3DTevStage* pStage) { mTevStage[idx] = *pStage; } + virtual void setTevStage(u32 idx, J3DTevStage stage) { mTevStage[idx] = stage; } + virtual J3DTevStage* getTevStage(u32 idx) { return &mTevStage[idx]; } + virtual void setTevSwapModeInfo(u32 idx, const J3DTevSwapModeInfo* pInfo) { mTevStage[idx].setTevSwapModeInfo(*pInfo); } + virtual void setTevSwapModeInfo(u32 idx, J3DTevSwapModeInfo info) { mTevStage[idx].setTevSwapModeInfo(info); } + virtual void setTevSwapModeTable(u32 idx, const J3DTevSwapModeTable* pTable) { + mTevSwapModeTable[idx] = *pTable; } - virtual void setTevSwapModeTable(u32 i, J3DTevSwapModeTable table) { - mTevSwapModeTable[i] = table; + virtual void setTevSwapModeTable(u32 idx, J3DTevSwapModeTable table) { + mTevSwapModeTable[idx] = table; } - virtual J3DTevSwapModeTable* getTevSwapModeTable(u32 i) { return &mTevSwapModeTable[i]; } - virtual void setIndTevStage(u32 i, const J3DIndTevStage* pStage) { mIndTevStage[i] = *pStage; } - virtual void setIndTevStage(u32 i, J3DIndTevStage stage) { mIndTevStage[i] = stage; } - virtual J3DIndTevStage* getIndTevStage(u32 i) { return &mIndTevStage[i]; } + virtual J3DTevSwapModeTable* getTevSwapModeTable(u32 idx) { return &mTevSwapModeTable[idx]; } + virtual void setIndTevStage(u32 idx, const J3DIndTevStage* pStage) { mIndTevStage[idx] = *pStage; } + virtual void setIndTevStage(u32 idx, J3DIndTevStage stage) { mIndTevStage[idx] = stage; } + virtual J3DIndTevStage* getIndTevStage(u32 idx) { return &mIndTevStage[idx]; } virtual u32 getTexNoOffset() const { return mTexNoOffset; } virtual u32 getTevRegOffset() const { return mTevRegOffset; } virtual void setTevRegOffset(u32 offs) { mTevRegOffset = offs; } @@ -531,21 +543,24 @@ public: virtual void indexToPtr() { indexToPtr_private(mTexNoOffset); } virtual u32 getType() { return 'TVB1'; } virtual s32 countDLSize(); - virtual void setTexNo(u32 i, const u16* pNo) { mTexNo[i] = *pNo; } - virtual void setTexNo(u32 i, u16 no) { mTexNo[i] = no; } - virtual u16 getTexNo(u32 i) const { return mTexNo[i]; } - virtual void setTevOrder(u32 i, const J3DTevOrder* pOrder) { mTevOrder[i] = *pOrder; } - virtual void setTevOrder(u32 i, J3DTevOrder order) { mTevOrder[i] = order; } - virtual J3DTevOrder* getTevOrder(u32 i) { return &mTevOrder[i]; } + virtual void setTexNo(u32 idx, const u16* pNo) { mTexNo[idx] = *pNo; } + virtual void setTexNo(u32 idx, u16 no) { mTexNo[idx] = no; } + virtual u16 getTexNo(u32 idx) const { + J3D_ASSERT(1574, idx < 1, "Error : range over."); + return mTexNo[idx]; + } + virtual void setTevOrder(u32 idx, const J3DTevOrder* pOrder) { mTevOrder[idx] = *pOrder; } + virtual void setTevOrder(u32 idx, J3DTevOrder order) { mTevOrder[idx] = order; } + virtual J3DTevOrder* getTevOrder(u32 idx) { return &mTevOrder[idx]; } virtual void setTevStageNum(const u8* pNum) {} virtual void setTevStageNum(u8 num) {} virtual u8 getTevStageNum() const { return 1; } - virtual void setTevStage(u32 i, const J3DTevStage* pStage) { mTevStage[i] = *pStage; } - virtual void setTevStage(u32 i, J3DTevStage stage) { mTevStage[i] = stage; } - virtual J3DTevStage* getTevStage(u32 i) { return &mTevStage[i]; } - virtual void setIndTevStage(u32 i, const J3DIndTevStage* pStage) { mIndTevStage[i] = *pStage; } - virtual void setIndTevStage(u32 i, J3DIndTevStage stage) { mIndTevStage[i] = stage; } - virtual J3DIndTevStage* getIndTevStage(u32 i) { return &mIndTevStage[i]; } + virtual void setTevStage(u32 idx, const J3DTevStage* pStage) { mTevStage[idx] = *pStage; } + virtual void setTevStage(u32 idx, J3DTevStage stage) { mTevStage[idx] = stage; } + virtual J3DTevStage* getTevStage(u32 idx) { return &mTevStage[idx]; } + virtual void setIndTevStage(u32 idx, const J3DIndTevStage* pStage) { mIndTevStage[idx] = *pStage; } + virtual void setIndTevStage(u32 idx, J3DIndTevStage stage) { mIndTevStage[idx] = stage; } + virtual J3DIndTevStage* getIndTevStage(u32 idx) { return &mIndTevStage[idx]; } virtual u32 getTexNoOffset() const { return mTexNoOffset; } virtual ~J3DTevBlock1() {} @@ -908,15 +923,15 @@ public: virtual u32 getType() { return 'IBLF'; } virtual void setIndTexStageNum(u8 num) { mIndTexStageNum = num; } virtual u8 getIndTexStageNum() const { return mIndTexStageNum; } - virtual void setIndTexOrder(u32 i, J3DIndTexOrder const* pOrder) { mIndTexOrder[i] = *pOrder; } - virtual void setIndTexOrder(u32 i, J3DIndTexOrder order) { mIndTexOrder[i] = order; } - virtual J3DIndTexOrder* getIndTexOrder(u32 i) { return &mIndTexOrder[i]; } - virtual void setIndTexMtx(u32 i, J3DIndTexMtx const* pMtx) { mIndTexMtx[i] = *pMtx; } - virtual void setIndTexMtx(u32 i, J3DIndTexMtx mtx) { mIndTexMtx[i] = mtx; } - virtual J3DIndTexMtx* getIndTexMtx(u32 i) { return &mIndTexMtx[i]; } - virtual void setIndTexCoordScale(u32 i, J3DIndTexCoordScale const* pScale) { mIndTexCoordScale[i] = *pScale; } - virtual void setIndTexCoordScale(u32 i, J3DIndTexCoordScale scale) { mIndTexCoordScale[i] = scale; } - virtual J3DIndTexCoordScale* getIndTexCoordScale(u32 i) { return &mIndTexCoordScale[i]; } + virtual void setIndTexOrder(u32 idx, J3DIndTexOrder const* pOrder) { mIndTexOrder[idx] = *pOrder; } + virtual void setIndTexOrder(u32 idx, J3DIndTexOrder order) { mIndTexOrder[idx] = order; } + virtual J3DIndTexOrder* getIndTexOrder(u32 idx) { return &mIndTexOrder[idx]; } + virtual void setIndTexMtx(u32 idx, J3DIndTexMtx const* pMtx) { mIndTexMtx[idx] = *pMtx; } + virtual void setIndTexMtx(u32 idx, J3DIndTexMtx mtx) { mIndTexMtx[idx] = mtx; } + virtual J3DIndTexMtx* getIndTexMtx(u32 idx) { return &mIndTexMtx[idx]; } + virtual void setIndTexCoordScale(u32 idx, J3DIndTexCoordScale const* pScale) { mIndTexCoordScale[idx] = *pScale; } + virtual void setIndTexCoordScale(u32 idx, J3DIndTexCoordScale scale) { mIndTexCoordScale[idx] = scale; } + virtual J3DIndTexCoordScale* getIndTexCoordScale(u32 idx) { return &mIndTexCoordScale[idx]; } virtual ~J3DIndBlockFull() {} private: @@ -1054,20 +1069,20 @@ public: virtual void diffLight(); virtual s32 countDLSize(); virtual u32 getType() { return 'CLON'; } - virtual void setMatColor(u32 i, J3DGXColor const* pColor) { mMatColor[i] = *pColor; } - virtual void setMatColor(u32 i, J3DGXColor color) { mMatColor[i] = color; } - virtual J3DGXColor* getMatColor(u32 i) { return &mMatColor[i]; } - virtual void setAmbColor(u32 i, J3DGXColor const* pColor) { mAmbColor[i] = *pColor; } - virtual void setAmbColor(u32 i, J3DGXColor color) { mAmbColor[i] = color; } - virtual J3DGXColor* getAmbColor(u32 i) { return &mAmbColor[i]; } + virtual void setMatColor(u32 idx, J3DGXColor const* pColor) { mMatColor[idx] = *pColor; } + virtual void setMatColor(u32 idx, J3DGXColor color) { mMatColor[idx] = color; } + virtual J3DGXColor* getMatColor(u32 idx) { return &mMatColor[idx]; } + virtual void setAmbColor(u32 idx, J3DGXColor const* pColor) { mAmbColor[idx] = *pColor; } + virtual void setAmbColor(u32 idx, J3DGXColor color) { mAmbColor[idx] = color; } + virtual J3DGXColor* getAmbColor(u32 idx) { return &mAmbColor[idx]; } virtual void setColorChanNum(u8 num) { mColorChanNum = num; } virtual void setColorChanNum(u8 const* pNum) { mColorChanNum = *pNum; } virtual u8 getColorChanNum() const { return mColorChanNum; } - virtual void setColorChan(u32 i, J3DColorChan const& chan) { mColorChan[i] = chan; } - virtual void setColorChan(u32 i, J3DColorChan const* pChan) { mColorChan[i] = *pChan; } - virtual J3DColorChan* getColorChan(u32 i) { return &mColorChan[i]; } - virtual void setLight(u32 i, J3DLightObj* pLight) { mLight[i] = pLight; } - virtual J3DLightObj* getLight(u32 i) { return mLight[i]; } + virtual void setColorChan(u32 idx, J3DColorChan const& chan) { mColorChan[idx] = chan; } + virtual void setColorChan(u32 idx, J3DColorChan const* pChan) { mColorChan[idx] = *pChan; } + virtual J3DColorChan* getColorChan(u32 idx) { return &mColorChan[idx]; } + virtual void setLight(u32 idx, J3DLightObj* pLight) { mLight[idx] = pLight; } + virtual J3DLightObj* getLight(u32 idx) { return mLight[idx]; } virtual void setCullMode(u8 const* pMode) { mCullMode = *pMode; } virtual void setCullMode(u8 mode) { mCullMode = mode; } virtual u8 getCullMode() const { return mCullMode; } @@ -1103,15 +1118,15 @@ public: virtual void diffLight(); virtual s32 countDLSize(); virtual u32 getType() { return 'CLOF'; } - virtual void setMatColor(u32 i, J3DGXColor const* pColor) { mMatColor[i] = *pColor; } - virtual void setMatColor(u32 i, J3DGXColor color) { mMatColor[i] = color; } - virtual J3DGXColor* getMatColor(u32 i) { return &mMatColor[i]; } + virtual void setMatColor(u32 idx, J3DGXColor const* pColor) { mMatColor[idx] = *pColor; } + virtual void setMatColor(u32 idx, J3DGXColor color) { mMatColor[idx] = color; } + virtual J3DGXColor* getMatColor(u32 idx) { return &mMatColor[idx]; } virtual void setColorChanNum(u8 num) { mColorChanNum = num; } virtual void setColorChanNum(u8 const* pNum) { mColorChanNum = *pNum;} virtual u8 getColorChanNum() const { return mColorChanNum; } - virtual void setColorChan(u32 i, J3DColorChan const& chan) { mColorChan[i] = chan; } - virtual void setColorChan(u32 i, J3DColorChan const* pChan) { mColorChan[i] = *pChan; } - virtual J3DColorChan* getColorChan(u32 i) { return &mColorChan[i]; } + virtual void setColorChan(u32 idx, J3DColorChan const& chan) { mColorChan[idx] = chan; } + virtual void setColorChan(u32 idx, J3DColorChan const* pChan) { mColorChan[idx] = *pChan; } + virtual J3DColorChan* getColorChan(u32 idx) { return &mColorChan[idx]; } virtual void setCullMode(u8 const* pMode) { mCullMode = *pMode;} virtual void setCullMode(u8 mode ) { mCullMode = mode; } virtual u8 getCullMode() const { return mCullMode; } @@ -1141,9 +1156,9 @@ public: virtual void load(); virtual s32 countDLSize(); virtual u32 getType() { return 'CLAB'; } - virtual void setAmbColor(u32 i, J3DGXColor const* pColor) { mAmbColor[i] = *pColor; } - virtual void setAmbColor(u32 i, J3DGXColor color) { mAmbColor[i] = color; } - virtual J3DGXColor* getAmbColor(u32 i) { return &mAmbColor[i]; } + virtual void setAmbColor(u32 idx, J3DGXColor const* pColor) { mAmbColor[idx] = *pColor; } + virtual void setAmbColor(u32 idx, J3DGXColor color) { mAmbColor[idx] = color; } + virtual J3DGXColor* getAmbColor(u32 idx) { return &mAmbColor[idx]; } virtual ~J3DColorBlockAmbientOn() {} protected: diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h index 81f42efbf..b379fd715 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h +++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h @@ -1,6 +1,7 @@ #ifndef J3DSHAPEMTX_H #define J3DSHAPEMTX_H +#include "JSystem/JUtility/JUTAssert.h" #include "dolphin/mtx/mtx.h" class J3DShapeMtx { @@ -26,7 +27,11 @@ public: static u8* sCurrentScaleFlag; static u8 sNBTFlag; - static void setCurrentPipeline(u32 pipeline) { sCurrentPipeline = pipeline; } + static void setCurrentPipeline(u32 pipeline) { + // TODO: needs to go in J3DShape.h for assert + J3D_ASSERT(91, pipeline < 4, "Error : range over."); + sCurrentPipeline = pipeline; + } protected: /* 0x04 */ u16 mUseMtxIndex; diff --git a/include/JSystem/J3DGraphBase/J3DSys.h b/include/JSystem/J3DGraphBase/J3DSys.h index e43e022ae..8100f78e2 100644 --- a/include/JSystem/J3DGraphBase/J3DSys.h +++ b/include/JSystem/J3DGraphBase/J3DSys.h @@ -63,7 +63,10 @@ public: void* getVtxCol() { return mVtxCol; } void setVtxCol(GXColor* pVtxCol) { mVtxCol = pVtxCol; } - void setModel(J3DModel* pModel) { mModel = pModel; } + void setModel(J3DModel* pModel) { + J3D_ASSERT(200, pModel, "Error : null pointer."); + mModel = pModel; + } void setShapePacket(J3DShapePacket* pPacket) { mShapePacket = pPacket; } void setMatPacket(J3DMatPacket* pPacket) { mMatPacket = pPacket; } J3DMatPacket* getMatPacket() { return mMatPacket; } diff --git a/include/JSystem/J3DGraphBase/J3DTexture.h b/include/JSystem/J3DGraphBase/J3DTexture.h index 19bee0e03..451dc2a3f 100644 --- a/include/JSystem/J3DGraphBase/J3DTexture.h +++ b/include/JSystem/J3DGraphBase/J3DTexture.h @@ -4,6 +4,7 @@ #include "JSystem/J3DGraphBase/J3DGD.h" #include "JSystem/J3DGraphBase/J3DStruct.h" #include "JSystem/J3DGraphBase/J3DTevs.h" +#include "JSystem/JUtility/JUTAssert.h" #include "JSystem/JUtility/JUTTexture.h" #include "dolphin/mtx/mtx.h" #include "dolphin/types.h" @@ -42,7 +43,10 @@ public: void addResTIMG(u16, ResTIMG const*); u16 getNum() const { return mNum; } - ResTIMG* getResTIMG(u16 entry) const { return &mpRes[entry]; } + ResTIMG* getResTIMG(u16 entry) const { + J3D_ASSERT(72, entry < mNum, "Error : range over."); + return &mpRes[entry]; + } void setResTIMG(u16 entry, const ResTIMG& timg) { mpRes[entry] = timg; mpRes[entry].imageOffset = ((mpRes[entry].imageOffset + (u32)&timg - (u32)(mpRes + entry))); diff --git a/include/JSystem/JUtility/JUTAssert.h b/include/JSystem/JUtility/JUTAssert.h index 3c174b196..0c1214110 100644 --- a/include/JSystem/JUtility/JUTAssert.h +++ b/include/JSystem/JUtility/JUTAssert.h @@ -18,7 +18,11 @@ } \ } +#ifdef DEBUG +#define J3D_ASSERT(LINE, COND, MSG) JUT_ASSERT_MSG(LINE, (COND) != 0, MSG) +#else #define J3D_ASSERT(LINE, COND, MSG) (void)0 +#endif #define JUT_WARN(LINE, ...) \ JUTAssertion::setWarningMessage_f(JUTAssertion::getSDevice(), __FILE__, LINE, __VA_ARGS__); \ diff --git a/include/d/actor/d_a_obj_movebox.h b/include/d/actor/d_a_obj_movebox.h index f25d0eb11..21746632a 100644 --- a/include/d/actor/d_a_obj_movebox.h +++ b/include/d/actor/d_a_obj_movebox.h @@ -186,7 +186,14 @@ namespace daObjMovebox { inline void mode_proc_call(); void chk_walk(cXyz*) { /* TODO */ } - void set_rollCrash() { mbRollCrash = TRUE; } + void set_rollCrash() { + if ( + mType == daObjMovebox::Act_c::TYPE_BREAKABLE_WOODEN_CRATE || + mType == daObjMovebox::Act_c::TYPE_GOLDEN_CRATE + ) { + mbRollCrash = TRUE; + } + } void prmZ_init(); void prmX_init(); diff --git a/include/d/actor/d_a_player_main.h b/include/d/actor/d_a_player_main.h index 37c913983..aa80578d3 100644 --- a/include/d/actor/d_a_player_main.h +++ b/include/d/actor/d_a_player_main.h @@ -296,10 +296,10 @@ public: static void setMorfFrame(u8 frame) { m_morf_frame = frame; } // TODO: - static void getNowOffsetXP() {} - static void getNowOffsetYP() {} - static void setNowOffsetX(f32) {} - static void setNowOffsetY(f32) {} + void getNowOffsetXP() {} + void getNowOffsetYP() {} + void setNowOffsetX(f32 x) { mEyePos.x = x; } + void setNowOffsetY(f32 y) { mEyePos.y = y; } public: /* 0x6C */ cXy mEyePosOld; diff --git a/include/d/actor/d_a_salvage.h b/include/d/actor/d_a_salvage.h index aeeb1d1a4..a71d70c3b 100644 --- a/include/d/actor/d_a_salvage.h +++ b/include/d/actor/d_a_salvage.h @@ -10,7 +10,13 @@ class daSalvage_c : public fopAc_ac_c { public: static int getSalvageId() { return mSalvageId; } void setSalvageId(int) {} - static BOOL isValidSalvageId() { return mSalvageId != -1 ? TRUE : FALSE; } + static BOOL isValidSalvageId() { + if (mSalvageId != -1) { + return TRUE; + } else { + return FALSE; + } + } void getSalvageKind() {} void checkRegist(int) {} diff --git a/include/d/d_attention.h b/include/d/d_attention.h index 3835f62b0..a0f5c1ecc 100644 --- a/include/d/d_attention.h +++ b/include/d/d_attention.h @@ -92,7 +92,7 @@ public: bool request(fopAc_ac_c*, f32, f32, f32, s16, int); bool requestF(fopAc_ac_c*, s16, int); - fpc_ProcID getLookTarget() { return mLookTargetID; } + fopAc_ac_c* getLookTarget() { return convPId(mLookTargetID); } private: /* 0x0 */ fpc_ProcID mRequestActorID; @@ -226,8 +226,8 @@ public: u8 getCatchChgItem() { return mCatch.getChangeItem(); } fopAc_ac_c* getCatghTarget() { return mCatch.getCatghTarget(); } - fopAc_ac_c* getLookTarget() { return mLook[0].convPId(mLook[0].getLookTarget()); } - fopAc_ac_c* getLook2Target() { return mLook[1].convPId(mLook[1].getLookTarget()); } + fopAc_ac_c* getLookTarget() { return mLook[0].getLookTarget(); } + fopAc_ac_c* getLook2Target() { return mLook[1].getLookTarget(); } fopAc_ac_c* getZHintTarget() { return mHint.getZHintTarget(); } int ZHintRequest(fopAc_ac_c* param_1, int param_2) { diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h index 92c8e05a5..61fb48235 100644 --- a/include/d/d_com_inf_game.h +++ b/include/d/d_com_inf_game.h @@ -2176,10 +2176,6 @@ inline stage_envr_info_class* dComIfGp_getStageEnvrInfo() { return g_dComIfG_gameInfo.play.getStage().getEnvrInfo(); } -inline dStage_EventInfo_c* dComIfGp_getStageEventInfo() { - return g_dComIfG_gameInfo.play.getStage().getEventInfo(); -} - inline stage_palet_info_class* dComIfGp_getStagePaletteInfo() { return g_dComIfG_gameInfo.play.getStage().getPaletInfo(); } @@ -3136,15 +3132,15 @@ inline bool dComIfGp_event_chkTalkXY() { return g_dComIfG_gameInfo.play.getEvent().chkTalkXY(); } -inline void dComIfGp_event_onEventFlag(s16 flag) { +inline void dComIfGp_event_onEventFlag(u16 flag) { g_dComIfG_gameInfo.play.getEvent().onEventFlag(flag); } -inline void dComIfGp_event_offEventFlag(s16 flag) { +inline void dComIfGp_event_offEventFlag(u16 flag) { g_dComIfG_gameInfo.play.getEvent().offEventFlag(flag); } -inline u16 dComIfGp_event_chkEventFlag(s16 flag) { +inline u16 dComIfGp_event_chkEventFlag(u16 flag) { return g_dComIfG_gameInfo.play.getEvent().chkEventFlag(flag); } @@ -3937,7 +3933,7 @@ inline s32 dComIfGp_particle_checkAtrCodeEffect(int code) { return g_dComIfG_gam * === ATTENTION === */ - inline dAttention_c& dComIfGp_getAttention() { +inline dAttention_c& dComIfGp_getAttention() { return g_dComIfG_gameInfo.play.getAttention(); } diff --git a/include/d/d_map.h b/include/d/d_map.h index d2de52f0e..83e3668e0 100644 --- a/include/d/d_map.h +++ b/include/d/d_map.h @@ -75,38 +75,39 @@ public: void roomDrawRoomEnlargementSize(int, int, int, int, f32, f32, f32, f32, u8); void roomDrawRoomRealSize(int, int, int, int, f32, f32, f32, f32, f32, f32, u8); - inline void clrUseRoom() {} - inline void setUseRoom() {} - inline void checkUseRoom() {} - inline void getEnableFlg() {} - inline void getStageMapInfoPE() {} - inline void getStageMapInfoCmPDot() {} - inline void getStageMapInfoMap0_X0() {} - inline void getStageMapInfoMap0_X1() {} - inline void getStageMapInfoMap0_Z0() {} - inline void getStageMapInfoMap0_Z1() {} - inline void getStageMapInfoMap0_XC() {} - inline void getStageMapInfoMap0_ZC() {} - inline void getStageMapInfoMap1_X0() {} - inline void getStageMapInfoMap1_X1() {} - inline void getStageMapInfoMap1_Z0() {} - inline void getStageMapInfoMap1_Z1() {} - inline void getStageMapInfoMap1_ZC() {} - inline void getStageMapInfoMap1_XC() {} - inline void getStageMapInfoAlpha() {} - inline void getMapDtP() {} - inline void getNowDspFloorNo() {} - inline void getMapDtSize() {} - inline void getMap0ScaleX() {} - inline void getMap0ScaleZ() {} - inline void getMap1ScaleX() {} - inline void getMap1ScaleZ() {} - inline void getMap1Width() {} - inline void getMap1Height() {} + void clrUseRoom() {} + void setUseRoom() {} + void checkUseRoom() {} + void getEnableFlg() {} + void getStageMapInfoPE() {} + void getStageMapInfoCmPDot() {} + void getStageMapInfoMap0_X0() {} + void getStageMapInfoMap0_X1() {} + void getStageMapInfoMap0_Z0() {} + void getStageMapInfoMap0_Z1() {} + void getStageMapInfoMap0_XC() {} + void getStageMapInfoMap0_ZC() {} + void getStageMapInfoMap1_X0() {} + void getStageMapInfoMap1_X1() {} + void getStageMapInfoMap1_Z0() {} + void getStageMapInfoMap1_Z1() {} + void getStageMapInfoMap1_ZC() {} + void getStageMapInfoMap1_XC() {} + void getStageMapInfoAlpha() {} + void getMapDtP() {} + void getNowDspFloorNo() {} + void getMapDtSize() {} + void getMap0ScaleX() {} + void getMap0ScaleZ() {} + void getMap1ScaleX() {} + void getMap1ScaleZ() {} + void getMap1Width() {} + void getMap1Height() {} + void setArgNo(int) {} - inline u8 getRoomNo() { return m_no; } - inline stage_map_info_class* getStageMapInfoP() { JUT_ASSERT(0x467, mStageMapInfoP != NULL); return mStageMapInfoP; } - inline dMap_RoomInfo_c* getNextRoomInfoP() { return m_next; } + u8 getRoomNo() { return m_no; } + stage_map_info_class* getStageMapInfoP() { JUT_ASSERT(0x467, mStageMapInfoP != NULL); return mStageMapInfoP; } + dMap_RoomInfo_c* getNextRoomInfoP() { return m_next; } /* 0x00 */ u8 m_exist; /* 0x01 */ u8 field_0x1; diff --git a/include/m_Do/m_Do_MemCard.h b/include/m_Do/m_Do_MemCard.h index 24084aa72..2651d4323 100644 --- a/include/m_Do/m_Do_MemCard.h +++ b/include/m_Do/m_Do_MemCard.h @@ -91,7 +91,7 @@ inline void mDoMemCd_ThdInit() { g_mDoMemCd_control.ThdInit(); } -inline void mDoMemCd_save(void* i_data, u32 param_1, u32 param_2) { +inline void mDoMemCd_Save(void* i_data, u32 param_1, u32 param_2) { g_mDoMemCd_control.save(i_data,param_1,param_2); } @@ -154,7 +154,6 @@ inline u32 mDoMemCd_getStatus(u32 status) { inline void mDoMemCd_Format() {} inline void mDoMemCd_Load() {} inline void mDoMemCd_LoadSync(void*, u32, u32) {} -inline void mDoMemCd_Save(void*, u32, u32) {} inline void mDoMemCd_clearProbeStat() {} inline void mDoMemCd_getDataVersion() {} inline void mDoMemCd_getProbeStat() {} diff --git a/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp b/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp index 44eeb10a1..7f22f64cb 100644 --- a/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp +++ b/src/JSystem/J3DGraphAnimator/J3DMaterialAttach.cpp @@ -83,10 +83,11 @@ s32 J3DMaterialTable::entryTexMtxAnimator(J3DAnmTextureSRTKey* btk) { J3DTexMtx *tmtx = pMaterial->getTexMtx(texMtxID); J3DTexMtxAnm* tmtxanm = new J3DTexMtxAnm(btk, no); - tmtx->getTexMtxInfo().mInfo = ((tmtx->getTexMtxInfo().mInfo) & 0x7F) | (btk->getTexMtxCalcType() << 7); - tmtx->getTexMtxInfo().mCenter.x = btk->getSRTCenter(no).x; - tmtx->getTexMtxInfo().mCenter.y = btk->getSRTCenter(no).y; - tmtx->getTexMtxInfo().mCenter.z = btk->getSRTCenter(no).z; + J3DTexMtxInfo& tmtxinfo = tmtx->getTexMtxInfo(); + tmtxinfo.mInfo = (tmtxinfo.mInfo & 0x7F) | btk->getTexMtxCalcType() << 7; + tmtxinfo.mCenter.x = btk->getSRTCenter(no).x; + tmtxinfo.mCenter.y = btk->getSRTCenter(no).y; + tmtxinfo.mCenter.z = btk->getSRTCenter(no).z; pMatAnm->setTexMtxAnm(texMtxID, tmtxanm); } @@ -291,10 +292,11 @@ s32 J3DMaterialTable::setTexMtxAnimator(J3DAnmTextureSRTKey* btk, J3DTexMtxAnm* pMaterial->getTexCoord(texMtxID)->setTexGenMtx(GX_TEXMTX0 + (texMtxID & 0xFF) * 3); J3DTexMtx *tmtx = pMaterial->getTexMtx(texMtxID); - tmtx->getTexMtxInfo().mInfo = ((tmtx->getTexMtxInfo().mInfo) & 0x7F) | (btk->getTexMtxCalcType() << 7); - tmtx->getTexMtxInfo().mCenter.x = btk->getSRTCenter(no).x; - tmtx->getTexMtxInfo().mCenter.y = btk->getSRTCenter(no).y; - tmtx->getTexMtxInfo().mCenter.z = btk->getSRTCenter(no).z; + J3DTexMtxInfo& tmtxinfo = tmtx->getTexMtxInfo(); + tmtxinfo.mInfo = (tmtxinfo.mInfo & 0x7F) | btk->getTexMtxCalcType() << 7; + tmtxinfo.mCenter.x = btk->getSRTCenter(no).x; + tmtxinfo.mCenter.y = btk->getSRTCenter(no).y; + tmtxinfo.mCenter.z = btk->getSRTCenter(no).z; pMatAnm->setTexMtxAnm(texMtxID, &pTexAnm[no]); } diff --git a/src/d/actor/d_a_player_main.cpp b/src/d/actor/d_a_player_main.cpp index c8a1001f2..1915f1087 100644 --- a/src/d/actor/d_a_player_main.cpp +++ b/src/d/actor/d_a_player_main.cpp @@ -3401,11 +3401,13 @@ void daPy_lk_c::setAnimeEquipSword(BOOL r4) { /* 8010C100-8010C158 .text setAnimeEquipSingleItem__9daPy_lk_cFUs */ void daPy_lk_c::setAnimeEquipSingleItem(u16 bckIdx) { - f32 rate = daPy_HIO_item_c0::m.field_0x14; - f32 start = daPy_HIO_item_c0::m.field_0x18; - s16 end = daPy_HIO_item_c0::m.field_0x2; - f32 f3 = daPy_HIO_item_c0::m.field_0x1C; - setActAnimeUpper(bckIdx, UPPER_MOVE2_e, rate, start, end, f3); + setActAnimeUpper( + bckIdx, UPPER_MOVE2_e, + daPy_HIO_item_c0::m.field_0x14, + daPy_HIO_item_c0::m.field_0x18, + daPy_HIO_item_c0::m.field_0x2, + daPy_HIO_item_c0::m.field_0x1C + ); setPriTextureAnime(0x74, 0); } @@ -6877,12 +6879,7 @@ BOOL daPy_lk_c::procFrontRollCrash_init() { fopAc_ac_c* actor = dComIfG_Bgsp()->GetActorPointer(mAcchCir[0]); if (actor != 0 && fopAcM_GetName(actor) == PROC_Obj_Movebox) { daObjMovebox::Act_c* movebox = (daObjMovebox::Act_c*)actor; - if ( - movebox->mType == daObjMovebox::Act_c::TYPE_BREAKABLE_WOODEN_CRATE || - movebox->mType == daObjMovebox::Act_c::TYPE_GOLDEN_CRATE - ) { - movebox->set_rollCrash(); - } + movebox->set_rollCrash(); } } return true; @@ -7069,7 +7066,10 @@ BOOL daPy_lk_c::procBackJumpLand() { /* 80115E88-80115EA4 .text checkAutoJumpFlying__9daPy_lk_cCFv */ int daPy_lk_c::checkAutoJumpFlying() const { - return mCurProc != daPyProc_AUTO_JUMP_e ? -1 : m34D0; + if (mCurProc != daPyProc_AUTO_JUMP_e) { + return -1; + } + return m34D0; } /* 80115EA4-8011602C .text procAutoJump_init__9daPy_lk_cFv */ @@ -8566,11 +8566,11 @@ s16 daPy_lk_c::getGroundAngle(cBgS_PolyInfo* param_1, s16 param_2) { if (plane == NULL || !cBgW_CheckBGround(plane->GetNP()->y)) { return 0; } - f32 cos = cM_scos((cM_atan2s(plane->GetNP()->x, plane->GetNP()->z) - param_2)); - f32 xz = - (std::sqrtf(plane->GetNP()->x * plane->GetNP()->x + plane->GetNP()->z * plane->GetNP()->z)); + cXyz* norm = plane->GetNP(); + f32 cos = cM_scos((cM_atan2s(norm->x, norm->z) - param_2)); + f32 xz = (std::sqrtf(norm->x * norm->x + norm->z * norm->z)); xz *= cos; - return cM_atan2s(xz, plane->GetNP()->y); + return cM_atan2s(xz, norm->y); } /* 80119EBC-8011A508 .text setLegAngle__9daPy_lk_cFfiPsPs */ @@ -9212,10 +9212,10 @@ void daPy_lk_c::setNeckAngle() { daPy_matAnm_c::onEyeMoveFlg(); } } else { - m_tex_eye_scroll[0]->mEyePos.x = 0.0f; - m_tex_eye_scroll[1]->mEyePos.x = 0.0f; - m_tex_eye_scroll[0]->mEyePos.y = 0.0f; - m_tex_eye_scroll[1]->mEyePos.y = 0.0f; + m_tex_eye_scroll[0]->setNowOffsetX(0.0f); + m_tex_eye_scroll[1]->setNowOffsetX(0.0f); + m_tex_eye_scroll[0]->setNowOffsetY(0.0f); + m_tex_eye_scroll[1]->setNowOffsetY(0.0f); if (daPy_matAnm_c::getEyeMoveFlg() != 0) { daPy_matAnm_c::setMorfFrame(3); } @@ -11885,10 +11885,11 @@ void daPy_lk_c::initTextureScroll() { m_texMtxAnm[no].setAnmTransform(btk); m_texMtxAnm[no].setAnmIndex(no); - tmtx->getTexMtxInfo().mInfo = (tmtx->getTexMtxInfo().mInfo & 0x7F) | btk->getTexMtxCalcType() << 7; - tmtx->getTexMtxInfo().mCenter.x = btk->getSRTCenter(no).x; - tmtx->getTexMtxInfo().mCenter.y = btk->getSRTCenter(no).y; - tmtx->getTexMtxInfo().mCenter.z = btk->getSRTCenter(no).z; + J3DTexMtxInfo& tmtxinfo = tmtx->getTexMtxInfo(); + tmtxinfo.mInfo = (tmtxinfo.mInfo & 0x7F) | btk->getTexMtxCalcType() << 7; + tmtxinfo.mCenter.x = btk->getSRTCenter(no).x; + tmtxinfo.mCenter.y = btk->getSRTCenter(no).y; + tmtxinfo.mCenter.z = btk->getSRTCenter(no).z; JUT_ASSERT(VERSION_SELECT(20814, 21001, 21001, 21001), mtl->getMaterialAnm() != NULL); diff --git a/src/d/actor/d_a_tag_msg.cpp b/src/d/actor/d_a_tag_msg.cpp index ce2441e98..575eda102 100644 --- a/src/d/actor/d_a_tag_msg.cpp +++ b/src/d/actor/d_a_tag_msg.cpp @@ -40,7 +40,7 @@ const char* daTag_Msg_c::myDemoName() { dStage_EventInfo_c *pEventInfo; u32 eventNo; - pEventInfo = dComIfGp_getStageEventInfo(); + pEventInfo = dComIfGp_getStage().getEventInfo(); eventNo = getEventNo() & 0xff; if (getMessage() == 0x1902) { diff --git a/src/d/d_event.cpp b/src/d/d_event.cpp index a2357e95e..9647b1acc 100644 --- a/src/d/d_event.cpp +++ b/src/d/d_event.cpp @@ -80,7 +80,7 @@ s32 dEvt_control_c::order(u16 eventType, u16 priority, u16 flag, u16 hindFlag, v /* 8007002C-8007015C .text setParam__14dEvt_control_cFP12dEvt_order_c */ void dEvt_control_c::setParam(dEvt_order_c* order) { - dStage_EventInfo_c* stageEventInfo = dComIfGp_getStageEventInfo(); + dStage_EventInfo_c* stageEventInfo = dComIfGp_getStage().getEventInfo(); setPt1(order->mActor1); setPt2(order->mActor2); mEventId = order->mEventId; @@ -696,7 +696,7 @@ void dEvt_control_c::remove() { /* 800714AC-80071534 .text getStageEventDt__14dEvt_control_cFv */ dStage_Event_dt_c* dEvt_control_c::getStageEventDt() { - dStage_EventInfo_c* stageEventInfo = dComIfGp_getStageEventInfo(); + dStage_EventInfo_c* stageEventInfo = dComIfGp_getStage().getEventInfo(); if (getMode() == dEvtMode_NONE_e) return NULL; @@ -708,7 +708,7 @@ dStage_Event_dt_c* dEvt_control_c::getStageEventDt() { /* 80071534-800715B8 .text nextStageEventDt__14dEvt_control_cFPv */ dStage_Event_dt_c* dEvt_control_c::nextStageEventDt(void* idxp) { - dStage_EventInfo_c* stageEventInfo = dComIfGp_getStageEventInfo(); + dStage_EventInfo_c* stageEventInfo = dComIfGp_getStage().getEventInfo(); if (idxp == NULL) return NULL; diff --git a/src/d/d_event_manager.cpp b/src/d/d_event_manager.cpp index 2f4b52809..e9b38721c 100644 --- a/src/d/d_event_manager.cpp +++ b/src/d/d_event_manager.cpp @@ -22,7 +22,7 @@ void dEvent_exception_c::init() { /* 800737F4-80073900 .text setStartDemo__18dEvent_exception_cFi */ int dEvent_exception_c::setStartDemo(int eventInfoIdx) { - dStage_EventInfo_c* stageEventInfo = dComIfGp_getStageEventInfo(); + dStage_EventInfo_c* stageEventInfo = dComIfGp_getStage().getEventInfo(); if (eventInfoIdx == 0xFF) { mEventInfoIdx = 206; return 0xFF; @@ -67,7 +67,7 @@ const char* dEvent_exception_c::getEventName() { "FALL_START", }; - dStage_EventInfo_c* stageEventInfo = dComIfGp_getStageEventInfo(); + dStage_EventInfo_c* stageEventInfo = dComIfGp_getStage().getEventInfo(); stage_stag_info_class* stage_info = dComIfGp_getStageStagInfo(); if (mEventInfoIdx == -1) return NULL; @@ -339,7 +339,7 @@ dEvDtEvent_c* dEvent_manager_c::getEventData(s16 eventIdx) { /* 800743AC-800744AC .text getEventIdx__16dEvent_manager_cFPCcUc */ s16 dEvent_manager_c::getEventIdx(const char* eventName, u8 eventInfoIdx) { - dStage_EventInfo_c* stageEventInfo = dComIfGp_getStageEventInfo(); + dStage_EventInfo_c* stageEventInfo = dComIfGp_getStage().getEventInfo(); if (mList.mHeaderP == NULL) return -1; @@ -733,7 +733,7 @@ void dEvent_manager_c::setPrmStaff(void* work, int staffIdx) { /* 80075288-8007537C .text getToolId__16dEvent_manager_cFUci */ u8 dEvent_manager_c::getToolId(u8 r4, int r31) { - dStage_EventInfo_c* eventInfo = dComIfGp_getStageEventInfo(); + dStage_EventInfo_c* eventInfo = dComIfGp_getStage().getEventInfo(); int r5 = r31; if (r4 == 0xFF) { return 0xFF; diff --git a/src/d/d_file_select.cpp b/src/d/d_file_select.cpp index b1094e8f0..e17e187fb 100644 --- a/src/d/d_file_select.cpp +++ b/src/d/d_file_select.cpp @@ -1801,7 +1801,7 @@ void dFile_select_c::CommandExec() { mDoMemCdRWm_SetCheckSumGameData(mSaveDataPtr, saveSlot); mDoMemCd_setPictWriteDataPtr(mSavePicDataPtr); mDoMemCd_setCopyToPos(0xFF); - mDoMemCd_save(mSaveDataPtr, 0x1650, 0); + mDoMemCd_Save(mSaveDataPtr, 0x1650, 0); field_0x392b = 0xF; } else if(field_0x392a == 3) { @@ -1816,7 +1816,7 @@ void dFile_select_c::CommandExec() { memcpy(r30, r4_2, 0x6000); mDoMemCd_setCopyToPos(field_0x3926); mDoMemCd_setPictWriteDataPtr(r30); - mDoMemCd_save(mSaveDataPtr, 0x1650, 0); + mDoMemCd_Save(mSaveDataPtr, 0x1650, 0); field_0x392b = 0x10; } } @@ -3715,7 +3715,7 @@ void dFile_select_c::ExDataSave() { dComIfGs_setDataNum(saveSlot); mDoMemCd_setPictWriteDataPtr(NULL); #endif - mDoMemCd_save(mSaveDataPtr, 0x1650, 0); + mDoMemCd_Save(mSaveDataPtr, 0x1650, 0); field_0x392b = 0x20; } diff --git a/src/d/d_map.cpp b/src/d/d_map.cpp index 092b59be9..23045f57a 100644 --- a/src/d/d_map.cpp +++ b/src/d/d_map.cpp @@ -182,14 +182,13 @@ void dMap_GetFloorInfoDtP(dStage_FloorInfo_c* floor, f32 ret) { /* 80045A98-80045AEC .text dMap_GetFloorInfoDtPFromFloorNo__FP18dStage_FloorInfo_cUc */ dStage_FloorInfo_dt_c* dMap_GetFloorInfoDtPFromFloorNo(dStage_FloorInfo_c* floor, u8 i_floorNo) { - /* Nonmatching */ dStage_FloorInfo_dt_c* entry; BOOL valid = FALSE; if (floor != NULL) { entry = floor->m_entries; - for (int i = 0; i < floor->num; i++, entry++) { - if (entry->floorNo == i_floorNo) { + for (int i = 0; !valid && i < floor->num; i++, entry++) { + if (i_floorNo == entry->floorNo) { valid = TRUE; break; } @@ -220,20 +219,26 @@ void dMap_GetFloorNo(dStage_dt_c*, f32) { u32 dMap_RoomInfo_c::getRoomDspFloorNo(u8 i_no, BOOL search) { /* Nonmatching */ s32 no = i_no - Floor_Base; +#if VERSION > VERSION_DEMO JUT_ASSERT(0x702, Floor_Valid(no)); +#endif s32 dspFloorNo = field_0x2[no]; if (search) { if (!IsFloorNo(dspFloorNo)) { while (!IsFloorNo(dspFloorNo) && --no >= 0) { +#if VERSION > VERSION_DEMO JUT_ASSERT(0x70f, Floor_Valid(no)); +#endif dspFloorNo = field_0x2[no]; } } if (!IsFloorNo(dspFloorNo)) { while (!IsFloorNo(dspFloorNo) && ++no <= (Floor_Num - 1)) { +#if VERSION > VERSION_DEMO JUT_ASSERT(0x718, Floor_Valid(no)); +#endif dspFloorNo = field_0x2[no]; } } @@ -411,13 +416,13 @@ void dMap_RoomInfoCtrl_c::ctrlDrawRoomRealSize(int i_no, int p1, int p2, int p3, /* 80047C64-80047CD0 .text init__19dMap_RoomInfoCtrl_cFv */ void dMap_RoomInfoCtrl_c::init() { - /* Nonmatching */ - int no = 0; - dMap_RoomInfo_c* info = m_info; + int no; + int i; dMap_RoomInfo_c* prev = NULL; - for (int i = 0; i < m_num; i++, no++, info++) { - info->init(prev, no); - prev = info; + dMap_RoomInfo_c* info = m_info; + no = 0; + for (i = 0; i < m_num; no++, i++, info++) { + prev = info->init(prev, no); } } diff --git a/src/m_Do/m_Do_graphic.cpp b/src/m_Do/m_Do_graphic.cpp index 8672e839c..03295a5ee 100644 --- a/src/m_Do/m_Do_graphic.cpp +++ b/src/m_Do/m_Do_graphic.cpp @@ -1047,7 +1047,7 @@ void blockenc(u8* block) { r6 = 30; // r6 (bit offset within r8) r8 = 0; // r8 (bitfield of color indexes) pix_idx = r8; - for (; pix_idx < 0x40; pix_idx += 4) { + for (; pix_idx < 0x40; pix_idx += 4, r6 -= 2) { // b2 = block[pix_idx + 2] * 11; // r2 = block[pix_idx + 0] * 30; // g2 = block[pix_idx + 1] * 59; @@ -1068,7 +1068,6 @@ void blockenc(u8* block) { } r8 |= (r24 & 0x03) << r6; - r6 -= 2; } } else { // VERSION_DEMO only block (optimized out in retail) pix_idx = 0; // r10