jak-project/test/decompiler/reference/levels/maincave/spiderwebs_REF.gc

352 lines
9.6 KiB
Common Lisp
Raw Normal View History

decomp: Continuing full pass of gameplay code (#839) * decomp: finish `babak` - :code is called in `(code nav-enemy-patrol babak)` * decomp: almost finish `process-taskable` * blocked: mistycannon / pelican * decomp: finish `babak-with-cannon` write a script to fix gsrc * decomp: finish `process-taskable` * decomp: finish `flutflut` and `yakow` * decomp: finish `fishermans-boat` * blocked: state decomp `training-obs` * decomp: finish `muse` * decomp: finish `bonelurker` * blocked: state decomp in `quicksandlurker`| `balloonlurker` * decomp: finish `assistant-village2` * scripts: script to help updating goal_src * starting to update goal_src * tests: update ref tests * src: more src updating * src: waiting on `process-taskable` and `muse` * blocked: `citb-plat` state decomp * decomp: finish `square-platform` * blocked: `orbit-plat` due to overlays + static data * decomp: finish `qbert-plat` * blocked: almost finish `misty-conveyor`, sparticle-callback * blocked: jungle-mirrors * blocked: state decomp in `swamp-blimp` * decomp: finish `swamp-bat` * decomp: finish `swamp-rat` * decomp: finish `swamp-rat-nest` * blocked: state decomp `kermit` * decomp: finish `cavecrystal-light` * decomp: finish `spiderwebs` * blocked: state decomp `dark-crystal` * decomp: finish `baby-spider` * decomp: finish `mother-spider-h` * decomp: finish `mother-spider-proj` * blocked: state decomp in `gnawer` * blocked: state decomp in `driller-lurker` * blocked: `sun-exit-chamber` breaks when adding handle cast * decomp: finish `sunken-water` * blocked: `target-tube` ShortCircuitElement::push_to_stack * decomp: finish `sunken-fish` * blocked: `minecart` decomp crash when adding stack cast * decomp: finish `assistant-village3` * decomp: finish `sage-village3` * blocked: `cave-trap` done but ran into `go` issue * blocked: `spider-egg` state decomp * decomp: finish `target-snowball` * blocked/stuck: `target-ice` decomp issue around cpad * pausing: ice-cube has some weird collide-shape-prim handling * blocked: `snow-ball` state decomp * blocked: `snow-bumper` state decomp * decomp: finish `snow-ram-h` * decomp: finish `yeti` * decomp: finish `assistant-lavatube` * re-enable the float cast log * decomp: updating to new sparticle definitions * decomp: address feedback up to `swamp-rat-nest` * address remaining feedback * all-types: move the `pointer` def * add back temporary `hud-hidden?`
2021-09-28 20:42:00 -04:00
;;-*-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 #xc00
)
)
;; definition of type spiderwebs
(deftype spiderwebs (process-drawable)
((spring-height meters :offset-assert 176)
)
:heap-base #x50
:method-count-assert 20
:size-assert #xb4
:flag-assert #x14005000b4
)
;; definition for method 3 of type spiderwebs
(defmethod inspect spiderwebs ((obj spiderwebs))
(let ((t9-0 (method-of-type process-drawable inspect)))
(t9-0 obj)
)
(format #t "~T~Tspring-height: (meters ~m)~%" (-> obj spring-height))
obj
)
;; failed to figure out what this is:
(let
((v1-2
(new 'static 'skeleton-group
:art-group-name "spiderwebs"
:bounds (new 'static 'vector :w 14336.0)
:version #x6
)
)
)
(set! (-> v1-2 jgeo) 0)
(set! (-> v1-2 janim) -1)
(set! (-> v1-2 mgeo 0) (the-as uint 1))
(set! (-> v1-2 lod-dist 0) 4095996000.0)
(set! *spiderwebs-sg* v1-2)
)
;; definition for function spiderwebs-default-event-handler
;; INFO: Return type mismatch none vs object.
;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code?
(defbehavior
spiderwebs-default-event-handler spiderwebs
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(let ((v1-0 arg2))
(the-as object (cond
((= v1-0 'bonk)
(let ((a1-1 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-1 from) self)
(set! (-> a1-1 num-params) 3)
(set! (-> a1-1 message) 'jump)
(set!
(-> a1-1 param 0)
(the-as uint (-> self spring-height))
)
(set!
(-> a1-1 param 1)
(the-as uint (-> self spring-height))
)
(set! (-> a1-1 param 2) (the-as uint *spider-jump-mods*))
(if (send-event-function arg0 a1-1)
(go spiderwebs-bounce)
)
)
)
((= v1-0 '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))
)
(let
((a1-3 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-3 from) self)
(set! (-> a1-3 num-params) 3)
(set! (-> a1-3 message) 'jump)
(set!
(-> a1-3 param 0)
(the-as uint (-> self spring-height))
)
(set!
(-> a1-3 param 1)
(the-as uint (-> self spring-height))
)
(set!
(-> a1-3 param 2)
(the-as uint *spider-jump-mods*)
)
(send-event-function arg0 a1-3)
)
)
)
(go spiderwebs-bounce)
)
)
)
)
((= v1-0 'attack)
(if
(and
(= (-> arg3 param 1) 'flop)
(let ((a1-4 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-4 from) self)
(set! (-> a1-4 num-params) 3)
(set! (-> a1-4 message) 'jump)
(set!
(-> a1-4 param 0)
(the-as uint (-> self spring-height))
)
(set!
(-> a1-4 param 1)
(the-as uint (-> self spring-height))
)
(set! (-> a1-4 param 2) (the-as uint *spider-jump-mods*))
(send-event-function arg0 a1-4)
)
)
(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))
(let ((gp-0 (-> self skel root-channel 0)))
(joint-control-channel-group-eval!
gp-0
(the-as art-joint-anim (-> self draw art-group data 2))
num-func-identity
)
(set! (-> gp-0 frame-num) 0.0)
)
(transform-post)
(while #t
(logior! (-> self mask) (process-mask sleep-code))
(suspend)
)
(none)
)
)
;; failed to figure out what this is:
(defstate spiderwebs-bounce (spiderwebs)
:code
(behavior ()
(logclear! (-> self mask) (process-mask actor-pause))
(sound-play-by-name
(static-sound-name "web-tramp")
(new-sound-id)
1024
0
0
(the-as uint 1)
(the-as vector #t)
)
(let ((gp-1 (-> self skel root-channel 0)))
(set!
(-> gp-1 frame-group)
(the-as art-joint-anim (-> self draw art-group data 2))
)
(set! (-> gp-1 param 0) (ja-aframe 10.0 0))
(set! (-> gp-1 param 1) 1.0)
(set! (-> gp-1 frame-num) 0.0)
(joint-control-channel-group!
gp-1
(the-as art-joint-anim (-> self draw art-group data 2))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((gp-2 (-> self skel root-channel 0)))
(set! (-> gp-2 param 0) (ja-aframe 10.0 0))
(set! (-> gp-2 param 1) 1.0)
(joint-control-channel-group-eval!
gp-2
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(set! (-> self event-hook) (-> spiderwebs-idle event))
(let ((gp-3 (-> self skel root-channel 0)))
(set!
(-> gp-3 frame-group)
(the-as art-joint-anim (-> self draw art-group data 2))
)
(set!
(-> gp-3 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 2))
data
0
length
)
-1
)
)
)
(set! (-> gp-3 param 1) 1.0)
(set! (-> gp-3 frame-num) (ja-aframe 10.0 0))
(joint-control-channel-group!
gp-3
(the-as art-joint-anim (-> self draw art-group data 2))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-10 (-> self skel root-channel 0)))
(set!
(-> a0-10 param 0)
(the float (+ (-> a0-10 frame-group data 0 length) -1))
)
(set! (-> a0-10 param 1) 1.0)
(joint-control-channel-group-eval!
a0-10
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(go spiderwebs-idle)
(none)
)
:post
(the-as (function none :behavior spiderwebs) transform-post)
)
;; definition for method 11 of type spiderwebs
(defmethod copy-defaults! spiderwebs ((obj spiderwebs) (arg0 res-lump))
(set! (-> obj mask) (logior (process-mask platform) (-> obj mask)))
(let
((s4-0
(new 'process 'collide-shape-moving obj (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) 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) (the-as uint 2048))
(set! (-> s3-0 collide-with) (the-as uint 16))
(set! (-> s3-0 prim-core action) (the-as uint 1))
(set! (-> s3-0 prim-core offense) 4)
(set! (-> s3-0 transform-index) 3)
(set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 14336.0)
)
(dummy-46 s4-0)
(set! (-> s4-0 nav-radius) 13926.4)
(dummy-50 s4-0)
(set! (-> obj root) s4-0)
)
(process-drawable-from-entity! obj arg0)
(dummy-14 obj *spiderwebs-sg* '())
(set!
(-> obj spring-height)
(res-lump-float arg0 'spring-height :default 45056.0)
)
(ja-channel-set! 1)
(let ((a0-11 (-> obj 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 (-> 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)
)
(nav-mesh-connect obj (-> obj root) (the-as nav-control #f))
(transform-post)
(go spiderwebs-idle)
(none)
)