summaryrefslogtreecommitdiff
path: root/src/wm_map.h
blob: 651c071adedb6bf30a0b8ef75672a5a400c0e630 (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
#include <common.h>
#include <rvl/mtx.h>
#include <g3dhax.h>
#include <game.h>

struct WMSceneDataNode {
	u32 nodeKey;
	u32 brresKey;
	u32 lmType;
	const char *modelName;	// Actually an offset before dWMMap_c loads the data
	Mtx matrix;
};

struct WMSceneDataHeader {
	u32 magic;
	u32 nodeCount;
	WMSceneDataNode nodes[1];	// dynamic length array
};


// todo: make this subclass mdl_c maybe? dunno...
class WMSceneNode {
public:
	WMSceneDataNode *baseData;
	nw4r::g3d::ResMdl resMdl;
	m3d::mdl_c model;

	void loadFrom(WMSceneDataNode *data, mHeapAllocator_c *allocator);
	void draw();
	void updateAlpha(const char *materialName, u8 alpha);
};


class dWMMap_c : public dBase_c {
public:
	int onCreate();
	int onDelete();
	int onExecute();
	int onDraw();

	mHeapAllocator_c allocator;

	WMSceneDataHeader *data;
	WMSceneNode *nodes;

	static dWMMap_c *build();
	static dWMMap_c *instance;
};