summaryrefslogtreecommitdiff
path: root/src/sector.h
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2023-04-09 02:02:51 +0300
committerkartofen <mladenovnasko0@gmail.com>2023-04-09 02:02:51 +0300
commitfc027f7d214028086178a7328926c9b14ead464d (patch)
treed2972055a06565f26a19626ac3fb26ead84e0766 /src/sector.h
map loading done
Diffstat (limited to 'src/sector.h')
-rw-r--r--src/sector.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sector.h b/src/sector.h
new file mode 100644
index 0000000..20050f7
--- /dev/null
+++ b/src/sector.h
@@ -0,0 +1,28 @@
+#ifndef SECTOR_H
+#define SECTOR_H
+
+#include "common.h"
+#include "player.h"
+
+struct sector {
+ float floor, ceil; // floor and ceiling heights
+ uint *vertices; // index of each vertex (vertices[nverts])
+ uint *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_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