Compare commits
12 Commits
feature/dd
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| 8921f02821 | |||
| 211af18c26 | |||
| b337ae8516 | |||
| 10316d3075 | |||
| 589b225ab0 | |||
| 7697b35336 | |||
| 6e1cf1db3e | |||
| 020bfd4134 | |||
| 8e610f14a0 | |||
| 753509b4ea | |||
| 7dbbbb4668 | |||
| 81b47c3760 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
.claude
|
||||
.local
|
||||
impostor.lua
|
||||
impostor.original.lua
|
||||
@@ -5,4 +6,5 @@ prompts
|
||||
docs
|
||||
minify.lua
|
||||
*.tic
|
||||
*.zip
|
||||
*.zip
|
||||
NOTES_*
|
||||
|
||||
@@ -10,7 +10,6 @@ globals = {
|
||||
"Discussion",
|
||||
"Util",
|
||||
"Decision",
|
||||
"Situation",
|
||||
"Screen",
|
||||
"Sprite",
|
||||
"UI",
|
||||
@@ -31,7 +30,7 @@ globals = {
|
||||
"MenuWindow",
|
||||
"GameWindow",
|
||||
"PopupWindow",
|
||||
"ConfigurationWindow",
|
||||
"ControlsWindow",
|
||||
"AudioTestWindow",
|
||||
"MinigameButtonMashWindow",
|
||||
"MinigameRhythmWindow",
|
||||
@@ -66,6 +65,10 @@ globals = {
|
||||
"map",
|
||||
"time",
|
||||
"RLE",
|
||||
"mouse",
|
||||
"Mouse",
|
||||
"print",
|
||||
"musicator_generate_pattern",
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ init/init.context.lua
|
||||
system/system.util.lua
|
||||
system/system.print.lua
|
||||
system/system.input.lua
|
||||
system/system.mouse.lua
|
||||
system/system.asciiart.lua
|
||||
system/system.rle.lua
|
||||
logic/logic.meter.lua
|
||||
@@ -38,10 +39,7 @@ sprite/sprite.matrix_architect.lua
|
||||
sprite/sprite.matrix_neo.lua
|
||||
sprite/sprite.matrix_oraculum.lua
|
||||
sprite/sprite.matrix_trinity.lua
|
||||
situation/situation.manager.lua
|
||||
situation/situation.drink_coffee.lua
|
||||
decision/decision.manager.lua
|
||||
decision/decision.have_a_coffee.lua
|
||||
decision/decision.go_to_home.lua
|
||||
decision/decision.go_to_toilet.lua
|
||||
decision/decision.go_to_walking_to_office.lua
|
||||
@@ -72,7 +70,7 @@ window/window.intro.title.lua
|
||||
window/window.intro.ttg.lua
|
||||
window/window.intro.brief.lua
|
||||
window/window.menu.lua
|
||||
window/window.configuration.lua
|
||||
window/window.controls.lua
|
||||
window/window.audiotest.lua
|
||||
window/window.popup.lua
|
||||
window/window.minigame.mash.lua
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
Decision.register({
|
||||
id = "have_a_coffee",
|
||||
label = "Have a Coffee",
|
||||
handle = function()
|
||||
local new_situation_id = Situation.apply("drink_coffee", Context.game.current_screen)
|
||||
local level = Ascension.get_level()
|
||||
local disc_id = "coworker_disc_0"
|
||||
-- TODO: Add more discussions for levels above 3
|
||||
if level >= 1 and level <= 3 then
|
||||
local suffix = Context.have_done_work_today and ("_asc_" .. level) or ("_" .. level)
|
||||
disc_id = "coworker_disc" .. suffix
|
||||
end
|
||||
Discussion.start(disc_id, "game")
|
||||
Context.game.current_situation = new_situation_id
|
||||
end,
|
||||
})
|
||||
@@ -134,6 +134,7 @@ end
|
||||
--- @param decisions table A table of decision items.<br/>
|
||||
--- @param selected_decision_index number The current index of the selected decision.<br/>
|
||||
--- @return number selected_decision_index The updated index of the selected decision.
|
||||
--- @return boolean mouse_confirmed True if the user clicked the center to confirm.
|
||||
function Decision.update(decisions, selected_decision_index)
|
||||
if Input.left() then
|
||||
Audio.sfx_beep()
|
||||
@@ -142,5 +143,22 @@ function Decision.update(decisions, selected_decision_index)
|
||||
Audio.sfx_beep()
|
||||
selected_decision_index = Util.safeindex(decisions, selected_decision_index + 1)
|
||||
end
|
||||
return selected_decision_index
|
||||
|
||||
local bar_h = 16
|
||||
local bar_y = Config.screen.height - bar_h
|
||||
local prev_zone = { x = 0, y = bar_y, w = 15, h = bar_h }
|
||||
local next_zone = { x = Config.screen.width-15, y = bar_y, w = 15, h = bar_h }
|
||||
local confirm_zone = { x = 15, y = bar_y, w = Config.screen.width-30, h = bar_h }
|
||||
|
||||
if Mouse.zone(prev_zone) then
|
||||
Audio.sfx_beep()
|
||||
selected_decision_index = Util.safeindex(decisions, selected_decision_index - 1)
|
||||
elseif Mouse.zone(next_zone) then
|
||||
Audio.sfx_beep()
|
||||
selected_decision_index = Util.safeindex(decisions, selected_decision_index + 1)
|
||||
elseif Mouse.zone(confirm_zone) then
|
||||
return selected_decision_index, true
|
||||
end
|
||||
|
||||
return selected_decision_index, false
|
||||
end
|
||||
|
||||
@@ -23,7 +23,7 @@ Context = {}
|
||||
--- * have_met_sumphore (boolean) Whether the player has talked to the homeless guy.<br/>
|
||||
--- * have_been_to_office (boolean) Whether the player has been to the office.<br/>
|
||||
--- * have_done_work_today (boolean) Whether the player has done work today.<br/>
|
||||
--- * game (table) Current game progress state. Contains: `current_screen` (string) active screen ID, `current_situation` (string|nil) active situation ID.<br/>
|
||||
--- * game (table) Current game progress state. Contains: `current_screen` (string) active screen ID<br/>
|
||||
function Context.initial_data()
|
||||
return {
|
||||
current_menu_item = 1,
|
||||
@@ -48,7 +48,6 @@ function Context.initial_data()
|
||||
have_met_sumphore = false,
|
||||
game = {
|
||||
current_screen = "home",
|
||||
current_situation = nil,
|
||||
},
|
||||
day_count = 1,
|
||||
delta_time = 0,
|
||||
|
||||
@@ -3,12 +3,12 @@ Util = {}
|
||||
Meter = {}
|
||||
Minigame = {}
|
||||
Decision = {}
|
||||
Situation = {}
|
||||
Screen = {}
|
||||
Map = {}
|
||||
UI = {}
|
||||
Print = {}
|
||||
Input = {}
|
||||
Mouse = {}
|
||||
Sprite = {}
|
||||
Audio = {}
|
||||
Focus = {}
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
-- desc: Life of a programmer
|
||||
-- site: https://git.teletype.hu/games/impostor
|
||||
-- license: MIT License
|
||||
-- version: 1.0-beta1
|
||||
-- version: 1.0-beta2
|
||||
-- script: lua
|
||||
|
||||
@@ -8,7 +8,6 @@ local _screens = {}
|
||||
--- @param screen_data.name string Display name of the screen.
|
||||
--- @param screen_data.decisions table Array of decision ID strings available on this screen.
|
||||
--- @param screen_data.background string Map ID used as background.
|
||||
--- @param[opt] screen_data.situations table Array of situation ID strings. Defaults to {}.
|
||||
--- @param[opt] screen_data.init function Called when the screen is entered. Defaults to noop.
|
||||
--- @param[opt] screen_data.update function Called each frame while screen is active. Defaults to noop.
|
||||
--- @param[opt] screen_data.draw function Called after the focus overlay to draw screen-specific overlays. Defaults to noop.
|
||||
@@ -16,9 +15,6 @@ function Screen.register(screen_data)
|
||||
if _screens[screen_data.id] then
|
||||
trace("Warning: Overwriting screen with id: " .. screen_data.id)
|
||||
end
|
||||
if not screen_data.situations then
|
||||
screen_data.situations = {}
|
||||
end
|
||||
if not screen_data.init then
|
||||
screen_data.init = function() end
|
||||
end
|
||||
@@ -43,7 +39,6 @@ end
|
||||
--- * name (string) Display name.<br/>
|
||||
--- * decisions (table) Array of decision ID strings.<br/>
|
||||
--- * background (string) Map ID used as background.<br/>
|
||||
--- * situations (table) Array of situation ID strings.<br/>
|
||||
--- * init (function) Called when the screen is entered.<br/>
|
||||
--- * update (function) Called each frame while screen is active.
|
||||
function Screen.get_by_id(screen_id)
|
||||
@@ -58,7 +53,6 @@ end
|
||||
--- * name (string) Display name of the screen.<br/>
|
||||
--- * decisions (table) Array of decision ID strings available on this screen.<br/>
|
||||
--- * background (string) Map ID used as background.<br/>
|
||||
--- * situations (table) Array of situation ID strings.<br/>
|
||||
--- * init (function) Called when the screen is entered.<br/>
|
||||
--- * update (function) Called each frame while screen is active.<br/>
|
||||
function Screen.get_all()
|
||||
|
||||
@@ -81,13 +81,7 @@ local on_text_complete = nil
|
||||
local show_mysterious_screen = true
|
||||
local trigger_flash_on_wake = false
|
||||
|
||||
function MysteriousManScreen.draw_background()
|
||||
local img_values = {0,1,0,1,0,1,0,1,0,1,0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,1,0,1,0,1,0,2,0,1,0,1,0,1,0,2,0,1,0,1,0,2,1,0,1,0,1,2,0,1,0,2,0,2,1,0,1,2,0,2,1,0,1,0,1,2,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,2,0,2,1,0,1,0,1,0,1,0,1,0,2,1,0,1,2,0,1,0,1,2,1,0,1,0,1,0,1,0,2,1,0,2,0,1,0,1,0,2,0,1,0,1,0,2,0,1,0,2,0,1,0,1,0,2,1,0,1,2,0,1,0,1,0,1,0,1,0,2,0,1,0,2,0,1,0,2,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0}
|
||||
local img_runs = {1480,1,151,1,87,1,1,150,1,1,86,1,2,148,1,2,87,2,148,2,88,2,148,2,88,2,148,2,88,2,148,2,88,2,70,1,2,9,1,2,63,2,88,2,69,1,2,3,5,1,1,1,1,1,1,1,61,2,88,2,68,1,1,3,1,2,1,3,2,3,2,61,2,88,2,68,1,6,1,4,1,5,1,1,60,2,88,2,67,1,1,17,2,60,2,88,2,67,1,19,1,1,59,2,88,2,67,1,19,1,1,59,2,88,2,67,4,1,11,1,1,1,3,59,2,88,2,67,21,1,59,2,88,2,67,21,1,59,2,88,2,66,1,21,2,58,2,88,2,66,1,21,1,1,58,2,88,2,66,4,17,2,1,58,2,88,2,65,2,5,1,15,2,58,2,88,2,63,1,1,2,22,4,55,2,88,2,57,2,2,34,2,2,49,2,88,2,55,1,2,39,3,1,47,2,88,2,55,5,1,3,2,2,1,25,1,1,1,1,1,1,1,47,2,88,2,57,1,2,1,29,1,4,1,1,1,1,49,2,88,2,59,1,2,8,15,9,2,52,2,88,2,62,2,1,1,1,24,1,1,1,54,2,88,2,66,1,22,1,58,2,88,2,66,1,21,1,59,2,88,2,66,2,20,1,59,2,88,2,65,3,20,2,58,2,88,2,63,2,2,1,20,1,1,2,56,2,88,2,61,2,4,1,20,1,2,2,55,2,88,2,59,1,1,6,1,19,1,4,2,54,2,88,2,58,2,7,2,17,1,1,6,2,52,3,87,2,56,1,2,9,1,26,2,51,3,87,2,55,1,1,40,1,50,2,88,2,54,2,41,1,50,2,88,2,53,2,42,2,49,2,88,2,52,2,44,2,48,2,88,2,51,2,46,2,47,2,88,2,50,2,16,1,31,1,47,2,88,2,50,3,1,14,1,29,1,1,2,46,2,88,2,50,18,1,29,1,2,1,46,2,88,2,50,4,14,1,33,1,45,2,88,2,53,1,3,11,2,15,1,13,1,2,46,2,88,2,56,1,1,11,1,15,1,10,2,1,49,2,88,2,55,2,3,10,2,12,2,8,8,46,2,88,2,50,1,1,4,4,1,9,2,11,2,8,2,4,2,1,2,1,1,42,2,88,2,48,2,3,8,1,9,2,9,3,7,2,8,1,1,2,1,1,40,2,88,2,45,3,2,1,1,1,1,8,1,7,1,1,3,6,4,6,1,8,1,1,1,1,4,2,38,2,88,2,45,1,2,2,22,4,4,4,6,1,10,1,1,2,1,2,1,2,37,2,88,2,42,1,1,1,4,1,2,19,1,1,4,1,5,21,1,2,6,35,2,88,2,42,2,1,1,1,1,15,2,8,3,4,3,6,1,17,1,1,2,1,1,1,34,2,88,2,41,3,1,1,15,2,9,3,5,2,8,1,21,1,1,34,2,88,2,41,1,1,1,16,2,11,2,5,2,9,2,18,2,1,34,2,88,2,41,1,2,1,14,2,13,1,5,1,12,1,17,1,2,34,2,88,2,41,1,16,1,17,1,2,1,14,2,17,1,1,33,2,88,2,41,1,2,1,12,1,17,1,3,2,15,1,14,1,1,1,1,33,2,88,2,41,15,1,22,1,17,1,1,11,1,3,1,33,2,88,2,41,1,14,2,40,1,15,1,33,2,88,2,41,1,15,2,35,1,3,1,10,1,4,1,33,2,88,2,41,1,3,1,12,2,36,2,11,1,4,1,33,2,88,2,40,1,1,18,1,35,1,12,1,4,1,1,32,2,88,2,40,2,4,1,14,1,33,1,12,1,6,1,32,2,88,2,40,1,6,1,14,1,31,1,13,1,6,1,32,2,88,2,39,2,22,2,28,1,21,1,1,31,2,88,2,39,2,24,1,26,1,22,1,1,31,2,88,2,39,2,25,1,24,1,23,1,1,31,2,88,2,39,1,27,1,22,2,23,1,1,31,2,88,2,39,1,49,2,24,3,30,2,88,2,39,1,48,1,27,1,1,30,2,88,2,39,1,47,2,27,1,1,30,2,88,2,37,1,1,47,2,28,1,1,30,2,88,2,37,1,1,46,1,30,2,1,29,2,88,2,37,1,47,1,30,2,30,2,88,2,37,1,1,2,43,1,33,30,3,87,2,37,1,45,1,31,1,1,2,29,3,87,2,37,45,1,35,1,29,1,1,88,2,1,35,1,1,80,2,1,26,1,3,86,1,1,2,1,21,1,4,4,2,1,3,80,30,1,2,125,2,80,2,156,2,79,2,1,156,2,1,77,4,156,1,3,76,3,1,140,1,15,1,2,2,74,2,1,1,1,5,3,129,1,18,1,82,1,7,1,129,1,18,1,82,1,9,1,123,3,20,1,1,80,2,11,1,1,119,1,22,1,1,1,2,76,4,1,154,2,2,63,1,14,3,1,126,1,27,2,65,1,17,1,17,2,132,4,66,1,17,4,113,39,66,2,16,31,191,1,1,1,15,1,153,2,15,3,48,2,16,2,152,1,16,1,1,1,48,2,16,2,152,1,1,2,2,1,10,1,1,1,48,1,13,6,153,1,3,13,1,1,48,1,15,2,1,1,153,3,64,1,16,2,154,1,1,83,1,154,1,17,1,66,1,154,1,17,1,66,1,155,1,82,1,156,1,82,1,156,1,1,80,1,1,157,2,78,2,158,2,78,2,158,1,80,1,158,1,79,2,158,1,79,1,159,1,79,1,160,1,77,2,160,1,77,1,162,1,74,1,1,1,162,1,75,1,239,1,165,1,72,1,166,1,240,1,69,1,412,1,63,1,175,1,63,2,238,1,175,1,63,1,239,1,807}
|
||||
RLE.draw(img_values, img_runs)
|
||||
end
|
||||
|
||||
local choices = {
|
||||
MysteriousManScreen.choices = {
|
||||
{
|
||||
label = "Wake Up",
|
||||
},
|
||||
@@ -96,7 +90,25 @@ local choices = {
|
||||
},
|
||||
}
|
||||
|
||||
local function go_to_day_state()
|
||||
-- Draws the background image
|
||||
-- @within MysteriousManScreen
|
||||
function MysteriousManScreen.draw_background()
|
||||
local img_values = {0,1,0,1,0,1,0,1,0,1,0,1,2,1,4,1,0,2,4,1,0,2,4,1,0,2,4,1,0,2,4,1,0,2,4,2,1,4,2,1,4,1,0,2,4,1,0,1,4,2,1,2,1,0,1,2,4,1,0,2,4,2,1,0,1,2,1,2,1,0,1,4,1,0,2,4,2,0,1,0,1,0,1,2,4,1,0,2,4,2,1,0,1,4,1,0,2,4,2,0,1,2,4,1,0,2,4,1,0,1,0,4,1,0,2,4,0,1,0,1,0,1,0,4,1,0,2,4,0,1,4,1,0,2,4,0,1,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,0,4,1,0,2,4,1,0,1,0,4,1,0,2,4,1,0,1,0,1,4,1,0,2,4,1,2,1,0,1,4,1,0,2,4,2,1,0,1,2,4,1,0,2,4,2,1,0,1,2,4,1,0,2,4,1,2,0,1,0,1,0,1,2,1,2,1,0,2,4,1,0,2,4,0,1,0,1,2,1,0,1,0,2,4,1,0,2,4,2,1,0,1,0,1,4,1,0,2,4,2,1,0,1,0,2,4,2,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,0,1,0,1,4,1,0,2,4,1,0,1,0,1,0,1,4,1,0,2,4,2,1,0,1,0,2,0,1,4,1,0,2,4,1,0,1,0,1,2,0,1,4,1,0,2,4,2,1,0,1,0,1,4,1,0,2,4,2,1,0,2,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,4,1,0,2,4,1,0,1,0,1,4,1,0,2,4,0,1,0,1,0,1,0,1,4,1,0,2,4,0,1,0,1,0,1,4,1,0,2,4,1,0,1,0,2,4,1,0,2,4,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3,1,47,2,88,2,55,5,1,3,2,2,1,25,1,1,1,1,1,1,1,47,2,88,2,57,1,2,1,29,1,4,1,1,1,1,49,2,88,2,59,1,2,8,15,9,2,52,2,88,2,62,2,1,1,1,24,1,1,1,54,2,88,2,66,1,22,1,58,2,88,2,66,1,21,1,59,2,88,2,66,2,20,1,59,2,88,2,65,3,20,2,58,2,88,2,63,2,2,1,20,1,1,2,56,2,88,2,61,2,4,1,20,1,2,2,55,2,88,2,59,1,1,6,1,19,1,4,2,54,2,88,2,58,2,7,2,17,1,1,6,2,52,3,87,2,56,1,2,9,1,26,2,51,3,87,2,55,1,1,40,1,50,2,88,2,54,2,41,1,50,2,88,2,53,2,42,2,49,2,88,2,52,2,44,2,48,2,88,2,51,2,46,2,47,2,88,2,50,2,16,1,31,1,47,2,88,2,50,3,1,14,1,29,1,1,2,46,2,88,2,50,18,1,29,1,2,1,46,2,88,2,50,4,14,1,33,1,45,2,88,2,53,1,3,11,2,15,1,13,1,2,46,2,88,2,56,1,1,11,1,15,1,10,2,1,49,2,88,2,55,2,3,10,2,12,2,8,8,46,2,88,2,50,1,1,4,4,1,9,2,11,2,8,2,4,2,1,2,1,1,42,2,88,2,48,2,3,8,1,9,2,9,3,7,2,8,1,1,2,1,1,40,2,88,2,45,3,2,1,1,1,1,8,1,7,1,1,3,6,4,6,1,8,1,1,1,1,4,2,38,2,88,2,45,1,2,2,22,4,4,4,6,1,10,1,1,2,1,2,1,2,37,2,88,2,42,1,1,1,4,1,2,19,1,1,4,1,5,21,1,2,6,35,2,88,2,42,2,1,1,1,1,15,2,8,3,4,3,6,1,17,1,1,2,1,1,1,34,2,88,2,41,3,1,1,15,2,9,3,5,2,8,1,21,1,1,34,2,88,2,41,1,1,1,16,2,11,2,5,2,9,2,18,2,1,34,2,88,2,41,1,2,1,14,2,13,1,5,1,12,1,17,1,2,34,2,88,2,41,1,16,1,17,1,2,1,14,2,17,1,1,33,2,88,2,41,1,2,1,12,1,17,1,3,2,15,1,14,1,1,1,1,33,2,88,2,41,15,1,22,1,17,1,1,11,1,3,1,33,2,88,2,41,1,14,2,40,1,15,1,33,2,88,2,41,1,15,2,35,1,3,1,10,1,4,1,33,2,88,2,41,1,3,1,12,2,36,2,11,1,4,1,33,2,88,2,40,1,1,18,1,35,1,12,1,4,1,1,32,2,88,2,40,2,4,1,14,1,33,1,12,1,6,1,32,2,88,2,40,1,6,1,14,1,31,1,13,1,6,1,32,2,88,2,39,2,22,2,28,1,21,1,1,31,2,88,2,39,2,24,1,26,1,22,1,1,31,2,88,2,39,2,25,1,24,1,23,1,1,31,2,88,2,39,1,27,1,22,2,23,1,1,31,2,88,2,39,1,49,2,24,3,30,2,88,2,39,1,48,1,27,1,1,30,2,88,2,39,1,47,2,27,1,1,30,2,88,2,37,1,1,47,2,28,1,1,30,2,88,2,37,1,1,46,1,30,2,1,29,2,88,2,37,1,47,1,30,2,30,2,88,2,37,1,1,2,43,1,33,30,3,87,2,37,1,45,1,31,1,1,2,29,3,87,2,37,45,1,35,1,29,1,1,88,2,1,35,1,1,80,2,1,26,1,3,86,1,1,2,1,21,1,4,4,2,1,3,80,30,1,2,125,2,80,2,156,2,79,2,1,156,2,1,77,4,156,1,3,76,3,1,140,1,15,1,2,2,74,2,1,1,1,5,3,129,1,18,1,82,1,7,1,129,1,18,1,82,1,9,1,123,3,20,1,1,80,2,11,1,1,119,1,22,1,1,1,2,76,4,1,154,2,2,63,1,14,3,1,126,1,27,2,65,1,17,1,17,2,132,4,66,1,17,4,113,39,66,2,16,31,191,1,1,1,15,1,153,2,15,3,48,2,16,2,152,1,16,1,1,1,48,2,16,2,152,1,1,2,2,1,10,1,1,1,48,1,13,6,153,1,3,13,1,1,48,1,15,2,1,1,153,3,64,1,16,2,154,1,1,83,1,154,1,17,1,66,1,154,1,17,1,66,1,155,1,82,1,156,1,82,1,156,1,1,80,1,1,157,2,78,2,158,2,78,2,158,1,80,1,158,1,79,2,158,1,79,1,159,1,79,1,160,1,77,2,160,1,77,1,162,1,74,1,1,1,162,1,75,1,239,1,165,1,72,1,166,1,240,1,69,1,412,1,63,1,175,1,63,2,238,1,175,1,63,1,239,1,807}
|
||||
RLE.draw(img_values, img_runs)
|
||||
end
|
||||
|
||||
function MysteriousManScreen.draw_day_switch_background()
|
||||
local img_values = {1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1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5,12,1,179,2,8,2,17,5,9,5,13,1,176,2,7,3,19,5,9,5,14,1,173,2,7,3,21,5,9,5,15,1,169,3,7,2,24,5,9,5,16,1,166,2,8,2,26,5,9,5,3,1,177,2,8,3,27,5,9,5,4,1,13,1,159,3,7,3,30,5,8,6,5,1,170,3,7,3,32,5,7,7,6,1,13,1,153,2,8,2,35,19,7,1,164,2,7,3,37,19,8,1,160,3,7,3,39,19,9,1,156,3,8,3,41,19,10,1,153,3,8,2,44,19,25,1,136,3,8,2,46,19,160,2,8,3,48,19,157,3,7,4,50,7,6,6,15,1,139,2,9,3,52,6,7,6,16,1,12,1,122,3,8,3,55,6,7,6,17,1,132,4,7,3,57,6,7,6,159,2,60,6,7,6,32,1,123,3,62,6,7,6,33,1,119,4,64,6,7,6,22,1,128,3,67,6,7,6,150,2,1,1,67,6,7,6,153,1,67,6,7,6,25,1,11,1,115,1,67,6,7,6,26,1,126,1,67,6,7,6,28,1,124,1,67,6,7,6,29,1,11,1,111,1,67,6,7,6,30,1,11,1,110,1,66,7,6,8,42,1,109,1,66,21,32,1,10,1,71,4,33,1,66,21,115,1,2,1,33,1,66,21,119,1,32,1,66,21,36,1,115,1,66,21,48,1,66,1,2,1,33,1,66,21,38,1,10,1,65,4,33,1,66,21,152,1,66,21,152,1,66,8,6,7,152,1,66,7,7,7,114,6,32,1,66,7,7,7,114,6,32,1,66,7,7,7,57,1,56,2,2,2,32,1,66,7,7,7,58,1,18,1,35,7,32,1,12,1,49,1,3,7,7,7,19,1,1,1,2,2,24,1,8,2,46,1,4,8,32,1,66,8,6,7,12,1,1,1,4,3,2,2,2,2,2,1,18,2,7,3,44,1,3,9,32,1,12,1,1,1,51,8,6,7,14,1,1,2,1,1,1,1,2,3,1,3,1,1,3,1,2,2,11,4,1,1,2,5,41,1,3,10,32,1,12,3,51,8,5,8,7,3,2,1,1,1,1,2,1,1,1,1,1,4,1,6,1,2,2,2,1,2,1,3,1,2,1,6,1,2,1,4,39,3,2,3,1,6,32,1,8,1,2,6,2,1,4,1,2,1,7,1,30,8,5,8,2,2,3,1,1,1,6,2,1,11,1,6,2,2,1,2,1,6,1,15,24,5,1,3,1,7,2,3,1,10,28,1,14,1,9,2,1,1,38,8,1,1,2,9,1,3,10,1,1,6,10,1,2,2,1,1,3,9,1,4,1,6,1,7,8,47,26,1,27,1,7,1,18,1,4,1,4,13,1,9,1,3,3,1,1,1,1,4,1,1,2,3,2,5,2,7,1,2,1,6,1,7,1,16,1,53,25,1,66,8,1,1,3,8,1,3,3,1,1,2,3,1,1,1,1,4,2,2,2,1,7,1,2,1,1,1,1,4,1,3,1,31,7,2,1,15,6,2,1,7,1,2,25,1,66,7,7,7,29,1,2,1,3,1,6,1,16,1,2,3,6,14,5,16,2,6,10,2,25,1,66,7,7,7,57,1,7,6,1,36,9,8,1,1,25,1,66,7,7,7,68,35,7,11,5,1,25,1,66,7,7,7,69,2,1,3,1,22,7,16,2,1,2,1,25,1,66,8,6,7,75,19,6,21,2,1,2,1,92,21,79,4,1,7,4,26,2,1,2,1,2,1,89,21,91,12,9,1,1,7,2,1,28,1,66,21,87,12,13,9,98,21,84,11,19,6,99,21,80,12,22,2,3,1,32,1,66,21,70,1,5,13,25,6,99,21,73,13,28,6,2,1,29,1,66,21,69,14,31,7,31,1,66,21,58,2,6,14,39,1,99,8,4,9,55,1,6,15,42,1,99,8,5,8,51,2,6,15,145,8,5,8,48,2,5,17,147,8,5,8,43,3,6,17,150,8,5,8,40,2,6,18,153,8,5,8,36,3,5,20,155,8,5,8,32,4,5,19,1,2,156,8,5,8,29,3,6,19,95,1,66,8,5,8,25,4,5,21,97,1,66,8,5,8,22,4,5,21,167,8,5,8,18,5,5,21,170,8,5,8,14,6,4,23,105,1,66,8,5,8,11,4,6,23,108,1,66,8,5,8,8,4,6,23,111,1,66,8,5,8,4,4,6,24,114,1,66,8,5,14,7,23,116,1,66,8,6,8,2,1,4,25,119,1,66,8,5,8,3,1,2,24,122,1,66,8,3,38,124,1,65,24,1,22,127,1,63,1,1,44,130,1,63,7,1,5,1,30,132,1,58,3,1,42,135,1,58,14,2,27,138,1,56,10,1,32,140,1,53,8,4,27,1,3,143,1,49,9,1,1,2,1,1,24,2,2,147,1,47,7,5,32,148,1,30,1,12,8,5,32,151,1,28,1,1,1,3,1,4,4,1,3,6,35,151,1,22,10,1,10,1,1,4,39,151,1,20,25,2,41,151,1,18,47,1,22,151,1,18,70,148,2,1,1,17,71,148,4,17,71,148,4,14,61,2,10,149,6,10,63,2,10,149,8,4,66,4,9,149,80,2,9,149,91,149,92,78,3,67,92,148,80,3,9,148,92,148,92,148,92,148,92,74,1,3,2,68,92,73,3,2,3,67,92,69,1,3,3,2,2,68,94,66,2,1,5,2,3,67,95,58,15,2,1,69,96,55,21,68}
|
||||
-- pal = {184,167,183,121,70,74}
|
||||
-- pal = b8a7b779464a
|
||||
RLE.draw(img_values, img_runs)
|
||||
end
|
||||
|
||||
-- Transitions from the text phase to the day display phase, starting the timer for how long the day label is shown.
|
||||
-- @within MysteriousManScreen
|
||||
function MysteriousManScreen.go_to_day_state()
|
||||
if on_text_complete then
|
||||
on_text_complete()
|
||||
on_text_complete = nil
|
||||
@@ -108,7 +120,9 @@ local function go_to_day_state()
|
||||
day_timer = day_display_seconds
|
||||
end
|
||||
|
||||
local function wake_up()
|
||||
-- Norman chooses to wake up, starting the button mash minigame and flash, then going to the next day.
|
||||
-- @within MysteriousManScreen
|
||||
function MysteriousManScreen.wake_up()
|
||||
Context.home_norman_visible = false
|
||||
Util.go_to_screen_by_id("home")
|
||||
MinigameButtonMashWindow.start("game", {
|
||||
@@ -130,7 +144,9 @@ local function wake_up()
|
||||
})
|
||||
end
|
||||
|
||||
local function stay_in_bed()
|
||||
-- Norman chooses to stay in bed, skipping the minigame and flash, and going straight to the next day.
|
||||
-- @within MysteriousManScreen
|
||||
function MysteriousManScreen.stay_in_bed()
|
||||
Day.increase()
|
||||
state = STATE_DAY
|
||||
day_timer = day_display_seconds
|
||||
@@ -199,18 +215,17 @@ Screen.register({
|
||||
text_done_timer = TEXT_DONE_HOLD_SECONDS
|
||||
-- If skipped by user, go to day state immediately
|
||||
if Input.select() then
|
||||
go_to_day_state()
|
||||
MysteriousManScreen.go_to_day_state()
|
||||
end
|
||||
end
|
||||
else
|
||||
text_done_timer = text_done_timer - Context.delta_time
|
||||
if text_done_timer <= 0 or Input.select() then
|
||||
MysteriousManScreen.go_to_day_state()
|
||||
-- to be continued
|
||||
if 4 <= Ascension.get_level() then
|
||||
Window.set_current("continued")
|
||||
end
|
||||
|
||||
go_to_day_state()
|
||||
end
|
||||
end
|
||||
elseif state == STATE_DAY then
|
||||
@@ -218,21 +233,24 @@ Screen.register({
|
||||
|
||||
if day_timer <= 0 or Input.select() then
|
||||
if trigger_flash_on_wake or Ascension.get_level() < 1 then
|
||||
wake_up()
|
||||
MysteriousManScreen.wake_up()
|
||||
else
|
||||
state = STATE_CHOICE
|
||||
selected_choice = 1
|
||||
end
|
||||
end
|
||||
elseif state == STATE_CHOICE then
|
||||
selected_choice = UI.update_menu(choices, selected_choice)
|
||||
local menu_x = (Config.screen.width - 60) / 2
|
||||
local menu_y = (Config.screen.height - 20) / 2
|
||||
local confirmed
|
||||
selected_choice, confirmed = UI.update_menu(MysteriousManScreen.choices, selected_choice, menu_x, menu_y)
|
||||
|
||||
if Input.select() then
|
||||
if Input.select() or confirmed then
|
||||
Audio.sfx_select()
|
||||
if selected_choice == 1 then
|
||||
wake_up()
|
||||
MysteriousManScreen.wake_up()
|
||||
else
|
||||
stay_in_bed()
|
||||
MysteriousManScreen.stay_in_bed()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -250,6 +268,7 @@ Screen.register({
|
||||
line_y = line_y + 8
|
||||
end
|
||||
elseif state == STATE_DAY then
|
||||
MysteriousManScreen.draw_day_switch_background()
|
||||
local day_text = day_text_override or ("Day " .. Context.day_count)
|
||||
Print.text_center(
|
||||
day_text,
|
||||
@@ -260,7 +279,7 @@ Screen.register({
|
||||
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)
|
||||
UI.draw_menu(MysteriousManScreen.choices, selected_choice, menu_x, menu_y)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -6,9 +6,6 @@ Screen.register({
|
||||
"go_to_walking_to_home",
|
||||
"have_a_coffee",
|
||||
},
|
||||
situations = {
|
||||
"drink_coffee",
|
||||
},
|
||||
init = function()
|
||||
Audio.music_play_room_work()
|
||||
end,
|
||||
|
||||
@@ -16,7 +16,7 @@ Screen.register({
|
||||
end,
|
||||
update = function()
|
||||
if not Context.stat_screen_active then return end
|
||||
if Input.select() or Input.player_interact() then
|
||||
if Input.select() or Input.select() then
|
||||
Focus.stop()
|
||||
Context.stat_screen_active = false
|
||||
Meter.show()
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
Situation.register({
|
||||
id = "drink_coffee",
|
||||
handle = function()
|
||||
Audio.sfx_select()
|
||||
end,
|
||||
})
|
||||
@@ -1,84 +0,0 @@
|
||||
--- @section Situation
|
||||
local _situations = {}
|
||||
|
||||
--- Registers a situation definition.
|
||||
--- @within Situation
|
||||
--- @param situation table The situation data table.
|
||||
--- @param situation.id string Unique situation identifier.<br/>
|
||||
--- @param[opt] situation.screen_id string ID of the screen this situation belongs to.<br/>
|
||||
--- @param[opt] situation.handle function Called when the situation is applied. Defaults to noop.<br/>
|
||||
--- @param[opt] situation.update function Called each frame while situation is active. Defaults to noop.<br/>
|
||||
function Situation.register(situation)
|
||||
if not situation or not situation.id then
|
||||
PopupWindow.show({"Error: Invalid situation object registered (missing id)!"})
|
||||
return
|
||||
end
|
||||
if not situation.handle then
|
||||
situation.handle = function() end
|
||||
end
|
||||
if not situation.update then
|
||||
situation.update = function() end
|
||||
end
|
||||
if _situations[situation.id] then
|
||||
trace("Warning: Overwriting situation with id: " .. situation.id)
|
||||
end
|
||||
_situations[situation.id] = situation
|
||||
end
|
||||
|
||||
--- Gets a situation by ID.
|
||||
--- @within Situation
|
||||
--- @param id string The situation ID.
|
||||
--- @return result table The situation table or nil. </br>
|
||||
--- Fields: </br>
|
||||
--- * id (string) Unique situation identifier.<br/>
|
||||
--- * screen_id (string) ID of the screen this situation belongs to.<br/>
|
||||
--- * handle (function) Called when the situation is applied.<br/>
|
||||
--- * update (function) Called each frame while situation is active.<br/>
|
||||
function Situation.get_by_id(id)
|
||||
return _situations[id]
|
||||
end
|
||||
|
||||
--- Gets all registered situations, optionally filtered by screen ID.
|
||||
--- @within Situation
|
||||
--- @param screen_id string Optional. If provided, returns situations associated with this screen ID.
|
||||
--- @return result table A table containing all registered situation data, indexed by their IDs, or an array filtered by screen_id. </br>
|
||||
--- Fields: </br>
|
||||
--- * id (string) Unique situation identifier.<br/>
|
||||
--- * screen_id (string) ID of the screen this situation belongs to.<br/>
|
||||
--- * handle (function) Called when the situation is applied.<br/>
|
||||
--- * update (function) Called each frame while situation is active.<br/>
|
||||
function Situation.get_all(screen_id)
|
||||
if screen_id then
|
||||
local filtered_situations = {}
|
||||
for _, situation in pairs(_situations) do
|
||||
if situation.screen_id == screen_id then
|
||||
table.insert(filtered_situations, situation)
|
||||
end
|
||||
end
|
||||
return filtered_situations
|
||||
end
|
||||
return _situations
|
||||
end
|
||||
|
||||
--- Applies a situation, checking screen compatibility and returning the new situation ID if successful.
|
||||
--- @within Situation
|
||||
--- @param id string The situation ID to apply.
|
||||
--- @param current_screen_id string The ID of the currently active screen.
|
||||
--- @return string|nil The ID of the applied situation if successful, otherwise nil.
|
||||
function Situation.apply(id, current_screen_id)
|
||||
local situation = Situation.get_by_id(id)
|
||||
local screen = Screen.get_by_id(current_screen_id)
|
||||
|
||||
if not situation then
|
||||
trace("Error: No situation found with id: " .. id)
|
||||
return nil
|
||||
end
|
||||
|
||||
if Util.contains(screen.situations, id) then
|
||||
situation.handle()
|
||||
return id
|
||||
else
|
||||
trace("Info: Situation " .. id .. " cannot be applied to current screen (id: " .. current_screen_id .. ").")
|
||||
return nil
|
||||
end
|
||||
end
|
||||
@@ -5,10 +5,9 @@ local INPUT_KEY_LEFT = 2
|
||||
local INPUT_KEY_RIGHT = 3
|
||||
local INPUT_KEY_A = 4
|
||||
local INPUT_KEY_B = 5
|
||||
local INPUT_KEY_Y = 7
|
||||
local INPUT_KEY_SPACE = 48
|
||||
local INPUT_KEY_BACKSPACE = 51
|
||||
local INPUT_KEY_ENTER = 50
|
||||
local INPUT_KEY_BACKSPACE = 51
|
||||
|
||||
--- Checks if Up is pressed.
|
||||
--- @within Input
|
||||
@@ -22,22 +21,12 @@ 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
|
||||
--- Checks if Menu Confirm is pressed.
|
||||
function Input.select() return btnp(INPUT_KEY_A) or keyp(INPUT_KEY_SPACE) or Mouse.clicked() end
|
||||
--- Checks if Back is pressed.
|
||||
--- @within Input
|
||||
function Input.menu_confirm() return btnp(INPUT_KEY_A) or keyp(INPUT_KEY_ENTER) end
|
||||
--- Checks if Player Interact is pressed.
|
||||
function Input.back() return btnp(INPUT_KEY_B) or keyp(INPUT_KEY_BACKSPACE) end
|
||||
--- Checks if Enter is pressed.
|
||||
--- @within Input
|
||||
function Input.player_interact() return btnp(INPUT_KEY_B) or keyp(INPUT_KEY_ENTER) end
|
||||
--- Checks if Menu Back is pressed.
|
||||
--- @within Input
|
||||
function Input.menu_back() return btnp(INPUT_KEY_Y) or keyp(INPUT_KEY_BACKSPACE) end
|
||||
--- Checks if Toggle Popup is pressed.
|
||||
--- @within Input
|
||||
function Input.toggle_popup() return keyp(INPUT_KEY_ENTER) end
|
||||
function Input.enter() return keyp(INPUT_KEY_ENTER) end
|
||||
|
||||
@@ -17,6 +17,7 @@ end
|
||||
--- @within Main
|
||||
function TIC()
|
||||
init_game()
|
||||
Mouse.update()
|
||||
|
||||
local now = time()
|
||||
if Context.last_frame_time == 0 then
|
||||
|
||||
76
inc/system/system.mouse.lua
Normal file
76
inc/system/system.mouse.lua
Normal file
@@ -0,0 +1,76 @@
|
||||
--- @section Mouse
|
||||
local _mx, _my = 0, 0
|
||||
local _mleft, _mleft_prev = false, false
|
||||
local _consumed = false
|
||||
|
||||
--- Updates mouse state. Call once per frame.
|
||||
--- @within Mouse
|
||||
function Mouse.update()
|
||||
_mleft_prev = _mleft
|
||||
_consumed = false
|
||||
local mt = {mouse()}
|
||||
_mx, _my, _mleft = mt[1], mt[2], mt[3]
|
||||
end
|
||||
|
||||
--- Returns current mouse X position.
|
||||
--- @within Mouse
|
||||
function Mouse.x() return _mx end
|
||||
|
||||
--- Returns current mouse Y position.
|
||||
--- @within Mouse
|
||||
function Mouse.y() return _my end
|
||||
|
||||
--- Returns true if the mouse button was just pressed this frame (and not yet consumed).
|
||||
--- @within Mouse
|
||||
function Mouse.clicked() return _mleft and not _mleft_prev and not _consumed end
|
||||
|
||||
--- Returns true if the mouse button is held down.
|
||||
--- @within Mouse
|
||||
function Mouse.held() return _mleft end
|
||||
|
||||
--- Marks the current click as consumed so Mouse.clicked() won't fire again this frame.
|
||||
--- @within Mouse
|
||||
function Mouse.consume() _consumed = true end
|
||||
|
||||
--- Returns true if the mouse is within the given rectangle.
|
||||
--- @within Mouse
|
||||
--- @param x number Left edge.
|
||||
--- @param y number Top edge.
|
||||
--- @param w number Width.
|
||||
--- @param h number Height.
|
||||
function Mouse.in_rect(x, y, w, h)
|
||||
return _mx >= x and _mx < x + w and _my >= y and _my < y + h
|
||||
end
|
||||
|
||||
--- Returns true if the mouse is within the given circle.
|
||||
--- @within Mouse
|
||||
--- @param cx number Center x.
|
||||
--- @param cy number Center y.
|
||||
--- @param r number Radius.
|
||||
function Mouse.in_circle(cx, cy, r)
|
||||
local dx = _mx - cx
|
||||
local dy = _my - cy
|
||||
return (dx * dx + dy * dy) <= (r * r)
|
||||
end
|
||||
|
||||
--- Returns true if the mouse was clicked inside the given rectangle, and consumes the click.
|
||||
--- @within Mouse
|
||||
--- @param rect table A table with fields: x, y, w, h.
|
||||
function Mouse.zone(rect)
|
||||
if Mouse.clicked() and Mouse.in_rect(rect.x, rect.y, rect.w, rect.h) then
|
||||
Mouse.consume()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--- Returns true if the mouse was clicked inside the given circle, and consumes the click.
|
||||
--- @within Mouse
|
||||
--- @param circle table A table with fields: x, y, r.
|
||||
function Mouse.zone_circle(circle)
|
||||
if Mouse.clicked() and Mouse.in_circle(circle.x, circle.y, circle.r) then
|
||||
Mouse.consume()
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -10,7 +10,7 @@ function Print.text(text, x, y, color, fixed, scale)
|
||||
local shadow_color = Config.colors.black
|
||||
if color == shadow_color then shadow_color = Config.colors.light_grey end
|
||||
scale = scale or 1
|
||||
print(text, x + 1, y + 1, shadow_color, fixed, scale)
|
||||
print(text, x + scale, y + scale, shadow_color, fixed, scale)
|
||||
print(text, x, y, color, fixed, scale)
|
||||
end
|
||||
|
||||
@@ -24,7 +24,7 @@ end
|
||||
--- @param[opt] scale number The scaling factor.<br/>
|
||||
function Print.text_center(text, x, y, color, fixed, scale)
|
||||
scale = scale or 1
|
||||
local text_width = print(text, 0, -6, 0, fixed, scale)
|
||||
local text_width = print(text, 0, -6 * scale, 0, fixed, scale)
|
||||
local centered_x = x - (text_width / 2)
|
||||
Print.text(text, centered_x, y, color, fixed, scale)
|
||||
end
|
||||
|
||||
@@ -38,8 +38,12 @@ end
|
||||
--- @within UI
|
||||
--- @param items table A table of menu items.<br/>
|
||||
--- @param selected_item number The current index of the selected item.<br/>
|
||||
--- @param[opt] x number Menu x position (required for mouse support).<br/>
|
||||
--- @param[opt] y number Menu y position (required for mouse support).<br/>
|
||||
--- @param[opt] centered boolean Whether the menu is centered horizontally.<br/>
|
||||
--- @return number selected_item The updated index of the selected item.
|
||||
function UI.update_menu(items, selected_item)
|
||||
--- @return boolean mouse_confirmed True if the user clicked on a menu item.
|
||||
function UI.update_menu(items, selected_item, x, y, centered)
|
||||
if Input.up() then
|
||||
Audio.sfx_beep()
|
||||
selected_item = selected_item - 1
|
||||
@@ -53,7 +57,25 @@ function UI.update_menu(items, selected_item)
|
||||
selected_item = 1
|
||||
end
|
||||
end
|
||||
return selected_item
|
||||
|
||||
if x ~= nil and y ~= nil then
|
||||
local menu_x = x
|
||||
if centered then
|
||||
local max_w = 0
|
||||
for _, item in ipairs(items) do
|
||||
local w = print(item.label, 0, -10, 0, false, 1, false)
|
||||
if w > max_w then max_w = w end
|
||||
end
|
||||
menu_x = (Config.screen.width - max_w) / 2
|
||||
end
|
||||
for i, _ in ipairs(items) do
|
||||
if Mouse.zone({ x = menu_x - 8, y = y + (i-1) * 10, w = Config.screen.width, h = 10 }) then
|
||||
return i, true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return selected_item, false
|
||||
end
|
||||
|
||||
--- Draws a bordered textbox with scrolling text.
|
||||
|
||||
@@ -107,9 +107,9 @@ function AudioTestWindow.update()
|
||||
AudioTestWindow.menuitems = AudioTestWindow.generate_menuitems(
|
||||
AudioTestWindow.list_func, AudioTestWindow.index_func
|
||||
)
|
||||
elseif Input.menu_confirm() then
|
||||
elseif Input.select() then
|
||||
AudioTestWindow.menuitems[AudioTestWindow.index_menu].decision()
|
||||
elseif Input.menu_back() then
|
||||
elseif Input.back() then
|
||||
AudioTestWindow.back()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,102 +0,0 @@
|
||||
--- @section ConfigurationWindow
|
||||
ConfigurationWindow.controls = {}
|
||||
ConfigurationWindow.selected_control = 1
|
||||
|
||||
--- Initializes configuration window.
|
||||
--- @within ConfigurationWindow
|
||||
function ConfigurationWindow.init()
|
||||
ConfigurationWindow.controls = {
|
||||
{
|
||||
label = "Save",
|
||||
action = function() Config.save() end,
|
||||
type = "action_item"
|
||||
},
|
||||
{
|
||||
label = "Restore Defaults",
|
||||
action = function() Config.reset() end,
|
||||
type = "action_item"
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
--- Draws configuration window.
|
||||
--- @within ConfigurationWindow
|
||||
function ConfigurationWindow.draw()
|
||||
UI.draw_top_bar("Configuration")
|
||||
|
||||
local x_start = 10
|
||||
local y_start = 40
|
||||
local x_value_right_align = Config.screen.width - 10
|
||||
local char_width = 4
|
||||
for i, control in ipairs(ConfigurationWindow.controls) do
|
||||
local current_y = y_start + (i - 1) * 12
|
||||
local color = Config.colors.light_blue
|
||||
if control.type == "numeric_stepper" then
|
||||
local value = control.get()
|
||||
local label_text = control.label
|
||||
local value_text = string.format(control.format, value)
|
||||
local value_x = x_value_right_align - (#value_text * char_width)
|
||||
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
Print.text("<", x_start - 8, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(value_text, value_x, current_y, color)
|
||||
Print.text(">", x_value_right_align + 4, current_y, color)
|
||||
else
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(value_text, value_x, current_y, color)
|
||||
end
|
||||
elseif control.type == "action_item" then
|
||||
local label_text = control.label
|
||||
if i == ConfigurationWindow.selected_control then
|
||||
color = Config.colors.item
|
||||
Print.text("<", x_start - 8, current_y, color)
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
Print.text(">", x_start + 8 + (#label_text * char_width) + 4, current_y, color)
|
||||
else
|
||||
Print.text(label_text, x_start, current_y, color)
|
||||
end
|
||||
end
|
||||
end
|
||||
Print.text("Press B to go back", x_start, 120, Config.colors.light_grey)
|
||||
end
|
||||
|
||||
--- Updates configuration window logic.
|
||||
--- @within ConfigurationWindow
|
||||
function ConfigurationWindow.update()
|
||||
if Input.menu_back() then
|
||||
GameWindow.set_state("menu")
|
||||
return
|
||||
end
|
||||
|
||||
if Input.up() then
|
||||
ConfigurationWindow.selected_control = ConfigurationWindow.selected_control - 1
|
||||
if ConfigurationWindow.selected_control < 1 then
|
||||
ConfigurationWindow.selected_control = #ConfigurationWindow.controls
|
||||
end
|
||||
elseif Input.down() then
|
||||
ConfigurationWindow.selected_control = ConfigurationWindow.selected_control + 1
|
||||
if ConfigurationWindow.selected_control > #ConfigurationWindow.controls then
|
||||
ConfigurationWindow.selected_control = 1
|
||||
end
|
||||
end
|
||||
|
||||
local control = ConfigurationWindow.controls[ConfigurationWindow.selected_control]
|
||||
if control then
|
||||
if control.type == "numeric_stepper" then
|
||||
local current_value = control.get()
|
||||
if Input.left() then
|
||||
local new_value = math.max(control.min, current_value - control.step)
|
||||
control.set(new_value)
|
||||
elseif Input.right() then
|
||||
local new_value = math.min(control.max, current_value + control.step)
|
||||
control.set(new_value)
|
||||
end
|
||||
elseif control.type == "action_item" then
|
||||
if Input.menu_confirm() then
|
||||
control.action()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -26,7 +26,7 @@ end
|
||||
--- @within ContinuedWindow
|
||||
function ContinuedWindow.update()
|
||||
ContinuedWindow.timer = ContinuedWindow.timer - 1
|
||||
if ContinuedWindow.timer <= 0 or Input.select() or Input.menu_confirm() then
|
||||
if ContinuedWindow.timer <= 0 or Input.select() or Input.select() then
|
||||
Window.set_current("menu")
|
||||
MenuWindow.refresh_menu_items()
|
||||
end
|
||||
|
||||
44
inc/window/window.controls.lua
Normal file
44
inc/window/window.controls.lua
Normal file
@@ -0,0 +1,44 @@
|
||||
--- @section ControlsWindow
|
||||
local _controls = {
|
||||
{ action = "Navigate", keyboard = "Arrow keys", gamepad = "D-pad" },
|
||||
{ action = "Select / OK", keyboard = "Space", gamepad = "Z button" },
|
||||
{ action = "Back", keyboard = "Backspace", gamepad = "B button" },
|
||||
{ action = "Click", keyboard = "Mouse", gamepad = "" },
|
||||
}
|
||||
|
||||
--- Draws the controls window.
|
||||
--- @within ControlsWindow
|
||||
function ControlsWindow.draw()
|
||||
UI.draw_top_bar("Controls")
|
||||
|
||||
local col_action = 4
|
||||
local col_keyboard = 80
|
||||
local col_gamepad = 170
|
||||
local row_h = 10
|
||||
local y_header = 18
|
||||
local y_start = 30
|
||||
|
||||
Print.text("Action", col_action, y_header, Config.colors.light_grey)
|
||||
Print.text("Keyboard", col_keyboard, y_header, Config.colors.light_grey)
|
||||
Print.text("Gamepad", col_gamepad, y_header, Config.colors.light_grey)
|
||||
line(col_action, y_header + 8, Config.screen.width - 4, y_header + 8, Config.colors.dark_grey)
|
||||
|
||||
for i, entry in ipairs(_controls) do
|
||||
local y = y_start + (i - 1) * row_h
|
||||
Print.text(entry.action, col_action, y, Config.colors.white)
|
||||
Print.text(entry.keyboard, col_keyboard, y, Config.colors.light_blue)
|
||||
if entry.gamepad ~= "" then
|
||||
Print.text(entry.gamepad, col_gamepad, y, Config.colors.light_blue)
|
||||
end
|
||||
end
|
||||
|
||||
Print.text("Space / Z button or click to go back", col_action, Config.screen.height - 10, Config.colors.light_grey)
|
||||
end
|
||||
|
||||
--- Updates the controls window logic.
|
||||
--- @within ControlsWindow
|
||||
function ControlsWindow.update()
|
||||
if Input.back() or Input.select() then
|
||||
Window.set_current("menu")
|
||||
end
|
||||
end
|
||||
@@ -52,7 +52,7 @@ function EndWindow.update()
|
||||
end
|
||||
end
|
||||
|
||||
if Input.menu_confirm() then
|
||||
if Input.select() then
|
||||
Audio.sfx_select()
|
||||
if Context._end.selection == 1 then
|
||||
Context._end.state = "ending"
|
||||
@@ -69,7 +69,7 @@ function EndWindow.update()
|
||||
end
|
||||
end
|
||||
elseif Context._end.state == "ending" then
|
||||
if Input.menu_confirm() then
|
||||
if Input.select() then
|
||||
Window.set_current("menu")
|
||||
MenuWindow.refresh_menu_items()
|
||||
end
|
||||
|
||||
@@ -38,7 +38,7 @@ end
|
||||
--- @within GameWindow
|
||||
function GameWindow.update()
|
||||
Focus.update()
|
||||
if Input.menu_back() then
|
||||
if Input.back() then
|
||||
Window.set_current("menu")
|
||||
MenuWindow.refresh_menu_items()
|
||||
return
|
||||
@@ -48,14 +48,6 @@ function GameWindow.update()
|
||||
if not screen or not screen.update then return end
|
||||
screen.update()
|
||||
|
||||
-- Handle current situation updates
|
||||
if Context.game.current_situation then
|
||||
local current_situation_obj = Situation.get_by_id(Context.game.current_situation)
|
||||
if current_situation_obj and type(current_situation_obj.update) == "function" then
|
||||
current_situation_obj.update()
|
||||
end
|
||||
end
|
||||
|
||||
if Context.stat_screen_active then return end
|
||||
|
||||
-- Fetch and filter decisions locally
|
||||
@@ -68,7 +60,7 @@ function GameWindow.update()
|
||||
_selected_decision_index = 1
|
||||
end
|
||||
|
||||
local new_selected_decision_index = Decision.update(
|
||||
local new_selected_decision_index, mouse_confirmed = Decision.update(
|
||||
_available_decisions,
|
||||
_selected_decision_index
|
||||
)
|
||||
@@ -77,7 +69,7 @@ function GameWindow.update()
|
||||
_selected_decision_index = new_selected_decision_index
|
||||
end
|
||||
|
||||
if Input.select() then
|
||||
if Input.select() or mouse_confirmed then
|
||||
local selected_decision = _available_decisions[_selected_decision_index]
|
||||
if selected_decision and selected_decision.handle then
|
||||
Audio.sfx_select()
|
||||
|
||||
@@ -31,7 +31,7 @@ function BriefIntroWindow.update()
|
||||
lines = lines + 1
|
||||
end
|
||||
|
||||
if BriefIntroWindow.y < -lines * 8 or Input.select() or Input.menu_confirm() then
|
||||
if BriefIntroWindow.y < -lines * 8 or Input.select() or Input.select() then
|
||||
Window.set_current("menu")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -30,7 +30,7 @@ end
|
||||
--- @within TitleIntroWindow
|
||||
function TitleIntroWindow.update()
|
||||
TitleIntroWindow.timer = TitleIntroWindow.timer - 1
|
||||
if TitleIntroWindow.timer <= 0 or Input.select() or Input.menu_confirm() then
|
||||
if TitleIntroWindow.timer <= 0 or Input.select() or Input.select() then
|
||||
Window.set_current("intro_ttg")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -27,13 +27,13 @@ function TTGIntroWindow.update()
|
||||
TTGIntroWindow.glitch_started = true
|
||||
end
|
||||
|
||||
-- Count menu_back presses during the intro
|
||||
if Input.menu_back() then
|
||||
-- Count enter presses during the intro
|
||||
if Input.enter() then
|
||||
TTGIntroWindow.space_count = TTGIntroWindow.space_count + 1
|
||||
end
|
||||
|
||||
TTGIntroWindow.timer = TTGIntroWindow.timer - 1
|
||||
if TTGIntroWindow.timer <= 0 or Input.menu_confirm() then
|
||||
if TTGIntroWindow.timer <= 0 or Input.select() then
|
||||
-- Evaluate exactly 3 presses at the end of the intro
|
||||
if TTGIntroWindow.space_count == 3 then
|
||||
Context.test_mode = true
|
||||
|
||||
@@ -1,18 +1,62 @@
|
||||
--- @section MenuWindow
|
||||
local _menu_items = {}
|
||||
local _click_timer = 0
|
||||
local _anim = 0
|
||||
local _menu_max_w = 0
|
||||
local ANIM_SPEED = 2.5
|
||||
local HEADER_H = 28
|
||||
|
||||
--- Calculates the animated x position of the menu block.
|
||||
--- @within MenuWindow
|
||||
--- @return number x The left edge x coordinate for the menu.
|
||||
function MenuWindow.calc_menu_x()
|
||||
local center_start = Config.screen.width / 2
|
||||
local center_end = Config.screen.width * 0.72
|
||||
local center = center_start + _anim * (center_end - center_start)
|
||||
return math.floor(center - _menu_max_w / 2)
|
||||
end
|
||||
|
||||
--- Draws the header with title and separator.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.draw_header()
|
||||
rect(0, 0, Config.screen.width, HEADER_H, Config.colors.dark_grey)
|
||||
rect(0, HEADER_H - 2, Config.screen.width, 2, Config.colors.light_blue)
|
||||
|
||||
local cx = Config.screen.width / 2
|
||||
local subtitle = "Definitely not an"
|
||||
if Context.test_mode then subtitle = subtitle .. " [TEST]" end
|
||||
local sub_w = print(subtitle, 0, -6, 0, false, 1, true)
|
||||
print(subtitle, math.floor(cx - sub_w / 2) + 1, 5, Config.colors.dark_grey, false, 1, true)
|
||||
print(subtitle, math.floor(cx - sub_w / 2), 4, Config.colors.light_grey, false, 1, true)
|
||||
|
||||
Print.text_center("IMPOSTOR", cx, 12, Config.colors.item, false, 2)
|
||||
end
|
||||
|
||||
--- Draws the 4x scaled Norman sprite on the left side of the screen.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.draw_norman()
|
||||
local nx = math.floor(Config.screen.width * 0.45 / 2) - 32
|
||||
local ny = HEADER_H + math.floor((Config.screen.height - HEADER_H - 96) / 2)
|
||||
spr(272, nx, ny, 0, 4)
|
||||
spr(273, nx + 32, ny, 0, 4)
|
||||
spr(288, nx, ny + 32, 0, 4)
|
||||
spr(289, nx + 32, ny + 32, 0, 4)
|
||||
spr(304, nx, ny + 64, 0, 4)
|
||||
spr(305, nx + 32, ny + 64, 0, 4)
|
||||
end
|
||||
|
||||
--- Draws the menu window.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.draw()
|
||||
local title = "Definitely not an Impostor"
|
||||
if Context.test_mode then
|
||||
title = title .. " (TEST MODE)"
|
||||
MenuWindow.draw_header()
|
||||
|
||||
if _anim > 0 then
|
||||
MenuWindow.draw_norman()
|
||||
end
|
||||
UI.draw_top_bar(title)
|
||||
|
||||
local menu_h = #_menu_items * 10
|
||||
local y = 10 + (Config.screen.height - 10 - 10 - menu_h) / 2
|
||||
UI.draw_menu(_menu_items, Context.current_menu_item, 0, y, true)
|
||||
local y = HEADER_H + math.floor((Config.screen.height - HEADER_H - 10 - menu_h) / 2)
|
||||
UI.draw_menu(_menu_items, Context.current_menu_item, MenuWindow.calc_menu_x(), y, false)
|
||||
|
||||
local ttg_text = "TTG"
|
||||
local ttg_w = print(ttg_text, 0, -10, 0, false, 1, false)
|
||||
@@ -22,9 +66,32 @@ end
|
||||
--- Updates the menu window logic.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.update()
|
||||
Context.current_menu_item = UI.update_menu(_menu_items, Context.current_menu_item)
|
||||
if _anim < 1 then
|
||||
_anim = math.min(1, _anim + ANIM_SPEED * Context.delta_time)
|
||||
end
|
||||
|
||||
if Input.menu_confirm() then
|
||||
local menu_h = #_menu_items * 10
|
||||
local y = HEADER_H + math.floor((Config.screen.height - HEADER_H - 10 - menu_h) / 2)
|
||||
|
||||
if _click_timer > 0 then
|
||||
_click_timer = _click_timer - Context.delta_time
|
||||
if _click_timer <= 0 then
|
||||
_click_timer = 0
|
||||
local selected_item = _menu_items[Context.current_menu_item]
|
||||
if selected_item and selected_item.decision then
|
||||
selected_item.decision()
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local new_item, mouse_confirmed = UI.update_menu(_menu_items, Context.current_menu_item, MenuWindow.calc_menu_x(), y, false)
|
||||
Context.current_menu_item = new_item
|
||||
|
||||
if mouse_confirmed then
|
||||
Audio.sfx_select()
|
||||
_click_timer = 0.5
|
||||
elseif Input.select() then
|
||||
local selected_item = _menu_items[Context.current_menu_item]
|
||||
if selected_item and selected_item.decision then
|
||||
Audio.sfx_select()
|
||||
@@ -64,11 +131,10 @@ function MenuWindow.exit()
|
||||
exit()
|
||||
end
|
||||
|
||||
--- Opens the configuration menu.
|
||||
--- Opens the controls screen.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.configuration()
|
||||
ConfigurationWindow.init()
|
||||
GameWindow.set_state("configuration")
|
||||
function MenuWindow.controls()
|
||||
Window.set_current("controls")
|
||||
end
|
||||
|
||||
--- Opens the audio test menu.
|
||||
@@ -85,7 +151,7 @@ function MenuWindow.continued()
|
||||
GameWindow.set_state("continued")
|
||||
end
|
||||
|
||||
--- Opens the minigame ddr test menu.
|
||||
--- Opens the DDR minigame test.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.ddr_test()
|
||||
AudioTestWindow.init()
|
||||
@@ -93,26 +159,34 @@ function MenuWindow.ddr_test()
|
||||
MinigameDDRWindow.start("menu", "generated", { special_mode = "only_nothing" })
|
||||
end
|
||||
|
||||
--- Refreshes menu items.
|
||||
--- Refreshes the list of menu items based on current game state.
|
||||
--- @within MenuWindow
|
||||
function MenuWindow.refresh_menu_items()
|
||||
_menu_items = {}
|
||||
if Context.game_in_progress then
|
||||
table.insert(_menu_items, {label = "Resume Game", decision = MenuWindow.resume_game})
|
||||
table.insert(_menu_items, {label = "Save Game", decision = MenuWindow.save_game})
|
||||
table.insert(_menu_items, {label = "Save Game", decision = MenuWindow.save_game})
|
||||
end
|
||||
|
||||
table.insert(_menu_items, {label = "New Game", decision = MenuWindow.new_game})
|
||||
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 = "Controls", decision = MenuWindow.controls})
|
||||
|
||||
if Context.test_mode then
|
||||
table.insert(_menu_items, {label = "Audio Test", decision = MenuWindow.audio_test})
|
||||
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})
|
||||
table.insert(_menu_items, {label = "DDR Test", decision = MenuWindow.ddr_test})
|
||||
end
|
||||
|
||||
table.insert(_menu_items, {label = "Exit", decision = MenuWindow.exit})
|
||||
|
||||
_menu_max_w = 0
|
||||
for _, item in ipairs(_menu_items) do
|
||||
local w = print(item.label, 0, -10, 0, false, 1, false)
|
||||
if w > _menu_max_w then _menu_max_w = w end
|
||||
end
|
||||
|
||||
Context.current_menu_item = 1
|
||||
_click_timer = 0
|
||||
_anim = 0
|
||||
end
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
--- @section MinigameDDRWindow
|
||||
|
||||
--- Background drawing for DDR minigame.
|
||||
--- @witin MinigameDDRWindow
|
||||
function MinigameDDRWindow.draw_background()
|
||||
local img_values = {1,0,1,0,1,0,1,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0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1}
|
||||
local img_runs = {809,40,5,26,178,42,4,7,30,10,127,103,11,1,116,124,116,124,115,18,60,47,115,10,105,10,115,9,108,9,114,9,108,9,114,9,108,9,114,9,33,31,44,9,114,9,34,28,46,9,114,9,108,9,114,9,108,9,114,9,108,9,114,9,108,9,114,9,109,8,114,9,109,8,114,9,109,9,112,10,105,1,3,9,111,11,104,2,3,9,111,11,101,5,3,9,111,11,101,5,3,9,111,9,103,5,3,9,111,9,99,1,2,6,3,9,111,9,99,1,2,8,1,9,111,9,3,1,88,1,3,1,2,11,1,9,111,9,3,1,88,1,3,14,1,9,111,9,3,1,88,1,3,1,2,11,1,9,111,9,3,1,88,1,5,12,1,9,111,9,3,1,88,1,3,14,1,9,111,9,3,1,88,3,1,1,2,11,1,9,111,9,3,1,88,3,1,14,1,9,111,9,3,1,88,3,2,13,2,8,111,9,3,1,88,3,3,12,3,8,110,9,3,1,88,3,3,12,3,9,109,9,3,1,88,3,1,14,3,9,109,9,3,1,90,1,1,7,3,4,3,9,109,9,3,1,90,1,1,5,6,3,3,9,108,10,3,1,44,1,4,1,40,1,1,5,7,2,3,9,108,10,3,1,44,1,4,1,38,3,1,5,7,3,2,9,108,10,3,1,48,1,39,3,1,5,7,2,3,9,108,10,3,1,88,3,1,5,6,3,3,9,108,10,3,1,32,5,4,4,3,2,38,3,1,15,2,9,108,10,3,1,41,5,2,2,2,4,32,3,1,15,2,9,108,10,2,2,41,9,2,5,3,1,3,1,23,3,1,9,1,5,2,9,108,10,2,2,41,12,35,3,1,7,4,4,2,9,108,10,2,2,32,26,30,3,1,5,7,3,2,9,108,10,2,2,36,21,31,9,7,3,2,9,108,10,2,2,35,23,30,10,6,3,2,9,108,10,2,2,35,23,30,11,4,4,2,9,108,10,2,2,34,24,30,19,2,9,108,10,2,2,33,25,30,19,2,9,108,10,2,2,32,28,28,19,2,9,108,10,2,2,32,30,26,19,2,9,108,10,2,2,33,31,24,19,2,9,108,10,2,4,37,17,32,19,2,10,107,10,2,5,85,19,2,10,107,10,2,109,2,10,107,12,1,107,3,10,107,133,107,133,107,133,107,133,107,133,107,133,107,133,118,111,129,6,63,3,28,10,121,13,98,6,142,7,76,6,129,10,13,5,77,15,109,4,31,4,78,4,24,7,75,173,66,176,64,177,62,178,62,178,62,56,31,2,7,2,2,3,2,1,2,1,61,8,62,56,114,8,62,56,114,8,62,56,114,8,62,56,114,8,62,9,8,39,114,9,61,8,9,39,114,9,61,8,9,39,114,9,61,8,9,39,114,9,61,8,9,39,114,9,61,8,9,39,114,9,61,8,9,39,115,8,61,8,8,40,115,8,61,56,115,8,61,13,2,1,1,1,1,16,1,1,2,17,115,8,61,13,2,1,1,1,2,1,1,10,2,1,1,1,2,1,2,7,1,6,115,8,60,14,2,1,1,1,5,9,2,1,1,1,2,1,2,6,2,6,115,8,59,15,2,1,1,1,5,9,2,1,1,1,2,1,2,6,2,6,115,8,59,15,2,1,1,1,6,8,2,1,1,1,2,1,2,14,115,8,59,6,1,11,1,1,7,10,1,1,2,1,2,14,115,8,59,6,1,11,1,1,7,10,1,1,2,1,2,1,1,12,115,9,58,6,1,1,2,10,9,8,1,1,2,1,2,1,1,12,115,9,58,6,1,1,2,8,1,1,9,8,1,1,2,1,2,1,1,11,116,9,58,6,1,1,2,1,2,7,9,8,1,1,2,1,2,1,1,11,116,9,58,6,1,1,2,1,2,7,9,10,2,1,2,1,1,11,116,9,58,57,116,9,58,58,115,9,102,13,116,9,58,48,2,10,1,3,22,84,5,7,58,158,7,5,6,6,75,3,7,2,7,1,7,2,6,1,6,2,6,2,4,4,6,2,6,1,6,2,6,3,6,1,6,5,7,8,7,9,11,1,9,2,50,1,22,1,14,5,3,5,3,4,3,6,3,5,2,16,2,5,3,14,2,6,2,6,5,5,11,4,30,1,50,1,37,6,3,5,3,5,2,6,3,5,3,6,1,7,2,6,2,15,2,6,2,5,6,5,12,1,15,1,106,93,2,8,10,5,2,6,2,5,4,4,100,7,3,13,2,65,3,8,3,5,2,5,4,4,3,5,4,4,100,94,2,5,3,5,4,4,6,5,2,5,105,86,2,13,3,5,4,4,6,5,2,1,1,3,102,4,2,24,2,62,1,1,2,7,3,5,4,5,4,5,2,8,4,2,92,5,2,24,2,61,5,5,7,2,5,6,3,4,3,7,102,88,6,7,12,8,6,1,3,7,103,87,6,7,11,9,6,1,3,7,110,1,9,9,5,1,2,1,3,47,162,1,10,6,27,34,162,1,10,6,27,34,97,3,57,14,2,7,26,66,9,33,5,2,17,223,17,223,18,222,47,193,53,1,3,163,19,1,85,109,14,29,36,151,784}
|
||||
-- pal = {220,220,220,90,90,90}
|
||||
-- pal = dcdcdc5a5a5a
|
||||
RLE.draw(img_values, img_runs)
|
||||
end
|
||||
|
||||
--- Gets initial DDR minigame configuration.
|
||||
--- @within MinigameDDRWindow
|
||||
--- @return result table The default DDR minigame configuration.
|
||||
@@ -345,6 +355,12 @@ function MinigameDDRWindow.update()
|
||||
right = Input.right()
|
||||
}
|
||||
|
||||
for _, target in ipairs(mg.target_arrows) do
|
||||
if Mouse.zone({ x = target.x, y = mg.target_y, w = mg.arrow_size, h = mg.arrow_size }) then
|
||||
input_map[target.dir] = true
|
||||
end
|
||||
end
|
||||
|
||||
for dir, pressed in pairs(input_map) do
|
||||
if pressed and mg.input_cooldowns[dir] == 0 then
|
||||
mg.input_cooldowns[dir] = mg.input_cooldown_duration
|
||||
@@ -387,13 +403,14 @@ function MinigameDDRWindow.draw()
|
||||
end
|
||||
return
|
||||
end
|
||||
if mg.return_window == "game" then
|
||||
GameWindow.draw()
|
||||
end
|
||||
-- if mg.return_window == "game" then
|
||||
-- GameWindow.draw()
|
||||
-- end
|
||||
rect(0, 0, Config.screen.width, Config.screen.height, Config.colors.black)
|
||||
rect(mg.bar_x - 2, mg.bar_y - 2, mg.bar_width + 4, mg.bar_height + 4, Config.colors.light_grey)
|
||||
rectb(mg.bar_x - 2, mg.bar_y - 2, mg.bar_width + 4, mg.bar_height + 4, Config.colors.dark_grey)
|
||||
local fill_width = (mg.bar_fill / mg.max_fill) * mg.bar_width
|
||||
MinigameDDRWindow.draw_background()
|
||||
if fill_width > 0 then
|
||||
local bar_color = Config.colors.light_blue
|
||||
if mg.bar_fill > 66 then
|
||||
|
||||
@@ -83,7 +83,9 @@ function MinigameButtonMashWindow.update()
|
||||
return
|
||||
end
|
||||
|
||||
if Input.select() then
|
||||
local mouse_on_button = Mouse.zone_circle({ x = mg.button_x, y = mg.button_y, r = mg.button_size })
|
||||
|
||||
if Input.select() or mouse_on_button then
|
||||
Audio.sfx_drum_high()
|
||||
|
||||
mg.bar_fill = mg.bar_fill + mg.fill_per_press
|
||||
|
||||
@@ -95,7 +95,9 @@ function MinigameRhythmWindow.update()
|
||||
if mg.press_cooldown > 0 then
|
||||
mg.press_cooldown = mg.press_cooldown - 1
|
||||
end
|
||||
if Input.select() and mg.press_cooldown == 0 then
|
||||
local mouse_on_button = Mouse.zone_circle({ x = mg.button_x, y = mg.button_y, r = mg.button_size })
|
||||
|
||||
if (Input.select() or mouse_on_button) and mg.press_cooldown == 0 then
|
||||
mg.button_pressed_timer = mg.button_press_duration
|
||||
mg.press_cooldown = mg.press_cooldown_duration
|
||||
local target_left = mg.target_center - (mg.target_width / 2)
|
||||
|
||||
@@ -28,7 +28,7 @@ end
|
||||
--- @within PopupWindow
|
||||
function PopupWindow.update()
|
||||
if Context.popup.show then
|
||||
if Input.menu_confirm() or Input.menu_back() then
|
||||
if Input.select() or Input.back() then
|
||||
PopupWindow.hide()
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,8 +16,8 @@ Window.register("game", GameWindow)
|
||||
PopupWindow = {}
|
||||
Window.register("popup", PopupWindow)
|
||||
|
||||
ConfigurationWindow = {}
|
||||
Window.register("configuration", ConfigurationWindow)
|
||||
ControlsWindow = {}
|
||||
Window.register("controls", ControlsWindow)
|
||||
|
||||
AudioTestWindow = {}
|
||||
Window.register("audiotest", AudioTestWindow)
|
||||
|
||||
Reference in New Issue
Block a user