mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 21:27:52 -04:00
c2c6d3ba46
* support res lump float * handle data macro * rest of res macros * add vi3 to the build system * missing close paren
1088 lines
29 KiB
Common Lisp
1088 lines
29 KiB
Common Lisp
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; name: basebutton.gc
|
|
;; name in dgo: basebutton
|
|
;; dgos: GAME, COMMON, L1
|
|
|
|
(define-extern *generic-button-sg* skeleton-group)
|
|
(define-extern target-warp-out (state vector vector target))
|
|
|
|
;; definition of type basebutton
|
|
(deftype basebutton (process-drawable)
|
|
((root-override collide-shape-moving :offset 112)
|
|
(down? symbol :offset-assert 176)
|
|
(spawned-by-other? symbol :offset-assert 180)
|
|
(move-to? symbol :offset-assert 184)
|
|
(notify-actor entity-actor :offset-assert 188)
|
|
(timeout float :offset-assert 192)
|
|
(button-id int32 :offset-assert 196)
|
|
(event-going-down symbol :offset-assert 200)
|
|
(event-down symbol :offset-assert 204)
|
|
(event-going-up symbol :offset-assert 208)
|
|
(event-up symbol :offset-assert 212)
|
|
(anim-speed float :offset-assert 216)
|
|
(move-to-pos vector :inline :offset-assert 224)
|
|
(move-to-quat quaternion :inline :offset-assert 240)
|
|
)
|
|
:heap-base #x90
|
|
:method-count-assert 32
|
|
:size-assert #x100
|
|
:flag-assert #x2000900100
|
|
(:methods
|
|
(basebutton-down-idle () _type_ :state 20)
|
|
(basebutton-going-down () _type_ :state 21)
|
|
(basebutton-going-up () _type_ :state 22)
|
|
(basebutton-startup () _type_ :state 23)
|
|
(basebutton-up-idle () _type_ :state 24)
|
|
(reset! (_type_) float 25)
|
|
(TODO-RENAME-26 (_type_) none 26)
|
|
(TODO-RENAME-27 (_type_) collide-shape-moving 27)
|
|
(arm-trigger-event! (_type_) symbol 28)
|
|
(TODO-RENAME-29 (_type_ symbol entity) none 29)
|
|
(move-to-vec-or-quat! (_type_ vector quaternion) quaternion 30)
|
|
(press! (_type_ symbol) int 31)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(let
|
|
((v1-1
|
|
(new 'static 'skeleton-group
|
|
:art-group-name "generic-button"
|
|
:bounds (new 'static 'vector :w 12288.0)
|
|
:version #x6
|
|
)
|
|
)
|
|
)
|
|
(set! (-> v1-1 jgeo) 0)
|
|
(set! (-> v1-1 janim) 2)
|
|
(set! (-> v1-1 mgeo 0) (the-as uint 1))
|
|
(set! (-> v1-1 lod-dist 0) 4095996000.0)
|
|
(set! *generic-button-sg* v1-1)
|
|
)
|
|
|
|
;; definition for method 30 of type basebutton
|
|
;; Used lq/sq
|
|
(defmethod
|
|
move-to-vec-or-quat!
|
|
basebutton
|
|
((obj basebutton) (arg0 vector) (arg1 quaternion))
|
|
(set! (-> obj move-to?) #t)
|
|
(if arg0
|
|
(set! (-> obj move-to-pos quad) (-> arg0 quad))
|
|
(set! (-> obj move-to-pos quad) (-> obj root-override trans quad))
|
|
)
|
|
(if arg1
|
|
(quaternion-copy! (-> obj move-to-quat) arg1)
|
|
(quaternion-copy! (-> obj move-to-quat) (-> obj root-override quat))
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-startup (basebutton)
|
|
:virtual #t
|
|
:code
|
|
(behavior ()
|
|
(if (-> self down?)
|
|
(go-virtual basebutton-down-idle)
|
|
(go-virtual basebutton-up-idle)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-up-idle (basebutton)
|
|
:virtual #t
|
|
:event
|
|
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(let ((v1-0 arg2))
|
|
(the-as object (cond
|
|
((= v1-0 'attack)
|
|
(case (-> arg3 param 1)
|
|
(('flop)
|
|
(TODO-RENAME-29
|
|
self
|
|
(-> self event-going-down)
|
|
(-> self notify-actor)
|
|
)
|
|
(sound-play-by-name
|
|
(static-sound-name "silo-button")
|
|
(new-sound-id)
|
|
1024
|
|
0
|
|
0
|
|
(the-as uint 1)
|
|
(the-as vector #t)
|
|
)
|
|
(go-virtual basebutton-going-down)
|
|
)
|
|
)
|
|
)
|
|
((= v1-0 'trigger)
|
|
(sound-play-by-name
|
|
(static-sound-name "silo-button")
|
|
(new-sound-id)
|
|
1024
|
|
0
|
|
0
|
|
(the-as uint 1)
|
|
(the-as vector #t)
|
|
)
|
|
(go-virtual basebutton-going-down)
|
|
)
|
|
((= v1-0 'move-to)
|
|
(move-to-vec-or-quat!
|
|
self
|
|
(the-as vector (-> arg3 param 0))
|
|
(the-as quaternion (-> arg3 param 1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter
|
|
(behavior ()
|
|
(press! self #f)
|
|
(none)
|
|
)
|
|
:trans
|
|
(behavior ()
|
|
(if (-> self move-to?)
|
|
(rider-trans)
|
|
)
|
|
(none)
|
|
)
|
|
:code
|
|
(the-as (function none :behavior basebutton) anim-loop)
|
|
:post
|
|
(behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root-override trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root-override quat) (-> self move-to-quat))
|
|
(rider-post)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-going-down (basebutton)
|
|
:virtual #t
|
|
:event
|
|
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(let ((v1-0 arg2))
|
|
(the-as object (cond
|
|
((= v1-0 'untrigger)
|
|
(sound-play-by-name
|
|
(static-sound-name "silo-button")
|
|
(new-sound-id)
|
|
1024
|
|
0
|
|
0
|
|
(the-as uint 1)
|
|
(the-as vector #t)
|
|
)
|
|
(go-virtual basebutton-going-up)
|
|
)
|
|
((= v1-0 'move-to)
|
|
(move-to-vec-or-quat!
|
|
self
|
|
(the-as vector (-> arg3 param 0))
|
|
(the-as quaternion (-> arg3 param 1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter
|
|
(behavior ()
|
|
(press! self #t)
|
|
(none)
|
|
)
|
|
:trans
|
|
(the-as (function none :behavior basebutton) rider-trans)
|
|
:code
|
|
(behavior ()
|
|
(let ((a0-0 (-> self skel root-channel 0)))
|
|
(set!
|
|
(-> a0-0 param 0)
|
|
(the float (+ (-> a0-0 frame-group data 0 length) -1))
|
|
)
|
|
(set! (-> a0-0 param 1) (-> self anim-speed))
|
|
(joint-control-channel-group!
|
|
a0-0
|
|
(the-as art-joint-anim #f)
|
|
num-func-seek!
|
|
)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(let ((a0-1 (-> self skel root-channel 0)))
|
|
(set!
|
|
(-> a0-1 param 0)
|
|
(the float (+ (-> a0-1 frame-group data 0 length) -1))
|
|
)
|
|
(set! (-> a0-1 param 1) (-> self anim-speed))
|
|
(joint-control-channel-group-eval!
|
|
a0-1
|
|
(the-as art-joint-anim #f)
|
|
num-func-seek!
|
|
)
|
|
)
|
|
)
|
|
(TODO-RENAME-29 self (-> self event-down) (-> self notify-actor))
|
|
(go-virtual basebutton-down-idle)
|
|
(none)
|
|
)
|
|
:post
|
|
(behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root-override trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root-override quat) (-> self move-to-quat))
|
|
)
|
|
(rider-post)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-down-idle (basebutton)
|
|
:virtual #t
|
|
:event
|
|
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(let ((v1-0 arg2))
|
|
(the-as object (cond
|
|
((= v1-0 'untrigger)
|
|
(sound-play-by-name
|
|
(static-sound-name "silo-button")
|
|
(new-sound-id)
|
|
1024
|
|
0
|
|
0
|
|
(the-as uint 1)
|
|
(the-as vector #t)
|
|
)
|
|
(go-virtual basebutton-going-up)
|
|
)
|
|
((= v1-0 'move-to)
|
|
(move-to-vec-or-quat!
|
|
self
|
|
(the-as vector (-> arg3 param 0))
|
|
(the-as quaternion (-> arg3 param 1))
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter
|
|
(behavior ()
|
|
(press! self #t)
|
|
(none)
|
|
)
|
|
:trans
|
|
(behavior ()
|
|
(if (-> self move-to?)
|
|
(rider-trans)
|
|
)
|
|
(none)
|
|
)
|
|
:code
|
|
(behavior ()
|
|
(set!
|
|
(-> self state-time)
|
|
(the-as seconds (-> *display* base-frame-counter))
|
|
)
|
|
(cond
|
|
((= (-> self timeout) 0.0)
|
|
(anim-loop)
|
|
)
|
|
(else
|
|
(until
|
|
(>=
|
|
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
|
(the int (* 300.0 (-> self timeout)))
|
|
)
|
|
(suspend)
|
|
)
|
|
(TODO-RENAME-29 self (-> self event-going-up) (-> self notify-actor))
|
|
(sound-play-by-name
|
|
(static-sound-name "silo-button")
|
|
(new-sound-id)
|
|
1024
|
|
0
|
|
0
|
|
(the-as uint 1)
|
|
(the-as vector #t)
|
|
)
|
|
(go-virtual basebutton-going-up)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
:post
|
|
(behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root-override trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root-override quat) (-> self move-to-quat))
|
|
(rider-post)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-going-up (basebutton)
|
|
:virtual #t
|
|
:event
|
|
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(let ((v1-0 arg2))
|
|
(the-as object (cond
|
|
((= v1-0 'move-to)
|
|
(move-to-vec-or-quat!
|
|
self
|
|
(the-as vector (-> arg3 param 0))
|
|
(the-as quaternion (-> arg3 param 1))
|
|
)
|
|
)
|
|
((= v1-0 'trigger)
|
|
(sound-play-by-name
|
|
(static-sound-name "silo-button")
|
|
(new-sound-id)
|
|
1024
|
|
0
|
|
0
|
|
(the-as uint 1)
|
|
(the-as vector #t)
|
|
)
|
|
(go-virtual basebutton-going-down)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
:enter
|
|
(behavior ()
|
|
(press! self #f)
|
|
(none)
|
|
)
|
|
:trans
|
|
(the-as (function none :behavior basebutton) rider-trans)
|
|
:code
|
|
(behavior ()
|
|
(let ((a0-0 (-> self skel root-channel 0)))
|
|
(set! (-> a0-0 param 0) 0.0)
|
|
(set! (-> a0-0 param 1) (-> self anim-speed))
|
|
(joint-control-channel-group!
|
|
a0-0
|
|
(the-as art-joint-anim #f)
|
|
num-func-seek!
|
|
)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(let ((a0-1 (-> self skel root-channel 0)))
|
|
(set! (-> a0-1 param 0) 0.0)
|
|
(set! (-> a0-1 param 1) (-> self anim-speed))
|
|
(joint-control-channel-group-eval!
|
|
a0-1
|
|
(the-as art-joint-anim #f)
|
|
num-func-seek!
|
|
)
|
|
)
|
|
)
|
|
(TODO-RENAME-29 self (-> self event-up) (-> self notify-actor))
|
|
(go-virtual basebutton-up-idle)
|
|
(none)
|
|
)
|
|
:post
|
|
(behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root-override trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root-override quat) (-> self move-to-quat))
|
|
)
|
|
(rider-post)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 31 of type basebutton
|
|
(defmethod press! basebutton ((obj basebutton) (arg0 symbol))
|
|
(set! (-> obj down?) arg0)
|
|
(cond
|
|
(arg0
|
|
(if (not (-> obj spawned-by-other?))
|
|
(process-entity-status! obj (entity-perm-status complete) #t)
|
|
)
|
|
)
|
|
(else
|
|
(if (not (-> obj spawned-by-other?))
|
|
(process-entity-status! obj (entity-perm-status complete) #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 29 of type basebutton
|
|
(defmethod
|
|
TODO-RENAME-29
|
|
basebutton
|
|
((obj basebutton) (arg0 symbol) (arg1 entity))
|
|
(with-pp
|
|
(when arg0
|
|
(cond
|
|
(arg1
|
|
(let ((v1-0 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> v1-0 from) pp)
|
|
(set! (-> v1-0 num-params) 0)
|
|
(set! (-> v1-0 message) arg0)
|
|
(let ((a1-1 arg1))
|
|
(send-event-function (if a1-1
|
|
(-> a1-1 extra process)
|
|
)
|
|
v1-0
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(if (nonzero? (-> obj link))
|
|
(send-to-all (-> obj link) arg0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 25 of type basebutton
|
|
(defmethod reset! basebutton ((obj basebutton))
|
|
(set! (-> obj down?) #f)
|
|
(set! (-> obj spawned-by-other?) #t)
|
|
(set! (-> obj move-to?) #f)
|
|
(set! (-> obj notify-actor) #f)
|
|
(set! (-> obj timeout) 0.0)
|
|
(set! (-> obj event-going-down) #f)
|
|
(set! (-> obj event-down) #f)
|
|
(set! (-> obj event-going-up) #f)
|
|
(set! (-> obj event-up) #f)
|
|
(let ((f0-1 1.0))
|
|
(set! (-> obj anim-speed) f0-1)
|
|
f0-1
|
|
)
|
|
)
|
|
|
|
;; definition for method 28 of type basebutton
|
|
(defmethod arm-trigger-event! basebutton ((obj basebutton))
|
|
(let ((v0-0 'trigger))
|
|
(set! (-> obj event-going-down) v0-0)
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
;; definition for method 26 of type basebutton
|
|
;; INFO: Return type mismatch int vs none.
|
|
(defmethod TODO-RENAME-26 basebutton ((obj basebutton))
|
|
(dummy-14 obj *generic-button-sg* '())
|
|
(logior! (-> obj skel status) 1)
|
|
(ja-channel-set! 1)
|
|
(cond
|
|
((-> obj down?)
|
|
(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)
|
|
(the
|
|
float
|
|
(+
|
|
(->
|
|
(the-as art-joint-anim (-> obj draw art-group data 2))
|
|
data
|
|
0
|
|
length
|
|
)
|
|
-1
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(let ((s5-1 (-> obj skel root-channel 0)))
|
|
(joint-control-channel-group-eval!
|
|
s5-1
|
|
(the-as art-joint-anim (-> obj draw art-group data 2))
|
|
num-func-identity
|
|
)
|
|
(set! (-> s5-1 frame-num) 0.0)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> obj anim-speed) 2.0)
|
|
(dummy-47 (-> obj root-override))
|
|
(ja-post)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 27 of type basebutton
|
|
(defmethod TODO-RENAME-27 basebutton ((obj basebutton))
|
|
(let
|
|
((s5-0
|
|
(new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player))
|
|
)
|
|
)
|
|
(set! (-> s5-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s5-0 reaction) default-collision-reaction)
|
|
(set! (-> s5-0 no-reaction) nothing)
|
|
(dummy-29 s5-0 1)
|
|
(let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0)))
|
|
(set! (-> s4-0 prim-core collide-as) (the-as uint 2048))
|
|
(set! (-> s4-0 collide-with) (the-as uint 16))
|
|
(set! (-> s4-0 prim-core action) (the-as uint 3))
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0)
|
|
(dummy-46 s5-0)
|
|
(let
|
|
((s3-0
|
|
(new
|
|
'process
|
|
'collide-shape-prim-mesh
|
|
s5-0
|
|
(the-as uint 0)
|
|
(the-as uint 0)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> s3-0 prim-core collide-as) (the-as uint 2048))
|
|
(set! (-> s3-0 collide-with) (the-as uint 16))
|
|
(set! (-> s3-0 prim-core action) (the-as uint 3))
|
|
(set! (-> s3-0 prim-core offense) 4)
|
|
(set! (-> s3-0 transform-index) 4)
|
|
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 12288.0)
|
|
)
|
|
(dummy-28 s4-0)
|
|
(let
|
|
((s3-1
|
|
(new
|
|
'process
|
|
'collide-shape-prim-mesh
|
|
s5-0
|
|
(the-as uint 1)
|
|
(the-as uint 0)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> s3-1 prim-core collide-as) (the-as uint 2048))
|
|
(set! (-> s3-1 collide-with) (the-as uint 16))
|
|
(set! (-> s3-1 prim-core action) (the-as uint 3))
|
|
(set! (-> s3-1 prim-core offense) 4)
|
|
(set! (-> s3-1 transform-index) 3)
|
|
(set-vector! (-> s3-1 local-sphere) 0.0 0.0 0.0 12288.0)
|
|
)
|
|
(dummy-28 s4-0)
|
|
)
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
(dummy-50 s5-0)
|
|
(set! (-> obj root-override) s5-0)
|
|
s5-0
|
|
)
|
|
)
|
|
|
|
;; definition for method 11 of type basebutton
|
|
(defmethod copy-defaults! basebutton ((obj basebutton) (arg0 res-lump))
|
|
(reset! obj)
|
|
(set! (-> obj spawned-by-other?) #f)
|
|
(set! (-> obj button-id) -1)
|
|
(let
|
|
((v1-4
|
|
(res-lump-value
|
|
(-> obj entity)
|
|
'extra-id
|
|
uint128
|
|
:default
|
|
(the-as uint128 -1)
|
|
)
|
|
)
|
|
)
|
|
(if (>= (the-as int v1-4) 0)
|
|
(set! (-> obj button-id) (the-as int v1-4))
|
|
)
|
|
)
|
|
(when
|
|
(or
|
|
(res-lump-struct arg0 'next-actor structure)
|
|
(res-lump-struct arg0 'prev-actor structure)
|
|
)
|
|
(set! (-> obj link) (new 'process 'actor-link-info obj))
|
|
(if (< (-> obj button-id) 0)
|
|
(set! (-> obj button-id) (actor-count-before (-> obj link)))
|
|
)
|
|
)
|
|
(TODO-RENAME-27 obj)
|
|
(process-drawable-from-entity! obj arg0)
|
|
(let ((v1-16 #f))
|
|
(if
|
|
(and
|
|
(-> obj entity)
|
|
(logtest? (-> obj entity extra perm status) (entity-perm-status complete))
|
|
)
|
|
(set! v1-16 #t)
|
|
)
|
|
(set! (-> obj down?) v1-16)
|
|
)
|
|
(set! (-> obj notify-actor) (entity-actor-lookup arg0 'alt-actor 0))
|
|
(set! (-> obj timeout) (res-lump-float arg0 'timeout))
|
|
(if (not (-> obj spawned-by-other?))
|
|
(nav-mesh-connect obj (-> obj root-override) (the-as nav-control #f))
|
|
)
|
|
(arm-trigger-event! obj)
|
|
(TODO-RENAME-26 obj)
|
|
(go (method-of-object obj basebutton-startup))
|
|
(none)
|
|
)
|
|
|
|
;; definition for function basebutton-init-by-other
|
|
;; Used lq/sq
|
|
(defbehavior
|
|
basebutton-init-by-other basebutton
|
|
((arg0 basebutton)
|
|
(arg1 vector)
|
|
(arg2 quaternion)
|
|
(arg3 entity-actor)
|
|
(arg4 symbol)
|
|
(arg5 float)
|
|
)
|
|
(reset! self)
|
|
(set! (-> self spawned-by-other?) #t)
|
|
(set! (-> self button-id) -1)
|
|
(set! (-> self down?) arg4)
|
|
(set! (-> self notify-actor) arg3)
|
|
(set! (-> self timeout) arg5)
|
|
(if arg0
|
|
(set! (-> self entity) (the-as entity arg0))
|
|
)
|
|
(TODO-RENAME-27 self)
|
|
(set! (-> self root-override trans quad) (-> arg1 quad))
|
|
(quaternion-copy! (-> self root-override quat) arg2)
|
|
(set-vector! (-> self root-override scale) 1.0 1.0 1.0 1.0)
|
|
(arm-trigger-event! self)
|
|
(TODO-RENAME-26 self)
|
|
(go-virtual basebutton-startup)
|
|
(none)
|
|
)
|
|
|
|
;; definition for symbol *warp-info*, type (array string)
|
|
(define
|
|
*warp-info*
|
|
(the-as (array string)
|
|
(new
|
|
'static
|
|
'boxed-array
|
|
:type string :length 5 :allocated-length 5
|
|
"training-warp"
|
|
"village1-warp"
|
|
"village2-warp"
|
|
"village3-warp"
|
|
"citadel-warp"
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition of type warp-gate
|
|
(deftype warp-gate (process-drawable)
|
|
((level symbol :offset-assert 176)
|
|
(level-slot int32 :offset-assert 180)
|
|
(min-slot int32 :offset-assert 184)
|
|
(max-slot int32 :offset-assert 188)
|
|
)
|
|
:heap-base #x50
|
|
:method-count-assert 24
|
|
:size-assert #xc0
|
|
:flag-assert #x18005000c0
|
|
(:methods
|
|
(unknown-state00 () _type_ :state 20)
|
|
(dummy-21 () none 21)
|
|
(use (int level) _type_ :state 22)
|
|
(dummy-23 () none 23)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type warp-gate
|
|
(defmethod inspect warp-gate ((obj warp-gate))
|
|
(let ((t9-0 (method-of-type process-drawable inspect)))
|
|
(t9-0 obj)
|
|
)
|
|
(format #t "~T~Tlevel: ~A~%" (-> obj level))
|
|
(format #t "~T~Tlevel-slot: ~D~%" (-> obj level-slot))
|
|
(format #t "~T~Tmin-slot: ~D~%" (-> obj min-slot))
|
|
(format #t "~T~Tmax-slot: ~D~%" (-> obj max-slot))
|
|
obj
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate use (warp-gate)
|
|
:virtual #t
|
|
:trans
|
|
(behavior ()
|
|
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-0 from) self)
|
|
(set! (-> a1-0 num-params) 2)
|
|
(set! (-> a1-0 message) 'joystick)
|
|
(set! (-> a1-0 param 0) (the-as uint 0.0))
|
|
(set! (-> a1-0 param 1) (the-as uint 0.0))
|
|
(send-event-function *camera* a1-0)
|
|
)
|
|
(none)
|
|
)
|
|
:code
|
|
(behavior ((arg0 int) (arg1 level))
|
|
(set!
|
|
(-> self state-time)
|
|
(the-as seconds (-> *display* base-frame-counter))
|
|
)
|
|
(when (not arg1)
|
|
(process-release? *target*)
|
|
(go-virtual unknown-state00)
|
|
)
|
|
(let ((s4-0 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> s4-0 from) self)
|
|
(set! (-> s4-0 num-params) 3)
|
|
(set! (-> s4-0 message) 'change-state)
|
|
(set! (-> s4-0 param 0) (the-as uint target-warp-out))
|
|
(let ((v1-9 (new 'static 'vector)))
|
|
(set! (-> v1-9 quad) (-> self root trans quad))
|
|
(set! (-> s4-0 param 1) (the-as uint v1-9))
|
|
)
|
|
(set! (-> s4-0 param 2) (the-as uint (target-pos 0)))
|
|
(send-event-function *target* s4-0)
|
|
)
|
|
(case (-> self level)
|
|
(('citadel 'lavatube)
|
|
(while (and *target* (zero? (logand (-> *target* draw status) 2)))
|
|
(suspend)
|
|
)
|
|
)
|
|
(else
|
|
(load-state-want-levels (-> self level) (-> arg1 load-name))
|
|
(while
|
|
(or
|
|
(not
|
|
(member (level-status *level* (-> arg1 load-name)) '(loaded active))
|
|
)
|
|
(<
|
|
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
|
600
|
|
)
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
)
|
|
(set-blackout-frames 15)
|
|
(start 'play (get-continue-by-name *game-info* (-> *warp-info* arg0)))
|
|
(logior! (-> self mask) (process-mask sleep))
|
|
(suspend)
|
|
0
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; definition for symbol *warp-jump-mods*, type surface
|
|
(define
|
|
*warp-jump-mods*
|
|
(new 'static 'surface
|
|
:name 'jump
|
|
:turnv 273066.66
|
|
:turnvv 1820444.5
|
|
:tiltv 32768.0
|
|
:tiltvv 131072.0
|
|
:transv-max 65536.0
|
|
:target-speed 65536.0
|
|
:slip-factor 1.0
|
|
:slide-factor 1.0
|
|
:slope-up-factor 1.0
|
|
:slope-down-factor 1.0
|
|
:slope-slip-angle 1.0
|
|
:impact-fric 1.0
|
|
:bend-factor 1.0
|
|
:bend-speed 1.0
|
|
:alignv 1.0
|
|
:slope-up-traction 1.0
|
|
:align-speed 1.0
|
|
:mode 'air
|
|
:flags #x20
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate target-warp-out (target)
|
|
:event
|
|
(behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('death-end)
|
|
(let ((v0-0 (the-as object (logior (-> self draw status) 2))))
|
|
(set! (-> self draw status) (the-as uint v0-0))
|
|
v0-0
|
|
)
|
|
)
|
|
(else
|
|
(target-generic-event-handler arg0 arg1 arg2 arg3)
|
|
)
|
|
)
|
|
)
|
|
:enter
|
|
(behavior ((arg0 vector) (arg1 vector))
|
|
(set!
|
|
(-> self state-time)
|
|
(the-as seconds (-> *display* base-frame-counter))
|
|
)
|
|
(set! (-> self control status) (logand -8 (-> self control status)))
|
|
(set! (-> self control unknown-surface00) *warp-jump-mods*)
|
|
(set! (-> self control unknown-vector102 quad) (-> arg0 quad))
|
|
(set! (-> self control unknown-vector103 quad) (-> arg1 quad))
|
|
(set!
|
|
(-> self control unknown-vector102 y)
|
|
(+ -4096.0 (-> self control unknown-vector102 y))
|
|
)
|
|
(set! (-> self control unknown-int11) (the-as int #f))
|
|
(vector-reset! (-> self control transv))
|
|
(logior! (-> self state-flags) 1024)
|
|
(set! (-> self alt-cam-pos quad) (-> arg1 quad))
|
|
(none)
|
|
)
|
|
:exit
|
|
(behavior ()
|
|
(set! (-> self state-flags) (logand -1025 (-> self state-flags)))
|
|
(none)
|
|
)
|
|
:code
|
|
(behavior ((arg0 vector) (arg1 vector))
|
|
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-1 from) self)
|
|
(set! (-> a1-1 num-params) 2)
|
|
(set! (-> a1-1 message) 'change-state)
|
|
(set! (-> a1-1 param 0) (the-as uint cam-fixed))
|
|
(set! (-> a1-1 param 1) (the-as uint 0))
|
|
(send-event-function *camera* a1-1)
|
|
)
|
|
(ja-channel-push! 1 60)
|
|
(let ((gp-0 (-> self skel root-channel 0)))
|
|
(set!
|
|
(-> gp-0 frame-group)
|
|
(the-as art-joint-anim (-> self draw art-group data 41))
|
|
)
|
|
(set! (-> gp-0 param 0) (ja-aframe 16.0 0))
|
|
(set! (-> gp-0 param 1) 1.0)
|
|
(set! (-> gp-0 frame-num) 0.0)
|
|
(joint-control-channel-group!
|
|
gp-0
|
|
(the-as art-joint-anim (-> self draw art-group data 41))
|
|
num-func-seek!
|
|
)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(let ((gp-1 (-> self skel root-channel 0)))
|
|
(set! (-> gp-1 param 0) (ja-aframe 16.0 0))
|
|
(set! (-> gp-1 param 1) 1.0)
|
|
(joint-control-channel-group-eval!
|
|
gp-1
|
|
(the-as art-joint-anim #f)
|
|
num-func-seek!
|
|
)
|
|
)
|
|
)
|
|
(vector-!
|
|
(-> self control transv)
|
|
(-> self control unknown-vector102)
|
|
(-> self control trans)
|
|
)
|
|
(vector-xz-normalize! (-> self control transv) 32768.0)
|
|
(let ((gp-2 (new-stack-vector0)))
|
|
(let
|
|
((f0-6
|
|
(vector-dot
|
|
(-> self control dynam gravity-normal)
|
|
(-> self control transv)
|
|
)
|
|
)
|
|
)
|
|
0.0
|
|
(vector-!
|
|
gp-2
|
|
(-> self control transv)
|
|
(vector-float*! gp-2 (-> self control dynam gravity-normal) f0-6)
|
|
)
|
|
)
|
|
(let* ((f0-7 (vector-length gp-2))
|
|
(f1-1 f0-7)
|
|
(f2-4
|
|
(-
|
|
(sqrtf
|
|
(*
|
|
(* 2.0 (-> self control dynam gravity-length))
|
|
(vector-dot
|
|
(-> self control dynam gravity-normal)
|
|
(vector-!
|
|
(new 'stack-no-clear 'vector)
|
|
(-> self control unknown-vector102)
|
|
(-> self control trans)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(* 0.008333334 (- (-> self control dynam gravity-length)))
|
|
)
|
|
)
|
|
)
|
|
(vector+!
|
|
(-> self control transv)
|
|
(vector-float*!
|
|
(-> self control transv)
|
|
(-> self control dynam gravity-normal)
|
|
f2-4
|
|
)
|
|
(vector-float*! gp-2 gp-2 (/ f0-7 f1-1))
|
|
)
|
|
)
|
|
)
|
|
(dummy-48 (-> self control))
|
|
(set!
|
|
(-> self state-time)
|
|
(the-as seconds (-> *display* base-frame-counter))
|
|
)
|
|
(set!
|
|
(-> self trans-hook)
|
|
(lambda :behavior target () (let ((gp-0 (new-stack-vector0))
|
|
(f30-0
|
|
(vector-dot
|
|
(-> self control dynam gravity-normal)
|
|
(-> self control transv)
|
|
)
|
|
)
|
|
)
|
|
0.0
|
|
(vector-!
|
|
gp-0
|
|
(-> self control transv)
|
|
(vector-float*!
|
|
gp-0
|
|
(-> self control dynam gravity-normal)
|
|
f30-0
|
|
)
|
|
)
|
|
(let* ((f0-3 (vector-length gp-0))
|
|
(f1-0 f0-3)
|
|
)
|
|
(if (< f30-0 0.0)
|
|
(set! f30-0 8192.0)
|
|
)
|
|
(vector+!
|
|
(-> self control transv)
|
|
(vector-float*!
|
|
(-> self control transv)
|
|
(-> self control dynam gravity-normal)
|
|
f30-0
|
|
)
|
|
(vector-float*! gp-0 gp-0 (/ f0-3 f1-0))
|
|
)
|
|
)
|
|
)
|
|
(let
|
|
((gp-2
|
|
(vector-!
|
|
(new-stack-vector0)
|
|
(-> self control unknown-vector102)
|
|
(-> self control trans)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> gp-2 y) 0.0)
|
|
(let ((a1-7 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-7 from) self)
|
|
(set! (-> a1-7 num-params) 1)
|
|
(set! (-> a1-7 message) 'sidekick)
|
|
(set! (-> a1-7 param 0) (the-as uint #f))
|
|
(send-event-function *target* a1-7)
|
|
)
|
|
(when
|
|
(and
|
|
(or
|
|
(< (vector-dot gp-2 (-> self control transv)) 0.0)
|
|
(-> self control unknown-int11)
|
|
)
|
|
(>=
|
|
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
|
15
|
|
)
|
|
)
|
|
(vector-seek!
|
|
(-> self draw color-mult)
|
|
(new 'static 'vector)
|
|
(* 2.0 (-> *display* seconds-per-frame))
|
|
)
|
|
(set! (-> self control transv x) (* 0.95 (-> self control transv x)))
|
|
(set! (-> self control transv z) (* 0.95 (-> self control transv z)))
|
|
(when (not (-> self control unknown-int11))
|
|
(let ((a1-9 (new 'stack-no-clear 'event-message-block)))
|
|
(set! (-> a1-9 from) self)
|
|
(set! (-> a1-9 num-params) 2)
|
|
(set! (-> a1-9 message) 'do-effect)
|
|
(set! (-> a1-9 param 0) (the-as uint 'death-warp-out))
|
|
(set! (-> a1-9 param 1) (the-as uint -1.0))
|
|
(send-event-function self a1-9)
|
|
)
|
|
(let ((v0-2 #t))
|
|
(set! (-> self control unknown-int11) (the-as int v0-2))
|
|
v0-2
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(let ((gp-3 (-> self skel root-channel 0)))
|
|
(set!
|
|
(-> gp-3 frame-group)
|
|
(the-as art-joint-anim (-> self draw art-group data 41))
|
|
)
|
|
(set! (-> gp-3 param 0) (ja-aframe 40.0 0))
|
|
(set! (-> gp-3 param 1) 1.0)
|
|
(set! (-> gp-3 frame-num) (ja-aframe 16.0 0))
|
|
(joint-control-channel-group!
|
|
gp-3
|
|
(the-as art-joint-anim (-> self draw art-group data 41))
|
|
num-func-seek!
|
|
)
|
|
)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(let ((gp-4 (-> self skel root-channel 0)))
|
|
(set! (-> gp-4 param 0) (ja-aframe 40.0 0))
|
|
(set! (-> gp-4 param 1) 1.0)
|
|
(joint-control-channel-group-eval!
|
|
gp-4
|
|
(the-as art-joint-anim #f)
|
|
num-func-seek!
|
|
)
|
|
)
|
|
)
|
|
(anim-loop)
|
|
(none)
|
|
)
|
|
:post
|
|
target-no-stick-post
|
|
)
|