Files
jak-project/goal_src/jak2/engine/sound/speech.gc
T
water111 637990314b wip: better stack var support (#4222)
Closes #736

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2026-04-19 00:14:44 +02:00

488 lines
21 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: speech.gc
;; name in dgo: speech
;; dgos: ENGINE, GAME
;; DECOMP BEGINS
(defmethod speech-channel-method-12 ((this speech-channel))
(set! (-> this request handle) (the-as handle #f))
(set! (-> this request priority) -10000000000000000000000000000000000000.0)
0
(none)
)
(defmethod speech-channel-method-13 ((this speech-channel))
(set! (-> this id) (new 'static 'sound-id))
(set! (-> this last-request handle) (the-as handle #f))
(set! (-> this last-request priority) -10000000000000000000000000000000000000.0)
0
(none)
)
(defmethod speech-channel-method-11 ((this speech-channel))
(local-vars (v1-44 int))
(with-pp
(logclear! (-> this flags) (speech-channel-flag disable))
(if (or (not (-> *setting-control* user-current speech-control))
(load-in-progress? *level*)
(nonzero? (-> this id))
)
(logior! (-> this flags) (speech-channel-flag disable))
)
(set! (-> this target-pos quad) (-> (target-pos 0) quad))
(when (not (logtest? (-> this flags) (speech-channel-flag disable)))
(let ((s5-1 (-> this speech-table (-> this request speech-type))))
(cond
(s5-1
(let ((a0-8 (- (-> this update-time) (-> this request time)))
(v1-20 (handle->process (-> this request handle)))
)
(if (or (< (the-as time-frame (-> s5-1 request-timeout)) a0-8)
(or (not v1-20)
(< (square 245760.0)
(vector-vector-distance-squared (-> this target-pos) (-> (the-as process-drawable v1-20) root trans))
)
)
)
(speech-channel-method-12 this)
)
)
(let ((s4-0 (handle->process (-> this request handle))))
(when s4-0
(when (or (and (>= (-> this request priority) 0.0)
(time-elapsed? (-> this end-time) (the-as time-frame (-> s5-1 delay)))
)
(and (time-elapsed? (-> this end-time) (the-as time-frame (-> s5-1 delay)))
(time-elapsed? (-> this end-time) (the-as time-frame (-> this delay)))
)
)
(let ((s3-0 (-> s5-1 list length))
(v1-43 (-> s5-1 play-index))
)
(when (> s3-0 0)
(cond
((logtest? (-> s5-1 flags) (speech-type-flag random-order))
(set! v1-44 (rand-vu-int-count s3-0))
(when (= v1-44 (-> s5-1 play-index))
(+! v1-44 1)
(if (>= v1-44 s3-0)
(set! v1-44 0)
)
)
)
(else
(set! v1-44 (+ v1-43 1))
(if (>= v1-44 s3-0)
(set! v1-44 0)
)
)
)
(set! (-> s5-1 play-index) v1-44)
(let ((s3-1 (-> s5-1 list v1-44)))
(mem-copy! (the-as pointer (-> this last-request)) (the-as pointer (-> this request)) 21)
(set-time! (-> this start-time))
(set! (-> this delay)
(the-as uint (rand-vu-int-range (the-as int (-> s5-1 min-delay)) (the-as int (-> s5-1 max-delay))))
)
(set! (-> s5-1 delay) (-> this delay))
(set! (-> this id) (add-process *gui-control* s4-0 (-> this gui-channel) (gui-action play) s3-1 -99.0 0))
)
(speech-channel-method-12 this)
(logior! (-> this flags) (speech-channel-flag disable))
)
)
)
)
)
)
(else
(speech-channel-method-12 this)
)
)
)
)
(set-time! (-> this update-time))
(when (nonzero? (-> this id))
(let ((s4-1 (handle->process (-> this last-request handle))))
(cond
((and s4-1 (-> *setting-control* user-current speech-control))
(when *sound-player-enable*
(let ((s5-2 (the-as sound-rpc-set-param (get-sound-buffer-entry))))
(set! (-> s5-2 command) (sound-command set-param))
(set! (-> s5-2 id) (-> this id))
(set! (-> s5-2 params fo-min) 15)
(set! (-> s5-2 params fo-max) 90)
(set! (-> s5-2 params fo-curve) 9)
(let ((a1-12 (-> (the-as process-drawable s4-1) root trans)))
(let ((s4-2 pp))
(when (= a1-12 #t)
(if (and s4-2 (type? s4-2 process-drawable) (nonzero? (-> (the-as process-drawable s4-2) root)))
(set! a1-12 (-> (the-as process-drawable s4-2) root trans))
(set! a1-12 (the-as vector #f))
)
)
)
(sound-trans-convert (the-as vector3w (-> s5-2 params trans)) a1-12)
)
(set! (-> s5-2 params mask) (the-as uint 480))
(-> s5-2 id)
)
)
)
(else
(set-action!
*gui-control*
(gui-action stop)
(-> this id)
(gui-channel none)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
(set! (-> this id) (new 'static 'sound-id))
0
)
)
)
(case (get-status *gui-control* (-> this id))
(((gui-status pending))
(when (time-elapsed? (-> this start-time) (seconds 1))
(set-action!
*gui-control*
(gui-action stop)
(-> this id)
(gui-channel none)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
(set! (-> this id) (new 'static 'sound-id))
(set! (-> this end-time) (-> this update-time))
)
)
(((gui-status unknown))
(set! (-> this id) (new 'static 'sound-id))
(set! (-> this last-request handle) (the-as handle #f))
(set! (-> this end-time) (-> this update-time))
)
)
)
0
(none)
)
)
(defmethod speech-channel-method-9 ((this speech-channel) (arg0 process-drawable) (arg1 speech-type))
(let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> this target-pos))))
(when (< f0-0 (square 245760.0))
(let ((f0-2 (+ (* f0-0 (/ -1.0 (square 409600.0))) (the float (-> this speech-table arg1 priority)))))
(when (< (-> this request priority) f0-2)
(set! (-> this request priority) f0-2)
(set! (-> this request handle) (process->handle arg0))
(set! (-> this request speech-type) arg1)
(set-time! (-> this request time))
)
)
)
)
0
(none)
)
(defmethod speech-channel-method-10 ((this speech-channel) (arg0 handle))
(when (= arg0 (handle->process (-> this last-request handle)))
(set-action!
*gui-control*
(gui-action stop)
(-> this id)
(gui-channel none)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
(set! (-> this id) (new 'static 'sound-id))
(set! (-> this last-request handle) (the-as handle #f))
)
0
(none)
)
(defmethod speech-control-method-12 ((this speech-control) (arg0 process-drawable) (arg1 speech-type))
(let ((v1-2 (-> this speech-table arg1)))
(when v1-2
(let ((a0-1 (-> this channel-array (-> v1-2 channel))))
(if (not (logtest? (-> a0-1 flags) (speech-channel-flag disable)))
(speech-channel-method-9 a0-1 arg0 arg1)
)
)
)
)
0
(none)
)
(defmethod speech-control-method-11 ((this speech-control))
(dotimes (s5-0 2)
(speech-channel-method-11 (-> this channel-array s5-0))
)
0
(none)
)
(defmethod speech-table-set! ((this speech-control) (arg0 speech-type) (arg1 speech-type-info))
(set! (-> this speech-table arg0) arg1)
0
(none)
)
(defmethod speech-control-method-13 ((this speech-control) (arg0 handle))
(dotimes (s4-0 2)
(speech-channel-method-10 (-> this channel-array s4-0) arg0)
)
0
(none)
)
(defmethod speech-control-method-14 ((this speech-control))
(speech-control-method-9 this)
(let ((s5-0 (-> this channel-array)))
((method-of-type speech-channel speech-channel-method-13) (-> s5-0 0))
(set! (-> s5-0 0 speech-table) (-> this speech-table))
(set! (-> s5-0 0 gui-channel) (gui-channel guard))
)
(let ((s5-1 (-> this channel-array 1)))
(speech-channel-method-13 s5-1)
(set! (-> s5-1 speech-table) (-> this speech-table))
(set! (-> s5-1 gui-channel) (gui-channel citizen))
)
0
(none)
)
(defmethod speech-control-method-15 ((this speech-control) (arg0 process-drawable))
(when (not (logtest? (-> this channel-array 0 flags) (speech-channel-flag disable)))
(let ((v1-3 *target*))
(when v1-3
(cond
((focus-test? v1-3 dark)
(speech-control-method-12 this arg0 (speech-type speech-type-8))
)
((focus-test? v1-3 pilot)
(speech-control-method-12 this arg0 (speech-type speech-type-7))
)
(else
(speech-control-method-12 this arg0 (speech-type speech-type-6))
)
)
)
)
)
0
(none)
)
(defmethod speech-control-method-16 ((this speech-control))
(set-action!
*gui-control*
(gui-action stop)
(the-as sound-id 1)
(gui-channel guard)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
(set-action!
*gui-control*
(gui-action stop)
(the-as sound-id 1)
(gui-channel citizen)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
(dotimes (s5-0 2)
(speech-channel-method-12 (-> this channel-array s5-0))
)
0
(none)
)
(defmethod speech-control-method-9 ((this speech-control))
(dotimes (v1-0 57)
(set! (-> this speech-table v1-0) #f)
)
(dotimes (s5-0 2)
(speech-channel-method-12 (-> this channel-array s5-0))
)
(speech-table-set! this (speech-type speech-type-0) (new 'static 'speech-type-info
:priority 3
:request-timeout #x12c
:min-delay (seconds 1)
:max-delay (seconds 1)
:list (new 'static 'boxed-array :type string)
)
)
(speech-table-set! this (speech-type speech-type-3) (new 'static 'speech-type-info
:priority 3
:request-timeout #x12c
:min-delay (seconds 1)
:max-delay (seconds 1)
:list (new 'static 'boxed-array :type string
"kg136"
"kg139"
"kg140"
"kg141"
"kg142"
"kg134"
"kg157"
"kg143"
"kg156"
"kg176"
"kg177"
"kg536"
"kg551"
)
)
)
(speech-table-set! this (speech-type speech-type-9) (new 'static 'speech-type-info
:priority 1
:min-delay (seconds 2)
:max-delay (seconds 4)
:list (new 'static 'boxed-array :type string
"kg133"
"kg135"
"kg137"
"kg138"
"kg144"
"kg145"
"kg146"
"kg147"
"kg148"
"kg149"
"kg150"
"kg151"
"kg152"
"kg153"
"kg154"
"kg155"
"kg158"
"kg159"
"kg160"
"kg163"
"kg164"
"kg507"
"kg508"
"kg509"
"kg511"
"kg513"
"kg514"
"kg515"
"kg516"
"kg517"
"kg518"
"kg520"
"kg521"
"kg523"
"kg526"
"kg527"
"kg528"
"kg529"
"kg530"
"kg532"
"kg534"
"kg535"
"kg537"
"kg538"
"kg539"
"kg540"
"kg541"
"kg542"
"kg543"
"kg544"
"kg545"
"kg546"
"kg549"
"kg550"
)
)
)
(speech-table-set! this (speech-type speech-type-10) (new 'static 'speech-type-info
:flags (speech-type-flag random-order)
:priority 10
:request-timeout #x258
:min-delay (seconds 2)
:max-delay (seconds 4)
:list (new 'static 'boxed-array :type string
"kg165"
"kg165a"
"kg165b"
"kg166"
"kg166a"
"kg166b"
"kg167"
"kg167a"
"kg167b"
"kg168"
"kg168a"
"kg168b"
"kg169"
"kg169a"
"kg169b"
"kg170"
"kg170a"
"kg170b"
"kg171"
"kg171a"
"kg171b"
"kg172"
"kg172a"
"kg172b"
"kg173"
"kg173a"
"kg173b"
"kg174"
"kg174a"
"kg174b"
"kg175"
"kg175a"
"kg175b"
"kg510"
)
)
)
(speech-table-set! this (speech-type speech-type-11) (new 'static 'speech-type-info
:priority 2
:min-delay (seconds 0.1)
:max-delay (seconds 0.1)
:list (new 'static 'boxed-array :type string
"kg386a"
"kg428a"
"kg641"
"kg650"
"kg338a"
"kg339a"
"kg340a"
"kg341a"
"kg342a"
"kg343a"
"kg344a"
"kg512"
)
)
)
0
(none)
)
(define *speech-control* (new 'static 'speech-control))
(speech-control-method-14 *speech-control*)