From 297524c8ec41b585c4812494791772406653e479 Mon Sep 17 00:00:00 2001 From: Paweł Redman Date: Tue, 19 Dec 2017 19:27:06 +0100 Subject: Introduce tall tiles. Some features are still missing but the commit is large enough as it is. TODO: render layers and fix minor artifacts. --- src/common.hpp | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src/common.hpp') 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 ents; - - bool empty = true; + sector_level_t level; tile_t tiles[SECTOR_SIZE * SECTOR_SIZE]; }; @@ -101,7 +106,7 @@ namespace world { std::map 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 *path); // FIXME: iterators instead of returning std::lists - std::list get_sectors(rectf_t rect); + std::list get_sectors(rectf_t rect, sector_level_t level); std::list get_entities(rectf_t rect, cflags_t cflags); std::list 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: -- cgit