Files
jak-project/test/decompiler/reference/jak2/engine/game/idle-control_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

163 lines
4.9 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type idle-control-frame
(deftype idle-control-frame (uint32)
((command ic-cmd :offset 0 :size 8)
(anim uint8 :offset 8 :size 8)
(param0 uint8 :offset 16 :size 8)
(param1 uint8 :offset 24 :size 8)
)
)
;; definition for method 3 of type idle-control-frame
(defmethod inspect ((this idle-control-frame))
(local-vars (a2-4 int))
(when (not this)
(set! this this)
(goto cfg-11)
)
(format #t "[~8x] ~A~%" this 'idle-control-frame)
(let ((t9-1 format)
(a0-2 #t)
(a1-1 "~1Tcommand: #x~X : ~S~%")
(a2-1 (-> this command))
(v1-4 (-> this command))
)
(t9-1 a0-2 a1-1 a2-1 (cond
((= v1-4 (ic-cmd play))
"play"
)
((= v1-4 (ic-cmd push))
"push"
)
((= v1-4 (ic-cmd restart))
"restart"
)
(else
"*unknown*"
)
)
)
)
(format #t "~1Tanim: ~D~%" (-> this anim))
(format #t "~1Tparam0: ~D~%" (-> this param0))
(let ((t9-4 format)
(a0-5 #t)
(a1-4 "~1Tparam1: ~D~%")
)
(shift-arith-right-32 a2-4 this 24)
(t9-4 a0-5 a1-4 a2-4)
)
(label cfg-11)
this
)
;; definition of type idle-control
(deftype idle-control (structure)
((anim (pointer idle-control-frame))
(current (pointer idle-control-frame))
(counter int32)
(target int32)
)
(:methods
(idle-control-method-9 (_type_ (pointer idle-control-frame)) none)
(idle-control-method-10 (_type_ process-drawable) none :behavior process-drawable)
)
)
;; definition for method 3 of type idle-control
(defmethod inspect ((this idle-control))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'idle-control)
(format #t "~1Tanim: #x~X~%" (-> this anim))
(format #t "~1Tcurrent: #x~X~%" (-> this current))
(format #t "~1Tcounter: ~D~%" (-> this counter))
(format #t "~1Ttarget: ~D~%" (-> this target))
(label cfg-4)
this
)
;; definition for method 9 of type idle-control
;; WARN: Return type mismatch idle-control vs none.
(defmethod idle-control-method-9 ((this idle-control) (arg0 (pointer idle-control-frame)))
(set! (-> this anim) arg0)
(set! (-> this current) arg0)
(set! (-> this counter) 0)
(set! (-> this target) 0)
(none)
)
;; definition for method 10 of type idle-control
;; WARN: Return type mismatch int vs none.
;; WARN: Function (method 10 idle-control) has a return type of none, but the expression builder found a return statement.
(defmethod idle-control-method-10 ((this idle-control) (arg0 process-drawable))
(local-vars (a1-1 int))
(when (nonzero? (-> this anim))
(let ((s5-0 self))
(set! self arg0)
(loop
(let ((s4-0 (-> this current 0)))
(case (-> s4-0 command)
(((ic-cmd play))
(if (< (-> s4-0 anim) 0)
(return #f)
)
(when (zero? (-> this target))
(let ((t9-0 rand-vu-int-range)
(a0-3 (-> s4-0 param0))
)
(shift-arith-right-32 a1-1 s4-0 24)
(set! (-> this target) (t9-0 (the-as int a0-3) a1-1))
)
(ja :group! (-> (the-as process-drawable self) draw art-group data (-> s4-0 anim)) :num! min)
(return #f)
)
(ja :group! (-> (the-as process-drawable self) draw art-group data (-> s4-0 anim)) :num! (seek!))
(cond
((ja-done? 0)
(+! (-> this counter) 1)
(cond
((>= (-> this counter) (-> this target))
(set! (-> this current) (&-> this current 1))
(set! (-> this counter) 0)
(set! (-> this target) 0)
0
)
(else
(ja :num-func num-func-identity :frame-num 0.0)
(return #f)
)
)
)
(else
(return #f)
)
)
)
(((ic-cmd push))
(ja-channel-push! 1 (the-as time-frame (-> s4-0 param0)))
(set! (-> this current) (&-> this current 1))
(set! (-> this counter) 0)
(set! (-> this target) 0)
0
)
(((ic-cmd restart))
(set! (-> this current) (-> this anim))
(set! (-> this counter) 0)
(set! (-> this target) 0)
0
)
)
)
)
(set! self s5-0)
)
)
0
(none)
)