d/jak2: some work in nav-mesh/nav-control

This commit is contained in:
Tyler Wilding
2022-10-16 20:11:39 -04:00
parent 46f11b1b47
commit 48f750f32b
7 changed files with 21677 additions and 3805 deletions
+76 -69
View File
@@ -21845,7 +21845,7 @@
(deftype nav-poly (structure)
((data uint8 64 :offset-assert 0 :score -1)
(vertex vector 4 :inline :offset 0) ;; changed to vector from uint8 in jak 1
(vertex0 vector :inline :offset 0 :score 999)
(vertex0 vector :inline :offset 0)
(vertex1 vector :inline :offset 16)
(vertex2 vector :inline :offset 32)
(vertex3 vector :inline :offset 48)
@@ -21962,7 +21962,7 @@
(poly-count uint8 :offset-assert 13)
(nav-control-count uint8 :offset-assert 14)
(max-nav-control-count uint8 :offset-assert 15)
(route uint32 :offset-assert 16)
(route (pointer nav-poly) :offset-assert 16)
(poly-hash grid-hash :offset-assert 20)
(nav-control-array (inline-array nav-control) :offset-assert 24) ;; 307 elts
(sphere-hash sphere-hash :offset-assert 28)
@@ -21973,7 +21973,7 @@
(bounds vector :inline :offset-assert 48) ;; actually a sphere
(origin vector :inline :offset 48)
(entity entity :offset-assert 64)
(link-array (array nav-mesh-link) :offset-assert 68)
(link-array (inline-array nav-mesh-link) :offset-assert 68)
(link-count uint8 :offset-assert 72)
(flags nav-mesh-flag :offset-assert 73)
(pad1 uint8 2 :offset-assert 74)
@@ -21989,25 +21989,25 @@
(nav-mesh-method-10 (_type_ vector vector nav-poly) nav-poly 10) ;; (tri-centroid-local (_type_ nav-poly vector) vector 10)
(nav-mesh-method-11 (_type_ nav-poly vector) vector 11) ;; (get-adj-poly (_type_ nav-poly nav-poly symbol) nav-poly 11)
(nav-mesh-method-12 (_type_ nav-poly vector) none 12) ;; (setup-portal (_type_ nav-poly nav-poly nav-route-portal) object 12)
(nav-mesh-method-13 (_type_ symbol symbol) none 13) ;; (initialize-mesh! (_type_) none 13)
(get-route-portal(_type_ object object nav-find-poly-parms) none 14) ;; (move-along-nav-ray! (_type_ nav-ray) none 14)
(nav-mesh-method-13 (_type_ nav-poly nav-poly) none 13) ;; (initialize-mesh! (_type_) none 13)
(get-route-portal (_type_ nav-poly nav-poly nav-route-portal) (inline-array nav-vertex) 14) ;; (move-along-nav-ray! (_type_ nav-ray) none 14)
(initialize-mesh! (_type_) none 15) ;; (try-move-along-ray (_type_ nav-poly vector vector float) meters 15)
(move-along-nav-ray! (_type_ nav-ray) none 16) ;; (TODO-RENAME-16 (_type_ vector nav-poly vector symbol float clip-travel-vector-to-mesh-return-info) none 16)
(try-move-along-ray (_type_ nav-poly vector vector float) meters 17) ;; (update-route-table (_type_) none 17)
(nav-mesh-method-18 () none 18) ;; (dummy-18 (_type_ int vector int (pointer int8) int) none 18)
(nav-mesh-method-19 () none 19) ;; (compute-bounding-box (_type_ vector vector) none 19)
(nav-mesh-method-20 () none 20) ;; (debug-draw-poly (_type_ nav-poly rgba) none 20)
(nav-mesh-method-21 () none 21) ;; (point-in-poly? (_type_ nav-poly vector) symbol 21)
(nav-mesh-method-19 (_type_) none 19) ;; (compute-bounding-box (_type_ vector vector) none 19)
(nav-mesh-method-20 (_type_) none 20) ;; (debug-draw-poly (_type_ nav-poly rgba) none 20)
(nav-mesh-method-21 (_type_) none 21) ;; (point-in-poly? (_type_ nav-poly vector) symbol 21)
(nav-mesh-method-22 (_type_ vector vector) none 22) ;; (find-opposite-vertices (_type_ nav-poly nav-poly) uint 22)
(nav-mesh-method-23 (_type_ entity-nav-mesh) none 23) ;; (dummy-23 (_type_ nav-poly vector vector vector nav-route-portal) vector 23)
(nav-mesh-method-24 (_type_) none 24) ;; (closest-point-on-boundary (_type_ nav-poly vector vector) vector 24)
(nav-mesh-method-25 (_type_) none 25) ;; (project-point-into-tri-3d (_type_ nav-poly vector vector) none 25)
(nav-mesh-method-26 (_type_) none 26) ;; (project-point-into-tri-2d (_type_ nav-poly vector vector) vector 26)
(new-nav-control (_type_ vector int) nav-control 27) ;; (find-poly-fast (_type_ vector meters) nav-poly 27)
(new-nav-control (_type_ process-drawable int) nav-control 27) ;; (find-poly-fast (_type_ vector meters) nav-poly 27)
(nav-mesh-method-28 (_type_ object) none 28) ;; (find-poly (_type_ vector meters (pointer nav-control-flags)) nav-poly 28)
(nav-mesh-method-29 (_type_ object symbol) nav-control 29) ;; (is-in-mesh? (_type_ vector float meters) symbol 29)
(nav-mesh-method-29 (_type_ process-drawable symbol) nav-control 29) ;; (is-in-mesh? (_type_ vector float meters) symbol 29)
(nav-mesh-method-30 (_type_ process-drawable) none 30)
(change-to (_type_ process-drawable) none 31)
(change-to (_type_ process-drawable int) none 31)
(nav-mesh-method-32 "arg1 is a [[nav-mesh-link]] `id`" (_type_ uint32) none 32)
(nav-mesh-method-33 "arg1 is a [[nav-mesh-link]] `id`" (_type_ uint32) symbol 33)
(nav-mesh-method-34 (_type_ object vector float) none 34)
@@ -22022,10 +22022,10 @@
(closest-point-on-boundary (_type_ nav-poly vector vector) none 39)
(nav-mesh-method-40 (_type_ nav-poly vector object vector) none 40)
(project-point-into-poly-2d (_type_ nav-poly vector vector) none 41)
(nav-mesh-method-42 (_type_ nav-find-poly-parms) symbol 42)
(nav-mesh-method-42 (_type_ nav-find-poly-parms) nav-poly 42)
(nav-mesh-method-43 (_type_ nav-find-poly-parms) none 43)
(nav-mesh-method-44 (_type_ vector float float) symbol 44)
(nav-mesh-method-45 "TODO - asm expression building error" (_type_ entity-perm) none 45)
(nav-mesh-method-45 "TODO - asm expression building error" (_type_ entity-perm) none 45) ;; entity-perm is wrong
(nav-mesh-method-46 (_type_ object) none 46)
)
)
@@ -22067,7 +22067,7 @@
(pref-dir vector :inline :offset-assert 32)
(out-travel vector 2 :inline :offset-assert 48)
(closest-sphere-dist2 float :offset-assert 80)
(avoiding-sphere? basic :offset-assert 84)
(avoiding-sphere? symbol :offset-assert 84)
)
:method-count-assert 9
:size-assert #x58
@@ -22086,27 +22086,26 @@
(defenum nav-state-flag
:type uint32
:bitfield #t
(display-marks 0) ;; 1
(recovery-mode 1) ;; 2
(initialized 2) ;; 4
(debug 3) ;; 8
(directional-mode 4) ;; 16
(trapped-by-sphere 5) ;; 32
(target-poly-dirty 6) ;; 64
(blocked 7) ;; 128
(in-target-poly 8) ;; 256
(at-target 9) ;; 512
(target-inside 10) ;; 1024
(in-mesh 11) ;; 2048
(avoiding-sphere 12) ;; 4096
(touching-sphere 13) ;; 8192
(at-gap 14) ;; 16384
(display-marks 0)
(recovery-mode 1)
(initialized 2)
(debug 3)
(directional-mode 4)
(trapped-by-sphere 5)
(target-poly-dirty 6)
(blocked 7)
(in-target-poly 8)
(at-target 9)
(target-inside 10)
(in-mesh 11)
(avoiding-sphere 12)
(touching-sphere 13)
(at-gap 14)
)
(deftype nav-state (structure)
((flags nav-state-flag :offset-assert 0)
(nav basic :offset-assert 4)
(nav nav-control :offset-assert 4)
(user-poly nav-poly :offset-assert 8)
(mesh nav-mesh :offset-assert 12)
(current-poly nav-poly :offset-assert 16)
@@ -22133,17 +22132,26 @@
;; Failed to read fields.
(:methods
(nav-state-method-9 () none 9)
(nav-state-method-10 () none 10)
(nav-state-method-10
"Virtual/Stub" (_type_) none 10)
(nav-state-method-11 () none 11)
(nav-state-method-12 () none 12)
(nav-state-method-13 () none 13)
(nav-state-method-14 () none 14)
(nav-state-method-15 () none 15)
(nav-state-method-16 () none 16)
(nav-state-method-17 () none 17)
(nav-state-method-18 () none 18)
(nav-state-method-19 () none 19)
(nav-state-method-20 () none 20)
(nav-state-method-12 (_type_ vector) vector 12)
(nav-state-method-13 (_type_ vector) vector 13)
(nav-state-method-14 (_type_ vector) vector 14)
(nav-state-method-15 (_type_ vector) vector 15)
(get-speed
"@returns `speed`"
(_type_) meters 16)
(get-rotation-rate
"@returns `rotation-rate`"
(_type_) float 17)
(nav-state-method-18 (_type_ vector object vector) none 18)
(get-current-poly
"@returns `current-poly`"
(_type_) nav-poly 19)
(copy-nav-state!
"Copies the [[nav-state]] the given pointer points to into the current object"
(_type_ (pointer nav-state)) none 20)
(nav-state-method-21 () none 21)
(nav-state-method-22 () none 22)
(nav-state-method-23 () none 23)
@@ -22161,20 +22169,20 @@
(nav-state-method-35 () none 35)
(nav-state-method-36 () none 36)
(nav-state-method-37 () none 37)
(nav-state-method-38 () none 38)
(set-current-poly! (_type_ nav-poly) none 38)
(nav-state-method-39 () none 39)
(nav-state-method-40 () none 40)
(nav-state-method-41 () none 41)
(nav-state-method-42 () none 42)
(nav-state-method-43 () none 43)
(nav-state-method-44 () none 44)
(nav-state-method-45 () none 45)
(nav-state-method-46 () none 46)
(nav-state-method-47 () none 47)
(nav-state-method-41 (_type_ vector) symbol 41)
(nav-state-method-42 (_type_ vector) none 42)
(nav-state-method-43 (_type_ vector) none 43)
(set-velocity! (_type_ vector) none 44)
(set-heading! (_type_ vector) none 45)
(set-speed! (_type_ meters) none 46)
(nav-state-method-47 (_type_) none 47)
(nav-state-method-48 () none 48)
(nav-state-method-49 () none 49)
(nav-state-method-50 () none 50)
(nav-state-method-51 () none 51)
(nav-state-method-50 "Virtual/Stub" (_type_) none 50)
(nav-state-method-51 "TODO - #1888" () none 51)
(nav-state-method-52 () none 52)
(nav-state-method-53 () none 53)
(nav-state-method-54 () none 54)
@@ -22215,8 +22223,8 @@
(sphere-mask uint8 :offset-assert 61)
(pad1 uint8 2 :offset-assert 62)
(sphere-id-array uint8 16 :offset-assert 64)
(extra-nav-sphere sphere :inline :offset-assert 80)
(root-nav-sphere sphere :inline :offset-assert 96)
(extra-nav-sphere vector :inline :offset-assert 80) ;; it's a sphere, but makes code look nicer
(root-nav-sphere vector :inline :offset-assert 96) ;; it's a sphere, but makes code look nicer
(state nav-state :inline :offset-assert 112)
)
:method-count-assert 47
@@ -22230,7 +22238,7 @@
"Is the given point ([[vector]]) outside of the [[nav-mesh]]'s `bounds` [[sphere]] radius"
(_type_ vector) symbol 10)
(nav-control-method-11 "TODO" (_type_ vector) vector 11) ;; (dummy-11 (_type_ vector) vector 11)
(nav-control-method-12 () none 12) ;; (TODO-RENAME-12 (_type_ nav-gap-info) symbol 12)
(nav-control-method-12 (_type_ vector vector nav-poly) nav-poly 12) ;; (TODO-RENAME-12 (_type_ nav-gap-info) symbol 12)
(find-poly "TODO" (_type_ vector) nav-poly 13) ;; (dummy-13 (_type_ vector vector) vector 13)
(nav-control-method-14 (_type_ nav-poly vector object vector) none 14) ;; (set-current-poly! (_type_ nav-poly) none 14)
(nav-control-method-15 "TODO - same as 11" (_type_ vector) none 15) ;; (set-target-pos! (_type_ vector) none 15)
@@ -22238,11 +22246,11 @@
(is-in-mesh? "TODO" (_type_ vector float) symbol 17) ;; (project-onto-nav-mesh (_type_ vector vector) vector 17)
(nav-control-method-18 () none 18) ;; (find-poly (_type_ vector) nav-poly 18)
(nav-control-method-19 () none 19) ;; (dummy-19 (_type_ vector collide-shape-moving vector float) none 19)
(nav-control-method-20 (_type_ vector vector vector int symbol symbol) none 20) ;; (project-point-into-tri-3d (_type_ nav-poly vector vector) vector 20)
(nav-control-method-21 () none 21) ;; (TODO-RENAME-21 (_type_ vector) nav-poly 21)
(nav-control-method-22 () none 22) ;; (TODO-RENAME-22 (_type_ vector float) symbol 22)
(nav-control-method-20 (_type_ vector nav-poly vector float symbol symbol) none 20) ;; (project-point-into-tri-3d (_type_ nav-poly vector vector) vector 20)
(nav-control-method-21 (_type_) none 21) ;; (TODO-RENAME-21 (_type_ vector) nav-poly 21)
(nav-control-method-22 (_type_ vector nav-avoid-spheres-params) float 22) ;; (TODO-RENAME-22 (_type_ vector float) symbol 22)
(nav-control-method-23 "TODO" (_type_) none 23) ;; (dummy-23 (_type_ vector check-vector-collision-with-nav-spheres-info) float 23)
(nav-control-method-24 () none 24) ;; (dummy-24 (_type_ float clip-travel-vector-to-mesh-return-info) none 24)
(nav-control-method-24 (_type_ object int) none 24) ;; (dummy-24 (_type_ float clip-travel-vector-to-mesh-return-info) none 24)
(get-max-rotation-rate (_type_) float 25) ;; (is-in-mesh? (_type_ vector float) symbol 25)
(get-sphere-mask (_type_) none 26) ;; (TODO-RENAME-26 (_type_) none 26)
(get-target-speed (_type_) meters 27) ;; (TODO-RENAME-27 (_type_) none 27)
@@ -22264,7 +22272,7 @@
(display-marks? "Returns if navigation related marks should be displayed" (_type_) symbol 43)
(nav-control-method-44 () none 44)
(nav-control-method-45 (_type_ vector vector vector) sphere 45)
(find-sphere "TODO" (_type_) none 46)
(find-sphere "TODO" (_type_ symbol) none 46)
)
)
@@ -22314,8 +22322,8 @@
(grid-hash-method-9 () none 9)
(grid-hash-method-10 () none 10)
(grid-hash-method-11 () none 11)
(grid-hash-method-12 () none 12)
(grid-hash-method-13 () none 13)
(grid-hash-method-12 (_type_ vector) grid-hash-box 12)
(grid-hash-method-13 (_type_ vector float) grid-hash-box 13)
(grid-hash-method-14 () none 14)
(grid-hash-method-15 () none 15)
(grid-hash-method-16 () none 16)
@@ -29428,7 +29436,7 @@
(nav-engine-method-18 (_type_ nav-engine-spr-buffer) none 18)
(nav-engine-method-19 (_type_ nav-engine-spr-buffer) none 19)
(nav-engine-method-20 () none 20)
(nav-engine-method-21 () none 21)
(nav-engine-method-21 (_type_) none 21)
)
)
@@ -29442,20 +29450,19 @@
(define-extern *default-nav-mesh* nav-mesh) ;; nav-mesh
(define-extern nav-mesh-connect-from-ent (function entity-nav-mesh none))
(define-extern connection-validate (function connection none))
(define-extern connection-list-validate (function (inline-array connection) none))
(define-extern connection-list-validate (function (inline-array connection) symbol))
(define-extern nav-control-validate (function nav-control none))
(define-extern debug-validate-nav-poly (function nav-mesh-link nav-poly none))
(define-extern nav-dma-send-to-spr-no-flush (function object object object none))
(define-extern nav-dma-send-from-spr-no-flush (function none))
;; TODO - local vars and docstrings "Increments and returns the provided [[int]], if the value exceeds `2`, wrap back to `0`"
(define-extern inc-mod3 (function int int)) ;;
(define-extern inc-mod3 "Increments and returns the provided [[int]], if the value exceeds `2`, wrap back to `0`" (function int int)) ;;
(define-extern nav-state-patch-pointers (function none))
(define-extern vu-point-triangle-intersection? (function vector vector vector vector symbol)) ;;
(define-extern poly-in-height-range? (function nav-poly float float symbol))
(define-extern init-ray-local (function nav-ray nav-poly vector vector none)) ;;
(define-extern init-ray-dir-local (function nav-ray nav-poly vector vector float none)) ;;
(define-extern nav-ray-test (function nav-mesh nav-poly vector vector meters)) ;;
(define-extern point-poly-distance-min (function nav-poly none))
(define-extern point-poly-distance-min (function nav-mesh-work nav-poly float nav-poly float))
(define-extern nav-mesh-route-table-bit-index (function nav-mesh uint int int))
(define-extern ray-ccw-line-segment-intersection? (function vector vector vector vector symbol)) ;;
(define-extern ray-line-segment-intersection? (function vector vector vector vector symbol)) ;;
@@ -29517,9 +29524,9 @@
(define-extern circle-tangent-directions (function vector vector vector vector vector)) ;;
(define-extern circle-ray-intersection? (function vector vector float vector symbol))
(define-extern find-closest-circle-ray-intersection (function vector vector float int (inline-array vector) int int)) ;;
;; (define-extern compute-dir-parm function) ;; (function vector vector vector float)
;; (define-extern vector-rotate-y-sincos! function)
;; (define-extern test-xz-point-on-line-segment? function) ;; (function vector vector vector float symbol)
(define-extern compute-dir-parm (function vector vector vector float))
(define-extern vector-rotate-y-sincos! (function vector vector float float float))
(define-extern test-xz-point-on-line-segment? (function vector vector vector float symbol))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; aligner ;;
@@ -415,6 +415,8 @@
],
"water": [[10, "(function vector :behavior process-drawable)"]],
"dark-eco-pool": [[0, "(function none :behavior dark-eco-pool)"]],
"target-gun": [[22, "(function surface object object int object :behavior target)"]],
"target-gun": [
[22, "(function surface object object int object :behavior target)"]
],
"scene": [[4, "(function symbol :behavior scene-player)"]]
}
+16 -28
View File
@@ -282,20 +282,9 @@
"(method 12 perf-stat)": [0],
"(method 11 perf-stat)": [0],
"(method 22 gui-control)": [117, 121, 127, 128, 129, 139],
"bsp-camera-asm": [1, 2, 3, 4, 6, 7],
"(method 9 texture-page-dir)": [5, 6],
"level-remap-texture": [2, 3, 4, 5, 6],
"(method 27 nav-mesh)": [0, 1, 2, 4, 5],
"(method 31 nav-mesh)": [0, 1, 2, 7, 8, 9, 11, 12, 13, 15],
"(method 45 nav-mesh)": [1, 4, 5, 8],
"(method 46 nav-mesh)": [1, 2, 3, 5],
"(method 32 nav-mesh)": [0, 1, 2, 4],
"(method 33 nav-mesh)": [0, 1, 2, 4],
"(method 42 nav-mesh)": [1, 2, 3, 7],
"point-poly-distance-min": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
"(method 34 nav-mesh)": [1, 2, 3, 7],
"(method 35 nav-mesh)": [2, 4],
"(method 18 mysql-nav-graph)": [0, 1, 3, 4, 5, 9],
"draw-actor-marks": [8],
"find-nearest-entity": [7, 9, 10, 11, 12, 13, 14],
@@ -347,23 +336,22 @@
],
"(method 22 gui-control)": [
10, // goto L63 (B39)
16, // goto L58 (B27)
26, // goto L62 (B)
27, // goto L62
28, // goto L61
35, // goto L62
36, // goto L62
38, // goto L99
42, // goto L89
50, // goto L84
108, // goto L86
110, // goto L86
116, // goto L99
117, // goto L91
120
]
// "(method 67 collide-shape-moving)": [1, 7, 9, 10, 11, 12] - TODO
10, // goto L63 (B39)
16, // goto L58 (B27)
26, // goto L62 (B)
27, // goto L62
28, // goto L61
35, // goto L62
36, // goto L62
38, // goto L99
42, // goto L89
50, // goto L84
108, // goto L86
110, // goto L86
116, // goto L99
117, // goto L91
120
]
},
// Sometimes the game might use format strings that are fetched dynamically,
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -7,7 +7,7 @@
// if you want to filter to only some object names.
// it will make the decompiler much faster.
"allowed_objects": [],
"allowed_objects": ["nav-control"],
"banned_objects": ["effect-control", "ctywide-scenes", "texture-anim-tables", "traffic-engine"],
////////////////////////////