jak-project/goal_src/levels/maincave/spiderwebs.gc
Tyler Wilding 5f1ed7ab60
decomp: decompile *-obs files (#856)
* decomp: mostly finish `cam-master`

* decomp/scripts: lots of work in cam-states

* stash

* Merge remote-tracking branch 'water111/master' into decomp/camera-master

Updated submodule third-party/googletest

* decompiler: Add support for non power of 2 offsets for inline arr access

* decomp: mostly finish `cam-states` need to fix a macro issue

* blocked: `cam-master` decompiler crash when adding casts

* decomp: finish `cam-states-dbg`

* decomp: mostly finish `pov-camera` with the exception of joint-related code

* decomp: `cam-debug` finished decompiling, no way does this compile yet though

* decomp: considerable work done in `cam-layout`

* decomp: `cam-layout` almost done!

* decomp: `pov-camera` finished, TC tests will fail for now

* decomp: working on resolving issues

* decomp: cam-layout decompiling

* fixing more issues in cam-master...one event handler remains

* skip problematic function in `cam-master` for now

* gsrc: update res macros

* decomp: finish `cam-states`

* decomp: giving up on `cam-debug`

* tests: allow skipping state handlers in ref tests

* decomp: working through cam-layout bugs

* decomp: allow for shifting non-integers

* decomp: finalize `cam-layout` and `cam-master`

* decomp: finalize `cam-states`

* cleanup: bi-annual formatting of the casting files

* formatting

* decomp: start working on beach-obs

* blocked: `beach-obs` mostly finished, but handle cast issues and unknown `prebind` func signature

* blocked: `villagep-obs` done, `s6` not being referred to as `self`

* decomp: finish `citadel-obs`

* decomp: finish `darkcave-obs`

* blocked: need to allow `hud-h` to decompile properly (#f as static pointer)

* decomp: finish `jungle-obs`

* decomp: finish `village-obs`

* blocked: `misty-obs` handle cast issues

* decomp: finish `village2-obs`

* decomp: 1 function left in `swamp-obs`, particle related -- maybe we know now?

* decomp: finish `swamp-obs`

* blocked: `maincave-obs` handle casts

* decomp: finish `sunken-obs`

* blocked: `rolling-obs` handle casts and hud-parts

* decomp: finish `firecanyon-obs`

* decomp: finish `ogre-obs`

* blocked: `village3-obs` gives up type analysis!

* blocked: `snow-obs` has hud-parts and handle casts code

* decomp: finish `snow-flutflut-obs`

* blocked: `lavatube-obs` has s6-1 issue

* blocked: `title-obs` handle cast issues

* fixed post merge problems

* decomp: finish `jungleb-obs`

* blocked: `training-obs` has `s6-1` issue

* fix type consistency

* scripts: Extend update script to handle the game-text-id enum as well

* git: Update git attributes to effectively halve PR burden

* fixed `sound-play-by-name` signature

* fix particle definitions in firecanyon-obs

* fix func signature in racer-states

* update ref tests

* tests: update current ref tests

* tests: add `joint` to ref-tests

* tests: add `process-drawable` to ref-tests

* updated gsrc

* add back manual fix

* address most feedback, update source files

* get rid of forward declarations in `darkcave-obs`

Co-authored-by: ManDude <7569514+ManDude@users.noreply.github.com>
2021-11-05 21:29:32 -04:00

305 lines
6.8 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: spiderwebs.gc
;; name in dgo: spiderwebs
;; dgos: L1, MAI, MAINCAVE
;; DECOMP BEGINS
(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
)
)
(deftype spiderwebs (process-drawable)
((spring-height meters :offset-assert 176)
)
:heap-base #x50
:method-count-assert 20
:size-assert #xb4
:flag-assert #x14005000b4
(:states
spiderwebs-bounce
spiderwebs-idle
)
)
(defskelgroup *spiderwebs-sg* spiderwebs
0
-1
((1 (meters 999999)))
:bounds (static-spherem 0 0 0 3.5)
:longest-edge (meters 0)
)
(defbehavior
spiderwebs-default-event-handler spiderwebs
((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(case arg2
(('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)
)
)
)
(('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
)
)
)
(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)
)
)
(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
1
#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)
)
(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)
(initialize-skeleton 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)
)