- added music and sounds to things
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

- hooked up ddr logic into game logic
- TODO: "left_only" ddr needs tweak
This commit is contained in:
2026-03-21 23:20:48 +01:00
parent 9a3c9ee28c
commit 6a33be82e9
13 changed files with 102 additions and 29 deletions

View File

@@ -1,13 +1,32 @@
--- @section Audio
Audio = {
music_playing = nil
}
--- Stops current music.
--- @within Audio
function Audio.music_stop() music() end
function Audio.music_stop()
music()
Audio.music_playing = nil
end
--- Plays track, doesn't restart if already playing.
function Audio.music_play(track)
if not (Audio.music_playing == track) then
music(track)
Audio.music_playing = track
end
end
--- Plays main menu music.
--- @within Audio
function Audio.music_play_mainmenu() end
--- Plays mystery man music.
--- @within Audio
function Audio.music_play_mystery() Audio.music_play(2) end
--- Plays waking up music.
--- @within Audio
function Audio.music_play_wakingup() end
@@ -30,11 +49,11 @@ function Audio.music_play_room_() end
--- Plays room work music.
--- @within Audio
function Audio.music_play_room_work() music(0) end
function Audio.music_play_room_work() Audio.music_play(0) end
--- Plays activity work music.
--- @within Audio
function Audio.music_play_activity_work() music(1) end
function Audio.music_play_activity_work() Audio.music_play(1) end
--- Plays select sound effect.
--- @within Audio
@@ -56,9 +75,17 @@ function Audio.sfx_success() sfx(16, 'C-7', 60) end
--- @within Audio
function Audio.sfx_bloop() sfx(21, 'C-3', 60) end
--- Plays alarm sound effect.
--- Plays alarm sound effect
--- @within Audio
function Audio.sfx_alarm() sfx(61) end
function Audio.sfx_alarm() sfx(34, "C-5", 240) end
--- Plays drum sound effect.
--- @within Audio
function Audio.sfx_drum_low() sfx(61, "C-2") end
--- Plays drum sound effect.
--- @within Audio
function Audio.sfx_drum_high() sfx(61, "C-6") end
--- Plays sound effect for arrow hit
--- @within Audio

View File

