mirror of
https://github.com/open-goal/jak-project
synced 2026-08-09 18:58:50 -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>
173 lines
6.0 KiB
Common Lisp
Vendored
Generated
173 lines
6.0 KiB
Common Lisp
Vendored
Generated
;;-*-Lisp-*-
|
|
(in-package goal)
|
|
|
|
;; definition for symbol *spider-jump-mods*, type surface
|
|
(define *spider-jump-mods* (new 'static 'surface
|
|
:name 'jump
|
|
:turnv 131072.0
|
|
:turnvv 18204.445
|
|
:tiltv 32768.0
|
|
:tiltvv 131072.0
|
|
:transv-max 49152.0
|
|
:target-speed 49152.0
|
|
:seek0 0.6
|
|
:seek90 0.6
|
|
:seek180 0.6
|
|
:fric 0.2
|
|
:nonlin-fric-dist 1.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 allow-edge-grab jump)
|
|
)
|
|
)
|
|
|
|
;; definition of type spiderwebs
|
|
(deftype spiderwebs (process-drawable)
|
|
((spring-height meters)
|
|
)
|
|
(:states
|
|
spiderwebs-bounce
|
|
spiderwebs-idle
|
|
)
|
|
)
|
|
|
|
;; definition for method 3 of type spiderwebs
|
|
(defmethod inspect ((this spiderwebs))
|
|
(let ((t9-0 (method-of-type process-drawable inspect)))
|
|
(t9-0 this)
|
|
)
|
|
(format #t "~T~Tspring-height: (meters ~m)~%" (-> this spring-height))
|
|
this
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defskelgroup *spiderwebs-sg* spiderwebs spiderwebs-good-lod0-jg -1
|
|
((spiderwebs-good-lod0-mg (meters 999999)))
|
|
:bounds (static-spherem 0 0 0 3.5)
|
|
)
|
|
|
|
;; definition for function spiderwebs-default-event-handler
|
|
(defbehavior spiderwebs-default-event-handler spiderwebs ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
|
|
(case arg2
|
|
(('bonk)
|
|
(if (send-event arg0 'jump (-> self spring-height) (-> self spring-height) *spider-jump-mods*)
|
|
(go spiderwebs-bounce)
|
|
)
|
|
)
|
|
(('touch)
|
|
(when (= (-> arg0 type) target)
|
|
(let* ((a0-8 (target-pos 0))
|
|
(f1-1 (- (-> a0-8 y) (-> self root trans y)))
|
|
)
|
|
(if (and (>= 2048.0 (fabs f1-1))
|
|
(and (>= 13516.8 (vector-vector-distance a0-8 (-> self root trans)))
|
|
(send-event arg0 'jump (-> self spring-height) (-> self spring-height) *spider-jump-mods*)
|
|
)
|
|
)
|
|
(go spiderwebs-bounce)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
(('attack)
|
|
(if (and (= (-> arg3 param 1) 'flop)
|
|
(send-event arg0 'jump (-> self spring-height) (-> self spring-height) *spider-jump-mods*)
|
|
)
|
|
(go spiderwebs-bounce)
|
|
)
|
|
#f
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate spiderwebs-idle (spiderwebs)
|
|
:event spiderwebs-default-event-handler
|
|
:code (behavior ()
|
|
(logior! (-> self mask) (process-mask actor-pause))
|
|
(ja :group! spiderwebs-bounce-ja :num! min)
|
|
(transform-post)
|
|
(loop
|
|
(logior! (-> self mask) (process-mask sleep-code))
|
|
(suspend)
|
|
)
|
|
)
|
|
)
|
|
|
|
;; failed to figure out what this is:
|
|
(defstate spiderwebs-bounce (spiderwebs)
|
|
:code (behavior ()
|
|
(logclear! (-> self mask) (process-mask actor-pause))
|
|
(sound-play "web-tramp")
|
|
(ja-no-eval :group! spiderwebs-bounce-ja :num! (seek! (ja-aframe 10.0 0)) :frame-num 0.0)
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek! (ja-aframe 10.0 0)))
|
|
)
|
|
(set! (-> self event-hook) (-> spiderwebs-idle event))
|
|
(ja-no-eval :group! spiderwebs-bounce-ja :num! (seek!) :frame-num (ja-aframe 10.0 0))
|
|
(until (ja-done? 0)
|
|
(suspend)
|
|
(ja :num! (seek!))
|
|
)
|
|
(go spiderwebs-idle)
|
|
)
|
|
:post transform-post
|
|
)
|
|
|
|
;; definition for method 11 of type spiderwebs
|
|
;; INFO: Return type mismatch object vs none.
|
|
(defmethod init-from-entity! ((this spiderwebs) (arg0 entity-actor))
|
|
(logior! (-> this mask) (process-mask platform))
|
|
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
|
|
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
|
|
(set! (-> s4-0 reaction) default-collision-reaction)
|
|
(set! (-> s4-0 no-reaction)
|
|
(the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing)
|
|
)
|
|
(let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-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))
|
|
(set! (-> s3-0 prim-core offense) (collide-offense indestructible))
|
|
(set! (-> s3-0 transform-index) 3)
|
|
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 14336.0)
|
|
(set-root-prim! s4-0 s3-0)
|
|
)
|
|
(set! (-> s4-0 nav-radius) 13926.4)
|
|
(backup-collide-with-as s4-0)
|
|
(set! (-> this root) s4-0)
|
|
)
|
|
(process-drawable-from-entity! this arg0)
|
|
(initialize-skeleton this *spiderwebs-sg* '())
|
|
(set! (-> this spring-height) (res-lump-float arg0 'spring-height :default 45056.0))
|
|
(ja-channel-set! 1)
|
|
(let ((a0-11 (-> this skel root-channel 0)))
|
|
(set! (-> a0-11 param 0) (the float (+ (-> a0-11 frame-group data 0 length) -1)))
|
|
(set! (-> a0-11 param 1) 1.0)
|
|
(joint-control-channel-group! a0-11 (the-as art-joint-anim #f) num-func-seek!)
|
|
)
|
|
(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)
|
|
)
|
|
(nav-mesh-connect this (-> this root) (the-as nav-control #f))
|
|
(transform-post)
|
|
(go spiderwebs-idle)
|
|
(none)
|
|
)
|