Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrap sprite rgba to 0-255 #3549

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions decompiler/config/jak1/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion game/graphics/opengl_renderer/sprite/Sprite3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
96 changes: 48 additions & 48 deletions goal_src/jak1/engine/ui/hud-classes.gc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -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)
Expand Down Expand Up @@ -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)
)
Expand Down Expand Up @@ -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))))))
)
)
)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
Loading
Loading