remove prular defitions
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -13,8 +13,8 @@ globals = {
|
|||||||
"Audio",
|
"Audio",
|
||||||
"Config",
|
"Config",
|
||||||
"Context",
|
"Context",
|
||||||
"Meters",
|
"Meter",
|
||||||
"Minigames",
|
"Minigame",
|
||||||
"SplashWindow",
|
"SplashWindow",
|
||||||
"IntroWindow",
|
"IntroWindow",
|
||||||
"MenuWindow",
|
"MenuWindow",
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ Based on the analysis of `impostor.lua`, the following regularities and conventi
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Impostor Minigames Documentation
|
# Impostor Minigame Documentation
|
||||||
|
|
||||||
This document provides comprehensive documentation for all three minigames implemented in the Impostor game: Button Mash, Rhythm, and DDR (Dance Dance Revolution).
|
This document provides comprehensive documentation for all three minigames implemented in the Impostor game: Button Mash, Rhythm, and DDR (Dance Dance Revolution).
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ This document provides comprehensive documentation for all three minigames imple
|
|||||||
|
|
||||||
The Impostor game includes three interactive minigames that can be triggered during gameplay. Each minigame presents a unique challenge that the player must complete to progress. All minigames feature:
|
The Impostor game includes three interactive minigames that can be triggered during gameplay. Each minigame presents a unique challenge that the player must complete to progress. All minigames feature:
|
||||||
|
|
||||||
- **Overlay rendering** - Minigames render over the current game window
|
- **Overlay rendering** - Minigame render over the current game window
|
||||||
- **Progress tracking** - Visual indicators show completion status
|
- **Progress tracking** - Visual indicators show completion status
|
||||||
- **Return mechanism** - Automatic return to the calling window upon completion
|
- **Return mechanism** - Automatic return to the calling window upon completion
|
||||||
- **Visual feedback** - Button presses and hits are visually indicated
|
- **Visual feedback** - Button presses and hits are visually indicated
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Decision.register({
|
Decision.register({
|
||||||
id = "play_button_mash",
|
id = "play_button_mash",
|
||||||
label = "Play Button Mash",
|
label = "Play Button Mash",
|
||||||
handle = function() Meters.hide() MinigameButtonMashWindow.start(WINDOW_GAME) end,
|
handle = function() Meter.hide() MinigameButtonMashWindow.start(WINDOW_GAME) end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Decision.register({
|
Decision.register({
|
||||||
id = "play_ddr",
|
id = "play_ddr",
|
||||||
label = "Play DDR (Random)",
|
label = "Play DDR (Random)",
|
||||||
handle = function() Meters.hide() MinigameDDRWindow.start(WINDOW_GAME, nil) end,
|
handle = function() Meter.hide() MinigameDDRWindow.start(WINDOW_GAME, nil) end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
Decision.register({
|
Decision.register({
|
||||||
id = "play_rhythm",
|
id = "play_rhythm",
|
||||||
label = "Play Rhythm Game",
|
label = "Play Rhythm Game",
|
||||||
handle = function() Meters.hide() MinigameRhythmWindow.start(WINDOW_GAME) end,
|
handle = function() Meter.hide() MinigameRhythmWindow.start(WINDOW_GAME) end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -44,10 +44,10 @@ on than meets the eye.]]
|
|||||||
selected_decision_index = 1,
|
selected_decision_index = 1,
|
||||||
game_in_progress = false,
|
game_in_progress = false,
|
||||||
screens = {},
|
screens = {},
|
||||||
minigame_ddr = Minigames.get_default_ddr(),
|
minigame_ddr = Minigame.get_default_ddr(),
|
||||||
minigame_button_mash = Minigames.get_default_button_mash(),
|
minigame_button_mash = Minigame.get_default_button_mash(),
|
||||||
minigame_rhythm = Minigames.get_default_rhythm(),
|
minigame_rhythm = Minigame.get_default_rhythm(),
|
||||||
meters = Meters.get_initial(),
|
meters = Meter.get_initial(),
|
||||||
--- Active sprites.
|
--- Active sprites.
|
||||||
sprites = {},
|
sprites = {},
|
||||||
--- Current situation ID.
|
--- Current situation ID.
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ local COMBO_MAX_BONUS = 0.16
|
|||||||
local COMBO_TIMEOUT_FRAMES = 600
|
local COMBO_TIMEOUT_FRAMES = 600
|
||||||
|
|
||||||
-- Internal meters for tracking game progress and player stats.
|
-- Internal meters for tracking game progress and player stats.
|
||||||
Meters.COLOR_ISM = Config.colors.red
|
Meter.COLOR_ISM = Config.colors.red
|
||||||
Meters.COLOR_WPM = Config.colors.blue
|
Meter.COLOR_WPM = Config.colors.blue
|
||||||
Meters.COLOR_BM = Config.colors.black
|
Meter.COLOR_BM = Config.colors.black
|
||||||
Meters.COLOR_BG = Config.colors.meter_bg
|
Meter.COLOR_BG = Config.colors.meter_bg
|
||||||
|
|
||||||
--- Gets initial meter values.
|
--- Gets initial meter values.
|
||||||
-- @return table A table of initial meter values.
|
-- @return table A table of initial meter values.
|
||||||
function Meters.get_initial()
|
function Meter.get_initial()
|
||||||
return {
|
return {
|
||||||
ism = METER_DEFAULT,
|
ism = METER_DEFAULT,
|
||||||
wpm = METER_DEFAULT,
|
wpm = METER_DEFAULT,
|
||||||
@@ -26,24 +26,24 @@ function Meters.get_initial()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Hides meters.
|
--- Hides meters.
|
||||||
function Meters.hide()
|
function Meter.hide()
|
||||||
if Context and Context.meters then Context.meters.hidden = true end
|
if Context and Context.meters then Context.meters.hidden = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Shows meters.
|
--- Shows meters.
|
||||||
function Meters.show()
|
function Meter.show()
|
||||||
if Context and Context.meters then Context.meters.hidden = false end
|
if Context and Context.meters then Context.meters.hidden = false end
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets max meter value.
|
--- Gets max meter value.
|
||||||
-- @return number The maximum meter value.
|
-- @return number The maximum meter value.
|
||||||
function Meters.get_max()
|
function Meter.get_max()
|
||||||
return METER_MAX
|
return METER_MAX
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Gets combo multiplier.
|
--- Gets combo multiplier.
|
||||||
-- @return number The current combo multiplier.
|
-- @return number The current combo multiplier.
|
||||||
function Meters.get_combo_multiplier()
|
function Meter.get_combo_multiplier()
|
||||||
if not Context or not Context.meters then return 1 end
|
if not Context or not Context.meters then return 1 end
|
||||||
local combo = Context.meters.combo
|
local combo = Context.meters.combo
|
||||||
if combo == 0 then return 1 end
|
if combo == 0 then return 1 end
|
||||||
@@ -51,7 +51,7 @@ function Meters.get_combo_multiplier()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Updates all meters.
|
--- Updates all meters.
|
||||||
function Meters.update()
|
function Meter.update()
|
||||||
if not Context or not Context.game_in_progress or not Context.meters then return end
|
if not Context or not Context.game_in_progress or not Context.meters then return end
|
||||||
local m = Context.meters
|
local m = Context.meters
|
||||||
m.ism = math.max(0, m.ism - METER_DECAY_PER_FRAME)
|
m.ism = math.max(0, m.ism - METER_DECAY_PER_FRAME)
|
||||||
@@ -69,7 +69,7 @@ end
|
|||||||
--- Adds amount to a meter.
|
--- Adds amount to a meter.
|
||||||
-- @param key string The meter key (e.g., "wpm", "ism", "bm").
|
-- @param key string The meter key (e.g., "wpm", "ism", "bm").
|
||||||
-- @param amount number The amount to add.
|
-- @param amount number The amount to add.
|
||||||
function Meters.add(key, amount)
|
function Meter.add(key, amount)
|
||||||
if not Context or not Context.meters then return end
|
if not Context or not Context.meters then return end
|
||||||
local m = Context.meters
|
local m = Context.meters
|
||||||
if m[key] ~= nil then
|
if m[key] ~= nil then
|
||||||
@@ -78,12 +78,12 @@ function Meters.add(key, amount)
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Called on minigame completion.
|
--- Called on minigame completion.
|
||||||
function Meters.on_minigame_complete()
|
function Meter.on_minigame_complete()
|
||||||
local m = Context.meters
|
local m = Context.meters
|
||||||
local gain = math.floor(METER_GAIN_PER_CHORE * Meters.get_combo_multiplier())
|
local gain = math.floor(METER_GAIN_PER_CHORE * Meter.get_combo_multiplier())
|
||||||
Meters.add("wpm", gain)
|
Meter.add("wpm", gain)
|
||||||
Meters.add("ism", gain)
|
Meter.add("ism", gain)
|
||||||
Meters.add("bm", gain)
|
Meter.add("bm", gain)
|
||||||
m.combo = m.combo + 1
|
m.combo = m.combo + 1
|
||||||
m.combo_timer = 0
|
m.combo_timer = 0
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
-- Manages minigame configurations and initial states.
|
-- Manages minigame configurations and initial states.
|
||||||
Minigames = {}
|
Minigame = {}
|
||||||
|
|
||||||
--- Applies parameters to defaults.
|
--- Applies parameters to defaults.
|
||||||
-- @param defaults table The default configuration table.
|
-- @param defaults table The default configuration table.
|
||||||
@@ -15,7 +15,7 @@ end
|
|||||||
|
|
||||||
--- Gets default DDR minigame configuration.
|
--- Gets default DDR minigame configuration.
|
||||||
-- @return table The default DDR minigame configuration.
|
-- @return table The default DDR minigame configuration.
|
||||||
function Minigames.get_default_ddr()
|
function Minigame.get_default_ddr()
|
||||||
local arrow_size = 12
|
local arrow_size = 12
|
||||||
local arrow_spacing = 30
|
local arrow_spacing = 30
|
||||||
local total_width = (4 * arrow_size) + (3 * arrow_spacing)
|
local total_width = (4 * arrow_size) + (3 * arrow_spacing)
|
||||||
@@ -56,7 +56,7 @@ end
|
|||||||
|
|
||||||
--- Gets default button mash minigame configuration.
|
--- Gets default button mash minigame configuration.
|
||||||
-- @return table The default button mash minigame configuration.
|
-- @return table The default button mash minigame configuration.
|
||||||
function Minigames.get_default_button_mash()
|
function Minigame.get_default_button_mash()
|
||||||
return {
|
return {
|
||||||
bar_fill = 0,
|
bar_fill = 0,
|
||||||
max_fill = 100,
|
max_fill = 100,
|
||||||
@@ -78,7 +78,7 @@ end
|
|||||||
|
|
||||||
--- Gets default rhythm minigame configuration.
|
--- Gets default rhythm minigame configuration.
|
||||||
-- @return table The default rhythm minigame configuration.
|
-- @return table The default rhythm minigame configuration.
|
||||||
function Minigames.get_default_rhythm()
|
function Minigame.get_default_rhythm()
|
||||||
return {
|
return {
|
||||||
line_position = 0,
|
line_position = 0,
|
||||||
line_speed = 0.015,
|
line_speed = 0.015,
|
||||||
@@ -108,20 +108,20 @@ end
|
|||||||
--- Configures DDR minigame.
|
--- Configures DDR minigame.
|
||||||
-- @param params table Optional parameters to override defaults.
|
-- @param params table Optional parameters to override defaults.
|
||||||
-- @return table The configured DDR minigame state.
|
-- @return table The configured DDR minigame state.
|
||||||
function Minigames.configure_ddr(params)
|
function Minigame.configure_ddr(params)
|
||||||
return apply_params(Minigames.get_default_ddr(), params)
|
return apply_params(Minigame.get_default_ddr(), params)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Configures button mash minigame.
|
--- Configures button mash minigame.
|
||||||
-- @param params table Optional parameters to override defaults.
|
-- @param params table Optional parameters to override defaults.
|
||||||
-- @return table The configured button mash minigame state.
|
-- @return table The configured button mash minigame state.
|
||||||
function Minigames.configure_button_mash(params)
|
function Minigame.configure_button_mash(params)
|
||||||
return apply_params(Minigames.get_default_button_mash(), params)
|
return apply_params(Minigame.get_default_button_mash(), params)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Configures rhythm minigame.
|
--- Configures rhythm minigame.
|
||||||
-- @param params table Optional parameters to override defaults.
|
-- @param params table Optional parameters to override defaults.
|
||||||
-- @return table The configured rhythm minigame state.
|
-- @return table The configured rhythm minigame state.
|
||||||
function Minigames.configure_rhythm(params)
|
function Minigame.configure_rhythm(params)
|
||||||
return apply_params(Minigames.get_default_rhythm(), params)
|
return apply_params(Minigame.get_default_rhythm(), params)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ MinigameButtonMashWindow = {}
|
|||||||
MinigameRhythmWindow = {}
|
MinigameRhythmWindow = {}
|
||||||
MinigameDDRWindow = {}
|
MinigameDDRWindow = {}
|
||||||
Util = {}
|
Util = {}
|
||||||
Meters = {}
|
Meter = {}
|
||||||
Minigames = {}
|
Minigame = {}
|
||||||
Decision = {}
|
Decision = {}
|
||||||
Situation = {}
|
Situation = {}
|
||||||
Screen = {}
|
Screen = {}
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ function TIC()
|
|||||||
if handler then
|
if handler then
|
||||||
handler()
|
handler()
|
||||||
end
|
end
|
||||||
Meters.update()
|
Meter.update()
|
||||||
if Context.game_in_progress then
|
if Context.game_in_progress then
|
||||||
UI.draw_meters()
|
UI.draw_meters()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ function UI.draw_meters()
|
|||||||
if Context.meters.hidden then return end
|
if Context.meters.hidden then return end
|
||||||
|
|
||||||
local m = Context.meters
|
local m = Context.meters
|
||||||
local max = Meters.get_max()
|
local max = Meter.get_max()
|
||||||
local bar_w = 44
|
local bar_w = 44
|
||||||
local bar_h = 2
|
local bar_h = 2
|
||||||
local bar_x = 182
|
local bar_x = 182
|
||||||
@@ -145,16 +145,16 @@ function UI.draw_meters()
|
|||||||
local bar_offset = math.floor((line_h - bar_h) / 2)
|
local bar_offset = math.floor((line_h - bar_h) / 2)
|
||||||
|
|
||||||
local meter_list = {
|
local meter_list = {
|
||||||
{ key = "wpm", label = "WPM", color = Meters.COLOR_WPM, row = 0 },
|
{ key = "wpm", label = "WPM", color = Meter.COLOR_WPM, row = 0 },
|
||||||
{ key = "ism", label = "ISM", color = Meters.COLOR_ISM, row = 1 },
|
{ key = "ism", label = "ISM", color = Meter.COLOR_ISM, row = 1 },
|
||||||
{ key = "bm", label = "BM", color = Meters.COLOR_BM, row = 2 },
|
{ key = "bm", label = "BM", color = Meter.COLOR_BM, row = 2 },
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, meter in ipairs(meter_list) do
|
for _, meter in ipairs(meter_list) do
|
||||||
local label_y = start_y + meter.row * line_h
|
local label_y = start_y + meter.row * line_h
|
||||||
local bar_y = label_y + bar_offset
|
local bar_y = label_y + bar_offset
|
||||||
local fill_w = math.max(0, math.floor((m[meter.key] / max) * bar_w))
|
local fill_w = math.max(0, math.floor((m[meter.key] / max) * bar_w))
|
||||||
rect(bar_x, bar_y, bar_w, bar_h, Meters.COLOR_BG)
|
rect(bar_x, bar_y, bar_w, bar_h, Meter.COLOR_BG)
|
||||||
if fill_w > 0 then
|
if fill_w > 0 then
|
||||||
rect(bar_x, bar_y, fill_w, bar_h, meter.color)
|
rect(bar_x, bar_y, fill_w, bar_h, meter.color)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--- Initializes DDR minigame state.
|
--- Initializes DDR minigame state.
|
||||||
-- @param params table Optional parameters for configuration.
|
-- @param params table Optional parameters for configuration.
|
||||||
function MinigameDDRWindow.init(params)
|
function MinigameDDRWindow.init(params)
|
||||||
Context.minigame_ddr = Minigames.configure_ddr(params)
|
Context.minigame_ddr = Minigame.configure_ddr(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Starts the DDR minigame.
|
--- Starts the DDR minigame.
|
||||||
@@ -99,16 +99,16 @@ end
|
|||||||
function MinigameDDRWindow.update()
|
function MinigameDDRWindow.update()
|
||||||
local mg = Context.minigame_ddr
|
local mg = Context.minigame_ddr
|
||||||
if mg.bar_fill >= mg.max_fill then
|
if mg.bar_fill >= mg.max_fill then
|
||||||
Meters.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meters.show()
|
Meter.show()
|
||||||
Context.active_window = mg.return_window
|
Context.active_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
mg.frame_counter = mg.frame_counter + 1
|
mg.frame_counter = mg.frame_counter + 1
|
||||||
if mg.use_pattern and mg.current_song and mg.current_song.end_frame then
|
if mg.use_pattern and mg.current_song and mg.current_song.end_frame then
|
||||||
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
|
||||||
Meters.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meters.show()
|
Meter.show()
|
||||||
Context.active_window = mg.return_window
|
Context.active_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--- Initializes button mash minigame state.
|
--- Initializes button mash minigame state.
|
||||||
-- @param params table Optional parameters for configuration.
|
-- @param params table Optional parameters for configuration.
|
||||||
function MinigameButtonMashWindow.init(params)
|
function MinigameButtonMashWindow.init(params)
|
||||||
Context.minigame_button_mash = Minigames.configure_button_mash(params)
|
Context.minigame_button_mash = Minigame.configure_button_mash(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Starts the button mash minigame.
|
--- Starts the button mash minigame.
|
||||||
@@ -24,8 +24,8 @@ function MinigameButtonMashWindow.update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mg.bar_fill >= mg.max_fill then
|
if mg.bar_fill >= mg.max_fill then
|
||||||
Meters.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meters.show()
|
Meter.show()
|
||||||
Context.active_window = mg.return_window
|
Context.active_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
--- Initializes rhythm minigame state.
|
--- Initializes rhythm minigame state.
|
||||||
-- @param params table Optional parameters for configuration.
|
-- @param params table Optional parameters for configuration.
|
||||||
function MinigameRhythmWindow.init(params)
|
function MinigameRhythmWindow.init(params)
|
||||||
Context.minigame_rhythm = Minigames.configure_rhythm(params)
|
Context.minigame_rhythm = Minigame.configure_rhythm(params)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Starts the rhythm minigame.
|
--- Starts the rhythm minigame.
|
||||||
@@ -46,8 +46,8 @@ function MinigameRhythmWindow.update()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mg.score >= mg.max_score then
|
if mg.score >= mg.max_score then
|
||||||
Meters.on_minigame_complete()
|
Meter.on_minigame_complete()
|
||||||
Meters.show()
|
Meter.show()
|
||||||
Context.active_window = mg.return_window
|
Context.active_window = mg.return_window
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user