Files
jak-project/test/decompiler/reference/jak3/levels/comb/combx-obs_REF.gc
T
water111 7348e6a4ff [decompiler] Update vector ops, reduce casts (#3849)
Update the decompiler to use the new vf macros.

Also, fix a bunch of silly casting issues where accessing inline fields
with an offset of 0 would be better than a cast:

![image](https://github.com/user-attachments/assets/885bbb07-634f-47b8-99f5-5a947941cdde)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
2025-01-20 16:32:58 -05:00

223 lines
7.3 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type combx-elevator
(deftype combx-elevator (process-drawable)
((root collide-shape :override)
)
(:state-methods
idle
)
(:methods
(init-collision! (_type_) none)
(setup-skel-and-draw-masks (_type_) none)
)
)
;; definition for method 3 of type combx-elevator
(defmethod inspect ((this combx-elevator))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(label cfg-4)
this
)
;; failed to figure out what this is:
(defstate idle (combx-elevator)
:virtual #t
:code (behavior ()
(until #f
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
#f
)
:post ja-post
)
;; failed to figure out what this is:
(defskelgroup skel-combx-elevator tpl-elevator tpl-elevator-lod0-jg tpl-elevator-idle-ja
((tpl-elevator-lod0-mg (meters 999999)))
:bounds (static-spherem 0 0 0 11)
)
;; definition for method 21 of type combx-elevator
;; WARN: Return type mismatch collide-shape-moving vs none.
(defmethod init-collision! ((this combx-elevator))
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s5-0 reaction) cshape-reaction-default)
(set! (-> s5-0 no-reaction)
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
)
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
(set! (-> s5-0 total-prims) (the-as uint 3))
(set! (-> s4-0 prim-core collide-as) (collide-spec pusher))
(set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list))
(set! (-> s4-0 prim-core action) (collide-action solid rideable))
(set! (-> s4-0 transform-index) 3)
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 45056.0)
(set! (-> s5-0 root-prim) s4-0)
)
(pusher-init s5-0)
(let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
(set! (-> v1-15 prim-core collide-as) (collide-spec pusher))
(set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> v1-15 prim-core action) (collide-action solid rideable))
(set! (-> v1-15 transform-index) 3)
(set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 45056.0)
)
(let ((v1-18 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint (shl #xfe00 16)))))
(set! (-> v1-18 prim-core action) (collide-action solid))
(set! (-> v1-18 transform-index) 3)
(set-vector! (-> v1-18 local-sphere) 0.0 0.0 0.0 45056.0)
)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(let ((v1-21 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-21 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-21 prim-core collide-with))
)
(set! (-> this root) s5-0)
)
(none)
)
;; definition for method 22 of type combx-elevator
;; WARN: Return type mismatch int vs none.
(defmethod setup-skel-and-draw-masks ((this combx-elevator))
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-combx-elevator" (the-as (pointer level) #f)))
(the-as pair 0)
)
(setup-masks (-> this draw) 1 2)
(update-transforms (-> this root))
0
(none)
)
;; definition for method 11 of type combx-elevator
(defmethod init-from-entity! ((this combx-elevator) (arg0 entity-actor))
"Set up a newly created process from the entity that created it."
(init-collision! this)
(process-drawable-from-entity! this arg0)
(setup-skel-and-draw-masks this)
(set! (-> this draw light-index) (the-as uint 1))
(go (method-of-object this idle))
)
;; definition of type combx-states
(deftype combx-states (structure)
()
)
;; definition for method 3 of type combx-states
(defmethod inspect ((this combx-states))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'combx-states)
(label cfg-4)
this
)
;; definition for function init-mood-combx
(defun init-mood-combx ((arg0 mood-context))
(let ((v1-0 (-> arg0 light-group 1)))
(let ((a0-1 (-> v1-0 dir0)))
(set! (-> a0-1 direction x) 0.0)
(set! (-> a0-1 direction y) 1.0)
(set! (-> a0-1 direction z) 0.0)
(set! (-> a0-1 direction w) 0.0)
)
(set-vector! (-> v1-0 dir0 color) 0.667 0.667 0.667 1.0)
(set-vector! (-> v1-0 ambi color) 0.333 0.333 0.333 1.0)
(set! (-> v1-0 dir0 extra x) 0.75)
(set! (-> v1-0 dir1 extra x) 0.0)
(set! (-> v1-0 dir2 extra x) 0.0)
(set! (-> v1-0 ambi extra x) 0.25)
)
)
;; definition for function update-mood-combx
;; WARN: Return type mismatch int vs none.
(defbehavior update-mood-combx time-of-day-proc ((arg0 mood-context) (arg1 float) (arg2 int))
(update-mood-interior arg0 #f)
(let* ((s5-0 (camera-pos))
(f0-1 (fmin
(vector-vector-distance s5-0 (new 'static 'vector :x 368640.0 :z 40960.0 :w 1.0))
(vector-vector-distance s5-0 (new 'static 'vector :x 14274560.0 :y -167936.0 :z 614400.0 :w 1.0))
)
)
)
(when (< f0-1 716800.0)
(let ((f30-1 (fmax 0.0 (fmin 1.0 (* 0.000009765625 (- 819200.0 f0-1)))))
(a1-4 (-> arg0 current-fog))
(s5-1 (-> arg0 current-fog fog-dists))
)
(vector4-lerp!
(-> a1-4 fog-color)
(-> a1-4 fog-color)
(new 'static 'vector :x 30.0 :y 80.0 :z 150.0 :w 128.0)
f30-1
)
(vector4-lerp! s5-1 s5-1 (new 'static 'vector :x 262144.0 :y 937984.0 :z 255.0 :w 200.0) f30-1)
)
)
)
(cond
((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode)))
(palette-select-special arg0)
)
(else
(-> arg0 state)
(let* ((s5-2 (-> *display* part-clock frame-counter))
(f0-6 (* 1310.72 (the float (mod s5-2 25))))
(f30-2 (sin f0-6))
(f0-8 (* 109.22667 (the float (mod s5-2 600))))
(s5-3 (/ (mod s5-2 125) 25))
)
(set! (-> arg0 times 0 w) 1.0)
(set! (-> arg0 times 1 w) f30-2)
(set! (-> arg0 times 2 w) (+ 0.85 (* 0.15 (cos f0-8))))
(set! (-> arg0 times 3 w) (if (zero? s5-3)
f30-2
0.0
)
)
(set! (-> arg0 times 4 w) (if (= s5-3 1)
f30-2
0.0
)
)
(set! (-> arg0 times 5 w) (if (= s5-3 2)
f30-2
0.0
)
)
(set! (-> arg0 times 6 w) (if (= s5-3 3)
f30-2
0.0
)
)
(set! (-> arg0 times 7 w) (if (= s5-3 4)
f30-2
0.0
)
)
)
)
)
0
(none)
)