mirror of
https://github.com/open-goal/jak-project
synced 2026-09-07 19:40:48 -04:00
[jak3] More headers again again (#3359)
collide-cache-h, collide-h, projectile-h, background-h, subdivide-h, hfrag-h, shrubbery-h, tfrag-h, tie-h
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
;; name in dgo: cam-interface-h
|
||||
;; dgos: GAME
|
||||
|
||||
(define-extern math-camera-matrix (function matrix))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define-perm *camera-init-mat* matrix #f)
|
||||
|
||||
@@ -5,5 +5,143 @@
|
||||
;; name in dgo: collide-cache-h
|
||||
;; dgos: GAME
|
||||
|
||||
(defenum prim-type
|
||||
:type int8
|
||||
(prim -2)
|
||||
(sphere -1)
|
||||
(group 0)
|
||||
(mesh 1)
|
||||
(fake-prim 2)
|
||||
)
|
||||
|
||||
(declare-type collide-cache-prim structure)
|
||||
(declare-type collide-using-spheres-params structure)
|
||||
(declare-type instance-tie structure)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype collide-puss-sphere (structure)
|
||||
"A query sphere from the user for the porbe-using-spheres query.
|
||||
This is used internally by the collide-cache implementation."
|
||||
((bsphere sphere :inline)
|
||||
(bbox4w bounding-box4w :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype collide-puss-work (structure)
|
||||
"Scratchpad memory map for probe-using-spheres query."
|
||||
((closest-pt vector :inline)
|
||||
(tri-normal vector :inline)
|
||||
(tri-bbox4w bounding-box4w :inline)
|
||||
(spheres-bbox4w bounding-box4w :inline)
|
||||
(spheres collide-puss-sphere 64 :inline)
|
||||
)
|
||||
(:methods
|
||||
(check-mesh-prim-against-spheres (_type_ collide-cache-prim collide-using-spheres-params) symbol)
|
||||
(check-sphere-prim-against-spheres (_type_ collide-cache-prim collide-using-spheres-params) symbol)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype collide-cache-tri (structure)
|
||||
"A single triangle inside the collision cache.
|
||||
Contains a reference back to the source object (like a collide-shape or water-control), and the prim itself."
|
||||
((vertex vector 3 :inline)
|
||||
(extra-quad uint8 16)
|
||||
(pat pat-surface :overlay-at (-> extra-quad 0))
|
||||
(collide-ptr basic :overlay-at (-> extra-quad 4))
|
||||
(prim-index uint16 :overlay-at (-> extra-quad 8))
|
||||
(user16 uint16 :overlay-at (-> extra-quad 10))
|
||||
(user32 uint32 :overlay-at (-> extra-quad 12))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype collide-cache-prim (structure)
|
||||
"A primitive inside the collide-cache.
|
||||
This can represent a sphere, a triangle mesh, or a group of other primitives within a bounding sphere."
|
||||
((prim-core collide-prim-core :inline)
|
||||
(extra-quad uint8 16)
|
||||
(ccache collide-cache :overlay-at (-> extra-quad 0))
|
||||
(prim collide-shape-prim :overlay-at (-> extra-quad 4))
|
||||
(first-tri uint16 :overlay-at (-> extra-quad 8))
|
||||
(num-tris uint16 :overlay-at (-> extra-quad 10))
|
||||
(unused uint8 4 :overlay-at (-> extra-quad 12))
|
||||
(world-sphere vector :inline :overlay-at (-> prim-core world-sphere))
|
||||
(collide-as collide-spec :overlay-at (-> prim-core collide-as))
|
||||
(action collide-action :overlay-at (-> prim-core action))
|
||||
(prim-type prim-type :overlay-at (-> prim-core prim-type))
|
||||
)
|
||||
(:methods
|
||||
(collide-cache-prim-method-9 () none)
|
||||
(collide-cache-prim-method-10 () none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype collide-cache (basic)
|
||||
"The collide-cache is a structure to accelerate collision queries.
|
||||
In particular, it helps with queries where you don't know what you might hit.
|
||||
It can detect collision with the background geometry, foreground dynamic collision shapes (spheres and meshes), and water.
|
||||
To use it, it must first be 'filled' with geometry. Then you can manually inspect the geometry, or use one of the queries.
|
||||
The supported queries are 'line-sphere' (raycast) and 'spheres' (check if intersecting anything).
|
||||
It is not useful for ollision queries against a specific foreground object, like 'am I on top of platform X right now?'."
|
||||
((num-tris int32)
|
||||
(num-prims int32)
|
||||
(ignore-mask pat-surface)
|
||||
(ignore-processes process 2)
|
||||
(collide-box bounding-box :inline)
|
||||
(collide-box4w bounding-box4w :inline)
|
||||
(collide-with collide-spec)
|
||||
(unused uint32)
|
||||
(prims collide-cache-prim 100 :inline)
|
||||
(tris collide-cache-tri 461 :inline)
|
||||
)
|
||||
(:methods
|
||||
(collide-cache-method-9 () none)
|
||||
(collide-cache-method-10 () none)
|
||||
(collide-cache-method-11 () none)
|
||||
(collide-cache-method-12 () none)
|
||||
(collide-cache-method-13 () none)
|
||||
(collide-cache-method-14 () none)
|
||||
(collide-cache-method-15 () none)
|
||||
(collide-cache-method-16 () none)
|
||||
(collide-cache-method-17 () none)
|
||||
(collide-cache-method-18 () none)
|
||||
(collide-cache-method-19 () none)
|
||||
(collide-cache-method-20 () none)
|
||||
(collide-cache-method-21 () none)
|
||||
(collide-cache-method-22 () none)
|
||||
(collide-cache-method-23 () none)
|
||||
(collide-cache-method-24 () none)
|
||||
(collide-cache-method-25 () none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype collide-list-item (structure)
|
||||
"Entry on the broad-phase collision list.
|
||||
Can represent instanced collision, as a TIE instance, or a single non-instanced mesh fragment."
|
||||
((mesh instance-tie)
|
||||
(inst basic)
|
||||
)
|
||||
:pack-me
|
||||
)
|
||||
|
||||
|
||||
(deftype collide-list (structure)
|
||||
"List of items returned by the broad-phase collision query."
|
||||
((num-items int32)
|
||||
(items collide-list-item 256 :inline :offset 16)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(kmemopen global "collide-cache-buffers")
|
||||
|
||||
(define-perm *collide-cache* collide-cache (new 'global 'collide-cache))
|
||||
|
||||
(define-perm *collide-list* collide-list (new 'global 'collide-list))
|
||||
|
||||
(kmemclose)
|
||||
|
||||
@@ -7,3 +7,48 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype collide-query (structure)
|
||||
"Very general collision-query structure. The meaning is different depending on where it used.
|
||||
This has both inputs from the user, and collision results."
|
||||
((best-other-tri collide-tri-result :inline)
|
||||
(best-my-tri collide-tri-result :inline :overlay-at best-other-tri)
|
||||
(ignore-processes process-tree 2)
|
||||
(ignore-process0 process-tree :overlay-at (-> ignore-processes 0))
|
||||
(ignore-process1 process-tree :overlay-at (-> ignore-processes 1))
|
||||
(ignore-pat pat-surface)
|
||||
(collide-with collide-spec)
|
||||
(overlay-params uint32 3 :offset 112)
|
||||
(bbox bounding-box :inline)
|
||||
(bbox4w bounding-box4w :inline)
|
||||
(bsphere sphere :inline)
|
||||
(start-pos vector :inline)
|
||||
(move-dist vector :inline)
|
||||
(rlength vector :inline)
|
||||
(exit-planes plane 2)
|
||||
(radius float :offset 268)
|
||||
(inv-mat matrix :inline :offset 288)
|
||||
(spheres (inline-array sphere) :overlay-at (-> overlay-params 0))
|
||||
(num-spheres uint32 :overlay-at (-> overlay-params 1))
|
||||
(solid-only symbol :overlay-at (-> overlay-params 2))
|
||||
(best-dist float :overlay-at spheres)
|
||||
(best-other-prim collide-shape-prim :overlay-at num-spheres)
|
||||
(best-my-prim collide-shape-prim :overlay-at solid-only)
|
||||
(move-vec vector :inline :overlay-at move-dist)
|
||||
(best-u float :overlay-at best-dist)
|
||||
(action-mask collide-action :offset 352)
|
||||
(local-box4w bounding-box4w :inline)
|
||||
(search-box bounding-box4w :inline)
|
||||
(search-vector vector4w :inline)
|
||||
(instance-mat matrix :inline)
|
||||
(instance-ptr basic)
|
||||
(x-addr uint32)
|
||||
(x-step uint32)
|
||||
(y-addr uint32)
|
||||
(y-step uint32)
|
||||
(z-addr uint32)
|
||||
(z-step uint32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define *collide-test-flag* #f)
|
||||
|
||||
@@ -18,7 +18,7 @@ control over memory layout for use with DMA."
|
||||
(bsphere vector :inline)
|
||||
)
|
||||
(:methods
|
||||
(drawable-method-9 () none)
|
||||
(login (_type_) _type_)
|
||||
(draw (_type_ _type_ display-frame) none)
|
||||
(drawable-method-11 () none)
|
||||
(drawable-method-12 () none)
|
||||
|
||||
@@ -7,3 +7,25 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype background-work (basic)
|
||||
"List of all things for the background renderer to draw."
|
||||
((tfrag-tree-count int32)
|
||||
(tfrag-trees drawable-tree-tfrag 11)
|
||||
(tfrag-levels level 11)
|
||||
(tfrag-trans-tree-count int32)
|
||||
(tfrag-trans-trees drawable-tree-tfrag-trans 11)
|
||||
(tfrag-trans-levels level 11)
|
||||
(tfrag-water-tree-count int32)
|
||||
(tfrag-water-trees drawable-tree-tfrag-water 11)
|
||||
(tfrag-water-levels level 11)
|
||||
(shrub-tree-count int32)
|
||||
(shrub-trees drawable-tree-instance-shrub 11)
|
||||
(shrub-levels level 11)
|
||||
(tie-tree-count int32)
|
||||
(tie-trees drawable-tree-instance-tie 11)
|
||||
(tie-levels level 11)
|
||||
(tie-generic basic 11)
|
||||
(tie-generic-trans basic 11)
|
||||
(wait-to-vu0 uint32)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -7,3 +7,434 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype adgif-shader-array (inline-array-class)
|
||||
((data adgif-shader :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> adgif-shader-array heap-base) (the-as uint 80))
|
||||
|
||||
(deftype hfrag-montage (structure)
|
||||
((data uint16 16)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-bucket (structure)
|
||||
((next uint32)
|
||||
(count uint16)
|
||||
(vertex-count uint16)
|
||||
(next-scissor uint32)
|
||||
(count-scissor uint16)
|
||||
(vertex-count-scissor uint16)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-packed-index (uint16)
|
||||
()
|
||||
)
|
||||
|
||||
(deftype hfrag-vertex (structure)
|
||||
((height uint16)
|
||||
(packed-index hfrag-packed-index)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-vert-index (structure)
|
||||
((pos vector2ub :inline)
|
||||
(index0 uint16 :offset 2)
|
||||
(index1 uint16 :offset 4)
|
||||
(index2 uint16 :offset 6)
|
||||
)
|
||||
:pack-me
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-poly4 (structure)
|
||||
((data hfrag-vert-index 4 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(deftype hfrag-poly9 (structure)
|
||||
((data hfrag-vert-index 9 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(deftype hfrag-poly25 (structure)
|
||||
((data hfrag-vert-index 25 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
(deftype hfrag-poly4-chain (structure)
|
||||
((tag dma-packet :inline)
|
||||
(verts vector4w-3 4 :inline)
|
||||
(next dma-packet :inline :offset 208)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-poly9-chain (structure)
|
||||
((tag dma-packet :inline)
|
||||
(verts vector4w-3 12 :inline)
|
||||
(next dma-packet :inline :offset 592)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-poly25-chain (structure)
|
||||
((tag dma-packet :inline)
|
||||
(verts vector4w-3 40 :inline)
|
||||
(next dma-packet :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-cache-vertex (structure)
|
||||
((color vector4w :inline)
|
||||
(pos vector :inline)
|
||||
(clip uint32 :overlay-at (-> pos data 3))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-cache-line (structure)
|
||||
((data hfrag-cache-vertex 9 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-visbits (structure)
|
||||
((data uint8 128)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-gcf-control (structure)
|
||||
((matrix matrix :inline)
|
||||
(giftag generic-gif-tag :inline)
|
||||
(adnops gs-adcmd 2 :inline)
|
||||
(num-strips uint32 :overlay-at (-> giftag data 3))
|
||||
(num-dps uint32 :overlay-at (-> adnops 0 word 3))
|
||||
(kick-offset uint32 :offset 108)
|
||||
(shader gcf-shader :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-gcf-ctrl (structure)
|
||||
((tag dma-packet :inline)
|
||||
(control hfrag-gcf-control :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-init-packet (structure)
|
||||
((init-tmpl dma-packet :inline)
|
||||
(init-data uint32 8)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-sprite-coord (structure)
|
||||
((pos0 vector4w :inline)
|
||||
(pos1 vector4w :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-montage-coord (structure)
|
||||
((stq0 vector4 :inline)
|
||||
(stq1 vector4 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-sprite-packet (structure)
|
||||
((sprite-tmpl dma-gif-packet :inline)
|
||||
(color vector4w :inline)
|
||||
(tex0 vector :inline)
|
||||
(pos0 vector4w :inline)
|
||||
(tex1 vector :inline)
|
||||
(pos1 vector4w :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-tex-data (structure)
|
||||
((quad qword 3 :inline)
|
||||
(prims uint64 6 :overlay-at quad)
|
||||
(reg-0 uint8 :overlay-at (-> quad 0 data 2))
|
||||
(reg-1 uint8 :overlay-at (-> prims 3))
|
||||
(reg-2 uint8 :overlay-at (-> prims 5))
|
||||
(tex0 uint64 :overlay-at (-> quad 0 data 0))
|
||||
(tex1 uint64 :overlay-at (-> prims 2))
|
||||
(texflush uint64 :overlay-at (-> prims 4))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
; (deftype hfrag-mip-packet (structure)
|
||||
; ((mip-tmpl dma-gif-packet :inline)
|
||||
; (tex0-1 vector :inline)
|
||||
; (tex1-1 vector :inline)
|
||||
; (texflush vector :inline)
|
||||
; (color vector4w :inline)
|
||||
; (tex0 vector :inline)
|
||||
; (pos0 vector :inline)
|
||||
; (tex1 vector :inline)
|
||||
; (pos1 vector :inline)
|
||||
; )
|
||||
; )
|
||||
|
||||
|
||||
(deftype hfrag-adgif-packet (structure)
|
||||
((adgif-tmpl dma-gif-packet :inline)
|
||||
(adgif-data adgif-shader :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-adgif-packet2 (structure)
|
||||
((adgif-tmpl dma-gif-packet :inline)
|
||||
(adgif-data adgif-shader :inline)
|
||||
(texflush uint128)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-frame (structure)
|
||||
((quad qword 4 :inline :offset 0)
|
||||
(prims uint64 8 :overlay-at quad)
|
||||
(reg-0 uint8 :overlay-at (-> prims 1))
|
||||
(reg-1 uint8 :overlay-at (-> prims 3))
|
||||
(reg-2 uint8 :overlay-at (-> prims 5))
|
||||
(reg-3 uint8 :overlay-at (-> prims 7))
|
||||
(frame uint64 :overlay-at (-> prims 0))
|
||||
(scissor uint64 :overlay-at (-> prims 2))
|
||||
(xyoffset uint64 :overlay-at (-> prims 4))
|
||||
(test uint64 :overlay-at (-> prims 6))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-frame-packet (structure)
|
||||
((frame-tmpl dma-gif-packet :inline)
|
||||
(frame-data hfrag-frame :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfragment (drawable)
|
||||
((start-corner vector :inline)
|
||||
(spheres uint32)
|
||||
(visids uint32)
|
||||
(shaders (inline-array adgif-shader))
|
||||
(colors basic)
|
||||
(montage uint32)
|
||||
(buckets-far uint32)
|
||||
(buckets-mid uint32)
|
||||
(buckets-near uint32)
|
||||
(verts uint32)
|
||||
(pat-array uint32)
|
||||
(pat-length uint16)
|
||||
(num-buckets-far uint16)
|
||||
(num-buckets-mid uint16)
|
||||
(num-buckets-near uint16)
|
||||
(size uint32 :overlay-at (-> start-corner data 3))
|
||||
)
|
||||
(:methods
|
||||
(hfragment-method-17 () none)
|
||||
(hfragment-method-18 () none)
|
||||
(hfragment-method-19 () none)
|
||||
(hfragment-method-20 () none)
|
||||
(hfragment-method-21 () none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defmethod login ((this hfragment))
|
||||
"Initialize the object after it is loaded."
|
||||
(dotimes (s5-0 3)
|
||||
(adgif-shader-login (-> this shaders s5-0))
|
||||
(if (> s5-0 0)
|
||||
(set! (-> this shaders s5-0 tex0 tcc) 0)
|
||||
)
|
||||
(set! (-> this shaders 1 tex0 cbp) 3904)
|
||||
(set! (-> this shaders 2 tex0 cbp) 3904)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
(deftype hfrag-dma (structure)
|
||||
((banka uint32 340)
|
||||
(bankb uint32 340)
|
||||
(outa uint128 227)
|
||||
(outb uint128 227)
|
||||
(cache hfrag-cache-line 8 :inline)
|
||||
(colors rgba 1024)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-work (structure)
|
||||
((far-chaina dma-packet 6 :inline)
|
||||
(far-chainb dma-packet 6 :inline)
|
||||
(mid-chaina dma-packet 10 :inline)
|
||||
(mid-chainb dma-packet 10 :inline)
|
||||
(near-chaina dma-packet 18 :inline)
|
||||
(near-chainb dma-packet 18 :inline)
|
||||
(poly4-tmpl dma-packet 3 :inline)
|
||||
(poly9-tmpl dma-packet 3 :inline)
|
||||
(poly25-tmpl dma-packet 3 :inline)
|
||||
(init-tmpl dma-packet 3 :inline)
|
||||
(control-tmpl dma-packet 2 :inline :offset 1376)
|
||||
(heights4-tmpl dma-packet 2 :inline)
|
||||
(colors4-tmpl dma-packet 2 :inline)
|
||||
(heights9-tmpl dma-packet 2 :inline)
|
||||
(colors9-tmpl dma-packet 2 :inline)
|
||||
(heights25-tmpl dma-packet 2 :inline)
|
||||
(colors25-tmpl dma-packet 2 :inline)
|
||||
(init-vu1-tmpl dma-packet 2 :inline)
|
||||
(next-tmpl dma-packet :inline :offset 1696)
|
||||
(call-tmpl dma-packet :inline)
|
||||
(ret-tmpl dma-packet :inline)
|
||||
(next-scissor-tmpl dma-packet :inline)
|
||||
(ret-scissor-tmpl dma-packet :inline)
|
||||
(frame-tmpl dma-gif-packet :inline)
|
||||
(frames hfrag-frame 5 :inline)
|
||||
(adgif-tmpl dma-gif-packet :inline)
|
||||
(adgif-tmpl2 dma-gif-packet :inline)
|
||||
(sprite-tmpl dma-gif-packet :inline)
|
||||
(mip-tmpl dma-gif-packet :inline)
|
||||
(color uint128 6)
|
||||
(far-data hfrag-sprite-coord :inline)
|
||||
(near-data vector4w-2 16 :inline)
|
||||
(mip-data vector4w-3 7 :inline :offset 2896)
|
||||
(tex-data hfrag-tex-data 5 :offset 3120)
|
||||
(tex uint128 6 :offset 3360)
|
||||
(montage-tex-coords uint128 128 :offset 3456)
|
||||
(giftag generic-gif-tag :inline :offset 7552)
|
||||
(call-abort dma-packet :inline)
|
||||
(call-abort-vu1 dma-packet :inline)
|
||||
(shader-far adgif-shader :inline)
|
||||
(shader-mid adgif-shader :inline)
|
||||
(shader-near adgif-shader :inline)
|
||||
(stq uint128 9)
|
||||
(shader adgif-shader :inline)
|
||||
(constants vector :inline)
|
||||
(pos-temp vector4w :inline)
|
||||
(trans-temp vector :inline :overlay-at (-> pos-temp data 0))
|
||||
(dists vector :inline)
|
||||
(rdists vector :inline)
|
||||
(call-poly4-near uint32)
|
||||
(call-poly9-mid uint32)
|
||||
(call-poly9-near uint32)
|
||||
(call-poly25-far uint32)
|
||||
(call-poly25-mid uint32)
|
||||
(dma-buffer basic)
|
||||
(base uint32)
|
||||
(wait-to-spr uint32)
|
||||
(wait-from-spr uint32)
|
||||
(buffer-end uint32)
|
||||
(subdiv-index uint32)
|
||||
(scissor basic)
|
||||
(chain-ptr uint32)
|
||||
(chain-ptr-next uint32)
|
||||
(near-dist float)
|
||||
(far-dist float)
|
||||
(to-spr uint32)
|
||||
(from-spr uint32)
|
||||
(lowres-flag basic)
|
||||
(hfrag hfragment :inline)
|
||||
(next-far int16)
|
||||
(next-far-mid int16)
|
||||
(next-mid int16)
|
||||
(next-near-mid int16)
|
||||
(next-near int16)
|
||||
(next-far-scissor int16)
|
||||
(next-near-mid-scissor int16)
|
||||
(next-near-scissor int16)
|
||||
(count-far int16)
|
||||
(count-far-mid int16)
|
||||
(count-mid int16)
|
||||
(count-near-mid int16)
|
||||
(count-near int16)
|
||||
(count-far-scissor int16)
|
||||
(count-near-mid-scissor int16)
|
||||
(count-near-scissor int16)
|
||||
(size-far int32)
|
||||
(size-far-mid int32)
|
||||
(size-mid int32)
|
||||
(size-near-mid int32)
|
||||
(size-near int32)
|
||||
(size-far-scissor int32)
|
||||
(size-near-mid-scissor int32)
|
||||
(size-near-scissor int32)
|
||||
(size-texture int32)
|
||||
(poly-far hfrag-poly25)
|
||||
(poly-mid25 uint32)
|
||||
(poly-mid uint32)
|
||||
(poly-near uint32)
|
||||
(far-texture uint32)
|
||||
(near-textures uint16 16)
|
||||
(draw-table uint16 1024 :offset 8456)
|
||||
(corners uint128 1024)
|
||||
)
|
||||
(:methods
|
||||
(hfrag-work-method-9 () none)
|
||||
(hfrag-work-method-10 () none)
|
||||
(hfrag-work-method-11 () none)
|
||||
(hfrag-work-method-12 () none)
|
||||
(hfrag-work-method-13 () none)
|
||||
(hfrag-work-method-14 () none)
|
||||
(hfrag-work-method-15 () none)
|
||||
(hfrag-work-method-16 () none)
|
||||
(hfrag-work-method-17 () none)
|
||||
(hfrag-work-method-18 () none)
|
||||
(hfrag-work-method-19 () none)
|
||||
(hfrag-work-method-20 () none)
|
||||
(hfrag-work-method-21 () none)
|
||||
(hfrag-work-method-22 () none)
|
||||
(hfrag-work-method-23 () none)
|
||||
(hfrag-work-method-24 () none)
|
||||
(hfrag-work-method-25 () none)
|
||||
(hfrag-work-method-26 () none)
|
||||
(hfrag-work-method-27 () none)
|
||||
(hfrag-work-method-28 () none)
|
||||
(hfrag-work-method-29 () none)
|
||||
(hfrag-work-method-30 () none)
|
||||
(hfrag-work-method-31 () none)
|
||||
(hfrag-work-method-32 () none)
|
||||
(hfrag-work-method-33 () none)
|
||||
(hfrag-work-method-34 () none)
|
||||
(hfrag-work-method-35 () none)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype hfrag-mip-packet (structure)
|
||||
((mip-tmpl dma-gif-packet :inline)
|
||||
(tex0-1 vector :inline)
|
||||
(tex1-1 vector :inline)
|
||||
(texflush vector :inline)
|
||||
(color vector4w :inline)
|
||||
(tex0 vector :inline)
|
||||
(pos0 vector :inline)
|
||||
(tex1 vector :inline)
|
||||
(pos1 vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype hfrag-mip-packet-array (structure)
|
||||
((data hfrag-mip-packet 6 :inline)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -7,3 +7,150 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype subdivide-settings (basic)
|
||||
"Input settings for distances for switching mesh level of details.
|
||||
These are set by the level code and read by rendering code."
|
||||
((dist float 5)
|
||||
(meters float 5)
|
||||
(close float 12)
|
||||
(far float 12)
|
||||
)
|
||||
(:methods
|
||||
(new (symbol type float float) _type_)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defmethod new subdivide-settings ((allocation symbol) (type-to-make type) (arg0 float) (arg1 float))
|
||||
(let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
(dotimes (v1-2 10)
|
||||
(set! (-> v0-0 close v1-2) arg0)
|
||||
(set! (-> v0-0 far v1-2) arg1)
|
||||
)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
|
||||
(deftype subdivide-dists (structure)
|
||||
"Unused subdivide distances. Internally, tfrag/tie figure these out instead."
|
||||
((data uint32 32 :offset 0)
|
||||
(vector vector 8 :overlay-at (-> data 0))
|
||||
(k0s uint128 4 :overlay-at (-> data 0))
|
||||
(k1s uint128 4 :overlay-at (-> data 16))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype terrain-stats (structure)
|
||||
"Desptie the name `terrain-stats`, these are more general triangle stats for all renderers."
|
||||
((pris tr-stat :inline)
|
||||
(tie-generic tr-stat :inline)
|
||||
(tie-vanish tr-stat :inline)
|
||||
(tie tr-stat :inline)
|
||||
(tie-scissor tr-stat :inline)
|
||||
(tie-envmap tr-stat :inline)
|
||||
(tie-envmap-scissor tr-stat :inline)
|
||||
(tie-trans tr-stat :inline)
|
||||
(tie-scissor-trans tr-stat :inline)
|
||||
(tie-envmap-trans tr-stat :inline)
|
||||
(tie-envmap-scissor-trans tr-stat :inline)
|
||||
(tie-water tr-stat :inline)
|
||||
(tie-scissor-water tr-stat :inline)
|
||||
(tie-envmap-water tr-stat :inline)
|
||||
(tie-envmap-scissor-water tr-stat :inline)
|
||||
(shrub-near tr-stat :inline)
|
||||
(shrub tr-stat :inline)
|
||||
(tfrag-scissor tr-stat :inline)
|
||||
(tfrag tr-stat :inline)
|
||||
(billboard tr-stat :inline)
|
||||
(tfrag-trans tr-stat :inline)
|
||||
(tfrag-scissor-trans tr-stat :inline)
|
||||
(tfrag-water tr-stat :inline)
|
||||
(tfrag-scissor-water tr-stat :inline)
|
||||
(trans-pris tr-stat :inline)
|
||||
(trans-shrub tr-stat :inline)
|
||||
(ocean-mid tr-stat :inline)
|
||||
(ocean-near tr-stat :inline)
|
||||
(shadow tr-stat :inline)
|
||||
(hfrag tr-stat :inline)
|
||||
(total tr-stat :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype background-area (structure)
|
||||
"Scratchpad memory layout for most background rendering
|
||||
This uses the full scratchpad so it should only be used when the stack isn't on the scratchpad (rendering code).
|
||||
Interestingly, dma-area went from a union of all the -dma types to a plain array of bytes in jak 3."
|
||||
((dma-area uint8 14336)
|
||||
(vis-list uint8 2048)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype foreground-area (structure)
|
||||
"Scratchpad memory layout for most foreground rendering."
|
||||
((generic-work generic-work :inline :offset 0)
|
||||
(foreground-work foreground-work :inline :offset 0)
|
||||
(joint-work joint-work :inline :offset 0)
|
||||
(bone-mem bone-memory :inline :offset 0)
|
||||
(shadow-work shadow-work :inline :offset 0)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype region-prim-area (structure)
|
||||
"Scratchpad memory layout for regions."
|
||||
((region-prim-list region-prim-list :inline)
|
||||
(pos vector :inline)
|
||||
(ray vector :inline :offset 1328)
|
||||
(region-enter-count int32 :offset 1360)
|
||||
(region-enter-list region 320)
|
||||
(region-enter-prim-list drawable-region-sphere 320)
|
||||
(region-exit-count int32)
|
||||
(region-exit-list region 320)
|
||||
(region-exit-prim-list drawable-region-sphere 320)
|
||||
(region-inside-count int32)
|
||||
(region-inside-list region 320)
|
||||
(region-inside-prim-list drawable-region-sphere 320)
|
||||
(region-start-count int32)
|
||||
(region-start-list region 320)
|
||||
(region-start-prim-list drawable-region-sphere 320)
|
||||
)
|
||||
(:methods
|
||||
(region-prim-area-method-9 () none)
|
||||
(region-prim-area-method-10 () none)
|
||||
(region-prim-area-method-11 () none)
|
||||
(region-prim-area-method-12 () none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype sprite-area (structure)
|
||||
"Scratchpad memory layout for sprites."
|
||||
((clock-data vector 22 :inline)
|
||||
(buffer uint8 :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype work-area (structure)
|
||||
"All scratchpad memory layouts."
|
||||
((background background-area :inline :offset 0)
|
||||
(foreground foreground-area :inline :offset 0)
|
||||
(region-prim region-prim-area :inline :offset 0)
|
||||
(sprite sprite-area :inline :offset 0)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype terrain-context (structure)
|
||||
"Useless wrapper around work-area. (this added some stuff in jak 1)"
|
||||
((work work-area :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define *terrain-stats* (new 'global 'terrain-stats))
|
||||
|
||||
(define *collide-stats* (new 'global 'collide-stats))
|
||||
|
||||
@@ -7,3 +7,210 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype tfragment-stats (structure)
|
||||
"Triangle and vertex stats for a single tfragment."
|
||||
((num-tris uint16 4)
|
||||
(num-dverts uint16 4)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfragment-debug-data (structure)
|
||||
"Optional debug information (stats, lines) for a tfragment."
|
||||
((stats tfragment-stats :inline)
|
||||
(debug-lines (array vector-array))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype generic-tfragment (structure)
|
||||
"Unused. Could have been a way to render tfrag's through generic."
|
||||
((dummy int32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfragment (drawable)
|
||||
"A tfrag mesh fragment. This is just references to DMA data, plus some metadata."
|
||||
((color-index uint16 :offset 6)
|
||||
(debug-data tfragment-debug-data :offset 8)
|
||||
(color-indices uint32 :offset 12)
|
||||
(colors uint32 :overlay-at color-indices)
|
||||
(dma-chain uint32 3 :offset 32)
|
||||
(dma-common uint32 :overlay-at (-> dma-chain 0))
|
||||
(dma-level-0 uint32 :overlay-at dma-common)
|
||||
(dma-base uint32 :overlay-at (-> dma-chain 1))
|
||||
(dma-level-1 uint32 :overlay-at (-> dma-chain 2))
|
||||
(dma-qwc uint8 4 :offset 44)
|
||||
(shader (inline-array adgif-shader) :offset 48)
|
||||
(num-shaders uint8 :offset 52)
|
||||
(num-base-colors uint8 :offset 53)
|
||||
(num-level0-colors uint8 :offset 54)
|
||||
(num-level1-colors uint8 :offset 55)
|
||||
(color-offset uint8 :offset 56)
|
||||
(color-count uint8 :offset 57)
|
||||
(texture-masks-index uint16 :offset 58)
|
||||
(generic generic-tfragment :offset 60)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype drawable-inline-array-tfrag (drawable-inline-array)
|
||||
"Array of tfragments"
|
||||
((data tfragment 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype drawable-inline-array-tfrag-trans (drawable-inline-array-tfrag)
|
||||
((data2 tfragment 1 :inline)
|
||||
(pad2 uint32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype drawable-inline-array-tfrag-water (drawable-inline-array-tfrag)
|
||||
((data2 tfragment 1 :inline)
|
||||
(pad2 uint32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype drawable-tree-tfrag (drawable-tree)
|
||||
"top level tfrag tree."
|
||||
((time-of-day-pal time-of-day-palette :offset 12)
|
||||
(arrays drawable-inline-array :dynamic :offset 32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype drawable-tree-tfrag-trans (drawable-tree-tfrag)
|
||||
()
|
||||
)
|
||||
|
||||
(deftype drawable-tree-tfrag-water (drawable-tree-tfrag-trans)
|
||||
()
|
||||
)
|
||||
|
||||
(deftype tfrag-dists (structure)
|
||||
"Distances for mesh level-of-detail blending for use on VU1."
|
||||
((data uint32 16)
|
||||
(vector vector 4 :overlay-at (-> data 0))
|
||||
(k0s vector 2 :overlay-at (-> data 0))
|
||||
(k1s vector 2 :overlay-at (-> data 8))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfrag-data (structure)
|
||||
"Constants for VU1 data memory for tfrag rendering."
|
||||
((data uint32 56)
|
||||
(vector vector 14 :overlay-at (-> data 0))
|
||||
(fog vector :inline :overlay-at (-> data 0))
|
||||
(val vector :inline :overlay-at (-> data 4))
|
||||
(strgif gs-gif-tag :inline :overlay-at (-> data 8))
|
||||
(fangif gs-gif-tag :inline :overlay-at (-> data 12))
|
||||
(adgif gs-gif-tag :inline :overlay-at (-> data 16))
|
||||
(hvdf-offset vector :inline :overlay-at (-> data 20))
|
||||
(hmge-scale vector :inline :overlay-at (-> data 24))
|
||||
(invh-scale vector :inline :overlay-at (-> data 28))
|
||||
(ambient vector :inline :overlay-at (-> data 32))
|
||||
(guard vector :inline :overlay-at (-> data 36))
|
||||
(dists tfrag-dists :inline :overlay-at (-> data 40))
|
||||
(k0s uint128 2 :overlay-at (-> data 40))
|
||||
(k1s uint128 2 :overlay-at (-> data 48))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfrag-control (structure)
|
||||
"VU1 'control' data containing address and counters."
|
||||
((num-base-points uint32)
|
||||
(num-shared-base-points uint32)
|
||||
(num-level0-points uint32)
|
||||
(num-shared-level0-points uint32)
|
||||
(num-level1-points uint32)
|
||||
(num-shared-level1-points uint32)
|
||||
(ptr-vtxdata uint32)
|
||||
(ptr-base-points uint32)
|
||||
(ptr-shared-base-points uint32)
|
||||
(ptr-level0-points uint32)
|
||||
(ptr-shared-level0-points uint32)
|
||||
(ptr-level1-points uint32)
|
||||
(ptr-shared-level1-points uint32)
|
||||
(ptr-draw-points uint32)
|
||||
(ptr-interpolated-0 uint32)
|
||||
(ptr-shared-interpolated-0 uint32)
|
||||
(ptr-interpolated1 uint32)
|
||||
(ptr-shared-interpolated1 uint32)
|
||||
(ptr-strip-data uint32)
|
||||
(ptr-texture-data uint32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfrag-stats (structure)
|
||||
"TFRAG statistics computed on EE."
|
||||
((from int32)
|
||||
(to int32)
|
||||
(cnt int32)
|
||||
(tris int32)
|
||||
(tfaces int32)
|
||||
(tfrags int32)
|
||||
(dtris int32)
|
||||
(base-verts int32)
|
||||
(level0-verts int32)
|
||||
(level1-verts int32)
|
||||
(dma-cnt int32)
|
||||
(dma-dta int32)
|
||||
(dma-tex int32)
|
||||
(strips int32)
|
||||
(drawpoints int32)
|
||||
(vif int32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfrag-packet (structure)
|
||||
((tag uint128 2)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfrag-work (structure)
|
||||
"Scratch space for generating TFRAG DMA."
|
||||
((base-tmpl dma-packet :inline)
|
||||
(level-0-tmpl dma-packet :inline)
|
||||
(common-tmpl dma-packet :inline)
|
||||
(level-1-tmpl dma-packet :inline)
|
||||
(color-tmpl dma-packet :inline)
|
||||
(frag-dists vector :inline)
|
||||
(min-dist vector :inline)
|
||||
(color-ptr vector4w :inline)
|
||||
(tr-stat-tfrag tr-stat)
|
||||
(tr-stat-tfrag-scissor tr-stat)
|
||||
(vu1-enable-tfrag int32)
|
||||
(vu1-enable-tfrag-scissor int32)
|
||||
(cur-vis-bits uint32)
|
||||
(end-vis-bits uint32)
|
||||
(src-ptr uint32)
|
||||
(last-call uint32)
|
||||
(dma-buffer basic)
|
||||
(test-id uint32)
|
||||
(wait-from-spr uint32)
|
||||
(wait-to-spr uint32)
|
||||
(near-wait-from-spr uint32)
|
||||
(near-wait-to-spr uint32)
|
||||
(max-fragment uint16)
|
||||
(min-fragment uint16)
|
||||
(texture-dists uint32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tfrag-dma (structure)
|
||||
"Memory layout for to/from scratchpad for tfrag."
|
||||
((banka tfragment 16 :inline)
|
||||
(bankb tfragment 16 :inline)
|
||||
(outa uint128 128)
|
||||
(outb uint128 128)
|
||||
(colors rgba 2047)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -7,3 +7,308 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype tie-fragment-debug (structure)
|
||||
"Optional debug information about a tie-fragment."
|
||||
((num-tris uint16)
|
||||
(num-dverts uint16)
|
||||
(debug-lines (array vector-array))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype tie-fragment (drawable)
|
||||
"A mesh fragment of a TIE. This is a chunk of mesh that is rendered by VU1, stored as DMA chains."
|
||||
((gif-ref (inline-array adgif-shader) :overlay-at id)
|
||||
(point-ref uint32 :offset 8)
|
||||
(color-index uint16 :offset 12)
|
||||
(base-colors uint8 :offset 14)
|
||||
(tex-count uint16 :offset 32)
|
||||
(gif-count uint16 :offset 34)
|
||||
(vertex-count uint16 :offset 36)
|
||||
(color-count uint16)
|
||||
(dp-ref uint32)
|
||||
(dp-qwc uint32)
|
||||
(generic-ref uint32)
|
||||
(generic-count uint16)
|
||||
(normal-count uint16)
|
||||
(normal-ref uint32)
|
||||
(debug tie-fragment-debug)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype instance-tie (instance)
|
||||
"A TIE model instance."
|
||||
((color-indices uint32 :offset 8)
|
||||
(bucket-ptr prototype-bucket-tie :offset 12)
|
||||
(max-scale uint16 :overlay-at (-> origin data 3))
|
||||
(rmin-scale uint16 :overlay-at (-> origin data 11))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype drawable-inline-array-instance-tie (drawable-inline-array)
|
||||
"Array of tie instances stored in the level."
|
||||
((data instance-tie 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype drawable-tree-instance-tie (drawable-tree)
|
||||
"Top-level drawable-tree for TIEs"
|
||||
((prototypes proxy-prototype-array-tie :offset 8)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype prototype-tie (drawable-inline-array)
|
||||
"Prototype for a TIE: just an array of fragments."
|
||||
((data tie-fragment 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype tie-matrix (structure)
|
||||
"Per-instance matrix for TIE VU1 rendering."
|
||||
((mat matrix :inline)
|
||||
(morph qword :inline)
|
||||
(fog qword :inline)
|
||||
(envmap-flag uint32 :overlay-at (-> fog data 0))
|
||||
(guard-flag uint32 :overlay-at (-> fog data 1))
|
||||
(vertex-alpha float :overlay-at (-> fog data 2))
|
||||
(fog-value float :overlay-at (-> fog data 3))
|
||||
(fixed-alpha float :overlay-at (-> morph data 1))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype instance-tie-work (structure)
|
||||
"workspace for TIE instance DMA generation"
|
||||
((wind-const vector :inline)
|
||||
(hmge-d vector :inline)
|
||||
(hvdf-offset vector :inline)
|
||||
(wind-force vector :inline)
|
||||
(constant vector :inline)
|
||||
(far-morph vector :inline)
|
||||
(dist-test vector :inline)
|
||||
(min-dist vector :inline)
|
||||
(guard-plane plane 4 :inline)
|
||||
(upload-color-0 dma-packet :inline)
|
||||
(upload-color-1 dma-packet :inline)
|
||||
(upload-color-2 dma-packet :inline)
|
||||
(upload-color-ret dma-packet :inline)
|
||||
(upload-color-temp dma-packet :inline)
|
||||
(generic-color-0 dma-packet :inline)
|
||||
(generic-color-1 dma-packet :inline)
|
||||
(generic-color-end dma-packet :inline)
|
||||
(envmap-color-0 dma-packet :inline)
|
||||
(envmap-color-1 dma-packet :inline)
|
||||
(tie-scissor-perspective-matrix matrix :inline)
|
||||
(tod-env-color vector :inline)
|
||||
(morph-temp vector :inline)
|
||||
(fog-temp vector :inline)
|
||||
(fade-temp float)
|
||||
(wind-vectors uint32)
|
||||
(test-id uint32)
|
||||
(test-id2 uint32)
|
||||
(dma-buffer basic)
|
||||
(to-spr uint32)
|
||||
(from-spr uint32)
|
||||
(wind-work uint32)
|
||||
(cur-vis-bits uint32)
|
||||
(end-vis-bits uint32)
|
||||
(refl-fade-fac float)
|
||||
(refl-fade-end float)
|
||||
(flags uint32)
|
||||
(vanish-flag uint32)
|
||||
(translucent-flag uint32)
|
||||
(wait-from-spr uint32)
|
||||
(wait-to-spr uint32)
|
||||
(use-etie symbol)
|
||||
(buffer-start uint32)
|
||||
(buffer-end uint32)
|
||||
(tfrag-dists uint32)
|
||||
(alpha-dists uint32)
|
||||
(water-dists uint32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype instance-tie-dma (structure)
|
||||
"Scratchpad memory layout for TIE instance DMA generation."
|
||||
((banka instance-tie 32 :inline)
|
||||
(bankb instance-tie 32 :inline)
|
||||
(outa uint128 256)
|
||||
(outb uint128 256)
|
||||
(work instance-tie-work :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype prototype-tie-work (structure)
|
||||
"workspace for TIE protype DMA generation."
|
||||
((upload-flushe dma-packet :inline)
|
||||
(upload-palette dma-packet :inline)
|
||||
(upload-model-0 dma-packet :inline)
|
||||
(upload-model-1 dma-packet :inline)
|
||||
(upload-model-2 dma-packet :inline)
|
||||
(upload-model-3 dma-packet :inline)
|
||||
(upload-model-near-0 dma-packet :inline)
|
||||
(upload-model-near-1 dma-packet :inline)
|
||||
(upload-model-near-2 dma-packet :inline)
|
||||
(upload-model-near-3 dma-packet :inline)
|
||||
(upload-model-near-4 dma-packet :inline)
|
||||
(envmap-palette dma-packet :inline)
|
||||
(envmap-shader dma-packet :inline)
|
||||
(upload-envmap-0 dma-packet :inline)
|
||||
(upload-envmap-1 dma-packet :inline)
|
||||
(upload-envmap-2 dma-packet :inline)
|
||||
(upload-envmap-3 dma-packet :inline)
|
||||
(upload-envmap-4 dma-packet :inline)
|
||||
(upload-envmap-scissor-4 dma-packet :inline)
|
||||
(generic-palette dma-packet :inline)
|
||||
(generic-model-0 dma-packet :inline)
|
||||
(generic-model-1 dma-packet :inline)
|
||||
(generic-model-2 dma-packet :inline)
|
||||
(model-next dma-packet :inline)
|
||||
(clamp uint64)
|
||||
(prototype-array basic)
|
||||
(wait-from-spr uint32)
|
||||
(wait-to-spr uint32)
|
||||
(mood mood-context)
|
||||
(last uint32 16 :offset 416)
|
||||
(next uint32 16)
|
||||
(count uint16 16)
|
||||
(tie-last uint32 :overlay-at (-> last 0))
|
||||
(tie-next uint32 :overlay-at (-> next 0))
|
||||
(tie-count uint16 :overlay-at (-> count 0))
|
||||
(trans-last uint32 :overlay-at (-> last 1))
|
||||
(trans-next uint32 :overlay-at (-> next 1))
|
||||
(trans-count uint16 :overlay-at (-> count 1))
|
||||
(water-last uint32 :overlay-at (-> last 2))
|
||||
(water-next uint32 :overlay-at (-> next 2))
|
||||
(water-count uint16 :overlay-at (-> count 2))
|
||||
(scissor-last uint32 :overlay-at (-> last 3))
|
||||
(scissor-next uint32 :overlay-at (-> next 3))
|
||||
(scissor-count uint16 :overlay-at (-> count 3))
|
||||
(scissor-trans-last uint32 :overlay-at (-> last 4))
|
||||
(scissor-trans-next uint32 :overlay-at (-> next 4))
|
||||
(scissor-trans-count uint16 :overlay-at (-> count 4))
|
||||
(scissor-water-last uint32 :overlay-at (-> last 5))
|
||||
(scissor-water-next uint32 :overlay-at (-> next 5))
|
||||
(scissor-water-count uint16 :overlay-at (-> count 5))
|
||||
(envmap-last uint32 :overlay-at (-> last 6))
|
||||
(envmap-next uint32 :overlay-at (-> next 6))
|
||||
(envmap-count uint16 :overlay-at (-> count 6))
|
||||
(envmap-trans-last uint32 :overlay-at (-> last 7))
|
||||
(envmap-trans-next uint32 :overlay-at (-> next 7))
|
||||
(envmap-trans-count uint16 :overlay-at (-> count 7))
|
||||
(envmap-water-last uint32 :overlay-at (-> last 8))
|
||||
(envmap-water-next uint32 :overlay-at (-> next 8))
|
||||
(envmap-water-count uint16 :overlay-at (-> count 8))
|
||||
(envmap-scissor-last uint32 :overlay-at (-> last 9))
|
||||
(envmap-scissor-next uint32 :overlay-at (-> next 9))
|
||||
(envmap-scissor-count uint16 :overlay-at (-> count 9))
|
||||
(envmap-scissor-trans-last uint32 :overlay-at (-> last 10))
|
||||
(envmap-scissor-trans-next uint32 :overlay-at (-> next 10))
|
||||
(envmap-scissor-trans-count uint16 :overlay-at (-> count 10))
|
||||
(envmap-scissor-water-last uint32 :overlay-at (-> last 11))
|
||||
(envmap-scissor-water-next uint32 :overlay-at (-> next 11))
|
||||
(envmap-scissor-water-count uint16 :overlay-at (-> count 11))
|
||||
(generic-last uint32 :overlay-at (-> last 12))
|
||||
(generic-next uint32 :overlay-at (-> next 12))
|
||||
(generic-count uint16 :overlay-at (-> count 12))
|
||||
(generic-trans-last uint32 :overlay-at (-> last 13))
|
||||
(generic-trans-next uint32 :overlay-at (-> next 13))
|
||||
(generic-trans-count uint16 :overlay-at (-> count 13))
|
||||
(generic-water-last uint32 :overlay-at (-> last 14))
|
||||
(generic-water-next uint32 :overlay-at (-> next 14))
|
||||
(generic-water-count uint16 :overlay-at (-> count 14))
|
||||
(vanish-last uint32 :overlay-at (-> last 15))
|
||||
(vanish-next uint32 :overlay-at (-> next 15))
|
||||
(vanish-count uint16 :overlay-at (-> count 15))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype prototype-tie-dma (structure)
|
||||
((colora rgba 256)
|
||||
(colorb rgba 256)
|
||||
(outa uint128 256)
|
||||
(outb uint128 256)
|
||||
(geometry uint32 4)
|
||||
(next uint32 12)
|
||||
(count uint16 12)
|
||||
(counts uint32 4)
|
||||
(palette-ptr uint32 :overlay-at (-> counts 2))
|
||||
(model-ptr uint32 :overlay-at (-> counts 3))
|
||||
(ret-ptr uint32)
|
||||
(length uint32)
|
||||
(flags uint32)
|
||||
(dma-buffer basic)
|
||||
(this-frag-count uint32)
|
||||
(frag-count uint8 4)
|
||||
(from-spr uint32)
|
||||
(to-spr uint32)
|
||||
(spr-out uint32)
|
||||
(this-count uint32)
|
||||
(scissor-geometry uint32 :overlay-at (-> geometry 0))
|
||||
(near-geometry uint32 :overlay-at (-> geometry 1))
|
||||
(mid-geometry uint32 :overlay-at (-> geometry 2))
|
||||
(far-geometry uint32 :overlay-at (-> geometry 3))
|
||||
(scissor-frag-count uint8 :overlay-at (-> frag-count 0))
|
||||
(near-frag-count uint8 :overlay-at (-> frag-count 1))
|
||||
(mid-frag-count uint8 :overlay-at (-> frag-count 2))
|
||||
(far-frag-count uint8 :overlay-at (-> frag-count 3))
|
||||
(tie-scissor-next uint32 :overlay-at (-> next 0))
|
||||
(tie-near-next uint32 :overlay-at (-> next 1))
|
||||
(tie-mid-next uint32 :overlay-at (-> next 2))
|
||||
(tie-far-next uint32 :overlay-at (-> next 3))
|
||||
(trans-scissor-next uint32 4 :overlay-at (-> next 0))
|
||||
(trans-near-next uint32 :overlay-at (-> next 1))
|
||||
(trans-mid-next uint32 :overlay-at (-> next 2))
|
||||
(trans-far-next uint32 :overlay-at (-> next 3))
|
||||
(water-scissor-next uint32 4 :overlay-at (-> next 0))
|
||||
(water-near-next uint32 :overlay-at (-> next 1))
|
||||
(water-mid-next uint32 :overlay-at (-> next 2))
|
||||
(water-far-next uint32 :overlay-at (-> next 3))
|
||||
(envmap-scissor-next uint32 4 :overlay-at (-> next 4))
|
||||
(envmap-near-next uint32 :overlay-at (-> next 5))
|
||||
(envmap-mid-next uint32 :overlay-at (-> next 6))
|
||||
(envmap-far-next uint32 :overlay-at (-> next 7))
|
||||
(generic-near-next uint32 :overlay-at (-> next 8))
|
||||
(generic-mid-next uint32 :overlay-at (-> next 9))
|
||||
(generic-far-next uint32 :overlay-at (-> next 10))
|
||||
(vanish-next uint32 :overlay-at (-> next 11))
|
||||
(tie-count uint16 :overlay-at (-> count 0))
|
||||
(tie-scissor-count uint16 :overlay-at (-> count 0))
|
||||
(tie-near-count uint16 :overlay-at (-> count 1))
|
||||
(tie-mid-count uint16 :overlay-at (-> count 2))
|
||||
(tie-far-count uint16 :overlay-at (-> count 3))
|
||||
(trans-count uint16 :overlay-at (-> count 0))
|
||||
(trans-scissor-count uint16 :overlay-at (-> count 0))
|
||||
(trans-near-count uint16 :overlay-at (-> count 1))
|
||||
(trans-mid-count uint16 :overlay-at (-> count 2))
|
||||
(trans-far-count uint16 :overlay-at (-> count 3))
|
||||
(water-count uint16 :overlay-at (-> count 0))
|
||||
(water-scissor-count uint16 :overlay-at (-> count 0))
|
||||
(water-near-count uint16 :overlay-at (-> count 1))
|
||||
(water-mid-count uint16 :overlay-at (-> count 2))
|
||||
(water-far-count uint16 :overlay-at (-> count 3))
|
||||
(envmap-count uint16 :overlay-at (-> count 4))
|
||||
(envmap-scissor-count uint16 :overlay-at (-> count 4))
|
||||
(envmap-near-count uint16 :overlay-at (-> count 5))
|
||||
(envmap-mid-count uint16 :overlay-at (-> count 6))
|
||||
(envmap-far-count uint16 :overlay-at (-> count 7))
|
||||
(generic-count uint16 :overlay-at (-> count 8))
|
||||
(generic-near-count uint16 :overlay-at (-> count 8))
|
||||
(generic-mid-count uint16 :overlay-at (-> count 9))
|
||||
(generic-far-count uint16 :overlay-at (-> count 10))
|
||||
(vanish-count uint16 :overlay-at (-> count 11))
|
||||
(next-clear uint32 3 :overlay-at (-> next 0))
|
||||
(count-clear uint16 3 :overlay-at (-> count 0))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define *instance-tie-work-copy* (the-as instance-tie-work #f))
|
||||
|
||||
@@ -7,3 +7,238 @@
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype billboard (drawable)
|
||||
"A billboard for shrubbery in the distance. This is simple a quad that faces the camera.
|
||||
The only data needed is the texture/mode. The location is determined by bsphere."
|
||||
((flat adgif-shader :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype shrub-view-data (structure)
|
||||
"Camera and general settings for shrubbery VU1 program."
|
||||
((data uint128 3)
|
||||
(texture-giftag gs-gif-tag :inline :overlay-at (-> data 0))
|
||||
(consts vector :inline :overlay-at (-> data 1))
|
||||
(fog-clamp vector :inline :overlay-at (-> data 2))
|
||||
(tex-start-ptr int32 :overlay-at (-> data 1))
|
||||
(gifbufsum float :overlay-at (-> data 1))
|
||||
(mtx-buf-ptr int32 :overlay-at (-> consts y))
|
||||
(exp23 float :overlay-at mtx-buf-ptr)
|
||||
(fog-0 float :overlay-at (-> consts z))
|
||||
(fog-1 float :overlay-at (-> consts w))
|
||||
(fog-min float :overlay-at (-> data 2))
|
||||
(fog-max float :overlay-at (-> fog-clamp y))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype shrubbery (drawable)
|
||||
"Prototype (mesh/geometry) for a shrub. not _really_ a drawable in any way, as it
|
||||
overwrites all the normal drawable fields."
|
||||
((textures (inline-array adgif-shader) :overlay-at id)
|
||||
(header qword :offset 8)
|
||||
(obj-qwc uint8 :offset 12)
|
||||
(vtx-qwc uint8 :offset 13)
|
||||
(col-qwc uint8 :offset 14)
|
||||
(stq-qwc uint8 :offset 15)
|
||||
(obj uint32 :overlay-at (-> bsphere data 0))
|
||||
(vtx uint32 :overlay-at (-> bsphere data 1))
|
||||
(col uint32 :overlay-at (-> bsphere data 2))
|
||||
(stq uint32 :overlay-at (-> bsphere data 3))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype instance-shrubbery (instance)
|
||||
"Instance of a shrub."
|
||||
((flat-normal vector :inline)
|
||||
(flat-hwidth float :overlay-at (-> flat-normal data 3))
|
||||
(color uint32 :offset 8)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype drawable-inline-array-instance-shrub (drawable-inline-array)
|
||||
"Array of shrub instances stored in the level data."
|
||||
((data instance-shrubbery 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype drawable-tree-instance-shrub (drawable-tree)
|
||||
"Drawable-tree for the shrubs."
|
||||
()
|
||||
)
|
||||
|
||||
(deftype generic-shrub-fragment (drawable)
|
||||
"Shrub data, converted into the format for generic.
|
||||
The shrub renderer doesn't support clipping, so it falls back to generic.
|
||||
This requires storing the data for all shrubs prototype twice!"
|
||||
((textures (inline-array adgif-shader) :overlay-at id)
|
||||
(vtx-cnt uint32 :offset 8)
|
||||
(cnt-qwc uint8 :offset 12)
|
||||
(vtx-qwc uint8 :offset 13)
|
||||
(col-qwc uint8 :offset 14)
|
||||
(stq-qwc uint8 :offset 15)
|
||||
(cnt uint32 :overlay-at (-> bsphere data 0))
|
||||
(vtx uint32 :overlay-at (-> bsphere data 1))
|
||||
(col uint32 :overlay-at (-> bsphere data 2))
|
||||
(stq uint32 :overlay-at (-> bsphere data 3))
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype prototype-shrubbery (drawable-inline-array)
|
||||
"Array of shrub prototypes."
|
||||
((data shrubbery 1 :inline)
|
||||
(pad uint32)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype prototype-trans-shrubbery (prototype-shrubbery)
|
||||
"Array of transparent shrub prototypes."
|
||||
()
|
||||
)
|
||||
|
||||
(deftype prototype-generic-shrub (drawable-group)
|
||||
()
|
||||
)
|
||||
|
||||
(deftype shrubbery-matrix (structure)
|
||||
"Instance matrix for a shrub, contains interpolated color."
|
||||
((mat matrix :inline)
|
||||
(color qword :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; WARN: Return type mismatch symbol vs none.
|
||||
(defun shrubbery-login-post-texture ((arg0 shrubbery))
|
||||
"Do some weird fix-up to the shrubbery textures. this is likely to present normal-looking adgifs to the texture system, but then we scramble them up for easier consumption by VU1."
|
||||
(let* ((v1-1 (-> arg0 header data 0))
|
||||
(a1-1 (the-as object (+ (the-as uint (-> arg0 header)) (* (+ (-> arg0 header data 1) 1) 16))))
|
||||
(a2-5 (the-as object (+ (the-as int a1-1) (* v1-1 64))))
|
||||
(a3-0 (the-as object (-> arg0 textures)))
|
||||
)
|
||||
(dotimes (a0-1 (the-as int v1-1))
|
||||
(set! (-> (the-as qword a2-5) quad) (-> (the-as qword a3-0) quad))
|
||||
(let ((a2-6 (the-as object (+ (the-as int a2-5) 16)))
|
||||
(a3-1 (the-as object (&+ (the-as pointer a3-0) 16)))
|
||||
)
|
||||
(set! (-> (the-as qword a1-1) vector4w x) (the-as int (-> (the-as qword a3-1) data 0)))
|
||||
(set! (-> (the-as qword a1-1) vector4w y) (the-as int (-> (the-as qword a3-1) data 1)))
|
||||
(set! (-> (the-as qword a1-1) vector4w z) (the-as int (-> (the-as qword a3-1) data 2)))
|
||||
(set! a1-1 (+ (the-as int a1-1) 16))
|
||||
(let ((a3-2 (the-as object (&+ (the-as pointer a3-1) 16))))
|
||||
(dotimes (t0-4 3)
|
||||
(set! (-> (the-as qword a1-1) quad) (-> (the-as qword a3-2) quad))
|
||||
(set! a1-1 (+ (the-as int a1-1) 16))
|
||||
(set! a3-2 (&+ (the-as pointer a3-2) 16))
|
||||
)
|
||||
(set! (-> (the-as qword a2-6) quad) (-> (the-as qword a3-2) quad))
|
||||
(set! a2-5 (+ (the-as int a2-6) 16))
|
||||
(set! a3-0 (&+ (the-as pointer a3-2) 80))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(define *shrub-state* 0)
|
||||
|
||||
(deftype shrub-near-packet (structure)
|
||||
"DMA templates for generic rendering of shrubs."
|
||||
((matrix-tmpl dma-packet :inline)
|
||||
(header-tmpl dma-packet :inline)
|
||||
(stq-tmpl dma-packet :inline)
|
||||
(color-tmpl dma-packet :inline)
|
||||
(vertex-tmpl dma-packet :inline)
|
||||
(mscal-tmpl dma-packet :inline)
|
||||
(init-tmpl dma-packet :inline)
|
||||
(init-data qword 8)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype instance-shrub-work (structure)
|
||||
"Scratchpad layout for generating shrub DMA."
|
||||
((dummy qword 3 :inline)
|
||||
(chaina qword 8 :inline)
|
||||
(chainb qword 8 :inline)
|
||||
(colors rgba 1024)
|
||||
(matrix-tmpl qword 20 :inline)
|
||||
(count-tmpl vector4w 20 :inline)
|
||||
(mscalf-tmpl dma-packet :inline)
|
||||
(mscalf-ret-tmpl dma-packet :inline)
|
||||
(adgif-tmpl dma-gif-packet :inline)
|
||||
(billboard-tmpl dma-gif-packet :inline)
|
||||
(billboard-const vector :inline)
|
||||
(shrub-near-packets shrub-near-packet 6 :inline)
|
||||
(dma-ref dma-packet :inline)
|
||||
(dma-end dma-packet :inline)
|
||||
(wind-const vector :inline)
|
||||
(constants vector :inline)
|
||||
(color-constant vector4w :inline)
|
||||
(hmge-d vector :inline)
|
||||
(hvdf-offset vector :inline)
|
||||
(wind-force vector :inline)
|
||||
(color vector :inline)
|
||||
(bb-color vector :inline)
|
||||
(min-dist vector :inline)
|
||||
(temp-vec vector :inline)
|
||||
(guard-plane plane 4 :inline)
|
||||
(plane plane 4 :inline)
|
||||
(last uint32 4)
|
||||
(next uint32 4)
|
||||
(count uint16 4)
|
||||
(mod-count uint16 4)
|
||||
(wind-vectors uint32)
|
||||
(instance-ptr uint32)
|
||||
(chain-ptr uint32)
|
||||
(chain-ptr-next uint32)
|
||||
(stack-ptr uint32)
|
||||
(bucket-ptr uint32)
|
||||
(src-ptr uint32)
|
||||
(to-spr uint32)
|
||||
(from-spr uint32)
|
||||
(shrub-count uint32)
|
||||
(stack-ptr2 uint32 :overlay-at stack-ptr)
|
||||
(node uint32 6 :offset 6428)
|
||||
(length uint32 6)
|
||||
(prototypes uint32)
|
||||
(bucket-ptr2 uint32 :overlay-at bucket-ptr)
|
||||
(start-bank uint8 20 :offset 6484)
|
||||
(buffer-index uint32)
|
||||
(current-spr uint32)
|
||||
(current-mem uint32)
|
||||
(current-shrub-near-packet uint32)
|
||||
(current-shrub-near-trans-packet uint32)
|
||||
(to-spr2 uint32 :overlay-at to-spr)
|
||||
(dma-buffer basic :offset 6528)
|
||||
(near-last uint32)
|
||||
(near-next uint32)
|
||||
(near-count uint32)
|
||||
(near-trans-last uint32)
|
||||
(near-trans-next uint32)
|
||||
(near-trans-count uint32)
|
||||
(last-shrubs uint32)
|
||||
(chains uint32)
|
||||
(flags uint32)
|
||||
(node-count uint32)
|
||||
(inst-count uint32)
|
||||
(wait-from-spr uint32)
|
||||
(wait-to-spr uint32)
|
||||
(texture-dists uint32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype instance-shrub-dma (structure)
|
||||
((instancea uint128 325)
|
||||
(instanceb uint128 325)
|
||||
(outa uint128 128)
|
||||
(outb uint128 128)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -5,5 +5,219 @@
|
||||
;; name in dgo: sparticle-launcher-h
|
||||
;; dgos: GAME
|
||||
|
||||
(declare-type sprite-vec-data-3d structure)
|
||||
(declare-type sparticle-cpuinfo structure)
|
||||
(declare-type sparticle-system structure)
|
||||
|
||||
(defenum sp-field-id
|
||||
:type uint16
|
||||
)
|
||||
|
||||
(defenum sp-flag
|
||||
:type uint16
|
||||
)
|
||||
|
||||
(defenum sp-group-item-flag
|
||||
:bitfield #t
|
||||
:type uint16
|
||||
)
|
||||
|
||||
(defenum sp-launch-state-flags
|
||||
:bitfield #t
|
||||
:type uint16
|
||||
)
|
||||
|
||||
(defenum sp-group-flag
|
||||
:bitfield #t
|
||||
:type uint16
|
||||
)
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype sparticle-birthinfo (structure)
|
||||
"Used internally by the sparticle code."
|
||||
((sprite uint32)
|
||||
(anim int32)
|
||||
(anim-speed float)
|
||||
(birth-func basic)
|
||||
(joint-ppoint int32)
|
||||
(num-to-birth float)
|
||||
(sound basic)
|
||||
(dataf float 1 :overlay-at sprite)
|
||||
(data uint32 1 :overlay-at sprite)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype sp-field-init-spec (structure)
|
||||
"Part of a particle definition - how to initialize a field of a particle."
|
||||
((field sp-field-id)
|
||||
(flags sp-flag)
|
||||
(initial-valuef float)
|
||||
(random-rangef float)
|
||||
(random-multf float)
|
||||
(initial-value int32 :overlay-at initial-valuef)
|
||||
(random-range int32 :overlay-at random-rangef)
|
||||
(random-mult int32 :overlay-at random-multf)
|
||||
(func symbol :overlay-at initial-valuef)
|
||||
(tex texture-id :overlay-at initial-valuef)
|
||||
(pntr pointer :overlay-at initial-valuef)
|
||||
(object basic :overlay-at initial-valuef)
|
||||
(sym symbol :overlay-at initial-valuef)
|
||||
(sound sound-spec :overlay-at initial-valuef)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype sparticle-launcher (basic)
|
||||
"A definition of a single particle, as a list of init specs."
|
||||
((birthaccum float)
|
||||
(soundaccum float)
|
||||
(init-specs (inline-array sp-field-init-spec))
|
||||
)
|
||||
(:methods
|
||||
(get-field-spec-by-id (_type_ sp-field-id) sp-field-init-spec)
|
||||
(setup-special-textures (_type_ string) none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype sparticle-group-item (structure)
|
||||
"A reference to a single sparticle-launcher (by ID) and some parameters for using it."
|
||||
((launcher uint32)
|
||||
(fade-after meters)
|
||||
(falloff-to meters)
|
||||
(flags sp-group-item-flag)
|
||||
(period uint16)
|
||||
(length uint16)
|
||||
(offset int16)
|
||||
(hour-mask uint32)
|
||||
(binding uint32)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype sparticle-launch-state (structure)
|
||||
"The state associated with a launcher of a given sparticle."
|
||||
((group-item sparticle-group-item)
|
||||
(flags sp-launch-state-flags)
|
||||
(randomize uint16)
|
||||
(center vector)
|
||||
(sprite3d sprite-vec-data-3d)
|
||||
(sprite sparticle-cpuinfo)
|
||||
(offset uint32)
|
||||
(accum float)
|
||||
(spawn-time uint32)
|
||||
(control sparticle-launch-control)
|
||||
(swarm basic :overlay-at offset)
|
||||
(seed uint32 :overlay-at accum)
|
||||
(time uint32 :overlay-at spawn-time)
|
||||
(spec basic :overlay-at sprite)
|
||||
(id uint32 :overlay-at sprite3d)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype sparticle-launch-group (basic)
|
||||
"Definition of multiple a particle-group, which is a collection of particle effects."
|
||||
((length int16)
|
||||
(duration uint16)
|
||||
(linger-duration uint16)
|
||||
(flags sp-group-flag)
|
||||
(name string)
|
||||
(launcher (inline-array sparticle-group-item))
|
||||
(rotate-x degrees)
|
||||
(rotate-y degrees)
|
||||
(rotate-z degrees)
|
||||
(scale-x float)
|
||||
(scale-y float)
|
||||
(scale-z float)
|
||||
(bounds sphere :inline)
|
||||
)
|
||||
(:methods
|
||||
(create-launch-control (_type_ process) sparticle-launch-control)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(define *launch-matrix* (matrix-identity! (new 'global 'matrix)))
|
||||
|
||||
(deftype sparticle-launch-control (inline-array-class)
|
||||
"Top-level type containing all the state needed to launch a particle group.
|
||||
These are typically owned by a process, and allocated on the process heap.
|
||||
These refer to static particle definitions, and then spawn particles that are tracked by the
|
||||
particle system itself. This type just holds the launching-related state."
|
||||
((group sparticle-launch-group)
|
||||
(proc process-drawable)
|
||||
(local-clock int32)
|
||||
(fade float)
|
||||
(matrix int8)
|
||||
(state-mode uint8 3)
|
||||
(state-counter uint32)
|
||||
(local-space-binding particle-local-space-info :overlay-at fade)
|
||||
(last-spawn-frame int32)
|
||||
(last-spawn-time int32)
|
||||
(origin matrix :inline)
|
||||
(center vector :inline :overlay-at (-> origin data 12))
|
||||
(data sparticle-launch-state :inline :dynamic)
|
||||
)
|
||||
(:methods
|
||||
(sparticle-launch-control-method-14 () none)
|
||||
(sparticle-launch-control-method-15 () none)
|
||||
(sparticle-launch-control-method-16 () none)
|
||||
(sparticle-launch-control-method-17 () none)
|
||||
(sparticle-launch-control-method-18 () none)
|
||||
(sparticle-launch-control-method-19 () none)
|
||||
(sparticle-launch-control-method-20 () none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> sparticle-launch-control heap-base) (the-as uint 48))
|
||||
|
||||
(deftype sparticle-subsampler (basic)
|
||||
((spt-num float)
|
||||
(sp-system sparticle-system)
|
||||
(sp-launcher sparticle-launcher)
|
||||
(spawn-mat matrix :inline)
|
||||
(inited? basic)
|
||||
)
|
||||
(:methods
|
||||
(new (symbol type sparticle-system sparticle-launcher float) _type_)
|
||||
(sparticle-subsampler-method-9 () none)
|
||||
(sparticle-subsampler-method-10 () none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(defmethod new sparticle-subsampler ((allocation symbol) (type-to-make type) (arg0 sparticle-system) (arg1 sparticle-launcher) (arg2 float))
|
||||
(let ((s3-0 (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
|
||||
(if (zero? s3-0)
|
||||
(go process-drawable-art-error "sparticle-subsampler")
|
||||
)
|
||||
(set! (-> s3-0 sp-launcher) arg1)
|
||||
(set! (-> s3-0 inited?) #f)
|
||||
(set! (-> s3-0 sp-system) arg0)
|
||||
(set! (-> s3-0 spt-num) arg2)
|
||||
(matrix-identity! (-> s3-0 spawn-mat))
|
||||
s3-0
|
||||
)
|
||||
)
|
||||
|
||||
(defun compute-rot-in-screenspace ((arg0 vector))
|
||||
"Unclear what this does, but I'm not actually sure it makes sense. Unused"
|
||||
0.0
|
||||
(let ((a0-1 (-> (math-camera-matrix) fvec)))
|
||||
0.0
|
||||
(let ((v1-0 (new 'stack-no-clear 'vector)))
|
||||
(let ((f0-3 (vector-dot a0-1 arg0)))
|
||||
(vector-float*! v1-0 a0-1 f0-3)
|
||||
)
|
||||
(vector-! arg0 arg0 v1-0)
|
||||
)
|
||||
)
|
||||
(let ((a2-1 (matrix-transpose! (new 'stack-no-clear 'matrix) (math-camera-matrix))))
|
||||
(vector-matrix*! arg0 arg0 a2-1)
|
||||
)
|
||||
(the float (sar (shl (the int (atan (-> arg0 y) (* -1.0 (-> arg0 x)))) 48) 48))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user