mirror of
https://github.com/open-goal/jak-project
synced 2026-09-10 04:22:13 -04:00
[jak2] More progress on texture animations (#2835)
- Add security wall animation - Add waterfall animations - Add lava animations - Update layer values from the game to fix the security wall - Remove leftover debug in `level.gc` that would break level-specific animations on the second time you visited the level - Optionally load animated slot textures to the pool so generic can use them (fixes skull gems in UI)
This commit is contained in:
@@ -1026,7 +1026,7 @@ it returns a triangle and normal direction to push in.
|
||||
|
||||
;; hack: things have gone very wrong.
|
||||
;; added print
|
||||
(format 0 "very far in collision hack running~%")
|
||||
;; (format 0 "very far in collision hack running~%")
|
||||
(set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) ;; just use the triangle's normal, things are bad.
|
||||
(set! (-> arg0 coverage) 0.0)
|
||||
)
|
||||
|
||||
@@ -185,6 +185,14 @@
|
||||
(skull-gem 27)
|
||||
(bomb 28)
|
||||
(cas-conveyor 29)
|
||||
(security 30)
|
||||
(waterfall 31)
|
||||
(waterfall-b 32)
|
||||
(lava 33)
|
||||
(lava-b 34)
|
||||
(stadiumb 35)
|
||||
(fortress-pris 36)
|
||||
(fortress-warp 37)
|
||||
)
|
||||
|
||||
(deftype texture-anim-pc-upload (structure)
|
||||
@@ -591,6 +599,15 @@
|
||||
(define-extern *skull-gem-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *bomb-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *cas-conveyor-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *security-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *waterfall-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *waterfall-b-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *lava-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *lava-b-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *stadiumb-energy-wall-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *fortress-pris-texture-anim-array* (texture-anim-array texture-anim))
|
||||
(define-extern *fortress-warp-texture-anim-array* (texture-anim-array texture-anim))
|
||||
|
||||
|
||||
(defun pc-update-fixed-anim ((bucket bucket-id) (anim-id texture-anim-pc) (anim-array texture-anim-array))
|
||||
"Run a 'fixed' texture-anim, which should run entirely in C++."
|
||||
@@ -598,24 +615,42 @@
|
||||
bucket
|
||||
)
|
||||
;; determine how many texture we have:
|
||||
(let ((num 0))
|
||||
(let ((num-anims 0)
|
||||
(num-qwc-floats 0))
|
||||
(dotimes (i (-> anim-array length))
|
||||
(when (-> anim-array array-data i tex)
|
||||
(+! num 1)
|
||||
(+! num-anims 1)
|
||||
(+! num-qwc-floats 1) ;; for times
|
||||
(+! num-qwc-floats (* 10 (-> anim-array array-data i num-layers)))
|
||||
)
|
||||
)
|
||||
|
||||
;; (format 0 "pc-update-fixed-anim: ~d layers~%" num)
|
||||
(let ((num-qw (/ (+ num 3) 4)))
|
||||
(pc-texture-anim-flag start-anim-array dma-buf)
|
||||
(pc-texture-anim-flag-id anim-id dma-buf :qwc num-qw)
|
||||
(pc-texture-anim-flag start-anim-array dma-buf)
|
||||
(pc-texture-anim-flag-id anim-id dma-buf :qwc num-qwc-floats)
|
||||
|
||||
(dotimes (i num)
|
||||
(let ((out-ptr (the (inline-array vector) (-> dma-buf base)))
|
||||
)
|
||||
(dotimes (i num-anims)
|
||||
(let ((anim (-> anim-array array-data i))
|
||||
(out-slot (the (pointer float) (&+ (-> dma-buf base) (* 4 i))))
|
||||
(out-slot (the (pointer float) (&+ (-> dma-buf base) (* 11 16 i))))
|
||||
)
|
||||
|
||||
(set! (-> out-slot) (-> anim frame-time))
|
||||
(set! (-> out-ptr 0 x) (-> anim frame-time))
|
||||
(set! (-> out-ptr 0 y) (the-as float (if (-> anim tex)
|
||||
(-> anim tex dest 0)
|
||||
-1
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! out-ptr 16)
|
||||
|
||||
(dotimes (j (-> anim num-layers))
|
||||
(quad-copy! (the pointer out-ptr) (the pointer (-> anim data j start-vectors)) 5)
|
||||
(&+! out-ptr 80)
|
||||
(quad-copy! (the pointer out-ptr) (the pointer (-> anim data j end-vectors)) 5)
|
||||
(&+! out-ptr 80)
|
||||
)
|
||||
|
||||
(when (not (paused?))
|
||||
(with-pp
|
||||
@@ -631,10 +666,10 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(&+! (-> dma-buf base) (* 16 num-qw))
|
||||
(pc-texture-anim-flag finish-anim-array dma-buf)
|
||||
)
|
||||
|
||||
(&+! (-> dma-buf base) (* 16 num-qwc-floats))
|
||||
(pc-texture-anim-flag finish-anim-array dma-buf)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -669,6 +704,38 @@
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc cas-conveyor) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *security-texture-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc security) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *waterfall-texture-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc waterfall) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *waterfall-b-texture-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc waterfall-b) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *lava-texture-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc lava) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *lava-b-texture-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc lava-b) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *stadiumb-energy-wall-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc stadiumb) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *fortress-pris-texture-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc fortress-pris) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *fortress-warp-texture-anim-array*)
|
||||
(pc-update-fixed-anim bucket (texture-anim-pc fortress-warp) anim-array)
|
||||
(return #f)
|
||||
)
|
||||
((= anim-array *darkjak-texture-anim-array*)
|
||||
;; darkjak is simple, and we reimplemented it in C++.
|
||||
;; so we just have to send the frame-time value.
|
||||
|
||||
@@ -1074,7 +1074,6 @@ into 7 sections, which might explain the weird sizes in the center.
|
||||
(dotimes (s4-0 10)
|
||||
(let ((a0-8 (-> obj info texture-anim s4-0)))
|
||||
(when a0-8
|
||||
(set! (-> obj info texture-anim s4-0) #f)
|
||||
(set! (-> obj texture-anim-array s4-0)
|
||||
(init! (the-as texture-anim-array (-> a0-8 value)))
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user