diff --git a/assets/enemies.json b/assets/enemies.json index c3d69f9..c7b1353 100644 --- a/assets/enemies.json +++ b/assets/enemies.json @@ -1,5 +1,6 @@ { "PLAYER_TILE": { + "placement": "fixed", "components": [ {"_type": "Tile", "display": "\ua66b", "foreground": [255, 200, 125], @@ -8,7 +9,8 @@ {"_type": "Combat", "hp": 200, "damage": 15, "dead": false}, {"_type": "Motion", "dx": 0, "dy": 0, "random": false}, {"_type": "LightSource", "strength": 70, "radius": 2}, - {"_type": "EnemyConfig", "hearing_distance": 5} + {"_type": "EnemyConfig", "hearing_distance": 5}, + {"_type": "Sprite", "name": "peasant_girl"} ] }, "KNIGHT": { diff --git a/dinkyecs.cpp b/dinkyecs.cpp deleted file mode 100644 index 19e8383..0000000 --- a/dinkyecs.cpp +++ /dev/null @@ -1,3 +0,0 @@ -#include "dinkyecs.hpp" -#include "dbc.hpp" -#include diff --git a/gui.cpp b/gui.cpp index 1b3337d..070f05c 100644 --- a/gui.cpp +++ b/gui.cpp @@ -111,10 +111,8 @@ namespace gui { $renderer.init_terminal(); $map_view.create_render(); - $renderer.resize_grid(MAX_FONT_SIZE, $map_view); $map_view.resize_canvas(); - state(State::IDLE); } @@ -150,7 +148,7 @@ namespace gui { // just do 10 ticks if($rotation_count % 10 == 0) { run_systems(); - $rayview.$anim.play(true); + $rayview.$anim.play(false); $rotation = -10.0f; state(State::IDLE); } @@ -195,6 +193,8 @@ namespace gui { state(State::ROTATING); break; case FU::MAP_OPEN: + $renderer.resize_grid(MAX_FONT_SIZE, $map_view); + $map_view.resize_canvas(); state(State::MAPPING); break; case FU::ATTACK: @@ -310,26 +310,26 @@ namespace gui { } void FSM::render() { - auto start = std::chrono::high_resolution_clock::now(); - if(in_state(State::MAPPING)) { $window.clear(); $map_view.render(); $renderer.draw($map_view); } else { + auto start = std::chrono::high_resolution_clock::now(); $rayview.draw($window); - } + auto end = std::chrono::high_resolution_clock::now(); + auto elapsed = std::chrono::duration(end - start); + $stats.sample(1/elapsed.count()); - auto end = std::chrono::high_resolution_clock::now(); - auto elapsed = std::chrono::duration(end - start); - $stats.sample(1/elapsed.count()); + draw_weapon(); + } draw_gui(); - draw_weapon(); $window.display(); } void FSM::mouse() { + // temporarily gutted } void FSM::generate_map() { diff --git a/meson.build b/meson.build index 357af2f..0e7f443 100644 --- a/meson.build +++ b/meson.build @@ -51,7 +51,6 @@ sources = [ 'config.cpp', 'dbc.cpp', 'devices.cpp', - 'dinkyecs.cpp', 'gui.cpp', 'inventory.cpp', 'levelmanager.cpp', diff --git a/worldbuilder.cpp b/worldbuilder.cpp index 62eeeb3..487e6bc 100644 --- a/worldbuilder.cpp +++ b/worldbuilder.cpp @@ -235,10 +235,6 @@ void WorldBuilder::randomize_entities(DinkyECS::World &world, GameConfig &config int rand_entity = Random::uniform(0, keys.size() - 1); std::string key = keys[rand_entity]; // BUG: this may crash if PLAYER_TILE isn't first - if(key == "PLAYER_TITLE") { - key = keys[rand_entity + 1]; - fmt::println("SKIPPING PLAYER and using {} instead", key); - } auto entity_data = entity_db[key]; // pass that to the config as it'll be a generic json