From 279faf6dd5b481aa1516e8151f7bdbdd2a7bfd2f Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Thu, 2 Apr 2026 23:23:57 -0400 Subject: [PATCH] Now have hotkeys to test the different start/end conditions. --- src/gui/debug_ui.cpp | 7 ++----- src/gui/fsm.cpp | 36 +++++++++++++++++++++++++----------- src/gui/fsm.hpp | 2 ++ 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/gui/debug_ui.cpp b/src/gui/debug_ui.cpp index c4f9fcc..48e43a6 100644 --- a/src/gui/debug_ui.cpp +++ b/src/gui/debug_ui.cpp @@ -5,6 +5,7 @@ #include #include #include "game/components.hpp" +#include "gui/guecstra.hpp" namespace gui { using namespace guecs; @@ -15,11 +16,7 @@ namespace gui { "[*%(100,400)debug_text]" "[_]" "[_]" - "[_]" - "[spawn1|spawn2|spawn3]" - "[spawn4|spawn5|spawn6]"); - - // add_spawn_button("RAT_GIANT", "rat_with_sword", "spawn4"); + "[_]"); $gui.init(); } diff --git a/src/gui/fsm.cpp b/src/gui/fsm.cpp index 9a53796..f55f95e 100644 --- a/src/gui/fsm.cpp +++ b/src/gui/fsm.cpp @@ -143,6 +143,7 @@ namespace gui { mouse_action({1 << guecs::ModBit::hover}); } break; case START: + next_level(); close_scene(); state(State::IDLE); break; @@ -371,15 +372,19 @@ namespace gui { $debug_ui.debug(); shaders::reload(); break; - case KEY::L: - // This will go away as soon as containers work - $loot_ui.set_target($loot_ui.$temp_loot); - $loot_ui.update(); - event(Event::LOOT_OPEN); + case KEY::X: + show_scene("NEXT_LEVEL"); + state(State::NEXT_LEVEL_SCENE); break; case KEY::Z: $main_ui.toggle_mind_reading(); break; + case KEY::K: + player_died(); + break; + case KEY::N: + player_won(); + break; case KEY::F5: take_screenshot(); break; @@ -400,10 +405,6 @@ namespace gui { } void FSM::draw_gui() { - if($debug_ui.active) { - debug_render(); - } - if($cur_scene != nullptr) { $cur_scene->render($window); } else { @@ -411,6 +412,10 @@ namespace gui { $status_ui.render($window); if($loot_ui.active) $loot_ui.render($window); if(in_state(State::LOOTING)) $dnd_loot.render(); + + if($debug_ui.active) { + debug_render(); + } } } @@ -508,8 +513,7 @@ namespace gui { if(entity != player.entity) { $main_ui.dead_entity(entity); } else { - show_scene("DEATH"); - state(State::DEATH_SCENE); + player_died(); } } break; case eGUI::NOOP: { @@ -552,4 +556,14 @@ namespace gui { void FSM::close_scene() { $cur_scene = nullptr; } + + void FSM::player_died() { + show_scene("DEATH"); + state(State::DEATH_SCENE); + } + + void FSM::player_won() { + show_scene("WIN"); + state(State::WIN_SCENE); + } } diff --git a/src/gui/fsm.hpp b/src/gui/fsm.hpp index d6b228f..cff645e 100644 --- a/src/gui/fsm.hpp +++ b/src/gui/fsm.hpp @@ -80,5 +80,7 @@ namespace gui { void take_screenshot(); void show_scene(const std::string& name); void close_scene(); + void player_died(); + void player_won(); }; }