dungeon_crawler

annotate prototype/src/level.h @ 47:d52711f2b9a1

started writting audio code
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 16 Sep 2012 08:16:50 +0300
parents 38e16366efc2
children aa9e28670ae2
rev   line source
nuclear@1 1 #ifndef LEVEL_H_
nuclear@1 2 #define LEVEL_H_
nuclear@1 3
nuclear@1 4 #include <vector>
nuclear@1 5 #include "vmath/vmath.h"
nuclear@45 6 #include "psys/psys.h"
nuclear@1 7
nuclear@1 8 class GridCell;
nuclear@1 9 class Tile;
nuclear@1 10
nuclear@1 11 class Level {
nuclear@1 12 private:
nuclear@1 13 // cells are stored as a linear array of pointers to GridCells
nuclear@1 14 // null pointers mean unpopulated cells.
nuclear@1 15 GridCell **cells;
nuclear@1 16 int xsz, ysz;
nuclear@1 17 float cell_size;
nuclear@1 18
nuclear@38 19 // secondary data structure, simple list of all populated cells
nuclear@38 20 std::vector<GridCell*> cell_list;
nuclear@38 21
nuclear@1 22 void draw_grid() const;
nuclear@1 23
nuclear@1 24 public:
nuclear@1 25 Level();
nuclear@1 26 ~Level();
nuclear@1 27
nuclear@1 28 bool load(const char *fname);
nuclear@1 29 bool save(const char *fname) const;
nuclear@1 30
nuclear@1 31 const GridCell *get_cell(int x, int y) const;
nuclear@1 32 Vector3 get_cell_pos(int x, int y) const;
nuclear@23 33 unsigned int get_cell_dirmask(int x, int y) const;
nuclear@1 34
nuclear@38 35 void update(unsigned long msec, float dt);
nuclear@38 36
nuclear@1 37 void draw() const;
nuclear@23 38 void draw_lights() const;
nuclear@40 39 void draw_post() const;
nuclear@1 40 };
nuclear@1 41
nuclear@1 42 class GridCell {
nuclear@1 43 private:
nuclear@1 44 // each grid-cell might contain multiple tiles.
nuclear@38 45 std::vector<Tile*> tiles;
nuclear@1 46
nuclear@45 47 // particle systems
nuclear@45 48 std::vector<struct psys_emitter*> psys;
nuclear@45 49
nuclear@1 50 public:
nuclear@38 51 GridCell(Tile *tile = 0);
nuclear@5 52
nuclear@38 53 void add_tile(Tile *tile);
nuclear@38 54
nuclear@38 55 void update(unsigned long msec, float dt);
nuclear@1 56
nuclear@5 57 void draw(unsigned int draw_mask) const;
nuclear@23 58 void draw_lights(unsigned int draw_mask) const;
nuclear@40 59 void draw_post(unsigned int draw_mask) const;
nuclear@1 60 };
nuclear@1 61
nuclear@1 62 #endif // LEVEL_H_