jak-project/goal_src/jak3/engine/gfx/sprite/particles/sparticle-h.gc

141 lines
4.9 KiB
Common Lisp
Raw Normal View History

2023-10-10 09:41:05 -04:00
;;-*-Lisp-*-
(in-package goal)
;; name: sparticle-h.gc
;; name in dgo: sparticle-h
;; dgos: GAME
(declare-type sprite-vec-data-2d structure)
(define-extern sp-get-particle (function sparticle-system int sparticle-launch-state sparticle-cpuinfo))
(define-extern kill-all-particles-with-key (function sparticle-launch-control none))
decomp3: more engine stuff, detect non-virtual state inheritance (#3377) - `speech` - `ambient` - `water-h` - `vol-h` - `generic-obs` - `carry-h` - `pilot-h` - `board-h` - `gun-h` - `flut-h` - `indax-h` - `lightjak-h` - `darkjak-h` - `target-util` - `history` - `collide-reaction-target` - `logic-target` - `sidekick` - `projectile` - `voicebox` - `ragdoll-edit` - most of `ragdoll` (not added to gsrc yet) - `curves` - `find-nearest` - `lightjak-wings` - `target-handler` - `target-anim` - `target` - `target2` - `target-swim` - `target-lightjak` - `target-invisible` - `target-death` - `target-gun` - `gun-util` - `board-util` - `target-board` - `board-states` - `mech-h` - `vol` - `vent` - `viewer` - `gem-pool` - `collectables` - `crates` - `secrets-menu` Additionally: - Detection of non-virtual state inheritance - Added a config file that allows overriding the process stack size set by `stack-size-set!` calls - Fix for integer multiplication with `r0` - Fixed detection for the following macros: - `static-attack-info` - `defpart` and `defpartgroup` (probably still needs adjustments, uses Jak 2 implementation at the moment) - `sound-play` (Jak 3 seems to always call `sound-play-by-name` with a `sound-group` of 0, so the macro has been temporarily defaulted to use that) One somewhat significant change made here that should be noted is that the return type of `process::init-from-entity!` was changed to `object`. I've been thinking about this for a while, since it looks a bit nicer without the `(none)` at the end and I have recently encountered init methods that early return `0`.
2024-03-03 15:15:27 -05:00
;; +++sp-cpuinfo-flag
(defenum sp-cpuinfo-flag
:bitfield #t
:type uint32
decomp3: more engine stuff, detect non-virtual state inheritance (#3377) - `speech` - `ambient` - `water-h` - `vol-h` - `generic-obs` - `carry-h` - `pilot-h` - `board-h` - `gun-h` - `flut-h` - `indax-h` - `lightjak-h` - `darkjak-h` - `target-util` - `history` - `collide-reaction-target` - `logic-target` - `sidekick` - `projectile` - `voicebox` - `ragdoll-edit` - most of `ragdoll` (not added to gsrc yet) - `curves` - `find-nearest` - `lightjak-wings` - `target-handler` - `target-anim` - `target` - `target2` - `target-swim` - `target-lightjak` - `target-invisible` - `target-death` - `target-gun` - `gun-util` - `board-util` - `target-board` - `board-states` - `mech-h` - `vol` - `vent` - `viewer` - `gem-pool` - `collectables` - `crates` - `secrets-menu` Additionally: - Detection of non-virtual state inheritance - Added a config file that allows overriding the process stack size set by `stack-size-set!` calls - Fix for integer multiplication with `r0` - Fixed detection for the following macros: - `static-attack-info` - `defpart` and `defpartgroup` (probably still needs adjustments, uses Jak 2 implementation at the moment) - `sound-play` (Jak 3 seems to always call `sound-play-by-name` with a `sound-group` of 0, so the macro has been temporarily defaulted to use that) One somewhat significant change made here that should be noted is that the return type of `process::init-from-entity!` was changed to `object`. I've been thinking about this for a while, since it looks a bit nicer without the `(none)` at the end and I have recently encountered init methods that early return `0`.
2024-03-03 15:15:27 -05:00
;; todo copied from jak 2
(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
(sp-cpuinfo-flag-9 9)
(level0 10)
(level1 11)
(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)
(sp-cpuinfo-flag-21 21)
)
decomp3: more engine stuff, detect non-virtual state inheritance (#3377) - `speech` - `ambient` - `water-h` - `vol-h` - `generic-obs` - `carry-h` - `pilot-h` - `board-h` - `gun-h` - `flut-h` - `indax-h` - `lightjak-h` - `darkjak-h` - `target-util` - `history` - `collide-reaction-target` - `logic-target` - `sidekick` - `projectile` - `voicebox` - `ragdoll-edit` - most of `ragdoll` (not added to gsrc yet) - `curves` - `find-nearest` - `lightjak-wings` - `target-handler` - `target-anim` - `target` - `target2` - `target-swim` - `target-lightjak` - `target-invisible` - `target-death` - `target-gun` - `gun-util` - `board-util` - `target-board` - `board-states` - `mech-h` - `vol` - `vent` - `viewer` - `gem-pool` - `collectables` - `crates` - `secrets-menu` Additionally: - Detection of non-virtual state inheritance - Added a config file that allows overriding the process stack size set by `stack-size-set!` calls - Fix for integer multiplication with `r0` - Fixed detection for the following macros: - `static-attack-info` - `defpart` and `defpartgroup` (probably still needs adjustments, uses Jak 2 implementation at the moment) - `sound-play` (Jak 3 seems to always call `sound-play-by-name` with a `sound-group` of 0, so the macro has been temporarily defaulted to use that) One somewhat significant change made here that should be noted is that the return type of `process::init-from-entity!` was changed to `object`. I've been thinking about this for a while, since it looks a bit nicer without the `(none)` at the end and I have recently encountered init methods that early return `0`.
2024-03-03 15:15:27 -05:00
;; ---sp-cpuinfo-flag
(defmacro .movz (result value check original)
`(if (= ,check 0)
(set! ,result (the-as int ,value))
(set! ,result (the-as int ,original))
)
)
2024-03-23 13:03:01 -04:00
(define-extern kill-all-particles-in-level (function level int))
2024-03-24 12:27:04 -04:00
(define-extern remap-all-particles (function none))
(define-extern process-particles (function none))
2024-03-23 13:03:01 -04:00
2023-10-10 09:41:05 -04:00
;; DECOMP BEGINS
(define *sp-60-hz* #t)
(deftype sparticle-cpuinfo (structure)
"The per-particle information. This stays on the CPU, and isn't uploaded to the VU."
((sprite sprite-vec-data-2d)
(adgif adgif-shader)
(radius float)
(omega float)
(vel-sxvel vector :inline)
(rot-syvel vector :inline)
(fade rgbaf :inline)
(acc vector :inline)
(rotvel3d quaternion :inline)
(vel vector3s :inline :overlay-at (-> vel-sxvel data 0))
(accel vector3s :inline :overlay-at (-> acc data 0))
(scalevelx float :overlay-at (-> vel-sxvel data 3))
(scalevely float :overlay-at (-> rot-syvel data 3))
(friction float)
(timer int32)
(flags sp-cpuinfo-flag)
(flags-s32 int32 :overlay-at flags)
(user-int32 int32)
(user-uint32 uint32 :overlay-at user-int32)
(user-float float :overlay-at user-int32)
(user-pntr uint32 :overlay-at user-int32)
(user-object basic :overlay-at user-int32)
(user-sprite sprite-vec-data-2d :overlay-at user-int32)
(sp-func (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d uint none))
(next-time uint32)
(next-launcher basic)
(cache-alpha float)
(valid uint8)
(clock-index uint8)
(user1-int16 uint16)
(key sparticle-launch-control)
(binding sparticle-launch-state)
(data uint32 1 :overlay-at omega)
(datab int8 4 :overlay-at omega)
(dataf float 1 :overlay-at omega)
(datac uint8 1 :overlay-at omega)
)
)
(deftype sparticle-launchinfo (structure)
"Settings for launching a particle. These are a temporary thing consumed by the assembly particle code, and modified by particle callbacks."
((launchrot vector :inline)
(conerot vector :inline)
(rotate-x float)
(rotate-y float)
(rotate-z float)
(coneradius float)
(rotate vector :inline :overlay-at rotate-x)
(scale-x float)
(scale-y float)
(scale-z float)
(dummy float)
(scale vector :inline :overlay-at scale-x)
(data uint8 1 :overlay-at (-> launchrot data 0))
)
)
(deftype sparticle-system (basic)
"An entire particle 'system', which is a pipeline for spawning, updating, and generating sprite-renderer DMA data.
There are separate systems for different modes of sprite rendering: 2D/billboard, full 3D, and screen-space (HUD)"
((blocks int32 2)
(length int32 2)
(num-alloc int32 2)
(is-3d basic)
(flags uint32)
(alloc-table (pointer uint64))
(cpuinfo-table (inline-array sparticle-cpuinfo))
(vecdata-table pointer)
(adgifdata-table (inline-array adgif-shader))
)
(:methods
(new (symbol type int int symbol pointer (inline-array adgif-shader)) _type_)
)
)
(define-extern sp-kill-particle (function sparticle-system sparticle-cpuinfo symbol))
(define-extern *sp-particle-system-2d* sparticle-system)
(define-extern *sp-particle-system-3d* sparticle-system)