jak-project/test/decompiler/reference/levels/village2/sage-bluehut_REF.gc

459 lines
16 KiB
Common Lisp
Raw Normal View History

;;-*-Lisp-*-
(in-package goal)
;; definition of type assistant-bluehut
(deftype assistant-bluehut (process-taskable)
((sound-id sound-id :offset-assert 380)
decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
(jaws handle :offset-assert 384)
(sage entity-actor :offset-assert 392)
(im-talking symbol :offset-assert 396)
)
:heap-base #x120
:method-count-assert 53
:size-assert #x190
:flag-assert #x3501200190
)
;; definition for method 3 of type assistant-bluehut
(defmethod inspect assistant-bluehut ((obj assistant-bluehut))
(let ((t9-0 (method-of-type process-taskable inspect)))
(t9-0 obj)
)
(format #t "~T~Tsound-id: ~D~%" (-> obj sound-id))
(format #t "~T~Tjaws: ~D~%" (-> obj jaws))
(format #t "~T~Tsage: ~A~%" (-> obj sage))
(format #t "~T~Tim-talking: ~A~%" (-> obj im-talking))
obj
)
;; definition of type sage-bluehut
(deftype sage-bluehut (process-taskable)
((reminder-played symbol :offset-assert 380)
(assistant entity-actor :offset-assert 384)
)
:heap-base #x120
:method-count-assert 53
:size-assert #x184
:flag-assert #x3501200184
)
;; definition for method 3 of type sage-bluehut
(defmethod inspect sage-bluehut ((obj sage-bluehut))
(let ((t9-0 (method-of-type process-taskable inspect)))
(t9-0 obj)
)
(format #t "~T~Treminder-played: ~A~%" (-> obj reminder-played))
(format #t "~T~Tassistant: ~A~%" (-> obj assistant))
obj
)
;; failed to figure out what this is:
(defskelgroup *sage-bluehut-sg* sage-bluehut
0
3
((1 (meters 999999)))
:bounds (static-spherem 0 0 0 2.5)
:longest-edge (meters 0)
:shadow 2
)
;; definition for method 32 of type sage-bluehut
(defmethod play-anim! sage-bluehut ((obj sage-bluehut) (arg0 symbol))
(with-pp
(set! (-> obj talk-message) (the-as uint 291))
(case (current-status (-> obj tasks))
(((task-status need-hint) (task-status need-introduction))
(if (not arg0)
(set! (-> obj will-talk) #t)
)
(case (current-task (-> obj tasks))
(((game-task rolling-plants))
(when arg0
(let* ((s5-1 (-> obj tasks))
(s4-0 (method-of-object s5-1 save-reminder))
(a1-3 (new 'stack-no-clear 'event-message-block))
)
(set! (-> a1-3 from) pp)
(set! (-> a1-3 num-params) 2)
(set! (-> a1-3 message) 'query)
(set! (-> a1-3 param 0) (the-as uint 'pickup))
(set! (-> a1-3 param 1) (the-as uint 6))
(s4-0 s5-1 (the int (the-as float (send-event-function *target* a1-3))) 1)
)
(close-status! (-> obj tasks) (task-status need-introduction))
(let ((s5-2 (-> obj assistant extra process)))
(if (and s5-2 (should-display? (the-as assistant-bluehut s5-2)))
(send-event s5-2 'clone (process->handle obj))
)
)
(set! (-> obj draw bounds w) 40960.0)
)
(new 'static 'spool-anim
:name
"sage-bluehut-introduction-crop-dusting"
:index 8
:parts 12
:command-list
'((678 joint "cameraB") (1166 joint "camera") (1258 joint "cameraB"))
)
)
(else
(when arg0
(close-status! (-> obj tasks) (task-status need-introduction))
(close-specific-task! (game-task swamp-tether-1) (task-status need-introduction))
(close-specific-task! (game-task swamp-tether-2) (task-status need-introduction))
(close-specific-task! (game-task swamp-tether-3) (task-status need-introduction))
(close-specific-task! (game-task swamp-tether-4) (task-status need-introduction))
)
(new 'static 'spool-anim
:name "sage-bluehut-introduction-prec-arm"
:index 6
:parts 8
:command-list
'((141 joint "cameraB")
(214 joint "camera")
(308 joint "cameraB")
(686 joint "camera")
(786 joint "cameraB")
(843 joint "camera")
)
)
)
)
)
(((task-status need-reminder))
(set! (-> obj skippable) #t)
(if arg0
(set! (-> obj reminder-played) #t)
)
(cond
((zero? (get-reminder (-> obj tasks) 0))
(new 'static 'spool-anim :name "sage-bluehut-reminder-1-crop-dusting" :index 9 :parts 3 :command-list '())
)
(else
(if arg0
(set! (-> obj draw bounds w) 40960.0)
)
(new 'static 'spool-anim
:name "sage-bluehut-reminder-1-prec-arm"
:index 7
:parts 4
:command-list
'((90 joint "cameraB") (259 joint "camera") (352 joint "cameraB"))
)
)
)
)
(else
(if arg0
(format
0
"ERROR: <GMJ>: ~S playing anim for task status ~S~%"
(-> obj name)
(task-status->string (current-status (-> obj tasks)))
)
)
(get-art-elem obj)
)
)
)
)
;; definition for method 45 of type sage-bluehut
;; INFO: Return type mismatch symbol vs none.
(defmethod dummy-45 sage-bluehut ((obj sage-bluehut))
(cond
((= (current-status (-> obj tasks)) (task-status unknown))
)
((= (current-status (-> obj tasks)) (task-status invalid))
)
((and
(closed? (-> obj tasks) (game-task rolling-plants) (task-status need-reminder))
(= (get-reminder (-> obj tasks) 0) 0)
)
#t
)
((and
(closed? (-> obj tasks) (game-task swamp-arm) (task-status need-reminder))
(= (get-reminder (-> obj tasks) 0) 1)
)
#t
)
((and (-> obj reminder-played) (< 81920.0 (vector-vector-distance (-> obj root-override trans) (camera-pos))))
#t
)
(else
)
)
(none)
)
;; definition for method 31 of type sage-bluehut
(defmethod get-art-elem sage-bluehut ((obj sage-bluehut))
(cond
((and
(= (current-task (-> obj tasks)) (game-task rolling-plants))
(or
(= (current-status (-> obj tasks)) (task-status need-hint))
(= (current-status (-> obj tasks)) (task-status need-introduction))
)
)
(save-reminder (-> obj tasks) 0 0)
)
((and
(= (current-task (-> obj tasks)) (game-task swamp-arm))
(or
(= (current-status (-> obj tasks)) (task-status need-hint))
(= (current-status (-> obj tasks)) (task-status need-introduction))
)
)
(save-reminder (-> obj tasks) 1 0)
)
((dummy-45 obj)
(set! (-> obj reminder-played) #f)
(cond
((closed? (-> obj tasks) (game-task rolling-plants) (task-status need-reminder))
(save-reminder (-> obj tasks) 1 0)
)
((or
(closed? (-> obj tasks) (game-task swamp-arm) (task-status need-reminder))
(not (closed? (-> obj tasks) (game-task swamp-arm) (task-status need-introduction)))
)
(save-reminder (-> obj tasks) 0 0)
)
((zero? (get-reminder (-> obj tasks) 0))
(save-reminder (-> obj tasks) 1 0)
)
(else
(save-reminder (-> obj tasks) 0 0)
)
)
)
)
(if (zero? (get-reminder (-> obj tasks) 0))
(-> obj draw art-group data 4)
(-> obj draw art-group data 5)
)
)
;; failed to figure out what this is:
(defstate play-anim (sage-bluehut)
:virtual #t
:exit
(behavior ()
(send-event (-> self assistant extra process) 'end-mode)
(set! (-> self draw bounds w) 10240.0)
((-> (method-of-type process-taskable play-anim) exit))
(none)
)
)
;; definition for method 39 of type sage-bluehut
(defmethod should-display? sage-bluehut ((obj sage-bluehut))
(and (task-closed? (game-task village2-levitator) (task-status need-introduction)) (not (sages-kidnapped?)))
)
;; definition for method 44 of type sage-bluehut
;; INFO: Return type mismatch basic vs symbol.
(defmethod play-reminder sage-bluehut ((obj sage-bluehut))
(the-as
symbol
(and (-> obj will-talk) *target* (< -6365184.0 (-> (target-pos 0) z)) (< (-> (target-pos 0) x) 1612800.0))
)
)
;; definition for method 47 of type sage-bluehut
(defmethod target-above-threshold? sage-bluehut ((obj sage-bluehut))
(local-vars (v0-1 symbol))
(if (not (play-reminder obj))
(return #f)
)
(let ((gp-1 (-> obj assistant extra process)))
(if (not gp-1)
(return #t)
)
(target-above-threshold? (the-as assistant-bluehut gp-1))
(return (not (-> (the-as assistant-bluehut gp-1) im-talking)))
)
v0-1
)
;; definition for method 43 of type sage-bluehut
(defmethod TODO-RENAME-43 sage-bluehut ((obj sage-bluehut))
(when (TODO-RENAME-10 (-> obj ambient) (new 'stack-no-clear 'vector) 9000 122880.0 obj)
(let* ((v1-3 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-4 (the-as number (logior #x3f800000 v1-3)))
(f0-2 (+ -1.0 (the-as float v1-4)))
)
(cond
((< 0.8 f0-2)
(play-ambient (-> obj ambient) "SAGELP20" #f (-> obj root-override trans))
)
((< 0.6 f0-2)
(play-ambient (-> obj ambient) "SAGELP21" #f (-> obj root-override trans))
)
((< 0.4 f0-2)
(play-ambient (-> obj ambient) "SAGELP22" #f (-> obj root-override trans))
)
((< 0.2 f0-2)
(play-ambient (-> obj ambient) "SAGELP23" #f (-> obj root-override trans))
)
((nonzero? (get-task-status (game-task citadel-sage-blue)))
(play-ambient (-> obj ambient) "SAGELP24" #f (-> obj root-override trans))
)
)
)
)
)
;; failed to figure out what this is:
(defstate idle (sage-bluehut)
:virtual #t
:code
(behavior ()
(while #t
(let ((gp-0 (get-art-elem self)))
(cond
((= gp-0 (-> self draw art-group data 4))
(if (!= (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
gp-0
)
(ja-channel-push! 1 60)
)
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0))
(let* ((f30-0 3.0)
(v1-15 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-16 (the-as number (logior #x3f800000 v1-15)))
)
(countdown (gp-1 (+ (the int (* f30-0 (+ -1.0 (the-as float v1-16)))) 5))
(TODO-RENAME-43 self)
(let ((a0-5 (-> self skel root-channel 0)))
(set! (-> a0-5 frame-group) (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
)
(set! (-> a0-5 param 0) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
)
(set! (-> a0-5 param 1) 1.0)
(set! (-> a0-5 frame-num) 0.0)
(joint-control-channel-group!
a0-5
(if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
num-func-seek!
)
)
(until (ja-done? 0)
(if (dummy-45 self)
(go-virtual idle)
)
(suspend)
(let ((a0-7 (-> self skel root-channel 0)))
(set! (-> a0-7 param 0) (the float (+ (-> a0-7 frame-group data 0 length) -1)))
(set! (-> a0-7 param 1) 1.0)
(joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-seek!)
)
)
)
)
(ja-channel-push! 1 60)
(let ((a0-10 (-> self skel root-channel 0)))
(set! (-> a0-10 frame-group) (the-as art-joint-anim (-> self draw art-group data 3)))
(set! (-> a0-10 param 0)
(the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) data 0 length) -1))
)
(set! (-> a0-10 param 1) 1.0)
(set! (-> a0-10 frame-num) 0.0)
(joint-control-channel-group! a0-10 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-seek!)
)
(until (ja-done? 0)
(if (dummy-45 self)
(go-virtual idle)
)
(suspend)
(let ((a0-12 (-> self skel root-channel 0)))
(set! (-> a0-12 param 0) (the float (+ (-> a0-12 frame-group data 0 length) -1)))
(set! (-> a0-12 param 1) 1.0)
(joint-control-channel-group-eval! a0-12 (the-as art-joint-anim #f) num-func-seek!)
)
)
)
(else
(TODO-RENAME-43 self)
(if (!= (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
gp-0
)
(ja-channel-push! 1 60)
)
(set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim gp-0))
(let ((a0-16 (-> self skel root-channel 0)))
(set! (-> a0-16 frame-group) (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
)
(set! (-> a0-16 param 0) (the float (+ (-> (if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
)
(set! (-> a0-16 param 1) 1.0)
(set! (-> a0-16 frame-num) 0.0)
(joint-control-channel-group!
a0-16
(if (> (-> self skel active-channels) 0)
(-> self skel root-channel 0 frame-group)
)
num-func-seek!
)
)
(until (ja-done? 0)
(if (dummy-45 self)
(go-virtual idle)
)
(suspend)
(let ((a0-18 (-> self skel root-channel 0)))
(set! (-> a0-18 param 0) (the float (+ (-> a0-18 frame-group data 0 length) -1)))
(set! (-> a0-18 param 1) 1.0)
(joint-control-channel-group-eval! a0-18 (the-as art-joint-anim #f) num-func-seek!)
)
)
)
)
)
)
(none)
)
)
;; definition for method 11 of type sage-bluehut
(defmethod init-from-entity! sage-bluehut ((obj sage-bluehut) (arg0 entity-actor))
(dummy-40 obj arg0 *sage-bluehut-sg* 3 40 (new 'static 'vector :w 4505.6) 5)
(set! (-> obj tasks) (get-task-control (game-task rolling-plants)))
(set! (-> obj reminder-played) #f)
(set! (-> obj assistant) (entity-actor-lookup arg0 'alt-actor 0))
(set! (-> obj draw light-index) (the-as uint 1))
(set! (-> obj sound-flava) (the-as uint 5))
(dummy-42 obj)
(none)
)