Files
water111 48cb9bb787 [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>
2025-02-01 21:23:11 -05:00

93 lines
3.6 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for symbol *los-time-offset*, type time-frame
(define *los-time-offset* (the-as time-frame 0))
;; definition for method 9 of type los-control
;; INFO: Used lq/sq
;; WARN: Return type mismatch time-frame vs none.
(defmethod los-control-method-9 ((this los-control) (process process-focusable) (trans-vec vector) (radius float))
(when (and (time-elapsed? (-> this last-check-time) (-> this check-interval))
(-> this src-proc)
(or process (-> this dst-proc))
)
(let ((process-focus (as-type (handle->process (-> this src-proc)) process-focusable)))
(when process-focus
(if (not process)
(set! process (as-type (handle->process (-> this dst-proc)) process-focusable))
)
(when process
(let ((start-pos (new 'stack-no-clear 'vector)))
(set! (-> start-pos quad) (-> (get-trans process-focus 3) quad))
(if (not trans-vec)
(set! trans-vec (get-trans process 3))
)
(let ((distance (vector-! (new 'stack-no-clear 'vector) trans-vec start-pos))
(cquery (new 'stack-no-clear 'collide-query))
)
(set! (-> cquery start-pos quad) (-> start-pos quad))
(set! (-> cquery move-dist quad) (-> distance quad))
(let ((query cquery))
(set! (-> query radius) radius)
(set! (-> query collide-with) (-> this collide-with))
(set! (-> query ignore-process0) process-focus)
(set! (-> query ignore-process1) process)
(set! (-> query ignore-pat) (-> process-focus root pat-ignore-mask))
(set! (-> query action-mask) (collide-action solid))
)
(fill-using-line-sphere *collide-cache* cquery)
(let ((f30-0 (probe-using-line-sphere *collide-cache* cquery)))
(quad-copy! (the-as pointer (-> this last-collide-result)) (the-as pointer (-> cquery best-other-tri)) 6)
(if (>= 0.0 f30-0)
(set-time! (-> this have-no-los))
(set-time! (-> this have-los))
)
)
)
)
(set-time! (-> this last-check-time))
)
)
)
)
(none)
)
;; definition for method 10 of type los-control
(defmethod check-los? ((this los-control) (arg0 time-frame))
(and (time-elapsed? (-> this have-los) (+ (-> this check-interval) arg0))
(not (time-elapsed? (-> this have-no-los) (-> this check-interval)))
)
)
;; definition for method 11 of type los-control
(defmethod skip-check-los? ((this los-control) (arg0 int))
(and (time-elapsed? (-> this have-no-los) (+ (-> this check-interval) arg0))
(not (time-elapsed? (-> this have-los) (-> this check-interval)))
)
)
;; definition for method 12 of type los-control
;; WARN: Return type mismatch int vs none.
(defmethod set-dst-proc! ((this los-control) (dst handle))
(set! (-> this dst-proc) dst)
0
(none)
)
;; definition for method 13 of type los-control
;; WARN: Return type mismatch int vs none.
(defmethod new-source! ((this los-control) (proc process) (check-interval time-frame) (c-spec collide-spec))
(set! (-> this src-proc) (process->handle proc))
(set! (-> this dst-proc) (the-as handle #f))
(set! (-> this have-los) 0)
(set! (-> this have-no-los) 0)
(set! (-> this last-check-time) *los-time-offset*)
(set! (-> this check-interval) check-interval)
(set! (-> this collide-with) c-spec)
(set! *los-time-offset* (+ *los-time-offset* 1))
0
(none)
)