jak-project/goal_src/levels/sunken/sunken-obs.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

823 lines
20 KiB
Common Lisp

;;-*-Lisp-*-
(in-package goal)
;; name: sunken-obs.gc
;; name in dgo: sunken-obs
;; dgos: L1, SUN, SUNKEN
(define-extern *seaweed-sg* skeleton-group)
(define-extern *side-to-side-plat-sg* skeleton-group)
(define-extern *sunkencam-sg* skeleton-group)
;; DECOMP BEGINS
(deftype water-vol-deadly (process-hidden)
()
:method-count-assert 15
:size-assert #x70
:flag-assert #xf00000070
)
(deftype side-to-side-plat (plat)
((part-ry float :offset-assert 264)
)
:heap-base #xa0
:method-count-assert 33
:size-assert #x10c
:flag-assert #x2100a0010c
)
(defskelgroup *side-to-side-plat-sg* side-to-side-plat
0
3
((1 (meters 20)) (2 (meters 999999)))
:bounds (static-spherem 0 0 0 14)
:longest-edge (meters 0)
)
(set!
(-> *part-group-id-table* 436)
(new 'static 'sparticle-launch-group
:length 2
:duration #xbb8
:linger-duration #x5dc
:flags (sp-group-flag use-local-clock)
:name "group-side-to-side-plat"
:launcher
(new 'static 'inline-array sparticle-group-item 2
(sp-item 1713 :fade-after (meters 60.0) :falloff-to (meters 60.0))
(sp-item 1714 :fade-after (meters 160.0) :falloff-to (meters 160.0))
)
:bounds (new 'static 'sphere :w 32768.0)
)
)
(set!
(-> *part-id-table* 1713)
(new 'static 'sparticle-launcher
:init-specs
(new 'static 'inline-array sp-field-init-spec 16
(sp-flt spt-num 4.0)
(sp-rnd-flt spt-x (meters -11.0) (meters 22.0) 1.0)
(sp-flt spt-y (meters 1.0))
(sp-int spt-rot-x 5)
(sp-flt spt-r 5324.8)
(sp-flt spt-g 4096.0)
(sp-flt spt-b 3686.4)
(sp-flt spt-vel-y (meters 0.0033333334))
(sp-flt spt-fade-b -16.383999)
(sp-int spt-timer 25)
(sp-cpuinfo-flags aux-list)
(sp-rnd-flt spt-conerot-x (degrees 140.0) (degrees 40.0) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
(sp-flt spt-conerot-radius (meters 3.0))
(sp-flt spt-rotate-y (degrees 18.0))
(sp-end)
)
)
)
(set!
(-> *part-id-table* 1714)
(new 'static 'sparticle-launcher
:init-specs
(new 'static 'inline-array sp-field-init-spec 21
(sp-tex spt-texture (new 'static 'texture-id :index #xf :page #x2))
(sp-flt spt-num 6.0)
(sp-rnd-flt spt-x (meters -11.0) (meters 22.0) 1.0)
(sp-flt spt-y (meters 1.5))
(sp-rnd-flt spt-scale-x (meters 2.0) (meters 1.0) 1.0)
(sp-copy-from-other spt-scale-y -4)
(sp-rnd-flt spt-g 0.0 64.0 1.0)
(sp-rnd-flt spt-b 128.0 128.0 1.0)
(sp-rnd-flt spt-a 16.0 32.0 1.0)
(sp-flt spt-vel-y (meters 0.01))
(sp-flt spt-fade-g -0.42666668)
(sp-flt spt-fade-a -0.32)
(sp-flt spt-accel-y -0.13653333)
(sp-flt spt-friction 0.96)
(sp-int spt-timer 150)
(sp-cpuinfo-flags bit2 bit3)
(sp-rnd-flt spt-conerot-x (degrees 130.0) (degrees 100.00001) 1.0)
(sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0)
(sp-flt spt-conerot-radius (meters 3.0))
(sp-flt spt-rotate-y (degrees 18.0))
(sp-end)
)
)
)
(defmethod get-unlit-skel side-to-side-plat ((obj side-to-side-plat))
*side-to-side-plat-sg*
)
(defmethod dummy-24 side-to-side-plat ((obj side-to-side-plat))
(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-mesh
s5-0
(the-as uint 0)
(the-as uint 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! (-> s4-0 prim-core offense) 4)
(set! (-> s4-0 transform-index) 0)
(set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 57344.0)
)
(dummy-46 s5-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)
)
0
(none)
)
(defmethod dummy-26 side-to-side-plat ((obj side-to-side-plat))
(set!
(-> obj part-ry)
(+ 16384.0 (quaternion-y-angle (-> obj root-override quat)))
)
(none)
)
(defmethod TODO-RENAME-25 side-to-side-plat ((obj side-to-side-plat))
(let ((v0-0 (create-launch-control (-> *part-group-id-table* 436) obj)))
(set! (-> obj part) v0-0)
(the-as sparticle-launch-group v0-0)
)
)
(defmethod dummy-20 side-to-side-plat ((obj side-to-side-plat))
(when (nonzero? (-> obj part))
(set!
(-> *part-id-table* 1713 init-specs 14 initial-valuef)
(-> obj part-ry)
)
(set!
(-> *part-id-table* 1714 init-specs 19 initial-valuef)
(-> obj part-ry)
)
(spawn (-> obj part) (-> obj root-override trans))
)
(none)
)
(deftype sunkencam (pov-camera)
((seq uint64 :offset-assert 224)
)
:heap-base #x80
:method-count-assert 30
:size-assert #xe8
:flag-assert #x1e008000e8
)
(defskelgroup *sunkencam-sg* sunkencam
0
-1
((1 (meters 999999)))
:bounds (static-spherem 0 0 0 10)
:longest-edge (meters 0)
)
(defmethod set-stack-size! sunkencam ((obj sunkencam))
(stack-size-set! (-> obj main-thread) 512)
(none)
)
(defstate pov-camera-playing (sunkencam)
:virtual #t
:exit
(behavior ()
(set! (-> *screen-filter* draw?) #f)
(none)
)
:code
(behavior ()
(let ((v1-0 (-> self seq)))
(cond
((zero? v1-0)
(let ((a0-0 (-> self skel root-channel 0)))
(set!
(-> a0-0 frame-group)
(the-as art-joint-anim (-> self draw art-group data 5))
)
(set!
(-> a0-0 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 5))
data
0
length
)
-1
)
)
)
(set! (-> a0-0 param 1) 1.0)
(set! (-> a0-0 frame-num) 0.0)
(joint-control-channel-group!
a0-0
(the-as art-joint-anim (-> self draw art-group data 5))
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) 1.0)
(joint-control-channel-group-eval!
a0-1
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(let ((a0-3 (-> self skel root-channel 0)))
(set!
(-> a0-3 frame-group)
(the-as art-joint-anim (-> self draw art-group data 6))
)
(set!
(-> a0-3 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 6))
data
0
length
)
-1
)
)
)
(set! (-> a0-3 param 1) 1.0)
(set! (-> a0-3 frame-num) 0.0)
(joint-control-channel-group!
a0-3
(the-as art-joint-anim (-> self draw art-group data 6))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-4 (-> self skel root-channel 0)))
(set!
(-> a0-4 param 0)
(the float (+ (-> a0-4 frame-group data 0 length) -1))
)
(set! (-> a0-4 param 1) 1.0)
(joint-control-channel-group-eval!
a0-4
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(let ((v1-45 *screen-filter*))
(set! (-> v1-45 draw?) #t)
(set! (-> v1-45 color) (new 'static 'rgba :g #x20 :b #x40 :a #x50))
)
(set-blackout-frames 30)
(let ((a0-9 (-> self skel root-channel 0)))
(set!
(-> a0-9 frame-group)
(the-as art-joint-anim (-> self draw art-group data 7))
)
(set!
(-> a0-9 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 7))
data
0
length
)
-1
)
)
)
(set! (-> a0-9 param 1) 1.0)
(set! (-> a0-9 frame-num) 0.0)
(joint-control-channel-group!
a0-9
(the-as art-joint-anim (-> self draw art-group data 7))
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!
)
)
)
(set-blackout-frames 150)
(let ((gp-0 2))
(let ((a0-13 (-> self skel root-channel 0)))
(set!
(-> a0-13 frame-group)
(the-as art-joint-anim (-> self draw art-group data 8))
)
(set!
(-> a0-13 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 8))
data
0
length
)
-1
)
)
)
(set! (-> a0-13 param 1) 1.0)
(set! (-> a0-13 frame-num) 0.0)
(joint-control-channel-group!
a0-13
(the-as art-joint-anim (-> self draw art-group data 8))
num-func-seek!
)
)
(until (ja-done? 0)
(+! gp-0 -1)
(if (zero? gp-0)
(set! (-> *screen-filter* draw?) #f)
)
(suspend)
(let ((a0-14 (-> self skel root-channel 0)))
(set!
(-> a0-14 param 0)
(the float (+ (-> a0-14 frame-group data 0 length) -1))
)
(set! (-> a0-14 param 1) 1.0)
(joint-control-channel-group-eval!
a0-14
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
(set-blackout-frames 30)
)
((= v1-0 1)
(let ((a0-18 (-> self skel root-channel 0)))
(set!
(-> a0-18 frame-group)
(the-as art-joint-anim (-> self draw art-group data 9))
)
(set!
(-> a0-18 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 9))
data
0
length
)
-1
)
)
)
(set! (-> a0-18 param 1) 1.0)
(set! (-> a0-18 frame-num) 0.0)
(joint-control-channel-group!
a0-18
(the-as art-joint-anim (-> self draw art-group data 9))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-19 (-> self skel root-channel 0)))
(set!
(-> a0-19 param 0)
(the float (+ (-> a0-19 frame-group data 0 length) -1))
)
(set! (-> a0-19 param 1) 1.0)
(joint-control-channel-group-eval!
a0-19
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(let ((v1-116 *screen-filter*))
(set! (-> v1-116 draw?) #t)
(set! (-> v1-116 color) (new 'static 'rgba :g #x20 :b #x40 :a #x50))
)
(set-blackout-frames 30)
(let ((a0-24 (-> self skel root-channel 0)))
(set!
(-> a0-24 frame-group)
(the-as art-joint-anim (-> self draw art-group data 10))
)
(set!
(-> a0-24 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 10))
data
0
length
)
-1
)
)
)
(set! (-> a0-24 param 1) 1.0)
(set! (-> a0-24 frame-num) 0.0)
(joint-control-channel-group!
a0-24
(the-as art-joint-anim (-> self draw art-group data 10))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-25 (-> self skel root-channel 0)))
(set!
(-> a0-25 param 0)
(the float (+ (-> a0-25 frame-group data 0 length) -1))
)
(set! (-> a0-25 param 1) 1.0)
(joint-control-channel-group-eval!
a0-25
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(set-blackout-frames 30)
(let ((gp-1 2))
(let ((a0-28 (-> self skel root-channel 0)))
(set!
(-> a0-28 frame-group)
(the-as art-joint-anim (-> self draw art-group data 11))
)
(set!
(-> a0-28 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 11))
data
0
length
)
-1
)
)
)
(set! (-> a0-28 param 1) 1.0)
(set! (-> a0-28 frame-num) 0.0)
(joint-control-channel-group!
a0-28
(the-as art-joint-anim (-> self draw art-group data 11))
num-func-seek!
)
)
(until (ja-done? 0)
(+! gp-1 -1)
(if (zero? gp-1)
(set! (-> *screen-filter* draw?) #f)
)
(suspend)
(let ((a0-29 (-> self skel root-channel 0)))
(set!
(-> a0-29 param 0)
(the float (+ (-> a0-29 frame-group data 0 length) -1))
)
(set! (-> a0-29 param 1) 1.0)
(joint-control-channel-group-eval!
a0-29
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
(let ((gp-2 *camera*))
(send-event gp-2 'teleport)
(send-event gp-2 'change-state cam-fixed 0)
(send-event gp-2 'change-state *camera-base-mode* 0)
)
(set! (-> self state-time) (-> *display* base-frame-counter))
(until (>= (- (-> *display* base-frame-counter) (-> self state-time)) 300)
(suspend)
)
)
((= v1-0 2)
(let ((a0-36 (-> self skel root-channel 0)))
(set!
(-> a0-36 frame-group)
(the-as art-joint-anim (-> self draw art-group data 16))
)
(set!
(-> a0-36 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 16))
data
0
length
)
-1
)
)
)
(set! (-> a0-36 param 1) 1.0)
(set! (-> a0-36 frame-num) 0.0)
(joint-control-channel-group!
a0-36
(the-as art-joint-anim (-> self draw art-group data 16))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-37 (-> self skel root-channel 0)))
(set!
(-> a0-37 param 0)
(the float (+ (-> a0-37 frame-group data 0 length) -1))
)
(set! (-> a0-37 param 1) 1.0)
(joint-control-channel-group-eval!
a0-37
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(let ((a0-39 (-> self skel root-channel 0)))
(set!
(-> a0-39 frame-group)
(the-as art-joint-anim (-> self draw art-group data 17))
)
(set!
(-> a0-39 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 17))
data
0
length
)
-1
)
)
)
(set! (-> a0-39 param 1) 0.67)
(set! (-> a0-39 frame-num) 0.0)
(joint-control-channel-group!
a0-39
(the-as art-joint-anim (-> self draw art-group data 17))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-40 (-> self skel root-channel 0)))
(set!
(-> a0-40 param 0)
(the float (+ (-> a0-40 frame-group data 0 length) -1))
)
(set! (-> a0-40 param 1) 0.67)
(joint-control-channel-group-eval!
a0-40
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
(pov-camera-play-and-reposition
(the-as joint-anim-compressed (-> self draw art-group data 18))
(new 'static 'vector :x 2449408.0 :y -1822720.0 :z -7299072.0)
0.67
)
)
((= v1-0 3)
(ambient-hint-spawn "gamcam34" (the-as vector #f) *entity-pool* 'camera)
(pov-camera-play-and-reposition
(the-as joint-anim-compressed (-> self draw art-group data 12))
(new 'static 'vector :x 2707456.0 :y -630784.0 :z -6635520.0)
1.0
)
)
((= v1-0 4)
(ambient-hint-spawn "gamcam35" (the-as vector #f) *entity-pool* 'camera)
(pov-camera-play-and-reposition
(the-as joint-anim-compressed (-> self draw art-group data 13))
(new 'static 'vector :x 2834432.0 :y -634880.0 :z -6811648.0)
1.3
)
(set! (-> self state-time) (-> *display* base-frame-counter))
(until (>= (- (-> *display* base-frame-counter) (-> self state-time)) 60)
(suspend)
)
)
((= v1-0 5)
(ambient-hint-spawn "gamcam37" (the-as vector #f) *entity-pool* 'camera)
(pov-camera-play-and-reposition
(the-as joint-anim-compressed (-> self draw art-group data 14))
(new 'static 'vector :x 2695168.0 :y -544768.0 :z -7077888.0)
1.0
)
)
((= v1-0 6)
(ambient-hint-spawn "gamcam36" (the-as vector #f) *entity-pool* 'camera)
(pov-camera-play-and-reposition
(the-as joint-anim-compressed (-> self draw art-group data 15))
(new 'static 'vector :x 2482176.0 :y -516096.0 :z -6922240.0)
1.0
)
)
(else
(suspend)
0
)
)
)
(go-virtual pov-camera-done-playing)
(none)
)
)
(deftype seaweed (process-drawable)
((anim-speed float :offset-assert 176)
)
:heap-base #x50
:method-count-assert 20
:size-assert #xb4
:flag-assert #x14005000b4
)
;; NOTE - manually added
(define-extern *seaweed* seaweed)
(defskelgroup *seaweed-sg* seaweed
0
-1
((1 (meters 999999)))
:bounds (static-spherem 0 6 0 7)
:longest-edge (meters 0)
)
(defstate seaweed-idle (seaweed)
: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!
)
)
(while (not (ja-done? 0))
(suspend)
(ja-eval)
)
(while #t
(let ((a0-2 (-> self skel root-channel 0)))
(set!
(-> a0-2 frame-group)
(the-as art-joint-anim (-> self draw art-group data 2))
)
(set!
(-> a0-2 param 0)
(the
float
(+
(->
(the-as art-joint-anim (-> self draw art-group data 2))
data
0
length
)
-1
)
)
)
(set! (-> a0-2 param 1) (-> self anim-speed))
(set! (-> a0-2 frame-num) 0.0)
(joint-control-channel-group!
a0-2
(the-as art-joint-anim (-> self draw art-group data 2))
num-func-seek!
)
)
(until (ja-done? 0)
(suspend)
(let ((a0-3 (-> self skel root-channel 0)))
(set!
(-> a0-3 param 0)
(the float (+ (-> a0-3 frame-group data 0 length) -1))
)
(set! (-> a0-3 param 1) (-> self anim-speed))
(joint-control-channel-group-eval!
a0-3
(the-as art-joint-anim #f)
num-func-seek!
)
)
)
)
(none)
)
:post
(the-as (function none :behavior seaweed) ja-post)
)
(defmethod copy-defaults! seaweed ((obj seaweed) (arg0 res-lump))
(set! (-> obj root) (new 'process 'trsqv))
(process-drawable-from-entity! obj arg0)
(initialize-skeleton obj *seaweed-sg* '())
(ja-channel-set! 1)
(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)
(rand-vu-float-range
0.0
(the float (+ (-> (if (> (-> obj skel active-channels) 0)
(-> obj skel root-channel 0 frame-group)
)
data
0
length
)
-1
)
)
)
)
)
(set! (-> obj anim-speed) (rand-vu-float-range 0.2 0.4))
(set! *seaweed* obj)
(go seaweed-idle)
(none)
)