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");
$actions.set<Rectangle>(stats, {});
$actions.set<Text>(stats, {L"stats"});
$actions.set<Effect>(stats, {});
$actions.init();
@ -95,4 +94,8 @@ namespace boss {
void UI::run_systems() {
// 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);
bool boss_dead();
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, IN_COMBAT, 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, 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");
using enum Event;
(void)data; ///// !!!!!!!!!!!!!!!!!!!!!!! DIE this sucks
switch(ev) {
// this is only if using the debug X key to skip it
@ -226,9 +227,10 @@ namespace gui {
event(Event::BOSS_END);
}
} break;
case ATTACK:
fmt::println("ATTACK THE BOSS!");
break;
case ATTACK: {
// BUG: get rid of temp attack id and pass the data
$boss_fight_ui->attack($temp_attack_id);
} break;
case MOUSE_MOVE: {
sf::Vector2f pos = mouse_position();
$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 IN_COMBAT(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 END(Event ev);