mirror of
https://github.com/open-goal/jak-project
synced 2026-05-28 08:25:56 -04:00
ea93d32acc
- `pat-h` - `engines` - `res-h` - `res` - `fact-h` - `game-info-h` - `wind-h` - `merc-h` - `shadow-vu1-h` - `shadow-cpu-h` - `dynamics-h` - `memcard-h` - `surface-h` - part of `gui-h` - `ambient-h` - `speech-h` - `prototype-h` - `smush-control-h` - `generic-merc-h` - `generic-work-h` - `collide-func-h` - `collide-mesh-h` - `collide-shape-h` (only missing the `new` method for `collide-shape` because we don't have `process-drawable` yet and that also needs joint stuff etc.) - `collide-touch-h` - `collide-edge-grab-h` - `lightning-h` This also adds argument name remaps for the `relocate` and `mem-usage` methods (Jak 1 and 2 ref tests were updated, but not the gsrc).
852 lines
29 KiB
Common Lisp
Vendored
Generated
852 lines
29 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type battlecontroller-spawner
|
|
(deftype battlecontroller-spawner (structure)
|
|
((path path-control)
|
|
(creature handle)
|
|
(trigger-actor entity-actor)
|
|
(blocker-actor entity-actor)
|
|
(state int8)
|
|
(enabled symbol)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type battlecontroller-spawner
|
|
(defmethod inspect ((this battlecontroller-spawner))
|
|
(format #t "[~8x] ~A~%" this 'battlecontroller-spawner)
|
|
(format #t "~Tpath: ~A~%" (-> this path))
|
|
(format #t "~Tcreature: ~D~%" (-> this creature))
|
|
(format #t "~Ttrigger-actor: ~A~%" (-> this trigger-actor))
|
|
(format #t "~Tblocker-actor: ~A~%" (-> this blocker-actor))
|
|
(format #t "~Tstate: ~D~%" (-> this state))
|
|
(format #t "~Tenabled: ~A~%" (-> this enabled))
|
|
this
|
|
)
|
|
|
|
;; definition of type battlecontroller-creature-type
|
|
(deftype battlecontroller-creature-type (structure)
|
|
((type2 type)
|
|
(percent float)
|
|
(pickup-percent float)
|
|
(pickup-type pickup-type)
|
|
(max-pickup-count int8)
|
|
(pickup-count int8)
|
|
)
|
|
:allow-misaligned
|
|
)
|
|
|
|
;; definition for method 3 of type battlecontroller-creature-type
|
|
(defmethod inspect ((this battlecontroller-creature-type))
|
|
(format #t "[~8x] ~A~%" this 'battlecontroller-creature-type)
|
|
(format #t "~Ttype2: ~A~%" (-> this type2))
|
|
(format #t "~Tpercent: ~f~%" (-> this percent))
|
|
(format #t "~Tpickup-percent: ~f~%" (-> this pickup-percent))
|
|
(format #t "~Tpickup-type: ~D~%" (-> this pickup-type))
|
|
(format #t "~Tmax-pickup-count: ~D~%" (-> this max-pickup-count))
|
|
(format #t "~Tpickup-count: ~D~%" (-> this pickup-count))
|
|
this
|
|
)
|
|
|
|
;; definition of type battlecontroller
|
|
(deftype battlecontroller (process-drawable)
|
|
((final-pickup-spawn-point vector :inline)
|
|
(activate-distance float)
|
|
(max-spawn-count int16)
|
|
(spawn-count int16)
|
|
(die-count int16)
|
|
(target-count int8)
|
|
(spawner-count int8)
|
|
(creature-type-count int8)
|
|
(spawner-array battlecontroller-spawner 8 :inline)
|
|
(spawn-period time-frame)
|
|
(path-spawn path-control)
|
|
(creature-type-array battlecontroller-creature-type 4 :inline)
|
|
(final-pickup-type pickup-type)
|
|
(prespawn symbol)
|
|
(noticed-player symbol)
|
|
(camera-on symbol)
|
|
(misty-ambush-collision-hack symbol)
|
|
(disable-ocean symbol)
|
|
(disable-near-ocean symbol)
|
|
(disable-mid-ocean symbol)
|
|
)
|
|
(:methods
|
|
(battlecontroller-method-20 () none)
|
|
(battlecontroller-idle () _type_ :state)
|
|
(battlecontroller-play-intro-camera () _type_ :state)
|
|
(battlecontroller-method-23 () none)
|
|
(battlecontroller-active () _type_ :state)
|
|
(battlecontroller-method-25 () none)
|
|
(battlecontroller-die () _type_ :state)
|
|
(battlecontroller-method-27 (_type_) none)
|
|
(cleanup-if-finished! (_type_) none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type battlecontroller
|
|
(defmethod inspect ((this battlecontroller))
|
|
(let ((t9-0 (method-of-type process-drawable inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tfinal-pickup-spawn-point: #<vector @ #x~X>~%" (-> this final-pickup-spawn-point))
|
|
(format #t "~T~Tactivate-distance: ~f~%" (-> this activate-distance))
|
|
(format #t "~T~Tmax-spawn-count: ~D~%" (-> this max-spawn-count))
|
|
(format #t "~T~Tspawn-count: ~D~%" (-> this spawn-count))
|
|
(format #t "~T~Tdie-count: ~D~%" (-> this die-count))
|
|
(format #t "~T~Ttarget-count: ~D~%" (-> this target-count))
|
|
(format #t "~T~Tspawner-count: ~D~%" (-> this spawner-count))
|
|
(format #t "~T~Tcreature-type-count: ~D~%" (-> this creature-type-count))
|
|
(format #t "~T~Tspawner-array[8] @ #x~X~%" (-> this spawner-array))
|
|
(format #t "~T~Tspawn-period: ~D~%" (-> this spawn-period))
|
|
(format #t "~T~Tpath-spawn: ~A~%" (-> this path-spawn))
|
|
(format #t "~T~Tcreature-type-array[4] @ #x~X~%" (-> this creature-type-array))
|
|
(format #t "~T~Tfinal-pickup-type: ~D~%" (-> this final-pickup-type))
|
|
(format #t "~T~Tprespawn: ~A~%" (-> this prespawn))
|
|
(format #t "~T~Tnoticed-player: ~A~%" (-> this noticed-player))
|
|
(format #t "~T~Tcamera-on: ~A~%" (-> this camera-on))
|
|
(format #t "~T~Tmisty-ambush-collision-hack: ~A~%" (-> this misty-ambush-collision-hack))
|
|
(format #t "~T~Tdisable-ocean: ~A~%" (-> this disable-ocean))
|
|
(format #t "~T~Tdisable-near-ocean: ~A~%" (-> this disable-near-ocean))
|
|
(format #t "~T~Tdisable-mid-ocean: ~A~%" (-> this disable-mid-ocean))
|
|
this
|
|
)
|
|
|
|
;; definition for function battlecontroller-spawners-full?
|
|
(defbehavior battlecontroller-spawners-full? battlecontroller ()
|
|
(dotimes (v1-0 (-> self spawner-count))
|
|
(if (= (-> self spawner-array v1-0 creature) #f)
|
|
(return #f)
|
|
)
|
|
)
|
|
#t
|
|
)
|
|
|
|
;; definition for function battlecontroller-default-event-handler
|
|
;; INFO: Used lq/sq
|
|
(defbehavior battlecontroller-default-event-handler battlecontroller ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('child-die)
|
|
(+! (-> self die-count) 1)
|
|
(when (= (-> self die-count) (-> self max-spawn-count))
|
|
(let ((v1-4 (the-as process-drawable arg0)))
|
|
(when v1-4
|
|
(set! (-> self final-pickup-spawn-point quad) (-> v1-4 root trans quad))
|
|
(case (-> self final-pickup-type)
|
|
(((pickup-type fuel-cell))
|
|
#f
|
|
)
|
|
(else
|
|
(set! (-> v1-4 fact pickup-type) (-> self final-pickup-type))
|
|
(set! (-> v1-4 fact pickup-amount) 1.0)
|
|
(set! (-> v1-4 fact pickup-spawn-amount) 0.0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(('trigger)
|
|
(go-virtual battlecontroller-die)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
battlecontroller-default-event-handler
|
|
|
|
;; definition for function battlecontroller-draw-debug
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-draw-debug battlecontroller ()
|
|
(dotimes (gp-0 (-> self spawner-count))
|
|
(debug-draw (-> self spawner-array gp-0 path))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-camera-on
|
|
;; INFO: Return type mismatch int vs object.
|
|
(defbehavior battlecontroller-camera-on battlecontroller ()
|
|
(when (not (-> self camera-on))
|
|
(set! (-> self camera-on) #t)
|
|
(let ((v1-4 (res-lump-struct (-> self entity) 'camera-name structure)))
|
|
(if v1-4
|
|
(send-event *camera* 'change-to-entity-by-name v1-4)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
)
|
|
|
|
;; definition for function battlecontroller-camera-off
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-camera-off battlecontroller ()
|
|
(set! (-> self camera-on) #f)
|
|
(send-event *camera* 'clear-entity)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-update-spawners
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-update-spawners battlecontroller ()
|
|
(dotimes (gp-0 (-> self spawner-count))
|
|
(let* ((s5-0 (-> self spawner-array gp-0))
|
|
(s4-0 (handle->process (-> s5-0 creature)))
|
|
)
|
|
(when (and s4-0 (logtest? (-> (the-as nav-enemy s4-0) nav-enemy-flags) (nav-enemy-flags navenmf11)))
|
|
(cond
|
|
((< (-> s5-0 state) (-> s5-0 path curve num-cverts))
|
|
(when (or (-> self noticed-player) (= (-> s5-0 state) 1))
|
|
(let ((s3-0 (new 'stack-no-clear 'vector)))
|
|
(eval-path-curve-div! (-> s5-0 path) s3-0 (the float (-> s5-0 state)) 'interp)
|
|
(send-event s4-0 'cue-jump-to-point s3-0)
|
|
)
|
|
(if (not (logtest? (-> (the-as nav-enemy s4-0) nav-enemy-flags) (nav-enemy-flags navenmf11)))
|
|
(+! (-> s5-0 state) 1)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(send-event s4-0 'cue-chase)
|
|
(set! (-> s5-0 creature) (the-as handle #f))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-spawn-creature
|
|
;; INFO: Return type mismatch int vs handle.
|
|
(defbehavior battlecontroller-spawn-creature battlecontroller ((arg0 vector) (arg1 vector))
|
|
(local-vars (v1-25 pickup-type))
|
|
(let ((f0-0 (rand-vu))
|
|
(v1-0 0)
|
|
)
|
|
(dotimes (a0-1 (-> self creature-type-count))
|
|
(when (>= f0-0 0.0)
|
|
(set! f0-0 (- f0-0 (-> self creature-type-array a0-1 percent)))
|
|
(if (< f0-0 0.0)
|
|
(set! v1-0 a0-1)
|
|
)
|
|
)
|
|
)
|
|
(let* ((s5-0 (-> self creature-type-array v1-0))
|
|
(s2-0 (-> s5-0 type2))
|
|
(s1-0 (the-as nav-enemy (get-process *default-dead-pool* s2-0 #x4000)))
|
|
(gp-0 (when s1-0
|
|
(let ((t9-2 (method-of-type process activate)))
|
|
(t9-2 s1-0 self s2-0 (the-as pointer #x70004000))
|
|
)
|
|
(run-now-in-process s1-0 nav-enemy-init-by-other self arg0 arg1)
|
|
(-> s1-0 ppointer)
|
|
)
|
|
)
|
|
)
|
|
(if (and gp-0 (zero? (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info)))
|
|
(set! gp-0 (the-as (pointer process) #f))
|
|
)
|
|
(when (the-as (pointer nav-enemy) gp-0)
|
|
(logclear! (-> (the-as (pointer nav-enemy) gp-0) 0 mask) (process-mask actor-pause))
|
|
(if (-> self misty-ambush-collision-hack)
|
|
(logior! (-> (the-as (pointer nav-enemy) gp-0) 0 nav-enemy-flags) (nav-enemy-flags navenmf15))
|
|
)
|
|
(+! (-> self spawn-count) 1)
|
|
(-> self fact pickup-type)
|
|
(cond
|
|
((and (< (-> s5-0 pickup-count) (-> s5-0 max-pickup-count)) (rand-vu-percent? (-> s5-0 pickup-percent)))
|
|
(+! (-> s5-0 pickup-count) 1)
|
|
(set! v1-25 (-> s5-0 pickup-type))
|
|
)
|
|
(else
|
|
(set! v1-25 (-> self fact pickup-type))
|
|
)
|
|
)
|
|
(set! (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info pickup-type) v1-25)
|
|
(cond
|
|
((= v1-25 (pickup-type eco-pill))
|
|
)
|
|
((= v1-25 (pickup-type none))
|
|
(set! (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info pickup-amount) 0.0)
|
|
(set! (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info pickup-spawn-amount) 0.0)
|
|
)
|
|
(else
|
|
(set! (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info pickup-amount) 1.0)
|
|
(set! (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info pickup-spawn-amount) 0.0)
|
|
(logior! (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info options) (fact-options fade))
|
|
(set! (-> (the-as (pointer nav-enemy) gp-0) 0 enemy-info fade-time) (seconds 4))
|
|
)
|
|
)
|
|
)
|
|
(the-as handle (ppointer->handle gp-0))
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for function battlecontroller-spawn-creature-at-spawner
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-spawn-creature-at-spawner battlecontroller ((arg0 int) (arg1 int))
|
|
(let* ((s5-0 (-> self spawner-array arg0))
|
|
(s3-0 (-> s5-0 path))
|
|
(s4-0 (eval-path-curve-div! s3-0 (new 'stack-no-clear 'vector) (the float arg1) 'interp))
|
|
(a1-3 (eval-path-curve-div! s3-0 (new 'stack-no-clear 'vector) (the float (+ arg1 1)) 'interp))
|
|
)
|
|
(when (and (not (handle->process (-> s5-0 creature))) (< (-> self spawn-count) (-> self max-spawn-count)))
|
|
(let ((v1-10 (battlecontroller-spawn-creature s4-0 a1-3)))
|
|
(when (handle->process v1-10)
|
|
(set! (-> s5-0 creature) v1-10)
|
|
(set! (-> s5-0 state) (+ arg1 1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-spawn-creature-random-spawner
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-spawn-creature-random-spawner battlecontroller ()
|
|
(let* ((gp-0 (rand-vu-int-count (-> self spawner-count)))
|
|
(v1-2 (-> self spawner-array gp-0))
|
|
)
|
|
(when (and (-> v1-2 enabled) (-> v1-2 blocker-actor))
|
|
(when (logtest? (-> v1-2 blocker-actor extra perm status) (entity-perm-status complete))
|
|
(set! (-> v1-2 enabled) #f)
|
|
(let ((a0-9 0))
|
|
(dotimes (a1-0 (-> self spawner-count))
|
|
(if (-> self spawner-array a1-0 enabled)
|
|
(+! a0-9 1)
|
|
)
|
|
)
|
|
(if (zero? a0-9)
|
|
(set! (-> self spawn-count) (-> self max-spawn-count))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (and (-> v1-2 enabled) (not (handle->process (-> v1-2 creature))))
|
|
(let ((a1-7 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-7 from) self)
|
|
(set! (-> a1-7 num-params) 0)
|
|
(set! (-> a1-7 message) 'spawn)
|
|
(let ((t9-1 send-event-function)
|
|
(v1-3 (-> v1-2 trigger-actor))
|
|
)
|
|
(t9-1
|
|
(if v1-3
|
|
(-> v1-3 extra process)
|
|
)
|
|
a1-7
|
|
)
|
|
)
|
|
)
|
|
(battlecontroller-spawn-creature-at-spawner gp-0 0)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-fill-all-spawners
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-fill-all-spawners battlecontroller ()
|
|
(dotimes (gp-0 (-> self spawner-count))
|
|
(battlecontroller-spawn-creature-at-spawner gp-0 1)
|
|
)
|
|
(when (nonzero? (-> self path-spawn))
|
|
(let ((gp-1 (new 'stack-no-clear 'vector)))
|
|
(dotimes (s5-0 (-> self path-spawn curve num-cverts))
|
|
(eval-path-curve-div! (-> self path-spawn) gp-1 (the float s5-0) 'interp)
|
|
(let ((s4-0 (battlecontroller-spawn-creature gp-1 (-> self root trans))))
|
|
(when (handle->process s4-0)
|
|
(suspend)
|
|
(send-event (handle->process s4-0) 'cue-chase)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-battle-begin
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-battle-begin battlecontroller ()
|
|
(set-setting! 'music 'danger 0.0 0)
|
|
(let ((gp-0 (entity-actor-count (-> self entity) 'kill-actor)))
|
|
(dotimes (s5-0 gp-0)
|
|
(let ((v1-2 (entity-actor-lookup (-> self entity) 'kill-actor s5-0)))
|
|
(if v1-2
|
|
(logior! (-> v1-2 extra perm status) (entity-perm-status bit-9))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((gp-1 (entity-actor-count (-> self entity) 'trigger-actor)))
|
|
(dotimes (s5-1 gp-1)
|
|
(let ((s4-0 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> s4-0 from) self)
|
|
(set! (-> s4-0 num-params) 0)
|
|
(set! (-> s4-0 message) 'trigger)
|
|
(let ((s3-0 send-event-function)
|
|
(v1-7 (entity-actor-lookup (-> self entity) 'trigger-actor s5-1))
|
|
)
|
|
(s3-0
|
|
(if v1-7
|
|
(-> v1-7 extra process)
|
|
)
|
|
s4-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(level-hint-spawn (text-id zero) (the-as string #f) (-> self entity) *entity-pool* (game-task none))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-off
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-off battlecontroller ()
|
|
(remove-setting! 'music)
|
|
(let ((gp-0 (entity-actor-count (-> self entity) 'kill-actor)))
|
|
(dotimes (s5-0 gp-0)
|
|
(let ((v1-2 (entity-actor-lookup (-> self entity) 'kill-actor s5-0)))
|
|
(if v1-2
|
|
(logclear! (-> v1-2 extra perm status) (entity-perm-status bit-9))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-battle-end
|
|
(defbehavior battlecontroller-battle-end battlecontroller ()
|
|
(case (-> (level-get-target-inside *level*) name)
|
|
(('citadel)
|
|
(level-hint-spawn (text-id citadel-battle-end) "sksp0378" (the-as entity #f) *entity-pool* (game-task none))
|
|
)
|
|
)
|
|
(battlecontroller-off)
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate battlecontroller-idle (battlecontroller)
|
|
:virtual #t
|
|
:event battlecontroller-default-event-handler
|
|
:trans (behavior ()
|
|
0
|
|
)
|
|
:code (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(if (-> self prespawn)
|
|
(battlecontroller-fill-all-spawners)
|
|
)
|
|
(loop
|
|
(when (time-elapsed? (-> self state-time) (seconds 0.1))
|
|
(set-time! (-> self state-time))
|
|
(when (and *target*
|
|
(>= (-> self activate-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans)))
|
|
)
|
|
(set! (-> self noticed-player) #t)
|
|
(battlecontroller-battle-begin)
|
|
(when (not (-> self prespawn))
|
|
(battlecontroller-fill-all-spawners)
|
|
(suspend)
|
|
0
|
|
)
|
|
(go-virtual battlecontroller-play-intro-camera)
|
|
)
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
:post #f
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate battlecontroller-play-intro-camera (battlecontroller)
|
|
:virtual #t
|
|
:event battlecontroller-default-event-handler
|
|
:enter (behavior ()
|
|
(process-entity-status! self (entity-perm-status bit-3) #t)
|
|
)
|
|
:exit (behavior ()
|
|
(process-entity-status! self (entity-perm-status bit-3) #f)
|
|
)
|
|
:code (behavior ()
|
|
(go-virtual battlecontroller-active)
|
|
)
|
|
)
|
|
|
|
;; definition for function battlecontroller-disable-ocean
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-disable-ocean battlecontroller ()
|
|
(set! *ocean-off* (-> self disable-ocean))
|
|
(set! *ocean-mid-off* (-> self disable-mid-ocean))
|
|
(set! *ocean-near-off* (-> self disable-near-ocean))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate battlecontroller-active (battlecontroller)
|
|
:virtual #t
|
|
:event battlecontroller-default-event-handler
|
|
:trans (behavior ()
|
|
(if (and *target*
|
|
(>= (-> self activate-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans)))
|
|
)
|
|
(level-hint-spawn (text-id zero) (the-as string #f) (-> self entity) *entity-pool* (game-task none))
|
|
)
|
|
(battlecontroller-disable-ocean)
|
|
(battlecontroller-update-spawners)
|
|
)
|
|
:code (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(battlecontroller-camera-on)
|
|
(loop
|
|
(when (time-elapsed? (-> self state-time) (seconds 0.1))
|
|
(set-time! (-> self state-time))
|
|
(let ((gp-0 0))
|
|
(let ((v1-8 (-> self child)))
|
|
(while v1-8
|
|
(+! gp-0 1)
|
|
(set! v1-8 (-> v1-8 0 brother))
|
|
(nop!)
|
|
(nop!)
|
|
)
|
|
)
|
|
(if (and (zero? gp-0) (= (-> self spawn-count) (-> self max-spawn-count)))
|
|
(go-virtual battlecontroller-die)
|
|
)
|
|
(when (< gp-0 (-> self target-count))
|
|
(let ((gp-1 (current-time)))
|
|
(until (time-elapsed? gp-1 (-> self spawn-period))
|
|
(suspend)
|
|
)
|
|
)
|
|
(battlecontroller-spawn-creature-random-spawner)
|
|
)
|
|
)
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
:post #f
|
|
)
|
|
|
|
;; definition for function battlecontroller-special-contents?
|
|
(defbehavior battlecontroller-special-contents? battlecontroller ()
|
|
(= (-> self final-pickup-type) (pickup-type fuel-cell))
|
|
)
|
|
|
|
;; definition for function battlecontroller-special-contents-collected?
|
|
(defbehavior battlecontroller-special-contents-collected? battlecontroller ()
|
|
(= (-> self entity extra perm user-int8 0) 2)
|
|
)
|
|
|
|
;; definition for function battlecontroller-set-special-contents-collected
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-set-special-contents-collected battlecontroller ()
|
|
(let ((v1-2 (-> self entity extra perm)))
|
|
(logior! (-> v1-2 status) (entity-perm-status user-set-from-cstage))
|
|
(set! (-> v1-2 user-int8 0) 2)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for function battlecontroller-task-completed?
|
|
(defbehavior battlecontroller-task-completed? battlecontroller ()
|
|
(>= (-> self entity extra perm user-int8 0) 1)
|
|
)
|
|
|
|
;; definition for function battlecontroller-set-task-completed
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defbehavior battlecontroller-set-task-completed battlecontroller ()
|
|
(let ((v1-2 (-> self entity extra perm)))
|
|
(logior! (-> v1-2 status) (entity-perm-status user-set-from-cstage))
|
|
(set! (-> v1-2 user-int8 0) 1)
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate battlecontroller-die (battlecontroller)
|
|
:virtual #t
|
|
:event process-drawable-fuel-cell-handler
|
|
:code (behavior ()
|
|
(sound-play "money-pickup" :pitch -1.5 :position #f)
|
|
(battlecontroller-battle-end)
|
|
(battlecontroller-camera-off)
|
|
(battlecontroller-set-task-completed)
|
|
(countdown (gp-1 (entity-actor-count (-> self entity) 'fade-actor))
|
|
(let ((s5-1 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> s5-1 from) self)
|
|
(set! (-> s5-1 num-params) 0)
|
|
(set! (-> s5-1 message) 'fade)
|
|
(let ((s4-0 send-event-function)
|
|
(v1-2 (entity-actor-lookup (-> self entity) 'fade-actor gp-1))
|
|
)
|
|
(s4-0
|
|
(if v1-2
|
|
(-> v1-2 extra process)
|
|
)
|
|
s5-1
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(countdown (gp-2 (entity-actor-count (-> self entity) 'alt-actor))
|
|
(let ((s5-2 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> s5-2 from) self)
|
|
(set! (-> s5-2 num-params) 0)
|
|
(set! (-> s5-2 message) 'trigger)
|
|
(let ((s4-1 send-event-function)
|
|
(v1-8 (entity-actor-lookup (-> self entity) 'alt-actor gp-2))
|
|
)
|
|
(s4-1
|
|
(if v1-8
|
|
(-> v1-8 extra process)
|
|
)
|
|
s5-2
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(when (and (battlecontroller-special-contents?) (not (battlecontroller-special-contents-collected?)))
|
|
(label cfg-15)
|
|
(birth-pickup-at-point
|
|
(-> self final-pickup-spawn-point)
|
|
(-> self final-pickup-type)
|
|
(the float (-> self entity extra perm task))
|
|
#f
|
|
self
|
|
(the-as fact-info #f)
|
|
)
|
|
(when (not (-> self child))
|
|
(suspend)
|
|
(goto cfg-15)
|
|
)
|
|
(while (-> self child)
|
|
(suspend)
|
|
)
|
|
(battlecontroller-set-special-contents-collected)
|
|
)
|
|
(while (-> self child)
|
|
(suspend)
|
|
)
|
|
(process-entity-status! self (entity-perm-status dead) #t)
|
|
)
|
|
:post #f
|
|
)
|
|
|
|
;; definition for method 7 of type battlecontroller
|
|
(defmethod relocate ((this battlecontroller) (offset int))
|
|
(dotimes (v1-0 (-> this spawner-count))
|
|
(let ((a0-3 (-> this spawner-array v1-0)))
|
|
(if (nonzero? (-> a0-3 path))
|
|
(&+! (-> a0-3 path) offset)
|
|
)
|
|
)
|
|
)
|
|
(if (nonzero? (-> this path-spawn))
|
|
(&+! (-> this path-spawn) offset)
|
|
)
|
|
(call-parent-method this offset)
|
|
)
|
|
|
|
;; definition for method 10 of type battlecontroller
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defmethod deactivate ((this battlecontroller))
|
|
(with-pp
|
|
(let ((gp-0 pp))
|
|
(set! pp this)
|
|
(battlecontroller-off)
|
|
(set! pp gp-0)
|
|
)
|
|
(call-parent-method this)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 27 of type battlecontroller
|
|
;; INFO: Used lq/sq
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defmethod battlecontroller-method-27 ((this battlecontroller))
|
|
(local-vars (sv-16 res-tag))
|
|
(set! (-> this fact)
|
|
(new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc))
|
|
)
|
|
(set! (-> this path) (new 'process 'path-control this 'path 0.0))
|
|
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
|
|
(set! (-> this activate-distance) 122880.0)
|
|
(let ((s5-0 0))
|
|
(let* ((s4-0 '(patha pathb pathc pathd pathe pathf pathg pathh))
|
|
(s2-0 (car s4-0))
|
|
)
|
|
(while (not (null? s4-0))
|
|
(let ((v1-7 (res-lump-struct (-> this entity) (the-as symbol s2-0) structure))
|
|
(s3-0 (-> this spawner-array s5-0))
|
|
)
|
|
(when (and v1-7 (< s5-0 8))
|
|
(set! (-> s3-0 path) (new 'process 'path-control this (the-as symbol s2-0) 0.0))
|
|
(set! (-> s3-0 creature) (the-as handle #f))
|
|
(set! (-> s3-0 trigger-actor) #f)
|
|
(set! (-> s3-0 blocker-actor) #f)
|
|
(set! (-> s3-0 enabled) #t)
|
|
(logior! (-> s3-0 path flags) (path-control-flag display draw-line draw-point draw-text))
|
|
(+! s5-0 1)
|
|
)
|
|
)
|
|
(set! s4-0 (cdr s4-0))
|
|
(set! s2-0 (car s4-0))
|
|
)
|
|
)
|
|
(set! (-> this spawner-count) s5-0)
|
|
)
|
|
0
|
|
(if (res-lump-struct (-> this entity) 'pathspawn structure)
|
|
(set! (-> this path-spawn) (new 'process 'path-control this 'pathspawn 0.0))
|
|
)
|
|
(let ((s5-1 (entity-actor-count (-> this entity) 'spawner-trigger-actor)))
|
|
(dotimes (s4-1 s5-1)
|
|
(if (< s4-1 (-> this spawner-count))
|
|
(set! (-> this spawner-array s4-1 trigger-actor)
|
|
(entity-actor-lookup (-> this entity) 'spawner-trigger-actor s4-1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((s5-2 (entity-actor-count (-> this entity) 'spawner-blocker-actor)))
|
|
(dotimes (s4-2 s5-2)
|
|
(if (< s4-2 (-> this spawner-count))
|
|
(set! (-> this spawner-array s4-2 blocker-actor)
|
|
(entity-actor-lookup (-> this entity) 'spawner-blocker-actor s4-2)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this spawn-period)
|
|
(the-as time-frame (the int (* 300.0 (res-lump-float (-> this entity) 'delay :default 0.1))))
|
|
)
|
|
(set! (-> this target-count) 10)
|
|
(set! (-> this max-spawn-count) 100)
|
|
(set! (-> this spawn-count) 0)
|
|
(set! (-> this die-count) 0)
|
|
(set! (-> this creature-type-count) 1)
|
|
(set! (-> this noticed-player) #f)
|
|
(set! (-> this camera-on) #f)
|
|
(let ((v1-46 (res-lump-data (-> this entity) 'num-lurkers (pointer int32))))
|
|
(when v1-46
|
|
(set! (-> this target-count) (-> v1-46 0))
|
|
(set! (-> this max-spawn-count) (-> v1-46 1))
|
|
)
|
|
)
|
|
(set! (-> this creature-type-array 0 type2) babak)
|
|
(set! (-> this creature-type-array 0 percent) 1.0)
|
|
(let ((s5-3 0))
|
|
(set! sv-16 (new 'static 'res-tag))
|
|
(let ((v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16))))
|
|
(when v1-49
|
|
(dotimes (a0-22 (the-as int (-> sv-16 elt-count)))
|
|
(let ((a1-15 (-> (the-as (pointer uint32) (&+ v1-49 (* a0-22 4))))))
|
|
(when (nonzero? a1-15)
|
|
(set! (-> this creature-type-array s5-3 type2) (the-as type a1-15))
|
|
(+! s5-3 1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this creature-type-count) s5-3)
|
|
)
|
|
(let ((v1-52 (res-lump-data (-> this entity) 'percent pointer))
|
|
(f0-6 0.0)
|
|
)
|
|
(when v1-52
|
|
(dotimes (a0-26 (-> this creature-type-count))
|
|
(set! (-> this creature-type-array a0-26 percent) (fabs (-> (the-as (pointer float) (&+ v1-52 (* a0-26 4))))))
|
|
(+! f0-6 (-> this creature-type-array a0-26 percent))
|
|
)
|
|
(cond
|
|
((= f0-6 0.0)
|
|
(set! (-> this creature-type-count) 1)
|
|
(set! (-> this creature-type-array 0 percent) 1.0)
|
|
)
|
|
(else
|
|
(let ((f0-9 (/ 1.0 f0-6)))
|
|
(dotimes (v1-57 (-> this creature-type-count))
|
|
(set! (-> this creature-type-array 0 percent) (* (-> this creature-type-array 0 percent) f0-9))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this final-pickup-type)
|
|
(res-lump-value (-> this entity) 'final-pickup pickup-type :default (the-as uint128 7))
|
|
)
|
|
(let ((s5-4 (res-lump-data (-> this entity) 'pickup-type pointer))
|
|
(s4-3 (res-lump-data (-> this entity) 'max-pickup-count pointer))
|
|
(v1-63 (res-lump-data (-> this entity) 'pickup-percent pointer))
|
|
)
|
|
(dotimes (a0-34 (-> this creature-type-count))
|
|
(let ((a1-34 (-> this creature-type-array a0-34)))
|
|
(set! (-> a1-34 pickup-count) 0)
|
|
(if s5-4
|
|
(set! (-> a1-34 pickup-type) (the-as pickup-type (-> (the-as (pointer int32) (&+ s5-4 (* a0-34 4))))))
|
|
)
|
|
(if s4-3
|
|
(set! (-> a1-34 max-pickup-count) (-> (the-as (pointer int32) (&+ s4-3 (* a0-34 4)))))
|
|
)
|
|
(if v1-63
|
|
(set! (-> a1-34 pickup-percent) (-> (the-as (pointer float) (&+ v1-63 (* a0-34 4)))))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this misty-ambush-collision-hack) #f)
|
|
(set! (-> this disable-ocean) #f)
|
|
(set! (-> this disable-mid-ocean) #f)
|
|
(set! (-> this disable-near-ocean) #t)
|
|
(set! (-> this final-pickup-spawn-point quad) (-> this root trans quad))
|
|
(set! (-> this prespawn) (= (res-lump-value (-> this entity) 'mode uint128) 1))
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 28 of type battlecontroller
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defmethod cleanup-if-finished! ((this battlecontroller))
|
|
(if (battlecontroller-task-completed?)
|
|
(go (method-of-object this battlecontroller-die))
|
|
(go (method-of-object this battlecontroller-idle))
|
|
)
|
|
0
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 11 of type battlecontroller
|
|
(defmethod init-from-entity! ((this battlecontroller) (arg0 entity-actor))
|
|
(logior! (-> this mask) (process-mask enemy))
|
|
(set! (-> this root) (new 'process 'trsqv))
|
|
(process-drawable-from-entity! this arg0)
|
|
(battlecontroller-method-27 this)
|
|
(cleanup-if-finished! this)
|
|
(none)
|
|
)
|