Fixed player showing up as an enemy and did better map centering.

master
Zed A. Shaw 4 weeks ago
parent e2bd61a1e4
commit 421cca308b
  1. 4
      assets/enemies.json
  2. 3
      dinkyecs.cpp
  3. 20
      gui.cpp
  4. 1
      meson.build
  5. 4
      worldbuilder.cpp

@ -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": {

@ -1,3 +0,0 @@
#include "dinkyecs.hpp"
#include "dbc.hpp"
#include <fmt/core.h>

@ -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<double>(end - start);
$stats.sample(1/elapsed.count());
auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration<double>(end - start);
$stats.sample(1/elapsed.count());
draw_weapon();
}
draw_gui();
draw_weapon();
$window.display();
}
void FSM::mouse() {
// temporarily gutted
}
void FSM::generate_map() {

@ -51,7 +51,6 @@ sources = [
'config.cpp',
'dbc.cpp',
'devices.cpp',
'dinkyecs.cpp',
'gui.cpp',
'inventory.cpp',
'levelmanager.cpp',

@ -235,10 +235,6 @@ void WorldBuilder::randomize_entities(DinkyECS::World &world, GameConfig &config
int rand_entity = Random::uniform<int>(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

Loading…
Cancel
Save