jak-project/goal_src/jak3/engine/nav/nav-control-h.gc
Hat Kid 36f1592b90
decomp3: lightning renderer, nav code, texture remap, fix progress menu crash (#3461)
Also adds:

- BLERC
- Minimap (with missing texture for the map, sprites work)
- Eco Mine files
- Precursor robot boss files
- Sewer files
- Vehicle files
2024-04-12 18:44:38 -04:00

220 lines
7.8 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: nav-control-h.gc
;; name in dgo: nav-control-h
;; dgos: GAME
(defenum nav-state-flag
:type uint32
:bitfield #t
(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)
(use-position 15)
)
(defenum nav-control-flag
:type uint32
:bitfield #t
(display-marks 0) ;; 1
(debug 1) ;; 2
(no-redirect-in-clamp 2) ;; 4
(limit-rotation-rate 3) ;; 8
(update-heading-from-facing 4) ;; 16
(use-momentum 5) ;; 32
(momentum-ignore-heading 6) ;; 64
(output-sphere-hash 7) ;; 128
(kernel-run 8) ;; 256
)
;; DECOMP BEGINS
(deftype check-vector-collision-with-nav-spheres-info (structure)
((u float)
(intersect vector :inline)
(normal vector :inline)
)
)
(deftype nav-gap-info (structure)
((dest vector :inline)
(poly nav-poly)
)
)
(deftype nav-avoid-spheres-params (structure)
((current-pos vector :inline)
(travel vector :inline)
(pref-dir vector :inline)
(out-travel vector 2 :inline)
(closest-sphere-dist2 float)
(avoiding-sphere? symbol)
)
)
(deftype nav-callback-info (structure)
((callback-count int32)
(callback-array (function object nav-control none) 10)
)
)
(deftype nav-state (structure)
((flags nav-state-flag)
(nav nav-control)
(user-poly nav-poly)
(mesh nav-mesh)
(current-poly nav-poly)
(virtual-current-poly nav-poly)
(next-poly nav-poly)
(target-poly nav-poly)
(rotation-rate float)
(speed meters)
(prev-speed meters)
(pad0 uint32 1)
(travel vector :inline)
(target-pos vector :inline)
(current-pos vector :inline)
(current-pos-local vector :inline)
(virtual-current-pos-local vector :inline)
(velocity vector :inline)
(heading vector :inline)
(target-dir vector :inline)
(accel vector :inline :overlay-at target-dir)
(user-position vector :inline :overlay-at virtual-current-pos-local)
)
(:methods
(debug-draw (_type_) none)
(nav-state-method-10 (_type_) none)
(plan-over-pat1-polys-using-route (_type_ nav-gap-info) symbol)
(get-velocity (_type_ vector) vector)
(get-travel (_type_ vector) vector)
(get-heading (_type_ vector) vector)
(get-target-pos (_type_ vector) vector)
(get-speed (_type_) meters)
(get-rotation-rate (_type_) float)
(try-projecting-to-current-poly (_type_ vector vector vector) symbol)
(get-current-poly (_type_) nav-poly)
(copy-nav-state! (_type_ (pointer nav-state)) none)
(nav-state-method-21 () none)
(nav-state-method-22 () none)
(nav-state-method-23 () none)
(turn-and-navigate-to-destination (_type_) none)
(navigate-using-route-portals-wrapper (_type_) none)
(navigate-using-best-dir-recompute-avoid-spheres-1-wrapper (_type_) none)
(navigate-within-poly-wrapper (_type_) none)
(compute-travel-speed (_type_) none)
(nav-state-method-29 (_type_) none)
(nav-state-method-30 (_type_) none)
(navigate-using-best-dir-recompute-avoid-spheres-2 (_type_) none)
(update-travel-dir-from-spheres (_type_) none)
(compute-speed-simple (_type_) none)
(navigate-v1! (_type_) none)
(reset-target! (_type_) none)
(add-offset-to-target! (_type_ vector) none)
(navigate-v2! (_type_) none)
(set-current-poly! (_type_ nav-poly) none)
(nav-state-method-39 (_type_) symbol)
(do-navigation-to-destination (_type_ vector) none)
(clamp-vector-to-mesh-cross-gaps (_type_ vector) symbol)
(set-target-pos! (_type_ vector) none)
(set-virtual-cur-pos! (_type_ vector) none)
(set-travel! (_type_ vector) none)
(set-velocity! (_type_ vector) none)
(set-heading! (_type_ vector) none)
(set-speed! (_type_ meters) none)
(reset! (_type_ nav-control) none)
(nav-state-method-49 () none)
(navigate-using-best-dir-use-existing-avoid-spheres (_type_ nav-avoid-spheres-params) none)
(nav-state-method-51 (_type_) none)
(navigate-using-route-portals (_type_) none)
(navigate-using-best-dir-recompute-avoid-spheres-1 (_type_) none)
(navigate-within-poly (_type_) none)
(clamp-travel-vector (_type_) none)
)
)
(deftype nav-control (structure)
((flags nav-control-flag)
(callback-info nav-callback-info)
(process process)
(pad0 uint32)
(shape collide-shape)
(nearest-y-threshold meters)
(nav-cull-radius meters)
(sec-per-frame float)
(target-speed meters)
(acceleration meters)
(turning-acceleration meters)
(max-rotation-rate float)
(speed-scale float)
(sphere-count int32)
(sphere-array (inline-array sphere))
(root-sphere-id uint8)
(sphere-mask uint8)
(pad1 uint8 2)
(sphere-id-array uint8 16)
(extra-nav-sphere vector :inline)
(root-nav-sphere vector :inline)
(state nav-state :inline)
(mesh basic :overlay-at (-> state mesh))
)
(:methods
(debug-draw (_type_) none)
(point-in-bsphere? (_type_ vector) symbol)
(find-poly-containing-point-1 (_type_ vector) nav-poly)
(closest-point-on-mesh (_type_ vector vector nav-poly) nav-poly)
(find-nearest-poly-to-point (_type_ vector) nav-poly)
(project-point-onto-plane-of-poly (_type_ nav-poly vector vector vector) none)
(find-poly-containing-point-2 (_type_ vector) nav-poly)
(is-above-poly-max-height? (_type_ vector float) symbol)
(is-in-mesh? (_type_ vector float) symbol)
(avoid-spheres-1! (_type_ nav-avoid-spheres-params) symbol)
(avoid-spheres-2! (_type_ nav-avoid-spheres-params) symbol)
(clamp-vector-to-mesh-cross-gaps (_type_ vector nav-poly vector float symbol clamp-travel-vector-to-mesh-return-info) none)
(clamp-vector-to-mesh-no-gaps (_type_ vector nav-poly vector clamp-travel-vector-to-mesh-return-info) none)
(find-first-sphere-and-update-avoid-params (_type_ vector nav-avoid-spheres-params) float)
(set-spheres-from-nav-ids (_type_) none)
(add-root-sphere-to-hash! (_type_ vector int) symbol)
(get-max-rotation-rate (_type_) float)
(get-sphere-mask (_type_) uint)
(get-target-speed (_type_) meters)
(enable-extra-sphere! (_type_) none)
(disable-extra-sphere! (_type_) none)
(copy-extra-nav-sphere! (_type_ sphere) none)
(set-extra-nav-sphere-xyz! (_type_ sphere) none)
(set-extra-nav-sphere-radius! (_type_ float) none)
(set-nearest-y-thres! (_type_ float) none)
(set-nav-cull-radius! (_type_ meters) none)
(set-speed-scale! (_type_ float) none)
(set-target-speed! (_type_ meters) none)
(set-acceleration! (_type_ meters) none)
(set-turning-acceleration! (_type_ meters) none)
(set-max-rotation-rate! (_type_ float) none)
(set-sphere-mask! (_type_ uint) none)
(remove! (_type_) none)
(init! (_type_ collide-shape) none)
(display-marks? (_type_) symbol)
(nav-control-method-44 () none)
(find-first-sphere-intersecting-ray (_type_ vector vector vector) sphere)
(find-sphere-ids-from-sphere-hash (_type_ symbol) none)
)
)