mirror of
https://github.com/open-goal/jak-project
synced 2026-06-11 13:10:44 -04:00
c162c66118
This PR does two main things: 1. Work through the main low-hanging fruit issues in the formatter keeping it from feeling mature and usable 2. Iterate and prove that point by formatting all of the Jak 1 code base. **This has removed around 100K lines in total.** - The decompiler will now format it's results for jak 1 to keep things from drifting back to where they were. This is controlled by a new config flag `format_code`. How am I confident this hasn't broken anything?: - I compiled the entire project and stored it's `out/jak1/obj` files separately - I then recompiled the project after formatting and wrote a script that md5's each file and compares it (`compare-compilation-outputs.py` - The results (eventually) were the same:  > This proves that the only difference before and after is non-critical whitespace for all code/macros that is actually in use. I'm still aware of improvements that could be made to the formatter, as well as general optimization of it's performance. But in general these are for rare or non-critical situations in my opinion and I'll work through them before doing Jak 2. The vast majority looks great and is working properly at this point. Those known issues are the following if you are curious: 
494 lines
22 KiB
Common Lisp
494 lines
22 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
(bundles "CIT.DGO" "MIS.DGO" "SWA.DGO")
|
|
(require "engine/common-obs/babak.gc")
|
|
|
|
;; DECOMP BEGINS
|
|
|
|
(deftype battlecontroller-spawner (structure)
|
|
((path path-control)
|
|
(creature handle)
|
|
(trigger-actor entity-actor)
|
|
(blocker-actor entity-actor)
|
|
(state int8)
|
|
(enabled symbol)))
|
|
|
|
(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)
|
|
|
|
(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)))
|
|
|
|
(defbehavior battlecontroller-spawners-full? battlecontroller ()
|
|
(dotimes (v1-0 (-> self spawner-count))
|
|
(if (= (-> self spawner-array v1-0 creature) #f) (return #f)))
|
|
#t)
|
|
|
|
(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))))
|
|
|
|
battlecontroller-default-event-handler
|
|
|
|
(defbehavior battlecontroller-draw-debug battlecontroller ()
|
|
(dotimes (gp-0 (-> self spawner-count))
|
|
(debug-draw (-> self spawner-array gp-0 path)))
|
|
0
|
|
(none))
|
|
|
|
(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)
|
|
|
|
(defbehavior battlecontroller-camera-off battlecontroller ()
|
|
(set! (-> self camera-on) #f)
|
|
(send-event *camera* 'clear-entity)
|
|
0
|
|
(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))
|
|
|
|
(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)))))
|
|
|
|
(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))
|
|
|
|
(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))
|
|
|
|
(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))
|
|
|
|
(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))
|
|
|
|
(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))
|
|
|
|
(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))
|
|
|
|
(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)
|
|
|
|
(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)))
|
|
|
|
(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))
|
|
|
|
(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)
|
|
|
|
(defbehavior battlecontroller-special-contents? battlecontroller ()
|
|
(= (-> self final-pickup-type) (pickup-type fuel-cell)))
|
|
|
|
(defbehavior battlecontroller-special-contents-collected? battlecontroller ()
|
|
(= (-> self entity extra perm user-int8 0) 2))
|
|
|
|
(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))
|
|
|
|
(defbehavior battlecontroller-task-completed? battlecontroller ()
|
|
(>= (-> self entity extra perm user-int8 0) 1))
|
|
|
|
(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))
|
|
|
|
(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)
|
|
|
|
(defmethod relocate ((this battlecontroller) (arg0 int))
|
|
(dotimes (v1-0 (-> this spawner-count))
|
|
(let ((a0-3 (-> this spawner-array v1-0))) (if (nonzero? (-> a0-3 path)) (&+! (-> a0-3 path) arg0))))
|
|
(if (nonzero? (-> this path-spawn)) (&+! (-> this path-spawn) arg0))
|
|
(call-parent-method this arg0))
|
|
|
|
(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)))
|
|
|
|
(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))
|
|
|
|
(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))
|
|
|
|
(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))
|