mirror of
https://github.com/open-goal/jak-project
synced 2026-07-11 23:30:16 -04:00
637990314b
Closes #736 --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
980 lines
37 KiB
Common Lisp
Vendored
Generated
980 lines
37 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for symbol *min-bomb-train-times*, type (array float)
|
|
(define *min-bomb-train-times*
|
|
(new 'static 'boxed-array :type float 12.0 15.0 27.0 33.0 55.0 59.0 90.0 92.0 106.0 127.0 131.0 143.0 146.0)
|
|
)
|
|
|
|
;; definition of type min-bomb-train
|
|
(deftype min-bomb-train (process-focusable)
|
|
((path-pos float)
|
|
(path-length float)
|
|
(speed float)
|
|
(fall-travel-time float)
|
|
(actor-group (pointer actor-group))
|
|
(actor-group-count int32)
|
|
(wheel-angle degrees)
|
|
(sound-loop-id sound-id)
|
|
(attack-id uint32)
|
|
(spark-part sparticle-launch-control)
|
|
(smoke-part sparticle-launch-control)
|
|
(light-part sparticle-launch-control)
|
|
(doors-exploded? symbol)
|
|
(taskman handle)
|
|
(current-rail uint8)
|
|
(suck-level float)
|
|
(minimap (array connection-minimap))
|
|
)
|
|
(:state-methods
|
|
idle
|
|
wait
|
|
active
|
|
explode
|
|
fall
|
|
die
|
|
explode-doors
|
|
)
|
|
(:methods
|
|
(alloc-path! (_type_) symbol)
|
|
(init-collision! (_type_) none)
|
|
(get-path-progress (_type_ float float) float)
|
|
(update-task-manager (_type_) object)
|
|
(spawn-debris (_type_) none)
|
|
(explode-sound (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type min-bomb-train
|
|
(defmethod inspect ((this min-bomb-train))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-7)
|
|
)
|
|
(let ((t9-0 (method-of-type process-focusable inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~2Tpath-pos: ~f~%" (-> this path-pos))
|
|
(format #t "~2Tpath-length: ~f~%" (-> this path-length))
|
|
(format #t "~2Tspeed: ~f~%" (-> this speed))
|
|
(format #t "~2Tfall-travel-time: ~f~%" (-> this fall-travel-time))
|
|
(format #t "~2Tactor-group: #x~X~%" (-> this actor-group))
|
|
(dotimes (s5-0 (-> this actor-group-count))
|
|
(format #t "~T [~D]~2Tactor-group: ~`actor-group`P~%" s5-0 (-> this actor-group s5-0))
|
|
)
|
|
(format #t "~2Tactor-group-count: ~D~%" (-> this actor-group-count))
|
|
(format #t "~2Twheel-angle: ~f~%" (-> this wheel-angle))
|
|
(format #t "~2Tsound-loop-id: ~D~%" (-> this sound-loop-id))
|
|
(format #t "~2Tattack-id: ~D~%" (-> this attack-id))
|
|
(format #t "~2Tspark-part: ~A~%" (-> this spark-part))
|
|
(format #t "~2Tsmoke-part: ~A~%" (-> this smoke-part))
|
|
(format #t "~2Tlight-part: ~A~%" (-> this light-part))
|
|
(format #t "~2Tdoors-exploded?: ~A~%" (-> this doors-exploded?))
|
|
(format #t "~2Ttaskman: ~D~%" (-> this taskman))
|
|
(format #t "~2Tcurrent-rail: ~D~%" (-> this current-rail))
|
|
(format #t "~2Tsuck-level: ~f~%" (-> this suck-level))
|
|
(format #t "~2Tminimap: ~A~%" (-> this minimap))
|
|
(label cfg-7)
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup skel-min-bomb-train min-bomb-train min-bomb-train-lod0-jg min-bomb-train-idle-ja
|
|
((min-bomb-train-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 18)
|
|
:shadow min-bomb-train-shadow-mg
|
|
:origin-joint-index 3
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup skel-min-bomb-train-debris-a min-bomb-train-debris min-bomb-train-debris-a-lod0-jg -1
|
|
((min-bomb-train-debris-a-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 5)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup skel-min-bomb-train-debris-b min-bomb-train-debris min-bomb-train-debris-b-lod0-jg -1
|
|
((min-bomb-train-debris-b-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 2)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup skel-min-bomb-train-debris-c min-bomb-train-debris min-bomb-train-debris-c-lod0-jg -1
|
|
((min-bomb-train-debris-c-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 2)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup skel-min-bomb-train-debris-d min-bomb-train-debris min-bomb-train-debris-d-lod0-jg -1
|
|
((min-bomb-train-debris-d-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 2)
|
|
)
|
|
|
|
;; definition for symbol *min-bomb-train-debris-params*, type debris-static-params
|
|
(define *min-bomb-train-debris-params*
|
|
(new 'static 'debris-static-params
|
|
:joints (new 'static 'boxed-array :type debris-static-joint-params
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 3 :group "skel-min-bomb-train-debris-a")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 13 :group "skel-min-bomb-train-debris-b")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 14 :group "skel-min-bomb-train-debris-a")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 15 :group "skel-min-bomb-train-debris-b")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 16 :group "skel-min-bomb-train-debris-a")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 4 :group "skel-min-bomb-train-debris-b")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 5 :group "skel-min-bomb-train-debris-c")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 6 :group "skel-min-bomb-train-debris-d")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 7 :group "skel-min-bomb-train-debris-c")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 12 :group "skel-min-bomb-train-debris-d")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 8 :group "skel-min-bomb-train-debris-d")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 9 :group "skel-min-bomb-train-debris-d")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 10 :group "skel-min-bomb-train-debris-a")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 11 :group "skel-min-bomb-train-debris-a")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 3 :group "skel-min-bomb-train-debris-a")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 3 :group "skel-min-bomb-train-debris-c")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 3 :group "skel-min-bomb-train-debris-a")
|
|
(new 'static 'debris-static-joint-params :parent-joint-index 3 :group "skel-min-bomb-train-debris-c")
|
|
)
|
|
:collide-spec (collide-spec backgnd)
|
|
:sound-hit (static-sound-name "train-pieces")
|
|
)
|
|
)
|
|
|
|
;; definition for method 36 of type min-bomb-train
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod init-collision! ((this min-bomb-train))
|
|
(let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player))))
|
|
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s5-0 reaction) cshape-reaction-default)
|
|
(set! (-> s5-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-query vector vector object) nothing)
|
|
)
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0)))
|
|
(set! (-> s5-0 total-prims) (the-as uint 4))
|
|
(set! (-> s4-0 prim-core collide-as) (collide-spec obstacle))
|
|
(set! (-> s4-0 prim-core action) (collide-action solid no-standon))
|
|
(set! (-> s4-0 transform-index) 3)
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 40960.0)
|
|
(set! (-> s5-0 root-prim) s4-0)
|
|
)
|
|
(let ((v1-12 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
|
|
(set! (-> v1-12 prim-core collide-as) (collide-spec obstacle))
|
|
(set! (-> v1-12 prim-core action) (collide-action solid no-standon))
|
|
(set! (-> v1-12 transform-index) 3)
|
|
(set-vector! (-> v1-12 local-sphere) 0.0 0.0 0.0 40960.0)
|
|
)
|
|
(let ((v1-14 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0))))
|
|
(set! (-> v1-14 prim-core collide-as) (collide-spec obstacle))
|
|
(set! (-> v1-14 prim-core action) (collide-action solid no-standon))
|
|
(set! (-> v1-14 transform-index) 3)
|
|
(set-vector! (-> v1-14 local-sphere) 0.0 4096.0 28672.0 12288.0)
|
|
)
|
|
(let ((v1-16 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 2) (the-as uint 0))))
|
|
(set! (-> v1-16 prim-core collide-as) (collide-spec obstacle))
|
|
(set! (-> v1-16 prim-core action) (collide-action solid no-standon))
|
|
(set! (-> v1-16 transform-index) 3)
|
|
(set-vector! (-> v1-16 local-sphere) 0.0 12288.0 0.0 20480.0)
|
|
)
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
(let ((v1-19 (-> s5-0 root-prim)))
|
|
(set! (-> s5-0 backup-collide-as) (-> v1-19 prim-core collide-as))
|
|
(set! (-> s5-0 backup-collide-with) (-> v1-19 prim-core collide-with))
|
|
)
|
|
(set! (-> this root) s5-0)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 39 of type min-bomb-train
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod spawn-debris ((this min-bomb-train))
|
|
(let ((a1-1 (new 'stack 'debris-tuning (the-as uint 0))))
|
|
(set! (-> a1-1 scale-rand-lo) 1.0)
|
|
(set! (-> a1-1 scale-rand-hi) 1.5)
|
|
(set-vector! (-> a1-1 fountain-rand-transv-lo) -327680.0 163840.0 -327680.0 1.0)
|
|
(set-vector! (-> a1-1 fountain-rand-transv-hi) 327680.0 163840.0 327680.0 1.0)
|
|
(debris-spawn this a1-1 *min-bomb-train-debris-params* (the-as process-drawable #f))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 40 of type min-bomb-train
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod explode-sound ((this min-bomb-train))
|
|
(set-setting! 'music #f 0.0 0)
|
|
(sound-play "train-explode")
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate idle (min-bomb-train)
|
|
:virtual #t
|
|
:trans (behavior ()
|
|
(if (and (task-node-open? (game-task-node mine-blow-resolution))
|
|
(not (logtest? (-> self path flags) (path-control-flag not-found)))
|
|
)
|
|
(go-virtual active)
|
|
)
|
|
(when (task-node-closed? (game-task-node mine-blow-resolution))
|
|
(cleanup-for-death self)
|
|
(deactivate self)
|
|
)
|
|
)
|
|
:code sleep-code
|
|
:post ja-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate wait (min-bomb-train)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(logior! (-> self draw status) (draw-control-status no-draw))
|
|
(let ((v1-4 (-> self root root-prim)))
|
|
(set! (-> v1-4 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-4 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
)
|
|
:exit (behavior ()
|
|
(let ((v1-1 (-> self root root-prim)))
|
|
(set! (-> v1-1 prim-core collide-as) (-> self root backup-collide-as))
|
|
(set! (-> v1-1 prim-core collide-with) (-> self root backup-collide-with))
|
|
)
|
|
(logclear! (-> self draw status) (draw-control-status no-draw))
|
|
)
|
|
:trans (behavior ()
|
|
(if (or (task-open? (the-as string ((method-of-type res-lump get-property-struct)
|
|
(-> self entity)
|
|
'task-name
|
|
'interp
|
|
-1000000000.0
|
|
"mine-blow-resolution"
|
|
(the-as (pointer res-tag) #f)
|
|
*res-static-buf*
|
|
)
|
|
)
|
|
)
|
|
(task-node-open? (game-task-node mine-blow-resolution))
|
|
)
|
|
(go-virtual idle)
|
|
)
|
|
)
|
|
:code sleep-code
|
|
:post ja-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate active (min-bomb-train)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('touch 'attack)
|
|
(let ((s4-0 (the-as object (-> block param 0)))
|
|
(s3-0 (if (= message 'attack)
|
|
(-> block param 1)
|
|
#f
|
|
)
|
|
)
|
|
(s2-0 (-> (the-as collide-shape-prim-group (-> self root root-prim)) child 1))
|
|
)
|
|
(when (the-as touching-shapes-entry s4-0)
|
|
(let ((s1-0 (-> (the-as touching-shapes-entry s4-0) head)))
|
|
(while s1-0
|
|
(when (= (get-touched-prim s1-0 (-> self root) (the-as touching-shapes-entry s4-0)) s2-0)
|
|
(let ((s4-1 (as-type proc process-focusable)))
|
|
(when (and s4-1
|
|
(= (-> s4-1 type) target)
|
|
(or (not (the-as uint s3-0))
|
|
(not (logtest? (penetrate dark-bomb dark-smack) (-> (the-as attack-info s3-0) penetrate-using)))
|
|
)
|
|
)
|
|
(let ((v1-14 (-> self root root-prim)))
|
|
(set! (-> v1-14 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-14 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
(send-event
|
|
s4-1
|
|
'attack-invinc
|
|
(the-as touching-shapes-entry (-> block param 0))
|
|
(static-attack-info
|
|
:mask (vehicle-impulse-factor)
|
|
((id (-> self attack-id))
|
|
(damage 1000.0)
|
|
(vehicle-damage-factor 1.0)
|
|
(vehicle-impulse-factor 1.0)
|
|
(mode 'smush)
|
|
(vector (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))
|
|
(angle 'back)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(return #f)
|
|
)
|
|
(set! s1-0 (-> s1-0 next))
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
(('rail-down)
|
|
(when (>= (-> self actor-group-count) 3)
|
|
(dotimes (s5-2 (-> self actor-group 3 length))
|
|
(let ((s4-2 (-> self actor-group 3 data s5-2 actor)))
|
|
(cond
|
|
((and s4-2 (not (logtest? (-> s4-2 extra perm status) (entity-perm-status subtask-complete))))
|
|
(let ((v1-42 (as-type (handle->process (-> self taskman)) task-manager)))
|
|
(when v1-42
|
|
(set! (-> self current-rail) (the-as uint s5-2))
|
|
(let ((f0-3 (-> *min-bomb-train-times* s5-2)))
|
|
(if (< 0.0 (-> self suck-level))
|
|
(set! f0-3 (* f0-3 (/ 1.0 (-> self suck-level))))
|
|
)
|
|
(set! (-> (the-as task-manager v1-42) time-limit) (the-as time-frame (the int (* 300.0 f0-3))))
|
|
)
|
|
(return #t)
|
|
)
|
|
)
|
|
)
|
|
((= s4-2 (-> proc entity))
|
|
(when (and (nonzero? (-> self minimap s5-2)) *minimap*)
|
|
(kill-callback (-> *minimap* engine) (-> self minimap s5-2))
|
|
(set! (-> self minimap s5-2)
|
|
(add-icon! *minimap* self (the-as uint 155) (the-as int #f) (-> s4-2 extra trans) 0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
(('go-explode)
|
|
(go-virtual explode)
|
|
)
|
|
(('go-explode-doors)
|
|
(go-virtual explode-doors)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set-setting! 'music 'mineblow 0.0 0)
|
|
(when (not (handle->process (-> self taskman)))
|
|
(let ((v1-8 (-> *game-info* sub-task-list (game-task-node mine-blow-resolution))))
|
|
(set! (-> self taskman) (if (-> v1-8 manager)
|
|
(-> v1-8 manager manager)
|
|
(the-as handle #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((v1-13 (-> *game-info* sub-task-list (game-task-node mine-blow-resolution))))
|
|
(if (and v1-13 (< (the-as uint 2) (-> v1-13 death-count)))
|
|
(set! (-> self suck-level)
|
|
(- 1.0 (* 0.04 (the float (max 0 (min 5 (the-as int (+ (-> v1-13 death-count) -2)))))))
|
|
)
|
|
)
|
|
)
|
|
(add-icon! *minimap* self (the-as uint 129) (the-as int #f) (the-as vector #t) 0)
|
|
0
|
|
)
|
|
:trans (behavior ()
|
|
(if (not (task-node-open? (game-task-node mine-blow-resolution)))
|
|
(go-virtual idle)
|
|
)
|
|
(set! (-> self path-pos) (get-path-progress self (-> self path-pos) (* (-> self speed) (seconds-per-frame))))
|
|
(spawn-from-cspace (-> self spark-part) (joint-node min-bomb-train-lod0-jg sparks))
|
|
(spawn-from-cspace (-> self smoke-part) (joint-node min-bomb-train-lod0-jg sparks1))
|
|
(spawn-from-cspace (-> self spark-part) (joint-node min-bomb-train-lod0-jg sparks2))
|
|
(spawn-from-cspace (-> self smoke-part) (joint-node min-bomb-train-lod0-jg sparks3))
|
|
(spawn-from-cspace (-> self spark-part) (joint-node min-bomb-train-lod0-jg sparks4))
|
|
(spawn-from-cspace (-> self light-part) (joint-node min-bomb-train-lod0-jg light))
|
|
(spawn-from-cspace (-> self light-part) (joint-node min-bomb-train-lod0-jg light1))
|
|
(spawn-from-cspace (-> self light-part) (joint-node min-bomb-train-lod0-jg light2))
|
|
(spawn-from-cspace (-> self light-part) (joint-node min-bomb-train-lod0-jg light3))
|
|
(if (nonzero? (-> self sound-loop-id))
|
|
(sound-play-by-name
|
|
(static-sound-name "bomb-train")
|
|
(-> self sound-loop-id)
|
|
1024
|
|
(the int (* 1524.0 (lerp-scale -0.25 0.0 (-> self speed) 28672.0 57344.0)))
|
|
0
|
|
(sound-group)
|
|
#t
|
|
)
|
|
)
|
|
(let ((f1-1 (* 28672.0 ((method-of-type res-lump get-property-value-float)
|
|
(-> self entity)
|
|
'speed
|
|
'interp
|
|
(-> self path-pos)
|
|
1.0
|
|
(the-as (pointer res-tag) #f)
|
|
*res-static-buf*
|
|
)
|
|
)
|
|
)
|
|
(f0-10 1.0)
|
|
)
|
|
(when (< 0.0 (-> self suck-level))
|
|
(set! f0-10 (-> self suck-level))
|
|
(set! f1-1 (* f1-1 f0-10))
|
|
)
|
|
(let ((f0-14 (seek (-> self speed) f1-1 (* 7168.0 (seconds-per-frame) (square f0-10)))))
|
|
(set! (-> self speed) f0-14)
|
|
(set! (-> self speed) f0-14)
|
|
)
|
|
)
|
|
0
|
|
(update-task-manager self)
|
|
)
|
|
:code (behavior ()
|
|
(local-vars (v1-8 process))
|
|
(let ((gp-0 (as-type (handle->process (-> self taskman)) task-manager)))
|
|
(when gp-0
|
|
(logior! (-> gp-0 info mask) (task-manager-mask time-limit))
|
|
(until v1-8
|
|
(suspend)
|
|
(set! v1-8 (handle->process (-> gp-0 hud-timer)))
|
|
)
|
|
(let ((f0-0 (-> *min-bomb-train-times* 0)))
|
|
(if (< 0.0 (-> self suck-level))
|
|
(set! f0-0 (* f0-0 (/ 1.0 (-> self suck-level))))
|
|
)
|
|
(set! (-> gp-0 time-limit) (the-as time-frame (the int (* 300.0 f0-0))))
|
|
)
|
|
)
|
|
)
|
|
(sleep-code)
|
|
)
|
|
:post transform-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate die (min-bomb-train)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(cleanup-for-death self)
|
|
(send-event (handle->process (-> self taskman)) 'fail)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate fall (min-bomb-train)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('go-explode)
|
|
(go-virtual explode)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(set! (-> self root transv quad) (the-as uint128 0))
|
|
(if (nonzero? (-> self sound-loop-id))
|
|
(sound-stop (-> self sound-loop-id))
|
|
)
|
|
(set! (-> self fall-travel-time) (/ 2764800.0 (-> self speed)))
|
|
)
|
|
:trans (behavior ()
|
|
(cond
|
|
((not (time-elapsed? (-> self state-time) (the int (-> self fall-travel-time))))
|
|
(set! (-> self path-pos)
|
|
(path-control-method-26 (-> self path) (-> self path-pos) (* (-> self speed) (seconds-per-frame)))
|
|
)
|
|
(get-point-at-percent-along-path! (-> self path) (-> self root trans) (-> self path-pos) 'interp)
|
|
)
|
|
(else
|
|
(let ((gp-0 (displacement-between-points-at-percent-normalized!
|
|
(-> self path)
|
|
(new 'stack-no-clear 'vector)
|
|
(-> self path-pos)
|
|
)
|
|
)
|
|
)
|
|
(vector-normalize! gp-0 (-> self speed))
|
|
(set! (-> self root transv y) (- (-> self root transv y) (* 3.3333333 (seconds-per-frame) (-> self speed))))
|
|
(+! (-> gp-0 y) (-> self root transv y))
|
|
(vector+float*! (-> self root trans) (-> self root trans) gp-0 (seconds-per-frame))
|
|
)
|
|
)
|
|
)
|
|
(let ((a1-6 (vector-x-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))
|
|
(gp-1 (new 'stack-no-clear 'quaternion))
|
|
)
|
|
(quaternion-vector-angle! gp-1 a1-6 (* 0.26666668 (seconds-per-frame) (-> self speed)))
|
|
(quaternion*! (-> self root quat) gp-1 (-> self root quat))
|
|
)
|
|
(quaternion-normalize! (-> self root quat))
|
|
)
|
|
:code (behavior ()
|
|
(suspend-for (seconds 1)
|
|
)
|
|
(when (type? (-> self root) collide-shape)
|
|
(let ((v1-7 (-> self root root-prim)))
|
|
(set! (-> v1-7 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-7 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
)
|
|
(logior! (-> self draw status) (draw-control-status no-draw))
|
|
(transform-post)
|
|
(spawn-debris self)
|
|
(explode-sound self)
|
|
(cond
|
|
((logtest? (-> group-bomb-train-explode flags) (sp-group-flag sp13))
|
|
(vector-copy! (-> *launch-matrix* trans) (-> self root trans))
|
|
(part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-bomb-train-explode)
|
|
)
|
|
(else
|
|
(vector-copy! (-> *launch-matrix* trans) (-> self root trans))
|
|
(part-tracker-spawn part-tracker :to *entity-pool* :group group-bomb-train-explode)
|
|
)
|
|
)
|
|
(activate! *camera-smush-control* 819.2 36 210 0.5 1.0 (-> self clock))
|
|
(activate! *camera-smush-control-horizontal* 3276.8 24 210 0.5 1.0 (-> self clock))
|
|
(while (-> self child)
|
|
(suspend)
|
|
)
|
|
(go-virtual die)
|
|
)
|
|
:post transform-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate explode (min-bomb-train)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(set-setting! 'allow-progress #f 0.0 0)
|
|
(if (nonzero? (-> self sound-loop-id))
|
|
(sound-stop (-> self sound-loop-id))
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(when (type? (-> self root) collide-shape)
|
|
(let ((v1-2 (-> self root root-prim)))
|
|
(set! (-> v1-2 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-2 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
)
|
|
(logior! (-> self draw status) (draw-control-status no-draw))
|
|
(transform-post)
|
|
(spawn-debris self)
|
|
(explode-sound self)
|
|
(cond
|
|
((logtest? (-> group-bomb-train-explode flags) (sp-group-flag sp13))
|
|
(vector-copy! (-> *launch-matrix* trans) (-> self root trans))
|
|
(part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group group-bomb-train-explode)
|
|
)
|
|
(else
|
|
(vector-copy! (-> *launch-matrix* trans) (-> self root trans))
|
|
(part-tracker-spawn part-tracker :to *entity-pool* :group group-bomb-train-explode)
|
|
)
|
|
)
|
|
(activate! *camera-smush-control* 819.2 36 210 0.5 1.0 (-> self clock))
|
|
(activate! *camera-smush-control-horizontal* 3276.8 24 210 0.5 1.0 (-> self clock))
|
|
(while (-> self child)
|
|
(suspend)
|
|
)
|
|
(go-virtual die)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate explode-doors (min-bomb-train)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('doors-exploded)
|
|
(let ((v0-0 #t))
|
|
(set! (-> self doors-exploded?) v0-0)
|
|
v0-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(if (nonzero? (-> self sound-loop-id))
|
|
(sound-stop (-> self sound-loop-id))
|
|
)
|
|
)
|
|
:trans (behavior ()
|
|
(if (nonzero? (-> self sound-loop-id))
|
|
(sound-play "bomb-train" :id (-> self sound-loop-id))
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(when (type? (-> self root) collide-shape)
|
|
(let ((v1-2 (-> self root root-prim)))
|
|
(set! (-> v1-2 prim-core collide-as) (collide-spec))
|
|
(set! (-> v1-2 prim-core collide-with) (collide-spec))
|
|
)
|
|
0
|
|
)
|
|
(logior! (-> self draw status) (draw-control-status no-draw))
|
|
(transform-post)
|
|
(get-point-at-percent-along-path! (-> self path) (-> self root trans) 1.0 'interp)
|
|
(let ((a1-2 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-2 from) (process->ppointer self))
|
|
(set! (-> a1-2 num-params) 0)
|
|
(set! (-> a1-2 message) 'complete)
|
|
(let ((t9-3 send-event-function)
|
|
(v1-14 (-> *game-info* sub-task-list (game-task-node mine-blow-resolution)))
|
|
)
|
|
(t9-3
|
|
(handle->process (if (-> v1-14 manager)
|
|
(-> v1-14 manager manager)
|
|
(the-as handle #f)
|
|
)
|
|
)
|
|
a1-2
|
|
)
|
|
)
|
|
)
|
|
(until (-> self doors-exploded?)
|
|
(suspend)
|
|
)
|
|
(cleanup-for-death self)
|
|
)
|
|
)
|
|
|
|
;; definition for method 7 of type min-bomb-train
|
|
;; WARN: Return type mismatch process-focusable vs min-bomb-train.
|
|
(defmethod relocate ((this min-bomb-train) (offset int))
|
|
(if (nonzero? (-> this minimap))
|
|
(&+! (-> this minimap) offset)
|
|
)
|
|
(if (nonzero? (-> this spark-part))
|
|
(&+! (-> this spark-part) offset)
|
|
)
|
|
(if (nonzero? (-> this smoke-part))
|
|
(&+! (-> this smoke-part) offset)
|
|
)
|
|
(if (nonzero? (-> this light-part))
|
|
(&+! (-> this light-part) offset)
|
|
)
|
|
(the-as min-bomb-train ((method-of-type process-focusable relocate) this offset))
|
|
)
|
|
|
|
;; definition for method 35 of type min-bomb-train
|
|
(defmethod alloc-path! ((this min-bomb-train))
|
|
(set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0))
|
|
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
|
|
(not (logtest? (-> this path flags) (path-control-flag not-found)))
|
|
)
|
|
|
|
;; definition for method 38 of type min-bomb-train
|
|
;; WARN: Return type mismatch int vs object.
|
|
(defmethod update-task-manager ((this min-bomb-train))
|
|
(if (or (< (-> this actor-group-count) 3) (not (handle->process (-> this taskman))))
|
|
(return (the-as object 0))
|
|
)
|
|
(let ((s4-0 0)
|
|
(s5-0 #t)
|
|
)
|
|
(let ((v1-10 (-> this actor-group 3 data (-> this current-rail) actor)))
|
|
(when v1-10
|
|
(dotimes (a0-9 2)
|
|
(let ((f28-0 (if (zero? a0-9)
|
|
94208.0
|
|
40960.0
|
|
)
|
|
)
|
|
(s3-0 (if (zero? a0-9)
|
|
(method-of-object this fall)
|
|
(method-of-object this explode)
|
|
)
|
|
)
|
|
)
|
|
(dotimes (a1-4 (-> this actor-group a0-9 length))
|
|
(let ((a2-4 (-> this actor-group a0-9 data a1-4 actor)))
|
|
(when (and a2-4 (= v1-10 a2-4) (not (logtest? (-> a2-4 extra perm status) (entity-perm-status subtask-complete))))
|
|
(set! s5-0 #f)
|
|
0.0
|
|
(let* ((s2-0 (-> a2-4 extra trans))
|
|
(f1-0 (path-control-method-23 (-> this path) s2-0))
|
|
(f30-0 (* (-> this path-length) (- f1-0 (-> this path-pos))))
|
|
)
|
|
(when (and (< f30-0 f28-0) (< (vector-vector-distance (-> this root trans) s2-0) f28-0))
|
|
(let ((v1-19 (handle->process (-> this taskman))))
|
|
(when (and v1-19 (handle->process (-> (the-as task-manager v1-19) hud-timer)))
|
|
(logclear! (-> (the-as task-manager v1-19) info mask) (task-manager-mask time-limit))
|
|
(send-event (handle->process (-> (the-as task-manager v1-19) hud-timer)) 'hide-and-die)
|
|
)
|
|
)
|
|
(go s3-0)
|
|
)
|
|
(cond
|
|
((and (< s4-0 3) (< f30-0 163840.0))
|
|
(set! s4-0 3)
|
|
)
|
|
((and (< s4-0 2) (< f30-0 286720.0))
|
|
(set! s4-0 2)
|
|
)
|
|
((and (< s4-0 1) (< f30-0 409600.0))
|
|
(set! s4-0 1)
|
|
)
|
|
)
|
|
)
|
|
#t
|
|
(goto cfg-81)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(label cfg-81)
|
|
(let ((v1-42 (handle->process (-> this taskman))))
|
|
(if (and v1-42 (handle->process (-> (the-as task-manager v1-42) hud-timer)))
|
|
(send-event (handle->process (-> (the-as task-manager v1-42) hud-timer)) 'alert s4-0)
|
|
)
|
|
)
|
|
(let ((a0-48 (-> this actor-group 2 data 0 actor)))
|
|
(if (and a0-48 s5-0 (logtest? (-> a0-48 extra perm status) (entity-perm-status subtask-complete)))
|
|
(go (method-of-object this explode-doors))
|
|
)
|
|
)
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for method 37 of type min-bomb-train
|
|
;; INFO: Used lq/sq
|
|
(defmethod get-path-progress ((this min-bomb-train) (arg0 float) (arg1 float))
|
|
(rlet ((acc :class vf)
|
|
(Q :class vf)
|
|
(vf0 :class vf)
|
|
(vf1 :class vf)
|
|
(vf2 :class vf)
|
|
(vf3 :class vf)
|
|
)
|
|
(init-vf0-vector)
|
|
(when (nonzero? (-> this path))
|
|
(/ 28672.0 (-> this path-length))
|
|
0.0
|
|
0.0
|
|
(let ((f30-0 (path-control-method-26 (-> this path) arg0 arg1)))
|
|
(let ((f28-0 (path-control-method-26 (-> this path) arg0 -28672.0))
|
|
(f26-0 (path-control-method-26 (-> this path) arg0 28672.0))
|
|
(s5-1 (get-point-at-percent-along-path! (-> this path) (new 'stack-no-clear 'vector) f30-0 'interp))
|
|
)
|
|
(let ((s4-0 (get-point-at-percent-along-path! (-> this path) (new 'stack-no-clear 'vector) f28-0 'interp))
|
|
(a2-6 (get-point-at-percent-along-path! (-> this path) (new 'stack-no-clear 'vector) f26-0 'interp))
|
|
(v1-11 (new 'stack-no-clear 'vector))
|
|
(a1-7 (new 'stack-no-clear 'matrix))
|
|
)
|
|
(let ((a0-7 (new 'stack-no-clear 'vector)))
|
|
(vector-copy! a0-7 *up-vector*)
|
|
(vector-! v1-11 a2-6 s4-0)
|
|
(let ((a2-7 v1-11))
|
|
(let ((f0-4 1.0))
|
|
(.lvf vf1 (&-> a2-7 quad))
|
|
(.mul.vf.xyz vf2 vf1 vf1)
|
|
(let ((a3-8 f0-4))
|
|
(.mov vf3 a3-8)
|
|
)
|
|
)
|
|
(.mul.x.vf.w acc vf0 vf2)
|
|
(.add.mul.y.vf.w acc vf0 vf2 acc)
|
|
(.add.mul.z.vf.w vf2 vf0 vf2 acc)
|
|
(.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11)
|
|
(.wait.vf)
|
|
(.mul.vf.xyz vf1 vf1 Q)
|
|
(.nop.vf)
|
|
(.nop.vf)
|
|
(.nop.vf)
|
|
(.svf (&-> a2-7 quad) vf1)
|
|
)
|
|
(let ((a2-8 a1-7))
|
|
(vector-copy! (-> a2-8 fvec) v1-11)
|
|
(vector-copy! (-> a2-8 uvec) a0-7)
|
|
(vector-cross! (-> a2-8 rvec) (-> a2-8 uvec) v1-11)
|
|
)
|
|
)
|
|
(matrix->quaternion (-> this root quat) a1-7)
|
|
)
|
|
(vector-copy! (-> this root trans) s5-1)
|
|
)
|
|
f30-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function min-bomb-train-callback
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defun min-bomb-train-callback ((arg0 cspace) (arg1 transformq))
|
|
(let ((v1-0 (the-as min-bomb-train (-> arg0 param1))))
|
|
(when (and (-> v1-0 next-state) (= (-> v1-0 next-state name) 'active))
|
|
(set! (-> v1-0 wheel-angle)
|
|
(the float
|
|
(sar (shl (the int (+ (-> v1-0 wheel-angle) (* -8.439792 (seconds-per-frame) (-> v1-0 speed)))) 48) 48)
|
|
)
|
|
)
|
|
(quaternion-rotate-local-x! (-> arg1 quat) (-> arg1 quat) (-> v1-0 wheel-angle))
|
|
)
|
|
)
|
|
(cspace<-parented-transformq-joint! arg0 arg1)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 10 of type min-bomb-train
|
|
(defmethod deactivate ((this min-bomb-train))
|
|
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
|
|
(if (nonzero? (-> this sound-loop-id))
|
|
(sound-stop (-> this sound-loop-id))
|
|
)
|
|
(if (nonzero? (-> this spark-part))
|
|
(kill-particles (-> this spark-part))
|
|
)
|
|
(if (nonzero? (-> this smoke-part))
|
|
(kill-particles (-> this smoke-part))
|
|
)
|
|
(if (nonzero? (-> this light-part))
|
|
(kill-particles (-> this light-part))
|
|
)
|
|
((method-of-type process-focusable deactivate) this)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 12 of type min-bomb-train
|
|
(defmethod run-logic? ((this min-bomb-train))
|
|
"Should this process be run? Checked by execute-process-tree."
|
|
#t
|
|
)
|
|
|
|
;; definition for method 11 of type min-bomb-train
|
|
;; INFO: Used lq/sq
|
|
(defmethod init-from-entity! ((this min-bomb-train) (arg0 entity-actor))
|
|
"Set up a newly created process from the entity that created it."
|
|
(when (task-node-closed? (game-task-node mine-blow-resolution))
|
|
(cleanup-for-death this)
|
|
(return #f)
|
|
)
|
|
(init-collision! this)
|
|
(process-drawable-from-entity! this arg0)
|
|
(initialize-skeleton
|
|
this
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-min-bomb-train" (the-as (pointer level) #f)))
|
|
(the-as pair 0)
|
|
)
|
|
(if (not (alloc-path! this))
|
|
(go (method-of-object this idle))
|
|
)
|
|
(logclear! (-> this mask) (process-mask actor-pause))
|
|
(let ((a0-9 (-> this skel root-channel 0)))
|
|
(set! (-> a0-9 frame-group) (if (> (-> this skel active-channels) 0)
|
|
(-> this skel root-channel 0 frame-group)
|
|
)
|
|
)
|
|
(set! (-> a0-9 param 0) 1.0)
|
|
(set! (-> a0-9 frame-num) 0.0)
|
|
(joint-control-channel-group!
|
|
a0-9
|
|
(if (> (-> this skel active-channels) 0)
|
|
(-> this skel root-channel 0 frame-group)
|
|
)
|
|
num-func-loop!
|
|
)
|
|
)
|
|
(ja-post)
|
|
(let ((a0-10 (-> this node-list data 13)))
|
|
(set! (-> a0-10 param0) min-bomb-train-callback)
|
|
(set! (-> a0-10 param1) this)
|
|
(set! (-> a0-10 param2) (the-as basic 0))
|
|
)
|
|
(let ((a0-11 (-> this node-list data 14)))
|
|
(set! (-> a0-11 param0) min-bomb-train-callback)
|
|
(set! (-> a0-11 param1) this)
|
|
(set! (-> a0-11 param2) (the-as basic 0))
|
|
)
|
|
(let ((a0-12 (-> this node-list data 15)))
|
|
(set! (-> a0-12 param0) min-bomb-train-callback)
|
|
(set! (-> a0-12 param1) this)
|
|
(set! (-> a0-12 param2) (the-as basic 0))
|
|
)
|
|
(let ((a0-13 (-> this node-list data 16)))
|
|
(set! (-> a0-13 param0) min-bomb-train-callback)
|
|
(set! (-> a0-13 param1) this)
|
|
(set! (-> a0-13 param2) (the-as basic 0))
|
|
)
|
|
(set! (-> this speed) 0.0)
|
|
(if (nonzero? (-> this path))
|
|
(set! (-> this path-length) (total-distance (-> this path)))
|
|
)
|
|
(let* ((sv-16 (new 'static 'res-tag))
|
|
(v1-44 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))
|
|
)
|
|
(cond
|
|
((and v1-44 (nonzero? (-> sv-16 elt-count)))
|
|
(set! (-> this actor-group) v1-44)
|
|
(set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count)))
|
|
(when (>= (-> this actor-group-count) 3)
|
|
(let ((s5-1 (-> this actor-group 3 length)))
|
|
(set! (-> this minimap) (new 'process 'boxed-array connection-minimap s5-1))
|
|
(dotimes (s4-1 s5-1)
|
|
(let ((v1-57 (-> this actor-group 3 data s4-1 actor)))
|
|
(if v1-57
|
|
(set! (-> this minimap s4-1)
|
|
(add-icon! *minimap* this (the-as uint 154) (the-as int #f) (-> v1-57 extra trans) 0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(set! (-> this actor-group) (the-as (pointer actor-group) #f))
|
|
(set! (-> this actor-group-count) 0)
|
|
0
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this sound-loop-id) (new-sound-id))
|
|
(let* ((v1-64 *game-info*)
|
|
(a0-24 (+ (-> v1-64 attack-id) 1))
|
|
)
|
|
(set! (-> v1-64 attack-id) a0-24)
|
|
(set! (-> this attack-id) a0-24)
|
|
)
|
|
(set! (-> this spark-part) (create-launch-control group-bomb-train-sparks this))
|
|
(set! (-> this smoke-part) (create-launch-control group-bomb-train-smoke this))
|
|
(set! (-> this light-part) (create-launch-control group-bomb-train-light this))
|
|
(set! (-> this doors-exploded?) #f)
|
|
(set! (-> this taskman) (the-as handle #f))
|
|
(when (not (task-open? (the-as string ((method-of-type res-lump get-property-struct)
|
|
(-> this entity)
|
|
'task-name
|
|
'interp
|
|
-1000000000.0
|
|
"mine-blow-resolution"
|
|
(the-as (pointer res-tag) #f)
|
|
*res-static-buf*
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(logior! (-> this draw status) (draw-control-status no-draw))
|
|
(go (method-of-object this wait))
|
|
)
|
|
(if (task-node-open? (game-task-node mine-explore-resolution))
|
|
(go (method-of-object this idle))
|
|
)
|
|
(go (method-of-object this active))
|
|
)
|
|
|
|
|
|
|
|
|