Capturing attack clicks so now just have to make my own FSM for the minigame.

This commit is contained in:
Zed A. Shaw 2025-09-27 14:10:25 -04:00
parent 231adb6335
commit fdc0bcdb3b
4 changed files with 13 additions and 7 deletions

View file

@ -53,7 +53,6 @@ namespace boss {
auto stats = $actions.entity("stats"); auto stats = $actions.entity("stats");
$actions.set<Rectangle>(stats, {}); $actions.set<Rectangle>(stats, {});
$actions.set<Text>(stats, {L"stats"}); $actions.set<Text>(stats, {L"stats"});
$actions.set<Effect>(stats, {});
$actions.init(); $actions.init();
@ -95,4 +94,8 @@ namespace boss {
void UI::run_systems() { void UI::run_systems() {
// does nothing yet // does nothing yet
} }
void UI::attack(int attack_id) {
fmt::println("boss attacked with {}", attack_id);
}
} }

View file

@ -34,5 +34,6 @@ namespace boss {
void position_sprite(SpriteTexture& st, const std::string& name, float scale, bool at_mid=false); void position_sprite(SpriteTexture& st, const std::string& name, float scale, bool at_mid=false);
bool boss_dead(); bool boss_dead();
void run_systems(); void run_systems();
void attack(int attack_id);
}; };
} }

View file

@ -37,7 +37,7 @@ namespace gui {
FSM_STATE(State, IDLE, ev, data); FSM_STATE(State, IDLE, ev, data);
FSM_STATE(State, IN_COMBAT, ev); FSM_STATE(State, IN_COMBAT, ev);
FSM_STATE(State, COMBAT_ROTATE, ev); FSM_STATE(State, COMBAT_ROTATE, ev);
FSM_STATE(State, BOSS_FIGHT, ev); FSM_STATE(State, BOSS_FIGHT, ev, data);
FSM_STATE(State, END, ev); FSM_STATE(State, END, ev);
FSM_STATE(State, LOOTING, ev, data); FSM_STATE(State, LOOTING, ev, data);
} }
@ -206,9 +206,10 @@ namespace gui {
} }
} }
void FSM::BOSS_FIGHT(Event ev) { void FSM::BOSS_FIGHT(Event ev, std::any data) {
dbc::check($boss_fight_ui != nullptr, "$boss_fight_ui not initialized"); dbc::check($boss_fight_ui != nullptr, "$boss_fight_ui not initialized");
using enum Event; using enum Event;
(void)data; ///// !!!!!!!!!!!!!!!!!!!!!!! DIE this sucks
switch(ev) { switch(ev) {
// this is only if using the debug X key to skip it // this is only if using the debug X key to skip it
@ -226,9 +227,10 @@ namespace gui {
event(Event::BOSS_END); event(Event::BOSS_END);
} }
} break; } break;
case ATTACK: case ATTACK: {
fmt::println("ATTACK THE BOSS!"); // BUG: get rid of temp attack id and pass the data
break; $boss_fight_ui->attack($temp_attack_id);
} break;
case MOUSE_MOVE: { case MOUSE_MOVE: {
sf::Vector2f pos = mouse_position(); sf::Vector2f pos = mouse_position();
$boss_fight_ui->mouse(pos.x, pos.y, {1 << guecs::ModBit::hover}); $boss_fight_ui->mouse(pos.x, pos.y, {1 << guecs::ModBit::hover});

View file

@ -59,7 +59,7 @@ namespace gui {
void IDLE(Event ev, std::any data); void IDLE(Event ev, std::any data);
void IN_COMBAT(Event ev); void IN_COMBAT(Event ev);
void COMBAT_ROTATE(Event ev); void COMBAT_ROTATE(Event ev);
void BOSS_FIGHT(Event ev); void BOSS_FIGHT(Event ev, std::any data);
void LOOTING(Event ev, std::any data); void LOOTING(Event ev, std::any data);
void END(Event ev); void END(Event ev);