start rationalizing map gen
This commit is contained in:
parent
f987630754
commit
d82c3ccbea
26
w/w.c
26
w/w.c
|
@ -40,6 +40,7 @@
|
|||
#define TILE_DOOR 'd'
|
||||
#define TILE_START 's'
|
||||
#define TILE_UNKNOWN '?'
|
||||
#define TILE_UNUSED '.'
|
||||
|
||||
#define ITEM_POTION '0'
|
||||
#define ITEM_TRUC '1'
|
||||
|
@ -462,7 +463,6 @@ void clearscreen()
|
|||
|
||||
void init()
|
||||
{
|
||||
memset(&map, TILE_UNKNOWN, MAP_SIZE * MAP_SIZE);
|
||||
srand(time(NULL));
|
||||
FILE* file = fopen(statepath, "r");
|
||||
if (file)
|
||||
|
@ -597,25 +597,17 @@ char gentile()
|
|||
|
||||
void initmap()
|
||||
{
|
||||
// init map
|
||||
for (int i = 0; i < 15; i++)
|
||||
{
|
||||
setatpos(0, i, TILE_WALL);
|
||||
setatpos(14, i, TILE_WALL);
|
||||
setatpos(i, 0, TILE_WALL);
|
||||
setatpos(i, 14, TILE_WALL);
|
||||
}
|
||||
memset(&map, TILE_UNKNOWN, MAP_SIZE * MAP_SIZE);
|
||||
setatpos(1, 13, TILE_FREE);
|
||||
|
||||
char c = gentile();
|
||||
setatpos(1, 12, c);
|
||||
if (c == TILE_WALL) freedom--;
|
||||
else if (c == TILE_FREE)
|
||||
{
|
||||
setatpos(1, 11, c);
|
||||
}
|
||||
setatpos(0, 13, TILE_WALL);
|
||||
setatpos(0, 11, TILE_WALL);
|
||||
setatpos(1, 14, TILE_WALL);
|
||||
setatpos(3, 14, TILE_WALL);
|
||||
|
||||
c = gentile();
|
||||
for (int x = 0; x < MAP_SIZE; x += 2)
|
||||
for (int y = 14; y >=0; y -= 2)
|
||||
setatpos(x, y, TILE_UNUSED);
|
||||
}
|
||||
|
||||
void update(char* command)
|
||||
|
|
Loading…
Reference in New Issue