diff --git a/Taskfile.yml b/Taskfile.yml index 49dda18a16..1009f321fe 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -77,18 +77,17 @@ tasks: type-test: cmds: - ./out/build/Release/bin/goalc-test.exe --gtest_brief=0 --gtest_filter="*MANUAL_TEST_TypeConsistencyWithBuildFirst*" + check-gsrc-file: + cmds: + - python ./scripts/check-gsrc-file.py --files "{{.FILES}}" update-gsrc: cmds: - python ./scripts/next-decomp-file.py --files "{{.FILES}}" - task: decomp + - task: find-label-types - python ./scripts/update-goal-src.py --files "{{.FILES}}" - task: type-test - # TODO - make a script that checks for function/method splits - file-good?: - cmds: - - task: type-test - - task: offline-tests - - task: find-label-types + - task: check-gsrc-file cast-repl: cmds: - cmd: python ./scripts/cast-repl.py diff --git a/common/goos/TextDB.cpp b/common/goos/TextDB.cpp index afd555d1ac..4a1d4090a5 100644 --- a/common/goos/TextDB.cpp +++ b/common/goos/TextDB.cpp @@ -141,7 +141,7 @@ std::string TextDb::get_info_for(const Object& o, bool* terminate_compiler_error */ std::string TextDb::get_info_for(const std::shared_ptr& frag, int offset) const { int line_idx = frag->get_line_idx(offset); - std::string result = frag->get_description() + ", line: " + std::to_string(line_idx + 1) + "\n"; + std::string result = frag->get_description() + ":" + std::to_string(line_idx + 1) + "\n"; result += frag->get_line_containing_offset(offset) + "\n"; int offset_in_line = std::max(offset - frag->get_offset_of_line(line_idx), 1) - 1; diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index 5392e08d49..85e0e9f333 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -652,6 +652,7 @@ (bit7 7) ;; TODO - nav-enemy::45 (bit8 8) (bit10 10) ;; TODO - nav-enemy::nav-enemy-patrol-post + (bit12 12) ;; TODO - rolling-lightning-mole::(enter nav-enemy-chase fleeing-nav-enemy) (bit13 13) (bit17 17) (bit19 19) ;; TODO - nav-enemy::lambda::17 @@ -954,6 +955,9 @@ (beach-flutflutegg-hint #x275) (sidekick-hint-fish-powerup #x278) + + (misty-racer-hit-the-ballon-lurkers #x27e) + (sidekick-speech-hint-crate-darkeco1 #x281) (beach-collectors-unblocked #x288) @@ -974,7 +978,7 @@ (found-all-scout-flies #x296) (yakow-owed-powercell #x297) - + (misty-teetertotter-bonk-dax-tutorial #x2a4) (sidekick-hint-misty-get-red-eco #x2a5) @@ -990,6 +994,11 @@ (missed #x2b5) (lose! #x2b6) + (daxter-screaming-jump #x290) + (daxter-wahoo-jump #x291) + + (red-eco-tutorial #x2a6) + (village2-gambler-money #x300) (village2-geologist-money #x301) (village2-warrior-money #x302) @@ -1031,15 +1040,13 @@ (rolling-ring-chase-2 #x325) (rolling-beat-lurkers #x327) - (swamp-finished-with-flutflut #x328) - (rolling-race-beat-record #x335) (sidekick-speech-hint-rolling-crate-darkeco #x336) - + (rolling-lightning-moles-completion #x338) (rolling-dark-plants-location-hint #x339) (rolling-dark-plants-hint #x33a) - + (rolling-flying-lurker-intro #x33c) (rolling-ring-hint-one-ring-down #x33f) (rolling-ring-hint-be-quick-to-next #x340) (rolling-ring-hint-be-quick-all #x341) @@ -1052,6 +1059,7 @@ (sunken-blue-eco-charger-all-hint #x34d) (swamp-rats-nest-hint #x358) + (daxter-you-can-shoot-with-yellow-eco #x359) (swamp-bats-hint #x364) ;; maybe we can ???? the bats. lol (flutflut-reminder #x368) @@ -1109,6 +1117,8 @@ (snow-frozen-crate #x42b) ;; task name? (snow-bumpers #x42c) + (daxter-maybe-you-can-shoot-better-goggles #x433) + (darkcave-light-crystal-low-light-hint #x437) (darkcave-light-crystal-hint #x438) @@ -1162,6 +1172,9 @@ (citadel-break-generators-reminder #x809) (citadel-climb-plat-hint #x80c) + (daxter-dont-miss-the-next-launcher #x80d) + + (daxter-land-on-the-next-launcher #x812) (misty-battle-finished #x813) (training-precursor-orbs #x901) @@ -7862,7 +7875,7 @@ :flag-assert #xd00000014 (:methods (login (_type_) _type_ 9) - (dummy-10 (_type_ string type) joint 10) + (dummy-10 (_type_ string type) joint 10) ;; can also be art-joint-anim (dummy-11 (_type_ string type) int 11) (needs-link? (_type_) symbol 12) ) @@ -9577,7 +9590,7 @@ :flag-assert #xb000000c0 (:methods (new (symbol type int) _type_ 0) - (dummy-9 (_type_) none 9) + (dummy-9 (_type_) float 9) (dummy-10 (_type_ symbol) int 10) ) ) @@ -11380,9 +11393,9 @@ (unknown-vector10 vector :inline :offset 544) ;; from - logic-target::flat-setup (unknown-vector11 vector :inline :offset 560) ;; from - logic-target::target-no-move-post (unknown-vector12 vector :inline :offset 576) - (unknown-vector13 vector :inline :offset 592) ;; from - collide-shape::method-37 + (unknown-vector13 vector :inline :offset 592) ;; from - collide-shape::method-37 | target::mod-var-jump (unknown-vector14 vector :inline :offset 608) ;; from - logic-target::target-no-move-post - (unknown-vector15 vector :inline :offset 624) ;; from - collide-shape::method-37 + (unknown-vector15 vector :inline :offset 624) ;; from - collide-shape::method-37 | target-handler::target-exit (unknown-vector16 vector :inline :offset 640) ;; from - collide-shape::method-37 (unknown-dynamics00 dynamics :offset 656) ;; from - logic-target::bend-gravity (unknown-surface00 surface :offset 660) @@ -11409,7 +11422,8 @@ (unknown-qword00 uint128 :offset 1136) (unknown-float30 float :offset 1140) ;; from - logic-target::target-calc-camera-pos (unknown-vector40 vector :inline :offset 1152) ;; from - logic-target::target-real-post - (unknown-float40 float :offset 1176) ;; from - logic-target::do-rotations2 + (unknown-float40 float :offset 1172) ;; from - target-death::lambda-1 + (unknown-float41 float :offset 1176) ;; from - logic-target::do-rotations2 (unknown-int00 int32 :offset 1180) ;; from - logic-target::joint-points (unknown-float50 float :offset 1168) ;; from - logic-target::target-real-post (unknown-vector50 vector :inline :offset 1184) ;; from - logic-target::build-conversions @@ -11433,16 +11447,21 @@ (unknown-float71 float :offset 1524) ;; from - collide-shape::method-37 (unknown-vector70 vector :inline :offset 1536) ;; from - logic-target::add-thrust (unknown-vector71 vector :inline :offset 1552) ;; from - target-tube::tube-thrust - (unknown-vector72 vector :inline :offset 1584) ;; from - collide-reaction-target::target-collision-reaction + (unknown-vector72 vector :inline :offset 1568) ;; from - collide-reaction-racer::racer-collision-reaction + (unknown-vector73 vector :inline :offset 1584) ;; from - collide-reaction-racer::racer-collision-reaction (unknown-handle00 handle :offset 1600) ;; from logic-target::reset-target-state (unknown-sphere-array00 collide-shape-prim-sphere 3 :offset 1608) ;; from target-util::target-collide-set! and from target-util::target-danger-set! (unknown-sphere00 collide-shape-prim-sphere :offset 1632) ;; from target-util::target-danger-set! (unknown-sphere01 collide-shape-prim-sphere :offset 1636) ;; from target-util::target-danger-set! (unknown-sphere02 collide-shape-prim-sphere :offset 1640) ;; from target-util::target-danger-set! - (unknown-dword30 int64 :offset 1672) ;; from target-util::can-hands? - (unknown-dword31 int64 :offset 1680) ;; from target-util::can-hands? - (unknown-dword32 int64 :offset 1688) ;; from target-util::can-feet? - (unknown-dword33 int64 :offset 1696) ;; from target-util::can-feet? + (unknown-int50 int32 :offset 1656) ;; from target::(enter target-wheel) + (unknown-dword30 int64 :offset 1664) ;; from target::(trans target-walk) + (unknown-dword31 int64 :offset 1672) ;; from target-util::can-hands? + (unknown-dword32 int64 :offset 1680) ;; from target-util::can-hands? + (unknown-dword33 int64 :offset 1688) ;; from target-util::can-feet? + (unknown-dword34 int64 :offset 1696) ;; from target-util::can-feet? + (unknown-dword35 int64 :offset 1704) ;; from target::(exit target-slide-down) + (unknown-dword36 int64 :offset 1712) ;; from target::(trans target-jump) (unknown-float80 float :offset 1724) ;; from logic-target::bend-gravity (unknown-float81 float :offset 1728) ;; from logic-target::bend-gravity (unknown-float82 float :offset 1732) ;; from logic-target::bend-gravity @@ -11464,11 +11483,18 @@ (unknown-dword40 int64 :offset 2160) ;; from logic-target::target-compute-edge (unknown-dword41 int64 :offset 2168) ;; from logic-target::target-compute-edge (unknown-handle10 handle :offset 2176) ;; from logic-target::target-compute-pole - probably a swingpole - (unknown-float120 float :offset 2184) ;; from target::mod-var-jump + (unknown-uint20 uint32 :offset 2184) ;; from target::(trans target-running-attack) + (unknown-spoolanim00 spool-anim :offset 2184) ;; from target2::(trans target-stance-ambient) + (unknown-int20 int32 :offset 2184) ;; from (anon-function 1 basebutton) (unknown-symbol20 symbol :offset 2184) ;; from (anon-function 1 basebutton) - (unknown-int20 int32 :offset 2188) ;; from logic-target::target-compute-pole + (unknown-float120 float :offset 2184) ;; from target::mod-var-jump + (unknown-int21 int32 :offset 2188) ;; from logic-target::target-compute-pole + (unknown-uint30 uint32 :offset 2188) ;; from target::(code target-running-attack) (unknown-float121 float :offset 2188) ;; from target::mod-var-jump + (unknown-uint31 uint32 :offset 2192) ;; from target::(trans target-running-attack) + (unknown-float122 float :offset 2196) ;; from target::(trans target-jump) (unknown-float123 float :offset 2200) ;; from target::mod-var-jump + (unknown-float124 float :offset 2204) ;; from target::init-var-jump (unknown-vector102 vector :inline :offset 2224) ;; from (anon-function 3 basebutton) (unknown-vector103 vector :inline :offset 2240) ;; from (anon-function 3 basebutton) (unknown-quaternion02 quaternion :inline :offset 2256) ;; from racer-states::(code target-racing-get-on) @@ -11477,23 +11503,32 @@ (unknown-vector110 vector :inline :offset 2320) ;; from logic-target::flag-setup (unknown-vector111 vector :inline :offset 2336) ;; from logic-target::flag-setup (unknown-symbol30 symbol :offset 2384) ;; from target-util::target-danger-set! + (unknown-int31 uint32 :offset 2384) ;; from target:: (event target-running-attack) (unknown-dword50 int64 :offset 2392) ;; from target-util::target-start-attack (unknown-dword51 int64 :offset 2400) ;; from target-util::target-start-attack + (unknown-pointer00 pointer :offset 2416) ;; from target-handler::target-standard-event-handler (unknown-symbol40 symbol :offset 2428) ;; from logic-target::post-flag-setup + (unknown-dword60 int64 :offset 2432) ;; from target::(enter target-jump) + (unknown-dword61 int64 :offset 2440) ;; from target::(enter target-jump) + (unknown-dword62 int64 :offset 2448) ;; from target::(enter target-jump) - probably some sort of object64 that's used as a vector? + (unknown-dword63 int64 :offset 2456) ;; from target::(enter target-jump) (unknown-halfword00 int16 :offset 2488) ;; from logic-target::target-move-dist ;; these were determined from racer-collision-reaction. (history-length int16 :offset 2490) (history-data collide-history 128 :inline :offset-assert 2496) (unknown-float140 float :offset 18944) - (unknown-dword60 int64 :offset 18952) ;; from logic-target::add-thrust + (unknown-dword70 int64 :offset 18952) ;; from logic-target::add-thrust (unknown-int40 int32 :offset 18880) ;; from logic-target::flag-setup - (unknown-dword70 int64 :offset 18888) ;; from logic-target::post-flag-setup - (unknown-dword71 int64 :offset 18896) ;; from logic-target::post-flag-setup - (unknown-dword72 int64 :offset 18912) ;; from logic-target::reset-target-state - (unknown-vector120 vector :offset 18928) ;; from collide-shape::method-37 - (unknown-int50 uint32 :offset 18976) ;; from logic-target::print-target-stats + (unknown-dword80 int64 :offset 18888) ;; from logic-target::post-flag-setup + (unknown-dword81 int64 :offset 18896) ;; from logic-target::post-flag-setup + (unknown-float130 float :offset 18904) ;; from target2::target-swim-tilt + (unknown-float131 float :offset 18908) ;; from target2::target-swim-tilt + (unknown-dword82 int64 :offset 18912) ;; from logic-target::reset-target-state + (unknown-vector120 vector :inline :offset 18928) ;; from target::(code target-running-attack) + (unknown-float150 float :offset 18944) ;; from target::(code target-wheel-flip) + (unknown-int60 uint32 :offset 18976) ;; from logic-target::print-target-stats (unknown-soundid00 sound-id :offset 18980) ;; from powerups::target-powerup-process - (unknown-float130 float :offset 18984) ;; from powerups::target-powerup-process + (unknown-float141 float :offset 18984) ;; from powerups::target-powerup-process ) :size-assert #x4a2c :method-count-assert 65 @@ -11936,8 +11971,10 @@ (declare-type snowball-info basic) (declare-type tube-info basic) (declare-type racer-info basic) +(declare-type flut-info basic) (deftype target (process-drawable) - ((control control-info :score 100 :offset 112) + ((self-override target :score 100 :offset 28) + (control control-info :score 100 :offset 112) (fact-info-target fact-info-target :score 100 :offset 144) (skel2 basic :offset-assert 176) (racer racer-info :offset-assert 180) @@ -11954,12 +11991,12 @@ (alt-cam-pos vector :inline :offset-assert 448) (snowball snowball-info :offset-assert 464) (tube tube-info :offset-assert 468) - (flut basic :offset-assert 472) + (flut flut-info :offset-assert 472) (current-level level :offset-assert 476) (saved-pos transformq :inline :offset-assert 480) (saved-owner uint64 :offset-assert 528) (alt-neck-pos vector :inline :offset-assert 544) - (fp-hud uint64 :offset-assert 560) + (fp-hud handle :offset-assert 560) (no-load-wait uint64 :offset-assert 568) (no-look-around-wait uint64 :offset-assert 576) ;;(burn-proc handle :offset-assert 584) ;; PAL only @@ -11971,7 +12008,6 @@ (:methods (dummy-20 (_type_ collide-cache) object 20) ;; none or #f ) - (:states (target-racing-get-off handle) (target-racing-jump float float symbol) @@ -11984,15 +12020,15 @@ (target-racing-death symbol) (target-racing-get-off-jump handle) (target-racing-get-off-hit-ground symbol) - - (target-death) + (target-death symbol) (target-hit-ground symbol) - (target-clone-anim) + (target-clone-anim handle) ) ) (deftype sidekick (process-drawable) - ((control control-info :offset 112) + ((parent-override (pointer target) :score 100 :offset 12) + (control control-info :offset 112) (anim-seed uint64 :offset 192) (shadow-in-movie? symbol :offset-assert 200) ) @@ -18458,7 +18494,7 @@ (deftype water-control (basic) ((flags uint32 :offset-assert 4) - (process process :offset-assert 8) + (process process-drawable :offset-assert 8) (joint-index int32 :offset-assert 12) (top-y-offset float :offset-assert 16) (ripple-size meters :offset-assert 20) @@ -18497,14 +18533,14 @@ :flag-assert #x110000011c (:methods (new (symbol type process int float float float) _type_ 0) - (dummy-9 () none 9) + (dummy-9 (_type_) none 9) (dummy-10 (_type_) none 10) - (dummy-11 () none 11) + (start-bobbing! (_type_ float int int) none 11) (distance-from-surface (_type_) float 12) (dummy-13 (_type_ float vector int vector) none 13) (display-water-marks? (_type_) symbol 14) - (dummy-15 () none 15) - (dummy-16 () none 16) + (TODO-RENAME-15 (_type_) none 15) + (TODO-RENAME-16 (_type_) none 16) ) ) @@ -18513,8 +18549,8 @@ (wade-height meters :offset-assert 180) (swim-height meters :offset-assert 184) (bottom-height meters :offset-assert 188) - (attack-event basic :offset-assert 192) - (target uint64 :offset-assert 200) + (attack-event symbol :offset-assert 192) + (target handle :offset-assert 200) (flags uint32 :offset-assert 208) ) :heap-base #x70 @@ -18526,13 +18562,13 @@ (water-vol-idle () _type_ :state 20) (water-vol-startup () _type_ :state 21) (TODO-RENAME-22 (_type_) ripple-wave-set 22) ;; can also return an obs? - (dummy-23 () none 23) - (dummy-24 () none 24) + (reset-root! (_type_) none 23) + (set-stack-size! (_type_) none 24) (TODO-RENAME-25 (_type_) object 25) - (dummy-26 () none 26) - (dummy-27 () none 27) + (TODO-RENAME-26 (_type_) none 26) + (dummy-27 (_type_) none 27) (get-ripple-height (_type_ vector) float 28) - (dummy-29 () none 29) + (TODO-RENAME-29 (_type_) uint 29) ) ) @@ -18975,7 +19011,7 @@ (:methods (new (symbol type process-drawable) _type_ 0) (dummy-9 (_type_) none 9) - (dummy-10 () none 10) + (dummy-10 (_type_ vector) none 10) (TODO-RENAME-11 (_type_) symbol 11) ) ) @@ -19696,8 +19732,8 @@ (define-extern can-play-stance-amibent? (function symbol :behavior target)) (define-extern can-jump? (function symbol symbol :behavior target)) (define-extern move-legs? (function symbol :behavior target)) -(define-extern fall-test (function symbol symbol object :behavior target)) ;; NOTE - first arg unused -(define-extern slide-down-test (function symbol symbol object :behavior target)) +(define-extern fall-test (function none :behavior target)) ;; NOTE - first arg unused +(define-extern slide-down-test (function none :behavior target)) (define-extern smack-surface? (function symbol symbol :behavior target)) (define-extern can-wheel? (function symbol :behavior target)) (define-extern can-duck? (function symbol :behavior target)) @@ -19707,7 +19743,7 @@ (define-extern vector-local+! (function vector vector vector :behavior target)) (define-extern move-forward (function float vector :behavior target)) (define-extern set-forward-vel (function float vector :behavior target)) -(define-extern delete-back-vel (function float none :behavior target)) +(define-extern delete-back-vel (function none :behavior target)) (define-extern set-side-vel (function float vector :behavior target)) (define-extern target-timed-invulnerable (function seconds target none)) (define-extern target-timed-invulnerable-off (function target none)) @@ -19718,8 +19754,8 @@ ;; - Symbols (define-extern *TARGET-bank* target-bank) -(define-extern target-slide-down (state none)) -(define-extern target-falling (state symbol none)) +(define-extern target-slide-down (state target)) +(define-extern target-falling (state symbol target)) (define-extern *jchar-sg* skeleton-group) (define-extern *target-shadow-control* shadow-control) @@ -19748,7 +19784,7 @@ ;; - Functions -(define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector float none)) +(define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) (define-extern target-collision-low-coverage (function control-info collide-shape-intersect vector (pointer int) (pointer int) (pointer symbol) uint)) ;; i think the pointers are lies - TODO (define-extern poly-find-nearest-edge (function vector (inline-array vector) vector vector vector)) (define-extern target-collision-reaction (function control-info collide-shape-intersect vector vector none)) @@ -19767,10 +19803,10 @@ (define-extern target-print-stats (function target symbol symbol )) (define-extern activate-hud (function process none)) (define-extern reset-target-state (function symbol target :behavior target)) -(define-extern init-sidekick (function none)) -(define-extern target-generic-event-handler (function process int symbol event-message-block object)) +(define-extern init-sidekick (function none :behavior sidekick)) +(define-extern target-generic-event-handler (function process int symbol event-message-block object :behavior target)) (define-extern level-setup (function none :behavior target)) -(define-extern target-exit (function none)) +(define-extern target-exit (function none :behavior target)) (define-extern target-calc-camera-pos (function none :behavior target)) (define-extern do-target-shadow (function none :behavior target)) (define-extern target-powerup-process (function none :behavior target)) @@ -19808,7 +19844,7 @@ ;; - Unknowns -(define-extern target-continue (state continue-point none)) +(define-extern target-continue (state continue-point target)) ;; ---------------------- @@ -19819,14 +19855,14 @@ ;; - Functions -(define-extern cspace<-cspace+quaternion! (function cspace quaternion cspace)) -(define-extern starts function) +(define-extern cspace<-cspace+quaternion! (function cspace cspace quaternion matrix)) +(define-extern starts (function object)) ;; - Unknowns (define-extern *sidekick-sg* skeleton-group) -;;(define-extern sidekick-clone object) ;; unknown type -;;(define-extern *sidekick-remap* object) ;; unknown type +(define-extern sidekick-clone (state sidekick)) ;; unknown type +(define-extern *sidekick-remap* pair) ;; unknown type ;; ---------------------- @@ -19883,25 +19919,25 @@ ;; - Functions -(define-extern target-bonk-event-handler function) -(define-extern target-standard-event-handler function) -(define-extern target-send-attack function) -(define-extern target-attacked (function symbol uint uint process (state target) object :behavior target)) ;; unconfirmed, target-tube::(event target-tube-start) -(define-extern target-apply-tongue function) -(define-extern get-intersect-point function) +(define-extern target-bonk-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-standard-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-send-attack (function process uint uint int int symbol :behavior target)) ;; i suspect the uints are actually structures/basics +(define-extern target-attacked (function symbol attack-info process process (state handle attack-info target) object :behavior target)) ;; unconfirmed, target-tube::(event target-tube-start) +(define-extern target-apply-tongue (function vector symbol :behavior target)) +(define-extern get-intersect-point (function vector touching-prims-entry control-info process vector)) (define-extern target-powerup-effect (function symbol none :behavior target)) -(define-extern target-shoved function) -(define-extern target-dangerous-event-handler function) -(define-extern target-jump-event-handler function) -(define-extern target-walk-event-handler function) -(define-extern target-state-hook-exit function) -(define-extern target-effect-exit function) +(define-extern target-shoved (function meters meters process (state target) object :behavior target)) +(define-extern target-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-jump-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-walk-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-state-hook-exit (function none :behavior target)) +(define-extern target-effect-exit (function none :behavior target)) ;; - Unknowns -(define-extern target-jump (state float float symbol target)) ;; unknown type -(define-extern target-hit (state target)) ;; unknown type -(define-extern target-eco-powerup (state target)) ;; unknown type +(define-extern target-jump (state float float surface target)) ;; unknown type +(define-extern target-hit (state symbol attack-info target)) ;; unknown type +(define-extern target-eco-powerup (state object float target)) ;; unknown type (define-extern target-load-wait (state target)) ;; unknown type (define-extern target-grab (state target)) ;; unknown type (define-extern target-look-around (state target)) ;; unknown type @@ -19910,13 +19946,12 @@ (define-extern target-flut-start (state handle target)) ;; unknown type (define-extern target-snowball-start (state handle target)) ;; unknown type (define-extern target-tube-start (state handle target)) ;; unknown type -(define-extern target-periscope (state target)) ;; unknown type +(define-extern target-periscope (state handle target)) ;; unknown type (define-extern target-fishing (state handle target)) ;; unknown type (define-extern target-final-door (state basic handle target)) ;; unknown type -(define-extern target-play-anim (state target)) ;; unknown type -(define-extern target-clone-anim (state target)) ;; unknown type +(define-extern target-play-anim (state string handle target)) ;; unknown type (define-extern target-edge-grab (state target)) ;; unknown type -(define-extern target-pole-cycle (state target)) ;; unknown type +(define-extern target-pole-cycle (state handle target)) ;; unknown type (define-extern target-swim-stance (state target)) ;; unknown type (define-extern target-wade-stance (state target)) ;; unknown type @@ -19935,17 +19970,17 @@ (define-extern init-var-jump (function float float vector vector vector vector :behavior target)) ;; 1st and 2nd vectors may be symbols instead? (define-extern target-falling-anim (function int int symbol :behavior target)) (define-extern target-falling-trans (function basic cpad-list none :behavior target)) ;; todo - power of 2 array access issue (fixed in another PR?) -(define-extern target-falling-anim-trans function) +(define-extern target-falling-anim-trans (function none :behavior target)) ;; unconfirmed ;; - Unknowns (define-extern target-hit-ground (state symbol target)) ;; unknown type (define-extern target-stance (state target)) ;; unknown type -(define-extern target-high-jump (state float float symbol target)) ;; unknown type +(define-extern target-high-jump (state float float basic target)) ;; TODO - basic is a symbol...but decompiler changes the type (define-extern target-attack-air (state symbol target)) ;; unknown type (define-extern target-wheel-flip (state float float target)) ;; unknown type (define-extern target-duck-stance (state target)) ;; unknown type -(define-extern target-hit-ground-hard (state target)) ;; unknown type +(define-extern target-hit-ground-hard (state float target)) ;; unknown type (define-extern target-flop-hit-ground (state symbol target)) ;; unknown type (define-extern target-yellow-jump-blast (state target)) ;; unknown type (define-extern target-swim-down (state target)) ;; unknown type @@ -19958,7 +19993,7 @@ (define-extern target-walk (state target)) ;; unknown type (define-extern target-running-attack (state target)) ;; unknown type (define-extern target-duck-high-jump-jump (state float float symbol target)) ;; unknown type -(define-extern target-launch (state target)) ;; unknown type +(define-extern target-launch (state float symbol vector int target)) ;; unknown type (define-extern target-duck-high-jump (state float float symbol target)) ;; unknown type (define-extern target-double-jump (state float float target)) ;; unknown type (define-extern target-duck-walk (state target)) ;; unknown type @@ -19978,46 +20013,55 @@ ;; - Types -; (deftype first-person-hud (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; unrecognized get op: (set! v1 process) parent was UNKNOWN -; ) +(deftype first-person-hud (process) + ( + (max-nb-of-particles int32 :offset-assert 112) + (nb-of-particles int32 :offset-assert 116) + (particles hud-particle 3 :offset-assert 120) + (in-out-position int32 :offset-assert 132) + (sides-x-scale float :offset-assert 136) + (sides-y-scale float :offset-assert 140) + (x-offset int32 :offset-assert 144) + ) + :method-count-assert 15 + :heap-base #x30 + :size-assert #x94 + :flag-assert #xf00300094 + (:methods + (dumb-15 (_type_) none)) + ) ;; - Functions -(define-extern target-swim-tilt function) +(define-extern target-swim-tilt (function float float float float float :behavior target)) (define-extern projectile-init-by-other (function entity vector vector uint handle none :behavior projectile)) ;; 4th arg is `options`, 5th is `last-target` -(define-extern first-person-hud-init-by-other function) +(define-extern first-person-hud-init-by-other (function none :behavior first-person-hud)) (define-extern disable-hud (function int none)) (define-extern enable-hud (function none)) -(define-extern part-first-person-hud-left-func function) -(define-extern part-first-person-hud-right-func function) -(define-extern part-first-person-hud-selector-func function) -(define-extern look-for-points-of-interest function) +(define-extern part-first-person-hud-left-func (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern part-first-person-hud-right-func (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern part-first-person-hud-selector-func (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern look-for-points-of-interest (function symbol)) ;; - Unknowns -(define-extern target-death (state target)) ;; unknown type -;;(define-extern target-swim-jump-jump object) ;; unknown type -;;(define-extern target-swim-up object) ;; unknown type -;;(define-extern target-swim-jump object) ;; unknown type -;;(define-extern target-swim-walk object) ;; unknown type -;;(define-extern *yellow-jump-mods* object) ;; unknown type -;;(define-extern target-edge-grab-jump object) ;; unknown type -;;(define-extern target-edge-grab-off object) ;; unknown type -;;(define-extern target-pole-flip-up-jump object) ;; unknown type -;;(define-extern target-pole-flip-forward-jump object) ;; unknown type -;;(define-extern target-pole-flip-up object) ;; unknown type -;;(define-extern target-pole-flip-forward object) ;; unknown type -;;(define-extern *fp-hud-stack* object) ;; unknown type -;;(define-extern target-stance-look-around object) ;; unknown type -;;(define-extern hud-normal object) ;; unknown type -;;(define-extern hud-coming-in object) ;; unknown type -;;(define-extern hud-going-out object) ;; unknown type -;;(define-extern hud-waiting object) ;; unknown type +(define-extern target-swim-jump-jump (state float float surface target)) ;; unknown type +(define-extern target-swim-up (state target)) ;; unknown type +(define-extern target-swim-jump (state float float target)) ;; unknown type +(define-extern target-swim-walk (state target)) ;; unknown type +(define-extern *yellow-jump-mods* surface) ;; unknown type +(define-extern target-edge-grab-jump (state float float target)) ;; unknown type +(define-extern target-edge-grab-off (state target)) ;; unknown type +(define-extern target-pole-flip-up-jump (state float float target)) ;; unknown type +(define-extern target-pole-flip-forward-jump (state float float target)) ;; unknown type +(define-extern target-pole-flip-up (state object object float target)) ;; unknown type +(define-extern target-pole-flip-forward (state float float float target)) ;; unknown type +(define-extern *fp-hud-stack* pointer) ;; first-person-hud maybe? +(define-extern target-stance-look-around (state target)) ;; unknown type +(define-extern hud-normal (state first-person-hud)) ;; unknown type +(define-extern hud-coming-in (state first-person-hud)) ;; unknown type +(define-extern hud-going-out (state first-person-hud)) ;; unknown type +(define-extern hud-waiting (state first-person-hud)) ;; unknown type ;; ---------------------- @@ -20028,29 +20072,29 @@ ;; - Functions -(define-extern target-death-anim function) -(define-extern death-movie-remap function) +(define-extern target-death-anim (function spool-anim none :behavior target)) +(define-extern death-movie-remap (function int int int)) (define-extern pov-camera-init-by-other (function vector skeleton-group string int process-drawable pair none :behavior pov-camera)) ;; TODO - not confirmed -- sunken-elevator -(define-extern target-hit-effect function) -(define-extern target-hit-setup-anim function) -(define-extern target-hit-move function) -(define-extern target-hit-orient function) -(define-extern target-hit-push function) -(define-extern velocity-set-to-target! function) -(define-extern start-sequence-a function) +(define-extern target-hit-effect (function attack-info none :behavior target)) +(define-extern target-hit-setup-anim (function attack-info object :behavior target)) +(define-extern target-hit-move (function attack-info symbol (function none :behavior target) float none :behavior target)) +(define-extern target-hit-orient (function attack-info vector symbol :behavior target)) +(define-extern target-hit-push (function vector matrix float float attack-info object :behavior target)) +(define-extern velocity-set-to-target! (function vector float attack-info vector :behavior target)) +(define-extern start-sequence-a (function none)) ;; not confirmed (define-extern task-closed? (function game-task task-status symbol)) -(define-extern next-level function) +(define-extern next-level (function symbol level-load-info)) ;; - Unknowns -;;(define-extern *death-spool-array* object) ;; unknown type +(define-extern *death-spool-array* (array spool-anim)) ;; unknown type (define-extern *deathcam-sg* skeleton-group) -;;(define-extern *smack-mods* object) ;; unknown type -;;(define-extern *smack-up-mods* object) ;; unknown type +(define-extern *smack-mods* surface) ;; unknown type +(define-extern *smack-up-mods* surface) ;; unknown type (define-extern target-title (state target)) ;; unknown type (define-extern target-demo (state target)) ;; unknown type (define-extern target-warp-in (state target)) ;; unknown type -;;(define-extern *auto-continue* object) ;; unknown type +(define-extern *auto-continue* symbol) ;; unknown type ;; ---------------------- @@ -20682,15 +20726,15 @@ ;; - Functions -(define-extern splash-spawn function) -(define-extern part-water-splash-callback function) +(define-extern splash-spawn (function basic basic int none)) +(define-extern part-water-splash-callback (function part-tracker none)) (define-extern ocean-get-height (function vector float)) -(define-extern birth-func-y->userdata function) -(define-extern birth-func-ocean-height function) -(define-extern check-water-level-drop function) -(define-extern check-water-level-drop-and-die function) -(define-extern check-water-level-above-and-die function) -(define-extern water-vol-init-by-other function) +(define-extern birth-func-y->userdata (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern birth-func-ocean-height (function sparticle-system sparticle-cpuinfo matrix none)) +(define-extern check-water-level-drop (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-water-level-drop-and-die (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-water-level-above-and-die (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern water-vol-init-by-other (function entity none :behavior water-vol)) ;; ---------------------- @@ -26613,9 +26657,9 @@ :flag-assert #xd00000028 (:methods (dummy-9 (_type_ vector) none 9) - (dummy-10 (_type_ vector vector) symbol 10) + (TODO-RENAME-10 (_type_ collide-prim-core vector) symbol 10) (dummy-11 (_type_ vector) symbol 11) - (dummy-12 (_type_ vector) none 12) + (dummy-12 (_type_ vector) vector 12) ) ) @@ -26628,7 +26672,8 @@ ) (deftype arcing-shot (process-drawable) - ((y-vel float :offset-assert 176) + ((root-override collide-shape-moving :score 100 :offset 112) + (y-vel float :offset-assert 176) (grav float :offset-assert 180) (from vector :inline :offset-assert 192) (to vector :inline :offset-assert 208) @@ -26663,11 +26708,11 @@ (deftype redshot (arcing-shot) ((flight-time int64 :offset-assert 224) (stall-time int64 :offset-assert 232) - (ring torus :inline :offset-assert 240) + (ring torus :inline :offset-assert 240) (rotation-offset int64 :offset-assert 280) - (part-track handle :offset-assert 288) - (shot-particle sparticle-launch-control :offset-assert 296) - (test-particle sparticle-launch-control :offset-assert 300) + (part-track handle :offset-assert 288) + (shot-particle sparticle-launch-control :offset-assert 296) + (test-particle sparticle-launch-control :offset-assert 300) ) :method-count-assert 20 :size-assert #x130 @@ -26686,17 +26731,17 @@ ;; - Functions -(define-extern arcing-shot-setup (function vector vector float none :behavior arcing-shot)) -(define-extern arcing-shot-calculate (function vector float none :behavior arcing-shot)) +(define-extern arcing-shot-setup (function vector vector float float :behavior arcing-shot)) +(define-extern arcing-shot-calculate (function vector float float :behavior arcing-shot)) (define-extern redshot-trans (function int object :behavior redshot)) (define-extern redshot-particle-callback (function part-tracker none)) (define-extern darkecobomb-explode-if-player-high-enough (function none :behavior darkecobomb)) (define-extern arcing-shot-draw (function symbol :behavior arcing-shot)) (define-extern darkecobomb-handler (function process int symbol event-message-block object :behavior darkecobomb)) (define-extern darkecobomb-init-by-other (function vector vector float int float none :behavior darkecobomb)) -(define-extern greenshot-init-by-other (function vector vector float uint none :behavior greenshot)) +(define-extern greenshot-init-by-other (function vector vector float uint float none :behavior greenshot)) (define-extern redshot-handler (function process int symbol event-message-block object :behavior redshot)) -(define-extern redshot-init-by-other (function vector vector float int int int none :behavior redshot)) +(define-extern redshot-init-by-other (function vector vector float uint uint uint none :behavior redshot)) (define-extern yellowshot-init-by-other (function vector vector float uint none :behavior yellowshot)) ;; - Unknowns @@ -28981,7 +29026,7 @@ ;; - Functions (define-extern blocking-plane-spawn (function curve-control none)) -(define-extern racer-effect function) +(define-extern racer-effect (function none :behavior racer)) (define-extern blocking-plane-destroy (function none)) ;; - Unknowns @@ -28999,19 +29044,19 @@ ;; - Functions -(define-extern racer-collision-reaction function) -(define-extern racer-service-slide function) -(define-extern racer-xz function) -(define-extern racer-thrust function) +(define-extern racer-collision-reaction (function control-info collide-shape-intersect vector vector none)) +(define-extern racer-service-slide (function none :behavior target)) +(define-extern racer-xz (function float float none :behavior target)) +(define-extern racer-thrust (function basic float none :behavior target)) (define-extern racer-calc-gravity (function vector :behavior target)) -(define-extern racer-on-ground? function) -(define-extern racer-collision function) -(define-extern racer-integrate function) -(define-extern racer-effects function) +(define-extern racer-on-ground? (function symbol :behavior racer)) +(define-extern racer-collision (function none :behavior target)) +(define-extern racer-integrate (function none :behavior target)) +(define-extern racer-effects (function none :behavior target)) (define-extern racer-sounds (function object :behavior target)) -(define-extern racer-bend-gravity function) -(define-extern racer-find-prop-point function) -(define-extern racer-cushion function) +(define-extern racer-bend-gravity (function none :behavior target)) +(define-extern racer-find-prop-point (function vector vector vector :behavior target)) +(define-extern racer-cushion (function float none :behavior target)) (define-extern racer-buzz (function float none :behavior target)) (define-extern target-racing-center-anim (function none :behavior target)) (define-extern target-racing-turn-anim (function none :behavior target)) @@ -29140,7 +29185,8 @@ ;; - Types (deftype flutflut (process-drawable) - ((root-override collide-shape-moving :score 100 :offset 112) + ((parent-override (pointer target) :score 100 :offset 12) + (root-override collide-shape-moving :score 100 :offset 112) (extra-trans vector :inline :offset-assert 176) (condition int32 :offset-assert 192) (auto-get-off symbol :offset-assert 196) @@ -29182,56 +29228,65 @@ ;; - Types -; (deftype flut-info (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype flut-info (basic) + ((entity basic :offset-assert 4) + (flut-trans vector :inline :offset-assert 16) + (flut-quat vector :inline :offset-assert 32) + (flut-scale vector :inline :offset-assert 48) + (stick-lock basic :offset-assert 64) + (flap-sound-id sound-id :offset-assert 68) + ) + :method-count-assert 9 + :size-assert #x48 + :flag-assert #x900000048 + ) -; (deftype flut-bank (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype flut-bank (basic) + ((jump-height-min meters :offset-assert 4) + (jump-height-max meters :offset-assert 8) + (double-jump-height-min meters :offset-assert 12) + (double-jump-height-max meters :offset-assert 16) + (air-attack-speed meters :offset-assert 20) + (ground-timeout int64 :offset-assert 24)) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) ;; - Functions -(define-extern target-flut-post-post function) -(define-extern target-flut-falling-anim-trans function) -(define-extern target-flut-dangerous-event-handler function) -(define-extern target-flut-hit-ground-anim function) -(define-extern target-flut-standard-event-handler function) -(define-extern target-flut-post function) +(define-extern target-flut-post-post (function none :behavior target)) +(define-extern target-flut-falling-anim-trans (function none :behavior target)) +(define-extern target-flut-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-flut-hit-ground-anim (function symbol :behavior target)) +(define-extern target-flut-standard-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-flut-post (function none :behavior target)) ;; - Unknowns -;;(define-extern target-flut-stance object) ;; unknown type -;;(define-extern target-flut-grab object) ;; unknown type -;;(define-extern target-flut-clone-anim object) ;; unknown type -;;(define-extern target-flut-get-off-hit-ground object) ;; unknown type -;;(define-extern target-flut-get-off-jump object) ;; unknown type -;;(define-extern target-flut-death object) ;; unknown type -;;(define-extern target-flut-hit-ground object) ;; unknown type -;;(define-extern *flut-air-attack-mods* object) ;; unknown type -;;(define-extern target-flut-air-attack-hit-ground object) ;; unknown type -;;(define-extern target-flut-jump object) ;; unknown type -;;(define-extern *FLUT-bank* object) ;; unknown type -;;(define-extern target-flut-falling object) ;; unknown type -;;(define-extern *flut-run-attack-mods* object) ;; unknown type -;;(define-extern target-flut-hit object) ;; unknown type -;;(define-extern *flut-jump-mods* object) ;; unknown type -;;(define-extern target-flut-walk object) ;; unknown type -;;(define-extern *flut-walk-mods* object) ;; unknown type -;;(define-extern target-flut-air-attack object) ;; unknown type -;;(define-extern *flut-double-jump-mods* object) ;; unknown type -;;(define-extern target-flut-double-jump object) ;; unknown type -;;(define-extern target-flut-running-attack object) ;; unknown type -;;(define-extern target-flut-get-on object) ;; unknown type -;;(define-extern target-flut-get-off object) ;; unknown type +(define-extern target-flut-stance (state target)) ;; unknown type +(define-extern target-flut-grab (state target)) ;; unknown type +(define-extern target-flut-clone-anim (state handle target)) ;; unknown type +(define-extern target-flut-get-off-hit-ground (state target)) ;; unknown type +(define-extern target-flut-get-off-jump (state handle target)) ;; unknown type +(define-extern target-flut-death (state symbol target)) ;; unknown type +(define-extern target-flut-hit-ground (state target)) ;; unknown type +(define-extern *flut-air-attack-mods* surface) ;; unknown type +(define-extern target-flut-air-attack-hit-ground (state target)) ;; unknown type +(define-extern target-flut-jump (state float float target)) ;; unknown type +(define-extern *FLUT-bank* flut-bank) ;; unknown type +(define-extern target-flut-falling (state target)) ;; unknown type +(define-extern *flut-run-attack-mods* surface) ;; unknown type +(define-extern target-flut-hit (state target)) ;; unknown type +(define-extern *flut-jump-mods* surface) ;; unknown type +(define-extern target-flut-walk (state target)) ;; unknown type +(define-extern *flut-walk-mods* surface) ;; unknown type +(define-extern target-flut-air-attack (state float target)) ;; unknown type +(define-extern *flut-double-jump-mods* surface) ;; unknown type +(define-extern target-flut-double-jump (state float float target)) ;; unknown type +(define-extern target-flut-running-attack (state target)) ;; unknown type +(define-extern target-flut-get-on (state handle target)) ;; unknown type +(define-extern target-flut-get-off (state handle target)) ;; unknown type ;; ---------------------- @@ -32339,23 +32394,23 @@ ;; - Unknowns (define-extern *mother-spider-sg* skeleton-group) -;;(define-extern mother-spider-die-wait-for-children object) ;; unknown type -;;(define-extern mother-spider-idle object) ;; unknown type -;;(define-extern *mother-spider-threads* object) ;; unknown type -;;(define-extern *mother-spider-leg-infos* object) ;; unknown type -;;(define-extern mother-spider-hit-while-birthing object) ;; unknown type -;;(define-extern mother-spider-birthing object) ;; unknown type -;;(define-extern mother-spider-traveling object) ;; unknown type -;;(define-extern mother-spider-birth-baby object) ;; unknown type -;;(define-extern mother-spider-tracking object) ;; unknown type -;;(define-extern mother-spider-hit-while-tracking object) ;; unknown type -;;(define-extern mother-spider-spit object) ;; unknown type -;;(define-extern mother-spider-stop-traveling object) ;; unknown type -;;(define-extern mother-spider-die-from-uppercut object) ;; unknown type -;;(define-extern mother-spider-die object) ;; unknown type +(define-extern mother-spider-die-wait-for-children (state mother-spider)) ;; unknown type +(define-extern mother-spider-idle (state mother-spider)) ;; unknown type +(define-extern *mother-spider-threads* (inline-array mother-spider-thread)) ;; unknown type +(define-extern *mother-spider-leg-infos* (inline-array mother-spider-leg-info)) ;; unknown type +(define-extern mother-spider-hit-while-birthing (state mother-spider)) ;; unknown type +(define-extern mother-spider-birthing (state mother-spider)) ;; unknown type +(define-extern mother-spider-traveling (state mother-spider)) ;; unknown type +(define-extern mother-spider-birth-baby (state mother-spider)) ;; unknown type +(define-extern mother-spider-tracking (state mother-spider)) ;; unknown type +(define-extern mother-spider-hit-while-tracking (state mother-spider)) ;; unknown type +(define-extern mother-spider-spit (state mother-spider)) ;; unknown type +(define-extern mother-spider-stop-traveling (state mother-spider)) ;; unknown type +(define-extern mother-spider-die-from-uppercut (state mother-spider)) ;; unknown type +(define-extern mother-spider-die (state mother-spider)) ;; unknown type (define-extern *mother-spider-leg-sg* skeleton-group) -;;(define-extern mother-spider-leg-flying object) ;; unknown type -;;(define-extern wait-for-children object) ;; unknown type +(define-extern mother-spider-leg-flying (state mother-spider-leg)) ;; unknown type +(define-extern wait-for-children (state mother-spider)) ;; unknown type ;; ---------------------- @@ -33417,63 +33472,37 @@ ;; - Types -; (deftype bully-broken-cage (process-drawable) -; () -; :method-count-assert 20 -; :size-assert #xb0 -; :heap-base #x40 -; :flag-assert #x14004000b0 -; ;; not enough basic ops -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; ) -; ) +(deftype bully-broken-cage (process-drawable) + () + :method-count-assert 20 + :size-assert #xb0 + :heap-base #x40 + :flag-assert #x14004000b0 + ) -; (deftype bully (process-drawable) -; ((hit-player? basic :offset-assert 176) -; (bounced? basic :offset-assert 180) -; (bounce-volume int32 :offset-assert 184) -; (facing-ry float :offset-assert 188) -; (travel-ry float :offset-assert 192) -; (speed-u float :offset-assert 196) -; (spin-vel float :offset-assert 200) -; (travel-speed float :offset-assert 204) -; (reaction-delay uint64 :offset-assert 208) -; (start-spin-time uint64 :offset-assert 216) -; (slow-down uint64 :offset-assert 224) -; (hit-player-time uint64 :offset-assert 232) -; (neck basic :offset-assert 240) -; ) -; :method-count-assert 21 -; :size-assert #xf4 -; :heap-base #x90 -; :flag-assert #x15009000f4 -; ;; inherited inspect of process-drawable -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; (dummy-20 () none 20) -; ) -; ) +(deftype bully (process-drawable) + ((hit-player? symbol :offset-assert 176) + (bounced? symbol :offset-assert 180) + (bounce-volume int32 :offset-assert 184) + (facing-ry float :offset-assert 188) + (travel-ry float :offset-assert 192) + (speed-u float :offset-assert 196) + (spin-vel float :offset-assert 200) + (travel-speed float :offset-assert 204) + (reaction-delay uint64 :offset-assert 208) + (start-spin-time uint64 :offset-assert 216) + (slow-down uint64 :offset-assert 224) + (hit-player-time uint64 :offset-assert 232) + (neck basic :offset-assert 240) + ) + :method-count-assert 21 + :size-assert #xf4 + :heap-base #x90 + :flag-assert #x15009000f4 + (:methods + (dummy-20 () none 20) + ) + ) ;; - Functions @@ -33484,14 +33513,14 @@ ;; - Unknowns (define-extern *bully-sg* skeleton-group) -;;(define-extern *bully-shadow-control* object) ;; unknown type -;;(define-extern bully-idle object) ;; unknown type -;;(define-extern bully-start-spinning object) ;; unknown type -;;(define-extern bully-stop-spinning object) ;; unknown type -;;(define-extern bully-notice object) ;; unknown type -;;(define-extern bully-die object) ;; unknown type +(define-extern *bully-shadow-control* shadow-control) ;; unknown type +(define-extern bully-idle (state bully)) ;; unknown type +(define-extern bully-start-spinning (state bully)) ;; unknown type +(define-extern bully-stop-spinning (state bully)) ;; unknown type +(define-extern bully-notice (state bully)) ;; unknown type +(define-extern bully-die (state bully)) ;; unknown type (define-extern *bully-broken-cage-sg* skeleton-group) -;;(define-extern bully-broken-cage-explode object) ;; unknown type +(define-extern bully-broken-cage-explode (state bully-broken-cage)) ;; unknown type ;; ---------------------- @@ -34010,140 +34039,56 @@ ;; inherited inspect of nav-enemy ) -; (deftype lightning-mole (fleeing-nav-enemy) -; ((debug-vector vector :inline :offset-assert 528) -; (alt-actor basic :offset-assert 544) -; ) -; :method-count-assert 76 -; :size-assert #x224 -; :heap-base #x1c0 -; :flag-assert #x4c01c00224 -; ;; inherited inspect of fleeing-nav-enemy -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; (dummy-20 () none 20) -; (dummy-21 () none 21) -; (dummy-22 () none 22) -; (dummy-23 () none 23) -; (dummy-24 () none 24) -; (dummy-25 () none 25) -; (dummy-26 () none 26) -; (dummy-27 () none 27) -; (dummy-28 () none 28) -; (dummy-29 () none 29) -; (dummy-30 () none 30) -; (dummy-31 () none 31) -; (dummy-32 () none 32) -; (dummy-33 () none 33) -; (dummy-34 () none 34) -; (dummy-35 () none 35) -; (dummy-36 () none 36) -; (dummy-37 () none 37) -; (dummy-38 () none 38) -; (dummy-39 () none 39) -; (dummy-40 () none 40) -; (dummy-41 () none 41) -; (dummy-42 () none 42) -; (dummy-43 () none 43) -; (dummy-44 () none 44) -; (dummy-45 () none 45) -; (dummy-46 () none 46) -; (dummy-47 () none 47) -; (dummy-48 () none 48) -; (dummy-49 () none 49) -; (dummy-50 () none 50) -; (dummy-51 () none 51) -; (dummy-52 () none 52) -; (dummy-53 () none 53) -; (dummy-54 () none 54) -; (dummy-55 () none 55) -; (dummy-56 () none 56) -; (dummy-57 () none 57) -; (dummy-58 () none 58) -; (dummy-59 () none 59) -; (dummy-60 () none 60) -; (dummy-61 () none 61) -; (dummy-62 () none 62) -; (dummy-63 () none 63) -; (dummy-64 () none 64) -; (dummy-65 () none 65) -; (dummy-66 () none 66) -; (dummy-67 () none 67) -; (dummy-68 () none 68) -; (dummy-69 () none 69) -; (dummy-70 () none 70) -; (dummy-71 () none 71) -; (dummy-72 () none 72) -; (dummy-73 () none 73) -; (dummy-74 () none 74) -; (dummy-75 () none 75) -; ) -; ) +(deftype lightning-mole (fleeing-nav-enemy) + ((debug-vector vector :inline :offset-assert 528) + (alt-actor entity-actor :offset-assert 544) + ) + :method-count-assert 76 + :size-assert #x224 + :heap-base #x1c0 + :flag-assert #x4c01c00224 + ) -; (deftype peeper (process-drawable) -; () -; :method-count-assert 20 -; :size-assert #xb0 -; :heap-base #x40 -; :flag-assert #x14004000b0 -; ;; not enough basic ops -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; ) -; ) +(deftype peeper (process-drawable) + () + :method-count-assert 20 + :size-assert #xb0 + :heap-base #x40 + :flag-assert #x14004000b0 + ) ;; - Functions -(define-extern lightning-mole-task-complete? function) -(define-extern fleeing-nav-enemy-clip-travel function) -(define-extern fleeing-nav-enemy-adjust-travel function) -(define-extern fleeing-nav-enemy-chase-post-func function) -(define-extern fleeing-nav-enemy-adjust-nav-info function) +(define-extern lightning-mole-task-complete? (function symbol :behavior lightning-mole)) +(define-extern fleeing-nav-enemy-clip-travel (function fleeing-nav-enemy vector symbol)) +(define-extern fleeing-nav-enemy-adjust-travel (function fleeing-nav-enemy vector)) +(define-extern fleeing-nav-enemy-chase-post-func (function float :behavior fleeing-nav-enemy)) +(define-extern fleeing-nav-enemy-adjust-nav-info (function float :behavior fleeing-nav-enemy)) (define-extern find-adjacent-bounds-one function) -(define-extern find-adjacent-bounds function) -(define-extern fleeing-nav-enemy-chase-post function) -(define-extern lightning-mole-hole-post function) -(define-extern lightning-mole-run-code function) -(define-extern check-drop-level-rolling-dirt function) -(define-extern check-drop-level-rolling-dirt-finish function) +(define-extern find-adjacent-bounds (function basic clip-travel-vector-to-mesh-return-info none)) +(define-extern fleeing-nav-enemy-chase-post (function none :behavior fleeing-nav-enemy)) +(define-extern lightning-mole-hole-post (function none :behavior lightning-mole)) +(define-extern lightning-mole-run-code (function none :behavior lightning-mole)) +(define-extern check-drop-level-rolling-dirt (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-drop-level-rolling-dirt-finish (function sparticle-system sparticle-cpuinfo vector none)) ;; - Unknowns (define-extern *lightning-mole-sg* skeleton-group) -;;(define-extern peeper-up object) ;; unknown type -;;(define-extern peeper-down object) ;; unknown type -;;(define-extern peeper-hide object) ;; unknown type -;;(define-extern peeper-wait object) ;; unknown type +(define-extern peeper-up (state peeper)) ;; unknown type +(define-extern peeper-down (state peeper)) ;; unknown type +(define-extern peeper-hide (state peeper)) ;; unknown type +(define-extern peeper-wait (state peeper)) ;; unknown type (define-extern *lightning-mole-nav-enemy-info* nav-enemy-info) -;;(define-extern lightning-mole-gone object) ;; unknown type -;;(define-extern lightning-mole-hiding object) ;; unknown type -;;(define-extern lightning-mole-yelp object) ;; unknown type -;;(define-extern *lightning-mole-hole* object) ;; unknown type -;;(define-extern lightning-mole-head-for-hole object) ;; unknown type -;;(define-extern lightning-mole-dive object) ;; unknown type -;;(define-extern lightning-mole-debug-run object) ;; unknown type -;;(define-extern fleeing-nav-enemy-debug object) ;; unknown type -;;(define-extern lightning-mole-debug-blend object) ;; unknown type +(define-extern lightning-mole-gone (state lightning-mole)) ;; unknown type +(define-extern lightning-mole-hiding (state lightning-mole)) ;; unknown type +(define-extern lightning-mole-yelp (state lightning-mole)) ;; unknown type +(define-extern *lightning-mole-hole* vector) ;; unknown type +(define-extern lightning-mole-head-for-hole (state lightning-mole)) ;; unknown type +(define-extern lightning-mole-dive (state lightning-mole)) ;; unknown type +(define-extern lightning-mole-debug-run (state lightning-mole)) ;; unknown type +(define-extern fleeing-nav-enemy-debug (state fleeing-nav-enemy)) ;; unknown type +(define-extern lightning-mole-debug-blend (state lightning-mole)) ;; unknown type ;; ---------------------- @@ -34154,66 +34099,53 @@ ;; - Types -; (deftype robber (process-drawable) -; ((curve-position float :offset-assert 176) -; (speed float :offset-assert 180) -; (facing vector :inline :offset-assert 192) -; (tangent vector :inline :offset-assert 208) -; (run-blend-interp float :offset-assert 224) -; (near-timer int32 :offset-assert 228) -; (far-time uint64 :offset-assert 232) -; (y-offset float :offset-assert 240) -; (y-offset-desired float :offset-assert 244) -; (y-vel float :offset-assert 248) -; (water-height float :offset-assert 252) -; (timeout uint64 :offset-assert 256) -; (last-ambient-time uint64 :offset-assert 264) -; (time-to-next-ambient uint64 :offset-assert 272) -; ) -; :method-count-assert 20 -; :size-assert #x118 -; :heap-base #xb0 -; :flag-assert #x1400b00118 -; ;; inherited inspect of process-drawable -; (:methods -; (dummy-9 () none 9) -; (dummy-10 () none 10) -; (dummy-11 () none 11) -; (dummy-12 () none 12) -; (dummy-13 () none 13) -; (dummy-14 () none 14) -; (dummy-15 () none 15) -; (dummy-16 () none 16) -; (dummy-17 () none 17) -; (dummy-18 () none 18) -; (dummy-19 () none 19) -; ) -; ) +(deftype robber (process-drawable) + ((root-override collide-shape-moving :score 100 :offset 112) + (curve-position float :offset-assert 176) + (speed float :offset-assert 180) + (facing vector :inline :offset-assert 192) + (tangent vector :inline :offset-assert 208) + (run-blend-interp float :offset-assert 224) + (near-timer int32 :offset-assert 228) + (far-time uint64 :offset-assert 232) + (y-offset float :offset-assert 240) + (y-offset-desired float :offset-assert 244) + (y-vel float :offset-assert 248) + (water-height float :offset-assert 252) + (timeout uint64 :offset-assert 256) + (last-ambient-time uint64 :offset-assert 264) + (time-to-next-ambient uint64 :offset-assert 272) + ) + :method-count-assert 20 + :size-assert #x118 + :heap-base #xb0 + :flag-assert #x1400b00118 + ) ;; - Functions -(define-extern robber-find-ground function) -(define-extern robber-move function) -(define-extern robber-calc-speed function) -(define-extern robber-rotate function) -(define-extern robber-calc-anim-speed function) -(define-extern robber-task-complete? function) -(define-extern fuel-cell-init-as-spline-slider function) -(define-extern robber-event-handler function) +(define-extern robber-find-ground (function symbol :behavior robber)) +(define-extern robber-move (function float :behavior robber)) +(define-extern robber-calc-speed (function float float vector vector symbol float :behavior robber)) +(define-extern robber-rotate (function target float vector :behavior robber)) +(define-extern robber-calc-anim-speed (function float :behavior robber)) +(define-extern robber-task-complete? (function symbol :behavior robber)) +(define-extern fuel-cell-init-as-spline-slider (function handle float float int none :behavior fuel-cell)) +(define-extern robber-event-handler (function process int symbol event-message-block object :behavior robber)) ;; - Unknowns (define-extern *robber-sg* skeleton-group) -;;(define-extern robber-die object) ;; unknown type -;;(define-extern robber-dead object) ;; unknown type -;;(define-extern robber-initial object) ;; unknown type -;;(define-extern robber-initial-notice object) ;; unknown type -;;(define-extern robber-flee object) ;; unknown type -;;(define-extern robber-got-away object) ;; unknown type -;;(define-extern robber-tired object) ;; unknown type -;;(define-extern robber-idle object) ;; unknown type -;;(define-extern fuel-cell-spline-slider object) ;; unknown type -;;(define-extern robber-debug object) ;; unknown type +(define-extern robber-die (state robber)) ;; unknown type +(define-extern robber-dead (state robber)) ;; unknown type +(define-extern robber-initial (state robber)) ;; unknown type +(define-extern robber-initial-notice (state robber)) ;; unknown type +(define-extern robber-flee (state robber)) ;; unknown type +(define-extern robber-got-away (state robber)) ;; unknown type +(define-extern robber-tired (state robber)) ;; unknown type +(define-extern robber-idle (state robber)) ;; unknown type +(define-extern fuel-cell-spline-slider (state handle float float fuel-cell)) ;; unknown type +(define-extern robber-debug (state robber)) ;; unknown type ;; ---------------------- @@ -34330,45 +34262,103 @@ ;; - Types -; (deftype ogreboss-super-boulder (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; unrecognized get op: (set! v1 process-drawable) parent was UNKNOWN -; ) +(deftype ogreboss-super-boulder (process-drawable) + ((root-override basic :score 100 :offset 112) + (orig-pos vector :inline :offset-assert 176) + (src-pos vector :inline :offset-assert 192) + (spin-axis vector :inline :offset-assert 208) + (joint basic :offset-assert 224) + (speed float :offset-assert 228) + (size float :offset-assert 232) + (grow-rate float :offset-assert 236) + (lava basic :offset-assert 240) + (sound-id sound-id :offset-assert 244) + (hit-boss basic :offset-assert 248) + (tumble-quat quaternion :inline :offset-assert 256) + ) + :method-count-assert 20 + :heap-base #xa0 + :size-assert #x110 + :flag-assert #x1400a00110 + ) -; (deftype ogreboss-bounce-boulder (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; unrecognized get op: (set! v1 process-drawable) parent was UNKNOWN -; ) +(deftype ogreboss-bounce-boulder (process-drawable) + ((root-override basic :score 100 :offset 112) + (src-pos vector :inline :offset-assert 176) + (side-dir vector :inline :offset-assert 192) + (side-pos float :offset-assert 208) + (dest-pos float :offset-assert 212) + (boulder-type int8 :offset-assert 216) + ) + :method-count-assert 20 + :heap-base #x70 + :size-assert #xd9 + :flag-assert #x14007000d9 + ) -; (deftype ogreboss-missile (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; unrecognized get op: (set! v1 process-drawable) parent was UNKNOWN -; ) +(deftype ogreboss-missile (process-drawable) + ((root-override basic :score 100 :offset 112) + (trajectory trajectory :inline :offset-assert 176) + (src-pos vector :inline :offset-assert 224) + (dest-pos vector :inline :offset-assert 240) + (start-time int64 :offset-assert 256) + (tumble-quat quaternion :inline :offset-assert 272) + (blast-radius float :offset-assert 288) + (pickup-type pickup-type :offset-assert 292) + ) + :method-count-assert 20 + :heap-base #xc0 + :size-assert #x128 + :flag-assert #x1400c00128 + ) -; (deftype ogreboss-missile-init-data (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; bad get label -; ) +(deftype ogreboss-missile-init-data (structure) + ((src vector :offset-assert 0) + (dest vector :offset-assert 4) + (duration int64 :offset-assert 8) + (xz-speed float :offset-assert 16) + (blast-radius float :offset-assert 20) + (pickup-type pickup-type :offset-assert 24) + ) + :method-count-assert 9 + :size-assert #x1c + :flag-assert #x90000001c + ) -; (deftype ogreboss (UNKNOWN) -; () -; :method-count-assert 0 -; :size-assert #x0 -; :flag-assert #x0 -; ;; unrecognized get op: (set! v1 process-drawable) parent was UNKNOWN -; ) +(deftype ogreboss (process-drawable) + ((root-override basic :score 100 :offset 112) + (old-player-transform transformq :inline :offset-assert 176) + (level float :offset-assert 224) + (difficulty float :offset-assert 228) + (boulder int64 :offset-assert 232) + (column int64 :offset-assert 240) + (z-plane vector :inline :offset-assert 256) + (far-pos vector :inline :offset-assert 272) + (near-pos vector :inline :offset-assert 288) + (side-dir vector :inline :offset-assert 304) + (target-offset-array vector 3 :inline :offset-assert 320) ;; maybe not vectors + (target-actor-array basic 3 :offset-assert 368) + (target-blast-radius-array basic 3 :offset-assert 380) + (shuffle-pos float :offset-assert 392) + (target-count int8 :offset-assert 396) + (hit-count int8 :offset-assert 397) + (max-hit-count int8 :offset-assert 398) + (roll-boulder int8 :offset-assert 399) + (try-count uint8 :offset-assert 400) + (hit-time int64 :offset-assert 408) + (grow-time float :offset-assert 416) + (lava basic :offset-assert 420) + (vulnerable basic :offset-assert 424) + (bridge-assembled basic :offset-assert 428) + (at-near-spot basic :offset-assert 432) + (submerged basic :offset-assert 436) + (try-counted basic :offset-assert 440) + ) + :method-count-assert 20 + :heap-base #x150 + :size-assert #x1bc + :flag-assert #x14015001bc + ) ;; - Functions @@ -34407,36 +34397,36 @@ ;; - Unknowns (define-extern *ogreboss-sg* skeleton-group) -;;(define-extern *ogreboss* object) ;; unknown type -;;(define-extern ogreboss-dead object) ;; unknown type -;;(define-extern ogreboss-idle object) ;; unknown type -;;(define-extern ogreboss-die object) ;; unknown type -;;(define-extern ogreboss-stage1 object) ;; unknown type -;;(define-extern ogreboss-stage3-throw object) ;; unknown type -;;(define-extern ogreboss-stage3-shuffle object) ;; unknown type -;;(define-extern ogreboss-stage3-hit object) ;; unknown type -;;(define-extern ogreboss-stage2 object) ;; unknown type +(define-extern *ogreboss* ogreboss) ;; unknown type +(define-extern ogreboss-dead (state ogreboss)) ;; unknown type +(define-extern ogreboss-idle (state ogreboss)) ;; unknown type +(define-extern ogreboss-die (state ogreboss)) ;; unknown type +(define-extern ogreboss-stage1 (state ogreboss)) ;; unknown type +(define-extern ogreboss-stage3-throw (state ogreboss)) ;; unknown type +(define-extern ogreboss-stage3-shuffle (state ogreboss)) ;; unknown type +(define-extern ogreboss-stage3-hit (state ogreboss)) ;; unknown type +(define-extern ogreboss-stage2 (state ogreboss)) ;; unknown type (define-extern *ogreboss-cam-sg* skeleton-group) -;;(define-extern ogreboss-wait-for-player object) ;; unknown type -;;(define-extern ogreboss-intro object) ;; unknown type +(define-extern ogreboss-wait-for-player (state ogreboss)) ;; unknown type +(define-extern ogreboss-intro (state ogreboss)) ;; unknown type (define-extern *ogreboss-column-sg* skeleton-group) (define-extern *ogreboss-bounce-boulder-sg* skeleton-group) -;;(define-extern ogreboss-bounce-boulder-idle object) ;; unknown type +(define-extern ogreboss-bounce-boulder-idle (state ogreboss-bounce-boulder)) ;; unknown type (define-extern *ogreboss-super-boulder-sg* skeleton-group) -;;(define-extern ogreboss-super-boulder-idle object) ;; unknown type -;;(define-extern ogreboss-super-boulder-roll object) ;; unknown type -;;(define-extern ogreboss-super-boulder-land object) ;; unknown type -;;(define-extern ogreboss-super-boulder-throw object) ;; unknown type -;;(define-extern ogreboss-super-boulder-hit object) ;; unknown type -;;(define-extern ogreboss-super-boulder-die object) ;; unknown type -;;(define-extern ogreboss-super-boulder-killed-player object) ;; unknown type +(define-extern ogreboss-super-boulder-idle (state ogreboss-super-boulder)) ;; unknown type +(define-extern ogreboss-super-boulder-roll (state ogreboss-super-boulder)) ;; unknown type +(define-extern ogreboss-super-boulder-land (state ogreboss-super-boulder)) ;; unknown type +(define-extern ogreboss-super-boulder-throw (state ogreboss-super-boulder)) ;; unknown type +(define-extern ogreboss-super-boulder-hit (state ogreboss-super-boulder)) ;; unknown type +(define-extern ogreboss-super-boulder-die (state ogreboss-super-boulder)) ;; unknown type +(define-extern ogreboss-super-boulder-killed-player (state ogreboss-super-boulder)) ;; unknown type (define-extern *ogreboss-shoot-boulder-sg* skeleton-group) -;;(define-extern *ogreboss-missile-shadow-control* object) ;; unknown type -;;(define-extern ogreboss-missile-idle object) ;; unknown type +(define-extern *ogreboss-missile-shadow-control* shadow-control) ;; unknown type +(define-extern ogreboss-missile-idle (state ogreboss-missile)) ;; unknown type (define-extern *ogreboss-shoot-boulder-break-sg* skeleton-group) -;;(define-extern ogreboss-missile-impact object) ;; unknown type -;;(define-extern *ogreboss-shadow-control* object) ;; unknown type -;;(define-extern ogreboss-missile-seek object) ;; unknown type +(define-extern ogreboss-missile-impact (state ogreboss-missile)) ;; unknown type +(define-extern *ogreboss-shadow-control* shadow-control) ;; unknown type +(define-extern ogreboss-missile-seek (state ogreboss-missile)) ;; unknown type ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc index 128da81a78..15ac9cd55a 100644 --- a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc @@ -856,5 +856,39 @@ [0, "(function surface object object int float)"] ], + "target": [ + [1, "(function none :behavior target)"], + [5, "(function none :behavior target)"], + [16, "(function target float)"] + ], + + "water": [ + [13, "(function water-vol object)"] + ], + + "rolling-lightning-mole": [ + [38, "(function none :behavior lightning-mole)"] + ], + + "target-flut": [ + [23, "(function nav-enemy none :behavior target)"], + [57, "(function shadow-control :behavior target)"], + [58, "(function float :behavior flutflut)"] + ], + + "target-death": [ + [1, "(function process int :behavior target)"], + [2, "(function none :behavior target)"], + [16, "(function surface surface surface int none :behavior target)"], + [17, "(function surface surface surface int none :behavior target)"], + [19, "(function continue-point target)"], + [20, "(function target)"] + ], + + "target2": [ + [11, "(function vector int float symbol :behavior target)"], + [99, "(function symbol)"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc index f2d11b8e17..b7ad064488 100644 --- a/decompiler/config/jak1_ntsc_black_label/hacks.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/hacks.jsonc @@ -266,12 +266,10 @@ "ambient-inspect", // target BUG - "target-falling-anim-trans", + "target-falling-anim-trans", // CFG resolution // target2 BUG - "(anon-function 33 target2)", // BUG: - "(anon-function 67 target2)", // BUG: - "look-for-points-of-interest", + "look-for-points-of-interest", // Failed to split nested sc - looks like dead code to me // drawable-tree "(method 16 drawable-tree)", @@ -317,7 +315,7 @@ // "(anon-function 10 ice-cube)", // "(anon-function 15 ice-cube)", "mistycannon-find-best-solution", - "target-flut-falling-anim-trans", + "target-flut-falling-anim-trans", // CFG failure "kermit-check-to-hit-player?", "(anon-function 36 mistycannon)", "(anon-function 2 target-tube)", @@ -377,7 +375,9 @@ "command-get-trans", "command-get-camera", "(method 14 camera-tracker)", - "(enter billy-playing)" + "(enter billy-playing)", + "(code target-continue)", + "next-level" ], // If format is used with the wrong number of arguments, diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index ac53a2ff1b..797b639283 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -1446,6 +1446,376 @@ "steam-cap": [ ["L51", "attack-info"] ], + + "sidekick": [ + ["L29", "vector"] + ], + + "target": [ + ["L720", "float", true], + ["L721", "float", true], + ["L722", "float", true], + ["L723", "float", true], + ["L724", "float", true], + ["L725", "float", true], + ["L726", "float", true], + ["L727", "float", true], + ["L728", "float", true], + ["L729", "float", true], + ["L730", "float", true], + ["L731", "float", true], + ["L732", "float", true], + ["L733", "float", true], + ["L734", "(pointer float)", 1], + ["L735", "(pointer float)", 1], + ["L736", "(pointer float)", 1], + ["L737", "(pointer float)", 1], + ["L738", "(pointer float)", 1], + ["L739", "float", true], + ["L740", "float", true], + ["L741", "float", true], + ["L742", "float", true], + ["L743", "float", true], + ["L744", "float", true], + ["L745", "float", true], + ["L746", "float", true], + ["L747", "float", true], + ["L748", "float", true], + ["L749", "float", true], + ["L750", "(pointer float)", 1], + ["L751", "float", true], + ["L752", "float", true], + ["L753", "float", true], + ["L754", "float", true], + ["L755", "float", true], + ["L756", "float", true], + ["L757", "float", true], + ["L758", "float", true], + ["L759", "float", true], + ["L760", "float", true], + ["L761", "float", true], + ["L762", "float", true], + ["L763", "float", true], + ["L764", "float", true], + ["L765", "float", true], + ["L766", "float", true], + ["L767", "(pointer float)", 1], + ["L768", "float", true], + ["L769", "float", true], + ["L770", "float", true], + ["L771", "float", true], + ["L772", "float", true], + ["L773", "float", true], + ["L774", "float", true], + ["L775", "float", true], + ["L776", "float", true], + ["L777", "float", true], + ["L778", "float", true], + ["L779", "float", true], + ["L780", "float", true], + ["L781", "float", true], + ["L782", "float", true], + ["L783", "float", true], + ["L784", "float", true], + ["L785", "float", true], + ["L786", "(pointer float)", 1], + ["L787", "(pointer float)", 1], + ["L788", "float", true], + ["L789", "float", true], + ["L790", "float", true], + ["L791", "float", true], + ["L792", "float", true], + ["L793", "float", true], + ["L794", "float", true], + ["L795", "float", true], + ["L796", "float", true], + ["L797", "float", true], + ["L798", "float", true], + ["L799", "float", true], + ["L800", "float", true], + ["L801", "float", true], + ["L802", "float", true], + ["L803", "float", true], + ["L804", "float", true], + ["L805", "float", true], + ["L806", "float", true], + ["L807", "float", true], + ["L808", "float", true], + ["L809", "float", true], + ["L810", "float", true], + ["L811", "float", true], + ["L812", "float", true], + ["L813", "float", true], + ["L814", "(pointer float)", 1], + ["L815", "uint64", true] + ], + + "target-handler": [ + ["L195", "attack-info"], + ["L197", "float", true], + ["L198", "float", true], + ["L199", "float", true], + ["L200", "float", true], + ["L201", "float", true], + ["L202", "float", true], + ["L203", "float", true], + ["L204", "(pointer float)", 1], + ["L205", "uint64", true], + ["L206", "uint64", true], + ["L207", "uint64", true], + ["L208", "uint64", true], + ["L209", "uint64", true] + ], + + "water": [ + ["L148", "attack-info"], + ["L149", "attack-info"], + ["L150", "attack-info"] + ], + + "racer": [ + ["L106", "vector"] + ], + + "target-racer-FIC-LAV-MIS-OGR-ROL": [ + ["L237", "attack-info"], + ["L238", "attack-info"], + ["L240", "vector"] + ], + + "rolling-lightning-mole": [ + ["L181", "vector"], + ["L185", "rgba", true], + ["L186", "rgba", true], + ["L187", "rgba", true], + ["L189", "rgba", true], + ["L195", "vector"] + ], + + "rolling-robber": [ + ["L127", "vector"], + ["L139", "vector"], + ["L140", "vector"], + ["L145", "vector"] + ], + + "ogreboss": [ + ["L525", "uint64", true], + ["L526", "uint64", true], + ["L527", "uint64", true], + ["L528", "uint64", true], + ["L529", "uint64", true], + ["L530", "uint64", true] + ], + + "mother-spider": [ + ["L301", "(inline-array mother-spider-leg-info)", 8], + ["L302", "(inline-array mother-spider-thread)", 9] + ], + + "target-flut": [ + ["L399", "attack-info"], + ["L406", "float", true], + ["L407", "float", true], + ["L408", "float", true], + ["L409", "float", true], + ["L410", "float", true], + ["L411", "float", true], + ["L412", "float", true], + ["L413", "float", true], + ["L414", "float", true], + ["L415", "float", true], + ["L416", "float", true], + ["L417", "float", true], + ["L418", "float", true], + ["L419", "float", true], + ["L420", "float", true], + ["L421", "float", true], + ["L422", "float", true], + ["L423", "float", true], + ["L424", "float", true], + ["L425", "float", true], + ["L426", "float", true], + ["L427", "float", true], + ["L428", "float", true], + ["L429", "float", true], + ["L430", "float", true], + ["L431", "float", true], + ["L432", "float", true], + ["L433", "float", true], + ["L434", "float", true], + ["L435", "float", true], + ["L436", "float", true], + ["L437", "float", true], + ["L438", "float", true], + ["L439", "float", true], + ["L440", "float", true], + ["L441", "float", true], + ["L442", "float", true], + ["L443", "float", true], + ["L444", "float", true], + ["L445", "float", true], + ["L446", "float", true], + ["L447", "float", true], + ["L448", "float", true], + ["L449", "float", true], + ["L450", "float", true], + ["L451", "float", true], + ["L452", "float", true], + ["L453", "float", true], + ["L454", "float", true], + ["L455", "float", true], + ["L456", "float", true], + ["L457", "(pointer float)", 1], + ["L458", "uint64", true], + ["L459", "uint64", true], + ["L460", "uint64", true], + ["L461", "uint64", true], + ["L462", "uint64", true], + ["L463", "uint64", true], + ["L464", "uint64", true], + ["L465", "uint64", true], + ["L483", "uint64", true], + ["L484", "uint64", true] + ], + + "target-death": [ + ["L308", "vector"], + ["L316", "float", true], + ["L317", "float", true], + ["L318", "float", true], + ["L319", "float", true], + ["L320", "float", true], + ["L321", "float", true], + ["L322", "float", true], + ["L323", "float", true], + ["L324", "float", true], + ["L325", "float", true], + ["L326", "float", true], + ["L327", "float", true], + ["L328", "float", true], + ["L329", "float", true], + ["L330", "float", true], + ["L331", "float", true], + ["L332", "float", true], + ["L333", "float", true], + ["L334", "float", true], + ["L335", "float", true], + ["L336", "float", true], + ["L337", "float", true], + ["L338", "float", true], + ["L339", "float", true], + ["L340", "float", true], + ["L341", "float", true], + ["L342", "float", true], + ["L343", "float", true], + ["L344", "uint64", true], + ["L345", "uint64", true], + ["L346", "uint64", true], + ["L347", "uint64", true], + ["L348", "uint64", true], + ["L349", "uint64", true], + ["L350", "uint64", true], + ["L351", "uint64", true], + ["L352", "uint64", true], + ["L355", "float", true] + ], + + "target2": [ + ["L615", "attack-info"], + ["L656", "float", true], + ["L657", "float", true], + ["L658", "float", true], + ["L659", "float", true], + ["L660", "float", true], + ["L661", "float", true], + ["L662", "float", true], + ["L663", "float", true], + ["L664", "float", true], + ["L665", "float", true], + ["L666", "float", true], + ["L667", "float", true], + ["L668", "float", true], + ["L669", "float", true], + ["L670", "float", true], + ["L671", "float", true], + ["L672", "float", true], + ["L673", "float", true], + ["L674", "float", true], + ["L675", "float", true], + ["L676", "float", true], + ["L677", "float", true], + ["L678", "float", true], + ["L679", "float", true], + ["L680", "float", true], + ["L681", "float", true], + ["L682", "float", true], + ["L683", "float", true], + ["L684", "float", true], + ["L685", "float", true], + ["L686", "float", true], + ["L687", "float", true], + ["L688", "float", true], + ["L689", "float", true], + ["L690", "float", true], + ["L691", "float", true], + ["L692", "float", true], + ["L693", "float", true], + ["L694", "float", true], + ["L695", "float", true], + ["L696", "float", true], + ["L697", "float", true], + ["L698", "float", true], + ["L699", "float", true], + ["L700", "float", true], + ["L701", "float", true], + ["L702", "float", true], + ["L703", "float", true], + ["L704", "float", true], + ["L705", "float", true], + ["L706", "float", true], + ["L707", "float", true], + ["L708", "float", true], + ["L709", "float", true], + ["L710", "float", true], + ["L711", "float", true], + ["L712", "float", true], + ["L713", "float", true], + ["L714", "float", true], + ["L715", "float", true], + ["L716", "float", true], + ["L717", "float", true], + ["L718", "float", true], + ["L719", "float", true], + ["L720", "float", true], + ["L721", "float", true], + ["L722", "float", true], + ["L723", "float", true], + ["L724", "float", true], + ["L725", "float", true], + ["L726", "float", true], + ["L727", "float", true], + ["L728", "float", true], + ["L729", "float", true], + ["L730", "float", true], + ["L731", "float", true], + ["L732", "float", true], + ["L733", "float", true], + ["L734", "float", true], + ["L735", "float", true], + ["L736", "float", true], + ["L737", "float", true], + ["L738", "(pointer float)", 1], + ["L739", "float", true], + ["L740", "float", true], + ["L741", "float", true], + ["L742", "float", true], + ["L743", "float", true], + ["L744", "(pointer int32)", 1], + ["L745", "uint64", true], + ["L746", "uint64", true], + ["L757", "uint64", true] + ], "collide-shape": [ ["L399", "attack-info"], diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index fa0267d56c..f89d79594e 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -4421,5 +4421,620 @@ "(method 19 collide-shape-prim-sphere)": [[16, "collide-mesh-cache-tri"]], "(method 37 collide-shape)": [[16, "vector"]], + "starts": [ + [16, "event-message-block"] + ], + + "(trans target-flop)": [ + [16, "event-message-block"] + ], + + "(event target-wheel)": [ + [16, "event-message-block"] + ], + + "(code target-stance)": [ + [16, "ground-tween-info"] + ], + + "init-var-jump": [ + [16, "vector"] + ], + + "(code target-wheel)": [ + [16, "vector"] + ], + + "(code target-wheel-flip)": [ + [16, "vector"], + [32, "vector"] + ], + + "(enter target-flop)": [ + [16, "vector"] + ], + + "(code target-running-attack)": [ + [16, "vector"] + ], + + "(enter target-flop-hit-ground)": [ + [16, "vector"] + ], + + "(enter target-attack-air)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "(enter target-hit-ground)": [ + [16, "vector"] + ], + + "(code target-flop)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "(trans target-running-attack)": [ + [16, "vector"], + [32, "vector"] + ], + + "mod-var-jump": [ + [16, "vector"], + [32, "vector"] + ], + + "target-generic-event-handler": [ + [16, "event-message-block"] + ], + + "target-powerup-effect": [ + [16, "vector"] + ], + + "check-water-level-drop": [ + [16, "vector"] + ], + + "(method 13 water-control)": [ + [16, "vector"] + ], + + "(method 10 water-control)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "event-message-block"], + [144, "vector"], + [160, "vector"], + [176, "vector"], + [192, "vector"], + [208, "vector"] + ], + + "(method 15 water-control)": [ + [16, "event-message-block"] + ], + + "(anon-function 13 water)": [ + [16, "event-message-block"] + ], + + "(method 26 water-vol)": [ + [16, "event-message-block"] + ], + + "(code wait-for-start racer)": [ + [16, "event-message-block"], + [96, "vector"] + ], + + "(code idle racer)": [ + [16, "font-context"], + [112, "event-message-block"] + ], + + "(event wait-for-return racer)": [ + [16, "event-message-block"] + ], + + "racer-xz": [ + [16, "vector"] + ], + + "racer-cushion": [ + [16, "vector"] + ], + + "target-racing-post": [ + [16, "vector"], + [32, "vector"] + ], + + "racer-effects": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"], + [96, "vector"], + [112, "vector"], + [128, "vector"], + [144, "event-message-block"], + [224, "vector"], + [240, "vector"], + [256, "vector"] + ], + + "racer-sounds": [ + [16, "vector"], + [32, "event-message-block"] + ], + + "racer-collision": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "racer-find-prop-point": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "racer-integrate": [ + [16, "quaternion"] + ], + + "fleeing-nav-enemy-clip-travel": [ + [16, "clip-travel-vector-to-mesh-return-info"], + [176, "vector"], + [192, "vector"], + [208, "vector"] + ], + + "fleeing-nav-enemy-adjust-travel": [ + [16, "matrix"], + [80, "vector"], + [96, "vector"] + ], + + "fleeing-nav-enemy-chase-post-func": [ + [16, "matrix"], + [80, "matrix"] + ], + + "fleeing-nav-enemy-chase-post": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [112, "vector"], + [128, "vector"] + ], + + "(post lightning-mole-debug-run)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "matrix"] + ], + + "(code fleeing-nav-enemy-debug)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "matrix"], + [144, "vector"] + ], + + "(trans nav-enemy-chase lightning-mole)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "event-message-block"] + ], + + "(trans lightning-mole-debug-blend)": [ + [16, "vector"], + [32, "vector"] + ], + + "(code lightning-mole-dive)": [ + [16, "vector"], + [32, "vector"] + ], + + "(trans lightning-mole-dive)": [ + [16, "event-message-block"] + ], + + "(trans lightning-mole-head-for-hole)": [ + [16, "event-message-block"] + ], + + "(method 43 lightning-mole)": [ + [16, "event-message-block"] + ], + + "(method 44 lightning-mole)": [ + [16, "event-message-block"] + ], + + "check-drop-level-rolling-dirt": [ + [16, "vector"] + ], + + "check-drop-level-rolling-dirt-finish": [ + [16, "vector"] + ], + + "(code fuel-cell-spline-slider)": [ + [16, "vector"] + ], + + "robber-find-ground": [ + [16, "vector"], + [32, "collide-mesh-cache-tri"], + [128, "vector"] + ], + + "robber-rotate": [ + [16, "matrix"], + [80, "vector"] + ], + + "robber-calc-speed": [ + [16, "vector"] + ], + + "(code robber-die)": [ + [16, "vector"] + ], + + "(code robber-initial-notice)": [ + [16, "vector"] + ], + + "(method 11 robber)": [ + [16, "matrix"] + ], + + "(code robber-debug)": [ + [16, "vector"], + [32, "vector"] + ], + + "(code target-flut-running-attack)": [ + [16, "vector"] + ], + + "(enter target-flut-running-attack)": [ + [16, "vector"], + [32, "vector"] + ], + + "(trans target-flut-running-attack)": [ + [16, "vector"], + [32, "vector"] + ], + + "(event target-flut-air-attack)": [ + [16, "vector"], + [32, "event-message-block"] + ], + + "target-flut-standard-event-handler": [ + [16, "vector"], + [32, "matrix"] + ], + + "(code target-flut-start)": [ + [16, "event-message-block"] + ], + + "(exit target-flut-clone-anim)": [ + [16, "event-message-block"] + ], + + "(code target-flut-clone-anim)": [ + [16, "event-message-block"] + ], + + "(enter target-flut-air-attack-hit-ground)": [ + [16, "event-message-block"] + ], + + "(event target-flut-jump)": [ + [16, "vector"], + [32, "event-message-block"] + ], + + "(enter target-flut-air-attack)": [ + [16, "vector"] + ], + + "(post target-flut-get-on)": [ + [16, "vector"] + ], + + "(post target-flut-get-off-jump)": [ + [16, "vector"] + ], + + "(code target-flut-get-on)": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] + ], + + "(code target-flut-get-off-jump)": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] + ], + + "(code target-flut-death)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "(trans target-flut-air-attack)": [ + [16, "vector"], + [32, "vector"] + ], + + "(code target-flut-hit)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "event-message-block"] + ], + + "target-hit-orient": [ + [16, "vector"] + ], + + "target-hit-move": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"] + ], + + "(anon-function 20 target-death)": [ + [16, "event-message-block"] + ], + + "target-death-anim": [ + [16, "event-message-block"], + [96, "vector"] + ], + + "(code target-death)": [ + [16, "event-message-block"], + [96, "vector"] + ], + + "(code target-continue)": [ + [16, "event-message-block"], + [96, "transformq"] + ], + + "velocity-set-to-target!": [ + [16, "vector"] + ], + + "(exit target-hit)": [ + [16, "vector"] + ], + + "(code target-hit)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"], + [80, "event-message-block"] + ], + + "target-hit-push": [ + [16, "vector"] + ], + + "(anon-function 2 target-death)": [ + [16, "vector"] + ], + + "racer-collision-reaction": [ + [16, "vector"], + [32, "vector"], + [48, ["inline-array", "vector", 2]], + [112, "vector"], + [128, "vector"], + [144, "vector"], + [160, "vector"], + [176, "vector"], + [192, "vector"], + [208, "vector"], + [224, "vector"] + ], + + "target-send-attack": [ + [16, "event-message-block"], + [112, "vector"], + [144, "vector"], + [160, "vector"], + [192, "vector"], + [208, "vector"] + ], + + "target-apply-tongue": [ + [16, "vector"] + ], + + "target-bonk-event-handler": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"], + [128, "vector"] + ], + + "(code target-load-wait)": [ + [16, "event-message-block"] + ], + + "(code target-stance-look-around)": [ + [16, "event-message-block"] + ], + + "(enter target-look-around)": [ + [16, "event-message-block"] + ], + + "(exit target-look-around)": [ + [16, "event-message-block"] + ], + + "(code target-look-around)": [ + [16, "event-message-block"] + ], + + "(enter target-billy-game)": [ + [16, "event-message-block"] + ], + + "(exit target-billy-game)": [ + [16, "event-message-block"] + ], + + "(enter target-pole-cycle)": [ + [16, "event-message-block"] + ], + + "(code target-pole-flip-up-jump)": [ + [16, "event-message-block"] + ], + + "(enter target-edge-grab)": [ + [16, "event-message-block"] + ], + + "(exit target-edge-grab)": [ + [16, "event-message-block"] + ], + + "(trans target-swim-up)": [ + [16, "event-message-block"] + ], + + "(code target-launch)": [ + [16, "event-message-block"] + ], + + "(code target-play-anim)": [ + [16, "event-message-block"] + ], + + "(exit target-play-anim)": [ + [16, "event-message-block"] + ], + + "(trans target-edge-grab)": [ + [16, "collide-using-spheres-params"] + ], + + "(exit target-clone-anim)": [ + [16, "event-message-block"], + [96, "vector"] + ], + + "(enter target-clone-anim)": [ + [16, "event-message-block"] + ], + + "(code target-edge-grab-off)": [ + [16, "event-message-block"], + [96, "vector"] + ], + + "(trans target-look-around)": [ + [16, "vector"], + [32, "vector"] + ], + + "(trans target-pole-cycle)": [ + [16, "vector"] + ], + + "(code target-swim-jump)": [ + [16, "vector"] + ], + + "(anon-function 11 target2)": [ + [16, "vector"], + [48, "vector"], + [64, "vector"], + [80, "vector"] + ], + + "(enter target-yellow-blast)": [ + [16, "vector"] + ], + + "(code target-periscope)": [ + [16, "vector"], + [32, "event-message-block"] + ], + + "(enter target-yellow-jump-blast)": [ + [16, "vector"] + ], + + "(code target-swim-down)": [ + [16, "vector"] + ], + + "(code target-yellow-jump-blast)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "target-swim-tilt": [ + [16, "vector"], + [32, "vector"], + [48, "vector"] + ], + + "(code target-yellow-blast)": [ + [16, "vector"], + [32, "vector"], + [48, "event-message-block"] + ], + + "(code target-edge-grab-jump)": [ + [16, "vector"], + [32, "event-message-block"] + ], + + "(trans target-billy-game)": [ + [16, "vector"], + [32, "vector"] + ], + + "(code target-wade-walk)": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 9d396c27df..076726003a 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -5868,5 +5868,508 @@ [53, "s0", "(inline-array collide-cache-prim)"] ], + "target-falling-anim": [ + [51, "v1", "art-joint-anim"], + [160, "v1", "art-joint-anim"] + ], + + "target-hit-ground-anim": [ + [79, "v1", "art-joint-anim"], + [312, "v1", "art-joint-anim"], + [389, "v1", "art-joint-anim"], + [441, "v1", "art-joint-anim"], + [520, "v1", "art-joint-anim"], + [578, "v1", "art-joint-anim"], + [675, "v1", "art-joint-anim"], + [736, "v1", "art-joint-anim"], + [846, "v1", "art-joint-anim"] + ], + + "(code target-stance)": [ + [48, "v1", "art-joint-anim"], + [117, "v1", "art-joint-anim"], + [170, "v1", "art-joint-anim"], + [234, "v1", "art-joint-anim"], + [298, "v1", "art-joint-anim"], + [389, "v1", "art-joint-anim"], + [503, "v1", "art-joint-anim"] + ], + + "(code target-walk)": [ + [146, "v1", "art-joint-anim"], + [243, "v1", "art-joint-anim"] + ], + + "(code target-slide-down)": [ + [26, "v1", "art-joint-anim"] + ], + + "(code target-jump-forward)": [ + [13, "v1", "art-joint-anim"] + ], + + "(code target-double-jump)": [ + [24, "v1", "art-joint-anim"] + ], + + "(code target-attack-air)": [ + [14, "v1", "art-joint-anim"], + [167, "v1", "art-joint-anim"] + ], + + "(code target-attack)": [ + [14, "v1", "art-joint-anim"] + ], + + "(code target-flop)": [ + [13, "v1", "art-joint-anim"] + ], + + "(code target-duck-stance)": [ + [21, "v1", "art-joint-anim"], + [116, "v1", "art-joint-anim"], + [168, "v1", "art-joint-anim"] + ], + + "mod-var-jump": [ + [77, "f0", "float"], + [80, "f0", "float"], + [159, "v0", "vector"] + ], + + "(code target-duck-high-jump-jump)": [ + [8, "v1", "float"] + ], + + "(event target-running-attack)": [ + [41, "v1", "process-drawable"], + [50, "s5", "collide-shape"] + ], + + "(enter target-jump)": [ + [53, "v1", "vector"] + ], + + "(enter target-high-jump)": [ + [21, "v1", "vector"] + ], + + "(enter target-double-jump)": [ + [15, "v1", "vector"] + ], + + // TODO - these shouldnt be required, but are here because `go/enter-state` returns none + "(event target-flop)": [ + [34, "t9", "(function object :behavior target)"], + [40, "t9", "(function symbol object :behavior target)"] + ], + + "target-powerup-effect": [ + [267, "a0", "symbol"], + [307, "a0", "vector"] + ], + + "(method 10 water-control)": [ + [71, "a0", "collide-shape-moving"], + [147, "v1", "collide-shape-moving"], + [179, "v1", "collide-shape-moving"], + [461, "v1", "control-info"], + [473, "a0", "collide-shape-moving"], + [488, "v1", "collide-shape-moving"], + [502, "v1", "collide-shape-moving"], + [508, "v1", "collide-shape-moving"], + [580, "v1", "collide-shape-moving"], + [600, "s4", "collide-shape-moving"], + [609, "s4", "collide-shape-moving"], + [622, "s4", "collide-shape-moving"], + [627, "s4", "collide-shape-moving"], + [629, "s4", "collide-shape-moving"], + [716, "s5", "collide-shape-moving"], + [720, "s5", "collide-shape-moving"], + [721, "s5", "collide-shape-moving"], + [728, "s5", "collide-shape-moving"], + [730, "s5", "collide-shape-moving"], + [731, "s5", "collide-shape-moving"], + [744, "v1", "collide-shape-moving"], + [751, "a0", "collide-shape-moving"], + [775, "v1", "collide-shape-moving"], + [824, "a1", "collide-shape-moving"], + [826, "a0", "collide-shape-moving"], + [831, "v1", "collide-shape-moving"] + ], + + "part-water-splash-callback": [ + [3, "v1", "float"] + ], + + "(method 15 water-control)": [ + [42, "v1", "float"] + ], + + "(method 27 water-vol)": [ + [16, "v1", "target"] + ], + + "(method 26 water-vol)": [ + [19, "v1", "target"], + [33, "v1", "target"] + ], + + "(method 29 water-vol)": [ + ["_stack_", 16, "res-tag"], + [46, "v0", "(pointer float)"] + ], + + "(enter pickup racer)": [ + [1, "t9", "(function none :behavior racer)"] + ], + + "target-racing-jump-anim": [ + [36, "v1", "art-joint-anim"] + ], + + "target-racing-land-anim": [ + [23, "v1", "art-joint-anim"], + [82, "v1", "art-joint-anim"], + [144, "v1", "art-joint-anim"] + ], + + "(post target-racing-get-off-jump)": [ + [191, "f0", "float"] + ], + + "check-drop-level-rolling-dirt-finish": [ + [17, "v1", "float"] + ], + + "(code peeper-down)": [ + [24, "v1", "float"] + ], + + "(code nav-enemy-notice fleeing-nav-enemy)": [ + [27, "v1", "art-joint-anim"] + ], + + "(code lightning-mole-dive)": [ + [39, "v1", "art-joint-anim"] + ], + + "(code lightning-mole-yelp)": [ + [19, "v1", "art-joint-anim"] + ], + + "(code peeper-up)": [ + [10, "v1", "art-joint-anim"] + ], + + "(code robber-idle)": [ + [14, "v1", "art-joint-anim"] + ], + + "(code robber-initial)": [ + [14, "v1", "art-joint-anim"] + ], + + "(code robber-initial-notice)": [ + [43, "v1", "art-joint-anim"] + ], + + "(code robber-tired)": [ + [69, "v1", "art-joint-anim"], + [136, "v1", "float"] + ], + + "(code robber-flee)": [ + [69, "v1", "art-joint-anim"], + [136, "v1", "float"] + ], + + "(code robber-die)": [ + [71, "f0", "float"], + [104, "v1", "art-joint-anim"] + ], + + "target-flut-hit-ground-anim": [ + [131, "v1", "art-joint-anim"], + [204, "v1", "art-joint-anim"] + ], + + "target-flut-standard-event-handler": [ + [164, "a0", "process-drawable"] + ], + + "(code target-flut-stance)": [ + [81, "v1", "art-joint-anim"], + [145, "v1", "art-joint-anim"] + ], + + "(code target-flut-walk)": [ + [60, "v1", "art-joint-anim"] + ], + + "(code target-flut-air-attack)": [ + [98, "v1", "art-joint-anim"] + ], + + "(code target-flut-air-attack-hit-ground)": [ + [86, "v1", "art-joint-anim"] + ], + + "(code target-flut-death)": [ + [224, "v1", "art-joint-anim"] + ], + + "(code target-flut-get-off-hit-ground)": [ + [13, "v1", "art-joint-anim"] + ], + + "(code target-flut-running-attack)": [ + [181, "f30", "float"], + [246, "f1", "float"], + [247, "f0", "float"], + [247, "f30", "float"], + [350, "v1", "art-joint-anim"], + [381, "f30", "float"] + ], + + "(code target-flut-double-jump)": [ + [14, "v1", "art-joint-anim"], + [78, "v1", "art-joint-anim"] + ], + + "(trans target-flut-walk)": [ + [147, "f0", "float"], + [152, "f1", "float"], + [203, "f0", "float"] + ], + + "(event target-flut-running-attack)": [ + [41, "v1", "process-drawable"], + [53, "v1", "collide-shape"], + [59, "v1", "collide-shape"] + ], + + "(code target-flut-get-on)": [ + [62, "s4", "process-drawable"], + [69, "s4", "process-drawable"], + [88, "s4", "process-drawable"], + [93, "s4", "process-drawable"] + ], + + "(code target-flut-get-off-jump)": [ + [55, "s3", "process-drawable"], + [59, "s3", "process-drawable"], + [74, "s3", "process-drawable"], + [93, "s3", "process-drawable"], + [98, "s3", "process-drawable"], + [145, "v1", "art-joint-anim"] + ], + + "(event target-flut-grab)": [ + [24, "a0", "process-drawable"] + ], + + "(post target-racing-get-on)": [ + [76, "f0", "float"], + [88, "f0", "float"], + [92, "f1", "float"] + ], + + "target-death-anim": [ + [18, "v1", "art-joint-anim"] + ], + + "target-hit-setup-anim": [ + [90, "v1", "art-joint-anim"], + [164, "v1", "art-joint-anim"] + ], + + "(code target-death)": [ + [533, "v1", "art-joint-anim"], + [655, "v0", "int"], + [691, "v1", "nav-enemy"], + [844, "gp", "spool-anim"], + [968, "s5", "handle"], + [991, "s5", "handle"], + [1010, "gp", "spool-anim"], + [1028, "s5", "handle"], + [1031, "s5", "handle"] + ], + + "(anon-function 1 target-death)": [ + [12, "gp", "process-drawable"], + [16, "gp", "process-drawable"] + ], + + "next-level": [ + [7, "a1", "level-load-info"], + [10, "a1", "level-load-info"] + ], + + "target-generic-event-handler": [ + [10, "v1", "float"], + [297, "v1", "float"], + [308, "a0", "vector"], + [562, "v1", "(state target)"] + ], + + "target-standard-event-handler": [ + [167, "a0", "process"], + [182, "a0", "process"], + [197, "a0", "process"], + [223, "a0", "process"], + [242, "a0", "process"], + [257, "a0", "process"], + [272, "a0", "process"], + [280, "a1", "process"], + [303, "a0", "process"], + [330, "a0", "process"] + ], + + "(code target-load-wait)": [ + [21, "v1", "art-joint-anim"], + [138, "v1", "art-joint-anim"], + [196, "v1", "art-joint-anim"] + ], + + "(code target-grab)": [ + [133, "v1", "art-joint-anim"], + [185, "v1", "art-joint-anim"], + [322, "v1", "art-joint-anim"], + [475, "v1", "art-joint-anim"] + ], + + "(code target-pole-cycle)": [ + [87, "v1", "art-joint-anim"], + [148, "v1", "art-joint-anim"] + ], + + "(code target-pole-flip-up)": [ + [13, "v1", "art-joint-anim"] + ], + + "(code target-edge-grab-jump)": [ + [34, "v1", "art-joint-anim"] + ], + + "(code target-eco-powerup)": [ + [32, "v1", "art-joint-anim"], + [47, "v1", "float"], + [215, "v1", "float"] + ], + + "(code target-swim-stance)": [ + [31, "v1", "art-joint-anim"], + [52, "v1", "float"], + [89, "v1", "float"] + ], + + "(event target-swim-down)": [ + [9, "v1", "attack-info"], + [13, "v1", "attack-info"], + [18, "v1", "attack-info"], + [23, "v1", "attack-info"], + [38, "v1", "attack-info"], + [39, "v1", "attack-info"], + [41, "v1", "attack-info"] + ], + + "(code target-swim-walk)": [ + [54, "v1", "art-joint-anim"], + [140, "v1", "art-joint-anim"] + ], + + "(code target-yellow-jump-blast)": [ + [184, "v1", "art-joint-anim"] + ], + + "(code target-swim-down)": [ + [52, "v1", "art-joint-anim"] + ], + + "(anon-function 11 target2)": [ + [19, "s4", "target"], // confusing -- the parent of a target is a target? + [21, "s4", "target"], + [29, "s4", "target"], + [34, "s4", "target"], + [40, "s4", "target"], + [54, "s4", "target"], + [66, "s4", "target"], + [76, "s4", "target"], + [82, "s4", "target"], + [87, "s4", "target"], + [89, "s4", "target"], + [118, "s4", "target"], + [129, "s4", "target"] + ], + + "(code target-play-anim)": [ + [8, "v0", "art-joint-anim"] + ], + + "(code target-look-around)": [ + [20, "v0", "float"] + ], + + "(code target-stance-look-around)": [ + [10, "v0", "float"], + [36, "t9", "(function none :behavior target)"] + ], + + "part-first-person-hud-selector-func": [ + [16, "v1", "first-person-hud"] + ], + + "part-first-person-hud-right-func": [ + [16, "s5", "first-person-hud"], + [42, "s5", "first-person-hud"], + [46, "s5", "first-person-hud"], + [50, "s5", "first-person-hud"], + [59, "s5", "first-person-hud"] + ], + + "part-first-person-hud-left-func": [ + [16, "s5", "first-person-hud"], + [43, "s5", "first-person-hud"], + [47, "s5", "first-person-hud"], + [51, "s5", "first-person-hud"], + [60, "s5", "first-person-hud"] + ], + + "(event target-grab)": [ + [30, "a0", "process"], + [48, "a0", "process"], + [56, "a1", "process"] + ], + + "(code target-periscope)": [ + [25, "v1", "process-drawable"], + [49, "v1", "art-joint-anim"], + [130, "v1", "art-joint-anim"] + ], + + "(code target-swim-up)": [ + [17, "v1", "art-joint-anim"] + ], + + "(code target-yellow-blast)": [ + [161, "gp", "handle"], + [176, "v1", "art-joint-anim"], + [219, "gp", "handle"] + ], + + "(code target-edge-grab)": [ + [143, "v1", "art-joint-anim"], + [198, "v1", "art-joint-anim"] + ], + + "(method 10 first-person-hud)": [ + [32, "t9", "(function process none)"] + ], + + "(code target-pole-flip-forward-jump)": [ + [40, "t9", "(function none :behavior target)"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc index 7f06f7ff70..fe199c8f5e 100644 --- a/decompiler/config/jak1_ntsc_black_label/var_names.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/var_names.jsonc @@ -3730,5 +3730,17 @@ } }, + "target-powerup-effect": { + "vars": { + "a0-74": ["a0-74", "vector"] + } + }, + + "(code target-yellow-blast)": { + "vars": { + "gp-0": ["gp-0", "handle"] + } + }, + "aaaaaaaaaaaaaaaaaaaaaaa": {} } diff --git a/goal_src/engine/anim/joint-h.gc b/goal_src/engine/anim/joint-h.gc index 90bd2fac80..5acbddf1d0 100644 --- a/goal_src/engine/anim/joint-h.gc +++ b/goal_src/engine/anim/joint-h.gc @@ -6,19 +6,27 @@ ;; dgos: GAME, ENGINE (declare-type joint-control basic) +(declare-type effect-control basic) + +(define-extern cspace<-parented-transformq-joint! (function cspace transformq none)) +(define-extern cspace<-transformq! (function cspace transformq matrix)) +(define-extern vector<-cspace! (function vector cspace vector)) + +;; DECOMP BEGINS + (deftype joint-control-channel (structure) - ((parent joint-control :offset-assert 0) - (command symbol :offset-assert 4) - (frame-interp float :offset-assert 8) - (frame-group art-joint-anim :offset-assert 12) - (frame-num float :offset-assert 16) - (num-func (function joint-control-channel float float float) :offset-assert 20) - (param float 2 :offset-assert 24) - (group-sub-index int16 :offset-assert 32) - (group-size int16 :offset-assert 34) - (dist meters :offset-assert 36) - (eval-time uint32 :offset-assert 40) - (inspector-amount float :offset-assert 44) + ((parent joint-control :offset-assert 0) + (command symbol :offset-assert 4) + (frame-interp float :offset-assert 8) + (frame-group art-joint-anim :offset-assert 12) + (frame-num float :offset-assert 16) + (num-func (function joint-control-channel float float float) :offset-assert 20) + (param float 2 :offset-assert 24) + (group-sub-index int16 :offset-assert 32) + (group-size int16 :offset-assert 34) + (dist meters :offset-assert 36) + (eval-time uint32 :offset-assert 40) + (inspector-amount float :offset-assert 44) ) :method-count-assert 10 :size-assert #x30 @@ -28,7 +36,7 @@ ) ) -(declare-type effect-control basic) + (deftype joint-control (basic) ((status uint16 :offset-assert 4) (allocated-length int16 :offset-assert 6) @@ -55,27 +63,29 @@ :flag-assert #xb000000c0 (:methods (new (symbol type int) _type_ 0) - (dummy-9 (_type_) none 9) + (dummy-9 (_type_) float 9) (dummy-10 (_type_ symbol) int 10) ) ) + (deftype matrix-stack (structure) - ((top matrix :offset-assert 0) - (data matrix 24 :inline :offset-assert 16) + ((top matrix :offset-assert 0) + (data matrix 24 :inline :offset-assert 16) ) :method-count-assert 9 :size-assert #x610 :flag-assert #x900000610 ) + (deftype channel-upload-info (structure) - ((fixed joint-anim-compressed-fixed :offset-assert 0) - (fixed-qwc int32 :offset-assert 4) - (frame joint-anim-compressed-frame :offset-assert 8) - (frame-qwc int32 :offset-assert 12) - (amount float :offset-assert 16) - (interp float :offset-assert 20) + ((fixed joint-anim-compressed-fixed :offset-assert 0) + (fixed-qwc int32 :offset-assert 4) + (frame joint-anim-compressed-frame :offset-assert 8) + (frame-qwc int32 :offset-assert 12) + (amount float :offset-assert 16) + (interp float :offset-assert 20) ) :pack-me :method-count-assert 9 @@ -83,21 +93,20 @@ :flag-assert #x900000018 ) + (deftype joint-work (structure) - ((temp-mtx matrix :inline :offset-assert 0) - (joint-stack matrix-stack :inline :offset-assert 64) - (fix-jmp-table (function none) 16 :offset-assert 1616) - (frm-jmp-table (function none) 16 :offset-assert 1680) - (pair-jmp-table (function none) 16 :offset-assert 1744) - (uploads channel-upload-info 24 :inline :offset-assert 1808) - (num-uploads int32 :offset-assert 2384) - (mtx-acc matrix 2 :inline :offset-assert 2400) - (tq-acc transformq 100 :inline :offset-assert 2528) - (jacp-hdr joint-anim-compressed-hdr :inline :offset-assert 7328) - (fixed-data joint-anim-compressed-fixed :inline :offset-assert 7392) - (frame-data joint-anim-compressed-frame 2 :inline :offset-assert 9600) - ;(flatten-array UNKNOWN 576 :offset-assert 2400) no clue! - ;(flattened UNKNOWN 24 :offset-assert 2400) no clue! + ((temp-mtx matrix :inline :offset-assert 0) + (joint-stack matrix-stack :inline :offset-assert 64) + (fix-jmp-table (function none) 16 :offset-assert 1616) + (frm-jmp-table (function none) 16 :offset-assert 1680) + (pair-jmp-table (function none) 16 :offset-assert 1744) + (uploads channel-upload-info 24 :inline :offset-assert 1808) + (num-uploads int32 :offset-assert 2384) + (mtx-acc matrix 2 :inline :offset-assert 2400) + (tq-acc transformq 100 :inline :offset-assert 2528) + (jacp-hdr joint-anim-compressed-hdr :inline :offset-assert 7328) + (fixed-data joint-anim-compressed-fixed :inline :offset-assert 7392) + (frame-data joint-anim-compressed-frame 2 :inline :offset-assert 9600) ) :method-count-assert 9 :size-assert #x3640 @@ -108,4 +117,4 @@ (define-extern cspace<-transformq! (function cspace transformq matrix)) (define-extern vector<-cspace! (function vector cspace vector)) (define-extern cspace<-transformq+world-trans! (function cspace transformq vector matrix)) -(define-extern create-interpolated-joint-animation-frame (function joint-control int process-drawable int)) \ No newline at end of file +(define-extern create-interpolated-joint-animation-frame (function joint-control int process-drawable int)) diff --git a/goal_src/engine/collide/collide-reaction-target.gc b/goal_src/engine/collide/collide-reaction-target.gc index 1bc7e1e0b2..1d1167543f 100644 --- a/goal_src/engine/collide/collide-reaction-target.gc +++ b/goal_src/engine/collide/collide-reaction-target.gc @@ -8,3 +8,6 @@ ;; TODO - for logic-target (define-extern target-collision-reaction (function control-info collide-shape-intersect vector vector none)) (define-extern target-collision-no-reaction (function control-info collide-shape-intersect vector vector none)) + +;; TODO - for collide-reaction-racer +(define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) ;; not confirmed diff --git a/goal_src/engine/collide/collide-shape-h.gc b/goal_src/engine/collide/collide-shape-h.gc index 2eaec47bbb..2d0deac6e8 100644 --- a/goal_src/engine/collide/collide-shape-h.gc +++ b/goal_src/engine/collide/collide-shape-h.gc @@ -333,8 +333,7 @@ NOTE: uses the size-bytes as the TOTAL size of the structure." (let ((obj (object-new allocation type-to-make size-bytes))) - ;; not sure what this is. - (set! (-> obj cshape) cshape) + (set! (-> obj cshape) (the-as collide-shape cshape)) ;; sphere/mesh? (set! (-> obj prim-id) prim-id) (set! (-> obj prim-core action) 0) diff --git a/goal_src/engine/collide/collide-shape.gc b/goal_src/engine/collide/collide-shape.gc index 091bf8f4c4..48665649b9 100644 --- a/goal_src/engine/collide/collide-shape.gc +++ b/goal_src/engine/collide/collide-shape.gc @@ -993,11 +993,11 @@ ((s5-1 (vector-normalize-copy! (new 'stack-no-clear 'vector) - (the-as vector (&-> obj unknown-vector120)) + (the-as vector (-> obj unknown-vector120)) 1.0 ) ) - (f0-32 (vector-length (the-as vector (&-> obj unknown-vector120)))) + (f0-32 (vector-length (the-as vector (-> obj unknown-vector120)))) ) (set! (-> obj unknown-float140) (if (= f0-32 0.0) 0.0 diff --git a/goal_src/engine/collide/collide-target-h.gc b/goal_src/engine/collide/collide-target-h.gc index bf80fc6df7..3fac85f688 100644 --- a/goal_src/engine/collide/collide-target-h.gc +++ b/goal_src/engine/collide/collide-target-h.gc @@ -43,9 +43,9 @@ (unknown-vector10 vector :inline :offset 544) ;; from - logic-target::flat-setup (unknown-vector11 vector :inline :offset 560) ;; from - logic-target::target-no-move-post (unknown-vector12 vector :inline :offset 576) - (unknown-vector13 vector :inline :offset 592) ;; from - collide-shape::method-37 + (unknown-vector13 vector :inline :offset 592) ;; from - collide-shape::method-37 | target::mod-var-jump (unknown-vector14 vector :inline :offset 608) ;; from - logic-target::target-no-move-post - (unknown-vector15 vector :inline :offset 624) ;; from - collide-shape::method-37 + (unknown-vector15 vector :inline :offset 624) ;; from - collide-shape::method-37 | target-handler::target-exit (unknown-vector16 vector :inline :offset 640) ;; from - collide-shape::method-37 (unknown-dynamics00 dynamics :offset 656) ;; from - logic-target::bend-gravity (unknown-surface00 surface :offset 660) @@ -72,7 +72,8 @@ (unknown-qword00 uint128 :offset 1136) (unknown-float30 float :offset 1140) ;; from - logic-target::target-calc-camera-pos (unknown-vector40 vector :inline :offset 1152) ;; from - logic-target::target-real-post - (unknown-float40 float :offset 1176) ;; from - logic-target::do-rotations2 + (unknown-float40 float :offset 1172) ;; from - target-death::lambda-1 + (unknown-float41 float :offset 1176) ;; from - logic-target::do-rotations2 (unknown-int00 int32 :offset 1180) ;; from - logic-target::joint-points (unknown-float50 float :offset 1168) ;; from - logic-target::target-real-post (unknown-vector50 vector :inline :offset 1184) ;; from - logic-target::build-conversions @@ -96,16 +97,21 @@ (unknown-float71 float :offset 1524) ;; from - collide-shape::method-37 (unknown-vector70 vector :inline :offset 1536) ;; from - logic-target::add-thrust (unknown-vector71 vector :inline :offset 1552) ;; from - target-tube::tube-thrust - (unknown-vector72 vector :inline :offset 1584) ;; from - collide-reaction-target::target-collision-reaction + (unknown-vector72 vector :inline :offset 1568) ;; from - collide-reaction-racer::racer-collision-reaction + (unknown-vector73 vector :inline :offset 1584) ;; from - collide-reaction-racer::racer-collision-reaction (unknown-handle00 handle :offset 1600) ;; from logic-target::reset-target-state (unknown-sphere-array00 collide-shape-prim-sphere 3 :offset 1608) ;; from target-util::target-collide-set! and from target-util::target-danger-set! (unknown-sphere00 collide-shape-prim-sphere :offset 1632) ;; from target-util::target-danger-set! (unknown-sphere01 collide-shape-prim-sphere :offset 1636) ;; from target-util::target-danger-set! (unknown-sphere02 collide-shape-prim-sphere :offset 1640) ;; from target-util::target-danger-set! - (unknown-dword30 int64 :offset 1672) ;; from target-util::can-hands? - (unknown-dword31 int64 :offset 1680) ;; from target-util::can-hands? - (unknown-dword32 int64 :offset 1688) ;; from target-util::can-feet? - (unknown-dword33 int64 :offset 1696) ;; from target-util::can-feet? + (unknown-int50 int32 :offset 1656) ;; from target::(enter target-wheel) + (unknown-dword30 int64 :offset 1664) ;; from target::(trans target-walk) + (unknown-dword31 int64 :offset 1672) ;; from target-util::can-hands? + (unknown-dword32 int64 :offset 1680) ;; from target-util::can-hands? + (unknown-dword33 int64 :offset 1688) ;; from target-util::can-feet? + (unknown-dword34 int64 :offset 1696) ;; from target-util::can-feet? + (unknown-dword35 int64 :offset 1704) ;; from target::(exit target-slide-down) + (unknown-dword36 int64 :offset 1712) ;; from target::(trans target-jump) (unknown-float80 float :offset 1724) ;; from logic-target::bend-gravity (unknown-float81 float :offset 1728) ;; from logic-target::bend-gravity (unknown-float82 float :offset 1732) ;; from logic-target::bend-gravity @@ -127,11 +133,18 @@ (unknown-dword40 int64 :offset 2160) ;; from logic-target::target-compute-edge (unknown-dword41 int64 :offset 2168) ;; from logic-target::target-compute-edge (unknown-handle10 handle :offset 2176) ;; from logic-target::target-compute-pole - probably a swingpole - (unknown-float120 float :offset 2184) ;; from target::mod-var-jump + (unknown-uint20 uint32 :offset 2184) ;; from target::(trans target-running-attack) + (unknown-spoolanim00 spool-anim :offset 2184) ;; from target2::(trans target-stance-ambient) + (unknown-int20 int32 :offset 2184) ;; from (anon-function 1 basebutton) (unknown-symbol20 symbol :offset 2184) ;; from (anon-function 1 basebutton) - (unknown-int20 int32 :offset 2188) ;; from logic-target::target-compute-pole + (unknown-float120 float :offset 2184) ;; from target::mod-var-jump + (unknown-int21 int32 :offset 2188) ;; from logic-target::target-compute-pole + (unknown-uint30 uint32 :offset 2188) ;; from target::(code target-running-attack) (unknown-float121 float :offset 2188) ;; from target::mod-var-jump + (unknown-uint31 uint32 :offset 2192) ;; from target::(trans target-running-attack) + (unknown-float122 float :offset 2196) ;; from target::(trans target-jump) (unknown-float123 float :offset 2200) ;; from target::mod-var-jump + (unknown-float124 float :offset 2204) ;; from target::init-var-jump (unknown-vector102 vector :inline :offset 2224) ;; from (anon-function 3 basebutton) (unknown-vector103 vector :inline :offset 2240) ;; from (anon-function 3 basebutton) (unknown-quaternion02 quaternion :inline :offset 2256) ;; from racer-states::(code target-racing-get-on) @@ -140,23 +153,32 @@ (unknown-vector110 vector :inline :offset 2320) ;; from logic-target::flag-setup (unknown-vector111 vector :inline :offset 2336) ;; from logic-target::flag-setup (unknown-symbol30 symbol :offset 2384) ;; from target-util::target-danger-set! + (unknown-int31 uint32 :offset 2384) ;; from target:: (event target-running-attack) (unknown-dword50 int64 :offset 2392) ;; from target-util::target-start-attack (unknown-dword51 int64 :offset 2400) ;; from target-util::target-start-attack + (unknown-pointer00 pointer :offset 2416) ;; from target-handler::target-standard-event-handler (unknown-symbol40 symbol :offset 2428) ;; from logic-target::post-flag-setup + (unknown-dword60 int64 :offset 2432) ;; from target::(enter target-jump) + (unknown-dword61 int64 :offset 2440) ;; from target::(enter target-jump) + (unknown-dword62 int64 :offset 2448) ;; from target::(enter target-jump) - probably some sort of object64 that's used as a vector? + (unknown-dword63 int64 :offset 2456) ;; from target::(enter target-jump) (unknown-halfword00 int16 :offset 2488) ;; from logic-target::target-move-dist ;; these were determined from racer-collision-reaction. (history-length int16 :offset 2490) (history-data collide-history 128 :inline :offset-assert 2496) (unknown-float140 float :offset 18944) - (unknown-dword60 int64 :offset 18952) ;; from logic-target::add-thrust + (unknown-dword70 int64 :offset 18952) ;; from logic-target::add-thrust (unknown-int40 int32 :offset 18880) ;; from logic-target::flag-setup - (unknown-dword70 int64 :offset 18888) ;; from logic-target::post-flag-setup - (unknown-dword71 int64 :offset 18896) ;; from logic-target::post-flag-setup - (unknown-dword72 int64 :offset 18912) ;; from logic-target::reset-target-state - (unknown-vector120 vector :offset 18928) ;; from collide-shape::method-37 - (unknown-int50 uint32 :offset 18976) ;; from logic-target::print-target-stats + (unknown-dword80 int64 :offset 18888) ;; from logic-target::post-flag-setup + (unknown-dword81 int64 :offset 18896) ;; from logic-target::post-flag-setup + (unknown-float130 float :offset 18904) ;; from target2::target-swim-tilt + (unknown-float131 float :offset 18908) ;; from target2::target-swim-tilt + (unknown-dword82 int64 :offset 18912) ;; from logic-target::reset-target-state + (unknown-vector120 vector :inline :offset 18928) ;; from target::(code target-running-attack) + (unknown-float150 float :offset 18944) ;; from target::(code target-wheel-flip) + (unknown-int60 uint32 :offset 18976) ;; from logic-target::print-target-stats (unknown-soundid00 sound-id :offset 18980) ;; from powerups::target-powerup-process - (unknown-float130 float :offset 18984) ;; from powerups::target-powerup-process + (unknown-float141 float :offset 18984) ;; from powerups::target-powerup-process ) :size-assert #x4a2c :method-count-assert 65 diff --git a/goal_src/engine/draw/process-drawable.gc b/goal_src/engine/draw/process-drawable.gc index 00d831f1b6..5790279845 100644 --- a/goal_src/engine/draw/process-drawable.gc +++ b/goal_src/engine/draw/process-drawable.gc @@ -1199,7 +1199,6 @@ 0.0 ) ) - (none) ) (defbehavior anim-loop process-drawable () diff --git a/goal_src/engine/game/generic-obs.gc b/goal_src/engine/game/generic-obs.gc index 2c249960c1..11e37e2ea8 100644 --- a/goal_src/engine/game/generic-obs.gc +++ b/goal_src/engine/game/generic-obs.gc @@ -1170,6 +1170,7 @@ ) ) +;; TODO modified! (defun ja-anim-done? ((arg0 process)) (let ((gp-0 (command-get-process arg0 *target*))) (when gp-0 diff --git a/goal_src/engine/game/projectiles-h.gc b/goal_src/engine/game/projectiles-h.gc index a42c7b0c99..07a7193df1 100644 --- a/goal_src/engine/game/projectiles-h.gc +++ b/goal_src/engine/game/projectiles-h.gc @@ -5,6 +5,11 @@ ;; name in dgo: projectiles-h ;; dgos: GAME, ENGINE +(declare-type projectile process-drawable) +(define-extern projectile-init-by-other (function entity vector vector uint handle none :behavior projectile)) ;; 4th arg is `options`, 5th is `last-target` + +;; decomp begins + (deftype projectile (process-drawable) ((root-override collide-shape-moving :score 100 :offset 112) (base-trans vector :inline :offset-assert 176) diff --git a/goal_src/engine/geometry/vol-h.gc b/goal_src/engine/geometry/vol-h.gc index 5fc79c3d1f..28be9cb547 100644 --- a/goal_src/engine/geometry/vol-h.gc +++ b/goal_src/engine/geometry/vol-h.gc @@ -5,15 +5,16 @@ ;; name in dgo: vol-h ;; dgos: GAME, ENGINE -;; definition of type plane-volume +;; DECOMP BEGINS + (deftype plane-volume (structure) - ((volume-type symbol :offset-assert 0) - (point-count int16 :offset-assert 4) - (normal-count int16 :offset-assert 6) - (first-point vector :offset-assert 8) - (first-normal vector :offset-assert 12) - (num-planes int32 :offset-assert 16) - (plane uint32 :offset-assert 20) + ((volume-type symbol :offset-assert 0) + (point-count int16 :offset-assert 4) + (normal-count int16 :offset-assert 6) + (first-point vector :offset-assert 8) + (first-normal vector :offset-assert 12) + (num-planes int32 :offset-assert 16) + (plane uint32 :offset-assert 20) ) :pack-me :method-count-assert 12 @@ -26,12 +27,12 @@ ) ) -;; definition of type vol-control + (deftype vol-control (basic) - ((flags uint32 :offset-assert 4) - (process process-drawable :offset-assert 8) - (pos-vol-count int32 :offset-assert 12) - (pos-vol plane-volume 32 :inline :offset-assert 16) + ((flags uint32 :offset-assert 4) + (process process-drawable :offset-assert 8) + (pos-vol-count int32 :offset-assert 12) + (pos-vol plane-volume 32 :inline :offset-assert 16) (neg-vol-count int32 :offset-assert 784) (neg-vol plane-volume 32 :inline :offset-assert 788) (debug-point basic :offset-assert 1556) @@ -43,16 +44,24 @@ (:methods (new (symbol type process-drawable) _type_ 0) (dummy-9 (_type_) none 9) - (dummy-10 () none 10) + (dummy-10 (_type_ vector) none 10) (TODO-RENAME-11 (_type_) symbol 11) ) ) -;; definition for method 0 of type vol-control -;; INFO: Return type mismatch object vs vol-control. -;; Used lq/sq -(defmethod new vol-control ((allocation symbol) (type-to-make type) (arg0 process-drawable)) - (let ((gp-0 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size)))))) + +(defmethod + new + vol-control + ((allocation symbol) (type-to-make type) (arg0 process-drawable)) + (let + ((gp-0 + (the-as + object + (object-new allocation type-to-make (the-as int (-> type-to-make size))) + ) + ) + ) (when (zero? (the-as vol-control gp-0)) (go process-drawable-art-error "memory") (set! gp-0 0) @@ -156,8 +165,10 @@ ) ) - -;; definition for method 11 of type vol-control (defmethod TODO-RENAME-11 vol-control ((obj vol-control)) (and *display-vol-marks* (logtest? (-> obj flags) 1)) ) + + + + diff --git a/goal_src/engine/gfx/ocean/ocean-h.gc b/goal_src/engine/gfx/ocean/ocean-h.gc index 5f03ce22e1..ecc7ba48c4 100644 --- a/goal_src/engine/gfx/ocean/ocean-h.gc +++ b/goal_src/engine/gfx/ocean/ocean-h.gc @@ -5,6 +5,9 @@ ;; name in dgo: ocean-h ;; dgos: GAME, ENGINE +;; NOTE - for water +(define-extern ocean-get-height (function vector float)) + ;; The "ocean" renderer is used to render the infinite water. ;; It doesn't draw the rivers in FJ or the water near the farmer. diff --git a/goal_src/engine/gfx/water/water-h.gc b/goal_src/engine/gfx/water/water-h.gc index 5a04c5dae3..7914a22df7 100644 --- a/goal_src/engine/gfx/water/water-h.gc +++ b/goal_src/engine/gfx/water/water-h.gc @@ -57,54 +57,54 @@ ;; DECOMP BEGINS (deftype water-control (basic) - ((flags uint32 :offset-assert 4) - (process process :offset-assert 8) - (joint-index int32 :offset-assert 12) - (top-y-offset float :offset-assert 16) - (ripple-size meters :offset-assert 20) - (enter-water-time uint64 :offset-assert 24) - (wade-time uint64 :offset-assert 32) - (on-water-time uint64 :offset-assert 40) - (enter-swim-time uint64 :offset-assert 48) - (swim-time uint64 :offset-assert 56) - (base-height meters :offset-assert 64) - (wade-height meters :offset-assert 68) - (swim-height meters :offset-assert 72) - (surface-height meters :offset-assert 76) - (bottom-height meters :offset-assert 80) - (height meters :offset-assert 84) - (height-offset float 4 :offset-assert 88) - (real-ocean-offset meters :offset 88) - (ocean-offset meters :offset 92) - (bob-offset meters :offset 96) - (align-offset meters :offset 100) - (swim-depth meters :offset-assert 104) - (bob smush-control :inline :offset-assert 112) - (volume handle :offset-assert 144) - (bottom vector 2 :inline :offset-assert 160) - (top vector 2 :inline :offset-assert 192) - (enter-water-pos vector :inline :offset-assert 224) - (drip-old-pos vector :inline :offset-assert 240) - (drip-joint-index int32 :offset-assert 256) - (drip-wetness float :offset-assert 260) - (drip-time uint64 :offset-assert 264) - (drip-speed float :offset-assert 272) - (drip-height meters :offset-assert 276) - (drip-mult float :offset-assert 280) + ((flags uint32 :offset-assert 4) + (process process-drawable :offset-assert 8) + (joint-index int32 :offset-assert 12) + (top-y-offset float :offset-assert 16) + (ripple-size meters :offset-assert 20) + (enter-water-time uint64 :offset-assert 24) + (wade-time uint64 :offset-assert 32) + (on-water-time uint64 :offset-assert 40) + (enter-swim-time uint64 :offset-assert 48) + (swim-time uint64 :offset-assert 56) + (base-height meters :offset-assert 64) + (wade-height meters :offset-assert 68) + (swim-height meters :offset-assert 72) + (surface-height meters :offset-assert 76) + (bottom-height meters :offset-assert 80) + (height meters :offset-assert 84) + (height-offset float 4 :offset-assert 88) + (real-ocean-offset meters :offset 88) + (ocean-offset meters :offset 92) + (bob-offset meters :offset 96) + (align-offset meters :offset 100) + (swim-depth meters :offset-assert 104) + (bob smush-control :inline :offset-assert 112) + (volume handle :offset-assert 144) + (bottom vector 2 :inline :offset-assert 160) + (top vector 2 :inline :offset-assert 192) + (enter-water-pos vector :inline :offset-assert 224) + (drip-old-pos vector :inline :offset-assert 240) + (drip-joint-index int32 :offset-assert 256) + (drip-wetness float :offset-assert 260) + (drip-time uint64 :offset-assert 264) + (drip-speed float :offset-assert 272) + (drip-height meters :offset-assert 276) + (drip-mult float :offset-assert 280) ) :method-count-assert 17 :size-assert #x11c :flag-assert #x110000011c (:methods (new (symbol type process int float float float) _type_ 0) - (dummy-9 () none 9) + (dummy-9 (_type_) none 9) (dummy-10 (_type_) none 10) - (dummy-11 () none 11) + (start-bobbing! (_type_ float int int) none 11) (distance-from-surface (_type_) float 12) (dummy-13 (_type_ float vector int vector) none 13) (display-water-marks? (_type_) symbol 14) - (dummy-15 () none 15) - (dummy-16 () none 16) + (TODO-RENAME-15 (_type_) none 15) + (TODO-RENAME-16 (_type_) none 16) ) ) @@ -129,7 +129,7 @@ (object-new allocation type-to-make (the-as int (-> type-to-make size))) ) ) - (set! (-> v0-0 process) arg0) + (set! (-> v0-0 process) (the-as process-drawable arg0)) (set! (-> v0-0 joint-index) arg1) (set! (-> v0-0 wade-height) arg4) (set! (-> v0-0 swim-height) arg3) @@ -151,8 +151,8 @@ (wade-height meters :offset-assert 180) (swim-height meters :offset-assert 184) (bottom-height meters :offset-assert 188) - (attack-event basic :offset-assert 192) - (target uint64 :offset-assert 200) + (attack-event symbol :offset-assert 192) + (target handle :offset-assert 200) (flags uint32 :offset-assert 208) ) :heap-base #x70 @@ -163,13 +163,13 @@ (water-vol-idle () _type_ :state 20) (water-vol-startup () _type_ :state 21) (TODO-RENAME-22 (_type_) ripple-wave-set 22) - (dummy-23 () none 23) - (dummy-24 () none 24) + (reset-root! (_type_) none 23) + (set-stack-size! (_type_) none 24) (TODO-RENAME-25 (_type_) object 25) - (dummy-26 () none 26) - (dummy-27 () none 27) + (TODO-RENAME-26 (_type_) none 26) + (dummy-27 (_type_) none 27) (get-ripple-height (_type_ vector) float 28) - (dummy-29 () none 29) + (TODO-RENAME-29 (_type_) uint 29) ) ) diff --git a/goal_src/engine/gfx/water/water.gc b/goal_src/engine/gfx/water/water.gc index f960b7f3bf..20f971224f 100644 --- a/goal_src/engine/gfx/water/water.gc +++ b/goal_src/engine/gfx/water/water.gc @@ -5,3 +5,2305 @@ ;; name in dgo: water ;; dgos: GAME, ENGINE +;; DECOMP BEGINS + +(set! + (-> *part-id-table* 108) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 16 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.6) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.001) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 109) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 109) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.2) + (sp-end) + ) + ) + ) + +(defun + birth-func-y->userdata + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (+! (-> arg1 user-float) (-> arg2 vector 0 y)) + 0 + (none) + ) + +(defun + birth-func-ocean-height + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (set! + (-> arg2 vector 0 y) + (+ (ocean-get-height (the-as vector (-> arg2 vector))) (-> arg1 user-float)) + ) + 0 + (none) + ) + +(defun + check-water-level-drop + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! s5-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0) + (sound-play-by-name + (static-sound-name "water-drop") + (new-sound-id) + 1024 + 0 + 0 + 1 + (the-as symbol s5-0) + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 108) + s5-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + 0 + (none) + ) + +(defun + check-water-level-drop-and-die + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +(defun + check-water-level-above-and-die + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (>= (-> arg2 y) (-> arg1 user-float)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +(set! + (-> *part-id-table* 110) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 12.0) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-y (meters -0.05) (meters 0.1) 1.0) + (sp-rnd-flt spt-z -1024.0 2048.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.05) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 24.0 40.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 111) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 0.1) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-flt spt-y (meters 0.15)) + (sp-rnd-flt spt-z -1024.0 2048.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0) (meters 0.006666667) 1.0) + (sp-flt spt-accel-y 1.3653333) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 112) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 19 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 0.05) + (sp-rnd-flt spt-x (meters -1.0) (meters 2.0) 1.0) + (sp-rnd-flt spt-z -4096.0 8192.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.001) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.42666668) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 113) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 113) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 360) + (sp-launcher-by-id spt-next-launcher 114) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 114) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.7111111) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 115) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 19 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-rnd-flt spt-num 0.04 0.03 1.0) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-z -819.2 1638.4 1.0) + (sp-flt spt-scale-x (meters 0.5)) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.008333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.64) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 116) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 116) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 6 + (sp-flt spt-scalevel-x (meters 0.006666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 117) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 117) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-x (meters 0.005)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.32) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 118) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #xa :page #x2)) + (sp-flt spt-num 0.06) + (sp-flt spt-x (meters 10.0)) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 1.5) 1.0) + (sp-flt spt-rot-y (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.75) (meters 1.5) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters 0.01) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-flt spt-fade-a 0.7111111) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 119) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 119) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int-plain-rnd spt-next-time 90 119 1) + (sp-launcher-by-id spt-next-launcher 120) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 120) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.21333334) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 121) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 20 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-rnd-flt spt-num 0.05 0.4 1.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-z 2048.0 6144.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.7) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.003) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.42666668) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 122) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 122) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 360) + (sp-launcher-by-id spt-next-launcher 123) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 123) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.7111111) + (sp-end) + ) + ) + ) + +(set! + (-> *part-group-id-table* 40) + (new 'static 'sparticle-launch-group + :length 30 + :duration #x384 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-part-water-splash" + :launcher + (new 'static 'inline-array sparticle-group-item 30 + (sp-item 124 :flags (is-3d) :period 900 :length 63) + (sp-item 125 :period 900 :length 15) + (sp-item 126 :flags (is-3d) :period 900 :length 15) + (sp-item 127 :flags (is-3d) :period 900 :length 15) + (sp-item 128 :period 900 :length 15 :binding 129) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 130 :flags (is-3d) :period 900 :length 15 :offset 840) + (sp-item 131 :flags (is-3d) :period 900 :length 60 :offset 840) + (sp-item 132 :period 900 :length 10 :offset 840 :binding 133) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + ) + :bounds + (new 'static 'sphere :y -49152.0 :w 57344.0) + ) + ) + +(set! + (-> *part-group-id-table* 41) + (new 'static 'sparticle-launch-group + :length 16 + :duration #x384 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-part-water-splash-small" + :launcher + (new 'static 'inline-array sparticle-group-item 16 + (sp-item 124 :flags (is-3d) :period 900 :length 63) + (sp-item 125 :period 900 :length 15) + (sp-item 126 :flags (is-3d) :period 900 :length 15) + (sp-item 127 :flags (is-3d) :period 900 :length 15) + (sp-item 128 :period 900 :length 10 :binding 129) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + ) + :bounds + (new 'static 'sphere :y -49152.0 :w 57344.0) + ) + ) + +(set! + (-> *part-id-table* 129) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 18 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 0.4) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 133) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 18 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 0.4) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 131) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 0.3) + (sp-rnd-flt spt-scale-x (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0090666665) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0090666665) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 134) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 132) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 3.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters -0.002) (meters 0.004) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.018666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-z (meters -0.002) (meters 0.004) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 135) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 130) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #x10 :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.24000001) (meters 0.71999997) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.8) (meters 1.7600001) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-int spt-timer 240) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 136) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 136) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-y (meters 0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 137) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 137) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-scalevel-y (meters 0.0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 138) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 138) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-flt spt-scalevel-y (meters -0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 139) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 139) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 3 + (sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-flt spt-scalevel-y (meters -0.053333335)) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 126) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 2.4) (meters 1.6) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.4) (meters 1.6) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0037333334) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0037333334) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 134) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 134) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 360) + (sp-launcher-by-id spt-next-launcher 140) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 140) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.53333336) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 127) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 19 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-rnd-flt spt-num 0.5 1.0 1.0) + (sp-rnd-flt spt-x (meters -0.4) (meters 0.8) 1.0) + (sp-rnd-flt spt-y (meters -0.4) (meters 0.8) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.8) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.4) (meters 0.8) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0026666666) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0026666666) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 134) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 128) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 22 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 3.2) + (sp-flt spt-x (meters 0.96000004)) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 135) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 135) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 3 + (sp-flt spt-scalevel-x (meters 0.0)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 125) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 20 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 8.0) + (sp-flt spt-x (meters 0.8)) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0053333333) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00033333333)) + (sp-flt spt-scalevel-y (meters -0.00033333333)) + (sp-rnd-flt spt-accel-y -2.1845336 -0.5461334 1.0) + (sp-int spt-timer 375) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 124) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 22 + (sp-tex spt-texture (new 'static 'texture-id :index #x10 :page #x2)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 0.96000004) (meters 0.16000001) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.32000002) (meters 0.96000004) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-y (degrees 90.0)) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.16000001) (meters 1.7600001) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 48.0 24.0 1.0) + (sp-flt spt-vel-x (meters 0.0026666666)) + (sp-rnd-flt spt-scalevel-x (meters 0.0) (meters 0.0016666667) 1.0) + (sp-flt spt-rotvel-x (degrees 0.2)) + (sp-flt spt-scalevel-y (meters 0.04)) + (sp-int spt-timer 240) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 141) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 141) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 6 + (sp-flt spt-scalevel-x (meters 0.0)) + (sp-flt spt-rotvel-x (degrees 0.16666667)) + (sp-flt spt-scalevel-y (meters 0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 142) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 142) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 6 + (sp-flt spt-rotvel-x (degrees 0.13333334)) + (sp-flt spt-scalevel-y (meters 0.0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 143) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 143) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-rotvel-x (degrees 0.1)) + (sp-flt spt-scalevel-y (meters -0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 144) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 144) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 3 + (sp-flt spt-rotvel-x (degrees 0.06666667)) + (sp-flt spt-scalevel-y (meters -0.033333335)) + (sp-end) + ) + ) + ) + +(set! + (-> *part-id-table* 145) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-vel-y (meters 0.016666668)) + (sp-rnd-flt spt-vel-z (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00016666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-accel-y -2.7306666) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-int spt-next-time 225) + (sp-launcher-by-id spt-next-launcher 114) + (sp-end) + ) + ) + ) + +(defmethod dummy-9 water-control ((obj water-control)) + 0 + (none) + ) + +(defmethod dummy-10 water-control ((obj water-control)) + (with-pp + (let ((s5-0 (-> obj flags))) + (cond + ((zero? (logand (-> obj flags) 2)) + (set! (-> obj flags) (logand -97793 (-> obj flags))) + ) + ((and + (logtest? #x200000 (-> obj flags)) + (logtest? (-> obj process state-flags) 256) + ) + (set! (-> obj flags) (logior #x10000 (-> obj flags))) + ) + ((begin + (set! (-> obj top 1 quad) (-> obj top 0 quad)) + (vector<-cspace! + (the-as vector (-> obj top)) + (-> obj process node-list data (-> obj joint-index)) + ) + (+! (-> obj top 0 y) (-> obj top-y-offset)) + (set! (-> obj bottom 1 quad) (-> obj bottom 0 quad)) + (set! (-> obj bottom 0 quad) (-> obj process root trans quad)) + (set! (-> obj flags) (logand -31745 (-> obj flags))) + (set! (-> obj bob-offset) (update! (-> obj bob))) + (cond + ((and + (logtest? (-> obj flags) 256) + (zero? + (logand + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + 512 + ) + ) + ) + (set! + (-> obj real-ocean-offset) + (- + (ocean-get-height (the-as vector (-> obj bottom))) + (-> obj base-height) + ) + ) + (if (zero? (logand (-> obj flags) 512)) + (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) + (set! + (-> obj ocean-offset) + (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2) + ) + ) + ) + ((logtest? #x100000 (-> obj flags)) + (let* ((a0-26 (-> obj volume process 0)) + (f30-0 + (ripple-find-height + (the-as process-drawable a0-26) + 0 + (the-as vector (-> obj bottom)) + ) + ) + ) + (set! (-> obj real-ocean-offset) (- f30-0 (-> obj base-height))) + (if (zero? (logand (-> obj flags) 512)) + (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) + (set! + (-> obj ocean-offset) + (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2) + ) + ) + (let ((v1-36 (new 'stack-no-clear 'vector))) + (set! (-> v1-36 quad) (-> obj bottom 0 quad)) + (set! (-> v1-36 y) f30-0) + ) + ) + ) + (else + (set! (-> obj real-ocean-offset) 0.0) + (set! (-> obj ocean-offset) 0.0) + ) + ) + (if + (logtest? + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + 512 + ) + (set! (-> obj bob-offset) 0.0) + ) + (set! + (-> obj height) + (+ + (-> obj base-height) + (-> obj ocean-offset) + (-> obj bob-offset) + (-> obj align-offset) + ) + ) + (set! + (-> obj surface-height) + (+ (-> obj base-height) (-> obj real-ocean-offset)) + ) + (set! + (-> obj swim-depth) + (fmax + 0.0 + (- + (- (-> obj surface-height) (-> obj swim-height)) + (-> obj bottom 0 y) + ) + ) + ) + (>= (-> obj height) (-> obj bottom 0 y)) + ) + (if + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1024 + ) + (set! + (-> obj on-water-time) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (set! (-> obj drip-wetness) 1.0) + (set! + (-> obj drip-height) + (fmax + (- (-> obj surface-height) (-> obj bottom 0 y)) + (-> obj drip-height) + ) + ) + (set! (-> obj drip-speed) 15.0) + (if (zero? (logand (-> obj flags) 512)) + (TODO-RENAME-15 obj) + ) + (cond + ((>= (-> obj top 0 y) (-> obj height)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> obj bottom 0 quad)) + (vector-xz-length (-> obj process root transv)) + (set! (-> s4-0 y) (-> obj surface-height)) + (when + (and + (logtest? (-> obj process draw status) 8) + (zero? (-> obj process draw cur-lod)) + (logtest? #x400000 (-> obj flags)) + (logtest? #x800000 (-> obj flags)) + ) + (let ((f30-1 (y-angle (-> obj process root))) + (f28-0 (vector-xz-length (-> obj process root transv))) + ) + (set! + (-> *part-id-table* 118 init-specs 4 initial-valuef) + (+ 24576.0 f30-1) + ) + (set! + (-> *part-id-table* 118 init-specs 19 initial-valuef) + (+ 49152.0 f30-1) + ) + (set! + (-> *part-id-table* 118 init-specs 1 initial-valuef) + (* 0.0000036621095 f28-0) + ) + (set! + (-> *part-id-table* 118 init-specs 2 initial-valuef) + (* 0.1 f28-0) + ) + (set! + (-> *part-id-table* 118 init-specs 13 initial-valuef) + 0.7111111 + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 118) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! + (-> *part-id-table* 121 init-specs 1 initial-valuef) + (* 0.000004150391 f28-0) + ) + (set! (-> *part-id-table* 121 init-specs 18 initial-valuef) f30-1) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 121) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (when (< f28-0 4096.0) + (set! + (-> *part-id-table* 112 init-specs 4 random-rangef) + (-> obj ripple-size) + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 112) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 115) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ) + (if (< (-> obj top 1 y) (-> obj height)) + (dummy-13 obj 0.2 s4-0 1 (-> obj process root transv)) + ) + ) + ) + (else + (logior! (-> obj flags) 8192) + ) + ) + (when + (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (let* + ((v1-124 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (s4-1 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data v1-124) + ) + ) + ) + (set! + (-> *part-id-table* 110 init-specs 16 initial-valuef) + (-> obj surface-height) + ) + (set! + (-> *part-id-table* 110 init-specs 1 initial-valuef) + (+ + (lerp-scale + 12.0 + 0.4 + (the + float + (- + (-> *display* base-frame-counter) + (the-as int (-> obj enter-water-time)) + ) + ) + 0.0 + 600.0 + ) + (* 0.00012207031 (vector-xz-length (-> obj process root transv))) + ) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 110) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! + (-> *part-id-table* 111 init-specs 16 initial-valuef) + (-> obj surface-height) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 111) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + (let + ((f30-3 + (- + (+ + (-> obj base-height) + (-> obj ocean-offset) + (-> obj bob-offset) + (-> obj align-offset) + ) + (-> obj swim-height) + ) + ) + ) + (let* ((s4-2 (-> obj process root)) + (v1-146 + (if + (and (nonzero? s4-2) (type-type? (-> s4-2 type) control-info)) + s4-2 + ) + ) + (s4-3 + (and + v1-146 + (< + (- + (-> *display* base-frame-counter) + (-> (the-as control-info v1-146) unknown-dword11) + ) + 150 + ) + ) + ) + ) + (if + (and + (logtest? (-> obj flags) 16) + (and + s4-3 + (zero? + (logand + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1024 + ) + ) + ) + ) + (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) + ) + (cond + ((and + (logtest? (-> obj flags) 8) + (or + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1024 + ) + (>= f30-3 (-> obj bottom 0 y)) + (and + (logtest? s5-0 2048) + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 4 + ) + (zero? + (logand + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1 + ) + ) + (>= (+ 204.8 f30-3) (-> obj bottom 0 y)) + ) + ) + (or + (logtest? s5-0 2048) + (< 12288.0 (vector-xz-length (-> obj process root transv))) + (< + (+ (-> *display* base-frame-counter) -60) + (the-as int (-> obj enter-water-time)) + ) + (>= + (+ + (- + 204.8 + (fmin + 6144.0 + (+ + (-> obj ocean-offset) + (-> obj bob-offset) + (-> obj align-offset) + ) + ) + ) + f30-3 + ) + (-> obj bottom 0 y) + ) + ) + ) + (set! + (-> obj swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (send-event (-> obj process) 'swim) + (logior! (-> obj flags) 2048) + (if (zero? (logand s5-0 2048)) + (set! + (-> obj enter-swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (cond + ((and + (logtest? (-> obj flags) 16) + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 4 + ) + (zero? (logand #x10000 (-> obj flags))) + ) + (let ((v1-200 (new 'stack-no-clear 'vector))) + (set! (-> v1-200 quad) (-> obj bottom 0 quad)) + (set! (-> v1-200 y) (- (-> obj height) (-> obj swim-height))) + (let ((s4-4 (-> obj process root))) + (when + (and + (zero? + (logand (-> (the-as collide-shape-moving s4-4) status) 4096) + ) + (logtest? (-> obj flags) 2048) + (zero? + (logand + (-> + (the-as collide-shape-moving s4-4) + root-prim + prim-core + action + ) + 512 + ) + ) + ) + (let + ((a1-27 + (vector-! + (new 'stack-no-clear 'vector) + v1-200 + (-> s4-4 trans) + ) + ) + ) + (vector-float*! a1-27 a1-27 (-> *display* frames-per-second)) + (dummy-37 (the-as collide-shape-moving s4-4) a1-27) + ) + (logior! (-> (the-as collide-shape-moving s4-4) status) 1031) + ) + ) + ) + ) + ((and + (< (-> obj bottom 0 y) f30-3) + (zero? (logand #x10000 (-> obj flags))) + ) + (logior! (-> obj flags) 4096) + ) + ) + ) + ((begin + (set! + s4-3 + (and + (logtest? (-> obj flags) 4) + (or + (not (!= (-> obj bob amp) 0.0)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> obj swim-time)) + ) + 15 + ) + ) + (and + (>= (- (-> obj height) (-> obj wade-height)) (-> obj bottom 0 y)) + s4-3 + ) + ) + ) + s4-3 + ) + (set! + (-> obj wade-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (send-event (-> obj process) 'wade) + (logior! (-> obj flags) 1024) + ) + ) + ) + (when + (and + (logtest? (-> obj flags) 8) + (< (-> obj bottom 1 y) f30-3) + (and (< f30-3 (-> obj bottom 0 y)) (logtest? s5-0 4096)) + ) + (logior! (-> obj flags) 2048) + (let ((a1-30 (new 'stack-no-clear 'vector))) + (set! (-> a1-30 quad) (-> obj bottom 0 quad)) + (let ((s5-1 (-> obj process root))) + (set! (-> a1-30 y) f30-3) + (when + (zero? + (logand + (-> (the-as collide-shape-moving s5-1) root-prim prim-core action) + 512 + ) + ) + (let + ((f30-4 (-> (the-as collide-shape-moving s5-1) ground-impact-vel))) + (TODO-RENAME-61 + (the-as collide-shape-moving s5-1) + a1-30 + (-> s5-1 transv) + *up-vector* + ) + (logior! (-> (the-as collide-shape-moving s5-1) status) 1024) + (set! + (-> (the-as collide-shape-moving s5-1) ground-impact-vel) + f30-4 + ) + ) + ) + ) + ) + ) + ) + (when + (and (logtest? #x20000 (-> obj flags)) (= (-> obj process type) target)) + (when + (and + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1025 + ) + (zero? + (logand + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + 512 + ) + ) + ) + (when (< (-> obj process root trans y) -409.6) + (send-event (-> obj process) 'no-look-around 450) + (when + (zero? + (logand + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + #x4000 + ) + ) + (cond + ((= (-> obj process type) target) + (let ((a1-32 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-32 from) pp) + (set! (-> a1-32 num-params) 2) + (set! (-> a1-32 message) 'attack) + (set! (-> a1-32 param 0) (the-as uint #f)) + (let ((v1-275 (new 'static 'attack-info :mask #xe0))) + (set! (-> v1-275 shove-up) 2048.0) + (set! (-> v1-275 shove-back) 0.0) + (set! (-> v1-275 mode) 'tar) + (set! (-> a1-32 param 1) (the-as uint v1-275)) + ) + (send-event-function (-> obj process) a1-32) + ) + ) + (else + (let ((a1-33 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-33 from) pp) + (set! (-> a1-33 num-params) 4) + (set! (-> a1-33 message) 'attack) + (set! (-> a1-33 param 0) (the-as uint #f)) + (set! (-> a1-33 param 1) (the-as uint 'tar)) + (let ((v1-281 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-281) + (set! (-> a1-33 param 2) (the-as uint v1-281)) + ) + (set! (-> a1-33 param 3) (the-as uint 0)) + (send-event-function (-> obj process) a1-33) + ) + ) + ) + ) + (let ((v1-283 (-> obj process))) + (set! + (-> (the-as collide-shape-moving (-> v1-283 root)) surf) + *tar-surface* + ) + (set! + (-> + (the-as collide-shape-moving (-> v1-283 root)) + ground-pat + material + ) + 4 + ) + ) + ) + (set! (-> obj swim-height) (lerp (-> obj swim-height) 7372.8 0.05)) + ) + ) + ) + (else + (if (logtest? (-> obj flags) 512) + (TODO-RENAME-16 obj) + ) + ) + ) + ) + (when + (not + (or + (zero? (logand (-> obj flags) 64)) + (zero? (logand #x800000 (-> obj flags))) + (= (-> obj drip-wetness) 0.0) + ) + ) + (cond + ((logtest? (-> obj flags) #x8000) + (let + ((a2-15 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data (-> obj drip-joint-index)) + ) + ) + ) + (set! + (-> *part-id-table* 145 init-specs 16 initial-valuef) + (fmax (-> obj surface-height) (-> obj bottom 0 y)) + ) + (set! + (-> *part-id-table* 145 init-specs 8 initial-valuef) + (* 0.05 (- (-> a2-15 x) (-> obj drip-old-pos x))) + ) + (set! + (-> *part-id-table* 145 init-specs 9 initial-valuef) + (* 0.05 (- (-> a2-15 y) (-> obj drip-old-pos y))) + ) + (set! + (-> *part-id-table* 145 init-specs 10 initial-valuef) + (* 0.05 (- (-> a2-15 z) (-> obj drip-old-pos z))) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 145) + a2-15 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + (set! (-> obj drip-time) (the-as uint (-> *display* base-frame-counter))) + (set! (-> obj flags) (logand -32769 (-> obj flags))) + (set! + (-> obj drip-wetness) + (seek (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) + ) + (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) + (if (= (-> obj drip-wetness) 0.0) + (set! (-> obj drip-height) 0.0) + ) + ) + ((>= + (- + (-> *display* base-frame-counter) + (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult))) + ) + (the int (-> obj drip-speed)) + ) + (let* + ((s5-2 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (v1-328 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-2) + ) + ) + ) + (when + (and + (< + (- (-> v1-328 y) (-> obj process root trans y)) + (-> obj drip-height) + ) + (< (-> obj height) (-> v1-328 y)) + ) + (set! (-> obj drip-joint-index) s5-2) + (set! (-> obj drip-old-pos quad) (-> v1-328 quad)) + (logior! (-> obj flags) #x8000) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod + start-bobbing! + water-control + ((obj water-control) (arg0 float) (arg1 int) (arg2 int)) + (activate! (-> obj bob) (- arg0) arg1 arg2 0.9 1.0) + 0 + (none) + ) + +(defun part-water-splash-callback ((arg0 part-tracker)) + (let ((f1-0 (-> arg0 root trans y)) + (f0-0 (the-as float (-> arg0 userdata))) + ) + (set! (-> *part-id-table* 128 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 132 init-specs 18 initial-valuef) f1-0) + (set! (-> *part-id-table* 125 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 129 init-specs 15 initial-valuef) f1-0) + (set! (-> *part-id-table* 133 init-specs 15 initial-valuef) f1-0) + (set! + (-> *part-id-table* 129 init-specs 12 initial-valuef) + (* 13.653334 (* -0.15 f0-0)) + ) + (set! + (-> *part-id-table* 129 init-specs 12 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 133 init-specs 12 initial-valuef) + (* 13.653334 (* -0.15 f0-0)) + ) + (set! + (-> *part-id-table* 133 init-specs 12 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 2 initial-valuef) + (* 4096.0 (* 0.1 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 2 random-rangef) + (* 4096.0 (* 0.4 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 4 initial-valuef) + (* 4096.0 (* 0.1 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 4 random-rangef) + (* 4096.0 (* 0.4 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 9 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 9 random-rangef) + (* 13.653334 (* 3.4 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 10 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 10 random-rangef) + (* 13.653334 (* 3.4 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 2 initial-valuef) + (* 4096.0 (* 3.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 2 random-rangef) + (* 4096.0 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 4 initial-valuef) + (* 4096.0 (* 3.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 4 random-rangef) + (* 4096.0 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 9 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 9 random-rangef) + (* 13.653334 (* 1.4 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 10 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 10 random-rangef) + (* 13.653334 (* 1.4 f0-0)) + ) + (set! + (-> *part-id-table* 127 init-specs 2 initial-valuef) + (* 4096.0 (* -0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 2 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 3 initial-valuef) + (* 4096.0 (* -0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 3 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 4 initial-valuef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 4 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 6 initial-valuef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 6 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 11 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 127 init-specs 11 random-rangef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 127 init-specs 12 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 127 init-specs 12 random-rangef) + (* 13.653334 f0-0) + ) + (set! (-> *part-id-table* 132 init-specs 1 initial-valuef) (* 4.0 f0-0)) + (set! + (-> *part-id-table* 132 init-specs 2 initial-valuef) + (* 4096.0 (* -0.25 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 2 random-rangef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 3 initial-valuef) + (* 4096.0 (* -0.25 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 3 random-rangef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 10 initial-valuef) + (* 13.653334 (* -0.75 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 10 random-rangef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 12 initial-valuef) + (* 13.653334 (* -0.75 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 12 random-rangef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 11 initial-valuef) + (* 13.653334 (* 7.0 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 11 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 15 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 15 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! (-> *part-id-table* 128 init-specs 1 initial-valuef) (* 4.0 f0-0)) + (set! (-> *part-id-table* 128 init-specs 2 initial-valuef) (* 1.2 f0-0)) + (set! + (-> *part-id-table* 128 init-specs 9 initial-valuef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 128 init-specs 9 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 initial-valuef) + (* 13.653334 (* 6.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 9 initial-valuef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 128 init-specs 9 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 initial-valuef) + (* 13.653334 (* 6.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! (-> *part-id-table* 125 init-specs 1 initial-valuef) (* 8.0 f0-0)) + (set! (-> *part-id-table* 125 init-specs 2 initial-valuef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 125 init-specs 9 initial-valuef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 125 init-specs 9 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 10 initial-valuef) + (* 13.653334 (* 6.0 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 10 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 13 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 13 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 2 initial-valuef) + (* 4096.0 (* 1.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 2 random-rangef) + (* 4096.0 (* 0.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 3 initial-valuef) + (* 4096.0 (* 0.4 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 3 random-rangef) + (* 4096.0 (* 1.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 7 initial-valuef) + (* 4096.0 (* 0.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 7 random-rangef) + (* 4096.0 (* 2.2 f0-0)) + ) + (set! + (-> *part-id-table* 130 init-specs 2 initial-valuef) + (* 4096.0 (* 0.3 f0-0)) + ) + (set! + (-> *part-id-table* 130 init-specs 2 random-rangef) + (* 4096.0 (* 0.9 f0-0)) + ) + (set! (-> *part-id-table* 130 init-specs 6 initial-valuef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 130 init-specs 6 random-rangef) + (* 4096.0 (* 2.2 f0-0)) + ) + ) + 0 + (none) + ) + +(defmethod TODO-RENAME-15 water-control ((obj water-control)) + (with-pp + (logior! (-> obj flags) 512) + (set! (-> obj flags) (logand -65537 (-> obj flags))) + (set! + (-> obj enter-water-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set-vector! + (-> obj enter-water-pos) + (-> obj bottom 0 x) + (-> obj surface-height) + (-> obj bottom 0 z) + 1.0 + ) + (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) pp) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'ground-height)) + (let* ((f0-4 (the-as float (send-event-function (-> obj process) a1-1))) + (f30-0 (lerp-scale 0.3 1.0 f0-4 2048.0 24576.0)) + ) + (if (nonzero? (-> obj process skel effect)) + (dummy-10 (-> obj process skel effect) 'swim-stroke 0.0 -1) + ) + (dummy-13 + obj + f30-0 + (-> obj enter-water-pos) + 1 + (-> obj process root transv) + ) + ) + ) + ) + (if (logtest? #x20000 (-> obj flags)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + ) + +(defmethod TODO-RENAME-16 water-control ((obj water-control)) + (set! (-> obj flags) (logand -513 (-> obj flags))) + (set-zero! (-> obj bob)) + (if (logtest? #x20000 (-> obj flags)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + +(defun splash-spawn ((arg0 basic) (arg1 basic) (arg2 int)) + (let ((s4-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker s4-0) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s4-0 part-tracker-init (if (zero? arg2) + (-> *part-group-id-table* 41) + (-> *part-group-id-table* 40) + ) + -1 + part-water-splash-callback + arg0 + #f + arg1 + ) + (-> s4-0 ppointer) + ) + ) + 0 + (none) + ) + +(defmethod + dummy-13 + water-control + ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector)) + (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (let ((a1-3 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) + (set! (-> a1-3 y) (-> obj surface-height)) + (splash-spawn (the-as basic arg0) (the-as basic a1-3) arg2) + ) + ) + 0 + (none) + ) + +(defmethod dummy-27 water-vol ((obj water-vol)) + (when (handle->process (-> obj target)) + (let ((v1-7 (-> (the-as target (-> obj target process 0)) water))) + (set! (-> v1-7 flags) (logand -129892623 (-> v1-7 flags))) + (set! (-> v1-7 volume) (the-as handle #f)) + ) + (set! (-> obj target) (the-as handle #f)) + (iterate-process-tree *entity-pool* (lambda ((arg0 water-vol)) + (with-pp + (if + (and + (type-type? (-> arg0 type) water-vol) + (!= arg0 pp) + ) + (send-event arg0 'update) + ) + ) + ) + *null-kernel-context* + ) + (process-entity-status! obj (entity-perm-status bit-3) #f) + ) + 0 + (none) + ) + +(defmethod TODO-RENAME-26 water-vol ((obj water-vol)) + (with-pp + (cond + ((handle->process (-> obj target)) + (cond + ((not + (dummy-10 + (-> obj vol) + (-> (the-as target (-> obj target process 0)) control trans) + ) + ) + (dummy-27 obj) + ) + (else + (let ((v1-15 (-> (the-as target (-> obj target process 0)) water))) + (when + (and + (logtest? #x80000 (-> obj flags)) + (logtest? (-> v1-15 flags) 512) + (>= (-> v1-15 surface-height) (-> v1-15 bottom 0 y)) + ) + (let ((v1-18 (-> obj attack-event))) + (case v1-18 + ((#f) + ) + (('heat) + (send-event + (handle->process (-> obj target)) + 'heat + (* 10.0 (-> *display* seconds-per-frame)) + ) + ) + (('drown-death 'lava 'dark-eco-pool) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) pp) + (set! (-> a1-8 num-params) 2) + (set! (-> a1-8 message) 'attack-invinc) + (set! (-> a1-8 param 0) (the-as uint #f)) + (let ((a0-19 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-19 mode) v1-18) + (set! (-> a1-8 param 1) (the-as uint a0-19)) + ) + (if (send-event-function (handle->process (-> obj target)) a1-8) + (send-event obj 'notify 'attack) + ) + ) + ) + (else + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) pp) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((a0-27 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-27 mode) v1-18) + (set! (-> a1-10 param 1) (the-as uint a0-27)) + ) + (if (send-event-function (handle->process (-> obj target)) a1-10) + (send-event obj 'notify 'attack) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ((and + *target* + (and + (not (handle->process (-> *target* water volume))) + (dummy-10 (-> obj vol) (-> *target* control trans)) + ) + ) + (let ((s5-0 (-> *target* water))) + (process-entity-status! obj (entity-perm-status bit-3) #t) + (set! (-> s5-0 volume) (process->handle obj)) + (set! (-> obj target) (process->handle *target*)) + (logior! (-> s5-0 flags) 2) + (set! (-> s5-0 base-height) (-> obj water-height)) + (set! (-> s5-0 ocean-offset) 0.0) + (logior! (-> s5-0 flags) (-> obj flags)) + (if (< 0.0 (-> obj wade-height)) + (set! (-> s5-0 wade-height) (-> obj wade-height)) + ) + (if (< 0.0 (-> obj swim-height)) + (set! (-> s5-0 swim-height) (-> obj swim-height)) + ) + (if (< 0.0 (-> obj bottom-height)) + (set! (-> s5-0 bottom-height) (-> obj bottom-height)) + ) + (set-zero! (-> s5-0 bob)) + ) + ) + ) + 0 + (none) + ) + ) + +(defstate water-vol-startup (water-vol) + :virtual #t + :code + (behavior () + (go-virtual water-vol-idle) + (none) + ) + ) + +(defstate water-vol-idle (water-vol) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'update) + (TODO-RENAME-26 self) + ) + ) + ) + ) + :exit + (behavior () + (dummy-27 self) + (none) + ) + :trans + (behavior () + (TODO-RENAME-26 self) + (none) + ) + :code + (the-as (function none :behavior water-vol) anim-loop) + ) + +(defmethod set-stack-size! water-vol ((obj water-vol)) + (stack-size-set! (-> obj main-thread) 128) + (none) + ) + +(defmethod reset-root! water-vol ((obj water-vol)) + (set! (-> obj root) (new 'process 'trsqv)) + (none) + ) + +(defmethod TODO-RENAME-25 water-vol ((obj water-vol)) + (the-as object 0) + ) + +;; WARN: disable def twice: 85. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod TODO-RENAME-29 water-vol ((obj water-vol)) + (local-vars (sv-16 res-tag)) + (set! + (-> obj attack-event) + (the-as + symbol + ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + 'drown + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (process-drawable-from-entity! obj (the-as entity-actor (-> obj entity))) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj vol) (new 'process 'vol-control obj)) + (logior! (-> obj vol flags) 3) + (set! (-> obj bottom-height) 32768.0) + (set! (-> obj target) (the-as handle #f)) + (set! sv-16 (new 'static 'res-tag)) + (let + ((v1-8 + (the-as + (pointer float) + ((method-of-type res-lump get-property-data) + (-> obj entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (when v1-8 + (set! (-> obj water-height) (-> v1-8 0)) + (set! (-> obj wade-height) (-> v1-8 1)) + (set! (-> obj swim-height) (-> v1-8 2)) + (if (>= (-> sv-16 elt-count) (the-as uint 4)) + (set! (-> obj flags) (the-as uint (the int (-> v1-8 3)))) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 5)) + (set! (-> obj bottom-height) (-> v1-8 4)) + ) + ) + ) + (set! (-> obj flags) (logior #x800000 (-> obj flags))) + (cond + ((zero? (-> obj flags)) + (if (< 0.0 (-> obj wade-height)) + (logior! (-> obj flags) 4) + ) + (when (< 0.0 (-> obj swim-height)) + (let ((v0-4 (logior (-> obj flags) 8))) + (set! (-> obj flags) v0-4) + v0-4 + ) + ) + ) + (else + (the-as uint #f) + ) + ) + ) + +(defmethod TODO-RENAME-22 water-vol ((obj water-vol)) + (the-as ripple-wave-set 0) + ) + +(defbehavior water-vol-init-by-other water-vol ((arg0 entity)) + (set! (-> self entity) arg0) + (set-stack-size! self) + (reset-root! self) + (TODO-RENAME-29 self) + (TODO-RENAME-25 self) + (TODO-RENAME-22 self) + (go-virtual water-vol-startup) + (none) + ) + +(defmethod init-from-entity! water-vol ((obj water-vol) (arg0 entity-actor)) + (set-stack-size! obj) + (reset-root! obj) + (TODO-RENAME-29 obj) + (TODO-RENAME-25 obj) + (TODO-RENAME-22 obj) + (go (method-of-object obj water-vol-startup)) + (none) + ) + + + + diff --git a/goal_src/engine/nav/navigate-h.gc b/goal_src/engine/nav/navigate-h.gc index df7cec3a92..efcfdcd146 100644 --- a/goal_src/engine/nav/navigate-h.gc +++ b/goal_src/engine/nav/navigate-h.gc @@ -18,6 +18,7 @@ (bit7 7) ;; TODO - nav-enemy::45 (bit8 8) (bit10 10) ;; TODO - nav-enemy::nav-enemy-patrol-post + (bit12 12) ;; TODO - rolling-lightning-mole::(enter nav-enemy-chase fleeing-nav-enemy) (bit13 13) (bit17 17) (bit19 19) ;; TODO - nav-enemy::lambda::17 diff --git a/goal_src/engine/target/logic-target.gc b/goal_src/engine/target/logic-target.gc index cf744e2c6f..ab1df0ea0c 100644 --- a/goal_src/engine/target/logic-target.gc +++ b/goal_src/engine/target/logic-target.gc @@ -367,20 +367,20 @@ (let ((s4-2 format) (s3-2 arg1) (s2-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%") - (s1-2 (-> arg0 control unknown-int50)) + (s1-2 (-> arg0 control unknown-int60)) (s0-2 (pat-mode->string - (the-as pat-surface (-> arg0 control unknown-int50)) + (the-as pat-surface (-> arg0 control unknown-int60)) ) ) ) (set! sv-96 - (pat-material->string (the-as pat-surface (-> arg0 control unknown-int50))) + (pat-material->string (the-as pat-surface (-> arg0 control unknown-int60))) ) (let ((t1-2 - (pat-event->string (the-as pat-surface (-> arg0 control unknown-int50))) + (pat-event->string (the-as pat-surface (-> arg0 control unknown-int60))) ) ) (s4-2 s3-2 s2-2 s1-2 s0-2 sv-96 t1-2) @@ -1051,13 +1051,13 @@ ) ) (set! - (-> self control unknown-dword60) + (-> self control unknown-dword70) (-> *display* base-frame-counter) ) ) (if (< - (- (-> *display* base-frame-counter) (-> self control unknown-dword60)) + (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) 60 ) (set! f30-4 (+ 204800.0 f30-4)) @@ -1231,7 +1231,7 @@ 150 ) (logtest? (-> self control unknown-surface01 flags) 16) - (!= (-> self control unknown-float40) 0.0) + (!= (-> self control unknown-float41) 0.0) ) (zero? (logand (-> self control unknown-surface01 flags) 32)) ) @@ -1619,7 +1619,7 @@ (if (< (logand - (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) + (- (-> *display* base-frame-counter) (-> self control unknown-dword80)) 3 ) 1 @@ -1629,8 +1629,8 @@ ) (if (>= - (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) - (-> self control unknown-dword71) + (- (-> *display* base-frame-counter) (-> self control unknown-dword80)) + (-> self control unknown-dword81) ) (target-timed-invulnerable-off self) ) @@ -1982,12 +1982,12 @@ (cond ((and (< 2457.6 (vector-length s4-2)) - (not (-> self control unknown-int20)) + (not (-> self control unknown-int21)) ) (TODO-RENAME-28 (-> self control) (vector-normalize! s4-2 2457.6)) ) (else - (set! (-> self control unknown-int20) (the-as int #t)) + (set! (-> self control unknown-int21) (the-as int #t)) (TODO-RENAME-30 (-> self control) (vector-! @@ -2218,7 +2218,7 @@ (target-calc-camera-pos) (when (logtest? (-> self state-flags) #x4000) (set! (-> self state-flags) (logand -28673 (-> self state-flags))) - (set! (-> self control unknown-float40) 0.0) + (set! (-> self control unknown-float41) 0.0) ) (set! (-> self control unknown-int00) 0) 0 @@ -2231,9 +2231,9 @@ (countdown (s5-0 gp-0) (set! (-> self control unknown-int40) s5-0) (flag-setup) - (if (< (-> self control unknown-float40) 0.0) + (if (< (-> self control unknown-float41) 0.0) (set! - (-> self control unknown-float40) + (-> self control unknown-float41) (- 1.0 (-> self control unknown-cpad-info00 stick0-speed)) ) ) @@ -2257,9 +2257,9 @@ ) (set! f30-0 0.0) ) - (when (!= (-> self control unknown-float40) 0.0) - (let ((f0-12 (fmin 1.0 (-> self control unknown-float40)))) - (set! (-> self control unknown-float40) f0-12) + (when (!= (-> self control unknown-float41) 0.0) + (let ((f0-12 (fmin 1.0 (-> self control unknown-float41)))) + (set! (-> self control unknown-float41) f0-12) (let ((a1-2 (vector-float*! (new 'stack-no-clear 'vector) (if (= f30-0 0.0) *zero-vector* @@ -2649,7 +2649,7 @@ (set! (-> self cam-user-mode) 'normal) (set! (-> self control unknown-handle10) (the-as handle #f)) (set! (-> self control unknown-handle00) (the-as handle #f)) - (set! (-> self control unknown-dword72) 0) + (set! (-> self control unknown-dword82) 0) (buzz-stop! 0) self ) @@ -2775,7 +2775,7 @@ (add-connection *debug-engine* self target-print-stats self *stdcon0* #f) ) (activate-hud self) - (set! (-> self fp-hud) (the-as uint #f)) + (set! (-> self fp-hud) (the-as handle #f)) (set! (-> self water) (new 'process 'water-control self 9 0.0 8192.0 2048.0)) (set! (-> self water flags) (the-as uint #x4000f0)) (reset-target-state #t) diff --git a/goal_src/engine/target/sidekick.gc b/goal_src/engine/target/sidekick.gc index 263c269ad0..f6879c6839 100644 --- a/goal_src/engine/target/sidekick.gc +++ b/goal_src/engine/target/sidekick.gc @@ -5,3 +5,335 @@ ;; name in dgo: sidekick ;; dgos: GAME, ENGINE +(define-extern *sidekick-sg* skeleton-group) +(define-extern sidekick-clone (state sidekick)) + +;; DECOMP BEGINS + +(define + *sidekick-remap* + '( + ("run-to-stance-left" + "run-to-stance" + ) + ("run-to-stance-loop-left" + "run-to-stance-loop" + ) + ("stance-loop-left" + "stance-loop" + ) + ("run-to-stance-right" + "run-to-stance" + ) + ("run-to-stance-loop-right" + "run-to-stance-loop" + ) + ("stance-loop-right" + "stance-loop" + ) + ("run-to-stance-up" + "run-to-stance" + ) + ("run-to-stance-loop-up" + "run-to-stance-loop" + ) + ("stance-loop-up" + "stance-loop" + ) + ("run-to-stance-down" + "run-to-stance" + ) + ("run-to-stance-loop-down" + "run-to-stance-loop" + ) + ("stance-loop-down" + "stance-loop" + ) + ("run-right" + "run" + ) + ("run-left" + "run" + ) + ("walk-right" + "walk" + ) + ("walk-left" + "walk" + ) + ("edge-grab-stance1" + "edge-grab-stance1" + "edge-grab-stance1-alt" + ) + ("pole-cycle" "pole-cycle" "pole-cycle2") + ) + ) + +(defun cspace<-cspace+quaternion! ((arg0 cspace) (arg1 cspace) (arg2 quaternion)) + (rlet ((Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> arg0 bone transform))) + (quaternion->matrix s5-0 arg2) + (.lvf vf1 (&-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (.lvf vf2 (&-> (-> arg1 bone) transform vector 3 quad)) + (.lvf vf3 (&-> s5-0 vector 0 quad)) + (.lvf vf4 (&-> s5-0 vector 1 quad)) + (.lvf vf5 (&-> s5-0 vector 2 quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.mov.vf vf2 vf0 :mask #b1000) + (.mul.x.vf vf3 vf3 vf1) + (.mul.y.vf vf4 vf4 vf1) + (.mul.z.vf vf5 vf5 vf1) + (.svf (&-> s5-0 vector 3 quad) vf2) + (.svf (&-> s5-0 vector 0 quad) vf3) + (.svf (&-> s5-0 vector 1 quad) vf4) + (.svf (&-> s5-0 vector 2 quad) vf5) + s5-0 + ) + ) + ) + +(defstate sidekick-clone (sidekick) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('matrix) + (case (-> arg3 param 0) + (('play-anim) + (set! v0-0 (-> self node-list data)) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param0) + cspace<-cspace+quaternion! + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data)) + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param2) + (the-as basic (-> self parent-override 0 control quat)) + ) + ) + (('copy-parent) + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-cspace!) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) #f) + ) + (else + (set! v0-0 (-> self node-list data)) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param0) + cspace<-cspace+quaternion! + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as + basic + (-> self parent-override 0 control unknown-cspace10 parent) + ) + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param2) + (the-as basic (-> self parent-override 0 control quat)) + ) + ) + ) + v0-0 + ) + (('shadow) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self shadow-in-movie?) (the-as symbol v0-0)) + v0-0 + ) + (('blend-shape) + (cond + ((-> arg3 param 0) + (set! v0-0 (logior (-> self skel status) 8)) + (set! (-> self skel status) (the-as uint v0-0)) + ) + (else + (set! v0-0 (logand -9 (-> self skel status))) + (set! (-> self skel status) (the-as uint v0-0)) + ) + ) + v0-0 + ) + ) + ) + :code + (the-as (function none :behavior sidekick) looping-code) + :post + (behavior () + (let ((v1-0 'process-drawable-art-error) + (a0-0 (-> self parent-override)) + ) + (when (!= (-> (if a0-0 + (-> a0-0 0 self-override) + ) + next-state + name + ) + v1-0 + ) + (quaternion-copy! + (-> self root quat) + (-> self parent-override 0 control quat) + ) + (set! (-> self anim-seed) (-> self parent-override 0 anim-seed)) + (set! (-> self draw status) (-> self parent-override 0 draw status)) + (joint-control-copy! (-> self skel) (-> self parent-override 0 skel)) + (joint-control-remap! + (-> self skel) + (-> self draw art-group) + (-> self parent-override 0 draw art-group) + *sidekick-remap* + (the-as int (-> self anim-seed)) + "" + ) + (let ((v1-22 (-> self parent-override 0 draw color-mult quad))) + (set! (-> self draw color-mult quad) v1-22) + ) + (let ((v1-26 (-> self parent-override 0 draw color-emissive quad))) + (set! (-> self draw color-emissive quad) v1-26) + ) + (set! + (-> self draw secondary-interp) + (-> self parent-override 0 draw secondary-interp) + ) + (if *debug-segment* + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'draw + (new 'static 'rgba :r #x40 :b #x40 :a #x80) + ) + ) + (dummy-17 self) + (if *debug-segment* + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'draw + (new 'static 'rgba :r #x80 :a #x80) + ) + ) + (vector<-cspace! + (-> self draw origin) + (-> self node-list data (-> self draw origin-joint-index)) + ) + ) + ) + (when *display-sidekick-stats* + (format *stdcon* "~%") + (dummy-10 (-> self skel) (the-as symbol *stdcon*)) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-draw1) + (-> + self + parent-override + 0 + control + unknown-cspace10 + parent + bone + transform + vector + 3 + ) + 409.6 + (new 'static 'rgba :g #xff :a #x80) + ) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-draw1) + (-> self node-list data 3 bone transform vector 3) + 409.6 + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-draw1) + (-> self draw origin) + 409.6 + (new 'static 'rgba :r #xff :g #x80 :a #x80) + ) + ) + (set! + (-> self draw shadow) + (the-as shadow-geo (if (and (movie?) (-> self shadow-in-movie?)) + (-> self draw art-group data 2) + ) + ) + ) + (let ((a0-26 (-> self skel effect))) + (if a0-26 + (TODO-RENAME-9 a0-26) + ) + ) + (if (logtest? (-> self skel status) 72) + (merc-blend-shape self) + ) + (if (logtest? (-> self skel status) 384) + (merc-eye-anim self) + ) + (none) + ) + ) + +(defskelgroup *sidekick-sg* sidekick + 0 + -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 1) + :shadow 2 + :texture-level 2 + :sort 1 + ) + +(defbehavior init-sidekick sidekick () + (logior! (-> self mask) (process-mask sidekick)) + (set! (-> self root) (new 'process 'trsqv)) + (vector-identity! (-> self root scale)) + (quaternion-identity! (-> self root quat)) + (initialize-skeleton self *sidekick-sg* '()) + (set! (-> self draw origin-joint-index) (the-as uint 6)) + (set! (-> self draw shadow-joint-index) (the-as uint 6)) + (set! (-> self draw shadow-ctrl) *target-shadow-control*) + (logior! (-> self skel status) 256) + (let ((v1-14 (-> self node-list data))) + (set! (-> v1-14 0 param0) cspace<-cspace+quaternion!) + (set! + (-> v1-14 0 param1) + (the-as basic (-> self parent-override 0 control unknown-cspace10 parent)) + ) + (set! + (-> v1-14 0 param2) + (the-as basic (-> self parent-override 0 control quat)) + ) + ) + (set! (-> self shadow-in-movie?) #t) + (go sidekick-clone) + (none) + ) + +(defun starts () + (send-event *target* 'sidekick #t) + ) + + + + diff --git a/goal_src/engine/target/target-h.gc b/goal_src/engine/target/target-h.gc index 7e5e4c3854..39901bf6d1 100644 --- a/goal_src/engine/target/target-h.gc +++ b/goal_src/engine/target/target-h.gc @@ -11,35 +11,47 @@ (defun-extern start symbol continue-point target) ;; TODO - for mood (define-extern target-joint-pos (function vector)) ;; TODO - unconfirmed -;; TODO - for target-util -(define-extern target-falling (state symbol none)) -(define-extern target-slide-down (state none)) ;; TODO - for logic-target - defined in shadow (define-extern do-target-shadow (function none :behavior target)) ;; TODO - for logic-target - defined in powerups (define-extern target-powerup-process (function none :behavior target)) ;; TODO - for logic-target - defined in target-handler -(define-extern target-exit (function none)) -(define-extern target-generic-event-handler (function process int symbol event-message-block object)) +(define-extern target-exit (function none :behavior target)) +(define-extern target-generic-event-handler (function process int symbol event-message-block object :behavior target)) ;; TODO - for logic-target - defined in sidekick -(define-extern init-sidekick (function none)) ;; TODO - not finished +(declare-type sidekick process-drawable) +(define-extern init-sidekick (function none :behavior sidekick)) ;; TODO - for logic-target - defined in target-death -(define-extern target-continue (state continue-point none)) -(define-extern target-periscope (state target)) +(define-extern target-continue (state continue-point target)) +(define-extern target-periscope (state handle target)) ;; unknown type (define-extern mod-var-jump (function symbol symbol symbol vector vector :behavior target)) (define-extern init-var-jump (function float float vector vector vector vector :behavior target)) ;; 1st and 2nd vectors may be symbols instead? -(define-extern target-standard-event-handler function) +;; TODO - for target-util +(define-extern target-falling (state symbol target)) +(define-extern target-slide-down (state target)) +;; TODO - for target-tube +(define-extern target-attacked (function symbol attack-info process process (state handle attack-info target) object :behavior target)) ;; unconfirmed, target-tube::(event target-tube-start) +;; TODO - for racer-states +(define-extern racer-collision-reaction (function control-info collide-shape-intersect vector vector none)) +;; TODO -for target2 +(define-extern target-falling-anim-trans (function none :behavior target)) ;; unconfirmed -(declare-type sidekick basic) (declare-type collide-cache basic) (declare-type snowball-info basic) (declare-type tube-info basic) (declare-type racer-info basic) +(declare-type flut-info basic) +(declare-type target process-drawable) +(defun-extern start symbol continue-point target) + +;; NOTE - for logic-target - defined in sidekick +(declare-type sidekick process-drawable) ;; DECOMP BEGINS (deftype target (process-drawable) - ((control control-info :offset 112) + ((self-override target :offset 28) + (control control-info :offset 112) (fact-info-target fact-info-target :offset 144) (skel2 basic :offset-assert 176) (racer racer-info :offset-assert 180) @@ -56,12 +68,12 @@ (alt-cam-pos vector :inline :offset-assert 448) (snowball snowball-info :offset-assert 464) (tube tube-info :offset-assert 468) - (flut basic :offset-assert 472) + (flut flut-info :offset-assert 472) (current-level level :offset-assert 476) (saved-pos transformq :inline :offset-assert 480) (saved-owner uint64 :offset-assert 528) (alt-neck-pos vector :inline :offset-assert 544) - (fp-hud uint64 :offset-assert 560) + (fp-hud handle :offset-assert 560) (no-load-wait uint64 :offset-assert 568) (no-look-around-wait uint64 :offset-assert 576) ) @@ -73,8 +85,8 @@ (dummy-20 (_type_ collide-cache) object 20) ) (:states - target-clone-anim - target-death + (target-clone-anim handle) + (target-death symbol) (target-hit-ground symbol) (target-racing-bounce float float symbol) (target-racing-clone-anim handle) @@ -94,9 +106,10 @@ (define-perm *target* target #f) (deftype sidekick (process-drawable) - ((control control-info :offset 112) - (anim-seed uint64 :offset 192) - (shadow-in-movie? symbol :offset-assert 200) + ((parent-override (pointer target) :offset 12) + (control control-info :offset 112) + (anim-seed uint64 :offset 192) + (shadow-in-movie? symbol :offset-assert 200) ) :heap-base #x60 :method-count-assert 20 @@ -106,4 +119,9 @@ (define-perm *sidekick* sidekick #f) -(define-extern target-attacked (function symbol uint uint process (state target) object :behavior target)) ;; unconfirmed, target-tube::(event target-tube-start) + +0 + + + + diff --git a/goal_src/engine/target/target-util.gc b/goal_src/engine/target/target-util.gc index bdc3b1d6f3..3b6680dd2b 100644 --- a/goal_src/engine/target/target-util.gc +++ b/goal_src/engine/target/target-util.gc @@ -870,7 +870,7 @@ (- (-> self control trans y) (-> self control shadow-pos y)) ) -(defbehavior fall-test target ((arg0 symbol) (arg1 symbol)) +(defbehavior fall-test target () (when (and (zero? (logand (-> self control status) 1)) @@ -918,9 +918,10 @@ ) (go target-falling #f) ) + (none) ) -(defbehavior slide-down-test target ((arg0 symbol) (arg1 symbol)) +(defbehavior slide-down-test target () (if (and (zero? (logand (-> self control status) 129)) @@ -933,6 +934,7 @@ ) (go target-slide-down) ) + (none) ) (defbehavior smack-surface? target ((arg0 symbol)) @@ -1066,13 +1068,13 @@ ) ) ) - (-> self control unknown-dword30) + (-> self control unknown-dword31) ) ) #t ) (else - (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (set! (-> self control unknown-dword32) (-> *display* base-frame-counter)) #f ) ) @@ -1091,12 +1093,12 @@ (-> *display* base-frame-counter) (the-as int (-> *TARGET-bank* attack-timeout)) ) - (-> self control unknown-dword32) + (-> self control unknown-dword33) ) #t ) (else - (set! (-> self control unknown-dword33) (-> *display* base-frame-counter)) + (set! (-> self control unknown-dword34) (-> *display* base-frame-counter)) #f ) ) @@ -1136,7 +1138,7 @@ ) ) -(defbehavior delete-back-vel target ((arg0 float)) +(defbehavior delete-back-vel target () (let ((s5-0 (new-stack-vector0))) (vector-z-quaternion! s5-0 (-> self control dir-targ)) (let ((gp-0 (new-stack-vector0)) @@ -1181,8 +1183,8 @@ (defun target-timed-invulnerable ((arg0 seconds) (arg1 target)) (logior! (-> arg1 state-flags) 32) - (set! (-> arg1 control unknown-dword70) (-> *display* base-frame-counter)) - (set! (-> arg1 control unknown-dword71) (the-as int arg0)) + (set! (-> arg1 control unknown-dword80) (-> *display* base-frame-counter)) + (set! (-> arg1 control unknown-dword81) (the-as int arg0)) (dummy-53 (-> arg1 control) 2 4096 0) 0 (none) diff --git a/goal_src/engine/target/target.gc b/goal_src/engine/target/target.gc index ffc28b8603..6eba8a8c76 100644 --- a/goal_src/engine/target/target.gc +++ b/goal_src/engine/target/target.gc @@ -5,8 +5,7579 @@ ;; name in dgo: target ;; dgos: GAME, ENGINE -;; TODO - for final-door -(define-extern target-stance (state target)) +;; TODO - almost all of these are in target-handler or target2, temporary + +(define-extern target-attack-air (state symbol target)) ;; unknown type +(define-extern target-jump (state float float surface target)) ;; unknown type +(define-extern target-hit-ground (state symbol target)) ;; unknown type +(define-extern target-high-jump (state float float basic target)) ;; unknown type +(define-extern target-stance (state target)) ;; unknown type +(define-extern target-state-hook-exit (function none :behavior target)) +(define-extern target-wade-stance (state target)) ;; unknown type +(define-extern target-ice-stance (state target)) ;; unknown type +(define-extern target-walk (state target)) ;; unknown type +(define-extern target-duck-stance (state target)) ;; unknown type +(define-extern target-attack (state target)) ;; unknown type +(define-extern target-running-attack (state target)) ;; unknown type +(define-extern target-stance-ambient (state target)) ;; unknown type +(define-extern target-effect-exit (function none :behavior target)) +(define-extern target-ice-walk (state target)) ;; unknown type +(define-extern target-wheel (state target)) ;; unknown type +(define-extern target-duck-walk (state target)) ;; unknown type +(define-extern target-turn-around (state target)) ;; unknown type +(define-extern target-post (function none)) +(define-extern target-walk-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-attack-uppercut (state float float target)) ;; unknown type +(define-extern target-double-jump (state float float target)) ;; unknown type +(define-extern target-flop (state float float float target)) ;; unknown type +(define-extern target-launch (state float symbol vector int target)) ;; unknown type +(define-extern target-duck-high-jump (state float float symbol target)) ;; unknown type +(define-extern target-duck-high-jump-jump (state float float symbol target)) ;; unknown type +(define-extern target-wade-walk (state target)) ;; unknown type +(define-extern target-hit-ground-hard (state float target)) ;; unknown type +(define-extern target-land-effect (function none :behavior target)) +(define-extern target-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-standard-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-jump-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-hit (state symbol attack-info target)) ;; unknown type +(define-extern target-shoved (function meters meters process (state target) object :behavior target)) +(define-extern target-send-attack (function process uint uint int int symbol :behavior target)) ;; i suspect the uints are actually structures/basics +(define-extern target-yellow-blast (state target)) ;; unknown type +(define-extern target-bonk-event-handler (function process int symbol event-message-block object :behavior target)) +(define-extern target-attack-uppercut-jump (state float float target)) ;; unknown type +(define-extern target-flop-hit-ground (state symbol target)) ;; unknown type +(define-extern target-swim-down (state target)) ;; unknown type +(define-extern target-yellow-jump-blast (state target)) ;; unknown type +(define-extern target-wheel-flip (state float float target)) ;; unknown type + +;; DECOMP BEGINS + +(defbehavior target-falling-anim target ((arg0 int) (arg1 int)) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 38)) + (= v1-2 (-> self draw art-group data 62)) + ) + ) + ((let ((v1-8 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-8 (-> self draw art-group data 44)) + (= v1-8 (-> self draw art-group data 45)) + ) + ) + (ja-channel-push! 1 45) + (let ((a0-16 (-> self skel root-channel 0))) + (set! + (-> a0-16 frame-group) + (the-as art-joint-anim (-> self draw art-group data 50)) + ) + (set! + (-> a0-16 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 50)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-16 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-16 frame-num) 0.0) + (joint-control-channel-group! + a0-16 + (the-as art-joint-anim (-> self draw art-group data 50)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-17 (-> self skel root-channel 0))) + (set! + (-> a0-17 param 0) + (the float (+ (-> a0-17 frame-group data 0 length) -1)) + ) + (set! (-> a0-17 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-17 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 50) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-23 (-> self skel root-channel 0))) + (set! + (-> a0-23 param 0) + (the float (+ (-> a0-23 frame-group data 0 length) -1)) + ) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-23 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (ja-channel-push! 1 45) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 86) + ) + (ja-channel-push! 1 45) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! + (-> s5-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 34)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s5-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s5-0 frame-num) (ja-aframe (the-as float 20.0) 0)) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (let ((a0-33 (-> self skel root-channel 0))) + (set! + (-> a0-33 param 0) + (the float (+ (-> a0-33 frame-group data 0 length) -1)) + ) + (set! (-> a0-33 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-33 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + ) + (else + (ja-channel-push! 1 arg1) + (let ((v1-82 (-> self skel root-channel 0))) + (set! + (-> v1-82 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + ) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (suspend) + ) + ) + ) + ) + (let ((a0-42 (-> self skel root-channel 0))) + (set! + (-> a0-42 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-42 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-42 frame-num) 0.0) + (joint-control-channel-group! + a0-42 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (let ((s5-1 (-> *display* base-frame-counter))) + (while (or (= arg0 -1) (< (- (-> *display* base-frame-counter) s5-1) arg0)) + (suspend) + (let ((a0-43 (-> self skel root-channel 0))) + (set! + (-> a0-43 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-43 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-43 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + ) + #f + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(defbehavior target-falling-trans target ((arg0 basic) (arg1 cpad-list)) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack-air #f) + ) + (when (= arg0 'target-eco-powerup) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self water flags) 512)) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 900) + (zero? (logand (-> self state-flags) 2048)) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + ) + (if (logtest? (-> self control status) 1) + (go target-hit-ground #f) + ) + (when + (if + (and + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + (>= (the-as int arg1) 0) + (>= + (- (-> *display* base-frame-counter) (-> self state-time)) + (the-as int arg1) + ) + (not + (and + *cheat-mode* + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons r2) + ) + ) + ) + ) + #t + ) + (logior! (-> self control status) 1) + (go target-hit-ground 'stuck) + ) + (if (!= (-> self state-time) (-> *display* base-frame-counter)) + (slide-down-test) + ) + 0 + (none) + ) + +(defbehavior target-hit-ground-anim target ((arg0 symbol)) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 63)) + (= v1-2 (-> self draw art-group data 64)) + (= v1-2 (-> self draw art-group data 66)) + (= v1-2 (-> self draw art-group data 67)) + ) + (let + ((gp-0 + (or + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (< + (-> self control unknown-float01) + (-> (new 'static 'array float 1 61440.0) 0) + ) + ) + ) + (f30-0 (if (= arg0 'swim) + (-> (new 'static 'array float 1 0.4) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (ja-channel-set! 1) + (let ((s5-0 (-> self skel root-channel 0))) + (set! (-> s5-0 frame-group) (the-as art-joint-anim (if gp-0 + (-> + self + draw + art-group + data + 65 + ) + (-> + self + draw + art-group + data + 68 + ) + ) + ) + ) + (set! (-> s5-0 param 0) (the float (+ (-> (the-as art-joint-anim (if gp-0 + (-> + self + draw + art-group + data + 65 + ) + (-> + self + draw + art-group + data + 68 + ) + ) + ) + data 0 length + ) + -1 + ) + ) + ) + (let + ((f30-1 + (seek + f30-0 + (-> (new 'static 'array float 1 1.0) 0) + (* 0.5 (-> *display* seconds-per-frame)) + ) + ) + ) + (set! (-> s5-0 param 1) f30-1) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! s5-0 (the-as art-joint-anim (if gp-0 + (-> + self + draw + art-group + data + 65 + ) + (-> + self + draw + art-group + data + 68 + ) + ) + ) + num-func-seek! + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 (-> self align) (if gp-0 + 2 + 6 + ) + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (the-as float 1.5) + ) + (when + (and + (>= 25.0 (ja-aframe-num 0)) + (and + (>= (ja-aframe-num 0) 21.0) + (= (-> self next-state name) 'target-flop-hit-ground) + (!= (-> self control unknown-spoolanim00) 'stuck) + ) + ) + (set! (-> self event-hook) target-jump-event-handler) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (ja-channel-set! 0) + (go + target-high-jump + (-> *TARGET-bank* flop-jump-height-min) + (-> *TARGET-bank* flop-jump-height-max) + (if gp-0 + 'flop + 'flop-forward + ) + ) + ) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! + (-> s5-1 param 0) + (the float (+ (-> s5-1 frame-group data 0 length) -1)) + ) + (set! + f30-1 + (seek + f30-1 + (-> (new 'static 'array float 1 1.0) 0) + (* 0.5 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> s5-1 param 1) f30-1) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + #f + ) + ((and + (= (-> self control ground-pat material) (pat-material ice)) + (< 16384.0 (-> self control unknown-float01)) + ) + #f + ) + ((let ((v1-95 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (or + (= v1-95 (-> self draw art-group data 38)) + (= v1-95 (-> self draw art-group data 42)) + (= v1-95 (-> self draw art-group data 43)) + ) + (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (>= (ja-aframe-num 0) 38.0) + ) + ) + ) + (ja-channel-push! 1 6) + (let ((a0-35 (-> self skel root-channel 0))) + (set! + (-> a0-35 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> a0-35 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-35 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! + a0-35 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-36 (-> self skel root-channel 0))) + (set! + (-> a0-36 param 0) + (the float (+ (-> a0-36 frame-group data 0 length) -1)) + ) + (set! (-> a0-36 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-36 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (>= (ja-aframe-num 0) 35.0) + ) + (ja-channel-set! 1) + (let ((a0-44 (-> self skel root-channel 0))) + (set! + (-> a0-44 frame-group) + (the-as art-joint-anim (-> self draw art-group data 39)) + ) + (set! + (-> a0-44 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 39)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-44 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-44 frame-num) 0.0) + (joint-control-channel-group! + a0-44 + (the-as art-joint-anim (-> self draw art-group data 39)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-45 (-> self skel root-channel 0))) + (set! + (-> a0-45 param 0) + (the float (+ (-> a0-45 frame-group data 0 length) -1)) + ) + (set! (-> a0-45 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-45 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (set! + (-> gp-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) (ja-aframe (the-as float 50.0) 0)) + (joint-control-channel-group! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-49 (-> self skel root-channel 0))) + (set! + (-> a0-49 param 0) + (the float (+ (-> a0-49 frame-group data 0 length) -1)) + ) + (set! (-> a0-49 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-49 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((let ((v1-187 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-187 (-> self draw art-group data 34)) + (= v1-187 (-> self draw art-group data 41)) + ) + ) + (ja-channel-set! 1) + (let ((gp-2 (-> self skel root-channel 0))) + (set! + (-> gp-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 39)) + ) + (set! + (-> gp-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 39)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 38.0) 0)) + (joint-control-channel-group! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 39)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-61 (-> self skel root-channel 0))) + (set! + (-> a0-61 param 0) + (the float (+ (-> a0-61 frame-group data 0 length) -1)) + ) + (set! (-> a0-61 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-61 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-3 (-> self skel root-channel 0))) + (set! + (-> gp-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-3 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) (ja-aframe (the-as float 50.0) 0)) + (joint-control-channel-group! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-65 (-> self skel root-channel 0))) + (set! + (-> a0-65 param 0) + (the float (+ (-> a0-65 frame-group data 0 length) -1)) + ) + (set! (-> a0-65 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-65 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((let ((v1-242 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-242 (-> self draw art-group data 73)) + (= v1-242 (-> self draw art-group data 74)) + ) + ) + (let ((f30-2 (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 74) + ) + (-> (new 'static 'array float 1 24576.0) 0) + (-> (new 'static 'array float 1 -24576.0) 0) + ) + ) + ) + (ja-channel-push! 1 12) + (let ((gp-4 (-> self skel root-channel 0))) + (set! + (-> gp-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 39)) + ) + (set! + (-> gp-4 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 39)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-4 frame-num) (ja-aframe (the-as float 38.0) 0)) + (joint-control-channel-group! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 39)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set-forward-vel f30-2) + (suspend) + (let ((a0-82 (-> self skel root-channel 0))) + (set! + (-> a0-82 param 0) + (the float (+ (-> a0-82 frame-group data 0 length) -1)) + ) + (set! (-> a0-82 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-82 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((gp-5 (-> self skel root-channel 0))) + (set! + (-> gp-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-5 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-5 frame-num) (ja-aframe (the-as float 50.0) 0)) + (joint-control-channel-group! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-86 (-> self skel root-channel 0))) + (set! + (-> a0-86 param 0) + (the float (+ (-> a0-86 frame-group data 0 length) -1)) + ) + (set! (-> a0-86 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-86 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((let ((v1-305 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-305 (-> self draw art-group data 34)) + (= v1-305 (-> self draw art-group data 56)) + (= v1-305 (-> self draw art-group data 57)) + (= v1-305 (-> self draw art-group data 58)) + (= v1-305 (-> self draw art-group data 68)) + (= v1-305 (-> self draw art-group data 65)) + (= v1-305 (-> self draw art-group data 62)) + ) + ) + (ja-channel-push! 1 12) + (let ((gp-6 (-> self skel root-channel 0))) + (set! + (-> gp-6 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-6 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-6 frame-num) (ja-aframe (the-as float 42.0) 0)) + (joint-control-channel-group! + gp-6 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-113 (-> self skel root-channel 0))) + (set! + (-> a0-113 param 0) + (the float (+ (-> a0-113 frame-group data 0 length) -1)) + ) + (set! (-> a0-113 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-113 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 35) + ) + (let ((a0-119 (-> self skel root-channel 0))) + (set! + (-> a0-119 param 0) + (the float (+ (-> a0-119 frame-group data 0 length) -1)) + ) + (set! (-> a0-119 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! + a0-119 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + #f + ) + ) + ) + ) + +(defstate target-startup (target) + :event + target-standard-event-handler + :code + (behavior () + (suspend) + (suspend) + (go target-stance) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :exit + (behavior () + (set! (-> self control unknown-float81) 0.0) + (target-state-hook-exit) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if (logtest? (-> self water flags) 1024) + (go target-wade-stance) + ) + (when (= (-> self control ground-pat material) (pat-material ice)) + (set! (-> self control unknown-float81) 0.0) + (remove-exit) + (go target-ice-stance) + ) + (when (move-legs?) + (set! (-> self control unknown-float81) 0.0) + (remove-exit) + (go target-walk) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (set! (-> self control unknown-float81) 0.0) + (remove-exit) + (go target-duck-stance) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (slide-down-test) + (fall-test) + (none) + ) + :code + (behavior () + (let ((s5-0 22) + (gp-0 (new 'stack 'ground-tween-info)) + ) + (let ((v1-3 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-3 (-> self draw art-group data 89)) + (= v1-3 (-> self draw art-group data 90)) + ) + (set! s5-0 45) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 71) + ) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 frame-group) + (the-as art-joint-anim (-> self draw art-group data 72)) + ) + (set! + (-> a0-12 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 72)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-12 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-12 frame-num) 0.0) + (joint-control-channel-group! + a0-12 + (the-as art-joint-anim (-> self draw art-group data 72)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 param 0) + (the float (+ (-> a0-13 frame-group data 0 length) -1)) + ) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 51) + ) + (cond + ((rand-vu-percent? (the-as float 0.3)) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 frame-group) + (the-as art-joint-anim (-> self draw art-group data 53)) + ) + (set! + (-> a0-20 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 53)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-20 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-20 frame-num) 0.0) + (joint-control-channel-group! + a0-20 + (the-as art-joint-anim (-> self draw art-group data 53)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-21 (-> self skel root-channel 0))) + (set! + (-> a0-21 param 0) + (the float (+ (-> a0-21 frame-group data 0 length) -1)) + ) + (set! (-> a0-21 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-21 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((a0-23 (-> self skel root-channel 0))) + (set! + (-> a0-23 frame-group) + (the-as art-joint-anim (-> self draw art-group data 52)) + ) + (set! + (-> a0-23 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 52)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-23 frame-num) 0.0) + (joint-control-channel-group! + a0-23 + (the-as art-joint-anim (-> self draw art-group data 52)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 param 0) + (the float (+ (-> a0-24 frame-group data 0 length) -1)) + ) + (set! (-> a0-24 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-24 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 78) + ) + (let ((a0-30 (-> self skel root-channel 0))) + (set! + (-> a0-30 frame-group) + (the-as art-joint-anim (-> self draw art-group data 79)) + ) + (set! + (-> a0-30 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 79)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-30 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-30 frame-num) 0.0) + (joint-control-channel-group! + a0-30 + (the-as art-joint-anim (-> self draw art-group data 79)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-31 (-> self skel root-channel 0))) + (set! + (-> a0-31 param 0) + (the float (+ (-> a0-31 frame-group data 0 length) -1)) + ) + (set! (-> a0-31 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-31 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 84) + ) + (let ((a0-37 (-> self skel root-channel 0))) + (set! + (-> a0-37 frame-group) + (the-as art-joint-anim (-> self draw art-group data 85)) + ) + (set! + (-> a0-37 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 85)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-37 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-37 frame-num) 0.0) + (joint-control-channel-group! + a0-37 + (the-as art-joint-anim (-> self draw art-group data 85)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-38 (-> self skel root-channel 0))) + (set! + (-> a0-38 param 0) + (the float (+ (-> a0-38 frame-group data 0 length) -1)) + ) + (set! (-> a0-38 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-38 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! s5-0 0) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 59) + ) + (set! + (-> self control unknown-float81) + (-> self control unknown-float80) + ) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let ((s4-0 (-> self skel root-channel 0))) + (set! + (-> s4-0 frame-group) + (the-as art-joint-anim (if (rand-vu-percent? (the-as float 0.3)) + (-> self draw art-group data 61) + (-> self draw art-group data 60) + ) + ) + ) + (set! + (-> s4-0 param 0) + (the + float + (+ + (-> (the-as art-joint-anim (if (rand-vu-percent? (the-as float 0.3)) + (-> self draw art-group data 61) + (-> self draw art-group data 60) + ) + ) + data 0 length + ) + -1 + ) + ) + ) + (set! (-> s4-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s4-0 frame-num) 0.0) + (joint-control-channel-group! + s4-0 + (the-as art-joint-anim (if (rand-vu-percent? (the-as float 0.3)) + (-> self draw art-group data 61) + (-> self draw art-group data 60) + ) + ) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! + (-> self control unknown-float81) + (seek + (-> self control unknown-float81) + (-> (new 'static 'array float 1 0.0) 0) + (-> *display* seconds-per-frame) + ) + ) + (suspend) + (let ((a0-50 (-> self skel root-channel 0))) + (set! + (-> a0-50 param 0) + (the float (+ (-> a0-50 frame-group data 0 length) -1)) + ) + (set! (-> a0-50 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-50 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float81) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-206 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-206 (-> self draw art-group data 31)) + (= v1-206 (-> self draw art-group data 32)) + ) + ) + (ja-channel-push! 1 12) + (let ((a0-62 (-> self skel root-channel 0))) + (set! + (-> a0-62 frame-group) + (the-as art-joint-anim (-> self draw art-group data 30)) + ) + (set! (-> a0-62 param 0) 0.0) + (set! (-> a0-62 param 1) 1.2) + (set! + (-> a0-62 frame-num) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 30)) + data + 0 + length + ) + -1 + ) + ) + ) + (joint-control-channel-group! + a0-62 + (the-as art-joint-anim (-> self draw art-group data 30)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-63 (-> self skel root-channel 0))) + (set! (-> a0-63 param 0) 0.0) + (set! (-> a0-63 param 1) 1.2) + (joint-control-channel-group-eval! + a0-63 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! s5-0 12) + ) + ((or (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (begin + (set! s5-0 45) + (< 0.5 (-> self skel root-channel 6 frame-interp)) + ) + ) + (let ((v1-243 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-243 (-> self draw art-group data 28)) + (= v1-243 (-> self draw art-group data 29)) + (= v1-243 (-> self draw art-group data 54)) + (= v1-243 (-> self draw art-group data 55)) + ) + ) + ) + (let ((f30-1 (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (let + ((f0-57 + (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))) + ) + ) + (- f0-57 (* (the float (the int (/ f0-57 50.0))) 50.0)) + ) + ) + (else + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + ) + ) + (set! s5-0 45) + (ja-channel-push! 3 s5-0) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 4)) + (the-as uint (-> self draw art-group data 13)) + (the-as uint (-> self draw art-group data 16)) + (the-as uint (-> self draw art-group data 7)) + (the-as uint (-> self draw art-group data 10)) + ) + (let ((s4-1 (-> self skel root-channel 0))) + (set! (-> s4-1 num-func) num-func-identity) + (set! (-> s4-1 frame-num) (ja-aframe f30-1 0)) + ) + ) + (let ((a0-89 (-> self skel root-channel 1))) + (set! (-> a0-89 param 0) 0.0) + (joint-control-channel-group-eval! + a0-89 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-90 (-> self skel root-channel 2))) + (set! (-> a0-90 param 0) 0.0) + (joint-control-channel-group-eval! + a0-90 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (dotimes (s4-2 3) + (until (ja-done? 0) + (ground-tween-update + gp-0 + (-> self control unknown-float61) + (-> self control unknown-float62) + ) + (suspend) + (let ((a0-92 (-> self skel root-channel 0))) + (set! + (-> a0-92 param 0) + (the float (+ (-> a0-92 frame-group data 0 length) -1)) + ) + (set! (-> a0-92 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-92 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-93 (-> self skel root-channel 1))) + (set! (-> a0-93 param 0) 0.0) + (joint-control-channel-group-eval! + a0-93 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-94 (-> self skel root-channel 2))) + (set! (-> a0-94 param 0) 0.0) + (joint-control-channel-group-eval! + a0-94 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + (let ((v1-298 (-> self skel root-channel 0))) + (set! (-> v1-298 num-func) num-func-identity) + (set! (-> v1-298 frame-num) 0.0) + ) + ) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 3)) + (the-as uint (-> self draw art-group data 12)) + (the-as uint (-> self draw art-group data 15)) + (the-as uint (-> self draw art-group data 6)) + (the-as uint (-> self draw art-group data 9)) + ) + (until (ja-done? 0) + (ground-tween-update + gp-0 + (-> self control unknown-float61) + (-> self control unknown-float62) + ) + (suspend) + (let ((a0-99 (-> self skel root-channel 0))) + (set! + (-> a0-99 param 0) + (the float (+ (-> a0-99 frame-group data 0 length) -1)) + ) + (set! (-> a0-99 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-99 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-100 (-> self skel root-channel 1))) + (set! (-> a0-100 param 0) 0.0) + (joint-control-channel-group-eval! + a0-100 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-101 (-> self skel root-channel 2))) + (set! (-> a0-101 param 0) 0.0) + (joint-control-channel-group-eval! + a0-101 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (>= (-> self control unknown-float01) 5734.4) + ) + (set! s5-0 45) + ) + ) + ) + (if (not (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 5) + ) + (= (ja-group-size) 3) + ) + ) + (ja-channel-push! 3 s5-0) + ) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 5)) + (the-as uint (-> self draw art-group data 14)) + (the-as uint (-> self draw art-group data 17)) + (the-as uint (-> self draw art-group data 8)) + (the-as uint (-> self draw art-group data 11)) + ) + (while #t + (ground-tween-update + gp-0 + (-> self control unknown-float61) + (-> self control unknown-float62) + ) + (suspend) + (let ((a0-115 (-> self skel root-channel 0))) + (set! (-> a0-115 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-115 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((a0-116 (-> self skel root-channel 1))) + (set! (-> a0-116 param 0) 0.0) + (joint-control-channel-group-eval! + a0-116 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-117 (-> self skel root-channel 2))) + (set! (-> a0-117 param 0) 0.0) + (joint-control-channel-group-eval! + a0-117 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (if (can-play-stance-amibent?) + (go target-stance-ambient) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-walk (target) + :event + target-walk-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *walk-mods*) + (none) + ) + :exit + (behavior () + (target-effect-exit) + (target-state-hook-exit) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (when (= (-> self control ground-pat material) (pat-material ice)) + (target-effect-exit) + (remove-exit) + (go target-ice-walk) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons l1 r1) + ) + (and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> *TARGET-bank* wheel-timeout)) + ) + (-> self control unknown-dword30) + ) + (and + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (can-wheel?) + ) + ) + ) + (go target-wheel) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (target-effect-exit) + (remove-exit) + (go target-duck-walk) + ) + (when (not (move-legs?)) + (target-effect-exit) + (remove-exit) + (go target-stance) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (when + (and + (turn-around?) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 90) + ) + (set! + (-> self control transv quad) + (-> + self + control + unknown-vector-array10 + (-> self control unknown-int10) + quad + ) + ) + (set! (-> self control transv w) (-> (new 'static 'array float 1 1.0) 0)) + (go target-turn-around) + ) + (slide-down-test) + (fall-test) + (none) + ) + :code + (behavior () + (let ((f28-0 0.0) + (f30-0 + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -16384.0 (-> self control unknown-float01))) + ) + ) + ) + (gp-0 #f) + ) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 33) + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (ja-channel-push! 7 15) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 69) + ) + (ja-channel-push! 7 22) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 51) + ) + (let + ((f30-1 + (fmax + 0.8 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (-> self control unknown-float01)) + ) + ) + ) + ) + (cond + ((and + (rand-vu-percent? (the-as float 0.3)) + (< 20480.0 (-> self control unknown-float01)) + ) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 53)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-0 param 1) f30-1) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 53)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-1 param 1) f30-1) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 frame-group) + (the-as art-joint-anim (-> self draw art-group data 55)) + ) + (set! + (-> a0-20 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 55)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-20 param 1) f30-1) + (set! (-> a0-20 frame-num) 0.0) + (joint-control-channel-group! + a0-20 + (the-as art-joint-anim (-> self draw art-group data 55)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-21 (-> self skel root-channel 0))) + (set! + (-> a0-21 param 0) + (the float (+ (-> a0-21 frame-group data 0 length) -1)) + ) + (set! (-> a0-21 param 1) f30-1) + (joint-control-channel-group-eval! + a0-21 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 52)) + ) + (set! (-> s5-2 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-2 param 1) f30-1) + (set! (-> s5-2 frame-num) 0.0) + (joint-control-channel-group! + s5-2 + (the-as art-joint-anim (-> self draw art-group data 52)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-3 (-> self skel root-channel 0))) + (set! (-> s5-3 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-3 param 1) f30-1) + (joint-control-channel-group-eval! + s5-3 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-28 (-> self skel root-channel 0))) + (set! + (-> a0-28 frame-group) + (the-as art-joint-anim (-> self draw art-group data 54)) + ) + (set! + (-> a0-28 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 54)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-28 param 1) f30-1) + (set! (-> a0-28 frame-num) 0.0) + (joint-control-channel-group! + a0-28 + (the-as art-joint-anim (-> self draw art-group data 54)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-29 (-> self skel root-channel 0))) + (set! + (-> a0-29 param 0) + (the float (+ (-> a0-29 frame-group data 0 length) -1)) + ) + (set! (-> a0-29 param 1) f30-1) + (joint-control-channel-group-eval! + a0-29 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + (ja-channel-push! 7 15) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (set! f28-0 30.0) + ) + (else + (let ((v1-108 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-108 (-> self draw art-group data 59)) + (= v1-108 (-> self draw art-group data 60)) + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (set! f28-0 30.0) + (ja-channel-push! 7 45) + ) + ((let ((v1-116 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-116 (-> self draw art-group data 84)) + (= v1-116 (-> self draw art-group data 85)) + ) + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (set! f28-0 26.0) + (ja-channel-push! 7 30) + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + (set! f28-0 (ja-aframe-num 0)) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 102) + ) + (set! f28-0 (ja-aframe-num 0)) + (ja-channel-push! 7 30) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 89) + ) + (set! f28-0 (ja-aframe-num 0)) + (ja-channel-push! 7 15) + ) + ((let ((v1-146 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (and + (or + (or + (= v1-146 (-> self draw art-group data 38)) + (= v1-146 (-> self draw art-group data 71)) + (= v1-146 (-> self draw art-group data 58)) + (= v1-146 (-> self draw art-group data 62)) + (= v1-146 (-> self draw art-group data 65)) + (= v1-146 (-> self draw art-group data 68)) + ) + (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (< 30.0 (ja-aframe-num 0)) + ) + ) + (< 12288.0 (-> self control unknown-float01)) + ) + ) + (let ((s5-4 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + (f30-2 (-> self control ground-impact-vel)) + ) + (case (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + + (((-> self draw art-group data 71) (-> self draw art-group data 58)) + (ja-channel-push! 1 15) + ) + (else + (ja-channel-set! 1) + ) + ) + (cond + ((< (if (= s5-4 (-> self draw art-group data 34)) + (-> (new 'static 'array float 1 77824.0) 0) + (-> (new 'static 'array float 1 102400.0) 0) + ) + f30-2 + ) + (let ((s5-5 (-> self skel root-channel 0))) + (set! + (-> s5-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 28)) + ) + (set! + (-> s5-5 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-5 param 1) 1.00001) + (set! (-> s5-5 frame-num) 0.0) + (joint-control-channel-group! + s5-5 + (the-as art-joint-anim (-> self draw art-group data 28)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-6 (-> self skel root-channel 0))) + (set! + (-> s5-6 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-6 param 1) 1.00001) + (joint-control-channel-group-eval! + s5-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((< (if (= s5-4 (-> self draw art-group data 34)) + (-> (new 'static 'array float 1 61440.0) 0) + (-> (new 'static 'array float 1 102400.0) 0) + ) + f30-2 + ) + (let ((s5-7 (-> self skel root-channel 0))) + (set! + (-> s5-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 28)) + ) + (set! + (-> s5-7 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-7 param 1) 1.00001) + (set! + (-> s5-7 frame-num) + (ja-aframe (-> (new 'static 'array float 1 -1.0) 0) 0) + ) + (joint-control-channel-group! + s5-7 + (the-as art-joint-anim (-> self draw art-group data 28)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-8 (-> self skel root-channel 0))) + (set! + (-> s5-8 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-8 param 1) 1.00001) + (joint-control-channel-group-eval! + s5-8 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((s5-9 (-> self skel root-channel 0))) + (set! + (-> s5-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 29)) + ) + (set! (-> s5-9 param 0) (ja-aframe (the-as float 4.0) 0)) + (set! (-> s5-9 param 1) 1.00001) + (set! (-> s5-9 frame-num) 0.0) + (joint-control-channel-group! + s5-9 + (the-as art-joint-anim (-> self draw art-group data 29)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-10 (-> self skel root-channel 0))) + (set! (-> s5-10 param 0) (ja-aframe (the-as float 4.0) 0)) + (set! (-> s5-10 param 1) 1.00001) + (joint-control-channel-group-eval! + s5-10 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-116 (-> self skel root-channel 0))) + (set! + (-> a0-116 param 0) + (the float (+ (-> a0-116 frame-group data 0 length) -1)) + ) + (set! + (-> a0-116 param 1) + (/ + (* + (fmax 20480.0 (-> self control unknown-float01)) + (-> *display* seconds-per-frame) + ) + (/ + (-> *TARGET-bank* run-up-cycle-dist) + (-> *TARGET-bank* run-cycle-length) + ) + ) + ) + (joint-control-channel-group-eval! + a0-116 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! f28-0 30.0) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (ja-channel-set! 7) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (ja-channel-push! 7 15) + (set! gp-0 #t) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 78) + ) + (ja-channel-push! 7 45) + ) + (else + (ja-channel-push! 7 15) + ) + ) + ) + ) + ) + (set! (-> self skel root-channel 3 command) 'push) + (set! (-> self skel root-channel 6 command) 'stack) + (let ((v1-265 (-> self skel root-channel 0))) + (set! + (-> v1-265 frame-group) + (the-as art-joint-anim (-> self draw art-group data 23)) + ) + ) + (let ((f28-1 (ja-aframe f28-0 0))) + (let ((s5-11 (-> self skel root-channel 0))) + (set! (-> s5-11 frame-interp) 0.0) + (set! (-> s5-11 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + s5-11 + (the-as art-joint-anim (-> self draw art-group data 23)) + num-func-identity + ) + (set! (-> s5-11 frame-num) f28-1) + ) + (let ((s5-12 (-> self skel root-channel 1))) + (set! (-> s5-12 frame-interp) 0.0) + (set! (-> s5-12 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + s5-12 + (the-as art-joint-anim (-> self draw art-group data 25)) + num-func-identity + ) + (set! (-> s5-12 frame-num) f28-1) + ) + (let ((s5-13 (-> self skel root-channel 2))) + (set! (-> s5-13 frame-interp) 0.0) + (set! (-> s5-13 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + s5-13 + (the-as art-joint-anim (-> self draw art-group data 27)) + num-func-identity + ) + (set! (-> s5-13 frame-num) f28-1) + ) + (let ((s5-14 (-> self skel root-channel 4))) + (set! (-> s5-14 frame-interp) 0.0) + (set! (-> s5-14 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (joint-control-channel-group-eval! + s5-14 + (the-as art-joint-anim (-> self draw art-group data 20)) + num-func-identity + ) + (set! (-> s5-14 frame-num) f28-1) + ) + (let ((s5-15 (-> self skel root-channel 5))) + (set! (-> s5-15 frame-interp) 0.0) + (set! (-> s5-15 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (joint-control-channel-group-eval! + s5-15 + (the-as art-joint-anim (-> self draw art-group data 22)) + num-func-identity + ) + (set! (-> s5-15 frame-num) f28-1) + ) + (let ((s5-16 (-> self skel root-channel 3))) + (set! (-> s5-16 frame-interp) 0.0) + (set! (-> s5-16 dist) (-> *TARGET-bank* run-cycle-dist)) + (joint-control-channel-group-eval! + s5-16 + (the-as art-joint-anim (-> self draw art-group data 18)) + num-func-identity + ) + (set! (-> s5-16 frame-num) f28-1) + ) + ) + (let ((f28-2 0.0) + (f26-1 0.0) + ) + (while #t + (let + ((f22-0 + (fmax + (-> (new 'static 'array float 1 -1.0) 0) + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 2.0 (-> self control unknown-float61)) + ) + ) + ) + (f24-0 + (fmax + (-> (new 'static 'array float 1 -1.0) 0) + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 1.6 (-> self control unknown-float62)) + ) + ) + ) + ) + (set! + f30-0 + (seek + f30-0 + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -16384.0 (-> self control unknown-float01))) + ) + ) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (let ((v1-317 (-> self skel effect))) + (set! (-> v1-317 channel-offset) (if (< 0.5 f30-0) + 3 + 0 + ) + ) + ) + 0 + (let ((f0-64 (fabs (- f22-0 f28-2)))) + (set! f28-2 (seek f28-2 f22-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-64))))) + ) + (let ((f0-69 (fabs (- f24-0 f26-1)))) + (set! f26-1 (seek f26-1 f24-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-69))))) + ) + ) + (cond + ((>= f28-2 0.0) + (let ((v1-329 (-> self skel root-channel 1))) + (set! (-> v1-329 frame-interp) (fabs f28-2)) + (set! (-> v1-329 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! + (-> v1-329 frame-group) + (the-as art-joint-anim (-> self draw art-group data 24)) + ) + ) + (let ((v1-332 (-> self skel root-channel 4))) + (set! (-> v1-332 frame-interp) (fabs f28-2)) + (set! (-> v1-332 dist) (-> *TARGET-bank* run-up-cycle-dist)) + (set! + (-> v1-332 frame-group) + (the-as art-joint-anim (-> self draw art-group data 19)) + ) + ) + ) + (else + (let ((v1-335 (-> self skel root-channel 1))) + (set! (-> v1-335 frame-interp) (fabs f28-2)) + (set! (-> v1-335 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! + (-> v1-335 frame-group) + (the-as art-joint-anim (-> self draw art-group data 25)) + ) + ) + (let ((v1-338 (-> self skel root-channel 4))) + (set! (-> v1-338 frame-interp) (fabs f28-2)) + (set! (-> v1-338 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (set! + (-> v1-338 frame-group) + (the-as art-joint-anim (-> self draw art-group data 20)) + ) + ) + ) + ) + (cond + ((>= f26-1 0.0) + (let ((v1-341 (-> self skel root-channel 2))) + (set! (-> v1-341 frame-interp) (fabs f26-1)) + (set! (-> v1-341 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-341 frame-group) + (the-as art-joint-anim (-> self draw art-group data 26)) + ) + ) + (let ((v1-344 (-> self skel root-channel 5))) + (set! (-> v1-344 frame-interp) (fabs f26-1)) + (set! (-> v1-344 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! + (-> v1-344 frame-group) + (the-as art-joint-anim (-> self draw art-group data 21)) + ) + ) + ) + (else + (let ((v1-347 (-> self skel root-channel 2))) + (set! (-> v1-347 frame-interp) (fabs f26-1)) + (set! (-> v1-347 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-347 frame-group) + (the-as art-joint-anim (-> self draw art-group data 27)) + ) + ) + (let ((v1-350 (-> self skel root-channel 5))) + (set! (-> v1-350 frame-interp) (fabs f26-1)) + (set! (-> v1-350 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! + (-> v1-350 frame-group) + (the-as art-joint-anim (-> self draw art-group data 22)) + ) + ) + ) + ) + (set! (-> self skel root-channel 6 frame-interp) f30-0) + (let* ((f1-19 (dummy-9 (-> self skel))) + (f0-92 + (/ + (-> self control unknown-float01) + (* 60.0 (/ f1-19 (-> *TARGET-bank* run-cycle-length))) + ) + ) + (a0-182 (-> self skel root-channel 0)) + ) + (set! (-> a0-182 param 0) f0-92) + (joint-control-channel-group-eval! + a0-182 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((a0-183 (-> self skel root-channel 1))) + (set! (-> a0-183 param 0) 0.0) + (joint-control-channel-group-eval! + a0-183 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-184 (-> self skel root-channel 2))) + (set! (-> a0-184 param 0) 0.0) + (joint-control-channel-group-eval! + a0-184 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-185 (-> self skel root-channel 3))) + (set! (-> a0-185 param 0) 0.0) + (joint-control-channel-group-eval! + a0-185 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-186 (-> self skel root-channel 4))) + (set! (-> a0-186 param 0) 0.0) + (joint-control-channel-group-eval! + a0-186 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-187 (-> self skel root-channel 5))) + (set! (-> a0-187 param 0) 0.0) + (joint-control-channel-group-eval! + a0-187 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (if (and gp-0 (!= (-> self skel root-channel 0) (-> self skel channel))) + (ja-blend-eval) + ) + (suspend) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-turn-around (target) + :event + target-standard-event-handler + :enter + (behavior () + (vector-turn-to (-> self control transv)) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + (none) + ) + :exit + (behavior () + (target-state-hook-exit) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + (set! (-> self control unknown-float01) 0.0) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (set! (-> self control unknown-float81) 0.0) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (if + (and + (zero? (logand (-> self control status) 1)) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) + 24 + ) + ) + (go target-falling #f) + ) + (slide-down-test) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 12) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 33)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (quaternion-rotate-y! + (-> self control dir-targ) + (-> self control dir-targ) + (the-as float 32768.0) + ) + (TODO-RENAME-9 (-> self align)) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 2.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 16 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (remove-exit) + (set! (-> self control unknown-float81) 0.0) + (set-forward-vel (the-as float 40960.0)) + (set! (-> self control unknown-float01) 40960.0) + (target-state-hook-exit) + (go target-walk) + (none) + ) + :post + target-no-stick-post + ) + +(defstate target-slide-down (target) + :event + target-walk-event-handler + :enter + (behavior () + (set! (-> self control unknown-surface00) *jump-mods*) + (none) + ) + :exit + (behavior () + (set! (-> self control unknown-dword35) (-> *display* base-frame-counter)) + (none) + ) + :trans + (behavior () + (when + (or + (logtest? (-> self control status) 1) + (if + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + #t + ) + ) + (logior! (-> self control status) 1) + (go target-duck-stance) + ) + (none) + ) + :code + (behavior () + (if (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + ) + (ja-channel-push! 1 30) + ) + (while #t + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 31)) + ) + (set! + (-> a0-5 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 31)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! + a0-5 + (the-as art-joint-anim (-> self draw art-group data 31)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defbehavior + init-var-jump target + ((arg0 float) (arg1 float) (arg2 vector) (arg3 vector) (arg4 vector)) + (set! (-> self control status) (logand -16385 (-> self control status))) + (delete-back-vel) + (when + (< + (- + (-> *display* base-frame-counter) + (the-as int (-> self control rider-time)) + ) + 15 + ) + (let + ((f0-1 + (fmax + 0.0 + (fmin + 28672.0 + (* + 0.5 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control rider-last-move) + ) + ) + ) + ) + ) + ) + (set! arg0 (+ arg0 f0-1)) + (set! arg1 (+ arg1 f0-1)) + ) + (when + (or + (logtest? (-> self control unknown-surface01 flags) #x4000) + (= (-> self control poly-pat material) (pat-material rotate)) + ) + (+! (-> self control transv x) (-> self control rider-last-move x)) + (+! (-> self control transv z) (-> self control rider-last-move z)) + ) + ) + (set! (-> self control unknown-float123) 0.0) + (set! (-> self control unknown-float124) 0.0) + (cond + (arg3 + (set! + (-> self control unknown-uint20) + (the-as uint (- arg0 (+ -409.6 (-> *TARGET-bank* jump-collide-offset)))) + ) + (set! + (-> self control unknown-int21) + (the-as int (- arg1 (-> *TARGET-bank* jump-collide-offset))) + ) + ) + (else + (set! (-> self control unknown-uint20) (the-as uint arg0)) + (set! (-> self control unknown-int21) (the-as int arg1)) + ) + ) + (when arg2 + (let ((s4-1 (new-stack-vector0))) + (let ((f0-16 (vector-dot (-> self control dynam gravity-normal) arg4))) + 0.0 + (vector-! + s4-1 + arg4 + (vector-float*! s4-1 (-> self control dynam gravity-normal) f0-16) + ) + ) + (let* ((f0-17 (vector-length s4-1)) + (f1-11 f0-17) + (f2-7 + (- + (sqrtf (* 2.0 (-> self control dynam gravity-length) arg0)) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + arg4 + (vector-float*! arg4 (-> self control dynam gravity-normal) f2-7) + (vector-float*! s4-1 s4-1 (/ f0-17 f1-11)) + ) + ) + ) + ) + (let ((v0-2 (-> self control unknown-vector102))) + (set! (-> v0-2 quad) (-> self control trans quad)) + v0-2 + ) + ) + +(defbehavior + mod-var-jump target + ((arg0 symbol) (arg1 symbol) (arg2 symbol) (arg3 vector)) + (local-vars (v0-2 vector)) + (let + ((f30-0 + (* + 0.033333335 + (the float (- (-> *display* base-frame-counter) (-> self state-time))) + ) + ) + ) + (cond + ((or + (< (-> (new 'static 'array float 1 1.0) 0) f30-0) + (< (-> self control unknown-float123) 0.0) + (not arg2) + ) + (set! + (-> self control unknown-float123) + (-> (new 'static 'array float 1 -1.0) 0) + ) + ) + (else + (set! (-> self control unknown-float123) f30-0) + (set! (-> self control unknown-float124) f30-0) + (when arg0 + (let + ((s3-1 + (vector-! + (new-stack-vector0) + (-> self control trans) + (-> self control unknown-vector102) + ) + ) + (s4-0 (new-stack-vector0)) + ) + (let ((f0-5 (vector-dot (-> self control dynam gravity-normal) arg3))) + 0.0 + (vector-! + s4-0 + arg3 + (vector-float*! s4-0 (-> self control dynam gravity-normal) f0-5) + ) + ) + (let* ((f28-0 (vector-length s4-0)) + (f26-0 f28-0) + (f0-13 + (- + (sqrtf + (* + 2.0 + (-> self control dynam gravity-length) + (- + (lerp-scale + (the-as float (-> self control unknown-uint20)) + (the-as float (-> self control unknown-uint30)) + f30-0 + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + (vector-dot (-> self control dynam gravity-normal) s3-1) + ) + ) + ) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + arg3 + (vector-float*! arg3 (-> self control dynam gravity-normal) f0-13) + (vector-float*! s4-0 s4-0 (/ f28-0 f26-0)) + ) + ) + ) + ) + ) + ) + ) + 0 + (when (and arg1 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (and (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + extra + ) + #t + ) + ) + (let ((v1-57 (res-lump-struct (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + extra + ) + 'collide-offset vector :time (ja-frame-num 0) + ) + ) + ) + (cond + (v1-57 + (set! v0-2 (-> self control unknown-vector13)) + (set! (-> v0-2 quad) (-> v1-57 quad)) + ) + (else + (set! v0-2 (-> self control unknown-vector13)) + (set! (-> v0-2 quad) (the-as uint128 0)) + ) + ) + ) + v0-2 + ) + ) + +(defstate target-duck-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + (set! (-> self control unknown-surface00) *duck-mods*) + (target-collide-set! 'duck (-> (new 'static 'array float 1 1.0) 0)) + (none) + ) + :exit + (behavior () + (if + (not + (or + (= (-> self next-state name) 'target-duck-walk) + (= (-> self next-state name) 'target-duck-stance) + (= (-> self next-state name) 'target-walk) + (= (-> self next-state name) 'target-stance) + (= (-> self next-state name) 'target-stance-look-around) + ) + ) + (target-state-hook-exit) + ) + (target-exit) + (target-collide-set! 'normal (-> (new 'static 'array float 1 0.0) 0)) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (or + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + ) + (logtest? (-> self state-flags) 8192) + ) + (let ((v1-13 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (and + (not + (or + (= v1-13 (-> self draw art-group data 70)) + (= v1-13 (-> self draw art-group data 69)) + ) + ) + (can-exit-duck?) + ) + ) + ) + (go target-stance) + ) + (if (move-legs?) + (go target-duck-walk) + ) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go + target-high-jump + (-> *TARGET-bank* duck-jump-height-min) + (-> *TARGET-bank* duck-jump-height-max) + 'duck + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + ) + (if (and (can-hands? #t) (can-exit-duck?)) + (go + target-attack-uppercut + (-> *TARGET-bank* attack-jump-height-min) + (-> *TARGET-bank* attack-jump-height-max) + ) + ) + (fall-test) + (slide-down-test) + (none) + ) + :code + (behavior () + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 69) + ) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 70)) + ) + (set! + (-> a0-4 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 70)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! + a0-4 + (the-as art-joint-anim (-> self draw art-group data 70)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 param 0) + (the float (+ (-> a0-5 frame-group data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 32) + ) + (ja-channel-push! 1 30) + ) + (else + (ja-channel-push! 1 12) + (let ((a0-19 (-> self skel root-channel 0))) + (set! + (-> a0-19 frame-group) + (the-as art-joint-anim (-> self draw art-group data 30)) + ) + (set! + (-> a0-19 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 30)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-19 frame-num) 0.0) + (joint-control-channel-group! + a0-19 + (the-as art-joint-anim (-> self draw art-group data 30)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 param 0) + (the float (+ (-> a0-20 frame-group data 0 length) -1)) + ) + (set! (-> a0-20 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-20 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (while #t + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 frame-group) + (the-as art-joint-anim (-> self draw art-group data 31)) + ) + (set! + (-> a0-22 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 31)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-22 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-22 frame-num) 0.0) + (joint-control-channel-group! + a0-22 + (the-as art-joint-anim (-> self draw art-group data 31)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-23 (-> self skel root-channel 0))) + (set! + (-> a0-23 param 0) + (the float (+ (-> a0-23 frame-group data 0 length) -1)) + ) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-23 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-duck-walk (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + (target-collide-set! 'duck (-> (new 'static 'array float 1 1.0) 0)) + (if (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 69) + ) + ) + (set! (-> self control unknown-surface00) *duck-mods*) + ) + (none) + ) + :exit + (-> target-duck-stance exit) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (or + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + ) + (logtest? (-> self state-flags) 8192) + (and + (logtest? (-> self water flags) 1024) + (>= + (- + (- + (-> self control trans y) + (- (-> self water base-height) (-> self water wade-height)) + ) + ) + 2457.6 + ) + ) + ) + (can-exit-duck?) + ) + (go target-walk) + ) + (if (not (move-legs?)) + (go target-duck-stance) + ) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go + target-high-jump + (-> *TARGET-bank* duck-jump-height-min) + (-> *TARGET-bank* duck-jump-height-max) + 'duck + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + ) + (if (and (can-hands? #t) (can-exit-duck?)) + (go + target-attack-uppercut + (-> *TARGET-bank* attack-jump-height-min) + (-> *TARGET-bank* attack-jump-height-max) + ) + ) + (fall-test) + (slide-down-test) + (none) + ) + :code + (behavior () + (cond + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 32) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + (ja-channel-push! 1 135) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 32)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + (else + (ja-channel-push! 1 30) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 32)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + ) + ) + (while #t + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (set! (-> self control unknown-surface00) *duck-mods*) + ) + (let ((a0-18 (-> self skel root-channel 0))) + (set! + (-> a0-18 param 0) + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (/ + (-> self control unknown-float01) + (* + 60.0 + (/ + (-> *TARGET-bank* duck-walk-cycle-dist) + (-> *TARGET-bank* run-cycle-length) + ) + ) + ) + ) + ) + (joint-control-channel-group-eval! + a0-18 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (when (= (-> self control unknown-symbol40) 'launch) + (level-hint-spawn + (game-text-id daxter-screaming-jump) + "sksp009d" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id daxter-wahoo-jump) + "sksp009e" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (case (-> (level-get-target-inside *level*) name) + (('citadel) + (level-hint-spawn + (game-text-id daxter-land-on-the-next-launcher) + "sksp0393" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id daxter-dont-miss-the-next-launcher) + "sksp0388" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + enter-state + (let ((a0-9 (-> self control unknown-dword60)) + (a1-5 (-> self control unknown-dword61)) + (a2-5 (-> self control unknown-vector102)) + ) + (set! + (-> a2-5 quad) + (-> (the-as vector (-> self control unknown-dword62)) quad) + ) + (go + target-launch + (the-as float a0-9) + (the-as symbol a1-5) + a2-5 + (-> self control unknown-dword63) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (sound-play-by-name (static-sound-name "jump") (new-sound-id) 716 0 0 1 #t) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #t) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! arg2 (cond + (arg2 + (empty) + arg2 + ) + (else + *jump-mods* + ) + ) + ) + (set! (-> self control unknown-surface00) arg2) + (set! + (-> self control unknown-float123) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))) + ) + ) + ) + (set! + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01))) + ) + ) + ) + (none) + ) + :exit + target-exit + :trans + (behavior () + (set! + (-> self control unknown-float123) + (fmax + (-> self control unknown-float123) + (* + 0.003921569 + (the + float + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + abutton + 6 + ) + ) + ) + ) + ) + (target-falling-trans + #f + (the-as cpad-list (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + 15 + -1 + ) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 12288.0 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self state-flags) 2048)) + ) + ) + (go + target-double-jump + (-> *TARGET-bank* double-jump-height-min) + (-> *TARGET-bank* double-jump-height-max) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 26624.0 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (go + target-flop + (the-as float 65502.96) + (the-as float -163840.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + (slide-down-test) + (set! + (-> self control unknown-float122) + (seek + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01))) + ) + ) + (-> *display* seconds-per-frame) + ) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (ja-channel-push! 2 15) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (let ((a0-3 (-> self skel root-channel 1))) + (set! (-> a0-3 frame-interp) (-> self control unknown-float122)) + (set! + (-> a0-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 40)) + ) + (set! (-> a0-3 param 0) 0.0) + (joint-control-channel-group-eval! + a0-3 + (the-as art-joint-anim (-> self draw art-group data 40)) + num-func-chan + ) + ) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! (-> a0-4 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-+! + ) + ) + (let ((a0-5 (-> self skel root-channel 1))) + (set! (-> a0-5 frame-interp) (-> self control unknown-float122)) + (set! + (-> a0-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 40)) + ) + (set! (-> a0-5 param 0) 0.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim (-> self draw art-group data 40)) + num-func-chan + ) + ) + (suspend) + (until (ja-done? 0) + (let + ((f30-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (f0-8 (- 20.0 (ja-aframe-num 0))) + (gp-1 (-> self skel root-channel 0)) + ) + (set! + (-> gp-1 param 0) + (the float (+ (-> gp-1 frame-group data 0 length) -1)) + ) + (let ((v1-45 (and (< 0.0 f30-0) (< 0.0 f0-8)))) + (set! (-> gp-1 param 1) (if v1-45 + (fmin + (fmin + (-> (new 'static 'array float 1 3.0) 0) + f0-8 + ) + (/ + (* 5.0 f0-8) + (the + float + (time-to-apex f30-0 (the-as float -245760.0)) + ) + ) + ) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-10 (-> self skel root-channel 1))) + (set! (-> a0-10 frame-interp) (-> self control unknown-float122)) + (set! (-> a0-10 param 0) 0.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (suspend) + ) + (target-falling-anim -1 60) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-jump-forward (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + ((-> target-jump enter) arg0 arg1 (the-as surface #f)) + (set! (-> self control unknown-surface00) *forward-jump-mods*) + (none) + ) + :exit + target-exit + :trans + (-> target-jump trans) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 34)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! + (-> gp-0 frame-num) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! (-> self control unknown-dword70) 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-6 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! + a0-6 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! + (-> a0-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-7 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-7 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-double-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (when (= (-> self control unknown-symbol40) 'launch) + enter-state + (let ((a0-3 (-> self control unknown-dword60)) + (a1-1 (-> self control unknown-dword61)) + (a2-0 (-> self control unknown-vector102)) + ) + (set! + (-> a2-0 quad) + (-> (the-as vector (-> self control unknown-dword62)) quad) + ) + (go + target-launch + (the-as float a0-3) + (the-as symbol a1-1) + a2-0 + (-> self control unknown-dword63) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #t) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *double-jump-mods*) + (none) + ) + :exit + target-exit + :trans + (behavior () + (target-falling-trans + #f + (the-as cpad-list (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + 15 + -1 + ) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 22118.4 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (go + target-flop + (the-as float 33775.48) + (the-as float -122880.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (if (!= (-> self state-time) (-> *display* base-frame-counter)) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + ) + (set! + (-> self control unknown-float122) + (seek + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01))) + ) + ) + (-> *display* seconds-per-frame) + ) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 2 15) + (dummy-10 + (-> self skel effect) + 'jump-double + (-> (new 'static 'array float 1 -1.0) 0) + -1 + ) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 34)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) (ja-aframe (the-as float 5.0) 0)) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-seek! + ) + ) + (let ((a0-5 (-> self skel root-channel 1))) + (set! + (-> a0-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 40)) + ) + (set! (-> a0-5 param 0) 0.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim (-> self draw art-group data 40)) + num-func-chan + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-7 (-> self skel root-channel 1))) + (set! (-> a0-7 frame-interp) (-> self control unknown-float122)) + (set! (-> a0-7 param 0) 0.0) + (joint-control-channel-group-eval! + a0-7 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + (target-falling-anim -1 60) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-high-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 basic)) + (when (and (= (-> self control unknown-symbol40) 'launch) (!= arg2 'launch)) + enter-state + (let ((a0-3 (-> self control unknown-dword60)) + (a1-1 (-> self control unknown-dword61)) + (a2-1 (-> self control unknown-vector102)) + ) + (set! + (-> a2-1 quad) + (-> (the-as vector (-> self control unknown-dword62)) quad) + ) + (go + target-launch + (the-as float a0-3) + (the-as symbol a1-1) + a2-1 + (-> self control unknown-dword63) + ) + ) + ) + (set! (-> self control unknown-uint31) (the-as uint arg2)) + (if (or (= arg2 'duck) (= arg2 'launch)) + (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (sound-play-by-name + (static-sound-name "jump") + (new-sound-id) + 1024 + 457 + 0 + 1 + #t + ) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #t) + (-> self control transv) + ) + (set! (-> self control unknown-surface00) (cond + ((= arg2 'flip) + *flip-jump-mods* + ) + ((= arg2 'flop-forward) + *forward-high-jump-mods* + ) + (else + *high-jump-mods* + ) + ) + ) + (set! + (-> self control unknown-float122) + (fmax + 0.0 + (fmin 0.5 (* 0.00008138021 (+ -409.6 (-> self control unknown-float01)))) + ) + ) + (none) + ) + :exit + target-exit + :trans + (behavior () + (target-falling-trans + #f + (the-as cpad-list (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + 15 + -1 + ) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 73728.0 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (go + target-flop + (the-as float 33775.48) + (the-as float -122880.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + (set! + (-> self control unknown-float122) + (seek + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.00012207031 (+ -2048.0 (-> self control unknown-float01))) + ) + ) + (-> *display* seconds-per-frame) + ) + ) + (none) + ) + :code + (-> target-jump code) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-duck-high-jump (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (none) + ) + :exit + target-exit + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (if (not (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + (ja-channel-push! 1 12) + ) + (case arg2 + (('launch) + (let ((s3-0 (-> self skel root-channel 0))) + (set! + (-> s3-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 42)) + ) + (set! (-> s3-0 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s3-0 frame-num) 0.0) + (joint-control-channel-group! + s3-0 + (the-as art-joint-anim (-> self draw art-group data 42)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s3-1 (-> self skel root-channel 0))) + (set! (-> s3-1 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + s3-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((s3-2 (-> self skel root-channel 0))) + (set! + (-> s3-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 41)) + ) + (set! (-> s3-2 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s3-2 frame-num) 0.0) + (joint-control-channel-group! + s3-2 + (the-as art-joint-anim (-> self draw art-group data 41)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s3-3 (-> self skel root-channel 0))) + (set! (-> s3-3 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + s3-3 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (go target-duck-high-jump-jump arg0 arg1 arg2) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-duck-high-jump-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (sound-play-by-name + (static-sound-name "jump") + (new-sound-id) + 819 + -609 + 0 + 1 + #t + ) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (cond + ((= arg2 'launch) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *launch-jump-mods*) + ) + (else + (set! (-> self control unknown-surface00) *high-jump-mods*) + ) + ) + (none) + ) + :exit + target-exit + :trans + (-> target-high-jump trans) + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (let ((f30-0 (the-as float (if (= arg2 'launch) + 110.0 + 35.0 + ) + ) + ) + (f28-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (until (ja-done? 0) + (let* + ((f24-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (f26-0 (- f30-0 (ja-aframe-num 0))) + (f22-1 + (fmin + (fmin (-> (new 'static 'array float 1 3.0) 0) f26-0) + (/ + (* 5.0 f26-0) + (the float (time-to-apex f24-0 (the-as float -245760.0))) + ) + ) + ) + (s5-0 (-> self skel root-channel 0)) + ) + (set! + (-> s5-0 param 0) + (the float (+ (-> s5-0 frame-group data 0 length) -1)) + ) + (let ((v1-26 (cond + ((and (< 0.0 f24-0) (< 0.0 f26-0)) + (if (= arg2 'launch) + (set! + f28-0 + (lerp f28-0 (* 4.0 f22-1) (the-as float 0.25)) + ) + ) + f22-1 + ) + (else + f28-0 + ) + ) + ) + ) + (set! (-> s5-0 param 1) v1-26) + ) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + (cond + ((= arg2 'launch) + (let ((a0-7 (-> self skel root-channel 0))) + (set! + (-> a0-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 43)) + ) + (set! (-> a0-7 param 0) f28-0) + (set! (-> a0-7 frame-num) 0.0) + (joint-control-channel-group! + a0-7 + (the-as art-joint-anim (-> self draw art-group data 43)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 43)) + ) + (set! (-> a0-8 param 0) f28-0) + (joint-control-channel-group-eval! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 43)) + num-func-loop! + ) + ) + ) + ) + (else + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-9 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! + (-> a0-10 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-10 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + ) + ) + ) + (the-as none 0) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-falling (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 symbol)) + (set! (-> self control unknown-surface00) *jump-mods*) + (set! (-> self control unknown-uint20) (the-as uint arg0)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :trans + (behavior () + (target-falling-trans + (-> self control unknown-spoolanim00) + (the-as cpad-list (if (= (-> self control unknown-spoolanim00) #f) + 0 + (/ (the-as int (-> *TARGET-bank* stuck-time)) 2) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 symbol)) + (target-falling-anim -1 99) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-hit-ground (target) + :event + target-walk-event-handler + :enter + (behavior ((arg0 symbol)) + (cond + ((= arg0 'stuck) + ) + ((let ((v1-4 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-4 (-> self draw art-group data 42)) + (= v1-4 (-> self draw art-group data 43)) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-blue-hit-ground-effect + (-> (new 'static 'array float 1 0.0) 0) + -1 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 90) + ) + (else + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector52) + (-> self control trans) + ) + ) + ) + ) + (if + (and + (< (-> *TARGET-bank* fall-far) f0-1) + (zero? (logand (-> self control status) 1024)) + ) + (go target-hit-ground-hard f0-1) + ) + ) + ) + ) + (cond + ((= arg0 'stuck) + ) + (else + (target-land-effect) + ) + ) + (set! (-> self control unknown-dword31) 0) + (set! (-> self control unknown-dword33) 0) + (if + (>= + (-> self control ground-impact-vel) + (-> *TARGET-bank* fall-stumble-threshold) + ) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + ) + (if (!= (-> self control ground-pat material) (pat-material ice)) + (delete-back-vel) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (start-bobbing! + (-> self water) + (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (the-as float 4096.0) + (-> self control ground-impact-vel) + (the-as float 40960.0) + (-> (new 'static 'array float 1 102400.0) 0) + ) + 600 + 1500 + ) + (none) + ) + :trans + (behavior () + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if (and (not (can-exit-duck?)) (can-duck?)) + (go target-duck-stance) + ) + (when + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (if (logtest? (-> self water flags) 1024) + (go target-wade-walk) + (go target-walk) + ) + ) + (if + (and + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (not (can-exit-duck?)) + ) + (can-duck?) + ) + (go target-duck-stance) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (fall-test) + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 symbol)) + (target-hit-ground-anim #f) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-attack (target) + :event + target-dangerous-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (target-start-attack) + (target-danger-set! 'spin #f) + (set! (-> self control unknown-surface00) *attack-mods*) + (set! (-> self water drip-mult) 4.0) + (set! (-> self neck flex-blend) 0.0) + (none) + ) + :exit + (behavior () + (set! (-> self control unknown-dword33) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 15) + (let ((a0-1 (-> self skel root-channel 0))) + (set! + (-> a0-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 51)) + ) + (set! + (-> a0-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 51)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-1 param 1) (-> self control unknown-surface01 align-speed)) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! + a0-1 + (the-as art-joint-anim (-> self draw art-group data 51)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + 74 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + (level-hint-spawn + (game-text-id red-eco-tutorial) + "sksp0072" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (suspend) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 param 0) + (the float (+ (-> a0-24 frame-group data 0 length) -1)) + ) + (set! (-> a0-24 param 1) (-> self control unknown-surface01 align-speed)) + (joint-control-channel-group-eval! + a0-24 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-running-attack (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (cond + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 224) + ) + (let + ((gp-1 + (target-send-attack + arg0 + (the-as uint (-> self control unknown-symbol30)) + (-> arg3 param 0) + (-> self control unknown-dword50) + (-> self control unknown-dword51) + ) + ) + ) + (when gp-1 + (set! + (-> self control unknown-uint20) + (the-as uint (-> *display* base-frame-counter)) + ) + (let + ((v1-9 + (if + (and (nonzero? arg0) (type-type? (-> arg0 type) process-drawable)) + arg0 + ) + ) + ) + (when v1-9 + (let* ((s5-1 (-> (the-as process-drawable v1-9) root)) + (v1-11 + (if + (and + (nonzero? s5-1) + (type-type? (-> s5-1 type) collide-shape) + ) + (the-as collide-shape s5-1) + ) + ) + ) + (if + (and + v1-11 + (or + (logtest? (-> v1-11 root-prim prim-core collide-as) 256) + (logtest? (-> v1-11 root-prim prim-core action) 1024) + ) + ) + (set! (-> self control unknown-uint31) (the-as uint 1)) + ) + ) + ) + ) + (when (or (= gp-1 'die) (= gp-1 'push)) + (let ((v0-2 (the-as object (-> *display* base-frame-counter)))) + (set! (-> self control unknown-int21) (the-as int v0-2)) + v0-2 + ) + ) + ) + ) + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (if + (or + (and + (= (-> self fact-info-target eco-type) 1) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (< + (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) + 450 + ) + ) + (go target-yellow-blast) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control unknown-int21) 0) + (set! (-> self control unknown-uint31) (the-as uint 0)) + (set! (-> self control unknown-surface00) *run-attack-mods*) + (set! (-> *run-attack-mods* turnv) 655360.0) + (set! (-> *run-attack-mods* turnvv) 655360.0) + (target-start-attack) + (target-danger-set! 'punch #f) + (if + (or + (< (fabs (-> self control unknown-float62)) 0.3) + (< 0.3 (fabs (-> self control unknown-float61))) + ) + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (set! (-> *run-attack-mods* turnv) 0.0) + (set! (-> *run-attack-mods* turnvv) 0.0) + (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :trans + (behavior () + (when (!= (-> self state-time) (-> *display* base-frame-counter)) + (if + (and + (or + (smack-surface? #t) + (and + (>= (-> self control unknown-float63) 0.7) + (zero? (logand (-> self control status) 32)) + ) + ) + (begin + (set! (-> self control unknown-int21) (-> *display* base-frame-counter)) + (set! (-> self control unknown-float81) 0.0) + (let ((gp-0 (new-stack-vector0)) + (f30-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f30-0) + ) + (let* ((f0-5 (vector-length gp-0)) + (f1-1 f0-5) + (f2-1 (fmin 0.0 f30-0)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-1 + ) + (vector-float*! gp-0 gp-0 (/ f0-5 f1-1)) + ) + ) + ) + #t + ) + (or + (zero? (-> self control unknown-uint20)) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 12) + ) + ) + (!= (-> self control unknown-uint31) 1) + ) + (target-shoved + (-> *TARGET-bank* smack-surface-dist) + (-> *TARGET-bank* smack-surface-height) + (the-as process #f) + (the-as (state target) target-hit) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (and + (< 4096.0 (-> self control unknown-float01)) + (or + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons square) + ) + ) + ) + (zero? (logand (-> self state-flags) 6144)) + (zero? (logand (-> self control unknown-surface01 flags) 128)) + ) + ) + (go + target-attack-uppercut + (-> *TARGET-bank* attack-jump-height-min) + (-> *TARGET-bank* attack-jump-height-max) + ) + ) + (if + (and + (logtest? (-> self water flags) 512) + (zero? + (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21) + ) + ) + (dummy-13 + (-> self water) + (the-as float 0.6) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 37) + ) + 0 + (-> self control transv) + ) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + 23 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + (level-hint-spawn + (game-text-id red-eco-tutorial) + "sksp0072" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + (none) + ) + :code + (behavior () + (if (logtest? (-> self water flags) 512) + (sound-play-by-name + (static-sound-name "swim-stroke") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + ) + (ja-channel-push! 1 6) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 59)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (set! (-> self control dynam gravity-max) 368640.0) + (set! (-> self control dynam gravity-length) 368640.0) + (let ((f28-0 0.0) + (f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (gp-2 0) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and + (>= (ja-aframe-num 0) 20.0) + (and + (and + (zero? (logand (-> self control status) 1)) + (>= + (- + (-> *display* base-frame-counter) + (-> self control unknown-dword11) + ) + (the-as int (-> *TARGET-bank* ground-timeout)) + ) + (>= + 0.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (let ((v1-39 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (not + (or + (= v1-39 (-> self draw art-group data 59)) + (= v1-39 (-> self draw art-group data 60)) + (= v1-39 (-> self draw art-group data 61)) + ) + ) + (< 4096.0 (target-height-above-ground)) + ) + ) + ) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 12) + ) + ) + ) + (go target-falling #f) + ) + ((and + (nonzero? (-> self control unknown-uint30)) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint30)) + ) + ) + (the-as uint 12) + ) + ) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + ) + ((and + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons square) + ) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 15) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set-forward-vel + (fmax 32768.0 (* 0.8 (-> self control unknown-float01))) + ) + (set-forward-vel (* 0.8 (-> self control unknown-float01))) + ) + ) + ((ja-done? 0) + (set-forward-vel f28-0) + ) + (else + (set! + f28-0 + (* + (target-align-vel-z-adjust (-> self align delta trans z)) + (-> *display* frames-per-second) + f30-0 + ) + ) + (set-forward-vel f28-0) + ) + ) + ) + (let ((s5-1 (new-stack-vector0))) + (vector-matrix*! + s5-1 + (-> self control transv) + (-> self control unknown-matrix00) + ) + (set! (-> s5-1 y) 0.0) + (vector-matrix*! + (-> self control unknown-vector120) + s5-1 + (-> self control unknown-matrix01) + ) + ) + (suspend) + (let ((a0-44 (-> self skel root-channel 0))) + (set! + (-> a0-44 param 0) + (the float (+ (-> a0-44 frame-group data 0 length) -1)) + ) + (set! (-> a0-44 param 1) (-> self control unknown-surface01 align-speed)) + (joint-control-channel-group-eval! + a0-44 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (if (< 2 gp-2) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + ) + (+! gp-2 1) + ) + ) + (if + (and + (zero? (logand (-> self control status) 1)) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) + (the-as int (-> *TARGET-bank* ground-timeout)) + ) + (>= + 0.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (let ((v1-121 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (not + (or + (= v1-121 (-> self draw art-group data 59)) + (= v1-121 (-> self draw art-group data 60)) + (= v1-121 (-> self draw art-group data 61)) + ) + ) + (< 4096.0 (target-height-above-ground)) + ) + ) + ) + (go target-falling #f) + ) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-attack-air (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter + (behavior ((arg0 symbol)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (target-start-attack) + (target-danger-set! 'spin-air #f) + (set! (-> self control unknown-surface00) *jump-attack-mods*) + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (cond + ((or (>= 0.0 f0-1) (= arg0 'flop)) + (let ((gp-1 (new-stack-vector0))) + (let + ((f0-3 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-1 + (-> self control transv) + (vector-float*! gp-1 (-> self control dynam gravity-normal) f0-3) + ) + ) + (let* ((f0-4 (vector-length gp-1)) + (f1-2 f0-4) + (f2-0 33775.48) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-1 gp-1 (/ f0-4 f1-2)) + ) + ) + ) + ) + (else + (let* + ((f1-5 + (/ + f0-1 + (* + (-> self control dynam gravity-length) + (-> *display* seconds-per-frame) + ) + ) + ) + (f30-0 (* 0.5 f1-5 (-> *display* seconds-per-frame) f0-1)) + ) + (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 62) + ) + (set! + f30-0 + (fmax + 0.0 + (- + (-> *TARGET-bank* attack-jump-height-max) + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control unknown-vector52) + ) + ) + ) + ) + ) + ) + (let ((gp-2 (new-stack-vector0))) + (let + ((f0-8 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-2 + (-> self control transv) + (vector-float*! gp-2 (-> self control dynam gravity-normal) f0-8) + ) + ) + (let* ((f0-9 (vector-length gp-2)) + (f1-11 f0-9) + (f2-7 (+ 1024.0 (sqrtf (* 245760.0 (+ 2048.0 f30-0))))) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-7 + ) + (vector-float*! gp-2 gp-2 (/ f0-9 f1-11)) + ) + ) + ) + ) + ) + ) + ) + (set! (-> self control dynam gravity-length) 122880.0) + (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) + (none) + ) + :exit + (behavior () + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + ((-> target-attack exit)) + (none) + ) + :trans + (behavior () + (when (logtest? (-> self control status) 1) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (go target-hit-ground #f) + ) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 150) + (set! + (-> self control dynam gravity-length) + (seek + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + (* 245760.0 (-> *display* seconds-per-frame)) + ) + ) + ) + (when + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 15) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control unknown-vector10) + ) + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 70) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + (level-hint-spawn + (game-text-id red-eco-tutorial) + "sksp0072" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (none) + ) + :code + (behavior ((arg0 symbol)) + (ja-channel-push! 1 22) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 56)) + ) + (set! + (-> a0-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 56)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 56)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 16 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 param 0) + (the float (+ (-> a0-5 frame-group data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 57)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (let ((f30-0 393216.0)) + (let ((f0-8 (target-height-above-ground)) + (f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (while + (not + (or + (and (< (fabs (/ f0-8 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 510) + ) + ) + (quaternion-rotate-y! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion00) + (* f30-0 (-> *display* seconds-per-frame)) + ) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (set! f0-8 (target-height-above-ground)) + (set! + f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 frame-group) + (the-as art-joint-anim (-> self draw art-group data 58)) + ) + (set! + (-> a0-13 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 58)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-13 frame-num) 0.0) + (joint-control-channel-group! + a0-13 + (the-as art-joint-anim (-> self draw art-group data 58)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (cond + ((< (ja-aframe-num 0) 32.0) + (quaternion-rotate-y! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion00) + (* f30-0 (-> *display* seconds-per-frame)) + ) + ) + (else + (let + ((f0-22 + (deg-diff + (quaternion-y-angle (-> self control unknown-quaternion00)) + (quaternion-y-angle (-> self control dir-targ)) + ) + ) + ) + (quaternion-rotate-y! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion00) + (* 0.2 (fabs f0-22)) + ) + ) + ) + ) + (suspend) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 param 0) + (the float (+ (-> a0-20 frame-group data 0 length) -1)) + ) + (set! (-> a0-20 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-20 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (go target-falling #f) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-attack-uppercut (target) + :event + target-dangerous-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (target-start-attack) + (target-danger-set! 'uppercut #f) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (none) + ) + :exit + target-exit + :code + (behavior ((arg0 float) (arg1 float)) + (let ((s3-0 (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + ) + (s4-0 (-> self skel root-channel 0)) + ) + (set! + (-> s4-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 62)) + ) + (set! (-> s4-0 param 0) (ja-aframe (the-as float 7.0) 0)) + (set! (-> s4-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s4-0 frame-num) (if s3-0 + (ja-aframe (the-as float 5.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + (joint-control-channel-group! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 62)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s4-1 (-> self skel root-channel 0))) + (set! (-> s4-1 param 0) (ja-aframe (the-as float 7.0) 0)) + (set! (-> s4-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-attack-uppercut-jump arg0 arg1) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-attack-uppercut-jump (target) + :event + target-dangerous-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (if + (and + (= (-> self control ground-pat material) (pat-material ice)) + (< 32768.0 (-> self control unknown-float01)) + ) + (set-forward-vel (the-as float 32768.0)) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *uppercut-jump-mods*) + (target-start-attack) + (target-danger-set! 'uppercut #f) + (none) + ) + :exit + target-exit + :trans + (behavior () + (if (logtest? (-> self control status) 1) + (go target-hit-ground #f) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 22118.4 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (build-conversions (-> self control transv)) + (go + target-flop + (the-as float 65502.96) + (the-as float -163840.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 62) + ) + (>= (ja-aframe-num 0) 12.0) + ) + (go target-attack-air 'uppercut) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 23) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + ) + (if + (and + (= (-> self control unknown-symbol30) 'uppercut) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + -8192.0 + ) + ) + (target-danger-set! 'harmless #f) + ) + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (TODO-RENAME-9 (-> self align)) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 param 0) + (the float (+ (-> a0-2 frame-group data 0 length) -1)) + ) + (set! (-> a0-2 param 1) 0.9) + (joint-control-channel-group-eval! + a0-2 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (TODO-RENAME-9 (-> self align)) + (let* ((gp-0 (-> self align)) + (s5-0 (method-of-object gp-0 TODO-RENAME-10)) + (a1-2 (cond + ((>= 30.0 (ja-aframe-num 0)) + 18 + ) + ((>= 43.0 (ja-aframe-num 0)) + (set! (-> self control unknown-surface00) *double-jump-mods*) + 2 + ) + (else + 0 + ) + ) + ) + ) + (s5-0 + gp-0 + a1-2 + (-> (new 'static 'array float 1 1.0) 0) + (the-as float 0.95) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (go target-falling #f) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-flop (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + (cond + (v0-0 + (empty) + v0-0 + ) + ((let ((v1-0 arg2)) + (= v1-0 'swim) + ) + (cond + ((< 6144.0 (target-height-above-ground)) + (dummy-10 + (-> self skel effect) + 'swim-flop + (-> (new 'static 'array float 1 -1.0) 0) + -1 + ) + (let ((t9-3 enter-state)) + (set! (-> self next-state) target-swim-down) + ((the-as (function object :behavior target) t9-3)) + ) + ) + (else + (let ((t9-4 enter-state) + (a0-4 'swim) + ) + (set! (-> self next-state) target-flop-hit-ground) + ((the-as (function symbol object :behavior target) t9-4) a0-4) + ) + ) + ) + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter + (behavior ((arg0 float) (arg1 float) (arg2 float)) + (if + (and + (= (-> self fact-info-target eco-type) 1) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (go target-yellow-jump-blast) + ) + (if (= arg2 0.0) + (set-forward-vel arg2) + (set-forward-vel (-> self control unknown-float01)) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *flop-mods*) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control dynam gravity-max) 245760.0) + (set! (-> self control dynam gravity-length) 245760.0) + (let ((gp-1 (new-stack-vector0))) + (let + ((f0-6 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-1 + (-> self control transv) + (vector-float*! gp-1 (-> self control dynam gravity-normal) f0-6) + ) + ) + (let* ((f0-7 (vector-length gp-1)) + (f1-3 f0-7) + (f2-0 29491.2) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-1 gp-1 (/ f0-7 f1-3)) + ) + ) + ) + (none) + ) + :exit + (behavior () + (target-danger-set! 'harmless #f) + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (set! + (-> self control dynam gravity quad) + (-> self control unknown-dynamics00 gravity quad) + ) + (none) + ) + :trans + (behavior () + (delete-back-vel) + (let ((gp-1 (logtest? (-> self control status) 1))) + (when (and (not gp-1) (let ((v1-6 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-6 (-> self draw art-group data 64)) + (= v1-6 (-> self draw art-group data 66)) + ) + ) + ) + (when + (and + (or + (< (target-move-dist 30) 1638.4) + (and + (logtest? (-> self control status) 8) + (< 0.7 (-> self control poly-angle)) + ) + ) + (zero? (logand (-> self control status) 32)) + (>= (-> self control unknown-uint20) (the-as uint 2)) + ) + (set! (-> self control unknown-dword36) (-> *display* base-frame-counter)) + (set! gp-1 'stuck) + ) + ) + (when gp-1 + (logior! (-> self control status) 1) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 150) + (dummy-10 + (-> self skel effect) + 'group-red-eco-strike-ground + (ja-frame-num 0) + 0 + ) + (let* ((s4-1 (get-process *default-dead-pool* touch-tracker #x4000)) + (s5-1 (when s4-1 + (let ((t9-6 (method-of-type touch-tracker activate))) + (t9-6 + (the-as touch-tracker s4-1) + self + 'touch-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s4-1 + touch-tracker-init + (-> self control trans) + 4096.0 + 30 + ) + (-> s4-1 ppointer) + ) + ) + ) + (send-event (ppointer->process s5-1) 'event 'attack 'flop) + (send-event (ppointer->process s5-1) 'function (lambda ((arg0 target)) + (let + ((f0-3 + (seek + (-> + arg0 + control + root-prim + local-sphere + w + ) + (the-as + float + 28672.0 + ) + (* + 286720.0 + (-> + *display* + seconds-per-frame + ) + ) + ) + ) + ) + (set! + (-> + arg0 + control + root-prim + local-sphere + w + ) + f0-3 + ) + f0-3 + ) + ) + ) + ) + ) + (go target-flop-hit-ground gp-1) + ) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + (if (rand-vu-percent? (the-as float 0.5)) + 23 + 17 + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + ) + (when + (and + (not (-> self control unknown-symbol30)) + (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 63) + ) + (>= (ja-aframe-num 0) 8.0) + ) + (target-start-attack) + (target-danger-set! 'flop #f) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 float)) + (ja-channel-set! 2) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 63)) + ) + (set! + (-> a0-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 63)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 63)) + num-func-seek! + ) + ) + (let ((a0-3 (-> self skel root-channel 1))) + (set! + (-> a0-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 66)) + ) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group-eval! + a0-3 + (the-as art-joint-anim (-> self draw art-group data 66)) + num-func-chan + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((gp-0 (-> self skel root-channel 1))) + (set! + (-> gp-0 frame-interp) + (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float01) + (-> (new 'static 'array float 1 0.0) 0) + (the-as float 40960.0) + ) + ) + (set! + (-> gp-0 param 0) + (the float (+ (-> gp-0 frame-group data 0 length) -1)) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (set! + (-> self control dynam gravity quad) + (-> self control unknown-dynamics00 gravity quad) + ) + (target-danger-set! 'flop-down #f) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 64)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (let ((gp-2 (-> self skel root-channel 1))) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 67)) + num-func-identity + ) + (set! (-> gp-2 frame-num) 0.0) + ) + (let ((f30-0 (-> (new 'static 'array float 1 1.0) 0))) + (let ((gp-3 (new-stack-vector0))) + (let + ((f0-18 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control unknown-vector120) + ) + ) + ) + 0.0 + (vector-! + gp-3 + (-> self control unknown-vector120) + (vector-float*! gp-3 (-> self control dynam gravity-normal) f0-18) + ) + ) + (let* ((f0-19 (vector-length gp-3)) + (f1-1 f0-19) + (f2-0 -368640.0) + ) + (vector+! + (-> self control unknown-vector120) + (vector-float*! + (-> self control unknown-vector120) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-3 gp-3 (/ f0-19 f1-1)) + ) + ) + ) + (let ((gp-4 (new-stack-vector0))) + (let + ((f0-22 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-4 + (-> self control transv) + (vector-float*! gp-4 (-> self control dynam gravity-normal) f0-22) + ) + ) + (let* ((f0-23 (vector-length gp-4)) + (f1-3 f0-23) + (f2-2 (* -368640.0 f30-0)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-2 + ) + (vector-float*! gp-4 gp-4 (/ f0-23 f1-3)) + ) + ) + ) + (suspend) + (while #t + (+! (-> self control unknown-uint20) 1) + (let ((a0-30 (-> self skel root-channel 0))) + (set! (-> a0-30 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-30 + (the-as art-joint-anim #f) + num-func-+! + ) + ) + (let ((gp-5 (-> self skel root-channel 1))) + (set! + (-> gp-5 frame-interp) + (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float01) + (-> (new 'static 'array float 1 0.0) 0) + (the-as float 40960.0) + ) + ) + (set! (-> gp-5 param 0) 0.0) + (joint-control-channel-group-eval! + gp-5 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + (let ((gp-6 (new-stack-vector0)) + (f28-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-6 + (-> self control transv) + (vector-float*! gp-6 (-> self control dynam gravity-normal) f28-0) + ) + (let* ((f1-5 (vector-length gp-6)) + (f0-34 f1-5) + ) + (if (< (-> self control unknown-surface01 transv-max) f1-5) + (set! f1-5 (-> self control unknown-surface01 transv-max)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f28-0 + ) + (vector-float*! gp-6 gp-6 (/ f1-5 f0-34)) + ) + ) + ) + (if + (>= + (- (-> *display* base-frame-counter) (-> self state-time)) + (the-as int (-> *TARGET-bank* fall-timeout)) + ) + (go target-falling #f) + ) + (if + (and + (= *cheat-mode* 'debug) + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons r2) + ) + (not *pause-lock*) + ) + (go target-falling #f) + ) + (suspend) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-flop-hit-ground (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('swim) + #f + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior ((arg0 symbol)) + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector111) + (-> self control trans) + ) + ) + ) + ) + (if (< (-> *TARGET-bank* fall-far) f0-1) + (go target-hit-ground-hard f0-1) + ) + ) + (target-land-effect) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 30) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-uint20) (the-as uint arg0)) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + (set! (-> self control unknown-surface00) *flop-land-mods*) + (set! (-> *flop-land-mods* flags) (logand -1025 (-> *flop-land-mods* flags))) + (set! (-> self state-flags) (logior #x100000 (-> self state-flags))) + (none) + ) + :exit + target-exit + :trans + (behavior () + (when (!= (-> self control unknown-spoolanim00) 'stuck) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack-air 'flop) + ) + ) + (when + (and + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 75) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + (if (rand-vu-percent? (the-as float 0.5)) + 23 + 17 + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + ) + (let ((v1-33 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (if + (and + (or + (= v1-33 (-> self draw art-group data 65)) + (= v1-33 (-> self draw art-group data 68)) + ) + (>= (ja-aframe-num 0) 28.0) + ) + (logior! (-> *flop-land-mods* flags) 1024) + ) + ) + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 symbol)) + (target-hit-ground-anim arg0) + (go target-falling #f) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-wheel (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (= arg2 'touched) + (send-event arg0 'roll) + ) + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *wheel-mods*) + (+! (-> self control unknown-int50) 1) + (rot->dir-targ! (-> self control)) + (set-forward-vel + (+ + (-> *TARGET-bank* wheel-speed-min) + (* + (-> *TARGET-bank* wheel-speed-inc) + (the float (+ (-> self control unknown-int50) -1)) + ) + ) + ) + (if + (or + (< (fabs (-> self control unknown-float62)) 0.3) + (< 0.3 (fabs (-> self control unknown-float61))) + ) + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control unknown-int21) 0) + 0 + (none) + ) + :exit + (behavior () + (when (!= (-> self next-state name) 'target-wheel) + (set! (-> self control unknown-int50) 0) + (set! (-> self control unknown-dword30) (-> *display* base-frame-counter)) + ) + (target-exit) + (none) + ) + :code + (behavior () + (let ((gp-0 0)) + 0 + (let ((s5-0 0) + (f30-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (ja-channel-push! 1 12) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 69)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (until (ja-done? 0) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (set! gp-0 (-> *display* base-frame-counter)) + ) + (when + (and + (or (smack-surface? #f) (>= (-> self control unknown-float63) 0.7)) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 3) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 1) + ) + (if (>= 6.0 (ja-aframe-num 0)) + (target-shoved + (-> *TARGET-bank* smack-surface-dist) + (-> *TARGET-bank* smack-surface-height) + (the-as process #f) + (the-as (state target) target-hit) + ) + ) + (if (zero? s5-0) + (set! s5-0 (-> *display* base-frame-counter)) + ) + ) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (-> *display* base-frame-counter) + ) + (TODO-RENAME-9 (-> self align)) + (cond + ((nonzero? s5-0) + ) + (else + (TODO-RENAME-10 + (-> self align) + 4 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + f30-0 + ) + (let ((s4-1 (new-stack-vector0))) + (vector-matrix*! + s4-1 + (-> self control transv) + (-> self control unknown-matrix00) + ) + (set! (-> s4-1 y) 0.0) + (vector-matrix*! + (-> self control unknown-vector120) + s4-1 + (-> self control unknown-matrix01) + ) + ) + ) + ) + (suspend) + (let ((a0-15 (-> self skel root-channel 0))) + (set! + (-> a0-15 param 0) + (the float (+ (-> a0-15 frame-group data 0 length) -1)) + ) + (set! (-> a0-15 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-15 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + ) + ) + (if + (and + (or + (< + (- (-> *display* base-frame-counter) gp-0) + (the-as int (-> *TARGET-bank* wheel-jump-pre-window)) + ) + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + ) + (can-jump? 'target-wheel-flip) + ) + (go + target-wheel-flip + (-> *TARGET-bank* wheel-flip-height) + (-> *TARGET-bank* wheel-flip-dist) + ) + ) + ) + (set! + (-> self state-hook-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self state-hook) (lambda :behavior target () (cond + ((>= + (- + (-> + *display* + base-frame-counter + ) + (the-as + int + (-> + self + state-hook-time + ) + ) + ) + (the-as + int + (-> + *TARGET-bank* + wheel-jump-post-window + ) + ) + ) + (set! + (-> + self + state-hook + ) + (the-as + (function none :behavior target) + nothing + ) + ) + ) + (else + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? + 'target-wheel-flip + ) + ) + (go + target-wheel-flip + (-> + *TARGET-bank* + wheel-flip-height + ) + (-> + *TARGET-bank* + wheel-flip-dist + ) + ) + ) + ) + ) + (none) + ) + ) + (go target-duck-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-wheel-flip (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (set! (-> self control unknown-surface00) *wheel-flip-mods*) + (none) + ) + :exit + target-exit + :trans + (behavior () + (if + (and + (or + (smack-surface? #f) + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + ) + (!= (-> self state-time) (-> *display* base-frame-counter)) + ) + (target-shoved + (-> *TARGET-bank* smack-surface-dist) + (-> *TARGET-bank* smack-surface-height) + (the-as process #f) + (the-as (state target) target-hit) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + (go target-attack-air #f) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 1 12) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 71)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((f30-0 (-> (new 'static 'array float 1 1.0) 0))) + (until + (or + (ja-max? 0) + (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) 1)) + ) + (when + (and + (>= (ja-aframe-num 0) (-> (new 'static 'array float 1 3.0) 0)) + (not (-> self control unknown-symbol30)) + ) + (set! (-> self event-hook) target-dangerous-event-handler) + (target-start-attack) + (target-danger-set! 'flip #f) + ) + (TODO-RENAME-9 (-> self align)) + (if (not (ja-max? 0)) + (TODO-RENAME-10 + (-> self align) + 6 + (-> (new 'static 'array float 1 1.0) 0) + (/ arg0 (-> *TARGET-bank* wheel-flip-art-height)) + (* f30-0 (/ arg1 (-> *TARGET-bank* wheel-flip-art-dist))) + ) + (TODO-RENAME-10 + (-> self align) + 4 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (* f30-0 (/ arg1 (-> *TARGET-bank* wheel-flip-art-dist))) + ) + ) + (let ((s4-1 (new-stack-vector0))) + (vector-matrix*! + s4-1 + (-> self control transv) + (-> self control unknown-matrix00) + ) + (set! (-> s4-1 y) 0.0) + (vector-matrix*! + (-> self control unknown-vector120) + s4-1 + (-> self control unknown-matrix01) + ) + ) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! + (-> a0-11 param 0) + (the float (+ (-> a0-11 frame-group data 0 length) -1)) + ) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-11 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (while (zero? (logand (-> self control status) 1)) + (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) 3) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + ) + (ja-channel-push! 1 30) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + ) + ) + (let ((gp-2 (new-stack-vector0)) + (f30-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-2 + (-> self control transv) + (vector-float*! gp-2 (-> self control dynam gravity-normal) f30-1) + ) + (let* ((f1-6 (vector-length gp-2)) + (f0-21 f1-6) + (f1-7 (* 0.9 f1-6)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f30-1 + ) + (vector-float*! gp-2 gp-2 (/ f1-7 f0-21)) + ) + ) + ) + (suspend) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + (let ((a0-35 (-> self skel root-channel 0))) + (set! (-> a0-35 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-35 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + (else + (let ((v1-85 (-> self skel root-channel 0))) + (set! (-> v1-85 num-func) num-func-identity) + (set! + (-> v1-85 frame-num) + (the float (+ (-> v1-85 frame-group data 0 length) -1)) + ) + ) + ) + ) + ) + (target-land-effect) + (set! + (-> self state-hook-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self state-hook) (lambda :behavior target () (cond + ((>= + (- + (-> + *display* + base-frame-counter + ) + (the-as + int + (-> + self + state-hook-time + ) + ) + ) + 30 + ) + (set! + (-> + self + state-hook + ) + (the-as + (function none :behavior target) + nothing + ) + ) + ) + (else + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-high-jump + (-> + *TARGET-bank* + flip-jump-height-min + ) + (-> + *TARGET-bank* + flip-jump-height-max + ) + 'flip + ) + ) + ) + ) + (none) + ) + ) + (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + (go target-hit-ground #f) + (go target-stance) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + + + -;; TODO - for target-snowball -(define-extern target-jump (state float float symbol target)) diff --git a/goal_src/engine/target/target2.gc b/goal_src/engine/target/target2.gc index 7dcebc22f0..26b9cd86d4 100644 --- a/goal_src/engine/target/target2.gc +++ b/goal_src/engine/target/target2.gc @@ -5,5 +5,5941 @@ ;; name in dgo: target2 ;; dgos: GAME, ENGINE -;; TODO - for final-door -(define-extern target-grab (state target)) +(declare-type first-person-hud process) +(define-extern hud-waiting (state first-person-hud)) ;; unknown type +(define-extern hud-normal (state first-person-hud)) ;; unknown type +(define-extern hud-coming-in (state first-person-hud)) ;; unknown type +(define-extern hud-going-out (state first-person-hud)) ;; unknown type + +(define-extern target-final-door (state basic handle target)) ;; unknown type + +(define-extern target-pole-flip-up (state object object float target)) ;; unknown type +(define-extern target-pole-flip-forward (state float float float target)) ;; unknown type +(define-extern target-pole-flip-up-jump (state float float target)) ;; unknown type +(define-extern target-pole-flip-forward-jump (state float float target)) ;; unknown type +(define-extern target-edge-grab-jump (state float float target)) ;; unknown type +(define-extern target-edge-grab-off (state target)) ;; unknown type +(define-extern target-swim-stance (state target)) ;; unknown type +(define-extern target-swim-jump (state float float target)) ;; unknown type +(define-extern target-swim-walk (state target)) ;; unknown type +(define-extern target-swim-up (state target)) ;; unknown type +(define-extern target-swim-jump-jump (state float float surface target)) ;; unknown type + +;; DECOMP BEGINS + +(defstate target-load-wait (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('loading) + (set! (-> self state-time) (-> *display* base-frame-counter)) + #f + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :exit + target-exit + :code + (behavior () + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (while (< (- (-> *display* base-frame-counter) (-> self state-time)) 15) + (ja-channel-push! 1 30) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 112)) + ) + (set! + (-> a0-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 112)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-2 param 1) 1.0) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 112)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 4 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + (send-event + *camera* + 'joystick + (-> (new 'static 'array int32 1 0) 0) + (-> (new 'static 'array int32 1 0) 0) + ) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-0 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-0) 90) + (suspend) + (let ((s5-0 (-> self skel root-channel 0))) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 19.0) 0)) + (set! (-> s5-0 param 1) 0.05) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + ) + (ja-channel-push! 1 90) + (let ((gp-1 (-> self skel root-channel 0))) + (set! + (-> gp-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 36)) + ) + (set! + (-> gp-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 36)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-1 param 1) 1.0) + (set! (-> gp-1 frame-num) (ja-aframe (the-as float 40.0) 0)) + (joint-control-channel-group! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 36)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 param 0) + (the float (+ (-> a0-13 frame-group data 0 length) -1)) + ) + (set! (-> a0-13 param 1) 1.0) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-15 (-> self skel root-channel 0))) + (set! + (-> a0-15 frame-group) + (the-as art-joint-anim (-> self draw art-group data 37)) + ) + (set! + (-> a0-15 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 37)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-15 param 1) 1.0) + (set! (-> a0-15 frame-num) 0.0) + (joint-control-channel-group! + a0-15 + (the-as art-joint-anim (-> self draw art-group data 37)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! + (-> a0-16 param 0) + (the float (+ (-> a0-16 frame-group data 0 length) -1)) + ) + (set! (-> a0-16 param 1) 1.0) + (joint-control-channel-group-eval! + a0-16 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (go target-stance) + (none) + ) + :post + target-no-stick-post + ) + +(defstate target-stance-ambient (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('movie) + (go target-stance) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self neck flex-blend) 0.0) + ((-> target-stance enter)) + (let ((v1-2 (rand-vu-int-count 4))) + (cond + ((zero? v1-2) + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-1" + :index #xe7 + :parts 1 + :command-list '() + ) + ) + ) + ) + ((= v1-2 1) + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-2" + :index #xe8 + :parts 1 + :command-list '() + ) + ) + ) + ) + ((= v1-2 2) + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-3" + :index #xe9 + :parts 1 + :command-list '() + ) + ) + ) + ) + (else + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-4" + :index #xea + :parts 1 + :command-list '() + ) + ) + ) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :exit + (behavior () + (let ((a0-0 (-> self control unknown-spoolanim00))) + (when a0-0 + (ja-abort-spooled-anim a0-0 (the-as art-joint-anim #f) -1) + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 5)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + ) + ((-> target-stance exit)) + (target-exit) + (none) + ) + :trans + (behavior () + (spool-push + *art-control* + (-> self control unknown-spoolanim00 name) + 0 + self + (the-as float -99.0) + ) + (if + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons start l1 r1 triangle circle x square) + ) + *progress-process* + ) + (go target-stance) + ) + (none) + ) + :code + (behavior () + (while + (let + ((v1-13 + (file-status *art-control* (-> self control unknown-spoolanim00 name) 0) + ) + ) + (not (or (= v1-13 'locked) (= v1-13 'active))) + ) + (suspend) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 1.0) + (joint-control-channel-group-eval! + a0-0 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((a0-1 (-> self skel root-channel 1))) + (set! (-> a0-1 param 0) 0.0) + (joint-control-channel-group-eval! + a0-1 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-2 (-> self skel root-channel 2))) + (set! (-> a0-2 param 0) 0.0) + (joint-control-channel-group-eval! + a0-2 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + (ja-play-spooled-anim + (-> self control unknown-spoolanim00) + (the-as art-joint-anim (-> self draw art-group data 5)) + (the-as art-joint-anim (-> self draw art-group data 5)) + (the-as (function process-drawable symbol) (lambda () + (!= + (-> + *cpad-list* + cpads + 0 + stick0-speed + ) + 0.0 + ) + ) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint #f)) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(deftype first-person-hud (process) + ((max-nb-of-particles int32 :offset-assert 112) + (nb-of-particles int32 :offset-assert 116) + (particles hud-particle 3 :offset-assert 120) + (in-out-position int32 :offset-assert 132) + (sides-x-scale float :offset-assert 136) + (sides-y-scale float :offset-assert 140) + (x-offset int32 :offset-assert 144) + ) + :heap-base #x30 + :method-count-assert 15 + :size-assert #x94 + :flag-assert #xf00300094 + (:methods + (dumb-15 (_type_) none 14) + ) + ) + + +(define *fp-hud-stack* (malloc 'global #x3800)) + +(defmethod deactivate first-person-hud ((obj first-person-hud)) + (dotimes (s5-0 (-> obj nb-of-particles)) + (kill-and-free-particles (-> obj particles s5-0 part)) + (set! (-> obj particles s5-0 part matrix) -1) + ) + (enable-hud) + (set! (-> *target* fp-hud) (the-as handle #f)) + ((the-as (function process none) (find-parent-method first-person-hud 10)) + obj + ) + (none) + ) + +(defbehavior first-person-hud-init-by-other first-person-hud () + (logclear! (-> self mask) (process-mask pause)) + (set! (-> self nb-of-particles) 0) + (set! (-> self max-nb-of-particles) 3) + (set! (-> self in-out-position) 4096) + (when (< (-> self nb-of-particles) (-> self max-nb-of-particles)) + (let ((gp-0 (-> self nb-of-particles))) + (set! (-> self particles gp-0) (new 'static 'hud-particle)) + (set! + (-> self particles gp-0 part) + (create-launch-control (-> *part-group-id-table* 611) self) + ) + (set! (-> self particles gp-0 init-pos x) -320.0) + (set! (-> self particles gp-0 init-pos y) 254.0) + (set! (-> self particles gp-0 init-pos z) 15.0) + (set! (-> self particles gp-0 part matrix) -1) + ) + (+! (-> self nb-of-particles) 1) + ) + (when (< (-> self nb-of-particles) (-> self max-nb-of-particles)) + (let ((gp-1 (-> self nb-of-particles))) + (set! (-> self particles gp-1) (new 'static 'hud-particle)) + (set! + (-> self particles gp-1 part) + (create-launch-control (-> *part-group-id-table* 612) self) + ) + (set! (-> self particles gp-1 init-pos x) -320.0) + (set! (-> self particles gp-1 init-pos y) 192.0) + (set! (-> self particles gp-1 init-pos z) 15.0) + (set! (-> self particles gp-1 part matrix) -1) + ) + (+! (-> self nb-of-particles) 1) + ) + (when (< (-> self nb-of-particles) (-> self max-nb-of-particles)) + (let ((gp-2 (-> self nb-of-particles))) + (set! (-> self particles gp-2) (new 'static 'hud-particle)) + (set! + (-> self particles gp-2 part) + (create-launch-control (-> *part-group-id-table* 613) self) + ) + (set! (-> self particles gp-2 init-pos x) 256.0) + (set! (-> self particles gp-2 init-pos y) 244.0) + (set! (-> self particles gp-2 init-pos z) 15.0) + (set! (-> self particles gp-2 part matrix) -1) + ) + (+! (-> self nb-of-particles) 1) + ) + (case (get-aspect-ratio) + (('aspect4x3) + (set! (-> self sides-x-scale) 3.5) + (set! (-> self sides-y-scale) 13.0) + (set! (-> self x-offset) 0) + 0 + ) + (('aspect16x9) + (set! (-> self sides-x-scale) 2.8) + (set! (-> self sides-y-scale) 9.75) + (set! (-> self x-offset) 12) + ) + ) + (set! (-> self event-hook) (-> hud-waiting event)) + (go hud-waiting) + (none) + ) + +(defmethod relocate first-person-hud ((obj first-person-hud) (arg0 int)) + (dotimes (v1-0 (-> obj nb-of-particles)) + (when (-> obj particles v1-0 part) + (if (nonzero? (-> obj particles v1-0 part)) + (&+! (-> obj particles v1-0 part) arg0) + ) + ) + ) + (the-as first-person-hud ((method-of-type process relocate) obj arg0)) + ) + +(defmethod dumb-15 first-person-hud ((obj first-person-hud)) + (dotimes (s5-0 (-> obj nb-of-particles)) + (set! + (-> obj particles s5-0 pos x) + (+ -256.0 (-> obj particles s5-0 init-pos x)) + ) + (set! + (-> obj particles s5-0 pos y) + (* + 0.5 + (- + (* (-> obj particles s5-0 init-pos y) (-> *video-parms* relative-y-scale)) + (the float (-> *video-parms* screen-sy)) + ) + ) + ) + (set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z)) + (if (> (-> obj particles s5-0 part matrix) 0) + (set-vector! + (sprite-get-user-hvdf (-> obj particles s5-0 part matrix)) + (the float (+ (the int (-> obj particles s5-0 pos x)) 2048)) + (the float (+ (the int (-> obj particles s5-0 pos y)) 2048)) + (- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z))) + (-> *math-camera* hvdf-off w) + ) + ) + (spawn (-> obj particles s5-0 part) *null-vector*) + ) + 0 + (none) + ) + +(defstate hud-waiting (first-person-hud) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('go-away) + (go hud-going-out) + ) + ) + ) + :enter + (behavior () + (disable-hud (the-as int (-> *hud-parts* power))) + (none) + ) + :code + (behavior () + (while #t + (dotimes (gp-0 (-> self nb-of-particles)) + (if (= (-> self particles gp-0 part matrix) -1) + (set! (-> self particles gp-0 part matrix) (sprite-allocate-user-hvdf)) + ) + ) + (set-setting! + *setting-control* + self + 'common-page + 'set + (the-as float (-> (new 'static 'array int32 1 0) 0)) + 1 + ) + (suspend) + (go hud-coming-in) + (suspend) + ) + (none) + ) + ) + +(defstate hud-coming-in (first-person-hud) + :event + (-> hud-waiting event) + :code + (behavior () + (while #t + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 0 + (the int (* 350.0 (-> *display* time-adjust-ratio))) + ) + ) + (if (zero? (-> self in-out-position)) + (go hud-normal) + ) + (suspend) + ) + (none) + ) + :post + (behavior () + (dumb-15 self) + (none) + ) + ) + +(defstate hud-normal (first-person-hud) + :event + (-> hud-waiting event) + :code + (behavior () + (while #t + (if + (or + (not *progress-process*) + (= (-> *progress-process* 0 next-state name) 'progress-going-out) + (= (-> *progress-process* 0 next-state name) 'progress-gone) + ) + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 0 + (the int (* 150.0 (-> *display* time-adjust-ratio))) + ) + ) + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 4096 + (the int (* 200.0 (-> *display* time-adjust-ratio))) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +(defstate hud-going-out (first-person-hud) + :code + (behavior () + (while #t + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 4096 + (the int (* 350.0 (-> *display* time-adjust-ratio))) + ) + ) + (if (= (-> self in-out-position) 4096) + (deactivate self) + ) + (suspend) + ) + (none) + ) + :post + (behavior () + (dumb-15 self) + (none) + ) + ) + +(defun + part-first-person-hud-left-func + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (let ((s5-0 (handle->process (-> *target* fp-hud)))) + (when s5-0 + (let + ((f30-0 + (* + 0.00024414062 + (the float (-> (the-as first-person-hud s5-0) in-out-position)) + ) + ) + ) + (if (or (-> *setting-control* current movie) (movie?)) + (set! f30-0 1.0) + ) + (if (< 0.25 f30-0) + (set! f30-0 1.0) + (* 4.0 f30-0) + ) + (set! + (-> (the-as first-person-hud s5-0) particles 0 init-pos x) + (the float (- 59 (-> (the-as first-person-hud s5-0) x-offset))) + ) + (set! + (-> arg2 vector 0 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-x-scale) (* 10.0 f30-0)) + ) + ) + (set! + (-> arg2 vector 1 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-y-scale) (* 10.0 f30-0)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defun + part-first-person-hud-right-func + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (let ((s5-0 (handle->process (-> *target* fp-hud)))) + (when s5-0 + (let + ((f30-0 + (* + 0.00024414062 + (the float (-> (the-as first-person-hud s5-0) in-out-position)) + ) + ) + ) + (if (or (-> *setting-control* current movie) (movie?)) + (set! f30-0 1.0) + ) + (if (< 0.25 f30-0) + (set! f30-0 1.0) + (* 4.0 f30-0) + ) + (set! + (-> (the-as first-person-hud s5-0) particles 1 init-pos x) + (the float (+ (-> (the-as first-person-hud s5-0) x-offset) 452)) + ) + (set! + (-> arg2 vector 0 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-x-scale) (* 10.0 f30-0)) + ) + ) + (set! + (-> arg2 vector 1 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-y-scale) (* 10.0 f30-0)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defun + part-first-person-hud-selector-func + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (let ((v1-2 (handle->process (-> *target* fp-hud)))) + (when v1-2 + (let + ((f30-0 + (* + 0.00024414062 + (the float (-> (the-as first-person-hud v1-2) in-out-position)) + ) + ) + ) + (if (or (-> *setting-control* current movie) (movie?)) + (set! f30-0 1.0) + ) + (if (< 0.5 f30-0) + (set! f30-0 1.0) + (* 2.0 f30-0) + ) + (set! (-> arg2 vector 2 w) (- 64.0 (* 64.0 f30-0))) + ) + ) + ) + 0 + (none) + ) + +;; ERROR: function was not converted to expressions. Cannot decompile. + +(defstate target-stance-look-around (target) + :event + target-standard-event-handler + :enter + (-> target-stance enter) + :exit + (-> target-stance exit) + :trans + (-> target-stance trans) + :code + (behavior () + (while (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'dist-from-interp-src) + (and + (< (send-event-function *camera* a1-0) 4915.2) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 21) + (zero? (ja-group-size)) + ) + ) + (suspend) + ) + (let ((v1-8 target-stance)) + (set! (-> self next-state) v1-8) + (set! (-> self state) v1-8) + ) + ((the-as (function none :behavior target) (-> target-stance code))) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-look-around (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + ((let ((v1-4 arg2)) + (= v1-4 'end-mode) + ) + (go target-stance-look-around) + ) + ((-> self control unknown-symbol30) + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self cam-user-mode) 'look-around) + (set! (-> self control unknown-surface00) *duck-mods*) + (logior! (-> self state-flags) 512) + (send-event *camera* 'blend-from-as-fixed) + (send-event *camera* 'no-intro) + (camera-change-to (the-as string 'cam-eye) 60 #f) + (let ((a0-5 (handle->process (-> self fp-hud)))) + (if a0-5 + (deactivate a0-5) + ) + ) + (let ((gp-0 (get-process *default-dead-pool* first-person-hud #x4000))) + (set! (-> self fp-hud) (ppointer->handle (when gp-0 + (let + ((t9-5 + (method-of-type + first-person-hud + activate + ) + ) + ) + (t9-5 + (the-as first-person-hud gp-0) + *dproc* + 'first-person-hud + (&+ *fp-hud-stack* #x3800) + ) + ) + (run-now-in-process + gp-0 + first-person-hud-init-by-other + ) + (-> gp-0 ppointer) + ) + ) + ) + ) + (none) + ) + :exit + (behavior () + (let ((a0-1 (handle->process (-> self fp-hud)))) + (if a0-1 + (send-event a0-1 'go-away) + ) + ) + (set! (-> self cam-user-mode) 'normal) + (target-exit) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query-state) + (set! (-> a1-2 param 0) (the-as uint cam-eye)) + (when (send-event-function *camera* a1-2) + (send-event *camera* 'no-intro) + (send-event *camera* 'force-blend 60) + (send-event *camera* 'clear-entity) + (camera-change-to (the-as string 'base) 60 #f) + ) + ) + (none) + ) + :trans + (behavior () + (local-vars (sv-48 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons r2 circle square) + ) + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) + 150 + ) + (not *pause-lock*) + ) + (let + ((gp-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + (the-as float (-> *TARGET-bank* yellow-projectile-speed)) + ) + ) + (s5-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + 8192.0 + ) + ) + ) + (vector+float*! + s5-1 + s5-1 + (-> *math-camera* inv-camera-rot vector 1) + (the-as float -2048.0) + ) + (let ((s4-0 (get-process *default-dead-pool* projectile-yellow #x4000))) + (when s4-0 + (let ((t9-2 (method-of-type projectile-yellow activate))) + (t9-2 + (the-as projectile-yellow s4-0) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (let ((s3-0 run-function-in-process) + (s2-0 s4-0) + (s1-0 projectile-init-by-other) + (s0-0 (-> self entity)) + ) + (set! sv-48 s5-1) + (let ((v0-3 (camera-pos))) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> v0-3 quad)) + ) + (.lvf vf5 (&-> s5-1 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-48 quad) vf6) + (let + ((t1-0 + (if + (>= + (-> self fact-info-target eco-level) + (-> *FACT-bank* eco-level-max) + ) + 56 + 40 + ) + ) + (t2-0 #f) + ) + ((the-as + (function object object object object object object object none) + s3-0 + ) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + t1-0 + t2-0 + ) + ) + ) + (-> s4-0 ppointer) + ) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + ) + (when + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons triangle) + ) + (logclear! + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons triangle) + ) + (logclear! + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons triangle) + ) + (set! (-> self cam-user-mode) 'normal) + ) + (none) + ) + ) + :code + (behavior () + (while (let ((f30-0 8192.0) + (a1-0 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'dist-from-interp-dest) + (< f30-0 (send-event-function *camera* a1-0)) + ) + (if (!= (-> self cam-user-mode) 'look-around) + (go target-stance) + ) + (suspend) + ) + (ja-channel-set! 0) + (set! (-> self control transv quad) (the-as uint128 0)) + (while #t + (if (!= (-> self cam-user-mode) 'look-around) + (go target-stance-look-around) + ) + (suspend) + ) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-billy-game (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + ((let ((v1-4 arg2)) + (= v1-4 'end-mode) + ) + (go target-stance) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *duck-mods*) + (logior! (-> self state-flags) 512) + (send-event *camera* 'blend-from-as-fixed) + (send-event *camera* 'clear-entity) + (send-event *camera* 'no-intro) + (camera-change-to (the-as string 'cam-billy) 0 #f) + (let ((a0-6 (handle->process (-> self fp-hud)))) + (if a0-6 + (deactivate a0-6) + ) + ) + (let ((gp-0 (get-process *default-dead-pool* first-person-hud #x4000))) + (set! (-> self fp-hud) (ppointer->handle (when gp-0 + (let + ((t9-6 + (method-of-type + first-person-hud + activate + ) + ) + ) + (t9-6 + (the-as first-person-hud gp-0) + *dproc* + 'first-person-hud + (&+ *fp-hud-stack* #x3800) + ) + ) + (run-now-in-process + gp-0 + first-person-hud-init-by-other + ) + (-> gp-0 ppointer) + ) + ) + ) + ) + (none) + ) + :exit + (behavior () + (let ((a0-1 (handle->process (-> self fp-hud)))) + (if a0-1 + (send-event a0-1 'go-away) + ) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query-state) + (set! (-> a1-2 param 0) (the-as uint cam-billy)) + (when (send-event-function *camera* a1-2) + (send-event *camera* 'no-intro) + (send-event *camera* 'force-blend 0) + (camera-change-to (the-as string 'base) 0 #f) + ) + ) + (target-exit) + (none) + ) + :trans + (behavior () + (local-vars (sv-48 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons r2 circle square) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) + 135 + ) + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (not *pause-lock*) + ) + (let + ((gp-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + (the-as float (-> *TARGET-bank* yellow-projectile-speed)) + ) + ) + (s5-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + 8192.0 + ) + ) + ) + (vector+float*! + s5-1 + s5-1 + (-> *math-camera* inv-camera-rot vector 1) + (the-as float -2048.0) + ) + (let ((s4-0 (get-process *default-dead-pool* projectile-yellow #x4000))) + (when s4-0 + (let ((t9-2 (method-of-type projectile-yellow activate))) + (t9-2 + (the-as projectile-yellow s4-0) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (let ((s3-0 run-function-in-process) + (s2-0 s4-0) + (s1-0 projectile-init-by-other) + (s0-0 (-> self entity)) + ) + (set! sv-48 s5-1) + (let ((v0-4 (camera-pos))) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> v0-4 quad)) + ) + (.lvf vf5 (&-> s5-1 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-48 quad) vf6) + (let + ((t1-0 + (if + (>= + (-> self fact-info-target eco-level) + (-> *FACT-bank* eco-level-max) + ) + 120 + 104 + ) + ) + (t2-0 #f) + ) + ((the-as + (function object object object object object object object none) + s3-0 + ) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + t1-0 + t2-0 + ) + ) + ) + (-> s4-0 ppointer) + ) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + ) + (none) + ) + ) + :code + (behavior () + (ja-channel-set! 0) + (set! (-> self control transv quad) (the-as uint128 0)) + (anim-loop) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-grab (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + (else + (case arg2 + (('end-mode) + (go target-stance) + ) + (('play-anim) + (let ((v0-0 (the-as object (-> arg3 param 0)))) + (set! (-> self control unknown-uint20) (the-as uint v0-0)) + v0-0 + ) + ) + (('clone-anim) + (go + target-clone-anim + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (('change-mode) + (case (-> arg3 param 0) + (('final-door) + (go + target-final-door + (the-as basic (process->handle (the-as process (-> arg3 param 1)))) + (process->handle (the-as process (-> arg3 param 2))) + ) + ) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :enter + (behavior () + (set! (-> self control unknown-surface00) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self state-flags) 272) + (set! (-> self control unknown-uint20) (the-as uint 'stance)) + (none) + ) + :exit + (behavior () + (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (target-exit) + (none) + ) + :code + (behavior () + (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) + (let ((gp-0 0)) + (while (zero? (logand (-> self control status) 1)) + (target-falling-anim-trans) + (+! + gp-0 + (- + (-> *display* base-frame-counter) + (-> *display* old-base-frame-counter) + ) + ) + (suspend) + ) + (if (or (> gp-0 0) (let ((v1-11 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-11 (-> self draw art-group data 34)) + (= v1-11 (-> self draw art-group data 38)) + (= v1-11 (-> self draw art-group data 42)) + (= v1-11 (-> self draw art-group data 43)) + (= v1-11 (-> self draw art-group data 41)) + ) + ) + ) + (target-hit-ground-anim #f) + ) + ) + (-> self control unknown-spoolanim00) + (while #t + (let ((gp-1 (-> self control unknown-spoolanim00))) + (case gp-1 + (('stance) + (cond + ((or (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (< 0.5 (-> self skel root-channel 6 frame-interp)) + ) + (let ((v1-32 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-32 (-> self draw art-group data 28)) + (= v1-32 (-> self draw art-group data 29)) + (= v1-32 (-> self draw art-group data 54)) + (= v1-32 (-> self draw art-group data 55)) + ) + ) + ) + (ja-channel-push! 1 45) + (let ((a0-39 (-> self skel root-channel 0))) + (set! + (-> a0-39 frame-group) + (the-as art-joint-anim (-> self draw art-group data 4)) + ) + (set! + (-> a0-39 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 4)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-39 param 1) 1.0) + (set! (-> a0-39 frame-num) 0.0) + (joint-control-channel-group! + a0-39 + (the-as art-joint-anim (-> self draw art-group data 4)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-40 (-> self skel root-channel 0))) + (set! + (-> a0-40 param 0) + (the float (+ (-> a0-40 frame-group data 0 length) -1)) + ) + (set! (-> a0-40 param 1) 1.0) + (joint-control-channel-group-eval! + a0-40 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-42 (-> self skel root-channel 0))) + (set! + (-> a0-42 frame-group) + (the-as art-joint-anim (-> self draw art-group data 3)) + ) + (set! + (-> a0-42 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 3)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-42 param 1) 1.0) + (set! (-> a0-42 frame-num) 0.0) + (joint-control-channel-group! + a0-42 + (the-as art-joint-anim (-> self draw art-group data 3)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-43 (-> self skel root-channel 0))) + (set! + (-> a0-43 param 0) + (the float (+ (-> a0-43 frame-group data 0 length) -1)) + ) + (set! (-> a0-43 param 1) 1.0) + (joint-control-channel-group-eval! + a0-43 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (ja-channel-push! 1 45) + ) + ((let ((v1-87 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (and + (or + (= v1-87 (-> self draw art-group data 39)) + (= v1-87 (-> self draw art-group data 35)) + ) + (not (ja-max? 0)) + ) + ) + (let ((a0-54 (-> self skel root-channel 0))) + (set! + (-> a0-54 param 0) + (the float (+ (-> a0-54 frame-group data 0 length) -1)) + ) + (set! (-> a0-54 param 1) 1.0) + (joint-control-channel-group! + a0-54 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (ja-channel-push! 1 22) + ) + ((not (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 5) + ) + (= (ja-group-size) 1) + ) + ) + (ja-channel-push! 1 22) + ) + ) + (while #t + (let ((a0-63 (-> self skel root-channel 0))) + (set! + (-> a0-63 frame-group) + (the-as art-joint-anim (-> self draw art-group data 5)) + ) + (set! + (-> a0-63 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 5)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-63 param 1) 1.0) + (set! (-> a0-63 frame-num) 0.0) + (joint-control-channel-group! + a0-63 + (the-as art-joint-anim (-> self draw art-group data 5)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + (let ((a0-64 (-> self skel root-channel 0))) + (set! + (-> a0-64 param 0) + (the float (+ (-> a0-64 frame-group data 0 length) -1)) + ) + (set! (-> a0-64 param 1) 1.0) + (joint-control-channel-group-eval! + a0-64 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (('shock-in) + (ja-channel-push! 1 60) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 88)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 18.0) 0)) + (set! (-> s5-0 param 1) 1.0) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 88)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 18.0) 0)) + (set! (-> s5-1 param 1) 1.0) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (while #t + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + ) + ) + (('shock-out) + (if (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 88) + ) + ) + (ja-channel-push! 1 60) + ) + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 88)) + ) + (set! + (-> s5-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 88)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s5-2 param 1) 1.0) + (set! (-> s5-2 frame-num) (ja-aframe (the-as float 18.0) 0)) + (joint-control-channel-group! + s5-2 + (the-as art-joint-anim (-> self draw art-group data 88)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + (let ((a0-82 (-> self skel root-channel 0))) + (set! + (-> a0-82 param 0) + (the float (+ (-> a0-82 frame-group data 0 length) -1)) + ) + (set! (-> a0-82 param 1) 1.0) + (joint-control-channel-group-eval! + a0-82 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint 'stance)) + ) + ) + ) + (label cfg-94) + ) + (none) + ) + :post + (behavior () + (if (logtest? (-> self control status) 1) + (set! (-> self control transv quad) (the-as uint128 0)) + ) + (target-no-stick-post) + (none) + ) + ) + +(defstate target-pole-cycle (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + :enter + (behavior ((arg0 handle)) + (set! (-> self control unknown-handle10) arg0) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *pole-mods*) + (logior! (-> self control root-prim prim-core action) 256) + (target-collide-set! + 'pole + (the-as float (-> (new 'static 'array int32 1 0) 0)) + ) + (set! (-> self control unknown-vector102 quad) (-> self control transv quad)) + (set! (-> self control transv quad) (the-as uint128 0)) + (send-event *camera* 'ease-in) + (set! (-> self control unknown-int21) (the-as int #f)) + (none) + ) + :exit + (behavior () + (target-collide-set! + 'normal + (the-as float (-> (new 'static 'array int32 1 0) 0)) + ) + (set! + (-> self control root-prim prim-core action) + (logand -257 (-> self control root-prim prim-core action)) + ) + (set! (-> self control unknown-handle10) (the-as handle #f)) + (none) + ) + :trans + (behavior () + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self state-flags) 2048)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (cond + ((< 44.0 (ja-aframe-num 0)) + (set-forward-vel (the-as float -49152.0)) + (let ((gp-0 (new-stack-vector0))) + (let + ((f0-2 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f0-2) + ) + ) + (let* ((f0-3 (vector-length gp-0)) + (f1-1 f0-3) + (f2-0 -81920.0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-0 gp-0 (/ f0-3 f1-1)) + ) + ) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (go target-falling 'target-pole-cycle) + ) + ((>= (ja-aframe-num 0) 14.0) + (remove-exit) + (go + target-pole-flip-up + 28672.0 + 28672.0 + (* 1024.0 (- 26.0 (ja-aframe-num 0))) + ) + ) + (else + (remove-exit) + (go + target-pole-flip-forward + (the-as float 14336.0) + (the-as float 14336.0) + (the-as float 57344.0) + ) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 handle)) + (target-compute-pole) + (set! + (-> self control unknown-uint20) + (the-as + uint + (vector-dot + (-> self control unknown-vector100) + (vector-normalize! (-> self control unknown-vector102) (the-as float 1.0)) + ) + ) + ) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 83) + ) + (while (not (-> self control unknown-int21)) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 num-func) num-func-identity) + (set! (-> gp-1 frame-num) (ja-aframe (the-as float 37.0) 0)) + ) + ) + (else + (while (not (-> self control unknown-int21)) + (suspend) + ) + (suspend) + (ja-channel-push! 1 45) + ) + ) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 80)) + ) + (set! + (-> a0-9 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 80)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-9 param 1) 1.0) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 80)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! + (-> a0-10 param 0) + (the float (+ (-> a0-10 frame-group data 0 length) -1)) + ) + (set! (-> a0-10 param 1) 1.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (while #t + (set! + (-> self anim-seed) + (the-as uint (if (rand-vu-percent? (the-as float 0.1)) + 0 + 1 + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 frame-group) + (the-as art-joint-anim (-> self draw art-group data 80)) + ) + (set! + (-> a0-13 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 80)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-13 param 1) 1.0) + (set! (-> a0-13 frame-num) 0.0) + (joint-control-channel-group! + a0-13 + (the-as art-joint-anim (-> self draw art-group data 80)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-14 (-> self skel root-channel 0))) + (set! + (-> a0-14 param 0) + (the float (+ (-> a0-14 frame-group data 0 length) -1)) + ) + (set! (-> a0-14 param 1) 1.0) + (joint-control-channel-group-eval! + a0-14 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-pole-flip-up (target) + :event + target-standard-event-handler + :exit + (-> target-pole-cycle exit) + :code + (behavior ((arg0 object) (arg1 object) (arg2 float)) + (let ((s3-0 (-> self skel root-channel 0))) + (set! + (-> s3-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 81)) + ) + (set! + (-> s3-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 81)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s3-0 param 1) 1.0) + (set! + (-> s3-0 frame-num) + (ja-aframe (+ 1.0 (fmin 17.0 (ja-aframe-num 0))) 0) + ) + (joint-control-channel-group! + s3-0 + (the-as art-joint-anim (-> self draw art-group data 81)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set-forward-vel arg2) + (go target-pole-flip-up-jump (the-as float arg0) (the-as float arg1)) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-pole-flip-up-jump (target) + :event + target-standard-event-handler + :enter + (-> target-jump-forward enter) + :exit + target-exit + :trans + (behavior () + ((-> target-jump-forward trans)) + (vector-flatten! + (-> self control transv) + (-> self control transv) + (-> self control unknown-vector100) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 0 0 1 #t) + (send-event *camera* 'damp-up) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 83)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (let ((f0-1 (target-height-above-ground)) + (f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (while + (not + (and + (< (fabs (/ f0-1 (* 0.0033333334 f1-1))) 40.0) + (and (< f1-1 0.0) (ja-min? 0)) + ) + ) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 1.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (set! f0-1 (target-height-above-ground)) + (set! + f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + ) + (ja-channel-push! 1 75) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-9 param 0) 1.0) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! + (-> a0-10 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-10 param 0) 1.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-pole-flip-forward (target) + :event + target-standard-event-handler + :exit + (-> target-pole-cycle exit) + :code + (behavior ((arg0 float) (arg1 float) (arg2 float)) + (let ((s3-0 (-> self skel root-channel 0))) + (set! + (-> s3-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 82)) + ) + (set! (-> s3-0 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-0 param 1) 1.0) + (set! (-> s3-0 frame-num) (ja-aframe (+ 1.0 (ja-aframe-num 0)) 0)) + (joint-control-channel-group! + s3-0 + (the-as art-joint-anim (-> self draw art-group data 82)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s3-1 (-> self skel root-channel 0))) + (set! (-> s3-1 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-1 param 1) 1.0) + (joint-control-channel-group-eval! + s3-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set-forward-vel arg2) + (go target-pole-flip-forward-jump arg0 arg1) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-pole-flip-forward-jump (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + ((-> target-jump enter) arg0 arg1 (the-as surface #f)) + (set! (-> self control unknown-surface00) *forward-pole-jump-mods*) + (none) + ) + :exit + target-exit + :trans + (behavior () + ((-> target-jump-forward trans)) + (vector-flatten! + (-> self control transv) + (-> self control transv) + (-> self control unknown-vector100) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 0 0 1 #t) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 param 0) + (the float (+ (-> a0-2 frame-group data 0 length) -1)) + ) + (set! (-> a0-2 param 1) 1.0) + (joint-control-channel-group-eval! + a0-2 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ((the-as (function none :behavior target) (-> target-pole-flip-up-jump code)) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-edge-grab (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('end-mode) + (go target-falling 'target-edge-grab) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *edge-grab-mods*) + (set! (-> self control unknown-dword41) (-> *display* base-frame-counter)) + (logior! (-> self control root-prim prim-core action) 136) + (set! (-> self control unknown-vector102 quad) (-> self control transv quad)) + (set! (-> self control transv quad) (the-as uint128 0)) + (send-event *camera* 'ease-in) + (none) + ) + :exit + (behavior () + (when (logtest? (-> self control root-prim prim-core action) 128) + (set! + (-> self control root-prim prim-core action) + (logand -137 (-> self control root-prim prim-core action)) + ) + (send-event *camera* 'damp-up) + ) + (none) + ) + :trans + (behavior () + (when + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 60) + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self state-flags) 2048)) + ) + (cond + ((or + (< -0.2 (local-pad-angle)) + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + ) + (let ((a1-2 (new 'stack-no-clear 'collide-using-spheres-params))) + (set! + (-> a1-2 spheres) + (the-as + (pointer sphere) + (-> *collide-edge-work* world-player-leap-up-spheres) + ) + ) + (set! (-> a1-2 num-spheres) (the-as uint 6)) + (set! (-> a1-2 collide-with) (-> self control root-prim collide-with)) + (set! (-> a1-2 proc) #f) + (set! (-> a1-2 ignore-pat) (the-as uint 1)) + (set! (-> a1-2 solid-only) #t) + (when (not (dummy-11 *collide-cache* a1-2)) + (remove-exit) + (go + target-edge-grab-jump + (-> *TARGET-bank* edge-grab-jump-height-min) + (-> *TARGET-bank* edge-grab-jump-height-max) + ) + ) + ) + ) + (else + (remove-exit) + (go target-edge-grab-off) + ) + ) + ) + (none) + ) + :code + (behavior () + (target-compute-edge) + (set! + (-> self control unknown-uint20) + (the-as + uint + (vector-dot + (-> self control unknown-vector100) + (vector-normalize! (-> self control unknown-vector102) (the-as float 1.0)) + ) + ) + ) + (while (< 0.0 (-> self control unknown-float110)) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + ) + (ja-channel-push! 1 45) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + ) + (suspend) + ) + (ja-channel-push! 1 45) + (cond + ((< (the-as float (-> self control unknown-uint20)) -0.3) + (let ((gp-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 48)) + num-func-identity + ) + (set! (-> gp-2 frame-num) 0.0) + ) + ) + ((< 0.3 (the-as float (-> self control unknown-uint20))) + (let ((gp-3 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 47)) + num-func-identity + ) + (set! (-> gp-3 frame-num) 0.0) + ) + ) + (else + (let ((gp-4 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 46)) + num-func-identity + ) + (set! (-> gp-4 frame-num) 0.0) + ) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! + (-> a0-11 param 0) + (the float (+ (-> a0-11 frame-group data 0 length) -1)) + ) + (set! (-> a0-11 param 1) 1.0) + (joint-control-channel-group-eval! + a0-11 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (ja-channel-set! 1) + (while #t + (let ((a0-14 (-> self skel root-channel 0))) + (set! + (-> a0-14 frame-group) + (the-as art-joint-anim (-> self draw art-group data 44)) + ) + (set! + (-> a0-14 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 44)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-14 param 1) 1.0) + (set! (-> a0-14 frame-num) 0.0) + (joint-control-channel-group! + a0-14 + (the-as art-joint-anim (-> self draw art-group data 44)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-15 (-> self skel root-channel 0))) + (set! + (-> a0-15 param 0) + (the float (+ (-> a0-15 frame-group data 0 length) -1)) + ) + (set! (-> a0-15 param 1) 1.0) + (joint-control-channel-group-eval! + a0-15 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (+! (-> self anim-seed) 1) + (let ((a0-17 (-> self skel root-channel 0))) + (set! + (-> a0-17 frame-group) + (the-as art-joint-anim (-> self draw art-group data 45)) + ) + (set! + (-> a0-17 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 45)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-17 param 1) 1.0) + (set! (-> a0-17 frame-num) 0.0) + (joint-control-channel-group! + a0-17 + (the-as art-joint-anim (-> self draw art-group data 45)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-18 (-> self skel root-channel 0))) + (set! + (-> a0-18 param 0) + (the float (+ (-> a0-18 frame-group data 0 length) -1)) + ) + (set! (-> a0-18 param 1) 1.0) + (joint-control-channel-group-eval! + a0-18 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-edge-grab-jump (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('end-mode) + (go target-falling 'target-edge-grab) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :exit + (-> target-edge-grab exit) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-set! 1) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (set! + (-> self control root-prim prim-core action) + (logand -137 (-> self control root-prim prim-core action)) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 49)) + ) + (set! + (-> a0-8 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 49)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-8 param 1) 1.0) + (set! (-> a0-8 frame-num) 0.0) + (joint-control-channel-group! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 49)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (target-compute-edge-rider) + (TODO-RENAME-9 (-> self align)) + (when (zero? (logand (-> self align flags) 1)) + (vector-matrix*! + s4-0 + (the-as vector (-> self align delta)) + (-> self control unknown-matrix01) + ) + (TODO-RENAME-28 (-> self control) s4-0) + ) + (suspend) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 param 0) + (the float (+ (-> a0-12 frame-group data 0 length) -1)) + ) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! + a0-12 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control unknown-dword70) 0) + (set-forward-vel (the-as float 16384.0)) + (send-event *camera* 'damp-up) + (go target-jump-forward arg0 arg1) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-edge-grab-off (target) + :event + target-standard-event-handler + :exit + (-> target-edge-grab exit) + :code + (behavior () + (ja-channel-set! 1) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (send-event *camera* 'damp-up) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 50)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 191.0) 0)) + (set! (-> s5-0 param 1) 1.0) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 50)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (when (zero? (logand (-> self align flags) 1)) + (vector-matrix*! + gp-0 + (the-as vector (-> self align delta)) + (-> self control unknown-matrix01) + ) + (TODO-RENAME-28 (-> self control) gp-0) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 191.0) 0)) + (set! (-> s5-1 param 1) 1.0) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! + (-> self control root-prim prim-core action) + (logand -137 (-> self control root-prim prim-core action)) + ) + (vector-float*! + (-> self control transv) + (-> self control unknown-vector101) + -40960.0 + ) + (when + (and + (< + (- + (-> *display* base-frame-counter) + (the-as int (-> self control rider-time)) + ) + 60 + ) + (or + (logtest? (-> self control unknown-surface01 flags) #x4000) + (= (-> self control poly-pat material) (pat-material rotate)) + ) + ) + (+! (-> self control transv x) (-> self control rider-last-move x)) + (+! (-> self control transv z) (-> self control rider-last-move z)) + ) + (go target-falling 'target-edge-grab) + (none) + ) + :post + target-no-move-post + ) + +(defstate target-yellow-blast (target) + :event + (-> target-running-attack event) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *run-attack-mods*) + (set! (-> *run-attack-mods* turnv) 655360.0) + (set! (-> *run-attack-mods* turnvv) 655360.0) + (target-start-attack) + (target-danger-set! 'spin #f) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control unknown-int21) 0) + (set! (-> self control unknown-uint31) (the-as uint 0)) + (let ((gp-0 (new-stack-vector0)) + (f30-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f30-0) + ) + (let* ((f0-5 (vector-length gp-0)) + (f1-0 f0-5) + ) + (if (< 0.0 f30-0) + (set! f30-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f30-0 + ) + (vector-float*! gp-0 gp-0 (/ f0-5 f1-0)) + ) + ) + ) + (none) + ) + :exit + (behavior () + (set! (-> *run-attack-mods* turnv) 0.0) + (set! (-> *run-attack-mods* turnvv) 0.0) + (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :code + (behavior () + (let ((gp-0 (the-as handle #f))) + (ja-channel-push! 1 22) + (level-hint-spawn + (game-text-id daxter-you-can-shoot-with-yellow-eco) + "sksp0145" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (case (-> (level-get-target-inside *level*) name) + (('maincave) + (level-hint-spawn + (game-text-id daxter-maybe-you-can-shoot-better-goggles) + "sksp0328" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 84)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 9.0) 0)) + (set! (-> s5-0 param 1) 1.0) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 84)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 9.0) 0)) + (set! (-> s5-1 param 1) 1.0) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let + ((s5-2 + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control quat) + ) + ) + ) + (set! (-> s5-2 y) 0.0) + (vector-normalize! s5-2 (-> *TARGET-bank* yellow-projectile-speed)) + (when + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (let ((gp-1 (get-process *default-dead-pool* projectile-yellow #x4000))) + (set! gp-0 (ppointer->handle (when gp-1 + (let + ((t9-12 + (method-of-type + projectile-yellow + activate + ) + ) + ) + (t9-12 + (the-as projectile-yellow gp-1) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-1 + projectile-init-by-other + (-> self entity) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 23) + ) + s5-2 + (if + (>= + (-> self fact-info-target eco-level) + (-> *FACT-bank* eco-level-max) + ) + 25 + 9 + ) + #f + ) + (-> gp-1 ppointer) + ) + ) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + ) + ) + (let ((s5-3 (-> self skel root-channel 0))) + (set! + (-> s5-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 84)) + ) + (set! + (-> s5-3 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 84)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s5-3 param 1) 1.0) + (set! (-> s5-3 frame-num) (ja-aframe (the-as float 9.0) 0)) + (joint-control-channel-group! + s5-3 + (the-as art-joint-anim (-> self draw art-group data 84)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if + (or + (< + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint30)) + ) + ) + (the-as uint 30) + ) + (= (-> self control unknown-uint31) 1) + ) + (send-event (handle->process gp-0) 'die) + ) + (suspend) + (let ((a0-32 (-> self skel root-channel 0))) + (set! + (-> a0-32 param 0) + (the float (+ (-> a0-32 frame-group data 0 length) -1)) + ) + (set! (-> a0-32 param 1) 1.0) + (joint-control-channel-group-eval! + a0-32 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (if (logtest? (-> self control status) 1) + (go target-stance) + (go target-falling #f) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(define + *yellow-jump-mods* + (new 'static 'surface + :name 'run + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.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 + :mode 'air + :flags #x800 + ) + ) + +(defstate target-yellow-jump-blast (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self control unknown-surface00) *yellow-jump-mods*) + (let ((gp-0 (new-stack-vector0))) + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f0-1) + ) + ) + (let* ((f0-2 (vector-length gp-0)) + (f1-1 f0-2) + (f2-0 46917.434) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-0 gp-0 (/ f0-2 f1-1)) + ) + ) + ) + (none) + ) + :exit + (behavior () + (rot->dir-targ! (-> self control)) + (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 22) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 86)) + ) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> gp-0 param 1) 1.0) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 86)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> gp-1 param 1) 1.0) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (suspend) + (let ((gp-2 (new-stack-vector0))) + (let + ((f0-6 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-2 + (-> self control transv) + (vector-float*! gp-2 (-> self control dynam gravity-normal) f0-6) + ) + ) + (let* ((f0-7 (vector-length gp-2)) + (f1-1 f0-7) + (f2-0 46917.434) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-2 gp-2 (/ f0-7 f1-1)) + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 param 0) + (the float (+ (-> a0-13 frame-group data 0 length) -1)) + ) + (set! (-> a0-13 param 1) 1.0) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((gp-3 (get-process *default-dead-pool* projectile-yellow #x4000))) + (when gp-3 + (let ((t9-9 (method-of-type projectile-yellow activate))) + (t9-9 + (the-as projectile-yellow gp-3) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-3 + projectile-init-by-other + (-> self entity) + (-> self control unknown-vector90) + (vector-float*! + (new 'stack-no-clear 'vector) + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control quat) + ) + (the-as float (-> *TARGET-bank* yellow-projectile-speed)) + ) + (if + (>= (-> self fact-info-target eco-level) (-> *FACT-bank* eco-level-max)) + 16 + 0 + ) + #f + ) + (-> gp-3 ppointer) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + (let ((gp-4 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-4) 30) + (suspend) + ) + ) + (let ((gp-5 (-> self skel root-channel 0))) + (set! + (-> gp-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 86)) + ) + (set! + (-> gp-5 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 86)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-5 param 1) 1.0) + (set! (-> gp-5 frame-num) (ja-frame-num 0)) + (joint-control-channel-group! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 86)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 param 0) + (the float (+ (-> a0-22 frame-group data 0 length) -1)) + ) + (set! (-> a0-22 param 1) 1.0) + (joint-control-channel-group-eval! + a0-22 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (if (logtest? (-> self control status) 1) + (go target-stance) + (go target-falling #f) + ) + (none) + ) + :post + target-no-stick-post + ) + +(defstate target-eco-powerup (target) + :event + target-standard-event-handler + :exit + target-exit + :trans + (behavior () + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 object) (arg1 float)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (if (= arg1 (-> *FACT-bank* eco-full-inc)) + (set! (-> self control unknown-surface00) *double-jump-mods*) + (set! (-> self control unknown-surface00) *walk-mods*) + ) + (ja-channel-push! 1 15) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 87)) + ) + (set! + (-> s5-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 87)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! + (-> s5-0 param 1) + (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + 2.0 + 3.0 + ) + ) + ) + (set! + (-> s5-0 frame-num) + (ja-aframe (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + (-> (new 'static 'array int32 1 0) 0) + 6.0 + ) + ) + 0 + ) + ) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 87)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self state-flags) 2048)) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack-air #f) + ) + (when (can-hands? #f) + (if + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (go target-yellow-jump-blast) + (go target-running-attack) + ) + ) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 2 + (the-as float 1.0) + (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + 2.0 + 1.0 + ) + ) + (the-as float 1.0) + ) + (suspend) + (let ((a0-30 (-> self skel root-channel 0))) + (set! + (-> a0-30 param 0) + (the float (+ (-> a0-30 frame-group data 0 length) -1)) + ) + (set! + (-> a0-30 param 1) + (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + 2.0 + 3.0 + ) + ) + ) + (joint-control-channel-group-eval! + a0-30 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-falling 'target-eco-powerup) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-wade-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *wade-mods*) + (set-zero! (-> self water bob)) + (none) + ) + :exit + (behavior () + (target-state-hook-exit) + (target-exit) + (let ((v1-1 (-> self skel effect))) + (set! (-> v1-1 channel-offset) 0) + ) + 0 + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (when + (and + (zero? (logand (-> self water flags) 1024)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water wade-time)) + ) + 15 + ) + ) + (if (logtest? (-> self water flags) 2048) + (go target-swim-stance) + (go target-stance) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (go target-duck-stance) + ) + (if + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go target-wade-walk) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (sound-play-by-name + (static-sound-name "swim-stroke") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (dummy-13 + (-> self water) + (the-as float 1.4) + (-> self control trans) + 0 + (-> self control transv) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (none) + ) + :code + (-> target-stance code) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-wade-walk (target) + :event + target-standard-event-handler + :enter + (-> target-wade-stance enter) + :exit + (-> target-wade-stance exit) + :trans + (behavior () + ((-> self state-hook)) + (when + (and + (zero? (logand (-> self water flags) 1024)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water wade-time)) + ) + 30 + ) + ) + (if (logtest? (-> self water flags) 2048) + (go target-swim-stance) + (go target-stance) + ) + ) + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go target-wade-stance) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (go target-duck-walk) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (sound-play-by-name + (static-sound-name "swim-stroke") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (dummy-13 + (-> self water) + (the-as float 1.4) + (-> self control trans) + 0 + (-> self control transv) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 105) + (f30-0 0.0) + ) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 23)) + (= v1-2 (-> self draw art-group data 18)) + ) + (set! gp-0 15) + (set! f30-0 (ja-frame-num 0)) + ) + ((let ((v1-9 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-9 (-> self draw art-group data 34)) + (= v1-9 (-> self draw art-group data 38)) + ) + ) + (set! gp-0 30) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 92) + ) + (set! gp-0 120) + ) + ) + ) + (cond + ((and (= (ja-group-size) 6) (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 89) + ) + ) + ) + (else + (ja-channel-push! 6 gp-0) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 dist) (-> *TARGET-bank* wade-shallow-walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 89)) + num-func-identity + ) + (set! (-> gp-1 frame-num) f30-0) + ) + (let ((gp-2 (-> self skel root-channel 1))) + (set! (-> gp-2 dist) (-> *TARGET-bank* wade-deep-walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 90)) + num-func-identity + ) + (set! (-> gp-2 frame-num) f30-0) + ) + (let ((gp-3 (-> self skel root-channel 2))) + (set! (-> gp-3 frame-interp) 0.0) + (set! (-> gp-3 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 23)) + num-func-identity + ) + (set! (-> gp-3 frame-num) f30-0) + ) + (let ((gp-4 (-> self skel root-channel 3))) + (set! (-> gp-4 frame-interp) 0.0) + (set! (-> gp-4 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 25)) + num-func-identity + ) + (set! (-> gp-4 frame-num) f30-0) + ) + (let ((gp-5 (-> self skel root-channel 4))) + (set! (-> gp-5 frame-interp) 0.0) + (set! (-> gp-5 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 27)) + num-func-identity + ) + (set! (-> gp-5 frame-num) f30-0) + ) + ) + ) + ) + (set! (-> self skel root-channel 2 command) 'push) + (set! (-> self skel root-channel 5 command) 'stack) + (let ((f30-1 0.0) + (f28-0 0.0) + (f26-0 + (lerp-scale + (the-as float 1.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (-> self control unknown-float01) + (the-as float 16384.0) + (the-as float 32768.0) + ) + ) + (gp-6 0) + ) + (while #t + (let + ((f0-10 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control unknown-float61))))) + (f24-0 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control unknown-float62))))) + ) + (let ((f1-4 (fabs (- f0-10 f30-1)))) + (set! f30-1 (seek f30-1 f0-10 (fmax 0.05 (fmin 0.2 (* 0.25 f1-4))))) + ) + (let ((f0-14 (fabs (- f24-0 f28-0)))) + (set! f28-0 (seek f28-0 f24-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-14))))) + ) + ) + (let ((v1-84 (-> self skel root-channel 3))) + (set! (-> v1-84 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! + (-> v1-84 frame-group) + (the-as art-joint-anim (-> self draw art-group data 25)) + ) + ) + (cond + ((>= f30-1 0.0) + (let ((v1-87 (-> self skel root-channel 3))) + (set! (-> v1-87 frame-interp) (fabs f30-1)) + (set! (-> v1-87 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! + (-> v1-87 frame-group) + (the-as art-joint-anim (-> self draw art-group data 24)) + ) + ) + ) + (else + (let ((v1-90 (-> self skel root-channel 3))) + (set! (-> v1-90 frame-interp) (fabs f30-1)) + (set! (-> v1-90 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! + (-> v1-90 frame-group) + (the-as art-joint-anim (-> self draw art-group data 25)) + ) + ) + ) + ) + (cond + ((>= f28-0 0.0) + (let ((v1-93 (-> self skel root-channel 4))) + (set! (-> v1-93 frame-interp) (fabs f28-0)) + (set! (-> v1-93 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-93 frame-group) + (the-as art-joint-anim (-> self draw art-group data 26)) + ) + ) + ) + (else + (let ((v1-96 (-> self skel root-channel 4))) + (set! (-> v1-96 frame-interp) (fabs f28-0)) + (set! (-> v1-96 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-96 frame-group) + (the-as art-joint-anim (-> self draw art-group data 27)) + ) + ) + ) + ) + (let* ((f0-30 (- (-> self water height) (-> self control trans y))) + (f24-1 + (lerp-scale + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 1.0) + f0-30 + (lerp + (-> self water wade-height) + (-> self water swim-height) + (the-as float 0.25) + ) + (lerp + (-> self water wade-height) + (-> self water swim-height) + (the-as float 0.75) + ) + ) + ) + ) + (let ((v1-108 (-> self skel effect))) + (set! (-> v1-108 channel-offset) (if (< 0.5 f24-1) + 1 + 0 + ) + ) + ) + 0 + (set! + f26-0 + (seek + f26-0 + (lerp-scale + (the-as float 1.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (-> self control unknown-float01) + (the-as float 16384.0) + (the-as float 32768.0) + ) + (* 4.0 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> self skel root-channel 1 frame-interp) f24-1) + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 param 0) + (/ + (-> self control unknown-float01) + (* + 60.0 + (/ (dummy-9 (-> self skel)) (-> *TARGET-bank* run-cycle-length)) + ) + ) + ) + (joint-control-channel-group-eval! + s5-2 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((s5-3 (-> self skel root-channel 5))) + (set! + (-> s5-3 frame-interp) + (lerp f26-0 (the-as float (-> (new 'static 'array int32 1 0) 0)) f24-1) + ) + ) + ) + (let ((a0-66 (-> self skel root-channel 1))) + (set! (-> a0-66 param 0) 0.0) + (joint-control-channel-group-eval! + a0-66 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-67 (-> self skel root-channel 2))) + (set! (-> a0-67 param 0) 0.0) + (joint-control-channel-group-eval! + a0-67 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-68 (-> self skel root-channel 3))) + (set! (-> a0-68 param 0) 0.0) + (joint-control-channel-group-eval! + a0-68 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-69 (-> self skel root-channel 4))) + (set! (-> a0-69 param 0) 0.0) + (joint-control-channel-group-eval! + a0-69 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (when + (and + (>= (- (-> *display* base-frame-counter) gp-6) 60) + (< (- (-> self water height) (-> self control trans y)) 4096.0) + ) + (case (the int (ja-aframe-num 0)) + ((15 16 17 18) + (dummy-13 + (-> self water) + (the-as float 0.2) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 75) + ) + 0 + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control transv) + 2.5 + ) + ) + (set! gp-6 (-> *display* base-frame-counter)) + ) + ((46 47 48 49) + (dummy-13 + (-> self water) + (the-as float 0.2) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 71) + ) + 0 + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control transv) + 2.5 + ) + ) + (set! gp-6 (-> *display* base-frame-counter)) + ) + ) + ) + (suspend) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +(defbehavior + target-swim-tilt target + ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (let + ((gp-0 + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control unknown-quaternion00) + ) + ) + ) + (let + ((v1-2 + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control dir-targ) + ) + ) + (f0-1 + (fmin + 1.0 + (* + arg0 + (/ + (-> self control unknown-float01) + (-> self control unknown-surface01 target-speed) + ) + ) + ) + ) + ) + (set! + (-> self control unknown-float130) + (seek + (-> self control unknown-float130) + (fmax + (fmin (* (+ f0-1 arg2) (fmax 0.5 (+ 0.5 (vector-dot gp-0 v1-2)))) arg3) + (- arg3) + ) + (* arg1 (-> *display* seconds-per-frame)) + ) + ) + ) + (let + ((a2-2 + (vector-y-quaternion! + (new 'stack-no-clear 'vector) + (-> self control unknown-quaternion00) + ) + ) + ) + (forward-up-nopitch->quaternion + (-> self control unknown-quaternion01) + gp-0 + a2-2 + ) + ) + ) + (quaternion-rotate-x! + (-> self control unknown-quaternion01) + (-> self control unknown-quaternion01) + (the-as float (if (>= (-> self control unknown-float130) 0.0) + 16384.0 + -16384.0 + ) + ) + ) + (set! + (-> self control unknown-float00) + (fabs (-> self control unknown-float130)) + ) + (if (= (-> self next-state name) 'target-swim-down) + (set! + (-> self control unknown-float131) + (seek + (-> self control unknown-float131) + (the-as float -6144.0) + (* 4096.0 (-> *display* seconds-per-frame)) + ) + ) + (set! + (-> self control unknown-float131) + (seek + (-> self control unknown-float131) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (* 2048.0 (-> *display* seconds-per-frame)) + ) + ) + ) + (let ((f0-20 (-> self control unknown-float131))) + (set! (-> self control unknown-vector11 y) f0-20) + f0-20 + ) + ) + +(defstate target-swim-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *swim-mods*) + (logior! (-> self water flags) 16) + (none) + ) + :exit + (behavior () + (target-state-hook-exit) + (set! (-> self control unknown-surface00 target-speed) 28672.0) + (target-exit) + (when + (not + (or + (= (-> self next-state name) 'target-swim-stance) + (= (-> self next-state name) 'target-swim-walk) + (= (-> self next-state name) 'target-swim-down) + (= (-> self next-state name) 'target-swim-up) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float00) 0.0) + ) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (logtest? (-> self control status) 1) + (zero? (logand (-> self control status) 1024)) + ) + (set-zero! (-> self water bob)) + ) + (when + (and + (zero? (logand (-> self water flags) 2048)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (if (logtest? (-> self water flags) 1024) + (go target-wade-stance) + (go target-stance) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water enter-swim-time)) + ) + 30 + ) + ) + (go + target-swim-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (go target-swim-down) + ) + (if + (and + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (let ((gp-0 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (ja-aframe-num 0) + (if + (or + (and (= gp-0 (-> self draw art-group data 96)) #t) + (and (= gp-0 (-> self draw art-group data 95)) #t) + ) + #f + #t + ) + ) + ) + (go target-swim-walk) + ) + (target-swim-tilt + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 2.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 1.0) + ) + (none) + ) + :code + (behavior () + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 95)) + ) + (ja-channel-push! 1 22) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 97)) + ) + (set! + (-> a0-8 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 97)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! + (-> a0-8 param 1) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + 1.0 + 2.0 + ) + ) + ) + (set! (-> a0-8 frame-num) 0.0) + (joint-control-channel-group! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 97)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 param 0) + (the float (+ (-> a0-9 frame-group data 0 length) -1)) + ) + (let + ((v1-41 + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + 1.0 + 2.0 + ) + ) + ) + (set! (-> a0-9 param 1) (the-as float v1-41)) + ) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 92) + ) + (ja-channel-push! 1 249) + ) + (else + (ja-channel-push! 1 45) + ) + ) + ) + (while #t + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 91)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (until + (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-21 (-> self skel root-channel 0))) + (set! + (-> a0-21 param 0) + (the float (+ (-> a0-21 frame-group data 0 length) -1)) + ) + (set! (-> a0-21 param 1) 1.0) + (joint-control-channel-group-eval! + a0-21 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (none) + ) + :post + target-swim-post + ) + +(defstate target-swim-walk (target) + :event + target-standard-event-handler + :enter + (behavior () + ((-> target-swim-stance enter)) + (die-on-next-update! (-> self water bob)) + (set! + (-> self control unknown-uint20) + (the-as uint (-> *display* base-frame-counter)) + ) + (none) + ) + :exit + (-> target-swim-stance exit) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (logtest? (-> self control status) 1) + (zero? (logand (-> self control status) 1024)) + ) + (set-zero! (-> self water bob)) + ) + (when + (and + (zero? (logand (-> self water flags) 2048)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water swim-time)) + ) + 30 + ) + ) + (if (logtest? (-> self water flags) 1024) + (go target-wade-stance) + (go target-stance) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water enter-swim-time)) + ) + 30 + ) + ) + (go + target-swim-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (go target-swim-down) + ) + (cond + ((= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (if + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 15) + ) + (go target-swim-stance) + ) + ) + (else + (set! + (-> self control unknown-uint20) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + ) + (target-swim-tilt + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 2.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 1.0) + ) + (none) + ) + :code + (behavior () + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 95)) + (= v1-2 (-> self draw art-group data 97)) + ) + (ja-channel-push! 1 90) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 97) + ) + (ja-channel-push! 1 45) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 92)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 92)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) 1.0) + (set! (-> gp-0 frame-num) (ja-aframe (the-as float 19.0) 0)) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 92)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (if (zero? (logand (-> self align flags) 1)) + (set! + (-> self control unknown-surface00 target-speed) + (* + (-> self align delta trans z) + (-> self control unknown-surface01 alignv) + (-> *display* frames-per-second) + ) + ) + ) + (suspend) + (let ((a0-19 (-> self skel root-channel 0))) + (set! + (-> a0-19 param 0) + (the float (+ (-> a0-19 frame-group data 0 length) -1)) + ) + (set! (-> a0-19 param 1) 1.0) + (joint-control-channel-group-eval! + a0-19 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (ja-channel-push! 1 45) + ) + ) + ) + (while #t + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 frame-group) + (the-as art-joint-anim (-> self draw art-group data 92)) + ) + (set! + (-> a0-22 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 92)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-22 param 1) 1.0) + (set! (-> a0-22 frame-num) 0.0) + (joint-control-channel-group! + a0-22 + (the-as art-joint-anim (-> self draw art-group data 92)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (if (zero? (logand (-> self align flags) 1)) + (set! + (-> self control unknown-surface00 target-speed) + (* + (-> self align delta trans z) + (-> self control unknown-surface01 alignv) + (-> *display* frames-per-second) + ) + ) + ) + (suspend) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 param 0) + (the float (+ (-> a0-24 frame-group data 0 length) -1)) + ) + (set! (-> a0-24 param 1) 1.0) + (joint-control-channel-group-eval! + a0-24 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + target-swim-post + ) + +(defstate target-swim-down (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('attack 'attack-invinc) + (let ((v1-2 (the-as attack-info (-> arg3 param 1)))) + (when + (or + (zero? (logand (-> v1-2 mask) 32)) + (= (-> v1-2 mode) 'generic) + (= (-> v1-2 mode) 'drown) + ) + (set! (-> v1-2 mode) 'damage) + (if + (and + (= (-> self game mode) 'play) + (>= 1.0 (-> self fact-info-target health)) + ) + (set! (-> v1-2 mode) 'drown-death) + ) + (logior! (-> v1-2 mask) 32) + (set! (-> self control unknown-uint20) (the-as uint #t)) + ) + ) + ) + ) + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self water flags) (logand -17 (-> self water flags))) + (set! (-> self control unknown-surface00) *dive-mods*) + (set! (-> self control dynam gravity-max) 16384.0) + (set! (-> self control dynam gravity-length) 16384.0) + (set! + (-> self water swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self control unknown-uint20) (the-as uint #f)) + (if (= (-> self next-state name) 'target-swim-down) + (set! (-> self control unknown-float130) 0.0) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (target-exit) + (when + (not + (or + (= (-> self next-state name) 'target-swim-stance) + (= (-> self next-state name) 'target-swim-walk) + (= (-> self next-state name) 'target-swim-down) + (= (-> self next-state name) 'target-swim-up) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float00) 0.0) + ) + (none) + ) + :trans + (behavior () + (if + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water swim-time)) + ) + 150 + ) + (go target-stance) + ) + (cond + ((>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) + 30 + ) + (set! (-> self control unknown-surface00) *dive-mods*) + (if (= (-> self next-state name) 'target-swim-down) + (target-swim-tilt + (the-as float -0.9) + (the-as float 1.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 0.5) + ) + ) + ) + (else + (set! (-> self control unknown-surface00) *dive-bottom-mods*) + (if + (or + (= (-> self next-state name) 'target-swim-down) + (= (-> self next-state name) 'target-swim-stance) + ) + (target-swim-tilt + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 2.0) + (the-as float -1.0) + (the-as float 1.0) + ) + ) + ) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 60) + (s5-0 3000) + (f30-0 0.0) + ) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (set! f30-0 (cond + ((or + (= v1-2 (-> self draw art-group data 91)) + (= v1-2 (-> self draw art-group data 92)) + (= v1-2 (-> self draw art-group data 97)) + (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 95)) + ) + (ja-channel-push! 1 22) + (let ((a0-17 (-> self skel root-channel 0))) + (set! + (-> a0-17 frame-group) + (the-as art-joint-anim (-> self draw art-group data 93)) + ) + (set! + (-> a0-17 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 93)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-17 param 1) 1.0) + (set! (-> a0-17 frame-num) 0.0) + (joint-control-channel-group! + a0-17 + (the-as art-joint-anim (-> self draw art-group data 93)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 6 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + (if (= (ja-aframe-num 0) 73.0) + (dummy-13 + (-> self water) + (the-as float 0.7) + (-> self control trans) + 1 + *null-vector* + ) + ) + (suspend) + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 param 0) + (the float (+ (-> a0-22 frame-group data 0 length) -1)) + ) + (set! (-> a0-22 param 1) 1.0) + (joint-control-channel-group-eval! + a0-22 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 94)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + f30-0 + ) + (else + (case (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + + (((-> self draw art-group data 63) + (-> self draw art-group data 66) + (-> self draw art-group data 64) + (-> self draw art-group data 67) + ) + (ja-channel-push! 1 22) + (set! gp-0 120) + (let ((s4-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> self draw art-group data 94)) + num-func-identity + ) + (set! + (-> s4-1 frame-num) + (ja-aframe (the-as float 124.0) 0) + ) + ) + -16384.0 + ) + (else + (ja-channel-push! 1 22) + (let ((s4-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-2 + (the-as art-joint-anim (-> self draw art-group data 94)) + num-func-identity + ) + (set! (-> s4-2 frame-num) 0.0) + ) + f30-0 + ) + ) + ) + ) + ) + ) + (while #t + (if + (and + (or + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons square) + ) + ) + (-> self control unknown-spoolanim00) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) gp-0) + ) + (go target-swim-up) + ) + (if + (or + (>= (- (-> *display* base-frame-counter) (-> self state-time)) s5-0) + (and + (logtest? (-> self control status) 1) + (and + (< (-> self water swim-depth) 8192.0) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) gp-0) + ) + ) + ) + (go target-swim-up) + ) + (let ((s4-3 (new-stack-vector0)) + (f24-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + s4-3 + (-> self control transv) + (vector-float*! s4-3 (-> self control dynam gravity-normal) f24-0) + ) + (let* ((f28-0 (vector-length s4-3)) + (f26-0 f28-0) + (f24-1 (+ f24-0 f30-0)) + ) + (set! + f30-0 + (seek + f30-0 + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (* 32768.0 (-> *display* seconds-per-frame)) + ) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f24-1 + ) + (vector-float*! s4-3 s4-3 (/ f28-0 f26-0)) + ) + ) + ) + (suspend) + (let ((s4-4 (-> self skel root-channel 0))) + (set! + (-> s4-4 param 0) + (lerp-scale + (the-as float 0.4) + (the-as float 1.0) + (vector-length (-> self control transv)) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 16384.0) + ) + ) + (joint-control-channel-group-eval! + s4-4 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + (none) + ) + :post + target-swim-post + ) + +(defstate target-swim-up (target) + :event + (-> target-swim-down event) + :enter + (-> target-swim-down enter) + :exit + (-> target-swim-down exit) + :trans + (behavior () + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self water flags) #x6000)) + ) + (go + target-swim-jump-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + (the-as surface #f) + ) + ) + (when + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 3000) + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) 'attack) + (set! (-> a1-1 param 0) (the-as uint #f)) + (let ((a0-8 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-8 mode) 'drown-death) + (set! (-> a1-1 param 1) (the-as uint a0-8)) + ) + (send-event-function self a1-1) + ) + ) + ((-> target-swim-down trans)) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 30) + (let ((f30-0 1.0)) + (let ((gp-0 #t)) + (let ((a0-1 (-> self skel root-channel 0))) + (set! + (-> a0-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 95)) + ) + (set! + (-> a0-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 95)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-1 param 1) 1.0) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! + a0-1 + (the-as art-joint-anim (-> self draw art-group data 95)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (target-swim-tilt (the-as float (if (< 8192.0 (-> self water swim-depth)) + 0.5 + (-> (new 'static 'array int32 1 0) 0) + ) + ) + (the-as + float + 1.0 + ) + (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) + ) + (if + (and + (zero? (logand (-> self water flags) 4096)) + (or + (>= (ja-aframe-num 0) 222.0) + (and + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (>= (ja-aframe-num 0) 200.0) + ) + ) + ) + (goto cfg-37) + ) + (TODO-RENAME-9 (-> self align)) + (when (zero? (logand (-> self water flags) 4096)) + (logior! (-> self water flags) 16) + (set! gp-0 #f) + ) + (if gp-0 + (TODO-RENAME-10 + (-> self align) + 2 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + ) + (suspend) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 param 0) + (the float (+ (-> a0-9 frame-group data 0 length) -1)) + ) + (set! (-> a0-9 param 1) 1.0) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 96)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (while #t + (target-swim-tilt (the-as float (if (< 8192.0 (-> self water swim-depth)) + 0.3 + (-> (new 'static 'array int32 1 0) 0) + ) + ) + (the-as + float + 1.0 + ) + (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) + ) + (if (zero? (logand (-> self water flags) 4096)) + (goto cfg-37) + ) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (set! f30-0 2.0) + ) + (TODO-RENAME-9 (-> self align)) + (when (logtest? (-> self water flags) 4096) + (TODO-RENAME-10 + (-> self align) + 2 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) + ) + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! (-> a0-16 param 0) f30-0) + (joint-control-channel-group-eval! + a0-16 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (set! + f30-0 + (seek f30-0 (the-as float 1.0) (-> *display* seconds-per-frame)) + ) + ) + ) + (label cfg-37) + (logior! (-> self water flags) 16) + (set! + (-> self water swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (start-bobbing! (-> self water) (the-as float -4096.0) 600 1500) + (set! + (-> self water bob start-time) + (+ (-> *display* base-frame-counter) -15) + ) + (go target-swim-stance) + (none) + ) + :post + target-swim-post + ) + +(defstate target-swim-jump-jump (target) + :event + (-> target-jump event) + :enter + (-> target-jump enter) + :exit + target-exit + :trans + (behavior () + (cond + ((< (- (-> *display* base-frame-counter) (-> self state-time)) 150) + (set! (-> self water flags) (logior #x10000 (-> self water flags))) + (set! (-> self control status) (logand -8 (-> self control status))) + ) + (else + (set! (-> self trans-hook) (-> target-jump trans)) + ) + ) + ((-> target-jump trans)) + (none) + ) + :code + (-> target-jump code) + :post + (the-as (function none :behavior target) target-post) + ) + +(defstate target-swim-jump (target) + :event + target-standard-event-handler + :enter + (-> target-swim-stance enter) + :exit + (behavior () + ((-> target-swim-stance exit)) + (die-on-next-update! (-> self water bob)) + (set! (-> self water align-offset) 0.0) + (set! (-> self water flags) (logior #x10000 (-> self water flags))) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (die-on-next-update! (-> self water bob)) + (ja-channel-push! 1 15) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 98)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (until + (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (TODO-RENAME-9 (-> self align)) + (if (zero? (logand (-> self align flags) 1)) + (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) + ) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 param 0) + (the float (+ (-> a0-8 frame-group data 0 length) -1)) + ) + (set! (-> a0-8 param 1) 2.0) + (joint-control-channel-group-eval! + a0-8 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((f30-0 (fmax 0.0 (- (-> self water bob-offset))))) + (let ((s4-1 (new-stack-vector0))) + (let + ((f0-8 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + s4-1 + (-> self control transv) + (vector-float*! s4-1 (-> self control dynam gravity-normal) f0-8) + ) + ) + (let* ((f0-9 (vector-length s4-1)) + (f1-5 f0-9) + (f2-1 0.4096) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-1 + ) + (vector-float*! s4-1 s4-1 (/ f0-9 f1-5)) + ) + ) + ) + (go target-swim-jump-jump (+ f30-0 arg0) (+ f30-0 arg1) (the-as surface #f)) + ) + (none) + ) + :post + target-swim-post + ) + +(defstate target-hit-ground-hard (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float)) + (set! (-> self control unknown-dword31) 0) + (set! (-> self control unknown-dword33) 0) + (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) + (set! (-> self control unknown-surface00) *walk-mods*) + (none) + ) + :code + (behavior ((arg0 float)) + (when (!= arg0 0.0) + (let + ((f0-5 + (the + float + (the + int + (+ + 1.0 + (/ + (- arg0 (-> *TARGET-bank* fall-far)) + (-> *TARGET-bank* fall-far-inc) + ) + ) + ) + ) + ) + ) + (pickup-collectable! + (-> self fact-info-target) + (pickup-type eco-green) + (* (-> *FACT-bank* health-single-inc) (- (fmax 0.0 f0-5))) + (the-as handle #f) + ) + ) + (if (zero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))) + (target-timed-invulnerable + (-> *TARGET-bank* hit-invulnerable-timeout) + self + ) + ) + ) + (cond + ((and + (= (-> self game mode) 'play) + (>= 0.0 (-> self fact-info-target health)) + ) + (set! (-> self attack-info attacker) (the-as handle #f)) + (go target-death 'target-hit-ground-hard) + ) + (else + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 30) + (ja-channel-push! 1 1) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 36)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (until + (and + (ja-done? 0) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 param 0) + (the float (+ (-> a0-12 frame-group data 0 length) -1)) + ) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! + a0-12 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 37)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (until + (and + (ja-done? 0) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 param 0) + (the float (+ (-> a0-20 frame-group data 0 length) -1)) + ) + (set! (-> a0-20 param 1) 1.0) + (joint-control-channel-group-eval! + a0-20 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (go target-stance) + ) + ) + (none) + ) + :post + target-no-stick-post + ) + +(defstate target-launch (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'target-launch + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + :code + (behavior ((arg0 float) (arg1 symbol) (arg2 vector) (arg3 int)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (ja-channel-push! 1 45) + (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) + (let ((s2-0 (-> self skel root-channel 0))) + (set! + (-> s2-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 31)) + ) + (set! (-> s2-0 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> s2-0 param 1) 3.0) + (set! (-> s2-0 frame-num) 0.0) + (joint-control-channel-group! + s2-0 + (the-as art-joint-anim (-> self draw art-group data 31)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s2-1 (-> self skel root-channel 0))) + (set! (-> s2-1 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> s2-1 param 1) 3.0) + (joint-control-channel-group-eval! + s2-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (if arg1 + (send-event *camera* 'change-state arg1 180) + ) + (when (nonzero? arg3) + (let ((s3-1 (get-process *default-dead-pool* process #x4000))) + (when s3-1 + (let ((t9-9 (method-of-type process activate))) + (t9-9 s3-1 self 'process (the-as pointer #x70004000)) + ) + (run-next-time-in-process + s3-1 + (lambda :behavior target + ((arg0 vector) (arg1 int) (arg2 float)) + (local-vars (sv-32 int) (sv-40 vector) (sv-44 symbol)) + (set! sv-32 (-> *display* base-frame-counter)) + (let ((v1-2 (new-stack-vector0))) + (set! (-> v1-2 quad) (-> arg0 quad)) + (set! sv-40 v1-2) + ) + (set! sv-44 #t) + (until (>= (- (-> *display* base-frame-counter) sv-32) arg1) + (let ((s4-0 (ppointer->process (-> self parent)))) + (cond + ((and + sv-44 + (< + (- + (-> (the-as target s4-0) control trans y) + (-> (the-as target s4-0) control unknown-vector52 y) + ) + arg2 + ) + ) + (vector-xz-normalize! + (-> (the-as target s4-0) control transv) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + ) + (case (-> (the-as target s4-0) current-level name) + (('jungleb) + (let + ((v1-16 + (vector-! + (new-stack-vector0) + (-> (the-as target s4-0) control trans) + sv-40 + ) + ) + ) + (set! + (-> (the-as target s4-0) control trans x) + (+ (-> sv-40 x) (fmax -4096.0 (fmin 4096.0 (-> v1-16 x)))) + ) + (set! + (-> (the-as target s4-0) control trans z) + (+ (-> sv-40 z) (fmax -4096.0 (fmin 4096.0 (-> v1-16 z)))) + ) + ) + ) + ) + ) + (else + (if sv-44 + (set! sv-32 (-> *display* base-frame-counter)) + ) + (set! sv-44 (the-as symbol #f)) + (when + (or + (= + (-> (the-as target s4-0) next-state name) + 'target-duck-high-jump-jump + ) + (= (-> (the-as target s4-0) next-state name) 'target-falling) + ) + (let ((v1-30 (-> (the-as target s4-0) control trans)) + (s3-0 (-> (the-as target s4-0) control transv)) + ) + (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) + (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) + (let ((f30-0 (vector-xz-length s3-0))) + (if (< 122880.0 f30-0) + (vector-xz-normalize! s3-0 (the-as float 122880.0)) + ) + (if (< 4096.0 f30-0) + (forward-up-nopitch->quaternion + (-> (the-as target s4-0) control dir-targ) + (vector-normalize-copy! + (new 'stack-no-clear 'vector) + s3-0 + (the-as float 1.0) + ) + (vector-y-quaternion! + (new 'stack-no-clear 'vector) + (-> (the-as target s4-0) control quat) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (suspend) + 0 + ) + #f + ) + arg2 + arg3 + (-> (new 'static 'array float 1 143360.0) 0) + ) + (-> s3-1 ppointer) + ) + ) + ) + (sound-play-by-name + (static-sound-name "launch-fire") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (go target-high-jump arg0 arg0 'launch) + (none) + ) + :post + target-no-stick-post + ) + +(defstate target-periscope (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('change-mode) + #f + ) + (('end-mode) + (when (-> self control unknown-spoolanim00) + (set! (-> self control unknown-uint20) (the-as uint #f)) + #t + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :exit + (behavior () + (target-exit) + (set! (-> self cam-user-mode) 'normal) + (logior! (-> self state-flags) 256) + (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (none) + ) + :code + (behavior ((arg0 handle)) + (set! (-> self neck flex-blend) 0.0) + (target-exit) + (logior! (-> self state-flags) 144) + (let ((v1-4 (handle->process arg0))) + (if v1-4 + (quaterion<-rotate-y-vector + (-> self control dir-targ) + (vector-! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable v1-4) root trans) + (-> self control trans) + ) + ) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint #t)) + (ja-channel-push! 1 30) + (let ((a0-11 (-> self skel root-channel 0))) + (set! + (-> a0-11 frame-group) + (the-as art-joint-anim (-> self draw art-group data 101)) + ) + (set! + (-> a0-11 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 101)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-11 param 1) 1.0) + (set! (-> a0-11 frame-num) 0.0) + (joint-control-channel-group! + a0-11 + (the-as art-joint-anim (-> self draw art-group data 101)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 param 0) + (the float (+ (-> a0-12 frame-group data 0 length) -1)) + ) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! + a0-12 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (send-event (handle->process arg0) 'change-mode) + (while (-> self control unknown-spoolanim00) + (suspend) + ) + (let ((a0-16 (-> self skel root-channel 0))) + (set! + (-> a0-16 frame-group) + (the-as art-joint-anim (-> self draw art-group data 101)) + ) + (set! (-> a0-16 param 0) 0.0) + (set! (-> a0-16 param 1) 2.0) + (set! + (-> a0-16 frame-num) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 101)) + data + 0 + length + ) + -1 + ) + ) + ) + (joint-control-channel-group! + a0-16 + (the-as art-joint-anim (-> self draw art-group data 101)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) 0.0) + (set! (-> a0-17 param 1) 2.0) + (joint-control-channel-group-eval! + a0-17 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-stance) + (none) + ) + :post + target-no-stick-post + ) + +(defstate target-play-anim (target) + :event + target-generic-event-handler + :enter + (behavior ((arg0 string) (arg1 handle)) + (set! (-> self control unknown-handle10) arg1) + (dummy-60 + (-> self control) + (the-as float 40960.0) + (the-as float 40960.0) + #f + (-> self control root-prim collide-with) + ) + (logior! (-> self state-flags) 256) + (set! (-> self neck flex-blend) 0.0) + (none) + ) + :exit + (behavior () + (send-event (handle->process (-> self control unknown-handle10)) 'end-mode) + (target-exit) + (none) + ) + :code + (behavior ((arg0 string) (arg1 handle)) + (let + ((gp-0 + (the-as + art-joint-anim + (dummy-10 (-> self draw art-group) arg0 art-joint-anim) + ) + ) + ) + (when gp-0 + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (ja-channel-set! 1) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 frame-group) gp-0) + (set! (-> a0-4 param 0) (the float (+ (-> gp-0 data 0 length) -1))) + (set! (-> a0-4 param 1) 1.0) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! a0-4 gp-0 num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 param 0) + (the float (+ (-> a0-5 frame-group data 0 length) -1)) + ) + (set! (-> a0-5 param 1) 1.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'normal) + ) + ) + (go target-stance) + (none) + ) + :post + target-no-stick-post + ) + +(defstate target-clone-anim (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'trans) (= (-> arg3 param 0) 'restore)) + (set! (-> self control unknown-uint20) (the-as uint #f)) + ) + ((-> target-grab event) arg0 arg1 arg2 arg3) + ) + :enter + (behavior ((arg0 handle)) + (set! (-> self control unknown-handle10) arg0) + (set! (-> self control unknown-vector102 quad) (-> self control trans quad)) + (set! (-> self control unknown-uint20) (the-as uint #t)) + (quaternion-copy! + (the-as quaternion (-> self control unknown-vector103)) + (-> self control quat) + ) + (logior! (-> self state-flags) 256) + (vector-reset! (-> self control transv)) + (set! (-> self neck flex-blend) 0.0) + (send-event (ppointer->process (-> self sidekick)) 'shadow #t) + (none) + ) + :exit + (behavior () + (send-event (ppointer->process (-> self sidekick)) 'matrix 'normal) + (send-event (ppointer->process (-> self sidekick)) 'shadow #t) + (let ((gp-0 (-> self node-list data 3)) + (a1-2 (&-> (-> self control) unknown-qword00)) + ) + (cond + ((not (-> self control unknown-spoolanim00)) + ) + ((zero? (logand (-> self draw status) 2)) + (TODO-RENAME-30 (-> self control) (the-as vector a1-2)) + (matrix->quaternion + (-> self control unknown-quaternion00) + (-> gp-0 bone transform) + ) + (quaternion-copy! + (-> self control quat) + (-> self control unknown-quaternion00) + ) + (dummy-60 + (-> self control) + (the-as float 4096.0) + (the-as float 40960.0) + #t + (-> self control root-prim collide-with) + ) + (when (logtest? (-> self control status) 1024) + (let ((a1-6 (new-stack-vector0))) + (set! (-> a1-6 x) (-> self control trans x)) + (set! (-> a1-6 y) (-> self water height)) + (set! (-> a1-6 z) (-> self control trans z)) + (set! (-> a1-6 w) 1.0) + (TODO-RENAME-30 (-> self control) a1-6) + ) + ) + ) + (else + (format 0 "ERROR: : camera used backup position~%") + (TODO-RENAME-30 (-> self control) (-> self control unknown-vector102)) + (quaternion-copy! + (-> self control quat) + (the-as quaternion (-> self control unknown-vector103)) + ) + ) + ) + ) + (rot->dir-targ! (-> self control)) + (logior! (-> self control status) 7) + (set! (-> self control unknown-dword11) (-> *display* base-frame-counter)) + (ja-channel-set! 0) + (ja-post) + (target-exit) + (none) + ) + :code + (behavior ((arg0 handle)) + (clone-anim arg0 (the-as int (-> self draw origin-joint-index)) #t "") + (go target-stance) + (none) + ) + :post + target-no-ja-move-post + ) + + + + diff --git a/goal_src/engine/ui/hud-h.gc b/goal_src/engine/ui/hud-h.gc index f9d70cd913..0ca4600df6 100644 --- a/goal_src/engine/ui/hud-h.gc +++ b/goal_src/engine/ui/hud-h.gc @@ -28,6 +28,10 @@ (declare-type hud-bike-heat hud) (declare-type hud-money-all hud) +;; TODO - for target2 +(define-extern enable-hud (function none)) +(define-extern disable-hud (function int none)) + ;; DECOMP BEGINS (deftype hud-icon (basic) diff --git a/goal_src/engine/ui/text-h.gc b/goal_src/engine/ui/text-h.gc index 9c4e2c5ddf..3e0945fbf1 100644 --- a/goal_src/engine/ui/text-h.gc +++ b/goal_src/engine/ui/text-h.gc @@ -172,6 +172,9 @@ (beach-flutflutegg-hint #x275) (sidekick-hint-fish-powerup #x278) + + (misty-racer-hit-the-ballon-lurkers #x27e) + (sidekick-speech-hint-crate-darkeco1 #x281) (beach-collectors-unblocked #x288) @@ -192,7 +195,7 @@ (found-all-scout-flies #x296) (yakow-owed-powercell #x297) - + (misty-teetertotter-bonk-dax-tutorial #x2a4) (sidekick-hint-misty-get-red-eco #x2a5) @@ -208,6 +211,11 @@ (missed #x2b5) (lose! #x2b6) + (daxter-screaming-jump #x290) + (daxter-wahoo-jump #x291) + + (red-eco-tutorial #x2a6) + (village2-gambler-money #x300) (village2-geologist-money #x301) (village2-warrior-money #x302) @@ -249,15 +257,13 @@ (rolling-ring-chase-2 #x325) (rolling-beat-lurkers #x327) - (swamp-finished-with-flutflut #x328) - (rolling-race-beat-record #x335) (sidekick-speech-hint-rolling-crate-darkeco #x336) - + (rolling-lightning-moles-completion #x338) (rolling-dark-plants-location-hint #x339) (rolling-dark-plants-hint #x33a) - + (rolling-flying-lurker-intro #x33c) (rolling-ring-hint-one-ring-down #x33f) (rolling-ring-hint-be-quick-to-next #x340) (rolling-ring-hint-be-quick-all #x341) @@ -270,6 +276,7 @@ (sunken-blue-eco-charger-all-hint #x34d) (swamp-rats-nest-hint #x358) + (daxter-you-can-shoot-with-yellow-eco #x359) (swamp-bats-hint #x364) ;; maybe we can ???? the bats. lol (flutflut-reminder #x368) @@ -327,6 +334,8 @@ (snow-frozen-crate #x42b) ;; task name? (snow-bumpers #x42c) + (daxter-maybe-you-can-shoot-better-goggles #x433) + (darkcave-light-crystal-low-light-hint #x437) (darkcave-light-crystal-hint #x438) @@ -380,6 +389,9 @@ (citadel-break-generators-reminder #x809) (citadel-climb-plat-hint #x80c) + (daxter-dont-miss-the-next-launcher #x80d) + + (daxter-land-on-the-next-launcher #x812) (misty-battle-finished #x813) (training-precursor-orbs #x901) diff --git a/goal_src/kernel/gkernel.gc b/goal_src/kernel/gkernel.gc index 303674d5ec..d9bd569227 100644 --- a/goal_src/kernel/gkernel.gc +++ b/goal_src/kernel/gkernel.gc @@ -2361,7 +2361,7 @@ :enter #f :event #f))) -(set! (-> dead-state code) nothing) +(set! (-> dead-state code) (the (function none :behavior process) nothing)) ;; this is not yet defined. diff --git a/goal_src/levels/common/basebutton.gc b/goal_src/levels/common/basebutton.gc index 0c6b0146fe..456f2e52b5 100644 --- a/goal_src/levels/common/basebutton.gc +++ b/goal_src/levels/common/basebutton.gc @@ -786,7 +786,7 @@ (-> self control unknown-vector102 y) (+ -4096.0 (-> self control unknown-vector102 y)) ) - (set! (-> self control unknown-float120) (the-as float #f)) + (set! (-> self control unknown-uint20) (the-as uint #f)) (vector-reset! (-> self control transv)) (logior! (-> self state-flags) 1024) (set! (-> self alt-cam-pos quad) (-> arg1 quad)) @@ -936,7 +936,7 @@ (and (or (< (vector-dot gp-2 (-> self control transv)) 0.0) - (-> self control unknown-float120) + (-> self control unknown-spoolanim00) ) (>= (- (-> *display* base-frame-counter) (-> self state-time)) 15) ) @@ -947,10 +947,10 @@ ) (set! (-> self control transv x) (* 0.95 (-> self control transv x))) (set! (-> self control transv z) (* 0.95 (-> self control transv z))) - (when (not (-> self control unknown-float120)) + (when (not (-> self control unknown-spoolanim00)) (send-event self 'do-effect 'death-warp-out -1.0) (let ((v0-2 #t)) - (set! (-> self control unknown-float120) (the-as float v0-2)) + (set! (-> self control unknown-uint20) (the-as uint v0-2)) v0-2 ) ) diff --git a/goal_src/levels/common/dark-eco-pool.gc b/goal_src/levels/common/dark-eco-pool.gc index 5113c0b2c8..ad9c9109ed 100644 --- a/goal_src/levels/common/dark-eco-pool.gc +++ b/goal_src/levels/common/dark-eco-pool.gc @@ -118,7 +118,7 @@ ) ) ) - (set! (-> obj attack-event) (the-as basic v0-1)) + (set! (-> obj attack-event) (the-as symbol v0-1)) v0-1 ) ) diff --git a/goal_src/levels/common/water-anim.gc b/goal_src/levels/common/water-anim.gc index 32ffee6b01..929e1a0e97 100644 --- a/goal_src/levels/common/water-anim.gc +++ b/goal_src/levels/common/water-anim.gc @@ -953,7 +953,7 @@ (ripple-find-height obj 0 arg0) ) -(defmethod dummy-24 water-anim () +(defmethod set-stack-size! water-anim ((obj water-anim)) (none) ) diff --git a/goal_src/levels/finalboss/robotboss-misc.gc b/goal_src/levels/finalboss/robotboss-misc.gc index 0f84299121..e9ae07ddc4 100644 --- a/goal_src/levels/finalboss/robotboss-misc.gc +++ b/goal_src/levels/finalboss/robotboss-misc.gc @@ -8,6 +8,9 @@ (declare-type ecoclaw process-drawable) (define-extern *ecoclaw* (pointer ecoclaw)) +(define-extern ecoclaw-idle (state ecoclaw)) ;; unknown type +(define-extern ecoclaw-activate (state ecoclaw)) ;; unknown type + ;; DECOMP BEGINS (defskelgroup *med-res-snow1-sg* medres-snowback diff --git a/goal_src/levels/finalboss/robotboss-weapon.gc b/goal_src/levels/finalboss/robotboss-weapon.gc index a7d9d61b0f..602f00ee20 100644 --- a/goal_src/levels/finalboss/robotboss-weapon.gc +++ b/goal_src/levels/finalboss/robotboss-weapon.gc @@ -18,19 +18,22 @@ :flag-assert #xd00000028 (:methods (dummy-9 (_type_ vector) none 9) - (dummy-10 (_type_ vector vector) symbol 10) + (TODO-RENAME-10 (_type_ collide-prim-core vector) symbol 10) (dummy-11 (_type_ vector) symbol 11) - (dummy-12 (_type_ vector) none 12) + (dummy-12 (_type_ vector) vector 12) ) ) -(defmethod dummy-10 torus ((obj torus) (arg0 vector) (arg1 vector)) +(defmethod + TODO-RENAME-10 + torus + ((obj torus) (arg0 collide-prim-core) (arg1 vector)) (let ((gp-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) - (f30-0 (+ (-> obj radius-secondary) (-> arg0 w))) + (f30-0 (+ (-> obj radius-secondary) (-> arg0 world-sphere w))) ) - (vector-! gp-0 arg0 (-> obj origin)) + (vector-! gp-0 (the-as vector arg0) (-> obj origin)) (vector-flatten! s5-0 gp-0 (-> obj axis)) (vector-normalize! s5-0 (-> obj radius-primary)) (vector-! arg1 gp-0 s5-0) @@ -44,7 +47,7 @@ (when (and (logtest? (-> s4-0 prim-core collide-as) 16) - (dummy-10 obj (the-as vector (-> s4-0 prim-core)) arg0) + (TODO-RENAME-10 obj (-> s4-0 prim-core) arg0) ) (countdown (s3-0 (-> s4-0 num-prims)) (let ((v1-9 (-> s4-0 prims s3-0))) @@ -52,7 +55,7 @@ (and (logtest? (-> v1-9 prim-core action) 1) (logtest? (-> v1-9 prim-core collide-as) 16) - (dummy-10 obj (the-as vector (-> v1-9 prim-core)) arg0) + (TODO-RENAME-10 obj (-> v1-9 prim-core) arg0) ) (return #t) ) @@ -152,14 +155,15 @@ (vector-matrix*! arg0 arg0 s2-0) ) (vector+! arg0 arg0 (-> obj origin)) - (none) + arg0 ) (deftype arcing-shot (process-drawable) - ((y-vel float :offset-assert 176) - (grav float :offset-assert 180) - (from vector :inline :offset-assert 192) - (to vector :inline :offset-assert 208) + ((root-override collide-shape-moving :offset 112) + (y-vel float :offset-assert 176) + (grav float :offset-assert 180) + (from vector :inline :offset-assert 192) + (to vector :inline :offset-assert 208) ) :heap-base #x70 :method-count-assert 20 @@ -185,12 +189,11 @@ (* 0.5 (- (sqrtf (- (* f0-6 f0-6) (* 4.0 f3-1))) f0-6)) ) ) - (set! - (-> self grav) - (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2)) + (let ((f0-12 (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2)))) + (set! (-> self grav) f0-12) + f0-12 ) ) - (none) ) (defbehavior arcing-shot-calculate arcing-shot ((arg0 vector) (arg1 float)) @@ -198,9 +201,11 @@ (vector-lerp! arg0 (-> self from) (-> self to) s5-0) (set! (-> arg0 y) (-> self from y)) (+! (-> arg0 y) (* (-> self y-vel) s5-0)) - (+! (-> arg0 y) (* 0.5 s5-0 s5-0 (-> self grav))) + (let ((f0-6 (+ (-> arg0 y) (* 0.5 s5-0 s5-0 (-> self grav))))) + (set! (-> arg0 y) f0-6) + f0-6 + ) ) - (none) ) (defbehavior arcing-shot-draw arcing-shot () @@ -288,7 +293,7 @@ #f #f #f - (-> self root trans) + (-> self root-override trans) ) (-> s5-1 ppointer) ) @@ -415,7 +420,7 @@ #f #f #f - (-> self root trans) + (-> self root-override trans) ) (-> gp-0 ppointer) ) @@ -652,7 +657,7 @@ :trans (behavior () (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) @@ -796,9 +801,9 @@ ) (set! (-> s1-0 nav-radius) (* 0.75 (-> s1-0 root-prim local-sphere w))) (backup-collide-with-as s1-0) - (set! (-> self root) s1-0) + (set! (-> self root-override) s1-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *darkecobomb-sg* '()) (logclear! (-> self mask) (process-mask actor-pause)) (set! @@ -855,7 +860,7 @@ :trans (behavior () (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) @@ -868,7 +873,7 @@ ) (deactivate self) ) - (spawn (-> self part) (-> self root trans)) + (spawn (-> self part) (-> self root-override trans)) (none) ) :code @@ -930,7 +935,7 @@ (defbehavior greenshot-init-by-other greenshot - ((arg0 vector) (arg1 vector) (arg2 float) (arg3 uint)) + ((arg0 vector) (arg1 vector) (arg2 float) (arg3 uint) (arg4 float)) (let ((s2-0 (new @@ -959,9 +964,9 @@ ) (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) (backup-collide-with-as s2-0) - (set! (-> self root) s2-0) + (set! (-> self root-override) s2-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *greenshot-sg* '()) (logclear! (-> self mask) (process-mask actor-pause)) (arcing-shot-setup arg0 arg1 arg2) @@ -1045,10 +1050,10 @@ (the float (+ (-> self rotation-offset) (-> *display* game-frame-counter))) ) ) - (matrix->quaternion (-> self root quat) s5-0) + (matrix->quaternion (-> self root-override quat) s5-0) ) (if (< (* 0.006666667 (the float (min 150 arg0))) 1.0) - (spawn (-> self part) (-> self root trans)) + (spawn (-> self part) (-> self root-override trans)) ) ) @@ -1066,9 +1071,9 @@ #t ) (set! (-> self draw status) (logand -3 (-> self draw status))) - (quaternion-identity! (-> self root quat)) + (quaternion-identity! (-> self root-override quat)) (set! (-> self ring radius-secondary) 3072.0) - (set! (-> self ring origin quad) (-> self root trans quad)) + (set! (-> self ring origin quad) (-> self root-override trans quad)) (+! (-> self ring origin y) (-> self ring radius-secondary)) (set-vector! (-> self ring axis) 0.0 1.0 0.0 1.0) (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) @@ -1099,7 +1104,7 @@ redshot-particle-callback (-> self ppointer) #f - (-> self root trans) + (-> self root-override trans) ) (-> gp-1 ppointer) ) @@ -1210,7 +1215,7 @@ ) (go redshot-explode) ) - (spawn (-> self shot-particle) (-> self root trans)) + (spawn (-> self shot-particle) (-> self root-override trans)) (none) ) :code @@ -1236,7 +1241,7 @@ (behavior () (redshot-trans 1500) (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) @@ -1249,7 +1254,7 @@ ) (go redshot-wait) ) - (spawn (-> self shot-particle) (-> self root trans)) + (spawn (-> self shot-particle) (-> self root-override trans)) (none) ) :code @@ -1265,7 +1270,7 @@ (defbehavior redshot-init-by-other redshot - ((arg0 vector) (arg1 vector) (arg2 float) (arg3 int) (arg4 int) (arg5 int)) + ((arg0 vector) (arg1 vector) (arg2 float) (arg3 uint) (arg4 uint) (arg5 uint)) (local-vars (sv-16 collide-shape-prim-sphere)) (let ((s0-0 @@ -1296,15 +1301,15 @@ (set-root-prim! s0-0 sv-16) (set! (-> s0-0 nav-radius) (* 0.75 (-> s0-0 root-prim local-sphere w))) (backup-collide-with-as s0-0) - (set! (-> self root) s0-0) + (set! (-> self root-override) s0-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *redring-sg* '()) (logclear! (-> self mask) (process-mask actor-pause)) (arcing-shot-setup arg0 arg1 arg2) - (set! (-> self flight-time) arg3) - (set! (-> self stall-time) arg4) - (set! (-> self rotation-offset) arg5) + (set! (-> self flight-time) (the-as int arg3)) + (set! (-> self stall-time) (the-as int arg4)) + (set! (-> self rotation-offset) (the-as int arg5)) (set! (-> self part) (create-launch-control (-> *part-group-id-table* 647) self) @@ -1331,7 +1336,7 @@ :volume #x400 :fo-max 80 ) - (-> self root trans) + (-> self root-override trans) ) ) (go redshot-idle) @@ -1378,13 +1383,13 @@ :trans (behavior () (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) ) ) - (spawn (-> self part) (-> self root trans)) + (spawn (-> self part) (-> self root-override trans)) (when (>= (- (-> *display* game-frame-counter) (-> self state-time)) @@ -1438,9 +1443,9 @@ ) (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) (backup-collide-with-as s2-0) - (set! (-> self root) s2-0) + (set! (-> self root-override) s2-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *redring-sg* '()) (logior! (-> self draw status) 2) (arcing-shot-setup arg0 arg1 arg2) diff --git a/goal_src/levels/finalboss/robotboss.gc b/goal_src/levels/finalboss/robotboss.gc index fb1026c31a..157b848d95 100644 --- a/goal_src/levels/finalboss/robotboss.gc +++ b/goal_src/levels/finalboss/robotboss.gc @@ -3917,9 +3917,11 @@ (the-as (function none :behavior robotboss) transform-post) ) +;; WARN: Function may read a register that is not set: t2 (defbehavior robotboss-greenshot robotboss ((arg0 vector) (arg1 basic) (arg2 basic) (arg3 symbol)) + (local-vars (t2-0 none)) (+! (-> self children-spawned) 1) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s2-0 (new 'stack-no-clear 'vector))) @@ -3937,7 +3939,7 @@ (the-as pointer #x70004000) ) ) - (run-now-in-process s1-1 greenshot-init-by-other gp-0 s2-0 arg1 arg2) + (run-now-in-process s1-1 greenshot-init-by-other gp-0 s2-0 arg1 arg2 t2-0) (-> s1-1 ppointer) ) ) diff --git a/goal_src/levels/flut_common/flutflut.gc b/goal_src/levels/flut_common/flutflut.gc index a285b222ce..b125294b4c 100644 --- a/goal_src/levels/flut_common/flutflut.gc +++ b/goal_src/levels/flut_common/flutflut.gc @@ -12,15 +12,16 @@ ) (deftype flutflut (process-drawable) - ((root-override collide-shape-moving :offset 112) - (extra-trans vector :inline :offset-assert 176) - (condition int32 :offset-assert 192) - (auto-get-off symbol :offset-assert 196) - (cell handle :offset-assert 200) - (path-data path-control 2 :offset-assert 208) - (path-target path-control :offset 208) - (path-flut path-control :offset 212) - (touch-time uint64 :offset-assert 216) + ((parent-override (pointer target) :offset 12) + (root-override collide-shape-moving :offset 112) + (extra-trans vector :inline :offset-assert 176) + (condition int32 :offset-assert 192) + (auto-get-off symbol :offset-assert 196) + (cell handle :offset-assert 200) + (path-data path-control 2 :offset-assert 208) + (path-target path-control :offset 208) + (path-flut path-control :offset 212) + (touch-time uint64 :offset-assert 216) ) :pack-me :heap-base #x70 diff --git a/goal_src/levels/jungle/fisher-JUN.gc b/goal_src/levels/jungle/fisher-JUN.gc index c7dfe54b96..26eac21c9b 100644 --- a/goal_src/levels/jungle/fisher-JUN.gc +++ b/goal_src/levels/jungle/fisher-JUN.gc @@ -8,7 +8,6 @@ (declare-type fisher-fish process-drawable) (define-extern fisher-fish-caught (state fisher-fish)) (define-extern fisher-fish-die (state fisher-fish)) -(define-extern cspace<-cspace+quaternion! (function cspace quaternion cspace)) ;; DECOMP BEGINS @@ -2853,7 +2852,7 @@ (activate! (-> self control unknown-smush00) 1.0 120 210 0.3 1.0) ) ((= arg2 'lose) - (set! (-> self control unknown-float120) (the-as float arg2)) + (set! (-> self control unknown-uint20) (the-as uint arg2)) arg2 ) (else @@ -2866,7 +2865,7 @@ (set! (-> self control unknown-surface00) *empty-mods*) (logior! (-> self state-flags) 16) (set-zero! (-> self control unknown-smush00)) - (set! (-> self control unknown-float120) (the-as float #f)) + (set! (-> self control unknown-uint20) (the-as uint #f)) (none) ) :exit @@ -2983,7 +2982,7 @@ (set! (-> s5-1 frame-num) (ja-aframe 15.0 0)) ) (let ((s5-2 (new 'stack-no-clear 'vector))) - (until (-> self control unknown-float120) + (until (-> self control unknown-spoolanim00) (let ((v1-42 (handle->process arg0))) (when v1-42 (let ((a0-28 (-> self skel root-channel 0))) @@ -3040,7 +3039,7 @@ (suspend) ) ) - (case (-> self control unknown-float120) + (case (-> self control unknown-spoolanim00) (('lose) (ja-channel-push! 1 30) (let ((a0-38 (-> self skel root-channel 0))) diff --git a/goal_src/levels/racer_common/collide-reaction-racer.gc b/goal_src/levels/racer_common/collide-reaction-racer.gc index 8182600d88..68a44c6d34 100644 --- a/goal_src/levels/racer_common/collide-reaction-racer.gc +++ b/goal_src/levels/racer_common/collide-reaction-racer.gc @@ -5,3 +5,254 @@ ;; name in dgo: collide-reaction-racer ;; dgos: L1, FIC, LAV, MIS, OGR, RACERP, ROL +;; DECOMP BEGINS + +(defun + racer-collision-reaction + ((arg0 control-info) + (arg1 collide-shape-intersect) + (arg2 vector) + (arg3 vector) + ) + (local-vars + (sv-80 vector) + (sv-84 vector) + (sv-88 (inline-array vector)) + (sv-96 int) + (sv-104 int) + ) + (set! sv-80 (new-stack-vector0)) + (set! sv-84 (new-stack-vector0)) + (let ((v1-2 (new 'stack-no-clear 'inline-array 'vector 2))) + (dotimes (a0-1 2) + (set! (-> v1-2 a0-1 quad) (the-as uint128 0)) + ) + (set! sv-88 v1-2) + ) + (set! sv-96 0) + (set! sv-104 0) + (set! (-> sv-88 0 quad) (-> arg3 quad)) + (set! (-> sv-88 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (TODO-RENAME-28 arg0 a1-3) + ) + (dummy-56 arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! sv-104 (logior sv-104 1)) + ) + (if (= (-> arg0 unknown-surface00 mode) 'air) + (set! sv-104 (logior sv-104 32)) + ) + (let ((v1-21 (new 'stack-no-clear 'vector))) + (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-21 (-> arg1 best-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (set! sv-104 (logior sv-104 24)) + ) + (let ((v1-31 (-> sv-80 quad))) + (set! (-> sv-84 quad) v1-31) + ) + (if (= (-> arg1 best-u) 0.0) + (TODO-RENAME-28 arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-96 (logior sv-96 16)) + ) + (let + ((s3-1 + (< + (fabs (-> arg0 surface-angle)) + (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle) + ) + ) + ) + (if s3-1 + (set! sv-104 (logior sv-104 2)) + ) + (when (zero? (logand (-> arg0 prev-status) 1)) + (set! + (-> arg0 ground-impact-vel) + (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))) + ) + (set! sv-96 (logior sv-96 2048)) + (when (not s3-1) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s2-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0))) + ) + 0.0 + (vector-! + s2-1 + (-> sv-88 0) + (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0) + ) + (let* ((f0-18 (vector-length s2-1)) + (f1-6 f0-18) + ) + (if (< f28-0 0.0) + (set! f28-0 (* f28-0 f30-0)) + ) + (vector+! + (-> sv-88 0) + (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s2-1 s2-1 (/ f0-18 f1-6)) + ) + ) + ) + ) + ) + ) + ) + (set! sv-96 (logior sv-96 4)) + (cond + ((-> arg1 best-to-prim) + (set! sv-96 (logior sv-96 32)) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! + (-> arg0 unknown-handle00) + (process->handle (-> arg1 best-to-prim cshape process)) + ) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (set! sv-96 (logior sv-96 4096)) + ) + ) + (if (and s3-1 (logtest? #x10000 (-> arg0 root-prim prim-core action))) + (set! s3-1 #f) + ) + (cond + (s3-1 + (set! sv-104 (logior sv-104 4)) + (set! sv-96 (logior sv-96 8)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-int60) (the-as uint (-> arg1 best-tri pat))) + (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) + (cond + ((not + (and + (>= + (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> arg1 best-tri intersect) + (-> arg0 ground-touch-point) + ) + ) + ) + (and + (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) 90) + (zero? (logand sv-104 32)) + ) + ) + ) + ) + (else + (set! sv-104 (logior sv-104 256)) + (set! sv-104 (logand -65 sv-104)) + (let + ((s3-3 + (vector-cross! + (new 'stack-no-clear 'vector) + (-> arg0 poly-normal) + (-> arg0 ground-poly-normal) + ) + ) + ) + (vector-normalize! s3-3 1.0) + (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + ) + (let* + ((s2-2 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0) + ) + (s3-4 (new-stack-vector0)) + (f30-1 (vector-dot s2-2 arg2)) + ) + 0.0 + (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) + (let* ((f1-11 (vector-length s3-4)) + (f0-27 f1-11) + (f1-12 (* 0.9 f1-11)) + ) + (vector+! + arg2 + (vector-float*! arg2 s2-2 f30-1) + (vector-float*! s3-4 s3-4 (/ f1-12 f0-27)) + ) + ) + ) + ) + (else + (set! sv-96 (logior sv-96 1)) + (set! (-> arg0 cur-pat mode) 0) + (if (and (= (-> arg1 best-from-prim prim-id) 6) (zero? (logand sv-104 7))) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) + (dotimes (v1-142 16) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (set! sv-96 (logior sv-96 2)) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (zero? (logand sv-104 15)) + (set! sv-96 (logior sv-96 2)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! + (-> arg0 unknown-float60) + (vector-dot sv-84 (-> arg0 dynam gravity-normal)) + ) + (set! (-> arg0 unknown-dword10) (-> *display* base-frame-counter)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (set! sv-104 (logior sv-104 2048)) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (set! sv-96 (logior sv-96 1024)) + ) + ) + ) + ) + ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as uint sv-104)) + (update! + (-> arg0 history-data (-> arg0 unknown-halfword00)) + arg0 + (-> arg1 best-tri intersect) + (-> sv-88 1) + arg2 + ) + (set! + (-> arg0 unknown-halfword00) + (logand (+ (-> arg0 unknown-halfword00) 1) 127) + ) + sv-96 + (none) + ) + + + + diff --git a/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc b/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc index 57746dd39d..8bc7d8977b 100644 --- a/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc +++ b/goal_src/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL.gc @@ -70,10 +70,10 @@ ) (target-attacked arg2 - (-> arg3 param 1) - (the-as uint arg0) + (the-as attack-info (-> arg3 param 1)) + arg0 (the-as process (-> arg3 param 0)) - (the-as (state target) target-racing-hit) + target-racing-hit ) ) ) @@ -1571,10 +1571,7 @@ (defstate target-racing-hit (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :enter (behavior ((arg0 handle) (arg1 attack-info)) (let ((v1-0 (-> self attack-info))) @@ -2215,10 +2212,7 @@ (defstate target-racing-get-on (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :exit (-> target-racing-start exit) :code @@ -2243,8 +2237,8 @@ (-> self control unknown-quaternion00) ) (set! - (-> self control unknown-float120) - (-> self control unknown-vector11 y) + (-> self control unknown-uint20) + (the-as uint (-> self control unknown-vector11 y)) ) (let* ((s3-0 (handle->process arg0)) (s4-1 @@ -2267,7 +2261,7 @@ ) (set! (-> self racer bike-scale quad) (-> s4-1 root-override scale quad)) (set! - (-> self control unknown-int20) + (-> self control unknown-int21) (the-as int (-> self racer bike-trans y)) ) ) @@ -2532,7 +2526,7 @@ (set! (-> self control unknown-vector11 y) (lerp - (-> self control unknown-float120) + (the-as float (-> self control unknown-uint20)) (-> self racer cushion-base) f30-1 ) @@ -2540,8 +2534,8 @@ (set! (-> self racer bike-trans y) (lerp - (-> self control unknown-float121) - (+ 4096.0 (-> self control unknown-float121)) + (the-as float (-> self control unknown-uint30)) + (+ 4096.0 (the-as float (-> self control unknown-uint30))) f30-1 ) ) @@ -2554,10 +2548,7 @@ (defstate target-racing-get-off (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :exit (-> target-racing-start exit) :code @@ -2653,10 +2644,7 @@ (defstate target-racing-get-off-jump (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :exit (-> target-racing-start exit) :code @@ -2685,8 +2673,8 @@ (-> self control unknown-quaternion00) ) (set! - (-> self control unknown-float120) - (-> self control unknown-vector11 y) + (-> self control unknown-uint20) + (the-as uint (-> self control unknown-vector11 y)) ) (let* ((s2-0 (handle->process arg0)) (s3-0 @@ -2713,7 +2701,7 @@ ) (set! (-> self racer bike-scale quad) (-> s3-0 root-override scale quad)) (set! - (-> self control unknown-int20) + (-> self control unknown-int21) (the-as int (-> self racer bike-trans y)) ) ) @@ -2921,7 +2909,11 @@ ) (set! (-> self control unknown-vector11 y) - (lerp (-> self control unknown-float120) 6144.0 (fmin 1.0 (* 2.0 f30-0))) + (lerp + (the-as float (-> self control unknown-uint20)) + 6144.0 + (fmin 1.0 (* 2.0 f30-0)) + ) ) ) (vector+! @@ -2942,10 +2934,7 @@ (defstate target-racing-get-off-hit-ground (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-standard-event-handler - ) + target-standard-event-handler :enter (-> target-hit-ground enter) :trans @@ -3121,7 +3110,7 @@ :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (if (and (= arg2 'trans) (= (-> arg3 param 0) 'restore)) - (set! (-> self control unknown-float120) (the-as float #f)) + (set! (-> self control unknown-uint20) (the-as uint #f)) ) ((-> target-racing-grab event) arg0 arg1 arg2 arg3) ) @@ -3131,7 +3120,7 @@ (behavior () (set! (-> self control unknown-vector11 y) - (-> self control unknown-float120) + (the-as float (-> self control unknown-uint20)) ) (set! (-> self control unknown-vector12 y) @@ -3146,8 +3135,8 @@ :code (behavior ((arg0 handle)) (set! - (-> self control unknown-float120) - (-> self control unknown-vector11 y) + (-> self control unknown-uint20) + (the-as uint (-> self control unknown-vector11 y)) ) (set! (-> self control unknown-vector11 y) 0.0) (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) diff --git a/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc b/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc index 14feccb184..265e2bfc25 100644 --- a/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc +++ b/goal_src/levels/racer_common/target-racer-FIC-LAV-MIS-OGR-ROL.gc @@ -5,5 +5,4 @@ ;; name in dgo: target-racer ;; dgos: FIC, LAV, MIS, OGR, ROL -(define-extern racer-collision-reaction function) -(define-extern *racer-mods* surface) \ No newline at end of file +(define-extern *racer-mods* surface) diff --git a/goal_src/levels/snow/target-snowball.gc b/goal_src/levels/snow/target-snowball.gc index 83463f174c..0479f606e2 100644 --- a/goal_src/levels/snow/target-snowball.gc +++ b/goal_src/levels/snow/target-snowball.gc @@ -63,7 +63,7 @@ target-jump (-> *TARGET-bank* duck-jump-height-min) (-> *TARGET-bank* duck-jump-height-max) - #f + (the-as surface #f) ) ) (else diff --git a/goal_src/levels/swamp/swamp-bat.gc b/goal_src/levels/swamp/swamp-bat.gc index 9a5b8782ae..1ec3e7a5d1 100644 --- a/goal_src/levels/swamp/swamp-bat.gc +++ b/goal_src/levels/swamp/swamp-bat.gc @@ -828,15 +828,12 @@ swamp-bat-slave-event-handler (deactivate self) ) (swamp-bat-update-path) - (let ((s5-0 (method-of-object (-> self vol) dummy-10))) - (target-pos 5) - (if - (or - (s5-0) - (not (swamp-bat-check-slave-paths-match? (-> self path-select))) - ) - (go swamp-bat-launch-slaves) + (if + (or + (dummy-10 (-> self vol) (target-pos 5)) + (not (swamp-bat-check-slave-paths-match? (-> self path-select))) ) + (go swamp-bat-launch-slaves) ) ) (let ((gp-1 (new 'static 'matrix))) diff --git a/goalc/compiler/compilation/Type.cpp b/goalc/compiler/compilation/Type.cpp index 5cc342620c..59edfdcb5d 100644 --- a/goalc/compiler/compilation/Type.cpp +++ b/goalc/compiler/compilation/Type.cpp @@ -733,7 +733,7 @@ Val* Compiler::compile_deref(const goos::Object& form, const goos::Object& _rest // special case (-> enter) should return the appropriate function type. if (in_type.arg_count() > 0 && in_type.base_type() == "state") { - if (field_name == "enter") { + if (field_name == "enter" || field_name == "code") { result->set_type(state_to_go_function(in_type, TypeSpec("none"))); } } diff --git a/scripts/check-gsrc-file.py b/scripts/check-gsrc-file.py new file mode 100644 index 0000000000..77525bff89 --- /dev/null +++ b/scripts/check-gsrc-file.py @@ -0,0 +1,55 @@ +import re +from jak1_file_list import file_list +import argparse +import os + +parser = argparse.ArgumentParser() +parser.add_argument("--files") +args = parser.parse_args() + +files = args.files.split(",") + +throw_error = False + +method_split_pattern = re.compile('t9-\d+\s\(method-of-object') +missing_res_tag_pattern = re.compile('(sv-\d{2,} int)') +decompiler_error_pattern = re.compile(';; ERROR') + +for file in files: + src_path = "" + for f in file_list: + if f[2] != 3: + continue + if f[0] == file: + src_path = f[4] + break + + if not os.path.exists("./goal_src/{}".format(src_path)): + print("{} couldn't find in /goal_src!".format(file)) + throw_error = True + continue + + file_path = "./goal_src/{}/{}.gc".format(src_path, file) + with open(file_path) as f: + for lineno, line in enumerate(f): + method_split_match = method_split_pattern.search(line) + if method_split_match: + print("method_split - {}:{}".format(file_path, lineno + 1)) + throw_error = True + continue + missing_res_tag_match = missing_res_tag_pattern.search(line) + if missing_res_tag_match: + print("missing_res_tag - {}:{}".format(file_path, lineno + 1)) + throw_error = True + continue + decompiler_error_match = decompiler_error_pattern.search(line) + if decompiler_error_match: + print("decompiler_error - {}:{}".format(file_path, lineno + 1)) + throw_error = True + continue + +if throw_error: + print("found potential problems!") + exit(1) +else: + print("looks good!") diff --git a/scripts/update-goal-src.py b/scripts/update-goal-src.py index 2be0c1aaa6..962fd146a9 100644 --- a/scripts/update-goal-src.py +++ b/scripts/update-goal-src.py @@ -27,6 +27,7 @@ files_with_modifications = [ "sunken-obs", "cam-master", "generic-obs", + "target-snowball", "default-menu" ] diff --git a/test/decompiler/reference/engine/anim/joint-h_REF.gc b/test/decompiler/reference/engine/anim/joint-h_REF.gc index 9a9d771c5e..77da43a3e9 100644 --- a/test/decompiler/reference/engine/anim/joint-h_REF.gc +++ b/test/decompiler/reference/engine/anim/joint-h_REF.gc @@ -69,7 +69,7 @@ :flag-assert #xb000000c0 (:methods (new (symbol type int) _type_ 0) - (dummy-9 (_type_) none 9) + (dummy-9 (_type_) float 9) (dummy-10 (_type_ symbol) int 10) ) ) diff --git a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc index 7a19314b4f..2e35bd601a 100644 --- a/test/decompiler/reference/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/engine/collide/collide-target-h_REF.gc @@ -79,7 +79,8 @@ (unknown-qword00 uint128 :offset 1136) (unknown-float30 float :offset 1140) (unknown-vector40 vector :inline :offset 1152) - (unknown-float40 float :offset 1176) + (unknown-float40 float :offset 1172) + (unknown-float41 float :offset 1176) (unknown-int00 int32 :offset 1180) (unknown-float50 float :offset 1168) (unknown-vector50 vector :inline :offset 1184) @@ -103,16 +104,21 @@ (unknown-float71 float :offset 1524) (unknown-vector70 vector :inline :offset 1536) (unknown-vector71 vector :inline :offset 1552) - (unknown-vector72 vector :inline :offset 1584) + (unknown-vector72 vector :inline :offset 1568) + (unknown-vector73 vector :inline :offset 1584) (unknown-handle00 handle :offset 1600) (unknown-sphere-array00 collide-shape-prim-sphere 3 :offset 1608) (unknown-sphere00 collide-shape-prim-sphere :offset 1632) (unknown-sphere01 collide-shape-prim-sphere :offset 1636) (unknown-sphere02 collide-shape-prim-sphere :offset 1640) - (unknown-dword30 int64 :offset 1672) - (unknown-dword31 int64 :offset 1680) - (unknown-dword32 int64 :offset 1688) - (unknown-dword33 int64 :offset 1696) + (unknown-int50 int32 :offset 1656) + (unknown-dword30 int64 :offset 1664) + (unknown-dword31 int64 :offset 1672) + (unknown-dword32 int64 :offset 1680) + (unknown-dword33 int64 :offset 1688) + (unknown-dword34 int64 :offset 1696) + (unknown-dword35 int64 :offset 1704) + (unknown-dword36 int64 :offset 1712) (unknown-float80 float :offset 1724) (unknown-float81 float :offset 1728) (unknown-float82 float :offset 1732) @@ -134,11 +140,18 @@ (unknown-dword40 int64 :offset 2160) (unknown-dword41 int64 :offset 2168) (unknown-handle10 handle :offset 2176) - (unknown-float120 float :offset 2184) + (unknown-uint20 uint32 :offset 2184) + (unknown-spoolanim00 spool-anim :offset 2184) + (unknown-int20 int32 :offset 2184) (unknown-symbol20 symbol :offset 2184) - (unknown-int20 int32 :offset 2188) + (unknown-float120 float :offset 2184) + (unknown-int21 int32 :offset 2188) + (unknown-uint30 uint32 :offset 2188) (unknown-float121 float :offset 2188) + (unknown-uint31 uint32 :offset 2192) + (unknown-float122 float :offset 2196) (unknown-float123 float :offset 2200) + (unknown-float124 float :offset 2204) (unknown-vector102 vector :inline :offset 2224) (unknown-vector103 vector :inline :offset 2240) (unknown-quaternion02 quaternion :inline :offset 2256) @@ -147,27 +160,35 @@ (unknown-vector110 vector :inline :offset 2320) (unknown-vector111 vector :inline :offset 2336) (unknown-symbol30 symbol :offset 2384) + (unknown-int31 uint32 :offset 2384) (unknown-dword50 int64 :offset 2392) (unknown-dword51 int64 :offset 2400) + (unknown-pointer00 pointer :offset 2416) (unknown-symbol40 symbol :offset 2428) + (unknown-dword60 int64 :offset 2432) + (unknown-dword61 int64 :offset 2440) + (unknown-dword62 int64 :offset 2448) + (unknown-dword63 int64 :offset 2456) (unknown-halfword00 int16 :offset 2488) (history-length int16 :offset 2490) (history-data collide-history 128 :inline :offset-assert 2496) (unknown-float140 float :offset 18944) - (unknown-dword60 int64 :offset 18952) + (unknown-dword70 int64 :offset 18952) (unknown-int40 int32 :offset 18880) - (unknown-dword70 int64 :offset 18888) - (unknown-dword71 int64 :offset 18896) - (unknown-dword72 int64 :offset 18912) - (unknown-vector120 vector :offset 18928) - (unknown-int50 uint32 :offset 18976) + (unknown-dword80 int64 :offset 18888) + (unknown-dword81 int64 :offset 18896) + (unknown-float130 float :offset 18904) + (unknown-float131 float :offset 18908) + (unknown-dword82 int64 :offset 18912) + (unknown-vector120 vector :inline :offset 18928) + (unknown-float150 float :offset 18944) + (unknown-int60 uint32 :offset 18976) (unknown-soundid00 sound-id :offset 18980) - (unknown-float130 float :offset 18984) + (unknown-float141 float :offset 18984) ) :method-count-assert 65 :size-assert #x4a2c :flag-assert #x4100004a2c - :no-inspect ) ;; definition for method 9 of type collide-history diff --git a/test/decompiler/reference/engine/draw/process-drawable_REF.gc b/test/decompiler/reference/engine/draw/process-drawable_REF.gc index 4194804026..2c3e3bb6e4 100644 --- a/test/decompiler/reference/engine/draw/process-drawable_REF.gc +++ b/test/decompiler/reference/engine/draw/process-drawable_REF.gc @@ -1205,7 +1205,6 @@ ) ;; definition for method 9 of type joint-control -;; INFO: Return type mismatch float vs none. (defmethod dummy-9 joint-control ((obj joint-control)) (cond ((< @@ -1245,7 +1244,6 @@ 0.0 ) ) - (none) ) ;; definition for function anim-loop diff --git a/test/decompiler/reference/engine/geometry/vol-h_REF.gc b/test/decompiler/reference/engine/geometry/vol-h_REF.gc index 9ed7c2c358..e3c79f10e2 100644 --- a/test/decompiler/reference/engine/geometry/vol-h_REF.gc +++ b/test/decompiler/reference/engine/geometry/vol-h_REF.gc @@ -52,7 +52,7 @@ (:methods (new (symbol type process-drawable) _type_ 0) (dummy-9 (_type_) none 9) - (dummy-10 () none 10) + (dummy-10 (_type_ vector) none 10) (TODO-RENAME-11 (_type_) symbol 11) ) ) diff --git a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc index fdf468a29f..2e1b13a432 100644 --- a/test/decompiler/reference/engine/gfx/water/water-h_REF.gc +++ b/test/decompiler/reference/engine/gfx/water/water-h_REF.gc @@ -3,54 +3,54 @@ ;; definition of type water-control (deftype water-control (basic) - ((flags uint32 :offset-assert 4) - (process process :offset-assert 8) - (joint-index int32 :offset-assert 12) - (top-y-offset float :offset-assert 16) - (ripple-size meters :offset-assert 20) - (enter-water-time uint64 :offset-assert 24) - (wade-time uint64 :offset-assert 32) - (on-water-time uint64 :offset-assert 40) - (enter-swim-time uint64 :offset-assert 48) - (swim-time uint64 :offset-assert 56) - (base-height meters :offset-assert 64) - (wade-height meters :offset-assert 68) - (swim-height meters :offset-assert 72) - (surface-height meters :offset-assert 76) - (bottom-height meters :offset-assert 80) - (height meters :offset-assert 84) - (height-offset float 4 :offset-assert 88) - (real-ocean-offset meters :offset 88) - (ocean-offset meters :offset 92) - (bob-offset meters :offset 96) - (align-offset meters :offset 100) - (swim-depth meters :offset-assert 104) - (bob smush-control :inline :offset-assert 112) - (volume handle :offset-assert 144) - (bottom vector 2 :inline :offset-assert 160) - (top vector 2 :inline :offset-assert 192) - (enter-water-pos vector :inline :offset-assert 224) - (drip-old-pos vector :inline :offset-assert 240) - (drip-joint-index int32 :offset-assert 256) - (drip-wetness float :offset-assert 260) - (drip-time uint64 :offset-assert 264) - (drip-speed float :offset-assert 272) - (drip-height meters :offset-assert 276) - (drip-mult float :offset-assert 280) + ((flags uint32 :offset-assert 4) + (process process-drawable :offset-assert 8) + (joint-index int32 :offset-assert 12) + (top-y-offset float :offset-assert 16) + (ripple-size meters :offset-assert 20) + (enter-water-time uint64 :offset-assert 24) + (wade-time uint64 :offset-assert 32) + (on-water-time uint64 :offset-assert 40) + (enter-swim-time uint64 :offset-assert 48) + (swim-time uint64 :offset-assert 56) + (base-height meters :offset-assert 64) + (wade-height meters :offset-assert 68) + (swim-height meters :offset-assert 72) + (surface-height meters :offset-assert 76) + (bottom-height meters :offset-assert 80) + (height meters :offset-assert 84) + (height-offset float 4 :offset-assert 88) + (real-ocean-offset meters :offset 88) + (ocean-offset meters :offset 92) + (bob-offset meters :offset 96) + (align-offset meters :offset 100) + (swim-depth meters :offset-assert 104) + (bob smush-control :inline :offset-assert 112) + (volume handle :offset-assert 144) + (bottom vector 2 :inline :offset-assert 160) + (top vector 2 :inline :offset-assert 192) + (enter-water-pos vector :inline :offset-assert 224) + (drip-old-pos vector :inline :offset-assert 240) + (drip-joint-index int32 :offset-assert 256) + (drip-wetness float :offset-assert 260) + (drip-time uint64 :offset-assert 264) + (drip-speed float :offset-assert 272) + (drip-height meters :offset-assert 276) + (drip-mult float :offset-assert 280) ) :method-count-assert 17 :size-assert #x11c :flag-assert #x110000011c (:methods (new (symbol type process int float float float) _type_ 0) - (dummy-9 () none 9) + (dummy-9 (_type_) none 9) (dummy-10 (_type_) none 10) - (dummy-11 () none 11) + (start-bobbing! (_type_ float int int) none 11) (distance-from-surface (_type_) float 12) (dummy-13 (_type_ float vector int vector) none 13) (display-water-marks? (_type_) symbol 14) - (dummy-15 () none 15) - (dummy-16 () none 16) + (TODO-RENAME-15 (_type_) none 15) + (TODO-RENAME-16 (_type_) none 16) ) ) @@ -116,7 +116,7 @@ (object-new allocation type-to-make (the-as int (-> type-to-make size))) ) ) - (set! (-> v0-0 process) arg0) + (set! (-> v0-0 process) (the-as process-drawable arg0)) (set! (-> v0-0 joint-index) arg1) (set! (-> v0-0 wade-height) arg4) (set! (-> v0-0 swim-height) arg3) @@ -140,8 +140,8 @@ (wade-height meters :offset-assert 180) (swim-height meters :offset-assert 184) (bottom-height meters :offset-assert 188) - (attack-event basic :offset-assert 192) - (target uint64 :offset-assert 200) + (attack-event symbol :offset-assert 192) + (target handle :offset-assert 200) (flags uint32 :offset-assert 208) ) :heap-base #x70 @@ -152,13 +152,13 @@ (water-vol-idle () _type_ :state 20) (water-vol-startup () _type_ :state 21) (TODO-RENAME-22 (_type_) ripple-wave-set 22) - (dummy-23 () none 23) - (dummy-24 () none 24) + (reset-root! (_type_) none 23) + (set-stack-size! (_type_) none 24) (TODO-RENAME-25 (_type_) object 25) - (dummy-26 () none 26) - (dummy-27 () none 27) + (TODO-RENAME-26 (_type_) none 26) + (dummy-27 (_type_) none 27) (get-ripple-height (_type_ vector) float 28) - (dummy-29 () none 29) + (TODO-RENAME-29 (_type_) uint 29) ) ) diff --git a/test/decompiler/reference/engine/gfx/water/water_REF.gc b/test/decompiler/reference/engine/gfx/water/water_REF.gc new file mode 100644 index 0000000000..4e9790b50c --- /dev/null +++ b/test/decompiler/reference/engine/gfx/water/water_REF.gc @@ -0,0 +1,2383 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 108) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 16 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.6) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.001) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 109) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 109) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.2) + (sp-end) + ) + ) + ) + +;; definition for function birth-func-y->userdata +;; INFO: Return type mismatch int vs none. +(defun + birth-func-y->userdata + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (+! (-> arg1 user-float) (-> arg2 vector 0 y)) + 0 + (none) + ) + +;; definition for function birth-func-ocean-height +;; INFO: Return type mismatch int vs none. +(defun + birth-func-ocean-height + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (set! + (-> arg2 vector 0 y) + (+ (ocean-get-height (the-as vector (-> arg2 vector))) (-> arg1 user-float)) + ) + 0 + (none) + ) + +;; definition for function check-water-level-drop +;; INFO: Return type mismatch int vs none. +(defun + check-water-level-drop + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (when (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (sp-kill-particle arg0 arg1) + (set-vector! s5-0 (-> arg2 x) (-> arg1 user-float) (-> arg2 z) 1.0) + (sound-play-by-name + (static-sound-name "water-drop") + (new-sound-id) + 1024 + 0 + 0 + 1 + (the-as symbol s5-0) + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 108) + s5-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + 0 + (none) + ) + +;; definition for function check-water-level-drop-and-die +(defun + check-water-level-drop-and-die + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (and (< (-> arg2 y) (-> arg1 user-float)) (< (-> arg1 vel-sxvel y) 0.0)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +;; definition for function check-water-level-above-and-die +(defun + check-water-level-above-and-die + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (if (>= (-> arg2 y) (-> arg1 user-float)) + (sp-kill-particle arg0 arg1) + ) + (none) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 110) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 12.0) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-rnd-flt spt-y (meters -0.05) (meters 0.1) 1.0) + (sp-rnd-flt spt-z -1024.0 2048.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.05) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 24.0 40.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-accel-y 0.68266666 0.68266666 1.0) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 111) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 0.1) + (sp-rnd-flt spt-x (meters -0.25) (meters 0.5) 1.0) + (sp-flt spt-y (meters 0.15)) + (sp-rnd-flt spt-z -1024.0 2048.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.1) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0) (meters 0.006666667) 1.0) + (sp-flt spt-accel-y 1.3653333) + (sp-flt spt-friction 0.96) + (sp-int spt-timer 1500) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-above-and-die) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 112) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 19 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 0.05) + (sp-rnd-flt spt-x (meters -1.0) (meters 2.0) 1.0) + (sp-rnd-flt spt-z -4096.0 8192.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.5) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.001) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.42666668) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 113) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 113) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 360) + (sp-launcher-by-id spt-next-launcher 114) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 114) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.7111111) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 115) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 19 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-rnd-flt spt-num 0.04 0.03 1.0) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-z -819.2 1638.4 1.0) + (sp-flt spt-scale-x (meters 0.5)) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-flt spt-scalevel-x (meters 0.008333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.64) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 116) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 116) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 6 + (sp-flt spt-scalevel-x (meters 0.006666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 117) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 117) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-x (meters 0.005)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.32) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 118) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #xa :page #x2)) + (sp-flt spt-num 0.06) + (sp-flt spt-x (meters 10.0)) + (sp-rnd-flt spt-scale-x (meters 0.75) (meters 1.5) 1.0) + (sp-flt spt-rot-y (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.75) (meters 1.5) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters 0.01) (meters 0.006666667) 1.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.0033333334) (meters 0.004333333) 1.0) + (sp-flt spt-fade-a 0.7111111) + (sp-flt spt-friction 0.94) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 119) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 119) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int-plain-rnd spt-next-time 90 119 1) + (sp-launcher-by-id spt-next-launcher 120) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 120) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.21333334) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 121) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 20 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-rnd-flt spt-num 0.05 0.4 1.0) + (sp-rnd-flt spt-x (meters -0.5) (meters 1.0) 1.0) + (sp-rnd-flt spt-z 2048.0 6144.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.7) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.0016666667) (meters 0.003) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a 0.42666668) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 122) + (sp-flt spt-rotate-y (degrees 0.0)) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 122) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 360) + (sp-launcher-by-id spt-next-launcher 123) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 123) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.7111111) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-group-id-table* 40) + (new 'static 'sparticle-launch-group + :length 30 + :duration #x384 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-part-water-splash" + :launcher + (new 'static 'inline-array sparticle-group-item 30 + (sp-item 124 :flags (is-3d) :period 900 :length 63) + (sp-item 125 :period 900 :length 15) + (sp-item 126 :flags (is-3d) :period 900 :length 15) + (sp-item 127 :flags (is-3d) :period 900 :length 15) + (sp-item 128 :period 900 :length 15 :binding 129) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 130 :flags (is-3d) :period 900 :length 15 :offset 840) + (sp-item 131 :flags (is-3d) :period 900 :length 60 :offset 840) + (sp-item 132 :period 900 :length 10 :offset 840 :binding 133) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + (sp-item 133 :flags (start-dead) :period 900 :length 120 :offset 840) + ) + :bounds + (new 'static 'sphere :y -49152.0 :w 57344.0) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-group-id-table* 41) + (new 'static 'sparticle-launch-group + :length 16 + :duration #x384 + :linger-duration #x5dc + :flags (sp-group-flag use-local-clock) + :name "group-part-water-splash-small" + :launcher + (new 'static 'inline-array sparticle-group-item 16 + (sp-item 124 :flags (is-3d) :period 900 :length 63) + (sp-item 125 :period 900 :length 15) + (sp-item 126 :flags (is-3d) :period 900 :length 15) + (sp-item 127 :flags (is-3d) :period 900 :length 15) + (sp-item 128 :period 900 :length 10 :binding 129) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + (sp-item 129 :flags (start-dead) :period 900 :length 120) + ) + :bounds + (new 'static 'sphere :y -49152.0 :w 57344.0) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 129) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 18 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 0.4) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 133) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 18 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 0.4) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.05) (meters 0.15) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-flt spt-scalevel-x (meters 0.000033333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -1.6384001 -0.81920004 1.0) + (sp-int spt-timer 450) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 131) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 0.3) + (sp-rnd-flt spt-scale-x (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.080000006) (meters 0.32000002) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0090666665) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0090666665) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 134) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 132) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 23 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 3.2) + (sp-rnd-flt spt-x (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-y (meters -0.2) (meters 0.4) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters -0.002) (meters 0.004) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.018666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-z (meters -0.002) (meters 0.004) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 135) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 130) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #x10 :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.24000001) (meters 0.71999997) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.8) (meters 1.7600001) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.053333335) (meters 0.013333334) 1.0) + (sp-int spt-timer 240) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 136) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 136) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-scalevel-y (meters 0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 137) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 137) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-scalevel-y (meters 0.0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 138) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 138) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-flt spt-scalevel-y (meters -0.026666667)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 139) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 139) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 3 + (sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-flt spt-scalevel-y (meters -0.053333335)) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 126) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 17 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 2.4) (meters 1.6) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.4) (meters 1.6) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0037333334) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0037333334) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 134) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 134) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 4 + (sp-flt spt-fade-a 0.0) + (sp-int spt-next-time 360) + (sp-launcher-by-id spt-next-launcher 140) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 140) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 2 + (sp-flt spt-fade-a -0.53333336) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 127) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 19 + (sp-tex spt-texture (new 'static 'texture-id :index #x1e :page #x2)) + (sp-rnd-flt spt-num 0.5 1.0 1.0) + (sp-rnd-flt spt-x (meters -0.4) (meters 0.8) 1.0) + (sp-rnd-flt spt-y (meters -0.4) (meters 0.8) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.4) (meters 0.8) 1.0) + (sp-rnd-flt spt-rot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.4) (meters 0.8) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-scalevel-x (meters 0.004) (meters 0.0026666666) 1.0) + (sp-rnd-flt spt-scalevel-y (meters 0.004) (meters 0.0026666666) 1.0) + (sp-flt spt-fade-a 0.32) + (sp-int spt-timer 600) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat) + (sp-int spt-next-time 150) + (sp-launcher-by-id spt-next-launcher 134) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 128) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 22 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 3.2) + (sp-flt spt-x (meters 0.96000004)) + (sp-rnd-flt spt-scale-x (meters 0.35) (meters 0.075) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.075) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.016) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00066666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-rnd-flt spt-accel-y -3.2768002 -0.81920004 1.0) + (sp-int spt-timer 900) + (sp-cpuinfo-flags bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop) + (sp-int spt-next-time 120) + (sp-launcher-by-id spt-next-launcher 135) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 135) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 3 + (sp-flt spt-scalevel-x (meters 0.0)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 125) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 20 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 8.0) + (sp-flt spt-x (meters 0.8)) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.15) (meters 0.05) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters 0.0026666666) (meters 0.0053333333) 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0053333333) (meters 0.0053333333) 1.0) + (sp-flt spt-scalevel-x (meters -0.00033333333)) + (sp-flt spt-scalevel-y (meters -0.00033333333)) + (sp-rnd-flt spt-accel-y -2.1845336 -0.5461334 1.0) + (sp-int spt-timer 375) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 124) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 22 + (sp-tex spt-texture (new 'static 'texture-id :index #x10 :page #x2)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 0.96000004) (meters 0.16000001) 1.0) + (sp-rnd-flt spt-scale-x (meters 0.32000002) (meters 0.96000004) 1.0) + (sp-flt spt-rot-x 16384.0) + (sp-flt spt-rot-y (degrees 90.0)) + (sp-flt spt-rot-z (degrees 0.0)) + (sp-rnd-flt spt-scale-y (meters 0.16000001) (meters 1.7600001) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 48.0 24.0 1.0) + (sp-flt spt-vel-x (meters 0.0026666666)) + (sp-rnd-flt spt-scalevel-x (meters 0.0) (meters 0.0016666667) 1.0) + (sp-flt spt-rotvel-x (degrees 0.2)) + (sp-flt spt-scalevel-y (meters 0.04)) + (sp-int spt-timer 240) + (sp-cpuinfo-flags bit2 bit3 left-multiply-quat set-conerot) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 141) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 141) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 6 + (sp-flt spt-scalevel-x (meters 0.0)) + (sp-flt spt-rotvel-x (degrees 0.16666667)) + (sp-flt spt-scalevel-y (meters 0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 142) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 142) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 6 + (sp-flt spt-rotvel-x (degrees 0.13333334)) + (sp-flt spt-scalevel-y (meters 0.0)) + (sp-flt spt-fade-a -0.64) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 143) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 143) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 5 + (sp-flt spt-rotvel-x (degrees 0.1)) + (sp-flt spt-scalevel-y (meters -0.016666668)) + (sp-int spt-next-time 20) + (sp-launcher-by-id spt-next-launcher 144) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 144) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 3 + (sp-flt spt-rotvel-x (degrees 0.06666667)) + (sp-flt spt-scalevel-y (meters -0.033333335)) + (sp-end) + ) + ) + ) + +;; failed to figure out what this is: +(set! + (-> *part-id-table* 145) + (new 'static 'sparticle-launcher + :init-specs + (new 'static 'inline-array sp-field-init-spec 21 + (sp-tex spt-texture (new 'static 'texture-id :index #x9 :page #x2)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.15) (meters 0.05) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 128.0) + (sp-rnd-flt spt-a 40.0 24.0 1.0) + (sp-rnd-flt spt-vel-x (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-vel-y (meters 0.016666668)) + (sp-rnd-flt spt-vel-z (meters -0.016666668) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00016666666)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-accel-y -2.7306666) + (sp-int spt-timer 300) + (sp-cpuinfo-flags bit2 bit3) + (sp-flt spt-userdata 0.0) + (sp-func spt-func 'check-water-level-drop-and-die) + (sp-int spt-next-time 225) + (sp-launcher-by-id spt-next-launcher 114) + (sp-end) + ) + ) + ) + +;; definition for method 9 of type water-control +;; INFO: Return type mismatch int vs none. +(defmethod dummy-9 water-control ((obj water-control)) + 0 + (none) + ) + +;; definition for method 10 of type water-control +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defmethod dummy-10 water-control ((obj water-control)) + (with-pp + (let ((s5-0 (-> obj flags))) + (cond + ((zero? (logand (-> obj flags) 2)) + (set! (-> obj flags) (logand -97793 (-> obj flags))) + ) + ((and + (logtest? #x200000 (-> obj flags)) + (logtest? (-> obj process state-flags) 256) + ) + (set! (-> obj flags) (logior #x10000 (-> obj flags))) + ) + ((begin + (set! (-> obj top 1 quad) (-> obj top 0 quad)) + (vector<-cspace! + (the-as vector (-> obj top)) + (-> obj process node-list data (-> obj joint-index)) + ) + (+! (-> obj top 0 y) (-> obj top-y-offset)) + (set! (-> obj bottom 1 quad) (-> obj bottom 0 quad)) + (set! (-> obj bottom 0 quad) (-> obj process root trans quad)) + (set! (-> obj flags) (logand -31745 (-> obj flags))) + (set! (-> obj bob-offset) (update! (-> obj bob))) + (cond + ((and + (logtest? (-> obj flags) 256) + (zero? + (logand + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + 512 + ) + ) + ) + (set! + (-> obj real-ocean-offset) + (- + (ocean-get-height (the-as vector (-> obj bottom))) + (-> obj base-height) + ) + ) + (if (zero? (logand (-> obj flags) 512)) + (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) + (set! + (-> obj ocean-offset) + (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2) + ) + ) + ) + ((logtest? #x100000 (-> obj flags)) + (let* ((a0-26 (-> obj volume process 0)) + (f30-0 + (ripple-find-height + (the-as process-drawable a0-26) + 0 + (the-as vector (-> obj bottom)) + ) + ) + ) + (set! (-> obj real-ocean-offset) (- f30-0 (-> obj base-height))) + (if (zero? (logand (-> obj flags) 512)) + (set! (-> obj ocean-offset) (-> obj real-ocean-offset)) + (set! + (-> obj ocean-offset) + (lerp (-> obj ocean-offset) (-> obj real-ocean-offset) 0.2) + ) + ) + (let ((v1-36 (new 'stack-no-clear 'vector))) + (set! (-> v1-36 quad) (-> obj bottom 0 quad)) + (set! (-> v1-36 y) f30-0) + ) + ) + ) + (else + (set! (-> obj real-ocean-offset) 0.0) + (set! (-> obj ocean-offset) 0.0) + ) + ) + (if + (logtest? + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + 512 + ) + (set! (-> obj bob-offset) 0.0) + ) + (set! + (-> obj height) + (+ + (-> obj base-height) + (-> obj ocean-offset) + (-> obj bob-offset) + (-> obj align-offset) + ) + ) + (set! + (-> obj surface-height) + (+ (-> obj base-height) (-> obj real-ocean-offset)) + ) + (set! + (-> obj swim-depth) + (fmax + 0.0 + (- + (- (-> obj surface-height) (-> obj swim-height)) + (-> obj bottom 0 y) + ) + ) + ) + (>= (-> obj height) (-> obj bottom 0 y)) + ) + (if + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1024 + ) + (set! + (-> obj on-water-time) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (set! (-> obj drip-wetness) 1.0) + (set! + (-> obj drip-height) + (fmax + (- (-> obj surface-height) (-> obj bottom 0 y)) + (-> obj drip-height) + ) + ) + (set! (-> obj drip-speed) 15.0) + (if (zero? (logand (-> obj flags) 512)) + (TODO-RENAME-15 obj) + ) + (cond + ((>= (-> obj top 0 y) (-> obj height)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> obj bottom 0 quad)) + (vector-xz-length (-> obj process root transv)) + (set! (-> s4-0 y) (-> obj surface-height)) + (when + (and + (logtest? (-> obj process draw status) 8) + (zero? (-> obj process draw cur-lod)) + (logtest? #x400000 (-> obj flags)) + (logtest? #x800000 (-> obj flags)) + ) + (let ((f30-1 (y-angle (-> obj process root))) + (f28-0 (vector-xz-length (-> obj process root transv))) + ) + (set! + (-> *part-id-table* 118 init-specs 4 initial-valuef) + (+ 24576.0 f30-1) + ) + (set! + (-> *part-id-table* 118 init-specs 19 initial-valuef) + (+ 49152.0 f30-1) + ) + (set! + (-> *part-id-table* 118 init-specs 1 initial-valuef) + (* 0.0000036621095 f28-0) + ) + (set! + (-> *part-id-table* 118 init-specs 2 initial-valuef) + (* 0.1 f28-0) + ) + (set! + (-> *part-id-table* 118 init-specs 13 initial-valuef) + 0.7111111 + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 118) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! + (-> *part-id-table* 121 init-specs 1 initial-valuef) + (* 0.000004150391 f28-0) + ) + (set! (-> *part-id-table* 121 init-specs 18 initial-valuef) f30-1) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 121) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (when (< f28-0 4096.0) + (set! + (-> *part-id-table* 112 init-specs 4 random-rangef) + (-> obj ripple-size) + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 112) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (sp-launch-particles-var + *sp-particle-system-3d* + (-> *part-id-table* 115) + s4-0 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ) + (if (< (-> obj top 1 y) (-> obj height)) + (dummy-13 obj 0.2 s4-0 1 (-> obj process root transv)) + ) + ) + ) + (else + (logior! (-> obj flags) 8192) + ) + ) + (when + (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (let* + ((v1-124 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (s4-1 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data v1-124) + ) + ) + ) + (set! + (-> *part-id-table* 110 init-specs 16 initial-valuef) + (-> obj surface-height) + ) + (set! + (-> *part-id-table* 110 init-specs 1 initial-valuef) + (+ + (lerp-scale + 12.0 + 0.4 + (the + float + (- + (-> *display* base-frame-counter) + (the-as int (-> obj enter-water-time)) + ) + ) + 0.0 + 600.0 + ) + (* 0.00012207031 (vector-xz-length (-> obj process root transv))) + ) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 110) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + (set! + (-> *part-id-table* 111 init-specs 16 initial-valuef) + (-> obj surface-height) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 111) + s4-1 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + (let + ((f30-3 + (- + (+ + (-> obj base-height) + (-> obj ocean-offset) + (-> obj bob-offset) + (-> obj align-offset) + ) + (-> obj swim-height) + ) + ) + ) + (let* ((s4-2 (-> obj process root)) + (v1-146 + (if + (and (nonzero? s4-2) (type-type? (-> s4-2 type) control-info)) + s4-2 + ) + ) + (s4-3 + (and + v1-146 + (< + (- + (-> *display* base-frame-counter) + (-> (the-as control-info v1-146) unknown-dword11) + ) + 150 + ) + ) + ) + ) + (if + (and + (logtest? (-> obj flags) 16) + (and + s4-3 + (zero? + (logand + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1024 + ) + ) + ) + ) + (set! (-> obj bob amp) (* 0.8 (-> obj bob amp))) + ) + (cond + ((and + (logtest? (-> obj flags) 8) + (or + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1024 + ) + (>= f30-3 (-> obj bottom 0 y)) + (and + (logtest? s5-0 2048) + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 4 + ) + (zero? + (logand + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1 + ) + ) + (>= (+ 204.8 f30-3) (-> obj bottom 0 y)) + ) + ) + (or + (logtest? s5-0 2048) + (< 12288.0 (vector-xz-length (-> obj process root transv))) + (< + (+ (-> *display* base-frame-counter) -60) + (the-as int (-> obj enter-water-time)) + ) + (>= + (+ + (- + 204.8 + (fmin + 6144.0 + (+ + (-> obj ocean-offset) + (-> obj bob-offset) + (-> obj align-offset) + ) + ) + ) + f30-3 + ) + (-> obj bottom 0 y) + ) + ) + ) + (set! + (-> obj swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (send-event (-> obj process) 'swim) + (logior! (-> obj flags) 2048) + (if (zero? (logand s5-0 2048)) + (set! + (-> obj enter-swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + (cond + ((and + (logtest? (-> obj flags) 16) + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 4 + ) + (zero? (logand #x10000 (-> obj flags))) + ) + (let ((v1-200 (new 'stack-no-clear 'vector))) + (set! (-> v1-200 quad) (-> obj bottom 0 quad)) + (set! (-> v1-200 y) (- (-> obj height) (-> obj swim-height))) + (let ((s4-4 (-> obj process root))) + (when + (and + (zero? + (logand (-> (the-as collide-shape-moving s4-4) status) 4096) + ) + (logtest? (-> obj flags) 2048) + (zero? + (logand + (-> + (the-as collide-shape-moving s4-4) + root-prim + prim-core + action + ) + 512 + ) + ) + ) + (let + ((a1-27 + (vector-! + (new 'stack-no-clear 'vector) + v1-200 + (-> s4-4 trans) + ) + ) + ) + (vector-float*! a1-27 a1-27 (-> *display* frames-per-second)) + (dummy-37 (the-as collide-shape-moving s4-4) a1-27) + ) + (logior! (-> (the-as collide-shape-moving s4-4) status) 1031) + ) + ) + ) + ) + ((and + (< (-> obj bottom 0 y) f30-3) + (zero? (logand #x10000 (-> obj flags))) + ) + (logior! (-> obj flags) 4096) + ) + ) + ) + ((begin + (set! + s4-3 + (and + (logtest? (-> obj flags) 4) + (or + (not (!= (-> obj bob amp) 0.0)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> obj swim-time)) + ) + 15 + ) + ) + (and + (>= (- (-> obj height) (-> obj wade-height)) (-> obj bottom 0 y)) + s4-3 + ) + ) + ) + s4-3 + ) + (set! + (-> obj wade-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (send-event (-> obj process) 'wade) + (logior! (-> obj flags) 1024) + ) + ) + ) + (when + (and + (logtest? (-> obj flags) 8) + (< (-> obj bottom 1 y) f30-3) + (and (< f30-3 (-> obj bottom 0 y)) (logtest? s5-0 4096)) + ) + (logior! (-> obj flags) 2048) + (let ((a1-30 (new 'stack-no-clear 'vector))) + (set! (-> a1-30 quad) (-> obj bottom 0 quad)) + (let ((s5-1 (-> obj process root))) + (set! (-> a1-30 y) f30-3) + (when + (zero? + (logand + (-> (the-as collide-shape-moving s5-1) root-prim prim-core action) + 512 + ) + ) + (let + ((f30-4 (-> (the-as collide-shape-moving s5-1) ground-impact-vel))) + (TODO-RENAME-61 + (the-as collide-shape-moving s5-1) + a1-30 + (-> s5-1 transv) + *up-vector* + ) + (logior! (-> (the-as collide-shape-moving s5-1) status) 1024) + (set! + (-> (the-as collide-shape-moving s5-1) ground-impact-vel) + f30-4 + ) + ) + ) + ) + ) + ) + ) + (when + (and (logtest? #x20000 (-> obj flags)) (= (-> obj process type) target)) + (when + (and + (logtest? + (-> (the-as collide-shape-moving (-> obj process root)) status) + 1025 + ) + (zero? + (logand + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + 512 + ) + ) + ) + (when (< (-> obj process root trans y) -409.6) + (send-event (-> obj process) 'no-look-around 450) + (when + (zero? + (logand + (-> + (the-as collide-shape-moving (-> obj process root)) + root-prim + prim-core + action + ) + #x4000 + ) + ) + (cond + ((= (-> obj process type) target) + (let ((a1-32 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-32 from) pp) + (set! (-> a1-32 num-params) 2) + (set! (-> a1-32 message) 'attack) + (set! (-> a1-32 param 0) (the-as uint #f)) + (let ((v1-275 (new 'static 'attack-info :mask #xe0))) + (set! (-> v1-275 shove-up) 2048.0) + (set! (-> v1-275 shove-back) 0.0) + (set! (-> v1-275 mode) 'tar) + (set! (-> a1-32 param 1) (the-as uint v1-275)) + ) + (send-event-function (-> obj process) a1-32) + ) + ) + (else + (let ((a1-33 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-33 from) pp) + (set! (-> a1-33 num-params) 4) + (set! (-> a1-33 message) 'attack) + (set! (-> a1-33 param 0) (the-as uint #f)) + (set! (-> a1-33 param 1) (the-as uint 'tar)) + (let ((v1-281 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-281) + (set! (-> a1-33 param 2) (the-as uint v1-281)) + ) + (set! (-> a1-33 param 3) (the-as uint 0)) + (send-event-function (-> obj process) a1-33) + ) + ) + ) + ) + (let ((v1-283 (-> obj process))) + (set! + (-> (the-as collide-shape-moving (-> v1-283 root)) surf) + *tar-surface* + ) + (set! + (-> + (the-as collide-shape-moving (-> v1-283 root)) + ground-pat + material + ) + 4 + ) + ) + ) + (set! (-> obj swim-height) (lerp (-> obj swim-height) 7372.8 0.05)) + ) + ) + ) + (else + (if (logtest? (-> obj flags) 512) + (TODO-RENAME-16 obj) + ) + ) + ) + ) + (when + (not + (or + (zero? (logand (-> obj flags) 64)) + (zero? (logand #x800000 (-> obj flags))) + (= (-> obj drip-wetness) 0.0) + ) + ) + (cond + ((logtest? (-> obj flags) #x8000) + (let + ((a2-15 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data (-> obj drip-joint-index)) + ) + ) + ) + (set! + (-> *part-id-table* 145 init-specs 16 initial-valuef) + (fmax (-> obj surface-height) (-> obj bottom 0 y)) + ) + (set! + (-> *part-id-table* 145 init-specs 8 initial-valuef) + (* 0.05 (- (-> a2-15 x) (-> obj drip-old-pos x))) + ) + (set! + (-> *part-id-table* 145 init-specs 9 initial-valuef) + (* 0.05 (- (-> a2-15 y) (-> obj drip-old-pos y))) + ) + (set! + (-> *part-id-table* 145 init-specs 10 initial-valuef) + (* 0.05 (- (-> a2-15 z) (-> obj drip-old-pos z))) + ) + (sp-launch-particles-var + *sp-particle-system-2d* + (-> *part-id-table* 145) + a2-15 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + (set! (-> obj drip-time) (the-as uint (-> *display* base-frame-counter))) + (set! (-> obj flags) (logand -32769 (-> obj flags))) + (set! + (-> obj drip-wetness) + (seek (-> obj drip-wetness) 0.0 (* 0.001 (-> obj drip-speed))) + ) + (set! (-> obj drip-speed) (* 1.05 (-> obj drip-speed))) + (if (= (-> obj drip-wetness) 0.0) + (set! (-> obj drip-height) 0.0) + ) + ) + ((>= + (- + (-> *display* base-frame-counter) + (the int (/ (the float (-> obj drip-time)) (-> obj drip-mult))) + ) + (the int (-> obj drip-speed)) + ) + (let* + ((s5-2 (rand-vu-int-range 3 (+ (-> obj process node-list length) -1))) + (v1-328 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> obj process node-list data s5-2) + ) + ) + ) + (when + (and + (< + (- (-> v1-328 y) (-> obj process root trans y)) + (-> obj drip-height) + ) + (< (-> obj height) (-> v1-328 y)) + ) + (set! (-> obj drip-joint-index) s5-2) + (set! (-> obj drip-old-pos quad) (-> v1-328 quad)) + (logior! (-> obj flags) #x8000) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 11 of type water-control +;; INFO: Return type mismatch int vs none. +(defmethod + start-bobbing! + water-control + ((obj water-control) (arg0 float) (arg1 int) (arg2 int)) + (activate! (-> obj bob) (- arg0) arg1 arg2 0.9 1.0) + 0 + (none) + ) + +;; definition for function part-water-splash-callback +;; INFO: Return type mismatch int vs none. +(defun part-water-splash-callback ((arg0 part-tracker)) + (let ((f1-0 (-> arg0 root trans y)) + (f0-0 (the-as float (-> arg0 userdata))) + ) + (set! (-> *part-id-table* 128 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 132 init-specs 18 initial-valuef) f1-0) + (set! (-> *part-id-table* 125 init-specs 16 initial-valuef) f1-0) + (set! (-> *part-id-table* 129 init-specs 15 initial-valuef) f1-0) + (set! (-> *part-id-table* 133 init-specs 15 initial-valuef) f1-0) + (set! + (-> *part-id-table* 129 init-specs 12 initial-valuef) + (* 13.653334 (* -0.15 f0-0)) + ) + (set! + (-> *part-id-table* 129 init-specs 12 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 133 init-specs 12 initial-valuef) + (* 13.653334 (* -0.15 f0-0)) + ) + (set! + (-> *part-id-table* 133 init-specs 12 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 2 initial-valuef) + (* 4096.0 (* 0.1 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 2 random-rangef) + (* 4096.0 (* 0.4 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 4 initial-valuef) + (* 4096.0 (* 0.1 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 4 random-rangef) + (* 4096.0 (* 0.4 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 9 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 9 random-rangef) + (* 13.653334 (* 3.4 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 10 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 131 init-specs 10 random-rangef) + (* 13.653334 (* 3.4 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 2 initial-valuef) + (* 4096.0 (* 3.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 2 random-rangef) + (* 4096.0 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 4 initial-valuef) + (* 4096.0 (* 3.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 4 random-rangef) + (* 4096.0 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 9 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 9 random-rangef) + (* 13.653334 (* 1.4 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 10 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 126 init-specs 10 random-rangef) + (* 13.653334 (* 1.4 f0-0)) + ) + (set! + (-> *part-id-table* 127 init-specs 2 initial-valuef) + (* 4096.0 (* -0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 2 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 3 initial-valuef) + (* 4096.0 (* -0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 3 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 4 initial-valuef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 4 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 6 initial-valuef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! (-> *part-id-table* 127 init-specs 6 random-rangef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 127 init-specs 11 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 127 init-specs 11 random-rangef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 127 init-specs 12 initial-valuef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 127 init-specs 12 random-rangef) + (* 13.653334 f0-0) + ) + (set! (-> *part-id-table* 132 init-specs 1 initial-valuef) (* 4.0 f0-0)) + (set! + (-> *part-id-table* 132 init-specs 2 initial-valuef) + (* 4096.0 (* -0.25 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 2 random-rangef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 3 initial-valuef) + (* 4096.0 (* -0.25 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 3 random-rangef) + (* 4096.0 (* 0.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 10 initial-valuef) + (* 13.653334 (* -0.75 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 10 random-rangef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 12 initial-valuef) + (* 13.653334 (* -0.75 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 12 random-rangef) + (* 13.653334 (* 1.5 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 11 initial-valuef) + (* 13.653334 (* 7.0 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 11 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 15 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 132 init-specs 15 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! (-> *part-id-table* 128 init-specs 1 initial-valuef) (* 4.0 f0-0)) + (set! (-> *part-id-table* 128 init-specs 2 initial-valuef) (* 1.2 f0-0)) + (set! + (-> *part-id-table* 128 init-specs 9 initial-valuef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 128 init-specs 9 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 initial-valuef) + (* 13.653334 (* 6.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 9 initial-valuef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 128 init-specs 9 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 initial-valuef) + (* 13.653334 (* 6.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 10 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 128 init-specs 13 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! (-> *part-id-table* 125 init-specs 1 initial-valuef) (* 8.0 f0-0)) + (set! (-> *part-id-table* 125 init-specs 2 initial-valuef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 125 init-specs 9 initial-valuef) + (* 13.653334 f0-0) + ) + (set! + (-> *part-id-table* 125 init-specs 9 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 10 initial-valuef) + (* 13.653334 (* 6.0 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 10 random-rangef) + (* 13.653334 (* 2.0 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 13 initial-valuef) + (* 13.653334 (* -0.3 f0-0)) + ) + (set! + (-> *part-id-table* 125 init-specs 13 random-rangef) + (* 13.653334 (* -0.075 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 2 initial-valuef) + (* 4096.0 (* 1.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 2 random-rangef) + (* 4096.0 (* 0.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 3 initial-valuef) + (* 4096.0 (* 0.4 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 3 random-rangef) + (* 4096.0 (* 1.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 7 initial-valuef) + (* 4096.0 (* 0.2 f0-0)) + ) + (set! + (-> *part-id-table* 124 init-specs 7 random-rangef) + (* 4096.0 (* 2.2 f0-0)) + ) + (set! + (-> *part-id-table* 130 init-specs 2 initial-valuef) + (* 4096.0 (* 0.3 f0-0)) + ) + (set! + (-> *part-id-table* 130 init-specs 2 random-rangef) + (* 4096.0 (* 0.9 f0-0)) + ) + (set! (-> *part-id-table* 130 init-specs 6 initial-valuef) (* 4096.0 f0-0)) + (set! + (-> *part-id-table* 130 init-specs 6 random-rangef) + (* 4096.0 (* 2.2 f0-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 15 of type water-control +;; INFO: Return type mismatch int vs none. +(defmethod TODO-RENAME-15 water-control ((obj water-control)) + (with-pp + (logior! (-> obj flags) 512) + (set! (-> obj flags) (logand -65537 (-> obj flags))) + (set! + (-> obj enter-water-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set-vector! + (-> obj enter-water-pos) + (-> obj bottom 0 x) + (-> obj surface-height) + (-> obj bottom 0 z) + 1.0 + ) + (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) pp) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'ground-height)) + (let* ((f0-4 (the-as float (send-event-function (-> obj process) a1-1))) + (f30-0 (lerp-scale 0.3 1.0 f0-4 2048.0 24576.0)) + ) + (if (nonzero? (-> obj process skel effect)) + (dummy-10 (-> obj process skel effect) 'swim-stroke 0.0 -1) + ) + (dummy-13 + obj + f30-0 + (-> obj enter-water-pos) + 1 + (-> obj process root transv) + ) + ) + ) + ) + (if (logtest? #x20000 (-> obj flags)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + ) + +;; definition for method 16 of type water-control +;; INFO: Return type mismatch int vs none. +(defmethod TODO-RENAME-16 water-control ((obj water-control)) + (set! (-> obj flags) (logand -513 (-> obj flags))) + (set-zero! (-> obj bob)) + (if (logtest? #x20000 (-> obj flags)) + (set! (-> obj swim-height) 2867.2) + ) + 0 + (none) + ) + +;; definition for function splash-spawn +;; INFO: Return type mismatch int vs none. +(defun splash-spawn ((arg0 basic) (arg1 basic) (arg2 int)) + (let ((s4-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker s4-0) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s4-0 part-tracker-init (if (zero? arg2) + (-> *part-group-id-table* 41) + (-> *part-group-id-table* 40) + ) + -1 + part-water-splash-callback + arg0 + #f + arg1 + ) + (-> s4-0 ppointer) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type water-control +;; INFO: Return type mismatch int vs none. +(defmethod + dummy-13 + water-control + ((obj water-control) (arg0 float) (arg1 vector) (arg2 int) (arg3 vector)) + (when (and (logtest? (-> obj flags) 32) (logtest? #x800000 (-> obj flags))) + (let ((a1-3 (vector+float*! (new 'stack-no-clear 'vector) arg1 arg3 0.05))) + (set! (-> a1-3 y) (-> obj surface-height)) + (splash-spawn (the-as basic arg0) (the-as basic a1-3) arg2) + ) + ) + 0 + (none) + ) + +;; definition for method 27 of type water-vol +;; INFO: Return type mismatch int vs none. +(defmethod dummy-27 water-vol ((obj water-vol)) + (when (handle->process (-> obj target)) + (let ((v1-7 (-> (the-as target (-> obj target process 0)) water))) + (set! (-> v1-7 flags) (logand -129892623 (-> v1-7 flags))) + (set! (-> v1-7 volume) (the-as handle #f)) + ) + (set! (-> obj target) (the-as handle #f)) + (iterate-process-tree *entity-pool* (lambda ((arg0 water-vol)) + (with-pp + (if + (and + (type-type? (-> arg0 type) water-vol) + (!= arg0 pp) + ) + (send-event arg0 'update) + ) + ) + ) + *null-kernel-context* + ) + (process-entity-status! obj (entity-perm-status bit-3) #f) + ) + 0 + (none) + ) + +;; definition for method 26 of type water-vol +;; INFO: Return type mismatch int vs none. +(defmethod TODO-RENAME-26 water-vol ((obj water-vol)) + (with-pp + (cond + ((handle->process (-> obj target)) + (cond + ((not + (dummy-10 + (-> obj vol) + (-> (the-as target (-> obj target process 0)) control trans) + ) + ) + (dummy-27 obj) + ) + (else + (let ((v1-15 (-> (the-as target (-> obj target process 0)) water))) + (when + (and + (logtest? #x80000 (-> obj flags)) + (logtest? (-> v1-15 flags) 512) + (>= (-> v1-15 surface-height) (-> v1-15 bottom 0 y)) + ) + (let ((v1-18 (-> obj attack-event))) + (case v1-18 + ((#f) + ) + (('heat) + (send-event + (handle->process (-> obj target)) + 'heat + (* 10.0 (-> *display* seconds-per-frame)) + ) + ) + (('drown-death 'lava 'dark-eco-pool) + (let ((a1-8 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-8 from) pp) + (set! (-> a1-8 num-params) 2) + (set! (-> a1-8 message) 'attack-invinc) + (set! (-> a1-8 param 0) (the-as uint #f)) + (let ((a0-19 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-19 mode) v1-18) + (set! (-> a1-8 param 1) (the-as uint a0-19)) + ) + (if (send-event-function (handle->process (-> obj target)) a1-8) + (send-event obj 'notify 'attack) + ) + ) + ) + (else + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) pp) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((a0-27 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-27 mode) v1-18) + (set! (-> a1-10 param 1) (the-as uint a0-27)) + ) + (if (send-event-function (handle->process (-> obj target)) a1-10) + (send-event obj 'notify 'attack) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ((and + *target* + (and + (not (handle->process (-> *target* water volume))) + (dummy-10 (-> obj vol) (-> *target* control trans)) + ) + ) + (let ((s5-0 (-> *target* water))) + (process-entity-status! obj (entity-perm-status bit-3) #t) + (set! (-> s5-0 volume) (process->handle obj)) + (set! (-> obj target) (process->handle *target*)) + (logior! (-> s5-0 flags) 2) + (set! (-> s5-0 base-height) (-> obj water-height)) + (set! (-> s5-0 ocean-offset) 0.0) + (logior! (-> s5-0 flags) (-> obj flags)) + (if (< 0.0 (-> obj wade-height)) + (set! (-> s5-0 wade-height) (-> obj wade-height)) + ) + (if (< 0.0 (-> obj swim-height)) + (set! (-> s5-0 swim-height) (-> obj swim-height)) + ) + (if (< 0.0 (-> obj bottom-height)) + (set! (-> s5-0 bottom-height) (-> obj bottom-height)) + ) + (set-zero! (-> s5-0 bob)) + ) + ) + ) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defstate water-vol-startup (water-vol) + :virtual #t + :code + (behavior () + (go-virtual water-vol-idle) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate water-vol-idle (water-vol) + :virtual #t + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (if (= v1-0 'update) + (TODO-RENAME-26 self) + ) + ) + ) + ) + :exit + (behavior () + (dummy-27 self) + (none) + ) + :trans + (behavior () + (TODO-RENAME-26 self) + (none) + ) + :code + (the-as (function none :behavior water-vol) anim-loop) + ) + +;; definition for method 24 of type water-vol +(defmethod set-stack-size! water-vol ((obj water-vol)) + (stack-size-set! (-> obj main-thread) 128) + (none) + ) + +;; definition for method 23 of type water-vol +;; INFO: Return type mismatch trsqv vs none. +(defmethod reset-root! water-vol ((obj water-vol)) + (set! (-> obj root) (new 'process 'trsqv)) + (none) + ) + +;; definition for method 25 of type water-vol +;; INFO: Return type mismatch int vs object. +(defmethod TODO-RENAME-25 water-vol ((obj water-vol)) + (the-as object 0) + ) + +;; definition for method 29 of type water-vol +;; WARN: disable def twice: 85. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +;; Used lq/sq +(defmethod TODO-RENAME-29 water-vol ((obj water-vol)) + (local-vars (sv-16 res-tag)) + (set! + (-> obj attack-event) + (the-as + symbol + ((method-of-type res-lump get-property-struct) + (-> obj entity) + 'attack-event + 'interp + -1000000000.0 + 'drown + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (process-drawable-from-entity! obj (the-as entity-actor (-> obj entity))) + (logclear! (-> obj mask) (process-mask actor-pause)) + (set! (-> obj vol) (new 'process 'vol-control obj)) + (logior! (-> obj vol flags) 3) + (set! (-> obj bottom-height) 32768.0) + (set! (-> obj target) (the-as handle #f)) + (set! sv-16 (new 'static 'res-tag)) + (let + ((v1-8 + (the-as + (pointer float) + ((method-of-type res-lump get-property-data) + (-> obj entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (when v1-8 + (set! (-> obj water-height) (-> v1-8 0)) + (set! (-> obj wade-height) (-> v1-8 1)) + (set! (-> obj swim-height) (-> v1-8 2)) + (if (>= (-> sv-16 elt-count) (the-as uint 4)) + (set! (-> obj flags) (the-as uint (the int (-> v1-8 3)))) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 5)) + (set! (-> obj bottom-height) (-> v1-8 4)) + ) + ) + ) + (set! (-> obj flags) (logior #x800000 (-> obj flags))) + (cond + ((zero? (-> obj flags)) + (if (< 0.0 (-> obj wade-height)) + (logior! (-> obj flags) 4) + ) + (when (< 0.0 (-> obj swim-height)) + (let ((v0-4 (logior (-> obj flags) 8))) + (set! (-> obj flags) v0-4) + v0-4 + ) + ) + ) + (else + (the-as uint #f) + ) + ) + ) + +;; definition for method 22 of type water-vol +;; INFO: Return type mismatch int vs ripple-wave-set. +(defmethod TODO-RENAME-22 water-vol ((obj water-vol)) + (the-as ripple-wave-set 0) + ) + +;; definition for function water-vol-init-by-other +;; INFO: Return type mismatch object vs none. +(defbehavior water-vol-init-by-other water-vol ((arg0 entity)) + (set! (-> self entity) arg0) + (set-stack-size! self) + (reset-root! self) + (TODO-RENAME-29 self) + (TODO-RENAME-25 self) + (TODO-RENAME-22 self) + (go-virtual water-vol-startup) + (none) + ) + +;; definition for method 11 of type water-vol +;; INFO: Return type mismatch object vs none. +(defmethod init-from-entity! water-vol ((obj water-vol) (arg0 entity-actor)) + (set-stack-size! obj) + (reset-root! obj) + (TODO-RENAME-29 obj) + (TODO-RENAME-25 obj) + (TODO-RENAME-22 obj) + (go (method-of-object obj water-vol-startup)) + (none) + ) diff --git a/test/decompiler/reference/engine/target/logic-target_REF.gc b/test/decompiler/reference/engine/target/logic-target_REF.gc index 55ee3eed2c..4d6b0975c8 100644 --- a/test/decompiler/reference/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/engine/target/logic-target_REF.gc @@ -371,20 +371,20 @@ (let ((s4-2 format) (s3-2 arg1) (s2-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%") - (s1-2 (-> arg0 control unknown-int50)) + (s1-2 (-> arg0 control unknown-int60)) (s0-2 (pat-mode->string - (the-as pat-surface (-> arg0 control unknown-int50)) + (the-as pat-surface (-> arg0 control unknown-int60)) ) ) ) (set! sv-96 - (pat-material->string (the-as pat-surface (-> arg0 control unknown-int50))) + (pat-material->string (the-as pat-surface (-> arg0 control unknown-int60))) ) (let ((t1-2 - (pat-event->string (the-as pat-surface (-> arg0 control unknown-int50))) + (pat-event->string (the-as pat-surface (-> arg0 control unknown-int60))) ) ) (s4-2 s3-2 s2-2 s1-2 s0-2 sv-96 t1-2) @@ -1071,13 +1071,13 @@ ) ) (set! - (-> self control unknown-dword60) + (-> self control unknown-dword70) (-> *display* base-frame-counter) ) ) (if (< - (- (-> *display* base-frame-counter) (-> self control unknown-dword60)) + (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) 60 ) (set! f30-4 (+ 204800.0 f30-4)) @@ -1258,7 +1258,7 @@ 150 ) (logtest? (-> self control unknown-surface01 flags) 16) - (!= (-> self control unknown-float40) 0.0) + (!= (-> self control unknown-float41) 0.0) ) (zero? (logand (-> self control unknown-surface01 flags) 32)) ) @@ -1653,7 +1653,7 @@ (if (< (logand - (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) + (- (-> *display* base-frame-counter) (-> self control unknown-dword80)) 3 ) 1 @@ -1663,8 +1663,8 @@ ) (if (>= - (- (-> *display* base-frame-counter) (-> self control unknown-dword70)) - (-> self control unknown-dword71) + (- (-> *display* base-frame-counter) (-> self control unknown-dword80)) + (-> self control unknown-dword81) ) (target-timed-invulnerable-off self) ) @@ -2025,12 +2025,12 @@ (cond ((and (< 2457.6 (vector-length s4-2)) - (not (-> self control unknown-int20)) + (not (-> self control unknown-int21)) ) (TODO-RENAME-28 (-> self control) (vector-normalize! s4-2 2457.6)) ) (else - (set! (-> self control unknown-int20) (the-as int #t)) + (set! (-> self control unknown-int21) (the-as int #t)) (TODO-RENAME-30 (-> self control) (vector-! @@ -2267,7 +2267,7 @@ (target-calc-camera-pos) (when (logtest? (-> self state-flags) #x4000) (set! (-> self state-flags) (logand -28673 (-> self state-flags))) - (set! (-> self control unknown-float40) 0.0) + (set! (-> self control unknown-float41) 0.0) ) (set! (-> self control unknown-int00) 0) 0 @@ -2282,9 +2282,9 @@ (countdown (s5-0 gp-0) (set! (-> self control unknown-int40) s5-0) (flag-setup) - (if (< (-> self control unknown-float40) 0.0) + (if (< (-> self control unknown-float41) 0.0) (set! - (-> self control unknown-float40) + (-> self control unknown-float41) (- 1.0 (-> self control unknown-cpad-info00 stick0-speed)) ) ) @@ -2308,9 +2308,9 @@ ) (set! f30-0 0.0) ) - (when (!= (-> self control unknown-float40) 0.0) - (let ((f0-12 (fmin 1.0 (-> self control unknown-float40)))) - (set! (-> self control unknown-float40) f0-12) + (when (!= (-> self control unknown-float41) 0.0) + (let ((f0-12 (fmin 1.0 (-> self control unknown-float41)))) + (set! (-> self control unknown-float41) f0-12) (let ((a1-2 (vector-float*! (new 'stack-no-clear 'vector) (if (= f30-0 0.0) *zero-vector* @@ -2711,7 +2711,7 @@ (set! (-> self cam-user-mode) 'normal) (set! (-> self control unknown-handle10) (the-as handle #f)) (set! (-> self control unknown-handle00) (the-as handle #f)) - (set! (-> self control unknown-dword72) 0) + (set! (-> self control unknown-dword82) 0) (buzz-stop! 0) self ) @@ -2840,7 +2840,7 @@ (add-connection *debug-engine* self target-print-stats self *stdcon0* #f) ) (activate-hud self) - (set! (-> self fp-hud) (the-as uint #f)) + (set! (-> self fp-hud) (the-as handle #f)) (set! (-> self water) (new 'process 'water-control self 9 0.0 8192.0 2048.0)) (set! (-> self water flags) (the-as uint #x4000f0)) (reset-target-state #t) diff --git a/test/decompiler/reference/engine/target/sidekick_REF.gc b/test/decompiler/reference/engine/target/sidekick_REF.gc new file mode 100644 index 0000000000..af98374661 --- /dev/null +++ b/test/decompiler/reference/engine/target/sidekick_REF.gc @@ -0,0 +1,333 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *sidekick-remap*, type pair +(define + *sidekick-remap* + '( + ("run-to-stance-left" + "run-to-stance" + ) + ("run-to-stance-loop-left" + "run-to-stance-loop" + ) + ("stance-loop-left" + "stance-loop" + ) + ("run-to-stance-right" + "run-to-stance" + ) + ("run-to-stance-loop-right" + "run-to-stance-loop" + ) + ("stance-loop-right" + "stance-loop" + ) + ("run-to-stance-up" + "run-to-stance" + ) + ("run-to-stance-loop-up" + "run-to-stance-loop" + ) + ("stance-loop-up" + "stance-loop" + ) + ("run-to-stance-down" + "run-to-stance" + ) + ("run-to-stance-loop-down" + "run-to-stance-loop" + ) + ("stance-loop-down" + "stance-loop" + ) + ("run-right" + "run" + ) + ("run-left" + "run" + ) + ("walk-right" + "walk" + ) + ("walk-left" + "walk" + ) + ("edge-grab-stance1" + "edge-grab-stance1" + "edge-grab-stance1-alt" + ) + ("pole-cycle" "pole-cycle" "pole-cycle2") + ) + ) + +;; definition for function cspace<-cspace+quaternion! +(defun cspace<-cspace+quaternion! ((arg0 cspace) (arg1 cspace) (arg2 quaternion)) + (rlet ((Q :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (-> arg0 bone transform))) + (quaternion->matrix s5-0 arg2) + (.lvf vf1 (&-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (.lvf vf2 (&-> (-> arg1 bone) transform vector 3 quad)) + (.lvf vf3 (&-> s5-0 vector 0 quad)) + (.lvf vf4 (&-> s5-0 vector 1 quad)) + (.lvf vf5 (&-> s5-0 vector 2 quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.mov.vf vf2 vf0 :mask #b1000) + (.mul.x.vf vf3 vf3 vf1) + (.mul.y.vf vf4 vf4 vf1) + (.mul.z.vf vf5 vf5 vf1) + (.svf (&-> s5-0 vector 3 quad) vf2) + (.svf (&-> s5-0 vector 0 quad) vf3) + (.svf (&-> s5-0 vector 1 quad) vf4) + (.svf (&-> s5-0 vector 2 quad) vf5) + s5-0 + ) + ) + ) + +;; failed to figure out what this is: +(defstate sidekick-clone (sidekick) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (case arg2 + (('matrix) + (case (-> arg3 param 0) + (('play-anim) + (set! v0-0 (-> self node-list data)) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param0) + cspace<-cspace+quaternion! + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data)) + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param2) + (the-as basic (-> self parent-override 0 control quat)) + ) + ) + (('copy-parent) + (set! v0-0 (-> self node-list data)) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param0) cspace<-cspace!) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as basic (-> self parent-override 0 node-list data)) + ) + (set! (-> (the-as (inline-array cspace) v0-0) 0 param2) #f) + ) + (else + (set! v0-0 (-> self node-list data)) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param0) + cspace<-cspace+quaternion! + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param1) + (the-as + basic + (-> self parent-override 0 control unknown-cspace10 parent) + ) + ) + (set! + (-> (the-as (inline-array cspace) v0-0) 0 param2) + (the-as basic (-> self parent-override 0 control quat)) + ) + ) + ) + v0-0 + ) + (('shadow) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self shadow-in-movie?) (the-as symbol v0-0)) + v0-0 + ) + (('blend-shape) + (cond + ((-> arg3 param 0) + (set! v0-0 (logior (-> self skel status) 8)) + (set! (-> self skel status) (the-as uint v0-0)) + ) + (else + (set! v0-0 (logand -9 (-> self skel status))) + (set! (-> self skel status) (the-as uint v0-0)) + ) + ) + v0-0 + ) + ) + ) + :code + (the-as (function none :behavior sidekick) looping-code) + :post + (behavior () + (let ((v1-0 'process-drawable-art-error) + (a0-0 (-> self parent-override)) + ) + (when (!= (-> (if a0-0 + (-> a0-0 0 self-override) + ) + next-state + name + ) + v1-0 + ) + (quaternion-copy! + (-> self root quat) + (-> self parent-override 0 control quat) + ) + (set! (-> self anim-seed) (-> self parent-override 0 anim-seed)) + (set! (-> self draw status) (-> self parent-override 0 draw status)) + (joint-control-copy! (-> self skel) (-> self parent-override 0 skel)) + (joint-control-remap! + (-> self skel) + (-> self draw art-group) + (-> self parent-override 0 draw art-group) + *sidekick-remap* + (the-as int (-> self anim-seed)) + "" + ) + (let ((v1-22 (-> self parent-override 0 draw color-mult quad))) + (set! (-> self draw color-mult quad) v1-22) + ) + (let ((v1-26 (-> self parent-override 0 draw color-emissive quad))) + (set! (-> self draw color-emissive quad) v1-26) + ) + (set! + (-> self draw secondary-interp) + (-> self parent-override 0 draw secondary-interp) + ) + (if *debug-segment* + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'draw + (new 'static 'rgba :r #x40 :b #x40 :a #x80) + ) + ) + (dummy-17 self) + (if *debug-segment* + (add-frame + (-> *display* frames (-> *display* on-screen) frame profile-bar 0) + 'draw + (new 'static 'rgba :r #x80 :a #x80) + ) + ) + (vector<-cspace! + (-> self draw origin) + (-> self node-list data (-> self draw origin-joint-index)) + ) + ) + ) + (when *display-sidekick-stats* + (format *stdcon* "~%") + (dummy-10 (-> self skel) (the-as symbol *stdcon*)) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-draw1) + (-> + self + parent-override + 0 + control + unknown-cspace10 + parent + bone + transform + vector + 3 + ) + 409.6 + (new 'static 'rgba :g #xff :a #x80) + ) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-draw1) + (-> self node-list data 3 bone transform vector 3) + 409.6 + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (add-debug-sphere + *display-sidekick-stats* + (bucket-id debug-draw1) + (-> self draw origin) + 409.6 + (new 'static 'rgba :r #xff :g #x80 :a #x80) + ) + ) + (set! + (-> self draw shadow) + (the-as shadow-geo (if (and (movie?) (-> self shadow-in-movie?)) + (-> self draw art-group data 2) + ) + ) + ) + (let ((a0-26 (-> self skel effect))) + (if a0-26 + (TODO-RENAME-9 a0-26) + ) + ) + (if (logtest? (-> self skel status) 72) + (merc-blend-shape self) + ) + (if (logtest? (-> self skel status) 384) + (merc-eye-anim self) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defskelgroup *sidekick-sg* sidekick + 0 + -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :longest-edge (meters 1) + :shadow 2 + :texture-level 2 + :sort 1 + ) + +;; definition for function init-sidekick +;; INFO: Return type mismatch object vs none. +(defbehavior init-sidekick sidekick () + (logior! (-> self mask) (process-mask sidekick)) + (set! (-> self root) (new 'process 'trsqv)) + (vector-identity! (-> self root scale)) + (quaternion-identity! (-> self root quat)) + (initialize-skeleton self *sidekick-sg* '()) + (set! (-> self draw origin-joint-index) (the-as uint 6)) + (set! (-> self draw shadow-joint-index) (the-as uint 6)) + (set! (-> self draw shadow-ctrl) *target-shadow-control*) + (logior! (-> self skel status) 256) + (let ((v1-14 (-> self node-list data))) + (set! (-> v1-14 0 param0) cspace<-cspace+quaternion!) + (set! + (-> v1-14 0 param1) + (the-as basic (-> self parent-override 0 control unknown-cspace10 parent)) + ) + (set! + (-> v1-14 0 param2) + (the-as basic (-> self parent-override 0 control quat)) + ) + ) + (set! (-> self shadow-in-movie?) #t) + (go sidekick-clone) + (none) + ) + +;; definition for function starts +(defun starts () + (send-event *target* 'sidekick #t) + ) diff --git a/test/decompiler/reference/engine/target/target-h_REF.gc b/test/decompiler/reference/engine/target/target-h_REF.gc index 3b8796a7f0..e3931983f8 100644 --- a/test/decompiler/reference/engine/target/target-h_REF.gc +++ b/test/decompiler/reference/engine/target/target-h_REF.gc @@ -3,7 +3,8 @@ ;; definition of type target (deftype target (process-drawable) - ((control control-info :offset 112) + ((self-override target :offset 28) + (control control-info :offset 112) (fact-info-target fact-info-target :offset 144) (skel2 basic :offset-assert 176) (racer racer-info :offset-assert 180) @@ -20,12 +21,12 @@ (alt-cam-pos vector :inline :offset-assert 448) (snowball snowball-info :offset-assert 464) (tube tube-info :offset-assert 468) - (flut basic :offset-assert 472) + (flut flut-info :offset-assert 472) (current-level level :offset-assert 476) (saved-pos transformq :inline :offset-assert 480) (saved-owner uint64 :offset-assert 528) (alt-neck-pos vector :inline :offset-assert 544) - (fp-hud uint64 :offset-assert 560) + (fp-hud handle :offset-assert 560) (no-load-wait uint64 :offset-assert 568) (no-look-around-wait uint64 :offset-assert 576) ) @@ -37,8 +38,8 @@ (dummy-20 (_type_ collide-cache) object 20) ) (:states - target-clone-anim - target-death + (target-clone-anim handle) + (target-death symbol) (target-hit-ground symbol) (target-racing-bounce float float symbol) (target-racing-clone-anim handle) @@ -95,9 +96,10 @@ ;; definition of type sidekick (deftype sidekick (process-drawable) - ((control control-info :offset 112) - (anim-seed uint64 :offset 192) - (shadow-in-movie? symbol :offset-assert 200) + ((parent-override (pointer target) :offset 12) + (control control-info :offset 112) + (anim-seed uint64 :offset 192) + (shadow-in-movie? symbol :offset-assert 200) ) :heap-base #x60 :method-count-assert 20 diff --git a/test/decompiler/reference/engine/target/target-util_REF.gc b/test/decompiler/reference/engine/target/target-util_REF.gc index 48ae0beb97..e4170c6114 100644 --- a/test/decompiler/reference/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/engine/target/target-util_REF.gc @@ -1093,7 +1093,8 @@ ) ;; definition for function fall-test -(defbehavior fall-test target ((arg0 symbol) (arg1 symbol)) +;; INFO: Return type mismatch object vs none. +(defbehavior fall-test target () (when (and (zero? (logand (-> self control status) 1)) @@ -1141,10 +1142,12 @@ ) (go target-falling #f) ) + (none) ) ;; definition for function slide-down-test -(defbehavior slide-down-test target ((arg0 symbol) (arg1 symbol)) +;; INFO: Return type mismatch object vs none. +(defbehavior slide-down-test target () (if (and (zero? (logand (-> self control status) 129)) @@ -1157,6 +1160,7 @@ ) (go target-slide-down) ) + (none) ) ;; definition for function smack-surface? @@ -1296,13 +1300,13 @@ ) ) ) - (-> self control unknown-dword30) + (-> self control unknown-dword31) ) ) #t ) (else - (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (set! (-> self control unknown-dword32) (-> *display* base-frame-counter)) #f ) ) @@ -1322,12 +1326,12 @@ (-> *display* base-frame-counter) (the-as int (-> *TARGET-bank* attack-timeout)) ) - (-> self control unknown-dword32) + (-> self control unknown-dword33) ) #t ) (else - (set! (-> self control unknown-dword33) (-> *display* base-frame-counter)) + (set! (-> self control unknown-dword34) (-> *display* base-frame-counter)) #f ) ) @@ -1376,7 +1380,7 @@ ;; definition for function delete-back-vel ;; INFO: Return type mismatch int vs none. ;; Used lq/sq -(defbehavior delete-back-vel target ((arg0 float)) +(defbehavior delete-back-vel target () (let ((s5-0 (new-stack-vector0))) (vector-z-quaternion! s5-0 (-> self control dir-targ)) (let ((gp-0 (new-stack-vector0)) @@ -1425,8 +1429,8 @@ ;; INFO: Return type mismatch int vs none. (defun target-timed-invulnerable ((arg0 seconds) (arg1 target)) (logior! (-> arg1 state-flags) 32) - (set! (-> arg1 control unknown-dword70) (-> *display* base-frame-counter)) - (set! (-> arg1 control unknown-dword71) (the-as int arg0)) + (set! (-> arg1 control unknown-dword80) (-> *display* base-frame-counter)) + (set! (-> arg1 control unknown-dword81) (the-as int arg0)) (dummy-53 (-> arg1 control) 2 4096 0) 0 (none) diff --git a/test/decompiler/reference/engine/target/target2_REF.gc b/test/decompiler/reference/engine/target/target2_REF.gc new file mode 100644 index 0000000000..350430c10d --- /dev/null +++ b/test/decompiler/reference/engine/target/target2_REF.gc @@ -0,0 +1,5981 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate target-load-wait (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('loading) + (set! (-> self state-time) (-> *display* base-frame-counter)) + #f + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :exit + target-exit + :code + (behavior () + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (while (< (- (-> *display* base-frame-counter) (-> self state-time)) 15) + (ja-channel-push! 1 30) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 112)) + ) + (set! + (-> a0-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 112)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-2 param 1) 1.0) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 112)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 4 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + (send-event + *camera* + 'joystick + (-> (new 'static 'array int32 1 0) 0) + (-> (new 'static 'array int32 1 0) 0) + ) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-0 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-0) 90) + (suspend) + (let ((s5-0 (-> self skel root-channel 0))) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 19.0) 0)) + (set! (-> s5-0 param 1) 0.05) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + ) + (ja-channel-push! 1 90) + (let ((gp-1 (-> self skel root-channel 0))) + (set! + (-> gp-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 36)) + ) + (set! + (-> gp-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 36)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-1 param 1) 1.0) + (set! (-> gp-1 frame-num) (ja-aframe (the-as float 40.0) 0)) + (joint-control-channel-group! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 36)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 param 0) + (the float (+ (-> a0-13 frame-group data 0 length) -1)) + ) + (set! (-> a0-13 param 1) 1.0) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-15 (-> self skel root-channel 0))) + (set! + (-> a0-15 frame-group) + (the-as art-joint-anim (-> self draw art-group data 37)) + ) + (set! + (-> a0-15 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 37)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-15 param 1) 1.0) + (set! (-> a0-15 frame-num) 0.0) + (joint-control-channel-group! + a0-15 + (the-as art-joint-anim (-> self draw art-group data 37)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! + (-> a0-16 param 0) + (the float (+ (-> a0-16 frame-group data 0 length) -1)) + ) + (set! (-> a0-16 param 1) 1.0) + (joint-control-channel-group-eval! + a0-16 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (go target-stance) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-stance-ambient (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('movie) + (go target-stance) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self neck flex-blend) 0.0) + ((-> target-stance enter)) + (let ((v1-2 (rand-vu-int-count 4))) + (cond + ((zero? v1-2) + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-1" + :index #xe7 + :parts 1 + :command-list '() + ) + ) + ) + ) + ((= v1-2 1) + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-2" + :index #xe8 + :parts 1 + :command-list '() + ) + ) + ) + ) + ((= v1-2 2) + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-3" + :index #xe9 + :parts 1 + :command-list '() + ) + ) + ) + ) + (else + (set! + (-> self control unknown-uint20) + (the-as + uint + (new 'static 'spool-anim + :name "eichar-ambient-4" + :index #xea + :parts 1 + :command-list '() + ) + ) + ) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :exit + (behavior () + (let ((a0-0 (-> self control unknown-spoolanim00))) + (when a0-0 + (ja-abort-spooled-anim a0-0 (the-as art-joint-anim #f) -1) + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 5)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + ) + ((-> target-stance exit)) + (target-exit) + (none) + ) + :trans + (behavior () + (spool-push + *art-control* + (-> self control unknown-spoolanim00 name) + 0 + self + (the-as float -99.0) + ) + (if + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons start l1 r1 triangle circle x square) + ) + *progress-process* + ) + (go target-stance) + ) + (none) + ) + :code + (behavior () + (while + (let + ((v1-13 + (file-status *art-control* (-> self control unknown-spoolanim00 name) 0) + ) + ) + (not (or (= v1-13 'locked) (= v1-13 'active))) + ) + (suspend) + (let ((a0-0 (-> self skel root-channel 0))) + (set! (-> a0-0 param 0) 1.0) + (joint-control-channel-group-eval! + a0-0 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((a0-1 (-> self skel root-channel 1))) + (set! (-> a0-1 param 0) 0.0) + (joint-control-channel-group-eval! + a0-1 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-2 (-> self skel root-channel 2))) + (set! (-> a0-2 param 0) 0.0) + (joint-control-channel-group-eval! + a0-2 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + (ja-play-spooled-anim + (-> self control unknown-spoolanim00) + (the-as art-joint-anim (-> self draw art-group data 5)) + (the-as art-joint-anim (-> self draw art-group data 5)) + (the-as (function process-drawable symbol) (lambda () + (!= + (-> + *cpad-list* + cpads + 0 + stick0-speed + ) + 0.0 + ) + ) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint #f)) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; definition of type first-person-hud +(deftype first-person-hud (process) + ((max-nb-of-particles int32 :offset-assert 112) + (nb-of-particles int32 :offset-assert 116) + (particles hud-particle 3 :offset-assert 120) + (in-out-position int32 :offset-assert 132) + (sides-x-scale float :offset-assert 136) + (sides-y-scale float :offset-assert 140) + (x-offset int32 :offset-assert 144) + ) + :heap-base #x30 + :method-count-assert 15 + :size-assert #x94 + :flag-assert #xf00300094 + (:methods + (dumb-15 (_type_) none 14) + ) + ) + +;; definition for method 3 of type first-person-hud +(defmethod inspect first-person-hud ((obj first-person-hud)) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 obj) + ) + (format #t "~T~Tmax-nb-of-particles: ~D~%" (-> obj max-nb-of-particles)) + (format #t "~T~Tnb-of-particles: ~D~%" (-> obj nb-of-particles)) + (format #t "~T~Tparticles[3] @ #x~X~%" (-> obj particles)) + (format #t "~T~Tin-out-position: ~D~%" (-> obj in-out-position)) + (format #t "~T~Tsides-x-scale: ~f~%" (-> obj sides-x-scale)) + (format #t "~T~Tsides-y-scale: ~f~%" (-> obj sides-y-scale)) + (format #t "~T~Tx-offset: ~D~%" (-> obj x-offset)) + obj + ) + +;; definition for symbol *fp-hud-stack*, type pointer +(define *fp-hud-stack* (malloc 'global #x3800)) + +;; definition for method 10 of type first-person-hud +(defmethod deactivate first-person-hud ((obj first-person-hud)) + (dotimes (s5-0 (-> obj nb-of-particles)) + (kill-and-free-particles (-> obj particles s5-0 part)) + (set! (-> obj particles s5-0 part matrix) -1) + ) + (enable-hud) + (set! (-> *target* fp-hud) (the-as handle #f)) + ((the-as (function process none) (find-parent-method first-person-hud 10)) + obj + ) + (none) + ) + +;; definition for function first-person-hud-init-by-other +;; INFO: Return type mismatch object vs none. +(defbehavior first-person-hud-init-by-other first-person-hud () + (logclear! (-> self mask) (process-mask pause)) + (set! (-> self nb-of-particles) 0) + (set! (-> self max-nb-of-particles) 3) + (set! (-> self in-out-position) 4096) + (when (< (-> self nb-of-particles) (-> self max-nb-of-particles)) + (let ((gp-0 (-> self nb-of-particles))) + (set! (-> self particles gp-0) (new 'static 'hud-particle)) + (set! + (-> self particles gp-0 part) + (create-launch-control (-> *part-group-id-table* 611) self) + ) + (set! (-> self particles gp-0 init-pos x) -320.0) + (set! (-> self particles gp-0 init-pos y) 254.0) + (set! (-> self particles gp-0 init-pos z) 15.0) + (set! (-> self particles gp-0 part matrix) -1) + ) + (+! (-> self nb-of-particles) 1) + ) + (when (< (-> self nb-of-particles) (-> self max-nb-of-particles)) + (let ((gp-1 (-> self nb-of-particles))) + (set! (-> self particles gp-1) (new 'static 'hud-particle)) + (set! + (-> self particles gp-1 part) + (create-launch-control (-> *part-group-id-table* 612) self) + ) + (set! (-> self particles gp-1 init-pos x) -320.0) + (set! (-> self particles gp-1 init-pos y) 192.0) + (set! (-> self particles gp-1 init-pos z) 15.0) + (set! (-> self particles gp-1 part matrix) -1) + ) + (+! (-> self nb-of-particles) 1) + ) + (when (< (-> self nb-of-particles) (-> self max-nb-of-particles)) + (let ((gp-2 (-> self nb-of-particles))) + (set! (-> self particles gp-2) (new 'static 'hud-particle)) + (set! + (-> self particles gp-2 part) + (create-launch-control (-> *part-group-id-table* 613) self) + ) + (set! (-> self particles gp-2 init-pos x) 256.0) + (set! (-> self particles gp-2 init-pos y) 244.0) + (set! (-> self particles gp-2 init-pos z) 15.0) + (set! (-> self particles gp-2 part matrix) -1) + ) + (+! (-> self nb-of-particles) 1) + ) + (case (get-aspect-ratio) + (('aspect4x3) + (set! (-> self sides-x-scale) 3.5) + (set! (-> self sides-y-scale) 13.0) + (set! (-> self x-offset) 0) + 0 + ) + (('aspect16x9) + (set! (-> self sides-x-scale) 2.8) + (set! (-> self sides-y-scale) 9.75) + (set! (-> self x-offset) 12) + ) + ) + (set! (-> self event-hook) (-> hud-waiting event)) + (go hud-waiting) + (none) + ) + +;; definition for method 7 of type first-person-hud +;; INFO: Return type mismatch process vs first-person-hud. +(defmethod relocate first-person-hud ((obj first-person-hud) (arg0 int)) + (dotimes (v1-0 (-> obj nb-of-particles)) + (when (-> obj particles v1-0 part) + (if (nonzero? (-> obj particles v1-0 part)) + (&+! (-> obj particles v1-0 part) arg0) + ) + ) + ) + (the-as first-person-hud ((method-of-type process relocate) obj arg0)) + ) + +;; definition for method 14 of type first-person-hud +;; INFO: Return type mismatch int vs none. +(defmethod dumb-15 first-person-hud ((obj first-person-hud)) + (dotimes (s5-0 (-> obj nb-of-particles)) + (set! + (-> obj particles s5-0 pos x) + (+ -256.0 (-> obj particles s5-0 init-pos x)) + ) + (set! + (-> obj particles s5-0 pos y) + (* + 0.5 + (- + (* (-> obj particles s5-0 init-pos y) (-> *video-parms* relative-y-scale)) + (the float (-> *video-parms* screen-sy)) + ) + ) + ) + (set! (-> obj particles s5-0 pos z) (-> obj particles s5-0 init-pos z)) + (if (> (-> obj particles s5-0 part matrix) 0) + (set-vector! + (sprite-get-user-hvdf (-> obj particles s5-0 part matrix)) + (the float (+ (the int (-> obj particles s5-0 pos x)) 2048)) + (the float (+ (the int (-> obj particles s5-0 pos y)) 2048)) + (- (-> *math-camera* hvdf-off z) (* 1024.0 (-> obj particles s5-0 pos z))) + (-> *math-camera* hvdf-off w) + ) + ) + (spawn (-> obj particles s5-0 part) *null-vector*) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate hud-waiting (first-person-hud) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('go-away) + (go hud-going-out) + ) + ) + ) + :enter + (behavior () + (disable-hud (the-as int (-> *hud-parts* power))) + (none) + ) + :code + (behavior () + (while #t + (dotimes (gp-0 (-> self nb-of-particles)) + (if (= (-> self particles gp-0 part matrix) -1) + (set! (-> self particles gp-0 part matrix) (sprite-allocate-user-hvdf)) + ) + ) + (set-setting! + *setting-control* + self + 'common-page + 'set + (the-as float (-> (new 'static 'array int32 1 0) 0)) + 1 + ) + (suspend) + (go hud-coming-in) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate hud-coming-in (first-person-hud) + :event + (-> hud-waiting event) + :code + (behavior () + (while #t + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 0 + (the int (* 350.0 (-> *display* time-adjust-ratio))) + ) + ) + (if (zero? (-> self in-out-position)) + (go hud-normal) + ) + (suspend) + ) + (none) + ) + :post + (behavior () + (dumb-15 self) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate hud-normal (first-person-hud) + :event + (-> hud-waiting event) + :code + (behavior () + (while #t + (if + (or + (not *progress-process*) + (= (-> *progress-process* 0 next-state name) 'progress-going-out) + (= (-> *progress-process* 0 next-state name) 'progress-gone) + ) + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 0 + (the int (* 150.0 (-> *display* time-adjust-ratio))) + ) + ) + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 4096 + (the int (* 200.0 (-> *display* time-adjust-ratio))) + ) + ) + ) + (suspend) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate hud-going-out (first-person-hud) + :code + (behavior () + (while #t + (set! + (-> self in-out-position) + (seekl + (-> self in-out-position) + 4096 + (the int (* 350.0 (-> *display* time-adjust-ratio))) + ) + ) + (if (= (-> self in-out-position) 4096) + (deactivate self) + ) + (suspend) + ) + (none) + ) + :post + (behavior () + (dumb-15 self) + (none) + ) + ) + +;; definition for function part-first-person-hud-left-func +;; INFO: Return type mismatch int vs none. +(defun + part-first-person-hud-left-func + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (let ((s5-0 (handle->process (-> *target* fp-hud)))) + (when s5-0 + (let + ((f30-0 + (* + 0.00024414062 + (the float (-> (the-as first-person-hud s5-0) in-out-position)) + ) + ) + ) + (if (or (-> *setting-control* current movie) (movie?)) + (set! f30-0 1.0) + ) + (if (< 0.25 f30-0) + (set! f30-0 1.0) + (* 4.0 f30-0) + ) + (set! + (-> (the-as first-person-hud s5-0) particles 0 init-pos x) + (the float (- 59 (-> (the-as first-person-hud s5-0) x-offset))) + ) + (set! + (-> arg2 vector 0 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-x-scale) (* 10.0 f30-0)) + ) + ) + (set! + (-> arg2 vector 1 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-y-scale) (* 10.0 f30-0)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function part-first-person-hud-right-func +;; INFO: Return type mismatch int vs none. +(defun + part-first-person-hud-right-func + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (let ((s5-0 (handle->process (-> *target* fp-hud)))) + (when s5-0 + (let + ((f30-0 + (* + 0.00024414062 + (the float (-> (the-as first-person-hud s5-0) in-out-position)) + ) + ) + ) + (if (or (-> *setting-control* current movie) (movie?)) + (set! f30-0 1.0) + ) + (if (< 0.25 f30-0) + (set! f30-0 1.0) + (* 4.0 f30-0) + ) + (set! + (-> (the-as first-person-hud s5-0) particles 1 init-pos x) + (the float (+ (-> (the-as first-person-hud s5-0) x-offset) 452)) + ) + (set! + (-> arg2 vector 0 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-x-scale) (* 10.0 f30-0)) + ) + ) + (set! + (-> arg2 vector 1 w) + (* + 4096.0 + (+ (-> (the-as first-person-hud s5-0) sides-y-scale) (* 10.0 f30-0)) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function part-first-person-hud-selector-func +;; INFO: Return type mismatch int vs none. +(defun + part-first-person-hud-selector-func + ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 matrix)) + (let ((v1-2 (handle->process (-> *target* fp-hud)))) + (when v1-2 + (let + ((f30-0 + (* + 0.00024414062 + (the float (-> (the-as first-person-hud v1-2) in-out-position)) + ) + ) + ) + (if (or (-> *setting-control* current movie) (movie?)) + (set! f30-0 1.0) + ) + (if (< 0.5 f30-0) + (set! f30-0 1.0) + (* 2.0 f30-0) + ) + (set! (-> arg2 vector 2 w) (- 64.0 (* 64.0 f30-0))) + ) + ) + ) + 0 + (none) + ) + +;; definition for function look-for-points-of-interest +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; failed to figure out what this is: +(defstate target-stance-look-around (target) + :event + target-standard-event-handler + :enter + (-> target-stance enter) + :exit + (-> target-stance exit) + :trans + (-> target-stance trans) + :code + (behavior () + (while (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'dist-from-interp-src) + (and + (< (send-event-function *camera* a1-0) 4915.2) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 21) + (zero? (ja-group-size)) + ) + ) + (suspend) + ) + (let ((v1-8 target-stance)) + (set! (-> self next-state) v1-8) + (set! (-> self state) v1-8) + ) + ((the-as (function none :behavior target) (-> target-stance code))) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-look-around (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + ((let ((v1-4 arg2)) + (= v1-4 'end-mode) + ) + (go target-stance-look-around) + ) + ((-> self control unknown-symbol30) + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self cam-user-mode) 'look-around) + (set! (-> self control unknown-surface00) *duck-mods*) + (logior! (-> self state-flags) 512) + (send-event *camera* 'blend-from-as-fixed) + (send-event *camera* 'no-intro) + (camera-change-to (the-as string 'cam-eye) 60 #f) + (let ((a0-5 (handle->process (-> self fp-hud)))) + (if a0-5 + (deactivate a0-5) + ) + ) + (let ((gp-0 (get-process *default-dead-pool* first-person-hud #x4000))) + (set! (-> self fp-hud) (ppointer->handle (when gp-0 + (let + ((t9-5 + (method-of-type + first-person-hud + activate + ) + ) + ) + (t9-5 + (the-as first-person-hud gp-0) + *dproc* + 'first-person-hud + (&+ *fp-hud-stack* #x3800) + ) + ) + (run-now-in-process + gp-0 + first-person-hud-init-by-other + ) + (-> gp-0 ppointer) + ) + ) + ) + ) + (none) + ) + :exit + (behavior () + (let ((a0-1 (handle->process (-> self fp-hud)))) + (if a0-1 + (send-event a0-1 'go-away) + ) + ) + (set! (-> self cam-user-mode) 'normal) + (target-exit) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query-state) + (set! (-> a1-2 param 0) (the-as uint cam-eye)) + (when (send-event-function *camera* a1-2) + (send-event *camera* 'no-intro) + (send-event *camera* 'force-blend 60) + (send-event *camera* 'clear-entity) + (camera-change-to (the-as string 'base) 60 #f) + ) + ) + (none) + ) + :trans + (behavior () + (local-vars (sv-48 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons r2 circle square) + ) + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) + 150 + ) + (not *pause-lock*) + ) + (let + ((gp-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + (the-as float (-> *TARGET-bank* yellow-projectile-speed)) + ) + ) + (s5-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + 8192.0 + ) + ) + ) + (vector+float*! + s5-1 + s5-1 + (-> *math-camera* inv-camera-rot vector 1) + (the-as float -2048.0) + ) + (let ((s4-0 (get-process *default-dead-pool* projectile-yellow #x4000))) + (when s4-0 + (let ((t9-2 (method-of-type projectile-yellow activate))) + (t9-2 + (the-as projectile-yellow s4-0) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (let ((s3-0 run-function-in-process) + (s2-0 s4-0) + (s1-0 projectile-init-by-other) + (s0-0 (-> self entity)) + ) + (set! sv-48 s5-1) + (let ((v0-3 (camera-pos))) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> v0-3 quad)) + ) + (.lvf vf5 (&-> s5-1 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-48 quad) vf6) + (let + ((t1-0 + (if + (>= + (-> self fact-info-target eco-level) + (-> *FACT-bank* eco-level-max) + ) + 56 + 40 + ) + ) + (t2-0 #f) + ) + ((the-as + (function object object object object object object object none) + s3-0 + ) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + t1-0 + t2-0 + ) + ) + ) + (-> s4-0 ppointer) + ) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + ) + (when + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons triangle) + ) + (logclear! + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons triangle) + ) + (logclear! + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons triangle) + ) + (set! (-> self cam-user-mode) 'normal) + ) + (none) + ) + ) + :code + (behavior () + (while (let ((f30-0 8192.0) + (a1-0 (new 'stack-no-clear 'event-message-block)) + ) + (set! (-> a1-0 from) self) + (set! (-> a1-0 num-params) 0) + (set! (-> a1-0 message) 'dist-from-interp-dest) + (< f30-0 (send-event-function *camera* a1-0)) + ) + (if (!= (-> self cam-user-mode) 'look-around) + (go target-stance) + ) + (suspend) + ) + (ja-channel-set! 0) + (set! (-> self control transv quad) (the-as uint128 0)) + (while #t + (if (!= (-> self cam-user-mode) 'look-around) + (go target-stance-look-around) + ) + (suspend) + ) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-billy-game (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + ((let ((v1-4 arg2)) + (= v1-4 'end-mode) + ) + (go target-stance) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *duck-mods*) + (logior! (-> self state-flags) 512) + (send-event *camera* 'blend-from-as-fixed) + (send-event *camera* 'clear-entity) + (send-event *camera* 'no-intro) + (camera-change-to (the-as string 'cam-billy) 0 #f) + (let ((a0-6 (handle->process (-> self fp-hud)))) + (if a0-6 + (deactivate a0-6) + ) + ) + (let ((gp-0 (get-process *default-dead-pool* first-person-hud #x4000))) + (set! (-> self fp-hud) (ppointer->handle (when gp-0 + (let + ((t9-6 + (method-of-type + first-person-hud + activate + ) + ) + ) + (t9-6 + (the-as first-person-hud gp-0) + *dproc* + 'first-person-hud + (&+ *fp-hud-stack* #x3800) + ) + ) + (run-now-in-process + gp-0 + first-person-hud-init-by-other + ) + (-> gp-0 ppointer) + ) + ) + ) + ) + (none) + ) + :exit + (behavior () + (let ((a0-1 (handle->process (-> self fp-hud)))) + (if a0-1 + (send-event a0-1 'go-away) + ) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query-state) + (set! (-> a1-2 param 0) (the-as uint cam-billy)) + (when (send-event-function *camera* a1-2) + (send-event *camera* 'no-intro) + (send-event *camera* 'force-blend 0) + (camera-change-to (the-as string 'base) 0 #f) + ) + ) + (target-exit) + (none) + ) + :trans + (behavior () + (local-vars (sv-48 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons r2 circle square) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) + 135 + ) + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (not *pause-lock*) + ) + (let + ((gp-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + (the-as float (-> *TARGET-bank* yellow-projectile-speed)) + ) + ) + (s5-1 + (vector-float*! + (new-stack-vector0) + (-> *math-camera* inv-camera-rot vector 2) + 8192.0 + ) + ) + ) + (vector+float*! + s5-1 + s5-1 + (-> *math-camera* inv-camera-rot vector 1) + (the-as float -2048.0) + ) + (let ((s4-0 (get-process *default-dead-pool* projectile-yellow #x4000))) + (when s4-0 + (let ((t9-2 (method-of-type projectile-yellow activate))) + (t9-2 + (the-as projectile-yellow s4-0) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (let ((s3-0 run-function-in-process) + (s2-0 s4-0) + (s1-0 projectile-init-by-other) + (s0-0 (-> self entity)) + ) + (set! sv-48 s5-1) + (let ((v0-4 (camera-pos))) + (.mov.vf vf6 vf0 :mask #b1000) + (.lvf vf4 (&-> v0-4 quad)) + ) + (.lvf vf5 (&-> s5-1 quad)) + (.add.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> sv-48 quad) vf6) + (let + ((t1-0 + (if + (>= + (-> self fact-info-target eco-level) + (-> *FACT-bank* eco-level-max) + ) + 120 + 104 + ) + ) + (t2-0 #f) + ) + ((the-as + (function object object object object object object object none) + s3-0 + ) + s2-0 + s1-0 + s0-0 + sv-48 + gp-1 + t1-0 + t2-0 + ) + ) + ) + (-> s4-0 ppointer) + ) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + ) + (none) + ) + ) + :code + (behavior () + (ja-channel-set! 0) + (set! (-> self control transv quad) (the-as uint128 0)) + (anim-loop) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-grab (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (cond + ((and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + ) + (else + (case arg2 + (('end-mode) + (go target-stance) + ) + (('play-anim) + (let ((v0-0 (the-as object (-> arg3 param 0)))) + (set! (-> self control unknown-uint20) (the-as uint v0-0)) + v0-0 + ) + ) + (('clone-anim) + (go + target-clone-anim + (process->handle (the-as process (-> arg3 param 0))) + ) + ) + (('change-mode) + (case (-> arg3 param 0) + (('final-door) + (go + target-final-door + (the-as basic (process->handle (the-as process (-> arg3 param 1)))) + (process->handle (the-as process (-> arg3 param 2))) + ) + ) + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + ) + :enter + (behavior () + (set! (-> self control unknown-surface00) *grab-mods*) + (set! (-> self neck flex-blend) 0.0) + (logior! (-> self state-flags) 272) + (set! (-> self control unknown-uint20) (the-as uint 'stance)) + (none) + ) + :exit + (behavior () + (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (target-exit) + (none) + ) + :code + (behavior () + (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) + (let ((gp-0 0)) + (while (zero? (logand (-> self control status) 1)) + (target-falling-anim-trans) + (+! + gp-0 + (- + (-> *display* base-frame-counter) + (-> *display* old-base-frame-counter) + ) + ) + (suspend) + ) + (if (or (> gp-0 0) (let ((v1-11 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-11 (-> self draw art-group data 34)) + (= v1-11 (-> self draw art-group data 38)) + (= v1-11 (-> self draw art-group data 42)) + (= v1-11 (-> self draw art-group data 43)) + (= v1-11 (-> self draw art-group data 41)) + ) + ) + ) + (target-hit-ground-anim #f) + ) + ) + (-> self control unknown-spoolanim00) + (while #t + (let ((gp-1 (-> self control unknown-spoolanim00))) + (case gp-1 + (('stance) + (cond + ((or (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (< 0.5 (-> self skel root-channel 6 frame-interp)) + ) + (let ((v1-32 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-32 (-> self draw art-group data 28)) + (= v1-32 (-> self draw art-group data 29)) + (= v1-32 (-> self draw art-group data 54)) + (= v1-32 (-> self draw art-group data 55)) + ) + ) + ) + (ja-channel-push! 1 45) + (let ((a0-39 (-> self skel root-channel 0))) + (set! + (-> a0-39 frame-group) + (the-as art-joint-anim (-> self draw art-group data 4)) + ) + (set! + (-> a0-39 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 4)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-39 param 1) 1.0) + (set! (-> a0-39 frame-num) 0.0) + (joint-control-channel-group! + a0-39 + (the-as art-joint-anim (-> self draw art-group data 4)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-40 (-> self skel root-channel 0))) + (set! + (-> a0-40 param 0) + (the float (+ (-> a0-40 frame-group data 0 length) -1)) + ) + (set! (-> a0-40 param 1) 1.0) + (joint-control-channel-group-eval! + a0-40 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-42 (-> self skel root-channel 0))) + (set! + (-> a0-42 frame-group) + (the-as art-joint-anim (-> self draw art-group data 3)) + ) + (set! + (-> a0-42 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 3)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-42 param 1) 1.0) + (set! (-> a0-42 frame-num) 0.0) + (joint-control-channel-group! + a0-42 + (the-as art-joint-anim (-> self draw art-group data 3)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-43 (-> self skel root-channel 0))) + (set! + (-> a0-43 param 0) + (the float (+ (-> a0-43 frame-group data 0 length) -1)) + ) + (set! (-> a0-43 param 1) 1.0) + (joint-control-channel-group-eval! + a0-43 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (ja-channel-push! 1 45) + ) + ((let ((v1-87 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (and + (or + (= v1-87 (-> self draw art-group data 39)) + (= v1-87 (-> self draw art-group data 35)) + ) + (not (ja-max? 0)) + ) + ) + (let ((a0-54 (-> self skel root-channel 0))) + (set! + (-> a0-54 param 0) + (the float (+ (-> a0-54 frame-group data 0 length) -1)) + ) + (set! (-> a0-54 param 1) 1.0) + (joint-control-channel-group! + a0-54 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (ja-channel-push! 1 22) + ) + ((not (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 5) + ) + (= (ja-group-size) 1) + ) + ) + (ja-channel-push! 1 22) + ) + ) + (while #t + (let ((a0-63 (-> self skel root-channel 0))) + (set! + (-> a0-63 frame-group) + (the-as art-joint-anim (-> self draw art-group data 5)) + ) + (set! + (-> a0-63 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 5)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-63 param 1) 1.0) + (set! (-> a0-63 frame-num) 0.0) + (joint-control-channel-group! + a0-63 + (the-as art-joint-anim (-> self draw art-group data 5)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + (let ((a0-64 (-> self skel root-channel 0))) + (set! + (-> a0-64 param 0) + (the float (+ (-> a0-64 frame-group data 0 length) -1)) + ) + (set! (-> a0-64 param 1) 1.0) + (joint-control-channel-group-eval! + a0-64 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (('shock-in) + (ja-channel-push! 1 60) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 88)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 18.0) 0)) + (set! (-> s5-0 param 1) 1.0) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 88)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 18.0) 0)) + (set! (-> s5-1 param 1) 1.0) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (while #t + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + ) + ) + (('shock-out) + (if (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 88) + ) + ) + (ja-channel-push! 1 60) + ) + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 88)) + ) + (set! + (-> s5-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 88)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s5-2 param 1) 1.0) + (set! (-> s5-2 frame-num) (ja-aframe (the-as float 18.0) 0)) + (joint-control-channel-group! + s5-2 + (the-as art-joint-anim (-> self draw art-group data 88)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (!= gp-1 (-> self control unknown-spoolanim00)) + (goto cfg-94) + ) + (suspend) + (let ((a0-82 (-> self skel root-channel 0))) + (set! + (-> a0-82 param 0) + (the float (+ (-> a0-82 frame-group data 0 length) -1)) + ) + (set! (-> a0-82 param 1) 1.0) + (joint-control-channel-group-eval! + a0-82 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint 'stance)) + ) + ) + ) + (label cfg-94) + ) + (none) + ) + :post + (behavior () + (if (logtest? (-> self control status) 1) + (set! (-> self control transv quad) (the-as uint128 0)) + ) + (target-no-stick-post) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate target-pole-cycle (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + (-> self state name) + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + :enter + (behavior ((arg0 handle)) + (set! (-> self control unknown-handle10) arg0) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *pole-mods*) + (logior! (-> self control root-prim prim-core action) 256) + (target-collide-set! + 'pole + (the-as float (-> (new 'static 'array int32 1 0) 0)) + ) + (set! (-> self control unknown-vector102 quad) (-> self control transv quad)) + (set! (-> self control transv quad) (the-as uint128 0)) + (send-event *camera* 'ease-in) + (set! (-> self control unknown-int21) (the-as int #f)) + (none) + ) + :exit + (behavior () + (target-collide-set! + 'normal + (the-as float (-> (new 'static 'array int32 1 0) 0)) + ) + (set! + (-> self control root-prim prim-core action) + (logand -257 (-> self control root-prim prim-core action)) + ) + (set! (-> self control unknown-handle10) (the-as handle #f)) + (none) + ) + :trans + (behavior () + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self state-flags) 2048)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (cond + ((< 44.0 (ja-aframe-num 0)) + (set-forward-vel (the-as float -49152.0)) + (let ((gp-0 (new-stack-vector0))) + (let + ((f0-2 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f0-2) + ) + ) + (let* ((f0-3 (vector-length gp-0)) + (f1-1 f0-3) + (f2-0 -81920.0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-0 gp-0 (/ f0-3 f1-1)) + ) + ) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (go target-falling 'target-pole-cycle) + ) + ((>= (ja-aframe-num 0) 14.0) + (remove-exit) + (go + target-pole-flip-up + 28672.0 + 28672.0 + (* 1024.0 (- 26.0 (ja-aframe-num 0))) + ) + ) + (else + (remove-exit) + (go + target-pole-flip-forward + (the-as float 14336.0) + (the-as float 14336.0) + (the-as float 57344.0) + ) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 handle)) + (target-compute-pole) + (set! + (-> self control unknown-uint20) + (the-as + uint + (vector-dot + (-> self control unknown-vector100) + (vector-normalize! (-> self control unknown-vector102) (the-as float 1.0)) + ) + ) + ) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 83) + ) + (while (not (-> self control unknown-int21)) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) 1.0) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 num-func) num-func-identity) + (set! (-> gp-1 frame-num) (ja-aframe (the-as float 37.0) 0)) + ) + ) + (else + (while (not (-> self control unknown-int21)) + (suspend) + ) + (suspend) + (ja-channel-push! 1 45) + ) + ) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 80)) + ) + (set! + (-> a0-9 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 80)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-9 param 1) 1.0) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 80)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! + (-> a0-10 param 0) + (the float (+ (-> a0-10 frame-group data 0 length) -1)) + ) + (set! (-> a0-10 param 1) 1.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (while #t + (set! + (-> self anim-seed) + (the-as uint (if (rand-vu-percent? (the-as float 0.1)) + 0 + 1 + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 frame-group) + (the-as art-joint-anim (-> self draw art-group data 80)) + ) + (set! + (-> a0-13 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 80)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-13 param 1) 1.0) + (set! (-> a0-13 frame-num) 0.0) + (joint-control-channel-group! + a0-13 + (the-as art-joint-anim (-> self draw art-group data 80)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-14 (-> self skel root-channel 0))) + (set! + (-> a0-14 param 0) + (the float (+ (-> a0-14 frame-group data 0 length) -1)) + ) + (set! (-> a0-14 param 1) 1.0) + (joint-control-channel-group-eval! + a0-14 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-pole-flip-up (target) + :event + target-standard-event-handler + :exit + (-> target-pole-cycle exit) + :code + (behavior ((arg0 object) (arg1 object) (arg2 float)) + (let ((s3-0 (-> self skel root-channel 0))) + (set! + (-> s3-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 81)) + ) + (set! + (-> s3-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 81)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s3-0 param 1) 1.0) + (set! + (-> s3-0 frame-num) + (ja-aframe (+ 1.0 (fmin 17.0 (ja-aframe-num 0))) 0) + ) + (joint-control-channel-group! + s3-0 + (the-as art-joint-anim (-> self draw art-group data 81)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 1.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set-forward-vel arg2) + (go target-pole-flip-up-jump (the-as float arg0) (the-as float arg1)) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-pole-flip-up-jump (target) + :event + target-standard-event-handler + :enter + (-> target-jump-forward enter) + :exit + target-exit + :trans + (behavior () + ((-> target-jump-forward trans)) + (vector-flatten! + (-> self control transv) + (-> self control transv) + (-> self control unknown-vector100) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 0 0 1 #t) + (send-event *camera* 'damp-up) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 83)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (let ((f0-1 (target-height-above-ground)) + (f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (while + (not + (and + (< (fabs (/ f0-1 (* 0.0033333334 f1-1))) 40.0) + (and (< f1-1 0.0) (ja-min? 0)) + ) + ) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! (-> a0-5 param 0) 1.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (set! f0-1 (target-height-above-ground)) + (set! + f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + ) + (ja-channel-push! 1 75) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-9 param 0) 1.0) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! + (-> a0-10 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-10 param 0) 1.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-pole-flip-forward (target) + :event + target-standard-event-handler + :exit + (-> target-pole-cycle exit) + :code + (behavior ((arg0 float) (arg1 float) (arg2 float)) + (let ((s3-0 (-> self skel root-channel 0))) + (set! + (-> s3-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 82)) + ) + (set! (-> s3-0 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-0 param 1) 1.0) + (set! (-> s3-0 frame-num) (ja-aframe (+ 1.0 (ja-aframe-num 0)) 0)) + (joint-control-channel-group! + s3-0 + (the-as art-joint-anim (-> self draw art-group data 82)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s3-1 (-> self skel root-channel 0))) + (set! (-> s3-1 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-1 param 1) 1.0) + (joint-control-channel-group-eval! + s3-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set-forward-vel arg2) + (go target-pole-flip-forward-jump arg0 arg1) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-pole-flip-forward-jump (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + ((-> target-jump enter) arg0 arg1 (the-as surface #f)) + (set! (-> self control unknown-surface00) *forward-pole-jump-mods*) + (none) + ) + :exit + target-exit + :trans + (behavior () + ((-> target-jump-forward trans)) + (vector-flatten! + (-> self control transv) + (-> self control transv) + (-> self control unknown-vector100) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (sound-play-by-name (static-sound-name "jump") (new-sound-id) 1024 0 0 1 #t) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 param 0) + (the float (+ (-> a0-2 frame-group data 0 length) -1)) + ) + (set! (-> a0-2 param 1) 1.0) + (joint-control-channel-group-eval! + a0-2 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ((the-as (function none :behavior target) (-> target-pole-flip-up-jump code)) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-edge-grab (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('end-mode) + (go target-falling 'target-edge-grab) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *edge-grab-mods*) + (set! (-> self control unknown-dword41) (-> *display* base-frame-counter)) + (logior! (-> self control root-prim prim-core action) 136) + (set! (-> self control unknown-vector102 quad) (-> self control transv quad)) + (set! (-> self control transv quad) (the-as uint128 0)) + (send-event *camera* 'ease-in) + (none) + ) + :exit + (behavior () + (when (logtest? (-> self control root-prim prim-core action) 128) + (set! + (-> self control root-prim prim-core action) + (logand -137 (-> self control root-prim prim-core action)) + ) + (send-event *camera* 'damp-up) + ) + (none) + ) + :trans + (behavior () + (when + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 60) + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self state-flags) 2048)) + ) + (cond + ((or + (< -0.2 (local-pad-angle)) + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + ) + (let ((a1-2 (new 'stack-no-clear 'collide-using-spheres-params))) + (set! + (-> a1-2 spheres) + (the-as + (pointer sphere) + (-> *collide-edge-work* world-player-leap-up-spheres) + ) + ) + (set! (-> a1-2 num-spheres) (the-as uint 6)) + (set! (-> a1-2 collide-with) (-> self control root-prim collide-with)) + (set! (-> a1-2 proc) #f) + (set! (-> a1-2 ignore-pat) (the-as uint 1)) + (set! (-> a1-2 solid-only) #t) + (when (not (dummy-11 *collide-cache* a1-2)) + (remove-exit) + (go + target-edge-grab-jump + (-> *TARGET-bank* edge-grab-jump-height-min) + (-> *TARGET-bank* edge-grab-jump-height-max) + ) + ) + ) + ) + (else + (remove-exit) + (go target-edge-grab-off) + ) + ) + ) + (none) + ) + :code + (behavior () + (target-compute-edge) + (set! + (-> self control unknown-uint20) + (the-as + uint + (vector-dot + (-> self control unknown-vector100) + (vector-normalize! (-> self control unknown-vector102) (the-as float 1.0)) + ) + ) + ) + (while (< 0.0 (-> self control unknown-float110)) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + ) + (ja-channel-push! 1 45) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + ) + (suspend) + ) + (ja-channel-push! 1 45) + (cond + ((< (the-as float (-> self control unknown-uint20)) -0.3) + (let ((gp-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 48)) + num-func-identity + ) + (set! (-> gp-2 frame-num) 0.0) + ) + ) + ((< 0.3 (the-as float (-> self control unknown-uint20))) + (let ((gp-3 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 47)) + num-func-identity + ) + (set! (-> gp-3 frame-num) 0.0) + ) + ) + (else + (let ((gp-4 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 46)) + num-func-identity + ) + (set! (-> gp-4 frame-num) 0.0) + ) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! + (-> a0-11 param 0) + (the float (+ (-> a0-11 frame-group data 0 length) -1)) + ) + (set! (-> a0-11 param 1) 1.0) + (joint-control-channel-group-eval! + a0-11 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (ja-channel-set! 1) + (while #t + (let ((a0-14 (-> self skel root-channel 0))) + (set! + (-> a0-14 frame-group) + (the-as art-joint-anim (-> self draw art-group data 44)) + ) + (set! + (-> a0-14 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 44)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-14 param 1) 1.0) + (set! (-> a0-14 frame-num) 0.0) + (joint-control-channel-group! + a0-14 + (the-as art-joint-anim (-> self draw art-group data 44)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-15 (-> self skel root-channel 0))) + (set! + (-> a0-15 param 0) + (the float (+ (-> a0-15 frame-group data 0 length) -1)) + ) + (set! (-> a0-15 param 1) 1.0) + (joint-control-channel-group-eval! + a0-15 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (+! (-> self anim-seed) 1) + (let ((a0-17 (-> self skel root-channel 0))) + (set! + (-> a0-17 frame-group) + (the-as art-joint-anim (-> self draw art-group data 45)) + ) + (set! + (-> a0-17 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 45)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-17 param 1) 1.0) + (set! (-> a0-17 frame-num) 0.0) + (joint-control-channel-group! + a0-17 + (the-as art-joint-anim (-> self draw art-group data 45)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-18 (-> self skel root-channel 0))) + (set! + (-> a0-18 param 0) + (the float (+ (-> a0-18 frame-group data 0 length) -1)) + ) + (set! (-> a0-18 param 1) 1.0) + (joint-control-channel-group-eval! + a0-18 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-edge-grab-jump (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('end-mode) + (go target-falling 'target-edge-grab) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :exit + (-> target-edge-grab exit) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-set! 1) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (set! + (-> self control root-prim prim-core action) + (logand -137 (-> self control root-prim prim-core action)) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 49)) + ) + (set! + (-> a0-8 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 49)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-8 param 1) 1.0) + (set! (-> a0-8 frame-num) 0.0) + (joint-control-channel-group! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 49)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (target-compute-edge-rider) + (TODO-RENAME-9 (-> self align)) + (when (zero? (logand (-> self align flags) 1)) + (vector-matrix*! + s4-0 + (the-as vector (-> self align delta)) + (-> self control unknown-matrix01) + ) + (TODO-RENAME-28 (-> self control) s4-0) + ) + (suspend) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 param 0) + (the float (+ (-> a0-12 frame-group data 0 length) -1)) + ) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! + a0-12 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control unknown-dword70) 0) + (set-forward-vel (the-as float 16384.0)) + (send-event *camera* 'damp-up) + (go target-jump-forward arg0 arg1) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-edge-grab-off (target) + :event + target-standard-event-handler + :exit + (-> target-edge-grab exit) + :code + (behavior () + (ja-channel-set! 1) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (send-event *camera* 'damp-up) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 50)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 191.0) 0)) + (set! (-> s5-0 param 1) 1.0) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 50)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (when (zero? (logand (-> self align flags) 1)) + (vector-matrix*! + gp-0 + (the-as vector (-> self align delta)) + (-> self control unknown-matrix01) + ) + (TODO-RENAME-28 (-> self control) gp-0) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 191.0) 0)) + (set! (-> s5-1 param 1) 1.0) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! + (-> self control root-prim prim-core action) + (logand -137 (-> self control root-prim prim-core action)) + ) + (vector-float*! + (-> self control transv) + (-> self control unknown-vector101) + -40960.0 + ) + (when + (and + (< + (- + (-> *display* base-frame-counter) + (the-as int (-> self control rider-time)) + ) + 60 + ) + (or + (logtest? (-> self control unknown-surface01 flags) #x4000) + (= (-> self control poly-pat material) (pat-material rotate)) + ) + ) + (+! (-> self control transv x) (-> self control rider-last-move x)) + (+! (-> self control transv z) (-> self control rider-last-move z)) + ) + (go target-falling 'target-edge-grab) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-yellow-blast (target) + :event + (-> target-running-attack event) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *run-attack-mods*) + (set! (-> *run-attack-mods* turnv) 655360.0) + (set! (-> *run-attack-mods* turnvv) 655360.0) + (target-start-attack) + (target-danger-set! 'spin #f) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control unknown-int21) 0) + (set! (-> self control unknown-uint31) (the-as uint 0)) + (let ((gp-0 (new-stack-vector0)) + (f30-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f30-0) + ) + (let* ((f0-5 (vector-length gp-0)) + (f1-0 f0-5) + ) + (if (< 0.0 f30-0) + (set! f30-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f30-0 + ) + (vector-float*! gp-0 gp-0 (/ f0-5 f1-0)) + ) + ) + ) + (none) + ) + :exit + (behavior () + (set! (-> *run-attack-mods* turnv) 0.0) + (set! (-> *run-attack-mods* turnvv) 0.0) + (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :code + (behavior () + (let ((gp-0 (the-as handle #f))) + (ja-channel-push! 1 22) + (level-hint-spawn + (game-text-id daxter-you-can-shoot-with-yellow-eco) + "sksp0145" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (case (-> (level-get-target-inside *level*) name) + (('maincave) + (level-hint-spawn + (game-text-id daxter-maybe-you-can-shoot-better-goggles) + "sksp0328" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 84)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 9.0) 0)) + (set! (-> s5-0 param 1) 1.0) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 84)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 9.0) 0)) + (set! (-> s5-1 param 1) 1.0) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let + ((s5-2 + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control quat) + ) + ) + ) + (set! (-> s5-2 y) 0.0) + (vector-normalize! s5-2 (-> *TARGET-bank* yellow-projectile-speed)) + (when + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (let ((gp-1 (get-process *default-dead-pool* projectile-yellow #x4000))) + (set! gp-0 (ppointer->handle (when gp-1 + (let + ((t9-12 + (method-of-type + projectile-yellow + activate + ) + ) + ) + (t9-12 + (the-as projectile-yellow gp-1) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-1 + projectile-init-by-other + (-> self entity) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 23) + ) + s5-2 + (if + (>= + (-> self fact-info-target eco-level) + (-> *FACT-bank* eco-level-max) + ) + 25 + 9 + ) + #f + ) + (-> gp-1 ppointer) + ) + ) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + ) + ) + (let ((s5-3 (-> self skel root-channel 0))) + (set! + (-> s5-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 84)) + ) + (set! + (-> s5-3 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 84)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s5-3 param 1) 1.0) + (set! (-> s5-3 frame-num) (ja-aframe (the-as float 9.0) 0)) + (joint-control-channel-group! + s5-3 + (the-as art-joint-anim (-> self draw art-group data 84)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if + (or + (< + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint30)) + ) + ) + (the-as uint 30) + ) + (= (-> self control unknown-uint31) 1) + ) + (send-event (handle->process gp-0) 'die) + ) + (suspend) + (let ((a0-32 (-> self skel root-channel 0))) + (set! + (-> a0-32 param 0) + (the float (+ (-> a0-32 frame-group data 0 length) -1)) + ) + (set! (-> a0-32 param 1) 1.0) + (joint-control-channel-group-eval! + a0-32 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (if (logtest? (-> self control status) 1) + (go target-stance) + (go target-falling #f) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; definition for symbol *yellow-jump-mods*, type surface +(define + *yellow-jump-mods* + (new 'static 'surface + :name 'run + :tiltv 65536.0 + :tiltvv 131072.0 + :transv-max 40960.0 + :target-speed 40960.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 + :mode 'air + :flags #x800 + ) + ) + +;; failed to figure out what this is: +(defstate target-yellow-jump-blast (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self control unknown-surface00) *yellow-jump-mods*) + (let ((gp-0 (new-stack-vector0))) + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f0-1) + ) + ) + (let* ((f0-2 (vector-length gp-0)) + (f1-1 f0-2) + (f2-0 46917.434) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-0 gp-0 (/ f0-2 f1-1)) + ) + ) + ) + (none) + ) + :exit + (behavior () + (rot->dir-targ! (-> self control)) + (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 22) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 86)) + ) + (set! (-> gp-0 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> gp-0 param 1) 1.0) + (set! (-> gp-0 frame-num) 0.0) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 86)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> gp-1 param 1) 1.0) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (suspend) + (let ((gp-2 (new-stack-vector0))) + (let + ((f0-6 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-2 + (-> self control transv) + (vector-float*! gp-2 (-> self control dynam gravity-normal) f0-6) + ) + ) + (let* ((f0-7 (vector-length gp-2)) + (f1-1 f0-7) + (f2-0 46917.434) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-2 gp-2 (/ f0-7 f1-1)) + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 param 0) + (the float (+ (-> a0-13 frame-group data 0 length) -1)) + ) + (set! (-> a0-13 param 1) 1.0) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((gp-3 (get-process *default-dead-pool* projectile-yellow #x4000))) + (when gp-3 + (let ((t9-9 (method-of-type projectile-yellow activate))) + (t9-9 + (the-as projectile-yellow gp-3) + self + 'projectile-yellow + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + gp-3 + projectile-init-by-other + (-> self entity) + (-> self control unknown-vector90) + (vector-float*! + (new 'stack-no-clear 'vector) + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control quat) + ) + (the-as float (-> *TARGET-bank* yellow-projectile-speed)) + ) + (if + (>= (-> self fact-info-target eco-level) (-> *FACT-bank* eco-level-max)) + 16 + 0 + ) + #f + ) + (-> gp-3 ppointer) + ) + ) + (set! (-> self control unknown-dword82) (-> *display* base-frame-counter)) + (let ((gp-4 (-> *display* base-frame-counter))) + (until (>= (- (-> *display* base-frame-counter) gp-4) 30) + (suspend) + ) + ) + (let ((gp-5 (-> self skel root-channel 0))) + (set! + (-> gp-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 86)) + ) + (set! + (-> gp-5 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 86)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-5 param 1) 1.0) + (set! (-> gp-5 frame-num) (ja-frame-num 0)) + (joint-control-channel-group! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 86)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 param 0) + (the float (+ (-> a0-22 frame-group data 0 length) -1)) + ) + (set! (-> a0-22 param 1) 1.0) + (joint-control-channel-group-eval! + a0-22 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (if (logtest? (-> self control status) 1) + (go target-stance) + (go target-falling #f) + ) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-eco-powerup (target) + :event + target-standard-event-handler + :exit + target-exit + :trans + (behavior () + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 object) (arg1 float)) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (if (= arg1 (-> *FACT-bank* eco-full-inc)) + (set! (-> self control unknown-surface00) *double-jump-mods*) + (set! (-> self control unknown-surface00) *walk-mods*) + ) + (ja-channel-push! 1 15) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 87)) + ) + (set! + (-> s5-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 87)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! + (-> s5-0 param 1) + (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + 2.0 + 3.0 + ) + ) + ) + (set! + (-> s5-0 frame-num) + (ja-aframe (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + (-> (new 'static 'array int32 1 0) 0) + 6.0 + ) + ) + 0 + ) + ) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 87)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self state-flags) 2048)) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack-air #f) + ) + (when (can-hands? #f) + (if + (and + (= (-> self fact-info-target eco-type) 1) + (>= (-> self fact-info-target eco-level) 1.0) + ) + (go target-yellow-jump-blast) + (go target-running-attack) + ) + ) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 2 + (the-as float 1.0) + (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + 2.0 + 1.0 + ) + ) + (the-as float 1.0) + ) + (suspend) + (let ((a0-30 (-> self skel root-channel 0))) + (set! + (-> a0-30 param 0) + (the float (+ (-> a0-30 frame-group data 0 length) -1)) + ) + (set! + (-> a0-30 param 1) + (the-as float (if (= arg1 (-> *FACT-bank* eco-full-inc)) + 2.0 + 3.0 + ) + ) + ) + (joint-control-channel-group-eval! + a0-30 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-falling 'target-eco-powerup) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-wade-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *wade-mods*) + (set-zero! (-> self water bob)) + (none) + ) + :exit + (behavior () + (target-state-hook-exit) + (target-exit) + (let ((v1-1 (-> self skel effect))) + (set! (-> v1-1 channel-offset) 0) + ) + 0 + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (when + (and + (zero? (logand (-> self water flags) 1024)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water wade-time)) + ) + 15 + ) + ) + (if (logtest? (-> self water flags) 2048) + (go target-swim-stance) + (go target-stance) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (go target-duck-stance) + ) + (if + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go target-wade-walk) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (sound-play-by-name + (static-sound-name "swim-stroke") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (dummy-13 + (-> self water) + (the-as float 1.4) + (-> self control trans) + 0 + (-> self control transv) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (none) + ) + :code + (-> target-stance code) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-wade-walk (target) + :event + target-standard-event-handler + :enter + (-> target-wade-stance enter) + :exit + (-> target-wade-stance exit) + :trans + (behavior () + ((-> self state-hook)) + (when + (and + (zero? (logand (-> self water flags) 1024)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water wade-time)) + ) + 30 + ) + ) + (if (logtest? (-> self water flags) 2048) + (go target-swim-stance) + (go target-stance) + ) + ) + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go target-wade-stance) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (go target-duck-walk) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (sound-play-by-name + (static-sound-name "swim-stroke") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (dummy-13 + (-> self water) + (the-as float 1.4) + (-> self control trans) + 0 + (-> self control transv) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 105) + (f30-0 0.0) + ) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 23)) + (= v1-2 (-> self draw art-group data 18)) + ) + (set! gp-0 15) + (set! f30-0 (ja-frame-num 0)) + ) + ((let ((v1-9 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-9 (-> self draw art-group data 34)) + (= v1-9 (-> self draw art-group data 38)) + ) + ) + (set! gp-0 30) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 92) + ) + (set! gp-0 120) + ) + ) + ) + (cond + ((and (= (ja-group-size) 6) (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 89) + ) + ) + ) + (else + (ja-channel-push! 6 gp-0) + (let ((gp-1 (-> self skel root-channel 0))) + (set! (-> gp-1 dist) (-> *TARGET-bank* wade-shallow-walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 89)) + num-func-identity + ) + (set! (-> gp-1 frame-num) f30-0) + ) + (let ((gp-2 (-> self skel root-channel 1))) + (set! (-> gp-2 dist) (-> *TARGET-bank* wade-deep-walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 90)) + num-func-identity + ) + (set! (-> gp-2 frame-num) f30-0) + ) + (let ((gp-3 (-> self skel root-channel 2))) + (set! (-> gp-3 frame-interp) 0.0) + (set! (-> gp-3 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 23)) + num-func-identity + ) + (set! (-> gp-3 frame-num) f30-0) + ) + (let ((gp-4 (-> self skel root-channel 3))) + (set! (-> gp-4 frame-interp) 0.0) + (set! (-> gp-4 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 25)) + num-func-identity + ) + (set! (-> gp-4 frame-num) f30-0) + ) + (let ((gp-5 (-> self skel root-channel 4))) + (set! (-> gp-5 frame-interp) 0.0) + (set! (-> gp-5 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 27)) + num-func-identity + ) + (set! (-> gp-5 frame-num) f30-0) + ) + ) + ) + ) + (set! (-> self skel root-channel 2 command) 'push) + (set! (-> self skel root-channel 5 command) 'stack) + (let ((f30-1 0.0) + (f28-0 0.0) + (f26-0 + (lerp-scale + (the-as float 1.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (-> self control unknown-float01) + (the-as float 16384.0) + (the-as float 32768.0) + ) + ) + (gp-6 0) + ) + (while #t + (let + ((f0-10 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control unknown-float61))))) + (f24-0 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control unknown-float62))))) + ) + (let ((f1-4 (fabs (- f0-10 f30-1)))) + (set! f30-1 (seek f30-1 f0-10 (fmax 0.05 (fmin 0.2 (* 0.25 f1-4))))) + ) + (let ((f0-14 (fabs (- f24-0 f28-0)))) + (set! f28-0 (seek f28-0 f24-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-14))))) + ) + ) + (let ((v1-84 (-> self skel root-channel 3))) + (set! (-> v1-84 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! + (-> v1-84 frame-group) + (the-as art-joint-anim (-> self draw art-group data 25)) + ) + ) + (cond + ((>= f30-1 0.0) + (let ((v1-87 (-> self skel root-channel 3))) + (set! (-> v1-87 frame-interp) (fabs f30-1)) + (set! (-> v1-87 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! + (-> v1-87 frame-group) + (the-as art-joint-anim (-> self draw art-group data 24)) + ) + ) + ) + (else + (let ((v1-90 (-> self skel root-channel 3))) + (set! (-> v1-90 frame-interp) (fabs f30-1)) + (set! (-> v1-90 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! + (-> v1-90 frame-group) + (the-as art-joint-anim (-> self draw art-group data 25)) + ) + ) + ) + ) + (cond + ((>= f28-0 0.0) + (let ((v1-93 (-> self skel root-channel 4))) + (set! (-> v1-93 frame-interp) (fabs f28-0)) + (set! (-> v1-93 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-93 frame-group) + (the-as art-joint-anim (-> self draw art-group data 26)) + ) + ) + ) + (else + (let ((v1-96 (-> self skel root-channel 4))) + (set! (-> v1-96 frame-interp) (fabs f28-0)) + (set! (-> v1-96 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-96 frame-group) + (the-as art-joint-anim (-> self draw art-group data 27)) + ) + ) + ) + ) + (let* ((f0-30 (- (-> self water height) (-> self control trans y))) + (f24-1 + (lerp-scale + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 1.0) + f0-30 + (lerp + (-> self water wade-height) + (-> self water swim-height) + (the-as float 0.25) + ) + (lerp + (-> self water wade-height) + (-> self water swim-height) + (the-as float 0.75) + ) + ) + ) + ) + (let ((v1-108 (-> self skel effect))) + (set! (-> v1-108 channel-offset) (if (< 0.5 f24-1) + 1 + 0 + ) + ) + ) + 0 + (set! + f26-0 + (seek + f26-0 + (lerp-scale + (the-as float 1.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (-> self control unknown-float01) + (the-as float 16384.0) + (the-as float 32768.0) + ) + (* 4.0 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> self skel root-channel 1 frame-interp) f24-1) + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 param 0) + (/ + (-> self control unknown-float01) + (* + 60.0 + (/ (dummy-9 (-> self skel)) (-> *TARGET-bank* run-cycle-length)) + ) + ) + ) + (joint-control-channel-group-eval! + s5-2 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((s5-3 (-> self skel root-channel 5))) + (set! + (-> s5-3 frame-interp) + (lerp f26-0 (the-as float (-> (new 'static 'array int32 1 0) 0)) f24-1) + ) + ) + ) + (let ((a0-66 (-> self skel root-channel 1))) + (set! (-> a0-66 param 0) 0.0) + (joint-control-channel-group-eval! + a0-66 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-67 (-> self skel root-channel 2))) + (set! (-> a0-67 param 0) 0.0) + (joint-control-channel-group-eval! + a0-67 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-68 (-> self skel root-channel 3))) + (set! (-> a0-68 param 0) 0.0) + (joint-control-channel-group-eval! + a0-68 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-69 (-> self skel root-channel 4))) + (set! (-> a0-69 param 0) 0.0) + (joint-control-channel-group-eval! + a0-69 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (when + (and + (>= (- (-> *display* base-frame-counter) gp-6) 60) + (< (- (-> self water height) (-> self control trans y)) 4096.0) + ) + (case (the int (ja-aframe-num 0)) + ((15 16 17 18) + (dummy-13 + (-> self water) + (the-as float 0.2) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 75) + ) + 0 + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control transv) + 2.5 + ) + ) + (set! gp-6 (-> *display* base-frame-counter)) + ) + ((46 47 48 49) + (dummy-13 + (-> self water) + (the-as float 0.2) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 71) + ) + 0 + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control transv) + 2.5 + ) + ) + (set! gp-6 (-> *display* base-frame-counter)) + ) + ) + ) + (suspend) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; definition for function target-swim-tilt +(defbehavior + target-swim-tilt target + ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) + (let + ((gp-0 + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control unknown-quaternion00) + ) + ) + ) + (let + ((v1-2 + (vector-z-quaternion! + (new 'stack-no-clear 'vector) + (-> self control dir-targ) + ) + ) + (f0-1 + (fmin + 1.0 + (* + arg0 + (/ + (-> self control unknown-float01) + (-> self control unknown-surface01 target-speed) + ) + ) + ) + ) + ) + (set! + (-> self control unknown-float130) + (seek + (-> self control unknown-float130) + (fmax + (fmin (* (+ f0-1 arg2) (fmax 0.5 (+ 0.5 (vector-dot gp-0 v1-2)))) arg3) + (- arg3) + ) + (* arg1 (-> *display* seconds-per-frame)) + ) + ) + ) + (let + ((a2-2 + (vector-y-quaternion! + (new 'stack-no-clear 'vector) + (-> self control unknown-quaternion00) + ) + ) + ) + (forward-up-nopitch->quaternion + (-> self control unknown-quaternion01) + gp-0 + a2-2 + ) + ) + ) + (quaternion-rotate-x! + (-> self control unknown-quaternion01) + (-> self control unknown-quaternion01) + (the-as float (if (>= (-> self control unknown-float130) 0.0) + 16384.0 + -16384.0 + ) + ) + ) + (set! + (-> self control unknown-float00) + (fabs (-> self control unknown-float130)) + ) + (if (= (-> self next-state name) 'target-swim-down) + (set! + (-> self control unknown-float131) + (seek + (-> self control unknown-float131) + (the-as float -6144.0) + (* 4096.0 (-> *display* seconds-per-frame)) + ) + ) + (set! + (-> self control unknown-float131) + (seek + (-> self control unknown-float131) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (* 2048.0 (-> *display* seconds-per-frame)) + ) + ) + ) + (let ((f0-20 (-> self control unknown-float131))) + (set! (-> self control unknown-vector11 y) f0-20) + f0-20 + ) + ) + +;; failed to figure out what this is: +(defstate target-swim-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *swim-mods*) + (logior! (-> self water flags) 16) + (none) + ) + :exit + (behavior () + (target-state-hook-exit) + (set! (-> self control unknown-surface00 target-speed) 28672.0) + (target-exit) + (when + (not + (or + (= (-> self next-state name) 'target-swim-stance) + (= (-> self next-state name) 'target-swim-walk) + (= (-> self next-state name) 'target-swim-down) + (= (-> self next-state name) 'target-swim-up) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float00) 0.0) + ) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (logtest? (-> self control status) 1) + (zero? (logand (-> self control status) 1024)) + ) + (set-zero! (-> self water bob)) + ) + (when + (and + (zero? (logand (-> self water flags) 2048)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + ) + (if (logtest? (-> self water flags) 1024) + (go target-wade-stance) + (go target-stance) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water enter-swim-time)) + ) + 30 + ) + ) + (go + target-swim-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (go target-swim-down) + ) + (if + (and + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (let ((gp-0 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (ja-aframe-num 0) + (if + (or + (and (= gp-0 (-> self draw art-group data 96)) #t) + (and (= gp-0 (-> self draw art-group data 95)) #t) + ) + #f + #t + ) + ) + ) + (go target-swim-walk) + ) + (target-swim-tilt + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 2.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 1.0) + ) + (none) + ) + :code + (behavior () + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 95)) + ) + (ja-channel-push! 1 22) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 97)) + ) + (set! + (-> a0-8 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 97)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! + (-> a0-8 param 1) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + 1.0 + 2.0 + ) + ) + ) + (set! (-> a0-8 frame-num) 0.0) + (joint-control-channel-group! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 97)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 param 0) + (the float (+ (-> a0-9 frame-group data 0 length) -1)) + ) + (let + ((v1-41 + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + 1.0 + 2.0 + ) + ) + ) + (set! (-> a0-9 param 1) (the-as float v1-41)) + ) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 92) + ) + (ja-channel-push! 1 249) + ) + (else + (ja-channel-push! 1 45) + ) + ) + ) + (while #t + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 91)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (until + (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-21 (-> self skel root-channel 0))) + (set! + (-> a0-21 param 0) + (the float (+ (-> a0-21 frame-group data 0 length) -1)) + ) + (set! (-> a0-21 param 1) 1.0) + (joint-control-channel-group-eval! + a0-21 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (none) + ) + :post + target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-walk (target) + :event + target-standard-event-handler + :enter + (behavior () + ((-> target-swim-stance enter)) + (die-on-next-update! (-> self water bob)) + (set! + (-> self control unknown-uint20) + (the-as uint (-> *display* base-frame-counter)) + ) + (none) + ) + :exit + (-> target-swim-stance exit) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (logtest? (-> self control status) 1) + (zero? (logand (-> self control status) 1024)) + ) + (set-zero! (-> self water bob)) + ) + (when + (and + (zero? (logand (-> self water flags) 2048)) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water swim-time)) + ) + 30 + ) + ) + (if (logtest? (-> self water flags) 1024) + (go target-wade-stance) + (go target-stance) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water enter-swim-time)) + ) + 30 + ) + ) + (go + target-swim-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons square) + ) + (< (-> *TARGET-bank* min-dive-depth) (target-height-above-ground)) + ) + (go target-swim-down) + ) + (cond + ((= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (if + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 15) + ) + (go target-swim-stance) + ) + ) + (else + (set! + (-> self control unknown-uint20) + (the-as uint (-> *display* base-frame-counter)) + ) + ) + ) + (target-swim-tilt + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 2.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 1.0) + ) + (none) + ) + :code + (behavior () + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 95)) + (= v1-2 (-> self draw art-group data 97)) + ) + (ja-channel-push! 1 90) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 97) + ) + (ja-channel-push! 1 45) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 92)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 92)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) 1.0) + (set! (-> gp-0 frame-num) (ja-aframe (the-as float 19.0) 0)) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 92)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (if (zero? (logand (-> self align flags) 1)) + (set! + (-> self control unknown-surface00 target-speed) + (* + (-> self align delta trans z) + (-> self control unknown-surface01 alignv) + (-> *display* frames-per-second) + ) + ) + ) + (suspend) + (let ((a0-19 (-> self skel root-channel 0))) + (set! + (-> a0-19 param 0) + (the float (+ (-> a0-19 frame-group data 0 length) -1)) + ) + (set! (-> a0-19 param 1) 1.0) + (joint-control-channel-group-eval! + a0-19 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (ja-channel-push! 1 45) + ) + ) + ) + (while #t + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 frame-group) + (the-as art-joint-anim (-> self draw art-group data 92)) + ) + (set! + (-> a0-22 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 92)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-22 param 1) 1.0) + (set! (-> a0-22 frame-num) 0.0) + (joint-control-channel-group! + a0-22 + (the-as art-joint-anim (-> self draw art-group data 92)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (if (zero? (logand (-> self align flags) 1)) + (set! + (-> self control unknown-surface00 target-speed) + (* + (-> self align delta trans z) + (-> self control unknown-surface01 alignv) + (-> *display* frames-per-second) + ) + ) + ) + (suspend) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 param 0) + (the float (+ (-> a0-24 frame-group data 0 length) -1)) + ) + (set! (-> a0-24 param 1) 1.0) + (joint-control-channel-group-eval! + a0-24 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-down (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('attack 'attack-invinc) + (let ((v1-2 (the-as attack-info (-> arg3 param 1)))) + (when + (or + (zero? (logand (-> v1-2 mask) 32)) + (= (-> v1-2 mode) 'generic) + (= (-> v1-2 mode) 'drown) + ) + (set! (-> v1-2 mode) 'damage) + (if + (and + (= (-> self game mode) 'play) + (>= 1.0 (-> self fact-info-target health)) + ) + (set! (-> v1-2 mode) 'drown-death) + ) + (logior! (-> v1-2 mask) 32) + (set! (-> self control unknown-uint20) (the-as uint #t)) + ) + ) + ) + ) + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self water flags) (logand -17 (-> self water flags))) + (set! (-> self control unknown-surface00) *dive-mods*) + (set! (-> self control dynam gravity-max) 16384.0) + (set! (-> self control dynam gravity-length) 16384.0) + (set! + (-> self water swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self control unknown-uint20) (the-as uint #f)) + (if (= (-> self next-state name) 'target-swim-down) + (set! (-> self control unknown-float130) 0.0) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (target-exit) + (when + (not + (or + (= (-> self next-state name) 'target-swim-stance) + (= (-> self next-state name) 'target-swim-walk) + (= (-> self next-state name) 'target-swim-down) + (= (-> self next-state name) 'target-swim-up) + ) + ) + (quaternion-identity! (-> self control unknown-quaternion01)) + (set! (-> self control unknown-float00) 0.0) + ) + (none) + ) + :trans + (behavior () + (if + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> self water swim-time)) + ) + 150 + ) + (go target-stance) + ) + (cond + ((>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) + 30 + ) + (set! (-> self control unknown-surface00) *dive-mods*) + (if (= (-> self next-state name) 'target-swim-down) + (target-swim-tilt + (the-as float -0.9) + (the-as float 1.0) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 0.5) + ) + ) + ) + (else + (set! (-> self control unknown-surface00) *dive-bottom-mods*) + (if + (or + (= (-> self next-state name) 'target-swim-down) + (= (-> self next-state name) 'target-swim-stance) + ) + (target-swim-tilt + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 2.0) + (the-as float -1.0) + (the-as float 1.0) + ) + ) + ) + ) + (none) + ) + :code + (behavior () + (let ((gp-0 60) + (s5-0 3000) + (f30-0 0.0) + ) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (set! f30-0 (cond + ((or + (= v1-2 (-> self draw art-group data 91)) + (= v1-2 (-> self draw art-group data 92)) + (= v1-2 (-> self draw art-group data 97)) + (= v1-2 (-> self draw art-group data 96)) + (= v1-2 (-> self draw art-group data 95)) + ) + (ja-channel-push! 1 22) + (let ((a0-17 (-> self skel root-channel 0))) + (set! + (-> a0-17 frame-group) + (the-as art-joint-anim (-> self draw art-group data 93)) + ) + (set! + (-> a0-17 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 93)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-17 param 1) 1.0) + (set! (-> a0-17 frame-num) 0.0) + (joint-control-channel-group! + a0-17 + (the-as art-joint-anim (-> self draw art-group data 93)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 6 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + (if (= (ja-aframe-num 0) 73.0) + (dummy-13 + (-> self water) + (the-as float 0.7) + (-> self control trans) + 1 + *null-vector* + ) + ) + (suspend) + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 param 0) + (the float (+ (-> a0-22 frame-group data 0 length) -1)) + ) + (set! (-> a0-22 param 1) 1.0) + (joint-control-channel-group-eval! + a0-22 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 94)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + f30-0 + ) + (else + (case (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + + (((-> self draw art-group data 63) + (-> self draw art-group data 66) + (-> self draw art-group data 64) + (-> self draw art-group data 67) + ) + (ja-channel-push! 1 22) + (set! gp-0 120) + (let ((s4-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> self draw art-group data 94)) + num-func-identity + ) + (set! + (-> s4-1 frame-num) + (ja-aframe (the-as float 124.0) 0) + ) + ) + -16384.0 + ) + (else + (ja-channel-push! 1 22) + (let ((s4-2 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-2 + (the-as art-joint-anim (-> self draw art-group data 94)) + num-func-identity + ) + (set! (-> s4-2 frame-num) 0.0) + ) + f30-0 + ) + ) + ) + ) + ) + ) + (while #t + (if + (and + (or + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons square) + ) + ) + (-> self control unknown-spoolanim00) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) gp-0) + ) + (go target-swim-up) + ) + (if + (or + (>= (- (-> *display* base-frame-counter) (-> self state-time)) s5-0) + (and + (logtest? (-> self control status) 1) + (and + (< (-> self water swim-depth) 8192.0) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) gp-0) + ) + ) + ) + (go target-swim-up) + ) + (let ((s4-3 (new-stack-vector0)) + (f24-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + s4-3 + (-> self control transv) + (vector-float*! s4-3 (-> self control dynam gravity-normal) f24-0) + ) + (let* ((f28-0 (vector-length s4-3)) + (f26-0 f28-0) + (f24-1 (+ f24-0 f30-0)) + ) + (set! + f30-0 + (seek + f30-0 + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (* 32768.0 (-> *display* seconds-per-frame)) + ) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f24-1 + ) + (vector-float*! s4-3 s4-3 (/ f28-0 f26-0)) + ) + ) + ) + (suspend) + (let ((s4-4 (-> self skel root-channel 0))) + (set! + (-> s4-4 param 0) + (lerp-scale + (the-as float 0.4) + (the-as float 1.0) + (vector-length (-> self control transv)) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + (the-as float 16384.0) + ) + ) + (joint-control-channel-group-eval! + s4-4 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + ) + (none) + ) + :post + target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-up (target) + :event + (-> target-swim-down event) + :enter + (-> target-swim-down enter) + :exit + (-> target-swim-down exit) + :trans + (behavior () + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (zero? (logand (-> self state-flags) 2048)) + (zero? (logand (-> self water flags) #x6000)) + ) + (go + target-swim-jump-jump + (-> *TARGET-bank* swim-jump-height-min) + (-> *TARGET-bank* swim-jump-height-max) + (the-as surface #f) + ) + ) + (when + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 3000) + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) 'attack) + (set! (-> a1-1 param 0) (the-as uint #f)) + (let ((a0-8 (new 'static 'attack-info :mask #x20))) + (set! (-> a0-8 mode) 'drown-death) + (set! (-> a1-1 param 1) (the-as uint a0-8)) + ) + (send-event-function self a1-1) + ) + ) + ((-> target-swim-down trans)) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 30) + (let ((f30-0 1.0)) + (let ((gp-0 #t)) + (let ((a0-1 (-> self skel root-channel 0))) + (set! + (-> a0-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 95)) + ) + (set! + (-> a0-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 95)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-1 param 1) 1.0) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! + a0-1 + (the-as art-joint-anim (-> self draw art-group data 95)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (target-swim-tilt (the-as float (if (< 8192.0 (-> self water swim-depth)) + 0.5 + (-> (new 'static 'array int32 1 0) 0) + ) + ) + (the-as + float + 1.0 + ) + (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) + ) + (if + (and + (zero? (logand (-> self water flags) 4096)) + (or + (>= (ja-aframe-num 0) 222.0) + (and + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (>= (ja-aframe-num 0) 200.0) + ) + ) + ) + (goto cfg-37) + ) + (TODO-RENAME-9 (-> self align)) + (when (zero? (logand (-> self water flags) 4096)) + (logior! (-> self water flags) 16) + (set! gp-0 #f) + ) + (if gp-0 + (TODO-RENAME-10 + (-> self align) + 2 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + ) + (suspend) + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 param 0) + (the float (+ (-> a0-9 frame-group data 0 length) -1)) + ) + (set! (-> a0-9 param 1) 1.0) + (joint-control-channel-group-eval! + a0-9 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 96)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (while #t + (target-swim-tilt (the-as float (if (< 8192.0 (-> self water swim-depth)) + 0.3 + (-> (new 'static 'array int32 1 0) 0) + ) + ) + (the-as + float + 1.0 + ) + (the-as float (-> (new 'static 'array int32 1 0) 0)) (the-as float 0.1) + ) + (if (zero? (logand (-> self water flags) 4096)) + (goto cfg-37) + ) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (set! f30-0 2.0) + ) + (TODO-RENAME-9 (-> self align)) + (when (logtest? (-> self water flags) 4096) + (TODO-RENAME-10 + (-> self align) + 2 + (the-as float 1.0) + (the-as float 1.0) + (the-as float 1.0) + ) + (set! (-> self control transv y) (+ 8192.0 (* 8192.0 f30-0))) + ) + (suspend) + (let ((a0-16 (-> self skel root-channel 0))) + (set! (-> a0-16 param 0) f30-0) + (joint-control-channel-group-eval! + a0-16 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (set! + f30-0 + (seek f30-0 (the-as float 1.0) (-> *display* seconds-per-frame)) + ) + ) + ) + (label cfg-37) + (logior! (-> self water flags) 16) + (set! + (-> self water swim-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (start-bobbing! (-> self water) (the-as float -4096.0) 600 1500) + (set! + (-> self water bob start-time) + (+ (-> *display* base-frame-counter) -15) + ) + (go target-swim-stance) + (none) + ) + :post + target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-swim-jump-jump (target) + :event + (-> target-jump event) + :enter + (-> target-jump enter) + :exit + target-exit + :trans + (behavior () + (cond + ((< (- (-> *display* base-frame-counter) (-> self state-time)) 150) + (set! (-> self water flags) (logior #x10000 (-> self water flags))) + (set! (-> self control status) (logand -8 (-> self control status))) + ) + (else + (set! (-> self trans-hook) (-> target-jump trans)) + ) + ) + ((-> target-jump trans)) + (none) + ) + :code + (-> target-jump code) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-swim-jump (target) + :event + target-standard-event-handler + :enter + (-> target-swim-stance enter) + :exit + (behavior () + ((-> target-swim-stance exit)) + (die-on-next-update! (-> self water bob)) + (set! (-> self water align-offset) 0.0) + (set! (-> self water flags) (logior #x10000 (-> self water flags))) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (die-on-next-update! (-> self water bob)) + (ja-channel-push! 1 15) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 98)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (until + (and (ja-done? 0) (= (-> self skel root-channel 0) (-> self skel channel))) + (TODO-RENAME-9 (-> self align)) + (if (zero? (logand (-> self align flags) 1)) + (+! (-> self water align-offset) (* 0.6 (-> self align delta trans y))) + ) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 param 0) + (the float (+ (-> a0-8 frame-group data 0 length) -1)) + ) + (set! (-> a0-8 param 1) 2.0) + (joint-control-channel-group-eval! + a0-8 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((f30-0 (fmax 0.0 (- (-> self water bob-offset))))) + (let ((s4-1 (new-stack-vector0))) + (let + ((f0-8 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + s4-1 + (-> self control transv) + (vector-float*! s4-1 (-> self control dynam gravity-normal) f0-8) + ) + ) + (let* ((f0-9 (vector-length s4-1)) + (f1-5 f0-9) + (f2-1 0.4096) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-1 + ) + (vector-float*! s4-1 s4-1 (/ f0-9 f1-5)) + ) + ) + ) + (go target-swim-jump-jump (+ f30-0 arg0) (+ f30-0 arg1) (the-as surface #f)) + ) + (none) + ) + :post + target-swim-post + ) + +;; failed to figure out what this is: +(defstate target-hit-ground-hard (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float)) + (set! (-> self control unknown-dword31) 0) + (set! (-> self control unknown-dword33) 0) + (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) + (set! (-> self control unknown-surface00) *walk-mods*) + (none) + ) + :code + (behavior ((arg0 float)) + (when (!= arg0 0.0) + (let + ((f0-5 + (the + float + (the + int + (+ + 1.0 + (/ + (- arg0 (-> *TARGET-bank* fall-far)) + (-> *TARGET-bank* fall-far-inc) + ) + ) + ) + ) + ) + ) + (pickup-collectable! + (-> self fact-info-target) + (pickup-type eco-green) + (* (-> *FACT-bank* health-single-inc) (- (fmax 0.0 f0-5))) + (the-as handle #f) + ) + ) + (if (zero? (logand (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3))) + (target-timed-invulnerable + (-> *TARGET-bank* hit-invulnerable-timeout) + self + ) + ) + ) + (cond + ((and + (= (-> self game mode) 'play) + (>= 0.0 (-> self fact-info-target health)) + ) + (set! (-> self attack-info attacker) (the-as handle #f)) + (go target-death 'target-hit-ground-hard) + ) + (else + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 30) + (ja-channel-push! 1 1) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 36)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (until + (and + (ja-done? 0) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 param 0) + (the float (+ (-> a0-12 frame-group data 0 length) -1)) + ) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! + a0-12 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 37)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (until + (and + (ja-done? 0) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + (suspend) + (when (= (-> self skel root-channel 0) (-> self skel channel)) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 param 0) + (the float (+ (-> a0-20 frame-group data 0 length) -1)) + ) + (set! (-> a0-20 param 1) 1.0) + (joint-control-channel-group-eval! + a0-20 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (go target-stance) + ) + ) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-launch (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'query) (= (-> arg3 param 0) 'mode)) + 'target-launch + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + :code + (behavior ((arg0 float) (arg1 symbol) (arg2 vector) (arg3 int)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (ja-channel-push! 1 45) + (set-forward-vel (the-as float (-> (new 'static 'array int32 1 0) 0))) + (let ((s2-0 (-> self skel root-channel 0))) + (set! + (-> s2-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 31)) + ) + (set! (-> s2-0 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> s2-0 param 1) 3.0) + (set! (-> s2-0 frame-num) 0.0) + (joint-control-channel-group! + s2-0 + (the-as art-joint-anim (-> self draw art-group data 31)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s2-1 (-> self skel root-channel 0))) + (set! (-> s2-1 param 0) (ja-aframe (the-as float 15.0) 0)) + (set! (-> s2-1 param 1) 3.0) + (joint-control-channel-group-eval! + s2-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (if arg1 + (send-event *camera* 'change-state arg1 180) + ) + (when (nonzero? arg3) + (let ((s3-1 (get-process *default-dead-pool* process #x4000))) + (when s3-1 + (let ((t9-9 (method-of-type process activate))) + (t9-9 s3-1 self 'process (the-as pointer #x70004000)) + ) + (run-next-time-in-process + s3-1 + (lambda :behavior target + ((arg0 vector) (arg1 int) (arg2 float)) + (local-vars (sv-32 int) (sv-40 vector) (sv-44 symbol)) + (set! sv-32 (-> *display* base-frame-counter)) + (let ((v1-2 (new-stack-vector0))) + (set! (-> v1-2 quad) (-> arg0 quad)) + (set! sv-40 v1-2) + ) + (set! sv-44 #t) + (until (>= (- (-> *display* base-frame-counter) sv-32) arg1) + (let ((s4-0 (ppointer->process (-> self parent)))) + (cond + ((and + sv-44 + (< + (- + (-> (the-as target s4-0) control trans y) + (-> (the-as target s4-0) control unknown-vector52 y) + ) + arg2 + ) + ) + (vector-xz-normalize! + (-> (the-as target s4-0) control transv) + (the-as float (-> (new 'static 'array int32 1 0) 0)) + ) + (case (-> (the-as target s4-0) current-level name) + (('jungleb) + (let + ((v1-16 + (vector-! + (new-stack-vector0) + (-> (the-as target s4-0) control trans) + sv-40 + ) + ) + ) + (set! + (-> (the-as target s4-0) control trans x) + (+ (-> sv-40 x) (fmax -4096.0 (fmin 4096.0 (-> v1-16 x)))) + ) + (set! + (-> (the-as target s4-0) control trans z) + (+ (-> sv-40 z) (fmax -4096.0 (fmin 4096.0 (-> v1-16 z)))) + ) + ) + ) + ) + ) + (else + (if sv-44 + (set! sv-32 (-> *display* base-frame-counter)) + ) + (set! sv-44 (the-as symbol #f)) + (when + (or + (= + (-> (the-as target s4-0) next-state name) + 'target-duck-high-jump-jump + ) + (= (-> (the-as target s4-0) next-state name) 'target-falling) + ) + (let ((v1-30 (-> (the-as target s4-0) control trans)) + (s3-0 (-> (the-as target s4-0) control transv)) + ) + (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x))) + (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z))) + (let ((f30-0 (vector-xz-length s3-0))) + (if (< 122880.0 f30-0) + (vector-xz-normalize! s3-0 (the-as float 122880.0)) + ) + (if (< 4096.0 f30-0) + (forward-up-nopitch->quaternion + (-> (the-as target s4-0) control dir-targ) + (vector-normalize-copy! + (new 'stack-no-clear 'vector) + s3-0 + (the-as float 1.0) + ) + (vector-y-quaternion! + (new 'stack-no-clear 'vector) + (-> (the-as target s4-0) control quat) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (suspend) + 0 + ) + #f + ) + arg2 + arg3 + (-> (new 'static 'array float 1 143360.0) 0) + ) + (-> s3-1 ppointer) + ) + ) + ) + (sound-play-by-name + (static-sound-name "launch-fire") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + (go target-high-jump arg0 arg0 'launch) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-periscope (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('change-mode) + #f + ) + (('end-mode) + (when (-> self control unknown-spoolanim00) + (set! (-> self control unknown-uint20) (the-as uint #f)) + #t + ) + ) + (else + (target-generic-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :exit + (behavior () + (target-exit) + (set! (-> self cam-user-mode) 'normal) + (logior! (-> self state-flags) 256) + (set! (-> self state-flags) (logand -17 (-> self state-flags))) + (none) + ) + :code + (behavior ((arg0 handle)) + (set! (-> self neck flex-blend) 0.0) + (target-exit) + (logior! (-> self state-flags) 144) + (let ((v1-4 (handle->process arg0))) + (if v1-4 + (quaterion<-rotate-y-vector + (-> self control dir-targ) + (vector-! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable v1-4) root trans) + (-> self control trans) + ) + ) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint #t)) + (ja-channel-push! 1 30) + (let ((a0-11 (-> self skel root-channel 0))) + (set! + (-> a0-11 frame-group) + (the-as art-joint-anim (-> self draw art-group data 101)) + ) + (set! + (-> a0-11 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 101)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-11 param 1) 1.0) + (set! (-> a0-11 frame-num) 0.0) + (joint-control-channel-group! + a0-11 + (the-as art-joint-anim (-> self draw art-group data 101)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 param 0) + (the float (+ (-> a0-12 frame-group data 0 length) -1)) + ) + (set! (-> a0-12 param 1) 1.0) + (joint-control-channel-group-eval! + a0-12 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (send-event (handle->process arg0) 'change-mode) + (while (-> self control unknown-spoolanim00) + (suspend) + ) + (let ((a0-16 (-> self skel root-channel 0))) + (set! + (-> a0-16 frame-group) + (the-as art-joint-anim (-> self draw art-group data 101)) + ) + (set! (-> a0-16 param 0) 0.0) + (set! (-> a0-16 param 1) 2.0) + (set! + (-> a0-16 frame-num) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 101)) + data + 0 + length + ) + -1 + ) + ) + ) + (joint-control-channel-group! + a0-16 + (the-as art-joint-anim (-> self draw art-group data 101)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-17 (-> self skel root-channel 0))) + (set! (-> a0-17 param 0) 0.0) + (set! (-> a0-17 param 1) 2.0) + (joint-control-channel-group-eval! + a0-17 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-stance) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-play-anim (target) + :event + target-generic-event-handler + :enter + (behavior ((arg0 string) (arg1 handle)) + (set! (-> self control unknown-handle10) arg1) + (dummy-60 + (-> self control) + (the-as float 40960.0) + (the-as float 40960.0) + #f + (-> self control root-prim collide-with) + ) + (logior! (-> self state-flags) 256) + (set! (-> self neck flex-blend) 0.0) + (none) + ) + :exit + (behavior () + (send-event (handle->process (-> self control unknown-handle10)) 'end-mode) + (target-exit) + (none) + ) + :code + (behavior ((arg0 string) (arg1 handle)) + (let + ((gp-0 + (the-as + art-joint-anim + (dummy-10 (-> self draw art-group) arg0 art-joint-anim) + ) + ) + ) + (when gp-0 + (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) + (ja-channel-set! 1) + (let ((a0-4 (-> self skel root-channel 0))) + (set! (-> a0-4 frame-group) gp-0) + (set! (-> a0-4 param 0) (the float (+ (-> gp-0 data 0 length) -1))) + (set! (-> a0-4 param 1) 1.0) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! a0-4 gp-0 num-func-seek!) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 param 0) + (the float (+ (-> a0-5 frame-group data 0 length) -1)) + ) + (set! (-> a0-5 param 1) 1.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (send-event (ppointer->process (-> self sidekick)) 'matrix 'normal) + ) + ) + (go target-stance) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-clone-anim (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'trans) (= (-> arg3 param 0) 'restore)) + (set! (-> self control unknown-uint20) (the-as uint #f)) + ) + ((-> target-grab event) arg0 arg1 arg2 arg3) + ) + :enter + (behavior ((arg0 handle)) + (set! (-> self control unknown-handle10) arg0) + (set! (-> self control unknown-vector102 quad) (-> self control trans quad)) + (set! (-> self control unknown-uint20) (the-as uint #t)) + (quaternion-copy! + (the-as quaternion (-> self control unknown-vector103)) + (-> self control quat) + ) + (logior! (-> self state-flags) 256) + (vector-reset! (-> self control transv)) + (set! (-> self neck flex-blend) 0.0) + (send-event (ppointer->process (-> self sidekick)) 'shadow #t) + (none) + ) + :exit + (behavior () + (send-event (ppointer->process (-> self sidekick)) 'matrix 'normal) + (send-event (ppointer->process (-> self sidekick)) 'shadow #t) + (let ((gp-0 (-> self node-list data 3)) + (a1-2 (&-> (-> self control) unknown-qword00)) + ) + (cond + ((not (-> self control unknown-spoolanim00)) + ) + ((zero? (logand (-> self draw status) 2)) + (TODO-RENAME-30 (-> self control) (the-as vector a1-2)) + (matrix->quaternion + (-> self control unknown-quaternion00) + (-> gp-0 bone transform) + ) + (quaternion-copy! + (-> self control quat) + (-> self control unknown-quaternion00) + ) + (dummy-60 + (-> self control) + (the-as float 4096.0) + (the-as float 40960.0) + #t + (-> self control root-prim collide-with) + ) + (when (logtest? (-> self control status) 1024) + (let ((a1-6 (new-stack-vector0))) + (set! (-> a1-6 x) (-> self control trans x)) + (set! (-> a1-6 y) (-> self water height)) + (set! (-> a1-6 z) (-> self control trans z)) + (set! (-> a1-6 w) 1.0) + (TODO-RENAME-30 (-> self control) a1-6) + ) + ) + ) + (else + (format 0 "ERROR: : camera used backup position~%") + (TODO-RENAME-30 (-> self control) (-> self control unknown-vector102)) + (quaternion-copy! + (-> self control quat) + (the-as quaternion (-> self control unknown-vector103)) + ) + ) + ) + ) + (rot->dir-targ! (-> self control)) + (logior! (-> self control status) 7) + (set! (-> self control unknown-dword11) (-> *display* base-frame-counter)) + (ja-channel-set! 0) + (ja-post) + (target-exit) + (none) + ) + :code + (behavior ((arg0 handle)) + (clone-anim arg0 (the-as int (-> self draw origin-joint-index)) #t "") + (go target-stance) + (none) + ) + :post + target-no-ja-move-post + ) diff --git a/test/decompiler/reference/engine/target/target_REF.gc b/test/decompiler/reference/engine/target/target_REF.gc new file mode 100644 index 0000000000..d05b5df322 --- /dev/null +++ b/test/decompiler/reference/engine/target/target_REF.gc @@ -0,0 +1,7561 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function target-falling-anim +(defbehavior target-falling-anim target ((arg0 int) (arg1 int)) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 38)) + (= v1-2 (-> self draw art-group data 62)) + ) + ) + ((let ((v1-8 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-8 (-> self draw art-group data 44)) + (= v1-8 (-> self draw art-group data 45)) + ) + ) + (ja-channel-push! 1 45) + (let ((a0-16 (-> self skel root-channel 0))) + (set! + (-> a0-16 frame-group) + (the-as art-joint-anim (-> self draw art-group data 50)) + ) + (set! + (-> a0-16 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 50)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-16 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-16 frame-num) 0.0) + (joint-control-channel-group! + a0-16 + (the-as art-joint-anim (-> self draw art-group data 50)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-17 (-> self skel root-channel 0))) + (set! + (-> a0-17 param 0) + (the float (+ (-> a0-17 frame-group data 0 length) -1)) + ) + (set! (-> a0-17 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-17 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 50) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-23 (-> self skel root-channel 0))) + (set! + (-> a0-23 param 0) + (the float (+ (-> a0-23 frame-group data 0 length) -1)) + ) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-23 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (ja-channel-push! 1 45) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 86) + ) + (ja-channel-push! 1 45) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! + (-> s5-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 34)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> s5-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s5-0 frame-num) (ja-aframe (the-as float 20.0) 0)) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (let ((a0-33 (-> self skel root-channel 0))) + (set! + (-> a0-33 param 0) + (the float (+ (-> a0-33 frame-group data 0 length) -1)) + ) + (set! (-> a0-33 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-33 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + ) + (else + (ja-channel-push! 1 arg1) + (let ((v1-82 (-> self skel root-channel 0))) + (set! + (-> v1-82 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + ) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (suspend) + ) + ) + ) + ) + (let ((a0-42 (-> self skel root-channel 0))) + (set! + (-> a0-42 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-42 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-42 frame-num) 0.0) + (joint-control-channel-group! + a0-42 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (let ((s5-1 (-> *display* base-frame-counter))) + (while (or (= arg0 -1) (< (- (-> *display* base-frame-counter) s5-1) arg0)) + (suspend) + (let ((a0-43 (-> self skel root-channel 0))) + (set! + (-> a0-43 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-43 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-43 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + ) + #f + ) + +;; definition for function target-falling-anim-trans +;; ERROR: function was not converted to expressions. Cannot decompile. + +;; definition for function target-falling-trans +;; INFO: Return type mismatch int vs none. +(defbehavior target-falling-trans target ((arg0 basic) (arg1 cpad-list)) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack-air #f) + ) + (when (= arg0 'target-eco-powerup) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (zero? (logand (-> self water flags) 512)) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 900) + (zero? (logand (-> self state-flags) 2048)) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + ) + (if (logtest? (-> self control status) 1) + (go target-hit-ground #f) + ) + (when + (if + (and + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + (>= (the-as int arg1) 0) + (>= + (- (-> *display* base-frame-counter) (-> self state-time)) + (the-as int arg1) + ) + (not + (and + *cheat-mode* + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons r2) + ) + ) + ) + ) + #t + ) + (logior! (-> self control status) 1) + (go target-hit-ground 'stuck) + ) + (if (!= (-> self state-time) (-> *display* base-frame-counter)) + (slide-down-test) + ) + 0 + (none) + ) + +;; definition for function target-hit-ground-anim +(defbehavior target-hit-ground-anim target ((arg0 symbol)) + (let ((v1-2 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-2 (-> self draw art-group data 63)) + (= v1-2 (-> self draw art-group data 64)) + (= v1-2 (-> self draw art-group data 66)) + (= v1-2 (-> self draw art-group data 67)) + ) + (let + ((gp-0 + (or + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (< + (-> self control unknown-float01) + (-> (new 'static 'array float 1 61440.0) 0) + ) + ) + ) + (f30-0 (if (= arg0 'swim) + (-> (new 'static 'array float 1 0.4) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (ja-channel-set! 1) + (let ((s5-0 (-> self skel root-channel 0))) + (set! (-> s5-0 frame-group) (the-as art-joint-anim (if gp-0 + (-> + self + draw + art-group + data + 65 + ) + (-> + self + draw + art-group + data + 68 + ) + ) + ) + ) + (set! (-> s5-0 param 0) (the float (+ (-> (the-as art-joint-anim (if gp-0 + (-> + self + draw + art-group + data + 65 + ) + (-> + self + draw + art-group + data + 68 + ) + ) + ) + data 0 length + ) + -1 + ) + ) + ) + (let + ((f30-1 + (seek + f30-0 + (-> (new 'static 'array float 1 1.0) 0) + (* 0.5 (-> *display* seconds-per-frame)) + ) + ) + ) + (set! (-> s5-0 param 1) f30-1) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! s5-0 (the-as art-joint-anim (if gp-0 + (-> + self + draw + art-group + data + 65 + ) + (-> + self + draw + art-group + data + 68 + ) + ) + ) + num-func-seek! + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 (-> self align) (if gp-0 + 2 + 6 + ) + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (the-as float 1.5) + ) + (when + (and + (>= 25.0 (ja-aframe-num 0)) + (and + (>= (ja-aframe-num 0) 21.0) + (= (-> self next-state name) 'target-flop-hit-ground) + (!= (-> self control unknown-spoolanim00) 'stuck) + ) + ) + (set! (-> self event-hook) target-jump-event-handler) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (ja-channel-set! 0) + (go + target-high-jump + (-> *TARGET-bank* flop-jump-height-min) + (-> *TARGET-bank* flop-jump-height-max) + (if gp-0 + 'flop + 'flop-forward + ) + ) + ) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! + (-> s5-1 param 0) + (the float (+ (-> s5-1 frame-group data 0 length) -1)) + ) + (set! + f30-1 + (seek + f30-1 + (-> (new 'static 'array float 1 1.0) 0) + (* 0.5 (-> *display* seconds-per-frame)) + ) + ) + (set! (-> s5-1 param 1) f30-1) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + #f + ) + ((and + (= (-> self control ground-pat material) (pat-material ice)) + (< 16384.0 (-> self control unknown-float01)) + ) + #f + ) + ((let ((v1-95 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (or + (= v1-95 (-> self draw art-group data 38)) + (= v1-95 (-> self draw art-group data 42)) + (= v1-95 (-> self draw art-group data 43)) + ) + (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (>= (ja-aframe-num 0) 38.0) + ) + ) + ) + (ja-channel-push! 1 6) + (let ((a0-35 (-> self skel root-channel 0))) + (set! + (-> a0-35 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> a0-35 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-35 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-35 frame-num) 0.0) + (joint-control-channel-group! + a0-35 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-36 (-> self skel root-channel 0))) + (set! + (-> a0-36 param 0) + (the float (+ (-> a0-36 frame-group data 0 length) -1)) + ) + (set! (-> a0-36 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-36 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (>= (ja-aframe-num 0) 35.0) + ) + (ja-channel-set! 1) + (let ((a0-44 (-> self skel root-channel 0))) + (set! + (-> a0-44 frame-group) + (the-as art-joint-anim (-> self draw art-group data 39)) + ) + (set! + (-> a0-44 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 39)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-44 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-44 frame-num) 0.0) + (joint-control-channel-group! + a0-44 + (the-as art-joint-anim (-> self draw art-group data 39)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-45 (-> self skel root-channel 0))) + (set! + (-> a0-45 param 0) + (the float (+ (-> a0-45 frame-group data 0 length) -1)) + ) + (set! (-> a0-45 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-45 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-1 (-> self skel root-channel 0))) + (set! + (-> gp-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-1 frame-num) (ja-aframe (the-as float 50.0) 0)) + (joint-control-channel-group! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-49 (-> self skel root-channel 0))) + (set! + (-> a0-49 param 0) + (the float (+ (-> a0-49 frame-group data 0 length) -1)) + ) + (set! (-> a0-49 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-49 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((let ((v1-187 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-187 (-> self draw art-group data 34)) + (= v1-187 (-> self draw art-group data 41)) + ) + ) + (ja-channel-set! 1) + (let ((gp-2 (-> self skel root-channel 0))) + (set! + (-> gp-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 39)) + ) + (set! + (-> gp-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 39)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-2 frame-num) (ja-aframe (the-as float 38.0) 0)) + (joint-control-channel-group! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 39)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-61 (-> self skel root-channel 0))) + (set! + (-> a0-61 param 0) + (the float (+ (-> a0-61 frame-group data 0 length) -1)) + ) + (set! (-> a0-61 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-61 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-3 (-> self skel root-channel 0))) + (set! + (-> gp-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-3 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-3 frame-num) (ja-aframe (the-as float 50.0) 0)) + (joint-control-channel-group! + gp-3 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-65 (-> self skel root-channel 0))) + (set! + (-> a0-65 param 0) + (the float (+ (-> a0-65 frame-group data 0 length) -1)) + ) + (set! (-> a0-65 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-65 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((let ((v1-242 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-242 (-> self draw art-group data 73)) + (= v1-242 (-> self draw art-group data 74)) + ) + ) + (let ((f30-2 (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 74) + ) + (-> (new 'static 'array float 1 24576.0) 0) + (-> (new 'static 'array float 1 -24576.0) 0) + ) + ) + ) + (ja-channel-push! 1 12) + (let ((gp-4 (-> self skel root-channel 0))) + (set! + (-> gp-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 39)) + ) + (set! + (-> gp-4 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 39)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-4 frame-num) (ja-aframe (the-as float 38.0) 0)) + (joint-control-channel-group! + gp-4 + (the-as art-joint-anim (-> self draw art-group data 39)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set-forward-vel f30-2) + (suspend) + (let ((a0-82 (-> self skel root-channel 0))) + (set! + (-> a0-82 param 0) + (the float (+ (-> a0-82 frame-group data 0 length) -1)) + ) + (set! (-> a0-82 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-82 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (let ((gp-5 (-> self skel root-channel 0))) + (set! + (-> gp-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-5 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-5 frame-num) (ja-aframe (the-as float 50.0) 0)) + (joint-control-channel-group! + gp-5 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-86 (-> self skel root-channel 0))) + (set! + (-> a0-86 param 0) + (the float (+ (-> a0-86 frame-group data 0 length) -1)) + ) + (set! (-> a0-86 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-86 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((let ((v1-305 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-305 (-> self draw art-group data 34)) + (= v1-305 (-> self draw art-group data 56)) + (= v1-305 (-> self draw art-group data 57)) + (= v1-305 (-> self draw art-group data 58)) + (= v1-305 (-> self draw art-group data 68)) + (= v1-305 (-> self draw art-group data 65)) + (= v1-305 (-> self draw art-group data 62)) + ) + ) + (ja-channel-push! 1 12) + (let ((gp-6 (-> self skel root-channel 0))) + (set! + (-> gp-6 frame-group) + (the-as art-joint-anim (-> self draw art-group data 35)) + ) + (set! + (-> gp-6 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 35)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-6 frame-num) (ja-aframe (the-as float 42.0) 0)) + (joint-control-channel-group! + gp-6 + (the-as art-joint-anim (-> self draw art-group data 35)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-113 (-> self skel root-channel 0))) + (set! + (-> a0-113 param 0) + (the float (+ (-> a0-113 frame-group data 0 length) -1)) + ) + (set! (-> a0-113 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-113 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + #f + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 35) + ) + (let ((a0-119 (-> self skel root-channel 0))) + (set! + (-> a0-119 param 0) + (the float (+ (-> a0-119 frame-group data 0 length) -1)) + ) + (set! (-> a0-119 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group! + a0-119 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + #f + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate target-startup (target) + :event + target-standard-event-handler + :code + (behavior () + (suspend) + (suspend) + (go target-stance) + (none) + ) + :post + target-no-move-post + ) + +;; failed to figure out what this is: +(defstate target-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :exit + (behavior () + (set! (-> self control unknown-float81) 0.0) + (target-state-hook-exit) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if (logtest? (-> self water flags) 1024) + (go target-wade-stance) + ) + (when (= (-> self control ground-pat material) (pat-material ice)) + (set! (-> self control unknown-float81) 0.0) + (remove-exit) + (go target-ice-stance) + ) + (when (move-legs?) + (set! (-> self control unknown-float81) 0.0) + (remove-exit) + (go target-walk) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (set! (-> self control unknown-float81) 0.0) + (remove-exit) + (go target-duck-stance) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (slide-down-test) + (fall-test) + (none) + ) + :code + (behavior () + (let ((s5-0 22) + (gp-0 (new 'stack 'ground-tween-info)) + ) + (let ((v1-3 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-3 (-> self draw art-group data 89)) + (= v1-3 (-> self draw art-group data 90)) + ) + (set! s5-0 45) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 71) + ) + (let ((a0-12 (-> self skel root-channel 0))) + (set! + (-> a0-12 frame-group) + (the-as art-joint-anim (-> self draw art-group data 72)) + ) + (set! + (-> a0-12 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 72)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-12 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-12 frame-num) 0.0) + (joint-control-channel-group! + a0-12 + (the-as art-joint-anim (-> self draw art-group data 72)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 param 0) + (the float (+ (-> a0-13 frame-group data 0 length) -1)) + ) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-13 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 51) + ) + (cond + ((rand-vu-percent? (the-as float 0.3)) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 frame-group) + (the-as art-joint-anim (-> self draw art-group data 53)) + ) + (set! + (-> a0-20 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 53)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-20 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-20 frame-num) 0.0) + (joint-control-channel-group! + a0-20 + (the-as art-joint-anim (-> self draw art-group data 53)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-21 (-> self skel root-channel 0))) + (set! + (-> a0-21 param 0) + (the float (+ (-> a0-21 frame-group data 0 length) -1)) + ) + (set! (-> a0-21 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-21 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((a0-23 (-> self skel root-channel 0))) + (set! + (-> a0-23 frame-group) + (the-as art-joint-anim (-> self draw art-group data 52)) + ) + (set! + (-> a0-23 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 52)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-23 frame-num) 0.0) + (joint-control-channel-group! + a0-23 + (the-as art-joint-anim (-> self draw art-group data 52)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 param 0) + (the float (+ (-> a0-24 frame-group data 0 length) -1)) + ) + (set! (-> a0-24 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-24 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 78) + ) + (let ((a0-30 (-> self skel root-channel 0))) + (set! + (-> a0-30 frame-group) + (the-as art-joint-anim (-> self draw art-group data 79)) + ) + (set! + (-> a0-30 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 79)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-30 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-30 frame-num) 0.0) + (joint-control-channel-group! + a0-30 + (the-as art-joint-anim (-> self draw art-group data 79)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-31 (-> self skel root-channel 0))) + (set! + (-> a0-31 param 0) + (the float (+ (-> a0-31 frame-group data 0 length) -1)) + ) + (set! (-> a0-31 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-31 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 84) + ) + (let ((a0-37 (-> self skel root-channel 0))) + (set! + (-> a0-37 frame-group) + (the-as art-joint-anim (-> self draw art-group data 85)) + ) + (set! + (-> a0-37 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 85)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-37 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-37 frame-num) 0.0) + (joint-control-channel-group! + a0-37 + (the-as art-joint-anim (-> self draw art-group data 85)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-38 (-> self skel root-channel 0))) + (set! + (-> a0-38 param 0) + (the float (+ (-> a0-38 frame-group data 0 length) -1)) + ) + (set! (-> a0-38 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-38 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! s5-0 0) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 59) + ) + (set! + (-> self control unknown-float81) + (-> self control unknown-float80) + ) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let ((s4-0 (-> self skel root-channel 0))) + (set! + (-> s4-0 frame-group) + (the-as art-joint-anim (if (rand-vu-percent? (the-as float 0.3)) + (-> self draw art-group data 61) + (-> self draw art-group data 60) + ) + ) + ) + (set! + (-> s4-0 param 0) + (the + float + (+ + (-> (the-as art-joint-anim (if (rand-vu-percent? (the-as float 0.3)) + (-> self draw art-group data 61) + (-> self draw art-group data 60) + ) + ) + data 0 length + ) + -1 + ) + ) + ) + (set! (-> s4-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s4-0 frame-num) 0.0) + (joint-control-channel-group! + s4-0 + (the-as art-joint-anim (if (rand-vu-percent? (the-as float 0.3)) + (-> self draw art-group data 61) + (-> self draw art-group data 60) + ) + ) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! + (-> self control unknown-float81) + (seek + (-> self control unknown-float81) + (-> (new 'static 'array float 1 0.0) 0) + (-> *display* seconds-per-frame) + ) + ) + (suspend) + (let ((a0-50 (-> self skel root-channel 0))) + (set! + (-> a0-50 param 0) + (the float (+ (-> a0-50 frame-group data 0 length) -1)) + ) + (set! (-> a0-50 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-50 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float81) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-206 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-206 (-> self draw art-group data 31)) + (= v1-206 (-> self draw art-group data 32)) + ) + ) + (ja-channel-push! 1 12) + (let ((a0-62 (-> self skel root-channel 0))) + (set! + (-> a0-62 frame-group) + (the-as art-joint-anim (-> self draw art-group data 30)) + ) + (set! (-> a0-62 param 0) 0.0) + (set! (-> a0-62 param 1) 1.2) + (set! + (-> a0-62 frame-num) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 30)) + data + 0 + length + ) + -1 + ) + ) + ) + (joint-control-channel-group! + a0-62 + (the-as art-joint-anim (-> self draw art-group data 30)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-63 (-> self skel root-channel 0))) + (set! (-> a0-63 param 0) 0.0) + (set! (-> a0-63 param 1) 1.2) + (joint-control-channel-group-eval! + a0-63 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! s5-0 12) + ) + ((or (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (begin + (set! s5-0 45) + (< 0.5 (-> self skel root-channel 6 frame-interp)) + ) + ) + (let ((v1-243 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-243 (-> self draw art-group data 28)) + (= v1-243 (-> self draw art-group data 29)) + (= v1-243 (-> self draw art-group data 54)) + (= v1-243 (-> self draw art-group data 55)) + ) + ) + ) + (let ((f30-1 (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (let + ((f0-57 + (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))) + ) + ) + (- f0-57 (* (the float (the int (/ f0-57 50.0))) 50.0)) + ) + ) + (else + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + ) + ) + (set! s5-0 45) + (ja-channel-push! 3 s5-0) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 4)) + (the-as uint (-> self draw art-group data 13)) + (the-as uint (-> self draw art-group data 16)) + (the-as uint (-> self draw art-group data 7)) + (the-as uint (-> self draw art-group data 10)) + ) + (let ((s4-1 (-> self skel root-channel 0))) + (set! (-> s4-1 num-func) num-func-identity) + (set! (-> s4-1 frame-num) (ja-aframe f30-1 0)) + ) + ) + (let ((a0-89 (-> self skel root-channel 1))) + (set! (-> a0-89 param 0) 0.0) + (joint-control-channel-group-eval! + a0-89 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-90 (-> self skel root-channel 2))) + (set! (-> a0-90 param 0) 0.0) + (joint-control-channel-group-eval! + a0-90 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (dotimes (s4-2 3) + (until (ja-done? 0) + (ground-tween-update + gp-0 + (-> self control unknown-float61) + (-> self control unknown-float62) + ) + (suspend) + (let ((a0-92 (-> self skel root-channel 0))) + (set! + (-> a0-92 param 0) + (the float (+ (-> a0-92 frame-group data 0 length) -1)) + ) + (set! (-> a0-92 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-92 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-93 (-> self skel root-channel 1))) + (set! (-> a0-93 param 0) 0.0) + (joint-control-channel-group-eval! + a0-93 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-94 (-> self skel root-channel 2))) + (set! (-> a0-94 param 0) 0.0) + (joint-control-channel-group-eval! + a0-94 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + (let ((v1-298 (-> self skel root-channel 0))) + (set! (-> v1-298 num-func) num-func-identity) + (set! (-> v1-298 frame-num) 0.0) + ) + ) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 3)) + (the-as uint (-> self draw art-group data 12)) + (the-as uint (-> self draw art-group data 15)) + (the-as uint (-> self draw art-group data 6)) + (the-as uint (-> self draw art-group data 9)) + ) + (until (ja-done? 0) + (ground-tween-update + gp-0 + (-> self control unknown-float61) + (-> self control unknown-float62) + ) + (suspend) + (let ((a0-99 (-> self skel root-channel 0))) + (set! + (-> a0-99 param 0) + (the float (+ (-> a0-99 frame-group data 0 length) -1)) + ) + (set! (-> a0-99 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-99 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-100 (-> self skel root-channel 1))) + (set! (-> a0-100 param 0) 0.0) + (joint-control-channel-group-eval! + a0-100 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-101 (-> self skel root-channel 2))) + (set! (-> a0-101 param 0) 0.0) + (joint-control-channel-group-eval! + a0-101 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (>= (-> self control unknown-float01) 5734.4) + ) + (set! s5-0 45) + ) + ) + ) + (if (not (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 5) + ) + (= (ja-group-size) 3) + ) + ) + (ja-channel-push! 3 s5-0) + ) + (ground-tween-initialize + gp-0 + (the-as uint 0) + (the-as uint (-> self draw art-group data 5)) + (the-as uint (-> self draw art-group data 14)) + (the-as uint (-> self draw art-group data 17)) + (the-as uint (-> self draw art-group data 8)) + (the-as uint (-> self draw art-group data 11)) + ) + (while #t + (ground-tween-update + gp-0 + (-> self control unknown-float61) + (-> self control unknown-float62) + ) + (suspend) + (let ((a0-115 (-> self skel root-channel 0))) + (set! (-> a0-115 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-115 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((a0-116 (-> self skel root-channel 1))) + (set! (-> a0-116 param 0) 0.0) + (joint-control-channel-group-eval! + a0-116 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-117 (-> self skel root-channel 2))) + (set! (-> a0-117 param 0) 0.0) + (joint-control-channel-group-eval! + a0-117 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (if (can-play-stance-amibent?) + (go target-stance-ambient) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-walk (target) + :event + target-walk-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *walk-mods*) + (none) + ) + :exit + (behavior () + (target-effect-exit) + (target-state-hook-exit) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (when (= (-> self control ground-pat material) (pat-material ice)) + (target-effect-exit) + (remove-exit) + (go target-ice-walk) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons l1 r1) + ) + (and + (>= + (- + (-> *display* base-frame-counter) + (the-as int (-> *TARGET-bank* wheel-timeout)) + ) + (-> self control unknown-dword30) + ) + (and + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (can-wheel?) + ) + ) + ) + (go target-wheel) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (can-duck?) + ) + (target-effect-exit) + (remove-exit) + (go target-duck-walk) + ) + (when (not (move-legs?)) + (target-effect-exit) + (remove-exit) + (go target-stance) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (when + (and + (turn-around?) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 90) + ) + (set! + (-> self control transv quad) + (-> + self + control + unknown-vector-array10 + (-> self control unknown-int10) + quad + ) + ) + (set! (-> self control transv w) (-> (new 'static 'array float 1 1.0) 0)) + (go target-turn-around) + ) + (slide-down-test) + (fall-test) + (none) + ) + :code + (behavior () + (let ((f28-0 0.0) + (f30-0 + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -16384.0 (-> self control unknown-float01))) + ) + ) + ) + (gp-0 #f) + ) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 33) + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (ja-channel-push! 7 15) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 69) + ) + (ja-channel-push! 7 22) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 51) + ) + (let + ((f30-1 + (fmax + 0.8 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (-> self control unknown-float01)) + ) + ) + ) + ) + (cond + ((and + (rand-vu-percent? (the-as float 0.3)) + (< 20480.0 (-> self control unknown-float01)) + ) + (let ((s5-0 (-> self skel root-channel 0))) + (set! + (-> s5-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 53)) + ) + (set! (-> s5-0 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-0 param 1) f30-1) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! + s5-0 + (the-as art-joint-anim (-> self draw art-group data 53)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-1 param 1) f30-1) + (joint-control-channel-group-eval! + s5-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 frame-group) + (the-as art-joint-anim (-> self draw art-group data 55)) + ) + (set! + (-> a0-20 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 55)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-20 param 1) f30-1) + (set! (-> a0-20 frame-num) 0.0) + (joint-control-channel-group! + a0-20 + (the-as art-joint-anim (-> self draw art-group data 55)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-21 (-> self skel root-channel 0))) + (set! + (-> a0-21 param 0) + (the float (+ (-> a0-21 frame-group data 0 length) -1)) + ) + (set! (-> a0-21 param 1) f30-1) + (joint-control-channel-group-eval! + a0-21 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((s5-2 (-> self skel root-channel 0))) + (set! + (-> s5-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 52)) + ) + (set! (-> s5-2 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-2 param 1) f30-1) + (set! (-> s5-2 frame-num) 0.0) + (joint-control-channel-group! + s5-2 + (the-as art-joint-anim (-> self draw art-group data 52)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-3 (-> self skel root-channel 0))) + (set! (-> s5-3 param 0) (ja-aframe (the-as float 29.0) 0)) + (set! (-> s5-3 param 1) f30-1) + (joint-control-channel-group-eval! + s5-3 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-28 (-> self skel root-channel 0))) + (set! + (-> a0-28 frame-group) + (the-as art-joint-anim (-> self draw art-group data 54)) + ) + (set! + (-> a0-28 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 54)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-28 param 1) f30-1) + (set! (-> a0-28 frame-num) 0.0) + (joint-control-channel-group! + a0-28 + (the-as art-joint-anim (-> self draw art-group data 54)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-29 (-> self skel root-channel 0))) + (set! + (-> a0-29 param 0) + (the float (+ (-> a0-29 frame-group data 0 length) -1)) + ) + (set! (-> a0-29 param 1) f30-1) + (joint-control-channel-group-eval! + a0-29 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + (ja-channel-push! 7 15) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (set! f28-0 30.0) + ) + (else + (let ((v1-108 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((or + (= v1-108 (-> self draw art-group data 59)) + (= v1-108 (-> self draw art-group data 60)) + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (set! f28-0 30.0) + (ja-channel-push! 7 45) + ) + ((let ((v1-116 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-116 (-> self draw art-group data 84)) + (= v1-116 (-> self draw art-group data 85)) + ) + ) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (set! f28-0 26.0) + (ja-channel-push! 7 30) + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 23) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + (set! f28-0 (ja-aframe-num 0)) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 102) + ) + (set! f28-0 (ja-aframe-num 0)) + (ja-channel-push! 7 30) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 89) + ) + (set! f28-0 (ja-aframe-num 0)) + (ja-channel-push! 7 15) + ) + ((let ((v1-146 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (and + (or + (or + (= v1-146 (-> self draw art-group data 38)) + (= v1-146 (-> self draw art-group data 71)) + (= v1-146 (-> self draw art-group data 58)) + (= v1-146 (-> self draw art-group data 62)) + (= v1-146 (-> self draw art-group data 65)) + (= v1-146 (-> self draw art-group data 68)) + ) + (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (< 30.0 (ja-aframe-num 0)) + ) + ) + (< 12288.0 (-> self control unknown-float01)) + ) + ) + (let ((s5-4 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + (f30-2 (-> self control ground-impact-vel)) + ) + (case (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + + (((-> self draw art-group data 71) (-> self draw art-group data 58)) + (ja-channel-push! 1 15) + ) + (else + (ja-channel-set! 1) + ) + ) + (cond + ((< (if (= s5-4 (-> self draw art-group data 34)) + (-> (new 'static 'array float 1 77824.0) 0) + (-> (new 'static 'array float 1 102400.0) 0) + ) + f30-2 + ) + (let ((s5-5 (-> self skel root-channel 0))) + (set! + (-> s5-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 28)) + ) + (set! + (-> s5-5 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-5 param 1) 1.00001) + (set! (-> s5-5 frame-num) 0.0) + (joint-control-channel-group! + s5-5 + (the-as art-joint-anim (-> self draw art-group data 28)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-6 (-> self skel root-channel 0))) + (set! + (-> s5-6 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-6 param 1) 1.00001) + (joint-control-channel-group-eval! + s5-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((< (if (= s5-4 (-> self draw art-group data 34)) + (-> (new 'static 'array float 1 61440.0) 0) + (-> (new 'static 'array float 1 102400.0) 0) + ) + f30-2 + ) + (let ((s5-7 (-> self skel root-channel 0))) + (set! + (-> s5-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 28)) + ) + (set! + (-> s5-7 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-7 param 1) 1.00001) + (set! + (-> s5-7 frame-num) + (ja-aframe (-> (new 'static 'array float 1 -1.0) 0) 0) + ) + (joint-control-channel-group! + s5-7 + (the-as art-joint-anim (-> self draw art-group data 28)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-8 (-> self skel root-channel 0))) + (set! + (-> s5-8 param 0) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (set! (-> s5-8 param 1) 1.00001) + (joint-control-channel-group-eval! + s5-8 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((s5-9 (-> self skel root-channel 0))) + (set! + (-> s5-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 29)) + ) + (set! (-> s5-9 param 0) (ja-aframe (the-as float 4.0) 0)) + (set! (-> s5-9 param 1) 1.00001) + (set! (-> s5-9 frame-num) 0.0) + (joint-control-channel-group! + s5-9 + (the-as art-joint-anim (-> self draw art-group data 29)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s5-10 (-> self skel root-channel 0))) + (set! (-> s5-10 param 0) (ja-aframe (the-as float 4.0) 0)) + (set! (-> s5-10 param 1) 1.00001) + (joint-control-channel-group-eval! + s5-10 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-116 (-> self skel root-channel 0))) + (set! + (-> a0-116 param 0) + (the float (+ (-> a0-116 frame-group data 0 length) -1)) + ) + (set! + (-> a0-116 param 1) + (/ + (* + (fmax 20480.0 (-> self control unknown-float01)) + (-> *display* seconds-per-frame) + ) + (/ + (-> *TARGET-bank* run-up-cycle-dist) + (-> *TARGET-bank* run-cycle-length) + ) + ) + ) + (joint-control-channel-group-eval! + a0-116 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! f28-0 30.0) + (set! f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (ja-channel-set! 7) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 34) + ) + (ja-channel-push! 7 15) + (set! gp-0 #t) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 78) + ) + (ja-channel-push! 7 45) + ) + (else + (ja-channel-push! 7 15) + ) + ) + ) + ) + ) + (set! (-> self skel root-channel 3 command) 'push) + (set! (-> self skel root-channel 6 command) 'stack) + (let ((v1-265 (-> self skel root-channel 0))) + (set! + (-> v1-265 frame-group) + (the-as art-joint-anim (-> self draw art-group data 23)) + ) + ) + (let ((f28-1 (ja-aframe f28-0 0))) + (let ((s5-11 (-> self skel root-channel 0))) + (set! (-> s5-11 frame-interp) 0.0) + (set! (-> s5-11 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + s5-11 + (the-as art-joint-anim (-> self draw art-group data 23)) + num-func-identity + ) + (set! (-> s5-11 frame-num) f28-1) + ) + (let ((s5-12 (-> self skel root-channel 1))) + (set! (-> s5-12 frame-interp) 0.0) + (set! (-> s5-12 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + s5-12 + (the-as art-joint-anim (-> self draw art-group data 25)) + num-func-identity + ) + (set! (-> s5-12 frame-num) f28-1) + ) + (let ((s5-13 (-> self skel root-channel 2))) + (set! (-> s5-13 frame-interp) 0.0) + (set! (-> s5-13 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + s5-13 + (the-as art-joint-anim (-> self draw art-group data 27)) + num-func-identity + ) + (set! (-> s5-13 frame-num) f28-1) + ) + (let ((s5-14 (-> self skel root-channel 4))) + (set! (-> s5-14 frame-interp) 0.0) + (set! (-> s5-14 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (joint-control-channel-group-eval! + s5-14 + (the-as art-joint-anim (-> self draw art-group data 20)) + num-func-identity + ) + (set! (-> s5-14 frame-num) f28-1) + ) + (let ((s5-15 (-> self skel root-channel 5))) + (set! (-> s5-15 frame-interp) 0.0) + (set! (-> s5-15 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (joint-control-channel-group-eval! + s5-15 + (the-as art-joint-anim (-> self draw art-group data 22)) + num-func-identity + ) + (set! (-> s5-15 frame-num) f28-1) + ) + (let ((s5-16 (-> self skel root-channel 3))) + (set! (-> s5-16 frame-interp) 0.0) + (set! (-> s5-16 dist) (-> *TARGET-bank* run-cycle-dist)) + (joint-control-channel-group-eval! + s5-16 + (the-as art-joint-anim (-> self draw art-group data 18)) + num-func-identity + ) + (set! (-> s5-16 frame-num) f28-1) + ) + ) + (let ((f28-2 0.0) + (f26-1 0.0) + ) + (while #t + (let + ((f22-0 + (fmax + (-> (new 'static 'array float 1 -1.0) 0) + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 2.0 (-> self control unknown-float61)) + ) + ) + ) + (f24-0 + (fmax + (-> (new 'static 'array float 1 -1.0) 0) + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 1.6 (-> self control unknown-float62)) + ) + ) + ) + ) + (set! + f30-0 + (seek + f30-0 + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -16384.0 (-> self control unknown-float01))) + ) + ) + (* 2.0 (-> *display* seconds-per-frame)) + ) + ) + (let ((v1-317 (-> self skel effect))) + (set! (-> v1-317 channel-offset) (if (< 0.5 f30-0) + 3 + 0 + ) + ) + ) + 0 + (let ((f0-64 (fabs (- f22-0 f28-2)))) + (set! f28-2 (seek f28-2 f22-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-64))))) + ) + (let ((f0-69 (fabs (- f24-0 f26-1)))) + (set! f26-1 (seek f26-1 f24-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-69))))) + ) + ) + (cond + ((>= f28-2 0.0) + (let ((v1-329 (-> self skel root-channel 1))) + (set! (-> v1-329 frame-interp) (fabs f28-2)) + (set! (-> v1-329 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! + (-> v1-329 frame-group) + (the-as art-joint-anim (-> self draw art-group data 24)) + ) + ) + (let ((v1-332 (-> self skel root-channel 4))) + (set! (-> v1-332 frame-interp) (fabs f28-2)) + (set! (-> v1-332 dist) (-> *TARGET-bank* run-up-cycle-dist)) + (set! + (-> v1-332 frame-group) + (the-as art-joint-anim (-> self draw art-group data 19)) + ) + ) + ) + (else + (let ((v1-335 (-> self skel root-channel 1))) + (set! (-> v1-335 frame-interp) (fabs f28-2)) + (set! (-> v1-335 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! + (-> v1-335 frame-group) + (the-as art-joint-anim (-> self draw art-group data 25)) + ) + ) + (let ((v1-338 (-> self skel root-channel 4))) + (set! (-> v1-338 frame-interp) (fabs f28-2)) + (set! (-> v1-338 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (set! + (-> v1-338 frame-group) + (the-as art-joint-anim (-> self draw art-group data 20)) + ) + ) + ) + ) + (cond + ((>= f26-1 0.0) + (let ((v1-341 (-> self skel root-channel 2))) + (set! (-> v1-341 frame-interp) (fabs f26-1)) + (set! (-> v1-341 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-341 frame-group) + (the-as art-joint-anim (-> self draw art-group data 26)) + ) + ) + (let ((v1-344 (-> self skel root-channel 5))) + (set! (-> v1-344 frame-interp) (fabs f26-1)) + (set! (-> v1-344 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! + (-> v1-344 frame-group) + (the-as art-joint-anim (-> self draw art-group data 21)) + ) + ) + ) + (else + (let ((v1-347 (-> self skel root-channel 2))) + (set! (-> v1-347 frame-interp) (fabs f26-1)) + (set! (-> v1-347 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! + (-> v1-347 frame-group) + (the-as art-joint-anim (-> self draw art-group data 27)) + ) + ) + (let ((v1-350 (-> self skel root-channel 5))) + (set! (-> v1-350 frame-interp) (fabs f26-1)) + (set! (-> v1-350 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! + (-> v1-350 frame-group) + (the-as art-joint-anim (-> self draw art-group data 22)) + ) + ) + ) + ) + (set! (-> self skel root-channel 6 frame-interp) f30-0) + (let* ((f1-19 (dummy-9 (-> self skel))) + (f0-92 + (/ + (-> self control unknown-float01) + (* 60.0 (/ f1-19 (-> *TARGET-bank* run-cycle-length))) + ) + ) + (a0-182 (-> self skel root-channel 0)) + ) + (set! (-> a0-182 param 0) f0-92) + (joint-control-channel-group-eval! + a0-182 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (let ((a0-183 (-> self skel root-channel 1))) + (set! (-> a0-183 param 0) 0.0) + (joint-control-channel-group-eval! + a0-183 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-184 (-> self skel root-channel 2))) + (set! (-> a0-184 param 0) 0.0) + (joint-control-channel-group-eval! + a0-184 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-185 (-> self skel root-channel 3))) + (set! (-> a0-185 param 0) 0.0) + (joint-control-channel-group-eval! + a0-185 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-186 (-> self skel root-channel 4))) + (set! (-> a0-186 param 0) 0.0) + (joint-control-channel-group-eval! + a0-186 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (let ((a0-187 (-> self skel root-channel 5))) + (set! (-> a0-187 param 0) 0.0) + (joint-control-channel-group-eval! + a0-187 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (if (and gp-0 (!= (-> self skel root-channel 0) (-> self skel channel))) + (ja-blend-eval) + ) + (suspend) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-turn-around (target) + :event + target-standard-event-handler + :enter + (behavior () + (vector-turn-to (-> self control transv)) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + (none) + ) + :exit + (behavior () + (target-state-hook-exit) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + (set! (-> self control unknown-float01) 0.0) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (set! (-> self control unknown-float81) 0.0) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (if + (and + (zero? (logand (-> self control status) 1)) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) + 24 + ) + ) + (go target-falling #f) + ) + (slide-down-test) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 12) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 33)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (quaternion-rotate-y! + (-> self control dir-targ) + (-> self control dir-targ) + (the-as float 32768.0) + ) + (TODO-RENAME-9 (-> self align)) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) 2.0) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 16 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (remove-exit) + (set! (-> self control unknown-float81) 0.0) + (set-forward-vel (the-as float 40960.0)) + (set! (-> self control unknown-float01) 40960.0) + (target-state-hook-exit) + (go target-walk) + (none) + ) + :post + target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-slide-down (target) + :event + target-walk-event-handler + :enter + (behavior () + (set! (-> self control unknown-surface00) *jump-mods*) + (none) + ) + :exit + (behavior () + (set! (-> self control unknown-dword35) (-> *display* base-frame-counter)) + (none) + ) + :trans + (behavior () + (when + (or + (logtest? (-> self control status) 1) + (if + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + #t + ) + ) + (logior! (-> self control status) 1) + (go target-duck-stance) + ) + (none) + ) + :code + (behavior () + (if (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + ) + (ja-channel-push! 1 30) + ) + (while #t + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 31)) + ) + (set! + (-> a0-5 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 31)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! + a0-5 + (the-as art-joint-anim (-> self draw art-group data 31)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; definition for function init-var-jump +;; Used lq/sq +(defbehavior + init-var-jump target + ((arg0 float) (arg1 float) (arg2 vector) (arg3 vector) (arg4 vector)) + (set! (-> self control status) (logand -16385 (-> self control status))) + (delete-back-vel) + (when + (< + (- + (-> *display* base-frame-counter) + (the-as int (-> self control rider-time)) + ) + 15 + ) + (let + ((f0-1 + (fmax + 0.0 + (fmin + 28672.0 + (* + 0.5 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control rider-last-move) + ) + ) + ) + ) + ) + ) + (set! arg0 (+ arg0 f0-1)) + (set! arg1 (+ arg1 f0-1)) + ) + (when + (or + (logtest? (-> self control unknown-surface01 flags) #x4000) + (= (-> self control poly-pat material) (pat-material rotate)) + ) + (+! (-> self control transv x) (-> self control rider-last-move x)) + (+! (-> self control transv z) (-> self control rider-last-move z)) + ) + ) + (set! (-> self control unknown-float123) 0.0) + (set! (-> self control unknown-float124) 0.0) + (cond + (arg3 + (set! + (-> self control unknown-uint20) + (the-as uint (- arg0 (+ -409.6 (-> *TARGET-bank* jump-collide-offset)))) + ) + (set! + (-> self control unknown-int21) + (the-as int (- arg1 (-> *TARGET-bank* jump-collide-offset))) + ) + ) + (else + (set! (-> self control unknown-uint20) (the-as uint arg0)) + (set! (-> self control unknown-int21) (the-as int arg1)) + ) + ) + (when arg2 + (let ((s4-1 (new-stack-vector0))) + (let ((f0-16 (vector-dot (-> self control dynam gravity-normal) arg4))) + 0.0 + (vector-! + s4-1 + arg4 + (vector-float*! s4-1 (-> self control dynam gravity-normal) f0-16) + ) + ) + (let* ((f0-17 (vector-length s4-1)) + (f1-11 f0-17) + (f2-7 + (- + (sqrtf (* 2.0 (-> self control dynam gravity-length) arg0)) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + arg4 + (vector-float*! arg4 (-> self control dynam gravity-normal) f2-7) + (vector-float*! s4-1 s4-1 (/ f0-17 f1-11)) + ) + ) + ) + ) + (let ((v0-2 (-> self control unknown-vector102))) + (set! (-> v0-2 quad) (-> self control trans quad)) + v0-2 + ) + ) + +;; definition for function mod-var-jump +;; Used lq/sq +(defbehavior + mod-var-jump target + ((arg0 symbol) (arg1 symbol) (arg2 symbol) (arg3 vector)) + (local-vars (v0-2 vector)) + (let + ((f30-0 + (* + 0.033333335 + (the float (- (-> *display* base-frame-counter) (-> self state-time))) + ) + ) + ) + (cond + ((or + (< (-> (new 'static 'array float 1 1.0) 0) f30-0) + (< (-> self control unknown-float123) 0.0) + (not arg2) + ) + (set! + (-> self control unknown-float123) + (-> (new 'static 'array float 1 -1.0) 0) + ) + ) + (else + (set! (-> self control unknown-float123) f30-0) + (set! (-> self control unknown-float124) f30-0) + (when arg0 + (let + ((s3-1 + (vector-! + (new-stack-vector0) + (-> self control trans) + (-> self control unknown-vector102) + ) + ) + (s4-0 (new-stack-vector0)) + ) + (let ((f0-5 (vector-dot (-> self control dynam gravity-normal) arg3))) + 0.0 + (vector-! + s4-0 + arg3 + (vector-float*! s4-0 (-> self control dynam gravity-normal) f0-5) + ) + ) + (let* ((f28-0 (vector-length s4-0)) + (f26-0 f28-0) + (f0-13 + (- + (sqrtf + (* + 2.0 + (-> self control dynam gravity-length) + (- + (lerp-scale + (the-as float (-> self control unknown-uint20)) + (the-as float (-> self control unknown-uint30)) + f30-0 + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + (vector-dot (-> self control dynam gravity-normal) s3-1) + ) + ) + ) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + arg3 + (vector-float*! arg3 (-> self control dynam gravity-normal) f0-13) + (vector-float*! s4-0 s4-0 (/ f28-0 f26-0)) + ) + ) + ) + ) + ) + ) + ) + 0 + (when (and arg1 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (and (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + extra + ) + #t + ) + ) + (let ((v1-57 (res-lump-struct (-> (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + extra + ) + 'collide-offset vector :time (ja-frame-num 0) + ) + ) + ) + (cond + (v1-57 + (set! v0-2 (-> self control unknown-vector13)) + (set! (-> v0-2 quad) (-> v1-57 quad)) + ) + (else + (set! v0-2 (-> self control unknown-vector13)) + (set! (-> v0-2 quad) (the-as uint128 0)) + ) + ) + ) + v0-2 + ) + ) + +;; failed to figure out what this is: +(defstate target-duck-stance (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + (set! (-> self control unknown-surface00) *duck-mods*) + (target-collide-set! 'duck (-> (new 'static 'array float 1 1.0) 0)) + (none) + ) + :exit + (behavior () + (if + (not + (or + (= (-> self next-state name) 'target-duck-walk) + (= (-> self next-state name) 'target-duck-stance) + (= (-> self next-state name) 'target-walk) + (= (-> self next-state name) 'target-stance) + (= (-> self next-state name) 'target-stance-look-around) + ) + ) + (target-state-hook-exit) + ) + (target-exit) + (target-collide-set! 'normal (-> (new 'static 'array float 1 0.0) 0)) + (none) + ) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (or + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + ) + (logtest? (-> self state-flags) 8192) + ) + (let ((v1-13 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (and + (not + (or + (= v1-13 (-> self draw art-group data 70)) + (= v1-13 (-> self draw art-group data 69)) + ) + ) + (can-exit-duck?) + ) + ) + ) + (go target-stance) + ) + (if (move-legs?) + (go target-duck-walk) + ) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go + target-high-jump + (-> *TARGET-bank* duck-jump-height-min) + (-> *TARGET-bank* duck-jump-height-max) + 'duck + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + ) + (if (and (can-hands? #t) (can-exit-duck?)) + (go + target-attack-uppercut + (-> *TARGET-bank* attack-jump-height-min) + (-> *TARGET-bank* attack-jump-height-max) + ) + ) + (fall-test) + (slide-down-test) + (none) + ) + :code + (behavior () + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 69) + ) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 70)) + ) + (set! + (-> a0-4 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 70)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! + a0-4 + (the-as art-joint-anim (-> self draw art-group data 70)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 param 0) + (the float (+ (-> a0-5 frame-group data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 32) + ) + (ja-channel-push! 1 30) + ) + (else + (ja-channel-push! 1 12) + (let ((a0-19 (-> self skel root-channel 0))) + (set! + (-> a0-19 frame-group) + (the-as art-joint-anim (-> self draw art-group data 30)) + ) + (set! + (-> a0-19 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 30)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-19 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-19 frame-num) 0.0) + (joint-control-channel-group! + a0-19 + (the-as art-joint-anim (-> self draw art-group data 30)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 param 0) + (the float (+ (-> a0-20 frame-group data 0 length) -1)) + ) + (set! (-> a0-20 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-20 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (while #t + (let ((a0-22 (-> self skel root-channel 0))) + (set! + (-> a0-22 frame-group) + (the-as art-joint-anim (-> self draw art-group data 31)) + ) + (set! + (-> a0-22 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 31)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-22 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-22 frame-num) 0.0) + (joint-control-channel-group! + a0-22 + (the-as art-joint-anim (-> self draw art-group data 31)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-23 (-> self skel root-channel 0))) + (set! + (-> a0-23 param 0) + (the float (+ (-> a0-23 frame-group data 0 length) -1)) + ) + (set! (-> a0-23 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-23 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-duck-walk (target) + :event + target-standard-event-handler + :enter + (behavior () + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + (target-collide-set! 'duck (-> (new 'static 'array float 1 1.0) 0)) + (if (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 69) + ) + ) + (set! (-> self control unknown-surface00) *duck-mods*) + ) + (none) + ) + :exit + (-> target-duck-stance exit) + :trans + (behavior () + ((-> self state-hook)) + (if + (and + (or + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + ) + (logtest? (-> self state-flags) 8192) + (and + (logtest? (-> self water flags) 1024) + (>= + (- + (- + (-> self control trans y) + (- (-> self water base-height) (-> self water wade-height)) + ) + ) + 2457.6 + ) + ) + ) + (can-exit-duck?) + ) + (go target-walk) + ) + (if (not (move-legs?)) + (go target-duck-stance) + ) + (when + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (go + target-high-jump + (-> *TARGET-bank* duck-jump-height-min) + (-> *TARGET-bank* duck-jump-height-max) + 'duck + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + ) + (if (and (can-hands? #t) (can-exit-duck?)) + (go + target-attack-uppercut + (-> *TARGET-bank* attack-jump-height-min) + (-> *TARGET-bank* attack-jump-height-max) + ) + ) + (fall-test) + (slide-down-test) + (none) + ) + :code + (behavior () + (cond + ((and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 32) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + (ja-channel-push! 1 135) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 32)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + ) + (else + (ja-channel-push! 1 30) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 32)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + ) + ) + (while #t + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (set! (-> self control unknown-surface00) *duck-mods*) + ) + (let ((a0-18 (-> self skel root-channel 0))) + (set! + (-> a0-18 param 0) + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (/ + (-> self control unknown-float01) + (* + 60.0 + (/ + (-> *TARGET-bank* duck-walk-cycle-dist) + (-> *TARGET-bank* run-cycle-length) + ) + ) + ) + ) + ) + (joint-control-channel-group-eval! + a0-18 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (suspend) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (when (= (-> self control unknown-symbol40) 'launch) + (level-hint-spawn + (game-text-id daxter-screaming-jump) + "sksp009d" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id daxter-wahoo-jump) + "sksp009e" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (case (-> (level-get-target-inside *level*) name) + (('citadel) + (level-hint-spawn + (game-text-id daxter-land-on-the-next-launcher) + "sksp0393" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (level-hint-spawn + (game-text-id daxter-dont-miss-the-next-launcher) + "sksp0388" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + enter-state + (let ((a0-9 (-> self control unknown-dword60)) + (a1-5 (-> self control unknown-dword61)) + (a2-5 (-> self control unknown-vector102)) + ) + (set! + (-> a2-5 quad) + (-> (the-as vector (-> self control unknown-dword62)) quad) + ) + (go + target-launch + (the-as float a0-9) + (the-as symbol a1-5) + a2-5 + (-> self control unknown-dword63) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (sound-play-by-name (static-sound-name "jump") (new-sound-id) 716 0 0 1 #t) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #t) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! arg2 (cond + (arg2 + (empty) + arg2 + ) + (else + *jump-mods* + ) + ) + ) + (set! (-> self control unknown-surface00) arg2) + (set! + (-> self control unknown-float123) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.00004359654 (+ -11468.8 (-> self control unknown-float01))) + ) + ) + ) + (set! + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01))) + ) + ) + ) + (none) + ) + :exit + target-exit + :trans + (behavior () + (set! + (-> self control unknown-float123) + (fmax + (-> self control unknown-float123) + (* + 0.003921569 + (the + float + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + abutton + 6 + ) + ) + ) + ) + ) + (target-falling-trans + #f + (the-as cpad-list (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + 15 + -1 + ) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 12288.0 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (zero? (logand (-> self water flags) 512)) + (zero? (logand (-> self state-flags) 2048)) + ) + ) + (go + target-double-jump + (-> *TARGET-bank* double-jump-height-min) + (-> *TARGET-bank* double-jump-height-max) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 26624.0 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (go + target-flop + (the-as float 65502.96) + (the-as float -163840.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + (slide-down-test) + (set! + (-> self control unknown-float122) + (seek + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01))) + ) + ) + (-> *display* seconds-per-frame) + ) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 surface)) + (ja-channel-push! 2 15) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (let ((a0-3 (-> self skel root-channel 1))) + (set! (-> a0-3 frame-interp) (-> self control unknown-float122)) + (set! + (-> a0-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 40)) + ) + (set! (-> a0-3 param 0) 0.0) + (joint-control-channel-group-eval! + a0-3 + (the-as art-joint-anim (-> self draw art-group data 40)) + num-func-chan + ) + ) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! (-> a0-4 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-+! + ) + ) + (let ((a0-5 (-> self skel root-channel 1))) + (set! (-> a0-5 frame-interp) (-> self control unknown-float122)) + (set! + (-> a0-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 40)) + ) + (set! (-> a0-5 param 0) 0.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim (-> self draw art-group data 40)) + num-func-chan + ) + ) + (suspend) + (until (ja-done? 0) + (let + ((f30-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (f0-8 (- 20.0 (ja-aframe-num 0))) + (gp-1 (-> self skel root-channel 0)) + ) + (set! + (-> gp-1 param 0) + (the float (+ (-> gp-1 frame-group data 0 length) -1)) + ) + (let ((v1-45 (and (< 0.0 f30-0) (< 0.0 f0-8)))) + (set! (-> gp-1 param 1) (if v1-45 + (fmin + (fmin + (-> (new 'static 'array float 1 3.0) 0) + f0-8 + ) + (/ + (* 5.0 f0-8) + (the + float + (time-to-apex f30-0 (the-as float -245760.0)) + ) + ) + ) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-10 (-> self skel root-channel 1))) + (set! (-> a0-10 frame-interp) (-> self control unknown-float122)) + (set! (-> a0-10 param 0) 0.0) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (suspend) + ) + (target-falling-anim -1 60) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-jump-forward (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + ((-> target-jump enter) arg0 arg1 (the-as surface #f)) + (set! (-> self control unknown-surface00) *forward-jump-mods*) + (none) + ) + :exit + target-exit + :trans + (-> target-jump trans) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-set! 1) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 34)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! + (-> gp-0 frame-num) + (ja-aframe (-> (new 'static 'array float 1 3.0) 0) 0) + ) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (set! (-> self control unknown-dword70) 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-6 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-6 frame-num) 0.0) + (joint-control-channel-group! + a0-6 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-7 (-> self skel root-channel 0))) + (set! + (-> a0-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-7 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-7 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-double-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (when (= (-> self control unknown-symbol40) 'launch) + enter-state + (let ((a0-3 (-> self control unknown-dword60)) + (a1-1 (-> self control unknown-dword61)) + (a2-0 (-> self control unknown-vector102)) + ) + (set! + (-> a2-0 quad) + (-> (the-as vector (-> self control unknown-dword62)) quad) + ) + (go + target-launch + (the-as float a0-3) + (the-as symbol a1-1) + a2-0 + (-> self control unknown-dword63) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #t) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *double-jump-mods*) + (none) + ) + :exit + target-exit + :trans + (behavior () + (target-falling-trans + #f + (the-as cpad-list (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + 15 + -1 + ) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 22118.4 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (go + target-flop + (the-as float 33775.48) + (the-as float -122880.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (if (!= (-> self state-time) (-> *display* base-frame-counter)) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + ) + (set! + (-> self control unknown-float122) + (seek + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.000048828126 (+ -10240.0 (-> self control unknown-float01))) + ) + ) + (-> *display* seconds-per-frame) + ) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 2 15) + (dummy-10 + (-> self skel effect) + 'jump-double + (-> (new 'static 'array float 1 -1.0) 0) + -1 + ) + (let ((gp-0 (-> self skel root-channel 0))) + (set! + (-> gp-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 34)) + ) + (set! + (-> gp-0 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 34)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> gp-0 frame-num) (ja-aframe (the-as float 5.0) 0)) + (joint-control-channel-group! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 34)) + num-func-seek! + ) + ) + (let ((a0-5 (-> self skel root-channel 1))) + (set! + (-> a0-5 frame-group) + (the-as art-joint-anim (-> self draw art-group data 40)) + ) + (set! (-> a0-5 param 0) 0.0) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim (-> self draw art-group data 40)) + num-func-chan + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-6 (-> self skel root-channel 0))) + (set! + (-> a0-6 param 0) + (the float (+ (-> a0-6 frame-group data 0 length) -1)) + ) + (set! (-> a0-6 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-6 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((a0-7 (-> self skel root-channel 1))) + (set! (-> a0-7 frame-interp) (-> self control unknown-float122)) + (set! (-> a0-7 param 0) 0.0) + (joint-control-channel-group-eval! + a0-7 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + ) + (target-falling-anim -1 60) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-high-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 basic)) + (when (and (= (-> self control unknown-symbol40) 'launch) (!= arg2 'launch)) + enter-state + (let ((a0-3 (-> self control unknown-dword60)) + (a1-1 (-> self control unknown-dword61)) + (a2-1 (-> self control unknown-vector102)) + ) + (set! + (-> a2-1 quad) + (-> (the-as vector (-> self control unknown-dword62)) quad) + ) + (go + target-launch + (the-as float a0-3) + (the-as symbol a1-1) + a2-1 + (-> self control unknown-dword63) + ) + ) + ) + (set! (-> self control unknown-uint31) (the-as uint arg2)) + (if (or (= arg2 'duck) (= arg2 'launch)) + (go target-duck-high-jump arg0 arg1 (the-as symbol arg2)) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (sound-play-by-name + (static-sound-name "jump") + (new-sound-id) + 1024 + 457 + 0 + 1 + #t + ) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #t) + (-> self control transv) + ) + (set! (-> self control unknown-surface00) (cond + ((= arg2 'flip) + *flip-jump-mods* + ) + ((= arg2 'flop-forward) + *forward-high-jump-mods* + ) + (else + *high-jump-mods* + ) + ) + ) + (set! + (-> self control unknown-float122) + (fmax + 0.0 + (fmin 0.5 (* 0.00008138021 (+ -409.6 (-> self control unknown-float01)))) + ) + ) + (none) + ) + :exit + target-exit + :trans + (behavior () + (target-falling-trans + #f + (the-as cpad-list (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + 15 + -1 + ) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 73728.0 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (go + target-flop + (the-as float 33775.48) + (the-as float -122880.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + (set! + (-> self control unknown-float122) + (seek + (-> self control unknown-float122) + (fmax + 0.0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (* 0.00012207031 (+ -2048.0 (-> self control unknown-float01))) + ) + ) + (-> *display* seconds-per-frame) + ) + ) + (none) + ) + :code + (-> target-jump code) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-duck-high-jump (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (none) + ) + :exit + target-exit + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (if (not (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + (ja-channel-push! 1 12) + ) + (case arg2 + (('launch) + (let ((s3-0 (-> self skel root-channel 0))) + (set! + (-> s3-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 42)) + ) + (set! (-> s3-0 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s3-0 frame-num) 0.0) + (joint-control-channel-group! + s3-0 + (the-as art-joint-anim (-> self draw art-group data 42)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s3-1 (-> self skel root-channel 0))) + (set! (-> s3-1 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + s3-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (else + (let ((s3-2 (-> self skel root-channel 0))) + (set! + (-> s3-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 41)) + ) + (set! (-> s3-2 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s3-2 frame-num) 0.0) + (joint-control-channel-group! + s3-2 + (the-as art-joint-anim (-> self draw art-group data 41)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s3-3 (-> self skel root-channel 0))) + (set! (-> s3-3 param 0) (ja-aframe (the-as float 16.0) 0)) + (set! (-> s3-3 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + s3-3 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + ) + (go target-duck-high-jump-jump arg0 arg1 arg2) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-duck-high-jump-jump (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (sound-play-by-name + (static-sound-name "jump") + (new-sound-id) + 819 + -609 + 0 + 1 + #t + ) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (cond + ((= arg2 'launch) + (set! (-> self neck flex-blend) 0.0) + (set! (-> self control unknown-surface00) *launch-jump-mods*) + ) + (else + (set! (-> self control unknown-surface00) *high-jump-mods*) + ) + ) + (none) + ) + :exit + target-exit + :trans + (-> target-high-jump trans) + :code + (behavior ((arg0 float) (arg1 float) (arg2 symbol)) + (let ((f30-0 (the-as float (if (= arg2 'launch) + 110.0 + 35.0 + ) + ) + ) + (f28-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (until (ja-done? 0) + (let* + ((f24-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (f26-0 (- f30-0 (ja-aframe-num 0))) + (f22-1 + (fmin + (fmin (-> (new 'static 'array float 1 3.0) 0) f26-0) + (/ + (* 5.0 f26-0) + (the float (time-to-apex f24-0 (the-as float -245760.0))) + ) + ) + ) + (s5-0 (-> self skel root-channel 0)) + ) + (set! + (-> s5-0 param 0) + (the float (+ (-> s5-0 frame-group data 0 length) -1)) + ) + (let ((v1-26 (cond + ((and (< 0.0 f24-0) (< 0.0 f26-0)) + (if (= arg2 'launch) + (set! + f28-0 + (lerp f28-0 (* 4.0 f22-1) (the-as float 0.25)) + ) + ) + f22-1 + ) + (else + f28-0 + ) + ) + ) + ) + (set! (-> s5-0 param 1) v1-26) + ) + (joint-control-channel-group-eval! + s5-0 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (suspend) + ) + (cond + ((= arg2 'launch) + (let ((a0-7 (-> self skel root-channel 0))) + (set! + (-> a0-7 frame-group) + (the-as art-joint-anim (-> self draw art-group data 43)) + ) + (set! (-> a0-7 param 0) f28-0) + (set! (-> a0-7 frame-num) 0.0) + (joint-control-channel-group! + a0-7 + (the-as art-joint-anim (-> self draw art-group data 43)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-8 (-> self skel root-channel 0))) + (set! + (-> a0-8 frame-group) + (the-as art-joint-anim (-> self draw art-group data 43)) + ) + (set! (-> a0-8 param 0) f28-0) + (joint-control-channel-group-eval! + a0-8 + (the-as art-joint-anim (-> self draw art-group data 43)) + num-func-loop! + ) + ) + ) + ) + (else + (let ((a0-9 (-> self skel root-channel 0))) + (set! + (-> a0-9 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-9 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-9 frame-num) 0.0) + (joint-control-channel-group! + a0-9 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + (while #t + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! + (-> a0-10 frame-group) + (the-as art-joint-anim (-> self draw art-group data 38)) + ) + (set! (-> a0-10 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-loop! + ) + ) + ) + ) + ) + ) + (the-as none 0) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-falling (target) + :event + target-jump-event-handler + :enter + (behavior ((arg0 symbol)) + (set! (-> self control unknown-surface00) *jump-mods*) + (set! (-> self control unknown-uint20) (the-as uint arg0)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (none) + ) + :trans + (behavior () + (target-falling-trans + (-> self control unknown-spoolanim00) + (the-as cpad-list (if (= (-> self control unknown-spoolanim00) #f) + 0 + (/ (the-as int (-> *TARGET-bank* stuck-time)) 2) + ) + ) + ) + (none) + ) + :code + (behavior ((arg0 symbol)) + (target-falling-anim -1 99) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-hit-ground (target) + :event + target-walk-event-handler + :enter + (behavior ((arg0 symbol)) + (cond + ((= arg0 'stuck) + ) + ((let ((v1-4 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-4 (-> self draw art-group data 42)) + (= v1-4 (-> self draw art-group data 43)) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-blue-hit-ground-effect + (-> (new 'static 'array float 1 0.0) 0) + -1 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 90) + ) + (else + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector52) + (-> self control trans) + ) + ) + ) + ) + (if + (and + (< (-> *TARGET-bank* fall-far) f0-1) + (zero? (logand (-> self control status) 1024)) + ) + (go target-hit-ground-hard f0-1) + ) + ) + ) + ) + (cond + ((= arg0 'stuck) + ) + (else + (target-land-effect) + ) + ) + (set! (-> self control unknown-dword31) 0) + (set! (-> self control unknown-dword33) 0) + (if + (>= + (-> self control ground-impact-vel) + (-> *TARGET-bank* fall-stumble-threshold) + ) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + ) + (if (!= (-> self control ground-pat material) (pat-material ice)) + (delete-back-vel) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (start-bobbing! + (-> self water) + (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (the-as float 4096.0) + (-> self control ground-impact-vel) + (the-as float 40960.0) + (-> (new 'static 'array float 1 102400.0) 0) + ) + 600 + 1500 + ) + (none) + ) + :trans + (behavior () + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (if (and (not (can-exit-duck?)) (can-duck?)) + (go target-duck-stance) + ) + (when + (!= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (if (logtest? (-> self water flags) 1024) + (go target-wade-walk) + (go target-walk) + ) + ) + (if + (and + (or + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons l1 r1) + ) + (not (can-exit-duck?)) + ) + (can-duck?) + ) + (go target-duck-stance) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack) + ) + (if (can-hands? #t) + (go target-running-attack) + ) + (fall-test) + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 symbol)) + (target-hit-ground-anim #f) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-attack (target) + :event + target-dangerous-event-handler + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (target-start-attack) + (target-danger-set! 'spin #f) + (set! (-> self control unknown-surface00) *attack-mods*) + (set! (-> self water drip-mult) 4.0) + (set! (-> self neck flex-blend) 0.0) + (none) + ) + :exit + (behavior () + (set! (-> self control unknown-dword33) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :code + (behavior () + (ja-channel-push! 1 15) + (let ((a0-1 (-> self skel root-channel 0))) + (set! + (-> a0-1 frame-group) + (the-as art-joint-anim (-> self draw art-group data 51)) + ) + (set! + (-> a0-1 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 51)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-1 param 1) (-> self control unknown-surface01 align-speed)) + (set! (-> a0-1 frame-num) 0.0) + (joint-control-channel-group! + a0-1 + (the-as art-joint-anim (-> self draw art-group data 51)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + 74 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + (level-hint-spawn + (game-text-id red-eco-tutorial) + "sksp0072" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-jump + (-> *TARGET-bank* jump-height-min) + (-> *TARGET-bank* jump-height-max) + (the-as surface #f) + ) + ) + (suspend) + (let ((a0-24 (-> self skel root-channel 0))) + (set! + (-> a0-24 param 0) + (the float (+ (-> a0-24 frame-group data 0 length) -1)) + ) + (set! (-> a0-24 param 1) (-> self control unknown-surface01 align-speed)) + (joint-control-channel-group-eval! + a0-24 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-running-attack (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (cond + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 224) + ) + (let + ((gp-1 + (target-send-attack + arg0 + (the-as uint (-> self control unknown-symbol30)) + (-> arg3 param 0) + (-> self control unknown-dword50) + (-> self control unknown-dword51) + ) + ) + ) + (when gp-1 + (set! + (-> self control unknown-uint20) + (the-as uint (-> *display* base-frame-counter)) + ) + (let + ((v1-9 + (if + (and (nonzero? arg0) (type-type? (-> arg0 type) process-drawable)) + arg0 + ) + ) + ) + (when v1-9 + (let* ((s5-1 (-> (the-as process-drawable v1-9) root)) + (v1-11 + (if + (and + (nonzero? s5-1) + (type-type? (-> s5-1 type) collide-shape) + ) + (the-as collide-shape s5-1) + ) + ) + ) + (if + (and + v1-11 + (or + (logtest? (-> v1-11 root-prim prim-core collide-as) 256) + (logtest? (-> v1-11 root-prim prim-core action) 1024) + ) + ) + (set! (-> self control unknown-uint31) (the-as uint 1)) + ) + ) + ) + ) + (when (or (= gp-1 'die) (= gp-1 'push)) + (let ((v0-2 (the-as object (-> *display* base-frame-counter)))) + (set! (-> self control unknown-int21) (the-as int v0-2)) + v0-2 + ) + ) + ) + ) + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior () + (if + (or + (and + (= (-> self fact-info-target eco-type) 1) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (< + (- (-> *display* base-frame-counter) (-> self control unknown-dword82)) + 450 + ) + ) + (go target-yellow-blast) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control unknown-int21) 0) + (set! (-> self control unknown-uint31) (the-as uint 0)) + (set! (-> self control unknown-surface00) *run-attack-mods*) + (set! (-> *run-attack-mods* turnv) 655360.0) + (set! (-> *run-attack-mods* turnvv) 655360.0) + (target-start-attack) + (target-danger-set! 'punch #f) + (if + (or + (< (fabs (-> self control unknown-float62)) 0.3) + (< 0.3 (fabs (-> self control unknown-float61))) + ) + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (none) + ) + :exit + (behavior () + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (set! (-> *run-attack-mods* turnv) 0.0) + (set! (-> *run-attack-mods* turnvv) 0.0) + (set! (-> self control unknown-dword31) (-> *display* base-frame-counter)) + (target-exit) + (none) + ) + :trans + (behavior () + (when (!= (-> self state-time) (-> *display* base-frame-counter)) + (if + (and + (or + (smack-surface? #t) + (and + (>= (-> self control unknown-float63) 0.7) + (zero? (logand (-> self control status) 32)) + ) + ) + (begin + (set! (-> self control unknown-int21) (-> *display* base-frame-counter)) + (set! (-> self control unknown-float81) 0.0) + (let ((gp-0 (new-stack-vector0)) + (f30-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-0 + (-> self control transv) + (vector-float*! gp-0 (-> self control dynam gravity-normal) f30-0) + ) + (let* ((f0-5 (vector-length gp-0)) + (f1-1 f0-5) + (f2-1 (fmin 0.0 f30-0)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-1 + ) + (vector-float*! gp-0 gp-0 (/ f0-5 f1-1)) + ) + ) + ) + #t + ) + (or + (zero? (-> self control unknown-uint20)) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 12) + ) + ) + (!= (-> self control unknown-uint31) 1) + ) + (target-shoved + (-> *TARGET-bank* smack-surface-dist) + (-> *TARGET-bank* smack-surface-height) + (the-as process #f) + (the-as (state target) target-hit) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (and + (< 4096.0 (-> self control unknown-float01)) + (or + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons square) + ) + ) + ) + (zero? (logand (-> self state-flags) 6144)) + (zero? (logand (-> self control unknown-surface01 flags) 128)) + ) + ) + (go + target-attack-uppercut + (-> *TARGET-bank* attack-jump-height-min) + (-> *TARGET-bank* attack-jump-height-max) + ) + ) + (if + (and + (logtest? (-> self water flags) 512) + (zero? + (mod (- (-> *display* base-frame-counter) (-> self state-time)) 21) + ) + ) + (dummy-13 + (-> self water) + (the-as float 0.6) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data 37) + ) + 0 + (-> self control transv) + ) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + 23 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + (level-hint-spawn + (game-text-id red-eco-tutorial) + "sksp0072" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + ) + (none) + ) + :code + (behavior () + (if (logtest? (-> self water flags) 512) + (sound-play-by-name + (static-sound-name "swim-stroke") + (new-sound-id) + 1024 + 0 + 0 + 1 + #t + ) + ) + (ja-channel-push! 1 6) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 59)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (set! (-> self control dynam gravity-max) 368640.0) + (set! (-> self control dynam gravity-length) 368640.0) + (let ((f28-0 0.0) + (f30-0 (-> (new 'static 'array float 1 1.0) 0)) + (gp-2 0) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and + (>= (ja-aframe-num 0) 20.0) + (and + (and + (zero? (logand (-> self control status) 1)) + (>= + (- + (-> *display* base-frame-counter) + (-> self control unknown-dword11) + ) + (the-as int (-> *TARGET-bank* ground-timeout)) + ) + (>= + 0.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (let ((v1-39 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (not + (or + (= v1-39 (-> self draw art-group data 59)) + (= v1-39 (-> self draw art-group data 60)) + (= v1-39 (-> self draw art-group data 61)) + ) + ) + (< 4096.0 (target-height-above-ground)) + ) + ) + ) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 12) + ) + ) + ) + (go target-falling #f) + ) + ((and + (nonzero? (-> self control unknown-uint30)) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint30)) + ) + ) + (the-as uint 12) + ) + ) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + ) + ((and + (zero? + (logand + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons square) + ) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 15) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set-forward-vel + (fmax 32768.0 (* 0.8 (-> self control unknown-float01))) + ) + (set-forward-vel (* 0.8 (-> self control unknown-float01))) + ) + ) + ((ja-done? 0) + (set-forward-vel f28-0) + ) + (else + (set! + f28-0 + (* + (target-align-vel-z-adjust (-> self align delta trans z)) + (-> *display* frames-per-second) + f30-0 + ) + ) + (set-forward-vel f28-0) + ) + ) + ) + (let ((s5-1 (new-stack-vector0))) + (vector-matrix*! + s5-1 + (-> self control transv) + (-> self control unknown-matrix00) + ) + (set! (-> s5-1 y) 0.0) + (vector-matrix*! + (-> self control unknown-vector120) + s5-1 + (-> self control unknown-matrix01) + ) + ) + (suspend) + (let ((a0-44 (-> self skel root-channel 0))) + (set! + (-> a0-44 param 0) + (the float (+ (-> a0-44 frame-group data 0 length) -1)) + ) + (set! (-> a0-44 param 1) (-> self control unknown-surface01 align-speed)) + (joint-control-channel-group-eval! + a0-44 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 30) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (if (< 2 gp-2) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + ) + (+! gp-2 1) + ) + ) + (if + (and + (zero? (logand (-> self control status) 1)) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword11)) + (the-as int (-> *TARGET-bank* ground-timeout)) + ) + (>= + 0.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (let ((v1-121 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (not + (or + (= v1-121 (-> self draw art-group data 59)) + (= v1-121 (-> self draw art-group data 60)) + (= v1-121 (-> self draw art-group data 61)) + ) + ) + (< 4096.0 (target-height-above-ground)) + ) + ) + ) + (go target-falling #f) + ) + (go target-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-attack-air (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter + (behavior ((arg0 symbol)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (target-start-attack) + (target-danger-set! 'spin-air #f) + (set! (-> self control unknown-surface00) *jump-attack-mods*) + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (cond + ((or (>= 0.0 f0-1) (= arg0 'flop)) + (let ((gp-1 (new-stack-vector0))) + (let + ((f0-3 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-1 + (-> self control transv) + (vector-float*! gp-1 (-> self control dynam gravity-normal) f0-3) + ) + ) + (let* ((f0-4 (vector-length gp-1)) + (f1-2 f0-4) + (f2-0 33775.48) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-1 gp-1 (/ f0-4 f1-2)) + ) + ) + ) + ) + (else + (let* + ((f1-5 + (/ + f0-1 + (* + (-> self control dynam gravity-length) + (-> *display* seconds-per-frame) + ) + ) + ) + (f30-0 (* 0.5 f1-5 (-> *display* seconds-per-frame) f0-1)) + ) + (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 62) + ) + (set! + f30-0 + (fmax + 0.0 + (- + (-> *TARGET-bank* attack-jump-height-max) + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control trans) + (-> self control unknown-vector52) + ) + ) + ) + ) + ) + ) + (let ((gp-2 (new-stack-vector0))) + (let + ((f0-8 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-2 + (-> self control transv) + (vector-float*! gp-2 (-> self control dynam gravity-normal) f0-8) + ) + ) + (let* ((f0-9 (vector-length gp-2)) + (f1-11 f0-9) + (f2-7 (+ 1024.0 (sqrtf (* 245760.0 (+ 2048.0 f30-0))))) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-7 + ) + (vector-float*! gp-2 gp-2 (/ f0-9 f1-11)) + ) + ) + ) + ) + ) + ) + ) + (set! (-> self control dynam gravity-length) 122880.0) + (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) + (none) + ) + :exit + (behavior () + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + ((-> target-attack exit)) + (none) + ) + :trans + (behavior () + (when (logtest? (-> self control status) 1) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (go target-hit-ground #f) + ) + (if (>= (- (-> *display* base-frame-counter) (-> self state-time)) 150) + (set! + (-> self control dynam gravity-length) + (seek + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + (* 245760.0 (-> *display* seconds-per-frame)) + ) + ) + ) + (when + (and + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 15) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control unknown-vector10) + ) + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 70) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + (level-hint-spawn + (game-text-id red-eco-tutorial) + "sksp0072" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + ) + (none) + ) + :code + (behavior ((arg0 symbol)) + (ja-channel-push! 1 22) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 56)) + ) + (set! + (-> a0-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 56)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 56)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (TODO-RENAME-9 (-> self align)) + (TODO-RENAME-10 + (-> self align) + 16 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + ) + (suspend) + (let ((a0-5 (-> self skel root-channel 0))) + (set! + (-> a0-5 param 0) + (the float (+ (-> a0-5 frame-group data 0 length) -1)) + ) + (set! (-> a0-5 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-5 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (let ((gp-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim (-> self draw art-group data 57)) + num-func-identity + ) + (set! (-> gp-0 frame-num) 0.0) + ) + (let ((f30-0 393216.0)) + (let ((f0-8 (target-height-above-ground)) + (f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + (while + (not + (or + (and (< (fabs (/ f0-8 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 510) + ) + ) + (quaternion-rotate-y! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion00) + (* f30-0 (-> *display* seconds-per-frame)) + ) + (suspend) + (let ((a0-10 (-> self skel root-channel 0))) + (set! (-> a0-10 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-10 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + (set! f0-8 (target-height-above-ground)) + (set! + f1-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + ) + (let ((a0-13 (-> self skel root-channel 0))) + (set! + (-> a0-13 frame-group) + (the-as art-joint-anim (-> self draw art-group data 58)) + ) + (set! + (-> a0-13 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 58)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-13 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-13 frame-num) 0.0) + (joint-control-channel-group! + a0-13 + (the-as art-joint-anim (-> self draw art-group data 58)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (cond + ((< (ja-aframe-num 0) 32.0) + (quaternion-rotate-y! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion00) + (* f30-0 (-> *display* seconds-per-frame)) + ) + ) + (else + (let + ((f0-22 + (deg-diff + (quaternion-y-angle (-> self control unknown-quaternion00)) + (quaternion-y-angle (-> self control dir-targ)) + ) + ) + ) + (quaternion-rotate-y! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion00) + (* 0.2 (fabs f0-22)) + ) + ) + ) + ) + (suspend) + (let ((a0-20 (-> self skel root-channel 0))) + (set! + (-> a0-20 param 0) + (the float (+ (-> a0-20 frame-group data 0 length) -1)) + ) + (set! (-> a0-20 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-20 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + ) + (go target-falling #f) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-attack-uppercut (target) + :event + target-dangerous-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (target-start-attack) + (target-danger-set! 'uppercut #f) + (set! (-> self control unknown-surface00) *turn-around-mods*) + (none) + ) + :exit + target-exit + :code + (behavior ((arg0 float) (arg1 float)) + (let ((s3-0 (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 31) + ) + ) + (s4-0 (-> self skel root-channel 0)) + ) + (set! + (-> s4-0 frame-group) + (the-as art-joint-anim (-> self draw art-group data 62)) + ) + (set! (-> s4-0 param 0) (ja-aframe (the-as float 7.0) 0)) + (set! (-> s4-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> s4-0 frame-num) (if s3-0 + (ja-aframe (the-as float 5.0) 0) + (-> (new 'static 'array float 1 0.0) 0) + ) + ) + (joint-control-channel-group! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 62)) + num-func-seek! + ) + ) + (until (ja-done? 0) + (suspend) + (let ((s4-1 (-> self skel root-channel 0))) + (set! (-> s4-1 param 0) (ja-aframe (the-as float 7.0) 0)) + (set! (-> s4-1 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (go target-attack-uppercut-jump arg0 arg1) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-attack-uppercut-jump (target) + :event + target-dangerous-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (if + (and + (= (-> self control ground-pat material) (pat-material ice)) + (< 32768.0 (-> self control unknown-float01)) + ) + (set-forward-vel (the-as float 32768.0)) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (init-var-jump + arg0 + arg1 + (the-as vector #t) + (the-as vector #f) + (-> self control transv) + ) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *uppercut-jump-mods*) + (target-start-attack) + (target-danger-set! 'uppercut #f) + (none) + ) + :exit + target-exit + :trans + (behavior () + (if (logtest? (-> self control status) 1) + (go target-hit-ground #f) + ) + (when + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + 22118.4 + ) + (and + (< + -61440.0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + (>= + (- (-> *display* base-frame-counter) (-> self control unknown-dword36)) + (the-as int (-> *TARGET-bank* stuck-timeout)) + ) + (zero? (logand (-> self state-flags) 4096)) + (zero? (logand (-> self control unknown-surface01 flags) 384)) + ) + ) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (build-conversions (-> self control transv)) + (go + target-flop + (the-as float 65502.96) + (the-as float -163840.0) + (the-as + float + (if + (= + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + stick0-speed + ) + 0.0 + ) + (-> (new 'static 'array float 1 0.0) 0) + 68812.8 + ) + ) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 62) + ) + (>= (ja-aframe-num 0) 12.0) + ) + (go target-attack-air 'uppercut) + ) + (mod-var-jump + #t + #t + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons x) + ) + (-> self control transv) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 23) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + ) + (if + (and + (= (-> self control unknown-symbol30) 'uppercut) + (< + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + -8192.0 + ) + ) + (target-danger-set! 'harmless #f) + ) + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (TODO-RENAME-9 (-> self align)) + (until (ja-done? 0) + (suspend) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 param 0) + (the float (+ (-> a0-2 frame-group data 0 length) -1)) + ) + (set! (-> a0-2 param 1) 0.9) + (joint-control-channel-group-eval! + a0-2 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (TODO-RENAME-9 (-> self align)) + (let* ((gp-0 (-> self align)) + (s5-0 (method-of-object gp-0 TODO-RENAME-10)) + (a1-2 (cond + ((>= 30.0 (ja-aframe-num 0)) + 18 + ) + ((>= 43.0 (ja-aframe-num 0)) + (set! (-> self control unknown-surface00) *double-jump-mods*) + 2 + ) + (else + 0 + ) + ) + ) + ) + (s5-0 + gp-0 + a1-2 + (-> (new 'static 'array float 1 1.0) 0) + (the-as float 0.95) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + ) + (go target-falling #f) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-flop (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + (cond + (v0-0 + (empty) + v0-0 + ) + ((let ((v1-0 arg2)) + (= v1-0 'swim) + ) + (cond + ((< 6144.0 (target-height-above-ground)) + (dummy-10 + (-> self skel effect) + 'swim-flop + (-> (new 'static 'array float 1 -1.0) 0) + -1 + ) + (let ((t9-3 enter-state)) + (set! (-> self next-state) target-swim-down) + ((the-as (function object :behavior target) t9-3)) + ) + ) + (else + (let ((t9-4 enter-state) + (a0-4 'swim) + ) + (set! (-> self next-state) target-flop-hit-ground) + ((the-as (function symbol object :behavior target) t9-4) a0-4) + ) + ) + ) + ) + (else + (target-dangerous-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + :enter + (behavior ((arg0 float) (arg1 float) (arg2 float)) + (if + (and + (= (-> self fact-info-target eco-type) 1) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (go target-yellow-jump-blast) + ) + (if (= arg2 0.0) + (set-forward-vel arg2) + (set-forward-vel (-> self control unknown-float01)) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control status) (logand -8 (-> self control status))) + (set! (-> self control unknown-surface00) *flop-mods*) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control dynam gravity-max) 245760.0) + (set! (-> self control dynam gravity-length) 245760.0) + (let ((gp-1 (new-stack-vector0))) + (let + ((f0-6 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-1 + (-> self control transv) + (vector-float*! gp-1 (-> self control dynam gravity-normal) f0-6) + ) + ) + (let* ((f0-7 (vector-length gp-1)) + (f1-3 f0-7) + (f2-0 29491.2) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-1 gp-1 (/ f0-7 f1-3)) + ) + ) + ) + (none) + ) + :exit + (behavior () + (target-danger-set! 'harmless #f) + (set! + (-> self control dynam gravity-max) + (-> self control unknown-dynamics00 gravity-max) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (set! + (-> self control dynam gravity quad) + (-> self control unknown-dynamics00 gravity quad) + ) + (none) + ) + :trans + (behavior () + (delete-back-vel) + (let ((gp-1 (logtest? (-> self control status) 1))) + (when (and (not gp-1) (let ((v1-6 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (or + (= v1-6 (-> self draw art-group data 64)) + (= v1-6 (-> self draw art-group data 66)) + ) + ) + ) + (when + (and + (or + (< (target-move-dist 30) 1638.4) + (and + (logtest? (-> self control status) 8) + (< 0.7 (-> self control poly-angle)) + ) + ) + (zero? (logand (-> self control status) 32)) + (>= (-> self control unknown-uint20) (the-as uint 2)) + ) + (set! (-> self control unknown-dword36) (-> *display* base-frame-counter)) + (set! gp-1 'stuck) + ) + ) + (when gp-1 + (logior! (-> self control status) 1) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 150) + (dummy-10 + (-> self skel effect) + 'group-red-eco-strike-ground + (ja-frame-num 0) + 0 + ) + (let* ((s4-1 (get-process *default-dead-pool* touch-tracker #x4000)) + (s5-1 (when s4-1 + (let ((t9-6 (method-of-type touch-tracker activate))) + (t9-6 + (the-as touch-tracker s4-1) + self + 'touch-tracker + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s4-1 + touch-tracker-init + (-> self control trans) + 4096.0 + 30 + ) + (-> s4-1 ppointer) + ) + ) + ) + (send-event (ppointer->process s5-1) 'event 'attack 'flop) + (send-event (ppointer->process s5-1) 'function (lambda ((arg0 target)) + (let + ((f0-3 + (seek + (-> + arg0 + control + root-prim + local-sphere + w + ) + (the-as + float + 28672.0 + ) + (* + 286720.0 + (-> + *display* + seconds-per-frame + ) + ) + ) + ) + ) + (set! + (-> + arg0 + control + root-prim + local-sphere + w + ) + f0-3 + ) + f0-3 + ) + ) + ) + ) + ) + (go target-flop-hit-ground gp-1) + ) + ) + (when + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + (if (rand-vu-percent? (the-as float 0.5)) + 23 + 17 + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + ) + (when + (and + (not (-> self control unknown-symbol30)) + (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 63) + ) + (>= (ja-aframe-num 0) 8.0) + ) + (target-start-attack) + (target-danger-set! 'flop #f) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float) (arg2 float)) + (ja-channel-set! 2) + (let ((a0-2 (-> self skel root-channel 0))) + (set! + (-> a0-2 frame-group) + (the-as art-joint-anim (-> self draw art-group data 63)) + ) + (set! + (-> a0-2 param 0) + (the + float + (+ + (-> + (the-as art-joint-anim (-> self draw art-group data 63)) + data + 0 + length + ) + -1 + ) + ) + ) + (set! (-> a0-2 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (set! (-> a0-2 frame-num) 0.0) + (joint-control-channel-group! + a0-2 + (the-as art-joint-anim (-> self draw art-group data 63)) + num-func-seek! + ) + ) + (let ((a0-3 (-> self skel root-channel 1))) + (set! + (-> a0-3 frame-group) + (the-as art-joint-anim (-> self draw art-group data 66)) + ) + (set! (-> a0-3 param 0) 0.0) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group-eval! + a0-3 + (the-as art-joint-anim (-> self draw art-group data 66)) + num-func-chan + ) + ) + (until (ja-done? 0) + (suspend) + (let ((a0-4 (-> self skel root-channel 0))) + (set! + (-> a0-4 param 0) + (the float (+ (-> a0-4 frame-group data 0 length) -1)) + ) + (set! (-> a0-4 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-4 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (let ((gp-0 (-> self skel root-channel 1))) + (set! + (-> gp-0 frame-interp) + (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float01) + (-> (new 'static 'array float 1 0.0) 0) + (the-as float 40960.0) + ) + ) + (set! + (-> gp-0 param 0) + (the float (+ (-> gp-0 frame-group data 0 length) -1)) + ) + (set! (-> gp-0 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + gp-0 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + ) + (set! + (-> self control dynam gravity-length) + (-> self control unknown-dynamics00 gravity-length) + ) + (set! + (-> self control dynam gravity quad) + (-> self control unknown-dynamics00 gravity quad) + ) + (target-danger-set! 'flop-down #f) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 64)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + (let ((gp-2 (-> self skel root-channel 1))) + (joint-control-channel-group-eval! + gp-2 + (the-as art-joint-anim (-> self draw art-group data 67)) + num-func-identity + ) + (set! (-> gp-2 frame-num) 0.0) + ) + (let ((f30-0 (-> (new 'static 'array float 1 1.0) 0))) + (let ((gp-3 (new-stack-vector0))) + (let + ((f0-18 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control unknown-vector120) + ) + ) + ) + 0.0 + (vector-! + gp-3 + (-> self control unknown-vector120) + (vector-float*! gp-3 (-> self control dynam gravity-normal) f0-18) + ) + ) + (let* ((f0-19 (vector-length gp-3)) + (f1-1 f0-19) + (f2-0 -368640.0) + ) + (vector+! + (-> self control unknown-vector120) + (vector-float*! + (-> self control unknown-vector120) + (-> self control dynam gravity-normal) + f2-0 + ) + (vector-float*! gp-3 gp-3 (/ f0-19 f1-1)) + ) + ) + ) + (let ((gp-4 (new-stack-vector0))) + (let + ((f0-22 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-4 + (-> self control transv) + (vector-float*! gp-4 (-> self control dynam gravity-normal) f0-22) + ) + ) + (let* ((f0-23 (vector-length gp-4)) + (f1-3 f0-23) + (f2-2 (* -368640.0 f30-0)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f2-2 + ) + (vector-float*! gp-4 gp-4 (/ f0-23 f1-3)) + ) + ) + ) + (suspend) + (while #t + (+! (-> self control unknown-uint20) 1) + (let ((a0-30 (-> self skel root-channel 0))) + (set! (-> a0-30 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-30 + (the-as art-joint-anim #f) + num-func-+! + ) + ) + (let ((gp-5 (-> self skel root-channel 1))) + (set! + (-> gp-5 frame-interp) + (lerp-scale + (-> (new 'static 'array float 1 0.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float01) + (-> (new 'static 'array float 1 0.0) 0) + (the-as float 40960.0) + ) + ) + (set! (-> gp-5 param 0) 0.0) + (joint-control-channel-group-eval! + gp-5 + (the-as art-joint-anim #f) + num-func-chan + ) + ) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + (let ((gp-6 (new-stack-vector0)) + (f28-0 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-6 + (-> self control transv) + (vector-float*! gp-6 (-> self control dynam gravity-normal) f28-0) + ) + (let* ((f1-5 (vector-length gp-6)) + (f0-34 f1-5) + ) + (if (< (-> self control unknown-surface01 transv-max) f1-5) + (set! f1-5 (-> self control unknown-surface01 transv-max)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f28-0 + ) + (vector-float*! gp-6 gp-6 (/ f1-5 f0-34)) + ) + ) + ) + (if + (>= + (- (-> *display* base-frame-counter) (-> self state-time)) + (the-as int (-> *TARGET-bank* fall-timeout)) + ) + (go target-falling #f) + ) + (if + (and + (= *cheat-mode* 'debug) + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-abs + 0 + ) + (pad-buttons r2) + ) + (not *pause-lock*) + ) + (go target-falling #f) + ) + (suspend) + ) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-flop-hit-ground (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('swim) + #f + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + :enter + (behavior ((arg0 symbol)) + (let + ((f0-1 + (vector-dot + (-> self control dynam gravity-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector111) + (-> self control trans) + ) + ) + ) + ) + (if (< (-> *TARGET-bank* fall-far) f0-1) + (go target-hit-ground-hard f0-1) + ) + ) + (target-land-effect) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 30) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-uint20) (the-as uint arg0)) + (set-forward-vel (-> (new 'static 'array float 1 0.0) 0)) + (set! (-> self control unknown-surface00) *flop-land-mods*) + (set! (-> *flop-land-mods* flags) (logand -1025 (-> *flop-land-mods* flags))) + (set! (-> self state-flags) (logior #x100000 (-> self state-flags))) + (none) + ) + :exit + target-exit + :trans + (behavior () + (when (!= (-> self control unknown-spoolanim00) 'stuck) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + ) + (go target-attack-air 'flop) + ) + ) + (when + (and + (and + (= (-> self fact-info-target eco-type) 2) + (>= + (-> self fact-info-target eco-level) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (< (- (-> *display* base-frame-counter) (-> self state-time)) 75) + ) + (dummy-10 + (-> self skel effect) + 'group-red-eco-spinkick + (ja-frame-num 0) + (if (rand-vu-percent? (the-as float 0.5)) + 23 + 17 + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 30) + ) + (let ((v1-33 (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + ) + ) + (if + (and + (or + (= v1-33 (-> self draw art-group data 65)) + (= v1-33 (-> self draw art-group data 68)) + ) + (>= (ja-aframe-num 0) 28.0) + ) + (logior! (-> *flop-land-mods* flags) 1024) + ) + ) + (slide-down-test) + (none) + ) + :code + (behavior ((arg0 symbol)) + (target-hit-ground-anim arg0) + (go target-falling #f) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-wheel (target) + :event + (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (= arg2 'touched) + (send-event arg0 'roll) + ) + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + :enter + (behavior () + (set! (-> self state-time) (-> *display* base-frame-counter)) + (set! (-> self control unknown-surface00) *wheel-mods*) + (+! (-> self control unknown-int50) 1) + (rot->dir-targ! (-> self control)) + (set-forward-vel + (+ + (-> *TARGET-bank* wheel-speed-min) + (* + (-> *TARGET-bank* wheel-speed-inc) + (the float (+ (-> self control unknown-int50) -1)) + ) + ) + ) + (if + (or + (< (fabs (-> self control unknown-float62)) 0.3) + (< 0.3 (fabs (-> self control unknown-float61))) + ) + (set! + (-> self control unknown-float81) + (-> (new 'static 'array float 1 1.0) 0) + ) + ) + (set! (-> self control unknown-uint20) (the-as uint 0)) + (set! (-> self control unknown-int21) 0) + 0 + (none) + ) + :exit + (behavior () + (when (!= (-> self next-state name) 'target-wheel) + (set! (-> self control unknown-int50) 0) + (set! (-> self control unknown-dword30) (-> *display* base-frame-counter)) + ) + (target-exit) + (none) + ) + :code + (behavior () + (let ((gp-0 0)) + 0 + (let ((s5-0 0) + (f30-0 (-> (new 'static 'array float 1 1.0) 0)) + ) + (ja-channel-push! 1 12) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 69)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (until (ja-done? 0) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + (set! gp-0 (-> *display* base-frame-counter)) + ) + (when + (and + (or (smack-surface? #f) (>= (-> self control unknown-float63) 0.7)) + (>= + (the-as + uint + (- + (-> *display* base-frame-counter) + (the-as int (-> self control unknown-uint20)) + ) + ) + (the-as uint 3) + ) + (>= (- (-> *display* base-frame-counter) (-> self state-time)) 1) + ) + (if (>= 6.0 (ja-aframe-num 0)) + (target-shoved + (-> *TARGET-bank* smack-surface-dist) + (-> *TARGET-bank* smack-surface-height) + (the-as process #f) + (the-as (state target) target-hit) + ) + ) + (if (zero? s5-0) + (set! s5-0 (-> *display* base-frame-counter)) + ) + ) + (if + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons square) + ) + (-> *display* base-frame-counter) + ) + (TODO-RENAME-9 (-> self align)) + (cond + ((nonzero? s5-0) + ) + (else + (TODO-RENAME-10 + (-> self align) + 4 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + f30-0 + ) + (let ((s4-1 (new-stack-vector0))) + (vector-matrix*! + s4-1 + (-> self control transv) + (-> self control unknown-matrix00) + ) + (set! (-> s4-1 y) 0.0) + (vector-matrix*! + (-> self control unknown-vector120) + s4-1 + (-> self control unknown-matrix01) + ) + ) + ) + ) + (suspend) + (let ((a0-15 (-> self skel root-channel 0))) + (set! + (-> a0-15 param 0) + (the float (+ (-> a0-15 frame-group data 0 length) -1)) + ) + (set! (-> a0-15 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-15 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + ) + ) + (if + (and + (or + (< + (- (-> *display* base-frame-counter) gp-0) + (the-as int (-> *TARGET-bank* wheel-jump-pre-window)) + ) + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons x) + ) + ) + (can-jump? 'target-wheel-flip) + ) + (go + target-wheel-flip + (-> *TARGET-bank* wheel-flip-height) + (-> *TARGET-bank* wheel-flip-dist) + ) + ) + ) + (set! + (-> self state-hook-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self state-hook) (lambda :behavior target () (cond + ((>= + (- + (-> + *display* + base-frame-counter + ) + (the-as + int + (-> + self + state-hook-time + ) + ) + ) + (the-as + int + (-> + *TARGET-bank* + wheel-jump-post-window + ) + ) + ) + (set! + (-> + self + state-hook + ) + (the-as + (function none :behavior target) + nothing + ) + ) + ) + (else + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? + 'target-wheel-flip + ) + ) + (go + target-wheel-flip + (-> + *TARGET-bank* + wheel-flip-height + ) + (-> + *TARGET-bank* + wheel-flip-dist + ) + ) + ) + ) + ) + (none) + ) + ) + (go target-duck-stance) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) + +;; failed to figure out what this is: +(defstate target-wheel-flip (target) + :event + target-standard-event-handler + :enter + (behavior ((arg0 float) (arg1 float)) + (set! (-> self control unknown-surface00) *wheel-flip-mods*) + (none) + ) + :exit + target-exit + :trans + (behavior () + (if + (and + (or + (smack-surface? #f) + (< + (target-move-dist (the-as int (-> *TARGET-bank* stuck-time))) + (-> *TARGET-bank* stuck-distance) + ) + ) + (!= (-> self state-time) (-> *display* base-frame-counter)) + ) + (target-shoved + (-> *TARGET-bank* smack-surface-dist) + (-> *TARGET-bank* smack-surface-height) + (the-as process #f) + (the-as (state target) target-hit) + ) + ) + (if + (and + (logtest? + (-> + *cpad-list* + cpads + (-> self control unknown-cpad-info00 number) + button0-rel + 0 + ) + (pad-buttons circle) + ) + (can-feet?) + (and (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + (= (-> self skel root-channel 0) (-> self skel channel)) + ) + ) + (go target-attack-air #f) + ) + (none) + ) + :code + (behavior ((arg0 float) (arg1 float)) + (ja-channel-push! 1 12) + (let ((s4-0 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 71)) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((f30-0 (-> (new 'static 'array float 1 1.0) 0))) + (until + (or + (ja-max? 0) + (and (>= (ja-aframe-num 0) 4.0) (logtest? (-> self control status) 1)) + ) + (when + (and + (>= (ja-aframe-num 0) (-> (new 'static 'array float 1 3.0) 0)) + (not (-> self control unknown-symbol30)) + ) + (set! (-> self event-hook) target-dangerous-event-handler) + (target-start-attack) + (target-danger-set! 'flip #f) + ) + (TODO-RENAME-9 (-> self align)) + (if (not (ja-max? 0)) + (TODO-RENAME-10 + (-> self align) + 6 + (-> (new 'static 'array float 1 1.0) 0) + (/ arg0 (-> *TARGET-bank* wheel-flip-art-height)) + (* f30-0 (/ arg1 (-> *TARGET-bank* wheel-flip-art-dist))) + ) + (TODO-RENAME-10 + (-> self align) + 4 + (-> (new 'static 'array float 1 1.0) 0) + (-> (new 'static 'array float 1 1.0) 0) + (* f30-0 (/ arg1 (-> *TARGET-bank* wheel-flip-art-dist))) + ) + ) + (let ((s4-1 (new-stack-vector0))) + (vector-matrix*! + s4-1 + (-> self control transv) + (-> self control unknown-matrix00) + ) + (set! (-> s4-1 y) 0.0) + (vector-matrix*! + (-> self control unknown-vector120) + s4-1 + (-> self control unknown-matrix01) + ) + ) + (suspend) + (let ((a0-11 (-> self skel root-channel 0))) + (set! + (-> a0-11 param 0) + (the float (+ (-> a0-11 frame-group data 0 length) -1)) + ) + (set! (-> a0-11 param 1) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-11 + (the-as art-joint-anim #f) + num-func-seek! + ) + ) + (set! + f30-0 + (* + f30-0 + (fmin + (-> (new 'static 'array float 1 1.0) 0) + (-> self control unknown-float140) + ) + ) + ) + ) + ) + (set! (-> self state-time) (-> *display* base-frame-counter)) + (while (zero? (logand (-> self control status) 1)) + (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) 3) + (when (not (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + ) + (ja-channel-push! 1 30) + (let ((gp-1 (-> self skel root-channel 0))) + (joint-control-channel-group-eval! + gp-1 + (the-as art-joint-anim (-> self draw art-group data 38)) + num-func-identity + ) + (set! (-> gp-1 frame-num) 0.0) + ) + ) + ) + (let ((gp-2 (new-stack-vector0)) + (f30-1 + (vector-dot + (-> self control dynam gravity-normal) + (-> self control transv) + ) + ) + ) + 0.0 + (vector-! + gp-2 + (-> self control transv) + (vector-float*! gp-2 (-> self control dynam gravity-normal) f30-1) + ) + (let* ((f1-6 (vector-length gp-2)) + (f0-21 f1-6) + (f1-7 (* 0.9 f1-6)) + ) + (vector+! + (-> self control transv) + (vector-float*! + (-> self control transv) + (-> self control dynam gravity-normal) + f30-1 + ) + (vector-float*! gp-2 gp-2 (/ f1-7 f0-21)) + ) + ) + ) + (suspend) + (cond + ((= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + (let ((a0-35 (-> self skel root-channel 0))) + (set! (-> a0-35 param 0) (-> (new 'static 'array float 1 1.0) 0)) + (joint-control-channel-group-eval! + a0-35 + (the-as art-joint-anim #f) + num-func-loop! + ) + ) + ) + (else + (let ((v1-85 (-> self skel root-channel 0))) + (set! (-> v1-85 num-func) num-func-identity) + (set! + (-> v1-85 frame-num) + (the float (+ (-> v1-85 frame-group data 0 length) -1)) + ) + ) + ) + ) + ) + (target-land-effect) + (set! + (-> self state-hook-time) + (the-as uint (-> *display* base-frame-counter)) + ) + (set! (-> self state-hook) (lambda :behavior target () (cond + ((>= + (- + (-> + *display* + base-frame-counter + ) + (the-as + int + (-> + self + state-hook-time + ) + ) + ) + 30 + ) + (set! + (-> + self + state-hook + ) + (the-as + (function none :behavior target) + nothing + ) + ) + ) + (else + (if + (and + (logtest? + (logior + (logior + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 0 + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 1 + ) + ) + (-> + *cpad-list* + cpads + (-> + self + control + unknown-cpad-info00 + number + ) + button0-rel + 2 + ) + ) + (pad-buttons x) + ) + (can-jump? #f) + ) + (go + target-high-jump + (-> + *TARGET-bank* + flip-jump-height-min + ) + (-> + *TARGET-bank* + flip-jump-height-max + ) + 'flip + ) + ) + ) + ) + (none) + ) + ) + (if (= (if (> (-> self skel active-channels) 0) + (-> self skel root-channel 0 frame-group) + ) + (-> self draw art-group data 38) + ) + (go target-hit-ground #f) + (go target-stance) + ) + (none) + ) + :post + (the-as (function none :behavior target) target-post) + ) diff --git a/test/decompiler/reference/levels/common/basebutton_REF.gc b/test/decompiler/reference/levels/common/basebutton_REF.gc index 4f2aaa5c74..da803fa09c 100644 --- a/test/decompiler/reference/levels/common/basebutton_REF.gc +++ b/test/decompiler/reference/levels/common/basebutton_REF.gc @@ -834,7 +834,7 @@ (-> self control unknown-vector102 y) (+ -4096.0 (-> self control unknown-vector102 y)) ) - (set! (-> self control unknown-float120) (the-as float #f)) + (set! (-> self control unknown-uint20) (the-as uint #f)) (vector-reset! (-> self control transv)) (logior! (-> self state-flags) 1024) (set! (-> self alt-cam-pos quad) (-> arg1 quad)) @@ -984,7 +984,7 @@ (and (or (< (vector-dot gp-2 (-> self control transv)) 0.0) - (-> self control unknown-float120) + (-> self control unknown-spoolanim00) ) (>= (- (-> *display* base-frame-counter) (-> self state-time)) 15) ) @@ -995,10 +995,10 @@ ) (set! (-> self control transv x) (* 0.95 (-> self control transv x))) (set! (-> self control transv z) (* 0.95 (-> self control transv z))) - (when (not (-> self control unknown-float120)) + (when (not (-> self control unknown-spoolanim00)) (send-event self 'do-effect 'death-warp-out -1.0) (let ((v0-2 #t)) - (set! (-> self control unknown-float120) (the-as float v0-2)) + (set! (-> self control unknown-uint20) (the-as uint v0-2)) v0-2 ) ) diff --git a/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc b/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc index 4b8de37b14..2a54e8f89e 100644 --- a/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc +++ b/test/decompiler/reference/levels/common/dark-eco-pool_REF.gc @@ -126,7 +126,7 @@ ) ) ) - (set! (-> obj attack-event) (the-as basic v0-1)) + (set! (-> obj attack-event) (the-as symbol v0-1)) v0-1 ) ) @@ -517,7 +517,3 @@ (none) ) ) - - - - diff --git a/test/decompiler/reference/levels/common/water-anim_REF.gc b/test/decompiler/reference/levels/common/water-anim_REF.gc index 2fcd727bad..7d62178c3f 100644 --- a/test/decompiler/reference/levels/common/water-anim_REF.gc +++ b/test/decompiler/reference/levels/common/water-anim_REF.gc @@ -1019,7 +1019,7 @@ ;; definition for method 24 of type water-anim ;; INFO: Return type mismatch symbol vs none. -(defmethod dummy-24 water-anim () +(defmethod set-stack-size! water-anim ((obj water-anim)) (none) ) diff --git a/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc b/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc index 7383b34263..1445f2186d 100644 --- a/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc +++ b/test/decompiler/reference/levels/finalboss/robotboss-weapon_REF.gc @@ -13,9 +13,9 @@ :flag-assert #xd00000028 (:methods (dummy-9 (_type_ vector) none 9) - (dummy-10 (_type_ vector vector) symbol 10) + (TODO-RENAME-10 (_type_ collide-prim-core vector) symbol 10) (dummy-11 (_type_ vector) symbol 11) - (dummy-12 (_type_ vector) none 12) + (dummy-12 (_type_ vector) vector 12) ) ) @@ -30,12 +30,15 @@ ) ;; definition for method 10 of type torus -(defmethod dummy-10 torus ((obj torus) (arg0 vector) (arg1 vector)) +(defmethod + TODO-RENAME-10 + torus + ((obj torus) (arg0 collide-prim-core) (arg1 vector)) (let ((gp-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) - (f30-0 (+ (-> obj radius-secondary) (-> arg0 w))) + (f30-0 (+ (-> obj radius-secondary) (-> arg0 world-sphere w))) ) - (vector-! gp-0 arg0 (-> obj origin)) + (vector-! gp-0 (the-as vector arg0) (-> obj origin)) (vector-flatten! s5-0 gp-0 (-> obj axis)) (vector-normalize! s5-0 (-> obj radius-primary)) (vector-! arg1 gp-0 s5-0) @@ -50,7 +53,7 @@ (when (and (logtest? (-> s4-0 prim-core collide-as) 16) - (dummy-10 obj (the-as vector (-> s4-0 prim-core)) arg0) + (TODO-RENAME-10 obj (-> s4-0 prim-core) arg0) ) (countdown (s3-0 (-> s4-0 num-prims)) (let ((v1-9 (-> s4-0 prims s3-0))) @@ -58,7 +61,7 @@ (and (logtest? (-> v1-9 prim-core action) 1) (logtest? (-> v1-9 prim-core collide-as) 16) - (dummy-10 obj (the-as vector (-> v1-9 prim-core)) arg0) + (TODO-RENAME-10 obj (-> v1-9 prim-core) arg0) ) (return #t) ) @@ -139,7 +142,6 @@ ) ;; definition for method 12 of type torus -;; INFO: Return type mismatch vector vs none. (defmethod dummy-12 torus ((obj torus) (arg0 vector)) (let* ((f30-0 65536.0) (v1-1 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) @@ -170,15 +172,16 @@ (vector-matrix*! arg0 arg0 s2-0) ) (vector+! arg0 arg0 (-> obj origin)) - (none) + arg0 ) ;; definition of type arcing-shot (deftype arcing-shot (process-drawable) - ((y-vel float :offset-assert 176) - (grav float :offset-assert 180) - (from vector :inline :offset-assert 192) - (to vector :inline :offset-assert 208) + ((root-override collide-shape-moving :offset 112) + (y-vel float :offset-assert 176) + (grav float :offset-assert 180) + (from vector :inline :offset-assert 192) + (to vector :inline :offset-assert 208) ) :heap-base #x70 :method-count-assert 20 @@ -199,7 +202,6 @@ ) ;; definition for function arcing-shot-setup -;; INFO: Return type mismatch float vs none. ;; Used lq/sq (defbehavior arcing-shot-setup arcing-shot @@ -218,24 +220,24 @@ (* 0.5 (- (sqrtf (- (* f0-6 f0-6) (* 4.0 f3-1))) f0-6)) ) ) - (set! - (-> self grav) - (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2)) + (let ((f0-12 (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2)))) + (set! (-> self grav) f0-12) + f0-12 ) ) - (none) ) ;; definition for function arcing-shot-calculate -;; INFO: Return type mismatch float vs none. (defbehavior arcing-shot-calculate arcing-shot ((arg0 vector) (arg1 float)) (let ((s5-0 (fmin 1.0 (fmax 0.0 arg1)))) (vector-lerp! arg0 (-> self from) (-> self to) s5-0) (set! (-> arg0 y) (-> self from y)) (+! (-> arg0 y) (* (-> self y-vel) s5-0)) - (+! (-> arg0 y) (* 0.5 s5-0 s5-0 (-> self grav))) + (let ((f0-6 (+ (-> arg0 y) (* 0.5 s5-0 s5-0 (-> self grav))))) + (set! (-> arg0 y) f0-6) + f0-6 + ) ) - (none) ) ;; definition for function arcing-shot-draw @@ -340,7 +342,7 @@ #f #f #f - (-> self root trans) + (-> self root-override trans) ) (-> s5-1 ppointer) ) @@ -471,7 +473,7 @@ #f #f #f - (-> self root trans) + (-> self root-override trans) ) (-> gp-0 ppointer) ) @@ -710,7 +712,7 @@ :trans (behavior () (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) @@ -857,9 +859,9 @@ ) (set! (-> s1-0 nav-radius) (* 0.75 (-> s1-0 root-prim local-sphere w))) (backup-collide-with-as s1-0) - (set! (-> self root) s1-0) + (set! (-> self root-override) s1-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *darkecobomb-sg* '()) (logclear! (-> self mask) (process-mask actor-pause)) (set! @@ -927,7 +929,7 @@ :trans (behavior () (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) @@ -940,7 +942,7 @@ ) (deactivate self) ) - (spawn (-> self part) (-> self root trans)) + (spawn (-> self part) (-> self root-override trans)) (none) ) :code @@ -1005,7 +1007,7 @@ ;; Used lq/sq (defbehavior greenshot-init-by-other greenshot - ((arg0 vector) (arg1 vector) (arg2 float) (arg3 uint)) + ((arg0 vector) (arg1 vector) (arg2 float) (arg3 uint) (arg4 float)) (let ((s2-0 (new @@ -1034,9 +1036,9 @@ ) (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) (backup-collide-with-as s2-0) - (set! (-> self root) s2-0) + (set! (-> self root-override) s2-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *greenshot-sg* '()) (logclear! (-> self mask) (process-mask actor-pause)) (arcing-shot-setup arg0 arg1 arg2) @@ -1142,10 +1144,10 @@ (the float (+ (-> self rotation-offset) (-> *display* game-frame-counter))) ) ) - (matrix->quaternion (-> self root quat) s5-0) + (matrix->quaternion (-> self root-override quat) s5-0) ) (if (< (* 0.006666667 (the float (min 150 arg0))) 1.0) - (spawn (-> self part) (-> self root trans)) + (spawn (-> self part) (-> self root-override trans)) ) ) @@ -1164,9 +1166,9 @@ #t ) (set! (-> self draw status) (logand -3 (-> self draw status))) - (quaternion-identity! (-> self root quat)) + (quaternion-identity! (-> self root-override quat)) (set! (-> self ring radius-secondary) 3072.0) - (set! (-> self ring origin quad) (-> self root trans quad)) + (set! (-> self ring origin quad) (-> self root-override trans quad)) (+! (-> self ring origin y) (-> self ring radius-secondary)) (set-vector! (-> self ring axis) 0.0 1.0 0.0 1.0) (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) @@ -1197,7 +1199,7 @@ redshot-particle-callback (-> self ppointer) #f - (-> self root trans) + (-> self root-override trans) ) (-> gp-1 ppointer) ) @@ -1310,7 +1312,7 @@ ) (go redshot-explode) ) - (spawn (-> self shot-particle) (-> self root trans)) + (spawn (-> self shot-particle) (-> self root-override trans)) (none) ) :code @@ -1337,7 +1339,7 @@ (behavior () (redshot-trans 1500) (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) @@ -1350,7 +1352,7 @@ ) (go redshot-wait) ) - (spawn (-> self shot-particle) (-> self root trans)) + (spawn (-> self shot-particle) (-> self root-override trans)) (none) ) :code @@ -1369,7 +1371,7 @@ ;; Used lq/sq (defbehavior redshot-init-by-other redshot - ((arg0 vector) (arg1 vector) (arg2 float) (arg3 int) (arg4 int) (arg5 int)) + ((arg0 vector) (arg1 vector) (arg2 float) (arg3 uint) (arg4 uint) (arg5 uint)) (local-vars (sv-16 collide-shape-prim-sphere)) (let ((s0-0 @@ -1400,15 +1402,15 @@ (set-root-prim! s0-0 sv-16) (set! (-> s0-0 nav-radius) (* 0.75 (-> s0-0 root-prim local-sphere w))) (backup-collide-with-as s0-0) - (set! (-> self root) s0-0) + (set! (-> self root-override) s0-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *redring-sg* '()) (logclear! (-> self mask) (process-mask actor-pause)) (arcing-shot-setup arg0 arg1 arg2) - (set! (-> self flight-time) arg3) - (set! (-> self stall-time) arg4) - (set! (-> self rotation-offset) arg5) + (set! (-> self flight-time) (the-as int arg3)) + (set! (-> self stall-time) (the-as int arg4)) + (set! (-> self rotation-offset) (the-as int arg5)) (set! (-> self part) (create-launch-control (-> *part-group-id-table* 647) self) @@ -1435,7 +1437,7 @@ :volume #x400 :fo-max 80 ) - (-> self root trans) + (-> self root-override trans) ) ) (go redshot-idle) @@ -1492,13 +1494,13 @@ :trans (behavior () (arcing-shot-calculate - (-> self root trans) + (-> self root-override trans) (/ (the float (- (-> *display* game-frame-counter) (-> self state-time))) (the float (-> self flight-time)) ) ) - (spawn (-> self part) (-> self root trans)) + (spawn (-> self part) (-> self root-override trans)) (when (>= (- (-> *display* game-frame-counter) (-> self state-time)) @@ -1555,9 +1557,9 @@ ) (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) (backup-collide-with-as s2-0) - (set! (-> self root) s2-0) + (set! (-> self root-override) s2-0) ) - (set! (-> self root trans quad) (-> arg0 quad)) + (set! (-> self root-override trans quad) (-> arg0 quad)) (initialize-skeleton self *redring-sg* '()) (logior! (-> self draw status) 2) (arcing-shot-setup arg0 arg1 arg2) diff --git a/test/decompiler/reference/levels/finalboss/robotboss_REF.gc b/test/decompiler/reference/levels/finalboss/robotboss_REF.gc index b44fef5c0e..5a1fc596b7 100644 --- a/test/decompiler/reference/levels/finalboss/robotboss_REF.gc +++ b/test/decompiler/reference/levels/finalboss/robotboss_REF.gc @@ -3972,10 +3972,12 @@ ;; definition for function robotboss-greenshot ;; INFO: Return type mismatch sound-id vs none. +;; WARN: Function may read a register that is not set: t2 ;; Used lq/sq (defbehavior robotboss-greenshot robotboss ((arg0 vector) (arg1 basic) (arg2 basic) (arg3 symbol)) + (local-vars (t2-0 none)) (+! (-> self children-spawned) 1) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s2-0 (new 'stack-no-clear 'vector))) @@ -3993,7 +3995,7 @@ (the-as pointer #x70004000) ) ) - (run-now-in-process s1-1 greenshot-init-by-other gp-0 s2-0 arg1 arg2) + (run-now-in-process s1-1 greenshot-init-by-other gp-0 s2-0 arg1 arg2 t2-0) (-> s1-1 ppointer) ) ) diff --git a/test/decompiler/reference/levels/flut_common/flutflut_REF.gc b/test/decompiler/reference/levels/flut_common/flutflut_REF.gc index 08bcfdefe4..7478528729 100644 --- a/test/decompiler/reference/levels/flut_common/flutflut_REF.gc +++ b/test/decompiler/reference/levels/flut_common/flutflut_REF.gc @@ -8,15 +8,16 @@ ;; definition of type flutflut (deftype flutflut (process-drawable) - ((root-override collide-shape-moving :offset 112) - (extra-trans vector :inline :offset-assert 176) - (condition int32 :offset-assert 192) - (auto-get-off symbol :offset-assert 196) - (cell handle :offset-assert 200) - (path-data path-control 2 :offset-assert 208) - (path-target path-control :offset 208) - (path-flut path-control :offset 212) - (touch-time uint64 :offset-assert 216) + ((parent-override (pointer target) :offset 12) + (root-override collide-shape-moving :offset 112) + (extra-trans vector :inline :offset-assert 176) + (condition int32 :offset-assert 192) + (auto-get-off symbol :offset-assert 196) + (cell handle :offset-assert 200) + (path-data path-control 2 :offset-assert 208) + (path-target path-control :offset 208) + (path-flut path-control :offset 212) + (touch-time uint64 :offset-assert 216) ) :pack-me :heap-base #x70 diff --git a/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc b/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc index aaae9375df..ebe71ddb2f 100644 --- a/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc +++ b/test/decompiler/reference/levels/jungle/fisher-JUN_REF.gc @@ -2967,7 +2967,7 @@ (activate! (-> self control unknown-smush00) 1.0 120 210 0.3 1.0) ) ((= arg2 'lose) - (set! (-> self control unknown-float120) (the-as float arg2)) + (set! (-> self control unknown-uint20) (the-as uint arg2)) arg2 ) (else @@ -2980,7 +2980,7 @@ (set! (-> self control unknown-surface00) *empty-mods*) (logior! (-> self state-flags) 16) (set-zero! (-> self control unknown-smush00)) - (set! (-> self control unknown-float120) (the-as float #f)) + (set! (-> self control unknown-uint20) (the-as uint #f)) (none) ) :exit @@ -3097,7 +3097,7 @@ (set! (-> s5-1 frame-num) (ja-aframe 15.0 0)) ) (let ((s5-2 (new 'stack-no-clear 'vector))) - (until (-> self control unknown-float120) + (until (-> self control unknown-spoolanim00) (let ((v1-42 (handle->process arg0))) (when v1-42 (let ((a0-28 (-> self skel root-channel 0))) @@ -3154,7 +3154,7 @@ (suspend) ) ) - (case (-> self control unknown-float120) + (case (-> self control unknown-spoolanim00) (('lose) (ja-channel-push! 1 30) (let ((a0-38 (-> self skel root-channel 0))) diff --git a/test/decompiler/reference/levels/racer_common/collide-reaction-racer_REF.gc b/test/decompiler/reference/levels/racer_common/collide-reaction-racer_REF.gc new file mode 100644 index 0000000000..d401e76d17 --- /dev/null +++ b/test/decompiler/reference/levels/racer_common/collide-reaction-racer_REF.gc @@ -0,0 +1,251 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function racer-collision-reaction +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defun + racer-collision-reaction + ((arg0 control-info) + (arg1 collide-shape-intersect) + (arg2 vector) + (arg3 vector) + ) + (local-vars + (sv-80 vector) + (sv-84 vector) + (sv-88 (inline-array vector)) + (sv-96 int) + (sv-104 int) + ) + (set! sv-80 (new-stack-vector0)) + (set! sv-84 (new-stack-vector0)) + (let ((v1-2 (new 'stack-no-clear 'inline-array 'vector 2))) + (dotimes (a0-1 2) + (set! (-> v1-2 a0-1 quad) (the-as uint128 0)) + ) + (set! sv-88 v1-2) + ) + (set! sv-96 0) + (set! sv-104 0) + (set! (-> sv-88 0 quad) (-> arg3 quad)) + (set! (-> sv-88 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u)) + (TODO-RENAME-28 arg0 a1-3) + ) + (dummy-56 arg0 (-> arg1 best-tri pat)) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! sv-104 (logior sv-104 1)) + ) + (if (= (-> arg0 unknown-surface00 mode) 'air) + (set! sv-104 (logior sv-104 32)) + ) + (let ((v1-21 (new 'stack-no-clear 'vector))) + (set! (-> v1-21 quad) (-> arg1 best-from-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-21 (-> arg1 best-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (set! sv-104 (logior sv-104 24)) + ) + (let ((v1-31 (-> sv-80 quad))) + (set! (-> sv-84 quad) v1-31) + ) + (if (= (-> arg1 best-u) 0.0) + (TODO-RENAME-28 arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 0)) + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-96 (logior sv-96 16)) + ) + (let + ((s3-1 + (< + (fabs (-> arg0 surface-angle)) + (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle) + ) + ) + ) + (if s3-1 + (set! sv-104 (logior sv-104 2)) + ) + (when (zero? (logand (-> arg0 prev-status) 1)) + (set! + (-> arg0 ground-impact-vel) + (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))) + ) + (set! sv-96 (logior sv-96 2048)) + (when (not s3-1) + (let ((f30-0 (- 1.0 (-> arg0 surf impact-fric)))) + (when (< f30-0 1.0) + (let ((s2-1 (new-stack-vector0)) + (f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 0))) + ) + 0.0 + (vector-! + s2-1 + (-> sv-88 0) + (vector-float*! s2-1 (-> arg0 dynam gravity-normal) f28-0) + ) + (let* ((f0-18 (vector-length s2-1)) + (f1-6 f0-18) + ) + (if (< f28-0 0.0) + (set! f28-0 (* f28-0 f30-0)) + ) + (vector+! + (-> sv-88 0) + (vector-float*! (-> sv-88 0) (-> arg0 dynam gravity-normal) f28-0) + (vector-float*! s2-1 s2-1 (/ f0-18 f1-6)) + ) + ) + ) + ) + ) + ) + ) + (set! sv-96 (logior sv-96 4)) + (cond + ((-> arg1 best-to-prim) + (set! sv-96 (logior sv-96 32)) + (set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad)) + (set! + (-> arg0 unknown-handle00) + (process->handle (-> arg1 best-to-prim cshape process)) + ) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (set! sv-96 (logior sv-96 4096)) + ) + ) + (if (and s3-1 (logtest? #x10000 (-> arg0 root-prim prim-core action))) + (set! s3-1 #f) + ) + (cond + (s3-1 + (set! sv-104 (logior sv-104 4)) + (set! sv-96 (logior sv-96 8)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad)) + (set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-int60) (the-as uint (-> arg1 best-tri pat))) + (vector-reflect-flat-above! arg2 (-> sv-88 0) sv-84) + (cond + ((not + (and + (>= + (-> arg1 best-from-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! + (new 'stack-no-clear 'vector) + (-> arg1 best-tri intersect) + (-> arg0 ground-touch-point) + ) + ) + ) + (and + (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (< (- (-> *display* base-frame-counter) (-> arg0 unknown-dword10)) 90) + (zero? (logand sv-104 32)) + ) + ) + ) + ) + (else + (set! sv-104 (logior sv-104 256)) + (set! sv-104 (logand -65 sv-104)) + (let + ((s3-3 + (vector-cross! + (new 'stack-no-clear 'vector) + (-> arg0 poly-normal) + (-> arg0 ground-poly-normal) + ) + ) + ) + (vector-normalize! s3-3 1.0) + (vector-float*! arg2 s3-3 (vector-dot (-> sv-88 0) s3-3)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + ) + (let* + ((s2-2 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> sv-88 0) 1.0) + ) + (s3-4 (new-stack-vector0)) + (f30-1 (vector-dot s2-2 arg2)) + ) + 0.0 + (vector-! s3-4 arg2 (vector-float*! s3-4 s2-2 f30-1)) + (let* ((f1-11 (vector-length s3-4)) + (f0-27 f1-11) + (f1-12 (* 0.9 f1-11)) + ) + (vector+! + arg2 + (vector-float*! arg2 s2-2 f30-1) + (vector-float*! s3-4 s3-4 (/ f1-12 f0-27)) + ) + ) + ) + ) + (else + (set! sv-96 (logior sv-96 1)) + (set! (-> arg0 cur-pat mode) 0) + (if (and (= (-> arg1 best-from-prim prim-id) 6) (zero? (logand sv-104 7))) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (vector-reflect-flat! arg2 (-> sv-88 0) sv-84) + (dotimes (v1-142 16) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (set! sv-96 (logior sv-96 2)) + (set! (-> arg0 ground-touch-point w) 0.0) + (when (zero? (logand sv-104 15)) + (set! sv-96 (logior sv-96 2)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad)) + (set! + (-> arg0 unknown-float60) + (vector-dot sv-84 (-> arg0 dynam gravity-normal)) + ) + (set! (-> arg0 unknown-dword10) (-> *display* base-frame-counter)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + (set! sv-104 (logior sv-104 2048)) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (set! sv-96 (logior sv-96 1024)) + ) + ) + ) + ) + ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as uint sv-104)) + (update! + (-> arg0 history-data (-> arg0 unknown-halfword00)) + arg0 + (-> arg1 best-tri intersect) + (-> sv-88 1) + arg2 + ) + (set! + (-> arg0 unknown-halfword00) + (logand (+ (-> arg0 unknown-halfword00) 1) 127) + ) + sv-96 + (none) + ) diff --git a/test/decompiler/reference/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL_REF.gc b/test/decompiler/reference/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL_REF.gc index 2f05671116..a29fd80b71 100644 --- a/test/decompiler/reference/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL_REF.gc +++ b/test/decompiler/reference/levels/racer_common/racer-states-FIC-LAV-MIS-OGR-ROL_REF.gc @@ -63,10 +63,10 @@ ) (target-attacked arg2 - (-> arg3 param 1) - (the-as uint arg0) + (the-as attack-info (-> arg3 param 1)) + arg0 (the-as process (-> arg3 param 0)) - (the-as (state target) target-racing-hit) + target-racing-hit ) ) ) @@ -269,13 +269,7 @@ ) ) (set! (-> self control surf) *race-track-surface*) - (set! - (-> self control reaction) - (the-as - (function collide-shape-moving collide-shape-intersect vector vector none) - racer-collision-reaction - ) - ) + (set! (-> self control reaction) racer-collision-reaction) (vector-reset! (-> self racer rot)) (set! (-> self racer rot y) (y-angle (-> self control))) (target-collide-set! 'racer 0.0) @@ -1573,10 +1567,7 @@ ;; failed to figure out what this is: (defstate target-racing-hit (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :enter (behavior ((arg0 handle) (arg1 attack-info)) (let ((v1-0 (-> self attack-info))) @@ -2219,10 +2210,7 @@ ;; failed to figure out what this is: (defstate target-racing-get-on (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :exit (-> target-racing-start exit) :code @@ -2247,8 +2235,8 @@ (-> self control unknown-quaternion00) ) (set! - (-> self control unknown-float120) - (-> self control unknown-vector11 y) + (-> self control unknown-uint20) + (the-as uint (-> self control unknown-vector11 y)) ) (let* ((s3-0 (handle->process arg0)) (s4-1 @@ -2271,7 +2259,7 @@ ) (set! (-> self racer bike-scale quad) (-> s4-1 root-override scale quad)) (set! - (-> self control unknown-int20) + (-> self control unknown-int21) (the-as int (-> self racer bike-trans y)) ) ) @@ -2536,7 +2524,7 @@ (set! (-> self control unknown-vector11 y) (lerp - (-> self control unknown-float120) + (the-as float (-> self control unknown-uint20)) (-> self racer cushion-base) f30-1 ) @@ -2544,8 +2532,8 @@ (set! (-> self racer bike-trans y) (lerp - (-> self control unknown-float121) - (+ 4096.0 (-> self control unknown-float121)) + (the-as float (-> self control unknown-uint30)) + (+ 4096.0 (the-as float (-> self control unknown-uint30))) f30-1 ) ) @@ -2559,10 +2547,7 @@ ;; failed to figure out what this is: (defstate target-racing-get-off (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :exit (-> target-racing-start exit) :code @@ -2659,10 +2644,7 @@ ;; failed to figure out what this is: (defstate target-racing-get-off-jump (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-generic-event-handler - ) + target-generic-event-handler :exit (-> target-racing-start exit) :code @@ -2691,8 +2673,8 @@ (-> self control unknown-quaternion00) ) (set! - (-> self control unknown-float120) - (-> self control unknown-vector11 y) + (-> self control unknown-uint20) + (the-as uint (-> self control unknown-vector11 y)) ) (let* ((s2-0 (handle->process arg0)) (s3-0 @@ -2719,7 +2701,7 @@ ) (set! (-> self racer bike-scale quad) (-> s3-0 root-override scale quad)) (set! - (-> self control unknown-int20) + (-> self control unknown-int21) (the-as int (-> self racer bike-trans y)) ) ) @@ -2927,7 +2909,11 @@ ) (set! (-> self control unknown-vector11 y) - (lerp (-> self control unknown-float120) 6144.0 (fmin 1.0 (* 2.0 f30-0))) + (lerp + (the-as float (-> self control unknown-uint20)) + 6144.0 + (fmin 1.0 (* 2.0 f30-0)) + ) ) ) (vector+! @@ -2949,10 +2935,7 @@ ;; failed to figure out what this is: (defstate target-racing-get-off-hit-ground (target) :event - (the-as - (function process int symbol event-message-block object :behavior target) - target-standard-event-handler - ) + target-standard-event-handler :enter (-> target-hit-ground enter) :trans @@ -3130,7 +3113,7 @@ :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (if (and (= arg2 'trans) (= (-> arg3 param 0) 'restore)) - (set! (-> self control unknown-float120) (the-as float #f)) + (set! (-> self control unknown-uint20) (the-as uint #f)) ) ((-> target-racing-grab event) arg0 arg1 arg2 arg3) ) @@ -3140,7 +3123,7 @@ (behavior () (set! (-> self control unknown-vector11 y) - (-> self control unknown-float120) + (the-as float (-> self control unknown-uint20)) ) (set! (-> self control unknown-vector12 y) @@ -3155,8 +3138,8 @@ :code (behavior ((arg0 handle)) (set! - (-> self control unknown-float120) - (-> self control unknown-vector11 y) + (-> self control unknown-uint20) + (the-as uint (-> self control unknown-vector11 y)) ) (set! (-> self control unknown-vector11 y) 0.0) (send-event (ppointer->process (-> self sidekick)) 'matrix 'play-anim) diff --git a/test/decompiler/reference/levels/snow/target-snowball_REF.gc b/test/decompiler/reference/levels/snow/target-snowball_REF.gc index 3683e096a9..1304a747cf 100644 --- a/test/decompiler/reference/levels/snow/target-snowball_REF.gc +++ b/test/decompiler/reference/levels/snow/target-snowball_REF.gc @@ -72,7 +72,7 @@ target-jump (-> *TARGET-bank* duck-jump-height-min) (-> *TARGET-bank* duck-jump-height-max) - #f + (the-as surface #f) ) ) (else diff --git a/test/decompiler/reference/levels/swamp/swamp-bat_REF.gc b/test/decompiler/reference/levels/swamp/swamp-bat_REF.gc index c57d3db331..08366a8854 100644 --- a/test/decompiler/reference/levels/swamp/swamp-bat_REF.gc +++ b/test/decompiler/reference/levels/swamp/swamp-bat_REF.gc @@ -887,15 +887,12 @@ swamp-bat-slave-event-handler (deactivate self) ) (swamp-bat-update-path) - (let ((s5-0 (method-of-object (-> self vol) dummy-10))) - (target-pos 5) - (if - (or - (s5-0) - (not (swamp-bat-check-slave-paths-match? (-> self path-select))) - ) - (go swamp-bat-launch-slaves) + (if + (or + (dummy-10 (-> self vol) (target-pos 5)) + (not (swamp-bat-check-slave-paths-match? (-> self path-select))) ) + (go swamp-bat-launch-slaves) ) ) (let ((gp-1 (new 'static 'matrix))) diff --git a/test/test_reader.cpp b/test/test_reader.cpp index 550f0d8629..124a22acfc 100644 --- a/test/test_reader.cpp +++ b/test/test_reader.cpp @@ -349,6 +349,6 @@ TEST(GoosReader, TextDb) { .as_pair() ->cdr.as_pair() ->car; - std::string expected = "test/test_data/test_reader_file0.gc, line: 5\n(1 2 3 4)\n ^\n"; + std::string expected = "test/test_data/test_reader_file0.gc:5\n(1 2 3 4)\n ^\n"; EXPECT_EQ(expected, reader.db.get_info_for(result)); }