[decomp] macros for sound playback (#1453)

* `sound-play` macro

* update source

* fix `add-debug-light` lol

* fix `add-debug-light` forreal

* Update debug.gc

* update some mood/tod decomp
This commit is contained in:
ManDude
2022-06-13 23:39:22 +01:00
committed by GitHub
parent d73336bbf3
commit 8ccb1dfb66
247 changed files with 1698 additions and 2139 deletions
+51 -51
View File
@@ -1242,13 +1242,13 @@
(cond
((< (-> obj option-index) 4)
(when (nonzero? (-> s5-0 file (-> obj option-index) present))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set! (-> *progress-state* which) (-> obj option-index))
(set! (-> obj next-display-state) (progress-screen memcard-loading))
)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
@@ -1256,7 +1256,7 @@
(((progress-screen save-game) (progress-screen save-game-title))
(cond
((< (-> obj option-index) 4)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set! (-> *progress-state* which) (-> obj option-index))
(if (zero? (-> s5-0 file (-> obj option-index) present))
(set! (-> obj next-display-state) (progress-screen memcard-saving))
@@ -1264,30 +1264,30 @@
)
)
((and (= (-> obj display-state) (progress-screen save-game-title)) (= (-> obj option-index) 4))
(sound-play-by-name (static-sound-name "starts-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "starts-options")
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set-master-mode 'game)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
)
(((progress-screen memcard-insert))
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
(((progress-screen memcard-data-exists))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set! (-> obj next-display-state) (progress-screen memcard-saving))
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(if (= (-> obj display-state-stack 0) (progress-screen title))
(set! (-> obj next-display-state) (progress-screen save-game-title))
(set! (-> obj next-display-state) (progress-screen save-game))
@@ -1298,11 +1298,11 @@
(((progress-screen memcard-no-data))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set! (-> obj next-display-state) (progress-screen memcard-creating))
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
@@ -1316,18 +1316,18 @@
)
(cond
((= (-> obj display-state-stack 0) (progress-screen title))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set-master-mode 'game)
)
((nonzero? (-> obj display-state-stack 0))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set-master-mode 'game)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
@@ -1340,19 +1340,19 @@
(progress-screen memcard-removed)
(progress-screen auto-save)
)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
(((progress-screen pal-change-to-60hz))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice))
(set! (-> obj video-mode-timeout) (-> *display* real-frame-counter))
(set! (-> obj next-display-state) (progress-screen pal-now-60hz))
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> obj next-display-state) (progress-screen invalid))
)
@@ -1363,30 +1363,30 @@
((not (-> *progress-state* yes-no-choice))
(set! (-> *progress-state* video-mode-choice) 'pal)
(set! (-> *setting-control* default video-mode) (-> *progress-state* video-mode-choice))
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
)
(else
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
)
)
(set! (-> obj next-display-state) (progress-screen invalid))
)
(((progress-screen no-disc) (progress-screen bad-disc))
(when (is-cd-in?)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
(((progress-screen quit))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "title-start")
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
@@ -1394,18 +1394,18 @@
(((progress-screen memcard-format))
(cond
((-> *progress-state* yes-no-choice)
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set! (-> obj next-display-state) (progress-screen memcard-formatting))
)
((= (-> obj display-state-stack 0) (progress-screen title))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(initialize! *game-info* 'game (the-as game-save #f) "intro-start")
(set-master-mode 'game)
)
(else
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj next-display-state) (progress-screen invalid))
)
)
@@ -1431,7 +1431,7 @@
((cpad-pressed? 0 up)
(when (not (-> obj selected-option))
(if (!= (length s5-0) 1)
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-up-down")
)
(set! (-> obj last-option-index-change) (-> *display* real-frame-counter))
(if (> (-> obj option-index) 0)
@@ -1454,7 +1454,7 @@
(when v1-34
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) 1024 0 0 1 #t)
(sound-play "slider2001")
)
)
)
@@ -1467,7 +1467,7 @@
((cpad-pressed? 0 down)
(when (not (-> obj selected-option))
(if (!= (length s5-0) 1)
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-up-down")
)
(set! (-> obj last-option-index-change) (-> *display* real-frame-counter))
(cond
@@ -1495,7 +1495,7 @@
(when v1-69
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) 1024 0 0 1 #t)
(sound-play "slider2001")
)
)
)
@@ -1544,7 +1544,7 @@
)
)
(if s4-5
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-l-r")
)
)
)
@@ -1589,7 +1589,7 @@
)
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 f30-0)) 0 0 1 #t)
(sound-play "slider2001" :vol f30-0)
)
)
)
@@ -1641,7 +1641,7 @@
)
)
(if v1-217
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-l-r")
)
)
)
@@ -1686,7 +1686,7 @@
)
(when (< (seconds 0.3) (- (-> *display* real-frame-counter) (-> *progress-state* last-slider-sound)))
(set! (-> *progress-state* last-slider-sound) (-> *display* real-frame-counter))
(sound-play-by-name (static-sound-name "slider2001") (new-sound-id) (the int (* 10.24 f30-1)) 0 0 1 #t)
(sound-play "slider2001" :vol f30-1)
)
)
)
@@ -1724,7 +1724,7 @@
)
)
)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-options")
(set! (-> obj selected-option) #f)
)
((or (can-go-back? obj)
@@ -1737,8 +1737,8 @@
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle))
(if (= (-> obj display-state) (progress-screen settings))
(sound-play-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "menu-stats")
(sound-play "cursor-options")
)
(load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index))
(set! (-> obj next-display-state) (progress-screen invalid))
@@ -1755,7 +1755,7 @@
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(push! obj)
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(sound-play "select-option")
(set! (-> obj next-display-state) (the-as progress-screen (-> s5-0 (-> obj option-index) param3)))
(case (-> obj next-display-state)
(((progress-screen load-game) (progress-screen save-game) (progress-screen save-game-title))
@@ -1771,8 +1771,8 @@
)
((= (-> s5-0 (-> obj option-index) name) (game-text-id back))
(if (= (-> obj display-state) (progress-screen settings))
(sound-play-by-name (static-sound-name "menu-stats") (new-sound-id) 1024 0 0 1 #t)
(sound-play-by-name (static-sound-name "cursor-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "menu-stats")
(sound-play "cursor-options")
)
(load-level-text-files (-> *level-task-data* (-> obj display-level-index) text-group-index))
(set! (-> obj next-display-state) (progress-screen invalid))
@@ -1806,7 +1806,7 @@
)
)
)
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(sound-play "select-option")
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons x))
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle))
@@ -1823,7 +1823,7 @@
)
)
(else
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(set! (-> obj selected-option) #f)
(case (-> s5-0 (-> obj option-index) option-type)
(((game-option-type aspect-ratio))
@@ -1869,7 +1869,7 @@
(let ((s5-0 (-> obj display-level-index)))
(set! (-> obj next-level-index) (get-next-level-down s5-0))
(when (!= s5-0 (-> obj next-level-index))
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-up-down")
(set! (-> obj level-transition) 2)
)
)
@@ -1878,28 +1878,28 @@
(let ((s5-2 (-> obj next-level-index)))
(set! (-> obj next-level-index) (get-next-level-up s5-2))
(when (!= s5-2 (-> obj next-level-index))
(sound-play-by-name (static-sound-name "cursor-up-down") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-up-down")
(set! (-> obj level-transition) 1)
)
)
)
((cpad-pressed? 0 square)
(when (nonzero? (-> obj display-state))
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(sound-play "select-option")
(set! (-> obj next-display-state) (progress-screen fuel-cell))
(set! (-> obj stat-transition) #t)
)
)
((cpad-pressed? 0 x)
(when (!= (-> obj display-state) (progress-screen money))
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(sound-play "select-option")
(set! (-> obj next-display-state) (progress-screen money))
(set! (-> obj stat-transition) #t)
)
)
((cpad-pressed? 0 triangle)
(when (!= (-> obj display-state) (progress-screen buzzer))
(sound-play-by-name (static-sound-name "select-option") (new-sound-id) 1024 0 0 1 #t)
(sound-play "select-option")
(set! (-> obj next-display-state) (progress-screen buzzer))
(set! (-> obj stat-transition) #t)
)
@@ -1907,7 +1907,7 @@
((cpad-pressed? 0 circle)
(logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons circle))
(logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons circle))
(sound-play-by-name (static-sound-name "start-options") (new-sound-id) 1024 0 0 1 #t)
(sound-play "start-options")
(push! obj)
(set! (-> obj next-display-state) (progress-screen settings))
)
@@ -1917,7 +1917,7 @@
(let ((s5-8 (-> obj task-index)))
(set! (-> obj task-index) (get-next-task-down (-> obj task-index) (-> obj display-level-index)))
(if (!= s5-8 (-> obj task-index))
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-l-r")
)
)
)
@@ -1925,7 +1925,7 @@
(let ((s5-10 (-> obj task-index)))
(set! (-> obj task-index) (get-next-task-up (-> obj task-index) (-> obj display-level-index)))
(if (!= s5-10 (-> obj task-index))
(sound-play-by-name (static-sound-name "cursor-l-r") (new-sound-id) 1024 0 0 1 #t)
(sound-play "cursor-l-r")
)
)
)
@@ -2415,11 +2415,11 @@
(defstate progress-coming-in (progress)
:event (-> progress-waiting event)
:enter (behavior ()
(sound-group-pause (the-as uint 255))
(sound-group-pause (sound-group sfx music dialog sog3 ambient sog5 sog6 sog7))
(logclear! (-> *setting-control* default process-mask) (process-mask pause menu))
(add-setting! 'process-mask 'set 0.0 (process-mask progress))
(apply-settings *setting-control*)
(sound-play-by-name (static-sound-name "select-menu") (new-sound-id) 1024 0 0 1 #t)
(sound-play "select-menu")
(set-blackout-frames 0)
(set! *pause-lock* #f)
(none)
@@ -2448,7 +2448,7 @@
;; failed to figure out what this is:
(defstate progress-going-out (progress)
:enter (behavior ()
(sound-play-by-name (static-sound-name "menu-close") (new-sound-id) 1024 0 0 1 #t)
(sound-play "menu-close")
(hide-progress-icons)
(set! (-> self particles 3 init-pos x) -320.0)
(set! (-> self particles 4 init-pos x) -320.0)