summaryrefslogtreecommitdiff
path: root/src/sector.h
blob: 8315ee63f5a82e01b40173f3da184ee6892b77d6 (plain)
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
#ifndef SECTOR_H
#define SECTOR_H

#include "common.h"
#include "player.h"

struct sector {
    float floor, ceil;   // floor and ceiling heights
    size_t *vertices;    // index of each vertex (vertices[nverts])
    size_t *neighbors;   // index of each neighboring sector (neighbors[nverts])
    size_t nverts;       // number of vertices defining the sector
};

typedef struct {
    struct sector *sectors;  // all the sectors in the map
    size_t nsects;           // sectors[nsects]
    struct xy *vertices;     // all vertices in the map
    size_t nverts;           // vertices[nverts]
    player_t player;         // the player (should be an array in the future)
} map_t;

int map_draw(map_t *map, uint SW, uint SH);
int map_load(map_t *map, char *filename);
void map_unload(map_t *map);

void map_print(map_t *map);
int map_save(map_t *map, char *filename);


#endif