diff --git a/include/Camera.h b/include/Camera.h index 437aa1d31..0d70a3802 100644 --- a/include/Camera.h +++ b/include/Camera.h @@ -10,24 +10,30 @@ namespace Game { namespace P2JST { struct ObjectCamera; -} +} // namespace P2JST } // namespace Game namespace Sys { struct Sphere; +struct Cylinder; } // namespace Sys struct CullPlane : public ArrayContainer { + CullPlane(int); + bool isPointVisible(Vector3f&, float); + bool isVisible(Sys::Sphere&); + bool isCylinderVisible(Sys::Cylinder&); }; struct CullFrustum : public CullPlane { + CullFrustum(int); virtual ~CullFrustum(); // _00 virtual Matrixf* getViewMatrix(bool); // _40 virtual Vector3f getPosition(); // _44 virtual void updatePlanes(); // _48 - void getSideVector(); - void getUpVector(); - void getViewVector(); + Vector3f getSideVector(); + Vector3f getUpVector(); + Vector3f getViewVector(); float _28; // _28 float _2C; // _2C @@ -53,7 +59,7 @@ struct Camera : public CullFrustum { void calcScreenSize(Sys::Sphere&); void copyFrom(Camera*); float getFar(); - void getLookAtPosition(); + Vector3f getLookAtPosition(); float getNear(); void setFixNearFar(bool, float, float); void setProjection(); diff --git a/include/Game/GameSystem.h b/include/Game/GameSystem.h index 0413c6d9e..2727359d8 100644 --- a/include/Game/GameSystem.h +++ b/include/Game/GameSystem.h @@ -2,16 +2,26 @@ #define _GAME_GAMESYSTEM_H #include "types.h" +#include "CNode.h" +#include "ObjectMgr.h" struct Graphics; +struct JUTTexture; struct Viewport; -struct GenericObjectMgr; -template struct TObjectNode; - namespace Game { struct BaseGameSection; +struct TimeMgr; -struct GameSystem { +#pragma enumalwaysint on +enum GameSystemMode { + GSM_STORY_MODE = 0, + GSM_VERSUS_MODE, + GSM_ONE_PLAYER_CHALLENGE, + GSM_TWO_PLAYER_CHALLENGE, + GSM_PIKLOPEDIA +}; +#pragma enumalwaysint reset +struct GameSystem : public NodeObjectMgr { GameSystem(Game::BaseGameSection*); ~GameSystem(); @@ -46,9 +56,18 @@ struct GameSystem { void startFrame(); void startPause(bool, int, char*); - u8 _00[0x50]; // _00 - u32 m_frameTimer; // _50 - struct JUTTexture* m_xfbTexture; // _54 + u8 _3C; // _3C /* bitfield */ + TimeMgr* m_timeMgr; // _40 + GameSystemMode m_mode; // _44 + u8 m_isInCaveMaybe; // _48 + u8 _49; // _49 + bool m_isFrozen; // _4A + bool m_isPaused; // _4B + bool m_isPausedSoft; // _4C + bool m_isMoviePause; // _4D + u32 m_frameTimer; // _50 + JUTTexture* m_xfbTexture; // _54 + BaseGameSection* m_section; // _58 }; extern GameSystem* gameSystem; diff --git a/include/Game/GenericObjectMgr.h b/include/Game/GenericObjectMgr.h index c4aa8b348..129fb0322 100644 --- a/include/Game/GenericObjectMgr.h +++ b/include/Game/GenericObjectMgr.h @@ -2,8 +2,9 @@ #define _GAME_GENERICOBJECTMGR_H #include "types.h" -#include "Graphics.h" -#include "Viewport.h" + +struct Graphics; +struct Viewport; struct GenericObjectMgr { virtual void doAnimation(); diff --git a/include/Game/cellPyramid.h b/include/Game/cellPyramid.h index e130b7e27..7cb4b3799 100644 --- a/include/Game/cellPyramid.h +++ b/include/Game/cellPyramid.h @@ -43,6 +43,7 @@ struct CollisionBuffer { // TODO: Ensure this is aligned. struct CellLeg { + CellLeg(); CellLeg* m_next; // _00 CellLeg* m_prev; // _04 Cell* m_cell; // _08 diff --git a/include/Game/shadowMgr.h b/include/Game/shadowMgr.h new file mode 100644 index 000000000..f3a1fb049 --- /dev/null +++ b/include/Game/shadowMgr.h @@ -0,0 +1,123 @@ +#ifndef _GAME_SHADOWMGR_H +#define _GAME_SHADOWMGR_H + +#include "BaseParm.h" +#include "CNode.h" +#include "Color4.h" +#include "Parameters.h" +#include "Rect.h" +#include "Vector3.h" + +struct Camera; +struct Color4; +struct Matrixf; +struct Stream; +struct Viewport; + +namespace Game { +struct Creature; + +struct ShadowParam { + Vector3f m_position; // _00 + float _0C; // _0C + float _10; // _10 + float _14; // _14 + float m_height; // _18 + float m_radius; // _1C +}; + +// Size: 0x60 +struct ShadowParms : public Parameters { + Parm m_lodNear; // _0C + Parm m_lodFar; // _34 + void* m_end; // _5C +}; + +// Size: 0x20 +struct JointShadowRootNode : public CNode { + Creature* m_creature; // _18 + u8 _1C; // _1C +}; + +// Size: 0x24 +struct ShadowNode : public CNode { + Creature* m_creature; // _18 + u32 _1C; // _1C + uint _20; // _20 /* bitfield */ +}; + +struct CylinderBase { + CylinderBase(); + + virtual void setFilterTextureID(int); // _00 + virtual void drawInit(); // _04 + virtual void drawCylinder(Matrixf&, int); // _08 + virtual void drawFinish(); // _0C + + void setColor(Color4*); + void setCameraParms(Camera*, int); + void makeSRT(Matrixf&, ShadowParam&); + void getCylinderType(ShadowParam&, int); + void setupFillGX(); + void setupDrawCylinderGX(); + void setupFilterGX(); + void setOrthoProjection(); + void setOrthoCamera(); + void setScissorViewport(); + void fillShadowRect(); + void fillRectAlphaZero(); + void drawCylinderList(int); + + // VTBL _00 + void* m_displayListObj; // _04 + Color4* m_color; // _08 + ShadowParms* m_parms; // _0C + Rectf _10; // _10 + Vector3f _20[2]; // _20 + Vector3f _38[2]; // _38 + float _50; // _50 +}; + +struct ShadowCylinder2 : public CylinderBase { + u8 _54[8]; // _54 + void* _5C; // _5C + int _60; // _60 +}; + +struct ShadowCylinder3 : public CylinderBase { + u8 _54[4]; // _54 +}; + +// Size: 0x50 +struct ShadowMgr : public CNode { + virtual ~ShadowMgr(); // _00 + virtual int getChildCount(); // _04 + virtual void getSize(); // _08 + virtual void getMax(); // _0C + virtual void getCreature(int); // _10 + virtual void getFirst(); // _14 + virtual void getNext(int); // _18 + virtual void isDone(int); // _1C + virtual void write(Stream&); // _20 + virtual void read(Stream&); // _24 + + // CNode _00 + int _18; + int _1C; // _1C /* Sodium called this max? Unsure why. */ + ShadowNode* _20; + ShadowNode* _24; + ShadowCylinder2* _28; + ShadowCylinder3* _2C; + Viewport** m_viewports; + JointShadowRootNode* _34; + JointShadowRootNode* _38; + u8 _3C; + u8 _3D; + int _40; + int _44; + Color4 m_color; + ShadowParms* m_parms; +}; +} // namespace Game + +#endif diff --git a/include/Game/updateMgr.h b/include/Game/updateMgr.h new file mode 100644 index 000000000..05ec495df --- /dev/null +++ b/include/Game/updateMgr.h @@ -0,0 +1,29 @@ +#ifndef _GAME_UPDATEMGR_H +#define _GAME_UPDATEMGR_H + +#include "types.h" + +namespace Game { +struct UpdateMgr; + +struct UpdateContext { + UpdateContext(); + + void exit(); + void init(UpdateMgr*); + bool updatable(); + + UpdateMgr* _00; // _00 + s32 _04; // _04 + u8 _08; // _08 + u8 _09; // _09 +}; + +struct UpdateMgr { + bool updatable(UpdateContext*); +}; + +extern UpdateMgr* collisionUpdateMgr; +} // namespace Game + +#endif diff --git a/include/IDelegate.h b/include/IDelegate.h index 02228993f..0117d766c 100644 --- a/include/IDelegate.h +++ b/include/IDelegate.h @@ -1,12 +1,30 @@ #ifndef _IDELEGATE_H #define _IDELEGATE_H +#include "types.h" + template struct IDelegate1 { virtual void invoke(T); + + // VTBL _00 + T* m_object; // _04 + u32 _08; // _08 + u32 _0C; // _0C + // TODO: Proper typing. + void* m_function; // _10 }; template struct IDelegate3 { virtual void invoke(A, B, C); }; +template struct Delegate : public IDelegate1 { + virtual void invoke(T); +}; + +template +struct Delegate3 : public IDelegate3 { + virtual void invoke(A, B, C); +}; + #endif diff --git a/include/JSystem/J2D/J2DAnm.h b/include/JSystem/J2D/J2DAnm.h index 7d2ff6e0a..d839607b2 100644 --- a/include/JSystem/J2D/J2DAnm.h +++ b/include/JSystem/J2D/J2DAnm.h @@ -199,4 +199,8 @@ struct J2DAnmVtxColorKey : public J2DAnmVtxColor { short* _38; // _38 }; +struct J2DAnmLoaderDataBase { + static J2DAnmBase* load(void*); +}; + #endif diff --git a/include/JSystem/J2D/J2DGrafContext.h b/include/JSystem/J2D/J2DGrafContext.h index ce1dee97a..052b08c90 100644 --- a/include/JSystem/J2D/J2DGrafContext.h +++ b/include/JSystem/J2D/J2DGrafContext.h @@ -8,6 +8,8 @@ namespace JGeometry { template struct TBox2; typedef TBox2 TBox2f; +template struct TVec2; +typedef TVec2 TVec2f; } // namespace JGeometry // TODO: These matrix members wouldn't actually be Matrixf, because this is in a @@ -23,6 +25,14 @@ struct J2DGrafContext { virtual u32 getGrafType() const; // _18 virtual void setLookat(); // _1C + void drawFrame(const JGeometry::TBox2f&); + void fillBox(const JGeometry::TBox2f&); + void lineTo(JGeometry::TVec2f&); + void scissor(const JGeometry::TBox2f&); + void setColor(JUtility::TColor, JUtility::TColor, JUtility::TColor, + JUtility::TColor); + void setLineWidth(uchar); + // VTBL _00 float _04; // _04 float _08; // _08 diff --git a/include/JSystem/J2D/J2DPane.h b/include/JSystem/J2D/J2DPane.h index 92de4a24b..2d7dd0fe3 100644 --- a/include/JSystem/J2D/J2DPane.h +++ b/include/JSystem/J2D/J2DPane.h @@ -102,10 +102,14 @@ struct J2DPane { JGeometry::TBox2f* getBounds(); JGeometry::TVec3f getGlbVtx(uchar) const; void* getPointer(JSURandomInputStream*, ulong, JKRArchive*); + ulonglong getTagName() const; + float getTranslateX() const; + float getTranslateY() const; J2DPane* getFirstChildPane(); J2DPane* getNextChildPane(); J2DPane* getParentPane(); + JSUTree getPaneTree(); void initiate(); void initialize(J2DPane*, bool, ulonglong, const JGeometry::TBox2f&); @@ -167,12 +171,45 @@ struct J2DPane { }; struct J2DScreen : public J2DPane { - virtual ~J2DScreen(); + virtual ~J2DScreen(); // _00 + virtual void calcMtx(); // _24 + virtual void drawSelf(float, float, float (*)[3][4]); // _30 + virtual J2DPane* search(ulonglong); // _34 + virtual J2DPane* searchUserInfo(ulonglong); // _38 + virtual bool isUsed(const ResTIMG*); // _44 + virtual bool isUsed(const ResFONT*); // _48 + virtual void clearAnmTransform(); // _4C + virtual void setAnimation(J2DAnmBase*); // _54 + virtual void setAnimation(J2DAnmTransform*); // _58 + virtual void setAnimation(J2DAnmColor*); // _5C + virtual void setAnimation(J2DAnmTexPattern*); // _60 + virtual void setAnimation(J2DAnmTextureSRTKey*); // _64 + virtual void setAnimation(J2DAnmTevRegKey*); // _68 + virtual void setAnimation(J2DAnmVisibilityFull*); // _6C + virtual void setAnimation(J2DAnmVtxColor*); // _70 + virtual void setAnimationVF(J2DAnmVisibilityFull*); // _7C + virtual void setAnimationVC(J2DAnmVtxColor*); // _84 virtual void createPane(const J2DScrnBlockHeader&, JSURandomInputStream*, J2DPane*, ulong); // _8C virtual void createPane(const J2DScrnBlockHeader&, JSURandomInputStream*, J2DPane*, ulong, JKRArchive*); // _90 - virtual void _94() = 0; // _94 + // virtual void _94() = 0; // _94 + + void animation(); + bool checkSignature(JSURandomInputStream*); + void clean(); + bool createMaterial(JSURandomInputStream*, ulong, JKRArchive*); + void draw(float, float, const J2DGrafContext*); + u32 gather(J2DPane**, ulonglong, ulonglong, int); + J2DMaterial* getMaterial(ushort); + void* getResReference(JSURandomInputStream*, ulong); + bool getScreenInformation(JSURandomInputStream*); + u32 makeHierarchyPanes(J2DPane*, JSURandomInputStream*, ulong, JKRArchive*); + bool set(const char*, ulong, JKRArchive*); + bool set(JSURandomInputStream*, ulong); + bool private_set(JSURandomInputStream*, ulong, JKRArchive*); + + static void* getNameResource(char*); // J2DPane _000 bool _100; // _100 @@ -182,6 +219,8 @@ struct J2DScreen : public J2DPane { void* _10C; // _10C JUTNameTab* m_nameTab; // _110 int _114; // _114 + + static void* mDataManage; // unknown type }; // Size: 0x168 diff --git a/include/JSystem/J3D/J3DModel.h b/include/JSystem/J3D/J3DModel.h new file mode 100644 index 000000000..cf1ccd49a --- /dev/null +++ b/include/JSystem/J3D/J3DModel.h @@ -0,0 +1,46 @@ +#ifndef _JSYSTEM_J3D_J3DMODEL_H +#define _JSYSTEM_J3D_J3DMODEL_H + +#include "Dolphin/mtx.h" +#include "types.h" +#include "JSystem/J3D/J3DVertexBuffer.h" +#include "JSystem/JGeometry.h" + +struct J3DDeformData; +struct J3DMatPacket; +struct J3DModelData; +struct J3DMtxBuffer; +struct J3DShapePacket; +struct J3DSkinDeform; +struct J3DVtxColorCalc; + +struct J3DModel : public J3DVertexBuffer { + virtual void update(); // _00 + virtual void entry(); // _04 + virtual void calc(); // _08 + virtual void calcMaterial(); // _0C + virtual void calcDiffTexMtx(); // _10 + virtual void viewCalc(); // _14 + virtual ~J3DModel(); // _18 + + // _00 VTBL + J3DModelData* m_modelData; // _04 + uint _08; // _08 /* bitfield of some sort */ + u32 m_displayListFlag; // _0C + void* _10; // _10 + u32 _14; // _14 + JGeometry::TVec3f m_modelScale; // _18 + PSMatrix _24; // _24 + PSMatrix _54; // _54 + J3DMtxBuffer* m_mtxBuffer; // _84 + J3DVertexBuffer m_vertexBuffer; // _88 + J3DMatPacket* m_matPackets; // _C0 + J3DShapePacket* m_shapePackets; // _C4 + J3DDeformData* m_deformData; // _C8 + J3DSkinDeform* m_skinDeform; // _CC + J3DVtxColorCalc* m_vtxColorCalc; // _D0 + u32 _D4; // _D4 + void* _D8; // _D8 +}; + +#endif diff --git a/include/JSystem/J3D/J3DSys.h b/include/JSystem/J3D/J3DSys.h new file mode 100644 index 000000000..03d94e380 --- /dev/null +++ b/include/JSystem/J3D/J3DSys.h @@ -0,0 +1,60 @@ +#ifndef _JSYSTEM_J3D_J3DSYS_H +#define _JSYSTEM_J3D_J3DSYS_H + +#include "Dolphin/mtx.h" +#include "JSystem/JGeometry.h" +#include "types.h" + +struct J3DDrawBuffer; +struct J3DMatPacket; +struct J3DModel; +struct J3DMtxCalc; +struct J3DShapePacket; +struct J3DTexture; + +struct J3DSys { + J3DSys(); + void drawInit(); + void reinitGX(); + static void reinitGenMode(); + static void reinitIndStages(); + static void reinitLighting(); + static void reinitPixelProc(); + static void reinitTexture(); + static void reinitTevStages(); + static void reinitTransform(); + + PSMatrix44 _00; // _000 + J3DMtxCalc* m_mtxCalc; // _030 + uint _34; // _034 /* bitfield */ + J3DModel* _38; // _038 + J3DMatPacket* m_matPacket; // _03C + J3DShapePacket* m_shapePacket; // _040 + u32 _44; // _044 + J3DDrawBuffer* _48; // _048 + J3DDrawBuffer* _4C; // _04C + int _50; // _050 + u32 _54; // _054 + J3DTexture* _58; // _058 + u8 _5C[4]; // _05C + uint _60; // _060 + u8 _64[0xA0]; // _064 + PSMatrix44* _104; // _104 + PSMatrix* _108; // _108 + /* + * These might be part of a J3DVertexBuffer. + * See setArray__15J3DVertexBufferCFv. + */ + u32 _10C; // _10C + u32 _110; // _110 + uint _114; // _114 /* bitfield */ + + static PSMatrix44 mCurrentMtx; + static JGeometry::TVec3f mCurrentS; + static JGeometry::TVec3f mParentS; + static ushort sTexCoordScaleTable[32]; +}; + +extern J3DSys j3dSys; + +#endif diff --git a/include/JSystem/J3D/J3DVertexBuffer.h b/include/JSystem/J3D/J3DVertexBuffer.h new file mode 100644 index 000000000..1153bf1fc --- /dev/null +++ b/include/JSystem/J3D/J3DVertexBuffer.h @@ -0,0 +1,10 @@ +#ifndef _JSYSTEM_J3D_J3DVERTEXBUFFER_H +#define _JSYSTEM_J3D_J3DVERTEXBUFFER_H + +#include "types.h" + +struct J3DVertexBuffer { + u8 _00[0x38]; +}; + +#endif diff --git a/include/JSystem/JKR/JKRArchive.h b/include/JSystem/JKR/JKRArchive.h index 57d6fa1f5..fe3bb9307 100644 --- a/include/JSystem/JKR/JKRArchive.h +++ b/include/JSystem/JKR/JKRArchive.h @@ -1,16 +1,10 @@ #ifndef _JSYSTEM_JKR_JKRARCHIVE_H #define _JSYSTEM_JKR_JKRARCHIVE_H +#include "JSystem/JKR/JKRFileLoader.h" #include "JSystem/JKR/JKRHeap.h" #include "types.h" -struct JKRFileLoader { - virtual ~JKRFileLoader() = 0; // _00 - virtual void unmount() = 0; // _04 - - // _00 VTBL -}; - struct JKRArchive : public JKRFileLoader { enum EMountMode { EMM_Unk0 = 0, EMM_Unk1, EMM_Unk2 }; enum EMountDirection { EMD_Unk0 = 0, EMD_Unk1, EMD_Unk2 }; diff --git a/include/JSystem/JKR/JKRFileLoader.h b/include/JSystem/JKR/JKRFileLoader.h index a535c818d..5e71b74c4 100644 --- a/include/JSystem/JKR/JKRFileLoader.h +++ b/include/JSystem/JKR/JKRFileLoader.h @@ -2,9 +2,9 @@ #define _JSYSTEM_JKR_JKRFILELOADER_H #include "JSystem/JKR/JKRHeap.h" -#include "JSystem/JKR/JKRArchive.h" #include "JSystem/JSU/JSUPtrLink.h" +struct JKRArchive; struct JKRFileLoader : public JKRDisposer { JKRFileLoader(); virtual ~JKRFileLoader(); diff --git a/include/JSystem/JKR/JKRHeap.h b/include/JSystem/JKR/JKRHeap.h index a3aa87f99..be187056e 100644 --- a/include/JSystem/JKR/JKRHeap.h +++ b/include/JSystem/JKR/JKRHeap.h @@ -121,6 +121,82 @@ struct JKRHeap : public JKRDisposer { static u32 mMemorySize; }; +struct JKRExpHeap : public JKRHeap { + struct CMemBlock { + ushort m_usageHeader; // _00 + + /// This &'d with 0x7f is called "aln" by JKRExpHeap::dump + uchar _02; // _02 + + /// Called "gid" by JKRExpHeap::dump + uchar m_groupID; // _03 + + /// Called "size" by JKRExpHeap::dump + ulong m_allocatedSpace; // _04 + + /* + * Called "prev_ptr" by JKRExpHeap::dump. + * Sodium called this "headwards". + */ + CMemBlock* m_prevPtr; // _08 + + /* + * Called "next_ptr" by JKRExpHeap::dump. + * Sodium called this "tailwards". + */ + CMemBlock* m_nextPtr; // _0C + + u32 allocBack(ulong, uchar, uchar, uchar, uchar); + u32 allocFore(ulong, uchar, uchar, uchar, uchar); + void free(JKRExpHeap*); + static u32 getHeapBlock(void*); + void initiate(CMemBlock*, CMemBlock*, ulong, uchar, uchar); + }; + + JKRExpHeap(void*, ulong, JKRHeap*, bool); + + virtual ~JKRExpHeap(); // _00 + virtual u32 getHeapType(); // _08 + virtual bool check(); // _0C + virtual bool dump_sort(); // _10 + virtual bool dump(); // _14 + virtual void do_destroy(); // _18 + virtual void* do_alloc(ulong, int); // _1C + virtual void do_free(void*); // _20 + virtual void do_freeAll(); // _24 + virtual void do_freeTail(); // _28 + virtual void do_fillFreeArea(); // _2C + virtual int do_resize(void*, ulong); // _30 + virtual int do_getSize(void*); // _34 + virtual ulong do_getFreeSize(); // _38 + virtual void* do_getMaxFreeBlock(); // _3C + virtual ulong do_getTotalFreeSize(); // _40 + virtual uchar do_changeGroupID(uchar); // _44 + virtual uchar do_getCurrentGroupId(); // _48 + + u32 allocFromHead(ulong, int); + u32 allocFromHead(ulong); + u32 allocFromTail(ulong, int); + u32 allocFromTail(ulong); + u32 appendUsedList(CMemBlock*); + static JKRExpHeap* create(ulong, JKRHeap*, bool); + static JKRExpHeap* createRoot(int, bool); + int freeGroup(uchar); + void joinTwoBlocks(CMemBlock*); + void recycleFreeBlock(CMemBlock*); + void removeFreeBlock(CMemBlock*); + void setFreeBlock(CMemBlock*, CMemBlock*, CMemBlock*); + + u8 _6C; // _6C + u8 m_currentGroupID; // _6D + u8 _6E; // _6E + u8 _70[8]; // _70 + CMemBlock* m_head; // _78 + CMemBlock* m_tail; // _7C + CMemBlock* m_headUsedList; // _80 + CMemBlock* m_tailUsedList; // _84 +}; + void JKRDefaultMemoryErrorRoutine(void*, ulong, int); void* operator new(size_t, JKRHeap*, int); diff --git a/include/JSystem/JUT/JUTException.h b/include/JSystem/JUT/JUTException.h index 710c3dcfd..e02970d84 100644 --- a/include/JSystem/JUT/JUTException.h +++ b/include/JSystem/JUT/JUTException.h @@ -28,9 +28,9 @@ struct JUTException { JUTException::panic_f(__FILE__, line, __VA_ARGS__) #endif -#define JUT_ASSERTLINE(line, cond, string_ref) \ - if (!(cond)) \ - JUT_PANICLINE(line, string_ref) +#define JUT_ASSERTLINE(line, cond, ...) \ + if (!(cond)) \ + JUT_PANICLINE(line, __VA_ARGS__) #define P2ASSERTLINE(line, cond) JUT_ASSERTLINE(line, cond, "P2Assert") diff --git a/include/JSystem/JUT/JUTNameTab.h b/include/JSystem/JUT/JUTNameTab.h index 4e556c041..33eb59e2f 100644 --- a/include/JSystem/JUT/JUTNameTab.h +++ b/include/JSystem/JUT/JUTNameTab.h @@ -7,9 +7,18 @@ struct ResNTAB; // Size: 0x10 struct JUTNameTab { + JUTNameTab(); + JUTNameTab(const ResNTAB*); + JUTNameTab(const JUTNameTab&); + virtual ~JUTNameTab(); // _00 // virtual void _04() = 0; // _04 + void calcKeyCode(const char*) const; + void getIndex(const char*) const; + char* getName(ushort) const; + void setResource(const ResNTAB*); + // _00 VTBL ResNTAB* m_resource; // _04 u32 _08; // _08 diff --git a/include/P2DScreen.h b/include/P2DScreen.h new file mode 100644 index 000000000..b1803530b --- /dev/null +++ b/include/P2DScreen.h @@ -0,0 +1,55 @@ +#ifndef _P2DSCREEN_H +#define _P2DSCREEN_H + +#include "JSystem/J2D/J2DPane.h" +#include "types.h" +#include "CNode.h" + +struct Graphics; + +namespace P2DScreen { +struct Node : public CNode { + virtual ~Node(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + virtual void doInit(); // _10 + + J2DPane* _18; // _18 +}; + +struct CallBackNode : public Node { + virtual ~CallBackNode(); // _00 + virtual void update(); // _08 +}; + +// Size: 0x138 +struct Mgr : public J2DScreen { + Mgr(); + + virtual ~Mgr(); // _00 + virtual void update(); // _28 + virtual void draw(Graphics&, J2DGrafContext&); // _94 + + J2DPane* addCallBack(ulonglong, Node*); + void addCallBackPane(J2DPane*, Node*); + + Node _118; // _118 + u32 _130; // _130 + u8 _134[4]; // _134 +}; + +// Size: 0x148 +struct Mgr_tuning : public Mgr { + Mgr_tuning(); + + virtual ~Mgr_tuning(); // _00 + virtual void draw(Graphics&, J2DGrafContext&); // _94 + + float m_widthMaybe; // _138 + float m_heightMaybe; // _13C + float m_someX; // _140 + float m_someY; // _144 +}; +} // namespace P2DScreen + +#endif diff --git a/include/Screen/Bases.h b/include/Screen/Bases.h new file mode 100644 index 000000000..3d9312de9 --- /dev/null +++ b/include/Screen/Bases.h @@ -0,0 +1,111 @@ +#ifndef _SCREEN_BASES_H +#define _SCREEN_BASES_H + +#include "Dolphin/gx.h" +#include "JSystem/JKR/JKRDisposer.h" +#include "Screen/Enums.h" +#include "types.h" +#include "CNode.h" + +struct Graphics; +struct JKRArchive; + +namespace og { +namespace Screen { + struct DispMemberBase; +} // namespace Screen +} // namespace og + +namespace Resource { +struct MgrCommand; +} // namespace Resource + +namespace Screen { + +struct SceneArg { + virtual SceneType getSceneType(); // _00 + virtual int getClassSize(); // _04 +}; + +struct StartSceneArg : public SceneArg { + float _04; // _04 +}; + +struct SetSceneArg : public SceneArg { + SceneType m_sceneType; // _04 + u8 _08; // _08 + u8 _09; // _09 + og::Screen::DispMemberBase* m_dispMember; // _0C +}; + +struct EndSceneArg : public SceneArg { + u8 _04; // _04 +}; + +struct SceneBase { + virtual SceneType getSceneType() = 0; // _00 + virtual uint getOwnerID() = 0; // _04 + virtual ulonglong getMemberID() = 0; // _08 + virtual bool isUseBackupSceneInfo(); // _0C + virtual bool isDrawInDemo() const; // _10 + virtual char* getResName() = 0; // _14 + virtual void doCreateObj() = 0; // _18 + virtual void doUserCallBackFunc(Resource::MgrCommand*); // _1C + virtual void setPort(Graphics&); // _20 + virtual void doUpdateActive(); // _24 + virtual bool doConfirmSetScene(SetSceneArg&); // _28 + virtual bool doConfirmStartScene(StartSceneArg*); // _2C + virtual bool doConfirmEndScene(EndSceneArg*&); // _30 + virtual bool doStart(StartSceneArg*); // _34 + virtual bool doEnd(EndSceneArg*); // _38 + virtual bool setDefaultDispMember(); // _3C + virtual void doSetBackupScene(SetSceneArg&); // _40 + virtual int doGetFinishState(); // _44 +}; + +struct IObjBase : public CNode, JKRDisposer { + // VTBL 2 + virtual ~IObjBase(); // _00 + virtual bool update() = 0; // _04 + virtual void draw(Graphics&) = 0; // _08 + virtual bool start(const StartSceneArg*) = 0; // _0C + virtual bool end(const EndSceneArg*) = 0; // _10 + virtual void setOwner(SceneBase*) = 0; // _14 + virtual SceneBase* getOwner() const = 0; // _18 + virtual void create(JKRArchive&) = 0; // _1C +}; + +struct ObjBase : public IObjBase { + ObjBase(); + virtual bool update(); // _04 + virtual void draw(Graphics&); // _08 + virtual bool start(const StartSceneArg*); // _0C + virtual bool end(const EndSceneArg*); // _10 + virtual void setOwner(SceneBase*); // _14 + virtual SceneBase* getOwner() const; // _18 + virtual void create(JKRArchive&); // _1C + virtual void confirmSetScene(SetSceneArg&); // _20 + virtual void confirmStartScene(StartSceneArg*); // _24 + virtual void confirmEndScene(EndSceneArg*); // _28 + virtual bool doStart(const StartSceneArg*); // _2C + virtual bool doEnd(const EndSceneArg*); // _30 + virtual void doCreate(JKRArchive*); // _34 + virtual bool doUpdateFadein(); // _38 + virtual void doUpdateFadeinFinish(); // _3C + virtual bool doUpdate(); // _40 + virtual void doUpdateFinish(); // _44 + virtual bool doUpdateFadeout(); // _48 + virtual void doUpdateFadeoutFinish(); // _4C + virtual void doDraw(Graphics&); // _50 + virtual bool doConfirmSetScene(SetSceneArg&); // _54 + virtual bool doConfirmStartScene(StartSceneArg*); // _58 + virtual bool doConfirmEndScene(EndSceneArg*&); // _5C + + og::Screen::DispMemberBase* getDispMember(); + + int _30; // _30 + SceneBase* m_owner; // _34 +}; +} // namespace Screen + +#endif diff --git a/include/Screen/Enums.h b/include/Screen/Enums.h new file mode 100644 index 000000000..9c6f1d45e --- /dev/null +++ b/include/Screen/Enums.h @@ -0,0 +1,78 @@ +#ifndef _SCREEN_ENUMS_H +#define _SCREEN_ENUMS_H + +#include "types.h" + +enum SceneType { + SCENE_GROUND = 0x2710, + SCENE_CAVE, + SCENE_VS, + SCENE_FLOOR, + SCENE_2714, + SCENE_2715, + SCENE_2716, + SCENE_2717, + SCENE_2718, + SCENE_UFO_MENU, + SCENE_271A, + SCENE_PAUSE_MENU_DOUKUTU, + SCENE_PAUSE_MENU_ITEMS, + SCENE_PAUSE_MENU_MAP, + SCENE_COURSE_NAME, + SCENE_CAVE_IN_MENU, + SCENE_KANKETU_MENU, + SCENE_CAVE_MORE_MENU, + SCENE_KANTEI_DEMO, + SCENE_SPECIAL_ITEM, + SCENE_CHALLENGE_2P, + SCENE_SAVE, + SCENE_FINAL_MSG, + SCENE_CHALLENGE_1P, + SCENE_PAUSE_MENU_VS, + SCENE_WORLD_MAP_INFO_WINDOW_0, + SCENE_WORLD_MAP_INFO_WINDOW_1, + SCENE_PAUSE_MENU_CONTROLS, + SCENE_COUNT_DOWN, + SCENE_HURRY_UP, + SCENE_GAME_OVER_GENERAL, + SCENE_ORIMA_DOWN, + SCENE_LUJI_DOWN, + SCENE_PRESIDENT_DOWN, + SCENE_PIKMIN_DOWN, + SCENE_ZUKAN_ENEMY, + SCENE_ZUKAN_ITEM, + SCENE_HIGH_SCORE, + SCENE_CHALLENGE_SELECT, + SCENE_CHALLENGE_RESULT, + SCENE_VS_SELECT, + SCENE_CAVE_RESULT = 0x4E20, + SCENE_READY_GO, + SCENE_FINAL_FLOOR, + SCENE_DAY_END_RESULT_ITEM, + SCENE_DAY_END_RESULT_INC_P, + SCENE_DAY_END_RESULT_MAIL, + SCENE_FINAL_RESULT, + SCENE_PAY_DEPT, + SCENE_WIN_LOSE, + SCENE_WIN_LOSE_REASON, + SCENE_DAY_END_RESULT_TITL, + _SCENE_FORCE_UINT = 0xFFFFFFFF +}; + +// Responsible developer. +enum ScreenOwnerID { OWNER_KH = 'KH', OWNER_OGA = 'OGA', OWNER_MRMR = 'MRMR' }; + +// 8-byte screen ID +#pragma enumsalwaysint off +#pragma longlong_enums on +enum ScreenMemberID { + // MEMBER_FLOOR = (ulonglong)0xFFFFFFFFFFFFFFFE, + // MEMBER_DUMMY = 0xFFFFFFFFFFFFFFFF + MEMBER_FLOOR = 'FLOOR', + MEMBER_DUMMY = 'DUMMY', + _MEMBER_FORCE_ULONGLONG = 0xFFFFFFFFFFFFFFF +}; +#pragma longlong_enums reset +#pragma enumsalwaysint reset + +#endif diff --git a/include/SoundID.h b/include/SoundID.h index 95341eccd..0ead0d59c 100644 --- a/include/SoundID.h +++ b/include/SoundID.h @@ -473,7 +473,8 @@ enum SoundID { PSSE_SY_ZUKAN_SCRIPT_LOUIE = 6199, PSSE_SY_ZUKAN_SCRIPT_ORIMA = 6198, PSSE_SY_ZUKAN_SCRIPT_POD = 6200, - dropItem = 22544 + dropItem = 22544, + _PSSE_FORCE_UINT = 0xFFFFFFFF }; #endif diff --git a/include/StateMachine.h b/include/StateMachine.h new file mode 100644 index 000000000..79f294a8f --- /dev/null +++ b/include/StateMachine.h @@ -0,0 +1,49 @@ +#ifndef _STATEMACHINE_H +#define _STATEMACHINE_H + +#include "types.h" + +template struct StateMachine; + +struct StateArg { +}; + +template struct FSMState { + virtual void init(T*, StateArg*) = 0; // _00 + virtual void exec(T*) = 0; // _04 + virtual void cleanup(T*) = 0; // _08 + virtual void resume(T*) = 0; // _0C + virtual void restart(T*) = 0; // _10 + virtual void transit(T*, StateArg*) = 0; // _14 + + // VTBL _00 + int m_id; // _04 + StateMachine* m_stateMachine; // _08 +}; + +template struct StateMachine { + virtual void init(T*) = 0; // _00 + virtual u32 start(T*, int, StateArg*) = 0; // _04 + virtual void exec(T*) = 0; // _08 + virtual void transit(T*, int, StateArg*) = 0; // _0C + + // VTBL _00 + FSMState** m_states; // _04 + + // Count of registered states. + int m_count; // _08 + + // Maximum number of states that can be registered. + int m_limit; // _0C + + // Array of state IDs, indexed by their index in m_states. + int* m_indexToIDArray; // _10 + + // Array of state indices in m_states, indexed by their state ID. + int* m_idToIndexArray; // _14 + + // ID of current (active) state. + int m_currentID; // _18 +}; + +#endif diff --git a/include/SysShape/Model.h b/include/SysShape/Model.h index 6fd9ecc8e..44ada20f8 100644 --- a/include/SysShape/Model.h +++ b/include/SysShape/Model.h @@ -1,8 +1,11 @@ #ifndef _SYSSHAPE_MODEL_H #define _SYSSHAPE_MODEL_H +#include "types.h" #include "SysShape/MtxObject.h" +struct J3DModel; +struct Matrixf; namespace Sys { struct Sphere; } // namespace Sys @@ -13,6 +16,17 @@ struct Joint; struct Model : MtxObject { Model(struct J3DModelData*, unsigned long, unsigned long); + virtual Matrixf* getMatrix(); // _00 + virtual bool isModel(); // _04 + virtual bool isVisible(Sys::Sphere&); // _08 + virtual bool isVisible(); // _0C + virtual void hide(); // _10 + virtual void show(); // _14 + virtual void hidePackets(); // _18 + virtual void showPackets(); // _1C + virtual void jointVisible(bool, int); // _20 + virtual void jointVisible(bool, SysShape::Joint*); // _24 + void clearAnimatorAll(); void enableMaterialAnim(int); void enableMaterialAnim(J3DModelData*, int); @@ -21,22 +35,21 @@ struct Model : MtxObject { void getMatrix(int); void getRoughBoundingRadius(); void getRoughCenter(); - void hide(); - void hidePackets(); void initJoints(); void initJointsRec(int, SysShape::Joint*); - void isModel(); void isMtxImmediate(); - void isVisible(); - void isVisible(Sys::Sphere&); - void jointVisible(bool, int); - void jointVisible(bool, SysShape::Joint*); void setCurrentViewNo(unsigned long); void setViewCalcModeImm(); void setViewCalcModeInd(); - void show(); - void showPackets(); void viewCalc(); + + // VTBL _00 + u8 _04; // _04 + u8 _05; // _05 + bool m_isVisible; // _06 + J3DModel* m_j3dModel; // _08 + int m_jointCount; // _0C + Joint* m_joints; // _10 }; } // namespace SysShape diff --git a/include/SysShape/MtxObject.h b/include/SysShape/MtxObject.h index b7f55372b..671f713fc 100644 --- a/include/SysShape/MtxObject.h +++ b/include/SysShape/MtxObject.h @@ -1,8 +1,11 @@ #ifndef _SYSSHAPE_MTXOBJECT_H #define _SYSSHAPE_MTXOBJECT_H +struct Matrixf; namespace SysShape { struct MtxObject { + virtual Matrixf* getMatrix() = 0; // _00 + virtual bool isModel(); // _04 }; } // namespace SysShape diff --git a/include/TParticle2dMgr.h b/include/TParticle2dMgr.h new file mode 100644 index 000000000..f9961a205 --- /dev/null +++ b/include/TParticle2dMgr.h @@ -0,0 +1,48 @@ +#ifndef _TPARTICLE2DMGR_H +#define _TPARTICLE2DMGR_H + +#include "types.h" +#include "CNode.h" +#include "JSystem/JKR/JKRDisposer.h" +#include "Vector2.h" + +struct JPABaseEmitter; +struct JPAEmitterManager; +struct JPAResourceManager; +struct JKRSolidHeap; + +struct TParticle2dMgr : public CNode, JKRDisposer { + TParticle2dMgr(); + virtual ~TParticle2dMgr(); + + static void globalInstance(); + static TParticle2dMgr* Instance(); + static void deleteInstance(); + + void clearSceneEmitterAndResourceManager(); + void clearSceneResourceManager(); + JPABaseEmitter* create(ushort, Vector2f&, uchar, uchar); + void createHeap(ulong); + void createMgr(char*, ulong, ulong, ulong); + void draw(uchar, ushort); + void fade(JPABaseEmitter*); + void kill(JPABaseEmitter*); + void killAll(); + void killGroup(uchar); + void setSceneEmitterAndResourceManager(JPAEmitterManager*, + JPAResourceManager*); + void setSceneResourceManager(JPAResourceManager*); + void update(); + + JPAEmitterManager* _30; // _30 + JPAResourceManager* m_resourceManager; // _34 + JKRSolidHeap* m_solidHeap; // _38 + JPAEmitterManager* _3C; // _3C + u8 _40[4]; // _40 + + static TParticle2dMgr* _instance; +}; + +extern TParticle2dMgr* particle2dMgr; + +#endif diff --git a/include/Viewport.h b/include/Viewport.h index fd58c491a..ae30ecb3d 100644 --- a/include/Viewport.h +++ b/include/Viewport.h @@ -4,18 +4,24 @@ #include "Rect.h" #include "types.h" +struct J2DGrafContext; +struct J2DOrthoGraph; + struct Viewport { Viewport(); ~Viewport(); + void draw2dframe(J2DGrafContext&); + void getAspect(); void getMatrix(bool); void refresh(); void setJ3DViewMtx(bool); + void setOrthoGraph2d(J2DOrthoGraph&); void setProjection(); void setRect(Rectf&); void setViewport(); void updateCameraAspect(); - void viewable(); + bool viewable(); Viewport* m_list; // _00 int* _04; // _04 diff --git a/include/og/Floor.h b/include/og/Floor.h new file mode 100644 index 000000000..73526e986 --- /dev/null +++ b/include/og/Floor.h @@ -0,0 +1,152 @@ +#ifndef _OG_FLOOR_H +#define _OG_FLOOR_H + +#include "JSystem/J2D/J2DPane.h" +#include "JSystem/JUtility.h" +#include "types.h" +#include "Screen/Bases.h" +#include "og/Screen/ogScreen.h" + +struct Graphics; +struct JKRArchive; +struct J2DPane; + +namespace P2DScreen { +struct Mgr_tuning; +} + +namespace og { +namespace Screen { + struct AnimGroup; + struct AlphaMgr; + struct CallBack_CounterRV; + + // Size: 0x14 + struct DispMemberFloor : public DispMemberBase { + virtual uint getSize(); // _00 + virtual ulong getOwnerID(); // _04 + virtual ulonglong getMemberID(); // _08 + + int _08; // _08 + int m_caveID; // _0C + u8 _10; // _10 + u8 _11; // _11 + u8 _12; // _12 + }; + +} // namespace Screen + +namespace newScreen { + struct TitleMsg; + + // Size: 0x220 + struct Floor : public ::Screen::SceneBase { + virtual SceneType getSceneType(); // _00 + virtual uint getOwnerID(); // _04 + virtual ulonglong getMemberID(); // _08 + virtual bool isUseBackupSceneInfo(); // _0C + virtual bool isDrawInDemo() const; // _10 + virtual void getResName() const; // _14 + virtual void doCreateObj(JKRArchive*); // _18 + virtual void doUserCallBackFunc(Resource::MgrCommand*); // _1C + virtual void setPort(Graphics&); // _20 + virtual void doUpdateActive(); // _24 + virtual bool doConfirmSetScene(::Screen::SetSceneArg&); // _28 + virtual bool doConfirmStartScene(::Screen::StartSceneArg*); // _2C + virtual bool doConfirmEndScene(::Screen::EndSceneArg*&); // _30 + virtual bool doStart(::Screen::StartSceneArg*); // _34 + virtual bool doEnd(::Screen::EndSceneArg*); // _38 + virtual bool setDefaultDispMember(); // _3C + virtual void doSetBackupScene(::Screen::SetSceneArg&); // _40 + virtual int doGetFinishState(); // _44 + }; + + // Size: 0xBC + struct ObjFloor : public ::Screen::ObjBase { + ObjFloor(char const*); + virtual void doCreate(JKRArchive*); + + virtual ~ObjFloor(); // _00 + virtual bool doStart(const ::Screen::StartSceneArg*); // _2C + virtual bool doEnd(const ::Screen::EndSceneArg*); // _30 + virtual bool doUpdateFadein(); // _38 + virtual void doUpdateFadeinFinish(); // _3C + virtual bool doUpdate(); // _40 + virtual void doUpdateFinish(); // _44 + virtual bool doUpdateFadeout(); // _48 + virtual void doUpdateFadeoutFinish(); // _4C + virtual void doDraw(Graphics&); // _50 + + bool isFLOOR(); + bool isCHALLENGE(); + bool isVS(); + void setCaveMsgID(ulong, char*); + bool commonUpdate(); + void drawBG(Graphics&); + + Screen::DispMemberBase* m_dispMember; // _38 + char m_textTag[8]; // _3C + u8 _44[4]; // _44 + P2DScreen::Mgr_tuning* _48; // _48 + P2DScreen::Mgr_tuning* _4C; // _4C + P2DScreen::Mgr_tuning* _50; // _50 + og::Screen::CallBack_CounterRV* _54; // _54 + float _58; // _58 + float _5C; // _5C + float _60; // _60 + u8 _64; // _64 + JUtility::TColor _68; // _68 + u8 _6C; // _6C + float _70; // _70 + TitleMsg* _74; // _74 + TitleMsg* _78; // _78 + J2DPane* _7C; // _7C + float _80; // _80 + float _84; // _84 + og::Screen::AnimGroup* _88; // _88 + J2DPane* m_rulePane; // _8C + J2DPane* _90[6]; // _90 + u8 _A8; // _A8 + J2DPane* m_buttonPane; // _AC + J2DPane* m_loadingPane; // _B0 + og::Screen::AlphaMgr* m_alphaMgr; // _B4 + float _B8; // _B8 + + static struct StaticValues { + inline StaticValues(); + float _00; // _00 + float _04; // _04 + float _08; // _08 + float _0C; // _0C + float _10; // _10 + float _14; // _14 + float _18; // _18 + float _1C; // _1C + float _20; // _20 + float _24; // _24 + float _28; // _28 + float _2C; // _2C + float _30; // _30 + float _34; // _34 + float _38; // _38 + float _3C; // _3C + float _40; // _40 + float _44; // _44 + float _48; // _48 + float _4C; // _4C + float _50; // _50 + float _54; // _54 + float _58; // _58 + JUtility::TColor _5C[3]; // _5C + JUtility::TColor _68[3]; // _68 + int m_ruleMsgIndex; // _74 + u8 _78; // _78 + bool m_shouldNotRandomizeRuleMsgMaybe; // _79 + } msVal; + }; + + extern const ulonglong vsRuleMsgId[6]; +} // namespace newScreen +} // namespace og + +#endif diff --git a/include/og/Screen/AlphaMgr.h b/include/og/Screen/AlphaMgr.h new file mode 100644 index 000000000..0dc07ba07 --- /dev/null +++ b/include/og/Screen/AlphaMgr.h @@ -0,0 +1,27 @@ +#ifndef _OG_SCREEN_ALPHAMGR_H +#define _OG_SCREEN_ALPHAMGR_H + +#include "types.h" + +namespace og { +namespace Screen { + // Size: 0x18 + struct AlphaMgr { + AlphaMgr(); + void setBlinkArea(float, float); + void in(float); + void out(float); + void blink(float); + uchar calc(); + + int _00; // _00 + float _04; // _04 + float _08; // _08 + float _0C; // _0C + float _10; // _10 + float _14; // _14 + }; +} // namespace Screen +} // namespace og + +#endif diff --git a/include/og/Screen/anime.h b/include/og/Screen/anime.h new file mode 100644 index 000000000..254f252f5 --- /dev/null +++ b/include/og/Screen/anime.h @@ -0,0 +1,101 @@ +#ifndef _OG_SCREEN_ANIME_H +#define _OG_SCREEN_ANIME_H + +#include "Screen/Bases.h" +#include "types.h" + +struct J2DAnmBase; +struct J2DPane; +struct J2DScreen; + +namespace og { +namespace Screen { + struct AnimBaseBase { + AnimBaseBase(); + virtual void start() = 0; // _00 + virtual void moveAnim() = 0; // _04 + + void init(JKRArchive*, char*); + void setArea(float, float); + void setAllArea(); + void start(float); + bool update(); + bool updateSub(); + + // VTBL _00 + /* set to 1 by AnimScreen(), 2 by AnimPane() */ + int _04; // _04 + bool _08; // _08 + float _0C; // _0C + u8 _10; // _10 + uchar _11; // _11 /* alpha of pane/screen? */ + u8 _12; // _12 + J2DAnmBase* m_anm; // _14 + float m_frame; // _18 + float m_lastFrame; // _1C + float _20; // _20 /* speed */ + float _24; // _24 + float _28; // _28 + float _2C; // _2C + float _30; // _30 + float _34; // _34 + bool _38; // _38 + bool _39; // _39 + char* m_resourcePath; // _3C + }; + + struct AnimScreen : public AnimBaseBase { + AnimScreen(); + virtual void start(); // _00 + virtual void moveAnim(); // _04 + + void init(JKRArchive*, J2DScreen*, char*); + + J2DScreen* m_screen; // _40 + }; + + struct AnimPane : public AnimBaseBase { + AnimPane(); + virtual void start(); // _00 + virtual void moveAnim(); // _04 + + void init(JKRArchive*, J2DScreen*, ulonglong, char*); + + J2DPane* m_pane; + }; + + struct AnimGroup { + AnimGroup(int); + float getFrame(); + float getLastFrame(); + void reservAnim(float, float, float); + void setAllArea(); + void setAlpha(uchar); + void setAnim(AnimBaseBase*); + void setArea(float, float); + void setFrame(float); + void setRepeat(bool); + void setSpeed(float); + void start(); + bool update(); + + AnimBaseBase** m_animPanes; // _00 + int m_paneCount; // _04 + int m_paneLimit; // _08 + u8 _0C; // _0C + float _10; // _10 + float _14; // _14 + float _18; // _18 + }; + + struct AnimList { + AnimList(ushort); + void addAnim(AnimScreen*); + void nextAnim(float); + void start(); + void update(); + }; +} // namespace Screen +} // namespace og + +#endif diff --git a/include/og/Screen/callbackNodes.h b/include/og/Screen/callbackNodes.h new file mode 100644 index 000000000..278f48d97 --- /dev/null +++ b/include/og/Screen/callbackNodes.h @@ -0,0 +1,284 @@ +#ifndef _OG_SCREEN_CALLBACKNODES_H +#define _OG_SCREEN_CALLBACKNODES_H + +#include "types.h" +#include "JSystem/J2D/J2DPane.h" +#include "og/Screen/ScaleMgr.h" +#include "P2DScreen.h" +#include "SoundID.h" + +struct LifeGauge; + +namespace P2JME { +struct SimpleMessage; +} // namespace P2JME + +namespace og { +namespace Screen { + struct AngleMgr; + struct AnimGroup; + struct CounterKeta; + struct DataNavi; + + // Size: 0x44 + struct CallBack_CatchPiki : public P2DScreen::CallBackNode { + virtual ~CallBack_CatchPiki(); // _00 + virtual void update(); // _08 + virtual void _14(); // _14 + + ulong* _1C; // _1C + J2DPicture* _20; // _20 + ulong _24; // _24 + ScaleMgr m_scaleMgr; // _28 + }; + + struct CallBack_CounterRV : public P2DScreen::CallBackNode { + enum EnumCenteringMode { + ECM_UNKNOWN_2 = 2, + _ECM_FORCE_UINT = 0xFFFFFFFF + }; + + virtual ~CallBack_CounterRV(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + virtual void init(J2DScreen*, ulonglong, ulonglong, ulonglong, ulong*, + bool); // _14 + virtual void show(); // _18 + virtual void hide(); // _1C + virtual void setValue(bool, bool); // _20 + virtual void setValue(); // _24 + + J2DPane* getMotherPane(); + void setBlind(bool); + void setCenteringMode(EnumCenteringMode); + void setCounterUpDown(int, bool, bool); + void setKetaSub(int, bool, bool); + void setPuyoAnim(bool); + void setPuyoAnimZero(bool); + void setZeroAlpha(bool); + void startPuyoUp(float); + + char** m_characterTexturePaths; // _1C + ulong* _20; // _20 + ulong _24; // _24 + ulong _28; // _28 + ushort _2C; // _2C + ushort m_counterLimit; // _2E /* allocated slot count of _7C */ + ushort _30; // _30 + float _34; // _34 + float _38; // _38 + float _3C; // _3C + float _40; // _40 + float _44; // _44 + float m_widthMaybe; // _48 + float m_heightMaybe; // _4C + float _50; // _50 + float _54; // _54 + float _58; // _58 + float _5C; // _5C + uint m_basePosition; // _60 /* Use J2DBasePosition constants. */ + u8 _64; // _64 + u8 _65[7]; // _65 /* Hopefully this doesn't mess with size. */ + J2DPictureEx* _6C; // _6C + J2DPane* _70; // _70 + J2DPane* _74; // _74 + J2DPane* m_motherPane; // _78 + CounterKeta** m_counters; // _7C + ResTIMG** m_imgResources; // _80 + bool m_isPuyoAnim; // _84 + bool m_isPuyoAnimZero; // _85 + bool m_isBlind; // _86 + bool m_isHidden; // _87 + bool _88; // _88 + u8 _89; // _89 + EnumCenteringMode m_centeringMode; // _8C + uchar m_zeroAlpha; // _90 + SoundID m_scaleUpSoundID; // _94 + SoundID m_scaleDownSoundID; // _98 + u8 _9C; // _9C + float _A0; // _A0 + float _A4; // _A4 + + static struct { + float _00; + float _04; + float _08; + } msVal; + }; + + struct CallBack_CounterDay : public CallBack_CounterRV { + virtual ~CallBack_CounterDay(); // _00 + virtual void update(); // _08 + virtual void init(J2DScreen*, ulonglong, ulonglong, ulonglong, ulong*, + bool); // _14 + virtual void show(); // _18 + virtual void hide(); // _1C + virtual void setValue(); // _24 + + J2DPane* _A8; // _A8 + }; + + // Size: 0xCC + struct CallBack_CounterSlot : public CallBack_CounterRV { + virtual ~CallBack_CounterSlot(); // _00 + virtual void update(); // _08 + virtual void init(J2DScreen*, ulonglong, ulonglong, ulonglong, ulong*, + bool); // _14 + virtual void setValue(bool, bool); // _20 + virtual void setValue(); // _24 + + void setPuyoParam(float, float, float); + void slot_up(int); + void startSlot(float); + + u8 _A8; // _A8 + u8 _A9; // _A9 + u8 _AA; // _AA + u8 _AB; // _AB + u8 _AC; // _AC + u32 _B0; // _B0 + float _B4; // _B4 + float _B8; // _B8 + float _BC; // _BC + float _C0; // _C0 + float _C4; // _C4 + SoundID _C8; // _C8 + }; + + // Size: 0x28 + struct CallBack_DrawAfter : public P2DScreen::CallBackNode { + virtual ~CallBack_DrawAfter(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + virtual void _14(); // _14 + + J2DPictureEx* _1C; // _1C + J2DPictureEx* _20; // _20 + u8 _24; // _24 + }; + + // Size: 0x4C + struct CallBack_Furiko : public P2DScreen::CallBackNode { + virtual ~CallBack_Furiko(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + virtual void _14(); // _14 + + J2DPane* _1C; // _1C + u8 _20; // _20 + u8 _21; // _21 + float _24; // _24 + float _28; // _28 + float _2C; // _2C + float _30; // _30 + float _34; // _34 + float _38; // _38 + float _3C; // _3C + float _40; // _40 + float _44; // _44 + float _48; // _48 + }; + + struct CallBack_LifeGauge : public P2DScreen::CallBackNode { + enum LifeGaugeType { _LGT_FORCE_UINT = 0xFFFFFFFF }; + + virtual ~CallBack_LifeGauge(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + + DataNavi* m_data; // _1C + float m_naviLifeRatioMaybe; // _20 + float m_widthOrRadiusMaybe; // _24 + float m_offsetX; // _28 + float m_offsetY; // _2C + float _30; // _30 + u8 _34[8]; // _34 + float m_na_i_d4; // _3C + float m_na_i_d8; // _40 + float m_li_i_d4; // _44 + float m_li_i_d8; // _48 + LifeGauge* m_lifeGauge; // _4C + u8 _50; // _50 + u8 _51; // _51 + float _54; // _54 + float _58; // _58 + P2DScreen::Mgr* _5C; // _5C + J2DPane* m_pin1; // _60 + J2DPicture* m_pin2; // _64 + J2DPane* m_na_i; // _68 + J2DPane* m_li_i; // _6C + J2DPicture* _70; // _70 + J2DPicture* _74; // _74 + J2DPicture* _78; // _78 + J2DPicture* _7C; // _7C + J2DPicture* _80; // _80 + J2DPicture* _84; // _84 + AngleMgr* m_angleMgr; // _88 + ScaleMgr* m_scaleMgr; // _8C + LifeGaugeType m_lifeGaugeType; // _90 + u8 _94; // _94 + }; + + // Size: 0x48 + struct CallBack_Message : public P2DScreen::CallBackNode { + virtual ~CallBack_Message(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + virtual void _14(); // _14 + + P2JME::SimpleMessage* m_message; // _1C + ulonglong m_messageIDAsULL; // _20 + ulong m_messageIDAs2UL[2]; // _28 + float _30; // _30 + float _34; // _34 + float _38; // _38 + float _3C; // _3C + float _40; // _40 + float _44; // _44 + }; + + struct CallBack_Screen : public P2DScreen::CallBackNode { + virtual ~CallBack_Screen(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + virtual void _14(); // _14 + + J2DScreen* m_partsScreen; // _1C + J2DPane* _20; // _20 + J2DTextBox* _24; // _24 + float _28; // _28 + float _2C; // _2C + float _30; // _30 + }; + + // Size: 0x38 + struct CallBack_Picture : public CallBack_Screen { + virtual ~CallBack_Picture(); // _00 + virtual void update(); // _08 + virtual void draw(Graphics&, J2DGrafContext&); // _0C + virtual void _14(); // _14 + + AnimGroup* m_animGroup; // _34 + }; + + struct CallBack_SunMeter : public P2DScreen::CallBackNode { + virtual ~CallBack_SunMeter(); // _00 + virtual void update(); // _08 + virtual void _14(); // _14 + + float _1C; // _1C + u8 _20[4]; // _20 + J2DPane* _24; // _24 + J2DPane* _28; // _28 + J2DPane* _2C; // _2C + J2DPane* _30; // _30 + u8 _34[4]; // _34 + u8 _38; // _38 + u8 _39; // _39 + u8 _3A; // _3A + ScaleMgr* m_scaleMgr; // _3C + }; +} // namespace Screen +} // namespace og + +#endif diff --git a/include/og/Screen/ogScreen.h b/include/og/Screen/ogScreen.h index 5bf8276b8..2460d8bc5 100644 --- a/include/og/Screen/ogScreen.h +++ b/include/og/Screen/ogScreen.h @@ -3,6 +3,8 @@ #include "JSystem/J2D/J2DPane.h" #include "types.h" +#include "Screen/Enums.h" +#include "Vector2.h" struct J2DPane; struct ResTIMG; @@ -10,24 +12,92 @@ struct J2DGrafContext; struct JKRArchive; namespace JUtility { struct TColor; -} +} // namespace JUtility + +namespace P2DScreen { +struct Mgr; +} // namespace P2DScreen namespace og { namespace Screen { - void kakomiPane(J2DPane*); + struct AnimGroup; + struct CallBack_CounterDay; + struct CallBack_CounterRV; + struct CallBack_CounterSlot; + struct CallBack_DrawAfter; + struct CallBack_Furiko; + struct CallBack_Picture; + struct PictureTreeColorCaptureInfo; + + void blendColor(JUtility::TColor&, JUtility::TColor&, float, + JUtility::TColor*); + void blendPictureTreeColor(PictureTreeColorCaptureInfo*, JUtility::TColor&, + JUtility::TColor&, float); + void calcGlbCenter(J2DPane*, Vector2f*); + uint CalcKeta(ulong); + float calcSmooth0to1(float, float); + u32* capturePictureTreeColor(J2DPane*, int); void centeringPane(J2DPane*, bool, bool); - void maskTag(ulonglong, ushort, ushort); - void maskTag2(ulonglong, ushort); - void CalcKeta(ulong); - void MojiToNum(ulonglong, int); - void TagToName(ulonglong, char*); - ulonglong NameToTag(char*); ulonglong CharCodeToTag(char*); - void TagToHex(ulonglong, char*); - void TagSearch(J2DScreen*, ulonglong); - void setP2DScreen(char*, ulong, JKRArchive*); - void dumpInfoResTIMG(ResTIMG const*); + bool checkVisibleGlb(J2DPane*); + J2DPictureEx* CopyPicture(J2DPictureEx*, ulonglong); + J2DPictureEx* CopyPictureToPane(J2DPictureEx*, J2DPane*, float, float, + ulonglong); void drawPaneFrame(J2DGrafContext&, J2DPane*, JUtility::TColor&); + void dumpInfoResTIMG(ResTIMG const*); + CallBack_Furiko* getFurikoPtr(P2DScreen::Mgr*, ulonglong); + void kakomiPane(J2DPane*); + ResTIMG** makeSujiFontTable(char**, JKRArchive*); + ulonglong maskTag(ulonglong, ushort, ushort); + ulonglong maskTag2(ulonglong, ushort); + ulonglong MojiToNum(ulonglong, int); + ulonglong NameToTag(char*); + void registAnimGroupPane(AnimGroup*, JKRArchive*, J2DScreen*, ulonglong, + char*, float); + void registAnimGroupScreen(AnimGroup*, JKRArchive*, J2DScreen*, char*, + float); + void setAlphaScreen(J2DPane*); + void setAnimTextScreen(JKRArchive*, P2DScreen::Mgr*, ulonglong); + void setCallBack_3DStick(JKRArchive*, P2DScreen::Mgr*, ulonglong); + void setCallBack_3DStickSmall(JKRArchive*, P2DScreen::Mgr*, ulonglong); + void setCallBack_CStick(JKRArchive*, P2DScreen::Mgr*, ulonglong); + void setCallBack_CStickSmall(JKRArchive*, P2DScreen::Mgr*, ulonglong); + CallBack_CounterDay* setCallBack_CounterDay(P2DScreen::Mgr*, ulonglong, + ulonglong, ulonglong, ulong*, + ushort, JKRArchive*); + CallBack_CounterDay* setCallBack_CounterDay(char**, P2DScreen::Mgr*, + ulonglong, ulonglong, ulonglong, + ulong*, ushort, JKRArchive*); + void setCallBack_CounterMap(P2DScreen::Mgr*, ulonglong, ulonglong, + ulonglong, ulong*, ushort, ushort, bool, + JKRArchive*); + CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr*, ulonglong, + ulonglong, ulonglong, ulong*, + ushort, ushort, bool, + JKRArchive*); + CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr*, ulonglong, + ulong*, ushort, bool, bool, + JKRArchive*); + CallBack_CounterRV* setCallBack_CounterRV(P2DScreen::Mgr*, ulonglong, ulong, + ushort, bool, bool, JKRArchive*); + void setCallBack_CounterRV2(P2DScreen::Mgr*, ulonglong, ulong*, ushort, + bool, bool, JKRArchive*); + CallBack_CounterSlot* setCallBack_CounterSlot(P2DScreen::Mgr*, ulonglong, + ulong*, ushort, bool, bool, + JKRArchive*); + CallBack_DrawAfter* setCallBack_DrawAfter(P2DScreen::Mgr*, ulonglong); + CallBack_Furiko* setCallBack_Furiko(P2DScreen::Mgr*, ulonglong); + CallBack_Picture* setCallBack_Picture(JKRArchive*, char*, ulonglong, + P2DScreen::Mgr*, ulonglong); + void setCallBackMessage(P2DScreen::Mgr*); + void setCallBackMessageSub(P2DScreen::Mgr*, J2DPane*); + void setFurikoScreen(P2DScreen::Mgr*); + void setMenuScreen(JKRArchive*, P2DScreen::Mgr*, ulonglong); + void setMenuTitleScreen(JKRArchive*, P2DScreen::Mgr*, ulonglong); + void setP2DScreen(char*, ulong, JKRArchive*); + J2DPane* TagSearch(J2DScreen*, ulonglong); + void TagToHex(ulonglong, char*); + void TagToName(ulonglong, char*); struct DispMemberBase { virtual uint getSize() = 0; // _00 @@ -35,10 +105,10 @@ namespace Screen { virtual ulonglong getMemberID() = 0; // _08 virtual void doSetSubMemberAll(); // _10 - bool isID(ulong, ulonglong); + bool isID(ScreenOwnerID, ScreenMemberID); void getMemberName(char*); bool setSubMember(DispMemberBase*); - DispMemberBase* getSubMember(ulong, ulonglong); + DispMemberBase* getSubMember(ScreenOwnerID, ScreenMemberID); void setSubMemberAll(); // inline void getOwnerName(char* outName) {