diff --git a/README.md b/README.md index f9edf4e..d1304d8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# The Artisinal Handcrafted Retro-Future "3D" Dungeon Crawler +# The Artisanal Handcrafted Retro-Future "3D" Dungeon Crawler Welcome to my latest obsession, and turn based dungeon crawler in the style of old school raycasted games like _Wizardry_, _Might and Magic_, _Ultima_, and similar games. The game uses SFML 3.x as diff --git a/events.hpp b/events.hpp index 880c549..cd44ffe 100644 --- a/events.hpp +++ b/events.hpp @@ -3,7 +3,7 @@ namespace Events { enum GUI { START, COMBAT, LOOT, DEATH, STAIRS_UP, STAIRS_DOWN, TRAP, - COMBAT_START + COMBAT_START, NO_NEIGHBORS }; struct Combat { diff --git a/gui.cpp b/gui.cpp index 4fcdc03..e47014e 100644 --- a/gui.cpp +++ b/gui.cpp @@ -99,9 +99,13 @@ namespace gui { System::combat($level); run_systems(); $rotation = -10.0f; - state(State::IDLE); + state(State::IN_COMBAT); } break; + case STOP_COMBAT: + dbc::log("Exiting ATTACKING STATE"); + state(State::IDLE); + break; default: dbc::log(fmt::format("In ATTACKING state, unhandled event {}", (int)ev)); } @@ -161,6 +165,7 @@ namespace gui { case CLOSE: dbc::log("Nothing to close."); break; + case STOP_COMBAT: case TICK: // do nothing break; @@ -186,6 +191,9 @@ namespace gui { $camera.plan_rotate($rayview, -1); state(State::COMBAT_ROTATE); break; + case STOP_COMBAT: + state(State::IDLE); + break; case QUIT: $window.close(); state(State::END); @@ -405,9 +413,12 @@ namespace gui { } } break; - case eGUI::COMBAT_START: { - event(Event::START_COMBAT); - } break; + case eGUI::COMBAT_START: + event(Event::START_COMBAT); + break; + case eGUI::NO_NEIGHBORS: + event(Event::STOP_COMBAT); + break; case eGUI::LOOT: { // auto &item = std::any_cast(data); // $status_view.log(fmt::format("You picked up a {}.", diff --git a/gui.hpp b/gui.hpp index bc9d686..d761557 100644 --- a/gui.hpp +++ b/gui.hpp @@ -36,6 +36,7 @@ namespace gui { ROTATE_RIGHT, ATTACK, START_COMBAT, + STOP_COMBAT, QUIT }; diff --git a/systems.cpp b/systems.cpp index 6293c53..04aca58 100644 --- a/systems.cpp +++ b/systems.cpp @@ -215,6 +215,8 @@ void System::collision(GameLevel &level) { println("UNKNOWN COLLISION TYPE {}", entity); } } + } else { + world.send(Events::GUI::NO_NEIGHBORS, player.entity, player.entity); } }