@@ -4,17 +4,31 @@ Decision.register({
handle = function()
Meter.hide()
Util.go_to_screen_by_id("work")
MinigameDDRWindow.start("game", nil, {
on_win = function()
if (Context.minigame_ddr.special_mode_condition and Context.ascension.level == 1) then
local modes_for_ascension_levels = {}
modes_for_ascension_levels[0] = "normal"
modes_for_ascension_levels[1] = "only_special"
modes_for_ascension_levels[2] = "only_left"
modes_for_ascension_levels[3] = "only_nothing"
MinigameDDRWindow.start("game", "generated", {
on_win = function(game_context)
if (game_context.special_mode_condition and Context.ascension.level == 1) then
Context.should_ascend = true
elseif (game_context.special_mode_condition and Context.ascension.level == 2) then
Context.should_ascend = true
elseif (game_context.special_mode_condition and Context.ascension.level == 3) then
Context.should_ascend = true
elseif (game_context.special_mode_condition and Context.ascension.level == 4) then
Context.should_ascend = true
Context.minigame_ddr.special_mode_condition = false
end
Meter.show()
Util.go_to_screen_by_id("office")
Window.set_current("game")
Context.have_done_work_today = true
end,
special_mode = modes_for_ascension_levels[Ascension.get_level()]
})
end,
})

View File

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

View File

@@ -396,26 +396,27 @@
-- 016:ffffffffff0010201020766777001020102010201020102000fffffffffff3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f30b1b2b1b2b7667776777761b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- </MAP>
-- <SFX>
-- 000:060006400600064006000640060006400600060006000600060006000600060006000600060006000600060006000600060006000600060006000600300000000900
-- 016:00000000000000400040004000700070007000400040004000700070007000c000c000c000c000c000c000c000c000c000c000c000c000c000c000c0470000000000
-- 017:000000000000000000000000006000600060006000600060106020c030c050c060c080c0a0c0b0c0c0c0c0c0d0c0d0c0e0c0f0c0f0c0f0c0f0c0f0c0400000000000
-- 018:00c000c000c000c000c000c0006000600060006000600060200030005000600080009000a000b000c000d000d000e000e000e000f000f000f000f000500000000000
-- 019:0000000000000000000000d010d010d020d030d050d070d090d0b0d0c0d0e0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0f0d0500000000000
-- 017:030003000300030003000300036003600360036003600360136023c033c053c063c083c0a3c0b3c0c3c0c3c0d3c0d3c0e3c0f3c0f3c0f3c0f3c0f3c0400000000000
-- 018:03c003c003c003c003c003c0036003600360036003600360230033005300630083009300a300b300c300d300d300e300e300e300f300f300f300f300400000000000
-- 019:0300030003000300030003d013d013d023d033d053d073d093d0b3d0c3d0e3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0f3d0400000000000
-- 020:090009000900090009000900090009000900090009000900090009000900090009000900090009000900090009000900090009000900090009000900500000000000
-- 021:01000100010001000100f10001100110011001100110f11001200120012001200120f1201130113011302130213021302130313041308130a130d130580000000000
-- 022:03b003100300030003000300130063009300b300c300d300d300e300e300e300f300f300f300f300f300f300f300f300f300f300f300f300f300f300400000000000
-- 032:010001100100011001000110010001100100010001000100010001000100010001000100010001000100010001000100010001000100010001000100400000000800
-- 033:000000010002000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d40000000004
-- 044:0600f6000620f6000600f6000610f600f600f6000600f600f600f600f6000600060006000600060006000600060006000600060006000600060006004600000f0f00
-- 045:0000f0000020f0000000f0000010f000f000f0000000f000f000f000f0000000000000000000000000000000000000000000000000000000000000004600000f0f00
-- 033:000000010002000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c40000000004
-- 034:02000240020002000200020002000200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f200f2004700000f0200
-- 044:0600f6000620f6000600f6000610f600f600f6000600f600f600f600f6000600060006000600060006000600060006000600060006000600060006001600000f0f00
-- 045:0000f0000020f0000000f0000010f000f000f0000000f000f000f000f0000000000000000000000000000000000000000000000000000000000000005600000f0f00
-- 048:090009000900090009000900090009000900090009000900090009000900090009000900090009000900090009000900090009000900090009000900400000000000
-- 056:4100510061406140717081709100b100c100d100e100e100e100f100f100f100f100f100f100f100f100f100f100f100f100f100f100f100f100f10058a000000600
-- 057:000000010002000300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d40000000004
-- 058:41004110410041104100411041004110c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100500000080800
-- 059:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000500000000000
-- 060:220022002200820082008200820082008200820082008200820082008200820082008200820082008200820082008200820082008200820082008200100000000000
-- 061:9f009f00bf00df00df00ef00ef00ef00ef00ef00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00400000000000
-- 062:00000100010001000100510081008100910091009100a100a100a100a100a100b100b100b100b100c100c100c100d100d100d100e100e100e100f100484000000000
-- 063:00b000100000000000000000100060009000b000c000d000d000e000e000e000f000f000f000f000f000f000f000f000f000f000f000f000f000f000200000000000
-- 056:4100510061406140717081709100b100c100d100e100e100e100f100f100f100f100f100f100f100f100f100f100f100f100f100f100f100f100f100480000000600
-- 057:000000010002000300020001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000840000000004
-- 058:41004110410041104100411041004110c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100c100003000080800
-- 059:03000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030003000300030000b000000000
-- 060:220022002200820082008200820082008200820082008200820082008200820082008200820082008200820082008200820082008200820082008200500000000000
-- 061:9f009f00bf00df00df00ef00ef00ef00ef00ef00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00100000000000
-- 062:00000100010001000100510081008100910091009100a100a100a100a100a100b100b100b100b100c100c100c100d100d100d100e100e100e100f100580000000000
-- 063:00b000100000000000000000100060009000b000c000d000d000e000e000e000f000f000f000f000f000f000f000f000f000f000f000f000f000f000500000000000
-- </SFX>
-- <WAVES>
-- 000:bcceefceedddddc84333121268abaa99
@@ -435,8 +436,11 @@
-- 003:4008d30000000000000000000000000000000000000000004008d90000000000000000000000000000000000000000004008d30000000000000000000000000000004008d30000004008d90000000000000000000000000000000000000000004008d30000000000000000000000000000000000000000004008d90000000000000000000000000000000000000000004008d30000000000000000000000000000004008d30000004008d9000000000000000000000000000000000000000000
-- 004:43398d000000e0088b000000b0088b000881e0088b00000040088d000000e0088b000881b0088b000000e0088b00000040088d000000e0088b000000b0088b000000e0088b00000040088d000000e0088b000000b0088b000000e0088b00000040088b000000e00889000000b00889000000e0088900000040088b000000e00889000000b00889000000e0088900000040088b000000e00889000000b00889000000e0088900000040088b000000e00889000000b00889000000e00889000000
-- 005:455981000000000881000000000881000000000000000000400883000000000000000000000000000000000000000000400881000000000000000000000000000000000000000000400883000000000000000000000000000000000000000000400881000000000000000000000000000000000000000000400883000000000000000000000000000000000000000000400881000000000000000000000000000000000000000000400883000000000000000000000000000000000000000000
-- 008:4aa9b30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005008b30000000000000000000000000000000000000000000008b10000000000000000000008910000000000000000004008b30000000000000000000000000000000000000000000000000000000000000000000008b1000000000000000000f008b1000000000000000000000000000000000000000000000891000000000000000000000000000000000000000000
-- 009:4779d30000000000000000004008d30000000000000000004008db0000000000000000004008d30000000000000000004008d30000000000000000004008d30000000000000000004008db0000000000000000004008d30000000000000000004008d30000000000000000004008d30000000000000000004008db0000000000000000004008d30000000000000000004008d30000000000000000004008d30000000000000000004008db0000000000000000004008d3000000000000000000
-- </PATTERNS>
-- <TRACKS>
-- 000:1000012000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ff
-- 001:581000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- 002:900082000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-- </TRACKS>

View File

@@ -7,6 +7,9 @@ Screen.register({
"go_to_sleep",
"go_to_end",
},
init = function()
Audio.music_play_room_work()
end,
background = "bedroom",
draw = function()
if Context.home_norman_visible and Window.get_current_id() == "game" then

View File

@@ -191,6 +191,12 @@ Screen.register({
name = "Mysterious Man",
decisions = {},
background_color = Config.colors.black,
init = function()
Audio.music_play_mystery()
end,
exit = function()
Audio.music_stop()
end,
update = function()
if state == STATE_TEXT then
if not text_done then

View File

@@ -9,6 +9,9 @@ Screen.register({
situations = {
"drink_coffee",
},
init = function()
Audio.music_play_room_work()
end,
background = "office",
draw = function()
if Window.get_current_id() == "game" then

View File

@@ -6,6 +6,7 @@ Screen.register({
},
background = "bedroom",
init = function()
Audio.music_play_mystery()
Context.stat_screen_active = true
Meter.hide()
local cx = Config.screen.width * 0.75

View File

@@ -5,6 +5,9 @@ Screen.register({
"go_to_home",
"go_to_office",
},
init = function()
Audio.music_play_room_work()
end,
background = "street",
draw = function()
if Window.get_current_id() == "game" then

View File

@@ -6,6 +6,9 @@ Screen.register({
"go_to_office",
"sumphore_discussion",
},
init = function()
Audio.music_play_room_work()
end,
background = "street",
draw = function()
if Window.get_current_id() == "game" then

View File

@@ -39,11 +39,12 @@ function MinigameDDRWindow.init_context()
current_song = nil,
pattern_index = 1,
use_pattern = false,
generated_length = 60,
generated_length = 30,
return_window = nil,
win_timer = 0,
on_win = nil,
total_misses = 0,
total_hits = 0,
special_mode_condition = true,
special_mode_counter = 0
}
@@ -98,6 +99,8 @@ function MinigameDDRWindow.on_arrow_hit_special(arrow, game_context)
end
function MinigameDDRWindow.on_end(game_context)
Audio.sfx_select()
game_context.win_timer = Config.timing.minigame_win_duration
local num_special = 0
@@ -262,7 +265,7 @@ function MinigameDDRWindow.update()
Audio.music_stop()
Meter.on_minigame_complete()
if mg.on_win then
mg.on_win()
mg.on_win(mg)
else
Meter.show()
Window.set_current(mg.return_window)
@@ -422,7 +425,7 @@ function MinigameDDRWindow.draw()
Print.text_center(mg.debug_status, Config.screen.width / 2, debug_y, Config.colors.item)
debug_y = debug_y + 10
end
if mg.use_pattern then
if mg.use_pattern and Context.test_mode then
Print.text_center(
"PATTERN MODE - Frame:" .. mg.frame_counter,
Config.screen.width / 2,
@@ -437,12 +440,14 @@ function MinigameDDRWindow.draw()
Config.colors.light_blue
)
end
else
elseif Context.test_mode then
Print.text_center("RANDOM MODE", Config.screen.width / 2, debug_y, Config.colors.blue)
end
if mg.win_timer > 0 then
if mg.special_mode_condition then
Minigame.draw_win_overlay("SUCCESS...?")
elseif mg.total_hits < 10 then
Minigame.draw_win_overlay("MEH...")
else
Minigame.draw_win_overlay()
end

View File

@@ -84,6 +84,8 @@ function MinigameButtonMashWindow.update()
end
if Input.select() then
Audio.sfx_drum_high()
mg.bar_fill = mg.bar_fill + mg.fill_per_press
mg.button_pressed_timer = mg.button_press_duration
if mg.bar_fill > mg.target_points then
@@ -91,6 +93,7 @@ function MinigameButtonMashWindow.update()
end
end
if mg.bar_fill >= mg.target_points then
Audio.sfx_select()
mg.win_timer = Config.timing.minigame_win_duration
return
end

View File

@@ -114,6 +114,7 @@ function MinigameRhythmWindow.update()
end
end
if mg.score >= mg.max_score then
Audio.sfx_select()
mg.win_timer = Config.timing.minigame_win_duration
return
end