From ae0f139667f875d8da40705f6f0f2a2af9f8ffa9 Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Sun, 7 Apr 2024 16:49:45 +0200 Subject: [PATCH] decomp3: eye renderer and more files (#3457) - `eye` - `collision-editor` - `simple-nav-sphere` - `mech-part` - `mech-states` - `mech` - `target-mech` - `target-tube` - `flut-part` - `flut` - `target-flut` --- decompiler/config/jak3/all-types.gc | 402 +- .../ntsc_v1/anonymous_function_types.jsonc | 19 +- decompiler/config/jak3/ntsc_v1/hacks.jsonc | 3 +- decompiler/config/jak3/ntsc_v1/inputs.jsonc | 10 +- .../config/jak3/ntsc_v1/label_types.jsonc | 66 + .../jak3/ntsc_v1/stack_structures.jsonc | 48 +- .../config/jak3/ntsc_v1/type_casts.jsonc | 285 ++ decompiler/level_extractor/extract_merc.cpp | 6 +- game/graphics/opengl_renderer/EyeRenderer.cpp | 1 + .../opengl_renderer/OpenGLRenderer.cpp | 12 + .../graphics/opengl_renderer/OpenGLRenderer.h | 1 + goal_src/jak3/engine/ai/traffic-h.gc | 1 + .../jak3/engine/collide/collide-target-h.gc | 2 +- goal_src/jak3/engine/common-obs/elevator.gc | 2 +- .../jak3/engine/common-obs/generic-obs.gc | 19 +- goal_src/jak3/engine/common-obs/water-flow.gc | 26 +- .../jak3/engine/debug/collision-editor.gc | 940 +++++ goal_src/jak3/engine/draw/drawable.gc | 2 +- goal_src/jak3/engine/entity/entity.gc | 4 +- goal_src/jak3/engine/game/main.gc | 6 +- goal_src/jak3/engine/geometry/path-h.gc | 26 +- goal_src/jak3/engine/geometry/path.gc | 570 ++- goal_src/jak3/engine/gfx/foreground/eye.gc | 1024 +++++ .../process-drawable/process-drawable.gc | 6 +- .../process-drawable/simple-nav-sphere.gc | 128 + goal_src/jak3/engine/target/flut/flut-h.gc | 27 +- goal_src/jak3/engine/target/flut/flut-part.gc | 123 + goal_src/jak3/engine/target/flut/flut.gc | 620 +++ .../jak3/engine/target/flut/target-flut.gc | 3665 +++++++++++++++++ goal_src/jak3/engine/target/mech/mech-h.gc | 3 +- goal_src/jak3/engine/target/mech/mech-part.gc | 402 ++ .../jak3/engine/target/mech/mech-states.gc | 2747 ++++++++++++ goal_src/jak3/engine/target/mech/mech.gc | 479 +++ .../jak3/engine/target/mech/target-mech.gc | 1808 ++++++++ goal_src/jak3/engine/target/sidekick.gc | 6 +- goal_src/jak3/engine/target/target-h.gc | 77 +- goal_src/jak3/engine/target/target-launch.gc | 2 +- goal_src/jak3/engine/target/target-tube.gc | 1171 ++++++ goal_src/jak3/engine/target/target-util.gc | 2 +- goal_src/jak3/engine/target/target.gc | 4 +- .../levels/city/traffic/traffic-manager.gc | 4 + .../engine/collide/collide-target-h_REF.gc | 2 +- .../jak3/engine/common-obs/elevator_REF.gc | 6 +- .../jak3/engine/common-obs/generic-obs_REF.gc | 2 +- .../jak3/engine/common-obs/water-flow_REF.gc | 30 +- .../jak3/engine/debug/collision-editor_REF.gc | 994 +++++ .../jak3/engine/entity/entity_REF.gc | 4 +- .../jak3/engine/geometry/path-h_REF.gc | 26 +- .../jak3/engine/gfx/foreground/eye_REF.gc | 1130 +++++ .../process-drawable/simple-nav-sphere_REF.gc | 156 + .../jak3/engine/target/flut/flut-h_REF.gc | 23 +- .../jak3/engine/target/flut/flut-part_REF.gc | 137 + .../jak3/engine/target/flut/flut_REF.gc | 644 +++ .../engine/target/flut/target-flut_REF.gc | 3414 +++++++++++++++ .../jak3/engine/target/gun/gun-states_REF.gc | 4 - .../jak3/engine/target/mech/mech-h_REF.gc | 7 +- .../jak3/engine/target/mech/mech-part_REF.gc | 435 ++ .../engine/target/mech/mech-states_REF.gc | 2786 +++++++++++++ .../jak3/engine/target/mech/mech_REF.gc | 534 +++ .../engine/target/mech/target-mech_REF.gc | 1875 +++++++++ .../jak3/engine/target/target-h_REF.gc | 58 +- .../jak3/engine/target/target-ladder_REF.gc | 4 - .../jak3/engine/target/target-launch_REF.gc | 6 +- .../jak3/engine/target/target-tube_REF.gc | 1256 ++++++ .../jak3/engine/target/target-util_REF.gc | 2 +- .../jak3/engine/target/target_REF.gc | 4 +- test/offline/config/jak3/config.jsonc | 14 +- 67 files changed, 27889 insertions(+), 413 deletions(-) create mode 100644 test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/process-drawable/simple-nav-sphere_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/flut/flut-part_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/flut/flut_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/mech/mech_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/mech/target-mech_REF.gc create mode 100644 test/decompiler/reference/jak3/engine/target/target-tube_REF.gc diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index 2272adb34a..1c749613f6 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -21424,7 +21424,7 @@ (last-nonzero-input-dir-targ quaternion :inline :offset 6384) (time-of-last-wall-hide-first-check-pass time-frame :offset 6400) (time-of-first-wall-hide-first-check-pass time-frame :offset 6408) - (pad uint8 4) + (unknown-float0000 float :offset 6416) ) :size-assert #x1914 :flag-assert #x4400001914 @@ -22772,7 +22772,8 @@ (leg-ik joint-mod-ik 2 :offset-assert 252) ;; guessed by decompiler (foot joint-mod 2 :offset-assert 260) ;; guessed by decompiler (cloth symbol :offset-assert 268) - (init-time time-frame :offset-assert 272) ;; time-frame + (mech-ik joint-mod-ik 2 :offset-assert 272) ;; added + (init-time time-frame :offset 272) ;; time-frame (teleport-time time-frame :offset-assert 280) ;; time-frame (state-hook-time time-frame :offset-assert 288) ;; time-frame (state-hook (function none :behavior target) :offset-assert 296) ;; guessed by decompiler @@ -22807,9 +22808,9 @@ (mode-param1 handle :offset-assert 2320) ;; handle (mode-param2 uint64 :offset-assert 2328) (mode-param3 uint64 :offset-assert 2336) - (major-mode-exit-hook basic :offset-assert 2344) - (major-mode-event-hook basic :offset-assert 2348) - (sub-mode-exit-hook basic :offset-assert 2352) + (major-mode-exit-hook (function none :behavior target) :offset-assert 2344) + (major-mode-event-hook (function none :behavior target) :offset-assert 2348) + (sub-mode-exit-hook (function none :behavior target) :offset-assert 2352) (ext-geo-control external-art-buffer :offset-assert 2356) (pending-ext-geo target-geo :offset-assert 2360) (ext-geo target-geo :offset-assert 2364) @@ -22900,7 +22901,7 @@ (target-jump-forward float float symbol) (target-high-jump float float object) (target-double-jump float float) - (target-falling symbol) + (target-falling object) target-slide-down (target-flop float float float object) (target-hit-ground symbol) @@ -22961,49 +22962,50 @@ (target-board-clone-anim handle) ;; flut (target-flut-start handle symbol int) - target-flut-get-on - target-flut-get-off + (target-flut-get-on handle) + (target-flut-get-off handle) target-flut-get-off-jump - target-flut-eject + (target-flut-eject symbol) target-flut-grab target-flut-stance target-flut-walk - target-flut-jump - target-flut-double-jump + (target-flut-jump float float) + (target-flut-double-jump float float) target-flut-running-attack - target-flut-air-attack + (target-flut-air-attack float) target-flut-air-attack-hit-ground - target-flut-hit + (target-flut-hit symbol attack-info) target-flut-hit-ground - target-flut-falling - target-flut-kanga-catch - target-flut-death - target-flut-clone-anim + (target-flut-falling object) + (target-flut-kanga-catch handle symbol) + (target-flut-death symbol) + (target-flut-clone-anim handle) + target-flut-run-wild ;; mech (target-mech-start handle float symbol) - target-mech-get-on ;; associated process guessed by decompiler, old: (state handle target) + (target-mech-get-on handle) target-mech-get-off - target-mech-get-up + (target-mech-get-up handle) target-mech-grab target-mech-stance target-mech-walk - target-mech-jump ;; associated process guessed by decompiler, old: (state float float surface target) + (target-mech-jump float float surface) target-mech-punch target-mech-shield - target-mech-hit ;; associated process guessed by decompiler, old: (state symbol attack-info target) - target-mech-hit-ground ;; associated process guessed by decompiler, old: (state symbol target) - target-mech-falling ;; associated process guessed by decompiler, old: (state symbol target) + (target-mech-hit symbol attack-info) + (target-mech-hit-ground symbol) + (target-mech-falling symbol) target-mech-carry-pickup target-mech-carry-stance target-mech-carry-walk - target-mech-carry-jump ;; associated process guessed by decompiler, old: (state float float symbol target) + (target-mech-carry-jump float float) target-mech-carry-drag target-mech-carry-drop target-mech-carry-throw - target-mech-carry-hit-ground ;; associated process guessed by decompiler, old: (state symbol target) + (target-mech-carry-hit-ground symbol) target-mech-carry-falling - target-mech-death ;; associated process guessed by decompiler, old: (state symbol target) - target-mech-clone-anim ;; associated process guessed by decompiler, old: (state handle target) + (target-mech-death symbol) + (target-mech-clone-anim handle) ;; pilot (target-racing-start handle) (target-grab-ride handle) @@ -23071,8 +23073,12 @@ target-ladder-switch target-ladder-jump-off ;; tube - (target-tube-start handle) target-tube + target-tube-walk + (target-tube-start handle) + (target-tube-jump float float) + (target-tube-hit symbol attack-info) + (target-tube-death symbol) ;; tobot tobot-stance ) @@ -27896,29 +27902,29 @@ :flag-assert #x2000000024 (:methods (new "Allocate a new path-control, set up the curve to point to the specified lump data." (symbol type process symbol float entity symbol) _type_) ;; 0 - (path-control-method-9 (_type_) none) ;; 9 ;; (debug-draw (_type_) none) + (debug-draw (_type_) none) ;; 9 (get-point-in-path! (_type_ vector float symbol) vector) ;; 10 - (path-control-method-11 () none) ;; 11 ;; (get-random-point (_type_ vector) vector) - (path-control-method-12 () none) ;; 12 ;; (displacement-between-two-points-copy! (_type_ vector float float) vector) - (path-control-method-13 () none) ;; 13 ;; (displacement-between-two-points-normalized! (_type_ vector float) vector) + (get-random-point (_type_ vector) vector) ;; 11 + (path-control-method-12 (_type_ vector float float) vector) ;; 12 ;; (displacement-between-two-points-copy! (_type_ vector float float) vector) + (displacement-between-two-points-normalized! (_type_ vector float) vector) ;; 13 (get-point-at-percent-along-path! (_type_ vector float symbol) vector) ;; 14 - (path-control-method-15 () none) ;; 15 ;; (displacement-between-points-at-percent-scaled! (_type_ vector float float) vector) + (path-control-method-15 (_type_ vector float float) vector) ;; 15 ;; (displacement-between-points-at-percent-scaled! (_type_ vector float float) vector) (displacement-between-points-at-percent-normalized! (_type_ vector float) vector) ;; 16 (get-num-segments (_type_) float) ;; 17 (total-distance (_type_) float) ;; 18 (get-num-verts (_type_) int) ;; 19 (segement-duration->path-duration (_type_ float) float) ;; 20 (path-duration->segment-duration (_type_ float) float) ;; 21 - (path-control-method-22 () none) ;; 22 ;; (get-furthest-point-on-path (_type_ vector) float) - (path-control-method-23 () none) ;; 23 ;; (get-path-percentage-at-furthest-point (_type_ vector) float) - (path-control-method-24 () none) ;; 24 ;; (path-control-method-24 (_type_ vector) vector) + (path-control-method-22 (_type_ vector) float) ;; 22 ;; (get-furthest-point-on-path (_type_ vector) float) + (path-control-method-23 (_type_ vector) float) ;; 23 ;; (get-path-percentage-at-furthest-point (_type_ vector) float) + (path-control-method-24 (_type_ vector) float) ;; 24 ;; (path-control-method-24 (_type_ vector) vector) (path-control-method-25 (_type_ vector) float) ;; 25 - (path-control-method-26 () none) ;; 26 ;; (displacement-between-two-points! (_type_ vector float float) vector) - (path-control-method-27 () none) ;; 27 - (path-control-method-28 () none) ;; 28 - (path-control-method-29 () none) ;; 29 + (path-control-method-26 (_type_ float float) float) ;; 26 ;; (displacement-between-two-points! (_type_ vector float float) vector) + (path-control-method-27 (_type_ vector) vector) ;; 27 + (path-control-method-28 (_type_ vector float float) float) ;; 28 + (path-control-method-29 (_type_ vector int float) float) ;; 29 (should-display-marks? (_type_) symbol) ;; 30 - (path-control-method-31 () none) ;; 31 + (displacement-between-two-points! (_type_ vector float float) vector) ;; 31 ) ) @@ -35147,33 +35153,40 @@ (defenum flut-flag :type uint64 :bitfield #t + (ff0 0) + (ff1 1) + (ff2 2) + (ff3 3) ) ;; ---flut-h:flut-flag (deftype flut (process-focusable) - ((extra-trans vector :inline :offset-assert 208) + ((root collide-shape-moving :override) + (extra-trans vector :inline :offset-assert 208) (condition int32 :offset-assert 224) (shadow-backup shadow-geo :offset-assert 228) (rider handle :offset-assert 232) (nav-sphere-handle handle :offset-assert 240) (probe-time time-frame :offset-assert 248) - (count-lock basic :offset-assert 256) + (count-lock symbol :offset-assert 256) (flags flut-flag :offset-assert 264) - (mode basic :offset-assert 272) + (mode symbol :offset-assert 272) (color-index int32 :offset-assert 276) (minimap connection-minimap :offset-assert 280) ) :method-count-assert 35 :size-assert #x11c :flag-assert #x2300a0011c + (:state-methods + wait-for-start ;; 28 + idle ;; 29 + (pickup (state flut)) ;; 30 + wait-for-return ;; 31 + die ;; 32 + ) (:methods - (flut-method-28 () none) ;; 28 - (flut-method-29 () none) ;; 29 - (flut-method-30 () none) ;; 30 - (flut-method-31 () none) ;; 31 - (flut-method-32 () none) ;; 32 - (flut-method-33 () none) ;; 33 - (flut-method-34 () none) ;; 34 + (flut-method-33 (_type_) symbol) ;; 33 + (spawn-part-and-sound! (_type_) none) ;; 34 ) ) @@ -35313,7 +35326,7 @@ (define-extern move-legs? (function symbol :behavior target)) (define-extern jump-hit-ground-stuck? (function symbol :behavior target)) (define-extern target-time-to-ground (function time-frame :behavior target)) -(define-extern fall-test (function (state symbol target) float none :behavior target)) +(define-extern fall-test (function (state object target) float none :behavior target)) (define-extern slide-down-test (function none :behavior target)) (define-extern smack-surface? (function symbol symbol :behavior target)) (define-extern can-roll? (function symbol :behavior target)) @@ -36961,6 +36974,7 @@ (drag-sound-id sound-id :offset-assert 80) ;; guessed by decompiler (whine-sound-id sound-id :offset-assert 84) ;; guessed by decompiler (shield-sound-id sound-id :offset-assert 88) + (mode-sound-bank connection :offset-assert 92) ;; added (mech-start-time time-frame :offset-assert 96) ;; time-frame (mech-time time-frame :offset-assert 104) ;; time-frame (no-get-off-time time-frame :offset-assert 112) ;; time-frame @@ -36990,7 +37004,7 @@ (smoke-local-vel vector 2 :inline :offset-assert 464) ;; guessed by decompiler (particle-system-2d basic :offset-assert 496) (particle-system-3d basic :offset-assert 500) - (part-thruster sparticle-launch-control :offset-assert 504) + (part-thruster sparticle-launcher :offset-assert 504) (part-thruster-scale-x sp-field-init-spec :offset-assert 508) (part-thruster-scale-y sp-field-init-spec :offset-assert 512) (part-quat quaternion :offset-assert 516) @@ -40100,7 +40114,6 @@ ;; collision-editor ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype collision-editor-default-proc (process-drawable) () :method-count-assert 21 @@ -40110,9 +40123,7 @@ idle ;; 20 ) ) -|# -#| (deftype collision-editor-edited-proc (process-drawable) () :method-count-assert 21 @@ -40122,11 +40133,9 @@ idle ;; 20 ) ) -|# -#| (deftype collision-editor (process) - ((proc uint64 :offset-assert 128) + ((proc handle :offset-assert 128) ) :method-count-assert 15 :size-assert #x88 @@ -40135,39 +40144,46 @@ idle ;; 14 ) ) -|# -#| +;; +++collision-editor:collision-editor-func +(defenum collision-editor-func + :type uint64 + (analog 0) + (edit 1) + (print-collision 2) + (stop-editor 3) + ) +;; ---collision-editor:collision-editor-func + (deftype collision-edit-info (structure) - ((editing basic :offset-assert 0) - (current-func uint64 :offset-assert 8) - (analog-func uint64 :offset-assert 16) + ((editing symbol :offset-assert 0) + (current-func collision-editor-func :offset-assert 8) + (analog-func collision-editor-func :offset-assert 16) (current-prim int32 :offset-assert 24) ) :method-count-assert 12 :size-assert #x1c :flag-assert #xc0000001c (:methods - (collision-edit-info-method-9 () none) ;; 9 - (collision-edit-info-method-10 () none) ;; 10 - (collision-edit-info-method-11 () none) ;; 11 + (collision-edit-info-method-9 (_type_) none) ;; 9 + (draw-menu (_type_ process-drawable) none) ;; 10 + (collision-edit-info-method-11 (_type_ process-drawable) none) ;; 11 ) ) -|# -;; (define-extern collision-editor-default-proc-init-by-other function) -;; (define-extern collision-editor-edited-proc-init-by-other function) -;; (define-extern *collision-editor-mesh-names* array) -;; (define-extern *collision-editor-art-group-name* string) -;; (define-extern collision-editor-add-mesh-to-ccache function) -;; (define-extern print-default-collision function) -;; (define-extern print-actual-collision function) -;; (define-extern collision-edit-get-max-prim function) -;; (define-extern collision-edit-get-prim function) -;; (define-extern *collision-edit-info* object) -;; (define-extern collision-editor-init-by-other function) -;; (define-extern stop-collision-edit function) -;; (define-extern collision-edit function) +(define-extern collision-editor-default-proc-init-by-other (function object :behavior collision-editor-default-proc)) +(define-extern collision-editor-edited-proc-init-by-other (function object :behavior collision-editor-edited-proc)) +(define-extern *collision-editor-mesh-names* (array string)) +(define-extern *collision-editor-art-group-name* string) +(define-extern collision-editor-add-mesh-to-ccache (function collide-shape-prim-group collide-cache none)) +(define-extern print-default-collision (function process-drawable none)) +(define-extern print-actual-collision (function process-drawable none)) +(define-extern collision-edit-get-max-prim (function process-drawable int)) +(define-extern collision-edit-get-prim (function process-drawable int collide-shape-prim)) +(define-extern *collision-edit-info* collision-edit-info) +(define-extern collision-editor-init-by-other (function handle object :behavior collision-editor)) +(define-extern stop-collision-edit (function none)) +(define-extern collision-edit (function process (pointer process))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; speech-manager ;; @@ -41594,7 +41610,6 @@ ;; simple-nav-sphere ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype simple-nav-sphere (process-drawable) ((first-time? symbol :offset-assert 200) ;; guessed by decompiler (track-joint int32 :offset-assert 204) @@ -41603,14 +41618,13 @@ :size-assert #xd0 :flag-assert #x16005000d0 (:state-methods - active ;; 21, old: (active () _type_ :state) - idle ;; 20, old: (idle () _type_ :state) + idle ;; 20 + active ;; 21 ) ) -|# -;; (define-extern simple-nav-sphere-event-handler function) ;; (function process int symbol event-message-block object :behavior simple-nav-sphere) -;; (define-extern simple-nav-sphere-init-by-other function) ;; (function float vector nav-mesh int none :behavior simple-nav-sphere) +(define-extern simple-nav-sphere-event-handler (function process int symbol event-message-block object :behavior simple-nav-sphere)) +(define-extern simple-nav-sphere-init-by-other (function float vector nav-mesh int object :behavior simple-nav-sphere)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; process-taskable ;; @@ -49507,7 +49521,7 @@ ;; (define-extern traffic-manager-init-by-other function) ;; (function none :behavior traffic-manager) (define-extern traffic-start (function none)) (define-extern traffic-kill (function none)) -;; (define-extern ctywide-entity-hack function) ;; (function none) +(define-extern ctywide-entity-hack (function none)) ;; (define-extern traffic-entity-hack function) ;; (define-extern riders-on function) ;; (function none) ;; (define-extern riders-off function) ;; (function none) @@ -50277,59 +50291,56 @@ ;; mech-part ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern mech-spawn-thruster function) ;; (function mech-info vector vector float float none) +(define-extern mech-spawn-thruster (function mech-info vector vector float float none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mech ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype mech (process-drawable) - ((extra-trans vector :inline :offset-assert 208) + ((root collide-shape-moving :override) + (extra-trans vector :inline :offset-assert 208) (condition int32 :offset-assert 224) - (shadow-backup basic :offset-assert 228) - (rider uint64 :offset-assert 232) + (shadow-backup shadow-geo :offset-assert 228) + (rider handle :offset-assert 232) (shield-value float :offset-assert 240) - (nav-sphere-handle uint64 :offset-assert 248) - (probe-time uint64 :offset-assert 256) ;; time-frame + (nav-sphere-handle handle :offset-assert 248) + (probe-time time-frame :offset-assert 256) ;; time-frame ) :method-count-assert 25 :size-assert #x108 :flag-assert #x1900900108 - (:methods - (mech-method-24 () none) ;; 24 ;; (mech-method-24 (_type_) none) - ) (:state-methods - wait-for-return ;; 23, old: (wait-for-return () _type_ :state) - pickup ;; 22, old: (pickup ((state mech)) _type_ :state) - idle ;; 21, old: (idle () _type_ :state) - wait-for-start ;; 20, old: (wait-for-start () _type_ :state) + wait-for-start ;; 20 + idle ;; 21 + (pickup (state mech)) ;; 22 + wait-for-return ;; 23 + ) + (:methods + (mech-method-24 (_type_) none) ;; 24 ) ) -|# -#| (deftype mech-target (process-drawable) - () + ((parent (pointer target) :override) + ) :method-count-assert 22 :size-assert #xc8 :flag-assert #x16005000c8 (:state-methods - active ;; 21, old: (active () _type_ :state) - idle ;; 20, old: (idle () _type_ :state) + idle ;; 20 + active ;; 21 ) ) -|# -;; (define-extern mech-init function) ;; (function entity-actor matrix3 handle float none :behavior mech) -;; (define-extern mech-target-init function) ;; (function vector quaternion entity-actor none :behavior mech) -;; (define-extern mech-target-spawn function) ;; (function vector process quaternion entity-actor (pointer mech-target)) +(define-extern mech-init (function entity-actor matrix3 handle float object :behavior mech)) +(define-extern mech-target-init (function vector quaternion entity-actor object :behavior mech)) +(define-extern mech-target-spawn (function vector process quaternion entity-actor (pointer mech-target))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-mech ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype mech-shield (shield-sphere) () :method-count-assert 43 @@ -50339,43 +50350,42 @@ shield-disabled ;; 29 ) ) -|# -;; (define-extern mech-shield-init-by-other function) -;; (define-extern *mech-stance-mods* surface) ;; surface -;; (define-extern *mech-walk-mods* surface) ;; surface -;; (define-extern *mech-jump-mods* surface) ;; surface -;; (define-extern *mech-punch-mods* surface) ;; surface -;; (define-extern *mech-pickup-mods* surface) ;; surface -;; (define-extern *mech-carry-walk-mods* surface) ;; surface -;; (define-extern *mech-carry-drag-mods* surface) ;; surface -;; (define-extern *mech-carry-jump-mods* surface) ;; surface -;; (define-extern target-mech-falling-anim-trans function) ;; (function none :behavior target) -;; (define-extern target-mech-mech-effect function) ;; (function target none :behavior mech) -;; (define-extern mech-on-ground? function) ;; (function symbol :behavior target) -;; (define-extern target-mech-get-off? function) ;; (function symbol :behavior target) -;; (define-extern target-mech-handler function) ;; (function process int symbol event-message-block object :behavior target) -;; (define-extern target-mech-bonk-event-handler function) ;; (function process int symbol event-message-block object :behavior target) -;; (define-extern mech-leg-ik-callback function) ;; (function joint-mod-ik matrix matrix vector object :behavior target) -;; (define-extern mech-update-ik function) ;; (function none :behavior target) -;; (define-extern target-mech-init function) ;; (function handle float symbol none :behavior target) -;; (define-extern target-mech-exit function) ;; (function none :behavior target) -;; (define-extern target-mech-effect function) ;; (function none :behavior target) -;; (define-extern target-mech-add-thrust function) ;; (function none :behavior target) -;; (define-extern target-mech-collision function) ;; (function none :behavior target) -;; (define-extern target-mech-real-post function) ;; (function none :behavior target) -;; (define-extern target-mech-post function) ;; (function none :behavior target) +(define-extern mech-shield-init-by-other (function shield-sphere-spawn-params object :behavior mech-shield)) +(define-extern *mech-stance-mods* surface) +(define-extern *mech-walk-mods* surface) +(define-extern *mech-jump-mods* surface) +(define-extern *mech-punch-mods* surface) +(define-extern *mech-pickup-mods* surface) +(define-extern *mech-carry-walk-mods* surface) +(define-extern *mech-carry-drag-mods* surface) +(define-extern *mech-carry-jump-mods* surface) +(define-extern target-mech-falling-anim-trans (function none :behavior target)) +(define-extern target-mech-mech-effect (function target none :behavior mech)) +(define-extern mech-on-ground? (function symbol :behavior target)) +(define-extern target-mech-get-off? (function symbol :behavior target)) +(define-extern target-mech-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-mech-bonk-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern mech-leg-ik-callback (function joint-mod-ik matrix matrix vector object :behavior target)) +(define-extern mech-update-ik (function none :behavior target)) +(define-extern target-mech-init (function handle float symbol none :behavior target)) +(define-extern target-mech-exit (function none :behavior target)) +(define-extern target-mech-effect (function none :behavior target)) +(define-extern target-mech-add-thrust (function none :behavior target)) +(define-extern target-mech-collision (function none :behavior target)) +(define-extern target-mech-real-post (function none :behavior target)) +(define-extern target-mech-post (function none :behavior target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; mech-states ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *mech-exploder-params* joint-exploder-static-params) ;; joint-exploder-static-params -;; (define-extern check-turn-on-shield function) -;; (define-extern mech-can-throw? function) -;; (define-extern target-mech-punch-pick function) ;; (function symbol int :behavior target) -;; (define-extern target-mech-carry-update function) ;; (function none :behavior target) -;; (define-extern target-mech-carry-post function) ;; (function none :behavior target) +(define-extern *mech-exploder-params* joint-exploder-static-params) +(define-extern check-turn-on-shield (function target object)) +(define-extern mech-can-throw? (function symbol :behavior target)) +(define-extern target-mech-punch-pick (function symbol int :behavior target)) +(define-extern target-mech-carry-update (function none :behavior target)) +(define-extern target-mech-carry-post (function none :behavior target)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nstb-texture ;; @@ -65654,17 +65664,16 @@ ;; flut ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *flut-shadow-control* shadow-control) -;; (define-extern *flut-color-table* array) -;; (define-extern flut-color-from-index function) -;; (define-extern flut-random-color-index function) -;; (define-extern flut-init function) +(define-extern *flut-shadow-control* shadow-control) +(define-extern *flut-color-table* (array rgbaf)) +(define-extern flut-color-from-index (function int none :behavior flut)) +(define-extern flut-random-color-index (function int)) +(define-extern flut-init (function entity-actor transformq handle flut-flag symbol object :behavior flut)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; target-flut ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype flut-bank (basic) ((jump-height-min meters :offset-assert 4) (jump-height-max meters :offset-assert 8) @@ -65677,33 +65686,31 @@ :size-assert #x20 :flag-assert #x900000020 ) -|# -;; (define-extern *FLUT-bank* flut-bank) -;; (define-extern *flut-walk-mods* surface) -;; (define-extern *flut-run-racer-mods* surface) -;; (define-extern *flut-run-wild-mods* surface) -;; (define-extern *flut-jump-wild-mods* surface) -;; (define-extern *flut-jump-mods* surface) -;; (define-extern *flut-jump-racer-mods* surface) -;; (define-extern *flut-double-jump-mods* surface) -;; (define-extern *flut-double-jump-racer-mods* surface) -;; (define-extern *flut-run-attack-mods* surface) -;; (define-extern *flut-air-attack-mods* surface) -;; (define-extern flut-leg-ik-callback function) -;; (define-extern flut-update-ik function) -;; (define-extern target-flut-get-off? function) -;; (define-extern target-flut-post-post function) -;; (define-extern target-flut-wild-post function) -;; (define-extern target-flut-post function) -;; (define-extern target-flut-falling-anim-trans function) -;; (define-extern target-flut-hit-ground-anim function) -;; (define-extern target-flut-standard-event-handler function) -;; (define-extern target-flut-dangerous-event-handler function) -;; (define-extern target-fldax-enter function) -;; (define-extern target-fldax-exit function) -;; (define-extern target-flut-run-wild object) -;; (define-extern *flut-get-off-mods* object) +(define-extern *FLUT-bank* flut-bank) +(define-extern *flut-walk-mods* surface) +(define-extern *flut-run-racer-mods* surface) +(define-extern *flut-run-wild-mods* surface) +(define-extern *flut-jump-wild-mods* surface) +(define-extern *flut-jump-mods* surface) +(define-extern *flut-jump-racer-mods* surface) +(define-extern *flut-double-jump-mods* surface) +(define-extern *flut-double-jump-racer-mods* surface) +(define-extern *flut-run-attack-mods* surface) +(define-extern *flut-air-attack-mods* surface) +(define-extern flut-leg-ik-callback (function joint-mod-ik object object vector none)) +(define-extern flut-update-ik (function object :behavior target)) +(define-extern target-flut-get-off? (function symbol :behavior target)) +(define-extern target-flut-post-post (function none :behavior target)) +(define-extern target-flut-wild-post (function none :behavior target)) +(define-extern target-flut-post (function none :behavior target)) +(define-extern target-flut-falling-anim-trans (function object :behavior target)) +(define-extern target-flut-hit-ground-anim (function object :behavior target)) +(define-extern target-flut-standard-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-flut-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-fldax-enter (function object :behavior target)) +(define-extern target-fldax-exit (function object :behavior target)) +(define-extern *flut-get-off-mods* surface) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ctymark-obs-h ;; @@ -68255,10 +68262,9 @@ ;; target-tube ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype tube-info (basic) - ((entity basic :offset-assert 4) - (tube uint64 :offset-assert 8) ;; handle + ((entity entity :offset-assert 4) + (tube handle :offset-assert 8) ;; handle (downhill vector :inline :offset-assert 16) (centertube vector :inline :offset-assert 32) (downtube vector :inline :offset-assert 48) @@ -68267,7 +68273,7 @@ (old-transv vector :inline :offset-assert 96) (mod-x float :offset-assert 112) (mod-y float :offset-assert 116) - (start-time uint64 :offset-assert 120) ;; time-frame + (start-time time-frame :offset-assert 120) ;; time-frame (turn-anim-targ float :offset-assert 128) (turn-anim-frame float :offset-assert 132) (turn-anim-vel float :offset-assert 136) @@ -68279,20 +68285,16 @@ :size-assert #x98 :flag-assert #x900000098 ) -|# -#| (deftype tube-bank (basic) () :method-count-assert 9 :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype slide-control (process-drawable) - ((target uint64 :offset-assert 200) ;; handle + ((target handle :offset-assert 200) ;; handle (pos float :offset-assert 208) (trans vector :inline :offset-assert 224) (rot vector :inline :offset-assert 240) @@ -68302,27 +68304,23 @@ :size-assert #x110 :flag-assert #x1600900110 (:state-methods - slide-control-ride ;; 21, old: (slide-control-ride () _type_ :state) - slide-control-watch ;; 20, old: (slide-control-watch () _type_ :state) + slide-control-watch ;; 20 + slide-control-ride ;; 21 ) ) -|# -;; (define-extern *tube-mods* surface) ;; surface -;; (define-extern *tube-jump-mods* surface) ;; surface -;; (define-extern *tube-hit-mods* surface) ;; surface -;; (define-extern *tube-surface* surface) ;; surface -;; (define-extern *TUBE-bank* tube-bank) ;; tube-bank -;; (define-extern tube-sounds function) ;; (function sound-id :behavior target) -;; (define-extern tube-thrust function) ;; (function float float none :behavior target) -;; (define-extern target-tube-post function) ;; (function none :behavior target) -;; (define-extern target-tube-turn-anim function) ;; (function none :behavior target) -;; (define-extern target-tube-walk object) -;; (define-extern target-tube-jump object) ;; (state float float target) -;; (define-extern target-tube-hit object) ;; (state symbol attack-info target) -;; (define-extern target-tube-death object) ;; (state symbol target) -;; (define-extern distance-from-tangent function) ;; (function path-control float vector vector vector vector float) -;; (define-extern find-target-point function) ;; (function vector float :behavior slide-control) +(define-extern *tube-mods* surface) +(define-extern *tube-jump-mods* surface) +(define-extern *tube-hit-mods* surface) +(define-extern *tube-surface* surface) +(define-extern *TUBE-bank* tube-bank) +(define-extern tube-sounds (function sound-id :behavior target)) +(define-extern tube-thrust (function float float none :behavior target)) +(define-extern target-tube-post (function none :behavior target)) +(define-extern target-tube-turn-anim (function none :behavior target)) + +(define-extern distance-from-tangent (function path-control float vector vector vector vector float)) +(define-extern find-target-point (function vector float :behavior slide-control)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; precurc-part ;; diff --git a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc index 9221de2350..4b17f641ea 100644 --- a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc @@ -545,5 +545,22 @@ [107, "(function script-context object)"], [108, "(function script-context object)"] ], - "relocate": [[7, "(function sparticle-system sparticle-cpuinfo none)"]] + "relocate": [[7, "(function sparticle-system sparticle-cpuinfo none)"]], + "target-mech": [ + [7, "(function object :behavior target)"], + [8, "(function object :behavior target)"], + [9, "(function object :behavior target)"], + [18, "(function surface surface surface int object :behavior target)"], + [19, "(function surface surface surface int object :behavior target)"] + ], + "mech-states": [[57, "(function object :behavior target)"]], + "target-flut": [ + [14, "(function surface surface surface int object :behavior target)"], + [20, "(function object :behavior target)"], + [21, "(function object :behavior target)"], + [33, "(function process-focusable object)"], + [72, "(function object)"], + [73, "(function object :behavior target)"], + [74, "(function object :behavior target)"] + ] } diff --git a/decompiler/config/jak3/ntsc_v1/hacks.jsonc b/decompiler/config/jak3/ntsc_v1/hacks.jsonc index d28c2719f4..34928d3456 100644 --- a/decompiler/config/jak3/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak3/ntsc_v1/hacks.jsonc @@ -385,7 +385,8 @@ "(method 16 sparticle-launch-control)": [25, 35, 36, 48, 62, 65, 100, 102], "(anon-function 17 target-ladder)": [0, 1], "command-get-process": [46], - "foreground-draw-hud": [0, 7, 8, 9, 16, 22] + "foreground-draw-hud": [0, 7, 8, 9, 16, 22], + "target-flut-falling-anim-trans": [8, 9] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak3/ntsc_v1/inputs.jsonc b/decompiler/config/jak3/ntsc_v1/inputs.jsonc index dad6fb044e..5246f6628b 100644 --- a/decompiler/config/jak3/ntsc_v1/inputs.jsonc +++ b/decompiler/config/jak3/ntsc_v1/inputs.jsonc @@ -44,7 +44,7 @@ // "DGO/LJAKC.DGO", // "DGO/CTB.DGO", // "DGO/CTYCARC.DGO", - // "DGO/LMECH.DGO", + "DGO/LMECH.DGO", // "DGO/LBBSDRP2.DGO", // "DGO/NSA.DGO", // "DGO/LBBTCHA3.DGO", @@ -78,7 +78,7 @@ // "DGO/RAILB.DGO", // "DGO/LCTYHIJK.DGO", // "DGO/CTYPEPB.DGO", - // "DGO/PRECB.DGO", + "DGO/PRECB.DGO", // "DGO/LFORM.DGO", // "DGO/WASLEAPR.DGO", // "DGO/LKEIRA.DGO", @@ -133,7 +133,7 @@ // "DGO/CFA.DGO", // "DGO/LJINX.DGO", // "DGO/SEO.DGO", - // "DGO/PRECA.DGO", + "DGO/PRECA.DGO", // "DGO/TOWERC.DGO", // "DGO/WCA.DGO", // "DGO/SEC.DGO", @@ -208,7 +208,7 @@ // "DGO/LONINSIM.DGO", // "DGO/RUBA.DGO", // "DGO/DESRALLY.DGO", - // "DGO/WWD.DGO", + "DGO/WWD.DGO", // "DGO/STB.DGO", // "DGO/MIB.DGO", // "DGO/LCTYBLOW.DGO", @@ -235,7 +235,7 @@ // "DGO/TEMC.DGO", // "DGO/COMBC.DGO", // "DGO/LTRTWHLS.DGO", - // "DGO/PRECC.DGO", + "DGO/PRECC.DGO", // "DGO/DESCHASE.DGO", // "DGO/CITYCAST.DGO", // "DGO/CPO.DGO", diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index a7bf7328a1..f71bb1043d 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -584,5 +584,71 @@ ["L200", "uint64", true], ["L203", "uint64", true], ["L201", "uint64", true] + ], + "target-tube": [["L191", "attack-info"]], + "mech": [["L118", "attack-info"]], + "target-mech": [ + ["L256", "attack-info"], + ["L250", "vector"], + ["L249", "vector"] + ], + "mech-states": [ + ["L675", "uint64", true], + ["L655", "uint64", true], + ["L663", "uint64", true], + ["L668", "uint64", true], + ["L659", "uint64", true], + ["L669", "uint64", true], + ["L654", "uint64", true], + ["L653", "uint64", true], + ["L672", "uint64", true], + ["L657", "uint64", true], + ["L656", "uint64", true], + ["L674", "uint64", true], + ["L676", "uint64", true], + ["L667", "uint64", true], + ["L658", "uint64", true], + ["L673", "uint64", true], + ["L670", "uint64", true], + ["L662", "uint64", true], + ["L661", "uint64", true], + ["L660", "uint64", true], + ["L666", "uint64", true], + ["L665", "uint64", true], + ["L652", "uint64", true], + ["L629", "attack-info"], + ["L671", "uint64", true], + ["L664", "uint64", true] + ], + "target-flut": [ + ["L789", "uint64", true], + ["L766", "uint64", true], + ["L767", "uint64", true], + ["L774", "uint64", true], + ["L765", "uint64", true], + ["L768", "uint64", true], + ["L771", "uint64", true], + ["L773", "uint64", true], + ["L776", "uint64", true], + ["L750", "attack-info"], + ["L775", "uint64", true], + ["L770", "uint64", true], + ["L748", "attack-info"], + ["L769", "uint64", true], + ["L736", "attack-info"], + ["L735", "attack-info"], + ["L741", "attack-info"], + ["L740", "attack-info"], + ["L739", "attack-info"], + ["L772", "uint64", true], + ["L727", "attack-info"], + ["L764", "uint64", true], + ["L763", "uint64", true], + ["L762", "uint64", true] + ], + "flut": [ + ["L139", "attack-info"], + ["L138", "attack-info"], + ["L137", "attack-info"] ] } diff --git a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc index 4c0c0f2ca8..3d63fb17ee 100644 --- a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc @@ -718,5 +718,51 @@ [176, "part-tracker-init-params"] ], "(method 9 mood-control)": [[16, "mood-control-work"]], - "check-drop-level-rain": [[16, "vector"]] + "check-drop-level-rain": [[16, "vector"]], + "(method 28 path-control)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"] + ], + "(method 29 path-control)": [[32, "vector"]], + "print-default-collision": [ + [144, "vector"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [160, "matrix"] + ], + "mech-spawn-thruster": [[32, "vector"]], + "mech-shield-init-by-other": [[16, "shield-sphere-distort-spawn-params"]], + "target-mech-get-off?": [[560, ["inline-array", "sphere", 1]]], + "mech-update-ik": [ + [16, "collide-query"], + [592, "vector"], + [608, "vector"], + [624, "vector"], + [640, "vector"], + [656, "vector"], + [672, "vector"] + ], + "target-mech-init": [[96, "shield-sphere-spawn-params"]], + "target-mech-add-thrust": [[16, "vector"]], + "target-mech-collision": [[144, "vector"]], + "(code target-mech-carry-throw)": [[640, ["inline-array", "sphere", 1]]], + "(trans target-mech-carry-drag)": [[560, ["inline-array", "sphere", 1]]], + "(code target-mech-carry-drop)": [[672, ["inline-array", "sphere", 1]]], + "target-mech-carry-update": [[560, ["inline-array", "sphere", 1]]], + "flut-update-ik": [ + [16, "collide-query"], + [624, "vector"], + [640, "vector"], + [656, "vector"], + [592, "vector"], + [608, "vector"] + ], + "(code target-flut-get-on)": [ + [16, "vector"], + [32, "vector"] + ] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 8057e75647..42cf9f52e7 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -4688,5 +4688,290 @@ [90, "t1", "vu-lights"], [[93, 99], "t1", "(pointer uint128)"], [101, "t1", "(pointer uint128)"] + ], + "free-eye-index": [[30, "a2", "eye-control"]], + "update-eyes": [ + [23, "v1", "process-drawable"], + [29, "v1", "process-drawable"] + ], + "render-eyes-64": [ + [[77, 82], "v1", "dma-gif-packet"], + [[88, 93], "s0", "adgif-shader"], + [[132, 164], "v1", "(inline-array vector4w)"], + [[244, 274], "a1", "(inline-array vector4w)"], + [[284, 292], "v1", "dma-gif-packet"], + [[298, 303], "s0", "adgif-shader"], + [[376, 406], "a1", "(inline-array vector4w)"], + [[442, 450], "v1", "dma-gif-packet"], + [[456, 461], "s0", "adgif-shader"], + [[535, 562], "a1", "(inline-array vector4w)"], + [[575, 580], "v1", "dma-gif-packet"], + [[586, 591], "s0", "adgif-shader"], + [[664, 694], "a1", "(inline-array vector4w)"], + [[733, 738], "v1", "dma-gif-packet"], + [[744, 749], "s0", "adgif-shader"], + [[845, 874], "a1", "(inline-array vector4w)"], + [[887, 892], "v1", "dma-gif-packet"], + [[898, 903], "s0", "adgif-shader"], + [[1003, 1029], "a1", "(inline-array vector4w)"], + [180, "a0", "int"], + [188, "a1", "int"], + [310, "a0", "int"], + [318, "a1", "int"], + [468, "a0", "int"], + [476, "a1", "int"], + [598, "a0", "int"], + [606, "a1", "int"], + [756, "a0", "int"], + [764, "a1", "int"], + [910, "a0", "int"], + [918, "a1", "int"] + ], + "render-eyes-32": [ + [[77, 82], "v1", "dma-gif-packet"], + [[88, 93], "s0", "adgif-shader"], + [[132, 164], "v1", "(inline-array vector4w)"], + [[244, 274], "a1", "(inline-array vector4w)"], + [[287, 292], "v1", "dma-gif-packet"], + [[298, 303], "s0", "adgif-shader"], + [[376, 406], "a1", "(inline-array vector4w)"], + [[445, 450], "v1", "dma-gif-packet"], + [[456, 461], "s0", "adgif-shader"], + [[532, 562], "a1", "(inline-array vector4w)"], + [[575, 580], "v1", "dma-gif-packet"], + [[586, 591], "s0", "adgif-shader"], + [[664, 694], "a1", "(inline-array vector4w)"], + [[733, 738], "v1", "dma-gif-packet"], + [[744, 749], "s0", "adgif-shader"], + [[845, 874], "a1", "(inline-array vector4w)"], + [[887, 892], "v1", "dma-gif-packet"], + [[898, 903], "s0", "adgif-shader"], + [[1000, 1029], "a1", "(inline-array vector4w)"], + [180, "a0", "int"], + [188, "a1", "int"], + [910, "a0", "int"], + [918, "a1", "int"], + [310, "a0", "int"], + [318, "a1", "int"], + [468, "a0", "int"], + [476, "a1", "int"], + [598, "a0", "int"], + [606, "a1", "int"], + [756, "a0", "int"], + [764, "a1", "int"] + ], + "(method 28 path-control)": [["_stack_", 124, "float"]], + "collision-edit-get-prim": [[11, "v1", "collide-shape"]], + "collision-edit-get-max-prim": [[11, "v1", "collide-shape"]], + "print-actual-collision": [ + [12, "v1", "collide-shape"], + [182, "v1", "collide-shape"], + [83, "v1", "collide-shape-prim-mesh"], + [87, "v1", "(array string)"] + ], + "print-default-collision": [ + [23, "v1", "process-drawable"], + [27, "v1", "process-drawable"], + [55, "v1", "process-drawable"], + [66, "v1", "process-drawable"], + [76, "v0", "(array collide-mesh)"], + [138, "v1", "process-drawable"], + [157, "v1", "process-drawable"], + [267, "a1", "process-drawable"], + [277, "v1", "process-drawable"], + [375, "v1", "process-drawable"], + [[190, 250], "a0", "(inline-array collide-cache-tri)"] + ], + "(method 10 collision-edit-info)": [[[495, 538], "s4", "collide-cache-tri"]], + "(event slide-control-ride slide-control)": [ + [21, "gp", "process-drawable"], + [32, "v1", "vector"], + [36, "v1", "vector"], + [28, "v1", "vector"] + ], + "(code target-tube-walk)": [ + [44, "v1", "art-joint-anim"], + [129, "v1", "art-joint-anim"] + ], + "(code target-tube-start)": [[163, "v1", "float"]], + "(trans active simple-nav-sphere)": [ + [10, "v1", "process-drawable"], + [14, "a0", "collide-shape"], + [17, "a0", "collide-shape"] + ], + "simple-nav-sphere-event-handler": [ + [11, "a0", "collide-shape"], + [14, "a0", "collide-shape"], + [24, "a0", "collide-shape"], + [26, "a0", "collide-shape"], + [28, "a0", "collide-shape"], + [21, "v1", "float"] + ], + "target-mech-handler": [ + [94, "a0", "process"], + [[198, 380], "s3", "attack-info"] + ], + "mech-update-ik": [ + [3, "v1", "process-drawable"], + [36, "s5", "collide-shape"], + [41, "s5", "collide-shape"], + [85, "s5", "collide-shape-moving"] + ], + "target-mech-collision": [[108, "v0", "carry-info"]], + "(anon-function 8 target-mech)": [ + [4, "gp", "target"], + [10, "gp", "target"], + [14, "gp", "target"] + ], + "(anon-function 9 target-mech)": [ + [6, "v1", "target"], + [10, "v1", "target"], + [16, "v1", "target"], + [20, "v1", "target"], + [24, "v1", "target"], + [28, "v1", "target"], + [32, "v1", "target"] + ], + "(event target-mech-grab)": [[27, "a0", "process"]], + "(code target-mech-get-off)": [[67, "v1", "art-joint-anim"]], + "(code target-mech-get-up)": [ + [74, "v1", "process-drawable"], + [80, "v1", "process-drawable"], + [115, "v1", "art-joint-anim"] + ], + "(code target-mech-get-on)": [ + [74, "v1", "process-drawable"], + [80, "v1", "process-drawable"], + [115, "v1", "art-joint-anim"] + ], + "(code target-mech-carry-throw)": [ + [51, "v0", "carry-info"], + [112, "v0", "carry-info"] + ], + "(enter target-mech-carry-hit-ground)": [[3, "v0", "sound-rpc-set-param"]], + "(exit target-mech-carry-drag)": [ + [28, "v0", "sound-rpc-set-param"], + [11, "v0", "sound-rpc-set-param"] + ], + "(code target-mech-carry-walk)": [[80, "f0", "float"]], + "(code target-mech-carry-drop)": [ + [42, "v0", "carry-info"], + [110, "v1", "art-joint-anim"], + [176, "v0", "carry-info"], + [283, "v0", "sound-rpc-set-param"], + [316, "v0", "sound-rpc-set-param"] + ], + "(code target-mech-carry-pickup)": [ + [137, "v0", "carry-info"], + [377, "v1", "art-joint-anim"], + [541, "v0", "carry-info"], + [574, "f0", "float"] + ], + "(code target-mech-death)": [ + [410, "gp", "art-joint-anim"], + [731, "v1", "art-joint-anim"] + ], + "(code target-mech-walk)": [[91, "f0", "float"]], + "(code target-mech-punch)": [ + [107, "v1", "art-joint-anim"], + [135, "v1", "art-joint-anim"], + [163, "v1", "art-joint-anim"], + [191, "v1", "art-joint-anim"], + [231, "v1", "art-joint-anim"], + [259, "v1", "art-joint-anim"], + [287, "v1", "art-joint-anim"], + [315, "v1", "art-joint-anim"] + ], + "(event target-mech-punch)": [ + [45, "gp", "collide-query"], + [53, "s4", "collide-shape-prim"], + [68, "s5", "process-focusable"], + [104, "gp", "collide-query"], + [109, "s4", "collide-shape-prim"], + [137, "s5", "process-focusable"], + [166, "gp", "collide-query"], + [213, "gp", "collide-query"] + ], + "target-mech-punch-pick": [ + [227, "s5", "art-joint-anim"], + [246, "s5", "art-joint-anim"] + ], + "(code target-mech-jump)": [[26, "t9", "(function none)"]], + "(enter target-mech-hit-ground)": [[3, "v0", "sound-rpc-set-param"]], + "(method 33 flut)": [[8, "v0", "(array collide-shape)"]], + "(event target-flut-grab)": [[35, "a0", "process"]], + "(post target-flut-kanga-catch)": [[21, "s5", "process-focusable"]], + "(code target-flut-kanga-catch)": [ + [62, "s5", "art-joint-anim"], + [127, "s5", "process-focusable"], + [137, "s5", "process-focusable"], + [187, "s5", "process-focusable"] + ], + "target-flut-standard-event-handler": [[305, "a0", "process"]], + "target-flut-hit-ground-anim": [ + [137, "v1", "art-joint-anim"], + [212, "v1", "art-joint-anim"] + ], + "(code target-flut-run-wild)": [[72, "v1", "art-joint-anim"]], + "(code target-flut-double-jump)": [[14, "v1", "art-joint-anim"]], + "(code target-flut-stance)": [ + [87, "v1", "art-joint-anim"], + [153, "v1", "art-joint-anim"], + [219, "v1", "art-joint-anim"] + ], + "(trans target-flut-walk)": [ + [144, "f0", "float"], + [149, "f1", "float"] + ], + "(code target-flut-walk)": [[65, "v1", "art-joint-anim"]], + "(event target-flut-running-attack)": [ + [40, "v1", "process-drawable"], + [46, "s5", "collide-shape"] + ], + "(code target-flut-air-attack-hit-ground)": [[81, "v1", "art-joint-anim"]], + "(code target-flut-air-attack)": [[78, "v1", "art-joint-anim"]], + "flut-update-ik": [ + [3, "v1", "process-drawable"], + [36, "s5", "collide-shape"], + [41, "s5", "collide-shape"], + [96, "s5", "collide-shape-moving"] + ], + "(anon-function 74 target-flut)": [ + [6, "gp", "target"], + [10, "gp", "target"], + [16, "gp", "target"], + [24, "gp", "target"], + [33, "gp", "target"], + [42, "a0", "target"], + [49, "gp", "target"], + [56, "gp", "target"] + ], + "(anon-function 21 target-flut)": [[58, "v1", "art-joint-anim"]], + "(code target-flut-death)": [ + [609, "a1", "art-joint-anim"], + [698, "a1", "art-joint-anim"] + ], + "(code target-flut-get-on)": [ + [75, "s3", "process-drawable"], + [72, "s2", "process-drawable"], + [204, "v1", "process-drawable"], + [201, "s3", "process-drawable"] + ], + "(code target-flut-running-attack)": [ + [129, "a0", "uint"], + [298, "v1", "art-joint-anim"] + ], + "(trans target-flut-running-attack)": [[87, "v1", "int"]], + "(anon-function 20 target-flut)": [ + // [ + // 119, + // "v1", + // "art-joint-anim" + // ], + // [ + // 284, + // "v1", + // "art-joint-anim" + // ] ] } diff --git a/decompiler/level_extractor/extract_merc.cpp b/decompiler/level_extractor/extract_merc.cpp index aa15397284..bbda59d934 100644 --- a/decompiler/level_extractor/extract_merc.cpp +++ b/decompiler/level_extractor/extract_merc.cpp @@ -760,9 +760,9 @@ s32 find_or_add_texture_to_level(tfrag3::Level& out, } // check eyes - u32 eye_tpage = version == GameVersion::Jak2 ? 0x70c : 0x1cf; - u32 left_id = version == GameVersion::Jak2 ? 7 : 0x6f; - u32 right_id = version == GameVersion::Jak2 ? 8 : 0x70; + u32 eye_tpage = PerGameVersion(0x1cf, 0x70c, 0x3)[version]; + u32 left_id = PerGameVersion(0x6f, 0x7, 0x2)[version]; + u32 right_id = PerGameVersion(0x70, 0x8, 0x3)[version]; if (eye_out && (pc_combo_tex_id >> 16) == eye_tpage) { auto tex_it = tex_db.textures.find(pc_combo_tex_id); diff --git a/game/graphics/opengl_renderer/EyeRenderer.cpp b/game/graphics/opengl_renderer/EyeRenderer.cpp index 678486a1a2..bc70ce9341 100644 --- a/game/graphics/opengl_renderer/EyeRenderer.cpp +++ b/game/graphics/opengl_renderer/EyeRenderer.cpp @@ -23,6 +23,7 @@ void EyeRenderer::init_textures(TexturePool& texture_pool, GameVersion version) tbp += EYE_BASE_BLOCK_JAK1; break; case GameVersion::Jak2: + case GameVersion::Jak3: // NOTE: using jak 1's address because jak 2's breaks some ocean stuff. tbp += EYE_BASE_BLOCK_JAK1; break; diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index 0d6d6cc0a6..95cc7a2f70 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -302,6 +302,10 @@ void OpenGLRenderer::init_bucket_renderers_jak3() { init_bucket_renderer("debug-menu", BucketCategory::OTHER, BucketId::DEBUG_MENU, 0x8000); + auto eye_renderer = std::make_unique("eyes", 0); + m_render_state.eye_renderer = eye_renderer.get(); + m_jak3_eye_renderer = std::move(eye_renderer); + // for any unset renderers, just set them to an EmptyBucketRenderer. for (size_t i = 0; i < m_bucket_renderers.size(); i++) { if (!m_bucket_renderers[i]) { @@ -312,6 +316,8 @@ void OpenGLRenderer::init_bucket_renderers_jak3() { m_bucket_renderers[i]->init_shaders(m_render_state.shaders); m_bucket_renderers[i]->init_textures(*m_render_state.texture_pool, GameVersion::Jak3); } + m_jak3_eye_renderer->init_shaders(m_render_state.shaders); + m_jak3_eye_renderer->init_textures(*m_render_state.texture_pool, GameVersion::Jak3); } } @@ -1041,6 +1047,12 @@ void OpenGLRenderer::draw_renderer_selection_window() { ImGui::TreePop(); } } + if (m_jak3_eye_renderer) { + if (ImGui::TreeNode("Eyes")) { + m_jak3_eye_renderer->draw_debug_window(); + ImGui::TreePop(); + } + } ImGui::End(); } diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.h b/game/graphics/opengl_renderer/OpenGLRenderer.h index db9a4633db..bf2e165db4 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.h +++ b/game/graphics/opengl_renderer/OpenGLRenderer.h @@ -135,5 +135,6 @@ class OpenGLRenderer { } m_fbo_state; std::unique_ptr m_jak2_eye_renderer; + std::unique_ptr m_jak3_eye_renderer; GameVersion m_version; }; diff --git a/goal_src/jak3/engine/ai/traffic-h.gc b/goal_src/jak3/engine/ai/traffic-h.gc index 6ed17350d8..52c5e72524 100644 --- a/goal_src/jak3/engine/ai/traffic-h.gc +++ b/goal_src/jak3/engine/ai/traffic-h.gc @@ -53,6 +53,7 @@ (define-extern traffic-start (function none)) (define-extern traffic-kill (function none)) +(define-extern ctywide-entity-hack (function none)) ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/collide/collide-target-h.gc b/goal_src/jak3/engine/collide/collide-target-h.gc index 46d188c876..d01e7183e5 100644 --- a/goal_src/jak3/engine/collide/collide-target-h.gc +++ b/goal_src/jak3/engine/collide/collide-target-h.gc @@ -228,6 +228,6 @@ (last-nonzero-input-dir-targ quaternion :inline :offset 6384) (time-of-last-wall-hide-first-check-pass time-frame :offset 6400) (time-of-first-wall-hide-first-check-pass time-frame :offset 6408) - (pad uint8 4) + (unknown-float0000 float :offset 6416) ) ) diff --git a/goal_src/jak3/engine/common-obs/elevator.gc b/goal_src/jak3/engine/common-obs/elevator.gc index 873822dd2a..f972bfc989 100644 --- a/goal_src/jak3/engine/common-obs/elevator.gc +++ b/goal_src/jak3/engine/common-obs/elevator.gc @@ -549,7 +549,7 @@ :code sleep-code :post (behavior () (logclear! (-> self elevator-status) (elevator-status waiting-to-descend)) - (path-control-method-9 (-> self path)) + (debug-draw (-> self path)) (plat-post) ) ) diff --git a/goal_src/jak3/engine/common-obs/generic-obs.gc b/goal_src/jak3/engine/common-obs/generic-obs.gc index f736b5e8cf..0457989a82 100644 --- a/goal_src/jak3/engine/common-obs/generic-obs.gc +++ b/goal_src/jak3/engine/common-obs/generic-obs.gc @@ -164,14 +164,15 @@ ) (update-anim-data (-> self skel)) (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) - (let ((a0-22 (-> self skel effect))) - (if a0-22 - (effect-control-method-9 a0-22) - ) - ) - (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) - (merc-blend-shape self) - ) + ;; not-yet-implemented + ;; (let ((a0-22 (-> self skel effect))) + ;; (if a0-22 + ;; (effect-control-method-9 a0-22) + ;; ) + ;; ) + ;; (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) + ;; (merc-blend-shape self) + ;; ) (if (logtest? (-> self skel status) (joint-control-status eye-anim-valid eye-anim)) (merc-eye-anim self) ) @@ -2054,7 +2055,7 @@ :trans (behavior () (when (-> self enable) (when (nonzero? (-> self path)) - (path-control-method-9 (-> self path)) + (debug-draw (-> self path)) (get-point-at-percent-along-path! (-> self path) (-> self root trans) (-> self path-pos) 'interp) (displacement-between-points-at-percent-normalized! (-> self path) (-> self last-velocity) (-> self path-pos)) (let ((f0-3 (+ (-> self path-pos) (* (-> self path-speed) (seconds-per-frame))))) diff --git a/goal_src/jak3/engine/common-obs/water-flow.gc b/goal_src/jak3/engine/common-obs/water-flow.gc index e0b2cbf727..f4bdadb588 100644 --- a/goal_src/jak3/engine/common-obs/water-flow.gc +++ b/goal_src/jak3/engine/common-obs/water-flow.gc @@ -67,7 +67,7 @@ (defmethod draw-path ((this flow-control)) (let ((a0-1 (-> this path))) (if (nonzero? a0-1) - (path-control-method-9 a0-1) + (debug-draw a0-1) ) ) 0 @@ -129,17 +129,14 @@ 0 (let ((f0-12 (/ f30-0 (- f30-0 f0-10)))) (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((t9-2 (method-of-object (-> this path) path-control-method-13))) - sv-208 - (+ (the float (if (= s4-0 (+ s2-0 -1)) - (+ s4-0 -1) - s4-0 - ) - ) - f0-12 - ) - (t9-2) - ) + (displacement-between-two-points-normalized! (-> this path) sv-208 (+ (the float (if (= s4-0 (+ s2-0 -1)) + (+ s4-0 -1) + s4-0 + ) + ) + f0-12 + ) + ) ) ) ) @@ -262,10 +259,7 @@ (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((t9-3 (method-of-object (-> this path) path-control-method-13))) - (+ (the float s3-1) f0-12) - (t9-3) - ) + (displacement-between-two-points-normalized! (-> this path) s1-1 (+ (the float s3-1) f0-12)) (let ((v1-17 (new 'stack-no-clear 'vector))) (vector-float*! v1-17 s1-1 (* (-> s2-0 speed) (seconds-per-frame))) (let ((a1-16 (new 'stack-no-clear 'vector))) diff --git a/goal_src/jak3/engine/debug/collision-editor.gc b/goal_src/jak3/engine/debug/collision-editor.gc index c32215bc43..2eb4593749 100644 --- a/goal_src/jak3/engine/debug/collision-editor.gc +++ b/goal_src/jak3/engine/debug/collision-editor.gc @@ -5,5 +5,945 @@ ;; name in dgo: collision-editor ;; dgos: GAME +;; +++collision-editor-func +(defenum collision-editor-func + :type uint64 + (analog 0) + (edit 1) + (print-collision 2) + (stop-editor 3) + ) +;; ---collision-editor-func + + ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +(defskelgroup skel-collision-editor sew-rove-plat sew-rove-plat-lod0-jg sew-rove-plat-idle-ja + ((sew-rove-plat-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 100) + ) + +(deftype collision-editor-default-proc (process-drawable) + () + (:state-methods + idle + ) + ) + + +(defstate idle (collision-editor-default-proc) + :virtual #t + :trans (behavior () + (deactivate self) + ) + :code sleep-code + ) + +(defbehavior collision-editor-default-proc-init-by-other collision-editor-default-proc () + (let ((gp-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere gp-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) + (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) 3) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 4096000.0) + (set! (-> gp-0 total-prims) (the-as uint 1)) + (set! (-> gp-0 root-prim) v1-2) + ) + (set! (-> gp-0 nav-radius) (* 0.75 (-> gp-0 root-prim local-sphere w))) + (let ((v1-5 (-> gp-0 root-prim))) + (set! (-> gp-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> gp-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> self root) gp-0) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-collision-editor" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (transform-post) + (go-virtual idle) + ) + +(deftype collision-editor-edited-proc (process-drawable) + () + (:state-methods + idle + ) + ) + + +(defstate idle (collision-editor-edited-proc) + :virtual #t + :code sleep-code + :post (behavior () + (transform-post) + ) + ) + +(defbehavior collision-editor-edited-proc-init-by-other collision-editor-edited-proc () + (let ((gp-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere gp-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) + (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) 3) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> gp-0 total-prims) (the-as uint 1)) + (set! (-> gp-0 root-prim) v1-2) + ) + (set! (-> gp-0 nav-radius) (* 0.75 (-> gp-0 root-prim local-sphere w))) + (let ((v1-5 (-> gp-0 root-prim))) + (set! (-> gp-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> gp-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> self root) gp-0) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-collision-editor" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (go-virtual idle) + ) + +(define *collision-editor-mesh-names* (new 'static 'boxed-array :type string "moveplat")) + +(define *collision-editor-art-group-name* "sew-rove-plat") + +(defun collision-editor-add-mesh-to-ccache ((arg0 collide-shape-prim-group) (arg1 collide-cache)) + (set! (-> arg1 collide-box4w min x) -409600000) + (set! (-> arg1 collide-box4w min y) -409600000) + (set! (-> arg1 collide-box4w min z) -409600000) + (set! (-> arg1 collide-box4w max x) #x186a0000) + (set! (-> arg1 collide-box4w max y) #x186a0000) + (set! (-> arg1 collide-box4w max z) #x186a0000) + (set! (-> arg1 num-tris) 0) + (set! (-> arg1 num-prims) 0) + (set! (-> arg1 collide-with) (the-as collide-spec -1)) + (set! (-> arg1 ignore-mask) (new 'static 'pat-surface)) + (add-fg-prim-using-box arg0 arg1) + (none) + ) + +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +(defun print-default-collision ((arg0 process-drawable)) + (local-vars (sv-224 matrix) (sv-240 symbol) (sv-256 string) (sv-272 float) (sv-288 float)) + (let ((gp-0 (process-spawn collision-editor-default-proc :name "collision-editor-default-proc"))) + (when gp-0 + (when (and (nonzero? (-> (the-as process-drawable (-> gp-0 0)) draw)) + (-> (the-as process-drawable (-> gp-0 0)) draw jgeo) + ) + (format #t "(group (#f~%") + (format #t " :action (solid)~%") + (format #t " :collide-as enemy~%") + (format #t " :collide-with (player-list hit-by-others-list jak bot)~%") + (format #t " :sphere ((meters 0.0) (meters 0.0) (meters 0.0) (meters 2.0))~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> (the-as process-drawable (-> gp-0 0)) node-list data 3 joint name) + ) + (format #t " :children (~%") + (let* ((t9-10 (method-of-type res-lump get-property-struct)) + (a0-11 (-> (the-as process-drawable (-> gp-0 0)) draw jgeo extra)) + (a1-10 'collide-mesh-group) + (a2-3 'interp) + (a3-3 -1000000000.0) + (t0-0 (the-as float #f)) + (s5-1 (the-as + (array collide-mesh) + (t9-10 a0-11 a1-10 a2-3 a3-3 (the-as structure t0-0) (the-as (pointer res-tag) #f) *res-static-buf*) + ) + ) + ) + (cond + ((and s5-1 (> (length s5-1) 0)) + (dotimes (s4-0 (length s5-1)) + (format + #t + " (mesh ((la-collide-mesh ~S ~S)~%" + *collision-editor-art-group-name* + (-> *collision-editor-mesh-names* s4-0) + ) + (format #t " :action solid~%") + (format #t " :collide-as enemy~%") + (format #t " :collide-with (player-list hit-by-others-list jak bot)~%") + (let ((v1-22 (-> s5-1 s4-0 joint-id))) + (cond + ((= v1-22 -1) + (format #t " ;;:transform-index JOINT_ID_NO_TRANSFORM~%") + ) + ((= v1-22 -2) + (format #t " ;;:transform-index JOINT_ID_ROOT_TRANSLATION~%") + ) + ((= v1-22 -3) + (format #t " ;;:transform-index JOINT_ID_ROOT_TRANSFORM~%") + ) + (else + (let ((t9-19 format) + (a0-23 #t) + (a1-18 " :transform-index (joint-node-index ~S ~S)~%") + (a2-5 *collision-editor-art-group-name*) + (a3-12 (-> (the-as process-drawable (-> gp-0 0)) node-list data (+ (-> s5-1 s4-0 joint-id) 1) joint name)) + ) + (t9-19 a0-23 a1-18 a2-5 a3-12) + (let ((s0-0 (new 'stack 'collide-shape-prim-mesh (the-as collide-shape 0) (the-as uint a3-12) (the-as uint t0-0)))) + (set! (-> s0-0 cshape) (the-as collide-shape (-> (the-as process-drawable (-> gp-0 0)) root))) + (set! (-> s0-0 transform-index) (+ (-> s5-1 s4-0 joint-id) 1)) + (set! (-> s0-0 prim-core prim-type) 1) + (set! (-> s0-0 local-sphere w) 1.0) + (set! (-> s0-0 mesh) (-> s5-1 s4-0)) + (set! (-> s0-0 mesh-cache-id) (the-as uint 0)) + (set! (-> s0-0 mesh-id) s4-0) + (collision-editor-add-mesh-to-ccache (the-as collide-shape-prim-group s0-0) *collide-cache*) + (let ((a0-26 (the-as object (-> *collide-cache* tris))) + (v1-41 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (when (nonzero? (-> *collide-cache* num-tris)) + (set! (-> v1-41 quad) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 quad)) + (set! (-> s2-0 quad) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 quad)) + ) + (countdown (a1-27 (-> *collide-cache* num-tris)) + (set! (-> v1-41 x) (fmin + (fmin + (fmin (-> v1-41 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + ) + ) + (set! (-> v1-41 y) (fmin + (fmin + (fmin (-> v1-41 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + ) + ) + (set! (-> v1-41 z) (fmin + (fmin + (fmin (-> v1-41 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + ) + ) + (set! (-> s2-0 x) (fmax + (fmax + (fmax (-> s2-0 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + ) + ) + (set! (-> s2-0 y) (fmax + (fmax + (fmax (-> s2-0 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + ) + ) + (set! (-> s2-0 z) (fmax + (fmax + (fmax (-> s2-0 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + ) + ) + (set! a0-26 (-> (the-as (inline-array collide-cache-tri) a0-26) 1)) + ) + (vector+! s3-0 v1-41 s2-0) + (vector-float*! s3-0 s3-0 0.5) + (vector<-cspace! s1-0 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index))) + (vector-! s1-0 s3-0 s1-0) + (set! sv-224 (new 'stack-no-clear 'matrix)) + (let* ((a0-35 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) + (a2-11 (-> a0-35 rvec quad)) + (a1-36 (-> a0-35 uvec quad)) + (v1-53 (-> a0-35 fvec quad)) + (a0-36 (-> a0-35 trans quad)) + ) + (set! (-> sv-224 rvec quad) a2-11) + (set! (-> sv-224 uvec quad) a1-36) + (set! (-> sv-224 fvec quad) v1-53) + (set! (-> sv-224 trans quad) a0-36) + ) + (vector-reset! (-> sv-224 trans)) + (matrix-transpose! sv-224 sv-224) + (vector-matrix*! s1-0 s1-0 sv-224) + (let ((s0-1 format)) + (set! sv-240 #t) + (set! sv-256 " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%") + (set! sv-272 (-> s1-0 x)) + (set! sv-288 (-> s1-0 y)) + (let ((s1-1 (-> s1-0 z)) + (t1-1 (* 1.0001 (vector-vector-distance s3-0 s2-0))) + ) + (set! t0-0 s1-1) + (s0-1 sv-240 sv-256 sv-272 sv-288 t0-0 t1-1) + ) + ) + ) + ) + ) + ) + ) + ) + (format #t " ))~%") + ) + #f + ) + (else + (format #t " (sphere (#f~%") + (format #t " :action solid~%") + (format #t " :collide-as enemy~%") + (format #t " :collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> (the-as process-drawable (-> gp-0 0)) node-list data 3 joint name) + ) + (format #t " :sphere ((meters 0.0) (meters 0.0) (meters 0.0) (meters 1.0))~%") + (format #t " ))~%") + ) + ) + ) + (format #t " )))~%") + ) + ) + (deactivate (-> gp-0 0)) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defun print-actual-collision ((arg0 process-drawable)) + (format #t "~%~%") + (when arg0 + (when (type? (-> arg0 root) collide-shape) + (let ((s5-0 (-> (the-as collide-shape (-> arg0 root)) root-prim)) + (s4-0 0) + ) + (let ((v1-3 (-> s5-0 prim-core prim-type))) + (cond + ((or (= v1-3 1) (= v1-3 -1)) + (set! s4-0 1) + ) + ((zero? v1-3) + (let ((s4-1 s5-0)) + (format #t "(group (#f~%") + (format #t " ;;:action (solid)~%") + (format #t " ;;:collide-as enemy~%") + (format #t " ;;:collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%" + (-> s5-0 local-sphere x) + (-> s5-0 local-sphere y) + (-> s5-0 local-sphere z) + (-> s5-0 local-sphere w) + ) + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> arg0 node-list data (-> s4-1 transform-index) joint name) + ) + (format #t " :children (~%") + (set! s4-0 (the-as int (-> s4-1 specific 1))) + ) + (&+! s5-0 80) + ) + ) + ) + (dotimes (s3-0 s4-0) + (case (-> s5-0 prim-core prim-type) + ((1) + (let ((v1-11 s5-0)) + (format + #t + " (mesh ((la-collide-mesh ~S ~S)~%" + *collision-editor-art-group-name* + (-> (the-as + (array string) + (+ (* (-> (the-as collide-shape-prim-mesh v1-11) mesh-id) 4) (the-as int *collision-editor-mesh-names*)) + ) + 0 + ) + ) + ) + (format #t " ;;:action solid~%") + (format #t " ;;:collide-as enemy~%") + (format #t " ;;:collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> arg0 node-list data (-> s5-0 transform-index) joint name) + ) + (format + #t + " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%" + (-> s5-0 local-sphere x) + (-> s5-0 local-sphere y) + (-> s5-0 local-sphere z) + (-> s5-0 local-sphere w) + ) + (format #t " ))~%") + ) + ((-1) + (format #t " (sphere (#f~%") + (format #t " ;;:action solid~%") + (format #t " ;;:collide-as enemy~%") + (format #t " ;;:collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> arg0 node-list data (-> s5-0 transform-index) joint name) + ) + (format + #t + " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%" + (-> s5-0 local-sphere x) + (-> s5-0 local-sphere y) + (-> s5-0 local-sphere z) + (-> s5-0 local-sphere w) + ) + (format #t " ))~%") + ) + ) + (&+! s5-0 80) + ) + ) + (if (zero? (-> (the-as collide-shape (-> arg0 root)) root-prim prim-core prim-type)) + (format #t " )))~%") + ) + ) + ) + (format #t "~%~%") + (none) + ) + +(deftype collision-editor (process) + ((proc handle) + ) + (:state-methods + idle + ) + ) + +(defmethod inspect ((this collision-editor)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Tproc: ~D~%" (-> this proc)) + (label cfg-4) + this + ) + +(deftype collision-edit-info (structure) + ((editing symbol) + (current-func collision-editor-func) + (analog-func collision-editor-func) + (current-prim int32) + ) + (:methods + (collision-edit-info-method-9 (_type_) none) + (draw-menu (_type_ process-drawable) none) + (collision-edit-info-method-11 (_type_ process-drawable) none) + ) + ) + +(defmethod inspect ((this collision-edit-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collision-edit-info) + (format #t "~1Tediting: ~A~%" (-> this editing)) + (format #t "~1Tcurrent-func: ~D~%" (-> this current-func)) + (format #t "~1Tanalog-func: ~D~%" (-> this analog-func)) + (format #t "~1Tcurrent-prim: ~D~%" (-> this current-prim)) + (label cfg-4) + this + ) + +(defun collision-edit-get-max-prim ((arg0 process-drawable)) + (let ((gp-0 0)) + (when (and arg0 (type? (-> arg0 root) collide-shape)) + (let ((v1-3 (-> (the-as collide-shape (-> arg0 root)) root-prim))) + (if (zero? (-> v1-3 prim-core prim-type)) + (set! gp-0 (the-as int (-> v1-3 specific 1))) + ) + ) + ) + gp-0 + ) + ) + +;; WARN: Return type mismatch int vs collide-shape-prim. +(defun collision-edit-get-prim ((arg0 process-drawable) (arg1 int)) + (when (and arg0 (type? (-> arg0 root) collide-shape)) + (let ((s5-0 (-> (the-as collide-shape (-> arg0 root)) root-prim)) + (v1-3 (collision-edit-get-max-prim arg0)) + ) + (if (and s5-0 (>= v1-3 arg1)) + (return (the-as collide-shape-prim (+ (the-as uint s5-0) (* 80 arg1)))) + ) + ) + ) + (the-as collide-shape-prim #f) + ) + +(defmethod collision-edit-info-method-9 ((this collision-edit-info)) + (if (cpad-pressed? 0 up) + (+! (-> this current-func) -1) + ) + (if (cpad-pressed? 0 left) + (+! (-> this current-func) -4) + ) + (if (cpad-pressed? 0 down) + (+! (-> this current-func) 1) + ) + (if (cpad-pressed? 0 right) + (+! (-> this current-func) 4) + ) + (cond + ((< (the-as int (-> this current-func)) 0) + (set! (-> this current-func) (collision-editor-func stop-editor)) + ) + ((>= (the-as int (-> this current-func)) 4) + (set! (-> this current-func) (collision-editor-func analog)) + 0 + ) + ) + (none) + ) + +(defmethod collision-edit-info-method-11 ((this collision-edit-info) (arg0 process-drawable)) + (local-vars (s5-0 int)) + (when (not arg0) + (set! s5-0 (the-as int #f)) + (goto cfg-14) + ) + (set! s5-0 (-> this current-prim)) + (let ((v1-2 (collision-edit-get-max-prim arg0))) + (when (cpad-pressed? 0 r1) + (+! s5-0 1) + (if (cpad-hold? 0 l1) + (+! s5-0 4) + ) + ) + (when (cpad-pressed? 0 l1) + (+! s5-0 -1) + (if (cpad-hold? 0 r1) + (+! s5-0 -4) + ) + ) + (if (< s5-0 0) + (set! s5-0 v1-2) + ) + (if (< v1-2 s5-0) + (set! s5-0 0) + ) + ) + (set! (-> this current-prim) s5-0) + (label cfg-14) + (none) + ) + +(defmethod draw-menu ((this collision-edit-info) (arg0 process-drawable)) + (local-vars (a3-0 string)) + (when (cpad-pressed? 0 l2) + (set! (-> this editing) (not (-> this editing))) + (cond + ((-> this editing) + (set! *external-cam-mode* 'locked) + ) + (*target* + (set! *external-cam-mode* #f) + ) + (else + (set! *external-cam-mode* 'pad-0) + ) + ) + ) + (cond + ((or (not (-> this editing)) (cpad-hold? 0 r2)) + (if (not (-> this editing)) + (format *stdcon* "press l2 to edit collision~%") + (format *stdcon* "release r2 to continue editing collision~%") + ) + (if (or (cpad-hold? 0 r2) (not *target*)) + (set! *external-cam-mode* 'pad-0) + ) + ) + (else + (set! *external-cam-mode* 'locked) + (collision-edit-info-method-9 this) + (collision-edit-info-method-11 this arg0) + (let ((s3-0 ">") + (s4-0 " ") + ) + (if (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (set! s3-0 " ") + ) + (format *stdcon* " r2/l2: move camera~%") + (let ((s2-0 (-> this current-prim))) + "??" + (let ((v1-38 (collision-edit-get-prim arg0 0))) + (when v1-38 + (if (zero? (-> v1-38 prim-core prim-type)) + (+! s2-0 -1) + ) + ) + ) + (cond + ((= s2-0 -1) + (set! a3-0 "*group*") + ) + ((= (-> (collision-edit-get-prim arg0 s2-0) prim-core prim-type) 1) + (set! a3-0 (-> *collision-editor-mesh-names* s2-0)) + ) + (else + (set! a3-0 "*sphere*") + ) + ) + ) + (format *stdcon* " r1/l1: select prim ~D ~S~%" (-> this current-prim) a3-0) + (format *stdcon* " dpad: select function~%") + (format *stdcon* " x, tri: toggle/call~%") + (format *stdcon* "------------------------~%") + (format + *stdcon* + " ~S analog: ~S~%" + (if (= (-> this current-func) (collision-editor-func analog)) + s3-0 + s4-0 + ) + (if (= (-> this analog-func) (collision-editor-func analog)) + "adjust sphere" + "???" + ) + ) + (let ((v1-50 (collision-edit-get-prim arg0 (-> this current-prim))) + (a3-2 (the-as basic "??")) + ) + (if (zero? (-> v1-50 transform-index)) + (set! a3-2 "*root*") + ) + (if (and v1-50 + (< (-> v1-50 transform-index) (-> arg0 node-list length)) + (-> arg0 node-list data (-> v1-50 transform-index) joint) + ) + (set! a3-2 (-> arg0 node-list data (-> v1-50 transform-index) joint name)) + ) + (format + *stdcon* + " ~S change sphere joint ~S~%" + (if (= (-> this current-func) (collision-editor-func edit)) + s3-0 + s4-0 + ) + a3-2 + ) + ) + (format + *stdcon* + " ~S print to listener~%" + (if (= (-> this current-func) (collision-editor-func print-collision)) + s3-0 + s4-0 + ) + ) + (format *stdcon* " ~S quit~%" (cond + ((= (-> this current-func) (collision-editor-func stop-editor)) + (empty) + s3-0 + ) + (else + s4-0 + ) + ) + ) + ) + (let ((s4-1 0)) + (if (cpad-pressed? 0 x) + (+! s4-1 1) + ) + (if (cpad-pressed? 0 triangle) + (+! s4-1 -1) + ) + (when (nonzero? s4-1) + (case (-> this current-func) + (((collision-editor-func analog)) + (+! (-> this analog-func) s4-1) + ) + (((collision-editor-func edit)) + (let ((v1-75 (collision-edit-get-prim arg0 (-> this current-prim)))) + (when (and v1-75 (!= (-> v1-75 prim-core prim-type) 1)) + (let* ((a0-41 (-> v1-75 transform-index)) + (a1-25 (+ (-> arg0 node-list length) -1)) + (a0-42 (+ a0-41 s4-1)) + ) + (if (< a0-42 0) + (set! a0-42 a1-25) + ) + (while (or (= a0-42 1) (= a0-42 2)) + (+! a0-42 s4-1) + ) + (if (< a1-25 a0-42) + (set! a0-42 0) + ) + (set! (-> v1-75 transform-index) a0-42) + ) + ) + ) + ) + (((collision-editor-func print-collision)) + (print-actual-collision arg0) + ) + (((collision-editor-func stop-editor)) + (kill-by-type collision-editor-edited-proc *active-pool*) + (kill-by-type collision-editor *active-pool*) + ) + (else + (format 0 "~%ERROR: bad collision-edit-func~%") + ) + ) + ) + ) + (cond + ((< (the-as int (-> this analog-func)) 0) + (set! (-> this analog-func) (collision-editor-func analog)) + 0 + ) + ((>= (the-as int (-> this analog-func)) 1) + (set! (-> this analog-func) (collision-editor-func analog)) + 0 + ) + ) + (when arg0 + (let ((f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0)) + (f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 1.0)) + (f24-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 1.0)) + ) + (when (or (!= f30-0 0.0) (!= f28-0 0.0) (!= f26-0 0.0) (!= f24-0 0.0)) + (when (= (-> this analog-func) (collision-editor-func analog)) + (set! f30-0 (* -409.6 f30-0)) + (set! f28-0 (* -409.6 f28-0)) + (let ((f0-8 (+ (* 0.01 f24-0) (* -0.01 f26-0)))) + (set! f24-0 (+ 1.0 f0-8)) + ) + (set! f26-0 0.0) + ) + (when (= (-> this analog-func) (collision-editor-func analog)) + (let ((s4-2 (collision-edit-get-prim arg0 (-> this current-prim)))) + (when s4-2 + (set! (-> s4-2 local-sphere w) (* (-> s4-2 local-sphere w) f24-0)) + (let ((s3-1 (new 'stack-no-clear 'matrix))) + (let* ((a2-17 (matrix-local->world #f #f)) + (v1-107 (-> a2-17 rvec quad)) + (a0-58 (-> a2-17 uvec quad)) + (a1-37 (-> a2-17 fvec quad)) + (a2-18 (-> a2-17 trans quad)) + ) + (set! (-> s3-1 rvec quad) v1-107) + (set! (-> s3-1 uvec quad) a0-58) + (set! (-> s3-1 fvec quad) a1-37) + (set! (-> s3-1 trans quad) a2-18) + ) + (let ((s2-1 (new 'stack-no-clear 'matrix))) + (let* ((a2-19 (-> arg0 node-list data (-> s4-2 transform-index) bone transform)) + (v1-111 (-> a2-19 rvec quad)) + (a0-61 (-> a2-19 uvec quad)) + (a1-38 (-> a2-19 fvec quad)) + (a2-20 (-> a2-19 trans quad)) + ) + (set! (-> s2-1 rvec quad) v1-111) + (set! (-> s2-1 uvec quad) a0-61) + (set! (-> s2-1 fvec quad) a1-38) + (set! (-> s2-1 trans quad) a2-20) + ) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 x) f30-0) + (set! (-> s1-1 y) f28-0) + (set! (-> s1-1 z) f26-0) + (set! (-> s1-1 w) 1.0) + (vector-reset! (-> s3-1 trans)) + (vector-matrix*! s1-1 s1-1 s3-1) + (vector-reset! (-> s2-1 trans)) + (matrix-transpose! s2-1 s2-1) + (vector-matrix*! s1-1 s1-1 s2-1) + (+! (-> s4-2 local-sphere x) (-> s1-1 x)) + (+! (-> s4-2 local-sphere y) (-> s1-1 y)) + (+! (-> s4-2 local-sphere z) (-> s1-1 z)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s5-1 (collision-edit-get-prim arg0 (-> this current-prim)))) + (cond + (s5-1 + (show-maya-skeleton arg0 (-> s5-1 transform-index) #x45800000) + (let ((gp-1 (shl #x80ff 16))) + (let ((v1-117 (-> s5-1 prim-core prim-type))) + (cond + ((= v1-117 1) + (collision-editor-add-mesh-to-ccache (the-as collide-shape-prim-group s5-1) *collide-cache*) + (debug-draw *collide-cache*) + (let ((s4-3 (the-as object (-> *collide-cache* tris)))) + (countdown (s3-2 (-> *collide-cache* num-tris)) + (when (< (-> s5-1 prim-core world-sphere w) + (vector-vector-distance + (the-as vector (-> s5-1 prim-core)) + (the-as vector (-> (the-as collide-cache-tri s4-3) vertex)) + ) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-tri s4-3) vertex)) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (set! gp-1 (the-as int (the-as uint #x800000ff))) + ) + (when (< (-> s5-1 prim-core world-sphere w) + (vector-vector-distance (the-as vector (-> s5-1 prim-core)) (-> (the-as collide-cache-tri s4-3) vertex 1)) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (-> (the-as collide-cache-tri s4-3) vertex 1) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (set! gp-1 (the-as int (the-as uint #x800000ff))) + ) + (when (< (-> s5-1 prim-core world-sphere w) + (vector-vector-distance (the-as vector (-> s5-1 prim-core)) (-> (the-as collide-cache-tri s4-3) vertex 2)) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (-> (the-as collide-cache-tri s4-3) vertex 2) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (set! gp-1 (the-as int (the-as uint #x800000ff))) + ) + (set! s4-3 (&+ (the-as collide-cache-tri s4-3) 64)) + ) + ) + ) + ((= v1-117 -1) + ) + ((zero? v1-117) + ) + ) + ) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s5-1 prim-core)) + (-> s5-1 prim-core world-sphere w) + (the-as rgba gp-1) + ) + ) + ) + (else + (show-maya-skeleton arg0 1000 #x45800000) + ) + ) + ) + 0 + (none) + ) + +(define *collision-edit-info* (the-as collision-edit-info 0)) + +(define *collision-edit-info* + (new 'static 'collision-edit-info :editing #t :current-func (collision-editor-func print-collision)) + ) + +(defstate idle (collision-editor) + :virtual #t + :exit (behavior () + (set! *external-cam-mode* #f) + ) + :trans (behavior () + (let ((gp-0 *collision-edit-info*) + (s5-0 (method-of-type collision-edit-info draw-menu)) + (s4-0 (handle->process (-> self proc))) + ) + (s5-0 gp-0 (the-as process-drawable (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + ) + ) + :code sleep-code + ) + +(defbehavior collision-editor-init-by-other collision-editor ((arg0 handle)) + (set! (-> self proc) arg0) + (go-virtual idle) + ) + +(defun stop-collision-edit () + (kill-by-type collision-editor-edited-proc *active-pool*) + (kill-by-type collision-editor *active-pool*) + 0 + (none) + ) + +(defun collision-edit ((arg0 process)) + (stop-collision-edit) + (when (not arg0) + (let ((v1-2 (process-spawn collision-editor-edited-proc :name "collision-editor-edited-proc"))) + (set! arg0 (if v1-2 + (the-as process (-> v1-2 0 self)) + ) + ) + ) + ) + (let ((gp-2 (process->handle (the-as process-tree arg0)))) + (process-spawn collision-editor gp-2 :name "collision-editor") + ) + ) diff --git a/goal_src/jak3/engine/draw/drawable.gc b/goal_src/jak3/engine/draw/drawable.gc index dfe68875c1..7c9fd47828 100644 --- a/goal_src/jak3/engine/draw/drawable.gc +++ b/goal_src/jak3/engine/draw/drawable.gc @@ -1895,7 +1895,7 @@ (update-warp-and-hud *texture-pool*) ) (-> arg0 frames (-> arg0 on-screen) global-buf) - ;; (update-eyes) TODO + (update-eyes) ) (when *debug-segment* (with-profiler 'debug *profile-debug-color* diff --git a/goal_src/jak3/engine/entity/entity.gc b/goal_src/jak3/engine/entity/entity.gc index 4ba0e9fc77..b8e475b471 100644 --- a/goal_src/jak3/engine/entity/entity.gc +++ b/goal_src/jak3/engine/entity/entity.gc @@ -1107,7 +1107,7 @@ ) ) (if (nonzero? (-> (the-as process-drawable arg0) path)) - (path-control-method-9 (-> (the-as process-drawable arg0) path)) + (debug-draw (-> (the-as process-drawable arg0) path)) ) (if (nonzero? (-> (the-as process-drawable arg0) vol)) (debug-draw (-> (the-as process-drawable arg0) vol)) @@ -1482,7 +1482,7 @@ *active-pool* (lambda ((arg0 process)) (when (type? arg0 process-drawable) (if (nonzero? (-> (the-as process-drawable arg0) path)) - (path-control-method-9 (-> (the-as process-drawable arg0) path)) + (debug-draw (-> (the-as process-drawable arg0) path)) ) (if (nonzero? (-> (the-as process-drawable arg0) vol)) (debug-draw (-> (the-as process-drawable arg0) vol)) diff --git a/goal_src/jak3/engine/game/main.gc b/goal_src/jak3/engine/game/main.gc index c52157dc55..a26fc19177 100644 --- a/goal_src/jak3/engine/game/main.gc +++ b/goal_src/jak3/engine/game/main.gc @@ -1526,9 +1526,9 @@ ) ; ;; generate DMA to copy from render buffer to frame buffer. - ; (with-profiler 'blit-displays *profile-blit-color* - ; (blit-displays-work-method-19 *blit-displays-work*) - ; ) + (with-profiler 'blit-displays *profile-blit-color* + (blit-displays-work-method-19 *blit-displays-work*) + ) ;; wrap up this frame (drawing of stdcon, debugging, etc.) (end-display arg0) diff --git a/goal_src/jak3/engine/geometry/path-h.gc b/goal_src/jak3/engine/geometry/path-h.gc index cf79511bd6..dc26946d37 100644 --- a/goal_src/jak3/engine/geometry/path-h.gc +++ b/goal_src/jak3/engine/geometry/path-h.gc @@ -32,29 +32,29 @@ These path-controls are typically allocated on a process heap." ) (:methods (new (symbol type process symbol float entity symbol) _type_) - (path-control-method-9 (_type_) none) + (debug-draw (_type_) none) (get-point-in-path! (_type_ vector float symbol) vector) - (path-control-method-11 () none) - (path-control-method-12 () none) - (path-control-method-13 () none) + (get-random-point (_type_ vector) vector) + (path-control-method-12 (_type_ vector float float) vector) + (displacement-between-two-points-normalized! (_type_ vector float) vector) (get-point-at-percent-along-path! (_type_ vector float symbol) vector) - (path-control-method-15 () none) + (path-control-method-15 (_type_ vector float float) vector) (displacement-between-points-at-percent-normalized! (_type_ vector float) vector) (get-num-segments (_type_) float) (total-distance (_type_) float) (get-num-verts (_type_) int) (segement-duration->path-duration (_type_ float) float) (path-duration->segment-duration (_type_ float) float) - (path-control-method-22 () none) - (path-control-method-23 () none) - (path-control-method-24 () none) + (path-control-method-22 (_type_ vector) float) + (path-control-method-23 (_type_ vector) float) + (path-control-method-24 (_type_ vector) float) (path-control-method-25 (_type_ vector) float) - (path-control-method-26 () none) - (path-control-method-27 () none) - (path-control-method-28 () none) - (path-control-method-29 () none) + (path-control-method-26 (_type_ float float) float) + (path-control-method-27 (_type_ vector) vector) + (path-control-method-28 (_type_ vector float float) float) + (path-control-method-29 (_type_ vector int float) float) (should-display-marks? (_type_) symbol) - (path-control-method-31 () none) + (displacement-between-two-points! (_type_ vector float float) vector) ) ) diff --git a/goal_src/jak3/engine/geometry/path.gc b/goal_src/jak3/engine/geometry/path.gc index c2694f056e..fcc8077279 100644 --- a/goal_src/jak3/engine/geometry/path.gc +++ b/goal_src/jak3/engine/geometry/path.gc @@ -7,10 +7,570 @@ ;; DECOMP BEGINS -(defmethod path-control-method-25 ((this path-control) (arg0 vector)) - 0.0 +(defmethod debug-draw ((this path-control)) + (cond + ((logtest? (-> this flags) (path-control-flag not-found)) + (when (and (type? (-> this process) process-drawable) *display-entity-errors* (not *display-capture-mode*)) + (let ((s5-0 add-debug-text-3d) + (s4-0 #t) + (s3-0 577) + ) + (format (clear *temp-string*) "path data error in ~S" (-> this process name)) + (s5-0 + s4-0 + (the-as bucket-id s3-0) + *temp-string* + (-> this process root trans) + (font-color red) + (the-as vector2h #f) + ) + ) + ) + ) + ((let ((a0-5 this)) + (and *display-path-marks* (logtest? (-> a0-5 flags) (path-control-flag display))) + ) + (dotimes (s5-1 (-> this curve num-cverts)) + (let ((s4-1 (-> this curve cverts s5-1))) + (if (and (logtest? (-> this flags) (path-control-flag draw-line)) (< s5-1 (+ (-> this curve num-cverts) -1))) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + s4-1 + (-> this curve cverts (+ s5-1 1)) + (new 'static 'rgba :r #xff :g #x80 :a #x80) + #f + (the-as rgba -1) + ) + ) + (if (logtest? (-> this flags) (path-control-flag draw-point)) + (add-debug-x #t (bucket-id debug-no-zbuf1) s4-1 (new 'static 'rgba :r #xff :a #x80)) + ) + (when (logtest? (-> this flags) (path-control-flag draw-text)) + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-0 577) + ) + (format (clear *temp-string*) "~D" s5-1) + (s3-1 s2-1 (the-as bucket-id s1-0) *temp-string* s4-1 (font-color orange) (the-as vector2h #f)) + ) + ) + ) + ) + ) + ) + 0 + (none) ) -(defmethod get-point-at-percent-along-path! ((this path-control) (ret vector) (percent float) (search-type symbol)) - (static-vectorm 0 0 0) - ) \ No newline at end of file +(defmethod total-distance ((this path-control)) + (let ((f30-0 (-> this curve length))) + (when (= f30-0 0.0) + (dotimes (s5-0 (+ (-> this curve num-cverts) -1)) + (+! f30-0 (vector-vector-distance (-> this curve cverts s5-0) (-> this curve cverts (+ s5-0 1)))) + ) + (set! (-> this curve length) f30-0) + ) + f30-0 + ) + ) + +(defmethod total-distance ((this curve-control)) + (let ((f0-0 (-> this curve length))) + (when (= f0-0 0.0) + (set! f0-0 (curve-length (-> this curve))) + (set! (-> this curve length) f0-0) + ) + f0-0 + ) + ) + +(defmethod path-control-method-26 ((this path-control) (arg0 float) (arg1 float)) + (local-vars (v1-9 float)) + (let ((f30-0 (* arg0 (the float (+ (-> this curve num-cverts) -1)))) + (f28-0 (if (< 0.0 arg1) + 1.0 + -1.0 + ) + ) + (f26-0 (fabs arg1)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (get-point-in-path! this s5-0 f30-0 'interp) + 0.0 + (while (< 0.0 f26-0) + (let ((f24-0 (the float (the int (+ f28-0 f30-0))))) + (set! f30-0 (cond + ((or (< f24-0 0.0) (>= f24-0 (the float (-> this curve num-cverts)))) + (set! v1-9 f24-0) + (goto cfg-19) + f30-0 + ) + (else + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> this curve cverts (the int (the float (the int f24-0))) quad)) + 0.0 + (let ((f0-16 (vector-vector-distance s5-0 s4-0))) + (cond + ((< f0-16 f26-0) + (set! f26-0 (- f26-0 f0-16)) + (set! (-> s5-0 quad) (-> s4-0 quad)) + f24-0 + ) + (else + (let ((f0-17 (/ f26-0 f0-16))) + (set! v1-9 (lerp f30-0 f24-0 f0-17)) + ) + (goto cfg-19) + f30-0 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! v1-9 (the-as float #f)) + (label cfg-19) + (let* ((f0-21 (/ v1-9 (the float (+ (-> this curve num-cverts) -1)))) + (f0-22 (fmin 1.0 f0-21)) + ) + (fmax 0.0 f0-22) + ) + ) + +(defmethod get-point-in-path! ((this path-control) (arg0 vector) (arg1 float) (arg2 symbol)) + (let ((a1-1 (-> this curve num-cverts)) + (f0-3 (the float (the int arg1))) + ) + (cond + ((< arg1 0.0) + (set! (-> arg0 quad) (-> this curve cverts 0 quad)) + ) + ((>= f0-3 (the float (+ a1-1 -1))) + (set! (-> arg0 quad) (-> this curve cverts (+ a1-1 -1) quad)) + ) + ((or (= arg2 'exact) (= f0-3 arg1)) + (set! (-> arg0 quad) (-> this curve cverts (the int f0-3) quad)) + ) + (else + (vector-lerp! + arg0 + (-> this curve cverts (the int f0-3)) + (-> this curve cverts (the int (+ 1.0 f0-3))) + (- arg1 f0-3) + ) + ) + ) + ) + arg0 + ) + +(defmethod get-random-point ((this path-control) (arg0 vector)) + (with-pp + (cond + ((> (-> this curve num-cverts) 0) + (let ((a0-2 (rand-vu-int-count (-> this curve num-cverts)))) + (set! (-> arg0 quad) (-> this curve cverts a0-2 quad)) + ) + ) + (else + (format #t "WARNING: method get-random-point called on a path-control object with no vertices.~%") + (if pp + (format #t "current process is ~A~%" (-> pp name)) + ) + (set! (-> arg0 quad) (-> *null-vector* quad)) + ) + ) + arg0 + ) + ) + +(defmethod get-point-at-percent-along-path! ((this path-control) (arg0 vector) (arg1 float) (arg2 symbol)) + (get-point-in-path! this arg0 (* arg1 (the float (+ (-> this curve num-cverts) -1))) arg2) + ) + +(defmethod get-point-at-percent-along-path! ((this curve-control) (arg0 vector) (arg1 float) (arg2 symbol)) + (if (not (logtest? (-> this flags) (path-control-flag not-found))) + (curve-evaluate! + arg0 + arg1 + (-> this curve cverts) + (-> this curve num-cverts) + (-> this curve knots) + (-> this curve num-knots) + ) + ) + arg0 + ) + +(defmethod get-point-in-path! ((this curve-control) (arg0 vector) (arg1 float) (arg2 symbol)) + (if (not (logtest? (-> this flags) (path-control-flag not-found))) + (curve-evaluate! + arg0 + (/ arg1 (the float (+ (-> this curve num-cverts) -1))) + (-> this curve cverts) + (-> this curve num-cverts) + (-> this curve knots) + (-> this curve num-knots) + ) + ) + arg0 + ) + +(defmethod displacement-between-two-points! ((this path-control) (arg0 vector) (arg1 float) (arg2 float)) + (let ((v1-0 (-> this curve num-cverts)) + (f0-3 (the float (the int arg1))) + ) + (cond + ((or (logtest? (-> this flags) (path-control-flag not-found)) (< v1-0 2) (< arg1 0.0)) + (vector-reset! arg0) + ) + (else + (let ((f0-4 (fmin f0-3 (the float (+ v1-0 -2))))) + (vector-! arg0 (-> this curve cverts (the int (+ 1.0 f0-4))) (-> this curve cverts (the int f0-4))) + ) + (vector-float*! arg0 arg0 arg2) + ) + ) + ) + arg0 + ) + +(defmethod path-control-method-12 ((this path-control) (arg0 vector) (arg1 float) (arg2 float)) + (displacement-between-two-points! this arg0 arg1 arg2) + ) + +(defmethod path-control-method-15 ((this path-control) (arg0 vector) (arg1 float) (arg2 float)) + (path-control-method-12 + this + arg0 + (* arg1 (the float (+ (-> this curve num-cverts) -1))) + (* arg2 (the float (+ (-> this curve num-cverts) -1))) + ) + ) + +(defmethod displacement-between-two-points-normalized! ((this path-control) (arg0 vector) (arg1 float)) + (displacement-between-two-points! this arg0 arg1 1.0) + (vector-normalize! arg0 1.0) + ) + +(defmethod displacement-between-points-at-percent-normalized! ((this path-control) (arg0 vector) (arg1 float)) + (displacement-between-two-points-normalized! this arg0 (* arg1 (the float (+ (-> this curve num-cverts) -1)))) + ) + +(defmethod displacement-between-two-points! ((this curve-control) (arg0 vector) (arg1 float) (arg2 float)) + (when (not (logtest? (-> this flags) (path-control-flag not-found))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (curve-evaluate! + arg0 + arg1 + (-> this curve cverts) + (-> this curve num-cverts) + (-> this curve knots) + (-> this curve num-knots) + ) + (cond + ((< arg1 (- 1.0 arg2)) + (curve-evaluate! + s4-0 + (+ arg1 arg2) + (-> this curve cverts) + (-> this curve num-cverts) + (-> this curve knots) + (-> this curve num-knots) + ) + (vector-! arg0 s4-0 arg0) + ) + (else + (curve-evaluate! + s4-0 + (- arg1 arg2) + (-> this curve cverts) + (-> this curve num-cverts) + (-> this curve knots) + (-> this curve num-knots) + ) + (vector-! arg0 arg0 s4-0) + ) + ) + ) + ) + ) + +(defmethod path-control-method-26 ((this curve-control) (arg0 float) (arg1 float)) + (let* ((f30-0 0.0001) + (v1-2 (displacement-between-two-points! this (new 'stack-no-clear 'vector) arg0 f30-0)) + ) + 0.0 + 0.0 + (let* ((f0-3 (/ f30-0 (vector-length v1-2))) + (v1-4 (+ arg0 (* f0-3 arg1))) + ) + (fmax 0.0 (fmin 1.0 v1-4)) + ) + ) + ) + +(defmethod path-control-method-12 ((this curve-control) (arg0 vector) (arg1 float) (arg2 float)) + (displacement-between-two-points! this arg0 (/ arg1 (the float (+ (-> this curve num-cverts) -1))) arg2) + ) + +(defmethod path-control-method-15 ((this curve-control) (arg0 vector) (arg1 float) (arg2 float)) + (displacement-between-two-points! this arg0 arg1 arg2) + ) + +(defmethod displacement-between-points-at-percent-normalized! ((this curve-control) (arg0 vector) (arg1 float)) + (displacement-between-two-points! this arg0 arg1 0.01) + (vector-normalize! arg0 1.0) + ) + +(defmethod displacement-between-two-points-normalized! ((this curve-control) (arg0 vector) (arg1 float)) + (displacement-between-points-at-percent-normalized! + this + arg0 + (/ arg1 (the float (+ (-> this curve num-cverts) -1))) + ) + ) + +(defmethod path-control-method-28 ((this path-control) (arg0 vector) (arg1 float) (arg2 float)) + (local-vars + (sv-96 vector) + (sv-100 vector) + (sv-104 vector) + (sv-108 vector) + (sv-112 number) + (sv-116 vector) + (sv-120 symbol) + (sv-124 float) + ) + (set! sv-96 (new 'stack-no-clear 'vector)) + (set! sv-100 (new 'stack-no-clear 'vector)) + (set! sv-104 (new 'stack-no-clear 'vector)) + (set! sv-108 (new 'stack-no-clear 'vector)) + (set! sv-112 -1.0) + (set! sv-116 (new 'stack-no-clear 'vector)) + (set! sv-120 (the-as symbol #f)) + (set! sv-124 (the-as float -1.0)) + (get-point-in-path! this sv-96 0.0 'interp) + ;; og:preserve-this + (set! sv-112 (the-as float #x7f800000)) + (when (not arg2) + (set! sv-124 (path-control-method-22 this arg0)) + (get-point-in-path! this sv-108 sv-124 'interp) + (set! sv-112 (vector-vector-distance-squared sv-108 arg0)) + ) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (vector+! s3-1 arg0 (the-as vector arg1)) + (dotimes (s2-0 (+ (-> this curve num-cverts) -1)) + (get-point-in-path! this sv-100 (the float (+ s2-0 1)) 'interp) + (vector-! sv-104 sv-100 sv-96) + (let ((s0-0 #f)) + 0.0 + (let ((s1-0 (new 'stack-no-clear 'vector))) + (set! (-> s1-0 x) -1.0) + (set! (-> s1-0 y) -1.0) + (line-line-find-intersection-xz arg0 (the-as vector arg1) sv-96 sv-104 s1-0) + (when (>= (-> s1-0 x) 0.0) + (if (and (< 0.0 (-> s1-0 y)) (>= 1.0 (-> s1-0 y))) + (set! s0-0 #t) + ) + (vector+float*! sv-116 arg0 (the-as vector arg1) (-> s1-0 x)) + (cond + ((and s0-0 (not sv-120)) + (set! (-> sv-108 quad) (-> sv-116 quad)) + (set! sv-112 (vector-vector-distance-squared sv-116 arg0)) + (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) + (set! sv-120 #t) + ) + ((and s0-0 sv-120) + (let ((f0-22 (vector-vector-distance-squared sv-116 arg0))) + (when (< f0-22 (the-as float sv-112)) + (set! (-> sv-108 quad) (-> sv-116 quad)) + (set! sv-112 f0-22) + (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) + ) + ) + ) + ((not (or s0-0 sv-120)) + (let ((s0-1 (new 'stack-no-clear 'vector)) + (a3-5 (new 'stack-no-clear 'vector)) + ) + (set! (-> s1-0 y) (fmax 0.0 (fmin 1.0 (-> s1-0 y)))) + (vector+float*! s0-1 sv-96 sv-104 (-> s1-0 y)) + (let* ((f0-32 (vector-segment-distance-point! s0-1 arg0 s3-1 a3-5)) + (f0-33 (* f0-32 f0-32)) + ) + (when (< f0-33 (the-as float sv-112)) + (set! (-> sv-108 quad) (-> s0-1 quad)) + (set! sv-112 f0-33) + (set! sv-124 (lerp (the float s2-0) (the float (+ s2-0 1)) (-> s1-0 y))) + ) + ) + ) + ) + ) + ) + ) + ) + (set! (-> sv-96 quad) (-> sv-100 quad)) + ) + ) + (set! sv-124 (/ sv-124 (the float (+ (-> this curve num-cverts) -1)))) + sv-124 + ) + +(defmethod path-control-method-29 ((this path-control) (arg0 vector) (arg1 int) (arg2 float)) + (let ((s2-0 (get-point-in-path! this (new 'stack-no-clear 'vector) (the float arg1) 'interp)) + (a2-3 (get-point-in-path! this (new 'stack-no-clear 'vector) (the float (+ arg1 1)) 'interp)) + ) + (vector-segment-distance-point! arg0 s2-0 a2-3 (the-as vector arg2)) + ) + ) + +(defmethod path-control-method-22 ((this path-control) (arg0 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (f30-0 4096000000.0) + (f28-0 0.0) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 quad) (-> arg0 quad)) + (set! (-> s3-0 y) 0.0) + (get-point-in-path! this s4-0 0.0 'interp) + (set! (-> s4-0 y) 0.0) + (dotimes (s1-0 (+ (-> this curve num-cverts) -1)) + (set! (-> s5-0 quad) (-> s4-0 quad)) + (get-point-in-path! this s4-0 (the float (+ s1-0 1)) 'interp) + (set! (-> s4-0 y) 0.0) + (let ((f0-5 (vector-segment-distance-point! s3-0 s5-0 s4-0 s2-0))) + (when (< f0-5 f30-0) + (set! f30-0 f0-5) + (set! f28-0 + (+ (/ (vector-vector-xz-distance s2-0 s5-0) (vector-vector-xz-distance s4-0 s5-0)) (the float s1-0)) + ) + ) + ) + ) + ) + f28-0 + ) + ) + +(defmethod path-control-method-24 ((this path-control) (arg0 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (f30-0 4096000000.0) + (f28-0 0.0) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 quad) (-> arg0 quad)) + (get-point-in-path! this s4-0 0.0 'interp) + (dotimes (s1-0 (+ (-> this curve num-cverts) -1)) + (set! (-> s5-0 quad) (-> s4-0 quad)) + (get-point-in-path! this s4-0 (the float (+ s1-0 1)) 'interp) + (let ((f0-2 (vector-segment-distance-point! s3-0 s5-0 s4-0 s2-0))) + (when (< f0-2 f30-0) + (set! f30-0 f0-2) + (set! f28-0 (+ (/ (vector-vector-distance s2-0 s5-0) (vector-vector-distance s4-0 s5-0)) (the float s1-0))) + ) + ) + ) + ) + f28-0 + ) + ) + +(defmethod path-control-method-25 ((this path-control) (arg0 vector)) + (/ (path-control-method-24 this arg0) (the float (+ (-> this curve num-cverts) -1))) + ) + +(defmethod path-control-method-23 ((this path-control) (arg0 vector)) + (/ (path-control-method-22 this arg0) (the float (+ (-> this curve num-cverts) -1))) + ) + +(defmethod debug-draw ((this curve-control)) + (cond + ((logtest? (-> this flags) (path-control-flag not-found)) + (when (and (type? (-> this process) process-drawable) *display-entity-errors* (not *display-capture-mode*)) + (let ((s5-0 add-debug-text-3d) + (s4-0 #t) + (s3-0 577) + ) + (format (clear *temp-string*) "curve data error in ~S" (-> this process name)) + (s5-0 + s4-0 + (the-as bucket-id s3-0) + *temp-string* + (-> this process root trans) + (font-color red) + (the-as vector2h #f) + ) + ) + ) + ) + ((let ((a0-5 this)) + (and *display-path-marks* (logtest? (-> a0-5 flags) (path-control-flag display))) + ) + (if (and (logtest? (-> this flags) (path-control-flag draw-line)) (> (-> this curve num-cverts) 0)) + (add-debug-curve2 + #t + (bucket-id debug-no-zbuf1) + (-> this curve) + (new 'static 'rgba :r #xff :g #x80 :a #x80) + #f + ) + ) + (dotimes (s5-1 (-> this curve num-cverts)) + (let ((s4-1 (-> this curve cverts s5-1))) + (if (logtest? (-> this flags) (path-control-flag draw-point)) + (add-debug-x #t (bucket-id debug-no-zbuf1) s4-1 (new 'static 'rgba :r #xff :a #x80)) + ) + (when (logtest? (-> this flags) (path-control-flag draw-text)) + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-0 577) + ) + (format (clear *temp-string*) "~D" s5-1) + (s3-1 s2-1 (the-as bucket-id s1-0) *temp-string* s4-1 (font-color orange) (the-as vector2h #f)) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod path-control-method-27 ((this path-control) (arg0 vector)) + (let ((s4-0 (-> this curve num-cverts))) + (let ((f30-0 (/ 1.0 (the float s4-0)))) + (set-vector! arg0 0.0 0.0 0.0 0.0) + (dotimes (s3-0 s4-0) + (vector+float*! + arg0 + arg0 + (get-point-in-path! this (new 'stack-no-clear 'vector) (the float s3-0) 'interp) + f30-0 + ) + ) + ) + (dotimes (s3-1 s4-0) + (let ((f0-10 + (vector-vector-distance arg0 (get-point-in-path! this (new 'stack-no-clear 'vector) (the float s3-1) 'interp)) + ) + ) + (if (< (-> arg0 w) f0-10) + (set! (-> arg0 w) (+ 4096.0 f0-10)) + ) + ) + ) + ) + arg0 + ) diff --git a/goal_src/jak3/engine/gfx/foreground/eye.gc b/goal_src/jak3/engine/gfx/foreground/eye.gc index 3cffcb83d0..7c8458ec31 100644 --- a/goal_src/jak3/engine/gfx/foreground/eye.gc +++ b/goal_src/jak3/engine/gfx/foreground/eye.gc @@ -7,3 +7,1027 @@ ;; DECOMP BEGINS +(define *eye-work* (new 'static 'eye-work + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x508b400000008001 #x53531) + ) + :sprite-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x53531) + ) + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :blink-table (new 'static 'array float 10 0.0 0.667 0.9 1.0 1.0 1.0 1.0 0.333 0.1 0.0) + ) + ) + +(defun find-free-eye-index ((arg0 int) (arg1 string) (arg2 int)) + (dotimes (s4-0 32) + (let ((s2-0 (-> *eye-control-array* data s4-0))) + (when (!= (-> s2-0 level-index) -1) + (when (string-charp= arg1 (-> s2-0 art-group-name)) + (if (= (-> *kernel-context* login-level-index) (-> s2-0 level-index)) + (return s4-0) + ) + ) + ) + ) + ) + (let ((v1-14 (-> *level* level (-> *kernel-context* login-level-index)))) + (dotimes (s4-1 32) + (let ((s2-1 (-> *eye-control-array* data s4-1))) + (when (= (-> s2-1 level-index) -1) + (cond + ((< arg2 60) + (set! (-> s2-1 high-res?) #f) + (set! (-> s2-1 eye-slot) (logand (-> v1-14 eye-slot-lowres arg0) 15)) + (+! (-> v1-14 eye-slot-lowres arg0) 1) + ) + (else + (set! (-> s2-1 high-res?) #t) + (set! (-> s2-1 eye-slot) (logand (-> v1-14 eye-slot-highres arg0) 3)) + (+! (-> v1-14 eye-slot-highres arg0) 1) + ) + ) + (copyn-charp<-string (-> s2-1 art-group-name) arg1 (min 63 (+ (length arg1) 1))) + (set! (-> s2-1 level-index) (-> *kernel-context* login-level-index)) + (return s4-1) + ) + ) + ) + ) + (format 0 "ERROR: no free eye-controls available.~%") + 0 + ) + +(defun free-eye-index ((idx int)) + (when (< idx 32) + (let ((v1-4 (-> *eye-control-array* data idx))) + (set! (-> v1-4 process) (the-as handle #f)) + (set! (-> v1-4 random-time) (the-as uint 60)) + (set! (-> v1-4 blink) 0.0) + (set! (-> v1-4 shaders) (the-as (inline-array adgif-shader) #f)) + (set! (-> v1-4 level-index) -1) + (set! (-> v1-4 high-res?) #f) + (set! (-> v1-4 eye-slot) (the-as uint 0)) + (set! (-> v1-4 art-group-name 0) (the-as uint 0)) + (dotimes (a0-4 2) + (set! (-> v1-4 eyes a0-4 shader-count) (the-as uint 0)) + (dotimes (a1-3 8) + (set! (-> (the-as eye-control (+ (+ (* a1-3 4) (* 80 a0-4)) (the-as int v1-4))) left shader 0) #f) + ) + ) + ) + ) + 0 + ) + +(defun render-eyes-32 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) + (local-vars (sv-16 float)) + (let ((v1-0 *display*) + (a0-1 1776) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let* ((v1-2 (-> arg1 eye-slot)) + (s4-0 32) + (s3-0 (+ (* v1-2 32) 32)) + (s2-0 (* v1-2 32)) + ) + (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x))))) + (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y))))) + (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x))))) + ) + (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) + (let ((s1-0 (-> arg1 shaders 0))) + (let ((v1-16 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-16) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-16) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-0 (the-as structure (&+ (the-as dma-gif-packet v1-16) 32)))) + (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5) + (set! (-> (the-as adgif-shader s0-0) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-0) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-0) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let ((v1-25 (the-as object (-> arg0 base)))) + (set! (-> (the-as (inline-array vector4w) v1-25) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) v1-25) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 4) (* s4-0 16) (the-as int (* s3-0 16)) #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 5) 0 0 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) v1-25) 6) + (* (+ s4-0 64) 16) + (the-as int (* (+ s3-0 32) 16)) + #xffffff + 0 + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-30 (ash 16 (the-as int (-> s1-0 tex0 tw)))) + (a0-35 (ash 16 (the-as int (-> s1-0 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let* ((f0-6 (* 256.0 (-> arg1 left iris-scale))) + (a1-34 (the-as object (-> arg0 base))) + (a2-15 (the int (- f28-0 f0-6))) + (t0-5 (the int (- f26-0 f0-6))) + (a3-9 (the int (+ f28-0 f0-6))) + (t1-0 (the int (+ f26-0 f0-6))) + ) + (set! (-> (the-as (inline-array vector4w) a1-34) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-34) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 4) a2-15 t0-5 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 5) v1-30 a0-35 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 6) a3-9 t1-0 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-1 (-> arg1 shaders 3))) + (let ((v1-35 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-35) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-35) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-1 (the-as structure (&+ (the-as dma-gif-packet v1-35) 32)))) + (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5) + (set! (-> (the-as adgif-shader s0-1) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-1) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-1) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-42 (ash 16 (the-as int (-> s1-1 tex0 tw)))) + (a0-47 (ash 16 (the-as int (-> s1-1 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)) + ) + (let* ((f0-10 (* 256.0 (-> arg1 right iris-scale))) + (a1-44 (the-as object (-> arg0 base))) + (a2-25 (the int (- f30-0 f0-10))) + (t0-11 (the int (- sv-16 f0-10))) + (a3-19 (the int (+ f30-0 f0-10))) + (t1-1 (the int (+ sv-16 f0-10))) + ) + (set! (-> (the-as (inline-array vector4w) a1-44) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-44) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 4) a2-25 t0-11 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 5) v1-42 a0-47 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 6) a3-19 t1-1 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-2 (-> arg1 shaders 1))) + (let ((v1-50 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-50) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-50) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-2 (the-as structure (&+ (the-as dma-gif-packet v1-50) 32)))) + (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5) + (set! (-> (the-as adgif-shader s0-2) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-2) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-2) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-57 (ash 16 (the-as int (-> s1-2 tex0 tw)))) + (a0-65 (ash 16 (the-as int (-> s1-2 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let* ((f0-14 (* 256.0 (-> arg1 left pupil-scale))) + (a1-61 (the-as object (-> arg0 base))) + (a2-35 (the int (- f28-0 f0-14))) + (t0-17 (the int (- f26-0 f0-14))) + (a3-29 (the int (+ f28-0 f0-14))) + (t1-2 (the int (+ f26-0 f0-14))) + ) + (set! (-> (the-as (inline-array vector4w) a1-61) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-61) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 4) a2-35 t0-17 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 5) v1-57 a0-65 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 6) a3-29 t1-2 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-3 (-> arg1 shaders 4))) + (let ((v1-62 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-62) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-62) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-3 (the-as structure (&+ (the-as dma-gif-packet v1-62) 32)))) + (quad-copy! (the-as pointer s0-3) (the-as pointer s1-3) 5) + (set! (-> (the-as adgif-shader s0-3) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-3) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-3) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-69 (ash 16 (the-as int (-> s1-3 tex0 tw)))) + (a0-77 (ash 16 (the-as int (-> s1-3 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)) + ) + (let* ((f0-18 (* 256.0 (-> arg1 right pupil-scale))) + (a1-71 (the-as object (-> arg0 base))) + (a2-45 (the int (- f30-0 f0-18))) + (t0-23 (the int (- sv-16 f0-18))) + (a3-39 (the int (+ f30-0 f0-18))) + (t1-3 (the int (+ sv-16 f0-18))) + ) + (set! (-> (the-as (inline-array vector4w) a1-71) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-71) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 4) a2-45 t0-23 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 5) v1-69 a0-77 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 6) a3-39 t1-3 #xffffff 0) + ) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-4 (-> arg1 shaders 2))) + (let ((v1-77 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-77) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-77) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-4 (the-as structure (&+ (the-as dma-gif-packet v1-77) 32)))) + (quad-copy! (the-as pointer s0-4) (the-as pointer s1-4) 5) + (set! (-> (the-as adgif-shader s0-4) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-4) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-4) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-84 (ash 16 (the-as int (-> s1-4 tex0 tw)))) + (a0-95 (ash 16 (the-as int (-> s1-4 tex0 th)))) + ) + (when (< (-> arg1 left lid) 0.0) + (let ((f0-23 (+ 1.0 (-> arg1 left lid)))) + (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let* ((f0-27 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 left lid)))) + (a1-93 (the-as object (-> arg0 base))) + (a2-55 (* s4-0 16)) + (t0-29 (the int (* 16.0 f0-27))) + (a3-51 (* (+ s4-0 32) 16)) + (t1-6 (the int (* 16.0 (+ f0-27 (* 32.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (inline-array vector4w) a1-93) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-93) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 4) a2-55 t0-29 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 5) v1-84 a0-95 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 6) a3-51 t1-6 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-5 (-> arg1 shaders 5))) + (let ((v1-89 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-89) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-89) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-5 (the-as structure (&+ (the-as dma-gif-packet v1-89) 32)))) + (quad-copy! (the-as pointer s0-5) (the-as pointer s1-5) 5) + (set! (-> (the-as adgif-shader s0-5) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-5) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-5) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-96 (ash 16 (the-as int (-> s1-5 tex0 tw)))) + (a0-107 (ash 16 (the-as int (-> s1-5 tex0 th)))) + ) + (when (< (-> arg1 right lid) 0.0) + (let ((f0-33 (+ 1.0 (-> arg1 right lid)))) + (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)) + ) + (let* ((f0-37 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 right lid)))) + (a1-108 (the-as object (-> arg0 base))) + (a2-66 (* (+ s4-0 64) 16)) + (t0-35 (the int (* 16.0 f0-37))) + (a3-63 (* (+ s4-0 32) 16)) + (t1-9 (the int (* 16.0 (+ f0-37 (* 32.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (inline-array vector4w) a1-108) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-108) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 4) a2-66 t0-35 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 5) v1-96 a0-107 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 6) a3-63 t1-9 #xffffff 0) + ) + ) + ) + ) + (let ((v0-0 (&+ (-> arg0 base) 112))) + (set! (-> arg0 base) v0-0) + v0-0 + ) + ) + ) + ) + ) + +(defun render-eyes-64 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) + (local-vars (sv-16 float)) + (let ((v1-0 *display*) + (a0-1 1776) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let* ((v1-2 (-> arg1 eye-slot)) + (s4-0 64) + (s3-0 (+ (* v1-2 64) 64)) + (s2-0 (* v1-2 64)) + ) + (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x))))) + (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y))))) + (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x))))) + ) + (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) + (let ((s1-0 (-> arg1 shaders 0))) + (let ((v1-16 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-16) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-16) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-0 (the-as structure (&+ (the-as dma-gif-packet v1-16) 32)))) + (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5) + (set! (-> (the-as adgif-shader s0-0) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-0) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-0) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let ((v1-25 (the-as object (-> arg0 base)))) + (set! (-> (the-as (inline-array vector4w) v1-25) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) v1-25) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 4) (* s4-0 16) (the-as int (* s3-0 16)) #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 5) 0 0 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) v1-25) 6) + (* (+ s4-0 128) 16) + (the-as int (* (+ s3-0 64) 16)) + #xffffff + 0 + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-30 (ash 16 (the-as int (-> s1-0 tex0 tw)))) + (a0-35 (ash 16 (the-as int (-> s1-0 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let* ((f0-6 (* 512.0 (-> arg1 left iris-scale))) + (a1-34 (the-as object (-> arg0 base))) + (a2-15 (the int (- f28-0 f0-6))) + (t0-5 (the int (- f26-0 f0-6))) + (a3-9 (the int (+ f28-0 f0-6))) + (t1-0 (the int (+ f26-0 f0-6))) + ) + (set! (-> (the-as (inline-array vector4w) a1-34) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-34) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 4) a2-15 t0-5 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 5) v1-30 a0-35 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 6) a3-9 t1-0 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-1 (-> arg1 shaders 3))) + (let ((v1-35 (the-as dma-gif-packet (-> arg0 base)))) + (set! (-> v1-35 dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> v1-35 quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-1 (the-as structure (&+ v1-35 32)))) + (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5) + (set! (-> (the-as adgif-shader s0-1) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-1) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-1) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-42 (ash 16 (the-as int (-> s1-1 tex0 tw)))) + (a0-47 (ash 16 (the-as int (-> s1-1 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)) + ) + (let* ((f0-10 (* 512.0 (-> arg1 right iris-scale))) + (a1-44 (the-as object (-> arg0 base))) + (a2-25 (the int (- f30-0 f0-10))) + (t0-11 (the int (- sv-16 f0-10))) + (a3-19 (the int (+ f30-0 f0-10))) + (t1-1 (the int (+ sv-16 f0-10))) + ) + (set! (-> (the-as (inline-array vector4w) a1-44) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-44) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 4) a2-25 t0-11 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 5) v1-42 a0-47 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 6) a3-19 t1-1 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-2 (-> arg1 shaders 1))) + (let ((v1-50 (the-as dma-gif-packet (-> arg0 base)))) + (set! (-> v1-50 dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> v1-50 quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-2 (the-as structure (&+ v1-50 32)))) + (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5) + (set! (-> (the-as adgif-shader s0-2) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-2) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-2) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-57 (ash 16 (the-as int (-> s1-2 tex0 tw)))) + (a0-65 (ash 16 (the-as int (-> s1-2 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let* ((f0-14 (* 512.0 (-> arg1 left pupil-scale))) + (a1-61 (the-as object (-> arg0 base))) + (a2-35 (the int (- f28-0 f0-14))) + (t0-17 (the int (- f26-0 f0-14))) + (a3-29 (the int (+ f28-0 f0-14))) + (t1-2 (the int (+ f26-0 f0-14))) + ) + (set! (-> (the-as (pointer uint128) a1-61)) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-61) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 4) a2-35 t0-17 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 5) v1-57 a0-65 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 6) a3-29 t1-2 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-3 (-> arg1 shaders 4))) + (let ((v1-62 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-62) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-62) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-3 (the-as structure (&+ (the-as dma-gif-packet v1-62) 32)))) + (quad-copy! (the-as pointer s0-3) (the-as pointer s1-3) 5) + (set! (-> (the-as adgif-shader s0-3) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-3) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-3) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-69 (ash 16 (the-as int (-> s1-3 tex0 tw)))) + (a0-77 (ash 16 (the-as int (-> s1-3 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)) + ) + (let* ((f0-18 (* 512.0 (-> arg1 right pupil-scale))) + (a1-71 (the-as object (-> arg0 base))) + (a2-45 (the int (- f30-0 f0-18))) + (t0-23 (the int (- sv-16 f0-18))) + (a3-39 (the int (+ f30-0 f0-18))) + (t1-3 (the int (+ sv-16 f0-18))) + ) + (set! (-> (the-as (inline-array vector4w) a1-71) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-71) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 4) a2-45 t0-23 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 5) v1-69 a0-77 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 6) a3-39 t1-3 #xffffff 0) + ) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-4 (-> arg1 shaders 2))) + (let ((v1-77 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-77) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-77) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-4 (the-as structure (&+ (the-as dma-gif-packet v1-77) 32)))) + (quad-copy! (the-as pointer s0-4) (the-as pointer s1-4) 5) + (set! (-> (the-as adgif-shader s0-4) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-4) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-4) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-84 (ash 16 (the-as int (-> s1-4 tex0 tw)))) + (a0-95 (ash 16 (the-as int (-> s1-4 tex0 th)))) + ) + (when (< (-> arg1 left lid) 0.0) + (let ((f0-23 (+ 1.0 (-> arg1 left lid)))) + (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let* ((f0-27 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 left lid)))) + (a1-93 (the-as object (-> arg0 base))) + (a2-55 (* s4-0 16)) + (t0-29 (the int (* 16.0 f0-27))) + (a3-51 (* (+ s4-0 64) 16)) + (t1-6 (the int (* 16.0 (+ f0-27 (* 64.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (inline-array vector4w) a1-93) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-93) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 4) a2-55 t0-29 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 5) v1-84 a0-95 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 6) a3-51 t1-6 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-5 (-> arg1 shaders 5))) + (let ((v1-89 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-89) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-89) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-5 (the-as structure (&+ (the-as dma-gif-packet v1-89) 32)))) + (quad-copy! (the-as pointer s0-5) (the-as pointer s1-5) 5) + (set! (-> (the-as adgif-shader s0-5) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-5) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-5) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-96 (ash 16 (the-as int (-> s1-5 tex0 tw)))) + (a0-107 (ash 16 (the-as int (-> s1-5 tex0 th)))) + ) + (when (< (-> arg1 right lid) 0.0) + (let ((f0-33 (+ 1.0 (-> arg1 right lid)))) + (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)) + ) + (let* ((f0-37 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 right lid)))) + (a1-108 (the-as object (-> arg0 base))) + (a2-66 (* (+ s4-0 128) 16)) + (t0-35 (the int (* 16.0 f0-37))) + (a3-63 (* (+ s4-0 64) 16)) + (t1-9 (the int (* 16.0 (+ f0-37 (* 64.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (pointer uint128) a1-108)) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-108) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 4) a2-66 t0-35 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 5) v1-96 a0-107 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 6) a3-63 t1-9 #xffffff 0) + ) + ) + ) + ) + (let ((v0-0 (&+ (-> arg0 base) 112))) + (set! (-> arg0 base) v0-0) + v0-0 + ) + ) + ) + ) + ) + +(defun update-eyes () + (when (not (-> *blit-displays-work* screen-copied)) + (dotimes (gp-0 32) + (let* ((s5-0 (-> *eye-control-array* data gp-0)) + (v1-7 (handle->process (-> s5-0 process))) + ) + (when (and v1-7 + (logtest? (-> (the-as process-drawable v1-7) skel status) (joint-control-status eye-anim)) + (logtest? (-> (the-as process-drawable v1-7) draw status) (draw-control-status on-screen)) + ) + (when (-> s5-0 shaders) + (when (not (paused?)) + (cond + ((and (>= (-> s5-0 left lid) 0.0) (>= (-> s5-0 right lid) 0.0)) + (set! (-> s5-0 random-time) (the-as uint 60)) + (set! (-> s5-0 blink) 0.0) + ) + (else + (+! (-> s5-0 random-time) -1) + (let ((v1-19 (-> s5-0 random-time))) + (when (< v1-19 (the-as uint 10)) + (set! (-> s5-0 blink) (-> *eye-work* blink-table v1-19)) + (if (zero? v1-19) + (set! (-> s5-0 random-time) (the-as uint (the int (rand-vu-float-range 60.0 240.0)))) + ) + ) + ) + ) + ) + ) + (when (-> s5-0 left shader) + (cond + ((and (= (-> s5-0 left pupil-scale) 0.0) (= (-> s5-0 left iris-scale) 0.0)) + (dotimes (v1-24 (the-as int (-> s5-0 left shader-count))) + (set! (-> s5-0 left shader v1-24 tex0 tfx) 1) + ) + ) + (else + (dotimes (v1-27 (the-as int (-> s5-0 left shader-count))) + (set! (-> s5-0 left shader v1-27 tex0 tfx) 0) + ) + ) + ) + ) + (when (-> s5-0 right shader) + (cond + ((and (= (-> s5-0 right pupil-scale) 0.0) (= (-> s5-0 right iris-scale) 0.0)) + (dotimes (v1-34 (the-as int (-> s5-0 right shader-count))) + (set! (-> s5-0 right shader v1-34 tex0 tfx) 1) + ) + ) + (else + (dotimes (v1-37 (the-as int (-> s5-0 right shader-count))) + (set! (-> s5-0 right shader v1-37 tex0 tfx) 0) + ) + ) + ) + ) + (cond + ((-> s5-0 high-res?) + (let ((v1-42 *display*) + (a0-45 16) + ) + (+! (-> v1-42 mem-reserve-size) a0-45) + (when (not (-> v1-42 dma-buffer-overflow)) + (let ((a2-0 (-> v1-42 frames (-> v1-42 on-screen) global-buf))) + (if (< (-> a2-0 real-buffer-end) (the-as int (&+ (-> a2-0 base) a0-45))) + (set! (-> v1-42 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-42 dma-buffer-overflow)) + (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (the-as bucket-id (-> s5-0 bucket)) + ) + (let ((t9-2 set-display-gs-state-offset) + (a0-50 s3-0) + (a1-35 (-> *eyes-texture-base* vram-page)) + (a2-2 (the-as object 128)) + ) + (t9-2 a0-50 (the-as int a1-35) (the-as int a2-2) 256 0 0 64 64) + (let ((v1-50 *display*) + (a0-51 48) + ) + (+! (-> v1-50 mem-reserve-size) a0-51) + (when (not (-> v1-50 dma-buffer-overflow)) + (let* ((a2-3 (-> v1-50 frames (-> v1-50 on-screen) global-buf)) + (a1-44 (-> a2-3 real-buffer-end)) + ) + (set! a2-2 (-> a2-3 base)) + (if (< a1-44 (the-as int (&+ (the-as pointer a2-2) a0-51))) + (set! (-> v1-50 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-50 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-0 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + ) + ) + ) + (render-eyes-64 s3-0 s5-0 (the-as int a2-2)) + ) + (reset-display-gs-state *display* s3-0) + (let ((v1-55 *display*) + (a0-62 48) + ) + (+! (-> v1-55 mem-reserve-size) a0-62) + (when (not (-> v1-55 dma-buffer-overflow)) + (let ((a2-4 (-> v1-55 frames (-> v1-55 on-screen) global-buf))) + (if (< (-> a2-4 real-buffer-end) (the-as int (&+ (-> a2-4 base) a0-62))) + (set! (-> v1-55 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-55 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-0 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))) + ) + ) + ) + ) + ) + ) + ) + ) + ((not (-> s5-0 high-res?)) + (let ((v1-68 *display*) + (a0-74 16) + ) + (+! (-> v1-68 mem-reserve-size) a0-74) + (when (not (-> v1-68 dma-buffer-overflow)) + (let ((a2-7 (-> v1-68 frames (-> v1-68 on-screen) global-buf))) + (if (< (-> a2-7 real-buffer-end) (the-as int (&+ (-> a2-7 base) a0-74))) + (set! (-> v1-68 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-68 dma-buffer-overflow)) + (with-dma-buffer-add-bucket ((s3-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (the-as bucket-id (-> s5-0 bucket)) + ) + (let ((t9-6 set-display-gs-state-offset) + (a0-79 s3-1) + (a1-88 (-> *eyes-texture-base* vram-page)) + (a2-9 (the-as object 64)) + ) + (t9-6 a0-79 (the-as int a1-88) (the-as int a2-9) 512 0 0 32 32) + (let ((v1-76 *display*) + (a0-80 48) + ) + (+! (-> v1-76 mem-reserve-size) a0-80) + (when (not (-> v1-76 dma-buffer-overflow)) + (let* ((a2-10 (-> v1-76 frames (-> v1-76 on-screen) global-buf)) + (a1-97 (-> a2-10 real-buffer-end)) + ) + (set! a2-9 (-> a2-10 base)) + (if (< a1-97 (the-as int (&+ (the-as pointer a2-9) a0-80))) + (set! (-> v1-76 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-76 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-1 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + ) + ) + ) + (render-eyes-32 s3-1 s5-0 (the-as int a2-9)) + ) + (reset-display-gs-state *display* s3-1) + (let ((v1-81 *display*) + (a0-91 48) + ) + (+! (-> v1-81 mem-reserve-size) a0-91) + (when (not (-> v1-81 dma-buffer-overflow)) + (let ((a2-11 (-> v1-81 frames (-> v1-81 on-screen) global-buf))) + (if (< (-> a2-11 real-buffer-end) (the-as int (&+ (-> a2-11 base) a0-91))) + (set! (-> v1-81 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-81 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-1 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch uint vs int. +(defun get-eye-block ((arg0 int) (arg1 int)) + (let ((v1-0 arg0) + (a0-4 (-> ct32-24-block-table (* arg1 4))) + ) + (the-as int (+ (-> *eyes-texture-base* vram-block) (* v1-0 32) a0-4)) + ) + ) + +(defun convert-eye-data ((arg0 eye) (arg1 uint)) + (local-vars + (v0-0 float) + (v1-0 uint128) + (v1-1 uint128) + (v1-2 uint128) + (v1-3 uint128) + (v1-4 uint128) + (v1-5 uint128) + ) + (rlet ((vf1 :class vf) + (vf2 :class vf) + ) + (.pextlb v1-0 arg1 0) + (.pextlh v1-1 v1-0 0) + (.pw.sra v1-2 v1-1 16) + (.mov vf1 v1-2) + (.pextlb v1-3 0 arg1) + (.pextuh v1-4 0 v1-3) + (.pw.sll v1-5 v1-4 6) + (.mov vf2 v1-5) + (vitof15.xyzw vf1 vf1) + (vitof12.xyzw vf2 vf2) + (.svf (&-> arg0 data 0 quad) vf1) + (.svf (&-> arg0 data 1 quad) vf2) + (.mov v0-0 vf2) + v0-0 + ) + ) + +(defun merc-eye-anim ((arg0 process-drawable)) + (let* ((v1-2 (-> arg0 draw mgeo header eye-ctrl)) + (a0-2 (-> arg0 skel float-channels)) + (s3-0 (cond + ((> a0-2 0) + (-> arg0 skel channel (+ a0-2 -1 (-> arg0 skel active-channels))) + ) + (else + (let ((a0-8 (-> arg0 skel root-channel)) + (a1-4 (-> arg0 skel effect)) + ) + (-> a0-8 (if a1-4 + (-> a1-4 channel-offset) + 0 + ) + ) + ) + ) + ) + ) + (s4-0 (-> s3-0 frame-group)) + ) + (when (and (logtest? (-> arg0 skel status) (joint-control-status eye-anim)) + (and (nonzero? v1-2) (> (-> arg0 skel active-channels) 0) s4-0) + ) + (cond + ((and (-> arg0 skel override) (!= (-> arg0 skel override 41) 0.0)) + (let ((v1-6 (-> *eye-control-array* data (-> v1-2 eye-ctrl-index))) + (a0-24 (-> arg0 skel override)) + ) + (set! (-> v1-6 left x) (-> a0-24 42)) + (set! (-> v1-6 left y) (-> a0-24 43)) + (set! (-> v1-6 left lid) (-> a0-24 44)) + (set! (-> v1-6 left iris-scale) (-> a0-24 45)) + (set! (-> v1-6 left pupil-scale) (-> a0-24 46)) + (set! (-> v1-6 left lid-scale) (-> a0-24 47)) + (set! (-> v1-6 right x) (-> a0-24 48)) + (set! (-> v1-6 right y) (-> a0-24 49)) + (set! (-> v1-6 right lid) (-> a0-24 50)) + (set! (-> v1-6 right iris-scale) (-> a0-24 51)) + (set! (-> v1-6 right pupil-scale) (-> a0-24 52)) + (set! (-> v1-6 right lid-scale) (-> a0-24 53)) + ) + (logior! (-> arg0 skel status) (joint-control-status eye-anim-valid)) + ) + (else + (let* ((s5-0 (-> *eye-control-array* data (-> v1-2 eye-ctrl-index))) + (f0-13 (-> s3-0 frame-num)) + (f30-0 (- f0-13 (* (the float (the int (/ f0-13 1.0))) 1.0))) + ) + (set! (-> s5-0 process) (process->handle arg0)) + (set! (-> s5-0 shaders) (-> v1-2 shader)) + (let ((a0-34 *level*) + (v1-11 (-> arg0 draw)) + ) + (set! (-> s5-0 bucket) (the-as uint (vu1-bucket-map + (the-as int (-> a0-34 draw-index-map (-> v1-11 level-index))) + (the-as int (-> v1-11 default-texture-page)) + (merc-mode texture) + ) + ) + ) + ) + (let ((s2-0 (new 'stack-no-clear 'eye)) + (s1-0 (new 'stack-no-clear 'eye)) + ) + (cond + ((-> s4-0 eye-anim) + (let ((s0-1 (min (the int (-> s3-0 frame-num)) (-> s4-0 eye-anim max-frame))) + (s3-2 (min (+ (the int (-> s3-0 frame-num)) 1) (-> s4-0 eye-anim max-frame))) + ) + (convert-eye-data s2-0 (-> s4-0 eye-anim data (* s0-1 2) dword)) + (convert-eye-data s1-0 (-> s4-0 eye-anim data (* s3-2 2) dword)) + (vector4-lerp! (the-as vector (-> s5-0 eyes)) (the-as vector (&-> s2-0 x)) (the-as vector (&-> s1-0 x)) f30-0) + (vector4-lerp! + (the-as vector (&-> s5-0 left iris-scale)) + (the-as vector (&-> s2-0 iris-scale)) + (the-as vector (&-> s1-0 iris-scale)) + f30-0 + ) + (convert-eye-data s2-0 (-> s4-0 eye-anim data (+ (* s0-1 2) 1) dword)) + (convert-eye-data s1-0 (-> s4-0 eye-anim data (+ (* s3-2 2) 1) dword)) + ) + (vector4-lerp! + (the-as vector (-> s5-0 right)) + (the-as vector (&-> s2-0 x)) + (the-as vector (&-> s1-0 x)) + f30-0 + ) + (vector4-lerp! + (the-as vector (&-> s5-0 right iris-scale)) + (the-as vector (&-> s2-0 iris-scale)) + (the-as vector (&-> s1-0 iris-scale)) + f30-0 + ) + ) + (else + (format *stdcon* "no eye anim data for ~s~%" (-> arg0 name)) + (set! (-> s5-0 left x) 0.0) + (set! (-> s5-0 left y) 0.0) + (set! (-> s5-0 left lid) -1.0) + (set! (-> s5-0 left iris-scale) 0.55) + (set! (-> s5-0 left pupil-scale) 0.45) + (set! (-> s5-0 left lid-scale) 1.0) + (set! (-> s5-0 right x) 0.0) + (set! (-> s5-0 right y) 0.0) + (set! (-> s5-0 right lid) -1.0) + (set! (-> s5-0 right iris-scale) 0.55) + (set! (-> s5-0 right pupil-scale) 0.45) + (set! (-> s5-0 right lid-scale) 1.0) + ) + ) + ) + ) + (logior! (-> arg0 skel status) (joint-control-status eye-anim-valid)) + ) + ) + ) + ) + (if (logtest? (-> arg0 skel status) (joint-control-status eye-anim-valid)) + (logclear! (-> arg0 skel status) (joint-control-status eye-anim-valid)) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/process-drawable/process-drawable.gc b/goal_src/jak3/engine/process-drawable/process-drawable.gc index 22e784c31d..8aeb7d2bfd 100644 --- a/goal_src/jak3/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak3/engine/process-drawable/process-drawable.gc @@ -1515,9 +1515,9 @@ ;; (if (logtest? (-> this skel status) (joint-control-status blend-shape blend-shape-valid)) ;; (merc-blend-shape this) ;; ) - ;; (if (logtest? (-> this skel status) (joint-control-status eye-anim-valid eye-anim)) - ;; (merc-eye-anim this) - ;; ) + (if (logtest? (-> this skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim this) + ) (label cfg-45) ;; (let ((a0-26 (-> gp-0 effect))) ;; (if a0-26 diff --git a/goal_src/jak3/engine/process-drawable/simple-nav-sphere.gc b/goal_src/jak3/engine/process-drawable/simple-nav-sphere.gc index 316d7a0634..7e9734be0c 100644 --- a/goal_src/jak3/engine/process-drawable/simple-nav-sphere.gc +++ b/goal_src/jak3/engine/process-drawable/simple-nav-sphere.gc @@ -7,3 +7,131 @@ ;; DECOMP BEGINS +(deftype simple-nav-sphere (process-drawable) + ((first-time? symbol) + (track-joint int32) + ) + (:state-methods + idle + active + ) + ) + + +(defbehavior simple-nav-sphere-event-handler simple-nav-sphere ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('die-fast) + (go empty-state) + ) + (('move-trans) + (move-to-point! (the-as collide-shape (-> self root)) (the-as vector (-> arg3 param 0))) + #t + ) + (('set-radius) + (let ((f0-0 (the-as float (-> arg3 param 0))) + (a0-7 (-> self root)) + ) + (set! (-> a0-7 nav-radius) f0-0) + (set! (-> (the-as collide-shape a0-7) root-prim local-sphere w) f0-0) + (update-transforms (the-as collide-shape a0-7)) + ) + #t + ) + ) + ) + +(defmethod run-logic? ((this simple-nav-sphere)) + "Should this process be run? Checked by execute-process-tree." + (cond + (*display-nav-marks* + #t + ) + ((>= (-> this track-joint) 0) + #t + ) + ((-> this first-time?) + (set! (-> this first-time?) #f) + #t + ) + ) + ) + +(defstate idle (simple-nav-sphere) + :virtual #t + :event simple-nav-sphere-event-handler + :trans (behavior () + (if *display-nav-marks* + (add-debug-sphere + #t + (bucket-id debug) + (-> self root trans) + (-> self root nav-radius) + (new 'static 'rgba :r #x80 :g #x40 :a #x80) + ) + ) + ) + :code sleep-code + ) + +(defstate active (simple-nav-sphere) + :virtual #t + :event simple-nav-sphere-event-handler + :trans (behavior () + (let ((v1-0 (ppointer->process (-> self parent))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector<-cspace! gp-0 (-> (the-as process-drawable v1-0) node-list data (-> self track-joint))) + (move-to-point! (the-as collide-shape (-> self root)) gp-0) + ) + ) + :code sleep-code + ) + +(defbehavior simple-nav-sphere-init-by-other simple-nav-sphere ((arg0 float) (arg1 vector) (arg2 nav-mesh) (arg3 int)) + (set! (-> self track-joint) arg3) + (set! (-> self first-time?) #t) + (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((v1-3 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle)) + (set-vector! (-> v1-3 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-3) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-6 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> s5-0 nav-radius) arg0) + (set! (-> s5-0 root-prim local-sphere w) arg0) + (if arg1 + (set! (-> s5-0 trans quad) (-> arg1 quad)) + ) + (vector-identity! (-> s5-0 scale)) + (quaternion-identity! (-> s5-0 quat)) + (let ((v1-11 (-> s5-0 root-prim))) + (set! (-> v1-11 prim-core collide-as) (collide-spec)) + (set! (-> v1-11 prim-core collide-with) (collide-spec)) + ) + 0 + (update-transforms s5-0) + (set! (-> self root) s5-0) + ) + (logclear! (-> self mask) (process-mask actor-pause enemy)) + (set! (-> self event-hook) simple-nav-sphere-event-handler) + (cond + (arg2 + (let ((t9-5 (method-of-object arg2 nav-mesh-method-31))) + self + (t9-5) + ) + ) + (else + (nav-mesh-connect-from-ent self) + ) + ) + (if (>= (-> self track-joint) 0) + (go-virtual active) + (go-virtual idle) + ) + ) diff --git a/goal_src/jak3/engine/target/flut/flut-h.gc b/goal_src/jak3/engine/target/flut/flut-h.gc index 1a7dc171c7..d269e3e32b 100644 --- a/goal_src/jak3/engine/target/flut/flut-h.gc +++ b/goal_src/jak3/engine/target/flut/flut-h.gc @@ -9,6 +9,10 @@ (defenum flut-flag :type uint64 :bitfield #t + (ff0 0) + (ff1 1) + (ff2 2) + (ff3 3) ) ;; ---flut-flag @@ -37,26 +41,29 @@ (deftype flut (process-focusable) - ((extra-trans vector :inline) + ((root collide-shape-moving :override) + (extra-trans vector :inline) (condition int32) (shadow-backup shadow-geo) (rider handle) (nav-sphere-handle handle) (probe-time time-frame) - (count-lock basic) + (count-lock symbol) (flags flut-flag) - (mode basic) + (mode symbol) (color-index int32) (minimap connection-minimap) ) + (:state-methods + wait-for-start + idle + (pickup (state flut)) + wait-for-return + die + ) (:methods - (flut-method-28 () none) - (flut-method-29 () none) - (flut-method-30 () none) - (flut-method-31 () none) - (flut-method-32 () none) - (flut-method-33 () none) - (flut-method-34 () none) + (flut-method-33 (_type_) symbol) + (spawn-part-and-sound! (_type_) none) ) ) diff --git a/goal_src/jak3/engine/target/flut/flut-part.gc b/goal_src/jak3/engine/target/flut/flut-part.gc index e56c16493a..e0e7a9a3b7 100644 --- a/goal_src/jak3/engine/target/flut/flut-part.gc +++ b/goal_src/jak3/engine/target/flut/flut-part.gc @@ -7,3 +7,126 @@ ;; DECOMP BEGINS +(defpartgroup group-flut-trans-pad + :id 237 + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 1059 :fade-after (meters 160)) + (sp-item 1060 :fade-after (meters 160)) + (sp-item 1061 :fade-after (meters 60) :falloff-to (meters 60) :flags (is-3d)) + ) + ) + +(defpart 1059 + :init-specs ((:texture (common-white common)) + (:num 0.5) + (:y (meters 7)) + (:scale-x (meters 14) (meters 1)) + (:scale-y (meters 14)) + (:r 40.0) + (:g 60.0 60.0) + (:b 128.0) + (:a 32.0 32.0) + (:timer (seconds 0.035)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +(defpart 1060 + :init-specs ((:texture (common-white common)) + (:num 0.5) + (:y (meters 4)) + (:scale-x (meters 7) (meters 1)) + (:scale-y (meters 14)) + (:r 40.0) + (:g 60.0 60.0) + (:b 128.0) + (:a 64.0 64.0) + (:fade-a -8.533334) + (:timer (seconds 0.035)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +(defpart 1061 + :init-specs ((:texture (splash-foam level-default-sprite)) + (:num 1.0) + (:y (meters 0.75) (meters 0.1)) + (:scale-x (meters 0)) + (:rot-x (degrees 0) (degrees 15)) + (:rot-y (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 16.0) + (:g 0.0 127.0) + (:b 127.0) + (:a 127.0) + (:vel-y (meters 0)) + (:scalevel-x (meters 0.02)) + (:rotvel-y (degrees -0.6) (degrees 1.2)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.21333334) + (:accel-y (meters -0.00015)) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +(defpartgroup group-flut-attack-strike-ground + :id 238 + :duration (seconds 0.035) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 1062) (sp-item 1063)) + ) + +(defpart 1062 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 24.0) + (:y (meters 1)) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 8.0 56.0) + (:vel-y (meters 0.13333334) (meters 0.16666667)) + (:scalevel-x (meters 0.013333334)) + (:rotvel-z (degrees -0.4) (degrees 0.8)) + (:scalevel-y :copy scalevel-x) + (:fade-g -1.4222223) + (:fade-a -0.35555556) + (:accel-y (meters 0.00008333333)) + (:friction 0.7) + (:timer (seconds 0.6)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 1064) + (:conerot-x (degrees 90)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 1063 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 32.0) + (:y (meters 1)) + (:scale-x (meters 1) (meters 0.5)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 64.0 8.0) + (:vel-y (meters 0.3)) + (:scalevel-x (meters 0.0033333334)) + (:scalevel-y :copy scalevel-x) + (:fade-g -2.8444445) + (:fade-a -0.82222223) + (:friction 0.7) + (:timer (seconds 0.3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.15)) + (:next-launcher 1064) + (:conerot-x (degrees 90)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) diff --git a/goal_src/jak3/engine/target/flut/flut.gc b/goal_src/jak3/engine/target/flut/flut.gc index 0ab4ed19ce..63e189b869 100644 --- a/goal_src/jak3/engine/target/flut/flut.gc +++ b/goal_src/jak3/engine/target/flut/flut.gc @@ -7,3 +7,623 @@ ;; DECOMP BEGINS +(define *flut-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #xa)) + :shadow-dir (new 'static 'vector :y -1.0 :w 614400.0) + :bot-plane (new 'static 'plane :y 1.0 :w 81920.0) + :top-plane (new 'static 'plane :y 1.0 :w -2867.2) + ) + ) + ) + +(define *flut-color-table* (the-as (array rgbaf) (new 'static 'boxed-array :type vector + (new 'static 'vector :x 1.0 :y 1.0 :z 0.8 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.7 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.6 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.5 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.4 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.9 :z 0.5 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.8 :z 0.6 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.8 :z 0.5 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.8 :z 0.4 :w 1.0) + (new 'static 'vector :x 0.9 :y 0.9 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.8 :y 0.9 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.8 :y 1.0 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.8 :y 1.0 :z 0.8 :w 1.0) + ) + ) + ) + +(defmethod spawn-part-and-sound! ((this flut)) + (if (nonzero? (-> this part)) + (spawn (-> this part) (-> this root trans)) + ) + (if (nonzero? (-> this sound)) + (update! (-> this sound)) + ) + 0 + (none) + ) + +(defmethod deactivate ((this flut)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (when (-> this count-lock) + (set! (-> this count-lock) #f) + (+! (-> *game-info* flut-count) -1) + ) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +(defbehavior flut-color-from-index flut ((arg0 int)) + (set! (-> self draw color-mult quad) (-> *flut-color-table* (mod arg0 (-> *flut-color-table* length)) quad)) + 0 + (none) + ) + +(defun flut-random-color-index () + (rand-vu-int-range 0 (-> *flut-color-table* length)) + ) + +(defmethod flut-method-33 ((this flut)) + (let ((gp-0 (the-as (array collide-shape) (new 'stack 'boxed-array collide-shape 32)))) + (let ((a1-2 (sphere<-vector+r! (new 'stack-no-clear 'sphere) (-> this root trans) 16384.0))) + (+! (-> a1-2 y) 12288.0) + (set! (-> gp-0 length) + (fill-actor-list-for-box *actor-hash* (the-as bounding-box a1-2) (-> gp-0 data) (-> gp-0 allocated-length)) + ) + ) + (let* ((s5-1 (-> gp-0 length)) + (s4-0 0) + (v1-7 (-> gp-0 s4-0)) + ) + (while (< s4-0 s5-1) + (if (type? (-> v1-7 process) flut) + (return #f) + ) + (+! s4-0 1) + (set! v1-7 (-> gp-0 s4-0)) + ) + ) + ) + #t + ) + +(defstate wait-for-start (flut) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('bonk) + (send-event proc 'target-flut-get-off 90) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + #f + ) + (('attack) + (cond + ((and (-> self next-state) (= (-> self next-state name) 'wait-for-start)) + #f + ) + ((= (-> self mode) 'normal) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + (go-virtual die) + ) + (else + (send-event proc 'target-flut-get-off 90) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + ) + ) + ) + (('touch) + (send-event proc 'target-flut-get-off 90) + (send-shoves (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0) + #f + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-2 (the-as object (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-2)) + v0-2 + ) + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ) + :exit (behavior () + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + (set-vector! (-> self root root-prim local-sphere) 0.0 5734.4 0.0 7372.8) + ) + :code (behavior () + (ja-channel-set! 0) + (while (or (>= (-> *game-info* flut-count) 10) + (and (sphere-in-view-frustum? (sphere<-vector+r! (new 'stack 'sphere) (-> self root trans) 8192.0)) + (and (< (vector-vector-distance (-> self root trans) (camera-pos)) 409600.0) + *target* + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (flut-method-33 self)) + ) + (suspend) + ) + (go-virtual idle) + ) + ) + +(defstate idle (flut) + :virtual #t + :event (-> (method-of-type flut wait-for-start) event) + :enter (behavior () + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (let ((s5-0 (find-nearest-nav-mesh (-> self root trans) 8192.0))) + (when s5-0 + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! gp-0 (-> self root quat)) + (vector-normalize! gp-0 5120.0) + (vector+! gp-0 gp-0 (-> self root trans)) + (set! (-> self nav-sphere-handle) + (ppointer->handle + (process-spawn simple-nav-sphere #x46266666 gp-0 s5-0 -1 :name "simple-nav-sphere" :to self) + ) + ) + ) + ) + ) + ) + :exit (behavior () + (send-event (handle->process (-> self nav-sphere-handle)) 'die-fast) + ((-> (method-of-type flut wait-for-start) exit)) + ) + :code (behavior () + (when (not (-> self count-lock)) + (set! (-> self count-lock) #t) + (+! (-> *game-info* flut-count) 1) + ) + ;; og:preserve-this not-yet-implemented check + (if (and (nonzero? *minimap*) (not (-> self minimap))) + (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 11) (the-as int #f) (the-as vector #t) 0)) + ) + (change-parent self *entity-pool*) + (ja-channel-set! 1) + (ja :group! (-> self draw art-group data 3)) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + 0.0 + (let ((f30-0 20480.0)) + (until #f + (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) + (time-elapsed? (-> self probe-time) (seconds 1)) + ) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + (set-time! (-> self probe-time)) + ) + (when (and (and *target* (and (>= f30-0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (focus-test? *target* grabbed in-head pole flut light board dark)) + (can-display-query? self "flut" -99.0) + (-> *setting-control* user-current pilot) + (-> *target* current-level) + ) + (let ((gp-0 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-43 gp-0)) + (set! (-> v1-43 width) (the float 340)) + ) + (let ((v1-44 gp-0)) + (set! (-> v1-44 height) (the float 80)) + ) + (let ((v1-45 gp-0) + (a0-21 (-> *setting-control* user-default language)) + ) + (set! (-> v1-45 scale) (if (or (= a0-21 (language-enum korean)) (= a0-21 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id text-0083) #f) + gp-0 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (if (and (cpad-pressed? 0 triangle) + (send-event *target* 'change-mode 'flut self (-> self mode) (-> self color-index)) + ) + (go-virtual pickup (method-of-object self wait-for-return)) + ) + ) + (if *target* + (look-at! + (-> *target* neck) + (vector+! + (new 'stack-no-clear 'vector) + (the-as vector (-> self root root-prim prim-core)) + (new 'static 'vector :y 2048.0 :w 1.0) + ) + 'nothing-special + self + ) + ) + (spawn-part-and-sound! self) + (suspend) + (ja :num! (loop!)) + ) + ) + #f + ) + :post ja-post + ) + +(defstate pickup (flut) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('draw) + (ja-channel-set! 1) + (ja :group! (-> self draw art-group data 3)) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + (transform-post) + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('touch 'attack 'bonk) + #f + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as object (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ) + :enter (behavior ((arg0 (state flut))) + (talker-spawn-func (-> *talker-speech* 86) *entity-pool* (target-pos 0) (the-as region #f)) + (let ((t9-2 (-> arg0 enter))) + (if t9-2 + (t9-2) + ) + ) + ) + :code (behavior ((arg0 (state flut))) + (when (-> self count-lock) + (set! (-> self count-lock) #f) + (+! (-> *game-info* flut-count) -1) + ) + (when (-> self minimap) + (logior! (-> self minimap flags) (minimap-flag fade-out)) + (set! (-> self minimap) #f) + ) + (ja-channel-set! 0) + (ja-post) + (when (not (and (-> self entity) (= (-> self entity extra process) self))) + (let ((s5-0 (current-time))) + (until (time-elapsed? s5-0 (seconds 0.1)) + (spawn-part-and-sound! self) + (suspend) + ) + ) + (deactivate self) + ) + (while (zero? (ja-group-size)) + (if (or (not *target*) (or (< 24576.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + (go arg0) + ) + (spawn-part-and-sound! self) + (suspend) + ) + (while (and *target* (focus-test? *target* flut)) + (spawn-part-and-sound! self) + (suspend) + ) + (let ((s5-1 (current-time))) + (until (time-elapsed? s5-1 (seconds 1)) + (spawn-part-and-sound! self) + (suspend) + ) + ) + (go arg0) + ) + ) + +(defstate wait-for-return (flut) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as structure (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + (the-as structure #f) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-set! 0) + (ja-post) + (when (type? (-> self root) collide-shape) + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 prim-core collide-with) (collide-spec)) + ) + 0 + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (transform-post) + (sleep-code) + ) + ) + +(defstate die (flut) + :virtual #t + :enter (-> (method-of-type flut idle) enter) + :exit (-> (method-of-type flut idle) exit) + :code (behavior () + (change-parent self *entity-pool*) + (when (-> self count-lock) + (set! (-> self count-lock) #f) + (+! (-> *game-info* flut-count) -1) + ) + (when (-> self minimap) + (logior! (-> self minimap flags) (minimap-flag fade-out)) + (set! (-> self minimap) #f) + ) + (if (-> self skel effect) + (logior! (-> self skel effect flags) (effect-control-flag ecf1)) + ) + (when (logtest? (-> self flags) (flut-flag ff3)) + (set! (-> self root dynam gravity-max) 40960.0) + (set! (-> self root dynam gravity-length) 20480.0) + (vector-float*! + (-> self root dynam gravity) + (-> self root dynam gravity-normal) + (the-as float (-> self root dynam gravity-length)) + ) + ) + (cond + ((logtest? (-> self flags) (flut-flag ff1)) + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + ) + (else + (set-vector! (-> self root root-prim local-sphere) 0.0 1638.4 0.0 1638.4) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (logior! + (-> self root root-prim prim-core collide-with) + (collide-spec backgnd crate obstacle hit-by-others-list pusher) + ) + (set! (-> self root penetrated-by) (penetrate)) + 0 + ) + ) + (ja-channel-set! 1) + (cond + ((logtest? (-> self flags) (flut-flag ff3)) + (ja-no-eval :group! (-> self draw art-group data 29) + :num! (seek! (ja-aframe 65.0 0)) + :frame-num (ja-aframe 60.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 65.0 0))) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (ja-aframe 38.0 0)) + :frame-num (ja-aframe 25.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 38.0 0))) + ) + ) + ) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (while (nonzero? (-> self draw death-timer)) + (suspend) + ) + (ja-channel-set! 0) + (ja-post) + (if (and (-> self entity) (= (-> self entity extra process) self)) + (go-virtual wait-for-start) + ) + ) + :post (behavior () + (vector-v++! (-> self root transv) (compute-acc-due-to-gravity (-> self root) (new-stack-vector0) 0.0)) + (if (< (-> self root dynam gravity-max) (vector-length (-> self root transv))) + (vector-normalize! (-> self root transv) (-> self root dynam gravity-max)) + ) + (let ((v1-12 (-> self root)) + (a2-1 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> a2-1 collide-with) (collide-spec backgnd crate obstacle pusher)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> v1-12 pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-12 (-> v1-12 transv) a2-1 (meters 0)) + ) + (transform-post) + ) + ) + +(defbehavior flut-init flut ((arg0 entity-actor) (arg1 transformq) (arg2 handle) (arg3 flut-flag) (arg4 symbol)) + (let ((s1-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s1-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s1-0 reaction) cshape-reaction-default) + (set! (-> s1-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s1-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle obstacle-for-jak)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> v1-6 transform-index) 0) + (set-vector! (-> v1-6 local-sphere) 0.0 5734.4 0.0 7372.8) + (set! (-> s1-0 total-prims) (the-as uint 1)) + (set! (-> s1-0 root-prim) v1-6) + ) + (set! (-> s1-0 nav-radius) (* 0.75 (-> s1-0 root-prim local-sphere w))) + (let ((v1-9 (-> s1-0 root-prim))) + (set! (-> s1-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s1-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> self root) s1-0) + ) + (set! (-> self count-lock) #f) + (set! (-> self rider) arg2) + (set! (-> self flags) arg3) + (set! (-> self mode) arg4) + (set! (-> self minimap) #f) + (when arg0 + (process-entity-set! self arg0) + (if (logtest? (-> self entity extra kill-mask) (task-mask ctywide)) + (ctywide-entity-hack) + ) + (process-drawable-from-entity! self arg0) + (set-yaw-angle-clear-roll-pitch! (-> self root) (res-lump-float arg0 'rotoffset)) + ) + (when arg1 + (set! (-> self root trans quad) (-> arg1 trans quad)) + (quaternion-copy! (-> self root quat) (-> arg1 quat)) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self draw shadow-ctrl) *flut-shadow-control*) + (let ((v1-33 (-> self node-list data))) + (set! (-> v1-33 0 param0) (the-as (function cspace transformq none) cspace<-transformq+trans!)) + (set! (-> v1-33 0 param1) (the-as basic (-> self root trans))) + (set! (-> v1-33 0 param2) (the-as basic (-> self extra-trans))) + ) + (set! (-> self condition) (res-lump-value arg0 'index int :time -1000000000.0)) + (set! (-> self fact) + (new 'process 'fact-info self (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (if (not (logtest? arg3 (flut-flag ff0))) + (setup-masks (-> self draw) 0 2) + ) + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (set! (-> self color-index) (mod (the-as int (sar (the-as int arg3) 32)) (-> *flut-color-table* length))) + (flut-color-from-index (-> self color-index)) + (when (logtest? (-> self flags) (flut-flag ff1)) + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + ) + (if (and (-> self entity) (not (logtest? arg3 (flut-flag ff2)))) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :group 1 :fo-max 30) (-> self root trans) 0.0) + ) + (set! (-> self draw light-index) (the-as uint 30)) + (logior! (-> self mask) (process-mask crate)) + (cond + ((logtest? arg3 (flut-flag ff2)) + (go-virtual die) + ) + ((handle->process arg2) + (go-virtual idle) + ) + (else + (go-virtual wait-for-start) + ) + ) + ) + +(defmethod init-from-entity! ((this flut) (arg0 entity-actor)) + (flut-init + arg0 + (the-as transformq #f) + (the-as handle #f) + (the-as flut-flag (+ (shl (flut-random-color-index) 32) 1)) + 'normal + ) + ) diff --git a/goal_src/jak3/engine/target/flut/target-flut.gc b/goal_src/jak3/engine/target/flut/target-flut.gc index e9a5cb1aba..d7b94ce65a 100644 --- a/goal_src/jak3/engine/target/flut/target-flut.gc +++ b/goal_src/jak3/engine/target/flut/target-flut.gc @@ -7,3 +7,3668 @@ ;; DECOMP BEGINS +(deftype flut-bank (basic) + ((jump-height-min meters) + (jump-height-max meters) + (double-jump-height-min meters) + (double-jump-height-max meters) + (air-attack-speed meters) + (ground-timeout uint64) + ) + ) + + +(define *FLUT-bank* (new 'static 'flut-bank + :jump-height-min (meters 5) + :jump-height-max (meters 7) + :double-jump-height-min (meters 1) + :double-jump-height-max (meters 2) + :air-attack-speed (meters 20) + :ground-timeout #x96 + ) + ) + +(define *flut-walk-mods* (new 'static 'surface + :name 'run + :turnv 54613.332 + :turnvf 30.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 102400.0 + :target-speed 102400.0 + :seek0 1.5 + :seek90 3.0 + :seek180 2.0 + :fric 1.0 + :nonlin-fric-dist 0.1 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around gun-off) + ) + ) + +(define *flut-run-racer-mods* (new 'static 'surface + :name 'run + :turnv 54613.332 + :turnvf 30.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 1.5 + :seek90 3.0 + :seek180 2.0 + :fric 1.0 + :nonlin-fric-dist 0.1 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around gun-off) + ) + ) + +(define *flut-run-wild-mods* (new 'static 'surface + :name 'run + :turnv 54613.332 + :turnvf 30.0 + :turnvv 32768.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 204800.0 + :target-speed 204800.0 + :seek0 1.5 + :seek90 3.0 + :seek180 1.0 + :nonlin-fric-dist 0.1 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around gun-off) + ) + ) + +(define *flut-jump-wild-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 30.0 + :turnvv 16384.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 204800.0 + :target-speed 204800.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +(define *flut-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 102400.0 + :target-speed 102400.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +(define *flut-jump-racer-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +(define *flut-double-jump-mods* (new 'static 'surface + :name 'jump-double + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 102400.0 + :target-speed 102400.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.1 + :nonlin-fric-dist 10.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +(define *flut-double-jump-racer-mods* (new 'static 'surface + :name 'jump-double + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.1 + :nonlin-fric-dist 10.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +(define *flut-run-attack-mods* (new 'static 'surface + :name 'wheel-flip + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 143360.0 + :seek90 0.5 + :seek180 0.15 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flag no-turn-around turn-to-pad attack gun-off) + ) + ) + +(define *flut-air-attack-mods* (new 'static 'surface + :name 'flop + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 1.0 + :seek90 0.3 + :seek180 1.5 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flag air attack gun-off) + ) + ) + +(defun flut-leg-ik-callback ((arg0 joint-mod-ik) (arg1 object) (arg2 object) (arg3 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> arg3 quad)) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.0) + ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) + ) + (+! (-> arg0 user-position y) f0-1) + ) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-12 s5-0)) + (let ((a0-4 *up-vector*)) + (let ((a1-4 8192.0)) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> a0-4 quad)) + ) + (.lvf vf4 (&-> v1-12 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 (&-> s3-0 quad) vf6) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) + (a0-7 s2-0) + ) + (let ((v1-15 *up-vector*)) + (let ((a1-7 f0-11)) + (.mov vf7 a1-7) + ) + (.lvf vf5 (&-> v1-15 quad)) + ) + (.lvf vf4 (&-> s3-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 (&-> a0-7 quad) vf6) + ) + (let ((a0-8 s2-0)) + (let ((v1-16 *up-vector*)) + (let ((a1-8 (- f28-0))) + (.mov vf7 a1-8) + ) + (.lvf vf5 (&-> v1-16 quad)) + ) + (.lvf vf4 (&-> arg3 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 (&-> a0-8 quad) vf6) + ) + (let ((a1-9 s5-0)) + (let ((v1-17 s5-0)) + (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) + (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) + (.mov vf7 a2-6) + ) + (.lvf vf5 (&-> a0-10 quad)) + ) + (.lvf vf4 (&-> v1-17 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 (&-> a1-9 quad) vf6) + ) + ) + ) + (set-ik-target! arg0 s5-0) + ) + (none) + ) + ) + +;; WARN: Return type mismatch int vs object. +(defbehavior flut-update-ik target () + (local-vars (sv-720 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (the-as vector a1-0) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) + (let ((a1-6 (not (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> *target* target-flags))))) + (enable-set! s3-0 a1-6) + ) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-8 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-8) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (let ((a1-8 s0-0)) + (let ((a0-11 (-> v1-17 trans))) + (let ((v1-18 (-> v1-17 uvec))) + (let ((a2-8 (-> s3-0 hand-dist))) + (.mov vf7 a2-8) + ) + (.lvf vf5 (&-> v1-18 quad)) + ) + (.lvf vf4 (&-> a0-11 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 (&-> a1-8 quad) vf6) + ) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) + ) + ) + (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) + ) + (let ((a1-11 (-> gp-0 start-pos))) + (let ((v1-22 s0-0)) + (let ((a0-14 sv-720)) + (let ((a2-12 6144.0)) + (.mov vf7 a2-12) + ) + (.lvf vf5 (&-> a0-14 quad)) + ) + (.lvf vf4 (&-> v1-22 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 (&-> a1-11 quad) vf6) + ) + (let ((v1-23 (-> gp-0 move-dist)) + (f0-16 -20480.0) + ) + (vector-float*! v1-23 sv-720 f0-16) + ) + (let ((v1-25 gp-0)) + (set! (-> v1-25 radius) 4.096) + (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-25 ignore-process0) #f) + (set! (-> v1-25 ignore-process1) #f) + (set! (-> v1-25 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-25 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (set! (-> s1-0 quad) (-> gp-0 best-other-tri normal quad)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-16 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-16 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-14) + ) + ) + (let ((a1-18 s2-0)) + (let ((v1-32 (-> gp-0 start-pos))) + (let ((a0-29 (-> gp-0 move-dist))) + (let ((a2-15 f30-0)) + (.mov vf7 a2-15) + ) + (.lvf vf5 (&-> a0-29 quad)) + ) + (.lvf vf4 (&-> v1-32 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 (&-> a1-18 quad) vf6) + ) + (set! (-> s3-0 user-position quad) (-> s2-0 quad)) + (set! (-> s3-0 user-normal quad) (-> s1-0 quad)) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (set! (-> s3-0 user-position quad) (-> s0-0 quad)) + (set! (-> s3-0 user-normal quad) (-> *y-vector* quad)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + ) + ) + +(defbehavior target-flut-get-off? target () + (and (not (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + ) + (and (time-elapsed? (-> self control rider-time) (seconds 1)) (-> *setting-control* user-current pilot-exit)) + ) + ) + +(defbehavior target-flut-post-post target () + (vector+! (-> self flut flut-trans) (-> self control trans) (-> self control cspace-offset)) + (quaternion-copy! (the-as quaternion (-> self flut flut-quat)) (-> self control quat)) + (set! (-> self flut flut-scale quad) (-> self control scale quad)) + (let ((v1-8 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *flut-shadow-control* settings shadow-dir quad) v1-8) + ) + 0 + (none) + ) + +(defbehavior target-flut-wild-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self control remaining-ctrl-iterations) gp-1) + (flag-setup) + (if (< (-> self control force-turn-to-strength) 0.0) + (set! (-> self control force-turn-to-strength) (- 1.0 (-> self control cpad stick0-speed))) + ) + (build-conversions (-> self control transv)) + (do-rotations1) + (let ((s5-0 (new-stack-vector0))) + (read-pad s5-0) + (let ((f28-0 + (debounce-speed + (-> self control pad-magnitude) + (-> self control last-pad-magnitude) + (-> self control pad-xz-dir) + (-> self control last-pad-xz-dir) + ) + ) + ) + (when (!= (-> self control force-turn-to-strength) 0.0) + (let ((f0-12 (fmin 1.0 (-> self control force-turn-to-strength)))) + (set! (-> self control force-turn-to-strength) f0-12) + (let ((a1-3 (vector-float*! + (new 'stack-no-clear 'vector) + (if (= f28-0 0.0) + *zero-vector* + s5-0 + ) + f28-0 + ) + ) + (a2-2 + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control force-turn-to-direction) + (-> self control force-turn-to-speed) + ) + ) + ) + (vector-lerp! s5-0 a1-3 a2-2 f0-12) + ) + ) + (set! f28-0 (vector-length s5-0)) + (vector-normalize! s5-0 1.0) + ) + (turn-to-vector s5-0 f28-0) + ) + ) + (set-vector! + (-> self control transv-ctrl) + 0.0 + (-> self control transv-ctrl y) + (-> self control current-surface target-speed) + 1.0 + ) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (pre-collide-setup) + (let ((a2-3 (new 'stack-no-clear 'collide-query))) + (let ((v1-33 (-> self control))) + (set! (-> a2-3 collide-with) (-> v1-33 root-prim prim-core collide-with)) + (set! (-> a2-3 ignore-process0) self) + (set! (-> a2-3 ignore-process1) #f) + (set! (-> a2-3 ignore-pat) (-> v1-33 pat-ignore-mask)) + ) + (set! (-> a2-3 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-3 (meters 1)) + ) + (bend-gravity) + (post-flag-setup) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (ja-post) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (target-flut-post-post) + 0 + (none) + ) + +(defbehavior target-flut-post target () + (cond + ((and (= (-> self flut mode) 'wild) (not (logtest? (-> self focus-status) (focus-status dead hit)))) + (target-flut-wild-post) + ) + (else + (target-post) + (target-flut-post-post) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defbehavior target-flut-falling-anim-trans target () + (cond + ((not (-> self flut as-daxter?)) + (let ((v1-4 (ja-group))) + (b! + (and v1-4 (or (= v1-4 jakb-flut-jump-loop-ja) (= v1-4 jakb-flut-jump-land-ja))) + cfg-10 + :delay (empty-form) + ) + ) + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! jakb-flut-jump-loop-ja) + (b! #t cfg-35 :delay (nop!)) + (label cfg-10) + (cond + ((and (logtest? (-> self control status) (collide-status on-surface)) + (let ((v1-17 (ja-group))) + (not (and v1-17 (= v1-17 jakb-flut-jump-land-ja))) + ) + ) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! jakb-flut-jump-land-ja) + ) + ((let ((v1-26 (ja-group))) + (and v1-26 (= v1-26 jakb-flut-jump-loop-ja)) + ) + (ja :num! (loop!)) + ) + ((let ((v1-35 (ja-group))) + (and v1-35 (= v1-35 jakb-flut-jump-land-ja)) + ) + (ja :num! (seek!)) + ) + ) + (label cfg-35) + ) + (else + (let ((v1-47 (ja-group))) + (cond + ((not (and v1-47 (= v1-47 jakb-mech-death-a-ja))) + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! jakb-mech-death-a-ja) + ) + ((let ((v1-56 (ja-group))) + (and v1-56 (= v1-56 jakb-mech-death-a-ja)) + ) + (ja :num! (loop!)) + ) + ) + ) + ) + ) + 0 + ) + +;; WARN: Return type mismatch symbol vs object. +(defbehavior target-flut-hit-ground-anim target () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 jakb-flut-jump-loop-ja)) + (if (!= (-> self skel root-channel 0) (-> self skel channel)) + (ja-channel-push! 2 (seconds 0.05)) + (ja-channel-set! 2) + ) + (ja :group! jakb-flut-jump-land-ja :num! min) + (ja :chan 1 :group! jakb-flut-jump-forward-land-ja :num! min) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + (ja :chan 1 :num! (chan 0)) + ) + #f + ) + ((let ((v1-33 (ja-group))) + (and v1-33 (or (= v1-33 jakb-flut-jump-ja) (= v1-33 jakb-flut-jump-land-ja))) + ) + #f + ) + ((let ((v1-39 (ja-group))) + (and v1-39 (= v1-39 jakb-flut-double-jump-ja)) + ) + (ja-channel-set! 1) + (ja-no-eval :group! jakb-flut-jump-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + #f + ) + ((let ((v1-68 (ja-group))) + (and v1-68 (or (= v1-68 jakb-flut-air-attack-ja) (= v1-68 jakb-flut-air-attack-loop-ja))) + ) + (ja-channel-set! 1) + (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + #f + ) + ) + ) + ) + +(defbehavior target-flut-standard-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'flut + ) + (else + (case arg2 + (('event-step) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.07)) + ) + (('end-mode) + (case (-> arg3 param 0) + (('flut) + (-> self flut mode) + (go target-flut-get-off (process->handle arg0)) + ) + ) + ) + (('touched) + (cond + ((= (-> self flut mode) 'racer) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (-> arg3 param 0)) + (set! (-> a1-2 param 1) + (the-as + uint + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> self flut attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'flut) + (penetrate-using (-> self control penetrate-using)) + ) + ) + ) + ) + (let ((s5-0 (send-event-function arg0 a1-2))) + (when s5-0 + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "flut-punch-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + (let* ((v1-24 (-> self game)) + (a0-27 (+ (-> v1-24 attack-id) 1)) + ) + (set! (-> v1-24 attack-id) a0-27) + (set! (-> self flut attack-id) a0-27) + ) + ) + s5-0 + ) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-flut-hit + ) + ) + (('shove) + (when (not (and (-> self next-state) (= (-> self next-state name) 'target-hit))) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 168) + (when (not (logtest? (-> self attack-info-rec mask) (attack-mask attacker))) + (set! (-> self attack-info-rec attacker) (process->handle arg0)) + (logior! (-> self attack-info-rec mask) (attack-mask attacker)) + ) + (go target-flut-hit 'shove (-> self attack-info-rec)) + ) + ) + (('falling) + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-flut-death))) + (go target-flut-falling #f) + ) + ) + (('swim) + (send-event + self + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'drown)) + ) + ) + ) + (('change-mode) + (case (-> arg3 param 0) + (('grab) + (when (not (focus-test? self dead)) + (if (not (-> arg3 param 1)) + #t + (go target-flut-grab) + ) + ) + ) + (('kanga) + (go target-flut-kanga-catch (process->handle arg0) 'kanga) + ) + (('normal) + (go target-flut-get-off (process->handle arg0)) + ) + ) + ) + (('eject) + (go target-flut-eject #f) + ) + (('clone-anim) + (go target-flut-clone-anim (process->handle (the-as process (-> arg3 param 0)))) + ) + (('mode-time) + (- (current-time) (-> self flut flut-start-time)) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + +(defbehavior target-flut-dangerous-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (if ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 1920) + ) + (target-send-attack + arg0 + (-> self control danger-mode) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + (target-flut-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-flut-hit + ) + ) + (else + (target-flut-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + +(defbehavior target-fldax-enter target () + (ja-channel-set! 0) + (set! (-> self flut art-group-backup) (-> self draw art-group)) + (set! (-> self draw art-group) (-> self sidekick 0 draw art-group)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds2)) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'indax) + ) + +(defbehavior target-fldax-exit target () + (ja-channel-set! 0) + (set! (-> self draw art-group) (-> self flut art-group-backup)) + (logclear! (-> self draw status) (draw-control-status no-draw-bounds2)) + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ) + +(defstate target-flut-start (target) + :event target-flut-standard-event-handler + :exit (behavior () + (when (not (and (-> self next-state) + (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-flut-stance) + (= v1-3 'target-flut-walk) + (= v1-3 'target-flut-run-wild) + (= v1-3 'target-flut-jump) + (= v1-3 'target-flut-double-jump) + (= v1-3 'target-flut-hit-ground) + (= v1-3 'target-flut-falling) + (= v1-3 'target-flut-running-attack) + (= v1-3 'target-flut-air-attack) + (= v1-3 'target-flut-air-attack-hit-ground) + (= v1-3 'target-flut-hit) + (= v1-3 'target-flut-death) + (= v1-3 'target-flut-get-on) + (= v1-3 'target-flut-get-off) + (= v1-3 'target-flut-get-off-jump) + (= v1-3 'target-flut-eject) + (= v1-3 'target-flut-grab) + (= v1-3 'target-flut-clone-anim) + (= v1-3 'target-flut-kanga-catch) + ) + ) + ) + ) + (+! (-> *game-info* flut-count) -1) + (let ((v1-7 (-> self manipy))) + (when v1-7 + (deactivate (-> v1-7 0)) + (set! (-> self manipy) (the-as (pointer manipy) #f)) + ) + ) + (if (-> self flut as-daxter?) + (target-fldax-exit) + ) + (logclear! (-> self focus-status) (focus-status flut)) + (set! (-> self control mod-surface) *walk-mods*) + (logclear! (-> self target-flags) (target-flags tf6)) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (set! (-> self control cspace-offset quad) (the-as uint128 0)) + (remove-setting! 'sound-flava) + (setting-control-method-14 *setting-control* (-> self flut mode-sound-bank)) + (set! (-> self flut mode-sound-bank) #f) + (set! (-> self control pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :board #x1) + ) + (remove-setting! 'string-spline-accel) + (remove-setting! 'string-spline-max-move) + (remove-setting! 'string-spline-accel-player) + (remove-setting! 'string-spline-max-move-player) + (remove-setting! 'fov) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-height) + (remove-setting! 'string-max-height) + (target-exit) + ) + ) + :code (behavior ((arg0 handle) (arg1 symbol) (arg2 int)) + (local-vars + (sv-96 process) + (sv-112 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) + (sv-128 vector) + (sv-144 entity-actor) + ) + (target-exit) + (+! (-> *game-info* flut-count) 1) + (set-setting! 'string-spline-accel 'abs (meters 1) 0) + (set-setting! 'string-spline-max-move 'abs (meters 10) 0) + (set-setting! 'string-spline-accel-player 'abs (meters 1) 0) + (set-setting! 'string-spline-max-move-player 'abs (meters 10) 0) + (case arg1 + (('wild) + (set-setting! 'string-min-length 'abs (meters 5) 0) + (set-setting! 'string-max-length 'abs (meters 5) 0) + (set-setting! 'string-min-height 'abs (meters 3) 0) + (set-setting! 'string-max-height 'abs (meters 3) 0) + (set-setting! 'fov 'abs (degrees 95.0) 0) + ) + ) + (when (zero? (-> self flut)) + (set! (-> self flut) (new 'process 'flut-info)) + (set! (-> self flut mode-sound-bank) #f) + ) + (set! (-> self flut stick-lock) #f) + (set! arg2 (cond + ((>= arg2 0) + (empty) + arg2 + ) + (else + (flut-random-color-index) + ) + ) + ) + (set! (-> self flut color-index) arg2) + (case arg1 + ((#t) + (set! (-> self flut mode) (the-as basic 'normal)) + (set! (-> self flut as-daxter?) #f) + ) + (('racer) + (set! (-> self flut mode) (the-as basic arg1)) + (set! (-> self flut as-daxter?) #f) + ) + (('wild) + (set! (-> self flut mode) (the-as basic arg1)) + (set! (-> self flut as-daxter?) #t) + ) + (else + (set! (-> self flut mode) (the-as basic arg1)) + (set! (-> self flut as-daxter?) #f) + ) + ) + (if (-> self flut as-daxter?) + (target-fldax-enter) + ) + (let* ((v1-34 (-> self game)) + (a0-22 (+ (-> v1-34 attack-id) 1)) + ) + (set! (-> v1-34 attack-id) a0-22) + (set! (-> self flut attack-id) a0-22) + ) + (set! (-> self flut flap-sound-id) (the-as uint (new-sound-id))) + (set! (-> self flut mode-sound-bank) (the-as connection (add-setting! 'mode-sound-bank 'modeflut 0.0 0))) + (set! (-> self flut entity) #f) + (let ((v1-41 (handle->process arg0))) + (if v1-41 + (set! (-> self flut entity) (-> v1-41 entity)) + ) + ) + (when (not (and (-> self flut entity) (logtest? (-> self flut entity extra level info level-flags) (level-flags lf8))) + ) + (dotimes (v1-49 (-> *level* length)) + (let ((a0-40 (-> *level* level v1-49))) + (when (= (-> a0-40 status) 'active) + (when (logtest? (-> a0-40 info level-flags) (level-flags lf8)) + (let ((a0-42 (-> a0-40 entity data 0 entity))) + (when a0-42 + (set! (-> self flut entity) (the-as entity-actor a0-42)) + (goto cfg-36) + ) + ) + ) + ) + ) + ) + ) + (label cfg-36) + (target-collide-set! 'flut 0.0) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control ctrl-xz-vel) 0.0) + (logior! (-> self focus-status) (focus-status flut)) + (set-time! (-> self flut flut-start-time)) + (set! (-> self control pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nomech #x1)) + (let ((s4-1 (current-time))) + (label cfg-37) + (let ((s3-0 (-> self entity)) + (s2-0 (-> self level)) + ) + (process-entity-set! self (-> self flut entity)) + (let ((s1-0 (get-process *8k-dead-pool* manipy #x20000 1))) + (set! (-> self manipy) + (the-as + (pointer manipy) + (when s1-0 + (let ((t9-18 (method-of-type manipy activate))) + (t9-18 (the-as manipy s1-0) self "manipy" (the-as pointer #x70004000)) + ) + (let ((s0-0 run-function-in-process)) + (set! sv-96 s1-0) + (set! sv-112 manipy-init) + (set! sv-128 (-> self control trans)) + (set! sv-144 (-> self entity)) + (let ((t0-10 (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f))) + (t1-10 'collide-shape-moving) + (t2-0 0) + ) + ((the-as (function object object object object object object object none) s0-0) + sv-96 + sv-112 + sv-128 + sv-144 + t0-10 + t1-10 + t2-0 + ) + ) + ) + (-> s1-0 ppointer) + ) + ) + ) + ) + (set! (-> self entity) s3-0) + (set! (-> self level) s2-0) + ) + (when (not (or (-> self manipy) (time-elapsed? s4-1 (seconds 3)))) + (suspend) + (goto cfg-37) + ) + ) + (when (-> self manipy) + (send-event + (ppointer->process (-> self manipy)) + 'trans-hook + (lambda :behavior target + () + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (ppointer->process (-> self parent)))) + (set! (-> self control trans quad) (-> (the-as target gp-0) flut flut-trans quad)) + (let ((v1-5 (-> (the-as target gp-0) flut flut-quat quad))) + (set! (-> self control quat quad) v1-5) + ) + (set! (-> self control scale quad) (-> (the-as target gp-0) flut flut-scale quad)) + (set! (-> self control ground-pat material) + (the-as int (-> (the-as target gp-0) control ground-pat material)) + ) + (set! (-> self draw light-index) (-> (the-as target gp-0) draw light-index)) + (let ((t9-0 flut-color-from-index) + (v1-14 (-> self parent)) + ) + (t9-0 (-> (the-as target (if v1-14 + (the-as target (-> v1-14 0 self)) + ) + ) + flut + color-index + ) + ) + ) + (let ((v1-18 (-> self draw color-mult))) + (let ((a0-19 (-> self draw color-mult)) + (a1-1 (-> (the-as target gp-0) draw color-mult)) + ) + (.lvf vf4 (&-> a0-19 quad)) + (.lvf vf5 (&-> a1-1 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> v1-18 quad) vf6) + ) + (let ((v0-1 (-> (the-as target gp-0) draw color-emissive quad))) + (set! (-> self draw color-emissive quad) v0-1) + v0-1 + ) + ) + ) + ) + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'loop) + (send-event (ppointer->process (-> self manipy)) 'art-joint-anim "flut-get-on" 0) + (send-event (ppointer->process (-> self manipy)) 'blend-shape #t) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior target + () + (set! (-> self state-hook) #f) + (let ((v1-1 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *flut-shadow-control* settings shadow-dir quad) v1-1) + ) + (set! (-> self draw shadow-ctrl) *flut-shadow-control*) + (set! (-> self mech-ik 0) (new 'process 'joint-mod-ik self 7 3104.768)) + (set! (-> self mech-ik 1) (new 'process 'joint-mod-ik self 15 3104.768)) + (dotimes (v1-5 2) + (let ((a0-6 (-> self mech-ik v1-5))) + (set! (-> a0-6 elbow-pole-vector-axis) (the-as uint 2)) + (set! (-> a0-6 elbow-rotation-axis) (the-as uint 0)) + (set! (-> a0-6 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) + (logior! (-> a0-6 flags) (joint-mod-ik-flags elbow-trans-neg)) + ) + ) + #f + ) + ) + (send-event (ppointer->process (-> self manipy)) 'post-hook (lambda () (flut-update-ik))) + (case (-> self flut mode) + (('wild) + (send-event (ppointer->process (-> self manipy)) 'segment 0 16) + (set! (-> self flut wild-turn-time) (+ (current-time) (rand-vu-int-range (seconds 1) (seconds 2)))) + (set! (-> self flut wild-turn-rate) (rand-vu-float-range -32768.0 32768.0)) + ) + ) + ) + (remove-exit) + (cond + ((or (= arg1 #t) (= arg1 'racer)) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (go target-flut-stance) + ) + (else + (go target-flut-get-on arg0) + ) + ) + ) + :post target-post + ) + +(defstate target-flut-stance (target) + :event target-flut-standard-event-handler + :enter (behavior () + (set! (-> self control mod-surface) *flut-walk-mods*) + ) + :exit (-> target-flut-start exit) + :trans (behavior () + (if (= (-> self flut mode) 'wild) + (go target-flut-run-wild) + ) + (if (move-legs?) + (go target-flut-walk) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-flut-running-attack) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-flut-get-off?) + ) + (go target-flut-get-off (the-as handle #f)) + ) + ) + :code (behavior () + (let ((gp-0 22)) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 jakb-flut-walk-ja) (= v1-2 jakb-flut-run-squash-ja))) + (set! gp-0 60) + ) + ((let ((v1-9 (ja-group))) + (and v1-9 (= v1-9 jakb-flut-get-on-ja)) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-24 (ja-group))) + (and v1-24 (= v1-24 jakb-flut-smack-surface-ja)) + ) + (ja-no-eval :group! jakb-flut-smack-surface-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-54 (ja-group))) + (and v1-54 (= v1-54 jakb-flut-hit-back-ja)) + ) + (ja-no-eval :group! jakb-flut-hit-back-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-84 (ja-group))) + (and v1-84 (= v1-84 jakb-flut-running-attack-ja)) + ) + (ja-no-eval :group! jakb-flut-running-attack-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + (cond + ((-> self flut as-daxter?) + (let ((v1-116 (ja-group))) + (if (not (and v1-116 (= v1-116 jakb-mech-pull-ja))) + (ja-channel-push! 1 (the-as time-frame gp-0)) + ) + ) + (ja :group! jakb-mech-pull-ja) + ) + (else + (let ((v1-126 (ja-group))) + (if (not (and v1-126 (= v1-126 jakb-flut-idle-ja))) + (ja-channel-push! 1 (the-as time-frame gp-0)) + ) + ) + (ja :group! jakb-flut-idle-ja) + ) + ) + ) + (until #f + (can-play-stance-amibent?) + (suspend) + (ja :num! (loop!)) + ) + #f + ) + :post target-flut-post + ) + +(defstate target-flut-walk (target) + :event target-flut-standard-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (case (-> self flut mode) + (('racer) + (set! (-> self control mod-surface) *flut-run-racer-mods*) + ) + (else + (set! (-> self control mod-surface) *flut-walk-mods*) + ) + ) + (set! (-> self control unknown-word04) (the-as uint (-> self control mod-surface turnv))) + (set! (-> self control did-move-to-pole-or-max-jump-height) (-> self control mod-surface target-speed)) + ) + :exit (behavior () + (set! (-> self control mod-surface turnv) (the-as float (-> self control unknown-word04))) + (set! (-> self control mod-surface target-speed) (-> self control did-move-to-pole-or-max-jump-height)) + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + (let ((v1-9 (-> self skel effect))) + (set! (-> v1-9 channel-offset) 0) + ) + 0 + ((-> target-flut-start exit)) + ) + :trans (behavior () + (if (= (-> self flut mode) 'wild) + (go target-flut-run-wild) + ) + (if (not (move-legs?)) + (go target-flut-stance) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-flut-running-attack) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + (let ((f30-0 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control)))))) + (set! (-> self control mod-surface turnv) (lerp-scale + (the-as float (-> self control unknown-word04)) + (* 4.0 (the-as float (-> self control unknown-word04))) + f30-0 + 8192.0 + 21845.334 + ) + ) + (if (and (= (-> self control surf name) '*tar-surface*) (< 8192.0 f30-0)) + (seek! (-> self control mod-surface target-speed) 4096.0 (* 245760.0 (seconds-per-frame))) + (seek! + (-> self control mod-surface target-speed) + (-> self control did-move-to-pole-or-max-jump-height) + (* 81920.0 (seconds-per-frame)) + ) + ) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-flut-get-off?) + ) + (go target-flut-get-off (the-as handle #f)) + ) + ) + :code (behavior () + (let ((f26-0 0.0) + (f30-0 0.0) + (f28-0 0.0) + ) + (let ((gp-0 22)) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 jakb-flut-idle-ja)) + (set! gp-0 60) + ) + ((let ((v1-9 (ja-group))) + (and v1-9 + (or (= v1-9 jakb-flut-jump-ja) + (= v1-9 jakb-flut-jump-loop-ja) + (= v1-9 jakb-flut-air-attack-ja) + (= v1-9 jakb-flut-air-attack-land-ja) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.08)) + (ja-no-eval :group! jakb-flut-run-squash-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + (let ((v1-39 (ja-group))) + (set! f28-0 + (cond + ((and v1-39 (= v1-39 jakb-flut-run-squash-ja)) + (ja-channel-set! 3) + (set! f30-0 1.0) + 1.0 + ) + (else + (let ((v1-47 (ja-group))) + (cond + ((and v1-47 (= v1-47 jakb-flut-walk-ja)) + (set! f26-0 (ja-frame-num 0)) + (set! f30-0 (-> self skel root-channel 1 frame-interp (-> self skel active-frame-interp))) + (-> self skel root-channel 2 frame-interp (-> self skel active-frame-interp)) + ) + (else + (ja-channel-push! 3 (the-as time-frame gp-0)) + f28-0 + ) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! jakb-flut-walk-ja :num! (loop!) :dist 20480.0 :frame-num f26-0) + (ja-no-eval :chan 1 + :group! jakb-flut-jog-ja + :num! (identity f26-0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :dist 47104.0 + ) + (ja-no-eval :chan 2 + :group! jakb-flut-run-ja + :num! (identity f26-0) + :frame-interp0 f28-0 + :frame-interp1 f28-0 + :dist 53248.0 + ) + (until #f + (suspend) + (let ((f24-0 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 36864.0 40960.0)) + (f26-1 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 49152.0 77824.0)) + ) + (set! f30-0 (seek f30-0 f24-0 (* 4.0 (seconds-per-frame)))) + (set! f28-0 (seek f28-0 f26-1 (seconds-per-frame))) + ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja :chan 2 :frame-interp0 f28-0 :frame-interp1 f28-0) + (cond + ((< 0.5 f28-0) + (let ((v1-97 (-> self skel effect))) + (set! (-> v1-97 channel-offset) 2) + ) + 0 + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + ) + ((< 0.9 f30-0) + (let ((v1-103 (-> self skel effect))) + (set! (-> v1-103 channel-offset) 1) + ) + 0 + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + ) + (else + (let ((v1-108 (-> self skel effect))) + (set! (-> v1-108 channel-offset) 0) + ) + 0 + (logior! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + ) + ) + (let* ((f0-19 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) + (f0-21 (/ (* 58.0 (-> self control ctrl-xz-vel)) (* 60.0 f0-19))) + ) + (ja :num! (loop! f0-21)) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + ) + ) + #f + ) + :post target-flut-post + ) + +(defstate target-flut-run-wild (target) + :parent target-flut-walk + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *flut-run-wild-mods*) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + (let ((v1-3 (-> self skel effect))) + (set! (-> v1-3 channel-offset) 0) + ) + 0 + ((-> target-flut-start exit)) + ) + :trans (behavior () + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) + (< 40960.0 (-> self control ctrl-xz-vel)) + (< 0.7 (-> self control touch-angle)) + (< (vector-dot (-> self control wall-contact-normal) (-> self control dynam gravity-normal)) 0.3) + ) + (if (logtest? (-> self control status) (collide-status touch-actor)) + (send-event self 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 0.5)) + (angle 'shove) + ) + ) + ) + (send-event self 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 2)) + (angle 'shove) + (mode 'death) + ) + ) + ) + ) + ) + (when (time-elapsed? (-> self flut flut-start-time) (seconds 5)) + (if (and (< (target-move-dist (seconds 1)) 409.6) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + (send-event + self + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'death)) + ) + ) + ) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + ) + :code (behavior () + (local-vars (f0-17 float) (f1-2 float)) + (let ((f28-0 0.0) + (f30-0 0.0) + ) + (let ((f24-0 0.0) + (f26-0 0.0) + ) + 22 + (let ((gp-0 60) + (v1-3 (ja-group)) + ) + (cond + ((and v1-3 (= v1-3 jakb-mech-pull-ja)) + (set! f28-0 (ja-frame-num 0)) + (set! f24-0 (-> self skel root-channel 1 frame-interp (-> self skel active-frame-interp))) + (set! f26-0 (-> self skel root-channel 2 frame-interp (-> self skel active-frame-interp))) + ) + ((let ((v1-17 (ja-group))) + (and v1-17 (or (= v1-17 jakb-mech-get-on-ja) (= v1-17 jakb-mech-death-a-ja))) + ) + (ja-channel-push! 1 (seconds 0.08)) + (ja-no-eval :group! jakb-mech-dummy7-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-push! 3 (the-as time-frame gp-0)) + ) + (else + (ja-channel-push! 3 (the-as time-frame gp-0)) + ) + ) + ) + (ja-no-eval :group! jakb-mech-pull-ja :num! (loop!) :dist 131072.0 :frame-num f28-0) + (ja-no-eval :chan 1 + :group! jakb-mech-dummy4-ja + :num! (identity f28-0) + :frame-interp0 f24-0 + :frame-interp1 f24-0 + :dist 131072.0 + ) + (ja-no-eval :chan 2 + :group! jakb-mech-dummy5-ja + :num! (identity f28-0) + :frame-interp0 f26-0 + :frame-interp1 f26-0 + :dist 131072.0 + ) + ) + (quaternion-copy! (-> self flut prev-quat) (-> self control quat)) + (until #f + (suspend) + (let* ((f0-12 (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + 0.0 + (deg-diff (y-angle (-> self control)) (vector-y-angle (-> self control to-target-pt-xz))) + ) + ) + (f0-13 (lerp-scale 1.0 -1.0 f0-12 -21845.334 21845.334)) + ) + (set! f30-0 (seek f30-0 f0-13 (* 2.0 (seconds-per-frame)))) + ) + (cond + ((>= f30-0 0.0) + (set! f0-17 f30-0) + (set! f1-2 0.0) + ) + (else + (set! f1-2 (- f30-0)) + (set! f0-17 0.0) + ) + ) + (ja :chan 1 :frame-interp0 f1-2 :frame-interp1 f1-2) + (ja :chan 2 :frame-interp0 f0-17 :frame-interp1 f0-17) + (quaternion-copy! (-> self flut prev-quat) (-> self control quat)) + (let ((v1-94 (-> self skel effect))) + (set! (-> v1-94 channel-offset) 0) + ) + 0 + (logior! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + (let* ((f0-19 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) + (f0-21 (/ (* 58.0 (-> self control ctrl-xz-vel)) (* 60.0 f0-19))) + ) + (ja :num! (loop! f0-21)) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + ) + ) + #f + ) + ) + +(defstate target-flut-falling (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (when (and (= message 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 6) + ) + (< 0.0 (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control trans-old) (-> self control trans)) + ) + ) + ) + (send-event proc 'bonk (-> block param 0) (-> self control ground-impact-vel)) + (when (target-send-attack + proc + 'flut-bonk + (the-as touching-shapes-entry (-> block param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + ) + ) + (case message + (('jump) + (go target-flut-jump (the-as float (-> block param 0)) (the-as float (-> block param 0))) + ) + (else + (target-flut-standard-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 object)) + (set! (-> self control mod-surface) *flut-jump-mods*) + (set-time! (-> self state-time)) + ) + :exit (-> target-flut-start exit) + :trans (behavior () + (when (or (logtest? (-> self control status) (collide-status on-surface)) + (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (and (time-elapsed? (-> self state-time) (the-as time-frame (/ (the-as int (-> *TARGET-bank* stuck-time)) 2))) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-flut-hit-ground) + ) + (seek! + (-> self control unknown-float35) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control ctrl-xz-vel))))) + (seconds-per-frame) + ) + ) + :code (behavior ((arg0 object)) + (cond + ((not (-> self flut as-daxter?)) + (let ((v1-4 (ja-group))) + (cond + ((and v1-4 (= v1-4 jakb-flut-jump-loop-ja)) + ) + (else + (let ((v1-10 (ja-group))) + (if (and v1-10 (= v1-10 jakb-flut-double-jump-ja)) + (ja-channel-push! 2 (seconds 0.2)) + (ja-channel-push! 2 (seconds 0.5)) + ) + ) + ) + ) + ) + (ja-no-eval :group! jakb-flut-jump-loop-ja :num! (loop!) :frame-num 0.0) + (let ((gp-0 (-> self skel root-channel 1))) + (let ((f0-2 (-> self control unknown-float35))) + (set! (-> gp-0 frame-interp 1) f0-2) + (set! (-> gp-0 frame-interp 0) f0-2) + ) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + (else + (let ((v1-32 (ja-group))) + (cond + ((and v1-32 (= v1-32 jakb-mech-death-a-ja)) + ) + (else + (ja-channel-push! 1 (seconds 0.5)) + ) + ) + ) + (ja-no-eval :group! jakb-mech-death-a-ja :num! (loop!) :frame-num 0.0) + ) + ) + (until #f + (suspend) + (ja :num! (loop! max)) + (when (>= (ja-group-size) 2) + (let ((a0-20 (-> self skel root-channel 1))) + (let ((f0-8 (-> self control unknown-float35))) + (set! (-> a0-20 frame-interp 1) f0-8) + (set! (-> a0-20 frame-interp 0) f0-8) + ) + (set! (-> a0-20 param 0) 0.0) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim #f) num-func-chan) + ) + ) + ) + #f + ) + :post target-flut-post + ) + +(defstate target-flut-jump (target) + :event (-> target-flut-falling event) + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (case (-> self flut mode) + (('wild) + (set! (-> self control mod-surface) *flut-jump-wild-mods*) + ) + (('racer) + (set! (-> self control mod-surface) *flut-jump-racer-mods*) + ) + (else + (set! (-> self control mod-surface) *flut-jump-mods*) + ) + ) + (set! (-> self control unknown-float36) + (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control ctrl-xz-vel))))) + ) + (set! (-> self control unknown-float35) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control ctrl-xz-vel))))) + ) + ) + :exit (behavior () + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (set! (-> self control unknown-float36) + (fmax + (-> self control unknown-float36) + (* 0.003921569 (the float (-> *cpad-list* cpads (-> self control cpad number) abutton 6))) + ) + ) + ((-> target-flut-falling trans)) + (case (-> self flut mode) + (('wild) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) + (< 40960.0 (-> self control ctrl-xz-vel)) + (< 0.7 (-> self control touch-angle)) + (< (vector-dot (-> self control wall-contact-normal) (-> self control dynam gravity-normal)) 0.3) + ) + (if (logtest? (-> self control status) (collide-status touch-actor)) + (send-event self 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 0.5)) + (angle 'shove) + ) + ) + ) + (send-event self 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 2)) + (angle 'shove) + (mode 'death) + ) + ) + ) + ) + ) + ) + (else + (if (and (cpad-pressed? (-> self control cpad number) x) + (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 40960.0) + (not (logtest? (water-flag touch-water) (-> self water flags))) + (not (logtest? (target-flags prevent-jump prevent-double-jump) (-> self target-flags))) + (< 4096.0 (target-height-above-ground)) + ) + (go target-flut-double-jump (-> *FLUT-bank* double-jump-height-min) (-> *FLUT-bank* double-jump-height-max)) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) + (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 61440.0) + (and (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (time-elapsed? (-> self control last-time-of-stuck) (the-as time-frame (-> *TARGET-bank* stuck-timeout))) + (not (logtest? (-> self target-flags) (target-flags prevent-attack))) + (not (logtest? (-> self control current-surface flags) (surface-flag no-attack no-hands))) + ) + ) + (go target-flut-air-attack (-> *FLUT-bank* air-attack-speed)) + ) + ) + ) + (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (and (time-elapsed? (-> self state-time) (seconds 0.1)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + enter-state + 'stuck + (go target-flut-hit-ground) + ) + (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + ) + :code (behavior ((arg0 float) (arg1 float)) + (cond + ((not (-> self flut as-daxter?)) + (ja-channel-push! 2 (seconds 0.12)) + (ja :group! jakb-flut-jump-ja :num! min) + (let ((a0-3 (-> self skel root-channel 1))) + (let ((f0-1 (-> self control unknown-float35))) + (set! (-> a0-3 frame-interp 1) f0-1) + (set! (-> a0-3 frame-interp 0) f0-1) + ) + (set! (-> a0-3 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-ja)) + (set! (-> a0-3 param 0) 0.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim jakb-flut-jump-forward-ja) num-func-chan) + ) + (suspend) + (ja :group! jakb-flut-jump-ja :num! (+!)) + (let ((a0-5 (-> self skel root-channel 1))) + (let ((f0-4 (-> self control unknown-float35))) + (set! (-> a0-5 frame-interp 1) f0-4) + (set! (-> a0-5 frame-interp 0) f0-4) + ) + (set! (-> a0-5 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-ja)) + (set! (-> a0-5 param 0) 0.0) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim jakb-flut-jump-forward-ja) num-func-chan) + ) + (suspend) + 0 + ) + (else + (ja-channel-push! 1 (seconds 0.12)) + (ja :group! jakb-mech-get-on-ja :num! min) + (suspend) + (ja :group! jakb-mech-get-on-ja :num! (+!)) + (suspend) + 0 + ) + ) + (until (ja-done? 0) + (let ((f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f0-12 (/ (- 10.0 (ja-aframe-num 0)) (* (ja-step 0) (ja-speed 0)))) + ) + (ja :num! (seek! max (if (and (< 0.0 f30-0) (< 0.0 f0-12)) + (fmin (fmin 3.0 f0-12) (/ (* 5.0 f0-12) (the float (time-to-apex f30-0 -245760.0)))) + 1.0 + ) + ) + ) + ) + (when (>= (ja-group-size) 2) + (let ((a0-15 (-> self skel root-channel 1))) + (let ((f0-18 (-> self control unknown-float35))) + (set! (-> a0-15 frame-interp 1) f0-18) + (set! (-> a0-15 frame-interp 0) f0-18) + ) + (set! (-> a0-15 param 0) 0.0) + (joint-control-channel-group-eval! a0-15 (the-as art-joint-anim #f) num-func-chan) + ) + ) + (suspend) + ) + (cond + ((not (-> self flut as-daxter?)) + (ja-no-eval :group! jakb-flut-jump-loop-ja :num! (loop!) :frame-num 0.0) + (let ((a0-18 (-> self skel root-channel 1))) + (let ((f0-22 (-> self control unknown-float35))) + (set! (-> a0-18 frame-interp 1) f0-22) + (set! (-> a0-18 frame-interp 0) f0-22) + ) + (set! (-> a0-18 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-loop-ja)) + (set! (-> a0-18 param 0) 0.0) + (joint-control-channel-group-eval! a0-18 (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) num-func-chan) + ) + (until #f + (suspend) + (ja :group! jakb-flut-jump-loop-ja :num! (loop!)) + (let ((a0-20 (-> self skel root-channel 1))) + (let ((f0-25 (-> self control unknown-float35))) + (set! (-> a0-20 frame-interp 1) f0-25) + (set! (-> a0-20 frame-interp 0) f0-25) + ) + (set! (-> a0-20 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-loop-ja)) + (set! (-> a0-20 param 0) 0.0) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) num-func-chan) + ) + ) + #f + ) + (else + (ja-no-eval :group! jakb-mech-death-a-ja :num! (loop!) :frame-num 0.0) + (until #f + (suspend) + (ja :group! jakb-mech-death-a-ja :num! (loop!)) + ) + #f + ) + ) + ) + :post target-flut-post + ) + +(defstate target-flut-double-jump (target) + :event (-> target-flut-falling event) + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) + (set! (-> self control dynam gravity-max) 40960.0) + (set! (-> self control dynam gravity-length) 245760.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (case (-> self flut mode) + (('racer) + (set! (-> self control mod-surface) *flut-double-jump-racer-mods*) + ) + (else + (set! (-> self control mod-surface) *flut-double-jump-mods*) + ) + ) + ) + :exit (behavior () + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + ((-> target-flut-falling trans)) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons square) + ) + (not (logtest? (-> self target-flags) (target-flags prevent-attack))) + (not (logtest? (-> self control current-surface flags) (surface-flag no-attack no-hands))) + (time-elapsed? (-> self control last-time-of-stuck) (the-as time-frame (-> *TARGET-bank* stuck-timeout))) + (< 4096.0 (target-height-above-ground)) + ) + (go target-flut-air-attack (-> *FLUT-bank* air-attack-speed)) + ) + (if (!= (-> self state-time) (current-time)) + (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + ) + (let ((v1-41 (ja-group))) + (if (and v1-41 (= v1-41 jakb-flut-double-jump-ja)) + (sound-play "flut-flap" :id (the-as sound-id (-> self flut flap-sound-id))) + ) + ) + ) + :code (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-flut-double-jump-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 3 (seconds 0.1)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control mod-surface) *flut-jump-mods*) + (current-time) + (ja-channel-push! 2 (seconds 0.2)) + (ja-no-eval :group! jakb-flut-jump-loop-ja :num! (loop!) :frame-num 0.0) + (let ((gp-0 (-> self skel root-channel 1))) + (let ((f0-9 (-> self control unknown-float35))) + (set! (-> gp-0 frame-interp 1) f0-9) + (set! (-> gp-0 frame-interp 0) f0-9) + ) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (until #f + (suspend) + (seek! + (-> self control dynam gravity-max) + (-> self control standard-dynamics gravity-max) + (* 163840.0 (seconds-per-frame)) + ) + (seek! + (-> self control dynam gravity-length) + (-> self control standard-dynamics gravity-length) + (* 163840.0 (seconds-per-frame)) + ) + (ja :num! (loop! max)) + (let ((a0-13 (-> self skel root-channel 1))) + (let ((f0-23 (-> self control unknown-float35))) + (set! (-> a0-13 frame-interp 1) f0-23) + (set! (-> a0-13 frame-interp 0) f0-23) + ) + (set! (-> a0-13 param 0) 0.0) + (joint-control-channel-group-eval! a0-13 (the-as art-joint-anim #f) num-func-chan) + ) + ) + #f + ) + :post target-flut-post + ) + +(defstate target-flut-hit-ground (target) + :event target-flut-standard-event-handler + :enter (behavior () + (target-land-effect) + (when (< 40960.0 (-> self control ground-impact-vel)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.1)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.2)) + ) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (set! (-> self control mod-surface) *flut-walk-mods*) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still)) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (if (or (move-legs?) (= (-> self flut mode) 'wild)) + (go target-flut-walk) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + ) + :code (behavior () + (let ((t9-0 target-flut-hit-ground-anim)) + (t9-0) + ) + (go target-flut-stance) + ) + :post target-flut-post + ) + +(defstate target-flut-running-attack (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touched) + (cond + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 1920) + ) + (let ((gp-1 (target-send-attack + proc + (-> self control danger-mode) + (the-as touching-shapes-entry (-> block param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + ) + ) + (when gp-1 + (set! (-> self control unknown-word04) (the-as uint (current-time))) + (let ((v1-9 (if (type? proc process-drawable) + proc + ) + ) + ) + (when v1-9 + (let* ((s5-1 (-> (the-as process-drawable v1-9) root)) + (v1-10 (if (type? s5-1 collide-shape) + (the-as collide-shape s5-1) + ) + ) + ) + (if (and v1-10 (or (logtest? (-> v1-10 root-prim prim-core collide-as) (collide-spec enemy)) + (logtest? (-> v1-10 root-prim prim-core action) (collide-action no-smack)) + ) + ) + (set! (-> self control unknown-symbol03) (the-as float #x1)) + ) + ) + ) + ) + (when (or (= gp-1 'die) (= gp-1 'push)) + (let ((v0-2 (the-as object (current-time)))) + (set! (-> self control did-move-to-pole-or-max-jump-height) (the-as float v0-2)) + v0-2 + ) + ) + ) + ) + ) + (else + (target-flut-dangerous-event-handler proc argc message block) + ) + ) + ) + (else + (target-flut-dangerous-event-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control unknown-word04) (the-as uint 0)) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (set! (-> self control unknown-symbol03) 0.0) + (set! (-> self control mod-surface) *flut-run-attack-mods*) + (set! (-> *run-attack-mods* turnv) 655360.0) + (set! (-> *run-attack-mods* turnvv) 655360.0) + (target-start-attack) + (target-danger-set! 'flut-attack #f) + ) + :exit (behavior () + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (set! (-> *run-attack-mods* turnv) 0.0) + (set! (-> *run-attack-mods* turnvv) 0.0) + (set-time! (-> self control last-running-attack-end-time)) + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (when (!= (-> self state-time) (current-time)) + (if (and (or (smack-surface? #t) + (and (>= (-> self control surface-slope-z) 0.7) + (not (logtest? (-> self control status) (collide-status touch-actor))) + ) + ) + (begin + (set! (-> self control did-move-to-pole-or-max-jump-height) (the-as float (current-time))) + (set! (-> self control bend-target) 0.0) + (let ((v1-11 (new-stack-vector0)) + (f0-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-11 (-> self control transv) (vector-float*! v1-11 (-> self control dynam gravity-normal) f0-3)) + (let* ((f1-3 (vector-length v1-11)) + (f2-0 f1-3) + (f0-4 (fmin 0.0 f0-3)) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-4) + (vector-float*! v1-11 v1-11 (/ f1-3 f2-0)) + ) + ) + ) + #t + ) + (or (zero? (-> self control unknown-word04)) + (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 12)) + ) + (!= (the-as int (-> self control unknown-symbol03)) 1) + ) + (target-shoved (meters 2) (-> *TARGET-bank* smack-surface-height) (the-as process #f) target-flut-hit) + ) + (if (and (logtest? (water-flag touch-water) (-> self water flags)) + (zero? (mod (- (current-time) (-> self state-time)) 21)) + ) + (spawn-ripples + (-> self water) + 0.6 + (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg neckB)) + 0 + (-> self control transv) + #f + ) + ) + ) + ) + :code (behavior () + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 3 (seconds 0.4)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! jakb-flut-running-attack-ja :num! min) + (set! (-> self control dynam gravity-max) 368640.0) + (set! (-> self control dynam gravity-length) 368640.0) + (let ((f28-0 0.0) + (f30-0 (if (= (-> self control yellow-eco-last-use-time) (current-time)) + 0.2 + 0.8 + ) + ) + ) + (until (or (ja-done? 0) (< f30-0 0.05)) + (compute-alignment! (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and (>= (ja-aframe-num 0) 20.0) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 12)) + ) + ) + (go target-flut-falling #f) + ) + ((and (nonzero? (-> self control did-move-to-pole-or-max-jump-height)) + (>= (the-as + uint + (- (current-time) (the-as int (the-as uint (-> self control did-move-to-pole-or-max-jump-height)))) + ) + (the-as uint 12) + ) + ) + (set-forward-vel 0.0) + (set! f30-0 0.0) + ) + ((ja-done? 0) + (set-forward-vel f28-0) + ) + (else + (set! f28-0 + (* f30-0 (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second)) + ) + (set-forward-vel f28-0) + ) + ) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv) (-> self control w-R-c)) + (set! (-> gp-1 y) 0.0) + (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control c-R-w)) + ) + (suspend) + (ja :num! (seek! max (-> self control current-surface align-speed))) + (if (time-elapsed? (-> self state-time) (seconds 0.1)) + (set! (-> *flut-run-attack-mods* turnvv) 0.0) + ) + (if (time-elapsed? (-> self state-time) (seconds 0.1)) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) + ) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + (when (!= f30-0 0.0) + (set! (-> self trans-hook) (-> target-flut-hit-ground trans)) + (if (not (ja-done? 0)) + (ja-channel-push! 1 (seconds 0.05)) + ) + (ja-no-eval :group! jakb-flut-running-attack-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 f30-0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (go target-flut-stance) + ) + :post target-flut-post + ) + +(defstate target-flut-air-attack (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (if (and (= message 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 6) + ) + (< 0.0 (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control trans-old) (-> self control trans)) + ) + ) + ) + (send-event proc 'bonk (-> block param 0) (-> self control ground-impact-vel)) + ) + (case message + (('jump) + (go target-flut-jump (the-as float (-> block param 0)) (the-as float (-> block param 0))) + ) + (else + (target-flut-dangerous-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 float)) + (set-forward-vel arg0) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! (-> self control mod-surface) *flut-air-attack-mods*) + (target-start-attack) + (target-danger-set! 'flut-attack #f) + (let ((v1-5 (new-stack-vector0))) + (let ((f0-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-5 (-> self control transv) (vector-float*! v1-5 (-> self control dynam gravity-normal) f0-1)) + ) + (let* ((f0-2 (vector-length v1-5)) + (f1-1 f0-2) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-5 v1-5 (/ f0-2 f1-1)) + ) + ) + ) + ) + :exit (behavior () + (target-danger-set! 'harmless #f) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (set! (-> self control dynam gravity quad) (-> self control standard-dynamics gravity quad)) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (let ((gp-0 (new-stack-vector0))) + (vector-z-quaternion! gp-0 (-> self control quat-for-control)) + (let ((v1-1 (new-stack-vector0)) + (f0-1 (vector-dot gp-0 (-> self control transv))) + ) + 0.0 + (vector-! v1-1 (-> self control transv) (vector-float*! v1-1 gp-0 f0-1)) + (let* ((f1-2 (vector-length v1-1)) + (f2-0 f1-2) + ) + (if (< f0-1 0.0) + (set! f0-1 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) gp-0 f0-1) + (vector-float*! v1-1 v1-1 (/ f1-2 f2-0)) + ) + ) + ) + ) + (when (logtest? (-> self control status) (collide-status on-surface)) + (logior! (-> self control status) (collide-status on-surface)) + (remove-exit) + (go target-flut-air-attack-hit-ground) + ) + (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) 4096.0) + (and (time-elapsed? (-> self state-time) (seconds 0.5)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-flut-hit-ground) + ) + ) + :code (behavior ((arg0 float)) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek! (ja-aframe 8.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek! (ja-aframe 8.0 0))) + ) + (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek!) :frame-num (ja-aframe 8.0 0)) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (ja :group! jakb-flut-air-attack-loop-ja :num! min) + (until #f + (suspend) + ) + #f + ) + :post target-flut-post + ) + +(defstate target-flut-air-attack-hit-ground (target) + :event target-flut-standard-event-handler + :enter (behavior () + (target-land-effect) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.4)) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (set! (-> self control mod-surface) *flut-air-attack-mods*) + (sound-play "flop-land" :pitch -0.4) + (do-effect (-> self skel effect) (the-as symbol "group-flut-attack-strike-ground") (ja-frame-num 0) 0) + (let ((gp-2 + (process-spawn + touch-tracker + :init touch-tracker-init + (-> self control trans) + #x45800000 + 30 + :name "touch-tracker" + :to self + ) + ) + ) + (send-event + (ppointer->process gp-2) + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self control target-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'flut-attack) + (count (-> self control target-attack-id)) + (penetrate-using (-> self control penetrate-using)) + ) + ) + ) + (send-event + (ppointer->process gp-2) + 'function + (lambda ((arg0 process-focusable)) + (seek! (-> arg0 root root-prim local-sphere w) 28672.0 (* 286720.0 (seconds-per-frame))) + (update-transforms (-> arg0 root)) + ) + ) + ) + ) + :exit (-> target-flut-air-attack exit) + :trans (-> target-flut-hit-ground trans) + :code (behavior () + (ja-channel-set! 1) + (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek! (ja-aframe 22.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek! (ja-aframe 22.0 0))) + ) + (target-danger-set! 'harmless #f) + (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num (ja-aframe 22.0 0)) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (go target-flut-stance) + ) + :post target-flut-post + ) + +(defstate target-flut-kanga-catch (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('end-mode) + (case (-> block param 0) + (('kanga) + (go target-jump 16384.0 16384.0 (the-as surface #f)) + ) + ) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 handle) (arg1 symbol)) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set-setting! 'ignore-target #t 0.0 0) + ) + :exit (behavior () + (remove-setting! 'ignore-target) + ((-> target-flut-start exit)) + ) + :code (behavior ((arg0 handle) (arg1 symbol)) + (set! (-> (the-as target self) control unknown-handle02) (the-as handle #f)) + (let ((s5-0 jakb-flut-kanga-catch-ja)) + 0.0 + (let ((f30-0 0.0)) + (ja-channel-push! 1 (seconds 0.05)) + (set! (-> (the-as target self) control mod-surface) *empty-mods*) + (set! (-> (the-as target self) neck flex-blend) 0.0) + (sound-play "kanga-eat") + (set! (-> (the-as target self) control unknown-vector37 quad) (-> (the-as target self) control trans quad)) + (set! (-> (the-as target self) control unknown-vector38 quad) (-> (the-as target self) control trans quad)) + (set! (-> (the-as target self) control unknown-vector39 quad) (-> (the-as target self) control quat quad)) + (set! (-> (the-as target self) control unknown-vector40 quad) (-> (the-as target self) control quat quad)) + (ja :group! s5-0 :num! (seek!) :frame-num (ja-aframe 20.0 0)) + (while (< (ja-aframe-num 0) 93.0) + (let* ((s4-2 (handle->process arg0)) + (s5-1 (if (type? s4-2 process-focusable) + s4-2 + ) + ) + ) + (let ((f28-0 (ja-aframe-num 0))) + (send-event *camera* 'joystick -0.7 -1.0) + (cond + ((< f28-0 24.0) + (when s5-1 + (set! (-> (the-as target self) control unknown-vector38 quad) + (-> (get-trans (the-as process-focusable s5-1) 0) quad) + ) + (set! (-> (the-as target self) control unknown-vector40 quad) + (-> (get-quat (the-as process-focusable s5-1) 0) quad) + ) + ) + (let ((f28-1 (sin (lerp-scale 0.0 16384.0 (ja-aframe-num 0) 20.0 23.0)))) + (let ((f26-0 f28-1)) + (vector-lerp! + (-> (the-as target self) control trans) + (-> (the-as target self) control unknown-vector37) + (-> (the-as target self) control unknown-vector38) + f28-1 + ) + (set! (-> (the-as target self) control trans y) (lerp + (-> (the-as target self) control unknown-vector37 y) + (-> (the-as target self) control unknown-vector38 y) + f26-0 + ) + ) + ) + (if s5-1 + (quaternion-slerp! + (-> (the-as process-focusable s5-1) root quat) + (-> (the-as target self) control quat) + (the-as quaternion (-> (the-as target self) control unknown-vector40)) + (- 1.0 f28-1) + ) + ) + ) + (rot->dir-targ! (-> (the-as target self) control)) + ) + (else + (set! (-> (the-as target self) control unknown-handle02) arg0) + (set! f30-0 (seek f30-0 0.0 (* 40960.0 (seconds-per-frame)))) + (set-forward-vel f30-0) + ) + ) + ) + (cond + (s5-1 + (let ((s4-6 (the-as target self))) + ;; og:preserve-this + (set! self (the target s5-1)) + (let ((f0-14 (ja-aframe-num 0))) + f0-14 + (set! self (the target s4-6)) + (ja :num-func num-func-identity :frame-num (ja-aframe f0-14 0)) + ) + ) + ) + (else + (go target-flut-stance) + ) + ) + ) + (suspend) + 0 + ) + ) + ) + (go target-flut-stance) + ) + :post (behavior () + (target-no-stick-post) + (target-flut-post-post) + (let* ((s5-0 (handle->process (-> (the-as target self) control unknown-handle02))) + (gp-0 (if (type? s5-0 process-focusable) + (the-as process-focusable s5-0) + ) + ) + ) + (when gp-0 + (quaternion-copy! (-> gp-0 root quat) (-> (the-as target self) control quat-for-control)) + (set! (-> gp-0 root trans quad) (-> (the-as target self) control trans quad)) + (let ((s5-1 (the-as target self))) + ;; og:preserve-this + (set! self (the target gp-0)) + (ja-post) + (set! self (the target s5-1)) + ) + ) + ) + ) + ) + +(defstate target-flut-hit (target) + :event target-flut-standard-event-handler + :exit (behavior () + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-flut-death))) + (logclear! (-> self focus-status) (focus-status dead hit)) + ) + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (when (= *cheat-mode* 'debug) + (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) + (pickup-collectable! (-> self fact) (pickup-type health) 100.0 (the-as handle #f)) + (go target-flut-stance) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 attack-info)) + (set-time! (-> self state-time)) + (let ((s5-0 (-> self attack-info))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-2 s5-0)) + (set! (-> v1-2 attacker) (the-as handle #f)) + (set! (-> v1-2 mode) 'generic) + (set! (-> v1-2 shove-back) 10240.0) + (set! (-> v1-2 shove-up) 9011.2) + (set! (-> v1-2 angle) #f) + (set! (-> v1-2 trans quad) (-> self control trans quad)) + (set! (-> v1-2 control) 0.0) + (set! (-> v1-2 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) + (set! (-> v1-2 damage) (-> *FACT-bank* health-default-inc)) + ) + (case arg0 + (('shove) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + (let ((v1-6 s5-0)) + (set! (-> v1-6 shove-back) (-> *TARGET-bank* smack-surface-dist)) + (set! (-> v1-6 shove-up) (-> *TARGET-bank* smack-surface-height)) + (set! (-> v1-6 angle) 'shove) + ) + ) + ) + (combine! s5-0 arg1 self) + (when (not (logtest? (-> s5-0 mask) (attack-mask vector))) + (vector-z-quaternion! (-> s5-0 vector) (-> self control quat-for-control)) + (vector-xz-normalize! (-> s5-0 vector) (- (fabs (-> s5-0 shove-back)))) + (set! (-> s5-0 vector y) (-> s5-0 shove-up)) + ) + (set! (-> s4-0 quad) (-> s5-0 vector quad)) + (let ((f0-11 (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-0 1.0) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) + ) + ) + ) + (if (not (-> self attack-info angle)) + (set! (-> self attack-info angle) (if (>= 0.0 f0-11) + 'front + 'back + ) + ) + ) + ) + (case arg0 + (('attack) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> s5-0 mode) + (('endlessfall) + (cond + ((= (-> self game mode) 'debug) + (let ((s3-2 (new-stack-vector0))) + (set! (-> s3-2 quad) (-> self control last-trans-on-ground quad)) + (ja-channel-set! 0) + (let ((s2-0 (current-time))) + (until (time-elapsed? s2-0 (seconds 1)) + (suspend) + ) + ) + (move-to-point! (-> self control) s3-2) + ) + (set! (-> self control camera-pos quad) (-> self control trans quad)) + (send-event *camera* 'teleport) + (go target-flut-stance) + ) + (else + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-flut-death (-> s5-0 mode)) + ) + ) + ) + (('water-vol 'sharkey 'bot 'drown-death 'instant-death 'crush 'tentacle) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (if (= (-> self game mode) 'play) + (go target-flut-death (-> s5-0 mode)) + ) + ) + (('lava 'melt 'fry 'slime) + (sound-play "death-melt") + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (cond + ((logtest? (-> *part-group-id-table* 64 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 64)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 64)) + ) + ) + (set! (-> s5-0 angle) 'lava) + (set! (-> s5-0 shove-up) 20480.0) + ) + (('death) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + ) + (('cactus) + (cond + ((= (-> self flut mode) 'normal) + ) + (else + (go target-flut-death (-> s5-0 mode)) + ) + ) + ) + (('drown) + (if (= (-> self flut mode) 'normal) + (go target-flut-eject (-> s5-0 mode)) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> s5-0 damage)) (the-as handle #f)) + ) + ) + (else + (if (!= (-> self flut mode) 'normal) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> s5-0 damage)) (the-as handle #f)) + ) + ) + ) + (target-hit-effect s5-0) + (sound-play "flut-hit" :pitch -1) + ) + ) + (set! (-> self control mod-surface) *smack-mods*) + (let ((f30-0 1.0)) + (let ((v1-114 (-> s5-0 angle))) + (cond + ((= v1-114 'shove) + (cond + ((not (-> self flut as-daxter?)) + (let ((v1-119 (ja-group))) + (when (not (and v1-119 (= v1-119 jakb-flut-smack-surface-ja))) + (ja-channel-set! 1) + (ja :group! jakb-flut-smack-surface-ja :num! min) + ) + ) + ) + (else + (let ((v1-130 (ja-group))) + (when (not (and v1-130 (= v1-130 jakb-mech-drag-pickup-ja))) + (ja-channel-set! 1) + (ja :group! jakb-mech-drag-pickup-ja :num! min) + ) + ) + ) + ) + (sound-play "smack-surface") + (sound-play "flut-hit" :pitch 1) + ) + ((not (-> self flut as-daxter?)) + (let ((v1-148 (ja-group))) + (when (not (and v1-148 (= v1-148 jakb-flut-hit-back-ja))) + (ja-channel-push! 1 (seconds 0.075)) + (ja :group! jakb-flut-hit-back-ja :num! min) + ) + ) + ) + (else + (let ((v1-159 (ja-group))) + (when (not (and v1-159 (= v1-159 jakb-mech-drag-pickup-ja))) + (ja-channel-set! 1) + (ja :group! jakb-mech-drag-pickup-ja :num! min) + ) + ) + ) + ) + ) + (target-hit-move + s5-0 + (target-hit-orient s5-0 s4-0) + (the-as (function none :behavior target) target-flut-falling-anim-trans) + f30-0 + ) + ) + ) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-flut-death (-> s5-0 mode)) + ) + ((and (= (-> self flut mode) 'normal) (= arg0 'attack)) + (go target-flut-eject (-> s5-0 mode)) + ) + (else + (go target-flut-hit-ground) + ) + ) + ) + ) + :post target-flut-post + ) + +(defstate target-flut-death (target) + :event (-> target-death event) + :exit (behavior () + ((-> target-flut-start exit)) + ((-> target-death exit)) + ) + :trans (-> target-hit trans) + :code (behavior ((arg0 symbol)) + (set! (-> self control unknown-word04) (the-as uint #f)) + (logior! (-> self focus-status) (focus-status dead)) + (set! (-> self neck flex-blend) 0.0) + (target-timed-invulnerable-off self 0) + (add-setting! 'process-mask 'set 0.0 (process-mask enemy platform projectile death)) + (apply-settings *setting-control*) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self death-resetter continue) #f) + (set! (-> self death-resetter node) (game-task-node none)) + (set! (-> self death-resetter reset-mode) 'life) + (set! (-> self death-resetter execute) #f) + (let ((s5-0 (-> self child))) + (while s5-0 + (send-event (ppointer->process s5-0) 'notice 'die) + (set! s5-0 (-> s5-0 0 brother)) + ) + ) + (case arg0 + (('none 'water-vol 'sharkey) + ) + (('endlessfall) + (sound-play "death-fall") + (sound-play "flut-hit" :vol 70 :pitch -1.4) + (set-setting! 'mode-name 'cam-endlessfall 0.0 0) + (logior! (-> self control pat-ignore-mask) (new 'static 'pat-surface :noendlessfall #x1)) + (logclear! (-> self water flags) (water-flag swim-ground)) + (let ((f0-2 (fmin -4096.0 (- (-> self control ground-impact-vel))))) + (set! (-> self control unknown-word04) (the-as uint f0-2)) + (let ((v1-35 (new-stack-vector0))) + (let ((f1-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-35 (-> self control transv) (vector-float*! v1-35 (-> self control dynam gravity-normal) f1-3)) + ) + (let* ((f1-4 (vector-length v1-35)) + (f2-1 f1-4) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-2) + (vector-float*! v1-35 v1-35 (/ f1-4 f2-1)) + ) + ) + ) + ) + (let ((s5-3 (current-time))) + (until (time-elapsed? s5-3 (seconds 1)) + (target-flut-falling-anim-trans) + (vector-seek! (-> self draw color-mult) *zero-vector* (seconds-per-frame)) + (let ((v1-39 (new-stack-vector0)) + (f0-6 (the-as number (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + ) + 0.0 + (vector-! + v1-39 + (-> self control transv) + (vector-float*! v1-39 (-> self control dynam gravity-normal) (the-as float f0-6)) + ) + (let* ((f1-7 (vector-length v1-39)) + (f2-2 f1-7) + ) + (if (< (the-as float (-> self control unknown-word04)) (the-as float f0-6)) + (set! f0-6 (-> self control unknown-word04)) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) (the-as float f0-6)) + (vector-float*! v1-39 v1-39 (/ f1-7 f2-2)) + ) + ) + ) + (suspend) + ) + ) + (remove-setting! 'mode-name) + ) + (('lava 'fry 'slime 'dark-eco-pool 'melt 'big-explosion) + (let ((s5-4 (handle->process (-> self attack-info attacker)))) + (when (if (type? s5-4 water-vol) + s5-4 + ) + (logior! (-> self target-flags) (target-flags tf14)) + (set! (-> self alt-cam-pos y) (+ 4096.0 (-> self water height))) + ) + ) + (set! (-> self control mod-surface) *neutral-mods*) + (case arg0 + (('dark-eco-pool) + (sound-play "death-darkeco") + (cond + ((logtest? (-> *part-group-id-table* 62 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 62)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 62)) + ) + ) + (let ((v1-93 (-> self control root-prim))) + (set! (-> v1-93 prim-core collide-as) (collide-spec)) + (set! (-> v1-93 prim-core collide-with) (collide-spec)) + ) + 0 + (set! (-> self post-hook) target-no-ja-move-post) + (ja-channel-set! 0) + (ja-post) + (let ((s5-8 (current-time))) + (until (time-elapsed? s5-8 (seconds 2)) + (suspend) + ) + ) + ) + (('lava 'melt 'fry 'slime) + (sound-play "death-melt") + (cond + ((logtest? (-> *part-group-id-table* 64 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 64)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 64)) + ) + ) + (let ((v1-137 (-> self control root-prim))) + (set! (-> v1-137 prim-core collide-as) (collide-spec)) + (set! (-> v1-137 prim-core collide-with) (collide-spec)) + ) + 0 + (set! (-> self post-hook) target-no-ja-move-post) + (ja-channel-set! 0) + (ja-post) + (let ((s5-12 (current-time))) + (until (time-elapsed? s5-12 (seconds 2)) + (suspend) + ) + ) + ) + ) + ) + (('drown 'drown-death) + ((lambda :behavior target + () + (logior! (-> self target-flags) (target-flags tf14)) + (set! (-> self alt-cam-pos y) (+ -8192.0 (-> self water height))) + (sound-play "death-drown") + (logclear! (-> self water flags) (water-flag swim-ground)) + (set! (-> self control mod-surface) *dive-mods*) + (set! (-> self control dynam gravity-max) 6144.0) + (set! (-> self control dynam gravity-length) 6144.0) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-flut-deatha-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (if (< (+ -10240.0 (-> self water height)) (-> self control trans y)) + (seek! (-> self control trans y) (+ -10240.0 (-> self water height)) (* 81920.0 (seconds-per-frame))) + ) + (suspend) + (ja :num! (seek!)) + ) + #f + ) + ) + ) + (('cactus) + (set! (-> self control mod-surface) *neutral-mods*) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a1-48 jakb-turret-get-off-ja)) + (ja-no-eval :group! a1-48 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (let ((s5-13 (new 'stack-no-clear 'vector))) + (when (not (logtest? (-> self align flags) (align-flags disabled))) + (vector-matrix*! s5-13 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-float*! (-> self control transv) s5-13 (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (('bot) + ;; (L138) + ) + (else + (set! (-> self control mod-surface) *neutral-mods*) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a1-52 (if (-> self flut as-daxter?) + jakb-mech-get-off-ja + jakb-flut-deatha-ja + ) + ) + ) + (ja-no-eval :group! a1-52 :num! (seek!) :frame-num 0.0) + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (let ((s5-14 (new 'stack-no-clear 'vector))) + (when (not (logtest? (-> self align flags) (align-flags disabled))) + (vector-matrix*! s5-14 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-float*! (-> self control transv) s5-14 (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (target-death-reset arg0 #f) + ) + :post (behavior () + (target-flut-post-post) + (target-no-stick-post) + ) + ) + +(defstate target-flut-get-on (target) + :event target-generic-event-handler + :exit (behavior () + (logclear! (-> self target-flags) (target-flags tf5)) + ((-> target-flut-start exit)) + ) + :code (behavior ((arg0 handle)) + (set! (-> self control mod-surface) *flut-walk-mods*) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (logior! (-> self target-flags) (target-flags tf5 tf6)) + (set-time! (-> self state-time)) + (when (handle->process arg0) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> self control trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> self control trans quad)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector39)) (-> self control quat)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector40)) (-> self control quat-for-control)) + (set! (-> self control unknown-word04) (the-as uint (-> self control draw-offset y))) + (let* ((s2-0 (handle->process arg0)) + (s3-0 (if (type? s2-0 process-drawable) + (the-as process-drawable s2-0) + ) + ) + ) + (when s3-0 + (set! (-> s5-0 quad) (-> s3-0 root trans quad)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector40)) (-> s3-0 root quat)) + (send-event s3-0 'trans (-> self flut flut-trans)) + (quaternion-copy! (the-as quaternion (-> self flut flut-quat)) (-> s3-0 root quat)) + (set! (-> self flut flut-scale quad) (-> s3-0 root scale quad)) + (set! (-> self control did-move-to-pole-or-max-jump-height) (-> self flut flut-trans y)) + ) + ) + (set! (-> self control unknown-vector37 quad) (-> s4-0 quad)) + (set! (-> self control unknown-vector38 quad) (-> s5-0 quad)) + (let ((s4-1 #f)) + (sound-play "uppercut") + (ja-channel-push! 1 (seconds 0.05)) + (let ((s3-2 (if (-> self flut as-daxter?) + jakb-gun-yellow-fire-twirl-ja + jakb-flut-get-on-ja + ) + ) + (f30-0 (if (-> self flut as-daxter?) + 20.0 + 24.0 + ) + ) + ) + (ja-no-eval :group! s3-2 :num! (seek! (ja-aframe f30-0 0)) :frame-num 0.0) + (until (ja-done? 0) + (let* ((s3-3 (handle->process arg0)) + (v1-66 (if (type? s3-3 process-drawable) + (the-as process-drawable s3-3) + ) + ) + ) + (when v1-66 + (set! (-> s5-0 quad) (-> v1-66 root trans quad)) + (set! (-> self control unknown-vector38 quad) (-> s5-0 quad)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector40)) (-> v1-66 root quat)) + ) + ) + (when (and (not s4-1) (= (-> self skel root-channel 0) (-> self skel channel))) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (set! s4-1 #t) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (suspend) + (ja :num! (seek! (ja-aframe f30-0 0))) + ) + ) + ) + ) + ) + (sound-play "flut-coo") + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (logclear! (-> self target-flags) (target-flags tf6)) + (set! (-> self control transv quad) (the-as uint128 0)) + (quaternion-copy! (-> self control quat) (-> self control quat-for-control)) + (rot->dir-targ! (-> self control)) + (send-event (handle->process arg0) 'die) + (case (-> self flut mode) + (('wild) + (set-forward-vel 204800.0) + (set! (-> self control ctrl-xz-vel) 204800.0) + (ja-channel-set! 0) + ) + ) + (go target-flut-stance) + ) + :post (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (f30-0 (fmin 1.0 (* 0.0044444446 (the float (- (current-time) (-> self state-time)))))) + ) + (case (-> self flut mode) + (('wild) + (set! f30-0 (lerp-scale 0.0 1.0 (ja-frame-num 0) 0.0 (the float (+ (-> (ja-group) frames num-frames) -1)))) + ) + ) + (vector-lerp! gp-0 (-> self control unknown-vector37) (-> self control unknown-vector38) f30-0) + (set! (-> gp-0 y) + (lerp + (-> self control unknown-vector37 y) + (-> self control unknown-vector38 y) + (fmax 0.0 (fmin 1.0 (* 0.006666667 (the float (+ (- (the-as int (-> self state-time))) (current-time)))))) + ) + ) + (move-to-point! (-> self control) gp-0) + (quaternion-slerp! + (-> self control quat-for-control) + (the-as quaternion (-> self control unknown-vector39)) + (the-as quaternion (-> self control unknown-vector40)) + f30-0 + ) + ) + (target-no-move-post) + (let ((f30-1 (-> self alt-cam-pos y))) + (if (-> self flut as-daxter?) + (vector<-cspace! (-> self alt-cam-pos) (-> self sidekick 0 node-list data 3)) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + ) + (set! (-> self alt-cam-pos y) f30-1) + ) + ) + ) + +(let ((v1-45 (copy *forward-jump-mods* 'loading-level))) + (set! (-> v1-45 fric) 0.0) + (set! (-> v1-45 nonlin-fric-dist) 0.0) + (set! (-> v1-45 turnv) 0.0) + (set! (-> v1-45 turnvv) 0.0) + (set! (-> v1-45 tiltv) 131072.0) + (set! (-> v1-45 tiltvf) 30.0) + (set! (-> v1-45 mult-hook) + (the-as + (function surface surface surface int none) + (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (persist-with-delay *setting-control* 'string-spline-accel (seconds 0.05) 'string-spline-accel 'abs 4096.0 0) + (persist-with-delay + *setting-control* + 'string-spline-max-move + (seconds 0.05) + 'string-spline-max-move + 'abs + 40960.0 + 0 + ) + (persist-with-delay + *setting-control* + 'string-spline-accel-player + (seconds 0.05) + 'string-spline-accel-player + 'abs + 4096.0 + 0 + ) + (persist-with-delay + *setting-control* + 'string-spline-max-move-player + (seconds 0.05) + 'string-spline-max-move-player + 'abs + 40960.0 + 0 + ) + ) + ) + ) + ) + ) + (set! *flut-get-off-mods* v1-45) + ) + +(defstate target-flut-get-off (target) + :event target-generic-event-handler + :exit (-> target-flut-get-on exit) + :code (behavior ((arg0 handle)) + (logior! (-> self target-flags) (target-flags tf5)) + (set-forward-vel 0.0) + (let ((s5-0 0)) + (while (and (not (logtest? (-> self control status) (collide-status on-surface))) + (not (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (< 30 s5-0)) + #t + ) + ) + ) + (target-flut-falling-anim-trans) + (+! s5-0 (- (current-time) (-> self clock old-frame-counter))) + (suspend) + ) + ) + (go target-flut-get-off-jump) + ) + :post (behavior () + (target-no-stick-post) + (target-flut-post-post) + ) + ) + +(defstate target-flut-get-off-jump (target) + :event target-generic-event-handler + :exit (-> target-flut-start exit) + :code (behavior () + (let ((gp-1 (mem-copy! (the-as pointer (new 'stack 'transformq)) (the-as pointer (-> self control trans)) 48))) + (logior! (-> self target-flags) (target-flags tf5)) + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((s5-0 (if (-> self flut as-daxter?) + jakb-mech-dummy3-ja + jakb-flut-get-off-ja + ) + ) + ) + (ja-no-eval :group! s5-0 :num! (seek! (ja-aframe 18.0 0)) :frame-num 0.0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 18.0 0))) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (vector<-cspace! s5-2 (joint-node jakb-lod0-jg main)) + (move-to-point! (-> self control) s5-2) + ) + (send-event *camera* 'ease-in) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set-forward-vel 32768.0) + (process-spawn + flut + :init flut-init + (-> self flut entity) + gp-1 + (process->handle self) + (+ (if (= (-> self flut mode) 'wild) + 0 + 1 + ) + (shl (-> self flut color-index) 32) + ) + (-> self flut mode) + :name "flut" + :to self + ) + ) + (go target-jump 10240.0 10240.0 *flut-get-off-mods*) + ) + :post (behavior () + (let ((f30-0 (-> self alt-cam-pos y))) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + (set! (-> self alt-cam-pos y) f30-0) + ) + (target-no-move-post) + ) + ) + +(defstate target-flut-eject (target) + :event target-generic-event-handler + :exit (-> target-flut-start exit) + :code (behavior ((arg0 symbol)) + (let ((s5-1 (mem-copy! (the-as pointer (new 'stack 'transformq)) (the-as pointer (-> self control trans)) 48))) + (logior! (-> self target-flags) (target-flags tf5)) + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (ja-channel-push! 1 (seconds 0.1)) + (case arg0 + (('drown) + (ja-no-eval :group! jakb-flut-death-drown-ja :num! (seek! (ja-aframe 60.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 60.0 0))) + ) + ) + (else + (ja-no-eval :group! jakb-flut-deathb-ja :num! (seek! (ja-aframe 25.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 25.0 0))) + ) + ) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((s4-4 (new 'stack-no-clear 'vector))) + (vector<-cspace! s4-4 (joint-node jakb-lod0-jg main)) + (+! (-> s4-4 y) -9011.2) + (let ((v1-45 (-> self water flags))) + (if (and (logtest? (water-flag touch-water) v1-45) + (logtest? (water-flag under-water swimming) v1-45) + (not (logtest? (focus-status mech) (-> self focus-status))) + ) + (set! (-> s4-4 y) (-> self water collide-height)) + ) + ) + (move-to-point! (-> self control) s4-4) + ) + (send-event *camera* 'ease-in) + (ja-channel-set! 0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (let ((s4-5 (if (= (-> self flut mode) 'wild) + 4 + 5 + ) + ) + ) + (case arg0 + (('drown) + (set! s4-5 (logior s4-5 10)) + ) + ) + (process-spawn + flut + :init flut-init + (-> self flut entity) + s5-1 + (process->handle self) + (+ s4-5 (shl (-> self flut color-index) 32)) + (-> self flut mode) + :name "flut" + :to self + ) + ) + ) + (cond + ((= arg0 'drown) + (logior! (-> self water flags) (water-flag jump-out)) + (go target-swim-jump 20480.0 20480.0) + ) + (else + (go target-jump 14336.0 14336.0 *flut-get-off-mods*) + ) + ) + ) + :post (behavior () + (let ((f30-0 (-> self alt-cam-pos y))) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + (set! (-> self alt-cam-pos y) f30-0) + ) + (target-no-move-post) + ) + ) + +(defstate target-flut-grab (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + (-> self state name) + ) + (else + (case message + (('end-mode) + (case (-> block param 0) + (('grab) + (go target-flut-stance) + ) + (('flut) + (go target-grab 'stance) + ) + ) + ) + (('clone-anim) + (go target-flut-clone-anim (process->handle (the-as process (-> block param 0)))) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf2)) + (logior! (-> self focus-status) (focus-status grabbed)) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags tf2)) + (logclear! (-> self focus-status) (focus-status grabbed)) + (logclear! (-> self water flags) (water-flag jump-out)) + (target-exit) + ((-> target-flut-start exit)) + ) + :code (-> target-flut-stance code) + :post (behavior () + (target-no-stick-post) + (target-flut-post-post) + ) + ) + +(defstate target-flut-clone-anim (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (if (and (= message 'trans) (= (-> block param 0) 'restore)) + (set! (-> self control unknown-word04) (the-as uint #f)) + ) + ((-> target-flut-grab event) proc argc message block) + ) + :enter (-> target-clone-anim enter) + :exit (behavior () + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ((-> target-clone-anim exit)) + ((-> target-flut-start exit)) + ) + :code (behavior ((arg0 handle)) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (clone-anim arg0 #t "") + (go target-flut-stance) + ) + :post (behavior () + (target-no-ja-move-post) + (target-flut-post-post) + ) + ) diff --git a/goal_src/jak3/engine/target/mech/mech-h.gc b/goal_src/jak3/engine/target/mech/mech-h.gc index 56b4769c2a..607dcbbe66 100644 --- a/goal_src/jak3/engine/target/mech/mech-h.gc +++ b/goal_src/jak3/engine/target/mech/mech-h.gc @@ -20,6 +20,7 @@ (drag-sound-id sound-id) (whine-sound-id sound-id) (shield-sound-id sound-id) + (mode-sound-bank connection) (mech-start-time time-frame) (mech-time time-frame) (no-get-off-time time-frame) @@ -49,7 +50,7 @@ (smoke-local-vel vector 2 :inline) (particle-system-2d basic) (particle-system-3d basic) - (part-thruster sparticle-launch-control) + (part-thruster sparticle-launcher) (part-thruster-scale-x sp-field-init-spec) (part-thruster-scale-y sp-field-init-spec) (part-quat quaternion) diff --git a/goal_src/jak3/engine/target/mech/mech-part.gc b/goal_src/jak3/engine/target/mech/mech-part.gc index c6ad3ea5d0..0ce02fd1bc 100644 --- a/goal_src/jak3/engine/target/mech/mech-part.gc +++ b/goal_src/jak3/engine/target/mech/mech-part.gc @@ -7,3 +7,405 @@ ;; DECOMP BEGINS +(defpart 1037 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:y (meters 0)) + (:scale-x (meters 1)) + (:scale-y (meters 3)) + (:r 128.0 128.0) + (:g 64.0 64.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +(defpart 1038 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:y (meters -0.3)) + (:scale-x (meters 1.5) (meters 0.1)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 64.0 64.0) + (:b 0.0) + (:a 16.0 8.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + ) + ) + +(defpart 1039 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 4.0) + (:y (meters 0) (meters -0.25)) + (:scale-x (meters 0.2) (meters 0.2)) + (:rot-z (degrees 0) 1 (degrees 180)) + (:scale-y (meters 1) (meters 0.6)) + (:r 192.0) + (:g 64.0) + (:b 0.0) + (:a 0.0 16.0) + (:vel-y (meters -0.06666667) (meters -0.016666668)) + (:scalevel-x (meters 0.033333335)) + (:scalevel-y (meters 0.006666667)) + (:fade-r -2.0) + (:fade-g 2.0) + (:fade-b 5.0) + (:fade-a 0.32) + (:accel-x (meters 0) (meters 0.0016666667)) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.94) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.085)) + (:next-launcher 1040) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 1040 + :init-specs ((:r 64.0 64.0) + (:g 64.0 64.0) + (:b 64.0 64.0) + (:fade-r 0.0) + (:fade-g 0.0) + (:fade-b 0.0) + (:fade-a -0.128 -0.256) + ) + ) + +(defpart 1041 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.1 0.1) + (:y (meters 0.25) (meters -0.5)) + (:scale-x (meters 0.05)) + (:scale-y (meters 0.5)) + (:r 192.0 64.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 128.0) + (:vel-y (meters -0.033333335) (meters -0.026666667)) + (:scalevel-x (meters 0.001)) + (:scalevel-y (meters -0.017)) + (:fade-g 0.0) + (:accel-x (meters 0) (meters 0.0016666667)) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.96) + (:timer (seconds 0.167) (seconds 0.247)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.1)) + (:next-launcher 1042) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 1042 + :init-specs ((:scalevel-x (meters 0)) (:scalevel-y (meters 0))) + ) + +(defpart 1043 + :init-specs ((:num 0.6) + (:rot-x 8) + (:r 1638.4) + (:g 1331.2) + (:b 1433.6) + (:vel-y (meters -0.06666667) (meters -0.016666668)) + (:fade-r 32.768) + (:fade-g 26.623999) + (:fade-b 28.671999) + (:accel-x (meters 0) (meters 0.0016666667)) + (:friction 0.94) + (:timer (seconds 0.335)) + (:flags (distort)) + (:next-time (seconds 0.167)) + (:next-launcher 1044) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 1044 + :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b -4.096)) + ) + +(defun mech-spawn-thruster ((arg0 mech-info) (arg1 vector) (arg2 vector) (arg3 float) (arg4 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (set! (-> arg0 part-thruster) (-> *part-id-table* 1037)) + (set! (-> arg0 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) + (set! (-> arg0 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) + (let ((s1-0 (new 'stack-no-clear 'quaternion)) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (forward-up->quaternion s1-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) + (quaternion-rotate-local-x! s1-0 s1-0 32768.0) + (let ((a0-3 s0-0)) + (let ((v1-10 arg1)) + (let ((a1-4 (* 0.5 arg4))) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> arg2 quad)) + (.lvf vf4 (&-> v1-10 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 (&-> a0-3 quad) vf6) + ) + (set! (-> arg0 part-thruster-scale-x initial-valuef) arg3) + (set! (-> arg0 part-thruster-scale-y initial-valuef) arg4) + (dotimes (s4-1 2) + (quaternion-rotate-local-z! s1-0 s1-0 16384.0) + (quaternion-copy! (-> arg0 part-quat) s1-0) + (let ((t9-4 sp-launch-particles-var) + (a0-6 (-> arg0 particle-system-3d)) + (a1-7 (-> arg0 part-thruster)) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> s0-0 quad)) + (t9-4 + (the-as sparticle-system a0-6) + a1-7 + a2-4 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ) + (launch-particles (-> *part-id-table* 1043) arg1) + (launch-particles (-> *part-id-table* 1038) arg1) + (cond + ((!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) + (launch-particles (-> *part-id-table* 1043) arg1) + ) + (else + (launch-particles (-> *part-id-table* 1039) arg1) + (launch-particles (-> *part-id-table* 1041) arg1) + ) + ) + 0 + (none) + ) + ) + +(defpart 1045 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 3.0) + (:x (meters -16) (meters 32)) + (:y (meters 0) (meters 12)) + (:z (meters -16) (meters 32)) + (:scale-x (meters 0.1) (meters 0.3)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 0.1) (meters 0.1)) + (:r 0.0 64.0) + (:g 64.0 128.0) + (:b 64.0 196.0) + (:a 0.0) + (:vel-y (meters -0.0033333334) (meters 0.006666667)) + (:rotvel-z (degrees -0.4) (degrees 0.8)) + (:fade-a 0.21333334 0.21333334) + (:timer (seconds 2.5)) + (:flags (sp-cpuinfo-flag-2)) + (:userdata 0.0) + (:func 'check-water-level-above-and-die) + (:next-time (seconds 0.5)) + (:next-launcher 1046) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:rotate-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters -3) (meters 8)) + ) + ) + +(defpart 1046 + :init-specs ((:fade-a 0.0) (:next-time (seconds 1)) (:next-launcher 1047)) + ) + +(defpart 1047 + :init-specs ((:fade-a -0.21333334 -0.21333334)) + ) + +(defpart 1048 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:num 0.2) + (:x (meters -24) (meters 48)) + (:y (meters -4) (meters 4)) + (:z (meters -24) (meters 48)) + (:scale-x (meters 0.15) (meters 0.15)) + (:scale-y (meters 0.1) (meters 0.1)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 0.0) + (:vel-y (meters 0.008333334) (meters 0.005)) + (:fade-a 0.16) + (:timer (seconds 16)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:userdata 0.0) + (:func 'check-water-level-above-and-die) + (:next-time (seconds 0.33) (seconds 0.657)) + (:next-launcher 1049) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 1049 + :init-specs ((:fade-a 0.0) (:next-time (seconds 1) (seconds 5.997)) (:next-launcher 1050)) + ) + +(defpart 1050 + :init-specs ((:scalevel-x (meters -0.00033333333) (meters -0.00066666666)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.16) + (:accel-y (meters -0.0001) (meters -0.0001)) + ) + ) + +(defpart 1051 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.15) (meters 0.15)) + (:scale-y (meters 0.1) (meters 0.1)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 0.0) + (:vel-y (meters 0.008333334) (meters 0.005)) + (:fade-a 0.16) + (:accel-y (meters 0.0002)) + (:friction 0.97 0.01) + (:timer (seconds 4)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:userdata 0.0) + (:func 'check-water-level-above-and-die) + (:next-time (seconds 0.33) (seconds 0.657)) + (:next-launcher 1052) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters 0) (meters 0.5)) + ) + ) + +(defpart 1052 + :init-specs ((:fade-a 0.0) (:next-time (seconds 1) (seconds 0.997)) (:next-launcher 1050)) + ) + +(defpartgroup group-mech-explode-death + :id 236 + :duration (seconds 0.25) + :linger-duration (seconds 2) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 153) (sp-item 154)) + ) + +(defpart 1053 + :init-specs ((:num 4.0) + (:x (meters -1) (meters 3)) + (:y (meters 0) (meters 4)) + (:rot-x 6) + (:r 4096.0) + (:g 2662.4) + (:b 2867.2) + (:vel-y (meters 0.0033333334) (meters 0.01)) + (:accel-y (meters 0.0016666667) (meters 0.00033333333)) + (:friction 0.9) + (:timer (seconds 0.4)) + (:flags (distort)) + (:next-time (seconds 0.135) (seconds 0.13)) + (:next-launcher 1054) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 1054 + :init-specs ((:fade-b -5.12)) + ) + +(defpart 1055 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:birth-func 'birth-func-texture-group) + (:num 16.0 4.0) + (:x (meters -1) (meters 3)) + (:y (meters 0) (meters 4)) + (:scale-x (meters 0.5) (meters 0.25)) + (:scale-y (meters 1) (meters 0.25)) + (:r 255.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 32.0 32.0) + (:vel-y (meters 0.0033333334) (meters 0.01)) + (:scalevel-x (meters 0.013333334) (meters 0.006666667)) + (:scalevel-y :copy scalevel-x) + (:accel-y (meters 0.0016666667) (meters 0.00033333333)) + (:friction 0.9) + (:timer (seconds 0.367)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:userdata :data (new 'static 'boxed-array :type int32 40 1 0 #x400000 #x400f00 #x400f00)) + (:next-time (seconds 0.167)) + (:next-launcher 1056) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 1056 + :init-specs ((:fade-a -0.53333336 -0.53333336)) + ) + +(defpart 1057 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.2) (meters 4)) + (:rot-x (degrees 11.25)) + (:rot-z (degrees 0) (degrees 8)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 64.0 64.0) + (:b 255.0) + (:a 32.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 4096.0) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters -0.1) (meters 0.5)) + ) + ) + +(defpart 1058 + :init-specs ((:texture (motion-blur-part level-default-sprite)) + (:num 2.0 4.0) + (:scale-x (meters 2.5)) + (:rot-x 4) + (:scale-y (meters 0.04) (meters 0.03)) + (:r 0.0) + (:g 64.0 64.0) + (:b 255.0) + (:a 128.0) + (:omega (degrees 0.01125) (degrees 0.01125)) + (:vel-y (meters 0.1) (meters 0.2)) + (:fade-g -2.55 -2.55) + (:fade-b -2.0) + (:fade-a -0.64 -0.64) + (:accel-y (meters -0.0033333334) (meters -0.0033333334)) + (:friction 0.8 0.02) + (:timer (seconds 0.335)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:func 'sparticle-motion-blur) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + ) + ) diff --git a/goal_src/jak3/engine/target/mech/mech-states.gc b/goal_src/jak3/engine/target/mech/mech-states.gc index cab081d7cf..45f91dfcda 100644 --- a/goal_src/jak3/engine/target/mech/mech-states.gc +++ b/goal_src/jak3/engine/target/mech/mech-states.gc @@ -7,3 +7,2750 @@ ;; DECOMP BEGINS +(define *mech-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) + (new 'static 'joint-exploder-static-joint-params :joint-index 17 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 18 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 19 :parent-joint-index -1) + ) + :collide-spec (collide-spec backgnd) + ) + ) + +(defun check-turn-on-shield ((arg0 target)) + (when (cpad-hold? (-> arg0 control cpad number) circle) + (if (handle->process (-> arg0 mech shield-handle)) + (go target-mech-shield) + ) + ) + ) + +(defstate target-mech-start (target) + :event target-mech-handler + :exit target-mech-exit + :code target-mech-init + :post target-post + ) + +;; WARN: Return type mismatch object vs symbol. +(defbehavior mech-can-throw? target () + (let ((v1-1 (vector-float*! (new 'stack-no-clear 'vector) (-> self control local-normal) 0.0))) + (vector+float*! v1-1 v1-1 (-> self control c-R-w fvec) 20480.0) + (the-as symbol (send-event (handle->process (-> self carry other)) 'can-drop? v1-1)) + ) + ) + +(defstate target-mech-stance (target) + :event target-mech-handler + :enter (behavior () + (set! (-> self control mod-surface) *mech-stance-mods*) + (set! (-> self control mod-surface turnvv) 40049.777) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (rot->dir-targ! (-> self control)) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + ) + :exit (behavior () + (target-effect-exit) + (target-mech-exit) + (rot->dir-targ! (-> self control)) + ) + :trans (behavior () + (check-turn-on-shield self) + (when (not (cpad-hold? (-> self control cpad number) circle)) + (if (and (move-legs?) + (and (< (fabs + (deg-diff (quaternion-y-angle (-> self control dir-targ)) (vector-y-angle (-> self control to-target-pt-xz))) + ) + 1820.4445 + ) + (time-elapsed? (-> self control time-of-last-zero-input) (seconds 0.05)) + ) + ) + (go target-mech-walk) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-mech-punch) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + (if (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons r1) + ) + (go target-mech-carry-pickup) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-mech-get-off?) + ) + (go target-mech-shield) + ) + ) + (fall-test target-mech-falling (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 jakb-mech-turn90-ja))) + (let ((v1-8 (ja-group))) + (if (and v1-8 (= v1-8 jakb-mech-walk-ja)) + (sound-play "mech-stop") + ) + ) + (ja-channel-push! 3 (seconds 0.2)) + (ja :group! jakb-mech-turn90-ja :dist 16384.0) + (ja :chan 1 :group! jakb-mech-turn20-ja :dist 3640.889) + (ja :chan 2 :group! jakb-mech-stance-ja :dist 0.0) + ) + ) + (let ((f28-0 0.0) + (f30-0 0.0) + (gp-1 #f) + ) + (until #f + (let ((f26-0 (y-angle (-> self control)))) + (deg-diff f26-0 (quaternion-y-angle (-> self control dir-targ))) + (suspend) + (let ((f26-1 (* (deg-diff f26-0 (y-angle (-> self control))) (-> self clock frames-per-second)))) + (cond + ((< 910.2222 (fabs f26-1)) + (set! f28-0 (seek f28-0 1.0 (* 16.0 (seconds-per-frame)))) + (set! gp-1 #t) + ) + (else + (set! f28-0 (seek f28-0 0.0 (* 6.0 (seconds-per-frame)))) + (when (and gp-1 (= f28-0 0.0)) + (set! gp-1 #f) + (sound-play "mech-twitch") + ) + ) + ) + (set! f30-0 (seek f30-0 (lerp-scale 1.0 0.0 (fabs f26-1) 3640.889 16384.0) (* 10.0 (seconds-per-frame)))) + (let ((v1-41 (-> self skel effect))) + (set! (-> v1-41 channel-offset) (cond + ((< 0.8 (- 1.0 f28-0)) + 2 + ) + ((< 0.5 f30-0) + 1 + ) + (else + 0 + ) + ) + ) + ) + 0 + (ja :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja-no-eval :chan 1 :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) + ) + ) + (let ((a0-44 (-> self skel root-channel 2))) + (let ((f0-22 (- 1.0 f28-0))) + (set! (-> a0-44 frame-interp 1) f0-22) + (set! (-> a0-44 frame-interp 0) f0-22) + ) + (set! (-> a0-44 param 0) 1.0) + (joint-control-channel-group-eval! a0-44 (the-as art-joint-anim #f) num-func-loop!) + ) + (can-play-stance-amibent?) + ) + ) + #f + ) + :post target-mech-post + ) + +(defstate target-mech-walk (target) + :event target-mech-handler + :enter (behavior () + (set! (-> self control mod-surface) *mech-walk-mods*) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + ) + :exit (behavior () + (target-effect-exit) + (target-mech-exit) + ) + :trans (behavior () + (check-turn-on-shield self) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-mech-punch) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + (let ((gp-0 (ja-group)) + (f0-2 (ja-aframe-num 0)) + ) + (when (if (or (and (= gp-0 jakb-mech-walk-ja) (>= f0-2 5.5) (>= 9.5 f0-2)) + (and (= gp-0 jakb-mech-walk-ja) (>= f0-2 20.5) (>= 24.5 f0-2)) + ) + #t + ) + (case (-> self control unknown-spool-anim00) + (('punch) + (go target-mech-punch) + ) + (('jump) + (if (can-jump? #f) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + (set! (-> self control unknown-word04) (the-as uint #f)) + ) + ) + ) + (when (and (< 5.0 (the-as float (-> self control unknown-word04))) + (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + ) + (set-forward-vel 0.0) + (go target-mech-stance) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-mech-get-off?) + ) + (go target-mech-shield) + ) + ) + ) + (if (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons r1) + ) + (go target-mech-carry-pickup) + ) + (fall-test target-mech-falling (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((f30-0 0.0) + (f28-0 0.0) + ) + (let ((f26-0 (cond + ((zero? (-> self mech walk-anim-leg)) + (set! (-> self mech walk-anim-leg) 1) + 7.0 + ) + (else + (set! (-> self mech walk-anim-leg) 0) + 22.0 + ) + ) + ) + (v1-7 (ja-group)) + ) + (when (not (and v1-7 (= v1-7 jakb-mech-walk-ja))) + (ja-channel-push! 3 (seconds 0.1)) + (ja :group! jakb-mech-walk-ja + :num! (identity (ja-aframe f26-0 0)) + :dist (-> *TARGET-bank* mech-walk-cycle-dist) + ) + (ja :chan 1 :group! jakb-mech-run-ja :dist (-> *TARGET-bank* mech-run-cycle-dist)) + (ja :chan 2 :group! jakb-mech-stance-ja :dist 0.0) + ) + ) + (until #f + (if (< (-> self control ctrl-xz-vel) 8192.0) + (set-forward-vel 8192.0) + ) + (suspend) + (let* ((f0-5 (current-cycle-distance (-> self skel))) + (f26-1 (/ (-> self control ctrl-xz-vel) f0-5)) + ) + (set! (-> self control unknown-word04) + (the-as uint (+ (the-as float (-> self control unknown-word04)) f26-1)) + ) + (set! f30-0 + (seek f30-0 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 16384.0 32768.0) (* 2.0 (seconds-per-frame))) + ) + (set! f28-0 + (seek f28-0 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 0.0 12288.0) (* 2.0 (seconds-per-frame))) + ) + (let ((v1-39 (-> self skel effect))) + (set! (-> v1-39 channel-offset) (if (< 0.5 f30-0) + 1 + 0 + ) + ) + ) + 0 + (ja :num! (loop! f26-1)) + ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja :chan 2 :num! (chan 0) :frame-interp0 f28-0 :frame-interp1 f28-0) + ) + ) + #f + ) + :post target-mech-post + ) + +(defbehavior target-mech-punch-pick target ((arg0 symbol)) + (local-vars (sv-144 control-info) (sv-160 float)) + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + *null-vector* + *null-vector* + (the-as process #f) + (current-time) + ) + (let* ((s4-0 (get-trans self 3)) + (s2-0 (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control send-attack-dest) + s4-0 + 32768.0 + (-> self control c-R-w fvec) + 65536.0 + ) + ) + (s5-0 (the-as art-element #f)) + ) + (when s2-0 + (let ((s3-0 (get-trans s2-0 3))) + (set! sv-144 (-> self control)) + (let ((s0-0 s3-0) + (s1-0 deg-diff) + ) + (set! sv-160 (y-angle sv-144)) + (let* ((a1-4 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s0-0 (-> sv-144 trans)))) + (f0-0 (s1-0 sv-160 a1-4)) + ) + (cond + ((>= f0-0 5461.3335) + (set! (-> self mech walk-anim-leg) 0) + 0 + ) + ((>= -5461.3335 f0-0) + (set! (-> self mech walk-anim-leg) 1) + ) + (else + (set! (-> self mech walk-anim-leg) 2) + ) + ) + ) + ) + (when (< (vector-vector-distance s3-0 s4-0) 32768.0) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer self)) + (set! (-> a1-6 num-params) 0) + (set! (-> a1-6 message) 'dont-face?) + (if (not (send-event-function s2-0 a1-6)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s3-0 s4-0) 1.0) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + ) + ) + ) + ) + (let ((v1-29 (-> self mech walk-anim-leg))) + (cond + ((zero? v1-29) + (set! (-> self mech walk-anim-leg) 1) + (set! s5-0 jakb-mech-punch-l-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 7 + 6963.2 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ((= v1-29 1) + (set! (-> self mech walk-anim-leg) 0) + (set! s5-0 jakb-mech-punch-r-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 17 + 6963.2 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ((= v1-29 2) + (set! (-> self mech walk-anim-leg) 0) + (set! s5-0 jakb-mech-punch-b-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 39 + 11141.12 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ((= v1-29 3) + (set! (-> self mech walk-anim-leg) 0) + (set! s5-0 jakb-mech-punch-u-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 39 + 11141.12 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (if (zero? arg0) + (ja-no-eval :group! s5-0 :num! (seek!)) + (ja-no-eval :group! s5-0 :num! (seek!) :frame-num (ja-aframe 10.0 0)) + ) + ) + (-> self mech walk-anim-leg) + ) + +(defstate target-mech-punch (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((focus-test? self dangerous) + (case message + (('touched) + (if ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 1920) + ) + (target-send-attack + proc + (-> self control danger-mode) + (the-as touching-shapes-entry (-> block param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + (target-mech-handler proc argc message block) + ) + ) + (('impact-control) + (when (-> self control danger-mode) + (-> block param 1) + (let* ((gp-1 (the-as object (-> block param 3))) + (s5-1 (-> (the-as collide-query gp-1) best-other-tri collide-ptr)) + (s4-1 (if (type? s5-1 collide-shape-prim) + s5-1 + ) + ) + (s3-1 (if s4-1 + (-> (the-as collide-shape-prim s4-1) cshape process) + (the-as process-drawable #f) + ) + ) + (s5-2 (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + (if (and s4-1 (and (or (and s5-2 (focus-test? (the-as process-focusable s5-2) dead)) + (when (send-event + (-> (the-as collide-shape-prim s4-1) cshape process) + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self control target-attack-id)) + (damage 200.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode (-> self control danger-mode)) + (count (-> self control attack-count)) + (penetrate-using (penetrate touch punch mech mech-punch)) + (intersection (-> (the-as collide-query gp-1) best-other-tri intersect)) + ) + ) + ) + (set! (-> self control send-attack-dest) (process->handle s5-2)) + (set-time! (-> self control send-attack-time)) + #t + ) + ) + s5-2 + (focus-test? (the-as process-focusable s5-2) dead) + ) + ) + (set! (-> self mech forward-vel) 0.0) + (set! (-> self mech forward-vel) -40960.0) + ) + (when (or (not s5-2) (= (-> self control send-attack-time) (current-time))) + (cond + ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> (the-as collide-query gp-1) best-other-tri intersect quad)) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> (the-as collide-query gp-1) best-other-tri intersect quad)) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) + ) + ) + (sound-play "mech-punch-hit" :position (+ (the-as uint gp-1) 48)) + (activate! *camera-smush-control* 1638.4 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ) + ) + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *mech-punch-mods*) + (set! (-> self mech state-impact? 0) #f) + (rot->dir-targ! (-> self control)) + ) + :exit (behavior () + (set! (-> *mech-punch-mods* turnvv) 0.0) + (set! (-> self mech state-impact? 0) #f) + (set-time! (-> self control last-running-attack-end-time)) + (target-exit) + (target-mech-exit) + ) + :code (behavior () + (set! (-> self mech forward-vel) (-> self control ctrl-xz-vel)) + 1.0 + (let ((s5-0 #f) + (gp-0 0) + (s4-0 30) + ) + (target-mech-punch-pick (the-as symbol gp-0)) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (when (and (not (focus-test? self dangerous)) + (let ((v1-10 (ja-group))) + (and v1-10 (or (= v1-10 jakb-mech-punch-l-ja) + (= v1-10 jakb-mech-punch-r-ja) + (= v1-10 jakb-mech-punch-b-ja) + (= v1-10 jakb-mech-punch-u-ja) + ) + ) + ) + (>= (ja-aframe-num 0) 12.0) + ) + (target-start-attack) + (target-danger-set! 'mech-punch #f) + ) + (when (and (cpad-pressed? (-> self control cpad number) square) (< gp-0 2)) + (let ((s3-0 (ja-group)) + (f30-0 (ja-aframe-num 0)) + ) + (if (or (and (= s3-0 jakb-mech-punch-l-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-l-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-0 jakb-mech-punch-r-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-r-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-0 jakb-mech-punch-b-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-b-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-0 jakb-mech-punch-u-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-u-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + ) + (set! s5-0 #t) + ) + ) + ) + (when s5-0 + (let ((s3-1 (ja-group)) + (f30-2 (ja-aframe-num 0)) + ) + (when (or (and (= s3-1 jakb-mech-punch-l-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-l-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-1 jakb-mech-punch-r-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-r-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-1 jakb-mech-punch-b-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-b-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-1 jakb-mech-punch-u-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-u-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + ) + (+! gp-0 1) + (target-mech-punch-pick (the-as symbol gp-0)) + (set! (-> self state-time) (+ (current-time) (seconds -0.465))) + (set! (-> self mech forward-vel) (fmax 0.0 (-> self mech forward-vel))) + (set! s4-0 159) + (set! s5-0 #f) + ) + ) + ) + (let ((v1-142 (- (current-time) (-> self state-time))) + (s3-2 #t) + (f30-4 1.0) + ) + (cond + ((< (-> self mech forward-vel) 0.0) + (seek! (-> self mech forward-vel) -0.04096 (* 122880.0 (seconds-per-frame))) + ) + ((let ((a0-43 (ja-group))) + (and a0-43 (or (= a0-43 jakb-mech-punch-b-ja) (= a0-43 jakb-mech-punch-u-ja))) + ) + (cond + ((< v1-142 (seconds 0.465)) + (set! s3-2 #f) + ) + ((< v1-142 (seconds 0.53)) + (set! (-> self mech forward-vel) (lerp-scale 40960.0 81920.0 (the float v1-142) 139.8 159.98999)) + ) + (else + (set! (-> self mech forward-vel) (lerp-scale 81920.0 0.0 (the float v1-142) 159.98999 300.0)) + ) + ) + ) + (else + (let ((a0-50 (ja-group))) + (cond + ((and a0-50 (= a0-50 jakb-mech-punch-l-ja)) + (cond + ((< v1-142 (seconds 0.465)) + (seek! (-> self mech forward-vel) 0.0 (* 20480.0 (seconds-per-frame))) + (set! s3-2 #f) + ) + ((< v1-142 (seconds 0.53)) + (set! (-> self mech forward-vel) (lerp-scale 20480.0 40960.0 (the float v1-142) 139.8 159.98999)) + ) + (else + (set! (-> self mech forward-vel) (lerp-scale 40960.0 0.0 (the float v1-142) 159.98999 300.0)) + ) + ) + ) + ((< v1-142 (seconds 0.465)) + (seek! (-> self mech forward-vel) 0.0 (* 20480.0 (seconds-per-frame))) + (set! s3-2 #f) + ) + ((< v1-142 (seconds 0.53)) + (set! (-> self mech forward-vel) (lerp-scale 20480.0 40960.0 (the float v1-142) 139.8 159.98999)) + ) + (else + (set! (-> self mech forward-vel) (lerp-scale 40960.0 0.0 (the float v1-142) 159.98999 300.0)) + ) + ) + ) + ) + ) + (set! s3-2 (and (time-elapsed? (-> self state-time) s4-0) (and (>= (-> self mech forward-vel) 0.0) s3-2))) + (set! (-> self mech state-impact? 0) s3-2) + (set-forward-vel (-> self mech forward-vel)) + (when (< 20480.0 (vector-length (-> self control transv))) + (do-effect (-> self skel effect) (the-as symbol "effect-slide-poof") (ja-frame-num 0) 49) + (do-effect (-> self skel effect) (the-as symbol "effect-slide-poof") (ja-frame-num 0) 43) + ) + (suspend) + (ja :num! (seek! max (* (-> self control current-surface align-speed) f30-4))) + ) + ) + ) + (go target-mech-stance) + ) + :post target-mech-post + ) + +(defstate target-mech-falling (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (let ((v0-0 (target-mech-bonk-event-handler proc argc message block))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + ) + :enter (behavior ((arg0 symbol)) + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *mech-jump-mods*) + (set! (-> self mech jump-thrust) 0.0) + (let* ((v1-4 *game-info*) + (v0-0 (+ (-> v1-4 attack-id) 1)) + ) + (set! (-> v1-4 attack-id) v0-0) + (set! (-> self control target-attack-id) v0-0) + ) + ) + :exit (behavior () + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + (target-exit) + (target-mech-exit) + ) + :trans (behavior () + (local-vars (a0-0 none)) + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-mech-hit-ground (the-as symbol a0-0)) + ) + (let ((f0-0 (target-move-dist (-> *TARGET-bank* stuck-time))) + (v1-9 (ja-group)) + ) + (when (if (and (and v1-9 (= v1-9 jakb-mech-jump-loop-ja)) + (< f0-0 (-> *TARGET-bank* stuck-distance)) + (and (time-elapsed? (-> self state-time) (seconds 2)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-mech-hit-ground 'stuck) + ) + ) + (let ((f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + (let ((f0-2 (-> self mech jump-thrust-fuel))) + (cond + ((cpad-hold? (-> self control cpad number) x) + (cond + ((= f0-2 0.0) + (seek! (-> self mech jump-thrust) 0.0 (* 245760.0 (seconds-per-frame))) + ) + ((!= f0-2 (-> *TARGET-bank* mech-jump-thrust-fuel)) + (let ((f28-0 + (lerp-scale 122880.0 8192.0 (-> self mech jump-thrust-fuel) 600.0 (-> *TARGET-bank* mech-jump-thrust-fuel)) + ) + ) + (lerp-scale 409.6 8192.0 (-> self mech jump-thrust-fuel) 600.0 (-> *TARGET-bank* mech-jump-thrust-fuel)) + (seek! + (-> self mech jump-thrust) + (- (- (-> self control dynam gravity-length) f30-0) f28-0) + (* 8192000.0 (seconds-per-frame)) + ) + ) + ) + (else + (set! (-> self mech jump-thrust) 0.0) + ) + ) + (seek! (-> self mech jump-thrust-fuel) 0.0 (the float (- (current-time) (-> self clock old-frame-counter)))) + ) + (else + (seek! (-> self mech jump-thrust) 0.0 (* 491520.0 (seconds-per-frame))) + ) + ) + ) + (let ((v1-72 (new-stack-vector0))) + (let ((f0-29 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-72 (-> self control transv) (vector-float*! v1-72 (-> self control dynam gravity-normal) f0-29)) + ) + (let* ((f0-30 (vector-length v1-72)) + (f1-7 f0-30) + (f2-2 (+ f30-0 (* (-> self mech jump-thrust) (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-2) + (vector-float*! v1-72 v1-72 (/ f0-30 f1-7)) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (until #f + (cond + ((< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (let ((v1-7 (ja-group))) + (when (not (and v1-7 (= v1-7 jakb-mech-jump-thrust-ja))) + (ja-channel-push! 1 (seconds 0.1)) + (ja :group! jakb-mech-jump-thrust-ja :num! min) + ) + ) + (suspend) + (ja :num! (loop! 0.75)) + ) + (else + (let ((v1-22 (ja-group))) + (when (not (and v1-22 (= v1-22 jakb-mech-jump-loop-ja))) + (ja-channel-push! 1 (seconds 0.5)) + (ja :group! jakb-mech-jump-loop-ja :num! min) + ) + ) + (suspend) + (ja :num! (loop!)) + ) + ) + ) + #f + ) + :post target-mech-post + ) + +(defstate target-mech-jump (target) + :event (-> target-mech-falling event) + :enter (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (let* ((v1-4 *game-info*) + (a2-5 (+ (-> v1-4 attack-id) 1)) + ) + (set! (-> v1-4 attack-id) a2-5) + (set! (-> self control target-attack-id) a2-5) + ) + (set! (-> self mech jump-thrust) 0.0) + (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) + (sound-play "mech-jump") + (set! (-> self control unknown-symbol03) (the-as float arg2)) + (set! (-> self control mod-surface) *mech-jump-mods*) + ) + :exit (-> target-mech-falling exit) + :trans (-> target-mech-falling trans) + :code (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (let ((v1-2 (ja-group))) + (if (and v1-2 (= v1-2 jakb-mech-jump-land-ja)) + (ja-channel-push! 1 (seconds 0.5)) + (ja-channel-push! 1 (seconds 0.05)) + ) + ) + ((the-as (function none) (-> target-mech-falling code))) + ) + :post target-mech-post + ) + +(defstate target-mech-hit-ground (target) + :event target-mech-handler + :enter (behavior ((arg0 symbol)) + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self mech thrust-sound-id)) + (set! (-> v1-0 params volume) -4) + (set! (-> v1-0 auto-time) 48) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 params mask) (the-as uint 17)) + (-> v1-0 id) + ) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + (set-time! (-> self state-time)) + (cond + ((= arg0 'stuck) + ) + (else + (target-land-effect) + ) + ) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (if (!= (-> self control ground-pat material) (pat-material ice)) + (delete-back-vel) + ) + (set! (-> self control mod-surface) *mech-stance-mods*) + (start-bobbing! + (-> self water) + (lerp-scale 0.0 4096.0 (-> self control ground-impact-vel) 40960.0 102400.0) + 600 + 1500 + ) + (activate! *camera-smush-control* 1638.4 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still)) + (target-mech-exit) + ) + :trans (behavior () + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-mech-punch) + ) + (when (time-elapsed? (-> self state-time) (seconds 0.25)) + (if (move-legs?) + (go target-mech-walk) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + (if (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons r1) + ) + (go target-mech-carry-pickup) + ) + ) + (set-forward-vel 0.0) + ) + :code (behavior ((arg0 symbol)) + (target-hit-ground-anim #f (are-still?)) + (go target-mech-stance) + ) + :post target-mech-post + ) + +(defstate target-mech-hit (target) + :event target-mech-handler + :exit (behavior () + ((-> target-hit exit)) + (target-mech-exit) + ) + :trans (behavior () + (when (= *cheat-mode* 'debug) + (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) + (set-time! (-> self control time-of-last-debug-heal)) + (pickup-collectable! (-> self fact) (pickup-type health) 100.0 (the-as handle #f)) + (go target-mech-stance) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 attack-info)) + (logclear! (-> self water flags) (water-flag jump-out)) + (set-time! (-> self state-time)) + (let ((gp-0 (-> self attack-info)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-4 gp-0)) + (set! (-> v1-4 attacker) (the-as handle #f)) + (set! (-> v1-4 mode) 'generic) + (set! (-> v1-4 shove-back) 10240.0) + (set! (-> v1-4 shove-up) 6144.0) + (set! (-> v1-4 angle) #f) + (set! (-> v1-4 trans quad) (-> self control trans quad)) + (set! (-> v1-4 control) 0.0) + (set! (-> v1-4 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) + ) + (case arg0 + (('shove) + (let ((v1-7 gp-0)) + (set! (-> v1-7 shove-back) (-> *TARGET-bank* smack-surface-dist)) + (set! (-> v1-7 shove-up) (-> *TARGET-bank* smack-surface-height)) + (set! (-> v1-7 angle) 'shove) + ) + ) + ) + (combine! gp-0 arg1 self) + (when (not (logtest? (-> gp-0 mask) (attack-mask vector))) + (vector-z-quaternion! (-> gp-0 vector) (-> self control quat-for-control)) + (vector-xz-normalize! (-> gp-0 vector) (- (fabs (-> gp-0 shove-back)))) + (set! (-> gp-0 vector y) (-> gp-0 shove-up)) + ) + (set! (-> s5-0 quad) (-> gp-0 vector quad)) + (let ((f0-10 (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-0 1.0) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) + ) + ) + ) + (if (not (-> self attack-info angle)) + (set! (-> self attack-info angle) (if (>= 0.0 f0-10) + 'front + 'back + ) + ) + ) + ) + (cond + ((= arg0 'attack) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> gp-0 mode) + (('endlessfall) + (cond + ((= (-> self game mode) 'debug) + (let ((s4-1 (new-stack-vector0))) + (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) + (ja-channel-set! 0) + (let ((s3-1 (current-time))) + (until (time-elapsed? s3-1 (seconds 1)) + (suspend) + ) + ) + (move-to-point! (-> self control) s4-1) + ) + (set! (-> self control camera-pos quad) (-> self control trans quad)) + (send-event *camera* 'teleport) + (go target-mech-stance) + ) + (else + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-mech-death (-> gp-0 mode)) + ) + ) + ) + ) + (target-hit-effect gp-0) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-mech-death (-> gp-0 mode)) + ) + (else + (case (-> gp-0 mode) + (('burn 'burnup) + (sound-play "get-burned") + ) + ) + ) + ) + (set! (-> self control mod-surface) *smack-mods*) + (let ((v1-63 (ja-group))) + (when (not (and v1-63 (= v1-63 jakb-mech-hit-front-ja))) + (ja-channel-push! 1 (seconds 0.075)) + (ja :group! jakb-mech-hit-front-ja :num! min) + ) + ) + (target-hit-move gp-0 (target-hit-orient gp-0 s5-0) target-mech-falling-anim-trans 1.0) + ) + (go target-mech-hit-ground #f) + ) + :post (behavior () + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (vector-float*! + (-> self control dynam gravity) + (-> self control dynam gravity-normal) + (the-as float (-> self control dynam gravity-length)) + ) + (target-mech-post) + ) + ) + +(defstate target-mech-death (target) + :event (-> target-death event) + :exit (behavior () + (set! (-> self mech stick-off) #f) + (target-mech-exit) + ((-> target-death exit)) + ) + :trans (-> target-mech-hit trans) + :code (behavior ((arg0 symbol)) + (set! (-> self mech stick-off) (the-as basic #t)) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control did-move-to-pole-or-max-jump-height) + (the-as float (send-event (handle->process (-> self attack-info attacker)) 'target 'die arg0)) + ) + (set! (-> self neck flex-blend) 0.0) + (target-timed-invulnerable-off self 0) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (set-setting! 'process-mask 'set 0.0 (process-mask platform projectile death)) + (apply-settings *setting-control*) + (set! (-> self control transv quad) (the-as uint128 0)) + (logior! (-> self focus-status) (focus-status dead)) + (let ((s5-0 (-> self child))) + (while s5-0 + (send-event (ppointer->process s5-0) 'notice 'die) + (set! s5-0 (-> s5-0 0 brother)) + ) + ) + (cond + ((or (= arg0 'none) (= arg0 'instant-death) (= arg0 'bot) (= arg0 'big-explosion)) + ) + ((= arg0 'grenade) + (sound-play "explosion") + ) + ((= arg0 'endlessfall) + (sound-play "mech-death-fall") + (set! (-> self control unknown-sound-id00) + (add-process *gui-control* *target* (gui-channel daxter) (gui-action play) "mechfall" -99.0 0) + ) + (sound-params-set! *gui-control* (-> self control unknown-sound-id00) #t -1 100 2 -1.0) + (set-setting! 'mode-name 'cam-endlessfall 0.0 0) + (logior! (-> self control pat-ignore-mask) (new 'static 'pat-surface :noendlessfall #x1)) + (logclear! (-> self water flags) (water-flag swim-ground)) + (let ((f0-2 (fmin -4096.0 (- (-> self control ground-impact-vel))))) + (set! (-> self control unknown-word04) (the-as uint f0-2)) + (let ((v1-58 (new-stack-vector0))) + (let ((f1-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-58 (-> self control transv) (vector-float*! v1-58 (-> self control dynam gravity-normal) f1-3)) + ) + (let* ((f1-4 (vector-length v1-58)) + (f2-1 f1-4) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-2) + (vector-float*! v1-58 v1-58 (/ f1-4 f2-1)) + ) + ) + ) + ) + (set! (-> self trans-hook) + (lambda :behavior target + () + (vector-seek! (-> self draw color-mult) *zero-vector* (seconds-per-frame)) + (let ((v1-2 (new-stack-vector0)) + (f0-2 (the-as number (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + ) + 0.0 + (vector-! + v1-2 + (-> self control transv) + (vector-float*! v1-2 (-> self control dynam gravity-normal) (the-as float f0-2)) + ) + (let* ((f1-2 (vector-length v1-2)) + (f2-0 f1-2) + ) + (if (< (the-as float (-> self control unknown-word04)) (the-as float f0-2)) + (set! f0-2 (-> self control unknown-word04)) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) (the-as float f0-2)) + (vector-float*! v1-2 v1-2 (/ f1-2 f2-0)) + ) + ) + ) + ((-> target-mech-hit trans)) + ) + ) + (ja-channel-push! 1 (seconds 0.3)) + (ja-no-eval :group! jakb-mech-jump-loop-ja :num! (loop! 0.5) :frame-num 0.0) + (let ((gp-3 (current-time))) + (until (time-elapsed? gp-3 (seconds 0.8)) + (ja :group! jakb-mech-jump-loop-ja :num! (loop! 0.5)) + (suspend) + ) + ) + (remove-setting! 'mode-name) + ) + (else + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (remove-setting! 'slave-options) + (remove-setting! 'fov) + (remove-setting! 'head-offset) + (send-event *camera* 'set-dist #f #f) + (set! (-> self burn-proc) + (ppointer->handle + (process-spawn-function process process-drawable-burn-effect 1200 :to (ppointer->process (-> self manipy))) + ) + ) + (let ((gp-5 (if (zero? (rand-vu-int-count 2)) + jakb-mech-death-a-ja + jakb-mech-death-b-ja + ) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 (if (logtest? (-> self water flags) (water-flag under-water)) + 0.55 + 1.0 + ) + ) + ) + (ja-no-eval :group! gp-5 :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.03)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (process-drawable-shock-effect + (the-as process-drawable (ppointer->process (-> self manipy))) + (-> *lightning-spec-id-table* 1) + lightning-probe-callback + (-> *part-id-table* 160) + 0 + 0 + 40960.0 + ) + ) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + (sound-play "mech-eject") + (cond + ((logtest? (-> *part-group-id-table* 236 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 236)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 236)) + ) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((gp-9 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (cond + ((logtest? (-> self water flags) (water-flag under-water)) + (set! (-> gp-9 duration) (seconds 8)) + (set! (-> gp-9 gravity) -20480.0) + (set! (-> gp-9 rot-speed) 4.2) + (set-vector! (-> gp-9 fountain-rand-transv-lo) -20480.0 12288.0 -20480.0 1.0) + (set-vector! (-> gp-9 fountain-rand-transv-hi) 20480.0 24576.0 20480.0 1.0) + ) + (else + (set! (-> gp-9 gravity) -204800.0) + (set-vector! (-> gp-9 fountain-rand-transv-lo) -61440.0 12288.0 -61440.0 1.0) + (set-vector! (-> gp-9 fountain-rand-transv-hi) 61440.0 49152.0 61440.0 1.0) + ) + ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-mech-explode" (the-as (pointer level) #f)) + 41 + gp-9 + *mech-exploder-params* + :name "joint-exploder" + :to (ppointer->process (-> self manipy)) + :unk 0 + ) + ) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> self control trans quad)) + (set! (-> self post-hook) target-no-move-post) + (ja-channel-set! 1) + (ja-no-eval :group! jakb-death-painful-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (set! (-> self control transv quad) (the-as uint128 0)) + (vector-seek! + (-> self draw color-mult) + (new 'static 'vector :x 0.5 :y 0.5 :z 0.5 :w 1.0) + (* 5.0 (seconds-per-frame)) + ) + (suspend) + (ja :num! (seek!)) + ) + (let ((gp-10 (current-time))) + (until (time-elapsed? gp-10 (seconds 2)) + (suspend) + ) + ) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f)) + (if (!= (-> self game mode) 'play) + (go target-jump 16384.0 16384.0 (the-as surface #f)) + ) + (set-time! (-> self state-time)) + (sleep-code) + ) + :post target-mech-post + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior target-mech-carry-update target () + (carry-info-method-9 (-> self carry)) + (when (and (= (-> self control collide-mode) 'mech-carry) (< (-> self control collide-mode-transition) 1.0)) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'inline-array 'sphere 1)) + ) + (dotimes (s4-0 1) + ((method-of-type sphere new) (the-as symbol (-> s5-0 s4-0)) sphere) + ) + (let ((f30-0 (seek (-> self control collide-mode-transition) 1.0 (* 0.1 (-> self clock time-adjust-ratio))))) + (set! (-> s5-0 0 quad) (-> self control collision-spheres 2 prim-core world-sphere quad)) + (set! (-> s5-0 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 11468.8 f30-0 0.0 1.0)) + (let ((v1-17 gp-0)) + (set! (-> v1-17 best-dist) (the-as float s5-0)) + (set! (-> v1-17 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-17 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-17 ignore-process0) #f) + (set! (-> v1-17 ignore-process1) #f) + (set! (-> v1-17 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-17 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-17 action-mask) (collide-action solid)) + ) + (if (not (fill-and-probe-using-spheres *collide-cache* gp-0)) + (target-collide-set! 'mech-carry f30-0) + ) + ) + ) + ) + (send-event (handle->process (-> self carry other)) 'carry (-> self carry)) + (none) + ) + +(defbehavior target-mech-carry-post target () + (logior! (-> self focus-status) (focus-status carry)) + (target-mech-post) + (target-mech-carry-update) + (none) + ) + +(defstate target-mech-carry-pickup (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touched) + (cond + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 1920) + ) + (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) 'carry?) + (let ((a1-3 (send-event-function proc a1-2))) + (when a1-3 + (let ((f0-0 (distance-from-destination (-> self carry) (the-as carry-info a1-3)))) + (when (and (>= f0-0 0.0) (< f0-0 (-> self carry other-value))) + (set! (-> self carry other) (process->handle proc)) + (set! (-> self carry other-value) f0-0) + ) + ) + ) + ) + ) + #f + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + (('change-mode 'end-mode) + #f + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-pickup-mods*) + (set! (-> self mech stick-off) (the-as basic #t)) + (set-time! (-> self state-time)) + (set-forward-vel 0.0) + (set! (-> self carry other) (the-as handle #f)) + (set! (-> self carry other-value) 100000000000.0) + (set! (-> self carry max-distance) 32768.0) + (set! (-> self carry mode) (carry-mode carry mech-carry mech-drag)) + (carry-info-method-9 (-> self carry)) + ) + :exit (behavior () + (when (not (and (-> self next-state) (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-mech-carry-stance) + (= v1-3 'target-mech-carry-walk) + (= v1-3 'target-mech-carry-drop) + (= v1-3 'target-mech-carry-throw) + (= v1-3 'target-mech-carry-jump) + (= v1-3 'target-mech-carry-falling) + (= v1-3 'target-mech-carry-hit-ground) + (= v1-3 'target-mech-carry-throw) + (= v1-3 'target-mech-carry-drag) + (= v1-3 'target-mech-shield) + ) + ) + ) + ) + (logclear! (-> self focus-status) (focus-status carry)) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) *null-vector*) + (target-collide-set! 'mech 0.0) + (target-exit) + ) + (set! (-> self mech stick-off) #f) + (target-mech-exit) + ) + :code (behavior () + (let ((f30-0 0.0) + (f28-0 0.0) + (gp-0 #f) + ) + (ja-channel-push! 2 1) + (ja :group! jakb-mech-carry-pickup-high-ja :num! min) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja :num! (seek!)) + (ja :chan 1 :num! (chan 0)) + (target-danger-set! 'carry? #f) + (suspend) + (ja :num! (seek!)) + (ja :chan 1 :num! (chan 0)) + (format #t "carry picked ~A~%" (handle->process (-> self carry other))) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) (process->ppointer self)) + (set! (-> a1-9 num-params) 0) + (set! (-> a1-9 message) 'carry-info) + (let ((s5-1 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-9)))) + (cond + (s5-1 + (let* ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> s5-1 point) (-> self control trans))) + (s3-0 (new-stack-vector0)) + (f26-0 (vector-dot (-> self control local-normal) s4-1)) + ) + 0.0 + (vector-! s3-0 s4-1 (vector-float*! s3-0 (-> self control local-normal) f26-0)) + (let* ((f24-0 (vector-length s3-0)) + (f22-0 f24-0) + ) + (set! f28-0 (lerp-scale 1.0 0.0 f26-0 3072.0 7168.0)) + (vector+! + s4-1 + (vector-float*! s4-1 (-> self control local-normal) f26-0) + (vector-float*! s3-0 s3-0 (/ f24-0 f22-0)) + ) + ) + ) + (cond + ((logtest? (-> s5-1 mode) (carry-mode mech-drag)) + (sound-play "mech-drag-pikup") + (let ((s4-5 (vector-! (new 'stack-no-clear 'vector) (-> self carry point) (-> s5-1 point)))) + (set! gp-0 #t) + (vector-xz-normalize! s4-5 (-> s5-1 max-pull)) + (vector+! s4-5 s4-5 (-> s5-1 point)) + ) + (let* ((f26-1 (y-angle (-> s5-1 process 0 control))) + (f0-15 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) (-> s5-1 point) (-> self carry point)))) + (f0-21 (the float (the int (* 0.000061035156 (+ 73728.0 (deg- f0-15 f26-1)))))) + (s5-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> self carry face-dir) (the int f0-21)) + (let ((f24-2 (the float (sar (shl (the int (* 16384.0 f0-21)) 48) 48)))) + (set! (-> self control unknown-word04) (the-as uint (+ f26-1 f24-2))) + (set-vector! s5-2 (sin (+ f26-1 f24-2)) 0.0 (cos (+ f26-1 f24-2)) 1.0) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + s5-2 + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + ) + (else + (sound-play "mech-drag-pikup") + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-normalize! (vector-! (new-stack-vector0) (-> s5-1 point) (-> self control trans)) 1.0) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + ) + ) + (else + (sound-play "mech-pickup-1") + ) + ) + ) + ) + (target-danger-set! 'harmless #f) + (cond + (gp-0 + (ja-channel-push! 1 (seconds 0.01)) + (ja-no-eval :group! jakb-mech-drag-pickup-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) + (while (not (ja-done? 0)) + (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + ) + ) + (let ((s4-11 (new 'stack-no-clear 'vector)) + (s5-6 (new 'stack-no-clear 'vector)) + ) + (when (send-event (handle->process (-> self carry other)) 'pickup (-> self carry) s4-11 s5-6) + (target-collide-set! 'mech-carry 0.0) + (when gp-0 + (sound-play "mech-drag-grab") + (let ((s3-6 (vector-! (new 'stack-no-clear 'vector) s4-11 (-> self control trans))) + (a1-37 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-37 from) (process->ppointer self)) + (set! (-> a1-37 num-params) 0) + (set! (-> a1-37 message) 'carry-info) + (let ((s4-12 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-37)))) + (vector-flatten! s3-6 s3-6 s5-6) + (let ((f0-43 (vector-length s3-6))) + (when (< 1228.8 f0-43) + (vector-normalize! s3-6 (+ -1228.8 f0-43)) + (move-by-vector! (-> self control) s3-6) + (vector+! (-> s4-12 hold-trans) (-> s4-12 hold-trans) s3-6) + ) + ) + ) + ) + (set-yaw-angle-clear-roll-pitch! (-> self control) (the-as float (-> self control unknown-word04))) + (rot->dir-targ! (-> self control)) + (go target-mech-carry-drag) + ) + (sound-play "mech-servo-up") + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + (go target-mech-carry-stance) + ) + ) + (cond + (gp-0 + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-no-eval :num! (seek! (ja-aframe 11.0 0))) + (while (not (ja-done? 0)) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + (suspend) + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + ) + ) + ) + (go target-mech-stance) + ) + :post (behavior () + (target-mech-post) + (carry-info-method-9 (-> self carry)) + (target-mech-carry-update) + ) + ) + +(defstate target-mech-carry-drop (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('change-mode 'end-mode) + #f + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-walk-mods*) + (set-time! (-> self state-time)) + (set-forward-vel 0.0) + (set! (-> self mech stick-off) (the-as basic #t)) + ) + :exit (-> target-mech-carry-pickup exit) + :code (behavior () + (let ((f30-0 1.0) + (gp-1 (sound-play "mech-servo-down")) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'carry-info) + (let ((a0-8 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-1)))) + (when a0-8 + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> a0-8 point quad)) + (set! (-> s5-1 y) (- (-> s5-1 y) (-> a0-8 process 0 control root-prim prim-core world-sphere w))) + (let ((s4-0 (new-stack-vector0)) + (f28-0 (vector-dot (-> self control local-normal) s5-1)) + ) + 0.0 + (vector-! s4-0 s5-1 (vector-float*! s4-0 (-> self control local-normal) f28-0)) + (let* ((f26-0 (vector-length s4-0)) + (f24-0 f26-0) + ) + (set! f30-0 (lerp-scale 1.0 0.0 f28-0 3072.0 7168.0)) + (vector+! + s5-1 + (vector-float*! s5-1 (-> self control local-normal) f28-0) + (vector-float*! s4-0 s4-0 (/ f26-0 f24-0)) + ) + ) + ) + ) + ) + ) + ) + (ja-channel-push! 2 (seconds 0.1)) + (ja :group! jakb-mech-carry-pickup-high-ja :num! max) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) + (while (not (ja-done? 0)) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 0) + (set! (-> a1-10 message) 'carry-info) + (let ((s5-5 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-10)))) + (when s5-5 + (if (< 20.0 (ja-aframe-num 0)) + (seek! (-> s5-5 grab-trans-blend) 1.0 (* 2.0 (seconds-per-frame))) + ) + (let ((s3-0 (-> s5-5 process 0 control)) + (s5-6 (new 'stack-no-clear 'collide-query)) + ) + (let ((s4-1 (new 'stack-no-clear 'inline-array 'sphere 1))) + (dotimes (s2-0 1) + ((method-of-type sphere new) (the-as symbol (-> s4-1 s2-0)) sphere) + ) + (set! (-> s4-1 0 quad) (-> s3-0 root-prim prim-core world-sphere quad)) + (let ((v1-66 s5-6)) + (set! (-> v1-66 best-dist) (the-as float s4-1)) + (set! (-> v1-66 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-66 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-66 ignore-process0) #f) + (set! (-> v1-66 ignore-process1) #f) + (set! (-> v1-66 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-66 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-66 action-mask) (collide-action solid)) + ) + ) + (format 0 "frame: ~f~%" (ja-frame-num 0)) + (when (and (fill-and-probe-using-spheres *collide-cache* s5-6) (< 12.5 (ja-frame-num 0))) + (sound-play "mech-setdown") + (let ((v1-73 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-73 command) (sound-command set-param)) + (set! (-> v1-73 id) gp-1) + (set! (-> v1-73 params volume) -4) + (set! (-> v1-73 auto-time) 48) + (set! (-> v1-73 auto-from) 2) + (set! (-> v1-73 params mask) (the-as uint 17)) + (-> v1-73 id) + ) + (set! gp-1 (sound-play "mech-servo-up")) + (let ((v1-77 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-77 command) (sound-command set-param)) + (set! (-> v1-77 id) gp-1) + (set! (-> v1-77 params volume) -4) + (set! (-> v1-77 auto-time) 192) + (set! (-> v1-77 auto-from) 2) + (set! (-> v1-77 params mask) (the-as uint 17)) + (-> v1-77 id) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-carry-stance) + ) + ) + ) + ) + ) + (suspend) + (ja-eval) + ) + ) + (sound-play "mech-setdown") + (let ((v1-93 (vector-float*! (new 'stack-no-clear 'vector) (-> self control local-normal) 0.0))) + (vector+float*! v1-93 v1-93 (-> self control c-R-w fvec) 20480.0) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) v1-93) + ) + (target-collide-set! 'mech 0.0) + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-stance) + ) + :post (-> target-mech-carry-pickup post) + ) + +(defstate target-mech-carry-stance (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('change-mode) + (case (-> block param 0) + (('falling) + (if (and (-> self next-state) (= (-> self next-state name) 'target-mech-carry-drag)) + #f + (go target-mech-carry-falling) + ) + ) + (('grab) + (if (not (-> block param 1)) + #t + (go target-mech-grab) + ) + ) + ) + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-stance-mods*) + (set! (-> self control mod-surface turnvv) 20024.889) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (rot->dir-targ! (-> self control)) + (set-time! (-> self state-time)) + ) + :exit (behavior () + ((-> target-mech-carry-pickup exit)) + (rot->dir-targ! (-> self control)) + ) + :trans (behavior () + (if (and (move-legs?) + (and (< (fabs + (deg-diff (quaternion-y-angle (-> self control dir-targ)) (vector-y-angle (-> self control to-target-pt-xz))) + ) + 1820.4445 + ) + (time-elapsed? (-> self control time-of-last-zero-input) (seconds 0.05)) + ) + ) + (go target-mech-carry-walk) + ) + (if (and (cpad-pressed? (-> self control cpad number) r1) + (time-elapsed? (-> self carry pickup-time) (seconds 0.1)) + ) + (go target-mech-carry-drop) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + enter-state + (let ((a0-24 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-3 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-24 a1-3) + ) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t) (mech-can-throw?)) + (go target-mech-carry-throw) + ) + (fall-test (the-as (state object target) target-mech-carry-falling) (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 jakb-mech-carry-turn45-ja))) + (ja-channel-push! 2 (seconds 0.2)) + (ja :group! jakb-mech-carry-turn45-ja :dist 8192.0) + (ja :chan 1 :group! jakb-mech-carry-stance-ja :dist 0.0) + ) + ) + (let ((f30-0 0.0)) + (until #f + (let ((f28-0 (y-angle (-> self control)))) + (deg-diff f28-0 (quaternion-y-angle (-> self control dir-targ))) + (suspend) + (let ((f28-1 (* (deg-diff f28-0 (y-angle (-> self control))) (-> self clock frames-per-second)))) + (set! f30-0 (if (< 910.2222 (fabs f28-1)) + (seek f30-0 1.0 (* 16.0 (seconds-per-frame))) + (seek f30-0 0.0 (* 6.0 (seconds-per-frame))) + ) + ) + (let* ((f0-9 (current-cycle-distance (-> self skel))) + (v1-26 (if (= f0-9 0.0) + 0.0 + (/ f28-1 f0-9) + ) + ) + (f0-11 v1-26) + ) + (ja :num! (loop! f0-11)) + ) + ) + ) + (let ((v1-32 (-> self skel root-channel 1)) + (f0-13 (- 1.0 f30-0)) + ) + (set! (-> v1-32 frame-interp 1) f0-13) + (set! (-> v1-32 frame-interp 0) f0-13) + ) + ) + ) + #f + ) + :post target-mech-carry-post + ) + +(defstate target-mech-carry-walk (target) + :event (-> target-mech-carry-stance event) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *mech-carry-walk-mods*) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + ) + :exit (-> target-mech-carry-pickup exit) + :trans (behavior () + (let ((gp-0 (ja-group)) + (f0-0 (ja-aframe-num 0)) + ) + (when (if (or (and (= gp-0 jakb-mech-carry-walk-ja) (>= f0-0 5.5) (>= 9.5 f0-0)) + (and (= gp-0 jakb-mech-carry-walk-ja) (>= f0-0 20.5) (>= 24.5 f0-0)) + ) + #t + ) + (when (and (< 5.0 (the-as float (-> self control unknown-word04))) + (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + ) + (set-forward-vel 0.0) + (go target-mech-carry-stance) + ) + ) + ) + (if (and (cpad-pressed? (-> self control cpad number) r1) + (time-elapsed? (-> self carry pickup-time) (seconds 0.1)) + ) + (go target-mech-carry-drop) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + enter-state + (let ((a0-24 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-2 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-24 a1-2) + ) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t) (mech-can-throw?)) + (go target-mech-carry-throw) + ) + (fall-test (the-as (state object target) target-mech-carry-falling) (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((f30-0 0.0)) + (let ((f28-0 (cond + ((zero? (-> self mech walk-anim-leg)) + (set! (-> self mech walk-anim-leg) 1) + 7.0 + ) + (else + (set! (-> self mech walk-anim-leg) 0) + 22.0 + ) + ) + ) + (v1-7 (ja-group)) + ) + (when (not (and v1-7 (= v1-7 jakb-mech-carry-walk-ja))) + (ja-channel-push! 2 (seconds 0.1)) + (ja :group! jakb-mech-carry-walk-ja + :num! (identity (ja-aframe f28-0 0)) + :dist (-> *TARGET-bank* mech-walk-carry-cycle-dist) + ) + (ja :chan 1 :group! jakb-mech-carry-stance-ja :dist 0.0) + ) + ) + (until #f + (if (< (-> self control ctrl-xz-vel) 4096.0) + (set-forward-vel 4096.0) + ) + (suspend) + (let* ((f0-4 (current-cycle-distance (-> self skel))) + (f28-1 (/ (-> self control ctrl-xz-vel) f0-4)) + ) + (set! (-> self control unknown-word04) + (the-as uint (+ (the-as float (-> self control unknown-word04)) f28-1)) + ) + (set! f30-0 + (seek f30-0 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 0.0 8192.0) (* 2.0 (seconds-per-frame))) + ) + (ja :num! (loop! f28-1)) + ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + ) + ) + #f + ) + :post target-mech-carry-post + ) + +(defstate target-mech-carry-drag (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('push) + (when (zero? (-> self control sliding-start-time)) + (set! (-> self control sliding-start-time) (+ (current-time) (the-as time-frame (-> block param 0)))) + (let ((v0-0 (the-as object #t))) + (set! (-> self control unknown-word04) (the-as uint v0-0)) + v0-0 + ) + ) + ) + (('drop) + (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons r1)) + (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (pad-buttons r1)) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) *null-vector*) + (target-collide-set! 'mech 0.0) + (go target-mech-stance) + ) + (else + ((-> target-mech-carry-stance event) proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control sliding-start-time) 0) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control mod-surface) *mech-carry-drag-mods*) + (set-forward-vel 0.0) + ) + :exit (behavior () + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + (let ((v1-3 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-3 command) (sound-command set-param)) + (set! (-> v1-3 id) (-> self mech thrust-sound-id)) + (set! (-> v1-3 params volume) -4) + (set! (-> v1-3 auto-time) 48) + (set! (-> v1-3 auto-from) 2) + (set! (-> v1-3 params mask) (the-as uint 17)) + (-> v1-3 id) + ) + (let ((v1-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-5 command) (sound-command set-param)) + (set! (-> v1-5 id) (-> self mech drag-sound-id)) + (set! (-> v1-5 params volume) -4) + (set! (-> v1-5 auto-time) 48) + (set! (-> v1-5 auto-from) 2) + (set! (-> v1-5 params mask) (the-as uint 17)) + (-> v1-5 id) + ) + ((-> target-mech-carry-pickup exit)) + ) + :trans (behavior () + (when (and (not (cpad-hold? (-> self control cpad number) r1)) + (time-elapsed? (-> self carry pickup-time) (seconds 0.5)) + ) + (sound-play "mech-drag-off") + (if (or (and (>= (-> self mech back-touch-time) (-> self state-time)) + (< (vector-vector-distance (-> self control trans) (-> self mech back-touch-trans)) 4096.0) + ) + (let ((gp-1 (new 'stack-no-clear 'collide-query))) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'sphere 1))) + (dotimes (s4-0 1) + ((method-of-type sphere new) (the-as symbol (-> s5-1 s4-0)) sphere) + ) + (set! (-> s5-1 0 quad) (-> self control collision-spheres 0 prim-core world-sphere quad)) + (vector+float*! (the-as vector (-> s5-1 0)) (the-as vector (-> s5-1 0)) (-> self control c-R-w fvec) -4096.0) + (set! (-> s5-1 0 r) (-> self control collision-spheres 0 prim-core world-sphere w)) + (let ((v1-30 gp-1)) + (set! (-> v1-30 best-dist) (the-as float s5-1)) + (set! (-> v1-30 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-30 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-30 ignore-process0) #f) + (set! (-> v1-30 ignore-process1) #f) + (set! (-> v1-30 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-30 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-30 action-mask) (collide-action solid)) + ) + ) + (fill-and-probe-using-spheres *collide-cache* gp-1) + ) + ) + (send-event self 'push (seconds 0.5)) + (send-event self 'drop) + ) + ) + ) + :code (behavior () + (let ((f28-0 0.0) + (f30-0 0.0) + ) + (until #f + (let ((f0-2 + (* (vector-dot (-> self control to-target-pt-xz) (-> self control c-R-w fvec)) + (-> self control turn-to-magnitude) + ) + ) + (f26-0 0.0) + ) + (if (and (nonzero? (-> self control sliding-start-time)) (< (-> self control sliding-start-time) (current-time))) + (send-event self 'drop) + (set! f28-0 (cond + ((nonzero? (-> self control sliding-start-time)) + (let ((v1-17 (ja-group))) + (when (not (and v1-17 (= v1-17 jakb-mech-push-ja))) + (let ((v1-23 (ja-group))) + (if (and v1-23 (= v1-23 jakb-mech-pull-ja)) + (set! f26-0 (ja-aframe-num 0)) + ) + ) + (sound-play "mech-drag-push") + (ja-channel-push! 1 (seconds 0.3)) + (ja :group! jakb-mech-push-ja :num! (identity (ja-aframe f26-0 0)) :dist 16384.0) + ) + ) + (when (-> self control unknown-spool-anim00) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! f28-0 32768.0) + ) + (seek f28-0 0.0 (* 65536.0 (seconds-per-frame))) + ) + ((< 0.0 f0-2) + (let ((v1-47 (ja-group))) + (when (not (and v1-47 (= v1-47 jakb-mech-push-ja))) + (let ((v1-53 (ja-group))) + (if (and v1-53 (= v1-53 jakb-mech-pull-ja)) + (set! f26-0 (ja-aframe-num 0)) + ) + ) + (sound-play "mech-drag-push") + (ja-channel-push! 1 (seconds 0.3)) + (ja :group! jakb-mech-push-ja :num! (identity (ja-aframe f26-0 0)) :dist 16384.0) + ) + ) + (seek f28-0 49152.0 (* 24576.0 (seconds-per-frame))) + ) + ((< f0-2 0.0) + (let ((v1-71 (ja-group))) + (when (not (and v1-71 (= v1-71 jakb-mech-pull-ja))) + (let ((v1-77 (ja-group))) + (if (and v1-77 (= v1-77 jakb-mech-push-ja)) + (set! f26-0 (ja-aframe-num 0)) + ) + ) + (sound-play "mech-drag-pull") + (ja-channel-push! 1 (seconds 0.3)) + (ja :group! jakb-mech-pull-ja :num! (identity (ja-aframe f26-0 0)) :dist 16384.0) + ) + ) + (seek f28-0 -49152.0 (* 24576.0 (seconds-per-frame))) + ) + (else + (seek f28-0 0.0 (* 32768.0 (seconds-per-frame))) + ) + ) + ) + ) + ) + (set! f30-0 + (seek + f30-0 + (lerp-scale + 0.0 + 1.0 + (* (vector-vector-distance (-> self control trans) (-> self control trans-old-old)) + (-> self clock frames-per-second) + ) + 0.0 + 49152.0 + ) + (* 2.0 (seconds-per-frame)) + ) + ) + (sound-play-by-name + (static-sound-name "mech-drag-grind") + (-> self mech drag-sound-id) + (the int (* 1024.0 f30-0)) + 0 + 0 + (sound-group) + #t + ) + (set-forward-vel f28-0) + (let* ((f0-24 (current-cycle-distance (-> self skel))) + (f26-1 (/ f28-0 (* 2.0 f0-24))) + ) + (seek! + (-> self mech jump-thrust) + (lerp-scale 0.0 245760.0 (fabs f28-0) 0.0 49152.0) + (* 491520.0 (seconds-per-frame)) + ) + (let ((v1-114 (ja-group))) + (if (and v1-114 (or (= v1-114 jakb-mech-push-ja) (= v1-114 jakb-mech-pull-ja))) + (ja :num! (loop! f26-1)) + ) + ) + ) + (suspend) + 0 + ) + ) + #f + ) + :post target-mech-carry-post + ) + +(defstate target-mech-carry-falling (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (let ((v0-0 (target-mech-bonk-event-handler proc argc message block))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + ((-> target-mech-carry-stance event) proc argc message block) + ) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-carry-jump-mods*) + (set-time! (-> self state-time)) + ) + :exit (-> target-mech-carry-pickup exit) + :trans (behavior () + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-mech-carry-hit-ground #f) + ) + (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (time-elapsed? (-> self state-time) (seconds 0.05)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-mech-carry-hit-ground 'stuck) + ) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 jakb-mech-carry-jump-loop-ja)) + ) + (else + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! jakb-mech-carry-jump-loop-ja) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (suspend) + ) + ) + ) + ) + (ja-no-eval :group! jakb-mech-carry-jump-loop-ja :num! (loop!) :frame-num 0.0) + (until #f + (suspend) + (ja :group! jakb-mech-carry-jump-loop-ja :num! (loop!)) + ) + #f + ) + :post target-mech-carry-post + ) + +(defstate target-mech-carry-hit-ground (target) + :event (-> target-mech-carry-falling event) + :enter (behavior ((arg0 symbol)) + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self mech thrust-sound-id)) + (set! (-> v1-0 params volume) -4) + (set! (-> v1-0 auto-time) 48) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 params mask) (the-as uint 17)) + (-> v1-0 id) + ) + (rot->dir-targ! (-> self control)) + (cond + ((= arg0 'stuck) + ) + (else + (target-land-effect) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) + ) + ) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (if (!= (-> self control ground-pat material) (pat-material ice)) + (delete-back-vel) + ) + (set! (-> self control mod-surface) *mech-stance-mods*) + (set! (-> self control mod-surface turnvv) 0.0) + (start-bobbing! + (-> self water) + (lerp-scale 0.0 4096.0 (-> self control ground-impact-vel) 40960.0 102400.0) + 600 + 1500 + ) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still)) + ((-> target-mech-carry-pickup exit)) + ) + :trans (behavior () + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + enter-state + (let ((a0-16 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-2 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-16 a1-2) + ) + ) + (if (and (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + (let ((v1-26 (ja-group))) + (and (and v1-26 (= v1-26 jakb-mech-carry-jump-land-ja)) (>= (ja-aframe-num 0) 30.0)) + ) + ) + (go target-mech-carry-walk) + ) + (fall-test (the-as (state object target) target-mech-carry-falling) (-> *TARGET-bank* fall-height)) + ) + :code (behavior ((arg0 symbol)) + (target-hit-ground-anim #f (are-still?)) + (go target-mech-carry-stance) + ) + :post target-mech-carry-post + ) + +(defstate target-mech-carry-jump (target) + :event (-> target-mech-carry-falling event) + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (sound-play "mech-jump") + (set! (-> self control mod-surface) *mech-carry-jump-mods*) + (set! (-> self control unknown-float36) + (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control ctrl-xz-vel))))) + ) + ) + :exit (behavior () + (rot->dir-targ! (-> self control)) + ((-> target-mech-carry-pickup exit)) + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + (target-exit) + ) + :trans (behavior () + (set! (-> self control unknown-float36) + (fmax + (-> self control unknown-float36) + (* 0.003921569 (the float (-> *cpad-list* cpads (-> self control cpad number) abutton 6))) + ) + ) + ((-> target-mech-carry-falling trans)) + (mod-var-jump #t #f (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + (cond + ((>= (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 0.0) + (set! (-> self mech jump-thrust) 0.0) + ) + (else + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + ) + ) + ) + :code (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 1 (seconds 0.05)) + (ja :group! jakb-mech-carry-jump-ja :num! min) + (suspend) + (ja :group! jakb-mech-carry-jump-ja :num! (+!)) + (suspend) + (until (ja-done? 0) + (let ((f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f0-4 (- 10.0 (ja-aframe-num 0))) + (gp-1 (-> self skel root-channel 0)) + ) + (set! (-> gp-1 param 0) (the float (+ (-> gp-1 frame-group frames num-frames) -1))) + (let ((v1-27 (and (< 0.0 f30-0) (< 0.0 f0-4)))) + (set! (-> gp-1 param 1) + (if v1-27 + (fmin (fmin 3.0 f0-4) (/ (* 5.0 f0-4) (the float (time-to-apex f30-0 -245760.0)))) + 1.8 + ) + ) + ) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + (suspend) + ) + (go target-mech-carry-falling) + ) + :post target-mech-carry-post + ) + +(defstate target-mech-carry-throw (target) + :event (-> target-mech-carry-drop event) + :enter (behavior () + (set! (-> self control mod-surface) *mech-walk-mods*) + (set-time! (-> self state-time)) + (set-forward-vel 0.0) + (set! (-> self mech stick-off) (the-as basic #t)) + ) + :exit (-> target-mech-carry-pickup exit) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-mech-carry-throw-ja :num! (seek! (ja-aframe 16.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (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) 'carry-info) + (let ((gp-1 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-3)))) + (if gp-1 + (seek! (-> gp-1 grab-trans-blend) 1.0 (* 4.0 (seconds-per-frame))) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 16.0 0))) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer self)) + (set! (-> a1-7 num-params) 0) + (set! (-> a1-7 message) 'carry-info) + (let ((v1-30 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-7)))) + (when v1-30 + (let ((s4-0 (-> v1-30 process 0 control)) + (gp-3 (new 'stack-no-clear 'collide-query)) + ) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'sphere 1))) + (dotimes (s3-0 1) + ((method-of-type sphere new) (the-as symbol (-> s5-0 s3-0)) sphere) + ) + (set! (-> s5-0 0 quad) (-> s4-0 root-prim prim-core world-sphere quad)) + (let ((v1-38 gp-3)) + (set! (-> v1-38 best-dist) (the-as float s5-0)) + (set! (-> v1-38 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-38 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-38 ignore-process0) #f) + (set! (-> v1-38 ignore-process1) #f) + (set! (-> v1-38 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-38 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-38 action-mask) (collide-action solid)) + ) + ) + (when (fill-and-probe-using-spheres *collide-cache* gp-3) + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-carry-stance) + ) + ) + ) + ) + ) + (let ((v1-48 (vector-float*! (new 'stack-no-clear 'vector) (-> self control local-normal) 2048.0))) + (vector+float*! v1-48 v1-48 (-> self control c-R-w fvec) 131072.0) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) v1-48) + ) + (target-collide-set! 'normal 0.0) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-stance) + ) + :post (-> target-mech-carry-pickup post) + ) + +(defstate target-mech-get-on (target) + :event target-generic-event-handler + :exit (behavior () + (target-mech-exit) + (set! (-> self mech stick-off) #f) + (set! (-> self neck flex-blend) 1.0) + (logclear! (-> self target-flags) (target-flags tf5)) + ) + :code (behavior ((arg0 handle)) + (logior! (-> self target-flags) (target-flags tf5)) + (ja-channel-set! 1) + (set! (-> self control mod-surface) *empty-mods*) + (send-event (ppointer->process (-> self manipy)) 'draw #t) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-vector37 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector38 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector39 quad) (-> self control quat quad)) + (set! (-> self control unknown-vector40 quad) (-> self control quat quad)) + (let* ((gp-1 (handle->process arg0)) + (v1-23 (if (type? gp-1 process-drawable) + gp-1 + ) + ) + ) + (when v1-23 + (set! (-> self control unknown-vector38 quad) (-> (the-as process-drawable v1-23) root trans quad)) + (set! (-> self control unknown-vector40 quad) (-> (the-as process-drawable v1-23) root quat quad)) + ) + ) + (set! (-> self mech mech-trans quad) (-> self control unknown-vector38 quad)) + (quaternion-copy! + (the-as quaternion (-> self mech mech-quat)) + (the-as quaternion (-> self control unknown-vector40)) + ) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (set! (-> self mech stick-off) (the-as basic #t)) + (ja-no-eval :group! jakb-mech-get-on-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (let ((f30-0 (sin (lerp-scale 0.0 16384.0 (ja-aframe-num 0) 70.0 80.0)))) + (let ((f28-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) 70.0 80.0))) + (vector-lerp! + (-> self control trans) + (-> self control unknown-vector37) + (-> self control unknown-vector38) + f30-0 + ) + (set! (-> self control trans y) + (lerp (-> self control unknown-vector37 y) (-> self control unknown-vector38 y) f28-0) + ) + ) + (quaternion-slerp! + (-> self control quat-for-control) + (the-as quaternion (-> self control unknown-vector39)) + (the-as quaternion (-> self control unknown-vector40)) + f30-0 + ) + ) + (rot->dir-targ! (-> self control)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (suspend) + (ja :num! (seek!)) + ) + (go target-mech-stance) + ) + :post (behavior () + (target-no-move-post) + (target-mech-effect) + ) + ) + +(defstate target-mech-get-up (target) + :event target-generic-event-handler + :exit (behavior () + (target-mech-exit) + (set! (-> self mech stick-off) #f) + (set! (-> self neck flex-blend) 1.0) + (logclear! (-> self target-flags) (target-flags tf5)) + ) + :code (behavior ((arg0 handle)) + (logior! (-> self target-flags) (target-flags tf5)) + (ja-channel-set! 1) + (set! (-> self control mod-surface) *empty-mods*) + (send-event (ppointer->process (-> self manipy)) 'draw #t) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-vector37 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector38 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector39 quad) (-> self control quat quad)) + (set! (-> self control unknown-vector40 quad) (-> self control quat quad)) + (let* ((gp-1 (handle->process arg0)) + (v1-23 (if (type? gp-1 process-drawable) + gp-1 + ) + ) + ) + (when v1-23 + (set! (-> self control unknown-vector38 quad) (-> (the-as process-drawable v1-23) root trans quad)) + (set! (-> self control unknown-vector40 quad) (-> (the-as process-drawable v1-23) root quat quad)) + ) + ) + (set! (-> self mech mech-trans quad) (-> self control unknown-vector38 quad)) + (quaternion-copy! + (the-as quaternion (-> self mech mech-quat)) + (the-as quaternion (-> self control unknown-vector40)) + ) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (set! (-> self mech stick-off) (the-as basic #t)) + (ja-no-eval :group! jakb-mech-get-on-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (let ((f30-0 (sin (lerp-scale 0.0 16384.0 (ja-aframe-num 0) 70.0 80.0)))) + (let ((f28-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) 70.0 80.0))) + (vector-lerp! + (-> self control trans) + (-> self control unknown-vector37) + (-> self control unknown-vector38) + f30-0 + ) + (set! (-> self control trans y) + (lerp (-> self control unknown-vector37 y) (-> self control unknown-vector38 y) f28-0) + ) + ) + (quaternion-slerp! + (-> self control quat-for-control) + (the-as quaternion (-> self control unknown-vector39)) + (the-as quaternion (-> self control unknown-vector40)) + f30-0 + ) + ) + (rot->dir-targ! (-> self control)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (suspend) + (ja :num! (seek!)) + ) + (go target-mech-stance) + ) + :post (behavior () + (target-no-move-post) + (target-mech-effect) + ) + ) + +(defstate target-mech-shield (target) + :event target-mech-handler + :enter (behavior () + (vector-reset! (-> self control transv)) + (set! (-> self mech stick-off) (the-as basic #t)) + (send-event (handle->process (-> self mech shield-handle)) 'enabled) + ) + :exit (behavior () + (set! (-> self mech stick-off) #f) + (send-event (handle->process (-> self mech shield-handle)) 'disabled) + (sound-stop (-> self mech shield-sound-id)) + ) + :trans (behavior () + (sound-play "mech-shieldloop" :id (-> self mech shield-sound-id)) + (if (or (not (handle->process (-> self mech shield-handle))) + (not (logtest? (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons circle))) + ) + (go target-mech-stance) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-mech-get-off-ja :num! (seek! (ja-aframe 30.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 30.0 0))) + ) + (sleep-code) + ) + :post target-mech-post + ) + +(defstate target-mech-get-off (target) + :event target-generic-event-handler + :exit (behavior () + ((-> target-mech-start exit)) + (logclear! (-> self target-flags) (target-flags tf5)) + ) + :code (behavior () + (logior! (-> self target-flags) (target-flags tf5)) + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (set-setting! 'slave-options 'clear 0.0 (cam-slave-options BIKE_MODE)) + (remove-setting! 'fov) + (remove-setting! 'head-offset) + (send-event *camera* 'set-dist #f #f) + (set! (-> self neck flex-blend) 0.0) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-mech-get-off-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (when (< 51.0 (ja-aframe-num 0)) + (logior! (-> self target-flags) (target-flags tf6)) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + ) + (suspend) + (ja :num! (seek!)) + ) + (process-spawn + mech + :init mech-init + (-> self mech entity) + (-> self control trans) + (process->handle self) + (-> self mech shield-value) + :name "mech" + :to self + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector<-cspace! gp-1 (joint-node jakb-lod0-jg main)) + (+! (-> gp-1 y) -9011.2) + (move-to-point! (-> self control) gp-1) + ) + (send-event *camera* 'ease-in) + (ja-channel-set! 0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (let ((v1-66 (new-stack-vector0))) + (let ((f0-13 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-66 (-> self control transv) (vector-float*! v1-66 (-> self control dynam gravity-normal) f0-13)) + ) + (let* ((f0-14 (vector-length v1-66)) + (f1-2 f0-14) + (f2-0 -49152.0) + (a0-36 (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-66 v1-66 (/ f0-14 f1-2)) + ) + ) + ) + (go target-falling a0-36) + ) + ) + ) + :post (-> target-mech-get-on post) + ) + +(defstate target-mech-grab (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + (-> self state name) + ) + (else + (case message + (('end-mode) + (case (-> block param 0) + (('grab) + (go target-mech-stance) + ) + ) + ) + (('clone-anim) + (go target-mech-clone-anim (process->handle (the-as process (-> block param 0)))) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf2)) + (logior! (-> self focus-status) (focus-status grabbed)) + (set! (-> self mech stick-off) (the-as basic #t)) + (sound-stop (-> self mech engine-sound-id)) + (sound-stop (-> self mech thrust-sound-id)) + (sound-stop (-> self mech drag-sound-id)) + (sound-stop (-> self mech whine-sound-id)) + ) + :exit (behavior () + (target-effect-exit) + (set! (-> self mech stick-off) #f) + (logclear! (-> self target-flags) (target-flags tf2)) + (logclear! (-> self focus-status) (focus-status grabbed)) + (logclear! (-> self water flags) (water-flag jump-out)) + ((-> target-mech-start exit)) + ) + :code (-> target-mech-stance code) + :post target-mech-post + ) + +(defstate target-mech-clone-anim (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (if (and (= message 'trans) (= (-> block param 0) 'restore)) + (set! (-> self control unknown-word04) (the-as uint #f)) + ) + ((-> target-mech-grab event) proc argc message block) + ) + :enter (-> target-clone-anim enter) + :exit (behavior () + (set! (-> self control draw-offset y) (the-as float (-> self control unknown-word04))) + (set! (-> self control cspace-offset y) (-> self control draw-offset y)) + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ((-> target-clone-anim exit)) + ((-> target-mech-start exit)) + (vector-reset! (-> self control transv)) + ) + :code (behavior ((arg0 handle)) + (set! (-> self control unknown-word04) (the-as uint (-> self control draw-offset y))) + (set! (-> self control draw-offset y) 0.0) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (clone-anim arg0 #t "") + (go target-mech-stance) + ) + :post (behavior () + (vector+! (-> self mech mech-trans) (-> self control trans) (-> self control cspace-offset)) + (quaternion-copy! (the-as quaternion (-> self mech mech-quat)) (-> self control quat)) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (target-no-ja-move-post) + ) + ) diff --git a/goal_src/jak3/engine/target/mech/mech.gc b/goal_src/jak3/engine/target/mech/mech.gc index 802e92e8e3..42731ea6fe 100644 --- a/goal_src/jak3/engine/target/mech/mech.gc +++ b/goal_src/jak3/engine/target/mech/mech.gc @@ -7,3 +7,482 @@ ;; DECOMP BEGINS +(deftype mech (process-drawable) + ((root collide-shape-moving :override) + (extra-trans vector :inline) + (condition int32) + (shadow-backup shadow-geo) + (rider handle) + (shield-value float) + (nav-sphere-handle handle) + (probe-time time-frame) + ) + (:state-methods + wait-for-start + idle + (pickup (state mech)) + wait-for-return + ) + (:methods + (mech-method-24 (_type_) none) + ) + ) + + +(defmethod mech-method-24 ((this mech)) + (if (nonzero? (-> this part)) + (spawn (-> this part) (-> this root trans)) + ) + (update! (-> this sound)) + 0 + (none) + ) + +(defstate wait-for-start (mech) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack 'bonk) + (send-event proc 'target-mech-get-off (seconds 0.3)) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + (the-as structure #f) + ) + (('touch) + (send-event proc 'target-mech-get-off (seconds 0.3)) + (send-shoves (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0) + (the-as structure #f) + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-2 (the-as structure (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-2)) + v0-2 + ) + ) + (else + (set! (-> self draw shadow) #f) + (the-as structure #f) + ) + ) + ) + ) + ) + :exit (behavior () + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + ) + :code (behavior () + (go-virtual idle) + ) + ) + +(defstate idle (mech) + :virtual #t + :event (-> (method-of-type mech wait-for-start) event) + :enter (behavior () + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (let ((s5-0 (find-nearest-nav-mesh (-> self root trans) 8192.0))) + (when s5-0 + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! gp-0 (-> self root quat)) + (vector-normalize! gp-0 5120.0) + (vector+! gp-0 gp-0 (-> self root trans)) + (set! (-> self nav-sphere-handle) + (ppointer->handle + (process-spawn simple-nav-sphere #x46266666 gp-0 s5-0 -1 :name "simple-nav-sphere" :to self) + ) + ) + ) + ) + ) + ) + :exit (behavior () + (send-event (handle->process (-> self nav-sphere-handle)) 'die-fast) + ((-> (method-of-type mech wait-for-start) exit)) + ) + :code (behavior () + (change-parent self *entity-pool*) + (ja-channel-set! 1) + (ja :group! mech-mech-idle-ja) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + 0.0 + (let ((f30-0 20480.0)) + (until #f + (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) + (time-elapsed? (-> self probe-time) (seconds 1)) + ) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + (set-time! (-> self probe-time)) + ) + (when (and (and *target* (and (>= f30-0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (focus-test? *target* in-head pole light board mech dark)) + (can-display-query? self "mech" -99.0) + (-> *setting-control* user-current pilot) + ) + (let ((gp-0 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-31 gp-0)) + (set! (-> v1-31 width) (the float 340)) + ) + (let ((v1-32 gp-0)) + (set! (-> v1-32 height) (the float 80)) + ) + (let ((v1-33 gp-0) + (a0-19 (-> *setting-control* user-default language)) + ) + (set! (-> v1-33 scale) (if (or (= a0-19 (language-enum korean)) (= a0-19 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id text-0083) #f) + gp-0 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (if (and (cpad-pressed? 0 triangle) (send-event *target* 'change-mode 'mech self (-> self shield-value))) + (go-virtual pickup (method-of-object self wait-for-return)) + ) + ) + (if *target* + (look-at! + (-> *target* neck) + (vector+! + (new 'stack-no-clear 'vector) + (the-as vector (-> self root root-prim prim-core)) + (new 'static 'vector :y 2048.0 :w 1.0) + ) + 'nothing-special + self + ) + ) + (mech-method-24 self) + (suspend) + ) + ) + #f + ) + :post ja-post + ) + +(defstate pickup (mech) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('draw) + (ja-channel-set! 1) + (ja :group! mech-mech-idle-ja) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + (transform-post) + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('touch 'attack 'bonk) + #f + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as object (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ) + :enter (behavior ((arg0 (state mech))) + (let ((t9-0 (-> arg0 enter))) + (if t9-0 + (t9-0) + ) + ) + ) + :code (behavior ((arg0 (state mech))) + (ja-channel-set! 0) + (ja-post) + (while (zero? (ja-group-size)) + (if (or (not *target*) (or (< 24576.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + (go arg0) + ) + (mech-method-24 self) + (suspend) + ) + (while (and *target* (focus-test? *target* mech)) + (mech-method-24 self) + (suspend) + ) + (let ((s5-0 (current-time))) + (until (time-elapsed? s5-0 (seconds 1)) + (mech-method-24 self) + (suspend) + ) + ) + (go arg0) + ) + ) + +(defstate wait-for-return (mech) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as structure (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + (the-as structure #f) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-set! 0) + (ja-post) + (cleanup-for-death self) + ) + ) + +(defbehavior mech-init mech ((arg0 entity-actor) (arg1 matrix3) (arg2 handle) (arg3 float)) + (let ((s2-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s2-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s2-0 reaction) cshape-reaction-default) + (set! (-> s2-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s2-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle obstacle-for-jak)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> v1-6 transform-index) 0) + (set-vector! (-> v1-6 local-sphere) 0.0 6553.6 5324.8 6553.6) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-6) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-9 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> self root) s2-0) + ) + (set! (-> self rider) arg2) + (when arg0 + (process-entity-set! self arg0) + (process-drawable-from-entity! self arg0) + (set-yaw-angle-clear-roll-pitch! (-> self root) (res-lump-float arg0 'rotoffset)) + ) + (when arg1 + (set! (-> self root trans quad) (-> arg1 vector 0 quad)) + (quaternion-copy! (-> self root quat) (the-as quaternion (-> arg1 vector 1))) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self draw shadow-ctrl) *mech-shadow-control*) + (let ((v1-27 (-> self node-list data))) + (set! (-> v1-27 0 param0) (the-as (function cspace transformq none) cspace<-transformq+trans!)) + (set! (-> v1-27 0 param1) (the-as basic (-> self root trans))) + (set! (-> v1-27 0 param2) (the-as basic (-> self extra-trans))) + ) + (set! (-> self condition) (res-lump-value arg0 'index int :time -1000000000.0)) + (set! (-> self fact) + (new 'process 'fact-info self (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (set! (-> self shield-value) arg3) + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (if (-> self entity) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :group 1 :fo-max 30) (-> self root trans) 0.0) + ) + (set! (-> self draw light-index) (the-as uint 30)) + (if (handle->process arg2) + (go-virtual idle) + (go-virtual wait-for-start) + ) + ) + +(defmethod init-from-entity! ((this mech) (arg0 entity-actor)) + (mech-init arg0 (the-as matrix3 #f) (the-as handle #f) 100.0) + ) + +(deftype mech-target (process-drawable) + ((parent (pointer target) :override) + ) + (:state-methods + idle + active + ) + ) + + +(defskelgroup skel-mech-target mech mech-target-lod0-jg mech-target-idle-ja + ((mech-target-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4) + ) + +(defstate idle (mech-target) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('look-at-point) + (set-time! (-> self state-time)) + (go-virtual active) + ) + ) + ) + :trans (behavior () + (if (and (and *target* (and (>= 98304.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (focus-test? *target* mech) + ) + (go-virtual active) + ) + ) + :code (behavior () + (while (< 0.0 (-> self root scale x)) + (seek! (-> self root scale x) 0.0 (* 8.0 (seconds-per-frame))) + (set! (-> self root scale y) (-> self root scale x)) + (ja-post) + (suspend) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (ja-post) + (sleep-code) + ) + ) + +(defstate active (mech-target) + :virtual #t + :event (-> (method-of-type mech-target idle) event) + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (if (and (or (or (not *target*) (or (< 106496.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + (not (logtest? (focus-status mech) (-> *target* focus-status))) + ) + (time-elapsed? (-> self state-time) (seconds 10)) + ) + (go-virtual idle) + ) + ) + :code (behavior () + (sound-play "mech-target") + (let ((f30-0 0.0)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (while (< (-> self root scale x) 1.0) + (seek! (-> self root scale x) 1.0 (* 8.0 (seconds-per-frame))) + (set! (-> self root scale y) (-> self root scale x)) + (set! f30-0 (seek f30-0 1.0 (* 2.0 (seconds-per-frame)))) + (ja :num! (loop! f30-0)) + (ja-post) + (suspend) + ) + (until #f + (set! f30-0 (seek f30-0 1.0 (* 0.25 (seconds-per-frame)))) + (ja :num! (loop! f30-0)) + (ja-post) + (suspend) + ) + ) + #f + ) + ) + +(defbehavior mech-target-init mech ((arg0 vector) (arg1 quaternion) (arg2 entity-actor)) + (process-entity-set! self arg2) + (when (not (and (-> self level) (logtest? (level-flags lf16) (-> self level info level-flags)))) + (dotimes (v1-4 (-> *level* length)) + (let ((a0-7 (-> *level* level v1-4))) + (when (= (-> a0-7 status) 'active) + (when (logtest? (level-flags lf16) (-> a0-7 info level-flags)) + (set! (-> self level) a0-7) + (goto cfg-12) + ) + ) + ) + ) + ) + (label cfg-12) + (set! (-> self root) (the-as collide-shape-moving (new 'process 'trsqv))) + (set! (-> self root trans quad) (-> arg0 quad)) + (quaternion-copy! (-> self root quat) arg1) + (set! (-> self root scale x) 0.0) + (set! (-> self root scale y) 0.0) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-mech-target" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (go-virtual wait-for-start) + ) + +;; WARN: Return type mismatch (pointer process) vs (pointer mech-target). +(defun mech-target-spawn ((arg0 vector) (arg1 process) (arg2 quaternion) (arg3 entity-actor)) + (process-spawn mech-target :init mech-target-init arg0 arg2 arg3 :name "mech-target" :to arg1) + ) diff --git a/goal_src/jak3/engine/target/mech/target-mech.gc b/goal_src/jak3/engine/target/mech/target-mech.gc index 301c646aee..c3544618a6 100644 --- a/goal_src/jak3/engine/target/mech/target-mech.gc +++ b/goal_src/jak3/engine/target/mech/target-mech.gc @@ -7,3 +7,1811 @@ ;; DECOMP BEGINS +(deftype mech-shield (shield-sphere) + () + ) + + +(defbehavior mech-shield-init-by-other mech-shield ((arg0 shield-sphere-spawn-params)) + (set! (-> self level) (level-get *level* 'precura)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self sphere-size) (-> arg0 sphere-size)) + (set! (-> self owner) (-> arg0 owner)) + (set! (-> self track-joint) (-> arg0 track-joint)) + (set! (-> self offset-vec quad) (-> arg0 offset-vec quad)) + (init-collision! self) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-shield-sphere" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set-vector! (-> self root scale) (-> self sphere-size) (-> self sphere-size) (-> self sphere-size) 1.0) + (set! (-> self shield-type) (-> arg0 shield-type)) + (case (-> self shield-type) + (((shield-type shield-type-0)) + (set! (-> self heat-info damage-scalar) (/ 1.0 (the float (-> arg0 shield-strength)))) + (let ((s5-1 (new 'stack-no-clear 'shield-sphere-distort-spawn-params))) + (set! (-> s5-1 owner) (process->handle self)) + (set! (-> s5-1 sphere-size) (-> self sphere-size)) + (let ((s4-1 (the-as process #f))) + (let* ((s3-0 (get-process *default-dead-pool* shield-sphere-distort #x4000 1)) + (v1-22 (when s3-0 + (let ((t9-6 (method-of-type process activate))) + (t9-6 s3-0 self "process" (the-as pointer #x70004000)) + ) + (run-now-in-process s3-0 shield-sphere-distort-init-by-other s5-1) + (-> s3-0 ppointer) + ) + ) + ) + (if v1-22 + (set! s4-1 (-> v1-22 0)) + ) + ) + (set! (-> self heat-info distort-handle) (process->handle s4-1)) + ) + ) + ) + (((shield-type shield-type-1)) + (set! (-> self toggle-info enable-time) (-> arg0 enable-time)) + (set! (-> self heat-info last-heat-time) (-> arg0 disable-time)) + ) + ) + (ja-no-eval :group! (ja-group) :num! (loop!) :frame-num 0.0) + (ja-post) + (logior! (-> self draw status) (draw-control-status disable-fog)) + (let ((gp-1 (handle->process (-> arg0 owner)))) + (when (if (type? gp-1 process-focusable) + gp-1 + ) + ) + ) + (set! (-> self event-hook) (-> (method-of-type shield-sphere shield-enabled) event)) + (init-and-go! self) + ) + +(defstate shield-disabled (mech-shield) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (shield-event-handler self proc argc message block) + ) + :enter (behavior () + (toggle-shield self #f) + (set-time! (-> self state-time)) + ) + :trans (behavior () + (shield-enabled-trans self) + (if (and (= (-> self shield-type) (shield-type shield-type-1)) + (time-elapsed? (-> self state-time) (-> self heat-info last-heat-time)) + ) + (go-virtual shield-enabled) + ) + ) + :code sleep-code + :post (behavior () + (shield-post self) + ) + ) + +(defmethod init-collision! ((this mech-shield)) + (let ((s5-0 (new 'process 'collide-shape-moving this (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-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle impenetrable-obj)) + (set! (-> v1-6 prim-core action) (collide-action)) + (set-vector! (-> v1-6 local-sphere) 0.0 0.0 -4096.0 (+ 4096.0 (* 4096.0 (-> this sphere-size)))) + (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! (-> this root) s5-0) + ) + 0 + (none) + ) + +(defmethod draw ((this hud-heatmeter)) + (set-hud-piece-position! + (the-as hud-sprite (-> this sprites)) + 256 + (the int (+ 25.0 (* -100.0 (-> this offset)))) + ) + (set! (-> this sprites 0 pos z) #xfffff0) + (set-as-offset-from! + (-> this sprites 1) + (the-as vector4w (-> this sprites)) + (+ (the int (* 0.128 (the float (-> this values 0 current)))) -63) + 1 + ) + (set! (-> this sprites 1 pos z) #xfffff0) + ((method-of-type hud draw) this) + 0 + (none) + ) + +(defmethod update-values! ((this hud-heatmeter)) + (set! (-> this values 0 target) (the int (* 1000.0 (-> *game-info* distance)))) + (logclear! (-> this flags) (hud-flags disable)) + ((method-of-type hud update-values!) this) + 0 + (none) + ) + +(defmethod init-callback ((this hud-heatmeter)) + (set! (-> this gui-id) + (add-process *gui-control* this (gui-channel hud-upper-center-2) (gui-action hidden) (-> this name) 81920.0 0) + ) + (logior! (-> this flags) (hud-flags show)) + (set! (-> this sprites 0 tid) + (the-as texture-id (lookup-texture-by-id (new 'static 'texture-id :index #x2 :page #xa76))) + ) + (set! (-> this sprites 0 flags) (hud-sprite-flags hsf3)) + (set! (-> this sprites 0 scale-x) 1.2) + (set! (-> this sprites 0 scale-y) 1.2) + (set! (-> this sprites 1 tid) + (the-as texture-id (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xa76))) + ) + (set! (-> this sprites 1 flags) (hud-sprite-flags hsf3)) + (set! (-> this sprites 1 scale-x) 1.8) + (set! (-> this sprites 1 scale-y) 1.8) + 0 + (none) + ) + +(define *mech-stance-mods* + (new 'static 'surface + :name 'run + :turnv 18204262.0 + :turnvf 0.03 + :turnvv 40049.777 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :fric 0.3 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 4.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :slope-up-traction 1.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + (seek! (-> self control did-move-to-pole-or-max-jump-height) 0.0 (* 127431.11 (seconds-per-frame))) + (seek! + (-> self control did-move-to-pole-or-max-jump-height) + (* (-> self control turn-to-magnitude) (-> arg0 turnvv)) + (* 127431.11 (seconds-per-frame)) + ) + ) + (set! (-> arg0 turnvv) (-> self control did-move-to-pole-or-max-jump-height)) + (when (= (-> arg2 name) '*edge-surface*) + (set! (-> arg0 target-speed) 40960.0) + (set! (-> arg0 transv-max) 40960.0) + (set! (-> arg0 seek0) (* 1.6666 (-> arg2 seek0))) + (set! (-> arg0 seek90) (* 1.6666 (-> arg2 seek90))) + (set! (-> arg0 seek180) (* 1.6666 (-> arg2 seek180))) + ) + ) + ) + ) + :flags (surface-flag look-around no-turn-around) + ) + ) + +(define *mech-walk-mods* + (new 'static 'surface + :name 'run + :turnv 32768.0 + :turnvf 120.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :vel-turn -1.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.6666 + :seek90 1.6666 + :seek180 1.0 + :fric 0.1 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (when (= (-> arg2 name) '*edge-surface*) + (let ((v1-5 (vector-flatten! + (new 'stack-no-clear 'vector) + (vector-negate! (new-stack-vector0) (-> self control dynam gravity-normal)) + (-> self control local-normal) + ) + ) + ) + (set! (-> arg0 vel-turn) 0.0) + (vector+float*! (-> self control transv) (-> self control transv) v1-5 (* 409600.0 (seconds-per-frame))) + ) + ) + ) + ) + ) + :flags (surface-flag look-around no-turn-around) + ) + ) + +(define *mech-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 90.0 + :turnvv 18204.445 + :turnvvf 30.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag no-turn-around air) + ) + ) + +(define *mech-punch-mods* (new 'static 'surface + :name 'punch + :turnv 131072.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 91750.4 + :target-speed 122880.0 + :seek90 0.5 + :seek180 0.15 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flag no-turn-around turn-to-pad attack) + ) + ) + +(define *mech-pickup-mods* (new 'static 'surface + :name 'run + :turnv 16384.0 + :turnvf 240.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :vel-turn -1.0 + :transv-max 12288.0 + :target-speed 12288.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 0.5 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag look-around no-turn-around) + ) + ) + +(define *mech-carry-walk-mods* (new 'static 'surface + :name 'run + :turnv 25486.223 + :turnvf 96.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :vel-turn -1.0 + :transv-max 12288.0 + :target-speed 36864.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 0.5 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag look-around no-turn-around) + ) + ) + +(set! (-> *mech-carry-walk-mods* mult-hook) (-> *mech-walk-mods* mult-hook)) + +(define *mech-carry-drag-mods* (new 'static 'surface + :name 'run + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 12288.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag look-around no-turn-around) + ) + ) + +(define *mech-carry-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 90.0 + :turnvv 18204.445 + :turnvvf 30.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 36864.0 + :target-speed 36864.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air) + ) + ) + +(defbehavior target-mech-falling-anim-trans target () + 0 + (none) + ) + +(defbehavior target-mech-mech-effect mech ((arg0 target)) + (when (!= (-> arg0 mech thruster-flame-length) 0.0) + (let ((f30-0 0.0)) + (if (!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) + (set! f30-0 -2.0) + ) + (sound-play-by-name + (static-sound-name "mech-thrust") + (-> arg0 mech thrust-sound-id) + (the int (* 1024.0 (lerp-scale 0.3 1.0 (-> arg0 mech thruster-flame-length) 0.0 4096.0))) + (the int (* 1524.0 f30-0)) + 0 + (sound-group) + #t + ) + ) + (dotimes (s5-1 2) + (let* ((s3-1 (-> self node-list data (if (zero? s5-1) + 37 + 38 + ) + ) + ) + (s4-1 (vector<-cspace! (new 'stack-no-clear 'vector) s3-1)) + (a2-2 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-1 bone transform uvec))) + ) + (mech-spawn-thruster + (-> arg0 mech) + s4-1 + a2-2 + (-> arg0 mech thruster-flame-width) + (-> arg0 mech thruster-flame-length) + ) + ) + ) + ) + (when (logtest? (water-flag touch-water) (-> arg0 water flags)) + (let ((f30-1 (-> arg0 water height))) + (let ((s5-2 (-> *part-id-table* 1045))) + (let ((v1-28 (get-field-spec-by-id s5-2 (sp-field-id spt-userdata)))) + (if v1-28 + (set! (-> v1-28 initial-valuef) f30-1) + ) + ) + (let ((t9-6 sp-launch-particles-var) + (a0-12 *sp-particle-system-2d*) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> self root trans quad)) + (t9-6 a0-12 s5-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((s5-3 (-> *part-id-table* 1048))) + (let ((v1-34 (get-field-spec-by-id s5-3 (sp-field-id spt-userdata)))) + (if v1-34 + (set! (-> v1-34 initial-valuef) f30-1) + ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-15 *sp-particle-system-2d*) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> self root trans quad)) + (t9-8 a0-15 s5-3 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let* ((s5-4 (-> *part-id-table* 1051)) + (v1-40 (get-field-spec-by-id s5-4 (sp-field-id spt-userdata))) + (s4-2 (new 'stack-no-clear 'vector)) + ) + (if v1-40 + (set! (-> v1-40 initial-valuef) f30-1) + ) + (let ((s3-2 (get-field-spec-by-id s5-4 (sp-field-id spt-num)))) + (if s3-2 + (set! (-> s3-2 initial-valuef) (lerp-scale 0.1 2.0 (-> arg0 control ctrl-xz-vel) 0.0 40960.0)) + ) + ) + (process-drawable-random-point! self s4-2) + (let ((t9-13 sp-launch-particles-var) + (a0-21 *sp-particle-system-2d*) + (a2-6 *launch-matrix*) + ) + (set! (-> a2-6 trans quad) (-> s4-2 quad)) + (t9-13 a0-21 s5-4 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior mech-on-ground? target () + (logtest? (-> self control status) (collide-status on-surface)) + ) + +(defbehavior target-mech-get-off? target () + (when (and (mech-on-ground?) + (< (-> self mech no-get-off-time) (current-time)) + (-> *setting-control* user-current pilot-exit) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s4-0 (new 'stack-no-clear 'inline-array 'sphere 1)) + ) + (dotimes (s5-0 1) + ((method-of-type sphere new) (the-as symbol (-> s4-0 s5-0)) sphere) + ) + (let ((s5-1 (-> self node-list data 0 bone transform))) + (vector-matrix*! (-> s4-0 0) (new 'static 'vector :y 14336.0 :z 12288.0 :w 1.0) s5-1) + (set! (-> s4-0 0 r) 10240.0) + (let ((v1-11 gp-0)) + (set! (-> v1-11 best-dist) (the-as float s4-0)) + (set! (-> v1-11 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-11 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-11 ignore-process0) #f) + (set! (-> v1-11 ignore-process1) #f) + (set! (-> v1-11 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-11 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-11 action-mask) (collide-action solid)) + ) + (let ((s4-1 (fill-and-probe-using-spheres *collide-cache* gp-0))) + (when (not s4-1) + (vector-matrix*! (-> gp-0 start-pos) (new 'static 'vector :y 8192.0 :z 4096.0 :w 1.0) s5-1) + (set-vector! (-> gp-0 move-dist) 0.0 -40960.0 0.0 0.0) + (let ((v1-15 gp-0)) + (set! (-> v1-15 radius) 409.6) + (set! (-> v1-15 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-15 ignore-process0) self) + (set! (-> v1-15 ignore-process1) #f) + (set! (-> v1-15 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-15 action-mask) (collide-action solid)) + ) + (set! s4-1 (< (fill-and-probe-using-line-sphere *collide-cache* gp-0) 0.0)) + ) + (if (and s4-1 (-> *setting-control* user-current pilot)) + (talker-spawn-func (-> *talker-speech* 48) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (not s4-1) + ) + ) + ) + ) + ) + +(defbehavior target-mech-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object) (a0-19 symbol) (sv-96 target) (sv-112 process)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'mech + ) + (else + (case arg2 + (('end-mode) + (case (-> arg3 param 0) + (('mech) + enter-state + (process->handle arg0) + (go target-mech-get-off) + ) + ) + ) + (('change-mode) + (let ((v1-8 (-> arg3 param 0))) + (cond + ((= v1-8 'grab) + (when (not (focus-test? self dead)) + (if (not (-> arg3 param 1)) + #t + (go target-mech-grab) + ) + ) + ) + ((= v1-8 'normal) + enter-state + (process->handle arg0) + (go target-mech-get-off) + ) + ((begin (set! a0-19 'falling) (= v1-8 a0-19)) + (go target-mech-falling a0-19) + ) + ) + ) + ) + (('swim 'slide 'edge-grab) + #f + ) + (('clone-anim) + (go target-mech-clone-anim (process->handle (the-as process (-> arg3 param 0)))) + ) + (('touched) + (cond + ((logtest? (process-mask crate) (-> arg0 mask)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) 'attack) + (set! (-> a1-1 param 0) (-> arg3 param 0)) + (set! (-> a1-1 param 1) + (the-as + uint + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> self mech attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'mech) + (penetrate-using (-> self control penetrate-using)) + ) + ) + ) + ) + (set! v0-0 (send-event-function arg0 a1-1)) + ) + (when v0-0 + (let* ((v1-28 (-> self game)) + (a0-43 (+ (-> v1-28 attack-id) 1)) + ) + (set! (-> v1-28 attack-id) a0-43) + (set! (-> self mech attack-id) a0-43) + ) + ) + v0-0 + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (let ((s3-0 + (the-as object (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 168)) + ) + ) + (let ((s2-0 (the-as pointer s3-0)) + (s1-0 (method-of-type attack-info compute-intersect-info)) + (s0-0 (-> arg3 param 1)) + ) + (set! sv-96 self) + (set! sv-112 arg0) + (let ((a3-2 (if (type? sv-112 process-drawable) + sv-112 + ) + ) + (t0-0 (-> arg3 param 0)) + ) + (s1-0 (the-as attack-info s2-0) s0-0 sv-96 a3-2 (the-as touching-shapes-entry t0-0)) + ) + ) + (format 0 "info: ~A~%" (-> (the-as attack-info s3-0) mode)) + (let* ((v1-31 (-> (the-as attack-info s3-0) mode)) + (f30-0 (cond + ((= v1-31 'tar) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + (* 100.0 (seconds-per-frame)) + ) + ((= v1-31 'melt) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + (let ((s2-1 (if (logtest? (-> (the-as attack-info s3-0) mask) (attack-mask intersection)) + (-> (the-as attack-info s3-0) intersection) + (-> self control trans) + ) + ) + ) + (launch-particles (-> *part-id-table* 1053) s2-1) + (launch-particles (-> *part-id-table* 1055) s2-1) + ) + (* 100.0 (seconds-per-frame)) + ) + ((or (= v1-31 'burn) (= v1-31 'burnup)) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + (if (logtest? (-> (the-as attack-info s3-0) mask) (attack-mask intersection)) + (-> (the-as attack-info s3-0) intersection) + (-> self control trans) + ) + (launch-particles (-> *part-id-table* 1053) (-> self control trans)) + (launch-particles (-> *part-id-table* 1055) (-> self control trans)) + (* 20.0 (seconds-per-frame)) + ) + ((= v1-31 'shock) + (let ((s2-2 (if (logtest? (-> (the-as attack-info s3-0) mask) (attack-mask intersection)) + (-> (the-as attack-info s3-0) intersection) + (-> self control trans) + ) + ) + ) + (launch-particles (-> *part-id-table* 1057) s2-2) + (launch-particles (-> *part-id-table* 1058) s2-2) + ) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + 10.0 + ) + ((= v1-31 'explode) + (if (and (-> self next-state) (= (-> self next-state name) 'target-mech-shield)) + 0.0 + 4.0 + ) + ) + ((= v1-31 'grunt) + 1.0 + ) + ((= v1-31 'air) + 100.0 + ) + ((or (= v1-31 'endlessfall) (= v1-31 'crush) (= v1-31 'instant-death)) + 100.0 + ) + (else + (-> (the-as attack-info s3-0) damage) + ) + ) + ) + ) + (when (target-log-attack (the-as attack-info s3-0) 'background) + (case arg2 + (('attack 'attack-or-shove 'attack-invinc) + (if (not (or (logtest? (-> self target-flags) (target-flags tf2)) + (logtest? (game-secrets invulnerable) (-> self game secrets)) + ) + ) + (seek! (-> self mech shield-value) 0.0 f30-0) + ) + ) + ) + (if (and (= arg2 'attack-or-shove) (< 0.0 (-> self mech shield-value))) + (set! arg2 'shove) + ) + (if (= arg2 'attack-invinc) + (set! (-> self mech shield-value) 0.0) + ) + (if (or (= (-> self mech shield-value) 0.0) (= arg2 'shove)) + (target-attacked + arg2 + (the-as attack-info s3-0) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-mech-hit + ) + 'block + ) + ) + ) + ) + ) + (('shove) + (when (not (focus-test? self dead hit)) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 168) + (when (not (logtest? (-> self attack-info-rec mask) (attack-mask attacker))) + (set! (-> self attack-info-rec attacker) (process->handle arg0)) + (logior! (-> self attack-info-rec mask) (attack-mask attacker)) + ) + (go target-mech-hit 'shove (-> self attack-info-rec)) + ) + ) + (('effect-control) + (if (string= (the-as string (-> arg3 param 0)) "target-mech-walk") + (sound-play-by-name + (static-sound-name "mech-walk") + (new-sound-id) + 1024 + (the int (* 1524.0 (lerp-scale -0.2 0.0 (-> self control ctrl-xz-vel) 12288.0 40960.0))) + 0 + (sound-group) + #t + ) + ) + ) + (('target-mech-get-off) + (set! v0-0 (+ (current-time) (the-as time-frame (-> arg3 param 0)))) + (set! (-> self mech no-get-off-time) (the-as time-frame v0-0)) + v0-0 + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch symbol vs object. +(defbehavior target-mech-bonk-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (when (and (= arg2 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 6) + ) + (>= 409.6 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (begin + (vector-normalize! + (vector-! + s4-0 + (the-as vector (-> self control collision-spheres 0 prim-core)) + (-> self control actor-contact-pt) + ) + 1.0 + ) + (< 0.01 (-> s4-0 y)) + ) + ) + (if (< 0.75 (-> s4-0 y)) + (send-event + arg0 + 'bonk + (-> arg3 param 0) + (fmax + (-> self control ground-impact-vel) + (- (vector-dot (-> self control transv) (-> self control dynam gravity-normal))) + ) + ) + ) + (when (and (= (target-send-attack + arg0 + 'bonk + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (penetrate touch bonk mech-bonk) + ) + 'bounce + ) + (not (logtest? (-> self focus-status) (focus-status dead hit))) + ) + (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) + (target-timed-invulnerable (seconds 0.1) self 1) + (cond + ((focus-test? self carry) + enter-state + (let ((a0-19 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-8 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-19 a1-8) + ) + ) + (else + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + ) + ) + #f + ) + ) + ) + +;; WARN: Return type mismatch none vs object. +(defbehavior mech-leg-ik-callback target ((arg0 joint-mod-ik) (arg1 matrix) (arg2 matrix) (arg3 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> arg3 quad)) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.0) + ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) + ) + (+! (-> arg0 user-position y) f0-1) + ) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-12 s5-0)) + (let ((a0-4 *up-vector*)) + (let ((a1-4 8192.0)) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> a0-4 quad)) + ) + (.lvf vf4 (&-> v1-12 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 (&-> s3-0 quad) vf6) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) + (a0-7 s2-0) + ) + (let ((v1-15 *up-vector*)) + (let ((a1-7 f0-11)) + (.mov vf7 a1-7) + ) + (.lvf vf5 (&-> v1-15 quad)) + ) + (.lvf vf4 (&-> s3-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 (&-> a0-7 quad) vf6) + ) + (let ((a0-8 s2-0)) + (let ((v1-16 *up-vector*)) + (let ((a1-8 (- f28-0))) + (.mov vf7 a1-8) + ) + (.lvf vf5 (&-> v1-16 quad)) + ) + (.lvf vf4 (&-> arg3 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 (&-> a0-8 quad) vf6) + ) + (let ((a1-9 s5-0)) + (let ((v1-17 s5-0)) + (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) + (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) + (.mov vf7 a2-6) + ) + (.lvf vf5 (&-> a0-10 quad)) + ) + (.lvf vf4 (&-> v1-17 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 (&-> a1-9 quad) vf6) + ) + ) + ) + (set-ik-target! arg0 s5-0) + ) + ) + ) + +(defbehavior mech-update-ik target () + (local-vars (sv-720 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (the-as vector a1-0) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) mech-leg-ik-callback) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-5 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-5) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (let ((a1-6 s0-0)) + (let ((a0-8 (-> v1-13 trans))) + (let ((v1-14 (-> v1-13 uvec))) + (let ((a2-8 (-> s3-0 hand-dist))) + (.mov vf7 a2-8) + ) + (.lvf vf5 (&-> v1-14 quad)) + ) + (.lvf vf4 (&-> a0-8 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 (&-> a1-6 quad) vf6) + ) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) + ) + ) + (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) + ) + (let ((a1-9 (-> gp-0 start-pos))) + (let ((v1-18 s0-0)) + (let ((a0-11 sv-720)) + (let ((a2-12 6144.0)) + (.mov vf7 a2-12) + ) + (.lvf vf5 (&-> a0-11 quad)) + ) + (.lvf vf4 (&-> v1-18 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 (&-> a1-9 quad) vf6) + ) + (let ((v1-19 (-> gp-0 move-dist)) + (f0-16 -20480.0) + ) + (vector-float*! v1-19 sv-720 f0-16) + ) + (let ((v1-21 gp-0)) + (set! (-> v1-21 radius) 4.096) + (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-21 ignore-process0) #f) + (set! (-> v1-21 ignore-process1) #f) + (set! (-> v1-21 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-21 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (set! (-> s1-0 quad) (-> gp-0 best-other-tri normal quad)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-14 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-14 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-14) + ) + ) + (let ((a1-16 s2-0)) + (let ((v1-28 (-> gp-0 start-pos))) + (let ((a0-26 (-> gp-0 move-dist))) + (let ((a2-15 f30-0)) + (.mov vf7 a2-15) + ) + (.lvf vf5 (&-> a0-26 quad)) + ) + (.lvf vf4 (&-> v1-28 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 (&-> a1-16 quad) vf6) + ) + (set! (-> s3-0 user-position quad) (-> s2-0 quad)) + (set! (-> s3-0 user-normal quad) (-> s1-0 quad)) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (set! (-> s3-0 user-position quad) (-> s0-0 quad)) + (set! (-> s3-0 user-normal quad) (-> *y-vector* quad)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior target-mech-init target ((arg0 handle) (arg1 float) (arg2 symbol)) + (local-vars + (sv-160 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) + (sv-176 vector) + (sv-192 entity-actor) + ) + (target-gun-end-mode #f) + (target-exit) + (when (zero? (-> self mech)) + (set! (-> self mech) (new 'process 'mech-info)) + (set! (-> self mech hud 0) (the-as handle #f)) + (set! (-> self mech shield-handle) (the-as handle #f)) + (set! (-> self mech engine-sound-id) (new-sound-id)) + (set! (-> self mech thrust-sound-id) (new-sound-id)) + (set! (-> self mech drag-sound-id) (new-sound-id)) + (set! (-> self mech whine-sound-id) (new-sound-id)) + (set! (-> self mech shield-sound-id) (new-sound-id)) + (set! (-> self mech mode-sound-bank) #f) + ) + (set! (-> self board latch?) #f) + (set! (-> self mech stick-lock) #f) + (set! (-> self mech stick-off) #f) + (set-time! (-> self mech unstuck-time)) + (set! (-> self mech stuck-count) 0) + (set-time! (-> self mech mech-start-time)) + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + (set! (-> self mech state-impact? 0) #f) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + self + -1 + 0.0 + (collide-spec) + ) + (set! (-> self mech shield-max) 100.0) + (set! (-> self mech shield-value) arg1) + (set! (-> self mech entity) (entity-by-type mech)) + (let ((v1-31 (handle->process arg0))) + (if v1-31 + (set! (-> self mech entity) (-> v1-31 entity)) + ) + ) + (when (not (and (-> self mech entity) (logtest? (level-flags lf16) (-> self mech entity extra level info level-flags))) + ) + (dotimes (v1-39 (-> *level* length)) + (let ((a0-18 (-> *level* level v1-39))) + (when (= (-> a0-18 status) 'active) + (when (logtest? (level-flags lf16) (-> a0-18 info level-flags)) + (let ((a0-20 (-> a0-18 entity data 0 entity))) + (when a0-20 + (set! (-> self mech entity) (the-as entity-actor a0-20)) + (goto cfg-22) + ) + ) + ) + ) + ) + ) + ) + (label cfg-22) + (let ((v1-44 (-> self mech))) + (set! (-> v1-44 particle-system-2d) *sp-particle-system-2d*) + (set! (-> v1-44 particle-system-3d) *sp-particle-system-3d*) + (set! (-> v1-44 part-quat) *particle-quat*) + (set! (-> v1-44 part-vel) *particle-vel*) + (set! (-> v1-44 part-thruster) (-> *part-id-table* 1037)) + (set! (-> v1-44 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) + (set! (-> v1-44 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) + (set! (-> v1-44 thruster-flame-width) 0.0) + (set! (-> v1-44 thruster-flame-length) 0.0) + ) + (set! (-> self control reaction) target-collision-reaction) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control ctrl-xz-vel) 0.0) + (logior! (-> self focus-status) (focus-status mech)) + (set! (-> self control bend-target) 0.0) + (let ((v1-54 (-> self node-list data))) + (set! (-> v1-54 0 param0) (the-as (function cspace transformq none) cspace<-transformq+world-trans!)) + (set! (-> v1-54 0 param1) (the-as basic (-> self control trans))) + (set! (-> v1-54 0 param2) (the-as basic (-> self control cspace-offset))) + ) + (target-collide-set! 'mech 0.0) + (set! (-> self control pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nomech #x1)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (set! (-> self draw shadow) #f) + (let ((s4-1 (-> self entity)) + (s3-0 (-> self level)) + ) + (process-entity-set! self (-> self mech entity)) + (let ((s2-0 (get-process *8k-dead-pool* manipy #x20000 1))) + (set! (-> self manipy) + (the-as + (pointer manipy) + (when s2-0 + (let ((t9-13 (method-of-type manipy activate))) + (t9-13 (the-as manipy s2-0) self "manipy" (the-as pointer #x70004000)) + ) + (let ((s1-0 run-function-in-process) + (s0-0 s2-0) + ) + (set! sv-160 manipy-init) + (set! sv-176 (-> self control trans)) + (set! sv-192 (-> self entity)) + (let ((t0-1 (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f))) + (t1-0 #f) + (t2-0 0) + ) + ((the-as (function object object object object object object object none) s1-0) + s0-0 + sv-160 + sv-176 + sv-192 + t0-1 + t1-0 + t2-0 + ) + ) + ) + (-> s2-0 ppointer) + ) + ) + ) + ) + (set! (-> self entity) s4-1) + (set! (-> self level) s3-0) + ) + (when (-> self manipy) + (send-event + (ppointer->process (-> self manipy)) + 'trans-hook + (lambda :behavior target + () + (let ((v1-0 (ppointer->process (-> self parent)))) + (set! (-> self control trans quad) (-> (the-as target v1-0) mech mech-trans quad)) + (let ((a0-4 (-> (the-as target v1-0) mech mech-quat quad))) + (set! (-> self control quat quad) a0-4) + ) + (set! (-> self control scale quad) (-> (the-as target v1-0) mech mech-scale quad)) + (set! (-> self draw light-index) (-> (the-as target v1-0) draw light-index)) + (let ((a0-10 (-> (the-as target v1-0) draw color-mult quad))) + (set! (-> self draw color-mult quad) a0-10) + ) + (let ((a0-12 (-> (the-as target v1-0) draw color-emissive quad))) + (set! (-> self draw color-emissive quad) a0-12) + ) + (let ((v0-0 (-> (the-as target v1-0) draw shadow-ctrl settings shadow-dir quad))) + (set! (-> self draw shadow-ctrl settings shadow-dir quad) v0-0) + v0-0 + ) + ) + ) + ) + (send-event + (ppointer->process (-> self manipy)) + 'post-hook + (lambda :behavior target + () + (let ((gp-0 (ppointer->process (-> self parent)))) + ((method-of-type impact-control update-from-cspace) + (the-as impact-control (-> (the-as target gp-0) mech state-impact)) + ) + (when (-> (the-as target gp-0) mech state-impact? 0) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + ((method-of-type impact-control impact-control-method-11) + (the-as impact-control (-> (the-as target gp-0) mech state-impact)) + a1-0 + (the-as process gp-0) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + ) + ) + (mech-update-ik) + (target-mech-mech-effect (the-as target gp-0)) + ) + ) + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (send-event (ppointer->process (-> self manipy)) 'sync #t) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior target + () + (set! (-> self state-hook) #f) + (set! (-> self draw shadow-ctrl) *mech-shadow-control*) + (set! (-> self mech-ik 0) (new 'process 'joint-mod-ik self 27 5283.84)) + (set! (-> self mech-ik 1) (new 'process 'joint-mod-ik self 33 5283.84)) + (dotimes (v1-3 2) + (let ((a0-5 (-> self mech-ik v1-3))) + (set! (-> a0-5 elbow-pole-vector-axis) (the-as uint 2)) + (set! (-> a0-5 elbow-rotation-axis) (the-as uint 0)) + (set! (-> a0-5 callback) mech-leg-ik-callback) + (logior! (-> a0-5 flags) (joint-mod-ik-flags elbow-trans-neg)) + ) + ) + (dotimes (gp-0 2) + (enable-set! (-> self mech-ik gp-0) #t) + ) + #f + ) + ) + ) + (logior! (-> self target-flags) (target-flags tf6)) + (set-setting! 'string-max-length 'low (meters 7) 0) + (set-setting! 'string-min-length 'low (meters 4) 0) + (set-setting! 'string-max-height 'low (meters 3.5) 0) + (set-setting! 'string-min-height 'low (meters 1.5) 0) + (set-setting! 'fov 'abs (degrees 75.0) 0) + (set-setting! 'head-offset 'abs (meters 4.5) 0) + (set! (-> self mech mode-sound-bank) (the-as connection (add-setting! 'mode-sound-bank 'modemech 0.0 0))) + (set! (-> self mech hud 0) + (ppointer->handle (process-spawn hud-heatmeter :init hud-init-by-other :name "hud-heatmeter" :to self)) + ) + (let ((s4-3 (new 'stack-no-clear 'shield-sphere-spawn-params))) + (set! (-> s4-3 owner) (process->handle self)) + (set! (-> s4-3 sphere-size) 3.75) + (set! (-> s4-3 track-joint) 3) + (set! (-> s4-3 enable-time) (seconds 0.1)) + (set! (-> s4-3 disable-time) (seconds 0.1)) + (set! (-> s4-3 shield-strength) 8) + (set! (-> s4-3 shield-type) (shield-type shield-type-0)) + (if (new 'static 'vector :z -4096.0 :w 1.0) + (set! (-> s4-3 offset-vec quad) (-> (new 'static 'vector :z -4096.0 :w 1.0) quad)) + (vector-reset! (-> s4-3 offset-vec)) + ) + (let ((s3-1 (the-as process #f))) + (let* ((s2-1 (get-process *default-dead-pool* mech-shield #x4000 1)) + (v1-129 (when s2-1 + (let ((t9-32 (method-of-type process activate))) + (t9-32 s2-1 self "process" (the-as pointer #x70004000)) + ) + (run-now-in-process s2-1 mech-shield-init-by-other s4-3) + (-> s2-1 ppointer) + ) + ) + ) + (if v1-129 + (set! s3-1 (-> v1-129 0)) + ) + ) + (cond + (s3-1 + (set! (-> self mech shield-handle) (process->handle s3-1)) + (send-event (handle->process (-> self mech shield-handle)) 'disabled) + ) + (else + ) + ) + ) + ) + (remove-exit) + (if arg2 + (go target-mech-stance) + (go target-mech-get-on arg0) + ) + (none) + ) + +(defbehavior target-mech-exit target () + (when (not (and (-> self next-state) + (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-mech-stance) + (= v1-3 'target-mech-walk) + (= v1-3 'target-mech-jump) + (= v1-3 'target-mech-jump-jump) + (= v1-3 'target-mech-falling) + (= v1-3 'target-mech-hit-ground) + (= v1-3 'target-mech-punch) + (= v1-3 'target-mech-hit) + (= v1-3 'target-mech-death) + (= v1-3 'target-mech-carry-drag) + (= v1-3 'target-mech-carry-pickup) + (= v1-3 'target-mech-carry-drop) + (= v1-3 'target-mech-carry-stance) + (= v1-3 'target-mech-carry-walk) + (= v1-3 'target-mech-carry-jump) + (= v1-3 'target-mech-carry-falling) + (= v1-3 'target-mech-carry-hit-ground) + (= v1-3 'target-mech-carry-throw) + (= v1-3 'target-mech-get-off) + (= v1-3 'target-mech-get-off-jump) + (= v1-3 'target-mech-grab) + (= v1-3 'target-mech-clone-anim) + (= v1-3 'target-mech-shield) + ) + ) + ) + ) + (let ((v1-4 (-> self manipy))) + (when v1-4 + (deactivate (-> v1-4 0)) + (set! (-> self manipy) (the-as (pointer manipy) #f)) + ) + ) + (let ((a0-27 (handle->process (-> self mech shield-handle)))) + (if a0-27 + (deactivate a0-27) + ) + ) + ;; (setting-control-method-14 *setting-control* (-> self mech mode-sound-bank)) + (set! (-> self mech mode-sound-bank) #f) + (logclear! (-> self draw status) (draw-control-status no-draw-bounds)) + (logclear! (-> self focus-status) (focus-status mech)) + (logclear! (-> self control root-prim prim-core action) (collide-action stuck-wall-escape)) + (set! (-> self control mod-surface) *walk-mods*) + (logclear! (-> self target-flags) (target-flags tf6)) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-height) + (remove-setting! 'string-min-height) + (remove-setting! 'fov) + (remove-setting! 'head-offset) + (remove-setting! 'sound-flava) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (let ((v1-50 (-> self node-list data))) + (set! (-> v1-50 0 param0) (the-as (function cspace transformq none) cspace<-transformq+trans!)) + (set! (-> v1-50 0 param1) (the-as basic (-> self control trans))) + (set! (-> v1-50 0 param2) (the-as basic (-> self control cspace-offset))) + ) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (set! (-> self control pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :board #x1) + ) + (sound-stop (-> self mech engine-sound-id)) + (sound-stop (-> self mech thrust-sound-id)) + (sound-stop (-> self mech drag-sound-id)) + (sound-stop (-> self mech whine-sound-id)) + (send-event (handle->process (-> self mech hud 0)) 'hide-and-die) + (set! (-> self draw shadow) (-> self shadow-backup)) + (set! (-> self control cspace-offset quad) (the-as uint128 0)) + (remove-setting! 'sound-flava) + (target-exit) + ) + (none) + ) + +(defbehavior target-mech-effect target () + (sound-play "mech-pulse" :id (-> self mech engine-sound-id)) + (set! (-> self game distance) (/ (-> self mech shield-value) (-> self mech shield-max))) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defbehavior target-mech-add-thrust target () + (let ((s5-0 (-> self control target-transv)) + (gp-0 (-> self control transv-ctrl)) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (-> self control target-transv quad)) + (target-bend-vel-turn gp-0) + (target-add-slide-factor s5-0) + (let ((t9-2 vector-xz-normalize!) + (a0-5 (new-stack-vector0)) + ) + (set! (-> a0-5 quad) (-> s5-0 quad)) + (let ((s4-0 (t9-2 a0-5 1.0))) + (let ((t9-3 vector-xz-normalize!) + (a0-6 (new-stack-vector0)) + ) + (set! (-> a0-6 quad) (-> gp-0 quad)) + (let ((v1-7 (t9-3 a0-6 1.0))) + (set! (-> s4-0 y) 0.0) + (set! (-> v1-7 y) 0.0) + ) + ) + (let* ((f0-2 (-> s4-0 z)) + (v1-8 gp-0) + (f1-4 (sqrtf (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z))))) + (v1-10 s5-0) + (f0-11 + (cond + ((>= f1-4 (sqrtf (+ (* (-> v1-10 x) (-> v1-10 x)) (* (-> v1-10 z) (-> v1-10 z))))) + (let ((f0-3 (-> self control current-surface fric)) + (f1-5 1.0) + (v1-15 gp-0) + ) + (* f0-3 (fmax f1-5 (/ (sqrtf (+ (* (-> v1-15 x) (-> v1-15 x)) (* (-> v1-15 z) (-> v1-15 z)))) + (-> self control current-surface nonlin-fric-dist) + ) + ) + ) + ) + ) + ((>= f0-2 0.0) + (+ (* f0-2 (-> self control current-surface seek0)) (* (- 1.0 f0-2) (-> self control current-surface seek90))) + ) + (else + (+ (* (fabs f0-2) (-> self control current-surface seek180)) + (* (+ 1.0 f0-2) (-> self control current-surface seek90)) + ) + ) + ) + ) + (s4-1 vector-xz-normalize!) + (s3-0 gp-0) + (t9-4 seek) + (v1-30 gp-0) + ) + (s4-1 s3-0 (t9-4 + (sqrtf (+ (* (-> v1-30 x) (-> v1-30 x)) (* (-> v1-30 z) (-> v1-30 z)))) + (sqrtf (+ (* (-> s5-0 x) (-> s5-0 x)) (* (-> s5-0 z) (-> s5-0 z)))) + (* f0-11 (seconds-per-frame)) + ) + ) + ) + ) + ) + (set! (-> self control velocity-after-thrust) (vector-length gp-0)) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv-ctrl) (-> self control c-R-w)) + (vector-float*! gp-1 gp-1 0.5) + (vector+! gp-1 gp-1 (-> self control trans)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + gp-1 + (meters 0.2) + "ltransv" + (new 'static 'rgba :g #xff :a #x80) + ) + ) + (none) + ) + +(defbehavior target-mech-collision target () + (cond + ((and (-> self next-state) (= (-> self next-state name) 'target-mech-carry-drag)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 2) + (set! (-> a1-0 message) 'move) + (set! (-> a1-0 param 0) (the-as uint (-> self control transv))) + (set! (-> a1-0 param 1) (the-as uint s5-0)) + (let ((s3-0 (send-event-function (handle->process (-> self carry other)) a1-0)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-0 quad) (-> self control trans quad)) + (set! (-> (new 'stack-no-clear 'vector) quad) (-> self control transv quad)) + (let ((a2-1 (new 'stack-no-clear 'collide-query)) + (v1-18 (-> self control)) + ) + (set! (-> a2-1 collide-with) (-> v1-18 root-prim prim-core collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> v1-18 pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-18 (-> v1-18 transv) a2-1 (meters 1)) + ) + (vector-! gp-0 (-> self control trans) s4-0) + (let* ((s2-0 (-> self control dynam gravity-normal)) + (f30-0 (- (vector-dot s2-0 gp-0) (vector-dot s2-0 s5-0))) + (a1-4 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'carry-info) + (let* ((s1-0 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-4))) + (f0-2 (distance-from-destination (-> self carry) s1-0)) + ) + (cond + ((not s3-0) + ) + ((>= f0-2 0.0) + (let ((v1-38 (vector-float*! (new 'stack-no-clear 'vector) s2-0 f30-0))) + (vector+! (-> s1-0 hold-trans) (-> s1-0 hold-trans) v1-38) + ) + (let ((v1-39 (new-stack-vector0))) + (let ((f0-4 (vector-dot (-> self control dynam gravity-normal) s5-0))) + 0.0 + (vector-! v1-39 s5-0 (vector-float*! v1-39 (-> self control dynam gravity-normal) f0-4)) + ) + (let ((f0-5 (vector-length v1-39))) + f0-5 + (let ((f0-6 f0-5) + (v1-42 (new-stack-vector0)) + ) + (let ((f1-6 (vector-dot (-> self control dynam gravity-normal) gp-0))) + 0.0 + (vector-! v1-42 gp-0 (vector-float*! v1-42 (-> self control dynam gravity-normal) f1-6)) + ) + (let ((f1-7 (vector-length v1-42))) + f1-7 + (when (< f0-6 f1-7) + (let ((v1-46 (new-stack-vector0)) + (f0-8 (vector-dot (-> self control dynam gravity-normal) gp-0)) + ) + 0.0 + (vector-! v1-46 gp-0 (vector-float*! v1-46 (-> self control dynam gravity-normal) f0-8)) + (let ((f1-11 (vector-length v1-46)) + (a0-43 (new-stack-vector0)) + ) + (let ((f2-3 (vector-dot (-> self control dynam gravity-normal) s5-0))) + 0.0 + (vector-! a0-43 s5-0 (vector-float*! a0-43 (-> self control dynam gravity-normal) f2-3)) + ) + (let ((f2-4 (vector-length a0-43))) + f2-4 + (let ((f2-5 f2-4)) + (vector+! + gp-0 + (vector-float*! gp-0 (-> self control dynam gravity-normal) f0-8) + (vector-float*! v1-46 v1-46 (/ f2-5 f1-11)) + ) + ) + ) + ) + ) + (let ((a1-25 (vector+! (new 'stack-no-clear 'vector) s4-0 gp-0))) + (move-to-point! (-> self control) a1-25) + ) + ) + ) + ) + ) + ) + ) + (else + (send-event self 'drop (seconds 0.5)) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (let ((a2-17 (new 'stack-no-clear 'collide-query)) + (v1-54 (-> self control)) + ) + (set! (-> a2-17 collide-with) (-> v1-54 root-prim prim-core collide-with)) + (set! (-> a2-17 ignore-process0) self) + (set! (-> a2-17 ignore-process1) #f) + (set! (-> a2-17 ignore-pat) (-> v1-54 pat-ignore-mask)) + (set! (-> a2-17 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-54 (-> v1-54 transv) a2-17 (meters 1)) + ) + ) + ) + (when (logtest? (-> self control status) (collide-status touch-wall)) + (let ((v1-61 (vector-! (new 'stack-no-clear 'vector) (-> self control wall-contact-pt) (-> self control trans)))) + (set! (-> v1-61 y) 0.0) + (when (< (vector-dot v1-61 (-> self control c-R-w fvec)) 0.0) + (set-time! (-> self mech back-touch-time)) + (set! (-> self mech back-touch-point quad) (-> self control wall-contact-pt quad)) + (set! (-> self mech back-touch-trans quad) (-> self control trans quad)) + ) + ) + ) + 0 + (none) + ) + +(defbehavior target-mech-real-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self control remaining-ctrl-iterations) gp-1) + (flag-setup) + (if (< (-> self control force-turn-to-strength) 0.0) + (set! (-> self control force-turn-to-strength) (- 1.0 (-> self control cpad stick0-speed))) + ) + (build-conversions (-> self control transv)) + (do-rotations1) + (let ((s5-0 (new-stack-vector0))) + (read-pad s5-0) + (let ((f28-0 (-> self control pad-magnitude))) + (if (or (and (< 0.0 f28-0) + (< 0.3 (-> self control pad-magnitude)) + (< (vector-dot (-> self control pad-xz-dir) (-> self control last-pad-xz-dir)) 0.2) + (< f28-0 0.7) + ) + (-> self mech stick-off) + ) + (set! f28-0 0.0) + ) + (when (!= (-> self control force-turn-to-strength) 0.0) + (let ((f0-15 (fmin 1.0 (-> self control force-turn-to-strength)))) + (set! (-> self control force-turn-to-strength) f0-15) + (let ((a1-2 (vector-float*! + (new 'stack-no-clear 'vector) + (if (= f28-0 0.0) + *zero-vector* + s5-0 + ) + f28-0 + ) + ) + (a2-1 (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control force-turn-to-direction) + (-> self control force-turn-to-speed) + ) + ) + ) + (vector-lerp! s5-0 a1-2 a2-1 f0-15) + ) + ) + (set! f28-0 (vector-length s5-0)) + (vector-normalize! s5-0 1.0) + ) + (turn-to-vector s5-0 f28-0) + ) + ) + (cond + ((and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (add-thrust) + ) + (else + (let* ((v1-51 (-> self control target-transv)) + (f0-20 (sqrtf (+ (* (-> v1-51 x) (-> v1-51 x)) (* (-> v1-51 z) (-> v1-51 z))))) + ) + (set-vector! (-> self control target-transv) 0.0 0.0 f0-20 1.0) + ) + (target-mech-add-thrust) + ) + ) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (pre-collide-setup) + (target-mech-collision) + (bend-gravity) + (post-flag-setup) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (ja-post) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (vector+! (-> self mech mech-trans) (-> self control trans) (-> self control cspace-offset)) + (quaternion-copy! (the-as quaternion (-> self mech mech-quat)) (-> self control quat)) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (vector+! (-> self alt-cam-pos) (-> self control camera-pos) (new 'static 'vector :y 4096.0 :w 1.0)) + (set-time! (-> self mech mech-time)) + (target-mech-effect) + 0 + (none) + ) + +(defbehavior target-mech-post target () + (target-mech-real-post) + (none) + ) diff --git a/goal_src/jak3/engine/target/sidekick.gc b/goal_src/jak3/engine/target/sidekick.gc index 7383b39b70..80cc823a32 100644 --- a/goal_src/jak3/engine/target/sidekick.gc +++ b/goal_src/jak3/engine/target/sidekick.gc @@ -545,9 +545,9 @@ ;; (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) ;; (merc-blend-shape self) ;; ) - ;; (if (logtest? (-> self skel status) (joint-control-status eye-anim-valid eye-anim)) - ;; (merc-eye-anim self) - ;; ) + (if (logtest? (-> self skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim self) + ) (when (!= (not (-> *setting-control* user-current mirror)) (not (-> self mirror))) (cond ((-> self mirror) diff --git a/goal_src/jak3/engine/target/target-h.gc b/goal_src/jak3/engine/target/target-h.gc index 18a46d65ee..0a8c30727d 100644 --- a/goal_src/jak3/engine/target/target-h.gc +++ b/goal_src/jak3/engine/target/target-h.gc @@ -170,6 +170,25 @@ ;; target-ladder (define-extern *ladder-mods* surface) +;; target-tube +(define-extern *tube-mods* surface) +(define-extern *tube-jump-mods* surface) +(define-extern *tube-hit-mods* surface) +(define-extern *tube-surface* surface) + +;; target-flut +(define-extern *flut-walk-mods* surface) +(define-extern *flut-run-racer-mods* surface) +(define-extern *flut-run-wild-mods* surface) +(define-extern *flut-jump-wild-mods* surface) +(define-extern *flut-jump-mods* surface) +(define-extern *flut-jump-racer-mods* surface) +(define-extern *flut-double-jump-mods* surface) +(define-extern *flut-double-jump-racer-mods* surface) +(define-extern *flut-run-attack-mods* surface) +(define-extern *flut-air-attack-mods* surface) +(define-extern *flut-get-off-mods* surface) + ;; +++lightjak-stage (defenum lightjak-stage :bitfield #t @@ -237,7 +256,8 @@ (leg-ik joint-mod-ik 2) (foot joint-mod 2) (cloth symbol) - (init-time time-frame) + (mech-ik joint-mod-ik 2) + (init-time time-frame :overlay-at (-> mech-ik 0)) (teleport-time time-frame) (state-hook-time time-frame) (state-hook (function none :behavior target)) @@ -272,9 +292,9 @@ (mode-param1 handle) (mode-param2 uint64) (mode-param3 uint64) - (major-mode-exit-hook basic) - (major-mode-event-hook basic) - (sub-mode-exit-hook basic) + (major-mode-exit-hook (function none :behavior target)) + (major-mode-event-hook (function none :behavior target)) + (sub-mode-exit-hook (function none :behavior target)) (ext-geo-control external-art-buffer) (pending-ext-geo target-geo) (ext-geo target-geo) @@ -370,25 +390,26 @@ target-edge-grab (target-edge-grab-jump float float symbol) target-edge-grab-off - (target-falling symbol) + (target-falling object) target-float (target-flop float float float object) (target-flop-hit-ground symbol) - target-flut-air-attack + (target-flut-air-attack float) target-flut-air-attack-hit-ground - target-flut-clone-anim - target-flut-death - target-flut-double-jump - target-flut-eject - target-flut-falling - target-flut-get-off + (target-flut-clone-anim handle) + (target-flut-death symbol) + (target-flut-double-jump float float) + (target-flut-eject symbol) + (target-flut-falling object) + (target-flut-get-off handle) target-flut-get-off-jump - target-flut-get-on + (target-flut-get-on handle) target-flut-grab - target-flut-hit + (target-flut-hit symbol attack-info) target-flut-hit-ground - target-flut-jump - target-flut-kanga-catch + (target-flut-jump float float) + (target-flut-kanga-catch handle symbol) + target-flut-run-wild target-flut-running-attack target-flut-stance (target-flut-start handle symbol int) @@ -446,22 +467,22 @@ target-mech-carry-drag target-mech-carry-drop target-mech-carry-falling - target-mech-carry-hit-ground - target-mech-carry-jump + (target-mech-carry-hit-ground symbol) + (target-mech-carry-jump float float) target-mech-carry-pickup target-mech-carry-stance target-mech-carry-throw target-mech-carry-walk - target-mech-clone-anim - target-mech-death - target-mech-falling + (target-mech-clone-anim handle) + (target-mech-death symbol) + (target-mech-falling symbol) target-mech-get-off - target-mech-get-on - target-mech-get-up + (target-mech-get-on handle) + (target-mech-get-up handle) target-mech-grab - target-mech-hit - target-mech-hit-ground - target-mech-jump + (target-mech-hit symbol attack-info) + (target-mech-hit-ground symbol) + (target-mech-jump float float surface) target-mech-punch target-mech-shield target-mech-stance @@ -504,7 +525,11 @@ target-swim-walk target-title target-tube + (target-tube-death symbol) + (target-tube-hit symbol attack-info) + (target-tube-jump float float) (target-tube-start handle) + target-tube-walk target-turn-around target-turret-get-off (target-turret-get-on handle) diff --git a/goal_src/jak3/engine/target/target-launch.gc b/goal_src/jak3/engine/target/target-launch.gc index 643c9a8097..0b42792e3a 100644 --- a/goal_src/jak3/engine/target/target-launch.gc +++ b/goal_src/jak3/engine/target/target-launch.gc @@ -81,7 +81,7 @@ (a0-19 (-> self control)) ) (set! (-> a0-19 status) v1-53) - (go target-falling (the-as symbol a0-19)) + (go target-falling a0-19) ) ) ) diff --git a/goal_src/jak3/engine/target/target-tube.gc b/goal_src/jak3/engine/target/target-tube.gc index 4a9e82aef2..25a81d8051 100644 --- a/goal_src/jak3/engine/target/target-tube.gc +++ b/goal_src/jak3/engine/target/target-tube.gc @@ -7,3 +7,1174 @@ ;; DECOMP BEGINS +(define *tube-mods* (new 'static 'surface + :name 'tube + :turnv 21845.334 + :turnvv 524288.0 + :tiltv 5461.3335 + :tiltvv 131072.0 + :transv-max 1.0 + :target-speed 32768.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) + ) + +(define *tube-jump-mods* (new 'static 'surface + :name 'tube + :turnv 21845.334 + :turnvv 262144.0 + :tiltv 5461.3335 + :tiltvv 131072.0 + :transv-max 1.0 + :seek0 0.8 + :seek90 0.7 + :seek180 0.8 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air) + ) + ) + +(define *tube-hit-mods* (new 'static 'surface + :name 'tube + :turnv 21845.334 + :turnvv 262144.0 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 1.0 + :target-speed 40960.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + ) + ) + +(let ((v1-3 (new 'static 'surface + :name '*tube-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 94208.0 + :target-speed 1.0 + :seek0 32768.0 + :seek90 94208.0 + :seek180 8192.0 + :fric 0.98 + :nonlin-fric-dist 4091904.0 + :slip-factor 0.7 + :slope-down-factor 81920.0 + :slope-slip-angle 16384.0 + :bend-speed 4.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around turn-to-vel) + ) + ) + ) + (set! *tube-surface* v1-3) + (set! (-> v1-3 mult-hook) (the-as (function surface surface surface int none) nothing)) + (set! (-> v1-3 touch-hook) nothing) + (set! (-> v1-3 active-hook) nothing) + ) + +(deftype tube-info (basic) + ((entity entity) + (tube handle) + (downhill vector :inline) + (centertube vector :inline) + (downtube vector :inline) + (sidetube vector :inline) + (foretube vector :inline) + (old-transv vector :inline) + (mod-x float) + (mod-y float) + (start-time time-frame) + (turn-anim-targ float) + (turn-anim-frame float) + (turn-anim-vel float) + (tube-sound-id sound-id) + (tube-sound-vol float) + (tube-sound-pitch float) + ) + ) + + +(deftype tube-bank (basic) + () + ) + + +(define *TUBE-bank* (new 'static 'tube-bank)) + +(defbehavior tube-sounds target () + (seek! + (-> self tube tube-sound-vol) + (if (logtest? (-> self control status) (collide-status on-surface)) + 1.0 + 0.0 + ) + (* 2.0 (seconds-per-frame)) + ) + (seek! + (-> self tube tube-sound-pitch) + (lerp-scale -0.15 0.15 (-> self control ctrl-xz-vel) 0.0 122880.0) + (* 0.5 (seconds-per-frame)) + ) + (let ((f1-2 (-> self tube tube-sound-vol)) + (f0-9 (-> self tube tube-sound-pitch)) + ) + (sound-play-by-name + (static-sound-name "slide-loop") + (-> self tube tube-sound-id) + (the int (* 1024.0 f1-2)) + (the int (* 1524.0 f0-9)) + 0 + (sound-group) + (-> self control trans) + ) + ) + ) + +(defbehavior tube-thrust target ((arg0 float) (arg1 float)) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> self tube foretube) (-> self control trans)))) + (vector-flatten! s4-1 s4-1 (-> self tube downtube)) + (vector-flatten! s4-1 s4-1 (-> self control local-normal)) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + s4-1 + (meters 0.00024414062) + (new 'static 'rgba :g #xff :a #x80) + ) + (vector-matrix*! s4-1 s4-1 (-> self control w-R-c)) + (vector-float*! s4-1 s4-1 2.0) + (if (< (-> self control current-surface target-speed) (vector-length s4-1)) + (vector-normalize! s4-1 (-> self control current-surface target-speed)) + ) + (vector-v++! (-> self control transv-ctrl) s4-1) + (when (logtest? (-> self control status) (collide-status touch-wall)) + (let ((s3-0 (-> self tube old-transv))) + (-> self control transv-ctrl y) + (vector-reflect! s4-1 s3-0 (-> self control wall-contact-poly-normal)) + (let ((f0-5 (vector-dot (-> self tube sidetube) (-> self tube old-transv))) + (v1-28 (new-stack-vector0)) + (f1-2 (vector-dot (-> self tube sidetube) s4-1)) + ) + 0.0 + (vector-! v1-28 s4-1 (vector-float*! v1-28 (-> self tube sidetube) f1-2)) + (let* ((f2-2 (vector-length v1-28)) + (f3-0 f2-2) + ) + (cond + ((< 0.0 f0-5) + (if (< f1-2 (- f0-5)) + (set! f1-2 (- f0-5)) + ) + ) + ((< f0-5 0.0) + (if (< (- f0-5) f1-2) + (set! f1-2 (- f0-5)) + ) + ) + ) + (vector+! s4-1 (vector-float*! s4-1 (-> self tube sidetube) f1-2) (vector-float*! v1-28 v1-28 (/ f2-2 f3-0))) + ) + ) + (vector-flatten! s4-1 s4-1 (-> self control local-normal)) + (let ((v1-30 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self tube downtube) s4-1))) + 0.0 + (vector-! v1-30 s4-1 (vector-float*! v1-30 (-> self tube downtube) f0-8)) + ) + (let* ((f0-9 (vector-length v1-30)) + (f1-4 f0-9) + (f2-4 (fmax (-> self control ctrl-xz-vel) (vector-dot s3-0 (-> self tube downtube)))) + ) + (vector+! s4-1 (vector-float*! s4-1 (-> self tube downtube) f2-4) (vector-float*! v1-30 v1-30 (/ f0-9 f1-4))) + ) + ) + ) + (vector-matrix*! s4-1 s4-1 (-> self control w-R-c)) + (let ((f0-11 (-> self control transv-ctrl y))) + (set! (-> self control transv-ctrl quad) (-> s4-1 quad)) + (set! (-> self control transv-ctrl y) f0-11) + ) + ) + ) + (let ((s4-2 (new 'stack-no-clear 'vector))) + (set! (-> s4-2 quad) (-> self tube downtube quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> self tube sidetube quad)) + (vector-flatten! s3-1 s3-1 (-> self control local-normal)) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + s3-1 + (meters 2) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (vector-matrix*! s3-1 s3-1 (-> self control w-R-c)) + (vector-normalize! s3-1 (* arg0 (-> self control current-surface seek90))) + (vector-v++! (-> self control transv-ctrl) s3-1) + ) + (vector-flatten! s4-2 s4-2 (-> self control local-normal)) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + s4-2 + (meters 2) + (new 'static 'rgba :r #xff :g #x80 :b #x40 :a #x80) + ) + (vector-matrix*! s4-2 s4-2 (-> self control w-R-c)) + (vector-normalize! + s4-2 + (* (-> self control current-surface slope-down-factor) (fmax 0.2 (-> self control surface-angle))) + ) + (vector-v++! (-> self control transv-ctrl) s4-2) + ) + (let* ((f1-8 (-> self control current-surface fric)) + (f0-17 (- 1.0 (* 60.0 (seconds-per-frame) (- 1.0 f1-8)))) + (f0-19 (* 0.5 (+ 1.0 f0-17))) + ) + (set! (-> self control transv-ctrl x) (* (-> self control transv-ctrl x) f0-19)) + (set! (-> self control transv-ctrl z) (* (-> self control transv-ctrl z) f0-19)) + ) + (let ((f0-22 + (- (-> self control current-surface transv-max) (if (< arg1 0.0) + (* arg1 (-> self control current-surface seek0)) + (* arg1 (-> self control current-surface seek180)) + ) + ) + ) + (v1-78 (-> self control transv-ctrl)) + ) + (if (>= (sqrtf (+ (* (-> v1-78 x) (-> v1-78 x)) (* (-> v1-78 z) (-> v1-78 z)))) f0-22) + (vector-xz-normalize! (-> self control transv-ctrl) f0-22) + ) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv-ctrl) (-> self control c-R-w)) + (vector-float*! gp-1 gp-1 0.5) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + gp-1 + (meters 0.00024414062) + (new 'static 'rgba :g #xff :b #xff :a #x80) + ) + (vector+! gp-1 gp-1 (-> self control trans)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + gp-1 + (meters 0.2) + "ltransv" + (new 'static 'rgba :g #xff :b #xff :a #x80) + ) + (vector-matrix*! gp-1 (new 'static 'vector :z 40960.0 :w 1.0) (-> self control c-R-w)) + (vector-float*! gp-1 gp-1 0.5) + (vector+! gp-1 gp-1 (-> self control trans)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + gp-1 + (meters 0.2) + "nose" + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + ) + (tube-sounds) + 0 + (none) + ) + +(defbehavior target-tube-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self tube old-transv quad) (-> self control transv quad)) + (flag-setup) + (build-conversions (-> self control transv)) + (if (logtest? (-> self target-flags) (target-flags tinvuln1)) + (set! (-> self control current-surface turnv) (* 3.0 (-> self control current-surface turnv))) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) + (-> self control local-normal) + ) + (do-rotations1) + (send-event + (handle->process (-> self tube tube)) + 'update + (-> self tube centertube) + (-> self tube downtube) + (-> self tube sidetube) + (-> self tube foretube) + ) + (vector-flatten! + (-> self tube downhill) + (vector-negate! (new-stack-vector0) (-> self control dynam gravity-normal)) + (-> self control local-normal) + ) + (vector-normalize! (-> self tube downhill) 1.0) + (set! (-> self control turn-to-magnitude) 1.0) + (let ((f28-0 (analog-input (the-as int (-> self control cpad leftx)) 128.0 32.0 110.0 1.0))) + (set! (-> self tube mod-x) f28-0) + (let ((f0-8 (analog-input (the-as int (-> self control cpad lefty)) 128.0 32.0 110.0 1.0))) + (set! (-> self tube mod-y) f0-8) + (tube-thrust f28-0 f0-8) + ) + ) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (set! (-> self control reaction) target-collision-reaction) + (let ((a2-5 (new 'stack-no-clear 'collide-query))) + (let ((v1-52 (-> self control))) + (set! (-> a2-5 collide-with) (-> v1-52 root-prim prim-core collide-with)) + (set! (-> a2-5 ignore-process0) self) + (set! (-> a2-5 ignore-process1) #f) + (set! (-> a2-5 ignore-pat) (-> v1-52 pat-ignore-mask)) + ) + (set! (-> a2-5 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-5 (meters 1)) + ) + (bend-gravity) + (post-flag-setup) + (set! (-> self control surf) *tube-surface*) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (ja-post) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (none) + ) + +(defstate target-tube (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + 'tube + ) + (else + (let ((v1-3 message)) + (cond + ((= v1-3 'change-mode) + (case (-> block param 0) + (('grab) + (when (not (focus-test? self dead)) + (if (-> block param 1) + (logior! (-> self focus-status) (focus-status grabbed)) + ) + #t + ) + ) + ) + ) + ((= v1-3 'end-mode) + (case (-> block param 0) + (('grab) + (when (focus-test? self grabbed) + (logclear! (-> self focus-status) (focus-status grabbed)) + #t + ) + ) + (('tube) + (cond + ((focus-test? self indax) + enter-state + (-> *TARGET-bank* tube-jump-height-min) + (-> *TARGET-bank* tube-jump-height-max) + (go target-indax-jump) + ) + (else + (go + target-jump + (-> *TARGET-bank* tube-jump-height-min) + (-> *TARGET-bank* tube-jump-height-max) + (the-as surface #f) + ) + ) + ) + ) + ) + ) + ((= v1-3 'touched) + (send-event proc 'attack (-> block param 0) 'tube 0 0) + #f + ) + ((or (= v1-3 'attack) (= v1-3 'attack-or-shove) (= v1-3 'attack-invinc)) + (target-attacked + 'attack-or-shove + (the-as attack-info (-> block param 1)) + proc + (the-as touching-shapes-entry (-> block param 0)) + target-tube-hit + ) + ) + ((-> self major-mode-event-hook) + ((-> self major-mode-event-hook)) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + ) + ) + ) + :exit (behavior () + (when (not (and (-> self next-state) + (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-tube-walk) (= v1-3 'target-tube-jump) (= v1-3 'target-tube-hit)) + ) + ) + ) + (logclear! (-> self focus-status) (focus-status tube)) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (remove-setting! 'slave-options) + (sound-stop (-> self tube tube-sound-id)) + (set! (-> self tube tube-sound-id) (new 'static 'sound-id)) + (send-event (handle->process (-> self tube tube)) 'end-mode) + (when (focus-test? self indax) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-height) + (remove-setting! 'string-max-height) + (remove-setting! 'fov) + ) + (target-exit) + (let ((t9-10 (-> self sub-mode-exit-hook))) + (if t9-10 + (t9-10) + ) + ) + ) + (let ((t9-11 (-> self major-mode-exit-hook))) + (if t9-11 + (t9-11) + ) + ) + ) + :code nothing + :post (behavior () + (target-tube-post) + ) + ) + +(defstate target-tube-start (target) + :parent target-tube + :code (behavior ((arg0 handle)) + (set-setting! 'slave-options 'set 0.0 (cam-slave-options BIKE_MODE)) + (target-exit) + (set! (-> self control surf) *tube-surface*) + (if (zero? (-> self tube)) + (set! (-> self tube) (new 'process 'tube-info)) + ) + (set! (-> self tube tube) arg0) + (set! (-> self tube entity) #f) + (let ((a0-4 (handle->process arg0))) + (if a0-4 + (set! (-> self tube entity) (-> a0-4 entity)) + ) + ) + (set-time! (-> self tube start-time)) + (set! (-> self tube tube-sound-id) (new-sound-id)) + (set! (-> self tube tube-sound-vol) 0.0) + (set! (-> self tube tube-sound-pitch) 0.0) + (target-collide-set! 'tube 0.0) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control ctrl-xz-vel) 0.0) + (logior! (-> self focus-status) (focus-status tube)) + (when (focus-test? self indax) + (set-setting! 'string-min-length 'abs (meters 4) 0) + (set-setting! 'string-max-length 'abs (meters 4) 0) + (set-setting! 'string-min-height 'abs (meters 6) 0) + (set-setting! 'string-max-height 'abs (meters 6) 0) + (set-setting! 'fov 'abs (degrees 95.0) 0) + ) + (remove-exit) + (cond + ((< (the-as + float + (send-event + (handle->process (-> self tube tube)) + 'update + (-> self tube centertube) + (-> self tube downtube) + (-> self tube sidetube) + (-> self tube foretube) + ) + ) + 0.5 + ) + (vector-normalize-copy! (-> self control transv) (-> self tube downtube) 40960.0) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self control transv) 1.0) + (-> self control dynam gravity-normal) + ) + (go target-tube-jump (-> *TARGET-bank* tube-jump-height-min) (-> *TARGET-bank* tube-jump-height-max)) + ) + (else + (go target-tube-walk) + ) + ) + ) + :post target-post + ) + +(defbehavior target-tube-turn-anim target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self tube turn-anim-targ) (fmax -20.0 (fmin 20.0 (-> self tube turn-anim-targ)))) + (or (not (>= (* (-> self tube turn-anim-targ) (-> self tube turn-anim-frame)) 0.0)) + (< (fabs (-> self tube turn-anim-frame)) (fabs (-> self tube turn-anim-targ))) + ) + (+! (-> self tube turn-anim-vel) + (* (- (-> self tube turn-anim-targ) (-> self tube turn-anim-frame)) + (lerp-scale + 20.0 + (if (< (fabs (-> self tube turn-anim-frame)) (fabs (-> self tube turn-anim-targ))) + 30.0 + 60.0 + ) + (-> self control ctrl-xz-vel) + 0.0 + 36864.0 + ) + (seconds-per-frame) + ) + ) + (set! (-> self tube turn-anim-vel) + (fmax + -100.0 + (fmin 100.0 (* (-> self tube turn-anim-vel) (lerp-scale 0.96 0.9 (-> self control ctrl-xz-vel) 0.0 36864.0))) + ) + ) + (+! (-> self tube turn-anim-frame) (* (-> self tube turn-anim-vel) (seconds-per-frame))) + (set! (-> self tube turn-anim-frame) (fmax -20.0 (fmin 20.0 (-> self tube turn-anim-frame)))) + (cond + ((and (>= (-> self tube turn-anim-frame) 20.0) (>= (-> self tube turn-anim-vel) 0.0)) + (set! (-> self tube turn-anim-vel) 0.0) + ) + ((and (>= -20.0 (-> self tube turn-anim-frame)) (>= 0.0 (-> self tube turn-anim-vel))) + (set! (-> self tube turn-anim-vel) 0.0) + ) + ) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (let ((a1-4 (if (focus-test? self indax) + jakb-lightjak-shield-end-ja + jakb-tube-turn-ja + ) + ) + ) + (ja :group! a1-4 + :num! (identity (ja-aframe + (+ (-> self tube turn-anim-frame) + (* 5.0 (sin (* 145.63556 (the float (- (current-time) (-> self state-time)))))) + ) + 0 + ) + ) + ) + ) + 0 + (none) + ) + +(defstate target-tube-walk (target) + :parent target-tube + :enter (behavior () + (set! (-> self control mod-surface) *tube-mods*) + (set! (-> self control surf) *tube-surface*) + ) + :trans (behavior () + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go target-tube-jump (-> *TARGET-bank* tube-jump-height-min) (-> *TARGET-bank* tube-jump-height-max)) + ) + (when (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (seconds 0.2)) + (and (< 4096.0 (target-height-above-ground)) (!= (-> self control gspot-pat-surfce event) 7)) + ) + (set! (-> self control unknown-float0000) (+ -24576.0 (-> self tube centertube y))) + (cond + ((focus-test? self indax) + enter-state + 'tube + (go target-indax-falling) + ) + (else + (go target-falling 'tube) + ) + ) + ) + ) + :code (behavior () + (cond + ((and (not (focus-test? self indax)) + (let ((v1-5 (ja-group))) + (and v1-5 (or (= v1-5 jakb-jump-forward-ja) (= v1-5 jakb-duck-high-jump-ja) (= v1-5 jakb-jump-loop-ja))) + ) + ) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! jakb-tube-jump-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self tube turn-anim-frame) 0.0) + ) + ((and (focus-test? self indax) + (let ((v1-39 (ja-group))) + (and v1-39 (or (= v1-39 (-> self draw art-group data 476)) (= v1-39 (-> self draw art-group data 477)))) + ) + ) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! jakb-lightjak-dummy21-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self tube turn-anim-frame) 0.0) + ) + (else + (ja-channel-push! 1 (seconds 0.04)) + ) + ) + (until #f + (set! (-> self tube turn-anim-targ) (* 20.0 (-> self tube mod-x))) + (target-tube-turn-anim) + (suspend) + ) + #f + ) + ) + +(defstate target-tube-jump (target) + :parent target-tube + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! (-> self control mod-surface) *tube-jump-mods*) + (set! (-> self control unknown-float0000) (+ -24576.0 (-> self tube centertube y))) + ) + :trans (behavior () + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-tube-walk) + ) + (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + (seek! + (-> self control unknown-float35) + (fmax 0.0 (fmin 1.0 (* 0.00012207031 (+ -2048.0 (-> self control ctrl-xz-vel))))) + (seconds-per-frame) + ) + (if (and (< (-> self control trans y) (-> self control unknown-float0000)) + (and (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 0.0) + (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) + (focus-test? self indax) + ) + ) + (send-event + self + 'attack-invinc + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'endlessfall) + ) + ) + ) + ) + ) + :code (behavior ((arg0 float) (arg1 float)) + (let ((f28-0 35.0) + (f30-0 1.0) + ) + (ja-channel-push! 1 (seconds 0.05)) + (set! f28-0 (cond + ((focus-test? self indax) + (sound-play "dax-effort") + (ja :group! (-> self draw art-group data 476)) + 10.0 + ) + ((= (-> self ext-anim) (target-anim default)) + (ja :group! jakb-duck-high-jump-ja :num! (identity (ja-aframe 16.0 0))) + f28-0 + ) + (else + (ja :group! jakb-jump-forward-ja) + 10.0 + ) + ) + ) + (until (ja-done? 0) + (let* ((f24-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f26-0 (- f28-0 (ja-aframe-num 0))) + (f0-8 (fmin (fmin 3.0 f26-0) (/ (* 5.0 f26-0) (the float (time-to-apex f24-0 -245760.0))))) + (a0-16 (-> self skel root-channel 0)) + ) + (set! (-> a0-16 param 0) (the float (+ (-> a0-16 frame-group frames num-frames) -1))) + (let ((v1-35 (and (< 0.0 f24-0) (< 0.0 f26-0)))) + (set! (-> a0-16 param 1) (if v1-35 + f0-8 + f30-0 + ) + ) + ) + (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-seek!) + ) + (suspend) + ) + ) + (if (focus-test? self indax) + (ja-no-eval :group! (-> self draw art-group data 477) :num! (loop!) :frame-num 0.0) + (ja-no-eval :group! jakb-jump-loop-ja :num! (loop!) :frame-num 0.0) + ) + (until #f + (suspend) + (ja :num! (loop!)) + ) + #f + ) + ) + +(defstate target-tube-hit (target) + :parent target-tube + :enter (behavior ((arg0 symbol) (arg1 attack-info)) + (send-event + (handle->process (-> self tube tube)) + 'update + (-> self tube centertube) + (-> self tube downtube) + (-> self tube sidetube) + (-> self tube foretube) + ) + ) + :exit (behavior () + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-tube-death))) + (logclear! (-> self focus-status) (focus-status dead hit)) + ) + (logclear! (-> self focus-status) (focus-status grabbed in-head)) + (logclear! (-> self target-flags) (target-flags tf1 tf5)) + (let ((v1-12 (-> self prev-state parent))) + (when v1-12 + (let ((t9-0 (-> v1-12 exit))) + (if t9-0 + (t9-0) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 attack-info)) + (let ((gp-0 (-> self attack-info))) + (set-time! (-> self state-time)) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (when (not (logtest? (-> arg1 mask) (attack-mask vector))) + (vector-! + (-> arg1 vector) + (vector+float*! (new 'stack-no-clear 'vector) (-> self tube foretube) (-> self tube downtube) 20480.0) + (-> self control trans) + ) + (let ((v1-11 (new-stack-vector0)) + (f0-2 (vector-dot (-> self control wall-contact-poly-normal) (-> arg1 vector))) + ) + 0.0 + (vector-! v1-11 (-> arg1 vector) (vector-float*! v1-11 (-> self control wall-contact-poly-normal) f0-2)) + (let* ((f1-2 (vector-length v1-11)) + (f2-0 f1-2) + ) + (if (< f0-2 0.0) + (set! f0-2 (* 0.5 f0-2)) + ) + (vector+! + (-> arg1 vector) + (vector-float*! (-> arg1 vector) (-> self control wall-contact-poly-normal) f0-2) + (vector-float*! v1-11 v1-11 (/ f1-2 f2-0)) + ) + ) + ) + (logior! (-> arg1 mask) (attack-mask vector)) + ) + (when (and (logtest? (-> arg1 mask) (attack-mask mode)) + (= (-> arg1 mode) 'darkeco) + (not (logtest? (-> arg1 mask) (attack-mask shove-up))) + ) + (set! (-> arg1 shove-up) 12288.0) + (logior! (-> arg1 mask) (attack-mask shove-up)) + ) + (let ((v1-23 gp-0)) + (set! (-> v1-23 attacker) (the-as handle #f)) + (set! (-> v1-23 mode) 'generic) + (set! (-> v1-23 shove-back) 6144.0) + (set! (-> v1-23 shove-up) 12288.0) + (set! (-> v1-23 angle) #f) + (set! (-> v1-23 trans quad) (-> self control trans quad)) + (set! (-> v1-23 control) 0.0) + (set! (-> v1-23 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) + (set! (-> v1-23 damage) (-> *FACT-bank* health-default-inc)) + ) + (combine! gp-0 arg1 self) + (when (= arg0 'attack) + (send-event (handle->process (-> self notify)) 'notify 'hit (-> gp-0 mode)) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> gp-0 mode) + (('bot) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (if (= (-> self game mode) 'play) + (go target-death (-> gp-0 mode)) + ) + ) + (('endlessfall) + (when (= (-> self game mode) 'play) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (cond + ((focus-test? self indax) + enter-state + (-> gp-0 mode) + (go target-indax-death) + ) + (else + (go target-death (-> gp-0 mode)) + ) + ) + ) + ) + (('lava 'melt) + (when (= (-> self game mode) 'play) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-death (-> gp-0 mode)) + ) + ) + (else + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> gp-0 damage)) (the-as handle #f)) + ) + ) + (target-hit-effect gp-0) + ) + (set! (-> self control mod-surface) *smack-mods*) + (target-hit-setup-anim gp-0) + (target-hit-move gp-0 (target-hit-orient gp-0 (-> gp-0 vector)) target-falling-anim-trans 1.0) + (let ((v1-69 (new-stack-vector0)) + (f0-12 (vector-dot (-> self tube downtube) (-> self control transv))) + ) + 0.0 + (vector-! v1-69 (-> self control transv) (vector-float*! v1-69 (-> self tube downtube) f0-12)) + (let ((f1-5 (vector-length v1-69)) + (f2-2 (fmax 40960.0 f0-12)) + (f0-13 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self tube downtube) f2-2) + (vector-float*! v1-69 v1-69 (/ f0-13 f1-5)) + ) + ) + ) + (let ((s5-2 forward-up-nopitch->quaternion) + (s4-1 (-> self control dir-targ)) + (t9-14 vector-normalize!) + (a0-71 (new-stack-vector0)) + ) + (set! (-> a0-71 quad) (-> self control transv quad)) + (s5-2 s4-1 (t9-14 a0-71 1.0) (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ))) + ) + (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-tube-death (-> gp-0 mode)) + ) + ) + (go target-tube-walk) + ) + :post target-post + ) + +(defstate target-tube-death (target) + :parent target-tube + :event (-> target-death event) + :exit (behavior () + (logclear! (-> self focus-status) (focus-status dead hit)) + (target-exit) + (remove-setting! 'process-mask) + (apply-settings *setting-control*) + (let ((v1-7 (-> self prev-state parent))) + (when v1-7 + (let ((t9-3 (-> v1-7 exit))) + (if t9-3 + (t9-3) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (local-vars (v1-53 symbol)) + (set! (-> self neck flex-blend) 0.0) + (target-timed-invulnerable-off self 0) + (add-setting! 'process-mask 'set 0.0 (process-mask enemy platform projectile death)) + (apply-settings *setting-control*) + (set! (-> self control transv quad) (the-as uint128 0)) + (let ((s5-0 (-> self child))) + (while s5-0 + (send-event (ppointer->process s5-0) 'notice 'die) + (set! s5-0 (-> s5-0 0 brother)) + ) + ) + (set! (-> self death-resetter continue) #f) + (set! (-> self death-resetter node) (game-task-node none)) + (set! (-> self death-resetter reset-mode) 'life) + (set! (-> self death-resetter execute) #f) + (set! (-> self control mod-surface) *neutral-mods*) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-deatha-ja :num! (seek! (ja-aframe 134.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (when (not (logtest? (-> self align flags) (align-flags disabled))) + (vector-matrix*! gp-2 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-float*! (-> self control transv) gp-2 (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 134.0 0))) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f)) + (set-time! (-> self state-time)) + (until v1-53 + (suspend) + (set! v1-53 (and (time-elapsed? (-> self state-time) (seconds 1)) (not (movie?)))) + ) + (go target-tube-walk) + ) + :post target-no-stick-post + ) + +(deftype slide-control (process-drawable) + ((target handle) + (pos float) + (trans vector :inline) + (rot vector :inline) + (side vector :inline) + ) + (:state-methods + slide-control-watch + slide-control-ride + ) + ) + + +(defun distance-from-tangent ((arg0 path-control) (arg1 float) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 vector)) + (get-point-in-path! arg0 arg2 arg1 'interp) + (displacement-between-two-points-normalized! arg0 arg3 arg1) + (set! (-> arg2 y) (-> arg5 y)) + (set! (-> arg3 y) 0.0) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (vector-rotate-y! arg4 arg3 -16384.0) + (set! (-> arg4 y) 0.0) + (let* ((a2-5 (vector+! (new 'stack-no-clear 'vector) arg2 arg4)) + (f0-3 (vector-line-distance-point! arg5 arg2 a2-5 s2-1)) + ) + (if (< 0.0 (vector-dot arg3 (vector-! (new 'stack-no-clear 'vector) arg5 s2-1))) + (set! f0-3 (- f0-3)) + ) + f0-3 + ) + ) + ) + +(defbehavior find-target-point slide-control ((arg0 vector)) + (local-vars (f0-2 float)) + (let* ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (f28-0 (+ -0.1 (-> self pos))) + (f26-0 (distance-from-tangent (-> self path) f28-0 s4-0 s5-0 gp-0 arg0)) + ) + 0.0 + (let ((f30-0 f28-0)) + (until (or (and (< f26-0 f0-2) (>= f0-2 0.0)) (< (get-num-segments (-> self path)) f28-0)) + (set! f0-2 (distance-from-tangent (-> self path) f28-0 s4-0 s5-0 gp-0 arg0)) + (when (or (>= f26-0 f0-2) (< f26-0 0.0)) + (set! f26-0 f0-2) + (set! f30-0 f28-0) + ) + (set! f28-0 (+ 0.01 f28-0)) + ) + (distance-from-tangent (-> self path) f30-0 s4-0 s5-0 gp-0 arg0) + (set! (-> self trans quad) (-> s4-0 quad)) + (set! (-> self rot quad) (-> s5-0 quad)) + (set! (-> self side quad) (-> gp-0 quad)) + (set! (-> self pos) f30-0) + ) + ) + (-> self pos) + ) + +(defstate slide-control-watch (slide-control) + :virtual #t + :enter (behavior () + (get-point-in-path! (-> self path) (-> self trans) 0.2 'interp) + (get-point-in-path! (-> self path) (-> self root trans) 0.2 'interp) + (displacement-between-two-points-normalized! (-> self path) (-> self rot) 0.2) + (set! (-> self pos) 0.2) + ) + :trans (behavior () + (if (and (and *target* + (and (>= 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (< 0.0 + (vector-dot + (vector-! (new 'stack-no-clear 'vector) (-> *target* control trans) (-> self trans)) + (-> self rot) + ) + ) + (and (not (focus-test? *target* in-air)) + (< (-> *target* control trans y) (+ 12288.0 (-> self root trans y))) + (send-event *target* 'change-mode 'tube self) + ) + ) + (go-virtual slide-control-ride) + ) + ) + :code sleep-code + ) + +(defstate slide-control-ride (slide-control) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('end-mode) + (go-virtual slide-control-watch) + ) + (('update) + (let* ((s4-0 proc) + (gp-0 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (if gp-0 + (find-target-point (-> (the-as process-drawable gp-0) root trans)) + ) + (set! (-> (the-as vector (-> block param 0)) quad) (-> self trans quad)) + (set! (-> (the-as vector (-> block param 1)) quad) (-> self rot quad)) + (set! (-> (the-as vector (-> block param 2)) quad) (-> self side quad)) + (get-point-in-path! (-> self path) (the-as vector (-> block param 3)) (+ 0.2 (-> self pos)) 'interp) + (if (>= (-> self pos) (+ -0.2 (get-num-segments (-> self path)))) + (send-event gp-0 'end-mode 'tube) + ) + ) + (-> self pos) + ) + ) + ) + :enter (behavior () + (set! (-> self pos) 0.0) + (set! (-> self target) (process->handle *target*)) + (process-entity-status! self (entity-perm-status no-kill) #t) + ) + :exit (behavior () + (set! (-> self target) (the-as handle #f)) + (process-entity-status! self (entity-perm-status no-kill) #f) + ) + :trans (behavior () + (let ((gp-0 (handle->process (-> self target)))) + (cond + ((if (type? gp-0 process-drawable) + gp-0 + ) + ) + (else + (go-virtual slide-control-watch) + ) + ) + ) + ) + :code sleep-code + ) + +(defmethod init-from-entity! ((this slide-control) (arg0 entity-actor)) + (set! (-> this root) (new 'process 'trsqv)) + (process-drawable-from-entity! this arg0) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0)) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> this target) (the-as handle #f)) + (go (method-of-object this slide-control-watch)) + ) diff --git a/goal_src/jak3/engine/target/target-util.gc b/goal_src/jak3/engine/target/target-util.gc index 7faaea1e73..d49873931d 100644 --- a/goal_src/jak3/engine/target/target-util.gc +++ b/goal_src/jak3/engine/target/target-util.gc @@ -1389,7 +1389,7 @@ ) ;; WARN: Return type mismatch object vs none. -(defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) +(defbehavior fall-test target ((arg0 (state object target)) (arg1 float)) (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (time-elapsed? (-> self control last-time-on-surface) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) diff --git a/goal_src/jak3/engine/target/target.gc b/goal_src/jak3/engine/target/target.gc index e3b6c3cb4e..61298261e5 100644 --- a/goal_src/jak3/engine/target/target.gc +++ b/goal_src/jak3/engine/target/target.gc @@ -1843,7 +1843,7 @@ (defstate target-falling (target) :event target-jump-event-handler - :enter (behavior ((arg0 symbol)) + :enter (behavior ((arg0 object)) (case arg0 (('uppercut) (set! (-> self control mod-surface) *uppercut-jump-mods*) @@ -1866,7 +1866,7 @@ #t ) ) - :code (behavior ((arg0 symbol)) + :code (behavior ((arg0 object)) (case arg0 (('uppercut) (ja-no-eval :num! (seek!)) diff --git a/goal_src/jak3/levels/city/traffic/traffic-manager.gc b/goal_src/jak3/levels/city/traffic/traffic-manager.gc index 5ad96ca44d..0b258744f7 100644 --- a/goal_src/jak3/levels/city/traffic/traffic-manager.gc +++ b/goal_src/jak3/levels/city/traffic/traffic-manager.gc @@ -7,3 +7,7 @@ ;; DECOMP BEGINS +;; stub +(defun ctywide-entity-hack () + (none) + ) \ No newline at end of file diff --git a/test/decompiler/reference/jak3/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-target-h_REF.gc index 510fa7754f..c59c6b75f9 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-target-h_REF.gc @@ -223,7 +223,7 @@ (last-nonzero-input-dir-targ quaternion :inline :offset 6384) (time-of-last-wall-hide-first-check-pass time-frame :offset 6400) (time-of-first-wall-hide-first-check-pass time-frame :offset 6408) - (pad uint8 4) + (unknown-float0000 float :offset 6416) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc index 9868db3c6a..bbd415fa13 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc @@ -614,7 +614,7 @@ :code sleep-code :post (behavior () (logclear! (-> self elevator-status) (elevator-status waiting-to-descend)) - (path-control-method-9 (-> self path)) + (debug-draw (-> self path)) (plat-post) ) ) @@ -1021,7 +1021,3 @@ (init-sound! this) (go-arrived-or-waiting this) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc index e289ea7283..79dc051da1 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc @@ -2482,7 +2482,7 @@ :trans (behavior () (when (-> self enable) (when (nonzero? (-> self path)) - (path-control-method-9 (-> self path)) + (debug-draw (-> self path)) (get-point-at-percent-along-path! (-> self path) (-> self root trans) (-> self path-pos) 'interp) (displacement-between-points-at-percent-normalized! (-> self path) (-> self last-velocity) (-> self path-pos)) (let ((f0-3 (+ (-> self path-pos) (* (-> self path-speed) (seconds-per-frame))))) diff --git a/test/decompiler/reference/jak3/engine/common-obs/water-flow_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/water-flow_REF.gc index a73d1e9738..c8463a61ff 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/water-flow_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/water-flow_REF.gc @@ -113,7 +113,7 @@ (defmethod draw-path ((this flow-control)) (let ((a0-1 (-> this path))) (if (nonzero? a0-1) - (path-control-method-9 a0-1) + (debug-draw a0-1) ) ) 0 @@ -177,17 +177,14 @@ 0 (let ((f0-12 (/ f30-0 (- f30-0 f0-10)))) (set! sv-208 (new 'stack-no-clear 'vector)) - (let ((t9-2 (method-of-object (-> this path) path-control-method-13))) - sv-208 - (+ (the float (if (= s4-0 (+ s2-0 -1)) - (+ s4-0 -1) - s4-0 - ) - ) - f0-12 - ) - (t9-2) - ) + (displacement-between-two-points-normalized! (-> this path) sv-208 (+ (the float (if (= s4-0 (+ s2-0 -1)) + (+ s4-0 -1) + s4-0 + ) + ) + f0-12 + ) + ) ) ) ) @@ -313,10 +310,7 @@ (let ((f0-12 (/ f30-0 (- f30-0 f0-10))) (s1-1 (new 'stack-no-clear 'vector)) ) - (let ((t9-3 (method-of-object (-> this path) path-control-method-13))) - (+ (the float s3-1) f0-12) - (t9-3) - ) + (displacement-between-two-points-normalized! (-> this path) s1-1 (+ (the float s3-1) f0-12)) (let ((v1-17 (new 'stack-no-clear 'vector))) (vector-float*! v1-17 s1-1 (* (-> s2-0 speed) (seconds-per-frame))) (let ((a1-16 (new 'stack-no-clear 'vector))) @@ -707,7 +701,3 @@ (set! (-> this flow) (new 'process 'flow-control (the-as process-drawable this) (the-as res-lump #f))) (go (method-of-object this idle)) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc b/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc new file mode 100644 index 0000000000..1c0833b280 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/debug/collision-editor_REF.gc @@ -0,0 +1,994 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; failed to figure out what this is: +(defskelgroup skel-collision-editor sew-rove-plat sew-rove-plat-lod0-jg sew-rove-plat-idle-ja + ((sew-rove-plat-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 100) + ) + +;; definition of type collision-editor-default-proc +(deftype collision-editor-default-proc (process-drawable) + () + (:state-methods + idle + ) + ) + +;; definition for method 3 of type collision-editor-default-proc +(defmethod inspect ((this collision-editor-default-proc)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(defstate idle (collision-editor-default-proc) + :virtual #t + :trans (behavior () + (deactivate self) + ) + :code sleep-code + ) + +;; definition for function collision-editor-default-proc-init-by-other +(defbehavior collision-editor-default-proc-init-by-other collision-editor-default-proc () + (let ((gp-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere gp-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) + (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) 3) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 4096000.0) + (set! (-> gp-0 total-prims) (the-as uint 1)) + (set! (-> gp-0 root-prim) v1-2) + ) + (set! (-> gp-0 nav-radius) (* 0.75 (-> gp-0 root-prim local-sphere w))) + (let ((v1-5 (-> gp-0 root-prim))) + (set! (-> gp-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> gp-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> self root) gp-0) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-collision-editor" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (transform-post) + (go-virtual idle) + ) + +;; definition of type collision-editor-edited-proc +(deftype collision-editor-edited-proc (process-drawable) + () + (:state-methods + idle + ) + ) + +;; definition for method 3 of type collision-editor-edited-proc +(defmethod inspect ((this collision-editor-edited-proc)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(defstate idle (collision-editor-edited-proc) + :virtual #t + :code sleep-code + :post (behavior () + (transform-post) + ) + ) + +;; definition for function collision-editor-edited-proc-init-by-other +(defbehavior collision-editor-edited-proc-init-by-other collision-editor-edited-proc () + (let ((gp-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-sphere gp-0 (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) + (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) 3) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> gp-0 total-prims) (the-as uint 1)) + (set! (-> gp-0 root-prim) v1-2) + ) + (set! (-> gp-0 nav-radius) (* 0.75 (-> gp-0 root-prim local-sphere w))) + (let ((v1-5 (-> gp-0 root-prim))) + (set! (-> gp-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> gp-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> self root) gp-0) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-collision-editor" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (go-virtual idle) + ) + +;; definition for symbol *collision-editor-mesh-names*, type (array string) +(define *collision-editor-mesh-names* (new 'static 'boxed-array :type string "moveplat")) + +;; definition for symbol *collision-editor-art-group-name*, type string +(define *collision-editor-art-group-name* "sew-rove-plat") + +;; definition for function collision-editor-add-mesh-to-ccache +(defun collision-editor-add-mesh-to-ccache ((arg0 collide-shape-prim-group) (arg1 collide-cache)) + (set! (-> arg1 collide-box4w min x) -409600000) + (set! (-> arg1 collide-box4w min y) -409600000) + (set! (-> arg1 collide-box4w min z) -409600000) + (set! (-> arg1 collide-box4w max x) #x186a0000) + (set! (-> arg1 collide-box4w max y) #x186a0000) + (set! (-> arg1 collide-box4w max z) #x186a0000) + (set! (-> arg1 num-tris) 0) + (set! (-> arg1 num-prims) 0) + (set! (-> arg1 collide-with) (the-as collide-spec -1)) + (set! (-> arg1 ignore-mask) (new 'static 'pat-surface)) + (add-fg-prim-using-box arg0 arg1) + (none) + ) + +;; definition for function print-default-collision +;; INFO: Used lq/sq +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 272 mismatch: defined as size 4, got size 16 +;; ERROR: Stack slot load at 288 mismatch: defined as size 4, got size 16 +;; WARN: Return type mismatch int vs none. +(defun print-default-collision ((arg0 process-drawable)) + (local-vars (sv-224 matrix) (sv-240 symbol) (sv-256 string) (sv-272 float) (sv-288 float)) + (let ((gp-0 (process-spawn collision-editor-default-proc :name "collision-editor-default-proc"))) + (when gp-0 + (when (and (nonzero? (-> (the-as process-drawable (-> gp-0 0)) draw)) + (-> (the-as process-drawable (-> gp-0 0)) draw jgeo) + ) + (format #t "(group (#f~%") + (format #t " :action (solid)~%") + (format #t " :collide-as enemy~%") + (format #t " :collide-with (player-list hit-by-others-list jak bot)~%") + (format #t " :sphere ((meters 0.0) (meters 0.0) (meters 0.0) (meters 2.0))~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> (the-as process-drawable (-> gp-0 0)) node-list data 3 joint name) + ) + (format #t " :children (~%") + (let* ((t9-10 (method-of-type res-lump get-property-struct)) + (a0-11 (-> (the-as process-drawable (-> gp-0 0)) draw jgeo extra)) + (a1-10 'collide-mesh-group) + (a2-3 'interp) + (a3-3 -1000000000.0) + (t0-0 (the-as float #f)) + (s5-1 (the-as + (array collide-mesh) + (t9-10 a0-11 a1-10 a2-3 a3-3 (the-as structure t0-0) (the-as (pointer res-tag) #f) *res-static-buf*) + ) + ) + ) + (cond + ((and s5-1 (> (length s5-1) 0)) + (dotimes (s4-0 (length s5-1)) + (format + #t + " (mesh ((la-collide-mesh ~S ~S)~%" + *collision-editor-art-group-name* + (-> *collision-editor-mesh-names* s4-0) + ) + (format #t " :action solid~%") + (format #t " :collide-as enemy~%") + (format #t " :collide-with (player-list hit-by-others-list jak bot)~%") + (let ((v1-22 (-> s5-1 s4-0 joint-id))) + (cond + ((= v1-22 -1) + (format #t " ;;:transform-index JOINT_ID_NO_TRANSFORM~%") + ) + ((= v1-22 -2) + (format #t " ;;:transform-index JOINT_ID_ROOT_TRANSLATION~%") + ) + ((= v1-22 -3) + (format #t " ;;:transform-index JOINT_ID_ROOT_TRANSFORM~%") + ) + (else + (let ((t9-19 format) + (a0-23 #t) + (a1-18 " :transform-index (joint-node-index ~S ~S)~%") + (a2-5 *collision-editor-art-group-name*) + (a3-12 (-> (the-as process-drawable (-> gp-0 0)) node-list data (+ (-> s5-1 s4-0 joint-id) 1) joint name)) + ) + (t9-19 a0-23 a1-18 a2-5 a3-12) + (let ((s0-0 (new 'stack 'collide-shape-prim-mesh (the-as collide-shape 0) (the-as uint a3-12) (the-as uint t0-0)))) + (set! (-> s0-0 cshape) (the-as collide-shape (-> (the-as process-drawable (-> gp-0 0)) root))) + (set! (-> s0-0 transform-index) (+ (-> s5-1 s4-0 joint-id) 1)) + (set! (-> s0-0 prim-core prim-type) 1) + (set! (-> s0-0 local-sphere w) 1.0) + (set! (-> s0-0 mesh) (-> s5-1 s4-0)) + (set! (-> s0-0 mesh-cache-id) (the-as uint 0)) + (set! (-> s0-0 mesh-id) s4-0) + (collision-editor-add-mesh-to-ccache (the-as collide-shape-prim-group s0-0) *collide-cache*) + (let ((a0-26 (the-as object (-> *collide-cache* tris))) + (v1-41 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (when (nonzero? (-> *collide-cache* num-tris)) + (set! (-> v1-41 quad) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 quad)) + (set! (-> s2-0 quad) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 quad)) + ) + (countdown (a1-27 (-> *collide-cache* num-tris)) + (set! (-> v1-41 x) (fmin + (fmin + (fmin (-> v1-41 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + ) + ) + (set! (-> v1-41 y) (fmin + (fmin + (fmin (-> v1-41 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + ) + ) + (set! (-> v1-41 z) (fmin + (fmin + (fmin (-> v1-41 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + ) + ) + (set! (-> s2-0 x) (fmax + (fmax + (fmax (-> s2-0 x) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 x)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 x) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 x) + ) + ) + (set! (-> s2-0 y) (fmax + (fmax + (fmax (-> s2-0 y) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 y)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 y) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 y) + ) + ) + (set! (-> s2-0 z) (fmax + (fmax + (fmax (-> s2-0 z) (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 0 z)) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 1 z) + ) + (-> (the-as (inline-array collide-cache-tri) a0-26) 0 vertex 2 z) + ) + ) + (set! a0-26 (-> (the-as (inline-array collide-cache-tri) a0-26) 1)) + ) + (vector+! s3-0 v1-41 s2-0) + (vector-float*! s3-0 s3-0 0.5) + (vector<-cspace! s1-0 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index))) + (vector-! s1-0 s3-0 s1-0) + (set! sv-224 (new 'stack-no-clear 'matrix)) + (let* ((a0-35 (-> (the-as process-drawable (-> gp-0 0)) node-list data (-> s0-0 transform-index) bone transform)) + (a2-11 (-> a0-35 rvec quad)) + (a1-36 (-> a0-35 uvec quad)) + (v1-53 (-> a0-35 fvec quad)) + (a0-36 (-> a0-35 trans quad)) + ) + (set! (-> sv-224 rvec quad) a2-11) + (set! (-> sv-224 uvec quad) a1-36) + (set! (-> sv-224 fvec quad) v1-53) + (set! (-> sv-224 trans quad) a0-36) + ) + (vector-reset! (-> sv-224 trans)) + (matrix-transpose! sv-224 sv-224) + (vector-matrix*! s1-0 s1-0 sv-224) + (let ((s0-1 format)) + (set! sv-240 #t) + (set! sv-256 " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%") + (set! sv-272 (-> s1-0 x)) + (set! sv-288 (-> s1-0 y)) + (let ((s1-1 (-> s1-0 z)) + (t1-1 (* 1.0001 (vector-vector-distance s3-0 s2-0))) + ) + (set! t0-0 s1-1) + (s0-1 sv-240 sv-256 sv-272 sv-288 t0-0 t1-1) + ) + ) + ) + ) + ) + ) + ) + ) + (format #t " ))~%") + ) + #f + ) + (else + (format #t " (sphere (#f~%") + (format #t " :action solid~%") + (format #t " :collide-as enemy~%") + (format #t " :collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> (the-as process-drawable (-> gp-0 0)) node-list data 3 joint name) + ) + (format #t " :sphere ((meters 0.0) (meters 0.0) (meters 0.0) (meters 1.0))~%") + (format #t " ))~%") + ) + ) + ) + (format #t " )))~%") + ) + ) + (deactivate (-> gp-0 0)) + ) + 0 + (none) + ) + +;; definition for function print-actual-collision +;; WARN: Return type mismatch object vs none. +(defun print-actual-collision ((arg0 process-drawable)) + (format #t "~%~%") + (when arg0 + (when (type? (-> arg0 root) collide-shape) + (let ((s5-0 (-> (the-as collide-shape (-> arg0 root)) root-prim)) + (s4-0 0) + ) + (let ((v1-3 (-> s5-0 prim-core prim-type))) + (cond + ((or (= v1-3 1) (= v1-3 -1)) + (set! s4-0 1) + ) + ((zero? v1-3) + (let ((s4-1 s5-0)) + (format #t "(group (#f~%") + (format #t " ;;:action (solid)~%") + (format #t " ;;:collide-as enemy~%") + (format #t " ;;:collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%" + (-> s5-0 local-sphere x) + (-> s5-0 local-sphere y) + (-> s5-0 local-sphere z) + (-> s5-0 local-sphere w) + ) + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> arg0 node-list data (-> s4-1 transform-index) joint name) + ) + (format #t " :children (~%") + (set! s4-0 (the-as int (-> s4-1 specific 1))) + ) + (&+! s5-0 80) + ) + ) + ) + (dotimes (s3-0 s4-0) + (case (-> s5-0 prim-core prim-type) + ((1) + (let ((v1-11 s5-0)) + (format + #t + " (mesh ((la-collide-mesh ~S ~S)~%" + *collision-editor-art-group-name* + (-> (the-as + (array string) + (+ (* (-> (the-as collide-shape-prim-mesh v1-11) mesh-id) 4) (the-as int *collision-editor-mesh-names*)) + ) + 0 + ) + ) + ) + (format #t " ;;:action solid~%") + (format #t " ;;:collide-as enemy~%") + (format #t " ;;:collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> arg0 node-list data (-> s5-0 transform-index) joint name) + ) + (format + #t + " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%" + (-> s5-0 local-sphere x) + (-> s5-0 local-sphere y) + (-> s5-0 local-sphere z) + (-> s5-0 local-sphere w) + ) + (format #t " ))~%") + ) + ((-1) + (format #t " (sphere (#f~%") + (format #t " ;;:action solid~%") + (format #t " ;;:collide-as enemy~%") + (format #t " ;;:collide-with (player-list hit-by-others-list jak bot)~%") + (format + #t + " :transform-index (joint-node-index ~S ~S)~%" + *collision-editor-art-group-name* + (-> arg0 node-list data (-> s5-0 transform-index) joint name) + ) + (format + #t + " :sphere ((meters ~M) (meters ~M) (meters ~M) (meters ~M))~%" + (-> s5-0 local-sphere x) + (-> s5-0 local-sphere y) + (-> s5-0 local-sphere z) + (-> s5-0 local-sphere w) + ) + (format #t " ))~%") + ) + ) + (&+! s5-0 80) + ) + ) + (if (zero? (-> (the-as collide-shape (-> arg0 root)) root-prim prim-core prim-type)) + (format #t " )))~%") + ) + ) + ) + (format #t "~%~%") + (none) + ) + +;; definition of type collision-editor +(deftype collision-editor (process) + ((proc handle) + ) + (:state-methods + idle + ) + ) + +;; definition for method 3 of type collision-editor +(defmethod inspect ((this collision-editor)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Tproc: ~D~%" (-> this proc)) + (label cfg-4) + this + ) + +;; definition of type collision-edit-info +(deftype collision-edit-info (structure) + ((editing symbol) + (current-func collision-editor-func) + (analog-func collision-editor-func) + (current-prim int32) + ) + (:methods + (collision-edit-info-method-9 (_type_) none) + (draw-menu (_type_ process-drawable) none) + (collision-edit-info-method-11 (_type_ process-drawable) none) + ) + ) + +;; definition for method 3 of type collision-edit-info +(defmethod inspect ((this collision-edit-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'collision-edit-info) + (format #t "~1Tediting: ~A~%" (-> this editing)) + (format #t "~1Tcurrent-func: ~D~%" (-> this current-func)) + (format #t "~1Tanalog-func: ~D~%" (-> this analog-func)) + (format #t "~1Tcurrent-prim: ~D~%" (-> this current-prim)) + (label cfg-4) + this + ) + +;; definition for function collision-edit-get-max-prim +(defun collision-edit-get-max-prim ((arg0 process-drawable)) + (let ((gp-0 0)) + (when (and arg0 (type? (-> arg0 root) collide-shape)) + (let ((v1-3 (-> (the-as collide-shape (-> arg0 root)) root-prim))) + (if (zero? (-> v1-3 prim-core prim-type)) + (set! gp-0 (the-as int (-> v1-3 specific 1))) + ) + ) + ) + gp-0 + ) + ) + +;; definition for function collision-edit-get-prim +;; WARN: Return type mismatch int vs collide-shape-prim. +(defun collision-edit-get-prim ((arg0 process-drawable) (arg1 int)) + (when (and arg0 (type? (-> arg0 root) collide-shape)) + (let ((s5-0 (-> (the-as collide-shape (-> arg0 root)) root-prim)) + (v1-3 (collision-edit-get-max-prim arg0)) + ) + (if (and s5-0 (>= v1-3 arg1)) + (return (the-as collide-shape-prim (+ (the-as uint s5-0) (* 80 arg1)))) + ) + ) + ) + (the-as collide-shape-prim #f) + ) + +;; definition for method 9 of type collision-edit-info +;; WARN: Return type mismatch int vs none. +(defmethod collision-edit-info-method-9 ((this collision-edit-info)) + (if (cpad-pressed? 0 up) + (+! (-> this current-func) -1) + ) + (if (cpad-pressed? 0 left) + (+! (-> this current-func) -4) + ) + (if (cpad-pressed? 0 down) + (+! (-> this current-func) 1) + ) + (if (cpad-pressed? 0 right) + (+! (-> this current-func) 4) + ) + (cond + ((< (the-as int (-> this current-func)) 0) + (set! (-> this current-func) (collision-editor-func stop-editor)) + ) + ((>= (the-as int (-> this current-func)) 4) + (set! (-> this current-func) (collision-editor-func analog)) + 0 + ) + ) + (none) + ) + +;; definition for method 11 of type collision-edit-info +;; WARN: Return type mismatch int vs none. +(defmethod collision-edit-info-method-11 ((this collision-edit-info) (arg0 process-drawable)) + (local-vars (s5-0 int)) + (when (not arg0) + (set! s5-0 (the-as int #f)) + (goto cfg-14) + ) + (set! s5-0 (-> this current-prim)) + (let ((v1-2 (collision-edit-get-max-prim arg0))) + (when (cpad-pressed? 0 r1) + (+! s5-0 1) + (if (cpad-hold? 0 l1) + (+! s5-0 4) + ) + ) + (when (cpad-pressed? 0 l1) + (+! s5-0 -1) + (if (cpad-hold? 0 r1) + (+! s5-0 -4) + ) + ) + (if (< s5-0 0) + (set! s5-0 v1-2) + ) + (if (< v1-2 s5-0) + (set! s5-0 0) + ) + ) + (set! (-> this current-prim) s5-0) + (label cfg-14) + (none) + ) + +;; definition for method 10 of type collision-edit-info +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod draw-menu ((this collision-edit-info) (arg0 process-drawable)) + (local-vars (a3-0 string)) + (when (cpad-pressed? 0 l2) + (set! (-> this editing) (not (-> this editing))) + (cond + ((-> this editing) + (set! *external-cam-mode* 'locked) + ) + (*target* + (set! *external-cam-mode* #f) + ) + (else + (set! *external-cam-mode* 'pad-0) + ) + ) + ) + (cond + ((or (not (-> this editing)) (cpad-hold? 0 r2)) + (if (not (-> this editing)) + (format *stdcon* "press l2 to edit collision~%") + (format *stdcon* "release r2 to continue editing collision~%") + ) + (if (or (cpad-hold? 0 r2) (not *target*)) + (set! *external-cam-mode* 'pad-0) + ) + ) + (else + (set! *external-cam-mode* 'locked) + (collision-edit-info-method-9 this) + (collision-edit-info-method-11 this arg0) + (let ((s3-0 ">") + (s4-0 " ") + ) + (if (not (logtest? (-> *display* real-frame-clock integral-frame-counter) 8)) + (set! s3-0 " ") + ) + (format *stdcon* " r2/l2: move camera~%") + (let ((s2-0 (-> this current-prim))) + "??" + (let ((v1-38 (collision-edit-get-prim arg0 0))) + (when v1-38 + (if (zero? (-> v1-38 prim-core prim-type)) + (+! s2-0 -1) + ) + ) + ) + (cond + ((= s2-0 -1) + (set! a3-0 "*group*") + ) + ((= (-> (collision-edit-get-prim arg0 s2-0) prim-core prim-type) 1) + (set! a3-0 (-> *collision-editor-mesh-names* s2-0)) + ) + (else + (set! a3-0 "*sphere*") + ) + ) + ) + (format *stdcon* " r1/l1: select prim ~D ~S~%" (-> this current-prim) a3-0) + (format *stdcon* " dpad: select function~%") + (format *stdcon* " x, tri: toggle/call~%") + (format *stdcon* "------------------------~%") + (format + *stdcon* + " ~S analog: ~S~%" + (if (= (-> this current-func) (collision-editor-func analog)) + s3-0 + s4-0 + ) + (if (= (-> this analog-func) (collision-editor-func analog)) + "adjust sphere" + "???" + ) + ) + (let ((v1-50 (collision-edit-get-prim arg0 (-> this current-prim))) + (a3-2 (the-as basic "??")) + ) + (if (zero? (-> v1-50 transform-index)) + (set! a3-2 "*root*") + ) + (if (and v1-50 + (< (-> v1-50 transform-index) (-> arg0 node-list length)) + (-> arg0 node-list data (-> v1-50 transform-index) joint) + ) + (set! a3-2 (-> arg0 node-list data (-> v1-50 transform-index) joint name)) + ) + (format + *stdcon* + " ~S change sphere joint ~S~%" + (if (= (-> this current-func) (collision-editor-func edit)) + s3-0 + s4-0 + ) + a3-2 + ) + ) + (format + *stdcon* + " ~S print to listener~%" + (if (= (-> this current-func) (collision-editor-func print-collision)) + s3-0 + s4-0 + ) + ) + (format *stdcon* " ~S quit~%" (cond + ((= (-> this current-func) (collision-editor-func stop-editor)) + (empty) + s3-0 + ) + (else + s4-0 + ) + ) + ) + ) + (let ((s4-1 0)) + (if (cpad-pressed? 0 x) + (+! s4-1 1) + ) + (if (cpad-pressed? 0 triangle) + (+! s4-1 -1) + ) + (when (nonzero? s4-1) + (case (-> this current-func) + (((collision-editor-func analog)) + (+! (-> this analog-func) s4-1) + ) + (((collision-editor-func edit)) + (let ((v1-75 (collision-edit-get-prim arg0 (-> this current-prim)))) + (when (and v1-75 (!= (-> v1-75 prim-core prim-type) 1)) + (let* ((a0-41 (-> v1-75 transform-index)) + (a1-25 (+ (-> arg0 node-list length) -1)) + (a0-42 (+ a0-41 s4-1)) + ) + (if (< a0-42 0) + (set! a0-42 a1-25) + ) + (while (or (= a0-42 1) (= a0-42 2)) + (+! a0-42 s4-1) + ) + (if (< a1-25 a0-42) + (set! a0-42 0) + ) + (set! (-> v1-75 transform-index) a0-42) + ) + ) + ) + ) + (((collision-editor-func print-collision)) + (print-actual-collision arg0) + ) + (((collision-editor-func stop-editor)) + (kill-by-type collision-editor-edited-proc *active-pool*) + (kill-by-type collision-editor *active-pool*) + ) + (else + (format 0 "~%ERROR: bad collision-edit-func~%") + ) + ) + ) + ) + (cond + ((< (the-as int (-> this analog-func)) 0) + (set! (-> this analog-func) (collision-editor-func analog)) + 0 + ) + ((>= (the-as int (-> this analog-func)) 1) + (set! (-> this analog-func) (collision-editor-func analog)) + 0 + ) + ) + (when arg0 + (let ((f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 1.0)) + (f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 righty)) 128.0 48.0 110.0 1.0)) + (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 1.0)) + (f24-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 1.0)) + ) + (when (or (!= f30-0 0.0) (!= f28-0 0.0) (!= f26-0 0.0) (!= f24-0 0.0)) + (when (= (-> this analog-func) (collision-editor-func analog)) + (set! f30-0 (* -409.6 f30-0)) + (set! f28-0 (* -409.6 f28-0)) + (let ((f0-8 (+ (* 0.01 f24-0) (* -0.01 f26-0)))) + (set! f24-0 (+ 1.0 f0-8)) + ) + (set! f26-0 0.0) + ) + (when (= (-> this analog-func) (collision-editor-func analog)) + (let ((s4-2 (collision-edit-get-prim arg0 (-> this current-prim)))) + (when s4-2 + (set! (-> s4-2 local-sphere w) (* (-> s4-2 local-sphere w) f24-0)) + (let ((s3-1 (new 'stack-no-clear 'matrix))) + (let* ((a2-17 (matrix-local->world #f #f)) + (v1-107 (-> a2-17 rvec quad)) + (a0-58 (-> a2-17 uvec quad)) + (a1-37 (-> a2-17 fvec quad)) + (a2-18 (-> a2-17 trans quad)) + ) + (set! (-> s3-1 rvec quad) v1-107) + (set! (-> s3-1 uvec quad) a0-58) + (set! (-> s3-1 fvec quad) a1-37) + (set! (-> s3-1 trans quad) a2-18) + ) + (let ((s2-1 (new 'stack-no-clear 'matrix))) + (let* ((a2-19 (-> arg0 node-list data (-> s4-2 transform-index) bone transform)) + (v1-111 (-> a2-19 rvec quad)) + (a0-61 (-> a2-19 uvec quad)) + (a1-38 (-> a2-19 fvec quad)) + (a2-20 (-> a2-19 trans quad)) + ) + (set! (-> s2-1 rvec quad) v1-111) + (set! (-> s2-1 uvec quad) a0-61) + (set! (-> s2-1 fvec quad) a1-38) + (set! (-> s2-1 trans quad) a2-20) + ) + (let ((s1-1 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 x) f30-0) + (set! (-> s1-1 y) f28-0) + (set! (-> s1-1 z) f26-0) + (set! (-> s1-1 w) 1.0) + (vector-reset! (-> s3-1 trans)) + (vector-matrix*! s1-1 s1-1 s3-1) + (vector-reset! (-> s2-1 trans)) + (matrix-transpose! s2-1 s2-1) + (vector-matrix*! s1-1 s1-1 s2-1) + (+! (-> s4-2 local-sphere x) (-> s1-1 x)) + (+! (-> s4-2 local-sphere y) (-> s1-1 y)) + (+! (-> s4-2 local-sphere z) (-> s1-1 z)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (let ((s5-1 (collision-edit-get-prim arg0 (-> this current-prim)))) + (cond + (s5-1 + (show-maya-skeleton arg0 (-> s5-1 transform-index) #x45800000) + (let ((gp-1 (shl #x80ff 16))) + (let ((v1-117 (-> s5-1 prim-core prim-type))) + (cond + ((= v1-117 1) + (collision-editor-add-mesh-to-ccache (the-as collide-shape-prim-group s5-1) *collide-cache*) + (debug-draw *collide-cache*) + (let ((s4-3 (the-as object (-> *collide-cache* tris)))) + (countdown (s3-2 (-> *collide-cache* num-tris)) + (when (< (-> s5-1 prim-core world-sphere w) + (vector-vector-distance + (the-as vector (-> s5-1 prim-core)) + (the-as vector (-> (the-as collide-cache-tri s4-3) vertex)) + ) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-tri s4-3) vertex)) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (set! gp-1 (the-as int (the-as uint #x800000ff))) + ) + (when (< (-> s5-1 prim-core world-sphere w) + (vector-vector-distance (the-as vector (-> s5-1 prim-core)) (-> (the-as collide-cache-tri s4-3) vertex 1)) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (-> (the-as collide-cache-tri s4-3) vertex 1) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (set! gp-1 (the-as int (the-as uint #x800000ff))) + ) + (when (< (-> s5-1 prim-core world-sphere w) + (vector-vector-distance (the-as vector (-> s5-1 prim-core)) (-> (the-as collide-cache-tri s4-3) vertex 2)) + ) + (add-debug-x + #t + (bucket-id debug-no-zbuf1) + (-> (the-as collide-cache-tri s4-3) vertex 2) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (set! gp-1 (the-as int (the-as uint #x800000ff))) + ) + (set! s4-3 (&+ (the-as collide-cache-tri s4-3) 64)) + ) + ) + ) + ((= v1-117 -1) + ) + ((zero? v1-117) + ) + ) + ) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s5-1 prim-core)) + (-> s5-1 prim-core world-sphere w) + (the-as rgba gp-1) + ) + ) + ) + (else + (show-maya-skeleton arg0 1000 #x45800000) + ) + ) + ) + 0 + (none) + ) + +;; definition for symbol *collision-edit-info*, type collision-edit-info +(define *collision-edit-info* (the-as collision-edit-info 0)) + +;; definition for symbol *collision-edit-info*, type collision-edit-info +(define *collision-edit-info* + (new 'static 'collision-edit-info :editing #t :current-func (collision-editor-func print-collision)) + ) + +;; failed to figure out what this is: +(defstate idle (collision-editor) + :virtual #t + :exit (behavior () + (set! *external-cam-mode* #f) + ) + :trans (behavior () + (let ((gp-0 *collision-edit-info*) + (s5-0 (method-of-type collision-edit-info draw-menu)) + (s4-0 (handle->process (-> self proc))) + ) + (s5-0 gp-0 (the-as process-drawable (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + ) + ) + :code sleep-code + ) + +;; definition for function collision-editor-init-by-other +(defbehavior collision-editor-init-by-other collision-editor ((arg0 handle)) + (set! (-> self proc) arg0) + (go-virtual idle) + ) + +;; definition for function stop-collision-edit +;; WARN: Return type mismatch int vs none. +(defun stop-collision-edit () + (kill-by-type collision-editor-edited-proc *active-pool*) + (kill-by-type collision-editor *active-pool*) + 0 + (none) + ) + +;; definition for function collision-edit +(defun collision-edit ((arg0 process)) + (stop-collision-edit) + (when (not arg0) + (let ((v1-2 (process-spawn collision-editor-edited-proc :name "collision-editor-edited-proc"))) + (set! arg0 (if v1-2 + (the-as process (-> v1-2 0 self)) + ) + ) + ) + ) + (let ((gp-2 (process->handle (the-as process-tree arg0)))) + (process-spawn collision-editor gp-2 :name "collision-editor") + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/entity/entity_REF.gc b/test/decompiler/reference/jak3/engine/entity/entity_REF.gc index 3411c99aca..35d67226f1 100644 --- a/test/decompiler/reference/jak3/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak3/engine/entity/entity_REF.gc @@ -1274,7 +1274,7 @@ ) ) (if (nonzero? (-> (the-as process-drawable arg0) path)) - (path-control-method-9 (-> (the-as process-drawable arg0) path)) + (debug-draw (-> (the-as process-drawable arg0) path)) ) (if (nonzero? (-> (the-as process-drawable arg0) vol)) (debug-draw (-> (the-as process-drawable arg0) vol)) @@ -1652,7 +1652,7 @@ *active-pool* (lambda ((arg0 process)) (when (type? arg0 process-drawable) (if (nonzero? (-> (the-as process-drawable arg0) path)) - (path-control-method-9 (-> (the-as process-drawable arg0) path)) + (debug-draw (-> (the-as process-drawable arg0) path)) ) (if (nonzero? (-> (the-as process-drawable arg0) vol)) (debug-draw (-> (the-as process-drawable arg0) vol)) diff --git a/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc b/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc index e084c68690..d6eddcf901 100644 --- a/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc @@ -17,29 +17,29 @@ These path-controls are typically allocated on a process heap." ) (:methods (new (symbol type process symbol float entity symbol) _type_) - (path-control-method-9 (_type_) none) + (debug-draw (_type_) none) (get-point-in-path! (_type_ vector float symbol) vector) - (path-control-method-11 () none) - (path-control-method-12 () none) - (path-control-method-13 () none) + (get-random-point (_type_ vector) vector) + (path-control-method-12 (_type_ vector float float) vector) + (displacement-between-two-points-normalized! (_type_ vector float) vector) (get-point-at-percent-along-path! (_type_ vector float symbol) vector) - (path-control-method-15 () none) + (path-control-method-15 (_type_ vector float float) vector) (displacement-between-points-at-percent-normalized! (_type_ vector float) vector) (get-num-segments (_type_) float) (total-distance (_type_) float) (get-num-verts (_type_) int) (segement-duration->path-duration (_type_ float) float) (path-duration->segment-duration (_type_ float) float) - (path-control-method-22 () none) - (path-control-method-23 () none) - (path-control-method-24 () none) + (path-control-method-22 (_type_ vector) float) + (path-control-method-23 (_type_ vector) float) + (path-control-method-24 (_type_ vector) float) (path-control-method-25 (_type_ vector) float) - (path-control-method-26 () none) - (path-control-method-27 () none) - (path-control-method-28 () none) - (path-control-method-29 () none) + (path-control-method-26 (_type_ float float) float) + (path-control-method-27 (_type_ vector) vector) + (path-control-method-28 (_type_ vector float float) float) + (path-control-method-29 (_type_ vector int float) float) (should-display-marks? (_type_) symbol) - (path-control-method-31 () none) + (displacement-between-two-points! (_type_ vector float float) vector) ) ) diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc new file mode 100644 index 0000000000..d2e8087b64 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/eye_REF.gc @@ -0,0 +1,1130 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *eye-work*, type eye-work +(define *eye-work* (new 'static 'eye-work + :sprite-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x508b400000008001 #x53531) + ) + :sprite-tmpl2 (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x50ab400000008001 #x53531) + ) + :adgif-tmpl (new 'static 'dma-gif-packet + :dma-vif (new 'static 'dma-packet + :dma (new 'static 'dma-tag :qwc #x6 :id (dma-tag-id cnt)) + :vif1 (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd direct) :msk #x1) + ) + :gif (new 'static 'array uint64 2 #x1000000000008005 #xe) + ) + :blink-table (new 'static 'array float 10 0.0 0.667 0.9 1.0 1.0 1.0 1.0 0.333 0.1 0.0) + ) + ) + +;; definition for function find-free-eye-index +(defun find-free-eye-index ((arg0 int) (arg1 string) (arg2 int)) + (dotimes (s4-0 32) + (let ((s2-0 (-> *eye-control-array* data s4-0))) + (when (!= (-> s2-0 level-index) -1) + (when (string-charp= arg1 (-> s2-0 art-group-name)) + (if (= (-> *kernel-context* login-level-index) (-> s2-0 level-index)) + (return s4-0) + ) + ) + ) + ) + ) + (let ((v1-14 (-> *level* level (-> *kernel-context* login-level-index)))) + (dotimes (s4-1 32) + (let ((s2-1 (-> *eye-control-array* data s4-1))) + (when (= (-> s2-1 level-index) -1) + (cond + ((< arg2 60) + (set! (-> s2-1 high-res?) #f) + (set! (-> s2-1 eye-slot) (logand (-> v1-14 eye-slot-lowres arg0) 15)) + (+! (-> v1-14 eye-slot-lowres arg0) 1) + ) + (else + (set! (-> s2-1 high-res?) #t) + (set! (-> s2-1 eye-slot) (logand (-> v1-14 eye-slot-highres arg0) 3)) + (+! (-> v1-14 eye-slot-highres arg0) 1) + ) + ) + (copyn-charp<-string (-> s2-1 art-group-name) arg1 (min 63 (+ (length arg1) 1))) + (set! (-> s2-1 level-index) (-> *kernel-context* login-level-index)) + (return s4-1) + ) + ) + ) + ) + (format 0 "ERROR: no free eye-controls available.~%") + 0 + ) + +;; definition for function free-eye-index +(defun free-eye-index ((idx int)) + (when (< idx 32) + (let ((v1-4 (-> *eye-control-array* data idx))) + (set! (-> v1-4 process) (the-as handle #f)) + (set! (-> v1-4 random-time) (the-as uint 60)) + (set! (-> v1-4 blink) 0.0) + (set! (-> v1-4 shaders) (the-as (inline-array adgif-shader) #f)) + (set! (-> v1-4 level-index) -1) + (set! (-> v1-4 high-res?) #f) + (set! (-> v1-4 eye-slot) (the-as uint 0)) + (set! (-> v1-4 art-group-name 0) (the-as uint 0)) + (dotimes (a0-4 2) + (set! (-> v1-4 eyes a0-4 shader-count) (the-as uint 0)) + (dotimes (a1-3 8) + (set! (-> (the-as eye-control (+ (+ (* a1-3 4) (* 80 a0-4)) (the-as int v1-4))) left shader 0) #f) + ) + ) + ) + ) + 0 + ) + +;; definition for function render-eyes-32 +;; INFO: Used lq/sq +(defun render-eyes-32 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) + (local-vars (sv-16 float)) + (let ((v1-0 *display*) + (a0-1 1776) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let* ((v1-2 (-> arg1 eye-slot)) + (s4-0 32) + (s3-0 (+ (* v1-2 32) 32)) + (s2-0 (* v1-2 32)) + ) + (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x))))) + (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y))))) + (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x))))) + ) + (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) + (let ((s1-0 (-> arg1 shaders 0))) + (let ((v1-16 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-16) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-16) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-0 (the-as structure (&+ (the-as dma-gif-packet v1-16) 32)))) + (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5) + (set! (-> (the-as adgif-shader s0-0) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-0) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-0) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let ((v1-25 (the-as object (-> arg0 base)))) + (set! (-> (the-as (inline-array vector4w) v1-25) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) v1-25) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 4) (* s4-0 16) (the-as int (* s3-0 16)) #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 5) 0 0 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) v1-25) 6) + (* (+ s4-0 64) 16) + (the-as int (* (+ s3-0 32) 16)) + #xffffff + 0 + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-30 (ash 16 (the-as int (-> s1-0 tex0 tw)))) + (a0-35 (ash 16 (the-as int (-> s1-0 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let* ((f0-6 (* 256.0 (-> arg1 left iris-scale))) + (a1-34 (the-as object (-> arg0 base))) + (a2-15 (the int (- f28-0 f0-6))) + (t0-5 (the int (- f26-0 f0-6))) + (a3-9 (the int (+ f28-0 f0-6))) + (t1-0 (the int (+ f26-0 f0-6))) + ) + (set! (-> (the-as (inline-array vector4w) a1-34) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-34) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 4) a2-15 t0-5 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 5) v1-30 a0-35 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 6) a3-9 t1-0 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-1 (-> arg1 shaders 3))) + (let ((v1-35 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-35) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-35) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-1 (the-as structure (&+ (the-as dma-gif-packet v1-35) 32)))) + (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5) + (set! (-> (the-as adgif-shader s0-1) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-1) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-1) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-42 (ash 16 (the-as int (-> s1-1 tex0 tw)))) + (a0-47 (ash 16 (the-as int (-> s1-1 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)) + ) + (let* ((f0-10 (* 256.0 (-> arg1 right iris-scale))) + (a1-44 (the-as object (-> arg0 base))) + (a2-25 (the int (- f30-0 f0-10))) + (t0-11 (the int (- sv-16 f0-10))) + (a3-19 (the int (+ f30-0 f0-10))) + (t1-1 (the int (+ sv-16 f0-10))) + ) + (set! (-> (the-as (inline-array vector4w) a1-44) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-44) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 4) a2-25 t0-11 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 5) v1-42 a0-47 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 6) a3-19 t1-1 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-2 (-> arg1 shaders 1))) + (let ((v1-50 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-50) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-50) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-2 (the-as structure (&+ (the-as dma-gif-packet v1-50) 32)))) + (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5) + (set! (-> (the-as adgif-shader s0-2) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-2) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-2) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-57 (ash 16 (the-as int (-> s1-2 tex0 tw)))) + (a0-65 (ash 16 (the-as int (-> s1-2 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let* ((f0-14 (* 256.0 (-> arg1 left pupil-scale))) + (a1-61 (the-as object (-> arg0 base))) + (a2-35 (the int (- f28-0 f0-14))) + (t0-17 (the int (- f26-0 f0-14))) + (a3-29 (the int (+ f28-0 f0-14))) + (t1-2 (the int (+ f26-0 f0-14))) + ) + (set! (-> (the-as (inline-array vector4w) a1-61) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-61) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 4) a2-35 t0-17 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 5) v1-57 a0-65 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 6) a3-29 t1-2 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-3 (-> arg1 shaders 4))) + (let ((v1-62 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-62) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-62) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-3 (the-as structure (&+ (the-as dma-gif-packet v1-62) 32)))) + (quad-copy! (the-as pointer s0-3) (the-as pointer s1-3) 5) + (set! (-> (the-as adgif-shader s0-3) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-3) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-3) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-69 (ash 16 (the-as int (-> s1-3 tex0 tw)))) + (a0-77 (ash 16 (the-as int (-> s1-3 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)) + ) + (let* ((f0-18 (* 256.0 (-> arg1 right pupil-scale))) + (a1-71 (the-as object (-> arg0 base))) + (a2-45 (the int (- f30-0 f0-18))) + (t0-23 (the int (- sv-16 f0-18))) + (a3-39 (the int (+ f30-0 f0-18))) + (t1-3 (the int (+ sv-16 f0-18))) + ) + (set! (-> (the-as (inline-array vector4w) a1-71) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-71) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 4) a2-45 t0-23 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 5) v1-69 a0-77 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 6) a3-39 t1-3 #xffffff 0) + ) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-4 (-> arg1 shaders 2))) + (let ((v1-77 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-77) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-77) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-4 (the-as structure (&+ (the-as dma-gif-packet v1-77) 32)))) + (quad-copy! (the-as pointer s0-4) (the-as pointer s1-4) 5) + (set! (-> (the-as adgif-shader s0-4) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-4) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-4) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-84 (ash 16 (the-as int (-> s1-4 tex0 tw)))) + (a0-95 (ash 16 (the-as int (-> s1-4 tex0 th)))) + ) + (when (< (-> arg1 left lid) 0.0) + (let ((f0-23 (+ 1.0 (-> arg1 left lid)))) + (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x1f :scay1 (+ s2-0 31) :scay0 s2-0))) + (let* ((f0-27 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 left lid)))) + (a1-93 (the-as object (-> arg0 base))) + (a2-55 (* s4-0 16)) + (t0-29 (the int (* 16.0 f0-27))) + (a3-51 (* (+ s4-0 32) 16)) + (t1-6 (the int (* 16.0 (+ f0-27 (* 32.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (inline-array vector4w) a1-93) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-93) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 4) a2-55 t0-29 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 5) v1-84 a0-95 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 6) a3-51 t1-6 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-5 (-> arg1 shaders 5))) + (let ((v1-89 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-89) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-89) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-5 (the-as structure (&+ (the-as dma-gif-packet v1-89) 32)))) + (quad-copy! (the-as pointer s0-5) (the-as pointer s1-5) 5) + (set! (-> (the-as adgif-shader s0-5) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f) + ) + (set! (-> (the-as adgif-shader s0-5) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-5) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-96 (ash 16 (the-as int (-> s1-5 tex0 tw)))) + (a0-107 (ash 16 (the-as int (-> s1-5 tex0 th)))) + ) + (when (< (-> arg1 right lid) 0.0) + (let ((f0-33 (+ 1.0 (-> arg1 right lid)))) + (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x20 :scax1 #x3f :scay1 (+ s2-0 31) :scay0 s2-0)) + ) + (let* ((f0-37 (+ (the float (+ s3-0 -32)) (* 32.0 (-> arg1 right lid)))) + (a1-108 (the-as object (-> arg0 base))) + (a2-66 (* (+ s4-0 64) 16)) + (t0-35 (the int (* 16.0 f0-37))) + (a3-63 (* (+ s4-0 32) 16)) + (t1-9 (the int (* 16.0 (+ f0-37 (* 32.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (inline-array vector4w) a1-108) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-108) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 4) a2-66 t0-35 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 5) v1-96 a0-107 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 6) a3-63 t1-9 #xffffff 0) + ) + ) + ) + ) + (let ((v0-0 (&+ (-> arg0 base) 112))) + (set! (-> arg0 base) v0-0) + v0-0 + ) + ) + ) + ) + ) + +;; definition for function render-eyes-64 +;; INFO: Used lq/sq +(defun render-eyes-64 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) + (local-vars (sv-16 float)) + (let ((v1-0 *display*) + (a0-1 1776) + ) + (+! (-> v1-0 mem-reserve-size) a0-1) + (when (not (-> v1-0 dma-buffer-overflow)) + (let ((a2-1 (-> v1-0 frames (-> v1-0 on-screen) global-buf))) + (if (< (-> a2-1 real-buffer-end) (the-as int (&+ (-> a2-1 base) a0-1))) + (set! (-> v1-0 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-0 dma-buffer-overflow)) + (let* ((v1-2 (-> arg1 eye-slot)) + (s4-0 64) + (s3-0 (+ (* v1-2 64) 64)) + (s2-0 (* v1-2 64)) + ) + (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x))))) + (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y))))) + (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x))))) + ) + (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) + (let ((s1-0 (-> arg1 shaders 0))) + (let ((v1-16 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-16) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-16) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-0 (the-as structure (&+ (the-as dma-gif-packet v1-16) 32)))) + (quad-copy! (the-as pointer s0-0) (the-as pointer s1-0) 5) + (set! (-> (the-as adgif-shader s0-0) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-0) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-0) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let ((v1-25 (the-as object (-> arg0 base)))) + (set! (-> (the-as (inline-array vector4w) v1-25) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) v1-25) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 4) (* s4-0 16) (the-as int (* s3-0 16)) #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) v1-25) 5) 0 0 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) v1-25) 6) + (* (+ s4-0 128) 16) + (the-as int (* (+ s3-0 64) 16)) + #xffffff + 0 + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-30 (ash 16 (the-as int (-> s1-0 tex0 tw)))) + (a0-35 (ash 16 (the-as int (-> s1-0 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let* ((f0-6 (* 512.0 (-> arg1 left iris-scale))) + (a1-34 (the-as object (-> arg0 base))) + (a2-15 (the int (- f28-0 f0-6))) + (t0-5 (the int (- f26-0 f0-6))) + (a3-9 (the int (+ f28-0 f0-6))) + (t1-0 (the int (+ f26-0 f0-6))) + ) + (set! (-> (the-as (inline-array vector4w) a1-34) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-34) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 4) a2-15 t0-5 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 5) v1-30 a0-35 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-34) 6) a3-9 t1-0 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-1 (-> arg1 shaders 3))) + (let ((v1-35 (the-as dma-gif-packet (-> arg0 base)))) + (set! (-> v1-35 dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> v1-35 quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-1 (the-as structure (&+ v1-35 32)))) + (quad-copy! (the-as pointer s0-1) (the-as pointer s1-1) 5) + (set! (-> (the-as adgif-shader s0-1) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-1) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-1) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-42 (ash 16 (the-as int (-> s1-1 tex0 tw)))) + (a0-47 (ash 16 (the-as int (-> s1-1 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)) + ) + (let* ((f0-10 (* 512.0 (-> arg1 right iris-scale))) + (a1-44 (the-as object (-> arg0 base))) + (a2-25 (the int (- f30-0 f0-10))) + (t0-11 (the int (- sv-16 f0-10))) + (a3-19 (the int (+ f30-0 f0-10))) + (t1-1 (the int (+ sv-16 f0-10))) + ) + (set! (-> (the-as (inline-array vector4w) a1-44) 0 quad) (-> *eye-work* sprite-tmpl dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-44) 1 quad) (-> *eye-work* sprite-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 4) a2-25 t0-11 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 5) v1-42 a0-47 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-44) 6) a3-19 t1-1 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-2 (-> arg1 shaders 1))) + (let ((v1-50 (the-as dma-gif-packet (-> arg0 base)))) + (set! (-> v1-50 dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> v1-50 quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-2 (the-as structure (&+ v1-50 32)))) + (quad-copy! (the-as pointer s0-2) (the-as pointer s1-2) 5) + (set! (-> (the-as adgif-shader s0-2) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-2) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-2) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-57 (ash 16 (the-as int (-> s1-2 tex0 tw)))) + (a0-65 (ash 16 (the-as int (-> s1-2 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let* ((f0-14 (* 512.0 (-> arg1 left pupil-scale))) + (a1-61 (the-as object (-> arg0 base))) + (a2-35 (the int (- f28-0 f0-14))) + (t0-17 (the int (- f26-0 f0-14))) + (a3-29 (the int (+ f28-0 f0-14))) + (t1-2 (the int (+ f26-0 f0-14))) + ) + (set! (-> (the-as (pointer uint128) a1-61)) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-61) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 4) a2-35 t0-17 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 5) v1-57 a0-65 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-61) 6) a3-29 t1-2 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-3 (-> arg1 shaders 4))) + (let ((v1-62 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-62) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-62) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-3 (the-as structure (&+ (the-as dma-gif-packet v1-62) 32)))) + (quad-copy! (the-as pointer s0-3) (the-as pointer s1-3) 5) + (set! (-> (the-as adgif-shader s0-3) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-3) alpha) (new 'static 'gs-miptbp :tbp1 #x44)) + (set! (-> (the-as adgif-shader s0-3) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-69 (ash 16 (the-as int (-> s1-3 tex0 tw)))) + (a0-77 (ash 16 (the-as int (-> s1-3 tex0 th)))) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)) + ) + (let* ((f0-18 (* 512.0 (-> arg1 right pupil-scale))) + (a1-71 (the-as object (-> arg0 base))) + (a2-45 (the int (- f30-0 f0-18))) + (t0-23 (the int (- sv-16 f0-18))) + (a3-39 (the int (+ f30-0 f0-18))) + (t1-3 (the int (+ sv-16 f0-18))) + ) + (set! (-> (the-as (inline-array vector4w) a1-71) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-71) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 2) 128 128 128 128) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 4) a2-45 t0-23 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 5) v1-69 a0-77 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-71) 6) a3-39 t1-3 #xffffff 0) + ) + ) + ) + ) + (&+! (-> arg0 base) 112) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + (let ((s1-4 (-> arg1 shaders 2))) + (let ((v1-77 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-77) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-77) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-4 (the-as structure (&+ (the-as dma-gif-packet v1-77) 32)))) + (quad-copy! (the-as pointer s0-4) (the-as pointer s1-4) 5) + (set! (-> (the-as adgif-shader s0-4) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-4) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-4) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-84 (ash 16 (the-as int (-> s1-4 tex0 tw)))) + (a0-95 (ash 16 (the-as int (-> s1-4 tex0 th)))) + ) + (when (< (-> arg1 left lid) 0.0) + (let ((f0-23 (+ 1.0 (-> arg1 left lid)))) + (set! (-> arg1 left lid) (+ f0-23 (* (- 1.0 f0-23) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 (scissor-1 (new 'static 'gs-scissor :scax1 #x3f :scay1 (+ s2-0 63) :scay0 s2-0))) + (let* ((f0-27 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 left lid)))) + (a1-93 (the-as object (-> arg0 base))) + (a2-55 (* s4-0 16)) + (t0-29 (the int (* 16.0 f0-27))) + (a3-51 (* (+ s4-0 64) 16)) + (t1-6 (the int (* 16.0 (+ f0-27 (* 64.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (inline-array vector4w) a1-93) 0 quad) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-93) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 4) a2-55 t0-29 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 5) v1-84 a0-95 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-93) 6) a3-51 t1-6 #xffffff 0) + ) + ) + ) + (&+! (-> arg0 base) 112) + (let ((s1-5 (-> arg1 shaders 5))) + (let ((v1-89 (the-as object (-> arg0 base)))) + (set! (-> (the-as dma-gif-packet v1-89) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) + (set! (-> (the-as dma-gif-packet v1-89) quad 1) (-> *eye-work* adgif-tmpl quad 1)) + (let ((s0-5 (the-as structure (&+ (the-as dma-gif-packet v1-89) 32)))) + (quad-copy! (the-as pointer s0-5) (the-as pointer s1-5) 5) + (set! (-> (the-as adgif-shader s0-5) clamp) + (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f) + ) + (set! (-> (the-as adgif-shader s0-5) alpha) (new 'static 'gs-miptbp :tbp1 #x1)) + (set! (-> (the-as adgif-shader s0-5) prims 9) (gs-reg64 alpha-1)) + ) + ) + (&+! (-> arg0 base) 112) + (let ((v1-96 (ash 16 (the-as int (-> s1-5 tex0 tw)))) + (a0-107 (ash 16 (the-as int (-> s1-5 tex0 th)))) + ) + (when (< (-> arg1 right lid) 0.0) + (let ((f0-33 (+ 1.0 (-> arg1 right lid)))) + (set! (-> arg1 right lid) (+ f0-33 (* (- 1.0 f0-33) (-> arg1 blink)))) + ) + ) + (dma-buffer-add-gs-set arg0 + (scissor-1 (new 'static 'gs-scissor :scax0 #x40 :scax1 #x7f :scay1 (+ s2-0 63) :scay0 s2-0)) + ) + (let* ((f0-37 (+ (the float (+ s3-0 -64)) (* 64.0 (-> arg1 right lid)))) + (a1-108 (the-as object (-> arg0 base))) + (a2-66 (* (+ s4-0 128) 16)) + (t0-35 (the int (* 16.0 f0-37))) + (a3-63 (* (+ s4-0 64) 16)) + (t1-9 (the int (* 16.0 (+ f0-37 (* 64.0 (-> arg1 left lid-scale)))))) + ) + (set! (-> (the-as (pointer uint128) a1-108)) (-> *eye-work* sprite-tmpl2 dma-vif quad)) + (set! (-> (the-as (inline-array vector4w) a1-108) 1 quad) (-> *eye-work* sprite-tmpl2 quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 2) 128 128 128 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 3) 0 0 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 4) a2-66 t0-35 #xffffff 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 5) v1-96 a0-107 0 0) + (set-vector! (-> (the-as (inline-array vector4w) a1-108) 6) a3-63 t1-9 #xffffff 0) + ) + ) + ) + ) + (let ((v0-0 (&+ (-> arg0 base) 112))) + (set! (-> arg0 base) v0-0) + v0-0 + ) + ) + ) + ) + ) + +;; definition for function debug-eyes +;; INFO: Used lq/sq +;; WARN: Return type mismatch pointer vs none. +;; ERROR: Failed store: (s.q! (+ v1-23 16) a0-10) at op 69 +;; ERROR: Failed store: (s.w! (+ a0-11 4) a1-6) at op 74 +;; ERROR: Failed store: (s.w! (+ a0-11 8) a1-7) at op 76 +;; ERROR: Failed store: (s.w! (+ a0-11 12) a1-8) at op 78 +;; ERROR: Failed store: (s.w! (+ a0-12 4) 0) at op 81 +;; ERROR: Failed store: (s.w! (+ a0-12 8) 0) at op 82 +;; ERROR: Failed store: (s.w! (+ a0-12 12) 0) at op 83 +;; ERROR: Failed store: (s.w! (+ a0-13 4) a1-10) at op 88 +;; ERROR: Failed store: (s.w! (+ a0-13 8) a1-11) at op 90 +;; ERROR: Failed store: (s.w! (+ a0-13 12) 0) at op 91 +;; ERROR: Failed store: (s.w! (+ a0-14 4) a1-13) at op 96 +;; ERROR: Failed store: (s.w! (+ a0-14 8) 0) at op 97 +;; ERROR: Failed store: (s.w! (+ a0-14 12) 0) at op 98 +;; ERROR: Failed store: (s.w! (+ v1-24 4) a0-16) at op 103 +;; ERROR: Failed store: (s.w! (+ v1-24 8) a0-17) at op 105 +;; ERROR: Failed store: (s.w! (+ v1-24 12) 0) at op 106 +(defun debug-eyes ((arg0 dma-buffer)) + (dma-buffer-add-gs-set arg0 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) + (tex0-1 + (new 'static 'gs-tex0 :tbw #x1 :th (log2 512) :tw (log2 64) :tbp0 (-> *eyes-texture-base* vram-block)) + ) + (tex1-1 (new 'static 'gs-tex1 :mmag #x1 :mmin #x4 :l #x1 :k #xeed)) + (texa (new 'static 'gs-texa :ta0 #x80 :ta1 #x80)) + (clamp-1 (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp))) + ) + (let ((v1-23 (-> arg0 base))) + (set! (-> (the-as (pointer uint128) v1-23)) (-> *eye-work* sprite-tmpl dma-vif quad)) + (let ((a0-10 (-> *eye-work* sprite-tmpl quad 1))) + (s.q! (+ v1-23 16) a0-10) + ) + (let ((a0-11 (&+ v1-23 32))) + (set! (-> (the-as (pointer int32) a0-11)) 128) + (let ((a1-6 128)) + (s.w! (+ a0-11 4) a1-6) + ) + (let ((a1-7 128)) + (s.w! (+ a0-11 8) a1-7) + ) + (let ((a1-8 128)) + (s.w! (+ a0-11 12) a1-8) + ) + ) + (let ((a0-12 (&+ v1-23 48))) + (set! (-> (the-as (pointer int32) a0-12)) 0) + (s.w! (+ a0-12 4) 0) + (s.w! (+ a0-12 8) 0) + (s.w! (+ a0-12 12) 0) + ) + (let ((a0-13 (&+ v1-23 64))) + (set! (-> (the-as (pointer int32) a0-13)) #x7e00) + (let ((a1-10 #x7800)) + (s.w! (+ a0-13 4) a1-10) + ) + (let ((a1-11 #xffffff)) + (s.w! (+ a0-13 8) a1-11) + ) + (s.w! (+ a0-13 12) 0) + ) + (let ((a0-14 (&+ v1-23 80))) + (set! (-> (the-as (pointer int32) a0-14)) 1024) + (let ((a1-13 8192)) + (s.w! (+ a0-14 4) a1-13) + ) + (s.w! (+ a0-14 8) 0) + (s.w! (+ a0-14 12) 0) + ) + (let ((v1-24 (&+ v1-23 96))) + (set! (-> (the-as (pointer int32) v1-24)) #x8200) + (let ((a0-16 #x8800)) + (s.w! (+ v1-24 4) a0-16) + ) + (let ((a0-17 #xffffff)) + (s.w! (+ v1-24 8) a0-17) + ) + (s.w! (+ v1-24 12) 0) + ) + ) + (&+! (-> arg0 base) 112) + (none) + ) + +;; definition for function update-eyes +;; WARN: Return type mismatch int vs none. +(defun update-eyes () + (when (not (-> *blit-displays-work* screen-copied)) + (dotimes (gp-0 32) + (let* ((s5-0 (-> *eye-control-array* data gp-0)) + (v1-7 (handle->process (-> s5-0 process))) + ) + (when (and v1-7 + (logtest? (-> (the-as process-drawable v1-7) skel status) (joint-control-status eye-anim)) + (logtest? (-> (the-as process-drawable v1-7) draw status) (draw-control-status on-screen)) + ) + (when (-> s5-0 shaders) + (when (not (paused?)) + (cond + ((and (>= (-> s5-0 left lid) 0.0) (>= (-> s5-0 right lid) 0.0)) + (set! (-> s5-0 random-time) (the-as uint 60)) + (set! (-> s5-0 blink) 0.0) + ) + (else + (+! (-> s5-0 random-time) -1) + (let ((v1-19 (-> s5-0 random-time))) + (when (< v1-19 (the-as uint 10)) + (set! (-> s5-0 blink) (-> *eye-work* blink-table v1-19)) + (if (zero? v1-19) + (set! (-> s5-0 random-time) (the-as uint (the int (rand-vu-float-range 60.0 240.0)))) + ) + ) + ) + ) + ) + ) + (when (-> s5-0 left shader) + (cond + ((and (= (-> s5-0 left pupil-scale) 0.0) (= (-> s5-0 left iris-scale) 0.0)) + (dotimes (v1-24 (the-as int (-> s5-0 left shader-count))) + (set! (-> s5-0 left shader v1-24 tex0 tfx) 1) + ) + ) + (else + (dotimes (v1-27 (the-as int (-> s5-0 left shader-count))) + (set! (-> s5-0 left shader v1-27 tex0 tfx) 0) + ) + ) + ) + ) + (when (-> s5-0 right shader) + (cond + ((and (= (-> s5-0 right pupil-scale) 0.0) (= (-> s5-0 right iris-scale) 0.0)) + (dotimes (v1-34 (the-as int (-> s5-0 right shader-count))) + (set! (-> s5-0 right shader v1-34 tex0 tfx) 1) + ) + ) + (else + (dotimes (v1-37 (the-as int (-> s5-0 right shader-count))) + (set! (-> s5-0 right shader v1-37 tex0 tfx) 0) + ) + ) + ) + ) + (cond + ((-> s5-0 high-res?) + (let ((v1-42 *display*) + (a0-45 16) + ) + (+! (-> v1-42 mem-reserve-size) a0-45) + (when (not (-> v1-42 dma-buffer-overflow)) + (let ((a2-0 (-> v1-42 frames (-> v1-42 on-screen) global-buf))) + (if (< (-> a2-0 real-buffer-end) (the-as int (&+ (-> a2-0 base) a0-45))) + (set! (-> v1-42 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-42 dma-buffer-overflow)) + (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (the-as bucket-id (-> s5-0 bucket)) + ) + (let ((t9-2 set-display-gs-state-offset) + (a0-50 s3-0) + (a1-35 (-> *eyes-texture-base* vram-page)) + (a2-2 (the-as object 128)) + ) + (t9-2 a0-50 (the-as int a1-35) (the-as int a2-2) 256 0 0 64 64) + (let ((v1-50 *display*) + (a0-51 48) + ) + (+! (-> v1-50 mem-reserve-size) a0-51) + (when (not (-> v1-50 dma-buffer-overflow)) + (let* ((a2-3 (-> v1-50 frames (-> v1-50 on-screen) global-buf)) + (a1-44 (-> a2-3 real-buffer-end)) + ) + (set! a2-2 (-> a2-3 base)) + (if (< a1-44 (the-as int (&+ (the-as pointer a2-2) a0-51))) + (set! (-> v1-50 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-50 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-0 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + ) + ) + ) + (render-eyes-64 s3-0 s5-0 (the-as int a2-2)) + ) + (reset-display-gs-state *display* s3-0) + (let ((v1-55 *display*) + (a0-62 48) + ) + (+! (-> v1-55 mem-reserve-size) a0-62) + (when (not (-> v1-55 dma-buffer-overflow)) + (let ((a2-4 (-> v1-55 frames (-> v1-55 on-screen) global-buf))) + (if (< (-> a2-4 real-buffer-end) (the-as int (&+ (-> a2-4 base) a0-62))) + (set! (-> v1-55 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-55 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-0 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))) + ) + ) + ) + ) + ) + ) + ) + ) + ((not (-> s5-0 high-res?)) + (let ((v1-68 *display*) + (a0-74 16) + ) + (+! (-> v1-68 mem-reserve-size) a0-74) + (when (not (-> v1-68 dma-buffer-overflow)) + (let ((a2-7 (-> v1-68 frames (-> v1-68 on-screen) global-buf))) + (if (< (-> a2-7 real-buffer-end) (the-as int (&+ (-> a2-7 base) a0-74))) + (set! (-> v1-68 dma-buffer-overflow) #t) + ) + ) + (when (not (-> v1-68 dma-buffer-overflow)) + (with-dma-buffer-add-bucket ((s3-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (the-as bucket-id (-> s5-0 bucket)) + ) + (let ((t9-6 set-display-gs-state-offset) + (a0-79 s3-1) + (a1-88 (-> *eyes-texture-base* vram-page)) + (a2-9 (the-as object 64)) + ) + (t9-6 a0-79 (the-as int a1-88) (the-as int a2-9) 512 0 0 32 32) + (let ((v1-76 *display*) + (a0-80 48) + ) + (+! (-> v1-76 mem-reserve-size) a0-80) + (when (not (-> v1-76 dma-buffer-overflow)) + (let* ((a2-10 (-> v1-76 frames (-> v1-76 on-screen) global-buf)) + (a1-97 (-> a2-10 real-buffer-end)) + ) + (set! a2-9 (-> a2-10 base)) + (if (< a1-97 (the-as int (&+ (the-as pointer a2-9) a0-80))) + (set! (-> v1-76 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-76 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-1 + (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest always) :zte #x1 :ztst (gs-ztest always))) + ) + ) + ) + ) + (render-eyes-32 s3-1 s5-0 (the-as int a2-9)) + ) + (reset-display-gs-state *display* s3-1) + (let ((v1-81 *display*) + (a0-91 48) + ) + (+! (-> v1-81 mem-reserve-size) a0-91) + (when (not (-> v1-81 dma-buffer-overflow)) + (let ((a2-11 (-> v1-81 frames (-> v1-81 on-screen) global-buf))) + (if (< (-> a2-11 real-buffer-end) (the-as int (&+ (-> a2-11 base) a0-91))) + (set! (-> v1-81 dma-buffer-overflow) #t) + ) + ) + (if (not (-> v1-81 dma-buffer-overflow)) + (dma-buffer-add-gs-set s3-1 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function get-eye-block +;; WARN: Return type mismatch uint vs int. +(defun get-eye-block ((arg0 int) (arg1 int)) + (let ((v1-0 arg0) + (a0-4 (-> ct32-24-block-table (* arg1 4))) + ) + (the-as int (+ (-> *eyes-texture-base* vram-block) (* v1-0 32) a0-4)) + ) + ) + +;; definition for function convert-eye-data +(defun convert-eye-data ((arg0 eye) (arg1 uint)) + (local-vars + (v0-0 float) + (v1-0 uint128) + (v1-1 uint128) + (v1-2 uint128) + (v1-3 uint128) + (v1-4 uint128) + (v1-5 uint128) + ) + (rlet ((vf1 :class vf) + (vf2 :class vf) + ) + (.pextlb v1-0 arg1 0) + (.pextlh v1-1 v1-0 0) + (.pw.sra v1-2 v1-1 16) + (.mov vf1 v1-2) + (.pextlb v1-3 0 arg1) + (.pextuh v1-4 0 v1-3) + (.pw.sll v1-5 v1-4 6) + (.mov vf2 v1-5) + (vitof15.xyzw vf1 vf1) + (vitof12.xyzw vf2 vf2) + (.svf (&-> arg0 data 0 quad) vf1) + (.svf (&-> arg0 data 1 quad) vf2) + (.mov v0-0 vf2) + v0-0 + ) + ) + +;; definition for function merc-eye-anim +;; WARN: Return type mismatch int vs none. +(defun merc-eye-anim ((arg0 process-drawable)) + (let* ((v1-2 (-> arg0 draw mgeo header eye-ctrl)) + (a0-2 (-> arg0 skel float-channels)) + (s3-0 (cond + ((> a0-2 0) + (-> arg0 skel channel (+ a0-2 -1 (-> arg0 skel active-channels))) + ) + (else + (let ((a0-8 (-> arg0 skel root-channel)) + (a1-4 (-> arg0 skel effect)) + ) + (-> a0-8 (if a1-4 + (-> a1-4 channel-offset) + 0 + ) + ) + ) + ) + ) + ) + (s4-0 (-> s3-0 frame-group)) + ) + (when (and (logtest? (-> arg0 skel status) (joint-control-status eye-anim)) + (and (nonzero? v1-2) (> (-> arg0 skel active-channels) 0) s4-0) + ) + (cond + ((and (-> arg0 skel override) (!= (-> arg0 skel override 41) 0.0)) + (let ((v1-6 (-> *eye-control-array* data (-> v1-2 eye-ctrl-index))) + (a0-24 (-> arg0 skel override)) + ) + (set! (-> v1-6 left x) (-> a0-24 42)) + (set! (-> v1-6 left y) (-> a0-24 43)) + (set! (-> v1-6 left lid) (-> a0-24 44)) + (set! (-> v1-6 left iris-scale) (-> a0-24 45)) + (set! (-> v1-6 left pupil-scale) (-> a0-24 46)) + (set! (-> v1-6 left lid-scale) (-> a0-24 47)) + (set! (-> v1-6 right x) (-> a0-24 48)) + (set! (-> v1-6 right y) (-> a0-24 49)) + (set! (-> v1-6 right lid) (-> a0-24 50)) + (set! (-> v1-6 right iris-scale) (-> a0-24 51)) + (set! (-> v1-6 right pupil-scale) (-> a0-24 52)) + (set! (-> v1-6 right lid-scale) (-> a0-24 53)) + ) + (logior! (-> arg0 skel status) (joint-control-status eye-anim-valid)) + ) + (else + (let* ((s5-0 (-> *eye-control-array* data (-> v1-2 eye-ctrl-index))) + (f0-13 (-> s3-0 frame-num)) + (f30-0 (- f0-13 (* (the float (the int (/ f0-13 1.0))) 1.0))) + ) + (set! (-> s5-0 process) (process->handle arg0)) + (set! (-> s5-0 shaders) (-> v1-2 shader)) + (let ((a0-34 *level*) + (v1-11 (-> arg0 draw)) + ) + (set! (-> s5-0 bucket) (the-as uint (vu1-bucket-map + (the-as int (-> a0-34 draw-index-map (-> v1-11 level-index))) + (the-as int (-> v1-11 default-texture-page)) + (merc-mode texture) + ) + ) + ) + ) + (let ((s2-0 (new 'stack-no-clear 'eye)) + (s1-0 (new 'stack-no-clear 'eye)) + ) + (cond + ((-> s4-0 eye-anim) + (let ((s0-1 (min (the int (-> s3-0 frame-num)) (-> s4-0 eye-anim max-frame))) + (s3-2 (min (+ (the int (-> s3-0 frame-num)) 1) (-> s4-0 eye-anim max-frame))) + ) + (convert-eye-data s2-0 (-> s4-0 eye-anim data (* s0-1 2) dword)) + (convert-eye-data s1-0 (-> s4-0 eye-anim data (* s3-2 2) dword)) + (vector4-lerp! (the-as vector (-> s5-0 eyes)) (the-as vector (&-> s2-0 x)) (the-as vector (&-> s1-0 x)) f30-0) + (vector4-lerp! + (the-as vector (&-> s5-0 left iris-scale)) + (the-as vector (&-> s2-0 iris-scale)) + (the-as vector (&-> s1-0 iris-scale)) + f30-0 + ) + (convert-eye-data s2-0 (-> s4-0 eye-anim data (+ (* s0-1 2) 1) dword)) + (convert-eye-data s1-0 (-> s4-0 eye-anim data (+ (* s3-2 2) 1) dword)) + ) + (vector4-lerp! + (the-as vector (-> s5-0 right)) + (the-as vector (&-> s2-0 x)) + (the-as vector (&-> s1-0 x)) + f30-0 + ) + (vector4-lerp! + (the-as vector (&-> s5-0 right iris-scale)) + (the-as vector (&-> s2-0 iris-scale)) + (the-as vector (&-> s1-0 iris-scale)) + f30-0 + ) + ) + (else + (format *stdcon* "no eye anim data for ~s~%" (-> arg0 name)) + (set! (-> s5-0 left x) 0.0) + (set! (-> s5-0 left y) 0.0) + (set! (-> s5-0 left lid) -1.0) + (set! (-> s5-0 left iris-scale) 0.55) + (set! (-> s5-0 left pupil-scale) 0.45) + (set! (-> s5-0 left lid-scale) 1.0) + (set! (-> s5-0 right x) 0.0) + (set! (-> s5-0 right y) 0.0) + (set! (-> s5-0 right lid) -1.0) + (set! (-> s5-0 right iris-scale) 0.55) + (set! (-> s5-0 right pupil-scale) 0.45) + (set! (-> s5-0 right lid-scale) 1.0) + ) + ) + ) + ) + (logior! (-> arg0 skel status) (joint-control-status eye-anim-valid)) + ) + ) + ) + ) + (if (logtest? (-> arg0 skel status) (joint-control-status eye-anim-valid)) + (logclear! (-> arg0 skel status) (joint-control-status eye-anim-valid)) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/process-drawable/simple-nav-sphere_REF.gc b/test/decompiler/reference/jak3/engine/process-drawable/simple-nav-sphere_REF.gc new file mode 100644 index 0000000000..f079c36f28 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/process-drawable/simple-nav-sphere_REF.gc @@ -0,0 +1,156 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type simple-nav-sphere +(deftype simple-nav-sphere (process-drawable) + ((first-time? symbol) + (track-joint int32) + ) + (:state-methods + idle + active + ) + ) + +;; definition for method 3 of type simple-nav-sphere +(defmethod inspect ((this simple-nav-sphere)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tfirst-time?: ~A~%" (-> this first-time?)) + (format #t "~2Ttrack-joint: ~D~%" (-> this track-joint)) + (label cfg-4) + this + ) + +;; definition for function simple-nav-sphere-event-handler +(defbehavior simple-nav-sphere-event-handler simple-nav-sphere ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('die-fast) + (go empty-state) + ) + (('move-trans) + (move-to-point! (the-as collide-shape (-> self root)) (the-as vector (-> arg3 param 0))) + #t + ) + (('set-radius) + (let ((f0-0 (the-as float (-> arg3 param 0))) + (a0-7 (-> self root)) + ) + (set! (-> a0-7 nav-radius) f0-0) + (set! (-> (the-as collide-shape a0-7) root-prim local-sphere w) f0-0) + (update-transforms (the-as collide-shape a0-7)) + ) + #t + ) + ) + ) + +;; definition for method 12 of type simple-nav-sphere +(defmethod run-logic? ((this simple-nav-sphere)) + "Should this process be run? Checked by execute-process-tree." + (cond + (*display-nav-marks* + #t + ) + ((>= (-> this track-joint) 0) + #t + ) + ((-> this first-time?) + (set! (-> this first-time?) #f) + #t + ) + ) + ) + +;; failed to figure out what this is: +(defstate idle (simple-nav-sphere) + :virtual #t + :event simple-nav-sphere-event-handler + :trans (behavior () + (if *display-nav-marks* + (add-debug-sphere + #t + (bucket-id debug) + (-> self root trans) + (-> self root nav-radius) + (new 'static 'rgba :r #x80 :g #x40 :a #x80) + ) + ) + ) + :code sleep-code + ) + +;; failed to figure out what this is: +(defstate active (simple-nav-sphere) + :virtual #t + :event simple-nav-sphere-event-handler + :trans (behavior () + (let ((v1-0 (ppointer->process (-> self parent))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (vector<-cspace! gp-0 (-> (the-as process-drawable v1-0) node-list data (-> self track-joint))) + (move-to-point! (the-as collide-shape (-> self root)) gp-0) + ) + ) + :code sleep-code + ) + +;; definition for function simple-nav-sphere-init-by-other +;; INFO: Used lq/sq +(defbehavior simple-nav-sphere-init-by-other simple-nav-sphere ((arg0 float) (arg1 vector) (arg2 nav-mesh) (arg3 int)) + (set! (-> self track-joint) arg3) + (set! (-> self first-time?) #t) + (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) + (let ((v1-3 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle)) + (set-vector! (-> v1-3 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-3) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-6 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> s5-0 nav-radius) arg0) + (set! (-> s5-0 root-prim local-sphere w) arg0) + (if arg1 + (set! (-> s5-0 trans quad) (-> arg1 quad)) + ) + (vector-identity! (-> s5-0 scale)) + (quaternion-identity! (-> s5-0 quat)) + (let ((v1-11 (-> s5-0 root-prim))) + (set! (-> v1-11 prim-core collide-as) (collide-spec)) + (set! (-> v1-11 prim-core collide-with) (collide-spec)) + ) + 0 + (update-transforms s5-0) + (set! (-> self root) s5-0) + ) + (logclear! (-> self mask) (process-mask actor-pause enemy)) + (set! (-> self event-hook) simple-nav-sphere-event-handler) + (cond + (arg2 + (let ((t9-5 (method-of-object arg2 nav-mesh-method-31))) + self + (t9-5) + ) + ) + (else + (nav-mesh-connect-from-ent self) + ) + ) + (if (>= (-> self track-joint) 0) + (go-virtual active) + (go-virtual idle) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/flut/flut-h_REF.gc b/test/decompiler/reference/jak3/engine/target/flut/flut-h_REF.gc index 65c0c03068..6ae3bbd56b 100644 --- a/test/decompiler/reference/jak3/engine/target/flut/flut-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/flut/flut-h_REF.gc @@ -51,26 +51,29 @@ ;; definition of type flut (deftype flut (process-focusable) - ((extra-trans vector :inline) + ((root collide-shape-moving :override) + (extra-trans vector :inline) (condition int32) (shadow-backup shadow-geo) (rider handle) (nav-sphere-handle handle) (probe-time time-frame) - (count-lock basic) + (count-lock symbol) (flags flut-flag) - (mode basic) + (mode symbol) (color-index int32) (minimap connection-minimap) ) + (:state-methods + wait-for-start + idle + (pickup (state flut)) + wait-for-return + die + ) (:methods - (flut-method-28 () none) - (flut-method-29 () none) - (flut-method-30 () none) - (flut-method-31 () none) - (flut-method-32 () none) - (flut-method-33 () none) - (flut-method-34 () none) + (flut-method-33 (_type_) symbol) + (spawn-part-and-sound! (_type_) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/target/flut/flut-part_REF.gc b/test/decompiler/reference/jak3/engine/target/flut/flut-part_REF.gc new file mode 100644 index 0000000000..3fdf8fadad --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/flut/flut-part_REF.gc @@ -0,0 +1,137 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpartgroup group-flut-trans-pad + :id 237 + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 1059 :fade-after (meters 160)) + (sp-item 1060 :fade-after (meters 160)) + (sp-item 1061 :fade-after (meters 60) :falloff-to (meters 60) :flags (is-3d)) + ) + ) + +;; failed to figure out what this is: +(defpart 1059 + :init-specs ((:texture (common-white common)) + (:num 0.5) + (:y (meters 7)) + (:scale-x (meters 14) (meters 1)) + (:scale-y (meters 14)) + (:r 40.0) + (:g 60.0 60.0) + (:b 128.0) + (:a 32.0 32.0) + (:timer (seconds 0.035)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +;; failed to figure out what this is: +(defpart 1060 + :init-specs ((:texture (common-white common)) + (:num 0.5) + (:y (meters 4)) + (:scale-x (meters 7) (meters 1)) + (:scale-y (meters 14)) + (:r 40.0) + (:g 60.0 60.0) + (:b 128.0) + (:a 64.0 64.0) + (:fade-a -8.533334) + (:timer (seconds 0.035)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +;; failed to figure out what this is: +(defpart 1061 + :init-specs ((:texture (splash-foam level-default-sprite)) + (:num 1.0) + (:y (meters 0.75) (meters 0.1)) + (:scale-x (meters 0)) + (:rot-x (degrees 0) (degrees 15)) + (:rot-y (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 16.0) + (:g 0.0 127.0) + (:b 127.0) + (:a 127.0) + (:vel-y (meters 0)) + (:scalevel-x (meters 0.02)) + (:rotvel-y (degrees -0.6) (degrees 1.2)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.21333334) + (:accel-y (meters -0.00015)) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-flut-attack-strike-ground + :id 238 + :duration (seconds 0.035) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 1062) (sp-item 1063)) + ) + +;; failed to figure out what this is: +(defpart 1062 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 24.0) + (:y (meters 1)) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 8.0 56.0) + (:vel-y (meters 0.13333334) (meters 0.16666667)) + (:scalevel-x (meters 0.013333334)) + (:rotvel-z (degrees -0.4) (degrees 0.8)) + (:scalevel-y :copy scalevel-x) + (:fade-g -1.4222223) + (:fade-a -0.35555556) + (:accel-y (meters 0.00008333333)) + (:friction 0.7) + (:timer (seconds 0.6)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 1064) + (:conerot-x (degrees 90)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 1063 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 32.0) + (:y (meters 1)) + (:scale-x (meters 1) (meters 0.5)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 64.0 8.0) + (:vel-y (meters 0.3)) + (:scalevel-x (meters 0.0033333334)) + (:scalevel-y :copy scalevel-x) + (:fade-g -2.8444445) + (:fade-a -0.82222223) + (:friction 0.7) + (:timer (seconds 0.3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.15)) + (:next-launcher 1064) + (:conerot-x (degrees 90)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/flut/flut_REF.gc b/test/decompiler/reference/jak3/engine/target/flut/flut_REF.gc new file mode 100644 index 0000000000..01d62053c6 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/flut/flut_REF.gc @@ -0,0 +1,644 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *flut-shadow-control*, type shadow-control +(define *flut-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #xa)) + :shadow-dir (new 'static 'vector :y -1.0 :w 614400.0) + :bot-plane (new 'static 'plane :y 1.0 :w 81920.0) + :top-plane (new 'static 'plane :y 1.0 :w -2867.2) + ) + ) + ) + +;; definition for symbol *flut-color-table*, type (array rgbaf) +(define *flut-color-table* (the-as (array rgbaf) (new 'static 'boxed-array :type vector + (new 'static 'vector :x 1.0 :y 1.0 :z 0.8 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.7 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.6 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.5 :w 1.0) + (new 'static 'vector :x 1.0 :y 1.0 :z 0.4 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.9 :z 0.5 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.8 :z 0.6 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.8 :z 0.5 :w 1.0) + (new 'static 'vector :x 1.0 :y 0.8 :z 0.4 :w 1.0) + (new 'static 'vector :x 0.9 :y 0.9 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.8 :y 0.9 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.8 :y 1.0 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.8 :y 1.0 :z 0.8 :w 1.0) + ) + ) + ) + +;; definition for method 34 of type flut +;; WARN: Return type mismatch int vs none. +(defmethod spawn-part-and-sound! ((this flut)) + (if (nonzero? (-> this part)) + (spawn (-> this part) (-> this root trans)) + ) + (if (nonzero? (-> this sound)) + (update! (-> this sound)) + ) + 0 + (none) + ) + +;; definition for method 10 of type flut +(defmethod deactivate ((this flut)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (when (-> this count-lock) + (set! (-> this count-lock) #f) + (+! (-> *game-info* flut-count) -1) + ) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +;; definition for function flut-color-from-index +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior flut-color-from-index flut ((arg0 int)) + (set! (-> self draw color-mult quad) (-> *flut-color-table* (mod arg0 (-> *flut-color-table* length)) quad)) + 0 + (none) + ) + +;; definition for function flut-random-color-index +(defun flut-random-color-index () + (rand-vu-int-range 0 (-> *flut-color-table* length)) + ) + +;; definition for method 33 of type flut +(defmethod flut-method-33 ((this flut)) + (let ((gp-0 (the-as (array collide-shape) (new 'stack 'boxed-array collide-shape 32)))) + (let ((a1-2 (sphere<-vector+r! (new 'stack-no-clear 'sphere) (-> this root trans) 16384.0))) + (+! (-> a1-2 y) 12288.0) + (set! (-> gp-0 length) + (fill-actor-list-for-box *actor-hash* (the-as bounding-box a1-2) (-> gp-0 data) (-> gp-0 allocated-length)) + ) + ) + (let* ((s5-1 (-> gp-0 length)) + (s4-0 0) + (v1-7 (-> gp-0 s4-0)) + ) + (while (< s4-0 s5-1) + (if (type? (-> v1-7 process) flut) + (return #f) + ) + (+! s4-0 1) + (set! v1-7 (-> gp-0 s4-0)) + ) + ) + ) + #t + ) + +;; failed to figure out what this is: +(defstate wait-for-start (flut) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('bonk) + (send-event proc 'target-flut-get-off 90) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + #f + ) + (('attack) + (cond + ((and (-> self next-state) (= (-> self next-state name) 'wait-for-start)) + #f + ) + ((= (-> self mode) 'normal) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + (go-virtual die) + ) + (else + (send-event proc 'target-flut-get-off 90) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + ) + ) + ) + (('touch) + (send-event proc 'target-flut-get-off 90) + (send-shoves (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0) + #f + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-2 (the-as object (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-2)) + v0-2 + ) + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ) + :exit (behavior () + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + (set-vector! (-> self root root-prim local-sphere) 0.0 5734.4 0.0 7372.8) + ) + :code (behavior () + (ja-channel-set! 0) + (while (or (>= (-> *game-info* flut-count) 10) + (and (sphere-in-view-frustum? (sphere<-vector+r! (new 'stack 'sphere) (-> self root trans) 8192.0)) + (and (< (vector-vector-distance (-> self root trans) (camera-pos)) 409600.0) + *target* + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (flut-method-33 self)) + ) + (suspend) + ) + (go-virtual idle) + ) + ) + +;; failed to figure out what this is: +(defstate idle (flut) + :virtual #t + :event (-> (method-of-type flut wait-for-start) event) + :enter (behavior () + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (let ((s5-0 (find-nearest-nav-mesh (-> self root trans) 8192.0))) + (when s5-0 + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! gp-0 (-> self root quat)) + (vector-normalize! gp-0 5120.0) + (vector+! gp-0 gp-0 (-> self root trans)) + (set! (-> self nav-sphere-handle) + (ppointer->handle + (process-spawn simple-nav-sphere #x46266666 gp-0 s5-0 -1 :name "simple-nav-sphere" :to self) + ) + ) + ) + ) + ) + ) + :exit (behavior () + (send-event (handle->process (-> self nav-sphere-handle)) 'die-fast) + ((-> (method-of-type flut wait-for-start) exit)) + ) + :code (behavior () + (when (not (-> self count-lock)) + (set! (-> self count-lock) #t) + (+! (-> *game-info* flut-count) 1) + ) + (if (not (-> self minimap)) + (set! (-> self minimap) (add-icon! *minimap* self (the-as uint 11) (the-as int #f) (the-as vector #t) 0)) + ) + (change-parent self *entity-pool*) + (ja-channel-set! 1) + (ja :group! (-> self draw art-group data 3)) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + 0.0 + (let ((f30-0 20480.0)) + (until #f + (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) + (time-elapsed? (-> self probe-time) (seconds 1)) + ) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + (set-time! (-> self probe-time)) + ) + (when (and (and *target* (and (>= f30-0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (focus-test? *target* grabbed in-head pole flut light board dark)) + (can-display-query? self "flut" -99.0) + (-> *setting-control* user-current pilot) + (-> *target* current-level) + ) + (let ((gp-0 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-43 gp-0)) + (set! (-> v1-43 width) (the float 340)) + ) + (let ((v1-44 gp-0)) + (set! (-> v1-44 height) (the float 80)) + ) + (let ((v1-45 gp-0) + (a0-21 (-> *setting-control* user-default language)) + ) + (set! (-> v1-45 scale) (if (or (= a0-21 (language-enum korean)) (= a0-21 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id text-0083) #f) + gp-0 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (if (and (cpad-pressed? 0 triangle) + (send-event *target* 'change-mode 'flut self (-> self mode) (-> self color-index)) + ) + (go-virtual pickup (method-of-object self wait-for-return)) + ) + ) + (if *target* + (look-at! + (-> *target* neck) + (vector+! + (new 'stack-no-clear 'vector) + (the-as vector (-> self root root-prim prim-core)) + (new 'static 'vector :y 2048.0 :w 1.0) + ) + 'nothing-special + self + ) + ) + (spawn-part-and-sound! self) + (suspend) + (ja :num! (loop!)) + ) + ) + #f + ) + :post ja-post + ) + +;; failed to figure out what this is: +(defstate pickup (flut) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('draw) + (ja-channel-set! 1) + (ja :group! (-> self draw art-group data 3)) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + (transform-post) + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('touch 'attack 'bonk) + #f + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as object (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ) + :enter (behavior ((arg0 (state flut))) + (talker-spawn-func (-> *talker-speech* 86) *entity-pool* (target-pos 0) (the-as region #f)) + (let ((t9-2 (-> arg0 enter))) + (if t9-2 + (t9-2) + ) + ) + ) + :code (behavior ((arg0 (state flut))) + (when (-> self count-lock) + (set! (-> self count-lock) #f) + (+! (-> *game-info* flut-count) -1) + ) + (when (-> self minimap) + (logior! (-> self minimap flags) (minimap-flag fade-out)) + (set! (-> self minimap) #f) + ) + (ja-channel-set! 0) + (ja-post) + (when (not (and (-> self entity) (= (-> self entity extra process) self))) + (let ((s5-0 (current-time))) + (until (time-elapsed? s5-0 (seconds 0.1)) + (spawn-part-and-sound! self) + (suspend) + ) + ) + (deactivate self) + ) + (while (zero? (ja-group-size)) + (if (or (not *target*) (or (< 24576.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + (go arg0) + ) + (spawn-part-and-sound! self) + (suspend) + ) + (while (and *target* (focus-test? *target* flut)) + (spawn-part-and-sound! self) + (suspend) + ) + (let ((s5-1 (current-time))) + (until (time-elapsed? s5-1 (seconds 1)) + (spawn-part-and-sound! self) + (suspend) + ) + ) + (go arg0) + ) + ) + +;; failed to figure out what this is: +(defstate wait-for-return (flut) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as structure (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + (the-as structure #f) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-set! 0) + (ja-post) + (when (type? (-> self root) collide-shape) + (let ((v1-2 (-> self root root-prim))) + (set! (-> v1-2 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 prim-core collide-with) (collide-spec)) + ) + 0 + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (transform-post) + (sleep-code) + ) + ) + +;; failed to figure out what this is: +(defstate die (flut) + :virtual #t + :enter (-> (method-of-type flut idle) enter) + :exit (-> (method-of-type flut idle) exit) + :code (behavior () + (change-parent self *entity-pool*) + (when (-> self count-lock) + (set! (-> self count-lock) #f) + (+! (-> *game-info* flut-count) -1) + ) + (when (-> self minimap) + (logior! (-> self minimap flags) (minimap-flag fade-out)) + (set! (-> self minimap) #f) + ) + (if (-> self skel effect) + (logior! (-> self skel effect flags) (effect-control-flag ecf1)) + ) + (when (logtest? (-> self flags) (flut-flag ff3)) + (set! (-> self root dynam gravity-max) 40960.0) + (set! (-> self root dynam gravity-length) 20480.0) + (vector-float*! + (-> self root dynam gravity) + (-> self root dynam gravity-normal) + (the-as float (-> self root dynam gravity-length)) + ) + ) + (cond + ((logtest? (-> self flags) (flut-flag ff1)) + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + ) + (else + (set-vector! (-> self root root-prim local-sphere) 0.0 1638.4 0.0 1638.4) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (logior! + (-> self root root-prim prim-core collide-with) + (collide-spec backgnd crate obstacle hit-by-others-list pusher) + ) + (set! (-> self root penetrated-by) (penetrate)) + 0 + ) + ) + (ja-channel-set! 1) + (cond + ((logtest? (-> self flags) (flut-flag ff3)) + (ja-no-eval :group! (-> self draw art-group data 29) + :num! (seek! (ja-aframe 65.0 0)) + :frame-num (ja-aframe 60.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 65.0 0))) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (ja-aframe 38.0 0)) + :frame-num (ja-aframe 25.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 38.0 0))) + ) + ) + ) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (while (nonzero? (-> self draw death-timer)) + (suspend) + ) + (ja-channel-set! 0) + (ja-post) + (if (and (-> self entity) (= (-> self entity extra process) self)) + (go-virtual wait-for-start) + ) + ) + :post (behavior () + (vector-v++! (-> self root transv) (compute-acc-due-to-gravity (-> self root) (new-stack-vector0) 0.0)) + (if (< (-> self root dynam gravity-max) (vector-length (-> self root transv))) + (vector-normalize! (-> self root transv) (-> self root dynam gravity-max)) + ) + (let ((v1-12 (-> self root)) + (a2-1 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> a2-1 collide-with) (collide-spec backgnd crate obstacle pusher)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> v1-12 pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-12 (-> v1-12 transv) a2-1 (meters 0)) + ) + (transform-post) + ) + ) + +;; definition for function flut-init +;; INFO: Used lq/sq +(defbehavior flut-init flut ((arg0 entity-actor) (arg1 transformq) (arg2 handle) (arg3 flut-flag) (arg4 symbol)) + (let ((s1-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s1-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s1-0 reaction) cshape-reaction-default) + (set! (-> s1-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s1-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle obstacle-for-jak)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> v1-6 transform-index) 0) + (set-vector! (-> v1-6 local-sphere) 0.0 5734.4 0.0 7372.8) + (set! (-> s1-0 total-prims) (the-as uint 1)) + (set! (-> s1-0 root-prim) v1-6) + ) + (set! (-> s1-0 nav-radius) (* 0.75 (-> s1-0 root-prim local-sphere w))) + (let ((v1-9 (-> s1-0 root-prim))) + (set! (-> s1-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s1-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> self root) s1-0) + ) + (set! (-> self count-lock) #f) + (set! (-> self rider) arg2) + (set! (-> self flags) arg3) + (set! (-> self mode) arg4) + (set! (-> self minimap) #f) + (when arg0 + (process-entity-set! self arg0) + (if (logtest? (-> self entity extra kill-mask) (task-mask ctywide)) + (ctywide-entity-hack) + ) + (process-drawable-from-entity! self arg0) + (set-yaw-angle-clear-roll-pitch! (-> self root) (res-lump-float arg0 'rotoffset)) + ) + (when arg1 + (set! (-> self root trans quad) (-> arg1 trans quad)) + (quaternion-copy! (-> self root quat) (-> arg1 quat)) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self draw shadow-ctrl) *flut-shadow-control*) + (let ((v1-33 (-> self node-list data))) + (set! (-> v1-33 0 param0) (the-as (function cspace transformq none) cspace<-transformq+trans!)) + (set! (-> v1-33 0 param1) (the-as basic (-> self root trans))) + (set! (-> v1-33 0 param2) (the-as basic (-> self extra-trans))) + ) + (set! (-> self condition) (res-lump-value arg0 'index int :time -1000000000.0)) + (set! (-> self fact) + (new 'process 'fact-info self (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (if (not (logtest? arg3 (flut-flag ff0))) + (setup-masks (-> self draw) 0 2) + ) + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (set! (-> self color-index) (mod (the-as int (sar (the-as int arg3) 32)) (-> *flut-color-table* length))) + (flut-color-from-index (-> self color-index)) + (when (logtest? (-> self flags) (flut-flag ff1)) + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + ) + (if (and (-> self entity) (not (logtest? arg3 (flut-flag ff2)))) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :group 1 :fo-max 30) (-> self root trans) 0.0) + ) + (set! (-> self draw light-index) (the-as uint 30)) + (logior! (-> self mask) (process-mask crate)) + (cond + ((logtest? arg3 (flut-flag ff2)) + (go-virtual die) + ) + ((handle->process arg2) + (go-virtual idle) + ) + (else + (go-virtual wait-for-start) + ) + ) + ) + +;; definition for method 11 of type flut +(defmethod init-from-entity! ((this flut) (arg0 entity-actor)) + (flut-init + arg0 + (the-as transformq #f) + (the-as handle #f) + (the-as flut-flag (+ (shl (flut-random-color-index) 32) 1)) + 'normal + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc b/test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc new file mode 100644 index 0000000000..4b1c1a0bee --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/flut/target-flut_REF.gc @@ -0,0 +1,3414 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type flut-bank +(deftype flut-bank (basic) + ((jump-height-min meters) + (jump-height-max meters) + (double-jump-height-min meters) + (double-jump-height-max meters) + (air-attack-speed meters) + (ground-timeout uint64) + ) + ) + +;; definition for method 3 of type flut-bank +(defmethod inspect ((this flut-bank)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tjump-height-min: (meters ~m)~%" (-> this jump-height-min)) + (format #t "~1Tjump-height-max: (meters ~m)~%" (-> this jump-height-max)) + (format #t "~1Tdouble-jump-height-min: (meters ~m)~%" (-> this double-jump-height-min)) + (format #t "~1Tdouble-jump-height-max: (meters ~m)~%" (-> this double-jump-height-max)) + (format #t "~1Tair-attack-speed: (meters ~m)~%" (-> this air-attack-speed)) + (format #t "~1Tground-timeout: ~D~%" (-> this ground-timeout)) + (label cfg-4) + this + ) + +;; definition for symbol *FLUT-bank*, type flut-bank +(define *FLUT-bank* (new 'static 'flut-bank + :jump-height-min (meters 5) + :jump-height-max (meters 7) + :double-jump-height-min (meters 1) + :double-jump-height-max (meters 2) + :air-attack-speed (meters 20) + :ground-timeout #x96 + ) + ) + +;; definition for symbol *flut-walk-mods*, type surface +(define *flut-walk-mods* (new 'static 'surface + :name 'run + :turnv 54613.332 + :turnvf 30.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 102400.0 + :target-speed 102400.0 + :seek0 1.5 + :seek90 3.0 + :seek180 2.0 + :fric 1.0 + :nonlin-fric-dist 0.1 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around gun-off) + ) + ) + +;; definition for symbol *flut-run-racer-mods*, type surface +(define *flut-run-racer-mods* (new 'static 'surface + :name 'run + :turnv 54613.332 + :turnvf 30.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 1.5 + :seek90 3.0 + :seek180 2.0 + :fric 1.0 + :nonlin-fric-dist 0.1 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around gun-off) + ) + ) + +;; definition for symbol *flut-run-wild-mods*, type surface +(define *flut-run-wild-mods* (new 'static 'surface + :name 'run + :turnv 54613.332 + :turnvf 30.0 + :turnvv 32768.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 204800.0 + :target-speed 204800.0 + :seek0 1.5 + :seek90 3.0 + :seek180 1.0 + :nonlin-fric-dist 0.1 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around gun-off) + ) + ) + +;; definition for symbol *flut-jump-wild-mods*, type surface +(define *flut-jump-wild-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 30.0 + :turnvv 16384.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 204800.0 + :target-speed 204800.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +;; definition for symbol *flut-jump-mods*, type surface +(define *flut-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 102400.0 + :target-speed 102400.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +;; definition for symbol *flut-jump-racer-mods*, type surface +(define *flut-jump-racer-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +;; definition for symbol *flut-double-jump-mods*, type surface +(define *flut-double-jump-mods* (new 'static 'surface + :name 'jump-double + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 102400.0 + :target-speed 102400.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.1 + :nonlin-fric-dist 10.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +;; definition for symbol *flut-double-jump-racer-mods*, type surface +(define *flut-double-jump-racer-mods* (new 'static 'surface + :name 'jump-double + :turnv 131072.0 + :turnvf 30.0 + :turnvv 54613.332 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 0.9 + :seek90 1.5 + :seek180 1.5 + :fric 0.1 + :nonlin-fric-dist 10.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air gun-off) + ) + ) + +;; definition for symbol *flut-run-attack-mods*, type surface +(define *flut-run-attack-mods* (new 'static 'surface + :name 'wheel-flip + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 143360.0 + :seek90 0.5 + :seek180 0.15 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flag no-turn-around turn-to-pad attack gun-off) + ) + ) + +;; definition for symbol *flut-air-attack-mods*, type surface +(define *flut-air-attack-mods* (new 'static 'surface + :name 'flop + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 122880.0 + :target-speed 122880.0 + :seek0 1.0 + :seek90 0.3 + :seek180 1.5 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flag air attack gun-off) + ) + ) + +;; definition for function flut-leg-ik-callback +;; INFO: Used lq/sq +(defun flut-leg-ik-callback ((arg0 joint-mod-ik) (arg1 object) (arg2 object) (arg3 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> arg3 quad)) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.0) + ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) + ) + (+! (-> arg0 user-position y) f0-1) + ) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-12 s5-0)) + (let ((a0-4 *up-vector*)) + (let ((a1-4 8192.0)) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> a0-4 quad)) + ) + (.lvf vf4 (&-> v1-12 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 (&-> s3-0 quad) vf6) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) + (a0-7 s2-0) + ) + (let ((v1-15 *up-vector*)) + (let ((a1-7 f0-11)) + (.mov vf7 a1-7) + ) + (.lvf vf5 (&-> v1-15 quad)) + ) + (.lvf vf4 (&-> s3-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 (&-> a0-7 quad) vf6) + ) + (let ((a0-8 s2-0)) + (let ((v1-16 *up-vector*)) + (let ((a1-8 (- f28-0))) + (.mov vf7 a1-8) + ) + (.lvf vf5 (&-> v1-16 quad)) + ) + (.lvf vf4 (&-> arg3 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 (&-> a0-8 quad) vf6) + ) + (let ((a1-9 s5-0)) + (let ((v1-17 s5-0)) + (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) + (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) + (.mov vf7 a2-6) + ) + (.lvf vf5 (&-> a0-10 quad)) + ) + (.lvf vf4 (&-> v1-17 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 (&-> a1-9 quad) vf6) + ) + ) + ) + (set-ik-target! arg0 s5-0) + ) + (none) + ) + ) + +;; definition for function flut-update-ik +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs object. +(defbehavior flut-update-ik target () + (local-vars (sv-720 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (the-as vector a1-0) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) + (let ((a1-6 (not (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> *target* target-flags))))) + (enable-set! s3-0 a1-6) + ) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-17 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-8 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-8) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (let ((a1-8 s0-0)) + (let ((a0-11 (-> v1-17 trans))) + (let ((v1-18 (-> v1-17 uvec))) + (let ((a2-8 (-> s3-0 hand-dist))) + (.mov vf7 a2-8) + ) + (.lvf vf5 (&-> v1-18 quad)) + ) + (.lvf vf4 (&-> a0-11 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 (&-> a1-8 quad) vf6) + ) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) + ) + ) + (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) + ) + (let ((a1-11 (-> gp-0 start-pos))) + (let ((v1-22 s0-0)) + (let ((a0-14 sv-720)) + (let ((a2-12 6144.0)) + (.mov vf7 a2-12) + ) + (.lvf vf5 (&-> a0-14 quad)) + ) + (.lvf vf4 (&-> v1-22 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 (&-> a1-11 quad) vf6) + ) + (let ((v1-23 (-> gp-0 move-dist)) + (f0-16 -20480.0) + ) + (vector-float*! v1-23 sv-720 f0-16) + ) + (let ((v1-25 gp-0)) + (set! (-> v1-25 radius) 4.096) + (set! (-> v1-25 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-25 ignore-process0) #f) + (set! (-> v1-25 ignore-process1) #f) + (set! (-> v1-25 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-25 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (set! (-> s1-0 quad) (-> gp-0 best-other-tri normal quad)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-16 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-16 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-14) + ) + ) + (let ((a1-18 s2-0)) + (let ((v1-32 (-> gp-0 start-pos))) + (let ((a0-29 (-> gp-0 move-dist))) + (let ((a2-15 f30-0)) + (.mov vf7 a2-15) + ) + (.lvf vf5 (&-> a0-29 quad)) + ) + (.lvf vf4 (&-> v1-32 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 (&-> a1-18 quad) vf6) + ) + (set! (-> s3-0 user-position quad) (-> s2-0 quad)) + (set! (-> s3-0 user-normal quad) (-> s1-0 quad)) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (set! (-> s3-0 user-position quad) (-> s0-0 quad)) + (set! (-> s3-0 user-normal quad) (-> *y-vector* quad)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + ) + ) + +;; definition for function target-flut-get-off? +(defbehavior target-flut-get-off? target () + (and (not (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + ) + (and (time-elapsed? (-> self control rider-time) (seconds 1)) (-> *setting-control* user-current pilot-exit)) + ) + ) + +;; definition for function target-flut-post-post +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-flut-post-post target () + (vector+! (-> self flut flut-trans) (-> self control trans) (-> self control cspace-offset)) + (quaternion-copy! (the-as quaternion (-> self flut flut-quat)) (-> self control quat)) + (set! (-> self flut flut-scale quad) (-> self control scale quad)) + (let ((v1-8 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *flut-shadow-control* settings shadow-dir quad) v1-8) + ) + 0 + (none) + ) + +;; definition for function target-flut-wild-post +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-flut-wild-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self control remaining-ctrl-iterations) gp-1) + (flag-setup) + (if (< (-> self control force-turn-to-strength) 0.0) + (set! (-> self control force-turn-to-strength) (- 1.0 (-> self control cpad stick0-speed))) + ) + (build-conversions (-> self control transv)) + (do-rotations1) + (let ((s5-0 (new-stack-vector0))) + (read-pad s5-0) + (let ((f28-0 + (debounce-speed + (-> self control pad-magnitude) + (-> self control last-pad-magnitude) + (-> self control pad-xz-dir) + (-> self control last-pad-xz-dir) + ) + ) + ) + (when (!= (-> self control force-turn-to-strength) 0.0) + (let ((f0-12 (fmin 1.0 (-> self control force-turn-to-strength)))) + (set! (-> self control force-turn-to-strength) f0-12) + (let ((a1-3 (vector-float*! + (new 'stack-no-clear 'vector) + (if (= f28-0 0.0) + *zero-vector* + s5-0 + ) + f28-0 + ) + ) + (a2-2 + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control force-turn-to-direction) + (-> self control force-turn-to-speed) + ) + ) + ) + (vector-lerp! s5-0 a1-3 a2-2 f0-12) + ) + ) + (set! f28-0 (vector-length s5-0)) + (vector-normalize! s5-0 1.0) + ) + (turn-to-vector s5-0 f28-0) + ) + ) + (set-vector! + (-> self control transv-ctrl) + 0.0 + (-> self control transv-ctrl y) + (-> self control current-surface target-speed) + 1.0 + ) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (pre-collide-setup) + (let ((a2-3 (new 'stack-no-clear 'collide-query))) + (let ((v1-33 (-> self control))) + (set! (-> a2-3 collide-with) (-> v1-33 root-prim prim-core collide-with)) + (set! (-> a2-3 ignore-process0) self) + (set! (-> a2-3 ignore-process1) #f) + (set! (-> a2-3 ignore-pat) (-> v1-33 pat-ignore-mask)) + ) + (set! (-> a2-3 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-3 (meters 1)) + ) + (bend-gravity) + (post-flag-setup) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (ja-post) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (target-flut-post-post) + 0 + (none) + ) + +;; definition for function target-flut-post +;; WARN: Return type mismatch int vs none. +(defbehavior target-flut-post target () + (cond + ((and (= (-> self flut mode) 'wild) (not (logtest? (-> self focus-status) (focus-status dead hit)))) + (target-flut-wild-post) + ) + (else + (target-post) + (target-flut-post-post) + ) + ) + 0 + (none) + ) + +;; definition for function target-flut-falling-anim-trans +;; WARN: Return type mismatch int vs object. +(defbehavior target-flut-falling-anim-trans target () + (cond + ((not (-> self flut as-daxter?)) + (let ((v1-4 (ja-group))) + (b! + (and v1-4 (or (= v1-4 jakb-flut-jump-loop-ja) (= v1-4 jakb-flut-jump-land-ja))) + cfg-10 + :delay (empty-form) + ) + ) + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! jakb-flut-jump-loop-ja) + (b! #t cfg-35 :delay (nop!)) + (label cfg-10) + (cond + ((and (logtest? (-> self control status) (collide-status on-surface)) + (let ((v1-17 (ja-group))) + (not (and v1-17 (= v1-17 jakb-flut-jump-land-ja))) + ) + ) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! jakb-flut-jump-land-ja) + ) + ((let ((v1-26 (ja-group))) + (and v1-26 (= v1-26 jakb-flut-jump-loop-ja)) + ) + (ja :num! (loop!)) + ) + ((let ((v1-35 (ja-group))) + (and v1-35 (= v1-35 jakb-flut-jump-land-ja)) + ) + (ja :num! (seek!)) + ) + ) + (label cfg-35) + ) + (else + (let ((v1-47 (ja-group))) + (cond + ((not (and v1-47 (= v1-47 jakb-mech-death-a-ja))) + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! jakb-mech-death-a-ja) + ) + ((let ((v1-56 (ja-group))) + (and v1-56 (= v1-56 jakb-mech-death-a-ja)) + ) + (ja :num! (loop!)) + ) + ) + ) + ) + ) + 0 + ) + +;; definition for function target-flut-hit-ground-anim +;; WARN: Return type mismatch symbol vs object. +(defbehavior target-flut-hit-ground-anim target () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 jakb-flut-jump-loop-ja)) + (if (!= (-> self skel root-channel 0) (-> self skel channel)) + (ja-channel-push! 2 (seconds 0.05)) + (ja-channel-set! 2) + ) + (ja :group! jakb-flut-jump-land-ja :num! min) + (ja :chan 1 :group! jakb-flut-jump-forward-land-ja :num! min) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + (ja :chan 1 :num! (chan 0)) + ) + #f + ) + ((let ((v1-33 (ja-group))) + (and v1-33 (or (= v1-33 jakb-flut-jump-ja) (= v1-33 jakb-flut-jump-land-ja))) + ) + #f + ) + ((let ((v1-39 (ja-group))) + (and v1-39 (= v1-39 jakb-flut-double-jump-ja)) + ) + (ja-channel-set! 1) + (ja-no-eval :group! jakb-flut-jump-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + #f + ) + ((let ((v1-68 (ja-group))) + (and v1-68 (or (= v1-68 jakb-flut-air-attack-ja) (= v1-68 jakb-flut-air-attack-loop-ja))) + ) + (ja-channel-set! 1) + (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + #f + ) + ) + ) + ) + +;; definition for function target-flut-standard-event-handler +(defbehavior target-flut-standard-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'flut + ) + (else + (case arg2 + (('event-step) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.07)) + ) + (('end-mode) + (case (-> arg3 param 0) + (('flut) + (-> self flut mode) + (go target-flut-get-off (process->handle arg0)) + ) + ) + ) + (('touched) + (cond + ((= (-> self flut mode) 'racer) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (-> arg3 param 0)) + (set! (-> a1-2 param 1) + (the-as + uint + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> self flut attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'flut) + (penetrate-using (-> self control penetrate-using)) + ) + ) + ) + ) + (let ((s5-0 (send-event-function arg0 a1-2))) + (when s5-0 + (play-effect-sound + (-> self skel effect) + (the-as symbol "sound") + -1.0 + 28 + (the-as basic #f) + (static-sound-name "flut-punch-hit") + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + (let* ((v1-24 (-> self game)) + (a0-27 (+ (-> v1-24 attack-id) 1)) + ) + (set! (-> v1-24 attack-id) a0-27) + (set! (-> self flut attack-id) a0-27) + ) + ) + s5-0 + ) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-flut-hit + ) + ) + (('shove) + (when (not (and (-> self next-state) (= (-> self next-state name) 'target-hit))) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 168) + (when (not (logtest? (-> self attack-info-rec mask) (attack-mask attacker))) + (set! (-> self attack-info-rec attacker) (process->handle arg0)) + (logior! (-> self attack-info-rec mask) (attack-mask attacker)) + ) + (go target-flut-hit 'shove (-> self attack-info-rec)) + ) + ) + (('falling) + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-flut-death))) + (go target-flut-falling #f) + ) + ) + (('swim) + (send-event + self + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'drown)) + ) + ) + ) + (('change-mode) + (case (-> arg3 param 0) + (('grab) + (when (not (focus-test? self dead)) + (if (not (-> arg3 param 1)) + #t + (go target-flut-grab) + ) + ) + ) + (('kanga) + (go target-flut-kanga-catch (process->handle arg0) 'kanga) + ) + (('normal) + (go target-flut-get-off (process->handle arg0)) + ) + ) + ) + (('eject) + (go target-flut-eject #f) + ) + (('clone-anim) + (go target-flut-clone-anim (process->handle (the-as process (-> arg3 param 0)))) + ) + (('mode-time) + (- (current-time) (-> self flut flut-start-time)) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + +;; definition for function target-flut-dangerous-event-handler +(defbehavior target-flut-dangerous-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (if ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 1920) + ) + (target-send-attack + arg0 + (-> self control danger-mode) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + (target-flut-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-flut-hit + ) + ) + (else + (target-flut-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + +;; definition for function target-fldax-enter +(defbehavior target-fldax-enter target () + (ja-channel-set! 0) + (set! (-> self flut art-group-backup) (-> self draw art-group)) + (set! (-> self draw art-group) (-> self sidekick 0 draw art-group)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds2)) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'indax) + ) + +;; definition for function target-fldax-exit +(defbehavior target-fldax-exit target () + (ja-channel-set! 0) + (set! (-> self draw art-group) (-> self flut art-group-backup)) + (logclear! (-> self draw status) (draw-control-status no-draw-bounds2)) + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ) + +;; failed to figure out what this is: +(defstate target-flut-start (target) + :event target-flut-standard-event-handler + :exit (behavior () + (when (not (and (-> self next-state) + (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-flut-stance) + (= v1-3 'target-flut-walk) + (= v1-3 'target-flut-run-wild) + (= v1-3 'target-flut-jump) + (= v1-3 'target-flut-double-jump) + (= v1-3 'target-flut-hit-ground) + (= v1-3 'target-flut-falling) + (= v1-3 'target-flut-running-attack) + (= v1-3 'target-flut-air-attack) + (= v1-3 'target-flut-air-attack-hit-ground) + (= v1-3 'target-flut-hit) + (= v1-3 'target-flut-death) + (= v1-3 'target-flut-get-on) + (= v1-3 'target-flut-get-off) + (= v1-3 'target-flut-get-off-jump) + (= v1-3 'target-flut-eject) + (= v1-3 'target-flut-grab) + (= v1-3 'target-flut-clone-anim) + (= v1-3 'target-flut-kanga-catch) + ) + ) + ) + ) + (+! (-> *game-info* flut-count) -1) + (let ((v1-7 (-> self manipy))) + (when v1-7 + (deactivate (-> v1-7 0)) + (set! (-> self manipy) (the-as (pointer manipy) #f)) + ) + ) + (if (-> self flut as-daxter?) + (target-fldax-exit) + ) + (logclear! (-> self focus-status) (focus-status flut)) + (set! (-> self control mod-surface) *walk-mods*) + (logclear! (-> self target-flags) (target-flags tf6)) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (set! (-> self control cspace-offset quad) (the-as uint128 0)) + (remove-setting! 'sound-flava) + (setting-control-method-14 *setting-control* (-> self flut mode-sound-bank)) + (set! (-> self flut mode-sound-bank) #f) + (set! (-> self control pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :board #x1) + ) + (remove-setting! 'string-spline-accel) + (remove-setting! 'string-spline-max-move) + (remove-setting! 'string-spline-accel-player) + (remove-setting! 'string-spline-max-move-player) + (remove-setting! 'fov) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-height) + (remove-setting! 'string-max-height) + (target-exit) + ) + ) + :code (behavior ((arg0 handle) (arg1 symbol) (arg2 int)) + (local-vars + (sv-96 process) + (sv-112 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) + (sv-128 vector) + (sv-144 entity-actor) + ) + (target-exit) + (+! (-> *game-info* flut-count) 1) + (set-setting! 'string-spline-accel 'abs (meters 1) 0) + (set-setting! 'string-spline-max-move 'abs (meters 10) 0) + (set-setting! 'string-spline-accel-player 'abs (meters 1) 0) + (set-setting! 'string-spline-max-move-player 'abs (meters 10) 0) + (case arg1 + (('wild) + (set-setting! 'string-min-length 'abs (meters 5) 0) + (set-setting! 'string-max-length 'abs (meters 5) 0) + (set-setting! 'string-min-height 'abs (meters 3) 0) + (set-setting! 'string-max-height 'abs (meters 3) 0) + (set-setting! 'fov 'abs (degrees 95.0) 0) + ) + ) + (when (zero? (-> self flut)) + (set! (-> self flut) (new 'process 'flut-info)) + (set! (-> self flut mode-sound-bank) #f) + ) + (set! (-> self flut stick-lock) #f) + (set! arg2 (cond + ((>= arg2 0) + (empty) + arg2 + ) + (else + (flut-random-color-index) + ) + ) + ) + (set! (-> self flut color-index) arg2) + (case arg1 + ((#t) + (set! (-> self flut mode) (the-as basic 'normal)) + (set! (-> self flut as-daxter?) #f) + ) + (('racer) + (set! (-> self flut mode) (the-as basic arg1)) + (set! (-> self flut as-daxter?) #f) + ) + (('wild) + (set! (-> self flut mode) (the-as basic arg1)) + (set! (-> self flut as-daxter?) #t) + ) + (else + (set! (-> self flut mode) (the-as basic arg1)) + (set! (-> self flut as-daxter?) #f) + ) + ) + (if (-> self flut as-daxter?) + (target-fldax-enter) + ) + (let* ((v1-34 (-> self game)) + (a0-22 (+ (-> v1-34 attack-id) 1)) + ) + (set! (-> v1-34 attack-id) a0-22) + (set! (-> self flut attack-id) a0-22) + ) + (set! (-> self flut flap-sound-id) (the-as uint (new-sound-id))) + (set! (-> self flut mode-sound-bank) (the-as connection (add-setting! 'mode-sound-bank 'modeflut 0.0 0))) + (set! (-> self flut entity) #f) + (let ((v1-41 (handle->process arg0))) + (if v1-41 + (set! (-> self flut entity) (-> v1-41 entity)) + ) + ) + (when (not (and (-> self flut entity) (logtest? (-> self flut entity extra level info level-flags) (level-flags lf8))) + ) + (dotimes (v1-49 (-> *level* length)) + (let ((a0-40 (-> *level* level v1-49))) + (when (= (-> a0-40 status) 'active) + (when (logtest? (-> a0-40 info level-flags) (level-flags lf8)) + (let ((a0-42 (-> a0-40 entity data 0 entity))) + (when a0-42 + (set! (-> self flut entity) (the-as entity-actor a0-42)) + (goto cfg-36) + ) + ) + ) + ) + ) + ) + ) + (label cfg-36) + (target-collide-set! 'flut 0.0) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control ctrl-xz-vel) 0.0) + (logior! (-> self focus-status) (focus-status flut)) + (set-time! (-> self flut flut-start-time)) + (set! (-> self control pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nomech #x1)) + (let ((s4-1 (current-time))) + (label cfg-37) + (let ((s3-0 (-> self entity)) + (s2-0 (-> self level)) + ) + (process-entity-set! self (-> self flut entity)) + (let ((s1-0 (get-process *8k-dead-pool* manipy #x20000 1))) + (set! (-> self manipy) + (the-as + (pointer manipy) + (when s1-0 + (let ((t9-18 (method-of-type manipy activate))) + (t9-18 (the-as manipy s1-0) self "manipy" (the-as pointer #x70004000)) + ) + (let ((s0-0 run-function-in-process)) + (set! sv-96 s1-0) + (set! sv-112 manipy-init) + (set! sv-128 (-> self control trans)) + (set! sv-144 (-> self entity)) + (let ((t0-10 (art-group-get-by-name *level* "skel-flut" (the-as (pointer level) #f))) + (t1-10 'collide-shape-moving) + (t2-0 0) + ) + ((the-as (function object object object object object object object none) s0-0) + sv-96 + sv-112 + sv-128 + sv-144 + t0-10 + t1-10 + t2-0 + ) + ) + ) + (-> s1-0 ppointer) + ) + ) + ) + ) + (set! (-> self entity) s3-0) + (set! (-> self level) s2-0) + ) + (when (not (or (-> self manipy) (time-elapsed? s4-1 (seconds 3)))) + (suspend) + (goto cfg-37) + ) + ) + (when (-> self manipy) + (send-event + (ppointer->process (-> self manipy)) + 'trans-hook + (lambda :behavior target + () + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (ppointer->process (-> self parent)))) + (set! (-> self control trans quad) (-> (the-as target gp-0) flut flut-trans quad)) + (let ((v1-5 (-> (the-as target gp-0) flut flut-quat quad))) + (set! (-> self control quat quad) v1-5) + ) + (set! (-> self control scale quad) (-> (the-as target gp-0) flut flut-scale quad)) + (set! (-> self control ground-pat material) + (the-as int (-> (the-as target gp-0) control ground-pat material)) + ) + (set! (-> self draw light-index) (-> (the-as target gp-0) draw light-index)) + (let ((t9-0 flut-color-from-index) + (v1-14 (-> self parent)) + ) + (t9-0 (-> (the-as target (if v1-14 + (the-as target (-> v1-14 0 self)) + ) + ) + flut + color-index + ) + ) + ) + (let ((v1-18 (-> self draw color-mult))) + (let ((a0-19 (-> self draw color-mult)) + (a1-1 (-> (the-as target gp-0) draw color-mult)) + ) + (.lvf vf4 (&-> a0-19 quad)) + (.lvf vf5 (&-> a1-1 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> v1-18 quad) vf6) + ) + (let ((v0-1 (-> (the-as target gp-0) draw color-emissive quad))) + (set! (-> self draw color-emissive quad) v0-1) + v0-1 + ) + ) + ) + ) + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'loop) + (send-event (ppointer->process (-> self manipy)) 'art-joint-anim "flut-get-on" 0) + (send-event (ppointer->process (-> self manipy)) 'blend-shape #t) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior target + () + (set! (-> self state-hook) #f) + (let ((v1-1 (-> *target-shadow-control* settings shadow-dir quad))) + (set! (-> *flut-shadow-control* settings shadow-dir quad) v1-1) + ) + (set! (-> self draw shadow-ctrl) *flut-shadow-control*) + (set! (-> self mech-ik 0) (new 'process 'joint-mod-ik self 7 3104.768)) + (set! (-> self mech-ik 1) (new 'process 'joint-mod-ik self 15 3104.768)) + (dotimes (v1-5 2) + (let ((a0-6 (-> self mech-ik v1-5))) + (set! (-> a0-6 elbow-pole-vector-axis) (the-as uint 2)) + (set! (-> a0-6 elbow-rotation-axis) (the-as uint 0)) + (set! (-> a0-6 callback) (the-as (function joint-mod-ik matrix matrix vector object) flut-leg-ik-callback)) + (logior! (-> a0-6 flags) (joint-mod-ik-flags elbow-trans-neg)) + ) + ) + #f + ) + ) + (send-event (ppointer->process (-> self manipy)) 'post-hook (lambda () (flut-update-ik))) + (case (-> self flut mode) + (('wild) + (send-event (ppointer->process (-> self manipy)) 'segment 0 16) + (set! (-> self flut wild-turn-time) (+ (current-time) (rand-vu-int-range (seconds 1) (seconds 2)))) + (set! (-> self flut wild-turn-rate) (rand-vu-float-range -32768.0 32768.0)) + ) + ) + ) + (remove-exit) + (cond + ((or (= arg1 #t) (= arg1 'racer)) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (go target-flut-stance) + ) + (else + (go target-flut-get-on arg0) + ) + ) + ) + :post target-post + ) + +;; failed to figure out what this is: +(defstate target-flut-stance (target) + :event target-flut-standard-event-handler + :enter (behavior () + (set! (-> self control mod-surface) *flut-walk-mods*) + ) + :exit (-> target-flut-start exit) + :trans (behavior () + (if (= (-> self flut mode) 'wild) + (go target-flut-run-wild) + ) + (if (move-legs?) + (go target-flut-walk) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-flut-running-attack) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-flut-get-off?) + ) + (go target-flut-get-off (the-as handle #f)) + ) + ) + :code (behavior () + (let ((gp-0 22)) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 jakb-flut-walk-ja) (= v1-2 jakb-flut-run-squash-ja))) + (set! gp-0 60) + ) + ((let ((v1-9 (ja-group))) + (and v1-9 (= v1-9 jakb-flut-get-on-ja)) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-24 (ja-group))) + (and v1-24 (= v1-24 jakb-flut-smack-surface-ja)) + ) + (ja-no-eval :group! jakb-flut-smack-surface-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-54 (ja-group))) + (and v1-54 (= v1-54 jakb-flut-hit-back-ja)) + ) + (ja-no-eval :group! jakb-flut-hit-back-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-84 (ja-group))) + (and v1-84 (= v1-84 jakb-flut-running-attack-ja)) + ) + (ja-no-eval :group! jakb-flut-running-attack-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + (cond + ((-> self flut as-daxter?) + (let ((v1-116 (ja-group))) + (if (not (and v1-116 (= v1-116 jakb-mech-pull-ja))) + (ja-channel-push! 1 (the-as time-frame gp-0)) + ) + ) + (ja :group! jakb-mech-pull-ja) + ) + (else + (let ((v1-126 (ja-group))) + (if (not (and v1-126 (= v1-126 jakb-flut-idle-ja))) + (ja-channel-push! 1 (the-as time-frame gp-0)) + ) + ) + (ja :group! jakb-flut-idle-ja) + ) + ) + ) + (until #f + (can-play-stance-amibent?) + (suspend) + (ja :num! (loop!)) + ) + #f + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-walk (target) + :event target-flut-standard-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (case (-> self flut mode) + (('racer) + (set! (-> self control mod-surface) *flut-run-racer-mods*) + ) + (else + (set! (-> self control mod-surface) *flut-walk-mods*) + ) + ) + (set! (-> self control unknown-word04) (the-as uint (-> self control mod-surface turnv))) + (set! (-> self control did-move-to-pole-or-max-jump-height) (-> self control mod-surface target-speed)) + ) + :exit (behavior () + (set! (-> self control mod-surface turnv) (the-as float (-> self control unknown-word04))) + (set! (-> self control mod-surface target-speed) (-> self control did-move-to-pole-or-max-jump-height)) + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + (let ((v1-9 (-> self skel effect))) + (set! (-> v1-9 channel-offset) 0) + ) + 0 + ((-> target-flut-start exit)) + ) + :trans (behavior () + (if (= (-> self flut mode) 'wild) + (go target-flut-run-wild) + ) + (if (not (move-legs?)) + (go target-flut-stance) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-flut-running-attack) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + (let ((f30-0 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control)))))) + (set! (-> self control mod-surface turnv) (lerp-scale + (the-as float (-> self control unknown-word04)) + (* 4.0 (the-as float (-> self control unknown-word04))) + f30-0 + 8192.0 + 21845.334 + ) + ) + (if (and (= (-> self control surf name) '*tar-surface*) (< 8192.0 f30-0)) + (seek! (-> self control mod-surface target-speed) 4096.0 (* 245760.0 (seconds-per-frame))) + (seek! + (-> self control mod-surface target-speed) + (-> self control did-move-to-pole-or-max-jump-height) + (* 81920.0 (seconds-per-frame)) + ) + ) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-flut-get-off?) + ) + (go target-flut-get-off (the-as handle #f)) + ) + ) + :code (behavior () + (let ((f26-0 0.0) + (f30-0 0.0) + (f28-0 0.0) + ) + (let ((gp-0 22)) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 jakb-flut-idle-ja)) + (set! gp-0 60) + ) + ((let ((v1-9 (ja-group))) + (and v1-9 + (or (= v1-9 jakb-flut-jump-ja) + (= v1-9 jakb-flut-jump-loop-ja) + (= v1-9 jakb-flut-air-attack-ja) + (= v1-9 jakb-flut-air-attack-land-ja) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.08)) + (ja-no-eval :group! jakb-flut-run-squash-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + (let ((v1-39 (ja-group))) + (set! f28-0 + (cond + ((and v1-39 (= v1-39 jakb-flut-run-squash-ja)) + (ja-channel-set! 3) + (set! f30-0 1.0) + 1.0 + ) + (else + (let ((v1-47 (ja-group))) + (cond + ((and v1-47 (= v1-47 jakb-flut-walk-ja)) + (set! f26-0 (ja-frame-num 0)) + (set! f30-0 (-> self skel root-channel 1 frame-interp (-> self skel active-frame-interp))) + (-> self skel root-channel 2 frame-interp (-> self skel active-frame-interp)) + ) + (else + (ja-channel-push! 3 (the-as time-frame gp-0)) + f28-0 + ) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! jakb-flut-walk-ja :num! (loop!) :dist 20480.0 :frame-num f26-0) + (ja-no-eval :chan 1 + :group! jakb-flut-jog-ja + :num! (identity f26-0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :dist 47104.0 + ) + (ja-no-eval :chan 2 + :group! jakb-flut-run-ja + :num! (identity f26-0) + :frame-interp0 f28-0 + :frame-interp1 f28-0 + :dist 53248.0 + ) + (until #f + (suspend) + (let ((f24-0 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 36864.0 40960.0)) + (f26-1 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 49152.0 77824.0)) + ) + (set! f30-0 (seek f30-0 f24-0 (* 4.0 (seconds-per-frame)))) + (set! f28-0 (seek f28-0 f26-1 (seconds-per-frame))) + ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja :chan 2 :frame-interp0 f28-0 :frame-interp1 f28-0) + (cond + ((< 0.5 f28-0) + (let ((v1-97 (-> self skel effect))) + (set! (-> v1-97 channel-offset) 2) + ) + 0 + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + ) + ((< 0.9 f30-0) + (let ((v1-103 (-> self skel effect))) + (set! (-> v1-103 channel-offset) 1) + ) + 0 + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + ) + (else + (let ((v1-108 (-> self skel effect))) + (set! (-> v1-108 channel-offset) 0) + ) + 0 + (logior! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + ) + ) + (let* ((f0-19 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) + (f0-21 (/ (* 58.0 (-> self control ctrl-xz-vel)) (* 60.0 f0-19))) + ) + (ja :num! (loop! f0-21)) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + ) + ) + #f + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-run-wild (target) + :parent target-flut-walk + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *flut-run-wild-mods*) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + (let ((v1-3 (-> self skel effect))) + (set! (-> v1-3 channel-offset) 0) + ) + 0 + ((-> target-flut-start exit)) + ) + :trans (behavior () + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) + (< 40960.0 (-> self control ctrl-xz-vel)) + (< 0.7 (-> self control touch-angle)) + (< (vector-dot (-> self control wall-contact-normal) (-> self control dynam gravity-normal)) 0.3) + ) + (if (logtest? (-> self control status) (collide-status touch-actor)) + (send-event self 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 0.5)) + (angle 'shove) + ) + ) + ) + (send-event self 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 2)) + (angle 'shove) + (mode 'death) + ) + ) + ) + ) + ) + (when (time-elapsed? (-> self flut flut-start-time) (seconds 5)) + (if (and (< (target-move-dist (seconds 1)) 409.6) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + (send-event + self + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (new-attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode 'death)) + ) + ) + ) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + ) + :code (behavior () + (local-vars (f0-17 float) (f1-2 float)) + (let ((f28-0 0.0) + (f30-0 0.0) + ) + (let ((f24-0 0.0) + (f26-0 0.0) + ) + 22 + (let ((gp-0 60) + (v1-3 (ja-group)) + ) + (cond + ((and v1-3 (= v1-3 jakb-mech-pull-ja)) + (set! f28-0 (ja-frame-num 0)) + (set! f24-0 (-> self skel root-channel 1 frame-interp (-> self skel active-frame-interp))) + (set! f26-0 (-> self skel root-channel 2 frame-interp (-> self skel active-frame-interp))) + ) + ((let ((v1-17 (ja-group))) + (and v1-17 (or (= v1-17 jakb-mech-get-on-ja) (= v1-17 jakb-mech-death-a-ja))) + ) + (ja-channel-push! 1 (seconds 0.08)) + (ja-no-eval :group! jakb-mech-dummy7-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-push! 3 (the-as time-frame gp-0)) + ) + (else + (ja-channel-push! 3 (the-as time-frame gp-0)) + ) + ) + ) + (ja-no-eval :group! jakb-mech-pull-ja :num! (loop!) :dist 131072.0 :frame-num f28-0) + (ja-no-eval :chan 1 + :group! jakb-mech-dummy4-ja + :num! (identity f28-0) + :frame-interp0 f24-0 + :frame-interp1 f24-0 + :dist 131072.0 + ) + (ja-no-eval :chan 2 + :group! jakb-mech-dummy5-ja + :num! (identity f28-0) + :frame-interp0 f26-0 + :frame-interp1 f26-0 + :dist 131072.0 + ) + ) + (quaternion-copy! (-> self flut prev-quat) (-> self control quat)) + (until #f + (suspend) + (let* ((f0-12 (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + 0.0 + (deg-diff (y-angle (-> self control)) (vector-y-angle (-> self control to-target-pt-xz))) + ) + ) + (f0-13 (lerp-scale 1.0 -1.0 f0-12 -21845.334 21845.334)) + ) + (set! f30-0 (seek f30-0 f0-13 (* 2.0 (seconds-per-frame)))) + ) + (cond + ((>= f30-0 0.0) + (set! f0-17 f30-0) + (set! f1-2 0.0) + ) + (else + (set! f1-2 (- f30-0)) + (set! f0-17 0.0) + ) + ) + (ja :chan 1 :frame-interp0 f1-2 :frame-interp1 f1-2) + (ja :chan 2 :frame-interp0 f0-17 :frame-interp1 f0-17) + (quaternion-copy! (-> self flut prev-quat) (-> self control quat)) + (let ((v1-94 (-> self skel effect))) + (set! (-> v1-94 channel-offset) 0) + ) + 0 + (logior! (-> self target-flags) (target-flags lleg-no-ik rleg-no-ik)) + (let* ((f0-19 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) + (f0-21 (/ (* 58.0 (-> self control ctrl-xz-vel)) (* 60.0 f0-19))) + ) + (ja :num! (loop! f0-21)) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + ) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate target-flut-falling (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (when (and (= message 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 6) + ) + (< 0.0 (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control trans-old) (-> self control trans)) + ) + ) + ) + (send-event proc 'bonk (-> block param 0) (-> self control ground-impact-vel)) + (when (target-send-attack + proc + 'flut-bonk + (the-as touching-shapes-entry (-> block param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + ) + ) + (case message + (('jump) + (go target-flut-jump (the-as float (-> block param 0)) (the-as float (-> block param 0))) + ) + (else + (target-flut-standard-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 object)) + (set! (-> self control mod-surface) *flut-jump-mods*) + (set-time! (-> self state-time)) + ) + :exit (-> target-flut-start exit) + :trans (behavior () + (when (or (logtest? (-> self control status) (collide-status on-surface)) + (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (and (time-elapsed? (-> self state-time) (the-as time-frame (/ (the-as int (-> *TARGET-bank* stuck-time)) 2))) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-flut-hit-ground) + ) + (seek! + (-> self control unknown-float35) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control ctrl-xz-vel))))) + (seconds-per-frame) + ) + ) + :code (behavior ((arg0 object)) + (cond + ((not (-> self flut as-daxter?)) + (let ((v1-4 (ja-group))) + (cond + ((and v1-4 (= v1-4 jakb-flut-jump-loop-ja)) + ) + (else + (let ((v1-10 (ja-group))) + (if (and v1-10 (= v1-10 jakb-flut-double-jump-ja)) + (ja-channel-push! 2 (seconds 0.2)) + (ja-channel-push! 2 (seconds 0.5)) + ) + ) + ) + ) + ) + (ja-no-eval :group! jakb-flut-jump-loop-ja :num! (loop!) :frame-num 0.0) + (let ((gp-0 (-> self skel root-channel 1))) + (let ((f0-2 (-> self control unknown-float35))) + (set! (-> gp-0 frame-interp 1) f0-2) + (set! (-> gp-0 frame-interp 0) f0-2) + ) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + (else + (let ((v1-32 (ja-group))) + (cond + ((and v1-32 (= v1-32 jakb-mech-death-a-ja)) + ) + (else + (ja-channel-push! 1 (seconds 0.5)) + ) + ) + ) + (ja-no-eval :group! jakb-mech-death-a-ja :num! (loop!) :frame-num 0.0) + ) + ) + (until #f + (suspend) + (ja :num! (loop! max)) + (when (>= (ja-group-size) 2) + (let ((a0-20 (-> self skel root-channel 1))) + (let ((f0-8 (-> self control unknown-float35))) + (set! (-> a0-20 frame-interp 1) f0-8) + (set! (-> a0-20 frame-interp 0) f0-8) + ) + (set! (-> a0-20 param 0) 0.0) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim #f) num-func-chan) + ) + ) + ) + #f + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-jump (target) + :event (-> target-flut-falling event) + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (case (-> self flut mode) + (('wild) + (set! (-> self control mod-surface) *flut-jump-wild-mods*) + ) + (('racer) + (set! (-> self control mod-surface) *flut-jump-racer-mods*) + ) + (else + (set! (-> self control mod-surface) *flut-jump-mods*) + ) + ) + (set! (-> self control unknown-float36) + (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control ctrl-xz-vel))))) + ) + (set! (-> self control unknown-float35) + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -10240.0 (-> self control ctrl-xz-vel))))) + ) + ) + :exit (behavior () + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (set! (-> self control unknown-float36) + (fmax + (-> self control unknown-float36) + (* 0.003921569 (the float (-> *cpad-list* cpads (-> self control cpad number) abutton 6))) + ) + ) + ((-> target-flut-falling trans)) + (case (-> self flut mode) + (('wild) + (when (and (logtest? (-> self control status) (collide-status touch-wall)) + (< 40960.0 (-> self control ctrl-xz-vel)) + (< 0.7 (-> self control touch-angle)) + (< (vector-dot (-> self control wall-contact-normal) (-> self control dynam gravity-normal)) 0.3) + ) + (if (logtest? (-> self control status) (collide-status touch-actor)) + (send-event self 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 0.5)) + (angle 'shove) + ) + ) + ) + (send-event self 'attack #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 10)) + (shove-up (meters 2)) + (angle 'shove) + (mode 'death) + ) + ) + ) + ) + ) + ) + (else + (if (and (cpad-pressed? (-> self control cpad number) x) + (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 40960.0) + (not (logtest? (water-flag touch-water) (-> self water flags))) + (not (logtest? (target-flags prevent-jump prevent-double-jump) (-> self target-flags))) + (< 4096.0 (target-height-above-ground)) + ) + (go target-flut-double-jump (-> *FLUT-bank* double-jump-height-min) (-> *FLUT-bank* double-jump-height-max)) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) + (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 61440.0) + (and (< -61440.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (time-elapsed? (-> self control last-time-of-stuck) (the-as time-frame (-> *TARGET-bank* stuck-timeout))) + (not (logtest? (-> self target-flags) (target-flags prevent-attack))) + (not (logtest? (-> self control current-surface flags) (surface-flag no-attack no-hands))) + ) + ) + (go target-flut-air-attack (-> *FLUT-bank* air-attack-speed)) + ) + ) + ) + (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (and (time-elapsed? (-> self state-time) (seconds 0.1)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + enter-state + 'stuck + (go target-flut-hit-ground) + ) + (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + ) + :code (behavior ((arg0 float) (arg1 float)) + (cond + ((not (-> self flut as-daxter?)) + (ja-channel-push! 2 (seconds 0.12)) + (ja :group! jakb-flut-jump-ja :num! min) + (let ((a0-3 (-> self skel root-channel 1))) + (let ((f0-1 (-> self control unknown-float35))) + (set! (-> a0-3 frame-interp 1) f0-1) + (set! (-> a0-3 frame-interp 0) f0-1) + ) + (set! (-> a0-3 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-ja)) + (set! (-> a0-3 param 0) 0.0) + (joint-control-channel-group-eval! a0-3 (the-as art-joint-anim jakb-flut-jump-forward-ja) num-func-chan) + ) + (suspend) + (ja :group! jakb-flut-jump-ja :num! (+!)) + (let ((a0-5 (-> self skel root-channel 1))) + (let ((f0-4 (-> self control unknown-float35))) + (set! (-> a0-5 frame-interp 1) f0-4) + (set! (-> a0-5 frame-interp 0) f0-4) + ) + (set! (-> a0-5 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-ja)) + (set! (-> a0-5 param 0) 0.0) + (joint-control-channel-group-eval! a0-5 (the-as art-joint-anim jakb-flut-jump-forward-ja) num-func-chan) + ) + (suspend) + 0 + ) + (else + (ja-channel-push! 1 (seconds 0.12)) + (ja :group! jakb-mech-get-on-ja :num! min) + (suspend) + (ja :group! jakb-mech-get-on-ja :num! (+!)) + (suspend) + 0 + ) + ) + (until (ja-done? 0) + (let ((f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f0-12 (/ (- 10.0 (ja-aframe-num 0)) (* (ja-step 0) (ja-speed 0)))) + ) + (ja :num! (seek! max (if (and (< 0.0 f30-0) (< 0.0 f0-12)) + (fmin (fmin 3.0 f0-12) (/ (* 5.0 f0-12) (the float (time-to-apex f30-0 -245760.0)))) + 1.0 + ) + ) + ) + ) + (when (>= (ja-group-size) 2) + (let ((a0-15 (-> self skel root-channel 1))) + (let ((f0-18 (-> self control unknown-float35))) + (set! (-> a0-15 frame-interp 1) f0-18) + (set! (-> a0-15 frame-interp 0) f0-18) + ) + (set! (-> a0-15 param 0) 0.0) + (joint-control-channel-group-eval! a0-15 (the-as art-joint-anim #f) num-func-chan) + ) + ) + (suspend) + ) + (cond + ((not (-> self flut as-daxter?)) + (ja-no-eval :group! jakb-flut-jump-loop-ja :num! (loop!) :frame-num 0.0) + (let ((a0-18 (-> self skel root-channel 1))) + (let ((f0-22 (-> self control unknown-float35))) + (set! (-> a0-18 frame-interp 1) f0-22) + (set! (-> a0-18 frame-interp 0) f0-22) + ) + (set! (-> a0-18 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-loop-ja)) + (set! (-> a0-18 param 0) 0.0) + (joint-control-channel-group-eval! a0-18 (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) num-func-chan) + ) + (until #f + (suspend) + (ja :group! jakb-flut-jump-loop-ja :num! (loop!)) + (let ((a0-20 (-> self skel root-channel 1))) + (let ((f0-25 (-> self control unknown-float35))) + (set! (-> a0-20 frame-interp 1) f0-25) + (set! (-> a0-20 frame-interp 0) f0-25) + ) + (set! (-> a0-20 frame-group) (the-as art-joint-anim jakb-flut-jump-forward-loop-ja)) + (set! (-> a0-20 param 0) 0.0) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) num-func-chan) + ) + ) + #f + ) + (else + (ja-no-eval :group! jakb-mech-death-a-ja :num! (loop!) :frame-num 0.0) + (until #f + (suspend) + (ja :group! jakb-mech-death-a-ja :num! (loop!)) + ) + #f + ) + ) + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-double-jump (target) + :event (-> target-flut-falling event) + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #t (-> self control transv) 2.0) + (set! (-> self control dynam gravity-max) 40960.0) + (set! (-> self control dynam gravity-length) 245760.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (case (-> self flut mode) + (('racer) + (set! (-> self control mod-surface) *flut-double-jump-racer-mods*) + ) + (else + (set! (-> self control mod-surface) *flut-double-jump-mods*) + ) + ) + ) + :exit (behavior () + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + ((-> target-flut-falling trans)) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons square) + ) + (not (logtest? (-> self target-flags) (target-flags prevent-attack))) + (not (logtest? (-> self control current-surface flags) (surface-flag no-attack no-hands))) + (time-elapsed? (-> self control last-time-of-stuck) (the-as time-frame (-> *TARGET-bank* stuck-timeout))) + (< 4096.0 (target-height-above-ground)) + ) + (go target-flut-air-attack (-> *FLUT-bank* air-attack-speed)) + ) + (if (!= (-> self state-time) (current-time)) + (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + ) + (let ((v1-41 (ja-group))) + (if (and v1-41 (= v1-41 jakb-flut-double-jump-ja)) + (sound-play "flut-flap" :id (the-as sound-id (-> self flut flap-sound-id))) + ) + ) + ) + :code (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-flut-double-jump-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 3 (seconds 0.1)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control mod-surface) *flut-jump-mods*) + (current-time) + (ja-channel-push! 2 (seconds 0.2)) + (ja-no-eval :group! jakb-flut-jump-loop-ja :num! (loop!) :frame-num 0.0) + (let ((gp-0 (-> self skel root-channel 1))) + (let ((f0-9 (-> self control unknown-float35))) + (set! (-> gp-0 frame-interp 1) f0-9) + (set! (-> gp-0 frame-interp 0) f0-9) + ) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim jakb-flut-jump-forward-loop-ja) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (until #f + (suspend) + (seek! + (-> self control dynam gravity-max) + (-> self control standard-dynamics gravity-max) + (* 163840.0 (seconds-per-frame)) + ) + (seek! + (-> self control dynam gravity-length) + (-> self control standard-dynamics gravity-length) + (* 163840.0 (seconds-per-frame)) + ) + (ja :num! (loop! max)) + (let ((a0-13 (-> self skel root-channel 1))) + (let ((f0-23 (-> self control unknown-float35))) + (set! (-> a0-13 frame-interp 1) f0-23) + (set! (-> a0-13 frame-interp 0) f0-23) + ) + (set! (-> a0-13 param 0) 0.0) + (joint-control-channel-group-eval! a0-13 (the-as art-joint-anim #f) num-func-chan) + ) + ) + #f + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-hit-ground (target) + :event target-flut-standard-event-handler + :enter (behavior () + (target-land-effect) + (when (< 40960.0 (-> self control ground-impact-vel)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.1)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.2)) + ) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (set! (-> self control mod-surface) *flut-walk-mods*) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still)) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? 'flut) + ) + (go target-flut-jump (-> *FLUT-bank* jump-height-min) (-> *FLUT-bank* jump-height-max)) + ) + (if (or (move-legs?) (= (-> self flut mode) 'wild)) + (go target-flut-walk) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + ) + :code (behavior () + (let ((t9-0 target-flut-hit-ground-anim)) + (t9-0) + ) + (go target-flut-stance) + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-running-attack (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touched) + (cond + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 1920) + ) + (let ((gp-1 (target-send-attack + proc + (-> self control danger-mode) + (the-as touching-shapes-entry (-> block param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + ) + ) + (when gp-1 + (set! (-> self control unknown-word04) (the-as uint (current-time))) + (let ((v1-9 (if (type? proc process-drawable) + proc + ) + ) + ) + (when v1-9 + (let* ((s5-1 (-> (the-as process-drawable v1-9) root)) + (v1-10 (if (type? s5-1 collide-shape) + (the-as collide-shape s5-1) + ) + ) + ) + (if (and v1-10 (or (logtest? (-> v1-10 root-prim prim-core collide-as) (collide-spec enemy)) + (logtest? (-> v1-10 root-prim prim-core action) (collide-action no-smack)) + ) + ) + (set! (-> self control unknown-symbol03) (the-as float #x1)) + ) + ) + ) + ) + (when (or (= gp-1 'die) (= gp-1 'push)) + (let ((v0-2 (the-as object (current-time)))) + (set! (-> self control did-move-to-pole-or-max-jump-height) (the-as float v0-2)) + v0-2 + ) + ) + ) + ) + ) + (else + (target-flut-dangerous-event-handler proc argc message block) + ) + ) + ) + (else + (target-flut-dangerous-event-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control unknown-word04) (the-as uint 0)) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (set! (-> self control unknown-symbol03) 0.0) + (set! (-> self control mod-surface) *flut-run-attack-mods*) + (set! (-> *run-attack-mods* turnv) 655360.0) + (set! (-> *run-attack-mods* turnvv) 655360.0) + (target-start-attack) + (target-danger-set! 'flut-attack #f) + ) + :exit (behavior () + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (set! (-> *run-attack-mods* turnv) 0.0) + (set! (-> *run-attack-mods* turnvv) 0.0) + (set-time! (-> self control last-running-attack-end-time)) + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (when (!= (-> self state-time) (current-time)) + (if (and (or (smack-surface? #t) + (and (>= (-> self control surface-slope-z) 0.7) + (not (logtest? (-> self control status) (collide-status touch-actor))) + ) + ) + (begin + (set! (-> self control did-move-to-pole-or-max-jump-height) (the-as float (current-time))) + (set! (-> self control bend-target) 0.0) + (let ((v1-11 (new-stack-vector0)) + (f0-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-11 (-> self control transv) (vector-float*! v1-11 (-> self control dynam gravity-normal) f0-3)) + (let* ((f1-3 (vector-length v1-11)) + (f2-0 f1-3) + (f0-4 (fmin 0.0 f0-3)) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-4) + (vector-float*! v1-11 v1-11 (/ f1-3 f2-0)) + ) + ) + ) + #t + ) + (or (zero? (-> self control unknown-word04)) + (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 12)) + ) + (!= (the-as int (-> self control unknown-symbol03)) 1) + ) + (target-shoved (meters 2) (-> *TARGET-bank* smack-surface-height) (the-as process #f) target-flut-hit) + ) + (if (and (logtest? (water-flag touch-water) (-> self water flags)) + (zero? (mod (- (current-time) (-> self state-time)) 21)) + ) + (spawn-ripples + (-> self water) + 0.6 + (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg neckB)) + 0 + (-> self control transv) + #f + ) + ) + ) + ) + :code (behavior () + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 3 (seconds 0.4)) + (ja-channel-push! 1 (seconds 0.02)) + (ja :group! jakb-flut-running-attack-ja :num! min) + (set! (-> self control dynam gravity-max) 368640.0) + (set! (-> self control dynam gravity-length) 368640.0) + (let ((f28-0 0.0) + (f30-0 (if (= (-> self control yellow-eco-last-use-time) (current-time)) + 0.2 + 0.8 + ) + ) + ) + (until (or (ja-done? 0) (< f30-0 0.05)) + (compute-alignment! (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and (>= (ja-aframe-num 0) 20.0) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (>= (the-as uint (- (current-time) (the-as int (-> self control unknown-word04)))) (the-as uint 12)) + ) + ) + (go target-flut-falling #f) + ) + ((and (nonzero? (-> self control did-move-to-pole-or-max-jump-height)) + (>= (the-as + uint + (- (current-time) (the-as int (the-as uint (-> self control did-move-to-pole-or-max-jump-height)))) + ) + (the-as uint 12) + ) + ) + (set-forward-vel 0.0) + (set! f30-0 0.0) + ) + ((ja-done? 0) + (set-forward-vel f28-0) + ) + (else + (set! f28-0 + (* f30-0 (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second)) + ) + (set-forward-vel f28-0) + ) + ) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv) (-> self control w-R-c)) + (set! (-> gp-1 y) 0.0) + (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control c-R-w)) + ) + (suspend) + (ja :num! (seek! max (-> self control current-surface align-speed))) + (if (time-elapsed? (-> self state-time) (seconds 0.1)) + (set! (-> *flut-run-attack-mods* turnvv) 0.0) + ) + (if (time-elapsed? (-> self state-time) (seconds 0.1)) + (set! f30-0 (* f30-0 (fmin 1.0 (-> self control zx-vel-frac)))) + ) + ) + (if (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *FLUT-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (go target-flut-falling #f) + ) + (when (!= f30-0 0.0) + (set! (-> self trans-hook) (-> target-flut-hit-ground trans)) + (if (not (ja-done? 0)) + (ja-channel-push! 1 (seconds 0.05)) + ) + (ja-no-eval :group! jakb-flut-running-attack-end-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 f30-0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (go target-flut-stance) + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-air-attack (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (if (and (= message 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 6) + ) + (< 0.0 (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control trans-old) (-> self control trans)) + ) + ) + ) + (send-event proc 'bonk (-> block param 0) (-> self control ground-impact-vel)) + ) + (case message + (('jump) + (go target-flut-jump (the-as float (-> block param 0)) (the-as float (-> block param 0))) + ) + (else + (target-flut-dangerous-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 float)) + (set-forward-vel arg0) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! (-> self control mod-surface) *flut-air-attack-mods*) + (target-start-attack) + (target-danger-set! 'flut-attack #f) + (let ((v1-5 (new-stack-vector0))) + (let ((f0-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-5 (-> self control transv) (vector-float*! v1-5 (-> self control dynam gravity-normal) f0-1)) + ) + (let* ((f0-2 (vector-length v1-5)) + (f1-1 f0-2) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-5 v1-5 (/ f0-2 f1-1)) + ) + ) + ) + ) + :exit (behavior () + (target-danger-set! 'harmless #f) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (set! (-> self control dynam gravity quad) (-> self control standard-dynamics gravity quad)) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (let ((gp-0 (new-stack-vector0))) + (vector-z-quaternion! gp-0 (-> self control quat-for-control)) + (let ((v1-1 (new-stack-vector0)) + (f0-1 (vector-dot gp-0 (-> self control transv))) + ) + 0.0 + (vector-! v1-1 (-> self control transv) (vector-float*! v1-1 gp-0 f0-1)) + (let* ((f1-2 (vector-length v1-1)) + (f2-0 f1-2) + ) + (if (< f0-1 0.0) + (set! f0-1 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) gp-0 f0-1) + (vector-float*! v1-1 v1-1 (/ f1-2 f2-0)) + ) + ) + ) + ) + (when (logtest? (-> self control status) (collide-status on-surface)) + (logior! (-> self control status) (collide-status on-surface)) + (remove-exit) + (go target-flut-air-attack-hit-ground) + ) + (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) 4096.0) + (and (time-elapsed? (-> self state-time) (seconds 0.5)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-flut-hit-ground) + ) + ) + :code (behavior ((arg0 float)) + (ja-channel-push! 1 (seconds 0.05)) + (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek! (ja-aframe 8.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek! (ja-aframe 8.0 0))) + ) + (ja-no-eval :group! jakb-flut-air-attack-ja :num! (seek!) :frame-num (ja-aframe 8.0 0)) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (ja :group! jakb-flut-air-attack-loop-ja :num! min) + (until #f + (suspend) + ) + #f + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-air-attack-hit-ground (target) + :event target-flut-standard-event-handler + :enter (behavior () + (target-land-effect) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.4)) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (set! (-> self control mod-surface) *flut-air-attack-mods*) + (sound-play "flop-land" :pitch -0.4) + (do-effect (-> self skel effect) (the-as symbol "group-flut-attack-strike-ground") (ja-frame-num 0) 0) + (let ((gp-2 + (process-spawn + touch-tracker + :init touch-tracker-init + (-> self control trans) + #x45800000 + 30 + :name "touch-tracker" + :to self + ) + ) + ) + (send-event + (ppointer->process gp-2) + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self control target-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'flut-attack) + (count (-> self control target-attack-id)) + (penetrate-using (-> self control penetrate-using)) + ) + ) + ) + (send-event + (ppointer->process gp-2) + 'function + (lambda ((arg0 process-focusable)) + (seek! (-> arg0 root root-prim local-sphere w) 28672.0 (* 286720.0 (seconds-per-frame))) + (update-transforms (-> arg0 root)) + ) + ) + ) + ) + :exit (-> target-flut-air-attack exit) + :trans (-> target-flut-hit-ground trans) + :code (behavior () + (ja-channel-set! 1) + (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek! (ja-aframe 22.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek! (ja-aframe 22.0 0))) + ) + (target-danger-set! 'harmless #f) + (ja-no-eval :group! jakb-flut-air-attack-land-ja :num! (seek!) :frame-num (ja-aframe 22.0 0)) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-xz-vel) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (go target-flut-stance) + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-kanga-catch (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('end-mode) + (case (-> block param 0) + (('kanga) + (go target-jump 16384.0 16384.0 (the-as surface #f)) + ) + ) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 handle) (arg1 symbol)) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set-setting! 'ignore-target #t 0.0 0) + ) + :exit (behavior () + (remove-setting! 'ignore-target) + ((-> target-flut-start exit)) + ) + ) + +;; failed to figure out what this is: +(defstate target-flut-hit (target) + :event target-flut-standard-event-handler + :exit (behavior () + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-flut-death))) + (logclear! (-> self focus-status) (focus-status dead hit)) + ) + (target-exit) + ((-> target-flut-start exit)) + ) + :trans (behavior () + (when (= *cheat-mode* 'debug) + (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) + (pickup-collectable! (-> self fact) (pickup-type health) 100.0 (the-as handle #f)) + (go target-flut-stance) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 attack-info)) + (set-time! (-> self state-time)) + (let ((s5-0 (-> self attack-info))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-2 s5-0)) + (set! (-> v1-2 attacker) (the-as handle #f)) + (set! (-> v1-2 mode) 'generic) + (set! (-> v1-2 shove-back) 10240.0) + (set! (-> v1-2 shove-up) 9011.2) + (set! (-> v1-2 angle) #f) + (set! (-> v1-2 trans quad) (-> self control trans quad)) + (set! (-> v1-2 control) 0.0) + (set! (-> v1-2 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) + (set! (-> v1-2 damage) (-> *FACT-bank* health-default-inc)) + ) + (case arg0 + (('shove) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + (let ((v1-6 s5-0)) + (set! (-> v1-6 shove-back) (-> *TARGET-bank* smack-surface-dist)) + (set! (-> v1-6 shove-up) (-> *TARGET-bank* smack-surface-height)) + (set! (-> v1-6 angle) 'shove) + ) + ) + ) + (combine! s5-0 arg1 self) + (when (not (logtest? (-> s5-0 mask) (attack-mask vector))) + (vector-z-quaternion! (-> s5-0 vector) (-> self control quat-for-control)) + (vector-xz-normalize! (-> s5-0 vector) (- (fabs (-> s5-0 shove-back)))) + (set! (-> s5-0 vector y) (-> s5-0 shove-up)) + ) + (set! (-> s4-0 quad) (-> s5-0 vector quad)) + (let ((f0-11 (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) s4-0 1.0) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) + ) + ) + ) + (if (not (-> self attack-info angle)) + (set! (-> self attack-info angle) (if (>= 0.0 f0-11) + 'front + 'back + ) + ) + ) + ) + (case arg0 + (('attack) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> s5-0 mode) + (('endlessfall) + (cond + ((= (-> self game mode) 'debug) + (let ((s3-2 (new-stack-vector0))) + (set! (-> s3-2 quad) (-> self control last-trans-on-ground quad)) + (ja-channel-set! 0) + (let ((s2-0 (current-time))) + (until (time-elapsed? s2-0 (seconds 1)) + (suspend) + ) + ) + (move-to-point! (-> self control) s3-2) + ) + (set! (-> self control camera-pos quad) (-> self control trans quad)) + (send-event *camera* 'teleport) + (go target-flut-stance) + ) + (else + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-flut-death (-> s5-0 mode)) + ) + ) + ) + (('water-vol 'sharkey 'bot 'drown-death 'instant-death 'crush 'tentacle) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (if (= (-> self game mode) 'play) + (go target-flut-death (-> s5-0 mode)) + ) + ) + (('lava 'melt 'fry 'slime) + (sound-play "death-melt") + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (cond + ((logtest? (-> *part-group-id-table* 64 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 64)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 64)) + ) + ) + (set! (-> s5-0 angle) 'lava) + (set! (-> s5-0 shove-up) 20480.0) + ) + (('death) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + ) + (('cactus) + (cond + ((= (-> self flut mode) 'normal) + ) + (else + (go target-flut-death (-> s5-0 mode)) + ) + ) + ) + (('drown) + (if (= (-> self flut mode) 'normal) + (go target-flut-eject (-> s5-0 mode)) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> s5-0 damage)) (the-as handle #f)) + ) + ) + (else + (if (!= (-> self flut mode) 'normal) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> s5-0 damage)) (the-as handle #f)) + ) + ) + ) + (target-hit-effect s5-0) + (sound-play "flut-hit" :pitch -1) + ) + ) + (set! (-> self control mod-surface) *smack-mods*) + (let ((f30-0 1.0)) + (let ((v1-114 (-> s5-0 angle))) + (cond + ((= v1-114 'shove) + (cond + ((not (-> self flut as-daxter?)) + (let ((v1-119 (ja-group))) + (when (not (and v1-119 (= v1-119 jakb-flut-smack-surface-ja))) + (ja-channel-set! 1) + (ja :group! jakb-flut-smack-surface-ja :num! min) + ) + ) + ) + (else + (let ((v1-130 (ja-group))) + (when (not (and v1-130 (= v1-130 jakb-mech-drag-pickup-ja))) + (ja-channel-set! 1) + (ja :group! jakb-mech-drag-pickup-ja :num! min) + ) + ) + ) + ) + (sound-play "smack-surface") + (sound-play "flut-hit" :pitch 1) + ) + ((not (-> self flut as-daxter?)) + (let ((v1-148 (ja-group))) + (when (not (and v1-148 (= v1-148 jakb-flut-hit-back-ja))) + (ja-channel-push! 1 (seconds 0.075)) + (ja :group! jakb-flut-hit-back-ja :num! min) + ) + ) + ) + (else + (let ((v1-159 (ja-group))) + (when (not (and v1-159 (= v1-159 jakb-mech-drag-pickup-ja))) + (ja-channel-set! 1) + (ja :group! jakb-mech-drag-pickup-ja :num! min) + ) + ) + ) + ) + ) + (target-hit-move + s5-0 + (target-hit-orient s5-0 s4-0) + (the-as (function none :behavior target) target-flut-falling-anim-trans) + f30-0 + ) + ) + ) + (cond + ((and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-flut-death (-> s5-0 mode)) + ) + ((and (= (-> self flut mode) 'normal) (= arg0 'attack)) + (go target-flut-eject (-> s5-0 mode)) + ) + (else + (go target-flut-hit-ground) + ) + ) + ) + ) + :post target-flut-post + ) + +;; failed to figure out what this is: +(defstate target-flut-death (target) + :event (-> target-death event) + :exit (behavior () + ((-> target-flut-start exit)) + ((-> target-death exit)) + ) + :trans (-> target-hit trans) + :post (behavior () + (target-flut-post-post) + (target-no-stick-post) + ) + ) + +;; failed to figure out what this is: +(defstate target-flut-get-on (target) + :event target-generic-event-handler + :exit (behavior () + (logclear! (-> self target-flags) (target-flags tf5)) + ((-> target-flut-start exit)) + ) + :code (behavior ((arg0 handle)) + (set! (-> self control mod-surface) *flut-walk-mods*) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (logior! (-> self target-flags) (target-flags tf5 tf6)) + (set-time! (-> self state-time)) + (when (handle->process arg0) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> self control trans quad)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> self control trans quad)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector39)) (-> self control quat)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector40)) (-> self control quat-for-control)) + (set! (-> self control unknown-word04) (the-as uint (-> self control draw-offset y))) + (let* ((s2-0 (handle->process arg0)) + (s3-0 (if (type? s2-0 process-drawable) + (the-as process-drawable s2-0) + ) + ) + ) + (when s3-0 + (set! (-> s5-0 quad) (-> s3-0 root trans quad)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector40)) (-> s3-0 root quat)) + (send-event s3-0 'trans (-> self flut flut-trans)) + (quaternion-copy! (the-as quaternion (-> self flut flut-quat)) (-> s3-0 root quat)) + (set! (-> self flut flut-scale quad) (-> s3-0 root scale quad)) + (set! (-> self control did-move-to-pole-or-max-jump-height) (-> self flut flut-trans y)) + ) + ) + (set! (-> self control unknown-vector37 quad) (-> s4-0 quad)) + (set! (-> self control unknown-vector38 quad) (-> s5-0 quad)) + (let ((s4-1 #f)) + (sound-play "uppercut") + (ja-channel-push! 1 (seconds 0.05)) + (let ((s3-2 (if (-> self flut as-daxter?) + jakb-gun-yellow-fire-twirl-ja + jakb-flut-get-on-ja + ) + ) + (f30-0 (if (-> self flut as-daxter?) + 20.0 + 24.0 + ) + ) + ) + (ja-no-eval :group! s3-2 :num! (seek! (ja-aframe f30-0 0)) :frame-num 0.0) + (until (ja-done? 0) + (let* ((s3-3 (handle->process arg0)) + (v1-66 (if (type? s3-3 process-drawable) + (the-as process-drawable s3-3) + ) + ) + ) + (when v1-66 + (set! (-> s5-0 quad) (-> v1-66 root trans quad)) + (set! (-> self control unknown-vector38 quad) (-> s5-0 quad)) + (quaternion-copy! (the-as quaternion (-> self control unknown-vector40)) (-> v1-66 root quat)) + ) + ) + (when (and (not s4-1) (= (-> self skel root-channel 0) (-> self skel channel))) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (set! s4-1 #t) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (suspend) + (ja :num! (seek! (ja-aframe f30-0 0))) + ) + ) + ) + ) + ) + (sound-play "flut-coo") + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (logclear! (-> self target-flags) (target-flags tf6)) + (set! (-> self control transv quad) (the-as uint128 0)) + (quaternion-copy! (-> self control quat) (-> self control quat-for-control)) + (rot->dir-targ! (-> self control)) + (send-event (handle->process arg0) 'die) + (case (-> self flut mode) + (('wild) + (set-forward-vel 204800.0) + (set! (-> self control ctrl-xz-vel) 204800.0) + (ja-channel-set! 0) + ) + ) + (go target-flut-stance) + ) + :post (behavior () + (let ((gp-0 (new 'stack-no-clear 'vector)) + (f30-0 (fmin 1.0 (* 0.0044444446 (the float (- (current-time) (-> self state-time)))))) + ) + (case (-> self flut mode) + (('wild) + (set! f30-0 (lerp-scale 0.0 1.0 (ja-frame-num 0) 0.0 (the float (+ (-> (ja-group) frames num-frames) -1)))) + ) + ) + (vector-lerp! gp-0 (-> self control unknown-vector37) (-> self control unknown-vector38) f30-0) + (set! (-> gp-0 y) + (lerp + (-> self control unknown-vector37 y) + (-> self control unknown-vector38 y) + (fmax 0.0 (fmin 1.0 (* 0.006666667 (the float (+ (- (the-as int (-> self state-time))) (current-time)))))) + ) + ) + (move-to-point! (-> self control) gp-0) + (quaternion-slerp! + (-> self control quat-for-control) + (the-as quaternion (-> self control unknown-vector39)) + (the-as quaternion (-> self control unknown-vector40)) + f30-0 + ) + ) + (target-no-move-post) + (let ((f30-1 (-> self alt-cam-pos y))) + (if (-> self flut as-daxter?) + (vector<-cspace! (-> self alt-cam-pos) (-> self sidekick 0 node-list data 3)) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + ) + (set! (-> self alt-cam-pos y) f30-1) + ) + ) + ) + +;; failed to figure out what this is: +(let ((v1-45 (copy *forward-jump-mods* 'loading-level))) + (set! (-> v1-45 fric) 0.0) + (set! (-> v1-45 nonlin-fric-dist) 0.0) + (set! (-> v1-45 turnv) 0.0) + (set! (-> v1-45 turnvv) 0.0) + (set! (-> v1-45 tiltv) 131072.0) + (set! (-> v1-45 tiltvf) 30.0) + (set! (-> v1-45 mult-hook) + (the-as + (function surface surface surface int none) + (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (persist-with-delay *setting-control* 'string-spline-accel (seconds 0.05) 'string-spline-accel 'abs 4096.0 0) + (persist-with-delay + *setting-control* + 'string-spline-max-move + (seconds 0.05) + 'string-spline-max-move + 'abs + 40960.0 + 0 + ) + (persist-with-delay + *setting-control* + 'string-spline-accel-player + (seconds 0.05) + 'string-spline-accel-player + 'abs + 4096.0 + 0 + ) + (persist-with-delay + *setting-control* + 'string-spline-max-move-player + (seconds 0.05) + 'string-spline-max-move-player + 'abs + 40960.0 + 0 + ) + ) + ) + ) + ) + ) + (set! *flut-get-off-mods* v1-45) + ) + +;; failed to figure out what this is: +(defstate target-flut-get-off (target) + :event target-generic-event-handler + :exit (-> target-flut-get-on exit) + :code (behavior ((arg0 handle)) + (logior! (-> self target-flags) (target-flags tf5)) + (set-forward-vel 0.0) + (let ((s5-0 0)) + (while (and (not (logtest? (-> self control status) (collide-status on-surface))) + (not (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) (< 30 s5-0)) + #t + ) + ) + ) + (target-flut-falling-anim-trans) + (+! s5-0 (- (current-time) (-> self clock old-frame-counter))) + (suspend) + ) + ) + (go target-flut-get-off-jump) + ) + :post (behavior () + (target-no-stick-post) + (target-flut-post-post) + ) + ) + +;; failed to figure out what this is: +(defstate target-flut-get-off-jump (target) + :event target-generic-event-handler + :exit (-> target-flut-start exit) + :code (behavior () + (let ((gp-1 (mem-copy! (the-as pointer (new 'stack 'transformq)) (the-as pointer (-> self control trans)) 48))) + (logior! (-> self target-flags) (target-flags tf5)) + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (ja-channel-push! 1 (seconds 0.1)) + (let ((s5-0 (if (-> self flut as-daxter?) + jakb-mech-dummy3-ja + jakb-flut-get-off-ja + ) + ) + ) + (ja-no-eval :group! s5-0 :num! (seek! (ja-aframe 18.0 0)) :frame-num 0.0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 18.0 0))) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((s5-2 (new 'stack-no-clear 'vector))) + (vector<-cspace! s5-2 (joint-node jakb-lod0-jg main)) + (move-to-point! (-> self control) s5-2) + ) + (send-event *camera* 'ease-in) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set-forward-vel 32768.0) + (process-spawn + flut + :init flut-init + (-> self flut entity) + gp-1 + (process->handle self) + (+ (if (= (-> self flut mode) 'wild) + 0 + 1 + ) + (shl (-> self flut color-index) 32) + ) + (-> self flut mode) + :name "flut" + :to self + ) + ) + (go target-jump 10240.0 10240.0 *flut-get-off-mods*) + ) + :post (behavior () + (let ((f30-0 (-> self alt-cam-pos y))) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + (set! (-> self alt-cam-pos y) f30-0) + ) + (target-no-move-post) + ) + ) + +;; failed to figure out what this is: +(defstate target-flut-eject (target) + :event target-generic-event-handler + :exit (-> target-flut-start exit) + :code (behavior ((arg0 symbol)) + (let ((s5-1 (mem-copy! (the-as pointer (new 'stack 'transformq)) (the-as pointer (-> self control trans)) 48))) + (logior! (-> self target-flags) (target-flags tf5)) + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (ja-channel-push! 1 (seconds 0.1)) + (case arg0 + (('drown) + (ja-no-eval :group! jakb-flut-death-drown-ja :num! (seek! (ja-aframe 60.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 60.0 0))) + ) + ) + (else + (ja-no-eval :group! jakb-flut-deathb-ja :num! (seek! (ja-aframe 25.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 25.0 0))) + ) + ) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((s4-4 (new 'stack-no-clear 'vector))) + (vector<-cspace! s4-4 (joint-node jakb-lod0-jg main)) + (+! (-> s4-4 y) -9011.2) + (let ((v1-45 (-> self water flags))) + (if (and (logtest? (water-flag touch-water) v1-45) + (logtest? (water-flag under-water swimming) v1-45) + (not (logtest? (focus-status mech) (-> self focus-status))) + ) + (set! (-> s4-4 y) (-> self water collide-height)) + ) + ) + (move-to-point! (-> self control) s4-4) + ) + (send-event *camera* 'ease-in) + (ja-channel-set! 0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (let ((s4-5 (if (= (-> self flut mode) 'wild) + 4 + 5 + ) + ) + ) + (case arg0 + (('drown) + (set! s4-5 (logior s4-5 10)) + ) + ) + (process-spawn + flut + :init flut-init + (-> self flut entity) + s5-1 + (process->handle self) + (+ s4-5 (shl (-> self flut color-index) 32)) + (-> self flut mode) + :name "flut" + :to self + ) + ) + ) + (cond + ((= arg0 'drown) + (logior! (-> self water flags) (water-flag jump-out)) + (go target-swim-jump 20480.0 20480.0) + ) + (else + (go target-jump 14336.0 14336.0 *flut-get-off-mods*) + ) + ) + ) + :post (behavior () + (let ((f30-0 (-> self alt-cam-pos y))) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + (set! (-> self alt-cam-pos y) f30-0) + ) + (target-no-move-post) + ) + ) + +;; failed to figure out what this is: +(defstate target-flut-grab (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + (-> self state name) + ) + (else + (case message + (('end-mode) + (case (-> block param 0) + (('grab) + (go target-flut-stance) + ) + (('flut) + (go target-grab 'stance) + ) + ) + ) + (('clone-anim) + (go target-flut-clone-anim (process->handle (the-as process (-> block param 0)))) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf2)) + (logior! (-> self focus-status) (focus-status grabbed)) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags tf2)) + (logclear! (-> self focus-status) (focus-status grabbed)) + (logclear! (-> self water flags) (water-flag jump-out)) + (target-exit) + ((-> target-flut-start exit)) + ) + :code (-> target-flut-stance code) + :post (behavior () + (target-no-stick-post) + (target-flut-post-post) + ) + ) + +;; failed to figure out what this is: +(defstate target-flut-clone-anim (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (if (and (= message 'trans) (= (-> block param 0) 'restore)) + (set! (-> self control unknown-word04) (the-as uint #f)) + ) + ((-> target-flut-grab event) proc argc message block) + ) + :enter (-> target-clone-anim enter) + :exit (behavior () + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ((-> target-clone-anim exit)) + ((-> target-flut-start exit)) + ) + :code (behavior ((arg0 handle)) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (clone-anim arg0 #t "") + (go target-flut-stance) + ) + :post (behavior () + (target-no-ja-move-post) + (target-flut-post-post) + ) + ) diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-states_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-states_REF.gc index 0d20fed3c5..d4f642fb20 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-states_REF.gc @@ -476,7 +476,3 @@ ) :post target-gun-post ) - - - - diff --git a/test/decompiler/reference/jak3/engine/target/mech/mech-h_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/mech-h_REF.gc index 789a1229aa..c6be8a3cb6 100644 --- a/test/decompiler/reference/jak3/engine/target/mech/mech-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/mech/mech-h_REF.gc @@ -15,6 +15,7 @@ (drag-sound-id sound-id) (whine-sound-id sound-id) (shield-sound-id sound-id) + (mode-sound-bank connection) (mech-start-time time-frame) (mech-time time-frame) (no-get-off-time time-frame) @@ -44,7 +45,7 @@ (smoke-local-vel vector 2 :inline) (particle-system-2d basic) (particle-system-3d basic) - (part-thruster sparticle-launch-control) + (part-thruster sparticle-launcher) (part-thruster-scale-x sp-field-init-spec) (part-thruster-scale-y sp-field-init-spec) (part-quat quaternion) @@ -139,7 +140,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc new file mode 100644 index 0000000000..17fd17fcbe --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/mech/mech-part_REF.gc @@ -0,0 +1,435 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpart 1037 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:y (meters 0)) + (:scale-x (meters 1)) + (:scale-y (meters 3)) + (:r 128.0 128.0) + (:g 64.0 64.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +;; failed to figure out what this is: +(defpart 1038 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:y (meters -0.3)) + (:scale-x (meters 1.5) (meters 0.1)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 64.0 64.0) + (:b 0.0) + (:a 16.0 8.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + ) + ) + +;; failed to figure out what this is: +(defpart 1039 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 4.0) + (:y (meters 0) (meters -0.25)) + (:scale-x (meters 0.2) (meters 0.2)) + (:rot-z (degrees 0) 1 (degrees 180)) + (:scale-y (meters 1) (meters 0.6)) + (:r 192.0) + (:g 64.0) + (:b 0.0) + (:a 0.0 16.0) + (:vel-y (meters -0.06666667) (meters -0.016666668)) + (:scalevel-x (meters 0.033333335)) + (:scalevel-y (meters 0.006666667)) + (:fade-r -2.0) + (:fade-g 2.0) + (:fade-b 5.0) + (:fade-a 0.32) + (:accel-x (meters 0) (meters 0.0016666667)) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.94) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.085)) + (:next-launcher 1040) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 1040 + :init-specs ((:r 64.0 64.0) + (:g 64.0 64.0) + (:b 64.0 64.0) + (:fade-r 0.0) + (:fade-g 0.0) + (:fade-b 0.0) + (:fade-a -0.128 -0.256) + ) + ) + +;; failed to figure out what this is: +(defpart 1041 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.1 0.1) + (:y (meters 0.25) (meters -0.5)) + (:scale-x (meters 0.05)) + (:scale-y (meters 0.5)) + (:r 192.0 64.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 128.0) + (:vel-y (meters -0.033333335) (meters -0.026666667)) + (:scalevel-x (meters 0.001)) + (:scalevel-y (meters -0.017)) + (:fade-g 0.0) + (:accel-x (meters 0) (meters 0.0016666667)) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.96) + (:timer (seconds 0.167) (seconds 0.247)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:next-time (seconds 0.1)) + (:next-launcher 1042) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 1042 + :init-specs ((:scalevel-x (meters 0)) (:scalevel-y (meters 0))) + ) + +;; failed to figure out what this is: +(defpart 1043 + :init-specs ((:num 0.6) + (:rot-x 8) + (:r 1638.4) + (:g 1331.2) + (:b 1433.6) + (:vel-y (meters -0.06666667) (meters -0.016666668)) + (:fade-r 32.768) + (:fade-g 26.623999) + (:fade-b 28.671999) + (:accel-x (meters 0) (meters 0.0016666667)) + (:friction 0.94) + (:timer (seconds 0.335)) + (:flags (distort)) + (:next-time (seconds 0.167)) + (:next-launcher 1044) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 1044 + :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b -4.096)) + ) + +;; definition for function mech-spawn-thruster +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun mech-spawn-thruster ((arg0 mech-info) (arg1 vector) (arg2 vector) (arg3 float) (arg4 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (set! (-> arg0 part-thruster) (-> *part-id-table* 1037)) + (set! (-> arg0 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) + (set! (-> arg0 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) + (let ((s1-0 (new 'stack-no-clear 'quaternion)) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (forward-up->quaternion s1-0 arg2 (new 'static 'vector :y 1.0 :w 1.0)) + (quaternion-rotate-local-x! s1-0 s1-0 32768.0) + (let ((a0-3 s0-0)) + (let ((v1-10 arg1)) + (let ((a1-4 (* 0.5 arg4))) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> arg2 quad)) + (.lvf vf4 (&-> v1-10 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 (&-> a0-3 quad) vf6) + ) + (set! (-> arg0 part-thruster-scale-x initial-valuef) arg3) + (set! (-> arg0 part-thruster-scale-y initial-valuef) arg4) + (dotimes (s4-1 2) + (quaternion-rotate-local-z! s1-0 s1-0 16384.0) + (quaternion-copy! (-> arg0 part-quat) s1-0) + (let ((t9-4 sp-launch-particles-var) + (a0-6 (-> arg0 particle-system-3d)) + (a1-7 (-> arg0 part-thruster)) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> s0-0 quad)) + (t9-4 + (the-as sparticle-system a0-6) + a1-7 + a2-4 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ) + (launch-particles (-> *part-id-table* 1043) arg1) + (launch-particles (-> *part-id-table* 1038) arg1) + (cond + ((!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) + (launch-particles (-> *part-id-table* 1043) arg1) + ) + (else + (launch-particles (-> *part-id-table* 1039) arg1) + (launch-particles (-> *part-id-table* 1041) arg1) + ) + ) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defpart 1045 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 3.0) + (:x (meters -16) (meters 32)) + (:y (meters 0) (meters 12)) + (:z (meters -16) (meters 32)) + (:scale-x (meters 0.1) (meters 0.3)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 0.1) (meters 0.1)) + (:r 0.0 64.0) + (:g 64.0 128.0) + (:b 64.0 196.0) + (:a 0.0) + (:vel-y (meters -0.0033333334) (meters 0.006666667)) + (:rotvel-z (degrees -0.4) (degrees 0.8)) + (:fade-a 0.21333334 0.21333334) + (:timer (seconds 2.5)) + (:flags (sp-cpuinfo-flag-2)) + (:userdata 0.0) + (:func 'check-water-level-above-and-die) + (:next-time (seconds 0.5)) + (:next-launcher 1046) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:rotate-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters -3) (meters 8)) + ) + ) + +;; failed to figure out what this is: +(defpart 1046 + :init-specs ((:fade-a 0.0) (:next-time (seconds 1)) (:next-launcher 1047)) + ) + +;; failed to figure out what this is: +(defpart 1047 + :init-specs ((:fade-a -0.21333334 -0.21333334)) + ) + +;; failed to figure out what this is: +(defpart 1048 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:num 0.2) + (:x (meters -24) (meters 48)) + (:y (meters -4) (meters 4)) + (:z (meters -24) (meters 48)) + (:scale-x (meters 0.15) (meters 0.15)) + (:scale-y (meters 0.1) (meters 0.1)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 0.0) + (:vel-y (meters 0.008333334) (meters 0.005)) + (:fade-a 0.16) + (:timer (seconds 16)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:userdata 0.0) + (:func 'check-water-level-above-and-die) + (:next-time (seconds 0.33) (seconds 0.657)) + (:next-launcher 1049) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpart 1049 + :init-specs ((:fade-a 0.0) (:next-time (seconds 1) (seconds 5.997)) (:next-launcher 1050)) + ) + +;; failed to figure out what this is: +(defpart 1050 + :init-specs ((:scalevel-x (meters -0.00033333333) (meters -0.00066666666)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.16) + (:accel-y (meters -0.0001) (meters -0.0001)) + ) + ) + +;; failed to figure out what this is: +(defpart 1051 + :init-specs ((:texture (lakedrop level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.15) (meters 0.15)) + (:scale-y (meters 0.1) (meters 0.1)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 0.0) + (:vel-y (meters 0.008333334) (meters 0.005)) + (:fade-a 0.16) + (:accel-y (meters 0.0002)) + (:friction 0.97 0.01) + (:timer (seconds 4)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:userdata 0.0) + (:func 'check-water-level-above-and-die) + (:next-time (seconds 0.33) (seconds 0.657)) + (:next-launcher 1052) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters 0) (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 1052 + :init-specs ((:fade-a 0.0) (:next-time (seconds 1) (seconds 0.997)) (:next-launcher 1050)) + ) + +;; failed to figure out what this is: +(defpartgroup group-mech-explode-death + :id 236 + :duration (seconds 0.25) + :linger-duration (seconds 2) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 153) (sp-item 154)) + ) + +;; failed to figure out what this is: +(defpart 1053 + :init-specs ((:num 4.0) + (:x (meters -1) (meters 3)) + (:y (meters 0) (meters 4)) + (:rot-x 6) + (:r 4096.0) + (:g 2662.4) + (:b 2867.2) + (:vel-y (meters 0.0033333334) (meters 0.01)) + (:accel-y (meters 0.0016666667) (meters 0.00033333333)) + (:friction 0.9) + (:timer (seconds 0.4)) + (:flags (distort)) + (:next-time (seconds 0.135) (seconds 0.13)) + (:next-launcher 1054) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpart 1054 + :init-specs ((:fade-b -5.12)) + ) + +;; failed to figure out what this is: +(defpart 1055 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:birth-func 'birth-func-texture-group) + (:num 16.0 4.0) + (:x (meters -1) (meters 3)) + (:y (meters 0) (meters 4)) + (:scale-x (meters 0.5) (meters 0.25)) + (:scale-y (meters 1) (meters 0.25)) + (:r 255.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 32.0 32.0) + (:vel-y (meters 0.0033333334) (meters 0.01)) + (:scalevel-x (meters 0.013333334) (meters 0.006666667)) + (:scalevel-y :copy scalevel-x) + (:accel-y (meters 0.0016666667) (meters 0.00033333333)) + (:friction 0.9) + (:timer (seconds 0.367)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:userdata :data (new 'static 'boxed-array :type int32 40 1 0 #x400000 #x400f00 #x400f00)) + (:next-time (seconds 0.167)) + (:next-launcher 1056) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpart 1056 + :init-specs ((:fade-a -0.53333336 -0.53333336)) + ) + +;; failed to figure out what this is: +(defpart 1057 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.2) (meters 4)) + (:rot-x (degrees 11.25)) + (:rot-z (degrees 0) (degrees 8)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 64.0 64.0) + (:b 255.0) + (:a 32.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 4096.0) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters -0.1) (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 1058 + :init-specs ((:texture (motion-blur-part level-default-sprite)) + (:num 2.0 4.0) + (:scale-x (meters 2.5)) + (:rot-x 4) + (:scale-y (meters 0.04) (meters 0.03)) + (:r 0.0) + (:g 64.0 64.0) + (:b 255.0) + (:a 128.0) + (:omega (degrees 0.01125) (degrees 0.01125)) + (:vel-y (meters 0.1) (meters 0.2)) + (:fade-g -2.55 -2.55) + (:fade-b -2.0) + (:fade-a -0.64 -0.64) + (:accel-y (meters -0.0033333334) (meters -0.0033333334)) + (:friction 0.8 0.02) + (:timer (seconds 0.335)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:func 'sparticle-motion-blur) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc new file mode 100644 index 0000000000..5a5cfa5a83 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/mech/mech-states_REF.gc @@ -0,0 +1,2786 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *mech-exploder-params*, type joint-exploder-static-params +(define *mech-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) + (new 'static 'joint-exploder-static-joint-params :joint-index 17 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 18 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 19 :parent-joint-index -1) + ) + :collide-spec (collide-spec backgnd) + ) + ) + +;; definition for function check-turn-on-shield +(defun check-turn-on-shield ((arg0 target)) + (when (cpad-hold? (-> arg0 control cpad number) circle) + (if (handle->process (-> arg0 mech shield-handle)) + (go target-mech-shield) + ) + ) + ) + +;; failed to figure out what this is: +(defstate target-mech-start (target) + :event target-mech-handler + :exit target-mech-exit + :code target-mech-init + :post target-post + ) + +;; definition for function mech-can-throw? +;; WARN: Return type mismatch object vs symbol. +(defbehavior mech-can-throw? target () + (let ((v1-1 (vector-float*! (new 'stack-no-clear 'vector) (-> self control local-normal) 0.0))) + (vector+float*! v1-1 v1-1 (-> self control c-R-w fvec) 20480.0) + (the-as symbol (send-event (handle->process (-> self carry other)) 'can-drop? v1-1)) + ) + ) + +;; failed to figure out what this is: +(defstate target-mech-stance (target) + :event target-mech-handler + :enter (behavior () + (set! (-> self control mod-surface) *mech-stance-mods*) + (set! (-> self control mod-surface turnvv) 40049.777) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (rot->dir-targ! (-> self control)) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + ) + :exit (behavior () + (target-effect-exit) + (target-mech-exit) + (rot->dir-targ! (-> self control)) + ) + :trans (behavior () + (check-turn-on-shield self) + (when (not (cpad-hold? (-> self control cpad number) circle)) + (if (and (move-legs?) + (and (< (fabs + (deg-diff (quaternion-y-angle (-> self control dir-targ)) (vector-y-angle (-> self control to-target-pt-xz))) + ) + 1820.4445 + ) + (time-elapsed? (-> self control time-of-last-zero-input) (seconds 0.05)) + ) + ) + (go target-mech-walk) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-mech-punch) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + (if (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons r1) + ) + (go target-mech-carry-pickup) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-mech-get-off?) + ) + (go target-mech-shield) + ) + ) + (fall-test target-mech-falling (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 jakb-mech-turn90-ja))) + (let ((v1-8 (ja-group))) + (if (and v1-8 (= v1-8 jakb-mech-walk-ja)) + (sound-play "mech-stop") + ) + ) + (ja-channel-push! 3 (seconds 0.2)) + (ja :group! jakb-mech-turn90-ja :dist 16384.0) + (ja :chan 1 :group! jakb-mech-turn20-ja :dist 3640.889) + (ja :chan 2 :group! jakb-mech-stance-ja :dist 0.0) + ) + ) + (let ((f28-0 0.0) + (f30-0 0.0) + (gp-1 #f) + ) + (until #f + (let ((f26-0 (y-angle (-> self control)))) + (deg-diff f26-0 (quaternion-y-angle (-> self control dir-targ))) + (suspend) + (let ((f26-1 (* (deg-diff f26-0 (y-angle (-> self control))) (-> self clock frames-per-second)))) + (cond + ((< 910.2222 (fabs f26-1)) + (set! f28-0 (seek f28-0 1.0 (* 16.0 (seconds-per-frame)))) + (set! gp-1 #t) + ) + (else + (set! f28-0 (seek f28-0 0.0 (* 6.0 (seconds-per-frame)))) + (when (and gp-1 (= f28-0 0.0)) + (set! gp-1 #f) + (sound-play "mech-twitch") + ) + ) + ) + (set! f30-0 (seek f30-0 (lerp-scale 1.0 0.0 (fabs f26-1) 3640.889 16384.0) (* 10.0 (seconds-per-frame)))) + (let ((v1-41 (-> self skel effect))) + (set! (-> v1-41 channel-offset) (cond + ((< 0.8 (- 1.0 f28-0)) + 2 + ) + ((< 0.5 f30-0) + 1 + ) + (else + 0 + ) + ) + ) + ) + 0 + (ja :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja-no-eval :chan 1 :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) + ) + ) + (let ((a0-44 (-> self skel root-channel 2))) + (let ((f0-22 (- 1.0 f28-0))) + (set! (-> a0-44 frame-interp 1) f0-22) + (set! (-> a0-44 frame-interp 0) f0-22) + ) + (set! (-> a0-44 param 0) 1.0) + (joint-control-channel-group-eval! a0-44 (the-as art-joint-anim #f) num-func-loop!) + ) + (can-play-stance-amibent?) + ) + ) + #f + ) + :post target-mech-post + ) + +;; failed to figure out what this is: +(defstate target-mech-walk (target) + :event target-mech-handler + :enter (behavior () + (set! (-> self control mod-surface) *mech-walk-mods*) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + ) + :exit (behavior () + (target-effect-exit) + (target-mech-exit) + ) + :trans (behavior () + (check-turn-on-shield self) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-mech-punch) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + (let ((gp-0 (ja-group)) + (f0-2 (ja-aframe-num 0)) + ) + (when (if (or (and (= gp-0 jakb-mech-walk-ja) (>= f0-2 5.5) (>= 9.5 f0-2)) + (and (= gp-0 jakb-mech-walk-ja) (>= f0-2 20.5) (>= 24.5 f0-2)) + ) + #t + ) + (case (-> self control unknown-spool-anim00) + (('punch) + (go target-mech-punch) + ) + (('jump) + (if (can-jump? #f) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + (set! (-> self control unknown-word04) (the-as uint #f)) + ) + ) + ) + (when (and (< 5.0 (the-as float (-> self control unknown-word04))) + (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + ) + (set-forward-vel 0.0) + (go target-mech-stance) + ) + (if (and (or (cpad-pressed? (-> self control cpad number) triangle) (not (-> *setting-control* user-current pilot))) + (target-mech-get-off?) + ) + (go target-mech-shield) + ) + ) + ) + (if (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons r1) + ) + (go target-mech-carry-pickup) + ) + (fall-test target-mech-falling (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((f30-0 0.0) + (f28-0 0.0) + ) + (let ((f26-0 (cond + ((zero? (-> self mech walk-anim-leg)) + (set! (-> self mech walk-anim-leg) 1) + 7.0 + ) + (else + (set! (-> self mech walk-anim-leg) 0) + 22.0 + ) + ) + ) + (v1-7 (ja-group)) + ) + (when (not (and v1-7 (= v1-7 jakb-mech-walk-ja))) + (ja-channel-push! 3 (seconds 0.1)) + (ja :group! jakb-mech-walk-ja + :num! (identity (ja-aframe f26-0 0)) + :dist (-> *TARGET-bank* mech-walk-cycle-dist) + ) + (ja :chan 1 :group! jakb-mech-run-ja :dist (-> *TARGET-bank* mech-run-cycle-dist)) + (ja :chan 2 :group! jakb-mech-stance-ja :dist 0.0) + ) + ) + (until #f + (if (< (-> self control ctrl-xz-vel) 8192.0) + (set-forward-vel 8192.0) + ) + (suspend) + (let* ((f0-5 (current-cycle-distance (-> self skel))) + (f26-1 (/ (-> self control ctrl-xz-vel) f0-5)) + ) + (set! (-> self control unknown-word04) + (the-as uint (+ (the-as float (-> self control unknown-word04)) f26-1)) + ) + (set! f30-0 + (seek f30-0 (lerp-scale 0.0 1.0 (-> self control ctrl-xz-vel) 16384.0 32768.0) (* 2.0 (seconds-per-frame))) + ) + (set! f28-0 + (seek f28-0 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 0.0 12288.0) (* 2.0 (seconds-per-frame))) + ) + (let ((v1-39 (-> self skel effect))) + (set! (-> v1-39 channel-offset) (if (< 0.5 f30-0) + 1 + 0 + ) + ) + ) + 0 + (ja :num! (loop! f26-1)) + ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja :chan 2 :num! (chan 0) :frame-interp0 f28-0 :frame-interp1 f28-0) + ) + ) + #f + ) + :post target-mech-post + ) + +;; definition for function target-mech-punch-pick +;; INFO: Used lq/sq +(defbehavior target-mech-punch-pick target ((arg0 symbol)) + (local-vars (sv-144 control-info) (sv-160 float)) + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + *null-vector* + *null-vector* + (the-as process #f) + (current-time) + ) + (let* ((s4-0 (get-trans self 3)) + (s2-0 (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control send-attack-dest) + s4-0 + 32768.0 + (-> self control c-R-w fvec) + 65536.0 + ) + ) + (s5-0 (the-as art-element #f)) + ) + (when s2-0 + (let ((s3-0 (get-trans s2-0 3))) + (set! sv-144 (-> self control)) + (let ((s0-0 s3-0) + (s1-0 deg-diff) + ) + (set! sv-160 (y-angle sv-144)) + (let* ((a1-4 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s0-0 (-> sv-144 trans)))) + (f0-0 (s1-0 sv-160 a1-4)) + ) + (cond + ((>= f0-0 5461.3335) + (set! (-> self mech walk-anim-leg) 0) + 0 + ) + ((>= -5461.3335 f0-0) + (set! (-> self mech walk-anim-leg) 1) + ) + (else + (set! (-> self mech walk-anim-leg) 2) + ) + ) + ) + ) + (when (< (vector-vector-distance s3-0 s4-0) 32768.0) + (let ((a1-6 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-6 from) (process->ppointer self)) + (set! (-> a1-6 num-params) 0) + (set! (-> a1-6 message) 'dont-face?) + (if (not (send-event-function s2-0 a1-6)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s3-0 s4-0) 1.0) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + ) + ) + ) + ) + (let ((v1-29 (-> self mech walk-anim-leg))) + (cond + ((zero? v1-29) + (set! (-> self mech walk-anim-leg) 1) + (set! s5-0 jakb-mech-punch-l-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 7 + 6963.2 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ((= v1-29 1) + (set! (-> self mech walk-anim-leg) 0) + (set! s5-0 jakb-mech-punch-r-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 17 + 6963.2 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ((= v1-29 2) + (set! (-> self mech walk-anim-leg) 0) + (set! s5-0 jakb-mech-punch-b-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 39 + 11141.12 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ((= v1-29 3) + (set! (-> self mech walk-anim-leg) 0) + (set! s5-0 jakb-mech-punch-u-ja) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + (the-as process-drawable (ppointer->process (-> self manipy))) + 39 + 11141.12 + (logior (collide-spec mech-punch) (-> self control root-prim prim-core collide-with)) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (if (zero? arg0) + (ja-no-eval :group! s5-0 :num! (seek!)) + (ja-no-eval :group! s5-0 :num! (seek!) :frame-num (ja-aframe 10.0 0)) + ) + ) + (-> self mech walk-anim-leg) + ) + +;; failed to figure out what this is: +(defstate target-mech-punch (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((focus-test? self dangerous) + (case message + (('touched) + (if ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 1920) + ) + (target-send-attack + proc + (-> self control danger-mode) + (the-as touching-shapes-entry (-> block param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (-> self control penetrate-using) + ) + (target-mech-handler proc argc message block) + ) + ) + (('impact-control) + (when (-> self control danger-mode) + (-> block param 1) + (let* ((gp-1 (the-as object (-> block param 3))) + (s5-1 (-> (the-as collide-query gp-1) best-other-tri collide-ptr)) + (s4-1 (if (type? s5-1 collide-shape-prim) + s5-1 + ) + ) + (s3-1 (if s4-1 + (-> (the-as collide-shape-prim s4-1) cshape process) + (the-as process-drawable #f) + ) + ) + (s5-2 (if (type? s3-1 process-focusable) + s3-1 + ) + ) + ) + (if (and s4-1 (and (or (and s5-2 (focus-test? (the-as process-focusable s5-2) dead)) + (when (send-event + (-> (the-as collide-shape-prim s4-1) cshape process) + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self control target-attack-id)) + (damage 200.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode (-> self control danger-mode)) + (count (-> self control attack-count)) + (penetrate-using (penetrate touch punch mech mech-punch)) + (intersection (-> (the-as collide-query gp-1) best-other-tri intersect)) + ) + ) + ) + (set! (-> self control send-attack-dest) (process->handle s5-2)) + (set-time! (-> self control send-attack-time)) + #t + ) + ) + s5-2 + (focus-test? (the-as process-focusable s5-2) dead) + ) + ) + (set! (-> self mech forward-vel) 0.0) + (set! (-> self mech forward-vel) -40960.0) + ) + (when (or (not s5-2) (= (-> self control send-attack-time) (current-time))) + (cond + ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> (the-as collide-query gp-1) best-other-tri intersect quad)) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> (the-as collide-query gp-1) best-other-tri intersect quad)) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) + ) + ) + (sound-play "mech-punch-hit" :position (+ (the-as uint gp-1) 48)) + (activate! *camera-smush-control* 1638.4 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ) + ) + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *mech-punch-mods*) + (set! (-> self mech state-impact? 0) #f) + (rot->dir-targ! (-> self control)) + ) + :exit (behavior () + (set! (-> *mech-punch-mods* turnvv) 0.0) + (set! (-> self mech state-impact? 0) #f) + (set-time! (-> self control last-running-attack-end-time)) + (target-exit) + (target-mech-exit) + ) + :code (behavior () + (set! (-> self mech forward-vel) (-> self control ctrl-xz-vel)) + 1.0 + (let ((s5-0 #f) + (gp-0 0) + (s4-0 30) + ) + (target-mech-punch-pick (the-as symbol gp-0)) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (when (and (not (focus-test? self dangerous)) + (let ((v1-10 (ja-group))) + (and v1-10 (or (= v1-10 jakb-mech-punch-l-ja) + (= v1-10 jakb-mech-punch-r-ja) + (= v1-10 jakb-mech-punch-b-ja) + (= v1-10 jakb-mech-punch-u-ja) + ) + ) + ) + (>= (ja-aframe-num 0) 12.0) + ) + (target-start-attack) + (target-danger-set! 'mech-punch #f) + ) + (when (and (cpad-pressed? (-> self control cpad number) square) (< gp-0 2)) + (let ((s3-0 (ja-group)) + (f30-0 (ja-aframe-num 0)) + ) + (if (or (and (= s3-0 jakb-mech-punch-l-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-l-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-0 jakb-mech-punch-r-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-r-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-0 jakb-mech-punch-b-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-b-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-0 jakb-mech-punch-u-ja) + (>= f30-0 2.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-u-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + ) + (set! s5-0 #t) + ) + ) + ) + (when s5-0 + (let ((s3-1 (ja-group)) + (f30-2 (ja-aframe-num 0)) + ) + (when (or (and (= s3-1 jakb-mech-punch-l-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-l-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-1 jakb-mech-punch-r-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-r-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-1 jakb-mech-punch-b-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-b-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + (and (= s3-1 jakb-mech-punch-u-ja) + (>= f30-2 21.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-mech-punch-u-ja) frames num-frames) -1)) (ja-frame-num 0)) + ) + ) + (+! gp-0 1) + (target-mech-punch-pick (the-as symbol gp-0)) + (set! (-> self state-time) (+ (current-time) (seconds -0.465))) + (set! (-> self mech forward-vel) (fmax 0.0 (-> self mech forward-vel))) + (set! s4-0 159) + (set! s5-0 #f) + ) + ) + ) + (let ((v1-142 (- (current-time) (-> self state-time))) + (s3-2 #t) + (f30-4 1.0) + ) + (cond + ((< (-> self mech forward-vel) 0.0) + (seek! (-> self mech forward-vel) -0.04096 (* 122880.0 (seconds-per-frame))) + ) + ((let ((a0-43 (ja-group))) + (and a0-43 (or (= a0-43 jakb-mech-punch-b-ja) (= a0-43 jakb-mech-punch-u-ja))) + ) + (cond + ((< v1-142 (seconds 0.465)) + (set! s3-2 #f) + ) + ((< v1-142 (seconds 0.53)) + (set! (-> self mech forward-vel) (lerp-scale 40960.0 81920.0 (the float v1-142) 139.8 159.98999)) + ) + (else + (set! (-> self mech forward-vel) (lerp-scale 81920.0 0.0 (the float v1-142) 159.98999 300.0)) + ) + ) + ) + (else + (let ((a0-50 (ja-group))) + (cond + ((and a0-50 (= a0-50 jakb-mech-punch-l-ja)) + (cond + ((< v1-142 (seconds 0.465)) + (seek! (-> self mech forward-vel) 0.0 (* 20480.0 (seconds-per-frame))) + (set! s3-2 #f) + ) + ((< v1-142 (seconds 0.53)) + (set! (-> self mech forward-vel) (lerp-scale 20480.0 40960.0 (the float v1-142) 139.8 159.98999)) + ) + (else + (set! (-> self mech forward-vel) (lerp-scale 40960.0 0.0 (the float v1-142) 159.98999 300.0)) + ) + ) + ) + ((< v1-142 (seconds 0.465)) + (seek! (-> self mech forward-vel) 0.0 (* 20480.0 (seconds-per-frame))) + (set! s3-2 #f) + ) + ((< v1-142 (seconds 0.53)) + (set! (-> self mech forward-vel) (lerp-scale 20480.0 40960.0 (the float v1-142) 139.8 159.98999)) + ) + (else + (set! (-> self mech forward-vel) (lerp-scale 40960.0 0.0 (the float v1-142) 159.98999 300.0)) + ) + ) + ) + ) + ) + (set! s3-2 (and (time-elapsed? (-> self state-time) s4-0) (and (>= (-> self mech forward-vel) 0.0) s3-2))) + (set! (-> self mech state-impact? 0) s3-2) + (set-forward-vel (-> self mech forward-vel)) + (when (< 20480.0 (vector-length (-> self control transv))) + (do-effect (-> self skel effect) (the-as symbol "effect-slide-poof") (ja-frame-num 0) 49) + (do-effect (-> self skel effect) (the-as symbol "effect-slide-poof") (ja-frame-num 0) 43) + ) + (suspend) + (ja :num! (seek! max (* (-> self control current-surface align-speed) f30-4))) + ) + ) + ) + (go target-mech-stance) + ) + :post target-mech-post + ) + +;; failed to figure out what this is: +(defstate target-mech-falling (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (let ((v0-0 (target-mech-bonk-event-handler proc argc message block))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + ) + :enter (behavior ((arg0 symbol)) + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *mech-jump-mods*) + (set! (-> self mech jump-thrust) 0.0) + (let* ((v1-4 *game-info*) + (v0-0 (+ (-> v1-4 attack-id) 1)) + ) + (set! (-> v1-4 attack-id) v0-0) + (set! (-> self control target-attack-id) v0-0) + ) + ) + :exit (behavior () + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + (target-exit) + (target-mech-exit) + ) + :trans (behavior () + (local-vars (a0-0 none)) + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-mech-hit-ground (the-as symbol a0-0)) + ) + (let ((f0-0 (target-move-dist (-> *TARGET-bank* stuck-time))) + (v1-9 (ja-group)) + ) + (when (if (and (and v1-9 (= v1-9 jakb-mech-jump-loop-ja)) + (< f0-0 (-> *TARGET-bank* stuck-distance)) + (and (time-elapsed? (-> self state-time) (seconds 2)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-mech-hit-ground 'stuck) + ) + ) + (let ((f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + (let ((f0-2 (-> self mech jump-thrust-fuel))) + (cond + ((cpad-hold? (-> self control cpad number) x) + (cond + ((= f0-2 0.0) + (seek! (-> self mech jump-thrust) 0.0 (* 245760.0 (seconds-per-frame))) + ) + ((!= f0-2 (-> *TARGET-bank* mech-jump-thrust-fuel)) + (let ((f28-0 + (lerp-scale 122880.0 8192.0 (-> self mech jump-thrust-fuel) 600.0 (-> *TARGET-bank* mech-jump-thrust-fuel)) + ) + ) + (lerp-scale 409.6 8192.0 (-> self mech jump-thrust-fuel) 600.0 (-> *TARGET-bank* mech-jump-thrust-fuel)) + (seek! + (-> self mech jump-thrust) + (- (- (-> self control dynam gravity-length) f30-0) f28-0) + (* 8192000.0 (seconds-per-frame)) + ) + ) + ) + (else + (set! (-> self mech jump-thrust) 0.0) + ) + ) + (seek! (-> self mech jump-thrust-fuel) 0.0 (the float (- (current-time) (-> self clock old-frame-counter)))) + ) + (else + (seek! (-> self mech jump-thrust) 0.0 (* 491520.0 (seconds-per-frame))) + ) + ) + ) + (let ((v1-72 (new-stack-vector0))) + (let ((f0-29 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-72 (-> self control transv) (vector-float*! v1-72 (-> self control dynam gravity-normal) f0-29)) + ) + (let* ((f0-30 (vector-length v1-72)) + (f1-7 f0-30) + (f2-2 (+ f30-0 (* (-> self mech jump-thrust) (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-2) + (vector-float*! v1-72 v1-72 (/ f0-30 f1-7)) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (until #f + (cond + ((< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (let ((v1-7 (ja-group))) + (when (not (and v1-7 (= v1-7 jakb-mech-jump-thrust-ja))) + (ja-channel-push! 1 (seconds 0.1)) + (ja :group! jakb-mech-jump-thrust-ja :num! min) + ) + ) + (suspend) + (ja :num! (loop! 0.75)) + ) + (else + (let ((v1-22 (ja-group))) + (when (not (and v1-22 (= v1-22 jakb-mech-jump-loop-ja))) + (ja-channel-push! 1 (seconds 0.5)) + (ja :group! jakb-mech-jump-loop-ja :num! min) + ) + ) + (suspend) + (ja :num! (loop!)) + ) + ) + ) + #f + ) + :post target-mech-post + ) + +;; failed to figure out what this is: +(defstate target-mech-jump (target) + :event (-> target-mech-falling event) + :enter (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (let* ((v1-4 *game-info*) + (a2-5 (+ (-> v1-4 attack-id) 1)) + ) + (set! (-> v1-4 attack-id) a2-5) + (set! (-> self control target-attack-id) a2-5) + ) + (set! (-> self mech jump-thrust) 0.0) + (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) + (sound-play "mech-jump") + (set! (-> self control unknown-symbol03) (the-as float arg2)) + (set! (-> self control mod-surface) *mech-jump-mods*) + ) + :exit (-> target-mech-falling exit) + :trans (-> target-mech-falling trans) + :code (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (let ((v1-2 (ja-group))) + (if (and v1-2 (= v1-2 jakb-mech-jump-land-ja)) + (ja-channel-push! 1 (seconds 0.5)) + (ja-channel-push! 1 (seconds 0.05)) + ) + ) + ((the-as (function none) (-> target-mech-falling code))) + ) + :post target-mech-post + ) + +;; failed to figure out what this is: +(defstate target-mech-hit-ground (target) + :event target-mech-handler + :enter (behavior ((arg0 symbol)) + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self mech thrust-sound-id)) + (set! (-> v1-0 params volume) -4) + (set! (-> v1-0 auto-time) 48) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 params mask) (the-as uint 17)) + (-> v1-0 id) + ) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + (set-time! (-> self state-time)) + (cond + ((= arg0 'stuck) + ) + (else + (target-land-effect) + ) + ) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (if (!= (-> self control ground-pat material) (pat-material ice)) + (delete-back-vel) + ) + (set! (-> self control mod-surface) *mech-stance-mods*) + (start-bobbing! + (-> self water) + (lerp-scale 0.0 4096.0 (-> self control ground-impact-vel) 40960.0 102400.0) + 600 + 1500 + ) + (activate! *camera-smush-control* 1638.4 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still)) + (target-mech-exit) + ) + :trans (behavior () + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t)) + (go target-mech-punch) + ) + (when (time-elapsed? (-> self state-time) (seconds 0.25)) + (if (move-legs?) + (go target-mech-walk) + ) + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + (if (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons r1) + ) + (go target-mech-carry-pickup) + ) + ) + (set-forward-vel 0.0) + ) + :code (behavior ((arg0 symbol)) + (target-hit-ground-anim #f (are-still?)) + (go target-mech-stance) + ) + :post target-mech-post + ) + +;; failed to figure out what this is: +(defstate target-mech-hit (target) + :event target-mech-handler + :exit (behavior () + ((-> target-hit exit)) + (target-mech-exit) + ) + :trans (behavior () + (when (= *cheat-mode* 'debug) + (when (and (not *pause-lock*) (cpad-hold? (-> self control cpad number) r2)) + (set-time! (-> self control time-of-last-debug-heal)) + (pickup-collectable! (-> self fact) (pickup-type health) 100.0 (the-as handle #f)) + (go target-mech-stance) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 attack-info)) + (logclear! (-> self water flags) (water-flag jump-out)) + (set-time! (-> self state-time)) + (let ((gp-0 (-> self attack-info)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-4 gp-0)) + (set! (-> v1-4 attacker) (the-as handle #f)) + (set! (-> v1-4 mode) 'generic) + (set! (-> v1-4 shove-back) 10240.0) + (set! (-> v1-4 shove-up) 6144.0) + (set! (-> v1-4 angle) #f) + (set! (-> v1-4 trans quad) (-> self control trans quad)) + (set! (-> v1-4 control) 0.0) + (set! (-> v1-4 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) + ) + (case arg0 + (('shove) + (let ((v1-7 gp-0)) + (set! (-> v1-7 shove-back) (-> *TARGET-bank* smack-surface-dist)) + (set! (-> v1-7 shove-up) (-> *TARGET-bank* smack-surface-height)) + (set! (-> v1-7 angle) 'shove) + ) + ) + ) + (combine! gp-0 arg1 self) + (when (not (logtest? (-> gp-0 mask) (attack-mask vector))) + (vector-z-quaternion! (-> gp-0 vector) (-> self control quat-for-control)) + (vector-xz-normalize! (-> gp-0 vector) (- (fabs (-> gp-0 shove-back)))) + (set! (-> gp-0 vector y) (-> gp-0 shove-up)) + ) + (set! (-> s5-0 quad) (-> gp-0 vector quad)) + (let ((f0-10 (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) s5-0 1.0) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) + ) + ) + ) + (if (not (-> self attack-info angle)) + (set! (-> self attack-info angle) (if (>= 0.0 f0-10) + 'front + 'back + ) + ) + ) + ) + (cond + ((= arg0 'attack) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> gp-0 mode) + (('endlessfall) + (cond + ((= (-> self game mode) 'debug) + (let ((s4-1 (new-stack-vector0))) + (set! (-> s4-1 quad) (-> self control last-trans-on-ground quad)) + (ja-channel-set! 0) + (let ((s3-1 (current-time))) + (until (time-elapsed? s3-1 (seconds 1)) + (suspend) + ) + ) + (move-to-point! (-> self control) s4-1) + ) + (set! (-> self control camera-pos quad) (-> self control trans quad)) + (send-event *camera* 'teleport) + (go target-mech-stance) + ) + (else + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-mech-death (-> gp-0 mode)) + ) + ) + ) + ) + (target-hit-effect gp-0) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-mech-death (-> gp-0 mode)) + ) + (else + (case (-> gp-0 mode) + (('burn 'burnup) + (sound-play "get-burned") + ) + ) + ) + ) + (set! (-> self control mod-surface) *smack-mods*) + (let ((v1-63 (ja-group))) + (when (not (and v1-63 (= v1-63 jakb-mech-hit-front-ja))) + (ja-channel-push! 1 (seconds 0.075)) + (ja :group! jakb-mech-hit-front-ja :num! min) + ) + ) + (target-hit-move gp-0 (target-hit-orient gp-0 s5-0) target-mech-falling-anim-trans 1.0) + ) + (go target-mech-hit-ground #f) + ) + :post (behavior () + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (vector-float*! + (-> self control dynam gravity) + (-> self control dynam gravity-normal) + (the-as float (-> self control dynam gravity-length)) + ) + (target-mech-post) + ) + ) + +;; failed to figure out what this is: +(defstate target-mech-death (target) + :event (-> target-death event) + :exit (behavior () + (set! (-> self mech stick-off) #f) + (target-mech-exit) + ((-> target-death exit)) + ) + :trans (-> target-mech-hit trans) + :code (behavior ((arg0 symbol)) + (set! (-> self mech stick-off) (the-as basic #t)) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control did-move-to-pole-or-max-jump-height) + (the-as float (send-event (handle->process (-> self attack-info attacker)) 'target 'die arg0)) + ) + (set! (-> self neck flex-blend) 0.0) + (target-timed-invulnerable-off self 0) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (set-setting! 'process-mask 'set 0.0 (process-mask platform projectile death)) + (apply-settings *setting-control*) + (set! (-> self control transv quad) (the-as uint128 0)) + (logior! (-> self focus-status) (focus-status dead)) + (let ((s5-0 (-> self child))) + (while s5-0 + (send-event (ppointer->process s5-0) 'notice 'die) + (set! s5-0 (-> s5-0 0 brother)) + ) + ) + (cond + ((or (= arg0 'none) (= arg0 'instant-death) (= arg0 'bot) (= arg0 'big-explosion)) + ) + ((= arg0 'grenade) + (sound-play "explosion") + ) + ((= arg0 'endlessfall) + (sound-play "mech-death-fall") + (set! (-> self control unknown-sound-id00) + (add-process *gui-control* *target* (gui-channel daxter) (gui-action play) "mechfall" -99.0 0) + ) + (sound-params-set! *gui-control* (-> self control unknown-sound-id00) #t -1 100 2 -1.0) + (set-setting! 'mode-name 'cam-endlessfall 0.0 0) + (logior! (-> self control pat-ignore-mask) (new 'static 'pat-surface :noendlessfall #x1)) + (logclear! (-> self water flags) (water-flag swim-ground)) + (let ((f0-2 (fmin -4096.0 (- (-> self control ground-impact-vel))))) + (set! (-> self control unknown-word04) (the-as uint f0-2)) + (let ((v1-58 (new-stack-vector0))) + (let ((f1-3 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-58 (-> self control transv) (vector-float*! v1-58 (-> self control dynam gravity-normal) f1-3)) + ) + (let* ((f1-4 (vector-length v1-58)) + (f2-1 f1-4) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-2) + (vector-float*! v1-58 v1-58 (/ f1-4 f2-1)) + ) + ) + ) + ) + (set! (-> self trans-hook) + (lambda :behavior target + () + (vector-seek! (-> self draw color-mult) *zero-vector* (seconds-per-frame)) + (let ((v1-2 (new-stack-vector0)) + (f0-2 (the-as number (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + ) + 0.0 + (vector-! + v1-2 + (-> self control transv) + (vector-float*! v1-2 (-> self control dynam gravity-normal) (the-as float f0-2)) + ) + (let* ((f1-2 (vector-length v1-2)) + (f2-0 f1-2) + ) + (if (< (the-as float (-> self control unknown-word04)) (the-as float f0-2)) + (set! f0-2 (-> self control unknown-word04)) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) (the-as float f0-2)) + (vector-float*! v1-2 v1-2 (/ f1-2 f2-0)) + ) + ) + ) + ((-> target-mech-hit trans)) + ) + ) + (ja-channel-push! 1 (seconds 0.3)) + (ja-no-eval :group! jakb-mech-jump-loop-ja :num! (loop! 0.5) :frame-num 0.0) + (let ((gp-3 (current-time))) + (until (time-elapsed? gp-3 (seconds 0.8)) + (ja :group! jakb-mech-jump-loop-ja :num! (loop! 0.5)) + (suspend) + ) + ) + (remove-setting! 'mode-name) + ) + (else + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (remove-setting! 'slave-options) + (remove-setting! 'fov) + (remove-setting! 'head-offset) + (send-event *camera* 'set-dist #f #f) + (set! (-> self burn-proc) + (ppointer->handle + (process-spawn-function process process-drawable-burn-effect 1200 :to (ppointer->process (-> self manipy))) + ) + ) + (let ((gp-5 (if (zero? (rand-vu-int-count 2)) + jakb-mech-death-a-ja + jakb-mech-death-b-ja + ) + ) + ) + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 (if (logtest? (-> self water flags) (water-flag under-water)) + 0.55 + 1.0 + ) + ) + ) + (ja-no-eval :group! gp-5 :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.03)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (process-drawable-shock-effect + (the-as process-drawable (ppointer->process (-> self manipy))) + (-> *lightning-spec-id-table* 1) + lightning-probe-callback + (-> *part-id-table* 160) + 0 + 0 + 40960.0 + ) + ) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + (sound-play "mech-eject") + (cond + ((logtest? (-> *part-group-id-table* 236 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 236)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 236)) + ) + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((gp-9 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (cond + ((logtest? (-> self water flags) (water-flag under-water)) + (set! (-> gp-9 duration) (seconds 8)) + (set! (-> gp-9 gravity) -20480.0) + (set! (-> gp-9 rot-speed) 4.2) + (set-vector! (-> gp-9 fountain-rand-transv-lo) -20480.0 12288.0 -20480.0 1.0) + (set-vector! (-> gp-9 fountain-rand-transv-hi) 20480.0 24576.0 20480.0 1.0) + ) + (else + (set! (-> gp-9 gravity) -204800.0) + (set-vector! (-> gp-9 fountain-rand-transv-lo) -61440.0 12288.0 -61440.0 1.0) + (set-vector! (-> gp-9 fountain-rand-transv-hi) 61440.0 49152.0 61440.0 1.0) + ) + ) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-mech-explode" (the-as (pointer level) #f)) + 41 + gp-9 + *mech-exploder-params* + :name "joint-exploder" + :to (ppointer->process (-> self manipy)) + :unk 0 + ) + ) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> self control trans quad)) + (set! (-> self post-hook) target-no-move-post) + (ja-channel-set! 1) + (ja-no-eval :group! jakb-death-painful-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (set! (-> self control transv quad) (the-as uint128 0)) + (vector-seek! + (-> self draw color-mult) + (new 'static 'vector :x 0.5 :y 0.5 :z 0.5 :w 1.0) + (* 5.0 (seconds-per-frame)) + ) + (suspend) + (ja :num! (seek!)) + ) + (let ((gp-10 (current-time))) + (until (time-elapsed? gp-10 (seconds 2)) + (suspend) + ) + ) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f)) + (if (!= (-> self game mode) 'play) + (go target-jump 16384.0 16384.0 (the-as surface #f)) + ) + (set-time! (-> self state-time)) + (sleep-code) + ) + :post target-mech-post + ) + +;; definition for function target-mech-carry-update +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior target-mech-carry-update target () + (carry-info-method-9 (-> self carry)) + (when (and (= (-> self control collide-mode) 'mech-carry) (< (-> self control collide-mode-transition) 1.0)) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (new 'stack-no-clear 'inline-array 'sphere 1)) + ) + (dotimes (s4-0 1) + ((method-of-type sphere new) (the-as symbol (-> s5-0 s4-0)) sphere) + ) + (let ((f30-0 (seek (-> self control collide-mode-transition) 1.0 (* 0.1 (-> self clock time-adjust-ratio))))) + (set! (-> s5-0 0 quad) (-> self control collision-spheres 2 prim-core world-sphere quad)) + (set! (-> s5-0 0 r) (lerp-scale (-> *TARGET-bank* body-radius) 11468.8 f30-0 0.0 1.0)) + (let ((v1-17 gp-0)) + (set! (-> v1-17 best-dist) (the-as float s5-0)) + (set! (-> v1-17 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-17 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-17 ignore-process0) #f) + (set! (-> v1-17 ignore-process1) #f) + (set! (-> v1-17 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-17 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-17 action-mask) (collide-action solid)) + ) + (if (not (fill-and-probe-using-spheres *collide-cache* gp-0)) + (target-collide-set! 'mech-carry f30-0) + ) + ) + ) + ) + (send-event (handle->process (-> self carry other)) 'carry (-> self carry)) + (none) + ) + +;; definition for function target-mech-carry-post +(defbehavior target-mech-carry-post target () + (logior! (-> self focus-status) (focus-status carry)) + (target-mech-post) + (target-mech-carry-update) + (none) + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-pickup (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touched) + (cond + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self control) + (the-as uint 1920) + ) + (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) 'carry?) + (let ((a1-3 (send-event-function proc a1-2))) + (when a1-3 + (let ((f0-0 (distance-from-destination (-> self carry) (the-as carry-info a1-3)))) + (when (and (>= f0-0 0.0) (< f0-0 (-> self carry other-value))) + (set! (-> self carry other) (process->handle proc)) + (set! (-> self carry other-value) f0-0) + ) + ) + ) + ) + ) + #f + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + (('change-mode 'end-mode) + #f + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-pickup-mods*) + (set! (-> self mech stick-off) (the-as basic #t)) + (set-time! (-> self state-time)) + (set-forward-vel 0.0) + (set! (-> self carry other) (the-as handle #f)) + (set! (-> self carry other-value) 100000000000.0) + (set! (-> self carry max-distance) 32768.0) + (set! (-> self carry mode) (carry-mode carry mech-carry mech-drag)) + (carry-info-method-9 (-> self carry)) + ) + :exit (behavior () + (when (not (and (-> self next-state) (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-mech-carry-stance) + (= v1-3 'target-mech-carry-walk) + (= v1-3 'target-mech-carry-drop) + (= v1-3 'target-mech-carry-throw) + (= v1-3 'target-mech-carry-jump) + (= v1-3 'target-mech-carry-falling) + (= v1-3 'target-mech-carry-hit-ground) + (= v1-3 'target-mech-carry-throw) + (= v1-3 'target-mech-carry-drag) + (= v1-3 'target-mech-shield) + ) + ) + ) + ) + (logclear! (-> self focus-status) (focus-status carry)) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) *null-vector*) + (target-collide-set! 'mech 0.0) + (target-exit) + ) + (set! (-> self mech stick-off) #f) + (target-mech-exit) + ) + :code (behavior () + (let ((f30-0 0.0) + (f28-0 0.0) + (gp-0 #f) + ) + (ja-channel-push! 2 1) + (ja :group! jakb-mech-carry-pickup-high-ja :num! min) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja :num! (seek!)) + (ja :chan 1 :num! (chan 0)) + (target-danger-set! 'carry? #f) + (suspend) + (ja :num! (seek!)) + (ja :chan 1 :num! (chan 0)) + (format #t "carry picked ~A~%" (handle->process (-> self carry other))) + (let ((a1-9 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-9 from) (process->ppointer self)) + (set! (-> a1-9 num-params) 0) + (set! (-> a1-9 message) 'carry-info) + (let ((s5-1 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-9)))) + (cond + (s5-1 + (let* ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> s5-1 point) (-> self control trans))) + (s3-0 (new-stack-vector0)) + (f26-0 (vector-dot (-> self control local-normal) s4-1)) + ) + 0.0 + (vector-! s3-0 s4-1 (vector-float*! s3-0 (-> self control local-normal) f26-0)) + (let* ((f24-0 (vector-length s3-0)) + (f22-0 f24-0) + ) + (set! f28-0 (lerp-scale 1.0 0.0 f26-0 3072.0 7168.0)) + (vector+! + s4-1 + (vector-float*! s4-1 (-> self control local-normal) f26-0) + (vector-float*! s3-0 s3-0 (/ f24-0 f22-0)) + ) + ) + ) + (cond + ((logtest? (-> s5-1 mode) (carry-mode mech-drag)) + (sound-play "mech-drag-pikup") + (let ((s4-5 (vector-! (new 'stack-no-clear 'vector) (-> self carry point) (-> s5-1 point)))) + (set! gp-0 #t) + (vector-xz-normalize! s4-5 (-> s5-1 max-pull)) + (vector+! s4-5 s4-5 (-> s5-1 point)) + ) + (let* ((f26-1 (y-angle (-> s5-1 process 0 control))) + (f0-15 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) (-> s5-1 point) (-> self carry point)))) + (f0-21 (the float (the int (* 0.000061035156 (+ 73728.0 (deg- f0-15 f26-1)))))) + (s5-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> self carry face-dir) (the int f0-21)) + (let ((f24-2 (the float (sar (shl (the int (* 16384.0 f0-21)) 48) 48)))) + (set! (-> self control unknown-word04) (the-as uint (+ f26-1 f24-2))) + (set-vector! s5-2 (sin (+ f26-1 f24-2)) 0.0 (cos (+ f26-1 f24-2)) 1.0) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + s5-2 + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + ) + (else + (sound-play "mech-drag-pikup") + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-normalize! (vector-! (new-stack-vector0) (-> s5-1 point) (-> self control trans)) 1.0) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + ) + ) + ) + (else + (sound-play "mech-pickup-1") + ) + ) + ) + ) + (target-danger-set! 'harmless #f) + (cond + (gp-0 + (ja-channel-push! 1 (seconds 0.01)) + (ja-no-eval :group! jakb-mech-drag-pickup-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) + (while (not (ja-done? 0)) + (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + ) + ) + (let ((s4-11 (new 'stack-no-clear 'vector)) + (s5-6 (new 'stack-no-clear 'vector)) + ) + (when (send-event (handle->process (-> self carry other)) 'pickup (-> self carry) s4-11 s5-6) + (target-collide-set! 'mech-carry 0.0) + (when gp-0 + (sound-play "mech-drag-grab") + (let ((s3-6 (vector-! (new 'stack-no-clear 'vector) s4-11 (-> self control trans))) + (a1-37 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-37 from) (process->ppointer self)) + (set! (-> a1-37 num-params) 0) + (set! (-> a1-37 message) 'carry-info) + (let ((s4-12 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-37)))) + (vector-flatten! s3-6 s3-6 s5-6) + (let ((f0-43 (vector-length s3-6))) + (when (< 1228.8 f0-43) + (vector-normalize! s3-6 (+ -1228.8 f0-43)) + (move-by-vector! (-> self control) s3-6) + (vector+! (-> s4-12 hold-trans) (-> s4-12 hold-trans) s3-6) + ) + ) + ) + ) + (set-yaw-angle-clear-roll-pitch! (-> self control) (the-as float (-> self control unknown-word04))) + (rot->dir-targ! (-> self control)) + (go target-mech-carry-drag) + ) + (sound-play "mech-servo-up") + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + (go target-mech-carry-stance) + ) + ) + (cond + (gp-0 + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + (else + (ja-no-eval :num! (seek! (ja-aframe 11.0 0))) + (while (not (ja-done? 0)) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + (suspend) + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-eval) + ) + ) + ) + ) + (go target-mech-stance) + ) + :post (behavior () + (target-mech-post) + (carry-info-method-9 (-> self carry)) + (target-mech-carry-update) + ) + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-drop (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('change-mode 'end-mode) + #f + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-walk-mods*) + (set-time! (-> self state-time)) + (set-forward-vel 0.0) + (set! (-> self mech stick-off) (the-as basic #t)) + ) + :exit (-> target-mech-carry-pickup exit) + :code (behavior () + (let ((f30-0 1.0) + (gp-1 (sound-play "mech-servo-down")) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'carry-info) + (let ((a0-8 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-1)))) + (when a0-8 + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> a0-8 point quad)) + (set! (-> s5-1 y) (- (-> s5-1 y) (-> a0-8 process 0 control root-prim prim-core world-sphere w))) + (let ((s4-0 (new-stack-vector0)) + (f28-0 (vector-dot (-> self control local-normal) s5-1)) + ) + 0.0 + (vector-! s4-0 s5-1 (vector-float*! s4-0 (-> self control local-normal) f28-0)) + (let* ((f26-0 (vector-length s4-0)) + (f24-0 f26-0) + ) + (set! f30-0 (lerp-scale 1.0 0.0 f28-0 3072.0 7168.0)) + (vector+! + s5-1 + (vector-float*! s5-1 (-> self control local-normal) f28-0) + (vector-float*! s4-0 s4-0 (/ f26-0 f24-0)) + ) + ) + ) + ) + ) + ) + ) + (ja-channel-push! 2 (seconds 0.1)) + (ja :group! jakb-mech-carry-pickup-high-ja :num! max) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (suspend) + (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) + (while (not (ja-done? 0)) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 0) + (set! (-> a1-10 message) 'carry-info) + (let ((s5-5 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-10)))) + (when s5-5 + (if (< 20.0 (ja-aframe-num 0)) + (seek! (-> s5-5 grab-trans-blend) 1.0 (* 2.0 (seconds-per-frame))) + ) + (let ((s3-0 (-> s5-5 process 0 control)) + (s5-6 (new 'stack-no-clear 'collide-query)) + ) + (let ((s4-1 (new 'stack-no-clear 'inline-array 'sphere 1))) + (dotimes (s2-0 1) + ((method-of-type sphere new) (the-as symbol (-> s4-1 s2-0)) sphere) + ) + (set! (-> s4-1 0 quad) (-> s3-0 root-prim prim-core world-sphere quad)) + (let ((v1-66 s5-6)) + (set! (-> v1-66 best-dist) (the-as float s4-1)) + (set! (-> v1-66 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-66 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-66 ignore-process0) #f) + (set! (-> v1-66 ignore-process1) #f) + (set! (-> v1-66 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-66 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-66 action-mask) (collide-action solid)) + ) + ) + (format 0 "frame: ~f~%" (ja-frame-num 0)) + (when (and (fill-and-probe-using-spheres *collide-cache* s5-6) (< 12.5 (ja-frame-num 0))) + (sound-play "mech-setdown") + (let ((v1-73 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-73 command) (sound-command set-param)) + (set! (-> v1-73 id) gp-1) + (set! (-> v1-73 params volume) -4) + (set! (-> v1-73 auto-time) 48) + (set! (-> v1-73 auto-from) 2) + (set! (-> v1-73 params mask) (the-as uint 17)) + (-> v1-73 id) + ) + (set! gp-1 (sound-play "mech-servo-up")) + (let ((v1-77 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-77 command) (sound-command set-param)) + (set! (-> v1-77 id) gp-1) + (set! (-> v1-77 params volume) -4) + (set! (-> v1-77 auto-time) 192) + (set! (-> v1-77 auto-from) 2) + (set! (-> v1-77 params mask) (the-as uint 17)) + (-> v1-77 id) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-carry-stance) + ) + ) + ) + ) + ) + (suspend) + (ja-eval) + ) + ) + (sound-play "mech-setdown") + (let ((v1-93 (vector-float*! (new 'stack-no-clear 'vector) (-> self control local-normal) 0.0))) + (vector+float*! v1-93 v1-93 (-> self control c-R-w fvec) 20480.0) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) v1-93) + ) + (target-collide-set! 'mech 0.0) + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-stance) + ) + :post (-> target-mech-carry-pickup post) + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-stance (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('change-mode) + (case (-> block param 0) + (('falling) + (if (and (-> self next-state) (= (-> self next-state name) 'target-mech-carry-drag)) + #f + (go target-mech-carry-falling) + ) + ) + (('grab) + (if (not (-> block param 1)) + #t + (go target-mech-grab) + ) + ) + ) + ) + (else + (target-mech-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-stance-mods*) + (set! (-> self control mod-surface turnvv) 20024.889) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (rot->dir-targ! (-> self control)) + (set-time! (-> self state-time)) + ) + :exit (behavior () + ((-> target-mech-carry-pickup exit)) + (rot->dir-targ! (-> self control)) + ) + :trans (behavior () + (if (and (move-legs?) + (and (< (fabs + (deg-diff (quaternion-y-angle (-> self control dir-targ)) (vector-y-angle (-> self control to-target-pt-xz))) + ) + 1820.4445 + ) + (time-elapsed? (-> self control time-of-last-zero-input) (seconds 0.05)) + ) + ) + (go target-mech-carry-walk) + ) + (if (and (cpad-pressed? (-> self control cpad number) r1) + (time-elapsed? (-> self carry pickup-time) (seconds 0.1)) + ) + (go target-mech-carry-drop) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + enter-state + (let ((a0-24 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-3 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-24 a1-3) + ) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t) (mech-can-throw?)) + (go target-mech-carry-throw) + ) + (fall-test (the-as (state object target) target-mech-carry-falling) (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 jakb-mech-carry-turn45-ja))) + (ja-channel-push! 2 (seconds 0.2)) + (ja :group! jakb-mech-carry-turn45-ja :dist 8192.0) + (ja :chan 1 :group! jakb-mech-carry-stance-ja :dist 0.0) + ) + ) + (let ((f30-0 0.0)) + (until #f + (let ((f28-0 (y-angle (-> self control)))) + (deg-diff f28-0 (quaternion-y-angle (-> self control dir-targ))) + (suspend) + (let ((f28-1 (* (deg-diff f28-0 (y-angle (-> self control))) (-> self clock frames-per-second)))) + (set! f30-0 (if (< 910.2222 (fabs f28-1)) + (seek f30-0 1.0 (* 16.0 (seconds-per-frame))) + (seek f30-0 0.0 (* 6.0 (seconds-per-frame))) + ) + ) + (let* ((f0-9 (current-cycle-distance (-> self skel))) + (v1-26 (if (= f0-9 0.0) + 0.0 + (/ f28-1 f0-9) + ) + ) + (f0-11 v1-26) + ) + (ja :num! (loop! f0-11)) + ) + ) + ) + (let ((v1-32 (-> self skel root-channel 1)) + (f0-13 (- 1.0 f30-0)) + ) + (set! (-> v1-32 frame-interp 1) f0-13) + (set! (-> v1-32 frame-interp 0) f0-13) + ) + ) + ) + #f + ) + :post target-mech-carry-post + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-walk (target) + :event (-> target-mech-carry-stance event) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control mod-surface) *mech-carry-walk-mods*) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + ) + :exit (-> target-mech-carry-pickup exit) + :trans (behavior () + (let ((gp-0 (ja-group)) + (f0-0 (ja-aframe-num 0)) + ) + (when (if (or (and (= gp-0 jakb-mech-carry-walk-ja) (>= f0-0 5.5) (>= 9.5 f0-0)) + (and (= gp-0 jakb-mech-carry-walk-ja) (>= f0-0 20.5) (>= 24.5 f0-0)) + ) + #t + ) + (when (and (< 5.0 (the-as float (-> self control unknown-word04))) + (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + ) + (set-forward-vel 0.0) + (go target-mech-carry-stance) + ) + ) + ) + (if (and (cpad-pressed? (-> self control cpad number) r1) + (time-elapsed? (-> self carry pickup-time) (seconds 0.1)) + ) + (go target-mech-carry-drop) + ) + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + enter-state + (let ((a0-24 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-2 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-24 a1-2) + ) + ) + (if (and (cpad-pressed? (-> self control cpad number) square) (can-hands? #t) (mech-can-throw?)) + (go target-mech-carry-throw) + ) + (fall-test (the-as (state object target) target-mech-carry-falling) (-> *TARGET-bank* fall-height)) + ) + :code (behavior () + (let ((f30-0 0.0)) + (let ((f28-0 (cond + ((zero? (-> self mech walk-anim-leg)) + (set! (-> self mech walk-anim-leg) 1) + 7.0 + ) + (else + (set! (-> self mech walk-anim-leg) 0) + 22.0 + ) + ) + ) + (v1-7 (ja-group)) + ) + (when (not (and v1-7 (= v1-7 jakb-mech-carry-walk-ja))) + (ja-channel-push! 2 (seconds 0.1)) + (ja :group! jakb-mech-carry-walk-ja + :num! (identity (ja-aframe f28-0 0)) + :dist (-> *TARGET-bank* mech-walk-carry-cycle-dist) + ) + (ja :chan 1 :group! jakb-mech-carry-stance-ja :dist 0.0) + ) + ) + (until #f + (if (< (-> self control ctrl-xz-vel) 4096.0) + (set-forward-vel 4096.0) + ) + (suspend) + (let* ((f0-4 (current-cycle-distance (-> self skel))) + (f28-1 (/ (-> self control ctrl-xz-vel) f0-4)) + ) + (set! (-> self control unknown-word04) + (the-as uint (+ (the-as float (-> self control unknown-word04)) f28-1)) + ) + (set! f30-0 + (seek f30-0 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 0.0 8192.0) (* 2.0 (seconds-per-frame))) + ) + (ja :num! (loop! f28-1)) + ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + ) + ) + #f + ) + :post target-mech-carry-post + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-drag (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('push) + (when (zero? (-> self control sliding-start-time)) + (set! (-> self control sliding-start-time) (+ (current-time) (the-as time-frame (-> block param 0)))) + (let ((v0-0 (the-as object #t))) + (set! (-> self control unknown-word04) (the-as uint v0-0)) + v0-0 + ) + ) + ) + (('drop) + (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons r1)) + (logclear! (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) (pad-buttons r1)) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) *null-vector*) + (target-collide-set! 'mech 0.0) + (go target-mech-stance) + ) + (else + ((-> target-mech-carry-stance event) proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control sliding-start-time) 0) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control mod-surface) *mech-carry-drag-mods*) + (set-forward-vel 0.0) + ) + :exit (behavior () + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + (let ((v1-3 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-3 command) (sound-command set-param)) + (set! (-> v1-3 id) (-> self mech thrust-sound-id)) + (set! (-> v1-3 params volume) -4) + (set! (-> v1-3 auto-time) 48) + (set! (-> v1-3 auto-from) 2) + (set! (-> v1-3 params mask) (the-as uint 17)) + (-> v1-3 id) + ) + (let ((v1-5 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-5 command) (sound-command set-param)) + (set! (-> v1-5 id) (-> self mech drag-sound-id)) + (set! (-> v1-5 params volume) -4) + (set! (-> v1-5 auto-time) 48) + (set! (-> v1-5 auto-from) 2) + (set! (-> v1-5 params mask) (the-as uint 17)) + (-> v1-5 id) + ) + ((-> target-mech-carry-pickup exit)) + ) + :trans (behavior () + (when (and (not (cpad-hold? (-> self control cpad number) r1)) + (time-elapsed? (-> self carry pickup-time) (seconds 0.5)) + ) + (sound-play "mech-drag-off") + (if (or (and (>= (-> self mech back-touch-time) (-> self state-time)) + (< (vector-vector-distance (-> self control trans) (-> self mech back-touch-trans)) 4096.0) + ) + (let ((gp-1 (new 'stack-no-clear 'collide-query))) + (let ((s5-1 (new 'stack-no-clear 'inline-array 'sphere 1))) + (dotimes (s4-0 1) + ((method-of-type sphere new) (the-as symbol (-> s5-1 s4-0)) sphere) + ) + (set! (-> s5-1 0 quad) (-> self control collision-spheres 0 prim-core world-sphere quad)) + (vector+float*! (the-as vector (-> s5-1 0)) (the-as vector (-> s5-1 0)) (-> self control c-R-w fvec) -4096.0) + (set! (-> s5-1 0 r) (-> self control collision-spheres 0 prim-core world-sphere w)) + (let ((v1-30 gp-1)) + (set! (-> v1-30 best-dist) (the-as float s5-1)) + (set! (-> v1-30 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-30 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-30 ignore-process0) #f) + (set! (-> v1-30 ignore-process1) #f) + (set! (-> v1-30 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-30 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-30 action-mask) (collide-action solid)) + ) + ) + (fill-and-probe-using-spheres *collide-cache* gp-1) + ) + ) + (send-event self 'push (seconds 0.5)) + (send-event self 'drop) + ) + ) + ) + :code (behavior () + (let ((f28-0 0.0) + (f30-0 0.0) + ) + (until #f + (let ((f0-2 + (* (vector-dot (-> self control to-target-pt-xz) (-> self control c-R-w fvec)) + (-> self control turn-to-magnitude) + ) + ) + (f26-0 0.0) + ) + (if (and (nonzero? (-> self control sliding-start-time)) (< (-> self control sliding-start-time) (current-time))) + (send-event self 'drop) + (set! f28-0 (cond + ((nonzero? (-> self control sliding-start-time)) + (let ((v1-17 (ja-group))) + (when (not (and v1-17 (= v1-17 jakb-mech-push-ja))) + (let ((v1-23 (ja-group))) + (if (and v1-23 (= v1-23 jakb-mech-pull-ja)) + (set! f26-0 (ja-aframe-num 0)) + ) + ) + (sound-play "mech-drag-push") + (ja-channel-push! 1 (seconds 0.3)) + (ja :group! jakb-mech-push-ja :num! (identity (ja-aframe f26-0 0)) :dist 16384.0) + ) + ) + (when (-> self control unknown-spool-anim00) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! f28-0 32768.0) + ) + (seek f28-0 0.0 (* 65536.0 (seconds-per-frame))) + ) + ((< 0.0 f0-2) + (let ((v1-47 (ja-group))) + (when (not (and v1-47 (= v1-47 jakb-mech-push-ja))) + (let ((v1-53 (ja-group))) + (if (and v1-53 (= v1-53 jakb-mech-pull-ja)) + (set! f26-0 (ja-aframe-num 0)) + ) + ) + (sound-play "mech-drag-push") + (ja-channel-push! 1 (seconds 0.3)) + (ja :group! jakb-mech-push-ja :num! (identity (ja-aframe f26-0 0)) :dist 16384.0) + ) + ) + (seek f28-0 49152.0 (* 24576.0 (seconds-per-frame))) + ) + ((< f0-2 0.0) + (let ((v1-71 (ja-group))) + (when (not (and v1-71 (= v1-71 jakb-mech-pull-ja))) + (let ((v1-77 (ja-group))) + (if (and v1-77 (= v1-77 jakb-mech-push-ja)) + (set! f26-0 (ja-aframe-num 0)) + ) + ) + (sound-play "mech-drag-pull") + (ja-channel-push! 1 (seconds 0.3)) + (ja :group! jakb-mech-pull-ja :num! (identity (ja-aframe f26-0 0)) :dist 16384.0) + ) + ) + (seek f28-0 -49152.0 (* 24576.0 (seconds-per-frame))) + ) + (else + (seek f28-0 0.0 (* 32768.0 (seconds-per-frame))) + ) + ) + ) + ) + ) + (set! f30-0 + (seek + f30-0 + (lerp-scale + 0.0 + 1.0 + (* (vector-vector-distance (-> self control trans) (-> self control trans-old-old)) + (-> self clock frames-per-second) + ) + 0.0 + 49152.0 + ) + (* 2.0 (seconds-per-frame)) + ) + ) + (sound-play-by-name + (static-sound-name "mech-drag-grind") + (-> self mech drag-sound-id) + (the int (* 1024.0 f30-0)) + 0 + 0 + (sound-group) + #t + ) + (set-forward-vel f28-0) + (let* ((f0-24 (current-cycle-distance (-> self skel))) + (f26-1 (/ f28-0 (* 2.0 f0-24))) + ) + (seek! + (-> self mech jump-thrust) + (lerp-scale 0.0 245760.0 (fabs f28-0) 0.0 49152.0) + (* 491520.0 (seconds-per-frame)) + ) + (let ((v1-114 (ja-group))) + (if (and v1-114 (or (= v1-114 jakb-mech-push-ja) (= v1-114 jakb-mech-pull-ja))) + (ja :num! (loop! f26-1)) + ) + ) + ) + (suspend) + 0 + ) + ) + #f + ) + :post target-mech-carry-post + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-falling (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (let ((v0-0 (target-mech-bonk-event-handler proc argc message block))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + ((-> target-mech-carry-stance event) proc argc message block) + ) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *mech-carry-jump-mods*) + (set-time! (-> self state-time)) + ) + :exit (-> target-mech-carry-pickup exit) + :trans (behavior () + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-mech-carry-hit-ground #f) + ) + (when (if (and (< (target-move-dist (-> *TARGET-bank* stuck-time)) (-> *TARGET-bank* stuck-distance)) + (time-elapsed? (-> self state-time) (seconds 0.05)) + (not (and *cheat-mode* (cpad-hold? (-> self control cpad number) r2))) + ) + #t + ) + (logior! (-> self control status) (collide-status on-surface)) + (go target-mech-carry-hit-ground 'stuck) + ) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (= v1-2 jakb-mech-carry-jump-loop-ja)) + ) + (else + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! jakb-mech-carry-jump-loop-ja) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (suspend) + ) + ) + ) + ) + (ja-no-eval :group! jakb-mech-carry-jump-loop-ja :num! (loop!) :frame-num 0.0) + (until #f + (suspend) + (ja :group! jakb-mech-carry-jump-loop-ja :num! (loop!)) + ) + #f + ) + :post target-mech-carry-post + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-hit-ground (target) + :event (-> target-mech-carry-falling event) + :enter (behavior ((arg0 symbol)) + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self mech thrust-sound-id)) + (set! (-> v1-0 params volume) -4) + (set! (-> v1-0 auto-time) 48) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 params mask) (the-as uint 17)) + (-> v1-0 id) + ) + (rot->dir-targ! (-> self control)) + (cond + ((= arg0 'stuck) + ) + (else + (target-land-effect) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.3)) + ) + ) + (set! (-> self control last-running-attack-end-time) 0) + (set! (-> self control last-attack-end-time) 0) + (if (!= (-> self control ground-pat material) (pat-material ice)) + (delete-back-vel) + ) + (set! (-> self control mod-surface) *mech-stance-mods*) + (set! (-> self control mod-surface turnvv) 0.0) + (start-bobbing! + (-> self water) + (lerp-scale 0.0 4096.0 (-> self control ground-impact-vel) 40960.0 102400.0) + 600 + 1500 + ) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags lleg-still rleg-still)) + ((-> target-mech-carry-pickup exit)) + ) + :trans (behavior () + (when (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + enter-state + (let ((a0-16 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-2 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-16 a1-2) + ) + ) + (if (and (!= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + (let ((v1-26 (ja-group))) + (and (and v1-26 (= v1-26 jakb-mech-carry-jump-land-ja)) (>= (ja-aframe-num 0) 30.0)) + ) + ) + (go target-mech-carry-walk) + ) + (fall-test (the-as (state object target) target-mech-carry-falling) (-> *TARGET-bank* fall-height)) + ) + :code (behavior ((arg0 symbol)) + (target-hit-ground-anim #f (are-still?)) + (go target-mech-carry-stance) + ) + :post target-mech-carry-post + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-jump (target) + :event (-> target-mech-carry-falling event) + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (sound-play "mech-jump") + (set! (-> self control mod-surface) *mech-carry-jump-mods*) + (set! (-> self control unknown-float36) + (fmax 0.0 (fmin 1.0 (* 0.00004359654 (+ -11468.8 (-> self control ctrl-xz-vel))))) + ) + ) + :exit (behavior () + (rot->dir-targ! (-> self control)) + ((-> target-mech-carry-pickup exit)) + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + (target-exit) + ) + :trans (behavior () + (set! (-> self control unknown-float36) + (fmax + (-> self control unknown-float36) + (* 0.003921569 (the float (-> *cpad-list* cpads (-> self control cpad number) abutton 6))) + ) + ) + ((-> target-mech-carry-falling trans)) + (mod-var-jump #t #f (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + (cond + ((>= (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 0.0) + (set! (-> self mech jump-thrust) 0.0) + ) + (else + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech thruster-flame-width) 0.0) + (set! (-> self mech thruster-flame-length) 0.0) + ) + ) + ) + :code (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 1 (seconds 0.05)) + (ja :group! jakb-mech-carry-jump-ja :num! min) + (suspend) + (ja :group! jakb-mech-carry-jump-ja :num! (+!)) + (suspend) + (until (ja-done? 0) + (let ((f30-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f0-4 (- 10.0 (ja-aframe-num 0))) + (gp-1 (-> self skel root-channel 0)) + ) + (set! (-> gp-1 param 0) (the float (+ (-> gp-1 frame-group frames num-frames) -1))) + (let ((v1-27 (and (< 0.0 f30-0) (< 0.0 f0-4)))) + (set! (-> gp-1 param 1) + (if v1-27 + (fmin (fmin 3.0 f0-4) (/ (* 5.0 f0-4) (the float (time-to-apex f30-0 -245760.0)))) + 1.8 + ) + ) + ) + (joint-control-channel-group-eval! gp-1 (the-as art-joint-anim #f) num-func-seek!) + ) + (suspend) + ) + (go target-mech-carry-falling) + ) + :post target-mech-carry-post + ) + +;; failed to figure out what this is: +(defstate target-mech-carry-throw (target) + :event (-> target-mech-carry-drop event) + :enter (behavior () + (set! (-> self control mod-surface) *mech-walk-mods*) + (set-time! (-> self state-time)) + (set-forward-vel 0.0) + (set! (-> self mech stick-off) (the-as basic #t)) + ) + :exit (-> target-mech-carry-pickup exit) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-mech-carry-throw-ja :num! (seek! (ja-aframe 16.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (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) 'carry-info) + (let ((gp-1 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-3)))) + (if gp-1 + (seek! (-> gp-1 grab-trans-blend) 1.0 (* 4.0 (seconds-per-frame))) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 16.0 0))) + ) + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) (process->ppointer self)) + (set! (-> a1-7 num-params) 0) + (set! (-> a1-7 message) 'carry-info) + (let ((v1-30 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-7)))) + (when v1-30 + (let ((s4-0 (-> v1-30 process 0 control)) + (gp-3 (new 'stack-no-clear 'collide-query)) + ) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'sphere 1))) + (dotimes (s3-0 1) + ((method-of-type sphere new) (the-as symbol (-> s5-0 s3-0)) sphere) + ) + (set! (-> s5-0 0 quad) (-> s4-0 root-prim prim-core world-sphere quad)) + (let ((v1-38 gp-3)) + (set! (-> v1-38 best-dist) (the-as float s5-0)) + (set! (-> v1-38 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-38 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-38 ignore-process0) #f) + (set! (-> v1-38 ignore-process1) #f) + (set! (-> v1-38 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-38 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-38 action-mask) (collide-action solid)) + ) + ) + (when (fill-and-probe-using-spheres *collide-cache* gp-3) + (ja-no-eval :num! (seek! 0.0)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-carry-stance) + ) + ) + ) + ) + ) + (let ((v1-48 (vector-float*! (new 'stack-no-clear 'vector) (-> self control local-normal) 2048.0))) + (vector+float*! v1-48 v1-48 (-> self control c-R-w fvec) 131072.0) + (send-event (handle->process (-> self carry other)) 'drop (-> self carry) v1-48) + ) + (target-collide-set! 'normal 0.0) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (go target-mech-stance) + ) + :post (-> target-mech-carry-pickup post) + ) + +;; failed to figure out what this is: +(defstate target-mech-get-on (target) + :event target-generic-event-handler + :exit (behavior () + (target-mech-exit) + (set! (-> self mech stick-off) #f) + (set! (-> self neck flex-blend) 1.0) + (logclear! (-> self target-flags) (target-flags tf5)) + ) + :code (behavior ((arg0 handle)) + (logior! (-> self target-flags) (target-flags tf5)) + (ja-channel-set! 1) + (set! (-> self control mod-surface) *empty-mods*) + (send-event (ppointer->process (-> self manipy)) 'draw #t) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-vector37 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector38 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector39 quad) (-> self control quat quad)) + (set! (-> self control unknown-vector40 quad) (-> self control quat quad)) + (let* ((gp-1 (handle->process arg0)) + (v1-23 (if (type? gp-1 process-drawable) + gp-1 + ) + ) + ) + (when v1-23 + (set! (-> self control unknown-vector38 quad) (-> (the-as process-drawable v1-23) root trans quad)) + (set! (-> self control unknown-vector40 quad) (-> (the-as process-drawable v1-23) root quat quad)) + ) + ) + (set! (-> self mech mech-trans quad) (-> self control unknown-vector38 quad)) + (quaternion-copy! + (the-as quaternion (-> self mech mech-quat)) + (the-as quaternion (-> self control unknown-vector40)) + ) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (set! (-> self mech stick-off) (the-as basic #t)) + (ja-no-eval :group! jakb-mech-get-on-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (let ((f30-0 (sin (lerp-scale 0.0 16384.0 (ja-aframe-num 0) 70.0 80.0)))) + (let ((f28-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) 70.0 80.0))) + (vector-lerp! + (-> self control trans) + (-> self control unknown-vector37) + (-> self control unknown-vector38) + f30-0 + ) + (set! (-> self control trans y) + (lerp (-> self control unknown-vector37 y) (-> self control unknown-vector38 y) f28-0) + ) + ) + (quaternion-slerp! + (-> self control quat-for-control) + (the-as quaternion (-> self control unknown-vector39)) + (the-as quaternion (-> self control unknown-vector40)) + f30-0 + ) + ) + (rot->dir-targ! (-> self control)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (suspend) + (ja :num! (seek!)) + ) + (go target-mech-stance) + ) + :post (behavior () + (target-no-move-post) + (target-mech-effect) + ) + ) + +;; failed to figure out what this is: +(defstate target-mech-get-up (target) + :event target-generic-event-handler + :exit (behavior () + (target-mech-exit) + (set! (-> self mech stick-off) #f) + (set! (-> self neck flex-blend) 1.0) + (logclear! (-> self target-flags) (target-flags tf5)) + ) + :code (behavior ((arg0 handle)) + (logior! (-> self target-flags) (target-flags tf5)) + (ja-channel-set! 1) + (set! (-> self control mod-surface) *empty-mods*) + (send-event (ppointer->process (-> self manipy)) 'draw #t) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-vector37 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector38 quad) (-> self control trans quad)) + (set! (-> self control unknown-vector39 quad) (-> self control quat quad)) + (set! (-> self control unknown-vector40 quad) (-> self control quat quad)) + (let* ((gp-1 (handle->process arg0)) + (v1-23 (if (type? gp-1 process-drawable) + gp-1 + ) + ) + ) + (when v1-23 + (set! (-> self control unknown-vector38 quad) (-> (the-as process-drawable v1-23) root trans quad)) + (set! (-> self control unknown-vector40 quad) (-> (the-as process-drawable v1-23) root quat quad)) + ) + ) + (set! (-> self mech mech-trans quad) (-> self control unknown-vector38 quad)) + (quaternion-copy! + (the-as quaternion (-> self mech mech-quat)) + (the-as quaternion (-> self control unknown-vector40)) + ) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (set! (-> self mech stick-off) (the-as basic #t)) + (ja-no-eval :group! jakb-mech-get-on-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (let ((f30-0 (sin (lerp-scale 0.0 16384.0 (ja-aframe-num 0) 70.0 80.0)))) + (let ((f28-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) 70.0 80.0))) + (vector-lerp! + (-> self control trans) + (-> self control unknown-vector37) + (-> self control unknown-vector38) + f30-0 + ) + (set! (-> self control trans y) + (lerp (-> self control unknown-vector37 y) (-> self control unknown-vector38 y) f28-0) + ) + ) + (quaternion-slerp! + (-> self control quat-for-control) + (the-as quaternion (-> self control unknown-vector39)) + (the-as quaternion (-> self control unknown-vector40)) + f30-0 + ) + ) + (rot->dir-targ! (-> self control)) + (set! (-> self alt-cam-pos quad) (-> self control camera-pos quad)) + (suspend) + (ja :num! (seek!)) + ) + (go target-mech-stance) + ) + :post (behavior () + (target-no-move-post) + (target-mech-effect) + ) + ) + +;; failed to figure out what this is: +(defstate target-mech-shield (target) + :event target-mech-handler + :enter (behavior () + (vector-reset! (-> self control transv)) + (set! (-> self mech stick-off) (the-as basic #t)) + (send-event (handle->process (-> self mech shield-handle)) 'enabled) + ) + :exit (behavior () + (set! (-> self mech stick-off) #f) + (send-event (handle->process (-> self mech shield-handle)) 'disabled) + (sound-stop (-> self mech shield-sound-id)) + ) + :trans (behavior () + (sound-play "mech-shieldloop" :id (-> self mech shield-sound-id)) + (if (or (not (handle->process (-> self mech shield-handle))) + (not (logtest? (-> *cpad-list* cpads (-> self control cpad number) button0-abs 0) (pad-buttons circle))) + ) + (go target-mech-stance) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-mech-get-off-ja :num! (seek! (ja-aframe 30.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 30.0 0))) + ) + (sleep-code) + ) + :post target-mech-post + ) + +;; failed to figure out what this is: +(defstate target-mech-get-off (target) + :event target-generic-event-handler + :exit (behavior () + ((-> target-mech-start exit)) + (logclear! (-> self target-flags) (target-flags tf5)) + ) + :code (behavior () + (logior! (-> self target-flags) (target-flags tf5)) + (set! (-> self control mod-surface) *empty-mods*) + (rot->dir-targ! (-> self control)) + (set-setting! 'slave-options 'clear 0.0 (cam-slave-options BIKE_MODE)) + (remove-setting! 'fov) + (remove-setting! 'head-offset) + (send-event *camera* 'set-dist #f #f) + (set! (-> self neck flex-blend) 0.0) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-mech-get-off-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (when (< 51.0 (ja-aframe-num 0)) + (logior! (-> self target-flags) (target-flags tf6)) + (vector<-cspace! (-> self alt-cam-pos) (joint-node jakb-lod0-jg Rankle)) + ) + (suspend) + (ja :num! (seek!)) + ) + (process-spawn + mech + :init mech-init + (-> self mech entity) + (-> self control trans) + (process->handle self) + (-> self mech shield-value) + :name "mech" + :to self + ) + (rot->dir-targ! (-> self control)) + (ja-post) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector<-cspace! gp-1 (joint-node jakb-lod0-jg main)) + (+! (-> gp-1 y) -9011.2) + (move-to-point! (-> self control) gp-1) + ) + (send-event *camera* 'ease-in) + (ja-channel-set! 0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (let ((v1-66 (new-stack-vector0))) + (let ((f0-13 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-66 (-> self control transv) (vector-float*! v1-66 (-> self control dynam gravity-normal) f0-13)) + ) + (let* ((f0-14 (vector-length v1-66)) + (f1-2 f0-14) + (f2-0 -49152.0) + (a0-36 (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-66 v1-66 (/ f0-14 f1-2)) + ) + ) + ) + (go target-falling a0-36) + ) + ) + ) + :post (-> target-mech-get-on post) + ) + +;; failed to figure out what this is: +(defstate target-mech-grab (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + (-> self state name) + ) + (else + (case message + (('end-mode) + (case (-> block param 0) + (('grab) + (go target-mech-stance) + ) + ) + ) + (('clone-anim) + (go target-mech-clone-anim (process->handle (the-as process (-> block param 0)))) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + ) + ) + :enter (behavior () + (set! (-> self control mod-surface) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self target-flags) (target-flags tf2)) + (logior! (-> self focus-status) (focus-status grabbed)) + (set! (-> self mech stick-off) (the-as basic #t)) + (sound-stop (-> self mech engine-sound-id)) + (sound-stop (-> self mech thrust-sound-id)) + (sound-stop (-> self mech drag-sound-id)) + (sound-stop (-> self mech whine-sound-id)) + ) + :exit (behavior () + (target-effect-exit) + (set! (-> self mech stick-off) #f) + (logclear! (-> self target-flags) (target-flags tf2)) + (logclear! (-> self focus-status) (focus-status grabbed)) + (logclear! (-> self water flags) (water-flag jump-out)) + ((-> target-mech-start exit)) + ) + :code (-> target-mech-stance code) + :post target-mech-post + ) + +;; failed to figure out what this is: +(defstate target-mech-clone-anim (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (if (and (= message 'trans) (= (-> block param 0) 'restore)) + (set! (-> self control unknown-word04) (the-as uint #f)) + ) + ((-> target-mech-grab event) proc argc message block) + ) + :enter (-> target-clone-anim enter) + :exit (behavior () + (set! (-> self control draw-offset y) (the-as float (-> self control unknown-word04))) + (set! (-> self control cspace-offset y) (-> self control draw-offset y)) + (send-event (ppointer->process (-> self sidekick)) 'matrix #f) + ((-> target-clone-anim exit)) + ((-> target-mech-start exit)) + (vector-reset! (-> self control transv)) + ) + :code (behavior ((arg0 handle)) + (set! (-> self control unknown-word04) (the-as uint (-> self control draw-offset y))) + (set! (-> self control draw-offset y) 0.0) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (clone-anim arg0 #t "") + (go target-mech-stance) + ) + :post (behavior () + (vector+! (-> self mech mech-trans) (-> self control trans) (-> self control cspace-offset)) + (quaternion-copy! (the-as quaternion (-> self mech mech-quat)) (-> self control quat)) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (target-no-ja-move-post) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/mech/mech_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/mech_REF.gc new file mode 100644 index 0000000000..2dcc52e345 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/mech/mech_REF.gc @@ -0,0 +1,534 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type mech +(deftype mech (process-drawable) + ((root collide-shape-moving :override) + (extra-trans vector :inline) + (condition int32) + (shadow-backup shadow-geo) + (rider handle) + (shield-value float) + (nav-sphere-handle handle) + (probe-time time-frame) + ) + (:state-methods + wait-for-start + idle + (pickup (state mech)) + wait-for-return + ) + (:methods + (mech-method-24 (_type_) none) + ) + ) + +;; definition for method 3 of type mech +(defmethod inspect ((this mech)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Textra-trans: ~`vector`P~%" (-> this extra-trans)) + (format #t "~2Tcondition: ~D~%" (-> this condition)) + (format #t "~2Tshadow-backup: ~A~%" (-> this shadow-backup)) + (format #t "~2Trider: ~D~%" (-> this rider)) + (format #t "~2Tshield-value: ~f~%" (-> this shield-value)) + (format #t "~2Tnav-sphere-handle: ~D~%" (-> this nav-sphere-handle)) + (format #t "~2Tprobe-time: ~D~%" (-> this probe-time)) + (label cfg-4) + this + ) + +;; definition for method 24 of type mech +;; WARN: Return type mismatch int vs none. +(defmethod mech-method-24 ((this mech)) + (if (nonzero? (-> this part)) + (spawn (-> this part) (-> this root trans)) + ) + (update! (-> this sound)) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate wait-for-start (mech) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack 'bonk) + (send-event proc 'target-mech-get-off (seconds 0.3)) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + (the-as structure #f) + ) + (('touch) + (send-event proc 'target-mech-get-off (seconds 0.3)) + (send-shoves (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0) + (the-as structure #f) + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-2 (the-as structure (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-2)) + v0-2 + ) + ) + (else + (set! (-> self draw shadow) #f) + (the-as structure #f) + ) + ) + ) + ) + ) + :exit (behavior () + (set! (-> self root root-prim prim-core action) (collide-action)) + (set! (-> self root penetrated-by) (the-as penetrate -1)) + ) + :code (behavior () + (go-virtual idle) + ) + ) + +;; failed to figure out what this is: +(defstate idle (mech) + :virtual #t + :event (-> (method-of-type mech wait-for-start) event) + :enter (behavior () + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (let ((s5-0 (find-nearest-nav-mesh (-> self root trans) 8192.0))) + (when s5-0 + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-z-quaternion! gp-0 (-> self root quat)) + (vector-normalize! gp-0 5120.0) + (vector+! gp-0 gp-0 (-> self root trans)) + (set! (-> self nav-sphere-handle) + (ppointer->handle + (process-spawn simple-nav-sphere #x46266666 gp-0 s5-0 -1 :name "simple-nav-sphere" :to self) + ) + ) + ) + ) + ) + ) + :exit (behavior () + (send-event (handle->process (-> self nav-sphere-handle)) 'die-fast) + ((-> (method-of-type mech wait-for-start) exit)) + ) + :code (behavior () + (change-parent self *entity-pool*) + (ja-channel-set! 1) + (ja :group! mech-mech-idle-ja) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + 0.0 + (let ((f30-0 20480.0)) + (until #f + (when (and (logtest? (-> self draw status) (draw-control-status on-screen)) + (time-elapsed? (-> self probe-time) (seconds 1)) + ) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + (set-time! (-> self probe-time)) + ) + (when (and (and *target* (and (>= f30-0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (focus-test? *target* in-head pole light board mech dark)) + (can-display-query? self "mech" -99.0) + (-> *setting-control* user-current pilot) + ) + (let ((gp-0 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-31 gp-0)) + (set! (-> v1-31 width) (the float 340)) + ) + (let ((v1-32 gp-0)) + (set! (-> v1-32 height) (the float 80)) + ) + (let ((v1-33 gp-0) + (a0-19 (-> *setting-control* user-default language)) + ) + (set! (-> v1-33 scale) (if (or (= a0-19 (language-enum korean)) (= a0-19 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id text-0083) #f) + gp-0 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (if (and (cpad-pressed? 0 triangle) (send-event *target* 'change-mode 'mech self (-> self shield-value))) + (go-virtual pickup (method-of-object self wait-for-return)) + ) + ) + (if *target* + (look-at! + (-> *target* neck) + (vector+! + (new 'stack-no-clear 'vector) + (the-as vector (-> self root root-prim prim-core)) + (new 'static 'vector :y 2048.0 :w 1.0) + ) + 'nothing-special + self + ) + ) + (mech-method-24 self) + (suspend) + ) + ) + #f + ) + :post ja-post + ) + +;; failed to figure out what this is: +(defstate pickup (mech) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('draw) + (ja-channel-set! 1) + (ja :group! mech-mech-idle-ja) + (set! (-> self root root-prim prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> self root penetrated-by) (penetrate)) + (transform-post) + ) + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('touch 'attack 'bonk) + #f + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as object (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ) + :enter (behavior ((arg0 (state mech))) + (let ((t9-0 (-> arg0 enter))) + (if t9-0 + (t9-0) + ) + ) + ) + :code (behavior ((arg0 (state mech))) + (ja-channel-set! 0) + (ja-post) + (while (zero? (ja-group-size)) + (if (or (not *target*) (or (< 24576.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + (go arg0) + ) + (mech-method-24 self) + (suspend) + ) + (while (and *target* (focus-test? *target* mech)) + (mech-method-24 self) + (suspend) + ) + (let ((s5-0 (current-time))) + (until (time-elapsed? s5-0 (seconds 1)) + (mech-method-24 self) + (suspend) + ) + ) + (go arg0) + ) + ) + +;; failed to figure out what this is: +(defstate wait-for-return (mech) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('trans) + (vector+! (the-as vector (-> block param 0)) (-> self root trans) (-> self extra-trans)) + ) + (('shadow) + (cond + ((-> block param 0) + (let ((v0-1 (the-as structure (-> self shadow-backup)))) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + ) + (else + (set! (-> self draw shadow) #f) + (the-as structure #f) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-set! 0) + (ja-post) + (cleanup-for-death self) + ) + ) + +;; definition for function mech-init +;; INFO: Used lq/sq +(defbehavior mech-init mech ((arg0 entity-actor) (arg1 matrix3) (arg2 handle) (arg3 float)) + (let ((s2-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s2-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s2-0 reaction) cshape-reaction-default) + (set! (-> s2-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s2-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle obstacle-for-jak)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid can-ride no-standon)) + (set! (-> v1-6 transform-index) 0) + (set-vector! (-> v1-6 local-sphere) 0.0 6553.6 5324.8 6553.6) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-6) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-9 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> self root) s2-0) + ) + (set! (-> self rider) arg2) + (when arg0 + (process-entity-set! self arg0) + (process-drawable-from-entity! self arg0) + (set-yaw-angle-clear-roll-pitch! (-> self root) (res-lump-float arg0 'rotoffset)) + ) + (when arg1 + (set! (-> self root trans quad) (-> arg1 vector 0 quad)) + (quaternion-copy! (-> self root quat) (the-as quaternion (-> arg1 vector 1))) + ) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self draw shadow-ctrl) *mech-shadow-control*) + (let ((v1-27 (-> self node-list data))) + (set! (-> v1-27 0 param0) (the-as (function cspace transformq none) cspace<-transformq+trans!)) + (set! (-> v1-27 0 param1) (the-as basic (-> self root trans))) + (set! (-> v1-27 0 param2) (the-as basic (-> self extra-trans))) + ) + (set! (-> self condition) (res-lump-value arg0 'index int :time -1000000000.0)) + (set! (-> self fact) + (new 'process 'fact-info self (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (set! (-> self shield-value) arg3) + (set! (-> self nav-sphere-handle) (the-as handle #f)) + (if (-> self entity) + (move-to-ground + (-> self root) + 8192.0 + 40960.0 + #t + (collide-spec backgnd obstacle hit-by-player-list hit-by-others-list pusher) + ) + ) + (set! (-> self sound) + (new 'process 'ambient-sound (static-sound-spec "zoom-teleport" :group 1 :fo-max 30) (-> self root trans) 0.0) + ) + (set! (-> self draw light-index) (the-as uint 30)) + (if (handle->process arg2) + (go-virtual idle) + (go-virtual wait-for-start) + ) + ) + +;; definition for method 11 of type mech +(defmethod init-from-entity! ((this mech) (arg0 entity-actor)) + (mech-init arg0 (the-as matrix3 #f) (the-as handle #f) 100.0) + ) + +;; definition of type mech-target +(deftype mech-target (process-drawable) + ((parent (pointer target) :override) + ) + (:state-methods + idle + active + ) + ) + +;; definition for method 3 of type mech-target +(defmethod inspect ((this mech-target)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(defskelgroup skel-mech-target mech mech-target-lod0-jg mech-target-idle-ja + ((mech-target-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4) + ) + +;; failed to figure out what this is: +(defstate idle (mech-target) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('look-at-point) + (set-time! (-> self state-time)) + (go-virtual active) + ) + ) + ) + :trans (behavior () + (if (and (and *target* (and (>= 98304.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (focus-test? *target* mech) + ) + (go-virtual active) + ) + ) + :code (behavior () + (while (< 0.0 (-> self root scale x)) + (seek! (-> self root scale x) 0.0 (* 8.0 (seconds-per-frame))) + (set! (-> self root scale y) (-> self root scale x)) + (ja-post) + (suspend) + ) + (logior! (-> self draw status) (draw-control-status no-draw)) + (ja-post) + (sleep-code) + ) + ) + +;; failed to figure out what this is: +(defstate active (mech-target) + :virtual #t + :event (-> (method-of-type mech-target idle) event) + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (if (and (or (or (not *target*) (or (< 106496.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + (not (logtest? (focus-status mech) (-> *target* focus-status))) + ) + (time-elapsed? (-> self state-time) (seconds 10)) + ) + (go-virtual idle) + ) + ) + :code (behavior () + (sound-play "mech-target") + (let ((f30-0 0.0)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (while (< (-> self root scale x) 1.0) + (seek! (-> self root scale x) 1.0 (* 8.0 (seconds-per-frame))) + (set! (-> self root scale y) (-> self root scale x)) + (set! f30-0 (seek f30-0 1.0 (* 2.0 (seconds-per-frame)))) + (ja :num! (loop! f30-0)) + (ja-post) + (suspend) + ) + (until #f + (set! f30-0 (seek f30-0 1.0 (* 0.25 (seconds-per-frame)))) + (ja :num! (loop! f30-0)) + (ja-post) + (suspend) + ) + ) + #f + ) + ) + +;; definition for function mech-target-init +;; INFO: Used lq/sq +(defbehavior mech-target-init mech ((arg0 vector) (arg1 quaternion) (arg2 entity-actor)) + (process-entity-set! self arg2) + (when (not (and (-> self level) (logtest? (level-flags lf16) (-> self level info level-flags)))) + (dotimes (v1-4 (-> *level* length)) + (let ((a0-7 (-> *level* level v1-4))) + (when (= (-> a0-7 status) 'active) + (when (logtest? (level-flags lf16) (-> a0-7 info level-flags)) + (set! (-> self level) a0-7) + (goto cfg-12) + ) + ) + ) + ) + ) + (label cfg-12) + (set! (-> self root) (the-as collide-shape-moving (new 'process 'trsqv))) + (set! (-> self root trans quad) (-> arg0 quad)) + (quaternion-copy! (-> self root quat) arg1) + (set! (-> self root scale x) 0.0) + (set! (-> self root scale y) 0.0) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-mech-target" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (go-virtual wait-for-start) + ) + +;; definition for function mech-target-spawn +;; WARN: Return type mismatch (pointer process) vs (pointer mech-target). +(defun mech-target-spawn ((arg0 vector) (arg1 process) (arg2 quaternion) (arg3 entity-actor)) + (process-spawn mech-target :init mech-target-init arg0 arg2 arg3 :name "mech-target" :to arg1) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/mech/target-mech_REF.gc b/test/decompiler/reference/jak3/engine/target/mech/target-mech_REF.gc new file mode 100644 index 0000000000..bd3cc58f3e --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/mech/target-mech_REF.gc @@ -0,0 +1,1875 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type mech-shield +(deftype mech-shield (shield-sphere) + () + ) + +;; definition for method 3 of type mech-shield +(defmethod inspect ((this mech-shield)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type shield-sphere inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; definition for function mech-shield-init-by-other +;; INFO: Used lq/sq +(defbehavior mech-shield-init-by-other mech-shield ((arg0 shield-sphere-spawn-params)) + (set! (-> self level) (level-get *level* 'precura)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self sphere-size) (-> arg0 sphere-size)) + (set! (-> self owner) (-> arg0 owner)) + (set! (-> self track-joint) (-> arg0 track-joint)) + (set! (-> self offset-vec quad) (-> arg0 offset-vec quad)) + (init-collision! self) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-shield-sphere" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set-vector! (-> self root scale) (-> self sphere-size) (-> self sphere-size) (-> self sphere-size) 1.0) + (set! (-> self shield-type) (-> arg0 shield-type)) + (case (-> self shield-type) + (((shield-type shield-type-0)) + (set! (-> self heat-info damage-scalar) (/ 1.0 (the float (-> arg0 shield-strength)))) + (let ((s5-1 (new 'stack-no-clear 'shield-sphere-distort-spawn-params))) + (set! (-> s5-1 owner) (process->handle self)) + (set! (-> s5-1 sphere-size) (-> self sphere-size)) + (let ((s4-1 (the-as process #f))) + (let* ((s3-0 (get-process *default-dead-pool* shield-sphere-distort #x4000 1)) + (v1-22 (when s3-0 + (let ((t9-6 (method-of-type process activate))) + (t9-6 s3-0 self "process" (the-as pointer #x70004000)) + ) + (run-now-in-process s3-0 shield-sphere-distort-init-by-other s5-1) + (-> s3-0 ppointer) + ) + ) + ) + (if v1-22 + (set! s4-1 (-> v1-22 0)) + ) + ) + (set! (-> self heat-info distort-handle) (process->handle s4-1)) + ) + ) + ) + (((shield-type shield-type-1)) + (set! (-> self toggle-info enable-time) (-> arg0 enable-time)) + (set! (-> self heat-info last-heat-time) (-> arg0 disable-time)) + ) + ) + (ja-no-eval :group! (ja-group) :num! (loop!) :frame-num 0.0) + (ja-post) + (logior! (-> self draw status) (draw-control-status disable-fog)) + (let ((gp-1 (handle->process (-> arg0 owner)))) + (when (if (type? gp-1 process-focusable) + gp-1 + ) + ) + ) + (set! (-> self event-hook) (-> (method-of-type shield-sphere shield-enabled) event)) + (init-and-go! self) + ) + +;; failed to figure out what this is: +(defstate shield-disabled (mech-shield) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (shield-event-handler self proc argc message block) + ) + :enter (behavior () + (toggle-shield self #f) + (set-time! (-> self state-time)) + ) + :trans (behavior () + (shield-enabled-trans self) + (if (and (= (-> self shield-type) (shield-type shield-type-1)) + (time-elapsed? (-> self state-time) (-> self heat-info last-heat-time)) + ) + (go-virtual shield-enabled) + ) + ) + :code sleep-code + :post (behavior () + (shield-post self) + ) + ) + +;; definition for method 37 of type mech-shield +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! ((this mech-shield)) + (let ((s5-0 (new 'process 'collide-shape-moving this (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-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec obstacle impenetrable-obj)) + (set! (-> v1-6 prim-core action) (collide-action)) + (set-vector! (-> v1-6 local-sphere) 0.0 0.0 -4096.0 (+ 4096.0 (* 4096.0 (-> this sphere-size)))) + (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! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; definition for method 15 of type hud-heatmeter +;; WARN: Return type mismatch int vs none. +(defmethod draw ((this hud-heatmeter)) + (set-hud-piece-position! + (the-as hud-sprite (-> this sprites)) + 256 + (the int (+ 25.0 (* -100.0 (-> this offset)))) + ) + (set! (-> this sprites 0 pos z) #xfffff0) + (set-as-offset-from! + (-> this sprites 1) + (the-as vector4w (-> this sprites)) + (+ (the int (* 0.128 (the float (-> this values 0 current)))) -63) + 1 + ) + (set! (-> this sprites 1 pos z) #xfffff0) + ((method-of-type hud draw) this) + 0 + (none) + ) + +;; definition for method 16 of type hud-heatmeter +;; WARN: Return type mismatch int vs none. +(defmethod update-values! ((this hud-heatmeter)) + (set! (-> this values 0 target) (the int (* 1000.0 (-> *game-info* distance)))) + (logclear! (-> this flags) (hud-flags disable)) + ((method-of-type hud update-values!) this) + 0 + (none) + ) + +;; definition for method 17 of type hud-heatmeter +;; WARN: Return type mismatch int vs none. +(defmethod init-callback ((this hud-heatmeter)) + (set! (-> this gui-id) + (add-process *gui-control* this (gui-channel hud-upper-center-2) (gui-action hidden) (-> this name) 81920.0 0) + ) + (logior! (-> this flags) (hud-flags show)) + (set! (-> this sprites 0 tid) + (the-as texture-id (lookup-texture-by-id (new 'static 'texture-id :index #x2 :page #xa76))) + ) + (set! (-> this sprites 0 flags) (hud-sprite-flags hsf3)) + (set! (-> this sprites 0 scale-x) 1.2) + (set! (-> this sprites 0 scale-y) 1.2) + (set! (-> this sprites 1 tid) + (the-as texture-id (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xa76))) + ) + (set! (-> this sprites 1 flags) (hud-sprite-flags hsf3)) + (set! (-> this sprites 1 scale-x) 1.8) + (set! (-> this sprites 1 scale-y) 1.8) + 0 + (none) + ) + +;; definition for symbol *mech-stance-mods*, type surface +(define *mech-stance-mods* + (new 'static 'surface + :name 'run + :turnv 18204262.0 + :turnvf 0.03 + :turnvv 40049.777 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :fric 0.3 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 4.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :slope-up-traction 1.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + (seek! (-> self control did-move-to-pole-or-max-jump-height) 0.0 (* 127431.11 (seconds-per-frame))) + (seek! + (-> self control did-move-to-pole-or-max-jump-height) + (* (-> self control turn-to-magnitude) (-> arg0 turnvv)) + (* 127431.11 (seconds-per-frame)) + ) + ) + (set! (-> arg0 turnvv) (-> self control did-move-to-pole-or-max-jump-height)) + (when (= (-> arg2 name) '*edge-surface*) + (set! (-> arg0 target-speed) 40960.0) + (set! (-> arg0 transv-max) 40960.0) + (set! (-> arg0 seek0) (* 1.6666 (-> arg2 seek0))) + (set! (-> arg0 seek90) (* 1.6666 (-> arg2 seek90))) + (set! (-> arg0 seek180) (* 1.6666 (-> arg2 seek180))) + ) + ) + ) + ) + :flags (surface-flag look-around no-turn-around) + ) + ) + +;; definition for symbol *mech-walk-mods*, type surface +(define *mech-walk-mods* + (new 'static 'surface + :name 'run + :turnv 32768.0 + :turnvf 120.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :vel-turn -1.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 1.6666 + :seek90 1.6666 + :seek180 1.0 + :fric 0.1 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mult-hook (lambda :behavior target + ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) + (case arg3 + ((1) + (when (= (-> arg2 name) '*edge-surface*) + (let ((v1-5 (vector-flatten! + (new 'stack-no-clear 'vector) + (vector-negate! (new-stack-vector0) (-> self control dynam gravity-normal)) + (-> self control local-normal) + ) + ) + ) + (set! (-> arg0 vel-turn) 0.0) + (vector+float*! (-> self control transv) (-> self control transv) v1-5 (* 409600.0 (seconds-per-frame))) + ) + ) + ) + ) + ) + :flags (surface-flag look-around no-turn-around) + ) + ) + +;; definition for symbol *mech-jump-mods*, type surface +(define *mech-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 90.0 + :turnvv 18204.445 + :turnvvf 30.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 40960.0 + :target-speed 40960.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag no-turn-around air) + ) + ) + +;; definition for symbol *mech-punch-mods*, type surface +(define *mech-punch-mods* (new 'static 'surface + :name 'punch + :turnv 131072.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 91750.4 + :target-speed 122880.0 + :seek90 0.5 + :seek180 0.15 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 0.25 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'attack + :flags (surface-flag no-turn-around turn-to-pad attack) + ) + ) + +;; definition for symbol *mech-pickup-mods*, type surface +(define *mech-pickup-mods* (new 'static 'surface + :name 'run + :turnv 16384.0 + :turnvf 240.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :vel-turn -1.0 + :transv-max 12288.0 + :target-speed 12288.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 0.5 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag look-around no-turn-around) + ) + ) + +;; definition for symbol *mech-carry-walk-mods*, type surface +(define *mech-carry-walk-mods* (new 'static 'surface + :name 'run + :turnv 25486.223 + :turnvf 96.0 + :turnvv 524288.0 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :vel-turn -1.0 + :transv-max 12288.0 + :target-speed 36864.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 0.5 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag look-around no-turn-around) + ) + ) + +;; failed to figure out what this is: +(set! (-> *mech-carry-walk-mods* mult-hook) (-> *mech-walk-mods* mult-hook)) + +;; definition for symbol *mech-carry-drag-mods*, type surface +(define *mech-carry-drag-mods* (new 'static 'surface + :name 'run + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 12288.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag look-around no-turn-around) + ) + ) + +;; definition for symbol *mech-carry-jump-mods*, type surface +(define *mech-carry-jump-mods* (new 'static 'surface + :name 'jump + :turnv 131072.0 + :turnvf 90.0 + :turnvv 18204.445 + :turnvvf 30.0 + :tiltv 32768.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 36864.0 + :target-speed 36864.0 + :seek0 0.3 + :seek90 0.3 + :seek180 0.3 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air) + ) + ) + +;; definition for function target-mech-falling-anim-trans +;; WARN: Return type mismatch int vs none. +(defbehavior target-mech-falling-anim-trans target () + 0 + (none) + ) + +;; definition for function target-mech-mech-effect +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-mech-mech-effect mech ((arg0 target)) + (when (!= (-> arg0 mech thruster-flame-length) 0.0) + (let ((f30-0 0.0)) + (if (!= (-> *setting-control* user-current under-water-pitch-mod) 0.0) + (set! f30-0 -2.0) + ) + (sound-play-by-name + (static-sound-name "mech-thrust") + (-> arg0 mech thrust-sound-id) + (the int (* 1024.0 (lerp-scale 0.3 1.0 (-> arg0 mech thruster-flame-length) 0.0 4096.0))) + (the int (* 1524.0 f30-0)) + 0 + (sound-group) + #t + ) + ) + (dotimes (s5-1 2) + (let* ((s3-1 (-> self node-list data (if (zero? s5-1) + 37 + 38 + ) + ) + ) + (s4-1 (vector<-cspace! (new 'stack-no-clear 'vector) s3-1)) + (a2-2 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-1 bone transform uvec))) + ) + (mech-spawn-thruster + (-> arg0 mech) + s4-1 + a2-2 + (-> arg0 mech thruster-flame-width) + (-> arg0 mech thruster-flame-length) + ) + ) + ) + ) + (when (logtest? (water-flag touch-water) (-> arg0 water flags)) + (let ((f30-1 (-> arg0 water height))) + (let ((s5-2 (-> *part-id-table* 1045))) + (let ((v1-28 (get-field-spec-by-id s5-2 (sp-field-id spt-userdata)))) + (if v1-28 + (set! (-> v1-28 initial-valuef) f30-1) + ) + ) + (let ((t9-6 sp-launch-particles-var) + (a0-12 *sp-particle-system-2d*) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> self root trans quad)) + (t9-6 a0-12 s5-2 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((s5-3 (-> *part-id-table* 1048))) + (let ((v1-34 (get-field-spec-by-id s5-3 (sp-field-id spt-userdata)))) + (if v1-34 + (set! (-> v1-34 initial-valuef) f30-1) + ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-15 *sp-particle-system-2d*) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> self root trans quad)) + (t9-8 a0-15 s5-3 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let* ((s5-4 (-> *part-id-table* 1051)) + (v1-40 (get-field-spec-by-id s5-4 (sp-field-id spt-userdata))) + (s4-2 (new 'stack-no-clear 'vector)) + ) + (if v1-40 + (set! (-> v1-40 initial-valuef) f30-1) + ) + (let ((s3-2 (get-field-spec-by-id s5-4 (sp-field-id spt-num)))) + (if s3-2 + (set! (-> s3-2 initial-valuef) (lerp-scale 0.1 2.0 (-> arg0 control ctrl-xz-vel) 0.0 40960.0)) + ) + ) + (process-drawable-random-point! self s4-2) + (let ((t9-13 sp-launch-particles-var) + (a0-21 *sp-particle-system-2d*) + (a2-6 *launch-matrix*) + ) + (set! (-> a2-6 trans quad) (-> s4-2 quad)) + (t9-13 a0-21 s5-4 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function mech-on-ground? +(defbehavior mech-on-ground? target () + (logtest? (-> self control status) (collide-status on-surface)) + ) + +;; definition for function target-mech-get-off? +(defbehavior target-mech-get-off? target () + (when (and (mech-on-ground?) + (< (-> self mech no-get-off-time) (current-time)) + (-> *setting-control* user-current pilot-exit) + ) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s4-0 (new 'stack-no-clear 'inline-array 'sphere 1)) + ) + (dotimes (s5-0 1) + ((method-of-type sphere new) (the-as symbol (-> s4-0 s5-0)) sphere) + ) + (let ((s5-1 (-> self node-list data 0 bone transform))) + (vector-matrix*! (-> s4-0 0) (new 'static 'vector :y 14336.0 :z 12288.0 :w 1.0) s5-1) + (set! (-> s4-0 0 r) 10240.0) + (let ((v1-11 gp-0)) + (set! (-> v1-11 best-dist) (the-as float s4-0)) + (set! (-> v1-11 best-other-prim) (the-as collide-shape-prim 1)) + (set! (-> v1-11 collide-with) (-> self control root-prim prim-core collide-with)) + (set! (-> v1-11 ignore-process0) #f) + (set! (-> v1-11 ignore-process1) #f) + (set! (-> v1-11 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-11 best-my-prim) (the-as collide-shape-prim #t)) + (set! (-> v1-11 action-mask) (collide-action solid)) + ) + (let ((s4-1 (fill-and-probe-using-spheres *collide-cache* gp-0))) + (when (not s4-1) + (vector-matrix*! (-> gp-0 start-pos) (new 'static 'vector :y 8192.0 :z 4096.0 :w 1.0) s5-1) + (set-vector! (-> gp-0 move-dist) 0.0 -40960.0 0.0 0.0) + (let ((v1-15 gp-0)) + (set! (-> v1-15 radius) 409.6) + (set! (-> v1-15 collide-with) (collide-spec backgnd obstacle hit-by-others-list pusher)) + (set! (-> v1-15 ignore-process0) self) + (set! (-> v1-15 ignore-process1) #f) + (set! (-> v1-15 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-15 action-mask) (collide-action solid)) + ) + (set! s4-1 (< (fill-and-probe-using-line-sphere *collide-cache* gp-0) 0.0)) + ) + (if (and s4-1 (-> *setting-control* user-current pilot)) + (talker-spawn-func (-> *talker-speech* 48) *entity-pool* (target-pos 0) (the-as region #f)) + ) + (not s4-1) + ) + ) + ) + ) + ) + +;; definition for function target-mech-handler +;; INFO: Used lq/sq +(defbehavior target-mech-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object) (a0-19 symbol) (sv-96 target) (sv-112 process)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'mech + ) + (else + (case arg2 + (('end-mode) + (case (-> arg3 param 0) + (('mech) + enter-state + (process->handle arg0) + (go target-mech-get-off) + ) + ) + ) + (('change-mode) + (let ((v1-8 (-> arg3 param 0))) + (cond + ((= v1-8 'grab) + (when (not (focus-test? self dead)) + (if (not (-> arg3 param 1)) + #t + (go target-mech-grab) + ) + ) + ) + ((= v1-8 'normal) + enter-state + (process->handle arg0) + (go target-mech-get-off) + ) + ((begin (set! a0-19 'falling) (= v1-8 a0-19)) + (go target-mech-falling a0-19) + ) + ) + ) + ) + (('swim 'slide 'edge-grab) + #f + ) + (('clone-anim) + (go target-mech-clone-anim (process->handle (the-as process (-> arg3 param 0)))) + ) + (('touched) + (cond + ((logtest? (process-mask crate) (-> arg0 mask)) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) 'attack) + (set! (-> a1-1 param 0) (-> arg3 param 0)) + (set! (-> a1-1 param 1) + (the-as + uint + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> self mech attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'mech) + (penetrate-using (-> self control penetrate-using)) + ) + ) + ) + ) + (set! v0-0 (send-event-function arg0 a1-1)) + ) + (when v0-0 + (let* ((v1-28 (-> self game)) + (a0-43 (+ (-> v1-28 attack-id) 1)) + ) + (set! (-> v1-28 attack-id) a0-43) + (set! (-> self mech attack-id) a0-43) + ) + ) + v0-0 + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (let ((s3-0 + (the-as object (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 168)) + ) + ) + (let ((s2-0 (the-as pointer s3-0)) + (s1-0 (method-of-type attack-info compute-intersect-info)) + (s0-0 (-> arg3 param 1)) + ) + (set! sv-96 self) + (set! sv-112 arg0) + (let ((a3-2 (if (type? sv-112 process-drawable) + sv-112 + ) + ) + (t0-0 (-> arg3 param 0)) + ) + (s1-0 (the-as attack-info s2-0) s0-0 sv-96 a3-2 (the-as touching-shapes-entry t0-0)) + ) + ) + (format 0 "info: ~A~%" (-> (the-as attack-info s3-0) mode)) + (let* ((v1-31 (-> (the-as attack-info s3-0) mode)) + (f30-0 (cond + ((= v1-31 'tar) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + (* 100.0 (seconds-per-frame)) + ) + ((= v1-31 'melt) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + (let ((s2-1 (if (logtest? (-> (the-as attack-info s3-0) mask) (attack-mask intersection)) + (-> (the-as attack-info s3-0) intersection) + (-> self control trans) + ) + ) + ) + (launch-particles (-> *part-id-table* 1053) s2-1) + (launch-particles (-> *part-id-table* 1055) s2-1) + ) + (* 100.0 (seconds-per-frame)) + ) + ((or (= v1-31 'burn) (= v1-31 'burnup)) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + (if (logtest? (-> (the-as attack-info s3-0) mask) (attack-mask intersection)) + (-> (the-as attack-info s3-0) intersection) + (-> self control trans) + ) + (launch-particles (-> *part-id-table* 1053) (-> self control trans)) + (launch-particles (-> *part-id-table* 1055) (-> self control trans)) + (* 20.0 (seconds-per-frame)) + ) + ((= v1-31 'shock) + (let ((s2-2 (if (logtest? (-> (the-as attack-info s3-0) mask) (attack-mask intersection)) + (-> (the-as attack-info s3-0) intersection) + (-> self control trans) + ) + ) + ) + (launch-particles (-> *part-id-table* 1057) s2-2) + (launch-particles (-> *part-id-table* 1058) s2-2) + ) + (set! (-> (the-as attack-info s3-0) id) (the-as uint 2)) + 10.0 + ) + ((= v1-31 'explode) + (if (and (-> self next-state) (= (-> self next-state name) 'target-mech-shield)) + 0.0 + 4.0 + ) + ) + ((= v1-31 'grunt) + 1.0 + ) + ((= v1-31 'air) + 100.0 + ) + ((or (= v1-31 'endlessfall) (= v1-31 'crush) (= v1-31 'instant-death)) + 100.0 + ) + (else + (-> (the-as attack-info s3-0) damage) + ) + ) + ) + ) + (when (target-log-attack (the-as attack-info s3-0) 'background) + (case arg2 + (('attack 'attack-or-shove 'attack-invinc) + (if (not (or (logtest? (-> self target-flags) (target-flags tf2)) + (logtest? (game-secrets invulnerable) (-> self game secrets)) + ) + ) + (seek! (-> self mech shield-value) 0.0 f30-0) + ) + ) + ) + (if (and (= arg2 'attack-or-shove) (< 0.0 (-> self mech shield-value))) + (set! arg2 'shove) + ) + (if (= arg2 'attack-invinc) + (set! (-> self mech shield-value) 0.0) + ) + (if (or (= (-> self mech shield-value) 0.0) (= arg2 'shove)) + (target-attacked + arg2 + (the-as attack-info s3-0) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-mech-hit + ) + 'block + ) + ) + ) + ) + ) + (('shove) + (when (not (focus-test? self dead hit)) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 168) + (when (not (logtest? (-> self attack-info-rec mask) (attack-mask attacker))) + (set! (-> self attack-info-rec attacker) (process->handle arg0)) + (logior! (-> self attack-info-rec mask) (attack-mask attacker)) + ) + (go target-mech-hit 'shove (-> self attack-info-rec)) + ) + ) + (('effect-control) + (if (string= (the-as string (-> arg3 param 0)) "target-mech-walk") + (sound-play-by-name + (static-sound-name "mech-walk") + (new-sound-id) + 1024 + (the int (* 1524.0 (lerp-scale -0.2 0.0 (-> self control ctrl-xz-vel) 12288.0 40960.0))) + 0 + (sound-group) + #t + ) + ) + ) + (('target-mech-get-off) + (set! v0-0 (+ (current-time) (the-as time-frame (-> arg3 param 0)))) + (set! (-> self mech no-get-off-time) (the-as time-frame v0-0)) + v0-0 + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + +;; definition for function target-mech-bonk-event-handler +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs object. +(defbehavior target-mech-bonk-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (when (and (= arg2 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 6) + ) + (>= 409.6 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (begin + (vector-normalize! + (vector-! + s4-0 + (the-as vector (-> self control collision-spheres 0 prim-core)) + (-> self control actor-contact-pt) + ) + 1.0 + ) + (< 0.01 (-> s4-0 y)) + ) + ) + (if (< 0.75 (-> s4-0 y)) + (send-event + arg0 + 'bonk + (-> arg3 param 0) + (fmax + (-> self control ground-impact-vel) + (- (vector-dot (-> self control transv) (-> self control dynam gravity-normal))) + ) + ) + ) + (when (and (= (target-send-attack + arg0 + 'bonk + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (penetrate touch bonk mech-bonk) + ) + 'bounce + ) + (not (logtest? (-> self focus-status) (focus-status dead hit))) + ) + (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) + (target-timed-invulnerable (seconds 0.1) self 1) + (cond + ((focus-test? self carry) + enter-state + (let ((a0-19 (-> *TARGET-bank* mech-carry-jump-height-min)) + (a1-8 (-> *TARGET-bank* mech-carry-jump-height-max)) + ) + (go target-mech-carry-jump a0-19 a1-8) + ) + ) + (else + (go + target-mech-jump + (-> *TARGET-bank* mech-jump-height-min) + (-> *TARGET-bank* mech-jump-height-max) + (the-as surface #f) + ) + ) + ) + ) + #f + ) + ) + ) + +;; definition for function mech-leg-ik-callback +;; INFO: Used lq/sq +;; WARN: Return type mismatch none vs object. +(defbehavior mech-leg-ik-callback target ((arg0 joint-mod-ik) (arg1 matrix) (arg2 matrix) (arg3 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> arg3 quad)) + (let ((f0-1 (- (-> arg3 y) (-> (target-pos 0) y)))) + (if (< 6144.0 f0-1) + (set! f0-1 6144.0) + ) + (if (< f0-1 -6144.0) + (set! f0-1 -6144.0) + ) + (+! (-> arg0 user-position y) f0-1) + ) + (let ((f0-4 (- (-> arg3 y) (-> arg0 user-position y)))) + (seek! (-> arg0 user-float) f0-4 (* 40960.0 (seconds-per-frame))) + ) + (let* ((f28-0 (-> arg0 user-float)) + (f30-1 (lerp-scale 1.0 0.0 f28-0 0.0 12288.0)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-12 s5-0)) + (let ((a0-4 *up-vector*)) + (let ((a1-4 8192.0)) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> a0-4 quad)) + ) + (.lvf vf4 (&-> v1-12 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 (&-> s3-0 quad) vf6) + (vector-float*! (new 'stack-no-clear 'vector) *up-vector* -16384.0) + (let ((s2-0 (new 'stack-no-clear 'vector))) + 0.0 + (let ((f0-11 (intersect-ray-plane s3-0 *up-vector* (-> arg0 user-position) *up-vector*)) + (a0-7 s2-0) + ) + (let ((v1-15 *up-vector*)) + (let ((a1-7 f0-11)) + (.mov vf7 a1-7) + ) + (.lvf vf5 (&-> v1-15 quad)) + ) + (.lvf vf4 (&-> s3-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 (&-> a0-7 quad) vf6) + ) + (let ((a0-8 s2-0)) + (let ((v1-16 *up-vector*)) + (let ((a1-8 (- f28-0))) + (.mov vf7 a1-8) + ) + (.lvf vf5 (&-> v1-16 quad)) + ) + (.lvf vf4 (&-> arg3 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 (&-> a0-8 quad) vf6) + ) + (let ((a1-9 s5-0)) + (let ((v1-17 s5-0)) + (let ((a0-10 (vector-! (new 'stack-no-clear 'vector) s2-0 s5-0))) + (let ((a2-6 (fmin 1.0 (* (-> arg0 user-blend) f30-1)))) + (.mov vf7 a2-6) + ) + (.lvf vf5 (&-> a0-10 quad)) + ) + (.lvf vf4 (&-> v1-17 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 (&-> a1-9 quad) vf6) + ) + ) + ) + (set-ik-target! arg0 s5-0) + ) + ) + ) + +;; definition for function mech-update-ik +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior mech-update-ik target () + (local-vars (sv-720 vector)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((gp-0 (new 'stack-no-clear 'collide-query)) + (s5-0 (-> (the-as process-drawable (-> self parent 0)) root)) + ) + (let ((a1-0 (-> gp-0 bbox)) + (v1-2 (-> s5-0 trans)) + (a0-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-0 x) 10240.0) + (set! (-> a0-0 y) 10240.0) + (set! (-> a0-0 z) 10240.0) + (set! (-> a0-0 w) 1.0) + (vector-! (the-as vector a1-0) v1-2 a0-0) + ) + (let ((a1-2 (-> gp-0 bbox max)) + (v1-3 (-> s5-0 trans)) + (a0-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a0-1 x) 10240.0) + (set! (-> a0-1 y) 10240.0) + (set! (-> a0-1 z) 10240.0) + (set! (-> a0-1 w) 1.0) + (vector+! a1-2 v1-3 a0-1) + ) + (set! (-> gp-0 collide-with) (-> (the-as collide-shape s5-0) root-prim prim-core collide-with)) + (set! (-> gp-0 ignore-process0) #f) + (set! (-> gp-0 ignore-process1) #f) + (set! (-> gp-0 ignore-pat) (-> (the-as collide-shape s5-0) pat-ignore-mask)) + (fill-using-bounding-box *collide-cache* gp-0) + (dotimes (s4-0 2) + (let ((s3-0 (-> self mech-ik s4-0))) + #t + (set! (-> s3-0 callback) mech-leg-ik-callback) + (-> s3-0 shoulder-matrix-no-ik) + (let ((v1-13 (-> s3-0 elbow-matrix-no-ik)) + (s0-0 (new 'stack-no-clear 'vector)) + ) + (set! sv-720 (new 'stack-no-clear 'vector)) + (let ((a0-5 (-> *y-vector* quad))) + (set! (-> sv-720 quad) a0-5) + ) + (let ((s2-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (new 'stack-no-clear 'vector) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (let ((a1-6 s0-0)) + (let ((a0-8 (-> v1-13 trans))) + (let ((v1-14 (-> v1-13 uvec))) + (let ((a2-8 (-> s3-0 hand-dist))) + (.mov vf7 a2-8) + ) + (.lvf vf5 (&-> v1-14 quad)) + ) + (.lvf vf4 (&-> a0-8 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 (&-> a1-6 quad) vf6) + ) + (let ((f0-11 + (lerp-scale 1.0 0.0 (- (-> s0-0 y) (-> (the-as collide-shape-moving s5-0) gspot-pos y)) 2048.0 12288.0) + ) + ) + (seek! (-> s3-0 user-blend) f0-11 (* 4.0 (seconds-per-frame))) + ) + (let ((a1-9 (-> gp-0 start-pos))) + (let ((v1-18 s0-0)) + (let ((a0-11 sv-720)) + (let ((a2-12 6144.0)) + (.mov vf7 a2-12) + ) + (.lvf vf5 (&-> a0-11 quad)) + ) + (.lvf vf4 (&-> v1-18 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 (&-> a1-9 quad) vf6) + ) + (let ((v1-19 (-> gp-0 move-dist)) + (f0-16 -20480.0) + ) + (vector-float*! v1-19 sv-720 f0-16) + ) + (let ((v1-21 gp-0)) + (set! (-> v1-21 radius) 4.096) + (set! (-> v1-21 collide-with) (-> gp-0 collide-with)) + (set! (-> v1-21 ignore-process0) #f) + (set! (-> v1-21 ignore-process1) #f) + (set! (-> v1-21 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-21 action-mask) (collide-action solid)) + ) + (let ((f30-0 (probe-using-line-sphere *collide-cache* gp-0))) + (cond + ((>= f30-0 0.0) + (set! (-> s1-0 quad) (-> gp-0 best-other-tri normal quad)) + (when (< 8192.0 (vector-vector-angle-safe *y-vector* s1-0)) + (let* ((a1-14 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) *y-vector* s1-0) 1.0)) + (a2-14 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) a1-14 8192.0)) + ) + (vector-orient-by-quat! s1-0 *y-vector* a2-14) + ) + ) + (let ((a1-16 s2-0)) + (let ((v1-28 (-> gp-0 start-pos))) + (let ((a0-26 (-> gp-0 move-dist))) + (let ((a2-15 f30-0)) + (.mov vf7 a2-15) + ) + (.lvf vf5 (&-> a0-26 quad)) + ) + (.lvf vf4 (&-> v1-28 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 (&-> a1-16 quad) vf6) + ) + (set! (-> s3-0 user-position quad) (-> s2-0 quad)) + (set! (-> s3-0 user-normal quad) (-> s1-0 quad)) + ) + (else + (set! (-> s0-0 y) (-> (target-pos 0) y)) + (set! (-> s3-0 user-position quad) (-> s0-0 quad)) + (set! (-> s3-0 user-normal quad) (-> *y-vector* quad)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for function target-mech-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior target-mech-init target ((arg0 handle) (arg1 float) (arg2 symbol)) + (local-vars + (sv-160 (function vector entity-actor skeleton-group vector manipy-options none :behavior manipy)) + (sv-176 vector) + (sv-192 entity-actor) + ) + (target-gun-end-mode #f) + (target-exit) + (when (zero? (-> self mech)) + (set! (-> self mech) (new 'process 'mech-info)) + (set! (-> self mech hud 0) (the-as handle #f)) + (set! (-> self mech shield-handle) (the-as handle #f)) + (set! (-> self mech engine-sound-id) (new-sound-id)) + (set! (-> self mech thrust-sound-id) (new-sound-id)) + (set! (-> self mech drag-sound-id) (new-sound-id)) + (set! (-> self mech whine-sound-id) (new-sound-id)) + (set! (-> self mech shield-sound-id) (new-sound-id)) + (set! (-> self mech mode-sound-bank) #f) + ) + (set! (-> self board latch?) #f) + (set! (-> self mech stick-lock) #f) + (set! (-> self mech stick-off) #f) + (set-time! (-> self mech unstuck-time)) + (set! (-> self mech stuck-count) 0) + (set-time! (-> self mech mech-start-time)) + (set! (-> self mech jump-thrust) 0.0) + (set! (-> self mech jump-thrust-fuel) (-> *TARGET-bank* mech-jump-thrust-fuel)) + (set! (-> self mech state-impact? 0) #f) + ((method-of-type impact-control initialize) + (the-as impact-control (-> self mech state-impact)) + self + -1 + 0.0 + (collide-spec) + ) + (set! (-> self mech shield-max) 100.0) + (set! (-> self mech shield-value) arg1) + (set! (-> self mech entity) (entity-by-type mech)) + (let ((v1-31 (handle->process arg0))) + (if v1-31 + (set! (-> self mech entity) (-> v1-31 entity)) + ) + ) + (when (not (and (-> self mech entity) (logtest? (level-flags lf16) (-> self mech entity extra level info level-flags))) + ) + (dotimes (v1-39 (-> *level* length)) + (let ((a0-18 (-> *level* level v1-39))) + (when (= (-> a0-18 status) 'active) + (when (logtest? (level-flags lf16) (-> a0-18 info level-flags)) + (let ((a0-20 (-> a0-18 entity data 0 entity))) + (when a0-20 + (set! (-> self mech entity) (the-as entity-actor a0-20)) + (goto cfg-22) + ) + ) + ) + ) + ) + ) + ) + (label cfg-22) + (let ((v1-44 (-> self mech))) + (set! (-> v1-44 particle-system-2d) *sp-particle-system-2d*) + (set! (-> v1-44 particle-system-3d) *sp-particle-system-3d*) + (set! (-> v1-44 part-quat) *particle-quat*) + (set! (-> v1-44 part-vel) *particle-vel*) + (set! (-> v1-44 part-thruster) (-> *part-id-table* 1037)) + (set! (-> v1-44 part-thruster-scale-x) (-> *part-id-table* 1037 init-specs 4)) + (set! (-> v1-44 part-thruster-scale-y) (-> *part-id-table* 1037 init-specs 5)) + (set! (-> v1-44 thruster-flame-width) 0.0) + (set! (-> v1-44 thruster-flame-length) 0.0) + ) + (set! (-> self control reaction) target-collision-reaction) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control ctrl-xz-vel) 0.0) + (logior! (-> self focus-status) (focus-status mech)) + (set! (-> self control bend-target) 0.0) + (let ((v1-54 (-> self node-list data))) + (set! (-> v1-54 0 param0) (the-as (function cspace transformq none) cspace<-transformq+world-trans!)) + (set! (-> v1-54 0 param1) (the-as basic (-> self control trans))) + (set! (-> v1-54 0 param2) (the-as basic (-> self control cspace-offset))) + ) + (target-collide-set! 'mech 0.0) + (set! (-> self control pat-ignore-mask) (new 'static 'pat-surface :noentity #x1 :nomech #x1)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (set! (-> self draw shadow) #f) + (let ((s4-1 (-> self entity)) + (s3-0 (-> self level)) + ) + (process-entity-set! self (-> self mech entity)) + (let ((s2-0 (get-process *8k-dead-pool* manipy #x20000 1))) + (set! (-> self manipy) + (the-as + (pointer manipy) + (when s2-0 + (let ((t9-13 (method-of-type manipy activate))) + (t9-13 (the-as manipy s2-0) self "manipy" (the-as pointer #x70004000)) + ) + (let ((s1-0 run-function-in-process) + (s0-0 s2-0) + ) + (set! sv-160 manipy-init) + (set! sv-176 (-> self control trans)) + (set! sv-192 (-> self entity)) + (let ((t0-1 (art-group-get-by-name *level* "skel-mech" (the-as (pointer level) #f))) + (t1-0 #f) + (t2-0 0) + ) + ((the-as (function object object object object object object object none) s1-0) + s0-0 + sv-160 + sv-176 + sv-192 + t0-1 + t1-0 + t2-0 + ) + ) + ) + (-> s2-0 ppointer) + ) + ) + ) + ) + (set! (-> self entity) s4-1) + (set! (-> self level) s3-0) + ) + (when (-> self manipy) + (send-event + (ppointer->process (-> self manipy)) + 'trans-hook + (lambda :behavior target + () + (let ((v1-0 (ppointer->process (-> self parent)))) + (set! (-> self control trans quad) (-> (the-as target v1-0) mech mech-trans quad)) + (let ((a0-4 (-> (the-as target v1-0) mech mech-quat quad))) + (set! (-> self control quat quad) a0-4) + ) + (set! (-> self control scale quad) (-> (the-as target v1-0) mech mech-scale quad)) + (set! (-> self draw light-index) (-> (the-as target v1-0) draw light-index)) + (let ((a0-10 (-> (the-as target v1-0) draw color-mult quad))) + (set! (-> self draw color-mult quad) a0-10) + ) + (let ((a0-12 (-> (the-as target v1-0) draw color-emissive quad))) + (set! (-> self draw color-emissive quad) a0-12) + ) + (let ((v0-0 (-> (the-as target v1-0) draw shadow-ctrl settings shadow-dir quad))) + (set! (-> self draw shadow-ctrl settings shadow-dir quad) v0-0) + v0-0 + ) + ) + ) + ) + (send-event + (ppointer->process (-> self manipy)) + 'post-hook + (lambda :behavior target + () + (let ((gp-0 (ppointer->process (-> self parent)))) + ((method-of-type impact-control update-from-cspace) + (the-as impact-control (-> (the-as target gp-0) mech state-impact)) + ) + (when (-> (the-as target gp-0) mech state-impact? 0) + (let ((a1-0 (new 'stack-no-clear 'collide-query))) + ((method-of-type impact-control impact-control-method-11) + (the-as impact-control (-> (the-as target gp-0) mech state-impact)) + a1-0 + (the-as process gp-0) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + ) + ) + (mech-update-ik) + (target-mech-mech-effect (the-as target gp-0)) + ) + ) + ) + (send-event (ppointer->process (-> self manipy)) 'anim-mode 'clone-anim) + (send-event (ppointer->process (-> self manipy)) 'sync #t) + (send-event + (ppointer->process (-> self manipy)) + 'eval + (lambda :behavior target + () + (set! (-> self state-hook) #f) + (set! (-> self draw shadow-ctrl) *mech-shadow-control*) + (set! (-> self mech-ik 0) (new 'process 'joint-mod-ik self 27 5283.84)) + (set! (-> self mech-ik 1) (new 'process 'joint-mod-ik self 33 5283.84)) + (dotimes (v1-3 2) + (let ((a0-5 (-> self mech-ik v1-3))) + (set! (-> a0-5 elbow-pole-vector-axis) (the-as uint 2)) + (set! (-> a0-5 elbow-rotation-axis) (the-as uint 0)) + (set! (-> a0-5 callback) mech-leg-ik-callback) + (logior! (-> a0-5 flags) (joint-mod-ik-flags elbow-trans-neg)) + ) + ) + (dotimes (gp-0 2) + (enable-set! (-> self mech-ik gp-0) #t) + ) + #f + ) + ) + ) + (logior! (-> self target-flags) (target-flags tf6)) + (set-setting! 'string-max-length 'low (meters 7) 0) + (set-setting! 'string-min-length 'low (meters 4) 0) + (set-setting! 'string-max-height 'low (meters 3.5) 0) + (set-setting! 'string-min-height 'low (meters 1.5) 0) + (set-setting! 'fov 'abs (degrees 75.0) 0) + (set-setting! 'head-offset 'abs (meters 4.5) 0) + (set! (-> self mech mode-sound-bank) (the-as connection (add-setting! 'mode-sound-bank 'modemech 0.0 0))) + (set! (-> self mech hud 0) + (ppointer->handle (process-spawn hud-heatmeter :init hud-init-by-other :name "hud-heatmeter" :to self)) + ) + (let ((s4-3 (new 'stack-no-clear 'shield-sphere-spawn-params))) + (set! (-> s4-3 owner) (process->handle self)) + (set! (-> s4-3 sphere-size) 3.75) + (set! (-> s4-3 track-joint) 3) + (set! (-> s4-3 enable-time) (seconds 0.1)) + (set! (-> s4-3 disable-time) (seconds 0.1)) + (set! (-> s4-3 shield-strength) 8) + (set! (-> s4-3 shield-type) (shield-type shield-type-0)) + (if (new 'static 'vector :z -4096.0 :w 1.0) + (set! (-> s4-3 offset-vec quad) (-> (new 'static 'vector :z -4096.0 :w 1.0) quad)) + (vector-reset! (-> s4-3 offset-vec)) + ) + (let ((s3-1 (the-as process #f))) + (let* ((s2-1 (get-process *default-dead-pool* mech-shield #x4000 1)) + (v1-129 (when s2-1 + (let ((t9-32 (method-of-type process activate))) + (t9-32 s2-1 self "process" (the-as pointer #x70004000)) + ) + (run-now-in-process s2-1 mech-shield-init-by-other s4-3) + (-> s2-1 ppointer) + ) + ) + ) + (if v1-129 + (set! s3-1 (-> v1-129 0)) + ) + ) + (cond + (s3-1 + (set! (-> self mech shield-handle) (process->handle s3-1)) + (send-event (handle->process (-> self mech shield-handle)) 'disabled) + ) + (else + ) + ) + ) + ) + (remove-exit) + (if arg2 + (go target-mech-stance) + (go target-mech-get-on arg0) + ) + (none) + ) + +;; definition for function target-mech-exit +;; INFO: Used lq/sq +(defbehavior target-mech-exit target () + (when (not (and (-> self next-state) + (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-mech-stance) + (= v1-3 'target-mech-walk) + (= v1-3 'target-mech-jump) + (= v1-3 'target-mech-jump-jump) + (= v1-3 'target-mech-falling) + (= v1-3 'target-mech-hit-ground) + (= v1-3 'target-mech-punch) + (= v1-3 'target-mech-hit) + (= v1-3 'target-mech-death) + (= v1-3 'target-mech-carry-drag) + (= v1-3 'target-mech-carry-pickup) + (= v1-3 'target-mech-carry-drop) + (= v1-3 'target-mech-carry-stance) + (= v1-3 'target-mech-carry-walk) + (= v1-3 'target-mech-carry-jump) + (= v1-3 'target-mech-carry-falling) + (= v1-3 'target-mech-carry-hit-ground) + (= v1-3 'target-mech-carry-throw) + (= v1-3 'target-mech-get-off) + (= v1-3 'target-mech-get-off-jump) + (= v1-3 'target-mech-grab) + (= v1-3 'target-mech-clone-anim) + (= v1-3 'target-mech-shield) + ) + ) + ) + ) + (let ((v1-4 (-> self manipy))) + (when v1-4 + (deactivate (-> v1-4 0)) + (set! (-> self manipy) (the-as (pointer manipy) #f)) + ) + ) + (let ((a0-27 (handle->process (-> self mech shield-handle)))) + (if a0-27 + (deactivate a0-27) + ) + ) + (setting-control-method-14 *setting-control* (-> self mech mode-sound-bank)) + (set! (-> self mech mode-sound-bank) #f) + (logclear! (-> self draw status) (draw-control-status no-draw-bounds)) + (logclear! (-> self focus-status) (focus-status mech)) + (logclear! (-> self control root-prim prim-core action) (collide-action stuck-wall-escape)) + (set! (-> self control mod-surface) *walk-mods*) + (logclear! (-> self target-flags) (target-flags tf6)) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-height) + (remove-setting! 'string-min-height) + (remove-setting! 'fov) + (remove-setting! 'head-offset) + (remove-setting! 'sound-flava) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (let ((v1-50 (-> self node-list data))) + (set! (-> v1-50 0 param0) (the-as (function cspace transformq none) cspace<-transformq+trans!)) + (set! (-> v1-50 0 param1) (the-as basic (-> self control trans))) + (set! (-> v1-50 0 param2) (the-as basic (-> self control cspace-offset))) + ) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (set! (-> self control pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :board #x1) + ) + (sound-stop (-> self mech engine-sound-id)) + (sound-stop (-> self mech thrust-sound-id)) + (sound-stop (-> self mech drag-sound-id)) + (sound-stop (-> self mech whine-sound-id)) + (send-event (handle->process (-> self mech hud 0)) 'hide-and-die) + (set! (-> self draw shadow) (-> self shadow-backup)) + (set! (-> self control cspace-offset quad) (the-as uint128 0)) + (remove-setting! 'sound-flava) + (target-exit) + ) + (none) + ) + +;; definition for function target-mech-effect +;; WARN: Return type mismatch int vs none. +(defbehavior target-mech-effect target () + (sound-play "mech-pulse" :id (-> self mech engine-sound-id)) + (set! (-> self game distance) (/ (-> self mech shield-value) (-> self mech shield-max))) + 0 + (none) + ) + +;; definition for function target-mech-add-thrust +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defbehavior target-mech-add-thrust target () + (let ((s5-0 (-> self control target-transv)) + (gp-0 (-> self control transv-ctrl)) + ) + (set! (-> (new 'stack-no-clear 'vector) quad) (-> self control target-transv quad)) + (target-bend-vel-turn gp-0) + (target-add-slide-factor s5-0) + (let ((t9-2 vector-xz-normalize!) + (a0-5 (new-stack-vector0)) + ) + (set! (-> a0-5 quad) (-> s5-0 quad)) + (let ((s4-0 (t9-2 a0-5 1.0))) + (let ((t9-3 vector-xz-normalize!) + (a0-6 (new-stack-vector0)) + ) + (set! (-> a0-6 quad) (-> gp-0 quad)) + (let ((v1-7 (t9-3 a0-6 1.0))) + (set! (-> s4-0 y) 0.0) + (set! (-> v1-7 y) 0.0) + ) + ) + (let* ((f0-2 (-> s4-0 z)) + (v1-8 gp-0) + (f1-4 (sqrtf (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z))))) + (v1-10 s5-0) + (f0-11 + (cond + ((>= f1-4 (sqrtf (+ (* (-> v1-10 x) (-> v1-10 x)) (* (-> v1-10 z) (-> v1-10 z))))) + (let ((f0-3 (-> self control current-surface fric)) + (f1-5 1.0) + (v1-15 gp-0) + ) + (* f0-3 (fmax f1-5 (/ (sqrtf (+ (* (-> v1-15 x) (-> v1-15 x)) (* (-> v1-15 z) (-> v1-15 z)))) + (-> self control current-surface nonlin-fric-dist) + ) + ) + ) + ) + ) + ((>= f0-2 0.0) + (+ (* f0-2 (-> self control current-surface seek0)) (* (- 1.0 f0-2) (-> self control current-surface seek90))) + ) + (else + (+ (* (fabs f0-2) (-> self control current-surface seek180)) + (* (+ 1.0 f0-2) (-> self control current-surface seek90)) + ) + ) + ) + ) + (s4-1 vector-xz-normalize!) + (s3-0 gp-0) + (t9-4 seek) + (v1-30 gp-0) + ) + (s4-1 s3-0 (t9-4 + (sqrtf (+ (* (-> v1-30 x) (-> v1-30 x)) (* (-> v1-30 z) (-> v1-30 z)))) + (sqrtf (+ (* (-> s5-0 x) (-> s5-0 x)) (* (-> s5-0 z) (-> s5-0 z)))) + (* f0-11 (seconds-per-frame)) + ) + ) + ) + ) + ) + (set! (-> self control velocity-after-thrust) (vector-length gp-0)) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv-ctrl) (-> self control c-R-w)) + (vector-float*! gp-1 gp-1 0.5) + (vector+! gp-1 gp-1 (-> self control trans)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + gp-1 + (meters 0.2) + "ltransv" + (new 'static 'rgba :g #xff :a #x80) + ) + ) + (none) + ) + +;; definition for function target-mech-collision +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-mech-collision target () + (cond + ((and (-> self next-state) (= (-> self next-state name) 'target-mech-carry-drag)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 2) + (set! (-> a1-0 message) 'move) + (set! (-> a1-0 param 0) (the-as uint (-> self control transv))) + (set! (-> a1-0 param 1) (the-as uint s5-0)) + (let ((s3-0 (send-event-function (handle->process (-> self carry other)) a1-0)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-0 quad) (-> self control trans quad)) + (set! (-> (new 'stack-no-clear 'vector) quad) (-> self control transv quad)) + (let ((a2-1 (new 'stack-no-clear 'collide-query)) + (v1-18 (-> self control)) + ) + (set! (-> a2-1 collide-with) (-> v1-18 root-prim prim-core collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (-> v1-18 pat-ignore-mask)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-18 (-> v1-18 transv) a2-1 (meters 1)) + ) + (vector-! gp-0 (-> self control trans) s4-0) + (let* ((s2-0 (-> self control dynam gravity-normal)) + (f30-0 (- (vector-dot s2-0 gp-0) (vector-dot s2-0 s5-0))) + (a1-4 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 0) + (set! (-> a1-4 message) 'carry-info) + (let* ((s1-0 (the-as carry-info (send-event-function (handle->process (-> self carry other)) a1-4))) + (f0-2 (distance-from-destination (-> self carry) s1-0)) + ) + (cond + ((not s3-0) + ) + ((>= f0-2 0.0) + (let ((v1-38 (vector-float*! (new 'stack-no-clear 'vector) s2-0 f30-0))) + (vector+! (-> s1-0 hold-trans) (-> s1-0 hold-trans) v1-38) + ) + (let ((v1-39 (new-stack-vector0))) + (let ((f0-4 (vector-dot (-> self control dynam gravity-normal) s5-0))) + 0.0 + (vector-! v1-39 s5-0 (vector-float*! v1-39 (-> self control dynam gravity-normal) f0-4)) + ) + (let ((f0-5 (vector-length v1-39))) + f0-5 + (let ((f0-6 f0-5) + (v1-42 (new-stack-vector0)) + ) + (let ((f1-6 (vector-dot (-> self control dynam gravity-normal) gp-0))) + 0.0 + (vector-! v1-42 gp-0 (vector-float*! v1-42 (-> self control dynam gravity-normal) f1-6)) + ) + (let ((f1-7 (vector-length v1-42))) + f1-7 + (when (< f0-6 f1-7) + (let ((v1-46 (new-stack-vector0)) + (f0-8 (vector-dot (-> self control dynam gravity-normal) gp-0)) + ) + 0.0 + (vector-! v1-46 gp-0 (vector-float*! v1-46 (-> self control dynam gravity-normal) f0-8)) + (let ((f1-11 (vector-length v1-46)) + (a0-43 (new-stack-vector0)) + ) + (let ((f2-3 (vector-dot (-> self control dynam gravity-normal) s5-0))) + 0.0 + (vector-! a0-43 s5-0 (vector-float*! a0-43 (-> self control dynam gravity-normal) f2-3)) + ) + (let ((f2-4 (vector-length a0-43))) + f2-4 + (let ((f2-5 f2-4)) + (vector+! + gp-0 + (vector-float*! gp-0 (-> self control dynam gravity-normal) f0-8) + (vector-float*! v1-46 v1-46 (/ f2-5 f1-11)) + ) + ) + ) + ) + ) + (let ((a1-25 (vector+! (new 'stack-no-clear 'vector) s4-0 gp-0))) + (move-to-point! (-> self control) a1-25) + ) + ) + ) + ) + ) + ) + ) + (else + (send-event self 'drop (seconds 0.5)) + ) + ) + ) + ) + ) + ) + ) + ) + (else + (let ((a2-17 (new 'stack-no-clear 'collide-query)) + (v1-54 (-> self control)) + ) + (set! (-> a2-17 collide-with) (-> v1-54 root-prim prim-core collide-with)) + (set! (-> a2-17 ignore-process0) self) + (set! (-> a2-17 ignore-process1) #f) + (set! (-> a2-17 ignore-pat) (-> v1-54 pat-ignore-mask)) + (set! (-> a2-17 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide v1-54 (-> v1-54 transv) a2-17 (meters 1)) + ) + ) + ) + (when (logtest? (-> self control status) (collide-status touch-wall)) + (let ((v1-61 (vector-! (new 'stack-no-clear 'vector) (-> self control wall-contact-pt) (-> self control trans)))) + (set! (-> v1-61 y) 0.0) + (when (< (vector-dot v1-61 (-> self control c-R-w fvec)) 0.0) + (set-time! (-> self mech back-touch-time)) + (set! (-> self mech back-touch-point quad) (-> self control wall-contact-pt quad)) + (set! (-> self mech back-touch-trans quad) (-> self control trans quad)) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-mech-real-post +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-mech-real-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self control remaining-ctrl-iterations) gp-1) + (flag-setup) + (if (< (-> self control force-turn-to-strength) 0.0) + (set! (-> self control force-turn-to-strength) (- 1.0 (-> self control cpad stick0-speed))) + ) + (build-conversions (-> self control transv)) + (do-rotations1) + (let ((s5-0 (new-stack-vector0))) + (read-pad s5-0) + (let ((f28-0 (-> self control pad-magnitude))) + (if (or (and (< 0.0 f28-0) + (< 0.3 (-> self control pad-magnitude)) + (< (vector-dot (-> self control pad-xz-dir) (-> self control last-pad-xz-dir)) 0.2) + (< f28-0 0.7) + ) + (-> self mech stick-off) + ) + (set! f28-0 0.0) + ) + (when (!= (-> self control force-turn-to-strength) 0.0) + (let ((f0-15 (fmin 1.0 (-> self control force-turn-to-strength)))) + (set! (-> self control force-turn-to-strength) f0-15) + (let ((a1-2 (vector-float*! + (new 'stack-no-clear 'vector) + (if (= f28-0 0.0) + *zero-vector* + s5-0 + ) + f28-0 + ) + ) + (a2-1 (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control force-turn-to-direction) + (-> self control force-turn-to-speed) + ) + ) + ) + (vector-lerp! s5-0 a1-2 a2-1 f0-15) + ) + ) + (set! f28-0 (vector-length s5-0)) + (vector-normalize! s5-0 1.0) + ) + (turn-to-vector s5-0 f28-0) + ) + ) + (cond + ((and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (add-thrust) + ) + (else + (let* ((v1-51 (-> self control target-transv)) + (f0-20 (sqrtf (+ (* (-> v1-51 x) (-> v1-51 x)) (* (-> v1-51 z) (-> v1-51 z))))) + ) + (set-vector! (-> self control target-transv) 0.0 0.0 f0-20 1.0) + ) + (target-mech-add-thrust) + ) + ) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (pre-collide-setup) + (target-mech-collision) + (bend-gravity) + (post-flag-setup) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (ja-post) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (vector+! (-> self mech mech-trans) (-> self control trans) (-> self control cspace-offset)) + (quaternion-copy! (the-as quaternion (-> self mech mech-quat)) (-> self control quat)) + (set! (-> self mech mech-scale quad) (-> self control scale quad)) + (vector+! (-> self alt-cam-pos) (-> self control camera-pos) (new 'static 'vector :y 4096.0 :w 1.0)) + (set-time! (-> self mech mech-time)) + (target-mech-effect) + 0 + (none) + ) + +;; definition for function target-mech-post +(defbehavior target-mech-post target () + (target-mech-real-post) + (none) + ) diff --git a/test/decompiler/reference/jak3/engine/target/target-h_REF.gc b/test/decompiler/reference/jak3/engine/target/target-h_REF.gc index ab77614826..ab8840fbde 100644 --- a/test/decompiler/reference/jak3/engine/target/target-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-h_REF.gc @@ -18,7 +18,8 @@ (leg-ik joint-mod-ik 2) (foot joint-mod 2) (cloth symbol) - (init-time time-frame) + (mech-ik joint-mod-ik 2) + (init-time time-frame :overlay-at (-> mech-ik 0)) (teleport-time time-frame) (state-hook-time time-frame) (state-hook (function none :behavior target)) @@ -53,9 +54,9 @@ (mode-param1 handle) (mode-param2 uint64) (mode-param3 uint64) - (major-mode-exit-hook basic) - (major-mode-event-hook basic) - (sub-mode-exit-hook basic) + (major-mode-exit-hook (function none :behavior target)) + (major-mode-event-hook (function none :behavior target)) + (sub-mode-exit-hook (function none :behavior target)) (ext-geo-control external-art-buffer) (pending-ext-geo target-geo) (ext-geo target-geo) @@ -151,25 +152,26 @@ target-edge-grab (target-edge-grab-jump float float symbol) target-edge-grab-off - (target-falling symbol) + (target-falling object) target-float (target-flop float float float object) (target-flop-hit-ground symbol) - target-flut-air-attack + (target-flut-air-attack float) target-flut-air-attack-hit-ground - target-flut-clone-anim - target-flut-death - target-flut-double-jump - target-flut-eject - target-flut-falling - target-flut-get-off + (target-flut-clone-anim handle) + (target-flut-death symbol) + (target-flut-double-jump float float) + (target-flut-eject symbol) + (target-flut-falling object) + (target-flut-get-off handle) target-flut-get-off-jump - target-flut-get-on + (target-flut-get-on handle) target-flut-grab - target-flut-hit + (target-flut-hit symbol attack-info) target-flut-hit-ground - target-flut-jump - target-flut-kanga-catch + (target-flut-jump float float) + (target-flut-kanga-catch handle symbol) + target-flut-run-wild target-flut-running-attack target-flut-stance (target-flut-start handle symbol int) @@ -227,22 +229,22 @@ target-mech-carry-drag target-mech-carry-drop target-mech-carry-falling - target-mech-carry-hit-ground - target-mech-carry-jump + (target-mech-carry-hit-ground symbol) + (target-mech-carry-jump float float) target-mech-carry-pickup target-mech-carry-stance target-mech-carry-throw target-mech-carry-walk - target-mech-clone-anim - target-mech-death - target-mech-falling + (target-mech-clone-anim handle) + (target-mech-death symbol) + (target-mech-falling symbol) target-mech-get-off - target-mech-get-on - target-mech-get-up + (target-mech-get-on handle) + (target-mech-get-up handle) target-mech-grab - target-mech-hit - target-mech-hit-ground - target-mech-jump + (target-mech-hit symbol attack-info) + (target-mech-hit-ground symbol) + (target-mech-jump float float surface) target-mech-punch target-mech-shield target-mech-stance @@ -285,7 +287,11 @@ target-swim-walk target-title target-tube + (target-tube-death symbol) + (target-tube-hit symbol attack-info) + (target-tube-jump float float) (target-tube-start handle) + target-tube-walk target-turn-around target-turret-get-off (target-turret-get-on handle) diff --git a/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc b/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc index e8bae2f23d..278ea720e0 100644 --- a/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-ladder_REF.gc @@ -639,7 +639,3 @@ (go target-jump-forward (-> *TARGET-bank* jump-height-max) (-> *TARGET-bank* jump-height-max) #f) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/target/target-launch_REF.gc b/test/decompiler/reference/jak3/engine/target/target-launch_REF.gc index 880b7e2cb4..ec0ced4b2d 100644 --- a/test/decompiler/reference/jak3/engine/target/target-launch_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-launch_REF.gc @@ -76,7 +76,7 @@ (a0-19 (-> self control)) ) (set! (-> a0-19 status) v1-53) - (go target-falling (the-as symbol a0-19)) + (go target-falling a0-19) ) ) ) @@ -145,7 +145,3 @@ ) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/target/target-tube_REF.gc b/test/decompiler/reference/jak3/engine/target/target-tube_REF.gc new file mode 100644 index 0000000000..abe21bc446 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/target-tube_REF.gc @@ -0,0 +1,1256 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *tube-mods*, type surface +(define *tube-mods* (new 'static 'surface + :name 'tube + :turnv 21845.334 + :turnvv 524288.0 + :tiltv 5461.3335 + :tiltvv 131072.0 + :transv-max 1.0 + :target-speed 32768.0 + :seek0 1.0 + :seek90 1.0 + :seek180 1.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + ) + ) + +;; definition for symbol *tube-jump-mods*, type surface +(define *tube-jump-mods* (new 'static 'surface + :name 'tube + :turnv 21845.334 + :turnvv 262144.0 + :tiltv 5461.3335 + :tiltvv 131072.0 + :transv-max 1.0 + :seek0 0.8 + :seek90 0.7 + :seek180 0.8 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag air) + ) + ) + +;; definition for symbol *tube-hit-mods*, type surface +(define *tube-hit-mods* (new 'static 'surface + :name 'tube + :turnv 21845.334 + :turnvv 262144.0 + :tiltv 32768.0 + :tiltvv 131072.0 + :transv-max 1.0 + :target-speed 40960.0 + :fric 1.0 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + ) + ) + +;; failed to figure out what this is: +(let ((v1-3 (new 'static 'surface + :name '*tube-surface* + :turnv 1.0 + :turnvv 1.0 + :tiltv 1.0 + :tiltvv 1.0 + :transv-max 94208.0 + :target-speed 1.0 + :seek0 32768.0 + :seek90 94208.0 + :seek180 8192.0 + :fric 0.98 + :nonlin-fric-dist 4091904.0 + :slip-factor 0.7 + :slope-down-factor 81920.0 + :slope-slip-angle 16384.0 + :bend-speed 4.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :flags (surface-flag no-turn-around turn-to-vel) + ) + ) + ) + (set! *tube-surface* v1-3) + (set! (-> v1-3 mult-hook) (the-as (function surface surface surface int none) nothing)) + (set! (-> v1-3 touch-hook) nothing) + (set! (-> v1-3 active-hook) nothing) + ) + +;; definition of type tube-info +(deftype tube-info (basic) + ((entity entity) + (tube handle) + (downhill vector :inline) + (centertube vector :inline) + (downtube vector :inline) + (sidetube vector :inline) + (foretube vector :inline) + (old-transv vector :inline) + (mod-x float) + (mod-y float) + (start-time time-frame) + (turn-anim-targ float) + (turn-anim-frame float) + (turn-anim-vel float) + (tube-sound-id sound-id) + (tube-sound-vol float) + (tube-sound-pitch float) + ) + ) + +;; definition for method 3 of type tube-info +(defmethod inspect ((this tube-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tentity: ~A~%" (-> this entity)) + (format #t "~1Ttube: ~D~%" (-> this tube)) + (format #t "~1Tdownhill: ~`vector`P~%" (-> this downhill)) + (format #t "~1Tcentertube: ~`vector`P~%" (-> this centertube)) + (format #t "~1Tdowntube: ~`vector`P~%" (-> this downtube)) + (format #t "~1Tsidetube: ~`vector`P~%" (-> this sidetube)) + (format #t "~1Tforetube: ~`vector`P~%" (-> this foretube)) + (format #t "~1Told-transv: ~`vector`P~%" (-> this old-transv)) + (format #t "~1Tmod-x: ~f~%" (-> this mod-x)) + (format #t "~1Tmod-y: ~f~%" (-> this mod-y)) + (format #t "~1Tstart-time: ~D~%" (-> this start-time)) + (format #t "~1Tturn-anim-targ: ~f~%" (-> this turn-anim-targ)) + (format #t "~1Tturn-anim-frame: ~f~%" (-> this turn-anim-frame)) + (format #t "~1Tturn-anim-vel: ~f~%" (-> this turn-anim-vel)) + (format #t "~1Ttube-sound-id: ~D~%" (-> this tube-sound-id)) + (format #t "~1Ttube-sound-vol: ~f~%" (-> this tube-sound-vol)) + (format #t "~1Ttube-sound-pitch: ~f~%" (-> this tube-sound-pitch)) + (label cfg-4) + this + ) + +;; definition of type tube-bank +(deftype tube-bank (basic) + () + ) + +;; definition for method 3 of type tube-bank +(defmethod inspect ((this tube-bank)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (label cfg-4) + this + ) + +;; definition for symbol *TUBE-bank*, type tube-bank +(define *TUBE-bank* (new 'static 'tube-bank)) + +;; definition for function tube-sounds +(defbehavior tube-sounds target () + (seek! + (-> self tube tube-sound-vol) + (if (logtest? (-> self control status) (collide-status on-surface)) + 1.0 + 0.0 + ) + (* 2.0 (seconds-per-frame)) + ) + (seek! + (-> self tube tube-sound-pitch) + (lerp-scale -0.15 0.15 (-> self control ctrl-xz-vel) 0.0 122880.0) + (* 0.5 (seconds-per-frame)) + ) + (let ((f1-2 (-> self tube tube-sound-vol)) + (f0-9 (-> self tube tube-sound-pitch)) + ) + (sound-play-by-name + (static-sound-name "slide-loop") + (-> self tube tube-sound-id) + (the int (* 1024.0 f1-2)) + (the int (* 1524.0 f0-9)) + 0 + (sound-group) + (-> self control trans) + ) + ) + ) + +;; definition for function tube-thrust +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior tube-thrust target ((arg0 float) (arg1 float)) + (let ((s4-1 (vector-! (new 'stack-no-clear 'vector) (-> self tube foretube) (-> self control trans)))) + (vector-flatten! s4-1 s4-1 (-> self tube downtube)) + (vector-flatten! s4-1 s4-1 (-> self control local-normal)) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + s4-1 + (meters 0.00024414062) + (new 'static 'rgba :g #xff :a #x80) + ) + (vector-matrix*! s4-1 s4-1 (-> self control w-R-c)) + (vector-float*! s4-1 s4-1 2.0) + (if (< (-> self control current-surface target-speed) (vector-length s4-1)) + (vector-normalize! s4-1 (-> self control current-surface target-speed)) + ) + (vector-v++! (-> self control transv-ctrl) s4-1) + (when (logtest? (-> self control status) (collide-status touch-wall)) + (let ((s3-0 (-> self tube old-transv))) + (-> self control transv-ctrl y) + (vector-reflect! s4-1 s3-0 (-> self control wall-contact-poly-normal)) + (let ((f0-5 (vector-dot (-> self tube sidetube) (-> self tube old-transv))) + (v1-28 (new-stack-vector0)) + (f1-2 (vector-dot (-> self tube sidetube) s4-1)) + ) + 0.0 + (vector-! v1-28 s4-1 (vector-float*! v1-28 (-> self tube sidetube) f1-2)) + (let* ((f2-2 (vector-length v1-28)) + (f3-0 f2-2) + ) + (cond + ((< 0.0 f0-5) + (if (< f1-2 (- f0-5)) + (set! f1-2 (- f0-5)) + ) + ) + ((< f0-5 0.0) + (if (< (- f0-5) f1-2) + (set! f1-2 (- f0-5)) + ) + ) + ) + (vector+! s4-1 (vector-float*! s4-1 (-> self tube sidetube) f1-2) (vector-float*! v1-28 v1-28 (/ f2-2 f3-0))) + ) + ) + (vector-flatten! s4-1 s4-1 (-> self control local-normal)) + (let ((v1-30 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self tube downtube) s4-1))) + 0.0 + (vector-! v1-30 s4-1 (vector-float*! v1-30 (-> self tube downtube) f0-8)) + ) + (let* ((f0-9 (vector-length v1-30)) + (f1-4 f0-9) + (f2-4 (fmax (-> self control ctrl-xz-vel) (vector-dot s3-0 (-> self tube downtube)))) + ) + (vector+! s4-1 (vector-float*! s4-1 (-> self tube downtube) f2-4) (vector-float*! v1-30 v1-30 (/ f0-9 f1-4))) + ) + ) + ) + (vector-matrix*! s4-1 s4-1 (-> self control w-R-c)) + (let ((f0-11 (-> self control transv-ctrl y))) + (set! (-> self control transv-ctrl quad) (-> s4-1 quad)) + (set! (-> self control transv-ctrl y) f0-11) + ) + ) + ) + (let ((s4-2 (new 'stack-no-clear 'vector))) + (set! (-> s4-2 quad) (-> self tube downtube quad)) + (let ((s3-1 (new 'stack-no-clear 'vector))) + (set! (-> s3-1 quad) (-> self tube sidetube quad)) + (vector-flatten! s3-1 s3-1 (-> self control local-normal)) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + s3-1 + (meters 2) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (vector-matrix*! s3-1 s3-1 (-> self control w-R-c)) + (vector-normalize! s3-1 (* arg0 (-> self control current-surface seek90))) + (vector-v++! (-> self control transv-ctrl) s3-1) + ) + (vector-flatten! s4-2 s4-2 (-> self control local-normal)) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + s4-2 + (meters 2) + (new 'static 'rgba :r #xff :g #x80 :b #x40 :a #x80) + ) + (vector-matrix*! s4-2 s4-2 (-> self control w-R-c)) + (vector-normalize! + s4-2 + (* (-> self control current-surface slope-down-factor) (fmax 0.2 (-> self control surface-angle))) + ) + (vector-v++! (-> self control transv-ctrl) s4-2) + ) + (let* ((f1-8 (-> self control current-surface fric)) + (f0-17 (- 1.0 (* 60.0 (seconds-per-frame) (- 1.0 f1-8)))) + (f0-19 (* 0.5 (+ 1.0 f0-17))) + ) + (set! (-> self control transv-ctrl x) (* (-> self control transv-ctrl x) f0-19)) + (set! (-> self control transv-ctrl z) (* (-> self control transv-ctrl z) f0-19)) + ) + (let ((f0-22 + (- (-> self control current-surface transv-max) (if (< arg1 0.0) + (* arg1 (-> self control current-surface seek0)) + (* arg1 (-> self control current-surface seek180)) + ) + ) + ) + (v1-78 (-> self control transv-ctrl)) + ) + (if (>= (sqrtf (+ (* (-> v1-78 x) (-> v1-78 x)) (* (-> v1-78 z) (-> v1-78 z)))) f0-22) + (vector-xz-normalize! (-> self control transv-ctrl) f0-22) + ) + ) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv-ctrl) (-> self control c-R-w)) + (vector-float*! gp-1 gp-1 0.5) + (add-debug-vector + *display-target-marks* + (bucket-id debug-no-zbuf1) + (-> self control trans) + gp-1 + (meters 0.00024414062) + (new 'static 'rgba :g #xff :b #xff :a #x80) + ) + (vector+! gp-1 gp-1 (-> self control trans)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + gp-1 + (meters 0.2) + "ltransv" + (new 'static 'rgba :g #xff :b #xff :a #x80) + ) + (vector-matrix*! gp-1 (new 'static 'vector :z 40960.0 :w 1.0) (-> self control c-R-w)) + (vector-float*! gp-1 gp-1 0.5) + (vector+! gp-1 gp-1 (-> self control trans)) + (add-debug-text-sphere + *display-target-marks* + (bucket-id debug-no-zbuf1) + gp-1 + (meters 0.2) + "nose" + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + ) + (tube-sounds) + 0 + (none) + ) + +;; definition for function target-tube-post +;; INFO: Used lq/sq +(defbehavior target-tube-post target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self tube old-transv quad) (-> self control transv quad)) + (flag-setup) + (build-conversions (-> self control transv)) + (if (logtest? (-> self target-flags) (target-flags tinvuln1)) + (set! (-> self control current-surface turnv) (* 3.0 (-> self control current-surface turnv))) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) + (-> self control local-normal) + ) + (do-rotations1) + (send-event + (handle->process (-> self tube tube)) + 'update + (-> self tube centertube) + (-> self tube downtube) + (-> self tube sidetube) + (-> self tube foretube) + ) + (vector-flatten! + (-> self tube downhill) + (vector-negate! (new-stack-vector0) (-> self control dynam gravity-normal)) + (-> self control local-normal) + ) + (vector-normalize! (-> self tube downhill) 1.0) + (set! (-> self control turn-to-magnitude) 1.0) + (let ((f28-0 (analog-input (the-as int (-> self control cpad leftx)) 128.0 32.0 110.0 1.0))) + (set! (-> self tube mod-x) f28-0) + (let ((f0-8 (analog-input (the-as int (-> self control cpad lefty)) 128.0 32.0 110.0 1.0))) + (set! (-> self tube mod-y) f0-8) + (tube-thrust f28-0 f0-8) + ) + ) + (add-gravity) + (do-rotations2) + (reverse-conversions (-> self control transv)) + (set! (-> self control reaction) target-collision-reaction) + (let ((a2-5 (new 'stack-no-clear 'collide-query))) + (let ((v1-52 (-> self control))) + (set! (-> a2-5 collide-with) (-> v1-52 root-prim prim-core collide-with)) + (set! (-> a2-5 ignore-process0) self) + (set! (-> a2-5 ignore-process1) #f) + (set! (-> a2-5 ignore-pat) (-> v1-52 pat-ignore-mask)) + ) + (set! (-> a2-5 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide (-> self control) (-> self control transv) a2-5 (meters 1)) + ) + (bend-gravity) + (post-flag-setup) + (set! (-> self control surf) *tube-surface*) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (ja-post) + (joint-points) + (do-target-gspot) + (target-powerup-process) + (none) + ) + +;; failed to figure out what this is: +(defstate target-tube (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + 'tube + ) + (else + (let ((v1-3 message)) + (cond + ((= v1-3 'change-mode) + (case (-> block param 0) + (('grab) + (when (not (focus-test? self dead)) + (if (-> block param 1) + (logior! (-> self focus-status) (focus-status grabbed)) + ) + #t + ) + ) + ) + ) + ((= v1-3 'end-mode) + (case (-> block param 0) + (('grab) + (when (focus-test? self grabbed) + (logclear! (-> self focus-status) (focus-status grabbed)) + #t + ) + ) + (('tube) + (cond + ((focus-test? self indax) + enter-state + (-> *TARGET-bank* tube-jump-height-min) + (-> *TARGET-bank* tube-jump-height-max) + (go target-indax-jump) + ) + (else + (go + target-jump + (-> *TARGET-bank* tube-jump-height-min) + (-> *TARGET-bank* tube-jump-height-max) + (the-as surface #f) + ) + ) + ) + ) + ) + ) + ((= v1-3 'touched) + (send-event proc 'attack (-> block param 0) 'tube 0 0) + #f + ) + ((or (= v1-3 'attack) (= v1-3 'attack-or-shove) (= v1-3 'attack-invinc)) + (target-attacked + 'attack-or-shove + (the-as attack-info (-> block param 1)) + proc + (the-as touching-shapes-entry (-> block param 0)) + target-tube-hit + ) + ) + ((-> self major-mode-event-hook) + ((-> self major-mode-event-hook)) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + ) + ) + ) + :exit (behavior () + (when (not (and (-> self next-state) + (let ((v1-3 (-> self next-state name))) + (or (= v1-3 'target-tube-walk) (= v1-3 'target-tube-jump) (= v1-3 'target-tube-hit)) + ) + ) + ) + (logclear! (-> self focus-status) (focus-status tube)) + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control dynam gravity-max) (-> self control standard-dynamics gravity-max)) + (set! (-> self control dynam gravity-length) (-> self control standard-dynamics gravity-length)) + (target-collide-set! 'normal 0.0) + (set! (-> self control reaction) target-collision-reaction) + (remove-setting! 'slave-options) + (sound-stop (-> self tube tube-sound-id)) + (set! (-> self tube tube-sound-id) (new 'static 'sound-id)) + (send-event (handle->process (-> self tube tube)) 'end-mode) + (when (focus-test? self indax) + (remove-setting! 'string-min-length) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-height) + (remove-setting! 'string-max-height) + (remove-setting! 'fov) + ) + (target-exit) + (let ((t9-10 (-> self sub-mode-exit-hook))) + (if t9-10 + (t9-10) + ) + ) + ) + (let ((t9-11 (-> self major-mode-exit-hook))) + (if t9-11 + (t9-11) + ) + ) + ) + :code nothing + :post (behavior () + (target-tube-post) + ) + ) + +;; failed to figure out what this is: +(defstate target-tube-start (target) + :parent target-tube + :code (behavior ((arg0 handle)) + (set-setting! 'slave-options 'set 0.0 (cam-slave-options BIKE_MODE)) + (target-exit) + (set! (-> self control surf) *tube-surface*) + (if (zero? (-> self tube)) + (set! (-> self tube) (new 'process 'tube-info)) + ) + (set! (-> self tube tube) arg0) + (set! (-> self tube entity) #f) + (let ((a0-4 (handle->process arg0))) + (if a0-4 + (set! (-> self tube entity) (-> a0-4 entity)) + ) + ) + (set-time! (-> self tube start-time)) + (set! (-> self tube tube-sound-id) (new-sound-id)) + (set! (-> self tube tube-sound-vol) 0.0) + (set! (-> self tube tube-sound-pitch) 0.0) + (target-collide-set! 'tube 0.0) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control ctrl-xz-vel) 0.0) + (logior! (-> self focus-status) (focus-status tube)) + (when (focus-test? self indax) + (set-setting! 'string-min-length 'abs (meters 4) 0) + (set-setting! 'string-max-length 'abs (meters 4) 0) + (set-setting! 'string-min-height 'abs (meters 6) 0) + (set-setting! 'string-max-height 'abs (meters 6) 0) + (set-setting! 'fov 'abs (degrees 95.0) 0) + ) + (remove-exit) + (cond + ((< (the-as + float + (send-event + (handle->process (-> self tube tube)) + 'update + (-> self tube centertube) + (-> self tube downtube) + (-> self tube sidetube) + (-> self tube foretube) + ) + ) + 0.5 + ) + (vector-normalize-copy! (-> self control transv) (-> self tube downtube) 40960.0) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> self control transv) 1.0) + (-> self control dynam gravity-normal) + ) + (go target-tube-jump (-> *TARGET-bank* tube-jump-height-min) (-> *TARGET-bank* tube-jump-height-max)) + ) + (else + (go target-tube-walk) + ) + ) + ) + :post target-post + ) + +;; definition for function target-tube-turn-anim +;; WARN: Return type mismatch int vs none. +(defbehavior target-tube-turn-anim target () + (let ((f30-0 (-> self clock clock-ratio))) + (let ((gp-1 (max 1 (the int (-> self clock time-adjust-ratio))))) + (update-rates! (-> self clock) (/ f30-0 (the float gp-1))) + (while (nonzero? gp-1) + (+! gp-1 -1) + (set! (-> self tube turn-anim-targ) (fmax -20.0 (fmin 20.0 (-> self tube turn-anim-targ)))) + (or (not (>= (* (-> self tube turn-anim-targ) (-> self tube turn-anim-frame)) 0.0)) + (< (fabs (-> self tube turn-anim-frame)) (fabs (-> self tube turn-anim-targ))) + ) + (+! (-> self tube turn-anim-vel) + (* (- (-> self tube turn-anim-targ) (-> self tube turn-anim-frame)) + (lerp-scale + 20.0 + (if (< (fabs (-> self tube turn-anim-frame)) (fabs (-> self tube turn-anim-targ))) + 30.0 + 60.0 + ) + (-> self control ctrl-xz-vel) + 0.0 + 36864.0 + ) + (seconds-per-frame) + ) + ) + (set! (-> self tube turn-anim-vel) + (fmax + -100.0 + (fmin 100.0 (* (-> self tube turn-anim-vel) (lerp-scale 0.96 0.9 (-> self control ctrl-xz-vel) 0.0 36864.0))) + ) + ) + (+! (-> self tube turn-anim-frame) (* (-> self tube turn-anim-vel) (seconds-per-frame))) + (set! (-> self tube turn-anim-frame) (fmax -20.0 (fmin 20.0 (-> self tube turn-anim-frame)))) + (cond + ((and (>= (-> self tube turn-anim-frame) 20.0) (>= (-> self tube turn-anim-vel) 0.0)) + (set! (-> self tube turn-anim-vel) 0.0) + ) + ((and (>= -20.0 (-> self tube turn-anim-frame)) (>= 0.0 (-> self tube turn-anim-vel))) + (set! (-> self tube turn-anim-vel) 0.0) + ) + ) + ) + ) + (update-rates! (-> self clock) f30-0) + ) + (let ((a1-4 (if (focus-test? self indax) + jakb-lightjak-shield-end-ja + jakb-tube-turn-ja + ) + ) + ) + (ja :group! a1-4 + :num! (identity (ja-aframe + (+ (-> self tube turn-anim-frame) + (* 5.0 (sin (* 145.63556 (the float (- (current-time) (-> self state-time)))))) + ) + 0 + ) + ) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate target-tube-walk (target) + :parent target-tube + :enter (behavior () + (set! (-> self control mod-surface) *tube-mods*) + (set! (-> self control surf) *tube-surface*) + ) + :trans (behavior () + (if (and (logtest? (logior (logior (-> *cpad-list* cpads (-> self control cpad number) button0-rel 0) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 1) + ) + (-> *cpad-list* cpads (-> self control cpad number) button0-rel 2) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go target-tube-jump (-> *TARGET-bank* tube-jump-height-min) (-> *TARGET-bank* tube-jump-height-max)) + ) + (when (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (seconds 0.2)) + (and (< 4096.0 (target-height-above-ground)) (!= (-> self control gspot-pat-surfce event) 7)) + ) + (set! (-> self control unknown-float0000) (+ -24576.0 (-> self tube centertube y))) + (cond + ((focus-test? self indax) + enter-state + 'tube + (go target-indax-falling) + ) + (else + (go target-falling 'tube) + ) + ) + ) + ) + :code (behavior () + (cond + ((and (not (focus-test? self indax)) + (let ((v1-5 (ja-group))) + (and v1-5 (or (= v1-5 jakb-jump-forward-ja) (= v1-5 jakb-duck-high-jump-ja) (= v1-5 jakb-jump-loop-ja))) + ) + ) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! jakb-tube-jump-land-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self tube turn-anim-frame) 0.0) + ) + ((and (focus-test? self indax) + (let ((v1-39 (ja-group))) + (and v1-39 (or (= v1-39 (-> self draw art-group data 476)) (= v1-39 (-> self draw art-group data 477)))) + ) + ) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! jakb-lightjak-dummy21-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self tube turn-anim-frame) 0.0) + ) + (else + (ja-channel-push! 1 (seconds 0.04)) + ) + ) + (until #f + (set! (-> self tube turn-anim-targ) (* 20.0 (-> self tube mod-x))) + (target-tube-turn-anim) + (suspend) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate target-tube-jump (target) + :parent target-tube + :enter (behavior ((arg0 float) (arg1 float)) + (set-time! (-> self state-time)) + (init-var-jump arg0 arg1 #t #f (-> self control transv) 2.0) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! (-> self control mod-surface) *tube-jump-mods*) + (set! (-> self control unknown-float0000) (+ -24576.0 (-> self tube centertube y))) + ) + :trans (behavior () + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-tube-walk) + ) + (mod-var-jump #t #t (cpad-hold? (-> self control cpad number) x) (-> self control transv)) + (seek! + (-> self control unknown-float35) + (fmax 0.0 (fmin 1.0 (* 0.00012207031 (+ -2048.0 (-> self control ctrl-xz-vel))))) + (seconds-per-frame) + ) + (if (and (< (-> self control trans y) (-> self control unknown-float0000)) + (and (< (vector-dot (-> self control dynam gravity-normal) (-> self control transv)) 0.0) + (not (and (= *cheat-mode* 'debug) (cpad-hold? (-> self control cpad number) r2))) + (focus-test? self indax) + ) + ) + (send-event + self + 'attack-invinc + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode 'endlessfall) + ) + ) + ) + ) + ) + :code (behavior ((arg0 float) (arg1 float)) + (let ((f28-0 35.0) + (f30-0 1.0) + ) + (ja-channel-push! 1 (seconds 0.05)) + (set! f28-0 (cond + ((focus-test? self indax) + (sound-play "dax-effort") + (ja :group! (-> self draw art-group data 476)) + 10.0 + ) + ((= (-> self ext-anim) (target-anim default)) + (ja :group! jakb-duck-high-jump-ja :num! (identity (ja-aframe 16.0 0))) + f28-0 + ) + (else + (ja :group! jakb-jump-forward-ja) + 10.0 + ) + ) + ) + (until (ja-done? 0) + (let* ((f24-0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (f26-0 (- f28-0 (ja-aframe-num 0))) + (f0-8 (fmin (fmin 3.0 f26-0) (/ (* 5.0 f26-0) (the float (time-to-apex f24-0 -245760.0))))) + (a0-16 (-> self skel root-channel 0)) + ) + (set! (-> a0-16 param 0) (the float (+ (-> a0-16 frame-group frames num-frames) -1))) + (let ((v1-35 (and (< 0.0 f24-0) (< 0.0 f26-0)))) + (set! (-> a0-16 param 1) (if v1-35 + f0-8 + f30-0 + ) + ) + ) + (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-seek!) + ) + (suspend) + ) + ) + (if (focus-test? self indax) + (ja-no-eval :group! (-> self draw art-group data 477) :num! (loop!) :frame-num 0.0) + (ja-no-eval :group! jakb-jump-loop-ja :num! (loop!) :frame-num 0.0) + ) + (until #f + (suspend) + (ja :num! (loop!)) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate target-tube-hit (target) + :parent target-tube + :enter (behavior ((arg0 symbol) (arg1 attack-info)) + (send-event + (handle->process (-> self tube tube)) + 'update + (-> self tube centertube) + (-> self tube downtube) + (-> self tube sidetube) + (-> self tube foretube) + ) + ) + :exit (behavior () + (if (not (and (-> self next-state) (= (-> self next-state name) 'target-tube-death))) + (logclear! (-> self focus-status) (focus-status dead hit)) + ) + (logclear! (-> self focus-status) (focus-status grabbed in-head)) + (logclear! (-> self target-flags) (target-flags tf1 tf5)) + (let ((v1-12 (-> self prev-state parent))) + (when v1-12 + (let ((t9-0 (-> v1-12 exit))) + (if t9-0 + (t9-0) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol) (arg1 attack-info)) + (let ((gp-0 (-> self attack-info))) + (set-time! (-> self state-time)) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (when (not (logtest? (-> arg1 mask) (attack-mask vector))) + (vector-! + (-> arg1 vector) + (vector+float*! (new 'stack-no-clear 'vector) (-> self tube foretube) (-> self tube downtube) 20480.0) + (-> self control trans) + ) + (let ((v1-11 (new-stack-vector0)) + (f0-2 (vector-dot (-> self control wall-contact-poly-normal) (-> arg1 vector))) + ) + 0.0 + (vector-! v1-11 (-> arg1 vector) (vector-float*! v1-11 (-> self control wall-contact-poly-normal) f0-2)) + (let* ((f1-2 (vector-length v1-11)) + (f2-0 f1-2) + ) + (if (< f0-2 0.0) + (set! f0-2 (* 0.5 f0-2)) + ) + (vector+! + (-> arg1 vector) + (vector-float*! (-> arg1 vector) (-> self control wall-contact-poly-normal) f0-2) + (vector-float*! v1-11 v1-11 (/ f1-2 f2-0)) + ) + ) + ) + (logior! (-> arg1 mask) (attack-mask vector)) + ) + (when (and (logtest? (-> arg1 mask) (attack-mask mode)) + (= (-> arg1 mode) 'darkeco) + (not (logtest? (-> arg1 mask) (attack-mask shove-up))) + ) + (set! (-> arg1 shove-up) 12288.0) + (logior! (-> arg1 mask) (attack-mask shove-up)) + ) + (let ((v1-23 gp-0)) + (set! (-> v1-23 attacker) (the-as handle #f)) + (set! (-> v1-23 mode) 'generic) + (set! (-> v1-23 shove-back) 6144.0) + (set! (-> v1-23 shove-up) 12288.0) + (set! (-> v1-23 angle) #f) + (set! (-> v1-23 trans quad) (-> self control trans quad)) + (set! (-> v1-23 control) 0.0) + (set! (-> v1-23 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) + (set! (-> v1-23 damage) (-> *FACT-bank* health-default-inc)) + ) + (combine! gp-0 arg1 self) + (when (= arg0 'attack) + (send-event (handle->process (-> self notify)) 'notify 'hit (-> gp-0 mode)) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> gp-0 mode) + (('bot) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (if (= (-> self game mode) 'play) + (go target-death (-> gp-0 mode)) + ) + ) + (('endlessfall) + (when (= (-> self game mode) 'play) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (cond + ((focus-test? self indax) + enter-state + (-> gp-0 mode) + (go target-indax-death) + ) + (else + (go target-death (-> gp-0 mode)) + ) + ) + ) + ) + (('lava 'melt) + (when (= (-> self game mode) 'play) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-death (-> gp-0 mode)) + ) + ) + (else + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> gp-0 damage)) (the-as handle #f)) + ) + ) + (target-hit-effect gp-0) + ) + (set! (-> self control mod-surface) *smack-mods*) + (target-hit-setup-anim gp-0) + (target-hit-move gp-0 (target-hit-orient gp-0 (-> gp-0 vector)) target-falling-anim-trans 1.0) + (let ((v1-69 (new-stack-vector0)) + (f0-12 (vector-dot (-> self tube downtube) (-> self control transv))) + ) + 0.0 + (vector-! v1-69 (-> self control transv) (vector-float*! v1-69 (-> self tube downtube) f0-12)) + (let ((f1-5 (vector-length v1-69)) + (f2-2 (fmax 40960.0 f0-12)) + (f0-13 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self tube downtube) f2-2) + (vector-float*! v1-69 v1-69 (/ f0-13 f1-5)) + ) + ) + ) + (let ((s5-2 forward-up-nopitch->quaternion) + (s4-1 (-> self control dir-targ)) + (t9-14 vector-normalize!) + (a0-71 (new-stack-vector0)) + ) + (set! (-> a0-71 quad) (-> self control transv quad)) + (s5-2 s4-1 (t9-14 a0-71 1.0) (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ))) + ) + (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-tube-death (-> gp-0 mode)) + ) + ) + (go target-tube-walk) + ) + :post target-post + ) + +;; failed to figure out what this is: +(defstate target-tube-death (target) + :parent target-tube + :event (-> target-death event) + :exit (behavior () + (logclear! (-> self focus-status) (focus-status dead hit)) + (target-exit) + (remove-setting! 'process-mask) + (apply-settings *setting-control*) + (let ((v1-7 (-> self prev-state parent))) + (when v1-7 + (let ((t9-3 (-> v1-7 exit))) + (if t9-3 + (t9-3) + ) + ) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (local-vars (v1-53 symbol)) + (set! (-> self neck flex-blend) 0.0) + (target-timed-invulnerable-off self 0) + (add-setting! 'process-mask 'set 0.0 (process-mask enemy platform projectile death)) + (apply-settings *setting-control*) + (set! (-> self control transv quad) (the-as uint128 0)) + (let ((s5-0 (-> self child))) + (while s5-0 + (send-event (ppointer->process s5-0) 'notice 'die) + (set! s5-0 (-> s5-0 0 brother)) + ) + ) + (set! (-> self death-resetter continue) #f) + (set! (-> self death-resetter node) (game-task-node none)) + (set! (-> self death-resetter reset-mode) 'life) + (set! (-> self death-resetter execute) #f) + (set! (-> self control mod-surface) *neutral-mods*) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-deatha-ja :num! (seek! (ja-aframe 134.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (let ((gp-2 (new 'stack-no-clear 'vector))) + (when (not (logtest? (-> self align flags) (align-flags disabled))) + (vector-matrix*! gp-2 (the-as vector (-> self align delta)) (-> self control c-R-w)) + (vector-float*! (-> self control transv) gp-2 (-> self clock frames-per-second)) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 134.0 0))) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (initialize! (-> self game) 'life (the-as game-save #f) (the-as string #f) (the-as resetter-spec #f)) + (set-time! (-> self state-time)) + (until v1-53 + (suspend) + (set! v1-53 (and (time-elapsed? (-> self state-time) (seconds 1)) (not (movie?)))) + ) + (go target-tube-walk) + ) + :post target-no-stick-post + ) + +;; definition of type slide-control +(deftype slide-control (process-drawable) + ((target handle) + (pos float) + (trans vector :inline) + (rot vector :inline) + (side vector :inline) + ) + (:state-methods + slide-control-watch + slide-control-ride + ) + ) + +;; definition for method 3 of type slide-control +(defmethod inspect ((this slide-control)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Ttarget: ~D~%" (-> this target)) + (format #t "~2Tpos: ~f~%" (-> this pos)) + (format #t "~2Ttrans: ~`vector`P~%" (-> this trans)) + (format #t "~2Trot: ~`vector`P~%" (-> this rot)) + (format #t "~2Tside: ~`vector`P~%" (-> this side)) + (label cfg-4) + this + ) + +;; definition for function distance-from-tangent +(defun distance-from-tangent ((arg0 path-control) (arg1 float) (arg2 vector) (arg3 vector) (arg4 vector) (arg5 vector)) + (get-point-in-path! arg0 arg2 arg1 'interp) + (displacement-between-two-points-normalized! arg0 arg3 arg1) + (set! (-> arg2 y) (-> arg5 y)) + (set! (-> arg3 y) 0.0) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (vector-rotate-y! arg4 arg3 -16384.0) + (set! (-> arg4 y) 0.0) + (let* ((a2-5 (vector+! (new 'stack-no-clear 'vector) arg2 arg4)) + (f0-3 (vector-line-distance-point! arg5 arg2 a2-5 s2-1)) + ) + (if (< 0.0 (vector-dot arg3 (vector-! (new 'stack-no-clear 'vector) arg5 s2-1))) + (set! f0-3 (- f0-3)) + ) + f0-3 + ) + ) + ) + +;; definition for function find-target-point +;; INFO: Used lq/sq +(defbehavior find-target-point slide-control ((arg0 vector)) + (local-vars (f0-2 float)) + (let* ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (gp-0 (new 'stack-no-clear 'vector)) + (f28-0 (+ -0.1 (-> self pos))) + (f26-0 (distance-from-tangent (-> self path) f28-0 s4-0 s5-0 gp-0 arg0)) + ) + 0.0 + (let ((f30-0 f28-0)) + (until (or (and (< f26-0 f0-2) (>= f0-2 0.0)) (< (get-num-segments (-> self path)) f28-0)) + (set! f0-2 (distance-from-tangent (-> self path) f28-0 s4-0 s5-0 gp-0 arg0)) + (when (or (>= f26-0 f0-2) (< f26-0 0.0)) + (set! f26-0 f0-2) + (set! f30-0 f28-0) + ) + (set! f28-0 (+ 0.01 f28-0)) + ) + (distance-from-tangent (-> self path) f30-0 s4-0 s5-0 gp-0 arg0) + (set! (-> self trans quad) (-> s4-0 quad)) + (set! (-> self rot quad) (-> s5-0 quad)) + (set! (-> self side quad) (-> gp-0 quad)) + (set! (-> self pos) f30-0) + ) + ) + (-> self pos) + ) + +;; failed to figure out what this is: +(defstate slide-control-watch (slide-control) + :virtual #t + :enter (behavior () + (get-point-in-path! (-> self path) (-> self trans) 0.2 'interp) + (get-point-in-path! (-> self path) (-> self root trans) 0.2 'interp) + (displacement-between-two-points-normalized! (-> self path) (-> self rot) 0.2) + (set! (-> self pos) 0.2) + ) + :trans (behavior () + (if (and (and *target* + (and (>= 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (< 0.0 + (vector-dot + (vector-! (new 'stack-no-clear 'vector) (-> *target* control trans) (-> self trans)) + (-> self rot) + ) + ) + (and (not (focus-test? *target* in-air)) + (< (-> *target* control trans y) (+ 12288.0 (-> self root trans y))) + (send-event *target* 'change-mode 'tube self) + ) + ) + (go-virtual slide-control-ride) + ) + ) + :code sleep-code + ) + +;; failed to figure out what this is: +(defstate slide-control-ride (slide-control) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('end-mode) + (go-virtual slide-control-watch) + ) + (('update) + (let* ((s4-0 proc) + (gp-0 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (if gp-0 + (find-target-point (-> (the-as process-drawable gp-0) root trans)) + ) + (set! (-> (the-as vector (-> block param 0)) quad) (-> self trans quad)) + (set! (-> (the-as vector (-> block param 1)) quad) (-> self rot quad)) + (set! (-> (the-as vector (-> block param 2)) quad) (-> self side quad)) + (get-point-in-path! (-> self path) (the-as vector (-> block param 3)) (+ 0.2 (-> self pos)) 'interp) + (if (>= (-> self pos) (+ -0.2 (get-num-segments (-> self path)))) + (send-event gp-0 'end-mode 'tube) + ) + ) + (-> self pos) + ) + ) + ) + :enter (behavior () + (set! (-> self pos) 0.0) + (set! (-> self target) (process->handle *target*)) + (process-entity-status! self (entity-perm-status no-kill) #t) + ) + :exit (behavior () + (set! (-> self target) (the-as handle #f)) + (process-entity-status! self (entity-perm-status no-kill) #f) + ) + :trans (behavior () + (let ((gp-0 (handle->process (-> self target)))) + (cond + ((if (type? gp-0 process-drawable) + gp-0 + ) + ) + (else + (go-virtual slide-control-watch) + ) + ) + ) + ) + :code sleep-code + ) + +;; definition for method 11 of type slide-control +(defmethod init-from-entity! ((this slide-control) (arg0 entity-actor)) + (set! (-> this root) (new 'process 'trsqv)) + (process-drawable-from-entity! this arg0) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0)) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> this target) (the-as handle #f)) + (go (method-of-object this slide-control-watch)) + ) diff --git a/test/decompiler/reference/jak3/engine/target/target-util_REF.gc b/test/decompiler/reference/jak3/engine/target/target-util_REF.gc index 8eec0a844b..cbe7be17c4 100644 --- a/test/decompiler/reference/jak3/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-util_REF.gc @@ -1539,7 +1539,7 @@ ;; definition for function fall-test ;; WARN: Return type mismatch object vs none. -(defbehavior fall-test target ((arg0 (state symbol target)) (arg1 float)) +(defbehavior fall-test target ((arg0 (state object target)) (arg1 float)) (when (and (not (logtest? (-> self control status) (collide-status on-surface))) (time-elapsed? (-> self control last-time-on-surface) (-> *TARGET-bank* ground-timeout)) (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) diff --git a/test/decompiler/reference/jak3/engine/target/target_REF.gc b/test/decompiler/reference/jak3/engine/target/target_REF.gc index 81b9e7b8d8..018460f2ac 100644 --- a/test/decompiler/reference/jak3/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target_REF.gc @@ -1863,7 +1863,7 @@ ;; failed to figure out what this is: (defstate target-falling (target) :event target-jump-event-handler - :enter (behavior ((arg0 symbol)) + :enter (behavior ((arg0 object)) (case arg0 (('uppercut) (set! (-> self control mod-surface) *uppercut-jump-mods*) @@ -1886,7 +1886,7 @@ #t ) ) - :code (behavior ((arg0 symbol)) + :code (behavior ((arg0 object)) (case arg0 (('uppercut) (ja-no-eval :num! (seek!)) diff --git a/test/offline/config/jak3/config.jsonc b/test/offline/config/jak3/config.jsonc index 925519dad9..a40f544241 100644 --- a/test/offline/config/jak3/config.jsonc +++ b/test/offline/config/jak3/config.jsonc @@ -2,7 +2,10 @@ "dgos": [ "CGO/KERNEL.CGO", "CGO/GAME.CGO", - "DGO/HALFPIPE.DGO" + "DGO/HALFPIPE.DGO", + "DGO/PRECC.DGO", + "DGO/LMECH.DGO", + "DGO/WWD.DGO" ], "skip_compile_files": [ @@ -174,8 +177,13 @@ // script "command-get-process", // mood - "update-mood-direction" + "update-mood-direction", + // eyes + "debug-eyes" ], - "skip_compile_states": {} + "skip_compile_states": { + "(target-flut-kanga-catch target)": ["post", "code"], // setting pp + "(target-flut-death target)": ["code"] + } }