2022-06-30 01:22:51 -04:00
|
|
|
;;-*-Lisp-*-
|
|
|
|
(in-package goal)
|
|
|
|
|
|
|
|
;; name: forresca-obs.gc
|
|
|
|
;; name in dgo: forresca-obs
|
|
|
|
;; dgos: FRA
|
|
|
|
|
2022-08-05 16:12:54 -04:00
|
|
|
;; DECOMP BEGINS
|
|
|
|
|
2023-01-31 18:32:50 -05:00
|
|
|
(defun fortress-login ()
|
|
|
|
(set! *nav-network* (new 'loading-level 'nav-network))
|
|
|
|
(nav-network-method-9 *nav-network*)
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun fortress-deactivate ()
|
|
|
|
(set! *nav-network* (the-as nav-network 0))
|
|
|
|
0
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defun fortress-activate ((arg0 level))
|
|
|
|
(nav-network-method-10 *nav-network* arg0 *fortress-adjacency*)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype fort-elec-button (cty-guard-turret-button)
|
|
|
|
((start-up? symbol :offset-assert 288)
|
|
|
|
)
|
|
|
|
:heap-base #xb0
|
|
|
|
:method-count-assert 41
|
|
|
|
:size-assert #x124
|
|
|
|
:flag-assert #x2900b00124
|
|
|
|
(:methods
|
|
|
|
(waiting () _type_ :state 40)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
(defskelgroup skel-fort-elec-button cty-guard-turret-button cty-guard-turret-button-lod0-jg cty-guard-turret-button-idle-ja
|
|
|
|
((cty-guard-turret-button-lod0-mg (meters 999999)))
|
|
|
|
:bounds (static-spherem 0 0 0 3)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate waiting (fort-elec-button)
|
|
|
|
:virtual #t
|
|
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
|
|
(case event-type
|
|
|
|
(('trigger)
|
|
|
|
(go-virtual pop-up)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
:code (the-as (function none :behavior fort-elec-button) sleep-code)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod basebutton-method-33 fort-elec-button ((obj fort-elec-button))
|
|
|
|
"TODO - joint stuff"
|
|
|
|
(initialize-skeleton
|
|
|
|
obj
|
|
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-fort-elec-button" (the-as (pointer uint32) #f)))
|
|
|
|
(the-as pair 0)
|
|
|
|
)
|
|
|
|
(ja-channel-set! 1)
|
|
|
|
(cond
|
|
|
|
((-> obj start-up?)
|
|
|
|
(let ((a0-4 (-> obj skel root-channel 0)))
|
|
|
|
(set! (-> a0-4 frame-group) (the-as art-joint-anim (-> obj draw art-group data 3)))
|
|
|
|
(set! (-> a0-4 frame-num)
|
|
|
|
(the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 3)) frames num-frames) -1))
|
|
|
|
)
|
|
|
|
(joint-control-channel-group! a0-4 (the-as art-joint-anim (-> obj draw art-group data 3)) num-func-identity)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
(let ((a0-5 (-> obj skel root-channel 0)))
|
|
|
|
(set! (-> a0-5 frame-group) (the-as art-joint-anim (-> obj draw art-group data 3)))
|
|
|
|
(set! (-> a0-5 frame-num) 0.0)
|
|
|
|
(joint-control-channel-group! a0-5 (the-as art-joint-anim (-> obj draw art-group data 3)) num-func-identity)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(transform-post)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; WARN: Return type mismatch process-mask vs none.
|
|
|
|
(defmethod prepare-trigger-event! fort-elec-button ((obj fort-elec-button))
|
|
|
|
"Sets `event-going-down` to `'trigger`"
|
|
|
|
(set! (-> obj start-up?) (= 1 (res-lump-value (-> obj entity) 'extra-id uint :time -1000000000.0)))
|
|
|
|
(set! (-> obj event-going-down) 'trigger)
|
|
|
|
(process-entity-status! obj (entity-perm-status no-kill) #t)
|
|
|
|
(logclear! (-> obj mask) (process-mask actor-pause))
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod idle-state-transition fort-elec-button ((obj fort-elec-button))
|
|
|
|
"If `button-status` has [[button-status:0]] set, transition to [[basebutton::27]] otherwise, [[basebutton::30]]"
|
|
|
|
(cond
|
|
|
|
((-> obj start-up?)
|
|
|
|
(let ((s5-0 (-> obj skel root-channel 0)))
|
|
|
|
(joint-control-channel-group-eval!
|
|
|
|
s5-0
|
|
|
|
(the-as art-joint-anim (-> obj draw art-group data 2))
|
|
|
|
num-func-identity
|
|
|
|
)
|
|
|
|
(set! (-> s5-0 frame-num) 0.0)
|
|
|
|
)
|
|
|
|
(go (method-of-object obj up-idle))
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
(go (method-of-object obj waiting))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype fort-led (process-drawable)
|
|
|
|
((button-actor entity-actor :offset-assert 200)
|
|
|
|
)
|
|
|
|
:heap-base #x50
|
|
|
|
:method-count-assert 22
|
|
|
|
:size-assert #xcc
|
|
|
|
:flag-assert #x16005000cc
|
|
|
|
(:methods
|
|
|
|
(red () _type_ :state 20)
|
|
|
|
(green () _type_ :state 21)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
(defskelgroup skel-fort-led fort-led fort-led-lod0-jg fort-led-idle-ja
|
|
|
|
((fort-led-lod0-mg (meters 999999)))
|
|
|
|
:bounds (static-spherem 0 0 0 4)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate red (fort-led)
|
|
|
|
:virtual #t
|
|
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
|
|
(case event-type
|
|
|
|
(('trigger)
|
|
|
|
(go-virtual green)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
:code (behavior ()
|
|
|
|
(setup-masks (-> self draw) 4 2)
|
|
|
|
(ja-post)
|
|
|
|
(sleep-code)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate green (fort-led)
|
|
|
|
:virtual #t
|
|
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
|
|
(case event-type
|
|
|
|
(('untrigger)
|
|
|
|
(go-virtual red)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
:code (behavior ()
|
|
|
|
(setup-masks (-> self draw) 2 4)
|
|
|
|
(ja-post)
|
|
|
|
(sleep-code)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
;; WARN: Return type mismatch object vs none.
|
|
|
|
(defmethod init-from-entity! fort-led ((obj fort-led) (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! (-> obj root) (new 'process 'trsqv))
|
|
|
|
(process-drawable-from-entity! obj arg0)
|
|
|
|
(initialize-skeleton
|
|
|
|
obj
|
|
|
|
(the-as skeleton-group (art-group-get-by-name *level* "skel-fort-led" (the-as (pointer uint32) #f)))
|
|
|
|
(the-as pair 0)
|
|
|
|
)
|
|
|
|
(set! (-> obj button-actor) (entity-actor-lookup arg0 'alt-actor 0))
|
|
|
|
(if (and (-> obj button-actor)
|
|
|
|
(logtest? (-> obj button-actor extra perm status) (entity-perm-status subtask-complete))
|
|
|
|
)
|
|
|
|
(go (method-of-object obj green))
|
|
|
|
(go (method-of-object obj red))
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(deftype elec-lock-gate (fort-elec-gate)
|
|
|
|
((actor-group (pointer actor-group) :offset-assert 516)
|
|
|
|
(actor-group-count int32 :offset-assert 520)
|
|
|
|
(all-gone? symbol :offset-assert 524)
|
|
|
|
)
|
|
|
|
:heap-base #x190
|
|
|
|
:method-count-assert 32
|
|
|
|
:size-assert #x210
|
|
|
|
:flag-assert #x2001900210
|
|
|
|
(:methods
|
|
|
|
(pre-shutdown () _type_ :state 30)
|
|
|
|
(elec-lock-gate-method-31 (_type_ symbol) symbol 31)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
(defstate active (elec-lock-gate)
|
|
|
|
:virtual #t
|
|
|
|
:event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block))
|
|
|
|
(case event-type
|
|
|
|
(('trigger)
|
|
|
|
(if (elec-lock-gate-method-31 self (the-as symbol proc))
|
|
|
|
(go-virtual pre-shutdown)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
((-> (method-of-type elec-gate active) event) proc arg1 event-type event)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate pre-shutdown (elec-lock-gate)
|
|
|
|
:virtual #t
|
|
|
|
:trans (-> (method-of-type elec-lock-gate active) trans)
|
|
|
|
:code (behavior ()
|
|
|
|
(let ((a0-0 *target*))
|
|
|
|
(when (and a0-0 (< 81920.0 (vector-vector-distance (get-trans a0-0 0) (-> self root trans))))
|
|
|
|
(set! (-> self quality-enabled?) #f)
|
|
|
|
(let ((gp-1 (-> self clock frame-counter)))
|
|
|
|
(until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5))
|
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(hide-hud-quick #f)
|
|
|
|
(set-setting! 'entity-name "camera-243" 0 0)
|
|
|
|
(set-setting! 'process-mask 'set 0 (process-mask movie enemy))
|
|
|
|
(process-grab? *target* #f)
|
|
|
|
(let ((gp-2 (-> self clock frame-counter)))
|
|
|
|
(until (>= (- (-> self clock frame-counter) gp-2) (seconds 2))
|
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(go-virtual shutdown)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
:post (-> (method-of-type elec-lock-gate active) post)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defstate shutdown (elec-lock-gate)
|
|
|
|
:virtual #t
|
|
|
|
:enter (behavior ()
|
|
|
|
(let ((t9-1 (-> (the-as state (find-parent-method elec-lock-gate 22)) enter)))
|
|
|
|
(if t9-1
|
|
|
|
((the-as (function none) t9-1))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> self all-gone?) #f)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
:trans (behavior ()
|
|
|
|
(let ((gp-0 #t))
|
|
|
|
(dotimes (s5-0 5)
|
|
|
|
(let ((s4-0 (-> self l-bolt s5-0)))
|
|
|
|
(seek! (-> s4-0 pos) 0.0 (* (- 1.14 (-> s4-0 pos)) (-> self clock seconds-per-frame)))
|
|
|
|
(set! gp-0 (cond
|
|
|
|
((or (< 1.0 (-> s4-0 pos)) (>= 0.0 (-> s4-0 pos)))
|
|
|
|
(let ((v1-9 (-> self l-bolt s5-0 bolt))
|
|
|
|
(a0-1 3)
|
|
|
|
)
|
|
|
|
(let ((a1-2 (!= a0-1 (-> v1-9 state mode))))
|
|
|
|
(case a0-1
|
|
|
|
((3)
|
|
|
|
(if a1-2
|
|
|
|
(set! (-> v1-9 state counter) 0.0)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
((1)
|
|
|
|
(set! (-> v1-9 state start-color) (-> v1-9 spec start-color))
|
|
|
|
(set! (-> v1-9 state end-color) (-> v1-9 spec end-color))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> v1-9 state mode) (the-as lightning-mode a0-1))
|
|
|
|
)
|
|
|
|
(let ((v1-12 (-> self l-bolt s5-0 ring 0))
|
|
|
|
(a0-2 3)
|
|
|
|
)
|
|
|
|
(let ((a1-12 (!= a0-2 (-> v1-12 state mode))))
|
|
|
|
(case a0-2
|
|
|
|
((3)
|
|
|
|
(if a1-12
|
|
|
|
(set! (-> v1-12 state counter) 0.0)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
((1)
|
|
|
|
(set! (-> v1-12 state start-color) (-> v1-12 spec start-color))
|
|
|
|
(set! (-> v1-12 state end-color) (-> v1-12 spec end-color))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> v1-12 state mode) (the-as lightning-mode a0-2))
|
|
|
|
)
|
|
|
|
(let ((v1-15 (-> self l-bolt s5-0 ring 1))
|
|
|
|
(a0-3 3)
|
|
|
|
)
|
|
|
|
(let ((a1-22 (!= a0-3 (-> v1-15 state mode))))
|
|
|
|
(case a0-3
|
|
|
|
((3)
|
|
|
|
(if a1-22
|
|
|
|
(set! (-> v1-15 state counter) 0.0)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
((1)
|
|
|
|
(set! (-> v1-15 state start-color) (-> v1-15 spec start-color))
|
|
|
|
(set! (-> v1-15 state end-color) (-> v1-15 spec end-color))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> v1-15 state mode) (the-as lightning-mode a0-3))
|
|
|
|
)
|
|
|
|
gp-0
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
#f
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set! (-> self all-gone?) gp-0)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
:code (behavior ()
|
|
|
|
(until (-> self all-gone?)
|
|
|
|
(let ((gp-0 (-> self clock frame-counter)))
|
|
|
|
(until (>= (- (-> self clock frame-counter) gp-0) (seconds 0.5))
|
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(set-setting! 'interp-time 'abs 0 0)
|
|
|
|
(remove-setting! 'entity-name)
|
|
|
|
(remove-setting! 'process-mask)
|
|
|
|
(dotimes (gp-1 2)
|
|
|
|
(suspend)
|
|
|
|
)
|
|
|
|
(remove-setting! 'interp-time)
|
|
|
|
(process-release? *target*)
|
|
|
|
(go-virtual idle)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod elec-lock-gate-method-31 elec-lock-gate ((obj elec-lock-gate) (arg0 symbol))
|
|
|
|
(dotimes (v1-0 (-> obj actor-group-count))
|
|
|
|
(dotimes (a2-0 (-> obj actor-group v1-0 length))
|
|
|
|
(when (or (not arg0) (let ((a3-5 (-> obj actor-group v1-0 data a2-0 actor)))
|
|
|
|
(!= (if a3-5
|
|
|
|
(-> a3-5 extra process)
|
|
|
|
)
|
|
|
|
arg0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(if (not (logtest? (-> obj actor-group v1-0 data a2-0 actor extra perm status) (entity-perm-status subtask-complete))
|
|
|
|
)
|
|
|
|
(return #f)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
#t
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod set-state! elec-lock-gate ((obj elec-lock-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 (elec-lock-gate-method-31 obj #f)
|
|
|
|
(go (method-of-object obj shutdown))
|
|
|
|
((method-of-type fort-elec-gate set-state!) obj)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|
|
|
|
|
|
|
|
(defmethod set-palette! elec-lock-gate ((obj elec-lock-gate))
|
|
|
|
"Sets the [[elec-gate]]'s `palette-id` appropriately"
|
|
|
|
(local-vars (sv-16 res-tag))
|
|
|
|
(let ((t9-0 (method-of-type fort-elec-gate set-palette!)))
|
|
|
|
(t9-0 obj)
|
|
|
|
)
|
|
|
|
(logclear! (-> obj mask) (process-mask actor-pause))
|
|
|
|
(set! sv-16 (new 'static 'res-tag))
|
|
|
|
(let ((v1-4 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16))))
|
|
|
|
(cond
|
|
|
|
((and v1-4 (nonzero? (-> sv-16 elt-count)))
|
|
|
|
(set! (-> obj actor-group) (the-as (pointer actor-group) v1-4))
|
|
|
|
(set! (-> obj actor-group-count) (the-as int (-> sv-16 elt-count)))
|
|
|
|
)
|
|
|
|
(else
|
|
|
|
(set! (-> obj actor-group) (the-as (pointer actor-group) #f))
|
|
|
|
(set! (-> obj actor-group-count) 0)
|
|
|
|
0
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(none)
|
|
|
|
)
|