(init-vf0-vector) to make vector code a bit more readable (#494)

* decomp: Use a macro for loading VF0 (maybe should be in goal-lib.gc?)

* update references

* lint: format

* delete now unused file
This commit is contained in:
Tyler Wilding
2021-05-16 13:49:24 -04:00
committed by GitHub
parent bf6e9fc9e9
commit b75a64fc29
23 changed files with 129 additions and 123 deletions
@@ -588,3 +588,8 @@
(define-extern vector-rad<-vector-deg/2! (function vector vector int))
(define-extern sprite-distorter-generate-tables (function none))
(defmacro init-vf0-vector ()
"Initializes the VF0 vector which is a constant vector in the VU set to <0,0,0,1>"
`(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
)
@@ -319,7 +319,7 @@
;; definition for method 0 of type math-camera
(defmethod new math-camera ((allocation symbol) (type-to-make type))
(rlet ((vf0 :class vf))
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let
((gp-0
(object-new allocation type-to-make (the-as int (-> type-to-make size)))
@@ -371,7 +371,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((local-trans (new 'stack-no-clear 'vector)))
(set! (-> local-trans quad) (the-as uint128 0))
(set! (-> local-trans x) (cond
@@ -504,7 +504,7 @@
(vf30 :class vf)
(vf31 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((v1-0 0))
)
(.lvf vf24 (&-> *math-camera* camera-temp vector 0 quad))
@@ -552,7 +552,7 @@
(vf30 :class vf)
(vf31 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((v1-0 0))
)
(.lvf vf24 (&-> *math-camera* camera-temp vector 0 quad))
@@ -600,7 +600,7 @@
(vf30 :class vf)
(vf31 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((v1-0 0))
)
(.lvf vf24 (&-> *math-camera* camera-temp vector 0 quad))
@@ -37,7 +37,7 @@
(vf4 :class vf)
(vf5 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf3 arg1)
(.lvf vf4 arg0)
(.add.vf vf5 vf4 vf3)
@@ -100,7 +100,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf4 arg1)
(.lvf vf5 arg0)
(.mov vf1 arg2)
@@ -124,7 +124,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.sub.w.vf vf2 vf1 vf1 :mask #b111)
(.add.w.vf vf3 vf1 vf1 :mask #b111)
@@ -11,7 +11,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let*
((f0-1 (+ (-> arg0 wind-normal w) (rand-vu-float-range -1024.0 1024.0)))
(f30-1 (- f0-1 (* (the float (the int (/ f0-1 65536.0))) 65536.0)))
@@ -139,7 +139,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(TODO.VRGET vf1)
(.sqrt.vf Q vf1 :ftf #b0)
(.add.vf vf2 vf0 Q :mask #b1)
@@ -158,7 +158,7 @@
(rlet ((vf0 :class vf)
(vf1 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(TODO.VRGET vf1)
(.sub.w.vf vf1 vf1 vf0)
(.mov v0-0 vf1)
@@ -320,7 +320,7 @@
(vf4 :class vf)
(vf8 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(matrix-transpose! dst src)
(.lvf vf1 (&-> dst vector 0 quad))
(.lvf vf2 (&-> dst vector 1 quad))
@@ -380,7 +380,7 @@
(vf8 :class vf)
(vf9 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(nop!)
(nop!)
(.lvf vf23 (&-> src vector 0 quad))
@@ -1101,7 +1101,7 @@
(vf14 :class vf)
(vf15 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf10 (&-> src vector 0 quad))
(.lvf vf11 (&-> src vector 1 quad))
(.lvf vf12 (&-> src vector 2 quad))
@@ -226,7 +226,7 @@
(vf0 :class vf)
(vf1 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 vec quad))
(.mul.vf vf1 vf1 vf1)
(.add.z.vf acc vf1 vf1 :mask #b1000)
@@ -245,7 +245,7 @@
(vf0 :class vf)
(vf1 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 vec quad))
(.mul.vf vf1 vf1 vf1)
(.add.z.vf acc vf1 vf1 :mask #b1000)
@@ -265,7 +265,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 vec quad))
(.mul.vf vf2 vf1 vf1)
(.add.z.vf acc vf2 vf2 :mask #b1000)
@@ -291,7 +291,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 vec quad))
(.mul.vf vf2 vf1 vf1)
(.sub.vf vf3 vf3 vf3)
@@ -318,7 +318,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 vec quad))
(.lvf vf2 (&-> arg1 vec quad))
(.mul.vf vf1 vf1 vf2)
@@ -340,7 +340,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 vec quad))
(.lvf vf2 (&-> arg2 vec quad))
(.sub.vf vf4 vf0 vf0 :mask #b1000)
@@ -423,7 +423,7 @@
(vf4 :class vf)
(vf5 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 vec quad))
(.add.vf vf5 vf1 vf1)
(.add.w.vf vf2 vf0 vf1 :mask #b1)
@@ -866,7 +866,7 @@
(vf6 :class vf)
(vf7 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((s4-0 (new 'stack-no-clear 'vector))
(gp-0 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'vector))
@@ -105,7 +105,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((t9-0 vector-y-angle)
(v1-0 (new 'stack-no-clear 'vector))
)
@@ -128,7 +128,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((gp-0 deg-diff)
(s3-0 (y-angle obj))
(t9-1 vector-y-angle)
@@ -322,7 +322,7 @@
(vf6 :class vf)
(vf9 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 quad))
(.sub.vf vf2 vf2 vf2)
(.lvf vf9 (&-> *cos-poly-vec* quad))
@@ -360,7 +360,7 @@
(vf8 :class vf)
(vf9 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg2 quad))
(.sub.vf vf14 vf14 vf14)
(.lvf vf11 (&-> *sin-poly-vec2* quad))
@@ -890,7 +890,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.lvf vf2 (&-> arg1 quad))
(.mul.vf vf1 vf1 vf2)
@@ -911,7 +911,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.mov.vf vf6 vf0 :mask #b1000)
(.lvf vf4 (&-> arg1 quad))
(.lvf vf5 (&-> arg2 quad))
@@ -928,7 +928,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf4 (&-> arg1 quad))
(.lvf vf5 (&-> arg2 quad))
(.mov.vf vf6 vf0 :mask #b1000)
@@ -948,7 +948,7 @@
;; definition for function vector-reset!
(defun vector-reset! ((arg0 vector))
(rlet ((vf0 :class vf))
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.svf (&-> arg0 quad) vf0)
arg0
)
@@ -23,7 +23,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.mov vf6 arg2)
(.lvf vf4 (&-> arg1 quad))
(.add.x.vf vf5 vf0 vf0 :mask #b1000)
@@ -40,7 +40,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf4 (&-> arg1 quad))
(.lvf vf5 (&-> arg2 quad))
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
@@ -59,7 +59,7 @@
(vf6 :class vf)
(vf7 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.mov vf7 arg3)
(.lvf vf5 (&-> arg2 quad))
(.lvf vf4 (&-> arg1 quad))
@@ -80,7 +80,7 @@
(vf6 :class vf)
(vf7 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.mov vf7 arg3)
(.lvf vf5 (&-> arg2 quad))
(.lvf vf4 (&-> arg1 quad))
@@ -101,7 +101,7 @@
(vf6 :class vf)
(vf7 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf5 (&-> arg2 quad))
(.div.vf Q vf0 vf5 :fsf #b11 :ftf #b1)
(.add.x.vf vf6 vf0 vf0 :mask #b1000)
@@ -130,7 +130,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 quad))
(.mov vf2 arg2)
(.add.x.vf vf1 vf0 vf0 :mask #b1000)
@@ -149,7 +149,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((v1-0 #x3f000000))
(.lvf vf1 (&-> arg1 quad))
(.lvf vf2 (&-> arg2 quad))
@@ -172,7 +172,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf2 (&-> arg2 quad))
(.lvf vf1 (&-> arg1 quad))
(.mov vf3 arg3)
@@ -193,7 +193,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf2 (&-> arg2 quad))
(.lvf vf1 (&-> arg1 quad))
(.mov vf3 arg3)
@@ -213,7 +213,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.mov vf3 arg2)
(.div.vf Q vf0 vf3 :fsf #b11 :ftf #b0)
(.lvf vf1 (&-> arg1 quad))
@@ -233,7 +233,7 @@
(vf1 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 quad))
(.sub.vf vf4 vf0 vf1 :mask #b111)
(.add.x.vf vf4 vf0 vf0 :mask #b1000)
@@ -247,7 +247,7 @@
(rlet ((vf0 :class vf)
(vf1 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.sub.vf vf1 vf0 vf1 :mask #b111)
(.svf (&-> arg0 quad) vf1)
@@ -267,7 +267,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.lvf vf2 (&-> arg1 quad))
(.sub.vf vf1 vf2 vf1)
@@ -290,7 +290,7 @@
(vf4 :class vf)
(vf5 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.mov vf4 arg2)
(.lvf vf1 (&-> arg1 quad))
(.lvf vf2 (&-> arg0 quad))
@@ -462,7 +462,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((v1-0 arg0))
(let ((a1-0 arg0)
(f0-0 (-> *display* seconds-per-frame))
@@ -511,7 +511,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((v0-0 delta-p))
(let ((v1-0 velocity)
(f0-1 (* scale (-> *display* seconds-per-frame)))
@@ -547,7 +547,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 quad))
(let ((f0-0 (-> *display* frames-per-second)))
(.mov at-0 f0-0)
@@ -567,7 +567,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg1 quad))
(let ((f0-0 (-> *display* seconds-per-frame)))
(.mov at-0 f0-0)
@@ -588,7 +588,7 @@
(vf0 :class vf)
(vf1 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.mul.vf vf1 vf1 vf1)
(.mul.x.vf acc vf0 vf1 :mask #b1000)
@@ -613,7 +613,7 @@
(vf1 :class vf)
(vf2 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.add.w.vf vf2 vf0 vf0 :mask #b1)
(.mul.vf vf1 vf1 vf1)
@@ -645,7 +645,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf2 (&-> arg0 quad))
(.lvf vf3 (&-> arg1 quad))
(.sub.vf vf1 vf3 vf2)
@@ -692,7 +692,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf2 (&-> arg0 quad))
(.lvf vf3 (&-> arg1 quad))
(.sub.vf vf1 vf3 vf2)
@@ -736,7 +736,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.mul.vf vf2 vf1 vf1 :mask #b111)
(let ((v1-0 arg1))
@@ -766,7 +766,7 @@
(vf2 :class vf)
(vf3 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.mul.vf vf2 vf1 vf1 :mask #b111)
(let ((v1-0 arg1))
@@ -935,7 +935,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> a quad))
(.lvf vf2 (&-> b quad))
(.mov vf4 alpha)
@@ -957,7 +957,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(cond
((>= 0.0 alpha)
(set! (-> out quad) (-> a quad))
@@ -1192,7 +1192,7 @@
(vf3 :class vf)
(vf4 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(.lvf vf1 (&-> arg0 quad))
(.lvf vf2 (&-> arg1 quad))
(.sub.vf vf3 vf1 vf2 :mask #b111)
@@ -472,7 +472,7 @@
delayed-rand-vector
((obj delayed-rand-vector) (arg0 int) (arg1 int) (arg2 float) (arg3 float))
(rlet ((vf0 :class vf))
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(set! (-> obj min-time) arg0)
(set! (-> obj max-time) arg1)
(set! (-> obj xz-max) (* 0.5 arg2))
@@ -518,7 +518,7 @@
;; definition for method 12 of type delayed-rand-vector
(defmethod dummy-12 delayed-rand-vector ((obj delayed-rand-vector))
(rlet ((vf0 :class vf))
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(if
(>=
(the-as int (- (-> *display* base-frame-counter) (-> obj start-time)))
@@ -543,7 +543,7 @@
(arg3 float)
)
(rlet ((vf0 :class vf))
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(cond
(arg0
(let ((v1-0 (-> obj value)))
@@ -575,7 +575,7 @@
(vf5 :class vf)
(vf6 :class vf)
)
(.lvf vf0 (new 'static 'vector :x 0.0 :y 0.0 :z 0.0 :w 1.0))
(init-vf0-vector)
(let ((s5-0 (new 'stack-no-clear 'vector)))
(cond
(arg0