From a3578d0c7c64b11258260bee1148d33195542c4f Mon Sep 17 00:00:00 2001 From: TakaRikka Date: Tue, 4 Oct 2022 17:29:53 -0700 Subject: [PATCH] fopEn_enemy / fix e_wb --- Progress.md | 8 +- .../d_a_alink/throwBoomerang__9daAlink_cFv.s | 4 +- ...y_boomerangMove_cFP4cXyzPsP10fopAc_ac_cs.s | 10 +- .../execute__13daBoomerang_cFv.s | 4 +- include/JSystem/J3DGraphBase/J3DDrawBuffer.h | 39 +- include/JSystem/J3DGraphBase/J3DPacket.h | 4 +- include/JSystem/J3DGraphBase/J3DShape.h | 16 + include/JSystem/J3DGraphBase/J3DShapeMtx.h | 36 +- .../JSystem/J3DGraphLoader/J3DShapeFactory.h | 74 +++- include/JSystem/JSupport/JSupport.h | 2 +- include/d/a/d_a_alink.h | 20 +- include/d/a/d_a_player.h | 24 +- include/d/bg/d_bg_s_acch.h | 2 +- include/d/com/d_com_inf_game.h | 42 ++- include/d/d_drawlist.h | 1 + include/d/event/d_event.h | 2 + include/d/particle/d_particle.h | 23 +- include/f_op/f_op_actor.h | 22 ++ include/m_Do/m_Do_ext.h | 90 +++-- include/m_Do/m_Do_graphic.h | 1 + include/m_Do/m_Do_mtx.h | 2 +- include/rel/d/a/d_a_boomerang/d_a_boomerang.h | 4 +- include/rel/d/a/e/d_a_e_wb/d_a_e_wb.h | 144 +++++++- libs/JSystem/J3DGraphBase/J3DDrawBuffer.cpp | 265 ++++++-------- libs/JSystem/J3DGraphBase/J3DShapeMtx.cpp | 4 +- .../J3DGraphLoader/J3DShapeFactory.cpp | 308 +++++++++------- rel/d/a/d_a_boomerang/d_a_boomerang.cpp | 2 +- rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp | 115 +----- src/d/a/d_a_alink.cpp | 4 +- src/d/a/d_a_alink_boom.inc | 49 +-- src/d/a/d_a_horse_static.cpp | 19 +- src/d/a/d_a_itembase.cpp | 16 +- src/d/a/d_a_obj.cpp | 178 ++++----- src/d/a/d_a_player.cpp | 346 +++++++++--------- src/d/particle/d_particle.cpp | 2 +- src/f_op/f_op_actor.cpp | 11 - 36 files changed, 1057 insertions(+), 836 deletions(-) diff --git a/Progress.md b/Progress.md index fc8be3633dd..c2234273c8a 100644 --- a/Progress.md +++ b/Progress.md @@ -7,22 +7,22 @@ Section | Percentage | Decompiled (bytes) | Total (bytes) .init | 91.849662% | 8700 | 9472 .extab | 100.000000% | 96 | 96 .extabindex | 100.000000% | 96 | 96 -.text | 16.356925% | 588284 | 3596544 +.text | 16.478820% | 592668 | 3596544 .ctors | 100.000000% | 448 | 448 .dtors | 100.000000% | 32 | 32 .rodata | 100.000000% | 193856 | 193856 .data | 100.000000% | 197632 | 197632 .sdata | 100.000000% | 1408 | 1408 .sdata2 | 100.000000% | 20832 | 20832 -Total | 25.160968% | 1011640 | 4020672 +Total | 25.270005% | 1016024 | 4020672 ## Total Section | Percentage | Decompiled (bytes) | Total (bytes) ---|---|---|--- -main.dol | 25.160968% | 1011640 | 4020672 +main.dol | 25.270005% | 1016024 | 4020672 RELs | 33.217047% | 3820068 | 11500324 -Total | 31.130141% | 4831708 | 15520996 +Total | 31.158387% | 4836092 | 15520996 ## RELs diff --git a/asm/d/a/d_a_alink/throwBoomerang__9daAlink_cFv.s b/asm/d/a/d_a_alink/throwBoomerang__9daAlink_cFv.s index 009a9f0bc3a..dc8922a68d4 100644 --- a/asm/d/a/d_a_alink/throwBoomerang__9daAlink_cFv.s +++ b/asm/d/a/d_a_alink/throwBoomerang__9daAlink_cFv.s @@ -43,13 +43,13 @@ lbl_800E0734: /* 800E0758 64 03 00 40 */ oris r3, r0, 0x40 /* 800E075C 90 64 5F 18 */ stw r3, 0x5f18(r4) /* 800E0760 38 00 40 00 */ li r0, 0x4000 -/* 800E0764 B0 0D 8A 9C */ sth r0, struct_8045101C+0x0(r13) +/* 800E0764 B0 0D 8A 9C */ sth r0, m_dropAngleY__20daPy_boomerangMove_c+0x0(r13) /* 800E0768 54 60 03 56 */ rlwinm r0, r3, 0, 0xd, 0xb /* 800E076C 90 04 5F 18 */ stw r0, 0x5f18(r4) /* 800E0770 38 00 FF FF */ li r0, -1 /* 800E0774 B0 1D 30 8E */ sth r0, 0x308e(r29) /* 800E0778 38 00 00 00 */ li r0, 0 -/* 800E077C B0 0D 8A 9E */ sth r0, struct_8045101C+0x2(r13) +/* 800E077C B0 0D 8A 9E */ sth r0, m_dropAngleY__20daPy_boomerangMove_c+0x2(r13) /* 800E0780 48 00 00 44 */ b lbl_800E07C4 lbl_800E0784: /* 800E0784 3C 60 80 39 */ lis r3, m__20daAlinkHIO_pickUp_c0@ha /* 0x8038E840@ha */ diff --git a/asm/d/a/d_a_player/posMove__20daPy_boomerangMove_cFP4cXyzPsP10fopAc_ac_cs.s b/asm/d/a/d_a_player/posMove__20daPy_boomerangMove_cFP4cXyzPsP10fopAc_ac_cs.s index 0cff662c51f..ec6f3756e79 100644 --- a/asm/d/a/d_a_player/posMove__20daPy_boomerangMove_cFP4cXyzPsP10fopAc_ac_cs.s +++ b/asm/d/a/d_a_player/posMove__20daPy_boomerangMove_cFP4cXyzPsP10fopAc_ac_cs.s @@ -51,7 +51,7 @@ lbl_8015E6F0: /* 8015E708 98 1E 00 00 */ stb r0, 0(r30) /* 8015E70C 48 00 00 24 */ b lbl_8015E730 lbl_8015E710: -/* 8015E710 A8 0D 8A 9E */ lha r0, struct_8045101C+0x2(r13) +/* 8015E710 A8 0D 8A 9E */ lha r0, m_dropAngleY__20daPy_boomerangMove_c+0x2(r13) /* 8015E714 2C 00 00 00 */ cmpwi r0, 0 /* 8015E718 41 82 00 18 */ beq lbl_8015E730 /* 8015E71C 88 1E 00 00 */ lbz r0, 0(r30) @@ -97,7 +97,7 @@ lbl_8015E794: /* 8015E7B4 2C 03 00 00 */ cmpwi r3, 0 /* 8015E7B8 40 82 00 A8 */ bne lbl_8015E860 lbl_8015E7BC: -/* 8015E7BC A8 0D 8A 9E */ lha r0, struct_8045101C+0x2(r13) +/* 8015E7BC A8 0D 8A 9E */ lha r0, m_dropAngleY__20daPy_boomerangMove_c+0x2(r13) /* 8015E7C0 2C 00 00 00 */ cmpwi r0, 0 /* 8015E7C4 41 82 00 10 */ beq lbl_8015E7D4 /* 8015E7C8 88 1E 00 00 */ lbz r0, 0(r30) @@ -106,7 +106,7 @@ lbl_8015E7BC: lbl_8015E7D4: /* 8015E7D4 C0 22 9C 28 */ lfs f1, lit_4334(r2) /* 8015E7D8 48 10 91 7D */ bl cM_rndF__Ff -/* 8015E7DC A8 6D 8A 9C */ lha r3, struct_8045101C+0x0(r13) +/* 8015E7DC A8 6D 8A 9C */ lha r3, m_dropAngleY__20daPy_boomerangMove_c+0x0(r13) /* 8015E7E0 A8 1D 04 E6 */ lha r0, 0x4e6(r29) /* 8015E7E4 7C 03 02 14 */ add r0, r3, r0 /* 8015E7E8 C8 42 9C 08 */ lfd f2, lit_4237(r2) @@ -136,9 +136,9 @@ lbl_8015E7D4: /* 8015E848 EC 01 00 32 */ fmuls f0, f1, f0 /* 8015E84C EC 02 00 2A */ fadds f0, f2, f0 /* 8015E850 D0 1F 00 08 */ stfs f0, 8(r31) -/* 8015E854 A8 6D 8A 9C */ lha r3, struct_8045101C+0x0(r13) +/* 8015E854 A8 6D 8A 9C */ lha r3, m_dropAngleY__20daPy_boomerangMove_c+0x0(r13) /* 8015E858 38 03 20 00 */ addi r0, r3, 0x2000 -/* 8015E85C B0 0D 8A 9C */ sth r0, struct_8045101C+0x0(r13) +/* 8015E85C B0 0D 8A 9C */ sth r0, m_dropAngleY__20daPy_boomerangMove_c+0x0(r13) lbl_8015E860: /* 8015E860 38 60 00 00 */ li r3, 0 lbl_8015E864: diff --git a/asm/rel/d/a/d_a_boomerang/d_a_boomerang/execute__13daBoomerang_cFv.s b/asm/rel/d/a/d_a_boomerang/d_a_boomerang/execute__13daBoomerang_cFv.s index 39469e10bcb..98771505c83 100644 --- a/asm/rel/d/a/d_a_boomerang/d_a_boomerang/execute__13daBoomerang_cFv.s +++ b/asm/rel/d/a/d_a_boomerang/d_a_boomerang/execute__13daBoomerang_cFv.s @@ -244,8 +244,8 @@ lbl_804A1B68: /* 804A1B9C 28 00 00 00 */ cmplwi r0, 0 /* 804A1BA0 41 82 00 10 */ beq lbl_804A1BB0 /* 804A1BA4 38 00 00 01 */ li r0, 1 -/* 804A1BA8 3C 60 80 45 */ lis r3, struct_8045101C+0x2@ha /* 0x8045101E@ha */ -/* 804A1BAC B0 03 10 1E */ sth r0, struct_8045101C+0x2@l(r3) /* 0x8045101E@l */ +/* 804A1BA8 3C 60 80 45 */ lis r3, m_dropAngleY__20daPy_boomerangMove_c+0x2@ha /* 0x8045101E@ha */ +/* 804A1BAC B0 03 10 1E */ sth r0, m_dropAngleY__20daPy_boomerangMove_c+0x2@l(r3) /* 0x8045101E@l */ lbl_804A1BB0: /* 804A1BB0 38 60 00 01 */ li r3, 1 lbl_804A1BB4: diff --git a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h index 38cc0e08c29..b937d163871 100644 --- a/include/JSystem/J3DGraphBase/J3DDrawBuffer.h +++ b/include/JSystem/J3DGraphBase/J3DDrawBuffer.h @@ -11,22 +11,37 @@ class J3DDrawPacket; class J3DMatPacket; class J3DShapePacket; -typedef void (*J3DDrawBuffer_DrawFunc)(const J3DDrawBuffer* this_); +typedef int (J3DDrawBuffer::*sortFunc)(J3DMatPacket*); +typedef void (J3DDrawBuffer::*drawFunc)() const; class J3DDrawBuffer { public: + enum EDrawType { + DRAW_HEAD, + DRAW_TAIL, + }; + + enum ESortType { + SORT_MAT, + SORT_MAT_ANM, + SORT_Z, + SORT_MODEL, + SORT_INVALID, + SORT_NON, + }; + J3DDrawBuffer() { initialize(); } ~J3DDrawBuffer(); void initialize(); J3DError allocBuffer(u32); void frameInit(); - void entryMatSort(J3DMatPacket*); - void entryMatAnmSort(J3DMatPacket*); - void entryZSort(J3DMatPacket*); - void entryModelSort(J3DMatPacket*); - void entryInvalidSort(J3DMatPacket*); - bool entryNonSort(J3DMatPacket*); - bool entryImm(J3DPacket* pPacket, u16 index); + int entryMatSort(J3DMatPacket*); + int entryMatAnmSort(J3DMatPacket*); + int entryZSort(J3DMatPacket*); + int entryModelSort(J3DMatPacket*); + int entryInvalidSort(J3DMatPacket*); + int entryNonSort(J3DMatPacket*); + int entryImm(J3DPacket* pPacket, u16 index); void draw() const; void drawHead() const; void drawTail() const; @@ -43,12 +58,12 @@ public: /* 0x10 */ f32 mZNear; /* 0x14 */ f32 mZFar; /* 0x18 */ f32 mZRatio; - /* 0x1C */ Mtx* mpZMtx; + /* 0x1C */ MtxP mpZMtx; /* 0x20 */ J3DPacket* mpCallBackPacket; - static u8 sortFuncTable[72]; - static u8 drawFuncTable[24]; - static u8 entryNum[4 + 4 /* padding */]; + static sortFunc sortFuncTable[6]; + static drawFunc drawFuncTable[2]; + static int entryNum; }; #endif /* J3DDRAWBUFFER_H */ diff --git a/include/JSystem/J3DGraphBase/J3DPacket.h b/include/JSystem/J3DGraphBase/J3DPacket.h index 6552c461afd..463ba0d3560 100644 --- a/include/JSystem/J3DGraphBase/J3DPacket.h +++ b/include/JSystem/J3DGraphBase/J3DPacket.h @@ -57,9 +57,11 @@ public: } void addChildPacket(J3DPacket*); + J3DPacket* getNextPacket() const { return mpNextSibling; } + void setNextPacket(J3DPacket* i_packet) { mpNextSibling = i_packet; } - inline void clear() { + void drawClear() { mpNextSibling = NULL; mpFirstChild = NULL; } diff --git a/include/JSystem/J3DGraphBase/J3DShape.h b/include/JSystem/J3DGraphBase/J3DShape.h index f18551d7ede..85cf0da8e97 100644 --- a/include/JSystem/J3DGraphBase/J3DShape.h +++ b/include/JSystem/J3DGraphBase/J3DShape.h @@ -27,6 +27,11 @@ static inline void J3DFifoWriteXFCmd(u16 cmd, u16 len) { class J3DCurrentMtx : public J3DCurrentMtxInfo { public: + J3DCurrentMtx() { + mMtxIdxRegA = 0x3cf3cf00; + mMtxIdxRegB = 0x00f3cf3c; + } + u32 getMtxIdxRegA() const { return mMtxIdxRegA; } u32 getMtxIdxRegB() const { return mMtxIdxRegB; } @@ -54,6 +59,14 @@ enum J3DShpFlag { class J3DShape { public: + J3DShape() { + initialize(); + } + + enum { + kVcdVatDLSize = 0xC0, + }; + /* 80314B48 */ void initialize(); /* 80314BB8 */ void addTexMtxIndexInDL(_GXAttr, u32); /* 80314CBC */ void addTexMtxIndexInVcd(_GXAttr); @@ -93,11 +106,14 @@ public: inline u32 getMtxGroupNum() const { return mMtxGroupNum; } inline J3DShapeDraw* getShapeDraw(u32 idx) const { return mShapeDraw[idx]; } inline J3DShapeMtx* getShapeMtx(u32 idx) const { return mShapeMtx[idx]; } + static void resetVcdVatCache() { sOldVcdVatCmd = NULL; } static void* sOldVcdVatCmd; private: + friend struct J3DShapeFactory; + /* 0x04 */ J3DMaterial* mMaterial; /* 0x08 */ u16 mIndex; /* 0x0A */ u16 mMtxGroupNum; diff --git a/include/JSystem/J3DGraphBase/J3DShapeMtx.h b/include/JSystem/J3DGraphBase/J3DShapeMtx.h index 0a346b20683..1b745e5fc19 100644 --- a/include/JSystem/J3DGraphBase/J3DShapeMtx.h +++ b/include/JSystem/J3DGraphBase/J3DShapeMtx.h @@ -24,6 +24,10 @@ extern u8 struct_804515B0[4]; class J3DShapeMtx { public: + J3DShapeMtx(u16 useMtxIndex) + : mUseMtxIndex(useMtxIndex) + {} + /* 803130A8 */ void resetMtxLoadCache(); /* 803130E4 */ void loadMtxIndx_PNGP(int, u16) const; /* 80313128 */ void loadMtxIndx_PCPU(int, u16) const; @@ -54,6 +58,10 @@ private: class J3DShapeMtxConcatView : public J3DShapeMtx { public: + J3DShapeMtxConcatView(u16 useMtxIndex) + : J3DShapeMtx(useMtxIndex) + {} + /* 80314730 */ virtual ~J3DShapeMtxConcatView(); /* 803147E0 */ virtual u32 getType() const; /* 80313C54 */ virtual void load() const; @@ -73,6 +81,10 @@ public: class J3DShapeMtxYBBoardConcatView : public J3DShapeMtxConcatView { public: + J3DShapeMtxYBBoardConcatView(u16 useMtxIndex) + : J3DShapeMtxConcatView(useMtxIndex) + {} + /* 80314520 */ virtual ~J3DShapeMtxYBBoardConcatView(); /* 803147E0 */ virtual u32 getType() const; /* 803143E4 */ virtual void load() const; @@ -80,6 +92,10 @@ public: class J3DShapeMtxBBoardConcatView : public J3DShapeMtxConcatView { public: + J3DShapeMtxBBoardConcatView(u16 useMtxIndex) + : J3DShapeMtxConcatView(useMtxIndex) + {} + /* 803145A4 */ virtual ~J3DShapeMtxBBoardConcatView(); /* 803147E0 */ virtual u32 getType() const; /* 803142D4 */ virtual void load() const; @@ -87,6 +103,12 @@ public: class J3DShapeMtxMulti : public J3DShapeMtx { public: + J3DShapeMtxMulti(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable) + : J3DShapeMtx(useMtxIndex) + , mUseMtxNum(useMtxNum) + , mUseMtxIndexTable(useMtxIndexTable) + {} + /* 803146B0 */ virtual ~J3DShapeMtxMulti(); /* 803147E0 */ virtual u32 getType() const; /* 80273E08 */ virtual u32 getUseMtxNum() const; @@ -96,11 +118,17 @@ public: private: /* 0x6 */ u16 mUseMtxNum; - /* 0x8 */ u16* mUseMtxIndex; + /* 0x8 */ u16* mUseMtxIndexTable; }; -class J3DShapeMtxMultiConcatView : public J3DShapeMtx { +class J3DShapeMtxMultiConcatView : public J3DShapeMtxConcatView { public: + J3DShapeMtxMultiConcatView(u16 useMtxIndex, u16 useMtxNum, u16* useMtxIndexTable) + : J3DShapeMtxConcatView(useMtxIndex) + , mUseMtxNum(useMtxNum) + , mUseMtxIndexTable(useMtxIndexTable) + {} + /* 8031461C */ virtual ~J3DShapeMtxMultiConcatView(); /* 803147E0 */ virtual u32 getType() const; /* 80273E08 */ virtual u32 getUseMtxNum() const; @@ -111,7 +139,7 @@ public: private: /* 0x6 */ u16 mUseMtxNum; - /* 0x8 */ u16* mUseMtxIndex; + /* 0x8 */ u16* mUseMtxIndexTable; }; -#endif /* J3DSHAPEMTX_H */ +#endif /* J3DSHAPEMTX_H */ \ No newline at end of file diff --git a/include/JSystem/J3DGraphLoader/J3DShapeFactory.h b/include/JSystem/J3DGraphLoader/J3DShapeFactory.h index 6f1f64ce13b..385a217e253 100644 --- a/include/JSystem/J3DGraphLoader/J3DShapeFactory.h +++ b/include/JSystem/J3DGraphLoader/J3DShapeFactory.h @@ -1,6 +1,78 @@ #ifndef J3DSHAPEFACTORY_H #define J3DSHAPEFACTORY_H +#include "dolphin/gx/GX.h" #include "dolphin/types.h" -#endif /* J3DSHAPEFACTORY_H */ +struct J3DShape; +struct J3DShapeMtx; +struct J3DShapeDraw; +struct ResNTAB; + +struct J3DShapeInitData { + /* 0x00 */ u8 mShapeMtxType; + /* 0x02 */ u16 mMtxGroupNum; + /* 0x04 */ u16 mVtxDescListIndex; + /* 0x06 */ u16 mMtxInitDataIndex; + /* 0x08 */ u16 mDrawInitDataIndex; + /* 0x0C */ f32 mRadius; + /* 0x10 */ Vec mMin; + /* 0x1C */ Vec mMax; +}; + +struct J3DShapeMtxInitData { + /* 0x00 */ u16 mUseMtxIndex; + /* 0x02 */ u16 mUseMtxCount; + /* 0x04 */ u32 mFirstUseMtxIndex; +}; + +struct J3DShapeDrawInitData { + /* 0x00 */ u32 mDisplayListSize; + /* 0x04 */ u32 mDisplayListIndex; +}; + +struct J3DShapeBlock { + /* 0x00 */ u8 mMagic[4]; + /* 0x04 */ u32 mSize; + + /* 0x08 */ u16 mShapeNum; + /* 0x0A */ u16 _pad; + + /* 0x0C */ J3DShapeInitData* mShapeInitData; + /* 0x10 */ u16* mIndexTable; + /* 0x14 */ ResNTAB* mNameTable; + /* 0x18 */ GXVtxDescList* mVtxDescList; + /* 0x1C */ u16* mMtxTable; + /* 0x20 */ u8* mDisplayListData; + /* 0x24 */ J3DShapeMtxInitData* mMtxInitData; + /* 0x28 */ J3DShapeDrawInitData* mDrawInitData; +}; + +struct J3DShapeFactory { + /* 80337350 */ J3DShapeFactory(J3DShapeBlock const&); + /* 80337400 */ J3DShape* create(int, u32, GXVtxDescList*); + /* 803375BC */ J3DShapeMtx* newShapeMtx(u32, int, int) const; + /* 8033784C */ J3DShapeDraw* newShapeDraw(int, int) const; + /* 803378D8 */ void allocVcdVatCmdBuffer(u32); + /* 80337944 */ s32 calcSize(int, u32); + /* 803379D8 */ s32 calcSizeVcdVatCmdBuffer(u32); + /* 803379E8 */ s32 calcSizeShapeMtx(u32, int, int) const; + + /* 0x00 */ J3DShapeInitData* mShapeInitData; + /* 0x04 */ u16* mIndexTable; + /* 0x08 */ GXVtxDescList* mVtxDescList; + /* 0x0C */ u16* mMtxTable; + /* 0x10 */ u8* mDisplayListData; + /* 0x14 */ J3DShapeMtxInitData* mMtxInitData; + /* 0x18 */ J3DShapeDrawInitData* mDrawInitData; + /* 0x1C */ u8* mVcdVatCmdBuffer; + + u32 getMtxGroupNum(int no) const { return mShapeInitData[mIndexTable[no]].mMtxGroupNum; } + GXVtxDescList* getVtxDescList(int no) const { return (GXVtxDescList*)((u8*)mVtxDescList + mShapeInitData[mIndexTable[no]].mVtxDescListIndex); } + f32 getRadius(int no) const { return mShapeInitData[mIndexTable[no]].mRadius; } + Vec& getMin(int no) const { return mShapeInitData[mIndexTable[no]].mMin; } + Vec& getMax(int no) const { return mShapeInitData[mIndexTable[no]].mMax; } +}; + + +#endif /* J3DSHAPEFACTORY_H */ \ No newline at end of file diff --git a/include/JSystem/JSupport/JSupport.h b/include/JSystem/JSupport/JSupport.h index 7c1d91058ab..e98dee1f987 100644 --- a/include/JSystem/JSupport/JSupport.h +++ b/include/JSystem/JSupport/JSupport.h @@ -3,7 +3,7 @@ template T* JSUConvertOffsetToPtr(const void* ptr, const void* offset) { - if (ptr == NULL) { + if (offset == NULL) { return NULL; } else { return (T*)((s32)ptr + (s32)offset); diff --git a/include/d/a/d_a_alink.h b/include/d/a/d_a_alink.h index 7df6f5c7a6c..f0caef5526d 100644 --- a/include/d/a/d_a_alink.h +++ b/include/d/a/d_a_alink.h @@ -1430,7 +1430,7 @@ public: /* 800E01CC */ void cancelBoomerangLock(fopAc_ac_c*); /* 800E0210 */ fopAc_ac_c* getBoomerangActor(); /* 800E0244 */ bool checkBoomerangChargeEnd(); - /* 800E02B8 */ void checkBoomerangCarry(fopAc_ac_c*); + /* 800E02B8 */ BOOL checkBoomerangCarry(fopAc_ac_c*); /* 800E03D0 */ void initBoomerangUpperAnimeSpeed(int); /* 800E0440 */ BOOL checkBoomerangAnime() const; /* 800E04AC */ BOOL checkBoomerangThrowAnime() const; @@ -5596,17 +5596,17 @@ class daAlinkHIO_boom_c1 { public: /* 0x00 */ daAlinkHIO_anm_c mThrowAnm; /* 0x14 */ daAlinkHIO_anm_c mCatchAnm; - /* 0x28 */ s16 field_0x28; + /* 0x28 */ s16 field_0x28; // return time? /* 0x2A */ s16 mBgThroughTime; - /* 0x2C */ f32 field_0x2c; - /* 0x30 */ f32 field_0x30; - /* 0x34 */ f32 field_0x34; - /* 0x38 */ f32 field_0x38; - /* 0x3C */ f32 field_0x3c; - /* 0x40 */ f32 field_0x40; - /* 0x44 */ f32 field_0x44; + /* 0x2C */ f32 mIdleAnmSpeed; + /* 0x30 */ f32 mStartInterpolation; + /* 0x34 */ f32 mFlySpeed; + /* 0x38 */ f32 mFlySpeed2; // return speed? + /* 0x3C */ f32 mFlyDistMax; + /* 0x40 */ f32 mHorsebackFlyDistMax; + /* 0x44 */ f32 mLockDistMax; /* 0x48 */ f32 mCatchSpeed; -}; // Size: 0x4c +}; // Size: 0x4C class daAlinkHIO_boom_c0 { public: diff --git a/include/d/a/d_a_player.h b/include/d/a/d_a_player.h index 1e5e9c7604d..f026d1bfa89 100644 --- a/include/d/a/d_a_player.h +++ b/include/d/a/d_a_player.h @@ -34,12 +34,15 @@ private: class daPy_boomerangMove_c { public: /* 8015E5B0 */ void initOffset(cXyz const*); - /* 8015E654 */ void posMove(cXyz*, s16*, fopAc_ac_c*, s16); + /* 8015E654 */ int posMove(cXyz*, s16*, fopAc_ac_c*, s16); /* 8015E87C */ void bgCheckAfterOffset(cXyz const*); + static s16 m_dropAngleY; + static s16 m_eventKeepFlg; + private: /* 0x0 */ u8 field_0x0; - /* 0x2 */ u16 field_0x2; + /* 0x2 */ s16 field_0x2; /* 0x4 */ f32 field_0x4; /* 0x8 */ f32 field_0x8; }; // Size: 0xC @@ -213,7 +216,15 @@ public: HEAVY_STATE_BOOTS = FLG0_UNK_40000000 | EQUIP_HEAVY_BOOTS | FLG0_UNK_20000, }; - enum daPy_FLG1 { IS_WOLF = 0x2000000, FLG1_UNK_10000 = 0x10000, THROW_DAMAGE = 0x4000, FLG1_UNK_4 = 4, }; + + enum daPy_FLG1 { + IS_WOLF = 0x2000000, + FLG1_UNK_10000 = 0x10000, + THROW_DAMAGE = 0x4000, + FLG1_UNK_4 = 4, + FLG1_UNK_2 = 2, + }; + enum daPy_FLG2 { FLG2_UNK_20000000 = 0x20000000, FLG2_UNK_4080000 = 0x4080000, @@ -227,12 +238,14 @@ public: UNK_FLG2_2 = 2, UNK_DAPY_FLG2_1 = 1 }; + enum daPy_FLG3 { FLG3_UNK_2000000 = 0x2000000, FLG3_UNK_1000000 = 0x1000000, FLG3_UNK_100000 = 0x100000, COPY_ROD_THROW_AFTER = 0x40000 }; + enum daPy_ERFLG0 { ERFLG0_UNK_8000000 = 0x8000000, ERFLG0_UNK_1000000 = 0x1000000, @@ -243,15 +256,18 @@ public: ERFLG0_UNK_2 = 2, ERFLG0_UNK_1 = 1, }; + enum daPy_ERFLG1 { GANON_FINISH = 0x80000000, UNK_FORCE_PUT_POS = 0x2000, ERFLG1_UNK_2 = 2, ERFLG1_UNK_1 = 1, }; + enum daPy_ERFLG2 { ERFLG2_UNK_100 = 0x100, }; + enum daPy_RFLG0 { RFLG0_UNK_8000000 = 0x8000000, RFLG0_UNK_4000 = 0x4000, @@ -321,7 +337,7 @@ public: static u32 checkCarryStartLightBallA(); static u32 checkCarryStartLightBallB(); float getSpinnerRideSpeed() const; - void checkSpinnerReflectEffect(); + bool checkSpinnerReflectEffect(); static bool checkBoomerangCharge(); bool checkBoomerangChargeTime(); static daBoomerang_c* getThrowBoomerangActor(); diff --git a/include/d/bg/d_bg_s_acch.h b/include/d/bg/d_bg_s_acch.h index 0754ceb3ec8..7a56b4d3d65 100644 --- a/include/d/bg/d_bg_s_acch.h +++ b/include/d/bg/d_bg_s_acch.h @@ -47,7 +47,7 @@ public: bool ChkWallHit() { return m_flags & WALL_HIT; } void SetCir(cXyz& pos) { m_cir.Set(pos.x, pos.z, pos.y + GetWallH(), m_wall_r); } -}; +}; // Size: 0x40 class dBgS; class dBgS_Acch : public cBgS_Chk, public dBgS_Chk { diff --git a/include/d/com/d_com_inf_game.h b/include/d/com/d_com_inf_game.h index 0d0a803c887..899e6e40841 100644 --- a/include/d/com/d_com_inf_game.h +++ b/include/d/com/d_com_inf_game.h @@ -364,7 +364,10 @@ public: void setPlayerPtr(int i, fopAc_ac_c* ptr) { mPlayerPtr[i] = ptr; } void setPlayer(int i, fopAc_ac_c* player) { mPlayer[i] = (daAlink_c*)player; } - void setPlayerInfo(int i, fopAc_ac_c* ptr, int camIdx) { mPlayer[i] = (daAlink_c*)ptr; mPlayerCameraID[camIdx] = 0; } + void setPlayerInfo(int i, fopAc_ac_c* ptr, int camIdx) { + mPlayer[i] = (daAlink_c*)ptr; + mPlayerCameraID[camIdx] = 0; + } void setPlayerStatus(int param_0, int i, u32 flag) { mPlayerStatus[i] |= flag; } void clearPlayerStatus(int param_0, int i, u32 flag) { mPlayerStatus[i] &= ~flag; } bool checkPlayerStatus(int param_0, int i, u32 flag) { return flag & mPlayerStatus[i]; } @@ -1477,7 +1480,6 @@ inline void dComIfGs_setMemoryToCard(u8* p_saveData, int dataNum) { g_dComIfG_gameInfo.info.memory_to_card((char*)p_saveData, dataNum); } - void dComIfGp_setSelectItem(int index); s32 dComIfGp_offHeapLockFlag(int flag); void dComIfGp_createSubExpHeap2D(); @@ -2024,7 +2026,8 @@ inline BOOL dComIfGp_checkCameraAttentionStatus(int i, u32 flag) { return g_dComIfG_gameInfo.play.checkCameraAttentionStatus(i, flag); } -inline void dComIfGp_setCameraInfo(int camIdx, camera_class* p_cam, int param_2, int param_3, int param_4) { +inline void dComIfGp_setCameraInfo(int camIdx, camera_class* p_cam, int param_2, int param_3, + int param_4) { g_dComIfG_gameInfo.play.setCameraInfo(camIdx, p_cam, param_2, param_3, param_4); } @@ -2288,7 +2291,8 @@ inline int dComIfGp_event_moveApproval(void* actor) { inline int dComIfGp_event_order(u16 eventType, u16 priority, u16 flag, u16 param_3, void* param_4, void* param_5, s16 eventID, u8 infoIdx) { - return g_dComIfG_gameInfo.play.getEvent().order(eventType, priority, flag, param_3, param_4, param_5, eventID, infoIdx); + return g_dComIfG_gameInfo.play.getEvent().order(eventType, priority, flag, param_3, param_4, + param_5, eventID, infoIdx); } inline void dComIfGp_event_setGtItm(int i_itemNo) { @@ -2436,10 +2440,10 @@ inline u32 dComIfGp_particle_set(u32 param_0, u16 param_1, const cXyz* param_2, param_10, param_11, 1.0f); } -inline u32 dComIfGp_particle_set(u32 param_0, u16 param_1, const cXyz* param_2, const csXyz* param_3, - const cXyz* param_4, u8 param_5, dPa_levelEcallBack* param_6, - s8 param_7, const GXColor* param_8, const GXColor* param_9, - const cXyz* param_10) { +inline u32 dComIfGp_particle_set(u32 param_0, u16 param_1, const cXyz* param_2, + const csXyz* param_3, const cXyz* param_4, u8 param_5, + dPa_levelEcallBack* param_6, s8 param_7, const GXColor* param_8, + const GXColor* param_9, const cXyz* param_10) { return g_dComIfG_gameInfo.play.getParticle()->setNormal( param_0, param_1, param_2, NULL, param_3, param_4, param_5, param_6, param_7, param_8, param_9, param_10, 1.0f); @@ -2454,20 +2458,29 @@ inline u32 dComIfGp_particle_set(u16 param_1, const cXyz* param_2, const dKy_tev param_9, param_10, param_11, 1.0f); } +inline u32 dComIfGp_particle_set(u16 param_1, const cXyz* param_2, const csXyz* param_3, + const cXyz* param_4, u8 param_5, dPa_levelEcallBack* param_6, + s8 param_7, const GXColor* param_8, const GXColor* param_9, + const cXyz* param_10) { + return g_dComIfG_gameInfo.play.getParticle()->setNormal(param_1, param_2, NULL, param_3, + param_4, param_5, param_6, param_7, + param_8, param_9, param_10, 1.0f); +} + inline u32 dComIfGp_particle_set(u16 param_0, const cXyz* param_1, const csXyz* param_2, const cXyz* param_3) { return dComIfGp_particle_set(param_0, param_1, NULL, param_2, param_3, 0xFF, NULL, -1, NULL, NULL, NULL); } -inline u32 dComIfGp_particle_set(u16 param_0, const cXyz* param_1, const dKy_tevstr_c* param_2, const csXyz* param_3, - const cXyz* param_4) { +inline u32 dComIfGp_particle_set(u16 param_0, const cXyz* param_1, const dKy_tevstr_c* param_2, + const csXyz* param_3, const cXyz* param_4) { return dComIfGp_particle_set(param_0, param_1, param_2, param_3, param_4, 0xFF, NULL, -1, NULL, NULL, NULL); } -inline u32 dComIfGp_particle_set(u32 param_0, u16 param_1, const cXyz* param_2, const csXyz* param_3, - const cXyz* param_4) { +inline u32 dComIfGp_particle_set(u32 param_0, u16 param_1, const cXyz* param_2, + const csXyz* param_3, const cXyz* param_4) { return dComIfGp_particle_set(param_0, param_1, param_2, param_3, param_4, 0xFF, NULL, -1, NULL, NULL, NULL); } @@ -2496,7 +2509,6 @@ int dComIfGd_setShadow(u32 param_0, s8 param_1, J3DModel* param_2, cXyz* param_3 f32 param_5, f32 param_6, f32 param_7, cBgS_PolyInfo& param_8, dKy_tevstr_c* param_9, s16 param_10, f32 param_11, _GXTexObj* param_12); - inline int dComIfGd_setRealShadow(u32 param_0, s8 param_1, J3DModel* param_2, cXyz* param_3, f32 param_4, f32 param_5, dKy_tevstr_c* param_6) { return g_dComIfG_gameInfo.drawlist.setRealShadow(param_0, param_1, param_2, param_3, param_4, @@ -2522,6 +2534,10 @@ inline void dComIfGd_set2DOpa(dDlst_base_c* dlst) { g_dComIfG_gameInfo.drawlist.set2DOpa(dlst); } +inline void dComIfGd_set2DXlu(dDlst_base_c* dlst) { + g_dComIfG_gameInfo.drawlist.set2DXlu(dlst); +} + inline void dComIfGd_set2DOpaTop(dDlst_base_c* dlst) { g_dComIfG_gameInfo.drawlist.set2DOpaTop(dlst); } diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h index 4a4abb8f91c..256a1f1b109 100644 --- a/include/d/d_drawlist.h +++ b/include/d/d_drawlist.h @@ -284,6 +284,7 @@ public: void set2DOpa(dDlst_base_c* dlst) { set(mp2DOpaSet[0], mp2DOpaSet[1], dlst); } void set2DOpaTop(dDlst_base_c* dlst) { set(mp2DOpaTopSet[0], mp2DOpaTopSet[1], dlst); } + void set2DXlu(dDlst_base_c* dlst) { set(mp2DXluSet[0], mp2DXluSet[1], dlst); } view_class* getView() { return mView; } void setView(view_class* view) { mView = view; } void setWindow(dDlst_window_c* window) { mWindow = window; } diff --git a/include/d/event/d_event.h b/include/d/event/d_event.h index 04a9a610cb2..8da3453ea69 100644 --- a/include/d/event/d_event.h +++ b/include/d/event/d_event.h @@ -104,6 +104,8 @@ public: void setPtD(void* ptr); void setGtItm(u8 itemNo); void isOrderOK(); + /* 807DFAD8 */ void checkSkipEdge(); + /* 807E2908 */ void startCheckSkipEdge(void*); u16 chkFlag2(u16 flag) { return flag & mFlag2; } bool runCheck() { return mEventStatus != 0; } diff --git a/include/d/particle/d_particle.h b/include/d/particle/d_particle.h index d4a8cc965d4..270c1347d0f 100644 --- a/include/d/particle/d_particle.h +++ b/include/d/particle/d_particle.h @@ -2,9 +2,9 @@ #define D_PARTICLE_D_PARTICLE_H #include "JSystem/JParticle/JPAParticle.h" +#include "d/particle/d_particle_name.h" #include "dolphin/types.h" #include "f_op/f_op_actor.h" -#include "d/particle/d_particle_name.h" class dPa_levelEcallBack : public JPAEmitterCallBack { public: @@ -138,8 +138,8 @@ public: /* 8004AB1C */ void create(u8); /* 8004ABC4 */ void remove(); - /* 8004AC00 */ void setModel(JPABaseEmitter*, J3DModelData*, dKy_tevstr_c const&, u8, void*, u8, - u8); + /* 8004AC00 */ static void setModel(JPABaseEmitter*, J3DModelData*, dKy_tevstr_c const&, u8, + void*, u8, u8); /* 8004AC90 */ void resetModel(JPABaseEmitter*); /* 8004ACC0 */ void setupModel(JPABaseEmitter*); /* 8004ACEC */ void drawModel(JPABaseEmitter*, f32 (*)[4]); @@ -152,7 +152,15 @@ public: /* 80050014 */ virtual void drawAfter(JPABaseEmitter*); /* 8004AAA8 */ virtual void setup(JPABaseEmitter*, cXyz const*, csXyz const*, s8); - static u8 mEcallback[4]; + static void setModel(JPABaseEmitter* param_0, J3DModelData* param_1, + const dKy_tevstr_c& param_2, u8 param_3, J3DAnmTexPattern* param_4, + u8 param_5) { + setModel(param_0, param_1, param_2, param_3, param_4, param_5); + } + + static dPa_modelEcallBack* getEcallback() { return mEcallback; } + + static dPa_modelEcallBack* mEcallback; static u8 mPcallback[4]; static J3DModel* mModel; }; @@ -207,7 +215,6 @@ public: /* 8004FE6C */ virtual ~dPa_fsenthPcallBack(); /* 8004DCA0 */ virtual void execute(JPABaseEmitter*, JPABaseParticle*); /* 8004DD0C */ virtual void draw(JPABaseEmitter*, JPABaseParticle*); - }; class dPa_simpleData_c { @@ -244,7 +251,7 @@ public: void offActive() { mStatus &= ~1; } bool isActive() { return mStatus & 1; } - + private: /* 0x00 */ u32 mId; /* 0x04 */ u16 mNameId; @@ -341,6 +348,10 @@ public: static void offStatus(u8 status) { mStatus &= ~status; } static bool isStatus(u8 status) { return mStatus & status; } + static dPa_selectTexEcallBack* getTsuboSelectTexEcallBack(int idx) { + return ((dPa_selectTexEcallBack*)mTsubo) + idx; + } + static u8 mTsubo[64]; static u8 mLifeBall[24]; static Mtx mWindViewMatrix; diff --git a/include/f_op/f_op_actor.h b/include/f_op/f_op_actor.h index e85f70bf2c6..77f98548aa2 100644 --- a/include/f_op/f_op_actor.h +++ b/include/f_op/f_op_actor.h @@ -134,6 +134,28 @@ public: s8 getRoomNo() const { return current.mRoomNo; } }; // Size: 0x568 +class fopEn_enemy_c : public fopAc_ac_c { +public: + /* 80019404 */ void initBallModel(); + /* 800194FC */ void checkBallModelDraw(); + /* 80019520 */ void setBallModelEffect(dKy_tevstr_c*); + /* 800196A0 */ void drawBallModel(dKy_tevstr_c*); + + /* 0x568 */ cXyz mDownPos; + /* 0x574 */ cXyz mHeadLockPos; + /* 0x580 */ J3DModel* mBallModel; + /* 0x584 */ J3DAnmTextureSRTKey* mBtk; + /* 0x588 */ J3DAnmTevRegKey* mBrk; + /* 0x58C */ u8 field_0x58c; + /* 0x58D */ u8 mThrowMode; + /* 0x58E */ u16 mFlags; + /* 0x590 */ f32 field_0x590; + /* 0x594 */ u32 mEffectID1; + /* 0x598 */ u32 mEffectID2; + /* 0x59C */ u32 mMidnaBindID[3]; + /* 0x5A8 */ u8 field_0x5a8; +}; // Size: 0x5AC + s32 fopAc_IsActor(void* actor); #endif diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h index ab055c090ce..1d932e8347d 100644 --- a/include/m_Do/m_Do_ext.h +++ b/include/m_Do/m_Do_ext.h @@ -46,17 +46,21 @@ private: class mDoExt_btkAnm : public mDoExt_baseAnm { public: mDoExt_btkAnm() { mpAnm = 0; } - /* 8000D63C */ int init(J3DMaterialTable*, J3DAnmTextureSRTKey*, int, int, f32, s16, s16); - /* 8000D6D8 */ void entry(J3DMaterialTable*, f32); + /* 8000D63C */ int init(J3DMaterialTable* i_matTable, J3DAnmTextureSRTKey* i_btk, int i_anmPlay, + int i_attribute, f32 i_rate, s16 i_start, s16 param_6); + /* 8000D6D8 */ void entry(J3DMaterialTable* i_matTable, f32 i_frame); - void entry(J3DModelData* data) { entry(data, getFrame()); } - void entry(J3DModelData* data, f32 frame) { entry(&data->getMaterialTable(), frame); } - int init(J3DModelData* data, J3DAnmTextureSRTKey* key, int param_2, int param_3, f32 param_4, - s16 param_5, s16 param_6) { - return init(&data->getMaterialTable(), key, param_2, param_3, param_4, param_5, param_6); + void entry(J3DModelData* i_modelData) { entry(i_modelData, getFrame()); } + void entry(J3DModelData* i_modelData, f32 i_frame) { + entry(&i_modelData->getMaterialTable(), i_frame); + } + int init(J3DModelData* i_modelData, J3DAnmTextureSRTKey* i_btk, int i_anmPlay, int i_attribute, + f32 i_rate, s16 i_start, s16 param_6) { + return init(&i_modelData->getMaterialTable(), i_btk, i_anmPlay, i_attribute, i_rate, + i_start, param_6); } - int remove(J3DModelData* data) { return data->removeTexMtxAnimator(mpAnm); } + int remove(J3DModelData* i_modelData) { return i_modelData->removeTexMtxAnimator(mpAnm); } private: /* 0x14 */ J3DAnmTextureSRTKey* mpAnm; @@ -67,18 +71,22 @@ STATIC_ASSERT(sizeof(mDoExt_btkAnm) == 0x18); class mDoExt_brkAnm : public mDoExt_baseAnm { public: mDoExt_brkAnm() { mpAnm = 0; } - /* 8000D70C */ int init(J3DMaterialTable*, J3DAnmTevRegKey*, int, int, f32, s16, s16); - /* 8000D7A8 */ void entry(J3DMaterialTable*, f32); + /* 8000D70C */ int init(J3DMaterialTable* i_matTable, J3DAnmTevRegKey* i_brk, int i_anmPlay, + int i_attribute, f32 i_rate, s16 i_start, s16 param_6); + /* 8000D7A8 */ void entry(J3DMaterialTable* i_matTable, f32 i_frame); - void entry(J3DModelData* data) { entry(data, getFrame()); } - void entry(J3DModelData* data, f32 frame) { entry(&data->getMaterialTable(), frame); } - - int init(J3DModelData* data, J3DAnmTevRegKey* anmKey, int param_2, int param_3, f32 param_4, - s16 param_5, s16 param_6) { - return init(&data->getMaterialTable(), anmKey, param_2, param_3, param_4, param_5, param_6); + void entry(J3DModelData* i_modelData) { entry(i_modelData, getFrame()); } + void entry(J3DModelData* i_modelData, f32 i_frame) { + entry(&i_modelData->getMaterialTable(), i_frame); } - int remove(J3DModelData* data) { return data->removeTevRegAnimator(mpAnm); } + int init(J3DModelData* i_modelData, J3DAnmTevRegKey* i_brk, int i_anmPlay, int i_attribute, + f32 i_rate, s16 i_start, s16 param_6) { + return init(&i_modelData->getMaterialTable(), i_brk, i_anmPlay, i_attribute, i_rate, + i_start, param_6); + } + + int remove(J3DModelData* i_modelData) { return i_modelData->removeTevRegAnimator(mpAnm); } private: /* 0x14 */ J3DAnmTevRegKey* mpAnm; @@ -93,16 +101,18 @@ public: int i_attribute, f32 i_rate, s16 i_start, s16 param_6); /* 8000D518 */ void entry(J3DMaterialTable* i_matTable, f32 i_frame); - void entry(J3DModelData* data) { entry(data, getFrame()); } - void entry(J3DModelData* data, f32 frame) { entry(&data->getMaterialTable(), frame); } - - int init(J3DModelData* data, J3DAnmColor* anmColor, int param_2, int param_3, f32 param_4, - s16 param_5, s16 param_6) { - return init(&data->getMaterialTable(), anmColor, param_2, param_3, param_4, param_5, - param_6); + void entry(J3DModelData* i_modelData) { entry(i_modelData, getFrame()); } + void entry(J3DModelData* i_modelData, f32 i_frame) { + entry(&i_modelData->getMaterialTable(), i_frame); } - int remove(J3DModelData* data) { return data->removeMatColorAnimator(mpAnm); } + int init(J3DModelData* i_modelData, J3DAnmColor* i_bpk, int i_anmPlay, int i_attribute, + f32 i_rate, s16 i_start, s16 param_6) { + return init(&i_modelData->getMaterialTable(), i_bpk, i_anmPlay, i_attribute, i_rate, + i_start, param_6); + } + + int remove(J3DModelData* i_modelData) { return i_modelData->removeMatColorAnimator(mpAnm); } private: /* 0x14 */ J3DAnmColor* mpAnm; @@ -115,11 +125,11 @@ public: mDoExt_bckAnm() { mpMtxCalc = NULL; } /* 8000D7DC */ int init(J3DAnmTransform* i_bck, int i_play, int i_attr, f32 i_rate, s16 i_startF, s16 i_endF, bool i_modify); - /* 8000D990 */ void changeBckOnly(J3DAnmTransform*); - /* 8000D9CC */ void entry(J3DModelData*, f32); - /* 8000D9E8 */ void entryJoint(J3DModelData*, u16, f32); + /* 8000D990 */ void changeBckOnly(J3DAnmTransform* i_bck); + /* 8000D9CC */ void entry(J3DModelData* i_modelData, f32 i_frame); + /* 8000D9E8 */ void entryJoint(J3DModelData* i_modelData, u16 i_jntNo, f32 i_frame); - void entry(J3DModelData* data) { entry(data, getFrame()); } + void entry(J3DModelData* i_modelData) { entry(i_modelData, getFrame()); } J3DAnmTransform* getBckAnm() { return mAnm; } private: @@ -136,16 +146,18 @@ public: int i_attribute, f32 i_rate, s16 i_start, s16 param_6); /* 8000D5E8 */ void entry(J3DMaterialTable* i_matTable, s16 i_frame); - void entry(J3DModelData* data) { entry(data, getFrame()); } - void entry(J3DModelData* data, s16 frame) { entry(&data->getMaterialTable(), frame); } - - int init(J3DModelData* data, J3DAnmTexPattern* anmPattern, int param_2, int param_3, - f32 param_4, s16 param_5, s16 param_6) { - return init(&data->getMaterialTable(), anmPattern, param_2, param_3, param_4, param_5, - param_6); + void entry(J3DModelData* i_modelData) { entry(i_modelData, getFrame()); } + void entry(J3DModelData* i_modelData, s16 i_frame) { + entry(&i_modelData->getMaterialTable(), i_frame); } - int remove(J3DModelData* data) { return data->removeTexNoAnimator(mpAnm); } + int init(J3DModelData* i_modelData, J3DAnmTexPattern* i_btk, int i_anmPlay, int i_attribute, + f32 i_rate, s16 i_start, s16 param_6) { + return init(&i_modelData->getMaterialTable(), i_btk, i_anmPlay, i_attribute, i_rate, + i_start, param_6); + } + + int remove(J3DModelData* i_modelData) { return i_modelData->removeTexNoAnimator(mpAnm); } private: /* 0x14 */ J3DAnmTexPattern* mpAnm; @@ -197,7 +209,7 @@ private: class mDoExt_invisibleModel { public: - /* 8000E53C */ int create(J3DModel*, u8); + /* 8000E53C */ int create(J3DModel* i_model, u8 param_1); /* 8000E6C8 */ void entryJoint(cXyz*); /* 8000E7C0 */ void entryDL(cXyz*); @@ -219,7 +231,7 @@ class mDoExt_morf_c { // inheritance causing issues, fix later public: /* 8000F950 */ mDoExt_morf_c(); - /* 8000FB7C */ void setMorf(f32); + /* 8000FB7C */ void setMorf(f32 i_morf); /* 8000FBC0 */ void frameUpdate(); /* 8000FAE8 */ virtual ~mDoExt_morf_c(); diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h index 32b4acb8e8c..d989cefe34e 100644 --- a/include/m_Do/m_Do_graphic.h +++ b/include/m_Do/m_Do_graphic.h @@ -36,6 +36,7 @@ public: /* 80007F90 */ static void beginRender(); /* 800080D0 */ static void fadeOut(f32); /* 80007FD8 */ static void fadeOut(f32, _GXColor&); + /* 807DFAB4 */ static void fadeIn(f32, _GXColor&); /* 80008028 */ static void fadeOut_f(f32, _GXColor&); /* 800080A0 */ static void onBlure(const Mtx); /* 80008078 */ static void onBlure(); diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h index 123a7d17b83..a4a5e1b8c0a 100644 --- a/include/m_Do/m_Do_mtx.h +++ b/include/m_Do/m_Do_mtx.h @@ -54,7 +54,7 @@ public: static void XrotM(s16 x) { mDoMtx_XrotM(now, x); } static void inverse() { PSMTXInverse(now, now); } static void concat(const Mtx m) { PSMTXConcat(now, m, now); } - static void copy(const Mtx m) { PSMTXCopy(m, now); } + static void copy(Mtx m) { PSMTXCopy(now, m); } static Mtx now; static Mtx buffer[16]; diff --git a/include/rel/d/a/d_a_boomerang/d_a_boomerang.h b/include/rel/d/a/d_a_boomerang/d_a_boomerang.h index cd39bb9e4f0..e3f802d51b5 100644 --- a/include/rel/d/a/d_a_boomerang/d_a_boomerang.h +++ b/include/rel/d/a/d_a_boomerang/d_a_boomerang.h @@ -90,6 +90,8 @@ public: void onStateFlg0(daBoomerang_FLG0 flag) { mStateFlg0 |= flag; } void onWindCatch() { onStateFlg0(WIND_CATCH); } + bool checkForceDelete() const { return mForceDelete; } + bool checkCharge() const { return true; } private: /* 0x568 */ daMirror_c* field_0x568; @@ -114,7 +116,7 @@ private: /* 0x953 */ u8 field_0x953; /* 0x954 */ u8 field_0x954; /* 0x955 */ u8 field_0x955; - /* 0x956 */ u8 field_0x956; + /* 0x956 */ bool mForceDelete; /* 0x957 */ u8 field_0x957; /* 0x958 */ s16 field_0x958; /* 0x95A */ s16 field_0x95a; diff --git a/include/rel/d/a/e/d_a_e_wb/d_a_e_wb.h b/include/rel/d/a/e/d_a_e_wb/d_a_e_wb.h index 0f5478c59da..e752b8586af 100644 --- a/include/rel/d/a/e/d_a_e_wb/d_a_e_wb.h +++ b/include/rel/d/a/e/d_a_e_wb/d_a_e_wb.h @@ -4,8 +4,17 @@ #include "Z2AudioLib/Z2Creature.h" #include "dolphin/types.h" #include "rel/d/a/d_a_horse/d_a_horse.h" +#include "SSystem/SComponent/c_phase.h" +#include "d/cc/d_cc_uty.h" -class e_wb_class : public fopAc_ac_c { +enum daE_wb_ACT { + /* 0x00 */ ACT_WAIT, + /* 0x15 */ ACT_S_DAMAGE = 0x15, + /* 0x65 */ ACT_PL_RIDE = 0x65, + /* 0x67 */ ACT_PL_RIDE_NOW = 0x67, +}; + +class e_wb_class : public fopEn_enemy_c { public: BOOL checkWait(); void setPlayerRideNow(); @@ -16,38 +25,133 @@ public: void setRunRideMode(); private: - /* 0x0568 */ u8 field_0x568[0x4C]; + /* 0x05AC */ request_of_phase_process_class mPhase; /* 0x05B4 */ s16 field_0x5b4; - /* 0x05B6 */ u8 unk1462[9]; + /* 0x05B8 */ char* mResName; + /* 0x05BC */ u8 field_0x5bc; + /* 0x05BD */ u8 field_0x5bd; + /* 0x05BE */ u8 field_0x5be; /* 0x05BF */ bool field_0x5bf; - /* 0x05C0 */ u8 field_0x5c0[0x20]; - /* 0x05E0 */ void* field_0x5e0; - /* 0x05E4 */ u8 field_0x5e4[8]; + /* 0x05C0 */ u8 field_0x5c0; + /* 0x05C4 */ cXyz field_0x5c4; + /* 0x05D0 */ cXyz field_0x5d0; + /* 0x05DC */ s16 field_0x5dc; + /* 0x05DE */ s16 field_0x5de; + /* 0x05E0 */ mDoExt_McaMorfSO* field_0x5e0; + /* 0x05E4 */ f32 field_0x5e4; + /* 0x05E8 */ int mAnmID; /* 0x05EC */ Z2CreatureRide mZ2Ride; - /* 0x0688 */ u8 unk1673[6]; + /* 0x0688 */ u8 field_0x688[4]; + /* 0x068C */ s8 field_0x68c; /* 0x068E */ s16 field_0x68e; - /* 0x0690 */ s16 field_0x690; + /* 0x0690 */ s16 mActionID; /* 0x0692 */ u16 field_0x692; - /* 0x0694 */ u8 unk1684[0xc]; + /* 0x0694 */ u32 field_0x694; + /* 0x0698 */ s16 field_0x698[4]; /* 0x06A0 */ s16 field_0x6a0; - /* 0x06A2 */ u8 field_0x6a2[0xc]; + /* 0x06A2 */ u8 field_0x6a2[0x6ae - 0x6a2]; /* 0x06AE */ s16 field_0x6ae; /* 0x06B0 */ s16 field_0x6b0; - /* 0x06B2 */ u8 field_0x6b2[0xc]; + /* 0x06B2 */ s16 field_0x6b2; + /* 0x06B4 */ u8 field_0x6b4[0x6b6 - 0x6b4]; + /* 0x06B6 */ s16 field_0x6b6; + /* 0x06B8 */ u8 field_0x6b8[0x6ba - 0x6b8]; + /* 0x06BA */ s16 field_0x6ba; + /* 0x06BC */ u8 field_0x6bc; + /* 0x06BD */ u8 field_0x6bd; /* 0x06BE */ u16 field_0x6be; - /* 0x06C0 */ u8 field_0x6c0[0xdd]; - /* 0x079D */ u8 field_0x79d; - /* 0x079E */ u8 field_0x79e[0x4e]; + /* 0x06C0 */ s8 field_0x6c0; + /* 0x06C4 */ cXyz field_0x6c4; + /* 0x06D0 */ s16 field_0x6d0; + /* 0x06D2 */ s16 field_0x6d2; + /* 0x06D4 */ s16 field_0x6d4; + /* 0x06D6 */ s16 field_0x6d6; + /* 0x06D8 */ u8 field_0x6d8[0x6da - 0x6d8]; + /* 0x06DA */ s16 field_0x6da; + /* 0x06DC */ s16 field_0x6dc; + /* 0x06DE */ u8 field_0x6de[0x6e4 - 0x6de]; + /* 0x06E4 */ u8 field_0x6e4; + /* 0x06E5 */ u8 field_0x6e5[0x79a - 0x6e5]; + /* 0x079A */ s16 field_0x79a; + /* 0x079C */ u8 field_0x79c; + /* 0x079D */ s8 field_0x79d; + /* 0x079E */ s8 field_0x79e; + /* 0x079F */ s8 field_0x79f; + /* 0x07A0 */ s16 field_0x7a0; + /* 0x07A2 */ s8 field_0x7a2; + /* 0x07A4 */ s16 field_0x7a4; + /* 0x07A6 */ s8 field_0x7a6; + /* 0x07A7 */ s8 field_0x7a7; + /* 0x07A8 */ f32 field_0x7a8; + /* 0x07AC */ dBgS_AcchCir field_0x7ac; /* 0x07EC */ dBgS_Acch field_0x7ec; - /* 0x09C4 */ cXyz field_0x9c4; - /* 0x09D0 */ u8 field_0x9d0[0xa5f]; - /* 0x142F */ u8 field_0x142f; - /* 0x1430 */ u8 field_0x1430; + /* 0x09C4 */ dCcD_Stts field_0x9c4; + /* 0x0A00 */ dCcD_Sph field_0xa00[7]; + /* 0x1288 */ dCcD_Sph field_0x1288; + /* 0x13C0 */ dCcU_AtInfo field_0x13c0; + /* 0x13E4 */ u8 field_0x13e4; + /* 0x13E8 */ u32 field_0x13e8; + /* 0x13EC */ u32 field_0x13ec; + /* 0x13F0 */ u32 field_0x13f0; + /* 0x13F4 */ u32 field_0x13f4; + /* 0x13F8 */ u32 field_0x13f8; + /* 0x13FC */ u32 field_0x13fc; + /* 0x1400 */ u32 field_0x1400; + /* 0x1404 */ u32 field_0x1404; + /* 0x1408 */ u32 field_0x1408; + /* 0x140C */ u32 field_0x140c; + /* 0x1410 */ u32 field_0x1410; + /* 0x1414 */ u32 field_0x1414; + /* 0x1418 */ u32 field_0x1418; + /* 0x141C */ u32 field_0x141c; + /* 0x1420 */ u32 field_0x1420[3]; + /* 0x142C */ u8 field_0x142c; + /* 0x142D */ u8 field_0x142d; + /* 0x142E */ u8 field_0x142e; + /* 0x142F */ s8 field_0x142f; + /* 0x1430 */ s8 field_0x1430; /* 0x1432 */ s16 field_0x1432; - /* 0x1434 */ u8 field_0x1434[0x250]; + /* 0x1434 */ u32 field_0x1434; // Some actor ID + /* 0x1438 */ cXyz field_0x1438; + /* 0x1444 */ cXyz field_0x1444; + /* 0x1450 */ u8 field_0x1450[0x15d0 - 0x1450]; + /* 0x15D0 */ mDoExt_3DlineMat1_c field_0x15d0; + /* 0x160C */ mDoExt_3DlineMat1_c field_0x160c; + /* 0x1648 */ mDoExt_3DlineMat1_c field_0x1648; /* 0x1684 */ f32 field_0x1684; - /* 0x1688 */ u8 field_0x1688[0x16]; + /* 0x1688 */ u8 field_0x1688; + /* 0x168A */ u16 field_0x168a; + /* 0x168C */ f32 field_0x168c; + /* 0x1690 */ f32 field_0x1690; + /* 0x1694 */ u8 field_0x1694[0x169e - 0x1694]; /* 0x169E */ s16 field_0x169e; + /* 0x16A0 */ s16 field_0x16a0; + /* 0x16A4 */ cXyz field_0x16a4; + /* 0x16B0 */ cXyz field_0x16b0; + /* 0x16BC */ cXyz field_0x16bc; + /* 0x16C8 */ cXyz field_0x16c8; + /* 0x16D4 */ cXyz field_0x16d4; + /* 0x16E0 */ cXyz field_0x16e0; + /* 0x16EC */ cXyz field_0x16ec; + /* 0x16F8 */ cXyz field_0x16f8; + /* 0x1704 */ s16 field_0x1704; + /* 0x1708 */ f32 field_0x1708; + /* 0x170C */ f32 field_0x170c; + /* 0x1710 */ f32 field_0x1710; + /* 0x1714 */ f32 field_0x1714; + /* 0x1718 */ f32 field_0x1718; + /* 0x171C */ u8 field_0x171c[0x1720 - 0x171c]; + /* 0x1720 */ s8 field_0x1720; + /* 0x1721 */ s8 field_0x1721; + /* 0x1722 */ s8 field_0x1722; + /* 0x1723 */ u8 field_0x1723[0x17c4 - 0x1723]; + /* 0x17C4 */ u32 field_0x17c4; + /* 0x17D0 */ u32 field_0x17d0[4]; + /* 0x17E0 */ u8 field_0x17e0; + /* 0x17E1 */ u8 field_0x17e1; + /* 0x17E2 */ s16 mWaitRollAngle; + /* 0x17E4 */ u8 field_0x17e4[0x17e8 - 0x17e4]; + /* 0x17E8 */ f32 mSpeedRate; }; #endif /* D_A_E_WB_H */ diff --git a/libs/JSystem/J3DGraphBase/J3DDrawBuffer.cpp b/libs/JSystem/J3DGraphBase/J3DDrawBuffer.cpp index 35f960d8888..cd24d86819d 100644 --- a/libs/JSystem/J3DGraphBase/J3DDrawBuffer.cpp +++ b/libs/JSystem/J3DGraphBase/J3DDrawBuffer.cpp @@ -58,21 +58,15 @@ extern "C" void _restgpr_28(); /* 80456400-80456404 004A00 0004+00 2/2 0/0 0/0 .sdata2 @781 */ SECTION_SDATA2 static f32 lit_781 = 1.0f; -/* 80456404-80456408 004A04 0004+00 1/1 0/0 0/0 .sdata2 @782 */ -SECTION_SDATA2 static f32 lit_782 = 10000.0f; - -/* 80456408-80456410 004A08 0008+00 2/2 0/0 0/0 .sdata2 @784 */ -SECTION_SDATA2 static f64 lit_784 = 4503599627370496.0 /* cast u32 to float */; - void J3DDrawBuffer::calcZRatio() { mZRatio = (mZFar - mZNear) / (f32)mBufSize; } void J3DDrawBuffer::initialize() { - mDrawType = 0; - mSortType = 0; + mDrawType = DRAW_HEAD; + mSortType = SORT_MAT; mZNear = lit_781; - mZFar = lit_782; + mZFar = 10000.0f; mpZMtx = NULL; mpCallBackPacket = NULL; mBufSize = 0x20; @@ -123,7 +117,7 @@ asm void J3DDrawBuffer::frameInit() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J3DDrawBuffer::entryMatSort(J3DMatPacket* param_0) { +asm int J3DDrawBuffer::entryMatSort(J3DMatPacket* param_0) { nofralloc #include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/entryMatSort__13J3DDrawBufferFP12J3DMatPacket.s" } @@ -134,152 +128,130 @@ asm void J3DDrawBuffer::entryMatSort(J3DMatPacket* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J3DDrawBuffer::entryMatAnmSort(J3DMatPacket* param_0) { +asm int J3DDrawBuffer::entryMatAnmSort(J3DMatPacket* param_0) { nofralloc #include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/entryMatAnmSort__13J3DDrawBufferFP12J3DMatPacket.s" } #pragma pop +inline f32 J3DCalcZValue(register MtxP m, register Vec v) { + register f32 out; + + // clang-format off + asm { + lfs f1, lit_781(r2) + psq_l f0, 8(v), 0, 0 /* qr0 */ + lfs f2, 0x10(v) + psq_l f4, 32(m), 0, 0 /* qr0 */ + psq_l out, 40(m), 0, 0 /* qr0 */ + ps_merge00 f2, f2, f1 + ps_mul f4, f0, f4 + ps_madd out, f2, out, f4 + ps_sum0 out, out, out, out + } + // clang-format on + + return out; +} + /* 8032529C-803253B4 31FBDC 0118+00 1/0 0/0 0/0 .text entryZSort__13J3DDrawBufferFP12J3DMatPacket */ +// J3DCalcZValue needs work with the asm registers +#ifdef NONMATCHING +int J3DDrawBuffer::entryZSort(J3DMatPacket* i_packet) { + i_packet->drawClear(); + i_packet->getShapePacket()->drawClear(); + + Vec tmp; + tmp.x = mpZMtx[0][3]; + tmp.y = mpZMtx[1][3]; + tmp.z = mpZMtx[2][3]; + + f32 value = -J3DCalcZValue(j3dSys.getViewMtx(), tmp); + + u32 uvar4; + if (mZNear + mZRatio < value) { + if (mZFar - mZRatio > value) { + uvar4 = value / mZRatio; + } else { + uvar4 = mBufSize - 1; + } + } else { + uvar4 = 0; + } + + u32 idx = (mBufSize - 1) - uvar4; + i_packet->setNextPacket(mpBuf[idx]); + mpBuf[idx] = i_packet; + + return 1; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J3DDrawBuffer::entryZSort(J3DMatPacket* param_0) { +asm int J3DDrawBuffer::entryZSort(J3DMatPacket* param_0) { nofralloc #include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/entryZSort__13J3DDrawBufferFP12J3DMatPacket.s" } #pragma pop +#endif /* 803253B4-80325404 31FCF4 0050+00 1/0 0/0 0/0 .text * entryModelSort__13J3DDrawBufferFP12J3DMatPacket */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DDrawBuffer::entryModelSort(J3DMatPacket* param_0) { - nofralloc -#include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/entryModelSort__13J3DDrawBufferFP12J3DMatPacket.s" +int J3DDrawBuffer::entryModelSort(J3DMatPacket* i_packet) { + i_packet->drawClear(); + i_packet->getShapePacket()->drawClear(); + + if (mpCallBackPacket != NULL) { + mpCallBackPacket->addChildPacket(i_packet); + return 1; + } + + return 0; } -#pragma pop /* 80325404-80325458 31FD44 0054+00 1/0 0/0 0/0 .text * entryInvalidSort__13J3DDrawBufferFP12J3DMatPacket */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DDrawBuffer::entryInvalidSort(J3DMatPacket* param_0) { - nofralloc -#include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/entryInvalidSort__13J3DDrawBufferFP12J3DMatPacket.s" -} -#pragma pop +int J3DDrawBuffer::entryInvalidSort(J3DMatPacket* i_packet) { + i_packet->drawClear(); + i_packet->getShapePacket()->drawClear(); -bool J3DDrawBuffer::entryNonSort(J3DMatPacket* pMat) { - pMat->clear(); - pMat->mpShapePacket->clear(); + if (mpCallBackPacket != NULL) { + mpCallBackPacket->addChildPacket(i_packet->getShapePacket()); + return 1; + } - // inlined copy of entryImm, add to start of buf - pMat->mpNextSibling = mpBuf[0]; - mpBuf[0] = pMat; - return true; + return 0; } -bool J3DDrawBuffer::entryImm(J3DPacket* pPacket, u16 index) { - pPacket->mpNextSibling = mpBuf[index]; - mpBuf[index] = pPacket; - return true; +int J3DDrawBuffer::entryNonSort(J3DMatPacket* i_packet) { + i_packet->drawClear(); + i_packet->mpShapePacket->drawClear(); + + i_packet->setNextPacket(mpBuf[0]); + mpBuf[0] = i_packet; + + return 1; } -/* ############################################################################################## */ -/* 803CEBE8-803CEBF4 -00001 000C+00 1/1 0/0 0/0 .data @992 */ -SECTION_DATA static void* lit_992[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)entryMatSort__13J3DDrawBufferFP12J3DMatPacket, -}; +int J3DDrawBuffer::entryImm(J3DPacket* i_packet, u16 index) { + i_packet->setNextPacket(mpBuf[index]); + mpBuf[index] = i_packet; -/* 803CEBF4-803CEC00 -00001 000C+00 0/1 0/0 0/0 .data @993 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_993[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)entryMatAnmSort__13J3DDrawBufferFP12J3DMatPacket, -}; -#pragma pop - -/* 803CEC00-803CEC0C -00001 000C+00 0/1 0/0 0/0 .data @994 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_994[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)entryZSort__13J3DDrawBufferFP12J3DMatPacket, -}; -#pragma pop - -/* 803CEC0C-803CEC18 -00001 000C+00 0/1 0/0 0/0 .data @995 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_995[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)entryModelSort__13J3DDrawBufferFP12J3DMatPacket, -}; -#pragma pop - -/* 803CEC18-803CEC24 -00001 000C+00 0/1 0/0 0/0 .data @996 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_996[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)entryInvalidSort__13J3DDrawBufferFP12J3DMatPacket, -}; -#pragma pop - -/* 803CEC24-803CEC30 -00001 000C+00 0/1 0/0 0/0 .data @997 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_997[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)entryNonSort__13J3DDrawBufferFP12J3DMatPacket, -}; -#pragma pop + return 1; +} /* 803CEC30-803CEC78 02BD50 0048+00 0/1 1/1 0/0 .data sortFuncTable__13J3DDrawBuffer */ -SECTION_DATA u8 J3DDrawBuffer::sortFuncTable[72] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +SECTION_DATA sortFunc J3DDrawBuffer::sortFuncTable[6] = { + &J3DDrawBuffer::entryMatSort, &J3DDrawBuffer::entryMatAnmSort, &J3DDrawBuffer::entryZSort, + &J3DDrawBuffer::entryModelSort, &J3DDrawBuffer::entryInvalidSort, &J3DDrawBuffer::entryNonSort, }; -/* 803CEC78-803CEC84 -00001 000C+00 0/1 0/0 0/0 .data @998 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_998[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)drawHead__13J3DDrawBufferCFv, -}; -#pragma pop - -/* 803CEC84-803CEC90 -00001 000C+00 0/1 0/0 0/0 .data @999 */ -#pragma push -#pragma force_active on -SECTION_DATA static void* lit_999[3] = { - (void*)NULL, - (void*)0xFFFFFFFF, - (void*)drawTail__13J3DDrawBufferCFv, -}; -#pragma pop - /* 803CEC90-803CECA8 02BDB0 0018+00 1/2 0/0 0/0 .data drawFuncTable__13J3DDrawBuffer */ -SECTION_DATA u8 J3DDrawBuffer::drawFuncTable[24] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, +SECTION_DATA drawFunc J3DDrawBuffer::drawFuncTable[2] = { + &J3DDrawBuffer::drawHead, + &J3DDrawBuffer::drawTail, }; /* 803254AC-80325500 31FDEC 0054+00 0/0 2/2 0/0 .text draw__13J3DDrawBufferCFv */ @@ -293,16 +265,31 @@ asm void J3DDrawBuffer::draw() const { #pragma pop /* 80325500-80325578 31FE40 0078+00 1/0 0/0 0/0 .text drawHead__13J3DDrawBufferCFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DDrawBuffer::drawHead() const { - nofralloc -#include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/drawHead__13J3DDrawBufferCFv.s" +void J3DDrawBuffer::drawHead() const { + u32 size = mBufSize; + J3DPacket** buf = mpBuf; + + for (u32 i = 0; i < size; i++) { + for (J3DPacket* packet = buf[i]; packet != NULL; packet = packet->getNextPacket()) { + packet->draw(); + } + } } -#pragma pop /* 80325578-803255F0 31FEB8 0078+00 1/0 0/0 0/0 .text drawTail__13J3DDrawBufferCFv */ +// flipped regs +#ifdef NONMATCHING +void J3DDrawBuffer::drawTail() const { + int i = mBufSize - 1; + J3DPacket** buf = mpBuf; + + for (; i >= 0; i--) { + for (J3DPacket* packet = buf[i]; packet != NULL; packet = packet->getNextPacket()) { + packet->draw(); + } + } +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -311,22 +298,8 @@ asm void J3DDrawBuffer::drawTail() const { #include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/drawTail__13J3DDrawBufferCFv.s" } #pragma pop - -/* 803255F0-803256C4 31FF30 00D4+00 0/0 1/0 0/0 .text __sinit_J3DDrawBuffer_cpp */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void __sinit_J3DDrawBuffer_cpp() { - nofralloc -#include "asm/JSystem/J3DGraphBase/J3DDrawBuffer/__sinit_J3DDrawBuffer_cpp.s" -} -#pragma pop - -#pragma push -#pragma force_active on -REGISTER_CTORS(0x803255F0, __sinit_J3DDrawBuffer_cpp); -#pragma pop +#endif /* ############################################################################################## */ /* 804515E0-804515E8 000AE0 0004+04 0/0 1/1 0/0 .sbss entryNum__13J3DDrawBuffer */ -u8 J3DDrawBuffer::entryNum[4 + 4 /* padding */]; +int J3DDrawBuffer::entryNum; diff --git a/libs/JSystem/J3DGraphBase/J3DShapeMtx.cpp b/libs/JSystem/J3DGraphBase/J3DShapeMtx.cpp index 839a9492538..86d52ff500b 100644 --- a/libs/JSystem/J3DGraphBase/J3DShapeMtx.cpp +++ b/libs/JSystem/J3DGraphBase/J3DShapeMtx.cpp @@ -719,7 +719,7 @@ u32 J3DShapeMtxMultiConcatView::getUseMtxNum() const { /* 8031469C-803146AC 30EFDC 0010+00 1/0 0/0 0/0 .text * getUseMtxIndex__26J3DShapeMtxMultiConcatViewCFUs */ u32 J3DShapeMtxMultiConcatView::getUseMtxIndex(u16 no) const { - return mUseMtxIndex[no]; + return mUseMtxIndexTable[no]; } /* 803146AC-803146B0 30EFEC 0004+00 1/0 0/0 0/0 .text @@ -752,7 +752,7 @@ u32 J3DShapeMtxMulti::getUseMtxNum() const { /* 80314720-80314730 30F060 0010+00 1/0 0/0 0/0 .text getUseMtxIndex__16J3DShapeMtxMultiCFUs */ u32 J3DShapeMtxMulti::getUseMtxIndex(u16 no) const { - return mUseMtxIndex[no]; + return mUseMtxIndexTable[no]; } /* 80314730-8031478C 30F070 005C+00 1/0 0/0 0/0 .text __dt__21J3DShapeMtxConcatViewFv */ diff --git a/libs/JSystem/J3DGraphLoader/J3DShapeFactory.cpp b/libs/JSystem/J3DGraphLoader/J3DShapeFactory.cpp index 1f872b32289..6a21b67580f 100644 --- a/libs/JSystem/J3DGraphLoader/J3DShapeFactory.cpp +++ b/libs/JSystem/J3DGraphLoader/J3DShapeFactory.cpp @@ -4,36 +4,13 @@ // #include "JSystem/J3DGraphLoader/J3DShapeFactory.h" +#include "JSystem/J3DGraphBase/J3DShape.h" +#include "JSystem/JKernel/JKRHeap.h" +#include "JSystem/JSupport/JSupport.h" #include "dol2asm.h" +#include "dolphin/os/OS.h" #include "dolphin/types.h" -// -// Types: -// - -struct _GXVtxDescList {}; - -struct J3DShapeBlock {}; - -struct J3DShapeFactory { - /* 80337350 */ J3DShapeFactory(J3DShapeBlock const&); - /* 80337400 */ void create(int, u32, _GXVtxDescList*); - /* 803375BC */ void newShapeMtx(u32, int, int) const; - /* 8033784C */ void newShapeDraw(int, int) const; - /* 803378D8 */ void allocVcdVatCmdBuffer(u32); - /* 80337944 */ void calcSize(int, u32); - /* 803379D8 */ void calcSizeVcdVatCmdBuffer(u32); - /* 803379E8 */ void calcSizeShapeMtx(u32, int, int) const; -}; - -struct J3DShapeDraw { - /* 80314ABC */ J3DShapeDraw(u8 const*, u32); -}; - -struct J3DShape { - /* 80314B48 */ void initialize(); -}; - // // Forward References: // @@ -56,14 +33,15 @@ extern "C" extern char const* const J3DShapeFactory__stringBase0; // External References: // -extern "C" void OSReport(); +extern "C" J3DShapeInitData* func_80336764(const void*, + const void*); // JSUConvertOffsetToPtr +extern "C" u16* func_8033677C(const void*, const void*); // JSUConvertOffsetToPtr + extern "C" void* __nw__FUl(); extern "C" void* __nwa__FUl(); extern "C" void* __nwa__FUli(); extern "C" void __ct__12J3DShapeDrawFPCUcUl(); extern "C" void initialize__8J3DShapeFv(); -extern "C" void func_80336764(void* _this, void const*, u32); -extern "C" void func_8033677C(void* _this, void const*, u32); extern "C" void _savegpr_26(); extern "C" void _savegpr_29(); extern "C" void _restgpr_26(); @@ -81,141 +59,203 @@ extern "C" extern void* __vt__8J3DShape[6]; // /* 80337350-80337400 331C90 00B0+00 0/0 2/2 0/0 .text __ct__15J3DShapeFactoryFRC13J3DShapeBlock */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm J3DShapeFactory::J3DShapeFactory(J3DShapeBlock const& param_0) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/__ct__15J3DShapeFactoryFRC13J3DShapeBlock.s" +J3DShapeFactory::J3DShapeFactory(J3DShapeBlock const& block) { + // mShapeInitData = JSUConvertOffsetToPtr(&block, block.mShapeInitData); + mShapeInitData = func_80336764(&block, block.mShapeInitData); + // mIndexTable = JSUConvertOffsetToPtr(&block, block.mIndexTable); + mIndexTable = func_8033677C(&block, block.mIndexTable); + mVtxDescList = JSUConvertOffsetToPtr(&block, block.mVtxDescList); + // mMtxTable = JSUConvertOffsetToPtr(&block, block.mMtxTable); + mMtxTable = func_8033677C(&block, block.mMtxTable); + mDisplayListData = JSUConvertOffsetToPtr(&block, block.mDisplayListData); + mMtxInitData = JSUConvertOffsetToPtr(&block, block.mMtxInitData); + mDrawInitData = JSUConvertOffsetToPtr(&block, block.mDrawInitData); + mVcdVatCmdBuffer = NULL; } -#pragma pop /* 80337400-803375BC 331D40 01BC+00 0/0 1/1 0/0 .text * create__15J3DShapeFactoryFiUlP14_GXVtxDescList */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DShapeFactory::create(int param_0, u32 param_1, _GXVtxDescList* param_2) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/create__15J3DShapeFactoryFiUlP14_GXVtxDescList.s" -} -#pragma pop +J3DShape* J3DShapeFactory::create(int no, u32 flag, GXVtxDescList* vtxDesc) { + J3DShape* shape = new J3DShape; + shape->mMtxGroupNum = getMtxGroupNum(no); + shape->mRadius = getRadius(no); + shape->mVtxDesc = getVtxDescList(no); + shape->mShapeMtx = new J3DShapeMtx*[shape->mMtxGroupNum]; + shape->mShapeDraw = new J3DShapeDraw*[shape->mMtxGroupNum]; + shape->mMin = getMin(no); + shape->mMax = getMax(no); + shape->mVcdVatCmd = mVcdVatCmdBuffer + no * J3DShape::kVcdVatDLSize; -/* ############################################################################################## */ -/* 803A2100-803A2100 02E760 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ -#pragma push -#pragma force_active on -SECTION_DEAD static char const* const stringBase_803A2100 = - "WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n"; -/* @stringBase0 padding */ -SECTION_DEAD static char const* const pad_803A212C = "\0\0\0"; -#pragma pop + for (s32 i = 0; i < shape->mMtxGroupNum; i++) { + shape->mShapeMtx[i] = newShapeMtx(flag, no, i); + shape->mShapeDraw[i] = newShapeDraw(no, i); + } + + shape->mIndex = no; + return shape; +} + +static inline u32 getMdlDataFlag_MtxLoadType(u32 flag) { + return flag & 0x10; +} + +enum { + J3DMdlDataFlag_ConcatView = 0x10, +}; + +enum { + J3DShapeMtxType_Mtx = 0x00, + J3DShapeMtxType_BBoard = 0x01, + J3DShapeMtxType_YBBoard = 0x02, + J3DShapeMtxType_Multi = 0x03, +}; /* 803375BC-8033784C 331EFC 0290+00 1/1 0/0 0/0 .text newShapeMtx__15J3DShapeFactoryCFUlii */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DShapeFactory::newShapeMtx(u32 param_0, int param_1, int param_2) const { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/newShapeMtx__15J3DShapeFactoryCFUlii.s" +J3DShapeMtx* J3DShapeFactory::newShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) const { + J3DShapeMtx* ret = NULL; + const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]]; + const J3DShapeMtxInitData& mtxInitData = + (&mMtxInitData[shapeInitData.mMtxInitDataIndex])[mtxGroupNo]; + + switch (getMdlDataFlag_MtxLoadType(flag)) { + case J3DMdlDataFlag_ConcatView: + switch (shapeInitData.mShapeMtxType) { + case J3DShapeMtxType_Mtx: + ret = new J3DShapeMtxConcatView(mtxInitData.mUseMtxIndex); + break; + case J3DShapeMtxType_BBoard: + ret = new J3DShapeMtxBBoardConcatView(mtxInitData.mUseMtxIndex); + break; + case J3DShapeMtxType_YBBoard: + ret = new J3DShapeMtxYBBoardConcatView(mtxInitData.mUseMtxIndex); + break; + case J3DShapeMtxType_Multi: + ret = new J3DShapeMtxMultiConcatView(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, + &mMtxTable[mtxInitData.mFirstUseMtxIndex]); + break; + default: + OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n"); + break; + } + break; + + case 0: + default: + switch (shapeInitData.mShapeMtxType) { + case J3DShapeMtxType_Mtx: + case J3DShapeMtxType_BBoard: + case J3DShapeMtxType_YBBoard: + ret = new J3DShapeMtx(mtxInitData.mUseMtxIndex); + break; + case J3DShapeMtxType_Multi: + ret = new J3DShapeMtxMulti(mtxInitData.mUseMtxIndex, mtxInitData.mUseMtxCount, + &mMtxTable[mtxInitData.mFirstUseMtxIndex]); + break; + default: + OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n"); + break; + } + break; + } + + return ret; } -#pragma pop /* 8033784C-803378D8 33218C 008C+00 1/1 0/0 0/0 .text newShapeDraw__15J3DShapeFactoryCFii */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DShapeFactory::newShapeDraw(int param_0, int param_1) const { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/newShapeDraw__15J3DShapeFactoryCFii.s" +J3DShapeDraw* J3DShapeFactory::newShapeDraw(int shapeNo, int mtxGroupNo) const { + const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]]; + const J3DShapeDrawInitData& drawInitData = + (&mDrawInitData[shapeInitData.mDrawInitDataIndex])[mtxGroupNo]; + return new J3DShapeDraw(&mDisplayListData[drawInitData.mDisplayListIndex], + drawInitData.mDisplayListSize); } -#pragma pop /* 803378D8-80337944 332218 006C+00 0/0 1/1 0/0 .text allocVcdVatCmdBuffer__15J3DShapeFactoryFUl */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DShapeFactory::allocVcdVatCmdBuffer(u32 param_0) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/allocVcdVatCmdBuffer__15J3DShapeFactoryFUl.s" +void J3DShapeFactory::allocVcdVatCmdBuffer(u32 count) { + mVcdVatCmdBuffer = new (0x20) u8[J3DShape::kVcdVatDLSize * count]; + for (u32 i = 0; i < (J3DShape::kVcdVatDLSize * count) / 4; i++) + ((u32*)mVcdVatCmdBuffer)[i] = 0; } -#pragma pop /* 80337944-803379D8 332284 0094+00 0/0 1/1 0/0 .text calcSize__15J3DShapeFactoryFiUl */ +#ifdef NONMATCHING +s32 J3DShapeFactory::calcSize(int shapeNo, u32 flag) { + s32 size = 0x68; + + // regalloc + u32 mtxGroupNo = getMtxGroupNum(shapeNo); + size += mtxGroupNo * 4; + size += mtxGroupNo * 4; + + for (u32 i = 0; i < mtxGroupNo; i++) { + s32 shapeMtxSize = calcSizeShapeMtx(flag, shapeNo, i); + size += shapeMtxSize; + size += 0x0C; + } + + return size; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void J3DShapeFactory::calcSize(int param_0, u32 param_1) { +asm s32 J3DShapeFactory::calcSize(int param_0, u32 param_1) { nofralloc #include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/calcSize__15J3DShapeFactoryFiUl.s" } #pragma pop +#endif /* 803379D8-803379E8 332318 0010+00 0/0 1/1 0/0 .text * calcSizeVcdVatCmdBuffer__15J3DShapeFactoryFUl */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DShapeFactory::calcSizeVcdVatCmdBuffer(u32 param_0) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/calcSizeVcdVatCmdBuffer__15J3DShapeFactoryFUl.s" +s32 J3DShapeFactory::calcSizeVcdVatCmdBuffer(u32 count) { + return ALIGN_NEXT(count * J3DShape::kVcdVatDLSize, 0x20); } -#pragma pop /* 803379E8-80337AE0 332328 00F8+00 1/1 0/0 0/0 .text calcSizeShapeMtx__15J3DShapeFactoryCFUlii */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void J3DShapeFactory::calcSizeShapeMtx(u32 param_0, int param_1, int param_2) const { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/calcSizeShapeMtx__15J3DShapeFactoryCFUlii.s" -} -#pragma pop +s32 J3DShapeFactory::calcSizeShapeMtx(u32 flag, int shapeNo, int mtxGroupNo) const { + const J3DShapeInitData& shapeInitData = mShapeInitData[mIndexTable[shapeNo]]; + u32 ret = 0; -/* 80337AE0-80337AF8 332420 0018+00 1/1 0/0 0/0 .text - * JSUConvertOffsetToPtr<20J3DShapeDrawInitData>__FPCvUl */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -extern "C" asm void func_80337AE0(void* _this, void const* param_0, u32 param_1) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/func_80337AE0.s" -} -#pragma pop + u32 mtxLoadType = getMdlDataFlag_MtxLoadType(flag); + switch (mtxLoadType) { + case J3DMdlDataFlag_ConcatView: + switch (shapeInitData.mShapeMtxType) { + case J3DShapeMtxType_Mtx: + ret = 0x08; + break; + case J3DShapeMtxType_BBoard: + ret = 0x08; + break; + case J3DShapeMtxType_YBBoard: + ret = 0x08; + break; + case J3DShapeMtxType_Multi: + ret = 0x10; + break; + default: + OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n"); + } + break; -/* 80337AF8-80337B10 332438 0018+00 1/1 0/0 0/0 .text - * JSUConvertOffsetToPtr<19J3DShapeMtxInitData>__FPCvUl */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -extern "C" asm void func_80337AF8(void* _this, void const* param_0, u32 param_1) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/func_80337AF8.s" -} -#pragma pop + case 0: + default: + switch (shapeInitData.mShapeMtxType) { + case J3DShapeMtxType_Mtx: + case J3DShapeMtxType_BBoard: + case J3DShapeMtxType_YBBoard: + ret = 0x08; + break; + case J3DShapeMtxType_Multi: + ret = 0x10; + break; + default: + OSReport("WRONG SHAPE MATRIX TYPE (J3DModelInit.cpp)\n"); + } + break; + } -/* 80337B10-80337B28 332450 0018+00 1/1 0/0 0/0 .text JSUConvertOffsetToPtr__FPCvUl - */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -extern "C" asm void func_80337B10(void* _this, void const* param_0, u32 param_1) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/func_80337B10.s" -} -#pragma pop - -/* 80337B28-80337B40 332468 0018+00 1/1 0/0 0/0 .text - * JSUConvertOffsetToPtr<14_GXVtxDescList>__FPCvUl */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -extern "C" asm void func_80337B28(void* _this, void const* param_0, u32 param_1) { - nofralloc -#include "asm/JSystem/J3DGraphLoader/J3DShapeFactory/func_80337B28.s" -} -#pragma pop - -/* 803A2100-803A2100 02E760 0000+00 0/0 0/0 0/0 .rodata @stringBase0 */ + return ret; +} \ No newline at end of file diff --git a/rel/d/a/d_a_boomerang/d_a_boomerang.cpp b/rel/d/a/d_a_boomerang/d_a_boomerang.cpp index af0f885222c..5bd6f439f4c 100644 --- a/rel/d/a/d_a_boomerang/d_a_boomerang.cpp +++ b/rel/d/a/d_a_boomerang/d_a_boomerang.cpp @@ -346,7 +346,7 @@ extern "C" u8 mCurrentMtx__6J3DSys[48]; extern "C" u8 sincosTable___5JMath[65536]; extern "C" f32 mRoofY__11fopAcM_rc_c; extern "C" f32 mWaterY__11fopAcM_wt_c[1 + 1 /* padding */]; -extern "C" extern u8 struct_8045101C[4]; +extern "C" extern u8 m_dropAngleY__20daPy_boomerangMove_c[4]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; // diff --git a/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp b/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp index 77a356fabe3..035d95a1c5f 100644 --- a/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp +++ b/rel/d/a/e/d_a_e_wb/d_a_e_wb.cpp @@ -3,6 +3,7 @@ // Translation Unit: d_a_e_wb // + #include "rel/d/a/e/d_a_e_wb/d_a_e_wb.h" #include "dol2asm.h" #include "dolphin/types.h" @@ -15,24 +16,6 @@ namespace std { /* 807E2350 */ void fabsf(f32); }; -struct mDoMtx_stack_c { - /* 8000CD9C */ void transM(f32, f32, f32); - /* 8000CE38 */ void scaleM(f32, f32, f32); - /* 807E2858 */ void multVec(Vec const*, Vec*); - /* 807E288C */ void YrotS(s16); - - static u8 now[48]; -}; - -struct mDoGph_gInf_c { - /* 80007FD8 */ void fadeOut(f32, _GXColor&); - /* 807DFAB4 */ void fadeIn(f32, _GXColor&); -}; - -struct mDoCPd_c { - static u8 m_cpadInfo[256]; -}; - struct himo_s { /* 807E1CCC */ ~himo_s(); /* 807E1D2C */ himo_s(); @@ -52,71 +35,10 @@ struct daE_WB_HIO_c { /* 807E20DC */ ~daE_WB_HIO_c(); }; -struct daAlink_c { - /* 800ED0D4 */ void getHorseReinHandPos(cXyz*, cXyz*); - /* 800ED1F0 */ void checkHorseNotGrab() const; -}; - -struct dVibration_c { - /* 8006FA24 */ void StartShock(int, int, cXyz); - /* 8006FB10 */ void StartQuake(int, int, cXyz); - /* 8006FD94 */ void StopQuake(int); -}; - -struct dPa_levelEcallBack {}; - -struct dPa_control_c { - struct level_c { - /* 8004B918 */ void getEmitter(u32); - }; - - /* 8004C218 */ void setHitMark(u16, fopAc_ac_c*, cXyz const*, csXyz const*, cXyz const*, u32); - /* 8004D4CC */ void set(u32, u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, - cXyz const*, u8, dPa_levelEcallBack*, s8, _GXColor const*, - _GXColor const*, cXyz const*, f32); - /* 8004CA90 */ void set(u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, cXyz const*, - u8, dPa_levelEcallBack*, s8, _GXColor const*, _GXColor const*, - cXyz const*, f32); -}; - struct dMsgObject_c { /* 8023822C */ void getStatus(); }; -struct dEvt_control_c { - /* 80042468 */ void reset(); - /* 80042914 */ void setSkipProc(void*, int (*)(void*, int), int); - /* 807DFAD8 */ void checkSkipEdge(); - /* 807E2908 */ void startCheckSkipEdge(void*); -}; - -struct dEvent_manager_c { - /* 80047B1C */ void getMyStaffId(char const*, fopAc_ac_c*, int); - /* 800480EC */ void getMySubstanceP(int, char const*, int); - /* 8004817C */ void cutEnd(int); -}; - -struct dComIfG_play_c { - /* 8002C97C */ void getLayerNo(int); -}; - -struct dCcU_AtInfo {}; - -struct dCamera_c { - /* 801614AC */ void Start(); - /* 801614D0 */ void Stop(); - /* 8016300C */ void SetTrimSize(s32); - /* 80180B40 */ void Set(cXyz, cXyz, s16, f32); - /* 80180BA0 */ void Reset(cXyz, cXyz, f32, s16); - /* 80180C18 */ void Reset(cXyz, cXyz); -}; - -struct camera_class {}; - -struct cCcS { - /* 80264BA8 */ void Set(cCcD_Obj*); -}; - // // Forward References: // @@ -211,8 +133,8 @@ extern "C" void changeDemoParam2__9daPy_py_cFs(); extern "C" void fabsf__3stdFf(); extern "C" void __ct__4cXyzFRC4cXyz(); extern "C" static void cMtx_YrotS__FPA4_fs(); -extern "C" static void fopAcM_searchPlayerAngleY__FPC10fopAc_ac_c(); -extern "C" static void dComIfGs_onEventBit__FUs(); +extern "C" static void fopAcM_searchPlayerAngleY__FPC10fopAc_ac_c(fopAc_ac_c const* param_0); +extern "C" static void dComIfGs_onEventBit__FUs(u16); extern "C" static void Z2GetAudioMgr__Fv(); extern "C" void cancelOriginalDemo__9daPy_py_cFv(); extern "C" static void dComIfGp_event_reset__Fv(); @@ -227,14 +149,15 @@ extern "C" void __ct__4cXyzFv(); extern "C" static void fopAcM_SearchByName__Fs(); extern "C" static void fopAcM_SearchByID__FUi(unsigned int); extern "C" static void dComIfGp_getHorseActor__Fv(); -extern "C" static void dComIfGp_getPlayer__Fi(); -extern "C" static void dComIfGp_getCamera__Fi(); +extern "C" static void dComIfGp_getPlayer__Fi(int); +extern "C" static void dComIfGp_getCamera__Fi(int); extern "C" static void dComIfGp_getPlayerCameraID__Fi(); extern "C" static void dMsgObject_isTalkNowCheck__Fv(); extern "C" void abs__4cXyzCFv(); extern "C" static void cMtx_XrotM__FPA4_fs(); extern "C" static void JMAFastSqrt__Ff(); -extern "C" static void dComIfGp_particle_set__FUlUsPC4cXyzPC5csXyzPC4cXyz(); +extern "C" static void dComIfGp_particle_set__FUlUsPC4cXyzPC5csXyzPC4cXyz(u32 param_0, u16 param_1, cXyz const* param_2, + csXyz const* param_3, cXyz const* param_4); extern "C" void cancelOriginalDemo__9daHorse_cFv(); extern "C" void __ct__10JAISoundIDFUl(u32* this_replacement, u32 param_0); extern "C" static void dComIfGp_getVibration__Fv(); @@ -242,8 +165,8 @@ extern "C" void __ct__4cXyzFfff(); extern "C" void onDemoJumpDistance__9daHorse_cFff(); extern "C" void __as__4cXyzFRC4cXyz(); extern "C" void __apl__4cXyzFRC3Vec(); -extern "C" void multVec__14mDoMtx_stack_cFPC3VecP3Vec(); -extern "C" void YrotS__14mDoMtx_stack_cFs(); +extern "C" void multVec__14mDoMtx_stack_cFPC3VecP3Vec(Vec const* param_0, Vec* param_1); +extern "C" void YrotS__14mDoMtx_stack_cFs(s16); extern "C" void changeDemoPos0__9daHorse_cFPC4cXyz(); extern "C" void changeDemoMode__9daHorse_cFUli(); extern "C" void setHorsePosAndAngle__9daHorse_cFPC4cXyzs(); @@ -437,11 +360,9 @@ extern "C" extern void* __vt__14cCcD_ShapeAttr[22]; extern "C" extern void* __vt__9cCcD_Stts[8]; extern "C" u8 m_cpadInfo__8mDoCPd_c[256]; extern "C" u8 now__14mDoMtx_stack_c[48]; -extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mSimpleTexObj__21dDlst_shadowControl_c[32]; extern "C" u8 mCurrentMtx__6J3DSys[48]; extern "C" u8 sincosTable___5JMath[65536]; -extern "C" extern u32 g_blackColor; //extern "C" extern void* calc_mtx[1 + 1 /* padding */]; extern "C" extern u8 struct_80450C98[4]; extern "C" f32 mGroundY__11fopAcM_gc_c; @@ -4679,7 +4600,7 @@ static asm void cMtx_YrotS(f32 (*param_0)[4], s16 param_1) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void fopAcM_searchPlayerAngleY(fopAc_ac_c const* param_0) { +static asm void fopAcM_searchPlayerAngleY__FPC10fopAc_ac_c(fopAc_ac_c const* param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/fopAcM_searchPlayerAngleY__FPC10fopAc_ac_c.s" } @@ -4689,7 +4610,7 @@ static asm void fopAcM_searchPlayerAngleY(fopAc_ac_c const* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dComIfGs_onEventBit(u16 param_0) { +static asm void dComIfGs_onEventBit__FUs(u16 param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/dComIfGs_onEventBit__FUs.s" } @@ -4740,7 +4661,7 @@ asm void daPy_py_c::changeOriginalDemo() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void daPy_getPlayerActorClass() { +static asm void daPy_getPlayerActorClass__Fv() { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/daPy_getPlayerActorClass__Fv.s" } @@ -4841,7 +4762,7 @@ static asm void dComIfGp_getHorseActor() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dComIfGp_getPlayer(int param_0) { +static asm void dComIfGp_getPlayer__Fi(int param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/dComIfGp_getPlayer__Fi.s" } @@ -4851,7 +4772,7 @@ static asm void dComIfGp_getPlayer(int param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dComIfGp_getCamera(int param_0) { +static asm void dComIfGp_getCamera__Fi(int param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/dComIfGp_getCamera__Fi.s" } @@ -4913,7 +4834,7 @@ static asm void JMAFastSqrt(f32 param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dComIfGp_particle_set(u32 param_0, u16 param_1, cXyz const* param_2, +static asm void dComIfGp_particle_set__FUlUsPC4cXyzPC5csXyzPC4cXyz(u32 param_0, u16 param_1, cXyz const* param_2, csXyz const* param_3, cXyz const* param_4) { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/dComIfGp_particle_set__FUlUsPC4cXyzPC5csXyzPC4cXyz.s" @@ -4939,7 +4860,7 @@ extern "C" void __ct__10JAISoundIDFUl(u32* this_replacement, u32 param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -static asm void dComIfGp_getVibration() { +static asm void dComIfGp_getVibration__Fv() { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/dComIfGp_getVibration__Fv.s" } @@ -4993,7 +4914,7 @@ extern "C" asm void __apl__4cXyzFRC3Vec() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void mDoMtx_stack_c::multVec(Vec const* param_0, Vec* param_1) { +asm void multVec__14mDoMtx_stack_cFPC3VecP3Vec(Vec const* param_0, Vec* param_1) { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/multVec__14mDoMtx_stack_cFPC3VecP3Vec.s" } @@ -5003,7 +4924,7 @@ asm void mDoMtx_stack_c::multVec(Vec const* param_0, Vec* param_1) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void mDoMtx_stack_c::YrotS(s16 param_0) { +asm void YrotS__14mDoMtx_stack_cFs(s16 param_0) { nofralloc #include "asm/rel/d/a/e/d_a_e_wb/d_a_e_wb/YrotS__14mDoMtx_stack_cFs.s" } diff --git a/src/d/a/d_a_alink.cpp b/src/d/a/d_a_alink.cpp index ba0a9133399..6183ed4c53b 100644 --- a/src/d/a/d_a_alink.cpp +++ b/src/d/a/d_a_alink.cpp @@ -33,8 +33,6 @@ // Types: // -struct fopEn_enemy_c {}; - struct daTagMist_c { /* 80031CF0 */ void getPlayerNo(); }; @@ -3094,7 +3092,7 @@ extern "C" u8 mParticleTracePCB__13dPa_control_c[4 + 4 /* padding */]; extern "C" extern u8 struct_80450FB8[4]; extern "C" extern u8 struct_80450FBC[4]; extern "C" u8 m_midnaActor__9daPy_py_c[4]; -extern "C" extern u8 struct_8045101C[4]; +extern "C" extern u8 m_dropAngleY__20daPy_boomerangMove_c[4]; extern "C" u8 Zero__5csXyz[4]; extern "C" u8 mLinkPtr__14Z2CreatureLink[4 + 4 /* padding */]; extern "C" u8 mAudioMgrPtr__10Z2AudioMgr[4 + 4 /* padding */]; diff --git a/src/d/a/d_a_alink_boom.inc b/src/d/a/d_a_alink_boom.inc index 73e3a79c578..a487ce03fe8 100644 --- a/src/d/a/d_a_alink_boom.inc +++ b/src/d/a/d_a_alink_boom.inc @@ -1,3 +1,5 @@ +#include "rel/d/a/d_a_boomerang/d_a_boomerang.h" + /* 800DFFE0-800E0010 0DA920 0030+00 0/0 0/0 1/1 .text checkBoomerangLockAccept__9daAlink_cFv */ BOOL daAlink_c::checkBoomerangLockAccept() { return mSight.getDrawFlg() && i_dComIfGp_checkPlayerStatus0(0, 0x80000); @@ -9,9 +11,9 @@ BOOL daAlink_c::checkBoomerangLockAccept() { f32 daAlink_c::getBoomSpeed() { f32 speed; if (checkBoomerangChargeEndWait()) { - speed = daAlinkHIO_boom_c0::m.field_0x38; + speed = daAlinkHIO_boom_c0::m.mFlySpeed2; } else { - speed = daAlinkHIO_boom_c0::m.field_0x34; + speed = daAlinkHIO_boom_c0::m.mFlySpeed; } if (i_checkModeFlg(0x400) && mRideAcKeep.getActor() != NULL && mSpeedF > FLOAT_LABEL(lit_6108)) { @@ -39,22 +41,22 @@ f32 daAlink_c::getBoomCatchSpeed() const { /* 800E00C0-800E011C 0DAA00 005C+00 1/1 0/0 1/1 .text getBoomFlyMax__9daAlink_cCFv */ f32 daAlink_c::getBoomFlyMax() const { if (i_checkModeFlg(0x400) && !checkCanoeRide()) { - return daAlinkHIO_boom_c0::m.field_0x40; + return daAlinkHIO_boom_c0::m.mHorsebackFlyDistMax; } else { - return daAlinkHIO_boom_c0::m.field_0x3c; + return daAlinkHIO_boom_c0::m.mFlyDistMax; } } /* 800E011C-800E0190 0DAA5C 0074+00 1/1 0/0 2/2 .text getBoomLockMax__9daAlink_cFv */ f32 daAlink_c::getBoomLockMax() { - f32 max = getBoomFlyMax(); + f32 fly_max = getBoomFlyMax(); if (checkBossBabaRoom()) { return lit_12475; - } else if (daAlinkHIO_boom_c0::m.field_0x44 > max) { - return daAlinkHIO_boom_c0::m.field_0x44; + } else if (daAlinkHIO_boom_c0::m.mLockDistMax > fly_max) { + return daAlinkHIO_boom_c0::m.mLockDistMax; } else { - return max; + return fly_max; } } @@ -94,21 +96,25 @@ fopAc_ac_c* daAlink_c::getBoomerangActor() { } /* 800E0244-800E02B8 0DAB84 0074+00 0/0 1/1 0/0 .text checkBoomerangChargeEnd__9daAlink_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm bool daAlink_c::checkBoomerangChargeEnd() { - nofralloc -#include "asm/d/a/d_a_alink/checkBoomerangChargeEnd__9daAlink_cFv.s" +bool daAlink_c::checkBoomerangChargeEnd() { + if (checkBoomerangChargeEndWait()) { + return true; + } + + daBoomerang_c* boomerang = (daBoomerang_c*)getBoomerangActor(); + if (boomerang != NULL && boomerang->checkCharge()) { + return true; + } + + return false; } -#pragma pop /* 800E02B8-800E03D0 0DABF8 0118+00 0/0 1/1 0/0 .text * checkBoomerangCarry__9daAlink_cFP10fopAc_ac_c */ #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daAlink_c::checkBoomerangCarry(fopAc_ac_c* param_0) { +asm BOOL daAlink_c::checkBoomerangCarry(fopAc_ac_c* param_0) { nofralloc #include "asm/d/a/d_a_alink/checkBoomerangCarry__9daAlink_cFP10fopAc_ac_c.s" } @@ -124,7 +130,7 @@ void daAlink_c::initBoomerangUpperAnimeSpeed(int param_0) { mFrameCtrl2[2].setFrame(tmp); getNowAnmPackUpper(UPPER_NOW)->setFrame(tmp); } else { - mFrameCtrl2[2].setRate(daAlinkHIO_boom_c0::m.field_0x2c); + mFrameCtrl2[2].setRate(daAlinkHIO_boom_c0::m.mIdleAnmSpeed); } } } @@ -136,14 +142,9 @@ BOOL daAlink_c::checkBoomerangAnime() const { } /* 800E04AC-800E04E8 0DADEC 003C+00 13/13 0/0 0/0 .text checkBoomerangThrowAnime__9daAlink_cCFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm BOOL daAlink_c::checkBoomerangThrowAnime() const { - nofralloc -#include "asm/d/a/d_a_alink/checkBoomerangThrowAnime__9daAlink_cCFv.s" +BOOL daAlink_c::checkBoomerangThrowAnime() const { + return (mEquipItem == BOOMERANG || i_checkNoResetFlg1(FLG1_UNK_2) || mEquipItem == 0x102) && checkUpperAnime(0x53); } -#pragma pop /* 800E04E8-800E055C 0DAE28 0074+00 1/1 0/0 0/0 .text setBoomerangReadyQuake__9daAlink_cFv */ #pragma push diff --git a/src/d/a/d_a_horse_static.cpp b/src/d/a/d_a_horse_static.cpp index 8f7a8a18e9c..9e64804270a 100644 --- a/src/d/a/d_a_horse_static.cpp +++ b/src/d/a/d_a_horse_static.cpp @@ -12,13 +12,13 @@ BOOL e_wb_class::checkWait() { } void e_wb_class::setPlayerRideNow() { - field_0x690 = 0x67; + mActionID = ACT_PL_RIDE_NOW; field_0x5b4 = 0; field_0x6be |= 3; } void e_wb_class::setPlayerRide() { - field_0x690 = 0x65; + mActionID = ACT_PL_RIDE; field_0x5b4 = 0; field_0x6be |= 3; @@ -26,28 +26,29 @@ void e_wb_class::setPlayerRide() { } void e_wb_class::getOff() { - if (!checkDownDamage() || field_0x690 == 0x67) { - field_0x690 = 0; + if (!checkDownDamage() || mActionID == ACT_PL_RIDE_NOW) { + mActionID = 0; } else { field_0x692 = 0; } + field_0x5b4 = 0; - field_0x6be &= 0xfffc; + field_0x6be &= ~3; mZ2Ride.setLinkRiding(false); } BOOL e_wb_class::checkDownDamage() { - return field_0x690 != 0x65 && field_0x690 != 0x66 && field_0x690 != 0x15; + return mActionID != ACT_PL_RIDE && mActionID != 0x66 && mActionID != ACT_S_DAMAGE; } u8 e_wb_class::checkNormalRideMode() const { - return field_0x690 != 0x66 || field_0x5b4 < 1; + return mActionID != 0x66 || field_0x5b4 < 1; } void e_wb_class::setRunRideMode() { - if (field_0x690 == 0x65) { + if (mActionID == ACT_PL_RIDE) { field_0x5b4 = 0; - field_0x690 = 0x15; + mActionID = ACT_S_DAMAGE; field_0x692 = 0x65; } } diff --git a/src/d/a/d_a_itembase.cpp b/src/d/a/d_a_itembase.cpp index 4a589f4cfc0..9811545c172 100644 --- a/src/d/a/d_a_itembase.cpp +++ b/src/d/a/d_a_itembase.cpp @@ -99,14 +99,14 @@ int daItemBase_c::CreateItemHeap(char const* arcName, s16 bmdName, s16 btkName, if (brkName > 0) { J3DAnmTevRegKey* pbrk = (J3DAnmTevRegKey*)dComIfG_getObjectRes(arcName, brkName); s8 tevFrm = getTevFrm(); - int tmp = 1; + int anmPlay = 1; if (tevFrm != -1) { - tmp = 0; + anmPlay = 0; } mpBrkAnm = new mDoExt_brkAnm(); - if (mpBrkAnm == NULL || !mpBrkAnm->init(modelData, pbrk, tmp, 2, 1.0f, 0, -1)) { + if (mpBrkAnm == NULL || !mpBrkAnm->init(modelData, pbrk, anmPlay, 2, 1.0f, 0, -1)) { return 0; } } @@ -176,8 +176,7 @@ void daItemBase_c::setShadow() { if (!chkFlag(0x10)) { if (getShadowSize() != 0.0f) { - dComIfGd_setSimpleShadow(¤t.pos, mAcch.GetGroundH(), scale, - mAcch.m_gnd, 0, 1.0f, + dComIfGd_setSimpleShadow(¤t.pos, mAcch.GetGroundH(), scale, mAcch.m_gnd, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); } } else { @@ -186,10 +185,9 @@ void daItemBase_c::setShadow() { shadowSize = 150.0f; } - field_0x91c = - dComIfGd_setShadow(field_0x91c, 3, mpModel, ¤t.pos, shadowSize, 0.0f, - current.pos.y, mAcch.GetGroundH(), mAcch.m_gnd, - &mTevStr, 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); + field_0x91c = dComIfGd_setShadow(field_0x91c, 3, mpModel, ¤t.pos, shadowSize, 0.0f, + current.pos.y, mAcch.GetGroundH(), mAcch.m_gnd, &mTevStr, + 0, 1.0f, dDlst_shadowControl_c::getSimpleTex()); } } diff --git a/src/d/a/d_a_obj.cpp b/src/d/a/d_a_obj.cpp index 3f57f806591..7149519432d 100644 --- a/src/d/a/d_a_obj.cpp +++ b/src/d/a/d_a_obj.cpp @@ -4,110 +4,25 @@ // #include "d/a/d_a_obj.h" +#include "d/com/d_com_inf_game.h" #include "dol2asm.h" #include "dolphin/types.h" // // Types: // - -struct fopAc_ac_c {}; - -struct daPy_py_c { - /* 8015F398 */ void checkMasterSwordEquip(); -}; - -struct dCcD_GObjInf { - /* 800844F8 */ void GetTgHitObj(); - /* 8008457C */ void GetTgHitObjSe(); -}; - -struct Quaternion {}; - -struct Vec {}; - -struct cXyz { - /* 80009184 */ ~cXyz(); - /* 80266B34 */ void operator-(Vec const&) const; - /* 80266B84 */ void operator*(f32) const; - /* 80266C18 */ void operator/(f32) const; - /* 80266CBC */ void outprod(Vec const&) const; - - static f32 Zero[3]; - static u8 BaseY[12]; -}; - -struct daObj { - /* 80037038 */ void eff_break_tsubo(fopAc_ac_c*, cXyz, int); - /* 80037180 */ void make_eff_break_kotubo(fopAc_ac_c*); - /* 80037210 */ void make_eff_break_kotubo2(fopAc_ac_c*); - /* 800372A0 */ void make_eff_break_gm_kotubo(fopAc_ac_c*); - /* 80037330 */ void make_eff_break_gm_ootubo(fopAc_ac_c*); - /* 800373C0 */ void posMoveF_stream(fopAc_ac_c*, cXyz const*, cXyz const*, f32, f32); - /* 80037620 */ void posMoveF_grade(fopAc_ac_c*, cXyz const*, cXyz const*, f32, f32, cXyz const*, - f32, f32, cXyz const*); - /* 80037788 */ void quat_rotBaseY(Quaternion*, cXyz const&); - /* 80037900 */ void HitSeStart(cXyz const*, int, dCcD_GObjInf const*, u32); -}; - -struct dRes_info_c {}; - -struct dRes_control_c { - /* 8003C2EC */ void getRes(char const*, s32, dRes_info_c*, int); -}; - -struct dKy_tevstr_c {}; - -struct J3DModelData {}; - -struct JPABaseEmitter {}; - -struct dPa_modelEcallBack { - /* 8004AC00 */ void setModel(JPABaseEmitter*, J3DModelData*, dKy_tevstr_c const&, u8, void*, u8, - u8); - - static u8 mEcallback[4]; -}; - -struct dPa_levelEcallBack {}; - -struct csXyz {}; - -struct _GXColor {}; - -struct dPa_control_c { - /* 8004CA90 */ void set(u8, u16, cXyz const*, dKy_tevstr_c const*, csXyz const*, cXyz const*, - u8, dPa_levelEcallBack*, s8, _GXColor const*, _GXColor const*, - cXyz const*, f32); - - static u8 mTsubo[64]; -}; - -struct dCcD_GAtTgCoCommonBase { - /* 80083688 */ void GetAc(); -}; - -struct cCcD_SphAttr { - /* 80037A54 */ void GetCoCP(); -}; - -struct cCcD_CylAttr { - /* 80037A4C */ void GetCoCP(); -}; - -struct JAISoundID {}; - -struct Z2SeMgr { - /* 802AB984 */ void seStart(JAISoundID, Vec const*, u32, s8, f32, f32, f32, f32, u8); -}; - -struct Z2AudioMgr { - static u8 mAudioMgrPtr[4 + 4 /* padding */]; -}; - -struct JMath { - static u8 sincosTable_[65536]; -}; +namespace daObj { +/* 80037038 */ void eff_break_tsubo(fopAc_ac_c*, cXyz, int); +/* 80037180 */ void make_eff_break_kotubo(fopAc_ac_c*); +/* 80037210 */ void make_eff_break_kotubo2(fopAc_ac_c*); +/* 800372A0 */ void make_eff_break_gm_kotubo(fopAc_ac_c*); +/* 80037330 */ void make_eff_break_gm_ootubo(fopAc_ac_c*); +/* 800373C0 */ void posMoveF_stream(fopAc_ac_c*, cXyz const*, cXyz const*, f32, f32); +/* 80037620 */ void posMoveF_grade(fopAc_ac_c*, cXyz const*, cXyz const*, f32, f32, cXyz const*, + f32, f32, cXyz const*); +/* 80037788 */ void quat_rotBaseY(Quaternion*, cXyz const&); +/* 80037900 */ void HitSeStart(cXyz const*, int, dCcD_GObjInf const*, u32); +}; // namespace daObj // // Forward References: @@ -151,12 +66,6 @@ extern "C" void outprod__4cXyzCFRC3Vec(); extern "C" void cM_atan2s__Fff(); extern "C" void cM3d_CrawVec__FRC3VecRC3VecP3Vec(); extern "C" void seStart__7Z2SeMgrF10JAISoundIDPC3VecUlScffffUc(); -extern "C" void PSVECAdd(); -extern "C" void PSVECSubtract(); -extern "C" void PSVECScale(); -extern "C" void PSVECSquareMag(); -extern "C" void PSVECDotProduct(); -extern "C" void C_QUATRotAxisRad(); extern "C" void __register_global_object(); extern "C" void _savegpr_25(); extern "C" void _savegpr_26(); @@ -166,8 +75,6 @@ extern "C" void _restgpr_25(); extern "C" void _restgpr_26(); extern "C" void _restgpr_28(); extern "C" void _restgpr_29(); -extern "C" void acos(); -extern "C" extern u8 g_dComIfG_gameInfo[122384]; extern "C" u8 mTsubo__13dPa_control_c[64]; extern "C" f32 Zero__4cXyz[3]; extern "C" u8 BaseY__4cXyz[12]; @@ -194,6 +101,22 @@ SECTION_SDATA2 static f32 lit_3671 = 1.0f; /* 80037038-80037180 031978 0148+00 4/4 0/0 0/0 .text eff_break_tsubo__5daObjFP10fopAc_ac_c4cXyzi */ +#ifdef NONMATCHING +void daObj::eff_break_tsubo(fopAc_ac_c* param_0, cXyz param_1, int param_2) { + J3DModelData* tubo_bmd = (J3DModelData*)dComIfG_getObjectRes("Always", 0x20); + J3DAnmTexPattern* tubo_btp = (J3DAnmTexPattern*)dComIfG_getObjectRes("Always", 0x42); + + JPABaseEmitter* emitter = (JPABaseEmitter*)dComIfGp_particle_set( + 0x15C, ¶m_0->current.pos, NULL, NULL, 0xFF, dPa_modelEcallBack::getEcallback(), + fopAcM_GetRoomNo(param_0), NULL, NULL, ¶m_1); + + dPa_modelEcallBack::setModel(emitter, tubo_bmd, param_0->mTevStr, 3, tubo_btp, 0, param_2); + + dComIfGp_particle_set(0x15D, ¶m_0->current.pos, NULL, NULL, 0xFF, + dPa_control_c::getTsuboSelectTexEcallBack(param_2), + fopAcM_GetRoomNo(param_0), NULL, NULL, ¶m_1); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -202,6 +125,7 @@ asm void daObj::eff_break_tsubo(fopAc_ac_c* param_0, cXyz param_1, int param_2) #include "asm/d/a/d_a_obj/eff_break_tsubo__5daObjFP10fopAc_ac_c4cXyzi.s" } #pragma pop +#endif /* ############################################################################################## */ /* 804245E8-804245F4 051308 000C+00 1/1 0/0 0/0 .bss @3677 */ @@ -212,6 +136,14 @@ static f32 scale_3676[3]; /* 80037180-80037210 031AC0 0090+00 0/0 0/0 2/2 .text make_eff_break_kotubo__5daObjFP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +void daObj::make_eff_break_kotubo(fopAc_ac_c* param_0) { + static cXyz scale(1.0f, 1.0f, 1.0f); + + eff_break_tsubo(param_0, scale, 0); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -220,6 +152,7 @@ asm void daObj::make_eff_break_kotubo(fopAc_ac_c* param_0) { #include "asm/d/a/d_a_obj/make_eff_break_kotubo__5daObjFP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80424600-8042460C 051320 000C+00 1/1 0/0 0/0 .bss @3692 */ @@ -230,6 +163,14 @@ static f32 scale_3691[3]; /* 80037210-800372A0 031B50 0090+00 0/0 0/0 2/2 .text make_eff_break_kotubo2__5daObjFP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +void daObj::make_eff_break_kotubo2(fopAc_ac_c* param_0) { + static cXyz scale(1.0f, 1.0f, 1.0f); + + eff_break_tsubo(param_0, scale, 1); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -238,6 +179,7 @@ asm void daObj::make_eff_break_kotubo2(fopAc_ac_c* param_0) { #include "asm/d/a/d_a_obj/make_eff_break_kotubo2__5daObjFP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80424618-80424624 051338 000C+00 1/1 0/0 0/0 .bss @3719 */ @@ -248,6 +190,14 @@ static f32 scale_3718[3]; /* 800372A0-80037330 031BE0 0090+00 0/0 0/0 1/1 .text * make_eff_break_gm_kotubo__5daObjFP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +void daObj::make_eff_break_gm_kotubo(fopAc_ac_c* param_0) { + static cXyz scale(1.0f, 1.0f, 1.0f); + + eff_break_tsubo(param_0, scale, 3); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -256,6 +206,7 @@ asm void daObj::make_eff_break_gm_kotubo(fopAc_ac_c* param_0) { #include "asm/d/a/d_a_obj/make_eff_break_gm_kotubo__5daObjFP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80424630-8042463C 051350 000C+00 1/1 0/0 0/0 .bss @3732 */ @@ -269,6 +220,14 @@ SECTION_SDATA2 static f32 lit_3714 = 2.0f; /* 80037330-800373C0 031C70 0090+00 0/0 0/0 1/1 .text * make_eff_break_gm_ootubo__5daObjFP10fopAc_ac_c */ +// matches with literals +#ifdef NONMATCHING +void daObj::make_eff_break_gm_ootubo(fopAc_ac_c* param_0) { + static cXyz scale(2.0f, 2.0f, 2.0f); + + eff_break_tsubo(param_0, scale, 4); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off @@ -277,6 +236,7 @@ asm void daObj::make_eff_break_gm_ootubo(fopAc_ac_c* param_0) { #include "asm/d/a/d_a_obj/make_eff_break_gm_ootubo__5daObjFP10fopAc_ac_c.s" } #pragma pop +#endif /* ############################################################################################## */ /* 80451DA0-80451DA4 0003A0 0004+00 4/4 0/0 0/0 .sdata2 @3801 */ @@ -383,7 +343,8 @@ asm void daObj::HitSeStart(cXyz const* param_0, int param_1, dCcD_GObjInf const* #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void cCcD_CylAttr::GetCoCP() { +// asm void cCcD_CylAttr::GetCoCP() { +extern "C" asm void GetCoCP__12cCcD_CylAttrFv() { nofralloc #include "asm/d/a/d_a_obj/GetCoCP__12cCcD_CylAttrFv.s" } @@ -393,7 +354,8 @@ asm void cCcD_CylAttr::GetCoCP() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void cCcD_SphAttr::GetCoCP() { +// asm void cCcD_SphAttr::GetCoCP() { +extern "C" asm void GetCoCP__12cCcD_SphAttrFv() { nofralloc #include "asm/d/a/d_a_obj/GetCoCP__12cCcD_SphAttrFv.s" } diff --git a/src/d/a/d_a_player.cpp b/src/d/a/d_a_player.cpp index 518fc004f6f..81c1161e016 100644 --- a/src/d/a/d_a_player.cpp +++ b/src/d/a/d_a_player.cpp @@ -12,7 +12,9 @@ #include "dolphin/types.h" #include "f_op/f_op_actor_iter.h" #include "f_op/f_op_actor_mng.h" +#include "m_Do/m_Do_lib.h" #include "rel/d/a/d_a_boomerang/d_a_boomerang.h" +#include "rel/d/a/d_a_spinner/d_a_spinner.h" // // Forward References: @@ -77,6 +79,7 @@ extern "C" void setMidnaFaceNum__9daPy_py_cFi(); extern "C" void daPy_addCalcShort__FPsssss(); extern "C" extern void* __vt__18daPy_sightPacket_c[4 + 1 /* padding */]; extern "C" u8 m_midnaActor__9daPy_py_c[4]; +extern "C" u8 m_dropAngleY__20daPy_boomerangMove_c[4]; // // External References: @@ -143,10 +146,12 @@ bool daPy_frameCtrl_c::checkAnmEnd() { if (getEndFlg() != 0 && getNowSetFlg() == 0) { return true; } + if (getRate() == lit_4215[0]) { onEndFlg(); onNowSetFlg(); } + return false; } @@ -155,63 +160,38 @@ void daPy_frameCtrl_c::updateFrame() { offNowSetFlg(); } -/* ############################################################################################## */ -/* 80453608-80453610 001C08 0008+00 2/2 0/0 0/0 .sdata2 @4237 */ -SECTION_SDATA2 static f64 lit_4237 = 4503601774854144.0 /* cast s32 to float */; - /* 8015E544-8015E5B0 158E84 006C+00 0/0 1/1 6/6 .text setFrameCtrl__16daPy_frameCtrl_cFUcssff */ -// compiler generated literal from short to float conversion -#ifdef NONMATCHING -void daPy_frameCtrl_c::setFrameCtrl(u8 pAttribute, s16 pStart, s16 pEnd, f32 pRate, f32 pFrame) { - setAttribute(pAttribute); - setEnd(pEnd); - setRate(pRate); - setStart(pStart); - setFrame(pFrame); - if (pRate >= lit_4215[0]) { - setLoop(pStart); +void daPy_frameCtrl_c::setFrameCtrl(u8 i_attribute, s16 i_start, s16 i_end, f32 i_rate, + f32 i_frame) { + setAttribute(i_attribute); + setEnd(i_end); + setRate(i_rate); + setStart(i_start); + setFrame(i_frame); + + if (i_rate >= lit_4215[0]) { + setLoop(i_start); } else { - setLoop(pEnd); + setLoop(i_end); } + offEndFlg(); } -#else -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daPy_frameCtrl_c::setFrameCtrl(u8 param_0, s16 param_1, s16 param_2, f32 param_3, - f32 param_4) { - nofralloc -#include "asm/d/a/d_a_player/setFrameCtrl__16daPy_frameCtrl_cFUcssff.s" -} -#pragma pop -#endif - -/* ############################################################################################## */ -/* 80453610-80453614 001C10 0004+00 1/1 0/0 0/0 .sdata2 @4247 */ -SECTION_SDATA2 static f32 lit_4247 = 30.0f; - -/* 80453614-80453618 001C14 0004+00 1/1 0/0 0/0 .sdata2 @4248 */ -SECTION_SDATA2 static f32 lit_4248 = 70.0f; - -/* 80453618-8045361C 001C18 0004+00 2/2 0/0 0/0 .sdata2 @4249 */ -SECTION_SDATA2 static f32 lit_4249 = 50.0f; - -/* 8045361C-80453620 001C1C 0004+00 1/1 0/0 0/0 .sdata2 @4250 */ -SECTION_SDATA2 static f32 lit_4250 = 65536.0f; /* 8015E5B0-8015E654 158EF0 00A4+00 0/0 1/1 18/18 .text initOffset__20daPy_boomerangMove_cFPC4cXyz */ void daPy_boomerangMove_c::initOffset(cXyz const* param_0) { daBoomerang_c* boomerang = daPy_py_c::getThrowBoomerangActor(); + if (boomerang != NULL) { bgCheckAfterOffset(param_0); boomerang->onWindCatch(); } else { - field_0x4 = cM_rndF(lit_4248) + lit_4247; - field_0x8 = cM_rndF(lit_4249) + lit_4249; - field_0x2 = cM_rndF(lit_4250); + field_0x4 = cM_rndF(70.0f) + 30.0f; + field_0x8 = cM_rndF(50.0f) + 50.0f; + field_0x2 = cM_rndF(65536.0f); } + field_0x0 = 0; } @@ -221,34 +201,59 @@ daMidna_c* daPy_py_c::m_midnaActor; /* 8045101C-80451020 -00001 0004+00 1/1 1/1 1/1 .sbss None */ /* 8045101C 0002+00 data_8045101C m_dropAngleY__20daPy_boomerangMove_c */ +s16 daPy_boomerangMove_c::m_dropAngleY; + /* 8045101E 0002+00 data_8045101E m_eventKeepFlg__20daPy_boomerangMove_c */ -extern u8 struct_8045101C[4]; -u8 struct_8045101C[4]; - -/* 80453620-80453624 001C20 0004+00 1/1 0/0 0/0 .sdata2 @4332 */ -SECTION_SDATA2 static f32 lit_4332 = 300.0f; - -/* 80453624-80453628 001C24 0004+00 1/1 0/0 0/0 .sdata2 @4333 */ -SECTION_SDATA2 static f32 lit_4333 = -700.0f; - -/* 80453628-80453630 001C28 0004+04 1/1 0/0 0/0 .sdata2 @4334 */ -SECTION_SDATA2 static f32 lit_4334[1 + 1 /* padding */] = { - 2048.0f, - /* padding */ - 0.0f, -}; +s16 daPy_boomerangMove_c::m_eventKeepFlg; /* 8015E654-8015E87C 158F94 0228+00 0/0 1/1 17/17 .text * posMove__20daPy_boomerangMove_cFP4cXyzPsP10fopAc_ac_cs */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daPy_boomerangMove_c::posMove(cXyz* param_0, s16* param_1, fopAc_ac_c* param_2, - s16 param_3) { - nofralloc -#include "asm/d/a/d_a_player/posMove__20daPy_boomerangMove_cFP4cXyzPsP10fopAc_ac_cs.s" +int daPy_boomerangMove_c::posMove(cXyz* param_0, s16* param_1, fopAc_ac_c* param_2, s16 param_3) { + daBoomerang_c* boomerang = daPy_py_c::getThrowBoomerangActor(); + + field_0x2 -= param_3; + *param_1 -= param_3; + + if (field_0x8 > 300.0f) { + field_0x8 = 300.0f; + } + + if (field_0x4 < -700.0f) { + field_0x4 = -700.0f; + } else if (field_0x4 > 50.0f) { + field_0x4 = 50.0f; + } + + if (boomerang != NULL) { + if (boomerang->checkForceDelete()) { + return 0; + } + + if (i_dComIfGp_event_runCheck()) { + field_0x0 = 1; + } else if (m_eventKeepFlg != 0 && field_0x0 == 0) { + return 0; + } + + param_0->set(boomerang->current.pos.x + field_0x8 * cM_ssin(field_0x2), + boomerang->current.pos.y + field_0x4, + boomerang->current.pos.z + field_0x8 * cM_scos(field_0x2)); + boomerang->onWindCatch(); + return 1; + } + + daAlink_c* link = daAlink_getAlinkActorClass(); + if ((param_2 == NULL || !link->checkBoomerangCarry(param_2)) && + (m_eventKeepFlg == 0 || field_0x0 != 0)) { + s16 tmp = (m_dropAngleY + link->mCollisionRot.y) + cM_rndF(2048.0f); + + param_0->x = link->current.pos.x + field_0x8 * cM_ssin(tmp); + param_0->z = link->current.pos.z + field_0x8 * cM_scos(tmp); + m_dropAngleY += 0x2000; + } + + return 0; } -#pragma pop /* ############################################################################################## */ /* 80453630-80453638 001C30 0008+00 1/1 0/0 0/0 .sdata2 @4379 */ @@ -271,8 +276,8 @@ void daPy_boomerangMove_c::bgCheckAfterOffset(cXyz const* param_0) { if (boomerang != NULL) { field_0x4 = param_0->y - boomerang->current.pos.y; field_0x8 = boomerang->current.pos.absXZ(*param_0); - field_0x2 = cM_atan2s(param_0->x - boomerang->current.pos.x, - param_0->z - boomerang->current.pos.z); + field_0x2 = + cM_atan2s(param_0->x - boomerang->current.pos.x, param_0->z - boomerang->current.pos.z); } } #else @@ -375,10 +380,10 @@ void daPy_actorKeep_c::setActor() { /* 8015ECB8-8015ECFC 1595F8 0044+00 0/0 59/59 4/4 .text setData__16daPy_actorKeep_cFP10fopAc_ac_c */ -void daPy_actorKeep_c::setData(fopAc_ac_c* pActor) { - if (pActor != NULL) { - mActor = pActor; - mID = fopAcM_GetID(pActor); +void daPy_actorKeep_c::setData(fopAc_ac_c* i_actor) { + if (i_actor != NULL) { + mActor = i_actor; + mID = fopAcM_GetID(i_actor); } else { clearData(); } @@ -389,9 +394,9 @@ void daPy_actorKeep_c::clearData() { mActor = NULL; } -daPy_anmHeap_c::daPy_anmHeap_c(u32 pBufferSize) { +daPy_anmHeap_c::daPy_anmHeap_c(u32 i_bufferSize) { initData(); - mBufferSize = pBufferSize; + mBufferSize = i_bufferSize; } daPy_anmHeap_c::~daPy_anmHeap_c() { @@ -414,16 +419,16 @@ void* daPy_anmHeap_c::mallocBuffer() { /* 8015EE00-8015EF84 159740 0184+00 0/0 1/1 1/1 .text * createHeap__14daPy_anmHeap_cFQ214daPy_anmHeap_c16daAlinkHEAP_TYPE */ -void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE heap_type) { +void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE i_heapType) { u32 size; - if (heap_type == 4) { + if (i_heapType == 4) { size = mBufferSize; - } else if (heap_type == 3) { + } else if (i_heapType == 3) { size = 0x50; - } else if (heap_type == 0) { + } else if (i_heapType == 0) { size = 0x40; - } else if (heap_type == 1) { + } else if (i_heapType == 1) { size = 0x40; } else { size = 0xA0; @@ -432,13 +437,13 @@ void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE heap_type) { JKRHeap* tmp; mAnimeHeap = mDoExt_createSolidHeapFromGameToCurrent(&tmp, size, 0x20); - if (heap_type == 4) { + if (i_heapType == 4) { char* tmpWork = new char[size]; - } else if (heap_type == 3) { + } else if (i_heapType == 3) { mDoExt_transAnmBas* tmpTransBas = new mDoExt_transAnmBas(NULL); - } else if (heap_type == 0) { + } else if (i_heapType == 0) { J3DAnmTransformKey* tmpTrans = new J3DAnmTransformKey(); - } else if (heap_type == 1) { + } else if (i_heapType == 1) { J3DAnmTexPattern* tmpTp = new J3DAnmTexPattern(); } else { J3DAnmTextureSRTKey* tmpTk = new J3DAnmTextureSRTKey(); @@ -448,50 +453,24 @@ void daPy_anmHeap_c::createHeap(daPy_anmHeap_c::daAlinkHEAP_TYPE heap_type) { mDoExt_adjustSolidHeap(mAnimeHeap); } -/* ############################################################################################## */ -/* 80453648-80453650 001C48 0008+00 1/0 0/0 0/0 .sdata2 sumouArcName$4614 */ -extern "C" char sumouArcName[8]; - -/* 80453650-80453658 001C50 0005+03 1/0 0/0 0/0 .sdata2 ocArcName$4615 */ -extern "C" char ocArcName[8]; - -/* 80453658-80453660 001C58 0005+03 1/0 0/0 0/0 .sdata2 drArcName$4618 */ -extern "C" char drArcName[8]; - -/* 80453660-80453668 001C60 0008+00 1/0 0/0 0/0 .sdata2 msDemoArcName$4619 */ -extern "C" char msDemoArcName[8]; - -/* 80453668-80453670 001C68 0006+02 1/0 0/0 0/0 .sdata2 lastGanonArcName$4620 */ -extern "C" char lastGanonArcName[8]; - -/* 80453670-80453678 001C70 0006+02 1/0 0/0 0/0 .sdata2 pigGanonArcName$4621 */ -extern "C" char pigGanonArcName[8]; - -SECTION_RODATA static char const twglArcName[12] = "TWGate_Lk"; - -SECTION_RODATA static char const twgwArcName[12] = "TWGate_Wf"; - -SECTION_DATA static char* arcName[8] = { - (char*)&sumouArcName, (char*)&ocArcName, (char*)&twglArcName, (char*)&twgwArcName, - (char*)&drArcName, (char*)&msDemoArcName, (char*)&lastGanonArcName, (char*)&pigGanonArcName, -}; - -SECTION_SDATA2 static char sumouArcName[8] = "alSumou"; - -SECTION_SDATA2 static char ocArcName[8] = "B_oh"; - -SECTION_SDATA2 static char drArcName[8] = "B_DR"; - -SECTION_SDATA2 static char msDemoArcName[8] = "Lv6Gate"; - -SECTION_SDATA2 static char lastGanonArcName[8] = "B_gnd"; - -SECTION_SDATA2 static char pigGanonArcName[8] = "B_mgn"; - /* 8015EF84-8015F068 1598C4 00E4+00 3/3 0/0 0/0 .text loadData__14daPy_anmHeap_cFUs */ -void* daPy_anmHeap_c::loadData(u16 id) { +void* daPy_anmHeap_c::loadData(u16 i_resId) { + static const char twglArcName[12] = "TWGate_Lk"; + static const char twgwArcName[12] = "TWGate_Wf"; + static const char sumouArcName[8] = "alSumou"; + static const char ocArcName[8] = "B_oh"; + static const char drArcName[8] = "B_DR"; + static const char msDemoArcName[8] = "Lv6Gate"; + static const char lastGanonArcName[8] = "B_gnd"; + static const char pigGanonArcName[8] = "B_mgn"; + + static const char* arcName[8] = { + sumouArcName, ocArcName, twglArcName, twgwArcName, + drArcName, msDemoArcName, lastGanonArcName, pigGanonArcName, + }; + if (mArcNo == 0xFFFF) { - dComIfGp_getAnmArchive()->readIdxResource(mBuffer, mBufferSize, id); + dComIfGp_getAnmArchive()->readIdxResource(mBuffer, mBufferSize, i_resId); JKRHeap* heap = setAnimeHeap(); void* data = J3DAnmLoaderDataBase::load(mBuffer, UNK_FLAG0); mDoExt_setCurrentHeap(heap); @@ -499,10 +478,10 @@ void* daPy_anmHeap_c::loadData(u16 id) { } if (mArcNo == 0) { - return dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), id); + return dComIfG_getObjectIDRes(dStage_roomControl_c::getDemoArcName(), i_resId); } - return dComIfG_getObjectRes(arcName[mArcNo - 1], id); + return dComIfG_getObjectRes(arcName[mArcNo - 1], i_resId); } /* 8015F068-8015F0D0 1599A8 0068+00 0/0 9/9 5/5 .text loadDataIdx__14daPy_anmHeap_cFUs */ @@ -520,6 +499,7 @@ void* daPy_anmHeap_c::loadDataIdx(u16 id) { data = NULL; } } + return data; } @@ -534,6 +514,7 @@ void* daPy_anmHeap_c::loadDataPriIdx(u16 id) { mPriIdx = id; data = loadData(id); } + return data; } @@ -548,6 +529,7 @@ void* daPy_anmHeap_c::loadDataDemoRID(u16 id, u16 arc_no) { mArcNo = arc_no; data = loadData(id); } + return data; } @@ -578,29 +560,56 @@ SECTION_SDATA2 static u32 lit_4668 = 0xFF8000FF; SECTION_SDATA2 static u32 lit_4669 = 0x321400FF; /* 8015F1A0-8015F2FC 159AE0 015C+00 1/0 1/1 0/0 .text draw__18daPy_sightPacket_cFv */ +// dumb instruction block out of order +#ifdef NONMATCHING +void daPy_sightPacket_c::draw() { + GXTexObj texObj; + + j3dSys.reinitGX(); + GXSetNumIndStages(0); + GXClearVtxDesc(); + GXSetVtxDesc(GX_VA_POS, GX_DIRECT); + GXSetVtxDesc(GX_VA_TEX0, GX_DIRECT); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_CLR_RGBA, GX_RGB8, 0); + GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_CLR_RGBA, GX_RGB565, 0); + + GXColor reg0 = {255, 128, 0, 255}; + GXColor reg1 = {50, 20, 0, 255}; + + GXSetTevColor(GX_TEVREG0, reg0); + GXSetTevColor(GX_TEVREG1, reg1); + GXInitTexObj(&texObj, mpData, mpImg->width, mpImg->height, (GXTexFmt)mpImg->format, + (GXTexWrapMode)mpImg->wrapS, (GXTexWrapMode)mpImg->wrapT, + (GXBool)(mpImg->mipmapCount > 1)); + GXInitTexObjLOD(&texObj, GX_LINEAR, GX_LINEAR, 0.0, 0.0, 0.0, GX_FALSE, GX_FALSE, GX_ANISO_1); + GXLoadTexObj(&texObj, GX_TEXMAP0); + GXLoadPosMtxImm(field_0x14, GX_PNMTX0); + GXSetCurrentMtx(0); + GXSetTevOrder(GX_TEVSTAGE0, GX_TEXCOORD0, GX_TEXMAP0, GX_COLOR_NULL); + GXCallDisplayList(l_sightDL, 0x80); + J3DShape::resetVcdVatCache(); +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -extern "C" asm void draw__18daPy_sightPacket_cFv() { - // asm void daPy_sightPacket_c::draw() { +asm void daPy_sightPacket_c::draw() { nofralloc #include "asm/d/a/d_a_player/draw__18daPy_sightPacket_cFv.s" } #pragma pop - -/* ############################################################################################## */ -/* 80453680-80453684 001C80 0004+00 1/1 0/0 0/0 .sdata2 @4699 */ -SECTION_SDATA2 static f32 lit_4699 = 32.0f; +#endif /* 8015F2FC-8015F384 159C3C 0088+00 0/0 1/1 0/0 .text setSight__18daPy_sightPacket_cFv */ -#pragma push -#pragma optimization_level 0 -#pragma optimizewithasm off -asm void daPy_sightPacket_c::setSight() { - nofralloc -#include "asm/d/a/d_a_player/setSight__18daPy_sightPacket_cFv.s" +void daPy_sightPacket_c::setSight() { + Vec tmp; + + mDoLib_project(&mPos, &tmp); + mDoMtx_stack_c::transS(tmp.x, tmp.y, tmp.z); + mDoMtx_stack_c::scaleM(32.0f, 32.0f, 32.0f); + mDoMtx_stack_c::copy(field_0x14); + dComIfGd_set2DXlu(this); } -#pragma pop /* 8015F384-8015F398 159CC4 0014+00 0/0 1/1 0/0 .text * setSightImage__18daPy_sightPacket_cFP7ResTIMG */ @@ -617,6 +626,7 @@ BOOL daPy_py_c::checkMasterSwordEquip() { if (equipSword == MASTER_SWORD || equipSword == LIGHT_SWORD) { isMasterSword = true; } + return isMasterSword; } @@ -625,8 +635,7 @@ BOOL daPy_py_c::checkMasterSwordEquip() { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daPy_py_c::checkWoodShieldEquip() { - nofralloc +asm void daPy_py_c::checkWoodShieldEquip(){nofralloc #include "asm/d/a/d_a_player/checkWoodShieldEquip__9daPy_py_cFv.s" } #pragma pop @@ -641,6 +650,7 @@ f32 daPy_py_c::getAttentionOffsetY() { if (checkNowWolf()) { return -12.5f; } + return 57.5f; } @@ -678,8 +688,8 @@ void daPy_py_c::setLookPos(cXyz* p_pos) { } /* 8015F520-8015F55C 159E60 003C+00 0/0 0/0 4/4 .text setPlayerSe__9daPy_py_cFUl */ -void daPy_py_c::setPlayerSe(u32 se_id) { - daAlink_getAlinkActorClass()->seStartOnlyReverb(se_id); +void daPy_py_c::setPlayerSe(u32 i_sfxID) { + daAlink_getAlinkActorClass()->seStartOnlyReverb(i_sfxID); } /* 8015F55C-8015F60C 159E9C 00B0+00 1/1 0/0 2/2 .text @@ -696,7 +706,8 @@ bool daPy_py_c::linkGrabSubjectNoDraw(fopAc_ac_c* p_ac) { } } - if (check_carry && dComIfGp_checkCameraAttentionStatus(i_dComIfGp_getPlayerCameraID(0), 2) != 0) { + if (check_carry && + dComIfGp_checkCameraAttentionStatus(i_dComIfGp_getPlayerCameraID(0), 2) != 0) { ret = true; } @@ -718,8 +729,7 @@ asm bool daPy_py_c::linkGrabSubjectNoDraw(fopAc_ac_c* param_0) { #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daPy_py_c::wolfGrabSubjectNoDraw(fopAc_ac_c* param_0) { - nofralloc +asm void daPy_py_c::wolfGrabSubjectNoDraw(fopAc_ac_c* param_0){nofralloc #include "asm/d/a/d_a_player/wolfGrabSubjectNoDraw__9daPy_py_cFP10fopAc_ac_c.s" } #pragma pop @@ -735,48 +745,67 @@ bool daPy_py_c::checkRoomRestartStart() { if (mode == 4 || mode == 8 || mode == 5) { return true; - } else { - return false; } + + return false; } /* 8015F698-8015F730 159FD8 0098+00 0/0 2/2 1/1 .text checkCarryStartLightBallA__9daPy_py_cFv */ u32 daPy_py_c::checkCarryStartLightBallA() { - if (checkRoomRestartStart() || !i_dComIfGp_getStage() || !i_dComIfGp_getStage()->getStagInfo() || + if (checkRoomRestartStart() || !i_dComIfGp_getStage() || + !i_dComIfGp_getStage()->getStagInfo() || i_dStage_stagInfo_GetSaveTbl(i_dComIfGp_getStage()->getStagInfo()) != 0x17) { return FALSE; } + return dComIfGs_getLastSceneMode() & 0x100000; } /* 8015F730-8015F7C8 15A070 0098+00 0/0 2/2 1/1 .text checkCarryStartLightBallB__9daPy_py_cFv */ u32 daPy_py_c::checkCarryStartLightBallB() { - if (checkRoomRestartStart() || !i_dComIfGp_getStage() || !i_dComIfGp_getStage()->getStagInfo() || + if (checkRoomRestartStart() || !i_dComIfGp_getStage() || + !i_dComIfGp_getStage()->getStagInfo() || i_dStage_stagInfo_GetSaveTbl(i_dComIfGp_getStage()->getStagInfo()) != 0x17) { return FALSE; } + return dComIfGs_getLastSceneMode() & 0x80000; } -float daPy_py_c::getSpinnerRideSpeed() const { - float rideSpeed; +f32 daPy_py_c::getSpinnerRideSpeed() const { + f32 rideSpeed; + if (checkSpinnerRide()) { rideSpeed = mSpeedF; } else { rideSpeed = lit_4215[0]; } + return rideSpeed; } /* 8015F814-8015F89C 15A154 0088+00 0/0 0/0 1/1 .text checkSpinnerReflectEffect__9daPy_py_cFv */ +// matches with literals +#ifdef NONMATCHING +bool daPy_py_c::checkSpinnerReflectEffect() { + daSpinner_c* spinner = (daSpinner_c*)getSpinnerActor(); + + if (spinner != NULL && spinner->reflectAccept()) { + return true; + } + + return false; +} +#else #pragma push #pragma optimization_level 0 #pragma optimizewithasm off -asm void daPy_py_c::checkSpinnerReflectEffect() { +asm bool daPy_py_c::checkSpinnerReflectEffect() { nofralloc #include "asm/d/a/d_a_player/checkSpinnerReflectEffect__9daPy_py_cFv.s" } #pragma pop +#endif /* 8015F89C-8015F8C8 15A1DC 002C+00 0/0 0/0 7/7 .text checkBoomerangCharge__9daPy_py_cFv */ @@ -874,14 +903,3 @@ asm void daPy_addCalcShort(s16* param_0, s16 param_1, s16 param_2, s16 param_3, } #pragma pop #endif - -/* ############################################################################################## */ -/* 803BA14C-803BA160 01726C 0010+04 0/0 4/4 0/0 .data __vt__18daPy_sightPacket_c */ -SECTION_DATA extern void* __vt__18daPy_sightPacket_c[4 + 1 /* padding */] = { - (void*)NULL /* RTTI */, - (void*)NULL, - (void*)draw__18daPy_sightPacket_cFv, - (void*)__dt__18daPy_sightPacket_cFv, - /* padding */ - NULL, -}; diff --git a/src/d/particle/d_particle.cpp b/src/d/particle/d_particle.cpp index f80e660d17c..befe696a0e4 100644 --- a/src/d/particle/d_particle.cpp +++ b/src/d/particle/d_particle.cpp @@ -626,7 +626,7 @@ void dPa_followEcallBack::end() { /* ############################################################################################## */ /* 80450E90-80450E94 000390 0004+00 2/2 1/1 11/11 .sbss mEcallback__18dPa_modelEcallBack */ -u8 dPa_modelEcallBack::mEcallback[4]; +dPa_modelEcallBack* dPa_modelEcallBack::mEcallback; /* 80450E94-80450E98 000394 0004+00 2/2 0/0 0/0 .sbss mPcallback__18dPa_modelEcallBack */ u8 dPa_modelEcallBack::mPcallback[4]; diff --git a/src/f_op/f_op_actor.cpp b/src/f_op/f_op_actor.cpp index 9b11dbe3a79..8da6d9f2dbb 100644 --- a/src/f_op/f_op_actor.cpp +++ b/src/f_op/f_op_actor.cpp @@ -15,17 +15,6 @@ #include "d/s/d_s_play.h" #include "d/d_demo.h" -// -// Types: -// - -struct fopEn_enemy_c { - /* 80019404 */ void initBallModel(); - /* 800194FC */ void checkBallModelDraw(); - /* 80019520 */ void setBallModelEffect(dKy_tevstr_c*); - /* 800196A0 */ void drawBallModel(dKy_tevstr_c*); -}; - // // Forward References: //