Fixes door logic

This commit is contained in:
Linus Probert 2019-03-11 16:28:57 +01:00
parent e42e0243af
commit 184b42ff5a
2 changed files with 10 additions and 1 deletions

View File

@ -83,6 +83,8 @@ map_create_tile(void)
tile->lethal = false; tile->lethal = false;
tile->lightsource = false; tile->lightsource = false;
tile->levelExit = false; tile->levelExit = false;
tile->door = false;
tile->lockType = LOCK_NONE;
return tile; return tile;
} }
@ -147,7 +149,7 @@ map_add_door(Map *map, Position *tile_pos, MapTile *tile)
Room *room = map->rooms[cr->x][cr->y]; Room *room = map->rooms[cr->x][cr->y];
switch_tile(map, tile_pos, tile, &room->doors[tile_pos->x][tile_pos->y]); switch_tile(map, tile_pos, tile, &room->doors[tile_pos->x][tile_pos->y]);
tile->door = true; tile->door = true;
tile->animate = false; tile->sprite->animate = false;
} }
void void

View File

@ -36,6 +36,12 @@
typedef struct UpdateData UpdateData; typedef struct UpdateData UpdateData;
typedef struct Trap Trap; typedef struct Trap Trap;
typedef enum DoorLockType {
LOCK_NONE,
LOCK_SILVER,
LOCK_GOLD
} DoorLockType;
typedef struct MapTile_t { typedef struct MapTile_t {
Sprite *sprite; Sprite *sprite;
bool collider; bool collider;
@ -43,6 +49,7 @@ typedef struct MapTile_t {
bool lightsource; bool lightsource;
bool levelExit; bool levelExit;
bool door; bool door;
DoorLockType lockType;
} MapTile; } MapTile;
typedef struct Room_t { typedef struct Room_t {