summaryrefslogtreecommitdiff
path: root/include/g3dhax.h
blob: c3aeaefebb3d9abbe9bcc0897936311696bc3b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
// nw4r::g3d wrapper

namespace nw4r {
namespace g3d {

class ResName {
public:
	const char *name;

	ResName(const char *p = NULL) {
		name = p;
	}
};

class ResFile {
public:
	void * /*ResFileData*/ data;

	ResFile(void *p = NULL) {
		data = p;
	}

	void Init();
	bool CheckRevision() const;

	void * /*ResMdl*/ GetResMdl(const char *str) const;
	void * /*ResPltt*/ GetResPltt(const ResName n) const;
	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;
	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;
	void * /*ResAnmScn*/ GetResAnmScn(const char *str) const;

	bool Bind(ResFile rhs);
};

void *__ScnMdlSimple__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResMdl*/ mdl,
	int nView = 1);


void *__ScnMdl__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResMdl*/ mdl,
	u32 bufferOption,
	int nView = 1);


void *__AnmObjChrRes__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResAnmChr*/ resAnm,
	void * /*ResMdl*/ resMdl,
	bool bHasCache);


void *__AnmObjVisRes__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResAnmVis*/ resAnm,
	void * /*ResMdl*/ resMdl);


void *__AnmObjTexPatRes__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResAnmTexPat*/ resAnm,
	void * /*ResMdl*/ resMdl,
	bool bHasCache);


void *__AnmObjTexSrtRes__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResAnmTexSrt*/ resAnm,
	void * /*ResMdl*/ resMdl,
	bool bHasCache);


void *__AnmObjMatClrRes__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResAnmMatClr*/ resAnm,
	void * /*ResMdl*/ resMdl,
	bool bHasCache);


void *__AnmObjShpRes__Construct(
	void * /*MEMAllocator*/ pHeap,
	u32 *pSize,
	void * /*ResAnmShp*/ resAnm,
	void * /*ResMdl*/ resMdl,
	bool bHasCache);



bool InsertIntoScene(void *scnObj); // 80164F90

extern void *g3dMemAllocator; // 8042A6A8

inline void *ConstructScnMdlSimple(void *mdl, int nView = 1) {
	return __ScnMdlSimple__Construct(g3dMemAllocator, 0, mdl, nView);
}

inline void *ConstructScnMdl(void *mdl, u32 bufferOption, int nView = 1) {
	return __ScnMdl__Construct(g3dMemAllocator, 0, mdl, bufferOption, nView);
}



}
}


class mHeapAllocator_c { // Actually that weird subclass. INCOMPLETE!!
public:
	char data1[0x10];

	mHeapAllocator_c();
	virtual ~mHeapAllocator_c();
	virtual void *alloc(u32 size);
	virtual void free(void *block);

	bool link(s32 size, void *heap, const char *name, int align);
	u32 unlink();

	char data2[8];
};

namespace m3d {

	class mdl_c {
	public:
		mdl_c();
		virtual ~mdl_c();

		virtual void _vf0C();
		virtual void _vf10();
		virtual bool scheduleForDrawing();
		virtual void bindAnim(void *anim, float boo);
		virtual void _vf1C();

		bool setup(void *model, void *allocator, u32 bufferOption, int nView, u32 *size);
		void oneSetupType();
		void sub_80064BF0();

		void setDrawMatrix(const Mtx matrix);

		char data[0x3C];
	};
};



void SetupTextures_Player(m3d::mdl_c *model, int sceneID); // 800B3E50
void SetupTextures_Map(m3d::mdl_c *model, int sceneID); // 800B3F50
void SetupTextures_Boss(m3d::mdl_c *model, int sceneID); // 800B4050
void SetupTextures_Enemy(m3d::mdl_c *model, int sceneID); // 800B4170
void SetupTextures_MapObj(m3d::mdl_c *model, int sceneID); // 800B42B0
void SetupTextures_Item(m3d::mdl_c *model, int sceneID); // 800B43D0