@@ -173,6 +173,10 @@ void TerrainGen::generate(GridMap *myGridMap, int height, int width, int depth,
173173 // bool change3left = n3 > n4; // n3 -> n4
174174 // bool change4up = n2 > n4; // n2 -> n4
175175
176+ // -------------------------//
177+ // Basic Tiles
178+ // -------------------------//
179+
176180 // Water's Water
177181 // +---+---+
178182 // | 0 | 0 |
@@ -195,6 +199,10 @@ void TerrainGen::generate(GridMap *myGridMap, int height, int width, int depth,
195199 tileMap[x][y] = GROUND;
196200 }
197201
202+ // -------------------------//
203+ // Water Edges
204+ // -------------------------//
205+
198206 // Water's Edge South
199207 // +----+----+ +---+---+
200208 // | n1 | n2 | | 0 | 0 |
@@ -204,7 +212,7 @@ void TerrainGen::generate(GridMap *myGridMap, int height, int width, int depth,
204212 //
205213 if (n1 == 0 && n2 == 0 && n3 > 0 && n4 > 0 ) {
206214 tileMap[x][y] = WATER_EDGE;
207- tilesRotation = 16 ; // Facing South
215+ tilesRotation = SOUTH;
208216 }
209217 // Water's Edge North
210218 // +----+----+ +---+---+
@@ -215,7 +223,7 @@ void TerrainGen::generate(GridMap *myGridMap, int height, int width, int depth,
215223 //
216224 else if (n1 > 0 && n2 > 0 && n3 == 0 && n4 == 0 ) {
217225 tileMap[x][y] = WATER_EDGE;
218- tilesRotation = 0 ; // Facing North
226+ tilesRotation = NORTH;
219227 }
220228 // Water's Edge East
221229 // +----+----+ +---+---+
@@ -226,7 +234,7 @@ void TerrainGen::generate(GridMap *myGridMap, int height, int width, int depth,
226234 //
227235 else if (n1 == 0 && n3 == 0 && n2 > 0 && n4 > 0 ) {
228236 tileMap[x][y] = WATER_EDGE;
229- tilesRotation = 10 ; // Facing East
237+ tilesRotation = EAST;
230238
231239 }
232240 // Water's Edge West
@@ -238,16 +246,113 @@ void TerrainGen::generate(GridMap *myGridMap, int height, int width, int depth,
238246 //
239247 else if (n2 == 0 && n4 == 0 && n1 > 0 && n3 > 0 ) {
240248 tileMap[x][y] = WATER_EDGE;
241- tilesRotation = 22 ; // Facing West
249+ tilesRotation = WEST;
242250 }
243251
244- // Water's Corner's
252+ // -------------------------//
253+ // Water Corners
254+ // -------------------------//
255+
256+ // Water's Corner North
257+ // +----+----+ +---+---+
258+ // | n1 | n2 | | 0 | 0 |
259+ // +----+----+ +---+---+
260+ // | n3 | n4 | | 0 | 1 |
261+ // +----+----+ +---+---+
262+ //
245263 if (n1 == 0 && n2 == 0 && n3 == 0 && n4 > 0 ) {
246- tileMap[x][y] = WATER_CORNER; // Land in SE
247- } else if (n1 > 0 && n2 == 0 && n3 == 0 && n4 == 0 ) {
248- tileMap[x][y] = WATER_CORNER; // Land in NW
264+ tileMap[x][y] = WATER_CORNER;
265+ tilesRotation = NORTH;
266+ }
267+ // Water's Corner South
268+ // +----+----+ +---+---+
269+ // | n1 | n2 | | 1 | 0 |
270+ // +----+----+ +---+---+
271+ // | n3 | n4 | | 0 | 0 |
272+ // +----+----+ +---+---+
273+ //
274+ else if (n1 > 0 && n2 == 0 && n3 == 0 && n4 == 0 ) {
275+ tileMap[x][y] = WATER_CORNER;
276+ tilesRotation = SOUTH;
277+ }
278+ // Water's Corner East
279+ // +----+----+ +---+---+
280+ // | n1 | n2 | | 0 | 1 |
281+ // +----+----+ +---+---+
282+ // | n3 | n4 | | 0 | 0 |
283+ // +----+----+ +---+---+
284+ //
285+ else if (n1 == 0 && n2 > 0 && n3 == 0 && n4 == 0 ) {
286+ tileMap[x][y] = WATER_CORNER;
287+ tilesRotation = EAST;
288+ }
289+ // Water's Corner West
290+ // +----+----+ +---+---+
291+ // | n1 | n2 | | 0 | 0 |
292+ // +----+----+ +---+---+
293+ // | n3 | n4 | | 1 | 0 |
294+ // +----+----+ +---+---+
295+ //
296+ else if (n1 == 0 && n2 == 0 && n3 > 0 && n4 == 0 ) {
297+ tileMap[x][y] = WATER_CORNER;
298+ tilesRotation = WEST;
249299 }
250300
301+ // -------------------------//
302+ // Cliff's & Ramp's Corner
303+ // -------------------------//
304+
305+ // TODO : Decide how cliffs vs ramps are picked
306+
307+ // Corner North
308+ // +----+----+ +---+---+
309+ // | n1 | n2 | | 1 | 1 |
310+ // +----+----+ +---+---+
311+ // | n3 | n4 | | 1 | 2 |
312+ // +----+----+ +---+---+
313+ //
314+ if (n1 > 0 && n2 > 0 && n3 > 0 && n4 > 0 && n4 > n1 && n4 > n2 && n4 > n3) {
315+ tileMap[x][y] = CLIFF_CORNER;
316+ tilesRotation = NORTH;
317+ }
318+ // Corner South
319+ // +----+----+ +---+---+
320+ // | n1 | n2 | | 2 | 1 |
321+ // +----+----+ +---+---+
322+ // | n3 | n4 | | 1 | 1 |
323+ // +----+----+ +---+---+
324+ //
325+ else if (n1 > 0 && n2 > 0 && n3 > 0 && n4 > 0 && n1 > n2 && n1 > n3 && n1 > n4) {
326+ tileMap[x][y] = CLIFF_CORNER;
327+ tilesRotation = SOUTH;
328+ }
329+ // Corner East
330+ // +----+----+ +---+---+
331+ // | n1 | n2 | | 1 | 2 |
332+ // +----+----+ +---+---+
333+ // | n3 | n4 | | 1 | 1 |
334+ // +----+----+ +---+---+
335+ //
336+ else if (n1 > 0 && n2 > 0 && n3 > 0 && n4 > 0 && n2 > n1 && n2 > n3 && n2 > n4) {
337+ tileMap[x][y] = CLIFF_CORNER;
338+ tilesRotation = EAST;
339+ }
340+ // Corner East
341+ // +----+----+ +---+---+
342+ // | n1 | n2 | | 0 | 0 |
343+ // +----+----+ +---+---+
344+ // | n3 | n4 | | 1 | 0 |
345+ // +----+----+ +---+---+
346+ //
347+ else if (n1 > 0 && n2 > 0 && n3 > 0 && n4 > 0 && n3 > n1 && n3 > n2 && n3 > n4) {
348+ tileMap[x][y] = CLIFF_CORNER;
349+ tilesRotation = WEST;
350+ }
351+
352+ // -------------------------//
353+ // Cliff's & Ramp's Edges
354+ // -------------------------//
355+
251356 // Cliff's Edge
252357 // +----+----+ +---+---+
253358 // | n1 | n2 | | 2 | 1 |
@@ -417,13 +522,15 @@ void TerrainGen::generate(GridMap *myGridMap, int height, int width, int depth,
417522
418523 /* ****************************************************
419524
420- Grid Map Cell Setter
525+ Grid Map Cell Setter
421526
422- *****************************************************/
527+ *****************************************************/
423528
424529 myGridMap->set_cell_item (Vector3i (x, elevation, y), tileMap[x][y], rotationOrientation);
425530 }
426531 }
532+
533+ // TODO : Another run through required to check adjacent tiles, especially tiles touching corner tiles. TO ensure a cliff corner connects to cliffs
427534}
428535
429536TerrainGen::TileType TerrainGen::isCornerTile (int x, int y, vector<vector<TileType>> &tileMap) {
0 commit comments