diff options
| -rw-r--r-- | src/common.hpp | 5 | ||||
| -rw-r--r-- | src/game/interface.cpp | 12 | ||||
| -rw-r--r-- | src/world.cpp | 12 | 
3 files changed, 20 insertions, 9 deletions
diff --git a/src/common.hpp b/src/common.hpp index 5510f95..f269370 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -128,7 +128,10 @@ namespace world {  		bool test_rect(const cmodel_t *cmodel, const entity_t *ignore);  		trace_t trace(v2f_t start, v2f_t end, cflags_t cflags); -		void debug_point(sf::Vector2f point); +		struct { +			size_t sectors = 0, tiles = 0; +			size_t entities = 0; +		} stats;  	};  	class entity_t { diff --git a/src/game/interface.cpp b/src/game/interface.cpp index d1734af..f574732 100644 --- a/src/game/interface.cpp +++ b/src/game/interface.cpp @@ -170,9 +170,17 @@ void state_t::render_to(render::state_t *render)  		render->render_text(x, em, entry.text, render::ALIGN_LEFT_TOP, sf::Color::White);  		x[1] += em;  	} - +	  	x = v2f_t(0.0f, h - em * 1.5); -	ss << "S/T/E: "; +	ss << "World S/T/E: "; +	ss << game->world.stats.sectors << "/"; +	ss << game->world.stats.tiles << "/"; +	ss << game->world.stats.entities; +	render->render_text(x, em, ss.str(), render::ALIGN_LEFT_TOP, sf::Color::White); + +	x[1] -= em; +	ss.str(std::string()); +	ss << "View S/T/E: ";  	ss << render->stats.sectors << "/";  	ss << render->stats.tiles << "/";  	ss << render->stats.entities; diff --git a/src/world.cpp b/src/world.cpp index 7256aee..5c2d7b3 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -47,6 +47,9 @@ void world_t::generate(sector_t *sector, sector_index_t index, bool partial)  	sector->empty = false;  	generator(this, index, sector, gen_tiles, gen_decos, generator_data); +	stats.sectors++; +	stats.tiles += SECTOR_SIZE * SECTOR_SIZE; +  	// Unused, for now.  	/*  	for (coord_t ly = 0; ly < SECTOR_SIZE; ly++) @@ -368,12 +371,6 @@ trace_t trace_cmodel(v2f_t start, v2f_t end, const cmodel_t *cmodel)  	return {0};  } -void world_t::debug_point(sf::Vector2f point) -{ -	sector_index_t index = sector_index_at(point); -	printf("sector (%zd, %zd)\n", index[0], index[1]); -} -  entity_t::entity_t(int type_)  {  	type = type_; @@ -429,6 +426,8 @@ void entity_t::link(world_t *world_)  		sector = world->get_sector(index);  		link_to_sector(sector);  	} + +	world->stats.entities++;  }  void entity_t::unlink(void) @@ -444,6 +443,7 @@ void entity_t::unlink(void)  	}  	parents.clear(); +	world->stats.entities--;  	world = 0;  }  | 
