summaryrefslogtreecommitdiff
path: root/src/koopatlas/map.h
blob: 05833a257216ca6e2080884d377a7f83a672ea22 (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
#ifndef __KOOPATLAS_MAP_H
#define __KOOPATLAS_MAP_H

#include "koopatlas/core.h"

// Can't remember why I had this. Who cares
#define GEKKO
#include "rvl/mtx.h"
#include "rvl/GXEnum.h"
#include "rvl/GXStruct.h"
#include "rvl/GXTransform.h"
#include "rvl/GXGeometry.h"
#include "rvl/GXDispList.h"
#include "rvl/GXLighting.h"
#include "rvl/GXTev.h"
#include "rvl/GXTexture.h"
#include "rvl/GXCull.h"
#include "rvl/GXPixel.h"
#include "rvl/GXBump.h"
#include "rvl/GXVert.h"
#include "rvl/vifuncs.h"

class dWMMap_c : public dBase_c {
	public:
		dWMMap_c();

		int onCreate();
		int onDelete();
		int onExecute();
		int onDraw();

		class renderer_c : public m3d::proc_c {
			public:
				mAllocator_c allocator;

				void drawOpa();
				void drawXlu();

			private:
				void drawLayers();

				void beginRendering();
				void endRendering();

				void renderTileLayer(dKPLayer_s *layer, dKPLayer_s::sector_s *sector);
				void renderDoodadLayer(dKPLayer_s *layer);

				void loadTexture(GXTexObj *obj);

				void loadCamera();
				void loadCamera(Mtx m);

				GXTexObj *currentTexture;
				Mtx renderMtx;
				float baseZ;

				int minX, minY, maxX, maxY;
		};
		
		renderer_c renderer;
		enum EffRenderCount { EFFECT_RENDERER_COUNT = 12 };
		BGGMEffectRenderer effectRenderers[EFFECT_RENDERER_COUNT];

		mEf::es2 effects[7];
		void doEffects();

		mHeapAllocator_c allocator;
		m3d::mdl_c bgModel;
		m3d::anmTexSrt_c bgSrtAnm;
		mMtx bgMatrix;

		bool showLaunchStar;
		float launchStarX, launchStarY;
		m3d::mdl_c launchStarModel;
		m3d::anmChr_c launchStarAnm;
		mMtx launchStarMatrix;

		void spinLaunchStar();

		void renderPathLayer(dKPLayer_s *layer);

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

#endif