diff --git a/decompiler/config/all-types.gc b/decompiler/config/all-types.gc index e36eeca8da..8280b90a44 100644 --- a/decompiler/config/all-types.gc +++ b/decompiler/config/all-types.gc @@ -10934,7 +10934,7 @@ (dummy-37 () none 37) (dummy-38 () none 38) (dummy-39 () none 39) - (dummy-40 () none 40) + (dummy-40 (_type_ collide-sticky-rider-group) none 40) ;; WHAT ARE YOU (dummy-41 () none 41) (dummy-42 () none 42) (dummy-43 () none 43) @@ -11413,7 +11413,8 @@ ;; - Types (deftype projectile (process-drawable) - ((base-trans vector :inline :offset-assert 176) + ((root-override collide-shape-moving :score 100 :offset 112) + (base-trans vector :inline :offset-assert 176) (target vector :inline :offset-assert 192) (target-base vector :inline :offset-assert 208) (parent-base vector :inline :offset-assert 224) @@ -11421,8 +11422,8 @@ (base-vector vector :inline :offset-assert 256) (timeout uint64 :offset-assert 272) (options uint64 :offset-assert 280) - (last-target uint64 :offset-assert 288) - (notify-handle uint64 :offset-assert 296) + (last-target handle :offset-assert 288) + (notify-handle handle :offset-assert 296) (max-speed float :offset-assert 304) (max-turn float :offset-assert 308) (old-dist float 16 :offset-assert 312) @@ -11430,8 +11431,8 @@ (hits int32 :offset-assert 380) (max-hits int32 :offset-assert 384) (tween float :offset-assert 388) - (attack-mode basic :offset-assert 392) - (update-velocity basic :offset-assert 396) + (attack-mode symbol :offset-assert 392) + (update-velocity (function projectile none) :offset-assert 396) (counter int32 :offset-assert 400) (target-count int32 :offset-assert 404) (sound-id sound-id :offset-assert 408) @@ -11442,15 +11443,15 @@ :flag-assert #x1d0130019c ;; inherited inspect of process-drawable (:methods - (dummy-20 () none 20) - (projectile-dissipate () none 21) ;; state - (projectile-impact () none 22) ;; state - (dummy-23 () none 23) - (dummy-24 (_type_ ) none 24) - (dummy-25 () none 25) - (dummy-26 () none 26) - (dummy-27 () none 27) - (dummy-28 () none 28) + (unknown-state00 () _type_ :state 20) ;; state - sound related? + (projectile-dissipate () _type_ :state 21) ;; state + (projectile-impact () _type_ :state 22) ;; state + (unknown-state01 () _type_ :state 23) ;; state + (dummy-24 (_type_) none 24) + (dummy-25 (_type_) none 25) + (dummy-26 (_type_) none 26) + (dummy-27 (_type_) none 27) + (dummy-28 (_type_) none 28) ) ) @@ -18829,94 +18830,94 @@ ;; - Types -; (deftype target-bank (basic) -; ((jump-collide-offset meters :offset-assert 4) -; (jump-height-min meters :offset-assert 8) -; (jump-height-max meters :offset-assert 12) -; (double-jump-height-min meters :offset-assert 16) -; (double-jump-height-max meters :offset-assert 20) -; (flip-jump-height-min meters :offset-assert 24) -; (flip-jump-height-max meters :offset-assert 28) -; (duck-jump-height-min meters :offset-assert 32) -; (duck-jump-height-max meters :offset-assert 36) -; (flop-jump-height-min meters :offset-assert 40) -; (flop-jump-height-max meters :offset-assert 44) -; (attack-jump-height-min meters :offset-assert 48) -; (attack-jump-height-max meters :offset-assert 52) -; (edge-grab-jump-height-min meters :offset-assert 56) -; (edge-grab-jump-height-max meters :offset-assert 60) -; (swim-jump-height-min meters :offset-assert 64) -; (swim-jump-height-max meters :offset-assert 68) -; (tube-jump-height-min meters :offset-assert 72) -; (tube-jump-height-max meters :offset-assert 76) -; (wheel-duration uint64 :offset-assert 80) -; (wheel-jump-pre-window uint64 :offset-assert 88) -; (wheel-jump-post-window uint64 :offset-assert 96) -; (wheel-timeout uint64 :offset-assert 104) -; (wheel-speed-min meters :offset-assert 112) -; (wheel-speed-inc meters :offset-assert 116) -; (wheel-flip-duration uint64 :offset-assert 120) -; (wheel-flip-height meters :offset-assert 128) -; (wheel-flip-dist meters :offset-assert 132) -; (wheel-flip-art-height meters :offset-assert 136) -; (wheel-flip-art-dist meters :offset-assert 140) -; (duck-slide-distance meters :offset-assert 144) -; (fall-far meters :offset-assert 148) -; (fall-far-inc meters :offset-assert 152) -; (attack-timeout uint64 :offset-assert 160) -; (ground-timeout uint64 :offset-assert 168) -; (slide-down-timeout uint64 :offset-assert 176) -; (fall-timeout uint64 :offset-assert 184) -; (fall-stumble-threshold meters :offset-assert 192) -; (yellow-projectile-speed meters :offset-assert 196) -; (hit-invulnerable-timeout uint64 :offset-assert 200) -; (run-cycle-length float :offset-assert 208) -; (walk-cycle-dist meters :offset-assert 212) -; (walk-up-cycle-dist meters :offset-assert 216) -; (walk-down-cycle-dist meters :offset-assert 220) -; (walk-side-cycle-dist meters :offset-assert 224) -; (run-cycle-dist meters :offset-assert 228) -; (run-up-cycle-dist meters :offset-assert 232) -; (run-down-cycle-dist meters :offset-assert 236) -; (run-side-cycle-dist meters :offset-assert 240) -; (run-wall-cycle-dist meters :offset-assert 244) -; (duck-walk-cycle-dist meters :offset-assert 248) -; (wade-shallow-walk-cycle-dist meters :offset-assert 252) -; (wade-deep-walk-cycle-dist meters :offset-assert 256) -; (smack-surface-dist meters :offset-assert 260) -; (smack-surface-height meters :offset-assert 264) -; (min-dive-depth meters :offset-assert 268) -; (root-radius meters :offset-assert 272) -; (root-offset vector :inline :offset-assert 288) -; (body-radius meters :offset-assert 304) -; (edge-radius meters :offset-assert 308) -; (edge-offset vector :inline :offset-assert 320) -; (head-radius meters :offset-assert 336) -; (head-height meters :offset-assert 340) -; (head-offset vector :inline :offset-assert 352) -; (spin-radius meters :offset-assert 368) -; (spin-offset vector :inline :offset-assert 384) -; (duck-spin-radius meters :offset-assert 400) -; (duck-spin-offset vector :inline :offset-assert 416) -; (punch-radius meters :offset-assert 432) -; (punch-offset vector :inline :offset-assert 448) -; (uppercut-radius meters :offset-assert 464) -; (uppercut0-offset vector :inline :offset-assert 480) -; (uppercut1-offset vector :inline :offset-assert 496) -; (flop-radius meters :offset-assert 512) -; (flop0-offset vector :inline :offset-assert 528) -; (flop1-offset vector :inline :offset-assert 544) -; (stuck-time seconds :offset-assert 560) -; (stuck-timeout seconds :offset-assert 568) -; (stuck-distance meters :offset-assert 576) -; (tongue-pull-speed-min float :offset-assert 580) -; (tongue-pull-speed-max float :offset-assert 584) -; (yellow-attack-timeout uint64 :offset-assert 592) -; ) -; :method-count-assert 9 -; :size-assert #x258 -; :flag-assert #x900000258 -; ) +(deftype target-bank (basic) + ((jump-collide-offset meters :offset-assert 4) + (jump-height-min meters :offset-assert 8) + (jump-height-max meters :offset-assert 12) + (double-jump-height-min meters :offset-assert 16) + (double-jump-height-max meters :offset-assert 20) + (flip-jump-height-min meters :offset-assert 24) + (flip-jump-height-max meters :offset-assert 28) + (duck-jump-height-min meters :offset-assert 32) + (duck-jump-height-max meters :offset-assert 36) + (flop-jump-height-min meters :offset-assert 40) + (flop-jump-height-max meters :offset-assert 44) + (attack-jump-height-min meters :offset-assert 48) + (attack-jump-height-max meters :offset-assert 52) + (edge-grab-jump-height-min meters :offset-assert 56) + (edge-grab-jump-height-max meters :offset-assert 60) + (swim-jump-height-min meters :offset-assert 64) + (swim-jump-height-max meters :offset-assert 68) + (tube-jump-height-min meters :offset-assert 72) + (tube-jump-height-max meters :offset-assert 76) + (wheel-duration uint64 :offset-assert 80) + (wheel-jump-pre-window uint64 :offset-assert 88) + (wheel-jump-post-window uint64 :offset-assert 96) + (wheel-timeout uint64 :offset-assert 104) + (wheel-speed-min meters :offset-assert 112) + (wheel-speed-inc meters :offset-assert 116) + (wheel-flip-duration uint64 :offset-assert 120) + (wheel-flip-height meters :offset-assert 128) + (wheel-flip-dist meters :offset-assert 132) + (wheel-flip-art-height meters :offset-assert 136) + (wheel-flip-art-dist meters :offset-assert 140) + (duck-slide-distance meters :offset-assert 144) + (fall-far meters :offset-assert 148) + (fall-far-inc meters :offset-assert 152) + (attack-timeout uint64 :offset-assert 160) + (ground-timeout uint64 :offset-assert 168) + (slide-down-timeout uint64 :offset-assert 176) + (fall-timeout uint64 :offset-assert 184) + (fall-stumble-threshold meters :offset-assert 192) + (yellow-projectile-speed meters :offset-assert 196) + (hit-invulnerable-timeout uint64 :offset-assert 200) + (run-cycle-length float :offset-assert 208) + (walk-cycle-dist meters :offset-assert 212) + (walk-up-cycle-dist meters :offset-assert 216) + (walk-down-cycle-dist meters :offset-assert 220) + (walk-side-cycle-dist meters :offset-assert 224) + (run-cycle-dist meters :offset-assert 228) + (run-up-cycle-dist meters :offset-assert 232) + (run-down-cycle-dist meters :offset-assert 236) + (run-side-cycle-dist meters :offset-assert 240) + (run-wall-cycle-dist meters :offset-assert 244) + (duck-walk-cycle-dist meters :offset-assert 248) + (wade-shallow-walk-cycle-dist meters :offset-assert 252) + (wade-deep-walk-cycle-dist meters :offset-assert 256) + (smack-surface-dist meters :offset-assert 260) + (smack-surface-height meters :offset-assert 264) + (min-dive-depth meters :offset-assert 268) + (root-radius meters :offset-assert 272) + (root-offset vector :inline :offset-assert 288) + (body-radius meters :offset-assert 304) + (edge-radius meters :offset-assert 308) + (edge-offset vector :inline :offset-assert 320) + (head-radius meters :offset-assert 336) + (head-height meters :offset-assert 340) + (head-offset vector :inline :offset-assert 352) + (spin-radius meters :offset-assert 368) + (spin-offset vector :inline :offset-assert 384) + (duck-spin-radius meters :offset-assert 400) + (duck-spin-offset vector :inline :offset-assert 416) + (punch-radius meters :offset-assert 432) + (punch-offset vector :inline :offset-assert 448) + (uppercut-radius meters :offset-assert 464) + (uppercut0-offset vector :inline :offset-assert 480) + (uppercut1-offset vector :inline :offset-assert 496) + (flop-radius meters :offset-assert 512) + (flop0-offset vector :inline :offset-assert 528) + (flop1-offset vector :inline :offset-assert 544) + (stuck-time seconds :offset-assert 560) + (stuck-timeout seconds :offset-assert 568) + (stuck-distance meters :offset-assert 576) + (tongue-pull-speed-min float :offset-assert 580) + (tongue-pull-speed-max float :offset-assert 584) + (yellow-attack-timeout uint64 :offset-assert 592) + ) + :method-count-assert 9 + :size-assert #x258 + :flag-assert #x900000258 + ) ;; - Functions @@ -18950,7 +18951,7 @@ ;; - Unknowns -;;(define-extern *TARGET-bank* object) ;; unknown type +(define-extern *TARGET-bank* target-bank) ;; unknown type ;;(define-extern target-slide-down object) ;; unknown type ;;(define-extern target-falling object) ;; unknown type (define-extern *jchar-sg* skeleton-group) @@ -19243,7 +19244,7 @@ ;; - Functions (define-extern target-swim-tilt function) -(define-extern projectile-init-by-other function) +(define-extern projectile-init-by-other (function projectile vector vector uint handle none :behavior projectile)) ;; 4th arg is `options`, 5th is `last-target` (define-extern first-person-hud-init-by-other function) (define-extern disable-hud function) (define-extern enable-hud function) @@ -20260,7 +20261,7 @@ ;; - Functions -(define-extern eco-blue-glow function) +(define-extern eco-blue-glow (function collide-shape-prim none)) (define-extern cloud-track (function none)) @@ -20775,35 +20776,35 @@ ;; - Types -; (deftype search-info (structure) -; ((point vector :inline :offset-assert 0) -; (best-point vector :inline :offset-assert 16) -; (match-handle uint64 :offset-assert 32) -; (match basic :offset-assert 40) -; (best float :offset-assert 44) -; (radius float :offset-assert 48) -; (rating uint32 :offset-assert 52) -; (require uint32 :offset-assert 56) -; (mask uint32 :offset-assert 60) -; (rot-base vector :inline :offset-assert 64) -; (rot-range float :offset-assert 80) -; ) -; :method-count-assert 9 -; :size-assert #x54 -; :flag-assert #x900000054 -; ) +(deftype search-info (structure) + ((point vector :inline :offset-assert 0) + (best-point vector :inline :offset-assert 16) + (match-handle uint64 :offset-assert 32) + (match projectile :offset-assert 40) + (best float :offset-assert 44) + (radius float :offset-assert 48) + (rating uint32 :offset-assert 52) + (require uint32 :offset-assert 56) + (mask uint32 :offset-assert 60) + (rot-base vector :inline :offset-assert 64) + (rot-range float :offset-assert 80) + ) + :method-count-assert 9 + :size-assert #x54 + :flag-assert #x900000054 + ) ;; - Functions -(define-extern projectile-collision-reaction function) -(define-extern projectile-update-velocity-space-wars function) -(define-extern find-nearest-attackable function) +(define-extern projectile-collision-reaction (function collide-shape-moving collide-shape-intersect vector vector none)) +(define-extern projectile-update-velocity-space-wars (function projectile none)) +(define-extern find-nearest-attackable (function vector float uint32 uint32 vector float projectile)) ;; Whatever te search returns (match from search-info) (define-extern find-ground-and-draw-shadow (function vector vector float uint process float float none)) -(define-extern spawn-projectile-blue function) +(define-extern spawn-projectile-blue (function target none)) ;; - Unknowns -;;(define-extern *search-info* object) ;; unknown type +(define-extern *search-info* search-info) ;; unknown type ;; ---------------------- diff --git a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc index 549699a816..67ff6a1759 100644 --- a/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/anonymous_function_types.jsonc @@ -671,5 +671,17 @@ [1, "(function none :behavior minershort)"] ], + "projectiles": [ + [0, "(function none :behavior projectile)"], + [1, "(function symbol :behavior projectile)"], + [13, "(function symbol :behavior projectile)"], + [17, "(function none :behavior projectile)"], + [18, "(function none :behavior projectile)"], + [20, "(function none :behavior projectile)"], + [21, "(function process int symbol event-message-block object :behavior projectile)"], + [22, "(function uint :behavior projectile)"], + [27, "(function projectile int)"] + ], + "placeholder-do-not-add-below": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc index c7f3d1c7b7..efd33fc0d2 100644 --- a/decompiler/config/jak1_ntsc_black_label/label_types.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/label_types.jsonc @@ -1905,6 +1905,66 @@ ["L298", "float", true] ], + "projectiles": [ + ["L1", "_lambda_", true], + ["L2", "_lambda_", true], + ["L69", "_lambda_", true], + ["L76", "_lambda_", true], + ["L79", "_lambda_", true], + ["L93", "_lambda_", true], + ["L105", "_lambda_", true], + ["L114", "_lambda_", true], + ["L131", "_lambda_", true], + ["L144", "state", true], + ["L145", "state", true], + ["L146", "state", true], + ["L147", "state", true], + ["L148", "state", true], + ["L149", "state", true], + // ["L151", "sparticle-launcher", true], + // ["L153", "sparticle-launcher", true], + // ["L155", "sparticle-launcher", true], + // ["L157", "sparticle-launcher", true], + // ["L159", "sparticle-launcher", true], + // ["L161", "sparticle-launcher", true], + // // ["L163", "sparticle-launch-group", true], + // ["L166", "sparticle-launcher", true], + // ["L168", "sparticle-launcher", true], + // ["L170", "sparticle-launcher", true], + // ["L172", "sparticle-launcher", true], + // ["L174", "sparticle-launcher", true], + // ["L176", "sparticle-launcher", true], + // ["L178", "sparticle-launcher", true], + // // ["L180", "sparticle-launch-group", true], + // ["L183", "sparticle-launcher", true], + // ["L185", "sparticle-launcher", true], + // ["L187", "sparticle-launcher", true], + // ["L189", "sparticle-launcher", true], + // ["L191", "sparticle-launcher", true], + // ["L193", "sparticle-launcher", true], + // ["L195", "sparticle-launch-group", true], + ["L204", "float", true], + ["L210", "float", true], + ["L211", "float", true], + ["L212", "float", true], + ["L213", "float", true], + ["L214", "float", true], + ["L215", "float", true], + ["L217", "float", true], + ["L222", "float", true], + ["L223", "float", true], + ["L225", "float", true], + ["L229", "float", true], + ["L230", "float", true], + ["L231", "float", true], + ["L232", "float", true], + ["L236", "float", true], + ["L237", "float", true], + ["L238", "uint64", true], + ["L241", "uint64", true], + ["L242", "uint64", true] + ], + // please do not add things after this entry! git is dumb. "object-file-that-doesnt-actually-exist-and-i-just-put-this-here-to-prevent-merge-conflicts-with-this-file": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc index 33b2c9fe2b..fdcd090105 100644 --- a/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/stack_structures.jsonc @@ -1145,5 +1145,51 @@ [16, "vector"] ], + "(anon-function 27 projectiles)": [ + [16, "vector"] + ], + + "projectile-collision-reaction": [ + [16, "vector"], + [32, "vector"], + [48, "matrix"], + [96, "vector"], + [112, "event-message-block"], + [192, "vector"], + [208, "vector"] + ], + + "(anon-function 21 projectiles)": [ + [16, "event-message-block"] + ], + + "(anon-function 20 projectiles)": [ + [16, "vector"] + ], + + "projectile-update-velocity-space-wars": [ + [16, "vector"], + [32, "vector"], + [48, "vector"], + [64, "vector"] + ], + + "(anon-function 13 projectiles)": [ + [16, "event-message-block"] + ], + + "projectile-init-by-other": [ + [16, "collide-sticky-rider-group"] + ], + + "(method 27 projectile-yellow)": [ + [16, "vector"] + ], + + "spawn-projectile-blue": [ + [16, "vector"], + [32, "vector"] + ], + "placeholder-do-not-add-below!": [] } diff --git a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc index 2eb7da93aa..0b4c30825f 100644 --- a/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc +++ b/decompiler/config/jak1_ntsc_black_label/type_casts.jsonc @@ -2250,5 +2250,41 @@ [19, "v1", "float"] ], + "(anon-function 27 projectiles)": [ + [27, "s4", "collide-shape"], + [36, "s4", "collide-shape"] + ], + + "projectile-update-velocity-space-wars": [ + [60, "a0", "target"] + ], + + "projectile-init-by-other": [ + [70, "v1", "process-drawable"], + [77, "v1", "process-drawable"] + ], + + "(method 24 projectile-yellow)": [ + [99, "gp", "process-drawable"], + [102, "gp", "process-drawable"] + ], + + "(method 28 projectile-yellow)": [ + [26, "a0", "target"], + [118, "a1", "target"] + ], + + "(method 27 projectile-blue)": [ + [87, "v1", "process-drawable"] + ], + + "spawn-projectile-blue": [ + [74, "t9", "(function process function object object object object object object)"] + ], + + "(method 28 projectile-blue)": [ + [27, "v1", "process-drawable"] + ], + "placeholder-do-not-add-below": [] } diff --git a/test/decompiler/reference/engine/game/projectiles_REF.gc b/test/decompiler/reference/engine/game/projectiles_REF.gc new file mode 100644 index 0000000000..84b2039de1 --- /dev/null +++ b/test/decompiler/reference/engine/game/projectiles_REF.gc @@ -0,0 +1,1691 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type search-info +(deftype search-info (structure) + ((point vector :inline :offset-assert 0) + (best-point vector :inline :offset-assert 16) + (match-handle uint64 :offset-assert 32) + (match projectile :offset-assert 40) + (best float :offset-assert 44) + (radius float :offset-assert 48) + (rating uint32 :offset-assert 52) + (require uint32 :offset-assert 56) + (mask uint32 :offset-assert 60) + (rot-base vector :inline :offset-assert 64) + (rot-range float :offset-assert 80) + ) + :method-count-assert 9 + :size-assert #x54 + :flag-assert #x900000054 + ) + +;; definition for method 3 of type search-info +(defmethod inspect search-info ((obj search-info)) + (format #t "[~8x] ~A~%" obj 'search-info) + (format #t "~Tpoint: ~`vector`P~%" (-> obj point)) + (format #t "~Tbest-point: ~`vector`P~%" (-> obj best-point)) + (format #t "~Tmatch-handle: ~D~%" (-> obj match-handle)) + (format #t "~Tmatch: ~A~%" (-> obj match)) + (format #t "~Tbest: ~f~%" (-> obj best)) + (format #t "~Tradius: ~f~%" (-> obj radius)) + (format #t "~Trating: ~D~%" (-> obj rating)) + (format #t "~Trequire: ~D~%" (-> obj require)) + (format #t "~Tmask: ~D~%" (-> obj mask)) + (format #t "~Trot-base: ~`vector`P~%" (-> obj rot-base)) + (format #t "~Trot-range: ~f~%" (-> obj rot-range)) + obj + ) + +;; definition for symbol *search-info*, type search-info +(define *search-info* (new 'global 'search-info)) + +;; definition for function find-nearest-attackable +;; Used lq/sq +(defun + find-nearest-attackable + ((arg0 vector) + (arg1 float) + (arg2 uint32) + (arg3 uint32) + (arg4 vector) + (arg5 float) + ) + (let ((gp-0 *search-info*)) + (set! (-> gp-0 match) #f) + (set! (-> gp-0 point quad) (-> arg0 quad)) + (set! (-> gp-0 radius) arg1) + (set! (-> gp-0 best) arg1) + (set! (-> gp-0 rating) (the-as uint 0)) + (set! (-> gp-0 require) (the-as uint arg3)) + (set! (-> gp-0 mask) (the-as uint arg2)) + (set! (-> gp-0 rot-base quad) (-> arg4 quad)) + (set! (-> gp-0 rot-range) (if (= arg5 65536.0) + -2.0 + (cos arg5) + ) + ) + (iterate-process-tree *entity-pool* (lambda ((arg0 projectile)) + (when (logtest? #x828000 (-> arg0 mask)) + (let* ((gp-0 *search-info*) + (s4-0 arg0) + (s5-0 + (if + (and + (nonzero? s4-0) + (type-type? + (-> s4-0 type) + process-drawable + ) + ) + s4-0 + ) + ) + ) + (when s5-0 + (let* ((s3-0 (-> s5-0 root-override)) + (s4-1 + (if + (and + (nonzero? s3-0) + (type-type? + (-> s3-0 type) + collide-shape + ) + ) + s3-0 + ) + ) + ) + (when + (the-as collide-shape-moving s4-1) + (let* + ((s3-1 + (-> s4-1 root-prim prim-core) + ) + (f30-0 + (- + (vector-vector-distance + (-> gp-0 point) + (the-as vector s3-1) + ) + (-> s3-1 world-sphere w) + ) + ) + ) + (when + (nonzero? + (-> + s4-1 + root-prim + prim-core + collide-as + ) + ) + (let ((s4-2 0) + (v1-8 + (vector-normalize! + (vector-! + (new 'stack-no-clear 'vector + ) + (the-as vector s3-1) + (-> gp-0 point) + ) + 1.0 + ) + ) + ) + (if + (logtest? + #x20000 + (-> s5-0 mask) + ) + (set! s4-2 (logior s4-2 1)) + ) + (if + (and + (nonzero? (-> s5-0 draw)) + (nonzero? + (logand + (-> s5-0 draw status) + 8 + ) + ) + ) + (set! s4-2 (logior s4-2 2)) + ) + (let + ((a0-16 + (logand s4-2 (-> gp-0 mask)) + ) + ) + (when + (and + (>= + a0-16 + (the-as + int + (-> gp-0 rating) + ) + ) + (or + (zero? (-> gp-0 require)) + (nonzero? + (logand + a0-16 + (-> gp-0 require) + ) + ) + ) + (< f30-0 (-> gp-0 best)) + (>= + (vector-dot + v1-8 + (-> gp-0 rot-base) + ) + (-> gp-0 rot-range) + ) + ) + (set! (-> gp-0 match) s5-0) + (set! (-> gp-0 best) f30-0) + (set! + (-> gp-0 rating) + (the-as uint a0-16) + ) + a0-16 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + *null-kernel-context* + ) + (-> gp-0 match) + ) + ) + +;; definition for function projectile-collision-reaction +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defun + projectile-collision-reaction + ((arg0 collide-shape-moving) + (arg1 collide-shape-intersect) + (arg2 vector) + (arg3 vector) + ) + (local-vars + (sv-64 vector) + (sv-68 vector) + (sv-72 matrix) + (sv-80 int) + (sv-224 symbol) + ) + (with-pp + (set! sv-64 (new-stack-vector0)) + (set! sv-68 (new-stack-vector0)) + (set! sv-72 (new 'stack-no-clear 'matrix)) + (set! sv-80 0) + (set! (-> sv-72 vector 0 quad) (-> arg3 quad)) + (vector-float*! + (new 'stack-no-clear 'vector) + (-> arg1 move-vec) + (-> arg1 best-u) + ) + ((method-of-object arg0 dummy-28)) + (let ((t9-1 (method-of-object arg0 dummy-56))) + (-> arg1 best-tri pat) + (t9-1) + ) + (case (-> arg1 best-tri pat material) + (((pat-material stopproj)) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) pp) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'die) + (send-event-function (-> arg0 process) a1-3) + ) + ) + ) + (vector-! + sv-64 + (the-as vector (-> arg1 best-from-prim prim-core)) + (-> arg1 best-tri intersect) + ) + (set! (-> sv-64 w) 1.0) + (vector-normalize! sv-64 1.0) + (set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal))) + (let ((v1-22 (-> sv-64 quad))) + (set! (-> sv-68 quad) v1-22) + ) + (when (= (-> arg1 best-u) 0.0) + (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0) + ((method-of-object arg0 dummy-28)) + ) + (set! (-> arg0 surface-normal quad) (-> sv-68 quad)) + (set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad)) + (set! + (-> arg0 surface-angle) + (vector-dot sv-68 (-> arg0 dynam gravity-normal)) + ) + (set! + (-> arg0 poly-angle) + (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal)) + ) + (set! + (-> arg0 touch-angle) + (vector-dot + sv-68 + (vector-normalize! + (vector-negate! (new-stack-vector0) (the-as vector sv-72)) + 1.0 + ) + ) + ) + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-80 (logior sv-80 16)) + ) + (set! + sv-224 + (< + (fabs (-> arg0 surface-angle)) + (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle) + ) + ) + (if (zero? (logand (-> arg0 prev-status) 1)) + (set! + (-> arg0 ground-impact-vel) + (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))) + ) + ) + (set! sv-80 (logior sv-80 4)) + (if (-> arg1 best-to-prim) + (set! sv-80 (logior sv-80 32)) + ) + (cond + (sv-224 + (set! sv-80 (logior sv-80 8)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + ) + (else + (set! sv-80 (logior sv-80 1)) + (set! (-> arg0 local-normal quad) (-> sv-68 quad)) + ) + ) + (vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68) + (when (and (not sv-224) (>= (-> arg0 coverage) 0.9)) + (set! sv-80 (logior sv-80 2)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (when (!= (-> arg0 poly-pat mode) 1) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)) + ) + ) + (logior! (-> arg0 status) sv-80) + sv-80 + (none) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 102) L195) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 349) L193) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 350) L191) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 351) L189) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 352) L187) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 353) L185) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 354) L183) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 103) L180) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 355) L178) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 357) L176) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 356) L174) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 360) L172) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 358) L170) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 361) L168) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 359) L166) + +;; failed to figure out what this is: +(set! (-> *part-group-id-table* 104) L163) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2060) L161) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2063) L159) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2062) L157) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2059) L155) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2061) L153) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 2064) L151) + +;; definition for method 24 of type projectile +;; INFO: Return type mismatch int vs none. +(defmethod dummy-24 projectile ((obj projectile)) + (let ((t9-0 (method-of-object (-> obj part) dummy-11))) + (-> obj root-override root-prim prim-core) + (t9-0) + ) + 0 + (none) + ) + +;; definition for method 28 of type projectile +;; INFO: Return type mismatch int vs none. +(defmethod dummy-28 projectile ((obj projectile)) + 0 + (none) + ) + +;; failed to figure out what this is: +(let + ((gp-0 + (new 'static 'state + :name 'projectile-moving + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (method-set! projectile 23 gp-0) + (set! + (-> gp-0 event) + (lambda :behavior projectile + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (let ((v1-0 arg2)) + (the-as object (cond + ((= v1-0 'touched) + (when (-> self attack-mode) + (when (cond + ((= (-> arg0 type) target) + (let + ((a1-1 + (new 'stack-no-clear 'event-message-block) + ) + ) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) 'attack) + (set! (-> a1-1 param 0) (-> arg3 param 0)) + (let ((a0-4 L150)) + (let ((v1-6 (-> self attack-mode))) + (s.w! (+ a0-4 68) v1-6) + ) + (set! (-> a1-1 param 1) (the-as uint a0-4)) + ) + (send-event-function arg0 a1-1) + ) + ) + (else + (let + ((a1-2 + (new 'stack-no-clear 'event-message-block) + ) + ) + (set! (-> a1-2 from) self) + (set! (-> a1-2 num-params) 4) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (-> arg3 param 0)) + (set! + (-> a1-2 param 1) + (the-as uint (-> self attack-mode)) + ) + (let ((v1-13 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-13) + (set! (-> a1-2 param 2) (the-as uint v1-13)) + ) + (set! (-> a1-2 param 3) (the-as uint 0)) + (send-event-function arg0 a1-2) + ) + ) + ) + (let ((v1-14 (-> self notify-handle))) + (when (handle->process v1-14) + (let + ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) self) + (set! (-> a1-7 num-params) 2) + (set! (-> a1-7 message) 'notify) + (set! (-> a1-7 param 0) (the-as uint 'attack)) + (set! (-> a1-7 param 1) (the-as uint arg0)) + (send-event-function (-> v1-14 process 0) a1-7) + ) + ) + ) + (+! (-> self hits) 1) + (if (>= (-> self hits) (-> self max-hits)) + (go-virtual projectile-impact) + ) + ) + ) + ) + ((= v1-0 'die) + (go-virtual projectile-impact) + ) + ) + ) + ) + ) + ) + (set! + (-> gp-0 enter) + (lambda :behavior projectile + () + (let ((v0-0 (-> *display* base-frame-counter))) + (set! (-> self state-time) v0-0) + v0-0 + ) + ) + ) + (set! (-> gp-0 code) (lambda :behavior projectile () (let ((gp-0 #f)) + (while + (< + (the-as + int + (- + (-> + *display* + base-frame-counter + ) + (the-as + uint + (-> + self + state-time + ) + ) + ) + ) + (the-as + int + (-> self timeout) + ) + ) + (let + ((s5-0 + (the + int + (-> + *display* + time-ratio + ) + ) + ) + ) + (set-time-ratios + *display* + 1.0 + ) + (countdown (s4-0 s5-0) + (if gp-0 + (go-virtual + projectile-impact + ) + ) + (dummy-28 self) + ((-> + self + update-velocity + ) + self + ) + (when + (logtest? + (-> self options) + 2 + ) + (set! + (-> self tween) + (seek + (-> self tween) + 1.0 + (* + 0.5 + (-> + *display* + seconds-per-frame + ) + ) + ) + ) + (let + ((f0-6 + (vector-vector-distance + (-> + self + root-override + trans + ) + (-> self target) + ) + ) + ) + (cond + ((< f0-6 20480.0) + (set! + (-> self tween) + (seek + (-> self tween) + 1.0 + (* + 3.0 + (-> + *display* + seconds-per-frame + ) + ) + ) + ) + ) + ((< f0-6 40960.0) + (set! + (-> self tween) + (seek + (-> self tween) + 1.0 + (-> + *display* + seconds-per-frame + ) + ) + ) + ) + ) + ) + ) + (let + ((s3-0 + (new 'stack-no-clear 'vector + ) + ) + ) + (set! + (-> s3-0 quad) + (-> + self + root-override + trans + quad + ) + ) + (dummy-33 + (-> + self + root-override + ) + (-> + self + root-override + transv + ) + (-> + self + root-override + root-prim + collide-with + ) + ) + (set! + (-> + self + old-dist + (-> + self + old-dist-count + ) + ) + (* + 0.0625 + (vector-vector-distance + s3-0 + (-> + self + root-override + trans + ) + ) + ) + ) + ) + (set! + (-> + self + old-dist-count + ) + (logand + (+ + (-> + self + old-dist-count + ) + 1 + ) + 15 + ) + ) + (let ((f0-16 0.0)) + (countdown + (v1-35 16) + (+! + f0-16 + (-> + self + old-dist + v1-35 + ) + ) + ) + (if + (or + (and + (logtest? + (-> + self + root-override + status + ) + 8 + ) + (< f0-16 2048.0) + ) + (< f0-16 204.8) + ) + (set! gp-0 #t) + ) + ) + ) + (set-time-ratios + *display* + (the float s5-0) + ) + ) + (dummy-24 self) + (suspend) + ) + ) + (go-virtual projectile-dissipate) + (none) + ) + ) + ) + +;; definition for function projectile-update-velocity-space-wars +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defun projectile-update-velocity-space-wars ((arg0 projectile)) + (let + ((s5-1 + (vector-! + (new 'stack-no-clear 'vector) + (-> arg0 target) + (-> arg0 root-override trans) + ) + ) + ) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s3-0 + (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> arg0 root-override transv) + 1.0 + ) + ) + (f30-0 (vector-length (-> arg0 root-override transv))) + ) + (if (logtest? (-> arg0 root-override status) 4) + (vector-flatten! s5-1 s5-1 (-> arg0 root-override local-normal)) + ) + (vector-normalize-copy! s4-0 s5-1 1.0) + (if + (and + (or + (not (handle->process (-> arg0 last-target))) + (zero? + (-> + (the-as target (handle->process (-> arg0 last-target))) + control + root-prim + prim-core + collide-as + ) + ) + ) + (< (vector-dot s4-0 s3-0) 0.0) + ) + (go (method-of-object arg0 projectile-dissipate)) + ) + (vector-deg-slerp (-> arg0 root-override transv) s3-0 s4-0 (-> arg0 tween)) + (vector-normalize! (-> arg0 root-override transv) f30-0) + ) + (vector+! (-> arg0 root-override transv) (-> arg0 root-override transv) s5-1) + ) + (vector-v++! + (-> arg0 root-override transv) + (dummy-62 (-> arg0 root-override) (new-stack-vector0) 0.0) + ) + (if (< (-> arg0 max-speed) (vector-length (-> arg0 root-override transv))) + (vector-normalize! (-> arg0 root-override transv) (-> arg0 max-speed)) + ) + (if (logtest? (-> arg0 options) 1) + (set! (-> arg0 root-override transv y) -40960.0) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(let + ((gp-1 + (new 'static 'state + :name 'projectile-impact + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (method-set! projectile 22 gp-1) + (set! + (-> gp-1 code) + (lambda :behavior projectile + () + (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker gp-0) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-function-in-process + gp-0 + part-tracker-init + (-> *part-group-id-table* 104) + -1 + #f + #f + #f + (-> self root-override root-prim prim-core) + ) + (-> gp-0 ppointer) + ) + ) + (if (nonzero? (-> self sound-id)) + (sound-stop (-> self sound-id)) + ) + (sound-play-by-name + (the-as sound-name (make-u128 (l.d L239) (l.d L243))) + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (suspend) + (go-virtual unknown-state00) + (none) + ) + ) + ) + +;; failed to figure out what this is: +(let + ((gp-2 + (new 'static 'state + :name 'projectile-dissipate + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (method-set! projectile 21 gp-2) + (set! + (-> gp-2 code) + (lambda :behavior projectile + () + (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) + (when gp-0 + (let ((t9-1 (method-of-type part-tracker activate))) + (t9-1 + (the-as part-tracker gp-0) + *entity-pool* + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-function-in-process + gp-0 + part-tracker-init + (-> *part-group-id-table* 104) + -1 + #f + #f + #f + (-> self root-override root-prim prim-core) + ) + (-> gp-0 ppointer) + ) + ) + (if (nonzero? (-> self sound-id)) + (sound-stop (-> self sound-id)) + ) + (sound-play-by-name + (the-as sound-name (make-u128 (l.d L240) (the-as uint #x662d776f6c6c6579))) + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (suspend) + (go-virtual unknown-state00) + (none) + ) + ) + ) + +;; definition for method 27 of type projectile +;; INFO: Return type mismatch int vs none. +(defmethod dummy-27 projectile ((obj projectile)) + 0 + (none) + ) + +;; definition for method 26 of type projectile +;; INFO: Return type mismatch int vs none. +(defmethod dummy-26 projectile ((obj projectile)) + (let + ((s5-0 + (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)) + ) + ) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) projectile-collision-reaction) + (set! (-> s5-0 no-reaction) nothing) + (let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> s4-0 prim-core collide-as) (the-as uint 1024)) + (set! (-> s4-0 collide-with) (the-as uint 2957)) + (set! (-> s4-0 prim-core action) (the-as uint 1)) + (set! (-> s4-0 prim-core offense) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 5324.8 0.0 5324.8) + ) + ((method-of-object s5-0 dummy-46)) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + ((method-of-object s5-0 dummy-50)) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +;; definition for method 25 of type projectile +;; INFO: Return type mismatch int vs none. +(defmethod dummy-25 projectile ((obj projectile)) + (go (method-of-object obj unknown-state01)) + 0 + (none) + ) + +;; failed to figure out what this is: +(let + ((gp-3 + (new 'static 'state + :name 'projectile-die + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (method-set! projectile 20 gp-3) + (set! + (-> gp-3 code) + (lambda :behavior projectile () (let ((v1-0 (-> self notify-handle))) + (when (handle->process v1-0) + (let + ((a1-4 + (new 'stack-no-clear 'event-message-block + ) + ) + ) + (set! (-> a1-4 from) self) + (set! (-> a1-4 num-params) 1) + (set! (-> a1-4 message) 'notify) + (set! + (-> a1-4 param 0) + (the-as uint 'die) + ) + (send-event-function + (-> v1-0 process 0) + a1-4 + ) + ) + ) + ) + (dummy-18 self) + ) + ) + ) + +;; definition for method 10 of type projectile +(defmethod deactivate projectile ((obj projectile)) + (if (nonzero? (-> obj sound-id)) + (sound-stop (-> obj sound-id)) + ) + ((method-of-type process-drawable deactivate) obj) + (none) + ) + +;; definition for function projectile-init-by-other +;; Used lq/sq +(defbehavior + projectile-init-by-other projectile + ((arg0 projectile) (arg1 vector) (arg2 vector) (arg3 uint) (arg4 handle)) + (stack-size-set! (-> self main-thread) 512) + (set! (-> self entity) (the-as entity arg0)) + (set! (-> self attack-mode) #f) + (set! (-> self update-velocity) projectile-update-velocity-space-wars) + (set! (-> self max-speed) 40960.0) + (set! (-> self max-turn) 18204.445) + (set! (-> self tween) 1.0) + (set! (-> self last-target) arg4) + (set! (-> self timeout) (the-as uint 1200)) + (set! (-> self options) arg3) + (set! (-> self notify-handle) (the-as handle #f)) + (countdown (v1-4 16) + (set! (-> self old-dist v1-4) 4095996000.0) + ) + (dummy-26 self) + (set! (-> self root-override dynam gravity y) 1228800.0) + (set! (-> self root-override dynam gravity-length) 1228800.0) + (set! (-> self root-override dynam gravity-max) 1228800.0) + (set! (-> self root-override trans quad) (-> arg1 quad)) + (set! (-> self base-trans quad) (-> arg1 quad)) + (set! (-> self parent-base quad) (-> arg1 quad)) + (quaternion-copy! + (-> self root-override quat) + (-> (the-as process-drawable (-> self parent 0)) root quat) + ) + (quaternion-copy! + (the-as quaternion (-> self parent-quat)) + (-> (the-as process-drawable (-> self parent 0)) root quat) + ) + (vector-identity! (-> self root-override scale)) + (set! (-> self root-override transv quad) (-> arg2 quad)) + (vector-normalize-copy! (-> self base-vector) arg2 1.0) + (vector+float*! + (-> self target) + (-> self root-override trans) + (-> self root-override transv) + 2.0 + ) + (set! (-> self target-base quad) (-> self target quad)) + (dummy-27 self) + (dummy-24 self) + (when (not (type-type? (-> self type) projectile-blue)) + (let ((a1-8 (new 'stack-no-clear 'collide-sticky-rider-group))) + (set! (-> a1-8 num-riders) 1) + (set! (-> a1-8 allocated-riders) (the-as int *touching-list*)) + (dummy-40 (-> self root-override) a1-8) + ) + ) + (set! (-> self event-hook) (-> (method-of-object self unknown-state01) event)) + (dummy-25 self) + (none) + ) + +;; definition for method 27 of type projectile-yellow +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defmethod dummy-27 projectile-yellow ((obj projectile-yellow)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 30) + (set! (-> obj attack-mode) 'eco-yellow) + (set! (-> obj mode) 1) + (set! (-> obj max-speed) (vector-length (-> obj root-override transv))) + (set! (-> obj update-velocity) projectile-update-velocity-space-wars) + (set! (-> obj angle) (vector-y-angle (-> obj root-override transv))) + (set! (-> obj tween) 0.05) + (logior! (-> obj options) 2) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> obj root-override trans quad)) + (set! + (-> obj root-override trans y) + (+ -5324.8 (-> obj root-override trans y)) + ) + (vector+float*! + (-> obj target) + (-> obj root-override trans) + (-> obj root-override transv) + 2.0 + ) + (set! (-> obj target-base quad) (-> obj target quad)) + (let + ((f30-0 + (the float (sar (shl (the int (y-angle (-> obj root-override))) 48) 48)) + ) + ) + (set! (-> obj mask) (logior #x400000 (-> obj mask))) + (if (logtest? (-> obj options) 16) + (set! (-> obj max-hits) 1) + ) + (set! + (-> *part-id-table* 356 init-specs 18 initial-value) + (the-as int (the float (sar (shl (the int (+ -16384.0 f30-0)) 48) 48))) + ) + (set! + (-> *part-id-table* 358 init-specs 11 initial-value) + (the-as int (the float (sar (shl (the int (+ -16384.0 f30-0)) 48) 48))) + ) + (sound-play-by-name + (static-sound-name "yellow-fire") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! + (-> obj sound-id) + (sound-play-by-name + (static-sound-name "yellow-buzz") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + ) + (when (zero? (logand (-> obj options) 416)) + (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-2 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 + (the-as part-tracker s4-2) + obj + 'part-tracker + (the-as pointer #x70004000) + ) + ) + (run-function-in-process + s4-2 + part-tracker-init + (-> *part-group-id-table* 103) + -1 + #f + #f + #f + s5-0 + ) + (-> s4-2 ppointer) + ) + ) + ) + (set! + (-> *part-id-table* 350 init-specs 2 initial-value) + (the-as int f30-0) + ) + ) + ) + (set! + (-> obj part) + (the-as + sparticle-launch-control + (dummy-9 (-> *part-group-id-table* 102) obj) + ) + ) + (when *target* + (case (-> *target* current-level name) + (('swamp) + (set! + (-> obj water) + (new 'process 'water-control obj 0 0.0 8192.0 2048.0) + ) + (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water height) (if (logtest? (-> obj options) 64) + 8192.0 + 10240.0 + ) + ) + (logior! (-> obj root-override root-prim collide-with) 32) + ) + (('ogre) + (when (zero? (logand (-> obj options) 128)) + (set! + (-> obj water) + (new 'process 'water-control obj 0 0.0 8192.0 2048.0) + ) + (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water height) 129024.0) + (logior! (-> obj root-override root-prim collide-with) 32) + ) + ) + (('finalboss) + (set! + (-> obj root-override trans y) + (+ 4096.0 (-> obj root-override trans y)) + ) + (set! (-> obj water) (new 'process 'water-control obj 0 0.0 8192.0 2048.0)) + (set! (-> obj water flags) (the-as uint 146)) + (set! (-> obj water height) 1977958.4) + (logior! (-> obj root-override root-prim collide-with) 32) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 26 of type projectile-yellow +;; INFO: Return type mismatch uint vs none. +(defmethod dummy-26 projectile-yellow ((obj projectile-yellow)) + (let ((t9-0 (method-of-type projectile dummy-26))) + (t9-0 obj) + ) + (logior! (-> obj root-override root-prim collide-with) 8192) + (none) + ) + +;; definition for method 24 of type projectile-yellow +;; INFO: Return type mismatch int vs none. +(defmethod dummy-24 projectile-yellow ((obj projectile-yellow)) + (with-pp + (find-ground-and-draw-shadow + (-> obj root-override trans) + (-> obj root-override shadow-pos) + 8192.0 + (the-as uint 1) + (the-as process #f) + 12288.0 + 81920.0 + ) + (if (< (-> obj root-override trans y) (-> obj root-override shadow-pos y)) + (set! + (-> obj root-override trans y) + (+ 1228.8 (-> obj root-override shadow-pos y)) + ) + ) + (dummy-47 (-> obj root-override)) + (set! (-> *part-id-table* 353 init-specs 16 initial-value) 30) + (set! (-> *part-id-table* 353 init-specs 16 random-range) 300) + (cond + ((logtest? (-> obj options) 32) + (when + (>= + (the-as + int + (- (-> *display* base-frame-counter) (the-as uint (-> obj state-time))) + ) + 15 + ) + (when + (< + (the-as + int + (- (-> *display* base-frame-counter) (the-as uint (-> obj state-time))) + ) + 150 + ) + (set! (-> *part-id-table* 353 init-specs 16 initial-value) 0) + (set! (-> *part-id-table* 353 init-specs 16 random-range) 0) + 0 + ) + (let ((t9-2 (method-of-object (-> obj part) dummy-11))) + (-> obj root-override root-prim prim-core) + (t9-2) + ) + ) + ) + (else + (let ((t9-3 (method-of-object (-> obj part) dummy-11))) + (-> obj root-override root-prim prim-core) + (t9-3) + ) + ) + ) + (let ((s5-0 (get-sound-buffer-entry))) + (let ((v1-37 7)) + (s.h! (+ s5-0 2) v1-37) + ) + (let ((v1-38 (-> obj sound-id))) + (s.w! (+ s5-0 4) v1-38) + ) + (let ((a1-3 (-> obj root-override trans))) + (let ((gp-1 pp)) + (when (= a1-3 #t) + (if + (and + gp-1 + (type-type? (-> gp-1 type) process-drawable) + (nonzero? (-> (the-as process-drawable gp-1) root)) + ) + (set! a1-3 (-> (the-as process-drawable gp-1) root trans)) + (set! a1-3 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (the-as vector3w (&+ s5-0 24)) a1-3) + ) + (let ((v1-48 32)) + (s.h! (+ s5-0 8) v1-48) + ) + (l.wu (&+ s5-0 4)) + ) + 0 + (none) + ) + ) + +;; definition for method 28 of type projectile-yellow +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defmethod dummy-28 projectile-yellow ((obj projectile-yellow)) + (cond + ((or + (not (handle->process (-> obj last-target))) + (zero? + (-> + (the-as target (handle->process (-> obj last-target))) + control + root-prim + prim-core + collide-as + ) + ) + ) + (cond + ((zero? (-> obj target-count)) + (let + ((s5-0 + (find-nearest-attackable + (-> obj parent-base) + 409600.0 + (the-as uint32 0) + (the-as uint32 0) + (-> obj base-vector) + (if (logtest? (-> obj options) 160) + 546.13336 + 8192.0 + ) + ) + ) + ) + (let + ((s4-0 + (find-nearest-attackable + (-> obj parent-base) + 163840.0 + (the-as uint32 1) + (the-as uint32 0) + (-> obj base-vector) + (if (logtest? (-> obj options) 160) + 910.2222 + 8192.0 + ) + ) + ) + (v1-10 + (find-nearest-attackable + (-> obj parent-base) + 28672.0 + (the-as uint32 1) + (the-as uint32 0) + (-> obj base-vector) + 16384.0 + ) + ) + ) + (if s4-0 + (set! s5-0 s4-0) + ) + (if v1-10 + (set! s5-0 v1-10) + ) + ) + (let* ((a0-17 s5-0) + (v1-12 (if a0-17 + (-> a0-17 ppointer) + ) + ) + ) + (set! + (-> obj last-target) + (new 'static 'handle :process v1-12 :pid (-> v1-12 0 pid)) + ) + ) + (when s5-0 + (set! + (-> obj target quad) + (-> s5-0 root-override root-prim prim-core world-sphere quad) + ) + (if (= (-> s5-0 type symbol) 'mother-spider) + (set! (-> obj options) (logand -2 (-> obj options))) + ) + ) + ) + ) + (else + (set! (-> obj target quad) (-> obj target-base quad)) + ) + ) + ) + (else + (let ((a1-8 (handle->process (-> obj last-target)))) + (set! + (-> obj target quad) + (-> (the-as target a1-8) control root-prim prim-core world-sphere quad) + ) + ) + (if + (and + (< + (vector-vector-xz-distance (-> obj root-override trans) (-> obj target)) + 20480.0 + ) + (< 24576.0 (fabs (- (-> obj target y) (-> obj root-override trans y)))) + ) + (set! (-> obj last-target) (the-as handle #f)) + ) + ) + ) + (+! (-> obj target-count) 1) + 0 + (none) + ) + +;; definition for method 27 of type projectile-blue +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defmethod dummy-27 projectile-blue ((obj projectile-blue)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 204 30) + (sound-play-by-name + (static-sound-name "blue-eco-on") + (new-sound-id) + 1024 + 0 + 0 + (the-as uint 1) + (the-as vector #t) + ) + (set! (-> obj mode) 2) + (set! (-> obj max-speed) (-> *TARGET-bank* yellow-projectile-speed)) + (set! (-> obj update-velocity) projectile-update-velocity-space-wars) + (set! + (-> obj root-override trans y) + (+ -5324.8 (-> obj root-override trans y)) + ) + (vector+float*! + (-> obj target) + (-> obj root-override trans) + (-> obj root-override transv) + 2.0 + ) + (set! (-> obj target-base quad) (-> obj target quad)) + (set! (-> obj mask) (logior #x100000 (-> obj mask))) + (set! + (-> obj part) + (the-as sparticle-launch-control (dummy-9 (-> *part-group-id-table* 42) obj)) + ) + (set! (-> obj root-override root-prim collide-with) (the-as uint 1)) + (let* ((s5-1 (handle->process (-> obj last-target))) + (v1-20 + (if (and (nonzero? s5-1) (type-type? (-> s5-1 type) process-drawable)) + s5-1 + ) + ) + ) + (if v1-20 + (set! + (-> obj joint-num) + (rand-vu-int-range + 3 + (+ (-> (the-as process-drawable v1-20) node-list length) -1) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 26 of type projectile-blue +;; INFO: Return type mismatch int vs none. +(defmethod dummy-26 projectile-blue ((obj projectile-blue)) + (let + ((s5-0 + (new 'process 'collide-shape-moving obj (collide-list-enum hit-by-player)) + ) + ) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) projectile-collision-reaction) + (set! (-> s5-0 no-reaction) nothing) + (let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> s4-0 prim-core collide-as) (the-as uint 1024)) + (set! (-> s4-0 collide-with) (the-as uint 1)) + (set! (-> s4-0 prim-core action) (the-as uint 1)) + (set! (-> s4-0 prim-core offense) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 5324.8 0.0 5324.8) + ) + ((method-of-object s5-0 dummy-46)) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + ((method-of-object s5-0 dummy-50)) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> obj root-override) s5-0) + ) + 0 + (none) + ) + +;; definition for function spawn-projectile-blue +;; INFO: Return type mismatch int vs none. +;; Used lq/sq +(defun spawn-projectile-blue ((arg0 target)) + (local-vars (sv-48 entity)) + (with-pp + (when arg0 + (let ((s3-0 (rand-vu-int-range 3 (+ (-> arg0 node-list length) -1))) + (gp-0 (new-stack-vector0)) + ) + (set-vector! + gp-0 + (rand-vu-float-range -81920.0 81920.0) + (rand-vu-float-range -81920.0 81920.0) + (rand-vu-float-range -81920.0 81920.0) + 1.0 + ) + (let ((s4-1 (get-process *default-dead-pool* projectile-blue #x4000))) + (when s4-1 + (let ((t9-5 (method-of-type projectile-blue activate))) + (t9-5 + (the-as projectile-blue s4-1) + pp + 'projectile-blue + (the-as pointer #x70004000) + ) + ) + (let ((s2-0 run-function-in-process) + (s1-0 s4-1) + (s0-0 projectile-init-by-other) + ) + (set! sv-48 (-> pp entity)) + (let* + ((a3-1 + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> arg0 node-list data s3-0) + ) + ) + (t1-0 8) + (a0-8 pp) + (v1-9 (if a0-8 + (-> a0-8 ppointer) + ) + ) + (t2-0 (logior (shl (-> v1-9 0 pid) 32) (.asm.sllv.r0 v1-9))) + ) + (s2-0 s1-0 s0-0 sv-48 a3-1 gp-0 t1-0 t2-0) + ) + ) + (-> s4-1 ppointer) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 28 of type projectile-blue +;; INFO: Return type mismatch int vs none. +(defmethod dummy-28 projectile-blue ((obj projectile-blue)) + (let* ((s5-0 (handle->process (-> obj last-target))) + (v1-4 + (if (and (nonzero? s5-0) (type-type? (-> s5-0 type) process-drawable)) + s5-0 + ) + ) + ) + (if v1-4 + (vector<-cspace! + (-> obj target) + (-> (the-as process-drawable v1-4) node-list data (-> obj joint-num)) + ) + ) + ) + (if + (< + (vector-vector-distance (-> obj target) (-> obj root-override trans)) + 4096.0 + ) + (go (method-of-object obj projectile-impact)) + ) + 0 + (none) + ) + +;; definition for method 24 of type projectile-blue +;; INFO: Return type mismatch int vs none. +(defmethod dummy-24 projectile-blue ((obj projectile-blue)) + (if (rand-vu-percent? 0.75) + (eco-blue-glow + (the-as collide-shape-prim (-> obj root-override root-prim prim-core)) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(let + ((gp-4 + (new 'static 'state + :name 'projectile-impact + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (inherit-state gp-4 (method-of-type projectile projectile-impact)) + (method-set! projectile-blue 22 gp-4) + (set! (-> gp-4 code) (lambda :behavior projectile () (dummy-18 self))) + ) + +;; failed to figure out what this is: +(let + ((gp-5 + (new 'static 'state + :name 'projectile-dissipate + :next #f + :exit #f + :code #f + :trans #f + :post #f + :enter #f + :event #f + ) + ) + ) + (inherit-state gp-5 (method-of-type projectile projectile-dissipate)) + (method-set! projectile-blue 21 gp-5) + (set! + (-> gp-5 code) + (lambda :behavior projectile () (go-virtual unknown-state00) (none)) + ) + ) + + + +