jak-project/goal_src/levels/jungle/junglefish.gc
ManDude 2ea2d6a58a
[decompiler] implement defskelgroup (#955)
* implement `defskelgroup` in decompiler

0 lines removed!

* clang

* fix matcher code

* it was fine actually

* update all files (pt 1)

* update all files

* remaining fixes!

* null deref

* use METER_LENGTH

* move max lod warning

* clang

* math error

* fix macros too

* fix bug in a print
2021-11-04 19:10:39 -04:00

628 lines
14 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: junglefish.gc
;; name in dgo: junglefish
;; dgos: JUN, JUNGLE, L1
;; DECOMP BEGINS
(deftype junglefish (nav-enemy)
()
:heap-base #x120
:method-count-assert 76
:size-assert #x190
:flag-assert #x4c01200190
)
(defskelgroup *junglefish-sg* junglefish
0
4
((1 (meters 20)) (2 (meters 40)) (3 (meters 999999)))
:bounds (static-spherem 0 1 0 1.5)
:longest-edge (meters 0)
)
nav-enemy-default-event-handler
(defmethod common-post junglefish ((obj junglefish))
(dummy-10 (-> obj water))
((the-as (function nav-enemy none) (find-parent-method junglefish 39)) obj)
0
(none)
)
(defstate nav-enemy-patrol (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:exit
(behavior ()
(set! (-> self target-speed) (-> self nav-info walk-travel-speed))
(none)
)
:code
(behavior ()
(ja-channel-push! 1 60)
(let ((f30-0 (nav-enemy-rnd-float-range 0.9 1.1)))
(while #t
(let ((a0-2 (-> self skel root-channel 0)))
(set!
(-> a0-2 frame-group)
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info walk-anim))
)
)
(set!
(-> a0-2 param 0)
(the
float
(+
(->
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info walk-anim))
)
data
0
length
)
-1
)
)
)
(set! (-> a0-2 param 1) f30-0)
(set! (-> a0-2 frame-num) 0.0)
(joint-control-channel-group!
a0-2
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info walk-anim))
)
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-3 (-> self skel root-channel 0)))
(set!
(-> a0-3 param 0)
(the float (+ (-> a0-3 frame-group data 0 length) -1))
)
(set! (-> a0-3 param 1) f30-0)
(joint-control-channel-group-eval!
a0-3
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(when (nav-enemy-rnd-go-idle? 0.2)
(let ((a0-6 (-> self skel root-channel 0)))
(set! (-> a0-6 param 0) 1.0)
(joint-control-channel-group!
a0-6
(the-as art-joint-anim #f)
num-func-loop!
)
)
(ja-channel-push! 1 180)
(set! (-> self target-speed) 0.0)
(let ((a0-8 (-> self skel root-channel 0)))
(set!
(-> a0-8 frame-group)
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
)
(set!
(-> a0-8 param 0)
(the
float
(+
(->
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
data
0
length
)
-1
)
)
)
(set! (-> a0-8 param 1) f30-0)
(set! (-> a0-8 frame-num) 0.0)
(joint-control-channel-group!
a0-8
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
num-func-seek!
)
)
(until (ja-done? 0)
(ja-blend-eval)
(suspend)
(let ((a0-9 (-> self skel root-channel 0)))
(set!
(-> a0-9 param 0)
(the float (+ (-> a0-9 frame-group data 0 length) -1))
)
(set! (-> a0-9 param 1) f30-0)
(joint-control-channel-group-eval!
a0-9
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(until (not (nav-enemy-rnd-go-idle? 0.2))
(let ((a0-11 (-> self skel root-channel 0)))
(set!
(-> a0-11 frame-group)
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
)
(set!
(-> a0-11 param 0)
(the
float
(+
(->
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
data
0
length
)
-1
)
)
)
(set! (-> a0-11 param 1) f30-0)
(set! (-> a0-11 frame-num) 0.0)
(joint-control-channel-group!
a0-11
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info idle-anim))
)
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-12 (-> self skel root-channel 0)))
(set!
(-> a0-12 param 0)
(the float (+ (-> a0-12 frame-group data 0 length) -1))
)
(set! (-> a0-12 param 1) f30-0)
(joint-control-channel-group-eval!
a0-12
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
(set! (-> self target-speed) (-> self nav-info walk-travel-speed))
(let ((a0-15 (-> self skel root-channel 0)))
(set! (-> a0-15 param 0) 1.0)
(joint-control-channel-group!
a0-15
(the-as art-joint-anim #f)
num-func-loop!
)
)
(ja-channel-push! 1 180)
(let ((a0-17 (-> self skel root-channel 0)))
(set!
(-> a0-17 frame-group)
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info walk-anim))
)
)
(set!
(-> a0-17 param 0)
(the
float
(+
(->
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info walk-anim))
)
data
0
length
)
-1
)
)
)
(set! (-> a0-17 param 1) f30-0)
(set! (-> a0-17 frame-num) 0.0)
(joint-control-channel-group!
a0-17
(the-as
art-joint-anim
(-> self draw art-group data (-> self nav-info walk-anim))
)
num-func-seek!
)
)
(until (ja-done? 0)
(ja-blend-eval)
(suspend)
(let ((a0-18 (-> self skel root-channel 0)))
(set!
(-> a0-18 param 0)
(the float (+ (-> a0-18 frame-group data 0 length) -1))
)
(set! (-> a0-18 param 1) f30-0)
(joint-control-channel-group-eval!
a0-18
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
)
)
(none)
)
)
(defstate nav-enemy-notice (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:code
(behavior ()
(go-virtual nav-enemy-chase)
(none)
)
)
(defstate nav-enemy-chase (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:trans
(behavior ()
((-> (method-of-type nav-enemy nav-enemy-chase) trans))
(if
(and
*target*
(>=
8192.0
(vector-vector-distance
(-> self collide-info trans)
(-> *target* control trans)
)
)
)
(go-virtual nav-enemy-attack)
)
(none)
)
)
(defstate nav-enemy-stop-chase (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:code
(behavior ()
(go-virtual nav-enemy-patrol)
(none)
)
)
(defstate nav-enemy-stare (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:code
(behavior ()
(go-virtual nav-enemy-patrol)
(none)
)
)
(defstate nav-enemy-give-up (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:code
(behavior ()
(go-virtual nav-enemy-patrol)
(none)
)
)
(defstate nav-enemy-attack (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:code
(behavior ()
(ja-channel-push! 1 30)
(let ((a0-1 (-> self skel root-channel 0)))
(set!
(-> a0-1 frame-group)
(the-as art-joint-anim (-> self draw art-group data 5))
)
(set!
(-> a0-1 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 5))
data
0
length
)
-1
)
)
)
(set! (-> a0-1 param 1) 1.0)
(set! (-> a0-1 frame-num) 0.0)
(joint-control-channel-group!
a0-1
(the-as art-joint-anim (-> self draw art-group data 5))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-2 (-> self skel root-channel 0)))
(set!
(-> a0-2 param 0)
(the float (+ (-> a0-2 frame-group data 0 length) -1))
)
(set! (-> a0-2 param 1) 1.0)
(joint-control-channel-group-eval!
a0-2
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(go-virtual nav-enemy-chase)
(none)
)
:post
(the-as (function none :behavior junglefish) nav-enemy-chase-post)
)
(defstate nav-enemy-victory (junglefish)
:virtual #t
:event
(the-as
(function process int symbol event-message-block object :behavior junglefish)
nav-enemy-default-event-handler
)
:code
(behavior ()
(ja-channel-push! 1 22)
(let ((a0-1 (-> self skel root-channel 0)))
(set!
(-> a0-1 frame-group)
(the-as art-joint-anim (-> self draw art-group data 4))
)
(set!
(-> a0-1 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 4))
data
0
length
)
-1
)
)
)
(set! (-> a0-1 param 1) 2.0)
(set! (-> a0-1 frame-num) 0.0)
(joint-control-channel-group!
a0-1
(the-as art-joint-anim (-> self draw art-group data 4))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-2 (-> self skel root-channel 0)))
(set!
(-> a0-2 param 0)
(the float (+ (-> a0-2 frame-group data 0 length) -1))
)
(set! (-> a0-2 param 1) 2.0)
(joint-control-channel-group-eval!
a0-2
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(let ((a0-4 (-> self skel root-channel 0)))
(set!
(-> a0-4 frame-group)
(the-as art-joint-anim (-> self draw art-group data 4))
)
(set!
(-> a0-4 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 4))
data
0
length
)
-1
)
)
)
(set! (-> a0-4 param 1) 2.0)
(set! (-> a0-4 frame-num) 0.0)
(joint-control-channel-group!
a0-4
(the-as art-joint-anim (-> self draw art-group data 4))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-5 (-> self skel root-channel 0)))
(set!
(-> a0-5 param 0)
(the float (+ (-> a0-5 frame-group data 0 length) -1))
)
(set! (-> a0-5 param 1) 2.0)
(joint-control-channel-group-eval!
a0-5
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(go-virtual nav-enemy-patrol)
(none)
)
)
(define
*junglefish-nav-enemy-info*
(new 'static 'nav-enemy-info
:idle-anim 4
:walk-anim 4
:turn-anim -1
:notice-anim 4
:run-anim 4
:jump-anim -1
:jump-land-anim -1
:victory-anim 4
:taunt-anim 4
:die-anim 6
:neck-joint -1
:player-look-at-joint 5
:run-travel-speed (meters 5.5)
:run-rotate-speed (degrees 720.0)
:run-acceleration (meters 6.0)
:run-turn-time (seconds 0.15)
:walk-travel-speed (meters 4.0)
:walk-rotate-speed (degrees 720.0)
:walk-acceleration (meters 6.0)
:walk-turn-time (seconds 0.15)
:attack-shove-back (meters 1.0)
:attack-shove-up (meters 0.5)
:shadow-size (meters 2.0)
:notice-nav-radius (meters 1.0)
:nav-nearest-y-threshold (meters 10.0)
:notice-distance (meters 25.0)
:stop-chase-distance (meters 35.0)
:frustration-distance (meters 8.0)
:frustration-time #x4b0
:die-anim-hold-frame 10000000000.0
:jump-land-anim-end-frame 10000000000.0
:jump-height-min (meters 1.0)
:jump-height-factor 0.5
:jump-start-anim-speed 1.0
:shadow-max-y (meters 1.0)
:shadow-min-y (meters -1.0)
:shadow-locus-dist (meters 150.0)
:use-align #f
:draw-shadow #f
:move-to-ground #f
:hover-if-no-ground #f
:use-momentum #t
:use-flee #f
:use-proximity-notice #f
:use-jump-blocked #f
:use-jump-patrol #f
:gnd-collide-with #x1
:debug-draw-neck #f
:debug-draw-jump #f
)
)
(defmethod copy-defaults! junglefish ((obj junglefish) (arg0 res-lump))
(let
((s4-0
(new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))
)
)
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s4-0 reaction) default-collision-reaction)
(set! (-> s4-0 no-reaction) nothing)
(let ((s3-0 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 3))))
(set! (-> s3-0 prim-core collide-as) (the-as uint 256))
(set! (-> s3-0 collide-with) (the-as uint 16))
(set! (-> s3-0 prim-core action) (the-as uint 1))
(set! (-> s3-0 prim-core offense) 1)
(set-vector! (-> s3-0 local-sphere) 0.0 3276.8 0.0 2457.6)
)
(dummy-46 s4-0)
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
(dummy-50 s4-0)
(set! (-> obj collide-info) s4-0)
)
(process-drawable-from-entity! obj arg0)
(initialize-skeleton obj *junglefish-sg* '())
(TODO-RENAME-45 obj *junglefish-nav-enemy-info*)
(set! (-> obj water) (new 'process 'water-control obj 7 0.0 8192.0 2048.0))
(set! (-> obj water flags) (the-as uint 2))
(set! (-> obj water height) (res-lump-float (-> obj entity) 'water-height))
(set! (-> obj water ripple-size) 5734.4)
(set! (-> obj collide-info trans y) (+ -4096.0 (-> obj water height)))
(go (method-of-object obj nav-enemy-idle))
(none)
)