mirror of
https://github.com/open-goal/jak-project
synced 2026-07-09 14:55:51 -04:00
93afb02cf4
This includes all the collision stuff needed to spawn `target`, decompiles the sparticle code and adds some of the PC hacks needed for merc to run (it doesn't work quite right and looks bad, likely due to a combination of code copied from Jak 2 and the time of day hacks). There are a bunch of temporary hacks (see commits) in place to prevent the game from crashing quite as much, but it is still extremely prone to doing so due to lots of missing functions/potentially bad decomp. --------- Co-authored-by: water <awaterford111445@gmail.com>
238 lines
7.7 KiB
Common Lisp
Vendored
Generated
238 lines
7.7 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type touching-prim
|
|
(deftype touching-prim (structure)
|
|
"A collide primitive that's touching another.
|
|
Potentially also stores the triangle that is involved."
|
|
((cprim collide-shape-prim)
|
|
(has-tri? symbol)
|
|
(tri collide-tri-result :inline)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type touching-prim
|
|
(defmethod inspect ((this touching-prim))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'touching-prim)
|
|
(format #t "~1Tcprim: ~A~%" (-> this cprim))
|
|
(format #t "~1Thas-tri?: ~A~%" (-> this has-tri?))
|
|
(format #t "~1Ttri: #<collide-tri-result @ #x~X>~%" (-> this tri))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type touching-prims-entry
|
|
(deftype touching-prims-entry (structure)
|
|
"A record of two primitives touching."
|
|
((next touching-prims-entry)
|
|
(prev touching-prims-entry)
|
|
(allocated? symbol)
|
|
(u float)
|
|
(prim1 touching-prim :inline)
|
|
(prim2 touching-prim :inline)
|
|
)
|
|
(:methods
|
|
(touching-prims-entry-method-9 (_type_ vector) vector)
|
|
(get-middle-of-bsphere-overlap (_type_ vector) vector)
|
|
(get-touched-prim (_type_ collide-shape touching-shapes-entry) collide-shape-prim)
|
|
(get-touched-tri (_type_ collide-shape touching-shapes-entry) collide-tri-result)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type touching-prims-entry
|
|
(defmethod inspect ((this touching-prims-entry))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'touching-prims-entry)
|
|
(format #t "~1Tnext: #<touching-prims-entry @ #x~X>~%" (-> this next))
|
|
(format #t "~1Tprev: #<touching-prims-entry @ #x~X>~%" (-> this prev))
|
|
(format #t "~1Tallocated?: ~A~%" (-> this allocated?))
|
|
(format #t "~1Tu: ~f~%" (-> this u))
|
|
(format #t "~1Tprim1: #<touching-prim @ #x~X>~%" (-> this prim1))
|
|
(format #t "~1Tprim2: #<touching-prim @ #x~X>~%" (-> this prim2))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type touching-prims-entry-pool
|
|
(deftype touching-prims-entry-pool (structure)
|
|
"A pool of up to 64 touching prim records."
|
|
((head touching-prims-entry)
|
|
(nodes touching-prims-entry 64 :inline)
|
|
)
|
|
(:methods
|
|
(new (symbol type) _type_)
|
|
(alloc-node (_type_) touching-prims-entry)
|
|
(get-free-node-count (_type_) int)
|
|
(init-list! (_type_) none)
|
|
(free-node (_type_ touching-prims-entry) touching-prims-entry)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type touching-prims-entry-pool
|
|
(defmethod inspect ((this touching-prims-entry-pool))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'touching-prims-entry-pool)
|
|
(format #t "~1Thead: #<touching-prims-entry @ #x~X>~%" (-> this head))
|
|
(format #t "~1Tnodes[64] @ #x~X~%" (-> this nodes))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 11 of type touching-prims-entry-pool
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod init-list! ((this touching-prims-entry-pool))
|
|
(let ((prev (the-as touching-prims-entry #f)))
|
|
(let ((current (the-as touching-prims-entry (-> this nodes))))
|
|
(set! (-> this head) current)
|
|
(countdown (a0-1 64)
|
|
(set! (-> current prev) prev)
|
|
(let ((next (&+ current 240)))
|
|
(set! (-> current next) (the-as touching-prims-entry next))
|
|
(set! (-> current allocated?) #f)
|
|
(set! prev current)
|
|
(set! current (the-as touching-prims-entry next))
|
|
)
|
|
)
|
|
)
|
|
(set! (-> prev next) #f)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 0 of type touching-prims-entry-pool
|
|
;; WARN: Return type mismatch structure vs touching-prims-entry-pool.
|
|
(defmethod new touching-prims-entry-pool ((allocation symbol) (type-to-make type))
|
|
(let ((t9-0 (method-of-type structure new))
|
|
(v1-1 type-to-make)
|
|
)
|
|
(-> type-to-make size)
|
|
(let ((gp-0 (t9-0 allocation v1-1)))
|
|
((method-of-type touching-prims-entry-pool init-list!) (the-as touching-prims-entry-pool gp-0))
|
|
(the-as touching-prims-entry-pool gp-0)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition of type touching-shapes-entry
|
|
(deftype touching-shapes-entry (structure)
|
|
"A record of two collide shapes touching,
|
|
storing a record of the primitives involved."
|
|
((cshape1 collide-shape)
|
|
(cshape2 collide-shape)
|
|
(resolve-u int8)
|
|
(head touching-prims-entry)
|
|
(handle1 handle)
|
|
(handle2 handle)
|
|
)
|
|
:pack-me
|
|
(:methods
|
|
(get-head (_type_) touching-prims-entry)
|
|
(get-next (_type_ touching-shapes-entry) touching-prims-entry)
|
|
(get-touched-shape (_type_ collide-shape) collide-shape)
|
|
(prims-touching? (_type_ collide-shape uint) touching-prims-entry)
|
|
(prims-touching-action? (_type_ collide-shape collide-action collide-action) basic)
|
|
(free-touching-prims-list (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type touching-shapes-entry
|
|
(defmethod inspect ((this touching-shapes-entry))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'touching-shapes-entry)
|
|
(format #t "~1Tcshape1: ~A~%" (-> this cshape1))
|
|
(format #t "~1Tcshape2: ~A~%" (-> this cshape2))
|
|
(format #t "~1Tresolve-u: ~D~%" (-> this resolve-u))
|
|
(format #t "~1Thead: #<touching-prims-entry @ #x~X>~%" (-> this head))
|
|
(format #t "~1Thandle1: ~D~%" (-> this handle1))
|
|
(format #t "~1Thandle2: ~D~%" (-> this handle2))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition of type touching-list
|
|
(deftype touching-list (structure)
|
|
"Contains a record of touching collide shape pairs."
|
|
((num-touching-shapes int32)
|
|
(resolve-u int8)
|
|
(touching-shapes touching-shapes-entry 32 :inline)
|
|
)
|
|
(:methods
|
|
(new (symbol type) _type_)
|
|
(add-touching-prims (_type_ collide-shape-prim collide-shape-prim float collide-tri-result collide-tri-result) none)
|
|
(free-nodes (_type_) none)
|
|
(update-from-step-size (_type_ float) none)
|
|
(send-events-for-touching-shapes (_type_) none)
|
|
(get-shapes-entry (_type_ collide-shape collide-shape) touching-shapes-entry)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type touching-list
|
|
(defmethod inspect ((this touching-list))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(format #t "[~8x] ~A~%" this 'touching-list)
|
|
(format #t "~1Tnum-touching-shapes: ~D~%" (-> this num-touching-shapes))
|
|
(format #t "~1Tresolve-u: ~D~%" (-> this resolve-u))
|
|
(format #t "~1Ttouching-shapes[32] @ #x~X~%" (-> this touching-shapes))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for method 0 of type touching-list
|
|
;; WARN: Return type mismatch structure vs touching-list.
|
|
(defmethod new touching-list ((allocation symbol) (type-to-make type))
|
|
(let ((t9-0 (method-of-type structure new))
|
|
(v1-1 type-to-make)
|
|
)
|
|
(-> type-to-make size)
|
|
(let ((v0-0 (t9-0 allocation v1-1)))
|
|
(set! (-> (the-as touching-list v0-0) num-touching-shapes) 0)
|
|
(set! (-> (the-as touching-list v0-0) resolve-u) 0)
|
|
(the-as touching-list v0-0)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 9 of type touching-shapes-entry
|
|
(defmethod get-head ((this touching-shapes-entry))
|
|
(-> this head)
|
|
)
|
|
|
|
;; definition for method 10 of type touching-shapes-entry
|
|
;; WARN: Return type mismatch collide-shape vs touching-prims-entry.
|
|
(defmethod get-next ((this touching-shapes-entry) (arg0 touching-shapes-entry))
|
|
(the-as touching-prims-entry (-> arg0 cshape1))
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(kmemopen global "collide-touching-lists")
|
|
|
|
;; definition (perm) for symbol *touching-prims-entry-pool*, type touching-prims-entry-pool
|
|
(define-perm *touching-prims-entry-pool* touching-prims-entry-pool (new 'global 'touching-prims-entry-pool))
|
|
|
|
;; definition (perm) for symbol *touching-list*, type touching-list
|
|
(define-perm *touching-list* touching-list (new 'global 'touching-list))
|
|
|
|
;; failed to figure out what this is:
|
|
(kmemclose)
|
|
|
|
|
|
|
|
|