jak-project/goal_src/levels/snow/target-snowball.gc
ManDude 0212aa10c9
[decomp] better handling of animation code and art files (#1352)
* update refs

* [decompiler] read and process art groups

* finish decompiler art group selection & detect in `ja-group?`

* make art stuff work on offline tests!

* [decompiler] detect `ja-group!` (primitive)

* corrections.

* more

* use new feature on skel groups!

* find `loop!` as well

* fully fledged `ja` macro & decomp + `loop` detect

* fancy fixed point printing!

* update source

* `:num! max` (i knew i should've done this)

* Update jak1_ntsc_black_label.jsonc

* hi imports

* make compiling the game work

* fix `defskelgroup`

* clang

* update refs

* fix chan

* fix seek and finalboss

* fix tests

* delete unused function

* track let rewrite stats

* reorder `rewrite_let`

* Update .gitattributes

* fix bug with `:num! max`

* Update robotboss-part.gc

* Update goal-lib.gc

* document `ja`

* get rid of pc fixes thing

* use std::abs
2022-05-20 02:30:14 +01:00

143 lines
3.4 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: target-snowball.gc
;; name in dgo: target-snowball
;; dgos: L1, SNO
;; DECOMP BEGINS
(deftype snowball-info (basic)
((entity basic :offset-assert 4)
)
:method-count-assert 9
:size-assert #x8
:flag-assert #x900000008
)
(deftype snowball-bank (basic)
()
:method-count-assert 9
:size-assert #x4
:flag-assert #x900000004
)
(define *SNOWBALL-bank* (new 'static 'snowball-bank))
(defbehavior target-snowball-post target ()
(let ((gp-0 (the int (-> *display* time-ratio))))
(set-time-ratios *display* 1.0)
(countdown (s5-0 gp-0)
(set! (-> self control unknown-int40) s5-0)
(flag-setup)
(build-conversions (-> self control transv))
(reverse-conversions (-> self control transv))
(post-flag-setup)
)
(set-time-ratios *display* (the float gp-0))
)
(rot->dir-targ! (-> self control))
(ja-post)
(joint-points)
(do-target-shadow)
(target-powerup-process)
0
(none)
)
(defstate target-snowball-start (target)
:event
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(cond
((and (= arg2 'query) (= (-> arg3 param 0) 'mode))
'snowball
)
((let ((v1-3 arg2))
(= v1-3 'end-mode)
)
(go
target-jump
(-> *TARGET-bank* duck-jump-height-min)
(-> *TARGET-bank* duck-jump-height-max)
(the-as surface #f)
)
)
(else
(target-generic-event-handler arg0 arg1 arg2 arg3)
)
)
)
:exit
(behavior ()
(when (!= (-> self next-state name) 'target-snowball)
(let ((v1-1 (-> self manipy)))
(when v1-1
(deactivate (-> v1-1 0))
(set! (-> self manipy) (the-as (pointer manipy) #f))
)
)
(logclear! (-> self control root-prim prim-core action) (collide-action ca-12))
(set! (-> self control unknown-surface00) *walk-mods*)
(set! (-> self control dynam gravity-max) (-> self control unknown-dynamics00 gravity-max))
(set! (-> self control dynam gravity-length) (-> self control unknown-dynamics00 gravity-length))
(target-collide-set! 'normal 0.0)
(set! (-> self control reaction) target-collision-reaction)
(target-exit)
)
(none)
)
:code
(behavior ((arg0 handle))
(target-exit)
(set! *display-profile* #f)
(set! *display-entity-errors* #f)
(if (zero? (-> self snowball))
(set! (-> self snowball) (new 'process 'snowball-info))
)
(set! (-> self snowball entity) #f)
(let ((a0-2 (handle->process arg0)))
(if a0-2
(set! (-> self snowball entity) (-> a0-2 entity))
)
)
(reset-target-state #t)
(set! (-> self control transv quad) (the-as uint128 0))
(set! (-> self control unknown-float01) 0.0)
(move-by-vector! (-> self control) (new 'static 'vector :y 4096.0 :w 1.0))
(logior! (-> self control root-prim prim-core action) (collide-action ca-12))
(ja-channel-set! 1)
(ja :group! (-> self draw art-group data 5) :num! min)
(remove-exit)
(go target-snowball)
(none)
)
:post
target-post
)
(defstate target-snowball (target)
:event
(-> target-snowball-start event)
:exit
(-> target-snowball-start exit)
:code
(behavior ()
(loop
(suspend)
)
(none)
)
:post
(behavior ()
(target-snowball-post)
(none)
)
)