test mode #42

Merged
mr.zero merged 1 commits from feature/test-mode into master 2026-03-20 06:25:25 +00:00
4 changed files with 31 additions and 5 deletions
Showing only changes of commit 9da44700cb - Show all commits

View File

@@ -25,6 +25,7 @@ Context = {}
function Context.initial_data()
return {
current_menu_item = 1,
test_mode = false,
popup = {
show = false,
content = {}

View File

@@ -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

View File

@@ -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

View File

@@ -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})
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