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

116 lines
3.4 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition for function position-in-front-of-camera!
(defun position-in-front-of-camera! ((arg0 vector) (arg1 float) (arg2 float))
(vector-float*! arg0 (-> *math-camera* inv-camera-rot fvec) arg1)
(vector+float*! arg0 arg0 (-> *math-camera* inv-camera-rot uvec) arg2)
(vector+! arg0 arg0 (-> *math-camera* trans))
arg0
)
;; definition for function position-in-front-of-screen!
(defun position-in-front-of-screen! ((arg0 vector) (arg1 float) (arg2 vector))
(let ((a2-1 (vector-negate! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot fvec)))
(a1-3 (vector-float*! (new 'stack-no-clear 'vector) (-> *math-camera* inv-camera-rot fvec) arg1))
)
(vector+! a1-3 a1-3 (-> *math-camera* trans))
(reverse-transform-point! arg0 a1-3 a2-1 arg2)
)
arg0
)
;; definition for function matrix-local->world
(defun matrix-local->world ((arg0 symbol) (arg1 symbol))
(if arg0
(-> *math-camera* inv-camera-rot-smooth)
(-> *math-camera* inv-camera-rot)
)
)
;; definition for function matrix-world->local
(defun matrix-world->local ((arg0 symbol) (arg1 object))
(-> *math-camera* camera-rot)
)
;; definition (perm) for symbol *camera-dummy-vector*, type vector
(define-perm *camera-dummy-vector* vector (vector-reset! (new 'global 'vector)))
;; definition for function camera-pos
(defun camera-pos ()
(cond
(*camera-combiner*
(-> *camera-combiner* trans)
)
(*math-camera*
(-> *math-camera* trans)
)
(else
*camera-dummy-vector*
)
)
)
;; definition for function math-camera-pos
(defun math-camera-pos ()
(-> *math-camera* trans)
)
;; definition for function camera-matrix
(defun camera-matrix ()
(if *camera-combiner*
(-> *camera-combiner* inv-camera-rot)
(-> *math-camera* inv-camera-rot)
)
)
;; definition for function math-camera-matrix
(defun math-camera-matrix ()
(-> *math-camera* inv-camera-rot)
)
;; definition for function camera-angle
(defun camera-angle ()
(let ((f0-0 (-> *math-camera* camera-rot rvec x))
(f1-0 (-> *math-camera* camera-rot rvec z))
)
(atan f1-0 f0-0)
)
)
;; definition for function camera-teleport-to-entity
;; INFO: Used lq/sq
;; WARN: Return type mismatch object vs symbol.
(defbehavior camera-teleport-to-entity process ((arg0 entity-actor))
(let ((gp-0 (new 'stack 'transformq)))
(vector-copy! (-> gp-0 trans) (-> arg0 extra trans))
(quaternion-copy! (-> gp-0 quat) (-> arg0 quat))
(vector-identity! (-> gp-0 scale))
(the-as symbol (send-event *camera* 'teleport-to-transformq gp-0))
)
)
;; definition for function camera-teleport-to-entity-named
;; WARN: Return type mismatch int vs none.
(defun camera-teleport-to-entity-named ((arg0 string))
(let ((a0-3 (as-type (entity-by-name arg0) entity-actor)))
(if a0-3
(camera-teleport-to-entity (the-as entity-actor a0-3))
(format #t "sorry, couldn't find an actor named '~S'~%" arg0)
)
)
0
(none)
)
;; definition for function camera-teleport-to-location
;; WARN: Return type mismatch int vs none.
(defun camera-teleport-to-location ((arg0 float) (arg1 float) (arg2 float))
(let ((v1-1 (new 'stack 'transformq)))
(set-vector! (-> v1-1 trans) (* 4096.0 arg0) (* 4096.0 arg1) (* 4096.0 arg2) 1.0)
(send-event *camera* 'teleport-to-transformq v1-1)
)
0
(none)
)