summary refs log tree commit diff stats
path: root/src/game.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.h')
-rw-r--r--src/game.h40
1 files changed, 2 insertions, 38 deletions
diff --git a/src/game.h b/src/game.h index 446680a..40ace3d 100644 --- a/src/game.h +++ b/src/game.h
@@ -16,20 +16,6 @@ constexpr int TilesetIndex(int x, int y) {
16 return x + y * 24; 16 return x + y * 24;
17} 17}
18 18
19enum class Tile {
20 Floor,
21 Wall,
22 Dust,
23 Lamp
24};
25
26enum class Source {
27 None,
28 Dust,
29 Lamp,
30 Player
31};
32
33enum class LoseState { 19enum class LoseState {
34 None, 20 None,
35 PoppingLamps, 21 PoppingLamps,
@@ -52,8 +38,6 @@ struct Input {
52 } 38 }
53}; 39};
54 40
55using coord = std::tuple<int, int>;
56
57struct Kickup { 41struct Kickup {
58 int x; 42 int x;
59 int y; 43 int y;
@@ -64,18 +48,6 @@ struct Kickup {
64 std::set<coord> front; 48 std::set<coord> front;
65}; 49};
66 50
67struct MapData {
68 Tile tile = Tile::Floor;
69 bool lit = false;
70 bool wasLit = false;
71 size_t dustLife = 0;
72 Source lightType = Source::None;
73 int lightRadius = 0;
74 std::set<coord> litTiles;
75 int renderId = -1;
76 bool dirtyRender = true;
77};
78
79class Game { 51class Game {
80public: 52public:
81 53
@@ -89,7 +61,7 @@ public:
89 bool quit = false; 61 bool quit = false;
90 LoseState losing = LoseState::None; 62 LoseState losing = LoseState::None;
91 63
92 Map<MapData> map; 64 Map map;
93 std::list<Kickup> kickups; 65 std::list<Kickup> kickups;
94 int litSpots = 0; 66 int litSpots = 0;
95 bool dirtyLighting = true; 67 bool dirtyLighting = true;
@@ -105,18 +77,10 @@ public:
105 Animation playerAnim {"../res/player_anim.txt"}; 77 Animation playerAnim {"../res/player_anim.txt"};
106 78
107 int maxZoom = INIT_ZOOM; 79 int maxZoom = INIT_ZOOM;
108
109 int curZoom = INIT_ZOOM; 80 int curZoom = INIT_ZOOM;
110 int curBoundX = map.getLeft();
111 int curBoundY = map.getTop();
112
113 bool zooming = false; 81 bool zooming = false;
114 int zoomProgress = 0; 82 int zoomProgress = 0;
115 int zoomLength; 83 int zoomLength;
116 int lastZoomTop;
117 int lastZoomLeft;
118 int lastZoomWidth;
119 int lastZoomHeight;
120 84
121 Input keystate; 85 Input keystate;
122 bool firstInput = false; 86 bool firstInput = false;
@@ -159,7 +123,7 @@ private:
159 123
160 void processKickup(); 124 void processKickup();
161 125
162 void growMap(size_t zoom); 126 void loadMap();
163 127
164 void setZoom(size_t zoom); 128 void setZoom(size_t zoom);
165 129