mirror of
https://github.com/open-goal/jak-project
synced 2026-07-06 05:54:45 -04:00
d52739226c
A few issues: - lwidea's fr3 is getting loaded and unloaded all the time - the debug line drawing clipping is wrong (doesn't seem wrong in pcsx2, so I think this is on us) - nothing actually using vis data yet - at a large distance, our view frustum culling seems slightly too aggressive (might be that viewport scissoring is wrong) - in the city, things seem darker as you move away. unclear how this is happening (fog?)
256 lines
11 KiB
Common Lisp
Vendored
Generated
256 lines
11 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type bsp-node
|
|
(deftype bsp-node (structure)
|
|
((front int16 :offset-assert 0)
|
|
(back int16 :offset-assert 2)
|
|
(front-box-min vector4b :inline :offset-assert 4)
|
|
(front-box-max vector4b :inline :offset-assert 8)
|
|
(back-box-min vector4b :inline :offset-assert 12)
|
|
(back-box-max vector4b :inline :offset-assert 16)
|
|
)
|
|
:pack-me
|
|
:method-count-assert 9
|
|
:size-assert #x14
|
|
:flag-assert #x900000014
|
|
)
|
|
|
|
;; definition for method 3 of type bsp-node
|
|
(defmethod inspect bsp-node ((obj bsp-node))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj 'bsp-node)
|
|
(format #t "~1Tfront: ~D~%" (-> obj front))
|
|
(format #t "~1Tback: ~D~%" (-> obj back))
|
|
(format #t "~1Tfront-box-min: #<vector4b @ #x~X>~%" (-> obj front-box-min))
|
|
(format #t "~1Tfront-box-max: #<vector4b @ #x~X>~%" (-> obj front-box-max))
|
|
(format #t "~1Tback-box-min: #<vector4b @ #x~X>~%" (-> obj back-box-min))
|
|
(format #t "~1Tback-box-max: #<vector4b @ #x~X>~%" (-> obj back-box-max))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; definition of type bsp-header
|
|
(deftype bsp-header (drawable)
|
|
((info file-info :offset 4)
|
|
(all-visible-list (pointer uint16) :offset-assert 32)
|
|
(visible-list-length int16 :offset-assert 36)
|
|
(extra-vis-list-length int16 :offset-assert 38)
|
|
(drawable-trees drawable-tree-array :offset-assert 40)
|
|
(pat pointer :offset-assert 44)
|
|
(pat-length int32 :offset-assert 48)
|
|
(texture-remap-table (pointer uint64) :offset-assert 52)
|
|
(texture-remap-table-len int32 :offset-assert 56)
|
|
(texture-ids (pointer texture-id) :offset-assert 60)
|
|
(texture-page-count int32 :offset-assert 64)
|
|
(unknown-basic basic :offset-assert 68)
|
|
(name symbol :offset-assert 72)
|
|
(nickname symbol :offset-assert 76)
|
|
(vis-info level-vis-info 8 :offset-assert 80)
|
|
(actors drawable-inline-array-actor :offset-assert 112)
|
|
(cameras (array entity-camera) :offset-assert 116)
|
|
(nodes (inline-array bsp-node) :offset-assert 120)
|
|
(level level :offset-assert 124)
|
|
(current-leaf-idx uint16 :offset-assert 128)
|
|
(texture-flags texture-page-flag 10 :offset-assert 130)
|
|
(cam-outside-bsp uint8 :offset 152)
|
|
(cam-using-back uint8 :offset-assert 153)
|
|
(cam-box-idx uint16 :offset-assert 154)
|
|
(ambients symbol :offset-assert 156)
|
|
(subdivide-close float :offset-assert 160)
|
|
(subdivide-far float :offset-assert 164)
|
|
(race-meshes (array entity-race-mesh) :offset-assert 168)
|
|
(actor-birth-order (pointer uint32) :offset-assert 172)
|
|
(light-hash light-hash :offset-assert 176)
|
|
(nav-meshes (array entity-nav-mesh) :offset-assert 180)
|
|
(actor-groups (array actor-group) :offset-assert 184)
|
|
(region-trees (array drawable-tree-region-prim) :offset-assert 188)
|
|
(region-array region-array :offset-assert 192)
|
|
(collide-hash collide-hash :offset-assert 196)
|
|
(wind-array-length int32 :offset 204)
|
|
(vis-spheres vector-array :offset 216)
|
|
(region-tree drawable-tree-region-prim :offset 252)
|
|
(tfrag-masks texture-masks-array :offset-assert 256)
|
|
(tfrag-closest (pointer float) :offset-assert 260)
|
|
(tfrag-mask-count uint32 :offset 260)
|
|
(shrub-masks texture-masks-array :offset-assert 264)
|
|
(shrub-closest (pointer float) :offset-assert 268)
|
|
(shrub-mask-count uint32 :offset 268)
|
|
(alpha-masks texture-masks-array :offset-assert 272)
|
|
(alpha-closest (pointer float) :offset-assert 276)
|
|
(alpha-mask-count uint32 :offset 276)
|
|
(water-masks texture-masks-array :offset-assert 280)
|
|
(water-closest (pointer float) :offset-assert 284)
|
|
(water-mask-count uint32 :offset 284)
|
|
(bsp-scale vector :inline :offset-assert 288)
|
|
(bsp-offset vector :inline :offset-assert 304)
|
|
(unk-data uint32 18 :offset 180)
|
|
(end uint8 :offset 399)
|
|
)
|
|
:method-count-assert 19
|
|
:size-assert #x190
|
|
:flag-assert #x1300000190
|
|
(:methods
|
|
(birth (_type_) none 17)
|
|
(deactivate-entities (_type_) none 18)
|
|
)
|
|
)
|
|
|
|
;; definition of type game-level
|
|
(deftype game-level (basic)
|
|
((master-bsp basic :offset-assert 4)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x8
|
|
:flag-assert #x900000008
|
|
)
|
|
|
|
;; definition for method 3 of type game-level
|
|
(defmethod inspect game-level ((obj game-level))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj (-> obj type))
|
|
(format #t "~1Tmaster-bsp: ~A~%" (-> obj master-bsp))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; definition of type view-frustum
|
|
(deftype view-frustum (structure)
|
|
((hither-top-left vector :inline :offset-assert 0)
|
|
(hither-top-right vector :inline :offset-assert 16)
|
|
(hither-bottom-left vector :inline :offset-assert 32)
|
|
(hither-bottom-right vector :inline :offset-assert 48)
|
|
(yon-top-left vector :inline :offset-assert 64)
|
|
(yon-top-right vector :inline :offset-assert 80)
|
|
(yon-bottom-left vector :inline :offset-assert 96)
|
|
(yon-bottom-right vector :inline :offset-assert 112)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x80
|
|
:flag-assert #x900000080
|
|
)
|
|
|
|
;; definition for method 3 of type view-frustum
|
|
(defmethod inspect view-frustum ((obj view-frustum))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj 'view-frustum)
|
|
(format #t "~1Thither-top-left: #<vector @ #x~X>~%" (-> obj hither-top-left))
|
|
(format #t "~1Thither-top-right: #<vector @ #x~X>~%" (-> obj hither-top-right))
|
|
(format #t "~1Thither-bottom-left: #<vector @ #x~X>~%" (-> obj hither-bottom-left))
|
|
(format #t "~1Thither-bottom-right: #<vector @ #x~X>~%" (-> obj hither-bottom-right))
|
|
(format #t "~1Tyon-top-left: #<vector @ #x~X>~%" (-> obj yon-top-left))
|
|
(format #t "~1Tyon-top-right: #<vector @ #x~X>~%" (-> obj yon-top-right))
|
|
(format #t "~1Tyon-bottom-left: #<vector @ #x~X>~%" (-> obj yon-bottom-left))
|
|
(format #t "~1Tyon-bottom-right: #<vector @ #x~X>~%" (-> obj yon-bottom-right))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; definition for method 3 of type bsp-header
|
|
(defmethod inspect bsp-header ((obj bsp-header))
|
|
(format #t "[~8x] ~A~%" obj (-> obj type))
|
|
(format #t "~Tall-visible-list: #x~X~%" (-> obj all-visible-list))
|
|
(format #t "~Tvisible-list-length: ~D~%" (-> obj visible-list-length))
|
|
(format #t "~Tdrawable-trees: ~A~%" (-> obj drawable-trees))
|
|
(format #t "~Tpat: #x~X~%" (-> obj pat))
|
|
(format #t "~Tpat-length: ~D~%" (-> obj pat-length))
|
|
(inspect-bsp-tree obj (-> obj nodes 0))
|
|
obj
|
|
)
|
|
|
|
;; definition (debug) for function inspect-bsp-tree
|
|
;; WARN: Return type mismatch bsp-header vs none.
|
|
(defun-debug inspect-bsp-tree ((arg0 bsp-header) (arg1 bsp-node))
|
|
(cond
|
|
((zero? arg1)
|
|
)
|
|
(else
|
|
(format #t "_#x~X________________~%" arg1)
|
|
(inspect arg1)
|
|
(let ((s4-0 *print-column*))
|
|
(set! *print-column* (+ *print-column* 64))
|
|
(if (> (-> arg1 front) 0)
|
|
(inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 front)))
|
|
(format #t "_#x~X________________~%" arg1)
|
|
)
|
|
(if (> (-> arg1 back) 0)
|
|
(inspect-bsp-tree arg0 (the-as bsp-node (-> arg1 back)))
|
|
(format #t "_#x~X________________~%" arg1)
|
|
)
|
|
(set! *print-column* s4-0)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function map-bsp-tree
|
|
;; WARN: Return type mismatch bsp-header vs none.
|
|
(defun map-bsp-tree ((arg0 (function bsp-node none)) (arg1 bsp-header) (arg2 bsp-node))
|
|
(cond
|
|
((zero? arg2)
|
|
)
|
|
(else
|
|
(if (> (-> arg2 front) 0)
|
|
(map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 front)))
|
|
(arg0 arg2)
|
|
)
|
|
(if (> (-> arg2 back) 0)
|
|
(map-bsp-tree arg0 arg1 (the-as bsp-node (-> arg2 back)))
|
|
(arg0 arg2)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition of type collide-stats
|
|
(deftype collide-stats (structure)
|
|
((calls uint32 :offset-assert 0)
|
|
(spheres uint32 :offset-assert 4)
|
|
(nodes uint32 :offset-assert 8)
|
|
(frags uint32 :offset-assert 12)
|
|
(tris uint32 :offset-assert 16)
|
|
(output uint32 :offset-assert 20)
|
|
(pad0 uint32 2 :offset-assert 24)
|
|
(total-target uint32 8 :offset-assert 32)
|
|
(target-cache-fill uint32 8 :offset-assert 64)
|
|
(target-ray-poly uint32 6 :offset-assert 96)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x78
|
|
:flag-assert #x900000078
|
|
)
|
|
|
|
;; definition for method 3 of type collide-stats
|
|
(defmethod inspect collide-stats ((obj collide-stats))
|
|
(when (not obj)
|
|
(set! obj obj)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" obj 'collide-stats)
|
|
(format #t "~1Tcalls: ~D~%" (-> obj calls))
|
|
(format #t "~1Tspheres: ~D~%" (-> obj spheres))
|
|
(format #t "~1Tnodes: ~D~%" (-> obj nodes))
|
|
(format #t "~1Tfrags: ~D~%" (-> obj frags))
|
|
(format #t "~1Ttris: ~D~%" (-> obj tris))
|
|
(format #t "~1Toutput: ~D~%" (-> obj output))
|
|
(format #t "~1Ttotal-target: #<stopwatch @ #x~X>~%" (&-> obj pad0 1))
|
|
(format #t "~1Ttarget-cache-fill: #<stopwatch @ #x~X>~%" (&-> obj total-target 7))
|
|
(format #t "~1Ttarget-ray-poly: #<stopwatch @ #x~X>~%" (&-> obj target-cache-fill 7))
|
|
(label cfg-4)
|
|
obj
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
0
|