diff --git a/decompiler/analysis/variable_naming.cpp b/decompiler/analysis/variable_naming.cpp index bc0463ced2..c8887064ad 100644 --- a/decompiler/analysis/variable_naming.cpp +++ b/decompiler/analysis/variable_naming.cpp @@ -730,8 +730,14 @@ void merge_infos( * the none variables */ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) { - bool event_handler_hack = - function.ir2.env.version > GameVersion::Jak1 && function.guessed_name.is_event_handler(); + bool event_handler_hack = false; + + if (function.ir2.env.version == GameVersion::Jak2) { + event_handler_hack = function.guessed_name.is_event_handler() || + function.guessed_name.to_string() == "target-generic-event-handler" || + function.guessed_name.to_string() == "target-standard-event-handler"; + } + for (int block_id = 0; block_id < int(blocks.size()); block_id++) { const auto& block = blocks.at(block_id); const TypeState* init_types = &function.ir2.env.get_types_at_block_entry(block_id); diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index d6e8b560a4..656bf5a2e2 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -15012,7 +15012,7 @@ ;; Failed to read fields. (:methods (attack-info-method-9 (_type_ attack-info process-drawable process-drawable) none 9) - (attack-info-method-10 (_type_ object process-drawable process touching-shapes-entry) attack-info 10) + (compute-intersect-info (_type_ object process-drawable process touching-shapes-entry) attack-info 10) (combine! (_type_ attack-info process-drawable) attack-info 11) ) ) @@ -17037,12 +17037,12 @@ ;; eg: 'flop, 'punch (danger-mode symbol :offset 5984) ;; target-board-spin-check (target-attack-id uint32 :offset 5988) ;; target-board::target-board-handler - (unknown-attack-id00 int32 :offset 5992) ;; target-handler::target-attacked + (attacked-by-id int32 :offset 5992) ;; target-handler::target-attacked ;; how big to make the darkjak bomb collision sphere. (bomb-scale float :offset 5996) ;; target-util::target-danger-set! (attack-count uint64 :offset 6000) ;; target-board::target-board-handler - (unknown-dword06 handle :offset 6008) ;; (method 28 target) - (unknown-time-frame000 time-frame :offset 6016) ;; target-handler::target-send-attack + (send-attack-dest handle :offset 6008) ;; (method 28 target) + (send-attack-time time-frame :offset 6016) ;; target-handler::target-send-attack (unknown-combo-tracker00 combo-tracker :inline :offset 6032) ;; (enter target-running-attack) (unknown-time-frame21 time-frame :offset 6072) ;; (code target-running-attack) (unknown-dword07 int64 :offset 6096) ;; (enter target-double-jump) @@ -17571,9 +17571,9 @@ (:methods (new (symbol type process-drawable) _type_ 0) (effect-control-method-9 (_type_) none 9) ;; (TODO-RENAME-9 (_type_) none 9) - (effect-control-method-10 () none 10) ;; (dummy-10 (_type_ symbol float int) object 10) + (do-effect (_type_ symbol float int) none 10) ;; (dummy-10 (_type_ symbol float int) object 10) (effect-control-method-11 () none 11) ;; (dummy-11 (_type_ symbol float int basic pat-surface) none 11) - (effect-control-method-12 (_type_ symbol float int basic sound-name) int 12) ;; (dummy-12 (_type_ symbol float int basic sound-name) int 12) + (play-effect-sound (_type_ symbol float int basic sound-name) int 12) ;; (dummy-12 (_type_ symbol float int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) (effect-control-method-14 () none 14) ;; (TODO-RENAME-14 (_type_ float float float) none 14) ) @@ -18060,6 +18060,10 @@ (target-warp-out vector vector target) ;; (define-extern target-warp-out state) ;; (state vector vector target) (target-warp-in vector vector target) ;; (define-extern target-warp-in state) ;; (state vector vector target) target-indax-start + (target-racing-start handle) + (target-flut-start handle) + (target-tube-start handle) + ) ) @@ -28729,8 +28733,8 @@ (define-extern target-shoved (function meters meters process (state object object target) object :behavior target)) (define-extern attack-mode-is-invinc (function symbol symbol)) -(define-extern target-attacked (function symbol attack-info process process (state symbol attack-info target) object :behavior target)) -(define-extern target-send-attack (function process uint uint int int uint symbol :behavior target)) +(define-extern target-attacked (function symbol attack-info process touching-shapes-entry (state symbol attack-info target) object :behavior target)) +(define-extern target-send-attack (function process symbol touching-shapes-entry int int uint symbol :behavior target)) (define-extern target-generic-event-handler (function process int symbol event-message-block object :behavior target)) ;; (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-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) @@ -34684,708 +34688,6 @@ (define-extern *ocean-mid-masks-palace* ocean-mid-masks) (define-extern *ocean-map-palace* ocean-map) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; race-h ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(deftype race-turbo-pad (structure) - ((position vector :inline :offset-assert 0) - (handle uint64 :offset-assert 16) - ) - :method-count-assert 9 - :size-assert #x18 - :flag-assert #x900000018 - ) - -(deftype race-decision-point (structure) - ((pos float :offset-assert 0) - (decision-type uint8 :offset-assert 4) - (shortcuts uint8 :offset-assert 5) - (safe-paths uint8 :offset-assert 6) - ) - :method-count-assert 9 - :size-assert #x7 - :flag-assert #x900000007 - ) - -(deftype race-racer-info (structure) - ((rider uint8 :offset-assert 0) - (vehicle uint8 :offset-assert 1) - (flags uint8 :offset-assert 2) - (seek-offset int8 :offset-assert 3) - ) - :method-count-assert 9 - :size-assert #x4 - :flag-assert #x900000004 - ) - -(deftype race-info (basic) - ((race-mesh-name string :offset-assert 4) - (path-group-name string :offset-assert 8) - (task-node uint16 :offset-assert 12) - (mesh basic :offset-assert 16) - (ai-min-speed-factor float :offset-assert 20) - (ai-max-speed-factor float :offset-assert 24) - (ai-spread-factor float :offset-assert 28) - (start-sphere sphere :inline :offset-assert 32) - (start-dir vector :inline :offset-assert 48) - (finish-sphere sphere :inline :offset-assert 64) - (finish-dir vector :inline :offset-assert 80) - (player-intro-pos vector :inline :offset-assert 96) - (flags uint8 :offset-assert 112) - (score uint8 :offset-assert 113) - (lap-count int8 :offset-assert 114) - (racer-count int8 :offset-assert 115) - (turbo-pad-count int8 :offset-assert 116) - (map-index int8 :offset-assert 117) - (decision-point-count int8 :offset-assert 118) - (safe-paths uint8 :offset-assert 119) - (turbo-pad-array (inline-array race-turbo-pad) :offset-assert 120) - (racer-array (inline-array race-racer-info) :offset-assert 124) - (decision-point-array (inline-array race-decision-point) :offset-assert 128) - (level symbol :offset-assert 132) - (borrow-level symbol :offset-assert 136) - (borrow pair :offset-assert 140) - (manager uint64 :offset-assert 144) - (manager-handle-init-hack basic :offset 144) - (hatch-actor-name string :offset-assert 152) - (countdown-scene basic :offset-assert 156) - (complete-continue basic :offset-assert 160) - (start-camera string :offset-assert 164) - (go-speech uint16 :offset-assert 168) - ) - :method-count-assert 10 - :size-assert #xaa - :flag-assert #xa000000aa - (:methods - (race-info-method-9 (_type_) none 9) - ) - ) - -(deftype racer-state (structure) - ((position vector :inline :offset-assert 0) - (racer uint64 :offset-assert 16) - (flags uint8 :offset-assert 24) - (rank int8 :offset-assert 25) - (finish-count int8 :offset-assert 26) - (lap-count int8 :offset-assert 27) - (lap-quadrant int8 :offset-assert 28) - (rider uint8 :offset-assert 29) - (lap-distance float :offset-assert 32) - (lap-distance-prev float :offset-assert 36) - (pos float :offset-assert 40) - (target-pos-offset float :offset-assert 44) - (speed-factor float :offset-assert 48) - (finish-time uint32 :offset-assert 52) - (lap-start uint32 :offset-assert 56) - (best-lap-time uint32 :offset-assert 60) - (lap-time-array float 5 :offset-assert 64) ;; kinda a guess, too small to be time-frames - (start-position vector :inline :offset-assert 96) - ) - :method-count-assert 14 - :size-assert #x70 - :flag-assert #xe00000070 - (:methods - (racer-state-method-9 () none 9) - (racer-state-method-10 () none 10) - (racer-state-method-11 () none 11) - (racer-state-method-12 () none 12) - (racer-state-method-13 () none 13) - ) - ) - -(deftype race-state (structure) - ((info basic :offset-assert 0) - (flags uint8 :offset-assert 4) - (state uint8 :offset-assert 5) - (racer-count int8 :offset-assert 6) - (finished-count int8 :offset-assert 7) - (i-player int8 :offset-assert 8) - (i-countdown int8 :offset-assert 9) - (manager uint64 :offset-assert 16) - (scene-player uint64 :offset-assert 24) - (race-signal uint64 :offset-assert 32) - (arrow uint64 :offset-assert 40) - (hud-timer uint64 :offset-assert 48) - (hud-lap-counter uint64 :offset-assert 56) - (hud-turbo-counter uint64 :offset-assert 64) - (hud-position uint64 :offset-assert 72) - (current-time uint32 :offset-assert 80) - (countdown-start-time uint32 :offset-assert 84) - (race-start-time uint32 :offset-assert 88) - (rankings int8 10 :offset-assert 92) ;; weird size - (target-pos float :offset-assert 104) - (suck-factor float :offset-assert 108) - (racer-array racer-state 10 :inline :offset-assert 112) - (player-intro-curve cubic-curve :inline :offset-assert 1232) - ) - :method-count-assert 19 - :size-assert #x510 - :flag-assert #x1300000510 - (:methods - (race-state-method-9 () none 9) - (race-state-method-10 () none 10) - (race-state-method-11 () none 11) - (race-state-method-12 () none 12) - (race-state-method-13 () none 13) - (race-state-method-14 () none 14) - (race-state-method-15 () none 15) - (race-state-method-16 () none 16) - (race-state-method-17 () none 17) - (race-state-method-18 () none 18) - ) - ) - -(deftype race-manager (process) - ((race-state race-state :offset-assert 128) - (state-time time-frame :offset-assert 136) - (player-on-track-time time-frame :offset-assert 144) - (message-id uint32 :offset-assert 152) - (finish-sound-id uint32 :offset-assert 156) - ) - :method-count-assert 28 - :size-assert #xa0 - :flag-assert #x1c002000a0 - (:methods - (idle () _type_ :state 14) - (active () _type_ :state 15) - (fail () _type_ :state 16) - (win () _type_ :state 17) - (lose () _type_ :state 18) - (die () _type_ :state 19) - (race-manager-method-20 () none 20) - (race-manager-method-21 () none 21) - (race-manager-method-22 () none 22) - (race-manager-method-23 () none 23) - (race-manager-method-24 () none 24) - (race-manager-method-25 () none 25) - (race-manager-method-26 () none 26) - (race-manager-method-27 () none 27) - ) - ) - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; race-mesh ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype race-mesh-hash-search (structure) - ((best-dist float :offset-assert 0) - (debug-cells-searched int32 :offset-assert 4) - (debug-slices-searched int32 :offset-assert 8) - (bounds bounding-box4w :inline :offset-assert 16) - (cell-quads UNKNOWN 2 :offset-assert 48) - (slice-quads UNKNOWN 4 :offset-assert 80) - (cell-bits UNKNOWN 2 :offset-assert 48) - (slice-bits UNKNOWN 2 :offset-assert 80) - ) - :method-count-assert 9 - :size-assert #x90 - :flag-assert #x900000090 - ) -|# - -#| -(deftype race-mesh-slice-query (structure) - ((slice-id int16 :offset-assert 0) - (lap-dist float :offset-assert 4) - (pt-on-slice vector :inline :offset-assert 16) - (slice-corners UNKNOWN 4 :offset-assert 32) - (search-sphere sphere :inline :offset-assert 96) - ) - :method-count-assert 9 - :size-assert #x70 - :flag-assert #x900000070 - ) -|# - -#| -(deftype race-path-edge-info (structure) - ((sample-t float :offset-assert 0) - ) - :method-count-assert 9 - :size-assert #x4 - :flag-assert #x900000004 - ) -|# - -#| -(deftype race-path-sample (structure) - ((bytes UNKNOWN 32 :offset-assert 0) - (pos vector :inline :offset-assert 0) - (quat quaternion :inline :offset-assert 16) - (stick-x int8 :offset-assert 12) - (stick-y int8 :offset-assert 13) - (throttle uint8 :offset-assert 14) - (flags uint8 :offset-assert 15) - ) - :method-count-assert 9 - :size-assert #x20 - :flag-assert #x900000020 - ) -|# - -#| -(deftype race-path (structure) - ((sample-count uint16 :offset-assert 0) - (record-id int8 :offset-assert 2) - (pad uint8 :offset-assert 3) - (samples uint32 :offset-assert 4) - (edge-infos uint32 :offset-assert 8) - ) - :method-count-assert 13 - :size-assert #xc - :flag-assert #xd0000000c - (:methods - (race-path-method-9 () none 9) - (race-path-method-10 () none 10) - (race-path-method-11 () none 11) - (race-path-method-12 () none 12) - ) - ) -|# - -#| -(deftype race-path-group (structure) - ((name basic :offset-assert 0) - (path-count int8 :offset-assert 4) - (pad UNKNOWN 3 :offset-assert 5) - (paths uint32 :offset-assert 8) - ) - :method-count-assert 9 - :size-assert #xc - :flag-assert #x90000000c - ) -|# - -#| -(deftype race-mesh-edge (structure) - ((left vector :inline :offset-assert 0) - (right vector :inline :offset-assert 16) - (lap-dist float :offset-assert 12) - ) - :method-count-assert 9 - :size-assert #x20 - :flag-assert #x900000020 - ) -|# - -#| -(deftype race-mesh-slice (structure) - ((edge-index-array UNKNOWN 2 :offset-assert 0) - (start-edge int16 :offset-assert 0) - (end-edge int16 :offset-assert 2) - ) - :method-count-assert 9 - :size-assert #x4 - :flag-assert #x900000004 - ) -|# - -#| -(deftype race-mesh-hash-cell (structure) - ((first-slice int16 :offset-assert 0) - (slice-count uint8 :offset-assert 2) - (pad uint8 :offset-assert 3) - ) - :method-count-assert 9 - :size-assert #x4 - :flag-assert #x900000004 - ) -|# - -#| -(deftype race-mesh-hash (structure) - ((cells-wide int8 :offset-assert 0) - (cells-tall int8 :offset-assert 1) - (cell-length float :offset-assert 4) - (cells uint32 :offset-assert 8) - (slice-table uint32 :offset-assert 12) - (origin vector :inline :offset-assert 16) - ) - :method-count-assert 9 - :size-assert #x20 - :flag-assert #x900000020 - ) -|# - -#| -(deftype race-mesh (basic) - ((version uint8 :offset-assert 4) - (path-group-count uint8 :offset-assert 5) - (flags uint8 :offset-assert 6) - (pad UNKNOWN 1 :offset-assert 7) - (slice-count int16 :offset-assert 8) - (edge-count int16 :offset-assert 10) - (slices uint32 :offset-assert 12) - (edges uint32 :offset-assert 16) - (hash race-mesh-hash :offset-assert 20) - (path-groups uint32 :offset-assert 24) - ) - :method-count-assert 20 - :size-assert #x1c - :flag-assert #x140000001c - (:methods - (race-mesh-method-9 () none 9) - (race-mesh-method-10 () none 10) - (race-mesh-method-11 () none 11) - (race-mesh-method-12 () none 12) - (race-mesh-method-13 () none 13) - (race-mesh-method-14 () none 14) - (race-mesh-method-15 () none 15) - (race-mesh-method-16 () none 16) - (race-mesh-method-17 () none 17) - (race-mesh-method-18 () none 18) - (race-mesh-method-19 () none 19) - ) - ) -|# - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; race-part ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; race-obs ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype race-signal-banner (process-drawable) - () - :method-count-assert 21 - :size-assert #xc8 - :flag-assert #x15005000c8 - (:methods - (idle () _type_ :state 20) - ) - ) -|# - -#| -(deftype race-signal (process-drawable) - ((pos vector :inline :offset-assert 204) - (y-offset float :offset-assert 220) - (dest-y-offset float :offset-assert 224) - (bob-time time-frame :offset-assert 228) - (start-time time-frame :offset-assert 236) - (banner uint64 :offset-assert 244) - (curve cubic-curve :inline :offset-assert 252) - ) - :method-count-assert 30 - :size-assert #x140 - :flag-assert #x1e00c00140 - (:methods - (spawn-banner () _type_ :state 20) - (idle () _type_ :state 21) - (count-3 () _type_ :state 22) - (count-2 () _type_ :state 23) - (count-1 () _type_ :state 24) - (count-go () _type_ :state 25) - (die () _type_ :state 26) - (test () _type_ :state 27) - (race-signal-method-28 () none 28) - (race-signal-method-29 () none 29) - ) - ) -|# - -#| -(deftype stadium-racer (vehicle-rider) - ((rider-type uint8 :offset-assert 217) - ) - :method-count-assert 36 - :size-assert #xde - :flag-assert #x24006000de - (:methods - ) - ) -|# - -#| -(deftype errol-rider (stadium-racer) - () - :method-count-assert 36 - :size-assert #xde - :flag-assert #x24006000de - (:methods - ) - ) -|# - -#| -(deftype turbo-pickup (process-drawable) - ((available basic :offset-assert 196) - ) - :method-count-assert 23 - :size-assert #xcc - :flag-assert #x17005000cc - (:methods - (idle () _type_ :state 20) - (die () _type_ :state 21) - (turbo-pickup-method-22 () none 22) - ) - ) -|# - -;; (define-extern race-signal-banner-init-by-other function) -;; (define-extern race-signal-banner-spawn function) -;; (define-extern race-signal-event-handler function) -;; (define-extern race-signal-init-by-other function) -;; (define-extern race-signal-spawn function) -;; (define-extern turbo-pickup-init-by-other function) -;; (define-extern turbo-pickup-spawn function) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; vehicle-racer ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype race-control (structure) - ((state race-state :offset-assert 0) - (mesh basic :offset-assert 4) - (path-select int8 :offset-assert 8) - (path-group race-path-group :offset-assert 12) - (path race-path :offset-assert 16) - (path-t float :offset-assert 20) - (racer-state racer-state :offset-assert 24) - (path-sample race-path-sample :inline :offset-assert 32) - (lin-velocity vector :inline :offset-assert 64) - (ang-velocity vector :inline :offset-assert 80) - ) - :method-count-assert 13 - :size-assert #x60 - :flag-assert #xd00000060 - (:methods - (race-control-method-9 () none 9) - (race-control-method-10 () none 10) - (race-control-method-11 () none 11) - (race-control-method-12 () none 12) - ) - ) -|# - -#| -(deftype vehicle-racer (vehicle) - ((race race-control :inline :offset-assert 876) - (ai-controls vehicle-controls :inline :offset-assert 972) - (rider-hand-joint int8 :offset-assert 988) - (turbo-pickup-count int8 :offset-assert 989) - (minimap connection-minimap :offset-assert 992) - (shortcut-speed-factor float :offset-assert 996) - (path-deviation float :offset-assert 1000) - (shortcut-time time-frame :offset-assert 1004) - ) - :method-count-assert 156 - :size-assert #x3f8 - :flag-assert #x9c038003f8 - (:methods - (waiting-race () _type_ :state 144) - (waiting-for-start () _type_ :state 145) - (racing () _type_ :state 146) - (race-finished () _type_ :state 147) - (vehicle-racer-method-148 () none 148) - (vehicle-racer-method-149 () none 149) - (vehicle-racer-method-150 () none 150) - (vehicle-racer-method-151 () none 151) - (vehicle-racer-method-152 () none 152) - (vehicle-racer-method-153 () none 153) - (vehicle-racer-method-154 () none 154) - (vehicle-racer-method-155 () none 155) - ) - ) -|# - - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; race-info ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(define-extern *race-info-array* (array race-info)) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; race-manager ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -(define-extern race-find-ground (function object none)) -(define-extern *race-state* race-state) -(define-extern *race-rigid-body-queue* rigid-body-queue) -;; (define-extern race-manager-event-handler function) -(define-extern *race-manager* race-manager) -;; (define-extern race-manager-init-by-other function) -;; (define-extern race-start function) -;; (define-extern race-kill function) -;; (define-extern type-from-race-vehicle-type function) -;; (define-extern race-vehicle-entity-hack function) -;; (define-extern race-level-activate function) -;; (define-extern race-level-deactivate function) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; race-hud ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; (define-extern rminutes function) -;; (define-extern rseconds function) -;; (define-extern rmicroseconds function) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; pilot-recorder ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype pilrec-sample (structure) - ((sample-time time-frame :offset-assert 0) - (pos vector :inline :offset-assert 16) - (quat quaternion :inline :offset-assert 32) - (stick-x float :offset-assert 48) - (stick-y float :offset-assert 52) - (throttle float :offset-assert 56) - (flags uint8 :offset-assert 60) - ) - :method-count-assert 9 - :size-assert #x3d - :flag-assert #x90000003d - ) -|# - -#| -(deftype pilot-recorder-samples (basic) - ((samples uint32 :offset-assert 4) - ) - :method-count-assert 9 - :size-assert #x8 - :flag-assert #x900000008 - ) -|# - -#| -(deftype pilot-recorder (process) - ((info basic :offset-assert 124) - (mesh basic :offset-assert 128) - (select-race uint64 :offset-assert 132) - (path-num int32 :offset-assert 140) - (sample-count int32 :offset-assert 144) - (samples uint32 :offset-assert 148) - (state-time time-frame :offset-assert 156) - (start-time time-frame :offset-assert 164) - (start-record-plane plane :inline :offset-assert 172) - (start-record-center vector :inline :offset-assert 188) - (finish-record-plane plane :inline :offset-assert 204) - (finish-record-center vector :inline :offset-assert 220) - (prev-pos vector :inline :offset-assert 236) - ) - :method-count-assert 31 - :size-assert #x100 - :flag-assert #x1f00800100 - (:methods - (pilot-recorder-method-9 () none 9) - (pilot-recorder-method-10 () none 10) - (pilot-recorder-method-11 () none 11) - (pilot-recorder-method-12 () none 12) - (pilot-recorder-method-13 () none 13) - (die-fast () _type_ :state 14) - (idle () _type_ :state 15) - (active () _type_ :state 16) - (recording () _type_ :state 17) - (fail-full () _type_ :state 18) - (finished () _type_ :state 19) - (save () _type_ :state 20) - (fail-save () _type_ :state 21) - (pilot-recorder-method-22 () none 22) - (pilot-recorder-method-23 () none 23) - (pilot-recorder-method-24 () none 24) - (pilot-recorder-method-25 () none 25) - (pilot-recorder-method-26 () none 26) - (pilot-recorder-method-27 () none 27) - (pilot-recorder-method-28 () none 28) - (pilot-recorder-method-29 () none 29) - (pilot-recorder-method-30 () none 30) - ) - ) -|# - -;; (define-extern *pilot-recorder-samples* object) -;; (define-extern delete-race-path function) -;; (define-extern *pilot-recorder* object) -;; (define-extern pilot-recorder-init-by-other function) -;; (define-extern start-pilot-recorder function) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; racebike ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype vehicle-race-bike (vehicle-racer) - ((steering-wheel basic :offset-assert 1012) - ) - :method-count-assert 156 - :size-assert #x3fc - :flag-assert #x9c038003fc - (:methods - ) - ) -|# - -#| -(deftype race-bike-d (vehicle-race-bike) - () - :method-count-assert 156 - :size-assert #x3fc - :flag-assert #x9c038003fc - (:methods - ) - ) -|# - -#| -(deftype race-bike-e (vehicle-race-bike) - () - :method-count-assert 156 - :size-assert #x3fc - :flag-assert #x9c038003fc - (:methods - ) - ) -|# - -;; (define-extern *race-bike-d-constants* object) -;; (define-extern *race-bike-e-constants* object) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; stadium-race-obs ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype stdmb-race-hatch (process-drawable) - ((tt float :offset-assert 196) - (tt-target float :offset-assert 200) - ) - :method-count-assert 23 - :size-assert #xd0 - :flag-assert #x17005000d0 - (:methods - (idle () _type_ :state 20) - (stdmb-race-hatch-method-21 () none 21) - (stdmb-race-hatch-method-22 () none 22) - ) - ) -|# - -#| -(deftype stdmb-platform (stdmb-race-hatch) - () - :method-count-assert 23 - :size-assert #xd0 - :flag-assert #x17005000d0 - (:methods - ) - ) -|# - -;; (define-extern stdmb-race-hatch-init-by-other function) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; spyder ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -37750,7 +37052,7 @@ ;; (define-extern target-turret-post function) ;; (define-extern target-turret-stance state) ;; (define-extern *turret-get-on-mods* object) -;; (define-extern target-turret-get-on state) +(define-extern target-turret-get-on (state handle target)) ;; (define-extern target-turret-get-off state) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -43930,93 +43232,6 @@ ;; (define-extern demo-control-init function) (define-extern target-demo (state symbol target)) -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; errol-chal-part ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;; (define-extern city-race-borrow-level-activate function) - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; errol-chal ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -#| -(deftype errol-racer (vehicle-rider) - ((minimap connection-minimap :offset-assert 220) - ) - :method-count-assert 36 - :size-assert #xe4 - :flag-assert #x24007000e4 - (:methods - ) - ) -|# - -#| -(deftype vehicle-city-racer (vehicle-racer) - () - :method-count-assert 156 - :size-assert #x3f8 - :flag-assert #x9c038003f8 - (:methods - ) - ) -|# - -#| -(deftype race-bike-a (vehicle-city-racer) - () - :method-count-assert 156 - :size-assert #x3f8 - :flag-assert #x9c038003f8 - (:methods - ) - ) -|# - -#| -(deftype race-bike-b (vehicle-city-racer) - () - :method-count-assert 156 - :size-assert #x3f8 - :flag-assert #x9c038003f8 - (:methods - ) - ) -|# - -#| -(deftype turbo-ring (process-drawable) - ((touch-time time-frame :offset-assert 196) - (minimap connection-minimap :offset-assert 204) - (player-got basic :offset-assert 208) - (persistent basic :offset-assert 212) - (id int8 :offset-assert 216) - (boost float :offset-assert 220) - (plane vector :inline :offset-assert 236) - (part-track uint64 :offset-assert 252) - (mat matrix :inline :offset-assert 268) - ) - :method-count-assert 25 - :size-assert #x150 - :flag-assert #x1900d00150 - (:methods - (idle () _type_ :state 20) - (die () _type_ :state 21) - (turbo-ring-method-22 () none 22) - (turbo-ring-method-23 () none 23) - (turbo-ring-method-24 () none 24) - ) - ) -|# - -;; (define-extern *race-bike-a-constants* object) -;; (define-extern *race-bike-b-constants* object) -;; (define-extern turbo-ring-init-by-other function) -;; (define-extern turbo-ring-spawn function) -;; (define-extern *city-errol-challenge-rings* array) -;; (define-extern *city-bush-port-rings* array) - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; credits ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -45290,7 +44505,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; (define-extern *mech-exploder-params* joint-exploder-static-params) -;; (define-extern target-mech-start state) +(define-extern target-mech-start (state handle target)) ;; (define-extern target-mech-stance state) ;; (define-extern target-mech-walk state) ;; (define-extern target-mech-punch-pick function) @@ -49980,6 +49195,21 @@ :flag-assert #x900000004 ) +(defenum vehicle-type + :type int32 + (bikea 0) + (bikeb 1) + (bikec 2) + (cara 3) + (carb 4) + (carc 5) + (guard-bike 6) + (hellcat 7) + (evan-test-bike 8) + (test-bike 9) + (test-car 10) + ) + (deftype vehicle (rigid-body-object) ( (pad uint32 4 :offset-assert 272) @@ -50569,9 +49799,9 @@ ) |# -#| (deftype vehicle-guard (vehicle) - () + ((pad2 uint8 196) + ) :method-count-assert 159 :size-assert #x434 :flag-assert #x9f03c00434 @@ -50594,7 +49824,6 @@ (vehicle-guard-method-158 () none 158) ) ) -|# ;; (define-extern vehicle-los-clear? function) ;; (define-extern vehicle-draw-beam function) @@ -50678,10 +49907,661 @@ ;; (define-extern transport-init-by-other function) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; bike ;; +;; race-h ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deftype race-turbo-pad (structure) + ((position vector :inline :offset-assert 0) + (handle uint64 :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x18 + :flag-assert #x900000018 + ) + +(deftype race-decision-point (structure) + ((pos float :offset-assert 0) + (decision-type uint8 :offset-assert 4) + (shortcuts uint8 :offset-assert 5) + (safe-paths uint8 :offset-assert 6) + ) + :method-count-assert 9 + :size-assert #x7 + :flag-assert #x900000007 + ) + +(deftype race-racer-info (structure) + ((rider uint8 :offset-assert 0) + (vehicle uint8 :offset-assert 1) + (flags uint8 :offset-assert 2) + (seek-offset int8 :offset-assert 3) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) + +(deftype race-info (basic) + ((race-mesh-name string :offset-assert 4) + (path-group-name string :offset-assert 8) + (task-node uint16 :offset-assert 12) + (mesh basic :offset-assert 16) + (ai-min-speed-factor float :offset-assert 20) + (ai-max-speed-factor float :offset-assert 24) + (ai-spread-factor float :offset-assert 28) + (start-sphere sphere :inline :offset-assert 32) + (start-dir vector :inline :offset-assert 48) + (finish-sphere sphere :inline :offset-assert 64) + (finish-dir vector :inline :offset-assert 80) + (player-intro-pos vector :inline :offset-assert 96) + (flags uint8 :offset-assert 112) + (score uint8 :offset-assert 113) + (lap-count int8 :offset-assert 114) + (racer-count int8 :offset-assert 115) + (turbo-pad-count int8 :offset-assert 116) + (map-index int8 :offset-assert 117) + (decision-point-count int8 :offset-assert 118) + (safe-paths uint8 :offset-assert 119) + (turbo-pad-array (inline-array race-turbo-pad) :offset-assert 120) + (racer-array (inline-array race-racer-info) :offset-assert 124) + (decision-point-array (inline-array race-decision-point) :offset-assert 128) + (level symbol :offset-assert 132) + (borrow-level symbol :offset-assert 136) + (borrow pair :offset-assert 140) + (manager uint64 :offset-assert 144) + (manager-handle-init-hack basic :offset 144) + (hatch-actor-name string :offset-assert 152) + (countdown-scene basic :offset-assert 156) + (complete-continue basic :offset-assert 160) + (start-camera string :offset-assert 164) + (go-speech uint16 :offset-assert 168) + ) + :method-count-assert 10 + :size-assert #xaa + :flag-assert #xa000000aa + (:methods + (race-info-method-9 (_type_) none 9) + ) + ) + +(deftype racer-state (structure) + ((position vector :inline :offset-assert 0) + (racer uint64 :offset-assert 16) + (flags uint8 :offset-assert 24) + (rank int8 :offset-assert 25) + (finish-count int8 :offset-assert 26) + (lap-count int8 :offset-assert 27) + (lap-quadrant int8 :offset-assert 28) + (rider uint8 :offset-assert 29) + (lap-distance float :offset-assert 32) + (lap-distance-prev float :offset-assert 36) + (pos float :offset-assert 40) + (target-pos-offset float :offset-assert 44) + (speed-factor float :offset-assert 48) + (finish-time uint32 :offset-assert 52) + (lap-start uint32 :offset-assert 56) + (best-lap-time uint32 :offset-assert 60) + (lap-time-array float 5 :offset-assert 64) ;; kinda a guess, too small to be time-frames + (start-position vector :inline :offset-assert 96) + ) + :method-count-assert 14 + :size-assert #x70 + :flag-assert #xe00000070 + (:methods + (racer-state-method-9 () none 9) + (racer-state-method-10 () none 10) + (racer-state-method-11 () none 11) + (racer-state-method-12 () none 12) + (racer-state-method-13 () none 13) + ) + ) + +(deftype race-state (structure) + ((info basic :offset-assert 0) + (flags uint8 :offset-assert 4) + (state uint8 :offset-assert 5) + (racer-count int8 :offset-assert 6) + (finished-count int8 :offset-assert 7) + (i-player int8 :offset-assert 8) + (i-countdown int8 :offset-assert 9) + (manager uint64 :offset-assert 16) + (scene-player uint64 :offset-assert 24) + (race-signal uint64 :offset-assert 32) + (arrow uint64 :offset-assert 40) + (hud-timer uint64 :offset-assert 48) + (hud-lap-counter uint64 :offset-assert 56) + (hud-turbo-counter uint64 :offset-assert 64) + (hud-position uint64 :offset-assert 72) + (current-time uint32 :offset-assert 80) + (countdown-start-time uint32 :offset-assert 84) + (race-start-time uint32 :offset-assert 88) + (rankings int8 10 :offset-assert 92) ;; weird size + (target-pos float :offset-assert 104) + (suck-factor float :offset-assert 108) + (racer-array racer-state 10 :inline :offset-assert 112) + (player-intro-curve cubic-curve :inline :offset-assert 1232) + ) + :method-count-assert 19 + :size-assert #x510 + :flag-assert #x1300000510 + (:methods + (race-state-method-9 () none 9) + (race-state-method-10 () none 10) + (race-state-method-11 () none 11) + (race-state-method-12 () none 12) + (race-state-method-13 () none 13) + (race-state-method-14 () none 14) + (race-state-method-15 () none 15) + (race-state-method-16 () none 16) + (race-state-method-17 () none 17) + (race-state-method-18 () none 18) + ) + ) + +(deftype race-manager (process) + ((race-state race-state :offset-assert 128) + (state-time time-frame :offset-assert 136) + (player-on-track-time time-frame :offset-assert 144) + (message-id uint32 :offset-assert 152) + (finish-sound-id uint32 :offset-assert 156) + ) + :method-count-assert 28 + :size-assert #xa0 + :flag-assert #x1c002000a0 + (:methods + (idle () _type_ :state 14) + (active () _type_ :state 15) + (fail () _type_ :state 16) + (win () _type_ :state 17) + (lose () _type_ :state 18) + (die () _type_ :state 19) + (race-manager-method-20 () none 20) + (race-manager-method-21 () none 21) + (race-manager-method-22 () none 22) + (race-manager-method-23 () none 23) + (race-manager-method-24 () none 24) + (race-manager-method-25 () none 25) + (race-manager-method-26 () none 26) + (race-manager-method-27 () none 27) + ) + ) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; race-mesh ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; #| +(deftype race-mesh-hash-search (structure) + ((best-dist float :offset-assert 0) + (debug-cells-searched int32 :offset-assert 4) + (debug-slices-searched int32 :offset-assert 8) + (bounds bounding-box4w :inline :offset-assert 16) + (cell-quads UNKNOWN 2 :offset-assert 48) + (slice-quads UNKNOWN 4 :offset-assert 80) + (cell-bits UNKNOWN 2 :offset-assert 48) + (slice-bits UNKNOWN 2 :offset-assert 80) + ) + :method-count-assert 9 + :size-assert #x90 + :flag-assert #x900000090 + ) +|# + +#| +(deftype race-mesh-slice-query (structure) + ((slice-id int16 :offset-assert 0) + (lap-dist float :offset-assert 4) + (pt-on-slice vector :inline :offset-assert 16) + (slice-corners UNKNOWN 4 :offset-assert 32) + (search-sphere sphere :inline :offset-assert 96) + ) + :method-count-assert 9 + :size-assert #x70 + :flag-assert #x900000070 + ) +|# + +#| +(deftype race-path-edge-info (structure) + ((sample-t float :offset-assert 0) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) +|# + +(deftype race-path-sample (structure) + ((bytes uint8 32 :offset-assert 0) + (pos vector :inline :offset 0) + (quat quaternion :inline :offset 16) + (stick-x int8 :offset 12) + (stick-y int8 :offset 13) + (throttle uint8 :offset 14) + (flags uint8 :offset 15) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) + +(deftype race-path (structure) + ((sample-count uint16 :offset-assert 0) + (record-id int8 :offset-assert 2) + (pad uint8 :offset-assert 3) + (samples uint32 :offset-assert 4) + (edge-infos uint32 :offset-assert 8) + ) + :method-count-assert 13 + :size-assert #xc + :flag-assert #xd0000000c + (:methods + (race-path-method-9 () none 9) + (race-path-method-10 () none 10) + (race-path-method-11 () none 11) + (race-path-method-12 () none 12) + ) + ) + +(deftype race-path-group (structure) + ((name basic :offset-assert 0) + (path-count int8 :offset-assert 4) + (pad uint8 3 :offset-assert 5) + (paths uint32 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +#| +(deftype race-mesh-edge (structure) + ((left vector :inline :offset-assert 0) + (right vector :inline :offset-assert 16) + (lap-dist float :offset-assert 12) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) +|# + +#| +(deftype race-mesh-slice (structure) + ((edge-index-array UNKNOWN 2 :offset-assert 0) + (start-edge int16 :offset-assert 0) + (end-edge int16 :offset-assert 2) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) +|# + +#| +(deftype race-mesh-hash-cell (structure) + ((first-slice int16 :offset-assert 0) + (slice-count uint8 :offset-assert 2) + (pad uint8 :offset-assert 3) + ) + :method-count-assert 9 + :size-assert #x4 + :flag-assert #x900000004 + ) +|# + +#| +(deftype race-mesh-hash (structure) + ((cells-wide int8 :offset-assert 0) + (cells-tall int8 :offset-assert 1) + (cell-length float :offset-assert 4) + (cells uint32 :offset-assert 8) + (slice-table uint32 :offset-assert 12) + (origin vector :inline :offset-assert 16) + ) + :method-count-assert 9 + :size-assert #x20 + :flag-assert #x900000020 + ) +|# + +#| +(deftype race-mesh (basic) + ((version uint8 :offset-assert 4) + (path-group-count uint8 :offset-assert 5) + (flags uint8 :offset-assert 6) + (pad UNKNOWN 1 :offset-assert 7) + (slice-count int16 :offset-assert 8) + (edge-count int16 :offset-assert 10) + (slices uint32 :offset-assert 12) + (edges uint32 :offset-assert 16) + (hash race-mesh-hash :offset-assert 20) + (path-groups uint32 :offset-assert 24) + ) + :method-count-assert 20 + :size-assert #x1c + :flag-assert #x140000001c + (:methods + (race-mesh-method-9 () none 9) + (race-mesh-method-10 () none 10) + (race-mesh-method-11 () none 11) + (race-mesh-method-12 () none 12) + (race-mesh-method-13 () none 13) + (race-mesh-method-14 () none 14) + (race-mesh-method-15 () none 15) + (race-mesh-method-16 () none 16) + (race-mesh-method-17 () none 17) + (race-mesh-method-18 () none 18) + (race-mesh-method-19 () none 19) + ) + ) +|# + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; race-part ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; race-obs ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +#| +(deftype race-signal-banner (process-drawable) + () + :method-count-assert 21 + :size-assert #xc8 + :flag-assert #x15005000c8 + (:methods + (idle () _type_ :state 20) + ) + ) +|# + +#| +(deftype race-signal (process-drawable) + ((pos vector :inline :offset-assert 204) + (y-offset float :offset-assert 220) + (dest-y-offset float :offset-assert 224) + (bob-time time-frame :offset-assert 228) + (start-time time-frame :offset-assert 236) + (banner uint64 :offset-assert 244) + (curve cubic-curve :inline :offset-assert 252) + ) + :method-count-assert 30 + :size-assert #x140 + :flag-assert #x1e00c00140 + (:methods + (spawn-banner () _type_ :state 20) + (idle () _type_ :state 21) + (count-3 () _type_ :state 22) + (count-2 () _type_ :state 23) + (count-1 () _type_ :state 24) + (count-go () _type_ :state 25) + (die () _type_ :state 26) + (test () _type_ :state 27) + (race-signal-method-28 () none 28) + (race-signal-method-29 () none 29) + ) + ) +|# + +#| +(deftype stadium-racer (vehicle-rider) + ((rider-type uint8 :offset-assert 217) + ) + :method-count-assert 36 + :size-assert #xde + :flag-assert #x24006000de + (:methods + ) + ) +|# + +#| +(deftype errol-rider (stadium-racer) + () + :method-count-assert 36 + :size-assert #xde + :flag-assert #x24006000de + (:methods + ) + ) +|# + +#| +(deftype turbo-pickup (process-drawable) + ((available basic :offset-assert 196) + ) + :method-count-assert 23 + :size-assert #xcc + :flag-assert #x17005000cc + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (turbo-pickup-method-22 () none 22) + ) + ) +|# + +;; (define-extern race-signal-banner-init-by-other function) +;; (define-extern race-signal-banner-spawn function) +;; (define-extern race-signal-event-handler function) +;; (define-extern race-signal-init-by-other function) +;; (define-extern race-signal-spawn function) +;; (define-extern turbo-pickup-init-by-other function) +;; (define-extern turbo-pickup-spawn function) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; vehicle-racer ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deftype race-control (structure) + ((state race-state :offset-assert 0) + (mesh basic :offset-assert 4) + (path-select int8 :offset-assert 8) + (path-group race-path-group :offset-assert 12) + (path race-path :offset-assert 16) + (path-t float :offset-assert 20) + (racer-state racer-state :offset-assert 24) + (path-sample race-path-sample :inline :offset-assert 32) + (lin-velocity vector :inline :offset-assert 64) + (ang-velocity vector :inline :offset-assert 80) + ) + :method-count-assert 13 + :size-assert #x60 + :flag-assert #xd00000060 + (:methods + (race-control-method-9 () none 9) + (race-control-method-10 () none 10) + (race-control-method-11 () none 11) + (race-control-method-12 () none 12) + ) + ) + +(deftype vehicle-racer (vehicle) + ((race race-control :inline :offset-assert 880) + (ai-controls vehicle-controls :inline :offset-assert 976) + (rider-hand-joint int8 :offset-assert 992) + (turbo-pickup-count int8 :offset-assert 993) + (minimap connection-minimap :offset-assert 996) + (shortcut-speed-factor float :offset-assert 1000) + (path-deviation float :offset-assert 1004) + (shortcut-time time-frame :offset-assert 1008) + ) + :method-count-assert 156 + :size-assert #x3f8 + :flag-assert #x9c038003f8 + (:methods + (waiting-race () _type_ :state 144) + (waiting-for-start () _type_ :state 145) + (racing () _type_ :state 146) + (race-finished () _type_ :state 147) + (vehicle-racer-method-148 () none 148) + (vehicle-racer-method-149 () none 149) + (vehicle-racer-method-150 () none 150) + (vehicle-racer-method-151 () none 151) + (vehicle-racer-method-152 () none 152) + (vehicle-racer-method-153 () none 153) + (vehicle-racer-method-154 () none 154) + (vehicle-racer-method-155 () none 155) + ) + ) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; race-info ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-extern *race-info-array* (array race-info)) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; race-manager ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(define-extern race-find-ground (function object none)) +(define-extern *race-state* race-state) +(define-extern *race-rigid-body-queue* rigid-body-queue) +;; (define-extern race-manager-event-handler function) +(define-extern *race-manager* race-manager) +;; (define-extern race-manager-init-by-other function) +;; (define-extern race-start function) +;; (define-extern race-kill function) +(define-extern type-from-race-vehicle-type (function int type)) +;; (define-extern race-vehicle-entity-hack function) +;; (define-extern race-level-activate function) +;; (define-extern race-level-deactivate function) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; race-hud ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; (define-extern rminutes function) +;; (define-extern rseconds function) +;; (define-extern rmicroseconds function) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; pilot-recorder ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +#| +(deftype pilrec-sample (structure) + ((sample-time time-frame :offset-assert 0) + (pos vector :inline :offset-assert 16) + (quat quaternion :inline :offset-assert 32) + (stick-x float :offset-assert 48) + (stick-y float :offset-assert 52) + (throttle float :offset-assert 56) + (flags uint8 :offset-assert 60) + ) + :method-count-assert 9 + :size-assert #x3d + :flag-assert #x90000003d + ) +|# + +#| +(deftype pilot-recorder-samples (basic) + ((samples uint32 :offset-assert 4) + ) + :method-count-assert 9 + :size-assert #x8 + :flag-assert #x900000008 + ) +|# + +#| +(deftype pilot-recorder (process) + ((info basic :offset-assert 124) + (mesh basic :offset-assert 128) + (select-race uint64 :offset-assert 132) + (path-num int32 :offset-assert 140) + (sample-count int32 :offset-assert 144) + (samples uint32 :offset-assert 148) + (state-time time-frame :offset-assert 156) + (start-time time-frame :offset-assert 164) + (start-record-plane plane :inline :offset-assert 172) + (start-record-center vector :inline :offset-assert 188) + (finish-record-plane plane :inline :offset-assert 204) + (finish-record-center vector :inline :offset-assert 220) + (prev-pos vector :inline :offset-assert 236) + ) + :method-count-assert 31 + :size-assert #x100 + :flag-assert #x1f00800100 + (:methods + (pilot-recorder-method-9 () none 9) + (pilot-recorder-method-10 () none 10) + (pilot-recorder-method-11 () none 11) + (pilot-recorder-method-12 () none 12) + (pilot-recorder-method-13 () none 13) + (die-fast () _type_ :state 14) + (idle () _type_ :state 15) + (active () _type_ :state 16) + (recording () _type_ :state 17) + (fail-full () _type_ :state 18) + (finished () _type_ :state 19) + (save () _type_ :state 20) + (fail-save () _type_ :state 21) + (pilot-recorder-method-22 () none 22) + (pilot-recorder-method-23 () none 23) + (pilot-recorder-method-24 () none 24) + (pilot-recorder-method-25 () none 25) + (pilot-recorder-method-26 () none 26) + (pilot-recorder-method-27 () none 27) + (pilot-recorder-method-28 () none 28) + (pilot-recorder-method-29 () none 29) + (pilot-recorder-method-30 () none 30) + ) + ) +|# + +;; (define-extern *pilot-recorder-samples* object) +;; (define-extern delete-race-path function) +;; (define-extern *pilot-recorder* object) +;; (define-extern pilot-recorder-init-by-other function) +;; (define-extern start-pilot-recorder function) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; stadium-race-obs ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +#| +(deftype stdmb-race-hatch (process-drawable) + ((tt float :offset-assert 196) + (tt-target float :offset-assert 200) + ) + :method-count-assert 23 + :size-assert #xd0 + :flag-assert #x17005000d0 + (:methods + (idle () _type_ :state 20) + (stdmb-race-hatch-method-21 () none 21) + (stdmb-race-hatch-method-22 () none 22) + ) + ) +|# + +#| +(deftype stdmb-platform (stdmb-race-hatch) + () + :method-count-assert 23 + :size-assert #xd0 + :flag-assert #x17005000d0 + (:methods + ) + ) +|# + +;; (define-extern stdmb-race-hatch-init-by-other function) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; bike ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + (deftype bike-base (vehicle) () :method-count-assert 144 @@ -50690,17 +50570,15 @@ (:methods ) ) -|# -#| (deftype bikea (bike-base) - ((fin-fl basic :offset-assert 876) - (fin-fr basic :offset-assert 880) - (fin-rl basic :offset-assert 884) - (fin-rr basic :offset-assert 888) - (rudder basic :offset-assert 892) - (brake-l basic :offset-assert 896) - (brake-r basic :offset-assert 900) + ((fin-fl basic :offset-assert 880) + (fin-fr basic :offset-assert 884) + (fin-rl basic :offset-assert 888) + (fin-rr basic :offset-assert 892) + (rudder basic :offset-assert 896) + (brake-l basic :offset-assert 900) + (brake-r basic :offset-assert 904) ) :method-count-assert 144 :size-assert #x38c @@ -50708,18 +50586,16 @@ (:methods ) ) -|# -#| (deftype bikeb (bike-base) - ((fin-rl basic :offset-assert 876) - (fin-rr basic :offset-assert 880) - (rudder basic :offset-assert 884) - (rudder-f basic :offset-assert 888) - (brake-l basic :offset-assert 892) - (brake-r basic :offset-assert 896) - (flap-l basic :offset-assert 900) - (flap-r basic :offset-assert 904) + ((fin-rl basic :offset-assert 880) + (fin-rr basic :offset-assert 884) + (rudder basic :offset-assert 888) + (rudder-f basic :offset-assert 892) + (brake-l basic :offset-assert 896) + (brake-r basic :offset-assert 900) + (flap-l basic :offset-assert 904) + (flap-r basic :offset-assert 908) ) :method-count-assert 144 :size-assert #x390 @@ -50727,21 +50603,19 @@ (:methods ) ) -|# -#| (deftype bikec (bike-base) - ((fin-fl basic :offset-assert 876) - (fin-fr basic :offset-assert 880) - (fin-rl basic :offset-assert 884) - (fin-rr basic :offset-assert 888) - (fin2-fl basic :offset-assert 892) - (fin2-fr basic :offset-assert 896) - (rudder basic :offset-assert 900) - (brake-l basic :offset-assert 904) - (brake-r basic :offset-assert 908) - (spoiler-l basic :offset-assert 912) - (spoiler-r basic :offset-assert 916) + ((fin-fl basic :offset-assert 880) + (fin-fr basic :offset-assert 884) + (fin-rl basic :offset-assert 888) + (fin-rr basic :offset-assert 892) + (fin2-fl basic :offset-assert 896) + (fin2-fr basic :offset-assert 900) + (rudder basic :offset-assert 904) + (brake-l basic :offset-assert 908) + (brake-r basic :offset-assert 912) + (spoiler-l basic :offset-assert 916) + (spoiler-r basic :offset-assert 920) ) :method-count-assert 144 :size-assert #x39c @@ -50749,11 +50623,9 @@ (:methods ) ) -|# -#| (deftype guard-bike (vehicle-guard) - ((turret-jm basic :offset-assert 1072) + ((turret-jm basic :offset-assert 1076) ) :method-count-assert 159 :size-assert #x438 @@ -50761,7 +50633,6 @@ (:methods ) ) -|# ;; (define-extern *bike-explosion-info* vehicle-explosion-info) ;; (define-extern *bikea-constants* object) @@ -50774,9 +50645,8 @@ ;; car ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype car-base (vehicle) - ((rider-hand-joint-array UNKNOWN 2 :offset-assert 876) + ((rider-hand-joint-array int8 2 :offset-assert 880) ) :method-count-assert 144 :size-assert #x372 @@ -50784,19 +50654,17 @@ (:methods ) ) -|# -#| (deftype cara (car-base) - ((steering-wheel-l basic :offset-assert 880) - (steering-wheel-r basic :offset-assert 884) - (fin-fl basic :offset-assert 888) - (fin-fr basic :offset-assert 892) - (fin-rl basic :offset-assert 896) - (fin-rr basic :offset-assert 900) - (rudder-l basic :offset-assert 904) - (rudder-r basic :offset-assert 908) - (rudder basic :offset-assert 912) + ((steering-wheel-l basic :offset-assert 884) + (steering-wheel-r basic :offset-assert 888) + (fin-fl basic :offset-assert 892) + (fin-fr basic :offset-assert 896) + (fin-rl basic :offset-assert 900) + (fin-rr basic :offset-assert 904) + (rudder-l basic :offset-assert 908) + (rudder-r basic :offset-assert 912) + (rudder basic :offset-assert 916) ) :method-count-assert 144 :size-assert #x398 @@ -50804,16 +50672,14 @@ (:methods ) ) -|# -#| (deftype carb (car-base) - ((steering-wheel-l basic :offset-assert 880) - (steering-wheel-r basic :offset-assert 884) - (fin-fl basic :offset-assert 888) - (fin-fr basic :offset-assert 892) - (fin-rl basic :offset-assert 896) - (fin-rr basic :offset-assert 900) + ((steering-wheel-l basic :offset-assert 884) + (steering-wheel-r basic :offset-assert 888) + (fin-fl basic :offset-assert 892) + (fin-fr basic :offset-assert 896) + (fin-rl basic :offset-assert 900) + (fin-rr basic :offset-assert 904) ) :method-count-assert 144 :size-assert #x38c @@ -50821,17 +50687,15 @@ (:methods ) ) -|# -#| (deftype carc (car-base) - ((steering-wheel basic :offset-assert 880) - (fin-fl basic :offset-assert 884) - (fin-fr basic :offset-assert 888) - (fin-rl basic :offset-assert 892) - (fin-rr basic :offset-assert 896) - (fin2-rl basic :offset-assert 900) - (fin2-rr basic :offset-assert 904) + ((steering-wheel basic :offset-assert 884) + (fin-fl basic :offset-assert 888) + (fin-fr basic :offset-assert 892) + (fin-rl basic :offset-assert 896) + (fin-rr basic :offset-assert 900) + (fin2-rl basic :offset-assert 904) + (fin2-rr basic :offset-assert 908) ) :method-count-assert 144 :size-assert #x390 @@ -50839,11 +50703,9 @@ (:methods ) ) -|# -#| (deftype hellcat (vehicle-guard) - ((turret-jm basic :offset-assert 1072) + ((turret-jm basic :offset-assert 1076) ) :method-count-assert 159 :size-assert #x438 @@ -50851,7 +50713,6 @@ (:methods ) ) -|# ;; (define-extern *car-explosion-info* vehicle-explosion-info) ;; (define-extern *cara-constants* object) @@ -50864,7 +50725,6 @@ ;; test-bike ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype test-bike (bikec) () :method-count-assert 144 @@ -50873,9 +50733,7 @@ (:methods ) ) -|# -#| (deftype evan-test-bike (bikea) () :method-count-assert 144 @@ -50884,7 +50742,6 @@ (:methods ) ) -|# ;; (define-extern *test-bike-constants* object) ;; (define-extern *evan-test-bike-constants* object) @@ -50893,7 +50750,6 @@ ;; test-car ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype test-car (cara) () :method-count-assert 144 @@ -50902,7 +50758,6 @@ (:methods ) ) -|# ;; (define-extern *test-car-constants* object) @@ -51361,10 +51216,10 @@ ;; (define-extern *traffic-engine* object) ;; (define-extern *traffic-fast-spawn* object) ;; (define-extern draw-city-info function) -;; (define-extern vehicle-spawn function) +(define-extern vehicle-spawn (function target type traffic-object-spawn-params process-drawable)) ;; (define-extern citizen-spawn function) ;; (define-extern traffic-object-spawn function) -;; (define-extern type-from-vehicle-type function) +(define-extern type-from-vehicle-type (function vehicle-type type)) ;; (define-extern traffic-manager-event-handler function) ;; (define-extern traffic-manager-init-by-other function) (define-extern traffic-start (function none)) @@ -51380,6 +51235,133 @@ ;; (define-extern ctywide-entity-hack function) ;; (define-extern lwide-entity-hack function) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; errol-chal-part ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;; (define-extern city-race-borrow-level-activate function) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; errol-chal ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +#| +(deftype errol-racer (vehicle-rider) + ((minimap connection-minimap :offset-assert 220) + ) + :method-count-assert 36 + :size-assert #xe4 + :flag-assert #x24007000e4 + (:methods + ) + ) +|# + +(deftype vehicle-city-racer (vehicle-racer) + () + :method-count-assert 156 + :size-assert #x3f8 + :flag-assert #x9c038003f8 + (:methods + ) + ) + +(deftype race-bike-a (vehicle-city-racer) + () + :method-count-assert 156 + :size-assert #x3f8 + :flag-assert #x9c038003f8 + (:methods + ) + ) + +(deftype race-bike-b (vehicle-city-racer) + () + :method-count-assert 156 + :size-assert #x3f8 + :flag-assert #x9c038003f8 + (:methods + ) + ) + +;; is this actually here? +(deftype race-bike-c (vehicle-city-racer) + () + :method-count-assert 156 + :size-assert #x3f8 + :flag-assert #x9c038003f8 + (:methods + ) + ) + +#| +(deftype turbo-ring (process-drawable) + ((touch-time time-frame :offset-assert 196) + (minimap connection-minimap :offset-assert 204) + (player-got basic :offset-assert 208) + (persistent basic :offset-assert 212) + (id int8 :offset-assert 216) + (boost float :offset-assert 220) + (plane vector :inline :offset-assert 236) + (part-track uint64 :offset-assert 252) + (mat matrix :inline :offset-assert 268) + ) + :method-count-assert 25 + :size-assert #x150 + :flag-assert #x1900d00150 + (:methods + (idle () _type_ :state 20) + (die () _type_ :state 21) + (turbo-ring-method-22 () none 22) + (turbo-ring-method-23 () none 23) + (turbo-ring-method-24 () none 24) + ) + ) +|# + +;; (define-extern *race-bike-a-constants* object) +;; (define-extern *race-bike-b-constants* object) +;; (define-extern turbo-ring-init-by-other function) +;; (define-extern turbo-ring-spawn function) +;; (define-extern *city-errol-challenge-rings* array) +;; (define-extern *city-bush-port-rings* array) + + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; racebike ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +(deftype vehicle-race-bike (vehicle-racer) + ((steering-wheel basic :offset-assert 1016) + ) + :method-count-assert 156 + :size-assert #x3fc + :flag-assert #x9c038003fc + (:methods + ) + ) + +(deftype race-bike-d (vehicle-race-bike) + () + :method-count-assert 156 + :size-assert #x3fc + :flag-assert #x9c038003fc + (:methods + ) + ) + +(deftype race-bike-e (vehicle-race-bike) + () + :method-count-assert 156 + :size-assert #x3fc + :flag-assert #x9c038003fc + (:methods + ) + ) + +;; (define-extern *race-bike-d-constants* object) +;; (define-extern *race-bike-e-constants* object) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ctywide-texture ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -51679,7 +51661,7 @@ ;; pilot-states ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern target-pilot-start state) +(define-extern target-pilot-start (state handle target)) ;; (define-extern target-pilot-bike-anim-loop function) ;; (define-extern target-pilot-car-anim-loop function) ;; (define-extern target-daxter-pilot-car-anim-loop function) @@ -51693,7 +51675,7 @@ ;; (define-extern target-pilot-get-off state) ;; (define-extern target-pilot-grab state) ;; (define-extern target-pilot-clone-anim state) -;; (define-extern target-pilot-edge-grab state) +(define-extern target-pilot-edge-grab (state target)) ;; (define-extern target-pilot-hit state) ;; (define-extern target-pilot-death state) diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 7e9069d257..bd923f065b 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -110,7 +110,6 @@ "draw-inline-array-instance-shrub", "target-land-effect", - "target-standard-event-handler", "(method 12 effect-control)", "(method 11 effect-control)", "(method 10 effect-control)", @@ -393,7 +392,60 @@ "(method 24 grid-hash)": [39, 35, 22, 15], "(method 12 flow-control)": [11, 12, 13, 14, 15, 18, 20, 22, 29], "(method 19 process-drawable)": [0, 2, 3, 7, 10, 11, 30], - "find-offending-process-focusable": [16, 19] + "find-offending-process-focusable": [16, 19], + + "target-standard-event-handler": [ + 5, // fwd L31/7 + 6, // to 152 + 7, // fwd L38 + 20, // to 152 + 21, // fwd L39 + 22, // to 152 + 23, // to L40 + 24, // to 152 + 25, // to L45 + 43, // to l152 + 44, // to 46 + 45, // to l152 + + 46, // to l114 + + 190, // to l152 + 191, // to 121 + 210, + 211, + 212, + 213, + 214, + + 224, + 225, + 226, + 227, + 232, + 233, + 234, + 235, + 236, + 237, + 238, + 239, + 240, + 241, + 242, + + 255, + 256, + + 269, + 270, + 285, + 286, + 287, + 288, + 289, + 290 + ] }, // Sometimes the game might use format strings that are fetched dynamically, diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 2c2694a932..ee49966ca2 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -3390,7 +3390,8 @@ [681, "v1", "fact-info-target"], [699, "v1", "fact-info-target"], [866, "v1", "(state target)"], - [894, "a0", "process"] + [894, "a0", "process"], + [517, "v1", "float"] ], "target-dangerous-event-handler": [ [9, "v1", "fact-info-target"], @@ -3515,7 +3516,8 @@ "(code special-contents-die crate)": [[42, "v1", "collide-shape-moving"]], "target-send-attack": [ ["_stack_", 96, "symbol"], - [16, "s4", "process-focusable"] + [16, "s4", "process-focusable"], + [[429, 444], "t1", "sound-name"] ], "(method 36 crate)": [ [6, "a0", "collide-shape-moving"], @@ -4905,5 +4907,29 @@ [360, "a0", "(pointer uint128)"] ], "(method 13 editable-face)": [[[31, 84], "s3", "(inline-array vector)"]], - "(method 13 editable-plane)": [[[37, 90], "s3", "(inline-array vector)"]] + "(method 13 editable-plane)": [[[37, 90], "s3", "(inline-array vector)"]], + "target-standard-event-handler": [ + [45, "v1", "(pointer process)"], + [93, "a0", "vector"], + [203, "a0", "process"], + [205, "v1", "(pointer process)"], + [228, "a0", "process"], + [230, "v1", "(pointer process)"], + [250, "a0", "process"], + [252, "v1", "(pointer process)"], + [343, "s5", "process"], + [345, "v1", "(pointer process)"], + [369, "a0", "process"], + [371, "v1", "(pointer process)"], + [392, "a0", "process"], + [394, "v1", "(pointer process)"], + [439, "a0", "process"], + [441, "v1", "(pointer process)"], + [461, "a0", "process"], + [463, "v1", "(pointer process)"], + [640, "a0", "process"], + [642, "v1", "(pointer process)"], + [698, "v1", "(pointer process)"], + [68, "a0", "vector"] + ] } diff --git a/game/graphics/pipelines/opengl.h b/game/graphics/pipelines/opengl.h index 54721b51c7..fb193c8017 100644 --- a/game/graphics/pipelines/opengl.h +++ b/game/graphics/pipelines/opengl.h @@ -38,7 +38,7 @@ class GLDisplay : public GfxDisplay { int get_screen_rate(int vmode_idx) override; int get_screen_vmode_count() override; int get_monitor_count() override; - std::tuple get_mouse_pos(); + std::tuple get_mouse_pos() override; void set_size(int w, int h) override; void update_fullscreen(GfxDisplayMode mode, int screen) override; void render() override; diff --git a/game/kernel/jak2/klisten.cpp b/game/kernel/jak2/klisten.cpp index 6e1b5c994d..0f3f892e8d 100644 --- a/game/kernel/jak2/klisten.cpp +++ b/game/kernel/jak2/klisten.cpp @@ -184,7 +184,6 @@ int sql_query_sync(Ptr string_in) { break; } std::this_thread::sleep_for(std::chrono::milliseconds(1)); - /* iVar2 = 99999; do { bVar1 = iVar2 != 0; diff --git a/game/mips2c/jak2_functions/ocean.cpp b/game/mips2c/jak2_functions/ocean.cpp index 09fcf55c7c..85a5eaaa36 100644 --- a/game/mips2c/jak2_functions/ocean.cpp +++ b/game/mips2c/jak2_functions/ocean.cpp @@ -16,7 +16,6 @@ struct Cache { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; c->load_symbol2(v1, cache.math_camera); // lw v1, *math-camera*(s7) c->load_symbol2(a0, cache.sky_work); // lw a0, *sky-work*(s7) c->daddiu(a0, a0, 1008); // daddiu a0, a0, 1008 @@ -293,8 +292,6 @@ struct Cache { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; c->copy_vfs_from_other(&ocean_regs_vfs); - bool bc = false; - u32 call_addr = 0; c->mov64(v1, a0); // or v1, a0, r0 get_fake_spad_addr2(t4, cache.fake_scratchpad_data, 0, c);// lui t4, 28672 c->ori(t4, t4, 12288); // ori t4, t4, 12288 diff --git a/game/mips2c/jak2_functions/ocean_vu0.cpp b/game/mips2c/jak2_functions/ocean_vu0.cpp index c007d0ea11..ea804d094d 100644 --- a/game/mips2c/jak2_functions/ocean_vu0.cpp +++ b/game/mips2c/jak2_functions/ocean_vu0.cpp @@ -12,7 +12,6 @@ struct Cache { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; c->mtc1(f0, a2); // mtc1 f0, a2 c->cvtws(f0, f0); // cvt.w.s f0, f0 c->mfc1(t1, f0); // mfc1 t1, f0 @@ -198,7 +197,6 @@ namespace method_15_ocean { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; // nop // sll r0, r0, 0 c->mov64(v1, a1); // or v1, a1, r0 c->mov64(a0, a2); // or a0, a2, r0 @@ -511,7 +509,6 @@ block_5: goto block_13; } -block_7: c->lui(a0, 16288); // lui a0, 16288 c->mtc1(f0, a0); // mtc1 f0, a0 c->lwc1(f1, 4, v1); // lwc1 f1, 4(v1) @@ -528,7 +525,6 @@ block_9: goto block_13; } -block_11: c->lui(a0, 16288); // lui a0, 16288 c->mtc1(f0, a0); // mtc1 f0, a0 c->lwc1(f1, 8, v1); // lwc1 f1, 8(v1) diff --git a/game/mips2c/jak2_functions/spatial_hash.cpp b/game/mips2c/jak2_functions/spatial_hash.cpp index a41af0f0d9..68c6d48c4d 100644 --- a/game/mips2c/jak2_functions/spatial_hash.cpp +++ b/game/mips2c/jak2_functions/spatial_hash.cpp @@ -8,7 +8,6 @@ namespace method_18_grid_hash { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; c->lh(v1, 10, a0); // lh v1, 10(a0) c->lb(a3, 24, a0); // lb a3, 24(a0) c->mult3(a3, a3, v1); // mult3 a3, a3, v1 @@ -49,7 +48,6 @@ u64 execute(void* ctxt) { goto block_3; } - block_2: c->dsubu(a2, r0, a2); // dsubu a2, r0, a2 c->dsrav(a1, a1, a2); // dsrav a1, a1, a2 @@ -117,7 +115,6 @@ namespace method_19_grid_hash { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; c->lh(v1, 10, a0); // lh v1, 10(a0) c->lb(a3, 24, a0); // lb a3, 24(a0) c->mult3(a3, a3, v1); // mult3 a3, a3, v1 @@ -158,7 +155,6 @@ u64 execute(void* ctxt) { goto block_3; } - block_2: c->dsubu(a2, r0, a2); // dsubu a2, r0, a2 c->dsrav(a1, a1, a2); // dsrav a1, a1, a2 @@ -226,7 +222,6 @@ namespace method_20_grid_hash { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; bool bc = false; - u32 call_addr = 0; c->daddiu(sp, sp, -48); // daddiu sp, sp, -48 c->sd(ra, 0, sp); // sd ra, 0(sp) c->sq(s5, 16, sp); // sq s5, 16(sp) @@ -357,8 +352,6 @@ namespace Mips2C::jak2 { namespace method_22_grid_hash { u64 execute(void* ctxt) { auto* c = (ExecutionContext*)ctxt; - bool bc = false; - u32 call_addr = 0; // nop // sll r0, r0, 0 // nop // sll r0, r0, 0 c->lq(v1, 0, a2); // lq v1, 0(a2) @@ -507,7 +500,6 @@ u64 execute(void* ctxt) { goto block_4; } - block_3: c->dsubu(a3, r0, a3); // dsubu a3, r0, a3 c->dsrav(a3, t2, a3); // dsrav a3, t2, a3 @@ -647,7 +639,6 @@ u64 execute(void* ctxt) { goto block_3; } - block_2: c->dsubu(t3, r0, t3); // dsubu t3, r0, t3 c->dsrav(t1, t1, t3); // dsrav t1, t1, t3 @@ -1220,7 +1211,6 @@ u64 execute(void* ctxt) { goto block_6; } - block_5: c->dsubu(a1, r0, a1); // dsubu a1, r0, a1 c->dsrav(a0, a0, a1); // dsrav a0, a0, a1 @@ -1464,7 +1454,6 @@ u64 execute(void* ctxt) { goto block_6; } - block_5: c->dsubu(a1, r0, a1); // dsubu a1, r0, a1 c->dsrav(a0, a0, a1); // dsrav a0, a0, a1 @@ -1738,7 +1727,6 @@ u64 execute(void* ctxt) { goto block_3; } - block_2: c->dsubu(t0, r0, t0); // dsubu t0, r0, t0 c->dsrav(t0, t2, t0); // dsrav t0, t2, t0 @@ -1899,7 +1887,6 @@ u64 execute(void* ctxt) { goto block_4; } - block_3: c->dsubu(a3, r0, a3); // dsubu a3, r0, a3 c->dsrav(a3, t2, a3); // dsrav a3, t2, a3 @@ -2249,7 +2236,6 @@ u64 execute(void* ctxt) { goto block_4; } - block_3: c->dsubu(a1, r0, a1); // dsubu a1, r0, a1 c->dsrav(a0, a0, a1); // dsrav a0, a0, a1 @@ -2611,7 +2597,6 @@ u64 execute(void* ctxt) { goto block_30; } - block_12: c->lwc1(f0, 16, gp); // lwc1 f0, 16(gp) c->lwc1(f1, 0, t0); // lwc1 f1, 0(t0) c->lwc1(f2, 12, t0); // lwc1 f2, 12(t0) @@ -2629,7 +2614,6 @@ u64 execute(void* ctxt) { goto block_30; } - block_16: c->lwc1(f0, 4, t0); // lwc1 f0, 4(t0) c->lwc1(f1, 12, t0); // lwc1 f1, 12(t0) c->adds(f0, f0, f1); // add.s f0, f0, f1 @@ -2647,7 +2631,6 @@ u64 execute(void* ctxt) { goto block_30; } - block_20: c->lwc1(f0, 20, gp); // lwc1 f0, 20(gp) c->lwc1(f1, 4, t0); // lwc1 f1, 4(t0) c->lwc1(f2, 12, t0); // lwc1 f2, 12(t0) @@ -2665,7 +2648,6 @@ u64 execute(void* ctxt) { goto block_30; } - block_24: c->lwc1(f0, 8, t0); // lwc1 f0, 8(t0) c->lwc1(f1, 12, t0); // lwc1 f1, 12(t0) c->adds(f0, f0, f1); // add.s f0, f0, f1 @@ -2683,7 +2665,6 @@ u64 execute(void* ctxt) { goto block_30; } - block_28: c->lwc1(f0, 24, gp); // lwc1 f0, 24(gp) c->lwc1(f1, 8, t0); // lwc1 f1, 8(t0) c->lwc1(f2, 12, t0); // lwc1 f2, 12(t0) diff --git a/goal_src/jak2/engine/collide/collide-target-h.gc b/goal_src/jak2/engine/collide/collide-target-h.gc index ccf882683a..090849db0e 100644 --- a/goal_src/jak2/engine/collide/collide-target-h.gc +++ b/goal_src/jak2/engine/collide/collide-target-h.gc @@ -182,11 +182,11 @@ (time-of-last-debug-float time-frame :offset 5944) (danger-mode symbol :offset 5984) (target-attack-id uint32 :offset 5988) - (unknown-attack-id00 int32 :offset 5992) + (attacked-by-id int32 :offset 5992) (bomb-scale float :offset 5996) (attack-count uint64 :offset 6000) - (unknown-dword06 handle :offset 6008) - (unknown-time-frame000 time-frame :offset 6016) + (send-attack-dest handle :offset 6008) + (send-attack-time time-frame :offset 6016) (unknown-combo-tracker00 combo-tracker :inline :offset 6032) (unknown-time-frame21 time-frame :offset 6072) (unknown-dword07 int64 :offset 6096) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index 7c1504eeb1..343259f3c0 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -765,14 +765,12 @@ (the-as object (deactivate self)) ) ((= v1-0 'do-effect) - (when (and (nonzero? (-> self skel)) (-> self skel effect)) - (let ((t9-46 (method-of-object (-> self skel effect) effect-control-method-10))) - (-> event param 0) - (-> event param 1) - -1 - (the-as object (t9-46)) + (if (and (nonzero? (-> self skel)) (-> self skel effect)) + (the-as + object + (do-effect (-> self skel effect) (the-as symbol (-> event param 0)) (the-as float (-> event param 1)) -1) + ) ) - ) ) (else (if (-> self cur-event-hook) diff --git a/goal_src/jak2/engine/entity/entity-h.gc b/goal_src/jak2/engine/entity/entity-h.gc index ed6e6ee617..7e80747f31 100644 --- a/goal_src/jak2/engine/entity/entity-h.gc +++ b/goal_src/jak2/engine/entity/entity-h.gc @@ -23,6 +23,22 @@ (bit-12 12) ) +(defenum vehicle-type + :type int32 + (bikea 0) + (bikeb 1) + (bikec 2) + (cara 3) + (carb 4) + (carc 5) + (guard-bike 6) + (hellcat 7) + (evan-test-bike 8) + (test-bike 9) + (test-car 10) + ) + + (declare-type race-mesh basic) ;; NOTE - for cam-start diff --git a/goal_src/jak2/engine/game/effect-control-h.gc b/goal_src/jak2/engine/game/effect-control-h.gc index 983205d3ce..024e37fe7b 100644 --- a/goal_src/jak2/engine/game/effect-control-h.gc +++ b/goal_src/jak2/engine/game/effect-control-h.gc @@ -60,9 +60,9 @@ (:methods (new (symbol type process-drawable) _type_ 0) (effect-control-method-9 (_type_) none 9) - (effect-control-method-10 () none 10) + (do-effect (_type_ symbol float int) none 10) (effect-control-method-11 () none 11) - (effect-control-method-12 (_type_ symbol float int basic sound-name) int 12) + (play-effect-sound (_type_ symbol float int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) (effect-control-method-14 () none 14) ) diff --git a/goal_src/jak2/engine/game/game-h.gc b/goal_src/jak2/engine/game/game-h.gc index 395655a54a..c3888c2566 100644 --- a/goal_src/jak2/engine/game/game-h.gc +++ b/goal_src/jak2/engine/game/game-h.gc @@ -331,7 +331,7 @@ :flag-assert #xc000000a0 (:methods (attack-info-method-9 (_type_ attack-info process-drawable process-drawable) none 9) - (attack-info-method-10 (_type_ object process-drawable process touching-shapes-entry) attack-info 10) + (compute-intersect-info (_type_ object process-drawable process touching-shapes-entry) attack-info 10) (combine! (_type_ attack-info process-drawable) attack-info 11) ) ) diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index 5eb2180686..ec3ac89568 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -14,7 +14,7 @@ (define-extern can-play-stance-amibent? (function symbol :behavior target)) (define-extern ja-blend-eval (function int :behavior process-drawable)) (define-extern spawn-projectile (function type projectile-init-by-other-params process-tree dead-pool (pointer process))) -(define-extern target-attacked (function symbol attack-info process process (state symbol attack-info target) object :behavior target)) +(define-extern target-attacked (function symbol attack-info process touching-shapes-entry (state symbol attack-info target) object :behavior target)) (define-extern target-clone-anim (state handle target)) (define-extern clone-anim (function handle symbol string none :behavior process-drawable)) (define-extern lightning-probe-callback (function lightning-tracker none)) @@ -2558,7 +2558,7 @@ event-type (the-as attack-info (-> event param 1)) proc - (the-as process (-> event param 0)) + (the-as touching-shapes-entry (-> event param 0)) target-hit ) ) diff --git a/goal_src/jak2/engine/target/board/target-board.gc b/goal_src/jak2/engine/target/board/target-board.gc index be25a9716f..b2a6cc3105 100644 --- a/goal_src/jak2/engine/target/board/target-board.gc +++ b/goal_src/jak2/engine/target/board/target-board.gc @@ -1059,20 +1059,10 @@ ) ) (spawn (-> self board part-control) (-> self control trans)) - (let ((t9-26 (method-of-object (-> self skel effect) effect-control-method-10))) - 'effect-board-poof - 0 - -1 - (t9-26) - ) - (when (< (-> self board shock-offset) -2048.0) - (let ((t9-27 (method-of-object (-> self skel effect) effect-control-method-10))) - 'effect-board-poof - 0 - -1 - (t9-27) + (do-effect (-> self skel effect) 'effect-board-poof 0.0 -1) + (if (< (-> self board shock-offset) -2048.0) + (do-effect (-> self skel effect) 'effect-board-poof 0.0 -1) ) - ) ) (vector-lerp! (-> self board slow-transv) (-> self board slow-transv) (-> self control transv) 0.2) (if (< (-> self board slow-transv y) 0.0) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index e03556ba28..6c28e932f8 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -3217,7 +3217,7 @@ (set! (-> obj control current-surface name) 'current) (set! (-> obj control current-surface active-hook) nothing) (set! (-> obj control current-surface touch-hook) nothing) - (set! (-> obj control unknown-dword06) (the-as handle #f)) + (set! (-> obj control send-attack-dest) (the-as handle #f)) (dotimes (v1-84 8) (set! (-> obj attack-info-old v1-84 attacker) (the-as handle #f)) ) diff --git a/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index b4be62d7bf..11f761c46c 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -710,7 +710,7 @@ ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 (-> self control unknown-combo-tracker00) - (-> self control unknown-dword06) + (-> self control send-attack-dest) (-> self control trans) 24576.0 (-> self control c-R-w vector 2) @@ -950,7 +950,7 @@ ) ) (let ((t1-3 (make-u128 (the-as uint #x7469682d6863) (the-as uint #x6e75702d6b616a64)))) - (effect-control-method-12 + (play-effect-sound (-> self skel effect) 'punch -1.0 diff --git a/goal_src/jak2/engine/target/target-h.gc b/goal_src/jak2/engine/target/target-h.gc index 5fd7d785f2..be5271caf6 100644 --- a/goal_src/jak2/engine/target/target-h.gc +++ b/goal_src/jak2/engine/target/target-h.gc @@ -82,7 +82,6 @@ (define-extern target-hit-ground-anim (function symbol symbol none :behavior target)) (define-extern are-still? (function symbol :behavior target)) (define-extern *attack-end-mods* surface) -(define-extern target-send-attack (function process uint uint int int uint symbol :behavior target)) (define-extern target-dangerous-event-handler (function process int symbol event-message-block object :behavior target)) (define-extern target-start-attack (function none :behavior target)) (define-extern target-danger-set! (function symbol symbol none :behavior target)) @@ -160,6 +159,20 @@ (define-extern target-death (state symbol target)) (define-extern *float-mods* surface) +(define-extern target-send-attack (function process symbol touching-shapes-entry int int uint symbol :behavior target)) +(define-extern target-powerup-effect (function symbol none :behavior target)) +(define-extern target-load-wait (state target)) +(define-extern target-board-start (state object target)) +(define-extern target-pilot-start (state handle target)) +(define-extern target-mech-start (state handle target)) +(define-extern target-turret-get-on (state handle target)) +(define-extern target-play-anim (state string handle target)) +(define-extern target-edge-grab (state target)) +(define-extern target-pilot-edge-grab (state target)) +(define-extern target-pole-cycle (state handle target)) +(define-extern target-slide-down-to-ground (state target)) + + ;; og:ignore-form:(new 'static 'boxed-array ;; DECOMP BEGINS @@ -251,6 +264,9 @@ target-indax-start (target-warp-in vector vector target) (target-warp-out vector vector target) + (target-racing-start handle) + (target-flut-start handle) + (target-tube-start handle) ) ) diff --git a/goal_src/jak2/engine/target/target-handler.gc b/goal_src/jak2/engine/target/target-handler.gc index fd5245deb5..f2fe32dcb6 100644 --- a/goal_src/jak2/engine/target/target-handler.gc +++ b/goal_src/jak2/engine/target/target-handler.gc @@ -5,5 +5,1636 @@ ;; name in dgo: target-handler ;; dgos: ENGINE, GAME +(define-extern type-from-race-vehicle-type (function int type)) +(define-extern type-from-vehicle-type (function vehicle-type type)) +(define-extern vehicle-spawn (function target type traffic-object-spawn-params process-drawable)) + + ;; DECOMP BEGINS +(defbehavior target-shoved target ((arg0 meters) (arg1 meters) (arg2 process) (arg3 (state object object target))) + (let ((s5-0 (new 'static 'attack-info))) + (set! (-> s5-0 attacker) (process->handle arg2)) + (set! (-> s5-0 shove-back) arg0) + (set! (-> s5-0 shove-up) arg1) + (set! (-> s5-0 angle) + (if (not (logtest? (logior (-> self control status) (-> self control old-status)) (collide-status on-surface))) + 'air + 'shove + ) + ) + (set! (-> s5-0 mask) (attack-info-mask attacker shove-back shove-up angle)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) + (go arg3 'shove s5-0) + ) + ) + +(defun attack-mode-is-invinc ((arg0 symbol)) + (case arg0 + (('dark-eco-pool + 'endlessfall + 'melt + 'lava + 'bot + 'instant-death + 'grenade + 'drill-mech-master + 'centipede + 'drown-death + 'crush + 'death + ) + #t + ) + ) + ) + +(defbehavior target-attacked target ((arg0 symbol) + (arg1 attack-info) + (arg2 process) + (arg3 touching-shapes-entry) + (arg4 (state symbol attack-info target)) + ) + (let ((s4-0 (if (logtest? (-> arg1 mask) (attack-info-mask mode)) + (-> arg1 mode) + ) + ) + (s2-0 arg0) + ) + (when (or (and (not (logtest? (-> self focus-status) (focus-status hit))) + (zero? (logand (state-flags disable-attacks) (-> self state-flags))) + ) + (= s4-0 'endlessfall) + ) + (case s4-0 + (('endlessfall) + (if (not (-> *setting-control* user-current endlessfall)) + (return #f) + ) + ) + ) + (cond + ((or (logtest? (state-flags sf2 tinvul1 tinvul2) (-> self state-flags)) + (logtest? (-> self game secrets) (game-secrets invulnerable)) + (and (logtest? (-> self state-flags) (state-flags sf4)) (not (attack-mode-is-invinc s4-0))) + (< 0.0 (-> (the-as fact-info-target (-> self fact-override)) shield-level)) + (and (= s4-0 'darkeco) (and (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) + (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) + ) + (or (logtest? (-> self state-flags) (state-flags sf15)) + (logtest? (-> self focus-status) (focus-status dangerous)) + ) + ) + ) + ) + (case arg0 + (('attack-or-shove) + ) + (('attack-invinc) + (set! arg0 'attack) + ) + (else + (return #f) + ) + ) + ) + (else + (case arg0 + (('attack-or-shove 'attack-invinc) + (set! arg0 'attack) + ) + ) + ) + ) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer arg1) 160) + (compute-intersect-info (-> self attack-info-rec) arg1 self arg2 arg3) + (when (not (logtest? (focus-status mech) (-> self focus-status))) + (if (and (not (target-log-attack (-> self attack-info-rec) (if (logtest? (attack-info-mask test) (-> arg1 mask)) + 'test + 'log + ) + ) + ) + (!= s2-0 'attack-invinc) + ) + (return #f) + ) + ) + (if (logtest? (attack-info-mask test) (-> arg1 mask)) + (return #t) + ) + (set! (-> self control attacked-by-id) (the-as int (-> self attack-info-rec id))) + (cond + ((and (logtest? (-> self attack-info-rec mask) (attack-info-mask mode)) + (= (-> self attack-info-rec mode) 'damage) + (not (and (= (-> self game mode) 'play) + (>= 0.0 (- (-> (the-as fact-info-target (-> self fact-override)) health) (-> self attack-info-rec damage))) + ) + ) + ) + (pickup-collectable! + (-> self fact-override) + (pickup-type health) + (if (logtest? (attack-info-mask damage) (-> self attack-info-rec mask)) + (- (-> self attack-info-rec damage)) + (- (-> *FACT-bank* health-single-inc)) + ) + (the-as handle #f) + ) + (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-1 + (let ((t9-6 (method-of-type part-tracker activate))) + (t9-6 (the-as part-tracker gp-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-7 run-function-in-process) + (a0-27 gp-1) + (a1-10 part-tracker-init) + (a2-9 (-> *part-group-id-table* 9)) + (a3-4 0) + (t0-2 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) + (-> (the-as vector (if (logtest? (-> self attack-info-rec mask) (attack-info-mask intersection)) + (-> self attack-info-rec intersection) + (the-as vector (-> self control root-prim prim-core)) + ) + ) + quad + ) + ) + ((the-as (function object object object object object object object object none) t9-7) + a0-27 + a1-10 + a2-9 + a3-4 + t0-2 + t1-0 + t2-0 + t3-0 + ) + ) + (-> gp-1 ppointer) + ) + ) + (target-timed-invulnerable + (the-as time-frame (if (logtest? (-> self attack-info-rec mask) (attack-info-mask invinc-time)) + (the-as int (-> self attack-info-rec invinc-time)) + (the-as int (-> *TARGET-bank* hit-invulnerable-timeout)) + ) + ) + self + 1 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.5)) + (sound-play "oof") + #t + ) + (else + (logior! (-> self focus-status) (focus-status ignore hit)) + (when (and (= (-> self game mode) 'play) + (and (or (and (>= 0.0 (- (-> (the-as fact-info-target (-> self fact-override)) health) (-> self attack-info-rec damage))) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + ) + (attack-mode-is-invinc s4-0) + ) + (= arg0 'attack) + ) + ) + (logior! (-> self focus-status) (focus-status dead)) + (set! (-> self state-flags) (logior (state-flags disable-attacks) (-> self state-flags))) + ) + (go arg4 arg0 (-> self attack-info-rec)) + ) + ) + ) + ) + ) + +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 711] +(defbehavior target-send-attack target ((arg0 process) (arg1 symbol) (arg2 touching-shapes-entry) (arg3 int) (arg4 int) (arg5 uint)) + (local-vars + (sv-96 symbol) + (sv-100 touching-prims-entry) + (sv-128 touching-prims-entry) + (sv-176 touching-prims-entry) + (sv-224 uint) + (sv-240 int) + (sv-256 symbol) + (sv-272 symbol) + (sv-288 symbol) + (sv-304 vector) + (sv-320 matrix) + (sv-336 int) + (sv-352 symbol) + (sv-368 symbol) + (sv-384 symbol) + (sv-400 vector) + (sv-416 matrix) + (sv-432 int) + (sv-448 symbol) + (sv-464 symbol) + (sv-480 symbol) + (sv-496 vector) + (sv-512 matrix) + (sv-528 int) + (sv-544 symbol) + (sv-560 symbol) + (sv-576 symbol) + (sv-592 vector) + (sv-608 matrix) + (sv-624 int) + (sv-640 symbol) + (sv-656 symbol) + (sv-672 symbol) + (sv-688 vector) + (sv-704 matrix) + ) + (set! sv-224 arg5) + (let* ((s3-0 arg0) + (s4-0 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + (s3-1 (and s4-0 (logtest? (-> (the-as process-focusable s4-0) focus-status) (focus-status dead hit)))) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (the-as uint arg2)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id count penetrate-using)))) + (set! (-> v1-5 id) (the-as uint arg3)) + (set! (-> v1-5 mode) arg1) + (set! (-> v1-5 count) (the-as uint arg4)) + (set! (-> v1-5 penetrate-using) sv-224) + (set! (-> a1-2 param 1) (the-as uint v1-5)) + ) + (set! sv-96 (the-as symbol (send-event-function arg0 a1-2))) + ) + (when sv-96 + (set! (-> self control send-attack-dest) (process->handle arg0)) + (set! (-> self control send-attack-time) (-> self clock frame-counter)) + (send-event self 'hit arg1 arg0 arg2) + (set! arg0 (the process (and (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 2) + ) + arg0 + ) + ) + ) + (when (the-as object arg0) + (when (and s4-0 (not s3-1) (-> self control danger-mode) (zero? (logand (-> s4-0 mask) (process-mask dark-effect)))) + (logior! (-> s4-0 mask) (process-mask dark-effect)) + (process-spawn-function + process + (lambda :behavior target + ((arg0 handle)) + (local-vars (sv-112 vector) (sv-128 matrix)) + (let ((gp-0 (-> self parent))) + (let ((s4-0 0) + (s3-0 (-> self clock frame-counter)) + ) + (set! (-> self clock) (-> gp-0 0 clock)) + (while (let ((v1-48 gp-0)) + (and (or (logtest? (-> (the-as process-focusable (if v1-48 + (the-as process-focusable (-> v1-48 0 self)) + ) + ) + focus-status + ) + (focus-status dead hit) + ) + (let ((v1-53 gp-0)) + (and (-> (the-as process-focusable (if v1-53 + (the-as process-focusable (-> v1-53 0 self)) + ) + ) + next-state + ) + (let ((v1-56 gp-0)) + (= (-> (the-as process-focusable (if v1-56 + (the-as process-focusable (-> v1-56 0 self)) + ) + ) + next-state + name + ) + 'knocked + ) + ) + ) + ) + ) + (< (- (-> self clock frame-counter) s3-0) (seconds 15)) + (zero? (logand (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) + ) + ) + ) + (let ((s2-0 sp-launch-particles-var) + (s1-0 *sp-particle-system-2d*) + (s0-0 (-> *part-id-table* 178)) + ) + (set! sv-128 *launch-matrix*) + (set! sv-112 (-> sv-128 trans)) + (let ((v1-9 (-> (process-drawable-random-point! + (the-as process-drawable (ppointer->process gp-0)) + (new 'stack-no-clear 'vector) + ) + quad + ) + ) + ) + (set! (-> sv-112 quad) v1-9) + ) + (let ((a3-0 #f) + (t0-0 #f) + (t1-0 1.0) + ) + (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-0) (the-as sparticle-launch-control t0-0) t1-0) + ) + ) + (send-event (ppointer->process gp-0) 'color-effect 'dark 60) + (when (>= (- (-> self clock frame-counter) (the-as time-frame s4-0)) (seconds 0.05)) + (set! s4-0 (the-as int (-> self clock frame-counter))) + (cond + ((and (< (- (-> self clock frame-counter) s3-0) (seconds 0.5)) (handle->process arg0)) + (process-drawable2-shock-effect + (the-as process-drawable (handle->process arg0)) + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + ) + ) + (else + (send-event (handle->process arg0) 'color-effect 'shock 60) + (process-drawable-shock-effect + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + 0 + 0 + 40960.0 + ) + ) + ) + ) + (suspend) + ) + ) + (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) + (send-event (ppointer->process gp-0) 'color-effect #f 0) + ) + (none) + ) + (process->handle self) + :to s4-0 + ) + ) + ) + (let ((v1-37 arg1)) + (cond + ((or (= v1-37 'spin) (= v1-37 'spin-air) (= v1-37 'board-spin)) + (set! sv-100 (prims-touching? arg2 (-> self control) (the-as uint 256))) + (cond + (sv-100 + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-8 (method-of-type part-tracker activate))) + (t9-8 (the-as part-tracker s4-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-4 run-function-in-process) + (s2-1 s4-1) + (s1-1 part-tracker-init) + (s0-1 (-> *part-group-id-table* 10)) + ) + (set! sv-240 0) + (set! sv-256 (the-as symbol #f)) + (set! sv-272 (the-as symbol #f)) + (set! sv-288 (the-as symbol #f)) + (set! sv-320 *launch-matrix*) + (set! sv-304 (-> sv-320 trans)) + (let ((v1-50 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-100 (-> self control) arg2) quad))) + (set! (-> sv-304 quad) v1-50) + ) + ((the-as (function object object object object object object object object none) s3-4) + s2-1 + s1-1 + s0-1 + sv-240 + sv-256 + sv-272 + sv-288 + sv-320 + ) + ) + (-> s4-1 ppointer) + ) + ) + ) + (else + (do-effect (-> self skel effect) 'group-spin-hit -1.0 38) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (cond + ((= arg1 'board-spin) + (static-sound-name "board-impact") + ) + ((using-gun? self) + (static-sound-name "gun-spin-hit") + ) + (else + (static-sound-name "spin-hit") + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) + ) + ((or (= v1-37 'punch) (= v1-37 'mech-punch)) + (when arg2 + (set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 256))) + (cond + (sv-128 + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-17 (method-of-type part-tracker activate))) + (t9-17 (the-as part-tracker s4-3) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-6 run-function-in-process) + (s2-3 s4-3) + (s1-3 part-tracker-init) + (s0-3 (-> *part-group-id-table* 11)) + ) + (set! sv-336 0) + (set! sv-352 (the-as symbol #f)) + (set! sv-368 (the-as symbol #f)) + (set! sv-384 (the-as symbol #f)) + (set! sv-416 *launch-matrix*) + (set! sv-400 (-> sv-416 trans)) + (let ((v1-77 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) + (set! (-> sv-400 quad) v1-77) + ) + ((the-as (function object object object object object object object object none) s3-6) + s2-3 + s1-3 + s0-3 + sv-336 + sv-352 + sv-368 + sv-384 + sv-416 + ) + ) + (-> s4-3 ppointer) + ) + ) + ) + ((let ((v0-20 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-128 v0-20) + v0-20 + ) + (let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-4 + (let ((t9-22 (method-of-type part-tracker activate))) + (t9-22 (the-as part-tracker s4-4) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-7 run-function-in-process) + (s2-4 s4-4) + (s1-4 part-tracker-init) + (s0-4 (-> *part-group-id-table* 11)) + ) + (set! sv-432 0) + (set! sv-448 (the-as symbol #f)) + (set! sv-464 (the-as symbol #f)) + (set! sv-480 (the-as symbol #f)) + (set! sv-512 *launch-matrix*) + (set! sv-496 (-> sv-512 trans)) + (let ((v1-91 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) + (set! (-> sv-496 quad) v1-91) + ) + ((the-as (function object object object object object object object object none) s3-7) + s2-4 + s1-4 + s0-4 + sv-432 + sv-448 + sv-464 + sv-480 + sv-512 + ) + ) + (-> s4-4 ppointer) + ) + ) + ) + ) + ) + (case arg1 + (('mech-punch) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "mech-punch-hit")) + ) + (else + (let ((t1-6 (if (using-gun? self) + (static-sound-name "gun-punch-hit") + (static-sound-name "punch-hit") + ) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) t1-6) + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flip) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) + ) + ((= v1-37 'uppercut) + (set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 256))) + (cond + (sv-176 + (let ((s4-5 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-5 + (let ((t9-33 (method-of-type part-tracker activate))) + (t9-33 (the-as part-tracker s4-5) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-8 run-function-in-process) + (s2-5 s4-5) + (s1-5 part-tracker-init) + (s0-5 (-> *part-group-id-table* 11)) + ) + (set! sv-528 0) + (set! sv-544 (the-as symbol #f)) + (set! sv-560 (the-as symbol #f)) + (set! sv-576 (the-as symbol #f)) + (set! sv-608 *launch-matrix*) + (set! sv-592 (-> sv-608 trans)) + (let ((v1-123 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) + (set! (-> sv-592 quad) v1-123) + ) + ((the-as (function object object object object object object object object none) s3-8) + s2-5 + s1-5 + s0-5 + sv-528 + sv-544 + sv-560 + sv-576 + sv-608 + ) + ) + (-> s4-5 ppointer) + ) + ) + ) + ((let ((v0-34 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-176 v0-34) + v0-34 + ) + (let ((s4-6 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-6 + (let ((t9-38 (method-of-type part-tracker activate))) + (t9-38 (the-as part-tracker s4-6) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-9 run-function-in-process) + (s2-6 s4-6) + (s1-6 part-tracker-init) + (s0-6 (-> *part-group-id-table* 11)) + ) + (set! sv-624 0) + (set! sv-640 (the-as symbol #f)) + (set! sv-656 (the-as symbol #f)) + (set! sv-672 (the-as symbol #f)) + (set! sv-704 *launch-matrix*) + (set! sv-688 (-> sv-704 trans)) + (let ((v1-137 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) + (set! (-> sv-688 quad) v1-137) + ) + ((the-as (function object object object object object object object object none) s3-9) + s2-6 + s1-6 + s0-6 + sv-624 + sv-640 + sv-656 + sv-672 + sv-704 + ) + ) + (-> s4-6 ppointer) + ) + ) + ) + ) + (do-effect (-> self skel effect) 'group-uppercut-hit -1.0 22) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "uppercut-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((or (= v1-37 'flop) (= v1-37 'flop-down)) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 22) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 18) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "flop-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flut-attack) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + ) + ((= v1-37 'darkjak) + (set! (-> self darkjak attack-time) (-> self clock frame-counter)) + (let* ((v1-160 *game-info*) + (a0-102 (+ (-> v1-160 attack-id) 1)) + ) + (set! (-> v1-160 attack-id) a0-102) + (set! (-> self darkjak attack-id) a0-102) + a0-102 + ) + ) + ) + ) + ) + ) + sv-96 + ) + +;; WARN: Return type mismatch none vs object. +(defbehavior target-generic-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (the-as + object + (case arg2 + (('get-pickup) + (when (not (logtest? (-> self focus-status) (focus-status dead))) + (let ((s4-0 (-> arg3 param 0)) + (f28-0 (the-as float (-> arg3 param 1))) + ) + (if (!= (pickup-collectable! (-> self fact-override) (the-as pickup-type s4-0) 0.0 (the-as handle #f)) + (pickup-collectable! (-> self fact-override) (the-as pickup-type s4-0) f28-0 (process->handle arg0)) + ) + #t + 'full + ) + ) + ) + ) + (('test-pickup) + (let ((a1-6 (-> arg3 param 0))) + (pickup-collectable! (-> self fact-override) (the-as pickup-type a1-6) 0.0 (the-as handle #f)) + ) + ) + (('reset-pickup) + (the-as object (reset! (-> self fact-override) (the-as symbol (-> arg3 param 0)))) + ) + (('reset-collide) + (cond + ((-> self control collide-mode) + (target-collide-set! (-> self control collide-mode) (-> self control collide-mode-transition)) + ) + ((-> self control danger-mode) + (the-as object (target-danger-set! (-> self control danger-mode) #f)) + ) + ) + ) + (('level-deactivate) + (when (and (logtest? (focus-status pilot) (-> self focus-status)) + (or (= (-> arg3 param 0) 'ctywide) (and (= (-> arg3 param 0) 'lracelit) (-> self pilot as-daxter?))) + ) + (ja-channel-set! 0) + (target-gun-end-mode #t) + (set! (-> self skel top-anim interp) 0.0) + (let ((v1-30 (get-channel (-> self skel top-anim) 0))) + (if v1-30 + (set! (-> v1-30 frame-interp 1) 0.0) + ) + ) + (update (-> self skel top-anim)) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (set! (-> self event-hook) #f) + (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) + ) + ) + ) + (('level-enter) + (let ((s5-1 (level-get *level* (the-as symbol (-> arg3 param 0))))) + (when s5-1 + (let ((s4-1 (-> s5-1 info))) + (let ((v1-40 (-> s4-1 buzzer))) + (if (nonzero? v1-40) + (set! (-> self fact-override buzzer) 0.0) + (set! (-> self fact-override buzzer) (pickup-collectable! + (-> self fact-override) + (pickup-type buzzer) + (the float (logior -65536 v1-40)) + (the-as handle #f) + ) + ) + ) + ) + (if (zero? (-> self game task-enter-times (-> s4-1 task-level))) + (set! (-> self game task-enter-times (-> s4-1 task-level)) (-> *display* game-clock frame-counter)) + ) + ) + (let ((s4-2 (-> *game-info* sub-task-list))) + (dotimes (s3-0 (-> s4-2 length)) + (when (nonzero? s3-0) + (let ((s2-0 (-> s4-2 s3-0))) + (when (and (= (-> s5-1 info taskname) (-> s2-0 level)) + (zero? (-> self game task-close-times (-> s2-0 task))) + (= s3-0 (-> *game-info* play-list (-> s2-0 task) play-node)) + (or (logtest? (-> s2-0 flags) (game-task-node-flag closed)) (open? s2-0)) + (not (task-complete? (-> self game) (-> s2-0 task))) + (zero? (logand (game-task-node-flag utility-node) (-> s2-0 flags))) + ) + (when (zero? (-> self game task-close-times (-> s2-0 task))) + (format #t "--------------> set task start time for ~A~%" (-> s2-0 name)) + (set! (-> self game task-close-times (-> s2-0 task)) (-> *display* game-clock frame-counter)) + ) + ) + ) + ) + ) + ) + (update-task-masks 'level) + (format #t "GAMEPLAY: enter ~A~%" (-> arg3 param 0)) + ) + ) + ) + (('get-attack-count) + (set! v0-0 (+ (-> self control attack-count) (-> arg3 param 0))) + (set! (-> self control attack-count) (the-as uint v0-0)) + v0-0 + ) + (('continue) + (set! (-> self focus-status) (logior (focus-status teleporting) (-> self focus-status))) + (go target-continue (the-as continue-point (-> arg3 param 0))) + ) + (('query) + (case (-> arg3 param 0) + (('powerup) + (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) (-> arg3 param 1)) + (< 0.0 (-> (the-as fact-info-target (-> self fact-override)) eco-level)) + ) + ) + (('pickup) + (pickup-collectable! (-> self fact-override) (the-as pickup-type (-> arg3 param 1)) 0.0 (the-as handle #f)) + ) + (('ground-height) + (target-height-above-ground) + ) + (('gun-type) + (-> self gun gun-type) + ) + ) + ) + (('release) + (when (and (nonzero? (-> self gun)) (handle->process (-> self gun charge-active?))) + (set! (-> self gun charge-active?) (the-as handle #f)) + (set! v0-0 (-> self clock frame-counter)) + (set! (-> self gun fire-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + (('trans) + (case (-> arg3 param 0) + (('save) + (set! (-> self alt-cam-pos quad) (-> self control trans quad)) + (logior! (-> self state-flags) (state-flags sf12)) + (mem-copy! (the-as pointer (-> arg3 param 1)) (the-as pointer (-> self control trans)) 48) + ) + (('restore) + (logclear! (-> self state-flags) (state-flags sf12)) + (let ((gp-1 (-> arg3 param 1))) + (move-to-point! (-> self control) (the-as vector (+ gp-1 0))) + (quaternion-copy! (-> self control quat) (the-as quaternion (+ gp-1 16))) + ) + (rot->dir-targ! (-> self control)) + (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! v0-0 (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (the-as time-frame v0-0)) + v0-0 + ) + (('reset) + (set! v0-0 (logclear (-> self state-flags) (state-flags sf12))) + (set! (-> self state-flags) (the-as state-flags v0-0)) + v0-0 + ) + ) + ) + (('effect) + (the-as object (target-powerup-effect (the-as symbol (-> arg3 param 0)))) + ) + (('color-effect) + (set! (-> self color-effect) (the-as basic (-> arg3 param 0))) + (set! (-> self color-effect-start-time) (-> self clock frame-counter)) + (set! v0-0 (-> arg3 param 1)) + (set! (-> self color-effect-duration) (the-as uint v0-0)) + v0-0 + ) + (('do-effect) + (do-effect (-> self skel effect) (the-as symbol (-> arg3 param 0)) (the-as float (-> arg3 param 1)) -1) + (if (-> self sidekick) + (the-as object (do-effect + (-> self sidekick 0 skel effect) + (the-as symbol (-> arg3 param 0)) + (the-as float (-> arg3 param 1)) + -1 + ) + ) + ) + ) + (('effect-control) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (case (-> arg3 param 0) + (('effect-walk-step-left 'effect-walk-step-right 'effect-run-step-left 'effect-run-step-right) + (activate! *camera-smush-control* 409.6 15 75 1.0 0.98 (-> *display* camera-clock)) + ) + ) + ) + ) + (('neck) + (set! (-> self neck flex-blend) (the-as float (-> arg3 param 0))) + (cond + ((-> arg3 param 1) + (logior! (-> self state-flags) (state-flags sf13)) + (set! (-> self alt-neck-pos quad) (-> (the-as vector (-> arg3 param 1)) quad)) + (the-as object (look-at! (-> self neck) (-> self alt-neck-pos) 'force arg0)) + ) + (else + (set! v0-0 (logclear (-> self state-flags) (state-flags sf13))) + (set! (-> self state-flags) (the-as state-flags v0-0)) + v0-0 + ) + ) + ) + (('sidekick) + (cond + ((and (-> arg3 param 0) (not (-> self sidekick))) + (let ((gp-2 (get-process *default-dead-pool* sidekick #x4000))) + (set! v0-0 + (when gp-2 + (let ((t9-31 (method-of-type sidekick activate))) + (t9-31 (the-as sidekick gp-2) self (symbol->string (-> sidekick symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process gp-2 init-sidekick) + (-> gp-2 ppointer) + ) + ) + ) + (set! (-> self sidekick) (the-as (pointer sidekick) v0-0)) + v0-0 + ) + ((and (not (-> arg3 param 0)) (-> self sidekick)) + (deactivate (-> self sidekick 0)) + (set! (-> self sidekick) (the-as (pointer sidekick) #f)) + #f + ) + ) + ) + (('blend-shape) + (if (-> arg3 param 0) + (logior! (-> self skel status) (joint-control-status blend-shape)) + (logclear! (-> self skel status) (joint-control-status blend-shape)) + ) + (let ((v1-175 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-175 from) (process->ppointer arg0)) + (set! (-> v1-175 num-params) arg1) + (set! (-> v1-175 message) arg2) + (set! (-> v1-175 param 0) (-> arg3 param 0)) + (set! (-> v1-175 param 1) (-> arg3 param 1)) + (set! (-> v1-175 param 2) (-> arg3 param 2)) + (set! (-> v1-175 param 3) (-> arg3 param 3)) + (set! (-> v1-175 param 4) (-> arg3 param 4)) + (set! (-> v1-175 param 5) (-> arg3 param 5)) + (send-event-function (ppointer->process (-> self sidekick)) v1-175) + ) + ) + (('shadow) + (cond + ((-> arg3 param 0) + (let ((v1-178 (-> self draw shadow-ctrl))) + (logclear! (-> v1-178 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (else + (let ((v1-180 (-> self draw shadow-ctrl))) + (logior! (-> v1-180 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + (('rotate-y-angle) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (the-as float (-> arg3 param 0)) + ) + (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + (rot->dir-targ! (-> self control)) + ) + ) + (('touched) + (cond + ((< 0.0 (-> (the-as fact-info-target (-> self fact-override)) shield-level)) + (let ((s4-3 (-> self control penetrate-using))) + (set! (-> self control penetrate-using) (penetrate touch shield)) + (let* ((v1-193 (-> self game)) + (a0-161 (+ (-> v1-193 attack-id) 1)) + ) + (set! (-> v1-193 attack-id) a0-161) + (set! (-> self fact-override shield-attack-id) a0-161) + ) + (set! v0-0 (target-send-attack + arg0 + 'shield + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> (the-as fact-info-target (-> self fact-override)) shield-attack-id)) + 0 + (the-as uint (-> self control penetrate-using)) + ) + ) + (set! (-> self control penetrate-using) s4-3) + ) + v0-0 + ) + ((and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (or (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 16) + ) + (logtest? (process-mask crate) (-> arg0 mask)) + ) + ) + (target-send-attack + arg0 + 'darkjak + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self darkjak attack-id)) + 0 + (the-as uint #x10001) + ) + ) + (else + (send-event arg0 'touch (-> arg3 param 0)) + ) + ) + ) + (('dry) + (set! (-> self water drip-wetness) 0.0) + ) + (('reset-height) + (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) + #f + ) + (('draw) + (if (-> arg3 param 0) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (let ((v1-223 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-223 from) (process->ppointer arg0)) + (set! (-> v1-223 num-params) arg1) + (set! (-> v1-223 message) arg2) + (set! (-> v1-223 param 0) (-> arg3 param 0)) + (set! (-> v1-223 param 1) (-> arg3 param 1)) + (set! (-> v1-223 param 2) (-> arg3 param 2)) + (set! (-> v1-223 param 3) (-> arg3 param 3)) + (set! (-> v1-223 param 4) (-> arg3 param 4)) + (set! (-> v1-223 param 5) (-> arg3 param 5)) + (send-event-function (ppointer->process (-> self manipy)) v1-223) + ) + ) + (('no-load-wait) + (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + (set! (-> self no-load-wait) (the-as uint v0-0)) + v0-0 + ) + (('no-look-around) + (set! (-> self no-look-around-wait) + (the-as uint (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + ) + (if (and (-> self next-state) (= (-> self next-state name) 'target-look-around)) + (send-event self 'end-mode) + ) + ) + (('change-state) + enter-state + (-> arg3 param 1) + (-> arg3 param 2) + (-> arg3 param 3) + (-> arg3 param 4) + (go (the-as (state target) (-> arg3 param 0))) + ) + (('tobot) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self tobot?) (the-as symbol v0-0)) + v0-0 + ) + (('carry-info) + (-> self carry) + ) + (('gun-type) + (cond + ((-> arg3 param 0) + (the-as object (target-gun-type-set! (the-as int (-> arg3 param 0)))) + ) + (else + (set! v0-0 #t) + (set! (-> self gun put-away?) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + (('get-notify) + (set! v0-0 (process->handle (the-as process (-> arg3 param 0)))) + (set! (-> self notify) (the-as handle v0-0)) + v0-0 + ) + ) + ) + ) + +;; WARN: Return type mismatch none vs object. +(defbehavior target-standard-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (at-0 int) (s3-0 type)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let* ((v1-0 arg2) + (a1-1 (= v1-0 'attack)) + ) + (b! + (not (or a1-1 (begin (set! a1-1 (= v1-0 'attack-or-shove)) a1-1) (= v1-0 'attack-invinc))) + cfg-7 + :delay (nop!) + ) + (let ((v0-0 + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-hit + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-7) + (b! (!= v1-0 'shove) cfg-21 :delay (nop!)) + (set! v0-0 (when (not (and (-> self next-state) (= (-> self next-state name) 'target-hit))) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 160) + (when (not (logtest? (-> self attack-info-rec mask) (attack-info-mask attacker))) + (set! (-> self attack-info-rec attacker) (process->handle arg0)) + (logior! (-> self attack-info-rec mask) (attack-info-mask attacker)) + ) + (go target-hit 'shove (-> self attack-info-rec)) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-21) + (b! (!= v1-0 'push-trans) cfg-23 :delay (nop!)) + (let ((v1-15 (-> self control additional-decaying-velocity))) + (.lvf vf1 (&-> (the-as vector (-> arg3 param 0)) quad)) + (let ((f0-0 (-> self clock frames-per-second))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-15 quad) vf1) + ) + (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-decay-start-time) + (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + ) + (set! v0-0 #t) + (b! #t cfg-291 :delay (nop!)) + (label cfg-23) + (b! (!= v1-0 'push-transv) cfg-25 :delay (nop!)) + (set! (-> self control additional-decaying-velocity quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-decay-start-time) + (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + ) + (set! v0-0 #t) + (b! #t cfg-291 :delay (nop!)) + (label cfg-25) + (b! (!= v1-0 'loading) cfg-44 :delay (nop!)) + (set! v0-0 + (if (not (or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + (or (logtest? (-> self state-flags) (state-flags sf1)) + (logtest? (focus-status dead dangerous hit grabbed in-head edge-grab pole flut tube board pilot mech) + (-> self focus-status) + ) + (>= (the-as time-frame (-> self no-load-wait)) (-> self clock frame-counter)) + ) + ) + ) + (go target-load-wait) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-44) + (b! (!= v1-0 'gun-combo) cfg-46 :delay (nop!)) + (set! v0-0 #t) + (b! #t cfg-291 :delay (nop!)) + (label cfg-46) + (b! (!= v1-0 'change-mode) cfg-191 :delay (nop!)) + (let ((v1-45 (-> arg3 param 0))) + (set! v0-0 + (cond + ((= v1-45 'grab) + (when (not (logtest? (-> self focus-status) (focus-status dead))) + (if (not (-> arg3 param 1)) + #t + (go target-grab 'stance) + ) + ) + ) + ((= v1-45 'look-around) + (go target-look-around) + ) + ((= v1-45 'falling) + (go target-falling #f) + ) + ((= v1-45 'racer) + (if *debug-segment* + (load-package "racerp" global) + ) + (go target-racing-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ((= v1-45 'flut) + (if *debug-segment* + (load-package "flutp" global) + ) + (go target-flut-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ((= v1-45 'board) + (if (logtest? (-> self game features) (game-feature board)) + (go target-board-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ) + ((or (= v1-45 'pilot) (= v1-45 'pilot-race) (= v1-45 'pilot-daxter) (= v1-45 'pilot-race-daxter)) + (let ((s5-1 (the-as object (-> arg3 param 1)))) + (when (not (the-as uint s5-1)) + (let ((s4-1 (new 'stack 'traffic-object-spawn-params))) + (case (-> arg3 param 0) + (('pilot-race 'pilot-race-daxter) + (set! s3-0 (type-from-race-vehicle-type (the-as int (-> arg3 param 2)))) + ) + (else + (set! s3-0 (type-from-vehicle-type (the-as vehicle-type (-> arg3 param 2)))) + ) + ) + (when s3-0 + (set! (-> s4-1 position quad) (-> self control trans quad)) + (quaternion-copy! (-> s4-1 rotation) (-> self control quat)) + (set! (-> s4-1 id) (the-as uint 0)) + (set! (-> s4-1 behavior) (the-as uint 4)) + (let ((a0-87 (vehicle-spawn self s3-0 s4-1))) + (if a0-87 + (set! s5-1 a0-87) + ) + ) + ) + ) + ) + (when s5-1 + (case (-> arg3 param 0) + (('pilot-daxter 'pilot-race-daxter) + #t + ) + (else + ) + ) + enter-state + (let ((a0-93 (process->handle s5-1))) + (-> arg3 param 3) + (go target-pilot-start (the-as handle a0-93)) + ) + ) + ) + ) + ((= v1-45 'mech) + (if *debug-segment* + (load-package "mechp" global) + ) + enter-state + (let ((a0-101 (process->handle (the-as process (-> arg3 param 1))))) + (if (>= arg1 2) + (-> arg3 param 2) + #x42c80000 + ) + (go target-mech-start (the-as handle a0-101)) + ) + ) + ((= v1-45 'indax) + enter-state + (process->handle (the-as process (-> arg3 param 1))) + (go target-indax-start) + ) + ((= v1-45 'gun) + (if (logtest? (-> self game features) (game-feature gun)) + (the-as object (target-gun-init (the-as int (-> arg3 param 2)))) + ) + ) + ((= v1-45 'tube) + (if (and (logtest? (-> self control status) (collide-status on-surface)) + (not (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + ) + ) + (go target-tube-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ) + ((= v1-45 'turret) + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-turret-get-on (process->handle (the-as process (-> arg3 param 1)))) + ) + ) + ((= v1-45 'darkjak) + (cond + ((not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (go target-darkjak-get-on (the-as int (-> arg3 param 2))) + ) + ((logtest? (-> arg3 param 2) 128) + (set! (-> self darkjak stage) (logand -2 (-> self darkjak stage))) + (set! v0-0 (+ (- (seconds 20) (-> self fact-override darkjak-start-time)) (-> self clock frame-counter))) + (set! (-> self fact-override darkjak-effect-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + ) + ((= v1-45 'hide) + (go target-hide) + ) + ((= v1-45 'normal) + (if (and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (and (not (logtest? (-> self focus-status) (focus-status dead dangerous hit grabbed))) + (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + ) + ) + (go target-darkjak-get-off) + ) + ) + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-191) + (b! (!= v1-0 'end-mode) cfg-212 :delay (nop!)) + (set! v0-0 + (cond + ((and (using-gun? self) (target-gun-end-mode #f)) + (go target-stance) + ) + ((and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (and (not (logtest? (-> self focus-status) (focus-status dead dangerous hit grabbed))) + (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + ) + ) + (go target-darkjak-get-off) + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-212) + (b! (!= v1-0 'gun) cfg-214 :delay (nop!)) + (set! v0-0 (the-as object (target-gun-fire (the-as pickup-type (-> arg3 param 0))))) + (b! #t cfg-291 :delay (nop!)) + (label cfg-214) + (b! (!= v1-0 'darkjak) cfg-225 :delay (nop!)) + (set! v0-0 + (when (and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (zero? (-> self darkjak want-stage)) + ) + (let ((v1-164 (-> arg3 param 0))) + (when (logtest? v1-164 4) + (set! (-> self darkjak want-stage) v1-164) + (go target-darkjak-bomb0) + ) + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-225) + (b! (!= v1-0 'play-anim) cfg-227 :delay (nop!)) + (set! v0-0 (go target-play-anim (the-as string (-> arg3 param 0)) (the-as handle a1-1))) + (b! #t cfg-291 :delay (nop!)) + (label cfg-227) + (b! (!= v1-0 'clone-anim) cfg-234 :delay (nop!)) + (set! v0-0 (go target-clone-anim (process->handle (the-as process (-> arg3 param 0))))) + (b! #t cfg-291 :delay (nop!)) + (label cfg-234) + (b! (!= v1-0 'edge-grab) cfg-238 :delay (nop!)) + (b! (logtest? (-> self focus-status) (focus-status dead hit grabbed)) cfg-237 :delay (set! v0-0 #f)) + (set! v0-0 (go target-edge-grab)) + (label cfg-237) + (b! #t cfg-291 :delay (nop!)) + (label cfg-238) + (b! (!= v1-0 'pilot-edge-grab) cfg-242 :delay (nop!)) + (b! (logtest? (-> self focus-status) (focus-status dead hit grabbed)) cfg-241 :delay (set! v0-0 #f)) + enter-state + (-> arg3 param 0) + (set! v0-0 (go target-pilot-edge-grab)) + (label cfg-241) + (b! #t cfg-291 :delay (nop!)) + (label cfg-242) + (b! (!= v1-0 'pole-grab) cfg-256 :delay (nop!)) + (set! v0-0 + (if (and (not (logtest? (-> self focus-status) (focus-status dead hit grabbed pole))) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 2) + ) + (-> self draw art-group data 104) + ) + (go target-pole-cycle (process->handle arg0)) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-256) + (b! (!= v1-0 'swim) cfg-270 :delay (nop!)) + (set! v0-0 + (if (not (or (= (-> self control mod-surface mode) 'swim) + (= (-> self control mod-surface mode) 'dive) + (and (-> self next-state) (= (-> self next-state name) 'target-hit)) + (logtest? (-> self focus-status) (focus-status dead hit grabbed)) + ) + ) + (go target-swim-stance) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-270) + (b! (!= v1-0 'wade) cfg-286 :delay (nop!)) + (set! v0-0 + (if (and (!= (-> self control mod-surface mode) 'wade) + (and (-> self next-state) + (let ((v1-206 (-> self next-state name))) + (or (= v1-206 'target-stance) (= v1-206 'target-walk) (= v1-206 'target-stance-look-around)) + ) + ) + (zero? (logand (-> self focus-status) (focus-status dead hit grabbed))) + ) + (go target-wade-stance) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-286) + (b! (!= v1-0 'slide) cfg-290 :delay (nop!)) + (b! + (logtest? (-> self focus-status) (focus-status dead hit grabbed on-water under-water)) + cfg-289 + :delay (set! v0-0 #f) + ) + (set! v0-0 (go target-slide-down-to-ground)) + (label cfg-289) + (b! #t cfg-291 :delay (nop!)) + (label cfg-290) + (set! v0-0 (target-generic-event-handler arg0 arg1 arg2 arg3)) + (label cfg-291) + (the-as object v0-0) + ) + ) + ) + ) + +(defbehavior target-dangerous-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (cond + ((< 0.0 (-> (the-as fact-info-target (-> self fact-override)) shield-level)) + (let ((s4-1 (-> self control penetrate-using))) + (set! (-> self control penetrate-using) (penetrate touch shield)) + (let ((v0-0 (the-as object (target-send-attack + arg0 + 'shield + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> (the-as fact-info-target (-> self fact-override)) shield-attack-id)) + 0 + (the-as uint (-> self control penetrate-using)) + ) + ) + ) + ) + (set! (-> self control penetrate-using) s4-1) + v0-0 + ) + ) + ) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 1920) + ) + (target-send-attack + arg0 + (-> self control danger-mode) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (the-as uint (-> self control penetrate-using)) + ) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-hit + ) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + +(defbehavior target-bonk-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (cond + ((and (= arg2 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 6) + ) + (< (* 16384.0 (-> self clock time-adjust-ratio)) + (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control transv) (-> self control last-transv)) + ) + ) + (begin + (vector-normalize! + (vector-! + s4-0 + (the-as vector (-> self control collision-spheres 0 prim-core)) + (-> self control actor-contact-pt) + ) + 1.0 + ) + (< 0.01 (-> s4-0 y)) + ) + ) + (if (< 0.75 (-> s4-0 y)) + (send-event + arg0 + 'bonk + (-> arg3 param 0) + (fmax + (-> self control ground-impact-vel) + (- (vector-dot (-> self control transv) (-> self control dynam gravity-normal))) + ) + ) + ) + (let ((f0-7 (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control highest-jump-mark) (-> self control trans)) + ) + ) + ) + (when (< (-> *TARGET-bank* fall-far) f0-7) + (when (and (target-send-attack + arg0 + 'bonk + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (the-as uint (-> self control penetrate-using)) + ) + (zero? (logand (-> self focus-status) (focus-status dead hit))) + ) + (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) + (target-timed-invulnerable (seconds 0.1) self 1) + (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) + ) + ) + ) + #f + ) + ((= arg2 'jump) + (sound-play "jump-long") + (go + target-jump + (the-as float (-> arg3 param 0)) + (the-as float (-> arg3 param 1)) + (the-as surface (-> arg3 param 2)) + ) + ) + ) + ) + ) + +(defbehavior target-jump-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'swim) (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + (return #f) + ) + (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +(defbehavior target-walk-event-handler target ((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-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +target-post + +target-standard-event-handler + +(defbehavior target-exit target () + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control anim-collide-offset-local quad) (the-as uint128 0)) + (set! (-> self control anim-collide-offset-world quad) (the-as uint128 0)) + (set! (-> self control old-anim-collide-offset-world quad) (the-as uint128 0)) + (set! (-> self control draw-offset quad) (the-as uint128 0)) + (set! (-> self control force-turn-to-strength) 0.0) + (set! (-> self control bend-target) 0.0) + (set! (-> self control bomb-scale) 0.0) + (logclear! + (-> self state-flags) + (state-flags sf1 sf5 sf13 sf14 sf15 lleg-still rleg-still lleg-no-ik rleg-no-ik) + ) + (logclear! (-> self focus-status) (focus-status hit grabbed in-head teleporting)) + (target-danger-set! 'harmless #f) + (logior! (-> self water flags) (water-flags swim-ground)) + (logclear! (-> self water flags) (water-flags jump-out)) + (set! (-> self water drip-mult) 1.0) + (set! (-> self neck flex-blend) 1.0) + (set! (-> self neck base-joint) (the-as uint 6)) + (set! (-> self control duck-gun-tube-transision) 0.0) + (logclear! (-> self skel status) (joint-control-status valid-spooled-frame)) + (logclear! (-> self control status) (collide-status touch-ceiling-sticky)) + (initialize (-> self control impact-ctrl) self -1 0.0 (collide-spec)) + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + *null-vector* + *null-vector* + (the-as process #f) + 0 + ) + (logclear! (-> self skel effect flags) (effect-control-flag ecf2)) + 0 + (none) + ) + +;; WARN: Return type mismatch (function none) vs none. +(defbehavior target-state-hook-exit target () + (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) + (none) + ) + +;; WARN: Return type mismatch state-flags vs none. +(defbehavior target-effect-exit target () + (let ((v1-1 (-> self skel effect))) + (set! (-> v1-1 channel-offset) 0) + ) + 0 + (logclear! (-> self state-flags) (state-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) + (none) + ) diff --git a/goal_src/jak2/engine/target/target-util.gc b/goal_src/jak2/engine/target/target-util.gc index 60538535d9..5d7148c870 100644 --- a/goal_src/jak2/engine/target/target-util.gc +++ b/goal_src/jak2/engine/target/target-util.gc @@ -1578,7 +1578,7 @@ ) ) -(defmethod attack-info-method-10 attack-info ((obj attack-info) (arg0 object) (arg1 process-drawable) (arg2 process) (arg3 touching-shapes-entry)) +(defmethod compute-intersect-info attack-info ((obj attack-info) (arg0 object) (arg1 process-drawable) (arg2 process) (arg3 touching-shapes-entry)) (when (and arg3 arg1) (let ((a1-2 (prims-touching? arg3 (the-as collide-shape (-> arg1 root)) (the-as uint -1)))) (when a1-2 diff --git a/goal_src/jak2/engine/target/target.gc b/goal_src/jak2/engine/target/target.gc index 9a0e8bebb6..90faa24615 100644 --- a/goal_src/jak2/engine/target/target.gc +++ b/goal_src/jak2/engine/target/target.gc @@ -2094,8 +2094,8 @@ ) (when (target-send-attack proc - (the-as uint (-> self control danger-mode)) - (-> event param 0) + (-> self control danger-mode) + (the-as touching-shapes-entry (-> event param 0)) (the-as int (-> self control target-attack-id)) (the-as int (-> self control attack-count)) (the-as uint (-> self control penetrate-using)) @@ -2234,12 +2234,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-1 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 38 - (s5-1) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 38) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) (talker-spawn-func (-> *talker-speech* 328) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -2355,8 +2350,8 @@ ) (let ((gp-1 (target-send-attack proc - (the-as uint (-> self control danger-mode)) - (-> event param 0) + (-> self control danger-mode) + (the-as touching-shapes-entry (-> event param 0)) (the-as int (-> self control target-attack-id)) (the-as int (-> self control attack-count)) (the-as uint (-> self control penetrate-using)) @@ -2542,12 +2537,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-1 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 22 - (s5-1) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 22) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) (talker-spawn-func (-> *talker-speech* 328) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -2748,7 +2738,7 @@ ) ) ) - (effect-control-method-12 + (play-effect-sound (-> self skel effect) 'punch -1.0 @@ -2991,12 +2981,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-0 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 31 - (s5-0) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 31) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) (talker-spawn-func (-> *talker-speech* 328) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -3291,12 +3276,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-0 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 22 - (s5-0) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 22) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) ) (if (and (= (-> self control danger-mode) 'uppercut) @@ -3500,16 +3480,11 @@ ) ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) - (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) - (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) - ) - (let ((s4-0 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-strike-ground - (ja-frame-num 0) - 0 - (s4-0) + (if (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) + (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) + ) + (do-effect (-> self skel effect) 'group-red-eco-strike-ground (ja-frame-num 0) 0) ) - ) (let ((v1-56 (process-spawn touch-tracker :init touch-tracker-init (-> self control trans) #x45800000 30 :to self)) ) (send-event @@ -3530,17 +3505,11 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let* ((gp-2 (-> self skel effect)) - (s5-2 (method-of-object gp-2 effect-control-method-10)) - ) - 'group-red-eco-spinkick - (ja-frame-num 0) - (if (rand-vu-percent? 0.5) - 22 - 18 - ) - (s5-2) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) (if (rand-vu-percent? 0.5) + 22 + 18 + ) + ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) ) (when (and (not (-> self control danger-mode)) @@ -3753,17 +3722,11 @@ ) (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) ) - (let* ((gp-0 (-> self skel effect)) - (s5-0 (method-of-object gp-0 effect-control-method-10)) - ) - 'group-red-eco-spinkick - (ja-frame-num 0) - (if (rand-vu-percent? 0.5) - 22 - 18 - ) - (s5-0) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) (if (rand-vu-percent? 0.5) + 22 + 18 + ) + ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) ) (let ((v1-37 (ja-group))) diff --git a/goal_src/jak2/kernel/gkernel-h.gc b/goal_src/jak2/kernel/gkernel-h.gc index 9c4b6f96fe..3bbc1dbe1d 100644 --- a/goal_src/jak2/kernel/gkernel-h.gc +++ b/goal_src/jak2/kernel/gkernel-h.gc @@ -481,7 +481,7 @@ (defmacro process->ppointer (proc) "safely get a (pointer process) from a process, returning #f if invalid." - `(let ((the-proc ,proc)) + `(let ((the-proc (the-as process ,proc))) (if the-proc (-> the-proc ppointer)) ) ) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 19e0eb8fa7..5ffe7c662c 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -116,8 +116,8 @@ ) (defmacro process->ppointer (proc) - ;"safely get a (pointer process) from a process, returning #f if invalid." - `(let ((the-proc ,proc)) + "safely get a (pointer process) from a process, returning #f if invalid." + `(let ((the-proc (the-as process ,proc))) (if the-proc (-> the-proc ppointer)) ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc index af3ad6da5b..f8d5c020cc 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-target-h_REF.gc @@ -177,11 +177,11 @@ (time-of-last-debug-float time-frame :offset 5944) (danger-mode symbol :offset 5984) (target-attack-id uint32 :offset 5988) - (unknown-attack-id00 int32 :offset 5992) + (attacked-by-id int32 :offset 5992) (bomb-scale float :offset 5996) (attack-count uint64 :offset 6000) - (unknown-dword06 handle :offset 6008) - (unknown-time-frame000 time-frame :offset 6016) + (send-attack-dest handle :offset 6008) + (send-attack-time time-frame :offset 6016) (unknown-combo-tracker00 combo-tracker :inline :offset 6032) (unknown-time-frame21 time-frame :offset 6072) (unknown-dword07 int64 :offset 6096) diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc index 30aef05776..ac92eb214e 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc @@ -1049,14 +1049,12 @@ (the-as object (deactivate self)) ) ((= v1-0 'do-effect) - (when (and (nonzero? (-> self skel)) (-> self skel effect)) - (let ((t9-46 (method-of-object (-> self skel effect) effect-control-method-10))) - (-> event param 0) - (-> event param 1) - -1 - (the-as object (t9-46)) + (if (and (nonzero? (-> self skel)) (-> self skel effect)) + (the-as + object + (do-effect (-> self skel effect) (the-as symbol (-> event param 0)) (the-as float (-> event param 1)) -1) + ) ) - ) ) (else (if (-> self cur-event-hook) diff --git a/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc b/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc index cdb47ca65e..c45dbe71b0 100644 --- a/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type effect-control (deftype effect-control (basic) ((process process-drawable :offset-assert 4) (flags effect-control-flag :offset-assert 8) @@ -16,14 +18,15 @@ (:methods (new (symbol type process-drawable) _type_ 0) (effect-control-method-9 (_type_) none 9) - (effect-control-method-10 () none 10) + (do-effect (_type_ symbol float int) none 10) (effect-control-method-11 () none 11) - (effect-control-method-12 (_type_ symbol float int basic sound-name) int 12) + (play-effect-sound (_type_ symbol float int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) (effect-control-method-14 () none 14) ) ) +;; definition for method 3 of type effect-control (defmethod inspect effect-control ((obj effect-control)) (when (not obj) (set! obj obj) @@ -42,6 +45,7 @@ obj ) +;; definition for method 0 of type effect-control (defmethod new effect-control ((allocation symbol) (type-to-make type) (arg0 process-drawable)) (cond ((res-lump-struct (-> arg0 draw jgeo extra) 'effect-name structure) @@ -57,10 +61,13 @@ ) ) +;; definition for method 13 of type effect-control +;; WARN: Return type mismatch int vs none. (defmethod set-channel-offset! effect-control ((obj effect-control) (arg0 int)) (set! (-> obj channel-offset) arg0) 0 (none) ) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc index e80cb3a4fa..f254073301 100644 --- a/test/decompiler/reference/jak2/engine/game/game-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-h_REF.gc @@ -306,7 +306,7 @@ :flag-assert #xc000000a0 (:methods (attack-info-method-9 (_type_ attack-info process-drawable process-drawable) none 9) - (attack-info-method-10 (_type_ object process-drawable process touching-shapes-entry) attack-info 10) + (compute-intersect-info (_type_ object process-drawable process touching-shapes-entry) attack-info 10) (combine! (_type_ attack-info process-drawable) attack-info 11) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc index f2a76eaf78..472079a1c5 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc @@ -2559,7 +2559,7 @@ event-type (the-as attack-info (-> event param 1)) proc - (the-as process (-> event param 0)) + (the-as touching-shapes-entry (-> event param 0)) target-hit ) ) diff --git a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc index 207e3876c8..f88799f0b4 100644 --- a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc @@ -1043,20 +1043,10 @@ ) ) (spawn (-> self board part-control) (-> self control trans)) - (let ((t9-26 (method-of-object (-> self skel effect) effect-control-method-10))) - 'effect-board-poof - 0 - -1 - (t9-26) - ) - (when (< (-> self board shock-offset) -2048.0) - (let ((t9-27 (method-of-object (-> self skel effect) effect-control-method-10))) - 'effect-board-poof - 0 - -1 - (t9-27) + (do-effect (-> self skel effect) 'effect-board-poof 0.0 -1) + (if (< (-> self board shock-offset) -2048.0) + (do-effect (-> self skel effect) 'effect-board-poof 0.0 -1) ) - ) ) (vector-lerp! (-> self board slow-transv) (-> self board slow-transv) (-> self control transv) 0.2) (if (< (-> self board slow-transv y) 0.0) diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index 35bfd3f4a3..9b7cd9de77 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -3278,7 +3278,7 @@ (set! (-> obj control current-surface name) 'current) (set! (-> obj control current-surface active-hook) nothing) (set! (-> obj control current-surface touch-hook) nothing) - (set! (-> obj control unknown-dword06) (the-as handle #f)) + (set! (-> obj control send-attack-dest) (the-as handle #f)) (dotimes (v1-84 8) (set! (-> obj attack-info-old v1-84 attacker) (the-as handle #f)) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc index a13af6ea66..8b3e629a33 100644 --- a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -710,7 +710,7 @@ ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 (-> self control unknown-combo-tracker00) - (-> self control unknown-dword06) + (-> self control send-attack-dest) (-> self control trans) 24576.0 (-> self control c-R-w vector 2) @@ -950,7 +950,7 @@ ) ) (let ((t1-3 (make-u128 (the-as uint #x7469682d6863) (the-as uint #x6e75702d6b616a64)))) - (effect-control-method-12 + (play-effect-sound (-> self skel effect) 'punch -1.0 diff --git a/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc new file mode 100644 index 0000000000..bcb966d8cd --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc @@ -0,0 +1,1660 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function target-shoved +(defbehavior target-shoved target ((arg0 meters) (arg1 meters) (arg2 process) (arg3 (state object object target))) + (let ((s5-0 (new 'static 'attack-info))) + (set! (-> s5-0 attacker) (process->handle arg2)) + (set! (-> s5-0 shove-back) arg0) + (set! (-> s5-0 shove-up) arg1) + (set! (-> s5-0 angle) + (if (not (logtest? (logior (-> self control status) (-> self control old-status)) (collide-status on-surface))) + 'air + 'shove + ) + ) + (set! (-> s5-0 mask) (attack-info-mask attacker shove-back shove-up angle)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.1)) + (go arg3 'shove s5-0) + ) + ) + +;; definition for function attack-mode-is-invinc +(defun attack-mode-is-invinc ((arg0 symbol)) + (case arg0 + (('dark-eco-pool + 'endlessfall + 'melt + 'lava + 'bot + 'instant-death + 'grenade + 'drill-mech-master + 'centipede + 'drown-death + 'crush + 'death + ) + #t + ) + ) + ) + +;; definition for function target-attacked +;; INFO: Used lq/sq +(defbehavior target-attacked target ((arg0 symbol) + (arg1 attack-info) + (arg2 process) + (arg3 touching-shapes-entry) + (arg4 (state symbol attack-info target)) + ) + (let ((s4-0 (if (logtest? (-> arg1 mask) (attack-info-mask mode)) + (-> arg1 mode) + ) + ) + (s2-0 arg0) + ) + (when (or (and (not (logtest? (-> self focus-status) (focus-status hit))) + (zero? (logand (state-flags disable-attacks) (-> self state-flags))) + ) + (= s4-0 'endlessfall) + ) + (case s4-0 + (('endlessfall) + (if (not (-> *setting-control* user-current endlessfall)) + (return #f) + ) + ) + ) + (cond + ((or (logtest? (state-flags sf2 tinvul1 tinvul2) (-> self state-flags)) + (logtest? (-> self game secrets) (game-secrets invulnerable)) + (and (logtest? (-> self state-flags) (state-flags sf4)) (not (attack-mode-is-invinc s4-0))) + (< 0.0 (-> (the-as fact-info-target (-> self fact-override)) shield-level)) + (and (= s4-0 'darkeco) (and (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) + (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) + ) + (or (logtest? (-> self state-flags) (state-flags sf15)) + (logtest? (-> self focus-status) (focus-status dangerous)) + ) + ) + ) + ) + (case arg0 + (('attack-or-shove) + ) + (('attack-invinc) + (set! arg0 'attack) + ) + (else + (return #f) + ) + ) + ) + (else + (case arg0 + (('attack-or-shove 'attack-invinc) + (set! arg0 'attack) + ) + ) + ) + ) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer arg1) 160) + (compute-intersect-info (-> self attack-info-rec) arg1 self arg2 arg3) + (when (not (logtest? (focus-status mech) (-> self focus-status))) + (if (and (not (target-log-attack (-> self attack-info-rec) (if (logtest? (attack-info-mask test) (-> arg1 mask)) + 'test + 'log + ) + ) + ) + (!= s2-0 'attack-invinc) + ) + (return #f) + ) + ) + (if (logtest? (attack-info-mask test) (-> arg1 mask)) + (return #t) + ) + (set! (-> self control attacked-by-id) (the-as int (-> self attack-info-rec id))) + (cond + ((and (logtest? (-> self attack-info-rec mask) (attack-info-mask mode)) + (= (-> self attack-info-rec mode) 'damage) + (not (and (= (-> self game mode) 'play) + (>= 0.0 (- (-> (the-as fact-info-target (-> self fact-override)) health) (-> self attack-info-rec damage))) + ) + ) + ) + (pickup-collectable! + (-> self fact-override) + (pickup-type health) + (if (logtest? (attack-info-mask damage) (-> self attack-info-rec mask)) + (- (-> self attack-info-rec damage)) + (- (-> *FACT-bank* health-single-inc)) + ) + (the-as handle #f) + ) + (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-1 + (let ((t9-6 (method-of-type part-tracker activate))) + (t9-6 (the-as part-tracker gp-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((t9-7 run-function-in-process) + (a0-27 gp-1) + (a1-10 part-tracker-init) + (a2-9 (-> *part-group-id-table* 9)) + (a3-4 0) + (t0-2 #f) + (t1-0 #f) + (t2-0 #f) + (t3-0 *launch-matrix*) + ) + (set! (-> t3-0 trans quad) + (-> (the-as vector (if (logtest? (-> self attack-info-rec mask) (attack-info-mask intersection)) + (-> self attack-info-rec intersection) + (the-as vector (-> self control root-prim prim-core)) + ) + ) + quad + ) + ) + ((the-as (function object object object object object object object object none) t9-7) + a0-27 + a1-10 + a2-9 + a3-4 + t0-2 + t1-0 + t2-0 + t3-0 + ) + ) + (-> gp-1 ppointer) + ) + ) + (target-timed-invulnerable + (the-as time-frame (if (logtest? (-> self attack-info-rec mask) (attack-info-mask invinc-time)) + (the-as int (-> self attack-info-rec invinc-time)) + (the-as int (-> *TARGET-bank* hit-invulnerable-timeout)) + ) + ) + self + 1 + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.5)) + (sound-play "oof") + #t + ) + (else + (logior! (-> self focus-status) (focus-status ignore hit)) + (when (and (= (-> self game mode) 'play) + (and (or (and (>= 0.0 (- (-> (the-as fact-info-target (-> self fact-override)) health) (-> self attack-info-rec damage))) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + ) + (attack-mode-is-invinc s4-0) + ) + (= arg0 'attack) + ) + ) + (logior! (-> self focus-status) (focus-status dead)) + (set! (-> self state-flags) (logior (state-flags disable-attacks) (-> self state-flags))) + ) + (go arg4 arg0 (-> self attack-info-rec)) + ) + ) + ) + ) + ) + +;; definition for function target-send-attack +;; INFO: Used lq/sq +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: Stack slot offset 96 signed mismatch +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 711] +(defbehavior target-send-attack target ((arg0 process) (arg1 symbol) (arg2 touching-shapes-entry) (arg3 int) (arg4 int) (arg5 uint)) + (local-vars + (sv-96 symbol) + (sv-100 touching-prims-entry) + (sv-128 touching-prims-entry) + (sv-176 touching-prims-entry) + (sv-224 uint) + (sv-240 int) + (sv-256 symbol) + (sv-272 symbol) + (sv-288 symbol) + (sv-304 vector) + (sv-320 matrix) + (sv-336 int) + (sv-352 symbol) + (sv-368 symbol) + (sv-384 symbol) + (sv-400 vector) + (sv-416 matrix) + (sv-432 int) + (sv-448 symbol) + (sv-464 symbol) + (sv-480 symbol) + (sv-496 vector) + (sv-512 matrix) + (sv-528 int) + (sv-544 symbol) + (sv-560 symbol) + (sv-576 symbol) + (sv-592 vector) + (sv-608 matrix) + (sv-624 int) + (sv-640 symbol) + (sv-656 symbol) + (sv-672 symbol) + (sv-688 vector) + (sv-704 matrix) + ) + (set! sv-224 arg5) + (let* ((s3-0 arg0) + (s4-0 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + (s3-1 (and s4-0 (logtest? (-> (the-as process-focusable s4-0) focus-status) (focus-status dead hit)))) + ) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (the-as uint arg2)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id count penetrate-using)))) + (set! (-> v1-5 id) (the-as uint arg3)) + (set! (-> v1-5 mode) arg1) + (set! (-> v1-5 count) (the-as uint arg4)) + (set! (-> v1-5 penetrate-using) sv-224) + (set! (-> a1-2 param 1) (the-as uint v1-5)) + ) + (set! sv-96 (the-as symbol (send-event-function arg0 a1-2))) + ) + (when sv-96 + (set! (-> self control send-attack-dest) (process->handle arg0)) + (set! (-> self control send-attack-time) (-> self clock frame-counter)) + (send-event self 'hit arg1 arg0 arg2) + (set! arg0 (and (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 2) + ) + arg0 + ) + ) + (when (the-as object arg0) + (when (and s4-0 (not s3-1) (-> self control danger-mode) (zero? (logand (-> s4-0 mask) (process-mask dark-effect)))) + (logior! (-> s4-0 mask) (process-mask dark-effect)) + (process-spawn-function + process + (lambda :behavior target + ((arg0 handle)) + (local-vars (sv-112 vector) (sv-128 matrix)) + (let ((gp-0 (-> self parent))) + (let ((s4-0 0) + (s3-0 (-> self clock frame-counter)) + ) + (set! (-> self clock) (-> gp-0 0 clock)) + (while (let ((v1-48 gp-0)) + (and (or (logtest? (-> (the-as process-focusable (if v1-48 + (the-as process-focusable (-> v1-48 0 self)) + ) + ) + focus-status + ) + (focus-status dead hit) + ) + (let ((v1-53 gp-0)) + (and (-> (the-as process-focusable (if v1-53 + (the-as process-focusable (-> v1-53 0 self)) + ) + ) + next-state + ) + (let ((v1-56 gp-0)) + (= (-> (the-as process-focusable (if v1-56 + (the-as process-focusable (-> v1-56 0 self)) + ) + ) + next-state + name + ) + 'knocked + ) + ) + ) + ) + ) + (< (- (-> self clock frame-counter) s3-0) (seconds 15)) + (zero? (logand (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) + ) + ) + ) + (let ((s2-0 sp-launch-particles-var) + (s1-0 *sp-particle-system-2d*) + (s0-0 (-> *part-id-table* 178)) + ) + (set! sv-128 *launch-matrix*) + (set! sv-112 (-> sv-128 trans)) + (let ((v1-9 (-> (process-drawable-random-point! + (the-as process-drawable (ppointer->process gp-0)) + (new 'stack-no-clear 'vector) + ) + quad + ) + ) + ) + (set! (-> sv-112 quad) v1-9) + ) + (let ((a3-0 #f) + (t0-0 #f) + (t1-0 1.0) + ) + (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-0) (the-as sparticle-launch-control t0-0) t1-0) + ) + ) + (send-event (ppointer->process gp-0) 'color-effect 'dark 60) + (when (>= (- (-> self clock frame-counter) (the-as time-frame s4-0)) (seconds 0.05)) + (set! s4-0 (the-as int (-> self clock frame-counter))) + (cond + ((and (< (- (-> self clock frame-counter) s3-0) (seconds 0.5)) (handle->process arg0)) + (process-drawable2-shock-effect + (the-as process-drawable (handle->process arg0)) + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + ) + ) + (else + (send-event (handle->process arg0) 'color-effect 'shock 60) + (process-drawable-shock-effect + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + 0 + 0 + 40960.0 + ) + ) + ) + ) + (suspend) + ) + ) + (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) + (send-event (ppointer->process gp-0) 'color-effect #f 0) + ) + (none) + ) + (process->handle self) + :to s4-0 + ) + ) + ) + (let ((v1-37 arg1)) + (cond + ((or (= v1-37 'spin) (= v1-37 'spin-air) (= v1-37 'board-spin)) + (set! sv-100 (prims-touching? arg2 (-> self control) (the-as uint 256))) + (cond + (sv-100 + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-8 (method-of-type part-tracker activate))) + (t9-8 (the-as part-tracker s4-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-4 run-function-in-process) + (s2-1 s4-1) + (s1-1 part-tracker-init) + (s0-1 (-> *part-group-id-table* 10)) + ) + (set! sv-240 0) + (set! sv-256 (the-as symbol #f)) + (set! sv-272 (the-as symbol #f)) + (set! sv-288 (the-as symbol #f)) + (set! sv-320 *launch-matrix*) + (set! sv-304 (-> sv-320 trans)) + (let ((v1-50 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-100 (-> self control) arg2) quad))) + (set! (-> sv-304 quad) v1-50) + ) + ((the-as (function object object object object object object object object none) s3-4) + s2-1 + s1-1 + s0-1 + sv-240 + sv-256 + sv-272 + sv-288 + sv-320 + ) + ) + (-> s4-1 ppointer) + ) + ) + ) + (else + (do-effect (-> self skel effect) 'group-spin-hit -1.0 38) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (cond + ((= arg1 'board-spin) + (static-sound-name "board-impact") + ) + ((using-gun? self) + (static-sound-name "gun-spin-hit") + ) + (else + (static-sound-name "spin-hit") + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) + ) + ((or (= v1-37 'punch) (= v1-37 'mech-punch)) + (when arg2 + (set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 256))) + (cond + (sv-128 + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-17 (method-of-type part-tracker activate))) + (t9-17 (the-as part-tracker s4-3) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-6 run-function-in-process) + (s2-3 s4-3) + (s1-3 part-tracker-init) + (s0-3 (-> *part-group-id-table* 11)) + ) + (set! sv-336 0) + (set! sv-352 (the-as symbol #f)) + (set! sv-368 (the-as symbol #f)) + (set! sv-384 (the-as symbol #f)) + (set! sv-416 *launch-matrix*) + (set! sv-400 (-> sv-416 trans)) + (let ((v1-77 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) + (set! (-> sv-400 quad) v1-77) + ) + ((the-as (function object object object object object object object object none) s3-6) + s2-3 + s1-3 + s0-3 + sv-336 + sv-352 + sv-368 + sv-384 + sv-416 + ) + ) + (-> s4-3 ppointer) + ) + ) + ) + ((let ((v0-20 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-128 v0-20) + v0-20 + ) + (let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-4 + (let ((t9-22 (method-of-type part-tracker activate))) + (t9-22 (the-as part-tracker s4-4) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-7 run-function-in-process) + (s2-4 s4-4) + (s1-4 part-tracker-init) + (s0-4 (-> *part-group-id-table* 11)) + ) + (set! sv-432 0) + (set! sv-448 (the-as symbol #f)) + (set! sv-464 (the-as symbol #f)) + (set! sv-480 (the-as symbol #f)) + (set! sv-512 *launch-matrix*) + (set! sv-496 (-> sv-512 trans)) + (let ((v1-91 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) + (set! (-> sv-496 quad) v1-91) + ) + ((the-as (function object object object object object object object object none) s3-7) + s2-4 + s1-4 + s0-4 + sv-432 + sv-448 + sv-464 + sv-480 + sv-512 + ) + ) + (-> s4-4 ppointer) + ) + ) + ) + ) + ) + (case arg1 + (('mech-punch) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "mech-punch-hit")) + ) + (else + (let ((t1-6 (if (using-gun? self) + (static-sound-name "gun-punch-hit") + (static-sound-name "punch-hit") + ) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) t1-6) + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flip) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) + ) + ((= v1-37 'uppercut) + (set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 256))) + (cond + (sv-176 + (let ((s4-5 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-5 + (let ((t9-33 (method-of-type part-tracker activate))) + (t9-33 (the-as part-tracker s4-5) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-8 run-function-in-process) + (s2-5 s4-5) + (s1-5 part-tracker-init) + (s0-5 (-> *part-group-id-table* 11)) + ) + (set! sv-528 0) + (set! sv-544 (the-as symbol #f)) + (set! sv-560 (the-as symbol #f)) + (set! sv-576 (the-as symbol #f)) + (set! sv-608 *launch-matrix*) + (set! sv-592 (-> sv-608 trans)) + (let ((v1-123 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) + (set! (-> sv-592 quad) v1-123) + ) + ((the-as (function object object object object object object object object none) s3-8) + s2-5 + s1-5 + s0-5 + sv-528 + sv-544 + sv-560 + sv-576 + sv-608 + ) + ) + (-> s4-5 ppointer) + ) + ) + ) + ((let ((v0-34 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-176 v0-34) + v0-34 + ) + (let ((s4-6 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-6 + (let ((t9-38 (method-of-type part-tracker activate))) + (t9-38 (the-as part-tracker s4-6) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) + ) + (let ((s3-9 run-function-in-process) + (s2-6 s4-6) + (s1-6 part-tracker-init) + (s0-6 (-> *part-group-id-table* 11)) + ) + (set! sv-624 0) + (set! sv-640 (the-as symbol #f)) + (set! sv-656 (the-as symbol #f)) + (set! sv-672 (the-as symbol #f)) + (set! sv-704 *launch-matrix*) + (set! sv-688 (-> sv-704 trans)) + (let ((v1-137 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) + (set! (-> sv-688 quad) v1-137) + ) + ((the-as (function object object object object object object object object none) s3-9) + s2-6 + s1-6 + s0-6 + sv-624 + sv-640 + sv-656 + sv-672 + sv-704 + ) + ) + (-> s4-6 ppointer) + ) + ) + ) + ) + (do-effect (-> self skel effect) 'group-uppercut-hit -1.0 22) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "uppercut-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((or (= v1-37 'flop) (= v1-37 'flop-down)) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 22) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 18) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "flop-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flut-attack) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + ) + ((= v1-37 'darkjak) + (set! (-> self darkjak attack-time) (-> self clock frame-counter)) + (let* ((v1-160 *game-info*) + (a0-102 (+ (-> v1-160 attack-id) 1)) + ) + (set! (-> v1-160 attack-id) a0-102) + (set! (-> self darkjak attack-id) a0-102) + a0-102 + ) + ) + ) + ) + ) + ) + sv-96 + ) + +;; definition for function target-generic-event-handler +;; INFO: Used lq/sq +;; WARN: Return type mismatch none vs object. +(defbehavior target-generic-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-0 object)) + (the-as + object + (case arg2 + (('get-pickup) + (when (not (logtest? (-> self focus-status) (focus-status dead))) + (let ((s4-0 (-> arg3 param 0)) + (f28-0 (the-as float (-> arg3 param 1))) + ) + (if (!= (pickup-collectable! (-> self fact-override) (the-as pickup-type s4-0) 0.0 (the-as handle #f)) + (pickup-collectable! (-> self fact-override) (the-as pickup-type s4-0) f28-0 (process->handle arg0)) + ) + #t + 'full + ) + ) + ) + ) + (('test-pickup) + (let ((a1-6 (-> arg3 param 0))) + (pickup-collectable! (-> self fact-override) (the-as pickup-type a1-6) 0.0 (the-as handle #f)) + ) + ) + (('reset-pickup) + (the-as object (reset! (-> self fact-override) (the-as symbol (-> arg3 param 0)))) + ) + (('reset-collide) + (cond + ((-> self control collide-mode) + (target-collide-set! (-> self control collide-mode) (-> self control collide-mode-transition)) + ) + ((-> self control danger-mode) + (the-as object (target-danger-set! (-> self control danger-mode) #f)) + ) + ) + ) + (('level-deactivate) + (when (and (logtest? (focus-status pilot) (-> self focus-status)) + (or (= (-> arg3 param 0) 'ctywide) (and (= (-> arg3 param 0) 'lracelit) (-> self pilot as-daxter?))) + ) + (ja-channel-set! 0) + (target-gun-end-mode #t) + (set! (-> self skel top-anim interp) 0.0) + (let ((v1-30 (get-channel (-> self skel top-anim) 0))) + (if v1-30 + (set! (-> v1-30 frame-interp 1) 0.0) + ) + ) + (update (-> self skel top-anim)) + (when (not (logtest? (-> self focus-status) (focus-status grabbed))) + (set! (-> self event-hook) #f) + (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) + ) + ) + ) + (('level-enter) + (let ((s5-1 (level-get *level* (the-as symbol (-> arg3 param 0))))) + (when s5-1 + (let ((s4-1 (-> s5-1 info))) + (let ((v1-40 (-> s4-1 buzzer))) + (if (nonzero? v1-40) + (set! (-> self fact-override buzzer) 0.0) + (set! (-> self fact-override buzzer) (pickup-collectable! + (-> self fact-override) + (pickup-type buzzer) + (the float (logior -65536 v1-40)) + (the-as handle #f) + ) + ) + ) + ) + (if (zero? (-> self game task-enter-times (-> s4-1 task-level))) + (set! (-> self game task-enter-times (-> s4-1 task-level)) (-> *display* game-clock frame-counter)) + ) + ) + (let ((s4-2 (-> *game-info* sub-task-list))) + (dotimes (s3-0 (-> s4-2 length)) + (when (nonzero? s3-0) + (let ((s2-0 (-> s4-2 s3-0))) + (when (and (= (-> s5-1 info taskname) (-> s2-0 level)) + (zero? (-> self game task-close-times (-> s2-0 task))) + (= s3-0 (-> *game-info* play-list (-> s2-0 task) play-node)) + (or (logtest? (-> s2-0 flags) (game-task-node-flag closed)) (open? s2-0)) + (not (task-complete? (-> self game) (-> s2-0 task))) + (zero? (logand (game-task-node-flag utility-node) (-> s2-0 flags))) + ) + (when (zero? (-> self game task-close-times (-> s2-0 task))) + (format #t "--------------> set task start time for ~A~%" (-> s2-0 name)) + (set! (-> self game task-close-times (-> s2-0 task)) (-> *display* game-clock frame-counter)) + ) + ) + ) + ) + ) + ) + (update-task-masks 'level) + (format #t "GAMEPLAY: enter ~A~%" (-> arg3 param 0)) + ) + ) + ) + (('get-attack-count) + (set! v0-0 (+ (-> self control attack-count) (-> arg3 param 0))) + (set! (-> self control attack-count) (the-as uint v0-0)) + v0-0 + ) + (('continue) + (set! (-> self focus-status) (logior (focus-status teleporting) (-> self focus-status))) + (go target-continue (the-as continue-point (-> arg3 param 0))) + ) + (('query) + (case (-> arg3 param 0) + (('powerup) + (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) (-> arg3 param 1)) + (< 0.0 (-> (the-as fact-info-target (-> self fact-override)) eco-level)) + ) + ) + (('pickup) + (pickup-collectable! (-> self fact-override) (the-as pickup-type (-> arg3 param 1)) 0.0 (the-as handle #f)) + ) + (('ground-height) + (target-height-above-ground) + ) + (('gun-type) + (-> self gun gun-type) + ) + ) + ) + (('release) + (when (and (nonzero? (-> self gun)) (handle->process (-> self gun charge-active?))) + (set! (-> self gun charge-active?) (the-as handle #f)) + (set! v0-0 (-> self clock frame-counter)) + (set! (-> self gun fire-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + (('trans) + (case (-> arg3 param 0) + (('save) + (set! (-> self alt-cam-pos quad) (-> self control trans quad)) + (logior! (-> self state-flags) (state-flags sf12)) + (mem-copy! (the-as pointer (-> arg3 param 1)) (the-as pointer (-> self control trans)) 48) + ) + (('restore) + (logclear! (-> self state-flags) (state-flags sf12)) + (let ((gp-1 (-> arg3 param 1))) + (move-to-point! (-> self control) (the-as vector (+ gp-1 0))) + (quaternion-copy! (-> self control quat) (the-as quaternion (+ gp-1 16))) + ) + (rot->dir-targ! (-> self control)) + (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! v0-0 (-> self clock frame-counter)) + (set! (-> self control last-time-on-surface) (the-as time-frame v0-0)) + v0-0 + ) + (('reset) + (set! v0-0 (logclear (-> self state-flags) (state-flags sf12))) + (set! (-> self state-flags) (the-as state-flags v0-0)) + v0-0 + ) + ) + ) + (('effect) + (the-as object (target-powerup-effect (the-as symbol (-> arg3 param 0)))) + ) + (('color-effect) + (set! (-> self color-effect) (the-as basic (-> arg3 param 0))) + (set! (-> self color-effect-start-time) (-> self clock frame-counter)) + (set! v0-0 (-> arg3 param 1)) + (set! (-> self color-effect-duration) (the-as uint v0-0)) + v0-0 + ) + (('do-effect) + (do-effect (-> self skel effect) (the-as symbol (-> arg3 param 0)) (the-as float (-> arg3 param 1)) -1) + (if (-> self sidekick) + (the-as object (do-effect + (-> self sidekick 0 skel effect) + (the-as symbol (-> arg3 param 0)) + (the-as float (-> arg3 param 1)) + -1 + ) + ) + ) + ) + (('effect-control) + (when (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 32) + ) + (case (-> arg3 param 0) + (('effect-walk-step-left 'effect-walk-step-right 'effect-run-step-left 'effect-run-step-right) + (activate! *camera-smush-control* 409.6 15 75 1.0 0.98 (-> *display* camera-clock)) + ) + ) + ) + ) + (('neck) + (set! (-> self neck flex-blend) (the-as float (-> arg3 param 0))) + (cond + ((-> arg3 param 1) + (logior! (-> self state-flags) (state-flags sf13)) + (set! (-> self alt-neck-pos quad) (-> (the-as vector (-> arg3 param 1)) quad)) + (the-as object (look-at! (-> self neck) (-> self alt-neck-pos) 'force arg0)) + ) + (else + (set! v0-0 (logclear (-> self state-flags) (state-flags sf13))) + (set! (-> self state-flags) (the-as state-flags v0-0)) + v0-0 + ) + ) + ) + (('sidekick) + (cond + ((and (-> arg3 param 0) (not (-> self sidekick))) + (let ((gp-2 (get-process *default-dead-pool* sidekick #x4000))) + (set! v0-0 + (when gp-2 + (let ((t9-31 (method-of-type sidekick activate))) + (t9-31 (the-as sidekick gp-2) self (symbol->string (-> sidekick symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process gp-2 init-sidekick) + (-> gp-2 ppointer) + ) + ) + ) + (set! (-> self sidekick) (the-as (pointer sidekick) v0-0)) + v0-0 + ) + ((and (not (-> arg3 param 0)) (-> self sidekick)) + (deactivate (-> self sidekick 0)) + (set! (-> self sidekick) (the-as (pointer sidekick) #f)) + #f + ) + ) + ) + (('blend-shape) + (if (-> arg3 param 0) + (logior! (-> self skel status) (joint-control-status blend-shape)) + (logclear! (-> self skel status) (joint-control-status blend-shape)) + ) + (let ((v1-175 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-175 from) (process->ppointer arg0)) + (set! (-> v1-175 num-params) arg1) + (set! (-> v1-175 message) arg2) + (set! (-> v1-175 param 0) (-> arg3 param 0)) + (set! (-> v1-175 param 1) (-> arg3 param 1)) + (set! (-> v1-175 param 2) (-> arg3 param 2)) + (set! (-> v1-175 param 3) (-> arg3 param 3)) + (set! (-> v1-175 param 4) (-> arg3 param 4)) + (set! (-> v1-175 param 5) (-> arg3 param 5)) + (send-event-function (ppointer->process (-> self sidekick)) v1-175) + ) + ) + (('shadow) + (cond + ((-> arg3 param 0) + (let ((v1-178 (-> self draw shadow-ctrl))) + (logclear! (-> v1-178 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (else + (let ((v1-180 (-> self draw shadow-ctrl))) + (logior! (-> v1-180 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + (('rotate-y-angle) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (the-as float (-> arg3 param 0)) + ) + (if (= (-> *cpad-list* cpads (-> self control cpad number) stick0-speed) 0.0) + (rot->dir-targ! (-> self control)) + ) + ) + (('touched) + (cond + ((< 0.0 (-> (the-as fact-info-target (-> self fact-override)) shield-level)) + (let ((s4-3 (-> self control penetrate-using))) + (set! (-> self control penetrate-using) (penetrate touch shield)) + (let* ((v1-193 (-> self game)) + (a0-161 (+ (-> v1-193 attack-id) 1)) + ) + (set! (-> v1-193 attack-id) a0-161) + (set! (-> self fact-override shield-attack-id) a0-161) + ) + (set! v0-0 (target-send-attack + arg0 + 'shield + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> (the-as fact-info-target (-> self fact-override)) shield-attack-id)) + 0 + (the-as uint (-> self control penetrate-using)) + ) + ) + (set! (-> self control penetrate-using) s4-3) + ) + v0-0 + ) + ((and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (or (and (logtest? (focus-status dark) (-> self focus-status)) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) 16) + ) + (logtest? (process-mask crate) (-> arg0 mask)) + ) + ) + (target-send-attack + arg0 + 'darkjak + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self darkjak attack-id)) + 0 + (the-as uint #x10001) + ) + ) + (else + (send-event arg0 'touch (-> arg3 param 0)) + ) + ) + ) + (('dry) + (set! (-> self water drip-wetness) 0.0) + ) + (('reset-height) + (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) + #f + ) + (('draw) + (if (-> arg3 param 0) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (let ((v1-223 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-223 from) (process->ppointer arg0)) + (set! (-> v1-223 num-params) arg1) + (set! (-> v1-223 message) arg2) + (set! (-> v1-223 param 0) (-> arg3 param 0)) + (set! (-> v1-223 param 1) (-> arg3 param 1)) + (set! (-> v1-223 param 2) (-> arg3 param 2)) + (set! (-> v1-223 param 3) (-> arg3 param 3)) + (set! (-> v1-223 param 4) (-> arg3 param 4)) + (set! (-> v1-223 param 5) (-> arg3 param 5)) + (send-event-function (ppointer->process (-> self manipy)) v1-223) + ) + ) + (('no-load-wait) + (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + (set! (-> self no-load-wait) (the-as uint v0-0)) + v0-0 + ) + (('no-look-around) + (set! (-> self no-look-around-wait) + (the-as uint (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 0)))) + ) + (if (and (-> self next-state) (= (-> self next-state name) 'target-look-around)) + (send-event self 'end-mode) + ) + ) + (('change-state) + enter-state + (-> arg3 param 1) + (-> arg3 param 2) + (-> arg3 param 3) + (-> arg3 param 4) + (go (the-as (state target) (-> arg3 param 0))) + ) + (('tobot) + (set! v0-0 (-> arg3 param 0)) + (set! (-> self tobot?) (the-as symbol v0-0)) + v0-0 + ) + (('carry-info) + (-> self carry) + ) + (('gun-type) + (cond + ((-> arg3 param 0) + (the-as object (target-gun-type-set! (the-as int (-> arg3 param 0)))) + ) + (else + (set! v0-0 #t) + (set! (-> self gun put-away?) (the-as symbol v0-0)) + v0-0 + ) + ) + ) + (('get-notify) + (set! v0-0 (process->handle (the-as process (-> arg3 param 0)))) + (set! (-> self notify) (the-as handle v0-0)) + v0-0 + ) + ) + ) + ) + +;; definition for function target-standard-event-handler +;; INFO: Used lq/sq +;; WARN: Return type mismatch none vs object. +(defbehavior target-standard-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (at-0 int) (s3-0 type)) + (rlet ((vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let* ((v1-0 arg2) + (a1-1 (= v1-0 'attack)) + ) + (b! + (not (or a1-1 (begin (set! a1-1 (= v1-0 'attack-or-shove)) a1-1) (= v1-0 'attack-invinc))) + cfg-7 + :delay (nop!) + ) + (let ((v0-0 + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-hit + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-7) + (b! (!= v1-0 'shove) cfg-21 :delay (nop!)) + (set! v0-0 (when (not (and (-> self next-state) (= (-> self next-state name) 'target-hit))) + (mem-copy! (the-as pointer (-> self attack-info-rec)) (the-as pointer (-> arg3 param 1)) 160) + (when (not (logtest? (-> self attack-info-rec mask) (attack-info-mask attacker))) + (set! (-> self attack-info-rec attacker) (process->handle arg0)) + (logior! (-> self attack-info-rec mask) (attack-info-mask attacker)) + ) + (go target-hit 'shove (-> self attack-info-rec)) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-21) + (b! (!= v1-0 'push-trans) cfg-23 :delay (nop!)) + (let ((v1-15 (-> self control additional-decaying-velocity))) + (.lvf vf1 (&-> (the-as vector (-> arg3 param 0)) quad)) + (let ((f0-0 (-> self clock frames-per-second))) + (.mov at-0 f0-0) + ) + (.mov vf2 at-0) + (.mov.vf vf1 vf0 :mask #b1000) + (.mul.x.vf vf1 vf1 vf2 :mask #b111) + (.svf (&-> v1-15 quad) vf1) + ) + (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-decay-start-time) + (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + ) + (set! v0-0 #t) + (b! #t cfg-291 :delay (nop!)) + (label cfg-23) + (b! (!= v1-0 'push-transv) cfg-25 :delay (nop!)) + (set! (-> self control additional-decaying-velocity quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (set! (-> self control additional-decaying-velocity-end-time) (-> self clock frame-counter)) + (set! (-> self control additional-decaying-velocity-decay-start-time) + (+ (-> self clock frame-counter) (the-as time-frame (-> arg3 param 1))) + ) + (set! v0-0 #t) + (b! #t cfg-291 :delay (nop!)) + (label cfg-25) + (b! (!= v1-0 'loading) cfg-44 :delay (nop!)) + (set! v0-0 + (if (not (or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + (or (logtest? (-> self state-flags) (state-flags sf1)) + (logtest? (focus-status dead dangerous hit grabbed in-head edge-grab pole flut tube board pilot mech) + (-> self focus-status) + ) + (>= (the-as time-frame (-> self no-load-wait)) (-> self clock frame-counter)) + ) + ) + ) + (go target-load-wait) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-44) + (b! (!= v1-0 'gun-combo) cfg-46 :delay (nop!)) + (set! v0-0 #t) + (b! #t cfg-291 :delay (nop!)) + (label cfg-46) + (b! (!= v1-0 'change-mode) cfg-191 :delay (nop!)) + (let ((v1-45 (-> arg3 param 0))) + (set! v0-0 + (cond + ((= v1-45 'grab) + (when (not (logtest? (-> self focus-status) (focus-status dead))) + (if (not (-> arg3 param 1)) + #t + (go target-grab 'stance) + ) + ) + ) + ((= v1-45 'look-around) + (go target-look-around) + ) + ((= v1-45 'falling) + (go target-falling #f) + ) + ((= v1-45 'racer) + (if *debug-segment* + (load-package "racerp" global) + ) + (go target-racing-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ((= v1-45 'flut) + (if *debug-segment* + (load-package "flutp" global) + ) + (go target-flut-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ((= v1-45 'board) + (if (logtest? (-> self game features) (game-feature board)) + (go target-board-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ) + ((or (= v1-45 'pilot) (= v1-45 'pilot-race) (= v1-45 'pilot-daxter) (= v1-45 'pilot-race-daxter)) + (let ((s5-1 (the-as object (-> arg3 param 1)))) + (when (not (the-as uint s5-1)) + (let ((s4-1 (new 'stack 'traffic-object-spawn-params))) + (case (-> arg3 param 0) + (('pilot-race 'pilot-race-daxter) + (set! s3-0 (type-from-race-vehicle-type (the-as int (-> arg3 param 2)))) + ) + (else + (set! s3-0 (type-from-vehicle-type (the-as vehicle-type (-> arg3 param 2)))) + ) + ) + (when s3-0 + (set! (-> s4-1 position quad) (-> self control trans quad)) + (quaternion-copy! (-> s4-1 rotation) (-> self control quat)) + (set! (-> s4-1 id) (the-as uint 0)) + (set! (-> s4-1 behavior) (the-as uint 4)) + (let ((a0-87 (vehicle-spawn self s3-0 s4-1))) + (if a0-87 + (set! s5-1 a0-87) + ) + ) + ) + ) + ) + (when s5-1 + (case (-> arg3 param 0) + (('pilot-daxter 'pilot-race-daxter) + #t + ) + (else + ) + ) + enter-state + (let ((a0-93 (process->handle s5-1))) + (-> arg3 param 3) + (go target-pilot-start (the-as handle a0-93)) + ) + ) + ) + ) + ((= v1-45 'mech) + (if *debug-segment* + (load-package "mechp" global) + ) + enter-state + (let ((a0-101 (process->handle (the-as process (-> arg3 param 1))))) + (if (>= arg1 2) + (-> arg3 param 2) + #x42c80000 + ) + (go target-mech-start (the-as handle a0-101)) + ) + ) + ((= v1-45 'indax) + enter-state + (process->handle (the-as process (-> arg3 param 1))) + (go target-indax-start) + ) + ((= v1-45 'gun) + (if (logtest? (-> self game features) (game-feature gun)) + (the-as object (target-gun-init (the-as int (-> arg3 param 2)))) + ) + ) + ((= v1-45 'tube) + (if (and (logtest? (-> self control status) (collide-status on-surface)) + (not (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + ) + ) + (go target-tube-start (process->handle (the-as process (-> arg3 param 1)))) + ) + ) + ((= v1-45 'turret) + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-turret-get-on (process->handle (the-as process (-> arg3 param 1)))) + ) + ) + ((= v1-45 'darkjak) + (cond + ((not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (go target-darkjak-get-on (the-as int (-> arg3 param 2))) + ) + ((logtest? (-> arg3 param 2) 128) + (set! (-> self darkjak stage) (logand -2 (-> self darkjak stage))) + (set! v0-0 (+ (- (seconds 20) (-> self fact-override darkjak-start-time)) (-> self clock frame-counter))) + (set! (-> self fact-override darkjak-effect-time) (the-as time-frame v0-0)) + v0-0 + ) + ) + ) + ((= v1-45 'hide) + (go target-hide) + ) + ((= v1-45 'normal) + (if (and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (and (not (logtest? (-> self focus-status) (focus-status dead dangerous hit grabbed))) + (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + ) + ) + (go target-darkjak-get-off) + ) + ) + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-191) + (b! (!= v1-0 'end-mode) cfg-212 :delay (nop!)) + (set! v0-0 + (cond + ((and (using-gun? self) (target-gun-end-mode #f)) + (go target-stance) + ) + ((and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (and (not (logtest? (-> self focus-status) (focus-status dead dangerous hit grabbed))) + (not (and (-> self next-state) (= (-> self next-state name) 'target-darkjak-get-off))) + ) + ) + (go target-darkjak-get-off) + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-212) + (b! (!= v1-0 'gun) cfg-214 :delay (nop!)) + (set! v0-0 (the-as object (target-gun-fire (the-as pickup-type (-> arg3 param 0))))) + (b! #t cfg-291 :delay (nop!)) + (label cfg-214) + (b! (!= v1-0 'darkjak) cfg-225 :delay (nop!)) + (set! v0-0 + (when (and (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (zero? (-> self darkjak want-stage)) + ) + (let ((v1-164 (-> arg3 param 0))) + (when (logtest? v1-164 4) + (set! (-> self darkjak want-stage) v1-164) + (go target-darkjak-bomb0) + ) + ) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-225) + (b! (!= v1-0 'play-anim) cfg-227 :delay (nop!)) + (set! v0-0 (go target-play-anim (the-as string (-> arg3 param 0)) (the-as handle a1-1))) + (b! #t cfg-291 :delay (nop!)) + (label cfg-227) + (b! (!= v1-0 'clone-anim) cfg-234 :delay (nop!)) + (set! v0-0 (go target-clone-anim (process->handle (the-as process (-> arg3 param 0))))) + (b! #t cfg-291 :delay (nop!)) + (label cfg-234) + (b! (!= v1-0 'edge-grab) cfg-238 :delay (nop!)) + (b! (logtest? (-> self focus-status) (focus-status dead hit grabbed)) cfg-237 :delay (set! v0-0 #f)) + (set! v0-0 (go target-edge-grab)) + (label cfg-237) + (b! #t cfg-291 :delay (nop!)) + (label cfg-238) + (b! (!= v1-0 'pilot-edge-grab) cfg-242 :delay (nop!)) + (b! (logtest? (-> self focus-status) (focus-status dead hit grabbed)) cfg-241 :delay (set! v0-0 #f)) + enter-state + (-> arg3 param 0) + (set! v0-0 (go target-pilot-edge-grab)) + (label cfg-241) + (b! #t cfg-291 :delay (nop!)) + (label cfg-242) + (b! (!= v1-0 'pole-grab) cfg-256 :delay (nop!)) + (set! v0-0 + (if (and (not (logtest? (-> self focus-status) (focus-status dead hit grabbed pole))) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 2) + ) + (-> self draw art-group data 104) + ) + (go target-pole-cycle (process->handle arg0)) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-256) + (b! (!= v1-0 'swim) cfg-270 :delay (nop!)) + (set! v0-0 + (if (not (or (= (-> self control mod-surface mode) 'swim) + (= (-> self control mod-surface mode) 'dive) + (and (-> self next-state) (= (-> self next-state name) 'target-hit)) + (logtest? (-> self focus-status) (focus-status dead hit grabbed)) + ) + ) + (go target-swim-stance) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-270) + (b! (!= v1-0 'wade) cfg-286 :delay (nop!)) + (set! v0-0 + (if (and (!= (-> self control mod-surface mode) 'wade) + (and (-> self next-state) + (let ((v1-206 (-> self next-state name))) + (or (= v1-206 'target-stance) (= v1-206 'target-walk) (= v1-206 'target-stance-look-around)) + ) + ) + (zero? (logand (-> self focus-status) (focus-status dead hit grabbed))) + ) + (go target-wade-stance) + ) + ) + (b! #t cfg-291 :delay (nop!)) + (label cfg-286) + (b! (!= v1-0 'slide) cfg-290 :delay (nop!)) + (b! + (logtest? (-> self focus-status) (focus-status dead hit grabbed on-water under-water)) + cfg-289 + :delay (set! v0-0 #f) + ) + (set! v0-0 (go target-slide-down-to-ground)) + (label cfg-289) + (b! #t cfg-291 :delay (nop!)) + (label cfg-290) + (set! v0-0 (target-generic-event-handler arg0 arg1 arg2 arg3)) + (label cfg-291) + (the-as object v0-0) + ) + ) + ) + ) + +;; definition for function target-dangerous-event-handler +(defbehavior target-dangerous-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('touched) + (cond + ((< 0.0 (-> (the-as fact-info-target (-> self fact-override)) shield-level)) + (let ((s4-1 (-> self control penetrate-using))) + (set! (-> self control penetrate-using) (penetrate touch shield)) + (let ((v0-0 (the-as object (target-send-attack + arg0 + 'shield + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> (the-as fact-info-target (-> self fact-override)) shield-attack-id)) + 0 + (the-as uint (-> self control penetrate-using)) + ) + ) + ) + ) + (set! (-> self control penetrate-using) s4-1) + v0-0 + ) + ) + ) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 1920) + ) + (target-send-attack + arg0 + (-> self control danger-mode) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (the-as uint (-> self control penetrate-using)) + ) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + (('attack 'attack-or-shove 'attack-invinc) + (target-attacked + arg2 + (the-as attack-info (-> arg3 param 1)) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + target-hit + ) + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + +;; definition for function target-bonk-event-handler +;; INFO: Used lq/sq +(defbehavior target-bonk-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (cond + ((and (= arg2 'touched) + ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (-> self control) + (the-as uint 6) + ) + (< (* 16384.0 (-> self clock time-adjust-ratio)) + (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control transv) (-> self control last-transv)) + ) + ) + (begin + (vector-normalize! + (vector-! + s4-0 + (the-as vector (-> self control collision-spheres 0 prim-core)) + (-> self control actor-contact-pt) + ) + 1.0 + ) + (< 0.01 (-> s4-0 y)) + ) + ) + (if (< 0.75 (-> s4-0 y)) + (send-event + arg0 + 'bonk + (-> arg3 param 0) + (fmax + (-> self control ground-impact-vel) + (- (vector-dot (-> self control transv) (-> self control dynam gravity-normal))) + ) + ) + ) + (let ((f0-7 (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control highest-jump-mark) (-> self control trans)) + ) + ) + ) + (when (< (-> *TARGET-bank* fall-far) f0-7) + (when (and (target-send-attack + arg0 + 'bonk + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as int (-> self control target-attack-id)) + (the-as int (-> self control attack-count)) + (the-as uint (-> self control penetrate-using)) + ) + (zero? (logand (-> self focus-status) (focus-status dead hit))) + ) + (set! (-> self control last-trans-any-surf quad) (-> self control trans quad)) + (target-timed-invulnerable (seconds 0.1) self 1) + (go target-jump (-> *TARGET-bank* jump-height-min) (-> *TARGET-bank* jump-height-max) (the-as surface #f)) + ) + ) + ) + #f + ) + ((= arg2 'jump) + (sound-play "jump-long") + (go + target-jump + (the-as float (-> arg3 param 0)) + (the-as float (-> arg3 param 1)) + (the-as surface (-> arg3 param 2)) + ) + ) + ) + ) + ) + +;; definition for function target-jump-event-handler +(defbehavior target-jump-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (if (and (= arg2 'swim) (< 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + (return #f) + ) + (let ((v0-0 (target-bonk-event-handler arg0 arg1 arg2 arg3))) + (cond + (v0-0 + (empty) + v0-0 + ) + (else + (target-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +;; definition for function target-walk-event-handler +(defbehavior target-walk-event-handler target ((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-standard-event-handler arg0 arg1 arg2 arg3) + ) + ) + ) + ) + +;; failed to figure out what this is: +target-post + +;; failed to figure out what this is: +target-standard-event-handler + +;; definition for function target-exit +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-exit target () + (set! (-> self control mod-surface) *walk-mods*) + (set! (-> self control anim-collide-offset-local quad) (the-as uint128 0)) + (set! (-> self control anim-collide-offset-world quad) (the-as uint128 0)) + (set! (-> self control old-anim-collide-offset-world quad) (the-as uint128 0)) + (set! (-> self control draw-offset quad) (the-as uint128 0)) + (set! (-> self control force-turn-to-strength) 0.0) + (set! (-> self control bend-target) 0.0) + (set! (-> self control bomb-scale) 0.0) + (logclear! + (-> self state-flags) + (state-flags sf1 sf5 sf13 sf14 sf15 lleg-still rleg-still lleg-no-ik rleg-no-ik) + ) + (logclear! (-> self focus-status) (focus-status hit grabbed in-head teleporting)) + (target-danger-set! 'harmless #f) + (logior! (-> self water flags) (water-flags swim-ground)) + (logclear! (-> self water flags) (water-flags jump-out)) + (set! (-> self water drip-mult) 1.0) + (set! (-> self neck flex-blend) 1.0) + (set! (-> self neck base-joint) (the-as uint 6)) + (set! (-> self control duck-gun-tube-transision) 0.0) + (logclear! (-> self skel status) (joint-control-status valid-spooled-frame)) + (logclear! (-> self control status) (collide-status touch-ceiling-sticky)) + (initialize (-> self control impact-ctrl) self -1 0.0 (collide-spec)) + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + *null-vector* + *null-vector* + (the-as process #f) + 0 + ) + (logclear! (-> self skel effect flags) (effect-control-flag ecf2)) + 0 + (none) + ) + +;; definition for function target-state-hook-exit +;; WARN: Return type mismatch (function none) vs none. +(defbehavior target-state-hook-exit target () + (set! (-> self state-hook) (the-as (function none :behavior target) nothing)) + (none) + ) + +;; definition for function target-effect-exit +;; WARN: Return type mismatch state-flags vs none. +(defbehavior target-effect-exit target () + (let ((v1-1 (-> self skel effect))) + (set! (-> v1-1 channel-offset) 0) + ) + 0 + (logclear! (-> self state-flags) (state-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/target/target-util_REF.gc b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc index fcc4e150c6..eaeda596e7 100644 --- a/test/decompiler/reference/jak2/engine/target/target-util_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-util_REF.gc @@ -1743,7 +1743,7 @@ ) ;; definition for method 10 of type attack-info -(defmethod attack-info-method-10 attack-info ((obj attack-info) (arg0 object) (arg1 process-drawable) (arg2 process) (arg3 touching-shapes-entry)) +(defmethod compute-intersect-info attack-info ((obj attack-info) (arg0 object) (arg1 process-drawable) (arg2 process) (arg3 touching-shapes-entry)) (when (and arg3 arg1) (let ((a1-2 (prims-touching? arg3 (the-as collide-shape (-> arg1 root)) (the-as uint -1)))) (when a1-2 diff --git a/test/decompiler/reference/jak2/engine/target/target_REF.gc b/test/decompiler/reference/jak2/engine/target/target_REF.gc index c1ce5aa14f..99ab9b2517 100644 --- a/test/decompiler/reference/jak2/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target_REF.gc @@ -2118,8 +2118,8 @@ ) (when (target-send-attack proc - (the-as uint (-> self control danger-mode)) - (-> event param 0) + (-> self control danger-mode) + (the-as touching-shapes-entry (-> event param 0)) (the-as int (-> self control target-attack-id)) (the-as int (-> self control attack-count)) (the-as uint (-> self control penetrate-using)) @@ -2258,12 +2258,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-1 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 38 - (s5-1) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 38) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) (talker-spawn-func (-> *talker-speech* 328) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -2381,8 +2376,8 @@ ) (let ((gp-1 (target-send-attack proc - (the-as uint (-> self control danger-mode)) - (-> event param 0) + (-> self control danger-mode) + (the-as touching-shapes-entry (-> event param 0)) (the-as int (-> self control target-attack-id)) (the-as int (-> self control attack-count)) (the-as uint (-> self control penetrate-using)) @@ -2568,12 +2563,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-1 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 22 - (s5-1) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 22) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) (talker-spawn-func (-> *talker-speech* 328) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -2774,7 +2764,7 @@ ) ) ) - (effect-control-method-12 + (play-effect-sound (-> self skel effect) 'punch -1.0 @@ -3019,12 +3009,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-0 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 31 - (s5-0) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 31) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) (talker-spawn-func (-> *talker-speech* 328) *entity-pool* (target-pos 0) (the-as region #f)) ) @@ -3323,12 +3308,7 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let ((s5-0 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-spinkick - (ja-frame-num 0) - 22 - (s5-0) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) 22) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) ) (if (and (= (-> self control danger-mode) 'uppercut) @@ -3533,16 +3513,11 @@ ) ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) - (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) - (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) - ) - (let ((s4-0 (method-of-object (-> self skel effect) effect-control-method-10))) - 'group-red-eco-strike-ground - (ja-frame-num 0) - 0 - (s4-0) + (if (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) + (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) + ) + (do-effect (-> self skel effect) 'group-red-eco-strike-ground (ja-frame-num 0) 0) ) - ) (let ((v1-56 (process-spawn touch-tracker :init touch-tracker-init (-> self control trans) #x45800000 30 :to self)) ) (send-event @@ -3563,17 +3538,11 @@ (when (and (= (-> (the-as fact-info-target (-> self fact-override)) eco-type) 2) (>= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 1.0) ) - (let* ((gp-2 (-> self skel effect)) - (s5-2 (method-of-object gp-2 effect-control-method-10)) - ) - 'group-red-eco-spinkick - (ja-frame-num 0) - (if (rand-vu-percent? 0.5) - 22 - 18 - ) - (s5-2) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) (if (rand-vu-percent? 0.5) + 22 + 18 + ) + ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) ) (when (and (not (-> self control danger-mode)) @@ -3787,17 +3756,11 @@ ) (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.25)) ) - (let* ((gp-0 (-> self skel effect)) - (s5-0 (method-of-object gp-0 effect-control-method-10)) - ) - 'group-red-eco-spinkick - (ja-frame-num 0) - (if (rand-vu-percent? 0.5) - 22 - 18 - ) - (s5-0) - ) + (do-effect (-> self skel effect) 'group-red-eco-spinkick (ja-frame-num 0) (if (rand-vu-percent? 0.5) + 22 + 18 + ) + ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 153 (seconds 0.1)) ) (let ((v1-37 (ja-group))) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 7800fb7076..8ce9c99acc 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -191,7 +191,9 @@ "(method 10 joint-control)", "entity-lookup-part-group", - "process-drawable-shock-skel-effect" // stack array + "process-drawable-shock-skel-effect", // stack array + + "target-send-attack" ], "skip_compile_states": {