[decompiler] as-type and font method support (#3855)

Add support for `as-type` macro, and detecting inline font methods. This
works in all three games but I've only updated jak 3's goal_src for now.
Eventually I will go back and work through the others, but I want to get
more decompiler features in first.


![image](https://github.com/user-attachments/assets/5c31bf85-97b4-437c-bc4b-dc054e60551e)

---------

Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
water111
2025-02-01 21:23:11 -05:00
committed by GitHub
parent d5590ab638
commit 48cb9bb787
645 changed files with 5391 additions and 16694 deletions
+24 -36
View File
@@ -201,46 +201,34 @@
(send-event proc 'touch (-> block param 0))
)
(('attack)
(let ((s4-0 *target*)
(s3-0 proc)
)
(when (!= (if (type? s3-0 process-focusable)
(the-as process-focusable s3-0)
(when (!= (as-type proc process-focusable) *target*)
(let ((s5-1 (the-as attack-info (-> block param 1))))
(case (-> s5-1 mode)
(('eco-red 'eco-yellow 'eco-blue 'eco-dark)
#f
)
(else
(when (!= (-> s5-1 id) (-> self incoming-attack-id))
(set! (-> self incoming-attack-id) (-> s5-1 id))
(let ((v1-10 (as-type proc process-focusable)))
(cond
(v1-10
(vector-! (-> self hit-dir) (-> self root trans) (-> v1-10 root trans))
(vector-normalize! (-> self hit-dir) 1.0)
)
s4-0
)
(let ((s5-1 (the-as attack-info (-> block param 1))))
(case (-> s5-1 mode)
(('eco-red 'eco-yellow 'eco-blue 'eco-dark)
#f
)
(else
(when (!= (-> s5-1 id) (-> self incoming-attack-id))
(set! (-> self incoming-attack-id) (-> s5-1 id))
(let ((v1-10 (if (type? proc process-focusable)
(the-as process-focusable proc)
)
)
)
(cond
(v1-10
(vector-! (-> self hit-dir) (-> self root trans) (-> v1-10 root trans))
(vector-normalize! (-> self hit-dir) 1.0)
)
((logtest? (attack-mask attacker-velocity) (-> s5-1 mask))
(vector-normalize-copy! (-> self hit-dir) (-> s5-1 attacker-velocity) 1.0)
)
(else
(vector-reset! (-> self hit-dir))
)
((logtest? (attack-mask attacker-velocity) (-> s5-1 mask))
(vector-normalize-copy! (-> self hit-dir) (-> s5-1 attacker-velocity) 1.0)
)
(else
(vector-reset! (-> self hit-dir))
)
)
(+! (-> self hit-points) -1.0)
(if (>= 0.0 (-> self hit-points))
(go-virtual die)
(go-virtual hit)
)
)
(+! (-> self hit-points) -1.0)
(if (>= 0.0 (-> self hit-points))
(go-virtual die)
(go-virtual hit)
)
)
)
)
+16 -22
View File
@@ -700,18 +700,14 @@
#t
)
(else
(let ((s4-1 (-> s5-0 best-other-tri collide-ptr)))
(when (and (if (type? s4-1 collide-shape-prim)
s4-1
)
(< (vector-dot
(-> s5-0 best-other-tri normal)
(vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri)))
)
0.0
(when (and (the-as basic (as-type (-> s5-0 best-other-tri collide-ptr) collide-shape-prim))
(< (vector-dot
(-> s5-0 best-other-tri normal)
(vector-! (new 'stack-no-clear 'vector) arg2 (the-as vector (-> s5-0 best-other-tri)))
)
)
)
0.0
)
)
)
)
)
@@ -1813,17 +1809,15 @@
(set! (-> s2-1 entity) (-> this actor-group 1 data s5-2 actor))
(set! (-> s2-1 directed?) #f)
(set! (-> s2-1 no-initial-move-to-ground?) #f)
(let* ((s1-2 (ppointer->process (process-spawn predator :init enemy-init-by-other this s2-1 :to this)))
(s2-2 (if (type? s1-2 process-focusable)
s1-2
)
)
(s3-2 (entity-nav-mesh-by-aid (the-as actor-id (-> s3-1 nav-mesh-id))))
(v1-66 (if (type? s3-2 entity-nav-mesh)
s3-2
)
)
)
(let ((s2-2
(the-as process (as-type
(ppointer->process (process-spawn predator :init enemy-init-by-other this s2-1 :to this))
process-focusable
)
)
)
(v1-66 (as-type (entity-nav-mesh-by-aid (the-as actor-id (-> s3-1 nav-mesh-id))) entity-nav-mesh))
)
(set! (-> this predator-h (-> this predator-count)) (process->handle s2-2))
(+! (-> this predator-count) 1)
(when v1-66
+1 -6
View File
@@ -139,12 +139,7 @@
(defmethod spooked? ((this wren))
"@returns a [[symbol]] indicating if Jak is considered close enough to the wren to spook it.
If so, it transitions from [[wren::peck]] to [[wren::hunt]]"
(let* ((gp-0 *target*)
(a0-2 (if (type? gp-0 process-focusable)
gp-0
)
)
)
(let ((a0-2 (the-as target (as-type *target* process-focusable))))
(the-as symbol (and a0-2 (< (vector-vector-xz-distance (-> this root trans) (get-trans a0-2 0)) 102400.0)))
)
)