[decomp] fix and decomp part tester (#935)

* temp

* update tests
This commit is contained in:
water111
2021-10-23 20:15:31 -04:00
committed by GitHub
parent 20e5f671b1
commit d6e82eedb0
10 changed files with 353 additions and 45 deletions
@@ -0,0 +1,166 @@
;;-*-Lisp-*-
(in-package goal)
;; this file is debug only
(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)
)
)
;; definition of type part-tester
(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
)
;; definition for method 3 of type part-tester
(defmethod inspect part-tester ((obj part-tester))
(let ((t9-0 (method-of-type process inspect)))
(t9-0 obj)
)
(format #t "~T~Troot: ~A~%" (-> obj root))
(format #t "~T~Tpart: ~A~%" (-> obj part))
(format #t "~T~Told-group: ~A~%" (-> obj old-group))
obj
)
;; definition for symbol *part-tester-name*, type string
(define *part-tester-name* (the-as string #f))
;; definition for method 10 of type part-tester
(defmethod deactivate part-tester ((obj part-tester))
(if (nonzero? (-> obj part))
(kill-and-free-particles (-> obj part))
)
((method-of-type process deactivate) obj)
(none)
)
;; failed to figure out what this is:
(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))
)
(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))
)
(if (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)
)
)
;; definition for function part-tester-init-by-other
;; INFO: Return type mismatch object vs none.
;; Used lq/sq
(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)
)
;; definition (perm) for symbol *debug-part-dead-pool*, type dead-pool
(define-perm *debug-part-dead-pool* dead-pool
(new 'debug 'dead-pool 1 #x10000 '*debug-part-dead-pool*)
)
;; definition for function start-part
;; INFO: Return type mismatch (pointer process) vs none.
(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)
)
)
+8 -30
View File
@@ -1016,39 +1016,21 @@
)
(else
(let* ((a0-1 (-> obj bsp boxes))
(v1-5 (the-as object (-> a0-1 data)))
(s5-1 (-> a0-1 data))
)
(countdown (a0-2 (-> a0-1 length))
(if
(and
(>=
(-> arg0 x)
(-> (the-as (inline-array box8s) v1-5) 0 min x)
)
(>=
(-> arg0 y)
(-> (the-as (inline-array box8s) v1-5) 0 min y)
)
(>=
(-> arg0 z)
(-> (the-as (inline-array box8s) v1-5) 0 min z)
)
(<
(-> arg0 x)
(-> (the-as (inline-array box8s) v1-5) 0 max x)
)
(<
(-> arg0 y)
(-> (the-as (inline-array box8s) v1-5) 0 max y)
)
(<
(-> arg0 z)
(-> (the-as (inline-array box8s) v1-5) 0 max z)
)
(>= (-> arg0 x) (-> s5-1 0 min x))
(>= (-> arg0 y) (-> s5-1 0 min y))
(>= (-> arg0 z) (-> s5-1 0 min z))
(< (-> arg0 x) (-> s5-1 0 max x))
(< (-> arg0 y) (-> s5-1 0 max y))
(< (-> arg0 z) (-> s5-1 0 max z))
)
(return (the-as symbol #t))
)
(set! v1-5 (-> (the-as (inline-array box8s) v1-5) 1))
(set! s5-1 (the-as (inline-array box8s) (-> s5-1 1)))
)
)
#f
@@ -2159,7 +2141,3 @@
)
)
)
+7 -7
View File
@@ -250,13 +250,13 @@
;; definition of type vector4w
(deftype vector4w (structure)
((data int32 4 :offset 0)
(x int32 :offset 0)
(y int32 :offset 4)
(z int32 :offset 8)
(w int32 :offset 12)
(dword uint64 2 :offset 0)
(quad uint128 :offset 0)
((data int32 4 :offset-assert 0)
(x int32 :offset 0)
(y int32 :offset 4)
(z int32 :offset 8)
(w int32 :offset 12)
(dword uint64 2 :offset 0)
(quad uint128 :offset 0)
)
:method-count-assert 9
:size-assert #x10