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_DOOR 'd'
|
||||||
#define TILE_START 's'
|
#define TILE_START 's'
|
||||||
#define TILE_UNKNOWN '?'
|
#define TILE_UNKNOWN '?'
|
||||||
|
#define TILE_UNUSED '.'
|
||||||
|
|
||||||
#define ITEM_POTION '0'
|
#define ITEM_POTION '0'
|
||||||
#define ITEM_TRUC '1'
|
#define ITEM_TRUC '1'
|
||||||
|
@ -462,7 +463,6 @@ void clearscreen()
|
||||||
|
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
memset(&map, TILE_UNKNOWN, MAP_SIZE * MAP_SIZE);
|
|
||||||
srand(time(NULL));
|
srand(time(NULL));
|
||||||
FILE* file = fopen(statepath, "r");
|
FILE* file = fopen(statepath, "r");
|
||||||
if (file)
|
if (file)
|
||||||
|
@ -597,25 +597,17 @@ char gentile()
|
||||||
|
|
||||||
void initmap()
|
void initmap()
|
||||||
{
|
{
|
||||||
// init map
|
memset(&map, TILE_UNKNOWN, MAP_SIZE * MAP_SIZE);
|
||||||
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);
|
|
||||||
}
|
|
||||||
setatpos(1, 13, TILE_FREE);
|
setatpos(1, 13, TILE_FREE);
|
||||||
|
|
||||||
char c = gentile();
|
setatpos(0, 13, TILE_WALL);
|
||||||
setatpos(1, 12, c);
|
setatpos(0, 11, TILE_WALL);
|
||||||
if (c == TILE_WALL) freedom--;
|
setatpos(1, 14, TILE_WALL);
|
||||||
else if (c == TILE_FREE)
|
setatpos(3, 14, TILE_WALL);
|
||||||
{
|
|
||||||
setatpos(1, 11, c);
|
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
void update(char* command)
|
||||||
|
|
Loading…
Reference in New Issue