start rationalizing map gen

This commit is contained in:
quenousimporte 2025-04-11 19:29:06 +02:00
parent f987630754
commit d82c3ccbea
1 changed files with 9 additions and 17 deletions

26
w/w.c
View File

@ -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)