Files
jak-project/goal_src/jak3/levels/desert/lizard/desert-lizard-task.gc
water111 637990314b wip: better stack var support (#4222)
Closes #736

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2026-04-19 00:14:44 +02:00

940 lines
41 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: desert-lizard-task.gc
;; name in dgo: desert-lizard-task
;; dgos: DESLIZ
;; DECOMP BEGINS
(deftype lizard-graph-edge (structure)
((index int32 2)
)
)
(deftype lizard-graph (structure)
((point-count int32)
(point (inline-array vector))
(edge-count int32)
(edge (inline-array lizard-graph-edge))
)
)
(define *desertg-lizard-graph* (new 'static 'lizard-graph
:point-count 45
:point (new 'static 'inline-array vector 45
(new 'static 'vector :x 12159220.0 :y 96453.016 :z 11255192.0 :w 1.0)
(new 'static 'vector :x 11811593.0 :y 95637.51 :z 11244747.0 :w 1.0)
(new 'static 'vector :x 12977765.0 :y 115690.29 :z 12300696.0 :w 1.0)
(new 'static 'vector :x 10494278.0 :y 102037.914 :z 11438241.0 :w 1.0)
(new 'static 'vector :x 12858980.0 :y 135433.83 :z 12292217.0 :w 1.0)
(new 'static 'vector :x 11255888.0 :y 127009.586 :z 12256049.0 :w 1.0)
(new 'static 'vector :x 10488994.0 :y 100464.23 :z 11521800.0 :w 1.0)
(new 'static 'vector :x 10699856.0 :y 94315.73 :z 11499928.0 :w 1.0)
(new 'static 'vector :x 12482108.0 :y 83292.98 :z 11580046.0 :w 1.0)
(new 'static 'vector :x 12534209.0 :y 89273.96 :z 11447621.0 :w 1.0)
(new 'static 'vector :x 13542767.0 :y 80482.305 :z 11325357.0 :w 1.0)
(new 'static 'vector :x 10761460.0 :y 83899.59 :z 11193178.0 :w 1.0)
(new 'static 'vector :x 12771776.0 :y 128539.85 :z 12145826.0 :w 1.0)
(new 'static 'vector :x 12459867.0 :y 92916.53 :z 11926976.0 :w 1.0)
(new 'static 'vector :x 12030523.0 :y 95984.84 :z 12259776.0 :w 1.0)
(new 'static 'vector :x 11671264.0 :y 96310.07 :z 12126739.0 :w 1.0)
(new 'static 'vector :x 13725734.0 :y 94713.04 :z 12116662.0 :w 1.0)
(new 'static 'vector :x 14220326.0 :y 100064.055 :z 11723857.0 :w 1.0)
(new 'static 'vector :x 14339439.0 :y 93189.734 :z 11446679.0 :w 1.0)
(new 'static 'vector :x 14231918.0 :y 116961.28 :z 10700183.0 :w 1.0)
(new 'static 'vector :x 12322815.0 :y 97267.71 :z 11140667.0 :w 1.0)
(new 'static 'vector :x 10132397.0 :y 89511.52 :z 11282675.0 :w 1.0)
(new 'static 'vector :x 10240039.0 :y 93371.59 :z 10426203.0 :w 1.0)
(new 'static 'vector :x 13764115.0 :y 247212.44 :z 10341907.0 :w 1.0)
(new 'static 'vector :x 10970396.0 :y 112328.3 :z 10878195.0 :w 1.0)
(new 'static 'vector :x 13345790.0 :y 265702.2 :z 10253720.0 :w 1.0)
(new 'static 'vector :x 12801145.0 :y 188361.94 :z 10155089.0 :w 1.0)
(new 'static 'vector :x 11238276.0 :y 93120.92 :z 10864433.0 :w 1.0)
(new 'static 'vector :x 11490917.0 :y 78383.516 :z 11034294.0 :w 1.0)
(new 'static 'vector :x 12328754.0 :y 214313.78 :z 9670777.0 :w 1.0)
(new 'static 'vector :x 11873237.0 :y 232102.3 :z 9410927.0 :w 1.0)
(new 'static 'vector :x 11200223.0 :y 246805.7 :z 9311026.0 :w 1.0)
(new 'static 'vector :x 10672004.0 :y 139629.36 :z 9467616.0 :w 1.0)
(new 'static 'vector :x 10176183.0 :y 92769.484 :z 9691667.0 :w 1.0)
(new 'static 'vector :x 13205543.0 :y 83584.62 :z 12211117.0 :w 1.0)
(new 'static 'vector :x 13391707.0 :y 86575.516 :z 12095526.0 :w 1.0)
(new 'static 'vector :x 13261862.0 :y 87103.9 :z 11748678.0 :w 1.0)
(new 'static 'vector :x 13343946.0 :y 88021.4 :z 11463514.0 :w 1.0)
(new 'static 'vector :x 13854309.0 :y 84142.49 :z 11516803.0 :w 1.0)
(new 'static 'vector :x 12248553.0 :y 122121.83 :z 12220210.0 :w 1.0)
(new 'static 'vector :x 12468468.0 :y 182501.78 :z 12343703.0 :w 1.0)
(new 'static 'vector :x 12733561.0 :y 175568.48 :z 12429350.0 :w 1.0)
(new 'static 'vector :x 11113306.0 :y 128412.055 :z 12156435.0 :w 1.0)
(new 'static 'vector :x 10924031.0 :y 119228.83 :z 11930908.0 :w 1.0)
(new 'static 'vector :x 12509591.0 :y 102221.01 :z 11222341.0 :w 1.0)
)
:edge-count 47
:edge (new 'static 'inline-array lizard-graph-edge 47
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 0 1))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 39 40))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 14 39))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 38 17))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 36 37))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 35 36))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 44 20))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 9 44))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 8 9))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 10 38))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 35 16))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 34 35))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 12 13))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 13 8))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 37 10))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 14 15))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 15 5))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 2 34))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 16 17))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 17 18))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 4 2))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 18 19))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 23 19))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 20 0))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 12 4))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 6 21))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 21 22))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 25 23))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 7 6))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 11 7))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 26 25))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 29 26))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 24 11))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 27 24))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 28 1))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 28 27))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 30 29))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 31 30))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 32 31))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 33 32))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 22 33))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 40 41))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 41 4))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 5 42))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 42 43))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 43 6))
(new 'static 'lizard-graph-edge :index (new 'static 'array int32 2 43 7))
)
)
)
(defmethod draw ((this hud-desert-lizards))
(set-hud-piece-position! (-> this sprites 0) (the int (+ 462.0 (* 130.0 (-> this offset)))) 160)
(format (clear (-> this strings 0 text)) "~D/~D" (-> this values 0 current) 3)
(set-as-offset-from! (the-as hud-sprite (-> this strings 0 pos)) (-> this sprites 0 pos) -20 45)
((method-of-type hud draw) this)
0
(none)
)
(defmethod update-values! ((this hud-desert-lizards))
(set! (-> this values 0 target) (the int (-> *game-info* counter)))
(set! (-> this values 1 target) (the int (-> *game-info* score)))
((method-of-type hud update-values!) this)
0
(none)
)
(defmethod init-callback ((this hud-desert-lizards))
(set! (-> this level) (level-get *level* 'desliz))
(set! (-> this gui-id)
(add-process *gui-control* this (gui-channel hud-center-right) (gui-action hidden) (-> this name) 81920.0 0)
)
(logior! (-> this flags) (hud-flags show))
(set! (-> this sprites 0 tid) (the-as texture-id (get-texture hud-desert-lizard desliz-minimap)))
(set! (-> this sprites 0 flags) (hud-sprite-flags hsf2))
(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.8)
(set! (-> this strings 0 flags) (font-flags shadow kerning middle large))
(set! (-> this strings 0 color) (font-color white))
0
(none)
)
(deftype task-manager-desert-catch-lizards (task-manager)
((corral-pos sphere :inline)
(actor-group (pointer actor-group))
(actor-group-count int32)
(manager-entity entity-actor)
(lizard-count int32)
(lizards-left int32)
(sound-id sound-id)
(restart-time time-frame)
(vehicle-handle handle)
(vehicle-hit-points float)
(vehicle-turbo-count float)
(lizard-in-corral symbol)
(daxter-comment-time time-frame)
(hint-time time-frame)
(arrow-handle handle)
)
(:state-methods
paused
)
(:methods
(spawn-lizard (_type_ int) (pointer process))
(on-restart (_type_) none)
)
)
(defstate active (task-manager-desert-catch-lizards)
:virtual #t
:enter (behavior ()
(let ((t9-0 (-> (method-of-type task-manager active) enter)))
(if t9-0
(t9-0)
)
)
(set-setting! 'music 'waschase 0.0 0)
(set! (-> self lizard-in-corral) #f)
(set! (-> self daxter-comment-time) 0)
0
)
:exit (behavior ()
(when (-> self arrow-handle)
(send-event (handle->process (-> self arrow-handle)) 'leave)
(set! (-> self arrow-handle) (the-as handle #f))
)
)
:code (behavior ()
(until (-> self manager-entity)
(suspend)
)
(suspend)
(let ((gp-0 (-> self actor-group 0)))
(dotimes (s5-0 (-> gp-0 length))
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-0 from) (process->ppointer self))
(set! (-> a1-0 num-params) 0)
(set! (-> a1-0 message) 'suppress-spawn)
(let ((t9-0 send-event-function)
(v1-7 (-> gp-0 data s5-0 actor))
)
(t9-0
(if v1-7
(-> v1-7 extra process)
)
a1-0
)
)
)
)
)
(when (time-elapsed? (-> self state-time) (seconds 5))
(suspend-for (seconds 1)
(set! (-> self sound-id)
(add-process *gui-control* self (gui-channel background) (gui-action queue) "hudchime" -99.0 0)
)
)
(sound-params-set! *gui-control* (-> self sound-id) #f -1 -1 -1 1.0)
(set-action!
*gui-control*
(gui-action play)
(-> self sound-id)
(gui-channel none)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
)
(if (not (-> self hud-counter))
(set! (-> self hud-counter)
(ppointer->handle
(process-spawn hud-desert-lizards :init hud-init-by-other :name "hud-desert-lizards" :to self)
)
)
)
(let ((v1-37 (-> self manager-entity extra perm)))
(if (logtest? (-> v1-37 status) (entity-perm-status bit-5))
(set! (-> self lizard-count) (the-as int (-> v1-37 user-object 0)))
)
)
(kill-by-type flut *active-pool*)
(dotimes (gp-3 (-> self lizard-count))
(spawn-lizard self gp-3)
)
(until #f
(while (begin
(set! (-> self vehicle-handle) (-> *vehicle-info* handle-by-vehicle-type 13))
(not (handle->process (-> self vehicle-handle)))
)
(suspend)
)
(send-event *target* 'change-mode 'fldax)
(cond
((and *target* (focus-test? *target* dead))
(kill-current-talker '() '() 'exit)
)
((and *target* (focus-test? *target* flut))
(when (not (-> self arrow-handle))
(let ((gp-4 (new 'stack-no-clear 'task-arrow-params)))
(vector-copy! (-> gp-4 pos) (-> *minimap-class-list* 121 default-position))
(quaternion-identity! (-> gp-4 quat))
(set! (-> gp-4 flags) (task-arrow-flags taf8))
(set! (-> gp-4 map-icon) (the-as uint 12))
(set! (-> self arrow-handle) (process->handle (task-arrow-spawn gp-4 self)))
)
)
(cond
((zero? (-> self daxter-comment-time))
(set! (-> self daxter-comment-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 3.0 6.0)))))
)
((< (-> self daxter-comment-time) (current-time))
(let ((v1-80 (rand-vu-int-range 0 19)))
(cond
((zero? v1-80)
(talker-spawn-func (-> *catch-lizards-speech-list* 31) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 1)
(talker-spawn-func (-> *catch-lizards-speech-list* 32) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 2)
(talker-spawn-func (-> *catch-lizards-speech-list* 33) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 3)
(talker-spawn-func (-> *catch-lizards-speech-list* 34) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 4)
(talker-spawn-func (-> *catch-lizards-speech-list* 35) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 5)
(talker-spawn-func (-> *catch-lizards-speech-list* 36) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 6)
(talker-spawn-func (-> *catch-lizards-speech-list* 37) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 7)
(talker-spawn-func (-> *catch-lizards-speech-list* 38) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 8)
(talker-spawn-func (-> *catch-lizards-speech-list* 39) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 9)
(talker-spawn-func (-> *catch-lizards-speech-list* 40) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 10)
(talker-spawn-func (-> *catch-lizards-speech-list* 41) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 11)
(talker-spawn-func (-> *talker-speech* 100) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 12)
(talker-spawn-func (-> *catch-lizards-speech-list* 42) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 13)
(talker-spawn-func (-> *catch-lizards-speech-list* 43) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 14)
(talker-spawn-func (-> *catch-lizards-speech-list* 44) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 15)
(talker-spawn-func (-> *catch-lizards-speech-list* 45) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 16)
(talker-spawn-func (-> *catch-lizards-speech-list* 46) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 17)
(talker-spawn-func (-> *catch-lizards-speech-list* 47) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-80 18)
(talker-spawn-func (-> *catch-lizards-speech-list* 48) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
(set! (-> self daxter-comment-time) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 5.0 10.0)))))
)
)
)
)
(cond
((and *target*
(focus-test? *target* flut)
(-> self lizard-in-corral)
(not (logtest? (-> *target* focus-status) (focus-status dead hit)))
)
(let ((v1-133 (-> *target* flut entity)))
(if v1-133
(logior! (-> v1-133 extra perm status) (entity-perm-status subtask-complete))
)
)
(send-event (handle->process (-> self vehicle-handle)) 'go-die)
(when (-> self arrow-handle)
(send-event (handle->process (-> self arrow-handle)) 'leave)
(set! (-> self arrow-handle) (the-as handle #f))
)
(let ((v1-150 (rand-vu-int-range 0 7)))
(cond
((zero? v1-150)
(talker-spawn-func (-> *catch-lizards-speech-list* 16) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-150 1)
(talker-spawn-func (-> *catch-lizards-speech-list* 17) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-150 2)
(talker-spawn-func (-> *catch-lizards-speech-list* 18) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-150 3)
(talker-spawn-func (-> *catch-lizards-speech-list* 19) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-150 4)
(talker-spawn-func (-> *catch-lizards-speech-list* 21) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-150 5)
(talker-spawn-func (-> *catch-lizards-speech-list* 22) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-150 6)
(talker-spawn-func (-> *catch-lizards-speech-list* 23) *entity-pool* (target-pos 0) (the-as region #f))
)
((= v1-150 7)
(talker-spawn-func (-> *catch-lizards-speech-list* 24) *entity-pool* (target-pos 0) (the-as region #f))
)
)
)
(set! (-> self daxter-comment-time) 0)
(cond
((= (-> self lizard-count) 2)
(send-event self 'complete)
)
(else
(kill-current-talker '() '(message notice) 'exit)
(let* ((gp-34 (get-process *default-dead-pool* scene-player #x4000 1))
(gp-35 (ppointer->handle
(when gp-34
(let ((t9-76 (method-of-type scene-player activate)))
(t9-76 (the-as scene-player gp-34) *default-pool* "scene-player" (the-as pointer #x70004000))
)
(let* ((t9-77 run-function-in-process)
(a0-168 gp-34)
(a1-50 scene-player-init)
(v1-175 (-> self lizard-count))
(a2-39 (cond
((zero? v1-175)
"desert-lizard-catch"
)
((= v1-175 1)
"desert-lizard-catch-2"
)
)
)
)
((the-as (function object object object object object none) t9-77)
a0-168
a1-50
a2-39
#t
"desert-lizard-corral"
)
)
(-> gp-34 ppointer)
)
)
)
)
(while (handle->process (the-as handle gp-35))
(suspend)
)
)
(while (begin
(set! (-> self vehicle-handle) (-> *vehicle-info* handle-by-vehicle-type 13))
(not (handle->process (-> self vehicle-handle)))
)
(format *stdebug* "waiting for snake~%")
(suspend)
)
(let ((v1-189 (the-as wvehicle (handle->process (-> self vehicle-handle)))))
(set! (-> v1-189 hit-points) (-> self vehicle-hit-points))
(set! (-> v1-189 turbo-supply) (-> self vehicle-turbo-count))
)
)
)
(spawn-lizard self (-> self lizard-count))
)
((and *target*
(focus-test? *target* flut)
(>= 4096000.0 (vector-vector-xz-distance (target-pos 0) (-> self corral-pos)))
)
(let* ((a0-188 *gui-control*)
(t9-82 (method-of-object a0-188 gui-control-method-12))
(a2-41 16)
(a3-35 1)
(v1-201 (-> self lizard-count))
)
(t9-82
a0-188
self
(the-as gui-channel a2-41)
(the-as gui-action a3-35)
(cond
((zero? v1-201)
"desert-lizard-catch"
)
((= v1-201 1)
"desert-lizard-catch-2"
)
(else
"desert-lizard-catch-3"
)
)
0
-1.0
(new 'static 'sound-id)
)
)
(let ((gp-37 (-> self actor-group 1)))
(dotimes (s5-28 (-> gp-37 length))
(let ((a1-59 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-59 from) (process->ppointer self))
(set! (-> a1-59 num-params) 0)
(set! (-> a1-59 message) 'shutdown)
(let ((t9-83 send-event-function)
(v1-208 (-> gp-37 data s5-28 actor))
)
(t9-83
(if v1-208
(-> v1-208 extra process)
)
a1-59
)
)
)
)
)
)
(else
(let ((gp-38 (-> self actor-group 1)))
(dotimes (s5-29 (-> gp-38 length))
(let ((a1-60 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-60 from) (process->ppointer self))
(set! (-> a1-60 num-params) 0)
(set! (-> a1-60 message) 'trigger)
(let ((t9-84 send-event-function)
(v1-219 (-> gp-38 data s5-29 actor))
)
(t9-84
(if v1-219
(-> v1-219 extra process)
)
a1-60
)
)
)
)
)
)
)
(set! (-> self lizard-in-corral) #f)
(suspend)
)
#f
)
)
(defstate paused (task-manager-desert-catch-lizards)
:virtual #t
:event task-manager-event-handler
:enter (behavior ()
(set-time! (-> self state-time))
(set! (-> self manager-entity) #f)
)
:trans (behavior ()
((-> (method-of-object self wait) trans))
(send-event (handle->process (-> self hud-counter)) 'force-hide)
(if *debug-segment*
(format *stdebug* "task-manager: ~A paused~%" (-> self node-info name))
)
(let ((v1-13 (level-get *level* 'desertg)))
(if (and v1-13 (= (-> v1-13 status) 'active) (-> v1-13 display?))
(go-virtual active)
)
)
)
:code sleep-code
)
(defstate resolution (task-manager-desert-catch-lizards)
:virtual #t
:code (behavior ()
(send-event (handle->process (-> self vehicle-handle)) 'go-die)
(call-parent-state-handler code)
)
)
(defmethod on-fail ((this task-manager-desert-catch-lizards) (arg0 symbol))
(case arg0
(('death)
(let ((v1-1 (rand-vu-int-count 5)))
(cond
((zero? v1-1)
(new 'static 'resetter-params
:flags (resetter-flag auto-reset text-message no-audio no-slow-down)
:fail (new 'static 'resetter-spec :continue "desert-lizard-corral" :reset-mode 'life :execute #f)
:retry (new 'static 'resetter-spec :continue #f :reset-mode 'try :execute #f)
)
)
((or (= v1-1 1) (= v1-1 2))
(new 'static 'resetter-params
:flags (resetter-flag auto-reset text-message no-audio no-slow-down)
:fail (new 'static 'resetter-spec :continue "desert-lizard-corral-snake-1" :reset-mode 'life :execute #f)
:retry (new 'static 'resetter-spec :continue #f :reset-mode 'try :execute #f)
)
)
((or (= v1-1 3) (= v1-1 4))
(new 'static 'resetter-params
:flags (resetter-flag auto-reset text-message no-audio no-slow-down)
:fail (new 'static 'resetter-spec :continue "desert-lizard-corral-snake-2" :reset-mode 'life :execute #f)
:retry (new 'static 'resetter-spec :continue #f :reset-mode 'try :execute #f)
)
)
)
)
)
(else
((method-of-type task-manager on-fail) this arg0)
)
)
)
(defmethod spawn-lizard ((this task-manager-desert-catch-lizards) (arg0 int))
(let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this manager-entity quat)))
(s5-0 (new 'stack-no-clear 'inline-array 'vector 2))
)
(vector-rotate-around-y! s4-0 s4-0 (* 9102.223 (the float (+ arg0 1))))
(vector+float*! (-> s5-0 0) (the-as vector (-> this corral-pos)) s4-0 40960.0)
(quaternion-rotate-y!
(the-as quaternion (-> s5-0 1))
*unity-quaternion*
(* 182.04445 (rand-vu-float-range -180.0 180.0))
)
(process-spawn flut :init flut-init (-> this manager-entity) s5-0 #f 0 'normal :name "flut" :to *entity-pool*)
)
)
(defmethod on-restart ((this task-manager-desert-catch-lizards))
(kill-by-type flut *active-pool*)
(let ((v1-2 (-> this manager-entity extra perm)))
(logior! (-> v1-2 status) (entity-perm-status bit-5))
(set! (-> v1-2 user-object 0) (the-as object 0))
)
0
(dotimes (s5-0 (-> this actor-group 0 length))
(toggle-status (-> this actor-group 0 data s5-0 actor) (entity-perm-status subtask-complete) #f)
)
0
(none)
)
;; WARN: Return type mismatch symbol vs none.
(defmethod task-manager-method-26 ((this task-manager-desert-catch-lizards))
(with-pp
(let ((t9-0 (method-of-type task-manager task-manager-method-26)))
(t9-0 this)
)
(let ((v1-2 (level-get *level* 'desertg)))
(when (or (not v1-2) (!= (-> v1-2 status) 'active) (not (-> v1-2 display?)))
(if (and *target* (not (focus-test? *target* disable dead)) (focus-test? *target* flut))
(send-event this 'fail)
(go (method-of-object this paused))
)
)
)
(when (zero? (-> this lizard-count))
(when (and (not (time-elapsed? (-> this hint-time) (seconds 10)))
(can-display-query? this "desert-lizard-task" -99.0)
)
(let ((s5-0
(new 'stack 'font-context *font-default-matrix* 40 300 0.0 (font-color default) (font-flags shadow kerning))
)
)
(set-width! s5-0 340)
(set-height! s5-0 60)
(set-scale! s5-0 0.6)
(set! (-> s5-0 flags) (font-flags shadow kerning middle-vert large))
(if (and *target* (focus-test? *target* flut))
(print-game-text
(lookup-text! *common-text* (text-id text-05e9) #f)
s5-0
#f
44
(bucket-id hud-draw-hud-alpha)
)
(print-game-text
(lookup-text! *common-text* (text-id text-05e8) #f)
s5-0
#f
44
(bucket-id hud-draw-hud-alpha)
)
)
)
)
(if (time-elapsed? (-> this hint-time) (seconds 120))
(set-time! (-> this hint-time))
)
)
(when (not (-> this manager-entity))
(set! (-> this manager-entity) (the-as entity-actor (entity-by-name "desert-lizard-manager-1")))
(let* ((sv-192 (new 'static 'res-tag))
(v1-46 (res-lump-data (-> this manager-entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-192)))
)
(cond
((and v1-46 (nonzero? (-> sv-192 elt-count)))
(set! (-> this actor-group) v1-46)
(set! (-> this actor-group-count) (the-as int (-> sv-192 elt-count)))
)
(else
(set! (-> this actor-group) (the-as (pointer actor-group) #f))
(set! (-> this actor-group-count) 0)
0
)
)
)
)
(when (-> this manager-entity)
(send-event (handle->process (-> this hud-counter)) 'force-show)
(let ((s5-1 0))
(dotimes (s4-2 (-> this actor-group 0 length))
(if (and (-> this actor-group 0 data s4-2) (let ((a1-16 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-16 from) (process->ppointer pp))
(set! (-> a1-16 num-params) 0)
(set! (-> a1-16 message) 'lizard)
(let ((t9-13 send-event-function)
(v1-69 (-> this actor-group 0 data s4-2 actor))
)
(t9-13
(if v1-69
(-> v1-69 extra process)
)
a1-16
)
)
)
)
(+! s5-1 1)
)
)
(if (and *target* (focus-test? *target* flut))
(+! s5-1 1)
)
(set! (-> this lizards-left) s5-1)
)
(set! (-> *game-info* score) (the float (-> this lizards-left)))
(let ((s3-0 (new 'stack-no-clear 'vector))
(s4-3 (the-as (array collide-shape) ((method-of-type array new)
(the-as symbol (new 'stack-no-clear 'array 'collide-shape 32))
array
collide-shape
32
)
)
)
(s5-2 0)
)
(vector-copy! s3-0 (-> this corral-pos))
(set! (-> s4-3 length) (fill-actor-list-for-box *actor-hash* s3-0 (-> s4-3 data) (-> s4-3 allocated-length)))
(dotimes (s3-1 (-> s4-3 length))
(if (type? (-> s4-3 s3-1 process) flut)
(+! s5-2 1)
)
)
(when (< (-> this lizard-count) s5-2)
(set-time! (-> this restart-time))
(set! (-> this lizard-count) s5-2)
(let ((v1-103 (-> this manager-entity extra perm)))
(logior! (-> v1-103 status) (entity-perm-status bit-5))
(set! (-> v1-103 user-object 0) (-> this lizard-count))
)
)
)
(set! (-> *game-info* counter) (the float (-> this lizard-count)))
(if (and *target*
(not (focus-test? *target* disable dead))
(let ((v1-111 *target*))
(or (and v1-111 (or (focus-test? v1-111 on-water under-water)
(= (-> v1-111 control ground-pat material) (pat-material waterbottom))
)
)
(and (focus-test? *target* flut) (< 3481600.0 (vector-vector-distance (target-pos 0) (-> this corral-pos))))
)
)
)
(send-event this 'fail)
)
)
(when *display-path-marks*
(let ((gp-1 *desertg-lizard-graph*))
(dotimes (s5-4 (-> gp-1 edge-count))
(let ((v1-127 (-> gp-1 edge s5-4)))
(add-debug-line
#t
(bucket-id debug-no-zbuf1)
(-> gp-1 point (-> v1-127 index 0))
(-> gp-1 point (-> v1-127 index 1))
*color-red*
#f
(the-as rgba -1)
)
)
)
)
)
(none)
)
)
(defmethod taskman-event-handler ((this task-manager-desert-catch-lizards) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (v0-0 object))
(case arg2
(('get-graph-table)
*desertg-lizard-graph*
)
(('enter)
(set! v0-0 #t)
(set! (-> this lizard-in-corral) (the-as symbol v0-0))
v0-0
)
(('got-lizard)
(set! v0-0 (current-time))
(set! (-> this hint-time) (the-as time-frame v0-0))
v0-0
)
(('restart)
(on-restart this)
((method-of-type task-manager taskman-event-handler) this arg0 arg1 arg2 arg3)
)
(('vehicle-info)
(set! (-> this vehicle-hit-points) (the-as float (-> arg3 param 0)))
(set! (-> this vehicle-turbo-count) (the-as float (-> arg3 param 1)))
)
(else
((method-of-type task-manager taskman-event-handler) this arg0 arg1 arg2 arg3)
)
)
)
(defmethod task-manager-method-25 ((this task-manager-desert-catch-lizards))
(if (nonzero? (-> this sound-id))
(set-action!
*gui-control*
(gui-action stop)
(-> this sound-id)
(gui-channel none)
(gui-action none)
(the-as string #f)
(the-as (function gui-connection symbol) #f)
(the-as process #f)
)
)
(when (and (nonzero? (-> this arrow-handle)) (-> this arrow-handle))
(send-event (handle->process (-> this arrow-handle)) 'leave)
(set! (-> this arrow-handle) (the-as handle #f))
)
((method-of-type task-manager task-manager-method-25) this)
(none)
)
;; WARN: Return type mismatch symbol vs none.
(defmethod set-time-limit ((this task-manager-desert-catch-lizards))
(let ((t9-0 (method-of-type task-manager set-time-limit)))
(t9-0 this)
)
(let ((t1-0 2))
(set-setting! 'vehicles 'set (shr t1-0 32) t1-0)
)
(set! (-> this lizard-count) 0)
(set! (-> this manager-entity) #f)
(set! (-> this sound-id) (new 'static 'sound-id))
(set! (-> this restart-time) 0)
(set-time! (-> this hint-time))
(set! (-> *game-info* counter) 0.0)
(set! (-> this corral-pos quad) (-> *minimap-class-list* 121 default-position quad))
(set! (-> this corral-pos r) 83968.0)
(set! (-> this vehicle-hit-points) 0.0)
(set! (-> this vehicle-turbo-count) 0.0)
(set! (-> this arrow-handle) (the-as handle #f))
(none)
)
(deftype kleever-catch-lizards (process-drawable)
((pad uint8 4)
)
(:state-methods
idle
)
)
(defstate idle (kleever-catch-lizards)
:virtual #t
:code (behavior ()
(until #f
(ja-no-eval :group! (-> self draw art-group data 10) :num! (seek!) :frame-num 0.0)
(until (ja-done? 0)
(suspend)
(ja :num! (seek!))
)
)
#f
)
:post ja-post
)
(defmethod init-from-entity! ((this kleever-catch-lizards) (arg0 entity-actor))
"Set up a newly created process from the entity that created it."
(let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))))
(let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0)))
(set! (-> s4-0 total-prims) (the-as uint 3))
(set! (-> s3-0 prim-core collide-as) (collide-spec obstacle))
(set! (-> s3-0 prim-core action) (collide-action solid no-standon))
(set-vector! (-> s3-0 local-sphere) 0.0 8192.0 0.0 9011.2)
(set! (-> s4-0 root-prim) s3-0)
)
(let ((v1-7 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
(set! (-> v1-7 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-7 prim-core action) (collide-action solid))
(set-vector! (-> v1-7 local-sphere) 0.0 4096.0 0.0 4096.0)
)
(let ((v1-9 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))))
(set! (-> v1-9 prim-core collide-as) (collide-spec obstacle))
(set! (-> v1-9 prim-core action) (collide-action solid no-standon))
(set-vector! (-> v1-9 local-sphere) 0.0 10240.0 0.0 4096.0)
)
(set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w)))
(let ((v1-12 (-> s4-0 root-prim)))
(set! (-> s4-0 backup-collide-as) (-> v1-12 prim-core collide-as))
(set! (-> s4-0 backup-collide-with) (-> v1-12 prim-core collide-with))
)
(set! (-> this root) s4-0)
)
(process-drawable-from-entity! this arg0)
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-kleever-highres" (the-as (pointer level) #f)))
(the-as pair 0)
)
(let ((a0-17 (-> this skel root-channel 0)))
(set! (-> a0-17 frame-group) (the-as art-joint-anim (-> this draw art-group data 10)))
(set! (-> a0-17 frame-num) 0.0)
(joint-control-channel-group!
a0-17
(the-as art-joint-anim (-> this draw art-group data 10))
num-func-identity
)
)
(transform-post)
(go (method-of-object this idle))
)
(deftype toad-catch-lizards (w-parking-spot)
()
)