Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jak3] More headers again again #3359

Merged
merged 5 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,213 changes: 592 additions & 621 deletions decompiler/config/jak3/all-types.gc

Large diffs are not rendered by default.

15 changes: 14 additions & 1 deletion decompiler/config/jak3/ntsc_v1/type_casts.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -335,5 +335,18 @@
"joint-mod-blend-world-callback": [[[1, 150], "gp", "joint-mod-blend-world"]],
"(top-level-login eye-h)": [[77, "a3", "eye-control"]],
"entity-actor-lookup": [["_stack_", 16, "res-tag"]],
"entity-actor-count": [["_stack_", 16, "res-tag"]]
"entity-actor-count": [["_stack_", 16, "res-tag"]],
"(method 3 collide-query)": [[116, "f0", "float"], [137, "f0", "float"]],
"shrubbery-login-post-texture": [
[[13, 15], "a3", "qword"],
[16, "a3", "pointer"],
[24, "a3", "pointer"],
[[17, 23], "a3", "qword"],
[[13, 23], "a1", "qword"],
[14, "a2", "qword"],
[[27, 29], "a3", "qword"],
[[27, 29], "a1", "qword"],
[[35, 37], "a3", "qword"],
[[35, 37], "a2", "qword"]
]
}
2 changes: 2 additions & 0 deletions goal_src/jak3/engine/camera/cam-interface-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
138 changes: 138 additions & 0 deletions goal_src/jak3/engine/collide/collide-cache-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
45 changes: 45 additions & 0 deletions goal_src/jak3/engine/collide/collide-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion goal_src/jak3/engine/draw/drawable-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
22 changes: 22 additions & 0 deletions goal_src/jak3/engine/gfx/background/background-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
)
)
Loading
Loading