35 lines
971 B
C
35 lines
971 B
C
#ifndef DATA_H
|
|
#define DATA_H
|
|
|
|
#define SET_SIZE 32 // base set size of 32, if tiles go beyond, the set is realloc'd with this amount
|
|
|
|
struct Data {
|
|
int set_count;
|
|
int size;
|
|
int *id; // 0 = player, 1 = npc, etc.
|
|
struct TileSetData **set;
|
|
};
|
|
|
|
struct TileSetData {
|
|
char **keys; // ties to tiles entry
|
|
int *key_id; // key_id acquired from key hash that points to tiles[id], allows for acquiring TileData from a string key as well as an id.
|
|
int size;
|
|
int tile_count;
|
|
int *id;
|
|
struct TileData **tile;
|
|
};
|
|
|
|
struct TileData {
|
|
int count; // count of key=>value pairs
|
|
int length; // max amount of entries
|
|
char **keys; // i.e., "name"
|
|
char **size; // since we're void, we should keep track of entry lengths
|
|
void **values; // i..e, "nupi"
|
|
};
|
|
|
|
struct Data *loadDataFromMemory(char *memory, int size);
|
|
struct TileSetData *loadTileSetData(char *memory, int *offset, int *depth);
|
|
struct TileData *loadTileData(char *memory, int *offset, int *depth);
|
|
|
|
#endif
|