Refactor before working on animations sending events.

This commit is contained in:
Zed A. Shaw 2026-01-06 23:50:03 -05:00
parent 8b1f288fce
commit 63260f01b9
7 changed files with 10 additions and 42 deletions

View file

@ -89,7 +89,7 @@ namespace boss {
break;
case COMBAT_START:
$ui.status(L"X TURN", L"STEP");
next_combat_dumb_name();
next_combat();
break;
case COMBAT:
do_combat(data);
@ -99,7 +99,11 @@ namespace boss {
}
}
void Fight::next_combat_dumb_name() {
void Fight::END(game::Event ev, std::any) {
fmt::println("BOSS_FIGHT:END event {}", (int)ev);
}
void Fight::next_combat() {
if(auto action = $battle.next()) {
System::combat(*action, $world, $boss_id, 0);
} else if(player_dead()) {
@ -143,10 +147,6 @@ namespace boss {
}
void Fight::END(game::Event ev, std::any) {
fmt::println("BOSS_FIGHT:END event {}", (int)ev);
}
void Fight::run_systems() {
$ui.update_stats();
$battle.set($host, "tough_personality", false);
@ -155,7 +155,6 @@ namespace boss {
}
void Fight::render(sf::RenderWindow& window) {
$ui.play_animations();
$ui.render();
}

View file

@ -51,7 +51,7 @@ namespace boss {
void init_fight();
void do_combat(std::any data);
void next_combat_dumb_name();
void next_combat();
sf::Vector2f mouse_position();
bool handle_keyboard_mouse();
};

View file

@ -87,7 +87,7 @@ namespace boss {
}
void System::plan_battle(BattleEngine& battle, std::shared_ptr<DinkyECS::World> world, DinkyECS::Entity boss_id) {
// REFACTOR: make this loop the list of entities in the battle then
// BUG: make this loop the list of entities in the battle then
// use their world state to configure the plan
battle.plan();
}

View file

@ -78,7 +78,9 @@ namespace boss {
$actions.render(*$window);
$combat_ui.render(*$window);
$arena.play_animations();
$arena.render($view_texture);
$view_texture.display();
$window->draw($view_sprite);
}
@ -102,10 +104,6 @@ namespace boss {
$arena.animate_actor(actor);
}
void UI::play_animations() {
$arena.play_animations();
}
void UI::damage(const string& actor, const std::string& target, int amount) {
if(amount > 0) {
$arena.attach_text(target, fmt::format("{}", amount));

View file

@ -37,7 +37,6 @@ namespace boss {
void move_actor(const std::string& actor, const std::string& cell_name);
void animate_actor(const std::string& actor);
void update_stats();
void play_animations();
void damage(const std::string& actor, const std::string& target, int amount);
void reset_camera();
};