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

d/jak2: finish the majority of sparticle and sparticle-launcher #1840

Merged
merged 7 commits into from
Sep 5, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
d/jak2: make bits unique in sp-cpuinfo-flag
  • Loading branch information
xTVaser committed Sep 4, 2022
commit deb9eeee42f142782a84af98fdf1e7cc986b6cd6
22 changes: 11 additions & 11 deletions decompiler/config/jak2/all-types.gc
Original file line number Diff line number Diff line change
Expand Up @@ -18449,28 +18449,28 @@
(defenum sp-cpuinfo-flag
:bitfield #t
:type uint32
(bit0 0)
(bit1 1)
(bit2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst
(bit3 3)
(bit4 4)
(unk5 5)
(sp-cpuinfo-flag-0 0)
(sp-cpuinfo-flag-1 1)
(sp-cpuinfo-flag-2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst
(sp-cpuinfo-flag-3 3)
(sp-cpuinfo-flag-4 4)
(sp-cpuinfo-flag-5 5)
(ready-to-launch 6) ;; maybe just just death?
(distort 7) ;; distort sprite
(aux-list 8) ;; prevents relaunch, adds to aux
(bit9 9)
(sp-cpuinfo-flag-9 9)
(level0 10)
(level1 11)
(bit12 12) ;; required to relaunch
(bit13 13)
(bit14 14)
(sp-cpuinfo-flag-12 12) ;; required to relaunch
(sp-cpuinfo-flag-13 13)
(sp-cpuinfo-flag-14 14)
(glow 15) ;; glow sprite
(use-global-acc 16)
(launch-along-z 17)
(left-multiply-quat 18)
(right-multiply-quat 19)
(set-conerot 20)
(unk-21 21)
(sp-cpuinfo-flag-21 21)
)
;; ---sparticle-h:sp-cpuinfo-flag

Expand Down
22 changes: 11 additions & 11 deletions goal_src/jak2/engine/gfx/sprite/particles/sparticle-h.gc
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
(defenum sp-cpuinfo-flag
:bitfield #t
:type uint32
(bit0 0)
(bit1 1)
(bit2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst
(bit3 3)
(bit4 4)
(unk5 5)
(sp-cpuinfo-flag-0 0)
(sp-cpuinfo-flag-1 1)
(sp-cpuinfo-flag-2 2) ;; cleared after an aux has its func set to add-to-sprite-aux-lst
(sp-cpuinfo-flag-3 3)
(sp-cpuinfo-flag-4 4)
(sp-cpuinfo-flag-5 5)
(ready-to-launch 6) ;; maybe just just death?
(distort 7) ;; distort sprite
(aux-list 8) ;; prevents relaunch, adds to aux
(bit9 9)
(sp-cpuinfo-flag-9 9)
(level0 10)
(level1 11)
(bit12 12) ;; required to relaunch
(bit13 13)
(bit14 14)
(sp-cpuinfo-flag-12 12) ;; required to relaunch
(sp-cpuinfo-flag-13 13)
(sp-cpuinfo-flag-14 14)
(glow 15) ;; glow sprite
(use-global-acc 16)
(launch-along-z 17)
(left-multiply-quat 18)
(right-multiply-quat 19)
(set-conerot 20)
(unk-21 21)
(sp-cpuinfo-flag-21 21)
)
;; ---sp-cpuinfo-flag

Expand Down
10 changes: 5 additions & 5 deletions goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
(+! (-> arg0 launchrot y) (-> s0-0 y))
(+! (-> arg0 launchrot z) (-> s0-0 z))
)
(when (logtest? (sp-cpuinfo-flag unk-21) (-> arg1 flags))
(when (logtest? (sp-cpuinfo-flag sp-cpuinfo-flag-21) (-> arg1 flags))
(set! (-> arg0 launchrot w) (* (-> arg0 launchrot w) (vector-length (the-as vector (-> arg3 vector)))))
(set! (-> arg0 conerot w) (* (-> arg0 conerot w) (vector-length (-> arg3 vector 1))))
)
Expand Down Expand Up @@ -425,7 +425,7 @@
(.svf (&-> v1-27 r-g-b-a quad) vf3)
)
(.mov v1-28 vf3)
(logior! (-> gp-0 flags) (sp-cpuinfo-flag unk5))
(logior! (-> gp-0 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-5))
(set! (-> gp-0 cache-alpha) (-> s5-0 vector 2 w))
)
0
Expand Down Expand Up @@ -461,11 +461,11 @@

(defun sp-relaunch-setup-fields ((arg0 object) (arg1 sparticle-launcher) (arg2 sparticle-cpuinfo) (arg3 sprite-vec-data-3d))
(let ((a1-1 (-> arg1 init-specs 0))
(s4-0 (logand (-> arg2 flags) (sp-cpuinfo-flag bit9 level0 level1)))
(s4-0 (logand (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)))
)
(set! (-> arg2 next-launcher) (the-as basic 0))
(cond
((and (logtest? (-> arg2 flags) (sp-cpuinfo-flag bit12))
((and (logtest? (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-12))
(zero? (logand (-> arg2 flags) (sp-cpuinfo-flag distort)))
(zero? (logand (-> arg2 flags) (sp-cpuinfo-flag glow)))
)
Expand Down Expand Up @@ -561,7 +561,7 @@
(when (logtest? (-> arg2 flags) (sp-cpuinfo-flag distort))
(set! (-> arg3 r-g-b-a w) 0.0)
(set! (-> arg2 fade w) 0.0)
(logclear! (-> arg2 flags) (sp-cpuinfo-flag bit2))
(logclear! (-> arg2 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-2))
)
(when (logtest? (-> arg2 flags) (sp-cpuinfo-flag glow))
)
Expand Down
18 changes: 12 additions & 6 deletions goal_src/jak2/engine/gfx/sprite/particles/sparticle.gc
Original file line number Diff line number Diff line change
Expand Up @@ -380,47 +380,53 @@
)

(defun sparticle-kill-it-level0 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(if (zero? (logand (-> arg1 flags) (sp-cpuinfo-flag bit9 level0 level1)))
(if (zero? (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)))
(sparticle-kill-it arg0 arg1)
)
0
(none)
)

(defun sparticle-kill-it-level1 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag bit9 level0 level1)) (sp-cpuinfo-flag bit9))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1))
(sp-cpuinfo-flag sp-cpuinfo-flag-9)
)
(sparticle-kill-it arg0 arg1)
)
0
(none)
)

