Map file correctly loaded.

This commit is contained in:
2014-03-06 01:58:49 -04:30
parent 04621deb25
commit 55e707c1ce
3 changed files with 339 additions and 4 deletions

View File

@@ -6,7 +6,9 @@
#ifndef MAP_H
#define MAP_H
static const int MAX_MAP_SIZE = 64;
#define MAX_MAP_SIZE 64
#define MAX_OBJECTS 512
#define MAX_STR 128
typedef enum FLOOR_TYPES {
VOID = 0,
@@ -27,6 +29,7 @@ typedef enum OBJECT_TYPES {
PERSON,
PLAYER_START,
EXIT,
DIALOG,
NONE = 9989
} obj_t;
@@ -35,13 +38,26 @@ typedef enum ERROR_CODES {
FILE_NOT_FOUND,
OUT_OF_MEMORY,
PREMATURE_EOF,
MAP_TOO_LARGE
MAP_TOO_LARGE,
INVALID_KEY
} errcode_t;
typedef struct MAP_CELL{
floor_t f;
} map_cell_t;
typedef struct OBJECT {
obj_t type;
short x, y, eX, eY, sX, sY;
short id;
short dId;
char name[MAX_STR];
char target[MAX_STR];
char dialog[MAX_STR];
unsigned char unlocked;
} game_obj_t;
extern errcode_t readMapData(const char *, map_cell_t ***, int *, int *);
extern errcode_t readMapObjects(const char *, game_obj_t **, int *);
#endif