Files
water111 637990314b wip: better stack var support (#4222)
Closes #736

---------

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

491 lines
15 KiB
Common Lisp
Vendored
Generated

;;-*-Lisp-*-
(in-package goal)
;; definition of type basebutton
(deftype basebutton (process-focusable)
((button-status button-status)
(notify-actor entity)
(actor-group (pointer actor-group))
(actor-group-count int32)
(timeout float)
(button-id int32)
(event-going-down symbol)
(event-down symbol)
(event-going-up symbol)
(event-up symbol)
(anim-speed float)
(move-to-pos vector :inline)
(move-to-quat quaternion :inline)
)
(:state-methods
down-idle
going-down
going-up
up-idle
)
(:methods
(init! (_type_) none)
(idle-state-transition (_type_) object)
(init-skel-and-ja! (_type_) none)
(init-collision! (_type_) none)
(prepare-trigger-event! (_type_) none)
(send-event! (_type_ symbol) none)
(move-to! (_type_ vector quaternion) none)
(press! (_type_ symbol) entity-perm-status)
)
)
;; definition for method 3 of type basebutton
(defmethod inspect ((this basebutton))
(when (not this)
(set! this this)
(goto cfg-7)
)
(let ((t9-0 (method-of-type process-focusable inspect)))
(t9-0 this)
)
(format #t "~2Tbutton-status: ~D~%" (-> this button-status))
(format #t "~2Tnotify-actor: ~A~%" (-> this notify-actor))
(format #t "~2Tactor-group: #x~X~%" (-> this actor-group))
(dotimes (s5-0 (-> this actor-group-count))
(format #t "~T [~D]~2Tactor-group: ~`actor-group`P~%" s5-0 (-> this actor-group s5-0))
)
(format #t "~2Tactor-group-count: ~D~%" (-> this actor-group-count))
(format #t "~2Ttimeout: ~f~%" (-> this timeout))
(format #t "~2Tbutton-id: ~D~%" (-> this button-id))
(format #t "~2Tevent-going-down: ~A~%" (-> this event-going-down))
(format #t "~2Tevent-down: ~A~%" (-> this event-down))
(format #t "~2Tevent-going-up: ~A~%" (-> this event-going-up))
(format #t "~2Tevent-up: ~A~%" (-> this event-up))
(format #t "~2Tanim-speed: ~f~%" (-> this anim-speed))
(format #t "~2Tmove-to-pos: #<vector @ #x~X>~%" (-> this move-to-pos))
(format #t "~2Tmove-to-quat: #<quaternion @ #x~X>~%" (-> this move-to-quat))
(label cfg-7)
this
)
;; failed to figure out what this is:
(defskelgroup skel-generic-button mtn-dice-button 0 3 ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3))
;; definition for method 38 of type basebutton
;; INFO: Used lq/sq
;; WARN: Return type mismatch int vs none.
(defmethod move-to! ((this basebutton) (arg0 vector) (arg1 quaternion))
(logclear! (-> this button-status) (button-status button-status-2))
(if arg0
(vector-copy! (-> this move-to-pos) arg0)
(vector-copy! (-> this move-to-pos) (-> this root trans))
)
(if arg1
(quaternion-copy! (-> this move-to-quat) arg1)
(quaternion-copy! (-> this move-to-quat) (-> this root quat))
)
0
(none)
)
;; definition for method 33 of type basebutton
(defmethod idle-state-transition ((this basebutton))
(if (logtest? (-> this button-status) (button-status pressed))
(go (method-of-object this down-idle))
(go (method-of-object this up-idle))
)
)
;; failed to figure out what this is:
(defstate up-idle (basebutton)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('attack)
(let ((v1-1 (the-as attack-info (-> block param 1))))
(case (-> v1-1 mode)
(('flop 'spin 'punch 'eco-yellow 'eco-red 'eco-blue 'eco-dark)
(when (or (not (or (= (-> v1-1 mode) 'spin) (= (-> v1-1 mode) 'punch)))
(logtest? (-> self button-status) (button-status button-status-3))
)
(send-event! self (-> self event-going-down))
(go-virtual going-down)
)
)
)
)
)
(('trigger)
(sound-play "silo-button")
(go-virtual going-down)
)
(('touch)
(when (logtest? (-> self button-status) (button-status button-status-4))
(send-event! self (-> self event-going-down))
(go-virtual going-down)
)
)
(('move-to)
(move-to! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
)
)
)
:enter (behavior ()
(press! self #f)
)
:trans (behavior ()
(if (logtest? (-> self button-status) (button-status button-status-2))
(rider-trans)
)
)
:code sleep-code
:post (behavior ()
(when (logtest? (-> self button-status) (button-status button-status-2))
(logclear! (-> self button-status) (button-status button-status-2))
(vector-copy! (-> self root trans) (-> self move-to-pos))
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
(rider-post)
)
)
)
;; failed to figure out what this is:
(defstate going-down (basebutton)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('untrigger)
(go-virtual going-up)
)
(('move-to)
(move-to! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
)
)
)
:enter (behavior ()
(press! self #t)
)
:trans rider-trans
:code (behavior ()
(ja-no-eval :num! (seek! max (-> self anim-speed)))
(until (ja-done? 0)
(suspend)
(ja :num! (seek! max (-> self anim-speed)))
)
(send-event! self (-> self event-down))
(let ((gp-0 (res-lump-struct (-> self entity) 'on-activate structure)))
(if gp-0
(script-eval (the-as pair gp-0))
)
)
(go-virtual down-idle)
)
:post (behavior ()
(when (logtest? (-> self button-status) (button-status button-status-2))
(logclear! (-> self button-status) (button-status button-status-2))
(vector-copy! (-> self root trans) (-> self move-to-pos))
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
)
(rider-post)
)
)
;; failed to figure out what this is:
(defstate down-idle (basebutton)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('untrigger)
(go-virtual going-up)
)
(('move-to)
(move-to! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
)
)
)
:enter (behavior ()
(press! self #t)
(set-time! (-> self state-time))
)
:trans (behavior ()
(if (logtest? (-> self button-status) (button-status button-status-2))
(rider-trans)
)
)
:code (behavior ()
(cond
((= (-> self timeout) 0.0)
(sleep-code)
)
(else
(until (time-elapsed? (-> self state-time) (the int (* 300.0 (-> self timeout))))
(suspend)
)
(send-event! self (-> self event-going-up))
(sound-play "silo-button")
(go-virtual going-up)
)
)
)
:post (behavior ()
(when (logtest? (-> self button-status) (button-status button-status-2))
(logclear! (-> self button-status) (button-status button-status-2))
(vector-copy! (-> self root trans) (-> self move-to-pos))
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
(rider-post)
)
)
)
;; failed to figure out what this is:
(defstate going-up (basebutton)
:virtual #t
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(case message
(('move-to)
(move-to! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
)
(('trigger)
(go-virtual going-down)
)
)
)
:enter (behavior ()
(press! self #f)
)
:trans rider-trans
:code (behavior ()
(ja-no-eval :num! (seek! 0.0 (-> self anim-speed)))
(until (ja-done? 0)
(suspend)
(ja :num! (seek! 0.0 (-> self anim-speed)))
)
(send-event! self (-> self event-up))
(go-virtual up-idle)
)
:post (behavior ()
(when (logtest? (-> self button-status) (button-status button-status-2))
(logclear! (-> self button-status) (button-status button-status-2))
(vector-copy! (-> self root trans) (-> self move-to-pos))
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
)
(rider-post)
)
)
;; definition for method 39 of type basebutton
(defmethod press! ((this basebutton) (arg0 symbol))
(if arg0
(logior! (-> this button-status) (button-status pressed))
(logclear! (-> this button-status) (button-status pressed))
)
(when (not (logtest? (-> this button-status) (button-status button-status-1)))
(if arg0
(process-entity-status! this (entity-perm-status subtask-complete) #t)
(process-entity-status! this (entity-perm-status subtask-complete) #f)
)
)
)
;; definition for method 37 of type basebutton
;; WARN: Return type mismatch int vs none.
(defmethod send-event! ((this basebutton) (arg0 symbol))
(with-pp
(when arg0
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-1 from) (process->ppointer pp))
(set! (-> a1-1 num-params) 0)
(set! (-> a1-1 message) arg0)
(let ((t9-0 send-event-function)
(v1-2 (-> this notify-actor))
)
(t9-0
(if v1-2
(-> v1-2 extra process)
)
a1-1
)
)
)
(dotimes (s4-0 (-> this actor-group-count))
(let ((s3-0 (-> this actor-group s4-0)))
(dotimes (s2-0 (-> s3-0 length))
(let ((a1-2 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-2 from) (process->ppointer pp))
(set! (-> a1-2 num-params) 0)
(set! (-> a1-2 message) arg0)
(let ((t9-1 send-event-function)
(v1-10 (-> s3-0 data s2-0 actor))
)
(t9-1
(if v1-10
(-> v1-10 extra process)
)
a1-2
)
)
)
)
)
)
)
0
(none)
)
)
;; definition for method 32 of type basebutton
;; WARN: Return type mismatch int vs none.
(defmethod init! ((this basebutton))
(set! (-> this button-status) (button-status))
(set! (-> this notify-actor) #f)
(set! (-> this timeout) 0.0)
(set! (-> this event-going-down) #f)
(set! (-> this event-down) #f)
(set! (-> this event-going-up) #f)
(set! (-> this event-up) #f)
(set! (-> this anim-speed) 1.0)
0
(none)
)
;; definition for method 36 of type basebutton
;; WARN: Return type mismatch int vs none.
(defmethod prepare-trigger-event! ((this basebutton))
(set! (-> this event-going-down) 'trigger)
0
(none)
)
;; definition for method 34 of type basebutton
;; WARN: Return type mismatch int vs none.
(defmethod init-skel-and-ja! ((this basebutton))
(initialize-skeleton
this
(the-as skeleton-group (art-group-get-by-name *level* "skel-generic-button" (the-as (pointer level) #f)))
(the-as pair 0)
)
(ja-channel-set! 1)
(cond
((logtest? (-> this button-status) (button-status pressed))
(let ((s5-1 (-> this skel root-channel 0)))
(joint-control-channel-group-eval!
s5-1
(the-as art-joint-anim (-> this draw art-group data 3))
num-func-identity
)
(set! (-> s5-1 frame-num)
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 3)) frames num-frames) -1))
)
)
)
(else
(let ((s5-2 (-> this skel root-channel 0)))
(joint-control-channel-group-eval!
s5-2
(the-as art-joint-anim (-> this draw art-group data 3))
num-func-identity
)
(set! (-> s5-2 frame-num) 0.0)
)
)
)
(set! (-> this anim-speed) 2.0)
(transform-post)
(none)
)
;; definition for method 35 of type basebutton
;; WARN: Return type mismatch int vs none.
(defmethod init-collision! ((this basebutton))
(let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player))))
(let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0))))
(set! (-> s4-0 prim-core collide-as) (collide-spec obstacle pusher))
(set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list))
(set! (-> s4-0 prim-core action) (collide-action solid rideable))
(set! (-> s4-0 transform-index) 3)
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0)
(set! (-> s5-0 total-prims) (the-as uint 1))
(set! (-> s5-0 root-prim) s4-0)
)
(pusher-init s5-0)
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
(let ((v1-12 (-> s5-0 root-prim)))
(set! (-> s5-0 backup-collide-as) (-> v1-12 prim-core collide-as))
(set! (-> s5-0 backup-collide-with) (-> v1-12 prim-core collide-with))
)
(set! (-> this root) s5-0)
)
0
(none)
)
;; definition for method 11 of type basebutton
;; INFO: Used lq/sq
(defmethod init-from-entity! ((this basebutton) (arg0 entity-actor))
"Set up a newly created process from the entity that created it."
(init! this)
(set! (-> this button-id) -1)
(let ((v1-4 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0)))
(if (>= (the-as int v1-4) 0)
(set! (-> this button-id) (the-as int v1-4))
)
)
(init-collision! this)
(process-drawable-from-entity! this arg0)
(if (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete)))
(logior! (-> this button-status) (button-status pressed))
(logclear! (-> this button-status) (button-status pressed))
)
(set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0))
(let* ((sv-16 (new 'static 'res-tag))
(v1-15 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))
)
(cond
((and v1-15 (nonzero? (-> sv-16 elt-count)))
(set! (-> this actor-group) v1-15)
(set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count)))
)
(else
(set! (-> this actor-group) (the-as (pointer actor-group) #f))
(set! (-> this actor-group-count) 0)
0
)
)
)
(set! (-> this timeout) (res-lump-float arg0 'timeout))
(if (not (logtest? (-> this button-status) (button-status button-status-1)))
(nav-mesh-connect-from-ent this)
)
(prepare-trigger-event! this)
(init-skel-and-ja! this)
(idle-state-transition this)
)
;; definition for function basebutton-init-by-other
;; INFO: Used lq/sq
;; WARN: Return type mismatch object vs none.
(defbehavior basebutton-init-by-other basebutton ((arg0 entity-actor) (arg1 vector) (arg2 quaternion) (arg3 entity-actor) (arg4 symbol) (arg5 float))
(init! self)
(logior! (-> self button-status) (button-status button-status-1))
(set! (-> self button-id) -1)
(if arg4
(logior! (-> self button-status) (button-status pressed))
)
(set! (-> self notify-actor) arg3)
(set! (-> self timeout) arg5)
(if arg0
(process-entity-set! self arg0)
)
(set! (-> self actor-group) (the-as (pointer actor-group) #f))
(set! (-> self actor-group-count) 0)
(init-collision! self)
(vector-copy! (-> self root trans) arg1)
(quaternion-copy! (-> self root quat) arg2)
(set-vector! (-> self root scale) 1.0 1.0 1.0 1.0)
(prepare-trigger-event! self)
(init-skel-and-ja! self)
(idle-state-transition self)
(none)
)