From: John Tsiombikas Date: Sun, 25 Mar 2018 22:08:06 +0000 (+0300) Subject: starting tile-maze X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=94b31f853e22eea059754d66ad27536e6308231f starting tile-maze --- diff --git a/src/tilemaze.c b/src/tilemaze.c new file mode 100644 index 0000000..1d413d9 --- /dev/null +++ b/src/tilemaze.c @@ -0,0 +1,62 @@ +#include +#include "tilemaze.h" +#include "mesh.h" + +struct object { + char *name; + struct g3d_mesh mesh; + + void *texels; + int tex_width, tex_height; + + struct object *next; +}; + +struct tile { + struct object *objlist; +}; + +struct tilemaze { + struct tile *tileset; + int num_tiles; + + struct object *objects; +}; + + +struct tilemaze *load_tilemaze(const char *fname) +{ + struct tilemaze *tmz; + + if(!(tmz = calloc(sizeof *tmz, 1))) { + return 0; + } + /* TODO */ + return tmz; +} + +void destroy_tilemaze(struct tilemaze *tmz) +{ + if(!tmz) return; + + free(tmz->tileset); + + while(tmz->objects) { + struct object *o = tmz->objects; + tmz->objects = tmz->objects->next; + + free(o->mesh.varr); + free(o->mesh.iarr); + free(o); + } + + free(tmz); +} + +void update_tilemaze(struct tilemaze *tmz) +{ +} + +void draw_tilemaze(struct tilemaze *tmz) +{ +} diff --git a/src/tilemaze.h b/src/tilemaze.h new file mode 100644 index 0000000..a06acd8 --- /dev/null +++ b/src/tilemaze.h @@ -0,0 +1,12 @@ +#ifndef TILEMAZE_H_ +#define TILEMAZE_H_ + +struct tilemaze; + +struct tilemaze *load_tilemaze(const char *fname); +void destroy_tilemaze(struct tilemaze *tmz); + +void update_tilemaze(struct tilemaze *tmz); +void draw_tilemaze(struct tilemaze *tmz); + +#endif /* TILEMAZE_H_ */