Files
jak-project/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc
T
Tyler Wilding e975eab15a decompiler: Apply docstring indentation fix to all game versions (#3614)
Previously was only applying to game versions above Jak 2, Fixes #3342
2024-07-29 21:57:07 -04:00

1172 lines
44 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type elec-gate-params
(deftype elec-gate-params (structure)
((bolt-spec lightning-spec)
(ring-spec lightning-spec)
(ring-radius-min float)
(ring-radius-max float)
(speed-mult float)
)
)
;; definition for method 3 of type elec-gate-params
(defmethod inspect ((this elec-gate-params))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'elec-gate-params)
(format #t "~1Tbolt-spec: ~A~%" (-> this bolt-spec))
(format #t "~1Tring-spec: ~A~%" (-> this ring-spec))
(format #t "~1Tring-radius-min: ~f~%" (-> this ring-radius-min))
(format #t "~1Tring-radius-max: ~f~%" (-> this ring-radius-max))
(format #t "~1Tspeed-mult: ~f~%" (-> this speed-mult))
(label cfg-4)
this
)
;; definition of type elec-gate-bolt
(deftype elec-gate-bolt (structure)
((ring lightning-control 2)
(bolt lightning-control)
(ring-radius float)
(pos float)
)
)
;; definition for method 3 of type elec-gate-bolt
(defmethod inspect ((this elec-gate-bolt))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'elec-gate-bolt)
(format #t "~1Tring[2] @ #x~X~%" (-> this ring))
(format #t "~1Tbolt: ~A~%" (-> this bolt))
(format #t "~1Tring-radius: ~f~%" (-> this ring-radius))
(format #t "~1Tpos: ~f~%" (-> this pos))
(label cfg-4)
this
)
;; definition of type elec-wall
(deftype elec-wall (structure)
((pos vector :inline)
(dir vector :inline)
)
)
;; definition for method 3 of type elec-wall
(defmethod inspect ((this elec-wall))
(when (not this)
(set! this this)
(goto cfg-4)
)
(format #t "[~8x] ~A~%" this 'elec-wall)
(format #t "~1Tpos: #<vector @ #x~X>~%" (-> this pos))
(format #t "~1Tdir: #<vector @ #x~X>~%" (-> this dir))
(label cfg-4)
this
)
;; definition of type elec-gate
(deftype elec-gate (process-drawable)
((params elec-gate-params)
(path-l path-control :overlay-at path)
(path-r path-control)
(l-bolt elec-gate-bolt 5 :inline)
(part-on sparticle-launch-control :overlay-at part)
(part-off sparticle-launch-control)
(part-spawner-left part-spawner)
(part-spawner-right part-spawner)
(on-start pair)
(on-stop pair)
(dividing-wall elec-wall :inline)
(plane elec-wall 2 :inline)
(wall-y float)
(wall-xz float)
(lightning-quality float)
(quality-enabled? symbol)
)
(:state-methods
idle
active
shutdown
)
(:methods
(get-params (_type_) elec-gate-params)
(elec-gate-method-24 (_type_) none)
(set-palette! (_type_) none)
(set-state! (_type_) none)
(spawn-particles (_type_ sparticle-launch-control) none)
(set-elec-scale-if-close! (_type_ float) none)
(set-elec-scale! (_type_ float) none)
)
)
;; definition for method 3 of type elec-gate
(defmethod inspect ((this elec-gate))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 this)
)
(format #t "~2Tparams: #<elec-gate-params @ #x~X>~%" (-> this params))
(format #t "~2Tpath-l: ~A~%" (-> this path))
(format #t "~2Tpath-r: ~A~%" (-> this path-r))
(format #t "~2Tl-bolt[5] @ #x~X~%" (-> this l-bolt))
(format #t "~2Tpart-on: ~A~%" (-> this part))
(format #t "~2Tpart-off: ~A~%" (-> this part-off))
(format #t "~2Tpart-spawner-left: ~A~%" (-> this part-spawner-left))
(format #t "~2Tpart-spawner-right: ~A~%" (-> this part-spawner-right))
(format #t "~2Ton-start: ~A~%" (-> this on-start))
(format #t "~2Ton-stop: ~A~%" (-> this on-stop))
(format #t "~2Tdividing-wall: #<elec-wall @ #x~X>~%" (-> this dividing-wall))
(format #t "~2Tplane[2] @ #x~X~%" (-> this plane))
(format #t "~2Twall-y: ~f~%" (-> this wall-y))
(format #t "~2Twall-xz: ~f~%" (-> this wall-xz))
(format #t "~2Tlightning-quality: ~f~%" (-> this lightning-quality))
(format #t "~2Tquality-enabled?: ~A~%" (-> this quality-enabled?))
(label cfg-4)
this
)
;; definition for symbol *default-elec-gate-params*, type elec-gate-params
(define *default-elec-gate-params* (new 'static 'elec-gate-params
:bolt-spec (new 'static 'lightning-spec
:name #f
:flags (lightning-spec-flags lsf2)
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:end-color (new 'static 'rgba :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:fade-time 120.0
:texture (new 'static 'texture-id :index #x83 :page #xc)
:reduction 0.42
:num-points 16
:box-size 8601.6
:merge-factor 0.5
:merge-count 2
:radius 4096.0
:duration -1.0
:sound #f
)
:ring-spec (new 'static 'lightning-spec
:name #f
:flags (lightning-spec-flags lsf2)
:rand-func #x3
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:fade-time 120.0
:texture (new 'static 'texture-id :index #x83 :page #xc)
:reduction 0.42
:num-points 12
:box-size 3072.0
:merge-factor 0.5
:radius 2048.0
:duration -1.0
:sound #f
)
:ring-radius-min 1638.4
:ring-radius-max 2867.2
:speed-mult 1.0
)
)
;; definition for function elec-gate-post
;; INFO: Used lq/sq
(defbehavior elec-gate-post elec-gate ()
(local-vars (curr-bolt elec-gate-bolt) (curr-point int))
(let ((num-points (-> self params ring-spec num-points)))
(dotimes (bolt-idx 5)
(set! curr-bolt (-> self l-bolt bolt-idx))
(let ((s4-0
(get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp)
)
(s3-0
(get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp)
)
)
(let ((a0-2 (-> curr-bolt bolt))
(v1-10 s4-0)
)
(set! (-> a0-2 state meet data 0 quad) (-> v1-10 quad))
)
(let ((a0-5 (-> curr-bolt bolt))
(v1-13 s3-0)
)
(set! (-> a0-5 state meet data (+ (-> a0-5 state points-to-draw) -1) quad) (-> v1-13 quad))
)
(let ((s2-0 (-> curr-bolt ring 0))
(s1-0 (-> curr-bolt ring 1))
(s0-0 (new 'stack-no-clear 'vector))
)
(set! (-> s0-0 x) 0.0)
(set! (-> s0-0 y) 0.0)
(set! (-> s0-0 z) (-> curr-bolt ring-radius))
(set! (-> s0-0 w) 0.0)
(let ((f30-0 (* 65536.0 (/ 1.0 (the float (+ num-points -1))))))
(set! curr-point 0)
(while (< curr-point num-points)
(set-point! s2-0 curr-point (vector+! (new 'stack-no-clear 'vector) s4-0 s0-0))
(set-point! s1-0 curr-point (vector+! (new 'stack-no-clear 'vector) s3-0 s0-0))
(vector-rotate-y! s0-0 s0-0 f30-0)
(set! curr-point (+ curr-point 1))
)
)
)
)
)
)
(debug-draw (-> self path))
(debug-draw (-> self path-r))
(none)
)
;; failed to figure out what this is:
(defstate idle (elec-gate)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('trigger)
(go-virtual active)
)
)
)
:enter (behavior ()
(process-entity-status! self (entity-perm-status subtask-complete) #t)
(dotimes (bolt-idx 5)
(let* ((bolt (-> self l-bolt bolt-idx bolt))
(mode (lightning-mode lm0))
(mode-diff? (!= mode (-> bolt state mode)))
)
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> bolt state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> bolt state start-color) (-> bolt spec start-color))
(set! (-> bolt state end-color) (-> bolt spec end-color))
)
)
(set! (-> bolt state mode) mode)
(let ((first-ring (-> self l-bolt bolt-idx ring 0)))
(set! mode (lightning-mode lm0))
(set! mode-diff? (!= mode (-> first-ring state mode)))
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> first-ring state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> first-ring state start-color) (-> first-ring spec start-color))
(set! (-> first-ring state end-color) (-> first-ring spec end-color))
)
)
(set! (-> first-ring state mode) mode)
)
(let ((second-ring (-> self l-bolt bolt-idx ring 1)))
(set! mode (lightning-mode lm0))
(set! mode-diff? (!= mode (-> second-ring state mode)))
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> second-ring state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> second-ring state start-color) (-> second-ring spec start-color))
(set! (-> second-ring state end-color) (-> second-ring spec end-color))
)
)
(set! (-> second-ring state mode) mode)
)
)
)
)
:code sleep-code
:post (behavior ()
(set-elec-scale-if-close! self 0.0)
(if (nonzero? (-> self part-off))
(spawn-particles self (-> self part-off))
)
)
)
;; failed to figure out what this is:
(defstate active (elec-gate)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('shutdown)
(go-virtual shutdown)
)
)
)
:enter (behavior ()
(process-entity-status! self (entity-perm-status subtask-complete) #f)
(if (-> self on-start)
(script-eval (-> self on-start) :vector (-> self root trans))
)
(dotimes (bolt-idx 5)
(let* ((curr-bolt (-> self l-bolt bolt-idx bolt))
(mode (lightning-mode lm1))
(mode-diff? (!= mode (-> curr-bolt state mode)))
)
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> curr-bolt state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> curr-bolt state start-color) (-> curr-bolt spec start-color))
(set! (-> curr-bolt state end-color) (-> curr-bolt spec end-color))
)
)
(set! (-> curr-bolt state mode) mode)
(let ((first-ring (-> self l-bolt bolt-idx ring 0)))
(set! mode (lightning-mode lm1))
(set! mode-diff? (!= mode (-> first-ring state mode)))
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> first-ring state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> first-ring state start-color) (-> first-ring spec start-color))
(set! (-> first-ring state end-color) (-> first-ring spec end-color))
)
)
(set! (-> first-ring state mode) mode)
)
(let ((second-ring (-> self l-bolt bolt-idx ring 1)))
(set! mode (lightning-mode lm1))
(set! mode-diff? (!= mode (-> second-ring state mode)))
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> second-ring state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> second-ring state start-color) (-> second-ring spec start-color))
(set! (-> second-ring state end-color) (-> second-ring spec end-color))
)
)
(set! (-> second-ring state mode) mode)
)
)
)
(let ((vec-pair (new 'stack-no-clear 'inline-array 'vector 2)))
(dotimes (vec-idx 2)
(set! (-> vec-pair vec-idx quad) (the-as uint128 0))
)
(let ((s5-0 (new 'stack-no-clear 'vector)))
0.0
(get-point-in-path! (-> self path) (-> vec-pair 0) 0.0 'interp)
(get-point-in-path! (-> self path-r) (-> vec-pair 1) 0.0 'interp)
(vector-! s5-0 (-> vec-pair 1) (-> vec-pair 0))
(vector-normalize! s5-0 8192.0)
(vector+! (-> vec-pair 1) (-> vec-pair 1) s5-0)
(vector-negate! s5-0 s5-0)
(vector+! (-> vec-pair 0) (-> vec-pair 0) s5-0)
(vector-normalize-copy! s5-0 *up-vector* -8192.0)
(vector+! (-> vec-pair 0) (-> vec-pair 0) s5-0)
(vector+! (-> vec-pair 1) (-> vec-pair 1) s5-0)
)
(let ((f0-6
(+ (- 81920.0 (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) 0.0 'interp) y))
(-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (get-num-segments (-> self path)) 'interp)
y
)
)
)
)
(blocking-plane-spawn (the-as curve-control #f) vec-pair f0-6)
)
)
)
:trans (behavior ()
(local-vars
(sv-176
(function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker)
)
(sv-192 lightning-spec)
(sv-208 int)
(sv-224 symbol)
(sv-240 symbol)
(sv-256 lightning-spec)
(sv-272 int)
(sv-288 symbol)
(sv-304 symbol)
)
(let* ((target *target*)
(proc-focus (if (type? target process-focusable)
target
)
)
)
(when proc-focus
(let ((focus-trans (get-trans proc-focus 0)))
(let* ((a0-3 (vector-! (new 'stack-no-clear 'vector) focus-trans (the-as vector (-> self dividing-wall))))
(s4-0 (-> self plane (if (< 0.0 (vector-dot a0-3 (-> self dividing-wall dir)))
0
1
)
)
)
(s3-1 (vector-! (new 'stack-no-clear 'vector) focus-trans (-> s4-0 pos)))
)
(when (and (< (vector-dot (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-1 1.0) (-> s4-0 dir)) 0.0)
(let ((v1-13 s3-1))
(< (sqrtf (+ (* (-> v1-13 x) (-> v1-13 x)) (* (-> v1-13 z) (-> v1-13 z)))) (-> self wall-xz))
)
(< (fabs (-> s3-1 y)) (-> self wall-y))
)
(send-event
proc-focus
'attack
#f
(static-attack-info
((id (new-attack-id))
(vector (-> s4-0 dir))
(shove-back (meters 6))
(shove-up (meters 3))
(control (if (focus-test? proc-focus board)
1.0
0.0
)
)
)
)
)
(let* ((s4-1 (-> self l-bolt))
(s3-2 (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) (-> s4-1 0 pos) 'interp))
(s4-2
(get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> s4-1 0 pos) 'interp)
)
)
(let ((s2-0 (get-process *default-dead-pool* lightning-tracker #x4000)))
(when s2-0
(let ((t9-7 (method-of-type lightning-tracker activate)))
(t9-7
(the-as lightning-tracker s2-0)
*entity-pool*
(symbol->string (-> lightning-tracker symbol))
(the-as pointer #x70004000)
)
)
(let ((s1-0 run-function-in-process)
(s0-0 s2-0)
)
(set! sv-176 lightning-tracker-init)
(set! sv-192 (-> self params bolt-spec))
(set! sv-208 15)
(set! sv-224 (the-as symbol #f))
(set! sv-240 (the-as symbol #f))
(let ((t3-0 (get-trans proc-focus 3)))
((the-as (function object object object object object object object object none) s1-0)
s0-0
sv-176
sv-192
sv-208
sv-224
sv-240
s3-2
t3-0
)
)
)
(-> s2-0 ppointer)
)
)
(let ((s3-3 (get-process *default-dead-pool* lightning-tracker #x4000)))
(when s3-3
(let ((t9-11 (method-of-type lightning-tracker activate)))
(t9-11
(the-as lightning-tracker s3-3)
*entity-pool*
(symbol->string (-> lightning-tracker symbol))
(the-as pointer #x70004000)
)
)
(let ((s2-1 run-function-in-process)
(s1-1 s3-3)
(s0-1 lightning-tracker-init)
)
(set! sv-256 (-> self params bolt-spec))
(set! sv-272 15)
(set! sv-288 (the-as symbol #f))
(set! sv-304 (the-as symbol #f))
(let ((t3-1 (get-trans proc-focus 3)))
((the-as (function object object object object object object object object none) s2-1)
s1-1
s0-1
sv-256
sv-272
sv-288
sv-304
s4-2
t3-1
)
)
)
(-> s3-3 ppointer)
)
)
)
)
)
(set! (-> self lightning-quality)
(lerp-scale 0.0 1.0 (vector-vector-distance focus-trans (-> self root trans)) 491520.0 163840.0)
)
)
)
)
(let ((gp-2 (+ (the int (* 5.0 (-> self lightning-quality))) 1)))
(dotimes (bolt-idx 5)
(let ((s3-5 (-> self l-bolt bolt-idx))
(s2-2 (-> self params))
(s4-4 (if (and (-> self quality-enabled?) (zero? (mod bolt-idx gp-2)))
(lightning-mode lm0)
(lightning-mode lm-1)
)
)
)
(seek! (-> s3-5 pos) 1.5 (* (-> s2-2 speed-mult) (+ 0.2 (-> s3-5 pos)) (seconds-per-frame)))
(cond
((>= (-> s3-5 pos) 1.5)
(let ((v1-59 (-> self l-bolt bolt-idx bolt))
(a0-31 (logand s4-4 (lightning-mode lm1)))
)
(let ((a1-19 (!= a0-31 (-> v1-59 state mode))))
(case a0-31
(((lightning-mode lm3))
(if a1-19
(set! (-> v1-59 state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> v1-59 state start-color) (-> v1-59 spec start-color))
(set! (-> v1-59 state end-color) (-> v1-59 spec end-color))
)
)
)
(set! (-> v1-59 state mode) a0-31)
)
(let ((v1-62 (-> self l-bolt bolt-idx ring 0))
(a0-32 (logand s4-4 (lightning-mode lm1)))
)
(let ((a1-29 (!= a0-32 (-> v1-62 state mode))))
(case a0-32
(((lightning-mode lm3))
(if a1-29
(set! (-> v1-62 state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> v1-62 state start-color) (-> v1-62 spec start-color))
(set! (-> v1-62 state end-color) (-> v1-62 spec end-color))
)
)
)
(set! (-> v1-62 state mode) a0-32)
)
(let ((v1-65 (-> self l-bolt bolt-idx ring 1))
(a0-33 (logand s4-4 (lightning-mode lm1)))
)
(let ((a1-39 (!= a0-33 (-> v1-65 state mode))))
(case a0-33
(((lightning-mode lm3))
(if a1-39
(set! (-> v1-65 state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> v1-65 state start-color) (-> v1-65 spec start-color))
(set! (-> v1-65 state end-color) (-> v1-65 spec end-color))
)
)
)
(set! (-> v1-65 state mode) a0-33)
)
(set! (-> s3-5 ring-radius) (rand-vu-float-range (-> s2-2 ring-radius-min) (-> s2-2 ring-radius-max)))
(set! (-> s3-5 pos) 0.0)
)
((>= (-> s3-5 pos) 1.0)
(let ((v1-69 (-> self l-bolt bolt-idx bolt))
(a0-37 (logand (lightning-mode lm0) s4-4))
)
(let ((a1-50 (!= a0-37 (-> v1-69 state mode))))
(case a0-37
(((lightning-mode lm3))
(if a1-50
(set! (-> v1-69 state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> v1-69 state start-color) (-> v1-69 spec start-color))
(set! (-> v1-69 state end-color) (-> v1-69 spec end-color))
)
)
)
(set! (-> v1-69 state mode) a0-37)
)
(let ((v1-72 (-> self l-bolt bolt-idx ring 0))
(a0-38 (logand (lightning-mode lm0) s4-4))
)
(let ((a1-60 (!= a0-38 (-> v1-72 state mode))))
(case a0-38
(((lightning-mode lm3))
(if a1-60
(set! (-> v1-72 state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> v1-72 state start-color) (-> v1-72 spec start-color))
(set! (-> v1-72 state end-color) (-> v1-72 spec end-color))
)
)
)
(set! (-> v1-72 state mode) a0-38)
)
(let ((v1-75 (-> self l-bolt bolt-idx ring 1))
(a0-39 (logand (lightning-mode lm0) s4-4))
)
(let ((a1-70 (!= a0-39 (-> v1-75 state mode))))
(case a0-39
(((lightning-mode lm3))
(if a1-70
(set! (-> v1-75 state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> v1-75 state start-color) (-> v1-75 spec start-color))
(set! (-> v1-75 state end-color) (-> v1-75 spec end-color))
)
)
)
(set! (-> v1-75 state mode) a0-39)
)
)
)
)
)
)
)
:code sleep-code
:post (behavior ()
(set-elec-scale-if-close! self 1.0)
(if (nonzero? (-> self part))
(spawn-particles self (-> self part))
)
(update! (-> self sound))
(elec-gate-post)
)
)
;; failed to figure out what this is:
(defstate shutdown (elec-gate)
:virtual #t
:enter (behavior ()
(process-entity-status! self (entity-perm-status subtask-complete) #t)
(stop! (-> self sound))
(sound-play "elec-gate-off")
(blocking-plane-destroy)
(if (-> self on-stop)
(script-eval (-> self on-stop) :vector (-> self root trans))
)
)
:trans (behavior ()
(let ((go-idle? #t))
(dotimes (bolt-idx 5)
(let ((left-bolt-0 (-> self l-bolt bolt-idx)))
(seek! (-> left-bolt-0 pos) 0.0 (* (- 1.14 (-> left-bolt-0 pos)) (seconds-per-frame)))
(set! go-idle?
(cond
((or (< 1.0 (-> left-bolt-0 pos)) (>= 0.0 (-> left-bolt-0 pos)))
(let* ((left-bolt-1 (-> self l-bolt bolt-idx bolt))
(mode (lightning-mode lm3))
(mode-diff? (!= mode (-> left-bolt-1 state mode)))
)
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> left-bolt-1 state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> left-bolt-1 state start-color) (-> left-bolt-1 spec start-color))
(set! (-> left-bolt-1 state end-color) (-> left-bolt-1 spec end-color))
)
)
(set! (-> left-bolt-1 state mode) mode)
(let ((left-bolt-first-ring (-> self l-bolt bolt-idx ring 0)))
(set! mode (lightning-mode lm3))
(set! mode-diff? (!= mode (-> left-bolt-first-ring state mode)))
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> left-bolt-first-ring state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> left-bolt-first-ring state start-color) (-> left-bolt-first-ring spec start-color))
(set! (-> left-bolt-first-ring state end-color) (-> left-bolt-first-ring spec end-color))
)
)
(set! (-> left-bolt-first-ring state mode) mode)
)
(let ((left-bolt-second-ring (-> self l-bolt bolt-idx ring 1)))
(set! mode (lightning-mode lm3))
(set! mode-diff? (!= mode (-> left-bolt-second-ring state mode)))
(case mode
(((lightning-mode lm3))
(if mode-diff?
(set! (-> left-bolt-second-ring state counter) 0.0)
)
)
(((lightning-mode lm1))
(set! (-> left-bolt-second-ring state start-color) (-> left-bolt-second-ring spec start-color))
(set! (-> left-bolt-second-ring state end-color) (-> left-bolt-second-ring spec end-color))
)
)
(set! (-> left-bolt-second-ring state mode) mode)
)
)
go-idle?
)
(else
#f
)
)
)
)
)
(if go-idle?
(go-virtual idle)
)
)
)
:code sleep-code
:post (behavior ()
(set-elec-scale-if-close! self 0.0)
(if (nonzero? (-> self part-off))
(spawn-particles self (-> self part-off))
)
(elec-gate-post)
)
)
;; definition for method 28 of type elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-elec-scale-if-close! ((this elec-gate) (arg0 float))
"If [[target]]'s position is within `80` [[meters]], set the scale to the value provided
@see [[elec-gate::29]]"
(if (< (vector-vector-distance (-> this root trans) (target-pos 0)) 327680.0)
(set-elec-scale! this arg0)
)
0
(none)
)
;; definition for method 27 of type elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod spawn-particles ((this elec-gate) (sparticle-lc sparticle-launch-control))
"TODO - Calls [[sparticle-launch-control::11]] on `part-spawner-left` and `part-spawner-right` if they are defined"
(if (-> this part-spawner-left)
(spawn sparticle-lc (the-as vector (&-> (-> this part-spawner-left child) 8)))
)
(if (-> this part-spawner-right)
(spawn sparticle-lc (the-as vector (&-> (-> this part-spawner-right child) 8)))
)
0
(none)
)
;; definition for method 7 of type elec-gate
;; WARN: Return type mismatch process-drawable vs elec-gate.
(defmethod relocate ((this elec-gate) (new-addr int))
(dotimes (bolt-idx 5)
(let ((left-bolt (-> this l-bolt bolt-idx)))
(if (nonzero? (-> left-bolt bolt))
(&+! (-> left-bolt bolt) new-addr)
)
(if (nonzero? (-> left-bolt ring 0))
(&+! (-> left-bolt ring 0) new-addr)
)
(if (nonzero? (-> left-bolt ring 1))
(&+! (-> left-bolt ring 1) new-addr)
)
)
)
(if (nonzero? (-> this path-r))
(&+! (-> this path-r) new-addr)
)
(when (nonzero? (-> this part-off))
(if (nonzero? (-> this part-off))
(&+! (-> this part-off) new-addr)
)
)
(the-as elec-gate ((method-of-type process-drawable relocate) this new-addr))
)
;; definition for method 10 of type elec-gate
(defmethod deactivate ((this elec-gate))
"Make a process dead, clean it up, remove it from the active pool, and return to dead pool."
(set-elec-scale-if-close! this 0.0)
(call-parent-method this)
(none)
)
;; definition for method 23 of type elec-gate
(defmethod get-params ((this elec-gate))
"@returns [[*default-elec-gate-params*]] by default"
*default-elec-gate-params*
)
;; definition for method 24 of type elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod elec-gate-method-24 ((this elec-gate))
0
(none)
)
;; definition for method 25 of type elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-palette! ((this elec-gate))
"Sets the [[elec-gate]]'s `palette-id` appropriately"
0
(none)
)
;; definition for method 26 of type elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-state! ((this elec-gate))
"If either [[actor-option::17]] is set on the [[elec-gate]] or the related subtask is completed
make the gate `idle`.
Otherwise, the gate will be `active`."
(if (or (logtest? (actor-option user17) (-> this fact options))
(and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete)))
)
(go (method-of-object this idle))
(go (method-of-object this active))
)
0
(none)
)
;; definition for method 11 of type elec-gate
;; INFO: Used lq/sq
(defmethod init-from-entity! ((this elec-gate) (arg0 entity-actor))
"Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that.
This commonly includes things such as:
- stack size
- collision information
- loading the skeleton group / bones
- sounds"
(set! (-> this root) (new 'process 'trsqv))
(process-drawable-from-entity! this arg0)
(set! (-> this entity) arg0)
(set! (-> this fact)
(new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc))
)
(set! (-> this params) (get-params this))
(logclear! (-> this mask) (process-mask actor-pause))
(set! (-> this path) (new 'process 'path-control this 'pathl 0.0 (the-as entity #f) #f))
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
(set! (-> this path-r) (new 'process 'path-control this 'pathr 0.0 (the-as entity #f) #f))
(logior! (-> this path-r flags) (path-control-flag display draw-line draw-point draw-text))
(set! (-> this part-spawner-left) (the-as part-spawner (entity-actor-lookup arg0 'alt-actor 0)))
(set! (-> this part-spawner-right) (the-as part-spawner (entity-actor-lookup arg0 'alt-actor 1)))
(let ((params (-> this params)))
(dotimes (bolt-idx 5)
(let ((left-bolt (-> this l-bolt bolt-idx)))
(set! (-> left-bolt bolt) (new 'process 'lightning-control (-> params bolt-spec) this 0.0))
(set! (-> left-bolt ring 0) (new 'process 'lightning-control (-> params ring-spec) this 0.0))
(set! (-> left-bolt ring 1) (new 'process 'lightning-control (-> params ring-spec) this 0.0))
(set! (-> left-bolt ring-radius)
(rand-vu-float-range (-> params ring-radius-min) (-> params ring-radius-max))
)
(set! (-> left-bolt pos) (* 0.2 (the float bolt-idx)))
)
)
)
(let* ((s4-1 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) 0.0 'interp))
(v1-26 (get-point-in-path! (-> this path-r) (new 'stack-no-clear 'vector) 0.0 'interp))
(a1-15 (vector-! (new 'stack-no-clear 'vector) v1-26 s4-1))
(s5-3 (vector+float*! (new 'stack-no-clear 'vector) s4-1 a1-15 0.5))
(v1-28 (vector-normalize-copy! (new 'stack-no-clear 'vector) a1-15 1.0))
)
(vector-cross! v1-28 v1-28 *up-vector*)
(set! (-> this dividing-wall pos quad) (-> s5-3 quad))
(set! (-> this dividing-wall dir quad) (-> v1-28 quad))
(vector+float*! (the-as vector (-> this plane)) s5-3 v1-28 12288.0)
(set! (-> (the-as vector (-> this plane 0 dir)) quad) (-> v1-28 quad))
(vector-float*! v1-28 v1-28 -1.0)
(vector+float*! (the-as vector (-> this plane 1)) s5-3 v1-28 12288.0)
(set! (-> (the-as vector (-> this plane 1 dir)) quad) (-> v1-28 quad))
)
(set! (-> this wall-xz)
(vector-vector-distance
(get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) 0.0 'interp)
(get-point-in-path! (-> this path-r) (new 'stack-no-clear 'vector) 0.0 'interp)
)
)
(set! (-> this wall-xz) (* 0.5 (-> this wall-xz)))
(+! (-> this wall-xz) 4096.0)
(set! (-> this wall-y)
(fabs
(- (-> (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (get-num-segments (-> this path)) 'interp)
y
)
(-> (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) 0.0 'interp) y)
)
)
)
(+! (-> this wall-y) 4096.0)
(set! (-> this quality-enabled?) #t)
(set! (-> this lightning-quality) 1.0)
(set! (-> this sound)
(new 'process 'ambient-sound (static-sound-spec "electric-gate" :fo-max 70) (-> this root trans))
)
(set! (-> this on-start) (res-lump-struct (-> this entity) 'on-start pair))
(set! (-> this on-stop) (res-lump-struct (-> this entity) 'on-stop pair))
(elec-gate-method-24 this)
(set-palette! this)
(set-state! this)
(none)
)
;; definition of type fort-elec-gate
(deftype fort-elec-gate (elec-gate)
((palette-id int32)
)
)
;; definition for method 3 of type fort-elec-gate
(defmethod inspect ((this fort-elec-gate))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type elec-gate inspect)))
(t9-0 this)
)
(format #t "~2Tpalette-id: ~D~%" (-> this palette-id))
(label cfg-4)
this
)
;; definition for method 29 of type fort-elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-elec-scale! ((this fort-elec-gate) (scale float))
"Calls associated mood functions to set the scale with the value provided
@see mood-funcs
@see mood-funcs2"
(set-fordumpa-electricity-scale! scale)
(set-forresca-electricity-scale! scale (-> this palette-id))
(set-forrescb-electricity-scale! scale (-> this palette-id))
0
(none)
)
;; definition for method 25 of type fort-elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-palette! ((this fort-elec-gate))
"Sets the [[elec-gate]]'s `palette-id` appropriately"
(set! (-> this palette-id) (res-lump-value (-> this entity) 'extra-id int :time -1000000000.0))
0
(none)
)
;; definition of type drill-elec-gate
(deftype drill-elec-gate (elec-gate)
((palette-id int32)
)
)
;; definition for method 3 of type drill-elec-gate
(defmethod inspect ((this drill-elec-gate))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type elec-gate inspect)))
(t9-0 this)
)
(format #t "~2Tpalette-id: ~D~%" (-> this palette-id))
(label cfg-4)
this
)
;; definition for method 29 of type drill-elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-elec-scale! ((this drill-elec-gate) (arg0 float))
"Calls associated mood functions to set the scale with the value provided
@see mood-funcs
@see mood-funcs2"
(set-drill-electricity-scale! arg0 (-> this palette-id))
0
(none)
)
;; definition for method 25 of type drill-elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-palette! ((this drill-elec-gate))
"Sets the [[elec-gate]]'s `palette-id` appropriately"
(set! (-> this palette-id) (res-lump-value (-> this entity) 'extra-id int :time -1000000000.0))
0
(none)
)
;; definition of type caspad-elec-gate
(deftype caspad-elec-gate (elec-gate)
()
)
;; definition for method 3 of type caspad-elec-gate
(defmethod inspect ((this caspad-elec-gate))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type elec-gate inspect)))
(t9-0 this)
)
(label cfg-4)
this
)
;; definition of type castle-elec-gate
(deftype castle-elec-gate (elec-gate)
()
)
;; definition for method 3 of type castle-elec-gate
(defmethod inspect ((this castle-elec-gate))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type elec-gate inspect)))
(t9-0 this)
)
(label cfg-4)
this
)
;; definition for method 29 of type castle-elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-elec-scale! ((this castle-elec-gate) (arg0 float))
"Calls associated mood functions to set the scale with the value provided
@see mood-funcs
@see mood-funcs2"
(set-castle-electricity-scale! arg0)
0
(none)
)
;; definition for symbol *caspad-elec-gate-params*, type elec-gate-params
(define *caspad-elec-gate-params* (new 'static 'elec-gate-params
:bolt-spec (new 'static 'lightning-spec
:name #f
:flags (lightning-spec-flags lsf2)
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:end-color (new 'static 'rgba :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:fade-time 120.0
:texture (new 'static 'texture-id :index #x83 :page #xc)
:reduction 0.42
:num-points 16
:box-size 16793.6
:merge-factor 0.5
:merge-count 2
:radius 18841.6
:duration -1.0
:sound #f
)
:ring-spec (new 'static 'lightning-spec
:name #f
:flags (lightning-spec-flags lsf2)
:rand-func #x3
:start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:end-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)
:fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5)
:fade-start-factor 0.2
:fade-time 120.0
:texture (new 'static 'texture-id :index #x83 :page #xc)
:reduction 0.42
:num-points 12
:box-size 17408.0
:merge-factor 0.5
:merge-count 2
:radius 17612.8
:duration -1.0
:sound #f
)
:ring-radius-min 40960.0
:ring-radius-max 53248.0
:speed-mult 0.3
)
)
;; definition for method 23 of type caspad-elec-gate
(defmethod get-params ((this caspad-elec-gate))
"@returns [[*default-elec-gate-params*]] by default"
*caspad-elec-gate-params*
)
;; definition of type palroof-elec-gate
(deftype palroof-elec-gate (elec-gate)
((palette-id int32)
)
)
;; definition for method 3 of type palroof-elec-gate
(defmethod inspect ((this palroof-elec-gate))
(when (not this)
(set! this this)
(goto cfg-4)
)
(let ((t9-0 (method-of-type elec-gate inspect)))
(t9-0 this)
)
(format #t "~2Tpalette-id: ~D~%" (-> this palette-id))
(label cfg-4)
this
)
;; definition for method 29 of type palroof-elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-elec-scale! ((this palroof-elec-gate) (arg0 float))
"Calls associated mood functions to set the scale with the value provided
@see mood-funcs
@see mood-funcs2"
(set-palroof-electricity-scale! arg0 (-> this palette-id))
0
(none)
)
;; definition for method 25 of type palroof-elec-gate
;; WARN: Return type mismatch int vs none.
(defmethod set-palette! ((this palroof-elec-gate))
"Sets the [[elec-gate]]'s `palette-id` appropriately"
(set! (-> this palette-id) (res-lump-value (-> this entity) 'extra-id int :time -1000000000.0))
0
(none)
)