From 8b21a55906893ecf0558463a3f54ca3351ffad40 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Sat, 28 Jan 2023 22:02:58 +0100 Subject: [PATCH] decomp: `blerc`, `ripple`, `under-*` files (#2163) Co-authored-by: Tyler Wilding --- decompiler/analysis/variable_naming.cpp | 3 +- decompiler/config/jak2/all-types.gc | 565 ++-- .../jak2/anonymous_function_types.jsonc | 63 +- decompiler/config/jak2/hacks.jsonc | 8 +- decompiler/config/jak2/inputs.jsonc | 5 +- decompiler/config/jak2/label_types.jsonc | 7 +- decompiler/config/jak2/stack_structures.jsonc | 23 +- decompiler/config/jak2/type_casts.jsonc | 193 +- decompiler/config/jak2/var_names.jsonc | 41 + decompiler/util/data_decompile.cpp | 15 +- game/CMakeLists.txt | 2 + .../opengl_renderer/OpenGLRenderer.cpp | 4 +- game/graphics/opengl_renderer/buckets.h | 3 + .../jak2_functions/merc_blend_shape.cpp | 576 ++++ game/mips2c/jak2_functions/ripple.cpp | 604 ++++ game/mips2c/mips2c_table.cpp | 13 +- .../jak2/engine/common_objs/water-anim.gc | 9 +- goal_src/jak2/engine/data/art-h.gc | 2 +- goal_src/jak2/engine/gfx/foreground/ripple.gc | 201 +- .../jak2/engine/gfx/merc/merc-blend-shape.gc | 304 +- .../jak2/engine/physics/chain-physics-h.gc | 11 +- goal_src/jak2/engine/physics/chain-physics.gc | 8 +- .../engine/target/mech_suit/mech-states.gc | 2 +- .../engine/target/mech_suit/target-mech.gc | 1 - goal_src/jak2/engine/target/target-h.gc | 4 +- goal_src/jak2/engine/target/target-handler.gc | 16 +- goal_src/jak2/game.gp | 111 +- goal_src/jak2/levels/common/airlock.gc | 1 + goal_src/jak2/levels/hiphog/whack.gc | 1 + goal_src/jak2/levels/underport/centipede.gc | 1391 ++++++++++ goal_src/jak2/levels/underport/pipe-grunt.gc | 106 + goal_src/jak2/levels/underport/sig5-course.gc | 1932 +++++++++++++ goal_src/jak2/levels/underport/under-laser.gc | 525 ++++ goal_src/jak2/levels/underport/under-obs.gc | 2176 +++++++++++++++ .../levels/underport/under-shoot-block.gc | 2291 +++++++++++++++ .../jak2/levels/underport/under-sig-obs.gc | 1517 ++++++++++ .../jak2/levels/underport/underb-master.gc | 1158 ++++++++ .../jak2/engine/common_objs/water-anim_REF.gc | 9 +- .../reference/jak2/engine/data/art-h_REF.gc | 2 +- .../jak2/engine/gfx/foreground/ripple_REF.gc | 251 ++ .../engine/physics/chain-physics-h_REF.gc | 4 +- .../jak2/engine/physics/chain-physics_REF.gc | 8 +- .../target/mech_suit/mech-states_REF.gc | 6 +- .../jak2/engine/target/target-h_REF.gc | 2 +- .../jak2/engine/target/target-handler_REF.gc | 16 +- .../jak2/levels/underport/centipede_REF.gc | 1483 ++++++++++ .../jak2/levels/underport/pipe-grunt_REF.gc | 131 + .../jak2/levels/underport/sig5-course_REF.gc | 1996 +++++++++++++ .../jak2/levels/underport/under-laser_REF.gc | 615 ++++ .../jak2/levels/underport/under-obs_REF.gc | 2456 ++++++++++++++++ .../levels/underport/under-shoot-block_REF.gc | 2465 +++++++++++++++++ .../levels/underport/under-sig-obs_REF.gc | 1709 ++++++++++++ .../levels/underport/underb-master_REF.gc | 1279 +++++++++ test/offline/config/jak2/config.jsonc | 3 +- 54 files changed, 25877 insertions(+), 450 deletions(-) create mode 100644 game/mips2c/jak2_functions/merc_blend_shape.cpp create mode 100644 game/mips2c/jak2_functions/ripple.cpp create mode 100644 test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/centipede_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc create mode 100644 test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc diff --git a/decompiler/analysis/variable_naming.cpp b/decompiler/analysis/variable_naming.cpp index 9c11f9bcdd..ef14a994d9 100644 --- a/decompiler/analysis/variable_naming.cpp +++ b/decompiler/analysis/variable_naming.cpp @@ -739,7 +739,8 @@ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) { function.guessed_name.to_string() == "(method 74 pegasus)" || function.guessed_name.to_string() == "(method 74 crimson-guard-level)" || function.guessed_name.to_string() == "widow-handler" || - function.guessed_name.to_string() == "(method 74 hal)"; + function.guessed_name.to_string() == "(method 74 hal)" || + function.guessed_name.to_string() == "water-anim-event-handler"; } for (int block_id = 0; block_id < int(blocks.size()); block_id++) { diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 52abcb75c8..f785a7818d 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -11255,7 +11255,7 @@ (eye-anim merc-eye-anim-block :offset 4) (master-art-group-name string :offset-assert 32) ;; guessed by decompiler (master-art-group-index int32 :offset-assert 36) - (blend-shape-anim basic :offset-assert 40) + (blend-shape-anim (pointer int8) :offset-assert 40) (frames joint-anim-compressed-control :offset-assert 44) ) :method-count-assert 13 @@ -18021,9 +18021,9 @@ (turn-off (_type_ time-frame) none :behavior process 10) (update (_type_ process-drawable) none :behavior process 11) (gravity-update (_type_) none 12) - (apply-gravity (_type_ vector int) none :behavior process 13) + (apply-gravity (_type_ vector int process-drawable) none :behavior process 13) (chain-physics-method-14 (_type_ vector int) none 14) - (clamp-length (_type_ vector vector) vector 15) + (clamp-length (_type_ vector vector object process-drawable) vector 15) (chain-physics-method-16 (_type_ int) float 16) (chain-physics-method-17 (_type_ vector) none 17) ) @@ -18372,7 +18372,7 @@ (target-mech-jump float float surface) target-mech-punch target-mech-stance - (target-mech-start handle) + (target-mech-start handle float symbol) target-mech-walk target-pilot-edge-grab (target-pilot-start handle) @@ -24119,7 +24119,6 @@ ;; merc-blend-shape ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype blerc-block-header (structure) ((tag generic-merc-tag :inline :offset-assert 0) (vtx-count uint32 :offset-assert 16) @@ -24131,9 +24130,7 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype blerc-block (structure) ((output uint8 848 :offset-assert 0) ;; guessed by decompiler (header blerc-block-header :inline :offset-assert 848) @@ -24142,19 +24139,15 @@ :size-assert #x370 :flag-assert #x900000370 ) -|# -#| (deftype blerc-dcache (structure) - ((repl-mult vector 40 :offset-assert 0) ;; guessed by decompiler + ((repl-mult vector 40 :inline :offset-assert 0) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x280 :flag-assert #x900000280 ) -|# -#| (deftype blerc-globals (structure) ((first uint32 :offset-assert 0) (next uint32 :offset-assert 4) @@ -24168,9 +24161,7 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype blerc-context (structure) ((block-a blerc-block :inline :offset-assert 0) (dummy uint8 7312 :offset-assert 880) ;; guessed by decompiler @@ -24180,19 +24171,18 @@ :size-assert #x2370 :flag-assert #x900002370 ) -|# -;; (define-extern *stats-blerc* object) ;; symbol -;; (define-extern *blerc-globals* object) ;; blerc-globals -;; (define-extern blerc-stats-init function) ;; (function none) -(define-extern blerc-init (function none)) ;; +(define-extern *stats-blerc* symbol) +(define-extern *blerc-globals* blerc-globals) +(define-extern blerc-stats-init (function none)) +(define-extern blerc-init (function none)) ;; (define-extern blerc-a-fragment function) ;; function ;; (define-extern dma-from-spr function) ;; function ;; (define-extern merc-dma-chain-to-spr function) ;; function (define-extern blerc-execute (function none)) (define-extern merc-blend-shape (function process-drawable object)) -;; (define-extern setup-blerc-chains-for-one-fragment function) ;; (function object object object object object object object) -;; (define-extern setup-blerc-chains function) ;; (function merc-ctrl (pointer int16) dma-buffer none) +(define-extern setup-blerc-chains-for-one-fragment (function object object object object object object object)) +(define-extern setup-blerc-chains (function merc-ctrl (pointer int16) dma-buffer none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; merc ;; @@ -24281,7 +24271,7 @@ NOTE: There can only be 16 effects at a given time, NOOP if already at that limit!" (function ripple-wave merc-effect none)) -(define-extern ripple-update-waveform-offs (function ripple-wave-set none)) +(define-extern ripple-update-waveform-offs (function ripple-wave-set clock none)) (define-extern ripple-execute-init "TODO - Handled by MIPS2C" (function none)) (define-extern ripple-create-wave-table "TODO - Handled by MIPS2C" (function ripple-wave-set int)) (define-extern ripple-apply-wave-table "TODO - Handled by MIPS2C" (function merc-effect symbol)) @@ -47369,21 +47359,18 @@ ;; under-shoot-block ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype under-block-spawner (basic) - ((col int8 :offset-assert 4) - (row int8 :offset-assert 5) - (active-handle uint64 :offset-assert 8) - (waiting-handle uint64 :offset-assert 16) + ((col int8 :offset-assert 4) + (row int8 :offset-assert 5) + (active-handle handle :offset-assert 8) + (waiting-handle handle :offset-assert 16) (exploded-time time-frame :offset-assert 24) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) -|# -#| (deftype under-block-slot (basic) ((col int8 :offset-assert 4) (row int8 :offset-assert 5) @@ -47392,51 +47379,47 @@ :size-assert #x6 :flag-assert #x900000006 ) -|# -#| (deftype under-block-puzzle (basic) - ((auto-unlock? basic :offset-assert 4) - (cells-wide int8 :offset-assert 8) - (cells-tall int8 :offset-assert 9) - (last-block-id int8 :offset-assert 10) - (slot-mask uint8 :offset-assert 11) - (slot-mask-full uint8 :offset-assert 12) - (prev-special-attack-id uint32 :offset-assert 16) - (orient-ry float :offset-assert 20) - (spawners basic :offset-assert 24) - (slots basic :offset-assert 28) - (cells uint32 :offset-assert 32) - (pulse-ops uint32 :offset-assert 36) - (origin vector :inline :offset-assert 48) - (local-to-world matrix :inline :offset-assert 64) + ((auto-unlock? symbol :offset-assert 4) + (cells-wide int8 :offset-assert 8) + (cells-tall int8 :offset-assert 9) + (last-block-id int8 :offset-assert 10) + (slot-mask uint8 :offset-assert 11) + (slot-mask-full uint8 :offset-assert 12) + (prev-special-attack-id uint32 :offset-assert 16) + (orient-ry float :offset-assert 20) + (spawners (array under-block-spawner) :offset-assert 24) + (slots (array under-block-slot) :offset-assert 28) + (cells (pointer int32) :offset-assert 32) + (pulse-ops (pointer int8) :offset-assert 36) + (origin vector :inline :offset-assert 48) + (local-to-world matrix :inline :offset-assert 64) ) :method-count-assert 9 :size-assert #x80 :flag-assert #x900000080 ) -|# -#| (deftype under-block (process-focusable) - ((puzzle basic :offset-assert 200) - (my-parent uint32 :offset-assert 204) - (prev-attack-id uint32 :offset-assert 208) - (spawner-id int8 :offset-assert 212) - (my-id int8 :offset-assert 213) - (col int8 :offset-assert 214) - (row int8 :offset-assert 215) - (prev-col int8 :offset-assert 216) - (prev-row int8 :offset-assert 217) - (move-dir-x int8 :offset-assert 218) - (move-dir-z int8 :offset-assert 219) - (pulse-op int8 :offset-assert 220) - (pulse-pc int8 :offset-assert 221) - (pulse-ctr int8 :offset-assert 222) - (flags uint64 :offset-assert 228) - (activated-time time-frame :offset-assert 236) - (rot-axis vector :inline :offset-assert 252) - (away-from-focal-pt vector :inline :offset-assert 268) + ((puzzle under-block-puzzle :offset-assert 204) + (my-parent (pointer process) :offset-assert 208) + (prev-attack-id uint32 :offset-assert 212) + (spawner-id int8 :offset-assert 216) + (my-id int8 :offset-assert 217) + (col int8 :offset-assert 218) + (row int8 :offset-assert 219) + (prev-col int8 :offset-assert 220) + (prev-row int8 :offset-assert 221) + (move-dir-x int8 :offset-assert 222) + (move-dir-z int8 :offset-assert 223) + (pulse-op int8 :offset-assert 224) + (pulse-pc int8 :offset-assert 225) + (pulse-ctr int8 :offset-assert 226) + (flags uint64 :offset-assert 232) + (activated-time time-frame :offset-assert 240) + (rot-axis vector :inline :offset-assert 256) + (away-from-focal-pt vector :inline :offset-assert 272) ) :method-count-assert 51 :size-assert #x120 @@ -47456,57 +47439,53 @@ (fall () _type_ :state 38) (explode () _type_ :state 39) (die-fast () _type_ :state 40) - (under-block-method-41 () none 41) - (under-block-method-42 () none 42) - (under-block-method-43 () none 43) - (under-block-method-44 () none 44) - (under-block-method-45 () none 45) - (under-block-method-46 () none 46) - (under-block-method-47 () none 47) - (under-block-method-48 () none 48) - (under-block-method-49 () none 49) - (under-block-method-50 () none 50) + (under-block-method-41 (_type_ symbol) none 41) + (under-block-method-42 (_type_) none 42) + (under-block-method-43 (_type_ int int) symbol 43) + (under-block-method-44 (_type_) symbol 44) + (under-block-method-45 (_type_) none 45) + (under-block-method-46 (_type_ int int) none 46) + (under-block-method-47 (_type_ int int) int 47) + (under-block-method-48 (_type_ int int) symbol 48) + (under-block-method-49 (_type_ int int) symbol 49) + (under-block-method-50 (_type_) none 50) ) ) -|# -#| (deftype under-shoot-block (process-drawable) - ((puzzle basic :offset-assert 196) - (actor-group uint32 :offset-assert 200) - (allow-unlock? basic :offset-assert 204) + ((puzzle under-block-puzzle :offset-assert 200) + (actor-group (pointer actor-group) :offset-assert 204) + (allow-unlock? symbol :offset-assert 208) ) :method-count-assert 29 - :size-assert #xe0 - :flag-assert #x1d006000e0 + :size-assert #xd4 + :flag-assert #x1d006000d4 (:methods (idle () _type_ :state 20) (victory-locked () _type_ :state 21) (victory () _type_ :state 22) (beaten () _type_ :state 23) - (under-shoot-block-method-24 () none 24) - (under-shoot-block-method-25 () none 25) - (under-shoot-block-method-26 () none 26) - (under-shoot-block-method-27 () none 27) - (under-shoot-block-method-28 () none 28) + (under-shoot-block-method-24 (_type_ int int) none 24) + (under-shoot-block-method-25 (_type_ int int float int) none 25) + (under-shoot-block-method-26 (_type_) none 26) + (under-shoot-block-method-27 (_type_ symbol) none 27) + (under-shoot-block-method-28 (_type_) int 28) ) ) -|# -;; (define-extern *under-block-puzzles* array) -;; (define-extern *under-shoot-block-exploder-params* joint-exploder-static-params) -;; (define-extern under-block-event-handler function) -;; (define-extern cshape-reaction-under-block function) -;; (define-extern under-block-init-by-other function) -;; (define-extern under-shoot-block-event-handler function) +(define-extern *under-block-puzzles* (array under-block-puzzle)) +(define-extern *under-shoot-block-exploder-params* joint-exploder-static-params) +(define-extern under-block-event-handler (function process int symbol event-message-block object :behavior under-block)) +(define-extern cshape-reaction-under-block (function control-info collide-query vector none :behavior under-block)) +(define-extern under-block-init-by-other (function int int symbol (pointer process) none :behavior under-block)) +(define-extern under-shoot-block-event-handler (function process int symbol event-message-block object :behavior under-shoot-block)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; underb-master ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype under-warp (process-drawable) - ((interp float :offset-assert 196) + ((interp float :offset-assert 200) ) :method-count-assert 23 :size-assert #xcc @@ -47514,61 +47493,52 @@ (:methods (idle () _type_ :state 20) (die-fast () _type_ :state 21) - (die-fast () _type_ :state 22) + (under-warp-method-22 (_type_) none 22) ) ) -|# -#| (deftype underb-master (process) - ((warp-handle uint64 :offset-assert 124) - (tank-handle uint64 :offset-assert 132) - (underwater-time time-frame :offset-assert 140) - (last-air-beep-time time-frame :offset-assert 148) - (ambient-sound-id uint32 :offset-assert 156) - (air-supply float :offset-assert 160) - (air-charge-up? basic :offset-assert 164) - (under-water-pitch-mod float :offset-assert 168) - (big-room-entered basic :offset-assert 172) - (big-room-timer uint64 :offset-assert 180) - (under-plat-player-on basic :offset-assert 188) - (under-plat-is-up basic :offset-assert 192) + ((warp-handle handle :offset-assert 128) + (tank-handle handle :offset-assert 136) + (underwater-time time-frame :offset-assert 144) + (last-air-beep-time time-frame :offset-assert 152) + (ambient-sound-id sound-id :offset-assert 160) + (air-supply float :offset-assert 164) + (air-charge-up? symbol :offset-assert 168) + (under-water-pitch-mod float :offset-assert 172) + (big-room-entered symbol :offset-assert 176) + (big-room-timer time-frame :offset-assert 184) + (under-plat-player-on symbol :offset-assert 192) + (under-plat-is-up symbol :offset-assert 196) ) :method-count-assert 24 :size-assert #xc8 :flag-assert #x18005000c8 (:methods - (underb-master-method-9 () none 9) - (underb-master-method-10 () none 10) - (underb-master-method-11 () none 11) - (underb-master-method-12 () none 12) - (underb-master-method-13 () none 13) (idle () _type_ :state 14) (big-room-player-under () _type_ :state 15) (big-room-player-plat () _type_ :state 16) - (underb-master-method-17 () none 17) + (underb-master-method-17 () none 17) ;; doesn't actually exist? (big-room-player-above () _type_ :state 18) (big-room-player-falling () _type_ :state 19) (big-room-player-exiting () _type_ :state 20) (big-room-player-done () _type_ :state 21) - (underb-master-method-22 () none 22) - (underb-master-method-23 () none 23) + (under-warp-check "Used to check whether the underwater warp effect should be drawn." (_type_) symbol 22) + (spawn-air-tank-hud "Spawns or hides the air tank HUD bar." (_type_ symbol) none 23) ) ) -|# -#| (deftype under-locking (process-drawable) - ((id int8 :offset-assert 196) - (up-y float :offset-assert 200) - (down-y float :offset-assert 204) - (mode uint64 :offset-assert 212) - (which-reminder? basic :offset-assert 220) - (spooled-sound-id uint32 :offset-assert 224) - (draining-part basic :offset-assert 228) - (actor-group uint32 :offset-assert 232) - (spooled-sound-delay int32 :offset-assert 236) - (last-reminder-time time-frame :offset-assert 252) + ((id int8 :offset-assert 200) + (up-y float :offset-assert 204) + (down-y float :offset-assert 208) + (mode uint64 :offset-assert 216) + (which-reminder? symbol :offset-assert 224) + (spooled-sound-id uint32 :offset-assert 228) + (draining-part sparticle-launch-control :offset-assert 232) + (actor-group (pointer actor-group) :offset-assert 236) + (spooled-sound-delay int32 :offset-assert 240) + (last-reminder-time time-frame :offset 256) ) :method-count-assert 24 :size-assert #x108 @@ -47580,9 +47550,7 @@ (draining () _type_ :state 23) ) ) -|# -#| (deftype water-anim-under (water-anim) () :method-count-assert 29 @@ -47591,27 +47559,25 @@ (:methods ) ) -|# -;; (define-extern under-warp-init-by-other function) -;; (define-extern *underb-master* object) -;; (define-extern underb-master-event-handler function) -;; (define-extern underb-master-post function) -;; (define-extern underb-master-init-by-other function) -;; (define-extern underb-login function) -;; (define-extern underb-deactivate function) -;; (define-extern underb-activate function) -;; (define-extern ripple-for-water-anim-under ripple-wave-set) +(define-extern under-warp-init-by-other (function vector quaternion entity-actor none :behavior under-warp)) +(define-extern *underb-master* (pointer underb-master)) +(define-extern underb-master-event-handler (function process int symbol event-message-block object :behavior underb-master)) +(define-extern underb-master-post (function none :behavior underb-master)) +(define-extern underb-master-init-by-other (function level none :behavior underb-master)) +(define-extern underb-login (function level none)) +(define-extern underb-deactivate (function level none)) +(define-extern underb-activate (function level none)) +(define-extern ripple-for-water-anim-under ripple-wave-set) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; under-obs ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype bubbler (process-drawable) - ((rod-of-god-scale float :offset-assert 196) - (ambient-id uint32 :offset-assert 200) - (last-recharge-time time-frame :offset-assert 204) + ((rod-of-god-scale float :offset-assert 200) + (ambient-id uint32 :offset-assert 204) + (last-recharge-time time-frame :offset-assert 208) ) :method-count-assert 22 :size-assert #xd8 @@ -47621,19 +47587,17 @@ (hidden () _type_ :state 21) ) ) -|# -#| (deftype under-rise-plat (process-drawable) - ((up-y float :offset-assert 196) - (down-y float :offset-assert 200) - (delta-y float :offset-assert 204) - (up-threshold float :offset-assert 208) - (down-threshold float :offset-assert 212) - (last-ridden uint64 :offset-assert 220) - (ridden basic :offset-assert 228) - (rider-started basic :offset-assert 232) - (extra-id int32 :offset-assert 236) + ((up-y float :offset-assert 200) + (down-y float :offset-assert 204) + (delta-y float :offset-assert 208) + (up-threshold float :offset-assert 212) + (down-threshold float :offset-assert 216) + (last-ridden time-frame :offset-assert 224) + (ridden symbol :offset-assert 232) + (rider-started basic :offset-assert 236) + (extra-id int32 :offset-assert 240) ) :method-count-assert 26 :size-assert #xf4 @@ -47647,12 +47611,10 @@ (going-up () _type_ :state 25) ) ) -|# -#| (deftype under-buoy-base (process-drawable) - ((release basic :offset-assert 196) - (open-anim-frame float :offset-assert 200) + ((release symbol :offset-assert 200) + (open-anim-frame float :offset-assert 204) ) :method-count-assert 22 :size-assert #xd0 @@ -47662,9 +47624,7 @@ (opened () _type_ :state 21) ) ) -|# -#| (deftype under-buoy-chain (process-drawable) () :method-count-assert 21 @@ -47674,14 +47634,12 @@ (idle () _type_ :state 20) ) ) -|# -#| (deftype under-buoy-plat (rigid-body-platform) - ((orig-trans vector :inline :offset-assert 380) - (surface-height float :offset-assert 396) - (anchor-point vector :inline :offset-assert 412) - (base uint32 :offset-assert 428) + ((orig-trans vector :inline :offset-assert 384) + (surface-height float :offset-assert 400) + (anchor-point vector :inline :offset-assert 416) + (base (pointer under-buoy-base) :offset-assert 432) ) :method-count-assert 59 :size-assert #x1b4 @@ -47691,9 +47649,7 @@ (running () _type_ :state 58) ) ) -|# -#| (deftype under-mine-chain-physics (chain-physics) () :method-count-assert 18 @@ -47702,11 +47658,11 @@ (:methods ) ) -|# (deftype under-mine (process-drawable) - ((chain chain-physics :offset-assert 200) - (chain-initialized symbol :offset-assert 204) + ((root-override collide-shape-moving :offset 128 :score 1) + (chain under-mine-chain-physics :offset-assert 200) + (chain-initialized symbol :offset-assert 204) (main-mod joint-mod :offset-assert 208) (head-mod joint-mod :offset-assert 212) ) @@ -47719,36 +47675,31 @@ ) ) -#| (deftype under-lift (elevator) - ((sound-id uint32 :offset-assert 364) + ((sound-id sound-id :offset-assert 368) ) :method-count-assert 50 :size-assert #x174 :flag-assert #x3201000174 (:methods - (under-lift-method-49 () none 49) + (under-lift-method-49 (_type_ symbol) none 49) ) ) -|# -#| (deftype under-break-door (process-focusable) - ((anim basic :offset-assert 200) - (art-name basic :offset-assert 204) - (collide-mesh int32 :offset-assert 208) + ((anim art-joint-anim :offset-assert 204) + (art-name string :offset-assert 208) + (collide-mesh int32 :offset-assert 212) ) :method-count-assert 29 :size-assert #xd8 :flag-assert #x1d006000d8 (:methods - (hit () _type_ :state 27) + (hit (symbol) _type_ :state 27) (idle () _type_ :state 28) ) ) -|# -#| (deftype under-seaweed-a (process-drawable) () :method-count-assert 21 @@ -47758,9 +47709,7 @@ (idle () _type_ :state 20) ) ) -|# -#| (deftype under-seaweed-b (process-drawable) () :method-count-assert 21 @@ -47770,9 +47719,7 @@ (idle () _type_ :state 20) ) ) -|# -#| (deftype under-seaweed-c (process-drawable) () :method-count-assert 21 @@ -47782,9 +47729,7 @@ (idle () _type_ :state 20) ) ) -|# -#| (deftype under-seaweed-d (process-drawable) () :method-count-assert 21 @@ -47794,34 +47739,32 @@ (idle () _type_ :state 20) ) ) -|# -;; (define-extern under-rise-plat-event-handler function) -;; (define-extern under-buoy-base-init-by-other function) -;; (define-extern under-buoy-chain-init-by-other function) -;; (define-extern *under-buoy-plat-platform-constants* object) -;; (define-extern *under-mine-chain-setup* array) -;; (define-extern *under-mine-exploder-params* joint-exploder-static-params) +(define-extern under-rise-plat-event-handler (function process int symbol event-message-block object :behavior under-rise-plat)) +(define-extern under-buoy-base-init-by-other (function object entity-actor none :behavior under-buoy-base)) +(define-extern under-buoy-chain-init-by-other (function object entity-actor none :behavior under-buoy-chain)) +(define-extern *under-buoy-plat-platform-constants* rigid-body-platform-constants) +(define-extern *under-mine-chain-setup* (array chain-physics-setup)) +(define-extern *under-mine-exploder-params* joint-exploder-static-params) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; under-sig-obs ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype under-plat-shoot (plat) - ((draw-test-script basic :offset-assert 320) - (incoming-attack-id uint32 :offset-assert 324) - (angle-flip float :offset-assert 328) - (angle-flip-vel float :offset-assert 332) - (state-flip uint32 :offset-assert 336) - (time-flip uint32 :offset-assert 340) - (disable-track-under basic :offset-assert 344) - (dest-angle float :offset-assert 348) - (on-shake basic :offset-assert 352) - (hint-count float :offset-assert 356) - (hit-time time-frame :offset-assert 364) - (knocked-sound-time time-frame :offset-assert 364) - (axe-flip vector :inline :offset-assert 380) + ((draw-test-script script-context :offset-assert 324) + (incoming-attack-id uint32 :offset-assert 328) + (angle-flip float :offset-assert 332) + (angle-flip-vel float :offset-assert 336) + (state-flip uint32 :offset-assert 340) + (time-flip uint32 :offset-assert 344) + (disable-track-under basic :offset-assert 348) + (dest-angle float :offset-assert 352) + (on-shake basic :offset-assert 356) + (hint-count float :offset-assert 360) + (hit-time time-frame :offset-assert 368) + (knocked-sound-time time-frame :offset-assert 376) + (axe-flip vector :inline :offset-assert 384) ) :method-count-assert 39 :size-assert #x190 @@ -47832,11 +47775,10 @@ (dormant () _type_ :state 38) ) ) -|# -#| (deftype under-break-floor (process-drawable) - () + ((root-override collide-shape-moving :offset 128 :score 1) + ) :method-count-assert 23 :size-assert #xc8 :flag-assert #x17005000c8 @@ -47846,9 +47788,7 @@ (die-fast () _type_ :state 22) ) ) -|# -#| (deftype under-break-wall (process-drawable) () :method-count-assert 22 @@ -47859,11 +47799,10 @@ (die () _type_ :state 21) ) ) -|# -#| (deftype under-break-bridge (process-drawable) - ((bridge-id int8 :offset-assert 196) + ((root-override collide-shape-moving :offset 128 :score 1) + (bridge-id int8 :offset-assert 200) ) :method-count-assert 23 :size-assert #xc9 @@ -47874,9 +47813,7 @@ (die () _type_ :state 22) ) ) -|# -#| (deftype under-int-door (process-drawable) () :method-count-assert 23 @@ -47888,13 +47825,11 @@ (idle-open () _type_ :state 22) ) ) -|# -#| (deftype under-plat-long (base-plat) - ((sync sync-eased :inline :offset-assert 268) - (move-start vector :inline :offset-assert 316) - (move-end vector :inline :offset-assert 332) + ((sync sync-eased :inline :offset-assert 272) + (move-start vector :inline :offset-assert 320) + (move-end vector :inline :offset-assert 336) ) :method-count-assert 35 :size-assert #x160 @@ -47903,14 +47838,13 @@ (idle () _type_ :state 34) ) ) -|# -#| (deftype under-plat-wall (process-drawable) - ((extended-amount float :offset-assert 196) - (in-trans vector :inline :offset-assert 204) - (out-trans vector :inline :offset-assert 220) - (sync sync-paused :inline :offset-assert 236) + ((root-override collide-shape-moving :offset 128 :score 1) + (extended-amount float :offset-assert 200) + (in-trans vector :inline :offset-assert 208) + (out-trans vector :inline :offset-assert 224) + (sync sync-paused :inline :offset-assert 240) ) :method-count-assert 21 :size-assert #x108 @@ -47919,37 +47853,33 @@ (active () _type_ :state 20) ) ) -|# -#| (deftype under-pipe-growls (process-drawable) - ((volume float :offset-assert 196) - (desired-volume float :offset-assert 200) - (volume-seek-speed float :offset-assert 204) - (approach-sound-id uint32 :offset-assert 208) - (approach-play-time time-frame :offset-assert 212) + ((volume float :offset-assert 200) + (desired-volume float :offset-assert 204) + (volume-seek-speed float :offset-assert 208) + (approach-sound-id sound-id :offset-assert 212) + (approach-play-time time-frame :offset-assert 216) ) :method-count-assert 23 - :size-assert #xe8 - :flag-assert #x17007000e8 + :size-assert #xe0 + :flag-assert #x17006000e0 (:methods (block-puzzle () _type_ :state 20) (block-puzzle-fade () _type_ :state 21) (intro-shooting () _type_ :state 22) ) ) -|# -;; (define-extern cshape-reaction-under-plat-shoot function) -;; (define-extern *under-break-floor-exploder-params* joint-exploder-static-params) -;; (define-extern under-pipe-growls-post function) -;; (define-extern under-pipe-growls-init-by-other function) +(define-extern cshape-reaction-under-plat-shoot (function control-info collide-query vector vector collide-status :behavior under-plat-shoot)) +(define-extern *under-break-floor-exploder-params* joint-exploder-static-params) +(define-extern under-pipe-growls-post (function sound-id :behavior under-pipe-growls)) +(define-extern under-pipe-growls-init-by-other (function vector symbol none :behavior under-pipe-growls)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; under-laser ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype under-laser-info (basic) ((options uint8 :offset-assert 4) (laser-radius float :offset-assert 8) @@ -47962,12 +47892,11 @@ :size-assert #x1c :flag-assert #x90000001c ) -|# -#| (deftype under-laser-shadow (process-drawable) - ((info basic :offset-assert 196) - (trans-xz-offset vector :inline :offset-assert 204) + ((root-override collide-shape-moving :offset 128 :score 1) + (info under-laser-info :offset-assert 200) + (trans-xz-offset vector :inline :offset-assert 208) ) :method-count-assert 21 :size-assert #xe0 @@ -47976,11 +47905,10 @@ (idle () _type_ :state 20) ) ) -|# -#| (deftype under-laser-slave (process-drawable) - () + ((root-override collide-shape-moving :offset 128 :score 1) + ) :method-count-assert 21 :size-assert #xc8 :flag-assert #x15005000c8 @@ -47988,19 +47916,18 @@ (idle () _type_ :state 20) ) ) -|# -#| (deftype under-laser (process-drawable) - ((info basic :offset-assert 196) - (id int8 :offset-assert 200) - (lightning basic :offset-assert 204) - (draw-test-script basic :offset-assert 208) - (sync sync-eased :inline :offset-assert 212) - (laser-dir vector :inline :offset-assert 268) - (slave-trans-offset vector :inline :offset-assert 284) - (zero-pos vector :inline :offset-assert 300) - (one-pos vector :inline :offset-assert 316) + ((root-override collide-shape-moving :offset 128 :score 1) + (info under-laser-info :offset-assert 200) + (id int8 :offset-assert 204) + (lightning lightning-control :offset-assert 208) + (draw-test-script script-context :offset-assert 212) + (sync sync-eased :inline :offset-assert 216) + (laser-dir vector :inline :offset-assert 272) + (slave-trans-offset vector :inline :offset-assert 288) + (zero-pos vector :inline :offset-assert 304) + (one-pos vector :inline :offset-assert 320) ) :method-count-assert 23 :size-assert #x150 @@ -48009,32 +47936,29 @@ (:methods (dormant () _type_ :state 20) (idle () _type_ :state 21) - (under-laser-method-22 () none 22) + (under-laser-method-22 (_type_) none 22) ) ) -|# -;; (define-extern *under-laser-infos* array) -;; (define-extern under-laser-shadow-init-by-other function) -;; (define-extern under-laser-slave-init-by-other function) +(define-extern *under-laser-infos* (array under-laser-info)) +(define-extern under-laser-shadow-init-by-other (function under-laser-info vector vector none :behavior under-laser-shadow)) +(define-extern under-laser-slave-init-by-other (function none :behavior under-laser-slave)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pipe-grunt ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype pipe-grunt (grunt) - ((pipe-front vector :inline :offset-assert 700) - (pipe-dir vector :inline :offset-assert 716) + ((pipe-front vector :inline :offset-assert 704) + (pipe-dir vector :inline :offset-assert 720) ) :method-count-assert 187 :size-assert #x2e0 :flag-assert #xbb026002e0 (:methods - (pipe-grunt-method-186 () none 186) + (pipe-grunt-method-186 (_type_) vector 186) ) ) -|# ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -48144,9 +48068,8 @@ ;; centipede ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype centipede-cam (structure) - ((init? basic :offset-assert 0) + ((init? symbol :offset-assert 0) (trans vector :inline :offset-assert 16) (dir vector :inline :offset-assert 32) (track-focus-tilt float :offset-assert 48) @@ -48155,28 +48078,26 @@ :size-assert #x34 :flag-assert #x900000034 ) -|# -#| (deftype centipede (nav-enemy) - ((id int8 :offset-assert 600) - (anim-ctr int8 :offset-assert 601) - (focus-pos-hist-count int8 :offset-assert 602) - (legs-sound basic :offset-assert 604) - (grabbed-focus? basic :offset-assert 608) - (using-chan1-effects? basic :offset-assert 612) - (set-camera-mode? basic :offset-assert 616) - (talking-volume float :offset-assert 620) - (desired-talking-volume float :offset-assert 624) - (legs-volume float :offset-assert 628) - (focus-gnd-height float :offset-assert 632) - (track-focus-tilt float :offset-assert 636) - (bobbing-intensity float :offset-assert 640) - (bobbing basic :offset-assert 644) - (src-quat quaternion :inline :offset-assert 652) - (dest-quat quaternion :inline :offset-assert 668) - (cam centipede-cam :inline :offset-assert 684) - (focus-pos-hist UNKNOWN 15 :offset-assert 748) + ((id int8 :offset-assert 604) + (anim-ctr int8 :offset-assert 605) + (focus-pos-hist-count int8 :offset-assert 606) + (legs-sound ambient-sound :offset-assert 608) + (grabbed-focus? symbol :offset-assert 612) + (using-chan1-effects? symbol :offset-assert 616) + (set-camera-mode? symbol :offset-assert 620) + (talking-volume float :offset-assert 624) + (desired-talking-volume float :offset-assert 628) + (legs-volume float :offset-assert 632) + (focus-gnd-height float :offset-assert 636) + (track-focus-tilt float :offset-assert 640) + (bobbing-intensity float :offset-assert 644) + (bobbing trsqv :offset-assert 648) + (src-quat quaternion :inline :offset-assert 656) + (dest-quat quaternion :inline :offset-assert 672) + (cam centipede-cam :inline :offset-assert 688) + (focus-pos-hist vector 15 :inline :offset-assert 752) ) :method-count-assert 189 :size-assert #x3e0 @@ -48187,17 +48108,16 @@ (hidden () _type_ :state 180) (grab-cam () _type_ :state 181) (thru-grating () _type_ :state 182) - (centipede-method-183 () none 183) - (centipede-method-184 () none 184) - (centipede-method-185 () none 185) - (centipede-method-186 () none 186) - (centipede-method-187 () none 187) - (centipede-method-188 () none 188) + (centipede-method-183 (_type_) none 183) + (set-chan1-effects (_type_) none 184) + (target-close? "Is the target close enough to attack?" (_type_) symbol 185) + (centipede-method-186 (_type_) none 186) + (centipede-method-187 (_type_) none 187) + (centipede-method-188 (_type_) none 188) ) ) -|# -;; (define-extern *centipede-nav-enemy-info* nav-enemy-info) +(define-extern *centipede-nav-enemy-info* nav-enemy-info) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sig5-cent1-path0 ;; @@ -48215,41 +48135,38 @@ ;; sig5-course ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype sig5-course (bot-course) - ((chase-speeches basic :offset-assert 48) + ((chase-speeches bot-speech-list-shuffle :offset-assert 48) ) :method-count-assert 9 :size-assert #x34 :flag-assert #x900000034 ;; field default-check-too-far uses ~A with a signed load ) -|# -#| (deftype sig-under (sig) - ((shot-at-growls-index int8 :offset-assert 1068) - (growls UNKNOWN 2 :offset-assert 1076) - (next-chase-play-time time-frame :offset-assert 1092) - (grating-broken-time time-frame :offset-assert 1092) - (test-plane plane :inline :offset-assert 1100) + ((sig5-course sig5-course :offset 652 :score 1) + (shot-at-growls-index int8 :offset-assert 1072) + (growls handle 2 :offset-assert 1080) + (next-chase-play-time time-frame :offset 1096) + (grating-broken-time time-frame :offset 1096) + (test-plane plane :inline :offset-assert 1104) ) :method-count-assert 265 :size-assert #x460 :flag-assert #x10903e00460 (:methods (intro-shooting () _type_ :state 259) - (sig-under-method-260 () none 260) - (sig-under-method-261 () none 261) - (sig-under-method-262 () none 262) - (sig-under-method-263 () none 263) - (sig-under-method-264 () none 264) + (sig-under-method-260 (_type_) symbol 260) + (sig-under-method-261 (_type_ vector vector symbol) symbol 261) + (sig-under-method-262 (_type_ symbol) symbol 262) + (sig-under-method-263 (_type_) none 263) + (sig-under-method-264 (_type_) symbol 264) ) ) -|# -;; (define-extern sig5-default-check-too-far function) -;; (define-extern *sig5-course* sig5-course) +(define-extern sig5-default-check-too-far (function sig-under symbol)) +(define-extern *sig5-course* sig5-course) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; under-scenes ;; diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index 9e070e0ab4..89c6e96bc2 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -961,5 +961,66 @@ [4, "(function object)"] ], "drill-obs2": [[24, "(function process object)"]], - "drill-spool": [[2, "(function none :behavior drill-crane)"]] + "drill-spool": [[2, "(function none :behavior drill-crane)"]], + "under-sig-obs": [[28, "(function (pointer process))"]], + "sig5-course": [ + [0, "(function sig-under none)"], + [1, "(function symbol)"], + [2, "(function sig-under none)"], + [3, "(function object sig-under symbol)"], + [4, "(function sig-under none)"], + [5, "(function object sig-under symbol)"], + [6, "(function sig-under none)"], + [7, "(function object sig-under symbol)"], + [8, "(function sig-under none)"], + [9, "(function object sig-under symbol)"], + [10, "(function sig-under none)"], + [11, "(function object sig-under symbol)"], + [12, "(function sig-under none)"], + [13, "(function sig-under none)"], + [14, "(function object sig-under symbol)"], + [15, "(function sig-under none)"], + [16, "(function object sig-under symbol)"], + [17, "(function sig-under none)"], + [18, "(function sig-under none)"], + [19, "(function object sig-under symbol)"], + [20, "(function sig-under none)"], + [21, "(function object sig-under symbol)"], + [22, "(function sig-under none)"], + [23, "(function object sig-under symbol)"], + [24, "(function sig-under none)"], + [25, "(function object sig-under symbol)"], + [26, "(function sig-under none)"], + [27, "(function object sig-under symbol)"], + [28, "(function sig-under none)"], + [29, "(function object sig-under symbol)"], + [30, "(function sig-under none)"], + [31, "(function object sig-under symbol)"], + [32, "(function sig-under none)"], + [33, "(function object sig-under symbol)"], + [34, "(function sig-under none)"], + [35, "(function object sig-under symbol)"], + [36, "(function sig-under none)"], + [37, "(function object sig-under symbol)"], + [38, "(function sig-under none)"], + [39, "(function object sig-under symbol)"], + [40, "(function sig-under none)"], + [41, "(function object sig-under symbol)"], + [42, "(function sig-under none)"], + [43, "(function object sig-under symbol)"], + [44, "(function sig-under none)"], + [45, "(function object sig-under symbol)"], + [46, "(function sig-under none)"], + [47, "(function object sig-under symbol)"], + [48, "(function sig-under none)"], + [49, "(function object sig-under symbol)"], + [50, "(function sig-under none)"], + [51, "(function object sig-under symbol)"], + [52, "(function sig-under none)"], + [53, "(function object sig-under symbol)"], + [54, "(function sig-under none)"], + [55, "(function object sig-under symbol)"], + [56, "(function sig-under none)"], + [57, "(function object sig-under symbol)"] + ] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index cb2176144a..c62a2afc16 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -681,7 +681,13 @@ "(method 17 nav-engine)", "(method 18 nav-engine)", "(method 21 nav-engine)", - "(method 39 nav-state)" + "(method 39 nav-state)", + "setup-blerc-chains-for-one-fragment", + "blerc-execute", + "ripple-create-wave-table", + "ripple-execute-init", + "ripple-apply-wave-table", + "ripple-matrix-scale" ], "mips2c_jump_table_functions": {}, diff --git a/decompiler/config/jak2/inputs.jsonc b/decompiler/config/jak2/inputs.jsonc index c12402990c..1cb006961c 100644 --- a/decompiler/config/jak2/inputs.jsonc +++ b/decompiler/config/jak2/inputs.jsonc @@ -116,7 +116,7 @@ "DGO/LDJAKBRN.DGO", "DGO/TOA.DGO", // "DGO/STADBLMP.DGO", - // "DGO/UND.DGO", + "DGO/UND.DGO", // "DGO/LYSKDCD.DGO", // "DGO/HALFPIPE.DGO", // "DGO/LSAMERGD.DGO", @@ -233,6 +233,7 @@ "LPROTECT.DGO", "LSACK.DGO", "LTRNYSAM.DGO", + "LWHACK.DGO", "LWIDEA.DGO", "LWIDEB.DGO", "LWIDEC.DGO", @@ -258,6 +259,8 @@ "TOD.DGO", "TOE.DGO", "TOMBEXT.DGO", + "UNB.DGO", + "UND.DGO", "VI1.DGO", "VIN.DGO" ] diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 11d0938e3e..9f48b917da 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -1180,5 +1180,10 @@ ["L231", "uint64", true], ["L219", "uint64", true], ["L218", "uint64", true] - ] + ], + "underb-master": [["L249", "attack-info"]], + "under-laser": [["L46", "attack-info"]], + "merc-blend-shape": [["L72", "(pointer int16)", 40]], + "centipede": [["L193", "attack-info"]], + "sig5-course": [["L358", "attack-info"]] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 9b6f1a2da2..4ce337b5ce 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -1765,5 +1765,26 @@ "(method 11 fire-floor)": [[64, "matrix3"]], "(trans drill-laser-idle drill-laser)": [[16, "vector"]], "(code die drill-metalhead-eggs)": [[16, "vector"]], - "drill-falling-door-handler": [[16, "attack-info"]] + "drill-falling-door-handler": [[16, "attack-info"]], + "(method 12 city-level-info)": [[16, ["inline-array", "vector", 7]]], + "(method 25 under-shoot-block)": [[16, "matrix"]], + "(code victory under-block)": [[16, "matrix"]], + "(code sink-partially under-block)": [[16, "matrix"]], + "(code rock under-block)": [[16, "matrix"]], + "(code flip under-block)": [[16, "matrix"]], + "(code follow under-block)": [[16, "matrix"]], + "(code rise-up under-block)": [[16, "matrix"]], + "underb-master-event-handler": [[32, "vector"]], + "(method 22 under-warp)": [[32, "vector"]], + "(method 13 under-mine-chain-physics)": [[16, "vector"]], + "(method 22 under-laser)": [ + [16, "collide-query"], + [576, "event-message-block"], + [560, "vector"] + ], + "(enter idle under-laser)": [[32, "vector"]], + "merc-blend-shape": [[16, ["array", "int16", 128]]], + "(method 55 centipede)": [[64, "collide-query"]], + "(post hostile centipede)": [[16, "vector"]], + "(code intro-shooting sig-under)": [[16, "vector"]] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 2de6af5558..f8641a1e83 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -7960,7 +7960,6 @@ [96, "a1", "process-focusable"], [19, "a0", "part-tracker"] ], - "race-ring-set-particle-rotation-callback": [[1, "v1", "(pointer race-ring)"]], "(method 9 city-level-info)": [[387, "v1", "nav-segment"]], "(method 67 traffic-engine)": [ [[137, 183], "s0", "crimson-guard"], @@ -8378,5 +8377,195 @@ ["_stack_", 32, "res-tag"], [116, "v0", "(pointer float)"] ], - "(method 46 drill-mech-elevator)": [["_stack_", 16, "float"]] + "(method 46 drill-mech-elevator)": [["_stack_", 16, "float"]], + "race-ring-set-particle-rotation-callback": [ + [1, "v1", "(pointer race-ring)"] + ], + "(method 11 under-shoot-block)": [["_stack_", 16, "res-tag"]], + "(method 10 under-shoot-block)": [ + [62, "t9", "(function process-drawable none)"] + ], + "under-block-event-handler": [ + [23, "gp", "attack-info"], + [28, "gp", "attack-info"], + [53, "gp", "attack-info"], + [57, "gp", "attack-info"] + ], + "(post fall under-block)": [[26, "gp", "collide-shape-moving"]], + "(method 41 under-block)": [ + [6, "v1", "collide-shape-prim-group"], + [8, "v1", "collide-shape-prim-group"], + [15, "v1", "collide-shape-prim-group"], + [17, "v1", "collide-shape-prim-group"], + [19, "v1", "collide-shape-prim-group"], + [21, "v1", "collide-shape-prim-group"], + [27, "v1", "collide-shape-prim-group"], + [30, "v1", "collide-shape-prim-group"] + ], + "(event idle under-break-door)": [[13, "v1", "attack-info"]], + "(method 10 under-lift)": [[10, "t9", "(function process-drawable none)"]], + "(event waiting under-buoy-plat)": [[4, "v1", "attack-info"]], + "(trans idle under-buoy-chain)": [[6, "v1", "process-drawable"]], + "(code idle under-warp)": [[38, "v1", "art-joint-anim"]], + "(trans draining under-locking)": [[39, "gp", "water-anim"]], + "(code draining under-locking)": [ + [51, "v1", "water-anim"], + [80, "v1", "water-anim"] + ], + "(code filling under-locking)": [ + [15, "gp", "water-anim"], + [54, "v1", "water-anim"] + ], + "(trans filling under-locking)": [[52, "gp", "water-anim"]], + "(event idle under-buoy-base)": [[4, "v1", "attack-info"]], + "(method 11 under-rise-plat)": [ + [74, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], + "(method 29 under-buoy-plat)": [ + [9, "t9", "(function rigid-body-object float none)"] + ], + "(method 49 under-lift)": [[2, "v1", "collide-shape-prim-group"]], + "(post running under-lift)": [[4, "t9", "(function none)"]], + "(code ambush pipe-grunt)": [[23, "a1", "art-joint-anim"]], + "(trans idle under-laser-shadow)": [[7, "a1", "process-drawable"]], + "(method 11 under-laser)": [ + [106, "v0", "(pointer float)"], + ["_stack_", 64, "res-tag"] + ], + "(method 22 under-laser)": [[85, "s5", "collide-shape-prim-sphere"]], + "under-laser-slave-init-by-other": [ + [16, "s5", "under-laser"], + [22, "s5", "under-laser"], + [26, "s5", "under-laser"], + [35, "s5", "under-laser"] + ], + "under-laser-shadow-init-by-other": [[28, "v1", "under-laser"]], + "(trans idle under-laser-slave)": [ + [6, "v1", "under-laser"], + [12, "v1", "under-laser"] + ], + "(method 11 under-locking)": [["_stack_", 16, "res-tag"]], + "setup-blerc-chains": [ + [43, "v1", "int"], + [80, "s0", "int"], + [83, "a0", "int"], + [[30, 40], "s1", "merc-fragment-control"], + [41, "v1", "merc-fragment"], + [46, "v1", "(pointer uint8)"], + [59, "a0", "merc-blend-ctrl"], + [[64, 76], "s1", "merc-fragment-control"], + [77, "a1", "merc-blend-ctrl"], + [106, "v1", "(pointer uint32)"], + [108, "v1", "(pointer uint32)"] + ], + "under-block-init-by-other": [[9, "a0", "under-block"]], + "(method 142 centipede)": [[48, "s3", "process-focusable"]], + "(method 187 centipede)": [ + [111, "a0", "process-focusable"], + [114, "a0", "process-focusable"] + ], + "(method 188 centipede)": [ + [164, "s5", "art-joint-anim"], + [248, "v1", "art-joint-anim"] + ], + "(method 55 centipede)": [ + [18, "a0", "process-focusable"], + [21, "a0", "process-focusable"] + ], + "(code attack centipede)": [ + [14, "v1", "art-joint-anim"], + [79, "v1", "art-joint-anim"] + ], + "(trans attack centipede)": [[16, "v1", "process-focusable"]], + "(enter attack centipede)": [ + [43, "gp", "process-focusable"], + [46, "gp", "process-focusable"] + ], + "(method 186 centipede)": [[15, "s5", "process-focusable"]], + "(post hostile centipede)": [ + [20, "a0", "process-focusable"], + [23, "a0", "process-focusable"] + ], + "(trans hostile centipede)": [[20, "v1", "process-focusable"]], + "(method 107 centipede)": [[15, "v0", "process-focusable"]], + "(event plat-path-active under-plat-shoot)": [ + [14, "s5", "attack-info"], + [16, "s5", "attack-info"], + [26, "s4", "process-drawable"], + [28, "s3", "collide-shape"], + [34, "gp", "collide-shape"], + [173, "a0", "process-focusable"], + [165, "a0", "process-focusable"], + [163, "gp", "process-focusable"], + [176, "a0", "process-focusable"] + ], + "(post plat-path-active under-plat-shoot)": [[4, "t9", "(function none)"]], + "(enter die-falling under-plat-shoot)": [ + [9, "v1", "collide-shape-prim-group"] + ], + "(event idle under-break-floor)": [[4, "v1", "attack-info"]], + "under-pipe-growls-post": [[70, "v0", "sound-rpc-set-param"]], + "(method 11 under-plat-long)": [ + [43, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], + "(method 11 under-int-door)": [ + ["_stack_", 16, "res-tag"], + [137, "v0", "(pointer actor-group)"], + [226, "v1", "art-joint-anim"] + ], + "(code open under-int-door)": [[35, "v1", "art-joint-anim"]], + "(method 11 under-break-bridge)": [ + [173, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], + "(code broken under-break-bridge)": [ + [5, "v1", "collide-shape-prim-group"], + [7, "v1", "collide-shape-prim-group"] + ], + "(method 11 under-break-wall)": [ + [112, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], + "ripple-find-height": [[[31, 82], "s4", "mei-ripple"]], + "(method 260 sig-under)": [ + [30, "a0", "connection"], + [31, "a0", "collide-shape"], + [78, "a0", "connection"], + [79, "a0", "collide-shape"] + ], + "(code intro-shooting sig-under)": [[213, "v1", "art-joint-anim"]], + "(trans intro-shooting sig-under)": [ + [25, "a0", "process-focusable"], + [28, "a0", "process-focusable"] + ], + "(anon-function 0 sig5-course)": [[38, "v1", "sigt-wait-spot"]], + "(anon-function 2 sig5-course)": [[45, "v1", "sigt-wait-spot"]], + "(anon-function 4 sig5-course)": [[56, "v1", "sigt-wait-spot"]], + "(anon-function 6 sig5-course)": [[25, "v1", "sigt-wait-spot"]], + "(anon-function 8 sig5-course)": [[37, "v1", "sigt-wait-spot"]], + "(anon-function 10 sig5-course)": [[36, "v1", "sigt-wait-spot"]], + "(anon-function 13 sig5-course)": [[49, "v1", "sigt-wait-spot"]], + "(anon-function 15 sig5-course)": [[22, "v1", "sigt-wait-spot"]], + "(anon-function 18 sig5-course)": [[28, "v1", "sigt-wait-spot"]], + "(anon-function 20 sig5-course)": [[85, "v1", "sigt-wait-spot"]], + "(anon-function 22 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 24 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 26 sig5-course)": [[27, "v1", "sigt-wait-spot"]], + "(anon-function 28 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 30 sig5-course)": [[26, "v1", "sigt-wait-spot"]], + "(anon-function 32 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 34 sig5-course)": [[55, "v1", "sigt-wait-spot"]], + "(anon-function 36 sig5-course)": [[25, "v1", "sigt-wait-spot"]], + "(anon-function 38 sig5-course)": [[60, "v1", "sigt-wait-spot"]], + "(anon-function 40 sig5-course)": [[25, "v1", "sigt-wait-spot"]], + "(anon-function 42 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 44 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 46 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 48 sig5-course)": [[31, "v1", "sigt-wait-spot"]], + "(anon-function 50 sig5-course)": [[15, "v1", "sigt-wait-spot"]], + "(anon-function 52 sig5-course)": [[41, "v1", "sigt-wait-spot"]], + "(anon-function 54 sig5-course)": [[14, "v1", "sigt-wait-spot"]], + "(anon-function 56 sig5-course)": [[116, "v1", "sigt-wait-spot"]] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index d31fc7692b..28357a7d47 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -4044,5 +4044,46 @@ "a1-0": "tex-idx" }, "args": ["time"] + }, + "(method 22 underb-master)": { + "vars": { + "a2-0": "target-pos", + "a0-2": "tpos-offset" + } + }, + "(method 185 centipede)": { + "vars": { + "gp-0": "targ", + "a1-1": "targ-pos", + "f30-0": "y-off", + "f0-1": "dist" + } + }, + "(method 187 centipede)": { + "vars": { + "gp-0": "centipede-cam", + "s5-0": "cam-dir", + "a0-15": "proc" + } + }, + "(method 188 centipede)": { + "vars": { + "v1-2": "janim" + } + }, + "(method 186 centipede)": { + "vars": { + "s5-0": "proc", + "a1-2": "msg", + "s3-0": "cam-dir", + "s4-1": "trans-off" + } + }, + "(method 183 centipede)": { + "vars": { + "a1-0": "overlap-parms", + "f0-0": "travel-speed", + "s4-0": "bob-trans" + } } } diff --git a/decompiler/util/data_decompile.cpp b/decompiler/util/data_decompile.cpp index cbf464cc2c..36f57d377a 100644 --- a/decompiler/util/data_decompile.cpp +++ b/decompiler/util/data_decompile.cpp @@ -864,7 +864,20 @@ const std::unordered_map< 4, ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}, {"bot-course", {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}}}, - {"hal3-course", {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}}}}}}; + {"hal3-course", {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}}}, + {"sig5-course", + {{"spots", ArrayFieldDecompMeta(TypeSpec("bot-spot"), 32)}, + {"speeches", ArrayFieldDecompMeta(TypeSpec("bot-speech-info"), 16)}, + {"dirs", ArrayFieldDecompMeta(TypeSpec("vector"), 16)}, + {"speech-tunings", ArrayFieldDecompMeta(TypeSpec("bot-speech-tuning"), 16)}}}, + {"under-block-puzzle", + {{"cells", ArrayFieldDecompMeta(TypeSpec("int32"), + 4, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}, + {"pulse-ops", + ArrayFieldDecompMeta(TypeSpec("int8"), + 1, + ArrayFieldDecompMeta::Kind::REF_TO_INTEGER_ARR)}}}}}}; goos::Object decompile_structure(const TypeSpec& type, const DecompilerLabel& label, diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 064eb2b8bb..21ca6a6946 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -102,6 +102,8 @@ set(RUNTIME_SOURCE mips2c/jak2_functions/texture.cpp mips2c/jak2_functions/ocean.cpp mips2c/jak2_functions/ocean_vu0.cpp + mips2c/jak2_functions/merc_blend_shape.cpp + mips2c/jak2_functions/ripple.cpp overlord/dma.cpp overlord/fake_iso.cpp overlord/iso.cpp diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index a7ea0a71be..e3feef09c2 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -237,12 +237,14 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { // 230 init_bucket_renderer("tex-l2-pris2", BucketCategory::TEX, BucketId::TEX_L2_PRIS2); - + init_bucket_renderer("merc-l2-pris2", BucketCategory::MERC, BucketId::MERC_L2_PRIS2); init_bucket_renderer("tex-l3-pris2", BucketCategory::TEX, BucketId::TEX_L3_PRIS2); + init_bucket_renderer("merc-l3-pris2", BucketCategory::MERC, BucketId::MERC_L3_PRIS2); // 240 init_bucket_renderer("tex-l4-pris2", BucketCategory::TEX, BucketId::TEX_L4_PRIS2); + init_bucket_renderer("merc-l4-pris2", BucketCategory::MERC, BucketId::MERC_L4_PRIS2); // 250 init_bucket_renderer("tex-l0-water", BucketCategory::TEX, BucketId::TEX_L0_WATER); diff --git a/game/graphics/opengl_renderer/buckets.h b/game/graphics/opengl_renderer/buckets.h index e68b4b776e..83b0e178b1 100644 --- a/game/graphics/opengl_renderer/buckets.h +++ b/game/graphics/opengl_renderer/buckets.h @@ -157,8 +157,11 @@ enum class BucketId { TEX_L1_PRIS2 = 228, MERC_L1_PRIS2 = 229, TEX_L2_PRIS2 = 232, + MERC_L2_PRIS2 = 233, TEX_L3_PRIS2 = 236, + MERC_L3_PRIS2 = 237, TEX_L4_PRIS2 = 240, + MERC_L4_PRIS2 = 241, TEX_L0_WATER = 252, MERC_L0_WATER = 253, TFRAG_W_L0_WATER = 255, diff --git a/game/mips2c/jak2_functions/merc_blend_shape.cpp b/game/mips2c/jak2_functions/merc_blend_shape.cpp new file mode 100644 index 0000000000..69f0310355 --- /dev/null +++ b/game/mips2c/jak2_functions/merc_blend_shape.cpp @@ -0,0 +1,576 @@ +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak2/kscheme.h" +using ::jak2::intern_from_c; +namespace Mips2C::jak2 { +namespace blerc_execute { +struct Cache { + void* blerc_globals; // *blerc-globals* + void* fake_scratchpad_data; // *fake-scratchpad-data* + void* gsf_buffer; // *gsf-buffer* + void* stats_blerc; // *stats-blerc* + void* flush_cache; // flush-cache +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + u32 madr, sadr, qwc, tadr; + c->daddiu(sp, sp, -96); // daddiu sp, sp, -96 + c->sd(ra, 0, sp); // sd ra, 0(sp) + c->sq(s2, 16, sp); // sq s2, 16(sp) + c->sq(s3, 32, sp); // sq s3, 32(sp) + c->sq(s4, 48, sp); // sq s4, 48(sp) + c->sq(s5, 64, sp); // sq s5, 64(sp) + c->sq(gp, 80, sp); // sq gp, 80(sp) + c->load_symbol2(v1, cache.blerc_globals); // lw v1, *blerc-globals*(s7) + c->lwu(s5, 0, v1); // lwu s5, 0(v1) + bc = c->sgpr64(s5) == 0; // beq s5, r0, L56 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_33;} // branch non-likely + + c->addiu(v1, r0, 0); // addiu v1, r0, 0 + c->addiu(gp, r0, 0); // addiu gp, r0, 0 + c->addiu(v1, r0, 0); // addiu v1, r0, 0 + c->load_symbol2(v1, cache.gsf_buffer); // lw v1, *gsf-buffer*(s7) + c->load_symbol2(t9, cache.flush_cache); // lw t9, flush-cache(s7) + c->addiu(a0, r0, 0); // addiu a0, r0, 0 + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->addiu(v1, r0, 848); // addiu v1, r0, 848 + get_fake_spad_addr2(a0, cache.fake_scratchpad_data, 0, c);// lui a0, 28672 + c->daddu(a1, v1, a0); // daddu a1, v1, a0 + c->load_symbol2(v1, cache.blerc_globals); // lw v1, *blerc-globals*(s7) + c->daddu(v1, r0, v1); // daddu v1, r0, v1 + // nop // sll r0, r0, 0 + c->lui(a0, 4096); // lui a0, 4096 + // nop // sll r0, r0, 0 + c->ori(a0, a0, 54272); // ori a0, a0, 54272 + c->andi(a1, a1, 16383); // andi a1, a1, 16383 + +/* +block_2: + c->lw(a2, 0, a0); // lw a2, 0(a0) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->andi(a2, a2, 256); // andi a2, a2, 256 + // nop // sll r0, r0, 0 + bc = c->sgpr64(a2) != 0; // bne a2, r0, L38 + c->lw(a2, 0, v1); // lw a2, 0(v1) + if (bc) {goto block_2;} // branch non-likely +*/ + c->lw(a2, 0, v1); + + bc = c->sgpr64(a2) == 0; // beq a2, r0, L39 + // c->sw(a1, 128, a0); // sw a1, 128(a0) + sadr = c->sgpr64(a1); + if (bc) {goto block_5;} // branch non-likely + + c->addiu(v1, r0, 324); // addiu v1, r0, 324 + // c->sw(a2, 48, a0); // sw a2, 48(a0) + tadr = c->sgpr64(a2); + // c->sw(r0, 32, a0); // sw r0, 32(a0) + // Unknown instr: sync.l + // c->sw(v1, 0, a0); // sw v1, 0(a0) + spad_to_dma_blerc_chain(cache.fake_scratchpad_data, sadr, tadr); + // Unknown instr: sync.l + +block_5: + c->gprs[v1].du64[0] = 0; // or v1, r0, r0 + //beq r0, r0, L55 // beq r0, r0, L55 + // nop // sll r0, r0, 0 + goto block_31; // branch always + + +block_6: + bc = c->sgpr64(gp) != 0; // bne gp, r0, L41 + // nop // sll r0, r0, 0 + if (bc) {goto block_8;} // branch non-likely + + get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672 + c->daddu(a0, r0, v1); // daddu a0, r0, v1 + //beq r0, r0, L42 // beq r0, r0, L42 + // nop // sll r0, r0, 0 + goto block_9; // branch always + + +block_8: + c->addiu(v1, r0, 8192); // addiu v1, r0, 8192 + get_fake_spad_addr2(a0, cache.fake_scratchpad_data, 0, c);// lui a0, 28672 + c->daddu(a0, v1, a0); // daddu a0, v1, a0 + +block_9: + bc = c->sgpr64(gp) != 0; // bne gp, r0, L43 + // nop // sll r0, r0, 0 + if (bc) {goto block_11;} // branch non-likely + + c->addiu(v1, r0, 8192); // addiu v1, r0, 8192 + get_fake_spad_addr2(a1, cache.fake_scratchpad_data, 0, c);// lui a1, 28672 + c->daddu(a1, v1, a1); // daddu a1, v1, a1 + //beq r0, r0, L44 // beq r0, r0, L44 + // nop // sll r0, r0, 0 + goto block_12; // branch always + + +block_11: + get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672 + c->daddu(a1, r0, v1); // daddu a1, r0, v1 + +block_12: + c->daddiu(v1, a0, 848); // daddiu v1, a0, 848 + c->daddu(a2, r0, a0); // daddu a2, r0, a0 + c->daddiu(a3, a1, 848); // daddiu a3, a1, 848 + c->daddiu(a1, v1, 12); // daddiu a1, v1, 12 + // nop // sll r0, r0, 0 + c->lui(a2, 4096); // lui a2, 4096 + // nop // sll r0, r0, 0 + c->ori(a2, a2, 54272); // ori a2, a2, 54272 + c->andi(a3, a3, 16383); // andi a3, a3, 16383 + +/* +block_13: + c->lw(t0, 0, a2); // lw t0, 0(a2) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->andi(t0, t0, 256); // andi t0, t0, 256 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t0) != 0; // bne t0, r0, L45 + c->lw(t0, 0, a1); // lw t0, 0(a1) + if (bc) {goto block_13;} // branch non-likely +*/ + + c->lw(t0, 0, a1); + + bc = c->sgpr64(t0) == 0; // beq t0, r0, L46 + // c->sw(a3, 128, a2); // sw a3, 128(a2) + sadr = c->sgpr64(a3); + if (bc) {goto block_16;} // branch non-likely + + c->addiu(a1, r0, 324); // addiu a1, r0, 324 + // c->sw(t0, 48, a2); // sw t0, 48(a2) + tadr = c->sgpr64(t0); + // c->sw(r0, 32, a2); // sw r0, 32(a2) + // Unknown instr: sync.l + // c->sw(a1, 0, a2); // sw a1, 0(a2) + // Unknown instr: sync.l + // tadr here is bogus, it's reading something uploaded by the other transfer. + spad_to_dma_blerc_chain(cache.fake_scratchpad_data, sadr, tadr); + +block_16: + c->gprs[a1].du64[0] = 0; // or a1, r0, r0 + c->mov64(a2, a0); // or a2, a0, r0 + c->load_symbol2(a3, cache.gsf_buffer); // lw a3, *gsf-buffer*(s7) + c->daddiu(t2, a2, 880); // daddiu t2, a2, 880 + c->lb(t1, 0, t2); // lb t1, 0(t2) + // nop // sll r0, r0, 0 + c->mov64(t0, a2); // or t0, a2, r0 + c->lw(a1, 868, a2); // lw a1, 868(a2) + c->daddiu(t3, t1, 1); // daddiu t3, t1, 1 + c->mov64(t1, a3); // or t1, a3, r0 + c->sll(t8, t3, 4); // sll t8, t3, 4 + c->sll(t3, a1, 4); // sll t3, a1, 4 + c->daddu(t9, t3, a3); // daddu t9, t3, a3 + c->daddu(t3, t2, t8); // daddu t3, t2, t8 + bc = c->sgpr64(a1) == 0; // beq a1, r0, L49 + c->daddiu(ra, t2, 16); // daddiu ra, t2, 16 + if (bc) {goto block_21;} // branch non-likely + + c->lh(t5, 12, t3); // lh t5, 12(t3) + c->daddu(t2, t3, t8); // daddu t2, t3, t8 + //beq r0, r0, L48 // beq r0, r0, L48 + // nop // sll r0, r0, 0 + goto block_19; // branch always + + +block_18: + c->lh(t5, 12, t2); // lh t5, 12(t2) + c->daddu(t2, t2, t8); // daddu t2, t2, t8 + c->sq(t6, 0, t1); // sq t6, 0(t1) + c->daddiu(t1, t1, 16); // daddiu t1, t1, 16 + +block_19: + c->pcpyh(t5, t5); // pcpyh t5, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + bc = c->sgpr64(t1) != c->sgpr64(t9); // bne t1, t9, L47 + c->pcpyld(t6, t5, t5); // pcpyld t6, t5, t5 + if (bc) {goto block_18;} // branch non-likely + + c->dsubu(t3, t2, t8); // dsubu t3, t2, t8 + // nop // sll r0, r0, 0 + +block_21: + c->addiu(t1, r0, 255); // addiu t1, r0, 255 + c->addiu(t2, r0, 8192); // addiu t2, r0, 8192 + c->lb(s5, 0, t3); // lb s5, 0(t3) + c->daddiu(s4, t3, 16); // daddiu s4, t3, 16 + c->pcpyh(t1, t1); // pcpyh t1, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t1, t1, t1); // pcpyld t1, t1, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyh(t2, t2); // pcpyh t2, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pcpyld(t2, t2, t2); // pcpyld t2, t2, t2 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->mov128_gpr_gpr(t3, t1); // por t3, t1, r0 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->mov128_gpr_gpr(t4, r0); // por t4, r0, r0 + c->mfc1(r0, f31); // mfc1 r0, f31 + +block_22: + c->ld(t6, 0, ra); // ld t6, 0(ra) + c->daddu(s2, ra, t8); // daddu s2, ra, t8 + c->daddiu(ra, ra, 8); // daddiu ra, ra, 8 + c->mov64(s3, a3); // or s3, a3, r0 + c->pextlb(t6, r0, t6); // pextlb t6, r0, t6 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pmulth(t7, t6, t2); // pmulth t7, t6, t2 + c->ld(t5, 0, s2); // ld t5, 0(s2) + c->daddiu(s5, s5, -1); // daddiu s5, s5, -1 + // nop // sll r0, r0, 0 + //beq r0, r0, L52 // beq r0, r0, L52 + c->daddu(s2, s2, t8); // daddu s2, s2, t8 + goto block_24; // branch always + + +block_23: + c->pmaddh(t7, t5, t6); // pmaddh t7, t5, t6 + c->ld(t5, 0, s2); // ld t5, 0(s2) + c->daddu(s2, s2, t8); // daddu s2, s2, t8 + c->daddiu(s3, s3, 16); // daddiu s3, s3, 16 + +block_24: + c->lq(t6, 0, s3); // lq t6, 0(s3) + c->pextlb(t5, t5, r0); // pextlb t5, t5, r0 + bc = c->sgpr64(s3) != c->sgpr64(t9); // bne s3, t9, L51 + c->psrah(t5, t5, 8); // psrah t5, t5, 8 + if (bc) {goto block_23;} // branch non-likely + + // Unknown instr: pmfhl.uw t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psraw(t7, t7, 13); // psraw t7, t7, 13 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->psraw(t5, t5, 13); // psraw t5, t5, 13 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pinteh(t5, t5, t7); // pinteh t5, t5, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pminh(t3, t3, t5); // pminh t3, t3, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pmaxh(t4, t4, t5); // pmaxh t4, t4, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pminh(t5, t5, t1); // pminh t5, t5, t1 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pmaxh(t5, t5, r0); // pmaxh t5, t5, r0 + c->lq(t7, 0, s4); // lq t7, 0(s4) + c->ppacb(t5, r0, t5); // ppacb t5, r0, t5 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->ppach(t7, r0, t7); // ppach t7, r0, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->pextlh(t5, t5, t7); // pextlh t5, t5, t7 + c->mfc1(r0, f31); // mfc1 r0, f31 + c->sq(t5, 0, t0); // sq t5, 0(t0) + c->daddiu(t0, t0, 16); // daddiu t0, t0, 16 + bc = c->sgpr64(s5) != 0; // bne s5, r0, L50 + c->daddiu(s4, s4, 16); // daddiu s4, s4, 16 + if (bc) {goto block_22;} // branch non-likely + + c->load_symbol2(a3, cache.stats_blerc); // lw a3, *stats-blerc*(s7) + bc = c->sgpr64(a3) == c->sgpr64(s7); // beq a3, s7, L53 + c->load_symbol2(a3, cache.blerc_globals); // lw a3, *blerc-globals*(s7) + if (bc) {goto block_28;} // branch non-likely + + c->lw(t2, 12, a3); // lw t2, 12(a3) + c->lw(t1, 16, a3); // lw t1, 16(a3) + c->lw(t0, 20, a3); // lw t0, 20(a3) + c->lw(a2, 864, a2); // lw a2, 864(a2) + c->multu3(a1, a1, a2); // multu3 a1, a1, a2 + c->daddiu(t2, t2, 1); // daddiu t2, t2, 1 + c->daddu(a2, t1, a2); // daddu a2, t1, a2 + c->daddu(a1, t0, a1); // daddu a1, t0, a1 + c->sw(t2, 12, a3); // sw t2, 12(a3) + c->sw(a2, 16, a3); // sw a2, 16(a3) + c->sw(a1, 20, a3); // sw a1, 20(a3) + c->pcpyud(a1, t3, r0); // pcpyud a1, t3, r0 + c->pminh(t3, t3, a1); // pminh t3, t3, a1 + c->dsrl32(a1, t3, 0); // dsrl32 a1, t3, 0 + c->pminh(t3, t3, a1); // pminh t3, t3, a1 + c->dsrl(t3, t3, 16); // dsrl t3, t3, 16 + c->lh(a1, 8, a3); // lh a1, 8(a3) + c->pminh(t3, t3, a1); // pminh t3, t3, a1 + c->sh(t3, 8, a3); // sh t3, 8(a3) + c->pcpyud(a1, t4, r0); // pcpyud a1, t4, r0 + c->pmaxh(t4, t4, a1); // pmaxh t4, t4, a1 + c->dsrl32(a1, t4, 0); // dsrl32 a1, t4, 0 + c->pmaxh(t4, t4, a1); // pmaxh t4, t4, a1 + c->dsrl(t4, t4, 16); // dsrl t4, t4, 16 + c->lh(a1, 10, a3); // lh a1, 10(a3) + c->pmaxh(t4, t4, a1); // pmaxh t4, t4, a1 + c->sh(t4, 10, a3); // sh t4, 10(a3) + +block_28: + c->gprs[a1].du64[0] = 0; // or a1, r0, r0 + c->lwu(a1, 872, a0); // lwu a1, 872(a0) + c->mov64(a3, a0); // or a3, a0, r0 + c->lwu(a0, 876, a0); // lwu a0, 876(a0) + c->lui(a2, 4096); // lui a2, 4096 + // nop // sll r0, r0, 0 + c->ori(a2, a2, 53248); // ori a2, a2, 53248 + c->andi(a3, a3, 16383); // andi a3, a3, 16383 + +/* +block_29: + c->lw(t0, 0, a2); // lw t0, 0(a2) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + c->andi(t0, t0, 256); // andi t0, t0, 256 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t0) != 0; // bne t0, r0, L54 + // nop // sll r0, r0, 0 + if (bc) {goto block_29;} // branch non-likely +*/ + + + // c->sw(a3, 128, a2); // sw a3, 128(a2) + sadr = c->sgpr64(a3); + c->addiu(a3, r0, 256); // addiu a3, r0, 256 + // c->sw(a1, 16, a2); // sw a1, 16(a2) + madr = c->sgpr64(a1); + // nop // sll r0, r0, 0 + // c->sw(a0, 32, a2); // sw a0, 32(a2) + qwc = c->sgpr64(a0); + // Unknown instr: sync.l + // c->sw(a3, 0, a2); // sw a3, 0(a2) + spad_from_dma_no_sadr_off(cache.fake_scratchpad_data, madr, sadr, qwc); + // Unknown instr: sync.l + c->gprs[a0].du64[0] = 0; // or a0, r0, r0 + c->addiu(a0, r0, 1); // addiu a0, r0, 1 + c->dsubu(gp, a0, gp); // dsubu gp, a0, gp + c->lwu(s5, 12, v1); // lwu s5, 12(v1) + c->mov64(v1, s5); // or v1, s5, r0 + +block_31: + bc = c->sgpr64(s5) != 0; // bne s5, r0, L40 + // nop // sll r0, r0, 0 + if (bc) {goto block_6;} // branch non-likely + + c->mov64(v1, s7); // or v1, s7, r0 + +block_33: + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->lq(gp, 80, sp); // lq gp, 80(sp) + c->lq(s5, 64, sp); // lq s5, 64(sp) + c->lq(s4, 48, sp); // lq s4, 48(sp) + c->lq(s3, 32, sp); // lq s3, 32(sp) + c->lq(s2, 16, sp); // lq s2, 16(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 96); // daddiu sp, sp, 96 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.blerc_globals = intern_from_c("*blerc-globals*").c(); + cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c(); + cache.gsf_buffer = intern_from_c("*gsf-buffer*").c(); + cache.stats_blerc = intern_from_c("*stats-blerc*").c(); + cache.flush_cache = intern_from_c("flush-cache").c(); + gLinkedFunctionTable.reg("blerc-execute", execute, 256); +} + +} // namespace blerc_execute +} // namespace Mips2C + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak2/kscheme.h" +using ::jak2::intern_from_c; +namespace Mips2C::jak2 { +namespace setup_blerc_chains_for_one_fragment { +struct Cache { + void* blerc_globals; // *blerc-globals* + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->daddiu(sp, sp, -128); // daddiu sp, sp, -128 + c->sd(ra, 0, sp); // sd ra, 0(sp) + c->sq(s0, 16, sp); // sq s0, 16(sp) + c->sq(s1, 32, sp); // sq s1, 32(sp) + c->sq(s2, 48, sp); // sq s2, 48(sp) + c->sq(s3, 64, sp); // sq s3, 64(sp) + c->sq(s4, 80, sp); // sq s4, 80(sp) + c->sq(s5, 96, sp); // sq s5, 96(sp) + c->sq(gp, 112, sp); // sq gp, 112(sp) + c->lb(v1, 0, t0); // lb v1, 0(t0) + c->addiu(t2, r0, 0); // addiu t2, r0, 0 + c->mov128_gpr_gpr(t7, r0); // por t7, r0, r0 + c->load_symbol2(t3, cache.blerc_globals); // lw t3, *blerc-globals*(s7) + c->lw(t3, 4, t3); // lw t3, 4(t3) + c->mov64(t4, v1); // or t4, v1, r0 + +block_1: + c->lui(t7, 4096); // lui t7, 4096 + // nop // sll r0, r0, 0 + c->daddiu(t7, t7, 1); // daddiu t7, t7, 1 + // nop // sll r0, r0, 0 + bc = c->sgpr64(t3) == 0; // beq t3, r0, L11 + c->sq(t7, 0, a2); // sq t7, 0(a2) + if (bc) {goto block_3;} // branch non-likely + + c->sw(a2, 12, t3); // sw a2, 12(t3) + // nop // sll r0, r0, 0 + +block_3: + c->mov64(t3, a2); // or t3, a2, r0 + c->daddu(t6, t4, t4); // daddu t6, t4, t4 + c->daddu(t5, v1, v1); // daddu t5, v1, v1 + c->daddu(t6, t6, t4); // daddu t6, t6, t4 + c->daddu(t7, t5, v1); // daddu t7, t5, v1 + c->daddu(t5, t6, t6); // daddu t5, t6, t6 + c->daddu(t6, t7, t7); // daddu t6, t7, t7 + c->daddu(t7, t5, t5); // daddu t7, t5, t5 + c->daddiu(t6, t6, 15); // daddiu t6, t6, 15 + c->daddiu(t5, t5, 15); // daddiu t5, t5, 15 + c->andi(t6, t6, 65520); // andi t6, t6, 65520 + c->dsrl(t5, t5, 4); // dsrl t5, t5, 4 + c->daddu(t8, t2, t2); // daddu t8, t2, t2 + c->daddiu(t7, t7, 15); // daddiu t7, t7, 15 + c->daddu(t9, t8, t2); // daddu t9, t8, t2 + c->dsrl(t8, t7, 4); // dsrl t8, t7, 4 + c->daddu(ra, t9, t9); // daddu ra, t9, t9 + c->addiu(t9, r0, 0); // addiu t9, r0, 0 + c->daddu(t7, ra, ra); // daddu t7, ra, ra + c->daddiu(s3, a2, 32); // daddiu s3, a2, 32 + c->daddu(s2, ra, a3); // daddu s2, ra, a3 + c->daddu(ra, t7, t1); // daddu ra, t7, t1 + c->lui(t7, 12288); // lui t7, 12288 + c->daddiu(gp, a0, -1); // daddiu gp, a0, -1 + c->daddu(t7, t7, t5); // daddu t7, t7, t5 + c->mov64(s5, a1); // or s5, a1, r0 + c->sq(t7, 0, s3); // sq t7, 0(s3) + c->daddiu(s4, t0, 2); // daddiu s4, t0, 2 + c->sw(s2, 4, s3); // sw s2, 4(s3) + c->daddu(s2, s2, t6); // daddu s2, s2, t6 + c->daddiu(s3, s3, 16); // daddiu s3, s3, 16 + // nop // sll r0, r0, 0 + +block_4: + c->lb(s1, 0, s4); // lb s1, 0(s4) + c->daddiu(s4, s4, 1); // daddiu s4, s4, 1 + c->lh(s0, 0, s5); // lh s0, 0(s5) + c->daddiu(s5, s5, 2); // daddiu s5, s5, 2 + bc = c->sgpr64(s1) == 0; // beq s1, r0, L13 + c->sq(t7, 0, s3); // sq t7, 0(s3) + if (bc) {goto block_7;} // branch non-likely + + c->sw(s2, 4, s3); // sw s2, 4(s3) + c->daddu(s2, s2, t6); // daddu s2, s2, t6 + bc = c->sgpr64(s0) == 0; // beq s0, r0, L13 + c->sw(s0, 12, s3); // sw s0, 12(s3) + if (bc) {goto block_7;} // branch non-likely + + c->daddiu(s3, s3, 16); // daddiu s3, s3, 16 + c->daddiu(t9, t9, 1); // daddiu t9, t9, 1 + +block_7: + bc = c->sgpr64(gp) != 0; // bne gp, r0, L12 + c->daddiu(gp, gp, -1); // daddiu gp, gp, -1 + if (bc) {goto block_4;} // branch non-likely + + c->sq(t7, 0, s3); // sq t7, 0(s3) + c->mov128_gpr_gpr(t6, r0); // por t6, r0, r0 + c->sw(ra, 4, s3); // sw ra, 4(s3) + get_fake_spad_addr2(t6, cache.fake_scratchpad_data, 0, c);// lui t6, 28672 + c->sb(t8, 0, s3); // sb t8, 0(s3) + // nop // sll r0, r0, 0 + c->sq(t6, 16, s3); // sq t6, 16(s3) + c->daddiu(t6, s3, 32); // daddiu t6, s3, 32 + c->sw(t9, 20, a2); // sw t9, 20(a2) + // nop // sll r0, r0, 0 + c->sw(t4, 16, a2); // sw t4, 16(a2) + // nop // sll r0, r0, 0 + c->sw(ra, 24, a2); // sw ra, 24(a2) + // nop // sll r0, r0, 0 + c->sw(t8, 28, a2); // sw t8, 28(a2) + // nop // sll r0, r0, 0 + bc = c->sgpr64(t4) != c->sgpr64(v1); // bne t4, v1, L14 + c->daddiu(t5, t5, 1); // daddiu t5, t5, 1 + if (bc) {goto block_11;} // branch non-likely + + c->daddiu(t7, t9, 3); // daddiu t7, t9, 3 + c->multu3(t5, t5, t7); // multu3 t5, t5, t7 + c->daddiu(t5, t5, -457); // daddiu t5, t5, -457 + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(t5)) <= 0; // blez t5, L14 + // nop // sll r0, r0, 0 + if (bc) {goto block_11;} // branch non-likely + + //beq r0, r0, L10 // beq r0, r0, L10 + c->addiu(t4, r0, 24); // addiu t4, r0, 24 + goto block_1; // branch always + + +block_11: + c->mov64(a2, t6); // or a2, t6, r0 + c->daddu(t2, t2, t4); // daddu t2, t2, t4 + bc = c->sgpr64(t2) == c->sgpr64(v1); // beq t2, v1, L15 + c->daddu(t5, t2, t4); // daddu t5, t2, t4 + if (bc) {goto block_14;} // branch non-likely + + c->dsubu(t5, t5, v1); // dsubu t5, t5, v1 + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(t5)) <= 0; // blez t5, L10 + // nop // sll r0, r0, 0 + if (bc) {goto block_1;} // branch non-likely + + //beq r0, r0, L10 // beq r0, r0, L10 + c->dsubu(t4, v1, t2); // dsubu t4, v1, t2 + goto block_1; // branch always + + +block_14: + c->load_symbol2(v1, cache.blerc_globals); // lw v1, *blerc-globals*(s7) + c->sw(t3, 4, v1); // sw t3, 4(v1) + c->mov64(v0, a2); // or v0, a2, r0 + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->lq(gp, 112, sp); // lq gp, 112(sp) + c->lq(s5, 96, sp); // lq s5, 96(sp) + c->lq(s4, 80, sp); // lq s4, 80(sp) + c->lq(s3, 64, sp); // lq s3, 64(sp) + c->lq(s2, 48, sp); // lq s2, 48(sp) + c->lq(s1, 32, sp); // lq s1, 32(sp) + c->lq(s0, 16, sp); // lq s0, 16(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 128); // daddiu sp, sp, 128 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.blerc_globals = intern_from_c("*blerc-globals*").c(); + cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("setup-blerc-chains-for-one-fragment", execute, 256); +} + +} // namespace setup_blerc_chains_for_one_fragment +} // namespace Mips2C \ No newline at end of file diff --git a/game/mips2c/jak2_functions/ripple.cpp b/game/mips2c/jak2_functions/ripple.cpp new file mode 100644 index 0000000000..ecb6b05ca9 --- /dev/null +++ b/game/mips2c/jak2_functions/ripple.cpp @@ -0,0 +1,604 @@ +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak2/kscheme.h" +using ::jak2::intern_from_c; +namespace Mips2C::jak2 { + +struct RippleVu0 { + Vf data_mem[256]; + void sq(const Vf& reg, u16 addr) { + ASSERT(addr < 256); + data_mem[addr] = reg; + } + Vf lq(u16 addr) { + ASSERT(addr < 256); + return data_mem[addr]; + } +} gRippleVu0; + +namespace ripple_execute_init { +struct Cache { + void* cos_poly_vec; // *cos-poly-vec* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->load_symbol2(v1, cache.cos_poly_vec); // lw v1, *cos-poly-vec*(s7) + c->lqc2(vf7, 0, v1); // lqc2 vf7, 0(v1) + c->lui(v1, 15561); // lui v1, 15561 + c->ori(v1, v1, 4058); // ori v1, v1, 4058 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->mfc1(v1, f0); // mfc1 v1, f0 + c->mov128_vf_gpr(vf6, v1); // qmtc2.i vf6, v1 + c->mov128_gpr_vf(v1, vf6); // qmfc2.i v1, vf6 + c->addiu(v1, r0, 128); // addiu v1, r0, 128 + u16 vi2 = c->gpr_src(v1).du16[0]; // ctc2.i vi2, v1 + c->gprs[v1].du64[0] = vi2; // cfc2.i v1, vi2 + c->lui(v1, 16256); // lui v1, 16256 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->mfc1(v1, f0); // mfc1 v1, f0 + c->mov128_vf_gpr(vf9, v1); // qmtc2.i vf9, v1 + c->mov128_gpr_vf(v1, vf9); // qmfc2.i v1, vf9 + u16 vi1 = 0; // viaddi vi1, vi0, 0 + c->addiu(v1, r0, 128); // addiu v1, r0, 128 + c->vmove(DEST::xyzw, vf5, vf6); // vmove.xyzw vf5, vf6 + +block_1: + c->vmul(DEST::xyzw, vf1, vf5, vf5); // vmul.xyzw vf1, vf5, vf5 + c->vadda_bc(DEST::xyzw, BC::w, vf0, vf0); // vaddaw.xyzw acc, vf0, vf0 + c->vadd(DEST::x, vf5, vf5, vf6); // vadd.x vf5, vf5, vf6 + c->vsub_bc(DEST::y, BC::x, vf9, vf0, vf9); // vsubx.y vf9, vf0, vf9 + c->vmul(DEST::xyzw, vf2, vf1, vf1); // vmul.xyzw vf2, vf1, vf1 + c->vmadda_bc(DEST::xyzw, BC::x, vf1, vf7); // vmaddax.xyzw acc, vf1, vf7 + c->vmul(DEST::xyzw, vf3, vf2, vf1); // vmul.xyzw vf3, vf2, vf1 + c->vmadda_bc(DEST::xyzw, BC::y, vf2, vf7); // vmadday.xyzw acc, vf2, vf7 + c->vmul(DEST::xyzw, vf4, vf2, vf2); // vmul.xyzw vf4, vf2, vf2 + c->vmadda_bc(DEST::xyzw, BC::z, vf3, vf7); // vmaddaz.xyzw acc, vf3, vf7 + c->daddiu(v1, v1, -1); // daddiu v1, v1, -1 + c->vmadd_bc(DEST::xyzw, BC::w, vf8, vf4, vf7); // vmaddw.xyzw vf8, vf4, vf7 + c->vadd_bc(DEST::y, BC::x, vf9, vf9, vf8); // vaddx.y vf9, vf9, vf8 + c->vsub(DEST::xyzw, vf10, vf0, vf9); // vsub.xyzw vf10, vf0, vf9 + gRippleVu0.sq(c->vfs[vf9].vf, vi1++); // vsqi.xyzw vf9, vi1 + c->vmove(DEST::xyzw, vf9, vf8); // vmove.xyzw vf9, vf8 + bc = c->sgpr64(v1) != 0; // bne v1, r0, L40 + gRippleVu0.sq(c->vfs[vf10].vf, vi2++); // vsqi.xyzw vf10, vi2 + if (bc) {goto block_1;} // branch non-likely + + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.cos_poly_vec = intern_from_c("*cos-poly-vec*").c(); + gLinkedFunctionTable.reg("ripple-execute-init", execute, 32); +} + +} // namespace ripple_execute_init +} // namespace Mips2C + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak2/kscheme.h" +using ::jak2::intern_from_c; +namespace Mips2C::jak2 { +namespace ripple_create_wave_table { +struct Cache { + void* display; // *display* + void* fake_scratchpad_data; // *fake-scratchpad-data* + void* setting_control; // *setting-control* + void* atan; // atan + void* cos; // cos + void* ntsc; // ntsc + void* pal; // pal + void* ripple_update_waveform_offs; // ripple-update-waveform-offs + void* sin; // sin +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u16 vi1, vi2; + u32 call_addr = 0; + c->daddiu(sp, sp, -80); // daddiu sp, sp, -80 + c->sd(ra, 0, sp); // sd ra, 0(sp) + c->sq(s4, 16, sp); // sq s4, 16(sp) + c->sq(s5, 32, sp); // sq s5, 32(sp) + c->sq(gp, 48, sp); // sq gp, 48(sp) + c->swc1(f28, 64, sp); // swc1 f28, 64(sp) + c->swc1(f30, 68, sp); // swc1 f30, 68(sp) + c->mov64(gp, a0); // or gp, a0, r0 + c->lwu(v1, 4, gp); // lwu v1, 4(gp) + bc = c->sgpr64(s7) != c->sgpr64(v1); // bne s7, v1, L31 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_9;} // branch non-likely + + c->addiu(s5, r0, 0); // addiu s5, r0, 0 + //beq r0, r0, L30 // beq r0, r0, L30 + // nop // sll r0, r0, 0 + goto block_7; // branch always + + +block_2: + c->addiu(v1, r0, 28); // addiu v1, r0, 28 + c->mult3(v1, v1, s5); // mult3 v1, v1, s5 + c->daddiu(v1, v1, 12); // daddiu v1, v1, 12 + c->daddu(s4, v1, gp); // daddu s4, v1, gp + c->load_symbol2(t9, cache.atan); // lw t9, atan(s7) + c->lh(v1, 10, s4); // lh v1, 10(s4) + c->mtc1(f0, v1); // mtc1 f0, v1 + c->cvtsw(f0, f0); // cvt.s.w f0, f0 + c->mfc1(a0, f0); // mfc1 a0, f0 + c->lh(v1, 8, s4); // lh v1, 8(s4) + c->mtc1(f0, v1); // mtc1 f0, v1 + c->cvtsw(f0, f0); // cvt.s.w f0, f0 + c->mfc1(a1, f0); // mfc1 a1, f0 + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->mtc1(f28, v0); // mtc1 f28, v0 + c->lui(v1, 16768); // lui v1, 16768 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->lh(v1, 8, s4); // lh v1, 8(s4) + c->lh(a0, 8, s4); // lh a0, 8(s4) + c->mult3(v1, v1, a0); // mult3 v1, v1, a0 + c->lh(a0, 10, s4); // lh a0, 10(s4) + c->lh(a1, 10, s4); // lh a1, 10(s4) + c->mult3(a0, a0, a1); // mult3 a0, a0, a1 + c->daddu(v1, v1, a0); // daddu v1, v1, a0 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->cvtsw(f1, f1); // cvt.s.w f1, f1 + c->sqrts(f1, f1); // sqrt.s f1, f1 + c->divs(f30, f0, f1); // div.s f30, f0, f1 + c->load_symbol2(t9, cache.cos); // lw t9, cos(s7) + c->mfc1(a0, f28); // mfc1 a0, f28 + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->mtc1(f0, v0); // mtc1 f0, v0 + c->lui(v1, 18304); // lui v1, 18304 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->divs(f1, f1, f30); // div.s f1, f1, f30 + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->swc1(f0, 16, s4); // swc1 f0, 16(s4) + c->load_symbol2(t9, cache.sin); // lw t9, sin(s7) + c->mfc1(a0, f28); // mfc1 a0, f28 + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + c->mtc1(f0, v0); // mtc1 f0, v0 + c->lui(v1, 18304); // lui v1, 18304 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->divs(f1, f1, f30); // div.s f1, f1, f30 + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->swc1(f0, 20, s4); // swc1 f0, 20(s4) + c->load_symbol2(v1, cache.setting_control); // lw v1, *setting-control*(s7) + c->lwu(v1, 72, v1); // lwu v1, 72(v1) + c->load_symbol_addr(a0, cache.ntsc); // daddiu a0, s7, ntsc + bc = c->sgpr64(v1) != c->sgpr64(a0); // bne v1, a0, L28 + c->mov64(a0, s7); // or a0, s7, r0 + if (bc) {goto block_4;} // branch non-likely + + c->lui(v1, 15496); // lui v1, 15496 + c->ori(v1, v1, 34953); // ori v1, v1, 34953 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->lui(v1, -14464); // lui v1, -14464 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->divs(f1, f1, f30); // div.s f1, f1, f30 + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->lwc1(f1, 12, s4); // lwc1 f1, 12(s4) + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->swc1(f0, 24, s4); // swc1 f0, 24(s4) + c->mfc1(v1, f0); // mfc1 v1, f0 + //beq r0, r0, L29 // beq r0, r0, L29 + // nop // sll r0, r0, 0 + goto block_6; // branch always + + +block_4: + c->load_symbol_addr(a0, cache.pal); // daddiu a0, s7, pal + bc = c->sgpr64(v1) != c->sgpr64(a0); // bne v1, a0, L29 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_6;} // branch non-likely + + c->lui(v1, 15523); // lui v1, 15523 + c->ori(v1, v1, 55050); // ori v1, v1, 55050 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->lui(v1, -14464); // lui v1, -14464 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->divs(f1, f1, f30); // div.s f1, f1, f30 + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->lwc1(f1, 12, s4); // lwc1 f1, 12(s4) + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->swc1(f0, 24, s4); // swc1 f0, 24(s4) + c->mfc1(v1, f0); // mfc1 v1, f0 + +block_6: + c->daddiu(s5, s5, 1); // daddiu s5, s5, 1 + +block_7: + c->lw(v1, 0, gp); // lw v1, 0(gp) + c->slt(v1, s5, v1); // slt v1, s5, v1 + bc = c->sgpr64(v1) != 0; // bne v1, r0, L27 + // nop // sll r0, r0, 0 + if (bc) {goto block_2;} // branch non-likely + + c->mov64(v1, s7); // or v1, s7, r0 + c->mov64(v1, s7); // or v1, s7, r0 + c->daddiu(v1, s7, 4); // daddiu v1, s7, #t + c->sw(v1, 4, gp); // sw v1, 4(gp) + +block_9: + c->load_symbol2(t9, cache.ripple_update_waveform_offs);// lw t9, ripple-update-waveform-offs(s7) + c->mov64(a0, gp); // or a0, gp, r0 + c->load_symbol2(v1, cache.display); // lw v1, *display*(s7) + c->lwu(a1, 72, v1); // lwu a1, 72(v1) + call_addr = c->gprs[t9].du32[0]; // function call: + c->sll(v0, ra, 0); // sll v0, ra, 0 + c->jalr(call_addr); // jalr ra, t9 + get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672 + c->addiu(a0, r0, 64); // addiu a0, r0, 64 + c->mov64(a1, v1); // or a1, v1, r0 + +block_10: + c->daddiu(a0, a0, -1); // daddiu a0, a0, -1 + c->sq(r0, 0, a1); // sq r0, 0(a1) + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + bc = c->sgpr64(a0) != 0; // bne a0, r0, L32 + c->daddiu(a1, a1, 16); // daddiu a1, a1, 16 + if (bc) {goto block_10;} // branch non-likely + + c->addiu(a0, r0, 0); // addiu a0, r0, 0 + //beq r0, r0, L36 // beq r0, r0, L36 + // nop // sll r0, r0, 0 + goto block_17; // branch always + + +block_12: + c->addiu(a1, r0, 28); // addiu a1, r0, 28 + c->mult3(a1, a1, a0); // mult3 a1, a1, a0 + c->daddiu(a1, a1, 12); // daddiu a1, a1, 12 + c->daddu(a1, a1, gp); // daddu a1, a1, gp + c->lui(a2, 18048); // lui a2, 18048 + c->mtc1(f0, a2); // mtc1 f0, a2 + c->lui(a2, 15232); // lui a2, 15232 + c->mtc1(f1, a2); // mtc1 f1, a2 + c->lwc1(f2, 4, a1); // lwc1 f2, 4(a1) + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->adds(f0, f0, f1); // add.s f0, f0, f1 + c->lui(a2, 15232); // lui a2, 15232 + c->mtc1(f1, a2); // mtc1 f1, a2 + c->lwc1(f2, 16, a1); // lwc1 f2, 16(a1) + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->lui(a2, 15232); // lui a2, 15232 + c->mtc1(f2, a2); // mtc1 f2, a2 + c->lwc1(f3, 20, a1); // lwc1 f3, 20(a1) + c->muls(f2, f2, f3); // mul.s f2, f2, f3 + c->lwc1(f3, 0, a1); // lwc1 f3, 0(a1) + c->addiu(a1, r0, 255); // addiu a1, r0, 255 + c->mfc1(a2, f0); // mfc1 a2, f0 + c->mov128_vf_gpr(vf1, a2); // qmtc2.i vf1, a2 + c->mfc1(a2, f1); // mfc1 a2, f1 + c->mov128_vf_gpr(vf2, a2); // qmtc2.i vf2, a2 + c->mfc1(a2, f2); // mfc1 a2, f2 + c->mov128_vf_gpr(vf3, a2); // qmtc2.i vf3, a2 + c->mfc1(a2, f3); // mfc1 a2, f3 + c->mov128_vf_gpr(vf4, a2); // qmtc2.i vf4, a2 + vi1 = c->gpr_src(a1).du16[0]; // ctc2.i vi1, a1 + c->mov64(a1, v1); // or a1, v1, r0 + c->addiu(a2, r0, 16); // addiu a2, r0, 16 + c->vmove(DEST::xyzw, vf6, vf0); // vmove.xyzw vf6, vf0 + +block_13: + c->addiu(a3, r0, 16); // addiu a3, r0, 16 + c->vmove(DEST::xyzw, vf5, vf0); // vmove.xyzw vf5, vf0 + +block_14: + c->lw(at, 0, a1); // lw at, 0(a1) + c->vadda_bc(DEST::xyzw, BC::x, vf1, vf0); // vaddax.xyzw acc, vf1, vf0 + c->vmadda(DEST::xyzw, vf2, vf5); // vmadda.xyzw acc, vf2, vf5 + c->vmadd(DEST::xyzw, vf7, vf3, vf6); // vmadd.xyzw vf7, vf3, vf6 + c->mov128_vf_gpr(vf10, at); // qmtc2.i vf10, at + c->vadd_bc(DEST::xyzw, BC::w, vf5, vf5, vf0); // vaddw.xyzw vf5, vf5, vf0 + c->vftoi0(DEST::xyzw, vf8, vf7); // vftoi0.xyzw vf8, vf7 + vi2 = c->vfs[vf8].vf.x_as_u16(); // vmtirx vi2, vf8 + c->vitof0(DEST::xyzw, vf8, vf8); // vitof0.xyzw vf8, vf8 + vi2 &= vi1; // viand vi2, vi2, vi1 + c->vfs[vf9].vf = gRippleVu0.lq(vi2++); // vlqi.xyzw vf9, vi2 + c->vsub(DEST::xyzw, vf7, vf7, vf8); // vsub.xyzw vf7, vf7, vf8 + c->vadda_bc(DEST::xyzw, BC::x, vf0, vf9); // vaddax.xyzw acc, vf0, vf9 + c->vmadd_bc(DEST::xyzw, BC::y, vf9, vf7, vf9); // vmaddy.xyzw vf9, vf7, vf9 + c->vadda_bc(DEST::xyzw, BC::x, vf10, vf0); // vaddax.xyzw acc, vf10, vf0 + c->vmadd(DEST::xyzw, vf10, vf9, vf4); // vmadd.xyzw vf10, vf9, vf4 + c->mov128_gpr_vf(at, vf10); // qmfc2.i at, vf10 + c->sw(at, 0, a1); // sw at, 0(a1) + c->daddiu(a3, a3, -1); // daddiu a3, a3, -1 + bc = c->sgpr64(a3) != 0; // bne a3, r0, L35 + c->daddiu(a1, a1, 4); // daddiu a1, a1, 4 + if (bc) {goto block_14;} // branch non-likely + + c->daddiu(a2, a2, -1); // daddiu a2, a2, -1 + bc = c->sgpr64(a2) != 0; // bne a2, r0, L34 + c->vadd_bc(DEST::xyzw, BC::w, vf6, vf6, vf0); // vaddw.xyzw vf6, vf6, vf0 + if (bc) {goto block_13;} // branch non-likely + + c->mov128_gpr_vf(a1, vf6); // qmfc2.i a1, vf6 + c->daddiu(a0, a0, 1); // daddiu a0, a0, 1 + +block_17: + c->lw(a1, 0, gp); // lw a1, 0(gp) + c->slt(a1, a0, a1); // slt a1, a0, a1 + bc = c->sgpr64(a1) != 0; // bne a1, r0, L33 + // nop // sll r0, r0, 0 + if (bc) {goto block_12;} // branch non-likely + + c->mov64(a0, s7); // or a0, s7, r0 + c->mov64(a0, s7); // or a0, s7, r0 + c->lui(a0, 17152); // lui a0, 17152 + c->mtc1(f0, a0); // mtc1 f0, a0 + c->lui(a0, 17279); // lui a0, 17279 + c->mtc1(f1, a0); // mtc1 f1, a0 + c->lwc1(f2, 8, gp); // lwc1 f2, 8(gp) + c->mfc1(a0, f2); // mfc1 a0, f2 + c->mov128_vf_gpr(vf16, a0); // qmtc2.i vf16, a0 + c->mfc1(a0, f0); // mfc1 a0, f0 + c->mov128_vf_gpr(vf14, a0); // qmtc2.i vf14, a0 + c->mfc1(a0, f1); // mfc1 a0, f1 + c->mov128_vf_gpr(vf15, a0); // qmtc2.i vf15, a0 + c->vmax_bc(DEST::xyzw, BC::x, vf16, vf0, vf16); // vmaxx.xyzw vf16, vf0, vf16 + c->vmini_bc(DEST::w, BC::x, vf16, vf0, vf0); // vminix.w vf16, vf0, vf0 + c->mov64(v1, v1); // or v1, v1, r0 + c->addiu(v0, r0, 15); // addiu v0, r0, 15 + +block_19: + c->addiu(a0, r0, 15); // addiu a0, r0, 15 + +block_20: + c->addiu(a2, r0, 4); // addiu a2, r0, 4 + c->addiu(at, r0, -60); // addiu at, r0, -60 + c->movz(a2, at, a0); // movz a2, at, a0 + c->addiu(a1, r0, 64); // addiu a1, r0, 64 + c->addiu(at, r0, -960); // addiu at, r0, -960 + c->daddu(a2, a2, v1); // daddu a2, a2, v1 + c->movz(a1, at, v0); // movz a1, at, v0 + c->lw(at, 0, v1); // lw at, 0(v1) + c->lw(a2, 0, a2); // lw a2, 0(a2) + c->daddu(a1, a1, v1); // daddu a1, a1, v1 + c->lw(a1, 0, a1); // lw a1, 0(a1) + c->mov128_vf_gpr(vf11, at); // qmtc2.i vf11, at + c->mov128_vf_gpr(vf12, a2); // qmtc2.i vf12, a2 + c->mov128_vf_gpr(vf13, a1); // qmtc2.i vf13, a1 + c->vadd_bc(DEST::xyzw, BC::x, vf11, vf0, vf11); // vaddx.xyzw vf11, vf0, vf11 + c->vsub_bc(DEST::y, BC::x, vf11, vf11, vf12); // vsubx.y vf11, vf11, vf12 + c->vsub_bc(DEST::z, BC::x, vf11, vf11, vf13); // vsubx.z vf11, vf11, vf13 + c->vmul(DEST::yzw, vf11, vf11, vf16); // vmul.yzw vf11, vf11, vf16 + c->vadd_bc(DEST::xyzw, BC::x, vf11, vf11, vf14); // vaddx.xyzw vf11, vf11, vf14 + c->vmax_bc(DEST::xyzw, BC::x, vf11, vf11, vf0); // vmaxx.xyzw vf11, vf11, vf0 + c->vmini_bc(DEST::xyzw, BC::x, vf11, vf11, vf15); // vminix.xyzw vf11, vf11, vf15 + c->vftoi0(DEST::xyzw, vf11, vf11); // vftoi0.xyzw vf11, vf11 + c->mov128_gpr_vf(at, vf11); // qmfc2.i at, vf11 + c->ppach(at, at, at); // ppach at, at, at + c->ppacb(at, at, at); // ppacb at, at, at + c->sw(at, 1024, v1); // sw at, 1024(v1) + c->daddiu(v1, v1, 4); // daddiu v1, v1, 4 + bc = c->sgpr64(a0) != 0; // bne a0, r0, L38 + c->daddiu(a0, a0, -1); // daddiu a0, a0, -1 + if (bc) {goto block_20;} // branch non-likely + + bc = c->sgpr64(v0) != 0; // bne v0, r0, L37 + c->daddiu(v0, v0, -1); // daddiu v0, v0, -1 + if (bc) {goto block_19;} // branch non-likely + + c->ld(ra, 0, sp); // ld ra, 0(sp) + c->lwc1(f30, 68, sp); // lwc1 f30, 68(sp) + c->lwc1(f28, 64, sp); // lwc1 f28, 64(sp) + c->lq(gp, 48, sp); // lq gp, 48(sp) + c->lq(s5, 32, sp); // lq s5, 32(sp) + c->lq(s4, 16, sp); // lq s4, 16(sp) + //jr ra // jr ra + c->daddiu(sp, sp, 80); // daddiu sp, sp, 80 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.display = intern_from_c("*display*").c(); + cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c(); + cache.setting_control = intern_from_c("*setting-control*").c(); + cache.atan = intern_from_c("atan").c(); + cache.cos = intern_from_c("cos").c(); + cache.ntsc = intern_from_c("ntsc").c(); + cache.pal = intern_from_c("pal").c(); + cache.ripple_update_waveform_offs = intern_from_c("ripple-update-waveform-offs").c(); + cache.sin = intern_from_c("sin").c(); + gLinkedFunctionTable.reg("ripple-create-wave-table", execute, 128); +} + +} // namespace ripple_create_wave_table +} // namespace Mips2C + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak2/kscheme.h" +using ::jak2::intern_from_c; +namespace Mips2C::jak2 { +namespace ripple_apply_wave_table { +struct Cache { + void* fake_scratchpad_data; // *fake-scratchpad-data* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + get_fake_spad_addr2(v1, cache.fake_scratchpad_data, 0, c);// lui v1, 28672 + c->daddiu(v1, v1, 1024); // daddiu v1, v1, 1024 + c->lwu(a1, 4, a0); // lwu a1, 4(a0) + c->lwu(t2, 0, a0); // lwu t2, 0(a0) + c->lwu(a2, 8, a0); // lwu a2, 8(a0) + c->lwu(a3, 12, a0); // lwu a3, 12(a0) + c->lhu(a0, 18, a0); // lhu a0, 18(a0) + c->addiu(t0, r0, 0); // addiu t0, r0, 0 + //beq r0, r0, L25 // beq r0, r0, L25 + // nop // sll r0, r0, 0 + goto block_4; // branch always + + +block_1: + c->lbu(t1, 0, a3); // lbu t1, 0(a3) + c->lbu(t3, 0, a1); // lbu t3, 0(a1) + c->daddiu(t3, t3, 3); // daddiu t3, t3, 3 + c->dsrl(t3, t3, 2); // dsrl t3, t3, 2 + c->dsll(t3, t3, 4); // dsll t3, t3, 4 + c->daddu(t2, t2, t3); // daddu t2, t2, t3 + c->mov64(t4, t2); // or t4, t2, r0 + c->mov64(t3, t1); // or t3, t1, r0 + c->mov64(t5, t4); // or t5, t4, r0 + c->mov64(t4, a2); // or t4, a2, r0 + +block_2: + c->lb(t6, 0, t4); // lb t6, 0(t4) + c->lb(t7, 1, t4); // lb t7, 1(t4) + c->andi(t6, t6, 15); // andi t6, t6, 15 + c->andi(t7, t7, 15); // andi t7, t7, 15 + c->sll(t7, t7, 4); // sll t7, t7, 4 + c->daddu(t6, t6, t7); // daddu t6, t6, t7 + c->sll(t6, t6, 2); // sll t6, t6, 2 + c->daddu(t8, t6, v1); // daddu t8, t6, v1 + c->lb(t6, 0, t8); // lb t6, 0(t8) + c->lb(t7, 1, t8); // lb t7, 1(t8) + c->lb(t8, 2, t8); // lb t8, 2(t8) + c->sb(t6, 7, t5); // sb t6, 7(t5) + c->sb(t7, 2, t5); // sb t7, 2(t5) + c->sb(t8, 10, t5); // sb t8, 10(t5) + c->daddiu(t3, t3, -1); // daddiu t3, t3, -1 + c->daddiu(t4, t4, 2); // daddiu t4, t4, 2 + bc = c->sgpr64(t3) != 0; // bne t3, r0, L24 + c->daddiu(t5, t5, 12); // daddiu t5, t5, 12 + if (bc) {goto block_2;} // branch non-likely + + c->lbu(t3, 2, a1); // lbu t3, 2(a1) + c->lbu(t4, 1, a1); // lbu t4, 1(a1) + c->daddiu(t4, t4, 3); // daddiu t4, t4, 3 + c->dsrl(t4, t4, 2); // dsrl t4, t4, 2 + c->daddu(t3, t3, t4); // daddu t3, t3, t4 + c->dsll(t3, t3, 4); // dsll t3, t3, 4 + c->daddu(t2, t2, t3); // daddu t2, t2, t3 + c->lbu(t3, 3, a1); // lbu t3, 3(a1) + c->dsll(t3, t3, 1); // dsll t3, t3, 1 + c->daddiu(t3, t3, 4); // daddiu t3, t3, 4 + c->daddu(a1, a1, t3); // daddu a1, a1, t3 + c->dsll(t1, t1, 1); // dsll t1, t1, 1 + c->daddiu(t1, t1, 15); // daddiu t1, t1, 15 + c->andi(t1, t1, 65520); // andi t1, t1, 65520 + c->daddu(a2, a2, t1); // daddu a2, a2, t1 + c->daddiu(a3, a3, 2); // daddiu a3, a3, 2 + c->mov64(t1, a3); // or t1, a3, r0 + c->daddiu(t0, t0, 1); // daddiu t0, t0, 1 + +block_4: + c->slt(t1, t0, a0); // slt t1, t0, a0 + bc = c->sgpr64(t1) != 0; // bne t1, r0, L23 + // nop // sll r0, r0, 0 + if (bc) {goto block_1;} // branch non-likely + + c->mov64(v1, s7); // or v1, s7, r0 + c->mov64(v0, s7); // or v0, s7, r0 + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.fake_scratchpad_data = intern_from_c("*fake-scratchpad-data*").c(); + gLinkedFunctionTable.reg("ripple-apply-wave-table", execute, 128); +} + +} // namespace ripple_apply_wave_table +} // namespace Mips2C + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak2/kscheme.h" +using ::jak2::intern_from_c; +namespace Mips2C::jak2 { +namespace ripple_matrix_scale { +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->lhu(v1, 2, a0); // lhu v1, 2(a0) + c->lw(a1, 4, a0); // lw a1, 4(a0) + c->lw(a2, 28, a0); // lw a2, 28(a0) + c->lqc2(vf1, 16, a0); // lqc2 vf1, 16(a0) + +block_1: + c->lqc2(vf5, 16, a1); // lqc2 vf5, 16(a1) + c->lqc2(vf6, 48, a1); // lqc2 vf6, 48(a1) + c->lqc2(vf7, 64, a1); // lqc2 vf7, 64(a1) + c->lqc2(vf8, 96, a1); // lqc2 vf8, 96(a1) + c->vmul_bc(DEST::xyzw, BC::x, vf4, vf5, vf1); // vmulx.xyzw vf4, vf5, vf1 + c->vmul_bc(DEST::xyzw, BC::y, vf5, vf5, vf1); // vmuly.xyzw vf5, vf5, vf1 + c->lq(a3, 0, a1); // lq a3, 0(a1) + c->vmul_bc(DEST::xyzw, BC::z, vf7, vf7, vf1); // vmulz.xyzw vf7, vf7, vf1 + c->lq(a0, 32, a1); // lq a0, 32(a1) + c->vmul_bc(DEST::xyzw, BC::z, vf8, vf8, vf1); // vmulz.xyzw vf8, vf8, vf1 + c->sq(a3, 0, a2); // sq a3, 0(a2) + c->lq(a3, 80, a1); // lq a3, 80(a1) + c->vsub(DEST::xyzw, vf6, vf6, vf4); // vsub.xyzw vf6, vf6, vf4 + c->sq(a0, 32, a2); // sq a0, 32(a2) + c->sqc2(vf5, 16, a2); // sqc2 vf5, 16(a2) + c->sq(a3, 80, a2); // sq a3, 80(a2) + c->daddiu(v1, v1, -1); // daddiu v1, v1, -1 + c->sqc2(vf7, 64, a2); // sqc2 vf7, 64(a2) + c->addiu(a1, a1, 128); // addiu a1, a1, 128 + c->sqc2(vf6, 48, a2); // sqc2 vf6, 48(a2) + c->addiu(a2, a2, 128); // addiu a2, a2, 128 + bc = c->sgpr64(v1) != 0; // bne v1, r0, L13 + c->sqc2(vf8, -32, a2); // sqc2 vf8, -32(a2) + if (bc) {goto block_1;} // branch non-likely + + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + //jr ra // jr ra + c->daddu(sp, sp, r0); // daddu sp, sp, r0 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + gLinkedFunctionTable.reg("ripple-matrix-scale", execute, 128); +} + +} // namespace ripple_matrix_scale +} // namespace Mips2C \ No newline at end of file diff --git a/game/mips2c/mips2c_table.cpp b/game/mips2c/mips2c_table.cpp index bc0e03404a..1061650f2d 100644 --- a/game/mips2c/mips2c_table.cpp +++ b/game/mips2c/mips2c_table.cpp @@ -210,6 +210,12 @@ namespace method_39_nav_state { extern void link(); } namespace method_17_nav_engine { extern void link(); } namespace method_18_nav_engine { extern void link(); } namespace method_21_nav_engine { extern void link(); } +namespace setup_blerc_chains_for_one_fragment { extern void link(); } +namespace blerc_execute { extern void link(); } +namespace ripple_execute_init { extern void link(); } +namespace ripple_create_wave_table { extern void link(); } +namespace ripple_apply_wave_table { extern void link(); } +namespace ripple_matrix_scale { extern void link(); } } // clang-format on @@ -350,7 +356,12 @@ PerGameVersion>> gMips2C jak2::method_20_nav_engine::link, jak2::method_43_nav_mesh::link, jak2::nav_dma_send_to_spr_no_flush::link, jak2::nav_dma_send_from_spr_no_flush::link, jak2::method_17_nav_engine::link, jak2::method_18_nav_engine::link, - jak2::method_21_nav_engine::link}}}, + jak2::method_21_nav_engine::link}}, + {"merc-blend-shape", + {jak2::setup_blerc_chains_for_one_fragment::link, jak2::blerc_execute::link}}, + {"ripple", + {jak2::ripple_execute_init::link, jak2::ripple_create_wave_table::link, + jak2::ripple_apply_wave_table::link, jak2::ripple_matrix_scale::link}}}, }; void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) { diff --git a/goal_src/jak2/engine/common_objs/water-anim.gc b/goal_src/jak2/engine/common_objs/water-anim.gc index b59fedc92e..504e9e0cf2 100644 --- a/goal_src/jak2/engine/common_objs/water-anim.gc +++ b/goal_src/jak2/engine/common_objs/water-anim.gc @@ -312,15 +312,14 @@ ) ;; WARN: Return type mismatch none vs object. -;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 210] (defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-1 none)) + (local-vars (v0-1 object)) (the-as object (case arg2 (('move-to) (move-to-point! self (the-as vector (-> arg3 param 0))) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) (set! (-> self mask) (the-as process-mask v0-1)) v0-1 ) @@ -330,7 +329,7 @@ (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) (move-to-point! self a1-2) ) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) (set! (-> self mask) (the-as process-mask v0-1)) v0-1 ) @@ -397,7 +396,7 @@ ) (let ((a0-40 (-> self flow))) (if (nonzero? a0-40) - (push-process a0-40 (the-as process-focusable gp-0)) + (the-as object (push-process a0-40 (the-as process-focusable gp-0))) ) ) ) diff --git a/goal_src/jak2/engine/data/art-h.gc b/goal_src/jak2/engine/data/art-h.gc index 4360b2dc08..264ec3ea13 100644 --- a/goal_src/jak2/engine/data/art-h.gc +++ b/goal_src/jak2/engine/data/art-h.gc @@ -204,7 +204,7 @@ (eye-anim merc-eye-anim-block :offset 4) (master-art-group-name string :offset-assert 32) (master-art-group-index int32 :offset-assert 36) - (blend-shape-anim basic :offset-assert 40) + (blend-shape-anim (pointer int8) :offset-assert 40) (frames joint-anim-compressed-control :offset-assert 44) ) :method-count-assert 13 diff --git a/goal_src/jak2/engine/gfx/foreground/ripple.gc b/goal_src/jak2/engine/gfx/foreground/ripple.gc index 49b4d56135..935fca30c7 100644 --- a/goal_src/jak2/engine/gfx/foreground/ripple.gc +++ b/goal_src/jak2/engine/gfx/foreground/ripple.gc @@ -7,9 +7,202 @@ ;; DECOMP BEGINS -(defun ripple-make-request ((arg0 ripple-wave) (arg1 merc-effect)) - (none)) +(deftype ripple-request (structure) + ((waveform ripple-wave :offset-assert 0) + (effect merc-effect :offset-assert 4) + ) + :pack-me + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + + +(deftype ripple-globals (structure) + ((count int32 :offset-assert 0) + (requests ripple-request 16 :inline :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x84 + :flag-assert #x900000084 + ) + + +(define *ripple-globals* "A collection of [[ripple-request]] (max of 16)" (new 'global 'ripple-globals)) + +(defun ripple-make-request ((waveform ripple-wave) (effect merc-effect)) + "Iterate through [[*ripple-globals*]] `requests` looking for the one that matches the provided `effect` +If NOT found, append a new [[ripple-request]] with the providded `effect` and `waveform` to the end of the `requests`. + +NOTE: There can only be 16 effects at a given time, NOOP if already at that limit!" + (let ((v1-1 (-> *ripple-globals* count)) + (a2-1 (-> *ripple-globals* requests)) + (a3-0 0) + ) + (when (< v1-1 16) + (dotimes (t0-1 v1-1) + (if (= effect (-> a2-1 t0-1 effect)) + (set! a3-0 1) + ) + ) + (when (zero? a3-0) + (set! (-> a2-1 v1-1 effect) effect) + (set! (-> a2-1 v1-1 waveform) waveform) + (+! (-> *ripple-globals* count) 1) + ) + ) + ) + 0 + (none) + ) + +(defun ripple-update-waveform-offs ((arg0 ripple-wave-set) (arg1 clock)) + (let ((f0-1 (the float (- (-> arg1 integral-frame-counter) (-> arg0 frame-save))))) + (when (!= f0-1 0.0) + (dotimes (v1-3 (-> arg0 count)) + (let ((a2-4 (-> arg0 wave v1-3))) + (+! (-> a2-4 offs) (* f0-1 (-> a2-4 delta))) + (set! (-> a2-4 offs) (the float (logand (the int (-> a2-4 offs)) #xffff))) + ) + ) + (set! (-> arg0 frame-save) (-> arg1 integral-frame-counter)) + ) + ) + 0 + (none) + ) + +(def-mips2c ripple-execute-init (function none)) + +(def-mips2c ripple-create-wave-table (function ripple-wave-set int)) + +(def-mips2c ripple-apply-wave-table (function merc-effect symbol)) + +(defun ripple-execute () + "Iterate through [[*ripple-globals*]] requests, from the end to index `0` +For each request, if it has a `waveform` create the wave-table via `ripple-create-wave-table` +Then for each `waveform` apply the `effect` using `ripple-apply-wave-table` + +Once completed, all `requests` have been processed and the `count` is reset to `0`" + (when (-> *ripple-globals* count) + (ripple-execute-init) + (let ((gp-0 0) + (s5-0 (-> *ripple-globals* count)) + (s4-0 (-> *ripple-globals* requests)) + ) + (while (!= gp-0 s5-0) + (when (-> s4-0 gp-0 waveform) + (let ((s3-0 gp-0) + (s2-0 (-> s4-0 gp-0 waveform)) + ) + (ripple-create-wave-table (the-as ripple-wave-set s2-0)) + (while (!= s3-0 s5-0) + (when (= s2-0 (-> s4-0 s3-0 waveform)) + (ripple-apply-wave-table (-> s4-0 s3-0 effect)) + (set! (-> s4-0 s3-0 waveform) #f) + ) + (+! s3-0 1) + ) + ) + ) + (+! gp-0 1) + ) + ) + (set! (-> *ripple-globals* count) 0) + 0 + ) + 0 + (none) + ) + +(def-mips2c ripple-matrix-scale function) + +;; WARN: Return type mismatch symbol vs none. +(defun-debug ripple-add-debug-sphere ((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float)) + (let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat)))) + (s5-0 (new-stack-vector0)) + ) + (let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z)))) + (f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z)))) + ) + (set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0)))) + (set! (-> s5-0 y) 0.0) + (set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0)))) + ) + (set! (-> s5-0 w) 0.0) + (vector+! s5-0 s5-0 (-> arg0 root trans)) + (add-debug-sphere #t (bucket-id debug2) s5-0 (meters 0.5) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + (none) + ) + +(defun ripple-slow-add-sine-waves ((arg0 ripple-wave-set) (arg1 float) (arg2 float)) + (let ((f30-0 0.0)) + (dotimes (s3-0 (-> arg0 count)) + (let* ((v1-3 (-> arg0 wave s3-0)) + (f0-2 (+ (-> v1-3 offs) (* arg1 (-> v1-3 xmul)) (* arg2 (-> v1-3 zmul)))) + ) + (+! f30-0 (* (-> v1-3 scale) (cos f0-2))) + ) + ) + (fmax -127.0 (fmin 127.0 f30-0)) + ) + ) (defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector)) - -100000000.0 - ) \ No newline at end of file + (local-vars (sv-16 draw-control) (sv-32 float) (sv-48 float)) + (let ((f30-0 (-> arg0 root trans y))) + (set! sv-16 (-> arg0 draw)) + (if (or (zero? sv-16) (not (-> sv-16 ripple))) + (return f30-0) + ) + (let ((v1-11 (-> sv-16 lod-set lod (-> sv-16 cur-lod) geo effect))) + (if (not (logtest? (-> v1-11 0 effect-bits) (effect-bits ripple))) + (return f30-0) + ) + (let* ((v1-12 (-> v1-11 0 extra-info)) + (s4-0 (the-as mei-ripple (+ (the-as uint v1-12) (* (-> v1-12 ripple-offset) 16)))) + (gp-0 (-> sv-16 ripple)) + (s5-0 (-> gp-0 waveform)) + ) + (if (not (-> gp-0 waveform)) + (return f30-0) + ) + (if (not (-> s5-0 converted)) + (return f30-0) + ) + (let* ((f28-0 (- (-> arg2 x) (-> arg0 root trans x))) + (f26-0 (- (-> arg2 z) (-> arg0 root trans z))) + (f22-0 (+ (quaternion-y-angle (-> arg0 root quat)) (-> s4-0 angle))) + (f24-0 (cos f22-0)) + (f1-3 (sin f22-0)) + (f0-4 (- (* f28-0 f24-0) (* f26-0 f1-3))) + (f1-5 (+ (* f26-0 f24-0) (* f28-0 f1-3))) + (f2-3 (/ 1.0 (-> s4-0 grid-size))) + (f28-1 (* f2-3 (- f0-4 (-> s4-0 x-base)))) + (f26-1 (* f2-3 (- f1-5 (-> s4-0 z-base)))) + ) + (ripple-update-waveform-offs s5-0 (-> *display* bg-clock)) + (let* ((f22-1 (the float (the int f28-1))) + (f24-1 (the float (the int f26-1))) + (f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1)) + ) + (set! sv-32 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) + (set! sv-48 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) + (let* ((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) + (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-32 f20-0)))) + (f1-9 (+ sv-48 (* (- f28-1 f22-1) (- f1-6 sv-48)))) + (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) + (f0-23 (-> gp-0 faded-scale)) + ) + (if (< f0-23 0.0) + (set! f0-23 (-> gp-0 global-scale)) + ) + (+ f30-0 (* 0.0078125 f1-12 f0-23)) + ) + ) + ) + ) + ) + ) + ) diff --git a/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc b/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc index 27f536a499..b74c99088d 100644 --- a/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc +++ b/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc @@ -5,9 +5,305 @@ ;; name in dgo: merc-blend-shape ;; dgos: ENGINE, GAME +(define-extern setup-blerc-chains (function merc-ctrl (pointer int16) dma-buffer none)) + ;; DECOMP BEGINS -(defun merc-blend-shape ((obj process-drawable)) - ;; (format *stdcon* "no mbs for you ~A~%" obj) - (the object #f) - ) \ No newline at end of file +(define *stats-blerc* #f) + +(deftype blerc-block-header (structure) + ((tag generic-merc-tag :inline :offset-assert 0) + (vtx-count uint32 :offset-assert 16) + (overlap uint32 :offset-assert 20) + (lump-dest uint32 :offset-assert 24) + (lump-qwc uint32 :offset-assert 28) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + + +(deftype blerc-block (structure) + ((output uint8 848 :offset-assert 0) + (header blerc-block-header :inline :offset-assert 848) + ) + :method-count-assert 9 + :size-assert #x370 + :flag-assert #x900000370 + ) + + +(deftype blerc-dcache (structure) + ((repl-mult vector 40 :inline :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x280 + :flag-assert #x900000280 + ) + + +(deftype blerc-globals (structure) + ((first uint32 :offset-assert 0) + (next uint32 :offset-assert 4) + (min-val int16 :offset-assert 8) + (max-val int16 :offset-assert 10) + (fragment-count int32 :offset-assert 12) + (vtx-count int32 :offset-assert 16) + (target-vtx-count int32 :offset-assert 20) + ) + :method-count-assert 9 + :size-assert #x18 + :flag-assert #x900000018 + ) + + +(define *blerc-globals* (new 'global 'blerc-globals)) + +(deftype blerc-context (structure) + ((block-a blerc-block :inline :offset-assert 0) + (dummy uint8 7312 :offset-assert 880) + (block-b blerc-block :inline :offset-assert 8192) + ) + :method-count-assert 9 + :size-assert #x2370 + :flag-assert #x900002370 + ) + + +(defun-debug blerc-stats-init () + (when *stats-blerc* + (when (nonzero? (-> *blerc-globals* fragment-count)) + (format *stdcon* "~%BLERC (merc blend target) STATS~%") + (format + *stdcon* + " ~D fragments, ~D vertices~%" + (-> *blerc-globals* fragment-count) + (-> *blerc-globals* vtx-count) + ) + (format + *stdcon* + " ~D blend target computations (~F average)~%" + (-> *blerc-globals* target-vtx-count) + (/ (the float (-> *blerc-globals* target-vtx-count)) (the float (-> *blerc-globals* vtx-count))) + ) + (if (< (-> *blerc-globals* min-val) 0) + (format *stdcon* "MINIMUM OUT OF RANGE: ~D~%" (-> *blerc-globals* min-val)) + ) + (if (< 255 (-> *blerc-globals* max-val)) + (format *stdcon* "MAXIMUM OUT OF RANGE: ~D~%" (-> *blerc-globals* max-val)) + ) + ) + (let ((a0-7 *blerc-globals*)) + (set! (-> a0-7 min-val) 255) + (set! (-> a0-7 max-val) 0) + (set! (-> a0-7 fragment-count) 0) + (set! (-> a0-7 vtx-count) 0) + (set! (-> a0-7 target-vtx-count) 0) + ) + ) + 0 + (none) + ) + +(defun blerc-init () + (blerc-stats-init) + (let ((v1-0 *blerc-globals*)) + (set! (-> v1-0 first) (the-as uint 0)) + (set! (-> v1-0 next) (the-as uint 0)) + ) + 0 + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; ERROR: function has no type analysis. Cannot decompile. + +;; ERROR: function has no type analysis. Cannot decompile. + +(def-mips2c blerc-execute (function none)) + +;; WARN: Return type mismatch int vs object. +(defun merc-blend-shape ((arg0 process-drawable)) + (when *debug-segment* + (let ((s5-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) + (v1-7 'merc) + (s4-0 *profile-merc-color*) + ) + (when (and *dproc* *debug-segment*) + (let ((s3-0 (-> s5-0 data (-> s5-0 count)))) + (let ((s2-0 (-> s5-0 base-time))) + (set! (-> s3-0 name) v1-7) + (set! (-> s3-0 start-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s2-0)))) + ) + (set! (-> s3-0 depth) (the-as uint (-> s5-0 depth))) + (set! (-> s3-0 color) s4-0) + (set! (-> s5-0 segment (-> s5-0 depth)) s3-0) + ) + (+! (-> s5-0 count) 1) + (+! (-> s5-0 depth) 1) + (set! (-> s5-0 max-depth) (max (-> s5-0 max-depth) (-> s5-0 depth))) + ) + ) + 0 + ) + (let* ((a2-0 (-> arg0 skel root-channel 0)) + (a3-0 (-> a2-0 frame-group)) + (a1-2 (new 'stack-no-clear 'array 'int16 128)) + ) + (when (and a3-0 + (> (-> arg0 skel active-channels) 0) + (zero? (-> arg0 draw cur-lod)) + (logtest? (-> arg0 skel status) (joint-control-status blend-shape)) + ) + (cond + ((and (-> arg0 skel override) (!= (-> arg0 skel override 0) 0.0)) + (let ((a0-13 (-> arg0 draw mgeo))) + (let ((v1-35 (-> a0-13 header blend-target-count)) + (a2-2 (-> arg0 skel override)) + ) + (dotimes (a3-1 (the-as int v1-35)) + (set! (-> a1-2 a3-1) (the int (* 8192.0 (-> a2-2 (+ a3-1 1))))) + ) + ) + (setup-blerc-chains a0-13 a1-2 (-> *display* frames (-> *display* on-screen) global-buf)) + ) + (logior! (-> arg0 skel status) (joint-control-status blend-shape-valid)) + (return (the-as object #f)) + ) + (else + (let ((t2-0 (-> a3-0 blend-shape-anim))) + (when t2-0 + (let ((a0-15 (-> arg0 draw mgeo))) + (let* ((v1-49 (-> a0-15 header blend-target-count)) + (t0-5 (-> a2-0 frame-num)) + (t1-2 (the int t0-5)) + (a2-6 (&+ t2-0 (* (the-as uint t1-2) v1-49))) + ) + (cond + ((< t1-2 (the-as int (+ (-> a3-0 frames num-frames) -1))) + (let* ((a3-6 (&+ a2-6 v1-49)) + (t0-6 (* 64.0 (- t0-5 (the float t1-2)))) + (t1-4 (- 64.0 t0-6)) + ) + (dotimes (t2-2 (the-as int v1-49)) + (set! (-> a1-2 t2-2) (the int (+ (* (the float (+ (-> (the-as (pointer uint8) (&+ a2-6 t2-2))) -64)) t1-4) + (* (the float (+ (-> (the-as (pointer uint8) (&+ a3-6 t2-2))) -64)) t0-6) + ) + ) + ) + ) + ) + ) + (else + (dotimes (a3-7 (the-as int v1-49)) + (set! (-> a1-2 a3-7) (the-as int (* (+ (-> (the-as (pointer uint8) (&+ a2-6 a3-7))) -64) 64))) + ) + ) + ) + ) + (setup-blerc-chains a0-15 a1-2 (-> *display* frames (-> *display* on-screen) global-buf)) + ) + (logior! (-> arg0 skel status) (joint-control-status blend-shape-valid)) + (return (the-as object #f)) + ) + ) + ) + ) + ) + ) + (when (logtest? (-> arg0 skel status) (joint-control-status blend-shape-valid)) + (logclear! (-> arg0 skel status) (joint-control-status blend-shape-valid)) + (setup-blerc-chains + (-> arg0 draw lod-set lod 0 geo) + (new 'static 'array int16 40 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + (-> *display* frames (-> *display* on-screen) global-buf) + ) + ) + (when *debug-segment* + (let ((gp-1 (-> *display* frames (-> *display* on-screen) profile-array data 0))) + (when (and *dproc* *debug-segment*) + (let* ((v1-87 (+ (-> gp-1 depth) -1)) + (s5-1 (-> gp-1 segment v1-87)) + (s4-1 (-> gp-1 base-time)) + ) + (when (>= v1-87 0) + (set! (-> s5-1 end-time) (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint s4-1)))) + (+! (-> gp-1 depth) -1) + ) + ) + ) + ) + 0 + ) + 0 + ) + +(def-mips2c setup-blerc-chains-for-one-fragment (function object object object object object object object)) + +(defun setup-blerc-chains ((arg0 merc-ctrl) (arg1 (pointer int16)) (arg2 dma-buffer)) + (local-vars + (sv-16 uint) + (sv-20 pointer) + (sv-24 merc-effect) + (sv-28 uint) + (sv-32 object) + (sv-48 int) + (sv-64 int) + ) + (set! sv-16 (-> arg0 header effect-count)) + (let ((s3-0 (-> arg0 header blend-target-count)) + (v1-1 (-> arg2 base)) + ) + (set! sv-20 (&+ v1-1 0)) + (let ((a2-1 (the-as object (&+ v1-1 16)))) + (if (zero? (-> *blerc-globals* first)) + (set! (-> *blerc-globals* first) (the-as uint a2-1)) + ) + (dotimes (s2-0 (the-as int sv-16)) + (set! sv-24 (-> arg0 effect s2-0)) + (set! sv-28 (-> sv-24 blend-frag-count)) + (when (nonzero? sv-28) + (let ((v1-15 (the-as object (-> sv-24 frag-geo))) + (s1-0 (the-as structure (-> sv-24 frag-ctrl))) + (s0-0 (the-as object (-> sv-24 blend-data))) + ) + (set! sv-32 (-> sv-24 blend-ctrl)) + (set! sv-48 0) + (while (< sv-48 (the-as int sv-28)) + (set! sv-64 (+ (the-as int v1-15) + (logand (* (+ (-> (the-as merc-fragment-control s1-0) unsigned-four-count) 3) 4) #xfff0) + ) + ) + (if (nonzero? (-> (the-as (pointer uint8) sv-32) 0)) + (set! a2-1 (setup-blerc-chains-for-one-fragment s3-0 arg1 a2-1 s0-0 sv-32 sv-64)) + ) + (let ((a0-14 (logand (+ (* (the-as uint 6) (-> (the-as merc-blend-ctrl sv-32) blend-vtx-count)) 15) #xfff0))) + (set! v1-15 + (+ sv-64 + (logand (* (+ (-> (the-as merc-fragment-control s1-0) lump-four-count) 3) 4) #xfff0) + (* (-> (the-as merc-fragment-control s1-0) fp-qwc) 16) + ) + ) + (set! s1-0 (&+ s1-0 (* (-> (the-as merc-fragment-control s1-0) mat-xfer-count) 2) 4)) + (set! s0-0 + (+ (the-as int s0-0) (* (the-as uint a0-14) (+ (-> (the-as merc-blend-ctrl sv-32) nonzero-index-count) 1))) + ) + ) + (set! sv-32 (+ (the-as int sv-32) s3-0 2)) + (the-as int sv-32) + (set! sv-48 (+ sv-48 1)) + ) + ) + ) + ) + (set! (-> (the-as (pointer int64) sv-20)) (logior #x20000000 (shr (shl (the-as int a2-1) 33) 1))) + (set! (-> (the-as (pointer uint32) sv-20) 2) (the-as uint 0)) + (set! (-> (the-as (pointer uint32) sv-20) 3) (the-as uint 0)) + (set! (-> arg2 base) (the-as pointer a2-1)) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak2/engine/physics/chain-physics-h.gc b/goal_src/jak2/engine/physics/chain-physics-h.gc index cb5eaca99f..8d94cd439d 100644 --- a/goal_src/jak2/engine/physics/chain-physics-h.gc +++ b/goal_src/jak2/engine/physics/chain-physics-h.gc @@ -53,17 +53,10 @@ (turn-off (_type_ time-frame) none :behavior process 10) (update (_type_ process-drawable) none :behavior process 11) (gravity-update (_type_) none 12) - (apply-gravity (_type_ vector int) none :behavior process 13) + (apply-gravity (_type_ vector int process-drawable) none :behavior process 13) (chain-physics-method-14 (_type_ vector int) none 14) - (clamp-length (_type_ vector vector) vector 15) + (clamp-length (_type_ vector vector object process-drawable) vector 15) (chain-physics-method-16 (_type_ int) float 16) (chain-physics-method-17 (_type_ vector) none 17) ) ) - - -0 - - - - diff --git a/goal_src/jak2/engine/physics/chain-physics.gc b/goal_src/jak2/engine/physics/chain-physics.gc index 33f13c2796..d6281b73f6 100644 --- a/goal_src/jak2/engine/physics/chain-physics.gc +++ b/goal_src/jak2/engine/physics/chain-physics.gc @@ -13,7 +13,7 @@ (none) ) -(defmethod apply-gravity chain-physics ((obj chain-physics) (arg0 vector) (arg1 int)) +(defmethod apply-gravity chain-physics ((obj chain-physics) (arg0 vector) (arg1 int) (arg2 process-drawable)) (vector-float*! arg0 (-> obj gravity) @@ -33,7 +33,7 @@ (none) ) -(defmethod clamp-length chain-physics ((obj chain-physics) (arg0 vector) (arg1 vector)) +(defmethod clamp-length chain-physics ((obj chain-physics) (arg0 vector) (arg1 vector) (arg2 object) (arg3 process-drawable)) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector-! gp-0 arg0 arg1) (vector-normalize! gp-0 (-> obj joint-length)) @@ -145,7 +145,7 @@ (vector-negate! s1-0 s1-0) ) (set! sv-288 (new 'stack-no-clear 'vector)) - (apply-gravity obj sv-288 s0-0) + (apply-gravity obj sv-288 s0-0 arg0) (let ((v1-34 sv-528)) (let ((a0-10 sv-528)) (.mov.vf vf6 vf0 :mask #b1000) @@ -168,7 +168,7 @@ (.svf (&-> v1-40 quad) vf6) ) ) - (clamp-length obj sv-528 s3-0) + (clamp-length obj sv-528 s3-0 s0-0 arg0) (set! sv-400 (new 'stack-no-clear 'vector)) (let ((v1-43 sv-528) (a0-16 s3-0) diff --git a/goal_src/jak2/engine/target/mech_suit/mech-states.gc b/goal_src/jak2/engine/target/mech_suit/mech-states.gc index c8e2bef9f6..408c5bb7dc 100644 --- a/goal_src/jak2/engine/target/mech_suit/mech-states.gc +++ b/goal_src/jak2/engine/target/mech_suit/mech-states.gc @@ -35,7 +35,7 @@ (defstate target-mech-start (target) :event target-mech-handler :exit target-mech-exit - :code (the-as (function handle none :behavior target) target-mech-init) + :code target-mech-init :post target-post ) diff --git a/goal_src/jak2/engine/target/mech_suit/target-mech.gc b/goal_src/jak2/engine/target/mech_suit/target-mech.gc index 910439cda3..baeccaa55d 100644 --- a/goal_src/jak2/engine/target/mech_suit/target-mech.gc +++ b/goal_src/jak2/engine/target/mech_suit/target-mech.gc @@ -5,7 +5,6 @@ ;; name in dgo: target-mech ;; dgos: DRILLMTN, UNB, RUI -(define-extern target-mech-start (state handle target)) (define-extern target-mech-stance (state target)) (define-extern target-mech-walk (state target)) (define-extern target-mech-punch-pick (function symbol int :behavior target)) diff --git a/goal_src/jak2/engine/target/target-h.gc b/goal_src/jak2/engine/target/target-h.gc index 2ee6ac1a83..1664401907 100644 --- a/goal_src/jak2/engine/target/target-h.gc +++ b/goal_src/jak2/engine/target/target-h.gc @@ -166,7 +166,7 @@ (define-extern target-load-wait (state target)) (define-extern target-board-start (state object target)) (define-extern target-pilot-start (state handle target)) -(define-extern target-mech-start (state handle target)) +(define-extern target-mech-start (state handle float symbol target)) (define-extern target-turret-get-on (state handle target)) (define-extern target-play-anim (state string handle target)) (define-extern target-edge-grab (state target)) @@ -361,7 +361,7 @@ (target-mech-jump float float surface) target-mech-punch target-mech-stance - (target-mech-start handle) + (target-mech-start handle float symbol) target-mech-walk target-pilot-edge-grab (target-pilot-start handle) diff --git a/goal_src/jak2/engine/target/target-handler.gc b/goal_src/jak2/engine/target/target-handler.gc index ed83bef5b5..12958159f3 100644 --- a/goal_src/jak2/engine/target/target-handler.gc +++ b/goal_src/jak2/engine/target/target-handler.gc @@ -1236,13 +1236,15 @@ (if *debug-segment* (load-package "mechp" global) ) - enter-state - (let ((a0-101 (process->handle (the-as process (-> arg3 param 1))))) - (if (>= arg1 2) - (-> arg3 param 2) - #x42c80000 - ) - (go target-mech-start (the-as handle a0-101)) + (go + target-mech-start + (process->handle (the-as process (-> arg3 param 1))) + (the-as float (if (>= arg1 2) + (the-as int (-> arg3 param 2)) + #x42c80000 + ) + ) + #f ) ) ((= v1-45 'indax) diff --git a/goal_src/jak2/game.gp b/goal_src/jak2/game.gp index 5a1f82be3f..9ca47343d0 100644 --- a/goal_src/jak2/game.gp +++ b/goal_src/jak2/game.gp @@ -863,7 +863,7 @@ (copy-strs "INSHUT" "INVORTEX" "INCSQUAR" "INPRISON") ;; jak ambient -(copy-strs "JAA1" "JAA2" "JAA3" "JAA4" "JAA5" "JAA6") +(copy-strs "JAA1" "JAA2" "JAA3" "JAA4" "JAA5" "JAA6" "JAA7") (copy-vag-files "ENG") @@ -1159,6 +1159,8 @@ "atollext-vis" ) +(copy-strs "AT1RES" "ATSINTRO" "ATSTANK" "ATSA" "ATSB" "ATSC" "ATSD" "ATSE" "ATSARA" "ATSARB") + ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; ATO ;; ;;;;;;;;;;;;;;;;;;;;; @@ -1593,25 +1595,24 @@ ;; ;; CPO ;; ;;;;;;;;;;;;;;;;;;;;; -;; (cgo "CPO.DGO" "cpo.gd") +(cgo "CPO.DGO" "cpo.gd") -;; (goal-src-sequence -;; "" -;; :deps ("$OUT/obj/los-control.o") -;; "levels/city/port/ctyport-part.gc" -;; ) +(goal-src-sequence + "" + :deps ("$OUT/obj/los-control.o") + "levels/city/port/ctyport-part.gc" + ) -;; (copy-textures 1557 1560 1558 1325 1645) - -;; (copy-gos -;; "barge-ag" -;; "mecha-daxter-ag" -;; "farthy-ag" -;; "air-train-ag" -;; "hip-door-a-ag" -;; "ctyport-vis" -;; ) +(copy-textures 1557 1560 1558 1325 1645) +(copy-gos + "barge-ag" + "mecha-daxter-ag" + "farthy-ag" + ;; "air-train-ag" + ;; "hip-door-a-ag" + "ctyport-vis" + ) ;;;;;;;;;;;;;;;;;;;;; ;; CTB ;;;;;;;;;;;;;;;;;;;;; @@ -3260,25 +3261,27 @@ "lwhack" ) +(copy-strs "CIWAMINT" "CIWAMRES") + ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; LWIDEB ;; ;;;;;;;;;;;;;;;;;;;;; -;; (cgo "LWIDEB.DGO" "lwideb.gd") +(cgo "LWIDEB.DGO" "lwideb.gd") -;; (copy-textures 2972) +(copy-textures 2972) -;; (copy-gos -;; "grunt-ag" -;; "citizen-norm-ag" -;; "predator-ag" -;; "flitter-ag" -;; "cara-ag" -;; "citizen-norm-rider-ag" -;; "crimson-bike-ag" -;; "bikea-ag" -;; "lwideb" -;; ) +(copy-gos + ;; "grunt-ag" + ;; "citizen-norm-ag" + ;; "predator-ag" + ;; "flitter-ag" + ;; "cara-ag" + ;; "citizen-norm-rider-ag" + ;; "crimson-bike-ag" + ;; "bikea-ag" + "lwideb" + ) ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; LWIDEC @@ -3862,7 +3865,7 @@ "ruins-vis" ) -(copy-strs "RUB1" "RUBW1" "RUBW2" "RUBW3" "RUBW4" "RUBW5" "RUBW6" "RUDPA1" "RUPC1" "RUPC2" "RUTVICTO") +(copy-strs "RUB1" "RUBW1" "RUBW2" "RUBW3" "RUBW4" "RUBW5" "RUBW6" "RUDPA1" "RUPC1" "RUPC2" "RUPC3" "RUGTHRES" "RUSVICTO" "RUTVICTO") ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; SAG @@ -4178,6 +4181,8 @@ "strip-vis" ) +(copy-strs "ECVICTOR") + ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; SWB ;; ;;;;;;;;;;;;;;;;;;;;; @@ -4338,6 +4343,8 @@ "tombb-vis" ) +(copy-strs "TOBINTRO" "TOBRES") + ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; TOC ;; ;;;;;;;;;;;;;;;;;;;;; @@ -4479,32 +4486,34 @@ "underb-vis" ) +(copy-strs "UNBD1" "UNBD2" "UNBD3" "UNBD4" "UNFSRES" "UNCONE" "UNCTWO" "UNCTHREE" "UNGSORES") + ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; UND ;; ;;;;;;;;;;;;;;;;;;;;; -;; (cgo "UND.DGO" "und.gd") +(cgo "UND.DGO" "und.gd") -;; (copy-textures 3045 3048 3049 3047 3276) +(copy-textures 3045 3048 3049 3047 3276) -;; (copy-gos -;; "daxter-highres-ag" -;; "jak-highres-ag" -;; "sig-highres-ag" -;; "centipede-fma-ag" -;; "under-break-bridge-b-ag" -;; "under-break-bridge-ag" -;; "com-airlock-inner-ag" -;; "under-break-door-ag" -;; "grunt-fma-ag" -;; "under-break-ceiling-ag" -;; "under-seaweed-c-ag" -;; "under-seaweed-b-ag" -;; "under-seaweed-d-ag" -;; "under-seaweed-a-ag" -;; "particleman-ag" -;; "under-vis" -;; ) +(copy-gos + ;; "daxter-highres-ag" + ;; "jak-highres-ag" + ;; "sig-highres-ag" + "centipede-fma-ag" + "under-break-bridge-b-ag" + "under-break-bridge-ag" + ;; "com-airlock-inner-ag" + "under-break-door-ag" + ;; "grunt-fma-ag" + "under-break-ceiling-ag" + "under-seaweed-c-ag" + "under-seaweed-b-ag" + "under-seaweed-d-ag" + "under-seaweed-a-ag" + ;; "particleman-ag" + "under-vis" + ) ;; ;;;;;;;;;;;;;;;;;;;;; ;; ;; VIN diff --git a/goal_src/jak2/levels/common/airlock.gc b/goal_src/jak2/levels/common/airlock.gc index 79a7797000..7f1b69d6a5 100644 --- a/goal_src/jak2/levels/common/airlock.gc +++ b/goal_src/jak2/levels/common/airlock.gc @@ -1330,6 +1330,7 @@ This commonly includes things such as: - collision information - loading the skeleton group / bones - sounds" + (stack-size-set! (-> obj main-thread) 1024) ;; added (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 penetrated-by) (penetrate)) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) diff --git a/goal_src/jak2/levels/hiphog/whack.gc b/goal_src/jak2/levels/hiphog/whack.gc index 4cf7aa1374..7fa2b6bbfb 100644 --- a/goal_src/jak2/levels/hiphog/whack.gc +++ b/goal_src/jak2/levels/hiphog/whack.gc @@ -2748,6 +2748,7 @@ ;; WARN: Return type mismatch object vs none. (defbehavior whack-a-metal-init whack-a-metal ((arg0 entity-actor)) + (stack-size-set! (-> self main-thread) 512) ;; added (set! (-> self entity) arg0) (set! (-> self level) (level-get *level* 'hiphog)) (set! (-> self root) (new 'process 'trsqv)) diff --git a/goal_src/jak2/levels/underport/centipede.gc b/goal_src/jak2/levels/underport/centipede.gc index ae4ce2dc94..7084b5f29c 100644 --- a/goal_src/jak2/levels/underport/centipede.gc +++ b/goal_src/jak2/levels/underport/centipede.gc @@ -7,3 +7,1394 @@ ;; DECOMP BEGINS +(deftype centipede-cam (structure) + ((init? symbol :offset-assert 0) + (trans vector :inline :offset-assert 16) + (dir vector :inline :offset-assert 32) + (track-focus-tilt float :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + + +(deftype centipede (nav-enemy) + ((id int8 :offset-assert 604) + (anim-ctr int8 :offset-assert 605) + (focus-pos-hist-count int8 :offset-assert 606) + (legs-sound ambient-sound :offset-assert 608) + (grabbed-focus? symbol :offset-assert 612) + (using-chan1-effects? symbol :offset-assert 616) + (set-camera-mode? symbol :offset-assert 620) + (talking-volume float :offset-assert 624) + (desired-talking-volume float :offset-assert 628) + (legs-volume float :offset-assert 632) + (focus-gnd-height float :offset-assert 636) + (track-focus-tilt float :offset-assert 640) + (bobbing-intensity float :offset-assert 644) + (bobbing trsqv :offset-assert 648) + (src-quat quaternion :inline :offset-assert 656) + (dest-quat quaternion :inline :offset-assert 672) + (cam centipede-cam :inline :offset-assert 688) + (focus-pos-hist vector 15 :inline :offset-assert 752) + ) + :heap-base #x360 + :method-count-assert 189 + :size-assert #x3e0 + :flag-assert #xbd036003e0 + (:methods + (attack () _type_ :state 178) + (attack-failed () _type_ :state 179) + (hidden () _type_ :state 180) + (grab-cam () _type_ :state 181) + (thru-grating () _type_ :state 182) + (centipede-method-183 (_type_) none 183) + (set-chan1-effects (_type_) none 184) + (target-close? (_type_) symbol 185) + (centipede-method-186 (_type_) none 186) + (centipede-method-187 (_type_) none 187) + (centipede-method-188 (_type_) none 188) + ) + ) + + +(defskelgroup skel-centipede centipede centipede-lod0-jg centipede-idle-ja + ((centipede-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 3 10) + :shadow centipede-shadow-mg + :origin-joint-index 3 + ) + +(define *centipede-nav-enemy-info* + (new 'static 'nav-enemy-info + :use-die-falling #f + :use-victory #f + :use-jump-blocked #f + :debug-draw-neck #f + :jump-debug-draw #f + :move-to-ground #f + :hover-if-no-ground #t + :idle-anim-script (new 'static 'array idle-control-frame 4 + (new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x1e) + (new 'static 'idle-control-frame :command (ic-cmd play) :anim #x3 :param0 #x1 :param1 #x1) + (new 'static 'idle-control-frame) + (new 'static 'idle-control-frame) + ) + :idle-anim 3 + :notice-anim 3 + :hostile-anim -1 + :hit-anim 3 + :knocked-anim -1 + :knocked-land-anim -1 + :die-anim 3 + :die-falling-anim 3 + :victory-anim -1 + :jump-wind-up-anim 3 + :jump-in-air-anim 3 + :jump-land-anim 3 + :neck-joint 4 + :look-at-joint 6 + :bullseye-joint 6 + :sound-hit (static-sound-name "centipede-hit") + :sound-die (static-sound-name "centipede-die") + :notice-distance (meters 500) + :notice-distance-delta (meters 10) + :proximity-notice-distance (meters 500) + :default-hit-points #x3e8 + :gnd-collide-with (collide-spec backgnd) + :movement-gravity (meters -100) + :friction 0.8 + :attack-shove-back (meters 5) + :attack-shove-up (meters 3) + :attack-mode 'generic + :attack-damage 2 + :recover-gnd-collide-with (collide-spec backgnd crate obstacle hit-by-others-list pusher) + :jump-height-min (meters 3) + :jump-height-factor 0.5 + :knocked-seek-ry-clamp 2730.6667 + :knocked-soft-vxz-lo 72089.6 + :knocked-soft-vxz-hi 108134.4 + :knocked-soft-vy-lo 81920.0 + :knocked-soft-vy-hi 122880.0 + :knocked-medium-vxz-lo 147456.0 + :knocked-medium-vxz-hi 196608.0 + :knocked-medium-vy-lo 135168.0 + :knocked-medium-vy-hi 151552.0 + :knocked-hard-vxz-lo 78643.2 + :knocked-hard-vxz-hi 117964.8 + :knocked-hard-vy-lo 183500.8 + :knocked-hard-vy-hi 209715.2 + :knocked-huge-vxz-lo 164659.2 + :knocked-huge-vxz-hi 249036.8 + :knocked-huge-vy-lo 183500.8 + :knocked-huge-vy-hi 217907.2 + :knocked-yellow-vxz-lo 40960.0 + :knocked-yellow-vxz-hi 49152.0 + :knocked-yellow-vy-lo 57344.0 + :knocked-yellow-vy-hi 81920.0 + :knocked-red-vxz-lo 24576.0 + :knocked-red-vxz-hi 196608.0 + :knocked-red-vy-lo 94208.0 + :knocked-red-vy-hi 151552.0 + :knocked-blue-vxz-lo 40960.0 + :knocked-blue-vxz-hi 49152.0 + :knocked-blue-vy-lo 24576.0 + :knocked-blue-vy-hi 81920.0 + :shadow-size (meters 2) + :shadow-max-y (meters 2) + :shadow-min-y (meters -3) + :shadow-locus-dist (meters 150) + :gem-joint -1 + :gem-offset (new 'static 'sphere :r 163840.0) + :callback-info #f + :use-momentum #t + :use-frustration #f + :use-stop-chase #f + :use-circling #f + :use-pacing #f + :walk-anim 3 + :turn-anim -1 + :run-anim 3 + :taunt-anim 3 + :run-travel-speed (meters 6) + :run-acceleration (meters 24) + :run-turning-acceleration (meters 50) + :walk-travel-speed (meters 4) + :walk-acceleration (meters 6) + :walk-turning-acceleration (meters 3) + :maximum-rotation-rate (degrees 90.0) + :notice-nav-radius (meters 7) + :frustration-distance (meters 8) + :frustration-time (seconds 4) + :blocked-time (seconds 0.3) + :circle-dist-lo 20480.0 + :circle-dist-hi 61440.0 + :nav-mesh #f + ) + ) + +(set! (-> *centipede-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +(defmethod general-event-handler centipede ((obj centipede) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" + (case arg2 + (('under-break-floor) + (go (method-of-object obj thru-grating)) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + +;; WARN: Return type mismatch nav-enemy vs centipede. +(defmethod relocate centipede ((obj centipede) (arg0 int)) + (if (nonzero? (-> obj bobbing)) + (&+! (-> obj bobbing) arg0) + ) + (if (nonzero? (-> obj legs-sound)) + (&+! (-> obj legs-sound) arg0) + ) + (the-as centipede ((method-of-type nav-enemy relocate) obj arg0)) + ) + +(defmethod deactivate centipede ((obj centipede)) + (when (-> obj set-camera-mode?) + (set! (-> obj set-camera-mode?) #f) + (remove-setting-by-arg0 *setting-control* 'mode-name) + ) + (if (nonzero? (-> obj legs-sound)) + (stop! (-> obj legs-sound)) + ) + ((method-of-type nav-enemy deactivate) obj) + (none) + ) + +;; WARN: Return type mismatch float vs none. +(defmethod centipede-method-187 centipede ((obj centipede)) + (with-pp + (let ((centipede-cam (-> obj cam))) + (let ((cam-dir (new 'stack-no-clear 'vector))) + (set! (-> cam-dir quad) (-> centipede-cam dir quad)) + (vector-z-quaternion! (-> centipede-cam dir) (-> obj root-override2 quat)) + (set! (-> centipede-cam dir y) 0.0) + (vector-normalize! (-> centipede-cam dir) 1.0) + (set! (-> centipede-cam trans quad) (-> obj root-override2 trans quad)) + (set! (-> centipede-cam trans y) + (+ 32768.0 + (* (+ (* 2048.0 (cos (* 218.45334 (the float (mod (-> pp clock frame-counter) 300))))) + (* 614.4 (cos (* 68.91272 (the float (mod (-> pp clock frame-counter) 951))))) + ) + (-> obj bobbing-intensity) + ) + (-> centipede-cam trans y) + ) + ) + (if (= (-> obj id) 1) + (set! (-> centipede-cam dir y) -0.574) + (set! (-> centipede-cam dir y) -0.474) + ) + (vector-normalize! (-> centipede-cam dir) 1.0) + (let ((proc (handle->process (-> obj focus handle))) + (s3-0 #f) + ) + (when (and proc (not (and (-> obj next-state) (let ((v1-27 (-> obj next-state name))) + (or (= v1-27 'attack) (= v1-27 'attack-failed)) + ) + ) + ) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector-! s2-0 (get-trans (the-as process-focusable proc) 0) (-> obj root-override2 trans)) + (vector-normalize! s2-0 1.0) + (when (>= (vector-dot s2-0 (-> centipede-cam dir)) 0.342) + (let ((f0-23 (fmax + 0.0 + (fmin 8192.0 (atan (-> s2-0 y) (sqrtf (+ (* (-> s2-0 x) (-> s2-0 x)) (* (-> s2-0 z) (-> s2-0 z)))))) + ) + ) + ) + (seek! (-> centipede-cam track-focus-tilt) f0-23 (* 65536.0 (-> pp clock seconds-per-frame))) + ) + (set! s3-0 #t) + ) + ) + ) + (if (not s3-0) + (seek! (-> centipede-cam track-focus-tilt) 0.0 (* 65536.0 (-> pp clock seconds-per-frame))) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'vector)) + (s3-1 (new 'stack-no-clear 'quaternion)) + (s2-1 (new 'stack-no-clear 'matrix)) + ) + (vector-rotate90-around-y! s4-1 (-> centipede-cam dir)) + (set! (-> s4-1 y) 0.0) + (vector-normalize! s4-1 1.0) + (quaternion-vector-angle! s3-1 s4-1 (-> centipede-cam track-focus-tilt)) + (quaternion->matrix s2-1 s3-1) + (vector-matrix*! (-> centipede-cam dir) (-> centipede-cam dir) s2-1) + ) + (cond + ((-> centipede-cam init?) + (set! (-> centipede-cam init?) #f) + ) + (else + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (s4-2 (new 'stack-no-clear 'vector)) + ) + (matrix-from-two-vectors-max-angle! s3-2 (-> centipede-cam dir) cam-dir 8192.0) + (vector-matrix*! s4-2 (-> centipede-cam dir) s3-2) + (matrix-from-two-vectors-smooth! s3-2 s4-2 (-> centipede-cam dir) 65536.0 150) + (vector-matrix*! (-> centipede-cam dir) s4-2 s3-2) + ) + ) + ) + ) + (let ((v1-47 *camera*)) + (when v1-47 + (let ((v1-48 (-> v1-47 slave))) + (when v1-48 + (set! (-> v1-48 0 saved-pt quad) (-> centipede-cam trans quad)) + (let ((s5-1 (-> v1-48 0 tracking))) + (vector-cross! (the-as vector (-> s5-1 inv-mat)) *up-vector* (-> centipede-cam dir)) + (vector-normalize! (the-as vector (-> s5-1 inv-mat)) 1.0) + (vector-cross! (-> s5-1 inv-mat vector 1) (-> centipede-cam dir) (the-as vector (-> s5-1 inv-mat))) + (set! (-> s5-1 inv-mat vector 2 quad) (-> centipede-cam dir quad)) + (set! (-> s5-1 inv-mat vector 0 w) 0.0) + (set! (-> s5-1 inv-mat vector 1 w) 0.0) + (set! (-> s5-1 inv-mat vector 2 w) 0.0) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + +(defmethod centipede-method-188 centipede ((obj centipede)) + (local-vars (s5-0 art-element)) + (let ((janim (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and janim (= janim (-> obj draw art-group data 4))) + (when (ja-done? 1) + (-> obj draw art-group data 7) + (let ((v1-10 (get-rand-int obj 100)) + (a0-9 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 1 frame-group) + ) + ) + ) + (cond + ((and (= a0-9 (-> obj draw art-group data 7)) (> (-> obj anim-ctr) 0)) + (+! (-> obj anim-ctr) -1) + (set! s5-0 (-> obj draw art-group data 7)) + ) + ((= a0-9 (-> obj draw art-group data 11)) + (set! s5-0 (-> obj draw art-group data 12)) + (set! (-> obj anim-ctr) (get-rand-int-range obj 0 3)) + ) + ((= a0-9 (-> obj draw art-group data 12)) + (let ((v1-20 (-> obj anim-ctr))) + (cond + ((> v1-20 0) + (set! (-> obj anim-ctr) (+ v1-20 -1)) + (set! s5-0 (-> obj draw art-group data 12)) + ) + (else + (set! s5-0 (-> obj draw art-group data 13)) + ) + ) + ) + ) + ((= a0-9 (-> obj draw art-group data 13)) + (set! s5-0 (-> obj draw art-group data 14)) + (set! (-> obj anim-ctr) (get-rand-int-range obj 0 3)) + ) + ((and (= a0-9 (-> obj draw art-group data 14)) (> (-> obj anim-ctr) 0)) + (+! (-> obj anim-ctr) -1) + (set! s5-0 (-> obj draw art-group data 14)) + ) + ((< v1-10 10) + (set! s5-0 (-> obj draw art-group data 11)) + ) + ((< v1-10 30) + (set! s5-0 (-> obj draw art-group data 8)) + ) + ((< v1-10 50) + (set! s5-0 (-> obj draw art-group data 9)) + ) + ((< v1-10 65) + (set! s5-0 (-> obj draw art-group data 10)) + ) + (else + (set! s5-0 (-> obj draw art-group data 7)) + (set! (-> obj anim-ctr) (get-rand-int-range obj 2 6)) + ) + ) + ) + (let ((a0-17 (-> obj skel root-channel 1))) + (set! (-> a0-17 frame-interp 1) 1.0) + (set! (-> obj skel interp-select 0) 192) + (set! (-> obj skel interp-select 1) 0) + (set! (-> a0-17 frame-group) (the-as art-joint-anim s5-0)) + (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim s5-0) frames num-frames) -1))) + (set! (-> a0-17 param 1) 1.0) + (set! (-> a0-17 frame-num) 0.0) + (joint-control-channel-group! a0-17 (the-as art-joint-anim s5-0) num-func-seek!) + ) + ) + (let ((a0-18 (-> obj skel root-channel 0))) + (set! (-> a0-18 param 0) 0.7) + (joint-control-channel-group-eval! a0-18 (the-as art-joint-anim #f) num-func-loop!) + ) + (let ((a0-19 (-> obj skel root-channel 1))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group frames num-frames) -1))) + (set! (-> a0-19 param 1) 1.0) + (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (else + (ja-channel-push! 2 (seconds 0.15)) + (let ((a0-21 (-> obj skel root-channel 0))) + (set! (-> a0-21 frame-group) (the-as art-joint-anim (-> obj draw art-group data 4))) + (set! (-> a0-21 param 0) 0.7) + (joint-control-channel-group! a0-21 (the-as art-joint-anim (-> obj draw art-group data 4)) num-func-loop!) + ) + (let ((a0-22 (-> obj skel root-channel 1))) + (set! (-> a0-22 frame-interp 1) 1.0) + (set! (-> obj skel interp-select 0) 192) + (set! (-> obj skel interp-select 1) 0) + (set! (-> a0-22 frame-group) (the-as art-joint-anim (-> obj draw art-group data 7))) + (set! (-> a0-22 param 0) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 7)) frames num-frames) -1)) + ) + (set! (-> a0-22 param 1) 1.0) + (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> obj draw art-group data 7)) num-func-seek!) + ) + (set! (-> obj anim-ctr) (get-rand-int-range obj 2 6)) + (when (not (-> obj using-chan1-effects?)) + (set! (-> obj using-chan1-effects?) #t) + (let ((v1-106 (-> obj skel effect))) + (set! (-> v1-106 channel-offset) 1) + ) + 0 + ) + ) + ) + ) + (none) + ) + +(defmethod set-chan1-effects centipede ((obj centipede)) + (when (-> obj using-chan1-effects?) + (set! (-> obj using-chan1-effects?) #f) + (let ((v1-2 (-> obj skel effect))) + (set! (-> v1-2 channel-offset) 0) + ) + 0 + ) + (none) + ) + +;; WARN: Return type mismatch quaternion vs none. +(defmethod nav-enemy-method-142 centipede ((obj centipede) (arg0 nav-control)) + (with-pp + (let ((t9-0 (method-of-type nav-enemy nav-enemy-method-142))) + (t9-0 obj arg0) + ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! s5-0 (-> obj root-override2 quat)) + (vector-normalize! s5-0 1.0) + (let ((s3-0 (handle->process (-> obj focus handle))) + (s4-0 #f) + ) + (cond + (s3-0 + (let ((s2-0 (-> obj focus-pos-hist-count))) + (countdown (v1-7 (min 14 s2-0)) + (set! (-> obj focus-pos-hist (+ v1-7 1) quad) (-> obj focus-pos-hist v1-7 quad)) + ) + (set! (-> obj focus-pos-hist 0 quad) (-> (get-trans (the-as process-focusable s3-0) 0) quad)) + (if (< s2-0 15) + (set! (-> obj focus-pos-hist-count) (+ s2-0 1)) + ) + ) + ) + (else + (set! (-> obj focus-pos-hist-count) 0) + 0 + ) + ) + (when s3-0 + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-! s3-1 (-> obj focus-pos-hist (+ (-> obj focus-pos-hist-count) -1)) (-> obj root-override2 trans)) + (vector-normalize! s3-1 1.0) + (when (>= (vector-dot s3-1 s5-0) 0.342) + (let ((f0-9 + (fmax + 0.0 + (fmin 8192.0 (atan (-> s3-1 y) (sqrtf (+ (* (-> s3-1 x) (-> s3-1 x)) (* (-> s3-1 z) (-> s3-1 z)))))) + ) + ) + ) + (set! (-> obj track-focus-tilt) + (seek-with-smooth (-> obj track-focus-tilt) f0-9 (* 5461.3335 (-> pp clock seconds-per-frame)) 0.25 1.0) + ) + ) + (set! s4-0 #t) + ) + ) + ) + (if (not s4-0) + (set! (-> obj track-focus-tilt) + (seek-with-smooth (-> obj track-focus-tilt) 0.0 (* 5461.3335 (-> pp clock seconds-per-frame)) 0.25 1.0) + ) + ) + ) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'quaternion)) + ) + (vector-rotate90-around-y! s3-2 s5-0) + (quaternion-vector-angle! s4-1 s3-2 (+ 4551.1113 (-> obj track-focus-tilt))) + (quaternion*! (-> obj root-override2 quat) s4-1 (-> obj root-override2 quat)) + ) + ) + (none) + ) + ) + +(defmethod coin-flip? centipede ((obj centipede)) + "@returns The result of a 50/50 RNG roll" + #f + ) + +(defmethod in-aggro-range? centipede ((obj centipede) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" + (when arg0 + (if (not arg1) + (set! arg1 (get-trans arg0 0)) + ) + (when arg1 + (let* ((f0-0 (-> obj root-override2 trans y)) + (v1-4 (-> obj root-override2)) + (f1-0 (-> v1-4 trans y)) + (a0-2 (-> obj fact-info-override)) + ) + (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) + (let* ((f30-0 (-> obj enemy-info-override notice-nav-radius)) + (f0-1 f30-0) + ) + (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (is-in-mesh? (-> obj nav) arg1 f30-0) + ) + ) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch process vs process-focusable. +(defmethod get-enemy-target centipede ((obj centipede)) + "@returns the [[process-focusable]] that the enemy is currently focusing on, or [[#f]] otherwise" + (let ((v0-0 (handle->process (-> obj focus handle)))) + (if (and v0-0 (logtest? (-> (the-as process-focusable v0-0) focus-status) (focus-status disable dead grabbed))) + (set! v0-0 (the-as process #f)) + ) + (the-as process-focusable v0-0) + ) + ) + +(defmethod target-close? centipede ((obj centipede)) + "Is the target close enough to attack?" + (let ((targ (get-enemy-target obj))) + (when targ + (let* ((targ-pos (get-trans targ 0)) + (y-off (- (-> targ-pos y) (-> obj root-override2 trans y))) + (dist 28672.0) + ) + (and (>= (* dist dist) (vector-vector-xz-distance-squared (-> obj root-override2 trans) targ-pos)) + (or (>= y-off -12288.0) (or (>= 24576.0 y-off) (logtest? (-> targ focus-status) (focus-status edge-grab)))) + ) + ) + ) + ) + ) + +(defmethod centipede-method-183 centipede ((obj centipede)) + (with-pp + (when (not (and (-> obj next-state) (= (-> obj next-state name) 'thru-grating))) + (centipede-method-187 obj) + (when (= (-> obj id) 2) + (let ((overlap-parms (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> overlap-parms options) (overlaps-others-options)) + (set! (-> overlap-parms collide-with-filter) (the-as collide-spec -1)) + (set! (-> overlap-parms tlist) *touching-list*) + (find-overlapping-shapes (-> obj root-override2) overlap-parms) + ) + ) + (let* ((travel-speed (-> *centipede-nav-enemy-info* run-travel-speed)) + (f0-2 (fmin 1.0 (/ (vector-length (-> obj root-override2 transv)) travel-speed))) + ) + (seek! (-> obj bobbing-intensity) f0-2 (* 4.0 (-> pp clock seconds-per-frame))) + ) + (quaternion-copy! (-> obj bobbing quat) (-> obj root-override2 quat)) + (set! (-> obj bobbing trans quad) (-> obj root-override2 trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (f30-1 (* 2662.4 (cos (* 283.70563 (the float (mod (-> pp clock frame-counter) 231)))))) + (bob-trans (-> obj bobbing trans)) + ) + (vector-z-quaternion! s5-0 (-> obj root-override2 quat)) + (set! (-> s5-0 y) 0.0) + (vector-normalize! s5-0 (* f30-1 (-> obj bobbing-intensity))) + (vector+! (the-as vector (&-> bob-trans x)) (the-as vector (&-> bob-trans x)) s5-0) + ) + ) + (update-trans! (-> obj sound) (-> obj root-override2 trans)) + (when (!= (-> obj talking-volume) (-> obj desired-talking-volume)) + (seek! (-> obj talking-volume) (-> obj desired-talking-volume) (* 4.0 (-> pp clock seconds-per-frame))) + (update-vol! (-> obj sound) (-> obj talking-volume)) + ) + (update! (-> obj sound)) + (update-trans! (-> obj legs-sound) (-> obj root-override2 trans)) + (let ((f0-20 (fmin 1.0 (* 0.00012207031 (vector-length (-> obj root-override2 transv)))))) + (when (!= (-> obj legs-volume) f0-20) + (seek! (-> obj legs-volume) f0-20 (* 4.0 (-> pp clock seconds-per-frame))) + (update-vol! (-> obj legs-sound) (-> obj legs-volume)) + ) + ) + (update! (-> obj legs-sound)) + (none) + ) + ) + +(defmethod track-target! centipede ((obj centipede)) + "Does a lot of various things relating to interacting with the target +- tracks when the enemy was last drawn +- looks at the target and handles attacking +@TODO Not extremely well understood yet" + (with-pp + (let ((t9-0 (method-of-type nav-enemy track-target!))) + (t9-0 obj) + ) + (let ((a0-3 (handle->process (-> obj focus handle)))) + (when a0-3 + (let ((f0-0 (-> (get-trans (the-as process-focusable a0-3) 1) y))) + (if (!= f0-0 -40959590.0) + (set! (-> obj focus-gnd-height) f0-0) + ) + ) + ) + ) + (let ((s5-0 (-> obj root-override2))) + (set! (-> s5-0 gspot-pos quad) (-> s5-0 trans quad)) + (let ((v1-12 (-> obj nav)) + (a0-8 (-> s5-0 trans)) + (a1-2 (new 'stack-no-clear 'nav-find-poly-parms)) + ) + (vector-! (-> a1-2 point) a0-8 (-> v1-12 state mesh bounds)) + (set! (-> a1-2 y-threshold) (-> v1-12 nearest-y-threshold)) + (set! (-> a1-2 ignore) (the-as uint 2)) + (let ((a1-3 (find-poly-containing-point-local (-> v1-12 state mesh) a1-2)) + (s4-0 (new 'stack-no-clear 'collide-query)) + ) + (when a1-3 + (let ((s2-0 (-> obj nav)) + (s3-0 (-> s4-0 best-other-tri intersect)) + ) + (let ((a3-2 (-> s4-0 best-other-tri normal)) + (v1-15 (-> s5-0 trans)) + ) + (project-point-onto-plane-of-poly-local + (-> s2-0 state mesh) + a1-3 + s3-0 + a3-2 + (vector-! (new 'stack-no-clear 'vector) v1-15 (-> s2-0 state mesh bounds)) + ) + ) + (vector+! s3-0 s3-0 (-> s2-0 state mesh bounds)) + ) + 0 + (let ((f0-2 1024.0)) + (if (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> s4-0 best-other-tri intersect) (-> s5-0 trans))) + (set! (-> s5-0 gspot-pos y) (-> s4-0 best-other-tri intersect y)) + ) + ) + ) + ) + ) + (let ((f0-6 (-> obj root-override2 trans y))) + (cond + ((>= (-> s5-0 gspot-pos y) f0-6) + (set! (-> s5-0 trans y) (-> s5-0 gspot-pos y)) + ) + ((and (!= (-> obj focus-gnd-height) -40959590.0) + (>= (- (-> obj focus-gnd-height) (-> s5-0 gspot-pos y)) 4096.0) + ) + (set! (-> s5-0 trans y) (seek-with-smooth + (-> s5-0 trans y) + (-> obj focus-gnd-height) + (* 24576.0 (-> pp clock seconds-per-frame)) + 0.25 + 1.0 + ) + ) + ) + (else + (set! (-> s5-0 trans y) (seek-with-smooth + (-> s5-0 trans y) + (-> s5-0 gspot-pos y) + (* 24576.0 (-> pp clock seconds-per-frame)) + 0.25 + 1.0 + ) + ) + ) + ) + ) + ) + (centipede-method-183 obj) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-idle centipede ((obj centipede)) + (case (-> obj id) + ((1) + (cond + ((or (not *target*) + (task-node-closed? (game-task-node under-sig-centipede1-end)) + (and *debug-segment* (cpad-hold? 0 l2)) + ) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ((task-node-closed? (game-task-node under-sig-centipede1-start)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (go (method-of-object obj grab-cam)) + ) + (else + (go (method-of-object obj hidden)) + ) + ) + ) + ((2) + (cond + ((or (not *target*) + (task-node-closed? (game-task-node under-sig-resolution)) + (and *debug-segment* (cpad-hold? 0 l2)) + ) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ((task-node-closed? (game-task-node under-sig-centipede2-start)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (go (method-of-object obj grab-cam)) + ) + (else + (go (method-of-object obj hidden)) + ) + ) + ) + (else + (go process-drawable-art-error "bad centipede id") + ) + ) + (none) + ) + +(defstate hidden (centipede) + :virtual #t + :enter (behavior () + (logior! (-> self focus-status) (focus-status disable)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 0.0) + (let ((v1-5 (-> self root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (none) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-5 (-> self root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-5 prim-core collide-with) (-> self root-override2 backup-collide-with)) + ) + (none) + ) + :code (the-as (function none :behavior centipede) sleep-code) + ) + +(defstate grab-cam (centipede) + :virtual #t + :exit (behavior () + (set-chan1-effects self) + (none) + ) + :code (behavior () + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (set! (-> self desired-talking-volume) 0.0) + (centipede-method-187 self) + (set-setting! 'interp-time 'abs 0 0) + (when (not (-> self set-camera-mode?)) + (set! (-> self set-camera-mode?) #t) + (set-setting-by-param *setting-control* 'mode-name 'cam-fixed 0 0) + ) + (set-setting! 'allow-look-around #f 0 0) + (suspend) + (until #f + (let ((v1-13 *camera*)) + (when (and v1-13 (-> v1-13 slave)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) + (set! (-> self enemy-flags) (logior (enemy-flag dangerous-backup) (-> self enemy-flags))) + (logclear! (-> self mask) (process-mask actor-pause)) + (go-hostile self) + ) + ) + (centipede-method-188 self) + (suspend) + ) + #f + (none) + ) + ) + +(defstate idle (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy idle) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy idle) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :code (behavior () + (until #f + (cond + (*target* + (set! (-> self state-time) (-> self clock frame-counter)) + ) + (else + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (cleanup-for-death self) + (go-virtual die-fast) + ) + ) + ) + (centipede-method-188 self) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior centipede) nav-enemy-simple-post) + ) + +(defstate active (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy active) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy active) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :code (-> (method-of-type centipede idle) code) + :post (-> (method-of-type centipede idle) post) + ) + +(defstate stare (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy stare) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy stare) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :code (-> (method-of-type centipede idle) code) + ) + +(defstate hostile (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy hostile) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (let ((v1-6 (handle->process (-> self focus handle)))) + (if (or (not v1-6) (logtest? (-> (the-as process-focusable v1-6) focus-status) (focus-status dead))) + (go-virtual stop-chase) + ) + ) + ) + (let ((t9-1 (-> (method-of-type nav-enemy hostile) trans))) + (if t9-1 + (t9-1) + ) + ) + (if (target-close? self) + (go-virtual attack) + ) + (none) + ) + :code (the-as (function none :behavior centipede) sleep-code) + :post (behavior () + (centipede-method-188 self) + (let ((a0-2 (handle->process (-> self focus handle)))) + (when a0-2 + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> (get-trans (the-as process-focusable a0-2) 0) quad)) + (set! (-> gp-0 y) (-> self root-override2 trans y)) + (let ((v1-12 (-> self nav state))) + (logclear! (-> v1-12 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-12 flags) (nav-state-flag target-poly-dirty)) + (set! (-> v1-12 target-post quad) (-> gp-0 quad)) + ) + ) + 0 + ) + ) + (nav-enemy-method-176 self) + (none) + ) + ) + +(defstate stop-chase (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy stop-chase) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy stop-chase) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (react-to-focus self) + ) + (none) + ) + :code (the-as (function none :behavior centipede) sleep-code) + :post (behavior () + (centipede-method-188 self) + (nav-enemy-method-176 self) + (none) + ) + ) + +;; WARN: Return type mismatch quaternion vs none. +(defmethod centipede-method-186 centipede ((obj centipede)) + (with-pp + (let ((proc (handle->process (-> obj focus handle)))) + (when proc + (set! (-> obj focus-pos quad) (-> (get-trans (the-as process-focusable proc) 0) quad)) + (when (and (not (-> obj grabbed-focus?)) (= (-> proc type) target) (>= (ja-frame-num 0) 5.0)) + (let ((msg (new 'stack-no-clear 'event-message-block))) + (set! (-> msg from) (process->ppointer pp)) + (set! (-> msg num-params) 2) + (set! (-> msg message) 'attack-invinc) + (set! (-> msg param 0) (the-as uint #f)) + (let ((v1-16 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-9 *game-info*) + (a2-1 (+ (-> a0-9 attack-id) 1)) + ) + (set! (-> a0-9 attack-id) a2-1) + (set! (-> v1-16 id) a2-1) + ) + (set! (-> v1-16 mode) 'centipede) + (set! (-> msg param 1) (the-as uint v1-16)) + ) + (if (send-event-function proc msg) + (set! (-> obj grabbed-focus?) #t) + ) + ) + ) + (when (not (-> obj grabbed-focus?)) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (let ((cam-dir (new 'stack-no-clear 'vector)) + (trans-off (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (new 'stack-no-clear 'matrix))) + (set! (-> cam-dir quad) (-> obj cam dir quad)) + (set! (-> cam-dir y) 0.0) + (vector-normalize! cam-dir 1.0) + (vector-! trans-off (-> obj focus-pos) (-> obj root-override2 trans)) + (set! (-> s5-1 quad) (-> trans-off quad)) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (matrix-from-two-vectors-max-angle! s2-0 cam-dir s5-1 7281.778) + (vector-matrix*! s5-1 cam-dir s2-0) + ) + (let ((v1-25 s5-1) + (a0-22 s5-1) + (a1-9 trans-off) + ) + (vector-float*! v1-25 a0-22 (sqrtf (+ (* (-> a1-9 x) (-> a1-9 x)) (* (-> a1-9 z) (-> a1-9 z))))) + ) + (set! (-> s5-1 y) (+ 49152.0 (-> trans-off y))) + ) + (vector-normalize! s5-1 1.0) + (quaternion-look-at! (-> obj dest-quat) s5-1 *up-vector*) + ) + ) + ) + ) + (let ((f0-12 (fmin 1.0 (* 0.16666667 (ja-frame-num 0))))) + (quaternion-slerp! (-> obj root-override2 quat) (-> obj src-quat) (-> obj dest-quat) f0-12) + ) + (none) + ) + ) + +(defstate attack (centipede) + :virtual #t + :enter (behavior () + (let ((v1-0 self)) + (set! (-> v1-0 enemy-flags) (the-as enemy-flag (logclear (-> v1-0 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) + (set! (-> self grabbed-focus?) #f) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 0.0) + (let ((gp-0 (handle->process (-> self focus handle)))) + (if (not gp-0) + (go-hostile self) + ) + (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) + ) + (quaternion-copy! (-> self src-quat) (-> self root-override2 quat)) + (quaternion-copy! (-> self dest-quat) (-> self src-quat)) + (none) + ) + :exit (behavior () + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (none) + ) + :trans (behavior () + (when (-> self grabbed-focus?) + (let ((v1-3 (handle->process (-> self focus handle)))) + (if v1-3 + (vector-seek-3d-smooth! + (-> (the-as process-focusable v1-3) root-override trans) + (-> self root-override2 trans) + (* 28672.0 (-> self clock seconds-per-frame)) + 0.8 + ) + ) + ) + ) + (none) + ) + :code (behavior () + (local-vars (a1-5 event-message-block)) + (ja-channel-push! 1 (seconds 0.17)) + (ja-no-eval :group! centipede-attack0-ja + :num! (seek! (the float (+ (-> (the-as art-joint-anim centipede-attack0-ja) frames num-frames) -1)) 3.0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (centipede-method-186 self) + (suspend) + (ja :num! (seek! max 3.0)) + ) + (if (not (-> self grabbed-focus?)) + (go-virtual attack-failed) + ) + (ja-no-eval :group! centipede-eat0-ja + :num! (seek! (the float (+ (-> (the-as art-joint-anim centipede-eat0-ja) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (when (-> self grabbed-focus?) + (until (send-event-function *target* a1-5) + (suspend) + (set! a1-5 (new 'stack-no-clear 'event-message-block)) + (let ((v1-57 (process->ppointer self))) + (set! (-> a1-5 from) v1-57) + ) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'end-mode) + ) + ) + (go-hostile self) + (none) + ) + :post (behavior () + (transform-post) + (centipede-method-183 self) + (none) + ) + ) + +(defstate attack-failed (centipede) + :virtual #t + :exit (behavior () + (set-chan1-effects self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self desired-talking-volume) 1.0) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.35)) + (let* ((v1-5 (- (-> self clock frame-counter) (-> self state-time))) + (f1-2 (* 0.00952381 (the float v1-5))) + ) + (quaternion-slerp! (-> self root-override2 quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (* f1-2 f1-2))) + ) + (centipede-method-188 self) + (suspend) + ) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (centipede-method-188 self) + (suspend) + ) + (go-hostile self) + (none) + ) + :post (-> (method-of-type centipede attack) post) + ) + +(defstate thru-grating (centipede) + :virtual #t + :enter (behavior () + (let ((v1-0 self)) + (set! (-> v1-0 enemy-flags) (the-as enemy-flag (logclear (-> v1-0 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (none) + ) + :code (behavior () + (logior! (-> self focus-status) (focus-status disable)) + (let ((v1-3 (-> self root-override2 root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (when (-> self set-camera-mode?) + (set! (-> self set-camera-mode?) #f) + (remove-setting-by-arg0 *setting-control* 'mode-name) + ) + (remove-setting! 'allow-look-around) + (set-setting! 'entity-name "camera-252" 0 0) + (centipede-method-188 self) + (suspend) + (suspend) + (remove-setting! 'interp-time) + (remove-setting! 'entity-name) + (logior! (-> self draw status) (draw-control-status no-draw)) + (cleanup-for-death self) + (sleep-code) + (none) + ) + :post (behavior () + (centipede-method-183 self) + (none) + ) + ) + +;; WARN: Return type mismatch collide-shape-moving vs none. +(defmethod init-enemy-collision! centipede ((obj centipede)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 9) 0))) + (set! (-> s5-0 total-prims) (the-as uint 10)) + (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> s4-0 prim-core action) (collide-action solid semi-solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 12288.0 40960.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-13 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set! (-> v1-13 transform-index) 3) + (set-vector! (-> v1-13 local-sphere) 0.0 -4096.0 -8192.0 14336.0) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 -4096.0 6144.0 13721.6) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-17 prim-core action) (collide-action solid)) + (set! (-> v1-17 transform-index) 3) + (set-vector! (-> v1-17 local-sphere) 0.0 -4096.0 12288.0 13312.0) + ) + (let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-19 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-19 prim-core action) (collide-action solid)) + (set! (-> v1-19 transform-index) 7) + (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 7782.4) + ) + (let ((v1-21 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-21 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-21 prim-core action) (collide-action solid)) + (set! (-> v1-21 transform-index) 7) + (set-vector! (-> v1-21 local-sphere) 4096.0 12288.0 0.0 3686.4) + ) + (let ((v1-23 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-23 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-23 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-23 prim-core action) (collide-action semi-solid)) + (set! (-> v1-23 transform-index) 7) + (set-vector! (-> v1-23 local-sphere) 3276.8 20480.0 0.0 2457.6) + ) + (let ((v1-25 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-25 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-25 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-25 prim-core action) (collide-action solid)) + (set! (-> v1-25 transform-index) 8) + (set-vector! (-> v1-25 local-sphere) 0.0 0.0 0.0 7782.4) + ) + (let ((v1-27 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-27 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-27 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-27 prim-core action) (collide-action solid)) + (set! (-> v1-27 transform-index) 8) + (set-vector! (-> v1-27 local-sphere) -4096.0 12288.0 0.0 3686.4) + ) + (let ((v1-29 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-29 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-29 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-29 prim-core action) (collide-action semi-solid)) + (set! (-> v1-29 transform-index) 8) + (set-vector! (-> v1-29 local-sphere) -3276.8 20480.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-32 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-32 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-32 prim-core collide-with)) + ) + (set! (-> s5-0 event-other) 'centipede) + (set! (-> obj root-override2) s5-0) + ) + (none) + ) + +(defmethod init-enemy! centipede ((obj centipede)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (set! (-> obj id) (res-lump-value (-> obj entity) 'extra-id int :time -1000000000.0)) + (set! (-> obj cam init?) #t) + (set! (-> obj using-chan1-effects?) #f) + (set! (-> obj set-camera-mode?) #f) + (set! (-> obj focus-gnd-height) -40959590.0) + (set! (-> obj bobbing-intensity) 1.0) + (set-vector! (-> obj root-override2 scale) 0.75 0.75 0.75 1.0) + (set! (-> obj root-override2 trans y) (+ 4096.0 (-> obj root-override2 trans y))) + (case (-> obj id) + ((1) + (let ((v1-10 (-> obj root-override2))) + (set-vector! (-> v1-10 quat) -0.2103 -0.2293 -0.0508 0.949) + (set! (-> v1-10 trans x) -248325.33) + (set! (-> v1-10 trans z) 8201697.0) + ) + (set! (-> *centipede-nav-enemy-info* run-travel-speed) 32768.0) + ) + ((2) + (let ((v1-16 (-> obj root-override2))) + (set-vector! (-> v1-16 quat) -0.1832 0.519 0.115 0.827) + (set! (-> v1-16 trans x) -1001253.25) + (set! (-> v1-16 trans z) 7913366.5) + ) + (set! (-> *centipede-nav-enemy-info* run-travel-speed) 30720.0) + ) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-centipede" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) + (init-enemy-behaviour-and-stats! obj *centipede-nav-enemy-info*) + (logclear! (-> obj mask) (process-mask enemy)) + (set! (-> obj mask) (logior (process-mask bot) (-> obj mask))) + (let ((v1-31 (-> obj nav))) + (set! (-> v1-31 sphere-mask) (the-as uint 64)) + ) + 0 + (logclear! (-> obj root-override2 nav-flags) (nav-flags has-root-sphere has-extra-sphere)) + (let ((v1-35 (-> obj nav))) + (set! (-> v1-35 speed-scale) 1.0) + ) + 0 + (set-gravity-length (-> obj root-override2 dynam) 573440.0) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (set! (-> obj bobbing) (the-as trsqv (new 'process 'joint-mod-set-world obj 3 #t))) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "cent-talk" :fo-max 90) (-> obj root-override2 trans)) + ) + (update-vol! (-> obj sound) 0.0) + (set! (-> obj talking-volume) 0.0) + (set! (-> obj desired-talking-volume) 0.0) + (set! (-> obj legs-sound) + (new 'process 'ambient-sound (static-sound-spec "cent-legs-loop" :fo-max 90) (-> obj root-override2 trans)) + ) + (update-vol! (-> obj sound) 0.0) + (set! (-> obj legs-volume) 0.0) + 0 + (none) + ) diff --git a/goal_src/jak2/levels/underport/pipe-grunt.gc b/goal_src/jak2/levels/underport/pipe-grunt.gc index 85bd541a40..ccf0520815 100644 --- a/goal_src/jak2/levels/underport/pipe-grunt.gc +++ b/goal_src/jak2/levels/underport/pipe-grunt.gc @@ -7,3 +7,109 @@ ;; DECOMP BEGINS +(deftype pipe-grunt (grunt) + ((pipe-front vector :inline :offset-assert 704) + (pipe-dir vector :inline :offset-assert 720) + ) + :heap-base #x260 + :method-count-assert 187 + :size-assert #x2e0 + :flag-assert #xbb026002e0 + (:methods + (pipe-grunt-method-186 (_type_) vector 186) + ) + ) + + +;; WARN: Return type mismatch object vs none. +(defmethod go-ambush pipe-grunt ((obj pipe-grunt)) + (go (method-of-object obj ambush)) + (none) + ) + +(defmethod pipe-grunt-method-186 pipe-grunt ((obj pipe-grunt)) + (let ((gp-0 (new 'static 'vector :x -1187061.8 :y -278487.03 :z 8090870.0 :w 1.0))) + (let ((v1-0 (new 'static 'vector :x -1148026.9 :y -278487.03 :z 8112414.5 :w 1.0)) + (s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 v1-0 gp-0) + (let ((f30-0 (vector-length s3-0))) + (vector-normalize! s3-0 1.0) + (vector-rotate90-around-y! s4-0 s3-0) + (vector-normalize-copy! (-> obj event-param-point) s3-0 (get-rand-float-range obj 0.0 f30-0)) + ) + (vector-normalize! s4-0 (get-rand-float-range obj -16384.0 16384.0)) + (vector+! (-> obj event-param-point) (-> obj event-param-point) s4-0) + ) + (vector+! (-> obj event-param-point) (-> obj event-param-point) gp-0) + ) + ) + +(defstate ambush (pipe-grunt) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior pipe-grunt) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory)) + (let ((v1-7 (-> self root-override2 root-prim))) + (set! (-> v1-7 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-7 prim-core collide-with) (-> self root-override2 backup-collide-with)) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-10 self)) + (set! (-> v1-10 enemy-flags) (the-as enemy-flag (logclear (-> v1-10 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-10 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (set-vector! (-> self pipe-front) -1198776.4 -224337.92 8087470.0 1.0) + (vector-! (-> self pipe-dir) (-> self pipe-front) (-> self root-override2 trans)) + (vector-normalize! (-> self pipe-dir) 1.0) + (quaternion-look-at! (-> self root-override2 quat) (-> self pipe-dir) *up-vector*) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (vector-normalize-copy! (-> self root-override2 transv) (-> self pipe-dir) (-> self charge-anim travel-speed)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-rotate90-around-y! gp-0 (-> self pipe-dir)) + (vector-normalize! gp-0 (get-rand-float-range self -4096.0 4096.0)) + (move-by-vector! (-> self root-override2) gp-0) + ) + (none) + ) + :trans (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self root-override2 trans quad)) + (vector-v++! gp-0 (-> self root-override2 transv)) + (move-to-point! (-> self root-override2) gp-0) + (let ((v1-4 (new 'stack-no-clear 'vector))) + (vector-! v1-4 (-> self pipe-front) gp-0) + (when (< (vector-dot v1-4 (-> self pipe-dir)) 0.0) + (pipe-grunt-method-186 self) + (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (send-event self 'jump 0 (-> self event-param-point)) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (ja-channel-push! 1 0) + (until #f + (let ((a1-2 (-> self draw art-group data (-> self charge-anim anim-index)))) + (ja-no-eval :group! a1-2 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1)) f30-0) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior pipe-grunt) nav-enemy-simple-post) + ) diff --git a/goal_src/jak2/levels/underport/sig5-course.gc b/goal_src/jak2/levels/underport/sig5-course.gc index ae0198ce0a..2a611a0684 100644 --- a/goal_src/jak2/levels/underport/sig5-course.gc +++ b/goal_src/jak2/levels/underport/sig5-course.gc @@ -7,3 +7,1935 @@ ;; DECOMP BEGINS +(deftype sig5-course (bot-course) + ((chase-speeches bot-speech-list-shuffle :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + + +(deftype sig-under (sig) + ((sig5-course sig5-course :offset 652) + (shot-at-growls-index int8 :offset-assert 1072) + (growls handle 2 :offset-assert 1080) + (next-chase-play-time time-frame :offset 1096) + (grating-broken-time time-frame :offset 1096) + (test-plane plane :inline :offset-assert 1104) + ) + :heap-base #x3e0 + :method-count-assert 265 + :size-assert #x460 + :flag-assert #x10903e00460 + (:methods + (intro-shooting () _type_ :state 259) + (sig-under-method-260 (_type_) symbol 260) + (sig-under-method-261 (_type_ vector vector symbol) symbol 261) + (sig-under-method-262 (_type_ symbol) symbol 262) + (sig-under-method-263 (_type_) none 263) + (sig-under-method-264 (_type_) symbol 264) + ) + ) + + +;; WARN: Return type mismatch time-frame vs none. +(defmethod sig-under-method-263 sig-under ((obj sig-under)) + (with-pp + (let ((s5-0 (-> pp clock frame-counter))) + (when (and (>= s5-0 (-> obj next-chase-play-time)) + (not (channel-active? obj (the-as uint 0))) + (>= (the-as int (sig-method-256 obj)) 750) + ) + (let ((a1-2 (bot-speech-list-method-9 + (-> obj sig5-course chase-speeches) + obj + (-> obj sig5-course speeches) + (speech-flags) + ) + ) + ) + (when (>= a1-2 0) + (play-speech obj a1-2) + (set! (-> obj next-chase-play-time) (+ s5-0 (get-rand-int-range obj 1500 2700))) + ) + ) + ) + ) + (none) + ) + ) + +;; WARN: Return type mismatch object vs symbol. +(defmethod attacked-by-player? sig-under ((obj sig-under) (arg0 process-focusable)) + "Were we attacked by the player?" + (the-as + symbol + (and (and arg0 (zero? (logand (-> arg0 focus-status) (focus-status disable dead ignore grabbed)))) + (or (and (logtest? (process-mask enemy) (-> arg0 mask)) (zero? (logand (bot-flags bf26) (-> obj bot-flags)))) + (and (logtest? (-> arg0 mask) (process-mask target)) (logtest? (-> obj bot-flags) (bot-flags attacked))) + ) + ) + ) + ) + +(defmethod enemy-method-86 sig-under ((obj sig-under)) + (let ((gp-0 (-> obj root-override2))) + (when (< (-> gp-0 transv y) 0.0) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (find-ground (-> obj root-override2) a1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + ) + (>= (-> gp-0 gspot-pos y) (-> gp-0 trans y)) + ) + ) + ) + +;; WARN: Return type mismatch object vs symbol. +(defmethod enemy-method-76 sig-under ((obj sig-under) (arg0 process) (arg1 event-message-block)) + (with-pp + (the-as + symbol + (cond + ((and (and (-> obj next-state) (= (-> obj next-state name) 'jump)) (type? arg0 under-break-floor)) + (let ((v1-5 (-> arg1 param 0)) + (a1-2 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) v1-5) + (let ((v1-6 (new 'static 'attack-info :mask (attack-info-mask id penetrate-using)))) + (let* ((a0-6 *game-info*) + (a2-3 (+ (-> a0-6 attack-id) 1)) + ) + (set! (-> a0-6 attack-id) a2-3) + (set! (-> v1-6 id) a2-3) + ) + (set! (-> v1-6 penetrate-using) (penetrate flop)) + (set! (-> a1-2 param 1) (the-as uint v1-6)) + ) + (send-event-function arg0 a1-2) + ) + ) + (else + ((method-of-type sig enemy-method-76) obj arg0 arg1) + ) + ) + ) + ) + ) + +(defmethod general-event-handler sig-under ((obj sig-under) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" + (with-pp + (case arg2 + (('set-task) + (let* ((s1-1 (logtest? (-> obj bot-task-bits) 16)) + (t9-0 (method-of-type sig general-event-handler)) + (s5-1 (t9-0 obj arg0 arg1 arg2 arg3)) + ) + (when (and (not s1-1) (logtest? (-> obj bot-task-bits) 16)) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'under-break-floor) + (let ((t9-1 send-event-function) + (v1-11 (-> obj actor-group 0 data 8 actor)) + ) + (t9-1 + (if v1-11 + (-> v1-11 extra process) + ) + a1-2 + ) + ) + ) + ) + s5-1 + ) + ) + (('centipede-chase) + (let ((v1-14 *sig5-cent1-path0*)) + (if (= (-> arg3 param 0) 2) + (set! v1-14 *sig5-cent2-path0*) + ) + (send-event obj 'sig-path v1-14) + ) + ) + (('notify) + (if (and (type? arg0 sig-shot) + (= (-> arg3 param 0) 'die) + (-> obj next-state) + (= (-> obj next-state name) 'intro-shooting) + ) + (send-event (handle->process (-> obj growls (-> obj shot-at-growls-index))) 'sig-shot) + ((method-of-type sig general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + (else + ((method-of-type sig general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +;; WARN: disable def twice: 39. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod sig-under-method-262 sig-under ((obj sig-under) (arg0 symbol)) + (when (or (logtest? (-> obj bot-task-bits) 2) + (and arg0 + (let ((f0-0 81920.0)) + (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> obj root-override2 trans))) + ) + ) + ) + (cond + ((speech-playing? obj 7) + (and (not (channel-active? obj (the-as uint 0))) (scene-play obj "under-centipede-one" #f)) + ) + (else + (play-speech obj 7) + (reset-warn-time! obj) + #f + ) + ) + ) + ) + +(defmethod sig-under-method-264 sig-under ((obj sig-under)) + (and (logtest? (-> obj bot-task-bits) 8) + (not (channel-active? obj (the-as uint 0))) + (scene-play obj "under-get-sig-out-res" #f) + ) + ) + +(defmethod sig-under-method-260 sig-under ((obj sig-under)) + (local-vars (a2-5 float) (a2-12 float)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + ) + (let ((gp-0 (new 'stack-no-clear 'sphere))) + (set! (-> gp-0 quad) (-> obj root-override2 trans quad)) + (set! (-> gp-0 r) 327680.0) + (set! *actor-list-length* 0) + (if #t + (set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* gp-0 *actor-list* 256)) + ) + (when #f + (let ((a0-5 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-12 (-> a0-5 next0))) + (while (!= a0-5 (-> *collide-player-list* alive-list-end)) + (let* ((a0-6 (-> (the-as connection a0-5) param1)) + (a1-1 (-> (the-as collide-shape a0-6) root-prim)) + ) + (when (logtest? (-> a1-1 prim-core collide-as) (collide-spec enemy hit-by-others-list)) + (let ((a1-2 (-> a1-1 prim-core))) + (let ((a2-4 a1-2) + (a3-1 gp-0) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-1 a2-5) + (f1-1 (+ (-> a1-2 world-sphere w) (-> gp-0 r))) + ) + (when (< f0-1 (* f1-1 f1-1)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-5 v1-12) + *collide-player-list* + (set! v1-12 (-> v1-12 next0)) + ) + ) + ) + ) + (when #f + (let ((a0-8 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-19 (-> a0-8 next0))) + (while (!= a0-8 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-9 (-> (the-as connection a0-8) param1)) + (a1-13 (-> (the-as collide-shape a0-9) root-prim)) + ) + (when (logtest? (-> a1-13 prim-core collide-as) (collide-spec enemy hit-by-others-list)) + (let ((a1-14 (-> a1-13 prim-core))) + (let ((a2-11 a1-14) + (a3-2 gp-0) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-2 a2-12) + (f1-5 (+ (-> a1-14 world-sphere w) (-> gp-0 r))) + ) + (when (< f0-2 (* f1-5 f1-5)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-8 v1-19) + *collide-hit-by-player-list* + (set! v1-19 (-> v1-19 next0)) + ) + ) + ) + ) + ) + (dotimes (gp-1 *actor-list-length*) + (let ((v1-24 (-> *actor-list* gp-1))) + (when (logtest? (-> v1-24 root-prim prim-core collide-as) (collide-spec enemy hit-by-others-list)) + (let ((a0-16 (-> v1-24 process))) + (if (= (-> a0-16 type) pipe-grunt) + (send-event a0-16 'instant-death) + ) + ) + ) + ) + ) + #f + ) + ) + +(defmethod sig-under-method-261 sig-under ((obj sig-under) (arg0 vector) (arg1 vector) (arg2 symbol)) + (set! (-> arg0 w) + (- (+ (* (-> arg0 x) (-> obj root-override2 trans x)) (* (-> arg0 z) (-> obj root-override2 trans z)))) + ) + (let ((v1-2 (new 'stack-no-clear 'vector))) + (set! (-> v1-2 quad) (-> arg1 quad)) + (set! (-> v1-2 y) 0.0) + (let ((f0-6 (vector4-dot (the-as vector (-> obj test-plane)) v1-2)) + (f1-3 14336.0) + (f2-1 16384.0) + ) + (when arg2 + (set! f1-3 (+ 2048.0 f1-3)) + (set! f2-1 (+ 2048.0 f2-1)) + ) + (if (and (>= f0-6 -2048.0) (>= f1-3 f0-6)) + (>= (* f2-1 f2-1) (vector-vector-xz-distance-squared arg1 (-> obj root-override2 trans))) + ) + ) + ) + ) + +(defstate intro-shooting (sig-under) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior sig-under) enemy-event-handler) + :enter (behavior () + (move-to-point! (-> self root-override2) (the-as vector (-> self sig5-course spots 0))) + (quaternion-identity! (-> self root-override2 quat)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-! gp-0 (the-as vector (-> self sig5-course spots 1)) (-> self root-override2 trans)) + (vector-normalize! gp-0 1.0) + (set-heading-vec! (-> self root-override2) gp-0) + ) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (let ((v1-11 self)) + (set! (-> v1-11 enemy-flags) (the-as enemy-flag (logclear (-> v1-11 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-11 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (set! (-> self skel top-anim interp) 0.0) + (set! (-> self focus-mode) 1) + (set! (-> self bot-flags) (logior (bot-flags bf11 bf18) (-> self bot-flags))) + (set! (-> self root-override2 penetrated-by) + (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot) + (-> self root-override2 penetrated-by) + ) + ) + (look-at-target! self (enemy-flag lock-focus)) + (none) + ) + :exit (behavior () + (logclear! (-> self bot-flags) (bot-flags bf18)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) + (none) + ) + :trans (behavior () + (if (logtest? (-> self focus-status) (focus-status grabbed)) + (go-virtual waiting-close) + ) + (let ((a0-1 (handle->process (-> self focus handle)))) + (if a0-1 + (bot-method-222 self (get-trans (the-as process-focusable a0-1) 3)) + ) + ) + (none) + ) + :code (behavior () + (until #f + (let ((gp-0 (get-rand-int self 2))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (if (and (not (logtest? (-> self bot-task-bits) 1)) (zero? gp-0)) + (set! (-> s5-0 quad) (-> self sig5-course spots 2 center quad)) + (set! (-> s5-0 quad) (-> self sig5-course spots 1 center quad)) + ) + (+! (-> s5-0 x) (get-rand-float-range self -20480.0 20480.0)) + (+! (-> s5-0 y) (get-rand-float-range self 0.0 20480.0)) + (send-event (ppointer->process (-> self my-simple-focus)) 'move-trans s5-0) + ) + (set! (-> self shot-at-growls-index) gp-0) + ) + (set! (-> self poi-handle) (ppointer->handle (-> self my-simple-focus))) + (enemy-focus-method-13 + (-> self focus) + (the-as process-focusable (ppointer->process (-> self my-simple-focus))) + (enemy-aware enemy-aware-3) + ) + (bot-method-223 self #f) + (let ((f30-2 8.0)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-1 (-> self draw art-group data 12)) + (f30-3 (ja-aframe f30-2 0)) + ) + (ja-no-eval :group! gp-1 :num! (seek! f30-3) :frame-num 0.0) + (until (ja-done? 0) + (seek-toward-heading-vec! + (-> self root-override2) + (-> self focus-info bullseye-xz-dir) + 32768.0 + (seconds 0.05) + ) + (suspend) + (ja :num! (seek! f30-3)) + ) + ) + ) + (fire-gun self (-> self focus-info bullseye)) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (when #t + (set! (-> self state-time) (-> self clock frame-counter)) + (logclear! (-> self bot-flags) (bot-flags bf18)) + (let ((gp-3 (+ (-> self clock frame-counter) (get-rand-int-range self 30 600)))) + (ja-channel-push! 1 (seconds 0.5)) + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (if (>= (-> self clock frame-counter) gp-3) + (goto cfg-27) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (label cfg-27) + (set! (-> self bot-flags) (logior (bot-flags bf18) (-> self bot-flags))) + ) + #f + (none) + ) + :post (the-as (function none :behavior sig-under) nav-enemy-simple-post) + ) + +(defmethod alive? sig-under ((obj sig-under)) + ((method-of-type bot alive?) obj) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod init! sig-under ((obj sig-under)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type sig init!))) + (t9-0 obj) + ) + (set! (-> obj too-far-warn-dist-default) 245760.0) + (set! (-> obj too-far-fail-dist-delta-default) 163840.0) + (countdown (v1-3 2) + (set! (-> obj growls v1-3) (the-as handle #f)) + ) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-idle sig-under ((obj sig-under)) + (cond + ((task-node-closed? (game-task-node under-sig-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (go (method-of-object obj intro-shooting)) + ) + ) + (none) + ) + +;; WARN: Return type mismatch int vs symbol. +(defun sig5-default-check-too-far ((arg0 sig-under)) + (let ((v0-0 (bot-simple-check-too-far arg0))) + (if (logtest? (-> arg0 bot-task-bits) 4) + (set! v0-0 2) + ) + (the-as symbol v0-0) + ) + ) + +(define *sig5-course* + (new 'static 'sig5-course + :course-id #xd + :speech-count #x1e + :spot-count #x24 + :too-far-warn-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 13 14 15) + ) + :too-far-fail-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 16 17) + ) + :attack-player-speeches (new 'static 'bot-speech-list + :flags #x2 + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 0 1 2 3 4 5) + ) + :default-check-too-far 'sig5-default-check-too-far + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to #x16 + :on-set (lambda ((arg0 sig-under)) + (let ((a0-1 80)) + (set! (-> arg0 hit-points) a0-1) + (set! (-> arg0 enemy-info-override default-hit-points) a0-1) + ) + (clear-speech-flags! arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 growls 0) + (ppointer->handle (process-spawn under-pipe-growls (-> arg0 sig5-course spots 2) 'intro-shooting :to arg0)) + ) + (set! (-> arg0 growls 1) + (ppointer->handle (process-spawn under-pipe-growls (-> arg0 sig5-course spots 1) 'intro-shooting :to arg0)) + ) + (if (task-node-open? (game-task-node under-sig-introduction)) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-find-sig-res" -99.0 0) + ) + (let ((v1-27 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-27 bytes 5) (the-as uint 1)) + (set! (-> v1-27 bytes 6) (the-as uint 0)) + (set! (-> v1-27 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-27) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (if (not (and (logtest? (-> arg1 bot-task-bits) 1) + *target* + (zero? (logand (-> *target* focus-status) (focus-status dead in-air edge-grab))) + ) + ) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) + (task-node-open? (game-task-node under-sig-introduction)) + (scene-play arg1 "under-find-sig-res" #f) + ) + (process-entity-status! arg1 (entity-perm-status no-kill) #t) + (countdown (s5-0 2) + (send-event (handle->process (-> arg1 growls s5-0)) 'die-fast) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 0)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (set-setting! 'music 'tomb 0 0) + (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 3 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set! (-> arg0 bot-task-bits) (logand -5 (-> arg0 bot-task-bits))) + (logior! (-> arg0 bot-flags) (bot-flags bf06)) + (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (set! (-> arg0 notice-enemy-dist) 122880.0) + (clear-poi-and-focus! arg0) + (set! (-> arg0 focus-mode) 0) + (set! (-> arg0 root-override2 penetrated-by) (get-penetrate-info arg0)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 3)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-12) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 4 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 3)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((logtest? (-> arg1 actor-group 0 data 0 actor extra perm status) (entity-perm-status subtask-complete)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (if (and (not (speech-playing? arg1 6)) (not (channel-active? arg1 (the-as uint 0)))) + (play-speech arg1 6) + ) + #f + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 5 + :nav-mesh-index 1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (reset-warn-time! arg0) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-one" -99.0 0) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 4)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-5) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-262 arg1 #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 5)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-262 arg1 #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 7 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 6)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-262 arg1 #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 8 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 8 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (sig-under-method-262 arg1 #t)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 9 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set-setting! 'music 'danger7 0 0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 7)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 10 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 10 + :nav-mesh-index 2 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (with-pp + (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 900 1500))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-two" -99.0 0) + (let* ((v1-7 (-> arg0 sig5-course spots)) + (s5-1 (-> v1-7 8)) + ) + (let ((v1-8 (-> v1-7 9))) + (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-8) (the-as vector s5-1)) + ) + (set! (-> arg0 test-plane y) 0.0) + (vector-normalize! (-> arg0 test-plane) 1.0) + (set! (-> arg0 test-plane w) + (- (+ (* (-> s5-1 center x) (-> arg0 test-plane x)) (* (-> s5-1 center z) (-> arg0 test-plane z)))) + ) + ) + (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-11 bytes 5) (the-as uint 1)) + (set! (-> v1-11 bytes 6) (the-as uint 10)) + (set! (-> v1-11 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-11) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (sig-under-method-263 arg1) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 y) 0.0) + (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (scene-play arg1 "under-centipede-two" #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 11 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 11 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set-setting! 'music 'tomb 0 0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 10)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 12 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 12 + :nav-mesh-index 3 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (reset-warn-time! arg0) + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 sig5-course spots 10))) + (set-vector! (-> arg0 root-override2 quat) 0.0 0.5874 0.0 0.8092) + (play-speech arg0 8) + (play-speech arg0 9) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 10)) + (set! (-> v1-15 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-15) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.8)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 13 + :nav-mesh-index 3 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 11)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (logtest? (-> arg1 actor-group 0 data 2 actor extra perm status) (entity-perm-status subtask-complete)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 14 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 14 + :nav-mesh-index 4 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((a1-0 (-> arg0 sig5-course spots))) + (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector (-> a1-0 13)) (the-as vector (-> a1-0 12))) + ) + (vector-normalize! (-> arg0 test-plane) 1.0) + (let ((v1-4 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-4 bytes 5) (the-as uint 1)) + (set! (-> v1-4 bytes 6) (the-as uint 12)) + (set! (-> v1-4 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-4) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 16 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 13)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 15 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + #f + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 15 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-2 (-> arg0 sig5-course spots 14))) + (set! (-> v1-2 center quad) (-> arg0 root-override2 trans quad)) + (set! (-> v1-2 center w) 8192.0) + ) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 14)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-5) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (if (sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #t) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 17 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 15)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index #x6 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 16)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (not (speech-playing? arg1 10)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 10) + (reset-warn-time! arg1) + ) + (when (and (speech-playing? arg1 10) (not (channel-active? arg1 (the-as uint 0)))) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set! (-> arg0 growls 0) + (ppointer->handle (process-spawn under-pipe-growls (-> arg0 sig5-course spots 17) 'block-puzzle :to arg0)) + ) + (set! (-> arg0 notice-enemy-dist) 245760.0) + (send-event (ppointer->process (-> arg0 my-simple-focus)) 'move-trans (-> arg0 sig5-course spots 17)) + (set! (-> arg0 poi-handle) (ppointer->handle (-> arg0 my-simple-focus))) + (let ((v1-23 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-23 bytes 5) (the-as uint 1)) + (set! (-> v1-23 bytes 6) (the-as uint 16)) + (set! (-> v1-23 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-23) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'trigger) + (let ((t9-0 send-event-function) + (v1-9 (-> arg1 actor-group 0 data 3 actor)) + ) + (t9-0 + (if v1-9 + (-> v1-9 extra process) + ) + a1-1 + ) + ) + ) + ) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.7)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 20 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 20 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (play-speech arg0 11) + (reset-warn-time! arg0) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 2)) + (set! (-> v1-5 bytes 6) (the-as uint 18)) + (set! (-> v1-5 bytes 7) (the-as uint 19)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-5) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (+ (-> pp clock frame-counter) (seconds -6))) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'music 'danger3 0 0) + ) + #f + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 sig-under)) + (with-pp + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer pp)) + (set! (-> a1-0 num-params) 1) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'beaten)) + (let ((t9-0 send-event-function) + (v1-6 (-> arg0 actor-group 0 data 4 actor)) + ) + (when (t9-0 + (if v1-6 + (-> v1-6 extra process) + ) + a1-0 + ) + (clear-poi-and-focus! arg0) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 0.0) + (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (clear-focused (-> arg0 focus)) + (set! (-> arg0 bot-flags) (logior (bot-flags bf26) (-> arg0 bot-flags))) + (when (and (process-grab? arg0 #t) (process-grab? *target* #t)) + (process-grab? arg0 #f) + (process-grab? *target* #f) + (set-setting! 'entity-name "camera-245" 0 0) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer pp)) + (set! (-> a1-6 num-params) 0) + (set! (-> a1-6 message) 'unlock) + (let ((t9-8 send-event-function) + (v1-26 (-> arg0 actor-group 0 data 4 actor)) + ) + (t9-8 + (if v1-26 + (-> v1-26 extra process) + ) + a1-6 + ) + ) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer pp)) + (set! (-> a1-7 num-params) 0) + (set! (-> a1-7 message) 'beaten) + (let ((t9-9 send-event-function) + (v1-33 (-> arg0 actor-group 0 data 3 actor)) + ) + (t9-9 + (if v1-33 + (-> v1-33 extra process) + ) + a1-7 + ) + ) + ) + (send-event (handle->process (-> arg0 growls 0)) 'fade) + (set-setting! 'music 'tomb 0 0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (go-to-waypoint! arg0 21 #f) + ) + ) + ) + ) + (none) + ) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 21 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (reset-warn-time! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 2)) + (set! (-> v1-3 bytes 6) (the-as uint 21)) + (set! (-> v1-3 bytes 7) (the-as uint 22)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (if (and (not (speech-playing? arg1 12)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 12) + ) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (process-release? arg1) + (sig-under-method-260 arg1) + (move-to-point! (-> arg1 root-override2) (the-as vector (-> arg1 sig5-course spots 20))) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 2) + (add-process *gui-control* arg1 (gui-channel art-load) (gui-action queue) "under-centipede-three" -99.0 0) + ) + #f + ) + (else + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) + (process-release? *target*) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 22 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 22 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let* ((v1-1 (-> arg0 sig5-course spots)) + (s5-0 (-> v1-1 24)) + ) + (let ((v1-2 (-> v1-1 25))) + (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-2) (the-as vector s5-0)) + ) + (set! (-> arg0 test-plane y) 0.0) + (vector-normalize! (-> arg0 test-plane) 1.0) + (set! (-> arg0 test-plane w) + (- (+ (* (-> s5-0 center x) (-> arg0 test-plane x)) (* (-> s5-0 center z) (-> arg0 test-plane z)))) + ) + ) + (set! (-> arg0 too-far-warn-dist) 102400.0) + (set! (-> arg0 too-far-fail-dist-delta) 204800.0) + (reset-warn-time! arg0) + (let ((v1-9 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-9 bytes 5) (the-as uint 1)) + (set! (-> v1-9 bytes 6) (the-as uint 23)) + (set! (-> v1-9 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-9) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (local-vars (v1-14 symbol)) + (with-pp + (when (logtest? (-> arg1 waypoint-bits) 1) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'trigger) + (let ((t9-0 send-event-function) + (v1-8 (-> arg1 actor-group 0 data 5 actor)) + ) + (t9-0 + (if v1-8 + (-> v1-8 extra process) + ) + a1-1 + ) + ) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! v1-14 + (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) + (begin + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 y) 0.0) + (set! (-> s5-0 w) 1.0) + (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (let ((f0-4 81920.0)) + (>= (* f0-4 f0-4) + (vector-vector-xz-distance-squared (target-pos 0) (the-as vector (-> arg1 sig5-course spots 24))) + ) + ) + ) + (set! v1-14 #t) + (goto cfg-21) + ) + (set! (-> s5-0 quad) (-> (math-camera-pos) quad)) + (set! (-> s5-0 y) 0.0) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (set! v1-14 #t) + (goto cfg-21) + ) + #f + ) + ) + ) + ) + (label cfg-21) + (when v1-14 + (when (scene-play arg1 "under-centipede-three" #f) + (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 23 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 sig-under)) + (set-action! + *gui-control* + (gui-action stop) + (the-as sound-id 1) + (gui-channel art-load) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (logior! (-> arg0 bot-flags) (bot-flags bf06)) + (set! (-> arg0 notice-enemy-dist) 122880.0) + (clear-poi-and-focus! arg0) + (set! (-> arg0 focus-mode) 0) + (set! (-> arg0 root-override2 penetrated-by) (get-penetrate-info arg0)) + (logior! (-> arg0 waypoint-bits) 1) + (send-event arg0 'move-trans (-> arg0 sig5-course spots 21)) + (send-event *target* 'continue (get-continue-by-name *game-info* "sig5-skip-to-cent2")) + (react-to-focus arg0) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 23 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (stop-speech arg0 (the-as uint 0) #f) + (set-setting! 'music 'danger7 0 0) + (set! (-> arg0 bot-task-bits) (logand -9 (-> arg0 bot-task-bits))) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 23)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 24 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 24 + :nav-mesh-index #x7 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (with-pp + (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 600 1200))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 26)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (sig-under-method-263 arg1) + (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) + (sig-method-257 arg1) + (let ((f0-0 61440.0)) + (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root-override2 trans))) + ) + ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> arg1 sig5-course spots 28)) + (let ((s5-1 (-> arg1 actor-group 0 data 6 actor))) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (or (not s5-1) (zero? (logand (-> s5-1 extra perm status) (entity-perm-status subtask-complete)))) + ) + (let ((s5-2 18)) + (case (get-rand-int arg1 3) + ((1) + (set! s5-2 19) + ) + ((2) + (set! s5-2 20) + ) + ) + (play-speech arg1 s5-2) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index #x8 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (clear-poi-and-focus! arg0) + (set! (-> arg0 next-chase-play-time) 0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 3)) + (set! (-> v1-3 bytes 6) (the-as uint 29)) + (set! (-> v1-3 bytes 7) (the-as uint 30)) + (set! (-> v1-3 bytes 8) (the-as uint 31)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (if (not (logtest? (-> arg1 bot-task-bits) 16)) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) + (zero? (logand (-> arg1 focus-status) (focus-status in-air))) + ) + (logior! (-> arg1 waypoint-bits) 2) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (not (speech-playing? arg1 21)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 21) + ) + (when (zero? (-> arg1 next-chase-play-time)) + (let ((a0-14 (-> arg1 actor-group 0 data 7 actor))) + (if (and a0-14 (logtest? (-> a0-14 extra perm status) (entity-perm-status subtask-complete))) + (set! (-> arg1 next-chase-play-time) (-> pp clock frame-counter)) + ) + ) + ) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (and (-> arg1 next-state) (let ((v1-54 (-> arg1 next-state name))) + (or (= v1-54 'waiting-far) (= v1-54 'waiting-close) (= v1-54 'waiting-turn)) + ) + ) + (or (nonzero? (-> arg1 next-chase-play-time)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 6)) + ) + ) + (when (not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (send-event (ppointer->process (-> arg1 my-simple-focus)) 'move-trans (-> arg1 sig5-course spots 32)) + (set! (-> arg1 poi-handle) (ppointer->handle (-> arg1 my-simple-focus))) + ) + (let ((v1-78 (-> arg1 sig5-course spots 32))) + (when (>= 10012.445 + (fabs + (deg- + (atan + (- (-> v1-78 center x) (-> arg1 root-override2 trans x)) + (- (-> v1-78 center z) (-> arg1 root-override2 trans z)) + ) + (quaternion-y-angle (-> arg1 root-override2 quat)) + ) + ) + ) + (let ((s4-1 (target-pos 0)) + (s5-1 (-> arg1 sig5-course spots 32)) + ) + (when (or (zero? (-> arg1 next-chase-play-time)) + (and (nonzero? (-> arg1 next-chase-play-time)) + (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 2)) + (or (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 9)) + (>= (vector-vector-xz-distance s4-1 (-> s5-1 center)) (+ 8192.0 (-> s5-1 center w))) + (< 20480.0 (- (-> s4-1 y) (-> s5-1 center y))) + ) + ) + ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> s5-1 center)) + (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (if (not (channel-active? arg1 (the-as uint 0))) + (play-speech arg1 22) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index #x9 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) + (send-event (ppointer->process (-> arg0 my-simple-focus)) 'move-trans (-> arg0 sig5-course spots 34)) + (set! (-> arg0 poi-handle) (ppointer->handle (-> arg0 my-simple-focus))) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 33)) + (set! (-> v1-15 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-15) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) + (zero? (logand (-> arg1 focus-status) (focus-status in-air))) + ) + (logior! (-> arg1 waypoint-bits) 1) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (cond + ((sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (if (and (not (speech-playing? arg1 23)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 23) + ) + #f + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 27 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (remove-setting! 'music) + (stop-speech arg0 (the-as uint 0) #f) + (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (let ((v1-8 (-> arg0 sig5-course spots 35))) + (set! (-> v1-8 center quad) (-> arg0 root-override2 trans quad)) + (set! (-> v1-8 center w) 16384.0) + ) + (let ((v1-11 (the-as sigt-wait-spot (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0)))) + (set! (-> v1-11 num-spots) (the-as uint 1)) + (set! (-> v1-11 bytes 6) (the-as uint 35)) + (set! (-> v1-11 which-spot) -1) + (set! (-> v1-11 check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 28 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (process-entity-status! arg0 (entity-perm-status bit-4) #f) + (process-entity-status! arg0 (entity-perm-status no-kill) #f) + (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 bot-flags) (bot-flags bf06)) + (bot-method-196 arg0) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 35)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as (function sigt-wait-spot sig symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + ) + :speeches (new 'static 'inline-array bot-speech-info 30 + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt082") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt056") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt046") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt047") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt083") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt087") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt060") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt062") + (new 'static 'bot-speech-info :hold-time #x21c :slave-id -1 :name "sigt068") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt061") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt070") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt069") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt059") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt043") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt044") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt045") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt053") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt091") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt065") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt066") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt067") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt075") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt108") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt103") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt072") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt073") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt074") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt076") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt077") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt078") + ) + :speech-tunings (new 'static 'inline-array bot-speech-tuning 1 + (new 'static 'bot-speech-tuning :fo-min 30 :fo-max #x78 :fo-curve #xb :trans? #t) + ) + :spots (new 'static 'inline-array bot-spot 36 + (new 'static 'bot-spot :center (new 'static 'vector :x -308019.2 :y -266199.03 :z 7887175.5 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -307036.16 :y -212992.0 :z 7998914.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -390389.75 :y -212992.0 :z 7958937.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -384000.0 :y -262144.0 :z 8051425.5 :w 12288.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -356638.72 :y -274432.0 :z 8130109.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -243343.36 :y -274391.03 :z 8183521.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -250470.4 :y -274391.03 :z 8217600.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -264601.6 :y -274145.28 :z 8243118.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -788848.6 :y -274432.0 :z 8396390.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -799170.56 :y -274432.0 :z 8391762.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -925736.94 :y -274432.0 :z 8324137.0 :w 15360.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -927580.2 :y -274432.0 :z 8278016.0 :w 15360.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -914350.06 :y -274432.0 :z 8265974.0 :w 15360.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -963911.7 :y -274432.0 :z 8239145.0 :w 9216.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -914350.06 :y -274432.0 :z 8265974.0 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1017733.1 :y -278487.03 :z 8185446.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1051934.8 :y -278487.03 :z 8145428.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1204633.6 :y -216145.92 :z 8084193.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1111695.4 :y -278487.03 :z 8137564.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1148682.2 :y -278487.03 :z 8114503.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1082736.6 :y -290775.03 :z 8085012.5 :w 14336.0)) + (new 'static 'bot-spot + :center (new 'static 'vector :x -1049436.1 :y -290816.0 :z 8026562.5 :w 6144.0) + :blocked-xz-dist 6144.0 + ) + (new 'static 'bot-spot + :center (new 'static 'vector :x -1035591.7 :y -290816.0 :z 8032379.0 :w 6144.0) + :blocked-xz-dist 6144.0 + ) + (new 'static 'bot-spot :center (new 'static 'vector :x -971816.94 :y -290816.0 :z 7933378.5 :w 12288.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -993935.4 :y -290816.0 :z 7965040.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -982917.1 :y -290816.0 :z 7947387.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -743751.7 :y -290775.03 :z 7586201.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -762880.0 :y -289505.28 :z 7576125.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -762019.8 :y -339968.0 :z 7567155.0 :w 12288.0)) + (new 'static 'bot-spot + :center (new 'static 'vector :x -754810.9 :y -339968.0 :z 7534715.0 :w 6144.0) + :blocked-xz-dist 7168.0 + ) + (new 'static 'bot-spot + :center (new 'static 'vector :x -746782.75 :y -339968.0 :z 7539343.5 :w 6144.0) + :blocked-xz-dist 7168.0 + ) + (new 'static 'bot-spot + :center (new 'static 'vector :x -735846.4 :y -339968.0 :z 7545651.0 :w 6144.0) + :blocked-xz-dist 7168.0 + ) + (new 'static 'bot-spot :center (new 'static 'vector :x -725278.75 :y -405504.0 :z 7510630.5 :w 12288.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -754810.9 :y -405504.0 :z 7487365.0 :w 17408.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -722984.94 :y -339968.0 :z 7535657.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :w 16384.0)) + ) + :chase-speeches (new 'static 'bot-speech-list-shuffle + :flags #x8 + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 24 25 26 27 28 29) + ) + ) + ) + +(set! (-> *bot-course-table* course 13) *sig5-course*) diff --git a/goal_src/jak2/levels/underport/under-laser.gc b/goal_src/jak2/levels/underport/under-laser.gc index c7a70bad7a..11b127a628 100644 --- a/goal_src/jak2/levels/underport/under-laser.gc +++ b/goal_src/jak2/levels/underport/under-laser.gc @@ -7,3 +7,528 @@ ;; DECOMP BEGINS +(deftype under-laser-info (basic) + ((options uint8 :offset-assert 4) + (laser-radius float :offset-assert 8) + (laser-move-dist float :offset-assert 12) + (shadow-top-y float :offset-assert 16) + (shadow-height float :offset-assert 20) + (shadow-radius-adjust float :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + + +(define *under-laser-infos* (new 'static 'boxed-array :type under-laser-info + (new 'static 'under-laser-info + :laser-radius 28508.16 + :laser-move-dist 35840.0 + :shadow-top-y -271360.0 + :shadow-height 3072.0 + :shadow-radius-adjust 4096.0 + ) + (new 'static 'under-laser-info + :options #x1 + :laser-radius 27443.2 + :laser-move-dist 35512.32 + :shadow-top-y -288768.0 + :shadow-height 3276.8 + :shadow-radius-adjust 1024.0 + ) + (new 'static 'under-laser-info + :options #x1 + :laser-radius 27443.2 + :laser-move-dist 35512.32 + :shadow-top-y -288768.0 + :shadow-height 3276.8 + :shadow-radius-adjust 1024.0 + ) + (new 'static 'under-laser-info + :laser-radius 29573.12 + :laser-move-dist 35430.4 + :shadow-top-y -288153.6 + :shadow-height 3276.8 + :shadow-radius-adjust 1638.4 + ) + (new 'static 'under-laser-info + :laser-radius 33423.36 + :laser-move-dist 35225.6 + :shadow-top-y -289382.4 + :shadow-height 2048.0 + :shadow-radius-adjust 2048.0 + ) + (new 'static 'under-laser-info + :laser-radius 44933.12 + :laser-move-dist 35430.4 + :shadow-top-y -290406.4 + :shadow-height 4587.52 + :shadow-radius-adjust -4096.0 + ) + ) + ) + +(deftype under-laser-shadow (process-drawable) + ((root-override collide-shape-moving :offset 128) + (info under-laser-info :offset-assert 200) + (trans-xz-offset vector :inline :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 21 + :size-assert #xe0 + :flag-assert #x15006000e0 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(deftype under-laser-slave (process-drawable) + ((root-override collide-shape-moving :offset 128) + ) + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(deftype under-laser (process-drawable) + ((root-override collide-shape-moving :offset 128) + (info under-laser-info :offset-assert 200) + (id int8 :offset-assert 204) + (lightning lightning-control :offset-assert 208) + (draw-test-script script-context :offset-assert 212) + (sync sync-eased :inline :offset-assert 216) + (laser-dir vector :inline :offset-assert 272) + (slave-trans-offset vector :inline :offset-assert 288) + (zero-pos vector :inline :offset-assert 304) + (one-pos vector :inline :offset-assert 320) + ) + :heap-base #xd0 + :method-count-assert 23 + :size-assert #x150 + :flag-assert #x1700d00150 + (:methods + (dormant () _type_ :state 20) + (idle () _type_ :state 21) + (under-laser-method-22 (_type_) none 22) + ) + ) + + +(defskelgroup skel-under-laser under-laser under-laser-lod0-jg under-laser-idle-ja + ((under-laser-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + ) + +(defskelgroup skel-under-laser-shadow under-laser-shadow under-laser-shadow-lod0-jg under-laser-shadow-idle-ja + ((under-laser-shadow-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 14) + :shadow under-laser-shadow-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(defstate idle (under-laser-shadow) + :virtual #t + :trans (behavior () + (let ((a1-0 (ppointer->process (-> self parent))) + (v1-2 (-> self root-override)) + ) + (let ((f0-0 (-> v1-2 trans y))) + (set! (-> v1-2 trans quad) (-> (the-as process-drawable a1-0) root trans quad)) + (vector+! (-> v1-2 trans) (-> v1-2 trans) (-> self trans-xz-offset)) + (set! (-> v1-2 trans y) f0-0) + ) + (let ((a0-3 (-> self draw shadow-ctrl))) + (let ((a1-5 (-> a0-3 settings))) + (logclear! (-> a1-5 flags) (shadow-flags disable-draw)) + (set! (-> a1-5 center quad) (-> v1-2 trans quad)) + ) + (shadow-control-method-14 + a0-3 + (-> v1-2 trans) + (new 'static 'vector :y -1.0 :w 1.0) + 409600.0 + 819.2 + (+ 819.2 (-> self info shadow-height)) + ) + ) + ) + (let ((f0-3 (vector-vector-distance (math-camera-pos) (-> self root-override trans)))) + (set! (-> self root-override scale x) (lerp-scale 0.5 3.5 f0-3 32768.0 245760.0)) + ) + (none) + ) + :code (the-as (function none :behavior under-laser-shadow) sleep-code) + :post (the-as (function none :behavior under-laser-shadow) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior under-laser-shadow-init-by-other under-laser-shadow ((arg0 under-laser-info) (arg1 vector) (arg2 vector)) + (set! (-> self info) arg0) + (set! (-> self trans-xz-offset quad) (-> arg1 quad)) + (set! (-> self root-override) (the-as collide-shape-moving (new 'process 'trsqv))) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((s3-0 (-> self root-override))) + (let ((v1-4 (ppointer->process (-> self parent)))) + (set! (-> s3-0 scale quad) (-> arg2 quad)) + (set! (-> s3-0 trans quad) (-> (the-as under-laser v1-4) root-override trans quad)) + ) + (vector+! (-> s3-0 trans) (-> s3-0 trans) arg1) + (set! (-> s3-0 trans y) (+ 819.2 (-> arg0 shadow-top-y))) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> arg1 quad)) + (vector-normalize! s4-1 1.0) + (quaternion-look-at! (-> s3-0 quat) s4-1 *up-vector*) + ) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-laser-shadow" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self draw bounds w) (+ 12288.0 (* 20480.0 (-> arg2 z)))) + (set! (-> self draw shadow-ctrl) + (new 'process 'shadow-control -2048.0 -61440.0 69632.0 (shadow-flags shdf03 disable-draw) 245760.0) + ) + (set! (-> self draw shadow-ctrl settings shadow-type) 1) + (go-virtual idle) + (none) + ) + +(defstate idle (under-laser-slave) + :virtual #t + :trans (behavior () + (let ((v1-0 (ppointer->process (-> self parent))) + (a0-1 (-> self root-override)) + ) + (set! (-> a0-1 trans quad) (-> (the-as under-laser v1-0) root-override trans quad)) + (vector+! (-> a0-1 trans) (-> a0-1 trans) (-> (the-as under-laser v1-0) slave-trans-offset)) + ) + (none) + ) + :code (the-as (function none :behavior under-laser-slave) sleep-code) + :post (the-as (function none :behavior under-laser-slave) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior under-laser-slave-init-by-other under-laser-slave () + (set! (-> self root-override) (the-as collide-shape-moving (new 'process 'trsqv))) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((gp-0 (-> self root-override)) + (s5-0 (ppointer->process (-> self parent))) + ) + (set! (-> gp-0 trans quad) (-> (the-as under-laser s5-0) root-override trans quad)) + (vector+! (-> gp-0 trans) (-> gp-0 trans) (-> (the-as under-laser s5-0) slave-trans-offset)) + (quaternion-copy! (-> gp-0 quat) (-> (the-as under-laser s5-0) root-override quat)) + (quaternion-rotate-y! (-> gp-0 quat) (-> gp-0 quat) 32768.0) + (set! (-> gp-0 scale quad) (-> (the-as under-laser s5-0) root-override scale quad)) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-laser" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go-virtual idle) + (none) + ) + +;; WARN: Return type mismatch sound-id vs none. +(defmethod under-laser-method-22 under-laser ((obj under-laser)) + (with-pp + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s5-0 start-pos quad) (-> obj root-override trans quad)) + (set! (-> s5-0 move-dist quad) (-> obj slave-trans-offset quad)) + (let ((v1-2 s5-0)) + (set! (-> v1-2 radius) 409.6) + (set! (-> v1-2 collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-2 ignore-process0) obj) + (set! (-> v1-2 ignore-process1) #f) + (set! (-> v1-2 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + (let* ((s4-0 (-> s5-0 best-other-tri collide-ptr)) + (s5-1 (if (type? s4-0 collide-shape-prim-sphere) + s4-0 + ) + ) + ) + (when s5-1 + (let ((s4-1 (new 'stack-no-clear 'vector))) + (vector-rotate-around-y! s4-1 (-> obj slave-trans-offset) (if (logtest? (-> obj info options) 1) + 16384.0 + -16384.0 + ) + ) + (vector-normalize! s4-1 1.0) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (the-as uint #f)) + (let ((v1-11 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id damage)))) + (let* ((a0-15 *game-info*) + (a2-2 (+ (-> a0-15 attack-id) 1)) + ) + (set! (-> a0-15 attack-id) a2-2) + (set! (-> v1-11 id) a2-2) + ) + (set! (-> v1-11 vector quad) (-> s4-1 quad)) + (set! (-> v1-11 shove-back) 12288.0) + (set! (-> v1-11 shove-up) 8192.0) + (set! (-> v1-11 damage) 1.0) + (set! (-> a1-4 param 1) (the-as uint v1-11)) + ) + (if (send-event-function (-> (the-as collide-shape-prim-sphere s5-1) cshape process) a1-4) + (sound-play "und-laser-hit") + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + +(defstate dormant (under-laser) + :virtual #t + :enter (behavior () + (logior! (-> self draw status) (draw-control-status no-draw)) + (none) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + (none) + ) + :trans (behavior () + (if (not (eval! + (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) + (the-as pair (-> self draw-test-script)) + ) + ) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior under-laser) sleep-code) + ) + +(defstate idle (under-laser) + :virtual #t + :enter (behavior () + (process-spawn under-laser-slave :to self) + (let ((gp-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! gp-1 (-> self slave-trans-offset) 0.5) + (set! (-> gp-1 y) 0.0) + (let* ((f0-2 0.000048828126) + (v1-9 gp-1) + (f0-3 + (* f0-2 + (+ (sqrtf (+ (* (-> v1-9 x) (-> v1-9 x)) (* (-> v1-9 z) (-> v1-9 z)))) (-> self info shadow-radius-adjust)) + ) + ) + ) + (set-vector! s5-0 3.5 1.0 f0-3 1.0) + ) + (process-spawn under-laser-shadow (-> self info) gp-1 s5-0 :to self) + ) + (update-vol! (-> self sound) 1.0) + (none) + ) + :code (the-as (function none :behavior under-laser) sleep-code) + :post (behavior () + (let ((f30-0 (get-norm! (-> self sync) 0))) + (vector-lerp! (-> self root-override trans) (-> self zero-pos) (-> self one-pos) f30-0) + (if (!= (-> self sync offset) 0.0) + (set! f30-0 (- 1.0 f30-0)) + ) + (set-under-laser! f30-0) + ) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector-lerp! + s5-0 + (-> self zero-pos) + (-> self one-pos) + (get-norm! (-> self sync) (the-as int (+ (-> self clock frame-counter) (seconds 0.15)))) + ) + (vector-normalize-copy! s4-0 (-> self laser-dir) 1228.8) + (vector+! s4-0 s4-0 s5-0) + (set! (-> self lightning state meet data 0 quad) (-> s4-0 quad)) + (vector-normalize-copy! gp-0 (-> self laser-dir) -1228.8) + (vector+! gp-0 gp-0 (-> self slave-trans-offset)) + (vector+! gp-0 gp-0 s5-0) + (let ((v1-16 (-> self lightning))) + (set! (-> v1-16 state meet data (+ (-> v1-16 state points-to-draw) -1) quad) (-> gp-0 quad)) + ) + ) + (let ((a1-10 (new 'stack-no-clear 'vector))) + (vector-float*! a1-10 (-> self slave-trans-offset) 0.5) + (vector+! a1-10 a1-10 (-> self root-override trans)) + (update-trans! (-> self sound) a1-10) + ) + (update! (-> self sound)) + (under-laser-method-22 self) + (ja-post) + (none) + ) + ) + +;; WARN: Return type mismatch process-drawable vs under-laser. +(defmethod relocate under-laser ((obj under-laser) (arg0 int)) + (if (nonzero? (-> obj lightning)) + (&+! (-> obj lightning) arg0) + ) + (the-as under-laser ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-laser ((obj under-laser) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-64 res-tag)) + (with-pp + (set! (-> obj root-override) (the-as collide-shape-moving (new 'process 'trsqv))) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-laser" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((v1-7 (res-lump-value (-> obj entity) 'extra-id uint128 :time -1000000000.0))) + (set! (-> obj id) (the-as int v1-7)) + (set! (-> obj info) (-> *under-laser-infos* v1-7)) + ) + (let ((a1-6 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-11 0)) + (if #t + (set! v1-11 (logior v1-11 1)) + ) + (set! (-> a1-6 sync-type) 'sync-eased) + (set! (-> a1-6 sync-flags) (the-as sync-flags v1-11)) + ) + (set! (-> a1-6 period) (the-as uint 1800)) + (set! (-> a1-6 entity) arg0) + (set! (-> a1-6 percent) 0.0) + (set! (-> a1-6 ease-in) 0.15) + (set! (-> a1-6 ease-out) 0.15) + (set! (-> a1-6 pause-in) 0.0) + (set! (-> a1-6 pause-out) 0.0) + (initialize! (-> obj sync) a1-6) + ) + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s5-1 (-> obj root-override))) + (set-vector! (-> s5-1 scale) 1.25 1.25 1.25 1.0) + (set! sv-64 (new 'static 'res-tag)) + (let ((v1-22 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-64)))) + (when v1-22 + (+! (-> s5-1 trans x) (-> v1-22 0)) + (+! (-> s5-1 trans y) (-> v1-22 1)) + (+! (-> s5-1 trans z) (-> v1-22 2)) + ) + ) + (let ((f0-15 (res-lump-float arg0 'rotoffset))) + (if (!= f0-15 0.0) + (quaternion-rotate-y! (-> s5-1 quat) (-> s5-1 quat) f0-15) + ) + ) + (vector-z-quaternion! (-> obj laser-dir) (-> s5-1 quat)) + (vector-normalize! (-> obj laser-dir) 1.0) + (quaternion-rotate-y! (-> s5-1 quat) (-> s5-1 quat) -16384.0) + (when (logtest? (-> obj info options) 1) + (let ((s4-1 (new 'stack-no-clear 'quaternion))) + (quaternion-vector-angle! s4-1 (-> obj laser-dir) 16384.0) + (quaternion*! (-> s5-1 quat) s4-1 (-> s5-1 quat)) + ) + ) + (let ((f30-0 (-> obj info laser-radius))) + (let ((s4-2 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! s4-2 (-> obj laser-dir) (- f30-0)) + (vector+! (-> s5-1 trans) (-> s5-1 trans) s4-2) + ) + (vector-normalize-copy! (-> obj slave-trans-offset) (-> obj laser-dir) (* 2.0 f30-0)) + ) + (set! (-> obj zero-pos quad) (-> s5-1 trans quad)) + (let ((f30-1 (-> obj info laser-move-dist))) + (cond + ((logtest? (-> obj info options) 1) + (set! (-> obj one-pos quad) (-> obj zero-pos quad)) + (+! (-> obj one-pos y) f30-1) + ) + (else + (let ((s4-3 (new 'stack-no-clear 'vector))) + (vector-rotate-around-y! s4-3 (-> obj laser-dir) 16384.0) + (vector-normalize! s4-3 f30-1) + (vector+! (-> obj one-pos) (-> obj zero-pos) s4-3) + ) + ) + ) + ) + (vector-lerp! (-> s5-1 trans) (-> obj zero-pos) (-> obj one-pos) (get-norm! (-> obj sync) 0)) + ) + (let ((a2-13 (new 'static 'lightning-spec + :name #f + :flags (lightning-spec-flags lsf2) + :start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :end-color (new 'static 'rgba :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture (new 'static 'texture-id :index #x83 :page #xc) + :reduction 0.42 + :num-points 16 + :box-size 8192.0 + :merge-factor 0.1 + :merge-count 4 + :radius 2048.0 + :duration -1.0 + :sound #f + ) + ) + ) + (set! (-> obj lightning) (new 'process 'lightning-control a2-13 obj 0.0)) + ) + (let ((a3-5 (new 'stack-no-clear 'vector))) + (vector-float*! a3-5 (-> obj slave-trans-offset) 0.5) + (vector+! a3-5 a3-5 (-> obj root-override trans)) + (if (zero? (-> obj id)) + (set! (-> obj sound) (new 'process 'ambient-sound (static-sound-spec "und-laser-near" :fo-max 40) a3-5)) + (set! (-> obj sound) (new 'process 'ambient-sound (static-sound-spec "und-laser-beam" :fo-max 40) a3-5)) + ) + ) + (set! (-> obj draw-test-script) (res-lump-struct (-> obj entity) 'on-activate script-context)) + (cond + ((and (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair (-> obj draw-test-script)) + ) + (= *bot-record-path* -1) + ) + (update-vol! (-> obj sound) 0.0) + (go (method-of-object obj dormant)) + ) + (else + (go (method-of-object obj idle)) + ) + ) + (none) + ) + ) diff --git a/goal_src/jak2/levels/underport/under-obs.gc b/goal_src/jak2/levels/underport/under-obs.gc index 18fb819ccb..befbdae51e 100644 --- a/goal_src/jak2/levels/underport/under-obs.gc +++ b/goal_src/jak2/levels/underport/under-obs.gc @@ -7,3 +7,2179 @@ ;; DECOMP BEGINS +(defpartgroup group-bubbler-streams + :id 500 + :bounds (static-bspherem 0 8 0 16) + :parts ((sp-item 2197 :flags (is-3d bit6)) + (sp-item 2198 :flags (bit6)) + (sp-item 2199 :fade-after (meters 80) :falloff-to (meters 160)) + (sp-item 2200 :flags (is-3d bit6)) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 990 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 1380 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 2010 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 3930 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 600 :length 5 :binding 2195) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + ) + ) + +(defpart 2199 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 8.0) + (sp-rnd-flt spt-x (meters 0) (meters 2.7) 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 32) 1.0) + (sp-flt spt-scale-x (meters 0.25)) + (sp-rnd-flt spt-scale-y (meters 0.25) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.0016666667) (meters 0.0016666667) 1.0) + (sp-flt spt-fade-a 0.4) + (sp-int spt-timer 160) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 80) + (sp-launcher-by-id spt-next-launcher 2203) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +(defpart 2203 + :init-specs ((sp-flt spt-fade-a -0.4)) + ) + +(defpart 2197 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xd3 :page #xc)) + (sp-func spt-birth-func 'birth-func-camera-orient) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 299)) + (sp-flt spt-scale-x (meters 6)) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-flt spt-scale-y (meters 600)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-rnd-flt spt-b 0.0 128.0 1.0) + (sp-rnd-flt spt-a 32.0 4.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 2200 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0.1)) + (sp-flt spt-scale-x (meters 16)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-rnd-flt spt-b 0.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +(defpart 2198 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 1)) + (sp-rnd-flt spt-scale-x (meters 12) (meters 0.1) 1.0) + (sp-flt spt-rot-x 6144.0) + (sp-rnd-flt spt-scale-y (meters 20) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-rnd-flt spt-b 0.0 128.0 1.0) + (sp-flt spt-a 20.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 16384.0) + ) + ) + +(defpart 2202 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.1) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.15) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.01) 1.0) + (sp-flt spt-fade-a 0.16) + (sp-int spt-timer 4800) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-int-plain-rnd spt-next-time 99 197 1) + (sp-launcher-by-id spt-next-launcher 2204) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +(defpart 2204 + :init-specs ((sp-flt spt-fade-a 0.0) + (sp-int-plain-rnd spt-next-time 300 1799 1) + (sp-launcher-by-id spt-next-launcher 2205) + ) + ) + +(defpart 2205 + :init-specs ((sp-rnd-flt spt-scalevel-x (meters -0.00033333333) (meters -0.00066666666) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.16) + (sp-rnd-flt spt-accel-y -0.4096 -0.4096 1.0) + ) + ) + +(defpart 2201 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 0.3)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.01) 1.0) + (sp-int spt-timer 3000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +(defpart 2195 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-flt spt-z (meters 0.1)) + (sp-flt spt-scale-x (meters 1.5)) + (sp-flt spt-scale-y (meters 0.9)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-flt spt-omega 0.0) + (sp-rnd-int-flt spt-vel-x (meters -0.21333334) 1 1747.6267) + (sp-flt spt-vel-y (meters 0)) + (sp-flt spt-vel-z (meters 0)) + (sp-flt spt-scalevel-x (meters -0.0050000004)) + (sp-flt spt-scalevel-y (meters 0.0016666667)) + (sp-flt spt-fade-a 1.6) + (sp-int-plain-rnd spt-timer 2400 599 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2206) + ) + ) + +(defpart 2206 + :init-specs ((sp-flt spt-scale-x (meters 1.2)) + (sp-flt spt-scale-y (meters 1)) + (sp-flt spt-scalevel-x (meters 0.010000001)) + (sp-flt spt-scalevel-y (meters -0.0033333334)) + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2207) + ) + ) + +(defpart 2207 + :init-specs ((sp-flt spt-scale-x (meters 1.5)) + (sp-flt spt-scale-y (meters 0.9)) + (sp-flt spt-scalevel-x (meters -0.010000001)) + (sp-flt spt-scalevel-y (meters 0.0033333334)) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2206) + ) + ) + +(defpart 2196 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-rnd-flt spt-num 0.0 0.5 1.0) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-flt spt-y (meters 0.1)) + (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters -0.00033333333) (meters -0.00066666666) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.53333336) + (sp-int spt-timer 2400) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 2208) + (sp-rnd-flt spt-conerot-x (degrees 110.0) (degrees 50.000004) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.4)) + ) + ) + +(defpart 2208 + :init-specs ((sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.0033333334) 1.0) + (sp-flt spt-accel-y -0.27306667) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 2209) + ) + ) + +(defpart 2209 + :init-specs ((sp-flt spt-fade-a -0.08)) + ) + +(deftype bubbler (process-drawable) + ((rod-of-god-scale float :offset-assert 200) + (ambient-id uint32 :offset-assert 204) + (last-recharge-time time-frame :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 22 + :size-assert #xd8 + :flag-assert #x16006000d8 + (:methods + (idle () _type_ :state 20) + (hidden () _type_ :state 21) + ) + ) + + +(defstate hidden (bubbler) + :virtual #t + :trans (behavior () + (if (send-event (ppointer->process *underb-master*) 'query 'bubbler) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior bubbler) sleep-code) + ) + +(defstate idle (bubbler) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('untrigger) + (go-virtual idle) + ) + ) + ) + :trans (behavior () + (if (not (send-event (ppointer->process *underb-master*) 'query 'bubbler)) + (go-virtual hidden) + ) + (set! (-> *part-id-table* 2197 init-specs 4 initial-valuef) (* 16384.0 (-> self rod-of-god-scale))) + (set! (-> *part-id-table* 2197 init-specs 8 initial-valuef) 0.0) + (set! (-> *part-id-table* 2197 init-specs 9 initial-valuef) 96.0) + (set! (-> *part-id-table* 2197 init-specs 10 initial-valuef) 255.0) + (set! (-> *part-id-table* 2200 init-specs 3 initial-valuef) (* 65536.0 (-> self rod-of-god-scale))) + (set! (-> *part-id-table* 2200 init-specs 2 initial-valuef) 3686.4) + (set! (-> *part-id-table* 2200 init-specs 5 initial-valuef) 0.0) + (set! (-> *part-id-table* 2200 init-specs 6 initial-valuef) 96.0) + (set! (-> *part-id-table* 2200 init-specs 7 initial-valuef) 255.0) + (set! (-> *part-id-table* 2198 init-specs 9 initial-valuef) (* 25.0 (-> self rod-of-god-scale))) + (set! (-> *part-id-table* 2198 init-specs 6 initial-valuef) 0.0) + (set! (-> *part-id-table* 2198 init-specs 7 initial-valuef) 96.0) + (set! (-> *part-id-table* 2198 init-specs 8 initial-valuef) 255.0) + (spawn (-> self part) (-> self root trans)) + (sound-play "bubbler" :id (the-as sound-id (-> self ambient-id)) :position (-> self root trans)) + (let ((a0-4 *target*)) + (when a0-4 + (let ((a0-5 (get-trans a0-4 0))) + (when (and (>= (- (-> a0-5 y) (-> self root trans y)) -6144.0) + (let ((f0-18 11264.0)) + (>= (* f0-18 f0-18) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) + ) + ) + (if (>= (- (-> self clock frame-counter) (-> self last-recharge-time)) (seconds 1)) + (sound-play "oxygen-recharge") + ) + (set! (-> self last-recharge-time) (-> self clock frame-counter)) + (send-event (ppointer->process *underb-master*) 'bubbler) + ) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior bubbler) sleep-code) + ) + +(defmethod deactivate bubbler ((obj bubbler)) + (sound-stop (the-as sound-id (-> obj ambient-id))) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! bubbler ((obj bubbler) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 500) obj)) + (set! (-> obj rod-of-god-scale) 1.0) + (set! (-> obj ambient-id) (the-as uint (sound-play "bubbler" :position (-> obj root trans)))) + (go (method-of-object obj idle)) + (none) + ) + +(deftype under-rise-plat (process-drawable) + ((up-y float :offset-assert 200) + (down-y float :offset-assert 204) + (delta-y float :offset-assert 208) + (up-threshold float :offset-assert 212) + (down-threshold float :offset-assert 216) + (last-ridden time-frame :offset-assert 224) + (ridden symbol :offset-assert 232) + (rider-started basic :offset-assert 236) + (extra-id int32 :offset-assert 240) + ) + :heap-base #x80 + :method-count-assert 26 + :size-assert #xf4 + :flag-assert #x1a008000f4 + (:methods + (idle-up () _type_ :state 20) + (wait-up () _type_ :state 21) + (going-down () _type_ :state 22) + (idle-down () _type_ :state 23) + (wait-down () _type_ :state 24) + (going-up () _type_ :state 25) + ) + ) + + +(defskelgroup skel-under-rise-plat under-rise-plat under-rise-plat-lod0-jg under-rise-plat-idle-ja + ((under-rise-plat-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 14) + ) + +(defbehavior under-rise-plat-event-handler under-rise-plat ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('ridden) + (set! (-> self ridden) #t) + (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (set! (-> self last-ridden) (the-as time-frame v0-0)) + v0-0 + ) + ) + (('big-room) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'status (-> arg3 param 0)) + ) + ) + ) + +(defstate wait-up (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (set! (-> self rider-started) #f) + (set! (-> self ridden) #f) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'up #t) + ) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (not (-> self ridden)) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) + ) + (go-virtual idle-up) + ) + (set! (-> self ridden) #f) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +(defstate idle-up (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logior! (-> self mask) (process-mask actor-pause)) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (if (-> self ridden) + (go-virtual going-down) + ) + (let* ((a0-1 (target-pos 0)) + (v1-6 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) a0-1)) + ) + (set! (-> v1-6 y) (+ 58000.0 (-> v1-6 y))) + (if (< (-> self down-threshold) (-> v1-6 y)) + (go-virtual going-down) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +(defstate going-down (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self root transv y) -20480.0) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'up #f) + ) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (let ((gp-0 (-> self root))) + (if (>= (-> self down-y) (-> gp-0 trans y)) + (go-virtual wait-down) + ) + (vector-v++! (-> gp-0 trans) (-> gp-0 transv)) + (if (>= (-> self down-y) (-> gp-0 trans y)) + (set! (-> gp-0 trans y) (-> self down-y)) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +(defstate wait-down (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (set! (-> self rider-started) #f) + (set! (-> self ridden) #f) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (not (-> self ridden)) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) + ) + (go-virtual idle-down) + ) + (set! (-> self ridden) #f) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +(defstate idle-down (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logior! (-> self mask) (process-mask actor-pause)) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (-> self ridden) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #t) + ) + (set! (-> self rider-started) (the-as basic #t)) + (go-virtual going-up) + ) + (let* ((a0-4 (target-pos 0)) + (v1-19 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) a0-4)) + ) + (set! (-> v1-19 y) (+ 58000.0 (-> v1-19 y))) + (if (< (-> v1-19 y) (-> self up-threshold)) + (go-virtual going-up) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +(defstate going-up (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self root transv y) 20480.0) + (set! (-> self ridden) #f) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (-> self rider-started) + (when (and (not (-> self ridden)) (>= (- (-> self clock frame-counter) (-> self last-ridden)) (seconds 2))) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) + ) + (go-virtual going-down) + ) + ) + (set! (-> self ridden) #f) + (let ((gp-0 (-> self root))) + (if (>= (-> gp-0 trans y) (-> self up-y)) + (go-virtual wait-up) + ) + (vector-v++! (-> gp-0 trans) (-> gp-0 transv)) + (if (>= (-> gp-0 trans y) (-> self up-y)) + (set! (-> gp-0 trans y) (-> self up-y)) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-rise-plat ((obj under-rise-plat) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (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-spec obstacle camera-blocker pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 -40960.0 0.0 57344.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-12 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-12 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-12 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (-> obj root) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-16 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-16 + (+! (-> obj root trans x) (-> v1-16 0)) + (+! (-> obj root trans y) (-> v1-16 1)) + (+! (-> obj root trans z) (-> v1-16 2)) + ) + ) + (set! (-> obj extra-id) (res-lump-value arg0 'extra-id int :time -1000000000.0)) + (set! (-> obj delta-y) (res-lump-float arg0 'height :default 92160.0)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-rise-plat" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((v1-23 (-> obj root))) + (set! (-> obj down-y) (-> v1-23 trans y)) + (+! (-> v1-23 trans y) (-> obj delta-y)) + (set! (-> obj up-y) (-> v1-23 trans y)) + (set! (-> obj down-threshold) (* 0.6666667 (-> obj delta-y))) + (set! (-> obj up-threshold) (- (-> obj down-threshold))) + (vector-reset! (-> v1-23 transv)) + ) + (set! (-> obj ridden) #f) + (set! (-> obj rider-started) #f) + (set! (-> obj draw light-index) (the-as uint 2)) + (go (method-of-object obj idle-up)) + (none) + ) + +(deftype under-buoy-base (process-drawable) + ((release symbol :offset-assert 200) + (open-anim-frame float :offset-assert 204) + ) + :heap-base #x50 + :method-count-assert 22 + :size-assert #xd0 + :flag-assert #x16005000d0 + (:methods + (idle () _type_ :state 20) + (opened () _type_ :state 21) + ) + ) + + +(defskelgroup skel-under-buoy-base under-buoy-base under-buoy-base-lod0-jg under-buoy-base-idle-ja + ((under-buoy-base-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 5) + ) + +(defstate idle (under-buoy-base) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('attack) + (case (-> (the-as attack-info (-> event param 1)) mode) + (('mech-punch 'crush) + (let ((a0-5 (ppointer->process (-> self parent)))) + (send-event a0-5 'base-hit) + ) + ) + ) + ) + (('release) + (let ((v0-0 (the-as object #t))) + (set! (-> self release) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + ) + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (when (-> self release) + (ja :num-func num-func-identity :frame-num (-> self open-anim-frame)) + (set! (-> self open-anim-frame) (+ 0.2 (-> self open-anim-frame))) + (if (< 17.0 (-> self open-anim-frame)) + (go-virtual opened) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-buoy-base) sleep-code) + :post (the-as (function none :behavior under-buoy-base) ja-post) + ) + +(defstate opened (under-buoy-base) + :virtual #t + :enter (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (none) + ) + :code (the-as (function none :behavior under-buoy-base) sleep-code) + :post (the-as (function none :behavior under-buoy-base) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior under-buoy-base-init-by-other under-buoy-base ((arg0 object) (arg1 entity-actor)) + (process-entity-set! self arg1) + (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0))) + (set! (-> s5-0 total-prims) (the-as uint 4)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 20480.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 8192.0 0.0 20480.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 8192.0 0.0 20480.0) + ) + (let ((v1-12 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 2) (the-as uint 0)))) + (set! (-> v1-12 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-12 prim-core action) (collide-action solid)) + (set! (-> v1-12 transform-index) 6) + (set-vector! (-> v1-12 local-sphere) 0.0 8192.0 0.0 20480.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-15 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-15 prim-core collide-with)) + ) + (set! (-> self root) s5-0) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-buoy-base" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (process-drawable-from-entity! self arg1) + (set! (-> self release) #f) + (logior! (-> self mask) (process-mask actor-pause)) + (set! (-> self draw light-index) (the-as uint 2)) + (cond + ((and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete))) + (set! (-> self open-anim-frame) 17.0) + (ja-no-eval :group! (-> self draw art-group data 2) :num! (identity (-> self open-anim-frame))) + (go-virtual opened) + ) + (else + (set! (-> self open-anim-frame) 0.0) + (ja-no-eval :group! (-> self draw art-group data 2) :num! (identity (-> self open-anim-frame))) + (go-virtual idle) + ) + ) + (none) + ) + +(deftype under-buoy-chain (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(defskelgroup skel-under-buoy-chain under-buoy-chain under-buoy-chain-lod0-jg under-buoy-chain-idle-ja + ((under-buoy-chain-lod0-mg (meters 999999))) + :bounds (static-spherem 0 -10 0 14) + ) + +(defstate idle (under-buoy-chain) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (let ((v1-0 (ppointer->process (-> self parent)))) + (set! (-> self root trans quad) (-> (the-as process-drawable v1-0) root trans quad)) + ) + (none) + ) + :code (the-as (function none :behavior under-buoy-chain) sleep-code) + :post (the-as (function none :behavior under-buoy-chain) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior under-buoy-chain-init-by-other under-buoy-chain ((arg0 object) (arg1 entity-actor)) + (process-entity-set! self arg1) + (let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set! (-> v1-6 transform-index) 4) + (set-vector! (-> v1-6 local-sphere) 0.0 -40960.0 0.0 57344.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> self root) s5-0) + ) + (process-drawable-from-entity! self arg1) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-buoy-chain" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self draw light-index) (the-as uint 2)) + (logior! (-> self mask) (process-mask actor-pause)) + (go-virtual idle) + (none) + ) + +(deftype under-buoy-plat (rigid-body-platform) + ((orig-trans vector :inline :offset-assert 384) + (surface-height float :offset-assert 400) + (anchor-point vector :inline :offset-assert 416) + (base (pointer under-buoy-base) :offset-assert 432) + ) + :heap-base #x140 + :method-count-assert 59 + :size-assert #x1b4 + :flag-assert #x3b014001b4 + (:methods + (waiting () _type_ :state 57) + (running () _type_ :state 58) + ) + ) + + +(defskelgroup skel-under-buoy-plat under-buoy-plat under-buoy-plat-lod0-jg under-buoy-plat-idle-ja + ((under-buoy-plat-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 5) + ) + +(defmethod rigid-body-object-method-29 under-buoy-plat ((obj under-buoy-plat) (arg0 float)) + ((the-as (function rigid-body-object float none) (find-parent-method under-buoy-plat 29)) obj arg0) + (rigid-body-platform-method-56 obj (-> obj orig-trans)) + 0 + (none) + ) + +(defmethod rigid-body-object-method-32 under-buoy-plat ((obj under-buoy-plat)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (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) (collide-spec obstacle camera-blocker pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak hit-by-others-list player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 4) + (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 20480.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-16 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-16 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + ) + (set! (-> obj root-override-2) s5-0) + ) + 0 + (none) + ) + +(define *under-buoy-plat-platform-constants* (new 'static 'rigid-body-platform-constants + :mass 1.48 + :inv-mass 0.6756757 + :cm-joint (new 'static 'vector :w 1.0) + :linear-damping 0.8 + :angular-damping 0.5 + :friction-factor 0.1 + :inertial-tensor-x (meters 5) + :inertial-tensor-y (meters 1) + :inertial-tensor-z (meters 5) + :max-time-step 0.02 + :gravity (meters 80) + :idle-distance (meters 50) + :attack-force-scale 1.0 + :name '*under-buoy-plat-platform-constants* + :drag-factor 2.0 + :buoyancy-factor 2.3 + :max-buoyancy-depth (meters 1.5) + :player-weight (meters 150) + :player-bonk-factor 0.5 + :player-dive-factor 1.0 + :player-force-distance (meters 2) + :player-force-clamp (meters 1000000) + :player-force-timeout #x1e + :explosion-force (meters 1000) + :control-point-count 5 + :platform #t + :sound-name "ruins-plat" + ) + ) + +(defmethod rigid-body-platform-method-53 under-buoy-plat ((obj under-buoy-plat) (arg0 vector)) + -220341.05 + ) + +(defmethod rigid-body-platform-method-56 under-buoy-plat ((obj under-buoy-plat) (arg0 vector)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 arg0 (-> obj rbody state position)) + (set! (-> v1-0 y) 0.0) + (let* ((f0-1 (vector-length v1-0)) + (f1-1 (* 4.0 (fmax 0.0 (fmin 4096.0 (+ -819.2 f0-1))))) + ) + (when (< 0.0 f1-1) + (vector-float*! v1-0 v1-0 (/ f1-1 f0-1)) + (rigid-body-method-20 (-> obj rbody state) v1-0) + ) + ) + ) + 0 + (none) + ) + +(defmethod rigid-body-object-method-33 under-buoy-plat ((obj under-buoy-plat)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-buoy-plat" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (rigid-body-object-method-31 obj *under-buoy-plat-platform-constants*) + (set! (-> obj orig-trans quad) (-> obj root-override-2 trans quad)) + (set! (-> obj anchor-point quad) (-> obj root-override-2 trans quad)) + (set! (-> obj surface-height) (-> obj root-override-2 trans y)) + (set! (-> obj info-override cm-joint y) 6144.0) + (let ((s5-1 (-> obj info-override control-point-count))) + (dotimes (s4-1 s5-1) + (let ((s3-0 (-> obj control-point-array data s4-1))) + (let ((f30-0 (* 65536.0 (/ (the float s4-1) (the float s5-1))))) + (set! (-> s3-0 local-pos x) (* 12288.0 (sin f30-0))) + (set! (-> s3-0 local-pos y) 8192.0) + (set! (-> s3-0 local-pos z) (* 12288.0 (cos f30-0))) + ) + (set! (-> s3-0 local-pos w) 1.0) + ) + ) + ) + (process-spawn under-buoy-chain (target-pos 0) (-> obj entity) :to obj) + (set! (-> obj base) (process-spawn under-buoy-base (target-pos 0) (-> obj entity) :to obj)) + (logior! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj draw light-index) (the-as uint 2)) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod rigid-body-object-method-34 under-buoy-plat ((obj under-buoy-plat)) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (go (method-of-object obj running)) + (go (method-of-object obj waiting)) + ) + (none) + ) + +(defstate waiting (under-buoy-plat) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('attack) + (case (-> (the-as attack-info (-> event param 1)) mode) + (('mech-punch 'crush) + (go-virtual running) + ) + ) + ) + (('base-hit) + (go-virtual running) + ) + ) + ) + :enter (behavior () + 0 + (none) + ) + :code (the-as (function none :behavior under-buoy-plat) sleep-code) + :post (the-as (function none :behavior under-buoy-plat) ja-post) + ) + +(defstate running (under-buoy-plat) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior under-buoy-plat) + rigid-body-object-event-handler + ) + :enter (behavior () + (sound-play "break-chain") + (send-event (ppointer->process (-> self base)) 'release) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (behavior () + (rigid-body-object-method-37 self) + (none) + ) + ) + +(defskelgroup skel-under-mine under-mine under-mine-lod0-jg under-mine-idle-ja + ((under-mine-lod0-mg (meters 20)) (under-mine-lod1-mg (meters 999999))) + :bounds (static-spherem 0 0 0 9) + :shadow under-mine-shadow-mg + :origin-joint-index 12 + ) + +(defskelgroup skel-under-mine-explode under-mine under-mine-explode-lod0-jg under-mine-explode-idle-ja + ((under-mine-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 9) + :origin-joint-index 11 + ) + +(deftype under-mine-chain-physics (chain-physics) + () + :method-count-assert 18 + :size-assert #x570 + :flag-assert #x1200000570 + ) + + +(defmethod apply-gravity under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 vector) (arg1 int) (arg2 process-drawable)) + (local-vars (v1-7 vector) (v1-11 vector) (a0-17 float) (a0-26 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (vector-float*! arg0 (-> obj gravity) (* 81.92 (-> self clock time-adjust-ratio))) + (cond + ((= arg1 (+ (-> obj num-joints) -1)) + (let ((v1-4 (new 'stack-no-clear 'vector))) + (set! (-> v1-4 quad) (-> arg2 entity trans quad)) + (vector-! v1-4 v1-4 (the-as vector (-> obj chain-joints arg1))) + (vector+float*! arg0 arg0 v1-4 1.0) + ) + ) + (else + (cond + ((>= arg1 (the-as int (+ (-> obj num-joints) -1))) + (set! v1-7 (new 'stack-no-clear 'vector)) + (set! (-> v1-7 quad) (-> arg2 entity trans quad)) + (set! (-> v1-7 y) (+ 8192.0 (-> v1-7 y))) + ) + (else + (set! v1-7 (new 'stack-no-clear 'vector)) + (set! (-> v1-7 quad) (-> obj chain-joints (+ arg1 1) position quad)) + ) + ) + (vector-! v1-7 v1-7 (the-as vector (-> obj chain-joints arg1))) + (.lvf vf1 (&-> v1-7 quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov a0-17 vf1) + (let ((f0-6 (sqrtf a0-17))) + (vector+float*! arg0 arg0 v1-7 (/ (* 1.1 (- f0-6 (-> obj joint-length))) f0-6)) + ) + (set! v1-11 + (cond + ((zero? arg1) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg2 node-list data (-> obj root-joint-index))) + ) + (else + (set! v1-11 (new 'stack-no-clear 'vector)) + (set! (-> v1-11 quad) (-> obj chain-joints (+ arg1 -1) position quad)) + v1-11 + ) + ) + ) + (vector-! v1-11 v1-11 (the-as vector (-> obj chain-joints arg1))) + (.lvf vf1 (&-> v1-11 quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov a0-26 vf1) + (let ((f0-9 (sqrtf a0-26))) + (vector+float*! arg0 arg0 v1-11 (/ (* 1.1 (- f0-9 (-> obj joint-length))) f0-9)) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod chain-physics-method-14 under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 vector) (arg1 int)) + (vector-reset! arg0) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs vector. +(defmethod clamp-length under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 vector) (arg1 vector) (arg2 object) (arg3 process-drawable)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 quad) (-> arg3 entity trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 y) (+ -19660.8 (-> v1-0 y))) + (vector-! s5-0 arg0 v1-0) + (let ((f0-2 (vector-normalize-ret-len! s5-0 1.0))) + (if (< f0-2 20480.0) + (vector+float*! arg0 arg0 s5-0 (- 20480.0 f0-2)) + ) + ) + ) + ) + (the-as vector 0) + ) + +(defmethod chain-physics-method-16 under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 int)) + 21845.334 + ) + +(deftype under-mine (process-drawable) + ((root-override collide-shape-moving :offset 128) + (chain under-mine-chain-physics :offset-assert 200) + (chain-initialized symbol :offset-assert 204) + (main-mod joint-mod :offset-assert 208) + (head-mod joint-mod :offset-assert 212) + ) + :heap-base #x60 + :method-count-assert 22 + :size-assert #xd8 + :flag-assert #x16006000d8 + (:methods + (explode () _type_ :state 20) + (idle () _type_ :state 21) + ) + ) + + +(define *under-mine-chain-setup* (new 'static 'boxed-array :type chain-physics-setup + (new 'static 'chain-physics-setup :joint-index 14) + (new 'static 'chain-physics-setup :joint-index 13) + (new 'static 'chain-physics-setup :joint-index 12) + (new 'static 'chain-physics-setup :joint-index 11) + (new 'static 'chain-physics-setup :joint-index 10) + (new 'static 'chain-physics-setup :joint-index 9) + (new 'static 'chain-physics-setup :joint-index 8) + (new 'static 'chain-physics-setup :joint-index 7) + (new 'static 'chain-physics-setup :joint-index 6) + (new 'static 'chain-physics-setup :joint-index 5) + (new 'static 'chain-physics-setup :joint-index 4) + ) + ) + +(define *under-mine-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index 4) + (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index 5) + (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index 6) + (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index 7) + (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index 8) + (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index 9) + (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index 10) + (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index 11) + (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index 12) + (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index 13) + (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index 14) + (new 'static 'joint-exploder-static-joint-params :joint-index 14 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 15 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 16 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 17 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 18 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 19 :parent-joint-index 15) + ) + :collide-spec #x1 + ) + ) + +(defstate explode (under-mine) + :virtual #t + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-3 (-> self root-override root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (let ((gp-0 (new 'stack-no-clear 'explosion-init-params))) + (let ((v1-9 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self chain root-joint-index))) + ) + ) + (vector+float*! + v1-9 + v1-9 + (-> self node-list data (-> self chain root-joint-index) bone transform vector 1) + 10240.0 + ) + (set! (-> gp-0 spawn-point quad) (-> v1-9 quad)) + ) + (quaternion-copy! (-> gp-0 spawn-quat) (-> self root-override quat)) + (set! (-> gp-0 radius) 16384.0) + (set! (-> gp-0 group) (-> *part-group-id-table* 501)) + (set! (-> gp-0 collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> gp-0 penetrate-using) (penetrate explode)) + (explosion-spawn (the-as process-drawable *default-pool*) explosion gp-0) + ) + (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (set! (-> gp-1 duration) (seconds 4)) + (set! (-> gp-1 gravity) -20480.0) + (set! (-> gp-1 rot-speed) 4.2) + (set-vector! (-> gp-1 fountain-rand-transv-lo) -40960.0 20480.0 -40960.0 1.0) + (set-vector! (-> gp-1 fountain-rand-transv-hi) 40960.0 49152.0 40960.0 1.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-under-mine-explode" (the-as (pointer uint32) #f)) + 7 + gp-1 + *under-mine-exploder-params* + :to self + ) + ) + (sound-play "buoy-explode") + (activate! *camera-smush-control* 819.2 37 210 1.0 0.995 (-> self clock)) + (ja-channel-set! 0) + (ja-post) + (none) + ) + :trans (behavior () + (when (not (-> self child)) + (cleanup-for-death self) + (deactivate self) + ) + (none) + ) + :code (the-as (function none :behavior under-mine) sleep-code) + ) + +(defstate idle (under-mine) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('attack 'bonk 'touched) + (go-virtual explode) + ) + ) + ) + :trans (behavior () + (local-vars (a0-8 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (ja :num! (loop!)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self entity trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (cond + (*target* + (set! (-> s5-0 quad) (-> (get-trans *target* 3) quad)) + (set! (-> s5-0 y) (+ -28672.0 (-> s5-0 y))) + ) + (else + (set! (-> s5-0 quad) (-> gp-0 quad)) + (set! (-> s5-0 y) (+ -1024.0 (-> s5-0 y))) + ) + ) + (set! (-> gp-0 y) (+ -28672.0 (-> gp-0 y))) + (vector-seek-3d-smooth! (-> self root-override trans) s5-0 (* 204.8 (-> self clock time-adjust-ratio)) 0.25) + ) + (let ((v1-21 (vector-! (new 'stack-no-clear 'vector) (-> self root-override trans) gp-0))) + (.lvf vf1 (&-> v1-21 quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov a0-8 vf1) + (let ((f0-9 a0-8) + (f1-4 28672.0) + ) + (if (< (* f1-4 f1-4) f0-9) + (vector-float*! v1-21 v1-21 (/ 28672.0 (sqrtf f0-9))) + ) + ) + (vector+! (-> self root-override trans) gp-0 v1-21) + ) + (set! (-> self root-override trans y) (fmax (-> self root-override trans y) (+ 409.6 (-> gp-0 y)))) + ) + (when (-> self chain-initialized) + (let ((s5-1 (new-stack-vector0)) + (gp-1 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self head-mod quat))) + ) + (dotimes (v1-27 (min 8 (the-as int (-> self chain num-joints)))) + (vector+! s5-1 s5-1 (the-as vector (-> self chain chain-joints v1-27))) + ) + (vector-float*! s5-1 s5-1 (/ 1.0 (the float (min 8 (the-as int (-> self chain num-joints)))))) + (vector-! + s5-1 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self chain root-joint-index))) + s5-1 + ) + (vector-normalize! s5-1 1.0) + (vector-seek-3d-smooth! (-> gp-1 vector 1) s5-1 (* 0.5 (-> self clock time-adjust-ratio)) 0.5) + (vector-normalize! s5-1 1.0) + (quaternion-from-two-vectors-partial! + (-> self head-mod quat) + (new 'static 'vector :y 1.0) + (-> gp-1 vector 1) + 0.25 + ) + ) + (update (-> self chain) self) + ) + (none) + ) + ) + :code (the-as (function none :behavior under-mine) sleep-code) + :post (behavior () + (transform-post) + ;; TODO uncomment when hover-formation is in + ;; (when *nav-network* + ;; (let* ((a0-0 *nav-network*) + ;; (t9-1 (method-of-object a0-0 nav-network-method-25)) + ;; ) + ;; self + ;; (-> self root-override root-prim prim-core) + ;; (t9-1 a0-0) + ;; ) + ;; ) + (when (not (-> self chain-initialized)) + (set! (-> self chain-initialized) #t) + (initialize-chain-joints (-> self chain)) + ) + (none) + ) + ) + +;; WARN: Return type mismatch process-drawable vs under-mine. +(defmethod relocate under-mine ((obj under-mine) (arg0 int)) + (if (nonzero? (-> obj main-mod)) + (&+! (-> obj main-mod) arg0) + ) + (if (nonzero? (-> obj head-mod)) + (&+! (-> obj head-mod) arg0) + ) + (if (nonzero? (-> obj chain)) + (&+! (-> obj chain) arg0) + ) + (the-as under-mine ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-mine ((obj under-mine) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec enemy camera-blocker)) + (set! (-> v1-2 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 15) + (set-vector! (-> v1-2 local-sphere) 0.0 12288.0 0.0 10240.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-2) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-5 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> s4-0 event-self) 'touched) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-mine" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj chain-initialized) #f) + (set! (-> obj chain) (new 'process 'under-mine-chain-physics)) + (chain-physics-initialize obj (-> obj chain) 15 1843.2 *under-mine-chain-setup*) + (set! (-> obj chain negate-y) (the-as basic #t)) + (set! (-> obj chain axial-slop) 1820.4445) + (set! (-> obj chain maximum-stretch) 100.0) + (set! (-> obj chain stretch-vel) 0.7) + (set! (-> obj chain stretch-vel-parallel) 0.9) + (set! (-> obj chain compress-vel) 0.85) + (set! (-> obj chain compress-vel-parallel) 0.9) + (set! (-> obj main-mod) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj 3)) + (set! (-> obj main-mod track-mode) (track-mode no-rotate no-scale)) + (mode-set! (-> obj main-mod) (joint-mod-mode joint-set-world)) + (set! (-> obj main-mod trans quad) (-> obj entity trans quad)) + (set! (-> obj head-mod) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj 15)) + (set! (-> obj head-mod track-mode) (track-mode no-trans no-scale)) + (mode-set! (-> obj head-mod) (joint-mod-mode joint-set*)) + (quaternion-identity! (-> obj head-mod quat)) + (set! (-> obj draw light-index) (the-as uint 10)) + (go (method-of-object obj idle)) + (none) + ) + +(deftype under-lift (elevator) + ((sound-id sound-id :offset-assert 368) + ) + :heap-base #x100 + :method-count-assert 50 + :size-assert #x174 + :flag-assert #x3201000174 + (:methods + (under-lift-method-49 (_type_ symbol) none 49) + ) + ) + + +(defskelgroup skel-under-lift under-lift under-lift-lod0-jg under-lift-idle-ja + ((under-lift-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 5.6 9.2) + ) + +(defmethod get-art-group under-lift ((obj under-lift)) + "@returns The associated [[art-group]]" + (art-group-get-by-name *level* "skel-under-lift" (the-as (pointer uint32) #f)) + ) + +(defmethod move-between-points under-lift ((obj under-lift) (arg0 vector) (arg1 float) (arg2 float)) + "Move between two points on the elevator's path +@param vec TODO not sure +@param point-a The first point fetched from the elevator's path +@param point-b The second point fetched from the path +@see [[path-control]] and [[elevator]]" + (let ((s4-0 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg1 'interp)) + (a0-3 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg2 'interp)) + (v1-3 (-> obj root-override trans)) + ) + (when (and (< (-> a0-3 y) (-> s4-0 y)) (< (-> arg0 y) (+ -8192.0 (-> v1-3 y)))) + (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) arg0 v1-3))) + (vector-inv-orient-by-quat! s4-2 s4-2 (-> obj root-override quat)) + (and (< (fabs (-> s4-2 x)) 24576.0) (< 0.0 (-> s4-2 z)) (< (-> s4-2 z) 49152.0)) + ) + ) + ) + ) + +(defmethod commited-to-ride? under-lift ((obj under-lift)) + "@returns if the target is considered within the elevator area enough to begin descending/ascending" + (let* ((gp-0 *target*) + (a0-2 (if (type? gp-0 process-focusable) + gp-0 + ) + ) + ) + (when a0-2 + (let* ((v1-1 (get-trans a0-2 0)) + (gp-2 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj root-override trans))) + ) + (vector-inv-orient-by-quat! gp-2 gp-2 (-> obj root-override quat)) + (and (< (fabs (-> gp-2 x)) 20480.0) (< 0.0 (-> gp-2 z)) (< (-> gp-2 z) 40960.0)) + ) + ) + ) + ) + +(defmethod under-lift-method-49 under-lift ((obj under-lift) (arg0 symbol)) + (let ((v1-3 (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) child 1))) + (cond + (arg0 + (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> v1-3 prim-core collide-with) (collide-spec jak player-list)) + ) + (else + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + 0 + ) + ) + ) + (none) + ) + +(defstate running (under-lift) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type elevator running) enter))) + (if t9-0 + (t9-0) + ) + ) + (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) + ) + (under-lift-method-49 self #t) + (set-setting! 'jump #f 0 0) + ) + (none) + ) + :post (behavior () + (let ((t9-0 (-> (method-of-type elevator running) post))) + (if t9-0 + ((the-as (function none) t9-0)) + ) + ) + (sound-play "under-lift-lp" :id (-> self sound-id) :position (-> self root-override trans)) + (none) + ) + ) + +(defstate arrived (under-lift) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type elevator arrived) enter))) + (if t9-0 + (t9-0) + ) + ) + (sound-stop (-> self sound-id)) + (sound-play "sew-elev-stop") + (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) + ) + (under-lift-method-49 self #f) + (remove-setting! 'jump) + ) + (none) + ) + ) + +(defmethod deactivate under-lift ((obj under-lift)) + (sound-stop (-> obj sound-id)) + ((the-as (function process-drawable none) (find-parent-method under-lift 10)) obj) + (none) + ) + +(defmethod init-plat! under-lift ((obj under-lift)) + "Does any necessary initial platform setup. +For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." + (set! (-> obj sound-id) (new-sound-id)) + (set! (-> obj draw light-index) (the-as uint 4)) + 0 + (none) + ) + +(defmethod init-plat-collision! under-lift ((obj under-lift)) + "TODO - collision stuff for setting up the platform" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 22937.6 37683.2) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-15 prim-core action) (collide-action solid rideable)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 22937.6 37683.2) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-17 prim-core action) (collide-action solid)) + (set! (-> v1-17 transform-index) 3) + (set-vector! (-> v1-17 local-sphere) 0.0 0.0 22937.6 39321.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-20 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-20 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-20 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + (under-lift-method-49 obj #f) + (none) + ) + +(deftype under-break-door (process-focusable) + ((anim art-joint-anim :offset-assert 204) + (art-name string :offset-assert 208) + (collide-mesh int32 :offset-assert 212) + ) + :heap-base #x60 + :method-count-assert 29 + :size-assert #xd8 + :flag-assert #x1d006000d8 + (:methods + (hit (symbol) _type_ :state 27) + (idle () _type_ :state 28) + ) + ) + + +(defskelgroup skel-under-break-door under-break-door under-break-door-lod0-jg -1 + ((under-break-door-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 14) + :origin-joint-index 3 + ) + +(defstate idle (under-break-door) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('trigger) + (go-virtual hit #f) + ) + (('attack) + (case (-> (the-as attack-info (-> event param 1)) mode) + (('mech-punch 'crush) + (go-virtual hit #f) + ) + ) + ) + (('combo) + #t + ) + ) + ) + :code (behavior () + (add-process + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (the-as string (-> self anim extra)) + -99.0 + 0 + ) + (until #f + (transform-post) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + #f + (none) + ) + ) + +(defstate hit (under-break-door) + :virtual #t + :exit (behavior () + (ja-abort-spooled-anim (the-as spool-anim (-> self anim)) (the-as art-joint-anim #f) -1) + (none) + ) + :code (behavior ((arg0 symbol)) + (set! (-> self draw force-lod) 0) + (-> self draw bounds w) + (let ((v1-3 (-> self root-override root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (set! (-> self draw bounds w) 573440.0) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let* ((s5-0 (-> self draw art-group)) + (s4-0 (method-of-object s5-0 get-art-by-name-method)) + ) + (format (clear *temp-string*) "~S-end" (-> self art-name)) + (let ((s5-1 (s4-0 s5-0 *temp-string* art-joint-anim))) + (if (not arg0) + (ja-play-spooled-anim + (the-as spool-anim (-> self anim)) + (ja-group) + (the-as art-joint-anim s5-1) + (the-as (function process-drawable symbol) false-func) + ) + ) + (ja-channel-set! 1) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-1)) + ) + ) + (suspend) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + (none) + ) + :post (the-as (function none :behavior under-break-door) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-door ((obj under-break-door) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (stack-size-set! (-> obj main-thread) 512) + (set! (-> obj mask) (logior (process-mask collectable) (-> obj mask))) + (let ((s3-0 ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'art-name + 'interp + -1000000000.0 + "under-break-door-1" + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s4-0 (art-group-get-by-name *level* "skel-under-break-door" (the-as (pointer uint32) #f))) + ) + (set! (-> obj art-name) (the-as string s3-0)) + (let ((s2-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 3) + (set-vector! (-> v1-8 local-sphere) 0.0 0.0 0.0 57344.0) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-8) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-11 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-11 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + ) + (set! (-> obj root-override) s2-0) + ) + (cond + ((string= (-> obj art-name) "under-break-door-1") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-1" :anim-name "1-break" :parts 1 :command-list '()) + ) + ) + ) + ((string= (-> obj art-name) "under-break-door-2") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-2" :anim-name "2-break" :parts 1 :command-list '()) + ) + ) + ) + ((string= (-> obj art-name) "under-break-door-3") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-3" :anim-name "3-break" :parts 2 :command-list '()) + ) + ) + ) + ((string= (-> obj art-name) "under-break-door-4") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-4" :anim-name "4-break" :parts 1 :command-list '()) + ) + ) + ) + (else + (go process-drawable-art-error (the-as string s3-0)) + ) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj (the-as skeleton-group s4-0) (the-as pair 0)) + ) + (ja-channel-set! 1) + (let* ((s5-1 (-> obj skel root-channel 0)) + (s4-1 (-> obj draw art-group)) + (s3-1 (method-of-object s4-1 get-art-by-name-method)) + ) + (format (clear *temp-string*) "~S-idle" (-> obj art-name)) + (set! (-> s5-1 frame-group) (the-as art-joint-anim (s3-1 s4-1 *temp-string* (the-as type #f)))) + ) + (set! (-> obj draw light-index) (the-as uint 10)) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (go (method-of-object obj hit) #t) + (go (method-of-object obj idle)) + ) + (none) + ) + +(deftype under-seaweed-a (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(defskelgroup skel-under-seaweed-a under-seaweed-a under-seaweed-a-lod0-jg under-seaweed-a-idle-ja + ((under-seaweed-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 3) + ) + +(defstate idle (under-seaweed-a) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-a) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-a ((obj under-seaweed-a) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 4) 0))) + (set! (-> s4-0 total-prims) (the-as uint 5)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 22937.6 37683.2) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (let ((v1-15 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-17 transform-index) 3) + (set-vector! (-> v1-17 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (let ((v1-19 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 2) (the-as uint 0)))) + (set! (-> v1-19 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-19 transform-index) 3) + (set-vector! (-> v1-19 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (let ((v1-21 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 3) (the-as uint 0)))) + (set! (-> v1-21 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-21 transform-index) 3) + (set-vector! (-> v1-21 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-24 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-a" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +(deftype under-seaweed-b (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(defskelgroup skel-under-seaweed-b under-seaweed-b under-seaweed-b-lod0-jg under-seaweed-b-idle-ja + ((under-seaweed-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 4 0 5) + ) + +(defstate idle (under-seaweed-b) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-b) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-b ((obj under-seaweed-b) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-b" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +(deftype under-seaweed-c (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(defskelgroup skel-under-seaweed-c under-seaweed-c under-seaweed-c-lod0-jg under-seaweed-c-idle-ja + ((under-seaweed-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 3 0 4) + ) + +(defstate idle (under-seaweed-c) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-c) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-c ((obj under-seaweed-c) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-c" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +(deftype under-seaweed-d (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(defskelgroup skel-under-seaweed-d under-seaweed-d under-seaweed-d-lod0-jg under-seaweed-d-idle-ja + ((under-seaweed-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 6 0 7) + ) + +(defstate idle (under-seaweed-d) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-d) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-d ((obj under-seaweed-d) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-d" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +(defmethod draw hud-mech-air-tank ((obj hud-mech-air-tank)) + (set-hud-piece-position! + (the-as hud-sprite (-> obj sprites)) + (the int (+ 472.0 (* 100.0 (-> obj offset)))) + 208 + ) + (set-as-offset-from! (-> obj sprites 1) (the-as vector4w (-> obj sprites)) 0 51) + (set! (-> obj sprites 0 scale-x) 0.8) + (set! (-> obj sprites 0 scale-y) 0.8) + (set! (-> obj sprites 1 scale-x) 0.8) + (set! (-> obj sprites 1 scale-y) 0.8) + (set! (-> obj sprites 3 scale-x) 0.8) + (set! (-> obj sprites 3 scale-y) 0.8) + (set! (-> obj sprites 2 scale-x) 3.2) + (set! (-> obj sprites 2 scale-y) (* 4.56 (- 1.0 (-> *game-info* air-supply)))) + (set-as-offset-from! (-> obj sprites 2) (the-as vector4w (-> obj sprites)) 0 2) + (set-as-offset-from! (-> obj sprites 3) (the-as vector4w (-> obj sprites)) -30 -20) + ((method-of-type hud draw) obj) + 0 + (none) + ) + +(defmethod update-values hud-mech-air-tank ((obj hud-mech-air-tank)) + (set! (-> obj values 0 target) (the int (-> *game-info* air-supply))) + (logclear! (-> obj flags) (hud-flags disable)) + ((method-of-type hud update-values) obj) + 0 + (none) + ) + +(defmethod init-callback hud-mech-air-tank ((obj hud-mech-air-tank)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel hud-middle-right) (gui-action hidden) (-> obj name) 81920.0 0) + ) + (logior! (-> obj flags) (hud-flags show)) + (set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x2 :page #xd55))) + (set! (-> obj sprites 1 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xd55))) + (set! (-> obj sprites 2 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #xd55))) + (set! (-> obj sprites 3 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x1 :page #xd55))) + 0 + (none) + ) diff --git a/goal_src/jak2/levels/underport/under-shoot-block.gc b/goal_src/jak2/levels/underport/under-shoot-block.gc index 3f220f67ea..11eec491d0 100644 --- a/goal_src/jak2/levels/underport/under-shoot-block.gc +++ b/goal_src/jak2/levels/underport/under-shoot-block.gc @@ -7,3 +7,2294 @@ ;; DECOMP BEGINS +(deftype under-block-spawner (basic) + ((col int8 :offset-assert 4) + (row int8 :offset-assert 5) + (active-handle handle :offset-assert 8) + (waiting-handle handle :offset-assert 16) + (exploded-time time-frame :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + + +(deftype under-block-slot (basic) + ((col int8 :offset-assert 4) + (row int8 :offset-assert 5) + ) + :method-count-assert 9 + :size-assert #x6 + :flag-assert #x900000006 + ) + + +(deftype under-block-puzzle (basic) + ((auto-unlock? symbol :offset-assert 4) + (cells-wide int8 :offset-assert 8) + (cells-tall int8 :offset-assert 9) + (last-block-id int8 :offset-assert 10) + (slot-mask uint8 :offset-assert 11) + (slot-mask-full uint8 :offset-assert 12) + (prev-special-attack-id uint32 :offset-assert 16) + (orient-ry float :offset-assert 20) + (spawners (array under-block-spawner) :offset-assert 24) + (slots (array under-block-slot) :offset-assert 28) + (cells (pointer int32) :offset-assert 32) + (pulse-ops (pointer int8) :offset-assert 36) + (origin vector :inline :offset-assert 48) + (local-to-world matrix :inline :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) + + +(define *under-block-puzzles* + (new 'static 'boxed-array :type under-block-puzzle + (new 'static 'under-block-puzzle + :auto-unlock? #t + :cells-wide 5 + :cells-tall #x8 + :orient-ry 11286.756 + :spawners (new 'static 'boxed-array :type under-block-spawner + (new 'static 'under-block-spawner :col 1 :row 2) + (new 'static 'under-block-spawner :col 2 :row 1) + ) + :slots (new 'static 'boxed-array :type under-block-slot + (new 'static 'under-block-slot :col 1 :row 5) + (new 'static 'under-block-slot :col 3 :row 5) + ) + :cells (new 'static 'array int32 12 0 0 0 0 0 0 0 0 0 0 0 0) + :pulse-ops (new 'static 'array int8 144 + #x2c + 1 + 0 + 0 + 1 + 0 + 0 + 0 + #x58 + 2 + 0 + 0 + 1 + 0 + 0 + 0 + -124 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -80 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + -36 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + -22 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -38 + #x7 + 0 + 0 + 1 + 0 + 0 + 0 + -84 + #x8 + 0 + 0 + 1 + 0 + 0 + 0 + #x60 + #x9 + 0 + 0 + 1 + 0 + 0 + 0 + -10 + #x9 + 0 + 0 + 1 + 0 + 0 + 0 + #x6e + #xa + 0 + 0 + 1 + 0 + 0 + 0 + -56 + #xa + 0 + 0 + 1 + 0 + 0 + 0 + 4 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x22 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x40 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x5e + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x7c + #xb + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + :origin (new 'static 'vector :x -472567.8 :y -274432.0 :z 8110768.0 :w 1.0) + ) + (new 'static 'under-block-puzzle + :auto-unlock? #t + :cells-wide #x6 + :cells-tall #x8 + :orient-ry 11286.756 + :spawners (new 'static 'boxed-array :type under-block-spawner (new 'static 'under-block-spawner :col 1 :row 2)) + :slots (new 'static 'boxed-array :type under-block-slot (new 'static 'under-block-slot :col 3 :row 5)) + :cells (new 'static 'array int32 12 + -16843010 + #xfefefe + -16843010 + -16908034 + #xfefefe + -16843010 + #xfe + #xfefe00 + -33554432 + #xfe + -16843264 + -16843010 + ) + :pulse-ops (new 'static 'array int8 112 + #x2c + 1 + 0 + 0 + 1 + 0 + 0 + 0 + #x3a + 2 + 0 + 0 + 1 + 0 + 0 + 0 + #x2a + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -4 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -80 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + #x46 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + -66 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + #x18 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + #x54 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + #x72 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -112 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -82 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -52 + #x6 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + :origin (new 'static 'vector :x -969931.2 :y -274432.0 :z 8208644.0 :w 1.0) + ) + (new 'static 'under-block-puzzle + :auto-unlock? #f + :cells-wide #x7 + :cells-tall #x6 + :orient-ry 11286.756 + :spawners (new 'static 'boxed-array :type under-block-spawner + (new 'static 'under-block-spawner :row 4) + (new 'static 'under-block-spawner :row 5) + ) + :slots (new 'static 'boxed-array :type under-block-slot + (new 'static 'under-block-slot :col 5 :row 1) + (new 'static 'under-block-slot :col 5 :row 4) + ) + :cells (new 'static 'array int32 12 #xff00 0 -16777216 0 0 0 0 0 #xff #xff 0 0) + :pulse-ops (new 'static 'array int8 208 + #x2c + 1 + 0 + 0 + 1 + 0 + 0 + 0 + #x58 + 2 + 0 + 0 + 1 + 0 + 0 + 0 + -124 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -80 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + -36 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + #x8 + #x7 + 0 + 0 + 1 + 0 + 0 + 0 + #x34 + #x8 + 0 + 0 + 1 + 0 + 0 + 0 + #x60 + #x9 + 0 + 0 + 1 + 0 + 0 + 0 + -116 + #xa + 0 + 0 + 1 + 0 + 0 + 0 + -72 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + -28 + #xc + 0 + 0 + 1 + 0 + 0 + 0 + #x10 + #xe + 0 + 0 + 1 + 0 + 0 + 0 + #x3c + #xf + 0 + 0 + 1 + 0 + 0 + 0 + #x4a + #x10 + 0 + 0 + 1 + 0 + 0 + 0 + #x3a + #x11 + 0 + 0 + 1 + 0 + 0 + 0 + #xc + #x12 + 0 + 0 + 1 + 0 + 0 + 0 + -64 + #x12 + 0 + 0 + 1 + 0 + 0 + 0 + #x56 + #x13 + 0 + 0 + 1 + 0 + 0 + 0 + -50 + #x13 + 0 + 0 + 1 + 0 + 0 + 0 + #x28 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + #x64 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -126 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -96 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -66 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -36 + #x14 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + :origin (new 'static 'vector :x -1120440.4 :y -290775.03 :z 8072909.0 :w 1.0) + ) + ) + ) + +(defskelgroup skel-under-shoot-block under-shoot-block under-shoot-block-lod0-jg under-shoot-block-idle-ja + ((under-shoot-block-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3.2) + ) + +(defskelgroup skel-under-shoot-block-explode under-shoot-block under-shoot-block-explode-lod0-jg under-shoot-block-explode-idle-ja + ((under-shoot-block-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 15) + ) + +(define *under-shoot-block-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 14 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 15 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 16 :parent-joint-index -1) + ) + :collide-spec #x1 + ) + ) + +(deftype under-block (process-focusable) + ((puzzle under-block-puzzle :offset-assert 204) + (my-parent (pointer process) :offset-assert 208) + (prev-attack-id uint32 :offset-assert 212) + (spawner-id int8 :offset-assert 216) + (my-id int8 :offset-assert 217) + (col int8 :offset-assert 218) + (row int8 :offset-assert 219) + (prev-col int8 :offset-assert 220) + (prev-row int8 :offset-assert 221) + (move-dir-x int8 :offset-assert 222) + (move-dir-z int8 :offset-assert 223) + (pulse-op int8 :offset-assert 224) + (pulse-pc int8 :offset-assert 225) + (pulse-ctr int8 :offset-assert 226) + (flags uint64 :offset-assert 232) + (activated-time time-frame :offset-assert 240) + (rot-axis vector :inline :offset-assert 256) + (away-from-focal-pt vector :inline :offset-assert 272) + ) + :heap-base #xa0 + :method-count-assert 51 + :size-assert #x120 + :flag-assert #x3300a00120 + (:methods + (waiting () _type_ :state 27) + (rise-up () _type_ :state 28) + (follow () _type_ :state 29) + (idle () _type_ :state 30) + (active () _type_ :state 31) + (flip () _type_ :state 32) + (rock () _type_ :state 33) + (sink-partially () _type_ :state 34) + (sunk-partially () _type_ :state 35) + (victory () _type_ :state 36) + (beaten () _type_ :state 37) + (fall () _type_ :state 38) + (explode () _type_ :state 39) + (die-fast () _type_ :state 40) + (under-block-method-41 (_type_ symbol) none 41) + (under-block-method-42 (_type_) none 42) + (under-block-method-43 (_type_ int int) symbol 43) + (under-block-method-44 (_type_) symbol 44) + (under-block-method-45 (_type_) none 45) + (under-block-method-46 (_type_ int int) none 46) + (under-block-method-47 (_type_ int int) int 47) + (under-block-method-48 (_type_ int int) symbol 48) + (under-block-method-49 (_type_ int int) symbol 49) + (under-block-method-50 (_type_) none 50) + ) + ) + + +(deftype under-shoot-block (process-drawable) + ((puzzle under-block-puzzle :offset-assert 200) + (actor-group (pointer actor-group) :offset-assert 204) + (allow-unlock? symbol :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 29 + :size-assert #xd4 + :flag-assert #x1d006000d4 + (:methods + (idle () _type_ :state 20) + (victory-locked () _type_ :state 21) + (victory () _type_ :state 22) + (beaten () _type_ :state 23) + (under-shoot-block-method-24 (_type_ int int) none 24) + (under-shoot-block-method-25 (_type_ int int float int) none 25) + (under-shoot-block-method-26 (_type_) none 26) + (under-shoot-block-method-27 (_type_ symbol) none 27) + (under-shoot-block-method-28 (_type_) int 28) + ) + ) + + +(defbehavior under-block-event-handler under-block ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('track) + (cond + ((-> arg3 param 0) + (if (logtest? (-> self flags) 1) + #t + 'abort + ) + ) + (else + (logtest? (-> self flags) 1) + ) + ) + ) + (('attack) + (when (logtest? (-> self flags) 1) + (let ((gp-0 (the-as attack-info (-> arg3 param 1)))) + (when (and (!= (-> gp-0 id) (-> self prev-attack-id)) (!= (-> gp-0 id) (-> self puzzle prev-special-attack-id))) + (let ((s5-0 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3))) + (when (not (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot) s5-0)) + (if (< (+ 7372.8 (-> self root-override trans y)) (-> (target-pos 0) y)) + (return #f) + ) + ) + (set! (-> self prev-attack-id) (-> gp-0 id)) + (if (logtest? s5-0 (penetrate punch)) + (set! (-> self puzzle prev-special-attack-id) (-> gp-0 id)) + ) + ) + (when #t + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-1 0) + (gp-1 0) + ) + (vector-! s4-0 (-> self root-override trans) (target-pos 0)) + (vector-rotate-around-y! s4-0 s4-0 (- (-> self puzzle orient-ry))) + (cond + ((< (fabs (-> s4-0 z)) (fabs (-> s4-0 x))) + (if (>= (-> s4-0 x) 0.0) + (set! s5-1 1) + (set! s5-1 -1) + ) + ) + ((>= (-> s4-0 z) 0.0) + (set! gp-1 1) + ) + (else + (set! gp-1 -1) + ) + ) + (cond + ((under-block-method-43 self s5-1 gp-1) + (set! (-> self move-dir-x) s5-1) + (set! (-> self move-dir-z) gp-1) + (under-block-method-48 self (+ (-> self col) s5-1) (+ (-> self row) gp-1)) + (set! (-> self flags) (logand -2 (-> self flags))) + (if (zero? (-> self activated-time)) + (under-block-method-42 self) + ) + (go-virtual flip) + ) + ((under-block-method-49 self s5-1 gp-1) + (set! (-> self move-dir-x) s5-1) + (set! (-> self move-dir-z) gp-1) + (set! (-> self flags) (logand -2 (-> self flags))) + (go-virtual rock) + ) + ((and (-> self next-state) (= (-> self next-state name) 'idle)) + (go-virtual active) + ) + ) + ) + ) + #t + ) + ) + ) + ) + (('rise-up) + (if (and (-> self next-state) (= (-> self next-state name) 'waiting)) + (go-virtual rise-up) + ) + ) + (('sunk-partially) + (and (-> self next-state) (= (-> self next-state name) 'sunk-partially)) + ) + (('victory) + (if (and (-> self next-state) (= (-> self next-state name) 'sunk-partially)) + (go-virtual victory) + ) + ) + (('die-fast) + (go-virtual die-fast) + ) + ) + ) + +(defmethod under-block-method-48 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-0 (-> obj puzzle))) + (when (and (>= arg0 0) (< arg0 (-> v1-0 cells-wide)) (>= arg1 0) (< arg1 (-> v1-0 cells-tall))) + (let* ((a1-1 (+ (* arg1 (-> v1-0 cells-wide)) arg0)) + (a2-4 (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1)))) + (a0-1 (-> obj my-id)) + ) + (when (or (zero? a2-4) (= a2-4 a0-1)) + (set! (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1))) a0-1) + #t + ) + ) + ) + ) + ) + +(defmethod under-block-method-46 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-0 (-> obj puzzle))) + (when (and (>= arg0 0) (< arg0 (-> v1-0 cells-wide)) (>= arg1 0) (< arg1 (-> v1-0 cells-tall))) + (let ((a1-1 (+ (* arg1 (-> v1-0 cells-wide)) arg0))) + (when (= (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1))) (-> obj my-id)) + (set! (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1))) 0) + 0 + ) + ) + ) + ) + (none) + ) + +(defmethod under-block-method-47 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-0 (-> obj puzzle)) + (v0-0 -1) + ) + (when (and (>= arg0 0) (< arg0 (-> v1-0 cells-wide)) (>= arg1 0) (< arg1 (-> v1-0 cells-tall))) + (let ((a0-7 (+ (* arg1 (-> v1-0 cells-wide)) arg0))) + (set! v0-0 (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a0-7)))) + ) + ) + v0-0 + ) + ) + +(defmethod under-block-method-43 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-3 (under-block-method-47 obj (+ (-> obj col) arg0) (+ (-> obj row) arg1)))) + (or (zero? v1-3) (= v1-3 -2) (= v1-3 (-> obj my-id))) + ) + ) + +(defmethod under-block-method-49 under-block ((obj under-block) (arg0 int) (arg1 int)) + (= (under-block-method-47 obj (+ (-> obj col) arg0) (+ (-> obj row) arg1)) -1) + ) + +(defmethod under-block-method-44 under-block ((obj under-block)) + (let ((v1-0 (-> obj puzzle)) + (a2-0 (-> obj puzzle slots)) + ) + (countdown (a1-1 (-> a2-0 length)) + (let ((a3-2 (-> a2-0 a1-1))) + (when (and (= (-> a3-2 col) (-> obj col)) (= (-> a3-2 row) (-> obj row))) + (logior! (-> v1-0 slot-mask) (ash 1 a1-1)) + (return #t) + ) + ) + ) + ) + #f + ) + +(defmethod under-block-method-42 under-block ((obj under-block)) + (with-pp + (set! (-> obj activated-time) (-> pp clock frame-counter)) + (logior! (-> obj flags) 2) + (set! (-> obj pulse-pc) 0) + (set! (-> obj pulse-op) 0) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +;; WARN: Function (method 45 under-block) has a return type of none, but the expression builder found a return statement. +(defmethod under-block-method-45 under-block ((obj under-block)) + (with-pp + (let ((v1-0 (-> obj puzzle))) + (when (logtest? (-> obj flags) 2) + (cond + ((!= (-> v1-0 slot-mask) (-> v1-0 slot-mask-full)) + (when (zero? (-> obj pulse-op)) + (if (< (- (-> pp clock frame-counter) (-> obj activated-time)) + (the-as time-frame (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (-> obj pulse-pc) 4))))) + ) + (return #f) + ) + (set! (-> obj pulse-op) + (the-as int (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (+ (-> obj pulse-pc) 1) 4))))) + ) + (+! (-> obj pulse-pc) 2) + (case (-> obj pulse-op) + ((1) + (set! (-> obj pulse-ctr) 3) + (sound-play "und-block-flash") + ) + ((2) + (go (method-of-object obj explode)) + ) + ) + ) + (case (-> obj pulse-op) + ((1) + (let ((v1-24 (-> obj pulse-ctr))) + (cond + ((= v1-24 3) + (set-vector! (-> obj draw color-mult) 1.1 0.25 0.25 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((or (= v1-24 2) (= v1-24 1)) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 1.0 1.0 1.0 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((zero? v1-24) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + (set! (-> obj pulse-op) 0) + 0 + ) + ) + ) + ) + ) + ) + (else + (set! (-> obj flags) (logand -3 (-> obj flags))) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + ) + ) + ) + ) + (none) + ) + ) + +(defmethod under-block-method-41 under-block ((obj under-block) (arg0 symbol)) + (let ((v1-1 (-> obj root-override root-prim))) + (case arg0 + (('active) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-as) (collide-spec)) + 0 + ) + (('fall) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-with) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-as) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-with) (collide-spec)) + 0 + ) + (('beaten) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-as) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-as) (collide-spec obstacle pusher)) + ) + ) + ) + (none) + ) + +(defpartgroup group-shoot-block-explode + :id 497 + :duration (seconds 2) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 6) + :parts ((sp-item 2181 :flags (bit6) :period 900 :length 5) + (sp-item 2182 :flags (bit6) :period 900 :length 5) + (sp-item 2183 :period 900 :length 15) + (sp-item 2184 :fade-after (meters 60) :falloff-to (meters 60) :period 900 :length 50 :offset 20) + (sp-item 2185 :fade-after (meters 200) :falloff-to (meters 200) :period 900 :length 25 :offset 20) + (sp-item 2186 :fade-after (meters 150) :falloff-to (meters 150) :period 900 :length 20 :offset 30) + ) + ) + +(defpart 2186 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x34 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-rot-z) + :flags (sp-flag spflag7) + :random-rangef 65536.0 + :random-multf 1.0 + ) + (sp-rnd-flt spt-scale-y (meters 0.8) (meters 0.2) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.1) (meters 0.26666668) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -5.12) + (sp-flt spt-fade-g -6.4) + (sp-flt spt-fade-b -7.28) + (sp-flt spt-fade-a -0.1254902) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 1000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int spt-next-time 25) + (sp-launcher-by-id spt-next-launcher 2187) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-conerot-x) + :flags (sp-flag from-pointer) + :func '*sp-temp* + ) + ) + ) + +(defpart 2185 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.026666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.01) (meters 0.26666668) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.12) (degrees 0.24) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -5.12) + (sp-flt spt-fade-g -6.4) + (sp-flt spt-fade-b -7.28) + (sp-flt spt-fade-a -0.1254902) + (sp-rnd-flt spt-friction 0.93 0.06 1.0) + (sp-int spt-timer 1000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int spt-next-time 25) + (sp-launcher-by-id spt-next-launcher 2187) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 2187 + :init-specs ((sp-rnd-flt spt-scalevel-x (meters 0.016666668) (meters 0.016666668) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g 0.0) + (sp-flt spt-fade-b 0.0) + (sp-rnd-flt spt-fade-a -0.062068965 -0.72 1.0) + (sp-int-plain-rnd spt-next-time 15 14 1) + (sp-launcher-by-id spt-next-launcher 2188) + ) + ) + +(defpart 2188 + :init-specs ((sp-flt spt-fade-a -0.2)) + ) + +(defpart 2182 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 10)) + (sp-flt spt-rot-x 2048.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 24.0) + (sp-flt spt-scalevel-x (meters 0.13333334)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g -2.1333334) + (sp-flt spt-fade-b -4.266667) + (sp-flt spt-fade-a 0.0) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 2189) + ) + ) + +(defpart 2189 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.85333335) + (sp-flt spt-fade-g -1.7066667) + (sp-flt spt-fade-b -1.7066667) + (sp-flt spt-fade-a -0.64) + ) + ) + +(defpart 2181 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 10)) + (sp-flt spt-rot-x 2048.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 24.0) + (sp-flt spt-scalevel-x (meters 0.5)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -4.266667) + (sp-flt spt-fade-g -4.266667) + (sp-flt spt-fade-b -4.266667) + (sp-flt spt-fade-a 0.0) + (sp-int spt-timer 65) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2190) + ) + ) + +(defpart 2190 + :init-specs ((sp-flt spt-scalevel-x (meters -0.2857143)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -1.8285714) + (sp-flt spt-fade-g -3.6571429) + (sp-flt spt-fade-b -3.6571429) + (sp-flt spt-fade-a -1.3714286) + ) + ) + +(defpart 2184 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x32 :page #xc)) + (sp-rnd-flt spt-num 12.0 2.0 1.0) + (sp-flt spt-x (meters 0.25)) + (sp-rnd-flt spt-scale-x (meters 1) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 16.0 48.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.083333336) (meters 0.083333336) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.006666667) (meters 0.0016666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.12) (degrees 0.24) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g -3.1) + (sp-flt spt-fade-b -0.1) + (sp-rnd-flt spt-accel-y -0.68266666 -1.3653333 1.0) + (sp-flt spt-friction 0.87) + (sp-int spt-timer 1000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int-plain-rnd spt-next-time 35 14 1) + (sp-launcher-by-id spt-next-launcher 2191) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 2191 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.14444445) + (sp-flt spt-fade-g -0.33333334) + (sp-flt spt-fade-b -0.33333334) + (sp-int-plain-rnd spt-next-time 45 14 1) + (sp-launcher-by-id spt-next-launcher 2192) + ) + ) + +(defpart 2192 + :init-specs ((sp-flt spt-fade-r 0.0) (sp-flt spt-fade-g -0.08695652) (sp-flt spt-fade-a -0.18478261)) + ) + +(defpart 2183 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 12.0 4.0 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 0.6) 1.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 2) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 128.0 64.0 1.0) + (sp-rnd-flt spt-g 96.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.06666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.033333335) (meters 0.02) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.12) (degrees 0.24) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.64) + (sp-rnd-flt spt-friction 0.84 0.06 1.0) + (sp-int spt-timer 710) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int-plain-rnd spt-next-time 35 14 1) + (sp-launcher-by-id spt-next-launcher 2193) + (sp-rnd-flt spt-conerot-x (degrees -1440.0) (degrees 2880.0) 1.0) + ) + ) + +(defpart 2193 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int-plain-rnd spt-next-time 0 94 1) + (sp-launcher-by-id spt-next-launcher 2194) + ) + ) + +(defpart 2194 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-copy-from-other spt-scalevel-y -4) (sp-flt spt-fade-a -0.128)) + ) + +(defmethod under-block-method-50 under-block ((obj under-block)) + (with-pp + (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint (if (logtest? (-> obj flags) 4) + 1 + 0 + ) + ) + ) + ) + ) + (when (logtest? (-> obj flags) 4) + (set! (-> s5-0 fountain-rand-transv-lo quad) (-> obj away-from-focal-pt quad)) + (set! (-> s5-0 fountain-rand-transv-hi x) 24576.0) + (set! (-> s5-0 fountain-rand-transv-hi y) 49152.0) + (set! (-> s5-0 fountain-rand-transv-hi z) 10240.0) + (set! (-> s5-0 fountain-rand-transv-hi w) 18432.0) + ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-under-shoot-block-explode" (the-as (pointer uint32) #f)) + 5 + s5-0 + *under-shoot-block-exploder-params* + :to obj + ) + ) + (if (>= 204800.0 (vector-vector-distance (target-pos 0) (-> obj root-override trans))) + (activate! *camera-smush-control* 409.6 37 210 1.0 0.995 (-> pp clock)) + ) + (let ((s5-2 (new 'stack-no-clear 'explosion-init-params))) + (set! (-> s5-2 spawn-point quad) (-> obj root-override trans quad)) + (quaternion-copy! (-> s5-2 spawn-quat) (-> obj root-override quat)) + (set! (-> s5-2 radius) 16384.0) + (set! (-> s5-2 group) (-> *part-group-id-table* 497)) + (set! (-> s5-2 collide-with) (collide-spec jak bot player-list)) + (set! (-> s5-2 penetrate-using) (penetrate explode)) + (explosion-spawn obj explosion s5-2) + ) + (none) + ) + ) + +(defstate waiting (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +(defstate rise-up (under-block) + :virtual #t + :event under-block-event-handler + :trans (the-as (function none :behavior under-block) rider-trans) + :code (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (while (not (under-block-method-48 self (-> self col) (-> self row))) + (suspend) + ) + (under-block-method-41 self 'active) + (set! (-> self state-time) (-> self clock frame-counter)) + (sound-play "und-block-rise") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-1 vector 1 quad) (-> gp-1 vector 0 quad)) + (set! (-> gp-1 vector 1 y) (+ 16384.0 (-> gp-1 vector 1 y))) + (until (>= 409.6 (fabs (- (-> gp-1 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-1 vector 1) + (* 30720.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (rider-post) + (suspend) + ) + (set! (-> self root-override trans quad) (-> gp-1 vector 1 quad)) + ) + (rider-post) + (go-virtual idle) + (none) + ) + ) + +(defstate follow (under-block) + :virtual #t + :event under-block-event-handler + :trans (the-as (function none :behavior under-block) rider-trans) + :code (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (set! (-> gp-0 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-0 vector 1 quad) (-> gp-0 vector 0 quad)) + (set! (-> gp-0 vector 1 y) (+ 16384.0 (-> gp-0 vector 1 y))) + (until (>= 409.6 (fabs (- (-> gp-0 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-0 vector 1) + (* 30720.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (rider-post) + (suspend) + ) + (set! (-> self root-override trans quad) (-> gp-0 vector 1 quad)) + ) + (rider-post) + (go-virtual waiting) + 0 + (none) + ) + ) + +(defstate idle (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (logior! (-> self flags) 1) + (under-block-method-41 self 'active) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +(defstate active (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (logior! (-> self flags) 1) + (under-block-method-41 self 'active) + (none) + ) + :exit (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +(defstate flip (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self prev-col) (-> self col)) + (set! (-> self prev-row) (-> self row)) + (+! (-> self col) (-> self move-dir-x)) + (+! (-> self row) (-> self move-dir-z)) + (under-block-method-48 self (-> self col) (-> self row)) + (none) + ) + :exit (behavior () + (under-block-method-46 self (-> self prev-col) (-> self prev-row)) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (local-vars (at-0 int)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (sound-play "und-block-roll") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 1 quad) (-> self root-override trans quad)) + (set-vector! + (-> gp-1 vector 0) + (+ 8192.0 (* 16384.0 (the float (-> self col)))) + 8192.0 + (+ 8192.0 (* 16384.0 (the float (-> self row)))) + 1.0 + ) + (vector-matrix*! + (the-as vector (-> gp-1 vector)) + (the-as vector (-> gp-1 vector)) + (-> self puzzle local-to-world) + ) + (quaternion-copy! (the-as quaternion (-> gp-1 trans)) (-> self root-override quat)) + (vector-! (-> self rot-axis) (the-as vector (-> gp-1 vector)) (-> gp-1 vector 1)) + (set! (-> self rot-axis y) 0.0) + (vector-normalize! (-> self rot-axis) 1.0) + (vector-rotate90-around-y! (-> self rot-axis) (-> self rot-axis)) + (quaternion-vector-angle! (the-as quaternion (-> gp-1 vector 2)) (-> self rot-axis) -16384.0) + (quaternion*! + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 trans)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let ((f30-0 (fmin 1.0 (* 0.022222223 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((s5-1 (-> self root-override))) + (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) + (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) + (set! (-> s5-1 trans y) (+ -8192.0 (* 11585.237 (sin (lerp 8192.0 24576.0 f30-0))) (-> s5-1 trans y))) + (vector-! (-> s5-1 transv) (-> s5-1 trans) (-> s5-1 transv)) + (let ((v1-17 (-> s5-1 transv))) + (.lvf vf1 (&-> (-> s5-1 transv) quad)) + (let ((f0-12 (-> self clock frames-per-second))) + (.mov at-0 f0-12) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-17 quad) vf1) + ) + (quaternion-slerp! + (-> s5-1 quat) + (the-as quaternion (-> gp-1 trans)) + (the-as quaternion (-> gp-1 vector 2)) + f30-0 + ) + ) + (transform-post) + (when (>= f30-0 1.0) + (cond + ((under-block-method-44 self) + (go-virtual sink-partially) + ) + ((= (under-block-method-47 self (-> self col) (-> self row)) -2) + (go-virtual fall) + ) + (else + (go-virtual active) + ) + ) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + ) + +(defstate rock (under-block) + :virtual #t + :event under-block-event-handler + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (sound-play "und-block-knock") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (let ((a1-1 (+ (-> self col) (-> self move-dir-x))) + (a0-4 (+ (-> self row) (-> self move-dir-z))) + ) + (set! (-> gp-1 vector 1 quad) (-> self root-override trans quad)) + (set-vector! + (-> gp-1 vector 0) + (+ 8192.0 (* 16384.0 (the float a1-1))) + 8192.0 + (+ 8192.0 (* 16384.0 (the float a0-4))) + 1.0 + ) + ) + (vector-matrix*! + (the-as vector (-> gp-1 vector)) + (the-as vector (-> gp-1 vector)) + (-> self puzzle local-to-world) + ) + (quaternion-copy! (the-as quaternion (-> gp-1 trans)) (-> self root-override quat)) + (vector-! (-> self rot-axis) (the-as vector (-> gp-1 vector)) (-> gp-1 vector 1)) + (set! (-> self rot-axis y) 0.0) + (vector-normalize! (-> self rot-axis) 1.0) + (vector-rotate90-around-y! (-> self rot-axis) (-> self rot-axis)) + (quaternion-vector-angle! (the-as quaternion (-> gp-1 vector 2)) (-> self rot-axis) -16384.0) + (quaternion*! + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 trans)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let ((f30-0 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((s5-1 (-> self root-override))) + (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) + (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) + (set! (-> s5-1 trans y) (+ -8192.0 (* 11585.237 (sin (lerp 8192.0 24576.0 f30-0))) (-> s5-1 trans y))) + (quaternion-slerp! + (-> s5-1 quat) + (the-as quaternion (-> gp-1 trans)) + (the-as quaternion (-> gp-1 vector 2)) + f30-0 + ) + ) + (transform-post) + (if (>= f30-0 0.15) + (goto cfg-5) + ) + ) + (suspend) + ) + #f + (label cfg-5) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let* ((f1-9 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (s5-2 (-> self root-override)) + (f30-1 (fmax 0.0 (- 0.15 f1-9))) + ) + (set! (-> s5-2 transv quad) (-> s5-2 trans quad)) + (vector-lerp! (-> s5-2 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-1) + (set! (-> s5-2 trans y) (+ -8192.0 (* 11585.237 (sin (lerp 8192.0 24576.0 f30-1))) (-> s5-2 trans y))) + (quaternion-slerp! + (-> s5-2 quat) + (the-as quaternion (-> gp-1 trans)) + (the-as quaternion (-> gp-1 vector 2)) + f30-1 + ) + (transform-post) + (if (= f30-1 0.0) + (go-virtual active) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + +(defstate sink-partially (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (sound-play "und-block-lock") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-1 vector 1 quad) (-> gp-1 vector 0 quad)) + (set! (-> gp-1 vector 1 y) (+ -1228.8 (-> gp-1 vector 1 y))) + (until (>= 40.96 (fabs (- (-> gp-1 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-1 vector 1) + (* 8192.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (transform-post) + (suspend) + ) + ) + (go-virtual sunk-partially) + (none) + ) + ) + +(defstate sunk-partially (under-block) + :virtual #t + :event under-block-event-handler + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +(defstate victory (under-block) + :virtual #t + :event under-block-event-handler + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (sound-play "und-block-sink") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-1 vector 1 quad) (-> gp-1 vector 0 quad)) + (set! (-> gp-1 vector 1 y) (-> self puzzle origin y)) + (set! (-> gp-1 vector 1 y) (+ -8192.0 (-> gp-1 vector 1 y))) + (until (>= 40.96 (fabs (- (-> gp-1 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-1 vector 1) + (* 12288.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (transform-post) + (suspend) + ) + ) + (go-virtual beaten) + (none) + ) + ) + +(defstate beaten (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (under-block-method-41 self 'beaten) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +(defstate fall (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (logclear! (-> self mask) (process-mask actor-pause)) + (under-block-method-41 self 'fall) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((gp-0 (new 'stack-no-clear 'quaternion)) + (s5-0 (new 'stack-no-clear 'quaternion)) + (f30-0 0.0) + ) + (quaternion-copy! gp-0 (-> self root-override quat)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.25)) + (+! f30-0 (* 65536.0 (-> self clock seconds-per-frame))) + (quaternion-vector-angle! s5-0 (-> self rot-axis) (- f30-0)) + (quaternion*! (-> self root-override quat) s5-0 gp-0) + (suspend) + ) + ) + (go-virtual explode) + (none) + ) + :post (behavior () + (let ((gp-0 (-> self root-override))) + (set! (-> gp-0 transv y) (- (-> gp-0 transv y) (* 348160.0 (-> self clock seconds-per-frame)))) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) self) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> gp-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-0 (meters 0)) + ) + (when (and (logtest? (-> (the-as collide-shape-moving gp-0) status) (collide-status touch-surface)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) + ) + (logior! (-> self flags) 4) + (go-virtual explode) + ) + ) + (ja-post) + (none) + ) + ) + +(defstate explode (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (under-block-method-46 self (-> self col) (-> self row)) + (let ((v1-4 (-> self puzzle))) + (countdown (a0-3 (-> v1-4 slots length)) + (let ((a1-3 (-> v1-4 slots a0-3))) + (if (and (= (-> a1-3 col) (-> self col)) (= (-> a1-3 row) (-> self row))) + (logclear! (-> v1-4 slot-mask) (ash 1 a0-3)) + ) + ) + ) + ) + (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> self draw color-emissive) 0.0 0.0 0.0 1.0) + (send-event (ppointer->process (-> self my-parent)) 'explode (-> self spawner-id)) + (none) + ) + :code (behavior () + (sound-play "und-block-explo") + (under-block-method-50 self) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-7 (-> self root-override root-prim))) + (set! (-> v1-7 prim-core collide-as) (collide-spec)) + (set! (-> v1-7 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (none) + ) + ) + +(defstate die-fast (under-block) + :virtual #t + :code (the-as (function none :behavior under-block) nothing) + ) + +;; WARN: Return type mismatch collide-status vs none. +(defbehavior cshape-reaction-under-block under-block ((arg0 control-info) (arg1 collide-query) (arg2 vector)) + (if (logtest? (cshape-reaction-just-move arg0 arg1 arg2) (collide-status touch-surface)) + (set! (-> self away-from-focal-pt quad) (-> arg1 best-other-tri intersect quad)) + ) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior under-block-init-by-other under-block ((arg0 int) (arg1 int) (arg2 symbol) (arg3 (pointer process))) + (set! (-> self spawner-id) arg0) + (set! (-> self my-id) arg1) + (set! (-> self my-parent) arg3) + (let ((v1-0 arg3)) + (set! (-> self puzzle) + (the-as under-block-puzzle (-> (the-as under-block (if v1-0 + (the-as under-block (-> v1-0 0 self)) + ) + ) + focus-status + ) + ) + ) + ) + (set! (-> self event-hook) under-block-event-handler) + (let ((s4-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-under-block) + ) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) + (set! (-> s4-0 total-prims) (the-as uint 4)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec backgnd jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 13107.2) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (let ((v1-19 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-19 prim-core action) (collide-action solid rideable)) + (set! (-> v1-19 transform-index) 3) + (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 13107.2) + ) + (let ((v1-21 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-21 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-21 prim-core action) (collide-action solid rideable)) + (set! (-> v1-21 transform-index) 3) + (set-vector! (-> v1-21 local-sphere) 0.0 0.0 0.0 13107.2) + ) + (let ((v1-23 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-23 prim-core collide-with) (collide-spec backgnd)) + (set! (-> v1-23 prim-core action) (collide-action solid)) + (set! (-> v1-23 transform-index) 3) + (set-vector! (-> v1-23 local-sphere) 0.0 0.0 0.0 6553.6) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-26 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-26 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-26 prim-core collide-with)) + ) + (set! (-> self root-override) s4-0) + ) + (cond + ((= arg2 'beaten) + (let ((v1-31 (-> self puzzle slots arg0))) + (set! (-> self col) (-> v1-31 col)) + (set! (-> self row) (-> v1-31 row)) + ) + ) + (else + (let ((v1-35 (-> self puzzle spawners arg0))) + (set! (-> self col) (-> v1-35 col)) + (set! (-> self row) (-> v1-35 row)) + ) + ) + ) + (let ((s5-1 (-> self root-override))) + (set-vector! + (-> s5-1 trans) + (+ 8192.0 (* 16384.0 (the float (-> self col)))) + 8192.0 + (+ 8192.0 (* 16384.0 (the float (-> self row)))) + 1.0 + ) + (vector-matrix*! (-> s5-1 trans) (-> s5-1 trans) (-> self puzzle local-to-world)) + (case arg2 + (('waiting 'beaten) + (set! (-> s5-1 trans y) (+ -16384.0 (-> s5-1 trans y))) + ) + (('follow) + (set! (-> s5-1 trans y) (+ -32768.0 (-> s5-1 trans y))) + ) + ) + (matrix->quaternion (-> s5-1 quat) (-> self puzzle local-to-world)) + (vector-identity! (-> s5-1 scale)) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-shoot-block" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (transform-post) + (set! (-> self mask) (logior (process-mask enemy) (-> self mask))) + (set! (-> self draw light-index) (the-as uint 30)) + (cond + ((= arg2 'idle) + (under-block-method-48 self (-> self col) (-> self row)) + (go-virtual idle) + ) + ((= arg2 'beaten) + (go-virtual beaten) + ) + ((= arg2 'follow) + (go-virtual follow) + ) + (else + (go-virtual waiting) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod under-shoot-block-method-25 under-shoot-block ((obj under-shoot-block) (arg0 int) (arg1 int) (arg2 float) (arg3 int)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (set-vector! (-> gp-0 vector 0) -8192.0 0.0 -8192.0 1.0) + (set-vector! (-> gp-0 vector 1) -8192.0 0.0 8192.0 1.0) + (set-vector! (-> gp-0 vector 2) 8192.0 0.0 8192.0 1.0) + (set-vector! (-> gp-0 trans) 8192.0 0.0 -8192.0 1.0) + (vector-float*! (the-as vector (-> gp-0 vector)) (the-as vector (-> gp-0 vector)) arg2) + (vector-float*! (-> gp-0 vector 1) (-> gp-0 vector 1) arg2) + (vector-float*! (-> gp-0 vector 2) (-> gp-0 vector 2) arg2) + (vector-float*! (-> gp-0 trans) (-> gp-0 trans) arg2) + (let ((v1-12 (&+ gp-0 64))) + (set! (-> v1-12 vector 0 x) (+ 8192.0 (* 16384.0 (the float arg0)))) + (set! (-> v1-12 vector 0 y) 0.0) + (set! (-> v1-12 vector 0 z) (+ 8192.0 (* 16384.0 (the float arg1)))) + (set! (-> v1-12 vector 0 w) 1.0) + ) + (vector+! (the-as vector (-> gp-0 vector)) (the-as vector (-> gp-0 vector)) (the-as vector (&+ gp-0 64))) + (vector+! (-> gp-0 vector 1) (-> gp-0 vector 1) (the-as vector (&+ gp-0 64))) + (vector+! (-> gp-0 vector 2) (-> gp-0 vector 2) (the-as vector (&+ gp-0 64))) + (vector+! (-> gp-0 trans) (-> gp-0 trans) (the-as vector (&+ gp-0 64))) + (let ((s4-0 (-> obj puzzle local-to-world))) + (vector-matrix*! (the-as vector (-> gp-0 vector)) (the-as vector (-> gp-0 vector)) s4-0) + (vector-matrix*! (-> gp-0 vector 1) (-> gp-0 vector 1) s4-0) + (vector-matrix*! (-> gp-0 vector 2) (-> gp-0 vector 2) s4-0) + (vector-matrix*! (-> gp-0 trans) (-> gp-0 trans) s4-0) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> gp-0 vector)) + (-> gp-0 vector 1) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> gp-0 vector 1) + (-> gp-0 vector 2) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> gp-0 vector 2) + (-> gp-0 trans) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> gp-0 trans) + (the-as vector (-> gp-0 vector)) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + ) + (none) + ) + +(defmethod under-shoot-block-method-24 under-shoot-block ((obj under-shoot-block) (arg0 int) (arg1 int)) + (local-vars (v1-11 symbol) (v1-20 symbol)) + (let ((a0-1 (-> obj puzzle))) + (if (>= (-> (the-as (pointer int8) (&+ (-> a0-1 cells) (+ (* arg1 (-> a0-1 cells-wide)) arg0)))) 0) + (under-shoot-block-method-25 obj arg0 arg1 1.0 (the-as int (the-as uint #x80ffffff))) + (under-shoot-block-method-25 obj arg0 arg1 0.95 (shl #x8000 16)) + ) + ) + (let ((v1-9 (-> obj puzzle spawners))) + (countdown (a0-7 (-> v1-9 length)) + (let ((a1-5 (-> v1-9 a0-7))) + (when (and (= (-> a1-5 col) arg0) (= (-> a1-5 row) arg1)) + (set! v1-11 #t) + (goto cfg-12) + ) + ) + ) + ) + (set! v1-11 #f) + (label cfg-12) + (if v1-11 + (under-shoot-block-method-25 obj arg0 arg1 0.6 (the-as int (the-as uint #x8000ffff))) + ) + (let ((v1-18 (-> obj puzzle slots))) + (countdown (a0-9 (-> v1-18 length)) + (let ((a1-12 (-> v1-18 a0-9))) + (when (and (= (-> a1-12 col) arg0) (= (-> a1-12 row) arg1)) + (set! v1-20 #t) + (goto cfg-23) + ) + ) + ) + ) + (set! v1-20 #f) + (label cfg-23) + (if v1-20 + (under-shoot-block-method-25 obj arg0 arg1 0.6 (the-as int (the-as uint #x80ffff00))) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod under-shoot-block-method-26 under-shoot-block ((obj under-shoot-block)) + (countdown (s5-0 (-> obj puzzle cells-tall)) + (countdown (s4-0 (-> obj puzzle cells-wide)) + (under-shoot-block-method-24 obj s4-0 s5-0) + ) + ) + (none) + ) + +(defmethod under-shoot-block-method-28 under-shoot-block ((obj under-shoot-block)) + (let* ((v1-0 (-> obj puzzle)) + (v0-0 (+ (-> v1-0 last-block-id) 1)) + ) + (if (or (< 127 v0-0) (<= v0-0 0)) + (set! v0-0 1) + ) + (set! (-> v1-0 last-block-id) v0-0) + v0-0 + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod under-shoot-block-method-27 under-shoot-block ((obj under-shoot-block) (arg0 symbol)) + (local-vars + (sv-16 process) + (sv-32 (function int int symbol (pointer process) none :behavior under-block)) + (sv-48 int) + (sv-64 process) + (sv-80 (function int int symbol (pointer process) none :behavior under-block)) + (sv-96 int) + (sv-112 process) + (sv-128 (function int int symbol (pointer process) none :behavior under-block)) + (sv-144 int) + ) + (let ((s4-0 (-> obj puzzle))) + (set! (-> s4-0 prev-special-attack-id) (the-as uint 0)) + (set! (-> s4-0 slot-mask) (the-as uint 0)) + (let ((v1-0 0)) + (countdown (a0-2 (-> s4-0 slots length)) + (set! v1-0 (logior v1-0 (ash 1 a0-2))) + ) + (set! (-> s4-0 slot-mask-full) (the-as uint v1-0)) + (if arg0 + (set! (-> s4-0 slot-mask) (the-as uint v1-0)) + ) + ) + (matrix-rotate-y! (-> s4-0 local-to-world) (-> s4-0 orient-ry)) + (set! (-> s4-0 local-to-world trans quad) (-> s4-0 origin quad)) + (set! (-> s4-0 local-to-world trans w) 1.0) + (let ((v1-3 (-> s4-0 cells))) + (countdown (a0-11 (* (-> s4-0 cells-wide) (-> s4-0 cells-tall))) + (when (> (-> (the-as (pointer int8) (&+ v1-3 a0-11))) 0) + (set! (-> (the-as (pointer int8) (&+ v1-3 a0-11))) 0) + 0 + ) + ) + ) + (countdown (s3-0 (-> s4-0 spawners length)) + (let ((s2-0 (-> s4-0 spawners s3-0))) + (set! (-> s2-0 exploded-time) 0) + (cond + (arg0 + (let ((s1-0 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s2-0 active-handle) + (ppointer->handle + (when s1-0 + (let ((t9-2 (method-of-type under-block activate))) + (t9-2 (the-as under-block s1-0) obj (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s0-0 run-function-in-process)) + (set! sv-16 s1-0) + (set! sv-32 under-block-init-by-other) + (set! sv-48 s3-0) + (let ((a3-1 (under-shoot-block-method-28 obj)) + (t0-0 'beaten) + (t1-0 (process->ppointer obj)) + ) + ((the-as (function object object object object object object none) s0-0) sv-16 sv-32 sv-48 a3-1 t0-0 t1-0) + ) + ) + (-> s1-0 ppointer) + ) + ) + ) + ) + (set! (-> s2-0 waiting-handle) (the-as handle #f)) + ) + (else + (let ((s1-1 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s2-0 active-handle) + (ppointer->handle + (when s1-1 + (let ((t9-6 (method-of-type under-block activate))) + (t9-6 (the-as under-block s1-1) obj (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s0-1 run-function-in-process)) + (set! sv-64 s1-1) + (set! sv-80 under-block-init-by-other) + (set! sv-96 s3-0) + (let ((a3-3 (under-shoot-block-method-28 obj)) + (t0-1 'idle) + (t1-1 (process->ppointer obj)) + ) + ((the-as (function object object object object object object none) s0-1) sv-64 sv-80 sv-96 a3-3 t0-1 t1-1) + ) + ) + (-> s1-1 ppointer) + ) + ) + ) + ) + (let ((s1-2 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s2-0 waiting-handle) + (ppointer->handle + (when s1-2 + (let ((t9-10 (method-of-type under-block activate))) + (t9-10 (the-as under-block s1-2) obj (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s0-2 run-function-in-process)) + (set! sv-112 s1-2) + (set! sv-128 under-block-init-by-other) + (set! sv-144 s3-0) + (let ((a3-5 (under-shoot-block-method-28 obj)) + (t0-2 'waiting) + (t1-2 (process->ppointer obj)) + ) + ((the-as (function object object object object object object none) s0-2) sv-112 sv-128 sv-144 a3-5 t0-2 t1-2) + ) + ) + (-> s1-2 ppointer) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +(defbehavior under-shoot-block-event-handler under-shoot-block ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('explode) + (let ((v1-4 (-> self puzzle spawners (-> arg3 param 0)))) + (set! (-> v1-4 active-handle) (the-as handle #f)) + (set! v0-0 (-> self clock frame-counter)) + (set! (-> v1-4 exploded-time) (the-as time-frame v0-0)) + ) + v0-0 + ) + (('query) + (case (-> arg3 param 0) + (('beaten) + (and (-> self next-state) (let ((v1-8 (-> self next-state name))) + (or (= v1-8 'victory-locked) (= v1-8 'victory) (= v1-8 'beaten)) + ) + ) + ) + ) + ) + (('unlock) + (set! v0-0 #t) + (set! (-> self allow-unlock?) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + +(defstate idle (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :trans (behavior () + (local-vars (sv-96 int)) + (let ((gp-0 (-> self puzzle))) + (if (= (-> gp-0 slot-mask) (-> gp-0 slot-mask-full)) + (go-virtual victory-locked) + ) + (let ((gp-1 (-> gp-0 spawners))) + (countdown (s5-0 (-> gp-1 length)) + (let ((s4-0 (-> gp-1 s5-0))) + (when (and (not (handle->process (-> s4-0 active-handle))) + (>= (- (-> self clock frame-counter) (-> s4-0 exploded-time)) (seconds 1)) + ) + (set! (-> s4-0 active-handle) (-> s4-0 waiting-handle)) + (let ((s3-0 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s4-0 waiting-handle) + (ppointer->handle + (when s3-0 + (let ((t9-2 (method-of-type under-block activate))) + (t9-2 (the-as under-block s3-0) self (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s2-0 run-function-in-process) + (s1-0 s3-0) + (s0-0 under-block-init-by-other) + ) + (set! sv-96 s5-0) + (let ((a3-1 (under-shoot-block-method-28 self)) + (t0-0 'follow) + (t1-0 (process->ppointer self)) + ) + ((the-as (function object object object object object object none) s2-0) s1-0 s0-0 sv-96 a3-1 t0-0 t1-0) + ) + ) + (-> s3-0 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> s4-0 active-handle)) 'rise-up) + ) + ) + ) + ) + ) + 0 + (none) + ) + :code (the-as (function none :behavior under-shoot-block) sleep-code) + ) + +(defstate victory-locked (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :trans (behavior () + (local-vars (v1-9 symbol)) + (let ((gp-0 (-> self puzzle spawners))) + (countdown (s5-0 (-> gp-0 length)) + (let ((v1-3 (-> gp-0 s5-0))) + (when (not (send-event (handle->process (-> v1-3 active-handle)) 'sunk-partially)) + (set! v1-9 #f) + (goto cfg-13) + ) + ) + ) + ) + (set! v1-9 #t) + (label cfg-13) + (when v1-9 + (if (-> self allow-unlock?) + (go-virtual victory) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-shoot-block) sleep-code) + ) + +(defstate victory (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :code (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (sound-play "und-block-chime") + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (suspend) + ) + (let ((gp-1 (-> self puzzle spawners))) + (countdown (s5-1 (-> gp-1 length)) + (let ((v1-10 (-> gp-1 s5-1))) + (send-event (handle->process (-> v1-10 active-handle)) 'victory) + ) + ) + ) + (let ((v1-17 (-> self actor-group))) + (when v1-17 + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'trigger) + (let ((t9-4 send-event-function) + (v1-19 (-> v1-17 0 data 1 actor)) + ) + (t9-4 + (if v1-19 + (-> v1-19 extra process) + ) + a1-3 + ) + ) + ) + ) + ) + (go-virtual beaten) + (none) + ) + ) + +(defstate beaten (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :code (the-as (function none :behavior under-shoot-block) sleep-code) + ) + +(defmethod deactivate under-shoot-block ((obj under-shoot-block)) + (let ((s5-0 (-> obj puzzle spawners))) + (countdown (s4-0 (-> s5-0 length)) + (let ((s3-0 (-> s5-0 s4-0))) + (send-event (handle->process (-> s3-0 active-handle)) 'die-fast) + (send-event (handle->process (-> s3-0 waiting-handle)) 'die-fast) + ) + ) + ) + ((the-as (function process-drawable none) (find-parent-method under-shoot-block 10)) obj) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-shoot-block ((obj under-shoot-block) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (let ((s5-1 (res-lump-value (-> obj entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) + (if (or (< (the-as int s5-1) 0) (>= (the-as int s5-1) (-> *under-block-puzzles* length))) + (go process-drawable-art-error "bad puzzle id") + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((a0-7 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (if (and a0-7 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) a0-7)) + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + ) + ) + (let ((v1-13 (-> *under-block-puzzles* s5-1))) + (set! (-> obj puzzle) v1-13) + (set! (-> obj allow-unlock?) (-> v1-13 auto-unlock?)) + ) + ) + (let ((s5-2 + (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + ) + ) + (under-shoot-block-method-27 obj (the-as symbol s5-2)) + (if s5-2 + (go (method-of-object obj beaten)) + (go (method-of-object obj idle)) + ) + ) + (none) + ) diff --git a/goal_src/jak2/levels/underport/under-sig-obs.gc b/goal_src/jak2/levels/underport/under-sig-obs.gc index 46dcacef98..cbcdc3a0b9 100644 --- a/goal_src/jak2/levels/underport/under-sig-obs.gc +++ b/goal_src/jak2/levels/underport/under-sig-obs.gc @@ -7,3 +7,1520 @@ ;; DECOMP BEGINS +(deftype under-plat-shoot (plat) + ((draw-test-script script-context :offset-assert 324) + (incoming-attack-id uint32 :offset-assert 328) + (angle-flip float :offset-assert 332) + (angle-flip-vel float :offset-assert 336) + (state-flip uint32 :offset-assert 340) + (time-flip uint32 :offset-assert 344) + (disable-track-under basic :offset-assert 348) + (dest-angle float :offset-assert 352) + (on-shake basic :offset-assert 356) + (hint-count float :offset-assert 360) + (hit-time time-frame :offset-assert 368) + (knocked-sound-time time-frame :offset-assert 376) + (axe-flip vector :inline :offset-assert 384) + ) + :heap-base #x110 + :method-count-assert 39 + :size-assert #x190 + :flag-assert #x2701100190 + (:methods + (die-falling () _type_ :state 37) + (dormant () _type_ :state 38) + ) + ) + + +(defskelgroup skel-under-plat-shoot under-plat-shoot under-plat-shoot-lod0-jg under-plat-shoot-idle-ja + ((under-plat-shoot-lod0-mg (meters 20)) (under-plat-shoot-lod1-mg (meters 999999))) + :bounds (static-spherem 0 0 0 5.1) + ) + +(defmethod get-art-group under-plat-shoot ((obj under-plat-shoot)) + "@returns The associated [[art-group]]" + (art-group-get-by-name *level* "skel-under-plat-shoot" (the-as (pointer uint32) #f)) + ) + +(defbehavior cshape-reaction-under-plat-shoot under-plat-shoot ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (let ((gp-0 (cshape-reaction-default arg0 arg1 arg2 arg3))) + (when (logtest? gp-0 (collide-status touch-surface)) + (let ((s5-0 self)) + (when (>= (- (-> self clock frame-counter) (-> s5-0 hit-time)) (seconds 0.25)) + (sound-play "shoot-plat-fall") + (set! (-> s5-0 hit-time) (-> self clock frame-counter)) + ) + ) + ) + gp-0 + ) + ) + +(defmethod init-plat-collision! under-plat-shoot ((obj under-plat-shoot)) + "TODO - collision stuff for setting up the platform" + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-under-plat-shoot) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot obstacle hit-by-others-list player-list pusher) + ) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 -4915.2 0.0 17203.2) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (let ((v1-16 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-16 prim-core collide-as) (collide-spec pusher)) + (set! (-> v1-16 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-16 prim-core action) (collide-action solid rideable)) + (set! (-> v1-16 transform-index) 0) + (set-vector! (-> v1-16 local-sphere) 0.0 -4915.2 0.0 17203.2) + ) + (let ((v1-18 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-18 prim-core collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-18 prim-core action) (collide-action solid)) + (set! (-> v1-18 transform-index) 0) + (set-vector! (-> v1-18 local-sphere) 0.0 -4915.2 0.0 13516.8) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-21 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-21 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-21 prim-core collide-with)) + ) + (set! (-> s5-0 rider-max-momentum) 0.0) + (set! (-> s5-0 max-iteration-count) (the-as uint 5)) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +(defmethod base-plat-method-32 under-plat-shoot ((obj under-plat-shoot)) + 0 + (none) + ) + +(defmethod init-plat! under-plat-shoot ((obj under-plat-shoot)) + "Does any necessary initial platform setup. +For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask))) + (set-vector! (-> obj axe-flip) 1.0 0.0 0.0 1.0) + (set! (-> obj angle-flip) 180.0) + (set! (-> obj time-flip) (the-as uint 570)) + (set! (-> obj draw-test-script) (res-lump-struct (-> obj entity) 'on-activate script-context)) + (set! (-> obj disable-track-under) #f) + (if (>= (res-lump-value (-> obj entity) 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) + (set! (-> obj disable-track-under) (the-as basic #t)) + ) + (set! (-> obj hint-count) 0.0) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "shoot-plat-lp" :fo-max 70) (-> obj root-override trans)) + ) + 0 + (none) + ) + +(defstate dormant (under-plat-shoot) + :virtual #t + :enter (behavior () + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-4 (-> self root-override root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) + ) + 0 + (none) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-3 (-> self root-override root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root-override backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> self root-override backup-collide-with)) + ) + (none) + ) + :trans (behavior () + (when (not (eval! + (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) + (the-as pair (-> self draw-test-script)) + ) + ) + enter-state + #t + (go-virtual plat-path-active) + ) + (none) + ) + :code (the-as (function none :behavior under-plat-shoot) sleep-code) + ) + +(defstate plat-path-active (under-plat-shoot) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as + object + (case event-type + (('bonk) + (the-as object (start-bouncing! self)) + ) + (('attack) + (when (zero? (-> self state-flip)) + (let ((s5-0 (the-as object (-> event param 1)))) + (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> (the-as attack-info s5-0) id)) + (let* ((gp-0 proc) + (s4-0 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when s4-0 + (let* ((s3-0 (-> (the-as process-drawable s4-0) root)) + (gp-1 (if (type? (the-as collide-shape s3-0) collide-shape) + s3-0 + ) + ) + ) + (when gp-1 + (when (logtest? (-> (the-as collide-shape gp-1) root-prim prim-core collide-as) (collide-spec projectile)) + (when (zero? (-> self state-flip)) + (sound-play "mtn-plat-flip1") + (set! (-> self state-flip) (the-as uint 1)) + ) + (if (= (-> (find-offending-process-focusable s4-0 (the-as attack-info s5-0)) type) target) + (set! (-> self time-flip) (the-as uint 1140)) + (set! (-> self time-flip) (the-as uint 570)) + ) + (set! (-> self hint-count) -1.0) + (vector-! (-> self axe-flip) (-> gp-1 trans) (-> self root-override trans)) + (set! (-> self axe-flip y) 0.0) + (vector-normalize! (-> self axe-flip) 1.0) + (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) + (set! (-> self angle-flip-vel) -10.0) + (set! (-> self state-time) (-> self clock frame-counter)) + ) + ) + ) + ) + ) + #f + ) + ) + ) + ) + (('hint) + (when (>= (-> self hint-count) 0.0) + (+! (-> self hint-count) (-> self clock seconds-per-frame)) + (if (< 6.0 (-> self hint-count)) + #f + ) + ) + ) + (('track) + (cond + ((-> event param 0) + (if (zero? (-> self state-flip)) + #t + 'abort + ) + ) + ((and *target* + (-> self disable-track-under) + (< (-> *target* control trans y) (+ -20480.0 (-> self root-override trans y))) + ) + #f + ) + (else + (zero? (-> self state-flip)) + ) + ) + ) + (('centipede) + (when (not (and (-> self next-state) (let ((v1-39 (-> self next-state name))) + (or (= v1-39 'die-falling) (= v1-39 'empty-state)) + ) + ) + ) + (vector-reset! (-> self root-override transv)) + (let* ((gp-2 proc) + (a0-11 (if (type? (the-as process-focusable gp-2) process-focusable) + gp-2 + ) + ) + ) + (when a0-11 + (vector-! + (-> self root-override transv) + (-> self root-override trans) + (get-trans (the-as process-focusable a0-11) 0) + ) + (set! (-> self root-override transv y) 0.0) + (vector-normalize! (-> self root-override transv) 163840.0) + (set! (-> self root-override transv y) 20480.0) + ) + ) + (go-virtual die-falling) + ) + ) + ) + ) + ) + :enter (behavior () + (let ((t9-0 (-> (method-of-type plat plat-path-active) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self dest-angle) 180.0) + (set! (-> self on-shake) #f) + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self time-flip))) + (set! (-> self state-flip) (the-as uint 0)) + 0 + ) + (cond + ((zero? (-> self state-flip)) + (set! (-> self on-shake) #f) + (when (!= (-> self dest-angle) 180.0) + (sound-play "mtn-plat-flip2") + (set! (-> self dest-angle) 180.0) + ) + ) + (else + (if (!= (-> self dest-angle) 0.0) + (set! (-> self dest-angle) 0.0) + ) + ) + ) + (+! (-> self angle-flip-vel) + (* -0.5 (-> self clock seconds-per-frame) (- (-> self angle-flip) (-> self dest-angle))) + ) + (+! (-> self angle-flip-vel) (* -6.0 (-> self clock seconds-per-frame) (-> self angle-flip-vel))) + (+! (-> self angle-flip) (-> self angle-flip-vel)) + (if (!= *bot-record-path* -1) + (set! (-> self angle-flip) 0.0) + ) + (quaternion-vector-angle! (-> self root-override quat) (-> self axe-flip) (* 182.04445 (-> self angle-flip))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (+ (-> self time-flip) -300))) + (= 1 (-> self state-flip)) + ) + (when (not (-> self on-shake)) + (sound-play "mtn-plat-shake") + (set! (-> self on-shake) (the-as basic #t)) + ) + (let ((s5-2 (new 'stack-no-clear 'vector)) + (gp-2 (new 'stack-no-clear 'quaternion)) + ) + (set-vector! + s5-2 + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + 1.0 + ) + (vector-normalize! s5-2 1.0) + (quaternion-vector-angle! gp-2 s5-2 910.2222) + (quaternion-pseudo-seek + (-> self root-override quat) + (-> self root-override quat) + gp-2 + (-> self clock seconds-per-frame) + ) + ) + ) + (quaternion-normalize! (-> self root-override quat)) + (let ((t9-12 (-> (method-of-type plat plat-path-active) trans))) + (if t9-12 + (t9-12) + ) + ) + (none) + ) + :post (behavior () + (let ((t9-0 (-> (method-of-type plat plat-path-active) post))) + (if t9-0 + ((the-as (function none) t9-0)) + ) + ) + (none) + ) + ) + +(defstate die-falling (under-plat-shoot) + :virtual #t + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (logclear! (-> self mask) (process-mask actor-pause enemy platform)) + (let ((v1-7 (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) child 0))) + (set! (-> v1-7 prim-core collide-as) (collide-spec)) + (set! (-> v1-7 prim-core collide-with) (collide-spec)) + ) + 0 + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (let ((f30-0 (* 0.0016666667 (the float (+ (- (seconds -1) (-> self state-time)) (-> self clock frame-counter)))))) + (when (>= f30-0 1.0) + (cleanup-for-death self) + (go empty-state) + ) + (let ((f0-3 (- 1.0 f30-0))) + (set-vector! (-> self root-override scale) f0-3 f0-3 f0-3 1.0) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((f30-0 (rand-vu-float-range 0.5 0.8))) + (sound-play-by-name + (static-sound-name "und-floor-break") + (new-sound-id) + 716 + (the int (* 1524.0 f30-0)) + 0 + (sound-group sfx) + #t + ) + ) + (set! (-> self hit-time) (-> self clock frame-counter)) + (let ((gp-1 (new 'stack-no-clear 'quaternion)) + (s5-1 (new 'stack-no-clear 'quaternion)) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-1 0.0) + ) + (vector-normalize-copy! s4-0 (-> self root-override transv) 1.0) + (vector-rotate90-around-y! s4-0 s4-0) + (quaternion-copy! gp-1 (-> self root-override quat)) + (until #f + (+! f30-1 (* 65536.0 (-> self clock seconds-per-frame))) + (quaternion-vector-angle! s5-1 s4-0 (- f30-1)) + (quaternion*! (-> self root-override quat) s5-1 gp-1) + (suspend) + ) + ) + #f + (none) + ) + :post (behavior () + (let ((v1-0 (-> self root-override))) + (set! (-> v1-0 transv y) (- (-> v1-0 transv y) (* 512000.0 (-> self clock seconds-per-frame)))) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) self) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-0 (-> v1-0 transv) a2-0 (meters 0)) + ) + ) + (ja-post) + (none) + ) + ) + +(defmethod plat-path-sync under-plat-shoot ((obj under-plat-shoot)) + "If the `sync` period is greater than `0` then transition the state to [[plat::35]] +otherwise, [[plat::34]] + +@see [[sync-eased]]" + (with-pp + (cond + ((and (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair (-> obj draw-test-script)) + ) + (= *bot-record-path* -1) + ) + (go (method-of-object obj dormant)) + ) + (else + enter-state + #t + (go (method-of-object obj plat-path-active)) + ) + ) + ) + ) + +(deftype under-break-floor (process-drawable) + ((root-override collide-shape-moving :offset 128) + ) + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc8 + :flag-assert #x17005000c8 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (die-fast () _type_ :state 22) + ) + ) + + +(defskelgroup skel-under-break-floor under-break-floor under-break-floor-lod0-jg under-break-floor-idle-ja + ((under-break-floor-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 7.25) + ) + +(defskelgroup skel-under-break-floor-explode under-break-floor under-break-floor-explode-lod0-jg under-break-floor-explode-idle-ja + ((under-break-floor-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 15) + ) + +(define *under-break-floor-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index -1) + ) + :collide-spec #x1 + ) + ) + +(defstate idle (under-break-floor) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as + object + (case event-type + (('attack) + (when (logtest? (-> (the-as attack-info (-> event param 1)) penetrate-using) (penetrate flop)) + (go-virtual die) + #f + ) + ) + ) + ) + ) + :code (the-as (function none :behavior under-break-floor) sleep-code) + ) + +(defstate die (under-break-floor) + :virtual #t + :enter (behavior () + (let ((v1-1 (-> self root-override root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (none) + ) + :code (behavior () + ((lambda () + (with-pp + (sound-play "und-floor-break") + (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (set! (-> gp-1 duration) (seconds 0.6)) + (set-vector! (-> gp-1 fountain-rand-transv-lo) -98304.0 24576.0 -98304.0 1.0) + (set-vector! (-> gp-1 fountain-rand-transv-hi) 98304.0 114688.0 98304.0 1.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-under-break-floor-explode" (the-as (pointer uint32) #f)) + 5 + gp-1 + *under-break-floor-exploder-params* + :to pp + ) + ) + ) + ) + ) + (suspend) + (ja-channel-set! 0) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event self 'death-end) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + (none) + ) + :post (the-as (function none :behavior under-break-floor) ja-post) + ) + +(defstate die-fast (under-break-floor) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-floor ((obj under-break-floor) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) + (set! (-> s4-0 total-prims) (the-as uint 3)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid)) + (set! (-> s3-0 transform-index) 0) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 20480.0) + (set! (-> s4-0 root-prim) s3-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 0) + (set-vector! (-> v1-8 local-sphere) 0.0 0.0 0.0 20480.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 0) + (set-vector! (-> v1-10 local-sphere) 0.0 0.0 0.0 20480.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-13 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (set! (-> obj root-override penetrated-by) (penetrate flop)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-break-floor" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj draw light-index) (the-as uint 3)) + (let ((a0-20 (-> obj skel root-channel 0))) + (set! (-> a0-20 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-20 frame-num) 0.0) + (joint-control-channel-group! a0-20 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (go (method-of-object obj die-fast)) + (go (method-of-object obj idle)) + ) + (none) + ) + +(deftype under-break-wall (process-drawable) + () + :heap-base #x50 + :method-count-assert 22 + :size-assert #xc8 + :flag-assert #x16005000c8 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + ) + ) + + +(defskelgroup skel-under-break-wall1 under-break-wall under-break-wall-lod0-jg under-break-wall-idle-ja + ((under-break-wall-lod0-mg (meters 999999))) + :bounds (static-spherem 8.5 1.8 -1.3 10) + ) + +(defskelgroup skel-under-break-wall2 under-break-wall-b under-break-wall-b-lod0-jg under-break-wall-b-idle-ja + ((under-break-wall-b-lod0-mg (meters 999999))) + :bounds (static-spherem 8.5 1.8 -1.3 10) + ) + +(defstate idle (under-break-wall) + :virtual #t + :code (the-as (function none :behavior under-break-wall) sleep-code) + ) + +(defstate die (under-break-wall) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-wall ((obj under-break-wall) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (with-pp + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 4) + (set-vector! (-> v1-2 local-sphere) 5324.8 -18432.0 -8192.0 32768.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-2) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-5 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (if (= (res-lump-value (-> obj entity) 'extra-id uint :time -1000000000.0) 2) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-break-wall2" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-break-wall1" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (let ((s4-4 (-> obj root))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-15 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-15 + (+! (-> obj root trans x) (-> v1-15 0)) + (+! (-> obj root trans y) (-> v1-15 1)) + (+! (-> obj root trans z) (-> v1-15 2)) + ) + ) + (let ((f0-12 (res-lump-float arg0 'rotoffset))) + (if (!= f0-12 0.0) + (quaternion-rotate-y! (-> s4-4 quat) (-> s4-4 quat) f0-12) + ) + ) + ) + (transform-post) + (if (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (res-lump-struct (-> obj entity) 'on-activate pair) + ) + (go (method-of-object obj die)) + (go (method-of-object obj idle)) + ) + (none) + ) + ) + +(deftype under-break-bridge (process-drawable) + ((root-override collide-shape-moving :offset 128) + (bridge-id int8 :offset-assert 200) + ) + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc9 + :flag-assert #x17005000c9 + (:methods + (idle () _type_ :state 20) + (broken () _type_ :state 21) + (die () _type_ :state 22) + ) + ) + + +(defskelgroup skel-under-bridge1 under-break-bridge under-break-bridge-lod0-jg under-break-bridge-idle-ja + ((under-break-bridge-lod0-mg (meters 999999))) + :bounds (static-spherem 3 0 -6.5 14) + :origin-joint-index 3 + ) + +(defskelgroup skel-under-bridge2 under-break-bridge-b under-break-bridge-b-lod0-jg under-break-bridge-b-idle-ja + ((under-break-bridge-b-lod0-mg (meters 999999))) + :bounds (static-spherem 3 0 -6.5 14) + :origin-joint-index 3 + ) + +(defstate idle (under-break-bridge) + :virtual #t + :code (the-as (function none :behavior under-break-bridge) sleep-code) + ) + +(defstate broken (under-break-bridge) + :virtual #t + :code (behavior () + (set! (-> self draw origin-joint-index) (the-as uint 54)) + (let* ((v1-2 (-> self root-override root-prim)) + (a1-0 (-> (the-as collide-shape-prim-group v1-2) child 0)) + (a0-3 (-> (the-as collide-shape-prim-group v1-2) child 1)) + ) + (set! (-> a1-0 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 transform-index) (-> a0-3 transform-index)) + (set! (-> v1-2 local-sphere quad) (-> a0-3 local-sphere quad)) + (set! (-> self draw bounds quad) (-> a0-3 local-sphere quad)) + (set! (-> a0-3 prim-core collide-as) (-> v1-2 prim-core collide-as)) + ) + (ja-channel-push! 1 0) + (ja :group! (-> self draw art-group data 3) :num! min) + (transform-post) + (sleep-code) + (none) + ) + ) + +(defstate die (under-break-bridge) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-bridge ((obj under-break-bridge) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (with-pp + (set! (-> obj bridge-id) (res-lump-value (-> obj entity) 'extra-id int :time -1000000000.0)) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) + (set! (-> s4-0 total-prims) (the-as uint 3)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s3-0 prim-core action) (collide-action solid)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 12288.0 0.0 -26624.0 57344.0) + (set! (-> s4-0 root-prim) s3-0) + ) + (let ((v1-9 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-9 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-9 prim-core action) (collide-action solid)) + (set! (-> v1-9 transform-index) 3) + (set-vector! (-> v1-9 local-sphere) 12288.0 0.0 -26624.0 57344.0) + ) + (let ((v1-11 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-11 prim-core action) (collide-action solid)) + (set! (-> v1-11 transform-index) 54) + (set-vector! (-> v1-11 local-sphere) 0.0 0.0 49152.0 61440.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-14 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (process-drawable-from-entity! obj arg0) + (if (= (res-lump-value (-> obj entity) 'extra-id uint :time -1000000000.0) 1) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-bridge2" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-bridge1" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (let ((s4-4 (-> obj root-override))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-24 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-24 + (+! (-> obj root-override trans x) (-> v1-24 0)) + (+! (-> obj root-override trans y) (-> v1-24 1)) + (+! (-> obj root-override trans z) (-> v1-24 2)) + ) + ) + (let ((f0-20 (res-lump-float arg0 'rotoffset))) + (if (!= f0-20 0.0) + (quaternion-rotate-y! (-> s4-4 quat) (-> s4-4 quat) f0-20) + ) + ) + ) + (transform-post) + (cond + ((eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (res-lump-struct (-> obj entity) 'on-activate pair) + ) + (if (= (-> obj bridge-id) 1) + (go (method-of-object obj broken)) + (go (method-of-object obj die)) + ) + ) + (else + (go (method-of-object obj idle)) + ) + ) + (none) + ) + ) + +(deftype under-int-door (process-drawable) + () + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc8 + :flag-assert #x17005000c8 + (:methods + (idle-closed () _type_ :state 20) + (open () _type_ :state 21) + (idle-open () _type_ :state 22) + ) + ) + + +(defskelgroup skel-under-int-door under-int-door under-int-door-lod0-jg -1 + ((under-int-door-lod0-mg (meters 999999))) + :bounds (static-spherem 0 6 0 15) + ) + +(defstate idle-closed (under-int-door) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('trigger) + (go-virtual open) + ) + ) + ) + :code (the-as (function none :behavior under-int-door) sleep-code) + ) + +(defstate open (under-int-door) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (sound-play "und-block-door") + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-no-eval :group! (-> self draw art-group data 2) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1)) 0.13) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.13)) + ) + (logclear! (-> self skel status) (joint-control-status sync-math)) + (go-virtual idle-open) + (none) + ) + :post (the-as (function none :behavior under-int-door) transform-post) + ) + +(defstate idle-open (under-int-door) + :virtual #t + :code (the-as (function none :behavior under-int-door) sleep-code) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-int-door ((obj under-int-door) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (with-pp + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) + (set! (-> s4-0 total-prims) (the-as uint 3)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s3-0 prim-core action) (collide-action solid)) + (set-vector! (-> s3-0 local-sphere) 0.0 24576.0 0.0 57344.0) + (set! (-> s4-0 root-prim) s3-0) + ) + (let ((v1-7 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-7 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set! (-> v1-7 transform-index) 3) + (set-vector! (-> v1-7 local-sphere) 8192.0 24576.0 0.0 28672.0) + ) + (let ((v1-9 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-9 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-9 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-9 prim-core action) (collide-action solid)) + (set! (-> v1-9 transform-index) 4) + (set-vector! (-> v1-9 local-sphere) -8192.0 24576.0 0.0 28672.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-12 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-12 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-12 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-int-door" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-18 (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (when (and v1-18 (nonzero? (-> sv-16 elt-count))) + (let ((a0-25 (-> v1-18 0 data 0 actor))) + (if (and a0-25 (logtest? (-> a0-25 extra perm status) (entity-perm-status subtask-complete))) + (process-entity-status! obj (entity-perm-status subtask-complete) #t) + ) + ) + ) + ) + (ja-channel-push! 1 0) + (let ((s5-2 #t)) + (cond + ((eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (res-lump-struct (-> obj entity) 'on-activate pair) + ) + (set! s5-2 #f) + ) + ((not (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete)))) + (set! s5-2 #f) + ) + ) + (cond + (s5-2 + (let ((a0-40 (-> obj skel root-channel 0))) + (set! (-> a0-40 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-40 param 0) 1.0) + (set! (-> a0-40 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 2)) frames num-frames) -1)) + ) + (joint-control-channel-group! a0-40 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-loop!) + ) + ) + (else + (let ((a0-41 (-> obj skel root-channel 0))) + (set! (-> a0-41 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-41 param 0) 1.0) + (set! (-> a0-41 frame-num) 0.0) + (joint-control-channel-group! a0-41 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-loop!) + ) + ) + ) + (transform-post) + (if s5-2 + (go (method-of-object obj idle-open)) + (go (method-of-object obj idle-closed)) + ) + ) + (none) + ) + ) + +(deftype under-plat-long (base-plat) + ((sync sync-eased :inline :offset-assert 272) + (move-start vector :inline :offset-assert 320) + (move-end vector :inline :offset-assert 336) + ) + :heap-base #xe0 + :method-count-assert 35 + :size-assert #x160 + :flag-assert #x2300e00160 + (:methods + (idle () _type_ :state 34) + ) + ) + + +(defskelgroup skel-under-plat-long under-plat-long under-plat-long-lod0-jg under-plat-long-idle-ja + ((under-plat-long-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 11.5) + :origin-joint-index 3 + ) + +(defstate idle (under-plat-long) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior under-plat-long) plat-event) + :trans (behavior () + (plat-trans) + (vector-lerp! + (-> self root-override trans) + (-> self move-start) + (-> self move-end) + (get-norm! (-> self sync) 0) + ) + (none) + ) + :code (the-as (function none :behavior under-plat-long) sleep-code) + :post (the-as (function none :behavior under-plat-long) plat-post) + ) + +(defmethod init-plat-collision! under-plat-long ((obj under-plat-long)) + "TODO - collision stuff for setting up the platform" + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (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) (collide-spec pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 47104.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-14 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-plat-long ((obj under-plat-long) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (init-plat-collision! obj) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-plat-long" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (stop-bouncing! obj) + (let ((s5-1 (-> obj root-override))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-8 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-8 + (+! (-> s5-1 trans x) (-> v1-8 0)) + (+! (-> s5-1 trans y) (-> v1-8 1)) + (+! (-> s5-1 trans z) (-> v1-8 2)) + ) + ) + (let ((f0-6 (res-lump-float arg0 'rotoffset))) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> s5-1 quat) (-> s5-1 quat) f0-6) + ) + ) + (set! (-> obj move-start quad) (-> s5-1 trans quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! s3-1 (-> s5-1 quat)) + (vector-rotate90-around-y! s3-1 s3-1) + (let ((f0-7 (res-lump-float arg0 'distance :default 65536.0))) + (vector+float*! (-> obj move-end) (-> obj move-start) s3-1 f0-7) + ) + ) + (let ((a1-10 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-16 0)) + (if #t + (set! v1-16 (logior v1-16 1)) + ) + (set! (-> a1-10 sync-type) 'sync-eased) + (set! (-> a1-10 sync-flags) (the-as sync-flags v1-16)) + ) + (set! (-> a1-10 period) (the-as uint 1800)) + (set! (-> a1-10 entity) arg0) + (set! (-> a1-10 percent) 0.0) + (set! (-> a1-10 ease-in) 0.15) + (set! (-> a1-10 ease-out) 0.15) + (set! (-> a1-10 pause-in) 0.0) + (set! (-> a1-10 pause-out) 0.0) + (initialize! (-> obj sync) a1-10) + ) + (vector-lerp! (-> s5-1 trans) (-> obj move-start) (-> obj move-end) (get-norm! (-> obj sync) 0)) + ) + (transform-post) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "und-float-plat" :fo-max 50) (-> obj root-override trans)) + ) + (base-plat-method-32 obj) + (set! (-> obj fact) + (new 'process 'fact-info obj (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (go (method-of-object obj idle)) + (none) + ) + +(deftype under-plat-wall (process-drawable) + ((root-override collide-shape-moving :offset 128) + (extended-amount float :offset-assert 200) + (in-trans vector :inline :offset-assert 208) + (out-trans vector :inline :offset-assert 224) + (sync sync-paused :inline :offset-assert 240) + ) + :heap-base #x90 + :method-count-assert 21 + :size-assert #x108 + :flag-assert #x1500900108 + (:methods + (active () _type_ :state 20) + ) + ) + + +(defskelgroup skel-under-plat-wall under-plat-wall under-plat-wall-lod0-jg -1 + ((under-plat-wall-lod0-mg (meters 999999))) + :bounds (static-spherem 0 -2 6 8) + ) + +(defstate active (under-plat-wall) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) + ) + :enter (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (none) + ) + :exit (behavior () + (logior! (-> self mask) (process-mask actor-pause)) + (none) + ) + :trans (the-as (function none :behavior under-plat-wall) rider-trans) + :code (behavior () + (let ((gp-0 #t)) + (until #f + (let ((f30-0 (get-norm! (-> self sync) 0))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-lerp! s5-0 (-> self in-trans) (-> self out-trans) f30-0) + (move-to-point! (-> self root-override) s5-0) + ) + (cond + ((= f30-0 0.0) + (set! gp-0 #f) + ) + ((= f30-0 1.0) + (set! gp-0 #f) + ) + (else + (when (not gp-0) + (sound-play "und-wall-plat") + (set! gp-0 #t) + ) + ) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-plat-wall) rider-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-plat-wall ((obj under-plat-wall) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj extended-amount) 0.0) + (set! (-> obj mask) (logior (process-mask platform) (-> obj mask))) + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (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-spec pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable pull-rider-can-collide)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 -8192.0 24576.0 32768.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-16 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-16 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + ) + (set! (-> s4-0 rider-max-momentum) 0.0) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-plat-wall" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (logior! (-> obj skel status) (joint-control-status sync-math)) + (let ((a1-6 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-24 0)) + (if #t + (set! v1-24 (logior v1-24 1)) + ) + (set! (-> a1-6 sync-type) 'sync-paused) + (set! (-> a1-6 sync-flags) (the-as sync-flags v1-24)) + ) + (set! (-> a1-6 entity) (-> obj entity)) + (set! (-> a1-6 period) (the-as uint 1500)) + (set! (-> a1-6 percent) 0.0) + (set! (-> a1-6 pause-in) 0.2) + (set! (-> a1-6 pause-out) 0.2) + (initialize! (-> obj sync) a1-6) + ) + (let ((f30-0 (quaternion-y-angle (-> obj root-override quat))) + (s4-2 (new 'stack-no-clear 'vector)) + ) + (set-vector! s4-2 0.0 0.0 (res-lump-float arg0 'tunemeters) 1.0) + (vector-rotate-around-y! s4-2 s4-2 f30-0) + (vector+! (-> obj out-trans) (-> obj root-override trans) s4-2) + (set-vector! s4-2 0.0 0.0 -32768.0 1.0) + (vector-rotate-around-y! s4-2 s4-2 f30-0) + (vector+! (-> obj in-trans) (-> obj out-trans) s4-2) + ) + (ja-channel-push! 1 0) + (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) + ) + (transform-post) + (logclear! (-> obj mask) (process-mask actor-pause)) + (go (method-of-object obj active)) + (none) + ) + +(deftype under-pipe-growls (process-drawable) + ((volume float :offset-assert 200) + (desired-volume float :offset-assert 204) + (volume-seek-speed float :offset-assert 208) + (approach-sound-id sound-id :offset-assert 212) + (approach-play-time time-frame :offset-assert 216) + ) + :heap-base #x60 + :method-count-assert 23 + :size-assert #xe0 + :flag-assert #x17006000e0 + (:methods + (block-puzzle () _type_ :state 20) + (block-puzzle-fade () _type_ :state 21) + (intro-shooting () _type_ :state 22) + ) + ) + + +(defbehavior under-pipe-growls-post under-pipe-growls () + (when (and (zero? (-> self approach-sound-id)) (>= (-> self clock frame-counter) (-> self approach-play-time))) + (let ((gp-0 (-> self root trans))) + (set! (-> self approach-sound-id) (if (zero? (rand-vu-int-count 3)) + (sound-play "grunt-warn" :position gp-0) + (sound-play "grunt-notice" :position gp-0) + ) + ) + ) + ) + (when (!= (-> self volume) (-> self desired-volume)) + (seek! + (-> self volume) + (-> self desired-volume) + (* (-> self volume-seek-speed) (-> self clock seconds-per-frame)) + ) + (when (nonzero? (-> self approach-sound-id)) + (when *sound-player-enable* + (let ((v1-12 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-12 command) (sound-command set-param)) + (set! (-> v1-12 id) (-> self approach-sound-id)) + (set! (-> v1-12 params volume) (the int (* 1024.0 (-> self volume)))) + (set! (-> v1-12 params mask) (the-as uint 1)) + (-> v1-12 id) + ) + ) + ) + ) + ) + +(defstate intro-shooting (under-pipe-growls) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('sig-shot) + (when (>= (-> self volume) 0.6) + (when (nonzero? (-> self approach-sound-id)) + (sound-stop (-> self approach-sound-id)) + (set! (-> self approach-sound-id) (new 'static 'sound-id)) + 0 + ) + (let ((v1-5 (rand-vu-int-count 5))) + (cond + ((zero? v1-5) + (let ((f30-0 (rand-vu-float-range 0.9 1.5))) + (sound-play-by-name + (static-sound-name "grunt-die") + (new-sound-id) + (the int (* 1024.0 f30-0)) + 0 + 0 + (sound-group sfx) + (-> self root trans) + ) + ) + (go-virtual intro-shooting) + ) + ((and (>= v1-5 1) (>= 2 v1-5)) + #f + ) + (else + (let ((f30-1 (rand-vu-float-range 0.9 1.5))) + (sound-play-by-name + (static-sound-name "grunt-hit") + (new-sound-id) + (the int (* 1024.0 f30-1)) + 0 + 0 + (sound-group sfx) + (-> self root trans) + ) + ) + ) + ) + ) + ) + ) + (('die-fast) + (cleanup-for-death self) + (go empty-state) + ) + ) + ) + :enter (behavior () + (set! (-> self volume) 0.0) + (set! (-> self desired-volume) 1.0) + (set! (-> self volume-seek-speed) (rand-vu-float-range 0.5 0.2)) + (none) + ) + :code (the-as (function none :behavior under-pipe-growls) sleep-code) + :post (the-as (function none :behavior under-pipe-growls) under-pipe-growls-post) + ) + +(defstate block-puzzle (under-pipe-growls) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('fade) + (go-virtual block-puzzle-fade) + ) + ) + ) + :enter (behavior () + (set! (-> self volume) 0.25) + (set! (-> self desired-volume) 1.0) + (set! (-> self volume-seek-speed) 0.8) + (none) + ) + :code (behavior () + (sound-play "grunt-notice" :vol 40 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (suspend) + ) + (sound-play "grunt-warn" :vol 50 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (suspend) + ) + (sound-play "grunt-hit" :vol 60 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (suspend) + ) + (sound-play "grunt-notice" :vol 70 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (suspend) + ) + (sound-play "grunt-notice" :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (suspend) + ) + (sound-play "grunt-notice" :vol 200 :position (target-pos 0)) + (sleep-code) + (none) + ) + :post (the-as (function none :behavior under-pipe-growls) under-pipe-growls-post) + ) + +(defstate block-puzzle-fade (under-pipe-growls) + :virtual #t + :enter (behavior () + (set! (-> self desired-volume) 0.0) + (set! (-> self volume-seek-speed) 0.5) + (none) + ) + :trans (behavior () + (when (= (-> self volume) (-> self desired-volume)) + (cleanup-for-death self) + (go empty-state) + ) + (none) + ) + :code (the-as (function none :behavior under-pipe-growls) sleep-code) + :post (the-as (function none :behavior under-pipe-growls) under-pipe-growls-post) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior under-pipe-growls-init-by-other under-pipe-growls ((arg0 vector) (arg1 symbol)) + (set! (-> self approach-sound-id) (new 'static 'sound-id)) + (set! (-> self approach-play-time) + (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 0.1) (seconds 1))) + ) + (set! (-> self root) (new 'process 'trsqv)) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((s4-1 (-> self root))) + (set! (-> s4-1 trans quad) (-> arg0 quad)) + (quaternion-identity! (-> s4-1 quat)) + (vector-identity! (-> s4-1 scale)) + ) + (set! (-> self volume) 0.0) + (set! (-> self desired-volume) 0.0) + (set! (-> self volume-seek-speed) 1.0) + (if (= arg1 'intro-shooting) + (go-virtual intro-shooting) + (go-virtual block-puzzle) + ) + (none) + ) diff --git a/goal_src/jak2/levels/underport/underb-master.gc b/goal_src/jak2/levels/underport/underb-master.gc index 38f25e6186..d9cdde5258 100644 --- a/goal_src/jak2/levels/underport/underb-master.gc +++ b/goal_src/jak2/levels/underport/underb-master.gc @@ -7,3 +7,1161 @@ ;; DECOMP BEGINS +(deftype under-warp (process-drawable) + ((interp float :offset-assert 200) + ) + :heap-base #x50 + :method-count-assert 23 + :size-assert #xcc + :flag-assert #x17005000cc + (:methods + (idle () _type_ :state 20) + (die-fast () _type_ :state 21) + (under-warp-method-22 (_type_) none 22) + ) + ) + + +(defskelgroup skel-under-warp under-warp under-warp-lod0-jg under-warp-idle-ja + ((under-warp-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 8) + ) + +(defstate idle (under-warp) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('die-fast) + (set-under-fog-interp! 0.0) + (go-virtual die-fast) + ) + ) + ) + :code (behavior () + (until #f + (let ((v1-2 (-> self skel root-channel 1)) + (f0-0 (-> self interp)) + ) + (set! (-> v1-2 frame-interp 1) f0-0) + (set! (-> v1-2 frame-interp 0) f0-0) + ) + (ja :num! (loop!)) + (ja :chan 1 :num! (chan 0)) + (ja-no-eval :group! (-> self draw art-group data 2) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (behavior () + (under-warp-method-22 self) + (ja-post) + (none) + ) + ) + +(defstate die-fast (under-warp) + :virtual #t + :code (the-as (function none :behavior under-warp) nothing) + ) + +(defmethod under-warp-method-22 under-warp ((obj under-warp)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((s3-0 (camera-matrix)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (f30-0 4096.0) + ) + (let ((f0-4 (* 0.00013563369 (tan (* 0.5 (-> *math-camera* fov))) f30-0))) + (set-vector! (-> obj root scale) f0-4 f0-4 f0-4 1.0) + ) + (set! (-> gp-0 quad) (-> (camera-pos) quad)) + (vector-normalize-copy! s5-0 (-> s3-0 vector 2) 1.0) + (matrix->quaternion (-> obj root quat) s3-0) + (let ((v1-10 (-> obj root trans))) + (let ((a0-5 f30-0)) + (.mov vf7 a0-5) + ) + (.lvf vf5 (&-> s5-0 quad)) + (.lvf vf4 (&-> gp-0 quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> v1-10 quad) vf6) + ) + ) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior under-warp-init-by-other under-warp ((arg0 vector) (arg1 quaternion) (arg2 entity-actor)) + (set! (-> self level) (the-as level arg2)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (quaternion-copy! (-> self root quat) arg1) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-warp" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self interp) 0.5) + (ja-channel-push! 2 (seconds 0.3)) + (ja-no-eval :group! (-> self draw art-group data 2) :num! (loop!)) + (let ((gp-2 (-> self skel root-channel 1))) + (let ((f0-2 (-> self interp))) + (set! (-> gp-2 frame-interp 1) f0-2) + (set! (-> gp-2 frame-interp 0) f0-2) + ) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-identity) + (set! (-> gp-2 frame-num) 0.0) + ) + (logior! (-> self skel status) (joint-control-status blend-shape)) + (go-virtual idle) + (none) + ) + +(deftype underb-master (process) + ((warp-handle handle :offset-assert 128) + (tank-handle handle :offset-assert 136) + (underwater-time time-frame :offset-assert 144) + (last-air-beep-time time-frame :offset-assert 152) + (ambient-sound-id sound-id :offset-assert 160) + (air-supply float :offset-assert 164) + (air-charge-up? symbol :offset-assert 168) + (under-water-pitch-mod float :offset-assert 172) + (big-room-entered symbol :offset-assert 176) + (big-room-timer time-frame :offset-assert 184) + (under-plat-player-on symbol :offset-assert 192) + (under-plat-is-up symbol :offset-assert 196) + ) + :heap-base #x50 + :method-count-assert 24 + :size-assert #xc8 + :flag-assert #x18005000c8 + (:methods + (idle () _type_ :state 14) + (big-room-player-under () _type_ :state 15) + (big-room-player-plat () _type_ :state 16) + (underb-master-method-17 () none 17) + (big-room-player-above () _type_ :state 18) + (big-room-player-falling () _type_ :state 19) + (big-room-player-exiting () _type_ :state 20) + (big-room-player-done () _type_ :state 21) + (under-warp-check (_type_) symbol 22) + (spawn-air-tank-hud (_type_ symbol) none 23) + ) + ) + + +(define *underb-master* (the-as (pointer underb-master) #f)) + +(defmethod deactivate underb-master ((obj underb-master)) + (sound-stop (-> obj ambient-sound-id)) + (send-event (handle->process (-> obj warp-handle)) 'die-fast) + (set! *underb-master* (the-as (pointer underb-master) #f)) + ((method-of-type process deactivate) obj) + (none) + ) + +;; WARN: disable def twice: 121. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defbehavior underb-master-event-handler underb-master ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('query) + (case (-> arg3 param 0) + (('mech) + (not (-> *setting-control* user-current pilot-exit)) + ) + (('bubbler) + (and (handle->process (-> self warp-handle)) + (or (and (-> self next-state) (= (-> self next-state name) 'idle)) (not (under-warp-check self))) + ) + ) + ) + ) + (('request) + (case (-> arg3 param 0) + (('mech) + (cond + ((-> arg3 param 1) + (cond + ((-> *setting-control* user-current pilot-exit) + (let ((a1-2 *target*)) + (when (and a1-2 (logtest? (focus-status mech) (-> a1-2 focus-status))) + (set-setting! 'pilot-exit #f 0 0) + (apply-settings *setting-control*) + #t + ) + ) + ) + (else + #t + ) + ) + ) + ((-> *setting-control* user-current pilot-exit) + #t + ) + (else + (remove-setting! 'pilot-exit) + (apply-settings *setting-control*) + (not (-> *setting-control* user-current pilot-exit)) + ) + ) + ) + (('under-warp) + (cond + ((-> arg3 param 1) + (set-under-fog-interp! 1.0) + (when (not (handle->process (-> self warp-handle))) + (let ((s2-0 (camera-matrix)) + (s3-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> gp-0 quad) (-> (camera-pos) quad)) + (vector-normalize-copy! s3-0 (-> s2-0 vector 2) 1.0) + (matrix->quaternion s5-0 s2-0) + (set! (-> self warp-handle) + (ppointer->handle (process-spawn under-warp gp-0 s5-0 (-> self level) :to *display-pool*)) + ) + ) + (set! v0-0 (sound-play "mech-under-amb")) + (set! (-> self ambient-sound-id) (the-as sound-id v0-0)) + v0-0 + ) + ) + (else + (set-under-fog-interp! 0.0) + (let ((a0-41 (handle->process (-> self warp-handle)))) + (when a0-41 + (send-event a0-41 'die-fast) + (set! (-> self warp-handle) (the-as handle #f)) + (sound-stop (-> self ambient-sound-id)) + (set! (-> self ambient-sound-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + ) + ) + (('big-room) + (case (-> arg3 param 1) + (('status) + (cond + ((-> arg3 param 2) + (set! v0-0 #t) + (set! (-> self big-room-entered) (the-as symbol v0-0)) + v0-0 + ) + (else + (set! (-> self big-room-entered) #f) + #f + ) + ) + ) + (('under-plat) + (case (-> arg3 param 2) + (('player) + (cond + ((-> arg3 param 3) + (set! v0-0 #t) + (set! (-> self under-plat-player-on) (the-as symbol v0-0)) + v0-0 + ) + (else + (set! (-> self under-plat-player-on) #f) + #f + ) + ) + ) + (('up) + (cond + ((-> arg3 param 3) + (set! v0-0 #t) + (set! (-> self under-plat-is-up) (the-as symbol v0-0)) + v0-0 + ) + (else + (set! (-> self under-plat-is-up) #f) + #f + ) + ) + ) + ) + ) + ) + ) + ) + ) + (('bubbler) + (set! v0-0 #t) + (set! (-> self air-charge-up?) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + +(defmethod under-warp-check underb-master ((obj underb-master)) + "Used to check whether the underwater warp effect should be drawn." + (let ((target-pos (target-pos 0)) + (tpos-offset (new 'stack-no-clear 'vector)) + (a1-0 (new 'stack-no-clear 'vector)) + (v1-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> tpos-offset x) (+ -827392.0 (-> target-pos x))) + (set! (-> tpos-offset y) 0.0) + (set! (-> tpos-offset z) (+ -7671808.0 (-> target-pos z))) + (set! (-> a1-0 x) -94208.0) + (set! (-> a1-0 y) 0.0) + (set! (-> a1-0 z) -143360.0) + (vector-cross! v1-0 tpos-offset a1-0) + (< (-> v1-0 y) 0.0) + ) + ) + +(defmethod spawn-air-tank-hud underb-master ((obj underb-master) (arg0 symbol)) + "Spawns or hides the air tank HUD bar." + (cond + (arg0 + (if (not (handle->process (-> obj tank-handle))) + (set! (-> obj tank-handle) + (ppointer->handle (process-spawn hud-mech-air-tank :init hud-init-by-other :to obj)) + ) + ) + ) + (else + (send-event (handle->process (-> obj tank-handle)) 'hide-and-die) + (set! (-> obj tank-handle) (the-as handle #f)) + ) + ) + (none) + ) + +(defbehavior underb-master-post underb-master () + #t + (let ((gp-0 *target*)) + (let ((f30-0 0.0)) + (when (and gp-0 (not (-> *setting-control* user-current pilot-exit))) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! (-> gp-0 control) s5-0 (collide-action solid semi-solid)) + (let ((v1-7 (-> s5-0 flags))) + (if (logtest? (water-flags touch-water) v1-7) + (set! f30-0 (lerp-scale 0.0 1.0 (- (-> gp-0 control trans y) (-> s5-0 trans y)) -4096.0 -20480.0)) + ) + ) + ) + ) + (when (!= f30-0 (-> self under-water-pitch-mod)) + (set! (-> self under-water-pitch-mod) f30-0) + (if (= f30-0 0.0) + (remove-setting! 'under-water-pitch-mod) + (set-setting! 'under-water-pitch-mod 'abs f30-0 0) + ) + ) + ) + (if (or (not gp-0) (zero? (logand (-> gp-0 water flags) (water-flags under-water)))) + (set! (-> self air-charge-up?) #t) + (set! (-> self underwater-time) (-> self clock frame-counter)) + ) + ) + (cond + ((-> self air-charge-up?) + (set! (-> self air-supply) + (seek-with-smooth (-> self air-supply) 1.0 (* 2.0 (-> self clock seconds-per-frame)) 0.125 0.01) + ) + (when (= (-> self air-supply) 1.0) + (set! (-> self air-charge-up?) #f) + (set! (-> self air-supply) 1.01) + (set! (-> self last-air-beep-time) 0) + 0 + ) + ) + (else + (seek! (-> self air-supply) 0.0 (* 0.04 (-> self clock seconds-per-frame))) + (cond + ((= (-> self air-supply) 0.0) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer self)) + (set! (-> a1-6 num-params) 2) + (set! (-> a1-6 message) 'attack) + (set! (-> a1-6 param 0) (the-as uint #f)) + (let ((v1-35 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-11 *game-info*) + (a2-7 (+ (-> a0-11 attack-id) 1)) + ) + (set! (-> a0-11 attack-id) a2-7) + (set! (-> v1-35 id) a2-7) + ) + (set! (-> v1-35 mode) 'air) + (set! (-> a1-6 param 1) (the-as uint v1-35)) + ) + (send-event-function *target* a1-6) + ) + ) + (else + (when (>= 0.4 (-> self air-supply)) + (let ((v1-39 (the int (lerp-scale 90.0 300.0 (-> self air-supply) 0.0 0.4)))) + (when (>= (- (-> self clock frame-counter) (-> self last-air-beep-time)) v1-39) + (set! (-> self last-air-beep-time) (-> self clock frame-counter)) + (sound-play "oxygen-warning") + ) + ) + ) + ) + ) + ) + ) + (set! (-> *game-info* air-supply) (fmin 1.0 (-> self air-supply))) + (if (or (and *target* (zero? (logand (focus-status mech) (-> *target* focus-status)))) + (and (>= (-> self air-supply) 1.0) + (>= (- (-> self clock frame-counter) (-> self underwater-time)) (seconds 3)) + ) + ) + (spawn-air-tank-hud self #f) + (spawn-air-tank-hud self #t) + ) + (none) + ) + +(defstate idle (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (if (-> self big-room-entered) + (go-virtual big-room-player-under) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +(defstate big-room-player-under (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (if (-> self under-plat-player-on) + (go-virtual big-room-player-plat) + ) + (if (not (-> self big-room-entered)) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +(defstate big-room-player-plat (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (set-setting! 'entity-name "camera-239" 0 0) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #f) + (none) + ) + :exit (behavior () + (remove-setting! 'entity-name) + (none) + ) + :trans (behavior () + (let ((gp-0 (target-pos 0))) + (if (or (and (-> self under-plat-is-up) (-> self under-plat-player-on)) (< -245760.0 (-> gp-0 y))) + (go-virtual big-room-player-above) + ) + (if (and (not (-> self under-plat-player-on)) (< (-> gp-0 y) -245760.0)) + (go-virtual big-room-player-falling) + ) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +(defstate big-room-player-above (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 600.0 0) + (remove-setting! 'mode-name) + (none) + ) + :trans (behavior () + (if (< (-> (target-pos 0) y) -245760.0) + (go-virtual big-room-player-falling) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +(defstate big-room-player-falling (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (set-setting! 'mode-name 'cam-endlessfall 0 0) + (none) + ) + :exit (behavior () + (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) + (remove-setting! 'mode-name) + (none) + ) + :trans (behavior () + (cond + ((not *target*) + (go-virtual idle) + ) + ((under-warp-check self) + (if (< (-> (target-pos 0) y) -258048.0) + (go-virtual big-room-player-exiting) + ) + ) + (else + (if (< (-> (target-pos 0) y) -278528.0) + (go-virtual big-room-player-under) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +(defstate big-room-player-exiting (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) + (set-setting! 'entity-name "camera-244" 0 0) + (set! (-> self big-room-timer) (-> self clock frame-counter)) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) + (none) + ) + :exit (behavior () + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 600.0 0) + (remove-setting! 'entity-name) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self big-room-timer)) (seconds 1)) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +(defstate big-room-player-done (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (go-virtual idle) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior underb-master-init-by-other underb-master ((arg0 level)) + (set! *underb-master* (the-as (pointer underb-master) (process->ppointer self))) + (set! (-> self warp-handle) (the-as handle #f)) + (set! (-> self tank-handle) (the-as handle #f)) + (set! (-> self level) arg0) + (set! (-> self air-supply) 1.0) + (set! (-> self air-charge-up?) #f) + (set! (-> self ambient-sound-id) (new 'static 'sound-id)) + (set! (-> self big-room-entered) #f) + (set! (-> self under-plat-player-on) #f) + (set! (-> self under-plat-is-up) #f) + (go-virtual idle) + (none) + ) + +;; TODO uncomment once hover-formation is in +(defun underb-login ((arg0 level)) + ;; (set! *nav-network* (new 'loading-level 'nav-network)) + ;; (nav-network-method-9 *nav-network*) + 0 + (none) + ) + +(defun underb-deactivate ((arg0 level)) + ;; (set! *nav-network* (the-as nav-network 0)) + 0 + (none) + ) + +(defun underb-activate ((arg0 level)) + ;; (nav-network-method-10 *nav-network* arg0 *under-adjacency*) + (let ((v1-3 (process-spawn underb-master arg0 :to *entity-pool*))) + (if v1-3 + (set! (-> v1-3 0 level) arg0) + ) + ) + 0 + (none) + ) + +(deftype under-locking (process-drawable) + ((id int8 :offset-assert 200) + (up-y float :offset-assert 204) + (down-y float :offset-assert 208) + (mode uint64 :offset-assert 216) + (which-reminder? symbol :offset-assert 224) + (spooled-sound-id uint32 :offset-assert 228) + (draining-part sparticle-launch-control :offset-assert 232) + (actor-group (pointer actor-group) :offset-assert 236) + (spooled-sound-delay int32 :offset-assert 240) + (last-reminder-time time-frame :offset 256) + ) + :heap-base #x90 + :method-count-assert 24 + :size-assert #x108 + :flag-assert #x1800900108 + (:methods + (startup () _type_ :state 20) + (active () _type_ :state 21) + (filling () _type_ :state 22) + (draining () _type_ :state 23) + ) + ) + + +;; WARN: Return type mismatch process-drawable vs under-locking. +(defmethod relocate under-locking ((obj under-locking) (arg0 int)) + (if (nonzero? (-> obj draining-part)) + (&+! (-> obj draining-part) arg0) + ) + (the-as under-locking ((method-of-type process-drawable relocate) obj arg0)) + ) + +(defmethod deactivate under-locking ((obj under-locking)) + (if (nonzero? (-> obj draining-part)) + (kill-and-free-particles (-> obj draining-part)) + ) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +(defstate startup (under-locking) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('test) + #f + ) + ) + ) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :trans (behavior () + (let ((v1-0 (-> self actor-group))) + (cond + ((and v1-0 + (let ((a0-2 (-> v1-0 0 data 0 actor))) + (if a0-2 + (-> a0-2 extra process) + ) + ) + (let ((a0-5 (-> v1-0 0 data 1 actor))) + (if a0-5 + (-> a0-5 extra process) + ) + ) + (let ((a1-2 (-> v1-0 0 data 2 actor))) + (if a1-2 + (-> a1-2 extra process) + ) + ) + ) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (let ((a0-13 (-> v1-0 0 data 0 actor))) + (if a0-13 + (-> a0-13 extra process) + ) + ) + (let ((v1-2 (-> v1-0 0 data 1 actor))) + (if v1-2 + (-> v1-2 extra process) + ) + ) + (let ((a1-6 *target*)) + (cond + ((and a1-6 (logtest? (focus-status mech) (-> a1-6 focus-status))) + (set! (-> self mode) (the-as uint 3)) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) (process->ppointer self)) + (set! (-> a1-8 num-params) 1) + (set! (-> a1-8 message) 'move-to-y) + (set! (-> a1-8 param 0) (the-as uint (-> self up-y))) + (let ((t9-0 send-event-function) + (v1-13 (-> self actor-group 0 data 2 actor)) + ) + (t9-0 + (if v1-13 + (-> v1-13 extra process) + ) + a1-8 + ) + ) + ) + ) + (else + (set! (-> self mode) (the-as uint 0)) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) (process->ppointer self)) + (set! (-> a1-9 num-params) 1) + (set! (-> a1-9 message) 'move-to-y) + (set! (-> a1-9 param 0) (the-as uint (-> self down-y))) + (let ((t9-1 send-event-function) + (v1-22 (-> self actor-group 0 data 2 actor)) + ) + (t9-1 + (if v1-22 + (-> v1-22 extra process) + ) + a1-9 + ) + ) + ) + ) + ) + ) + (go-virtual active) + ) + ) + (else + (set! (-> self state-time) (-> self clock frame-counter)) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-locking) sleep-code) + ) + +(defstate active (under-locking) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('test) + (let ((v1-1 (-> self mode))) + (cond + ((-> event param 0) + (when (or (zero? v1-1) (= v1-1 5)) + (let ((a0-4 *target*)) + (and a0-4 (zero? (logand (focus-status mech) (-> a0-4 focus-status)))) + ) + ) + ) + (else + (or (= v1-1 2) (= v1-1 3)) + ) + ) + ) + ) + ) + ) + :trans (behavior () + (let ((v1-0 (-> self mode))) + (cond + ((zero? v1-0) + (let ((v1-1 *target*) + (a0-1 (-> self actor-group)) + ) + (when (and v1-1 a0-1) + (if (and (-> a0-1 0 data 0 actor) + (logtest? (focus-status mech) (-> v1-1 focus-status)) + (send-event (ppointer->process *underb-master*) 'request 'mech #t) + ) + (set! (-> self mode) (the-as uint 1)) + ) + ) + ) + ) + ((= v1-0 1) + (if (not (logtest? (-> self actor-group 0 data 0 actor extra perm status) (entity-perm-status subtask-complete))) + (go-virtual filling) + ) + ) + ((= v1-0 2) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'front) + (let ((t9-2 send-event-function) + (v1-24 (-> self actor-group 0 data 1 actor)) + ) + (if (not (t9-2 + (if v1-24 + (-> v1-24 extra process) + ) + a1-2 + ) + ) + (set! (-> self mode) (the-as uint 3)) + ) + ) + ) + ) + ((= v1-0 3) + (if (>= 20480.0 (vector-vector-xz-distance (target-pos 0) (-> self root trans))) + (set! (-> self mode) (the-as uint 4)) + ) + ) + ((= v1-0 4) + (go-virtual draining) + ) + ((= v1-0 5) + (let ((a1-4 *target*)) + (when (or (not a1-4) (zero? (logand (focus-status mech) (-> a1-4 focus-status)))) + (set! (-> self mode) (the-as uint 0)) + 0 + ) + ) + (when (>= (- (-> self clock frame-counter) (-> self last-reminder-time)) (seconds 9)) + (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (add-process + *gui-control* + self + (gui-channel ashelin) + (gui-action play) + (if (-> self which-reminder?) + "cityv193" + "cityv192" + ) + -99.0 + 0 + ) + (set! (-> self which-reminder?) (not (-> self which-reminder?))) + ) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-locking) sleep-code) + ) + +(defstate filling (under-locking) + :virtual #t + :event (-> (method-of-type under-locking active) event) + :enter (behavior () + (set! (-> self spooled-sound-id) + (the-as uint (add-process *gui-control* self (gui-channel ashelin) (gui-action queue) "wtrfill" -99.0 0)) + ) + (set! (-> self state-time) 0) + (set! (-> self spooled-sound-delay) (if (= (-> self id) 1) + 120 + 0 + ) + ) + (none) + ) + :trans (behavior () + (when (and (zero? (-> self state-time)) + ;; TODO this always returns false? + ;; (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self last-reminder-time) (-> self clock frame-counter)) + ) + (when (nonzero? (-> self state-time)) + (when (and (>= (-> self spooled-sound-delay) 0) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self spooled-sound-delay)) + ) + (set-action! + *gui-control* + (gui-action play) + (the-as sound-id (-> self spooled-sound-id)) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (set! (-> self spooled-sound-delay) -1) + ) + (let* ((v1-21 (-> self actor-group 0 data 2 actor)) + (gp-0 (if v1-21 + (-> v1-21 extra process) + ) + ) + ) + (when gp-0 + (let ((f0-0 (-> (the-as process-drawable gp-0) root trans y))) + (when (!= f0-0 (-> self up-y)) + (let ((f0-4 (seek f0-0 (-> self up-y) (* 12288.0 (-> self clock seconds-per-frame))))) + (send-event gp-0 'move-to-y f0-4) + ) + ) + ) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (spawn (-> self part) (-> self root trans)) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (while (zero? (-> self state-time)) + (suspend) + ) + (until #f + (let* ((v1-4 (-> self actor-group 0 data 2 actor)) + (gp-0 (if v1-4 + (-> v1-4 extra process) + ) + ) + ) + (when gp-0 + (if (< (- (-> (camera-pos) y) (-> (the-as process-drawable gp-0) root trans y)) 22528.0) + (goto cfg-11) + ) + ) + ) + (suspend) + ) + #f + (label cfg-11) + (let ((a3-1 (res-lump-struct (-> self entity) 'camera-name structure))) + (if a3-1 + (set-setting! 'entity-name a3-1 0 0) + ) + ) + (until #f + (let* ((a0-2 (-> self actor-group 0 data 2 actor)) + (v1-19 (if a0-2 + (-> a0-2 extra process) + ) + ) + ) + (when v1-19 + (when (= (-> (the-as process-drawable v1-19) root trans y) (-> self up-y)) + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) + (remove-setting! 'entity-name) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) + (set! (-> self mode) (the-as uint 2)) + (go-virtual active) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defstate draining (under-locking) + :virtual #t + :event (-> (method-of-type under-locking active) event) + :enter (behavior () + (set! (-> self spooled-sound-id) + (the-as uint (add-process *gui-control* self (gui-channel ashelin) (gui-action queue) "wtrdrain" -99.0 0)) + ) + (set! (-> self state-time) 0) + 0 + (none) + ) + :trans (behavior () + (when (and (zero? (-> self state-time)) + ;; TODO this always returns false? + ;; (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (set-action! + *gui-control* + (gui-action play) + (the-as sound-id (-> self spooled-sound-id)) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + ) + (when (nonzero? (-> self state-time)) + (let* ((v1-14 (-> self actor-group 0 data 2 actor)) + (gp-0 (if v1-14 + (-> v1-14 extra process) + ) + ) + ) + (when gp-0 + (let ((f0-0 (-> (the-as process-drawable gp-0) root trans y))) + (when (!= f0-0 (-> self down-y)) + (let ((f0-4 (seek f0-0 (-> self down-y) (* 12288.0 (-> self clock seconds-per-frame))))) + (send-event gp-0 'move-to-y f0-4) + ) + ) + ) + (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (spawn (-> self draining-part) (-> self root trans)) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (while (zero? (-> self state-time)) + (suspend) + ) + (let ((a3-1 (res-lump-struct (-> self entity) 'camera-name structure))) + (if a3-1 + (set-setting! 'entity-name a3-1 0 0) + ) + ) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #f) + (until #f + (let* ((a0-3 (-> self actor-group 0 data 2 actor)) + (v1-15 (if a0-3 + (-> a0-3 extra process) + ) + ) + ) + (when v1-15 + (if (< (-> (the-as process-drawable v1-15) root trans y) (+ 10240.0 (-> (target-pos 0) y))) + (goto cfg-17) + ) + ) + ) + (suspend) + ) + #f + (label cfg-17) + (remove-setting! 'entity-name) + (until #f + (let* ((a0-8 (-> self actor-group 0 data 2 actor)) + (v1-26 (if a0-8 + (-> a0-8 extra process) + ) + ) + ) + (when v1-26 + (when (= (-> (the-as process-drawable v1-26) root trans y) (-> self down-y)) + (set! (-> self mode) (the-as uint 5)) + (send-event (ppointer->process *underb-master*) 'request 'mech #f) + (set! (-> self which-reminder?) #f) + (go-virtual active) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-locking ((obj under-locking) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (set! (-> obj which-reminder?) #f) + (set! (-> obj spooled-sound-id) (the-as uint 0)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (set! (-> obj id) (res-lump-value arg0 'extra-id int :time -1000000000.0)) + (let ((f0-0 (-> obj root trans y))) + (set! (-> obj up-y) (+ 49152.0 f0-0)) + (set! (-> obj down-y) (+ f0-0 (if (= (-> obj id) 2) + -16384.0 + -20480.0 + ) + ) + ) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((a0-6 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (if (and a0-6 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) a0-6)) + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + ) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 498) obj)) + (set! (-> obj draining-part) (create-launch-control (-> *part-group-id-table* 499) obj)) + (go (method-of-object obj startup)) + (none) + ) + +(deftype water-anim-under (water-anim) + () + :heap-base #x80 + :method-count-assert 29 + :size-assert #x100 + :flag-assert #x1d00800100 + ) + + +(define ripple-for-water-anim-under (new 'static 'ripple-wave-set + :count 3 + :converted #f + :normal-scale 1.0 + :wave (new 'static 'inline-array ripple-wave 4 + (new 'static 'ripple-wave :scale 40.0 :xdiv 1 :speed 1.5) + (new 'static 'ripple-wave :scale 40.0 :xdiv -1 :zdiv 1 :speed 1.5) + (new 'static 'ripple-wave :scale 20.0 :xdiv 5 :zdiv 3 :speed 0.75) + (new 'static 'ripple-wave) + ) + ) + ) + +(defmethod init-water! water-anim-under ((obj water-anim-under)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) + (t9-0 obj) + ) + (let ((v1-2 (new 'process 'ripple-control))) + (set! (-> obj draw ripple) v1-2) + (set-vector! (-> obj draw color-mult) 0.01 0.45 0.5 0.75) + (set! (-> v1-2 global-scale) 3072.0) + (set! (-> v1-2 close-fade-dist) 163840.0) + (set! (-> v1-2 far-fade-dist) 245760.0) + (set! (-> v1-2 waveform) ripple-for-water-anim-under) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc index 7ea9a5fad9..41d2e4f115 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc @@ -381,15 +381,14 @@ ;; definition for function water-anim-event-handler ;; INFO: Used lq/sq ;; WARN: Return type mismatch none vs object. -;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 210] (defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-1 none)) + (local-vars (v0-1 object)) (the-as object (case arg2 (('move-to) (move-to-point! self (the-as vector (-> arg3 param 0))) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) (set! (-> self mask) (the-as process-mask v0-1)) v0-1 ) @@ -399,7 +398,7 @@ (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) (move-to-point! self a1-2) ) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) (set! (-> self mask) (the-as process-mask v0-1)) v0-1 ) @@ -466,7 +465,7 @@ ) (let ((a0-40 (-> self flow))) (if (nonzero? a0-40) - (push-process a0-40 (the-as process-focusable gp-0)) + (the-as object (push-process a0-40 (the-as process-focusable gp-0))) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc index 8c2ca8b70e..490abec631 100644 --- a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc @@ -310,7 +310,7 @@ (eye-anim merc-eye-anim-block :offset 4) (master-art-group-name string :offset-assert 32) (master-art-group-index int32 :offset-assert 36) - (blend-shape-anim basic :offset-assert 40) + (blend-shape-anim (pointer int8) :offset-assert 40) (frames joint-anim-compressed-control :offset-assert 44) ) :method-count-assert 13 diff --git a/test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc b/test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc new file mode 100644 index 0000000000..25d9f11da8 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc @@ -0,0 +1,251 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type ripple-request +(deftype ripple-request (structure) + ((waveform ripple-wave :offset-assert 0) + (effect merc-effect :offset-assert 4) + ) + :pack-me + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) + +;; definition for method 3 of type ripple-request +(defmethod inspect ripple-request ((obj ripple-request)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'ripple-request) + (format #t "~1Twaveform: ~A~%" (-> obj waveform)) + (format #t "~1Teffect: #~%" (-> obj effect)) + (label cfg-4) + obj + ) + +;; definition of type ripple-globals +(deftype ripple-globals (structure) + ((count int32 :offset-assert 0) + (requests ripple-request 16 :inline :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x84 + :flag-assert #x900000084 + ) + +;; definition for method 3 of type ripple-globals +(defmethod inspect ripple-globals ((obj ripple-globals)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'ripple-globals) + (format #t "~1Tcount: ~D~%" (-> obj count)) + (format #t "~1Trequests[16] @ #x~X~%" (-> obj requests)) + (label cfg-4) + obj + ) + +;; definition for symbol *ripple-globals*, type ripple-globals +(define *ripple-globals* "A collection of [[ripple-request]] (max of 16)" (new 'global 'ripple-globals)) + +;; definition for function ripple-make-request +;; WARN: Return type mismatch int vs none. +(defun ripple-make-request ((waveform ripple-wave) (effect merc-effect)) + "Iterate through [[*ripple-globals*]] `requests` looking for the one that matches the provided `effect` +If NOT found, append a new [[ripple-request]] with the providded `effect` and `waveform` to the end of the `requests`. + +NOTE: There can only be 16 effects at a given time, NOOP if already at that limit!" + (let ((v1-1 (-> *ripple-globals* count)) + (a2-1 (-> *ripple-globals* requests)) + (a3-0 0) + ) + (when (< v1-1 16) + (dotimes (t0-1 v1-1) + (if (= effect (-> a2-1 t0-1 effect)) + (set! a3-0 1) + ) + ) + (when (zero? a3-0) + (set! (-> a2-1 v1-1 effect) effect) + (set! (-> a2-1 v1-1 waveform) waveform) + (+! (-> *ripple-globals* count) 1) + ) + ) + ) + 0 + (none) + ) + +;; definition for function ripple-update-waveform-offs +;; WARN: Return type mismatch int vs none. +(defun ripple-update-waveform-offs ((arg0 ripple-wave-set) (arg1 clock)) + (let ((f0-1 (the float (- (-> arg1 integral-frame-counter) (-> arg0 frame-save))))) + (when (!= f0-1 0.0) + (dotimes (v1-3 (-> arg0 count)) + (let ((a2-4 (-> arg0 wave v1-3))) + (+! (-> a2-4 offs) (* f0-1 (-> a2-4 delta))) + (set! (-> a2-4 offs) (the float (logand (the int (-> a2-4 offs)) #xffff))) + ) + ) + (set! (-> arg0 frame-save) (-> arg1 integral-frame-counter)) + ) + ) + 0 + (none) + ) + +;; definition for function ripple-execute-init +;; INFO: function output is handled by mips2c +(def-mips2c ripple-execute-init (function none)) + +;; definition for function ripple-create-wave-table +;; INFO: function output is handled by mips2c +(def-mips2c ripple-create-wave-table (function ripple-wave-set int)) + +;; definition for function ripple-apply-wave-table +;; INFO: function output is handled by mips2c +(def-mips2c ripple-apply-wave-table (function merc-effect symbol)) + +;; definition for function ripple-execute +;; WARN: Return type mismatch int vs none. +(defun ripple-execute () + "Iterate through [[*ripple-globals*]] requests, from the end to index `0` +For each request, if it has a `waveform` create the wave-table via `ripple-create-wave-table` +Then for each `waveform` apply the `effect` using `ripple-apply-wave-table` + +Once completed, all `requests` have been processed and the `count` is reset to `0`" + (when (-> *ripple-globals* count) + (ripple-execute-init) + (let ((gp-0 0) + (s5-0 (-> *ripple-globals* count)) + (s4-0 (-> *ripple-globals* requests)) + ) + (while (!= gp-0 s5-0) + (when (-> s4-0 gp-0 waveform) + (let ((s3-0 gp-0) + (s2-0 (-> s4-0 gp-0 waveform)) + ) + (ripple-create-wave-table (the-as ripple-wave-set s2-0)) + (while (!= s3-0 s5-0) + (when (= s2-0 (-> s4-0 s3-0 waveform)) + (ripple-apply-wave-table (-> s4-0 s3-0 effect)) + (set! (-> s4-0 s3-0 waveform) #f) + ) + (+! s3-0 1) + ) + ) + ) + (+! gp-0 1) + ) + ) + (set! (-> *ripple-globals* count) 0) + 0 + ) + 0 + (none) + ) + +;; definition for function ripple-matrix-scale +;; INFO: function output is handled by mips2c +(def-mips2c ripple-matrix-scale function) + +;; definition (debug) for function ripple-add-debug-sphere +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defun-debug ripple-add-debug-sphere ((arg0 process-drawable) (arg1 vector) (arg2 float) (arg3 float)) + (let ((f30-0 (- (quaternion-y-angle (-> arg0 root quat)))) + (s5-0 (new-stack-vector0)) + ) + (let ((f28-0 (+ (-> arg1 x) (* arg2 (-> arg1 z)))) + (f26-0 (+ (-> arg1 y) (* arg3 (-> arg1 z)))) + ) + (set! (-> s5-0 x) (- (* f28-0 (cos f30-0)) (* f26-0 (sin f30-0)))) + (set! (-> s5-0 y) 0.0) + (set! (-> s5-0 z) (+ (* f26-0 (cos f30-0)) (* f28-0 (sin f30-0)))) + ) + (set! (-> s5-0 w) 0.0) + (vector+! s5-0 s5-0 (-> arg0 root trans)) + (add-debug-sphere #t (bucket-id debug2) s5-0 (meters 0.5) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + (none) + ) + +;; definition for function ripple-slow-add-sine-waves +(defun ripple-slow-add-sine-waves ((arg0 ripple-wave-set) (arg1 float) (arg2 float)) + (let ((f30-0 0.0)) + (dotimes (s3-0 (-> arg0 count)) + (let* ((v1-3 (-> arg0 wave s3-0)) + (f0-2 (+ (-> v1-3 offs) (* arg1 (-> v1-3 xmul)) (* arg2 (-> v1-3 zmul)))) + ) + (+! f30-0 (* (-> v1-3 scale) (cos f0-2))) + ) + ) + (fmax -127.0 (fmin 127.0 f30-0)) + ) + ) + +;; definition for function ripple-find-height +(defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector)) + (local-vars (sv-16 draw-control) (sv-32 float) (sv-48 float)) + (let ((f30-0 (-> arg0 root trans y))) + (set! sv-16 (-> arg0 draw)) + (if (or (zero? sv-16) (not (-> sv-16 ripple))) + (return f30-0) + ) + (let ((v1-11 (-> sv-16 lod-set lod (-> sv-16 cur-lod) geo effect))) + (if (not (logtest? (-> v1-11 0 effect-bits) (effect-bits ripple))) + (return f30-0) + ) + (let* ((v1-12 (-> v1-11 0 extra-info)) + (s4-0 (the-as mei-ripple (+ (the-as uint v1-12) (* (-> v1-12 ripple-offset) 16)))) + (gp-0 (-> sv-16 ripple)) + (s5-0 (-> gp-0 waveform)) + ) + (if (not (-> gp-0 waveform)) + (return f30-0) + ) + (if (not (-> s5-0 converted)) + (return f30-0) + ) + (let* ((f28-0 (- (-> arg2 x) (-> arg0 root trans x))) + (f26-0 (- (-> arg2 z) (-> arg0 root trans z))) + (f22-0 (+ (quaternion-y-angle (-> arg0 root quat)) (-> s4-0 angle))) + (f24-0 (cos f22-0)) + (f1-3 (sin f22-0)) + (f0-4 (- (* f28-0 f24-0) (* f26-0 f1-3))) + (f1-5 (+ (* f26-0 f24-0) (* f28-0 f1-3))) + (f2-3 (/ 1.0 (-> s4-0 grid-size))) + (f28-1 (* f2-3 (- f0-4 (-> s4-0 x-base)))) + (f26-1 (* f2-3 (- f1-5 (-> s4-0 z-base)))) + ) + (ripple-update-waveform-offs s5-0 (-> *display* bg-clock)) + (let* ((f22-1 (the float (the int f28-1))) + (f24-1 (the float (the int f26-1))) + (f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1)) + ) + (set! sv-32 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) + (set! sv-48 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) + (let* ((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) + (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-32 f20-0)))) + (f1-9 (+ sv-48 (* (- f28-1 f22-1) (- f1-6 sv-48)))) + (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) + (f0-23 (-> gp-0 faded-scale)) + ) + (if (< f0-23 0.0) + (set! f0-23 (-> gp-0 global-scale)) + ) + (+ f30-0 (* 0.0078125 f1-12 f0-23)) + ) + ) + ) + ) + ) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/physics/chain-physics-h_REF.gc b/test/decompiler/reference/jak2/engine/physics/chain-physics-h_REF.gc index 5f7ca6eba4..2ece3b96bf 100644 --- a/test/decompiler/reference/jak2/engine/physics/chain-physics-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/chain-physics-h_REF.gc @@ -75,9 +75,9 @@ (turn-off (_type_ time-frame) none :behavior process 10) (update (_type_ process-drawable) none :behavior process 11) (gravity-update (_type_) none 12) - (apply-gravity (_type_ vector int) none :behavior process 13) + (apply-gravity (_type_ vector int process-drawable) none :behavior process 13) (chain-physics-method-14 (_type_ vector int) none 14) - (clamp-length (_type_ vector vector) vector 15) + (clamp-length (_type_ vector vector object process-drawable) vector 15) (chain-physics-method-16 (_type_ int) float 16) (chain-physics-method-17 (_type_ vector) none 17) ) diff --git a/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc b/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc index bf57fd7886..95d552dc3a 100644 --- a/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc @@ -11,7 +11,7 @@ ;; definition for method 13 of type chain-physics ;; WARN: Return type mismatch int vs none. -(defmethod apply-gravity chain-physics ((obj chain-physics) (arg0 vector) (arg1 int)) +(defmethod apply-gravity chain-physics ((obj chain-physics) (arg0 vector) (arg1 int) (arg2 process-drawable)) (vector-float*! arg0 (-> obj gravity) @@ -34,7 +34,7 @@ ) ;; definition for method 15 of type chain-physics -(defmethod clamp-length chain-physics ((obj chain-physics) (arg0 vector) (arg1 vector)) +(defmethod clamp-length chain-physics ((obj chain-physics) (arg0 vector) (arg1 vector) (arg2 object) (arg3 process-drawable)) (let ((gp-0 (new 'stack-no-clear 'vector))) (vector-! gp-0 arg0 arg1) (vector-normalize! gp-0 (-> obj joint-length)) @@ -155,7 +155,7 @@ (vector-negate! s1-0 s1-0) ) (set! sv-288 (new 'stack-no-clear 'vector)) - (apply-gravity obj sv-288 s0-0) + (apply-gravity obj sv-288 s0-0 arg0) (let ((v1-34 sv-528)) (let ((a0-10 sv-528)) (.mov.vf vf6 vf0 :mask #b1000) @@ -178,7 +178,7 @@ (.svf (&-> v1-40 quad) vf6) ) ) - (clamp-length obj sv-528 s3-0) + (clamp-length obj sv-528 s3-0 s0-0 arg0) (set! sv-400 (new 'stack-no-clear 'vector)) (let ((v1-43 sv-528) (a0-16 s3-0) diff --git a/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc b/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc index e4533214af..d64663578e 100644 --- a/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech_suit/mech-states_REF.gc @@ -31,7 +31,7 @@ (defstate target-mech-start (target) :event target-mech-handler :exit target-mech-exit - :code (the-as (function handle none :behavior target) target-mech-init) + :code target-mech-init :post target-post ) @@ -2866,7 +2866,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/target/target-h_REF.gc b/test/decompiler/reference/jak2/engine/target/target-h_REF.gc index eeb367fc38..d6cfbea715 100644 --- a/test/decompiler/reference/jak2/engine/target/target-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-h_REF.gc @@ -184,7 +184,7 @@ (target-mech-jump float float surface) target-mech-punch target-mech-stance - (target-mech-start handle) + (target-mech-start handle float symbol) target-mech-walk target-pilot-edge-grab (target-pilot-start handle) diff --git a/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc index 377679ddd3..f4c89a52e9 100644 --- a/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc @@ -1244,13 +1244,15 @@ (if *debug-segment* (load-package "mechp" global) ) - enter-state - (let ((a0-101 (process->handle (the-as process (-> arg3 param 1))))) - (if (>= arg1 2) - (-> arg3 param 2) - #x42c80000 - ) - (go target-mech-start (the-as handle a0-101)) + (go + target-mech-start + (process->handle (the-as process (-> arg3 param 1))) + (the-as float (if (>= arg1 2) + (the-as int (-> arg3 param 2)) + #x42c80000 + ) + ) + #f ) ) ((= v1-45 'indax) diff --git a/test/decompiler/reference/jak2/levels/underport/centipede_REF.gc b/test/decompiler/reference/jak2/levels/underport/centipede_REF.gc new file mode 100644 index 0000000000..0466659665 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/centipede_REF.gc @@ -0,0 +1,1483 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type centipede-cam +(deftype centipede-cam (structure) + ((init? symbol :offset-assert 0) + (trans vector :inline :offset-assert 16) + (dir vector :inline :offset-assert 32) + (track-focus-tilt float :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + +;; definition for method 3 of type centipede-cam +(defmethod inspect centipede-cam ((obj centipede-cam)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'centipede-cam) + (format #t "~1Tinit?: ~A~%" (-> obj init?)) + (format #t "~1Ttrans: #~%" (-> obj trans)) + (format #t "~1Tdir: #~%" (-> obj dir)) + (format #t "~1Ttrack-focus-tilt: ~f~%" (-> obj track-focus-tilt)) + (label cfg-4) + obj + ) + +;; definition of type centipede +(deftype centipede (nav-enemy) + ((id int8 :offset-assert 604) + (anim-ctr int8 :offset-assert 605) + (focus-pos-hist-count int8 :offset-assert 606) + (legs-sound ambient-sound :offset-assert 608) + (grabbed-focus? symbol :offset-assert 612) + (using-chan1-effects? symbol :offset-assert 616) + (set-camera-mode? symbol :offset-assert 620) + (talking-volume float :offset-assert 624) + (desired-talking-volume float :offset-assert 628) + (legs-volume float :offset-assert 632) + (focus-gnd-height float :offset-assert 636) + (track-focus-tilt float :offset-assert 640) + (bobbing-intensity float :offset-assert 644) + (bobbing trsqv :offset-assert 648) + (src-quat quaternion :inline :offset-assert 656) + (dest-quat quaternion :inline :offset-assert 672) + (cam centipede-cam :inline :offset-assert 688) + (focus-pos-hist vector 15 :inline :offset-assert 752) + ) + :heap-base #x360 + :method-count-assert 189 + :size-assert #x3e0 + :flag-assert #xbd036003e0 + (:methods + (attack () _type_ :state 178) + (attack-failed () _type_ :state 179) + (hidden () _type_ :state 180) + (grab-cam () _type_ :state 181) + (thru-grating () _type_ :state 182) + (centipede-method-183 (_type_) none 183) + (set-chan1-effects (_type_) none 184) + (target-close? (_type_) symbol 185) + (centipede-method-186 (_type_) none 186) + (centipede-method-187 (_type_) none 187) + (centipede-method-188 (_type_) none 188) + ) + ) + +;; definition for method 3 of type centipede +(defmethod inspect centipede ((obj centipede)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type nav-enemy inspect))) + (t9-0 obj) + ) + (format #t "~2Tid: ~D~%" (-> obj id)) + (format #t "~2Tanim-ctr: ~D~%" (-> obj anim-ctr)) + (format #t "~2Tfocus-pos-hist-count: ~D~%" (-> obj focus-pos-hist-count)) + (format #t "~2Tlegs-sound: ~A~%" (-> obj legs-sound)) + (format #t "~2Tgrabbed-focus?: ~A~%" (-> obj grabbed-focus?)) + (format #t "~2Tusing-chan1-effects?: ~A~%" (-> obj using-chan1-effects?)) + (format #t "~2Tset-camera-mode?: ~A~%" (-> obj set-camera-mode?)) + (format #t "~2Ttalking-volume: ~f~%" (-> obj talking-volume)) + (format #t "~2Tdesired-talking-volume: ~f~%" (-> obj desired-talking-volume)) + (format #t "~2Tlegs-volume: ~f~%" (-> obj legs-volume)) + (format #t "~2Tfocus-gnd-height: ~f~%" (-> obj focus-gnd-height)) + (format #t "~2Ttrack-focus-tilt: ~f~%" (-> obj track-focus-tilt)) + (format #t "~2Tbobbing-intensity: ~f~%" (-> obj bobbing-intensity)) + (format #t "~2Tbobbing: ~A~%" (-> obj bobbing)) + (format #t "~2Tsrc-quat: #~%" (-> obj src-quat)) + (format #t "~2Tdest-quat: #~%" (-> obj dest-quat)) + (format #t "~2Tcam: #~%" (-> obj cam)) + (format #t "~2Tfocus-pos-hist[15] @ #x~X~%" (-> obj focus-pos-hist)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-centipede centipede centipede-lod0-jg centipede-idle-ja + ((centipede-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 3 10) + :shadow centipede-shadow-mg + :origin-joint-index 3 + ) + +;; definition for symbol *centipede-nav-enemy-info*, type nav-enemy-info +(define *centipede-nav-enemy-info* + (new 'static 'nav-enemy-info + :use-die-falling #f + :use-victory #f + :use-jump-blocked #f + :debug-draw-neck #f + :jump-debug-draw #f + :move-to-ground #f + :hover-if-no-ground #t + :idle-anim-script (new 'static 'array idle-control-frame 4 + (new 'static 'idle-control-frame :command (ic-cmd push) :param0 #x1e) + (new 'static 'idle-control-frame :command (ic-cmd play) :anim #x3 :param0 #x1 :param1 #x1) + (new 'static 'idle-control-frame) + (new 'static 'idle-control-frame) + ) + :idle-anim 3 + :notice-anim 3 + :hostile-anim -1 + :hit-anim 3 + :knocked-anim -1 + :knocked-land-anim -1 + :die-anim 3 + :die-falling-anim 3 + :victory-anim -1 + :jump-wind-up-anim 3 + :jump-in-air-anim 3 + :jump-land-anim 3 + :neck-joint 4 + :look-at-joint 6 + :bullseye-joint 6 + :sound-hit (static-sound-name "centipede-hit") + :sound-die (static-sound-name "centipede-die") + :notice-distance (meters 500) + :notice-distance-delta (meters 10) + :proximity-notice-distance (meters 500) + :default-hit-points #x3e8 + :gnd-collide-with (collide-spec backgnd) + :movement-gravity (meters -100) + :friction 0.8 + :attack-shove-back (meters 5) + :attack-shove-up (meters 3) + :attack-mode 'generic + :attack-damage 2 + :recover-gnd-collide-with (collide-spec backgnd crate obstacle hit-by-others-list pusher) + :jump-height-min (meters 3) + :jump-height-factor 0.5 + :knocked-seek-ry-clamp 2730.6667 + :knocked-soft-vxz-lo 72089.6 + :knocked-soft-vxz-hi 108134.4 + :knocked-soft-vy-lo 81920.0 + :knocked-soft-vy-hi 122880.0 + :knocked-medium-vxz-lo 147456.0 + :knocked-medium-vxz-hi 196608.0 + :knocked-medium-vy-lo 135168.0 + :knocked-medium-vy-hi 151552.0 + :knocked-hard-vxz-lo 78643.2 + :knocked-hard-vxz-hi 117964.8 + :knocked-hard-vy-lo 183500.8 + :knocked-hard-vy-hi 209715.2 + :knocked-huge-vxz-lo 164659.2 + :knocked-huge-vxz-hi 249036.8 + :knocked-huge-vy-lo 183500.8 + :knocked-huge-vy-hi 217907.2 + :knocked-yellow-vxz-lo 40960.0 + :knocked-yellow-vxz-hi 49152.0 + :knocked-yellow-vy-lo 57344.0 + :knocked-yellow-vy-hi 81920.0 + :knocked-red-vxz-lo 24576.0 + :knocked-red-vxz-hi 196608.0 + :knocked-red-vy-lo 94208.0 + :knocked-red-vy-hi 151552.0 + :knocked-blue-vxz-lo 40960.0 + :knocked-blue-vxz-hi 49152.0 + :knocked-blue-vy-lo 24576.0 + :knocked-blue-vy-hi 81920.0 + :shadow-size (meters 2) + :shadow-max-y (meters 2) + :shadow-min-y (meters -3) + :shadow-locus-dist (meters 150) + :gem-joint -1 + :gem-offset (new 'static 'sphere :r 163840.0) + :callback-info #f + :use-momentum #t + :use-frustration #f + :use-stop-chase #f + :use-circling #f + :use-pacing #f + :walk-anim 3 + :turn-anim -1 + :run-anim 3 + :taunt-anim 3 + :run-travel-speed (meters 6) + :run-acceleration (meters 24) + :run-turning-acceleration (meters 50) + :walk-travel-speed (meters 4) + :walk-acceleration (meters 6) + :walk-turning-acceleration (meters 3) + :maximum-rotation-rate (degrees 90.0) + :notice-nav-radius (meters 7) + :frustration-distance (meters 8) + :frustration-time (seconds 4) + :blocked-time (seconds 0.3) + :circle-dist-lo 20480.0 + :circle-dist-hi 61440.0 + :nav-mesh #f + ) + ) + +;; failed to figure out what this is: +(set! (-> *centipede-nav-enemy-info* fact-defaults) *fact-info-enemy-defaults*) + +;; definition for method 74 of type centipede +(defmethod general-event-handler centipede ((obj centipede) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" + (case arg2 + (('under-break-floor) + (go (method-of-object obj thru-grating)) + ) + (else + ((method-of-type nav-enemy general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + +;; definition for method 7 of type centipede +;; WARN: Return type mismatch nav-enemy vs centipede. +(defmethod relocate centipede ((obj centipede) (arg0 int)) + (if (nonzero? (-> obj bobbing)) + (&+! (-> obj bobbing) arg0) + ) + (if (nonzero? (-> obj legs-sound)) + (&+! (-> obj legs-sound) arg0) + ) + (the-as centipede ((method-of-type nav-enemy relocate) obj arg0)) + ) + +;; definition for method 10 of type centipede +(defmethod deactivate centipede ((obj centipede)) + (when (-> obj set-camera-mode?) + (set! (-> obj set-camera-mode?) #f) + (remove-setting-by-arg0 *setting-control* 'mode-name) + ) + (if (nonzero? (-> obj legs-sound)) + (stop! (-> obj legs-sound)) + ) + ((method-of-type nav-enemy deactivate) obj) + (none) + ) + +;; definition for method 187 of type centipede +;; INFO: Used lq/sq +;; WARN: Return type mismatch float vs none. +(defmethod centipede-method-187 centipede ((obj centipede)) + (with-pp + (let ((centipede-cam (-> obj cam))) + (let ((cam-dir (new 'stack-no-clear 'vector))) + (set! (-> cam-dir quad) (-> centipede-cam dir quad)) + (vector-z-quaternion! (-> centipede-cam dir) (-> obj root-override2 quat)) + (set! (-> centipede-cam dir y) 0.0) + (vector-normalize! (-> centipede-cam dir) 1.0) + (set! (-> centipede-cam trans quad) (-> obj root-override2 trans quad)) + (set! (-> centipede-cam trans y) + (+ 32768.0 + (* (+ (* 2048.0 (cos (* 218.45334 (the float (mod (-> pp clock frame-counter) 300))))) + (* 614.4 (cos (* 68.91272 (the float (mod (-> pp clock frame-counter) 951))))) + ) + (-> obj bobbing-intensity) + ) + (-> centipede-cam trans y) + ) + ) + (if (= (-> obj id) 1) + (set! (-> centipede-cam dir y) -0.574) + (set! (-> centipede-cam dir y) -0.474) + ) + (vector-normalize! (-> centipede-cam dir) 1.0) + (let ((proc (handle->process (-> obj focus handle))) + (s3-0 #f) + ) + (when (and proc (not (and (-> obj next-state) (let ((v1-27 (-> obj next-state name))) + (or (= v1-27 'attack) (= v1-27 'attack-failed)) + ) + ) + ) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (vector-! s2-0 (get-trans (the-as process-focusable proc) 0) (-> obj root-override2 trans)) + (vector-normalize! s2-0 1.0) + (when (>= (vector-dot s2-0 (-> centipede-cam dir)) 0.342) + (let ((f0-23 (fmax + 0.0 + (fmin 8192.0 (atan (-> s2-0 y) (sqrtf (+ (* (-> s2-0 x) (-> s2-0 x)) (* (-> s2-0 z) (-> s2-0 z)))))) + ) + ) + ) + (seek! (-> centipede-cam track-focus-tilt) f0-23 (* 65536.0 (-> pp clock seconds-per-frame))) + ) + (set! s3-0 #t) + ) + ) + ) + (if (not s3-0) + (seek! (-> centipede-cam track-focus-tilt) 0.0 (* 65536.0 (-> pp clock seconds-per-frame))) + ) + ) + (let ((s4-1 (new 'stack-no-clear 'vector)) + (s3-1 (new 'stack-no-clear 'quaternion)) + (s2-1 (new 'stack-no-clear 'matrix)) + ) + (vector-rotate90-around-y! s4-1 (-> centipede-cam dir)) + (set! (-> s4-1 y) 0.0) + (vector-normalize! s4-1 1.0) + (quaternion-vector-angle! s3-1 s4-1 (-> centipede-cam track-focus-tilt)) + (quaternion->matrix s2-1 s3-1) + (vector-matrix*! (-> centipede-cam dir) (-> centipede-cam dir) s2-1) + ) + (cond + ((-> centipede-cam init?) + (set! (-> centipede-cam init?) #f) + ) + (else + (let ((s3-2 (new 'stack-no-clear 'matrix)) + (s4-2 (new 'stack-no-clear 'vector)) + ) + (matrix-from-two-vectors-max-angle! s3-2 (-> centipede-cam dir) cam-dir 8192.0) + (vector-matrix*! s4-2 (-> centipede-cam dir) s3-2) + (matrix-from-two-vectors-smooth! s3-2 s4-2 (-> centipede-cam dir) 65536.0 150) + (vector-matrix*! (-> centipede-cam dir) s4-2 s3-2) + ) + ) + ) + ) + (let ((v1-47 *camera*)) + (when v1-47 + (let ((v1-48 (-> v1-47 slave))) + (when v1-48 + (set! (-> v1-48 0 saved-pt quad) (-> centipede-cam trans quad)) + (let ((s5-1 (-> v1-48 0 tracking))) + (vector-cross! (the-as vector (-> s5-1 inv-mat)) *up-vector* (-> centipede-cam dir)) + (vector-normalize! (the-as vector (-> s5-1 inv-mat)) 1.0) + (vector-cross! (-> s5-1 inv-mat vector 1) (-> centipede-cam dir) (the-as vector (-> s5-1 inv-mat))) + (set! (-> s5-1 inv-mat vector 2 quad) (-> centipede-cam dir quad)) + (set! (-> s5-1 inv-mat vector 0 w) 0.0) + (set! (-> s5-1 inv-mat vector 1 w) 0.0) + (set! (-> s5-1 inv-mat vector 2 w) 0.0) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for method 188 of type centipede +;; WARN: Return type mismatch int vs none. +(defmethod centipede-method-188 centipede ((obj centipede)) + (local-vars (s5-0 art-element)) + (let ((janim (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and janim (= janim (-> obj draw art-group data 4))) + (when (ja-done? 1) + (-> obj draw art-group data 7) + (let ((v1-10 (get-rand-int obj 100)) + (a0-9 (if (> (-> obj skel active-channels) 0) + (-> obj skel root-channel 1 frame-group) + ) + ) + ) + (cond + ((and (= a0-9 (-> obj draw art-group data 7)) (> (-> obj anim-ctr) 0)) + (+! (-> obj anim-ctr) -1) + (set! s5-0 (-> obj draw art-group data 7)) + ) + ((= a0-9 (-> obj draw art-group data 11)) + (set! s5-0 (-> obj draw art-group data 12)) + (set! (-> obj anim-ctr) (get-rand-int-range obj 0 3)) + ) + ((= a0-9 (-> obj draw art-group data 12)) + (let ((v1-20 (-> obj anim-ctr))) + (cond + ((> v1-20 0) + (set! (-> obj anim-ctr) (+ v1-20 -1)) + (set! s5-0 (-> obj draw art-group data 12)) + ) + (else + (set! s5-0 (-> obj draw art-group data 13)) + ) + ) + ) + ) + ((= a0-9 (-> obj draw art-group data 13)) + (set! s5-0 (-> obj draw art-group data 14)) + (set! (-> obj anim-ctr) (get-rand-int-range obj 0 3)) + ) + ((and (= a0-9 (-> obj draw art-group data 14)) (> (-> obj anim-ctr) 0)) + (+! (-> obj anim-ctr) -1) + (set! s5-0 (-> obj draw art-group data 14)) + ) + ((< v1-10 10) + (set! s5-0 (-> obj draw art-group data 11)) + ) + ((< v1-10 30) + (set! s5-0 (-> obj draw art-group data 8)) + ) + ((< v1-10 50) + (set! s5-0 (-> obj draw art-group data 9)) + ) + ((< v1-10 65) + (set! s5-0 (-> obj draw art-group data 10)) + ) + (else + (set! s5-0 (-> obj draw art-group data 7)) + (set! (-> obj anim-ctr) (get-rand-int-range obj 2 6)) + ) + ) + ) + (let ((a0-17 (-> obj skel root-channel 1))) + (set! (-> a0-17 frame-interp 1) 1.0) + (set! (-> obj skel interp-select 0) 192) + (set! (-> obj skel interp-select 1) 0) + (set! (-> a0-17 frame-group) (the-as art-joint-anim s5-0)) + (set! (-> a0-17 param 0) (the float (+ (-> (the-as art-joint-anim s5-0) frames num-frames) -1))) + (set! (-> a0-17 param 1) 1.0) + (set! (-> a0-17 frame-num) 0.0) + (joint-control-channel-group! a0-17 (the-as art-joint-anim s5-0) num-func-seek!) + ) + ) + (let ((a0-18 (-> obj skel root-channel 0))) + (set! (-> a0-18 param 0) 0.7) + (joint-control-channel-group-eval! a0-18 (the-as art-joint-anim #f) num-func-loop!) + ) + (let ((a0-19 (-> obj skel root-channel 1))) + (set! (-> a0-19 param 0) (the float (+ (-> a0-19 frame-group frames num-frames) -1))) + (set! (-> a0-19 param 1) 1.0) + (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + (else + (ja-channel-push! 2 (seconds 0.15)) + (let ((a0-21 (-> obj skel root-channel 0))) + (set! (-> a0-21 frame-group) (the-as art-joint-anim (-> obj draw art-group data 4))) + (set! (-> a0-21 param 0) 0.7) + (joint-control-channel-group! a0-21 (the-as art-joint-anim (-> obj draw art-group data 4)) num-func-loop!) + ) + (let ((a0-22 (-> obj skel root-channel 1))) + (set! (-> a0-22 frame-interp 1) 1.0) + (set! (-> obj skel interp-select 0) 192) + (set! (-> obj skel interp-select 1) 0) + (set! (-> a0-22 frame-group) (the-as art-joint-anim (-> obj draw art-group data 7))) + (set! (-> a0-22 param 0) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 7)) frames num-frames) -1)) + ) + (set! (-> a0-22 param 1) 1.0) + (joint-control-channel-group! a0-22 (the-as art-joint-anim (-> obj draw art-group data 7)) num-func-seek!) + ) + (set! (-> obj anim-ctr) (get-rand-int-range obj 2 6)) + (when (not (-> obj using-chan1-effects?)) + (set! (-> obj using-chan1-effects?) #t) + (let ((v1-106 (-> obj skel effect))) + (set! (-> v1-106 channel-offset) 1) + ) + 0 + ) + ) + ) + ) + (none) + ) + +;; definition for method 184 of type centipede +;; WARN: Return type mismatch int vs none. +(defmethod set-chan1-effects centipede ((obj centipede)) + (when (-> obj using-chan1-effects?) + (set! (-> obj using-chan1-effects?) #f) + (let ((v1-2 (-> obj skel effect))) + (set! (-> v1-2 channel-offset) 0) + ) + 0 + ) + (none) + ) + +;; definition for method 142 of type centipede +;; INFO: Used lq/sq +;; WARN: Return type mismatch quaternion vs none. +(defmethod nav-enemy-method-142 centipede ((obj centipede) (arg0 nav-control)) + (with-pp + (let ((t9-0 (method-of-type nav-enemy nav-enemy-method-142))) + (t9-0 obj arg0) + ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! s5-0 (-> obj root-override2 quat)) + (vector-normalize! s5-0 1.0) + (let ((s3-0 (handle->process (-> obj focus handle))) + (s4-0 #f) + ) + (cond + (s3-0 + (let ((s2-0 (-> obj focus-pos-hist-count))) + (countdown (v1-7 (min 14 s2-0)) + (set! (-> obj focus-pos-hist (+ v1-7 1) quad) (-> obj focus-pos-hist v1-7 quad)) + ) + (set! (-> obj focus-pos-hist 0 quad) (-> (get-trans (the-as process-focusable s3-0) 0) quad)) + (if (< s2-0 15) + (set! (-> obj focus-pos-hist-count) (+ s2-0 1)) + ) + ) + ) + (else + (set! (-> obj focus-pos-hist-count) 0) + 0 + ) + ) + (when s3-0 + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-! s3-1 (-> obj focus-pos-hist (+ (-> obj focus-pos-hist-count) -1)) (-> obj root-override2 trans)) + (vector-normalize! s3-1 1.0) + (when (>= (vector-dot s3-1 s5-0) 0.342) + (let ((f0-9 + (fmax + 0.0 + (fmin 8192.0 (atan (-> s3-1 y) (sqrtf (+ (* (-> s3-1 x) (-> s3-1 x)) (* (-> s3-1 z) (-> s3-1 z)))))) + ) + ) + ) + (set! (-> obj track-focus-tilt) + (seek-with-smooth (-> obj track-focus-tilt) f0-9 (* 5461.3335 (-> pp clock seconds-per-frame)) 0.25 1.0) + ) + ) + (set! s4-0 #t) + ) + ) + ) + (if (not s4-0) + (set! (-> obj track-focus-tilt) + (seek-with-smooth (-> obj track-focus-tilt) 0.0 (* 5461.3335 (-> pp clock seconds-per-frame)) 0.25 1.0) + ) + ) + ) + (let ((s3-2 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'quaternion)) + ) + (vector-rotate90-around-y! s3-2 s5-0) + (quaternion-vector-angle! s4-1 s3-2 (+ 4551.1113 (-> obj track-focus-tilt))) + (quaternion*! (-> obj root-override2 quat) s4-1 (-> obj root-override2 quat)) + ) + ) + (none) + ) + ) + +;; definition for method 60 of type centipede +(defmethod coin-flip? centipede ((obj centipede)) + "@returns The result of a 50/50 RNG roll" + #f + ) + +;; definition for method 98 of type centipede +(defmethod in-aggro-range? centipede ((obj centipede) (arg0 process-focusable) (arg1 vector)) + "Should the enemy activate. +- if `activate-distance` is `0.0`, always true +- otherwise, check if the provided process is close enough +@param proc The process used to distance check +@returns true/false" + (when arg0 + (if (not arg1) + (set! arg1 (get-trans arg0 0)) + ) + (when arg1 + (let* ((f0-0 (-> obj root-override2 trans y)) + (v1-4 (-> obj root-override2)) + (f1-0 (-> v1-4 trans y)) + (a0-2 (-> obj fact-info-override)) + ) + (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) + (let* ((f30-0 (-> obj enemy-info-override notice-nav-radius)) + (f0-1 f30-0) + ) + (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (is-in-mesh? (-> obj nav) arg1 f30-0) + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 107 of type centipede +;; WARN: Return type mismatch process vs process-focusable. +(defmethod get-enemy-target centipede ((obj centipede)) + "@returns the [[process-focusable]] that the enemy is currently focusing on, or [[#f]] otherwise" + (let ((v0-0 (handle->process (-> obj focus handle)))) + (if (and v0-0 (logtest? (-> (the-as process-focusable v0-0) focus-status) (focus-status disable dead grabbed))) + (set! v0-0 (the-as process #f)) + ) + (the-as process-focusable v0-0) + ) + ) + +;; definition for method 185 of type centipede +(defmethod target-close? centipede ((obj centipede)) + "Is the target close enough to attack?" + (let ((targ (get-enemy-target obj))) + (when targ + (let* ((targ-pos (get-trans targ 0)) + (y-off (- (-> targ-pos y) (-> obj root-override2 trans y))) + (dist 28672.0) + ) + (and (>= (* dist dist) (vector-vector-xz-distance-squared (-> obj root-override2 trans) targ-pos)) + (or (>= y-off -12288.0) (or (>= 24576.0 y-off) (logtest? (-> targ focus-status) (focus-status edge-grab)))) + ) + ) + ) + ) + ) + +;; definition for method 183 of type centipede +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod centipede-method-183 centipede ((obj centipede)) + (with-pp + (when (not (and (-> obj next-state) (= (-> obj next-state name) 'thru-grating))) + (centipede-method-187 obj) + (when (= (-> obj id) 2) + (let ((overlap-parms (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> overlap-parms options) (overlaps-others-options)) + (set! (-> overlap-parms collide-with-filter) (the-as collide-spec -1)) + (set! (-> overlap-parms tlist) *touching-list*) + (find-overlapping-shapes (-> obj root-override2) overlap-parms) + ) + ) + (let* ((travel-speed (-> *centipede-nav-enemy-info* run-travel-speed)) + (f0-2 (fmin 1.0 (/ (vector-length (-> obj root-override2 transv)) travel-speed))) + ) + (seek! (-> obj bobbing-intensity) f0-2 (* 4.0 (-> pp clock seconds-per-frame))) + ) + (quaternion-copy! (-> obj bobbing quat) (-> obj root-override2 quat)) + (set! (-> obj bobbing trans quad) (-> obj root-override2 trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (f30-1 (* 2662.4 (cos (* 283.70563 (the float (mod (-> pp clock frame-counter) 231)))))) + (bob-trans (-> obj bobbing trans)) + ) + (vector-z-quaternion! s5-0 (-> obj root-override2 quat)) + (set! (-> s5-0 y) 0.0) + (vector-normalize! s5-0 (* f30-1 (-> obj bobbing-intensity))) + (vector+! (the-as vector (&-> bob-trans x)) (the-as vector (&-> bob-trans x)) s5-0) + ) + ) + (update-trans! (-> obj sound) (-> obj root-override2 trans)) + (when (!= (-> obj talking-volume) (-> obj desired-talking-volume)) + (seek! (-> obj talking-volume) (-> obj desired-talking-volume) (* 4.0 (-> pp clock seconds-per-frame))) + (update-vol! (-> obj sound) (-> obj talking-volume)) + ) + (update! (-> obj sound)) + (update-trans! (-> obj legs-sound) (-> obj root-override2 trans)) + (let ((f0-20 (fmin 1.0 (* 0.00012207031 (vector-length (-> obj root-override2 transv)))))) + (when (!= (-> obj legs-volume) f0-20) + (seek! (-> obj legs-volume) f0-20 (* 4.0 (-> pp clock seconds-per-frame))) + (update-vol! (-> obj legs-sound) (-> obj legs-volume)) + ) + ) + (update! (-> obj legs-sound)) + (none) + ) + ) + +;; definition for method 55 of type centipede +;; INFO: Used lq/sq +(defmethod track-target! centipede ((obj centipede)) + "Does a lot of various things relating to interacting with the target +- tracks when the enemy was last drawn +- looks at the target and handles attacking +@TODO Not extremely well understood yet" + (with-pp + (let ((t9-0 (method-of-type nav-enemy track-target!))) + (t9-0 obj) + ) + (let ((a0-3 (handle->process (-> obj focus handle)))) + (when a0-3 + (let ((f0-0 (-> (get-trans (the-as process-focusable a0-3) 1) y))) + (if (!= f0-0 -40959590.0) + (set! (-> obj focus-gnd-height) f0-0) + ) + ) + ) + ) + (let ((s5-0 (-> obj root-override2))) + (set! (-> s5-0 gspot-pos quad) (-> s5-0 trans quad)) + (let ((v1-12 (-> obj nav)) + (a0-8 (-> s5-0 trans)) + (a1-2 (new 'stack-no-clear 'nav-find-poly-parms)) + ) + (vector-! (-> a1-2 point) a0-8 (-> v1-12 state mesh bounds)) + (set! (-> a1-2 y-threshold) (-> v1-12 nearest-y-threshold)) + (set! (-> a1-2 ignore) (the-as uint 2)) + (let ((a1-3 (find-poly-containing-point-local (-> v1-12 state mesh) a1-2)) + (s4-0 (new 'stack-no-clear 'collide-query)) + ) + (when a1-3 + (let ((s2-0 (-> obj nav)) + (s3-0 (-> s4-0 best-other-tri intersect)) + ) + (let ((a3-2 (-> s4-0 best-other-tri normal)) + (v1-15 (-> s5-0 trans)) + ) + (project-point-onto-plane-of-poly-local + (-> s2-0 state mesh) + a1-3 + s3-0 + a3-2 + (vector-! (new 'stack-no-clear 'vector) v1-15 (-> s2-0 state mesh bounds)) + ) + ) + (vector+! s3-0 s3-0 (-> s2-0 state mesh bounds)) + ) + 0 + (let ((f0-2 1024.0)) + (if (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> s4-0 best-other-tri intersect) (-> s5-0 trans))) + (set! (-> s5-0 gspot-pos y) (-> s4-0 best-other-tri intersect y)) + ) + ) + ) + ) + ) + (let ((f0-6 (-> obj root-override2 trans y))) + (cond + ((>= (-> s5-0 gspot-pos y) f0-6) + (set! (-> s5-0 trans y) (-> s5-0 gspot-pos y)) + ) + ((and (!= (-> obj focus-gnd-height) -40959590.0) + (>= (- (-> obj focus-gnd-height) (-> s5-0 gspot-pos y)) 4096.0) + ) + (set! (-> s5-0 trans y) (seek-with-smooth + (-> s5-0 trans y) + (-> obj focus-gnd-height) + (* 24576.0 (-> pp clock seconds-per-frame)) + 0.25 + 1.0 + ) + ) + ) + (else + (set! (-> s5-0 trans y) (seek-with-smooth + (-> s5-0 trans y) + (-> s5-0 gspot-pos y) + (* 24576.0 (-> pp clock seconds-per-frame)) + 0.25 + 1.0 + ) + ) + ) + ) + ) + ) + (centipede-method-183 obj) + (none) + ) + ) + +;; definition for method 116 of type centipede +;; WARN: Return type mismatch object vs none. +(defmethod go-idle centipede ((obj centipede)) + (case (-> obj id) + ((1) + (cond + ((or (not *target*) + (task-node-closed? (game-task-node under-sig-centipede1-end)) + (and *debug-segment* (cpad-hold? 0 l2)) + ) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ((task-node-closed? (game-task-node under-sig-centipede1-start)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (go (method-of-object obj grab-cam)) + ) + (else + (go (method-of-object obj hidden)) + ) + ) + ) + ((2) + (cond + ((or (not *target*) + (task-node-closed? (game-task-node under-sig-resolution)) + (and *debug-segment* (cpad-hold? 0 l2)) + ) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + ((task-node-closed? (game-task-node under-sig-centipede2-start)) + (logclear! (-> obj mask) (process-mask actor-pause)) + (logclear! (-> obj enemy-flags) (enemy-flag notice)) + (process-entity-status! obj (entity-perm-status no-kill) #t) + (go (method-of-object obj grab-cam)) + ) + (else + (go (method-of-object obj hidden)) + ) + ) + ) + (else + (go process-drawable-art-error "bad centipede id") + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate hidden (centipede) + :virtual #t + :enter (behavior () + (logior! (-> self focus-status) (focus-status disable)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 0.0) + (let ((v1-5 (-> self root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (collide-spec)) + (set! (-> v1-5 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (none) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-5 (-> self root-override2 root-prim))) + (set! (-> v1-5 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-5 prim-core collide-with) (-> self root-override2 backup-collide-with)) + ) + (none) + ) + :code (the-as (function none :behavior centipede) sleep-code) + ) + +;; failed to figure out what this is: +(defstate grab-cam (centipede) + :virtual #t + :exit (behavior () + (set-chan1-effects self) + (none) + ) + :code (behavior () + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (set! (-> self desired-talking-volume) 0.0) + (centipede-method-187 self) + (set-setting! 'interp-time 'abs 0 0) + (when (not (-> self set-camera-mode?)) + (set! (-> self set-camera-mode?) #t) + (set-setting-by-param *setting-control* 'mode-name 'cam-fixed 0 0) + ) + (set-setting! 'allow-look-around #f 0 0) + (suspend) + (until #f + (let ((v1-13 *camera*)) + (when (and v1-13 (-> v1-13 slave)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory called-dying)) + (set! (-> self enemy-flags) (logior (enemy-flag dangerous-backup) (-> self enemy-flags))) + (logclear! (-> self mask) (process-mask actor-pause)) + (go-hostile self) + ) + ) + (centipede-method-188 self) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy idle) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy idle) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :code (behavior () + (until #f + (cond + (*target* + (set! (-> self state-time) (-> self clock frame-counter)) + ) + (else + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (cleanup-for-death self) + (go-virtual die-fast) + ) + ) + ) + (centipede-method-188 self) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior centipede) nav-enemy-simple-post) + ) + +;; failed to figure out what this is: +(defstate active (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy active) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy active) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :code (-> (method-of-type centipede idle) code) + :post (-> (method-of-type centipede idle) post) + ) + +;; failed to figure out what this is: +(defstate stare (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy stare) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy stare) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :code (-> (method-of-type centipede idle) code) + ) + +;; failed to figure out what this is: +(defstate hostile (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy hostile) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy hostile) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (let ((v1-6 (handle->process (-> self focus handle)))) + (if (or (not v1-6) (logtest? (-> (the-as process-focusable v1-6) focus-status) (focus-status dead))) + (go-virtual stop-chase) + ) + ) + ) + (let ((t9-1 (-> (method-of-type nav-enemy hostile) trans))) + (if t9-1 + (t9-1) + ) + ) + (if (target-close? self) + (go-virtual attack) + ) + (none) + ) + :code (the-as (function none :behavior centipede) sleep-code) + :post (behavior () + (centipede-method-188 self) + (let ((a0-2 (handle->process (-> self focus handle)))) + (when a0-2 + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> (get-trans (the-as process-focusable a0-2) 0) quad)) + (set! (-> gp-0 y) (-> self root-override2 trans y)) + (let ((v1-12 (-> self nav state))) + (logclear! (-> v1-12 flags) (nav-state-flag directional-mode)) + (logior! (-> v1-12 flags) (nav-state-flag target-poly-dirty)) + (set! (-> v1-12 target-post quad) (-> gp-0 quad)) + ) + ) + 0 + ) + ) + (nav-enemy-method-176 self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate stop-chase (centipede) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type nav-enemy stop-chase) enter))) + (if t9-0 + (t9-0) + ) + ) + (stop-looking-at-target! self) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (let ((t9-1 (-> (method-of-type nav-enemy stop-chase) exit))) + (if t9-1 + (t9-1) + ) + ) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (react-to-focus self) + ) + (none) + ) + :code (the-as (function none :behavior centipede) sleep-code) + :post (behavior () + (centipede-method-188 self) + (nav-enemy-method-176 self) + (none) + ) + ) + +;; definition for method 186 of type centipede +;; INFO: Used lq/sq +;; WARN: Return type mismatch quaternion vs none. +(defmethod centipede-method-186 centipede ((obj centipede)) + (with-pp + (let ((proc (handle->process (-> obj focus handle)))) + (when proc + (set! (-> obj focus-pos quad) (-> (get-trans (the-as process-focusable proc) 0) quad)) + (when (and (not (-> obj grabbed-focus?)) (= (-> proc type) target) (>= (ja-frame-num 0) 5.0)) + (let ((msg (new 'stack-no-clear 'event-message-block))) + (set! (-> msg from) (process->ppointer pp)) + (set! (-> msg num-params) 2) + (set! (-> msg message) 'attack-invinc) + (set! (-> msg param 0) (the-as uint #f)) + (let ((v1-16 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-9 *game-info*) + (a2-1 (+ (-> a0-9 attack-id) 1)) + ) + (set! (-> a0-9 attack-id) a2-1) + (set! (-> v1-16 id) a2-1) + ) + (set! (-> v1-16 mode) 'centipede) + (set! (-> msg param 1) (the-as uint v1-16)) + ) + (if (send-event-function proc msg) + (set! (-> obj grabbed-focus?) #t) + ) + ) + ) + (when (not (-> obj grabbed-focus?)) + (let ((s5-1 (new 'stack-no-clear 'vector))) + (let ((cam-dir (new 'stack-no-clear 'vector)) + (trans-off (new 'stack-no-clear 'vector)) + ) + (let ((s2-0 (new 'stack-no-clear 'matrix))) + (set! (-> cam-dir quad) (-> obj cam dir quad)) + (set! (-> cam-dir y) 0.0) + (vector-normalize! cam-dir 1.0) + (vector-! trans-off (-> obj focus-pos) (-> obj root-override2 trans)) + (set! (-> s5-1 quad) (-> trans-off quad)) + (set! (-> s5-1 y) 0.0) + (vector-normalize! s5-1 1.0) + (matrix-from-two-vectors-max-angle! s2-0 cam-dir s5-1 7281.778) + (vector-matrix*! s5-1 cam-dir s2-0) + ) + (let ((v1-25 s5-1) + (a0-22 s5-1) + (a1-9 trans-off) + ) + (vector-float*! v1-25 a0-22 (sqrtf (+ (* (-> a1-9 x) (-> a1-9 x)) (* (-> a1-9 z) (-> a1-9 z))))) + ) + (set! (-> s5-1 y) (+ 49152.0 (-> trans-off y))) + ) + (vector-normalize! s5-1 1.0) + (quaternion-look-at! (-> obj dest-quat) s5-1 *up-vector*) + ) + ) + ) + ) + (let ((f0-12 (fmin 1.0 (* 0.16666667 (ja-frame-num 0))))) + (quaternion-slerp! (-> obj root-override2 quat) (-> obj src-quat) (-> obj dest-quat) f0-12) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate attack (centipede) + :virtual #t + :enter (behavior () + (let ((v1-0 self)) + (set! (-> v1-0 enemy-flags) (the-as enemy-flag (logclear (-> v1-0 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (set! (-> self enemy-flags) (logior (enemy-flag actor-pause-backup) (-> self enemy-flags))) + (set! (-> self grabbed-focus?) #f) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 0.0) + (let ((gp-0 (handle->process (-> self focus handle)))) + (if (not gp-0) + (go-hostile self) + ) + (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable gp-0) 0) quad)) + ) + (quaternion-copy! (-> self src-quat) (-> self root-override2 quat)) + (quaternion-copy! (-> self dest-quat) (-> self src-quat)) + (none) + ) + :exit (behavior () + (logclear! (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (none) + ) + :trans (behavior () + (when (-> self grabbed-focus?) + (let ((v1-3 (handle->process (-> self focus handle)))) + (if v1-3 + (vector-seek-3d-smooth! + (-> (the-as process-focusable v1-3) root-override trans) + (-> self root-override2 trans) + (* 28672.0 (-> self clock seconds-per-frame)) + 0.8 + ) + ) + ) + ) + (none) + ) + :code (behavior () + (local-vars (a1-5 event-message-block)) + (ja-channel-push! 1 (seconds 0.17)) + (ja-no-eval :group! centipede-attack0-ja + :num! (seek! (the float (+ (-> (the-as art-joint-anim centipede-attack0-ja) frames num-frames) -1)) 3.0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (centipede-method-186 self) + (suspend) + (ja :num! (seek! max 3.0)) + ) + (if (not (-> self grabbed-focus?)) + (go-virtual attack-failed) + ) + (ja-no-eval :group! centipede-eat0-ja + :num! (seek! (the float (+ (-> (the-as art-joint-anim centipede-eat0-ja) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (when (-> self grabbed-focus?) + (until (send-event-function *target* a1-5) + (suspend) + (set! a1-5 (new 'stack-no-clear 'event-message-block)) + (let ((v1-57 (process->ppointer self))) + (set! (-> a1-5 from) v1-57) + ) + (set! (-> a1-5 num-params) 0) + (set! (-> a1-5 message) 'end-mode) + ) + ) + (go-hostile self) + (none) + ) + :post (behavior () + (transform-post) + (centipede-method-183 self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate attack-failed (centipede) + :virtual #t + :exit (behavior () + (set-chan1-effects self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self desired-talking-volume) 1.0) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.35)) + (let* ((v1-5 (- (-> self clock frame-counter) (-> self state-time))) + (f1-2 (* 0.00952381 (the float v1-5))) + ) + (quaternion-slerp! (-> self root-override2 quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (* f1-2 f1-2))) + ) + (centipede-method-188 self) + (suspend) + ) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (centipede-method-188 self) + (suspend) + ) + (go-hostile self) + (none) + ) + :post (-> (method-of-type centipede attack) post) + ) + +;; failed to figure out what this is: +(defstate thru-grating (centipede) + :virtual #t + :enter (behavior () + (let ((v1-0 self)) + (set! (-> v1-0 enemy-flags) (the-as enemy-flag (logclear (-> v1-0 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-0 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (vector-reset! (-> self root-override2 transv)) + (set! (-> self desired-talking-volume) 1.0) + (none) + ) + :exit (behavior () + (set-chan1-effects self) + (none) + ) + :code (behavior () + (logior! (-> self focus-status) (focus-status disable)) + (let ((v1-3 (-> self root-override2 root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (when (-> self set-camera-mode?) + (set! (-> self set-camera-mode?) #f) + (remove-setting-by-arg0 *setting-control* 'mode-name) + ) + (remove-setting! 'allow-look-around) + (set-setting! 'entity-name "camera-252" 0 0) + (centipede-method-188 self) + (suspend) + (suspend) + (remove-setting! 'interp-time) + (remove-setting! 'entity-name) + (logior! (-> self draw status) (draw-control-status no-draw)) + (cleanup-for-death self) + (sleep-code) + (none) + ) + :post (behavior () + (centipede-method-183 self) + (none) + ) + ) + +;; definition for method 114 of type centipede +;; WARN: Return type mismatch collide-shape-moving vs none. +(defmethod init-enemy-collision! centipede ((obj centipede)) + "Initializes the [[collide-shape-moving]] and any ancillary tasks to make the enemy collide properly" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 9) 0))) + (set! (-> s5-0 total-prims) (the-as uint 10)) + (set! (-> s4-0 prim-core collide-as) (collide-spec enemy)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> s4-0 prim-core action) (collide-action solid semi-solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 12288.0 40960.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-13 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set! (-> v1-13 transform-index) 3) + (set-vector! (-> v1-13 local-sphere) 0.0 -4096.0 -8192.0 14336.0) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 -4096.0 6144.0 13721.6) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-17 prim-core action) (collide-action solid)) + (set! (-> v1-17 transform-index) 3) + (set-vector! (-> v1-17 local-sphere) 0.0 -4096.0 12288.0 13312.0) + ) + (let ((v1-19 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-19 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-19 prim-core action) (collide-action solid)) + (set! (-> v1-19 transform-index) 7) + (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 7782.4) + ) + (let ((v1-21 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-21 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-21 prim-core action) (collide-action solid)) + (set! (-> v1-21 transform-index) 7) + (set-vector! (-> v1-21 local-sphere) 4096.0 12288.0 0.0 3686.4) + ) + (let ((v1-23 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-23 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-23 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-23 prim-core action) (collide-action semi-solid)) + (set! (-> v1-23 transform-index) 7) + (set-vector! (-> v1-23 local-sphere) 3276.8 20480.0 0.0 2457.6) + ) + (let ((v1-25 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-25 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-25 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-25 prim-core action) (collide-action solid)) + (set! (-> v1-25 transform-index) 8) + (set-vector! (-> v1-25 local-sphere) 0.0 0.0 0.0 7782.4) + ) + (let ((v1-27 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-27 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-27 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-27 prim-core action) (collide-action solid)) + (set! (-> v1-27 transform-index) 8) + (set-vector! (-> v1-27 local-sphere) -4096.0 12288.0 0.0 3686.4) + ) + (let ((v1-29 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-29 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-29 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list pusher)) + (set! (-> v1-29 prim-core action) (collide-action semi-solid)) + (set! (-> v1-29 transform-index) 8) + (set-vector! (-> v1-29 local-sphere) -3276.8 20480.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-32 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-32 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-32 prim-core collide-with)) + ) + (set! (-> s5-0 event-other) 'centipede) + (set! (-> obj root-override2) s5-0) + ) + (none) + ) + +;; definition for method 115 of type centipede +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy! centipede ((obj centipede)) + "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" + (set! (-> obj id) (res-lump-value (-> obj entity) 'extra-id int :time -1000000000.0)) + (set! (-> obj cam init?) #t) + (set! (-> obj using-chan1-effects?) #f) + (set! (-> obj set-camera-mode?) #f) + (set! (-> obj focus-gnd-height) -40959590.0) + (set! (-> obj bobbing-intensity) 1.0) + (set-vector! (-> obj root-override2 scale) 0.75 0.75 0.75 1.0) + (set! (-> obj root-override2 trans y) (+ 4096.0 (-> obj root-override2 trans y))) + (case (-> obj id) + ((1) + (let ((v1-10 (-> obj root-override2))) + (set-vector! (-> v1-10 quat) -0.2103 -0.2293 -0.0508 0.949) + (set! (-> v1-10 trans x) -248325.33) + (set! (-> v1-10 trans z) 8201697.0) + ) + (set! (-> *centipede-nav-enemy-info* run-travel-speed) 32768.0) + ) + ((2) + (let ((v1-16 (-> obj root-override2))) + (set-vector! (-> v1-16 quat) -0.1832 0.519 0.115 0.827) + (set! (-> v1-16 trans x) -1001253.25) + (set! (-> v1-16 trans z) 7913366.5) + ) + (set! (-> *centipede-nav-enemy-info* run-travel-speed) 30720.0) + ) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-centipede" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj skel generate-frame-function) create-interpolated2-joint-animation-frame) + (init-enemy-behaviour-and-stats! obj *centipede-nav-enemy-info*) + (logclear! (-> obj mask) (process-mask enemy)) + (set! (-> obj mask) (logior (process-mask bot) (-> obj mask))) + (let ((v1-31 (-> obj nav))) + (set! (-> v1-31 sphere-mask) (the-as uint 64)) + ) + 0 + (logclear! (-> obj root-override2 nav-flags) (nav-flags has-root-sphere has-extra-sphere)) + (let ((v1-35 (-> obj nav))) + (set! (-> v1-35 speed-scale) 1.0) + ) + 0 + (set-gravity-length (-> obj root-override2 dynam) 573440.0) + (logclear! (-> obj enemy-flags) (enemy-flag enable-on-active checking-water)) + (set! (-> obj bobbing) (the-as trsqv (new 'process 'joint-mod-set-world obj 3 #t))) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "cent-talk" :fo-max 90) (-> obj root-override2 trans)) + ) + (update-vol! (-> obj sound) 0.0) + (set! (-> obj talking-volume) 0.0) + (set! (-> obj desired-talking-volume) 0.0) + (set! (-> obj legs-sound) + (new 'process 'ambient-sound (static-sound-spec "cent-legs-loop" :fo-max 90) (-> obj root-override2 trans)) + ) + (update-vol! (-> obj sound) 0.0) + (set! (-> obj legs-volume) 0.0) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc b/test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc new file mode 100644 index 0000000000..91052e7ff5 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/pipe-grunt_REF.gc @@ -0,0 +1,131 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type pipe-grunt +(deftype pipe-grunt (grunt) + ((pipe-front vector :inline :offset-assert 704) + (pipe-dir vector :inline :offset-assert 720) + ) + :heap-base #x260 + :method-count-assert 187 + :size-assert #x2e0 + :flag-assert #xbb026002e0 + (:methods + (pipe-grunt-method-186 (_type_) vector 186) + ) + ) + +;; definition for method 3 of type pipe-grunt +(defmethod inspect pipe-grunt ((obj pipe-grunt)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type grunt inspect))) + (t9-0 obj) + ) + (format #t "~2Tpipe-front: #~%" (-> obj pipe-front)) + (format #t "~2Tpipe-dir: #~%" (-> obj pipe-dir)) + (label cfg-4) + obj + ) + +;; definition for method 66 of type pipe-grunt +;; WARN: Return type mismatch object vs none. +(defmethod go-ambush pipe-grunt ((obj pipe-grunt)) + (go (method-of-object obj ambush)) + (none) + ) + +;; definition for method 186 of type pipe-grunt +(defmethod pipe-grunt-method-186 pipe-grunt ((obj pipe-grunt)) + (let ((gp-0 (new 'static 'vector :x -1187061.8 :y -278487.03 :z 8090870.0 :w 1.0))) + (let ((v1-0 (new 'static 'vector :x -1148026.9 :y -278487.03 :z 8112414.5 :w 1.0)) + (s3-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-! s3-0 v1-0 gp-0) + (let ((f30-0 (vector-length s3-0))) + (vector-normalize! s3-0 1.0) + (vector-rotate90-around-y! s4-0 s3-0) + (vector-normalize-copy! (-> obj event-param-point) s3-0 (get-rand-float-range obj 0.0 f30-0)) + ) + (vector-normalize! s4-0 (get-rand-float-range obj -16384.0 16384.0)) + (vector+! (-> obj event-param-point) (-> obj event-param-point) s4-0) + ) + (vector+! (-> obj event-param-point) (-> obj event-param-point) gp-0) + ) + ) + +;; failed to figure out what this is: +(defstate ambush (pipe-grunt) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior pipe-grunt) enemy-event-handler) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (logior! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice alert victory)) + (let ((v1-7 (-> self root-override2 root-prim))) + (set! (-> v1-7 prim-core collide-as) (-> self root-override2 backup-collide-as)) + (set! (-> v1-7 prim-core collide-with) (-> self root-override2 backup-collide-with)) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-10 self)) + (set! (-> v1-10 enemy-flags) (the-as enemy-flag (logclear (-> v1-10 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-10 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (set-vector! (-> self pipe-front) -1198776.4 -224337.92 8087470.0 1.0) + (vector-! (-> self pipe-dir) (-> self pipe-front) (-> self root-override2 trans)) + (vector-normalize! (-> self pipe-dir) 1.0) + (quaternion-look-at! (-> self root-override2 quat) (-> self pipe-dir) *up-vector*) + (set! (-> self charge-anim) (-> *grunt-global-info* charge-anim (get-rand-int self 3))) + (vector-normalize-copy! (-> self root-override2 transv) (-> self pipe-dir) (-> self charge-anim travel-speed)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-rotate90-around-y! gp-0 (-> self pipe-dir)) + (vector-normalize! gp-0 (get-rand-float-range self -4096.0 4096.0)) + (move-by-vector! (-> self root-override2) gp-0) + ) + (none) + ) + :trans (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self root-override2 trans quad)) + (vector-v++! gp-0 (-> self root-override2 transv)) + (move-to-point! (-> self root-override2) gp-0) + (let ((v1-4 (new 'stack-no-clear 'vector))) + (vector-! v1-4 (-> self pipe-front) gp-0) + (when (< (vector-dot v1-4 (-> self pipe-dir)) 0.0) + (pipe-grunt-method-186 self) + (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag vulnerable)))) + (send-event self 'jump 0 (-> self event-param-point)) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((f30-0 (get-rand-float-range self 0.9 1.1))) + (ja-channel-push! 1 0) + (until #f + (let ((a1-2 (-> self draw art-group data (-> self charge-anim anim-index)))) + (ja-no-eval :group! a1-2 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1)) f30-0) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior pipe-grunt) nav-enemy-simple-post) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc b/test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc new file mode 100644 index 0000000000..3f78de16ed --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/sig5-course_REF.gc @@ -0,0 +1,1996 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type sig5-course +(deftype sig5-course (bot-course) + ((chase-speeches bot-speech-list-shuffle :offset-assert 48) + ) + :method-count-assert 9 + :size-assert #x34 + :flag-assert #x900000034 + ) + +;; definition for method 3 of type sig5-course +(defmethod inspect sig5-course ((obj sig5-course)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tcourse-id: ~D~%" (-> obj course-id)) + (format #t "~1Tspeech-count: ~D~%" (-> obj speech-count)) + (format #t "~1Tspot-count: ~D~%" (-> obj spot-count)) + (format #t "~1Tretry-cookie: ~D~%" (-> obj retry-cookie)) + (format #t "~1Ttoo-far-warn-speeches: ~A~%" (-> obj too-far-warn-speeches)) + (format #t "~1Ttoo-far-fail-speeches: ~A~%" (-> obj too-far-fail-speeches)) + (format #t "~1Tattack-player-speeches: ~A~%" (-> obj attack-player-speeches)) + (format #t "~1Tdefault-check-too-far: ~A~%" (-> obj default-check-too-far)) + (format #t "~1Twaypoints: ~A~%" (-> obj waypoints)) + (format #t "~1Tspeeches: #x~X~%" (-> obj speeches)) + (format #t "~1Tspeech-tunings: #x~X~%" (-> obj speech-tunings)) + (format #t "~1Tdirs: #x~X~%" (-> obj dirs)) + (format #t "~1Tspots: #x~X~%" (-> obj spots)) + (format #t "~1Tchase-speeches: ~A~%" (-> obj chase-speeches)) + (label cfg-4) + obj + ) + +;; definition of type sig-under +(deftype sig-under (sig) + ((sig5-course sig5-course :offset 652) + (shot-at-growls-index int8 :offset-assert 1072) + (growls handle 2 :offset-assert 1080) + (next-chase-play-time time-frame :offset 1096) + (grating-broken-time time-frame :offset 1096) + (test-plane plane :inline :offset-assert 1104) + ) + :heap-base #x3e0 + :method-count-assert 265 + :size-assert #x460 + :flag-assert #x10903e00460 + (:methods + (intro-shooting () _type_ :state 259) + (sig-under-method-260 (_type_) symbol 260) + (sig-under-method-261 (_type_ vector vector symbol) symbol 261) + (sig-under-method-262 (_type_ symbol) symbol 262) + (sig-under-method-263 (_type_) none 263) + (sig-under-method-264 (_type_) symbol 264) + ) + ) + +;; definition for method 3 of type sig-under +(defmethod inspect sig-under ((obj sig-under)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type sig inspect))) + (t9-0 obj) + ) + (format #t "~2Tshot-at-growls-index: ~D~%" (-> obj shot-at-growls-index)) + (format #t "~2Tgrowls[2] @ #x~X~%" (-> obj growls)) + (format #t "~2Tnext-chase-play-time: ~D~%" (-> obj next-chase-play-time)) + (format #t "~2Tgrating-broken-time: ~D~%" (-> obj next-chase-play-time)) + (format #t "~2Ttest-plane: #~%" (-> obj test-plane)) + (label cfg-4) + obj + ) + +;; definition for method 263 of type sig-under +;; WARN: Return type mismatch time-frame vs none. +(defmethod sig-under-method-263 sig-under ((obj sig-under)) + (with-pp + (let ((s5-0 (-> pp clock frame-counter))) + (when (and (>= s5-0 (-> obj next-chase-play-time)) + (not (channel-active? obj (the-as uint 0))) + (>= (the-as int (sig-method-256 obj)) 750) + ) + (let ((a1-2 (bot-speech-list-method-9 + (-> obj sig5-course chase-speeches) + obj + (-> obj sig5-course speeches) + (speech-flags) + ) + ) + ) + (when (>= a1-2 0) + (play-speech obj a1-2) + (set! (-> obj next-chase-play-time) (+ s5-0 (get-rand-int-range obj 1500 2700))) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for method 195 of type sig-under +;; WARN: Return type mismatch object vs symbol. +(defmethod attacked-by-player? sig-under ((obj sig-under) (arg0 process-focusable)) + "Were we attacked by the player?" + (the-as + symbol + (and (and arg0 (zero? (logand (-> arg0 focus-status) (focus-status disable dead ignore grabbed)))) + (or (and (logtest? (process-mask enemy) (-> arg0 mask)) (zero? (logand (bot-flags bf26) (-> obj bot-flags)))) + (and (logtest? (-> arg0 mask) (process-mask target)) (logtest? (-> obj bot-flags) (bot-flags attacked))) + ) + ) + ) + ) + +;; definition for method 86 of type sig-under +(defmethod enemy-method-86 sig-under ((obj sig-under)) + (let ((gp-0 (-> obj root-override2))) + (when (< (-> gp-0 transv y) 0.0) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + (find-ground (-> obj root-override2) a1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + ) + (>= (-> gp-0 gspot-pos y) (-> gp-0 trans y)) + ) + ) + ) + +;; definition for method 76 of type sig-under +;; WARN: Return type mismatch object vs symbol. +(defmethod enemy-method-76 sig-under ((obj sig-under) (arg0 process) (arg1 event-message-block)) + (with-pp + (the-as + symbol + (cond + ((and (and (-> obj next-state) (= (-> obj next-state name) 'jump)) (type? arg0 under-break-floor)) + (let ((v1-5 (-> arg1 param 0)) + (a1-2 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) v1-5) + (let ((v1-6 (new 'static 'attack-info :mask (attack-info-mask id penetrate-using)))) + (let* ((a0-6 *game-info*) + (a2-3 (+ (-> a0-6 attack-id) 1)) + ) + (set! (-> a0-6 attack-id) a2-3) + (set! (-> v1-6 id) a2-3) + ) + (set! (-> v1-6 penetrate-using) (penetrate flop)) + (set! (-> a1-2 param 1) (the-as uint v1-6)) + ) + (send-event-function arg0 a1-2) + ) + ) + (else + ((method-of-type sig enemy-method-76) obj arg0 arg1) + ) + ) + ) + ) + ) + +;; definition for method 74 of type sig-under +(defmethod general-event-handler sig-under ((obj sig-under) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + "Handles various events for the enemy +@TODO - unsure if there is a pattern for the events and this should have a more specific name" + (with-pp + (case arg2 + (('set-task) + (let* ((s1-1 (logtest? (-> obj bot-task-bits) 16)) + (t9-0 (method-of-type sig general-event-handler)) + (s5-1 (t9-0 obj arg0 arg1 arg2 arg3)) + ) + (when (and (not s1-1) (logtest? (-> obj bot-task-bits) 16)) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'under-break-floor) + (let ((t9-1 send-event-function) + (v1-11 (-> obj actor-group 0 data 8 actor)) + ) + (t9-1 + (if v1-11 + (-> v1-11 extra process) + ) + a1-2 + ) + ) + ) + ) + s5-1 + ) + ) + (('centipede-chase) + (let ((v1-14 *sig5-cent1-path0*)) + (if (= (-> arg3 param 0) 2) + (set! v1-14 *sig5-cent2-path0*) + ) + (send-event obj 'sig-path v1-14) + ) + ) + (('notify) + (if (and (type? arg0 sig-shot) + (= (-> arg3 param 0) 'die) + (-> obj next-state) + (= (-> obj next-state name) 'intro-shooting) + ) + (send-event (handle->process (-> obj growls (-> obj shot-at-growls-index))) 'sig-shot) + ((method-of-type sig general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + (else + ((method-of-type sig general-event-handler) obj arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +;; definition for method 262 of type sig-under +;; WARN: disable def twice: 39. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod sig-under-method-262 sig-under ((obj sig-under) (arg0 symbol)) + (when (or (logtest? (-> obj bot-task-bits) 2) + (and arg0 + (let ((f0-0 81920.0)) + (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> obj root-override2 trans))) + ) + ) + ) + (cond + ((speech-playing? obj 7) + (and (not (channel-active? obj (the-as uint 0))) (scene-play obj "under-centipede-one" #f)) + ) + (else + (play-speech obj 7) + (reset-warn-time! obj) + #f + ) + ) + ) + ) + +;; definition for method 264 of type sig-under +(defmethod sig-under-method-264 sig-under ((obj sig-under)) + (and (logtest? (-> obj bot-task-bits) 8) + (not (channel-active? obj (the-as uint 0))) + (scene-play obj "under-get-sig-out-res" #f) + ) + ) + +;; definition for method 260 of type sig-under +;; INFO: Used lq/sq +(defmethod sig-under-method-260 sig-under ((obj sig-under)) + (local-vars (a2-5 float) (a2-12 float)) + (rlet ((vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + ) + (let ((gp-0 (new 'stack-no-clear 'sphere))) + (set! (-> gp-0 quad) (-> obj root-override2 trans quad)) + (set! (-> gp-0 r) 327680.0) + (set! *actor-list-length* 0) + (if #t + (set! *actor-list-length* (fill-actor-list-for-sphere *actor-hash* gp-0 *actor-list* 256)) + ) + (when #f + (let ((a0-5 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((v1-12 (-> a0-5 next0))) + (while (!= a0-5 (-> *collide-player-list* alive-list-end)) + (let* ((a0-6 (-> (the-as connection a0-5) param1)) + (a1-1 (-> (the-as collide-shape a0-6) root-prim)) + ) + (when (logtest? (-> a1-1 prim-core collide-as) (collide-spec enemy hit-by-others-list)) + (let ((a1-2 (-> a1-1 prim-core))) + (let ((a2-4 a1-2) + (a3-1 gp-0) + ) + (.lvf vf2 (&-> a2-4 world-sphere quad)) + (.lvf vf3 (&-> a3-1 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-5 vf1) + (let ((f0-1 a2-5) + (f1-1 (+ (-> a1-2 world-sphere w) (-> gp-0 r))) + ) + (when (< f0-1 (* f1-1 f1-1)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-5 v1-12) + *collide-player-list* + (set! v1-12 (-> v1-12 next0)) + ) + ) + ) + ) + (when #f + (let ((a0-8 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((v1-19 (-> a0-8 next0))) + (while (!= a0-8 (-> *collide-hit-by-player-list* alive-list-end)) + (let* ((a0-9 (-> (the-as connection a0-8) param1)) + (a1-13 (-> (the-as collide-shape a0-9) root-prim)) + ) + (when (logtest? (-> a1-13 prim-core collide-as) (collide-spec enemy hit-by-others-list)) + (let ((a1-14 (-> a1-13 prim-core))) + (let ((a2-11 a1-14) + (a3-2 gp-0) + ) + (.lvf vf2 (&-> a2-11 world-sphere quad)) + (.lvf vf3 (&-> a3-2 quad)) + ) + (.sub.vf vf1 vf3 vf2) + (.mul.vf vf1 vf1 vf1) + (.add.y.vf vf1 vf1 vf1 :mask #b1) + (.add.z.vf vf1 vf1 vf1 :mask #b1) + (.mov a2-12 vf1) + (let ((f0-2 a2-12) + (f1-5 (+ (-> a1-14 world-sphere w) (-> gp-0 r))) + ) + (when (< f0-2 (* f1-5 f1-5)) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) + ) + ) + ) + ) + ) + ) + (set! a0-8 v1-19) + *collide-hit-by-player-list* + (set! v1-19 (-> v1-19 next0)) + ) + ) + ) + ) + ) + (dotimes (gp-1 *actor-list-length*) + (let ((v1-24 (-> *actor-list* gp-1))) + (when (logtest? (-> v1-24 root-prim prim-core collide-as) (collide-spec enemy hit-by-others-list)) + (let ((a0-16 (-> v1-24 process))) + (if (= (-> a0-16 type) pipe-grunt) + (send-event a0-16 'instant-death) + ) + ) + ) + ) + ) + #f + ) + ) + +;; definition for method 261 of type sig-under +;; INFO: Used lq/sq +(defmethod sig-under-method-261 sig-under ((obj sig-under) (arg0 vector) (arg1 vector) (arg2 symbol)) + (set! (-> arg0 w) + (- (+ (* (-> arg0 x) (-> obj root-override2 trans x)) (* (-> arg0 z) (-> obj root-override2 trans z)))) + ) + (let ((v1-2 (new 'stack-no-clear 'vector))) + (set! (-> v1-2 quad) (-> arg1 quad)) + (set! (-> v1-2 y) 0.0) + (let ((f0-6 (vector4-dot (the-as vector (-> obj test-plane)) v1-2)) + (f1-3 14336.0) + (f2-1 16384.0) + ) + (when arg2 + (set! f1-3 (+ 2048.0 f1-3)) + (set! f2-1 (+ 2048.0 f2-1)) + ) + (if (and (>= f0-6 -2048.0) (>= f1-3 f0-6)) + (>= (* f2-1 f2-1) (vector-vector-xz-distance-squared arg1 (-> obj root-override2 trans))) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate intro-shooting (sig-under) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior sig-under) enemy-event-handler) + :enter (behavior () + (move-to-point! (-> self root-override2) (the-as vector (-> self sig5-course spots 0))) + (quaternion-identity! (-> self root-override2 quat)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-! gp-0 (the-as vector (-> self sig5-course spots 1)) (-> self root-override2 trans)) + (vector-normalize! gp-0 1.0) + (set-heading-vec! (-> self root-override2) gp-0) + ) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active checking-water)) + (let ((v1-11 self)) + (set! (-> v1-11 enemy-flags) (the-as enemy-flag (logclear (-> v1-11 enemy-flags) (enemy-flag enemy-flag36)))) + (set! (-> v1-11 nav callback-info) *nav-enemy-null-callback-info*) + ) + 0 + (nav-enemy-method-167 self) + (set! (-> self skel top-anim interp) 0.0) + (set! (-> self focus-mode) 1) + (set! (-> self bot-flags) (logior (bot-flags bf11 bf18) (-> self bot-flags))) + (set! (-> self root-override2 penetrated-by) + (logior (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot) + (-> self root-override2 penetrated-by) + ) + ) + (look-at-target! self (enemy-flag lock-focus)) + (none) + ) + :exit (behavior () + (logclear! (-> self bot-flags) (bot-flags bf18)) + (set! (-> self root-override2 penetrated-by) (get-penetrate-info self)) + (none) + ) + :trans (behavior () + (if (logtest? (-> self focus-status) (focus-status grabbed)) + (go-virtual waiting-close) + ) + (let ((a0-1 (handle->process (-> self focus handle)))) + (if a0-1 + (bot-method-222 self (get-trans (the-as process-focusable a0-1) 3)) + ) + ) + (none) + ) + :code (behavior () + (until #f + (let ((gp-0 (get-rand-int self 2))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (if (and (not (logtest? (-> self bot-task-bits) 1)) (zero? gp-0)) + (set! (-> s5-0 quad) (-> self sig5-course spots 2 center quad)) + (set! (-> s5-0 quad) (-> self sig5-course spots 1 center quad)) + ) + (+! (-> s5-0 x) (get-rand-float-range self -20480.0 20480.0)) + (+! (-> s5-0 y) (get-rand-float-range self 0.0 20480.0)) + (send-event (ppointer->process (-> self my-simple-focus)) 'move-trans s5-0) + ) + (set! (-> self shot-at-growls-index) gp-0) + ) + (set! (-> self poi-handle) (ppointer->handle (-> self my-simple-focus))) + (enemy-focus-method-13 + (-> self focus) + (the-as process-focusable (ppointer->process (-> self my-simple-focus))) + (enemy-aware enemy-aware-3) + ) + (bot-method-223 self #f) + (let ((f30-2 8.0)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-1 (-> self draw art-group data 12)) + (f30-3 (ja-aframe f30-2 0)) + ) + (ja-no-eval :group! gp-1 :num! (seek! f30-3) :frame-num 0.0) + (until (ja-done? 0) + (seek-toward-heading-vec! + (-> self root-override2) + (-> self focus-info bullseye-xz-dir) + 32768.0 + (seconds 0.05) + ) + (suspend) + (ja :num! (seek! f30-3)) + ) + ) + ) + (fire-gun self (-> self focus-info bullseye)) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (when #t + (set! (-> self state-time) (-> self clock frame-counter)) + (logclear! (-> self bot-flags) (bot-flags bf18)) + (let ((gp-3 (+ (-> self clock frame-counter) (get-rand-int-range self 30 600)))) + (ja-channel-push! 1 (seconds 0.5)) + (ja-no-eval :group! (-> self draw art-group data 7) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 7)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (if (>= (-> self clock frame-counter) gp-3) + (goto cfg-27) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (label cfg-27) + (set! (-> self bot-flags) (logior (bot-flags bf18) (-> self bot-flags))) + ) + #f + (none) + ) + :post (the-as (function none :behavior sig-under) nav-enemy-simple-post) + ) + +;; definition for method 183 of type sig-under +(defmethod alive? sig-under ((obj sig-under)) + ((method-of-type bot alive?) obj) + ) + +;; definition for method 210 of type sig-under +;; WARN: Return type mismatch symbol vs none. +(defmethod init! sig-under ((obj sig-under)) + "Set defaults for various fields." + (let ((t9-0 (method-of-type sig init!))) + (t9-0 obj) + ) + (set! (-> obj too-far-warn-dist-default) 245760.0) + (set! (-> obj too-far-fail-dist-delta-default) 163840.0) + (countdown (v1-3 2) + (set! (-> obj growls v1-3) (the-as handle #f)) + ) + (none) + ) + +;; definition for method 116 of type sig-under +;; WARN: Return type mismatch object vs none. +(defmethod go-idle sig-under ((obj sig-under)) + (cond + ((task-node-closed? (game-task-node under-sig-resolution)) + (cleanup-for-death obj) + (go (method-of-object obj die-fast)) + ) + (else + (go (method-of-object obj intro-shooting)) + ) + ) + (none) + ) + +;; definition for function sig5-default-check-too-far +;; WARN: Return type mismatch int vs symbol. +(defun sig5-default-check-too-far ((arg0 sig-under)) + (let ((v0-0 (bot-simple-check-too-far arg0))) + (if (logtest? (-> arg0 bot-task-bits) 4) + (set! v0-0 2) + ) + (the-as symbol v0-0) + ) + ) + +;; definition for symbol *sig5-course*, type sig5-course +(define *sig5-course* + (new 'static 'sig5-course + :course-id #xd + :speech-count #x1e + :spot-count #x24 + :too-far-warn-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 13 14 15) + ) + :too-far-fail-speeches (new 'static 'bot-speech-list-shuffle + :flags #xa + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 16 17) + ) + :attack-player-speeches (new 'static 'bot-speech-list + :flags #x2 + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 0 1 2 3 4 5) + ) + :default-check-too-far 'sig5-default-check-too-far + :waypoints (new 'static 'boxed-array :type bot-waypoint + (new 'static 'bot-waypoint + :waypoint-id 1 + :skip-to #x16 + :on-set (lambda ((arg0 sig-under)) + (let ((a0-1 80)) + (set! (-> arg0 hit-points) a0-1) + (set! (-> arg0 enemy-info-override default-hit-points) a0-1) + ) + (clear-speech-flags! arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 growls 0) + (ppointer->handle (process-spawn under-pipe-growls (-> arg0 sig5-course spots 2) 'intro-shooting :to arg0)) + ) + (set! (-> arg0 growls 1) + (ppointer->handle (process-spawn under-pipe-growls (-> arg0 sig5-course spots 1) 'intro-shooting :to arg0)) + ) + (if (task-node-open? (game-task-node under-sig-introduction)) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-find-sig-res" -99.0 0) + ) + (let ((v1-27 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-27 bytes 5) (the-as uint 1)) + (set! (-> v1-27 bytes 6) (the-as uint 0)) + (set! (-> v1-27 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-27) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (if (not (and (logtest? (-> arg1 bot-task-bits) 1) + *target* + (zero? (logand (-> *target* focus-status) (focus-status dead in-air edge-grab))) + ) + ) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.1)) + (task-node-open? (game-task-node under-sig-introduction)) + (scene-play arg1 "under-find-sig-res" #f) + ) + (process-entity-status! arg1 (entity-perm-status no-kill) #t) + (countdown (s5-0 2) + (send-event (handle->process (-> arg1 growls s5-0)) 'die-fast) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 2 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 2 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 0)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (set-setting! 'music 'tomb 0 0) + (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 3 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 3 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set! (-> arg0 bot-task-bits) (logand -5 (-> arg0 bot-task-bits))) + (logior! (-> arg0 bot-flags) (bot-flags bf06)) + (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (set! (-> arg0 notice-enemy-dist) 122880.0) + (clear-poi-and-focus! arg0) + (set! (-> arg0 focus-mode) 0) + (set! (-> arg0 root-override2 penetrated-by) (get-penetrate-info arg0)) + (let ((v1-12 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-12 bytes 5) (the-as uint 1)) + (set! (-> v1-12 bytes 6) (the-as uint 3)) + (set! (-> v1-12 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-12) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 4 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 4 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 3)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((logtest? (-> arg1 actor-group 0 data 0 actor extra perm status) (entity-perm-status subtask-complete)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 5 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (if (and (not (speech-playing? arg1 6)) (not (channel-active? arg1 (the-as uint 0)))) + (play-speech arg1 6) + ) + #f + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 5 + :nav-mesh-index 1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (reset-warn-time! arg0) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-one" -99.0 0) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 4)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-5) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-262 arg1 #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 6 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 6 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 5)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-262 arg1 #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 7 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 7 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 6)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-262 arg1 #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 8 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 8 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 7)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (sig-under-method-262 arg1 #t)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 9 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 9 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set-setting! 'music 'danger7 0 0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 7)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 10 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 10 + :nav-mesh-index 2 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (with-pp + (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 900 1500))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-centipede-two" -99.0 0) + (let* ((v1-7 (-> arg0 sig5-course spots)) + (s5-1 (-> v1-7 8)) + ) + (let ((v1-8 (-> v1-7 9))) + (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-8) (the-as vector s5-1)) + ) + (set! (-> arg0 test-plane y) 0.0) + (vector-normalize! (-> arg0 test-plane) 1.0) + (set! (-> arg0 test-plane w) + (- (+ (* (-> s5-1 center x) (-> arg0 test-plane x)) (* (-> s5-1 center z) (-> arg0 test-plane z)))) + ) + ) + (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-11 bytes 5) (the-as uint 1)) + (set! (-> v1-11 bytes 6) (the-as uint 10)) + (set! (-> v1-11 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-11) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (sig-under-method-263 arg1) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 y) 0.0) + (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (scene-play arg1 "under-centipede-two" #f) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 11 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 11 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set-setting! 'music 'tomb 0 0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 1)) + (set! (-> v1-3 bytes 6) (the-as uint 10)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 12 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 12 + :nav-mesh-index 3 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (reset-warn-time! arg0) + (move-to-point! (-> arg0 root-override2) (the-as vector (-> arg0 sig5-course spots 10))) + (set-vector! (-> arg0 root-override2 quat) 0.0 0.5874 0.0 0.8092) + (play-speech arg0 8) + (play-speech arg0 9) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 10)) + (set! (-> v1-15 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-15) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.8)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 13 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 13 + :nav-mesh-index 3 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 11)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (logtest? (-> arg1 actor-group 0 data 2 actor extra perm status) (entity-perm-status subtask-complete)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 14 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 14 + :nav-mesh-index 4 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((a1-0 (-> arg0 sig5-course spots))) + (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector (-> a1-0 13)) (the-as vector (-> a1-0 12))) + ) + (vector-normalize! (-> arg0 test-plane) 1.0) + (let ((v1-4 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-4 bytes 5) (the-as uint 1)) + (set! (-> v1-4 bytes 6) (the-as uint 12)) + (set! (-> v1-4 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-4) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 16 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 13)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (cond + ((sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 15 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ((outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 17 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + #f + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 15 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-2 (-> arg0 sig5-course spots 14))) + (set! (-> v1-2 center quad) (-> arg0 root-override2 trans quad)) + (set! (-> v1-2 center w) 8192.0) + ) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 1)) + (set! (-> v1-5 bytes 6) (the-as uint 14)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-5) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (if (sig-under-method-261 arg1 (-> arg1 test-plane) (target-pos 0) #t) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 16 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 17 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 15)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 18 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 18 + :nav-mesh-index #x6 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let ((v1-1 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-1 bytes 5) (the-as uint 1)) + (set! (-> v1-1 bytes 6) (the-as uint 16)) + (set! (-> v1-1 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-1) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (not (speech-playing? arg1 10)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 10) + (reset-warn-time! arg1) + ) + (when (and (speech-playing? arg1 10) (not (channel-active? arg1 (the-as uint 0)))) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 19 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 19 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (set! (-> arg0 growls 0) + (ppointer->handle (process-spawn under-pipe-growls (-> arg0 sig5-course spots 17) 'block-puzzle :to arg0)) + ) + (set! (-> arg0 notice-enemy-dist) 245760.0) + (send-event (ppointer->process (-> arg0 my-simple-focus)) 'move-trans (-> arg0 sig5-course spots 17)) + (set! (-> arg0 poi-handle) (ppointer->handle (-> arg0 my-simple-focus))) + (let ((v1-23 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-23 bytes 5) (the-as uint 1)) + (set! (-> v1-23 bytes 6) (the-as uint 16)) + (set! (-> v1-23 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-23) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'trigger) + (let ((t9-0 send-event-function) + (v1-9 (-> arg1 actor-group 0 data 3 actor)) + ) + (t9-0 + (if v1-9 + (-> v1-9 extra process) + ) + a1-1 + ) + ) + ) + ) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.7)) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 20 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 20 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (play-speech arg0 11) + (reset-warn-time! arg0) + (let ((v1-5 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-5 bytes 5) (the-as uint 2)) + (set! (-> v1-5 bytes 6) (the-as uint 18)) + (set! (-> v1-5 bytes 7) (the-as uint 19)) + (set! (-> v1-5 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-5) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) (+ (-> pp clock frame-counter) (seconds -6))) + (logior! (-> arg1 waypoint-bits) 1) + (set-setting! 'music 'danger3 0 0) + ) + #f + ) + ) + ) + ) + ) + (none) + ) + :on-update (lambda ((arg0 sig-under)) + (with-pp + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer pp)) + (set! (-> a1-0 num-params) 1) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'beaten)) + (let ((t9-0 send-event-function) + (v1-6 (-> arg0 actor-group 0 data 4 actor)) + ) + (when (t9-0 + (if v1-6 + (-> v1-6 extra process) + ) + a1-0 + ) + (clear-poi-and-focus! arg0) + (logior! (-> arg0 focus-status) (focus-status disable)) + (set! (-> arg0 notice-enemy-dist) 0.0) + (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (clear-focused (-> arg0 focus)) + (set! (-> arg0 bot-flags) (logior (bot-flags bf26) (-> arg0 bot-flags))) + (when (and (process-grab? arg0 #t) (process-grab? *target* #t)) + (process-grab? arg0 #f) + (process-grab? *target* #f) + (set-setting! 'entity-name "camera-245" 0 0) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer pp)) + (set! (-> a1-6 num-params) 0) + (set! (-> a1-6 message) 'unlock) + (let ((t9-8 send-event-function) + (v1-26 (-> arg0 actor-group 0 data 4 actor)) + ) + (t9-8 + (if v1-26 + (-> v1-26 extra process) + ) + a1-6 + ) + ) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer pp)) + (set! (-> a1-7 num-params) 0) + (set! (-> a1-7 message) 'beaten) + (let ((t9-9 send-event-function) + (v1-33 (-> arg0 actor-group 0 data 3 actor)) + ) + (t9-9 + (if v1-33 + (-> v1-33 extra process) + ) + a1-7 + ) + ) + ) + (send-event (handle->process (-> arg0 growls 0)) 'fade) + (set-setting! 'music 'tomb 0 0) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (go-to-waypoint! arg0 21 #f) + ) + ) + ) + ) + (none) + ) + ) + :on-skipping-here #f + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 21 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (reset-warn-time! arg0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 2)) + (set! (-> v1-3 bytes 6) (the-as uint 21)) + (set! (-> v1-3 bytes 7) (the-as uint 22)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (if (and (not (speech-playing? arg1 12)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1.5)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 12) + ) + (cond + ((not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (process-release? arg1) + (sig-under-method-260 arg1) + (move-to-point! (-> arg1 root-override2) (the-as vector (-> arg1 sig5-course spots 20))) + #f + ) + ((not (logtest? (-> arg1 waypoint-bits) 2)) + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2)) + (remove-setting! 'entity-name) + (logior! (-> arg1 waypoint-bits) 2) + (add-process *gui-control* arg1 (gui-channel art-load) (gui-action queue) "under-centipede-three" -99.0 0) + ) + #f + ) + (else + (when (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 2.5)) + (process-release? *target*) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 22 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 22 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (let* ((v1-1 (-> arg0 sig5-course spots)) + (s5-0 (-> v1-1 24)) + ) + (let ((v1-2 (-> v1-1 25))) + (vector-! (the-as vector (-> arg0 test-plane)) (the-as vector v1-2) (the-as vector s5-0)) + ) + (set! (-> arg0 test-plane y) 0.0) + (vector-normalize! (-> arg0 test-plane) 1.0) + (set! (-> arg0 test-plane w) + (- (+ (* (-> s5-0 center x) (-> arg0 test-plane x)) (* (-> s5-0 center z) (-> arg0 test-plane z)))) + ) + ) + (set! (-> arg0 too-far-warn-dist) 102400.0) + (set! (-> arg0 too-far-fail-dist-delta) 204800.0) + (reset-warn-time! arg0) + (let ((v1-9 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-9 bytes 5) (the-as uint 1)) + (set! (-> v1-9 bytes 6) (the-as uint 23)) + (set! (-> v1-9 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-9) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (local-vars (v1-14 symbol)) + (with-pp + (when (logtest? (-> arg1 waypoint-bits) 1) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer pp)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'trigger) + (let ((t9-0 send-event-function) + (v1-8 (-> arg1 actor-group 0 data 5 actor)) + ) + (t9-0 + (if v1-8 + (-> v1-8 extra process) + ) + a1-1 + ) + ) + ) + ) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! v1-14 + (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.25)) + (begin + (set! (-> s5-0 quad) (-> (target-pos 0) quad)) + (set! (-> s5-0 y) 0.0) + (set! (-> s5-0 w) 1.0) + (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (let ((f0-4 81920.0)) + (>= (* f0-4 f0-4) + (vector-vector-xz-distance-squared (target-pos 0) (the-as vector (-> arg1 sig5-course spots 24))) + ) + ) + ) + (set! v1-14 #t) + (goto cfg-21) + ) + (set! (-> s5-0 quad) (-> (math-camera-pos) quad)) + (set! (-> s5-0 y) 0.0) + (set! (-> s5-0 w) 1.0) + (when (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) + (set! v1-14 #t) + (goto cfg-21) + ) + #f + ) + ) + ) + ) + (label cfg-21) + (when v1-14 + (when (scene-play arg1 "under-centipede-three" #f) + (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 23 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here (lambda ((arg0 sig-under)) + (set-action! + *gui-control* + (gui-action stop) + (the-as sound-id 1) + (gui-channel art-load) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (ai-task-control-method-12 (-> arg0 ai-ctrl) arg0) + (logclear! (-> arg0 focus-status) (focus-status disable)) + (logior! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (process-entity-status! arg0 (entity-perm-status no-kill) #t) + (logior! (-> arg0 bot-flags) (bot-flags bf06)) + (set! (-> arg0 notice-enemy-dist) 122880.0) + (clear-poi-and-focus! arg0) + (set! (-> arg0 focus-mode) 0) + (set! (-> arg0 root-override2 penetrated-by) (get-penetrate-info arg0)) + (logior! (-> arg0 waypoint-bits) 1) + (send-event arg0 'move-trans (-> arg0 sig5-course spots 21)) + (send-event *target* 'continue (get-continue-by-name *game-info* "sig5-skip-to-cent2")) + (react-to-focus arg0) + (none) + ) + :check-too-far #f + ) + (new 'static 'bot-waypoint + :waypoint-id 23 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (stop-speech arg0 (the-as uint 0) #f) + (set-setting! 'music 'danger7 0 0) + (set! (-> arg0 bot-task-bits) (logand -9 (-> arg0 bot-task-bits))) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 23)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 24 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 24 + :nav-mesh-index #x7 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (with-pp + (set! (-> arg0 next-chase-play-time) (+ (-> pp clock frame-counter) (get-rand-int-range arg0 600 1200))) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 26)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (sig-under-method-263 arg1) + (when (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 4)) + (sig-method-257 arg1) + (let ((f0-0 61440.0)) + (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root-override2 trans))) + ) + ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> arg1 sig5-course spots 28)) + (let ((s5-1 (-> arg1 actor-group 0 data 6 actor))) + (when (and (not (channel-active? arg1 (the-as uint 0))) + (or (not s5-1) (zero? (logand (-> s5-1 extra perm status) (entity-perm-status subtask-complete)))) + ) + (let ((s5-2 18)) + (case (get-rand-int arg1 3) + ((1) + (set! s5-2 19) + ) + ((2) + (set! s5-2 20) + ) + ) + (play-speech arg1 s5-2) + ) + ) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 25 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 25 + :nav-mesh-index #x8 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (clear-poi-and-focus! arg0) + (set! (-> arg0 next-chase-play-time) 0) + (let ((v1-3 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-3 bytes 5) (the-as uint 3)) + (set! (-> v1-3 bytes 6) (the-as uint 29)) + (set! (-> v1-3 bytes 7) (the-as uint 30)) + (set! (-> v1-3 bytes 8) (the-as uint 31)) + (set! (-> v1-3 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-3) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + (return #t) + ) + (if (not (logtest? (-> arg1 bot-task-bits) 16)) + (set! (-> arg1 waypoint-time0) (-> pp clock frame-counter)) + ) + (when (and (not (logtest? (-> arg1 waypoint-bits) 2)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) + (zero? (logand (-> arg1 focus-status) (focus-status in-air))) + ) + (logior! (-> arg1 waypoint-bits) 2) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (if (and (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 1)) + (not (speech-playing? arg1 21)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 21) + ) + (when (zero? (-> arg1 next-chase-play-time)) + (let ((a0-14 (-> arg1 actor-group 0 data 7 actor))) + (if (and a0-14 (logtest? (-> a0-14 extra perm status) (entity-perm-status subtask-complete))) + (set! (-> arg1 next-chase-play-time) (-> pp clock frame-counter)) + ) + ) + ) + (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) + (and (-> arg1 next-state) (let ((v1-54 (-> arg1 next-state name))) + (or (= v1-54 'waiting-far) (= v1-54 'waiting-close) (= v1-54 'waiting-turn)) + ) + ) + (or (nonzero? (-> arg1 next-chase-play-time)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 6)) + ) + ) + (when (not (logtest? (-> arg1 waypoint-bits) 1)) + (logior! (-> arg1 waypoint-bits) 1) + (send-event (ppointer->process (-> arg1 my-simple-focus)) 'move-trans (-> arg1 sig5-course spots 32)) + (set! (-> arg1 poi-handle) (ppointer->handle (-> arg1 my-simple-focus))) + ) + (let ((v1-78 (-> arg1 sig5-course spots 32))) + (when (>= 10012.445 + (fabs + (deg- + (atan + (- (-> v1-78 center x) (-> arg1 root-override2 trans x)) + (- (-> v1-78 center z) (-> arg1 root-override2 trans z)) + ) + (quaternion-y-angle (-> arg1 root-override2 quat)) + ) + ) + ) + (let ((s4-1 (target-pos 0)) + (s5-1 (-> arg1 sig5-course spots 32)) + ) + (when (or (zero? (-> arg1 next-chase-play-time)) + (and (nonzero? (-> arg1 next-chase-play-time)) + (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 2)) + (or (>= (- (-> pp clock frame-counter) (-> arg1 next-chase-play-time)) (seconds 9)) + (>= (vector-vector-xz-distance s4-1 (-> s5-1 center)) (+ 8192.0 (-> s5-1 center w))) + (< 20480.0 (- (-> s4-1 y) (-> s5-1 center y))) + ) + ) + ) + (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag vulnerable)))) + (when (send-event arg1 'jump 5 (-> s5-1 center)) + (logclear! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + (if (not (channel-active? arg1 (the-as uint 0))) + (play-speech arg1 22) + ) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 26 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 26 + :nav-mesh-index #x9 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (add-process *gui-control* arg0 (gui-channel art-load) (gui-action queue) "under-get-sig-out-res" -99.0 0) + (send-event (ppointer->process (-> arg0 my-simple-focus)) 'move-trans (-> arg0 sig5-course spots 34)) + (set! (-> arg0 poi-handle) (ppointer->handle (-> arg0 my-simple-focus))) + (let ((v1-15 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-15 bytes 5) (the-as uint 1)) + (set! (-> v1-15 bytes 6) (the-as uint 33)) + (set! (-> v1-15 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-15) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) + (with-pp + (when (and (not (logtest? (-> arg1 waypoint-bits) 1)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 0.5)) + (zero? (logand (-> arg1 focus-status) (focus-status in-air))) + ) + (logior! (-> arg1 waypoint-bits) 1) + (logior! (-> arg1 enemy-flags) (enemy-flag enable-on-active checking-water)) + ) + (cond + ((sig-under-method-264 arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 27 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + (else + (if (and (not (speech-playing? arg1 23)) + (>= (- (-> pp clock frame-counter) (-> arg1 waypoint-time0)) (seconds 3.5)) + (not (channel-active? arg1 (the-as uint 0))) + ) + (play-speech arg1 23) + ) + #f + ) + ) + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 27 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (remove-setting! 'music) + (stop-speech arg0 (the-as uint 0) #f) + (logclear! (-> arg0 enemy-flags) (enemy-flag enable-on-active checking-water)) + (let ((v1-8 (-> arg0 sig5-course spots 35))) + (set! (-> v1-8 center quad) (-> arg0 root-override2 trans quad)) + (set! (-> v1-8 center w) 16384.0) + ) + (let ((v1-11 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-11 bytes 5) (the-as uint 1)) + (set! (-> v1-11 bytes 6) (the-as uint 35)) + (set! (-> v1-11 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-11) check-done) + (the-as + (function sigt-wait-spot sig symbol) + (lambda ((arg0 object) (arg1 sig-under)) (when (scene-release? arg1) + (reset-warn-time! arg1) + (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) + (go-to-waypoint! arg1 28 #f) + (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) + #t + ) + ) + ) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + (new 'static 'bot-waypoint + :waypoint-id 28 + :nav-mesh-index -1 + :skip-to -1 + :on-set (lambda ((arg0 sig-under)) + (process-entity-status! arg0 (entity-perm-status bit-4) #f) + (process-entity-status! arg0 (entity-perm-status no-kill) #f) + (logclear! (-> arg0 enemy-flags) (enemy-flag use-notice-distance)) + (logclear! (-> arg0 bot-flags) (bot-flags bf06)) + (bot-method-196 arg0) + (let ((v1-7 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) + (set! (-> v1-7 bytes 5) (the-as uint 1)) + (set! (-> v1-7 bytes 6) (the-as uint 35)) + (set! (-> v1-7 bytes 4) (the-as uint -1)) + (set! (-> (the-as sigt-wait-spot v1-7) check-done) + (the-as (function sigt-wait-spot sig symbol) (lambda () #f)) + ) + ) + (none) + ) + :on-update #f + :on-skipping-here #f + :check-too-far 'bot-check-too-far-always-okay + ) + ) + :speeches (new 'static 'inline-array bot-speech-info 30 + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt082") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt056") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt046") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt047") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt083") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt087") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt060") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt062") + (new 'static 'bot-speech-info :hold-time #x21c :slave-id -1 :name "sigt068") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt061") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt070") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt069") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt059") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt043") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt044") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt045") + (new 'static 'bot-speech-info :flags (speech-flags sf01) :hold-time #x5a :slave-id -1 :name "sigt053") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt091") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt065") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt066") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt067") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt075") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt108") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt103") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt072") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt073") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt074") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt076") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt077") + (new 'static 'bot-speech-info :hold-time #x5a :slave-id -1 :name "sigt078") + ) + :speech-tunings (new 'static 'inline-array bot-speech-tuning 1 + (new 'static 'bot-speech-tuning :fo-min 30 :fo-max #x78 :fo-curve #xb :trans? #t) + ) + :spots (new 'static 'inline-array bot-spot 36 + (new 'static 'bot-spot :center (new 'static 'vector :x -308019.2 :y -266199.03 :z 7887175.5 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -307036.16 :y -212992.0 :z 7998914.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -390389.75 :y -212992.0 :z 7958937.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -384000.0 :y -262144.0 :z 8051425.5 :w 12288.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -356638.72 :y -274432.0 :z 8130109.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -243343.36 :y -274391.03 :z 8183521.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -250470.4 :y -274391.03 :z 8217600.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -264601.6 :y -274145.28 :z 8243118.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -788848.6 :y -274432.0 :z 8396390.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -799170.56 :y -274432.0 :z 8391762.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -925736.94 :y -274432.0 :z 8324137.0 :w 15360.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -927580.2 :y -274432.0 :z 8278016.0 :w 15360.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -914350.06 :y -274432.0 :z 8265974.0 :w 15360.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -963911.7 :y -274432.0 :z 8239145.0 :w 9216.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -914350.06 :y -274432.0 :z 8265974.0 :w 8192.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1017733.1 :y -278487.03 :z 8185446.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1051934.8 :y -278487.03 :z 8145428.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1204633.6 :y -216145.92 :z 8084193.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1111695.4 :y -278487.03 :z 8137564.0 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1148682.2 :y -278487.03 :z 8114503.5 :w 14336.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -1082736.6 :y -290775.03 :z 8085012.5 :w 14336.0)) + (new 'static 'bot-spot + :center (new 'static 'vector :x -1049436.1 :y -290816.0 :z 8026562.5 :w 6144.0) + :blocked-xz-dist 6144.0 + ) + (new 'static 'bot-spot + :center (new 'static 'vector :x -1035591.7 :y -290816.0 :z 8032379.0 :w 6144.0) + :blocked-xz-dist 6144.0 + ) + (new 'static 'bot-spot :center (new 'static 'vector :x -971816.94 :y -290816.0 :z 7933378.5 :w 12288.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -993935.4 :y -290816.0 :z 7965040.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -982917.1 :y -290816.0 :z 7947387.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -743751.7 :y -290775.03 :z 7586201.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -762880.0 :y -289505.28 :z 7576125.5 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -762019.8 :y -339968.0 :z 7567155.0 :w 12288.0)) + (new 'static 'bot-spot + :center (new 'static 'vector :x -754810.9 :y -339968.0 :z 7534715.0 :w 6144.0) + :blocked-xz-dist 7168.0 + ) + (new 'static 'bot-spot + :center (new 'static 'vector :x -746782.75 :y -339968.0 :z 7539343.5 :w 6144.0) + :blocked-xz-dist 7168.0 + ) + (new 'static 'bot-spot + :center (new 'static 'vector :x -735846.4 :y -339968.0 :z 7545651.0 :w 6144.0) + :blocked-xz-dist 7168.0 + ) + (new 'static 'bot-spot :center (new 'static 'vector :x -725278.75 :y -405504.0 :z 7510630.5 :w 12288.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -754810.9 :y -405504.0 :z 7487365.0 :w 17408.0)) + (new 'static 'bot-spot :center (new 'static 'vector :x -722984.94 :y -339968.0 :z 7535657.0 :w 4096.0)) + (new 'static 'bot-spot :center (new 'static 'vector :w 16384.0)) + ) + :chase-speeches (new 'static 'bot-speech-list-shuffle + :flags #x8 + :last-local-index -1 + :speech-indexes (new 'static 'boxed-array :type int16 24 25 26 27 28 29) + ) + ) + ) + +;; failed to figure out what this is: +(set! (-> *bot-course-table* course 13) *sig5-course*) diff --git a/test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc new file mode 100644 index 0000000000..fe2d035650 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/under-laser_REF.gc @@ -0,0 +1,615 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type under-laser-info +(deftype under-laser-info (basic) + ((options uint8 :offset-assert 4) + (laser-radius float :offset-assert 8) + (laser-move-dist float :offset-assert 12) + (shadow-top-y float :offset-assert 16) + (shadow-height float :offset-assert 20) + (shadow-radius-adjust float :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) + +;; definition for method 3 of type under-laser-info +(defmethod inspect under-laser-info ((obj under-laser-info)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Toptions: ~D~%" (-> obj options)) + (format #t "~1Tlaser-radius: ~f~%" (-> obj laser-radius)) + (format #t "~1Tlaser-move-dist: ~f~%" (-> obj laser-move-dist)) + (format #t "~1Tshadow-top-y: ~f~%" (-> obj shadow-top-y)) + (format #t "~1Tshadow-height: ~f~%" (-> obj shadow-height)) + (format #t "~1Tshadow-radius-adjust: ~f~%" (-> obj shadow-radius-adjust)) + (label cfg-4) + obj + ) + +;; definition for symbol *under-laser-infos*, type (array under-laser-info) +(define *under-laser-infos* (new 'static 'boxed-array :type under-laser-info + (new 'static 'under-laser-info + :laser-radius 28508.16 + :laser-move-dist 35840.0 + :shadow-top-y -271360.0 + :shadow-height 3072.0 + :shadow-radius-adjust 4096.0 + ) + (new 'static 'under-laser-info + :options #x1 + :laser-radius 27443.2 + :laser-move-dist 35512.32 + :shadow-top-y -288768.0 + :shadow-height 3276.8 + :shadow-radius-adjust 1024.0 + ) + (new 'static 'under-laser-info + :options #x1 + :laser-radius 27443.2 + :laser-move-dist 35512.32 + :shadow-top-y -288768.0 + :shadow-height 3276.8 + :shadow-radius-adjust 1024.0 + ) + (new 'static 'under-laser-info + :laser-radius 29573.12 + :laser-move-dist 35430.4 + :shadow-top-y -288153.6 + :shadow-height 3276.8 + :shadow-radius-adjust 1638.4 + ) + (new 'static 'under-laser-info + :laser-radius 33423.36 + :laser-move-dist 35225.6 + :shadow-top-y -289382.4 + :shadow-height 2048.0 + :shadow-radius-adjust 2048.0 + ) + (new 'static 'under-laser-info + :laser-radius 44933.12 + :laser-move-dist 35430.4 + :shadow-top-y -290406.4 + :shadow-height 4587.52 + :shadow-radius-adjust -4096.0 + ) + ) + ) + +;; definition of type under-laser-shadow +(deftype under-laser-shadow (process-drawable) + ((root-override collide-shape-moving :offset 128) + (info under-laser-info :offset-assert 200) + (trans-xz-offset vector :inline :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 21 + :size-assert #xe0 + :flag-assert #x15006000e0 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-laser-shadow +(defmethod inspect under-laser-shadow ((obj under-laser-shadow)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tinfo: ~A~%" (-> obj info)) + (format #t "~2Ttrans-xz-offset: #~%" (-> obj trans-xz-offset)) + (label cfg-4) + obj + ) + +;; definition of type under-laser-slave +(deftype under-laser-slave (process-drawable) + ((root-override collide-shape-moving :offset 128) + ) + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-laser-slave +(defmethod inspect under-laser-slave ((obj under-laser-slave)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; definition of type under-laser +(deftype under-laser (process-drawable) + ((root-override collide-shape-moving :offset 128) + (info under-laser-info :offset-assert 200) + (id int8 :offset-assert 204) + (lightning lightning-control :offset-assert 208) + (draw-test-script script-context :offset-assert 212) + (sync sync-eased :inline :offset-assert 216) + (laser-dir vector :inline :offset-assert 272) + (slave-trans-offset vector :inline :offset-assert 288) + (zero-pos vector :inline :offset-assert 304) + (one-pos vector :inline :offset-assert 320) + ) + :heap-base #xd0 + :method-count-assert 23 + :size-assert #x150 + :flag-assert #x1700d00150 + (:methods + (dormant () _type_ :state 20) + (idle () _type_ :state 21) + (under-laser-method-22 (_type_) none 22) + ) + ) + +;; definition for method 3 of type under-laser +(defmethod inspect under-laser ((obj under-laser)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tinfo: ~A~%" (-> obj info)) + (format #t "~2Tid: ~D~%" (-> obj id)) + (format #t "~2Tlightning: ~A~%" (-> obj lightning)) + (format #t "~2Tdraw-test-script: ~A~%" (-> obj draw-test-script)) + (format #t "~2Tsync: #~%" (-> obj sync)) + (format #t "~2Tlaser-dir: #~%" (-> obj laser-dir)) + (format #t "~2Tslave-trans-offset: #~%" (-> obj slave-trans-offset)) + (format #t "~2Tzero-pos: #~%" (-> obj zero-pos)) + (format #t "~2Tone-pos: #~%" (-> obj one-pos)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-laser under-laser under-laser-lod0-jg under-laser-idle-ja + ((under-laser-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-laser-shadow under-laser-shadow under-laser-shadow-lod0-jg under-laser-shadow-idle-ja + ((under-laser-shadow-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 14) + :shadow under-laser-shadow-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +;; failed to figure out what this is: +(defstate idle (under-laser-shadow) + :virtual #t + :trans (behavior () + (let ((a1-0 (ppointer->process (-> self parent))) + (v1-2 (-> self root-override)) + ) + (let ((f0-0 (-> v1-2 trans y))) + (set! (-> v1-2 trans quad) (-> (the-as process-drawable a1-0) root trans quad)) + (vector+! (-> v1-2 trans) (-> v1-2 trans) (-> self trans-xz-offset)) + (set! (-> v1-2 trans y) f0-0) + ) + (let ((a0-3 (-> self draw shadow-ctrl))) + (let ((a1-5 (-> a0-3 settings))) + (logclear! (-> a1-5 flags) (shadow-flags disable-draw)) + (set! (-> a1-5 center quad) (-> v1-2 trans quad)) + ) + (shadow-control-method-14 + a0-3 + (-> v1-2 trans) + (new 'static 'vector :y -1.0 :w 1.0) + 409600.0 + 819.2 + (+ 819.2 (-> self info shadow-height)) + ) + ) + ) + (let ((f0-3 (vector-vector-distance (math-camera-pos) (-> self root-override trans)))) + (set! (-> self root-override scale x) (lerp-scale 0.5 3.5 f0-3 32768.0 245760.0)) + ) + (none) + ) + :code (the-as (function none :behavior under-laser-shadow) sleep-code) + :post (the-as (function none :behavior under-laser-shadow) ja-post) + ) + +;; definition for function under-laser-shadow-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior under-laser-shadow-init-by-other under-laser-shadow ((arg0 under-laser-info) (arg1 vector) (arg2 vector)) + (set! (-> self info) arg0) + (set! (-> self trans-xz-offset quad) (-> arg1 quad)) + (set! (-> self root-override) (the-as collide-shape-moving (new 'process 'trsqv))) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((s3-0 (-> self root-override))) + (let ((v1-4 (ppointer->process (-> self parent)))) + (set! (-> s3-0 scale quad) (-> arg2 quad)) + (set! (-> s3-0 trans quad) (-> (the-as under-laser v1-4) root-override trans quad)) + ) + (vector+! (-> s3-0 trans) (-> s3-0 trans) arg1) + (set! (-> s3-0 trans y) (+ 819.2 (-> arg0 shadow-top-y))) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> arg1 quad)) + (vector-normalize! s4-1 1.0) + (quaternion-look-at! (-> s3-0 quat) s4-1 *up-vector*) + ) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-laser-shadow" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self draw bounds w) (+ 12288.0 (* 20480.0 (-> arg2 z)))) + (set! (-> self draw shadow-ctrl) + (new 'process 'shadow-control -2048.0 -61440.0 69632.0 (shadow-flags shdf03 disable-draw) 245760.0) + ) + (set! (-> self draw shadow-ctrl settings shadow-type) 1) + (go-virtual idle) + (none) + ) + +;; failed to figure out what this is: +(defstate idle (under-laser-slave) + :virtual #t + :trans (behavior () + (let ((v1-0 (ppointer->process (-> self parent))) + (a0-1 (-> self root-override)) + ) + (set! (-> a0-1 trans quad) (-> (the-as under-laser v1-0) root-override trans quad)) + (vector+! (-> a0-1 trans) (-> a0-1 trans) (-> (the-as under-laser v1-0) slave-trans-offset)) + ) + (none) + ) + :code (the-as (function none :behavior under-laser-slave) sleep-code) + :post (the-as (function none :behavior under-laser-slave) ja-post) + ) + +;; definition for function under-laser-slave-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior under-laser-slave-init-by-other under-laser-slave () + (set! (-> self root-override) (the-as collide-shape-moving (new 'process 'trsqv))) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((gp-0 (-> self root-override)) + (s5-0 (ppointer->process (-> self parent))) + ) + (set! (-> gp-0 trans quad) (-> (the-as under-laser s5-0) root-override trans quad)) + (vector+! (-> gp-0 trans) (-> gp-0 trans) (-> (the-as under-laser s5-0) slave-trans-offset)) + (quaternion-copy! (-> gp-0 quat) (-> (the-as under-laser s5-0) root-override quat)) + (quaternion-rotate-y! (-> gp-0 quat) (-> gp-0 quat) 32768.0) + (set! (-> gp-0 scale quad) (-> (the-as under-laser s5-0) root-override scale quad)) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-laser" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go-virtual idle) + (none) + ) + +;; definition for method 22 of type under-laser +;; INFO: Used lq/sq +;; WARN: Return type mismatch sound-id vs none. +(defmethod under-laser-method-22 under-laser ((obj under-laser)) + (with-pp + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s5-0 start-pos quad) (-> obj root-override trans quad)) + (set! (-> s5-0 move-dist quad) (-> obj slave-trans-offset quad)) + (let ((v1-2 s5-0)) + (set! (-> v1-2 radius) 409.6) + (set! (-> v1-2 collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-2 ignore-process0) obj) + (set! (-> v1-2 ignore-process1) #f) + (set! (-> v1-2 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-2 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s5-0) 0.0) + (let* ((s4-0 (-> s5-0 best-other-tri collide-ptr)) + (s5-1 (if (type? s4-0 collide-shape-prim-sphere) + s4-0 + ) + ) + ) + (when s5-1 + (let ((s4-1 (new 'stack-no-clear 'vector))) + (vector-rotate-around-y! s4-1 (-> obj slave-trans-offset) (if (logtest? (-> obj info options) 1) + 16384.0 + -16384.0 + ) + ) + (vector-normalize! s4-1 1.0) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer pp)) + (set! (-> a1-4 num-params) 2) + (set! (-> a1-4 message) 'attack) + (set! (-> a1-4 param 0) (the-as uint #f)) + (let ((v1-11 (new 'static 'attack-info :mask (attack-info-mask vector shove-back shove-up id damage)))) + (let* ((a0-15 *game-info*) + (a2-2 (+ (-> a0-15 attack-id) 1)) + ) + (set! (-> a0-15 attack-id) a2-2) + (set! (-> v1-11 id) a2-2) + ) + (set! (-> v1-11 vector quad) (-> s4-1 quad)) + (set! (-> v1-11 shove-back) 12288.0) + (set! (-> v1-11 shove-up) 8192.0) + (set! (-> v1-11 damage) 1.0) + (set! (-> a1-4 param 1) (the-as uint v1-11)) + ) + (if (send-event-function (-> (the-as collide-shape-prim-sphere s5-1) cshape process) a1-4) + (sound-play "und-laser-hit") + ) + ) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate dormant (under-laser) + :virtual #t + :enter (behavior () + (logior! (-> self draw status) (draw-control-status no-draw)) + (none) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + (none) + ) + :trans (behavior () + (if (not (eval! + (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) + (the-as pair (-> self draw-test-script)) + ) + ) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior under-laser) sleep-code) + ) + +;; failed to figure out what this is: +(defstate idle (under-laser) + :virtual #t + :enter (behavior () + (process-spawn under-laser-slave :to self) + (let ((gp-1 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! gp-1 (-> self slave-trans-offset) 0.5) + (set! (-> gp-1 y) 0.0) + (let* ((f0-2 0.000048828126) + (v1-9 gp-1) + (f0-3 + (* f0-2 + (+ (sqrtf (+ (* (-> v1-9 x) (-> v1-9 x)) (* (-> v1-9 z) (-> v1-9 z)))) (-> self info shadow-radius-adjust)) + ) + ) + ) + (set-vector! s5-0 3.5 1.0 f0-3 1.0) + ) + (process-spawn under-laser-shadow (-> self info) gp-1 s5-0 :to self) + ) + (update-vol! (-> self sound) 1.0) + (none) + ) + :code (the-as (function none :behavior under-laser) sleep-code) + :post (behavior () + (let ((f30-0 (get-norm! (-> self sync) 0))) + (vector-lerp! (-> self root-override trans) (-> self zero-pos) (-> self one-pos) f30-0) + (if (!= (-> self sync offset) 0.0) + (set! f30-0 (- 1.0 f30-0)) + ) + (set-under-laser! f30-0) + ) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector-lerp! + s5-0 + (-> self zero-pos) + (-> self one-pos) + (get-norm! (-> self sync) (the-as int (+ (-> self clock frame-counter) (seconds 0.15)))) + ) + (vector-normalize-copy! s4-0 (-> self laser-dir) 1228.8) + (vector+! s4-0 s4-0 s5-0) + (set! (-> self lightning state meet data 0 quad) (-> s4-0 quad)) + (vector-normalize-copy! gp-0 (-> self laser-dir) -1228.8) + (vector+! gp-0 gp-0 (-> self slave-trans-offset)) + (vector+! gp-0 gp-0 s5-0) + (let ((v1-16 (-> self lightning))) + (set! (-> v1-16 state meet data (+ (-> v1-16 state points-to-draw) -1) quad) (-> gp-0 quad)) + ) + ) + (let ((a1-10 (new 'stack-no-clear 'vector))) + (vector-float*! a1-10 (-> self slave-trans-offset) 0.5) + (vector+! a1-10 a1-10 (-> self root-override trans)) + (update-trans! (-> self sound) a1-10) + ) + (update! (-> self sound)) + (under-laser-method-22 self) + (ja-post) + (none) + ) + ) + +;; definition for method 7 of type under-laser +;; WARN: Return type mismatch process-drawable vs under-laser. +(defmethod relocate under-laser ((obj under-laser) (arg0 int)) + (if (nonzero? (-> obj lightning)) + (&+! (-> obj lightning) arg0) + ) + (the-as under-laser ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; definition for method 11 of type under-laser +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-laser ((obj under-laser) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-64 res-tag)) + (with-pp + (set! (-> obj root-override) (the-as collide-shape-moving (new 'process 'trsqv))) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-laser" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((v1-7 (res-lump-value (-> obj entity) 'extra-id uint128 :time -1000000000.0))) + (set! (-> obj id) (the-as int v1-7)) + (set! (-> obj info) (-> *under-laser-infos* v1-7)) + ) + (let ((a1-6 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-11 0)) + (if #t + (set! v1-11 (logior v1-11 1)) + ) + (set! (-> a1-6 sync-type) 'sync-eased) + (set! (-> a1-6 sync-flags) (the-as sync-flags v1-11)) + ) + (set! (-> a1-6 period) (the-as uint 1800)) + (set! (-> a1-6 entity) arg0) + (set! (-> a1-6 percent) 0.0) + (set! (-> a1-6 ease-in) 0.15) + (set! (-> a1-6 ease-out) 0.15) + (set! (-> a1-6 pause-in) 0.0) + (set! (-> a1-6 pause-out) 0.0) + (initialize! (-> obj sync) a1-6) + ) + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s5-1 (-> obj root-override))) + (set-vector! (-> s5-1 scale) 1.25 1.25 1.25 1.0) + (set! sv-64 (new 'static 'res-tag)) + (let ((v1-22 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-64)))) + (when v1-22 + (+! (-> s5-1 trans x) (-> v1-22 0)) + (+! (-> s5-1 trans y) (-> v1-22 1)) + (+! (-> s5-1 trans z) (-> v1-22 2)) + ) + ) + (let ((f0-15 (res-lump-float arg0 'rotoffset))) + (if (!= f0-15 0.0) + (quaternion-rotate-y! (-> s5-1 quat) (-> s5-1 quat) f0-15) + ) + ) + (vector-z-quaternion! (-> obj laser-dir) (-> s5-1 quat)) + (vector-normalize! (-> obj laser-dir) 1.0) + (quaternion-rotate-y! (-> s5-1 quat) (-> s5-1 quat) -16384.0) + (when (logtest? (-> obj info options) 1) + (let ((s4-1 (new 'stack-no-clear 'quaternion))) + (quaternion-vector-angle! s4-1 (-> obj laser-dir) 16384.0) + (quaternion*! (-> s5-1 quat) s4-1 (-> s5-1 quat)) + ) + ) + (let ((f30-0 (-> obj info laser-radius))) + (let ((s4-2 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! s4-2 (-> obj laser-dir) (- f30-0)) + (vector+! (-> s5-1 trans) (-> s5-1 trans) s4-2) + ) + (vector-normalize-copy! (-> obj slave-trans-offset) (-> obj laser-dir) (* 2.0 f30-0)) + ) + (set! (-> obj zero-pos quad) (-> s5-1 trans quad)) + (let ((f30-1 (-> obj info laser-move-dist))) + (cond + ((logtest? (-> obj info options) 1) + (set! (-> obj one-pos quad) (-> obj zero-pos quad)) + (+! (-> obj one-pos y) f30-1) + ) + (else + (let ((s4-3 (new 'stack-no-clear 'vector))) + (vector-rotate-around-y! s4-3 (-> obj laser-dir) 16384.0) + (vector-normalize! s4-3 f30-1) + (vector+! (-> obj one-pos) (-> obj zero-pos) s4-3) + ) + ) + ) + ) + (vector-lerp! (-> s5-1 trans) (-> obj zero-pos) (-> obj one-pos) (get-norm! (-> obj sync) 0)) + ) + (let ((a2-13 (new 'static 'lightning-spec + :name #f + :flags (lightning-spec-flags lsf2) + :start-color (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) + :end-color (new 'static 'rgba :a #x80) + :fade-to-color (new 'static 'rgba :r #xbf :b #x8f :a #x5) + :fade-start-factor 0.2 + :fade-time 120.0 + :texture (new 'static 'texture-id :index #x83 :page #xc) + :reduction 0.42 + :num-points 16 + :box-size 8192.0 + :merge-factor 0.1 + :merge-count 4 + :radius 2048.0 + :duration -1.0 + :sound #f + ) + ) + ) + (set! (-> obj lightning) (new 'process 'lightning-control a2-13 obj 0.0)) + ) + (let ((a3-5 (new 'stack-no-clear 'vector))) + (vector-float*! a3-5 (-> obj slave-trans-offset) 0.5) + (vector+! a3-5 a3-5 (-> obj root-override trans)) + (if (zero? (-> obj id)) + (set! (-> obj sound) (new 'process 'ambient-sound (static-sound-spec "und-laser-near" :fo-max 40) a3-5)) + (set! (-> obj sound) (new 'process 'ambient-sound (static-sound-spec "und-laser-beam" :fo-max 40) a3-5)) + ) + ) + (set! (-> obj draw-test-script) (res-lump-struct (-> obj entity) 'on-activate script-context)) + (cond + ((and (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair (-> obj draw-test-script)) + ) + (= *bot-record-path* -1) + ) + (update-vol! (-> obj sound) 0.0) + (go (method-of-object obj dormant)) + ) + (else + (go (method-of-object obj idle)) + ) + ) + (none) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc new file mode 100644 index 0000000000..5eedbec5e1 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/under-obs_REF.gc @@ -0,0 +1,2456 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpartgroup group-bubbler-streams + :id 500 + :bounds (static-bspherem 0 8 0 16) + :parts ((sp-item 2197 :flags (is-3d bit6)) + (sp-item 2198 :flags (bit6)) + (sp-item 2199 :fade-after (meters 80) :falloff-to (meters 160)) + (sp-item 2200 :flags (is-3d bit6)) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 990 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 1380 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 2010 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 3930 :length 5 :binding 2195) + (sp-item 2201 :fade-after (meters 160) :falloff-to (meters 40) :period 600 :length 5 :binding 2195) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2195 :flags (bit1 start-dead launch-asap) :binding 2196) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2196 :fade-after (meters 100) :falloff-to (meters 100) :flags (bit1 start-dead)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 2202 :fade-after (meters 100) :falloff-to (meters 100)) + ) + ) + +;; failed to figure out what this is: +(defpart 2199 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 8.0) + (sp-rnd-flt spt-x (meters 0) (meters 2.7) 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 32) 1.0) + (sp-flt spt-scale-x (meters 0.25)) + (sp-rnd-flt spt-scale-y (meters 0.25) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.0016666667) (meters 0.0016666667) 1.0) + (sp-flt spt-fade-a 0.4) + (sp-int spt-timer 160) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + (sp-int spt-next-time 80) + (sp-launcher-by-id spt-next-launcher 2203) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 2203 + :init-specs ((sp-flt spt-fade-a -0.4)) + ) + +;; failed to figure out what this is: +(defpart 2197 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xd3 :page #xc)) + (sp-func spt-birth-func 'birth-func-camera-orient) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 299)) + (sp-flt spt-scale-x (meters 6)) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-flt spt-scale-y (meters 600)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-rnd-flt spt-b 0.0 128.0 1.0) + (sp-rnd-flt spt-a 32.0 4.0 1.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 2200 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0.1)) + (sp-flt spt-scale-x (meters 16)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-rnd-flt spt-b 0.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14) + ) + ) + +;; failed to figure out what this is: +(defpart 2198 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 1)) + (sp-rnd-flt spt-scale-x (meters 12) (meters 0.1) 1.0) + (sp-flt spt-rot-x 6144.0) + (sp-rnd-flt spt-scale-y (meters 20) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-rnd-flt spt-b 0.0 128.0 1.0) + (sp-flt spt-a 20.0) + (sp-int spt-timer 5) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-flt spt-userdata 16384.0) + ) + ) + +;; failed to figure out what this is: +(defpart 2202 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 0.1) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.15) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.01) 1.0) + (sp-flt spt-fade-a 0.16) + (sp-int spt-timer 4800) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-int-plain-rnd spt-next-time 99 197 1) + (sp-launcher-by-id spt-next-launcher 2204) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 3600.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 2204 + :init-specs ((sp-flt spt-fade-a 0.0) + (sp-int-plain-rnd spt-next-time 300 1799 1) + (sp-launcher-by-id spt-next-launcher 2205) + ) + ) + +;; failed to figure out what this is: +(defpart 2205 + :init-specs ((sp-rnd-flt spt-scalevel-x (meters -0.00033333333) (meters -0.00066666666) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.16) + (sp-rnd-flt spt-accel-y -0.4096 -0.4096 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 2201 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 0.3)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-flt spt-a 128.0) + (sp-rnd-flt spt-vel-y (meters 0.016666668) (meters 0.01) 1.0) + (sp-int spt-timer 3000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-rotate-y (degrees 0.0)) + ) + ) + +;; failed to figure out what this is: +(defpart 2195 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 16) 1.0) + (sp-rnd-flt spt-y (meters 0) (meters 16) 1.0) + (sp-flt spt-z (meters 0.1)) + (sp-flt spt-scale-x (meters 1.5)) + (sp-flt spt-scale-y (meters 0.9)) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-flt spt-omega 0.0) + (sp-rnd-int-flt spt-vel-x (meters -0.21333334) 1 1747.6267) + (sp-flt spt-vel-y (meters 0)) + (sp-flt spt-vel-z (meters 0)) + (sp-flt spt-scalevel-x (meters -0.0050000004)) + (sp-flt spt-scalevel-y (meters 0.0016666667)) + (sp-flt spt-fade-a 1.6) + (sp-int-plain-rnd spt-timer 2400 599 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 ready-to-launch) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2206) + ) + ) + +;; failed to figure out what this is: +(defpart 2206 + :init-specs ((sp-flt spt-scale-x (meters 1.2)) + (sp-flt spt-scale-y (meters 1)) + (sp-flt spt-scalevel-x (meters 0.010000001)) + (sp-flt spt-scalevel-y (meters -0.0033333334)) + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2207) + ) + ) + +;; failed to figure out what this is: +(defpart 2207 + :init-specs ((sp-flt spt-scale-x (meters 1.5)) + (sp-flt spt-scale-y (meters 0.9)) + (sp-flt spt-scalevel-x (meters -0.010000001)) + (sp-flt spt-scalevel-y (meters 0.0033333334)) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2206) + ) + ) + +;; failed to figure out what this is: +(defpart 2196 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x21 :page #xc)) + (sp-rnd-flt spt-num 0.0 0.5 1.0) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-flt spt-y (meters 0.1)) + (sp-rnd-flt spt-z (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters -0.00033333333) (meters -0.00066666666) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.53333336) + (sp-int spt-timer 2400) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-int spt-next-time 5) + (sp-launcher-by-id spt-next-launcher 2208) + (sp-rnd-flt spt-conerot-x (degrees 110.0) (degrees 50.000004) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.4)) + ) + ) + +;; failed to figure out what this is: +(defpart 2208 + :init-specs ((sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.0033333334) 1.0) + (sp-flt spt-accel-y -0.27306667) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 2209) + ) + ) + +;; failed to figure out what this is: +(defpart 2209 + :init-specs ((sp-flt spt-fade-a -0.08)) + ) + +;; definition of type bubbler +(deftype bubbler (process-drawable) + ((rod-of-god-scale float :offset-assert 200) + (ambient-id uint32 :offset-assert 204) + (last-recharge-time time-frame :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 22 + :size-assert #xd8 + :flag-assert #x16006000d8 + (:methods + (idle () _type_ :state 20) + (hidden () _type_ :state 21) + ) + ) + +;; definition for method 3 of type bubbler +(defmethod inspect bubbler ((obj bubbler)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Trod-of-god-scale: ~f~%" (-> obj rod-of-god-scale)) + (format #t "~2Tambient-id: ~D~%" (-> obj ambient-id)) + (format #t "~2Tlast-recharge-time: ~D~%" (-> obj last-recharge-time)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defstate hidden (bubbler) + :virtual #t + :trans (behavior () + (if (send-event (ppointer->process *underb-master*) 'query 'bubbler) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior bubbler) sleep-code) + ) + +;; failed to figure out what this is: +(defstate idle (bubbler) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('untrigger) + (go-virtual idle) + ) + ) + ) + :trans (behavior () + (if (not (send-event (ppointer->process *underb-master*) 'query 'bubbler)) + (go-virtual hidden) + ) + (set! (-> *part-id-table* 2197 init-specs 4 initial-valuef) (* 16384.0 (-> self rod-of-god-scale))) + (set! (-> *part-id-table* 2197 init-specs 8 initial-valuef) 0.0) + (set! (-> *part-id-table* 2197 init-specs 9 initial-valuef) 96.0) + (set! (-> *part-id-table* 2197 init-specs 10 initial-valuef) 255.0) + (set! (-> *part-id-table* 2200 init-specs 3 initial-valuef) (* 65536.0 (-> self rod-of-god-scale))) + (set! (-> *part-id-table* 2200 init-specs 2 initial-valuef) 3686.4) + (set! (-> *part-id-table* 2200 init-specs 5 initial-valuef) 0.0) + (set! (-> *part-id-table* 2200 init-specs 6 initial-valuef) 96.0) + (set! (-> *part-id-table* 2200 init-specs 7 initial-valuef) 255.0) + (set! (-> *part-id-table* 2198 init-specs 9 initial-valuef) (* 25.0 (-> self rod-of-god-scale))) + (set! (-> *part-id-table* 2198 init-specs 6 initial-valuef) 0.0) + (set! (-> *part-id-table* 2198 init-specs 7 initial-valuef) 96.0) + (set! (-> *part-id-table* 2198 init-specs 8 initial-valuef) 255.0) + (spawn (-> self part) (-> self root trans)) + (sound-play "bubbler" :id (the-as sound-id (-> self ambient-id)) :position (-> self root trans)) + (let ((a0-4 *target*)) + (when a0-4 + (let ((a0-5 (get-trans a0-4 0))) + (when (and (>= (- (-> a0-5 y) (-> self root trans y)) -6144.0) + (let ((f0-18 11264.0)) + (>= (* f0-18 f0-18) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) + ) + ) + (if (>= (- (-> self clock frame-counter) (-> self last-recharge-time)) (seconds 1)) + (sound-play "oxygen-recharge") + ) + (set! (-> self last-recharge-time) (-> self clock frame-counter)) + (send-event (ppointer->process *underb-master*) 'bubbler) + ) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior bubbler) sleep-code) + ) + +;; definition for method 10 of type bubbler +(defmethod deactivate bubbler ((obj bubbler)) + (sound-stop (the-as sound-id (-> obj ambient-id))) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; definition for method 11 of type bubbler +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! bubbler ((obj bubbler) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 500) obj)) + (set! (-> obj rod-of-god-scale) 1.0) + (set! (-> obj ambient-id) (the-as uint (sound-play "bubbler" :position (-> obj root trans)))) + (go (method-of-object obj idle)) + (none) + ) + +;; definition of type under-rise-plat +(deftype under-rise-plat (process-drawable) + ((up-y float :offset-assert 200) + (down-y float :offset-assert 204) + (delta-y float :offset-assert 208) + (up-threshold float :offset-assert 212) + (down-threshold float :offset-assert 216) + (last-ridden time-frame :offset-assert 224) + (ridden symbol :offset-assert 232) + (rider-started basic :offset-assert 236) + (extra-id int32 :offset-assert 240) + ) + :heap-base #x80 + :method-count-assert 26 + :size-assert #xf4 + :flag-assert #x1a008000f4 + (:methods + (idle-up () _type_ :state 20) + (wait-up () _type_ :state 21) + (going-down () _type_ :state 22) + (idle-down () _type_ :state 23) + (wait-down () _type_ :state 24) + (going-up () _type_ :state 25) + ) + ) + +;; definition for method 3 of type under-rise-plat +(defmethod inspect under-rise-plat ((obj under-rise-plat)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tup-y: ~f~%" (-> obj up-y)) + (format #t "~2Tdown-y: ~f~%" (-> obj down-y)) + (format #t "~2Tdelta-y: ~f~%" (-> obj delta-y)) + (format #t "~2Tup-threshold: ~f~%" (-> obj up-threshold)) + (format #t "~2Tdown-threshold: ~f~%" (-> obj down-threshold)) + (format #t "~2Tlast-ridden: ~D~%" (-> obj last-ridden)) + (format #t "~2Tridden: ~A~%" (-> obj ridden)) + (format #t "~2Trider-started: ~A~%" (-> obj rider-started)) + (format #t "~2Textra-id: ~D~%" (-> obj extra-id)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-rise-plat under-rise-plat under-rise-plat-lod0-jg under-rise-plat-idle-ja + ((under-rise-plat-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 14) + ) + +;; definition for function under-rise-plat-event-handler +(defbehavior under-rise-plat-event-handler under-rise-plat ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('ridden) + (set! (-> self ridden) #t) + (let ((v0-0 (the-as object (-> self clock frame-counter)))) + (set! (-> self last-ridden) (the-as time-frame v0-0)) + v0-0 + ) + ) + (('big-room) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'status (-> arg3 param 0)) + ) + ) + ) + +;; failed to figure out what this is: +(defstate wait-up (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (set! (-> self rider-started) #f) + (set! (-> self ridden) #f) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'up #t) + ) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (not (-> self ridden)) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) + ) + (go-virtual idle-up) + ) + (set! (-> self ridden) #f) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +;; failed to figure out what this is: +(defstate idle-up (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logior! (-> self mask) (process-mask actor-pause)) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (if (-> self ridden) + (go-virtual going-down) + ) + (let* ((a0-1 (target-pos 0)) + (v1-6 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) a0-1)) + ) + (set! (-> v1-6 y) (+ 58000.0 (-> v1-6 y))) + (if (< (-> self down-threshold) (-> v1-6 y)) + (go-virtual going-down) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +;; failed to figure out what this is: +(defstate going-down (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self root transv y) -20480.0) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'up #f) + ) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (let ((gp-0 (-> self root))) + (if (>= (-> self down-y) (-> gp-0 trans y)) + (go-virtual wait-down) + ) + (vector-v++! (-> gp-0 trans) (-> gp-0 transv)) + (if (>= (-> self down-y) (-> gp-0 trans y)) + (set! (-> gp-0 trans y) (-> self down-y)) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +;; failed to figure out what this is: +(defstate wait-down (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (set! (-> self rider-started) #f) + (set! (-> self ridden) #f) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (not (-> self ridden)) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) + ) + (go-virtual idle-down) + ) + (set! (-> self ridden) #f) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +;; failed to figure out what this is: +(defstate idle-down (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logior! (-> self mask) (process-mask actor-pause)) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (-> self ridden) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #t) + ) + (set! (-> self rider-started) (the-as basic #t)) + (go-virtual going-up) + ) + (let* ((a0-4 (target-pos 0)) + (v1-19 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) a0-4)) + ) + (set! (-> v1-19 y) (+ 58000.0 (-> v1-19 y))) + (if (< (-> v1-19 y) (-> self up-threshold)) + (go-virtual going-up) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +;; failed to figure out what this is: +(defstate going-up (under-rise-plat) + :virtual #t + :event under-rise-plat-event-handler + :enter (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self root transv y) 20480.0) + (set! (-> self ridden) #f) + 0 + (none) + ) + :trans (behavior () + (rider-trans) + (when (-> self rider-started) + (when (and (not (-> self ridden)) (>= (- (-> self clock frame-counter) (-> self last-ridden)) (seconds 2))) + (if (= (-> self extra-id) 1) + (send-event (ppointer->process *underb-master*) 'request 'big-room 'under-plat 'player #f) + ) + (go-virtual going-down) + ) + ) + (set! (-> self ridden) #f) + (let ((gp-0 (-> self root))) + (if (>= (-> gp-0 trans y) (-> self up-y)) + (go-virtual wait-up) + ) + (vector-v++! (-> gp-0 trans) (-> gp-0 transv)) + (if (>= (-> gp-0 trans y) (-> self up-y)) + (set! (-> gp-0 trans y) (-> self up-y)) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-rise-plat) sleep-code) + :post (the-as (function none :behavior under-rise-plat) rider-post) + ) + +;; definition for method 11 of type under-rise-plat +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-rise-plat ((obj under-rise-plat) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (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-spec obstacle camera-blocker pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 -40960.0 0.0 57344.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-12 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-12 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-12 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (-> obj root) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-16 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-16 + (+! (-> obj root trans x) (-> v1-16 0)) + (+! (-> obj root trans y) (-> v1-16 1)) + (+! (-> obj root trans z) (-> v1-16 2)) + ) + ) + (set! (-> obj extra-id) (res-lump-value arg0 'extra-id int :time -1000000000.0)) + (set! (-> obj delta-y) (res-lump-float arg0 'height :default 92160.0)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-rise-plat" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (let ((v1-23 (-> obj root))) + (set! (-> obj down-y) (-> v1-23 trans y)) + (+! (-> v1-23 trans y) (-> obj delta-y)) + (set! (-> obj up-y) (-> v1-23 trans y)) + (set! (-> obj down-threshold) (* 0.6666667 (-> obj delta-y))) + (set! (-> obj up-threshold) (- (-> obj down-threshold))) + (vector-reset! (-> v1-23 transv)) + ) + (set! (-> obj ridden) #f) + (set! (-> obj rider-started) #f) + (set! (-> obj draw light-index) (the-as uint 2)) + (go (method-of-object obj idle-up)) + (none) + ) + +;; definition of type under-buoy-base +(deftype under-buoy-base (process-drawable) + ((release symbol :offset-assert 200) + (open-anim-frame float :offset-assert 204) + ) + :heap-base #x50 + :method-count-assert 22 + :size-assert #xd0 + :flag-assert #x16005000d0 + (:methods + (idle () _type_ :state 20) + (opened () _type_ :state 21) + ) + ) + +;; definition for method 3 of type under-buoy-base +(defmethod inspect under-buoy-base ((obj under-buoy-base)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Trelease: ~A~%" (-> obj release)) + (format #t "~2Topen-anim-frame: ~f~%" (-> obj open-anim-frame)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-buoy-base under-buoy-base under-buoy-base-lod0-jg under-buoy-base-idle-ja + ((under-buoy-base-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 5) + ) + +;; failed to figure out what this is: +(defstate idle (under-buoy-base) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('attack) + (case (-> (the-as attack-info (-> event param 1)) mode) + (('mech-punch 'crush) + (let ((a0-5 (ppointer->process (-> self parent)))) + (send-event a0-5 'base-hit) + ) + ) + ) + ) + (('release) + (let ((v0-0 (the-as object #t))) + (set! (-> self release) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + ) + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (when (-> self release) + (ja :num-func num-func-identity :frame-num (-> self open-anim-frame)) + (set! (-> self open-anim-frame) (+ 0.2 (-> self open-anim-frame))) + (if (< 17.0 (-> self open-anim-frame)) + (go-virtual opened) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-buoy-base) sleep-code) + :post (the-as (function none :behavior under-buoy-base) ja-post) + ) + +;; failed to figure out what this is: +(defstate opened (under-buoy-base) + :virtual #t + :enter (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (none) + ) + :code (the-as (function none :behavior under-buoy-base) sleep-code) + :post (the-as (function none :behavior under-buoy-base) ja-post) + ) + +;; definition for function under-buoy-base-init-by-other +;; WARN: Return type mismatch object vs none. +(defbehavior under-buoy-base-init-by-other under-buoy-base ((arg0 object) (arg1 entity-actor)) + (process-entity-set! self arg1) + (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0))) + (set! (-> s5-0 total-prims) (the-as uint 4)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 20480.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 8192.0 0.0 20480.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 8192.0 0.0 20480.0) + ) + (let ((v1-12 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 2) (the-as uint 0)))) + (set! (-> v1-12 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-12 prim-core action) (collide-action solid)) + (set! (-> v1-12 transform-index) 6) + (set-vector! (-> v1-12 local-sphere) 0.0 8192.0 0.0 20480.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-15 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-15 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-15 prim-core collide-with)) + ) + (set! (-> self root) s5-0) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-buoy-base" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (process-drawable-from-entity! self arg1) + (set! (-> self release) #f) + (logior! (-> self mask) (process-mask actor-pause)) + (set! (-> self draw light-index) (the-as uint 2)) + (cond + ((and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete))) + (set! (-> self open-anim-frame) 17.0) + (ja-no-eval :group! (-> self draw art-group data 2) :num! (identity (-> self open-anim-frame))) + (go-virtual opened) + ) + (else + (set! (-> self open-anim-frame) 0.0) + (ja-no-eval :group! (-> self draw art-group data 2) :num! (identity (-> self open-anim-frame))) + (go-virtual idle) + ) + ) + (none) + ) + +;; definition of type under-buoy-chain +(deftype under-buoy-chain (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-buoy-chain +(defmethod inspect under-buoy-chain ((obj under-buoy-chain)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-buoy-chain under-buoy-chain under-buoy-chain-lod0-jg under-buoy-chain-idle-ja + ((under-buoy-chain-lod0-mg (meters 999999))) + :bounds (static-spherem 0 -10 0 14) + ) + +;; failed to figure out what this is: +(defstate idle (under-buoy-chain) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (let ((v1-0 (ppointer->process (-> self parent)))) + (set! (-> self root trans quad) (-> (the-as process-drawable v1-0) root trans quad)) + ) + (none) + ) + :code (the-as (function none :behavior under-buoy-chain) sleep-code) + :post (the-as (function none :behavior under-buoy-chain) ja-post) + ) + +;; definition for function under-buoy-chain-init-by-other +;; WARN: Return type mismatch object vs none. +(defbehavior under-buoy-chain-init-by-other under-buoy-chain ((arg0 object) (arg1 entity-actor)) + (process-entity-set! self arg1) + (let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((v1-6 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set! (-> v1-6 transform-index) 4) + (set-vector! (-> v1-6 local-sphere) 0.0 -40960.0 0.0 57344.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> self root) s5-0) + ) + (process-drawable-from-entity! self arg1) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-buoy-chain" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self draw light-index) (the-as uint 2)) + (logior! (-> self mask) (process-mask actor-pause)) + (go-virtual idle) + (none) + ) + +;; definition of type under-buoy-plat +(deftype under-buoy-plat (rigid-body-platform) + ((orig-trans vector :inline :offset-assert 384) + (surface-height float :offset-assert 400) + (anchor-point vector :inline :offset-assert 416) + (base (pointer under-buoy-base) :offset-assert 432) + ) + :heap-base #x140 + :method-count-assert 59 + :size-assert #x1b4 + :flag-assert #x3b014001b4 + (:methods + (waiting () _type_ :state 57) + (running () _type_ :state 58) + ) + ) + +;; definition for method 3 of type under-buoy-plat +(defmethod inspect under-buoy-plat ((obj under-buoy-plat)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type rigid-body-platform inspect))) + (t9-0 obj) + ) + (format #t "~2Torig-trans: #~%" (-> obj orig-trans)) + (format #t "~2Tsurface-height: ~f~%" (-> obj surface-height)) + (format #t "~2Tanchor-point: #~%" (-> obj anchor-point)) + (format #t "~2Tbase: #x~X~%" (-> obj base)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-buoy-plat under-buoy-plat under-buoy-plat-lod0-jg under-buoy-plat-idle-ja + ((under-buoy-plat-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 5) + ) + +;; definition for method 29 of type under-buoy-plat +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-29 under-buoy-plat ((obj under-buoy-plat) (arg0 float)) + ((the-as (function rigid-body-object float none) (find-parent-method under-buoy-plat 29)) obj arg0) + (rigid-body-platform-method-56 obj (-> obj orig-trans)) + 0 + (none) + ) + +;; definition for method 32 of type under-buoy-plat +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-32 under-buoy-plat ((obj under-buoy-plat)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (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) (collide-spec obstacle camera-blocker pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak hit-by-others-list player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 4) + (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 20480.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-16 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-16 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + ) + (set! (-> obj root-override-2) s5-0) + ) + 0 + (none) + ) + +;; definition for symbol *under-buoy-plat-platform-constants*, type rigid-body-platform-constants +(define *under-buoy-plat-platform-constants* (new 'static 'rigid-body-platform-constants + :mass 1.48 + :inv-mass 0.6756757 + :cm-joint (new 'static 'vector :w 1.0) + :linear-damping 0.8 + :angular-damping 0.5 + :friction-factor 0.1 + :inertial-tensor-x (meters 5) + :inertial-tensor-y (meters 1) + :inertial-tensor-z (meters 5) + :max-time-step 0.02 + :gravity (meters 80) + :idle-distance (meters 50) + :attack-force-scale 1.0 + :name '*under-buoy-plat-platform-constants* + :drag-factor 2.0 + :buoyancy-factor 2.3 + :max-buoyancy-depth (meters 1.5) + :player-weight (meters 150) + :player-bonk-factor 0.5 + :player-dive-factor 1.0 + :player-force-distance (meters 2) + :player-force-clamp (meters 1000000) + :player-force-timeout #x1e + :explosion-force (meters 1000) + :control-point-count 5 + :platform #t + :sound-name "ruins-plat" + ) + ) + +;; definition for method 53 of type under-buoy-plat +(defmethod rigid-body-platform-method-53 under-buoy-plat ((obj under-buoy-plat) (arg0 vector)) + -220341.05 + ) + +;; definition for method 56 of type under-buoy-plat +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-platform-method-56 under-buoy-plat ((obj under-buoy-plat) (arg0 vector)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (vector-! v1-0 arg0 (-> obj rbody state position)) + (set! (-> v1-0 y) 0.0) + (let* ((f0-1 (vector-length v1-0)) + (f1-1 (* 4.0 (fmax 0.0 (fmin 4096.0 (+ -819.2 f0-1))))) + ) + (when (< 0.0 f1-1) + (vector-float*! v1-0 v1-0 (/ f1-1 f0-1)) + (rigid-body-method-20 (-> obj rbody state) v1-0) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 33 of type under-buoy-plat +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-33 under-buoy-plat ((obj under-buoy-plat)) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-buoy-plat" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (rigid-body-object-method-31 obj *under-buoy-plat-platform-constants*) + (set! (-> obj orig-trans quad) (-> obj root-override-2 trans quad)) + (set! (-> obj anchor-point quad) (-> obj root-override-2 trans quad)) + (set! (-> obj surface-height) (-> obj root-override-2 trans y)) + (set! (-> obj info-override cm-joint y) 6144.0) + (let ((s5-1 (-> obj info-override control-point-count))) + (dotimes (s4-1 s5-1) + (let ((s3-0 (-> obj control-point-array data s4-1))) + (let ((f30-0 (* 65536.0 (/ (the float s4-1) (the float s5-1))))) + (set! (-> s3-0 local-pos x) (* 12288.0 (sin f30-0))) + (set! (-> s3-0 local-pos y) 8192.0) + (set! (-> s3-0 local-pos z) (* 12288.0 (cos f30-0))) + ) + (set! (-> s3-0 local-pos w) 1.0) + ) + ) + ) + (process-spawn under-buoy-chain (target-pos 0) (-> obj entity) :to obj) + (set! (-> obj base) (process-spawn under-buoy-base (target-pos 0) (-> obj entity) :to obj)) + (logior! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj draw light-index) (the-as uint 2)) + (none) + ) + +;; definition for method 34 of type under-buoy-plat +;; WARN: Return type mismatch object vs none. +(defmethod rigid-body-object-method-34 under-buoy-plat ((obj under-buoy-plat)) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (go (method-of-object obj running)) + (go (method-of-object obj waiting)) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate waiting (under-buoy-plat) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('attack) + (case (-> (the-as attack-info (-> event param 1)) mode) + (('mech-punch 'crush) + (go-virtual running) + ) + ) + ) + (('base-hit) + (go-virtual running) + ) + ) + ) + :enter (behavior () + 0 + (none) + ) + :code (the-as (function none :behavior under-buoy-plat) sleep-code) + :post (the-as (function none :behavior under-buoy-plat) ja-post) + ) + +;; failed to figure out what this is: +(defstate running (under-buoy-plat) + :virtual #t + :event (the-as + (function process int symbol event-message-block object :behavior under-buoy-plat) + rigid-body-object-event-handler + ) + :enter (behavior () + (sound-play "break-chain") + (send-event (ppointer->process (-> self base)) 'release) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (behavior () + (rigid-body-object-method-37 self) + (none) + ) + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-mine under-mine under-mine-lod0-jg under-mine-idle-ja + ((under-mine-lod0-mg (meters 20)) (under-mine-lod1-mg (meters 999999))) + :bounds (static-spherem 0 0 0 9) + :shadow under-mine-shadow-mg + :origin-joint-index 12 + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-mine-explode under-mine under-mine-explode-lod0-jg under-mine-explode-idle-ja + ((under-mine-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 9) + :origin-joint-index 11 + ) + +;; definition of type under-mine-chain-physics +(deftype under-mine-chain-physics (chain-physics) + () + :method-count-assert 18 + :size-assert #x570 + :flag-assert #x1200000570 + ) + +;; definition for method 3 of type under-mine-chain-physics +(defmethod inspect under-mine-chain-physics ((obj under-mine-chain-physics)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tchain-joints[20] @ #x~X~%" (-> obj chain-joints)) + (format #t "~1Tnum-joints: ~D~%" (-> obj num-joints)) + (format #t "~1Troot-joint-index: ~D~%" (-> obj root-joint-index)) + (format #t "~1Tjoint-length: ~f~%" (-> obj joint-length)) + (format #t "~1Tgravity: #~%" (-> obj gravity)) + (format #t "~1Tgravity-target: #~%" (-> obj gravity-target)) + (format #t "~1Tstretch-vel: ~f~%" (-> obj stretch-vel)) + (format #t "~1Tstretch-vel-parallel: ~f~%" (-> obj stretch-vel-parallel)) + (format #t "~1Tcompress-vel: ~f~%" (-> obj compress-vel)) + (format #t "~1Tcompress-vel-parallel: ~f~%" (-> obj compress-vel-parallel)) + (format #t "~1Tnegate-y: ~A~%" (-> obj negate-y)) + (format #t "~1Taxial-slop: ~f~%" (-> obj axial-slop)) + (format #t "~1Tmaximum-stretch: ~f~%" (-> obj maximum-stretch)) + (format #t "~1Tturn-off-start: ~D~%" (-> obj turn-off-start)) + (format #t "~1Tturn-off-duration: ~D~%" (-> obj turn-off-duration)) + (label cfg-4) + obj + ) + +;; definition for method 13 of type under-mine-chain-physics +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod apply-gravity under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 vector) (arg1 int) (arg2 process-drawable)) + (local-vars (v1-7 vector) (v1-11 vector) (a0-17 float) (a0-26 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (vector-float*! arg0 (-> obj gravity) (* 81.92 (-> self clock time-adjust-ratio))) + (cond + ((= arg1 (+ (-> obj num-joints) -1)) + (let ((v1-4 (new 'stack-no-clear 'vector))) + (set! (-> v1-4 quad) (-> arg2 entity trans quad)) + (vector-! v1-4 v1-4 (the-as vector (-> obj chain-joints arg1))) + (vector+float*! arg0 arg0 v1-4 1.0) + ) + ) + (else + (cond + ((>= arg1 (the-as int (+ (-> obj num-joints) -1))) + (set! v1-7 (new 'stack-no-clear 'vector)) + (set! (-> v1-7 quad) (-> arg2 entity trans quad)) + (set! (-> v1-7 y) (+ 8192.0 (-> v1-7 y))) + ) + (else + (set! v1-7 (new 'stack-no-clear 'vector)) + (set! (-> v1-7 quad) (-> obj chain-joints (+ arg1 1) position quad)) + ) + ) + (vector-! v1-7 v1-7 (the-as vector (-> obj chain-joints arg1))) + (.lvf vf1 (&-> v1-7 quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov a0-17 vf1) + (let ((f0-6 (sqrtf a0-17))) + (vector+float*! arg0 arg0 v1-7 (/ (* 1.1 (- f0-6 (-> obj joint-length))) f0-6)) + ) + (set! v1-11 + (cond + ((zero? arg1) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg2 node-list data (-> obj root-joint-index))) + ) + (else + (set! v1-11 (new 'stack-no-clear 'vector)) + (set! (-> v1-11 quad) (-> obj chain-joints (+ arg1 -1) position quad)) + v1-11 + ) + ) + ) + (vector-! v1-11 v1-11 (the-as vector (-> obj chain-joints arg1))) + (.lvf vf1 (&-> v1-11 quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov a0-26 vf1) + (let ((f0-9 (sqrtf a0-26))) + (vector+float*! arg0 arg0 v1-11 (/ (* 1.1 (- f0-9 (-> obj joint-length))) f0-9)) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 14 of type under-mine-chain-physics +;; WARN: Return type mismatch int vs none. +(defmethod chain-physics-method-14 under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 vector) (arg1 int)) + (vector-reset! arg0) + 0 + (none) + ) + +;; definition for method 15 of type under-mine-chain-physics +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs vector. +(defmethod clamp-length under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 vector) (arg1 vector) (arg2 object) (arg3 process-drawable)) + (let ((v1-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 quad) (-> arg3 entity trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> v1-0 y) (+ -19660.8 (-> v1-0 y))) + (vector-! s5-0 arg0 v1-0) + (let ((f0-2 (vector-normalize-ret-len! s5-0 1.0))) + (if (< f0-2 20480.0) + (vector+float*! arg0 arg0 s5-0 (- 20480.0 f0-2)) + ) + ) + ) + ) + (the-as vector 0) + ) + +;; definition for method 16 of type under-mine-chain-physics +(defmethod chain-physics-method-16 under-mine-chain-physics ((obj under-mine-chain-physics) (arg0 int)) + 21845.334 + ) + +;; definition of type under-mine +(deftype under-mine (process-drawable) + ((root-override collide-shape-moving :offset 128) + (chain under-mine-chain-physics :offset-assert 200) + (chain-initialized symbol :offset-assert 204) + (main-mod joint-mod :offset-assert 208) + (head-mod joint-mod :offset-assert 212) + ) + :heap-base #x60 + :method-count-assert 22 + :size-assert #xd8 + :flag-assert #x16006000d8 + (:methods + (explode () _type_ :state 20) + (idle () _type_ :state 21) + ) + ) + +;; definition for method 3 of type under-mine +(defmethod inspect under-mine ((obj under-mine)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tchain: ~A~%" (-> obj chain)) + (format #t "~2Tchain-initialized: ~A~%" (-> obj chain-initialized)) + (format #t "~2Tmain-mod: ~A~%" (-> obj main-mod)) + (format #t "~2Thead-mod: ~A~%" (-> obj head-mod)) + (label cfg-4) + obj + ) + +;; definition for symbol *under-mine-chain-setup*, type (array chain-physics-setup) +(define *under-mine-chain-setup* (new 'static 'boxed-array :type chain-physics-setup + (new 'static 'chain-physics-setup :joint-index 14) + (new 'static 'chain-physics-setup :joint-index 13) + (new 'static 'chain-physics-setup :joint-index 12) + (new 'static 'chain-physics-setup :joint-index 11) + (new 'static 'chain-physics-setup :joint-index 10) + (new 'static 'chain-physics-setup :joint-index 9) + (new 'static 'chain-physics-setup :joint-index 8) + (new 'static 'chain-physics-setup :joint-index 7) + (new 'static 'chain-physics-setup :joint-index 6) + (new 'static 'chain-physics-setup :joint-index 5) + (new 'static 'chain-physics-setup :joint-index 4) + ) + ) + +;; definition for symbol *under-mine-exploder-params*, type joint-exploder-static-params +(define *under-mine-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index 4) + (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index 5) + (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index 6) + (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index 7) + (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index 8) + (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index 9) + (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index 10) + (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index 11) + (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index 12) + (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index 13) + (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index 14) + (new 'static 'joint-exploder-static-joint-params :joint-index 14 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 15 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 16 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 17 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 18 :parent-joint-index 15) + (new 'static 'joint-exploder-static-joint-params :joint-index 19 :parent-joint-index 15) + ) + :collide-spec #x1 + ) + ) + +;; failed to figure out what this is: +(defstate explode (under-mine) + :virtual #t + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((v1-3 (-> self root-override root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (let ((gp-0 (new 'stack-no-clear 'explosion-init-params))) + (let ((v1-9 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self chain root-joint-index))) + ) + ) + (vector+float*! + v1-9 + v1-9 + (-> self node-list data (-> self chain root-joint-index) bone transform vector 1) + 10240.0 + ) + (set! (-> gp-0 spawn-point quad) (-> v1-9 quad)) + ) + (quaternion-copy! (-> gp-0 spawn-quat) (-> self root-override quat)) + (set! (-> gp-0 radius) 16384.0) + (set! (-> gp-0 group) (-> *part-group-id-table* 501)) + (set! (-> gp-0 collide-with) + (collide-spec backgnd jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list pusher) + ) + (set! (-> gp-0 penetrate-using) (penetrate explode)) + (explosion-spawn (the-as process-drawable *default-pool*) explosion gp-0) + ) + (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (set! (-> gp-1 duration) (seconds 4)) + (set! (-> gp-1 gravity) -20480.0) + (set! (-> gp-1 rot-speed) 4.2) + (set-vector! (-> gp-1 fountain-rand-transv-lo) -40960.0 20480.0 -40960.0 1.0) + (set-vector! (-> gp-1 fountain-rand-transv-hi) 40960.0 49152.0 40960.0 1.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-under-mine-explode" (the-as (pointer uint32) #f)) + 7 + gp-1 + *under-mine-exploder-params* + :to self + ) + ) + (sound-play "buoy-explode") + (activate! *camera-smush-control* 819.2 37 210 1.0 0.995 (-> self clock)) + (ja-channel-set! 0) + (ja-post) + (none) + ) + :trans (behavior () + (when (not (-> self child)) + (cleanup-for-death self) + (deactivate self) + ) + (none) + ) + :code (the-as (function none :behavior under-mine) sleep-code) + ) + +;; failed to figure out what this is: +(defstate idle (under-mine) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('attack 'bonk 'touched) + (go-virtual explode) + ) + ) + ) + :trans (behavior () + (local-vars (a0-8 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (ja :num! (loop!)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self entity trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (cond + (*target* + (set! (-> s5-0 quad) (-> (get-trans *target* 3) quad)) + (set! (-> s5-0 y) (+ -28672.0 (-> s5-0 y))) + ) + (else + (set! (-> s5-0 quad) (-> gp-0 quad)) + (set! (-> s5-0 y) (+ -1024.0 (-> s5-0 y))) + ) + ) + (set! (-> gp-0 y) (+ -28672.0 (-> gp-0 y))) + (vector-seek-3d-smooth! (-> self root-override trans) s5-0 (* 204.8 (-> self clock time-adjust-ratio)) 0.25) + ) + (let ((v1-21 (vector-! (new 'stack-no-clear 'vector) (-> self root-override trans) gp-0))) + (.lvf vf1 (&-> v1-21 quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov a0-8 vf1) + (let ((f0-9 a0-8) + (f1-4 28672.0) + ) + (if (< (* f1-4 f1-4) f0-9) + (vector-float*! v1-21 v1-21 (/ 28672.0 (sqrtf f0-9))) + ) + ) + (vector+! (-> self root-override trans) gp-0 v1-21) + ) + (set! (-> self root-override trans y) (fmax (-> self root-override trans y) (+ 409.6 (-> gp-0 y)))) + ) + (when (-> self chain-initialized) + (let ((s5-1 (new-stack-vector0)) + (gp-1 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self head-mod quat))) + ) + (dotimes (v1-27 (min 8 (the-as int (-> self chain num-joints)))) + (vector+! s5-1 s5-1 (the-as vector (-> self chain chain-joints v1-27))) + ) + (vector-float*! s5-1 s5-1 (/ 1.0 (the float (min 8 (the-as int (-> self chain num-joints)))))) + (vector-! + s5-1 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self chain root-joint-index))) + s5-1 + ) + (vector-normalize! s5-1 1.0) + (vector-seek-3d-smooth! (-> gp-1 vector 1) s5-1 (* 0.5 (-> self clock time-adjust-ratio)) 0.5) + (vector-normalize! s5-1 1.0) + (quaternion-from-two-vectors-partial! + (-> self head-mod quat) + (new 'static 'vector :y 1.0) + (-> gp-1 vector 1) + 0.25 + ) + ) + (update (-> self chain) self) + ) + (none) + ) + ) + :code (the-as (function none :behavior under-mine) sleep-code) + :post (behavior () + (transform-post) + (when *nav-network* + (let* ((a0-0 *nav-network*) + (t9-1 (method-of-object a0-0 nav-network-method-25)) + ) + self + (-> self root-override root-prim prim-core) + (t9-1 a0-0) + ) + ) + (when (not (-> self chain-initialized)) + (set! (-> self chain-initialized) #t) + (initialize-chain-joints (-> self chain)) + ) + (none) + ) + ) + +;; definition for method 7 of type under-mine +;; WARN: Return type mismatch process-drawable vs under-mine. +(defmethod relocate under-mine ((obj under-mine) (arg0 int)) + (if (nonzero? (-> obj main-mod)) + (&+! (-> obj main-mod) arg0) + ) + (if (nonzero? (-> obj head-mod)) + (&+! (-> obj head-mod) arg0) + ) + (if (nonzero? (-> obj chain)) + (&+! (-> obj chain) arg0) + ) + (the-as under-mine ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; definition for method 11 of type under-mine +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-mine ((obj under-mine) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec enemy camera-blocker)) + (set! (-> v1-2 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 15) + (set-vector! (-> v1-2 local-sphere) 0.0 12288.0 0.0 10240.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-2) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-5 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> s4-0 event-self) 'touched) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-mine" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj chain-initialized) #f) + (set! (-> obj chain) (new 'process 'under-mine-chain-physics)) + (chain-physics-initialize obj (-> obj chain) 15 1843.2 *under-mine-chain-setup*) + (set! (-> obj chain negate-y) (the-as basic #t)) + (set! (-> obj chain axial-slop) 1820.4445) + (set! (-> obj chain maximum-stretch) 100.0) + (set! (-> obj chain stretch-vel) 0.7) + (set! (-> obj chain stretch-vel-parallel) 0.9) + (set! (-> obj chain compress-vel) 0.85) + (set! (-> obj chain compress-vel-parallel) 0.9) + (set! (-> obj main-mod) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj 3)) + (set! (-> obj main-mod track-mode) (track-mode no-rotate no-scale)) + (mode-set! (-> obj main-mod) (joint-mod-mode joint-set-world)) + (set! (-> obj main-mod trans quad) (-> obj entity trans quad)) + (set! (-> obj head-mod) (new 'process 'joint-mod (joint-mod-mode flex-blend) obj 15)) + (set! (-> obj head-mod track-mode) (track-mode no-trans no-scale)) + (mode-set! (-> obj head-mod) (joint-mod-mode joint-set*)) + (quaternion-identity! (-> obj head-mod quat)) + (set! (-> obj draw light-index) (the-as uint 10)) + (go (method-of-object obj idle)) + (none) + ) + +;; definition of type under-lift +(deftype under-lift (elevator) + ((sound-id sound-id :offset-assert 368) + ) + :heap-base #x100 + :method-count-assert 50 + :size-assert #x174 + :flag-assert #x3201000174 + (:methods + (under-lift-method-49 (_type_ symbol) none 49) + ) + ) + +;; definition for method 3 of type under-lift +(defmethod inspect under-lift ((obj under-lift)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type elevator inspect))) + (t9-0 obj) + ) + (format #t "~2Tsound-id: ~D~%" (-> obj sound-id)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-lift under-lift under-lift-lod0-jg under-lift-idle-ja + ((under-lift-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 5.6 9.2) + ) + +;; definition for method 30 of type under-lift +(defmethod get-art-group under-lift ((obj under-lift)) + "@returns The associated [[art-group]]" + (art-group-get-by-name *level* "skel-under-lift" (the-as (pointer uint32) #f)) + ) + +;; definition for method 43 of type under-lift +(defmethod move-between-points under-lift ((obj under-lift) (arg0 vector) (arg1 float) (arg2 float)) + "Move between two points on the elevator's path +@param vec TODO not sure +@param point-a The first point fetched from the elevator's path +@param point-b The second point fetched from the path +@see [[path-control]] and [[elevator]]" + (let ((s4-0 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg1 'interp)) + (a0-3 (get-point-in-path! (-> obj path) (new 'stack-no-clear 'vector) arg2 'interp)) + (v1-3 (-> obj root-override trans)) + ) + (when (and (< (-> a0-3 y) (-> s4-0 y)) (< (-> arg0 y) (+ -8192.0 (-> v1-3 y)))) + (let ((s4-2 (vector-! (new 'stack-no-clear 'vector) arg0 v1-3))) + (vector-inv-orient-by-quat! s4-2 s4-2 (-> obj root-override quat)) + (and (< (fabs (-> s4-2 x)) 24576.0) (< 0.0 (-> s4-2 z)) (< (-> s4-2 z) 49152.0)) + ) + ) + ) + ) + +;; definition for method 45 of type under-lift +(defmethod commited-to-ride? under-lift ((obj under-lift)) + "@returns if the target is considered within the elevator area enough to begin descending/ascending" + (let* ((gp-0 *target*) + (a0-2 (if (type? gp-0 process-focusable) + gp-0 + ) + ) + ) + (when a0-2 + (let* ((v1-1 (get-trans a0-2 0)) + (gp-2 (vector-! (new 'stack-no-clear 'vector) v1-1 (-> obj root-override trans))) + ) + (vector-inv-orient-by-quat! gp-2 gp-2 (-> obj root-override quat)) + (and (< (fabs (-> gp-2 x)) 20480.0) (< 0.0 (-> gp-2 z)) (< (-> gp-2 z) 40960.0)) + ) + ) + ) + ) + +;; definition for method 49 of type under-lift +;; WARN: Return type mismatch int vs none. +(defmethod under-lift-method-49 under-lift ((obj under-lift) (arg0 symbol)) + (let ((v1-3 (-> (the-as collide-shape-prim-group (-> obj root-override root-prim)) child 1))) + (cond + (arg0 + (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> v1-3 prim-core collide-with) (collide-spec jak player-list)) + ) + (else + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + 0 + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate running (under-lift) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type elevator running) enter))) + (if t9-0 + (t9-0) + ) + ) + (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) + ) + (under-lift-method-49 self #t) + (set-setting! 'jump #f 0 0) + ) + (none) + ) + :post (behavior () + (let ((t9-0 (-> (method-of-type elevator running) post))) + (if t9-0 + ((the-as (function none) t9-0)) + ) + ) + (sound-play "under-lift-lp" :id (-> self sound-id) :position (-> self root-override trans)) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate arrived (under-lift) + :virtual #t + :enter (behavior () + (let ((t9-0 (-> (method-of-type elevator arrived) enter))) + (if t9-0 + (t9-0) + ) + ) + (sound-stop (-> self sound-id)) + (sound-play "sew-elev-stop") + (when (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (logtest? (elevator-flags airlock-opened) (-> self params flags)) + ) + (under-lift-method-49 self #f) + (remove-setting! 'jump) + ) + (none) + ) + ) + +;; definition for method 10 of type under-lift +(defmethod deactivate under-lift ((obj under-lift)) + (sound-stop (-> obj sound-id)) + ((the-as (function process-drawable none) (find-parent-method under-lift 10)) obj) + (none) + ) + +;; definition for method 33 of type under-lift +;; WARN: Return type mismatch int vs none. +(defmethod init-plat! under-lift ((obj under-lift)) + "Does any necessary initial platform setup. +For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." + (set! (-> obj sound-id) (new-sound-id)) + (set! (-> obj draw light-index) (the-as uint 4)) + 0 + (none) + ) + +;; definition for method 31 of type under-lift +(defmethod init-plat-collision! under-lift ((obj under-lift)) + "TODO - collision stuff for setting up the platform" + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 22937.6 37683.2) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-15 prim-core action) (collide-action solid rideable)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 22937.6 37683.2) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-17 prim-core action) (collide-action solid)) + (set! (-> v1-17 transform-index) 3) + (set-vector! (-> v1-17 local-sphere) 0.0 0.0 22937.6 39321.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-20 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-20 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-20 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + (under-lift-method-49 obj #f) + (none) + ) + +;; definition of type under-break-door +(deftype under-break-door (process-focusable) + ((anim art-joint-anim :offset-assert 204) + (art-name string :offset-assert 208) + (collide-mesh int32 :offset-assert 212) + ) + :heap-base #x60 + :method-count-assert 29 + :size-assert #xd8 + :flag-assert #x1d006000d8 + (:methods + (hit (symbol) _type_ :state 27) + (idle () _type_ :state 28) + ) + ) + +;; definition for method 3 of type under-break-door +(defmethod inspect under-break-door ((obj under-break-door)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 obj) + ) + (format #t "~2Tanim: ~A~%" (-> obj anim)) + (format #t "~2Tart-name: ~A~%" (-> obj art-name)) + (format #t "~2Tcollide-mesh: ~D~%" (-> obj collide-mesh)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-break-door under-break-door under-break-door-lod0-jg -1 + ((under-break-door-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 14) + :origin-joint-index 3 + ) + +;; failed to figure out what this is: +(defstate idle (under-break-door) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('trigger) + (go-virtual hit #f) + ) + (('attack) + (case (-> (the-as attack-info (-> event param 1)) mode) + (('mech-punch 'crush) + (go-virtual hit #f) + ) + ) + ) + (('combo) + #t + ) + ) + ) + :code (behavior () + (add-process + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (the-as string (-> self anim extra)) + -99.0 + 0 + ) + (until #f + (transform-post) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate hit (under-break-door) + :virtual #t + :exit (behavior () + (ja-abort-spooled-anim (the-as spool-anim (-> self anim)) (the-as art-joint-anim #f) -1) + (none) + ) + :post (the-as (function none :behavior under-break-door) ja-post) + ) + +;; definition for method 11 of type under-break-door +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-door ((obj under-break-door) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (stack-size-set! (-> obj main-thread) 512) + (set! (-> obj mask) (logior (process-mask collectable) (-> obj mask))) + (let ((s3-0 ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'art-name + 'interp + -1000000000.0 + "under-break-door-1" + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + (s4-0 (art-group-get-by-name *level* "skel-under-break-door" (the-as (pointer uint32) #f))) + ) + (set! (-> obj art-name) (the-as string s3-0)) + (let ((s2-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 3) + (set-vector! (-> v1-8 local-sphere) 0.0 0.0 0.0 57344.0) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-8) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-11 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-11 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + ) + (set! (-> obj root-override) s2-0) + ) + (cond + ((string= (-> obj art-name) "under-break-door-1") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-1" :anim-name "1-break" :parts 1 :command-list '()) + ) + ) + ) + ((string= (-> obj art-name) "under-break-door-2") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-2" :anim-name "2-break" :parts 1 :command-list '()) + ) + ) + ) + ((string= (-> obj art-name) "under-break-door-3") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-3" :anim-name "3-break" :parts 2 :command-list '()) + ) + ) + ) + ((string= (-> obj art-name) "under-break-door-4") + (set! (-> obj anim) + (the-as + art-joint-anim + (new 'static 'spool-anim :name "under-break-door-4" :anim-name "4-break" :parts 1 :command-list '()) + ) + ) + ) + (else + (go process-drawable-art-error (the-as string s3-0)) + ) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton obj (the-as skeleton-group s4-0) (the-as pair 0)) + ) + (ja-channel-set! 1) + (let* ((s5-1 (-> obj skel root-channel 0)) + (s4-1 (-> obj draw art-group)) + (s3-1 (method-of-object s4-1 get-art-by-name-method)) + ) + (format (clear *temp-string*) "~S-idle" (-> obj art-name)) + (set! (-> s5-1 frame-group) (the-as art-joint-anim (s3-1 s4-1 *temp-string* (the-as type #f)))) + ) + (set! (-> obj draw light-index) (the-as uint 10)) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (go (method-of-object obj hit) #t) + (go (method-of-object obj idle)) + ) + (none) + ) + +;; definition of type under-seaweed-a +(deftype under-seaweed-a (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-seaweed-a +(defmethod inspect under-seaweed-a ((obj under-seaweed-a)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-seaweed-a under-seaweed-a under-seaweed-a-lod0-jg under-seaweed-a-idle-ja + ((under-seaweed-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 3) + ) + +;; failed to figure out what this is: +(defstate idle (under-seaweed-a) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-a) ja-post) + ) + +;; definition for method 11 of type under-seaweed-a +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-a ((obj under-seaweed-a) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (let ((s4-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 4) 0))) + (set! (-> s4-0 total-prims) (the-as uint 5)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 22937.6 37683.2) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (let ((v1-15 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-17 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-17 transform-index) 3) + (set-vector! (-> v1-17 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (let ((v1-19 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 2) (the-as uint 0)))) + (set! (-> v1-19 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-19 transform-index) 3) + (set-vector! (-> v1-19 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (let ((v1-21 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 3) (the-as uint 0)))) + (set! (-> v1-21 prim-core collide-as) (collide-spec obstacle camera-blocker)) + (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-21 transform-index) 3) + (set-vector! (-> v1-21 local-sphere) 0.0 8192.0 0.0 12288.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-24 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-24 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-24 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-a" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +;; definition of type under-seaweed-b +(deftype under-seaweed-b (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-seaweed-b +(defmethod inspect under-seaweed-b ((obj under-seaweed-b)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-seaweed-b under-seaweed-b under-seaweed-b-lod0-jg under-seaweed-b-idle-ja + ((under-seaweed-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 4 0 5) + ) + +;; failed to figure out what this is: +(defstate idle (under-seaweed-b) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-b) ja-post) + ) + +;; definition for method 11 of type under-seaweed-b +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-b ((obj under-seaweed-b) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-b" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +;; definition of type under-seaweed-c +(deftype under-seaweed-c (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-seaweed-c +(defmethod inspect under-seaweed-c ((obj under-seaweed-c)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-seaweed-c under-seaweed-c under-seaweed-c-lod0-jg under-seaweed-c-idle-ja + ((under-seaweed-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 3 0 4) + ) + +;; failed to figure out what this is: +(defstate idle (under-seaweed-c) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-c) ja-post) + ) + +;; definition for method 11 of type under-seaweed-c +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-c ((obj under-seaweed-c) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-c" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +;; definition of type under-seaweed-d +(deftype under-seaweed-d (process-drawable) + () + :heap-base #x50 + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-seaweed-d +(defmethod inspect under-seaweed-d ((obj under-seaweed-d)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-seaweed-d under-seaweed-d under-seaweed-d-lod0-jg under-seaweed-d-idle-ja + ((under-seaweed-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 6 0 7) + ) + +;; failed to figure out what this is: +(defstate idle (under-seaweed-d) + :virtual #t + :enter (behavior () + 0 + (none) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) + :num! (seek! (the float (+ (-> (ja-group) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-seaweed-d) ja-post) + ) + +;; definition for method 11 of type under-seaweed-d +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-seaweed-d ((obj under-seaweed-d) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-seaweed-d" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (go (method-of-object obj idle)) + (none) + ) + +;; definition for method 15 of type hud-mech-air-tank +;; WARN: Return type mismatch int vs none. +(defmethod draw hud-mech-air-tank ((obj hud-mech-air-tank)) + (set-hud-piece-position! + (the-as hud-sprite (-> obj sprites)) + (the int (+ 472.0 (* 100.0 (-> obj offset)))) + 208 + ) + (set-as-offset-from! (-> obj sprites 1) (the-as vector4w (-> obj sprites)) 0 51) + (set! (-> obj sprites 0 scale-x) 0.8) + (set! (-> obj sprites 0 scale-y) 0.8) + (set! (-> obj sprites 1 scale-x) 0.8) + (set! (-> obj sprites 1 scale-y) 0.8) + (set! (-> obj sprites 3 scale-x) 0.8) + (set! (-> obj sprites 3 scale-y) 0.8) + (set! (-> obj sprites 2 scale-x) 3.2) + (set! (-> obj sprites 2 scale-y) (* 4.56 (- 1.0 (-> *game-info* air-supply)))) + (set-as-offset-from! (-> obj sprites 2) (the-as vector4w (-> obj sprites)) 0 2) + (set-as-offset-from! (-> obj sprites 3) (the-as vector4w (-> obj sprites)) -30 -20) + ((method-of-type hud draw) obj) + 0 + (none) + ) + +;; definition for method 16 of type hud-mech-air-tank +;; WARN: Return type mismatch int vs none. +(defmethod update-values hud-mech-air-tank ((obj hud-mech-air-tank)) + (set! (-> obj values 0 target) (the int (-> *game-info* air-supply))) + (logclear! (-> obj flags) (hud-flags disable)) + ((method-of-type hud update-values) obj) + 0 + (none) + ) + +;; definition for method 17 of type hud-mech-air-tank +;; WARN: Return type mismatch int vs none. +(defmethod init-callback hud-mech-air-tank ((obj hud-mech-air-tank)) + (set! (-> obj gui-id) + (add-process *gui-control* obj (gui-channel hud-middle-right) (gui-action hidden) (-> obj name) 81920.0 0) + ) + (logior! (-> obj flags) (hud-flags show)) + (set! (-> obj sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x2 :page #xd55))) + (set! (-> obj sprites 1 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xd55))) + (set! (-> obj sprites 2 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #xd55))) + (set! (-> obj sprites 3 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x1 :page #xd55))) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc new file mode 100644 index 0000000000..74cd9387ce --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/under-shoot-block_REF.gc @@ -0,0 +1,2465 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type under-block-spawner +(deftype under-block-spawner (basic) + ((col int8 :offset-assert 4) + (row int8 :offset-assert 5) + (active-handle handle :offset-assert 8) + (waiting-handle handle :offset-assert 16) + (exploded-time time-frame :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +;; definition for method 3 of type under-block-spawner +(defmethod inspect under-block-spawner ((obj under-block-spawner)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tcol: ~D~%" (-> obj col)) + (format #t "~1Trow: ~D~%" (-> obj row)) + (format #t "~1Tactive-handle: ~D~%" (-> obj active-handle)) + (format #t "~1Twaiting-handle: ~D~%" (-> obj waiting-handle)) + (format #t "~1Texploded-time: ~D~%" (-> obj exploded-time)) + (label cfg-4) + obj + ) + +;; definition of type under-block-slot +(deftype under-block-slot (basic) + ((col int8 :offset-assert 4) + (row int8 :offset-assert 5) + ) + :method-count-assert 9 + :size-assert #x6 + :flag-assert #x900000006 + ) + +;; definition for method 3 of type under-block-slot +(defmethod inspect under-block-slot ((obj under-block-slot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tcol: ~D~%" (-> obj col)) + (format #t "~1Trow: ~D~%" (-> obj row)) + (label cfg-4) + obj + ) + +;; definition of type under-block-puzzle +(deftype under-block-puzzle (basic) + ((auto-unlock? symbol :offset-assert 4) + (cells-wide int8 :offset-assert 8) + (cells-tall int8 :offset-assert 9) + (last-block-id int8 :offset-assert 10) + (slot-mask uint8 :offset-assert 11) + (slot-mask-full uint8 :offset-assert 12) + (prev-special-attack-id uint32 :offset-assert 16) + (orient-ry float :offset-assert 20) + (spawners (array under-block-spawner) :offset-assert 24) + (slots (array under-block-slot) :offset-assert 28) + (cells (pointer int32) :offset-assert 32) + (pulse-ops (pointer int8) :offset-assert 36) + (origin vector :inline :offset-assert 48) + (local-to-world matrix :inline :offset-assert 64) + ) + :method-count-assert 9 + :size-assert #x80 + :flag-assert #x900000080 + ) + +;; definition for method 3 of type under-block-puzzle +(defmethod inspect under-block-puzzle ((obj under-block-puzzle)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tauto-unlock?: ~A~%" (-> obj auto-unlock?)) + (format #t "~1Tcells-wide: ~D~%" (-> obj cells-wide)) + (format #t "~1Tcells-tall: ~D~%" (-> obj cells-tall)) + (format #t "~1Tlast-block-id: ~D~%" (-> obj last-block-id)) + (format #t "~1Tslot-mask: ~D~%" (-> obj slot-mask)) + (format #t "~1Tslot-mask-full: ~D~%" (-> obj slot-mask-full)) + (format #t "~1Tprev-special-attack-id: ~D~%" (-> obj prev-special-attack-id)) + (format #t "~1Torient-ry: ~f~%" (-> obj orient-ry)) + (format #t "~1Tspawners: ~A~%" (-> obj spawners)) + (format #t "~1Tslots: ~A~%" (-> obj slots)) + (format #t "~1Tcells: #x~X~%" (-> obj cells)) + (format #t "~1Tpulse-ops: #x~X~%" (-> obj pulse-ops)) + (format #t "~1Torigin: #~%" (-> obj origin)) + (format #t "~1Tlocal-to-world: #~%" (-> obj local-to-world)) + (label cfg-4) + obj + ) + +;; definition for symbol *under-block-puzzles*, type (array under-block-puzzle) +(define *under-block-puzzles* + (new 'static 'boxed-array :type under-block-puzzle + (new 'static 'under-block-puzzle + :auto-unlock? #t + :cells-wide 5 + :cells-tall #x8 + :orient-ry 11286.756 + :spawners (new 'static 'boxed-array :type under-block-spawner + (new 'static 'under-block-spawner :col 1 :row 2) + (new 'static 'under-block-spawner :col 2 :row 1) + ) + :slots (new 'static 'boxed-array :type under-block-slot + (new 'static 'under-block-slot :col 1 :row 5) + (new 'static 'under-block-slot :col 3 :row 5) + ) + :cells (new 'static 'array int32 12 0 0 0 0 0 0 0 0 0 0 0 0) + :pulse-ops (new 'static 'array int8 144 + #x2c + 1 + 0 + 0 + 1 + 0 + 0 + 0 + #x58 + 2 + 0 + 0 + 1 + 0 + 0 + 0 + -124 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -80 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + -36 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + -22 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -38 + #x7 + 0 + 0 + 1 + 0 + 0 + 0 + -84 + #x8 + 0 + 0 + 1 + 0 + 0 + 0 + #x60 + #x9 + 0 + 0 + 1 + 0 + 0 + 0 + -10 + #x9 + 0 + 0 + 1 + 0 + 0 + 0 + #x6e + #xa + 0 + 0 + 1 + 0 + 0 + 0 + -56 + #xa + 0 + 0 + 1 + 0 + 0 + 0 + 4 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x22 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x40 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x5e + #xb + 0 + 0 + 1 + 0 + 0 + 0 + #x7c + #xb + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + :origin (new 'static 'vector :x -472567.8 :y -274432.0 :z 8110768.0 :w 1.0) + ) + (new 'static 'under-block-puzzle + :auto-unlock? #t + :cells-wide #x6 + :cells-tall #x8 + :orient-ry 11286.756 + :spawners (new 'static 'boxed-array :type under-block-spawner (new 'static 'under-block-spawner :col 1 :row 2)) + :slots (new 'static 'boxed-array :type under-block-slot (new 'static 'under-block-slot :col 3 :row 5)) + :cells (new 'static 'array int32 12 + -16843010 + #xfefefe + -16843010 + -16908034 + #xfefefe + -16843010 + #xfe + #xfefe00 + -33554432 + #xfe + -16843264 + -16843010 + ) + :pulse-ops (new 'static 'array int8 112 + #x2c + 1 + 0 + 0 + 1 + 0 + 0 + 0 + #x3a + 2 + 0 + 0 + 1 + 0 + 0 + 0 + #x2a + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -4 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -80 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + #x46 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + -66 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + #x18 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + #x54 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + #x72 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -112 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -82 + #x6 + 0 + 0 + 1 + 0 + 0 + 0 + -52 + #x6 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + :origin (new 'static 'vector :x -969931.2 :y -274432.0 :z 8208644.0 :w 1.0) + ) + (new 'static 'under-block-puzzle + :auto-unlock? #f + :cells-wide #x7 + :cells-tall #x6 + :orient-ry 11286.756 + :spawners (new 'static 'boxed-array :type under-block-spawner + (new 'static 'under-block-spawner :row 4) + (new 'static 'under-block-spawner :row 5) + ) + :slots (new 'static 'boxed-array :type under-block-slot + (new 'static 'under-block-slot :col 5 :row 1) + (new 'static 'under-block-slot :col 5 :row 4) + ) + :cells (new 'static 'array int32 12 #xff00 0 -16777216 0 0 0 0 0 #xff #xff 0 0) + :pulse-ops (new 'static 'array int8 208 + #x2c + 1 + 0 + 0 + 1 + 0 + 0 + 0 + #x58 + 2 + 0 + 0 + 1 + 0 + 0 + 0 + -124 + 3 + 0 + 0 + 1 + 0 + 0 + 0 + -80 + 4 + 0 + 0 + 1 + 0 + 0 + 0 + -36 + 5 + 0 + 0 + 1 + 0 + 0 + 0 + #x8 + #x7 + 0 + 0 + 1 + 0 + 0 + 0 + #x34 + #x8 + 0 + 0 + 1 + 0 + 0 + 0 + #x60 + #x9 + 0 + 0 + 1 + 0 + 0 + 0 + -116 + #xa + 0 + 0 + 1 + 0 + 0 + 0 + -72 + #xb + 0 + 0 + 1 + 0 + 0 + 0 + -28 + #xc + 0 + 0 + 1 + 0 + 0 + 0 + #x10 + #xe + 0 + 0 + 1 + 0 + 0 + 0 + #x3c + #xf + 0 + 0 + 1 + 0 + 0 + 0 + #x4a + #x10 + 0 + 0 + 1 + 0 + 0 + 0 + #x3a + #x11 + 0 + 0 + 1 + 0 + 0 + 0 + #xc + #x12 + 0 + 0 + 1 + 0 + 0 + 0 + -64 + #x12 + 0 + 0 + 1 + 0 + 0 + 0 + #x56 + #x13 + 0 + 0 + 1 + 0 + 0 + 0 + -50 + #x13 + 0 + 0 + 1 + 0 + 0 + 0 + #x28 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + #x64 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -126 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -96 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -66 + #x14 + 0 + 0 + 1 + 0 + 0 + 0 + -36 + #x14 + 0 + 0 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + ) + :origin (new 'static 'vector :x -1120440.4 :y -290775.03 :z 8072909.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-shoot-block under-shoot-block under-shoot-block-lod0-jg under-shoot-block-idle-ja + ((under-shoot-block-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3.2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-shoot-block-explode under-shoot-block under-shoot-block-explode-lod0-jg under-shoot-block-explode-idle-ja + ((under-shoot-block-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 15) + ) + +;; definition for symbol *under-shoot-block-exploder-params*, type joint-exploder-static-params +(define *under-shoot-block-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 14 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 15 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 16 :parent-joint-index -1) + ) + :collide-spec #x1 + ) + ) + +;; definition of type under-block +(deftype under-block (process-focusable) + ((puzzle under-block-puzzle :offset-assert 204) + (my-parent (pointer process) :offset-assert 208) + (prev-attack-id uint32 :offset-assert 212) + (spawner-id int8 :offset-assert 216) + (my-id int8 :offset-assert 217) + (col int8 :offset-assert 218) + (row int8 :offset-assert 219) + (prev-col int8 :offset-assert 220) + (prev-row int8 :offset-assert 221) + (move-dir-x int8 :offset-assert 222) + (move-dir-z int8 :offset-assert 223) + (pulse-op int8 :offset-assert 224) + (pulse-pc int8 :offset-assert 225) + (pulse-ctr int8 :offset-assert 226) + (flags uint64 :offset-assert 232) + (activated-time time-frame :offset-assert 240) + (rot-axis vector :inline :offset-assert 256) + (away-from-focal-pt vector :inline :offset-assert 272) + ) + :heap-base #xa0 + :method-count-assert 51 + :size-assert #x120 + :flag-assert #x3300a00120 + (:methods + (waiting () _type_ :state 27) + (rise-up () _type_ :state 28) + (follow () _type_ :state 29) + (idle () _type_ :state 30) + (active () _type_ :state 31) + (flip () _type_ :state 32) + (rock () _type_ :state 33) + (sink-partially () _type_ :state 34) + (sunk-partially () _type_ :state 35) + (victory () _type_ :state 36) + (beaten () _type_ :state 37) + (fall () _type_ :state 38) + (explode () _type_ :state 39) + (die-fast () _type_ :state 40) + (under-block-method-41 (_type_ symbol) none 41) + (under-block-method-42 (_type_) none 42) + (under-block-method-43 (_type_ int int) symbol 43) + (under-block-method-44 (_type_) symbol 44) + (under-block-method-45 (_type_) none 45) + (under-block-method-46 (_type_ int int) none 46) + (under-block-method-47 (_type_ int int) int 47) + (under-block-method-48 (_type_ int int) symbol 48) + (under-block-method-49 (_type_ int int) symbol 49) + (under-block-method-50 (_type_) none 50) + ) + ) + +;; definition for method 3 of type under-block +(defmethod inspect under-block ((obj under-block)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 obj) + ) + (format #t "~2Tpuzzle: ~A~%" (-> obj puzzle)) + (format #t "~2Tmy-parent: #x~X~%" (-> obj my-parent)) + (format #t "~2Tprev-attack-id: ~D~%" (-> obj prev-attack-id)) + (format #t "~2Tspawner-id: ~D~%" (-> obj spawner-id)) + (format #t "~2Tmy-id: ~D~%" (-> obj my-id)) + (format #t "~2Tcol: ~D~%" (-> obj col)) + (format #t "~2Trow: ~D~%" (-> obj row)) + (format #t "~2Tprev-col: ~D~%" (-> obj prev-col)) + (format #t "~2Tprev-row: ~D~%" (-> obj prev-row)) + (format #t "~2Tmove-dir-x: ~D~%" (-> obj move-dir-x)) + (format #t "~2Tmove-dir-z: ~D~%" (-> obj move-dir-z)) + (format #t "~2Tpulse-op: ~D~%" (-> obj pulse-op)) + (format #t "~2Tpulse-pc: ~D~%" (-> obj pulse-pc)) + (format #t "~2Tpulse-ctr: ~D~%" (-> obj pulse-ctr)) + (format #t "~2Tflags: ~D~%" (-> obj flags)) + (format #t "~2Tactivated-time: ~D~%" (-> obj activated-time)) + (format #t "~2Trot-axis: #~%" (-> obj rot-axis)) + (format #t "~2Taway-from-focal-pt: #~%" (-> obj away-from-focal-pt)) + (label cfg-4) + obj + ) + +;; definition of type under-shoot-block +(deftype under-shoot-block (process-drawable) + ((puzzle under-block-puzzle :offset-assert 200) + (actor-group (pointer actor-group) :offset-assert 204) + (allow-unlock? symbol :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 29 + :size-assert #xd4 + :flag-assert #x1d006000d4 + (:methods + (idle () _type_ :state 20) + (victory-locked () _type_ :state 21) + (victory () _type_ :state 22) + (beaten () _type_ :state 23) + (under-shoot-block-method-24 (_type_ int int) none 24) + (under-shoot-block-method-25 (_type_ int int float int) none 25) + (under-shoot-block-method-26 (_type_) none 26) + (under-shoot-block-method-27 (_type_ symbol) none 27) + (under-shoot-block-method-28 (_type_) int 28) + ) + ) + +;; definition for method 3 of type under-shoot-block +(defmethod inspect under-shoot-block ((obj under-shoot-block)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tpuzzle: ~A~%" (-> obj puzzle)) + (format #t "~2Tactor-group: #x~X~%" (-> obj actor-group)) + (format #t "~2Tallow-unlock?: ~A~%" (-> obj allow-unlock?)) + (format #t "~2Tstate-time: ~D~%" (-> obj state-time)) + (label cfg-4) + obj + ) + +;; definition for function under-block-event-handler +(defbehavior under-block-event-handler under-block ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('track) + (cond + ((-> arg3 param 0) + (if (logtest? (-> self flags) 1) + #t + 'abort + ) + ) + (else + (logtest? (-> self flags) 1) + ) + ) + ) + (('attack) + (when (logtest? (-> self flags) 1) + (let ((gp-0 (the-as attack-info (-> arg3 param 1)))) + (when (and (!= (-> gp-0 id) (-> self prev-attack-id)) (!= (-> gp-0 id) (-> self puzzle prev-special-attack-id))) + (let ((s5-0 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3))) + (when (not (logtest? (penetrate jak-yellow-shot jak-red-shot jak-blue-shot jak-dark-shot) s5-0)) + (if (< (+ 7372.8 (-> self root-override trans y)) (-> (target-pos 0) y)) + (return #f) + ) + ) + (set! (-> self prev-attack-id) (-> gp-0 id)) + (if (logtest? s5-0 (penetrate punch)) + (set! (-> self puzzle prev-special-attack-id) (-> gp-0 id)) + ) + ) + (when #t + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-1 0) + (gp-1 0) + ) + (vector-! s4-0 (-> self root-override trans) (target-pos 0)) + (vector-rotate-around-y! s4-0 s4-0 (- (-> self puzzle orient-ry))) + (cond + ((< (fabs (-> s4-0 z)) (fabs (-> s4-0 x))) + (if (>= (-> s4-0 x) 0.0) + (set! s5-1 1) + (set! s5-1 -1) + ) + ) + ((>= (-> s4-0 z) 0.0) + (set! gp-1 1) + ) + (else + (set! gp-1 -1) + ) + ) + (cond + ((under-block-method-43 self s5-1 gp-1) + (set! (-> self move-dir-x) s5-1) + (set! (-> self move-dir-z) gp-1) + (under-block-method-48 self (+ (-> self col) s5-1) (+ (-> self row) gp-1)) + (set! (-> self flags) (logand -2 (-> self flags))) + (if (zero? (-> self activated-time)) + (under-block-method-42 self) + ) + (go-virtual flip) + ) + ((under-block-method-49 self s5-1 gp-1) + (set! (-> self move-dir-x) s5-1) + (set! (-> self move-dir-z) gp-1) + (set! (-> self flags) (logand -2 (-> self flags))) + (go-virtual rock) + ) + ((and (-> self next-state) (= (-> self next-state name) 'idle)) + (go-virtual active) + ) + ) + ) + ) + #t + ) + ) + ) + ) + (('rise-up) + (if (and (-> self next-state) (= (-> self next-state name) 'waiting)) + (go-virtual rise-up) + ) + ) + (('sunk-partially) + (and (-> self next-state) (= (-> self next-state name) 'sunk-partially)) + ) + (('victory) + (if (and (-> self next-state) (= (-> self next-state name) 'sunk-partially)) + (go-virtual victory) + ) + ) + (('die-fast) + (go-virtual die-fast) + ) + ) + ) + +;; definition for method 48 of type under-block +(defmethod under-block-method-48 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-0 (-> obj puzzle))) + (when (and (>= arg0 0) (< arg0 (-> v1-0 cells-wide)) (>= arg1 0) (< arg1 (-> v1-0 cells-tall))) + (let* ((a1-1 (+ (* arg1 (-> v1-0 cells-wide)) arg0)) + (a2-4 (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1)))) + (a0-1 (-> obj my-id)) + ) + (when (or (zero? a2-4) (= a2-4 a0-1)) + (set! (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1))) a0-1) + #t + ) + ) + ) + ) + ) + +;; definition for method 46 of type under-block +;; WARN: Return type mismatch int vs none. +(defmethod under-block-method-46 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-0 (-> obj puzzle))) + (when (and (>= arg0 0) (< arg0 (-> v1-0 cells-wide)) (>= arg1 0) (< arg1 (-> v1-0 cells-tall))) + (let ((a1-1 (+ (* arg1 (-> v1-0 cells-wide)) arg0))) + (when (= (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1))) (-> obj my-id)) + (set! (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a1-1))) 0) + 0 + ) + ) + ) + ) + (none) + ) + +;; definition for method 47 of type under-block +(defmethod under-block-method-47 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-0 (-> obj puzzle)) + (v0-0 -1) + ) + (when (and (>= arg0 0) (< arg0 (-> v1-0 cells-wide)) (>= arg1 0) (< arg1 (-> v1-0 cells-tall))) + (let ((a0-7 (+ (* arg1 (-> v1-0 cells-wide)) arg0))) + (set! v0-0 (-> (the-as (pointer int8) (&+ (-> v1-0 cells) a0-7)))) + ) + ) + v0-0 + ) + ) + +;; definition for method 43 of type under-block +(defmethod under-block-method-43 under-block ((obj under-block) (arg0 int) (arg1 int)) + (let ((v1-3 (under-block-method-47 obj (+ (-> obj col) arg0) (+ (-> obj row) arg1)))) + (or (zero? v1-3) (= v1-3 -2) (= v1-3 (-> obj my-id))) + ) + ) + +;; definition for method 49 of type under-block +(defmethod under-block-method-49 under-block ((obj under-block) (arg0 int) (arg1 int)) + (= (under-block-method-47 obj (+ (-> obj col) arg0) (+ (-> obj row) arg1)) -1) + ) + +;; definition for method 44 of type under-block +(defmethod under-block-method-44 under-block ((obj under-block)) + (let ((v1-0 (-> obj puzzle)) + (a2-0 (-> obj puzzle slots)) + ) + (countdown (a1-1 (-> a2-0 length)) + (let ((a3-2 (-> a2-0 a1-1))) + (when (and (= (-> a3-2 col) (-> obj col)) (= (-> a3-2 row) (-> obj row))) + (logior! (-> v1-0 slot-mask) (ash 1 a1-1)) + (return #t) + ) + ) + ) + ) + #f + ) + +;; definition for method 42 of type under-block +;; WARN: Return type mismatch int vs none. +(defmethod under-block-method-42 under-block ((obj under-block)) + (with-pp + (set! (-> obj activated-time) (-> pp clock frame-counter)) + (logior! (-> obj flags) 2) + (set! (-> obj pulse-pc) 0) + (set! (-> obj pulse-op) 0) + 0 + (none) + ) + ) + +;; definition for method 45 of type under-block +;; WARN: Return type mismatch object vs none. +;; WARN: Function (method 45 under-block) has a return type of none, but the expression builder found a return statement. +(defmethod under-block-method-45 under-block ((obj under-block)) + (with-pp + (let ((v1-0 (-> obj puzzle))) + (when (logtest? (-> obj flags) 2) + (cond + ((!= (-> v1-0 slot-mask) (-> v1-0 slot-mask-full)) + (when (zero? (-> obj pulse-op)) + (if (< (- (-> pp clock frame-counter) (-> obj activated-time)) + (the-as time-frame (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (-> obj pulse-pc) 4))))) + ) + (return #f) + ) + (set! (-> obj pulse-op) + (the-as int (-> (the-as (pointer uint32) (&+ (-> obj puzzle pulse-ops) (* (+ (-> obj pulse-pc) 1) 4))))) + ) + (+! (-> obj pulse-pc) 2) + (case (-> obj pulse-op) + ((1) + (set! (-> obj pulse-ctr) 3) + (sound-play "und-block-flash") + ) + ((2) + (go (method-of-object obj explode)) + ) + ) + ) + (case (-> obj pulse-op) + ((1) + (let ((v1-24 (-> obj pulse-ctr))) + (cond + ((= v1-24 3) + (set-vector! (-> obj draw color-mult) 1.1 0.25 0.25 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((or (= v1-24 2) (= v1-24 1)) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 1.0 1.0 1.0 1.0) + (+! (-> obj pulse-ctr) -1) + ) + ((zero? v1-24) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + (set! (-> obj pulse-op) 0) + 0 + ) + ) + ) + ) + ) + ) + (else + (set! (-> obj flags) (logand -3 (-> obj flags))) + (set-vector! (-> obj draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> obj draw color-emissive) 0.0 0.0 0.0 1.0) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for method 41 of type under-block +;; WARN: Return type mismatch int vs none. +(defmethod under-block-method-41 under-block ((obj under-block) (arg0 symbol)) + (let ((v1-1 (-> obj root-override root-prim))) + (case arg0 + (('active) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-as) (collide-spec)) + 0 + ) + (('fall) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-with) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-as) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-with) (collide-spec)) + 0 + ) + (('beaten) + (set! (-> (the-as collide-shape-prim-group v1-1) child 0 prim-core collide-as) (collide-spec)) + (set! (-> (the-as collide-shape-prim-group v1-1) child 1 prim-core collide-as) (collide-spec obstacle pusher)) + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defpartgroup group-shoot-block-explode + :id 497 + :duration (seconds 2) + :flags (use-local-clock) + :bounds (static-bspherem 0 0 0 6) + :parts ((sp-item 2181 :flags (bit6) :period 900 :length 5) + (sp-item 2182 :flags (bit6) :period 900 :length 5) + (sp-item 2183 :period 900 :length 15) + (sp-item 2184 :fade-after (meters 60) :falloff-to (meters 60) :period 900 :length 50 :offset 20) + (sp-item 2185 :fade-after (meters 200) :falloff-to (meters 200) :period 900 :length 25 :offset 20) + (sp-item 2186 :fade-after (meters 150) :falloff-to (meters 150) :period 900 :length 20 :offset 30) + ) + ) + +;; failed to figure out what this is: +(defpart 2186 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x34 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-rot-z) + :flags (sp-flag spflag7) + :random-rangef 65536.0 + :random-multf 1.0 + ) + (sp-rnd-flt spt-scale-y (meters 0.8) (meters 0.2) 1.0) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.1) (meters 0.26666668) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -5.12) + (sp-flt spt-fade-g -6.4) + (sp-flt spt-fade-b -7.28) + (sp-flt spt-fade-a -0.1254902) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 1000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int spt-next-time 25) + (sp-launcher-by-id spt-next-launcher 2187) + (new 'static 'sp-field-init-spec + :field (sp-field-id spt-conerot-x) + :flags (sp-flag from-pointer) + :func '*sp-temp* + ) + ) + ) + +;; failed to figure out what this is: +(defpart 2185 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x33 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.013333334) (meters 0.026666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.01) (meters 0.26666668) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.12) (degrees 0.24) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -5.12) + (sp-flt spt-fade-g -6.4) + (sp-flt spt-fade-b -7.28) + (sp-flt spt-fade-a -0.1254902) + (sp-rnd-flt spt-friction 0.93 0.06 1.0) + (sp-int spt-timer 1000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int spt-next-time 25) + (sp-launcher-by-id spt-next-launcher 2187) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 2187 + :init-specs ((sp-rnd-flt spt-scalevel-x (meters 0.016666668) (meters 0.016666668) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g 0.0) + (sp-flt spt-fade-b 0.0) + (sp-rnd-flt spt-fade-a -0.062068965 -0.72 1.0) + (sp-int-plain-rnd spt-next-time 15 14 1) + (sp-launcher-by-id spt-next-launcher 2188) + ) + ) + +;; failed to figure out what this is: +(defpart 2188 + :init-specs ((sp-flt spt-fade-a -0.2)) + ) + +;; failed to figure out what this is: +(defpart 2182 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xca :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 10)) + (sp-flt spt-rot-x 2048.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 24.0) + (sp-flt spt-scalevel-x (meters 0.13333334)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g -2.1333334) + (sp-flt spt-fade-b -4.266667) + (sp-flt spt-fade-a 0.0) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow) + (sp-int spt-next-time 75) + (sp-launcher-by-id spt-next-launcher 2189) + ) + ) + +;; failed to figure out what this is: +(defpart 2189 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.85333335) + (sp-flt spt-fade-g -1.7066667) + (sp-flt spt-fade-b -1.7066667) + (sp-flt spt-fade-a -0.64) + ) + ) + +;; failed to figure out what this is: +(defpart 2181 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xbb :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-scale-x (meters 10)) + (sp-flt spt-rot-x 2048.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 24.0) + (sp-flt spt-scalevel-x (meters 0.5)) + (sp-flt spt-rotvel-z (degrees 0.3)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -4.266667) + (sp-flt spt-fade-g -4.266667) + (sp-flt spt-fade-b -4.266667) + (sp-flt spt-fade-a 0.0) + (sp-int spt-timer 65) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow) + (sp-int spt-next-time 30) + (sp-launcher-by-id spt-next-launcher 2190) + ) + ) + +;; failed to figure out what this is: +(defpart 2190 + :init-specs ((sp-flt spt-scalevel-x (meters -0.2857143)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -1.8285714) + (sp-flt spt-fade-g -3.6571429) + (sp-flt spt-fade-b -3.6571429) + (sp-flt spt-fade-a -1.3714286) + ) + ) + +;; failed to figure out what this is: +(defpart 2184 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x32 :page #xc)) + (sp-rnd-flt spt-num 12.0 2.0 1.0) + (sp-flt spt-x (meters 0.25)) + (sp-rnd-flt spt-scale-x (meters 1) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 255.0) + (sp-flt spt-g 255.0) + (sp-flt spt-b 255.0) + (sp-rnd-flt spt-a 16.0 48.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.083333336) (meters 0.083333336) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.006666667) (meters 0.0016666667) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.12) (degrees 0.24) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r 0.0) + (sp-flt spt-fade-g -3.1) + (sp-flt spt-fade-b -0.1) + (sp-rnd-flt spt-accel-y -0.68266666 -1.3653333 1.0) + (sp-flt spt-friction 0.87) + (sp-int spt-timer 1000) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int-plain-rnd spt-next-time 35 14 1) + (sp-launcher-by-id spt-next-launcher 2191) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 2191 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-r -0.14444445) + (sp-flt spt-fade-g -0.33333334) + (sp-flt spt-fade-b -0.33333334) + (sp-int-plain-rnd spt-next-time 45 14 1) + (sp-launcher-by-id spt-next-launcher 2192) + ) + ) + +;; failed to figure out what this is: +(defpart 2192 + :init-specs ((sp-flt spt-fade-r 0.0) (sp-flt spt-fade-g -0.08695652) (sp-flt spt-fade-a -0.18478261)) + ) + +;; failed to figure out what this is: +(defpart 2183 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 12.0 4.0 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 0.6) 1.0) + (sp-rnd-flt spt-scale-x (meters 2.5) (meters 2) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 128.0 64.0 1.0) + (sp-rnd-flt spt-g 96.0 32.0 1.0) + (sp-rnd-flt spt-b 64.0 32.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.06666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.033333335) (meters 0.02) 1.0) + (sp-rnd-flt spt-rotvel-z (degrees -0.12) (degrees 0.24) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.64) + (sp-rnd-flt spt-friction 0.84 0.06 1.0) + (sp-int spt-timer 710) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int-plain-rnd spt-next-time 35 14 1) + (sp-launcher-by-id spt-next-launcher 2193) + (sp-rnd-flt spt-conerot-x (degrees -1440.0) (degrees 2880.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 2193 + :init-specs ((sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int-plain-rnd spt-next-time 0 94 1) + (sp-launcher-by-id spt-next-launcher 2194) + ) + ) + +;; failed to figure out what this is: +(defpart 2194 + :init-specs ((sp-flt spt-scalevel-x (meters 0)) (sp-copy-from-other spt-scalevel-y -4) (sp-flt spt-fade-a -0.128)) + ) + +;; definition for method 50 of type under-block +;; INFO: Used lq/sq +(defmethod under-block-method-50 under-block ((obj under-block)) + (with-pp + (let ((s5-0 (new 'stack 'joint-exploder-tuning (the-as uint (if (logtest? (-> obj flags) 4) + 1 + 0 + ) + ) + ) + ) + ) + (when (logtest? (-> obj flags) 4) + (set! (-> s5-0 fountain-rand-transv-lo quad) (-> obj away-from-focal-pt quad)) + (set! (-> s5-0 fountain-rand-transv-hi x) 24576.0) + (set! (-> s5-0 fountain-rand-transv-hi y) 49152.0) + (set! (-> s5-0 fountain-rand-transv-hi z) 10240.0) + (set! (-> s5-0 fountain-rand-transv-hi w) 18432.0) + ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-under-shoot-block-explode" (the-as (pointer uint32) #f)) + 5 + s5-0 + *under-shoot-block-exploder-params* + :to obj + ) + ) + (if (>= 204800.0 (vector-vector-distance (target-pos 0) (-> obj root-override trans))) + (activate! *camera-smush-control* 409.6 37 210 1.0 0.995 (-> pp clock)) + ) + (let ((s5-2 (new 'stack-no-clear 'explosion-init-params))) + (set! (-> s5-2 spawn-point quad) (-> obj root-override trans quad)) + (quaternion-copy! (-> s5-2 spawn-quat) (-> obj root-override quat)) + (set! (-> s5-2 radius) 16384.0) + (set! (-> s5-2 group) (-> *part-group-id-table* 497)) + (set! (-> s5-2 collide-with) (collide-spec jak bot player-list)) + (set! (-> s5-2 penetrate-using) (penetrate explode)) + (explosion-spawn obj explosion s5-2) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate waiting (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +;; failed to figure out what this is: +(defstate rise-up (under-block) + :virtual #t + :event under-block-event-handler + :trans (the-as (function none :behavior under-block) rider-trans) + :code (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (while (not (under-block-method-48 self (-> self col) (-> self row))) + (suspend) + ) + (under-block-method-41 self 'active) + (set! (-> self state-time) (-> self clock frame-counter)) + (sound-play "und-block-rise") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-1 vector 1 quad) (-> gp-1 vector 0 quad)) + (set! (-> gp-1 vector 1 y) (+ 16384.0 (-> gp-1 vector 1 y))) + (until (>= 409.6 (fabs (- (-> gp-1 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-1 vector 1) + (* 30720.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (rider-post) + (suspend) + ) + (set! (-> self root-override trans quad) (-> gp-1 vector 1 quad)) + ) + (rider-post) + (go-virtual idle) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate follow (under-block) + :virtual #t + :event under-block-event-handler + :trans (the-as (function none :behavior under-block) rider-trans) + :code (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (set! (-> gp-0 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-0 vector 1 quad) (-> gp-0 vector 0 quad)) + (set! (-> gp-0 vector 1 y) (+ 16384.0 (-> gp-0 vector 1 y))) + (until (>= 409.6 (fabs (- (-> gp-0 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-0 vector 1) + (* 30720.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (rider-post) + (suspend) + ) + (set! (-> self root-override trans quad) (-> gp-0 vector 1 quad)) + ) + (rider-post) + (go-virtual waiting) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (logior! (-> self flags) 1) + (under-block-method-41 self 'active) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +;; failed to figure out what this is: +(defstate active (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (logior! (-> self flags) 1) + (under-block-method-41 self 'active) + (none) + ) + :exit (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +;; failed to figure out what this is: +(defstate flip (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self prev-col) (-> self col)) + (set! (-> self prev-row) (-> self row)) + (+! (-> self col) (-> self move-dir-x)) + (+! (-> self row) (-> self move-dir-z)) + (under-block-method-48 self (-> self col) (-> self row)) + (none) + ) + :exit (behavior () + (under-block-method-46 self (-> self prev-col) (-> self prev-row)) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (local-vars (at-0 int)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (sound-play "und-block-roll") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 1 quad) (-> self root-override trans quad)) + (set-vector! + (-> gp-1 vector 0) + (+ 8192.0 (* 16384.0 (the float (-> self col)))) + 8192.0 + (+ 8192.0 (* 16384.0 (the float (-> self row)))) + 1.0 + ) + (vector-matrix*! + (the-as vector (-> gp-1 vector)) + (the-as vector (-> gp-1 vector)) + (-> self puzzle local-to-world) + ) + (quaternion-copy! (the-as quaternion (-> gp-1 trans)) (-> self root-override quat)) + (vector-! (-> self rot-axis) (the-as vector (-> gp-1 vector)) (-> gp-1 vector 1)) + (set! (-> self rot-axis y) 0.0) + (vector-normalize! (-> self rot-axis) 1.0) + (vector-rotate90-around-y! (-> self rot-axis) (-> self rot-axis)) + (quaternion-vector-angle! (the-as quaternion (-> gp-1 vector 2)) (-> self rot-axis) -16384.0) + (quaternion*! + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 trans)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let ((f30-0 (fmin 1.0 (* 0.022222223 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((s5-1 (-> self root-override))) + (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) + (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) + (set! (-> s5-1 trans y) (+ -8192.0 (* 11585.237 (sin (lerp 8192.0 24576.0 f30-0))) (-> s5-1 trans y))) + (vector-! (-> s5-1 transv) (-> s5-1 trans) (-> s5-1 transv)) + (let ((v1-17 (-> s5-1 transv))) + (.lvf vf1 (&-> (-> s5-1 transv) quad)) + (let ((f0-12 (-> self clock frames-per-second))) + (.mov at-0 f0-12) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-17 quad) vf1) + ) + (quaternion-slerp! + (-> s5-1 quat) + (the-as quaternion (-> gp-1 trans)) + (the-as quaternion (-> gp-1 vector 2)) + f30-0 + ) + ) + (transform-post) + (when (>= f30-0 1.0) + (cond + ((under-block-method-44 self) + (go-virtual sink-partially) + ) + ((= (under-block-method-47 self (-> self col) (-> self row)) -2) + (go-virtual fall) + ) + (else + (go-virtual active) + ) + ) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + ) + +;; failed to figure out what this is: +(defstate rock (under-block) + :virtual #t + :event under-block-event-handler + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (sound-play "und-block-knock") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (let ((a1-1 (+ (-> self col) (-> self move-dir-x))) + (a0-4 (+ (-> self row) (-> self move-dir-z))) + ) + (set! (-> gp-1 vector 1 quad) (-> self root-override trans quad)) + (set-vector! + (-> gp-1 vector 0) + (+ 8192.0 (* 16384.0 (the float a1-1))) + 8192.0 + (+ 8192.0 (* 16384.0 (the float a0-4))) + 1.0 + ) + ) + (vector-matrix*! + (the-as vector (-> gp-1 vector)) + (the-as vector (-> gp-1 vector)) + (-> self puzzle local-to-world) + ) + (quaternion-copy! (the-as quaternion (-> gp-1 trans)) (-> self root-override quat)) + (vector-! (-> self rot-axis) (the-as vector (-> gp-1 vector)) (-> gp-1 vector 1)) + (set! (-> self rot-axis y) 0.0) + (vector-normalize! (-> self rot-axis) 1.0) + (vector-rotate90-around-y! (-> self rot-axis) (-> self rot-axis)) + (quaternion-vector-angle! (the-as quaternion (-> gp-1 vector 2)) (-> self rot-axis) -16384.0) + (quaternion*! + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 vector 2)) + (the-as quaternion (-> gp-1 trans)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let ((f30-0 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time))))))) + (let ((s5-1 (-> self root-override))) + (set! (-> s5-1 transv quad) (-> s5-1 trans quad)) + (vector-lerp! (-> s5-1 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-0) + (set! (-> s5-1 trans y) (+ -8192.0 (* 11585.237 (sin (lerp 8192.0 24576.0 f30-0))) (-> s5-1 trans y))) + (quaternion-slerp! + (-> s5-1 quat) + (the-as quaternion (-> gp-1 trans)) + (the-as quaternion (-> gp-1 vector 2)) + f30-0 + ) + ) + (transform-post) + (if (>= f30-0 0.15) + (goto cfg-5) + ) + ) + (suspend) + ) + #f + (label cfg-5) + (set! (-> self state-time) (-> self clock frame-counter)) + (until #f + (let* ((f1-9 (fmin 1.0 (* 0.0074074073 (the float (- (-> self clock frame-counter) (-> self state-time)))))) + (s5-2 (-> self root-override)) + (f30-1 (fmax 0.0 (- 0.15 f1-9))) + ) + (set! (-> s5-2 transv quad) (-> s5-2 trans quad)) + (vector-lerp! (-> s5-2 trans) (-> gp-1 vector 1) (the-as vector (-> gp-1 vector)) f30-1) + (set! (-> s5-2 trans y) (+ -8192.0 (* 11585.237 (sin (lerp 8192.0 24576.0 f30-1))) (-> s5-2 trans y))) + (quaternion-slerp! + (-> s5-2 quat) + (the-as quaternion (-> gp-1 trans)) + (the-as quaternion (-> gp-1 vector 2)) + f30-1 + ) + (transform-post) + (if (= f30-1 0.0) + (go-virtual active) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate sink-partially (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (sound-play "und-block-lock") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-1 vector 1 quad) (-> gp-1 vector 0 quad)) + (set! (-> gp-1 vector 1 y) (+ -1228.8 (-> gp-1 vector 1 y))) + (until (>= 40.96 (fabs (- (-> gp-1 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-1 vector 1) + (* 8192.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (transform-post) + (suspend) + ) + ) + (go-virtual sunk-partially) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate sunk-partially (under-block) + :virtual #t + :event under-block-event-handler + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +;; failed to figure out what this is: +(defstate victory (under-block) + :virtual #t + :event under-block-event-handler + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (sound-play "und-block-sink") + (let ((gp-1 (new 'stack-no-clear 'matrix))) + (set! (-> gp-1 vector 0 quad) (-> self root-override trans quad)) + (set! (-> gp-1 vector 1 quad) (-> gp-1 vector 0 quad)) + (set! (-> gp-1 vector 1 y) (-> self puzzle origin y)) + (set! (-> gp-1 vector 1 y) (+ -8192.0 (-> gp-1 vector 1 y))) + (until (>= 40.96 (fabs (- (-> gp-1 vector 1 y) (-> self root-override trans y)))) + (vector-seek-3d-smooth! + (-> self root-override trans) + (-> gp-1 vector 1) + (* 12288.0 (-> self clock seconds-per-frame)) + 0.25 + ) + (transform-post) + (suspend) + ) + ) + (go-virtual beaten) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate beaten (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (under-block-method-41 self 'beaten) + (none) + ) + :code (the-as (function none :behavior under-block) sleep-code) + ) + +;; failed to figure out what this is: +(defstate fall (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (logclear! (-> self mask) (process-mask actor-pause)) + (under-block-method-41 self 'fall) + (none) + ) + :trans (behavior () + (under-block-method-45 self) + (none) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (let ((gp-0 (new 'stack-no-clear 'quaternion)) + (s5-0 (new 'stack-no-clear 'quaternion)) + (f30-0 0.0) + ) + (quaternion-copy! gp-0 (-> self root-override quat)) + (while (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.25)) + (+! f30-0 (* 65536.0 (-> self clock seconds-per-frame))) + (quaternion-vector-angle! s5-0 (-> self rot-axis) (- f30-0)) + (quaternion*! (-> self root-override quat) s5-0 gp-0) + (suspend) + ) + ) + (go-virtual explode) + (none) + ) + :post (behavior () + (let ((gp-0 (-> self root-override))) + (set! (-> gp-0 transv y) (- (-> gp-0 transv y) (* 348160.0 (-> self clock seconds-per-frame)))) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-0 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) self) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> gp-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-0 (meters 0)) + ) + (when (and (logtest? (-> (the-as collide-shape-moving gp-0) status) (collide-status touch-surface)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.01)) + ) + (logior! (-> self flags) 4) + (go-virtual explode) + ) + ) + (ja-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate explode (under-block) + :virtual #t + :event under-block-event-handler + :enter (behavior () + (set! (-> self flags) (logand -2 (-> self flags))) + (under-block-method-46 self (-> self col) (-> self row)) + (let ((v1-4 (-> self puzzle))) + (countdown (a0-3 (-> v1-4 slots length)) + (let ((a1-3 (-> v1-4 slots a0-3))) + (if (and (= (-> a1-3 col) (-> self col)) (= (-> a1-3 row) (-> self row))) + (logclear! (-> v1-4 slot-mask) (ash 1 a0-3)) + ) + ) + ) + ) + (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) + (set-vector! (-> self draw color-emissive) 0.0 0.0 0.0 1.0) + (send-event (ppointer->process (-> self my-parent)) 'explode (-> self spawner-id)) + (none) + ) + :code (behavior () + (sound-play "und-block-explo") + (under-block-method-50 self) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-7 (-> self root-override root-prim))) + (set! (-> v1-7 prim-core collide-as) (collide-spec)) + (set! (-> v1-7 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate die-fast (under-block) + :virtual #t + :code (the-as (function none :behavior under-block) nothing) + ) + +;; definition for function cshape-reaction-under-block +;; INFO: Used lq/sq +;; WARN: Return type mismatch collide-status vs none. +(defbehavior cshape-reaction-under-block under-block ((arg0 control-info) (arg1 collide-query) (arg2 vector)) + (if (logtest? (cshape-reaction-just-move arg0 arg1 arg2) (collide-status touch-surface)) + (set! (-> self away-from-focal-pt quad) (-> arg1 best-other-tri intersect quad)) + ) + (none) + ) + +;; definition for function under-block-init-by-other +;; WARN: Return type mismatch object vs none. +(defbehavior under-block-init-by-other under-block ((arg0 int) (arg1 int) (arg2 symbol) (arg3 (pointer process))) + (set! (-> self spawner-id) arg0) + (set! (-> self my-id) arg1) + (set! (-> self my-parent) arg3) + (let ((v1-0 arg3)) + (set! (-> self puzzle) + (the-as under-block-puzzle (-> (the-as under-block (if v1-0 + (the-as under-block (-> v1-0 0 self)) + ) + ) + focus-status + ) + ) + ) + ) + (set! (-> self event-hook) under-block-event-handler) + (let ((s4-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-under-block) + ) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 3) 0))) + (set! (-> s4-0 total-prims) (the-as uint 4)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec backgnd jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 13107.2) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (let ((v1-19 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-19 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-19 prim-core action) (collide-action solid rideable)) + (set! (-> v1-19 transform-index) 3) + (set-vector! (-> v1-19 local-sphere) 0.0 0.0 0.0 13107.2) + ) + (let ((v1-21 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-21 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> v1-21 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-21 prim-core action) (collide-action solid rideable)) + (set! (-> v1-21 transform-index) 3) + (set-vector! (-> v1-21 local-sphere) 0.0 0.0 0.0 13107.2) + ) + (let ((v1-23 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-23 prim-core collide-with) (collide-spec backgnd)) + (set! (-> v1-23 prim-core action) (collide-action solid)) + (set! (-> v1-23 transform-index) 3) + (set-vector! (-> v1-23 local-sphere) 0.0 0.0 0.0 6553.6) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-26 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-26 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-26 prim-core collide-with)) + ) + (set! (-> self root-override) s4-0) + ) + (cond + ((= arg2 'beaten) + (let ((v1-31 (-> self puzzle slots arg0))) + (set! (-> self col) (-> v1-31 col)) + (set! (-> self row) (-> v1-31 row)) + ) + ) + (else + (let ((v1-35 (-> self puzzle spawners arg0))) + (set! (-> self col) (-> v1-35 col)) + (set! (-> self row) (-> v1-35 row)) + ) + ) + ) + (let ((s5-1 (-> self root-override))) + (set-vector! + (-> s5-1 trans) + (+ 8192.0 (* 16384.0 (the float (-> self col)))) + 8192.0 + (+ 8192.0 (* 16384.0 (the float (-> self row)))) + 1.0 + ) + (vector-matrix*! (-> s5-1 trans) (-> s5-1 trans) (-> self puzzle local-to-world)) + (case arg2 + (('waiting 'beaten) + (set! (-> s5-1 trans y) (+ -16384.0 (-> s5-1 trans y))) + ) + (('follow) + (set! (-> s5-1 trans y) (+ -32768.0 (-> s5-1 trans y))) + ) + ) + (matrix->quaternion (-> s5-1 quat) (-> self puzzle local-to-world)) + (vector-identity! (-> s5-1 scale)) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-shoot-block" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (transform-post) + (set! (-> self mask) (logior (process-mask enemy) (-> self mask))) + (set! (-> self draw light-index) (the-as uint 30)) + (cond + ((= arg2 'idle) + (under-block-method-48 self (-> self col) (-> self row)) + (go-virtual idle) + ) + ((= arg2 'beaten) + (go-virtual beaten) + ) + ((= arg2 'follow) + (go-virtual follow) + ) + (else + (go-virtual waiting) + ) + ) + (none) + ) + +;; definition for method 25 of type under-shoot-block +;; WARN: Return type mismatch symbol vs none. +(defmethod under-shoot-block-method-25 under-shoot-block ((obj under-shoot-block) (arg0 int) (arg1 int) (arg2 float) (arg3 int)) + (let ((gp-0 (new 'stack-no-clear 'matrix))) + (set-vector! (-> gp-0 vector 0) -8192.0 0.0 -8192.0 1.0) + (set-vector! (-> gp-0 vector 1) -8192.0 0.0 8192.0 1.0) + (set-vector! (-> gp-0 vector 2) 8192.0 0.0 8192.0 1.0) + (set-vector! (-> gp-0 trans) 8192.0 0.0 -8192.0 1.0) + (vector-float*! (the-as vector (-> gp-0 vector)) (the-as vector (-> gp-0 vector)) arg2) + (vector-float*! (-> gp-0 vector 1) (-> gp-0 vector 1) arg2) + (vector-float*! (-> gp-0 vector 2) (-> gp-0 vector 2) arg2) + (vector-float*! (-> gp-0 trans) (-> gp-0 trans) arg2) + (let ((v1-12 (&+ gp-0 64))) + (set! (-> v1-12 vector 0 x) (+ 8192.0 (* 16384.0 (the float arg0)))) + (set! (-> v1-12 vector 0 y) 0.0) + (set! (-> v1-12 vector 0 z) (+ 8192.0 (* 16384.0 (the float arg1)))) + (set! (-> v1-12 vector 0 w) 1.0) + ) + (vector+! (the-as vector (-> gp-0 vector)) (the-as vector (-> gp-0 vector)) (the-as vector (&+ gp-0 64))) + (vector+! (-> gp-0 vector 1) (-> gp-0 vector 1) (the-as vector (&+ gp-0 64))) + (vector+! (-> gp-0 vector 2) (-> gp-0 vector 2) (the-as vector (&+ gp-0 64))) + (vector+! (-> gp-0 trans) (-> gp-0 trans) (the-as vector (&+ gp-0 64))) + (let ((s4-0 (-> obj puzzle local-to-world))) + (vector-matrix*! (the-as vector (-> gp-0 vector)) (the-as vector (-> gp-0 vector)) s4-0) + (vector-matrix*! (-> gp-0 vector 1) (-> gp-0 vector 1) s4-0) + (vector-matrix*! (-> gp-0 vector 2) (-> gp-0 vector 2) s4-0) + (vector-matrix*! (-> gp-0 trans) (-> gp-0 trans) s4-0) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> gp-0 vector)) + (-> gp-0 vector 1) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> gp-0 vector 1) + (-> gp-0 vector 2) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> gp-0 vector 2) + (-> gp-0 trans) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + (-> gp-0 trans) + (the-as vector (-> gp-0 vector)) + (the-as rgba arg3) + #f + (the-as rgba -1) + ) + ) + (none) + ) + +;; definition for method 24 of type under-shoot-block +(defmethod under-shoot-block-method-24 under-shoot-block ((obj under-shoot-block) (arg0 int) (arg1 int)) + (local-vars (v1-11 symbol) (v1-20 symbol)) + (let ((a0-1 (-> obj puzzle))) + (if (>= (-> (the-as (pointer int8) (&+ (-> a0-1 cells) (+ (* arg1 (-> a0-1 cells-wide)) arg0)))) 0) + (under-shoot-block-method-25 obj arg0 arg1 1.0 (the-as int (the-as uint #x80ffffff))) + (under-shoot-block-method-25 obj arg0 arg1 0.95 (shl #x8000 16)) + ) + ) + (let ((v1-9 (-> obj puzzle spawners))) + (countdown (a0-7 (-> v1-9 length)) + (let ((a1-5 (-> v1-9 a0-7))) + (when (and (= (-> a1-5 col) arg0) (= (-> a1-5 row) arg1)) + (set! v1-11 #t) + (goto cfg-12) + ) + ) + ) + ) + (set! v1-11 #f) + (label cfg-12) + (if v1-11 + (under-shoot-block-method-25 obj arg0 arg1 0.6 (the-as int (the-as uint #x8000ffff))) + ) + (let ((v1-18 (-> obj puzzle slots))) + (countdown (a0-9 (-> v1-18 length)) + (let ((a1-12 (-> v1-18 a0-9))) + (when (and (= (-> a1-12 col) arg0) (= (-> a1-12 row) arg1)) + (set! v1-20 #t) + (goto cfg-23) + ) + ) + ) + ) + (set! v1-20 #f) + (label cfg-23) + (if v1-20 + (under-shoot-block-method-25 obj arg0 arg1 0.6 (the-as int (the-as uint #x80ffff00))) + ) + (none) + ) + +;; definition for method 26 of type under-shoot-block +;; WARN: Return type mismatch symbol vs none. +(defmethod under-shoot-block-method-26 under-shoot-block ((obj under-shoot-block)) + (countdown (s5-0 (-> obj puzzle cells-tall)) + (countdown (s4-0 (-> obj puzzle cells-wide)) + (under-shoot-block-method-24 obj s4-0 s5-0) + ) + ) + (none) + ) + +;; definition for method 28 of type under-shoot-block +(defmethod under-shoot-block-method-28 under-shoot-block ((obj under-shoot-block)) + (let* ((v1-0 (-> obj puzzle)) + (v0-0 (+ (-> v1-0 last-block-id) 1)) + ) + (if (or (< 127 v0-0) (<= v0-0 0)) + (set! v0-0 1) + ) + (set! (-> v1-0 last-block-id) v0-0) + v0-0 + ) + ) + +;; definition for method 27 of type under-shoot-block +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defmethod under-shoot-block-method-27 under-shoot-block ((obj under-shoot-block) (arg0 symbol)) + (local-vars + (sv-16 process) + (sv-32 (function int int symbol (pointer process) none :behavior under-block)) + (sv-48 int) + (sv-64 process) + (sv-80 (function int int symbol (pointer process) none :behavior under-block)) + (sv-96 int) + (sv-112 process) + (sv-128 (function int int symbol (pointer process) none :behavior under-block)) + (sv-144 int) + ) + (let ((s4-0 (-> obj puzzle))) + (set! (-> s4-0 prev-special-attack-id) (the-as uint 0)) + (set! (-> s4-0 slot-mask) (the-as uint 0)) + (let ((v1-0 0)) + (countdown (a0-2 (-> s4-0 slots length)) + (set! v1-0 (logior v1-0 (ash 1 a0-2))) + ) + (set! (-> s4-0 slot-mask-full) (the-as uint v1-0)) + (if arg0 + (set! (-> s4-0 slot-mask) (the-as uint v1-0)) + ) + ) + (matrix-rotate-y! (-> s4-0 local-to-world) (-> s4-0 orient-ry)) + (set! (-> s4-0 local-to-world trans quad) (-> s4-0 origin quad)) + (set! (-> s4-0 local-to-world trans w) 1.0) + (let ((v1-3 (-> s4-0 cells))) + (countdown (a0-11 (* (-> s4-0 cells-wide) (-> s4-0 cells-tall))) + (when (> (-> (the-as (pointer int8) (&+ v1-3 a0-11))) 0) + (set! (-> (the-as (pointer int8) (&+ v1-3 a0-11))) 0) + 0 + ) + ) + ) + (countdown (s3-0 (-> s4-0 spawners length)) + (let ((s2-0 (-> s4-0 spawners s3-0))) + (set! (-> s2-0 exploded-time) 0) + (cond + (arg0 + (let ((s1-0 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s2-0 active-handle) + (ppointer->handle + (when s1-0 + (let ((t9-2 (method-of-type under-block activate))) + (t9-2 (the-as under-block s1-0) obj (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s0-0 run-function-in-process)) + (set! sv-16 s1-0) + (set! sv-32 under-block-init-by-other) + (set! sv-48 s3-0) + (let ((a3-1 (under-shoot-block-method-28 obj)) + (t0-0 'beaten) + (t1-0 (process->ppointer obj)) + ) + ((the-as (function object object object object object object none) s0-0) sv-16 sv-32 sv-48 a3-1 t0-0 t1-0) + ) + ) + (-> s1-0 ppointer) + ) + ) + ) + ) + (set! (-> s2-0 waiting-handle) (the-as handle #f)) + ) + (else + (let ((s1-1 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s2-0 active-handle) + (ppointer->handle + (when s1-1 + (let ((t9-6 (method-of-type under-block activate))) + (t9-6 (the-as under-block s1-1) obj (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s0-1 run-function-in-process)) + (set! sv-64 s1-1) + (set! sv-80 under-block-init-by-other) + (set! sv-96 s3-0) + (let ((a3-3 (under-shoot-block-method-28 obj)) + (t0-1 'idle) + (t1-1 (process->ppointer obj)) + ) + ((the-as (function object object object object object object none) s0-1) sv-64 sv-80 sv-96 a3-3 t0-1 t1-1) + ) + ) + (-> s1-1 ppointer) + ) + ) + ) + ) + (let ((s1-2 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s2-0 waiting-handle) + (ppointer->handle + (when s1-2 + (let ((t9-10 (method-of-type under-block activate))) + (t9-10 (the-as under-block s1-2) obj (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s0-2 run-function-in-process)) + (set! sv-112 s1-2) + (set! sv-128 under-block-init-by-other) + (set! sv-144 s3-0) + (let ((a3-5 (under-shoot-block-method-28 obj)) + (t0-2 'waiting) + (t1-2 (process->ppointer obj)) + ) + ((the-as (function object object object object object object none) s0-2) sv-112 sv-128 sv-144 a3-5 t0-2 t1-2) + ) + ) + (-> s1-2 ppointer) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function under-shoot-block-event-handler +(defbehavior under-shoot-block-event-handler under-shoot-block ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('explode) + (let ((v1-4 (-> self puzzle spawners (-> arg3 param 0)))) + (set! (-> v1-4 active-handle) (the-as handle #f)) + (set! v0-0 (-> self clock frame-counter)) + (set! (-> v1-4 exploded-time) (the-as time-frame v0-0)) + ) + v0-0 + ) + (('query) + (case (-> arg3 param 0) + (('beaten) + (and (-> self next-state) (let ((v1-8 (-> self next-state name))) + (or (= v1-8 'victory-locked) (= v1-8 'victory) (= v1-8 'beaten)) + ) + ) + ) + ) + ) + (('unlock) + (set! v0-0 #t) + (set! (-> self allow-unlock?) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + +;; failed to figure out what this is: +(defstate idle (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :trans (behavior () + (local-vars (sv-96 int)) + (let ((gp-0 (-> self puzzle))) + (if (= (-> gp-0 slot-mask) (-> gp-0 slot-mask-full)) + (go-virtual victory-locked) + ) + (let ((gp-1 (-> gp-0 spawners))) + (countdown (s5-0 (-> gp-1 length)) + (let ((s4-0 (-> gp-1 s5-0))) + (when (and (not (handle->process (-> s4-0 active-handle))) + (>= (- (-> self clock frame-counter) (-> s4-0 exploded-time)) (seconds 1)) + ) + (set! (-> s4-0 active-handle) (-> s4-0 waiting-handle)) + (let ((s3-0 (get-process *default-dead-pool* under-block #x4000))) + (set! (-> s4-0 waiting-handle) + (ppointer->handle + (when s3-0 + (let ((t9-2 (method-of-type under-block activate))) + (t9-2 (the-as under-block s3-0) self (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) + ) + (let ((s2-0 run-function-in-process) + (s1-0 s3-0) + (s0-0 under-block-init-by-other) + ) + (set! sv-96 s5-0) + (let ((a3-1 (under-shoot-block-method-28 self)) + (t0-0 'follow) + (t1-0 (process->ppointer self)) + ) + ((the-as (function object object object object object object none) s2-0) s1-0 s0-0 sv-96 a3-1 t0-0 t1-0) + ) + ) + (-> s3-0 ppointer) + ) + ) + ) + ) + (send-event (handle->process (-> s4-0 active-handle)) 'rise-up) + ) + ) + ) + ) + ) + 0 + (none) + ) + :code (the-as (function none :behavior under-shoot-block) sleep-code) + ) + +;; failed to figure out what this is: +(defstate victory-locked (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :trans (behavior () + (local-vars (v1-9 symbol)) + (let ((gp-0 (-> self puzzle spawners))) + (countdown (s5-0 (-> gp-0 length)) + (let ((v1-3 (-> gp-0 s5-0))) + (when (not (send-event (handle->process (-> v1-3 active-handle)) 'sunk-partially)) + (set! v1-9 #f) + (goto cfg-13) + ) + ) + ) + ) + (set! v1-9 #t) + (label cfg-13) + (when v1-9 + (if (-> self allow-unlock?) + (go-virtual victory) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-shoot-block) sleep-code) + ) + +;; failed to figure out what this is: +(defstate victory (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :code (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (sound-play "und-block-chime") + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (suspend) + ) + (let ((gp-1 (-> self puzzle spawners))) + (countdown (s5-1 (-> gp-1 length)) + (let ((v1-10 (-> gp-1 s5-1))) + (send-event (handle->process (-> v1-10 active-handle)) 'victory) + ) + ) + ) + (let ((v1-17 (-> self actor-group))) + (when v1-17 + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'trigger) + (let ((t9-4 send-event-function) + (v1-19 (-> v1-17 0 data 1 actor)) + ) + (t9-4 + (if v1-19 + (-> v1-19 extra process) + ) + a1-3 + ) + ) + ) + ) + ) + (go-virtual beaten) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate beaten (under-shoot-block) + :virtual #t + :event under-shoot-block-event-handler + :code (the-as (function none :behavior under-shoot-block) sleep-code) + ) + +;; definition for method 10 of type under-shoot-block +(defmethod deactivate under-shoot-block ((obj under-shoot-block)) + (let ((s5-0 (-> obj puzzle spawners))) + (countdown (s4-0 (-> s5-0 length)) + (let ((s3-0 (-> s5-0 s4-0))) + (send-event (handle->process (-> s3-0 active-handle)) 'die-fast) + (send-event (handle->process (-> s3-0 waiting-handle)) 'die-fast) + ) + ) + ) + ((the-as (function process-drawable none) (find-parent-method under-shoot-block 10)) obj) + (none) + ) + +;; definition for method 11 of type under-shoot-block +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-shoot-block ((obj under-shoot-block) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (let ((s5-1 (res-lump-value (-> obj entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) + (if (or (< (the-as int s5-1) 0) (>= (the-as int s5-1) (-> *under-block-puzzles* length))) + (go process-drawable-art-error "bad puzzle id") + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((a0-7 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (if (and a0-7 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) a0-7)) + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + ) + ) + (let ((v1-13 (-> *under-block-puzzles* s5-1))) + (set! (-> obj puzzle) v1-13) + (set! (-> obj allow-unlock?) (-> v1-13 auto-unlock?)) + ) + ) + (let ((s5-2 + (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + ) + ) + (under-shoot-block-method-27 obj (the-as symbol s5-2)) + (if s5-2 + (go (method-of-object obj beaten)) + (go (method-of-object obj idle)) + ) + ) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc b/test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc new file mode 100644 index 0000000000..53f9dc2c16 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/under-sig-obs_REF.gc @@ -0,0 +1,1709 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type under-plat-shoot +(deftype under-plat-shoot (plat) + ((draw-test-script script-context :offset-assert 324) + (incoming-attack-id uint32 :offset-assert 328) + (angle-flip float :offset-assert 332) + (angle-flip-vel float :offset-assert 336) + (state-flip uint32 :offset-assert 340) + (time-flip uint32 :offset-assert 344) + (disable-track-under basic :offset-assert 348) + (dest-angle float :offset-assert 352) + (on-shake basic :offset-assert 356) + (hint-count float :offset-assert 360) + (hit-time time-frame :offset-assert 368) + (knocked-sound-time time-frame :offset-assert 376) + (axe-flip vector :inline :offset-assert 384) + ) + :heap-base #x110 + :method-count-assert 39 + :size-assert #x190 + :flag-assert #x2701100190 + (:methods + (die-falling () _type_ :state 37) + (dormant () _type_ :state 38) + ) + ) + +;; definition for method 3 of type under-plat-shoot +(defmethod inspect under-plat-shoot ((obj under-plat-shoot)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type plat inspect))) + (t9-0 obj) + ) + (format #t "~2Tdraw-test-script: ~A~%" (-> obj draw-test-script)) + (format #t "~2Tincoming-attack-id: ~D~%" (-> obj incoming-attack-id)) + (format #t "~2Tangle-flip: ~f~%" (-> obj angle-flip)) + (format #t "~2Tangle-flip-vel: ~f~%" (-> obj angle-flip-vel)) + (format #t "~2Tstate-flip: ~D~%" (-> obj state-flip)) + (format #t "~2Ttime-flip: ~D~%" (-> obj time-flip)) + (format #t "~2Tdisable-track-under: ~A~%" (-> obj disable-track-under)) + (format #t "~2Tdest-angle: ~f~%" (-> obj dest-angle)) + (format #t "~2Ton-shake: ~A~%" (-> obj on-shake)) + (format #t "~2Thint-count: ~f~%" (-> obj hint-count)) + (format #t "~2Thit-time: ~D~%" (-> obj hit-time)) + (format #t "~2Tknocked-sound-time: ~D~%" (-> obj hit-time)) + (format #t "~2Taxe-flip: #~%" (-> obj axe-flip)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-plat-shoot under-plat-shoot under-plat-shoot-lod0-jg under-plat-shoot-idle-ja + ((under-plat-shoot-lod0-mg (meters 20)) (under-plat-shoot-lod1-mg (meters 999999))) + :bounds (static-spherem 0 0 0 5.1) + ) + +;; definition for method 30 of type under-plat-shoot +(defmethod get-art-group under-plat-shoot ((obj under-plat-shoot)) + "@returns The associated [[art-group]]" + (art-group-get-by-name *level* "skel-under-plat-shoot" (the-as (pointer uint32) #f)) + ) + +;; definition for function cshape-reaction-under-plat-shoot +(defbehavior cshape-reaction-under-plat-shoot under-plat-shoot ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (let ((gp-0 (cshape-reaction-default arg0 arg1 arg2 arg3))) + (when (logtest? gp-0 (collide-status touch-surface)) + (let ((s5-0 self)) + (when (>= (- (-> self clock frame-counter) (-> s5-0 hit-time)) (seconds 0.25)) + (sound-play "shoot-plat-fall") + (set! (-> s5-0 hit-time) (-> self clock frame-counter)) + ) + ) + ) + gp-0 + ) + ) + +;; definition for method 31 of type under-plat-shoot +;; WARN: Return type mismatch int vs none. +(defmethod init-plat-collision! under-plat-shoot ((obj under-plat-shoot)) + "TODO - collision stuff for setting up the platform" + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s5-0 (new 'process 'collide-shape-moving obj (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-under-plat-shoot) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot obstacle hit-by-others-list player-list pusher) + ) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 -4915.2 0.0 17203.2) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (let ((v1-16 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-16 prim-core collide-as) (collide-spec pusher)) + (set! (-> v1-16 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-16 prim-core action) (collide-action solid rideable)) + (set! (-> v1-16 transform-index) 0) + (set-vector! (-> v1-16 local-sphere) 0.0 -4915.2 0.0 17203.2) + ) + (let ((v1-18 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-18 prim-core collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-18 prim-core action) (collide-action solid)) + (set! (-> v1-18 transform-index) 0) + (set-vector! (-> v1-18 local-sphere) 0.0 -4915.2 0.0 13516.8) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-21 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-21 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-21 prim-core collide-with)) + ) + (set! (-> s5-0 rider-max-momentum) 0.0) + (set! (-> s5-0 max-iteration-count) (the-as uint 5)) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +;; definition for method 32 of type under-plat-shoot +;; WARN: Return type mismatch int vs none. +(defmethod base-plat-method-32 under-plat-shoot ((obj under-plat-shoot)) + 0 + (none) + ) + +;; definition for method 33 of type under-plat-shoot +;; WARN: Return type mismatch int vs none. +(defmethod init-plat! under-plat-shoot ((obj under-plat-shoot)) + "Does any necessary initial platform setup. +For example for an elevator pre-compute the distance between the first and last points (both ways) and clear the sound." + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj mask) (logior (process-mask enemy) (-> obj mask))) + (set-vector! (-> obj axe-flip) 1.0 0.0 0.0 1.0) + (set! (-> obj angle-flip) 180.0) + (set! (-> obj time-flip) (the-as uint 570)) + (set! (-> obj draw-test-script) (res-lump-struct (-> obj entity) 'on-activate script-context)) + (set! (-> obj disable-track-under) #f) + (if (>= (res-lump-value (-> obj entity) 'extra-id int :default (the-as uint128 -1) :time -1000000000.0) 0) + (set! (-> obj disable-track-under) (the-as basic #t)) + ) + (set! (-> obj hint-count) 0.0) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "shoot-plat-lp" :fo-max 70) (-> obj root-override trans)) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate dormant (under-plat-shoot) + :virtual #t + :enter (behavior () + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-4 (-> self root-override root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) + ) + 0 + (none) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-3 (-> self root-override root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root-override backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> self root-override backup-collide-with)) + ) + (none) + ) + :trans (behavior () + (when (not (eval! + (new 'stack 'script-context (the-as basic (process->ppointer self)) self (the-as vector #f)) + (the-as pair (-> self draw-test-script)) + ) + ) + enter-state + #t + (go-virtual plat-path-active) + ) + (none) + ) + :code (the-as (function none :behavior under-plat-shoot) sleep-code) + ) + +;; failed to figure out what this is: +(defstate plat-path-active (under-plat-shoot) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as + object + (case event-type + (('bonk) + (the-as object (start-bouncing! self)) + ) + (('attack) + (when (zero? (-> self state-flip)) + (let ((s5-0 (the-as object (-> event param 1)))) + (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming-attack-id)) + (set! (-> self incoming-attack-id) (-> (the-as attack-info s5-0) id)) + (let* ((gp-0 proc) + (s4-0 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when s4-0 + (let* ((s3-0 (-> (the-as process-drawable s4-0) root)) + (gp-1 (if (type? (the-as collide-shape s3-0) collide-shape) + s3-0 + ) + ) + ) + (when gp-1 + (when (logtest? (-> (the-as collide-shape gp-1) root-prim prim-core collide-as) (collide-spec projectile)) + (when (zero? (-> self state-flip)) + (sound-play "mtn-plat-flip1") + (set! (-> self state-flip) (the-as uint 1)) + ) + (if (= (-> (find-offending-process-focusable s4-0 (the-as attack-info s5-0)) type) target) + (set! (-> self time-flip) (the-as uint 1140)) + (set! (-> self time-flip) (the-as uint 570)) + ) + (set! (-> self hint-count) -1.0) + (vector-! (-> self axe-flip) (-> gp-1 trans) (-> self root-override trans)) + (set! (-> self axe-flip y) 0.0) + (vector-normalize! (-> self axe-flip) 1.0) + (vector-rotate90-around-y! (-> self axe-flip) (-> self axe-flip)) + (set! (-> self angle-flip-vel) -10.0) + (set! (-> self state-time) (-> self clock frame-counter)) + ) + ) + ) + ) + ) + #f + ) + ) + ) + ) + (('hint) + (when (>= (-> self hint-count) 0.0) + (+! (-> self hint-count) (-> self clock seconds-per-frame)) + (if (< 6.0 (-> self hint-count)) + #f + ) + ) + ) + (('track) + (cond + ((-> event param 0) + (if (zero? (-> self state-flip)) + #t + 'abort + ) + ) + ((and *target* + (-> self disable-track-under) + (< (-> *target* control trans y) (+ -20480.0 (-> self root-override trans y))) + ) + #f + ) + (else + (zero? (-> self state-flip)) + ) + ) + ) + (('centipede) + (when (not (and (-> self next-state) (let ((v1-39 (-> self next-state name))) + (or (= v1-39 'die-falling) (= v1-39 'empty-state)) + ) + ) + ) + (vector-reset! (-> self root-override transv)) + (let* ((gp-2 proc) + (a0-11 (if (type? (the-as process-focusable gp-2) process-focusable) + gp-2 + ) + ) + ) + (when a0-11 + (vector-! + (-> self root-override transv) + (-> self root-override trans) + (get-trans (the-as process-focusable a0-11) 0) + ) + (set! (-> self root-override transv y) 0.0) + (vector-normalize! (-> self root-override transv) 163840.0) + (set! (-> self root-override transv y) 20480.0) + ) + ) + (go-virtual die-falling) + ) + ) + ) + ) + ) + :enter (behavior () + (let ((t9-0 (-> (method-of-type plat plat-path-active) enter))) + (if t9-0 + (t9-0) + ) + ) + (set! (-> self dest-angle) 180.0) + (set! (-> self on-shake) #f) + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (-> self time-flip))) + (set! (-> self state-flip) (the-as uint 0)) + 0 + ) + (cond + ((zero? (-> self state-flip)) + (set! (-> self on-shake) #f) + (when (!= (-> self dest-angle) 180.0) + (sound-play "mtn-plat-flip2") + (set! (-> self dest-angle) 180.0) + ) + ) + (else + (if (!= (-> self dest-angle) 0.0) + (set! (-> self dest-angle) 0.0) + ) + ) + ) + (+! (-> self angle-flip-vel) + (* -0.5 (-> self clock seconds-per-frame) (- (-> self angle-flip) (-> self dest-angle))) + ) + (+! (-> self angle-flip-vel) (* -6.0 (-> self clock seconds-per-frame) (-> self angle-flip-vel))) + (+! (-> self angle-flip) (-> self angle-flip-vel)) + (if (!= *bot-record-path* -1) + (set! (-> self angle-flip) 0.0) + ) + (quaternion-vector-angle! (-> self root-override quat) (-> self axe-flip) (* 182.04445 (-> self angle-flip))) + (when (and (>= (- (-> self clock frame-counter) (-> self state-time)) (the-as time-frame (+ (-> self time-flip) -300))) + (= 1 (-> self state-flip)) + ) + (when (not (-> self on-shake)) + (sound-play "mtn-plat-shake") + (set! (-> self on-shake) (the-as basic #t)) + ) + (let ((s5-2 (new 'stack-no-clear 'vector)) + (gp-2 (new 'stack-no-clear 'quaternion)) + ) + (set-vector! + s5-2 + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + (rand-vu-float-range -1.0 1.0) + 1.0 + ) + (vector-normalize! s5-2 1.0) + (quaternion-vector-angle! gp-2 s5-2 910.2222) + (quaternion-pseudo-seek + (-> self root-override quat) + (-> self root-override quat) + gp-2 + (-> self clock seconds-per-frame) + ) + ) + ) + (quaternion-normalize! (-> self root-override quat)) + (let ((t9-12 (-> (method-of-type plat plat-path-active) trans))) + (if t9-12 + (t9-12) + ) + ) + (none) + ) + :post (behavior () + (let ((t9-0 (-> (method-of-type plat plat-path-active) post))) + (if t9-0 + ((the-as (function none) t9-0)) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate die-falling (under-plat-shoot) + :virtual #t + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (logclear! (-> self mask) (process-mask actor-pause enemy platform)) + (let ((v1-7 (-> (the-as collide-shape-prim-group (-> self root-override root-prim)) child 0))) + (set! (-> v1-7 prim-core collide-as) (collide-spec)) + (set! (-> v1-7 prim-core collide-with) (collide-spec)) + ) + 0 + (none) + ) + :trans (behavior () + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (let ((f30-0 (* 0.0016666667 (the float (+ (- (seconds -1) (-> self state-time)) (-> self clock frame-counter)))))) + (when (>= f30-0 1.0) + (cleanup-for-death self) + (go empty-state) + ) + (let ((f0-3 (- 1.0 f30-0))) + (set-vector! (-> self root-override scale) f0-3 f0-3 f0-3 1.0) + ) + ) + ) + (none) + ) + :code (behavior () + (let ((f30-0 (rand-vu-float-range 0.5 0.8))) + (sound-play-by-name + (static-sound-name "und-floor-break") + (new-sound-id) + 716 + (the int (* 1524.0 f30-0)) + 0 + (sound-group sfx) + #t + ) + ) + (set! (-> self hit-time) (-> self clock frame-counter)) + (let ((gp-1 (new 'stack-no-clear 'quaternion)) + (s5-1 (new 'stack-no-clear 'quaternion)) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-1 0.0) + ) + (vector-normalize-copy! s4-0 (-> self root-override transv) 1.0) + (vector-rotate90-around-y! s4-0 s4-0) + (quaternion-copy! gp-1 (-> self root-override quat)) + (until #f + (+! f30-1 (* 65536.0 (-> self clock seconds-per-frame))) + (quaternion-vector-angle! s5-1 s4-0 (- f30-1)) + (quaternion*! (-> self root-override quat) s5-1 gp-1) + (suspend) + ) + ) + #f + (none) + ) + :post (behavior () + (let ((v1-0 (-> self root-override))) + (set! (-> v1-0 transv y) (- (-> v1-0 transv y) (* 512000.0 (-> self clock seconds-per-frame)))) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-0 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a2-0 ignore-process0) self) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-0 (-> v1-0 transv) a2-0 (meters 0)) + ) + ) + (ja-post) + (none) + ) + ) + +;; definition for method 36 of type under-plat-shoot +(defmethod plat-path-sync under-plat-shoot ((obj under-plat-shoot)) + "If the `sync` period is greater than `0` then transition the state to [[plat::35]] +otherwise, [[plat::34]] + +@see [[sync-eased]]" + (with-pp + (cond + ((and (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair (-> obj draw-test-script)) + ) + (= *bot-record-path* -1) + ) + (go (method-of-object obj dormant)) + ) + (else + enter-state + #t + (go (method-of-object obj plat-path-active)) + ) + ) + ) + ) + +;; definition of type under-break-floor +(deftype under-break-floor (process-drawable) + ((root-override collide-shape-moving :offset 128) + ) + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc8 + :flag-assert #x17005000c8 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (die-fast () _type_ :state 22) + ) + ) + +;; definition for method 3 of type under-break-floor +(defmethod inspect under-break-floor ((obj under-break-floor)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-break-floor under-break-floor under-break-floor-lod0-jg under-break-floor-idle-ja + ((under-break-floor-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 7.25) + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-break-floor-explode under-break-floor under-break-floor-explode-lod0-jg under-break-floor-explode-idle-ja + ((under-break-floor-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 15) + ) + +;; definition for symbol *under-break-floor-exploder-params*, type joint-exploder-static-params +(define *under-break-floor-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 3 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 4 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 5 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 6 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 7 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 8 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 9 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 10 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 11 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 12 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 13 :parent-joint-index -1) + ) + :collide-spec #x1 + ) + ) + +;; failed to figure out what this is: +(defstate idle (under-break-floor) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as + object + (case event-type + (('attack) + (when (logtest? (-> (the-as attack-info (-> event param 1)) penetrate-using) (penetrate flop)) + (go-virtual die) + #f + ) + ) + ) + ) + ) + :code (the-as (function none :behavior under-break-floor) sleep-code) + ) + +;; failed to figure out what this is: +(defstate die (under-break-floor) + :virtual #t + :enter (behavior () + (let ((v1-1 (-> self root-override root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (none) + ) + :code (behavior () + ((lambda () + (with-pp + (sound-play "und-floor-break") + (let ((gp-1 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (set! (-> gp-1 duration) (seconds 0.6)) + (set-vector! (-> gp-1 fountain-rand-transv-lo) -98304.0 24576.0 -98304.0 1.0) + (set-vector! (-> gp-1 fountain-rand-transv-hi) 98304.0 114688.0 98304.0 1.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-under-break-floor-explode" (the-as (pointer uint32) #f)) + 5 + gp-1 + *under-break-floor-exploder-params* + :to pp + ) + ) + ) + ) + ) + (suspend) + (ja-channel-set! 0) + (let ((gp-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-0) (seconds 1)) + (suspend) + ) + ) + (send-event self 'death-end) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + (none) + ) + :post (the-as (function none :behavior under-break-floor) ja-post) + ) + +;; failed to figure out what this is: +(defstate die-fast (under-break-floor) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; definition for method 11 of type under-break-floor +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-floor ((obj under-break-floor) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) + (set! (-> s4-0 total-prims) (the-as uint 3)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid)) + (set! (-> s3-0 transform-index) 0) + (set-vector! (-> s3-0 local-sphere) 0.0 0.0 0.0 20480.0) + (set! (-> s4-0 root-prim) s3-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 0) + (set-vector! (-> v1-8 local-sphere) 0.0 0.0 0.0 20480.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 0) + (set-vector! (-> v1-10 local-sphere) 0.0 0.0 0.0 20480.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-13 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (set! (-> obj root-override penetrated-by) (penetrate flop)) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-break-floor" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> obj draw light-index) (the-as uint 3)) + (let ((a0-20 (-> obj skel root-channel 0))) + (set! (-> a0-20 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-20 frame-num) 0.0) + (joint-control-channel-group! a0-20 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-identity) + ) + (transform-post) + (if (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete))) + (go (method-of-object obj die-fast)) + (go (method-of-object obj idle)) + ) + (none) + ) + +;; definition of type under-break-wall +(deftype under-break-wall (process-drawable) + () + :heap-base #x50 + :method-count-assert 22 + :size-assert #xc8 + :flag-assert #x16005000c8 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + ) + ) + +;; definition for method 3 of type under-break-wall +(defmethod inspect under-break-wall ((obj under-break-wall)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-break-wall1 under-break-wall under-break-wall-lod0-jg under-break-wall-idle-ja + ((under-break-wall-lod0-mg (meters 999999))) + :bounds (static-spherem 8.5 1.8 -1.3 10) + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-break-wall2 under-break-wall-b under-break-wall-b-lod0-jg under-break-wall-b-idle-ja + ((under-break-wall-b-lod0-mg (meters 999999))) + :bounds (static-spherem 8.5 1.8 -1.3 10) + ) + +;; failed to figure out what this is: +(defstate idle (under-break-wall) + :virtual #t + :code (the-as (function none :behavior under-break-wall) sleep-code) + ) + +;; failed to figure out what this is: +(defstate die (under-break-wall) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; definition for method 11 of type under-break-wall +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-wall ((obj under-break-wall) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (with-pp + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 4) + (set-vector! (-> v1-2 local-sphere) 5324.8 -18432.0 -8192.0 32768.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-2) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-5 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (if (= (res-lump-value (-> obj entity) 'extra-id uint :time -1000000000.0) 2) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-break-wall2" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-break-wall1" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (let ((s4-4 (-> obj root))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-15 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-15 + (+! (-> obj root trans x) (-> v1-15 0)) + (+! (-> obj root trans y) (-> v1-15 1)) + (+! (-> obj root trans z) (-> v1-15 2)) + ) + ) + (let ((f0-12 (res-lump-float arg0 'rotoffset))) + (if (!= f0-12 0.0) + (quaternion-rotate-y! (-> s4-4 quat) (-> s4-4 quat) f0-12) + ) + ) + ) + (transform-post) + (if (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (res-lump-struct (-> obj entity) 'on-activate pair) + ) + (go (method-of-object obj die)) + (go (method-of-object obj idle)) + ) + (none) + ) + ) + +;; definition of type under-break-bridge +(deftype under-break-bridge (process-drawable) + ((root-override collide-shape-moving :offset 128) + (bridge-id int8 :offset-assert 200) + ) + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc9 + :flag-assert #x17005000c9 + (:methods + (idle () _type_ :state 20) + (broken () _type_ :state 21) + (die () _type_ :state 22) + ) + ) + +;; definition for method 3 of type under-break-bridge +(defmethod inspect under-break-bridge ((obj under-break-bridge)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tbridge-id: ~D~%" (-> obj bridge-id)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-bridge1 under-break-bridge under-break-bridge-lod0-jg under-break-bridge-idle-ja + ((under-break-bridge-lod0-mg (meters 999999))) + :bounds (static-spherem 3 0 -6.5 14) + :origin-joint-index 3 + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-bridge2 under-break-bridge-b under-break-bridge-b-lod0-jg under-break-bridge-b-idle-ja + ((under-break-bridge-b-lod0-mg (meters 999999))) + :bounds (static-spherem 3 0 -6.5 14) + :origin-joint-index 3 + ) + +;; failed to figure out what this is: +(defstate idle (under-break-bridge) + :virtual #t + :code (the-as (function none :behavior under-break-bridge) sleep-code) + ) + +;; failed to figure out what this is: +(defstate broken (under-break-bridge) + :virtual #t + :code (behavior () + (set! (-> self draw origin-joint-index) (the-as uint 54)) + (let* ((v1-2 (-> self root-override root-prim)) + (a1-0 (-> (the-as collide-shape-prim-group v1-2) child 0)) + (a0-3 (-> (the-as collide-shape-prim-group v1-2) child 1)) + ) + (set! (-> a1-0 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 transform-index) (-> a0-3 transform-index)) + (set! (-> v1-2 local-sphere quad) (-> a0-3 local-sphere quad)) + (set! (-> self draw bounds quad) (-> a0-3 local-sphere quad)) + (set! (-> a0-3 prim-core collide-as) (-> v1-2 prim-core collide-as)) + ) + (ja-channel-push! 1 0) + (ja :group! (-> self draw art-group data 3) :num! min) + (transform-post) + (sleep-code) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate die (under-break-bridge) + :virtual #t + :code (behavior () + (cleanup-for-death self) + (none) + ) + ) + +;; definition for method 11 of type under-break-bridge +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-break-bridge ((obj under-break-bridge) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (with-pp + (set! (-> obj bridge-id) (res-lump-value (-> obj entity) 'extra-id int :time -1000000000.0)) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) + (set! (-> s4-0 total-prims) (the-as uint 3)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s3-0 prim-core action) (collide-action solid)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 12288.0 0.0 -26624.0 57344.0) + (set! (-> s4-0 root-prim) s3-0) + ) + (let ((v1-9 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-9 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-9 prim-core action) (collide-action solid)) + (set! (-> v1-9 transform-index) 3) + (set-vector! (-> v1-9 local-sphere) 12288.0 0.0 -26624.0 57344.0) + ) + (let ((v1-11 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-11 prim-core action) (collide-action solid)) + (set! (-> v1-11 transform-index) 54) + (set-vector! (-> v1-11 local-sphere) 0.0 0.0 49152.0 61440.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-14 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (process-drawable-from-entity! obj arg0) + (if (= (res-lump-value (-> obj entity) 'extra-id uint :time -1000000000.0) 1) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-bridge2" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-bridge1" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + ) + (let ((s4-4 (-> obj root-override))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-24 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-24 + (+! (-> obj root-override trans x) (-> v1-24 0)) + (+! (-> obj root-override trans y) (-> v1-24 1)) + (+! (-> obj root-override trans z) (-> v1-24 2)) + ) + ) + (let ((f0-20 (res-lump-float arg0 'rotoffset))) + (if (!= f0-20 0.0) + (quaternion-rotate-y! (-> s4-4 quat) (-> s4-4 quat) f0-20) + ) + ) + ) + (transform-post) + (cond + ((eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (res-lump-struct (-> obj entity) 'on-activate pair) + ) + (if (= (-> obj bridge-id) 1) + (go (method-of-object obj broken)) + (go (method-of-object obj die)) + ) + ) + (else + (go (method-of-object obj idle)) + ) + ) + (none) + ) + ) + +;; definition of type under-int-door +(deftype under-int-door (process-drawable) + () + :heap-base #x50 + :method-count-assert 23 + :size-assert #xc8 + :flag-assert #x17005000c8 + (:methods + (idle-closed () _type_ :state 20) + (open () _type_ :state 21) + (idle-open () _type_ :state 22) + ) + ) + +;; definition for method 3 of type under-int-door +(defmethod inspect under-int-door ((obj under-int-door)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-int-door under-int-door under-int-door-lod0-jg -1 + ((under-int-door-lod0-mg (meters 999999))) + :bounds (static-spherem 0 6 0 15) + ) + +;; failed to figure out what this is: +(defstate idle-closed (under-int-door) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('trigger) + (go-virtual open) + ) + ) + ) + :code (the-as (function none :behavior under-int-door) sleep-code) + ) + +;; failed to figure out what this is: +(defstate open (under-int-door) + :virtual #t + :code (behavior () + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (sound-play "und-block-door") + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-no-eval :group! (-> self draw art-group data 2) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1)) 0.13) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.13)) + ) + (logclear! (-> self skel status) (joint-control-status sync-math)) + (go-virtual idle-open) + (none) + ) + :post (the-as (function none :behavior under-int-door) transform-post) + ) + +;; failed to figure out what this is: +(defstate idle-open (under-int-door) + :virtual #t + :code (the-as (function none :behavior under-int-door) sleep-code) + ) + +;; definition for method 11 of type under-int-door +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-int-door ((obj under-int-door) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (with-pp + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) + (set! (-> s4-0 total-prims) (the-as uint 3)) + (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s3-0 prim-core action) (collide-action solid)) + (set-vector! (-> s3-0 local-sphere) 0.0 24576.0 0.0 57344.0) + (set! (-> s4-0 root-prim) s3-0) + ) + (let ((v1-7 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-7 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set! (-> v1-7 transform-index) 3) + (set-vector! (-> v1-7 local-sphere) 8192.0 24576.0 0.0 28672.0) + ) + (let ((v1-9 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-9 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-9 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-9 prim-core action) (collide-action solid)) + (set! (-> v1-9 transform-index) 4) + (set-vector! (-> v1-9 local-sphere) -8192.0 24576.0 0.0 28672.0) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-12 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-12 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-12 prim-core collide-with)) + ) + (set! (-> obj root) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-int-door" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-18 (res-lump-data (-> obj entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (when (and v1-18 (nonzero? (-> sv-16 elt-count))) + (let ((a0-25 (-> v1-18 0 data 0 actor))) + (if (and a0-25 (logtest? (-> a0-25 extra perm status) (entity-perm-status subtask-complete))) + (process-entity-status! obj (entity-perm-status subtask-complete) #t) + ) + ) + ) + ) + (ja-channel-push! 1 0) + (let ((s5-2 #t)) + (cond + ((eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (res-lump-struct (-> obj entity) 'on-activate pair) + ) + (set! s5-2 #f) + ) + ((not (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete)))) + (set! s5-2 #f) + ) + ) + (cond + (s5-2 + (let ((a0-40 (-> obj skel root-channel 0))) + (set! (-> a0-40 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-40 param 0) 1.0) + (set! (-> a0-40 frame-num) + (the float (+ (-> (the-as art-joint-anim (-> obj draw art-group data 2)) frames num-frames) -1)) + ) + (joint-control-channel-group! a0-40 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-loop!) + ) + ) + (else + (let ((a0-41 (-> obj skel root-channel 0))) + (set! (-> a0-41 frame-group) (the-as art-joint-anim (-> obj draw art-group data 2))) + (set! (-> a0-41 param 0) 1.0) + (set! (-> a0-41 frame-num) 0.0) + (joint-control-channel-group! a0-41 (the-as art-joint-anim (-> obj draw art-group data 2)) num-func-loop!) + ) + ) + ) + (transform-post) + (if s5-2 + (go (method-of-object obj idle-open)) + (go (method-of-object obj idle-closed)) + ) + ) + (none) + ) + ) + +;; definition of type under-plat-long +(deftype under-plat-long (base-plat) + ((sync sync-eased :inline :offset-assert 272) + (move-start vector :inline :offset-assert 320) + (move-end vector :inline :offset-assert 336) + ) + :heap-base #xe0 + :method-count-assert 35 + :size-assert #x160 + :flag-assert #x2300e00160 + (:methods + (idle () _type_ :state 34) + ) + ) + +;; definition for method 3 of type under-plat-long +(defmethod inspect under-plat-long ((obj under-plat-long)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type base-plat inspect))) + (t9-0 obj) + ) + (format #t "~2Tsync: #~%" (-> obj sync)) + (format #t "~2Tmove-start: #~%" (-> obj move-start)) + (format #t "~2Tmove-end: #~%" (-> obj move-end)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-plat-long under-plat-long under-plat-long-lod0-jg under-plat-long-idle-ja + ((under-plat-long-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 11.5) + :origin-joint-index 3 + ) + +;; failed to figure out what this is: +(defstate idle (under-plat-long) + :virtual #t + :event (the-as (function process int symbol event-message-block object :behavior under-plat-long) plat-event) + :trans (behavior () + (plat-trans) + (vector-lerp! + (-> self root-override trans) + (-> self move-start) + (-> self move-end) + (get-norm! (-> self sync) 0) + ) + (none) + ) + :code (the-as (function none :behavior under-plat-long) sleep-code) + :post (the-as (function none :behavior under-plat-long) plat-post) + ) + +;; definition for method 31 of type under-plat-long +;; WARN: Return type mismatch int vs none. +(defmethod init-plat-collision! under-plat-long ((obj under-plat-long)) + "TODO - collision stuff for setting up the platform" + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum usually-hit-by-player)))) + (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) (collide-spec pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 47104.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + (pusher-init s5-0) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-14 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +;; definition for method 11 of type under-plat-long +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-plat-long ((obj under-plat-long) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (init-plat-collision! obj) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-plat-long" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (stop-bouncing! obj) + (let ((s5-1 (-> obj root-override))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-8 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (when v1-8 + (+! (-> s5-1 trans x) (-> v1-8 0)) + (+! (-> s5-1 trans y) (-> v1-8 1)) + (+! (-> s5-1 trans z) (-> v1-8 2)) + ) + ) + (let ((f0-6 (res-lump-float arg0 'rotoffset))) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> s5-1 quat) (-> s5-1 quat) f0-6) + ) + ) + (set! (-> obj move-start quad) (-> s5-1 trans quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! s3-1 (-> s5-1 quat)) + (vector-rotate90-around-y! s3-1 s3-1) + (let ((f0-7 (res-lump-float arg0 'distance :default 65536.0))) + (vector+float*! (-> obj move-end) (-> obj move-start) s3-1 f0-7) + ) + ) + (let ((a1-10 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-16 0)) + (if #t + (set! v1-16 (logior v1-16 1)) + ) + (set! (-> a1-10 sync-type) 'sync-eased) + (set! (-> a1-10 sync-flags) (the-as sync-flags v1-16)) + ) + (set! (-> a1-10 period) (the-as uint 1800)) + (set! (-> a1-10 entity) arg0) + (set! (-> a1-10 percent) 0.0) + (set! (-> a1-10 ease-in) 0.15) + (set! (-> a1-10 ease-out) 0.15) + (set! (-> a1-10 pause-in) 0.0) + (set! (-> a1-10 pause-out) 0.0) + (initialize! (-> obj sync) a1-10) + ) + (vector-lerp! (-> s5-1 trans) (-> obj move-start) (-> obj move-end) (get-norm! (-> obj sync) 0)) + ) + (transform-post) + (set! (-> obj sound) + (new 'process 'ambient-sound (static-sound-spec "und-float-plat" :fo-max 50) (-> obj root-override trans)) + ) + (base-plat-method-32 obj) + (set! (-> obj fact) + (new 'process 'fact-info obj (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (go (method-of-object obj idle)) + (none) + ) + +;; definition of type under-plat-wall +(deftype under-plat-wall (process-drawable) + ((root-override collide-shape-moving :offset 128) + (extended-amount float :offset-assert 200) + (in-trans vector :inline :offset-assert 208) + (out-trans vector :inline :offset-assert 224) + (sync sync-paused :inline :offset-assert 240) + ) + :heap-base #x90 + :method-count-assert 21 + :size-assert #x108 + :flag-assert #x1500900108 + (:methods + (active () _type_ :state 20) + ) + ) + +;; definition for method 3 of type under-plat-wall +(defmethod inspect under-plat-wall ((obj under-plat-wall)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Textended-amount: ~f~%" (-> obj extended-amount)) + (format #t "~2Tin-trans: #~%" (-> obj in-trans)) + (format #t "~2Tout-trans: #~%" (-> obj out-trans)) + (format #t "~2Tsync: #~%" (-> obj sync)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-plat-wall under-plat-wall under-plat-wall-lod0-jg -1 + ((under-plat-wall-lod0-mg (meters 999999))) + :bounds (static-spherem 0 -2 6 8) + ) + +;; failed to figure out what this is: +(defstate active (under-plat-wall) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) + ) + :enter (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (none) + ) + :exit (behavior () + (logior! (-> self mask) (process-mask actor-pause)) + (none) + ) + :trans (the-as (function none :behavior under-plat-wall) rider-trans) + :code (behavior () + (let ((gp-0 #t)) + (until #f + (let ((f30-0 (get-norm! (-> self sync) 0))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-lerp! s5-0 (-> self in-trans) (-> self out-trans) f30-0) + (move-to-point! (-> self root-override) s5-0) + ) + (cond + ((= f30-0 0.0) + (set! gp-0 #f) + ) + ((= f30-0 1.0) + (set! gp-0 #f) + ) + (else + (when (not gp-0) + (sound-play "und-wall-plat") + (set! gp-0 #t) + ) + ) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + :post (the-as (function none :behavior under-plat-wall) rider-post) + ) + +;; definition for method 11 of type under-plat-wall +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-plat-wall ((obj under-plat-wall) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (set! (-> obj extended-amount) 0.0) + (set! (-> obj mask) (logior (process-mask platform) (-> obj mask))) + (set! (-> obj clock) (-> *display* user0-clock)) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (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-spec pusher)) + (set! (-> s3-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s3-0 prim-core action) (collide-action solid rideable pull-rider-can-collide)) + (set! (-> s3-0 transform-index) 3) + (set-vector! (-> s3-0 local-sphere) 0.0 -8192.0 24576.0 32768.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) s3-0) + ) + (pusher-init s4-0) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-16 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-16 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + ) + (set! (-> s4-0 rider-max-momentum) 0.0) + (set! (-> obj root-override) (the-as collide-shape-moving s4-0)) + ) + (process-drawable-from-entity! obj arg0) + (initialize-skeleton + obj + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-plat-wall" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (logior! (-> obj skel status) (joint-control-status sync-math)) + (let ((a1-6 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-24 0)) + (if #t + (set! v1-24 (logior v1-24 1)) + ) + (set! (-> a1-6 sync-type) 'sync-paused) + (set! (-> a1-6 sync-flags) (the-as sync-flags v1-24)) + ) + (set! (-> a1-6 entity) (-> obj entity)) + (set! (-> a1-6 period) (the-as uint 1500)) + (set! (-> a1-6 percent) 0.0) + (set! (-> a1-6 pause-in) 0.2) + (set! (-> a1-6 pause-out) 0.2) + (initialize! (-> obj sync) a1-6) + ) + (let ((f30-0 (quaternion-y-angle (-> obj root-override quat))) + (s4-2 (new 'stack-no-clear 'vector)) + ) + (set-vector! s4-2 0.0 0.0 (res-lump-float arg0 'tunemeters) 1.0) + (vector-rotate-around-y! s4-2 s4-2 f30-0) + (vector+! (-> obj out-trans) (-> obj root-override trans) s4-2) + (set-vector! s4-2 0.0 0.0 -32768.0 1.0) + (vector-rotate-around-y! s4-2 s4-2 f30-0) + (vector+! (-> obj in-trans) (-> obj out-trans) s4-2) + ) + (ja-channel-push! 1 0) + (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) + ) + (transform-post) + (logclear! (-> obj mask) (process-mask actor-pause)) + (go (method-of-object obj active)) + (none) + ) + +;; definition of type under-pipe-growls +(deftype under-pipe-growls (process-drawable) + ((volume float :offset-assert 200) + (desired-volume float :offset-assert 204) + (volume-seek-speed float :offset-assert 208) + (approach-sound-id sound-id :offset-assert 212) + (approach-play-time time-frame :offset-assert 216) + ) + :heap-base #x60 + :method-count-assert 23 + :size-assert #xe0 + :flag-assert #x17006000e0 + (:methods + (block-puzzle () _type_ :state 20) + (block-puzzle-fade () _type_ :state 21) + (intro-shooting () _type_ :state 22) + ) + ) + +;; definition for method 3 of type under-pipe-growls +(defmethod inspect under-pipe-growls ((obj under-pipe-growls)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tvolume: ~f~%" (-> obj volume)) + (format #t "~2Tdesired-volume: ~f~%" (-> obj desired-volume)) + (format #t "~2Tvolume-seek-speed: ~f~%" (-> obj volume-seek-speed)) + (format #t "~2Tapproach-sound-id: ~D~%" (-> obj approach-sound-id)) + (format #t "~2Tapproach-play-time: ~D~%" (-> obj approach-play-time)) + (format #t "~2Tstate-time: ~D~%" (-> obj state-time)) + (label cfg-4) + obj + ) + +;; definition for function under-pipe-growls-post +(defbehavior under-pipe-growls-post under-pipe-growls () + (when (and (zero? (-> self approach-sound-id)) (>= (-> self clock frame-counter) (-> self approach-play-time))) + (let ((gp-0 (-> self root trans))) + (set! (-> self approach-sound-id) (if (zero? (rand-vu-int-count 3)) + (sound-play "grunt-warn" :position gp-0) + (sound-play "grunt-notice" :position gp-0) + ) + ) + ) + ) + (when (!= (-> self volume) (-> self desired-volume)) + (seek! + (-> self volume) + (-> self desired-volume) + (* (-> self volume-seek-speed) (-> self clock seconds-per-frame)) + ) + (when (nonzero? (-> self approach-sound-id)) + (when *sound-player-enable* + (let ((v1-12 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-12 command) (sound-command set-param)) + (set! (-> v1-12 id) (-> self approach-sound-id)) + (set! (-> v1-12 params volume) (the int (* 1024.0 (-> self volume)))) + (set! (-> v1-12 params mask) (the-as uint 1)) + (-> v1-12 id) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate intro-shooting (under-pipe-growls) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('sig-shot) + (when (>= (-> self volume) 0.6) + (when (nonzero? (-> self approach-sound-id)) + (sound-stop (-> self approach-sound-id)) + (set! (-> self approach-sound-id) (new 'static 'sound-id)) + 0 + ) + (let ((v1-5 (rand-vu-int-count 5))) + (cond + ((zero? v1-5) + (let ((f30-0 (rand-vu-float-range 0.9 1.5))) + (sound-play-by-name + (static-sound-name "grunt-die") + (new-sound-id) + (the int (* 1024.0 f30-0)) + 0 + 0 + (sound-group sfx) + (-> self root trans) + ) + ) + (go-virtual intro-shooting) + ) + ((and (>= v1-5 1) (>= 2 v1-5)) + #f + ) + (else + (let ((f30-1 (rand-vu-float-range 0.9 1.5))) + (sound-play-by-name + (static-sound-name "grunt-hit") + (new-sound-id) + (the int (* 1024.0 f30-1)) + 0 + 0 + (sound-group sfx) + (-> self root trans) + ) + ) + ) + ) + ) + ) + ) + (('die-fast) + (cleanup-for-death self) + (go empty-state) + ) + ) + ) + :enter (behavior () + (set! (-> self volume) 0.0) + (set! (-> self desired-volume) 1.0) + (set! (-> self volume-seek-speed) (rand-vu-float-range 0.5 0.2)) + (none) + ) + :code (the-as (function none :behavior under-pipe-growls) sleep-code) + :post (the-as (function none :behavior under-pipe-growls) under-pipe-growls-post) + ) + +;; failed to figure out what this is: +(defstate block-puzzle (under-pipe-growls) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('fade) + (go-virtual block-puzzle-fade) + ) + ) + ) + :enter (behavior () + (set! (-> self volume) 0.25) + (set! (-> self desired-volume) 1.0) + (set! (-> self volume-seek-speed) 0.8) + (none) + ) + :code (behavior () + (sound-play "grunt-notice" :vol 40 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (suspend) + ) + (sound-play "grunt-warn" :vol 50 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.2)) + (suspend) + ) + (sound-play "grunt-hit" :vol 60 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + (suspend) + ) + (sound-play "grunt-notice" :vol 70 :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (suspend) + ) + (sound-play "grunt-notice" :position (target-pos 0)) + (set! (-> self state-time) (-> self clock frame-counter)) + (until (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (suspend) + ) + (sound-play "grunt-notice" :vol 200 :position (target-pos 0)) + (sleep-code) + (none) + ) + :post (the-as (function none :behavior under-pipe-growls) under-pipe-growls-post) + ) + +;; failed to figure out what this is: +(defstate block-puzzle-fade (under-pipe-growls) + :virtual #t + :enter (behavior () + (set! (-> self desired-volume) 0.0) + (set! (-> self volume-seek-speed) 0.5) + (none) + ) + :trans (behavior () + (when (= (-> self volume) (-> self desired-volume)) + (cleanup-for-death self) + (go empty-state) + ) + (none) + ) + :code (the-as (function none :behavior under-pipe-growls) sleep-code) + :post (the-as (function none :behavior under-pipe-growls) under-pipe-growls-post) + ) + +;; definition for function under-pipe-growls-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior under-pipe-growls-init-by-other under-pipe-growls ((arg0 vector) (arg1 symbol)) + (set! (-> self approach-sound-id) (new 'static 'sound-id)) + (set! (-> self approach-play-time) + (+ (-> self clock frame-counter) (rand-vu-int-range (seconds 0.1) (seconds 1))) + ) + (set! (-> self root) (new 'process 'trsqv)) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((s4-1 (-> self root))) + (set! (-> s4-1 trans quad) (-> arg0 quad)) + (quaternion-identity! (-> s4-1 quat)) + (vector-identity! (-> s4-1 scale)) + ) + (set! (-> self volume) 0.0) + (set! (-> self desired-volume) 0.0) + (set! (-> self volume-seek-speed) 1.0) + (if (= arg1 'intro-shooting) + (go-virtual intro-shooting) + (go-virtual block-puzzle) + ) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc b/test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc new file mode 100644 index 0000000000..5ccccc2586 --- /dev/null +++ b/test/decompiler/reference/jak2/levels/underport/underb-master_REF.gc @@ -0,0 +1,1279 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type under-warp +(deftype under-warp (process-drawable) + ((interp float :offset-assert 200) + ) + :heap-base #x50 + :method-count-assert 23 + :size-assert #xcc + :flag-assert #x17005000cc + (:methods + (idle () _type_ :state 20) + (die-fast () _type_ :state 21) + (under-warp-method-22 (_type_) none 22) + ) + ) + +;; definition for method 3 of type under-warp +(defmethod inspect under-warp ((obj under-warp)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tinterp: ~f~%" (-> obj interp)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defskelgroup skel-under-warp under-warp under-warp-lod0-jg under-warp-idle-ja + ((under-warp-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 8) + ) + +;; failed to figure out what this is: +(defstate idle (under-warp) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('die-fast) + (set-under-fog-interp! 0.0) + (go-virtual die-fast) + ) + ) + ) + :code (behavior () + (until #f + (let ((v1-2 (-> self skel root-channel 1)) + (f0-0 (-> self interp)) + ) + (set! (-> v1-2 frame-interp 1) f0-0) + (set! (-> v1-2 frame-interp 0) f0-0) + ) + (ja :num! (loop!)) + (ja :chan 1 :num! (chan 0)) + (ja-no-eval :group! (-> self draw art-group data 2) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 2)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + :post (behavior () + (under-warp-method-22 self) + (ja-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate die-fast (under-warp) + :virtual #t + :code (the-as (function none :behavior under-warp) nothing) + ) + +;; definition for method 22 of type under-warp +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod under-warp-method-22 under-warp ((obj under-warp)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((s3-0 (camera-matrix)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (f30-0 4096.0) + ) + (let ((f0-4 (* 0.00013563369 (tan (* 0.5 (-> *math-camera* fov))) f30-0))) + (set-vector! (-> obj root scale) f0-4 f0-4 f0-4 1.0) + ) + (set! (-> gp-0 quad) (-> (camera-pos) quad)) + (vector-normalize-copy! s5-0 (-> s3-0 vector 2) 1.0) + (matrix->quaternion (-> obj root quat) s3-0) + (let ((v1-10 (-> obj root trans))) + (let ((a0-5 f30-0)) + (.mov vf7 a0-5) + ) + (.lvf vf5 (&-> s5-0 quad)) + (.lvf vf4 (&-> gp-0 quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> v1-10 quad) vf6) + ) + ) + 0 + (none) + ) + ) + +;; definition for function under-warp-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior under-warp-init-by-other under-warp ((arg0 vector) (arg1 quaternion) (arg2 entity-actor)) + (set! (-> self level) (the-as level arg2)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (quaternion-copy! (-> self root quat) arg1) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-under-warp" (the-as (pointer uint32) #f))) + (the-as pair 0) + ) + (set! (-> self interp) 0.5) + (ja-channel-push! 2 (seconds 0.3)) + (ja-no-eval :group! (-> self draw art-group data 2) :num! (loop!)) + (let ((gp-2 (-> self skel root-channel 1))) + (let ((f0-2 (-> self interp))) + (set! (-> gp-2 frame-interp 1) f0-2) + (set! (-> gp-2 frame-interp 0) f0-2) + ) + (joint-control-channel-group! gp-2 (the-as art-joint-anim (-> self draw art-group data 3)) num-func-identity) + (set! (-> gp-2 frame-num) 0.0) + ) + (logior! (-> self skel status) (joint-control-status blend-shape)) + (go-virtual idle) + (none) + ) + +;; definition of type underb-master +(deftype underb-master (process) + ((warp-handle handle :offset-assert 128) + (tank-handle handle :offset-assert 136) + (underwater-time time-frame :offset-assert 144) + (last-air-beep-time time-frame :offset-assert 152) + (ambient-sound-id sound-id :offset-assert 160) + (air-supply float :offset-assert 164) + (air-charge-up? symbol :offset-assert 168) + (under-water-pitch-mod float :offset-assert 172) + (big-room-entered symbol :offset-assert 176) + (big-room-timer time-frame :offset-assert 184) + (under-plat-player-on symbol :offset-assert 192) + (under-plat-is-up symbol :offset-assert 196) + ) + :heap-base #x50 + :method-count-assert 24 + :size-assert #xc8 + :flag-assert #x18005000c8 + (:methods + (idle () _type_ :state 14) + (big-room-player-under () _type_ :state 15) + (big-room-player-plat () _type_ :state 16) + (underb-master-method-17 () none 17) + (big-room-player-above () _type_ :state 18) + (big-room-player-falling () _type_ :state 19) + (big-room-player-exiting () _type_ :state 20) + (big-room-player-done () _type_ :state 21) + (under-warp-check (_type_) symbol 22) + (spawn-air-tank-hud (_type_ symbol) none 23) + ) + ) + +;; definition for method 3 of type underb-master +(defmethod inspect underb-master ((obj underb-master)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~2Twarp-handle: ~D~%" (-> obj warp-handle)) + (format #t "~2Ttank-handle: ~D~%" (-> obj tank-handle)) + (format #t "~2Tunderwater-time: ~D~%" (-> obj underwater-time)) + (format #t "~2Tlast-air-beep-time: ~D~%" (-> obj last-air-beep-time)) + (format #t "~2Tambient-sound-id: ~D~%" (-> obj ambient-sound-id)) + (format #t "~2Tair-supply: ~f~%" (-> obj air-supply)) + (format #t "~2Tair-charge-up?: ~A~%" (-> obj air-charge-up?)) + (format #t "~2Tunder-water-pitch-mod: ~f~%" (-> obj under-water-pitch-mod)) + (format #t "~2Tbig-room-entered: ~A~%" (-> obj big-room-entered)) + (format #t "~2Tbig-room-timer: ~D~%" (-> obj big-room-timer)) + (format #t "~2Tunder-plat-player-on: ~A~%" (-> obj under-plat-player-on)) + (format #t "~2Tunder-plat-is-up: ~A~%" (-> obj under-plat-is-up)) + (label cfg-4) + obj + ) + +;; definition for symbol *underb-master*, type (pointer underb-master) +(define *underb-master* (the-as (pointer underb-master) #f)) + +;; definition for method 10 of type underb-master +(defmethod deactivate underb-master ((obj underb-master)) + (sound-stop (-> obj ambient-sound-id)) + (send-event (handle->process (-> obj warp-handle)) 'die-fast) + (set! *underb-master* (the-as (pointer underb-master) #f)) + ((method-of-type process deactivate) obj) + (none) + ) + +;; definition for function underb-master-event-handler +;; INFO: Used lq/sq +;; WARN: disable def twice: 121. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defbehavior underb-master-event-handler underb-master ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('query) + (case (-> arg3 param 0) + (('mech) + (not (-> *setting-control* user-current pilot-exit)) + ) + (('bubbler) + (and (handle->process (-> self warp-handle)) + (or (and (-> self next-state) (= (-> self next-state name) 'idle)) (not (under-warp-check self))) + ) + ) + ) + ) + (('request) + (case (-> arg3 param 0) + (('mech) + (cond + ((-> arg3 param 1) + (cond + ((-> *setting-control* user-current pilot-exit) + (let ((a1-2 *target*)) + (when (and a1-2 (logtest? (focus-status mech) (-> a1-2 focus-status))) + (set-setting! 'pilot-exit #f 0 0) + (apply-settings *setting-control*) + #t + ) + ) + ) + (else + #t + ) + ) + ) + ((-> *setting-control* user-current pilot-exit) + #t + ) + (else + (remove-setting! 'pilot-exit) + (apply-settings *setting-control*) + (not (-> *setting-control* user-current pilot-exit)) + ) + ) + ) + (('under-warp) + (cond + ((-> arg3 param 1) + (set-under-fog-interp! 1.0) + (when (not (handle->process (-> self warp-handle))) + (let ((s2-0 (camera-matrix)) + (s3-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> gp-0 quad) (-> (camera-pos) quad)) + (vector-normalize-copy! s3-0 (-> s2-0 vector 2) 1.0) + (matrix->quaternion s5-0 s2-0) + (set! (-> self warp-handle) + (ppointer->handle (process-spawn under-warp gp-0 s5-0 (-> self level) :to *display-pool*)) + ) + ) + (set! v0-0 (sound-play "mech-under-amb")) + (set! (-> self ambient-sound-id) (the-as sound-id v0-0)) + v0-0 + ) + ) + (else + (set-under-fog-interp! 0.0) + (let ((a0-41 (handle->process (-> self warp-handle)))) + (when a0-41 + (send-event a0-41 'die-fast) + (set! (-> self warp-handle) (the-as handle #f)) + (sound-stop (-> self ambient-sound-id)) + (set! (-> self ambient-sound-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + ) + ) + (('big-room) + (case (-> arg3 param 1) + (('status) + (cond + ((-> arg3 param 2) + (set! v0-0 #t) + (set! (-> self big-room-entered) (the-as symbol v0-0)) + v0-0 + ) + (else + (set! (-> self big-room-entered) #f) + #f + ) + ) + ) + (('under-plat) + (case (-> arg3 param 2) + (('player) + (cond + ((-> arg3 param 3) + (set! v0-0 #t) + (set! (-> self under-plat-player-on) (the-as symbol v0-0)) + v0-0 + ) + (else + (set! (-> self under-plat-player-on) #f) + #f + ) + ) + ) + (('up) + (cond + ((-> arg3 param 3) + (set! v0-0 #t) + (set! (-> self under-plat-is-up) (the-as symbol v0-0)) + v0-0 + ) + (else + (set! (-> self under-plat-is-up) #f) + #f + ) + ) + ) + ) + ) + ) + ) + ) + ) + (('bubbler) + (set! v0-0 #t) + (set! (-> self air-charge-up?) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + +;; definition for method 22 of type underb-master +(defmethod under-warp-check underb-master ((obj underb-master)) + "Used to check whether the underwater warp effect should be drawn." + (let ((target-pos (target-pos 0)) + (tpos-offset (new 'stack-no-clear 'vector)) + (a1-0 (new 'stack-no-clear 'vector)) + (v1-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> tpos-offset x) (+ -827392.0 (-> target-pos x))) + (set! (-> tpos-offset y) 0.0) + (set! (-> tpos-offset z) (+ -7671808.0 (-> target-pos z))) + (set! (-> a1-0 x) -94208.0) + (set! (-> a1-0 y) 0.0) + (set! (-> a1-0 z) -143360.0) + (vector-cross! v1-0 tpos-offset a1-0) + (< (-> v1-0 y) 0.0) + ) + ) + +;; definition for method 23 of type underb-master +;; WARN: Return type mismatch int vs none. +(defmethod spawn-air-tank-hud underb-master ((obj underb-master) (arg0 symbol)) + "Spawns or hides the air tank HUD bar." + (cond + (arg0 + (if (not (handle->process (-> obj tank-handle))) + (set! (-> obj tank-handle) + (ppointer->handle (process-spawn hud-mech-air-tank :init hud-init-by-other :to obj)) + ) + ) + ) + (else + (send-event (handle->process (-> obj tank-handle)) 'hide-and-die) + (set! (-> obj tank-handle) (the-as handle #f)) + ) + ) + (none) + ) + +;; definition for function underb-master-post +(defbehavior underb-master-post underb-master () + #t + (let ((gp-0 *target*)) + (let ((f30-0 0.0)) + (when (and gp-0 (not (-> *setting-control* user-current pilot-exit))) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! (-> gp-0 control) s5-0 (collide-action solid semi-solid)) + (let ((v1-7 (-> s5-0 flags))) + (if (logtest? (water-flags touch-water) v1-7) + (set! f30-0 (lerp-scale 0.0 1.0 (- (-> gp-0 control trans y) (-> s5-0 trans y)) -4096.0 -20480.0)) + ) + ) + ) + ) + (when (!= f30-0 (-> self under-water-pitch-mod)) + (set! (-> self under-water-pitch-mod) f30-0) + (if (= f30-0 0.0) + (remove-setting! 'under-water-pitch-mod) + (set-setting! 'under-water-pitch-mod 'abs f30-0 0) + ) + ) + ) + (if (or (not gp-0) (zero? (logand (-> gp-0 water flags) (water-flags under-water)))) + (set! (-> self air-charge-up?) #t) + (set! (-> self underwater-time) (-> self clock frame-counter)) + ) + ) + (cond + ((-> self air-charge-up?) + (set! (-> self air-supply) + (seek-with-smooth (-> self air-supply) 1.0 (* 2.0 (-> self clock seconds-per-frame)) 0.125 0.01) + ) + (when (= (-> self air-supply) 1.0) + (set! (-> self air-charge-up?) #f) + (set! (-> self air-supply) 1.01) + (set! (-> self last-air-beep-time) 0) + 0 + ) + ) + (else + (seek! (-> self air-supply) 0.0 (* 0.04 (-> self clock seconds-per-frame))) + (cond + ((= (-> self air-supply) 0.0) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer self)) + (set! (-> a1-6 num-params) 2) + (set! (-> a1-6 message) 'attack) + (set! (-> a1-6 param 0) (the-as uint #f)) + (let ((v1-35 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (let* ((a0-11 *game-info*) + (a2-7 (+ (-> a0-11 attack-id) 1)) + ) + (set! (-> a0-11 attack-id) a2-7) + (set! (-> v1-35 id) a2-7) + ) + (set! (-> v1-35 mode) 'air) + (set! (-> a1-6 param 1) (the-as uint v1-35)) + ) + (send-event-function *target* a1-6) + ) + ) + (else + (when (>= 0.4 (-> self air-supply)) + (let ((v1-39 (the int (lerp-scale 90.0 300.0 (-> self air-supply) 0.0 0.4)))) + (when (>= (- (-> self clock frame-counter) (-> self last-air-beep-time)) v1-39) + (set! (-> self last-air-beep-time) (-> self clock frame-counter)) + (sound-play "oxygen-warning") + ) + ) + ) + ) + ) + ) + ) + (set! (-> *game-info* air-supply) (fmin 1.0 (-> self air-supply))) + (if (or (and *target* (zero? (logand (focus-status mech) (-> *target* focus-status)))) + (and (>= (-> self air-supply) 1.0) + (>= (- (-> self clock frame-counter) (-> self underwater-time)) (seconds 3)) + ) + ) + (spawn-air-tank-hud self #f) + (spawn-air-tank-hud self #t) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate idle (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (if (-> self big-room-entered) + (go-virtual big-room-player-under) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; failed to figure out what this is: +(defstate big-room-player-under (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + 0 + (none) + ) + :trans (behavior () + (if (-> self under-plat-player-on) + (go-virtual big-room-player-plat) + ) + (if (not (-> self big-room-entered)) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; failed to figure out what this is: +(defstate big-room-player-plat (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (set-setting! 'entity-name "camera-239" 0 0) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #f) + (none) + ) + :exit (behavior () + (remove-setting! 'entity-name) + (none) + ) + :trans (behavior () + (let ((gp-0 (target-pos 0))) + (if (or (and (-> self under-plat-is-up) (-> self under-plat-player-on)) (< -245760.0 (-> gp-0 y))) + (go-virtual big-room-player-above) + ) + (if (and (not (-> self under-plat-player-on)) (< (-> gp-0 y) -245760.0)) + (go-virtual big-room-player-falling) + ) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; failed to figure out what this is: +(defstate big-room-player-above (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 600.0 0) + (remove-setting! 'mode-name) + (none) + ) + :trans (behavior () + (if (< (-> (target-pos 0) y) -245760.0) + (go-virtual big-room-player-falling) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; failed to figure out what this is: +(defstate big-room-player-falling (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (set-setting! 'mode-name 'cam-endlessfall 0 0) + (none) + ) + :exit (behavior () + (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) + (remove-setting! 'mode-name) + (none) + ) + :trans (behavior () + (cond + ((not *target*) + (go-virtual idle) + ) + ((under-warp-check self) + (if (< (-> (target-pos 0) y) -258048.0) + (go-virtual big-room-player-exiting) + ) + ) + (else + (if (< (-> (target-pos 0) y) -278528.0) + (go-virtual big-room-player-under) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; failed to figure out what this is: +(defstate big-room-player-exiting (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) + (set-setting! 'entity-name "camera-244" 0 0) + (set! (-> self big-room-timer) (-> self clock frame-counter)) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) + (none) + ) + :exit (behavior () + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 600.0 0) + (remove-setting! 'entity-name) + (none) + ) + :trans (behavior () + (if (>= (- (-> self clock frame-counter) (-> self big-room-timer)) (seconds 1)) + (go-virtual idle) + ) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; failed to figure out what this is: +(defstate big-room-player-done (underb-master) + :virtual #t + :event underb-master-event-handler + :enter (behavior () + (go-virtual idle) + (none) + ) + :code (the-as (function none :behavior underb-master) sleep-code) + :post underb-master-post + ) + +;; definition for function underb-master-init-by-other +;; WARN: Return type mismatch object vs none. +(defbehavior underb-master-init-by-other underb-master ((arg0 level)) + (set! *underb-master* (the-as (pointer underb-master) (process->ppointer self))) + (set! (-> self warp-handle) (the-as handle #f)) + (set! (-> self tank-handle) (the-as handle #f)) + (set! (-> self level) arg0) + (set! (-> self air-supply) 1.0) + (set! (-> self air-charge-up?) #f) + (set! (-> self ambient-sound-id) (new 'static 'sound-id)) + (set! (-> self big-room-entered) #f) + (set! (-> self under-plat-player-on) #f) + (set! (-> self under-plat-is-up) #f) + (go-virtual idle) + (none) + ) + +;; definition for function underb-login +;; WARN: Return type mismatch int vs none. +(defun underb-login ((arg0 level)) + (set! *nav-network* (new 'loading-level 'nav-network)) + (nav-network-method-9 *nav-network*) + 0 + (none) + ) + +;; definition for function underb-deactivate +;; WARN: Return type mismatch int vs none. +(defun underb-deactivate ((arg0 level)) + (set! *nav-network* (the-as nav-network 0)) + 0 + (none) + ) + +;; definition for function underb-activate +;; WARN: Return type mismatch int vs none. +(defun underb-activate ((arg0 level)) + (nav-network-method-10 *nav-network* arg0 *under-adjacency*) + (let ((v1-3 (process-spawn underb-master arg0 :to *entity-pool*))) + (if v1-3 + (set! (-> v1-3 0 level) arg0) + ) + ) + 0 + (none) + ) + +;; definition of type under-locking +(deftype under-locking (process-drawable) + ((id int8 :offset-assert 200) + (up-y float :offset-assert 204) + (down-y float :offset-assert 208) + (mode uint64 :offset-assert 216) + (which-reminder? symbol :offset-assert 224) + (spooled-sound-id uint32 :offset-assert 228) + (draining-part sparticle-launch-control :offset-assert 232) + (actor-group (pointer actor-group) :offset-assert 236) + (spooled-sound-delay int32 :offset-assert 240) + (last-reminder-time time-frame :offset 256) + ) + :heap-base #x90 + :method-count-assert 24 + :size-assert #x108 + :flag-assert #x1800900108 + (:methods + (startup () _type_ :state 20) + (active () _type_ :state 21) + (filling () _type_ :state 22) + (draining () _type_ :state 23) + ) + ) + +;; definition for method 3 of type under-locking +(defmethod inspect under-locking ((obj under-locking)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tid: ~D~%" (-> obj id)) + (format #t "~2Tup-y: ~f~%" (-> obj up-y)) + (format #t "~2Tdown-y: ~f~%" (-> obj down-y)) + (format #t "~2Tmode: ~D~%" (-> obj mode)) + (format #t "~2Twhich-reminder?: ~A~%" (-> obj which-reminder?)) + (format #t "~2Tspooled-sound-id: ~D~%" (-> obj spooled-sound-id)) + (format #t "~2Tdraining-part: ~A~%" (-> obj draining-part)) + (format #t "~2Tactor-group: #x~X~%" (-> obj actor-group)) + (format #t "~2Tspooled-sound-delay: ~D~%" (-> obj spooled-sound-delay)) + (format #t "~2Tstate-time: ~D~%" (-> obj state-time)) + (format #t "~2Tlast-reminder-time: ~D~%" (-> obj last-reminder-time)) + (label cfg-4) + obj + ) + +;; definition for method 7 of type under-locking +;; WARN: Return type mismatch process-drawable vs under-locking. +(defmethod relocate under-locking ((obj under-locking) (arg0 int)) + (if (nonzero? (-> obj draining-part)) + (&+! (-> obj draining-part) arg0) + ) + (the-as under-locking ((method-of-type process-drawable relocate) obj arg0)) + ) + +;; definition for method 10 of type under-locking +(defmethod deactivate under-locking ((obj under-locking)) + (if (nonzero? (-> obj draining-part)) + (kill-and-free-particles (-> obj draining-part)) + ) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; failed to figure out what this is: +(defstate startup (under-locking) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('test) + #f + ) + ) + ) + ) + :enter (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (none) + ) + :trans (behavior () + (let ((v1-0 (-> self actor-group))) + (cond + ((and v1-0 + (let ((a0-2 (-> v1-0 0 data 0 actor))) + (if a0-2 + (-> a0-2 extra process) + ) + ) + (let ((a0-5 (-> v1-0 0 data 1 actor))) + (if a0-5 + (-> a0-5 extra process) + ) + ) + (let ((a1-2 (-> v1-0 0 data 2 actor))) + (if a1-2 + (-> a1-2 extra process) + ) + ) + ) + (when (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.1)) + (let ((a0-13 (-> v1-0 0 data 0 actor))) + (if a0-13 + (-> a0-13 extra process) + ) + ) + (let ((v1-2 (-> v1-0 0 data 1 actor))) + (if v1-2 + (-> v1-2 extra process) + ) + ) + (let ((a1-6 *target*)) + (cond + ((and a1-6 (logtest? (focus-status mech) (-> a1-6 focus-status))) + (set! (-> self mode) (the-as uint 3)) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) (process->ppointer self)) + (set! (-> a1-8 num-params) 1) + (set! (-> a1-8 message) 'move-to-y) + (set! (-> a1-8 param 0) (the-as uint (-> self up-y))) + (let ((t9-0 send-event-function) + (v1-13 (-> self actor-group 0 data 2 actor)) + ) + (t9-0 + (if v1-13 + (-> v1-13 extra process) + ) + a1-8 + ) + ) + ) + ) + (else + (set! (-> self mode) (the-as uint 0)) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) (process->ppointer self)) + (set! (-> a1-9 num-params) 1) + (set! (-> a1-9 message) 'move-to-y) + (set! (-> a1-9 param 0) (the-as uint (-> self down-y))) + (let ((t9-1 send-event-function) + (v1-22 (-> self actor-group 0 data 2 actor)) + ) + (t9-1 + (if v1-22 + (-> v1-22 extra process) + ) + a1-9 + ) + ) + ) + ) + ) + ) + (go-virtual active) + ) + ) + (else + (set! (-> self state-time) (-> self clock frame-counter)) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-locking) sleep-code) + ) + +;; failed to figure out what this is: +(defstate active (under-locking) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('test) + (let ((v1-1 (-> self mode))) + (cond + ((-> event param 0) + (when (or (zero? v1-1) (= v1-1 5)) + (let ((a0-4 *target*)) + (and a0-4 (zero? (logand (focus-status mech) (-> a0-4 focus-status)))) + ) + ) + ) + (else + (or (= v1-1 2) (= v1-1 3)) + ) + ) + ) + ) + ) + ) + :trans (behavior () + (let ((v1-0 (-> self mode))) + (cond + ((zero? v1-0) + (let ((v1-1 *target*) + (a0-1 (-> self actor-group)) + ) + (when (and v1-1 a0-1) + (if (and (-> a0-1 0 data 0 actor) + (logtest? (focus-status mech) (-> v1-1 focus-status)) + (send-event (ppointer->process *underb-master*) 'request 'mech #t) + ) + (set! (-> self mode) (the-as uint 1)) + ) + ) + ) + ) + ((= v1-0 1) + (if (not (logtest? (-> self actor-group 0 data 0 actor extra perm status) (entity-perm-status subtask-complete))) + (go-virtual filling) + ) + ) + ((= v1-0 2) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'front) + (let ((t9-2 send-event-function) + (v1-24 (-> self actor-group 0 data 1 actor)) + ) + (if (not (t9-2 + (if v1-24 + (-> v1-24 extra process) + ) + a1-2 + ) + ) + (set! (-> self mode) (the-as uint 3)) + ) + ) + ) + ) + ((= v1-0 3) + (if (>= 20480.0 (vector-vector-xz-distance (target-pos 0) (-> self root trans))) + (set! (-> self mode) (the-as uint 4)) + ) + ) + ((= v1-0 4) + (go-virtual draining) + ) + ((= v1-0 5) + (let ((a1-4 *target*)) + (when (or (not a1-4) (zero? (logand (focus-status mech) (-> a1-4 focus-status)))) + (set! (-> self mode) (the-as uint 0)) + 0 + ) + ) + (when (>= (- (-> self clock frame-counter) (-> self last-reminder-time)) (seconds 9)) + (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (add-process + *gui-control* + self + (gui-channel ashelin) + (gui-action play) + (if (-> self which-reminder?) + "cityv193" + "cityv192" + ) + -99.0 + 0 + ) + (set! (-> self which-reminder?) (not (-> self which-reminder?))) + ) + ) + ) + ) + (none) + ) + :code (the-as (function none :behavior under-locking) sleep-code) + ) + +;; failed to figure out what this is: +(defstate filling (under-locking) + :virtual #t + :event (-> (method-of-type under-locking active) event) + :enter (behavior () + (set! (-> self spooled-sound-id) + (the-as uint (add-process *gui-control* self (gui-channel ashelin) (gui-action queue) "wtrfill" -99.0 0)) + ) + (set! (-> self state-time) 0) + (set! (-> self spooled-sound-delay) (if (= (-> self id) 1) + 120 + 0 + ) + ) + (none) + ) + :trans (behavior () + (when (and (zero? (-> self state-time)) + (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self last-reminder-time) (-> self clock frame-counter)) + ) + (when (nonzero? (-> self state-time)) + (when (and (>= (-> self spooled-sound-delay) 0) + (>= (- (-> self clock frame-counter) (-> self state-time)) (-> self spooled-sound-delay)) + ) + (set-action! + *gui-control* + (gui-action play) + (the-as sound-id (-> self spooled-sound-id)) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (set! (-> self spooled-sound-delay) -1) + ) + (let* ((v1-21 (-> self actor-group 0 data 2 actor)) + (gp-0 (if v1-21 + (-> v1-21 extra process) + ) + ) + ) + (when gp-0 + (let ((f0-0 (-> (the-as water-anim gp-0) root trans y))) + (when (!= f0-0 (-> self up-y)) + (let ((f0-4 (seek f0-0 (-> self up-y) (* 12288.0 (-> self clock seconds-per-frame))))) + (send-event gp-0 'move-to-y f0-4) + ) + ) + ) + (if (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 2)) + (spawn (-> self part) (-> self root trans)) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (while (zero? (-> self state-time)) + (suspend) + ) + (until #f + (let* ((v1-4 (-> self actor-group 0 data 2 actor)) + (gp-0 (if v1-4 + (-> v1-4 extra process) + ) + ) + ) + (when gp-0 + (if (< (- (-> (camera-pos) y) (-> (the-as water-anim gp-0) root trans y)) 22528.0) + (goto cfg-11) + ) + ) + ) + (suspend) + ) + #f + (label cfg-11) + (let ((a3-1 (res-lump-struct (-> self entity) 'camera-name structure))) + (if a3-1 + (set-setting! 'entity-name a3-1 0 0) + ) + ) + (until #f + (let* ((a0-2 (-> self actor-group 0 data 2 actor)) + (v1-19 (if a0-2 + (-> a0-2 extra process) + ) + ) + ) + (when v1-19 + (when (= (-> (the-as water-anim v1-19) root trans y) (-> self up-y)) + (persist-with-delay *setting-control* 'interp-time (seconds 0.05) 'interp-time 'abs 0.0 0) + (remove-setting! 'entity-name) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #t) + (set! (-> self mode) (the-as uint 2)) + (go-virtual active) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate draining (under-locking) + :virtual #t + :event (-> (method-of-type under-locking active) event) + :enter (behavior () + (set! (-> self spooled-sound-id) + (the-as uint (add-process *gui-control* self (gui-channel ashelin) (gui-action queue) "wtrdrain" -99.0 0)) + ) + (set! (-> self state-time) 0) + 0 + (none) + ) + :trans (behavior () + (when (and (zero? (-> self state-time)) + (= (get-status *gui-control* (the-as sound-id (-> self spooled-sound-id))) (gui-status ready)) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (set! (-> self last-reminder-time) (-> self clock frame-counter)) + (set-action! + *gui-control* + (gui-action play) + (the-as sound-id (-> self spooled-sound-id)) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + ) + (when (nonzero? (-> self state-time)) + (let* ((v1-14 (-> self actor-group 0 data 2 actor)) + (gp-0 (if v1-14 + (-> v1-14 extra process) + ) + ) + ) + (when gp-0 + (let ((f0-0 (-> (the-as water-anim gp-0) root trans y))) + (when (!= f0-0 (-> self down-y)) + (let ((f0-4 (seek f0-0 (-> self down-y) (* 12288.0 (-> self clock seconds-per-frame))))) + (send-event gp-0 'move-to-y f0-4) + ) + ) + ) + (if (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 1)) + (spawn (-> self draining-part) (-> self root trans)) + ) + ) + ) + ) + (none) + ) + :code (behavior () + (while (zero? (-> self state-time)) + (suspend) + ) + (let ((a3-1 (res-lump-struct (-> self entity) 'camera-name structure))) + (if a3-1 + (set-setting! 'entity-name a3-1 0 0) + ) + ) + (send-event (ppointer->process *underb-master*) 'request 'under-warp #f) + (until #f + (let* ((a0-3 (-> self actor-group 0 data 2 actor)) + (v1-15 (if a0-3 + (-> a0-3 extra process) + ) + ) + ) + (when v1-15 + (if (< (-> (the-as water-anim v1-15) root trans y) (+ 10240.0 (-> (target-pos 0) y))) + (goto cfg-17) + ) + ) + ) + (suspend) + ) + #f + (label cfg-17) + (remove-setting! 'entity-name) + (until #f + (let* ((a0-8 (-> self actor-group 0 data 2 actor)) + (v1-26 (if a0-8 + (-> a0-8 extra process) + ) + ) + ) + (when v1-26 + (when (= (-> (the-as water-anim v1-26) root trans y) (-> self down-y)) + (set! (-> self mode) (the-as uint 5)) + (send-event (ppointer->process *underb-master*) 'request 'mech #f) + (set! (-> self which-reminder?) #f) + (go-virtual active) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; definition for method 11 of type under-locking +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! under-locking ((obj under-locking) (arg0 entity-actor)) + "Typically the method that does the initial setup on the process, potentially using the [[entity-actor]] provided as part of that. +This commonly includes things such as: +- stack size +- collision information +- loading the skeleton group / bones +- sounds" + (local-vars (sv-16 res-tag)) + (set! (-> obj which-reminder?) #f) + (set! (-> obj spooled-sound-id) (the-as uint 0)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (set! (-> obj id) (res-lump-value arg0 'extra-id int :time -1000000000.0)) + (let ((f0-0 (-> obj root trans y))) + (set! (-> obj up-y) (+ 49152.0 f0-0)) + (set! (-> obj down-y) (+ f0-0 (if (= (-> obj id) 2) + -16384.0 + -20480.0 + ) + ) + ) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((a0-6 (res-lump-data (-> obj entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (if (and a0-6 (nonzero? (-> sv-16 elt-count))) + (set! (-> obj actor-group) (the-as (pointer actor-group) a0-6)) + (set! (-> obj actor-group) (the-as (pointer actor-group) #f)) + ) + ) + (set! (-> obj part) (create-launch-control (-> *part-group-id-table* 498) obj)) + (set! (-> obj draining-part) (create-launch-control (-> *part-group-id-table* 499) obj)) + (go (method-of-object obj startup)) + (none) + ) + +;; definition of type water-anim-under +(deftype water-anim-under (water-anim) + () + :heap-base #x80 + :method-count-assert 29 + :size-assert #x100 + :flag-assert #x1d00800100 + ) + +;; definition for method 3 of type water-anim-under +(defmethod inspect water-anim-under ((obj water-anim-under)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type water-anim inspect))) + (t9-0 obj) + ) + (label cfg-4) + obj + ) + +;; definition for symbol ripple-for-water-anim-under, type ripple-wave-set +(define ripple-for-water-anim-under (new 'static 'ripple-wave-set + :count 3 + :converted #f + :normal-scale 1.0 + :wave (new 'static 'inline-array ripple-wave 4 + (new 'static 'ripple-wave :scale 40.0 :xdiv 1 :speed 1.5) + (new 'static 'ripple-wave :scale 40.0 :xdiv -1 :zdiv 1 :speed 1.5) + (new 'static 'ripple-wave :scale 20.0 :xdiv 5 :zdiv 3 :speed 0.75) + (new 'static 'ripple-wave) + ) + ) + ) + +;; definition for method 24 of type water-anim-under +;; WARN: Return type mismatch int vs none. +(defmethod init-water! water-anim-under ((obj water-anim-under)) + "Initialize a [[water-anim]]'s default settings, this may include applying a [[riple-control]]" + (let ((t9-0 (method-of-type water-anim init-water!))) + (t9-0 obj) + ) + (let ((v1-2 (new 'process 'ripple-control))) + (set! (-> obj draw ripple) v1-2) + (set-vector! (-> obj draw color-mult) 0.01 0.45 0.5 0.75) + (set! (-> v1-2 global-scale) 3072.0) + (set! (-> v1-2 close-fade-dist) 163840.0) + (set! (-> v1-2 far-fade-dist) 245760.0) + (set! (-> v1-2 waveform) ripple-for-water-anim-under) + ) + 0 + (none) + ) + + + + diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 9e2d4cf843..dfff460bab 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -299,6 +299,7 @@ "(fall ruins-drop-plat)": ["code"], // missing cast to art-joint-anim "(fall ruins-pillar-collapse)": ["code"], // missing cast to art-joint-anim "(hit drill-wall)": ["code"], // missing cast to art-joint-anim - "(hit drill-crane)": ["code"] // missing cast to art-joint-anim + "(hit drill-crane)": ["code"], // missing cast to art-joint-anim + "(hit under-break-door)": ["code"] // missing cast to art-joint-anim } }