Compare commits
1 Commits
feature/ta
...
39e06d1d09
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
39e06d1d09 |
BIN
assets_src/26.01.14 Norman szobája v1.6.ase
Normal file
BIN
assets_src/26.01.14 Norman szobája v1.6.ase
Normal file
Binary file not shown.
BIN
assets_src/26.01.20 Iroda v1.0.ase
Normal file
BIN
assets_src/26.01.20 Iroda v1.0.ase
Normal file
Binary file not shown.
BIN
assets_src/26.01.20 Iroda v1.1.ase
Normal file
BIN
assets_src/26.01.20 Iroda v1.1.ase
Normal file
Binary file not shown.
Binary file not shown.
@@ -27,13 +27,13 @@ end
|
|||||||
--- Gets a decision by ID.
|
--- Gets a decision by ID.
|
||||||
-- @param id string The ID of the decision.
|
-- @param id string The ID of the decision.
|
||||||
-- @return table The decision table or nil.
|
-- @return table The decision table or nil.
|
||||||
function Decision.get_by_id(id)
|
function Decision.get(id)
|
||||||
return _decisions[id]
|
return _decisions[id]
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets all registered decisions.
|
--- Gets all registered decisions.
|
||||||
-- @return table A table of all registered decisions.
|
-- @return table A table of all registered decisions.
|
||||||
function Decision.get_all()
|
function Decision.get_all_registered()
|
||||||
return _decisions
|
return _decisions
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ function Decision.get_for_screen(screen_data)
|
|||||||
|
|
||||||
local screen_decisions = {}
|
local screen_decisions = {}
|
||||||
for _, decision_id in ipairs(screen_data.decisions) do
|
for _, decision_id in ipairs(screen_data.decisions) do
|
||||||
local decision = Decision.get_by_id(decision_id)
|
local decision = Decision.get(decision_id)
|
||||||
if decision then
|
if decision then
|
||||||
table.insert(screen_decisions, decision)
|
table.insert(screen_decisions, decision)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ end
|
|||||||
function Context.reset()
|
function Context.reset()
|
||||||
local initial_data = Context.initial_data()
|
local initial_data = Context.initial_data()
|
||||||
for k in pairs(Context) do
|
for k in pairs(Context) do
|
||||||
if type(Context[k]) ~= "function" then
|
if type(Context[k]) ~= "function" then Context[k] = nil
|
||||||
Context[k] = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
-- Manages minigame configurations and initial states.
|
-- Manages minigame configurations and initial states.
|
||||||
|
Minigame = {}
|
||||||
|
|
||||||
--- Applies parameters to defaults.
|
--- Applies parameters to defaults.
|
||||||
-- @param defaults table The default configuration table.
|
-- @param defaults table The default configuration table.
|
||||||
|
|||||||
@@ -2,9 +2,7 @@ local INPUT_KEY_UP = 0
|
|||||||
local INPUT_KEY_DOWN = 1
|
local INPUT_KEY_DOWN = 1
|
||||||
local INPUT_KEY_LEFT = 2
|
local INPUT_KEY_LEFT = 2
|
||||||
local INPUT_KEY_RIGHT = 3
|
local INPUT_KEY_RIGHT = 3
|
||||||
local INPUT_KEY_A = 4
|
local INPUT_KEY_A = 4 local INPUT_KEY_B = 5 local INPUT_KEY_Y = 7
|
||||||
local INPUT_KEY_B = 5
|
|
||||||
local INPUT_KEY_Y = 7
|
|
||||||
local INPUT_KEY_SPACE = 48
|
local INPUT_KEY_SPACE = 48
|
||||||
local INPUT_KEY_BACKSPACE = 51
|
local INPUT_KEY_BACKSPACE = 51
|
||||||
local INPUT_KEY_ENTER = 50
|
local INPUT_KEY_ENTER = 50
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
--- Utility functions.
|
||||||
|
Util = {}
|
||||||
|
|
||||||
--- Safely wraps an index for an array.
|
--- Safely wraps an index for an array.
|
||||||
-- @param array table The array to index.
|
-- @param array table The array to index.
|
||||||
@@ -13,13 +15,16 @@ function Util.go_to_screen_by_id(screen_id)
|
|||||||
local screen = Screen.get_by_id(screen_id)
|
local screen = Screen.get_by_id(screen_id)
|
||||||
if screen then
|
if screen then
|
||||||
Context.game.current_screen = screen_id
|
Context.game.current_screen = screen_id
|
||||||
screen.init()
|
local all_decisions_for_screen = Decision.get_for_screen(screen)
|
||||||
|
Context.game.decisions = Decision.filter_available(all_decisions_for_screen)
|
||||||
|
Context.game.selected_decision_index = 1
|
||||||
|
screen.init() -- Initialize the new screen
|
||||||
else
|
else
|
||||||
PopupWindow.show({"Error: Screen '" .. screen_id .. "' not found!"})
|
PopupWindow.show({"Error: Screen '" .. screen_id .. "' not found!"})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Checks if a table contains a specific value.
|
-- Checks if a table contains a specific value.
|
||||||
-- @param t table The table to check.
|
-- @param t table The table to check.
|
||||||
-- @param value any The value to look for.
|
-- @param value any The value to look for.
|
||||||
function Util.contains(t, value)
|
function Util.contains(t, value)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ local _selected_decision_index = 1
|
|||||||
--- Draws the game window.
|
--- Draws the game window.
|
||||||
function GameWindow.draw()
|
function GameWindow.draw()
|
||||||
local screen = Screen.get_by_id(Context.game.current_screen)
|
local screen = Screen.get_by_id(Context.game.current_screen)
|
||||||
if screen.background then Map.draw(screen.background) end
|
Map.draw(screen.background)
|
||||||
UI.draw_top_bar(screen.name)
|
UI.draw_top_bar(screen.name)
|
||||||
if #_available_decisions > 0 then
|
if #_available_decisions > 0 then
|
||||||
UI.draw_decision_selector(_available_decisions, _selected_decision_index)
|
UI.draw_decision_selector(_available_decisions, _selected_decision_index)
|
||||||
@@ -23,7 +23,7 @@ function GameWindow.update()
|
|||||||
local screen = Screen.get_by_id(Context.game.current_screen)
|
local screen = Screen.get_by_id(Context.game.current_screen)
|
||||||
screen.update()
|
screen.update()
|
||||||
|
|
||||||
-- Handle current situation updates
|
-- Handle situations (Context.game.current_situation is still present)
|
||||||
if Context.game.current_situation then
|
if Context.game.current_situation then
|
||||||
local current_situation_obj = Situation.get_by_id(Context.game.current_situation)
|
local current_situation_obj = Situation.get_by_id(Context.game.current_situation)
|
||||||
if current_situation_obj and current_situation_obj.update then
|
if current_situation_obj and current_situation_obj.update then
|
||||||
@@ -37,10 +37,6 @@ function GameWindow.update()
|
|||||||
|
|
||||||
if #_available_decisions == 0 then return end
|
if #_available_decisions == 0 then return end
|
||||||
|
|
||||||
if _selected_decision_index > #_available_decisions then
|
|
||||||
_selected_decision_index = 1
|
|
||||||
end
|
|
||||||
|
|
||||||
local new_selected_decision_index = UI.update_decision_selector(
|
local new_selected_decision_index = UI.update_decision_selector(
|
||||||
_available_decisions,
|
_available_decisions,
|
||||||
_selected_decision_index
|
_selected_decision_index
|
||||||
@@ -60,7 +56,7 @@ function GameWindow.update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Sets the active window.
|
--- Sets the active window.
|
||||||
-- @param new_state string The ID of the new active window.
|
-- @param new_state number The ID of the new active window.
|
||||||
function GameWindow.set_state(new_state)
|
function GameWindow.set_state(new_state)
|
||||||
Window.set_current(new_state)
|
Context.current_window = new_state
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -29,10 +29,10 @@ function IntroWindow.update()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if IntroWindow.y < -lines * 8 then
|
if IntroWindow.y < -lines * 8 then
|
||||||
Window.set_current("menu")
|
GameWindow.set_state("menu")
|
||||||
end
|
end
|
||||||
|
|
||||||
if Input.menu_confirm() then
|
if Input.menu_confirm() then
|
||||||
Window.set_current("menu")
|
GameWindow.set_state("menu")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -21,20 +21,17 @@ end
|
|||||||
|
|
||||||
--- Starts a new game from the menu.
|
--- Starts a new game from the menu.
|
||||||
function MenuWindow.new_game()
|
function MenuWindow.new_game()
|
||||||
Context.new_game()
|
Context.new_game() GameWindow.set_state("game")
|
||||||
GameWindow.set_state("game")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Loads a game from the menu.
|
--- Loads a game from the menu.
|
||||||
function MenuWindow.load_game()
|
function MenuWindow.load_game()
|
||||||
Context.load_game()
|
Context.load_game() GameWindow.set_state("game")
|
||||||
GameWindow.set_state("game")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Saves the current game from the menu.
|
--- Saves the current game from the menu.
|
||||||
function MenuWindow.save_game()
|
function MenuWindow.save_game()
|
||||||
Context.save_game()
|
Context.save_game() end
|
||||||
end
|
|
||||||
|
|
||||||
--- Resumes the game from the menu.
|
--- Resumes the game from the menu.
|
||||||
function MenuWindow.resume_game()
|
function MenuWindow.resume_game()
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ function MinigameDDRWindow.init(params)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Starts the DDR minigame.
|
--- Starts the DDR minigame.
|
||||||
-- @param return_window string The window ID to return to after the minigame.
|
-- @param return_window number The window ID to return to after the minigame.
|
||||||
-- @param[opt] song_key string The key of the song to play.
|
-- @param[opt] song_key string The key of the song to play.
|
||||||
-- @param[opt] params table Optional parameters for minigame configuration.
|
-- @param[opt] params table Optional parameters for minigame configuration.
|
||||||
function MinigameDDRWindow.start(return_window, song_key, params)
|
function MinigameDDRWindow.start(return_window, song_key, params)
|
||||||
@@ -25,7 +25,7 @@ function MinigameDDRWindow.start(return_window, song_key, params)
|
|||||||
Context.minigame_ddr.debug_status = "Random mode"
|
Context.minigame_ddr.debug_status = "Random mode"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Window.set_current("minigame_ddr")
|
Context.current_window = "minigame_ddr"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Spawns a random arrow.
|
--- Spawns a random arrow.
|
||||||
@@ -101,7 +101,7 @@ function MinigameDDRWindow.update()
|
|||||||
if mg.bar_fill >= mg.max_fill then
|
if mg.bar_fill >= mg.max_fill then
|
||||||
Meter.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meter.show()
|
Meter.show()
|
||||||
Window.set_current(mg.return_window)
|
Context.current_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
mg.frame_counter = mg.frame_counter + 1
|
mg.frame_counter = mg.frame_counter + 1
|
||||||
@@ -109,7 +109,7 @@ function MinigameDDRWindow.update()
|
|||||||
if mg.frame_counter > mg.current_song.end_frame and #mg.arrows == 0 then
|
if mg.frame_counter > mg.current_song.end_frame and #mg.arrows == 0 then
|
||||||
Meter.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meter.show()
|
Meter.show()
|
||||||
Window.set_current(mg.return_window)
|
Context.current_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -196,7 +196,7 @@ function MinigameDDRWindow.draw()
|
|||||||
print("DDR ERROR: Context not initialized", 10, 10, 12)
|
print("DDR ERROR: Context not initialized", 10, 10, 12)
|
||||||
print("Press Z to return", 10, 20, 12)
|
print("Press Z to return", 10, 20, 12)
|
||||||
if Input.select() then
|
if Input.select() then
|
||||||
Window.set_current("game")
|
Context.current_window = "game"
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ function MinigameButtonMashWindow.init(params)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Starts the button mash minigame.
|
--- Starts the button mash minigame.
|
||||||
-- @param return_window string The window ID to return to after the minigame.
|
-- @param return_window number The window ID to return to after the minigame.
|
||||||
-- @param[opt] params table Optional parameters for minigame configuration.
|
-- @param[opt] params table Optional parameters for minigame configuration.
|
||||||
function MinigameButtonMashWindow.start(return_window, params)
|
function MinigameButtonMashWindow.start(return_window, params)
|
||||||
MinigameButtonMashWindow.init(params)
|
MinigameButtonMashWindow.init(params)
|
||||||
Context.minigame_button_mash.return_window = return_window or "game"
|
Context.minigame_button_mash.return_window = return_window or "game"
|
||||||
Window.set_current("minigame_button_mash")
|
Context.current_window = "minigame_button_mash"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Updates button mash minigame logic.
|
--- Updates button mash minigame logic.
|
||||||
@@ -26,7 +26,7 @@ function MinigameButtonMashWindow.update()
|
|||||||
if mg.bar_fill >= mg.max_fill then
|
if mg.bar_fill >= mg.max_fill then
|
||||||
Meter.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meter.show()
|
Meter.show()
|
||||||
Window.set_current(mg.return_window)
|
Context.current_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local degradation = mg.base_degradation + (mg.bar_fill * mg.degradation_multiplier)
|
local degradation = mg.base_degradation + (mg.bar_fill * mg.degradation_multiplier)
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ function MinigameRhythmWindow.init(params)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Starts the rhythm minigame.
|
--- Starts the rhythm minigame.
|
||||||
-- @param return_window string The window ID to return to after the minigame.
|
-- @param return_window number The window ID to return to after the minigame.
|
||||||
-- @param[opt] params table Optional parameters for minigame configuration.
|
-- @param[opt] params table Optional parameters for minigame configuration.
|
||||||
function MinigameRhythmWindow.start(return_window, params)
|
function MinigameRhythmWindow.start(return_window, params)
|
||||||
MinigameRhythmWindow.init(params)
|
MinigameRhythmWindow.init(params)
|
||||||
Context.minigame_rhythm.return_window = return_window or "game"
|
Context.minigame_rhythm.return_window = return_window or "game"
|
||||||
Window.set_current("minigame_rhythm")
|
Context.current_window = "minigame_rhythm"
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Updates rhythm minigame logic.
|
--- Updates rhythm minigame logic.
|
||||||
@@ -48,7 +48,7 @@ function MinigameRhythmWindow.update()
|
|||||||
if mg.score >= mg.max_score then
|
if mg.score >= mg.max_score then
|
||||||
Meter.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meter.show()
|
Meter.show()
|
||||||
Window.set_current(mg.return_window)
|
Context.current_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if mg.button_pressed_timer > 0 then
|
if mg.button_pressed_timer > 0 then
|
||||||
|
|||||||
@@ -5,27 +5,21 @@ local POPUP_HEIGHT = 80
|
|||||||
local TEXT_MARGIN_X = POPUP_X + 10
|
local TEXT_MARGIN_X = POPUP_X + 10
|
||||||
local TEXT_MARGIN_Y = POPUP_Y + 10
|
local TEXT_MARGIN_Y = POPUP_Y + 10
|
||||||
local LINE_HEIGHT = 8
|
local LINE_HEIGHT = 8
|
||||||
|
|
||||||
--- Displays a popup window.
|
--- Displays a popup window.
|
||||||
-- @param content_strings table A table of strings to display in the popup.
|
-- @param content_strings table A table of strings to display in the popup.
|
||||||
function PopupWindow.show(content_strings)
|
function PopupWindow.show(content_strings)
|
||||||
Context.popup.show = true
|
Context.popup.show = true
|
||||||
Context.popup.content = content_strings or {}
|
Context.popup.content = content_strings or {} GameWindow.set_state("popup") end
|
||||||
GameWindow.set_state("popup")
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Hides the popup window.
|
--- Hides the popup window.
|
||||||
function PopupWindow.hide()
|
function PopupWindow.hide()
|
||||||
Context.popup.show = false
|
Context.popup.show = false
|
||||||
Context.popup.content = {}
|
Context.popup.content = {} GameWindow.set_state("game") end
|
||||||
GameWindow.set_state("game")
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Updates popup window logic.
|
--- Updates popup window logic.
|
||||||
function PopupWindow.update()
|
function PopupWindow.update()
|
||||||
if Context.popup.show then
|
if Context.popup.show then
|
||||||
if Input.menu_confirm() or Input.menu_back() then
|
if Input.menu_confirm() or Input.menu_back() then PopupWindow.hide()
|
||||||
PopupWindow.hide()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
--- Draws the splash window.
|
--- Draws the splash window.
|
||||||
function SplashWindow.draw()
|
function SplashWindow.draw()
|
||||||
local txt = "Definitely not an Impostor"
|
local txt = "Definitely not an Impostor"
|
||||||
local y = (Config.screen.height - 6) / 2
|
local w = #txt * 6
|
||||||
Print.text_center(txt, Config.screen.width / 2, y, Config.colors.white)
|
local x = (240 - w) / 2
|
||||||
|
local y = (136 - 6) / 2
|
||||||
|
print(txt, x, y, 12)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Updates the splash window logic.
|
--- Updates the splash window logic.
|
||||||
function SplashWindow.update()
|
function SplashWindow.update()
|
||||||
Context.splash_timer = Context.splash_timer - 1
|
Context.splash_timer = Context.splash_timer - 1
|
||||||
if Context.splash_timer <= 0 or Input.menu_confirm() then
|
if Context.splash_timer <= 0 or Input.menu_confirm() then
|
||||||
Window.set_current("intro")
|
GameWindow.set_state("intro")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user