diff options
Diffstat (limited to 'src/common.hpp')
-rw-r--r-- | src/common.hpp | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/src/common.hpp b/src/common.hpp index a253da5..71bc695 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -70,13 +70,18 @@ namespace world { class entity_t; + typedef enum { + SECTOR_EMPTY, + SECTOR_PARTIAL, + SECTOR_FULL + } sector_level_t; + class sector_t { public: sector_index_t index; rectf_t bounds; std::unordered_set<entity_t*> ents; - - bool empty = true; + sector_level_t level; tile_t tiles[SECTOR_SIZE * SECTOR_SIZE]; }; @@ -101,7 +106,7 @@ namespace world { std::map<sector_index_t, sector_t> sectors; void generate_tile(tile_t *tile, tile_index_t index); - void generate(sector_t *sector, sector_index_t index, bool partial); + void generate(sector_t *sector, sector_index_t index, sector_level_t level); protected: friend render::state_t; @@ -115,13 +120,13 @@ namespace world { world_t(void); - sector_t *get_sector(sector_index_t index, bool partial = false); - tile_t *get_tile(tile_index_t index, bool partial = false); + sector_t *get_sector(sector_index_t index, sector_level_t level); + tile_t *get_tile(tile_index_t index, sector_level_t level); bool find_path(v2f_t src, v2f_t dst, cmodel_t *cmodel, entity_t *ignore, std::list<v2f_t> *path); // FIXME: iterators instead of returning std::lists - std::list<sector_t*> get_sectors(rectf_t rect); + std::list<sector_t*> get_sectors(rectf_t rect, sector_level_t level); std::list<entity_t*> get_entities(rectf_t rect, cflags_t cflags); std::list<entity_t*> get_render_entities(rectf_t rect); @@ -313,12 +318,12 @@ namespace render { ALIGN_CENTER_BOTTOM } text_align_t; - void register_tile(uint8_t type, const char *path); + void register_tile(uint8_t type, const char *top, const char *side, float height); class state_t { sf::RenderWindow *window; - void render_sector(world::world_t *world, world::sector_t *sector); + void render_tile(world::world_t *world, v2f_t tx, world::tile_t *tile); void drender_text(rectf_t rect, std::string str); void drender_entity(world::entity_t *ent); public: |