mirror of
https://github.com/open-goal/jak-project
synced 2026-09-12 20:56:09 -04:00
6181c6c997
When working with mips2c recently, I noticed adding the `defmethod-mips2c` or `def-mips2c` code was a manual step. This is a bit tedious to have to go and do yourself, but more importantly you have to manually go and find the right spot in the source file else you might be declaring it too early or too late. This will automatically output the declaration for methods, and a half-finished comment for the functions. I wasn't able to fully output the function one because it seems the signature info from `all-types` doesn't make it all the way through -- but maybe I'm wrong or this is an easy fix?
225 lines
7.4 KiB
Common Lisp
Vendored
Generated
225 lines
7.4 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type ripple-request
|
|
(deftype ripple-request (structure)
|
|
((waveform ripple-wave :offset-assert 0)
|
|
(effect merc-effect :offset-assert 4)
|
|
)
|
|
:pack-me
|
|
:method-count-assert 9
|
|
:size-assert #x8
|
|
:flag-assert #x900000008
|
|
)
|
|
|
|
;; definition for method 3 of type ripple-request
|
|
(defmethod inspect ripple-request ((obj ripple-request))
|
|
(format #t "[~8x] ~A~%" obj 'ripple-request)
|
|
(format #t "~Twaveform: ~A~%" (-> obj waveform))
|
|
(format #t "~Teffect: #<merc-effect @ #x~X>~%" (-> obj effect))
|
|
obj
|
|
)
|
|
|
|
;; definition of type ripple-globals
|
|
(deftype ripple-globals (structure)
|
|
((count int32 :offset-assert 0)
|
|
(requests ripple-request 16 :inline :offset-assert 4)
|
|
)
|
|
:method-count-assert 9
|
|
:size-assert #x84
|
|
:flag-assert #x900000084
|
|
)
|
|
|
|
;; definition for method 3 of type ripple-globals
|
|
(defmethod inspect ripple-globals ((obj ripple-globals))
|
|
(format #t "[~8x] ~A~%" obj 'ripple-globals)
|
|
(format #t "~Tcount: ~D~%" (-> obj count))
|
|
(format #t "~Trequests[16] @ #x~X~%" (-> obj requests))
|
|
obj
|
|
)
|
|
|
|
;; definition for symbol *ripple-globals*, type ripple-globals
|
|
(define *ripple-globals* (new 'global 'ripple-globals))
|
|
|
|
;; definition for function ripple-make-request
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defun ripple-make-request ((arg0 ripple-wave) (arg1 merc-effect))
|
|
(let ((v1-1 (-> *ripple-globals* count))
|
|
(a2-1 (-> *ripple-globals* requests))
|
|
(a3-0 0)
|
|
)
|
|
(when (< v1-1 16)
|
|
(dotimes (t0-1 v1-1)
|
|
(if (= arg1 (-> a2-1 t0-1 effect))
|
|
(set! a3-0 1)
|
|
)
|
|
)
|
|
(when (zero? a3-0)
|
|
(set! (-> a2-1 v1-1 effect) arg1)
|
|
(set! (-> a2-1 v1-1 waveform) arg0)
|
|
(+! (-> *ripple-globals* count) 1)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ripple-update-waveform-offs
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defun ripple-update-waveform-offs ((arg0 ripple-wave-set))
|
|
(let ((f0-1 (the float (- (-> *display* integral-frame-counter) (the-as int (-> arg0 frame-save))))))
|
|
(when (!= f0-1 0.0)
|
|
(dotimes (v1-4 (-> arg0 count))
|
|
(let ((a1-4 (-> arg0 wave v1-4)))
|
|
(+! (-> a1-4 offs) (* f0-1 (-> a1-4 delta)))
|
|
(set! (-> a1-4 offs) (the float (logand (the int (-> a1-4 offs)) #xffff)))
|
|
)
|
|
)
|
|
(set! (-> arg0 frame-save) (the-as uint (-> *display* integral-frame-counter)))
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ripple-execute-init
|
|
;; INFO: function output is handled by mips2c
|
|
(def-mips2c ripple-execute-init (function none))
|
|
|
|
;; definition for function ripple-create-wave-table
|
|
;; INFO: function output is handled by mips2c
|
|
(def-mips2c ripple-create-wave-table (function ripple-wave-set int))
|
|
|
|
;; definition for function ripple-apply-wave-table
|
|
;; INFO: function output is handled by mips2c
|
|
(def-mips2c ripple-apply-wave-table (function merc-effect symbol))
|
|
|
|
;; definition for function ripple-execute
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defun ripple-execute ()
|
|
(when (-> *ripple-globals* count)
|
|
(ripple-execute-init)
|
|
(let ((gp-0 0)
|
|
(s5-0 (-> *ripple-globals* count))
|
|
(s4-0 (-> *ripple-globals* requests))
|
|
)
|
|
(while (!= gp-0 s5-0)
|
|
(when (-> s4-0 gp-0 waveform)
|
|
(let ((s3-0 gp-0)
|
|
(s2-0 (-> s4-0 gp-0 waveform))
|
|
)
|
|
(ripple-create-wave-table (the-as ripple-wave-set s2-0))
|
|
(while (!= s3-0 s5-0)
|
|
(when (= s2-0 (-> s4-0 s3-0 waveform))
|
|
(ripple-apply-wave-table (-> s4-0 s3-0 effect))
|
|
(set! (-> s4-0 s3-0 waveform) #f)
|
|
)
|
|
(+! s3-0 1)
|
|
)
|
|
)
|
|
)
|
|
(+! gp-0 1)
|
|
)
|
|
)
|
|
(set! (-> *ripple-globals* count) 0)
|
|
0
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ripple-matrix-scale
|
|
;; INFO: function output is handled by mips2c
|
|
(def-mips2c ripple-matrix-scale function)
|
|
|
|
;; definition (debug) for function ripple-add-debug-sphere
|
|
;; INFO: Used lq/sq
|
|
;; INFO: Return type mismatch symbol vs none.
|
|
(defun-debug ripple-add-debug-sphere ((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float))
|
|
(let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat))))
|
|
(s5-0 (new-stack-vector0))
|
|
)
|
|
(let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z))))
|
|
(f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z))))
|
|
)
|
|
(set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0))))
|
|
(set! (-> s5-0 y) 0.0)
|
|
(set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0))))
|
|
)
|
|
(set! (-> s5-0 w) 0.0)
|
|
(vector+! s5-0 s5-0 (-> arg0 root trans))
|
|
(add-debug-sphere #t (bucket-id debug) s5-0 2048.0 (new 'static 'rgba :r #xff :g #xff :a #x80))
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function ripple-slow-add-sine-waves
|
|
(defun ripple-slow-add-sine-waves ((arg0 ripple-wave-set) (arg1 float) (arg2 float))
|
|
(let ((f30-0 0.0))
|
|
(dotimes (s3-0 (-> arg0 count))
|
|
(let* ((v1-3 (-> arg0 wave s3-0))
|
|
(f0-2 (+ (-> v1-3 offs) (* arg1 (-> v1-3 xmul)) (* arg2 (-> v1-3 zmul))))
|
|
)
|
|
(+! f30-0 (* (-> v1-3 scale) (cos f0-2)))
|
|
)
|
|
)
|
|
(fmax -127.0 (fmin 127.0 f30-0))
|
|
)
|
|
)
|
|
|
|
;; definition for function ripple-find-height
|
|
(defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector))
|
|
(local-vars (sv-16 float) (sv-32 float))
|
|
(let* ((f30-0 (-> arg0 root trans y))
|
|
(v1-1 (-> arg0 draw))
|
|
(a1-5 (-> v1-1 lod-set lod (-> v1-1 cur-lod) geo effect))
|
|
)
|
|
(if (or (not (logtest? (-> a1-5 0 effect-bits) 4)) (not (-> v1-1 ripple)))
|
|
(return f30-0)
|
|
)
|
|
(let* ((a1-6 (-> a1-5 0 extra-info))
|
|
(s4-0 (the-as mei-ripple (+ (the-as uint a1-6) (* (-> a1-6 ripple-offset) 16))))
|
|
(gp-0 (-> v1-1 ripple))
|
|
(s5-0 (-> gp-0 waveform))
|
|
)
|
|
(if (not (-> gp-0 waveform))
|
|
(return f30-0)
|
|
)
|
|
(if (not (-> s5-0 converted))
|
|
(return f30-0)
|
|
)
|
|
(let* ((f28-0 (- (-> arg2 x) (-> arg0 root trans x)))
|
|
(f26-0 (- (-> arg2 z) (-> arg0 root trans z)))
|
|
(f22-0 (+ (quaternion-y-angle (-> arg0 root quat)) (-> s4-0 angle)))
|
|
(f24-0 (cos f22-0))
|
|
(f1-3 (sin f22-0))
|
|
(f0-4 (- (* f28-0 f24-0) (* f26-0 f1-3)))
|
|
(f1-5 (+ (* f26-0 f24-0) (* f28-0 f1-3)))
|
|
(f2-3 (/ 1.0 (-> s4-0 grid-size)))
|
|
(f28-1 (* f2-3 (- f0-4 (-> s4-0 x-base))))
|
|
(f26-1 (* f2-3 (- f1-5 (-> s4-0 z-base))))
|
|
)
|
|
(ripple-update-waveform-offs s5-0)
|
|
(let* ((f22-1 (the float (the int f28-1)))
|
|
(f24-1 (the float (the int f26-1)))
|
|
(f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1))
|
|
)
|
|
(set! sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1))
|
|
(set! sv-32 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1)))
|
|
(let* ((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1)))
|
|
(f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-16 f20-0))))
|
|
(f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32))))
|
|
(f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22))))
|
|
(f0-23 (-> gp-0 faded-scale))
|
|
)
|
|
(if (< f0-23 0.0)
|
|
(set! f0-23 (-> gp-0 global-scale))
|
|
)
|
|
(+ f30-0 (* 0.0078125 f1-12 f0-23))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|