rewrite sp-get-particle and fix some jak 2 region decomp (#2955)

This commit is contained in:
ManDude
2023-09-03 22:25:59 +01:00
committed by GitHub
parent bb530a5162
commit 46bdd109dd
14 changed files with 159 additions and 261 deletions
+19 -20
View File
@@ -9276,7 +9276,8 @@
)
(deftype region-face-array (inline-array-class)
((data region-face-data :dynamic :offset 20) ;; not sure what's going on here.
((data drawable-region-face :inline :dynamic :offset 16)
(pad0 uint8 4)
)
:method-count-assert 9
:size-assert #x14
@@ -9289,8 +9290,6 @@
:method-count-assert 20
:size-assert #x20
:flag-assert #x1400000020
(:methods
)
)
(deftype region-prim-list (structure)
@@ -20367,23 +20366,23 @@
)
(deftype region-prim-area (structure)
((region-prim-list region-prim-list :inline :offset-assert 0)
(pos vector :inline :offset-assert 1296)
(unknown-vector-uiyb1 vector :inline :offset-assert 1312)
(ray vector :inline :offset 1328)
(unknown-vector-t3edh vector :inline :offset-assert 1344)
(region-enter-count int32 :offset 1360)
(region-enter-list region-prim-area 320 :offset-assert 1364)
(region-enter-prim-list drawable-region-sphere 320 :offset-assert 2644)
(region-exit-count int32 :offset-assert 3924)
(region-exit-list region-prim-area 320 :offset-assert 3928)
(region-exit-prim-list drawable-region-sphere 320 :offset-assert 5208)
(region-inside-count int32 :offset-assert 6488)
(region-inside-list region-prim-area 320 :offset-assert 6492)
(region-inside-prim-list drawable-region-sphere 320 :offset-assert 7772)
(region-start-count int32 :offset-assert 9052)
(region-start-list region-prim-area 320 :offset-assert 9056)
(region-start-prim-list drawable-region-sphere 320 :offset-assert 10336)
((region-prim-list region-prim-list :inline :offset-assert 0)
(pos vector :inline :offset-assert 1296)
(unknown-vector-uiyb1 vector :inline :offset-assert 1312)
(ray vector :inline :offset 1328)
(unknown-vector-t3edh vector :inline :offset-assert 1344)
(region-enter-count int32 :offset 1360)
(region-enter-list region 320 :offset-assert 1364)
(region-enter-prim-list drawable-region-sphere 320 :offset-assert 2644)
(region-exit-count int32 :offset-assert 3924)
(region-exit-list region 320 :offset-assert 3928)
(region-exit-prim-list drawable-region-sphere 320 :offset-assert 5208)
(region-inside-count int32 :offset-assert 6488)
(region-inside-list region 320 :offset-assert 6492)
(region-inside-prim-list drawable-region-sphere 320 :offset-assert 7772)
(region-start-count int32 :offset-assert 9052)
(region-start-list region 320 :offset-assert 9056)
(region-start-prim-list drawable-region-sphere 320 :offset-assert 10336)
)
:method-count-assert 13
:size-assert #x2d60
@@ -2784,13 +2784,6 @@
[[23, 28], "a0", "drawable-region-prim"],
[4, "a0", "region-prim-area"]
],
"(method 19 drawable-region-volume)": [[8, "a3", "drawable-region-face"]],
"(method 18 drawable-region-volume)": [
[[23, 27], "a0", "drawable-region-face"]
],
"(method 17 drawable-region-volume)": [
[[12, 21], "a0", "drawable-region-face"]
],
"region-prim-lookup-by-id": [[45, "t6", "drawable-region-prim"]],
"region-tree-execute": [
[114, "v1", "region-prim-area"],
@@ -211,107 +211,37 @@
(defun sp-get-particle ((arg0 sparticle-system) (arg1 int) (arg2 sparticle-launch-state))
"alloc a particle"
(local-vars
(a2-3 int)
(a2-4 int)
(a2-5 int)
(a2-6 int)
(a2-7 int)
(a2-8 int)
(t1-16 int)
(t1-17 int)
(t1-18 int)
(t1-19 int)
(t1-20 int)
(t3-5 int)
)
;; pc port note : this function originally attempted to find a free sparticle by picking a "random"
;; (actually incremental) starting block and going from there. we disable that completely for pc
;; because it is actually detrimental since we may alloc sparticles spread over way too many blocks
;; which can have a negative impact on our performance.
(let ((v1-0 0)
(t0-0 (-> arg0 blocks 0))
(a3-0 0)
)
(when (= arg1 1)
(set! v1-0 t0-0)
(set! t0-0 (-> arg0 blocks 1))
)
;; this adds a moving offset to the allocation system. I'm not sure why.
(when arg2
(set! a3-0 (the-as int (-> arg2 randomize)))
(+! (-> arg2 randomize) 1)
(when (= (-> arg2 randomize) (/ t0-0 SPRITE_MAX_AMOUNT_MULT))
(set! (-> arg2 randomize) (the-as uint 0))
0
)
)
;; find the earliest free.
(dotimes (a2-1 t0-0)
(when (nonzero? (-> arg0 alloc-table (+ v1-0 a3-0)))
(let ((a2-2 0)
(t1-15 (-> arg0 alloc-table (+ v1-0 a3-0)))
(t0-4 (* (+ v1-0 a3-0) 64))
)
0
0
(let ((t2-4 (shl t1-15 32))
(t3-0 (+ a2-2 32))
)
(.movn t1-16 t2-4 t2-4 t1-15)
(.movz a2-3 t3-0 t2-4 a2-2)
)
(let ((t2-5 (shl t1-16 16))
(t3-1 (+ a2-3 16))
)
(.movn t1-17 t2-5 t2-5 t1-16)
(.movz a2-4 t3-1 t2-5 a2-3)
)
(let ((t2-6 (* t1-17 256))
(t3-2 (+ a2-4 8))
)
(.movn t1-18 t2-6 t2-6 t1-17)
(.movz a2-5 t3-2 t2-6 a2-4)
)
(let ((t2-7 (* t1-18 16))
(t3-3 (+ a2-5 4))
)
(.movn t1-19 t2-7 t2-7 t1-18)
(.movz a2-6 t3-3 t2-7 a2-5)
)
(let ((t2-8 (* t1-19 4))
(t3-4 (+ a2-6 2))
)
(.movn t1-20 t2-8 t2-8 t1-19)
(.movz a2-7 t3-4 t2-8 a2-6)
(let ((t1-21 (* t1-20 2))
(t2-9 (+ a2-7 1))
)
(.movn t3-5 t1-21 t1-21 t3-4)
(.movz a2-8 t2-9 t1-21 a2-7)
)
)
;; mark as allocated
(let ((t0-5 (+ t0-4 a2-8)))
(set! (-> arg0 alloc-table (+ v1-0 a3-0))
(logxor (-> arg0 alloc-table (+ v1-0 a3-0)) (the-as uint (ash 1 a2-8)))
)
;; update group's alloc count
(+! (-> arg0 num-alloc arg1) 1)
;; return it!
(let ((v1-9 (-> arg0 cpuinfo-table t0-5)))
(set! (-> v1-9 valid) #t)
(return v1-9)
)
)
(when (= arg1 1)
(set! v1-0 t0-0)
(set! t0-0 (-> arg0 blocks 1))
)
(dotimes (blk t0-0)
(when (nonzero? (-> arg0 alloc-table (+ v1-0 a3-0)))
(dotimes (bit 64)
(when (nonzero? (logand (ash 1 bit) (-> arg0 alloc-table (+ v1-0 a3-0))))
(logxor! (-> arg0 alloc-table (+ v1-0 a3-0)) (ash 1 bit))
(+! (-> arg0 num-alloc arg1) 1)
(let ((v1-9 (-> arg0 cpuinfo-table (+ bit (* (+ v1-0 a3-0) 64)))))
(set! (-> v1-9 valid) #t)
(return v1-9)
)
)
)
)
(+! a3-0 1)
(if (= a3-0 t0-0)
(set! a3-0 0)
)
)
)
(+! a3-0 1)
(when (= a3-0 t0-0)
;; wrap
(set! a3-0 0)
)
)
)
(the-as sparticle-cpuinfo #f)
)
+5
View File
@@ -1543,6 +1543,10 @@
(s1-3 (-> s4-8 bsp region-trees s2-4))
)
(while (< s2-4 s3-5)
;; pc port note : added this name check
(let ((tree-name (-> s1-3 name)))
(set! *debug-region-color-alt* (= tree-name 'camera))
(let ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length)))
(set! sv-128 0)
(let ((a0-117 (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128)))
@@ -1555,6 +1559,7 @@
)
)
)
)
(+! s2-4 1)
(set! s1-3 (-> s4-8 bsp region-trees s2-4))
)
+5 -2
View File
@@ -690,6 +690,7 @@
(region-tree (-> region-trees tree-i))
)
(while (< tree-i s3-5)
(let ((tree-name (-> region-tree name)))
(let* ((s0-4 (-> region-tree data2 (+ (-> region-tree length) -1) length))
(i 0)
(region (-> (the-as drawable-inline-array-region-prim (-> region-tree data2 (+ (-> region-tree length) -1))) data i))
@@ -698,10 +699,10 @@
(let ((draw? #f))
(when (and *display-region-inside* (region-method-9 (-> region region) (target-pos 0)))
(true! draw?)
(format *stdcon* "~1kinside region-~D (~A)~%" (-> region region id) (-> lev name)))
(format *stdcon* "~1kinside region-~D [~A] (l: ~A)~%" (-> region region id) tree-name (-> lev name)))
(when (and *region-debug-inspect* (or (= *region-debug-inspect* region) (and *merge-region-prims* (= (-> region region id) (-> *region-debug-inspect* region id)))))
(when (= *region-debug-inspect* region)
(format *stdcon* "~1kinspecting region-~D (~A)~%" (-> *region-debug-inspect* region id) (-> lev name))
(format *stdcon* "~1kinspecting region-~D [~A] (l: ~A)~%" (-> *region-debug-inspect* region id) tree-name (-> lev name))
(format *stdcon* " on-enter: ~A~%" (-> *region-debug-inspect* region on-enter))
(format *stdcon* " on-inside: ~A~%" (-> *region-debug-inspect* region on-inside))
(format *stdcon* " on-exit: ~A~%" (-> *region-debug-inspect* region on-exit))
@@ -709,11 +710,13 @@
(true! draw?)
)
(when draw?
(set! *debug-region-color-alt* (= tree-name 'camera))
(debug-draw-region region 0)))
(set! i (+ i 1))
(set! region (-> (the-as drawable-inline-array-region-prim (-> region-tree data2 (+ (-> region-tree length) -1))) data i))
)
)
)
(+! tree-i 1)
(set! region-tree (-> region-trees tree-i))
)
@@ -138,16 +138,16 @@
(ray vector :inline :offset 1328)
(unknown-vector-t3edh vector :inline :offset-assert 1344)
(region-enter-count int32 :offset 1360)
(region-enter-list region-prim-area 320 :offset-assert 1364)
(region-enter-list region 320 :offset-assert 1364)
(region-enter-prim-list drawable-region-sphere 320 :offset-assert 2644)
(region-exit-count int32 :offset-assert 3924)
(region-exit-list region-prim-area 320 :offset-assert 3928)
(region-exit-list region 320 :offset-assert 3928)
(region-exit-prim-list drawable-region-sphere 320 :offset-assert 5208)
(region-inside-count int32 :offset-assert 6488)
(region-inside-list region-prim-area 320 :offset-assert 6492)
(region-inside-list region 320 :offset-assert 6492)
(region-inside-prim-list drawable-region-sphere 320 :offset-assert 7772)
(region-start-count int32 :offset-assert 9052)
(region-start-list region-prim-area 320 :offset-assert 9056)
(region-start-list region 320 :offset-assert 9056)
(region-start-prim-list drawable-region-sphere 320 :offset-assert 10336)
)
:method-count-assert 13
@@ -180,20 +180,10 @@
)
(defun sp-get-particle ((arg0 sparticle-system) (arg1 int) (arg2 sparticle-launch-state))
(local-vars
(a2-3 int)
(a2-4 int)
(a2-5 int)
(a2-6 int)
(a2-7 int)
(a2-8 int)
(t1-16 int)
(t1-17 int)
(t1-18 int)
(t1-19 int)
(t1-20 int)
(t3-5 int)
)
;; pc port note : this function originally attempted to find a free sparticle by picking a "random"
;; (actually incremental) starting block and going from there. we disable that completely for pc
;; because it is actually detrimental since we may alloc sparticles spread over way too many blocks
;; which can have a negative impact on our performance.
(let ((v1-0 0)
(t0-0 (-> arg0 blocks 0))
(a3-0 0)
@@ -202,62 +192,13 @@
(set! v1-0 t0-0)
(set! t0-0 (-> arg0 blocks 1))
)
(when arg2
(set! a3-0 (the-as int (-> arg2 randomize)))
(+! (-> arg2 randomize) 1)
(when (= (-> arg2 randomize) (/ t0-0 SPRITE_MAX_AMOUNT_MULT))
(set! (-> arg2 randomize) (the-as uint 0))
0
)
)
(dotimes (a2-1 t0-0)
(dotimes (blk t0-0)
(when (nonzero? (-> arg0 alloc-table (+ v1-0 a3-0)))
(let ((a2-2 0)
(t1-15 (-> arg0 alloc-table (+ v1-0 a3-0)))
(t0-4 (* (+ v1-0 a3-0) 64))
)
0
0
(let ((t2-4 (shl t1-15 32))
(t3-0 (+ a2-2 32))
)
(.movn t1-16 t2-4 t2-4 t1-15)
(.movz a2-3 t3-0 t2-4 a2-2)
)
(let ((t2-5 (shl t1-16 16))
(t3-1 (+ a2-3 16))
)
(.movn t1-17 t2-5 t2-5 t1-16)
(.movz a2-4 t3-1 t2-5 a2-3)
)
(let ((t2-6 (* t1-17 256))
(t3-2 (+ a2-4 8))
)
(.movn t1-18 t2-6 t2-6 t1-17)
(.movz a2-5 t3-2 t2-6 a2-4)
)
(let ((t2-7 (* t1-18 16))
(t3-3 (+ a2-5 4))
)
(.movn t1-19 t2-7 t2-7 t1-18)
(.movz a2-6 t3-3 t2-7 a2-5)
)
(let ((t2-8 (* t1-19 4))
(t3-4 (+ a2-6 2))
)
(.movn t1-20 t2-8 t2-8 t1-19)
(.movz a2-7 t3-4 t2-8 a2-6)
(let ((t1-21 (* t1-20 2))
(t2-9 (+ a2-7 1))
)
(.movn t3-5 t1-21 t1-21 t3-4)
(.movz a2-8 t2-9 t1-21 a2-7)
)
)
(let ((t0-5 (+ t0-4 a2-8)))
(logxor! (-> arg0 alloc-table (+ v1-0 a3-0)) (the-as uint (ash 1 a2-8)))
(dotimes (bit 64)
(when (nonzero? (logand (ash 1 bit) (-> arg0 alloc-table (+ v1-0 a3-0))))
(logxor! (-> arg0 alloc-table (+ v1-0 a3-0)) (ash 1 bit))
(+! (-> arg0 num-alloc arg1) 1)
(let ((v1-9 (-> arg0 cpuinfo-table t0-5)))
(let ((v1-9 (-> arg0 cpuinfo-table (+ bit (* (+ v1-0 a3-0) 64)))))
(set! (-> v1-9 valid) (the-as uint 1))
(return v1-9)
)
+2 -1
View File
@@ -102,7 +102,8 @@
(deftype region-face-array (inline-array-class)
((data region-face-data :dynamic :offset 20)
((data drawable-region-face :inline :dynamic :offset 16)
(pad0 uint8 4 :offset-assert 16)
)
:method-count-assert 9
:size-assert #x14
+62 -40
View File
@@ -87,7 +87,8 @@
(local-vars (sv-32 vector2h) (sv-36 vector))
(set! sv-32 (new 'stack 'vector2h))
(set! sv-36 (-> obj bsphere))
(add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (new 'static 'rgba :r #xff :g #xff :a #x80))
(add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x80) (new 'static 'rgba :r #xff :g #xff :a #x80))
(new 'static 'rgba :r #xff :g #xff :a #x80)))
(when (nonzero? (-> obj region))
(let ((s5-0 add-debug-text-3d)
(s4-0 #t)
@@ -162,7 +163,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and in
(return #f)
)
)
(set! (-> obj region-enter-list regions-entered) (the-as region-prim-area region))
(set! (-> obj region-enter-list regions-entered) region)
)
(set! (-> obj region-enter-prim-list regions-entered) region-sphere)
(set! (-> obj region-enter-count) (+ regions-entered 1))
@@ -185,7 +186,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and inc
(return #f)
)
)
(set! (-> obj region-exit-list regions-exited) (the-as region-prim-area region))
(set! (-> obj region-exit-list regions-exited) region)
)
(set! (-> obj region-exit-prim-list regions-exited) arg0)
(set! (-> obj region-exit-count) (+ regions-exited 1))
@@ -208,7 +209,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and i
(return #f)
)
)
(set! (-> obj region-inside-list regions-inside) (the-as region-prim-area region))
(set! (-> obj region-inside-list regions-inside) region)
)
(set! (-> obj region-inside-prim-list regions-inside) arg0)
(set! (-> obj region-inside-count) (+ regions-inside 1))
@@ -231,7 +232,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
(return #f)
)
)
(set! (-> obj region-start-list regions-started) (the-as region-prim-area region))
(set! (-> obj region-start-list regions-started) region)
)
(set! (-> obj region-start-prim-list regions-started) arg0)
(set! (-> obj region-start-count) (+ regions-started 1))
@@ -245,7 +246,8 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
(t9-0 obj arg0)
)
(let ((a2-0 (-> obj bsphere)))
(add-debug-sphere #t (bucket-id debug2) a2-0 (-> obj bsphere w) (new 'static 'rgba :r #xff :a #x80))
(add-debug-sphere #t (bucket-id debug2) a2-0 (-> obj bsphere w) (#if PC_PORT (if *debug-region-color-alt* (static-rgba #xff #x00 #xff #x80) (new 'static 'rgba :r #xff :a #x80))
(new 'static 'rgba :r #xff :a #x80)))
)
0
(none)
@@ -288,23 +290,43 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
(t9-0 obj arg0)
)
)
(let ((s5-0 (-> obj bsphere)))
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
s5-0
(-> obj data normal)
(meters 2)
(new 'static 'rgba :r #xff :g #xff :a #x80)
(#cond
(PC_PORT
(when *debug-region-show-bsphere*
(let ((s5-0 (-> obj bsphere)))
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
s5-0
(-> obj data normal)
(meters 2)
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere #t (bucket-id debug2) s5-0 (-> obj bsphere w) (new 'static 'rgba :r #xff :a #x30))
)
)
)
(add-debug-sphere #t (bucket-id debug2) s5-0 (-> obj bsphere w) (new 'static 'rgba :r #xff :a #x30))
)
(#t
(let ((s5-0 (-> obj bsphere)))
(add-debug-vector
#t
(bucket-id debug-no-zbuf1)
s5-0
(-> obj data normal)
(meters 2)
(new 'static 'rgba :r #xff :g #xff :a #x80)
)
(add-debug-sphere #t (bucket-id debug2) s5-0 (-> obj bsphere w) (new 'static 'rgba :r #xff :a #x30))
)
))
(add-debug-bound
(bucket-id debug2)
(-> obj data points)
(the-as int (-> obj data num-points))
(new 'static 'rgba :r #xff :g #xff :a #x80)
(new 'static 'rgba :r #xff :a #x80)
(#if PC_PORT (if *debug-region-color-alt* (static-rgba #x00 #xff #x00 #x80) (new 'static 'rgba :r #xff :g #xff :a #x80))
(new 'static 'rgba :r #xff :g #xff :a #x80))
(#if PC_PORT (if *debug-region-color-alt* (static-rgba #xff #x00 #xff #x80) (new 'static 'rgba :r #xff :a #x80))
(new 'static 'rgba :r #xff :a #x80))
0
)
0
@@ -384,12 +406,12 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
(let* ((s5-0 (-> obj faces length))
(s4-0 0)
(a0-3 (the-as object (+ (+ (* s4-0 32) 16) (the-as int (-> obj faces)))))
(a0-3 (-> obj faces data s4-0))
)
(while (< s4-0 s5-0)
(debug-draw-region (the-as drawable-region-face a0-3) 1)
(debug-draw-region a0-3 1)
(+! s4-0 1)
(set! a0-3 (+ (+ (* s4-0 32) 16) (the-as int (-> obj faces))))
(set! a0-3 (-> obj faces data s4-0))
)
)
0
@@ -403,14 +425,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
(let* ((s4-0 (-> obj faces length))
(s3-0 0)
(a0-4 (the-as object (+ (+ (* s3-0 32) 16) (the-as int (-> obj faces)))))
(a0-4 (-> obj faces data s3-0))
)
(while (< s3-0 s4-0)
(if (not (track-region (the-as drawable-region-face a0-4) area))
(if (not (track-region a0-4 area))
(return #f)
)
(+! s3-0 1)
(set! a0-4 (+ (+ (* s3-0 32) 16) (the-as int (-> obj faces))))
(set! a0-4 (-> obj faces data s3-0))
)
)
(track-inside-region! area (the-as drawable-region-sphere obj))
@@ -421,16 +443,16 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
"@returns Whether or not the object overlaps with the provided [[region-prim-area]]'s extent"
(let* ((v1-1 (-> obj faces length))
(a2-0 0)
(a3-2 (the-as object (+ (+ (* a2-0 32) 16) (the-as int (-> obj faces)))))
(a3-2 (-> obj faces data a2-0))
)
(while (< a2-0 v1-1)
(let ((a3-4 (-> (the-as drawable-region-face a3-2) data normal)))
(let ((a3-4 (-> a3-2 data normal)))
(if (< 0.0 (- (vector-dot (-> arg0 pos) a3-4) (-> a3-4 w)))
(return #f)
)
)
(+! a2-0 1)
(set! a3-2 (+ (+ (* a2-0 32) 16) (the-as int (-> obj faces))))
(set! a3-2 (-> obj faces data a2-0))
)
)
#t
@@ -494,13 +516,13 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
(defmethod debug-print drawable-tree-region-prim ((obj drawable-tree-region-prim) (arg0 vector) (arg1 object))
(sphere<-vector+r! (the-as sphere (+ 1296 (scratchpad-object int))) arg0 0.0)
(sphere<-vector+r! (the-as sphere (-> (scratchpad-object region-prim-area) pos)) arg0 0.0)
(let* ((s4-0 (-> obj data2 (+ (-> obj length) -1) length))
(s3-0 0)
(s2-0 (the-as object (+ (+ (* s3-0 32) 32) (the-as int (-> obj data2 (+ (-> obj length) -1))))))
)
(while (< s3-0 s4-0)
(if (within-area? (the-as drawable-region-prim s2-0) (the-as region-prim-area (+ (scratchpad-object int) 0)))
(if (within-area? (the-as drawable-region-prim s2-0) (scratchpad-object region-prim-area))
(format
arg1
" splitbox-~D ~A~%"
@@ -550,18 +572,18 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
)
)
(countdown (gp-1 (-> (scratchpad-object region-prim-area) region-prim-list num-items))
(track-region
(-> (scratchpad-object region-prim-area) region-prim-list items gp-1)
(the-as region-prim-area (-> (scratchpad-object region-prim-area) region-prim-list))
)
)
(countdown (gp-1 (-> (scratchpad-object region-prim-area) region-prim-list num-items))
(track-region
(-> (scratchpad-object region-prim-area) region-prim-list items gp-1)
(the-as region-prim-area (-> (scratchpad-object region-prim-area) region-prim-list))
)
)
(let ((gp-2 (-> (scratchpad-object region-prim-area) region-enter-count)))
(while (begin (label cfg-22) (nonzero? gp-2))
(+! gp-2 -1)
(let* ((a2-5 (-> (scratchpad-object region-prim-area) region-enter-list gp-2))
(s5-2 (-> a2-5 region-prim-list items 0))
(s5-2 (-> a2-5 on-enter))
)
(when s5-2
(countdown (v1-47 (-> (scratchpad-object region-prim-area) region-start-count))
@@ -570,7 +592,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
)
(script-eval
(the-as pair s5-2)
s5-2
:key a2-5
:vector (-> (scratchpad-object region-prim-area) region-enter-prim-list gp-2 bsphere)
)
@@ -582,7 +604,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
(while (begin (label cfg-31) (nonzero? gp-3))
(+! gp-3 -1)
(let* ((a2-6 (-> (scratchpad-object region-prim-area) region-exit-list gp-3))
(s5-3 (-> a2-6 region-prim-list items 2))
(s5-3 (-> a2-6 on-exit))
)
(when s5-3
(countdown (v1-64 (-> (scratchpad-object region-prim-area) region-inside-count))
@@ -591,7 +613,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
)
(script-eval
(the-as pair s5-3)
s5-3
:key a2-6
:vector (-> (scratchpad-object region-prim-area) region-exit-prim-list gp-3 bsphere)
)
@@ -601,11 +623,11 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
(countdown (gp-4 (-> (scratchpad-object region-prim-area) region-inside-count))
(let* ((a2-7 (-> (scratchpad-object region-prim-area) region-inside-list gp-4))
(s5-4 (-> a2-7 region-prim-list items 1))
(s5-4 (-> a2-7 on-inside))
)
(if s5-4
(script-eval
(the-as pair s5-4)
s5-4
:key a2-7
:vector (-> (scratchpad-object region-prim-area) region-inside-prim-list gp-4 bsphere)
)
@@ -698,6 +698,7 @@
(debug-menu-append-item regions-menu (new-dm-func "Print on-inside" 'on-inside dm-print-region-pick-func))
(debug-menu-append-item regions-menu (new-dm-func "Print on-exit" 'on-exit dm-print-region-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "Display region inside" *display-region-inside* dm-boolean-toggle-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "Show non-sphere bsphere" *debug-region-show-bsphere* dm-boolean-toggle-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "Region Marks" *display-region-marks* dm-boolean-toggle-pick-func))
(debug-menu-append-item regions-menu (new-dm-bool "region-mode" #f
(lambda (arg (msg debug-menu-msg))
+2
View File
@@ -161,6 +161,8 @@
(define *hires-sky* #t)
(define *debug-region-color-alt* #f)
(define *debug-region-show-bsphere* #f)
(defun get-video-params () *video-params*)
+4 -4
View File
@@ -245,16 +245,16 @@
(ray vector :inline :offset 1328)
(unknown-vector-t3edh vector :inline :offset-assert 1344)
(region-enter-count int32 :offset 1360)
(region-enter-list region-prim-area 320 :offset-assert 1364)
(region-enter-list region 320 :offset-assert 1364)
(region-enter-prim-list drawable-region-sphere 320 :offset-assert 2644)
(region-exit-count int32 :offset-assert 3924)
(region-exit-list region-prim-area 320 :offset-assert 3928)
(region-exit-list region 320 :offset-assert 3928)
(region-exit-prim-list drawable-region-sphere 320 :offset-assert 5208)
(region-inside-count int32 :offset-assert 6488)
(region-inside-list region-prim-area 320 :offset-assert 6492)
(region-inside-list region 320 :offset-assert 6492)
(region-inside-prim-list drawable-region-sphere 320 :offset-assert 7772)
(region-start-count int32 :offset-assert 9052)
(region-start-list region-prim-area 320 :offset-assert 9056)
(region-start-list region 320 :offset-assert 9056)
(region-start-prim-list drawable-region-sphere 320 :offset-assert 10336)
)
:method-count-assert 13
+2 -1
View File
@@ -203,7 +203,8 @@
;; definition of type region-face-array
(deftype region-face-array (inline-array-class)
((data region-face-data :dynamic :offset 20)
((data drawable-region-face :inline :dynamic :offset 16)
(pad0 uint8 4 :offset-assert 16)
)
:method-count-assert 9
:size-assert #x14
+19 -19
View File
@@ -173,7 +173,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-enter-prim-list` and in
(return #f)
)
)
(set! (-> obj region-enter-list regions-entered) (the-as region-prim-area region))
(set! (-> obj region-enter-list regions-entered) region)
)
(set! (-> obj region-enter-prim-list regions-entered) region-sphere)
(set! (-> obj region-enter-count) (+ regions-entered 1))
@@ -198,7 +198,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-exit-prim-list` and inc
(return #f)
)
)
(set! (-> obj region-exit-list regions-exited) (the-as region-prim-area region))
(set! (-> obj region-exit-list regions-exited) region)
)
(set! (-> obj region-exit-prim-list regions-exited) arg0)
(set! (-> obj region-exit-count) (+ regions-exited 1))
@@ -223,7 +223,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-inside-prim-list` and i
(return #f)
)
)
(set! (-> obj region-inside-list regions-inside) (the-as region-prim-area region))
(set! (-> obj region-inside-list regions-inside) region)
)
(set! (-> obj region-inside-prim-list regions-inside) arg0)
(set! (-> obj region-inside-count) (+ regions-inside 1))
@@ -248,7 +248,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
(return #f)
)
)
(set! (-> obj region-start-list regions-started) (the-as region-prim-area region))
(set! (-> obj region-start-list regions-started) region)
)
(set! (-> obj region-start-prim-list regions-started) arg0)
(set! (-> obj region-start-count) (+ regions-started 1))
@@ -410,12 +410,12 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
(let* ((s5-0 (-> obj faces length))
(s4-0 0)
(a0-3 (the-as object (+ (+ (* s4-0 32) 16) (the-as int (-> obj faces)))))
(a0-3 (-> obj faces data s4-0))
)
(while (< s4-0 s5-0)
(debug-draw-region (the-as drawable-region-face a0-3) 1)
(debug-draw-region a0-3 1)
(+! s4-0 1)
(set! a0-3 (+ (+ (* s4-0 32) 16) (the-as int (-> obj faces))))
(set! a0-3 (-> obj faces data s4-0))
)
)
0
@@ -430,14 +430,14 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
(let* ((s4-0 (-> obj faces length))
(s3-0 0)
(a0-4 (the-as object (+ (+ (* s3-0 32) 16) (the-as int (-> obj faces)))))
(a0-4 (-> obj faces data s3-0))
)
(while (< s3-0 s4-0)
(if (not (track-region (the-as drawable-region-face a0-4) area))
(if (not (track-region a0-4 area))
(return #f)
)
(+! s3-0 1)
(set! a0-4 (+ (+ (* s3-0 32) 16) (the-as int (-> obj faces))))
(set! a0-4 (-> obj faces data s3-0))
)
)
(track-inside-region! area (the-as drawable-region-sphere obj))
@@ -449,16 +449,16 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
"@returns Whether or not the object overlaps with the provided [[region-prim-area]]'s extent"
(let* ((v1-1 (-> obj faces length))
(a2-0 0)
(a3-2 (the-as object (+ (+ (* a2-0 32) 16) (the-as int (-> obj faces)))))
(a3-2 (-> obj faces data a2-0))
)
(while (< a2-0 v1-1)
(let ((a3-4 (-> (the-as drawable-region-face a3-2) data normal)))
(let ((a3-4 (-> a3-2 data normal)))
(if (< 0.0 (- (vector-dot (-> arg0 pos) a3-4) (-> a3-4 w)))
(return #f)
)
)
(+! a2-0 1)
(set! a3-2 (+ (+ (* a2-0 32) 16) (the-as int (-> obj faces))))
(set! a3-2 (-> obj faces data a2-0))
)
)
#t
@@ -596,7 +596,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
(while (begin (label cfg-22) (nonzero? gp-2))
(+! gp-2 -1)
(let* ((a2-5 (-> (the-as region-prim-area (+ (* gp-2 4) #x70000000)) region-enter-list 0))
(s5-2 (-> a2-5 region-prim-list items 0))
(s5-2 (-> a2-5 on-enter))
)
(when s5-2
(countdown (v1-47 (-> (the-as region-prim-area #x70000000) region-start-count))
@@ -605,7 +605,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
)
(script-eval
(the-as pair s5-2)
s5-2
:key a2-5
:vector (-> (the-as region-prim-area (+ (* gp-2 4) #x70000000)) region-enter-prim-list 0 bsphere)
)
@@ -617,7 +617,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
(while (begin (label cfg-31) (nonzero? gp-3))
(+! gp-3 -1)
(let* ((a2-6 (-> (the-as region-prim-area (+ (* gp-3 4) #x70000000)) region-exit-list 0))
(s5-3 (-> a2-6 region-prim-list items 2))
(s5-3 (-> a2-6 on-exit))
)
(when s5-3
(countdown (v1-64 (-> (the-as region-prim-area #x70000000) region-inside-count))
@@ -626,7 +626,7 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
)
(script-eval
(the-as pair s5-3)
s5-3
:key a2-6
:vector (-> (the-as region-prim-area (+ (* gp-3 4) #x70000000)) region-exit-prim-list 0 bsphere)
)
@@ -636,11 +636,11 @@ otherwise, add the [[drawable-region-sphere]] to `region-start-prim-list` and in
)
(countdown (gp-4 (-> (the-as region-prim-area #x70000000) region-inside-count))
(let* ((a2-7 (-> (the-as region-prim-area (+ (* gp-4 4) #x70000000)) region-inside-list 0))
(s5-4 (-> a2-7 region-prim-list items 1))
(s5-4 (-> a2-7 on-inside))
)
(if s5-4
(script-eval
(the-as pair s5-4)
s5-4
:key a2-7
:vector (-> (the-as region-prim-area (+ (* gp-4 4) #x70000000)) region-inside-prim-list 0 bsphere)
)