mirror of
https://github.com/open-goal/jak-project
synced 2026-08-10 19:17:55 -04:00
13def9a8b2
Small fix to decompiler when the original compiler uses `ra` register. This seems to happen in "normal" code very rarely - perhaps they manually specified this in an `rlet`. Start figuring out buckets/textures for Jak 3. The foreground code is not yet modified for PC - I want to wait until the game is running, since it is too hard to do it now.
605 lines
20 KiB
Common Lisp
Vendored
Generated
605 lines
20 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for function can-display-query?
|
|
(defun can-display-query? ((arg0 process) (arg1 string) (arg2 float))
|
|
(let ((a1-2 (gui-control-method-12
|
|
*gui-control*
|
|
arg0
|
|
(gui-channel query)
|
|
(gui-action play)
|
|
(if arg1
|
|
arg1
|
|
(symbol->string (-> arg0 type symbol))
|
|
)
|
|
0
|
|
arg2
|
|
(new 'static 'sound-id)
|
|
)
|
|
)
|
|
)
|
|
(= (get-status *gui-control* a1-2) (gui-status active))
|
|
)
|
|
)
|
|
|
|
;; definition for function talker-surpress!
|
|
(defun talker-surpress! ()
|
|
(set! (-> *game-info* hint-play-time) (-> *display* base-clock frame-counter))
|
|
0
|
|
)
|
|
|
|
;; definition for function talker-displayed?
|
|
(defun talker-displayed? ()
|
|
(if (-> *setting-control* user-current hint)
|
|
#t
|
|
#f
|
|
)
|
|
)
|
|
|
|
;; definition for function kill-current-talker
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defun kill-current-talker ((arg0 pair) (arg1 pair) (arg2 symbol))
|
|
(if (not (member 'daxter arg1))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action stop)
|
|
(the-as sound-id 1)
|
|
(gui-channel daxter)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(if (not (member 'pecker arg1))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action stop)
|
|
(the-as sound-id 1)
|
|
(gui-channel pecker)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(if (not (member 'voicebox arg1))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action stop)
|
|
(the-as sound-id 1)
|
|
(gui-channel voicebox)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(if (not (member 'message arg1))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action stop)
|
|
(the-as sound-id 1)
|
|
(gui-channel message)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(when (not (member 'notice arg1))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action stop)
|
|
(the-as sound-id 1)
|
|
(gui-channel notice)
|
|
(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 notice-low)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function string->talker-speech
|
|
(defun string->talker-speech ((arg0 string))
|
|
(dotimes (s5-0 365)
|
|
(let ((s4-0 (-> *talker-speech* s5-0)))
|
|
(if (string= arg0 (-> s4-0 name))
|
|
(return s4-0)
|
|
)
|
|
)
|
|
)
|
|
(-> *talker-speech* 0)
|
|
)
|
|
|
|
;; definition for method 9 of type talker-speech-class
|
|
(defmethod talker-speech-class-method-9 ((this talker-speech-class))
|
|
(and (>= (-> *game-info* unknown-arr4 (* (-> this speech) 2)) (-> this pos))
|
|
(>= (-> this neg) (-> *game-info* unknown-arr4 (+ (* (-> this speech) 2) 1)))
|
|
)
|
|
)
|
|
|
|
;; definition for method 10 of type talker-speech-class
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod play-communicator-speech! ((this talker-speech-class))
|
|
(set! (-> *game-info* unknown-arr4 (+ (* (-> this speech) 2) 1)) (the-as uint #xffff))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 11 of type talker-speech-class
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod talker-speech-class-method-11 ((this talker-speech-class))
|
|
(set! (-> *game-info* unknown-arr4 (+ (* (-> this speech) 2) 1)) (the-as uint 0))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 12 of type talker-speech-class
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod talker-speech-class-method-12 ((this talker-speech-class) (arg0 int))
|
|
(if (>= arg0 0)
|
|
(set! (-> *game-info* unknown-arr4 (* (-> this speech) 2))
|
|
(the-as uint (seekl (the-as int (-> *game-info* unknown-arr4 (* (-> this speech) 2))) #xfff0 arg0))
|
|
)
|
|
(set! (-> *game-info* unknown-arr4 (* (-> this speech) 2))
|
|
(the-as uint (seekl (the-as int (-> *game-info* unknown-arr4 (* (-> this speech) 2))) 0 (- arg0)))
|
|
)
|
|
)
|
|
(if (talker-speech-class-method-9 this)
|
|
(talker-spawn-func this *entity-pool* (target-pos 0) (the-as region #f))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 13 of type talker-speech-class
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod talker-speech-class-method-13 ((this talker-speech-class) (arg0 int))
|
|
(if (>= arg0 0)
|
|
(set! (-> *game-info* unknown-arr4 (+ (* (-> this speech) 2) 1))
|
|
(the-as uint (seekl (the-as int (-> *game-info* unknown-arr4 (+ (* (-> this speech) 2) 1))) #xfff0 arg0))
|
|
)
|
|
(set! (-> *game-info* unknown-arr4 (+ (* (-> this speech) 2) 1))
|
|
(the-as uint (seekl (the-as int (-> *game-info* unknown-arr4 (+ (* (-> this speech) 2) 1))) 0 (- arg0)))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function talker-spawn-func
|
|
;; WARN: Return type mismatch int vs sound-id.
|
|
(defun talker-spawn-func ((arg0 talker-speech-class) (arg1 process-tree) (arg2 vector) (arg3 region))
|
|
(local-vars (s2-0 int))
|
|
(when (or (not arg0) (zero? (-> arg0 speech)) (not (talker-speech-class-method-9 arg0)))
|
|
(set! s2-0 0)
|
|
(goto cfg-27)
|
|
)
|
|
(if (and (or (not (-> *setting-control* user-current play-hints))
|
|
(= (-> *setting-control* user-current dialog-volume) 0.0)
|
|
)
|
|
(logtest? (-> arg0 flags) (talker-flags tf0))
|
|
)
|
|
(play-communicator-speech! arg0)
|
|
)
|
|
(set! s2-0
|
|
(the-as int (lookup-gui-connection-id *gui-control* (-> arg0 name) (-> arg0 channel) (gui-action none)))
|
|
)
|
|
(set! s2-0 (cond
|
|
((zero? (the-as sound-id s2-0))
|
|
(let ((v1-17 (process-spawn talker :init talker-init arg0 arg2 arg3 :name "talker" :to arg1)))
|
|
(cond
|
|
(v1-17
|
|
(if (nonzero? (-> (the-as talker (-> v1-17 0)) voice-id))
|
|
(the-as int (-> (the-as talker (-> v1-17 0)) voice-id))
|
|
(the-as int (-> (the-as talker (-> v1-17 0)) message-id))
|
|
)
|
|
)
|
|
(else
|
|
(empty)
|
|
s2-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(empty)
|
|
s2-0
|
|
)
|
|
)
|
|
)
|
|
(label cfg-27)
|
|
(the-as sound-id s2-0)
|
|
)
|
|
|
|
;; definition for function talker-init
|
|
;; INFO: Used lq/sq
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defbehavior talker-init talker ((arg0 talker-speech-class) (arg1 vector) (arg2 region))
|
|
(set! (-> self trans quad) (-> arg1 quad))
|
|
(let ((v1-2 (shr (the-as int (-> arg0 channel)) 4)))
|
|
(when (not (or (or (= v1-2 4) (= v1-2 5))
|
|
(or (not (-> *setting-control* user-current play-hints))
|
|
(= (-> *setting-control* user-current dialog-volume) 0.0)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> self voice-id)
|
|
(add-process *gui-control* self (-> arg0 channel) (gui-action queue) (-> arg0 name) 81920.0 0)
|
|
)
|
|
(sound-params-set!
|
|
*gui-control*
|
|
(-> self voice-id)
|
|
#f
|
|
-1
|
|
-1
|
|
-1
|
|
(-> *setting-control* user-current talker-volume)
|
|
)
|
|
)
|
|
)
|
|
(when (nonzero? (-> arg0 text-message))
|
|
(let* ((a0-7 *gui-control*)
|
|
(t9-2 (method-of-object a0-7 add-process))
|
|
(a1-4 self)
|
|
(v1-18 (shr (the-as int (-> arg0 channel)) 4))
|
|
)
|
|
(set! (-> self message-id) (t9-2
|
|
a0-7
|
|
a1-4
|
|
(if (or (= v1-18 4) (= v1-18 5))
|
|
(the-as gui-channel (the-as int (-> arg0 channel)))
|
|
(gui-channel message)
|
|
)
|
|
(gui-action play)
|
|
(-> arg0 name)
|
|
81920.0
|
|
0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> self message) arg0)
|
|
(set! (-> self region) arg2)
|
|
(set! (-> self total-time) 0)
|
|
(set! (-> self total-off-time) 0)
|
|
(set-time! (-> self start-time))
|
|
(set! (-> self voicebox) (the-as handle #f))
|
|
(set! (-> self save?) #f)
|
|
(set! (-> self grab?) #f)
|
|
(if (logtest? (-> self message flags) (talker-flags tf5 tf6))
|
|
(set! (-> self interp) 0.0)
|
|
(set! (-> self interp) 1.0)
|
|
)
|
|
(go-virtual idle)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 10 of type talker
|
|
(defmethod deactivate ((this talker))
|
|
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
|
|
(send-event (handle->process (-> this voicebox)) 'die)
|
|
(call-parent-method this)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 17 of type talker
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod talker-method-17 ((this talker))
|
|
(let ((gp-0
|
|
(new 'stack 'font-context *font-default-matrix* 36 310 0.0 (font-color default) (font-flags shadow kerning))
|
|
)
|
|
)
|
|
(let ((f0-0 320.0))
|
|
(let ((v1-2 gp-0))
|
|
(set! (-> v1-2 scale) 0.75)
|
|
)
|
|
(case (-> this message channel)
|
|
(((gui-channel notice))
|
|
(cond
|
|
((logtest? (-> this message flags) (talker-flags tf7))
|
|
(let ((v1-9 gp-0)
|
|
(a1-1 36)
|
|
(a0-4 140)
|
|
)
|
|
(set! (-> v1-9 origin x) (the float a1-1))
|
|
(set! (-> v1-9 origin y) (the float a0-4))
|
|
)
|
|
)
|
|
(else
|
|
(let ((v1-10 gp-0))
|
|
(set! (-> v1-10 scale) 0.6)
|
|
)
|
|
(let ((v1-11 gp-0)
|
|
(a1-2 36)
|
|
(a0-6 160)
|
|
)
|
|
(set! (-> v1-11 origin x) (the float a1-2))
|
|
(set! (-> v1-11 origin y) (the float a0-6))
|
|
)
|
|
)
|
|
)
|
|
(set! f0-0 160.0)
|
|
)
|
|
)
|
|
(let ((v1-14 gp-0))
|
|
(set! (-> v1-14 width) (the float 440))
|
|
)
|
|
(let ((v1-15 gp-0))
|
|
(set! (-> v1-15 height) (the float 140))
|
|
)
|
|
(set! (-> gp-0 flags) (font-flags shadow kerning middle large))
|
|
(if (logtest? (-> this message flags) (talker-flags tf5))
|
|
(set! (-> gp-0 alpha) (-> this interp))
|
|
(set! (-> gp-0 alpha) 1.0)
|
|
)
|
|
(when (logtest? (-> this message flags) (talker-flags tf6))
|
|
(let ((s4-0 gp-0)
|
|
(s3-0 36)
|
|
(v1-27 (the int (lerp-scale 400.0 f0-0 (-> this interp) 0.0 1.0)))
|
|
)
|
|
(set! (-> s4-0 origin x) (the float s3-0))
|
|
(set! (-> s4-0 origin y) (the float v1-27))
|
|
)
|
|
)
|
|
)
|
|
(let ((f0-17 (print-game-text
|
|
(lookup-text! *common-text* (-> this message text-message) #f)
|
|
gp-0
|
|
#t
|
|
44
|
|
(bucket-id hud-draw-hud-alpha)
|
|
)
|
|
)
|
|
)
|
|
(when (< 98.0 f0-17)
|
|
(let ((v1-32 gp-0))
|
|
(set! (-> v1-32 scale) 0.6)
|
|
)
|
|
)
|
|
)
|
|
(let ((s4-2 print-game-text)
|
|
(a0-14 (lookup-text! *common-text* (-> this message text-message) #f))
|
|
(a2-5 #f)
|
|
(a3-3 44)
|
|
(v1-36 (-> this message channel))
|
|
)
|
|
(s4-2
|
|
a0-14
|
|
gp-0
|
|
a2-5
|
|
a3-3
|
|
(if (or (= v1-36 (gui-channel notice)) (= v1-36 (gui-channel notice-low)) (= v1-36 (gui-channel subtitle)))
|
|
(bucket-id hud-draw-pris2)
|
|
(bucket-id hud-draw-hud-alpha)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate idle (talker)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(let ((gp-0 (current-time)))
|
|
(until (time-elapsed? gp-0 (the-as time-frame (-> self message delay)))
|
|
(suspend)
|
|
)
|
|
)
|
|
(while (or (not (time-elapsed? (-> self start-time) (the-as time-frame (+ (-> self message delay) 300))))
|
|
(and (logtest? (-> self message flags) (talker-flags tf8))
|
|
(not (time-elapsed? (-> self start-time) (seconds 180)))
|
|
)
|
|
)
|
|
(when (and (or (zero? (-> self voice-id)) (= (get-status *gui-control* (-> self voice-id)) (gui-status ready)))
|
|
(or (zero? (-> self message-id)) (= (get-status *gui-control* (-> self message-id)) (gui-status active)))
|
|
)
|
|
(case (-> self message channel)
|
|
(((gui-channel voicebox))
|
|
(if (and (not (handle->process (-> self voicebox))) *target*)
|
|
(set! (-> self voicebox) (ppointer->handle (voicebox-spawn *target* (target-pos 0))))
|
|
)
|
|
)
|
|
)
|
|
(go-virtual active)
|
|
)
|
|
(suspend)
|
|
)
|
|
(go-virtual exit)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate active (talker)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(if (logtest? (-> self message flags) (talker-flags tf0))
|
|
(play-communicator-speech! (-> self message))
|
|
)
|
|
(set-setting! 'hint (process->ppointer self) 0.0 0)
|
|
(set-setting! 'speech-control #f 0.0 0)
|
|
(if (nonzero? (-> self voice-id))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action play)
|
|
(-> self voice-id)
|
|
(gui-channel none)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(when (and (nonzero? (-> self voice-id)) (logtest? (-> self message flags) (talker-flags tf1)))
|
|
(add-setting! 'music-volume 'rel 0.25 0)
|
|
(add-setting! 'sfx-volume 'rel 0.75 0)
|
|
(add-setting! 'dialog-volume 'rel (-> *setting-control* user-current dialog-volume-talker) 0)
|
|
)
|
|
(if (logtest? (-> self message flags) (talker-flags tf2))
|
|
(auto-save-user)
|
|
)
|
|
(apply-settings *setting-control*)
|
|
)
|
|
:exit (behavior ()
|
|
(if (and (-> self grab?) *target*)
|
|
(process-release? *target*)
|
|
)
|
|
(let ((gp-0 (-> self message on-close)))
|
|
(when gp-0
|
|
(let* ((s5-0 (handle->process (-> self voicebox)))
|
|
(v1-9 (if (type? s5-0 process-drawable)
|
|
s5-0
|
|
)
|
|
)
|
|
)
|
|
(script-eval gp-0 :vector (if v1-9
|
|
(-> (the-as process-drawable v1-9) root trans)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (and (logtest? (-> self message flags) (talker-flags tf3)) (not (-> self save?)))
|
|
(set! (-> self save?) #t)
|
|
(auto-save-user)
|
|
)
|
|
(if (nonzero? (-> self voice-id))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action stop)
|
|
(-> self voice-id)
|
|
(gui-channel none)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(if (nonzero? (-> self message-id))
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action stop)
|
|
(-> self message-id)
|
|
(gui-channel none)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(remove-setting! 'music-volume)
|
|
(remove-setting! 'sfx-volume)
|
|
(remove-setting! 'dialog-volume)
|
|
(remove-setting! 'hint)
|
|
(remove-setting! 'speech-control)
|
|
(remove-setting! 'camera-name)
|
|
(apply-settings *setting-control*)
|
|
)
|
|
:code (behavior ()
|
|
(local-vars (v1-50 symbol))
|
|
(let ((gp-0 #t))
|
|
(while (or (and (nonzero? (-> self voice-id))
|
|
(let ((v1-41 (get-status *gui-control* (-> self voice-id))))
|
|
(or (= v1-41 (gui-status ready)) (= v1-41 (gui-status active)))
|
|
)
|
|
(begin
|
|
(dotimes (s5-2 4)
|
|
(when (and (string-charp= (-> self message name) (the-as (pointer uint8) (-> *sound-iop-info* stream-name s5-2)))
|
|
(= (-> self voice-id) (-> *sound-iop-info* stream-id s5-2))
|
|
(logtest? (-> *sound-iop-info* stream-status s5-2) (stream-status ss6))
|
|
)
|
|
(set! v1-50 #f)
|
|
(goto cfg-47)
|
|
)
|
|
)
|
|
(set! v1-50 #t)
|
|
(label cfg-47)
|
|
(and v1-50 (not (time-elapsed? (-> self state-time) (seconds 120))))
|
|
)
|
|
)
|
|
(and (nonzero? (-> self message-id))
|
|
(= (get-status *gui-control* (-> self message-id)) (gui-status active))
|
|
(or (not (time-elapsed? (-> self state-time) (the-as time-frame (-> self message text-duration))))
|
|
(and (logtest? (-> self message flags) (talker-flags tf4))
|
|
(-> self region)
|
|
(point-in-region-debug! (-> self region) (target-pos 0))
|
|
)
|
|
)
|
|
)
|
|
(not (time-elapsed? (-> self state-time) (seconds 0.05)))
|
|
)
|
|
(when (and (nonzero? (-> self voice-id)) (not gp-0) (zero? (get-status *gui-control* (-> self voice-id))))
|
|
(remove-setting! 'music-volume)
|
|
(remove-setting! 'sfx-volume)
|
|
(remove-setting! 'dialog-volume)
|
|
(set! gp-0 #t)
|
|
)
|
|
(when (and (-> self message camera) (not (-> self grab?)) *target*)
|
|
(when (process-grab? *target* #f)
|
|
(set! (-> self grab?) #t)
|
|
(set-setting! 'entity-name (-> self message camera) 0.0 0)
|
|
)
|
|
)
|
|
(when (and (nonzero? (-> self message-id))
|
|
(= (get-status *gui-control* (-> self message-id)) (gui-status active))
|
|
(not (paused?))
|
|
)
|
|
(if (logtest? (-> self message flags) (talker-flags tf5))
|
|
(seek! (-> self interp) 1.0 (* 0.5 (seconds-per-frame)))
|
|
(seek! (-> self interp) 1.0 (* 4.0 (seconds-per-frame)))
|
|
)
|
|
(talker-method-17 self)
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
(when (and (nonzero? (-> self message-id)) (logtest? (-> self message flags) (talker-flags tf5 tf6)))
|
|
(while (!= (-> self interp) 0.0)
|
|
(if (logtest? (-> self message flags) (talker-flags tf5))
|
|
(seek! (-> self interp) 0.0 (* 0.5 (seconds-per-frame)))
|
|
(seek! (-> self interp) 0.0 (* 4.0 (seconds-per-frame)))
|
|
)
|
|
(if (and (= (get-status *gui-control* (-> self message-id)) (gui-status active)) (not (paused?)))
|
|
(talker-method-17 self)
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
(when (and (logtest? (-> self message flags) (talker-flags tf3)) (not (-> self save?)))
|
|
(let ((gp-1 (current-time)))
|
|
(until (time-elapsed? gp-1 (seconds 1))
|
|
(suspend)
|
|
)
|
|
)
|
|
(set! (-> self save?) #t)
|
|
(auto-save-user)
|
|
)
|
|
(go-virtual exit)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate exit (talker)
|
|
:virtual #t
|
|
:code nothing
|
|
)
|