Files
jak-project/goal_src/engine/debug/part-tester.gc
T
water111 d6e82eedb0 [decomp] fix and decomp part tester (#935)
* temp

* update tests
2021-10-23 20:15:31 -04:00

161 lines
4.9 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: part-tester.gc
;; name in dgo: part-tester
;; dgos: GAME, ENGINE
(declare-type part-tester basic)
(define-extern *part-tester* part-tester)
(when *debug-segment*
;; failed to figure out what this is:
(set!
(-> *part-group-id-table* 105)
(new 'static 'sparticle-launch-group
:length 2
:duration #xbb8
:linger-duration #x5dc
:name "group-part-tester"
:launcher
(new 'static 'inline-array sparticle-group-item 2 (sp-item 56) (sp-item 57))
:bounds (new 'static 'sphere :w 4096.0)
)
)
(deftype part-tester (process)
((root trsqv :offset-assert 112)
(part sparticle-launch-control :offset-assert 116)
(old-group basic :offset-assert 120)
)
:heap-base #x100
:method-count-assert 14
:size-assert #x7c
:flag-assert #xe0100007c
)
(define *part-tester-name* (the-as string #f))
(defmethod deactivate part-tester ((obj part-tester))
(if (nonzero? (-> obj part))
(kill-and-free-particles (-> obj part))
)
((method-of-type process deactivate) obj)
(none)
)
(defstate part-tester-idle (part-tester)
:code
(behavior ()
(while #t
(let ((gp-0 (entity-by-name *part-tester-name*)))
(when gp-0
(let ((s5-0 (-> gp-0 extra process)))
(if
(and
s5-0
(type-type? (-> s5-0 type) process-drawable)
(nonzero? (-> (the-as process-drawable s5-0) root))
)
(set!
(-> self root trans quad)
(-> (the-as process-drawable s5-0) root trans quad)
)
(set! (-> self root trans quad) (-> gp-0 extra trans quad))
)
)
)
)
(add-debug-x
#t
(bucket-id debug-draw1)
(-> self root trans)
(the-as rgba (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
)
;; change this line to change the particle group to test
;; notes:
;; - 3d particles won't work
;; - particles that use aux list won't work
;; - some particles may have callbacks that won't work yet
;; - you need to load the level with the particle defs first
;; - there is an issue with blending. check the "always" box as a temporary workaround
;; - the visibilty check also doesn't work. comment it out in defmethod spawn.
(let ((gp-1 (-> *part-group-id-table* 105)))
(let ((s5-1 (-> self root trans)))
(when (!= gp-1 (-> self old-group))
(when (nonzero? (-> self part))
(kill-and-free-particles (-> self part))
(set! (-> self heap-cur) (&-> (-> self part) type))
)
(set! (-> self part) (create-launch-control gp-1 self))
)
(when (nonzero? (-> self part))
(spawn (-> self part) (cond
((logtest?
(-> gp-1 flags)
(sp-group-flag screen-space)
)
*zero-vector*
)
(else
(empty)
s5-1
)
)
)
)
)
(set! (-> self old-group) gp-1)
)
(suspend)
)
(none)
)
)
(defbehavior part-tester-init-by-other process-drawable ((arg0 vector))
(set! (-> self root) (new 'process 'trsqv))
(set! (-> self root trans quad) (-> arg0 quad))
(set! *part-tester* (the-as part-tester (process->ppointer self)))
(go part-tester-idle)
(none)
)
(define-perm *debug-part-dead-pool* dead-pool
(new 'debug 'dead-pool 1 #x10000 '*debug-part-dead-pool*)
)
(defun start-part ()
(kill-by-type part-tester *active-pool*)
(let ((gp-0 (get-process *debug-part-dead-pool* part-tester #x4000)))
(when gp-0
(let ((t9-2 (method-of-type part-tester activate)))
(t9-2
(the-as part-tester gp-0)
*default-pool*
'part-tester
(the-as pointer #x70004000)
)
)
(run-now-in-process gp-0 part-tester-init-by-other (if *anim-tester*
(->
*anim-tester*
0
root
trans
)
(target-pos 0)
)
)
(-> gp-0 ppointer)
)
)
(none)
)
)