mirror of
https://github.com/open-goal/jak-project
synced 2026-05-25 23:35:33 -04:00
cd68cb671e
Major change to how `deftype` shows up in our code: - the decompiler will no longer emit the `offset-assert`, `method-count-assert`, `size-assert` and `flag-assert` parameters. There are extremely few cases where having this in the decompiled code is helpful, as the types there come from `all-types` which already has those parameters. This also doesn't break type consistency because: - the asserts aren't compared. - the first step of the test uses `all-types`, which has the asserts, which will throw an error if they're bad. - the decompiler won't emit the `heap-base` parameter unless necessary now. - the decompiler will try its hardest to turn a fixed-offset field into an `overlay-at` field. It falls back to the old offset if all else fails. - `overlay-at` now supports field "dereferencing" to specify the offset that's within a field that's a structure, e.g.: ```lisp (deftype foobar (structure) ((vec vector :inline) (flags int32 :overlay-at (-> vec w)) ) ) ``` in this structure, the offset of `flags` will be 12 because that is the final offset of `vec`'s `w` field within this structure. - **removed ID from all method declarations.** IDs are only ever automatically assigned now. Fixes #3068. - added an `:overlay` parameter to method declarations, in order to declare a new method that goes on top of a previously-defined method. Syntax is `:overlay <method-name>`. Please do not ever use this. - added `state-methods` list parameter. This lets you quickly specify a list of states to be put in the method table. Same syntax as the `states` list parameter. The decompiler will try to put as many states in this as it can without messing with the method ID order. Also changes `defmethod` to make the first type definition (before the arguments) optional. The type can now be inferred from the first argument. Fixes #3093. --------- Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
690 lines
23 KiB
Common Lisp
Vendored
Generated
690 lines
23 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition of type basebutton
|
|
(deftype basebutton (process-drawable)
|
|
((root collide-shape-moving :override)
|
|
(down? symbol)
|
|
(spawned-by-other? symbol)
|
|
(move-to? symbol)
|
|
(notify-actor entity-actor)
|
|
(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
|
|
basebutton-down-idle
|
|
basebutton-going-down
|
|
basebutton-going-up
|
|
basebutton-startup
|
|
basebutton-up-idle
|
|
)
|
|
(:methods
|
|
(reset! (_type_) float)
|
|
(basebutton-method-26 (_type_) none)
|
|
(basebutton-method-27 (_type_) collide-shape-moving)
|
|
(arm-trigger-event! (_type_) symbol)
|
|
(basebutton-method-29 (_type_ symbol entity) none)
|
|
(move-to-vec-or-quat! (_type_ vector quaternion) quaternion)
|
|
(press! (_type_ symbol) int)
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type basebutton
|
|
(defmethod inspect ((this basebutton))
|
|
(let ((t9-0 (method-of-type process-drawable inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tdown?: ~A~%" (-> this down?))
|
|
(format #t "~T~Tspawned-by-other?: ~A~%" (-> this spawned-by-other?))
|
|
(format #t "~T~Tmove-to?: ~A~%" (-> this move-to?))
|
|
(format #t "~T~Tnotify-actor: ~A~%" (-> this notify-actor))
|
|
(format #t "~T~Ttimeout: ~f~%" (-> this timeout))
|
|
(format #t "~T~Tbutton-id: ~D~%" (-> this button-id))
|
|
(format #t "~T~Tevent-going-down: ~A~%" (-> this event-going-down))
|
|
(format #t "~T~Tevent-down: ~A~%" (-> this event-down))
|
|
(format #t "~T~Tevent-going-up: ~A~%" (-> this event-going-up))
|
|
(format #t "~T~Tevent-up: ~A~%" (-> this event-up))
|
|
(format #t "~T~Tanim-speed: ~f~%" (-> this anim-speed))
|
|
(format #t "~T~Tmove-to-pos: #<vector @ #x~X>~%" (-> this move-to-pos))
|
|
(format #t "~T~Tmove-to-quat: #<quaternion @ #x~X>~%" (-> this move-to-quat))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *generic-button-sg* generic-button generic-button-lod0-jg generic-button-idle-ja
|
|
((generic-button-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 3)
|
|
)
|
|
|
|
;; definition for method 30 of type basebutton
|
|
;; INFO: Used lq/sq
|
|
(defmethod move-to-vec-or-quat! ((this basebutton) (arg0 vector) (arg1 quaternion))
|
|
(set! (-> this move-to?) #t)
|
|
(if arg0
|
|
(set! (-> this move-to-pos quad) (-> arg0 quad))
|
|
(set! (-> this move-to-pos quad) (-> this root trans quad))
|
|
)
|
|
(if arg1
|
|
(quaternion-copy! (-> this move-to-quat) arg1)
|
|
(quaternion-copy! (-> this move-to-quat) (-> this root 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)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-up-idle (basebutton)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('attack)
|
|
(case (-> block param 1)
|
|
(('flop)
|
|
(basebutton-method-29 self (-> self event-going-down) (-> self notify-actor))
|
|
(sound-play "silo-button")
|
|
(go-virtual basebutton-going-down)
|
|
)
|
|
)
|
|
)
|
|
(('trigger)
|
|
(sound-play "silo-button")
|
|
(go-virtual basebutton-going-down)
|
|
)
|
|
(('move-to)
|
|
(move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(press! self #f)
|
|
)
|
|
:trans (behavior ()
|
|
(if (-> self move-to?)
|
|
(rider-trans)
|
|
)
|
|
)
|
|
:code anim-loop
|
|
:post (behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
|
(rider-post)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-going-down (basebutton)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('untrigger)
|
|
(sound-play "silo-button")
|
|
(go-virtual basebutton-going-up)
|
|
)
|
|
(('move-to)
|
|
(move-to-vec-or-quat! 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)))
|
|
)
|
|
(basebutton-method-29 self (-> self event-down) (-> self notify-actor))
|
|
(go-virtual basebutton-down-idle)
|
|
)
|
|
:post (behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
|
)
|
|
(rider-post)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-down-idle (basebutton)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('untrigger)
|
|
(sound-play "silo-button")
|
|
(go-virtual basebutton-going-up)
|
|
)
|
|
(('move-to)
|
|
(move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ()
|
|
(press! self #t)
|
|
)
|
|
:trans (behavior ()
|
|
(if (-> self move-to?)
|
|
(rider-trans)
|
|
)
|
|
)
|
|
:code (behavior ()
|
|
(set-time! (-> self state-time))
|
|
(cond
|
|
((= (-> self timeout) 0.0)
|
|
(anim-loop)
|
|
)
|
|
(else
|
|
(until (time-elapsed? (-> self state-time) (the int (* 300.0 (-> self timeout))))
|
|
(suspend)
|
|
)
|
|
(basebutton-method-29 self (-> self event-going-up) (-> self notify-actor))
|
|
(sound-play "silo-button")
|
|
(go-virtual basebutton-going-up)
|
|
)
|
|
)
|
|
)
|
|
:post (behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
|
(rider-post)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate basebutton-going-up (basebutton)
|
|
:virtual #t
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('move-to)
|
|
(move-to-vec-or-quat! self (the-as vector (-> block param 0)) (the-as quaternion (-> block param 1)))
|
|
)
|
|
(('trigger)
|
|
(sound-play "silo-button")
|
|
(go-virtual basebutton-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)))
|
|
)
|
|
(basebutton-method-29 self (-> self event-up) (-> self notify-actor))
|
|
(go-virtual basebutton-up-idle)
|
|
)
|
|
:post (behavior ()
|
|
(when (-> self move-to?)
|
|
(set! (-> self move-to?) #f)
|
|
(set! (-> self root trans quad) (-> self move-to-pos quad))
|
|
(quaternion-copy! (-> self root quat) (-> self move-to-quat))
|
|
)
|
|
(rider-post)
|
|
)
|
|
)
|
|
|
|
;; definition for method 31 of type basebutton
|
|
(defmethod press! ((this basebutton) (arg0 symbol))
|
|
(set! (-> this down?) arg0)
|
|
(cond
|
|
(arg0
|
|
(if (not (-> this spawned-by-other?))
|
|
(process-entity-status! this (entity-perm-status complete) #t)
|
|
)
|
|
)
|
|
(else
|
|
(if (not (-> this spawned-by-other?))
|
|
(process-entity-status! this (entity-perm-status complete) #f)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; definition for method 29 of type basebutton
|
|
;; INFO: Return type mismatch object vs none.
|
|
(defmethod basebutton-method-29 ((this 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? (-> this link))
|
|
(send-to-all (-> this link) arg0)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(none)
|
|
)
|
|
)
|
|
|
|
;; definition for method 25 of type basebutton
|
|
(defmethod reset! ((this basebutton))
|
|
(set! (-> this down?) #f)
|
|
(set! (-> this spawned-by-other?) #t)
|
|
(set! (-> this move-to?) #f)
|
|
(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)
|
|
)
|
|
|
|
;; definition for method 28 of type basebutton
|
|
(defmethod arm-trigger-event! ((this basebutton))
|
|
(let ((v0-0 'trigger))
|
|
(set! (-> this event-going-down) v0-0)
|
|
v0-0
|
|
)
|
|
)
|
|
|
|
;; definition for method 26 of type basebutton
|
|
(defmethod basebutton-method-26 ((this basebutton))
|
|
(initialize-skeleton this *generic-button-sg* '())
|
|
(logior! (-> this skel status) (janim-status inited))
|
|
(ja-channel-set! 1)
|
|
(cond
|
|
((-> this down?)
|
|
(let ((s5-0 (-> this skel root-channel 0)))
|
|
(joint-control-channel-group-eval!
|
|
s5-0
|
|
(the-as art-joint-anim (-> this draw art-group data 2))
|
|
num-func-identity
|
|
)
|
|
(set! (-> s5-0 frame-num)
|
|
(the float (+ (-> (the-as art-joint-anim (-> this draw art-group data 2)) data 0 length) -1))
|
|
)
|
|
)
|
|
)
|
|
(else
|
|
(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 2))
|
|
num-func-identity
|
|
)
|
|
(set! (-> s5-1 frame-num) 0.0)
|
|
)
|
|
)
|
|
)
|
|
(set! (-> this anim-speed) 2.0)
|
|
(update-transforms! (-> this root))
|
|
(ja-post)
|
|
(none)
|
|
)
|
|
|
|
;; definition for method 27 of type basebutton
|
|
(defmethod basebutton-method-27 ((this basebutton))
|
|
(let ((s5-0 (new 'process 'collide-shape-moving this (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)
|
|
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
|
)
|
|
(alloc-riders 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) (collide-kind ground-object))
|
|
(set! (-> s4-0 collide-with) (collide-kind target))
|
|
(set! (-> s4-0 prim-core action) (collide-action solid rider-plat-sticky))
|
|
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0)
|
|
(set-root-prim! s5-0 s4-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) (collide-kind ground-object))
|
|
(set! (-> s3-0 collide-with) (collide-kind target))
|
|
(set! (-> s3-0 prim-core action) (collide-action solid rider-plat-sticky))
|
|
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
|
(set! (-> s3-0 transform-index) 4)
|
|
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 12288.0)
|
|
(append-prim s4-0 s3-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) (collide-kind ground-object))
|
|
(set! (-> s3-1 collide-with) (collide-kind target))
|
|
(set! (-> s3-1 prim-core action) (collide-action solid rider-plat-sticky))
|
|
(set! (-> s3-1 prim-core offense) (collide-offense indestructible))
|
|
(set! (-> s3-1 transform-index) 3)
|
|
(set-vector! (-> s3-1 local-sphere) 0.0 0.0 0.0 12288.0)
|
|
(append-prim s4-0 s3-1)
|
|
)
|
|
)
|
|
(set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w)))
|
|
(backup-collide-with-as s5-0)
|
|
(set! (-> this root) s5-0)
|
|
s5-0
|
|
)
|
|
)
|
|
|
|
;; definition for method 11 of type basebutton
|
|
;; INFO: Return type mismatch object vs none.
|
|
(defmethod init-from-entity! ((this basebutton) (arg0 entity-actor))
|
|
(reset! this)
|
|
(set! (-> this spawned-by-other?) #f)
|
|
(set! (-> this button-id) -1)
|
|
(let ((v1-4 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1))))
|
|
(if (>= (the-as int v1-4) 0)
|
|
(set! (-> this button-id) (the-as int v1-4))
|
|
)
|
|
)
|
|
(when (or (res-lump-struct arg0 'next-actor structure) (res-lump-struct arg0 'prev-actor structure))
|
|
(set! (-> this link) (new 'process 'actor-link-info this))
|
|
(if (< (-> this button-id) 0)
|
|
(set! (-> this button-id) (actor-count-before (-> this link)))
|
|
)
|
|
)
|
|
(basebutton-method-27 this)
|
|
(process-drawable-from-entity! this arg0)
|
|
(let ((v1-16 #f))
|
|
(if (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status complete)))
|
|
(set! v1-16 #t)
|
|
)
|
|
(set! (-> this down?) v1-16)
|
|
)
|
|
(set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0))
|
|
(set! (-> this timeout) (res-lump-float arg0 'timeout))
|
|
(if (not (-> this spawned-by-other?))
|
|
(nav-mesh-connect this (-> this root) (the-as nav-control #f))
|
|
)
|
|
(arm-trigger-event! this)
|
|
(basebutton-method-26 this)
|
|
(go (method-of-object this basebutton-startup))
|
|
(none)
|
|
)
|
|
|
|
;; definition for function basebutton-init-by-other
|
|
;; INFO: Used lq/sq
|
|
;; INFO: 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))
|
|
(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) arg0)
|
|
)
|
|
(basebutton-method-27 self)
|
|
(set! (-> self root trans quad) (-> arg1 quad))
|
|
(quaternion-copy! (-> self root quat) arg2)
|
|
(set-vector! (-> self root scale) 1.0 1.0 1.0 1.0)
|
|
(arm-trigger-event! self)
|
|
(basebutton-method-26 self)
|
|
(go-virtual basebutton-startup)
|
|
(none)
|
|
)
|
|
|
|
;; definition for symbol *warp-info*, type (array string)
|
|
(define *warp-info* (new 'static 'boxed-array :type string
|
|
"training-warp"
|
|
"village1-warp"
|
|
"village2-warp"
|
|
"village3-warp"
|
|
"citadel-warp"
|
|
)
|
|
)
|
|
|
|
;; definition of type warp-gate
|
|
(deftype warp-gate (process-drawable)
|
|
((level symbol)
|
|
(level-slot int32)
|
|
(min-slot int32)
|
|
(max-slot int32)
|
|
)
|
|
(:state-methods
|
|
idle
|
|
active
|
|
(use int level)
|
|
hidden
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type warp-gate
|
|
(defmethod inspect ((this warp-gate))
|
|
(let ((t9-0 (method-of-type process-drawable inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tlevel: ~A~%" (-> this level))
|
|
(format #t "~T~Tlevel-slot: ~D~%" (-> this level-slot))
|
|
(format #t "~T~Tmin-slot: ~D~%" (-> this min-slot))
|
|
(format #t "~T~Tmax-slot: ~D~%" (-> this max-slot))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate use (warp-gate)
|
|
:virtual #t
|
|
:trans (behavior ()
|
|
(send-event *camera* 'joystick 0.0 0.0)
|
|
)
|
|
:code (behavior ((arg0 int) (arg1 level))
|
|
(set-time! (-> self state-time))
|
|
(when (not arg1)
|
|
(process-release? *target*)
|
|
(go-virtual idle)
|
|
)
|
|
(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* (not (logtest? (-> *target* draw status) (draw-status hidden))))
|
|
(suspend)
|
|
)
|
|
)
|
|
(else
|
|
(load-state-want-levels (-> self level) (-> arg1 load-name))
|
|
(while (or (not (member (level-status *level* (-> arg1 load-name)) '(loaded active)))
|
|
(not (time-elapsed? (-> self state-time) (seconds 2)))
|
|
)
|
|
(suspend)
|
|
)
|
|
)
|
|
)
|
|
(set-blackout-frames (seconds 0.05))
|
|
(start 'play (get-continue-by-name *game-info* (-> *warp-info* arg0)))
|
|
(logior! (-> self mask) (process-mask sleep))
|
|
(suspend)
|
|
0
|
|
)
|
|
)
|
|
|
|
;; 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 (surface-flags always-rotate-toward-transv)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate target-warp-out (target)
|
|
:event (behavior ((proc process) (argc int) (message symbol) (block event-message-block))
|
|
(case message
|
|
(('death-end)
|
|
(let ((v0-0 (the-as object (logior (-> self draw status) (draw-status hidden)))))
|
|
(set! (-> self draw status) (the-as draw-status v0-0))
|
|
v0-0
|
|
)
|
|
)
|
|
(else
|
|
(target-generic-event-handler proc argc message block)
|
|
)
|
|
)
|
|
)
|
|
:enter (behavior ((arg0 vector) (arg1 vector))
|
|
(set-time! (-> self state-time))
|
|
(logclear! (-> self control status) (cshape-moving-flags onsurf onground tsurf))
|
|
(set! (-> self control unknown-surface00) *warp-jump-mods*)
|
|
(set! (-> self control unknown-vector102 quad) (-> arg0 quad))
|
|
(set! (-> self control unknown-vector103 quad) (-> arg1 quad))
|
|
(+! (-> self control unknown-vector102 y) -4096.0)
|
|
(set! (-> self control unknown-uint20) (the-as uint #f))
|
|
(vector-reset! (-> self control transv))
|
|
(logior! (-> self state-flags) (state-flags use-alt-cam-pos))
|
|
(set! (-> self alt-cam-pos quad) (-> arg1 quad))
|
|
)
|
|
:exit (behavior ()
|
|
(logclear! (-> self state-flags) (state-flags use-alt-cam-pos))
|
|
)
|
|
:code (behavior ((arg0 vector) (arg1 vector))
|
|
(send-event *camera* 'change-state cam-fixed 0)
|
|
(ja-channel-push! 1 (seconds 0.2))
|
|
(ja-no-eval :group! eichar-duck-high-jump-ja :num! (seek! (ja-aframe 16.0 0)) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 16.0 0)))
|
|
)
|
|
(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))
|
|
)
|
|
)
|
|
)
|
|
(clear-collide-with-as (-> self control))
|
|
(set-time! (-> self state-time))
|
|
(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)
|
|
(send-event *target* 'sidekick #f)
|
|
(when (and (or (< (vector-dot gp-2 (-> self control transv)) 0.0) (-> self control unknown-spoolanim00))
|
|
(time-elapsed? (-> self state-time) (seconds 0.05))
|
|
)
|
|
(vector-seek! (-> self draw color-mult) (new 'static 'vector) (* 2.0 (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-spoolanim00))
|
|
(send-event self 'do-effect 'death-warp-out -1.0)
|
|
(let ((v0-2 #t))
|
|
(set! (-> self control unknown-uint20) (the-as uint v0-2))
|
|
v0-2
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(ja-no-eval :group! eichar-duck-high-jump-ja :num! (seek! (ja-aframe 40.0 0)) :frame-num (ja-aframe 16.0 0))
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 40.0 0)))
|
|
)
|
|
(anim-loop)
|
|
)
|
|
:post target-no-stick-post
|
|
)
|