Files
jak-project/goal_src/jak3/levels/desert/hover/deshover-texture.gc
Hat Kid bdded9ad8c jak3: add missing texture animations (#3577)
This refactors some of the texture animation code a bit to better
support multiple games and adds most of the missing texture animations
for Jak 3 with a couple of exceptions/bugs:

- `hanga-sprite`: Despite `move_to_pool` being set for this anim, it's
not showing up in-game, but it does display properly in the ImGUI debug
window.

![image](https://github.com/open-goal/jak-project/assets/6624576/29df8e17-8831-412b-b9b7-7704d6bd7813)
- `factoryc-alpha`: Some conveyors do not have the animation for some
reason.

![image](https://github.com/open-goal/jak-project/assets/6624576/209ef073-2a81-4e2c-b020-dc2ae0b01196)
- This spot in Spargus seems to use texture animations, but it looks
like it maps to the `fora-water-dest` texture/slot, which comes from
`foresta-water`. Because the texture is not initialized, the texture
shows up black on first load, but it does show up after loading
`foresta`.

![image](https://github.com/open-goal/jak-project/assets/6624576/1e54bab2-f97c-47d5-a92a-a98a52c30178)

![image](https://github.com/open-goal/jak-project/assets/6624576/240b0137-1e9e-4e65-8446-0f78df9802dd)
- `hfrag` texture anim is not handled yet. Probably needs some special
casing.
2024-07-15 02:25:18 +02:00

213 lines
10 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: deshover-texture.gc
;; name in dgo: deshover-texture
;; dgos: DESHOVER
;; DECOMP BEGINS
(define *deshover-texture-anim-array*
(the-as (texture-anim-array texture-anim)
(new 'static 'texture-anim-array :type texture-anim
(new 'static 'texture-anim
:num-layers #x5
:func-id 'deshover-texture-anim-func
:init-func #f
:tex #f
:tex-name "holograph-env-rim-dest"
:color (new 'static 'rgba :a #x80)
:frame-delta 300.0
:frame-mod 1200.0
:test (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest always))
:alpha (new 'static 'gs-alpha :b #x1 :d #x1)
:clamp (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))
:data (new 'static 'array texture-anim-layer 6
(new 'static 'texture-anim-layer
:func-id 'default-texture-anim-layer-func
:init-func #f
:tex #f
:end-time 1200.0
:tex-name "holograph-env-noise"
:test (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))
:alpha (new 'static 'gs-alpha :b #x2 :d #x1)
:start-color (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:start-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-color (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-st-rot (degrees 21600)
)
(new 'static 'texture-anim-layer
:func-id 'default-texture-anim-layer-func
:init-func #f
:tex #f
:end-time 1200.0
:tex-name "holograph-env-scan"
:test (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))
:alpha (new 'static 'gs-alpha :b #x2 :d #x1)
:start-color (new 'static 'vector :x 0.25 :y 0.35 :z 0.5 :w 1.0)
:start-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-color (new 'static 'vector :x 0.25 :y 0.35 :z 0.5 :w 1.0)
:end-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
)
(new 'static 'texture-anim-layer
:func-id 'default-texture-anim-layer-func
:init-func #f
:tex #f
:end-time 1200.0
:tex-name "holograph-env-rim"
:test (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))
:alpha (new 'static 'gs-alpha :b #x2 :d #x1)
:start-color (new 'static 'vector :x 0.5 :y 0.5 :z 0.5 :w 1.0)
:start-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-color (new 'static 'vector :x 0.5 :y 0.5 :z 0.5 :w 1.0)
:end-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-st-rot (degrees 360)
)
(new 'static 'texture-anim-layer
:func-id 'default-texture-anim-layer-func
:init-func #f
:tex #f
:end-time 1200.0
:tex-name "holograph-env-rim"
:test (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))
:alpha (new 'static 'gs-alpha :b #x2 :d #x1)
:start-color (new 'static 'vector :x 0.5 :y 0.5 :z 0.5 :w 1.0)
:start-scale (new 'static 'vector2 :data (new 'static 'array float 2 -1.0 1.0))
:start-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-color (new 'static 'vector :x 0.5 :y 0.5 :z 0.5 :w 1.0)
:end-scale (new 'static 'vector2 :data (new 'static 'array float 2 -1.0 1.0))
:end-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-st-rot (degrees 360)
)
(new 'static 'texture-anim-layer
:func-id 'default-texture-anim-layer-func
:init-func #f
:tex #f
:end-time 1200.0
:tex-name "environment-phong-rim"
:test (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))
:alpha (new 'static 'gs-alpha :b #x2 :d #x1)
:start-color (new 'static 'vector :x 0.125 :y 0.175 :z 0.25 :w 1.0)
:start-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:start-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:start-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
:end-color (new 'static 'vector :x 0.125 :y 0.175 :z 0.25 :w 1.0)
:end-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-st-scale (new 'static 'vector2 :data (new 'static 'array float 2 1.0 1.0))
:end-st-offset (new 'static 'vector2 :data (new 'static 'array float 2 0.5 0.5))
:end-qs (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0)
)
)
)
)
)
)
(defun deshover-texture-anim-func ()
(let ((gp-0 *deshover-texture-anim-array*))
(when (not (paused?))
(let ((s5-0 (-> gp-0 array-data 0 data 0)))
(cond
((= (-> s5-0 extra x) 0.0)
(cond
((>= 0.0 (-> s5-0 extra y))
(set! (-> s5-0 extra y) (rand-vu-float-range 150.0 300.0))
(set! (-> s5-0 extra z) (-> s5-0 extra y))
(set! (-> s5-0 extra w) (rand-vu-float-range 0.1 0.5))
(set! (-> s5-0 extra x) 1.0)
)
(else
(set! (-> s5-0 extra y) (- (-> s5-0 extra y) (* 300.0 (seconds-per-frame))))
)
)
)
((= (-> s5-0 extra x) 1.0)
(cond
((>= 0.0 (-> s5-0 extra y))
(set! (-> s5-0 extra y) (rand-vu-float-range 300.0 600.0))
(set! (-> s5-0 extra x) 0.0)
)
(else
(let ((f0-16 (+ 0.1 (* (-> s5-0 extra w) (sin (* 32768.0 (/ (-> s5-0 extra y) (-> s5-0 extra z))))))))
(set-vector! (-> s5-0 start-color) (* 0.5 f0-16) (* 0.7 f0-16) f0-16 1.0)
(set-vector! (-> s5-0 end-color) (* 0.5 f0-16) (* 0.7 f0-16) f0-16 1.0)
)
(set! (-> s5-0 extra y) (- (-> s5-0 extra y) (* 300.0 (seconds-per-frame))))
)
)
)
)
)
(let ((gp-1 (-> gp-0 array-data 0 data 1)))
(cond
((= (-> gp-1 extra x) 0.0)
(cond
((>= 0.0 (-> gp-1 extra y))
(set! (-> gp-1 extra y) (rand-vu-float-range 75.0 150.0))
(set! (-> gp-1 extra z) (-> gp-1 extra y))
(set! (-> gp-1 extra x) 1.0)
)
(else
(set! (-> gp-1 start-st-offset y) 0.0)
(set! (-> gp-1 end-st-offset y) 0.0)
(set! (-> gp-1 extra y) (- (-> gp-1 extra y) (* 300.0 (seconds-per-frame))))
)
)
)
((= (-> gp-1 extra x) 1.0)
(cond
((>= 0.0 (-> gp-1 extra y))
(set! (-> gp-1 extra y) (rand-vu-float-range 300.0 600.0))
(set! (-> gp-1 extra x) 0.0)
)
(else
(let ((f0-34 (- 1.0 (/ (-> gp-1 extra y) (-> gp-1 extra z)))))
(set! (-> gp-1 start-st-offset y) f0-34)
(set! (-> gp-1 end-st-offset y) f0-34)
)
(set! (-> gp-1 extra y) (- (-> gp-1 extra y) (* 300.0 (seconds-per-frame))))
)
)
)
)
)
)
)
0
(none)
)