From 732c8b34c80b17bcb343c97649d09b3b7ab3cad1 Mon Sep 17 00:00:00 2001 From: Zoltan Timar Date: Mon, 9 Mar 2026 16:20:50 +0100 Subject: [PATCH 1/2] feat: added standard day cycle, added mysterious man screen, added work screen, added new decisions, placed minigames in their proposed space --- impostor.inc | 7 +- inc/decision/decision.do_work.lua | 15 +++ inc/decision/decision.go_to_sleep.lua | 16 ++++ inc/logic/logic.minigame.lua | 2 +- inc/logic/logic.timer.lua | 4 +- inc/screen/screen.home.lua | 1 + inc/screen/screen.office.lua | 4 +- inc/screen/screen.work.lua | 6 ++ inc/window/window.minigame.ddr.lua | 11 ++- inc/window/window.minigame.mash.lua | 11 ++- inc/window/window.minigame.rhythm.lua | 11 ++- inc/window/window.mysterious_man.lua | 132 ++++++++++++++++++++++++++ inc/window/window.register.lua | 3 + 13 files changed, 205 insertions(+), 18 deletions(-) create mode 100644 inc/decision/decision.do_work.lua create mode 100644 inc/decision/decision.go_to_sleep.lua create mode 100644 inc/screen/screen.work.lua create mode 100644 inc/window/window.mysterious_man.lua diff --git a/impostor.inc b/impostor.inc index 126d176..ae7dac2 100644 --- a/impostor.inc +++ b/impostor.inc @@ -25,9 +25,8 @@ decision/decision.go_to_toilet.lua decision/decision.go_to_walking_to_office.lua decision/decision.go_to_office.lua decision/decision.go_to_walking_to_home.lua -decision/decision.play_button_mash.lua -decision/decision.play_rhythm.lua -decision/decision.play_ddr.lua +decision/decision.go_to_sleep.lua +decision/decision.do_work.lua map/map.manager.lua map/map.bedroom.lua map/map.street.lua @@ -38,6 +37,7 @@ screen/screen.toilet.lua screen/screen.walking_to_office.lua screen/screen.office.lua screen/screen.walking_to_home.lua +screen/screen.work.lua window/window.manager.lua window/window.register.lua window/window.splash.lua @@ -49,6 +49,7 @@ window/window.popup.lua window/window.minigame.mash.lua window/window.minigame.rhythm.lua window/window.minigame.ddr.lua +window/window.mysterious_man.lua window/window.game.lua system/system.main.lua meta/meta.assets.lua diff --git a/inc/decision/decision.do_work.lua b/inc/decision/decision.do_work.lua new file mode 100644 index 0000000..c544d7b --- /dev/null +++ b/inc/decision/decision.do_work.lua @@ -0,0 +1,15 @@ +Decision.register({ + id = "do_work", + label = "Do Work", + handle = function() + Meter.hide() + Util.go_to_screen_by_id("work") + MinigameDDRWindow.start("game", nil, { + on_win = function() + Meter.show() + Util.go_to_screen_by_id("office") + Window.set_current("game") + end, + }) + end, +}) diff --git a/inc/decision/decision.go_to_sleep.lua b/inc/decision/decision.go_to_sleep.lua new file mode 100644 index 0000000..bcc606d --- /dev/null +++ b/inc/decision/decision.go_to_sleep.lua @@ -0,0 +1,16 @@ +Decision.register({ + id = "go_to_sleep", + label = "Go to Sleep", + handle = function() + Meter.hide() + Day.increase() + MinigameRhythmWindow.start("game", { + focus_center_x = Config.screen.width / 2, + focus_center_y = Config.screen.height / 2, + focus_initial_radius = 0, + on_win = function() + MysteriousManWindow.start() + end, + }) + end, +}) diff --git a/inc/logic/logic.minigame.lua b/inc/logic/logic.minigame.lua index 97ba88e..51edddb 100644 --- a/inc/logic/logic.minigame.lua +++ b/inc/logic/logic.minigame.lua @@ -4,7 +4,7 @@ --- Draws a unified win message overlay. --- @within Minigame function Minigame.draw_win_overlay() - local text = "WELL DONE!" + local text = "SUCCESS" local tw = #text * 4 local th = 6 local padding = 4 diff --git a/inc/logic/logic.timer.lua b/inc/logic/logic.timer.lua index bf878e6..943a85c 100644 --- a/inc/logic/logic.timer.lua +++ b/inc/logic/logic.timer.lua @@ -50,7 +50,7 @@ function Timer.draw() local fg_color if progress <= 0.25 then - fg_color = Config.colors.white + fg_color = Config.colors.dark_grey elseif progress <= 0.5 then fg_color = Config.colors.light_blue elseif progress <= 0.75 then @@ -59,7 +59,7 @@ function Timer.draw() fg_color = Config.colors.red end - local bg_color = Config.colors.dark_grey + local bg_color = Config.colors.white local start_angle = -math.pi * 0.5 local progress_angle = progress * 2 * math.pi local r_outer_sq = r_outer * r_outer diff --git a/inc/screen/screen.home.lua b/inc/screen/screen.home.lua index a801ec1..56048b5 100644 --- a/inc/screen/screen.home.lua +++ b/inc/screen/screen.home.lua @@ -4,6 +4,7 @@ Screen.register({ decisions = { "go_to_toilet", "go_to_walking_to_office", + "go_to_sleep", }, background = "bedroom" }) diff --git a/inc/screen/screen.office.lua b/inc/screen/screen.office.lua index b7a0102..904eb85 100644 --- a/inc/screen/screen.office.lua +++ b/inc/screen/screen.office.lua @@ -2,9 +2,7 @@ Screen.register({ id = "office", name = "Office", decisions = { - "play_button_mash", - "play_rhythm", - "play_ddr", + "do_work", "go_to_walking_to_home", "have_a_coffee", }, diff --git a/inc/screen/screen.work.lua b/inc/screen/screen.work.lua new file mode 100644 index 0000000..83ae796 --- /dev/null +++ b/inc/screen/screen.work.lua @@ -0,0 +1,6 @@ +Screen.register({ + id = "work", + name = "Work", + decisions = {}, + background_color = Config.colors.blue, +}) diff --git a/inc/window/window.minigame.ddr.lua b/inc/window/window.minigame.ddr.lua index 207558a..ea2694b 100644 --- a/inc/window/window.minigame.ddr.lua +++ b/inc/window/window.minigame.ddr.lua @@ -39,7 +39,8 @@ function MinigameDDRWindow.init_context() pattern_index = 1, use_pattern = false, return_window = nil, - win_timer = 0 + win_timer = 0, + on_win = nil } end @@ -162,8 +163,12 @@ function MinigameDDRWindow.update() mg.win_timer = mg.win_timer - 1 if mg.win_timer == 0 then Meter.on_minigame_complete() - Meter.show() - Window.set_current(mg.return_window) + if mg.on_win then + mg.on_win() + else + Meter.show() + Window.set_current(mg.return_window) + end end return end diff --git a/inc/window/window.minigame.mash.lua b/inc/window/window.minigame.mash.lua index f4a8747..d38ef0e 100644 --- a/inc/window/window.minigame.mash.lua +++ b/inc/window/window.minigame.mash.lua @@ -21,7 +21,8 @@ function MinigameButtonMashWindow.init_context() focus_center_x = nil, focus_center_y = nil, focus_initial_radius = 0, - win_timer = 0 + win_timer = 0, + on_win = nil } end @@ -63,9 +64,13 @@ function MinigameButtonMashWindow.update() mg.win_timer = mg.win_timer - 1 if mg.win_timer == 0 then Meter.on_minigame_complete() - Meter.show() if mg.focus_center_x then Focus.stop() end - Window.set_current(mg.return_window) + if mg.on_win then + mg.on_win() + else + Meter.show() + Window.set_current(mg.return_window) + end end return end diff --git a/inc/window/window.minigame.rhythm.lua b/inc/window/window.minigame.rhythm.lua index 78d94b6..064a9d5 100644 --- a/inc/window/window.minigame.rhythm.lua +++ b/inc/window/window.minigame.rhythm.lua @@ -30,7 +30,8 @@ function MinigameRhythmWindow.init_context() focus_center_x = nil, focus_center_y = nil, focus_initial_radius = 0, - win_timer = 0 + win_timer = 0, + on_win = nil } end @@ -72,9 +73,13 @@ function MinigameRhythmWindow.update() mg.win_timer = mg.win_timer - 1 if mg.win_timer == 0 then Meter.on_minigame_complete() - Meter.show() if mg.focus_center_x then Focus.stop() end - Window.set_current(mg.return_window) + if mg.on_win then + mg.on_win() + else + Meter.show() + Window.set_current(mg.return_window) + end end return end diff --git a/inc/window/window.mysterious_man.lua b/inc/window/window.mysterious_man.lua new file mode 100644 index 0000000..e4c5a90 --- /dev/null +++ b/inc/window/window.mysterious_man.lua @@ -0,0 +1,132 @@ +--- @section MysteriousManWindow + +local STATE_TEXT = "text" +local STATE_DAY = "day" +local STATE_CHOICE = "choice" + +local state = STATE_TEXT +local text_y = Config.screen.height +local text_speed = 0.4 +local day_timer = 0 +local day_display_frames = 120 +local selected_choice = 1 + +local choices = { + { + label = "Wake Up", + }, + { + label = "Stay in Bed", + }, +} + +local text = [[ +Misterious man appears +during your sleep. + +He says nothing. +He doesn't need to. + +He says nothing. +]] + +--- Sets the scrolling text content. +--- @within MysteriousManWindow +--- @param new_text string The text to display. +function MysteriousManWindow.set_text(new_text) + text = new_text +end + +--- Starts the mysterious man window. +--- @within MysteriousManWindow +function MysteriousManWindow.start() + state = STATE_TEXT + text_y = Config.screen.height + day_timer = 0 + selected_choice = 1 + Meter.hide() + Window.set_current("mysterious_man") +end + +local function wake_up() + Util.go_to_screen_by_id("home") + MinigameButtonMashWindow.start("game", { + focus_center_x = Config.screen.width / 2, + focus_center_y = Config.screen.height / 2, + focus_initial_radius = 0, + on_win = function() + Meter.show() + Window.set_current("game") + end, + }) +end + +local function stay_in_bed() + Day.increase() + state = STATE_DAY + day_timer = day_display_frames +end + +--- Updates the mysterious man window logic. +--- @within MysteriousManWindow +function MysteriousManWindow.update() + if state == STATE_TEXT then + text_y = text_y - text_speed + + local lines = 1 + for _ in string.gmatch(text, "\n") do + lines = lines + 1 + end + + if text_y < -lines * 8 then + state = STATE_DAY + day_timer = day_display_frames + end + + if Input.select() then + state = STATE_DAY + day_timer = day_display_frames + end + elseif state == STATE_DAY then + day_timer = day_timer - 1 + + if day_timer <= 0 or Input.select() then + state = STATE_CHOICE + selected_choice = 1 + end + elseif state == STATE_CHOICE then + selected_choice = UI.update_menu(choices, selected_choice) + + if Input.select() then + Audio.sfx_select() + if selected_choice == 1 then + wake_up() + else + stay_in_bed() + end + end + end +end + +--- Draws the mysterious man window. +--- @within MysteriousManWindow +function MysteriousManWindow.draw() + rect(0, 0, Config.screen.width, Config.screen.height, Config.colors.black) + + if state == STATE_TEXT then + local x = (Config.screen.width - 132) / 2 + Print.text(text, x, text_y, Config.colors.light_grey) + elseif state == STATE_DAY then + local day_text = "Day " .. Context.day_count + Print.text_center( + day_text, + Config.screen.width / 2, + Config.screen.height / 2 - 3, + Config.colors.white + ) + elseif state == STATE_CHOICE then + local menu_x = (Config.screen.width - 60) / 2 + local menu_y = (Config.screen.height - 20) / 2 + UI.draw_menu(choices, selected_choice, menu_x, menu_y) + end +end diff --git a/inc/window/window.register.lua b/inc/window/window.register.lua index 6c368fd..a49db0d 100644 --- a/inc/window/window.register.lua +++ b/inc/window/window.register.lua @@ -27,3 +27,6 @@ Window.register("minigame_rhythm", MinigameRhythmWindow) MinigameDDRWindow = {} Window.register("minigame_ddr", MinigameDDRWindow) + +MysteriousManWindow = {} +Window.register("mysterious_man", MysteriousManWindow) From f3846a283e6ac85fbae44ae3965ae9f5e3b2a9a6 Mon Sep 17 00:00:00 2001 From: Zoltan Timar Date: Mon, 9 Mar 2026 16:25:11 +0100 Subject: [PATCH 2/2] fix: fixing linter --- .luacheckrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.luacheckrc b/.luacheckrc index 1221c0b..69f8bfe 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -30,6 +30,7 @@ globals = { "MinigameButtonMashWindow", "MinigameRhythmWindow", "MinigameDDRWindow", + "MysteriousManWindow", "mset", "mget", "btnp",