From 9da44700cb4ab71f6935a44a77fed9ae00c44673 Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Fri, 20 Mar 2026 07:25:04 +0100 Subject: [PATCH] test mode --- inc/init/init.context.lua | 1 + inc/system/system.input.lua | 4 ++++ inc/window/window.intro.ttg.lua | 15 ++++++++++++++- inc/window/window.menu.lua | 16 ++++++++++++---- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/inc/init/init.context.lua b/inc/init/init.context.lua index e406279..1f4be3b 100644 --- a/inc/init/init.context.lua +++ b/inc/init/init.context.lua @@ -25,6 +25,7 @@ Context = {} function Context.initial_data() return { current_menu_item = 1, + test_mode = false, popup = { show = false, content = {} diff --git a/inc/system/system.input.lua b/inc/system/system.input.lua index 2efd882..aeb1900 100644 --- a/inc/system/system.input.lua +++ b/inc/system/system.input.lua @@ -22,6 +22,10 @@ function Input.left() return btnp(INPUT_KEY_LEFT) end --- Checks if Right is pressed. --- @within Input function Input.right() return btnp(INPUT_KEY_RIGHT) end +--- Checks if Space is pressed. +--- @within Input +function Input.space() return keyp(INPUT_KEY_SPACE) end + --- Checks if Select is pressed. --- @within Input function Input.select() return btnp(INPUT_KEY_A) or keyp(INPUT_KEY_SPACE) end diff --git a/inc/window/window.intro.ttg.lua b/inc/window/window.intro.ttg.lua index b692ab7..c84208c 100644 --- a/inc/window/window.intro.ttg.lua +++ b/inc/window/window.intro.ttg.lua @@ -1,6 +1,8 @@ --- @section TTGIntroWindow TTGIntroWindow.timer = 180 TTGIntroWindow.glitch_started = false +TTGIntroWindow.space_count = 0 +TTGIntroWindow.space_timer = 0 TTGIntroWindow.text = [[ ###### ###### ###### ## ## # @@ -25,8 +27,19 @@ function TTGIntroWindow.update() TTGIntroWindow.glitch_started = true end + -- Count menu_back presses during the intro + if Input.menu_back() then + TTGIntroWindow.space_count = TTGIntroWindow.space_count + 1 + end + TTGIntroWindow.timer = TTGIntroWindow.timer - 1 - if TTGIntroWindow.timer <= 0 or Input.select() or Input.menu_confirm() then + if TTGIntroWindow.timer <= 0 or Input.menu_confirm() then + -- Evaluate exactly 3 presses at the end of the intro + if TTGIntroWindow.space_count == 3 then + Context.test_mode = true + MenuWindow.refresh_menu_items() + Audio.sfx_success() + end Glitch.hide() Window.set_current("intro_brief") end diff --git a/inc/window/window.menu.lua b/inc/window/window.menu.lua index 2c33637..15c6326 100644 --- a/inc/window/window.menu.lua +++ b/inc/window/window.menu.lua @@ -4,7 +4,11 @@ local _menu_items = {} --- Draws the menu window. --- @within MenuWindow function MenuWindow.draw() - UI.draw_top_bar("Definitely not an Impostor") + local title = "Definitely not an Impostor" + if Context.test_mode then + title = title .. " (TEST MODE)" + end + UI.draw_top_bar(title) local menu_h = #_menu_items * 10 local y = 10 + (Config.screen.height - 10 - 10 - menu_h) / 2 @@ -101,9 +105,13 @@ function MenuWindow.refresh_menu_items() table.insert(_menu_items, {label = "New Game", decision = MenuWindow.new_game}) table.insert(_menu_items, {label = "Load Game", decision = MenuWindow.load_game}) table.insert(_menu_items, {label = "Configuration", decision = MenuWindow.configuration}) - table.insert(_menu_items, {label = "Audio Test", decision = MenuWindow.audio_test}) - table.insert(_menu_items, {label = "To Be Continued...", decision = MenuWindow.continued}) - table.insert(_menu_items, {label = "DDR Test", decision = MenuWindow.ddr_test}) + + if Context.test_mode then + table.insert(_menu_items, {label = "Audio Test", decision = MenuWindow.audio_test}) + table.insert(_menu_items, {label = "To Be Continued...", decision = MenuWindow.continued}) + table.insert(_menu_items, {label = "DDR Test", decision = MenuWindow.ddr_test}) + end + table.insert(_menu_items, {label = "Exit", decision = MenuWindow.exit}) Context.current_menu_item = 1 -- 2.49.1