wrap sprite rgba to 0-255 (#3549)

This commit is contained in:
ManDude
2024-06-04 08:57:52 +02:00
committed by GitHub
parent a18d9dd4d0
commit 37762c5fb7
4 changed files with 112 additions and 106 deletions
+10 -10
View File
@@ -22303,20 +22303,20 @@
;; - Functions
(define-extern calculate-rotation-and-color-for-slice (function int float int int int hud-particle none))
(define-extern part-hud-health-01-func (function basic basic hud-particle none)) ;; TODO - i figured this out on another branch...all these particle functions get called by the particle system with the same beginning types iirc
(define-extern part-hud-health-02-func (function basic basic hud-particle none))
(define-extern part-hud-health-03-func (function basic basic hud-particle none))
(define-extern calculate-rotation-and-color-for-slice (function int float int int int matrix none))
(define-extern part-hud-health-01-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-health-02-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-health-03-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern fuel-cell-hud-orbit-callback (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern fuel-cell-hud-starburst-3-callback (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern fuel-cell-hud-starburst-4-callback (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern fuel-cell-hud-center-callback (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-buzzer-func (function basic basic hud-particle none))
(define-extern part-hud-eco-timer-01-func (function basic basic hud-particle none))
(define-extern part-hud-eco-timer-02-func (function basic basic hud-particle none))
(define-extern part-hud-eco-timer-03-func (function basic basic hud-particle none))
(define-extern part-hud-eco-timer-backing-func (function basic basic hud-particle none))
(define-extern part-hud-eco-timer-func (function basic basic hud-particle none))
(define-extern part-hud-buzzer-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-eco-timer-01-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-eco-timer-02-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-eco-timer-03-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-eco-timer-backing-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern part-hud-eco-timer-func (function sparticle-system sparticle-cpuinfo matrix none))
(define-extern show-hud (function none))
;; - Unknowns
@@ -846,7 +846,13 @@ void Sprite3::do_block_common(SpriteMode mode,
vert1.xyz_sx = m_vec_data_2d[sprite_idx].xyz_sx;
vert1.quat_sy = m_vec_data_2d[sprite_idx].flag_rot_sy;
vert1.rgba = m_vec_data_2d[sprite_idx].rgba / 255;
// ftoi'd in the original game, and I believe the VIF would discard the upper bits on pack
vert1.rgba = m_vec_data_2d[sprite_idx].rgba;
vert1.rgba.x() = (int)vert1.rgba.x() & 0xff;
vert1.rgba.y() = (int)vert1.rgba.y() & 0xff;
vert1.rgba.z() = (int)vert1.rgba.z() & 0xff;
vert1.rgba.w() = (int)vert1.rgba.w() & 0xff;
vert1.rgba /= 255;
vert1.flags_matrix[0] = m_vec_data_2d[sprite_idx].flag();
vert1.flags_matrix[1] = m_vec_data_2d[sprite_idx].matrix();
vert1.info[0] = 0; // hack
+48 -48
View File
@@ -279,14 +279,14 @@
)
(defun part-hud-health-01-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-health-01-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* health 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(cond
((and *target* (< (-> *target* fact health) 1.0))
(set! (-> arg2 prev-pos x) 32.0)
(set! (-> arg2 vector 2 w) 32.0)
)
(else
(let ((f0-3 128.0))
@@ -295,45 +295,45 @@
(when (and *target* (= (-> *target* fact health) 1.0))
(let* ((scaled-frame-counter (the int (* DISPLAY_FPS_RATIO (-> *display* integral-frame-counter))))
(v1-16 (logand scaled-frame-counter 7)))
(set! f0-3 (if (zero? (logand scaled-frame-counter 8))
(set! f0-3 (if (not (logtest? scaled-frame-counter 8))
(+ 128.0 (* 18.142857 (the float v1-16)))
(- 255.0 (* 18.142857 (the float v1-16)))
)
)
)
)
(set! (-> arg2 pos y) f0-3)
(set! (-> arg2 pos z) f0-3)
(set! (-> arg2 pos w) f0-3)
(set! (-> arg2 vector 2 x) f0-3)
(set! (-> arg2 vector 2 y) f0-3)
(set! (-> arg2 vector 2 z) f0-3)
)
(set! (-> arg2 prev-pos x) 128.0)
(set! (-> arg2 vector 2 w) 128.0)
)
)
0
(none)
)
(defun part-hud-health-02-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-health-02-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* health 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(if (and *target* (< (-> *target* fact health) 2.0))
(set! (-> arg2 prev-pos x) 32.0)
(set! (-> arg2 prev-pos x) 128.0)
(set! (-> arg2 vector 2 w) 32.0)
(set! (-> arg2 vector 2 w) 128.0)
)
0
(none)
)
(defun part-hud-health-03-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-health-03-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* health 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(if (and *target* (< (-> *target* fact health) 3.0))
(set! (-> arg2 prev-pos x) 32.0)
(set! (-> arg2 prev-pos x) 128.0)
(set! (-> arg2 vector 2 w) 32.0)
(set! (-> arg2 vector 2 w) 128.0)
)
0
(none)
@@ -1394,10 +1394,10 @@
)
(defun part-hud-buzzer-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-buzzer-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* buzzers 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(none)
)
@@ -1648,30 +1648,30 @@
)
(defun calculate-rotation-and-color-for-slice ((arg0 int) (arg1 float) (arg2 int) (arg3 int) (arg4 int) (arg5 hud-particle))
(defun calculate-rotation-and-color-for-slice ((arg0 int) (arg1 float) (arg2 int) (arg3 int) (arg4 int) (arg5 matrix))
(cond
((>= 0.0 arg1)
(set! (-> arg5 init-pos w) -16566.045)
(set! (-> arg5 vector 1 z) -16566.045)
)
(else
(let ((v1-1 arg0))
(cond
((zero? v1-1)
(if (< 1.0 arg1)
(set! (-> arg5 init-pos w) 910.2222)
(set! (-> arg5 init-pos w) (* 182.04445 (+ 5.0 (* 263.0 (- 1.0 arg1)))))
(set! (-> arg5 vector 1 z) 910.2222)
(set! (-> arg5 vector 1 z) (* 182.04445 (+ 5.0 (* 263.0 (- 1.0 arg1)))))
)
)
((= v1-1 1)
(if (< 0.6666667 arg1)
(set! (-> arg5 init-pos w) 17294.223)
(set! (-> arg5 init-pos w) (* 182.04445 (+ 95.0 (* 173.0 (- 1.0 (* 1.5 arg1))))))
(set! (-> arg5 vector 1 z) 17294.223)
(set! (-> arg5 vector 1 z) (* 182.04445 (+ 95.0 (* 173.0 (- 1.0 (* 1.5 arg1))))))
)
)
((= v1-1 2)
(if (< 0.33333334 arg1)
(set! (-> arg5 init-pos w) 33678.223)
(set! (-> arg5 init-pos w) (* 182.04445 (+ 185.0 (* 83.0 (- 1.0 (* 3.0 arg1))))))
(set! (-> arg5 vector 1 z) 33678.223)
(set! (-> arg5 vector 1 z) (* 182.04445 (+ 185.0 (* 83.0 (- 1.0 (* 3.0 arg1))))))
)
)
)
@@ -1683,14 +1683,14 @@
(if (and (< 0.0 arg1) (and (< arg1 0.2) (zero? (logand (the int (* DISPLAY_FPS_RATIO (-> *display* integral-frame-counter))) 4))))
(set! arg3 (* arg3 2))
)
(set! (-> arg5 pos y) (the float arg2))
(set! (-> arg5 pos z) (the float arg3))
(set! (-> arg5 pos w) (the float arg4))
(set! (-> arg5 vector 2 x) (the float arg2))
(set! (-> arg5 vector 2 y) (the float arg3))
(set! (-> arg5 vector 2 z) (the float arg4))
0
(none)
)
(defun part-hud-eco-timer-01-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-01-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-2
(/ (the float
(the-as uint (- (-> *target* fact eco-timeout)
@@ -1725,14 +1725,14 @@
(calculate-rotation-and-color-for-slice 0 f0-2 a2-1 a3-0 t0-0 arg2)
)
(let ((f0-3 (-> *hud-parts* power 0 scale-blue)))
(set! (-> arg2 init-pos x) f0-3)
(set! (-> arg2 pos x) f0-3)
(set! (-> arg2 vector 0 w) f0-3)
(set! (-> arg2 vector 1 w) f0-3)
)
0
(none)
)
(defun part-hud-eco-timer-02-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-02-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-2
(/ (the float
(the-as uint (- (-> *target* fact eco-timeout)
@@ -1767,14 +1767,14 @@
(calculate-rotation-and-color-for-slice 1 f0-2 a2-1 a3-0 t0-0 arg2)
)
(let ((f0-3 (-> *hud-parts* power 0 scale-blue)))
(set! (-> arg2 init-pos x) f0-3)
(set! (-> arg2 pos x) f0-3)
(set! (-> arg2 vector 0 w) f0-3)
(set! (-> arg2 vector 1 w) f0-3)
)
0
(none)
)
(defun part-hud-eco-timer-03-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-03-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-2
(/ (the float
(the-as uint (- (-> *target* fact eco-timeout)
@@ -1809,26 +1809,26 @@
(calculate-rotation-and-color-for-slice 2 f0-2 a2-1 a3-0 t0-0 arg2)
)
(let ((f0-3 (-> *hud-parts* power 0 scale-blue)))
(set! (-> arg2 init-pos x) f0-3)
(set! (-> arg2 pos x) f0-3)
(set! (-> arg2 vector 0 w) f0-3)
(set! (-> arg2 vector 1 w) f0-3)
)
0
(none)
)
(defun part-hud-eco-timer-backing-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-backing-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* power 0 scale-backing)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
0
(none)
)
(defun part-hud-eco-timer-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* power 0 scale-timer)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
0
(none)
+47 -47
View File
@@ -307,14 +307,14 @@
;; definition for function part-hud-health-01-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-health-01-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-health-01-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* health 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(cond
((and *target* (< (-> *target* fact health) 1.0))
(set! (-> arg2 prev-pos x) 32.0)
(set! (-> arg2 vector 2 w) 32.0)
)
(else
(let ((f0-3 128.0))
@@ -327,11 +327,11 @@
)
)
)
(set! (-> arg2 pos y) f0-3)
(set! (-> arg2 pos z) f0-3)
(set! (-> arg2 pos w) f0-3)
(set! (-> arg2 vector 2 x) f0-3)
(set! (-> arg2 vector 2 y) f0-3)
(set! (-> arg2 vector 2 z) f0-3)
)
(set! (-> arg2 prev-pos x) 128.0)
(set! (-> arg2 vector 2 w) 128.0)
)
)
0
@@ -340,14 +340,14 @@
;; definition for function part-hud-health-02-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-health-02-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-health-02-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* health 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(if (and *target* (< (-> *target* fact health) 2.0))
(set! (-> arg2 prev-pos x) 32.0)
(set! (-> arg2 prev-pos x) 128.0)
(set! (-> arg2 vector 2 w) 32.0)
(set! (-> arg2 vector 2 w) 128.0)
)
0
(none)
@@ -355,14 +355,14 @@
;; definition for function part-hud-health-03-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-health-03-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-health-03-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* health 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(if (and *target* (< (-> *target* fact health) 3.0))
(set! (-> arg2 prev-pos x) 32.0)
(set! (-> arg2 prev-pos x) 128.0)
(set! (-> arg2 vector 2 w) 32.0)
(set! (-> arg2 vector 2 w) 128.0)
)
0
(none)
@@ -1481,10 +1481,10 @@
;; definition for function part-hud-buzzer-func
;; INFO: Return type mismatch float vs none.
(defun part-hud-buzzer-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-buzzer-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* buzzers 0 scale)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
(none)
)
@@ -1747,30 +1747,30 @@
;; definition for function calculate-rotation-and-color-for-slice
;; INFO: Return type mismatch int vs none.
(defun calculate-rotation-and-color-for-slice ((arg0 int) (arg1 float) (arg2 int) (arg3 int) (arg4 int) (arg5 hud-particle))
(defun calculate-rotation-and-color-for-slice ((arg0 int) (arg1 float) (arg2 int) (arg3 int) (arg4 int) (arg5 matrix))
(cond
((>= 0.0 arg1)
(set! (-> arg5 init-pos w) -16566.045)
(set! (-> arg5 vector 1 z) -16566.045)
)
(else
(let ((v1-1 arg0))
(cond
((zero? v1-1)
(if (< 1.0 arg1)
(set! (-> arg5 init-pos w) 910.2222)
(set! (-> arg5 init-pos w) (* 182.04445 (+ 5.0 (* 263.0 (- 1.0 arg1)))))
(set! (-> arg5 vector 1 z) 910.2222)
(set! (-> arg5 vector 1 z) (* 182.04445 (+ 5.0 (* 263.0 (- 1.0 arg1)))))
)
)
((= v1-1 1)
(if (< 0.6666667 arg1)
(set! (-> arg5 init-pos w) 17294.223)
(set! (-> arg5 init-pos w) (* 182.04445 (+ 95.0 (* 173.0 (- 1.0 (* 1.5 arg1))))))
(set! (-> arg5 vector 1 z) 17294.223)
(set! (-> arg5 vector 1 z) (* 182.04445 (+ 95.0 (* 173.0 (- 1.0 (* 1.5 arg1))))))
)
)
((= v1-1 2)
(if (< 0.33333334 arg1)
(set! (-> arg5 init-pos w) 33678.223)
(set! (-> arg5 init-pos w) (* 182.04445 (+ 185.0 (* 83.0 (- 1.0 (* 3.0 arg1))))))
(set! (-> arg5 vector 1 z) 33678.223)
(set! (-> arg5 vector 1 z) (* 182.04445 (+ 185.0 (* 83.0 (- 1.0 (* 3.0 arg1))))))
)
)
)
@@ -1780,16 +1780,16 @@
(if (and (< 0.0 arg1) (and (< arg1 0.2) (not (logtest? (-> *display* integral-frame-counter) 4))))
(set! arg3 (* arg3 2))
)
(set! (-> arg5 pos y) (the float arg2))
(set! (-> arg5 pos z) (the float arg3))
(set! (-> arg5 pos w) (the float arg4))
(set! (-> arg5 vector 2 x) (the float arg2))
(set! (-> arg5 vector 2 y) (the float arg3))
(set! (-> arg5 vector 2 z) (the float arg4))
0
(none)
)
;; definition for function part-hud-eco-timer-01-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-eco-timer-01-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-01-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-2
(/ (the float
(the-as uint (- (-> *target* fact eco-timeout)
@@ -1824,8 +1824,8 @@
(calculate-rotation-and-color-for-slice 0 f0-2 a2-1 a3-0 t0-0 arg2)
)
(let ((f0-3 (-> *hud-parts* power 0 scale-blue)))
(set! (-> arg2 init-pos x) f0-3)
(set! (-> arg2 pos x) f0-3)
(set! (-> arg2 vector 0 w) f0-3)
(set! (-> arg2 vector 1 w) f0-3)
)
0
(none)
@@ -1833,7 +1833,7 @@
;; definition for function part-hud-eco-timer-02-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-eco-timer-02-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-02-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-2
(/ (the float
(the-as uint (- (-> *target* fact eco-timeout)
@@ -1868,8 +1868,8 @@
(calculate-rotation-and-color-for-slice 1 f0-2 a2-1 a3-0 t0-0 arg2)
)
(let ((f0-3 (-> *hud-parts* power 0 scale-blue)))
(set! (-> arg2 init-pos x) f0-3)
(set! (-> arg2 pos x) f0-3)
(set! (-> arg2 vector 0 w) f0-3)
(set! (-> arg2 vector 1 w) f0-3)
)
0
(none)
@@ -1877,7 +1877,7 @@
;; definition for function part-hud-eco-timer-03-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-eco-timer-03-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-03-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-2
(/ (the float
(the-as uint (- (-> *target* fact eco-timeout)
@@ -1912,8 +1912,8 @@
(calculate-rotation-and-color-for-slice 2 f0-2 a2-1 a3-0 t0-0 arg2)
)
(let ((f0-3 (-> *hud-parts* power 0 scale-blue)))
(set! (-> arg2 init-pos x) f0-3)
(set! (-> arg2 pos x) f0-3)
(set! (-> arg2 vector 0 w) f0-3)
(set! (-> arg2 vector 1 w) f0-3)
)
0
(none)
@@ -1921,10 +1921,10 @@
;; definition for function part-hud-eco-timer-backing-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-eco-timer-backing-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-backing-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* power 0 scale-backing)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
0
(none)
@@ -1932,10 +1932,10 @@
;; definition for function part-hud-eco-timer-func
;; INFO: Return type mismatch int vs none.
(defun part-hud-eco-timer-func ((arg0 basic) (arg1 basic) (arg2 hud-particle))
(defun part-hud-eco-timer-func ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix))
(let ((f0-0 (-> *hud-parts* power 0 scale-timer)))
(set! (-> arg2 init-pos x) f0-0)
(set! (-> arg2 pos x) f0-0)
(set! (-> arg2 vector 0 w) f0-0)
(set! (-> arg2 vector 1 w) f0-0)
)
0
(none)