mirror of
https://github.com/open-goal/jak-project
synced 2026-08-06 09:54:10 -04:00
440 lines
16 KiB
Common Lisp
Vendored
Generated
440 lines
16 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for method 15 of type hud-cpanel
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod draw ((this hud-cpanel))
|
|
(set-hud-piece-position! (-> this sprites 0) (the int (+ 502.0 (* 130.0 (-> this offset)))) 200)
|
|
(format (clear (-> this strings 0 text)) "~D" (-> this values 0 current))
|
|
(set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -28 55)
|
|
((method-of-type hud draw) this)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 16 of type hud-cpanel
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod update-values ((this hud-cpanel))
|
|
(set! (-> this values 0 target) (the int (-> *game-info* counter)))
|
|
((method-of-type hud update-values) this)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 17 of type hud-cpanel
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod init-callback ((this hud-cpanel))
|
|
(set! (-> this level) (level-get *level* 'drillmid))
|
|
(set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x10 :page #xb1e)))
|
|
(set! (-> this gui-id)
|
|
(add-process *gui-control* this (gui-channel hud-middle-right) (gui-action hidden) (-> this name) 81920.0 0)
|
|
)
|
|
(logior! (-> this flags) (hud-flags show))
|
|
(set! (-> this sprites 0 flags) (the-as uint 4))
|
|
(set! (-> this sprites 0 scale-x) 1.0)
|
|
(set! (-> this sprites 0 scale-y) 1.0)
|
|
(alloc-string-if-needed this 0)
|
|
(set! (-> this strings 0 scale) 0.6)
|
|
(set! (-> this strings 0 flags) (font-flags kerning middle large))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition of type drill-mech-master
|
|
(deftype drill-mech-master (process)
|
|
((cpanel-count int8)
|
|
(alarm-sound-id sound-id)
|
|
(explosion-sound-id sound-id)
|
|
(exited? symbol)
|
|
(killed-jak? symbol)
|
|
(part-doom sparticle-launch-control)
|
|
(hud-cpanel handle)
|
|
(hud-timer handle)
|
|
(scene-player-handle handle)
|
|
(state-time time-frame)
|
|
(next-warn-time time-frame)
|
|
(total-countdown-time time-frame)
|
|
(started-timer-time time-frame)
|
|
)
|
|
(:state-methods
|
|
idle
|
|
active
|
|
hostile
|
|
failed
|
|
victory
|
|
)
|
|
(:methods
|
|
(spawn-hud-panel (_type_ symbol) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type drill-mech-master
|
|
(defmethod inspect ((this drill-mech-master))
|
|
(when (not this)
|
|
(set! this this)
|
|
(goto cfg-4)
|
|
)
|
|
(let ((t9-0 (method-of-type process inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~2Tcpanel-count: ~D~%" (-> this cpanel-count))
|
|
(format #t "~2Talarm-sound-id: ~D~%" (-> this alarm-sound-id))
|
|
(format #t "~2Texplosion-sound-id: ~D~%" (-> this explosion-sound-id))
|
|
(format #t "~2Texited?: ~A~%" (-> this exited?))
|
|
(format #t "~2Tkilled-jak?: ~A~%" (-> this killed-jak?))
|
|
(format #t "~2Tpart-doom: ~A~%" (-> this part-doom))
|
|
(format #t "~2Thud-cpanel: ~D~%" (-> this hud-cpanel))
|
|
(format #t "~2Thud-timer: ~D~%" (-> this hud-timer))
|
|
(format #t "~2Tscene-player-handle: ~D~%" (-> this scene-player-handle))
|
|
(format #t "~2Tstate-time: ~D~%" (-> this state-time))
|
|
(format #t "~2Tnext-warn-time: ~D~%" (-> this next-warn-time))
|
|
(format #t "~2Ttotal-countdown-time: ~D~%" (-> this total-countdown-time))
|
|
(format #t "~2Tstarted-timer-time: ~D~%" (-> this started-timer-time))
|
|
(label cfg-4)
|
|
this
|
|
)
|
|
|
|
;; definition for symbol *drill-mech-master*, type (pointer drill-mech-master)
|
|
(define *drill-mech-master* (the-as (pointer drill-mech-master) #f))
|
|
|
|
;; definition for method 10 of type drill-mech-master
|
|
(defmethod deactivate ((this drill-mech-master))
|
|
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
|
|
(set! *drill-mech-master* (the-as (pointer drill-mech-master) #f))
|
|
(if (nonzero? (-> this alarm-sound-id))
|
|
(sound-stop (-> this alarm-sound-id))
|
|
)
|
|
(if (nonzero? (-> this part-doom))
|
|
(kill-and-free-particles (-> this part-doom))
|
|
)
|
|
((method-of-type process deactivate) this)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 7 of type drill-mech-master
|
|
;; WARN: Return type mismatch process vs drill-mech-master.
|
|
(defmethod relocate ((this drill-mech-master) (offset int))
|
|
(if (nonzero? (-> this part-doom))
|
|
(&+! (-> this part-doom) offset)
|
|
)
|
|
(the-as drill-mech-master ((method-of-type process relocate) this offset))
|
|
)
|
|
|
|
;; definition for function drill-mech-master-event-handler
|
|
(defbehavior drill-mech-master-event-handler drill-mech-master ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('hud-cpanel)
|
|
(let ((gp-0 (-> arg3 param 0)))
|
|
(set! (-> *game-info* counter) (the float (-> self cpanel-count)))
|
|
(spawn-hud-panel self (the-as symbol gp-0))
|
|
(set-setting! 'music #f 0.0 0)
|
|
(if (not gp-0)
|
|
(set! (-> self exited?) #t)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
(('drill-control-panel)
|
|
(set! (-> self cpanel-count) (max 0 (+ (-> self cpanel-count) -1)))
|
|
(set! (-> *game-info* counter) (the float (-> self cpanel-count)))
|
|
(spawn-hud-panel self #t)
|
|
(when (= (-> self cpanel-count) 9)
|
|
(set! (-> self next-warn-time) (+ (current-time) (seconds 3)))
|
|
(task-node-close! (game-task-node drill-mech-started-smashing))
|
|
)
|
|
(if (and (zero? (-> self cpanel-count)) (-> self next-state) (= (-> self next-state name) 'idle))
|
|
(go-virtual active)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 19 of type drill-mech-master
|
|
;; WARN: Return type mismatch int vs none.
|
|
(defmethod spawn-hud-panel ((this drill-mech-master) (arg0 symbol))
|
|
"Spawn the hud panel for the drill-mech mission."
|
|
(cond
|
|
((and arg0 (nonzero? (-> this cpanel-count)))
|
|
(if (not (handle->process (-> this hud-cpanel)))
|
|
(set! (-> this hud-cpanel) (ppointer->handle (process-spawn hud-cpanel :init hud-init-by-other :to this)))
|
|
)
|
|
)
|
|
(else
|
|
(send-event (handle->process (-> this hud-cpanel)) 'hide-and-die)
|
|
(set! (-> this hud-cpanel) (the-as handle #f))
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate idle (drill-mech-master)
|
|
:virtual #t
|
|
:event drill-mech-master-event-handler
|
|
:trans (behavior ()
|
|
(when (and (< (-> self cpanel-count) 10) (< 1 (-> self cpanel-count)) (>= (current-time) (-> self next-warn-time)))
|
|
(set! (-> self next-warn-time) (+ (current-time) (seconds 10)))
|
|
(talker-spawn-func (-> *talker-speech* 182) *entity-pool* (target-pos 0) (the-as region #f))
|
|
)
|
|
)
|
|
:code sleep-code
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate active (drill-mech-master)
|
|
:virtual #t
|
|
:event drill-mech-master-event-handler
|
|
:code (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(until (time-elapsed? (-> self state-time) (seconds 2))
|
|
(suspend)
|
|
)
|
|
(task-node-close! (game-task-node drill-mech-smash-consoles))
|
|
(set! (-> self alarm-sound-id) (sound-play "drill-alarm"))
|
|
(persist-with-delay *setting-control* 'ignore-target (seconds 8) 'ignore-target #t 0.0 0)
|
|
(set-setting! 'music 'danger10 0.0 0)
|
|
(set-time! (-> self state-time))
|
|
(until (time-elapsed? (-> self state-time) (seconds 1))
|
|
(suspend)
|
|
)
|
|
(talker-spawn-func (-> *talker-speech* 183) *entity-pool* (target-pos 0) (the-as region #f))
|
|
(set-setting! 'pilot #f 0.0 0)
|
|
(let ((v1-20 *target*))
|
|
(if v1-20
|
|
(send-event (handle->process (-> v1-20 mech hud 0)) 'hide-and-die)
|
|
)
|
|
)
|
|
(go-virtual hostile)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate hostile (drill-mech-master)
|
|
:virtual #t
|
|
:event drill-mech-master-event-handler
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(set-continue! *game-info* "drill-escape" #f)
|
|
(set! (-> self next-warn-time) (+ (current-time) (seconds 1)))
|
|
(set-time! (-> self started-timer-time))
|
|
(set! (-> self exited?) #f)
|
|
)
|
|
:trans (behavior ()
|
|
(if (and (-> self exited?) (process-grab? *target* #f))
|
|
(go-virtual victory)
|
|
)
|
|
(let ((gp-0 (the-as int (- (-> self total-countdown-time) (- (current-time) (-> self started-timer-time))))))
|
|
(if (< (the-as time-frame gp-0) 0)
|
|
(set! gp-0 0)
|
|
)
|
|
(set! (-> *game-info* timer) (the-as time-frame gp-0))
|
|
(if (and (>= 3000 gp-0) (zero? (-> self explosion-sound-id)))
|
|
(set! (-> self explosion-sound-id)
|
|
(add-process *gui-control* self (gui-channel background) (gui-action queue) "big-xplo" -99.0 0)
|
|
)
|
|
)
|
|
(if (zero? gp-0)
|
|
(go-virtual failed)
|
|
)
|
|
(when (>= (current-time) (-> self next-warn-time))
|
|
(set! (-> self next-warn-time) (+ (current-time) (seconds 25)))
|
|
(cond
|
|
((>= 9000 gp-0)
|
|
(add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv029" -99.0 0)
|
|
)
|
|
((>= #x4650 gp-0)
|
|
(add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv043" -99.0 0)
|
|
)
|
|
(else
|
|
(add-process *gui-control* self (gui-channel alert) (gui-action play) "cityv027" -99.0 0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(set! (-> self hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to self)))
|
|
(sleep-code)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate failed (drill-mech-master)
|
|
:virtual #t
|
|
:event drill-mech-master-event-handler
|
|
:enter (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(set-setting! 'allow-pause #f 0.0 0)
|
|
(set-setting! 'allow-progress #f 0.0 0)
|
|
)
|
|
:exit (behavior ()
|
|
(disable *screen-filter*)
|
|
(remove-setting! 'allow-pause)
|
|
(remove-setting! 'allow-progress)
|
|
)
|
|
:trans (behavior ()
|
|
(when (and (not (-> self killed-jak?))
|
|
(time-elapsed? (-> self state-time) (seconds 0.225))
|
|
(send-event *target* 'attack-invinc #f (static-attack-info ((id (new-attack-id)) (mode 'big-explosion))))
|
|
)
|
|
(set! (-> self killed-jak?) #t)
|
|
(setup
|
|
*screen-filter*
|
|
(new 'static 'vector :x 255.0 :y 255.0 :z 255.0)
|
|
(new 'static 'vector :x 255.0 :y 255.0 :z 255.0 :w 128.0)
|
|
(* 5.0 (seconds-per-frame))
|
|
(bucket-id tex-all-map)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(remove-setting! 'music)
|
|
(send-event (handle->process (-> self hud-timer)) 'hide-and-die)
|
|
(sound-stop (-> self alarm-sound-id))
|
|
(sound-play "explo-flash")
|
|
(let ((gp-1 #f))
|
|
(countdown (s5-1 5)
|
|
(let ((s4-0 (new 'stack-no-clear 'matrix)))
|
|
(position-in-front-of-camera! (-> s4-0 trans) (+ 28672.0 (* 20480.0 (the float s5-1))) 0.0)
|
|
(position-in-front-of-camera! (-> s4-0 vector 2) 4096.0 0.0)
|
|
(vector-! (-> s4-0 vector 2) (-> s4-0 vector 2) (-> s4-0 trans))
|
|
(vector-normalize! (-> s4-0 vector 2) 1.0)
|
|
(vector-cross! (-> s4-0 vector 0) *up-vector* (-> s4-0 vector 2))
|
|
(vector-normalize! (-> s4-0 vector 0) 1.0)
|
|
(vector-cross! (-> s4-0 vector 1) (-> s4-0 vector 2) (-> s4-0 vector 0))
|
|
(vector-normalize! (-> s4-0 vector 1) 1.0)
|
|
(set! (-> s4-0 vector 0 w) 0.0)
|
|
(set! (-> s4-0 vector 1 w) 0.0)
|
|
(set! (-> s4-0 vector 2 w) 0.0)
|
|
(set! (-> s4-0 trans w) 1.0)
|
|
(spawn-with-matrix (-> self part-doom) s4-0)
|
|
)
|
|
(set-time! (-> self state-time))
|
|
(until (time-elapsed? (-> self state-time) (seconds 0.2))
|
|
(when (and (not gp-1) (>= 2 s5-1) (= (get-status *gui-control* (-> self explosion-sound-id)) (gui-status ready)))
|
|
(set! gp-1 #t)
|
|
(set-action!
|
|
*gui-control*
|
|
(gui-action play)
|
|
(-> self explosion-sound-id)
|
|
(gui-channel none)
|
|
(gui-action none)
|
|
(the-as string #f)
|
|
(the-as (function gui-connection symbol) #f)
|
|
(the-as process #f)
|
|
)
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
)
|
|
(sleep-code)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate victory (drill-mech-master)
|
|
:virtual #t
|
|
:event drill-mech-master-event-handler
|
|
:code (behavior ()
|
|
(local-vars (v1-16 process))
|
|
(remove-setting! 'music)
|
|
(send-event (handle->process (-> self hud-timer)) 'hide-and-die)
|
|
(sound-stop (-> self alarm-sound-id))
|
|
(set! (-> self scene-player-handle)
|
|
(ppointer->handle (process-spawn scene-player :init scene-player-init "drill-top-explode" #t #f))
|
|
)
|
|
(until (not v1-16)
|
|
(suspend)
|
|
(set! v1-16 (handle->process (-> self scene-player-handle)))
|
|
)
|
|
(process-release? *target*)
|
|
(sleep-code)
|
|
)
|
|
)
|
|
|
|
;; definition for function drill-mech-master-init-by-other
|
|
;; WARN: Return type mismatch object vs none.
|
|
(defbehavior drill-mech-master-init-by-other drill-mech-master ()
|
|
(set! *drill-mech-master* (the-as (pointer drill-mech-master) (process->ppointer self)))
|
|
(set! (-> self exited?) #f)
|
|
(set! (-> self killed-jak?) #f)
|
|
(set! (-> self cpanel-count) 10)
|
|
(set! (-> self hud-cpanel) (the-as handle #f))
|
|
(set! (-> self hud-timer) (the-as handle #f))
|
|
(set! (-> self scene-player-handle) (the-as handle #f))
|
|
(set! (-> self alarm-sound-id) (new 'static 'sound-id))
|
|
(set! (-> self explosion-sound-id) (new 'static 'sound-id))
|
|
(set! (-> self total-countdown-time) (seconds 95))
|
|
(set! (-> self part-doom) (create-launch-control group-drill-engulfing-death self))
|
|
(dotimes (gp-0 (-> *level* length))
|
|
(let ((v1-9 (-> *level* level gp-0)))
|
|
(when (= (-> v1-9 status) 'active)
|
|
(let ((s5-0 (-> v1-9 bsp actors)))
|
|
(when (nonzero? s5-0)
|
|
(dotimes (s4-0 (-> s5-0 length))
|
|
(let ((s3-0 (-> s5-0 data s4-0 actor)))
|
|
(if (and (type-type? (-> s3-0 etype) drill-control-panel) (logtest? (-> s3-0 kill-mask) (task-mask task6)))
|
|
(add-icon! *minimap* self (the-as uint 16) (the-as int #f) (the-as vector s3-0) 0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(cond
|
|
((string= (-> *game-info* last-continue name) "drill-escape")
|
|
(set! (-> self cpanel-count) 0)
|
|
(set! (-> self total-countdown-time) (seconds 75))
|
|
(task-node-close! (game-task-node drill-mech-smash-consoles))
|
|
(set! (-> self alarm-sound-id) (sound-play "drill-alarm"))
|
|
(set-setting! 'music 'danger10 0.0 0)
|
|
(go-virtual hostile)
|
|
)
|
|
(else
|
|
(go-virtual idle)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(set-subtask-hook!
|
|
*game-info*
|
|
(game-task-node drill-mech-started-smashing)
|
|
TASK_MANAGER_EVENT_HOOK
|
|
(lambda :behavior task-manager
|
|
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('hud-cpanel)
|
|
(let ((v1-1 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> v1-1 from) (process->ppointer arg0))
|
|
(set! (-> v1-1 num-params) arg1)
|
|
(set! (-> v1-1 message) arg2)
|
|
(set! (-> v1-1 param 0) (-> arg3 param 0))
|
|
(set! (-> v1-1 param 1) (-> arg3 param 1))
|
|
(set! (-> v1-1 param 2) (-> arg3 param 2))
|
|
(set! (-> v1-1 param 3) (-> arg3 param 3))
|
|
(set! (-> v1-1 param 4) (-> arg3 param 4))
|
|
(set! (-> v1-1 param 5) (-> arg3 param 5))
|
|
(send-event-function (handle->process (-> self slave 0)) v1-1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(set-subtask-hook!
|
|
*game-info*
|
|
(game-task-node drill-mech-started-smashing)
|
|
TASK_MANAGER_INIT_HOOK
|
|
(lambda :behavior task-manager () (let ((v0-3 (ppointer->handle (process-spawn drill-mech-master :to self))))
|
|
(set! (-> self slave 0) (the-as handle v0-3))
|
|
v0-3
|
|
)
|
|
)
|
|
)
|