-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmap.h
56 lines (44 loc) · 904 Bytes
/
map.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef MAP_H
#define MAP_H
#include <stdint.h>
#define MAP_SIZE 32
#define HEADER_SIZE 13
#define THING_SIZE 5
#define INTERACTION_SIZE 4
#define INTCOMMAND_SIZE 9
#define BLOCKMAP_SIZE (MAP_SIZE * MAP_SIZE * 2 / 8)
#define COORD_SHIFT 3
enum NodeTypes {
NODE_LEAF,
NODE_VER_SPLIT,
NODE_HOZ_SPLIT
};
typedef struct Coord {
uint8_t X, Y;
} Coord;
typedef struct Node {
Coord One, Two;
uint8_t Type;
uint8_t Split;
uint16_t ArgOne, ArgTwo;
} Node;
typedef struct Line {
Coord Start, End;
uint16_t Texture;
uint16_t Flags;
} Line;
typedef struct Thing {
Coord Pos;
uint32_t Flags;
} Thing;
typedef struct Map {
uint16_t NumNodes, NumLines, NumThings;
Node *Nodes;
Line *Lines;
Thing *Things;
uint8_t *Blockmap;
} Map;
int LoadMap(const char *Filename, Map *Map);
void FreeMap(Map *Map);
int GetNode(Map *Map, unsigned int NodeNumber, unsigned int X, unsigned int Y);
#endif