summaryrefslogtreecommitdiff
path: root/include/game.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/game.h')
-rwxr-xr-xinclude/game.h1102
1 files changed, 1102 insertions, 0 deletions
diff --git a/include/game.h b/include/game.h
new file mode 100755
index 0000000..cb567f3
--- /dev/null
+++ b/include/game.h
@@ -0,0 +1,1102 @@
+#ifndef __KAMEK_GAME_H
+#define __KAMEK_GAME_H
+
+#include <common.h>
+#include <rvl/mtx.h>
+#include <rvl/GXEnum.h>
+#include <rvl/vifuncs.h>
+
+
+extern "C" {
+int strlen(const char *str);
+
+float atan(float x);
+float atan2(float y, float x);
+
+float cos(float x);
+float sin(float x);
+}
+
+bool DVD_Start();
+bool DVD_End();
+bool DVD_StillLoading(void *dvdclass2);
+void DVD_LoadFile(void *dvdclass, char *folder, char *file, void *callbackData);
+void DVD_FreeFile(void *dvdclass2, char *file);
+
+extern void *DVDClass;
+
+inline void *GetDVDClass() {
+ return DVDClass;
+}
+
+inline void *GetDVDClass2() {
+ return (void*)(((u32)GetDVDClass())+4);
+}
+
+void *DVD_GetFile(void *dvdclass2, const char *arc, const char *file);
+
+
+extern int Player_Active[4];
+extern int Player_ID[4];
+extern int Player_Powerup[4];
+extern int Player_Flags[4];
+extern int Player_Lives[4];
+extern int Player_Coins[4];
+
+struct StartLevelInfo {
+ int maybeUnused;
+ unsigned char unk1; // 0x04
+ unsigned char unk2; // 0x05
+ unsigned char unk3; // 0x06
+ unsigned char unk4; // 0x07
+ unsigned int purpose; // 0x08
+ unsigned char world1; // 0x0C
+ unsigned char level1; // 0x0D
+ unsigned char world2; // 0x0E
+ unsigned char level2; // 0x0F
+};
+
+extern void *GameMgr;
+inline void *GetGameMgr() {
+ return GameMgr;
+}
+
+bool QueryPlayerAvailability(int id);
+void DoStartLevel(void *gameMgr, StartLevelInfo *sl);
+void SetSomeConditionShit(int world, int level, unsigned int bits);
+
+bool IsWideScreen();
+
+#define GAMEMGR_GET_AFC(gmgr) (*((bool*)(((u32)(gmgr))+0xAFC)))
+
+
+#define COND_COIN1 1
+#define COND_COIN2 2
+#define COND_COIN3 4
+#define COND_NORMAL 0x10
+#define COND_SECRET 0x20
+#define COND_SGNORMAL 0x80
+#define COND_SGSECRET 0x100
+
+class SaveFirstBlock {
+public:
+ char titleID[4]; // 0x00
+ u8 field_00; // 0x04
+ u8 field_01; // 0x05
+ u8 current_file; // 0x06
+ u8 field_03; // 0x07
+ u16 freemode_fav[10][0x2A]; // 0x08
+ u16 coinbtl_fav[10][0x2A]; // 0x350
+ u16 bitfield; // 0x698
+ u16 field_69A; // 0x69A
+ u32 checksum; // 0x69C
+};
+
+class SaveBlock {
+public:
+ u8 field_00; // 0x00
+ u8 field_01; // 0x01
+ u8 bitfield; // 0x02
+ u8 current_world; // 0x03
+ u8 field_04; // 0x04
+ u8 current_path_node; // 0x05
+ u8 field_06; // 0x06
+ u8 switch_on; // 0x07
+ u8 field_08; // 0x08
+ u8 powerups_available[7]; // 0x09
+ u8 toad_level_idx[10]; // 0x10
+ u8 player_continues[4]; // 0x1A
+ u8 player_coins[4]; // 0x1E
+ u8 player_lives[4]; // 0x22
+ u8 player_flags[4]; // 0x26
+ u8 player_type[4]; // 0x2A
+ u8 player_powerup[4]; // 0x2E
+ u8 worlds_available[10]; // 0x32
+ u32 ambush_countdown[10]; // 0x3C
+ u16 field_64; // 0x64
+ u16 credits_hiscore; // 0x66
+ u16 score; // 0x68
+ u32 completions[10][0x2A]; // 0x6C
+ u8 hint_movie_bought[70]; // 0x6FC
+ u8 toad_location[10]; // 0x742
+ u8 field_74C[10][4]; // 0x74C
+ u8 field_774[10][4]; // 0x774
+ u8 field_79C[10][4]; // 0x79C
+ u8 death_counts[10][0x2A]; // 0x7C4
+ u8 death_count_3_4_switch; // 0x968
+ u8 pad[0x13]; // 0x969
+ u32 checksum; // 0x97C
+
+ u32 GetLevelCondition(int world, int level);
+ bool CheckLevelCondition(int world, int level, int cond);
+ bool CheckIfCoinCollected(int world, int level, int num);
+};
+
+class SaveFile {
+public:
+ u32 field_00;
+ u32 field_04;
+ u32 field_08;
+ u32 field_0C;
+ u32 field_10;
+ u32 field_14;
+ u32 field_18;
+ u32 field_1C;
+
+ // Real Savefile starts here
+ SaveFirstBlock header;
+ SaveBlock blocks[3];
+ SaveBlock quickSave[3];
+
+ SaveBlock *GetBlock(int id);
+ SaveBlock *GetQSBlock(int id);
+
+ bool CheckIfWriting(); // 0x800E0540
+};
+
+class SaveHandler {
+public:
+ u8 unknown[0x70];
+ u32 CurrentState;
+ u32 CurrentError;
+ u32 field_7C;
+};
+
+extern SaveFile *SaveFileInstance;
+extern SaveHandler *SaveHandlerInstance;
+
+inline SaveFile *GetSaveFile() {
+ return SaveFileInstance;
+}
+
+inline SaveHandler *GetSaveHandler() {
+ return SaveHandlerInstance;
+}
+
+#define WPAD_DOWN 0x0001 // Actually Left, but rotated
+#define WPAD_UP 0x0002 // Actually Right, but rotated
+#define WPAD_RIGHT 0x0004 // Actually Down, but rotated
+#define WPAD_LEFT 0x0008 // Actually Up, but rotated
+#define WPAD_PLUS 0x0010
+#define WPAD_TWO 0x0100
+#define WPAD_ONE 0x0200
+#define WPAD_B 0x0400
+#define WPAD_A 0x0800
+#define WPAD_MINUS 0x1000
+#define WPAD_HOME 0x8000
+
+struct RemoconMngClass {
+ void *vtable;
+ void *controllers[4];
+};
+
+/*
+ * Ok, here's how the remocon/wiimote shit works:
+ * Remocon is a NSMB-specific class, it handles the different control methods
+ * and D-pad directions and such automatically.
+ *
+ * Wiimote is a generic class (part of EGG) -- well it's not actually called
+ * that, but who cares. It handles different types of controllers. Only
+ * query it if whatever you're accessing is control type dependent.
+ */
+
+extern RemoconMngClass *RemoconMng;
+extern int ActiveWiimoteID;
+extern void *ActiveWiimote;
+
+inline RemoconMngClass *GetRemoconMng() {
+ return RemoconMng;
+}
+
+inline int GetActiveWiimoteID() {
+ return ActiveWiimoteID;
+}
+
+inline void *GetActiveRemocon() {
+ return GetRemoconMng()->controllers[GetActiveWiimoteID()];
+}
+
+inline void *GetActiveWiimote() {
+ return ActiveWiimote;
+}
+
+inline unsigned int Remocon_GetButtons(void *self) {
+ return *((unsigned int*)((u32)self+0x18));
+}
+
+inline unsigned int Remocon_GetPressed(void *self) {
+ return *((unsigned int*)((u32)self+0x1C));
+}
+
+typedef bool (*__Wiimote_TestButtons_type)(void*, unsigned int);
+inline bool Wiimote_TestButtons(void *self, unsigned int btns) {
+ VF_BEGIN(__Wiimote_TestButtons_type, self, 8, 0)
+ return VF_CALL(self, btns);
+ VF_END;
+}
+
+int SearchForIndexOfPlayerID(int id);
+
+bool CheckIfContinueShouldBeActivated();
+
+bool CheckIfMenuShouldBeCancelledForSpecifiedWiimote(int num);
+
+void StartTitleScreenStage(bool realDemo, int sceneParam);
+
+bool CheckIfWeCantDoStuff();
+
+u32 QueryGlobal5758(u32 check);
+
+void SaveGame(void *classDoesntMatter, bool isQuick);
+
+#include <actors.h>
+void *CreateParentedObject(short classID, void *parent, int settings, char something);
+void *CreateChildObject(short classID, void *parent, int settings, int unk1, int unk2);
+
+
+#define WIPE_FADE 0
+#define WIPE_CIRCLE 1
+#define WIPE_BOWSER 2
+#define WIPE_WAVY 3
+#define WIPE_MARIO 4
+#define WIPE_CIRCLE_s 5
+
+void ActivateWipe(int type);
+
+typedef void (*ScreenDrawFunc)();
+
+extern ScreenDrawFunc *CurrentDrawFunc;
+void WorldMapDrawFunc();
+void GameSetupDrawFunc();
+
+void GameSetup__LoadScene(void *self); // 0x80919560
+void FreeScene(int id);
+
+void WpadShit(int unk); // 0x8016F780
+
+void *BgTexMng__LoadAnimTile(void *self, int tileset, short tile, char *name, char *delays, char reverse); // 0x80087B60
+
+extern void *GameHeaps[];
+
+
+
+namespace nw4r {
+
+namespace ut {
+ // this isn't 100% accurate because it doesn't use templates
+ // or detail::LinkListImpl, but oh well
+ // I don't need the methods anyway.
+
+ class LinkListNode {
+ LinkListNode *next;
+ LinkListNode *prev;
+ };
+
+ class LinkList {
+ int count;
+ LinkListNode initialNode;
+ };
+
+ class Color : public GXColor { };
+
+ class Rect {
+ f32 left;
+ f32 top;
+ f32 right;
+ f32 bottom;
+ };
+
+ template <class T>
+ class TagProcessorBase { };
+}
+
+namespace lyt {
+ class Pane; // forward declaration
+ class DrawInfo;
+
+ class AnimTransform; // I'll do these later
+ class AnimResource;
+ class AnimationLink;
+ class ResourceAccessor;
+ class GroupContainer;
+
+ class Layout {
+ public:
+ Layout();
+ virtual ~Layout();
+
+ virtual bool Build(const void *data, ResourceAccessor *resAcc);
+
+ virtual AnimTransform *CreateAnimTransform();
+ virtual AnimTransform *CreateAnimTransform(const void *data, ResourceAccessor *resAcc);
+ virtual AnimTransform *CreateAnimTransform(const AnimResource &res, ResourceAccessor *resAcc);
+
+ virtual void BindAnimation(AnimTransform *anim);
+ virtual void UnbindAnimation(AnimTransform *anim);
+ virtual void UnbindAllAnimation();
+ virtual bool BindAnimationAuto(const AnimResource &res, ResourceAccessor *resAcc);
+
+ virtual void SetAnimationEnable(AnimTransform *anim, bool unk);
+
+ virtual void CalculateMtx(const DrawInfo &info);
+
+ virtual void/*?*/ Draw(const DrawInfo &info);
+ virtual void/*?*/ Animate(ulong flag);
+
+ virtual void/*?*/ SetTagProcessor(ut::TagProcessorBase<wchar_t> *tagProc);
+
+ ut::LinkList animations;
+
+ Pane *rootPane;
+ GroupContainer *groupContainer;
+
+ float width;
+ float height;
+ };
+
+
+ class DrawInfo {
+ public:
+ DrawInfo();
+ virtual ~DrawInfo();
+
+ Mtx matrix;
+ float left;
+ float top;
+ float right;
+ float bottom;
+ float scaleX;
+ float scaleY;
+ float alpha;
+ u8 _50; // this is actually a bitfield. todo: investigate how CW handles bitfields, and so on
+ };
+
+
+ class Material {
+ public:
+ // ...
+ };
+
+ class Pane {
+ public:
+ //Pane(nw4r::lyt::res::Pane const *); // todo: this struct
+ Pane(void *);
+ ~Pane();
+
+ virtual void *GetRuntimeTypeInfo() const;
+ virtual void CalculateMtx(const DrawInfo &info);
+
+ virtual void Draw(const DrawInfo &info);
+ virtual void DrawSelf(const DrawInfo &info);
+ virtual void Animate(ulong flag);
+ virtual void AnimateSelf(ulong flag);
+
+ virtual ut::Color GetVtxColor(ulong id) const;
+ virtual void SetVtxColor(ulong id, ut::Color color);
+ virtual uchar GetColorElement(ulong id) const;
+ virtual void SetColorElement(ulong id, uchar value);
+ virtual uchar GetVtxColorElement(ulong id) const;
+ virtual void SetVtxColorElement(ulong id, uchar value);
+
+ virtual Pane *FindPaneByName(const char *name, bool recursive);
+ virtual Material *FindMaterialByName(const char *name, bool recursive);
+
+ virtual void/*?*/ BindAnimation(AnimTransform *anim, bool unk1, bool unk2);
+ virtual void UnbindAnimation(AnimTransform *anim, bool unk);
+ virtual void UnbindAllAnimation(bool unk);
+ virtual void UnbindAnimationSelf(AnimTransform *anim);
+
+ virtual ut::LinkListNode *FindAnimationLinkSelf(AnimTransform *anim);
+ virtual ut::LinkListNode *FindAnimationLinkSelf(const AnimResource &anim);
+
+ virtual void SetAnimationEnable(AnimTransform *anim, bool unk1, bool unk2);
+ virtual void SetAnimationEnable(const AnimResource &anim, bool unk1, bool unk2);
+
+ virtual ulong GetMaterialNum() const;
+ virtual Material *GetMaterial() const;
+ virtual Material *GetMaterial(ulong id) const;
+
+ virtual void LoadMtx(const DrawInfo &info);
+
+ void AppendChild(Pane *child);
+
+ ut::Rect GetPaneRect(const DrawInfo &info) const;
+
+ ut::LinkListNode *AddAnimationLink(AnimationLink *link);
+
+ Vec2 GetVtxPos() const;
+
+
+ ut::LinkListNode parentLink;
+ Pane *parent;
+
+ ut::LinkList children;
+ ut::LinkList animations;
+
+ Material *material;
+
+ Vec trans;
+ Vec rotate;
+ Vec2 scale;
+ Vec2 size;
+
+ Mtx calcMtx;
+ Mtx effectiveMtx;
+
+ float _B4;
+
+ u8 alpha;
+ u8 effectiveAlpha;
+ u8 origin;
+ u8 flag;
+
+ char name[0x14];
+ char userdata[8];
+
+ u8 _D5;
+ u8 paneIsOwnedBySomeoneElse;
+ u8 _D7;
+ };
+}
+
+
+
+namespace g3d {
+struct CameraData
+{
+enum Flag
+ {
+FLAG_CAMERA_LOOKAT = 0x00000001,
+FLAG_CAMERA_ROTATE = 0x00000002,
+FLAG_CAMERA_AIM = 0x00000004,
+MASK_CAMERA = 0x00000007,
+
+FLAG_CMTX_VALID = 0x00000008,
+
+FLAG_PROJ_FLUSTUM = 0x00000010,
+FLAG_PROJ_PERSP = 0x00000020,
+FLAG_PROJ_ORTHO = 0x00000040,
+MASK_PROJ = 0x00000070,
+
+FLAG_PMTX_VALID = 0x00000080,
+
+FLAG_VIEWPORT_JITTER_ABOVE = 0x00000100
+ };
+
+Mtx cameraMtx;
+Mtx44 projMtx;
+
+u32 flags;
+
+VEC3 cameraPos;
+VEC3 cameraUp;
+VEC3 cameraTarget;
+VEC3 cameraRotate;
+f32 cameraTwist;
+
+GXProjectionType projType;
+f32 projFovy;
+f32 projAspect;
+f32 projNear;
+f32 projFar;
+f32 projTop;
+f32 projBottom;
+f32 projLeft;
+f32 projRight;
+
+f32 lightScaleS;
+f32 lightScaleT;
+f32 lightTransS;
+f32 lightTransT;
+
+VEC2 viewportOrigin;
+VEC2 viewportSize;
+f32 viewportNear;
+f32 viewportFar;
+
+u32 scissorX;
+u32 scissorY;
+u32 scissorWidth;
+u32 scissorHeight;
+
+s32 scissorOffsetX;
+s32 scissorOffsetY;
+};
+
+/* Correct camera
+cameraMtx:
+1.0 0.0 0.0 -0.0
+0.0 1.0 0.0 -0.0
+0.0 0.0 1.0 -6000.0
+
+projMtx:
+0.002345 0.000000 0.000000 -1.000000
+0.000000 0.004386 0.000000 -1.000000
+0.000000 0.000000 -0.000005 -0.500000
+0.000000 0.000000 0.000000 1.000000
+
+flags: 000000C9 : FLAG_CAMERA_LOOKAT | FLAG_CMTX_VALID | FLAG_PROJ_ORTHO | FLAG_PMTX_VALID
+
+cameraPos: {0, 0, 15}
+cameraUp: {0, 1, 0}
+cameraTarget: {0, 0, 0}
+cameraRotate: {0, 0, 0}
+cameraTwist: 0
+
+projType: 1
+projFovy: 60
+projAspect: 1.333333
+projNear: -100000
+projFar: 100000
+projTop: 456
+projBottom: 0
+projLeft: 0
+projRight: 853
+
+lightScaleS: 0.5
+lightScaleT: 0.5
+lightTransS: 0.5
+lightTransT: 0.5
+
+viewportOrigin: {0,0}
+viewportSize: {640,456}
+viewportNear: 0
+viewportFar: 1
+
+scissorX: 0
+scissorY: 0
+scissorWidth: 0x280
+scissorHeight: 0x1C8
+
+scissorOffsetX: 0
+scissorOffsetY: 0
+*/
+
+class Camera {
+public:
+ enum PostureType { POSTURE_LOOKAT, POSTURE_ROTATE, POSTURE_AIM };
+ struct PostureInfo
+ {
+ PostureType tp;
+ VEC3 cameraUp;
+ VEC3 cameraTarget;
+ VEC3 cameraRotate;
+ f32 cameraTwist;
+ };
+private:
+ CameraData *data;
+public:
+ Camera(CameraData *pCamera);
+ void Init();
+ void Init(u16 efbWidth, u16 efbHeight, u16 xfbWidth, u16 xfbHeight, u16 viWidth, u16 viHeight);
+ //void SetPosition(f32 x, f32 y, f32 z);
+ void SetPosition(const VEC3 &pos);
+ //void GetPosition(f32 *px, f32 *py, f32 *pz) const;
+ void GetPosition(VEC3 *pPos) const;
+ void SetPosture(const PostureInfo &info);
+ //void GetPosture(PostureInfo *info) const;
+ void SetCameraMtxDirectly(const Mtx &mtx);
+ void GetCameraMtx(Mtx *pMtx) const;
+ void SetOrtho(f32 top, f32 bottom, f32 left, f32 right, f32 near, f32 far);
+ //void SetFrustum(f32 top, f32 bottom, f32 left, f32 right, f32 near, f32 far);
+ void SetPerspective(f32 fovy, f32 aspect, f32 near, f32 far);
+ void SetProjectionMtxDirectly(const Mtx44 *pMtx);
+ void GetProjectionMtx(Mtx44 *pMtx) const;
+ //GXProjectionType GetProjectionType() const;
+ void SetScissor(u32 xOrigin, u32 yOrigin, u32 width, u32 height);
+ void SetScissorBoxOffset(s32 xOffset, s32 yOffset);
+ //void GetScissor(u32 *xOrigin, u32 *yOrigin, u32 *width, u32 *height);
+ void SetViewport(f32 xOrigin, f32 yOrigin, f32 width, f32 height);
+ //void SetViewport(f32 xOrigin, f32 yOrigin, f32 width, f32 height, f32 near, f32 far);
+ void SetViewportZRange(f32 near, f32 far);
+ void SetViewportJitter(u32 field);
+ //void SetViewportJitter(f32 xOrigin, f32 yOrigin, f32 width, f32 height, f32 near, f32 far, u32 field);
+ void GetViewport(f32 *xOrigin, f32 *yOrigin, f32 *width, f32 *height, f32 *near, f32 *far) const;
+ void GXSetViewport() const;
+ void GXSetProjection() const;
+ void GXSetScissor() const;
+ void GXSetScissorBoxOffset() const;
+};
+
+namespace G3DState {
+ GXRenderModeObj *GetRenderModeObj();
+}
+}
+}
+
+
+nw4r::g3d::CameraData *GetCameraByID(int id);
+
+int GetCurrentCameraID(); // 80164C80
+void SetCurrentCameraID(int id); // 80164C90
+
+void LinkScene(int id); // 80164D50
+void UnlinkScene(int id); // 80164CD0
+
+void SceneCalcWorld(int sceneID); // 80164E10
+void SceneCameraStuff(int sceneID); // 80164EA0
+
+void CalcMaterial(); // 80164E90
+void DrawOpa(); // 80164F70
+void DrawXlu(); // 80164F80
+
+bool ChangeAlphaUpdate(bool enable); // 802D3270
+
+void DoSpecialDrawing1(); // 8006CAE0
+void DoSpecialDrawing2(); // 8006CB40
+
+void SetupLYTDrawing(); // 80163360
+void ClearLayoutDrawList(); // 801632B0
+
+void DrawAllLayoutsBeforeX(int x); // 80163440
+void DrawAllLayoutsAfterX(int x); // 801634D0
+void DrawAllLayoutsAfterXandBeforeY(int x, int y); // 80163560
+
+void RenderEffects(int v1, int v2); // 80093F10
+
+void RemoveAllFromScnRoot(); // 80164FB0
+void Reset3DState(); // 80165000
+
+extern "C" void GXDrawDone(); // 801C4FE0
+
+
+
+namespace m2d {
+ class Base_c /*: public nw4r::ut::Link what's this? */ {
+ u32 _00;
+ u32 _04;
+
+ Base_c();
+ virtual ~Base_c();
+ virtual void _vf0C();
+
+ u8 _0C;
+ };
+
+ class Simple_c : public Base_c {
+ nw4r::lyt::Layout layout;
+ nw4r::lyt::DrawInfo drawInfo;
+
+ u32 _84;
+ float _88;
+ float _8C;
+ float _90;
+ u32 _94;
+
+ Simple_c();
+ ~Simple_c();
+
+ void _vf0C();
+ virtual void _vf10();
+ virtual void _vf14();
+ };
+}
+
+
+
+namespace EGG {
+ class Frustum {
+ GXProjectionType projType;
+ int isCentered;
+ float width;
+ float height;
+ float fovy;
+ float dunno;
+ float near;
+ float far;
+ float center_x_maybe;
+ float center_y_maybe;
+ float x_direction;
+ float unk2;
+ float unk3;
+ short some_flag_bit;
+
+
+ // isCentered might actually be isNotCentered, dunno
+ Frustum(GXProjectionType projType, Vec2 size, bool isCentered, float near, float far); // 802C6D20
+ Frustum(Frustum &f); // 802C6D90
+ virtual ~Frustum(); // 802C75F0
+
+ virtual void loadDirectly(); // 802C7050
+ virtual void loadIntoCamera(nw4r::g3d::Camera cam); // 802C7070
+
+ void setOrtho(float top, float bottom, float left, float right, float near, float far); // 802C6DD0
+
+ void setFovy(float newFovy); // 802C6F60
+
+ void getCenterPointsBasedOnPos(float x, float y, float *destX, float *destY); // 802C6FD0
+
+ // no idea what this does
+ float getSomethingForPerspective(float blah); // 802C7020
+
+
+ protected:
+ // not all of these might be protected, dunno
+
+ void copyAllFields(Frustum &f); // 802C6EE0
+
+ void saveSomething(float f1, float f2, float f3, float f4); // 802C70C0
+ void loadSomething(float *f1, float *f2, float *f3, float *f4); // 802C70E0
+
+ void loadPerspective(); // 802C7110
+ void loadOrtho(); // 802C7140
+
+ void setCameraPerspective(nw4r::g3d::Camera cam); // 802C7170
+ void setCameraOrtho(nw4r::g3d::Camera cam); // 802C71E0
+
+ void getPerspectiveProjMtx(Mtx44 *mtx); // 802C7250
+ void getPerspectiveProjv(float *ptr); // 802C72E0
+ void getOrthoProjv(float *ptr); // 802C73A0
+
+ void getOrthoVars(float *top, float *bottom, float *left, float *right); // 802C7480
+ };
+}
+
+
+
+
+struct LinkListEntry {
+ LinkListEntry *prev;
+ LinkListEntry *next;
+ void *owned_obj;
+};
+
+
+struct LinkList {
+ LinkListEntry *first;
+ LinkListEntry *last;
+ // PTMF goes here, but I don't know how to represent it
+};
+
+
+struct OrderedLinkListEntry : LinkListEntry {
+ u16 order;
+ u16 _;
+};
+
+
+struct TreeNode {
+ TreeNode *parent;
+ TreeNode *child;
+ TreeNode *prev;
+ TreeNode *next;
+ void *owned_obj;
+};
+
+
+struct Tree {
+ TreeNode *firstNode;
+ // PTMF goes here, but I don't know how to represent it
+};
+
+
+typedef bool (*ChainedFunc)(void*);
+
+struct FunctionChain {
+ ChainedFunc *functions;
+ u16 count;
+ u16 current;
+};
+
+
+class fBase_c {
+public:
+ u32 id;
+ u32 settings;
+ u16 name;
+ u8 _A;
+ u8 _B;
+ u8 _C;
+ u8 _D;
+ u8 base_type;
+ u8 _F;
+ TreeNode link_connect;
+ OrderedLinkListEntry link_execute;
+ OrderedLinkListEntry link_draw;
+ LinkListEntry link_IDlookup;
+ u32 _50;
+ u32 _54;
+ u32 _58;
+ u32 heap;
+
+ fBase_c();
+
+ virtual int onCreate();
+ virtual int beforeCreate();
+ virtual int afterCreate();
+
+ virtual int onDelete();
+ virtual int beforeDelete();
+ virtual int afterDelete();
+
+ virtual int onExecute();
+ virtual int beforeExecute();
+ virtual int afterExecute();
+
+ virtual int onDraw();
+ virtual int beforeDraw();
+ virtual int afterDraw();
+
+ virtual void willBeDeleted();
+
+ virtual bool moreHeapShit(u32 size, void *parentHeap);
+ virtual bool createHeap(u32 size, void *parentHeap);
+ virtual void heapCreated();
+
+ virtual ~fBase_c();
+
+ void Delete();
+
+ fBase_c *GetParent();
+ fBase_c *GetChild();
+ fBase_c *GetNext();
+};
+
+class dBase_c : public fBase_c {
+public:
+ u32 _64;
+ const char *explanation_string;
+ const char *name_string;
+
+ dBase_c();
+
+ int beforeCreate();
+ int afterCreate();
+ int beforeDelete();
+ int afterDelete();
+ int beforeExecute();
+ int afterExecute();
+ int beforeDraw();
+ int afterDraw();
+
+ ~dBase_c();
+
+ virtual const char *GetExplanationString();
+};
+
+class dScene_c : public dBase_c {
+public:
+ FunctionChain *funcChain;
+
+ dScene_c();
+
+ int beforeCreate();
+ int afterCreate();
+ int beforeDelete();
+ int afterDelete();
+ int beforeExecute();
+ int afterExecute();
+ int beforeDraw();
+ int afterDraw();
+
+ ~dScene_c();
+};
+
+class dActor_c : public dBase_c {
+public:
+ LinkListEntry link_actor;
+ Mtx matrix;
+ Vec pos;
+ Vec last_pos;
+ Vec pos_delta;
+ Vec _D0;
+ Vec scale;
+ Vec speed;
+ Vec max_speed;
+ S16Vec rot;
+ S16Vec _106;
+ u32 _10C;
+ u32 _110;
+ float y_speed_inc;
+ u32 _118;
+ float x_speed_inc;
+ u32 _120;
+ bool visible;
+
+ dActor_c();
+
+ virtual void specialDraw1();
+ virtual void specialDraw2();
+ virtual int _vf58();
+ virtual void _vf5C();
+
+ ~dActor_c();
+};
+
+
+
+class dPlayerModelBase_c {
+ // dunno what's public and what's private here
+ // don't really care
+public:
+ dPlayerModelBase_c(u8 player_id); // 800D5420
+ virtual ~dPlayerModelBase_c(); // 800D55D0
+
+ char allocator[28]; // actually a mHeapAllocatorSubclass but I don't have that
+ u32 _20;
+ u32 _24;
+ char someAnimation[2][0x38]; // actually PlayerAnim's
+ char yetAnotherAnimation[40]; // actually m3d::banm_c afaics -- is it even 40 bytes?
+ Vec someVector[2]; // maybe not an array
+ Vec headOffs;
+ Vec scale;
+ u8 player_id_1;
+ u8 player_id_2;
+ u8 powerup_id;
+ u8 powerup_tex;
+ int current_anim;
+ int last_anim_maybe;
+ u32 _15C;
+ int someFlags;
+ u32 _164;
+ u32 _168; // related to jump_strings
+ u32 _16C;
+ u32 _170;
+ u32 _174;
+ u8 _178;
+ char padding[3]; // not needed?
+ u32 model_visibility_flags_maybe;
+ u32 mode_maybe;
+ float _184;
+ float _188;
+ u32 _18C;
+ char someArray[6][12]; // some unknown class/struct
+ char _1D8[0x24];
+ short _1FC;
+ short _1FE;
+ short _200;
+ char padding_[2]; // not needed?
+ u32 _204;
+ u32 _208;
+
+ virtual int _vf0C(); // 800D6DA0
+ virtual void prepare(); // 800D5720
+ virtual void finaliseModel(); // 800D5740
+ virtual void update(); // 800D5750
+ virtual void update3DStuff(); // 800D5760
+ virtual void _vf20(); // 800D6D90
+ virtual void draw(); // 800D5C70
+ virtual int getCurrentModel(); // 800D5870
+ virtual int getCurrentResFile(); // 800D62D0
+ virtual void setPowerup(u8 powerup_id); // 800D5730
+ virtual void setPowerupTexture(); // 800D5CC0
+ virtual void _vf38(); // 800D6D80
+ virtual void _vf3C(); // 800BD750
+ virtual void _vf40(); // 800D6D70
+ virtual void _vf44(); // 800D6D60
+ virtual void _vf48(); // 800BD740
+ virtual void _vf4C(); // 800BD730
+ virtual void getModelMatrix(u32 unk, MtxPtr dest); // 800D5820
+ virtual int _vf54(); // 80318D0C
+ virtual bool _vf58(int type, char *buf, bool unk); // 800D6930
+ virtual void startAnimation(int id, float frame, float unk, float updateRate); // 800D5EC0
+ virtual int _vf60(); // 800D6920
+ virtual void _vf64(int id, float unk1, float unk2, float unk3); // 800D62F0
+ virtual void _vf68(int id, float unk); // 800D63E0
+ virtual void _vf6C(); // 800D62E0
+ virtual void _vf70(); // 800D6690
+ virtual void _vf74(); // 800D66A0
+ virtual void _vf78(); // 800D66B0
+ virtual void SomethingRelatedToPenguinAnims(); // 800D66C0
+ virtual void _vf80(); // 800D6A20
+ virtual void _vf84(float frame); // 800D5D00
+ virtual void _vf88(float frame); // 800D5D70
+ virtual void _vf8C(float updateRate); // 800D5D80
+ virtual void setUpdateRateForAnim1(float updateRate); // 800D5DF0
+ virtual void _vf94(); // 800D6D40
+ virtual int _vf98(); // 800D6D30
+ virtual void _vf9C(); // 800D6D20
+ virtual int _vfA0(); // 800D6D10
+ virtual void _vfA4(); // 800D6D00
+ virtual int _vfA8(); // 800D6CF0
+ virtual void _vfAC(bool blah); // 800BD720
+
+ // I won't even bother with non-virtual functions....
+};
+
+
+class dPlayerModelHandler_c {
+public:
+ dPlayerModelHandler_c(u8 player_id); // 800D6DB0
+ virtual ~dPlayerModelHandler_c(); // 800D6EF0
+
+ dPlayerModelBase_c *mdlClass; // might be dPlayerModel_c ?
+
+ int loadModel(u8 player_id, int powerup_id, int unk); // 800D6EE0
+ void update(); // 800D6F80
+ void setMatrix(Mtx matrix); // 800D6FA0
+ void setSRT(Vec position, S16Vec rotation, Vec scale); // 800D7030
+ void callVF20(); // 800D70F0
+ void draw(); // 800D7110
+
+private:
+ int hasMatrix; // might be bool ?
+
+ void allocPlayerClass(u8 player_id); // 800D6E00
+};
+
+
+class mTexture_c {
+public:
+ mTexture_c(); // 802C0D20
+ mTexture_c(u16 width, u16 height, GXTexFmt format); // 802C0D70
+
+ // vtable is at 80350450
+ virtual ~mTexture_c(); // 802C0DB0
+ virtual void setFlagTo1(); // 802C0E20
+
+ void setImageBuffer(void *buffer); // 802C0E30
+ void load(GXTexMapID id); // 802C0E50
+ void makeTexObj(GXTexObj *obj); // 802C0E90
+ void flushDC(); // 802C0F10
+
+ void makeRadialGradient(); // 802C0F60 parameters unknown yet
+ void makeLinearGradient(int type, char size, u16 startPos, u16 endPos,
+ GXColor begin, GXColor end, bool startAtCenter); // 802C1120
+ // "type" should be enum once I figure it out
+ // reverse might not be accurate
+
+ void allocateBuffer(/* EGG::Heap */void *heap = 0); // 802C14D0
+
+ void plotPixel(u16 x, u16 y, GXColor pixel); // 802C1570
+
+
+ u16 width;
+ u16 height;
+ u8 flags;
+ u8 format;
+ u8 wrapS;
+ u8 wrapT;
+ u8 minFilter;
+ u8 magFilter;
+
+private:
+ void *buffer;
+ void *myBuffer;
+};
+
+
+class dDvdLoader_c {
+public:
+ dDvdLoader_c(); // 8008F140
+ virtual ~dDvdLoader_c(); // 8008F170
+
+ void *load(const char *filename, u8 unk = 0); // 8008F1B0
+
+ bool close(); // 8008F2B0 -- Frees command, DON'T USE THIS unless you free the buffer yourself
+ bool unload(); // 8008F310 -- Frees command and buffer, USE THIS
+
+ int size;
+ void *command; // really mDvd_toMainRam_c
+ void *heap; // really EGG::Heap
+ void *buffer;
+
+private:
+ virtual void freeBuffer(); // 8008F380
+ void freeCommand(); // 8008F3F0
+};
+
+
+
+#endif
+