(defun sparticle-kill-it-level2 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag bit9 level0 level1)) (sp-cpuinfo-flag level0))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) (sp-cpuinfo-flag level0))
(sparticle-kill-it arg0 arg1)
)
0
(none)
)

(defun sparticle-kill-it-level3 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag bit9 level0 level1)) (sp-cpuinfo-flag bit9 level0))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1))
(sp-cpuinfo-flag sp-cpuinfo-flag-9 level0)
)
(sparticle-kill-it arg0 arg1)
)
0
(none)
)

(defun sparticle-kill-it-level4 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag bit9 level0 level1)) (sp-cpuinfo-flag level1))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1)) (sp-cpuinfo-flag level1))
(sparticle-kill-it arg0 arg1)
)
0
(none)
)

(defun sparticle-kill-it-level5 ((arg0 sparticle-system) (arg1 sparticle-cpuinfo))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag bit9 level0 level1)) (sp-cpuinfo-flag bit9 level1))
(if (= (logand (-> arg1 flags) (sp-cpuinfo-flag sp-cpuinfo-flag-9 level0 level1))
(sp-cpuinfo-flag sp-cpuinfo-flag-9 level1)
)
(sparticle-kill-it arg0 arg1)
)
0
Expand Down
8 changes: 3 additions & 5 deletions test/decompiler/reference/jak2/engine/anim/joint_REF.gc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions test/decompiler/reference/jak2/engine/load/loader_REF.gc

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.