mirror of
https://github.com/open-goal/jak-project
synced 2026-06-30 20:02:12 -04:00
bc66d416b4
Also fix `hud-draw-pris2` bucket in Jak 3 to make subtitles work and foreground HUD envmap.
1142 lines
36 KiB
Common Lisp
Vendored
Generated
1142 lines
36 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type billy
|
|
(deftype billy (process-taskable)
|
|
((child-override (pointer billy-snack) :overlay-at child)
|
|
(farthy handle)
|
|
(path-data path-control 3)
|
|
(path-snacks path-control :overlay-at (-> path-data 0))
|
|
(path-starts path-control :overlay-at (-> path-data 1))
|
|
(path-waypts path-control :overlay-at (-> path-data 2))
|
|
(passed-last-stage symbol)
|
|
(spawn-rats symbol)
|
|
(current-wave int32)
|
|
(wave-start-time time-frame)
|
|
(num-snacks int32)
|
|
(num-rats int32)
|
|
(max-rats int32)
|
|
(rat-speed float)
|
|
(offending-rat handle)
|
|
)
|
|
(:states
|
|
billy-done
|
|
billy-playing
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type billy
|
|
(defmethod inspect ((this billy))
|
|
(let ((t9-0 (method-of-type process-taskable inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tfarthy: ~D~%" (-> this farthy))
|
|
(format #t "~T~Tpath-data[3] @ #x~X~%" (-> this path-data))
|
|
(format #t "~T~Tpath-snacks: ~A~%" (-> this path-snacks))
|
|
(format #t "~T~Tpath-starts: ~A~%" (-> this path-starts))
|
|
(format #t "~T~Tpath-waypts: ~A~%" (-> this path-waypts))
|
|
(format #t "~T~Tpassed-last-stage: ~A~%" (-> this passed-last-stage))
|
|
(format #t "~T~Tspawn-rats: ~A~%" (-> this spawn-rats))
|
|
(format #t "~T~Tcurrent-wave: ~D~%" (-> this current-wave))
|
|
(format #t "~T~Twave-start-time: ~D~%" (-> this wave-start-time))
|
|
(format #t "~T~Tnum-snacks: ~D~%" (-> this num-snacks))
|
|
(format #t "~T~Tnum-rats: ~D~%" (-> this num-rats))
|
|
(format #t "~T~Tmax-rats: ~D~%" (-> this max-rats))
|
|
(format #t "~T~Trat-speed: ~f~%" (-> this rat-speed))
|
|
(format #t "~T~Toffending-rat: ~D~%" (-> this offending-rat))
|
|
this
|
|
)
|
|
|
|
;; definition for method 7 of type billy
|
|
(defmethod relocate ((this billy) (offset int))
|
|
(countdown (v1-0 3)
|
|
(if (nonzero? (-> this path-data v1-0))
|
|
(&+! (-> this path-data v1-0) offset)
|
|
)
|
|
)
|
|
(call-parent-method this offset)
|
|
)
|
|
|
|
;; definition of type billy-snack
|
|
(deftype billy-snack (process-drawable)
|
|
((num-rats int32)
|
|
)
|
|
(:states
|
|
billy-snack-eat
|
|
billy-snack-idle
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type billy-snack
|
|
(defmethod inspect ((this billy-snack))
|
|
(let ((t9-0 (method-of-type process-drawable inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tnum-rats: ~D~%" (-> this num-rats))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *farthy-snack-sg* farthy-snack farthy-snack-lod0-jg farthy-snack-idle-ja
|
|
((farthy-snack-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate billy-snack-eat (billy-snack)
|
|
:code (behavior ()
|
|
(ja :group! farthy-snack-eat-ja)
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(deactivate self)
|
|
(loop
|
|
(suspend)
|
|
)
|
|
)
|
|
:post ja-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate billy-snack-idle (billy-snack)
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('eat)
|
|
(go billy-snack-eat)
|
|
)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(loop
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
)
|
|
:post ja-post
|
|
)
|
|
|
|
;; definition for function billy-snack-init-by-other
|
|
;; INFO: Used lq/sq
|
|
;; INFO: Return type mismatch object vs none.
|
|
(defbehavior billy-snack-init-by-other billy-snack ((arg0 vector))
|
|
(set! (-> self root) (new 'process 'trsqv))
|
|
(set! (-> self root trans quad) (-> arg0 quad))
|
|
(initialize-skeleton self *farthy-snack-sg* '())
|
|
(set! (-> self num-rats) 0)
|
|
(go billy-snack-idle)
|
|
(none)
|
|
)
|
|
|
|
;; definition of type billy-rat
|
|
(deftype billy-rat (swamp-rat)
|
|
((dest-type uint64)
|
|
(snack handle)
|
|
(destination vector :inline)
|
|
(billy (pointer billy))
|
|
)
|
|
(:states
|
|
billy-rat-eat
|
|
billy-rat-salivate
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type billy-rat
|
|
(defmethod inspect ((this billy-rat))
|
|
(let ((t9-0 (method-of-type swamp-rat inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tdest-type: ~D~%" (-> this dest-type))
|
|
(format #t "~T~Tsnack: ~D~%" (-> this snack))
|
|
(format #t "~T~Tdestination: #<vector @ #x~X>~%" (-> this destination))
|
|
(format #t "~T~Tbilly: #x~X~%" (-> this billy))
|
|
this
|
|
)
|
|
|
|
;; definition for function rat-about-to-eat?
|
|
;; INFO: Return type mismatch basic vs symbol.
|
|
(defun rat-about-to-eat? ((arg0 billy-rat) (arg1 billy))
|
|
(the-as symbol (and (= (-> arg0 dest-type) 2) (> (-> arg1 num-snacks) 0) (handle->process (-> arg0 snack))))
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate nav-enemy-idle (billy-rat)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(go-virtual nav-enemy-chase)
|
|
)
|
|
:post nav-enemy-common-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate nav-enemy-die (billy-rat)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(nav-enemy-fall-and-play-death-anim
|
|
(the-as art-joint-anim (-> self draw art-group data (-> self nav-info die-anim)))
|
|
1.0
|
|
1.0
|
|
1000000000000000.0
|
|
600
|
|
)
|
|
(send-event (ppointer->process (-> self billy)) 'billy-rat-die)
|
|
(cleanup-for-death self)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate billy-rat-eat (billy-rat)
|
|
:trans (behavior ()
|
|
(seek-to-point-toward-point! (-> self collide-info) (-> self destination) 131072.0 (seconds 0.01))
|
|
)
|
|
:code (behavior ()
|
|
(send-event (handle->process (-> self snack)) 'eat)
|
|
(sound-play "rat-gulp")
|
|
(ja-channel-push! 1 (seconds 0.05))
|
|
(ja :group! swamp-rat-eat-ja)
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(send-event (ppointer->process (-> self billy)) 'billy-rat-needs-destination)
|
|
(logclear! (-> self nav flags) (nav-control-flags navcf19))
|
|
(go-virtual nav-enemy-chase)
|
|
)
|
|
:post nav-enemy-simple-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate billy-rat-salivate (billy-rat)
|
|
:event nav-enemy-default-event-handler
|
|
:code (behavior ()
|
|
(ja-channel-push! 1 (seconds 0.075))
|
|
(dotimes (gp-0 1)
|
|
(sound-play "rat-eat")
|
|
(let ((f30-0 (nav-enemy-rnd-float-range 0.8 1.2)))
|
|
(ja-no-eval :group! (-> self draw art-group data (-> self nav-info victory-anim))
|
|
:num! (seek! max f30-0)
|
|
:frame-num 0.0
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! max f30-0))
|
|
)
|
|
)
|
|
)
|
|
(send-event (ppointer->process (-> self billy)) 'billy-rat-needs-destination)
|
|
(if (= (-> self dest-type) 3)
|
|
(go billy-rat-eat)
|
|
(go-virtual nav-enemy-chase)
|
|
)
|
|
)
|
|
:post nav-enemy-simple-post
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate nav-enemy-victory (billy-rat)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(call-parent-state-handler enter)
|
|
(when (logtest? (nav-control-flags navcf19) (-> self nav flags))
|
|
(logclear! (-> self nav flags) (nav-control-flags navcf19))
|
|
(if (rat-about-to-eat? self (-> self billy 0))
|
|
(go billy-rat-salivate)
|
|
(send-event (ppointer->process (-> self billy)) 'billy-rat-needs-destination)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate nav-enemy-stare (billy-rat)
|
|
:virtual #t
|
|
:enter (behavior ()
|
|
(go-virtual nav-enemy-chase)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate nav-enemy-chase (billy-rat)
|
|
:virtual #t
|
|
:trans (behavior ()
|
|
(set! (-> self speed-scale) (-> self billy 0 rat-speed))
|
|
(if (or (logtest? (nav-control-flags navcf19) (-> self nav flags))
|
|
(time-elapsed? (-> self state-time) (-> self chase-rest-time))
|
|
)
|
|
(go-virtual nav-enemy-victory)
|
|
)
|
|
)
|
|
:post (behavior ()
|
|
(swamp-rat-update-wiggle-target (-> self destination))
|
|
(nav-enemy-travel-post)
|
|
)
|
|
)
|
|
|
|
;; definition for function billy-rat-init-by-other
|
|
;; INFO: Used lq/sq
|
|
(defbehavior billy-rat-init-by-other billy-rat ((arg0 billy) (arg1 vector) (arg2 vector))
|
|
(set! (-> self billy) (the-as (pointer billy) (process->ppointer arg0)))
|
|
(set! (-> self destination quad) (-> arg2 quad))
|
|
(set! (-> self dest-type) (the-as uint 1))
|
|
(let ((s4-0 (new 'stack-no-clear 'vector)))
|
|
(vector-! s4-0 arg2 arg1)
|
|
(set! (-> s4-0 y) 0.0)
|
|
(vector-normalize! s4-0 1.0)
|
|
(swamp-rat-init-by-other arg0 arg1 s4-0 (pickup-type none) #t)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *billy-sg* billy billy-lod0-jg billy-idle-breath-ja
|
|
((billy-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 2)
|
|
:longest-edge (meters 1)
|
|
:shadow billy-shadow-mg
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *billy-sidekick-sg* billy-sidekick billy-sidekick-lod0-jg billy-sidekick-idle-ja
|
|
((billy-sidekick-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 4)
|
|
)
|
|
|
|
;; definition for function billy-kill-all-but-farthy
|
|
(defbehavior billy-kill-all-but-farthy billy ()
|
|
(let* ((gp-0 (the-as (pointer process-tree) (-> self child-override)))
|
|
(s5-0 (-> (the-as (pointer billy-snack) gp-0) 0 brother))
|
|
)
|
|
(while gp-0
|
|
(if (not (or (= gp-0 (-> self farthy process)) (type-type? (-> (ppointer->process gp-0) type) fuel-cell)))
|
|
(deactivate (-> gp-0 0))
|
|
)
|
|
(set! gp-0 s5-0)
|
|
(set! s5-0 (-> gp-0 0 brother))
|
|
)
|
|
)
|
|
#f
|
|
)
|
|
|
|
;; definition for method 32 of type billy
|
|
(defmethod play-anim! ((this billy) (arg0 symbol))
|
|
(case (current-status (-> this tasks))
|
|
(((task-status need-hint) (task-status need-introduction))
|
|
(when arg0
|
|
(set! (-> this blend-on-exit) (the-as art-joint-anim #t))
|
|
(close-status! (-> this tasks) (task-status need-introduction))
|
|
(let ((s5-1 (new 'stack-no-clear 'vector)))
|
|
(dotimes (s4-0 (+ (the int (the float (+ (-> this path-snacks curve num-cverts) -1))) 1))
|
|
(eval-path-curve-div! (-> this path-snacks) s5-1 (the float s4-0) 'exact)
|
|
(+! (-> s5-1 x) -40960.0)
|
|
(+! (-> s5-1 z) 20480.0)
|
|
(manipy-spawn s5-1 (-> this entity) *farthy-snack-sg* #f :to this)
|
|
)
|
|
)
|
|
)
|
|
(new 'static 'spool-anim
|
|
:name "billy-introduction"
|
|
:index 5
|
|
:parts 14
|
|
:command-list '((0 kill "swamp-blimp-3")
|
|
(0 kill "swamp-tetherrock-14")
|
|
(0 kill "swamp-tetherrock-15")
|
|
(0 kill "flutflut-3")
|
|
(0 kill "tar-plat-26")
|
|
(0 kill "tar-plat-25")
|
|
(0 kill "babak-380")
|
|
(0 kill "eco-164")
|
|
(0 kill "eco-165")
|
|
(0 kill "eco-140")
|
|
(0 kill "launcher-97")
|
|
(0 kill "swamp-rat-nest-5")
|
|
(0 kill "swamp-rat-nest-4")
|
|
(0 kill "swamp-rat-nest-3")
|
|
(0 kill "swamp-rat-nest-2")
|
|
(0 kill "sharkey-9")
|
|
(0 kill "launcher-46")
|
|
(0 kill "launcher-44")
|
|
(0 kill "launcher-42")
|
|
(0 kill "swamp-spike-43")
|
|
(0 kill "swamp-spike-44")
|
|
(0 kill "swamp-spike-45")
|
|
(346 blackout 10)
|
|
(349 blackout 0)
|
|
(494 blackout 10)
|
|
(497 blackout 0)
|
|
(1145 blackout 10)
|
|
(1148 blackout 0)
|
|
(1518 blackout 10)
|
|
(1521 blackout 0)
|
|
)
|
|
)
|
|
)
|
|
(((task-status need-reminder-a) (task-status need-reminder))
|
|
(set! (-> this skippable) #t)
|
|
(set! (-> this blend-on-exit) (the-as art-joint-anim #t))
|
|
(set! (-> this will-talk) #t)
|
|
(new 'static 'spool-anim
|
|
:name "billy-reminder-1"
|
|
:index 8
|
|
:parts 2
|
|
:command-list '((0 kill "swamp-blimp-3")
|
|
(0 kill "swamp-tetherrock-14")
|
|
(0 kill "swamp-tetherrock-15")
|
|
(0 kill "flutflut-3")
|
|
(0 kill "tar-plat-26")
|
|
(0 kill "tar-plat-25")
|
|
(0 kill "babak-380")
|
|
(0 kill "eco-164")
|
|
(0 kill "eco-165")
|
|
(0 kill "eco-140")
|
|
(0 kill "launcher-97")
|
|
(0 kill "swamp-rat-nest-5")
|
|
(0 kill "swamp-rat-nest-4")
|
|
(0 kill "swamp-rat-nest-3")
|
|
(0 kill "swamp-rat-nest-2")
|
|
(0 kill "sharkey-9")
|
|
(0 kill "launcher-46")
|
|
(0 kill "launcher-44")
|
|
(0 kill "launcher-42")
|
|
(0 kill "swamp-spike-43")
|
|
(0 kill "swamp-spike-44")
|
|
(0 kill "swamp-spike-45")
|
|
)
|
|
)
|
|
)
|
|
(((task-status need-reward-speech))
|
|
(when arg0
|
|
(set! (-> this cell-for-task) (current-task (-> this tasks)))
|
|
(close-current! (-> this tasks))
|
|
)
|
|
(new 'static 'spool-anim
|
|
:name "billy-resolution"
|
|
:index 9
|
|
:parts 2
|
|
:command-list '((0 kill "swamp-blimp-3")
|
|
(0 kill "swamp-tetherrock-14")
|
|
(0 kill "swamp-tetherrock-15")
|
|
(0 kill "flutflut-3")
|
|
(0 kill "tar-plat-26")
|
|
(0 kill "tar-plat-25")
|
|
(0 kill "babak-380")
|
|
(0 kill "eco-164")
|
|
(0 kill "eco-165")
|
|
(0 kill "eco-140")
|
|
(0 kill "launcher-97")
|
|
(0 kill "swamp-rat-nest-5")
|
|
(0 kill "swamp-rat-nest-4")
|
|
(0 kill "swamp-rat-nest-3")
|
|
(0 kill "swamp-rat-nest-2")
|
|
(0 kill "sharkey-9")
|
|
(0 kill "launcher-46")
|
|
(0 kill "launcher-44")
|
|
(0 kill "launcher-42")
|
|
(0 kill "swamp-spike-43")
|
|
(0 kill "swamp-spike-44")
|
|
(0 kill "swamp-spike-45")
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(if arg0
|
|
(format
|
|
0
|
|
"ERROR: <GMJ>: ~S playing anim for task status ~S~%"
|
|
(-> this name)
|
|
(task-status->string (current-status (-> this tasks)))
|
|
)
|
|
)
|
|
(-> this draw art-group data 3)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 31 of type billy
|
|
(defmethod get-art-elem ((this billy))
|
|
(case (current-status (-> this tasks))
|
|
(((task-status invalid) (task-status need-resolution))
|
|
(-> this draw art-group data 10)
|
|
)
|
|
(else
|
|
(-> this draw art-group data 3)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 38 of type billy
|
|
;; INFO: Return type mismatch object vs none.
|
|
(defmethod process-taskable-method-38 ((this billy))
|
|
(case (current-status (-> this tasks))
|
|
(((task-status need-reminder-a) (task-status need-reminder))
|
|
(go (method-of-object this query))
|
|
)
|
|
(((task-status need-reward-speech))
|
|
(go (method-of-object this play-anim))
|
|
)
|
|
(else
|
|
(call-parent-method this)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 34 of type billy
|
|
(defmethod get-accept-anim ((this billy) (arg0 symbol))
|
|
(if arg0
|
|
(close-current! (-> this tasks))
|
|
)
|
|
(new 'static 'spool-anim :name "billy-accept" :index 6 :parts 3 :command-list '())
|
|
)
|
|
|
|
;; definition for method 36 of type billy
|
|
(defmethod get-reject-anim ((this billy) (arg0 symbol))
|
|
(new 'static 'spool-anim :name "billy-reject" :index 7 :parts 3 :command-list '())
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate billy-done (billy)
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('billy-rat-needs-destination)
|
|
(let* ((gp-0 proc)
|
|
(v1-2 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) billy-rat))
|
|
gp-0
|
|
)
|
|
)
|
|
)
|
|
(when v1-2
|
|
(set! (-> (the-as billy-rat v1-2) dest-type) (the-as uint 1))
|
|
(get-random-point (-> self path-waypts) (-> (the-as billy-rat v1-2) destination))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(init!
|
|
(-> self query)
|
|
(lookup-text! *common-text* (text-id play-again?) #f)
|
|
40
|
|
150
|
|
30
|
|
#f
|
|
(lookup-text! *common-text* (text-id quit) #f)
|
|
)
|
|
(ja-channel-set! 1)
|
|
(ja :group! (get-art-elem self))
|
|
(send-event *target* 'end-mode)
|
|
(when (and (handle->process (-> self offending-rat)) (zero? (-> self num-snacks)))
|
|
(send-event *camera* 'change-target (handle->process (-> self offending-rat)))
|
|
(send-event *camera* 'change-state cam-standoff 0)
|
|
(send-event *camera* 'set-standoff-height 0.0)
|
|
(send-event *camera* 'set-standoff-dist 20480.0)
|
|
(send-event *camera* 'set-standoff-height 16384.0)
|
|
(send-event *camera-combiner* 'stop-tracking)
|
|
(send-event *camera-combiner* 'start-tracking (ppointer->process (-> *camera* slave 0)))
|
|
(let ((a0-24 (get-reminder (-> self tasks) 0)))
|
|
(save-reminder (-> self tasks) (seekl a0-24 255 1) 0)
|
|
)
|
|
(let ((f0-2 (rand-float-gen)))
|
|
(cond
|
|
((< 0.75 f0-2)
|
|
(play-ambient (-> self ambient) "BIL-TA04" #t (the-as vector #f))
|
|
)
|
|
((< 0.5 f0-2)
|
|
(play-ambient (-> self ambient) "BIL-TA05" #t (the-as vector #f))
|
|
)
|
|
((< 0.25 f0-2)
|
|
(play-ambient (-> self ambient) "BIL-TA4A" #t (the-as vector #f))
|
|
)
|
|
(else
|
|
(play-ambient (-> self ambient) "BIL-TA5A" #t (the-as vector #f))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(billy-kill-all-but-farthy)
|
|
(send-event *camera* 'change-target *target*)
|
|
(send-event *camera* 'change-state *camera-base-mode* 0)
|
|
)
|
|
:trans (behavior ()
|
|
(cond
|
|
((> (-> self num-snacks) 0)
|
|
(when (process-grab? *target*)
|
|
(close-current! (-> self tasks))
|
|
(go-virtual play-anim)
|
|
)
|
|
)
|
|
((< (-> self num-snacks) 0)
|
|
(go-virtual idle)
|
|
)
|
|
(else
|
|
(process-grab? *target*)
|
|
(when (and *target* (logtest? (-> *target* state-flags) (state-flags grabbed)))
|
|
(let ((gp-0 (get-response (-> self query))))
|
|
(cond
|
|
((and (= gp-0 'yes) (process-release? *target*))
|
|
(go-virtual enter-playing)
|
|
)
|
|
((= gp-0 'no)
|
|
(go-virtual play-reject)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(spool-push *art-control* "billy-reject" 0 self -99.0)
|
|
)
|
|
:code process-taskable-anim-loop
|
|
:post (behavior ()
|
|
(ja-post)
|
|
)
|
|
)
|
|
|
|
;; definition for function billy-game-update-wave
|
|
;; INFO: Return type mismatch time-frame vs none.
|
|
(defbehavior billy-game-update-wave billy ()
|
|
(let* ((a0-2 (/ (the-as uint (+ (get-reminder (-> self tasks) 0) 1)) (the-as uint 5)))
|
|
(v1-4 (min 3 (the-as int a0-2)))
|
|
)
|
|
(cond
|
|
((zero? v1-4)
|
|
(let ((v1-5 (-> self current-wave)))
|
|
(cond
|
|
((zero? v1-5)
|
|
(set! (-> self max-rats) 6)
|
|
(set! (-> self rat-speed) 1.0)
|
|
(set! (-> self spawn-rats) #t)
|
|
(set! (-> self passed-last-stage) #f)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 15))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-5 2)
|
|
(set! (-> self max-rats) 8)
|
|
(set! (-> self rat-speed) 1.2)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 20))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-5 4)
|
|
(set! (-> self max-rats) 10)
|
|
(set! (-> self rat-speed) 1.35)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 25))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((= v1-4 1)
|
|
(let ((v1-30 (-> self current-wave)))
|
|
(cond
|
|
((zero? v1-30)
|
|
(set! (-> self max-rats) 6)
|
|
(set! (-> self rat-speed) 1.0)
|
|
(set! (-> self spawn-rats) #t)
|
|
(set! (-> self passed-last-stage) #f)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 15))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-30 2)
|
|
(set! (-> self max-rats) 7)
|
|
(set! (-> self rat-speed) 1.2)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 20))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-30 4)
|
|
(set! (-> self max-rats) 10)
|
|
(set! (-> self rat-speed) 1.3)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 22))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
((= v1-4 2)
|
|
(let ((v1-55 (-> self current-wave)))
|
|
(cond
|
|
((zero? v1-55)
|
|
(set! (-> self max-rats) 6)
|
|
(set! (-> self rat-speed) 1.0)
|
|
(set! (-> self spawn-rats) #t)
|
|
(set! (-> self passed-last-stage) #f)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 15))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-55 2)
|
|
(set! (-> self max-rats) 7)
|
|
(set! (-> self rat-speed) 1.1)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 18))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-55 4)
|
|
(set! (-> self max-rats) 9)
|
|
(set! (-> self rat-speed) 1.25)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 20))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(let ((v1-80 (-> self current-wave)))
|
|
(cond
|
|
((zero? v1-80)
|
|
(set! (-> self max-rats) 5)
|
|
(set! (-> self rat-speed) 0.9)
|
|
(set! (-> self spawn-rats) #t)
|
|
(set! (-> self passed-last-stage) #f)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 15))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-80 2)
|
|
(set! (-> self max-rats) 6)
|
|
(set! (-> self rat-speed) 1.0)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 18))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
((= v1-80 4)
|
|
(set! (-> self max-rats) 8)
|
|
(set! (-> self rat-speed) 1.1)
|
|
(set! (-> self spawn-rats) #t)
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 20))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
|
|
;; definition for function billy-game-update
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior billy-game-update billy ()
|
|
(let ((v1-0 (-> self current-wave)))
|
|
(cond
|
|
((or (zero? v1-0) (= v1-0 2) (= v1-0 4))
|
|
(billy-game-update-wave)
|
|
)
|
|
((= v1-0 5)
|
|
(set! (-> self spawn-rats) #f)
|
|
(set! (-> self passed-last-stage) #t)
|
|
)
|
|
((begin (set! (-> self spawn-rats) #f) (zero? (-> self num-rats)))
|
|
(when (time-elapsed? (-> self wave-start-time) (seconds 3))
|
|
(+! (-> self current-wave) 1)
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
(else
|
|
(set-time! (-> self wave-start-time))
|
|
)
|
|
)
|
|
)
|
|
(when (and (< (-> self num-rats) (-> self max-rats)) (-> self spawn-rats))
|
|
(let ((gp-0 (new 'stack-no-clear 'vector))
|
|
(s5-0 (new 'stack-no-clear 'vector))
|
|
)
|
|
(get-random-point (-> self path-starts) gp-0)
|
|
(get-random-point (-> self path-waypts) s5-0)
|
|
(if (process-spawn billy-rat self gp-0 s5-0 :to self)
|
|
(+! (-> self num-rats) 1)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate billy-playing (billy)
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('billy-rat-die)
|
|
(+! (-> self num-rats) -1)
|
|
(let* ((f0-2 (rand-float-gen))
|
|
(f0-3 (* 3.0 f0-2))
|
|
)
|
|
(cond
|
|
((< 1.0 f0-3)
|
|
#f
|
|
)
|
|
((< 0.8333333 f0-3)
|
|
(play-ambient (-> self ambient) "SKSP009F" #t (the-as vector #f))
|
|
)
|
|
((< 0.6666667 f0-3)
|
|
(play-ambient (-> self ambient) "BIL-TA02" #t (the-as vector #f))
|
|
)
|
|
((< 0.5 f0-3)
|
|
(play-ambient (-> self ambient) "BIL-TA08" #t (the-as vector #f))
|
|
)
|
|
((< 0.33333334 f0-3)
|
|
(play-ambient (-> self ambient) "BIL-TA09" #t (the-as vector #f))
|
|
)
|
|
((< 0.16666667 f0-3)
|
|
(play-ambient (-> self ambient) "BIL-TA2A" #t (the-as vector #f))
|
|
)
|
|
(else
|
|
(play-ambient (-> self ambient) "BIL-TA4B" #t (the-as vector #f))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(('billy-rat-needs-destination)
|
|
(let* ((s5-0 proc)
|
|
(gp-0 (if (and (nonzero? s5-0) (type-type? (-> s5-0 type) billy-rat))
|
|
(the-as billy-rat s5-0)
|
|
)
|
|
)
|
|
)
|
|
(when gp-0
|
|
(let ((f0-6 (rand-float-gen)))
|
|
(cond
|
|
((< 0.75 f0-6)
|
|
(play-ambient (-> self ambient) "BIL-TA01" #t (the-as vector #f))
|
|
)
|
|
((< 0.5 f0-6)
|
|
(play-ambient (-> self ambient) "BIL-TA03" #t (the-as vector #f))
|
|
)
|
|
((< 0.25 f0-6)
|
|
(play-ambient (-> self ambient) "BIL-TA1A" #t (the-as vector #f))
|
|
)
|
|
(else
|
|
(play-ambient (-> self ambient) "BIL-TA3A" #t (the-as vector #f))
|
|
)
|
|
)
|
|
)
|
|
(cond
|
|
((rat-about-to-eat? gp-0 self)
|
|
(set! (-> self num-snacks) 0)
|
|
(set! (-> self offending-rat) (process->handle gp-0))
|
|
(set! (-> gp-0 dest-type) (the-as uint 3))
|
|
(let ((v0-1 (the-as object (-> gp-0 destination))))
|
|
(set! (-> (the-as vector v0-1) quad) (-> (the-as billy-snack (-> gp-0 snack process 0)) root trans quad))
|
|
v0-1
|
|
)
|
|
)
|
|
((or (= (-> gp-0 dest-type) 2) (= (-> gp-0 dest-type) 3) (<= (-> self num-snacks) 0))
|
|
(set! (-> gp-0 dest-type) (the-as uint 1))
|
|
(get-random-point (-> self path-starts) (-> gp-0 destination))
|
|
)
|
|
(else
|
|
(let ((s3-0 100)
|
|
(s4-0 0)
|
|
(s2-0 (the-as (pointer process-tree) (-> self child-override)))
|
|
(s5-1 (the-as process-tree #f))
|
|
)
|
|
(while s2-0
|
|
(let* ((s1-0 (ppointer->process s2-0))
|
|
(v1-47 (if (and (nonzero? s1-0) (type-type? (-> s1-0 type) billy-snack))
|
|
s1-0
|
|
)
|
|
)
|
|
)
|
|
(cond
|
|
((not v1-47)
|
|
)
|
|
((< (-> (the-as billy-snack v1-47) num-rats) s3-0)
|
|
(set! s5-1 v1-47)
|
|
(set! s3-0 (-> (the-as billy-snack v1-47) num-rats))
|
|
(set! s4-0 1)
|
|
)
|
|
((= (-> (the-as billy-snack v1-47) num-rats) s3-0)
|
|
(+! s4-0 1)
|
|
)
|
|
)
|
|
)
|
|
(set! s2-0 (-> s2-0 0 brother))
|
|
)
|
|
(cond
|
|
((zero? s4-0)
|
|
(set! (-> gp-0 dest-type) (the-as uint 1))
|
|
(get-random-point (-> self path-waypts) (-> gp-0 destination))
|
|
)
|
|
(else
|
|
(set! (-> gp-0 snack) (process->handle (the-as billy-snack s5-1)))
|
|
(+! (-> (the-as billy-snack s5-1) num-rats) 1)
|
|
(set! (-> gp-0 dest-type) (the-as uint 2))
|
|
(set! (-> gp-0 destination quad) (-> (the-as billy-snack s5-1) root trans quad))
|
|
(set! (-> gp-0 destination x) (+ 6799.36 (-> gp-0 destination x)))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(add-setting! 'music 'danger 0.0 0)
|
|
(ja-channel-set! 0)
|
|
(clear-collide-with-as (-> self root))
|
|
(init! (-> self query) (the-as string #f) 40 150 25 #t (lookup-text! *common-text* (text-id quit) #f))
|
|
(set-time! (-> self wave-start-time))
|
|
(set! (-> self num-snacks) 0)
|
|
(set! (-> self num-rats) 0)
|
|
(set! (-> self current-wave) 0)
|
|
(set! (-> self offending-rat) (the-as handle #f))
|
|
(let ((gp-1 (new 'stack-no-clear 'vector)))
|
|
(dotimes (s5-1 (+ (the int (the float (+ (-> self path-snacks curve num-cverts) -1))) 1))
|
|
(eval-path-curve-div! (-> self path-snacks) gp-1 (the float s5-1) 'exact)
|
|
(if (process-spawn billy-snack gp-1 :to self)
|
|
(+! (-> self num-snacks) 1)
|
|
)
|
|
)
|
|
)
|
|
(backup-load-state-and-set-cmds *load-state* '())
|
|
(let* ((gp-2 '((kill "swamp-blimp-3")
|
|
(kill "swamp-tetherrock-14")
|
|
(kill "swamp-tetherrock-15")
|
|
(kill "flutflut-3")
|
|
(kill "tar-plat-26")
|
|
(kill "tar-plat-25")
|
|
(kill "babak-380")
|
|
(kill "eco-164")
|
|
(kill "eco-165")
|
|
(kill "eco-140")
|
|
(kill "launcher-97")
|
|
(kill "swamp-rat-nest-5")
|
|
(kill "swamp-rat-nest-4")
|
|
(kill "swamp-rat-nest-3")
|
|
(kill "swamp-rat-nest-2")
|
|
(kill "sharkey-9")
|
|
(kill "launcher-46")
|
|
(kill "launcher-44")
|
|
(kill "launcher-42")
|
|
(kill "swamp-spike-43")
|
|
(kill "swamp-spike-44")
|
|
(kill "swamp-spike-45")
|
|
)
|
|
)
|
|
(a1-8 (car gp-2))
|
|
)
|
|
(while (not (null? gp-2))
|
|
(execute-command *load-state* (the-as pair a1-8))
|
|
(set! gp-2 (cdr gp-2))
|
|
(set! a1-8 (car gp-2))
|
|
)
|
|
)
|
|
)
|
|
:exit (behavior ()
|
|
(restore-collide-with-as (-> self root))
|
|
(restore-load-state-and-cleanup *load-state*)
|
|
(set! (-> *ACTOR-bank* birth-max) 1000)
|
|
(remove-setting! 'music)
|
|
)
|
|
:trans (behavior ()
|
|
(spool-push *art-control* "billy-resolution" 0 self -99.0)
|
|
(spool-push *art-control* "billy-reject" 0 self -99.0)
|
|
)
|
|
:code (behavior ()
|
|
(loop
|
|
(billy-game-update)
|
|
(if (or (zero? (-> self num-snacks))
|
|
(and (zero? (-> self num-rats)) (-> self passed-last-stage))
|
|
(and *cheat-mode* (cpad-pressed? 1 x))
|
|
)
|
|
(go billy-done)
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
:post (behavior ()
|
|
(ja-post)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate enter-playing (billy)
|
|
:virtual #t
|
|
:trans (behavior ()
|
|
(when (send-event *target* 'change-mode 'billy)
|
|
(send-event *target* 'trans 'reset)
|
|
(let ((v1-8 (entity-actor-lookup (-> self entity) 'alt-actor 0)))
|
|
(cond
|
|
(v1-8
|
|
(move-to-point! (-> *target* control) (-> v1-8 extra trans))
|
|
(go billy-playing)
|
|
)
|
|
(else
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 43 of type billy
|
|
(defmethod process-taskable-method-43 ((this billy))
|
|
(when (ambient-control-method-10 (-> this ambient) (new 'stack-no-clear 'vector) (seconds 30) 122880.0 this)
|
|
(let ((f30-0 (rand-float-gen)))
|
|
(cond
|
|
((< 0.9411765 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM01" #f (-> this root trans))
|
|
)
|
|
((< 0.88235295 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM02" #f (-> this root trans))
|
|
)
|
|
((< 0.8235294 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM03" #f (-> this root trans))
|
|
)
|
|
((< 0.7647059 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM04" #f (-> this root trans))
|
|
)
|
|
((< 0.7058824 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM05" #f (-> this root trans))
|
|
)
|
|
((< 0.64705884 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM06" #f (-> this root trans))
|
|
)
|
|
((< 0.5882353 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM07" #f (-> this root trans))
|
|
)
|
|
((< 0.5294118 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM08" #f (-> this root trans))
|
|
)
|
|
((< 0.47058824 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM1A" #f (-> this root trans))
|
|
)
|
|
((< 0.4117647 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM2A" #f (-> this root trans))
|
|
)
|
|
((< 0.3529412 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-AM2B" #f (-> this root trans))
|
|
)
|
|
((= (current-status (-> this tasks)) (task-status invalid))
|
|
#f
|
|
)
|
|
((< 0.29411766 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-LO01" #f (-> this root trans))
|
|
)
|
|
((< 0.23529412 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-LO02" #f (-> this root trans))
|
|
)
|
|
((< 0.1764706 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-LO03" #f (-> this root trans))
|
|
)
|
|
((< 0.11764706 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-LO1A" #f (-> this root trans))
|
|
)
|
|
((< 0.05882353 f30-0)
|
|
(play-ambient (-> this ambient) "BIL-LO2A" #f (-> this root trans))
|
|
)
|
|
(else
|
|
(play-ambient (-> this ambient) "BIL-LO2B" #f (-> this root trans))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate play-anim (billy)
|
|
:virtual #t
|
|
:exit (behavior ()
|
|
(billy-kill-all-but-farthy)
|
|
((-> (method-of-type process-taskable play-anim) exit))
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate idle (billy)
|
|
:virtual #t
|
|
:code (behavior ()
|
|
(if (!= (ja-group) (get-art-elem self))
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
)
|
|
(loop
|
|
(ja :group! (get-art-elem self))
|
|
(let* ((f30-0 5.0)
|
|
(v1-9 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
|
|
(v1-10 (the-as number (logior #x3f800000 v1-9)))
|
|
)
|
|
(countdown (gp-1 (+ (the int (* f30-0 (+ -1.0 (the-as float v1-10)))) 5))
|
|
(ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(process-taskable-method-43 self)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
)
|
|
(when (ja-group? billy-idle-breath-ja)
|
|
(ja-no-eval :group! billy-idle-shoo-ja :num! (seek!) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 47 of type billy
|
|
;; INFO: Return type mismatch basic vs symbol.
|
|
(defmethod target-above-threshold? ((this billy))
|
|
(the-as
|
|
symbol
|
|
(and *target* (not (logtest? (-> *target* control root-prim prim-core action) (collide-action flut))))
|
|
)
|
|
)
|
|
|
|
;; definition for method 11 of type billy
|
|
(defmethod init-from-entity! ((this billy) (arg0 entity-actor))
|
|
(process-taskable-method-40 this arg0 *billy-sg* 3 40 (new 'static 'vector :w 4096.0) 5)
|
|
(set! (-> this tasks) (get-task-control (game-task swamp-billy)))
|
|
(dotimes (s5-0 3)
|
|
(let ((v1-3 (new 'process 'curve-control this 'path (the float s5-0))))
|
|
(set! (-> this path-data s5-0) v1-3)
|
|
(logior! (-> v1-3 flags) (path-control-flag display draw-line draw-point draw-text))
|
|
)
|
|
)
|
|
(set! (-> this path) (-> this path-snacks))
|
|
(set! (-> this farthy)
|
|
(ppointer->handle (manipy-spawn (-> this root trans) (-> this entity) *billy-sidekick-sg* #f :to this))
|
|
)
|
|
(send-event (handle->process (-> this farthy)) 'center-joint 3)
|
|
(send-event (handle->process (-> this farthy)) 'anim-mode 'clone-anim)
|
|
(process-taskable-method-42 this)
|
|
(none)
|
|
)
|