jak-project/goal_src/jak3/levels/sewer/jump-pad.gc
Hat Kid 949508d0ed
decomp3: traffic/citizen/faction code, desert-rescue (#3506)
- `cty-faction-h`
- `nav-graph`
- `citizen-h`
- `citizen`
- `civilian`
- `traffic-engine`
- `traffic-manager`
- `cty-attack-controller`
- `cty-faction`
- `formation-object`
- `formations`
- `squad-control-city-h`
- `squad-control-city`
- `traffic-util`
- `wlander-female`
- `wlander-h`
- `wlander-male`
- `speech-manager`
- `desert-rescue`
- `desresc-path`
- `neo-satellite`
- `rope-prim-system-h`
- `rope-prim-system`
- `rope-system`
- `wland-passenger`
- `cty-guard-projectile`
- `ctywide-init`
- `ff-squad-control`
- `guard-grenade`
- `guard-rifle`
- `guard-states`
- `guard-tazer`
- `ctywide-speech`
- `citizen-chick`
- `citizen-fat`
- `citizen-norm`
- `guard`
- `bike`
- `car`
- `test-bike`
- `vehicle-rider`
- `desert-rescue-bbush`
- `ff-squad-control-h`
- `flee-info`
- `guard-h`
- `mission-squad-control`
- `kg-squad-control`
- `kg-squad-member-h`
- `kg-squad-member`
- `mh-squad-control`
- `mh-squad-member-h`
- `mh-squad-member`
- `ctywide-obs-h`
- `ctywide-obs`
- `ctywide-part`
- `ctywide-scenes`
- `ctywide-tasks`
- `ctywide-texture`
- `billiards`
- `guide-arrow`
- `kg-vehicles`
- `flying-turret`
- `roboguard-city`
- `citizen-enemy`
- `metalhead-flitter`
- `metalhead-grunt`
- `metalhead-predator`
- `spydroid`
- `kg-squad-control-h`
- `mh-squad-control-h`
- `krimson-wall`
- `ctyport-obs`
- `ctyinda-obs`
- `ctyinda-part`
- `ctyindb-obs`
- `ctyindb-part`
- `ctyport-attack`
- `h-torpedo`
- `ctyport-part`
- `ctyport-scenes`
- `external-player-control`
- `desert-chase-path-h`
- `desert-chase-path`
- `desert-chase`
- `desert-jump`
- `wcar-catapult`
- `bombbot-h`
- `bombbot`
- `bombbot-path`
- `cty-hijack-missile`
- `cty-hijack`
- `ctyport-attack-bbush`
- `ctysluma-part`
- `ctyslumb-part`
- `ctyslumc-obs`
- `ctyslumc-part`
- `searchlight`
- `cty-destroy-grid`
- `ctyfarm-obs`
- `ctyfarma-part`
- `ctyfarmb-part`
- `freehq-part`
- `freehq-scenes`
- `onintent-scenes`
- `onintent-part`
- `cty-sniper-battery`
- `cty-sniper-turret`
- `intro-obs`
- `intro-part`
- `intro-scenes`
- `palcab-part`
- `palroof-part`
2024-05-09 19:18:55 -04:00

154 lines
4.5 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: jump-pad.gc
;; name in dgo: jump-pad
;; dgos: SEA, FRSTA
;; DECOMP BEGINS
(deftype jump-pad (bouncer)
((fan-quat quaternion :inline)
(rot-vel float)
(fan-loop-sound-id sound-id)
(fan-loop-sound sound-spec)
(jump-sound sound-spec)
)
(:methods
(get-skel (_type_) art-group)
(get-fan-joint-idx (_type_) int)
(init-sounds (_type_) none)
)
)
(defstate idle (jump-pad)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('trigger)
(go-virtual fire)
)
(('attack)
(let ((v1-3 (the-as object (-> block param 1)))
(a0-3 (-> block param 0))
(a2-1 0)
)
0.0
(let ((f30-0 (-> self spring-height)))
(cond
((= (-> (the-as attack-info v1-3) mode) 'flop)
(set! a2-1 1)
)
((= (-> (the-as attack-info v1-3) mode) 'board)
(set! a2-1 9)
)
)
(when (and (nonzero? a2-1) (and ((method-of-type touching-shapes-entry prims-touching?)
(the-as touching-shapes-entry a0-3)
(-> self root)
(the-as uint a2-1)
)
(send-event proc 'jump f30-0 f30-0 (-> self mods))
)
)
(sound-play "trampoline")
(go-virtual fire)
#f
)
)
)
)
(else
((-> (method-of-type bouncer idle) event) proc argc message block)
)
)
)
:trans (behavior ()
(seek! (-> self rot-vel) 10922.667 (* 21845.334 (seconds-per-frame)))
)
:code (behavior ()
(ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min)
(transform-post)
(sleep-code)
)
:post (behavior ()
(when (-> self fan-loop-sound)
(set! (-> self fan-loop-sound pitch-mod)
(the int (* 1524.0 (lerp-scale -0.9 0.6 (-> self rot-vel) 10922.667 87381.336)))
)
(sound-play-by-spec (-> self fan-loop-sound) (-> self fan-loop-sound-id) (-> self root trans))
)
(ja-post)
)
)
(defstate fire (jump-pad)
:virtual #t
:enter (behavior ()
(set-time! (-> self state-time))
)
:trans (behavior ()
(seek! (-> self rot-vel) 87381.336 (* 87381.336 (seconds-per-frame)))
)
:code (behavior ()
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1))
(if (-> self jump-sound)
(sound-play-by-spec (-> self jump-sound) (new-sound-id) (the-as vector #t))
)
(until (time-elapsed? (-> self state-time) (seconds 2))
(suspend)
)
(go-virtual idle)
)
:post (behavior ()
(when (-> self fan-loop-sound)
(set! (-> self fan-loop-sound pitch-mod)
(the int (* 1524.0 (lerp-scale -0.9 0.6 (-> self rot-vel) 10922.667 87381.336)))
)
(sound-play-by-spec (-> self fan-loop-sound) (-> self fan-loop-sound-id) (-> self root trans))
)
(let ((t9-2 (-> (method-of-type bouncer fire) post)))
(if t9-2
((the-as (function none) t9-2))
)
)
)
)
(defun jump-pad-joint-fan ((arg0 cspace) (arg1 quaternion))
(let ((gp-0 (-> arg0 param1)))
(quaternion-rotate-local-y!
(-> (the-as jump-pad gp-0) fan-quat)
(-> (the-as jump-pad gp-0) fan-quat)
(* (-> (the-as jump-pad gp-0) rot-vel) (seconds-per-frame))
)
(quaternion-copy! (&+ arg1 16) (-> (the-as jump-pad gp-0) fan-quat))
)
(cspace<-parented-transformq-joint! arg0 (the-as transformq arg1))
0
(none)
)
(defmethod init-skel! ((this jump-pad))
(initialize-skeleton this (the-as skeleton-group (get-skel this)) (the-as pair 0))
(quaternion-copy! (-> this fan-quat) (-> this root quat))
(let ((a0-6 (-> this node-list data (get-fan-joint-idx this))))
(set! (-> a0-6 param0) (the-as (function cspace transformq none) jump-pad-joint-fan))
(set! (-> a0-6 param1) this)
(set! (-> a0-6 param2) (the-as basic 0))
)
0
(none)
)
(defmethod init-from-entity! ((this jump-pad) (arg0 entity-actor))
(set! (-> this fan-loop-sound) #f)
(set! (-> this jump-sound) #f)
(init-sounds this)
(if (-> this fan-loop-sound)
(set! (-> this fan-loop-sound-id) (new-sound-id))
)
(call-parent-method this arg0)
)