summaryrefslogtreecommitdiff
path: root/src/wm_map.h
blob: 2ca55a05729550c2345b26fe34379dabad23d2c5 (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
#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;
	m3d::mdl_c model;

	void loadFrom(WMSceneDataNode *data, mHeapAllocator_c *allocator);
	void draw();
};


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;
};