[decomp] gsound (#583)

This commit is contained in:
ManDude 2021-06-12 15:48:38 +01:00 committed by GitHub
parent 504a073f8f
commit 877e3d161c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 1776 additions and 336 deletions

View file

@ -1241,11 +1241,12 @@
)
(deftype vector3w (structure)
((data int32 3 :offset-assert 0)
((data int32 3 :do-not-decompile :offset-assert 0)
(x int32 :offset 0)
(y int32 :offset 4)
(z int32 :offset 8)
)
:allow-misaligned
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
@ -2112,13 +2113,42 @@
)
(deftype sound-name (uint128)
()
((lo uint64 :offset 0)
(hi uint64 :offset 64)
)
:flag-assert #x900000010
)
(defenum sound-command
:type uint16
(load-bank)
(load-music)
(unload-bank)
(play)
(pause-sound)
(stop-sound)
(continue-sound)
(set-param)
(set-master-volume)
(pause-group)
(stop-group)
(continue-group)
(get-irx-version)
(set-falloff-curve)
(set-sound-falloff)
(reload-info)
(set-language)
(set-flava)
(set-reverb)
(set-ear-trans)
(shutdown)
(list-sounds)
(unload-music)
)
(deftype sound-rpc-cmd (structure)
((rsvd1 uint16 :offset-assert 0)
(command uint16 :offset-assert 2)
(command sound-command :offset-assert 2)
)
:method-count-assert 9
:size-assert #x4
@ -2134,7 +2164,7 @@
(fo-curve int8 :offset-assert 10)
(priority int8 :offset-assert 11)
(volume int32 :offset-assert 12)
(trans float 3 :offset-assert 16) ;; guess on type here
(trans vector3w :inline :offset-assert 16)
(group uint8 :offset-assert 28)
)
:pack-me
@ -2144,7 +2174,7 @@
)
(deftype sound-rpc-bank-cmd (sound-rpc-cmd)
((bank-name uint128 :offset-assert 16)
((bank-name sound-name :offset-assert 16)
)
:method-count-assert 9
:size-assert #x20
@ -2152,7 +2182,7 @@
)
(deftype sound-rpc-sound-cmd (sound-rpc-cmd)
((id uint32 :offset-assert 4)
((id sound-id :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
@ -2189,7 +2219,7 @@
)
(deftype sound-rpc-play (sound-rpc-sound-cmd)
((name uint128 :offset-assert 16)
((name sound-name :offset-assert 16)
(parms sound-play-parms :inline :offset-assert 32)
)
:method-count-assert 9
@ -2260,7 +2290,7 @@
(deftype sound-rpc-get-irx-version (sound-rpc-cmd)
((major uint32 :offset-assert 4)
(minor uint32 :offset-assert 8)
(ee-addr uint32 :offset-assert 12)
(ee-addr pointer :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
@ -2286,7 +2316,7 @@
)
(deftype sound-rpc-set-sound-falloff (sound-rpc-cmd)
((name uint128 :offset-assert 16)
((name sound-name :offset-assert 16)
(curve int32 :offset-assert 32)
(min int32 :offset-assert 36)
(max int32 :offset-assert 40)
@ -2315,8 +2345,8 @@
)
(deftype sound-rpc-set-ear-trans (sound-rpc-cmd)
((ear-trans float 3 :offset-assert 4) ;; guess on float, may be fixed point
(cam-trans float 3 :offset-assert 16)
((ear-trans vector3w :inline :offset-assert 4)
(cam-trans vector3w :inline :offset-assert 16)
(cam-angle int32 :offset-assert 28)
)
:method-count-assert 9
@ -2388,7 +2418,7 @@
(num float :offset-assert 8)
(group uint8 :offset-assert 12)
(sound-name-char uint8 16 :offset 16)
(sound-name uint128 :offset 16)
(sound-name sound-name :offset 16)
(trans float 4 :offset-assert 32) ;; guess
(volume int32 :offset-assert 48)
(pitch-mod int32 :offset-assert 52)
@ -2405,11 +2435,12 @@
:flag-assert #x90000004c
)
(declare-type entity basic)
(deftype ambient-sound (basic)
((spec basic :offset-assert 4)
(playing-id uint32 :offset-assert 8)
((spec sound-spec :offset-assert 4)
(playing-id sound-id :offset-assert 8)
(trans vector :inline :offset-assert 16)
(name uint128 :offset-assert 32)
(name sound-name :offset-assert 32)
(play-time uint64 :offset-assert 48)
(time-base uint64 :offset-assert 56)
(time-random uint64 :offset-assert 64)
@ -2418,20 +2449,21 @@
(falloff-near int32 :offset-assert 80)
(falloff-far int32 :offset-assert 84)
(falloff-mode int32 :offset-assert 88)
(params uint32 :offset-assert 92)
(params sound-play-parms :offset-assert 92)
(param-count int32 :offset-assert 96)
(entity basic :offset-assert 100)
(entity entity :offset-assert 100)
(sound-count int32 :offset-assert 104)
)
:method-count-assert 14
:size-assert #x6c
:flag-assert #xe0000006c
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(new (symbol type basic vector) _type_ 0)
(dummy-9 (_type_) int 9)
(dummy-10 (_type_ sound-name) int 10)
(dummy-11 (_type_ vector) int 11)
(dummy-12 (_type_ int) int 12)
(stop! (_type_) int 13)
)
)
@ -4998,7 +5030,7 @@
(:methods
(new (symbol type int) _type_ 0)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-10 (_type_ process symbol symbol float int) none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
@ -5627,7 +5659,7 @@
((text-id-to-display uint32 :offset-assert 112)
(sound-to-play basic :offset-assert 116)
(trans vector :offset-assert 120)
(sound-id uint32 :offset-assert 124)
(sound-id sound-id :offset-assert 124)
(mode basic :offset-assert 128)
(total-time uint64 :offset-assert 136)
(total-off-time uint64 :offset-assert 144)
@ -11017,7 +11049,7 @@
(update-velocity basic :offset-assert 396)
(counter int32 :offset-assert 400)
(target-count int32 :offset-assert 404)
(sound-id uint32 :offset-assert 408)
(sound-id sound-id :offset-assert 408)
)
:heap-base #x130
:method-count-assert 29
@ -13708,27 +13740,27 @@
:flag-assert #x900000008
)
; (deftype task-info-data (basic)
; ((task-id uint8 :offset-assert 4)
; (task-name UNKNOWN 4 :offset-assert 8)
; (text-index-when-resolved int32 :offset-assert 24)
; )
; :method-count-assert 9
; :size-assert #x1c
; :flag-assert #x90000001c
; )
(deftype task-info-data (basic)
((task-id uint8 :offset-assert 4)
(task-name symbol 4 :offset-assert 8)
(text-index-when-resolved int32 :offset-assert 24)
)
:method-count-assert 9
:size-assert #x1c
:flag-assert #x90000001c
)
; (deftype level-tasks-info (basic)
; ((level-name-id uint32 :offset-assert 4)
; (text-group-index int32 :offset-assert 8)
; (nb-of-tasks int32 :offset-assert 12)
; (buzzer-task-index int32 :offset-assert 16)
; (task-info UNKNOWN 8 :offset-assert 20)
; )
; :method-count-assert 9
; :size-assert #x34
; :flag-assert #x900000034
; )
(deftype level-tasks-info (basic)
((level-name-id uint32 :offset-assert 4)
(text-group-index int32 :offset-assert 8)
(nb-of-tasks int32 :offset-assert 12)
(buzzer-task-index int32 :offset-assert 16)
(task-info task-info-data 8 :offset-assert 20)
)
:method-count-assert 9
:size-assert #x34
:flag-assert #x900000034
)
(deftype game-option (basic)
((option-type uint64 :offset-assert 8)
@ -13790,16 +13822,15 @@
(card-info mc-slot-info :offset-assert 292)
(last-option-index-change uint64 :offset-assert 296)
(video-mode-timeout uint64 :offset-assert 304)
(pad uint8 :offset 731)
; (display-state-stack UNKNOWN 5 :offset-assert 312)
; (option-index-stack UNKNOWN 5 :offset-assert 352)
; (display-state-pos int32 :offset-assert 372)
; (nb-of-icons int32 :offset-assert 376)
; (icons UNKNOWN 6 :offset-assert 380)
; (max-nb-of-particles int32 :offset-assert 404)
; (nb-of-particles int32 :offset-assert 408)
; (particles UNKNOWN 40 :offset-assert 412)
; (particle-state UNKNOWN 40 :offset-assert 572)
(display-state-stack uint64 5 :offset-assert 312)
(option-index-stack uint32 5 :offset-assert 352)
(display-state-pos int32 :offset-assert 372)
(nb-of-icons int32 :offset-assert 376)
(icons uint32 6 :offset-assert 380)
(max-nb-of-particles int32 :offset-assert 404)
(nb-of-particles int32 :offset-assert 408)
(particles uint32 40 :offset-assert 412)
(particle-state uint32 40 :offset-assert 572)
)
:method-count-assert 59
:size-assert #x2dc
@ -13856,11 +13887,11 @@
;; - Symbols
(define-extern *progress-process* process) ;; unknown type
(define-extern *progress-process* (pointer progress))
;; - Unknowns
;;(define-extern *progress-last-task-index* object) ;; unknown type
(define-extern *progress-last-task-index* int)
;; ----------------------
@ -14291,7 +14322,6 @@
;; - Functions
(define-extern link-begin (function pointer (pointer uint8) int kheap link-flag int))
(define-extern string->sound-name (function string sound-name))
(define-extern str-load (function string int pointer int symbol))
(define-extern str-load-status (function (pointer int32) symbol))
(define-extern str-load-cancel (function none))
@ -14381,94 +14411,96 @@
;; - Types
; (deftype sound-iop-info (basic)
; ((frame uint32 :offset-assert 16)
; (strpos int32 :offset-assert 20)
; (str-id uint32 :offset-assert 24)
; (str-id-sign int32 :offset-assert 24)
; (freemem uint32 :offset-assert 28)
; (chinfo UNKNOWN 48 :offset-assert 32)
; (freemem2 uint32 :offset-assert 80)
; (nocd uint32 :offset-assert 84)
; (dirtycd uint32 :offset-assert 88)
; (diskspeed UNKNOWN 2 :offset-assert 92)
; (lastspeed uint32 :offset-assert 100)
; (dupseg int32 :offset-assert 104)
; (times UNKNOWN 41 :offset-assert 108)
; (times-seq uint32 :offset-assert 272)
; )
; :method-count-assert 9
; :size-assert #x114
; :flag-assert #x900000114
; )
(deftype sound-iop-info (basic)
((frame uint32 :offset 16)
(strpos int32 :offset-assert 20)
(str-id uint32 :offset-assert 24)
(str-id-sign int32 :offset 24)
(freemem uint32 :offset-assert 28)
(chinfo uint8 48 :offset-assert 32)
(freemem2 uint32 :offset-assert 80)
(nocd uint32 :offset-assert 84)
(dirtycd uint32 :offset-assert 88)
(diskspeed uint32 2 :offset-assert 92)
(lastspeed uint32 :offset-assert 100)
(dupseg int32 :offset-assert 104)
(times uint32 41 :offset-assert 108)
(times-seq uint32 :offset-assert 272)
)
:method-count-assert 9
:size-assert #x114
:flag-assert #x900000114
)
; (deftype flava-table-row (structure)
; ((music basic :offset-assert 0)
; (flava UNKNOWN 50 :offset-assert 4)
; )
; :method-count-assert 9
; :size-assert #x36
; :flag-assert #x900000036
; )
(deftype flava-table-row (structure)
((music symbol :offset-assert 0)
(flava uint8 50 :offset-assert 4)
)
:allow-misaligned
:method-count-assert 9
:size-assert #x36
:flag-assert #x900000036
)
; (deftype flava-table (basic)
; ((row UNKNOWN 20 :offset-assert 4)
; (count int32 :offset-assert 1284)
; )
; :method-count-assert 9
; :size-assert #x508
; :flag-assert #x900000508
; )
(deftype flava-table (basic)
((row flava-table-row 20 :inline :offset-assert 4)
(count int32 :offset-assert 1284)
)
:method-count-assert 9
:size-assert #x508
:flag-assert #x900000508
)
;; - Symbols
(define-extern target-pos function)
(define-extern new-sound-id function)
(define-extern get-sound-buffer-entry function)
(define-extern sound-trans-convert function)
(define-extern sound-stop function)
(define-extern effect-param->sound-spec function)
(define-extern ear-trans function)
(define-extern sound-play-by-spec function)
(define-extern sound-play-by-name function)
(define-extern target-pos (function int vector))
(define-extern new-sound-id (function sound-id))
(define-extern get-sound-buffer-entry (function pointer))
(define-extern sound-trans-convert (function vector3w vector int))
(define-extern sound-stop (function sound-id int))
(define-extern effect-param->sound-spec (function sound-spec sound-play-parms int sound-spec))
(define-extern ear-trans (function vector))
(define-extern sound-play-by-spec (function sound-spec sound-id vector sound-id))
(define-extern sound-play-by-name (function sound-name sound-id int int int uint vector sound-id))
(define-extern *setting-control* setting-control)
(define-extern sound-angle-convert function)
(define-extern sound-set-ear-trans function)
(define-extern activate-progress function)
(define-extern sound-command->string function)
(define-extern sound-name= function)
(define-extern str-is-playing? function)
(define-extern current-str-id function)
(define-extern current-str-pos function)
(define-extern is-cd-in? function)
(define-extern check-irx-version function)
(define-extern sound-bank-load function)
(define-extern sound-bank-unload function)
(define-extern sound-music-load function)
(define-extern sound-music-unload function)
(define-extern sound-reload-info function)
(define-extern set-language function)
(define-extern list-sounds function)
(define-extern sound-buffer-dump function)
(define-extern swap-sound-buffers function)
(define-extern free-last-sound-buffer-entry function)
(define-extern sound-angle-convert (function float int))
(define-extern sound-set-ear-trans (function vector vector float int))
(define-extern activate-progress (function process int int))
(define-extern sound-command->string (function sound-command string))
(define-extern sound-name= (function sound-name sound-name symbol))
(define-extern str-is-playing? (function symbol))
(define-extern current-str-id (function int))
(define-extern current-str-pos (function int int))
(define-extern is-cd-in? (function symbol))
(define-extern check-irx-version (function int))
(define-extern sound-bank-load (function sound-name sound-id))
(define-extern sound-bank-unload (function sound-name int))
(define-extern sound-music-load (function sound-name int))
(define-extern sound-music-unload (function int))
(define-extern sound-reload-info (function int))
(define-extern set-language (function int int))
(define-extern list-sounds (function int))
(define-extern sound-buffer-dump (function int))
(define-extern swap-sound-buffers (function vector vector float int))
(define-extern free-last-sound-buffer-entry (function int))
(define-extern sound-basic-cb function)
(define-extern sound-set-volume function)
(define-extern sound-set-reverb function)
(define-extern sound-pause function)
(define-extern sound-continue function)
(define-extern sound-group-pause function)
(define-extern sound-group-stop function)
(define-extern sound-group-continue function)
(define-extern sound-set-falloff-curve function)
(define-extern sound-set-sound-falloff function)
(define-extern sound-set-flava function)
(define-extern sound-volume-off function)
(define-extern show-iop-info function)
(define-extern show-iop-memory function)
(define-extern make-sqrt-table function)
(define-extern flava-lookup function)
(define-extern string->sound-name (function string sound-name))
(define-extern sound-set-volume (function uint float int))
(define-extern sound-set-reverb (function int float float uint int))
(define-extern sound-pause (function sound-id int))
(define-extern sound-continue (function sound-id int))
(define-extern sound-group-pause (function uint int))
(define-extern sound-group-stop (function uint int))
(define-extern sound-group-continue (function uint int))
(define-extern sound-set-falloff-curve (function int float float int))
(define-extern sound-set-sound-falloff (function sound-name int int int int))
(define-extern sound-set-flava (function uint int))
(define-extern sound-volume-off (function int))
(define-extern show-iop-info (function dma-buffer int))
(define-extern show-iop-memory (function dma-buffer int))
(define-extern make-sqrt-table (function int))
(define-extern flava-lookup (function symbol int integer))
;; - Functions
@ -14477,14 +14509,14 @@
;; - Unknowns
;;(define-extern *flava-table* object) ;; unknown type
;;(define-extern *sound-iop-info* object) ;; unknown type
;;(define-extern *ambient-spec* object) ;; unknown type
;;(define-extern *debug-effect-control* object) ;; unknown type
;;(define-extern *sound-player-enable* object) ;; unknown type
;;(define-extern *sound-player-rpc* object) ;; unknown type
;;(define-extern *sound-loader-rpc* object) ;; unknown type
;;(define-extern kset-language object) ;; unknown type
(define-extern *flava-table* flava-table) ;; unknown type
(define-extern *sound-iop-info* sound-iop-info) ;; unknown type
(define-extern *ambient-spec* sound-spec) ;; unknown type
(define-extern *debug-effect-control* symbol) ;; unknown type
(define-extern *sound-player-enable* symbol) ;; unknown type
(define-extern *sound-player-rpc* rpc-buffer-pair) ;; unknown type
(define-extern *sound-loader-rpc* rpc-buffer-pair) ;; unknown type
(define-extern kset-language (function int int)) ;; unknown type
;; ----------------------
@ -18438,7 +18470,7 @@
; (active-distance float :offset-assert 184)
; (seek-time uint64 :offset-assert 192)
; (dest vector :inline :offset-assert 208)
; (sound-id uint32 :offset-assert 224)
; (sound-id sound-id :offset-assert 224)
; )
; :method-count-assert 20
; :size-assert #xe4
@ -22386,7 +22418,7 @@
; (spawn-distance meters :offset-assert 472)
; (chase-speed meters :offset-assert 476)
; (y-speed meters :offset-assert 480)
; (sound-id uint32 :offset-assert 484)
; (sound-id sound-id :offset-assert 484)
; (enable-patrol basic :offset-assert 488)
; )
; :method-count-assert 76
@ -22546,7 +22578,7 @@
; (deftype plat (baseplat)
; ((path-pos float :offset-assert 228)
; (sync sync-info-eased :inline :offset-assert 232)
; (sound-id uint32 :offset-assert 260)
; (sound-id sound-id :offset-assert 260)
; )
; :method-count-assert 33
; :size-assert #x108
@ -22603,7 +22635,7 @@
; (path-pos float :offset-assert 188)
; (bidirectional? basic :offset-assert 192)
; (allow-auto-kill basic :offset-assert 196)
; (sound-id uint32 :offset-assert 200)
; (sound-id sound-id :offset-assert 200)
; (trans-off vector :inline :offset-assert 208)
; (spawn-pos vector :inline :offset-assert 224)
; )
@ -22918,8 +22950,8 @@
; (at-point vector :inline :offset-assert 336)
; (accuracy-range float :offset-assert 352)
; (target-theta float :offset-assert 356)
; (sound-id uint32 :offset-assert 360)
; (aim-sound-id uint32 :offset-assert 364)
; (sound-id sound-id :offset-assert 360)
; (aim-sound-id sound-id :offset-assert 364)
; (player-touching-grips? basic :offset-assert 368)
; )
; :method-count-assert 24
@ -23231,7 +23263,7 @@
;; - Types
; (deftype windmill-one (process-drawable)
; ((sound-id uint32 :offset-assert 176)
; ((sound-id sound-id :offset-assert 176)
; )
; :method-count-assert 20
; :size-assert #xb4
@ -26101,7 +26133,7 @@
; (beam-on basic :offset-assert 468)
; (resolution-anim basic :offset-assert 472)
; (sound-name basic :offset-assert 476)
; (sound-id uint32 :offset-assert 480)
; (sound-id sound-id :offset-assert 480)
; (alt-actor basic :offset-assert 484)
; )
; :method-count-assert 53
@ -28986,7 +29018,7 @@
; (deftype eggtop (process-drawable)
; ((cam-tracker uint64 :offset-assert 176)
; (sound-id uint32 :offset-assert 184)
; (sound-id sound-id :offset-assert 184)
; )
; :method-count-assert 20
; :size-assert #xbc
@ -30165,9 +30197,9 @@
; (raised? basic :offset-assert 356)
; (player-touching-grips? basic :offset-assert 360)
; (grips-moving? basic :offset-assert 364)
; (sound-id uint32 :offset-assert 368)
; (rise-sound-id uint32 :offset-assert 372)
; (grips-sound-id uint32 :offset-assert 376)
; (sound-id sound-id :offset-assert 368)
; (rise-sound-id sound-id :offset-assert 372)
; (grips-sound-id sound-id :offset-assert 376)
; (grips basic :offset-assert 380)
; (part-aligned basic :offset-assert 384)
; )
@ -31051,8 +31083,8 @@
; (hop-start-y float :offset-assert 468)
; (bounce int32 :offset-assert 472)
; (bounce-hit float :offset-assert 476)
; (engine-sound-id uint32 :offset-assert 480)
; (boost-sound-id uint32 :offset-assert 484)
; (engine-sound-id sound-id :offset-assert 480)
; (boost-sound-id sound-id :offset-assert 484)
; (engine-sound-pitch float :offset-assert 488)
; (turn-anim-targ float :offset-assert 492)
; (turn-anim-frame float :offset-assert 496)
@ -31067,7 +31099,7 @@
; (heavy basic :offset-assert 536)
; (unstuck-time uint64 :offset-assert 544)
; (stuck-count int32 :offset-assert 552)
; (scrape-sound-id uint32 :offset-assert 556)
; (scrape-sound-id sound-id :offset-assert 556)
; (heat-sound-time uint64 :offset-assert 560)
; )
; :method-count-assert 9
@ -31668,7 +31700,7 @@
;; - Types
; (deftype assistant (process-taskable)
; ((sound-id uint32 :offset-assert 380)
; ((sound-id sound-id :offset-assert 380)
; )
; :method-count-assert 53
; :size-assert #x180
@ -32470,7 +32502,7 @@
; (cam-tracker uint64 :offset-assert 1064)
; (player-attack-id int32 :offset-assert 696)
; (kill-player basic :offset-assert 1076)
; (engine-sound-id uint32 :offset-assert 1080)
; (engine-sound-id sound-id :offset-assert 1080)
; (engine-sound-envelope float :offset-assert 1084)
; (debug-draw basic :offset-assert 1088)
; (debug-path-record basic :offset-assert 1092)
@ -33353,7 +33385,7 @@
; (path-position vector :inline :offset-assert 192)
; (shadow-enable-plane vector :inline :offset-assert 208)
; (smush smush-control :inline :offset-assert 224)
; (sound-id uint32 :offset-assert 256)
; (sound-id sound-id :offset-assert 256)
; )
; :method-count-assert 20
; :size-assert #x104
@ -33857,8 +33889,8 @@
; (auto-pilot basic :offset-assert 852)
; (dead basic :offset-assert 856)
; (anim-frame float :offset-assert 860)
; (engine-sound-id uint32 :offset-assert 864)
; (pedal-sound-id uint32 :offset-assert 868)
; (engine-sound-id sound-id :offset-assert 864)
; (pedal-sound-id sound-id :offset-assert 868)
; (frame-count int8 :offset-assert 872)
; )
; :method-count-assert 35
@ -35000,7 +35032,7 @@
;; - Types
; (deftype assistant-bluehut (process-taskable)
; ((sound-id uint32 :offset-assert 380)
; ((sound-id sound-id :offset-assert 380)
; (jaws uint64 :offset-assert 384)
; (sage basic :offset-assert 392)
; (im-talking basic :offset-assert 396)
@ -35993,7 +36025,7 @@
; )
; (deftype kermit-pulse (process-drawable)
; ((sound-id uint32 :offset-assert 176)
; ((sound-id sound-id :offset-assert 176)
; )
; :method-count-assert 20
; :size-assert #xb4
@ -36022,7 +36054,7 @@
; (tongue-pulse-pos float :offset-assert 428)
; (miss-count int8 :offset-assert 432)
; (charged-up basic :offset-assert 436)
; (sound-id uint32 :offset-assert 440)
; (sound-id sound-id :offset-assert 440)
; )
; :method-count-assert 76
; :size-assert #x1bc
@ -37543,7 +37575,7 @@
; (turn-anim-targ float :offset-assert 128)
; (turn-anim-frame float :offset-assert 132)
; (turn-anim-vel float :offset-assert 136)
; (tube-sound-id uint32 :offset-assert 140)
; (tube-sound-id sound-id :offset-assert 140)
; (tube-sound-vol float :offset-assert 144)
; )
; :method-count-assert 9
@ -41874,7 +41906,7 @@
; (path-coming-out-u float :offset-assert 196)
; (path-faded-up-u float :offset-assert 200)
; (delay-til-bounce int32 :offset-assert 204)
; (rolling-sound-id uint32 :offset-assert 208)
; (rolling-sound-id sound-id :offset-assert 208)
; (rolling-sound-enabled? basic :offset-assert 212)
; (last-bounce-time uint64 :offset-assert 216)
; (hit-player-time uint64 :offset-assert 224)
@ -42517,7 +42549,7 @@
; ((part2 basic :offset-assert 412)
; (launched? basic :offset-assert 416)
; (growth float :offset-assert 420)
; (charge-sound-id uint32 :offset-assert 424)
; (charge-sound-id sound-id :offset-assert 424)
; (launch-time uint64 :offset-assert 432)
; (facing-dir vector :inline :offset-assert 448)
; )

View file

@ -526,5 +526,22 @@
],
"entity": [
["L324", "float", true]
],
"gsound": [
["L137", "float", true],
["L138", "float", true],
["L139", "float", true],
["L140", "float", true],
["L141", "float", true],
["L142", "float", true],
["L143", "float", true],
["L144", "float", true],
["L145", "float", true],
["L146", "float", true],
["L271", "uint64", true],
["L276", "uint64", true],
["L275", "uint64", true],
["L133", "_auto_", true]
]
}

View file

@ -542,5 +542,51 @@
"(method 9 actor-link-info)": [[[0, 36], "s3", "entity-actor"]],
"alt-actor-list-subtask-incomplete-count": [[19, "a0", "entity-links"]],
"actor-link-dead-hook": [[1, "v1", "entity-links"]],
"actor-link-subtask-complete-hook": [[1, "v1", "entity-links"]]
"actor-link-subtask-complete-hook": [[1, "v1", "entity-links"]],
"check-irx-version": [[[6, 37], "gp", "sound-rpc-get-irx-version"]],
"sound-bank-load": [[[9, 11], "v1", "sound-rpc-load-bank"]],
"sound-bank-unload": [[[7, 9], "v1", "sound-rpc-unload-bank"]],
"sound-music-load": [[[7, 9], "v1", "sound-rpc-load-music"]],
"sound-music-unload": [[6, "v1", "sound-rpc-unload-music"]],
"sound-reload-info": [[6, "v1", "sound-rpc-reload-info"]],
"set-language": [[[10, 12], "v1", "sound-rpc-set-language"]],
"list-sounds": [[6, "v1", "sound-rpc-list-sounds"]],
"sound-set-volume": [[[6, 13], "v1", "sound-rpc-set-master-volume"]],
"sound-set-reverb": [[[8, 21], "v1", "sound-rpc-set-reverb"]],
"sound-set-ear-trans": [[[7, 20], "gp", "sound-rpc-set-ear-trans"]],
"sound-play-by-name": [
[[13, 45], "s5", "sound-rpc-play"],
[[22, 39], "s3", "process-drawable"]
],
"sound-play-by-spec": [
[[9, 54], "s5", "sound-rpc-play"],
[[31, 47], "s3", "process-drawable"]
],
"sound-pause": [[[5, 7], "v1", "sound-rpc-pause-sound"]],
"sound-stop": [[[5, 7], "v1", "sound-rpc-stop-sound"]],
"sound-continue": [[[5, 7], "v1", "sound-rpc-continue-sound"]],
"sound-group-pause": [[[5, 7], "v1", "sound-rpc-pause-group"]],
"sound-group-stop": [[[5, 7], "v1", "sound-rpc-stop-group"]],
"sound-group-continue": [[[5, 7], "v1", "sound-rpc-continue-group"]],
"sound-set-falloff-curve": [[[7, 19], "v1", "sound-rpc-set-falloff-curve"]],
"sound-set-sound-falloff": [[[8, 13], "v1", "sound-rpc-set-sound-falloff"]],
"sound-set-flava": [[[5, 7], "v1", "sound-rpc-set-flava"]],
"(method 0 ambient-sound)": [
[136, "v1", "sound-spec"],
[143, "v1", "sound-spec"],
[140, "v1", "sound-spec"],
[147, "v1", "sound-spec"],
["_stack_", 16, "sound-spec"],
["_stack_", 32, "sound-name"],
["_stack_", 48, "(pointer float)"],
["_stack_", 52, "sound-play-parms"],
["_stack_", 64, "res-tag"]
],
"(method 11 ambient-sound)": [
[[18, 31], "s4", "process-drawable"],
[[12, 44], "gp", "sound-rpc-set-param"]
],
"(method 12 ambient-sound)": [[[8, 20], "v1", "sound-rpc-set-param"]],
"sound-buffer-dump": [[[14, 25], "s3", "sound-rpc-play"]]
}

View file

@ -1870,6 +1870,90 @@
"alt-actor-list-subtask-incomplete-count": {
"vars":{"s4-0":"alt-actor-count", "gp-0":"incomplete-count", "s3-0":"alt-actor-idx"}
},
"check-irx-version": {
"vars": { "gp-0": ["cmd", "sound-rpc-get-irx-version"] }
},
"sound-bank-load": {
"vars": { "v1-1": ["cmd", "sound-rpc-load-bank"] }
},
"sound-bank-unload": {
"vars": { "v1-1": ["cmd", "sound-rpc-unload-bank"] }
},
"sound-music-load": {
"vars": { "v1-1": ["cmd", "sound-rpc-load-music"] }
},
"sound-music-unload": {
"vars": { "v1-1": ["cmd", "sound-rpc-unload-music"] }
},
"sound-reload-info": {
"vars": { "v1-1": ["cmd", "sound-rpc-reload-info"] }
},
"set-language": {
"vars": { "v1-1": ["cmd", "sound-rpc-set-language"] }
},
"list-sounds": {
"vars": { "v1-1": ["cmd", "sound-rpc-list-sounds"] }
},
"sound-set-volume": {
"vars": { "v1-0": ["cmd", "sound-rpc-set-master-volume"] }
},
"sound-set-reverb": {
"vars": { "v1-0": ["cmd", "sound-rpc-set-reverb"] }
},
"sound-set-ear-trans": {
"vars": { "gp-0": ["cmd", "sound-rpc-set-ear-trans"] }
},
"sound-play-by-name": {
"args": [ "name", "id", "vol", "pitch", "bend", "group", "trans" ],
"vars": { "s5-0": ["cmd", "sound-rpc-play"], "s3-1": ["proc", "process-drawable"], "s4-0": "sound-trans" }
},
"sound-play-by-spec": {
"args": [ "spec", "id", "trans" ],
"vars": { "s5-0": ["cmd", "sound-rpc-play"], "s3-1": ["proc", "process-drawable"] }
},
"sound-pause": {
"vars": { "v1-0": ["cmd", "sound-rpc-pause-sound"] }
},
"sound-stop": {
"vars": { "v1-0": ["cmd", "sound-rpc-stop-sound"] }
},
"sound-continue": {
"vars": { "v1-0": ["cmd", "sound-rpc-continue-sound"] }
},
"sound-group-pause": {
"vars": { "v1-0": ["cmd", "sound-rpc-pause-group"] }
},
"sound-group-stop": {
"vars": { "v1-0": ["cmd", "sound-rpc-stop-group"] }
},
"sound-group-continue": {
"vars": { "v1-0": ["cmd", "sound-rpc-continue-group"] }
},
"sound-set-falloff-curve": {
"vars": { "v1-0": ["cmd", "sound-rpc-set-falloff-curve"] }
},
"sound-set-sound-falloff": {
"vars": { "v1-0": ["cmd", "sound-rpc-set-sound-falloff"] }
},
"sound-set-flava": {
"vars": { "v1-0": ["cmd", "sound-rpc-set-flava"] }
},
"(method 0 ambient-sound)": {
"vars": { "s5-1": ["obj", "ambient-sound"], "v1-2": "bc" }
},
"(method 9 ambient-sound)": {
"vars": { "s5-1": "spec", "s4-2": "spec-volume" }
},
"(method 11 ambient-sound)": {
"vars": { "gp-0": ["cmd", "sound-rpc-set-param"] }
},
"(method 12 ambient-sound)": {
"vars": { "v1-2": ["cmd", "sound-rpc-set-param"] }
},
"sound-buffer-dump": {
"vars": { "s3-0": ["cmd", "sound-rpc-play"] }
}

View file

@ -444,12 +444,26 @@ This is updated from the entity system used in Crash 2, which had most of these
default
)
(defmacro res-lump-data (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)))
(defmacro res-lump-data (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)) &key (time -1000000000.0))
"Helper macro to get data from a res-lump without interpolation."
`(the-as ,type ((method-of-type res-lump get-property-data)
,lump
,name
'interp
,time
(the-as pointer #f)
,tag-ptr
*res-static-buf*
)
)
)
(defmacro res-lump-data-exact (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)))
"Helper macro to get start of data from a res-lump."
`(the-as ,type ((method-of-type res-lump get-property-data)
,lump
,name
'exact
0.0
(the-as pointer #f)
,tag-ptr
@ -500,6 +514,19 @@ This is updated from the entity system used in Crash 2, which had most of these
)
)
(defmacro res-lump-struct-exact (lump name type &key (tag-ptr (the-as (pointer res-tag) #f)))
`(the-as ,type ((method-of-type res-lump get-property-struct)
,lump
,name
'exact
0.0
(the-as structure #f)
,tag-ptr
*res-static-buf*
)
)
)
(defmethod get-property-value res-lump ((obj res-lump) (name symbol) (mode symbol) (time float) (default uint128) (tag-addr (pointer res-tag)) (buf-addr pointer))
"Returns a given value property's value at a specific time stamp, or default on error.
name is the name of the property you want, mode is its lookup mode ('interp 'base 'exact), time is the timestamp.

View file

@ -59,7 +59,7 @@
((text-id-to-display uint32 :offset-assert 112)
(sound-to-play basic :offset-assert 116)
(trans vector :offset-assert 120)
(sound-id uint32 :offset-assert 124)
(sound-id sound-id :offset-assert 124)
(mode basic :offset-assert 128)
(total-time uint64 :offset-assert 136)
(total-off-time uint64 :offset-assert 144)

View file

@ -165,7 +165,7 @@
(set! (-> obj process) proc)
;; eco may override the pickup type and amount, so try to get this.
(let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag))))
(let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0)))
(cond
(v1-6
;; eco-info lookup succeeded,

View file

@ -28,7 +28,7 @@
(update-velocity basic :offset-assert 396)
(counter int32 :offset-assert 400)
(target-count int32 :offset-assert 404)
(sound-id uint32 :offset-assert 408)
(sound-id sound-id :offset-assert 408)
)
:heap-base #x130
:method-count-assert 29

View file

@ -5,6 +5,7 @@
;; name in dgo: settings-h
;; dgos: GAME, ENGINE
;; was manually done
(deftype setting-data (structure)
((border-mode basic :offset-assert 0)
(sfx-volume float :offset-assert 4)
@ -108,7 +109,7 @@
(:methods
(new (symbol type int) _type_ 0)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-10 (_type_ process symbol symbol float int) none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)

View file

@ -186,11 +186,12 @@
;; Vector of 3 signed words
(deftype vector3w (structure)
((data int32 3 :offset-assert 0)
((data int32 3 :do-not-decompile :offset-assert 0)
(x int32 :offset 0)
(y int32 :offset 4)
(z int32 :offset 8)
)
:allow-misaligned
:method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c

View file

@ -23,16 +23,45 @@
)
;; Sound names were sometimes packed into a uint128
;; fields added by us
(deftype sound-name (uint128)
()
((lo uint64 :offset 0)
(hi uint64 :offset 64)
)
:flag-assert #x900000010
)
(defenum sound-command
:type uint16
(load-bank)
(load-music)
(unload-bank)
(play)
(pause-sound)
(stop-sound)
(continue-sound)
(set-param)
(set-master-volume)
(pause-group)
(stop-group)
(continue-group)
(get-irx-version)
(set-falloff-curve)
(set-sound-falloff)
(reload-info)
(set-language)
(set-flava)
(set-reverb)
(set-ear-trans)
(shutdown)
(list-sounds)
(unload-music)
)
;; like should match the sound type in OVERLORD
;; This is shared between all sound RPCs.
(deftype sound-rpc-cmd (structure)
((rsvd1 uint16 :offset-assert 0)
(command uint16 :offset-assert 2)
(command sound-command :offset-assert 2)
)
:method-count-assert 9
:size-assert #x4
@ -48,7 +77,7 @@
(fo-curve int8 :offset-assert 10)
(priority int8 :offset-assert 11)
(volume int32 :offset-assert 12)
(trans float 3 :offset-assert 16) ;; guess on type here
(trans vector3w :inline :offset-assert 16)
(group uint8 :offset-assert 28)
)
:pack-me
@ -58,7 +87,7 @@
)
(deftype sound-rpc-bank-cmd (sound-rpc-cmd)
((bank-name uint128 :offset-assert 16)
((bank-name sound-name :offset-assert 16)
)
:method-count-assert 9
:size-assert #x20
@ -66,7 +95,7 @@
)
(deftype sound-rpc-sound-cmd (sound-rpc-cmd)
((id uint32 :offset-assert 4)
((id sound-id :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
@ -103,7 +132,7 @@
)
(deftype sound-rpc-play (sound-rpc-sound-cmd)
((name uint128 :offset-assert 16)
((name sound-name :offset-assert 16)
(parms sound-play-parms :inline :offset-assert 32)
)
:method-count-assert 9
@ -174,7 +203,7 @@
(deftype sound-rpc-get-irx-version (sound-rpc-cmd)
((major uint32 :offset-assert 4)
(minor uint32 :offset-assert 8)
(ee-addr uint32 :offset-assert 12)
(ee-addr pointer :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
@ -200,7 +229,7 @@
)
(deftype sound-rpc-set-sound-falloff (sound-rpc-cmd)
((name uint128 :offset-assert 16)
((name sound-name :offset-assert 16)
(curve int32 :offset-assert 32)
(min int32 :offset-assert 36)
(max int32 :offset-assert 40)
@ -229,8 +258,8 @@
)
(deftype sound-rpc-set-ear-trans (sound-rpc-cmd)
((ear-trans float 3 :offset-assert 4) ;; guess on float, may be fixed point
(cam-trans float 3 :offset-assert 16)
((ear-trans vector3w :inline :offset-assert 4)
(cam-trans vector3w :inline :offset-assert 16)
(cam-angle int32 :offset-assert 28)
)
:method-count-assert 9
@ -303,7 +332,7 @@
(num float :offset-assert 8)
(group uint8 :offset-assert 12)
(sound-name-char uint8 16 :offset 16)
(sound-name uint128 :offset 16)
(sound-name sound-name :offset 16)
(trans float 4 :offset-assert 32) ;; guess
(volume int32 :offset-assert 48)
(pitch-mod int32 :offset-assert 52)
@ -322,11 +351,12 @@
(define *current-sound-id* (the sound-id 65536))
(declare-type entity basic)
(deftype ambient-sound (basic)
((spec basic :offset-assert 4)
(playing-id uint32 :offset-assert 8)
((spec sound-spec :offset-assert 4)
(playing-id sound-id :offset-assert 8)
(trans vector :inline :offset-assert 16)
(name uint128 :offset-assert 32)
(name sound-name :offset-assert 32)
(play-time uint64 :offset-assert 48)
(time-base uint64 :offset-assert 56)
(time-random uint64 :offset-assert 64)
@ -335,20 +365,21 @@
(falloff-near int32 :offset-assert 80)
(falloff-far int32 :offset-assert 84)
(falloff-mode int32 :offset-assert 88)
(params uint32 :offset-assert 92)
(params sound-play-parms :offset-assert 92)
(param-count int32 :offset-assert 96)
(entity basic :offset-assert 100)
(entity entity :offset-assert 100)
(sound-count int32 :offset-assert 104)
)
:method-count-assert 14
:size-assert #x6c
:flag-assert #xe0000006c
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(new (symbol type basic vector) _type_ 0)
(dummy-9 (_type_) int 9)
(dummy-10 (_type_ sound-name) int 10)
(dummy-11 (_type_ vector) int 11)
(dummy-12 (_type_ int) int 12)
(stop! (_type_) int 13)
)
)
@ -356,3 +387,5 @@
(define *sound-bank-2* #f)
(defun-extern string->sound-name string sound-name)
(defun-extern sound-set-ear-trans vector vector float int)
(defun-extern ear-trans vector)

View file

@ -6,6 +6,300 @@
;; dgos: GAME, ENGINE
(define *sound-player-rpc* (new 'global 'rpc-buffer-pair (the-as uint 80) (the-as uint 128) 0))
(define *sound-loader-rpc* (new 'global 'rpc-buffer-pair (the-as uint 80) (the-as uint 1) 1))
(defun sound-name= ((arg0 sound-name) (arg1 sound-name))
"Return #t if both are the same name"
(declare (inline))
(and (= (-> arg0 lo) (-> arg1 lo))
(= (-> arg0 hi) (-> arg1 hi)))
)
(deftype sound-iop-info (basic)
((frame uint32 :offset 16)
(strpos int32 :offset-assert 20)
(str-id uint32 :offset-assert 24)
(str-id-sign int32 :offset 24)
(freemem uint32 :offset-assert 28)
(chinfo uint8 48 :offset-assert 32)
(freemem2 uint32 :offset-assert 80)
(nocd uint32 :offset-assert 84)
(dirtycd uint32 :offset-assert 88)
(diskspeed uint32 2 :offset-assert 92)
(lastspeed uint32 :offset-assert 100)
(dupseg int32 :offset-assert 104)
(times uint32 41 :offset-assert 108)
(times-seq uint32 :offset-assert 272)
)
:method-count-assert 9
:size-assert #x114
:flag-assert #x900000114
)
(define *sound-iop-info* (new 'global 'sound-iop-info))
(defun str-is-playing? ()
"Return #t if an audio stream is playing"
(!= (-> *sound-iop-info* strpos) -1)
)
(defun current-str-id ()
"Return id of the current stream"
(-> *sound-iop-info* str-id-sign)
)
(defun current-str-pos ((str int))
"Return position of the current stream. Return -1 if specified stream is not current"
(let ((ret -1))
(if (= str (-> *sound-iop-info* str-id))
(set! ret (-> *sound-iop-info* strpos))
)
ret
)
)
(defun is-cd-in? ()
(declare (inline))
(zero? (-> *sound-iop-info* nocd))
)
(defmacro is-cd-good? ()
`(zero? (-> *sound-iop-info* dirtycd))
)
(defun new-sound-id ()
(set! *current-sound-id* (the sound-id (1+ (the uint *current-sound-id*))))
(if (< (the-as int *current-sound-id*) #x10000)
(set! *current-sound-id* (the-as sound-id #x10000))
)
*current-sound-id*
)
(defun check-irx-version ()
(let ((cmd (the sound-rpc-get-irx-version (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command get-irx-version))
(set! (-> cmd ee-addr) (&-> *sound-iop-info* frame))
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer cmd) (the-as uint 80))
(sync *sound-loader-rpc* #f)
(format 0 "IRX version ~D.~D~%" (-> cmd major) (-> cmd minor))
(when (or (!= (-> cmd major) 2) (nonzero? (-> cmd minor)))
(format 0 "ERROR: IRX is the wrong version - need ~D.~D~%" 2 0)
(format 0 "~%~%Please do (:mch) then mkee on linux-dog~%~%~%")
(crash!)
0
)
)
0
)
;; TODO rpc 1 unimplemented
;(check-irx-version)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; sound loading
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun sound-bank-load ((name sound-name))
(let ((id (new-sound-id)))
(let ((cmd (the sound-rpc-load-bank (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command load-bank))
(set! (-> cmd bank-name) name)
)
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
id
)
)
(defun sound-bank-unload ((name sound-name))
(let ((cmd (the sound-rpc-unload-bank (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command unload-bank))
(set! (-> cmd bank-name) name)
)
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
0
)
(defun sound-music-load ((name sound-name))
(let ((cmd (the sound-rpc-load-music (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command load-music))
(set! (-> cmd bank-name) name)
)
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
0
)
(defun sound-music-unload ()
(let ((cmd (the sound-rpc-unload-music (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command unload-music))
)
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
0
)
;; TODO rpc 1 unimplemented
;(sound-bank-load (new 'static 'sound-name :lo #x6e6f6d6d6f63 :hi 0)) ;; common
;(sound-bank-load (new 'static 'sound-name :lo #x317974706d65 :hi 0)) ;; empty1
;(sound-bank-load (new 'static 'sound-name :lo #x327974706d65 :hi 0)) ;; empty2
(define *sound-bank-1* 'empty1)
(define *sound-bank-2* 'empty2)
(defun sound-reload-info ()
(let ((cmd (the sound-rpc-reload-info (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command reload-info))
)
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
0
)
(defun set-language ((lang int))
(kset-language lang)
(let ((cmd (the sound-rpc-set-language (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command set-language))
(set! (-> cmd lang) (the-as uint lang))
)
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
0
)
(defun list-sounds ()
(let ((cmd (the sound-rpc-list-sounds (add-element *sound-loader-rpc*))))
(set! (-> cmd command) (sound-command list-sounds))
)
(call *sound-loader-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
0
)
(defun-debug sound-command->string ((cmd sound-command))
(case cmd
(((sound-command unload-music)) "unload-music")
(((sound-command list-sounds)) "list-sounds")
(((sound-command shutdown)) "shutdown")
(((sound-command set-ear-trans)) "set-ear-trans")
(((sound-command set-reverb)) "set-reverb")
(((sound-command set-flava)) "set-flava")
(((sound-command set-language)) "set-language")
(((sound-command reload-info)) "reload-info")
(((sound-command set-sound-falloff)) "set-sound-falloff")
(((sound-command set-falloff-curve)) "set-falloff-curve")
(((sound-command get-irx-version)) "get-irx-version")
(((sound-command continue-group)) "continue-group")
(((sound-command stop-group)) "stop-group")
(((sound-command pause-group)) "pause-group")
(((sound-command set-master-volume)) "set-master-volume")
(((sound-command set-param)) "set-param")
(((sound-command continue-sound)) "continue-sound")
(((sound-command stop-sound)) "stop-sound")
(((sound-command pause-sound)) "pause-sound")
(((sound-command play)) "play")
(((sound-command unload-bank)) "unload-bank")
(((sound-command load-music)) "load-music")
(((sound-command load-bank)) "load-bank")
(else "*unknown*")
)
)
(defun sound-buffer-dump ()
(let ((elt-used (-> *sound-player-rpc* current elt-used))
(elt-size (-> *sound-player-rpc* current elt-size)))
(dotimes (i (the-as int elt-used))
(let* ((cmd (the sound-rpc-play (&+ (-> *sound-player-rpc* current base) (* elt-size (the-as uint i)))))
(a3-0 (sound-command->string (-> cmd command)))
(command (-> cmd command))
)
(if (= command (sound-command play))
(format #t "~D ~A ~G~%" i a3-0 (-> cmd name))
(format #t "~D ~A~%" i a3-0)
)
)
)
)
0
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; sound playback
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define *sound-player-enable* #t)
(defun swap-sound-buffers ((arg0 vector) (arg1 vector) (arg2 float))
(cond
((check-busy *sound-player-rpc*)
(set! *sound-player-enable* #f)
)
(else
(let ((a0-2 (-> *sound-player-rpc* current)))
(if (< (-> a0-2 elt-used) (-> a0-2 elt-count))
(sound-set-ear-trans arg0 arg1 arg2)
)
)
(call *sound-player-rpc* (the-as uint 0) (the-as pointer 0) (the-as uint 0))
(set! *sound-player-enable* #t)
)
)
(cond
((not (is-cd-in?))
(if (or (not *progress-process*)
(!= (-> *progress-process* 0 display-state) 32))
(activate-progress *dproc* 32)
)
)
((not (is-cd-good?))
(if (or (not *progress-process*)
(!= (-> *progress-process* 0 display-state) 33))
(activate-progress *dproc* 33)
)
)
)
0
)
(defun get-sound-buffer-entry ()
(add-element *sound-player-rpc*)
)
(defun free-last-sound-buffer-entry ()
(decrement-elt-used *sound-player-rpc*)
0
)
;; sound-basic-cb
(defun sound-trans-convert ((dest vector3w) (src vector))
(let ((vec (if src src (ear-trans))))
(set! (-> dest x) (the int (* (1/ 16) (-> vec x))))
(set! (-> dest y) (the int (* (1/ 16) (-> vec y))))
(set! (-> dest z) (the int (* (1/ 16) (-> vec z))))
)
0
)
(defun sound-angle-convert ((deg float))
(let ((ret (the int (* (/ 360.0 65536.0) (the float (sar (shl (the int deg) 48) 48))))))
(if (< ret 0)
(+! ret 360)
)
(if (< 359 ret)
(+! ret -360)
)
ret
)
)
(defun string->sound-name ((str string))
(let ((snd-name (new 'stack-no-clear 'qword)))
(set! (-> snd-name quad) (the-as uint128 0))
@ -25,3 +319,698 @@
(the-as sound-name (-> snd-name quad))
)
)
(defun sound-set-volume ((group uint) (volume float))
(let ((cmd (the sound-rpc-set-master-volume (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-master-volume))
(set! (-> cmd group) group)
(set! (-> cmd volume) (the int (* 10.24 volume)))
)
0
)
(defun sound-set-ear-trans ((ear-trans vector) (cam-trans vector) (cam-angle float))
(let ((cmd (the sound-rpc-set-ear-trans (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-ear-trans))
(sound-trans-convert (-> cmd ear-trans) ear-trans)
(sound-trans-convert (-> cmd cam-trans) cam-trans)
(set! (-> cmd cam-angle) (sound-angle-convert cam-angle))
)
0
)
(defmacro sound-trans-from-process (cmd sound-trans)
"Macro for getting an appropriate sound-trans from a process-drawable, if possible"
`(begin
(with-pp
(let ((proc (the process-drawable pp)))
(when (= ,sound-trans #t)
(if (and proc
(type-type? (-> proc type) process-drawable)
(nonzero? (-> proc root)))
(set! ,sound-trans (-> proc root trans))
(set! ,sound-trans (the vector #f))
)
)
)
)
(sound-trans-convert (-> ,cmd parms trans) ,sound-trans)
)
)
(defun sound-play-by-name ((name sound-name) (id sound-id) (vol int) (pitch int) (bend int) (group uint) (trans vector))
"Play a sound called name with the specified params"
(let ((sound-trans trans))
(when *sound-player-enable*
(let ((cmd (the sound-rpc-play (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command play))
(set! (-> cmd id) id)
(set! (-> cmd name) name)
(set! (-> cmd parms mask) (the-as uint 0))
(set! (-> cmd parms group) group)
(set! (-> cmd parms volume) vol)
(set! (-> cmd parms pitch-mod) pitch)
(set! (-> cmd parms bend) bend)
(sound-trans-from-process cmd sound-trans)
)
)
)
id
)
(defun sound-play-by-spec ((spec sound-spec) (id sound-id) (sound-trans vector))
"Play a sound from the given spec"
(when *sound-player-enable*
(let ((cmd (the sound-rpc-play (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command play))
(set! (-> cmd id) id)
(set! (-> cmd name) (-> spec sound-name))
(set! (-> cmd parms mask) (-> spec mask))
(set! (-> cmd parms group) (-> spec group))
(set! (-> cmd parms volume) (-> spec volume))
(set! (-> cmd parms pitch-mod) (-> spec pitch-mod))
(set! (-> cmd parms bend) (-> spec bend))
(set! (-> cmd parms fo-min) (-> spec fo-min))
(set! (-> cmd parms fo-max) (-> spec fo-max))
(set! (-> cmd parms fo-curve) (-> spec fo-curve))
(set! (-> cmd parms priority) (-> spec priority))
(sound-trans-from-process cmd sound-trans)
)
)
id
)
(defun sound-pause ((id sound-id))
(let ((cmd (the sound-rpc-pause-sound (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command pause-sound))
(set! (-> cmd id) id)
)
0
)
(defun sound-stop ((id sound-id))
(let ((cmd (the sound-rpc-stop-sound (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command stop-sound))
(set! (-> cmd id) id)
)
0
)
(defun sound-continue ((id sound-id))
(let ((cmd (the sound-rpc-continue-sound (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command continue-sound))
(set! (-> cmd id) id)
)
0
)
(defun sound-group-pause ((group uint))
(let ((cmd (the sound-rpc-pause-group (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command pause-group))
(set! (-> cmd group) group)
)
0
)
(defun sound-group-stop ((group uint))
(let ((cmd (the sound-rpc-stop-group (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command stop-group))
(set! (-> cmd group) group)
)
0
)
(defun sound-group-continue ((group uint))
(let ((cmd (the sound-rpc-continue-group (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command continue-group))
(set! (-> cmd group) group)
)
0
)
(defun sound-set-falloff-curve ((curve int) (falloff float) (ease float))
(let ((cmd (the sound-rpc-set-falloff-curve (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-falloff-curve))
(set! (-> cmd curve) curve)
(set! (-> cmd falloff) (the int (* 4096.0 falloff)))
(set! (-> cmd ease) (the int (* 4096.0 ease)))
)
0
)
(defun sound-set-sound-falloff ((name sound-name) (falloff-min int) (falloff-max int) (curve int))
(let ((cmd (the sound-rpc-set-sound-falloff (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-sound-falloff))
(set! (-> cmd name) name)
(set! (-> cmd min) falloff-min)
(set! (-> cmd max) falloff-max)
(set! (-> cmd curve) curve)
)
0
)
(defun sound-set-flava ((flava uint))
(let ((cmd (the sound-rpc-set-flava (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-flava))
(set! (-> cmd flava) flava)
)
0
)
(define-extern *setting-control* setting-control)
(defun sound-volume-off ()
"Set all sound volume to zero"
(with-pp
(dummy-10 *setting-control* pp 'music-volume 'abs 0.0 0)
(dummy-10 *setting-control* pp 'sfx-volume 'abs 0.0 0)
(dummy-10 *setting-control* pp 'ambient-volume 'abs 0.0 0)
)
0
)
(define *ambient-spec* (new 'static 'sound-spec))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ambient-sound stuff
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod new ambient-sound ((allocation symbol) (type-to-make type) (src basic) (sound-trans vector))
"Make a new ambient-sound. If failed, returns 0 and doesn't allocate anything.
src specifies the sound params source. This can be a string or symbol (the sound name), a sound-spec, or an entity-actor or entity-ambient (reads effect-name, cycle-speed and effect-param from the entity)."
(let ((spec (the sound-spec #f))
(name (new 'static 'sound-name))
(sound-times (the (pointer float) #f))
(params (the sound-play-parms #f))
(param-count 0)
)
(case (-> src type)
((entity-actor entity-ambient)
(swhen (res-lump-struct-exact (the entity src) 'effect-name symbol)
(set! name (string->sound-name (symbol->string bc)))
(set! sound-times (res-lump-data (the entity src) 'cycle-speed (pointer float)))
(set! spec *ambient-spec*)
(let ((sv-64 (new 'static 'res-tag)))
(swhen (res-lump-data-exact (the entity src) 'effect-param sound-play-parms :tag-ptr (& sv-64))
(set! params bc)
(set! param-count (the int (-> sv-64 elt-count)))
)
)
)
)
((sound-spec)
(set! spec (the sound-spec src))
)
((symbol)
(set! name (string->sound-name (symbol->string (the symbol src))))
)
((string)
(set! name (string->sound-name (the string src)))
)
(else
(format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" src)
)
)
(cond
((or spec (nonzero? name))
(let ((obj (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(set! (-> obj spec) spec)
(set! (-> obj name) name)
(set! (-> obj playing-id) (new-sound-id))
(set! (-> obj params) params)
(set! (-> obj param-count) param-count)
(set! (-> obj entity) #f)
(set! (-> obj sound-count) 1)
(set! (-> obj volume) 1024)
(set! (-> obj pitch) 0)
(when (and spec (!= spec *ambient-spec*))
(if (nonzero? (logand (-> spec mask) 1))
(set! (-> obj volume) (-> spec volume)))
(if (nonzero? (logand (-> spec mask) 2))
(set! (-> obj pitch) (-> spec pitch-mod)))
)
(cond
(sound-times
(set! (-> obj time-base) (the-as uint (the int (* 300.0 (-> sound-times 0)))))
(set! (-> obj time-random) (the-as uint (the int (* 300.0 (-> sound-times 1)))))
)
(else
(set! (-> obj time-base) (the-as uint -1))
)
)
(set! (-> obj trans quad) (-> sound-trans quad))
obj
)
)
(else
(the ambient-sound 0)
)
)
)
)
(defun-extern effect-param->sound-spec sound-spec sound-play-parms int sound-spec)
(define-extern *debug-effect-control* symbol)
(defmethod dummy-9 ambient-sound ((obj ambient-sound))
(if (not *ambient-sound-class*)
(return (the int #f))
)
(cond
((-> obj spec)
(when (or (< (the-as int (-> obj time-base)) 0)
(>= (the-as int (-> *display* base-frame-counter))
(the-as int (-> obj play-time)))
)
(when (>= (the-as int (-> obj time-base)) 0)
(set! (-> obj play-time) (+ (-> *display* base-frame-counter)
(-> obj time-base)
(the-as uint (rand-vu-int-count (the-as int (-> obj time-random))))
))
(set! (-> obj playing-id) (new-sound-id))
)
(let ((spec (-> obj spec)))
(when (= spec *ambient-spec*)
(set! (-> spec volume) (-> obj volume))
(set! (-> spec pitch-mod) (-> obj pitch))
(set! (-> spec bend) 0)
(set! (-> spec sound-name) (-> obj name))
(set! (-> spec fo-max) (-> obj falloff-far))
(set! (-> spec mask) (the-as uint 0))
(if (-> obj params)
(effect-param->sound-spec spec (-> obj params) (-> obj param-count))
)
)
(if (and (nonzero? (-> spec fo-max))
(< (* 4096.0 (the float (-> spec fo-max)))
(vector-vector-distance (ear-trans) (-> obj trans))))
(return 0)
)
(when (and *debug-effect-control* (>= (the-as int (-> obj time-base)) 0))
(with-pp
(format #t "(~5D) effect sound ~A ~G "
(-> *display* base-frame-counter)
(-> pp name)
(-> spec sound-name-char))
(format #t "volume: ~f pitch-mod: ~f~%"
(* 0.09765625 (the float (-> spec volume)))
(* 0.000656168 (the float (-> spec pitch-mod))))
)
)
(let ((spec-volume (-> spec volume)))
(set! (-> spec volume) (-> obj volume))
(set! (-> obj playing-id) (sound-play-by-spec spec (-> obj playing-id) (-> obj trans)))
(set! (-> spec volume) spec-volume)
)
)
)
)
(else
(cond
((< (the-as int (-> obj time-base)) 0)
(set! (-> obj playing-id) (sound-play-by-name
(-> obj name)
(-> obj playing-id)
(-> obj volume)
(-> obj pitch)
0
(the-as uint 1)
(-> obj trans)))
)
(else
(when (>= (the-as int (-> *display* base-frame-counter))
(the-as int (-> obj play-time)))
(set! (-> obj playing-id) (sound-play-by-name
(-> obj name)
(new-sound-id)
(-> obj volume)
(-> obj pitch)
0
(the-as uint 1)
(-> obj trans)))
(set! (-> obj play-time) (+ (-> *display* base-frame-counter)
(-> obj time-base)
(the-as uint (rand-vu-int-count (the-as int (-> obj time-random))))
))
)
)
)
)
)
0
)
(defmethod stop! ambient-sound ((obj ambient-sound))
"Halt playback of this ambient-sound"
(sound-stop (-> obj playing-id))
0
)
(defmethod dummy-11 ambient-sound ((obj ambient-sound) (sound-trans vector))
(set! (-> obj trans quad) (-> sound-trans quad))
(when (nonzero? (-> obj playing-id))
(let ((cmd (the sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> cmd command) (sound-command set-param))
(set! (-> cmd id) (-> obj playing-id))
(sound-trans-from-process cmd sound-trans)
(set! (-> cmd parms mask) (the-as uint #x20))
(-> cmd id)
)
)
0
)
(defmethod dummy-10 ambient-sound ((obj ambient-sound) (name sound-name))
(when (not (sound-name= (-> obj name) name))
(stop! obj)
(set! (-> obj playing-id) (new-sound-id))
(set! (-> obj name) name)
)
0
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; sound iop debugging
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun show-iop-info ((buf dma-buffer))
"Display sound channel status in the top left corner"
(dotimes (ch 24)
(draw-string-xy
(if (zero? (-> *sound-iop-info* chinfo ch)) "." "X")
buf (+ (* ch 16) 16) 48 0 1)
)
(dotimes (ch 24)
(draw-string-xy
(if (zero? (-> *sound-iop-info* chinfo (+ ch 24))) "." "X")
buf (+ (* ch 16) 16) 64 0 1)
)
0
)
(defun show-iop-memory ((buf dma-buffer))
(draw-string-xy
(string-format "~8D [~4D]" (-> *sound-iop-info* freemem)
(shr (-> *sound-iop-info* freemem) 10))
buf 32 96 0 1)
(draw-string-xy
(string-format "~8D [~4D]" (-> *sound-iop-info* freemem2)
(shr (-> *sound-iop-info* freemem2) 10))
buf 32 64 0 1)
0
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; sound utils
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun-extern math-camera-pos vector)
(defun-extern target-pos int vector)
(defun-extern camera-pos vector)
(defun ear-trans ()
"Return the trans for the game ear"
(cond
((or (movie?) *external-cam-mode*)
(math-camera-pos)
)
(*target*
(target-pos 0)
)
(else
(camera-pos)
)
)
)
(defun-debug make-sqrt-table ()
"Write the C code for the ??? square root table"
(format #t "static int sqrt_table[256] =~%{~%")
(dotimes (i 256)
(let* ((angle (sqrtf (* 16777216.0 (the float i))))
(angle-rounded (the int (+ 0.5 angle))))
(format #t "~D,~%" angle-rounded)
)
)
(format #t "};~%")
0
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; flava system
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deftype flava-table-row (structure)
((music symbol :offset-assert 0)
(flava uint8 50 :offset-assert 4) ;; index is some flava event, value is music variation
)
:allow-misaligned :method-count-assert 9
:size-assert #x36
:flag-assert #x900000036
)
(deftype flava-table (basic)
((row flava-table-row 20 :inline :offset-assert 4)
(count int32 :offset-assert 1284)
)
:method-count-assert 9
:size-assert #x508
:flag-assert #x900000508
)
;; make a new flava table with nothing defined
(define *flava-table* (new 'global 'flava-table))
(set! (-> *flava-table* count) 0)
(defun flava-lookup ((music symbol) (n int))
"Return the n'th flava for the specified music"
(dotimes (i (-> *flava-table* count))
(if (= (-> *flava-table* row i music) music)
(return (-> *flava-table* row i flava n))
)
)
0
)
(defmacro flava-table-add (name &rest flavas)
"Add a new music and its flavas to the table"
`(begin
;; append a new music to the flava table
(set! (-> *flava-table* row (-> *flava-table* count) music) ,name)
;; reset this music's flavas
(dotimes (n 50)
(set! (-> *flava-table* row (-> *flava-table* count) flava n) 0)
)
;; increase the music count
;; (this should probably be done after...)
(1+! (-> *flava-table* count))
;; set the flavas or whatever they're called
,@(apply (lambda (x) `(set! (-> *flava-table* row (1- (-> *flava-table* count)) flava ,(first x)) ,(second x))) flavas)
)
)
#| flava events (guesses):
0 :
1 : racer
2 : flutflut
3 : to-maincave
4 : to-snow
5 : sage-green
6 : voicebox
7 : birdlady
8 : mayor
9 : sculptor
10: uncle
11: sage-yellow
12: sage-red
13: sage-blue
14: miners
15: warrior
16: geologist
17: gambler
18: sage-hut
19: dock
20: farmer
21: jungleb-eggtop
22: misty-boat
23: misty-ambush (?)
24: beach-sentinel
25: beach-cannon
26: beach-logs
27: citadel-center
28: robocave
29: robocave-top
30: maincave
31: darkcave
32: snow-ambush (?)
33: snow-cave
34: snow-fort
35: snow-balls
36: levitator
37: swamp-launcher
38: swamp-ambush (?)
39: jungle-temple-exit
40: jungle-lurkerm
41: jungle-temple-top
42: rolling-race
43: ogre-middle
44: ogre-end
45: lavatube-middle
46: lavatube-end
47: finalboss-middle
48: finalboss-end
49: default
|#
;; TODO make enum
(flava-table-add 'village1
(5 2)
(6 6)
(7 4)
(20 5)
(8 7)
(9 8)
(10 9)
(19 10)
(18 3)
)
(flava-table-add 'jungle
(39 1)
(40 2)
(41 3)
)
(flava-table-add 'firecanyon
(1 1)
)
(flava-table-add 'jungleb
(21 1)
)
(flava-table-add 'beach
(7 4)
(24 1)
(25 2)
(26 3)
)
(flava-table-add 'misty
(1 3)
(22 2)
(23 1)
)
(flava-table-add 'village2
(5 1)
(6 2)
(15 3)
(16 4)
(17 5)
(36 6)
)
(flava-table-add 'swamp
(2 4)
(37 2)
(38 3)
)
(flava-table-add 'rolling
(42 1)
)
(flava-table-add 'ogre
(43 1)
(44 2)
)
(flava-table-add 'village3
(3 4)
(4 5)
(5 2)
(6 3)
(14 1)
)
(flava-table-add 'maincave
(28 1)
(29 2)
(30 3)
(31 4)
)
(flava-table-add 'snow
(2 2)
(32 1)
(33 3)
(34 4)
(35 5)
)
(flava-table-add 'lavatube
(45 2)
(46 3)
(49 1)
)
(flava-table-add 'citadel
(5 1)
(6 2)
(11 3)
(12 4)
(13 5)
(27 6)
)
(flava-table-add 'finalboss
(47 1)
(48 2)
)
(flava-table-add 'credits
(49 2)
)

View file

@ -5,7 +5,6 @@
;; name in dgo: progress-h
;; dgos: GAME, ENGINE
;; progress-h
(deftype count-info (structure)
((money-count int32 :offset-assert 0)
(buzzer-count int32 :offset-assert 4)
@ -16,7 +15,6 @@
:flag-assert #x900000008
)
;; progress-h
(deftype game-count-info (basic)
((length int32 :offset-assert 4)
(data count-info :inline :dynamic :offset-assert 8)
@ -25,3 +23,153 @@
:size-assert #x8
:flag-assert #x900000008
)
(deftype task-info-data (basic)
((task-id uint8 :offset-assert 4)
(task-name symbol 4 :offset-assert 8)
(text-index-when-resolved int32 :offset-assert 24)
)
:method-count-assert 9
:size-assert #x1c
:flag-assert #x90000001c
)
(deftype level-tasks-info (basic)
((level-name-id uint32 :offset-assert 4)
(text-group-index int32 :offset-assert 8)
(nb-of-tasks int32 :offset-assert 12)
(buzzer-task-index int32 :offset-assert 16)
(task-info task-info-data 8 :offset-assert 20)
)
:method-count-assert 9
:size-assert #x34
:flag-assert #x900000034
)
(deftype game-option (basic)
((option-type uint64 :offset-assert 8)
(name uint32 :offset-assert 16)
(scale basic :offset-assert 20)
(param1 float :offset-assert 24)
(param2 float :offset-assert 28)
(param3 int32 :offset-assert 32)
(value-to-modify uint32 :offset-assert 36)
)
:method-count-assert 9
:size-assert #x28
:flag-assert #x900000028
)
(deftype progress (process)
((current-debug-string int32 :offset-assert 112)
(current-debug-language int32 :offset-assert 116)
(current-debug-group int32 :offset-assert 120)
(in-out-position int32 :offset-assert 124)
(display-state uint64 :offset-assert 128)
(next-display-state uint64 :offset-assert 136)
(option-index int32 :offset-assert 144)
(selected-option basic :offset-assert 148)
(completion-percentage float :offset-assert 152)
(ready-to-run basic :offset-assert 156)
(display-level-index int32 :offset-assert 160)
(next-level-index int32 :offset-assert 164)
(task-index int32 :offset-assert 168)
(in-transition basic :offset-assert 172)
(last-in-transition basic :offset-assert 176)
(force-transition basic :offset-assert 180)
(stat-transition basic :offset-assert 184)
(level-transition int32 :offset-assert 188)
(language-selection uint64 :offset-assert 192)
(language-direction basic :offset-assert 200)
(language-transition basic :offset-assert 204)
(language-x-offset int32 :offset-assert 208)
(sides-x-scale float :offset-assert 212)
(sides-y-scale float :offset-assert 216)
(left-x-offset int32 :offset-assert 220)
(right-x-offset int32 :offset-assert 224)
(button-scale float :offset-assert 228)
(slot-scale float :offset-assert 232)
(left-side-x-scale float :offset-assert 236)
(left-side-y-scale float :offset-assert 240)
(right-side-x-scale float :offset-assert 244)
(right-side-y-scale float :offset-assert 248)
(small-orb-y-offset int32 :offset-assert 252)
(big-orb-y-offset int32 :offset-assert 256)
(transition-offset int32 :offset-assert 260)
(transition-offset-invert int32 :offset-assert 264)
(transition-percentage float :offset-assert 268)
(transition-percentage-invert float :offset-assert 272)
(transition-speed float :offset-assert 276)
(total-nb-of-power-cells int32 :offset-assert 280)
(total-nb-of-orbs int32 :offset-assert 284)
(total-nb-of-buzzers int32 :offset-assert 288)
(card-info mc-slot-info :offset-assert 292)
(last-option-index-change uint64 :offset-assert 296)
(video-mode-timeout uint64 :offset-assert 304)
(display-state-stack uint64 5 :offset-assert 312)
(option-index-stack uint32 5 :offset-assert 352)
(display-state-pos int32 :offset-assert 372)
(nb-of-icons int32 :offset-assert 376)
(icons uint32 6 :offset-assert 380)
(max-nb-of-particles int32 :offset-assert 404)
(nb-of-particles int32 :offset-assert 408)
(particles uint32 40 :offset-assert 412)
(particle-state uint32 40 :offset-assert 572)
)
:method-count-assert 59
:size-assert #x2dc
:flag-assert #x3b000002dc
(:methods
(dummy-14 () none 14)
(dummy-15 () none 15)
(dummy-16 () none 16)
(dummy-17 () none 17)
(dummy-18 () none 18)
(dummy-19 () none 19)
(dummy-20 () none 20)
(dummy-21 () none 21)
(dummy-22 () none 22)
(dummy-23 () none 23)
(dummy-24 () none 24)
(dummy-25 () none 25)
(dummy-26 () none 26)
(dummy-27 () none 27)
(dummy-28 () none 28)
(dummy-29 () none 29)
(dummy-30 () none 30)
(dummy-31 () none 31)
(dummy-32 () none 32)
(dummy-33 () none 33)
(dummy-34 () none 34)
(dummy-35 () none 35)
(dummy-36 () none 36)
(dummy-37 () none 37)
(dummy-38 () none 38)
(dummy-39 () none 39)
(dummy-40 () none 40)
(dummy-41 () none 41)
(dummy-42 () none 42)
(dummy-43 () none 43)
(dummy-44 () none 44)
(dummy-45 () none 45)
(dummy-46 () none 46)
(dummy-47 () none 47)
(dummy-48 () none 48)
(dummy-49 () none 49)
(dummy-50 () none 50)
(dummy-51 () none 51)
(dummy-52 () none 52)
(dummy-53 () none 53)
(dummy-54 () none 54)
(dummy-55 () none 55)
(dummy-56 () none 56)
(dummy-57 () none 57)
(dummy-58 () none 58)
)
)
(define *progress-process* (the (pointer progress) #f))
(define *progress-last-task-index* 0)
(defun-extern activate-progress process int int)

View file

@ -343,6 +343,16 @@
)
)
(defmacro swhen (condition &rest body)
"Same as when, but saves the branch condition onto a variable named bc"
`(let ((bc ,condition))
(if bc
(begin ,@body)
)
)
)
(defmacro return (val)
`(return-from #f ,val)
)

View file

@ -113,7 +113,7 @@
(define-extern mc-check-result (function int))
;; mc-makefile
;; kset-language
(define-extern kset-language (function int int))
(define-extern *debug-segment* symbol)
(define-extern *enable-method-set* int)

View file

@ -908,3 +908,32 @@
:type uint16
(dead 2)
(complete 6))
(defenum sound-command
:type uint16
(load-bank)
(load-music)
(unload-bank)
(play)
(pause-sound)
(stop-sound)
(continue-sound)
(set-param)
(set-master-volume)
(pause-group)
(stop-group)
(continue-group)
(get-irx-version)
(set-falloff-curve)
(set-sound-falloff)
(reload-info)
(set-language)
(set-flava)
(set-reverb)
(set-ear-trans)
(shutdown)
(list-sounds)
(unload-music)
)
(declare-type entity basic)

View file

@ -58,7 +58,7 @@
((text-id-to-display uint32 :offset-assert 112)
(sound-to-play basic :offset-assert 116)
(trans vector :offset-assert 120)
(sound-id uint32 :offset-assert 124)
(sound-id sound-id :offset-assert 124)
(mode basic :offset-assert 128)
(total-time uint64 :offset-assert 136)
(total-off-time uint64 :offset-assert 144)
@ -113,3 +113,7 @@
;; failed to figure out what this is:
(let ((v0-10 0))
)

View file

@ -24,7 +24,7 @@
(update-velocity basic :offset-assert 396)
(counter int32 :offset-assert 400)
(target-count int32 :offset-assert 404)
(sound-id uint32 :offset-assert 408)
(sound-id sound-id :offset-assert 408)
)
:heap-base #x130
:method-count-assert 29
@ -118,3 +118,7 @@
;; failed to figure out what this is:
(let ((v0-6 0))
)

View file

@ -152,7 +152,7 @@
(:methods
(new (symbol type int) _type_ 0)
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-10 (_type_ process symbol symbol float int) none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
@ -220,3 +220,7 @@
;; failed to figure out what this is:
(let ((v0-7 0))
)

View file

@ -251,7 +251,7 @@
(y int32 :offset 4)
(z int32 :offset 8)
)
:method-count-assert 9
:allow-misaligned :method-count-assert 9
:size-assert #xc
:flag-assert #x90000000c
)
@ -259,10 +259,10 @@
;; definition for method 3 of type vector3w
(defmethod inspect vector3w ((obj vector3w))
(format #t "[~8x] ~A~%" obj 'vector3w)
(format #t "~Tdata[3] @ #x~X~%" (-> obj data))
(format #t "~Tx: ~D~%" (-> obj data 0))
(format #t "~Ty: ~D~%" (-> obj data 1))
(format #t "~Tz: ~D~%" (-> obj data 2))
(format #t "~Tdata[3] @ #x~X~%" (&-> obj x))
(format #t "~Tx: ~D~%" (-> obj x))
(format #t "~Ty: ~D~%" (-> obj y))
(format #t "~Tz: ~D~%" (-> obj z))
obj
)
@ -963,3 +963,7 @@
;; definition for symbol *zero-vector*, type vector
(define *zero-vector* (new 'static 'vector))

View file

@ -22,7 +22,9 @@
;; definition of type sound-name
(deftype sound-name (uint128)
()
((lo uint64 :offset 0 :size 64)
(hi uint64 :offset 64 :size 64)
)
:method-count-assert 9
:size-assert #x10
:flag-assert #x900000010
@ -31,7 +33,7 @@
;; definition of type sound-rpc-cmd
(deftype sound-rpc-cmd (structure)
((rsvd1 uint16 :offset-assert 0)
(command uint16 :offset-assert 2)
(command sound-command :offset-assert 2)
)
:method-count-assert 9
:size-assert #x4
@ -56,7 +58,7 @@
(fo-curve int8 :offset-assert 10)
(priority int8 :offset-assert 11)
(volume int32 :offset-assert 12)
(trans float 3 :offset-assert 16)
(trans vector3w :inline :offset-assert 16)
(group uint8 :offset-assert 28)
)
:pack-me
@ -83,7 +85,7 @@
;; definition of type sound-rpc-bank-cmd
(deftype sound-rpc-bank-cmd (sound-rpc-cmd)
((bank-name uint128 :offset-assert 16)
((bank-name sound-name :offset-assert 16)
)
:method-count-assert 9
:size-assert #x20
@ -102,7 +104,7 @@
;; definition of type sound-rpc-sound-cmd
(deftype sound-rpc-sound-cmd (sound-rpc-cmd)
((id uint32 :offset-assert 4)
((id sound-id :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
@ -192,7 +194,7 @@
;; definition of type sound-rpc-play
(deftype sound-rpc-play (sound-rpc-sound-cmd)
((name uint128 :offset-assert 16)
((name sound-name :offset-assert 16)
(parms sound-play-parms :inline :offset-assert 32)
)
:method-count-assert 9
@ -363,7 +365,7 @@
(deftype sound-rpc-get-irx-version (sound-rpc-cmd)
((major uint32 :offset-assert 4)
(minor uint32 :offset-assert 8)
(ee-addr uint32 :offset-assert 12)
(ee-addr pointer :offset-assert 12)
)
:method-count-assert 9
:size-assert #x10
@ -426,7 +428,7 @@
;; definition of type sound-rpc-set-sound-falloff
(deftype sound-rpc-set-sound-falloff (sound-rpc-cmd)
((name uint128 :offset-assert 16)
((name sound-name :offset-assert 16)
(curve int32 :offset-assert 32)
(min int32 :offset-assert 36)
(max int32 :offset-assert 40)
@ -494,8 +496,8 @@
;; definition of type sound-rpc-set-ear-trans
(deftype sound-rpc-set-ear-trans (sound-rpc-cmd)
((ear-trans float 3 :offset-assert 4)
(cam-trans float 3 :offset-assert 16)
((ear-trans vector3w :inline :offset-assert 4)
(cam-trans vector3w :inline :offset-assert 16)
(cam-angle int32 :offset-assert 28)
)
:method-count-assert 9
@ -682,7 +684,7 @@
(num float :offset-assert 8)
(group uint8 :offset-assert 12)
(sound-name-char uint8 16 :offset 16)
(sound-name uint128 :offset 16)
(sound-name sound-name :offset 16)
(trans float 4 :offset-assert 32)
(volume int32 :offset-assert 48)
(pitch-mod int32 :offset-assert 52)
@ -726,10 +728,10 @@
;; definition of type ambient-sound
(deftype ambient-sound (basic)
((spec basic :offset-assert 4)
(playing-id uint32 :offset-assert 8)
((spec sound-spec :offset-assert 4)
(playing-id sound-id :offset-assert 8)
(trans vector :inline :offset-assert 16)
(name uint128 :offset-assert 32)
(name sound-name :offset-assert 32)
(play-time uint64 :offset-assert 48)
(time-base uint64 :offset-assert 56)
(time-random uint64 :offset-assert 64)
@ -738,20 +740,21 @@
(falloff-near int32 :offset-assert 80)
(falloff-far int32 :offset-assert 84)
(falloff-mode int32 :offset-assert 88)
(params uint32 :offset-assert 92)
(params sound-play-parms :offset-assert 92)
(param-count int32 :offset-assert 96)
(entity basic :offset-assert 100)
(entity entity :offset-assert 100)
(sound-count int32 :offset-assert 104)
)
:method-count-assert 14
:size-assert #x6c
:flag-assert #xe0000006c
(:methods
(dummy-9 () none 9)
(dummy-10 () none 10)
(dummy-11 () none 11)
(dummy-12 () none 12)
(dummy-13 () none 13)
(new (symbol type basic vector) _type_ 0)
(dummy-9 (_type_) int 9)
(dummy-10 (_type_ sound-name) int 10)
(dummy-11 (_type_ vector) int 11)
(dummy-12 (_type_ int) int 12)
(stop! (_type_) int 13)
)
)
@ -787,3 +790,7 @@
;; failed to figure out what this is:
(let ((v0-65 0))
)