mirror of
https://github.com/open-goal/jak-project
synced 2026-08-17 05:31:46 -04:00
[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.  --------- Co-authored-by: water111 <awaterford1111445@gmail.com>
This commit is contained in:
+2
-12
@@ -868,12 +868,7 @@
|
||||
(set! (-> v1-4 action-mask) (collide-action solid))
|
||||
)
|
||||
(when (>= (fill-and-probe-using-line-sphere *collide-cache* s4-0) 0.0)
|
||||
(let* ((s3-0 (-> s4-0 best-other-tri collide-ptr))
|
||||
(s4-1 (if (type? s3-0 collide-shape-prim-sphere)
|
||||
(the-as collide-shape-prim-sphere s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s4-1 (as-type (-> s4-0 best-other-tri collide-ptr) collide-shape-prim-sphere)))
|
||||
(when s4-1
|
||||
(set! (-> s5-0 y) 0.0)
|
||||
(vector-normalize! s5-0 1.0)
|
||||
@@ -943,12 +938,7 @@
|
||||
|
||||
;; definition for method 70 of type amphibian
|
||||
(defmethod go-hostile ((this amphibian))
|
||||
(let* ((s4-0 (handle->process (-> this attacker-handle)))
|
||||
(s5-0 (if (type? s4-0 process-focusable)
|
||||
s4-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s5-0 (the-as process (as-type (handle->process (-> this attacker-handle)) process-focusable))))
|
||||
(when s5-0
|
||||
(set! (-> this attacker-handle) (the-as handle #f))
|
||||
(when (collide-check? (-> this focus) (the-as process-focusable s5-0))
|
||||
|
||||
+12
-29
@@ -862,12 +862,7 @@
|
||||
;; INFO: Used lq/sq
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod flitter-method-180 ((this flitter))
|
||||
(let* ((s5-0 (handle->process (-> this focus handle)))
|
||||
(s3-0 (if (type? s5-0 process-focusable)
|
||||
(the-as process-focusable s5-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s3-0 (as-type (handle->process (-> this focus handle)) process-focusable)))
|
||||
(when s3-0
|
||||
(let* ((s5-1 (get-trans s3-0 0))
|
||||
(s4-1 (vector-! (new 'stack-no-clear 'vector) s5-1 (-> this root trans)))
|
||||
@@ -946,12 +941,8 @@
|
||||
(local-vars (v1-29 symbol))
|
||||
(stop-looking-at-target! self)
|
||||
(set! (-> self skel root-channel 0 frame-group) arg0)
|
||||
(let ((s4-1 (enemy-method-50 self (new 'stack-no-clear 'vector)))
|
||||
(s3-0 (-> self root))
|
||||
)
|
||||
(when (if (type? s3-0 collide-shape-moving)
|
||||
s3-0
|
||||
)
|
||||
(let ((s4-1 (enemy-method-50 self (new 'stack-no-clear 'vector))))
|
||||
(when (as-type (-> self root) collide-shape-moving)
|
||||
(set! (-> self root transv y) 33775.48)
|
||||
(ja :num-func num-func-identity :frame-num 0.0)
|
||||
(set-time! (-> self state-time))
|
||||
@@ -1058,18 +1049,15 @@
|
||||
(cond
|
||||
((= v1-11 (enemy-aware enemy-aware-3))
|
||||
(cond
|
||||
((when gp-0
|
||||
(let* ((gp-1 self)
|
||||
(s5-1 (method-of-object gp-1 flitter-method-182))
|
||||
(s4-0 (handle->process (-> self focus handle)))
|
||||
)
|
||||
(s5-1 gp-1 (the-as process-focusable (if (type? s4-0 process-focusable)
|
||||
s4-0
|
||||
)
|
||||
)
|
||||
)
|
||||
((if gp-0
|
||||
(flitter-method-182
|
||||
self
|
||||
(the-as
|
||||
process-focusable
|
||||
(the-as process (as-type (handle->process (-> self focus handle)) process-focusable))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (and (get-enemy-target self) (time-elapsed? (the-as int (-> self off-screen-timer)) (seconds 0.3)))
|
||||
(go-hostile self)
|
||||
)
|
||||
@@ -1204,12 +1192,7 @@
|
||||
)
|
||||
:trans (behavior ()
|
||||
(local-vars (s5-2 object))
|
||||
(let* ((s5-0 (handle->process (-> self focus handle)))
|
||||
(gp-0 (if (type? s5-0 process-focusable)
|
||||
(the-as process-focusable s5-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((gp-0 (as-type (handle->process (-> self focus handle)) process-focusable)))
|
||||
(set! s5-2 (cond
|
||||
((and gp-0
|
||||
(not (time-elapsed? (-> self state-time) (seconds 1.5)))
|
||||
|
||||
+2
-15
@@ -316,12 +316,7 @@
|
||||
(dotimes (group-idx (-> this actor-group-count))
|
||||
(let ((group (-> this actor-group group-idx)))
|
||||
(dotimes (actor-idx (-> group length))
|
||||
(let* ((actor-proc (-> group data actor-idx actor extra process))
|
||||
(fodder-proc (if (type? actor-proc fodder)
|
||||
(the-as fodder actor-proc)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((fodder-proc (as-type (-> group data actor-idx actor extra process) fodder)))
|
||||
(when (and fodder-proc (!= fodder-proc this) (time-elapsed? (-> fodder-proc look-at-other-time) (seconds 0.25)))
|
||||
(let* ((dir-to-other-fodder
|
||||
(vector-! (new 'stack-no-clear 'vector) (-> fodder-proc root trans) (-> this root trans))
|
||||
@@ -379,15 +374,7 @@
|
||||
(let ((proc (the-as process-drawable #f)))
|
||||
(cond
|
||||
((and (not (time-elapsed? (-> this look-at-other-time) (seconds 0.5)))
|
||||
(begin
|
||||
(let ((other-proc (handle->process (-> this look-at-other))))
|
||||
(set! proc (if (type? other-proc process-drawable)
|
||||
(the-as process-drawable other-proc)
|
||||
)
|
||||
)
|
||||
)
|
||||
proc
|
||||
)
|
||||
(begin (set! proc (as-type (handle->process (-> this look-at-other)) process-drawable)) proc)
|
||||
)
|
||||
(let ((s5-1 (vector<-cspace! (new 'static 'vector) (-> proc node-list data 5))))
|
||||
(look-at-position! this s5-1)
|
||||
|
||||
+1
-6
@@ -480,12 +480,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((gp-1 *target*)
|
||||
(a0-4 (if (type? gp-1 process-focusable)
|
||||
gp-1
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a0-4 (the-as target (as-type *target* process-focusable))))
|
||||
(when a0-4
|
||||
(let* ((gp-2 (-> self root))
|
||||
(s3-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (get-trans a0-4 0) (-> gp-2 trans)) 1.0))
|
||||
|
||||
Generated
Vendored
+16
-34
@@ -1223,12 +1223,7 @@
|
||||
)
|
||||
(('hit 'hit-flinch 'hit-knocked)
|
||||
(speech-control-method-13 *speech-control* (the-as handle this))
|
||||
(let* ((s1-0 (handle->process (-> this incoming attacker-handle)))
|
||||
(a0-13 (if (type? s1-0 process-focusable)
|
||||
s1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a0-13 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable))))
|
||||
(if (and a0-13 (logtest? (-> a0-13 mask) (process-mask target)))
|
||||
(speech-control-method-12 *speech-control* this (speech-type speech-type-11))
|
||||
)
|
||||
@@ -1385,22 +1380,18 @@
|
||||
((< (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0)
|
||||
0
|
||||
)
|
||||
((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
|
||||
)
|
||||
)
|
||||
2
|
||||
)
|
||||
(else
|
||||
(let ((s4-1 (-> s5-0 best-other-tri collide-ptr)))
|
||||
(if (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
|
||||
)
|
||||
)
|
||||
2
|
||||
0
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -2602,13 +2593,9 @@
|
||||
(set-point! (-> this l-control) 1 s5-0)
|
||||
(set! (-> this l-control spec) (-> *lightning-spec-id-table* 13))
|
||||
(+! (-> this l-control state points-to-draw) 2)
|
||||
(let* ((s4-1 (-> s3-0 best-other-tri collide-ptr))
|
||||
(v1-45 (if (type? s4-1 collide-shape-prim)
|
||||
(the-as collide-shape-prim s4-1)
|
||||
)
|
||||
)
|
||||
(s4-2 #t)
|
||||
)
|
||||
(let ((v1-45 (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim))
|
||||
(s4-2 #t)
|
||||
)
|
||||
(when v1-45
|
||||
(set! s4-2 #f)
|
||||
(if (logtest? (-> v1-45 prim-core collide-as) (collide-spec jak bot))
|
||||
@@ -3820,12 +3807,7 @@
|
||||
;; definition for method 201 of type crimson-guard-level
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defmethod crimson-guard-level-method-201 ((this crimson-guard-level) (arg0 float))
|
||||
(let* ((s3-0 (handle->process (-> this transport)))
|
||||
(s4-0 (if (type? s3-0 process-focusable)
|
||||
(the-as process-focusable s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s4-0 (as-type (handle->process (-> this transport)) process-focusable)))
|
||||
(when s4-0
|
||||
(let ((s2-0 (matrix<-transformq! (new 'stack-no-clear 'matrix) (the-as transformq (-> s4-0 root trans))))
|
||||
(s3-1 (new 'stack-no-clear 'vector))
|
||||
|
||||
Generated
Vendored
+2
-12
@@ -874,12 +874,7 @@
|
||||
)
|
||||
)
|
||||
(let ((gp-0 (-> self dest-pos)))
|
||||
(let* ((s5-0 (handle->process (-> self focus handle)))
|
||||
(a0-6 (if (type? s5-0 process-focusable)
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a0-6 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable))))
|
||||
(set! (-> gp-0 quad) (-> (get-trans (the-as process-focusable a0-6) 0) quad))
|
||||
)
|
||||
(+! (-> gp-0 y) -20480.0)
|
||||
@@ -1194,12 +1189,7 @@
|
||||
(hover-enemy-method-153 this)
|
||||
)
|
||||
(when (> (-> this hit-points) 0)
|
||||
(let* ((s1-0 (handle->process (-> this incoming attacker-handle)))
|
||||
(v1-23 (if (type? s1-0 process-focusable)
|
||||
s1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-23 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable))))
|
||||
(if (and *target* v1-23 (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> this focus-pos)))
|
||||
(f1-0 122880.0)
|
||||
)
|
||||
|
||||
+7
-16
@@ -176,12 +176,7 @@
|
||||
(hover-formation-method-15 a0-2 gp-0 (-> self offset))
|
||||
)
|
||||
(else
|
||||
(let* ((s5-0 (handle->process (-> self focus handle)))
|
||||
(a0-7 (if (type? s5-0 process-focusable)
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a0-7 (the-as process (as-type (handle->process (-> self focus handle)) process-focusable))))
|
||||
(cond
|
||||
(a0-7
|
||||
(let* ((s5-1 (get-trans (the-as process-focusable a0-7) 3))
|
||||
@@ -477,16 +472,12 @@
|
||||
(hover-enemy-method-141 self 1.0)
|
||||
)
|
||||
)
|
||||
(let* ((gp-0 *target*)
|
||||
(s1-0 (if (type? gp-0 process-focusable)
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
(gp-1 (new 'stack-no-clear 'vector))
|
||||
(s2-0 (new 'stack-no-clear 'vector))
|
||||
(s4-0 (-> self root))
|
||||
(s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp))
|
||||
)
|
||||
(let ((s1-0 (the-as target (as-type *target* process-focusable)))
|
||||
(gp-1 (new 'stack-no-clear 'vector))
|
||||
(s2-0 (new 'stack-no-clear 'vector))
|
||||
(s4-0 (-> self root))
|
||||
(s5-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp))
|
||||
)
|
||||
(let ((s0-0 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) 1.0 'interp))
|
||||
(s3-1
|
||||
(-> (the-as collide-shape-prim-group (-> self root root-prim))
|
||||
|
||||
+9
-46
@@ -16,18 +16,10 @@
|
||||
;; definition for method 16 of type hover-formation-control
|
||||
(defmethod hover-formation-control-method-16 ((this hover-formation-control))
|
||||
(let ((gp-0 (hover-formation-control-method-13 this (new 'stack-no-clear 'vector)))
|
||||
(s4-0 (cond
|
||||
((-> this anchor-proc)
|
||||
(let ((s3-0 (handle->process (-> this anchor-proc))))
|
||||
(if (type? s3-0 process-focusable)
|
||||
(the-as process-focusable s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(s4-0 (if (-> this anchor-proc)
|
||||
(as-type (handle->process (-> this anchor-proc)) process-focusable)
|
||||
*target*
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(and s4-0
|
||||
@@ -61,18 +53,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(s3-0 (cond
|
||||
((-> this anchor-proc)
|
||||
(let ((s2-0 (handle->process (-> this anchor-proc))))
|
||||
(if (type? s2-0 process-focusable)
|
||||
(the-as process-focusable s2-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(s3-0 (if (-> this anchor-proc)
|
||||
(as-type (handle->process (-> this anchor-proc)) process-focusable)
|
||||
*target*
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
@@ -116,18 +100,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(a0-7 (cond
|
||||
((-> this anchor-proc)
|
||||
(let ((s4-0 (handle->process (-> this anchor-proc))))
|
||||
(if (type? s4-0 process-focusable)
|
||||
(the-as process-focusable s4-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(a0-7 (if (-> this anchor-proc)
|
||||
(as-type (handle->process (-> this anchor-proc)) process-focusable)
|
||||
*target*
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(cond
|
||||
@@ -312,18 +288,10 @@
|
||||
(vector-rotate-y! arg0 arg1 arg2)
|
||||
(cond
|
||||
((logtest? (-> this flags) 2)
|
||||
(let ((s2-0 (cond
|
||||
((-> this anchor-proc)
|
||||
(let ((s4-0 (handle->process (-> this anchor-proc))))
|
||||
(if (type? s4-0 process-focusable)
|
||||
(the-as process-focusable s4-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(let ((s2-0 (if (-> this anchor-proc)
|
||||
(as-type (handle->process (-> this anchor-proc)) process-focusable)
|
||||
*target*
|
||||
)
|
||||
)
|
||||
)
|
||||
(s4-1 (hover-formation-control-method-15 this (new 'stack-no-clear 'vector) arg0))
|
||||
(s3-0 (new 'stack-no-clear 'vector))
|
||||
@@ -402,12 +370,7 @@
|
||||
(set! (-> s5-0 best-cost) -1.0)
|
||||
(set! (-> s5-0 count) 0)
|
||||
(dotimes (s4-0 16)
|
||||
(let* ((s3-0 (handle->process (-> this actor-table s4-0)))
|
||||
(a0-8 (if (type? s3-0 process-focusable)
|
||||
(the-as process-focusable s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a0-8 (as-type (handle->process (-> this actor-table s4-0)) process-focusable)))
|
||||
(cond
|
||||
(a0-8
|
||||
(set! (-> s5-0 actor-position s4-0 quad) (-> (get-trans a0-8 3) quad))
|
||||
|
||||
Generated
Vendored
+1
-6
@@ -925,12 +925,7 @@
|
||||
(let ((v1-2 (the-as list-node (-> this sphere-list))))
|
||||
(while v1-2
|
||||
(let ((s5-0 (-> v1-2 next)))
|
||||
(let* ((s3-0 (handle->process (-> (the-as hover-nav-sphere v1-2) handle)))
|
||||
(s4-0 (if (type? s3-0 hover-enemy)
|
||||
s3-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((s4-0 (the-as process (as-type (handle->process (-> (the-as hover-nav-sphere v1-2) handle)) hover-enemy))))
|
||||
(when s4-0
|
||||
(let ((a1-9 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-9 from) (process->ppointer pp))
|
||||
|
||||
+3
-7
@@ -496,13 +496,9 @@
|
||||
;; definition for method 104 of type metalmonk
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod enemy-method-104 ((this metalmonk) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint))
|
||||
(let* ((s3-0 arg0)
|
||||
(a0-2 (if (type? s3-0 process-focusable)
|
||||
s3-0
|
||||
)
|
||||
)
|
||||
(s3-1 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(let ((a0-2 (the-as process (as-type arg0 process-focusable)))
|
||||
(s3-1 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(let ((s1-0 (new 'stack-no-clear 'vector)))
|
||||
(vector-! s3-1 (get-trans (the-as process-focusable a0-2) 0) (-> this root trans))
|
||||
(set! (-> s3-1 y) 0.0)
|
||||
|
||||
Reference in New Issue
Block a user