mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
b72383964f
Co-authored-by: water <awaterford111445@gmail.com>
295 lines
7.7 KiB
Common Lisp
295 lines
7.7 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: rigid-body-queue.gc
|
|
;; name in dgo: rigid-body-queue
|
|
;; dgos: GAME, COMMON
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(defmethod rigid-body-queue-method-9 rigid-body-queue ((obj rigid-body-queue))
|
|
(set! (-> obj count) 0)
|
|
(dotimes (v1-0 128)
|
|
(set! (-> obj array v1-0) (the-as handle #f))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod validate rigid-body-queue ((obj rigid-body-queue))
|
|
(let ((gp-0 0))
|
|
(dotimes (v1-0 (-> obj count))
|
|
(let ((a1-2 (-> obj array v1-0))
|
|
(a2-0 (+ v1-0 1))
|
|
)
|
|
(while (< a2-0 (-> obj count))
|
|
(if (= a1-2 (-> obj array a2-0))
|
|
(+! gp-0 1)
|
|
)
|
|
(+! a2-0 1)
|
|
)
|
|
)
|
|
)
|
|
(if (> gp-0 0)
|
|
(format 0 "rigid-body-queue::validate: duplicate count ~d~%" gp-0)
|
|
)
|
|
(zero? gp-0)
|
|
)
|
|
)
|
|
|
|
(defmethod rigid-body-queue-method-10 rigid-body-queue ((obj rigid-body-queue))
|
|
(local-vars (s4-0 process))
|
|
(with-pp
|
|
(let ((f0-0 (-> pp clock seconds-per-frame))
|
|
(v1-1 (-> obj count))
|
|
)
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-1)
|
|
(+! v1-1 -1)
|
|
(let ((a0-4 (handle->process (-> obj array v1-1))))
|
|
(cond
|
|
(a0-4
|
|
(let ((a0-6 (-> (the-as rigid-body-object a0-4) rbody)))
|
|
(set! (-> a0-6 state time-remaining) f0-0)
|
|
(set! (-> a0-6 state blocked-by) #f)
|
|
(set! (-> a0-6 state step-count) 0)
|
|
(logclear! (-> a0-6 state flags) (rigid-body-flag blocker))
|
|
)
|
|
)
|
|
(else
|
|
)
|
|
)
|
|
)
|
|
(label cfg-9)
|
|
(b! (nonzero? v1-1) cfg-1 :delay (nop!))
|
|
)
|
|
(let ((s5-0 0))
|
|
(b! #t cfg-35 :delay (nop!))
|
|
(until (= (-> obj array s5-0) (process->handle s4-0))
|
|
(label cfg-11)
|
|
(set! s4-0 (handle->process (-> obj array s5-0)))
|
|
(b! (not s4-0) cfg-34 :delay (empty-form))
|
|
(let ((s3-0 (-> (the-as rigid-body-object s4-0) rbody)))
|
|
(b!
|
|
(not (and (logtest? (-> s3-0 state flags) (rigid-body-flag enable-physics))
|
|
(and (< 0.001 (-> s3-0 state time-remaining)) (< (-> s3-0 state step-count) 4))
|
|
)
|
|
)
|
|
cfg-34
|
|
:delay (empty-form)
|
|
)
|
|
(rigid-body-object-method-51 (the-as rigid-body-object s4-0))
|
|
(+! (-> s3-0 state step-count) 1)
|
|
(let ((a2-2 (-> s3-0 state blocked-by)))
|
|
(b! (not a2-2) cfg-34 :delay (empty-form))
|
|
(b! (not #t) cfg-34 :delay (empty-form))
|
|
(logior! (-> a2-2 rbody state flags) (rigid-body-flag blocker))
|
|
(rigid-body-queue-method-13 obj s5-0 a2-2)
|
|
)
|
|
)
|
|
)
|
|
(label cfg-34)
|
|
(+! s5-0 1)
|
|
(label cfg-35)
|
|
(b! (< s5-0 (-> obj count)) cfg-11)
|
|
)
|
|
(let ((s5-1 0))
|
|
(b! #t cfg-48 :delay (nop!))
|
|
(label cfg-37)
|
|
(let ((a0-20 (handle->process (-> obj array s5-1))))
|
|
(when (and a0-20
|
|
(logtest? (-> (the-as rigid-body-object a0-20) rbody state flags) (rigid-body-flag enable-physics))
|
|
)
|
|
(let ((s4-1 pp))
|
|
(set! pp (the-as rigid-body-object a0-20))
|
|
(rigid-body-object-method-52 (the-as rigid-body-object a0-20))
|
|
(set! pp s4-1)
|
|
)
|
|
)
|
|
)
|
|
(+! s5-1 1)
|
|
(label cfg-48)
|
|
(b! (< s5-1 (-> obj count)) cfg-37)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defmethod rigid-body-queue-method-11 rigid-body-queue ((obj rigid-body-queue) (arg0 rigid-body-object))
|
|
(let ((v1-0 -1))
|
|
(let ((a2-0 0))
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-1)
|
|
(b! (handle->process (-> obj array a2-0)) cfg-8 :delay (empty-form))
|
|
(set! v1-0 a2-0)
|
|
(b! #t cfg-11 :delay (nop!))
|
|
(label cfg-8)
|
|
(+! a2-0 1)
|
|
(label cfg-9)
|
|
(b! (< a2-0 (-> obj count)) cfg-1)
|
|
)
|
|
(label cfg-11)
|
|
(b! (= v1-0 -1) cfg-18 :delay (nop!))
|
|
(set! (-> obj array v1-0) (process->handle arg0))
|
|
)
|
|
(b! #t cfg-25 :delay (nop!))
|
|
(label cfg-18)
|
|
(b! (>= (-> obj count) 128) cfg-25 :delay #f)
|
|
(set! (-> obj array (-> obj count)) (process->handle arg0))
|
|
(+! (-> obj count) 1)
|
|
(label cfg-25)
|
|
0
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod rigid-body-queue-method-12 rigid-body-queue ((obj rigid-body-queue) (arg0 int) (arg1 int))
|
|
(when (< arg0 arg1)
|
|
(let ((v1-1 arg1)
|
|
(a3-0 (+ arg1 -1))
|
|
(a2-3 (-> obj array arg1))
|
|
)
|
|
(while (>= a3-0 arg0)
|
|
(set! (-> obj array v1-1) (-> obj array a3-0))
|
|
(+! a3-0 -1)
|
|
(+! v1-1 -1)
|
|
)
|
|
(set! (-> obj array arg0) a2-3)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod rigid-body-queue-method-13 rigid-body-queue ((obj rigid-body-queue) (arg0 int) (arg1 rigid-body-object))
|
|
(let ((v1-2 (process->handle arg1))
|
|
(a2-4 (+ arg0 1))
|
|
)
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-6)
|
|
(b! (!= (-> obj array a2-4) v1-2) cfg-8 :delay (empty-form))
|
|
(rigid-body-queue-method-12 obj arg0 a2-4)
|
|
(b! #t cfg-11 :delay (nop!))
|
|
(label cfg-8)
|
|
(+! a2-4 1)
|
|
(label cfg-9)
|
|
(b! (< a2-4 (-> obj count)) cfg-6)
|
|
)
|
|
(label cfg-11)
|
|
0
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod rigid-body-queue-method-14 rigid-body-queue ((obj rigid-body-queue) (arg0 int))
|
|
(let ((v1-0 arg0)
|
|
(a1-1 (+ arg0 1))
|
|
)
|
|
(while (< a1-1 (-> obj count))
|
|
(set! (-> obj array v1-0) (-> obj array a1-1))
|
|
(+! a1-1 1)
|
|
(+! v1-0 1)
|
|
)
|
|
)
|
|
(+! (-> obj count) -1)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(defmethod rigid-body-queue-method-15 rigid-body-queue ((obj rigid-body-queue) (arg0 rigid-body-object))
|
|
(let ((v1-2 (process->handle arg0))
|
|
(a1-4 0)
|
|
)
|
|
(b! #t cfg-9 :delay (nop!))
|
|
(label cfg-6)
|
|
(b! (!= (-> obj array a1-4) v1-2) cfg-8 :delay (empty-form))
|
|
(rigid-body-queue-method-14 obj a1-4)
|
|
(b! #t cfg-11 :delay (nop!))
|
|
(label cfg-8)
|
|
(+! a1-4 1)
|
|
(label cfg-9)
|
|
(b! (< a1-4 (-> obj count)) cfg-6)
|
|
)
|
|
(label cfg-11)
|
|
0
|
|
0
|
|
(none)
|
|
)
|
|
|
|
(deftype rigid-body-queue-manager (process)
|
|
((queue rigid-body-queue :offset-assert 128)
|
|
)
|
|
:heap-base #x10
|
|
:method-count-assert 15
|
|
:size-assert #x84
|
|
:flag-assert #xf00100084
|
|
(:methods
|
|
(idle () _type_ :state 14)
|
|
)
|
|
)
|
|
|
|
|
|
(defstate idle (rigid-body-queue-manager)
|
|
:virtual #t
|
|
:exit (behavior ()
|
|
(set! (-> self queue count) 0)
|
|
0
|
|
(none)
|
|
)
|
|
:code (the-as (function none :behavior rigid-body-queue-manager) sleep-code)
|
|
:post (behavior ()
|
|
(local-vars (a0-3 int) (a0-5 int))
|
|
(let* ((v1-1 (-> *perf-stats* data 17))
|
|
(a0-0 (-> v1-1 ctrl))
|
|
)
|
|
(+! (-> v1-1 count) 1)
|
|
(b! (zero? a0-0) cfg-2 :delay (nop!))
|
|
(.mtc0 Perf 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mtpc pcr0 0)
|
|
(.mtpc pcr1 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mtc0 Perf a0-0)
|
|
)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(label cfg-2)
|
|
0
|
|
(rigid-body-queue-method-10 (-> self queue))
|
|
(let ((v1-6 (-> *perf-stats* data 17)))
|
|
(b! (zero? (-> v1-6 ctrl)) cfg-4 :delay (nop!))
|
|
(.mtc0 Perf 0)
|
|
(.sync.l)
|
|
(.sync.p)
|
|
(.mfpc a0-3 pcr0)
|
|
(+! (-> v1-6 accum0) a0-3)
|
|
(.mfpc a0-5 pcr1)
|
|
(+! (-> v1-6 accum1) a0-5)
|
|
)
|
|
(label cfg-4)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
(defbehavior rigid-body-queue-manager-init-by-other rigid-body-queue-manager ((arg0 rigid-body-queue))
|
|
(stack-size-set! (-> self main-thread) 128)
|
|
(set! (-> self queue) arg0)
|
|
(rigid-body-queue-method-9 (-> self queue))
|
|
(go-virtual idle)
|
|
)
|
|
|
|
(defun rigid-body-queue-manager-spawn ((arg0 rigid-body-queue) (arg1 process-tree))
|
|
(let ((gp-0 (the-as process #f)))
|
|
(let ((v1-1 (process-spawn rigid-body-queue-manager arg0 :to arg1)))
|
|
(if v1-1
|
|
(set! gp-0 (-> v1-1 0))
|
|
)
|
|
)
|
|
gp-0
|
|
)
|
|
)
|