From 5c7a3384e59d99d7500c3e3f025b31c9376beb95 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sun, 25 Sep 2022 16:19:06 -0400 Subject: [PATCH] [jak2] static sound macro (#1919) eg ``` (set! (-> obj sound-pre-open) (static-sound-spec "airlock-slider")) ``` it is the same as jak 1, but the `fo-curve` option is set to 1 sometimes. --- decompiler/config/jak2/all-types.gc | 108 +++-- decompiler/util/data_decompile.cpp | 26 +- goal_src/jak2/engine/dma/dma-h.gc | 5 + goal_src/jak2/engine/game/main.gc | 10 +- goal_src/jak2/engine/game/settings.gc | 6 +- goal_src/jak2/engine/gfx/hw/video-h.gc | 2 - goal_src/jak2/engine/gfx/mood/mood.gc | 386 +++++++++++++++++ goal_src/jak2/engine/gfx/texture/texture-h.gc | 44 +- goal_src/jak2/engine/gfx/vu1-user-h.gc | 23 +- goal_src/jak2/engine/load/loader-h.gc | 10 +- goal_src/jak2/engine/math/matrix.gc | 13 +- goal_src/jak2/engine/math/trigonometry.gc | 2 +- goal_src/jak2/engine/ps2/vu1-macros.gc | 14 +- goal_src/jak2/engine/sound/gsound-h.gc | 78 ++-- .../jak2/engine/target/board/target-board.gc | 23 +- goal_src/jak2/engine/util/types-h.gc | 2 +- goal_src/jak2/kernel/dgo-h.gc | 1 + goal_src/jak2/kernel/gkernel-h.gc | 14 +- goal_src/jak2/levels/common/airlock.gc | 376 +++-------------- .../reference/jak2/decompiler-macros.gc | 36 +- .../jak2/engine/debug/editable-player_REF.gc | 390 ++---------------- .../jak2/engine/game/settings_REF.gc | 6 +- .../jak2/engine/gfx/mood/mood_REF.gc | 50 +-- .../engine/target/board/target-board_REF.gc | 16 +- .../jak2/levels/common/airlock_REF.gc | 376 +++-------------- 25 files changed, 788 insertions(+), 1229 deletions(-) diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 3ea98a1cd7..7515d922df 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -1858,39 +1858,31 @@ :bitfield #t :type uint8 (sfx) - (sog1) - (sog2) + (music) + (dialog) ;; same as jak 1 dialog (sog3) - (sog4) - (sog5) + (ambient) + (dialog2) ;; more dialog (sog6) (sog7) - - ; (music) 1 - ; (dialog) 2 - ; (sog3) - ; (ambient) - ; (sog5) - ; (sog6) - ; (sog7) ) -;; not 100% sure on these + (defenum sound-mask :bitfield #t :type uint16 - (volume) - (pitch) - (bend) - (unused) - (time) - (trans) - (fo-min) - (fo-max) - (fo-curve) - (sm09) - (sm10) - (sm11) + (volume) ;; 1 + (pitch) ;; 2 + (bend) ;; 4 + (unused) ;; 8 + (time) ;; 10 + (trans) ;; 20 + (fo-min) ;; 40 + (fo-max) ;; 80 + (fo-curve) ;; 100 + (sm-unk1) + (sm-unk2) + (reg0) ) @@ -30981,7 +30973,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (defenum enemy-flag - :type int64 + :type int64 :bitfield #t (lock-focus 0) (death-start 1) @@ -31188,39 +31180,39 @@ (deftype enemy (process-focusable) ((enemy-flags enemy-flag :offset-assert 208) (enemy-info symbol :offset-assert 216) - (hit-points int32 :offset-assert 220) - (gnd-collide uint32 :offset-assert 224) - (attack-id uint32 :offset-assert 228) - (persistent-attack-id uint32 :offset-assert 232) - (water-max-height float :offset-assert 236) - (water-surface-height float :offset-assert 240) - (desired-angle float :offset-assert 244) - (jump-why uint64 :offset-assert 248) - (penetrated-by-all uint64 :offset-assert 256) - (penetrated-flinch uint64 :offset-assert 264) - (penetrated-knocked uint64 :offset-assert 272) - (reaction-time uint64 :offset-assert 280) - (notice-time uint64 :offset-assert 288) - (state-timeout uint64 :offset-assert 296) - (auto-reset-penetrate-time uint64 :offset-assert 304) - (hit-focus-time uint64 :offset-assert 312) - (last-draw-time uint64 :offset-assert 320) - (starting-time uint64 :offset-assert 328) - (fated-time uint64 :offset-assert 336) - (focus-pos vector :inline :offset-assert 352) - (event-param-point vector :inline :offset-assert 368) - (jump-dest vector :inline :offset 368) - (focus enemy-focus :inline :offset-assert 384) - (incoming enemy-attack-info :inline :offset-assert 416) + (hit-points int32 :offset-assert 220) + (gnd-collide uint32 :offset-assert 224) + (attack-id uint32 :offset-assert 228) + (persistent-attack-id uint32 :offset-assert 232) + (water-max-height float :offset-assert 236) + (water-surface-height float :offset-assert 240) + (desired-angle float :offset-assert 244) + (jump-why uint64 :offset-assert 248) + (penetrated-by-all uint64 :offset-assert 256) + (penetrated-flinch uint64 :offset-assert 264) + (penetrated-knocked uint64 :offset-assert 272) + (reaction-time uint64 :offset-assert 280) + (notice-time uint64 :offset-assert 288) + (state-timeout uint64 :offset-assert 296) + (auto-reset-penetrate-time uint64 :offset-assert 304) + (hit-focus-time uint64 :offset-assert 312) + (last-draw-time uint64 :offset-assert 320) + (starting-time uint64 :offset-assert 328) + (fated-time uint64 :offset-assert 336) + (focus-pos vector :inline :offset-assert 352) + (event-param-point vector :inline :offset-assert 368) + (jump-dest vector :inline :offset 368) + (focus enemy-focus :inline :offset-assert 384) + (incoming enemy-attack-info :inline :offset-assert 416) (actor-group actor-group :offset-assert 480) - (actor-group-count int32 :offset-assert 484) - (neck symbol :offset-assert 488) - (on-notice symbol :offset-assert 492) - (on-active symbol :offset-assert 496) - (on-hostile symbol :offset-assert 500) - (on-death symbol :offset-assert 504) - (idle-anim-player idle-control :inline :offset-assert 512) - (rand-gen symbol :offset-assert 528) + (actor-group-count int32 :offset-assert 484) + (neck symbol :offset-assert 488) + (on-notice symbol :offset-assert 492) + (on-active symbol :offset-assert 496) + (on-hostile symbol :offset-assert 500) + (on-death symbol :offset-assert 504) + (idle-anim-player idle-control :inline :offset-assert 512) + (rand-gen symbol :offset-assert 528) ) :method-count-assert 137 :size-assert #x214 diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index 8850da6dd8..7036c1c1c6 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -692,7 +692,7 @@ goos::Object decompile_sound_spec(const TypeSpec& type, if (bend) { throw std::runtime_error("static sound-spec bend was not zero."); } - if (fo_curve) { + if (fo_curve && file->version == GameVersion::Jak1) { throw std::runtime_error("static sound-spec fo_curve was not zero."); } if (priority) { @@ -743,6 +743,10 @@ goos::Object decompile_sound_spec(const TypeSpec& type, implicit_mask |= 1 << 7; the_macro.push_back(pretty_print::to_symbol(fmt::format(":fo-max {}", fo_max))); } + if (fo_curve != 0) { + implicit_mask |= (1 << 8); + the_macro.push_back(pretty_print::to_symbol(fmt::format(":fo-curve {}", fo_curve))); + } if (mask < implicit_mask) { throw std::runtime_error( @@ -781,16 +785,18 @@ goos::Object decompile_structure(const TypeSpec& type, bool use_fancy_macros) { // some structures we want to decompile to fancy macros instead of a raw static definiton // temp hack!! - if (use_fancy_macros && file && file->version == GameVersion::Jak1) { - if (type == TypeSpec("sp-field-init-spec")) { - ASSERT(file->version == GameVersion::Jak1); // need to update enums - return decompile_sparticle_field_init(type, label, labels, words, ts, file); + if (use_fancy_macros && file) { + if (file->version == GameVersion::Jak1) { + if (type == TypeSpec("sp-field-init-spec")) { + ASSERT(file->version == GameVersion::Jak1); // need to update enums + return decompile_sparticle_field_init(type, label, labels, words, ts, file); + } + if (type == TypeSpec("sparticle-group-item")) { + ASSERT(file->version == GameVersion::Jak1); // need to update enums + return decompile_sparticle_group_item(type, label, labels, words, ts, file); + } } - if (type == TypeSpec("sparticle-group-item")) { - ASSERT(file->version == GameVersion::Jak1); // need to update enums - return decompile_sparticle_group_item(type, label, labels, words, ts, file); - } - if (type == TypeSpec("sound-spec") && file->version != GameVersion::Jak2) { + if (type == TypeSpec("sound-spec")) { return decompile_sound_spec(type, label, labels, words, ts, file); } } diff --git a/goal_src/jak2/engine/dma/dma-h.gc b/goal_src/jak2/engine/dma/dma-h.gc index cf3d49346c..f3b34bd6f8 100644 --- a/goal_src/jak2/engine/dma/dma-h.gc +++ b/goal_src/jak2/engine/dma/dma-h.gc @@ -323,6 +323,7 @@ ;; The dma send functions are disabled in OpenGOAL. (defun dma-sync-fast ((bank dma-bank)) + "Wait for dma to finish." (/ 0 0) (none) ) @@ -330,18 +331,22 @@ (defun dma-send-no-scratch ((bank dma-bank) (madr uint32) (qwc uint32)) + "Send from main memory. Wait for dma to be ready, flush the cache, and go!" (/ 0 0) (none) ) (defun dma-sync-with-count ((bank dma-bank) (count (pointer int32))) + "Sync, and 'count' how many iterations of checking for done. + This 'count' is often refered to as the 'wait'" (/ 0 0) 0 ) (defun dma-count-until-done ((bank dma-bank) (count (pointer int32))) + "Very similar to above, but won't change count if dma is already done." (/ 0 0) 0 ) diff --git a/goal_src/jak2/engine/game/main.gc b/goal_src/jak2/engine/game/main.gc index 95fae70720..d3be46e6e3 100644 --- a/goal_src/jak2/engine/game/main.gc +++ b/goal_src/jak2/engine/game/main.gc @@ -133,25 +133,25 @@ ) (logclear! (-> *setting-control* user-default process-mask) (process-mask freeze menu)) (set! *pause-lock* #f) - (sound-group-pause (sound-group sfx sog1 sog2 sog3 sog4 sog5 sog6 sog7)) + (sound-group-pause (sound-group sfx music dialog sog3 ambient dialog2 sog6 sog7)) (set! (-> *game-info* pause-start-time) (-> *display* real-clock frame-counter)) ) (('freeze) (logior! (-> *setting-control* user-default process-mask) (process-mask freeze)) (logclear! (-> *setting-control* user-default process-mask) (process-mask pause menu)) - (sound-group-pause (sound-group sfx sog4)) + (sound-group-pause (sound-group sfx ambient)) (set! (-> *game-info* pause-start-time) (-> *display* real-clock frame-counter)) ) (('menu) (logior! (-> *setting-control* user-default process-mask) (process-mask menu)) (logclear! (-> *setting-control* user-default process-mask) (process-mask freeze pause progress)) - (sound-group-pause (sound-group sfx sog1 sog2 sog3 sog4 sog5 sog6 sog7)) + (sound-group-pause (sound-group sfx music dialog sog3 ambient dialog2 sog6 sog7)) (set! *pause-lock* #f) ) (('progress) ;; entering progress, start the process (logclear! (-> *setting-control* user-default process-mask) (process-mask freeze pause menu)) - (sound-group-pause (sound-group sfx sog1 sog2 sog3 sog4 sog5 sog6 sog7)) + (sound-group-pause (sound-group sfx music dialog sog3 ambient dialog2 sog6 sog7)) (when (not *progress-process*) (activate-progress *dproc* 'main) (if (not *progress-process*) ;; process didn't start, back to game. @@ -162,7 +162,7 @@ ) (('game) (logclear! (-> *setting-control* user-default process-mask) (process-mask freeze pause menu)) - (sound-group-continue (sound-group sfx sog1 sog2 sog3 sog4 sog5 sog6 sog7)) + (sound-group-continue (sound-group sfx music dialog sog3 ambient dialog2 sog6 sog7)) ) ) diff --git a/goal_src/jak2/engine/game/settings.gc b/goal_src/jak2/engine/game/settings.gc index 7fa6365804..ca16c851a8 100644 --- a/goal_src/jak2/engine/game/settings.gc +++ b/goal_src/jak2/engine/game/settings.gc @@ -1080,15 +1080,15 @@ ) (when (!= (-> s5-0 music-volume) (-> s4-0 music-volume)) (seek! (-> s5-0 music-volume) (-> s4-0 music-volume) (-> pp clock seconds-per-frame)) - (sound-set-volume (sound-group sog1) (* 0.75 (-> s5-0 music-volume))) + (sound-set-volume (sound-group music) (* 0.75 (-> s5-0 music-volume))) ) (when (!= (-> s5-0 dialog-volume) (-> s4-0 dialog-volume)) (seek! (-> s5-0 dialog-volume) (-> s4-0 dialog-volume) (-> pp clock seconds-per-frame)) - (sound-set-volume (sound-group sog2 sog5) (-> s5-0 dialog-volume)) + (sound-set-volume (sound-group dialog dialog2) (-> s5-0 dialog-volume)) ) (when (!= (-> s5-0 ambient-volume) (-> s4-0 ambient-volume)) (seek! (-> s5-0 ambient-volume) (-> s4-0 ambient-volume) (-> pp clock seconds-per-frame)) - (sound-set-volume (sound-group sog4) (-> s5-0 ambient-volume)) + (sound-set-volume (sound-group ambient) (-> s5-0 ambient-volume)) ) ) (when (!= (-> s5-0 language) (-> s4-0 language)) diff --git a/goal_src/jak2/engine/gfx/hw/video-h.gc b/goal_src/jak2/engine/gfx/hw/video-h.gc index bac7a3672e..f48e046b83 100644 --- a/goal_src/jak2/engine/gfx/hw/video-h.gc +++ b/goal_src/jak2/engine/gfx/hw/video-h.gc @@ -5,14 +5,12 @@ ;; name in dgo: video-h ;; dgos: ENGINE, GAME -;; NOTE - for settings (define-extern set-aspect-ratio (function symbol none)) (define-extern set-video-mode (function symbol none)) ;; DECOMP BEGINS ;; very basic settings for video output. - (deftype video-params (structure) ((set-video-mode symbol :offset-assert 0) (reset-video-mode symbol :offset-assert 4) diff --git a/goal_src/jak2/engine/gfx/mood/mood.gc b/goal_src/jak2/engine/gfx/mood/mood.gc index 0cdab3330e..09eec9d249 100644 --- a/goal_src/jak2/engine/gfx/mood/mood.gc +++ b/goal_src/jak2/engine/gfx/mood/mood.gc @@ -920,9 +920,395 @@ ) ) +;; definition for method 17 of type mood-control +;; INFO: Used lq/sq ;; WARN: disable def twice: 141. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod gen-lightning-and-thunder! mood-control ((obj mood-control)) + (local-vars (a1-1 (array float))) + (with-pp + (let ((v1-3 (-> obj mood-channel-group data (-> obj lightning-index) vecs)) + (a1-0 (-> obj lightning-val)) + (a0-4 (/ (-> obj lightning-time) 2)) + (f0-0 (-> obj lightning-time2)) + ) + (set! (-> obj lightning-flash) 0.0) + (cond + ((>= 0.0 f0-0) + (cond + ((zero? a1-0) + (set! a1-1 *flash0*) + ) + ((= a1-0 1) + (set! a1-1 *flash1*) + ) + ((= a1-0 2) + (set! a1-1 *flash2*) + ) + ((= a1-0 3) + (set! a1-1 *flash3*) + ) + ((= a1-0 4) + (set! a1-1 *flash4*) + ) + ((= a1-0 5) + (set! a1-1 *flash5*) + ) + ((= a1-0 6) + (set! a1-1 *flash6*) + ) + (else + (set! a1-1 *flash7*) + ) + ) + (cond + ((< a0-4 (-> a1-1 length)) + (let ((f30-0 (-> a1-1 a0-4)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (cond + ((= (-> obj lightning-index) 4) + (set! (-> obj lightning-flash) f30-0) + ) + ((= (-> obj lightning-index) 5) + (set! (-> obj lightning-flash) f30-0) + (dotimes (s4-0 8) + (set-vector! s5-0 255.0 255.0 255.0 128.0) + (vector4-lerp! + (the-as vector (-> obj mood-fog-table data s4-0)) + (the-as vector (-> obj mood-fog-table data s4-0)) + s5-0 + f30-0 + ) + ) + ) + (else + (set! (-> obj lightning-flash) (* 1.9921875 f30-0)) + (set-vector! (-> v1-3 0) 1.0 1.0 1.0 1.0) + (set! (-> v1-3 1 quad) (-> v1-3 0 quad)) + (set! (-> v1-3 2 quad) (-> v1-3 0 quad)) + (set! (-> v1-3 3 quad) (-> v1-3 0 quad)) + (set! (-> v1-3 4 quad) (-> v1-3 0 quad)) + (set! (-> v1-3 5 quad) (-> v1-3 0 quad)) + ) + ) + ) + (when (not (paused?)) + (let ((v0-2 (the-as number (+ (-> obj lightning-time) 1)))) + (set! (-> obj lightning-time) (the-as int v0-2)) + v0-2 + ) + ) + ) + ((and (level-get-target-inside *level*) (= (-> (level-get-target-inside *level*) name) 'nest)) + (set! (-> obj lightning-time2) (rand-vu-float-range 3.0 5.0)) + ) + (else + (set! (-> obj lightning-time2) (rand-vu-float-range 15.0 20.0)) + ) + ) + ) + (else + (when (not (paused?)) + (set! (-> obj lightning-time2) (- (-> obj lightning-time2) (-> pp clock seconds-per-frame))) + (when (>= 0.0 (-> obj lightning-time2)) + (set! (-> obj lightning-index) (mod (the-as int (rand-uint31-gen *random-generator*)) 6)) + (set! (-> obj lightning-val) (the-as int (logand (rand-uint31-gen *random-generator*) 7))) + (set! (-> obj lightning-time) 0) + (cond + ((zero? (-> obj lightning-index)) + (play-or-stop-lightning! + obj + (static-sound-spec "thunder-b") + (new 'static 'vector :x 37109760.0 :y 16261120.0 :z 5857280.0) + ) + ) + ((= (-> obj lightning-index) 1) + (play-or-stop-lightning! + obj + (static-sound-spec "thunder-b") + (new 'static 'vector :x 20480000.0 :y 33341440.0 :z 12124160.0) + ) + ) + ((= (-> obj lightning-index) 2) + (play-or-stop-lightning! + obj + (static-sound-spec "thunder-b") + (new 'static 'vector :x -20480000.0 :y 33341440.0 :z 12124160.0) + ) + ) + ((= (-> obj lightning-index) 3) + (play-or-stop-lightning! + obj + (static-sound-spec "thunder-b") + (new 'static 'vector :x -37109760.0 :y 16261120.0 :z 5857280.0) + ) + ) + ((= (-> obj lightning-index) 4) + (play-or-stop-lightning! obj (static-sound-spec "thunder-c") (new 'static 'vector :y 40960000.0)) + ) + ((= (-> obj lightning-index) 5) + (play-or-stop-lightning! obj (static-sound-spec "thunder-a") (new 'static 'vector :y 40960000.0)) + ) + ) + ) + ) + ) + ) + ) + ) + ) +;; definition for method 9 of type mood-control ;; WARN: Return type mismatch int vs none. +(defmethod init-weather! mood-control ((obj mood-control)) + (local-vars (v1-39 int)) + (let ((s5-0 (level-get-target-inside *level*))) + (when s5-0 + (cond + ((= (-> s5-0 info taskname) 'drill) + (mem-copy! (the-as pointer (-> obj mood-fog-table)) (the-as pointer *drill-mood-fog-table*) 384) + (mem-copy! (the-as pointer (-> obj mood-color-table)) (the-as pointer *drill-mood-color-table*) 256) + (set! (-> obj mood-direction-table) *drill-mood-direction-table*) + (set! (-> obj mood-clouds cloud-min) (-> *clouds-1000* cloud-min)) + (set! (-> obj mood-clouds cloud-max) (-> *clouds-1000* cloud-max)) + ) + (else + (set! (-> obj mood-direction-table) *mood-direction-table*) + (let ((s4-0 (new 'stack-no-clear 'mood-control-work))) + (cond + ((and (-> obj overide-weather-flag) (not (movie?))) + (set! (-> s4-0 weather cloud) (* 2.0 (fmax 0.0 (fmin 1.0 (-> obj overide cloud))))) + (set! (-> s4-0 weather fog) (* 2.0 (-> obj overide fog))) + ) + (else + (set! (-> s4-0 weather cloud) (* 2.0 (fmax 0.0 (fmin 1.0 (-> obj current-interp cloud))))) + (set! (-> s4-0 weather fog) (* 2.0 (fmax 0.0 (fmin 1.0 (-> obj current-interp fog))))) + ) + ) + (set! (-> s4-0 iweather cloud) (the int (-> s4-0 weather cloud))) + (let ((f0-13 (- (-> s4-0 weather cloud) (the float (-> s4-0 iweather cloud))))) + (cond + ((zero? (-> s4-0 iweather cloud)) + (if (< f0-13 0.5) + (set! (-> s4-0 interp cloud) 0.0) + (set! (-> s4-0 interp cloud) (* 2.0 (+ -0.5 f0-13))) + ) + ) + (else + (set! (-> s4-0 interp cloud) f0-13) + ) + ) + ) + (set! (-> s4-0 iweather fog) (the int (-> s4-0 weather fog))) + (set! (-> s4-0 interp fog) (- (-> s4-0 weather fog) (the float (-> s4-0 iweather fog)))) + (let ((a0-6 (-> s4-0 iweather fog)) + (v1-30 (-> s4-0 iweather cloud)) + ) + (set! (-> s4-0 index 0) (+ (* 3 (the-as int v1-30)) (the-as int a0-6))) + (set! (-> s4-0 index 1) (the-as int (+ a0-6 1 (* 3 (the-as int v1-30))))) + (set! (-> s4-0 index 2) (+ (* 3 (the-as int (+ v1-30 1))) (the-as int a0-6))) + (set! (-> s4-0 index 3) (the-as int (+ a0-6 1 (* 3 (the-as int (+ v1-30 1)))))) + ) + (let ((v1-34 (-> s4-0 iweather cloud))) + (set! (-> s4-0 color-interp) (-> s4-0 interp cloud)) + (set! (-> s4-0 color-index 0) (the-as int v1-34)) + (set! (-> s4-0 color-index 1) (the-as int (+ v1-34 1))) + ) + 0 + (let ((f0-23 (- (-> s4-0 weather cloud) (the float (-> s4-0 iweather cloud))))) + (cond + ((zero? (-> s4-0 iweather cloud)) + (set! (-> s4-0 channel-interp) 0.0) + (set! v1-39 0) + ) + ((= (-> s4-0 iweather cloud) 2) + (set! (-> s4-0 channel-interp) 0.0) + (set! v1-39 2) + ) + ((< f0-23 0.5) + (set! (-> s4-0 channel-interp) (* 2.0 f0-23)) + (set! v1-39 0) + ) + (else + (set! (-> s4-0 channel-interp) (* 2.0 (+ -0.5 f0-23))) + (set! v1-39 1) + ) + ) + ) + (set! (-> s4-0 channel-index 0) v1-39) + (set! (-> s4-0 channel-index 1) (+ v1-39 1)) + (let* ((f0-33 (if (and (-> obj overide-weather-flag) (not (movie?))) + (* 8.0 (-> obj overide cloud)) + (* 8.0 (fmax 0.0 (fmin 1.0 (-> obj current-interp cloud)))) + ) + ) + (v1-52 (the int f0-33)) + ) + (set! (-> s4-0 cloud-interp) (- f0-33 (the float v1-52))) + (set! (-> s4-0 cloud-index 0) v1-52) + (set! (-> s4-0 cloud-index 1) (+ v1-52 1)) + ) + (apply-mood-clouds-and-fog obj s4-0) + (apply-mood-color obj s4-0) + (apply-mood-channels obj s4-0) + (adjust-num-clouds! obj s4-0) + ) + (when (not (or (paused?) (and (-> obj overide-weather-flag) (not (movie?))))) + (set! (-> obj target-interp cloud) + (fmax (fmin (-> obj target-interp cloud) (-> obj range max-cloud)) (-> obj range min-cloud)) + ) + (set! (-> obj target-interp fog) + (fmax (fmin (-> obj target-interp fog) (-> obj range max-fog)) (-> obj range min-fog)) + ) + (seek! + (-> obj current-interp cloud) + (-> obj target-interp cloud) + (* (/ 1.0 (-> obj speed-interp cloud)) (-> self clock seconds-per-frame)) + ) + (seek! + (-> obj current-interp fog) + (-> obj target-interp fog) + (* (/ 1.0 (-> obj speed-interp fog)) (-> self clock seconds-per-frame)) + ) + (when (!= (-> obj time-until-random cloud) -99.0) + (set! (-> obj time-until-random cloud) + (- (-> obj time-until-random cloud) (* 300.0 (-> self clock seconds-per-frame))) + ) + (when (< (-> obj time-until-random cloud) 0.0) + (set! (-> obj time-until-random cloud) + (rand-vu-float-range (-> obj time-until-random-min cloud) (-> obj time-until-random-max cloud)) + ) + (let ((f30-0 (rand-vu-float-range (-> obj range min-cloud) (-> obj range max-cloud))) + (f28-0 (rand-vu-float-range (-> obj range min-cloud) (-> obj range max-cloud))) + (f26-0 (rand-vu-float-range (-> obj range min-cloud) (-> obj range max-cloud))) + (f24-0 (rand-vu-float-range (-> obj range min-cloud) (-> obj range max-cloud))) + (f1-36 (rand-vu-float-range (-> obj range min-cloud) (-> obj range max-cloud))) + ) + (set! (-> obj target-interp cloud) (fabs (+ -0.25 (* 0.25 (+ f30-0 f28-0 f26-0 f24-0 f1-36))))) + ) + (set! (-> obj speed-interp cloud) (rand-vu-float-range 30.0 120.0)) + (when (and (< 0.0 (-> *setting-control* user-current rain)) + (< (-> obj target-interp cloud) 0.5) + (< 0.25 (-> obj target-interp cloud)) + (or (< (-> obj target-interp fog) 0.25) (< 0.75 (-> obj target-interp fog))) + ) + (set! (-> obj speed-interp fog) + (fabs + (/ (* 1.25 (-> obj current-interp fog) (-> obj speed-interp cloud)) (+ -0.75 (-> obj current-interp cloud))) + ) + ) + (set! (-> obj target-interp fog) 0.5) + (set! (-> obj time-until-random fog) (-> obj time-until-random cloud)) + ) + ) + ) + (when (!= (-> obj time-until-random fog) -99.0) + (set! (-> obj time-until-random fog) + (- (-> obj time-until-random fog) (* 300.0 (-> self clock seconds-per-frame))) + ) + (when (< (-> obj time-until-random fog) 0.0) + (set! (-> obj time-until-random fog) + (rand-vu-float-range (-> obj time-until-random-min fog) (-> obj time-until-random-max fog)) + ) + (let ((f30-1 (rand-vu-float-range (-> obj range min-fog) (-> obj range max-fog))) + (f28-1 (rand-vu-float-range (-> obj range min-fog) (-> obj range max-fog))) + (f26-1 (rand-vu-float-range (-> obj range min-fog) (-> obj range max-fog))) + (f1-52 (rand-vu-float-range (-> obj range min-fog) (-> obj range max-fog))) + ) + (set! (-> obj target-interp fog) (fabs (+ -1.0 (* 0.5 (+ f30-1 f28-1 f26-1 f1-52))))) + ) + (set! (-> obj speed-interp fog) (rand-vu-float-range 30.0 120.0)) + ) + ) + ) + (let ((f30-2 (if (and (-> obj overide-weather-flag) (not (movie?))) + (-> obj overide cloud) + (-> obj current-interp cloud) + ) + ) + (f26-2 (if (and (-> obj overide-weather-flag) (not (movie?))) + (-> obj overide fog) + (-> obj current-interp fog) + ) + ) + (f28-2 (fmin (-> s5-0 info max-rain) (-> *time-of-day-context* max-rain))) + ) + (set! (-> obj sound-pitch) (* 1.442695 (logf (-> *display* bg-clock clock-ratio)))) + (let* ((f0-114 (fmax 0.0 (fmin (* 4.0 (fmax 0.0 (+ -0.5 f26-2)) (fmax 0.0 (+ -0.5 f30-2))) f28-2))) + (f30-3 (fmin 0.75 f0-114)) + ) + (set! (-> *setting-control* user-default rain) f30-3) + (cond + ((and (or (and (level-get-target-inside *level*) (= (-> (level-get-target-inside *level*) name) 'nest)) + (< 0.0 (-> *setting-control* user-current rain)) + ) + (!= *master-mode* 'progress) + ) + (gen-lightning-and-thunder! obj) + (cond + ((zero? (-> obj rain-id)) + (set! (-> obj rain-id) (the-as uint (sound-play-by-name + (static-sound-name "rain-hiss") + (new-sound-id) + (the int (* 1024.0 f30-3)) + (the int (* 1524.0 (-> obj sound-pitch))) + 0 + (sound-group sfx) + #t + ) + ) + ) + ) + (else + (when *sound-player-enable* + (let ((v1-136 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-136 command) (sound-command set-param)) + (set! (-> v1-136 id) (the-as sound-id (-> obj rain-id))) + (set! (-> v1-136 params volume) (the int (* 1024.0 f30-3))) + (set! (-> v1-136 params pitch-mod) (the int (* 1524.0 (-> obj sound-pitch)))) + (set! (-> v1-136 params mask) (the-as uint 3)) + (-> v1-136 id) + ) + ) + ) + ) + ) + (else + (set! (-> obj lightning-flash) 0.0) + (when (nonzero? (-> obj rain-id)) + (sound-stop (the-as sound-id (-> obj rain-id))) + (set! (-> obj rain-id) (the-as uint 0)) + 0 + ) + ) + ) + ) + ) + (when (-> obj display-flag) + (cond + ((and (-> obj overide-weather-flag) (not (movie?))) + (format *stdcon* "overide cloud ~f~%" (-> obj overide cloud)) + (format *stdcon* "overide fog ~f~%" (-> obj overide fog)) + ) + (else + (format *stdcon* "time until random cloud ~f~%" (* 0.0033333334 (-> obj time-until-random cloud))) + (format *stdcon* "current cloud ~f~%" (-> obj current-interp cloud)) + (format *stdcon* "target cloud ~f~%" (-> obj target-interp cloud)) + (format *stdcon* "speed cloud ~f~%" (* (/ 1.0 (-> obj speed-interp cloud)) (-> self clock seconds-per-frame))) + (format *stdcon* "time until random fog ~f~%" (* 0.0033333334 (-> obj time-until-random fog))) + (format *stdcon* "current fog ~f~%" (-> obj current-interp fog)) + (format *stdcon* "target fog ~f~%" (-> obj target-interp fog)) + (format *stdcon* "speed fog ~f~%" (* (/ 1.0 (-> obj speed-interp fog)) (-> self clock seconds-per-frame))) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) ;; WARN: Return type mismatch int vs none. (defmethod update-mood-weather! mood-control ((obj mood-control) (cloud-target float) (fog-target float) (cloud-speed float) (fog-speed float)) diff --git a/goal_src/jak2/engine/gfx/texture/texture-h.gc b/goal_src/jak2/engine/gfx/texture/texture-h.gc index af08d7151d..10d6932105 100644 --- a/goal_src/jak2/engine/gfx/texture/texture-h.gc +++ b/goal_src/jak2/engine/gfx/texture/texture-h.gc @@ -5,8 +5,6 @@ ;; name in dgo: texture-h ;; dgos: ENGINE, GAME -;; TODO document and method names with texture.gc - (declare-type texture-page basic) (declare-type texture-pool basic) (declare-type fog-texture-work structure) @@ -32,6 +30,7 @@ ;; DECOMP BEGINS +;; unique identifier for a texture, as the tpage number and index of the texture within the tpage (deftype texture-id (uint32) ((index uint16 :offset 8 :size 12) (page uint16 :offset 20 :size 12) @@ -41,6 +40,7 @@ :flag-assert #x900000004 ) +;; a chunk of vram. (deftype texture-pool-segment (structure) ((dest uint32 :offset-assert 0) (size uint32 :offset-assert 4) @@ -52,6 +52,7 @@ :flag-assert #x900000008 ) +;; the manager for the VRAM. (deftype texture-pool (basic) ((top int32 :offset-assert 4) (cur int32 :offset-assert 8) @@ -93,6 +94,9 @@ ) ) +;; mask where each bit indicates if some part of a tpage is used, by a texture. +;; additionally, the w component holds a minimum distance. The texture is only needed +;; if the distance to the object is smaller than this. (deftype texture-mask (structure) ((mask vector4w :inline :offset-assert 0) (dist float :offset 12) @@ -104,6 +108,8 @@ :flag-assert #x900000010 ) +;; grouping of three masks, corresponding to the 3 segments of the texture. +;; so mask 0 is needed if segment 0 of the texture is needed, etc... (deftype texture-masks (structure) ((data texture-mask 3 :inline :offset-assert 0) ) @@ -112,6 +118,7 @@ :flag-assert #x900000030 ) +;; group of all texture-masks for a given tpage (deftype texture-masks-array (inline-array-class) ((data texture-masks :inline :dynamic :offset-assert 16) ) @@ -121,9 +128,13 @@ ) (set! (-> texture-masks-array heap-base) (the-as uint 48)) + +;; these globals are used during login. The level loading system sets this to the appropriate +;; mask/mask array, and the login methods of drawables will fill these out. (define *texture-masks* (the-as texture-masks #f)) (define *texture-masks-array* (the-as texture-masks-array #f)) +;; metadata for a texture. (deftype texture (basic) ((w int16 :offset-assert 4) (h int16 :offset-assert 6) @@ -146,6 +157,9 @@ :flag-assert #x900000070 ) +;; metadata for a "segment" of a texture page. +;; Each texture page has 3 segments - smaller number segments have higher detail +;; mips. (deftype texture-page-segment (structure) ((block-data pointer :offset-assert 0) (size uint32 :offset-assert 4) @@ -159,12 +173,20 @@ ) (defun texture-mip->segment ((arg0 int) (arg1 int)) + "Figure out which segment of a tpage a given mip level of a texture will be in. + arg0 is the mip level, arg1 is the total number of mips. + higher mip level is lower detail." (if (>= 2 arg1) (+ (- -1 arg0) arg1) (max 0 (- 2 arg0)) ) ) +;; a collection of textures. there is a tpage per category per level. +;; these tpages are loaded from the DVD. +;; eg: prison tfrag is its own tpage. +;; the tpage has multiple textures, and 3 segments. lower number segments +;; are larger and have hi-res versions of textures. (deftype texture-page (basic) ((info file-info :offset-assert 4) (name string :offset-assert 8) @@ -190,6 +212,8 @@ ) ) +;; a pointer to an adgif-shader, stored in bits 8-32. This allows them to fit into +;; an adgif shader easily. (deftype shader-ptr (uint32) ((shader uint32 :offset 8 :size 24) ) @@ -198,6 +222,8 @@ :flag-assert #x900000004 ) +;; an overlay structure containing a shader-ptr that points to the next adgif shader +;; in a linked list. (deftype texture-link (structure) ((next shader-ptr 1 :offset-assert 0) ) @@ -206,6 +232,10 @@ :flag-assert #x900000004 ) +;; an entry for a texture in the texture-page-dir. +;; the texture-page-dir contains an entry for each tpage. +;; Each entry contains a reference to the tpage, and a linked list of shaders +;; using it. (deftype texture-page-dir-entry (structure) ((length int16 :offset-assert 0) (status uint16 :offset-assert 2) @@ -219,6 +249,8 @@ :flag-assert #x90000000c ) +;; the list of all texture pages. +;; this is static data loaded from the DVD at boot. (deftype texture-page-dir (basic) ((length int32 :offset-assert 4) (entries texture-page-dir-entry 1 :inline :offset-assert 8) @@ -232,6 +264,8 @@ ) ) +;; unused in jak 2, but metadata for postponing tpage copies until a second frame, to have a smaller +;; impact on frame times when loading. (deftype texture-relocate-later (basic) ((memcpy symbol :offset-assert 4) (dest uint32 :offset-assert 8) @@ -257,6 +291,10 @@ (bit-9 9) ) +;; GS texturing/blending settings, called adgif-shader. +;; these are used by many different renderers and partially managed by the texture system. +;; for example, the texture system will automatically update tbp to point to the location +;; of texture. (deftype adgif-shader (structure) ((quad qword 5 :inline :offset-assert 0) (prims gs-reg64 10 :offset 0) @@ -291,6 +329,7 @@ ) (set! (-> adgif-shader-array heap-base) (the-as uint 80)) +;; metadata about an area of vram set aside for fancy dynamic texture effects (sky, eye, etc) (deftype texture-base (structure) ((vram-page uint32 :offset-assert 0) (vram-block uint32 :offset-assert 4) @@ -301,6 +340,7 @@ :flag-assert #x90000000c ) +;; GS swizzling tables. (define ct32-24-block-table (new 'static 'boxed-array :type int32 diff --git a/goal_src/jak2/engine/gfx/vu1-user-h.gc b/goal_src/jak2/engine/gfx/vu1-user-h.gc index 40bdfdd898..d049ac2b32 100644 --- a/goal_src/jak2/engine/gfx/vu1-user-h.gc +++ b/goal_src/jak2/engine/gfx/vu1-user-h.gc @@ -5,9 +5,21 @@ ;; name in dgo: vu1-user-h ;; dgos: ENGINE, GAME -;; The DMA buckets -;; name format: -;; -- +;; this file contains shared enums for the various renderers. + +;; Renderers will output data to "buckets", which are later spliced together into a single +;; very large dma chain. + +;; With the exception of a few special case buckets, there's a bucket for +;; --- +;; unlike jak 1, the "draw level index" is separate from the normal level index. + +;; for example: tie-s-l1-tfrag +;; - will be filled by the TIE renderer +;; - special "s" (scissor) variant of TIE +;; - using geometry of level 1 +;; - while the tfrag tpage is in VRAM + (defenum bucket-id :type int32 :bitfield #f @@ -397,7 +409,7 @@ (debug3 326) ) - +;; bit mask to select a renderer (defenum vu1-renderer-mask :type uint64 :bitfield #t @@ -438,6 +450,7 @@ (depth-cue) ) +;; bit mask to select tpages for upload (defenum texture-enable-mask :type uint64 :bitfield #t @@ -460,12 +473,14 @@ (tex16 16) ) +;; also used in u32's sometimes (defenum texture-enable-mask-u32 :type uint32 :bitfield #t :copy-entries texture-enable-mask ) +;; texture page kinds for Jak 2. Pris2 is the actual name. (defenum tpage-category :type int8 (tfrag 0) diff --git a/goal_src/jak2/engine/load/loader-h.gc b/goal_src/jak2/engine/load/loader-h.gc index 218df3e9e8..2ead41ed73 100644 --- a/goal_src/jak2/engine/load/loader-h.gc +++ b/goal_src/jak2/engine/load/loader-h.gc @@ -14,6 +14,8 @@ ;; DECOMP BEGINS +;; load-dir is an array of references to loaded things. +;; it's used to handle art groups that are loaded as part of a level load. (deftype load-dir (basic) ((lev level :offset-assert 4) (string-array (array string) :offset-assert 8) @@ -29,6 +31,7 @@ ) ) +;; specialization of load-dir for art-groups specificially. (deftype load-dir-art-group (load-dir) ((art-group-array (array art-group) :offset 12) ) @@ -41,6 +44,7 @@ ) (defmethod new load-dir ((allocation symbol) (type-to-make type) (arg0 int) (arg1 level)) + "Allocate a new load-dir that can hold arg0 items, for the given level." (let ((s4-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> s4-0 lev) arg1) (set! (-> s4-0 string-array) @@ -54,12 +58,14 @@ ) (defmethod new load-dir-art-group ((allocation symbol) (type-to-make type) (arg0 int) (arg1 level)) + "Allocate a new load-dir-art-group that can hold arg0 art-groups, for the given level." (let ((v0-0 ((method-of-type load-dir new) allocation type-to-make arg0 arg1))) (set! (-> v0-0 data-array content-type) art-group) (the-as load-dir-art-group v0-0) ) ) +;; an external-art-buffer is a buffer that streamed files use. (deftype external-art-buffer (basic) ((index int32 :offset-assert 4) (other external-art-buffer :offset-assert 8) @@ -99,6 +105,7 @@ (defmethod new external-art-buffer ((allocation symbol) (type-to-make type) (arg0 int) (arg1 function) (arg2 symbol)) + "Allocate a new external-art-buffer" (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (set! (-> v0-0 index) arg0) (set! (-> v0-0 init-heap) (the-as (function external-art-buffer object) arg1)) @@ -119,6 +126,7 @@ ) ) +;; a spool-anim is metadata for an animation that will be loaded in chunks to a pair of external-art-buffers (deftype spool-anim (basic) ((name string :offset 16) (anim-name basic :offset-assert 20) @@ -134,7 +142,7 @@ :flag-assert #x90000002c ) - +;; the external-art-control manages loading chunks from spool-anims to external-art-buffer. (deftype external-art-control (basic) ((buffer external-art-buffer 2 :offset-assert 4) (rec spool-anim 3 :inline :offset-assert 16) diff --git a/goal_src/jak2/engine/math/matrix.gc b/goal_src/jak2/engine/math/matrix.gc index 260e81c063..f89532440f 100644 --- a/goal_src/jak2/engine/math/matrix.gc +++ b/goal_src/jak2/engine/math/matrix.gc @@ -69,11 +69,14 @@ (define *identity-matrix* (matrix-identity! (new 'global 'matrix))) -(define *hermite-matrix* - (new 'static 'matrix - :data (new 'static 'array float 16 2.0 -2.0 1.0 1.0 -3.0 3.0 -2.0 -1.0 0.0 0.0 1.0 0.0 1.0 0.0 0.0 0.0) - ) - ) +(define *hermite-matrix* (new 'static 'matrix :vector (new 'static 'inline-array vector 4 + (new 'static 'vector :x 2.0 :y -2.0 :z 1.0 :w 1.0) + (new 'static 'vector :x -3.0 :y 3.0 :z -2.0 :w -1.0) + (new 'static 'vector :z 1.0) + (new 'static 'vector :x 1.0) + ) + ) + ) (defun matrix+! ((arg0 matrix) (arg1 matrix) (arg2 matrix)) "Set dst = src1 + src2. It is okay for any arguments to be the same data. diff --git a/goal_src/jak2/engine/math/trigonometry.gc b/goal_src/jak2/engine/math/trigonometry.gc index e50a67d3b9..baba316347 100644 --- a/goal_src/jak2/engine/math/trigonometry.gc +++ b/goal_src/jak2/engine/math/trigonometry.gc @@ -822,7 +822,7 @@ (defun sign-bit ((arg0 int)) "Return 1 if bit 31 is set, otherwise 0." ;; originally used 32-bit shift, doesn't really matter. - (logand (shl arg0 31) 1) + (logand (shr arg0 31) 1) ;(local-vars (v1-1 int)) ; (let ((v1-0 arg0)) diff --git a/goal_src/jak2/engine/ps2/vu1-macros.gc b/goal_src/jak2/engine/ps2/vu1-macros.gc index f526926ccd..511aecfefe 100644 --- a/goal_src/jak2/engine/ps2/vu1-macros.gc +++ b/goal_src/jak2/engine/ps2/vu1-macros.gc @@ -148,11 +148,15 @@ ) ) -;; In the original game, init-for-transform stashed a bunch of stuff in registers, to be used by other functions. -;; In OpenGOAL, this seems risky so we're going to back up this manually. -;; This does mean this file now has code, but it's not a big deal. -;; This seems like it is very old GOAL code and is really only used for debug and a few weird leftovers. -;; In Jak 2, it's only used for the camera debug drawing code. +;; In the original game, they sometimes stashed some values in vf registers across function calls. +;; In OpenGOAL, we don't have a one-to-one mapping of vf's to x86 hardware registers, so we need +;; to manually backup and restore these. + +;; it's used in a few places: +;; - init-for-transforms sets up register for doing world -> screen transformations. only used for debug cam drawing +;; - set-background-regs! sets up registers for background drawing and runs a VU0 program to premultiply some stuff +;; - bsp also does a similar thing, but doesn't run the VU0 program + (deftype transform-regs (structure) ;; Eventually we might want to actually name some of these fields to be more comprehensible? (;; vf0 not included! diff --git a/goal_src/jak2/engine/sound/gsound-h.gc b/goal_src/jak2/engine/sound/gsound-h.gc index a7c8eb2c8e..a06009e713 100644 --- a/goal_src/jak2/engine/sound/gsound-h.gc +++ b/goal_src/jak2/engine/sound/gsound-h.gc @@ -64,38 +64,30 @@ :bitfield #t :type uint8 (sfx) - (sog1) - (sog2) + (music) + (dialog) ;; same as jak 1 dialog (sog3) - (sog4) - (sog5) + (ambient) + (dialog2) ;; more dialog (sog6) (sog7) - ; (sfx) - ; (music) - ; (dialog) - ; (sog3) - ; (ambient) - ; (sog5) - ; (sog6) - ; (sog7) ) (defenum sound-mask :bitfield #t :type uint16 - (volume) - (pitch) - (bend) - (unused) - (time) - (trans) - (fo-min) - (fo-max) - (fo-curve) - (sm09) - (sm10) - (sm11) + (volume) ;; 1 + (pitch) ;; 2 + (bend) ;; 4 + (unused) ;; 8 + (time) ;; 10 + (trans) ;; 20 + (fo-min) ;; 40 + (fo-max) ;; 80 + (fo-curve) ;; 100 + (sm-unk1) + (sm-unk2) + (reg0) ) (defenum stream-status @@ -105,12 +97,12 @@ (ststatus-one 1) ;; another way to be playing (ststatus-two 2) (ststatus-three 3) - (ststatus-four 4) ;; is playing? + (ststatus-four 4) ;; normal playing (ststatus-five 5) (ststatus-six 6) ;; another way to be playing. (ststatus-seven 7) (ststatus-eight 8) - (ststatus-nine 9) + (ststatus-nine 9) ;; stopping? ) (defenum stereo-mode @@ -138,6 +130,40 @@ ) ) +(defmacro sound-vol (vol) + "convert to sound volume units" + (if (number? vol) + (* 1 (/ (* vol 1024) 100)) + `(the int (/ (* ,vol 1024) 100)) + ) + ) + +(defmacro static-sound-spec (name &key (num 1.0) &key (group 1) + &key (volume #f) + &key (pitch-mod 0) + &key (fo-min 0) &key (fo-max 0) + &key (fo-curve 0) + &key (mask ())) + (let ((snd-mask mask) + (snd-volume 100.0)) + (when (nonzero? fo-max) (cons! snd-mask 'fo-max)) + (when (nonzero? fo-min) (cons! snd-mask 'fo-min)) + (when (nonzero? fo-curve) (cons! snd-mask 'fo-curve)) + (when (nonzero? pitch-mod) (cons! snd-mask 'pitch)) + (when volume (cons! snd-mask 'volume) (set! snd-volume volume)) + `(new 'static 'sound-spec + :sound-name (static-sound-name ,name) + :num ,num + :group ,group + :volume (sound-vol ,snd-volume) + :pitch-mod ,pitch-mod + :fo-min ,fo-min + :fo-max ,fo-max + :fo-curve ,fo-curve + :mask (sound-mask ,@snd-mask) + )) + ) + ;; DECOMP BEGINS (deftype sound-stream-name (structure) diff --git a/goal_src/jak2/engine/target/board/target-board.gc b/goal_src/jak2/engine/target/board/target-board.gc index c31244fac4..7e0656f0e9 100644 --- a/goal_src/jak2/engine/target/board/target-board.gc +++ b/goal_src/jak2/engine/target/board/target-board.gc @@ -53,7 +53,6 @@ (define-extern target-board-hit (state vector target)) ;; DECOMP BEGINS - (define *board-walk-mods* (new 'static 'surface :name 'run @@ -178,7 +177,6 @@ ) ) - (set! (-> *board-duck-mods* mult-hook) (-> *board-walk-mods* mult-hook)) (define *board-air-mods* (new 'static 'surface @@ -322,7 +320,6 @@ (set! (-> v1-10 tiltvf) 0.0) ) - (let ((v1-12 (copy *board-jump-mods* 'global))) (set! (-> v1-12 seek0) 0.0) (set! (-> v1-12 seek90) 0.0) @@ -331,7 +328,6 @@ (set! *board-spin-post-mods* v1-12) ) - (let ((v1-14 (copy *board-duck-jump-mods* 'global))) (set! (-> v1-14 flags) (surface-flag no-turn-around turn-to-vel air)) (set! (-> v1-14 seek0) 0.0) @@ -441,7 +437,6 @@ ) ) - (set! (-> *board-turn-to-mods* mult-hook) (-> *board-walk-mods* mult-hook)) (define *board-ride-mods* (new 'static 'surface @@ -1012,13 +1007,7 @@ ) ) (let ((t9-12 sound-play-by-spec) - (a0-18 (new 'static 'sound-spec - :mask (sound-mask volume pitch sm11) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "board-steady") - ) - ) + (a0-18 (static-sound-spec "board-steady" :volume 0.0 :mask (pitch reg0))) ) (set! (-> a0-18 volume) (the int (* 1024.0 (-> self board engine-sound-volume)))) (set! (-> a0-18 pitch-mod) (the int (* 1524.0 (-> self board engine-sound-pitch)))) @@ -1038,13 +1027,7 @@ ) ) (let ((t9-15 sound-play-by-spec) - (a0-23 (new 'static 'sound-spec - :mask (sound-mask volume pitch sm11) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "board-wind") - ) - ) + (a0-23 (static-sound-spec "board-wind" :volume 0.0 :mask (pitch reg0))) ) (set! (-> a0-23 volume) (the int (-> self board wind-sound-volume))) (set! (-> a0-23 pitch-mod) (the int (-> self board wind-sound-pitch))) @@ -2975,4 +2958,4 @@ 0 0 (none) - ) \ No newline at end of file + ) diff --git a/goal_src/jak2/engine/util/types-h.gc b/goal_src/jak2/engine/util/types-h.gc index 9dc89f91c2..6b1f721cb7 100644 --- a/goal_src/jak2/engine/util/types-h.gc +++ b/goal_src/jak2/engine/util/types-h.gc @@ -21,7 +21,7 @@ ) (defmacro l.wu (location) - "Load an unsigned 32-bit value from a given address. Performsn _no_ type checking." + "Load an unsigned 32-bit value from a given address. Performs _no_ type checking." `(-> (the-as (pointer uint32) ,location) 0) ) diff --git a/goal_src/jak2/kernel/dgo-h.gc b/goal_src/jak2/kernel/dgo-h.gc index 342b07e6a6..d1d584c8eb 100644 --- a/goal_src/jak2/kernel/dgo-h.gc +++ b/goal_src/jak2/kernel/dgo-h.gc @@ -9,6 +9,7 @@ ;; I suspect that these are unused, and were for an older version of DGO. ;; All DGO stuff is handled on the IOP. +;; see also load-dgo.gc's dgo-header. (deftype dgo-entry (structure) ((offset uint32 :offset-assert 0) diff --git a/goal_src/jak2/kernel/gkernel-h.gc b/goal_src/jak2/kernel/gkernel-h.gc index 0d95780d9b..929d2d5fa4 100644 --- a/goal_src/jak2/kernel/gkernel-h.gc +++ b/goal_src/jak2/kernel/gkernel-h.gc @@ -622,19 +622,19 @@ ) (defmacro process-stack-used (proc) - ;; get how much stack the top thread of a process has used. + "get how much stack the top thread of a process has used." `(- (the int (-> ,proc top-thread stack-top)) (the int (-> ,proc top-thread sp)) ) ) (defmacro process-stack-size (proc) - ;; get how much stack the top thread of a process has + "get how much stack the top thread of a process has" `(-> ,proc top-thread stack-size) ) (defmacro process-heap-used (proc) - ;; get how much heap a process has used. + "get how much heap a process has used." `(- (-> ,proc allocated-length) (- (the int (-> ,proc heap-top)) (the int (-> ,proc heap-cur)) @@ -643,11 +643,12 @@ ) (defmacro process-heap-size (proc) - ;; get how much heap a process has + "get how much heap a process has" `(the int (-> ,proc allocated-length)) ) (defmacro break () + "crash the game by dividing by 0." `(/ 0 0) ) @@ -658,16 +659,17 @@ ) (defmacro process-mask? (mask enum-value) + "Are any of the given bits set in the process mask?" `(!= 0 (logand ,mask (process-mask ,enum-value))) ) (defmacro process-mask-set! (mask &rest enum-value) - ;; sets the given bits in the process mask (with or) + "Set the given bits in the process mask" `(set! ,mask (logior ,mask (process-mask ,@enum-value))) ) (defmacro process-mask-clear! (mask &rest enum-value) - ;; sets the given bits in the process mask (with or) + "Clear the given bits in the process mask." `(set! ,mask (logand ,mask (lognot (process-mask ,@enum-value)))) ) diff --git a/goal_src/jak2/levels/common/airlock.gc b/goal_src/jak2/levels/common/airlock.gc index a6617cb6a6..7089058f1d 100644 --- a/goal_src/jak2/levels/common/airlock.gc +++ b/goal_src/jak2/levels/common/airlock.gc @@ -876,69 +876,15 @@ (set! (-> obj pre-open-frame) 35.0) (set! (-> obj lock-frame) 45.0) (set! (-> obj open-frame) 45.0) - (set! (-> obj sound-pre-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slider") - :volume #x400 - ) - ) - (set! (-> obj sound-pre-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slide-e") - :volume #x400 - ) - ) - (set! (-> obj sound-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-seal") - :volume #x400 - ) - ) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-post-close) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slider") - :volume #x400 - ) - ) - (set! (-> obj sound-post-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slide-e") - :volume #x400 - ) - ) + (set! (-> obj sound-pre-open) (static-sound-spec "airlock-slider")) + (set! (-> obj sound-pre-open-stop) (static-sound-spec "airlock-slide-e")) + (set! (-> obj sound-open) (static-sound-spec "airlock-seal")) + (set! (-> obj sound-open-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "airlock-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-close-stop) (static-sound-spec "airlock-hit")) + (set! (-> obj sound-post-close) (static-sound-spec "airlock-slider")) + (set! (-> obj sound-post-close-stop) (static-sound-spec "airlock-slide-e")) (go (method-of-object obj close) #t) (none) ) @@ -1001,76 +947,16 @@ ) ) (set! (-> obj pre-open-speed) 0.9) - (set! (-> obj sound-gear) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-gear") - :volume #x400 - ) - ) - (set! (-> obj sound-pre-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slider") - :volume #x400 - ) - ) - (set! (-> obj sound-pre-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slide-e") - :volume #x400 - ) - ) - (set! (-> obj sound-lock-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-turn") - :volume #x400 - ) - ) - (set! (-> obj sound-lock-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-unlock") - :volume #x400 - ) - ) - (set! (-> obj sound-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-seal") - :volume #x400 - ) - ) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-gear) (static-sound-spec "airlock-gear")) + (set! (-> obj sound-pre-open) (static-sound-spec "airlock-slider")) + (set! (-> obj sound-pre-open-stop) (static-sound-spec "airlock-slide-e")) + (set! (-> obj sound-lock-loop) (static-sound-spec "airlock-turn")) + (set! (-> obj sound-lock-stop) (static-sound-spec "airlock-unlock")) + (set! (-> obj sound-open) (static-sound-spec "airlock-seal")) + (set! (-> obj sound-open-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "airlock-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-close-stop) (static-sound-spec "airlock-hit")) (go (method-of-object obj close) #t) (none) ) @@ -1140,34 +1026,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-stop-open") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-stop-close") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "door-stop-open")) + (set! (-> obj sound-close-loop) (static-sound-spec "door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "door-stop-close")) (go (method-of-object obj close) #t) (none) ) @@ -1237,34 +1099,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (set! (-> obj door-radius) 8192.0) (go (method-of-object obj close) #t) (none) @@ -1323,34 +1161,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wing-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wing-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wing-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wing-close-hit")) (go (method-of-object obj close) #t) (none) ) @@ -1430,34 +1244,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-slide") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-slide") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-slide")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-door-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-slide")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-door-hit")) (set! (-> obj sound-behind?) #t) (go (method-of-object obj close) #t) (none) @@ -1528,34 +1318,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (set! (-> obj door-radius) 8192.0) (go (method-of-object obj close) #t) (none) @@ -1626,34 +1392,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (set! (-> obj door-radius) 8192.0) (go (method-of-object obj close) #t) (none) @@ -1724,34 +1466,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (go (method-of-object obj close) #t) (none) ) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index e326288eb2..1943bcd6d7 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -931,4 +931,38 @@ (set! ,dest #f) (set! ,dest ,src) ) - ) \ No newline at end of file + ) + +(defmacro sound-vol (vol) + "convert to sound volume units" + (if (number? vol) + (* 1 (/ (* vol 1024) 100)) + `(the int (/ (* ,vol 1024) 100)) + ) + ) + +(defmacro static-sound-spec (name &key (num 1.0) &key (group 1) + &key (volume #f) + &key (pitch-mod 0) + &key (fo-min 0) &key (fo-max 0) + &key (fo-curve 0) + &key (mask ())) + (let ((snd-mask mask) + (snd-volume 100.0)) + (when (nonzero? fo-max) (cons! snd-mask 'fo-max)) + (when (nonzero? fo-min) (cons! snd-mask 'fo-min)) + (when (nonzero? fo-curve) (cons! snd-mask 'fo-curve)) + (when (nonzero? pitch-mod) (cons! snd-mask 'pitch)) + (when volume (cons! snd-mask 'volume) (set! snd-volume volume)) + `(new 'static 'sound-spec + :sound-name (static-sound-name ,name) + :num ,num + :group ,group + :volume (sound-vol ,snd-volume) + :pitch-mod ,pitch-mod + :fo-min ,fo-min + :fo-max ,fo-max + :fo-curve ,fo-curve + :mask (sound-mask ,@snd-mask) + )) + ) \ No newline at end of file diff --git a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc index 6fc1cf6b06..efe3e0395f 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc @@ -238,18 +238,7 @@ ) ) (((editable-command select-one)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a0-7 arg0) (t9-4 (method-of-object a0-7 editable-array-method-10)) (a1-12 (new 'stack-no-clear 'vector)) @@ -270,18 +259,7 @@ ) ) (((editable-command select-toggle)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a0-12 arg0) (t9-9 (method-of-object a0-12 editable-array-method-10)) (a1-16 (new 'stack-no-clear 'vector)) @@ -301,18 +279,7 @@ ) ) (((editable-command select-region)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a0-16 arg0) (t9-13 (method-of-object a0-16 editable-array-method-10)) (a1-19 (new 'stack-no-clear 'vector)) @@ -336,18 +303,7 @@ ) ) (((editable-command select-face)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a0-22 arg0) (t9-19 (method-of-object a0-22 editable-array-method-10)) (a1-24 (new 'stack-no-clear 'vector)) @@ -371,18 +327,7 @@ ) ) (((editable-command select-prim)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a0-28 arg0) (t9-25 (method-of-object a0-28 editable-array-method-10)) (a1-29 (new 'stack-no-clear 'vector)) @@ -406,18 +351,7 @@ ) ) (((editable-command select-current-region)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (when (-> arg0 region) (let ((s4-12 (-> arg0 region))) (editable-array-method-9 arg0 (editable-command select-none) arg2) @@ -570,18 +504,7 @@ (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) ) (((editable-command pick-target)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a0-71 arg0) (t9-41 (method-of-object a0-71 editable-array-method-10)) (a1-58 (new 'stack-no-clear 'vector)) @@ -600,50 +523,17 @@ (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) ) (((editable-command pick-loc) (editable-command pick-yes-no)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (editable-array-method-9 arg0 (the-as editable-command (-> arg0 target-command)) arg2) (editable-array-method-13 arg0 (the-as uint 0) (the-as basic 0) (the-as string #f)) ) (((editable-command edit-plane-clear)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (set! (-> arg0 edit-plane) #f) (editable-array-method-16 arg0) ) (((editable-command edit-plane-set)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (cond ((-> arg0 target) (let ((s5-11 (-> arg0 target))) @@ -1031,18 +921,7 @@ (if (and (-> arg0 region) (-> arg0 region locked)) (set! (-> arg0 region) (new 'debug 'editable-region)) ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a2-3 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) (s3-4 (new 'debug 'editable-sphere a2-3 2048.0 (-> arg0 region))) ) @@ -1059,18 +938,7 @@ (if (and (-> arg0 region) (-> arg0 region locked)) (set! (-> arg0 region) (new 'debug 'editable-region)) ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a2-7 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) (s3-6 (new 'debug 'editable-point a2-7 (-> arg0 region))) ) @@ -1084,18 +952,7 @@ (((editable-command insert-sample)) (let ((s4-5 (editable-array-method-11 arg0))) (when (>= s4-5 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a2-11 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) (s3-8 (new 'debug 'editable-sample a2-11 *editable-sample-region*)) ) @@ -1109,18 +966,7 @@ (((editable-command insert-sample-camera)) (let ((s4-6 (editable-array-method-11 arg0))) (when (>= s4-6 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let ((s3-11 (new 'debug 'editable-sample (math-camera-pos) *editable-sample-region*))) (set! (-> arg0 data s4-6) s3-11) (editable-array-method-9 arg0 (editable-command select-none) arg2) @@ -1132,18 +978,7 @@ (((editable-command insert-light)) (let ((s4-7 (editable-array-method-11 arg0))) (when (>= s4-7 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a2-18 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) (s3-13 (new 'debug 'editable-light a2-18 2048.0 *editable-light-region*)) ) @@ -1159,18 +994,7 @@ (((editable-command insert-entity)) (let ((s4-8 (editable-array-method-11 arg0))) (when (>= s4-8 0) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((a2-22 (editable-array-method-17 arg0 (new 'stack-no-clear 'vector) (-> arg2 edit-plane-normal))) (s3-15 (new 'debug 'editable-entity a2-22 *editable-entity-region*)) ) @@ -1182,18 +1006,7 @@ ) ) (((editable-command insert-box)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (if (and (-> arg0 region) (-> arg0 region locked)) (set! (-> arg0 region) (new 'debug 'editable-region)) ) @@ -1202,18 +1015,7 @@ ) ) (((editable-command insert-face)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (if (and (-> arg0 region) (-> arg0 region locked)) (set! (-> arg0 region) (new 'debug 'editable-region)) ) @@ -1273,18 +1075,7 @@ (if (and (-> arg0 region) (-> arg0 region locked)) (set! (-> arg0 region) (new 'debug 'editable-region)) ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let ((s3-18 (editable-array-method-11 arg0))) 0 (editable-array-method-14 @@ -1357,18 +1148,7 @@ ) (cond ((= arg0 (editable-command copy)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (set! (-> obj selection length) 0) (let* ((s4-2 (-> obj length)) (s3-1 0) @@ -1402,18 +1182,7 @@ ) ) ((= arg0 (editable-command copy-region)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (when (and (-> obj region) (not (-> obj region locked))) (editable-array-method-9 obj (editable-command select-current-region) arg1) (let ((v1-52 (copy (-> obj region) 'debug))) @@ -1425,18 +1194,7 @@ ) ) ((= arg0 (editable-command delete)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((s5-3 (-> obj length)) (s4-6 0) (s3-3 (-> obj data s4-6)) @@ -1459,18 +1217,7 @@ ) ((= arg0 (editable-command delete-region)) (when (-> obj region) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (when (!= (-> obj region) *editable-light-region*) (editable-array-method-9 obj (editable-command select-current-region) arg1) (editable-array-method-9 obj (editable-command delete) arg1) @@ -1479,18 +1226,7 @@ ) ) ((= arg0 (editable-command snap-to-ground)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((s5-5 (new 'stack-no-clear 'vector)) (s4-9 (-> obj length)) (s3-5 0) @@ -1508,18 +1244,7 @@ ) ) ((= arg0 (editable-command snap-y)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (cond ((-> obj target) (let* ((s5-7 (edit-get-trans (-> obj target))) @@ -1542,18 +1267,7 @@ ) ) ((= arg0 (editable-command snap-xz)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (cond ((-> obj target) (let* ((s5-9 (edit-get-trans (-> obj target))) @@ -1577,18 +1291,7 @@ ) ((= arg0 (editable-command region-set)) (when (and (-> obj region) (not (-> obj region locked))) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((s5-11 (-> obj length)) (s4-15 0) (a0-44 (-> obj data s4-15)) @@ -1605,18 +1308,7 @@ ) ((= arg0 (editable-command region-add)) (when (and (-> obj region) (not (-> obj region locked))) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (if (-> obj target) (editable-method-21 (-> obj target) (-> obj region)) (editable-array-method-13 obj (the-as uint 14) (the-as basic 49) "pick the editable to add to current region") @@ -1633,18 +1325,7 @@ (editable-array-method-9 obj (editable-command region-set) arg1) ) ((= arg0 (editable-command flip-side)) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (let* ((s5-14 (-> obj length)) (s4-18 0) (a0-58 (-> obj data s4-18)) @@ -2908,18 +2589,7 @@ (return #f) ) ) - (sound-play-by-spec - (new 'static 'sound-spec - :mask (sound-mask fo-curve) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "beep") - :volume #x400 - :fo-curve 1 - ) - (new-sound-id) - (the-as vector #t) - ) + (sound-play-by-spec (static-sound-spec "beep" :fo-curve 1) (new-sound-id) (the-as vector #t)) (format #t "EDITABLE: saved camera sample point for level ~A~%" arg0) ) (else diff --git a/test/decompiler/reference/jak2/engine/game/settings_REF.gc b/test/decompiler/reference/jak2/engine/game/settings_REF.gc index f641e0bce6..e5914a5aaa 100644 --- a/test/decompiler/reference/jak2/engine/game/settings_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/settings_REF.gc @@ -1084,15 +1084,15 @@ ) (when (!= (-> s5-0 music-volume) (-> s4-0 music-volume)) (seek! (-> s5-0 music-volume) (-> s4-0 music-volume) (-> pp clock seconds-per-frame)) - (sound-set-volume (sound-group sog1) (* 0.75 (-> s5-0 music-volume))) + (sound-set-volume (sound-group music) (* 0.75 (-> s5-0 music-volume))) ) (when (!= (-> s5-0 dialog-volume) (-> s4-0 dialog-volume)) (seek! (-> s5-0 dialog-volume) (-> s4-0 dialog-volume) (-> pp clock seconds-per-frame)) - (sound-set-volume (sound-group sog2 sog5) (-> s5-0 dialog-volume)) + (sound-set-volume (sound-group dialog dialog2) (-> s5-0 dialog-volume)) ) (when (!= (-> s5-0 ambient-volume) (-> s4-0 ambient-volume)) (seek! (-> s5-0 ambient-volume) (-> s4-0 ambient-volume) (-> pp clock seconds-per-frame)) - (sound-set-volume (sound-group sog4) (-> s5-0 ambient-volume)) + (sound-set-volume (sound-group ambient) (-> s5-0 ambient-volume)) ) ) (when (!= (-> s5-0 language) (-> s4-0 language)) diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc index 5ebb234da2..f7388734ab 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc @@ -1419,74 +1419,36 @@ ((zero? (-> obj lightning-index)) (play-or-stop-lightning! obj - (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "thunder-b") - :volume #x400 - ) + (static-sound-spec "thunder-b") (new 'static 'vector :x 37109760.0 :y 16261120.0 :z 5857280.0) ) ) ((= (-> obj lightning-index) 1) (play-or-stop-lightning! obj - (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "thunder-b") - :volume #x400 - ) + (static-sound-spec "thunder-b") (new 'static 'vector :x 20480000.0 :y 33341440.0 :z 12124160.0) ) ) ((= (-> obj lightning-index) 2) (play-or-stop-lightning! obj - (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "thunder-b") - :volume #x400 - ) + (static-sound-spec "thunder-b") (new 'static 'vector :x -20480000.0 :y 33341440.0 :z 12124160.0) ) ) ((= (-> obj lightning-index) 3) (play-or-stop-lightning! obj - (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "thunder-b") - :volume #x400 - ) + (static-sound-spec "thunder-b") (new 'static 'vector :x -37109760.0 :y 16261120.0 :z 5857280.0) ) ) ((= (-> obj lightning-index) 4) - (play-or-stop-lightning! - obj - (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "thunder-c") - :volume #x400 - ) - (new 'static 'vector :y 40960000.0) - ) + (play-or-stop-lightning! obj (static-sound-spec "thunder-c") (new 'static 'vector :y 40960000.0)) ) ((= (-> obj lightning-index) 5) - (play-or-stop-lightning! - obj - (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "thunder-a") - :volume #x400 - ) - (new 'static 'vector :y 40960000.0) - ) + (play-or-stop-lightning! obj (static-sound-spec "thunder-a") (new 'static 'vector :y 40960000.0)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc index 7f45a15a40..1c7c02cae3 100644 --- a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc @@ -995,13 +995,7 @@ ) ) (let ((t9-12 sound-play-by-spec) - (a0-18 (new 'static 'sound-spec - :mask (sound-mask volume pitch sm11) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "board-steady") - ) - ) + (a0-18 (static-sound-spec "board-steady" :volume 0.0 :mask (pitch reg0))) ) (set! (-> a0-18 volume) (the int (* 1024.0 (-> self board engine-sound-volume)))) (set! (-> a0-18 pitch-mod) (the int (* 1524.0 (-> self board engine-sound-pitch)))) @@ -1021,13 +1015,7 @@ ) ) (let ((t9-15 sound-play-by-spec) - (a0-23 (new 'static 'sound-spec - :mask (sound-mask volume pitch sm11) - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "board-wind") - ) - ) + (a0-23 (static-sound-spec "board-wind" :volume 0.0 :mask (pitch reg0))) ) (set! (-> a0-23 volume) (the int (-> self board wind-sound-volume))) (set! (-> a0-23 pitch-mod) (the int (-> self board wind-sound-pitch))) diff --git a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc index a341decbd9..fa70595fc8 100644 --- a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc @@ -946,69 +946,15 @@ (set! (-> obj pre-open-frame) 35.0) (set! (-> obj lock-frame) 45.0) (set! (-> obj open-frame) 45.0) - (set! (-> obj sound-pre-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slider") - :volume #x400 - ) - ) - (set! (-> obj sound-pre-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slide-e") - :volume #x400 - ) - ) - (set! (-> obj sound-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-seal") - :volume #x400 - ) - ) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-post-close) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slider") - :volume #x400 - ) - ) - (set! (-> obj sound-post-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slide-e") - :volume #x400 - ) - ) + (set! (-> obj sound-pre-open) (static-sound-spec "airlock-slider")) + (set! (-> obj sound-pre-open-stop) (static-sound-spec "airlock-slide-e")) + (set! (-> obj sound-open) (static-sound-spec "airlock-seal")) + (set! (-> obj sound-open-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "airlock-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-close-stop) (static-sound-spec "airlock-hit")) + (set! (-> obj sound-post-close) (static-sound-spec "airlock-slider")) + (set! (-> obj sound-post-close-stop) (static-sound-spec "airlock-slide-e")) (go (method-of-object obj close) #t) (none) ) @@ -1085,76 +1031,16 @@ ) ) (set! (-> obj pre-open-speed) 0.9) - (set! (-> obj sound-gear) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-gear") - :volume #x400 - ) - ) - (set! (-> obj sound-pre-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slider") - :volume #x400 - ) - ) - (set! (-> obj sound-pre-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-slide-e") - :volume #x400 - ) - ) - (set! (-> obj sound-lock-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-turn") - :volume #x400 - ) - ) - (set! (-> obj sound-lock-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-unlock") - :volume #x400 - ) - ) - (set! (-> obj sound-open) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-seal") - :volume #x400 - ) - ) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-open") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "airlock-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-gear) (static-sound-spec "airlock-gear")) + (set! (-> obj sound-pre-open) (static-sound-spec "airlock-slider")) + (set! (-> obj sound-pre-open-stop) (static-sound-spec "airlock-slide-e")) + (set! (-> obj sound-lock-loop) (static-sound-spec "airlock-turn")) + (set! (-> obj sound-lock-stop) (static-sound-spec "airlock-unlock")) + (set! (-> obj sound-open) (static-sound-spec "airlock-seal")) + (set! (-> obj sound-open-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "airlock-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "airlock-open")) + (set! (-> obj sound-close-stop) (static-sound-spec "airlock-hit")) (go (method-of-object obj close) #t) (none) ) @@ -1239,34 +1125,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-stop-open") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "door-stop-close") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "door-stop-open")) + (set! (-> obj sound-close-loop) (static-sound-spec "door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "door-stop-close")) (go (method-of-object obj close) #t) (none) ) @@ -1351,34 +1213,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (set! (-> obj door-radius) 8192.0) (go (method-of-object obj close) #t) (none) @@ -1452,34 +1290,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wing-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wing-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wing-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wing-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wing-close-hit")) (go (method-of-object obj close) #t) (none) ) @@ -1587,34 +1401,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-slide") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-slide") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-slide")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-door-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-slide")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-door-hit")) (set! (-> obj sound-behind?) #t) (go (method-of-object obj close) #t) (none) @@ -1700,34 +1490,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (set! (-> obj door-radius) 8192.0) (go (method-of-object obj close) #t) (none) @@ -1813,34 +1579,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (set! (-> obj door-radius) 8192.0) (go (method-of-object obj close) #t) (none) @@ -1926,34 +1668,10 @@ (the-as pair 0) ) (init-airlock! obj) - (set! (-> obj sound-open-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-open") - :volume #x400 - ) - ) - (set! (-> obj sound-open-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-open-hit") - :volume #x400 - ) - ) - (set! (-> obj sound-close-loop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-door-close") - :volume #x400 - ) - ) - (set! (-> obj sound-close-stop) (new 'static 'sound-spec - :num 1.0 - :group (sound-group sfx) - :sound-name (static-sound-name "wood-close-hit") - :volume #x400 - ) - ) + (set! (-> obj sound-open-loop) (static-sound-spec "wood-door-open")) + (set! (-> obj sound-open-stop) (static-sound-spec "wood-open-hit")) + (set! (-> obj sound-close-loop) (static-sound-spec "wood-door-close")) + (set! (-> obj sound-close-stop) (static-sound-spec "wood-close-hit")) (go (method-of-object obj close) #t) (none) )