mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
0ce5835818
Updates the decompiler for the new format and there's new macros. This new format should be easier to read/parse. Also rewrote `sp-init-fields!` (both jak 1 and 2) from assembly to GOAL. Hopefully I did not miss any regressions in Jak 1/2 while updating the files, it's a lot.
386 lines
12 KiB
Common Lisp
386 lines
12 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: assistant.gc
|
|
;; name in dgo: assistant
|
|
;; dgos: L1, VI1
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(import "goal_src/jak1/import/assistant-ag.gc")
|
|
|
|
(deftype assistant (process-taskable)
|
|
((sound-id sound-id :offset-assert 380)
|
|
)
|
|
:heap-base #x110
|
|
:method-count-assert 53
|
|
:size-assert #x180
|
|
:flag-assert #x3501100180
|
|
)
|
|
|
|
|
|
(defskelgroup *assistant-sg* assistant assistant-lod0-jg assistant-idle-leaning-right-ja
|
|
((assistant-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 2)
|
|
:shadow assistant-shadow-mg
|
|
)
|
|
|
|
(defmethod process-taskable-method-52 assistant ((obj assistant))
|
|
(let ((v1-1 (-> obj draw shadow-ctrl)))
|
|
(when v1-1
|
|
(let ((f0-0 (-> obj root-override trans y)))
|
|
(let ((a0-2 v1-1))
|
|
(set! (-> a0-2 settings bot-plane w) (- (+ -4096.0 f0-0)))
|
|
)
|
|
0
|
|
(let ((a0-4 v1-1))
|
|
(set! (-> a0-4 settings top-plane w) (- (+ 4096.0 f0-0)))
|
|
)
|
|
)
|
|
0
|
|
(logclear! (-> v1-1 settings flags) (shadow-flags shdf03))
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod draw-npc-shadow assistant ((obj assistant))
|
|
(-> obj draw shadow-ctrl)
|
|
(cond
|
|
((and (-> obj draw shadow)
|
|
(zero? (-> obj draw cur-lod))
|
|
(logtest? (-> obj draw status) (draw-status was-drawn))
|
|
)
|
|
(let ((v1-9 (-> obj draw shadow-ctrl)))
|
|
(logclear! (-> v1-9 settings flags) (shadow-flags disable-draw))
|
|
)
|
|
0
|
|
(update-direction-from-time-of-day (-> obj draw shadow-ctrl))
|
|
)
|
|
(else
|
|
(let ((v1-14 (-> obj draw shadow-ctrl)))
|
|
(logior! (-> v1-14 settings flags) (shadow-flags disable-draw))
|
|
)
|
|
0
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod play-anim! assistant ((obj assistant) (arg0 symbol))
|
|
(case (current-status (-> obj tasks))
|
|
(((task-status need-hint) (task-status need-introduction))
|
|
(case (current-task (-> obj tasks))
|
|
(((game-task jungle-eggtop))
|
|
(when arg0
|
|
(let* ((s5-1 (-> obj tasks))
|
|
(s4-0 (method-of-object s5-1 save-reminder))
|
|
)
|
|
(s4-0 s5-1 (the int (the-as float (send-event *target* 'query 'pickup (pickup-type fuel-cell)))) 1)
|
|
)
|
|
(close-status! (-> obj tasks) (task-status need-introduction))
|
|
)
|
|
(new 'static 'spool-anim
|
|
:name "assistant-introduction-blue-eco-switch"
|
|
:index 10
|
|
:parts 11
|
|
:command-list '((0 want-levels village1 beach)
|
|
(128 joint "cameraB")
|
|
(312 joint "camera")
|
|
(492 joint "cameraB")
|
|
(537 joint "camera")
|
|
(734 display-level beach movie)
|
|
(734 want-force-vis beach #t)
|
|
(735 alive "ecovent-48")
|
|
(742 blackout 10)
|
|
(743 joint "cameraB")
|
|
(745 blackout 0)
|
|
(839 alive "ecovent-200")
|
|
(841 joint "camera")
|
|
(842 dead "ecovent-48")
|
|
(942 blackout 10)
|
|
(944 joint "cameraB")
|
|
(945 blackout 0)
|
|
(945 dead "ecovent-200")
|
|
(945 display-level beach #f)
|
|
(1049 blackout 10)
|
|
(1051 joint "camera")
|
|
(1052 blackout 0)
|
|
(1135 blackout 10)
|
|
(1137 joint "cameraB")
|
|
(1138 blackout 0)
|
|
(1216 joint "camera")
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(if arg0
|
|
(close-status! (-> obj tasks) (task-status need-introduction))
|
|
)
|
|
(new 'static 'spool-anim
|
|
:name "assistant-introduction-race-bike"
|
|
:index 12
|
|
:parts 6
|
|
:command-list '((0 want-levels village1 beach) (129 joint "cameraB") (319 joint "camera") (505 joint "cameraB"))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(((task-status need-reminder) (task-status need-reminder-a))
|
|
(set! (-> obj skippable) #t)
|
|
(cond
|
|
((= (current-task (-> obj tasks)) (game-task none))
|
|
(new 'static 'spool-anim :name "assistant-reminder-1-generic" :index 14 :parts 2 :command-list '())
|
|
)
|
|
((closed? (-> obj tasks) (game-task jungle-eggtop) (task-status need-resolution))
|
|
(new 'static 'spool-anim :name "assistant-reminder-1-race-bike" :index 13 :parts 3 :command-list '())
|
|
)
|
|
((or (closed? (-> obj tasks) (game-task misty-bike) (task-status need-resolution))
|
|
(not (closed? (-> obj tasks) (game-task misty-bike) (task-status need-introduction)))
|
|
)
|
|
(new 'static 'spool-anim :name "assistant-reminder-1-blue-eco-switch" :index 11 :parts 3 :command-list '())
|
|
)
|
|
((zero? (get-reminder (-> obj tasks) 2))
|
|
(if arg0
|
|
(save-reminder (-> obj tasks) 1 2)
|
|
)
|
|
(new 'static 'spool-anim :name "assistant-reminder-1-race-bike" :index 13 :parts 3 :command-list '())
|
|
)
|
|
(else
|
|
(if arg0
|
|
(save-reminder (-> obj tasks) 0 2)
|
|
)
|
|
(new 'static 'spool-anim :name "assistant-reminder-1-blue-eco-switch" :index 11 :parts 3 :command-list '())
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(if arg0
|
|
(format
|
|
0
|
|
"ERROR: <GMJ>: ~S playing anim for task status ~S~%"
|
|
(-> obj name)
|
|
(task-status->string (current-status (-> obj tasks)))
|
|
)
|
|
)
|
|
(-> obj draw art-group data 3)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defmethod get-art-elem assistant ((obj assistant))
|
|
(-> obj draw art-group data 3)
|
|
)
|
|
|
|
(defmethod process-taskable-method-43 assistant ((obj assistant))
|
|
(let ((s5-0 (ambient-control-method-10 (-> obj ambient) (new 'stack-no-clear 'vector) (seconds 30) 122880.0 obj)))
|
|
(when s5-0
|
|
(let ((f0-2 (rand-float-gen)))
|
|
(cond
|
|
((< 16384.0 (-> s5-0 y))
|
|
#f
|
|
)
|
|
((< 0.8 f0-2)
|
|
(play-ambient (-> obj ambient) "ASSTLP01" #f (-> obj root-override trans))
|
|
)
|
|
((< 0.6 f0-2)
|
|
(play-ambient (-> obj ambient) "ASSTLP04" #f (-> obj root-override trans))
|
|
)
|
|
((< 0.4 f0-2)
|
|
(play-ambient (-> obj ambient) "ASSTLP05" #f (-> obj root-override trans))
|
|
)
|
|
((< 0.2 f0-2)
|
|
(play-ambient (-> obj ambient) "ASSTLP02" #f (-> obj root-override trans))
|
|
)
|
|
(else
|
|
(play-ambient (-> obj ambient) "ASSTLP03" #f (-> obj root-override trans))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
(defstate idle (assistant)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(if (!= (ja-group) assistant-idle-leaning-right-ja)
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
)
|
|
(loop
|
|
(process-taskable-method-43 self)
|
|
(ja :group! assistant-idle-leaning-right-ja)
|
|
(countdown (gp-0 (+ (the int (rand-float-gen)) 2))
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
(cond
|
|
((< (rand-float-gen) 0.66)
|
|
(ja-no-eval :group! assistant-idle-transition-to-welding-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(sound-play "welding-loop" :id (-> self sound-id) :position (the-as symbol (target-pos 0)))
|
|
(ja :group! assistant-idle-welding-ja)
|
|
(let* ((f30-0 4.0)
|
|
(v1-76 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-77 (the-as number (logior #x3f800000 v1-76)))
|
|
)
|
|
(countdown (gp-2 (+ (the int (* f30-0 (+ -1.0 (the-as float v1-77)))) 4))
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(spawn (-> self part) (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 30)))
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(ja-no-eval :group! (ja-group) :num! (seek! 0.0) :frame-num max)
|
|
(until (ja-done? 0)
|
|
(spawn (-> self part) (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 30)))
|
|
(suspend)
|
|
(ja :num! (seek! 0.0))
|
|
)
|
|
)
|
|
)
|
|
(sound-stop (-> self sound-id))
|
|
(ja-no-eval :group! assistant-idle-transition-to-welding-ja :num! (seek! 0.0) :frame-num max)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! 0.0))
|
|
)
|
|
(when (< (rand-float-gen) 0.66)
|
|
(ja-no-eval :group! assistant-idle-wiping-brow-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(ja-no-eval :group! assistant-idle-transition-right-to-left-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(countdown (gp-3 (+ (the int (rand-float-gen)) 1))
|
|
(ja-no-eval :group! assistant-idle-leaning-left-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
(ja-no-eval :group! assistant-idle-transition-left-to-right-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defpartgroup group-assistant-torch
|
|
:id 122
|
|
:bounds (static-bspherem 0 0 0 15)
|
|
:parts ((sp-item 365 :fade-after (meters 30) :falloff-to (meters 30))
|
|
(sp-item 366 :fade-after (meters 60) :falloff-to (meters 80))
|
|
)
|
|
)
|
|
|
|
(defpart 365
|
|
:init-specs ((:texture (new 'static 'texture-id :index #x12 :page #x2))
|
|
(:num 0.1 1.0)
|
|
(:scale-x (meters 1) (meters 3))
|
|
(:rot-z (degrees 0) (degrees 360))
|
|
(:scale-y :copy scale-x)
|
|
(:r 100.0 28.0)
|
|
(:g 100.0)
|
|
(:b 80.0)
|
|
(:a 32.0 64.0)
|
|
(:fade-a -6.4)
|
|
(:timer (seconds 0.035))
|
|
(:flags (bit2 bit3))
|
|
)
|
|
)
|
|
|
|
(defpart 366
|
|
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
|
(:num 0.1 1.0)
|
|
(:scale-x (meters 0.1) (meters 0.1))
|
|
(:scale-y :copy scale-x)
|
|
(:r 128.0 128.0)
|
|
(:g 128.0)
|
|
(:b 64.0)
|
|
(:a 32.0 96.0)
|
|
(:vel-y (meters 0.013333334) (meters 0.08))
|
|
(:scalevel-x (meters -0.00016666666))
|
|
(:scalevel-y :copy scalevel-x)
|
|
(:fade-g -0.2)
|
|
(:fade-b -0.2)
|
|
(:accel-y (meters -0.002))
|
|
(:friction 0.93)
|
|
(:timer (seconds 4))
|
|
(:flags (bit2))
|
|
(:userdata 140288.0)
|
|
(:func 'check-drop-level-assistant)
|
|
(:conerot-x (degrees 0) (degrees 180))
|
|
(:conerot-y (degrees 45) (degrees 180))
|
|
)
|
|
)
|
|
|
|
(defpart 367
|
|
:init-specs ((:texture (new 'static 'texture-id :index #xf :page #x2))
|
|
(:num 3.0 1.0)
|
|
(:scale-x (meters 0.075) (meters 0.075))
|
|
(:scale-y :copy scale-x)
|
|
(:r 128.0 64.0)
|
|
(:g 96.0)
|
|
(:a 32.0 96.0)
|
|
(:vel-y (meters 0.011666667) (meters 0.0033333334))
|
|
(:fade-a -0.85333335)
|
|
(:accel-y (meters -0.00016666666))
|
|
(:timer (seconds 1))
|
|
(:flags (bit2))
|
|
(:conerot-x (degrees 50.000004) (degrees 30))
|
|
(:conerot-y (degrees 0) (degrees 360))
|
|
)
|
|
)
|
|
|
|
(defun check-drop-level-assistant ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector))
|
|
(when (< (-> arg2 y) (-> arg1 user-float))
|
|
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
|
(sp-kill-particle arg0 arg1)
|
|
(if (< (rand-float-gen) 0.25)
|
|
(sound-play "water-drop")
|
|
)
|
|
(set-vector! gp-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0)
|
|
(launch-particles :rate 1.0 (-> *part-id-table* 367) gp-0)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
(defmethod init-from-entity! assistant ((obj assistant) (arg0 entity-actor))
|
|
(process-taskable-method-40 obj arg0 *assistant-sg* 3 31 (new 'static 'vector :w 4096.0) 5)
|
|
(set! (-> obj bounce-away) #f)
|
|
(set! (-> obj part) (create-launch-control (-> *part-group-id-table* 122) obj))
|
|
(set! (-> obj tasks) (get-task-control (game-task jungle-eggtop)))
|
|
(set! (-> obj sound-id) (new-sound-id))
|
|
(set! (-> obj draw light-index) (the-as uint 1))
|
|
(case (get-task-status (game-task firecanyon-assistant))
|
|
(((task-status unknown))
|
|
(go (method-of-object obj idle))
|
|
)
|
|
(else
|
|
(cleanup-for-death obj)
|
|
(deactivate obj)
|
|
)
|
|
)
|
|
(none)
|
|
)
|