diff options
author | Treeki <treeki@gmail.com> | 2011-10-04 22:07:32 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-10-04 22:07:32 +0200 |
commit | fc1043304e257f0924dbf850301eec76106ad565 (patch) | |
tree | 833ce18931d1fb092b45cb674d5cdc20dbbee8e4 /include | |
parent | e0ff484a06fd3f068e29eff4a125f61fbfd174c4 (diff) | |
download | kamek-master.tar.gz kamek-master.zip |
Diffstat (limited to '')
-rw-r--r-- | include/g3dhax.h | 176 |
1 files changed, 167 insertions, 9 deletions
diff --git a/include/g3dhax.h b/include/g3dhax.h index ac5ba80..ddeb3ee 100644 --- a/include/g3dhax.h +++ b/include/g3dhax.h @@ -1,6 +1,8 @@ #ifndef __KAMEK_G3DHAX_H #define __KAMEK_G3DHAX_H +#include <common.h> + // nw4r::g3d wrapper namespace nw4r { @@ -26,6 +28,10 @@ namespace nw4r { void * /*ResMat*/ GetResMat(const char *str) const; }; + class ResAnmChr { public: void* data; ResAnmChr(void *p = NULL) { data = p; } }; + class ResAnmTexPat { public: void* data; ResAnmTexPat(void *p = NULL) { data = p; } }; + class ResAnmTexSrt { public: void* data; ResAnmTexSrt(void *p = NULL) { data = p; } }; + class ResFile { public: void * /*ResFileData*/ data; @@ -42,11 +48,11 @@ namespace nw4r { void * /*ResTex*/ GetResTex(const char *str) const; void * /*ResTex*/ GetResTex(const ResName n) const; void * /*ResTex*/ GetResTex(u32 idx) const; - void * /*ResAnmChr*/ GetResAnmChr(const char *str) const; + ResAnmChr GetResAnmChr(const char *str) const; void * /*ResAnmVis*/ GetResAnmVis(const char *str) const; void * /*ResAnmClr*/ GetResAnmClr(const char *str) const; - void * /*ResAnmTexPat*/ GetResAnmTexPat(const char *str) const; - void * /*ResAnmTexSrt*/ GetResAnmTexSrt(const char *str) const; + ResAnmTexPat GetResAnmTexPat(const char *str) const; + ResAnmTexSrt GetResAnmTexSrt(const char *str) const; void * /*ResAnmScn*/ GetResAnmScn(const char *str) const; bool Bind(ResFile rhs); @@ -133,19 +139,40 @@ namespace nw4r { } -class mHeapAllocator_c { // Actually that weird subclass. INCOMPLETE!! +namespace EGG { + class Allocator { + public: + char data1[0x10]; + + Allocator(void *heap, s32 align); + virtual ~Allocator(); + + virtual void *alloc(u32 size); + virtual void free(void *block); + + void *heap; + s32 alignment; + }; +} + +class mAllocator_c : public EGG::Allocator { public: - char data1[0x10]; + mAllocator_c(); + ~mAllocator_c(); + + void *alloc(u32 size); + void free(void *block); +}; +class mHeapAllocator_c : public mAllocator_c { + public: mHeapAllocator_c(); - virtual ~mHeapAllocator_c(); - virtual void *alloc(u32 size); - virtual void free(void *block); + ~mHeapAllocator_c(); bool link(s32 size, void *heap, const char *name, int align); u32 unlink(); - char data2[8]; + bool linkAndBecomeCurrentHeap(s32 size, void *heap, const char *name, int align); }; namespace m3d { @@ -186,6 +213,8 @@ namespace m3d { void *scnObj; }; + class banm_c; + class mdl_c { public: mdl_c(); @@ -203,8 +232,137 @@ namespace m3d { void setDrawMatrix(const Mtx matrix); + void bindAnim(banm_c *animation, float unk); + char data[0x3C]; }; + + + + + class banm_c { + public: + virtual ~banm_c(); + + virtual int _vf0C() = 0; + virtual void detach(); + virtual void process(); + + bool testAnmFlag(u32 flag); /* nw4r::g3d::AnmObj::AnmFlag */ + + void *anmObj; // should be NW4R AnmObj class + void *frameHeap; // should be a frame heap + mAllocator_c allocator; + + private: + void setupHeap(mAllocator_c *allocator, u32 *sizeOutput); + float _getCurrentFrame(); + float _setCurrentFrame(float value); + float _getUpdateRate(); + float _setUpdateRate(float value); + }; + + class fanm_c : public banm_c { + public: + fanm_c(); + ~fanm_c(); + + void process(); + + void _80169050(float _unk, float updateRate, float _unk2, u8 _unk3); + void setCurrentFrame(float value); + bool isAnimationDone(); // I think + bool querySomething(float value); + + // 28 might be Max Frame? + float _28, _2C, currentFrame; + u8 _34; + }; + + class anmChr_c : public fanm_c { + public: + ~anmChr_c(); + int _vf0C(); + + bool setup(nw4r::g3d::ResMdl modelRes, nw4r::g3d::ResAnmChr anmRes, + mAllocator_c *allocator, u32 *sizeOutPtr); + + void bind(/*b*/mdl_c *model, nw4r::g3d::ResAnmChr anmRes, int unk); + }; + + class anmTexPat_c : public banm_c { + public: + class child_c : public fanm_c { + ~child_c(); + int _vf0C(); + + // some methods missing + }; + + // some methods missing + + ~anmTexPat_c(); + int _vf0C(); + void detach(); + void process(); + + bool setup(nw4r::g3d::ResMdl modelRes, nw4r::g3d::ResAnmTexPat anmRes, + mAllocator_c *allocator, u32 *sizeOutPtr, int count); + + void bindEntry(/*b*/mdl_c *model, nw4r::g3d::ResAnmTexPat resource, + int entryNumber, int _param4); + + float getFrameForEntry(int number); + void setFrameForEntry(float value, int number); + float getUpdateRateForEntry(int number); + void setUpdateRateForEntry(float value, int number); + bool isEntryAnimationDone(int number); + bool queryEntrySomething(float value, int number); + void setEntryByte34(u8 value, int number); + float getEntryField28(int number); + + private: + child_c *children; + + void processOneEntry(int number); + }; + + class anmTexSrt_c : public banm_c { + public: + class child_c : public fanm_c { + ~child_c(); + int _vf0C(); + + // some methods missing + }; + + // some methods missing + + ~anmTexSrt_c(); + int _vf0C(); + void detach(); + void process(); + + bool setup(nw4r::g3d::ResMdl modelRes, nw4r::g3d::ResAnmTexSrt anmRes, + mAllocator_c *allocator, u32 *sizeOutPtr, int count); + + void bindEntry(/*b*/mdl_c *model, nw4r::g3d::ResAnmTexSrt resource, + int entryNumber, int _param4); + + float getFrameForEntry(int number); + void setFrameForEntry(float value, int number); + float getUpdateRateForEntry(int number); + void setUpdateRateForEntry(float value, int number); + bool isEntryAnimationDone(int number); + void setEntryByte34(u8 value, int number); + float getEntryField28(int number); + float getEntryField2C(int number); + + private: + child_c *children; + + void processOneEntry(int number); + }; }; |