diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-14 14:11:05 -0400 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2022-03-14 14:11:05 -0400 |
commit | 7cd515fcfa1a5aac5605fcc63381033563fbf5d7 (patch) | |
tree | 2a375db2fe6c1476a111c1f3e83e50fd2b68124e /src/game.h | |
parent | 042da1570181dc80ee76860582f6a3c97641c14a (diff) | |
download | ether-7cd515fcfa1a5aac5605fcc63381033563fbf5d7.tar.gz ether-7cd515fcfa1a5aac5605fcc63381033563fbf5d7.tar.bz2 ether-7cd515fcfa1a5aac5605fcc63381033563fbf5d7.zip |
map is now "infinite" using chunks that dynamically load like in diamond&pearl
game is also slow as shit now
Diffstat (limited to 'src/game.h')
-rw-r--r-- | src/game.h | 40 |
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 | ||
19 | enum class Tile { | ||
20 | Floor, | ||
21 | Wall, | ||
22 | Dust, | ||
23 | Lamp | ||
24 | }; | ||
25 | |||
26 | enum class Source { | ||
27 | None, | ||
28 | Dust, | ||
29 | Lamp, | ||
30 | Player | ||
31 | }; | ||
32 | |||
33 | enum class LoseState { | 19 | enum class LoseState { |
34 | None, | 20 | None, |
35 | PoppingLamps, | 21 | PoppingLamps, |
@@ -52,8 +38,6 @@ struct Input { | |||
52 | } | 38 | } |
53 | }; | 39 | }; |
54 | 40 | ||
55 | using coord = std::tuple<int, int>; | ||
56 | |||
57 | struct Kickup { | 41 | struct 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 | ||
67 | struct 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 | |||
79 | class Game { | 51 | class Game { |
80 | public: | 52 | public: |
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 | ||