diff options
Diffstat (limited to 'include/game.h')
-rwxr-xr-x | include/game.h | 218 |
1 files changed, 212 insertions, 6 deletions
diff --git a/include/game.h b/include/game.h index cb567f3..b26842b 100755 --- a/include/game.h +++ b/include/game.h @@ -5,6 +5,7 @@ #include <rvl/mtx.h>
#include <rvl/GXEnum.h>
#include <rvl/vifuncs.h>
+#include <rvl/arc.h>
extern "C" {
@@ -34,6 +35,7 @@ inline void *GetDVDClass2() { }
void *DVD_GetFile(void *dvdclass2, const char *arc, const char *file);
+void *DVD_GetFile(void *dvdclass2, const char *arc, const char *file, u32 *length);
extern int Player_Active[4];
@@ -288,11 +290,13 @@ namespace ut { // I don't need the methods anyway.
class LinkListNode {
+ public:
LinkListNode *next;
LinkListNode *prev;
};
class LinkList {
+ public:
int count;
LinkListNode initialNode;
};
@@ -300,6 +304,7 @@ namespace ut { class Color : public GXColor { };
class Rect {
+ public:
f32 left;
f32 top;
f32 right;
@@ -457,6 +462,45 @@ namespace lyt { u8 paneIsOwnedBySomeoneElse;
u8 _D7;
};
+
+ class TextBox : public Pane {
+ public:
+ TextBox(void *, void *); // todo: TextBox((res::TextBox const *,ResBlockSet const &))
+ ~TextBox();
+
+ void *GetRuntimeTypeInfo() const;
+
+ void DrawSelf(const DrawInfo &info);
+
+ ut::Color GetVtxColor(ulong id) const;
+ void SetVtxColor(ulong id, ut::Color color);
+ uchar GetVtxColorElement(ulong id) const;
+ void SetVtxColorElement(ulong id, uchar value);
+
+ virtual void LoadMtx(const DrawInfo &info);
+
+ virtual void AllocStringBuffer(u16 size);
+ virtual void FreeStringBuffer();
+
+ virtual u16 SetString(const wchar_t *str, u16 destOffset = 0);
+ virtual u16 SetString(const wchar_t *str, u16 destOffset, u16 length);
+
+ wchar_t *stringBuf;
+
+ ut::Color colour1, colour2;
+ void *font; // actually a ut::ResFont or whatever
+
+ float fontSizeX, fontSizeY;
+ float lineSpace, charSpace;
+
+ void *tagProc; // actually a TagProcessor
+
+ u16 bufferLength;
+ u16 stringLength;
+
+ u8 alignment;
+ u8 flags;
+ };
}
@@ -663,17 +707,21 @@ extern "C" void GXDrawDone(); // 801C4FE0 namespace m2d {
class Base_c /*: public nw4r::ut::Link what's this? */ {
+ public:
u32 _00;
u32 _04;
Base_c();
virtual ~Base_c();
- virtual void _vf0C();
+ virtual void draw(); // don't call this directly
+
+ void scheduleForDrawing();
- u8 _0C;
+ u8 drawOrder;
};
class Simple_c : public Base_c {
+ public:
nw4r::lyt::Layout layout;
nw4r::lyt::DrawInfo drawInfo;
@@ -686,7 +734,7 @@ namespace m2d { Simple_c();
~Simple_c();
- void _vf0C();
+ void draw();
virtual void _vf10();
virtual void _vf14();
};
@@ -696,6 +744,7 @@ namespace m2d { namespace EGG {
class Frustum {
+ public:
GXProjectionType projType;
int isCentered;
float width;
@@ -792,10 +841,13 @@ struct Tree { typedef bool (*ChainedFunc)(void*);
-struct FunctionChain {
+class FunctionChain {
+public:
ChainedFunc *functions;
u16 count;
u16 current;
+
+ void setup(ChainedFunc *functions, u16 count); // 8015F740
};
@@ -850,6 +902,8 @@ public: fBase_c *GetParent();
fBase_c *GetChild();
fBase_c *GetNext();
+
+ bool hasUninitialisedProcesses(); // 80162B60
};
class dBase_c : public fBase_c {
@@ -876,7 +930,7 @@ public: class dScene_c : public dBase_c {
public:
- FunctionChain *funcChain;
+ FunctionChain *ptrToInitChain;
dScene_c();
@@ -890,6 +944,11 @@ public: int afterDraw();
~dScene_c();
+
+
+ void setInitChain(FunctionChain &initChain) {
+ ptrToInitChain = &initChain;
+ }
};
class dActor_c : public dBase_c {
@@ -1081,7 +1140,7 @@ public: dDvdLoader_c(); // 8008F140
virtual ~dDvdLoader_c(); // 8008F170
- void *load(const char *filename, u8 unk = 0); // 8008F1B0
+ void *load(const char *filename, u8 unk = 0, void *heap = 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
@@ -1098,5 +1157,152 @@ private: +// More layout crap
+// This file REALLY needs to be reorganised.
+
+namespace nw4r {
+namespace lyt {
+
+ class ResourceAccessor {
+ public:
+ ResourceAccessor();
+ virtual ~ResourceAccessor();
+
+ virtual void *GetResource(u32 dirKey, const char *filename, u32 *sizePtr) = 0;
+ virtual void *GetFont(const char *name);
+ };
+
+ class ArcResourceAccessor : public ResourceAccessor {
+ public:
+ ArcResourceAccessor();
+ ~ArcResourceAccessor();
+
+ bool Attach(void *data, const char *rootDirName);
+ void *GetResource(u32 dirKey, const char *filename, u32 *sizePtr);
+ void *GetFont(const char *name);
+
+ ARCHandle arc;
+ u32 unk_20;
+ ut::LinkList list; // 0x24
+ char rootDirName[0x80]; // 0x30
+ // class ends at 0xB0
+ };
+
+}
+}
+
+namespace m2d {
+ class ResAcc_c {
+ public:
+ ResAcc_c();
+ virtual ~ResAcc_c();
+ virtual void initialSetup();
+
+ nw4r::lyt::ResourceAccessor *resAccPtr; // 0x04
+ u32 unk_08; // 0x08
+ nw4r::lyt::ArcResourceAccessor resAcc; // 0x0C
+ // class ends at 0xBC
+ };
+
+ class ResAccLoader_c : public ResAcc_c {
+ public:
+ ResAccLoader_c();
+ ~ResAccLoader_c();
+
+ void *buffer;
+ dDvdLoader_c loader; // 0xC0
+ // ends at 0xD4
+
+ bool loadArc(const char *path);
+ bool loadArc(const char *path, u8 unk);
+ void free();
+ };
+
+ class EmbedLayoutBase_c : public Base_c {
+ public:
+ EmbedLayoutBase_c();
+ ~EmbedLayoutBase_c();
+
+ void draw(); // don't call this directly
+
+ virtual void update();
+ virtual bool build(const char *brlytPath, ResAcc_c *resAcc = 0);
+
+ nw4r::lyt::Pane *getRootPane();
+ nw4r::lyt::Pane *findPaneByName(const char *name) const;
+ nw4r::lyt::TextBox *findTextBoxByName(const char *name) const;
+ nw4r::lyt::Pane *findPictureByName(const char *name) const; // TODO: change to others
+ nw4r::lyt::Pane *findWindowByName(const char *name) const;
+
+ void animate();
+ void calculateMtx();
+
+ nw4r::lyt::Layout layout; // 0x10 -- actually m2d::Layout_c but I'll add that later
+ nw4r::lyt::DrawInfo drawInfo; // 0x30
+ void *unk_84; // 0x84 -- a ResAcc? referenced in Build()
+ float posX; // 0x88
+ float posY; // 0x8C
+ float clipX; // 0x90
+ float clipY; // 0x94
+ float clipWidth; // 0x98
+ float clipHeight; // 0x9C
+ bool clippingEnabled; // 0xA0
+ u32 hasAnimations; // 0xA4
+ u32 unk_A8; // 0xA8
+ };
+
+ class EmbedLayout_c : public EmbedLayoutBase_c {
+ public:
+ EmbedLayout_c();
+ ~EmbedLayout_c();
+
+ bool build(const char *brlytPath, ResAcc_c *resAcc = 0);
+
+ bool loadArc(const char *name, bool isLangSpecific);
+ bool loadArc(const char *name, u8 unk, bool isLangSpecific);
+
+ bool loadArcForRegion(const char *name); // uses EU/Layout/$name
+
+ // there's also a NedEU one, but should it really be listed here...?
+
+ bool free();
+
+ // does NSMBW even use consts? I have no idea. maybe not
+
+ void getPanes(const char **names, nw4r::lyt::Pane *output, int count) const;
+ void getWindows(const char **names, nw4r::lyt::Pane *output, int count) const; // TODO: change to others
+ void getPictures(const char **names, nw4r::lyt::Pane *output, int count) const;
+ void getTextBoxes(const char **names, nw4r::lyt::TextBox *output, int count) const;
+
+ void setLangStrings(const char **names, const int *msgIDs, int category, int count);
+
+ void loadAnimations(const char **names, int count);
+ void loadGroups(const char **names, int *animLinkIDs, int count);
+
+ void enableNonLoopAnim(int num, bool goToLastFrame = false);
+ void enableLoopAnim(int num);
+ void resetAnim(int num, bool goToLastFrame = false);
+ void disableAnim(int num);
+ void disableAllAnimations();
+
+ bool isAnimOn(int num = -1);
+ bool isAnyAnimOn();
+
+ void execAnimations();
+
+ ResAccLoader_c loader; // 0xAC
+ void *brlanHandlers; // 0x180
+ void *grpHandlers; // 0x184
+ bool *animsEnabled; // 0x188
+ int brlanCount; // 0x18C
+ int grpCount; // 0x190
+ int lastAnimTouched; // 0x194
+
+ private:
+ void fixTextBoxesRecursively(nw4r::lyt::Pane *pane);
+ };
+}
+
+
#endif
|