diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index e347d3ed73..473daef122 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -8427,7 +8427,7 @@ ((parent cspace :offset-assert 0) (joint joint :offset-assert 4) ;; guessed by decompiler (joint-num int16 :offset-assert 8) - (geo basic :offset-assert 12) + (geo drawable :offset-assert 12) (bone bone :offset-assert 16) (param0 (function cspace matrix none) :offset-assert 20) ;; guessed by decompiler (param1 basic :offset-assert 24) @@ -8438,8 +8438,8 @@ :flag-assert #xa00000020 ;; field param1 uses ~A with a signed load field param2 uses ~A with a signed load (:methods - (new (symbol type basic) _type_ 0) - (reset-and-assign-geo! (_type_ basic) _type_ 9) + (new (symbol type drawable) _type_ 0) + (reset-and-assign-geo! (_type_ drawable) _type_ 9) ) ) @@ -13369,12 +13369,13 @@ ;; joint-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; +++joint-h:joint-control-command (defenum joint-control-command :type int64 (zero 0) (push 1) (blend 2) - (four 4) + (joint-control-command-4 4) (eight 8) (push1 19) (thirty-two 32) @@ -13382,6 +13383,7 @@ (float 42) (stack1 52) ) +;; ---joint-h:joint-control-command (declare-type joint-control basic) (deftype joint-control-channel (structure) @@ -14069,6 +14071,7 @@ (gun-turn-fast 28) ;; hi 4096 ) +(declare-type control-info basic) (deftype surface (basic) ((name symbol) ;(data float 30 :score -1) @@ -14106,8 +14109,8 @@ ;; hook (active-hook (function none) :offset 128) - (touch-hook (function none)) - (impact-hook function) + (touch-hook (function none) :offset 132) + (impact-hook (function control-info (pointer float) vector none) :offset 136) (mult-hook (function surface surface surface int none)) (exit-hook function) @@ -16337,7 +16340,7 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (find-ground (_type_ collide-query collide-spec float float float) symbol 55) - (react-to-pat! (_type_ pat-surface) none 56) + (react-to-pat! (_type_ pat-surface) int 56) (integrate-no-collide! (_type_ vector) none 57) (integrate-for-enemy-no-mtg (_type_ vector overlaps-others-params) symbol 58) (move-above-ground (_type_ vector move-above-ground-params) none 59) @@ -16443,7 +16446,8 @@ ) (deftype lightning-tracker (process) - ((root trsqv :offset-assert 128) + ((ppointer-override (pointer lightning-tracker) :offset 28 :score 100) + (root trsqv :offset-assert 128) (lightning lightning-spec :offset-assert 132) (callback (function lightning-tracker none) :offset-assert 136) (duration uint64 :offset-assert 144) @@ -16805,6 +16809,8 @@ ;; the last safe ground (got on-surf flag) (last-trans-on-surf vector :inline :offset 4576) ;; logic-target::flag-setup + (unknown-vector-kjh1n23k1 vector :inline :offset 4592) + (unknown-vector-kj1n231 vector :inline :offset 4608) (unknown-time-frame05 time-frame :offset 4624) ;; board-h::want-to-board? (unknown-float0000 float :offset 4632) ;; target-util::can-duck? (unknown-float17 float :offset 4636) ;; logic-target::target-print-stats @@ -16816,8 +16822,10 @@ (unknown-time-frame07 time-frame :offset 4672) ;; logic-target::turn-around? (unknown-pat-surface00 pat-surface :offset 4680) ;; logic-target::target-print-stats (unknown-vector24 vector :inline :offset 4688) ;; logic-target::add-thrust + (unknown-vector-kj1hj2b3 vector :inline :offset 4704) (unknown-vector25 vector :inline :offset 4720) ;; logic-target::wall-hide? (unknown-vector001 vector :inline :offset 4736) ;; target2::target-bonk-event-handler + (unknown-vector-kij1b231 vector :inline :offset 4752) (unknown-handle00 handle :offset 4768) ;; logic-target::reset-target-state (unknown-pat-surface01 pat-surface :offset 4776) ;; logic-target::target-print-stats (unknown-float22 float :offset 4780) ;; logic-target::target-compute-slopes @@ -16827,8 +16835,18 @@ (unknown-float26 float :offset 4796) ;; logic-target::target-compute-slopes (unknown-word000 int32 :offset 4800) ;; (anon-function 16 target-darkjak) (unknown-float002 float :offset 4804) ;; target-gun::target-gun-joint-pre + (unknown-float-n12iuh3n1 float :offset 4808) + (unknown-float-ki1jhbn23hj float :offset 4812) (unknown-time-frame08 time-frame :offset 4816) ;; logic-target::turn-around? + (unknown-float-kj1n23j float :offset 4828) + (unknown-float-n234n23 float :offset 4832) + (unknown-float-m32j45nhn float :offset 4836) + (unknown-float-kj1n23k1 float :offset 4824) + (unknown-vector-l1jn23j vector :inline :offset 4848) + (unknown-vector-kj1n23k vector :inline :offset 4864) + (unknown-vector-kjh1n23kj1n23 vector :inline :offset 4912) (unknown-vector26 vector :inline :offset 4928) ;; logic-target::target-add-slide-factor + (unknown-vector-lkjk12nj3n vector :inline :offset 4944) ;; this is a bit weird ;; I believe it's supposed to set the velocity of jak when he first becomes blocked. @@ -16844,6 +16862,7 @@ (blocked-in-air-factor float :offset 4996) (unknown-time-frame09 time-frame :offset 5000) ;; logic-target::add-thrust + (unknown-time-frame-kjh1n23hkjn time-frame :offset 5008) (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) ;; (method 28 target) (unknown-word02 int32 :offset 5064) ;; (enter target-roll) (unknown-time-frame10 time-frame :offset 5072) ;; (exit target-roll) @@ -18392,7 +18411,7 @@ (num-spheres uint32 :offset 116) (solid-only symbol :offset 120) (best-dist float :offset 112 :score 2) - (best-other-prim basic :offset 116) + (best-other-prim collide-shape-prim :offset 116) (best-my-prim collide-shape-prim :offset 120 :score 1) (move-vec vector :inline :offset 224) (best-u float :offset 112 :score -1) @@ -23461,6 +23480,10 @@ (define-extern add-debug-light (function symbol bucket-id light vector string symbol)) (define-extern add-debug-lights (function symbol bucket-id (inline-array light) vector symbol)) (define-extern drawable-frag-count (function drawable int)) + +(define-extern drawable-tri-count (function drawable int)) ;; NOTE - defined in kernel? +(define-extern drawable-vertex-ratio (function drawable debug-vertex-stats int)) ;; NOTE - defined in kernel? + (define-extern history-init (function pos-history int pos-history)) (define-extern history-draw-and-update (function pos-history symbol vector symbol)) (define-extern dma-timeout-cam (function vector)) @@ -27391,8 +27414,8 @@ (define-extern vector<-cspace! (function vector cspace vector)) (define-extern vector<-matrix! (function vector matrix vector)) (define-extern vector<-cspace+vector! (function vector cspace vector vector)) -;; (define-extern cspace-children function) ;; (function process-drawable int pair) -(define-extern cspace-inspect-tree (function process-drawable cspace int int object object)) +(define-extern cspace-children (function process-drawable int pair)) ;; +(define-extern cspace-inspect-tree (function process-drawable cspace int int object process-drawable)) (define-extern execute-math-engine (function int)) (define-extern draw-joint-axes (function process-drawable none)) (define-extern draw-root (function process-drawable none)) @@ -27427,7 +27450,7 @@ (define-extern process-drawable-delay-player (function time-frame int :behavior process-drawable)) (define-extern process-drawable-fuel-cell-handler (function process int symbol event-message-block none :behavior process-drawable)) (define-extern process-drawable-birth-fuel-cell (function entity vector symbol none :behavior process-drawable)) -(define-extern find-offending-process-focusable (function process-tree process-focusable)) +(define-extern find-offending-process-focusable (function process-tree attack-info process-focusable :behavior process-drawable)) (define-extern *valid-con* string) (define-extern process-drawable-valid? (function process-drawable symbol)) @@ -28275,17 +28298,17 @@ ;; target-part ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern birth-func-copy-target-y-rot function) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) -;; (define-extern birth-func-ground-orient function) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) -;; (define-extern birth-func-target-orient function) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) -;; (define-extern birth-func-vector-orient function) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) -;; (define-extern birth-func-set-alpha-from-userdata function) -;; (define-extern part-tracker-track-target-joint function) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) -(define-extern process-drawable-burn-effect (function time-frame none :behavior target)) ;; +(define-extern birth-func-copy-target-y-rot (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; +(define-extern birth-func-ground-orient (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) +(define-extern birth-func-target-orient (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) +(define-extern birth-func-vector-orient (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) +(define-extern birth-func-set-alpha-from-userdata (function int sparticle-cpuinfo sparticle-launchinfo float)) +(define-extern part-tracker-track-target-joint (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; +(define-extern process-drawable-burn-effect (function time-frame rgbaf :behavior target)) ;; (define-extern lightning-probe-callback (function lightning-tracker none)) (define-extern process-drawable-shock-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float object)) ;; guess (define-extern process-drawable-shock-wall-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float none)) -(define-extern process-drawable2-shock-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float none)) +(define-extern process-drawable2-shock-effect (function process-drawable process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher none)) ;; (define-extern process-drawable-shock-skel-effect function) (define-extern *lightning-darkjak-pill* lightning-spec) @@ -28293,21 +28316,21 @@ ;; gun-part ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *red-shot-colors* object) -;; (define-extern check-shell-level1 function) -;; (define-extern check-shell-level2 function) -;; (define-extern sparticle-dark-shot-lightning function) +(define-extern *red-shot-colors* (pointer rgba)) +(define-extern check-shell-level1 (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern check-shell-level2 (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern sparticle-dark-shot-lightning (function sparticle-system sparticle-cpuinfo vector none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; collide-reaction-target ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define-extern poly-find-nearest-edge (function vector (inline-array vector) vector vector vector)) -;; (define-extern target-collision-low-coverage function) ;; (function control-info collide-shape-intersect vector (pointer uint32) (pointer uint64) (pointer symbol) uint) -(define-extern target-collision-reaction (function control-info collide-query vector vector collide-status)) ;; (function control-info collide-shape-intersect vector vector collide-status) +(define-extern poly-find-nearest-edge "TODO- Not 100% sure here, but unused" (function nav-poly (inline-array vector) vector vector nav-poly)) +(define-extern target-collision-low-coverage (function control-info collide-query vector (pointer uint32) (pointer int64) (pointer symbol) none)) ;; +(define-extern target-collision-reaction (function control-info collide-query vector vector collide-status :behavior target)) ;; (function control-info collide-shape-intersect vector vector collide-status) (define-extern target-collision-no-reaction (function control-info collide-query vector vector none)) ;; (function control-info collide-shape-intersect vector vector none) (define-extern *collide-edge-board-spec* collide-edge-spec) -(define-extern rail-surface-touch (function none)) +(define-extern rail-surface-touch (function none :behavior target)) (define-extern gravel-surface-touch (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -28602,14 +28625,14 @@ ;; target-anim ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern target-land-anim function) +(define-extern target-land-anim (function art-element :behavior target)) (define-extern target-stance-anim (function none :behavior target)) -(define-extern target-stance-push (function none :behavior target)) +(define-extern target-stance-push (function int none :behavior target)) (define-extern target-falling-anim (function int time-frame symbol :behavior target)) (define-extern target-falling-anim-trans (function none :behavior target)) (define-extern target-walk-anim (function int none :behavior target)) -;; (define-extern target-hit-ground-flop-anim function) -(define-extern target-hit-ground-anim (function symbol symbol :behavior target)) +(define-extern target-hit-ground-flop-anim (function symbol symbol none :behavior target)) +(define-extern target-hit-ground-anim (function symbol symbol none :behavior target)) (define-extern target-attack-air-anim (function none :behavior target)) (define-extern target-edge-grab-anim (function none :behavior target)) @@ -29326,7 +29349,7 @@ ;; (define-extern set-shadow-by-name function) ;; (define-extern get-shadow-by-name function) ;; (define-extern teleport-camera-by-name function) -(define-extern dma-add-process-drawable function) ;; (function process-drawable draw-control symbol dma-buffer none) +(define-extern dma-add-process-drawable (function process-drawable draw-control symbol dma-buffer none)) (define-extern *hud-lights* vu-lights) ;; (define-extern dma-add-process-drawable-hud function) ;; (function process-drawable draw-control symbol dma-buffer none) (define-extern add-process-drawable (function process-drawable draw-control symbol dma-buffer none)) @@ -32513,7 +32536,7 @@ (enemy-method-131 (_type_) none 131) (enemy-method-132 (_type_) none 132) (enemy-method-133 (_type_) none 133) - (enemy-method-134 (_type_ process symbol) process-focusable 134) + (enemy-method-134 (_type_ process attack-info) process-focusable 134) (enemy-method-135 (_type_ int) sound-id 135) (enemy-method-136 (_type_) enemy-flag 136) ) diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index 5ea022764e..5a850e96ac 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -418,7 +418,6 @@ "target-gun": [ [22, "(function surface object object int object :behavior target)"] ], - "scene": [[4, "(function symbol :behavior scene-player)"]], "enemy": [[37, "(function enemy-jump-info none :behavior enemy)"]], "nav-enemy": [ [7, "(function enemy-jump-info none :behavior nav-enemy)"], @@ -455,7 +454,14 @@ "crimson-guard-level": [ [28, "(function crimson-guard-level collide-shape-moving vector symbol)"] ], - "merc-death": [ - [3, "(function none :behavior process-drawable)"] + "merc-death": [[3, "(function none :behavior process-drawable)"]], + "target-anim": [ + [3, "(function none :behavior target)"], + [4, "(function none :behavior target)"], + [7, "(function none :behavior target)"], + [8, "(function none :behavior target)"], + [13, "(function none :behavior target)"], + [14, "(function none :behavior target)"], + [15, "(function none :behavior target)"] ] } diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index 300597ede3..ac25e6aa9c 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -223,7 +223,8 @@ "scene-player-init", "next-continue", "(method 25 warp-gate)", - "(code use warp-gate)" + "(code use warp-gate)", + "cspace-inspect-tree" ], // If format is used with the wrong number of arguments, @@ -380,13 +381,19 @@ "(method 36 collide-shape)": [8, 9], "(method 45 collide-shape)": [33], "(method 40 collide-shape)": [ - 0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32], + 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32 + ], "(method 12 collide-shape-prim-group)": [1, 2, 3, 4, 5, 6], "(method 13 collide-shape-prim)": [1, 2, 3, 4, 5, 6], - "(method 12 collide-shape-prim-sphere)": [1, 2, 3, 4, 5, 8, 10, 11, 13, 14, 15], - "(method 12 collide-shape-prim-mesh)": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16], + "(method 12 collide-shape-prim-sphere)": [ + 1, 2, 3, 4, 5, 8, 10, 11, 13, 14, 15 + ], + "(method 12 collide-shape-prim-mesh)": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16 + ], "(method 24 grid-hash)": [39, 35, 22, 15], - "(method 12 flow-control)": [11, 12, 13, 14, 15, 18, 20, 22, 29], + "(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] }, @@ -485,7 +492,6 @@ "(method 36 spatial-hash)", "(method 37 spatial-hash)", "(method 35 spatial-hash)" - ], "mips2c_jump_table_functions": {}, diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index 3752278b2d..b2f506e399 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -516,5 +516,8 @@ "process-drawable": [ ["L366", "vector"], ["L365", "vector"] - ] + ], + "gun-part": [["L192", "(pointer rgba)", 36]], + "target-part": [["L452", "uint64", true]], + "target-anim": [["L423", "uint64", true]] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 1e0aee58b6..b87c6de3df 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -605,7 +605,7 @@ "target-collision-reaction": [ [16, "vector"], [32, "vector"], - [48, "vector"] + [48, "matrix"] ], "turn-to-vector": [ [16, "vector"], @@ -770,7 +770,10 @@ [80, "vector"] ], "(event target-board-halfpipe)": [[16, "vector"]], - "process-drawable-shock-effect": [[16, "matrix"]], + "process-drawable-shock-effect": [ + [16, "matrix"], + [80, "collide-query"] + ], "(code target-board-get-on)": [[16, "event-message-block"]], "(enter target-board-get-on)": [ [16, "vector"], @@ -1151,26 +1154,13 @@ [32, "vector"] ], "(method 67 ocean)": [[16, "vector"]], - "(method 18 collide-shape-prim-mesh)": [ - [16, "collide-tri-result"] - ], - "(method 15 collide-shape-prim-sphere)": [ - [16, "collide-tri-result"]], - "target-attack-up": [ - [16, "event-message-block"] - ], - "(method 37 control-info)": [ - [48, "vector"] - ], - "(method 45 collide-shape)": [ - [16, "do-push-aways-work"] - ], - "(method 50 collide-shape)": [ - [32, "vector"] - ], - "(method 44 collide-shape)": [ - [16, "pull-rider-info"] - ], + "(method 18 collide-shape-prim-mesh)": [[16, "collide-tri-result"]], + "(method 15 collide-shape-prim-sphere)": [[16, "collide-tri-result"]], + "target-attack-up": [[16, "event-message-block"]], + "(method 37 control-info)": [[48, "vector"]], + "(method 45 collide-shape)": [[16, "do-push-aways-work"]], + "(method 50 collide-shape)": [[32, "vector"]], + "(method 44 collide-shape)": [[16, "pull-rider-info"]], // placeholder "placeholder-do-not-add-below": [], "(method 25 guard-shot)": [[32, "vector"]], @@ -1188,8 +1178,16 @@ "spawn-metalhead-projectile": [[16, "projectile-init-by-other-params"]], "(method 24 grid-hash)": [[16, "vector"]], "(method 11 grid-hash)": [ - [16, "vector"], [32, "vector"] + [16, "vector"], + [32, "vector"] ], - "(method 11 flow-control)": [[80, "vector"], [128, "vector"]], - "(method 9 joint-control)": [[16, "vector"]] + "(method 11 flow-control)": [ + [80, "vector"], + [128, "vector"] + ], + "(method 9 joint-control)": [[16, "vector"]], + "check-shell-level1": [[16, "vector"]], + "check-shell-level2": [[16, "vector"]], + "birth-func-target-orient": [[48, "vector"]], + "birth-func-vector-orient": [[32, "vector"]] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 1f79320f09..4c509ec31d 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -4528,9 +4528,7 @@ "(method 18 collide-shape-prim-group)": [ [[3, 32], "s4", "collide-shape-prim"] ], - "(method 19 collide-shape-prim)": [ - [[3, 32], "s4", "collide-shape-prim"] - ], + "(method 19 collide-shape-prim)": [[[3, 32], "s4", "collide-shape-prim"]], "collide-shape-draw-debug-marks": [ [24, "v1", "connection"], [[24, 41], "a0", "collide-shape"], @@ -4546,12 +4544,8 @@ [68, "a0", "process-focusable"], [153, "a0", "process-focusable"] ], - "(method 66 collide-shape-moving)": [ - [[29, 58], "s0", "collide-cache-prim"] - ], - "(method 36 collide-shape)": [ - [[1, 40], "v1", "collide-shape-prim"] - ], + "(method 66 collide-shape-moving)": [[[29, 58], "s0", "collide-cache-prim"]], + "(method 36 collide-shape)": [[[1, 40], "v1", "collide-shape-prim"]], "(method 38 collide-shape)": [ [[42, 80], "s5", "collide-shape-prim-mesh"], [34, "v0", "(array collide-mesh)"] @@ -4570,21 +4564,15 @@ [80, "a0", "collide-shape-moving"], [156, "s4", "(pointer uint64)"] ], - "(method 12 collide-shape-prim-group)":[ - [[12, 43], "s4", "collide-shape-prim"] - ], - "(method 13 collide-shape-prim)":[ + "(method 12 collide-shape-prim-group)": [ [[12, 43], "s4", "collide-shape-prim"] ], + "(method 13 collide-shape-prim)": [[[12, 43], "s4", "collide-shape-prim"]], "(method 12 collide-shape-prim-sphere)": [ [17, "gp", "collide-shape-prim-mesh"] ], - "(method 50 collide-shape)": [ - [[30, 100], "gp", "process-focusable"] - ], - "cshape-reaction-update-state": [ - ["_stack_", 56, "collide-status"] - ], + "(method 50 collide-shape)": [[[30, 100], "gp", "process-focusable"]], + "cshape-reaction-update-state": [["_stack_", 56, "collide-status"]], "(method 17 collide-shape-prim-mesh)": [ [[6, 11], "s2", "collide-shape-prim-group"] ], @@ -4594,9 +4582,7 @@ [76, "a0", "connection"], [77, "a0", "collide-shape"] ], - "(method 44 collide-shape)": [ - [25, "a0", "process-drawable"] - ], + "(method 44 collide-shape)": [[25, "a0", "process-drawable"]], // placeholder "placeholder-do-not-add-below": [], "(method 38 guard-lazer-shot)": [[[33, 37], "a0", "process-focusable"]], @@ -4673,9 +4659,7 @@ [366, "v1", "art-joint-anim"], [463, "v1", "art-joint-anim"] ], - "(method 10 grid-hash)": [ - [12, "a0", "(pointer uint128)"] - ], + "(method 10 grid-hash)": [[12, "a0", "(pointer uint128)"]], "(method 24 grid-hash)": [ [78, "v1", "(pointer uint128)"], [191, "t0", "(pointer int8)"], @@ -4688,9 +4672,7 @@ [149, "t4", "pointer"], [152, "t1", "pointer"] ], - "(method 27 sphere-hash)": [ - [44, "s2", "(pointer int8)"] - ], + "(method 27 sphere-hash)": [[44, "s2", "(pointer int8)"]], "(method 9 actor-hash-buckets)": [ [19, "v1", "connection"], [[16, 160], "s4", "collide-shape"], @@ -4703,33 +4685,15 @@ [71, "a0", "connection"], [72, "a0", "collide-shape"] ], - "(method 10 flow-control)": [ - ["_stack_", 32, "flow-section"] - ], - "(method 9 lod-set)": [ - ["_stack_", 16, "res-tag"] - ], - "execute-math-engine": [ - [[15, 28], "v1", "process-drawable"] - ], - "(method 14 draw-control)": [ - [13, "v1", "process-drawable"] - ], - "(method 17 process-drawable)": [ - [7, "v1", "collide-shape"] - ], - "(method 10 process-drawable)": [ - [32, "a0", "collide-shape"] - ], - "(code process-drawable-art-error)": [ - [[18, 50], "v1", "collide-shape"] - ], - "(method 18 process-drawable)": [ - [1, "v1", "pointer"] - ], - "skeleton-group->draw-control": [ - [[239, 249], "v1", "process-drawable"] - ], + "(method 10 flow-control)": [["_stack_", 32, "flow-section"]], + "(method 9 lod-set)": [["_stack_", 16, "res-tag"]], + "execute-math-engine": [[[15, 28], "v1", "process-drawable"]], + "(method 14 draw-control)": [[13, "v1", "process-drawable"]], + "(method 17 process-drawable)": [[7, "v1", "collide-shape"]], + "(method 10 process-drawable)": [[32, "a0", "collide-shape"]], + "(code process-drawable-art-error)": [[[18, 50], "v1", "collide-shape"]], + "(method 18 process-drawable)": [[1, "v1", "pointer"]], + "skeleton-group->draw-control": [[[239, 249], "v1", "process-drawable"]], "(method 14 process-drawable)": [ [[124, 129], "s5", "collide-shape"], [111, "v1", "vector"] @@ -4744,9 +4708,7 @@ [7, "a1", "int"], [[11, 35], "v1", "joint-control-channel"] ], - "ja-blend-eval": [ - [[3, 26], "s5", "joint-control-channel"] - ], + "ja-blend-eval": [[[3, 26], "s5", "joint-control-channel"]], "(method 9 joint-control)": [ [[12, 68], "s3", "joint-control-channel"], [[13, 70], "s5", "(pointer float)"] @@ -4755,22 +4717,96 @@ [5, "a0", "process-drawable"], [162, "s2", "art-joint-anim"] ], - "transform-and-sleep": [ - [[9, 13], "a0", "collide-shape"] + "transform-and-sleep": [[[9, 13], "a0", "collide-shape"]], + "transform-and-sleep-code": [[[9, 13], "a0", "collide-shape"]], + "transform-post": [[[2, 6], "a0", "collide-shape"]], + "rider-trans": [[[0, 4], "a0", "collide-shape"]], + "rider-post": [[[3, 17], "gp", "collide-shape"]], + "pusher-post": [[[2, 14], "gp", "collide-shape"]], + "birth-func-vector-orient": [[[7, 23], "s3", "sprite-vec-data-2d"]], + "process-drawable-burn-effect": [ + [28, "a0", "process-drawable"], + [108, "v1", "process-drawable"], + [49, "a0", "process-drawable"], + [64, "a0", "process-drawable"] ], - "transform-and-sleep-code": [ - [[9, 13], "a0", "collide-shape"] + "process-drawable2-shock-effect": [[59, "v0", "lightning-tracker"]], + "process-drawable-shock-effect": [[156, "v0", "lightning-tracker"]], + "(method 12 top-anim-joint-control)": [ + [8, "a1", "art-joint-anim"], + [40, "a1", "art-joint-anim"] ], - "transform-post": [ - [[2, 6], "a0", "collide-shape"] + "(method 13 draw-control)": [[44, "a0", "process-drawable"]], + "target-collision-reaction": [ + [349, "v1", "collide-shape-prim"], + [400, "a0", "process-focusable"], + [573, "a0", "process-focusable"], + [579, "a0", "process-focusable"] ], - "rider-trans": [ - [[0, 4], "a0", "collide-shape"] + "cspace-inspect-tree": [[[27, 89], "s2", "cspace"]], + "poly-find-nearest-edge": [ + [8, "f0", "float"], + [12, "f0", "float"] ], - "rider-post": [ - [[3, 17], "gp", "collide-shape"] + "(anon-function 15 target-anim)": [ + [103, "gp", "art-joint-anim"], + [161, "gp", "art-joint-anim"], + [161, "v1", "art-joint-anim"], + [213, "v1", "art-joint-anim"] ], - "pusher-post": [ - [[2, 14], "gp", "collide-shape"] + "(anon-function 14 target-anim)": [ + [52, "a1", "art-joint-anim"], + [186, "v1", "art-joint-anim"] + ], + "(anon-function 13 target-anim)": [[127, "a1", "art-joint-anim"]], + "target-stance-anim": [ + [98, "v1", "art-joint-anim"], + [164, "v1", "art-joint-anim"], + [261, "v1", "art-joint-anim"], + [385, "a1", "art-joint-anim"], + [475, "a1", "art-joint-anim"], + [635, "v1", "art-joint-anim"], + [772, "v1", "art-joint-anim"], + [1047, "v1", "art-joint-anim"] + ], + "target-stance-push": [ + [73, "v1", "art-joint-anim"], + [125, "v1", "art-joint-anim"] + ], + "target-falling-anim": [[61, "v1", "art-joint-anim"]], + "(anon-function 8 target-anim)": [ + [79, "v1", "art-joint-anim"], + [174, "v1", "art-joint-anim"] + ], + "target-hit-ground-flop-anim": [[39, "v1", "art-joint-anim"]], + "(anon-function 4 target-anim)": [ + [101, "v1", "art-joint-anim"], + [168, "v1", "art-joint-anim"], + [235, "v1", "art-joint-anim"], + [292, "v1", "art-joint-anim"] + ], + "(anon-function 3 target-anim)": [ + [102, "v1", "art-joint-anim"], + [162, "v1", "art-joint-anim"], + [231, "v1", "art-joint-anim"], + [289, "v1", "art-joint-anim"] + ], + "target-hit-ground-anim": [ + [132, "a1", "art-joint-anim"], + [284, "v1", "art-joint-anim"], + [336, "v1", "art-joint-anim"], + [472, "v1", "art-joint-anim"], + [532, "v1", "art-joint-anim"], + [687, "v1", "art-joint-anim"], + [848, "v1", "art-joint-anim"], + [947, "v1", "art-joint-anim"] + ], + "target-attack-air-anim": [ + [80, "v1", "art-joint-anim"], + [248, "v1", "art-joint-anim"] + ], + "target-edge-grab-anim": [ + [54, "v1", "art-joint-anim"], + [111, "v1", "art-joint-anim"] ] } diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc index 71625a0086..136cdc4570 100644 --- a/decompiler/config/jak2/var_names.jsonc +++ b/decompiler/config/jak2/var_names.jsonc @@ -2162,7 +2162,7 @@ } }, "(method 54 collide-shape)": { - "vars": {"v1-3":"proc"} + "vars": { "v1-3": "proc" } }, "(method 42 collide-shape)": { "args": ["obj", "other", "cquery"] @@ -2180,11 +2180,11 @@ "args": ["obj", "other", "cquery"] }, "(method 64 collide-shape-moving)": { - "args":["obj", "vel", "check-dist", "amt", "bounce-dist"], + "args": ["obj", "vel", "check-dist", "amt", "bounce-dist"], "vars": { - "gp-0":"initial-trans", - "s2-0":"collide-vel", - "s1-1":"vel-dir" + "gp-0": "initial-trans", + "s2-0": "collide-vel", + "s1-1": "vel-dir" } } } diff --git a/goal_src/jak2/engine/ai/enemy-h.gc b/goal_src/jak2/engine/ai/enemy-h.gc index 45aae50e5e..f50a8bff33 100644 --- a/goal_src/jak2/engine/ai/enemy-h.gc +++ b/goal_src/jak2/engine/ai/enemy-h.gc @@ -412,7 +412,7 @@ (enemy-method-131 (_type_) none 131) (enemy-method-132 (_type_) none 132) (enemy-method-133 (_type_) none 133) - (enemy-method-134 (_type_ process symbol) process-focusable 134) + (enemy-method-134 (_type_ process attack-info) process-focusable 134) (enemy-method-135 (_type_ int) sound-id 135) (enemy-method-136 (_type_) enemy-flag 136) ) diff --git a/goal_src/jak2/engine/anim/joint-h.gc b/goal_src/jak2/engine/anim/joint-h.gc index db34cd6a05..3f334bc334 100644 --- a/goal_src/jak2/engine/anim/joint-h.gc +++ b/goal_src/jak2/engine/anim/joint-h.gc @@ -5,20 +5,6 @@ ;; name in dgo: joint-h ;; dgos: ENGINE, GAME -(defenum joint-control-command - :type int64 - (zero 0) - (push 1) - (blend 2) - (four 4) - (eight 8) - (push1 19) - (thirty-two 32) - (stack 36) - (float 42) - (stack1 52) - ) - (declare-type joint-control basic) (defenum joint-control-status @@ -35,6 +21,23 @@ (eye-anim-valid 7) ;; 128 (eye-anim 8) ;; 256 ) +;; +++joint-control-command +(defenum joint-control-command + :type int64 + (zero 0) + (push 1) + (blend 2) + (joint-control-command-4 4) + (eight 8) + (push1 19) + (thirty-two 32) + (stack 36) + (float 42) + (stack1 52) + ) +;; ---joint-control-command + + ;; DECOMP BEGINS (deftype joint-control-channel (structure) diff --git a/goal_src/jak2/engine/anim/joint.gc b/goal_src/jak2/engine/anim/joint.gc index 7ba0b8c51e..a20f33c42d 100644 --- a/goal_src/jak2/engine/anim/joint.gc +++ b/goal_src/jak2/engine/anim/joint.gc @@ -1089,17 +1089,17 @@ ) -(defmethod reset-and-assign-geo! cspace ((obj cspace) (arg0 basic)) +(defmethod reset-and-assign-geo! cspace ((obj cspace) (arg0 drawable)) (set! (-> obj parent) #f) (set! (-> obj joint) #f) - (set! (-> obj geo) arg0) + (set! (-> obj geo) (the-as drawable arg0)) (set! (-> obj param0) #f) (set! (-> obj param1) #f) (set! (-> obj param2) #f) obj ) -(defmethod new cspace ((allocation symbol) (type-to-make type) (arg0 basic)) +(defmethod new cspace ((allocation symbol) (type-to-make type) (arg0 drawable)) (let ((t9-0 (method-of-type structure new)) (v1-1 type-to-make) ) diff --git a/goal_src/jak2/engine/anim/mspace-h.gc b/goal_src/jak2/engine/anim/mspace-h.gc index 5fc6df3e8f..141ec06394 100644 --- a/goal_src/jak2/engine/anim/mspace-h.gc +++ b/goal_src/jak2/engine/anim/mspace-h.gc @@ -63,7 +63,7 @@ ((parent cspace :offset-assert 0) (joint joint :offset-assert 4) (joint-num int16 :offset-assert 8) - (geo basic :offset-assert 12) + (geo drawable :offset-assert 12) (bone bone :offset-assert 16) (param0 (function cspace matrix none) :offset-assert 20) (param1 basic :offset-assert 24) @@ -73,8 +73,8 @@ :size-assert #x20 :flag-assert #xa00000020 (:methods - (new (symbol type basic) _type_ 0) - (reset-and-assign-geo! (_type_ basic) _type_ 9) + (new (symbol type drawable) _type_ 0) + (reset-and-assign-geo! (_type_ drawable) _type_ 9) ) ) diff --git a/goal_src/jak2/engine/collide/collide-h.gc b/goal_src/jak2/engine/collide/collide-h.gc index eed9767502..b4d8bf1ef3 100644 --- a/goal_src/jak2/engine/collide/collide-h.gc +++ b/goal_src/jak2/engine/collide/collide-h.gc @@ -33,7 +33,7 @@ (num-spheres uint32 :offset 116) (solid-only symbol :offset 120) (best-dist float :offset 112) - (best-other-prim basic :offset 116) + (best-other-prim collide-shape-prim :offset 116) (best-my-prim collide-shape-prim :offset 120) (move-vec vector :inline :offset 224) (best-u float :offset 112) diff --git a/goal_src/jak2/engine/collide/collide-shape-h.gc b/goal_src/jak2/engine/collide/collide-shape-h.gc index 76d29ae193..2e1da018a6 100644 --- a/goal_src/jak2/engine/collide/collide-shape-h.gc +++ b/goal_src/jak2/engine/collide/collide-shape-h.gc @@ -282,19 +282,20 @@ ;; DECOMP BEGINS (deftype collide-rider (structure) - ((rider-handle handle :offset-assert 0) - (sticky-prim collide-shape-prim :offset-assert 8) - (prim-ry float :offset-assert 12) - (rider-local-pos vector :inline :offset-assert 16) + ((rider-handle handle :offset-assert 0) + (sticky-prim collide-shape-prim :offset-assert 8) + (prim-ry float :offset-assert 12) + (rider-local-pos vector :inline :offset-assert 16) ) :method-count-assert 9 :size-assert #x20 :flag-assert #x900000020 ) + (deftype collide-rider-pool (basic) - ((alloc-count int32 :offset-assert 4) - (riders collide-rider 20 :inline :offset-assert 16) + ((alloc-count int32 :offset-assert 4) + (riders collide-rider 20 :inline :offset-assert 16) ) :method-count-assert 11 :size-assert #x290 @@ -461,23 +462,23 @@ (deftype collide-shape (trsqv) - ((actor-hash-index int16 :offset 12) - (process process-drawable :offset-assert 140) - (max-iteration-count uint8 :offset-assert 144) - (nav-flags nav-flags :offset-assert 145) - (total-prims uint8 :offset-assert 146) - (num-riders uint8 :offset-assert 147) - (pat-ignore-mask pat-surface :offset-assert 148) - (event-self symbol :offset-assert 152) - (event-other symbol :offset-assert 156) - (root-prim collide-shape-prim :offset-assert 160) + ((actor-hash-index int16 :offset 12) + (process process-drawable :offset-assert 140) + (max-iteration-count uint8 :offset-assert 144) + (nav-flags nav-flags :offset-assert 145) + (total-prims uint8 :offset-assert 146) + (num-riders uint8 :offset-assert 147) + (pat-ignore-mask pat-surface :offset-assert 148) + (event-self symbol :offset-assert 152) + (event-other symbol :offset-assert 156) + (root-prim collide-shape-prim :offset-assert 160) (riders (inline-array collide-rider) :offset-assert 164) - (penetrate-using penetrate :offset-assert 168) - (penetrated-by penetrate :offset-assert 176) - (backup-collide-as collide-spec :offset-assert 184) - (backup-collide-with collide-spec :offset-assert 188) - (event-priority uint8 :offset-assert 192) - (rider-max-momentum float :offset-assert 196) + (penetrate-using penetrate :offset-assert 168) + (penetrated-by penetrate :offset-assert 176) + (backup-collide-as collide-spec :offset-assert 184) + (backup-collide-with collide-spec :offset-assert 188) + (event-priority uint8 :offset-assert 192) + (rider-max-momentum float :offset-assert 196) ) :method-count-assert 55 :size-assert #xc8 @@ -551,7 +552,7 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (find-ground (_type_ collide-query collide-spec float float float) symbol 55) - (react-to-pat! (_type_ pat-surface) none 56) + (react-to-pat! (_type_ pat-surface) int 56) (integrate-no-collide! (_type_ vector) none 57) (integrate-for-enemy-no-mtg (_type_ vector overlaps-others-params) symbol 58) (move-above-ground (_type_ vector move-above-ground-params) none 59) @@ -628,7 +629,7 @@ (set! (-> s5-0 nav-flags) (nav-flags nav-flags0)) (set! (-> s5-0 event-self) #f) (set! (-> s5-0 event-other) #f) - (set! (-> s5-0 riders) #f) + (set! (-> s5-0 riders) (the-as (inline-array collide-rider) #f)) (set! (-> s5-0 root-prim) #f) (set! (-> s5-0 penetrate-using) (penetrate)) (set! (-> s5-0 penetrated-by) (penetrate)) diff --git a/goal_src/jak2/engine/collide/collide-shape.gc b/goal_src/jak2/engine/collide/collide-shape.gc index dd2783d81f..adcc54f2bc 100644 --- a/goal_src/jak2/engine/collide/collide-shape.gc +++ b/goal_src/jak2/engine/collide/collide-shape.gc @@ -975,8 +975,8 @@ ) ) ) + s5-0 ) - (none) ) ) diff --git a/goal_src/jak2/engine/collide/collide-target-h.gc b/goal_src/jak2/engine/collide/collide-target-h.gc index 0fc19bfe61..b90fe8c555 100644 --- a/goal_src/jak2/engine/collide/collide-target-h.gc +++ b/goal_src/jak2/engine/collide/collide-target-h.gc @@ -30,7 +30,7 @@ (unknown-time-frame-array00 time-frame 128 :offset 2688) (unknown-word00 int32 :offset 3712) (draw-offset vector :inline :offset 3728) - (cspace-offset vector :inline :offset 3744) + (cspace-offset vector :inline :offset 3744) (anim-collide-offset-local vector :inline :offset 3760) (anim-collide-offset-world vector :inline :offset 3776) (old-anim-collide-offset-world vector :inline :offset 3792) @@ -77,6 +77,8 @@ (unknown-float16 float :offset 4548) (unknown-vector22 vector :inline :offset 4560) (last-trans-on-surf vector :inline :offset 4576) + (unknown-vector-kjh1n23k1 vector :inline :offset 4592) + (unknown-vector-kj1n231 vector :inline :offset 4608) (unknown-time-frame05 time-frame :offset 4624) (unknown-float0000 float :offset 4632) (unknown-float17 float :offset 4636) @@ -88,8 +90,10 @@ (unknown-time-frame07 time-frame :offset 4672) (unknown-pat-surface00 pat-surface :offset 4680) (unknown-vector24 vector :inline :offset 4688) + (unknown-vector-kj1hj2b3 vector :inline :offset 4704) (unknown-vector25 vector :inline :offset 4720) (unknown-vector001 vector :inline :offset 4736) + (unknown-vector-kij1b231 vector :inline :offset 4752) (unknown-handle00 handle :offset 4768) (unknown-pat-surface01 pat-surface :offset 4776) (unknown-float22 float :offset 4780) @@ -99,12 +103,23 @@ (unknown-float26 float :offset 4796) (unknown-word000 int32 :offset 4800) (unknown-float002 float :offset 4804) + (unknown-float-n12iuh3n1 float :offset 4808) + (unknown-float-ki1jhbn23hj float :offset 4812) (unknown-time-frame08 time-frame :offset 4816) + (unknown-float-kj1n23j float :offset 4828) + (unknown-float-n234n23 float :offset 4832) + (unknown-float-m32j45nhn float :offset 4836) + (unknown-float-kj1n23k1 float :offset 4824) + (unknown-vector-l1jn23j vector :inline :offset 4848) + (unknown-vector-kj1n23k vector :inline :offset 4864) + (unknown-vector-kjh1n23kj1n23 vector :inline :offset 4912) (unknown-vector26 vector :inline :offset 4928) + (unknown-vector-lkjk12nj3n vector :inline :offset 4944) (btransv vector :inline :offset 4976) (blocked-factor float :offset 4992) (blocked-in-air-factor float :offset 4996) (unknown-time-frame09 time-frame :offset 5000) + (unknown-time-frame-kjh1n23hkjn time-frame :offset 5008) (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) (unknown-word02 int32 :offset 5064) (unknown-time-frame10 time-frame :offset 5072) diff --git a/goal_src/jak2/engine/common_objs/generic-obs-h.gc b/goal_src/jak2/engine/common_objs/generic-obs-h.gc index 1d5f08118b..4b72fe0f0b 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs-h.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs-h.gc @@ -23,6 +23,10 @@ (define-extern birth-pickup-at-point (function vector pickup-type float symbol process-tree fact-info (pointer process) :behavior process)) +;; NOTE - for process-drawable +(define-extern process-grab? (function process symbol symbol :behavior process)) +(define-extern process-release? (function process symbol :behavior process)) + ;; DECOMP BEGINS (deftype manipy (process-drawable) @@ -107,22 +111,23 @@ (deftype lightning-tracker (process) - ((root trsqv :offset-assert 128) - (lightning lightning-spec :offset-assert 132) - (callback (function lightning-tracker none) :offset-assert 136) - (duration uint64 :offset-assert 144) - (start-time time-frame :offset-assert 152) - (offset0 vector :inline :offset-assert 160) - (offset1 vector :inline :offset-assert 176) - (target0 uint64 :offset-assert 192) - (target1 uint64 :offset-assert 200) - (target-joint0 int32 :offset-assert 208) - (target-joint1 int32 :offset-assert 212) - (sound uint32 :offset-assert 216) - (userdata uint64 :offset-assert 224) - (user-time time-frame 2 :offset-assert 232) - (user-vector vector :inline :offset-assert 256) - (user-handle handle 2 :offset 288) + ((ppointer-override (pointer lightning-tracker) :offset 28) + (root trsqv :offset-assert 128) + (lightning lightning-spec :offset-assert 132) + (callback (function lightning-tracker none) :offset-assert 136) + (duration uint64 :offset-assert 144) + (start-time time-frame :offset-assert 152) + (offset0 vector :inline :offset-assert 160) + (offset1 vector :inline :offset-assert 176) + (target0 uint64 :offset-assert 192) + (target1 uint64 :offset-assert 200) + (target-joint0 int32 :offset-assert 208) + (target-joint1 int32 :offset-assert 212) + (sound uint32 :offset-assert 216) + (userdata uint64 :offset-assert 224) + (user-time time-frame 2 :offset-assert 232) + (user-vector vector :inline :offset-assert 256) + (user-handle handle 2 :offset 288) ) :heap-base #xb0 :method-count-assert 17 diff --git a/goal_src/jak2/engine/draw/drawable-h.gc b/goal_src/jak2/engine/draw/drawable-h.gc index 1ae1991d97..97e09cf032 100644 --- a/goal_src/jak2/engine/draw/drawable-h.gc +++ b/goal_src/jak2/engine/draw/drawable-h.gc @@ -23,6 +23,14 @@ (define-extern vis-cull (function int symbol)) (define-extern sphere-cull (function vector symbol)) +(define-extern drawable-tri-count (function drawable int)) ;; NOTE - defined in kernel? +(declare-type debug-vertex-stats basic) +(define-extern drawable-vertex-ratio (function drawable debug-vertex-stats int)) ;; NOTE - defined in kernel? + +(declare-type draw-control basic) +(define-extern add-process-drawable (function process-drawable draw-control symbol dma-buffer none)) +(define-extern dma-add-process-drawable (function process-drawable draw-control symbol dma-buffer none)) + ;; DECOMP BEGINS (deftype drawable (basic) diff --git a/goal_src/jak2/engine/gfx/foreground/foreground-h.gc b/goal_src/jak2/engine/gfx/foreground/foreground-h.gc index 91b40cbe3a..696e173973 100644 --- a/goal_src/jak2/engine/gfx/foreground/foreground-h.gc +++ b/goal_src/jak2/engine/gfx/foreground/foreground-h.gc @@ -5,6 +5,8 @@ ;; name in dgo: foreground-h ;; dgos: ENGINE, GAME +(define-extern *foreground-draw-engine* engine) + ;; DECOMP BEGINS (deftype mercneric-chain (structure) diff --git a/goal_src/jak2/engine/gfx/merc/merc-h.gc b/goal_src/jak2/engine/gfx/merc/merc-h.gc index c5af1a0811..80caf5565f 100644 --- a/goal_src/jak2/engine/gfx/merc/merc-h.gc +++ b/goal_src/jak2/engine/gfx/merc/merc-h.gc @@ -8,6 +8,10 @@ ;; NOTE - for default-menu (define-extern merc-stats (function none)) +;; NOTE - for process-drawable +(define-extern merc-blend-shape (function process-drawable object)) +(define-extern merc-eye-anim (function process-drawable none)) + ;; DECOMP BEGINS (deftype ripple-merc-query (inline-array-class) diff --git a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc index adc256a5c3..484a35c909 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc @@ -29,6 +29,12 @@ (define-extern ja-post (function none :behavior process-drawable)) +(declare-type debug-vertex-stats basic) +(define-extern *debug-vertex-stats* debug-vertex-stats) + +;; TODO - this shouldn't really be needed...but recursive call fails otherwise +(define-extern cspace-inspect-tree (function process-drawable cspace int int object process-drawable)) + ;; DECOMP BEGINS (defun cspace-by-name-no-fail ((arg0 process-drawable) (arg1 string)) diff --git a/goal_src/jak2/engine/process-drawable/process-drawable.gc b/goal_src/jak2/engine/process-drawable/process-drawable.gc index 0bd79743d8..a90f648cae 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable.gc @@ -5,7 +5,10 @@ ;; name in dgo: process-drawable ;; dgos: ENGINE, GAME -;; temp hacks to avoid crash at startup +(declare-type fuel-cell basic) ;; TODO!! + +;; DECOMP BEGINS + (defmethod add-to-loading-level skeleton-group ((obj skeleton-group)) (let ((v1-1 (-> *level* loading-level))) (if v1-1 @@ -15,6 +18,58 @@ obj ) +(defun cspace-by-name ((arg0 process-drawable) (arg1 string)) + (let* ((s4-0 (-> arg0 node-list length)) + (s3-0 0) + (s2-0 (-> arg0 node-list data s3-0)) + ) + (while (< s3-0 s4-0) + (if (and (-> s2-0 joint) (name= (-> s2-0 joint name) arg1)) + (return s2-0) + ) + (+! s3-0 1) + (set! s2-0 (-> arg0 node-list data s3-0)) + ) + ) + (the-as cspace #f) + ) + +(defun cspace-index-by-name ((arg0 process-drawable) (arg1 string)) + (let* ((s4-0 0) + (s3-0 (-> arg0 node-list length)) + (s2-0 0) + (v1-3 (-> arg0 node-list data s2-0)) + ) + (while (< s2-0 s3-0) + (if (and (-> v1-3 joint) (name= (-> v1-3 joint name) arg1)) + (return s4-0) + ) + (+! s4-0 1) + (+! s2-0 1) + (set! v1-3 (-> arg0 node-list data s2-0)) + ) + ) + -1 + ) + +(defun vector<-cspace! ((arg0 vector) (arg1 cspace)) + (rlet ((Q :class vf) + (vf0 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (.lvf vf2 (&-> (-> arg1 bone) transform trans quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.mov.vf vf2 vf0 :mask #b1000) + (.svf (&-> arg0 quad) vf2) + arg0 + ) + ) + (defun vector<-matrix! ((arg0 vector) (arg1 matrix)) (rlet ((Q :class vf) (vf0 :class vf) @@ -33,15 +88,1859 @@ ) ) -(defun draw-joint-axes ((arg0 process-drawable)) - (format 0 "draw-joint-axes not yet implemented~%") +(defun vector<-cspace+vector! ((arg0 vector) (arg1 cspace) (arg2 vector)) + (vector-matrix*! arg0 arg2 (-> arg1 bone transform)) + ) + +(defun-debug cspace-children ((arg0 process-drawable) (arg1 int)) + (let ((a3-0 '())) + (countdown (s4-0 (-> arg0 node-list length)) + (if (= (-> arg0 node-list data s4-0 parent) arg1) + (set! a3-0 (cons (-> arg0 node-list data s4-0) a3-0)) + ) + ) + a3-0 + ) + ) + +;; WARN: Using new Jak 2 rtype-of +(defun-debug cspace-inspect-tree ((arg0 process-drawable) (arg1 cspace) (arg2 int) (arg3 int) (arg4 object)) + (local-vars (sv-16 string) (sv-32 int) (sv-48 int)) + (if (and (= arg4 'mesh) (zero? *debug-vertex-stats*)) + (set! *debug-vertex-stats* (new 'debug 'debug-vertex-stats)) + ) + (if (not arg1) + (set! arg1 (the-as cspace (-> arg0 node-list data))) + ) + (print-tree-bitmask arg3 arg2) + (cond + ((-> arg1 joint) + (format + #t + "~S~S ~D" + (if (zero? arg2) + "" + "+---" + ) + (-> arg1 joint name) + (-> arg1 joint number) + ) + (let ((v1-11 arg4)) + (cond + ((= v1-11 'matrix) + #f + ) + ((= v1-11 'mesh) + (let ((s1-0 format) + (s0-0 #t) + ) + (set! sv-16 " ~D/~D/~F") + (set! sv-32 (drawable-frag-count (-> arg1 geo))) + (set! sv-48 (drawable-tri-count (-> arg1 geo))) + (let ((t0-2 (drawable-vertex-ratio (-> arg1 geo) *debug-vertex-stats*))) + (s1-0 s0-0 sv-16 sv-32 sv-48 t0-2) + ) + ) + ) + ) + ) + (format #t "~%") + ) + (else + (format + #t + "~S~S~%" + (if (zero? arg2) + "" + "+---" + ) + arg1 + ) + ) + ) + (let* ((s2-1 (cspace-children arg0 (the-as int arg1))) + (a0-16 s2-1) + (s1-1 ((method-of-type (rtype-of a0-16) length) a0-16)) + (a1-11 (car s2-1)) + ) + (while (not (null? s2-1)) + (+! s1-1 -1) + (cspace-inspect-tree + arg0 + (the-as cspace a1-11) + (+ arg2 1) + (if (zero? s1-1) + arg3 + (logior arg3 (ash 1 (+ arg2 1))) + ) + arg4 + ) + (set! s2-1 (cdr s2-1)) + (set! a1-11 (car s2-1)) + ) + ) + arg0 + ) + +(defmethod new draw-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 symbol)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 jgeo) (the-as art-joint-geo arg1)) + (set! (-> v0-0 process) (the-as process-drawable arg0)) + (set! (-> v0-0 ripple) #f) + v0-0 + ) + ) + +(defmethod lod-set! draw-control ((obj draw-control) (arg0 int)) + (let ((v1-1 (max 0 (min arg0 (the-as int (-> obj lod-set max-lod)))))) + (set! (-> obj desired-lod) v1-1) + (when (!= (-> obj cur-lod) v1-1) + (set! (-> obj mgeo) (-> obj lod-set lod v1-1 geo)) + (set! (-> obj cur-lod) v1-1) + (if (nonzero? (-> obj seg-mask)) + (setup-masks obj (the-as uint 0) 0) + ) + ) + ) + 0 (none) ) -;; DECOMP BEGINS +(defmethod lods-assign! draw-control ((obj draw-control) (arg0 lod-set)) + (mem-copy! (the-as pointer (-> obj lod-set)) (the-as pointer arg0) 49) + (let ((a1-2 (min (-> obj cur-lod) (the-as int (-> obj lod-set max-lod))))) + (set! (-> obj cur-lod) -1) + (lod-set! obj a1-2) + ) + 0 + (none) + ) -;; ERROR: top level function was not converted to expressions. Cannot decompile. +(defmethod setup-masks draw-control ((obj draw-control) (arg0 uint) (arg1 int)) + (local-vars (v1-4 int) (a2-1 (array uint64))) + (let ((a1-2 (logior (logclear (-> obj seg-mask) arg0) arg1))) + (set! (-> obj seg-mask) a1-2) + (cond + ((zero? a1-2) + (set! (-> obj effect-mask) (the-as uint 0)) + 0 + ) + ((begin (set! a2-1 (-> obj mgeo seg-table)) (set! v1-4 0) (nonzero? a2-1)) + (countdown (a3-0 (-> a2-1 length)) + (if (logtest? a1-2 (ash 1 a3-0)) + (set! v1-4 (logior v1-4 (-> a2-1 a3-0))) + ) + ) + (set! (-> obj effect-mask) (the-as uint v1-4)) + ) + (else + (set! (-> obj effect-mask) (the-as uint 0)) + 0 + ) + ) + ) + 0 + (none) + ) +(defmethod setup-lods! lod-set ((obj lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) + (local-vars (sv-16 res-tag)) + (let ((v1-0 (-> arg1 length)) + (s3-0 (-> arg0 max-lod)) + ) + (set! (-> obj max-lod) (the-as int s3-0)) + (dotimes (a0-1 (the-as int (+ s3-0 1))) + (when (or (< (-> arg0 mgeo a0-1) 0) (>= (-> arg0 mgeo a0-1) v1-0)) + (set! obj (the-as lod-set #f)) + (goto cfg-22) + ) + (let ((a1-14 (-> arg1 data (-> arg0 mgeo a0-1)))) + (when (or (zero? a1-14) (!= (-> a1-14 type) merc-ctrl)) + (set! obj (the-as lod-set #f)) + (goto cfg-22) + ) + (set! (-> obj lod a0-1 geo) (the-as merc-ctrl a1-14)) + ) + (set! (-> obj lod a0-1 dist) (-> arg0 lod-dist a0-1)) + ) + (if (= (-> obj lod s3-0 dist) 4095996000.0) + (set! (-> obj lod s3-0 dist) (res-lump-float arg2 'vis-dist :default 4095996000.0)) + ) + ) + (let ((v1-14 (-> arg1 data (-> arg0 jgeo)))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-15 (res-lump-data (-> v1-14 extra) 'lod-dist pointer :tag-ptr (& sv-16)))) + (when v1-15 + (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) + (set! (-> obj lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-15 (* a0-6 4))))) + ) + ) + ) + ) + (label cfg-22) + obj + ) +;; WARN: Return type mismatch cspace-array vs none. +(defmethod setup-cspace-and-add draw-control ((obj draw-control) (arg0 art-joint-geo) (arg1 symbol)) + (let ((s5-0 ((method-of-type cspace-array new) arg1 cspace-array (+ (-> arg0 length) 1))) + (v0-1 ((method-of-type skeleton new) arg1 skeleton (+ (-> arg0 length) 1))) + ) + (set! (-> obj skeleton) v0-1) + (let ((s3-1 v0-1)) + (when (or (zero? s5-0) (zero? s3-1)) + (go process-drawable-art-error "memory") + (set! s5-0 (the-as cspace-array #f)) + (goto cfg-13) + ) + (let ((v1-9 ((method-of-type cspace reset-and-assign-geo!) (the-as cspace (-> s5-0 data)) (the-as drawable #f)))) + (set! (-> v1-9 bone) (the-as bone (-> s3-1 bones))) + ) + (let ((v1-10 (-> s5-0 data))) + (set! (-> v1-10 0 param0) (the-as (function cspace matrix none) cspace<-transformq!)) + (set! (-> v1-10 0 param1) (the-as basic (-> (the-as process-drawable (-> obj process)) root trans))) + ) + (let ((v1-12 (reset-and-assign-geo! (-> s5-0 data 1) (the-as drawable #f)))) + (set! (-> v1-12 joint) (-> arg0 data 0)) + (set! (-> v1-12 bone) (-> s3-1 bones 1)) + (set! (-> v1-12 parent) (the-as cspace (-> s5-0 data))) + ) + (let ((v1-14 (reset-and-assign-geo! (-> s5-0 data 2) (the-as drawable #f)))) + (set! (-> v1-14 joint) (-> arg0 data 1)) + (set! (-> v1-14 bone) (-> s3-1 bones 2)) + (set! (-> v1-14 parent) (the-as cspace (-> s5-0 data))) + (set! (-> v1-14 param0) (the-as (function cspace matrix none) cspace<-parented-matrix-joint!)) + (set! (-> v1-14 param1) (-> obj process)) + ) + (let ((s2-0 3)) + (while (< s2-0 (-> s5-0 length)) + (let* ((s0-0 (-> arg0 data (+ s2-0 -1))) + (s1-0 (if (-> s0-0 parent) + (+ (-> s0-0 parent number) 1) + 0 + ) + ) + (v1-25 (reset-and-assign-geo! (-> s5-0 data s2-0) (the-as drawable #f))) + ) + (set! (-> v1-25 joint) s0-0) + (set! (-> v1-25 bone) (-> s3-1 bones s2-0)) + (set! (-> v1-25 parent) (-> s5-0 data s1-0)) + ) + (+! s2-0 1) + ) + ) + ) + ) + (add-connection *foreground-draw-engine* (-> obj process) add-process-drawable (-> obj process) obj #f) + (label cfg-13) + (none) + ) +(defun execute-math-engine () + (let ((gp-0 *matrix-engine*)) + (let ((s5-0 (-> gp-0 length))) + (dotimes (s4-0 s5-0) + (let ((v1-3 (the-as process-drawable (handle->process (-> gp-0 s4-0))))) + (if v1-3 + (do-joint-math (-> v1-3 draw) (-> v1-3 node-list) (-> v1-3 skel)) + ) + ) + ) + ) + (set! (-> gp-0 length) 0) + ) + 0 + 0 + ) +(defmethod do-joint-math draw-control ((obj draw-control) (arg0 cspace-array) (arg1 joint-control)) + (with-pp + (cond + ((logtest? (-> obj status) (draw-control-status no-draw no-draw-temp)) + ) + ((zero? arg1) + (matrix<-transformq+trans! + (the-as matrix (-> obj skeleton bones 3)) + (the-as transformq (-> (the-as process-drawable (-> obj process)) root trans)) + (-> obj skeleton bones 0 transform trans) + ) + (vector+! (-> obj origin) (-> obj skeleton bones 3 transform trans) (-> obj bounds)) + (set! (-> obj origin w) (-> obj bounds w)) + ) + (else + (let* ((s2-0 (-> obj mgeo num-joints)) + (s1-0 (+ s2-0 2)) + ) + (+ s1-0 1) + (let ((s5-0 pp)) + (set! pp (-> obj process)) + ((-> arg1 generate-frame-function) (the-as joint-anim-frame (+ 2400 #x70000000)) s1-0 arg1) + (if (-> arg1 prebind-function) + ((-> arg1 prebind-function) (the-as joint-anim-frame (+ 2400 #x70000000)) s1-0 arg1) + ) + (dotimes (s1-1 1) + (let* ((v1-20 (-> arg0 data s1-1)) + (t9-3 (-> v1-20 param0)) + ) + (when t9-3 + (let ((a0-9 v1-20) + (a1-5 (-> v1-20 param1)) + ) + (-> v1-20 param2) + (t9-3 a0-9 (the-as matrix a1-5)) + ) + ) + ) + ) + (dotimes (s1-2 2) + (let* ((a0-11 (-> arg0 data (+ s1-2 1))) + (a1-7 (+ (* s1-2 64) 2400 #x70000000)) + (t9-4 (-> a0-11 param0)) + ) + (if t9-4 + (t9-4 a0-11 (the-as matrix a1-7)) + ) + ) + ) + (let ((s1-3 3)) + (dotimes (s0-0 s2-0) + (let ((a0-12 (-> arg0 data (+ s0-0 s1-3))) + (a1-9 (+ (* 48 s0-0) 2528 #x70000000)) + ) + (if (-> a0-12 param0) + ((-> a0-12 param0) a0-12 (the-as matrix a1-9)) + (cspace<-parented-transformq-joint! a0-12 (the-as transformq a1-9)) + ) + ) + ) + ) + (if (-> arg1 postbind-function) + ((-> arg1 postbind-function) obj arg0 arg1) + ) + (let ((a1-11 (new 'stack-no-clear 'vector))) + (set! (-> a1-11 quad) (-> obj bounds quad)) + (set! (-> a1-11 w) 1.0) + (vector-matrix*! (-> obj origin) a1-11 (the-as matrix (-> obj skeleton bones (-> obj origin-joint-index)))) + ) + (let ((f0-2 (-> obj bounds w))) + (set! (-> obj origin w) f0-2) + f0-2 + ) + (set! pp s5-0) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod cleanup-for-death process-drawable ((obj process-drawable)) + (when (type? (-> obj root) collide-shape) + (let ((v1-2 (-> (the-as collide-shape (-> obj root)) root-prim))) + (set! (-> v1-2 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 prim-core collide-with) (collide-spec)) + ) + 0 + ) + (if (nonzero? (-> obj skel)) + (ja-channel-set! 0) + ) + (process-entity-status! obj (entity-perm-status dead) #t) + 0 + (none) + ) + +(defmethod relocate-nav process-drawable ((obj process-drawable) (arg0 int)) + (set! (-> obj nav) (the-as nav-control (&+ (the-as pointer (-> obj nav)) arg0))) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defun draw-joint-axes ((arg0 process-drawable)) + (local-vars + (sv-64 (function symbol bucket-id vector vector meters rgba symbol)) + (sv-80 symbol) + (sv-96 int) + (sv-112 vector) + ) + (let ((s5-0 (new 'stack-no-clear 'vector2h)) + (s4-0 (shl #x8000 16)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-1 s5-0)) + (set! (-> v1-1 x) 5) + (set! (-> v1-1 y) -5) + ) + (dotimes (s2-0 (-> arg0 node-list length)) + (let ((s1-0 (-> arg0 node-list data s2-0 bone transform))) + (vector<-cspace! s3-0 (-> arg0 node-list data s2-0)) + (dotimes (s0-0 3) + (set! sv-64 add-debug-vector) + (set! sv-80 #t) + (set! sv-96 318) + (set! sv-112 s3-0) + (let ((a3-0 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (+ (the-as uint s1-0) (* s0-0 16))) 1.0) + ) + (t0-0 #x444ccccd) + (t1-0 (logior (ash 255 (* s0-0 8)) s4-0)) + ) + (sv-64 sv-80 (the-as bucket-id sv-96) sv-112 a3-0 (the-as meters t0-0) (the-as rgba t1-0)) + ) + ) + ) + (format (clear *temp-string*) "~d" (+ s2-0 -1)) + (let ((a2-3 *temp-string*)) + (add-debug-text-3d #t (bucket-id debug-no-zbuf1) a2-3 s3-0 (font-color blue-#003cf1) s5-0) + ) + (set! (-> s5-0 x) (the-as int (+ (-> s5-0 x) 10))) + ) + ) + (none) + ) + +(defun draw-root ((arg0 process-drawable)) + (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> arg0 root trans) (-> arg0 root quat)) + (none) + ) + +(defmethod deactivate process-drawable ((obj process-drawable)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + (if (nonzero? (-> obj sound)) + (stop! (-> obj sound)) + ) + (let ((a0-3 (-> obj nav))) + (if (and a0-3 (nonzero? a0-3)) + (nav-control-method-41 a0-3) + ) + ) + (let* ((s5-0 (-> obj root)) + (a0-5 (if (type? s5-0 collide-shape) + s5-0 + ) + ) + ) + (when a0-5 + (let ((a2-0 (-> (the-as collide-shape a0-5) actor-hash-index)) + (v1-12 *actor-hash*) + ) + (when (and (!= a2-0 -1) (= a0-5 (-> v1-12 object-array a2-0 object))) + (remove-by-id v1-12 (-> v1-12 sphere-array a2-0) a2-0) + 0 + ) + ) + ) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +(defstate empty-state (process) + :code (the-as (function none :behavior process) nothing) + ) + +(defstate process-drawable-art-error (process-drawable) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (when (= v1-0 'nav-mesh-kill) + (deactivate self) + #t + ) + ) + ) + ) + :code (behavior ((arg0 string)) + (if (-> self entity) + (logior! (-> self entity extra perm status) (entity-perm-status bit-1)) + ) + (let* ((s5-0 (-> self root)) + (v1-6 (if (type? s5-0 collide-shape) + s5-0 + ) + ) + ) + (when v1-6 + (let ((a0-5 (-> (the-as collide-shape v1-6) root-prim))) + (set! (-> a0-5 prim-core collide-as) (collide-spec)) + (set! (-> a0-5 prim-core collide-with) (collide-spec)) + ) + (set! (-> (the-as collide-shape v1-6) backup-collide-as) (collide-spec)) + (set! (-> (the-as collide-shape v1-6) backup-collide-with) (collide-spec)) + 0 + ) + ) + (until #f + (when (the-as collide-shape *display-entity-errors*) + (let ((s5-1 (cond + ((nonzero? (the-as collide-shape (-> self root))) + (-> (the-as collide-shape (-> self root)) trans) + ) + ((the-as collide-shape (-> self entity)) + (&-> (the-as collide-shape (-> (the-as collide-shape (-> self entity)) trans z)) quat y) + ) + (else + #f + ) + ) + ) + ) + (when s5-1 + (let ((s4-0 add-debug-text-3d) + (s3-0 #t) + (s2-0 318) + ) + (format (clear *temp-string*) "~2j~s error for ~s" arg0 (-> self name)) + (s4-0 + s3-0 + (the-as bucket-id s2-0) + *temp-string* + (the-as vector s5-1) + (font-color precursor-#ec3b00) + (the-as vector2h #f) + ) + ) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defstate process-drawable-idle (process-drawable) + :code (the-as (function none :behavior process-drawable) sleep-code) + :post ja-post + ) + +(defun skeleton-group->draw-control ((arg0 process-drawable) (arg1 skeleton-group) (arg2 (pointer cspace-array))) + (local-vars (s2-0 draw-control) (sv-16 art-element) (sv-20 int)) + (let ((s3-0 (if (= (-> arg1 texture-level) 6) + (-> *level* default-level) + (-> arg0 level) + ) + ) + ) + (let ((s1-0 (load-to-heap-by-name (-> s3-0 art-group) (-> arg1 art-group-name) #f global (-> arg1 version)))) + (when (or (zero? s1-0) (or (not s1-0) (!= (-> s1-0 type) art-group))) + (go process-drawable-art-error "art-group") + (set! s2-0 (the-as draw-control #f)) + (goto cfg-50) + ) + (set! sv-16 (-> s1-0 data (-> arg1 jgeo))) + (set! sv-20 (-> s1-0 length)) + (when (or (< (the-as int (-> arg1 jgeo)) 0) + (>= (the-as int (-> arg1 jgeo)) sv-20) + (not sv-16) + (!= (-> sv-16 type) art-joint-geo) + ) + (go process-drawable-art-error "joint-geo") + (set! s2-0 (the-as draw-control #f)) + (goto cfg-50) + ) + (set! s2-0 (new 'process 'draw-control arg0 (the-as symbol sv-16))) + (let ((v1-24 s2-0)) + (set! (-> v1-24 status) (draw-control-status uninited)) + (set! (-> v1-24 art-group) s1-0) + (set! (-> v1-24 jgeo) (the-as art-joint-geo sv-16)) + (set! (-> v1-24 force-lod) -1) + (set! (-> v1-24 cur-lod) -1) + (set! (-> v1-24 shadow) #f) + (set! (-> v1-24 shadow-ctrl) #f) + (set! (-> v1-24 data-format) (draw-control-data-format merc)) + (set! (-> v1-24 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (set! (-> v1-24 color-emissive quad) (-> (new 'static 'vector) quad)) + (set! (-> v1-24 longest-edge) (-> arg1 longest-edge)) + (set! (-> v1-24 origin-joint-index) (the-as uint (-> arg1 origin-joint-index))) + (set! (-> v1-24 shadow-joint-index) (the-as uint (-> arg1 shadow-joint-index))) + ) + (set! (-> s2-0 bounds quad) (-> arg1 bounds quad)) + (let ((v1-26 (-> arg1 shadow))) + (when (and (> v1-26 0) (< v1-26 sv-20)) + (let ((s0-0 (-> s1-0 data v1-26))) + (if (and (not (logtest? (the-as int (res-lump-value (-> arg0 entity) 'options uint128 :time -1000000000.0)) 8192)) + (= (-> s0-0 type) shadow-geo) + ) + (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + ) + ) + ) + ) + (if (not (setup-lods! (-> s2-0 lod-set) arg1 s1-0 (-> arg0 entity))) + (go process-drawable-art-error "mesh") + ) + ) + (let ((v1-41 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + ) + (case (if (= (-> arg1 texture-level) 6) + 6 + (-> s3-0 index) + ) + ((6) + (set! v1-41 (-> arg1 sort)) + ) + ) + (set! (-> s2-0 default-texture-page) (the-as uint v1-41)) + ) + (set! (-> s2-0 level-index) (the-as uint (-> s3-0 index))) + ) + (set! (-> s2-0 dma-add-func) nothing) + (set! (-> arg2 0) (the-as cspace-array (setup-cspace-and-add s2-0 (the-as art-joint-geo sv-16) 'process))) + (set! (-> s2-0 dma-add-func) dma-add-process-drawable) + (set! (-> s2-0 shadow-mask) (res-lump-value (-> arg0 entity) 'shadow-mask uint :time -1000000000.0)) + (set! (-> s2-0 shadow-values) (res-lump-value (-> arg0 entity) 'shadow-values uint :time -1000000000.0)) + (set! (-> s2-0 light-index) (if (zero? (-> arg1 light-index)) + (res-lump-value (-> arg0 entity) 'light-index uint :time -1000000000.0) + (-> arg1 light-index) + ) + ) + (let* ((gp-1 (ppointer->process (-> arg0 parent))) + (v1-54 (if (type? gp-1 process-drawable) + gp-1 + ) + ) + ) + (when (and v1-54 (nonzero? (-> (the-as process-drawable v1-54) draw))) + (set! (-> s2-0 light-index) (-> (the-as process-drawable v1-54) draw light-index)) + (set! (-> s2-0 shadow-mask) (-> (the-as process-drawable v1-54) draw shadow-mask)) + (set! (-> s2-0 shadow-values) (-> (the-as process-drawable v1-54) draw shadow-values)) + ) + ) + (lod-set! s2-0 0) + (label cfg-50) + s2-0 + ) + +(defmethod initialize-skeleton process-drawable ((obj process-drawable) (arg0 skeleton-group) (arg1 pair)) + (local-vars (v1-14 art-element)) + (if (not arg0) + (go process-drawable-art-error "skel-group") + ) + (set! (-> obj draw) (skeleton-group->draw-control obj arg0 (&-> obj node-list))) + (let* ((s3-0 (-> obj draw)) + (a2-3 + (res-lump-value (-> s3-0 jgeo extra) 'joint-channel uint128 :default (the-as uint128 6) :time -1000000000.0) + ) + ) + (cond + ((> (the-as int a2-3) 0) + (logior! (-> s3-0 status) (draw-control-status math-skel)) + (let ((v0-3 (new 'process 'joint-control (the-as int a2-3)))) + (set! (-> obj skel) v0-3) + (let ((s4-0 v0-3)) + (let ((s3-1 (-> s3-0 art-group))) + (cond + ((>= (the-as int (-> arg0 janim)) 0) + (when (or (>= (the-as int (-> arg0 janim)) (-> s3-1 length)) + (begin (set! v1-14 (-> s3-1 data (-> arg0 janim))) (not v1-14)) + (!= (-> v1-14 type) art-joint-anim) + ) + (go process-drawable-art-error "initial joint-anim") + (return (the-as draw-control #f)) + ) + (ja-channel-set! 1) + (let ((s2-0 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s2-0 + (the-as art-joint-anim (-> s3-1 data (-> arg0 janim))) + num-func-identity + ) + (set! (-> s2-0 frame-num) 0.0) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + ) + (set! (-> s4-0 effect) (new 'process 'effect-control obj)) + ) + ) + ) + (else + (set! (-> s3-0 skeleton bones 0 transform trans quad) (-> (the-as vector (get-property-struct + (-> s3-0 jgeo extra) + 'trans-offset + 'interp + -1000000000.0 + *null-vector* + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + quad + ) + ) + ) + ) + ) + (let ((s5-3 (-> obj root))) + (if (and s5-3 (nonzero? s5-3) (type? s5-3 collide-shape)) + (find-collision-meshes (the-as collide-shape s5-3)) + ) + ) + (-> obj draw) + ) + +(defmethod initialize-skeleton-by-name process-drawable ((obj process-drawable) (arg0 string)) + (let* ((s4-0 *level*) + (s3-0 (method-of-object s4-0 art-group-get-by-name)) + ) + (format (clear *temp-string*) "skel-~S" arg0) + (let ((s4-1 (s3-0 s4-0 *temp-string* (the-as (pointer uint32) #f)))) + (if (and (nonzero? s4-1) (valid? s4-1 skeleton-group #f #f 0)) + (initialize-skeleton obj (the-as skeleton-group s4-1) (the-as pair 0)) + (go process-drawable-art-error arg0) + ) + ) + ) + (-> obj draw) + ) + +(defmethod apply-alignment process-drawable ((obj process-drawable) (arg0 align-opts) (arg1 transformq) (arg2 vector)) + (with-pp + (when (logtest? arg0 (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel)) + (let* ((s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root quat))) + (s0-0 (matrix-transpose! (new 'stack-no-clear 'matrix) s3-0)) + (s2-0 (vector-matrix*! (new 'stack-no-clear 'vector) (-> *standard-dynamics* gravity) s0-0)) + (a1-5 (vector-matrix*! (new 'stack-no-clear 'vector) (-> obj root transv) s0-0)) + ) + (if (logtest? arg0 (align-opts no-gravity)) + (set-vector! s2-0 0.0 0.0 0.0 1.0) + ) + (when (logtest? arg0 (align-opts adjust-x-vel)) + (set! (-> a1-5 x) (+ (* (-> arg1 trans x) (-> arg2 x) (-> pp clock frames-per-second)) + (* (-> s2-0 x) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-xz-vel keep-other-velocities))) + (set! (-> a1-5 z) 0.0) + ) + ) + (if (and (logtest? arg0 (align-opts adjust-y-vel)) + (not (and (logtest? arg0 (align-opts ignore-y-if-zero)) (= (-> arg1 trans y) 0.0))) + ) + (set! (-> a1-5 y) (+ (* (-> arg1 trans y) (-> arg2 y) (-> pp clock frames-per-second)) + (* (-> s2-0 y) (-> pp clock seconds-per-frame)) + ) + ) + ) + (when (logtest? arg0 (align-opts adjust-xz-vel)) + (set! (-> a1-5 z) (+ (* (-> arg1 trans z) (-> arg2 z) (-> pp clock frames-per-second)) + (* (-> s2-0 z) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-x-vel keep-other-velocities))) + (set! (-> a1-5 x) 0.0) + ) + ) + (vector-matrix*! (-> obj root transv) a1-5 s3-0) + ) + ) + (if (logtest? arg0 (align-opts adjust-quat)) + (quaternion-normalize! (quaternion*! (-> obj root quat) (-> obj root quat) (-> arg1 quat))) + ) + (-> obj root) + ) + ) + +(defbehavior ja-done? process-drawable ((arg0 int)) + (let ((v1-2 (-> self skel root-channel arg0))) + (cond + ((zero? (-> self skel active-channels)) + #t + ) + ((= (-> v1-2 num-func) num-func-seek!) + (= (-> v1-2 frame-num) (-> v1-2 param 0)) + ) + ((= (-> v1-2 num-func) num-func-interp-play!) + (= (the int (-> v1-2 frame-num)) (+ (-> v1-2 frame-group frames num-frames) -1)) + ) + (else + #t + ) + ) + ) + ) + +(defbehavior ja-min? process-drawable ((arg0 int)) + (= (-> self skel root-channel arg0 frame-num) 0.0) + ) + +(defbehavior ja-max? process-drawable ((arg0 int)) + (let ((v1-2 (-> self skel root-channel arg0))) + (>= (-> v1-2 frame-num) (the float (+ (-> v1-2 frame-group frames num-frames) -1))) + ) + ) + +;; WARN: Return type mismatch uint vs int. +(defbehavior ja-num-frames process-drawable ((arg0 int)) + (the-as int (+ (-> self skel root-channel arg0 frame-group frames num-frames) -1)) + ) + +(defbehavior ja-frame-num process-drawable ((arg0 int)) + (-> self skel root-channel arg0 frame-num) + ) + +(defbehavior ja-aframe-num process-drawable ((arg0 int)) + (let* ((a0-2 (-> self skel root-channel arg0)) + (v1-2 (-> a0-2 frame-group)) + ) + (if (and v1-2 (nonzero? v1-2)) + (+ (* (-> a0-2 frame-num) (-> v1-2 artist-step)) (-> v1-2 artist-base)) + 0.0 + ) + ) + ) + +(defbehavior ja-aframe process-drawable ((arg0 float) (arg1 int)) + (let ((v1-3 (-> self skel root-channel arg1 frame-group))) + (if (and v1-3 (nonzero? v1-3)) + (/ (- arg0 (-> v1-3 artist-base)) (-> v1-3 artist-step)) + arg0 + ) + ) + ) + +(defbehavior ja-speed process-drawable ((arg0 int)) + (-> self skel root-channel arg0 frame-group speed) + ) + +(defbehavior ja-step process-drawable ((arg0 int)) + (-> self skel root-channel arg0 frame-group artist-step) + ) + +(defbehavior ja-channel-set! process-drawable ((arg0 int)) + (let ((s5-0 (-> self skel))) + (when (nonzero? (-> s5-0 float-channels)) + (if (>= arg0 (the-as int (-> s5-0 active-channels))) + (qmem-copy->! + (the-as pointer (-> s5-0 channel arg0)) + (the-as pointer (-> s5-0 channel (-> s5-0 active-channels))) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + (qmem-copy<-! + (the-as pointer (-> s5-0 channel arg0)) + (the-as pointer (-> s5-0 channel (-> s5-0 active-channels))) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + ) + ) + (set! (-> s5-0 active-channels) (the-as uint arg0)) + (set! (-> s5-0 root-channel) (-> s5-0 channel)) + (set! (-> s5-0 blend-index) (the-as uint -1)) + (dotimes (v1-19 arg0) + (set! (-> s5-0 root-channel v1-19 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-19 group-sub-index) v1-19) + (set! (-> s5-0 root-channel v1-19 command) (if (zero? v1-19) + (joint-control-command push) + (joint-control-command blend) + ) + ) + (set! (-> s5-0 root-channel v1-19 frame-interp 0) 0.0) + (set! (-> s5-0 root-channel v1-19 frame-interp 1) 0.0) + (set! (-> s5-0 root-channel v1-19 frame-num) 0.0) + (set! (-> s5-0 root-channel v1-19 frame-group) #f) + (set! (-> s5-0 root-channel v1-19 num-func) num-func-none) + (set! (-> s5-0 root-channel v1-19 group-size) arg0) + ) + ) + arg0 + ) + +(defbehavior ja-channel-push! process-drawable ((arg0 int) (arg1 time-frame)) + (let ((s5-0 (-> self skel))) + (cond + ((or (zero? (-> s5-0 active-channels)) + (zero? arg1) + (when (>= (+ (-> s5-0 active-channels) (-> s5-0 float-channels) arg0) (-> s5-0 allocated-length)) + (format + 0 + "WARNING: ~A could not do (ja-channel-push! ~D) because it has ~D/~D channels.~%" + self + arg0 + (+ (-> s5-0 active-channels) (-> s5-0 float-channels)) + (-> s5-0 allocated-length) + ) + #t + ) + ) + (ja-channel-set! arg0) + ) + (else + (when (not (-> s5-0 root-channel 0 frame-group)) + (let ((s3-0 (/ (- (the-as int (-> s5-0 root-channel)) (the-as uint (the-as int (-> s5-0 channel)))) 64))) + (if (nonzero? (-> s5-0 float-channels)) + (qmem-copy<-! + (the-as pointer (-> s5-0 channel s3-0)) + (the-as pointer (-> s5-0 channel (-> s5-0 active-channels))) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + ) + (set! (-> s5-0 active-channels) (the-as uint s3-0)) + ) + (if (zero? (-> s5-0 active-channels)) + (return (ja-channel-set! arg0)) + ) + ) + (let ((s3-1 (-> s5-0 active-channels))) + (if (nonzero? (-> s5-0 float-channels)) + (qmem-copy->! + (the-as pointer (-> s5-0 channel (+ arg0 1 s3-1))) + (the-as pointer (-> s5-0 channel s3-1)) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + ) + (set! (-> s5-0 root-channel) (the-as (inline-array joint-control-channel) (-> s5-0 channel s3-1))) + ) + (set! (-> s5-0 active-channels) (the-as uint (+ arg0 1 (-> s5-0 active-channels)))) + (dotimes (v1-38 arg0) + (set! (-> s5-0 root-channel v1-38 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-38 group-sub-index) v1-38) + (set! (-> s5-0 root-channel v1-38 command) (if (zero? v1-38) + (joint-control-command push) + (joint-control-command blend) + ) + ) + (set! (-> s5-0 root-channel v1-38 frame-interp 0) 0.0) + (set! (-> s5-0 root-channel v1-38 frame-interp 1) 0.0) + (set! (-> s5-0 root-channel v1-38 frame-num) 0.0) + (set! (-> s5-0 root-channel v1-38 frame-group) #f) + (set! (-> s5-0 root-channel v1-38 num-func) num-func-none) + (set! (-> s5-0 root-channel v1-38 group-size) arg0) + ) + (let ((v1-42 (-> s5-0 root-channel arg0))) + (set! (-> v1-42 eval-time) (the-as uint 0)) + (set! (-> v1-42 group-sub-index) arg0) + (set! (-> s5-0 blend-index) (+ (-> s5-0 active-channels) -1)) + (set! (-> v1-42 frame-interp 0) 0.0) + (set! (-> v1-42 frame-interp 1) 0.0) + (set! (-> v1-42 frame-num) 0.0) + (set! (-> v1-42 frame-group) #f) + (set! (-> v1-42 group-size) arg0) + (set! (-> v1-42 param 0) (/ 5.0 (+ 5.0 (the float arg1)))) + (set! (-> v1-42 num-func) num-func-blend-in!) + (cond + ((= arg0 1) + (set! (-> v1-42 command) (joint-control-command stack1)) + (set! (-> s5-0 root-channel 0 command) (joint-control-command push1)) + ) + (else + (set! (-> v1-42 command) (joint-control-command stack)) + ) + ) + ) + arg0 + ) + ) + ) + ) + +(defbehavior ja-channel-float! process-drawable ((arg0 art-joint-anim) (arg1 float) (arg2 float) (arg3 float)) + (cond + ((>= (+ (-> self skel active-channels) (-> self skel float-channels)) (-> self skel allocated-length)) + (format + 0 + "WARNING: ~A could not do (ja-channel-float! ~D) because it has ~D/~D channels.~%" + self + 1 + (+ (-> self skel active-channels) (-> self skel float-channels)) + (-> self skel allocated-length) + ) + (the-as joint-control-channel #f) + ) + (else + (let ((v0-1 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels))))) + (+! (-> self skel float-channels) 1) + (set! (-> v0-1 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> v0-1 group-sub-index) 0) + (set! (-> v0-1 command) (joint-control-command float)) + (set! (-> v0-1 frame-interp 0) arg2) + (set! (-> v0-1 frame-interp 1) arg3) + (set! (-> v0-1 frame-num) arg1) + (set! (-> v0-1 frame-group) arg0) + (set! (-> v0-1 num-func) num-func-none) + (set! (-> v0-1 group-size) 1) + (set! (-> v0-1 dist) 0.0) + v0-1 + ) + ) + ) + ) + +;; WARN: Return type mismatch uint vs none. +(defbehavior joint-control-reset! process-drawable ((arg0 joint-control) (arg1 joint-control-channel)) + (let* ((v1-2 (the-as object (- (the-as int arg1) (the-as uint (* (-> arg1 group-size) 64))))) + (s5-0 (/ (- (the-as int v1-2) (the-as uint (the-as int (-> arg0 channel)))) 64)) + (s4-0 (/ (- (the-as int arg1) (the-as uint v1-2)) 64)) + ) + (when (> s5-0 0) + (if (= (-> (the-as joint-control-channel v1-2) command) (joint-control-command push1)) + (set! (-> (the-as joint-control-channel v1-2) command) (joint-control-command push)) + ) + (if (= (-> arg0 root-channel) (the-as joint-control-channel v1-2)) + (set! (-> arg0 root-channel) (-> arg0 channel)) + (set! (-> arg0 root-channel) + (the-as (inline-array joint-control-channel) (-> arg0 root-channel (- (+ s5-0 1)))) + ) + ) + (qmem-copy<-! + (the-as pointer (-> arg0 channel)) + (the-as pointer v1-2) + (the-as int (* (- (+ (-> arg0 active-channels) (-> arg0 float-channels)) (the-as uint s5-0)) 64)) + ) + (qmem-copy<-! + (the-as pointer (-> arg0 channel s4-0)) + (the-as pointer (+ (the-as uint (-> arg0 channel 1)) (* s4-0 64))) + (* (+ (- (- -1 s5-0) s4-0) (-> arg0 float-channels) (-> arg0 active-channels)) 64) + ) + (set! (-> arg0 active-channels) (- (-> arg0 active-channels) (the-as uint (+ s5-0 1)))) + ) + ) + (none) + ) + +(defbehavior ja-group-size process-drawable () + (if (< (the-as int (-> self skel root-channel)) + (the-as int (-> self skel channel (-> self skel active-channels))) + ) + (-> self skel root-channel 0 group-size) + 0 + ) + ) + +(defbehavior ja-eval process-drawable () + (let ((gp-0 (-> self skel root-channel 0)) + (s5-0 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels)))) + (s4-0 (-> self clock frame-counter)) + ) + (while (< (the-as int gp-0) (the-as int s5-0)) + (cond + ((logtest? (-> gp-0 command) (joint-control-command joint-control-command-4)) + ) + (else + (if (!= (-> gp-0 eval-time) s4-0) + (joint-control-channel-eval gp-0) + ) + ) + ) + (&+! gp-0 64) + ) + ) + 0 + ) + +(defbehavior ja-blend-eval process-drawable () + (let ((gp-0 (-> self skel root-channel)) + (s5-0 (the-as joint-control-channel (-> self skel channel))) + (s4-0 (-> self clock frame-counter)) + ) + (when (and (nonzero? (-> self skel active-channels)) (!= gp-0 s5-0)) + (while (< (the-as int s5-0) (the-as int gp-0)) + (cond + ((logtest? (-> s5-0 command) (joint-control-command joint-control-command-4)) + ) + (else + (if (!= (-> s5-0 eval-time) s4-0) + (joint-control-channel-eval s5-0) + ) + ) + ) + (&+! s5-0 64) + ) + ) + ) + 0 + ) + +;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] +;; ERROR: Unsupported inline assembly instruction kind - [jr ra] +(defmethod update-anim-data joint-control ((obj joint-control)) + (local-vars (s7-0 none) (ra-0 int)) + (let ((s5-0 (+ (-> obj active-channels) (-> obj float-channels)))) + (dotimes (s4-0 (the-as int s5-0)) + (let ((s3-0 (-> obj channel s4-0))) + (case (-> s3-0 command) + (((joint-control-command stack) (joint-control-command stack1)) + ) + (else + (let ((s2-0 (-> s3-0 frame-group))) + (when (not (and s2-0 (nonzero? s2-0) (= (logand (the-as int s2-0) 7) 4) (= (-> s2-0 type) art-joint-anim))) + (go process-drawable-art-error "joint-anim") + (break!) + ;; (.lw ra-0 return-from-thread s7-0) + ;; (.jr ra-0) + ;; (nop!) + ;; 0 + ) + (when (nonzero? (-> s2-0 frames flags)) + (cond + ((logtest? (-> s2-0 frames flags) 2) + (update-time-stamp *anim-manager* s2-0) + ) + ((logtest? (-> s2-0 frames flags) 1) + (decompress *anim-manager* s2-0) + ) + ) + ) + (set! (-> s3-0 frame-num) + (fmax 0.0 (fmin (-> s3-0 frame-num) (the float (+ (-> s2-0 frames num-frames) -1)))) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] +;; ERROR: Unsupported inline assembly instruction kind - [jr ra] +(defmethod evaluate-joint-control process-drawable ((obj process-drawable)) + (local-vars (s1-0 joint-control-channel) (s2-0 int) (s4-0 uint) (s7-0 none) (ra-0 int)) + (with-pp + (let ((gp-0 (-> obj skel))) + (let ((a0-1 (-> gp-0 top-anim))) + (b! (not a0-1) cfg-2 :delay (empty-form)) + (update a0-1) + ) + (until (= s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (label cfg-2) + (set! s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (let ((s3-0 (-> pp clock frame-counter))) + (b! (logtest? (-> obj draw status) (draw-control-status no-draw)) cfg-45 :delay (empty-form)) + (set! s2-0 0) + (b! #t cfg-30 :delay (nop!)) + (label cfg-4) + (set! s1-0 (-> gp-0 channel s2-0)) + (b! + (not (and (logtest? (-> s1-0 command) (joint-control-command thirty-two)) (!= (-> s1-0 eval-time) s3-0))) + cfg-10 + :delay (empty-form) + ) + ) + (joint-control-channel-eval s1-0) + ) + (label cfg-10) + (let ((v1-19 (-> s1-0 command))) + (b! (!= v1-19 (joint-control-command stack)) cfg-12 :delay (nop!)) + (b! #t cfg-29 :delay (nop!)) + (label cfg-12) + (cond + ((= v1-19 (joint-control-command stack1)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 0) (-> s1-0 frame-interp 0)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 1) (-> s1-0 frame-interp 1)) + ) + (else + (let ((s0-0 (-> s1-0 frame-group))) + (when (not (and s0-0 (nonzero? s0-0) (= (logand (the-as int s0-0) 7) 4) (= (-> s0-0 type) art-joint-anim))) + (go process-drawable-art-error "joint-anim") + (break!) + ;; (.lw ra-0 return-from-thread s7-0) + ;; (.jr ra-0) + ;; (nop!) + ;; 0 + ) + (when (nonzero? (-> s0-0 frames flags)) + (cond + ((logtest? (-> s0-0 frames flags) 2) + (update-time-stamp *anim-manager* s0-0) + ) + ((logtest? (-> s0-0 frames flags) 1) + (decompress *anim-manager* s0-0) + ) + ) + ) + (set! (-> s1-0 frame-num) + (fmax 0.0 (fmin (-> s1-0 frame-num) (the float (+ (-> s0-0 frames num-frames) -1)))) + ) + ) + ) + ) + ) + (label cfg-29) + (+! s2-0 1) + (label cfg-30) + (b! (< s2-0 (the-as int s4-0)) cfg-4) + (dotimes (v1-56 (the-as int s4-0)) + (set! (-> gp-0 channel v1-56 frame-interp 0) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 0)))) + (set! (-> gp-0 channel v1-56 frame-interp 1) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 1)))) + ) + (if (or (zero? s4-0) (or (not (-> gp-0 root-channel 0 frame-group)) (zero? (-> gp-0 active-channels)))) + (logior! (-> obj draw status) (draw-control-status no-draw-temp)) + ) + (if (logtest? (-> obj skel status) (joint-control-status blend-shape blend-shape-valid)) + (merc-blend-shape obj) + ) + (if (logtest? (-> obj skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim obj) + ) + (label cfg-45) + (let ((a0-26 (-> gp-0 effect))) + (if a0-26 + (effect-control-method-9 a0-26) + ) + ) + ) + 0 + (none) + ) + ) + +;; WARN: Function ja-post has a return type of none, but the expression builder found a return statement. +(defbehavior ja-post process-drawable () + (when (nonzero? (-> self draw)) + (let ((gp-1 (logtest? (-> self draw status) (draw-control-status uninited)))) + (logclear! (-> self draw status) (draw-control-status no-draw-temp uninited)) + (when (nonzero? (-> self skel)) + (evaluate-joint-control self) + (when (or (logtest? (-> self skel status) (joint-control-status sync-math)) gp-1) + (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) + (if (and gp-1 (type? (-> self root) collide-shape)) + (update-transforms (the-as collide-shape (-> self root))) + ) + (return #f) + ) + ) + ) + (let ((v1-23 *matrix-engine*)) + (set! (-> v1-23 (-> v1-23 length)) (process->handle self)) + (+! (-> v1-23 length) 1) + ) + ) + 0 + (none) + ) + +(defmethod current-cycle-distance joint-control ((obj joint-control)) + (cond + ((< (the-as int (-> obj root-channel)) (the-as int (-> obj channel (-> obj active-channels)))) + (let ((s4-0 (-> obj root-channel (-> obj root-channel 0 group-size))) + (s3-0 (the-as joint-control-channel (-> obj root-channel))) + (s5-0 (the-as (pointer float) (new 'stack-no-clear 'vector))) + ) + (while (< (the-as int s3-0) (the-as int s4-0)) + (case (-> s3-0 command) + (((joint-control-command push)) + (set! (-> s5-0 0) (-> s3-0 dist)) + (set! s5-0 (&-> s5-0 1)) + ) + (((joint-control-command blend) (joint-control-command push1) (joint-control-command float)) + (set! (-> s5-0 -1) (lerp (-> s5-0 -1) (-> s3-0 dist) (-> s3-0 frame-interp (-> obj active-frame-interp)))) + ) + (((joint-control-command stack)) + (set! (-> s5-0 -2) (lerp (-> s5-0 -2) (-> s5-0 -1) (-> s3-0 frame-interp (-> obj active-frame-interp)))) + (set! s5-0 (&-> s5-0 -1)) + ) + ) + (&+! s3-0 64) + ) + (-> s5-0 -1) + ) + ) + (else + 0.0 + ) + ) + ) + +(defmethod new top-anim-joint-control ((allocation symbol) (type-to-make type) (arg0 process-drawable)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 process) (the-as (pointer process-drawable) (process->ppointer arg0))) + (set! (-> gp-0 interp-select 0) (the-as uint (-> arg0 skel interp-select 0))) + (set! (-> gp-0 interp-select 1) (the-as uint (-> arg0 skel interp-select 1))) + (set! (-> gp-0 base-anim-speed) 1.0) + (set! (-> gp-0 base-anim-blend) 0.1333333) + (set! (-> gp-0 frame-post-put-away) #f) + (reset gp-0) + gp-0 + ) + ) + +;; WARN: Return type mismatch top-anim-joint-control vs none. +(defmethod reset top-anim-joint-control ((obj top-anim-joint-control)) + (let ((v0-0 obj)) + (set! (-> v0-0 interp) 0.0) + (set! (-> v0-0 frame-targ) #f) + (set! (-> v0-0 frame-group) #f) + (set! (-> v0-0 frame-group-push) #f) + (set! (-> v0-0 frame-num) 0.0) + (set! (-> v0-0 frame-start) 0.0) + (set! (-> v0-0 frame-blend) 0.0) + (set! (-> v0-0 frame-post-blend) 0.1333333) + (set! (-> v0-0 frame-post-end) 0.0) + (set! (-> v0-0 base-anim) #f) + (set! (-> v0-0 base-anim-speed) 1.0) + (set! (-> v0-0 base-anim-blend) 0.1333333) + ) + (none) + ) + +(defmethod get-channel top-anim-joint-control ((obj top-anim-joint-control) (arg0 int)) + (case arg0 + ((1) + (case (-> obj process 0 skel float-channels) + ((2) + (-> obj process 0 skel channel (-> obj process 0 skel active-channels)) + ) + (else + (the-as joint-control-channel #f) + ) + ) + ) + (else + (case (-> obj process 0 skel float-channels) + ((1) + (-> obj process 0 skel channel (-> obj process 0 skel active-channels)) + ) + ((2) + (-> obj process 0 skel channel (+ (-> obj process 0 skel active-channels) 1)) + ) + (else + (the-as joint-control-channel #f) + ) + ) + ) + ) + ) + +(defmethod push-anim-to-targ top-anim-joint-control ((obj top-anim-joint-control) + (arg0 art-joint-anim) + (arg1 float) + (arg2 int) + (arg3 int) + (arg4 float) + (arg5 float) + (arg6 symbol) + ) + (with-pp + (when (!= (-> obj interp) 0.0) + (let ((v1-1 obj)) + (set! (-> v1-1 frame-targ) arg0) + (set! (-> v1-1 frame-speed) arg4) + (set! (-> v1-1 frame-start) (/ arg1 (-> arg0 artist-step))) + (set! (-> v1-1 frame-blend) (if (zero? arg2) + 0.0 + (/ 5.0 (+ 5.0 (the float arg2))) + ) + ) + (set! (-> v1-1 frame-post-blend) (if (zero? arg3) + 0.0 + (/ 5.0 (+ 5.0 (the float arg3))) + ) + ) + (set! (-> v1-1 frame-post-end) (/ arg5 (-> arg0 artist-step))) + (set! (-> v1-1 frame-push-time) (-> pp clock frame-counter)) + (set! (-> v1-1 frame-post-put-away) #f) + ) + (if arg6 + (sound-play-by-spec (the-as sound-spec arg6) (new-sound-id) (the-as vector #t)) + ) + ) + 0 + (none) + ) + ) + +(defmethod update top-anim-joint-control ((obj top-anim-joint-control)) + (with-pp + (let* ((v1-0 (-> obj process)) + (pp (if v1-0 + (the-as process-drawable (-> v1-0 0 self)) + ) + ) + ) + (let ((s3-0 (get-channel obj 1)) + (s5-0 (get-channel obj 0)) + (s4-0 (-> obj base-anim)) + ) + (set! (-> obj frame-group-push) #f) + (cond + ((= (-> obj interp) 0.0) + (when s5-0 + (seek! (-> s5-0 frame-interp 1) 0.0 (* 8.0 (-> pp clock seconds-per-frame))) + (if s3-0 + (set! (-> s3-0 frame-interp 1) (fmin (-> s3-0 frame-interp 1) (-> s5-0 frame-interp 1))) + ) + (when (= (-> s5-0 frame-interp 1) 0.0) + (set! (-> obj frame-post-put-away) #f) + (when (= (-> obj interp) 0.0) + (joint-channel-float-delete! s5-0) + (set! (-> obj frame-group) #f) + (set! (-> obj frame-num) 0.0) + (set! (-> pp skel generate-frame-function) create-interpolated-joint-animation-frame) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + ) + ) + ) + ) + (else + (when (or (not s5-0) + (or (and (-> obj frame-targ) + (and (!= (-> obj frame-blend) 0.0) + (or (!= (-> s5-0 frame-group) (-> obj frame-targ)) (< (-> obj update-time) (-> obj frame-push-time))) + ) + ) + (and (not (-> obj frame-targ)) + (!= (-> s5-0 frame-group) s4-0) + (set! (-> obj frame-blend) (-> obj frame-post-blend)) + ) + ) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + (set! s5-0 (get-channel obj 0)) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + ) + (set! (-> pp skel generate-frame-function) create-interpolated2-joint-animation-frame) + (let ((s2-0 (the-as basic (-> obj frame-targ)))) + (set! s2-0 (cond + ((the-as art-joint-anim s2-0) + (empty) + s2-0 + ) + (else + s4-0 + ) + ) + ) + (set! s3-0 s5-0) + (if s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + ) + (cond + ((= s4-0 s2-0) + (let ((v1-30 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-30 + (set! (-> v1-30 param 0) 1.0) + (set! (-> v1-30 num-func) num-func-loop!) + v1-30 + ) + ) + ) + (when s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ((>= (-> obj frame-speed) 0.0) + (let ((v1-35 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 + (when v1-35 + (set! (-> v1-35 param 0) + (- (the float (+ (-> (the-as art-joint-anim s2-0) frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> v1-35 param 1) (-> obj frame-speed)) + (set! (-> v1-35 num-func) num-func-seek!) + v1-35 + ) + ) + ) + (if s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) + ) + (else + (when s5-0 + (let ((v1-39 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-39 + (set! (-> v1-39 param 0) 0.0) + (set! (-> v1-39 param 1) (fabs (-> obj frame-speed))) + (set! (-> v1-39 num-func) num-func-seek!) + v1-39 + ) + ) + ) + (when s5-0 + (set! (-> s5-0 frame-num) (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-start))) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ) + ) + ) + (when s5-0 + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) + (set! (-> obj frame-cur-blend) (-> obj frame-blend)) + ) + ) + (when s5-0 + (set! (-> pp skel interp-select 0) (the-as int (-> obj interp-select 0))) + (set! (-> pp skel interp-select 1) (the-as int (-> obj interp-select 1))) + (let ((f0-35 (cond + ((not (-> obj frame-targ)) + (-> obj base-anim-blend) + ) + (s3-0 + (-> obj frame-cur-blend) + ) + (else + 0.1333333 + ) + ) + ) + ) + (if (= f0-35 0.0) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + (seek! (-> s5-0 frame-interp 1) (-> obj interp) (* f0-35 (-> pp clock time-adjust-ratio))) + ) + ) + (when s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + (set! (-> s3-0 frame-interp 1) (-> obj interp)) + (if (!= (-> s3-0 eval-time) (-> pp clock frame-counter)) + (joint-control-channel-eval s3-0) + ) + (when (= (-> s5-0 frame-interp 1) (-> obj interp)) + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + (set! s5-0 (get-channel obj 0)) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + ) + ) + (let ((v1-70 (-> obj frame-targ))) + (cond + (v1-70 + (cond + ((= (-> s5-0 frame-group) v1-70) + (if (!= (-> s5-0 eval-time) (-> pp clock frame-counter)) + (joint-control-channel-eval s5-0) + ) + (when (= (-> s5-0 frame-num) (-> s5-0 param 0)) + (set! (-> obj frame-targ) #f) + (set! (-> obj frame-start) 0.0) + (cond + ((-> obj frame-post-put-away) + (set! (-> obj interp) 0.0) + (set! (-> obj frame-post-put-away) #f) + ) + ((!= (-> obj frame-post-blend) 0.0) + (set! (-> s5-0 param 0) (the float (+ (-> s5-0 frame-group frames num-frames) -1))) + ) + (else + (set! (-> s5-0 frame-num) 0.0) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) 1.0) + ) + ) + ) + ) + (else + (set! (-> s5-0 eval-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> s5-0 frame-group) v1-70) + (set! (-> s5-0 frame-num) (if (< (-> obj frame-speed) 0.0) + (- (the float (+ (-> v1-70 frames num-frames) -1)) (-> obj frame-start)) + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) + ) + (set! (-> s5-0 num-func) num-func-seek!) + (if (>= (-> obj frame-speed) 0.0) + (set! (-> s5-0 param 0) + (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> s5-0 param 0) 0.0) + ) + (set! (-> s5-0 param 1) (fabs (-> obj frame-speed))) + ) + ) + ) + (else + (when (!= (-> s5-0 frame-group) s4-0) + (set! (-> s5-0 frame-num) 0.0) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) (-> obj base-anim-speed)) + (set! (-> obj frame-post-blend) 0.1333333) + ) + ) + ) + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) + ) + ) + ) + ) + (set! (-> obj update-time) (-> pp clock frame-counter)) + ) + 0 + (none) + ) + ) + +;; WARN: new jak 2 until loop case, check carefully +(defbehavior sleep-code process-drawable () + (until #f + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + ) + #f + ) + +(defbehavior transform-and-sleep process-drawable () + (let ((gp-0 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-post) + (update-transforms (the-as collide-shape (-> self root))) + (set! (-> self skel status) gp-0) + ) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + (none) + ) + +(defbehavior transform-and-sleep-code process-drawable () + (let ((gp-0 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-post) + (update-transforms (the-as collide-shape (-> self root))) + (set! (-> self skel status) gp-0) + ) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + (none) + ) + +(defbehavior transform-post process-drawable () + (ja-post) + (update-transforms (the-as collide-shape (-> self root))) + 0 + ) + +(defbehavior rider-trans process-drawable () + (detect-riders! (the-as collide-shape (-> self root))) + 0 + (none) + ) + +(defbehavior rider-post process-drawable () + (ja-post) + (let ((gp-0 (the-as collide-shape (-> self root)))) + (update-transforms gp-0) + (pull-riders! gp-0) + (do-push-aways gp-0) + ) + 0 + (none) + ) + +(defbehavior pusher-post process-drawable () + (ja-post) + (let ((gp-0 (the-as collide-shape (-> self root)))) + (update-transforms gp-0) + (do-push-aways gp-0) + ) + 0 + ) + +(defbehavior process-drawable-delay-player process-drawable ((arg0 time-frame)) + (while (and *target* (logtest? (-> *target* focus-status) (focus-status in-air))) + (suspend) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (process-grab? *target* #f) + (while (or (-> *setting-control* user-current talking) + (-> *setting-control* user-current spooling) + (-> *setting-control* user-current hint) + (-> *setting-control* user-current ambient) + ) + (suspend) + ) + (while (< (- (-> self clock frame-counter) (-> self state-time)) arg0) + (suspend) + ) + (process-release? *target*) + (suspend) + 0 + ) + +;; WARN: Return type mismatch entity-perm-status vs none. +(defbehavior process-drawable-fuel-cell-handler process-drawable ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('pickup) + (if (type? arg0 fuel-cell) + (process-entity-status! self (entity-perm-status dead) #t) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. +(defbehavior process-drawable-birth-fuel-cell process-drawable ((arg0 entity) (arg1 vector) (arg2 symbol)) + (let ((v1-0 arg0) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (if (not v1-0) + (set! v1-0 (-> self entity)) + ) + (if arg1 + (set! (-> gp-0 quad) (-> arg1 quad)) + (set! (-> gp-0 quad) (-> v1-0 extra trans quad)) + ) + (let ((s5-0 (-> v1-0 extra perm task)) + (s4-0 (new 'static 'fact-info)) + ) + (set! (-> s4-0 options) (actor-option)) + (if arg2 + (set! (-> s4-0 options) (actor-option auto-pickup)) + ) + (when (and (nonzero? s5-0) (not (task-complete? *game-info* (the-as game-task s5-0)))) + (label cfg-12) + (birth-pickup-at-point gp-0 (pickup-type fuel-cell) (the float s5-0) #f self s4-0) + (when (not (-> self child)) + (suspend) + (goto cfg-12) + ) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. +;; WARN: Return type mismatch object vs process-focusable. +(defbehavior find-offending-process-focusable process-drawable ((arg0 process-tree) (arg1 attack-info)) + (let ((s5-0 (the-as object #f))) + (when (and arg1 (logtest? (-> arg1 mask) (attack-info-mask attacker))) + (let ((s4-0 (handle->process (-> arg1 attacker)))) + (set! s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (when (not (the-as process s5-0)) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'get-offending-focusable) + (set! s5-0 (send-event-function arg0 a1-3)) + ) + (when (not s5-0) + (label cfg-16) + (b! (not arg0) cfg-24 :delay (empty-form)) + (set! s5-0 (cond + ((type? arg0 process-focusable) + arg0 + ) + (else + (let ((v1-12 process-tree)) + (b! (= (-> arg0 type) v1-12) cfg-24 :delay (nop!)) + ) + (nop!) + (set! arg0 (ppointer->process (-> arg0 parent))) + (goto cfg-16) + s5-0 + ) + ) + ) + 0 + ) + ) + (label cfg-24) + (the-as process-focusable s5-0) + ) + ) + +(when *debug-segment* +(define *valid-con* (new 'debug 'string #x4000 (the-as string #f))) + +) +(defun-debug process-drawable-valid? ((arg0 process-drawable)) + (let ((s5-0 #t)) + (clear *valid-con*) + (format *valid-con* "~%--- ~A -----------------------------~%" arg0) + (dotimes (s4-0 (-> arg0 node-list length)) + (let ((s3-0 (-> arg0 node-list data s4-0))) + (when (-> s3-0 geo) + (cond + ((valid? (-> s3-0 geo) drawable (the-as symbol "cspace geo") #t *valid-con*) + ) + (else + (format *valid-con* "ERROR: ~A has an invalid geo ~A~%" s3-0 (-> s3-0 geo)) + (set! s5-0 #f) + ) + ) + ) + ) + ) + (let ((s4-1 (+ (-> arg0 skel active-channels) (-> arg0 skel float-channels)))) + (when (< (-> arg0 skel allocated-length) s4-1) + (format + *valid-con* + "ERROR: ~~A has ~D joint channels, but only ~D are allowed~%" + arg0 + s4-1 + (-> arg0 skel allocated-length) + ) + (set! s5-0 #f) + ) + (dotimes (s3-1 (the-as int s4-1)) + (let ((s2-0 (-> arg0 skel channel s3-1))) + (cond + ((logtest? (-> s2-0 command) (joint-control-command joint-control-command-4)) + ) + ((valid? (-> s2-0 frame-group) art-joint-anim (the-as symbol "joint-control frame-group") #t *valid-con*) + (when (not (and (>= (the int (-> s2-0 frame-num)) 0) + (< (the int (-> s2-0 frame-num)) (the-as int (-> s2-0 frame-group frames num-frames))) + ) + ) + (format + *valid-con* + "ERROR: ~`joint-control-channel`P #~D has an invalid frame-num ~F/~D [0-~D]~%" + s2-0 + s3-1 + (-> s2-0 frame-num) + (the int (-> s2-0 frame-num)) + (+ (-> s2-0 frame-group frames num-frames) -1) + ) + (set! s5-0 #f) + ) + ) + (else + (format + *valid-con* + "ERROR: ~`joint-control-channel`P #~D has an invalid frame-group ~A~%" + s2-0 + s3-1 + (-> s2-0 frame-group) + ) + (set! s5-0 #f) + ) + ) + ) + ) + ) + (when (not s5-0) + (format *valid-con* "--------------------------------~%~%") + (format 0 "~S" *valid-con*) + ) + s5-0 + ) + ) diff --git a/goal_src/jak2/engine/target/collide-reaction-target.gc b/goal_src/jak2/engine/target/collide-reaction-target.gc index 6827c51917..20cbbad9bb 100644 --- a/goal_src/jak2/engine/target/collide-reaction-target.gc +++ b/goal_src/jak2/engine/target/collide-reaction-target.gc @@ -7,3 +7,614 @@ ;; DECOMP BEGINS +(defun poly-find-nearest-edge ((arg0 nav-poly) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) + "TODO- Not 100% sure here, but unused" + (local-vars (sv-32 vector) (sv-36 float) (sv-40 int) (sv-48 float) (sv-80 vector)) + (set! sv-32 (new 'stack-no-clear 'vector)) + (set! sv-36 (the-as float 4095996000.0)) + (set! sv-40 -1) + (set! sv-48 (the-as float 0.0)) + (dotimes (s2-0 3) + (let ((s0-0 (-> arg1 s2-0))) + (set! sv-80 (-> arg1 (mod (+ s2-0 1) 3))) + (let ((f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) + ) + 0.0 + (vector-normalize! s1-1 1.0) + (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) + (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) + (set! sv-36 f30-0) + (set! sv-40 s2-0) + (set! sv-48 f0-5) + ) + ) + ) + ) + ) + (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) + (set! (-> arg0 vertex1 quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) + arg0 + ) + +(defun target-collision-low-coverage ((arg0 control-info) + (arg1 collide-query) + (arg2 vector) + (arg3 (pointer uint32)) + (arg4 (pointer int64)) + (arg5 (pointer symbol)) + ) + (local-vars + (sv-16 vector) + (sv-20 (pointer uint32)) + (sv-24 (pointer int64)) + (sv-28 (pointer symbol)) + (sv-32 uint) + (sv-40 int) + (sv-48 symbol) + (sv-52 vector) + (sv-56 vector) + ) + (with-pp + (set! sv-16 arg2) + (set! sv-20 arg3) + (set! sv-24 arg4) + (set! sv-28 arg5) + (set! sv-32 (-> arg3 0)) + (set! sv-40 (-> arg4 0)) + (set! sv-48 (-> arg5 0)) + (set! sv-52 (-> arg0 unknown-vector26)) + (set! sv-56 (vector-cross! (-> arg0 unknown-vector-kjh1n23kj1n23) (-> arg0 poly-normal) sv-16)) + (vector-normalize! sv-56 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) + (set! sv-32 (logior sv-32 512)) + ) + (vector-cross! sv-52 sv-16 sv-56) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) + (vector-negate! sv-52 sv-52) + ) + (vector-normalize! sv-52 1.0) + (let ((s4-0 (new 'stack-no-clear 'collide-query))) + (let ((s3-0 (vector-flatten! (-> arg0 unknown-vector-lkjk12nj3n) sv-52 (-> arg0 dynam gravity-normal)))) + (let ((v1-19 s4-0)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (-> arg1 best-my-prim prim-core collide-with)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (vector-normalize! s3-0 1.0) + (if (< (vector-dot s3-0 sv-16) 0.0) + (vector-negate! s3-0 s3-0) + ) + (set! (-> arg0 unknown-float-kj1n23k1) 4095996000.0) + (set! (-> arg0 unknown-float-n234n23) 4095996000.0) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) s3-0 2867.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 4096.0) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 unknown-float-kj1n23k1) + (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> s4-0 best-other-tri intersect)) + ) + ) + (set! (-> arg0 unknown-float-kj1n23j) (the-as float (-> s4-0 best-other-tri pat))) + (set! (-> arg0 unknown-vector-l1jn23j quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) (-> arg0 dynam gravity-normal) 819.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) s3-0 -819.2) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 -4096.0) + ) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 unknown-float-n234n23) + (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) + ) + (set! (-> arg0 unknown-float-m32j45nhn) (the-as float (-> s4-0 best-other-tri pat))) + (set! (-> arg0 unknown-vector-kj1n23k quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + ) + (when (and (not (logtest? sv-32 512)) + (and (or (< (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 unknown-float-kj1n23k1)) + (= (shr (shl (the-as int (-> arg0 unknown-float-kj1n23j)) 54) 61) 1) + ) + (and (< (-> arg0 unknown-float-n234n23) (* 2.0 (-> arg1 best-my-prim local-sphere w))) + (or (zero? (shr (shl (the-as int (-> arg0 unknown-float-m32j45nhn)) 54) 61)) + (= (shr (shl (the-as int (-> arg0 unknown-float-m32j45nhn)) 54) 61) 3) + ) + ) + ) + ) + (set! sv-32 (logior sv-32 128)) + (set! (-> arg0 unknown-time-frame-kjh1n23hkjn) (-> pp clock frame-counter)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-time-frame08) (-> pp clock frame-counter)) + (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector10))) + (f0-27 (if (logtest? sv-32 2) + (cos (- 16384.0 (acos (-> arg0 coverage)))) + (-> arg0 coverage) + ) + ) + (f1-11 (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-other-tri intersect)) + ) + ) + ) + (if (or (not (logtest? sv-32 32)) (< 0.5 f0-27)) + (set! sv-48 (the-as symbol #f)) + ) + (when (and (or (and (< f0-27 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 32) (< f0-27 0.3)) + (< f1-11 (* -0.25 (-> arg1 best-my-prim local-sphere w))) + ) + (>= (vector-dot sv-52 sv-16) -0.000001) + ) + (set! (-> arg0 surf) *edge-surface*) + (set! sv-32 (logior sv-32 1024)) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 32) + (set! sv-48 #t) + (set! sv-32 (logior sv-32 4096)) + ) + ) + ) + ) + (if (< (-> arg0 surface-angle) 0.0) + (set! sv-48 #t) + ) + (when sv-48 + (cond + ((and (or (or (= (-> arg0 poly-pat mode) (pat-mode ground)) (= (-> arg0 poly-pat mode) (pat-mode halfpipe))) + (and (logtest? sv-32 8) + (>= (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 unknown-float-kj1n23k1)) + (or (zero? (shr (shl (the-as int (-> arg0 unknown-float-kj1n23j)) 54) 61)) + (= (shr (shl (the-as int (-> arg0 unknown-float-kj1n23j)) 54) 61) 3) + ) + (< 0.3 (fabs (-> arg0 surface-angle))) + ) + ) + (zero? (logand sv-32 128)) + ) + (set! sv-32 (logior sv-32 64)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-time-frame08) (-> pp clock frame-counter)) + (set! sv-48 (the-as symbol #f)) + ) + (#t + (set! sv-32 (logior sv-32 64)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-time-frame08) (-> pp clock frame-counter)) + ) + ) + ) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch int vs collide-status. +(defbehavior target-collision-reaction target ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-240 symbol)) + (set! sv-80 (new-stack-vector0)) + (set! sv-84 (new-stack-vector0)) + (let ((v1-2 (new 'stack-no-clear 'matrix))) + (dotimes (a0-1 2) + (set! (-> v1-2 vector a0-1 quad) (the-as uint128 0)) + ) + (set! sv-88 v1-2) + ) + (set! sv-96 0) + (set! sv-104 0) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-3) + ) + (set! sv-104 (logior sv-104 (react-to-pat! arg0 (-> arg1 best-other-tri pat)))) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! sv-104 (logior sv-104 1)) + ) + (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flag air)) + (set! sv-104 (logior sv-104 32)) + ) + (let ((v1-24 (new 'stack-no-clear 'vector))) + (set! (-> v1-24 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-other-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (set! sv-104 (logior sv-104 24)) + ) + (let ((v1-35 (-> sv-80 quad))) + (set! (-> sv-84 quad) v1-35) + ) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (the-as vector (-> sv-88 vector))) + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-96 (logior sv-96 16)) + ) + (if (< (-> arg0 poly-angle) 0.0) + (set! sv-96 (logior sv-96 #x4000)) + ) + (if (!= (-> arg1 best-my-prim prim-id) 6) + (set! sv-104 (logior sv-104 #x8000)) + ) + (if (and (= (-> arg0 cur-pat mode) (pat-mode halfpipe)) (< (-> arg0 poly-angle) 0.75)) + (send-event (-> arg0 process) 'slide) + ) + (set! sv-240 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) + (if (and sv-240 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.4 (fabs (-> arg0 surface-angle))))) + (set! sv-240 (the-as symbol #f)) + ) + (if (and (logtest? sv-104 #x8000) (logtest? sv-104 32) (>= (-> arg0 poly-angle) 0.0) (not sv-240)) + (set! sv-240 #t) + ) + (if sv-240 + (set! sv-104 (logior sv-104 2)) + ) + (if (logtest? sv-104 8) + (target-collision-low-coverage + arg0 + arg1 + sv-84 + (the-as (pointer uint32) (& sv-104)) + (the-as (pointer int64) (& sv-96)) + (& sv-240) + ) + ) + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (set! (-> arg0 unknown-vector-kj1n231 quad) (-> arg0 transv quad)) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (set! (-> arg0 unknown-float21) (- (vector-dot (-> arg0 transv) sv-84))) + (set! sv-96 (logior sv-96 2048)) + (if (nonzero? (-> arg0 unknown-surface01 impact-hook)) + ((-> arg0 unknown-surface01 impact-hook) arg0 (the-as (pointer float) (-> sv-88 vector)) sv-84) + ) + (when (not sv-240) + (let ((f0-21 (- 1.0 (-> arg0 unknown-surface01 impact-fric)))) + (when (< f0-21 1.0) + (let ((v1-113 (new-stack-vector0)) + (f1-13 (vector-dot (-> arg0 dynam gravity-normal) (the-as vector (-> sv-88 vector)))) + ) + 0.0 + (vector-! + v1-113 + (the-as vector (-> sv-88 vector)) + (vector-float*! v1-113 (-> arg0 dynam gravity-normal) f1-13) + ) + (let* ((f2-2 (vector-length v1-113)) + (f3-0 f2-2) + ) + (if (< f1-13 0.0) + (set! f1-13 (* f1-13 f0-21)) + ) + (vector+! + (the-as vector (-> sv-88 vector)) + (vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f1-13) + (vector-float*! v1-113 v1-113 (/ f2-2 f3-0)) + ) + ) + ) + ) + ) + ) + ) + (set! sv-96 (logior sv-96 4)) + (cond + ((-> arg1 num-spheres) + (set! sv-96 (logior sv-96 32)) + (set! (-> arg0 unknown-vector001 quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 unknown-vector-kij1b231 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) + (process->handle (-> (the-as collide-shape-prim (-> arg1 num-spheres)) cshape process)) + ) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (set! sv-96 (logior sv-96 4096)) + ) + ) + (cond + (sv-240 + (set! sv-104 (logior sv-104 4)) + (set! sv-96 (logior sv-96 8)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector24 quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 unknown-vector-kj1hj2b3 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector25 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-pat-surface00) (-> arg1 best-other-tri pat)) + (cond + ((and (logtest? (focus-status mech) (-> (the-as process-focusable (-> arg0 process)) focus-status)) + (logtest? sv-104 #x8000) + (logtest? sv-104 32) + (< 0.0 (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (< 0.0 (vector-dot (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal))) + ) + (set! (-> arg0 surf) *edge-surface*) + (set! sv-104 (logior #x10000 sv-104)) + (vector-flatten! arg2 (vector-negate! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal)) sv-84) + (vector-normalize! arg2 (vector-dot arg2 (the-as vector (-> sv-88 vector)))) + ) + (else + (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) + ) + ) + (cond + ((and (or (and (>= (-> arg1 best-my-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + ) + (< (- (-> self clock frame-counter) (-> arg0 unknown-time-frame05)) (seconds 0.3)) + ) + (logtest? sv-104 #x8000) + ) + (>= (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + 0.0 + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) (zero? (logand sv-104 32))) + ) + (set! sv-104 (logior sv-104 256)) + (set! sv-104 (logand -65 sv-104)) + (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-4 1.0) + (vector-float*! arg2 s3-4 (vector-dot (the-as vector (-> sv-88 vector)) s3-4)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (else + ) + ) + ) + (else + (set! sv-96 (logior sv-96 1)) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-my-prim prim-id) 6) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (if (and (logtest? (focus-status board) (-> (the-as process-focusable (-> arg0 process)) focus-status)) + (not (logtest? (focus-status halfpipe) (-> (the-as process-focusable (-> arg0 process)) focus-status))) + (!= (-> arg0 cur-pat mode) 3) + (!= (-> arg0 ground-pat mode) 3) + ) + (vector-reflect-flat-gravity! arg2 (the-as vector (-> sv-88 vector)) sv-84 (-> arg0 dynam gravity-normal)) + (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) + ) + (vector+! arg2 arg2 sv-84) + (let ((f0-32 (-> arg0 unknown-surface01 slope-change-preserve))) + (when (< 0.0 f0-32) + (let ((v1-223 (new-stack-vector0))) + (let ((f1-25 (vector-dot (-> arg0 unknown-vector14) (the-as vector (-> sv-88 vector))))) + 0.0 + (vector-! v1-223 (the-as vector (-> sv-88 vector)) (vector-float*! v1-223 (-> arg0 unknown-vector14) f1-25)) + ) + (let ((f1-26 (vector-length v1-223))) + f1-26 + (let ((f1-27 f1-26) + (f2-5 (vector-length arg2)) + ) + (if (and (< 409.6 (fabs (- f2-5 f1-27))) (< f2-5 f1-27)) + (vector-normalize! arg2 (lerp-scale f2-5 f1-27 f0-32 0.0 1.0)) + ) + ) + ) + ) + ) + ) + (set! (-> arg0 grount-touch-point w) 0.0) + (when (not (logtest? sv-104 #x400f)) + (set! sv-96 (logior sv-96 2)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector22 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float0000) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 unknown-time-frame05) (-> self clock frame-counter)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 unknown-vector-kjh1n23k1 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (set! sv-104 (logior sv-104 2048)) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (set! sv-96 (logior sv-96 1024)) + ) + ) + ) + ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) + (when *debug-segment* + (+! (-> arg0 unknown-halfword00) 1) + (let ((v1-260 + (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-260 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-260 vector quad) (-> arg0 surface-normal quad)) + ) + (let ((v1-263 + (clear-record-tags! *history* (history-channel local-normal) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-263 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-263 vector quad) (-> arg0 local-normal quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 unknown-halfword00) (the-as uint 2)) + vector + quad + ) + (-> arg1 best-other-tri intersect quad) + ) + (let ((v1-269 + (clear-record-tags! *history* (history-channel transv-out) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-269 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-269 vector quad) (-> arg2 quad)) + ) + (let ((v1-272 + (clear-record-tags! *history* (history-channel transv-in) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-272 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-272 vector quad) (-> sv-88 vector 1 quad)) + ) + (let ((v1-275 (clear-record-tags! *history* (history-channel transv) (-> arg0 unknown-halfword00) (the-as uint 2))) + ) + (set! (-> v1-275 origin quad) (-> arg0 trans quad)) + (set! (-> v1-275 vector quad) (-> arg0 transv quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 unknown-halfword00) (the-as uint 2)) + vector + quad + ) + (-> arg0 trans quad) + ) + (let ((v1-281 (clear-record-tags! *history* (history-channel pat) (-> arg0 unknown-halfword00) (the-as uint 2)))) + (set! (-> v1-281 vector x) (the-as float (-> arg0 cur-pat))) + ) + (let ((v1-283 + (clear-record-tags! *history* (history-channel collide-status) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-283 collide-status) (-> arg0 status)) + (set! (-> v1-283 vector z) (the-as float (-> arg0 reaction-flag))) + ) + ) + (the-as collide-status sv-96) + ) + +(defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (if (= (-> arg0 unknown-surface00 mode) 'air) + (logior! (-> arg0 reaction-flag) (cshape-reaction-flags csrf05)) + ) + (when *debug-segment* + (+! (-> arg0 unknown-halfword00) 1) + (let ((v1-9 + (clear-record-tags! *history* (history-channel transv-out) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-9 origin quad) (-> arg0 trans quad)) + (set! (-> v1-9 vector quad) (-> arg2 quad)) + ) + (let ((v1-12 + (clear-record-tags! *history* (history-channel transv-in) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-12 origin quad) (-> arg0 trans quad)) + (set! (-> v1-12 vector quad) (-> arg3 quad)) + ) + (let ((v1-15 (clear-record-tags! *history* (history-channel transv) (-> arg0 unknown-halfword00) (the-as uint 2)))) + (set! (-> v1-15 origin quad) (-> arg0 trans quad)) + (set! (-> v1-15 vector quad) (-> arg0 transv quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 unknown-halfword00) (the-as uint 2)) + vector + quad + ) + (-> arg0 trans quad) + ) + (let ((v1-21 + (clear-record-tags! *history* (history-channel collide-status) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-21 collide-status) (logior (-> arg0 status) (collide-status no-touch))) + (set! (-> v1-21 vector z) (the-as float (-> arg0 reaction-flag))) + ) + ) + 0 + (none) + ) + +(define *collide-edge-board-spec* (new 'static 'collide-edge-spec + :split-dists (new 'static 'array float 2 1024.0 1433.6) + :outward-offset (new 'static 'vector :x 708.608 :y 13312.0 :w 1.0) + :flags (collide-edge-spec-flags find-adjacent-edge send-event) + :ignore-pat (new 'static 'pat-surface :noentity #x1 :nogrind #x1 :probe #x1) + :max-dist-sqrd-to-outward-pt 67108864.0 + :max-dir-cosa-delta -1.0 + :max-dir-cosa-player -2.0 + :touching-segment #f + :local-cache-fill-box (new 'static 'bounding-box + :min (new 'static 'vector :x -12288.0 :y -11059.2 :z -12288.0 :w 1.0) + :max (new 'static 'vector :x 12288.0 :y 16384.0 :z 12288.0 :w 1.0) + ) + :local-within-reach-box (new 'static 'bounding-box + :min (new 'static 'vector :x -11878.4 :y -2867.2 :z -11878.4 :w 1.0) + :max (new 'static 'vector :x 11878.4 :y 2867.2 :z 11878.4 :w 1.0) + ) + :local-player-spheres (new 'static 'inline-array sphere 12 + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x -737.28 :y 4096.0 :r 3072.0) + (new 'static 'sphere :x -737.28 :y 6553.6 :r 3072.0) + (new 'static 'sphere :x -737.28 :y 9420.8 :r 3072.0) + (new 'static 'sphere :x 1720.32 :y 3686.4 :r 2949.12) + (new 'static 'sphere :x 1720.32 :y 5734.4 :r 2949.12) + (new 'static 'sphere :x 1720.32 :y 8601.6 :r 2949.12) + ) + ) + ) + +(defbehavior rail-surface-touch target () + (when (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame02)) (seconds 0.2)) + (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one send-event)) + (set! (-> *collide-edge-board-spec* touching-segment) #f) + (do-edge-grabs *target* *collide-cache* *collide-edge-board-spec*) + (logior! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags send-event)) + (let ((gp-0 *edge-grab-info*)) + (when (-> gp-0 found-edge?) + (vector-normalize! + (vector-! (-> self control unknown-vector34) (the-as vector (-> gp-0 world-vertex)) (-> gp-0 world-vertex 1)) + 1.0 + ) + (set! (-> self control unknown-vector36 quad) (-> gp-0 hanging-matrix vector 0 quad)) + (send-event + self + 'push-transv + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector36) + (seek + (vector-length (-> self control unknown-vector18)) + 40960.0 + (* 81920.0 (-> self clock seconds-per-frame)) + ) + ) + 90 + ) + ) + ) + ) + 0 + (none) + ) + +(defun gravel-surface-touch () + 0 + (none) + ) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index d8ab903bb7..e78496aee1 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -15,7 +15,6 @@ (define-extern target-gun-joint-points (function none :behavior target)) (define-extern target-board-joint-points (function none :behavior target)) (define-extern debounce-speed (function float float vector vector float :behavior target)) -(define-extern target-collision-reaction (function control-info collide-query vector vector collide-status)) (define-extern ja-post (function none :behavior process-drawable)) (define-extern target-powerup-process (function none :behavior target)) (define-extern target-exit (function none :behavior target)) diff --git a/goal_src/jak2/engine/target/surface-h.gc b/goal_src/jak2/engine/target/surface-h.gc index e96972247a..f70e82d012 100644 --- a/goal_src/jak2/engine/target/surface-h.gc +++ b/goal_src/jak2/engine/target/surface-h.gc @@ -5,7 +5,8 @@ ;; name in dgo: surface-h ;; dgos: ENGINE, GAME -(define-extern rail-surface-touch (function none)) +(declare-type target process-focusable) +(define-extern rail-surface-touch (function none :behavior target)) (define-extern gravel-surface-touch (function none)) (defenum surface-flag @@ -44,55 +45,74 @@ (gun-turn-fast 28) ;; hi 4096 ) +(declare-type collide-shape trsqv) +(declare-type collide-shape-moving collide-shape) +(declare-type control-info collide-shape-moving) + +(declare-type surface basic) +(define-extern *dark-jump-mods* surface) +(define-extern *flop-land-mods* surface) +(define-extern *pole-mods* surface) +(define-extern *grab-mods* surface) +(define-extern *edge-grab-mods* surface) +(define-extern *stone-surface* surface) +(define-extern *gravel-surface* surface) +(define-extern *edge-surface* surface) +(define-extern *wade-surface* surface) +(define-extern *quicksand-surface* surface) +(define-extern *tar-surface* surface) +(define-extern *ice-surface* surface) +(define-extern *rail-surface* surface) ;; DECOMP BEGINS (deftype surface (basic) - ((name symbol :offset-assert 4) - (turnv float :offset-assert 8) - (turnvv float :offset-assert 12) - (tiltv float :offset-assert 16) - (tiltvv float :offset-assert 20) - (transv-max float :offset-assert 24) - (target-speed float :offset-assert 28) - (seek0 float :offset-assert 32) - (seek90 float :offset-assert 36) - (seek180 float :offset-assert 40) - (fric float :offset-assert 44) - (nonlin-fric-dist float :offset-assert 48) - (slip-factor float :offset-assert 52) - (slide-factor float :offset-assert 56) - (slope-up-factor float :offset-assert 60) - (slope-down-factor float :offset-assert 64) - (slope-slip-angle float :offset-assert 68) - (impact-fric float :offset-assert 72) - (bend-factor float :offset-assert 76) - (bend-speed float :offset-assert 80) - (alignv float :offset-assert 84) - (slope-up-traction float :offset-assert 88) - (align-speed float :offset-assert 92) - (slope-change-preserve float :offset-assert 96) - (turnvf float :offset-assert 100) - (turnvvf float :offset-assert 104) - (tiltvf float :offset-assert 108) - (tiltvvf float :offset-assert 112) - (vel-turn float :offset-assert 116) - (active-hook (function none) :offset 128) - (touch-hook (function none) :offset-assert 132) - (impact-hook function :offset-assert 136) - (mult-hook (function surface surface surface int none) :offset-assert 140) - (exit-hook function :offset-assert 144) - (mode symbol :offset-assert 148) - (flags surface-flag :offset-assert 152) - (data float 30 :offset 8) - (hook function 4 :offset 128) - (dataw uint32 2 :offset 148) + ((name symbol :offset-assert 4) + (turnv float :offset-assert 8) + (turnvv float :offset-assert 12) + (tiltv float :offset-assert 16) + (tiltvv float :offset-assert 20) + (transv-max float :offset-assert 24) + (target-speed float :offset-assert 28) + (seek0 float :offset-assert 32) + (seek90 float :offset-assert 36) + (seek180 float :offset-assert 40) + (fric float :offset-assert 44) + (nonlin-fric-dist float :offset-assert 48) + (slip-factor float :offset-assert 52) + (slide-factor float :offset-assert 56) + (slope-up-factor float :offset-assert 60) + (slope-down-factor float :offset-assert 64) + (slope-slip-angle float :offset-assert 68) + (impact-fric float :offset-assert 72) + (bend-factor float :offset-assert 76) + (bend-speed float :offset-assert 80) + (alignv float :offset-assert 84) + (slope-up-traction float :offset-assert 88) + (align-speed float :offset-assert 92) + (slope-change-preserve float :offset-assert 96) + (turnvf float :offset-assert 100) + (turnvvf float :offset-assert 104) + (tiltvf float :offset-assert 108) + (tiltvvf float :offset-assert 112) + (vel-turn float :offset-assert 116) + (active-hook (function none) :offset 128) + (touch-hook (function none) :offset 132) + (impact-hook (function control-info (pointer float) vector none) :offset 136) + (mult-hook (function surface surface surface int none) :offset-assert 140) + (exit-hook function :offset-assert 144) + (mode symbol :offset-assert 148) + (flags surface-flag :offset-assert 152) + (data float 30 :offset 8) + (hook function 4 :offset 128) + (dataw uint32 2 :offset 148) ) :method-count-assert 9 :size-assert #x9c :flag-assert #x90000009c ) + (defun calc-terminal-vel ((arg0 float) (arg1 float) (arg2 float)) (- (* (/ (- (* 0.016666668 arg0) arg1) arg2) (- 1.0 arg2)) arg1) ) @@ -109,7 +129,6 @@ ) ) -;; definition for method 2 of type surface ;; ERROR: Function may read a register that is not set: t3 (defmethod print surface ((obj surface)) (local-vars (t3-0 none)) @@ -177,6 +196,7 @@ arg0 ) +;; WARN: Return type mismatch float vs none. (defun surface-clamp-speed ((arg0 surface) (arg1 surface) (arg2 surface) (arg3 int)) (when (= arg3 1) (set! (-> arg0 transv-max) (fmin (-> arg0 transv-max) (-> arg1 transv-max))) @@ -571,7 +591,7 @@ (set! (-> v1-20 target-speed) 245760.0) (set! (-> v1-20 transv-max) 245760.0) (set! (-> v1-20 seek0) 0.9) - (define *dark-jump-mods* v1-20) + (set! *dark-jump-mods* v1-20) ) (define *roll-mods* (new 'static 'surface @@ -693,7 +713,7 @@ ) ) (set! (-> a0-9 mult-hook) surface-clamp-speed) - (define *flop-land-mods* a0-9) + (set! *flop-land-mods* a0-9) ) (define *wade-mods* (new 'static 'surface @@ -825,19 +845,19 @@ (let ((v1-30 (copy *walk-mods* 'global))) (set! (-> v1-30 name) 'pole) (set! (-> v1-30 flags) (surface-flag gun-hide gun-fast-exit)) - (define *pole-mods* v1-30) + (set! *pole-mods* v1-30) ) (let ((a0-14 (copy *walk-mods* 'global))) (set! (-> a0-14 name) 'grab) (set! (-> a0-14 flags) (surface-flag)) - (define *grab-mods* a0-14) + (set! *grab-mods* a0-14) ) (let ((v1-34 (copy *walk-mods* 'global))) (set! (-> v1-34 name) 'edge-grab) (set! (-> v1-34 flags) (surface-flag gun-inactive gun-no-twist)) - (define *edge-grab-mods* v1-34) + (set! *edge-grab-mods* v1-34) ) (define *empty-mods* (new 'static 'surface @@ -906,7 +926,7 @@ ) ) ) - (define *stone-surface* v1-37) + (set! *stone-surface* v1-37) (set! (-> v1-37 exit-hook) nothing) (set! (-> v1-37 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-37 touch-hook) nothing) @@ -945,7 +965,7 @@ ) ) ) - (define *gravel-surface* v1-38) + (set! *gravel-surface* v1-38) (set! (-> v1-38 exit-hook) nothing) (set! (-> v1-38 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-38 touch-hook) (lambda () (gravel-surface-touch) (none))) @@ -980,7 +1000,7 @@ ) ) ) - (define *edge-surface* v1-39) + (set! *edge-surface* v1-39) (set! (-> v1-39 exit-hook) nothing) (set! (-> v1-39 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-39 touch-hook) nothing) @@ -1017,7 +1037,7 @@ ) ) ) - (define *wade-surface* v1-40) + (set! *wade-surface* v1-40) (set! (-> v1-40 exit-hook) nothing) (set! (-> v1-40 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-40 touch-hook) nothing) @@ -1054,7 +1074,7 @@ ) ) ) - (define *quicksand-surface* v1-41) + (set! *quicksand-surface* v1-41) (set! (-> v1-41 exit-hook) nothing) (set! (-> v1-41 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-41 touch-hook) nothing) @@ -1091,7 +1111,7 @@ ) ) ) - (define *tar-surface* v1-42) + (set! *tar-surface* v1-42) (set! (-> v1-42 exit-hook) nothing) (set! (-> v1-42 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-42 touch-hook) nothing) @@ -1126,7 +1146,7 @@ ) ) ) - (define *ice-surface* v1-43) + (set! *ice-surface* v1-43) (set! (-> v1-43 exit-hook) nothing) (set! (-> v1-43 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-43 touch-hook) nothing) @@ -1165,7 +1185,7 @@ ) ) ) - (define *rail-surface* v1-44) + (set! *rail-surface* v1-44) (set! (-> v1-44 exit-hook) nothing) (set! (-> v1-44 mult-hook) (the-as (function surface surface surface int none) nothing)) (set! (-> v1-44 touch-hook) (lambda () (rail-surface-touch) (none))) @@ -1175,4 +1195,3 @@ (define *standard-ground-surface* *stone-surface*) (define *swim-surface* *stone-surface*) - diff --git a/goal_src/jak2/engine/target/target-anim.gc b/goal_src/jak2/engine/target/target-anim.gc index 1961e87830..54ecbb40ab 100644 --- a/goal_src/jak2/engine/target/target-anim.gc +++ b/goal_src/jak2/engine/target/target-anim.gc @@ -7,3 +7,1857 @@ ;; DECOMP BEGINS +(defbehavior target-land-anim target () + (cond + ((using-gun? self) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + (-> self draw art-group data 277) + ) + (else + (-> self draw art-group data 278) + ) + ) + ) + (else + (let ((v1-9 (ja-group))) + (if (or (and v1-9 (= v1-9 (-> self draw art-group data 394))) + (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + ) + (-> self draw art-group data 395) + (-> self draw art-group data 24) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior target-stance-anim target () + (let ((gp-0 22)) + (new 'stack 'ground-tween-info) + (let ((v1-4 (ja-group))) + (cond + ((and v1-4 (or (= v1-4 (-> self draw art-group data 94)) (= v1-4 (-> self draw art-group data 95)))) + (set! gp-0 45) + ) + ((let ((v1-11 (ja-group))) + (and v1-11 (= v1-11 (-> self draw art-group data 61))) + ) + ((lambda :behavior target + () + (cond + ((using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (-> self gun gun-type) + (((pickup-type eco-blue)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 285)) + 0.0 + 0 + 30 + 1.0 + 10.0 + #f + ) + ) + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 285)) + 0.0 + 0 + 30 + 1.0 + 6.0 + #f + ) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 62) :num! (seek! (ja-aframe 48.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 48.0 0))) + ) + (ja-channel-push! 1 (seconds 0.05)) + (let ((gp-2 (target-land-anim))) + (ja-no-eval :group! gp-2 + :num! (seek! (the float (+ (-> (the-as art-joint-anim gp-2) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 62) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 62)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 55.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-18 (ja-group))) + (and v1-18 + (or (= v1-18 (-> self draw art-group data 40)) + (= v1-18 (-> self draw art-group data 248)) + (= v1-18 (-> self draw art-group data 250)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control unknown-surface00) *attack-end-mods*) + (let* ((v1-3 (ja-group)) + (a1-0 (cond + ((and v1-3 (= v1-3 (-> self draw art-group data 248))) + (-> self draw art-group data 249) + ) + (else + (let ((v1-10 (ja-group))) + (cond + ((and v1-10 (= v1-10 (-> self draw art-group data 250))) + (-> self draw art-group data 251) + ) + ((rand-vu-percent? 0.3) + (-> self draw art-group data 42) + ) + (else + (-> self draw art-group data 41) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! a1-0 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-0) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (when (nonzero? (-> self gun track-target-hold-time)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (goto cfg-23) + ) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) + (label cfg-23) + (set! (-> self control unknown-surface00) *walk-mods*) + (let ((v1-57 (ja-group))) + (when (and (and v1-57 (= v1-57 (-> self draw art-group data 249))) + (and (using-gun? self) (= (-> self gun gun-type) (pickup-type eco-yellow))) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 270) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 270)) frames num-frames) -1))) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-25 (ja-group))) + (and v1-25 (= v1-25 (-> self draw art-group data 399))) + ) + (ja-no-eval :group! (-> self draw art-group data 400) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 400)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-55 (ja-group))) + (and v1-55 (= v1-55 (-> self draw art-group data 71))) + ) + (ja-no-eval :group! (-> self draw art-group data 72) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 72)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-85 (ja-group))) + (and v1-85 (= v1-85 (-> self draw art-group data 412))) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (ja-channel-push! 1 (seconds 0.07)) + (ja-no-eval :group! (-> self draw art-group data 396) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 396)) frames num-frames) -1))) + :frame-num (ja-aframe 15.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (set! gp-0 0) + ) + ((let ((v1-125 (ja-group))) + (and v1-125 + (or (= v1-125 (-> self draw art-group data 48)) + (= v1-125 (-> self draw art-group data 402)) + (= v1-125 (-> self draw art-group data 409)) + (= v1-125 (-> self draw art-group data 404)) + (= v1-125 (-> self draw art-group data 406)) + (= v1-125 (-> self draw art-group data 413)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control unknown-float29) (-> self control unknown-float28)) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let* ((v1-5 (ja-group)) + (a1-0 (cond + ((and v1-5 (= v1-5 (-> self draw art-group data 402))) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 403) + ) + ((let ((v1-14 (ja-group))) + (and v1-14 (= v1-14 (-> self draw art-group data 409))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 410) + ) + ((let ((v1-23 (ja-group))) + (and v1-23 (= v1-23 (-> self draw art-group data 404))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 405) + ) + ((let ((v1-32 (ja-group))) + (and v1-32 (= v1-32 (-> self draw art-group data 406))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 407) + ) + (else + (let ((v1-41 (ja-group))) + (cond + ((and v1-41 (= v1-41 (-> self draw art-group data 413))) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 414) + ) + ((rand-vu-percent? 0.3) + (-> self draw art-group data 50) + ) + (else + (-> self draw art-group data 49) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! a1-0 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-0) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (seek! (-> self control unknown-float29) 0.0 (-> self clock seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float29) 0.0) + (rot->dir-targ! (-> self control)) + (logclear! (-> self state-flags) (state-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) + (none) + ) + ) + ) + ((let ((v1-132 (ja-group))) + (and v1-132 (= v1-132 (-> self draw art-group data 273))) + ) + (set! (-> self control unknown-float29) (-> self control unknown-float28)) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let ((a1-18 (-> self draw art-group data 274))) + (ja-no-eval :group! a1-18 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-18) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (seek! (-> self control unknown-float29) 0.0 (-> self clock seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float29) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-166 (ja-group))) + (and v1-166 (= v1-166 (-> self draw art-group data 275))) + ) + (set! (-> self control unknown-float29) (-> self control unknown-float28)) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let ((a1-21 (-> self draw art-group data 276))) + (ja-no-eval :group! a1-21 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-21) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (seek! (-> self control unknown-float29) 0.0 (-> self clock seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float29) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-200 (ja-group))) + (and (and v1-200 (or (= v1-200 (-> self draw art-group data 277)) (= v1-200 (-> self draw art-group data 278)))) + (not (using-gun? self)) + ) + ) + (set! gp-0 60) + ) + ((let ((v1-208 (ja-group))) + (and v1-208 (or (= v1-208 (-> self draw art-group data 20)) + (= v1-208 (-> self draw art-group data 21)) + (= v1-208 (-> self draw art-group data 302)) + (= v1-208 (-> self draw art-group data 59)) + (= v1-208 (-> self draw art-group data 282)) + ) + ) + ) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! gp-0 30) + ) + (else + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 19) + :num! (seek! 0.0 1.2) + :frame-num (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 19)) frames num-frames) -1)) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! 0.0 1.2)) + ) + (set! gp-0 12) + ) + ) + ) + ((let ((v1-240 (ja-group))) + (or (and (and v1-240 (or (= v1-240 (-> self draw art-group data 12)) (= v1-240 (-> self draw art-group data 392)))) + (begin (set! gp-0 45) (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp)))) + (not (using-gun? self)) + ) + (let ((v1-253 (ja-group))) + (and v1-253 (or (= v1-253 (-> self draw art-group data 17)) + (= v1-253 (-> self draw art-group data 18)) + (= v1-253 (-> self draw art-group data 43)) + (= v1-253 (-> self draw art-group data 44)) + ) + ) + ) + ) + ) + (cond + ((and (rand-vu-percent? 0.3) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 6) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 6)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (let* ((v1-288 (ja-group)) + (f30-1 + (cond + ((and v1-288 (or (= v1-288 (-> self draw art-group data 12)) (= v1-288 (-> self draw art-group data 392)))) + (let ((f0-65 (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))))) + (- f0-65 (* (the float (the int (/ f0-65 50.0))) 50.0)) + ) + ) + (else + 0.0 + ) + ) + ) + ) + (set! gp-0 45) + (ja-channel-push! 1 (the-as time-frame gp-0)) + (ja :group! (-> self draw art-group data 4) :num! (identity (ja-aframe f30-1 0))) + ) + (dotimes (s5-1 3) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + (ja-no-eval :group! (-> self draw art-group data 3) :num! (seek! (ja-aframe 82.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 82.0 0))) + ) + (when (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (ja-aframe 142.0 0)) + :frame-num (ja-aframe 82.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 142.0 0))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1))) + :frame-num (ja-aframe 142.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ) + ((let ((v1-378 (ja-group))) + (and (and v1-378 (= v1-378 (-> self draw art-group data 12))) (>= (-> self control unknown-float05) 5734.4)) + ) + (set! gp-0 45) + ) + ) + ) + (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-stance)) + (go target-gun-stance) + ) + (let ((v1-395 (ja-group))) + (if (not (and (and v1-395 (= v1-395 (-> self draw art-group data 5))) (= (ja-group-size) 1))) + (ja-channel-push! 1 (the-as time-frame gp-0)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (ja :group! (-> self draw art-group data 396)) + (ja :group! (-> self draw art-group data 5)) + ) + (until #f + (suspend) + (ja :num! (loop!)) + (if (can-play-stance-amibent?) + (go target-stance-ambient) + ) + ) + #f + (none) + ) + +(defbehavior target-stance-push target ((arg0 int)) + (let ((v1-2 (ja-group))) + (cond + ((or (and (and v1-2 (= v1-2 (-> self draw art-group data 12))) + (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp))) + ) + (let ((v1-14 (ja-group))) + (and v1-14 + (or (= v1-14 (-> self draw art-group data 17)) + (= v1-14 (-> self draw art-group data 18)) + (= v1-14 (-> self draw art-group data 43)) + (= v1-14 (-> self draw art-group data 44)) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.15)) + (ja-no-eval :group! (-> self draw art-group data 4) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-push! arg0 (seconds 0.15)) + ) + ((let ((v1-68 (ja-group))) + (and (and v1-68 (or (= v1-68 (-> self draw art-group data 28)) + (= v1-68 (-> self draw art-group data 24)) + (= v1-68 (-> self draw art-group data 277)) + (= v1-68 (-> self draw art-group data 278)) + (= v1-68 (-> self draw art-group data 395)) + ) + ) + (not (ja-max? 0)) + ) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (ja-channel-push! arg0 (seconds 0.075)) + ) + ((let ((v1-84 (ja-group))) + (not (and (and v1-84 (= v1-84 (-> self draw art-group data 5))) (= (ja-group-size) 1))) + ) + (ja-channel-push! arg0 (seconds 0.075)) + ) + ) + ) + (none) + ) + +(defbehavior target-falling-anim target ((arg0 int) (arg1 time-frame)) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 27)) + (= v1-2 (-> self draw art-group data 51)) + (= v1-2 (-> self draw art-group data 267)) + ) + ) + ) + ((let ((v1-8 (ja-group))) + (and v1-8 (or (= v1-8 (-> self draw art-group data 33)) (= v1-8 (-> self draw art-group data 34)))) + ) + (ja-channel-push! 1 (seconds 0.15)) + (ja-no-eval :group! (-> self draw art-group data 39) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 39)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-37 (ja-group))) + (and v1-37 (= v1-37 (-> self draw art-group data 39))) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-push! 1 (seconds 0.15)) + ) + (else + (let ((v1-52 (ja-group))) + (cond + ((and v1-52 (= v1-52 (-> self draw art-group data 61))) + (let ((s5-0 (-> self clock frame-counter))) + (while (or (= arg0 -1) (< (- (-> self clock frame-counter) s5-0) arg0)) + (when (>= (- (-> self clock frame-counter) s5-0) (seconds 0.01)) + (let ((v1-62 (ja-group))) + (when (not (and v1-62 (= v1-62 (-> self draw art-group data 27)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja :group! (-> self draw art-group data 27) :num! min) + ) + ) + ) + (let ((v1-71 (new-stack-vector0)) + (f0-12 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-71 (-> self control transv) (vector-float*! v1-71 (-> self control dynam gravity-normal) f0-12)) + (let* ((f2-0 (vector-length v1-71)) + (f1-2 f2-0) + (f2-1 (* 0.9 f2-0)) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-12) + (vector-float*! v1-71 v1-71 (/ f2-1 f1-2)) + ) + ) + ) + (suspend) + (let ((v1-74 (ja-group))) + (if (and v1-74 (= v1-74 (-> self draw art-group data 27))) + (ja :num! (loop!)) + (ja :num! (seek!)) + ) + ) + ) + ) + (return #f) + ) + (else + (ja-channel-push! 1 arg1) + (ja :group! (-> self draw art-group data 27)) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (suspend) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 27) :num! (loop!) :frame-num 0.0) + (let ((s5-1 (-> self clock frame-counter))) + (while (or (= arg0 -1) (and (< (- (-> self clock frame-counter) s5-1) arg0) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + ) + (suspend) + (ja :group! (-> self draw art-group data 27) :num! (loop!)) + ) + ) + #f + ) + +(defbehavior target-falling-anim-trans target () + (let ((v1-2 (ja-group))) + (cond + ((not (and v1-2 (or (= v1-2 (-> self draw art-group data 27)) + (= v1-2 (-> self draw art-group data 24)) + (= v1-2 (-> self draw art-group data 277)) + (= v1-2 (-> self draw art-group data 278)) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! (-> self draw art-group data 27)) + ) + ((and (logtest? (-> self control status) (collide-status on-surface)) + (let ((v1-15 (ja-group))) + (and (not (and v1-15 (= v1-15 (-> self draw art-group data 24)))) + (zero? (logand (-> self control status) (collide-status on-water))) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.02)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim (target-land-anim))) + ) + ((let ((v1-23 (ja-group))) + (and v1-23 (= v1-23 (-> self draw art-group data 27))) + ) + (ja :num! (loop!)) + ) + ((let ((v1-33 (ja-group))) + (and v1-33 (or (= v1-33 (-> self draw art-group data 24)) + (= v1-33 (-> self draw art-group data 277)) + (= v1-33 (-> self draw art-group data 278)) + ) + ) + ) + (ja :num! (seek!)) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defbehavior target-walk-anim target ((arg0 int)) + (local-vars (sv-16 float)) + (let ((f24-0 0.0) + (f26-0 (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control unknown-float05)))))) + (f30-0 0.0) + (f28-0 0.0) + (s5-0 #f) + ) + (let ((v1-6 (ja-group))) + (cond + ((and v1-6 (= v1-6 (-> self draw art-group data 22))) + (set! f26-0 1.0) + (ja-channel-push! 7 (seconds 0.05)) + ) + ((let ((v1-12 (ja-group))) + (and v1-12 (or (= v1-12 (-> self draw art-group data 59)) (= v1-12 (-> self draw art-group data 282)))) + ) + (ja-channel-push! 7 (seconds 0.075)) + (set! f26-0 1.0) + ) + ((let ((v1-19 (ja-group))) + (and v1-19 (= v1-19 (-> self draw art-group data 40))) + ) + ((lambda :behavior target + () + (let ((f30-0 (fmax 0.8 (fmin 1.0 (* 0.000048828126 (-> self control unknown-float05)))))) + (cond + ((and (rand-vu-percent? 0.3) (< 20480.0 (-> self control unknown-float05))) + (ja-no-eval :group! (-> self draw art-group data 42) :num! (seek! (ja-aframe 29.0 0) f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 29.0 0) f30-0)) + ) + (ja-no-eval :group! (-> self draw art-group data 44) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 44)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 41) :num! (seek! (ja-aframe 29.0 0) f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 29.0 0) f30-0)) + ) + (ja-no-eval :group! (-> self draw art-group data 43) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 43)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + (ja-channel-push! 7 (seconds 0.05)) + (none) + ) + ) + (set! f26-0 1.0) + (set! f24-0 30.0) + ) + ((let ((v1-27 (ja-group))) + (and v1-27 (or (= v1-27 (-> self draw art-group data 408)) (= v1-27 (-> self draw art-group data 411)))) + ) + (set! f26-0 1.0) + (ja-channel-push! 7 (seconds 0.3)) + ) + ((let ((v1-33 (ja-group))) + (and v1-33 (or (= v1-33 (-> self draw art-group data 48)) + (= v1-33 (-> self draw art-group data 49)) + (= v1-33 (-> self draw art-group data 273)) + (= v1-33 (-> self draw art-group data 275)) + (= v1-33 (-> self draw art-group data 403)) + (= v1-33 (-> self draw art-group data 410)) + (= v1-33 (-> self draw art-group data 405)) + (= v1-33 (-> self draw art-group data 407)) + (= v1-33 (-> self draw art-group data 414)) + ) + ) + ) + (set! f26-0 1.0) + (set! f24-0 30.0) + (ja-channel-push! 7 (seconds 0.15)) + ) + ((let ((v1-40 (ja-group))) + (and (and v1-40 (or (= v1-40 (-> self draw art-group data 12)) + (= v1-40 (-> self draw art-group data 261)) + (= v1-40 (-> self draw art-group data 392)) + ) + ) + (= (ja-group-size) 7) + ) + ) + (set! f24-0 (ja-aframe-num 0)) + (set! f26-0 (-> self control unknown-float002)) + (set! f30-0 (-> self control unknown-float-n12iuh3n1)) + (set! f28-0 (-> self control unknown-float-ki1jhbn23hj)) + ) + ((let ((v1-50 (ja-group))) + (and v1-50 (= v1-50 (-> self draw art-group data 108))) + ) + (set! f24-0 (ja-aframe-num 0)) + (ja-channel-push! 7 (seconds 0.1)) + ) + ((let ((v1-55 (ja-group))) + (and v1-55 (= v1-55 (-> self draw art-group data 94))) + ) + (set! f24-0 (ja-aframe-num 0)) + (ja-channel-push! 7 (seconds 0.05)) + ) + ((let ((v1-60 (ja-group))) + (and (or (and v1-60 + (or (= v1-60 (-> self draw art-group data 27)) + (= v1-60 (-> self draw art-group data 61)) + (= v1-60 (-> self draw art-group data 47)) + (= v1-60 (-> self draw art-group data 51)) + (= v1-60 (-> self draw art-group data 267)) + (= v1-60 (-> self draw art-group data 54)) + ) + ) + (let ((v1-66 (ja-group))) + (and (and v1-66 (or (= v1-66 (-> self draw art-group data 23)) (= v1-66 (-> self draw art-group data 394)))) + (< 30.0 (ja-aframe-num 0)) + ) + ) + ) + (< 12288.0 (-> self control unknown-float05)) + ) + ) + ((lambda :behavior target + () + (let ((gp-0 (ja-group)) + (f30-0 (-> self control ground-impact-vel)) + ) + (let ((v1-7 (ja-group))) + (if (and v1-7 (or (= v1-7 (-> self draw art-group data 61)) (= v1-7 (-> self draw art-group data 47)))) + (ja-channel-push! 1 (seconds 0.05)) + (ja-channel-set! 1) + ) + ) + (cond + ((< (if (= gp-0 (-> self draw art-group data 23)) + 77824.0 + 102400.0 + ) + f30-0 + ) + (ja-no-eval :group! (-> self draw art-group data 17) :num! (seek! (ja-aframe 3.0 0) 1.00001) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 1.00001)) + ) + ) + ((< (if (= gp-0 (-> self draw art-group data 23)) + 61440.0 + 102400.0 + ) + f30-0 + ) + (ja-no-eval :group! (-> self draw art-group data 17) + :num! (seek! (ja-aframe 3.0 0) 1.00001) + :frame-num (ja-aframe -1.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 1.00001)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 18) :num! (seek! (ja-aframe 4.0 0) 1.00001) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 4.0 0) 1.00001)) + ) + ) + ) + ) + (when (using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (-> self gun gun-type) + (((pickup-type eco-blue)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 262)) + 16.0 + 90 + 60 + 1.0 + 0.0 + #f + ) + ) + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 299)) + 16.0 + 90 + 60 + 1.0 + 0.0 + #f + ) + ) + ) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (/ (* (fmax 20480.0 (-> self control unknown-float05)) (-> self clock seconds-per-frame)) + (/ (-> *TARGET-bank* run-up-cycle-dist) (-> *TARGET-bank* run-cycle-length)) + ) + ) + ) + ) + (ja-channel-push! 7 (seconds 0.1)) + (none) + ) + ) + (set! f24-0 30.0) + (set! f26-0 1.0) + ) + ((let ((v1-78 (ja-group))) + (and v1-78 (or (= v1-78 (-> self draw art-group data 23)) (= v1-78 (-> self draw art-group data 394)))) + ) + (ja-channel-push! 7 (seconds 0.05)) + (set! s5-0 #t) + ) + (else + (let ((v1-84 (ja-group))) + (cond + ((and v1-84 (= v1-84 (-> self draw art-group data 71))) + (ja-channel-push! 7 (seconds 0.15)) + ) + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! f24-0 55.0) + (ja-channel-push! 7 (seconds 0.1)) + ) + (else + (ja-channel-push! 7 (seconds 0.05)) + ) + ) + ) + ) + ) + ) + (set! (-> self skel root-channel 3 command) (joint-control-command push)) + (set! (-> self skel root-channel 6 command) (joint-control-command stack)) + (ja :group! (-> self draw art-group data 12)) + (let ((f24-1 (ja-aframe f24-0 0))) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (let ((s4-0 (-> self skel root-channel 0))) + (let ((f0-3 0.0)) + (set! (-> s4-0 frame-interp 1) f0-3) + (set! (-> s4-0 frame-interp 0) f0-3) + ) + (set! (-> s4-0 dist) 12288.0) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 392)) + num-func-identity + ) + (set! (-> s4-0 frame-num) f24-1) + ) + ) + ((and (using-gun? self) + (or (= (-> self gun gun-type) (pickup-type eco-yellow)) (= (-> self gun gun-type) (pickup-type eco-blue))) + ) + (let ((s4-1 (-> self skel root-channel 0))) + (let ((f0-5 0.0)) + (set! (-> s4-1 frame-interp 1) f0-5) + (set! (-> s4-1 frame-interp 0) f0-5) + ) + (set! (-> s4-1 dist) 12288.0) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> self draw art-group data 261)) + num-func-identity + ) + (set! (-> s4-1 frame-num) f24-1) + ) + ) + (else + (let ((s4-2 (-> self skel root-channel 0))) + (let ((f0-7 0.0)) + (set! (-> s4-2 frame-interp 1) f0-7) + (set! (-> s4-2 frame-interp 0) f0-7) + ) + (set! (-> s4-2 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + s4-2 + (the-as art-joint-anim (-> self draw art-group data 12)) + num-func-identity + ) + (set! (-> s4-2 frame-num) f24-1) + ) + ) + ) + (let ((s4-3 (-> self skel root-channel 1))) + (let ((f0-9 0.0)) + (set! (-> s4-3 frame-interp 1) f0-9) + (set! (-> s4-3 frame-interp 0) f0-9) + ) + (set! (-> s4-3 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + s4-3 + (the-as art-joint-anim (-> self draw art-group data 14)) + num-func-identity + ) + (set! (-> s4-3 frame-num) f24-1) + ) + (let ((s4-4 (-> self skel root-channel 2))) + (let ((f0-11 0.0)) + (set! (-> s4-4 frame-interp 1) f0-11) + (set! (-> s4-4 frame-interp 0) f0-11) + ) + (set! (-> s4-4 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + s4-4 + (the-as art-joint-anim (-> self draw art-group data 16)) + num-func-identity + ) + (set! (-> s4-4 frame-num) f24-1) + ) + (let ((s4-5 (-> self skel root-channel 4))) + (let ((f0-13 0.0)) + (set! (-> s4-5 frame-interp 1) f0-13) + (set! (-> s4-5 frame-interp 0) f0-13) + ) + (set! (-> s4-5 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (joint-control-channel-group-eval! + s4-5 + (the-as art-joint-anim (-> self draw art-group data 9)) + num-func-identity + ) + (set! (-> s4-5 frame-num) f24-1) + ) + (let ((s4-6 (-> self skel root-channel 5))) + (let ((f0-15 0.0)) + (set! (-> s4-6 frame-interp 1) f0-15) + (set! (-> s4-6 frame-interp 0) f0-15) + ) + (set! (-> s4-6 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (joint-control-channel-group-eval! + s4-6 + (the-as art-joint-anim (-> self draw art-group data 11)) + num-func-identity + ) + (set! (-> s4-6 frame-num) f24-1) + ) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (let ((s4-7 (-> self skel root-channel 3))) + (let ((f0-17 0.0)) + (set! (-> s4-7 frame-interp 1) f0-17) + (set! (-> s4-7 frame-interp 0) f0-17) + ) + (set! (-> s4-7 dist) 27033.6) + (joint-control-channel-group-eval! + s4-7 + (the-as art-joint-anim (-> self draw art-group data 393)) + num-func-identity + ) + (set! (-> s4-7 frame-num) f24-1) + ) + ) + ((using-gun? self) + (let ((s4-8 (-> self skel root-channel 3))) + (let ((f0-19 0.0)) + (set! (-> s4-8 frame-interp 1) f0-19) + (set! (-> s4-8 frame-interp 0) f0-19) + ) + (set! (-> s4-8 dist) (-> *TARGET-bank* run-cycle-dist)) + (joint-control-channel-group-eval! + s4-8 + (the-as art-joint-anim (-> self draw art-group data 299)) + num-func-identity + ) + (set! (-> s4-8 frame-num) f24-1) + ) + ) + (else + (let ((s4-9 (-> self skel root-channel 3))) + (let ((f0-21 0.0)) + (set! (-> s4-9 frame-interp 1) f0-21) + (set! (-> s4-9 frame-interp 0) f0-21) + ) + (set! (-> s4-9 dist) (-> *TARGET-bank* run-cycle-dist)) + (joint-control-channel-group-eval! + s4-9 + (the-as art-joint-anim (-> self draw art-group data 7)) + num-func-identity + ) + (set! (-> s4-9 frame-num) f24-1) + ) + ) + ) + ) + (let ((s4-10 (-> self clock frame-counter)) + (f24-2 + (if (and (using-gun? self) + (or (= (-> self gun gun-type) (pickup-type eco-yellow)) (= (-> self gun gun-type) (pickup-type eco-blue))) + ) + 0.0 + 1.0 + ) + ) + ) + (until (and (>= arg0 0) (>= (- (-> self clock frame-counter) s4-10) arg0)) + (let ((f20-0 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control unknown-float17))))) + (f22-1 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control unknown-float18))))) + ) + (set! sv-16 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control))))) + (set! f26-0 (seek + f26-0 + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control unknown-float05))))) + (* 2.0 (-> self clock seconds-per-frame)) + ) + ) + (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! f26-0 (seek + f26-0 + (lerp-scale f26-0 (* 0.7 f26-0) sv-16 1820.4445 3640.889) + (* 2.0 (-> self clock seconds-per-frame)) + ) + ) + ) + (cond + ((< 0.5 f26-0) + (let ((v1-206 (-> self skel effect))) + (set! (-> v1-206 channel-offset) 3) + ) + 0 + (logclear! (-> self state-flags) (state-flags lleg-no-ik rleg-no-ik)) + ) + (else + (let ((v1-211 (-> self skel effect))) + (set! (-> v1-211 channel-offset) 0) + ) + 0 + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + ) + ) + (let ((f0-37 (fabs (- f20-0 f30-0)))) + (set! f30-0 (seek f30-0 f20-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-37))))) + ) + (let ((f0-42 (fabs (- f22-1 f28-0)))) + (set! f28-0 (seek f28-0 f22-1 (fmax 0.05 (fmin 0.2 (* 0.25 f0-42))))) + ) + ) + (set! (-> self control unknown-float-n12iuh3n1) f30-0) + (set! (-> self control unknown-float-ki1jhbn23hj) f28-0) + (set! (-> self control unknown-float002) f26-0) + (cond + ((>= f30-0 0.0) + (let ((v1-228 (-> self skel root-channel 1))) + (let ((f0-48 (* (fabs f30-0) f24-2))) + (set! (-> v1-228 frame-interp 1) f0-48) + (set! (-> v1-228 frame-interp 0) f0-48) + ) + (set! (-> v1-228 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! (-> v1-228 frame-group) (the-as art-joint-anim (-> self draw art-group data 13))) + ) + (let ((v1-231 (-> self skel root-channel 4))) + (let ((f0-50 (fabs f30-0))) + (set! (-> v1-231 frame-interp 1) f0-50) + (set! (-> v1-231 frame-interp 0) f0-50) + ) + (set! (-> v1-231 dist) (-> *TARGET-bank* run-up-cycle-dist)) + (set! (-> v1-231 frame-group) (the-as art-joint-anim (-> self draw art-group data 8))) + ) + ) + (else + (let ((v1-234 (-> self skel root-channel 1))) + (let ((f0-53 (* (fabs f30-0) f24-2))) + (set! (-> v1-234 frame-interp 1) f0-53) + (set! (-> v1-234 frame-interp 0) f0-53) + ) + (set! (-> v1-234 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! (-> v1-234 frame-group) (the-as art-joint-anim (-> self draw art-group data 14))) + ) + (let ((v1-237 (-> self skel root-channel 4))) + (let ((f0-55 (fabs f30-0))) + (set! (-> v1-237 frame-interp 1) f0-55) + (set! (-> v1-237 frame-interp 0) f0-55) + ) + (set! (-> v1-237 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (set! (-> v1-237 frame-group) (the-as art-joint-anim (-> self draw art-group data 9))) + ) + ) + ) + (cond + ((>= f28-0 0.0) + (let ((v1-240 (-> self skel root-channel 2))) + (let ((f0-59 (* (fabs f28-0) f24-2))) + (set! (-> v1-240 frame-interp 1) f0-59) + (set! (-> v1-240 frame-interp 0) f0-59) + ) + (set! (-> v1-240 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-240 frame-group) (the-as art-joint-anim (-> self draw art-group data 15))) + ) + (let ((v1-243 (-> self skel root-channel 5))) + (let ((f0-61 (fabs f28-0))) + (set! (-> v1-243 frame-interp 1) f0-61) + (set! (-> v1-243 frame-interp 0) f0-61) + ) + (set! (-> v1-243 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! (-> v1-243 frame-group) (the-as art-joint-anim (-> self draw art-group data 10))) + ) + ) + (else + (let ((v1-246 (-> self skel root-channel 2))) + (let ((f0-64 (* (fabs f28-0) f24-2))) + (set! (-> v1-246 frame-interp 1) f0-64) + (set! (-> v1-246 frame-interp 0) f0-64) + ) + (set! (-> v1-246 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-246 frame-group) (the-as art-joint-anim (-> self draw art-group data 16))) + ) + (let ((v1-249 (-> self skel root-channel 5))) + (let ((f0-66 (fabs f28-0))) + (set! (-> v1-249 frame-interp 1) f0-66) + (set! (-> v1-249 frame-interp 0) f0-66) + ) + (set! (-> v1-249 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! (-> v1-249 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + ) + ) + ) + (let ((v1-252 (-> self skel root-channel 6))) + (set! (-> v1-252 frame-interp 1) f26-0) + (set! (-> v1-252 frame-interp 0) f26-0) + ) + (let* ((f1-14 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) + (f0-70 (/ (-> self control unknown-float05) (* 60.0 (/ f1-14 (-> *TARGET-bank* run-cycle-length))))) + ) + (ja :num! (loop! f0-70)) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + (ja :chan 3 :num! (chan 0)) + (ja :chan 4 :num! (chan 0)) + (ja :chan 5 :num! (chan 0)) + (if (and s5-0 (!= (-> self skel root-channel 0) (-> self skel channel))) + (ja-blend-eval) + ) + (suspend) + ) + ) + ) + (none) + ) + +(defbehavior target-hit-ground-flop-anim target ((arg0 symbol) (arg1 symbol)) + (let ((f30-0 (if (= arg0 'swim) + 0.4 + 1.0 + ) + ) + ) + (if (using-gun? self) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 288)) + 0.0 + 0 + 30 + 1.0 + 0.0 + #f + ) + ) + (ja-channel-set! 1) + (let ((s5-0 (-> self skel root-channel 0))) + (set! (-> s5-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 54))) + (set! (-> s5-0 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 54)) frames num-frames) -1)) + ) + (let ((f30-1 (seek f30-0 1.0 (* 0.5 (-> self clock seconds-per-frame))))) + (set! (-> s5-0 param 1) f30-1) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! s5-0 (the-as art-joint-anim (-> self draw art-group data 54)) num-func-seek!) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! + (-> self align) + (if arg1 + (align-opts adjust-y-vel) + (align-opts adjust-y-vel adjust-xz-vel) + ) + 1.0 + 1.0 + 1.5 + ) + (when (and (>= 25.0 (ja-aframe-num 0)) + (and (>= (ja-aframe-num 0) 21.0) + (and (-> self next-state) (= (-> self next-state name) 'target-flop-hit-ground)) + (!= (-> self tobot?) 'tobot) + (!= (-> self control unknown-spool-anim00) 'stuck) + ) + ) + (when (and (cpad-hold? (-> self control cpad number) x) (can-jump? #f) (!= (-> self control ground-pat event) 7)) + (let ((v1-55 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-55 (-> self control transv) (vector-float*! v1-55 (-> self control dynam gravity-normal) f0-8)) + ) + (let* ((f0-9 (vector-length v1-55)) + (f1-3 f0-9) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-55 v1-55 (/ f0-9 f1-3)) + ) + ) + ) + (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.4))) + (if (using-gun? self) + (go + target-high-jump + (-> *TARGET-bank* flop-jump-height-min) + (-> *TARGET-bank* flop-jump-height-max) + (if arg1 + 'flop + 'flop-forward + ) + ) + (go + target-duck-high-jump + (-> *TARGET-bank* flop-jump-height-min) + (-> *TARGET-bank* flop-jump-height-max) + (if arg1 + 'flop + 'flop-forward + ) + ) + ) + ) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (the float (+ (-> s5-1 frame-group frames num-frames) -1))) + (set! f30-1 (seek f30-1 1.0 (* 0.5 (-> self clock seconds-per-frame)))) + (set! (-> s5-1 param 1) f30-1) + (joint-control-channel-group-eval! s5-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior target-hit-ground-anim target ((arg0 symbol) (arg1 symbol)) + (cond + ((logtest? (water-flags swimming) (-> self water flags)) + ) + ((let ((v1-5 (ja-group))) + (and v1-5 (or (= v1-5 (-> self draw art-group data 52)) + (= v1-5 (-> self draw art-group data 53)) + (= v1-5 (-> self draw art-group data 55)) + (= v1-5 (-> self draw art-group data 56)) + ) + ) + ) + (target-hit-ground-flop-anim arg0 arg1) + ) + ((and (= (-> self control ground-pat material) (pat-material ice)) + (< 16384.0 (-> self control unknown-float05)) + ) + ) + ((let ((v1-20 (ja-group))) + (or (and v1-20 (or (= v1-20 (-> self draw art-group data 27)) + (= v1-20 (-> self draw art-group data 394)) + (= v1-20 (-> self draw art-group data 58)) + ) + ) + (let ((v1-26 (ja-group))) + (and (and v1-26 (= v1-26 (-> self draw art-group data 23))) + (or (>= (ja-aframe-num 0) 38.0) + (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + ) + ) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.02)) + (let ((a1-4 (target-land-anim))) + (ja-no-eval :group! a1-4 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-4) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (let ((v1-46 (ja-group))) + (if (or (and (and v1-46 (or (= v1-46 (-> self draw art-group data 277)) (= v1-46 (-> self draw art-group data 278)))) + (not (using-gun? self)) + ) + (let ((v1-53 (ja-group))) + (and (and v1-53 (= v1-53 (-> self draw art-group data 24))) + (and (>= (ja-aframe-num 0) 60.0) (using-gun? self)) + ) + ) + ) + (goto cfg-78) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + (label cfg-78) + ) + ((let ((v1-70 (ja-group))) + (and (and v1-70 (or (= v1-70 (-> self draw art-group data 23)) (= v1-70 (-> self draw art-group data 394)))) + (>= (ja-aframe-num 0) 35.0) + (not (using-gun? self)) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-set! 1) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 50.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-128 (ja-group))) + (and v1-128 + (or (= v1-128 (-> self draw art-group data 23)) + (= v1-128 (-> self draw art-group data 30)) + (= v1-128 (-> self draw art-group data 394)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-set! 1) + (cond + ((using-gun? self) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (ja-aframe 41.0 0)) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 41.0 0))) + ) + (ja-no-eval :num! (seek! 0.0)) + (ja-channel-push! 1 (seconds 0.1)) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + (ja-no-eval :group! (-> self draw art-group data 277) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 277)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (if (not (using-gun? self)) + (goto cfg-19) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 278) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 278)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (if (not (using-gun? self)) + (goto cfg-19) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (label cfg-19) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) frames num-frames) -1))) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 50.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-134 (ja-group))) + (and v1-134 + (or (= v1-134 (-> self draw art-group data 66)) + (= v1-134 (-> self draw art-group data 65)) + (= v1-134 (-> self draw art-group data 67)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (let* ((v1-142 (ja-group)) + (f30-0 (if (and v1-142 (= v1-142 (-> self draw art-group data 67))) + 24576.0 + -24576.0 + ) + ) + ) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) frames num-frames) -1))) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (set-forward-vel f30-0) + (suspend) + (ja :num! (seek!)) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 50.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-195 (ja-group))) + (and v1-195 + (or (= v1-195 (-> self draw art-group data 23)) + (= v1-195 (-> self draw art-group data 394)) + (= v1-195 (-> self draw art-group data 45)) + (= v1-195 (-> self draw art-group data 46)) + (= v1-195 (-> self draw art-group data 47)) + (= v1-195 (-> self draw art-group data 54)) + (= v1-195 (-> self draw art-group data 51)) + (= v1-195 (-> self draw art-group data 267)) + (= v1-195 (-> self draw art-group data 279)) + (= v1-195 (-> self draw art-group data 171)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.04)) + (cond + ((using-gun? self) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (ja-aframe 41.0 0)) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 41.0 0))) + ) + (ja-no-eval :num! (seek! 0.0)) + (ja-channel-push! 1 (seconds 0.1)) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + (ja-no-eval :group! (-> self draw art-group data 277) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 277)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 278) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 278)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (ja-no-eval :group! (-> self draw art-group data 395) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 395)) frames num-frames) -1))) + :frame-num (ja-aframe 42.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 42.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-201 (ja-group))) + (and v1-201 (or (= v1-201 (-> self draw art-group data 321)) (= v1-201 (-> self draw art-group data 322)))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 323) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 323)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-232 (ja-group))) + (and v1-232 (or (= v1-232 (-> self draw art-group data 24)) + (= v1-232 (-> self draw art-group data 277)) + (= v1-232 (-> self draw art-group data 278)) + (= v1-232 (-> self draw art-group data 323)) + (= v1-232 (-> self draw art-group data 331)) + (= v1-232 (-> self draw art-group data 342)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-248 (ja-group))) + (and v1-248 + (or (= v1-248 (-> self draw art-group data 328)) + (= v1-248 (-> self draw art-group data 330)) + (= v1-248 (-> self draw art-group data 348)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.017)) + (ja-no-eval :group! (-> self draw art-group data 331) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 331)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-279 (ja-group))) + (and v1-279 (or (= v1-279 (-> self draw art-group data 340)) (= v1-279 (-> self draw art-group data 341)))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (let ((v1-286 (ja-group))) + (if (and v1-286 (= v1-286 (-> self draw art-group data 341))) + (ja-channel-set! 1) + (ja-channel-push! 1 (seconds 0.04)) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 342) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 342)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defbehavior target-attack-air-anim target () + (when (using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 248)) + 0.0 + 30 + 30 + 0.6 + 0.0 + #f + ) + ) + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 248)) + 3.0 + 30 + 30 + 0.5 + 0.0 + #f + ) + ) + ) + ) + (set! (-> self control unknown-float41) 0.0) + (set! (-> self control unknown-float42) 0.0) + (ja-channel-push! 1 (seconds 0.075)) + (set! (-> self control unknown-sound-id01) (sound-play "spin-kick")) + (ja-no-eval :group! (-> self draw art-group data 45) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 45)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-sound-id01) (sound-play "spin-kick")) + (ja :group! (-> self draw art-group data 46) :num! min) + (let ((f30-0 -393216.0)) + (let ((f0-11 (target-height-above-ground)) + (f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + (while (not (or (and (< (fabs (/ f0-11 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.7)) + ) + ) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (* f30-0 (-> self clock seconds-per-frame)) + ) + (suspend) + (ja :num! (loop!)) + (set! f0-11 (target-height-above-ground)) + (set! f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 47) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 47)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (cond + ((< (ja-aframe-num 0) 32.0) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (* f30-0 (-> self clock seconds-per-frame)) + ) + ) + (else + (let ((f0-25 + (deg-diff + (quaternion-y-angle (-> self control quat-for-control)) + (quaternion-y-angle (-> self control dir-targ)) + ) + ) + ) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (* -0.2 (fabs f0-25)) + ) + ) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior target-edge-grab-anim target () + (ja-channel-push! 1 (seconds 0.15)) + (ja :group! (-> self draw art-group data 35) :num! min) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-set! 1) + (until #f + (ja-no-eval :group! (-> self draw art-group data 33) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 33)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (can-play-stance-amibent?) + (suspend) + (ja :num! (seek!)) + ) + (+! (-> self anim-seed) 1) + (ja-no-eval :group! (-> self draw art-group data 34) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 34)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (can-play-stance-amibent?) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) diff --git a/goal_src/jak2/engine/target/target-carry.gc b/goal_src/jak2/engine/target/target-carry.gc index 5c54778867..835491085c 100644 --- a/goal_src/jak2/engine/target/target-carry.gc +++ b/goal_src/jak2/engine/target/target-carry.gc @@ -658,12 +658,7 @@ (none) ) :code (behavior ((arg0 symbol)) - (let ((gp-0 target-hit-ground-anim) - (s5-0 #f) - ) - (are-still?) - (gp-0 s5-0) - ) + (target-hit-ground-anim #f (are-still?)) (go target-carry-stance) (none) ) diff --git a/goal_src/jak2/engine/target/target-h.gc b/goal_src/jak2/engine/target/target-h.gc index a0cbe676fb..39bd7c8b0d 100644 --- a/goal_src/jak2/engine/target/target-h.gc +++ b/goal_src/jak2/engine/target/target-h.gc @@ -79,7 +79,7 @@ (define-extern target-wade-walk (state target)) (define-extern target-hit-ground-hard (state float target)) (define-extern target-land-effect (function none :behavior target)) -(define-extern target-hit-ground-anim (function symbol symbol :behavior target)) +(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)) @@ -139,6 +139,9 @@ (define-extern target-pos (function int vector)) (define-extern stop (function symbol int)) +;; target-anim +(define-extern target-stance-ambient (state target)) + ;; og:ignore-form:(new 'static 'boxed-array ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/target/target.gc b/goal_src/jak2/engine/target/target.gc index fb24df6200..82fce2405c 100644 --- a/goal_src/jak2/engine/target/target.gc +++ b/goal_src/jak2/engine/target/target.gc @@ -2006,12 +2006,7 @@ (none) ) :code (behavior ((arg0 symbol)) - (let ((gp-0 target-hit-ground-anim) - (s5-0 #f) - ) - (are-still?) - (gp-0 s5-0) - ) + (target-hit-ground-anim #f (are-still?)) (go target-stance) (none) ) @@ -3780,12 +3775,7 @@ (none) ) :code (behavior ((arg0 symbol)) - (let ((gp-0 target-hit-ground-anim) - (s5-0 arg0) - ) - (are-still?) - (gp-0 s5-0) - ) + (target-hit-ground-anim arg0 (are-still?)) (go target-falling #f) (none) ) diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index c889310100..d5067c0a7f 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -1162,7 +1162,7 @@ ) ;; definition for method 9 of type cspace -(defmethod reset-and-assign-geo! cspace ((obj cspace) (arg0 basic)) +(defmethod reset-and-assign-geo! cspace ((obj cspace) (arg0 drawable)) (set! (-> obj parent) #f) (set! (-> obj joint) #f) (set! (-> obj geo) arg0) @@ -1173,7 +1173,7 @@ ) ;; definition for method 0 of type cspace -(defmethod new cspace ((allocation symbol) (type-to-make type) (arg0 basic)) +(defmethod new cspace ((allocation symbol) (type-to-make type) (arg0 drawable)) (let ((t9-0 (method-of-type structure new)) (v1-1 type-to-make) ) diff --git a/test/decompiler/reference/jak2/engine/anim/mspace-h_REF.gc b/test/decompiler/reference/jak2/engine/anim/mspace-h_REF.gc index b5bc169e5c..6c1f8807cd 100644 --- a/test/decompiler/reference/jak2/engine/anim/mspace-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/mspace-h_REF.gc @@ -111,7 +111,7 @@ ((parent cspace :offset-assert 0) (joint joint :offset-assert 4) (joint-num int16 :offset-assert 8) - (geo basic :offset-assert 12) + (geo drawable :offset-assert 12) (bone bone :offset-assert 16) (param0 (function cspace matrix none) :offset-assert 20) (param1 basic :offset-assert 24) @@ -121,8 +121,8 @@ :size-assert #x20 :flag-assert #xa00000020 (:methods - (new (symbol type basic) _type_ 0) - (reset-and-assign-geo! (_type_ basic) _type_ 9) + (new (symbol type drawable) _type_ 0) + (reset-and-assign-geo! (_type_ drawable) _type_ 9) ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc index 40021a4150..25c973de89 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-h_REF.gc @@ -26,7 +26,7 @@ (num-spheres uint32 :offset 116) (solid-only symbol :offset 120) (best-dist float :offset 112) - (best-other-prim basic :offset 116) + (best-other-prim collide-shape-prim :offset 116) (best-my-prim collide-shape-prim :offset 120) (move-vec vector :inline :offset 224) (best-u float :offset 112) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc index 7fc057460f..14cd3c04b6 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape-h_REF.gc @@ -1617,7 +1617,7 @@ (:methods (new (symbol type process-drawable collide-list-enum) _type_ 0) (find-ground (_type_ collide-query collide-spec float float float) symbol 55) - (react-to-pat! (_type_ pat-surface) none 56) + (react-to-pat! (_type_ pat-surface) int 56) (integrate-no-collide! (_type_ vector) none 57) (integrate-for-enemy-no-mtg (_type_ vector overlaps-others-params) symbol 58) (move-above-ground (_type_ vector move-above-ground-params) none 59) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc index c8ab2703a5..74edb6217f 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc @@ -790,7 +790,6 @@ ) ;; definition for method 56 of type collide-shape-moving -;; WARN: Return type mismatch int vs none. (defmethod react-to-pat! collide-shape-moving ((obj collide-shape-moving) (arg0 pat-surface)) (with-pp (let ((s5-0 0)) @@ -933,8 +932,8 @@ ) ) ) + s5-0 ) - (none) ) ) @@ -3124,7 +3123,3 @@ ) (the-as vector 0) ) - - - - 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 ba497a431f..a9b31dc18b 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 @@ -72,6 +72,8 @@ (unknown-float16 float :offset 4548) (unknown-vector22 vector :inline :offset 4560) (last-trans-on-surf vector :inline :offset 4576) + (unknown-vector-kjh1n23k1 vector :inline :offset 4592) + (unknown-vector-kj1n231 vector :inline :offset 4608) (unknown-time-frame05 time-frame :offset 4624) (unknown-float0000 float :offset 4632) (unknown-float17 float :offset 4636) @@ -83,8 +85,10 @@ (unknown-time-frame07 time-frame :offset 4672) (unknown-pat-surface00 pat-surface :offset 4680) (unknown-vector24 vector :inline :offset 4688) + (unknown-vector-kj1hj2b3 vector :inline :offset 4704) (unknown-vector25 vector :inline :offset 4720) (unknown-vector001 vector :inline :offset 4736) + (unknown-vector-kij1b231 vector :inline :offset 4752) (unknown-handle00 handle :offset 4768) (unknown-pat-surface01 pat-surface :offset 4776) (unknown-float22 float :offset 4780) @@ -94,12 +98,23 @@ (unknown-float26 float :offset 4796) (unknown-word000 int32 :offset 4800) (unknown-float002 float :offset 4804) + (unknown-float-n12iuh3n1 float :offset 4808) + (unknown-float-ki1jhbn23hj float :offset 4812) (unknown-time-frame08 time-frame :offset 4816) + (unknown-float-kj1n23j float :offset 4828) + (unknown-float-n234n23 float :offset 4832) + (unknown-float-m32j45nhn float :offset 4836) + (unknown-float-kj1n23k1 float :offset 4824) + (unknown-vector-l1jn23j vector :inline :offset 4848) + (unknown-vector-kj1n23k vector :inline :offset 4864) + (unknown-vector-kjh1n23kj1n23 vector :inline :offset 4912) (unknown-vector26 vector :inline :offset 4928) + (unknown-vector-lkjk12nj3n vector :inline :offset 4944) (btransv vector :inline :offset 4976) (blocked-factor float :offset 4992) (blocked-in-air-factor float :offset 4996) (unknown-time-frame09 time-frame :offset 5000) + (unknown-time-frame-kjh1n23hkjn time-frame :offset 5008) (unknown-sphere-array00 collide-shape-prim-sphere 10 :offset 5016) (unknown-word02 int32 :offset 5064) (unknown-time-frame10 time-frame :offset 5072) diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc index 6227120baa..f068cdf4b6 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc @@ -166,22 +166,23 @@ ;; definition of type lightning-tracker (deftype lightning-tracker (process) - ((root trsqv :offset-assert 128) - (lightning lightning-spec :offset-assert 132) - (callback (function lightning-tracker none) :offset-assert 136) - (duration uint64 :offset-assert 144) - (start-time time-frame :offset-assert 152) - (offset0 vector :inline :offset-assert 160) - (offset1 vector :inline :offset-assert 176) - (target0 uint64 :offset-assert 192) - (target1 uint64 :offset-assert 200) - (target-joint0 int32 :offset-assert 208) - (target-joint1 int32 :offset-assert 212) - (sound uint32 :offset-assert 216) - (userdata uint64 :offset-assert 224) - (user-time time-frame 2 :offset-assert 232) - (user-vector vector :inline :offset-assert 256) - (user-handle handle 2 :offset 288) + ((ppointer-override (pointer lightning-tracker) :offset 28) + (root trsqv :offset-assert 128) + (lightning lightning-spec :offset-assert 132) + (callback (function lightning-tracker none) :offset-assert 136) + (duration uint64 :offset-assert 144) + (start-time time-frame :offset-assert 152) + (offset0 vector :inline :offset-assert 160) + (offset1 vector :inline :offset-assert 176) + (target0 uint64 :offset-assert 192) + (target1 uint64 :offset-assert 200) + (target-joint0 int32 :offset-assert 208) + (target-joint1 int32 :offset-assert 212) + (sound uint32 :offset-assert 216) + (userdata uint64 :offset-assert 224) + (user-time time-frame 2 :offset-assert 232) + (user-vector vector :inline :offset-assert 256) + (user-handle handle 2 :offset 288) ) :heap-base #xb0 :method-count-assert 17 diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc new file mode 100644 index 0000000000..b2910f50ef --- /dev/null +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc @@ -0,0 +1,2033 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 15 of type skeleton-group +(defmethod add-to-loading-level skeleton-group ((obj skeleton-group)) + (let ((v1-1 (-> *level* loading-level))) + (if v1-1 + (set-loaded-art (-> v1-1 art-group) obj) + ) + ) + obj + ) + +;; definition for function cspace-by-name +(defun cspace-by-name ((arg0 process-drawable) (arg1 string)) + (let* ((s4-0 (-> arg0 node-list length)) + (s3-0 0) + (s2-0 (-> arg0 node-list data s3-0)) + ) + (while (< s3-0 s4-0) + (if (and (-> s2-0 joint) (name= (-> s2-0 joint name) arg1)) + (return s2-0) + ) + (+! s3-0 1) + (set! s2-0 (-> arg0 node-list data s3-0)) + ) + ) + (the-as cspace #f) + ) + +;; definition for function cspace-index-by-name +(defun cspace-index-by-name ((arg0 process-drawable) (arg1 string)) + (let* ((s4-0 0) + (s3-0 (-> arg0 node-list length)) + (s2-0 0) + (v1-3 (-> arg0 node-list data s2-0)) + ) + (while (< s2-0 s3-0) + (if (and (-> v1-3 joint) (name= (-> v1-3 joint name) arg1)) + (return s4-0) + ) + (+! s4-0 1) + (+! s2-0 1) + (set! v1-3 (-> arg0 node-list data s2-0)) + ) + ) + -1 + ) + +;; definition for function vector<-cspace! +(defun vector<-cspace! ((arg0 vector) (arg1 cspace)) + (rlet ((Q :class vf) + (vf0 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (.lvf vf2 (&-> (-> arg1 bone) transform trans quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.mov.vf vf2 vf0 :mask #b1000) + (.svf (&-> arg0 quad) vf2) + arg0 + ) + ) + +;; definition for function vector<-matrix! +(defun vector<-matrix! ((arg0 vector) (arg1 matrix)) + (rlet ((Q :class vf) + (vf0 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (.lvf vf2 (&-> arg1 trans quad)) + (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + (.wait.vf) + (.mul.vf vf2 vf2 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.mov.vf vf2 vf0 :mask #b1000) + (.svf (&-> arg0 quad) vf2) + arg0 + ) + ) + +;; definition for function vector<-cspace+vector! +(defun vector<-cspace+vector! ((arg0 vector) (arg1 cspace) (arg2 vector)) + (vector-matrix*! arg0 arg2 (-> arg1 bone transform)) + ) + +;; definition (debug) for function cspace-children +(defun-debug cspace-children ((arg0 process-drawable) (arg1 int)) + (let ((a3-0 '())) + (countdown (s4-0 (-> arg0 node-list length)) + (if (= (-> arg0 node-list data s4-0 parent) arg1) + (set! a3-0 (cons (-> arg0 node-list data s4-0) a3-0)) + ) + ) + a3-0 + ) + ) + +;; definition (debug) for function cspace-inspect-tree +;; INFO: Used lq/sq +;; WARN: Using new Jak 2 rtype-of +(defun-debug cspace-inspect-tree ((arg0 process-drawable) (arg1 cspace) (arg2 int) (arg3 int) (arg4 object)) + (local-vars (sv-16 string) (sv-32 int) (sv-48 int)) + (if (and (= arg4 'mesh) (zero? *debug-vertex-stats*)) + (set! *debug-vertex-stats* (new 'debug 'debug-vertex-stats)) + ) + (if (not arg1) + (set! arg1 (the-as cspace (-> arg0 node-list data))) + ) + (print-tree-bitmask arg3 arg2) + (cond + ((-> arg1 joint) + (format + #t + "~S~S ~D" + (if (zero? arg2) + "" + "+---" + ) + (-> arg1 joint name) + (-> arg1 joint number) + ) + (let ((v1-11 arg4)) + (cond + ((= v1-11 'matrix) + #f + ) + ((= v1-11 'mesh) + (let ((s1-0 format) + (s0-0 #t) + ) + (set! sv-16 " ~D/~D/~F") + (set! sv-32 (drawable-frag-count (-> arg1 geo))) + (set! sv-48 (drawable-tri-count (-> arg1 geo))) + (let ((t0-2 (drawable-vertex-ratio (-> arg1 geo) *debug-vertex-stats*))) + (s1-0 s0-0 sv-16 sv-32 sv-48 t0-2) + ) + ) + ) + ) + ) + (format #t "~%") + ) + (else + (format + #t + "~S~S~%" + (if (zero? arg2) + "" + "+---" + ) + arg1 + ) + ) + ) + (let* ((s2-1 (cspace-children arg0 (the-as int arg1))) + (a0-16 s2-1) + (s1-1 ((method-of-type (rtype-of a0-16) length) a0-16)) + (a1-11 (car s2-1)) + ) + (while (not (null? s2-1)) + (+! s1-1 -1) + (cspace-inspect-tree + arg0 + (the-as cspace a1-11) + (+ arg2 1) + (if (zero? s1-1) + arg3 + (logior arg3 (ash 1 (+ arg2 1))) + ) + arg4 + ) + (set! s2-1 (cdr s2-1)) + (set! a1-11 (car s2-1)) + ) + ) + arg0 + ) + +;; definition for method 0 of type draw-control +(defmethod new draw-control ((allocation symbol) (type-to-make type) (arg0 process) (arg1 symbol)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 jgeo) (the-as art-joint-geo arg1)) + (set! (-> v0-0 process) (the-as process-drawable arg0)) + (set! (-> v0-0 ripple) #f) + v0-0 + ) + ) + +;; definition for method 10 of type draw-control +;; WARN: Return type mismatch int vs none. +(defmethod lod-set! draw-control ((obj draw-control) (arg0 int)) + (let ((v1-1 (max 0 (min arg0 (the-as int (-> obj lod-set max-lod)))))) + (set! (-> obj desired-lod) v1-1) + (when (!= (-> obj cur-lod) v1-1) + (set! (-> obj mgeo) (-> obj lod-set lod v1-1 geo)) + (set! (-> obj cur-lod) v1-1) + (if (nonzero? (-> obj seg-mask)) + (setup-masks obj (the-as uint 0) 0) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 11 of type draw-control +;; WARN: Return type mismatch int vs none. +(defmethod lods-assign! draw-control ((obj draw-control) (arg0 lod-set)) + (mem-copy! (the-as pointer (-> obj lod-set)) (the-as pointer arg0) 49) + (let ((a1-2 (min (-> obj cur-lod) (the-as int (-> obj lod-set max-lod))))) + (set! (-> obj cur-lod) -1) + (lod-set! obj a1-2) + ) + 0 + (none) + ) + +;; definition for method 12 of type draw-control +;; WARN: Return type mismatch int vs none. +(defmethod setup-masks draw-control ((obj draw-control) (arg0 uint) (arg1 int)) + (local-vars (v1-4 int) (a2-1 (array uint64))) + (let ((a1-2 (logior (logclear (-> obj seg-mask) arg0) arg1))) + (set! (-> obj seg-mask) a1-2) + (cond + ((zero? a1-2) + (set! (-> obj effect-mask) (the-as uint 0)) + 0 + ) + ((begin (set! a2-1 (-> obj mgeo seg-table)) (set! v1-4 0) (nonzero? a2-1)) + (countdown (a3-0 (-> a2-1 length)) + (if (logtest? a1-2 (ash 1 a3-0)) + (set! v1-4 (logior v1-4 (-> a2-1 a3-0))) + ) + ) + (set! (-> obj effect-mask) (the-as uint v1-4)) + ) + (else + (set! (-> obj effect-mask) (the-as uint 0)) + 0 + ) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type lod-set +;; INFO: Used lq/sq +(defmethod setup-lods! lod-set ((obj lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) + (local-vars (sv-16 res-tag)) + (let ((v1-0 (-> arg1 length)) + (s3-0 (-> arg0 max-lod)) + ) + (set! (-> obj max-lod) (the-as int s3-0)) + (dotimes (a0-1 (the-as int (+ s3-0 1))) + (when (or (< (-> arg0 mgeo a0-1) 0) (>= (-> arg0 mgeo a0-1) v1-0)) + (set! obj (the-as lod-set #f)) + (goto cfg-22) + ) + (let ((a1-14 (-> arg1 data (-> arg0 mgeo a0-1)))) + (when (or (zero? a1-14) (!= (-> a1-14 type) merc-ctrl)) + (set! obj (the-as lod-set #f)) + (goto cfg-22) + ) + (set! (-> obj lod a0-1 geo) (the-as merc-ctrl a1-14)) + ) + (set! (-> obj lod a0-1 dist) (-> arg0 lod-dist a0-1)) + ) + (if (= (-> obj lod s3-0 dist) 4095996000.0) + (set! (-> obj lod s3-0 dist) (res-lump-float arg2 'vis-dist :default 4095996000.0)) + ) + ) + (let ((v1-14 (-> arg1 data (-> arg0 jgeo)))) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-15 (res-lump-data (-> v1-14 extra) 'lod-dist pointer :tag-ptr (& sv-16)))) + (when v1-15 + (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) + (set! (-> obj lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-15 (* a0-6 4))))) + ) + ) + ) + ) + (label cfg-22) + obj + ) + +;; definition for method 13 of type draw-control +;; WARN: Return type mismatch cspace-array vs none. +(defmethod setup-cspace-and-add draw-control ((obj draw-control) (arg0 art-joint-geo) (arg1 symbol)) + (let ((s5-0 ((method-of-type cspace-array new) arg1 cspace-array (+ (-> arg0 length) 1))) + (v0-1 ((method-of-type skeleton new) arg1 skeleton (+ (-> arg0 length) 1))) + ) + (set! (-> obj skeleton) v0-1) + (let ((s3-1 v0-1)) + (when (or (zero? s5-0) (zero? s3-1)) + (go process-drawable-art-error "memory") + (set! s5-0 (the-as cspace-array #f)) + (goto cfg-13) + ) + (let ((v1-9 ((method-of-type cspace reset-and-assign-geo!) (the-as cspace (-> s5-0 data)) (the-as drawable #f)))) + (set! (-> v1-9 bone) (the-as bone (-> s3-1 bones))) + ) + (let ((v1-10 (-> s5-0 data))) + (set! (-> v1-10 0 param0) (the-as (function cspace matrix none) cspace<-transformq!)) + (set! (-> v1-10 0 param1) (the-as basic (-> (the-as process-drawable (-> obj process)) root trans))) + ) + (let ((v1-12 (reset-and-assign-geo! (-> s5-0 data 1) (the-as drawable #f)))) + (set! (-> v1-12 joint) (-> arg0 data 0)) + (set! (-> v1-12 bone) (-> s3-1 bones 1)) + (set! (-> v1-12 parent) (the-as cspace (-> s5-0 data))) + ) + (let ((v1-14 (reset-and-assign-geo! (-> s5-0 data 2) (the-as drawable #f)))) + (set! (-> v1-14 joint) (-> arg0 data 1)) + (set! (-> v1-14 bone) (-> s3-1 bones 2)) + (set! (-> v1-14 parent) (the-as cspace (-> s5-0 data))) + (set! (-> v1-14 param0) (the-as (function cspace matrix none) cspace<-parented-matrix-joint!)) + (set! (-> v1-14 param1) (-> obj process)) + ) + (let ((s2-0 3)) + (while (< s2-0 (-> s5-0 length)) + (let* ((s0-0 (-> arg0 data (+ s2-0 -1))) + (s1-0 (if (-> s0-0 parent) + (+ (-> s0-0 parent number) 1) + 0 + ) + ) + (v1-25 (reset-and-assign-geo! (-> s5-0 data s2-0) (the-as drawable #f))) + ) + (set! (-> v1-25 joint) s0-0) + (set! (-> v1-25 bone) (-> s3-1 bones s2-0)) + (set! (-> v1-25 parent) (-> s5-0 data s1-0)) + ) + (+! s2-0 1) + ) + ) + ) + ) + (add-connection *foreground-draw-engine* (-> obj process) add-process-drawable (-> obj process) obj #f) + (label cfg-13) + (none) + ) + +;; definition for function execute-math-engine +(defun execute-math-engine () + (let ((gp-0 *matrix-engine*)) + (let ((s5-0 (-> gp-0 length))) + (dotimes (s4-0 s5-0) + (let ((v1-3 (the-as process-drawable (handle->process (-> gp-0 s4-0))))) + (if v1-3 + (do-joint-math (-> v1-3 draw) (-> v1-3 node-list) (-> v1-3 skel)) + ) + ) + ) + ) + (set! (-> gp-0 length) 0) + ) + 0 + 0 + ) + +;; definition for method 14 of type draw-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod do-joint-math draw-control ((obj draw-control) (arg0 cspace-array) (arg1 joint-control)) + (with-pp + (cond + ((logtest? (-> obj status) (draw-control-status no-draw no-draw-temp)) + ) + ((zero? arg1) + (matrix<-transformq+trans! + (the-as matrix (-> obj skeleton bones 3)) + (the-as transformq (-> (the-as process-drawable (-> obj process)) root trans)) + (-> obj skeleton bones 0 transform trans) + ) + (vector+! (-> obj origin) (-> obj skeleton bones 3 transform trans) (-> obj bounds)) + (set! (-> obj origin w) (-> obj bounds w)) + ) + (else + (let* ((s2-0 (-> obj mgeo num-joints)) + (s1-0 (+ s2-0 2)) + ) + (+ s1-0 1) + (let ((s5-0 pp)) + (set! pp (-> obj process)) + ((-> arg1 generate-frame-function) (the-as joint-anim-frame (+ 2400 #x70000000)) s1-0 arg1) + (if (-> arg1 prebind-function) + ((-> arg1 prebind-function) (the-as joint-anim-frame (+ 2400 #x70000000)) s1-0 arg1) + ) + (dotimes (s1-1 1) + (let* ((v1-20 (-> arg0 data s1-1)) + (t9-3 (-> v1-20 param0)) + ) + (when t9-3 + (let ((a0-9 v1-20) + (a1-5 (-> v1-20 param1)) + ) + (-> v1-20 param2) + (t9-3 a0-9 (the-as matrix a1-5)) + ) + ) + ) + ) + (dotimes (s1-2 2) + (let* ((a0-11 (-> arg0 data (+ s1-2 1))) + (a1-7 (+ (* s1-2 64) 2400 #x70000000)) + (t9-4 (-> a0-11 param0)) + ) + (if t9-4 + (t9-4 a0-11 (the-as matrix a1-7)) + ) + ) + ) + (let ((s1-3 3)) + (dotimes (s0-0 s2-0) + (let ((a0-12 (-> arg0 data (+ s0-0 s1-3))) + (a1-9 (+ (* 48 s0-0) 2528 #x70000000)) + ) + (if (-> a0-12 param0) + ((-> a0-12 param0) a0-12 (the-as matrix a1-9)) + (cspace<-parented-transformq-joint! a0-12 (the-as transformq a1-9)) + ) + ) + ) + ) + (if (-> arg1 postbind-function) + ((-> arg1 postbind-function) obj arg0 arg1) + ) + (let ((a1-11 (new 'stack-no-clear 'vector))) + (set! (-> a1-11 quad) (-> obj bounds quad)) + (set! (-> a1-11 w) 1.0) + (vector-matrix*! (-> obj origin) a1-11 (the-as matrix (-> obj skeleton bones (-> obj origin-joint-index)))) + ) + (let ((f0-2 (-> obj bounds w))) + (set! (-> obj origin w) f0-2) + f0-2 + ) + (set! pp s5-0) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 17 of type process-drawable +;; WARN: Return type mismatch int vs none. +(defmethod cleanup-for-death process-drawable ((obj process-drawable)) + (when (type? (-> obj root) collide-shape) + (let ((v1-2 (-> (the-as collide-shape (-> obj root)) root-prim))) + (set! (-> v1-2 prim-core collide-as) (collide-spec)) + (set! (-> v1-2 prim-core collide-with) (collide-spec)) + ) + 0 + ) + (if (nonzero? (-> obj skel)) + (ja-channel-set! 0) + ) + (process-entity-status! obj (entity-perm-status dead) #t) + 0 + (none) + ) + +;; definition for method 18 of type process-drawable +;; WARN: Return type mismatch int vs none. +(defmethod relocate-nav process-drawable ((obj process-drawable) (arg0 int)) + (set! (-> obj nav) (the-as nav-control (&+ (the-as pointer (-> obj nav)) arg0))) + 0 + (none) + ) + +;; definition for function draw-joint-axes +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defun draw-joint-axes ((arg0 process-drawable)) + (local-vars + (sv-64 (function symbol bucket-id vector vector meters rgba symbol)) + (sv-80 symbol) + (sv-96 int) + (sv-112 vector) + ) + (let ((s5-0 (new 'stack-no-clear 'vector2h)) + (s4-0 (shl #x8000 16)) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (let ((v1-1 s5-0)) + (set! (-> v1-1 x) 5) + (set! (-> v1-1 y) -5) + ) + (dotimes (s2-0 (-> arg0 node-list length)) + (let ((s1-0 (-> arg0 node-list data s2-0 bone transform))) + (vector<-cspace! s3-0 (-> arg0 node-list data s2-0)) + (dotimes (s0-0 3) + (set! sv-64 add-debug-vector) + (set! sv-80 #t) + (set! sv-96 318) + (set! sv-112 s3-0) + (let ((a3-0 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (+ (the-as uint s1-0) (* s0-0 16))) 1.0) + ) + (t0-0 #x444ccccd) + (t1-0 (logior (ash 255 (* s0-0 8)) s4-0)) + ) + (sv-64 sv-80 (the-as bucket-id sv-96) sv-112 a3-0 (the-as meters t0-0) (the-as rgba t1-0)) + ) + ) + ) + (format (clear *temp-string*) "~d" (+ s2-0 -1)) + (let ((a2-3 *temp-string*)) + (add-debug-text-3d #t (bucket-id debug-no-zbuf1) a2-3 s3-0 (font-color blue-#003cf1) s5-0) + ) + (set! (-> s5-0 x) (the-as int (+ (-> s5-0 x) 10))) + ) + ) + (none) + ) + +;; definition for function draw-root +(defun draw-root ((arg0 process-drawable)) + (add-debug-quaternion #t (bucket-id debug-no-zbuf1) (-> arg0 root trans) (-> arg0 root quat)) + (none) + ) + +;; definition for method 10 of type process-drawable +(defmethod deactivate process-drawable ((obj process-drawable)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + (if (nonzero? (-> obj sound)) + (stop! (-> obj sound)) + ) + (let ((a0-3 (-> obj nav))) + (if (and a0-3 (nonzero? a0-3)) + (nav-control-method-41 a0-3) + ) + ) + (let* ((s5-0 (-> obj root)) + (a0-5 (if (type? s5-0 collide-shape) + s5-0 + ) + ) + ) + (when a0-5 + (let ((a2-0 (-> (the-as collide-shape a0-5) actor-hash-index)) + (v1-12 *actor-hash*) + ) + (when (and (!= a2-0 -1) (= a0-5 (-> v1-12 object-array a2-0 object))) + (remove-by-id v1-12 (-> v1-12 sphere-array a2-0) a2-0) + 0 + ) + ) + ) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +;; failed to figure out what this is: +(defstate empty-state (process) + :code (the-as (function none :behavior process) nothing) + ) + +;; failed to figure out what this is: +(defstate process-drawable-art-error (process-drawable) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (when (= v1-0 'nav-mesh-kill) + (deactivate self) + #t + ) + ) + ) + ) + :code (behavior ((arg0 string)) + (if (-> self entity) + (logior! (-> self entity extra perm status) (entity-perm-status bit-1)) + ) + (let* ((s5-0 (-> self root)) + (v1-6 (if (type? s5-0 collide-shape) + s5-0 + ) + ) + ) + (when v1-6 + (let ((a0-5 (-> (the-as collide-shape v1-6) root-prim))) + (set! (-> a0-5 prim-core collide-as) (collide-spec)) + (set! (-> a0-5 prim-core collide-with) (collide-spec)) + ) + (set! (-> (the-as collide-shape v1-6) backup-collide-as) (collide-spec)) + (set! (-> (the-as collide-shape v1-6) backup-collide-with) (collide-spec)) + 0 + ) + ) + (until #f + (when (the-as collide-shape *display-entity-errors*) + (let ((s5-1 (cond + ((nonzero? (the-as collide-shape (-> self root))) + (-> (the-as collide-shape (-> self root)) trans) + ) + ((the-as collide-shape (-> self entity)) + (&-> (the-as collide-shape (-> (the-as collide-shape (-> self entity)) trans z)) quat y) + ) + (else + #f + ) + ) + ) + ) + (when s5-1 + (let ((s4-0 add-debug-text-3d) + (s3-0 #t) + (s2-0 318) + ) + (format (clear *temp-string*) "~2j~s error for ~s" arg0 (-> self name)) + (s4-0 + s3-0 + (the-as bucket-id s2-0) + *temp-string* + (the-as vector s5-1) + (font-color precursor-#ec3b00) + (the-as vector2h #f) + ) + ) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate process-drawable-idle (process-drawable) + :code (the-as (function none :behavior process-drawable) sleep-code) + :post ja-post + ) + +;; definition for function skeleton-group->draw-control +;; INFO: Used lq/sq +;; WARN: Stack slot offset 20 signed mismatch +;; WARN: Stack slot offset 20 signed mismatch +;; WARN: Stack slot offset 20 signed mismatch +;; WARN: Stack slot offset 20 signed mismatch +(defun skeleton-group->draw-control ((arg0 process-drawable) (arg1 skeleton-group) (arg2 (pointer cspace-array))) + (local-vars (s2-0 draw-control) (sv-16 art-element) (sv-20 int)) + (let ((s3-0 (if (= (-> arg1 texture-level) 6) + (-> *level* default-level) + (-> arg0 level) + ) + ) + ) + (let ((s1-0 (load-to-heap-by-name (-> s3-0 art-group) (-> arg1 art-group-name) #f global (-> arg1 version)))) + (when (or (zero? s1-0) (or (not s1-0) (!= (-> s1-0 type) art-group))) + (go process-drawable-art-error "art-group") + (set! s2-0 (the-as draw-control #f)) + (goto cfg-50) + ) + (set! sv-16 (-> s1-0 data (-> arg1 jgeo))) + (set! sv-20 (-> s1-0 length)) + (when (or (< (the-as int (-> arg1 jgeo)) 0) + (>= (the-as int (-> arg1 jgeo)) sv-20) + (not sv-16) + (!= (-> sv-16 type) art-joint-geo) + ) + (go process-drawable-art-error "joint-geo") + (set! s2-0 (the-as draw-control #f)) + (goto cfg-50) + ) + (set! s2-0 (new 'process 'draw-control arg0 (the-as symbol sv-16))) + (let ((v1-24 s2-0)) + (set! (-> v1-24 status) (draw-control-status uninited)) + (set! (-> v1-24 art-group) s1-0) + (set! (-> v1-24 jgeo) (the-as art-joint-geo sv-16)) + (set! (-> v1-24 force-lod) -1) + (set! (-> v1-24 cur-lod) -1) + (set! (-> v1-24 shadow) #f) + (set! (-> v1-24 shadow-ctrl) #f) + (set! (-> v1-24 data-format) (draw-control-data-format merc)) + (set! (-> v1-24 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (set! (-> v1-24 color-emissive quad) (-> (new 'static 'vector) quad)) + (set! (-> v1-24 longest-edge) (-> arg1 longest-edge)) + (set! (-> v1-24 origin-joint-index) (the-as uint (-> arg1 origin-joint-index))) + (set! (-> v1-24 shadow-joint-index) (the-as uint (-> arg1 shadow-joint-index))) + ) + (set! (-> s2-0 bounds quad) (-> arg1 bounds quad)) + (let ((v1-26 (-> arg1 shadow))) + (when (and (> v1-26 0) (< v1-26 sv-20)) + (let ((s0-0 (-> s1-0 data v1-26))) + (if (and (not (logtest? (the-as int (res-lump-value (-> arg0 entity) 'options uint128 :time -1000000000.0)) 8192)) + (= (-> s0-0 type) shadow-geo) + ) + (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + ) + ) + ) + ) + (if (not (setup-lods! (-> s2-0 lod-set) arg1 s1-0 (-> arg0 entity))) + (go process-drawable-art-error "mesh") + ) + ) + (let ((v1-41 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + ) + (case (if (= (-> arg1 texture-level) 6) + 6 + (-> s3-0 index) + ) + ((6) + (set! v1-41 (-> arg1 sort)) + ) + ) + (set! (-> s2-0 default-texture-page) (the-as uint v1-41)) + ) + (set! (-> s2-0 level-index) (the-as uint (-> s3-0 index))) + ) + (set! (-> s2-0 dma-add-func) nothing) + (set! (-> arg2 0) (the-as cspace-array (setup-cspace-and-add s2-0 (the-as art-joint-geo sv-16) 'process))) + (set! (-> s2-0 dma-add-func) dma-add-process-drawable) + (set! (-> s2-0 shadow-mask) (res-lump-value (-> arg0 entity) 'shadow-mask uint :time -1000000000.0)) + (set! (-> s2-0 shadow-values) (res-lump-value (-> arg0 entity) 'shadow-values uint :time -1000000000.0)) + (set! (-> s2-0 light-index) (if (zero? (-> arg1 light-index)) + (res-lump-value (-> arg0 entity) 'light-index uint :time -1000000000.0) + (-> arg1 light-index) + ) + ) + (let* ((gp-1 (ppointer->process (-> arg0 parent))) + (v1-54 (if (type? gp-1 process-drawable) + gp-1 + ) + ) + ) + (when (and v1-54 (nonzero? (-> (the-as process-drawable v1-54) draw))) + (set! (-> s2-0 light-index) (-> (the-as process-drawable v1-54) draw light-index)) + (set! (-> s2-0 shadow-mask) (-> (the-as process-drawable v1-54) draw shadow-mask)) + (set! (-> s2-0 shadow-values) (-> (the-as process-drawable v1-54) draw shadow-values)) + ) + ) + (lod-set! s2-0 0) + (label cfg-50) + s2-0 + ) + +;; definition for method 14 of type process-drawable +;; INFO: Used lq/sq +(defmethod initialize-skeleton process-drawable ((obj process-drawable) (arg0 skeleton-group) (arg1 pair)) + (local-vars (v1-14 art-element)) + (if (not arg0) + (go process-drawable-art-error "skel-group") + ) + (set! (-> obj draw) (skeleton-group->draw-control obj arg0 (&-> obj node-list))) + (let* ((s3-0 (-> obj draw)) + (a2-3 + (res-lump-value (-> s3-0 jgeo extra) 'joint-channel uint128 :default (the-as uint128 6) :time -1000000000.0) + ) + ) + (cond + ((> (the-as int a2-3) 0) + (logior! (-> s3-0 status) (draw-control-status math-skel)) + (let ((v0-3 (new 'process 'joint-control (the-as int a2-3)))) + (set! (-> obj skel) v0-3) + (let ((s4-0 v0-3)) + (let ((s3-1 (-> s3-0 art-group))) + (cond + ((>= (the-as int (-> arg0 janim)) 0) + (when (or (>= (the-as int (-> arg0 janim)) (-> s3-1 length)) + (begin (set! v1-14 (-> s3-1 data (-> arg0 janim))) (not v1-14)) + (!= (-> v1-14 type) art-joint-anim) + ) + (go process-drawable-art-error "initial joint-anim") + (return (the-as draw-control #f)) + ) + (ja-channel-set! 1) + (let ((s2-0 (-> obj skel root-channel 0))) + (joint-control-channel-group-eval! + s2-0 + (the-as art-joint-anim (-> s3-1 data (-> arg0 janim))) + num-func-identity + ) + (set! (-> s2-0 frame-num) 0.0) + ) + ) + (else + (ja-channel-set! 0) + ) + ) + ) + (set! (-> s4-0 effect) (new 'process 'effect-control obj)) + ) + ) + ) + (else + (set! (-> s3-0 skeleton bones 0 transform trans quad) (-> (the-as vector (get-property-struct + (-> s3-0 jgeo extra) + 'trans-offset + 'interp + -1000000000.0 + *null-vector* + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + quad + ) + ) + ) + ) + ) + (let ((s5-3 (-> obj root))) + (if (and s5-3 (nonzero? s5-3) (type? s5-3 collide-shape)) + (find-collision-meshes (the-as collide-shape s5-3)) + ) + ) + (-> obj draw) + ) + +;; definition for method 15 of type process-drawable +(defmethod initialize-skeleton-by-name process-drawable ((obj process-drawable) (arg0 string)) + (let* ((s4-0 *level*) + (s3-0 (method-of-object s4-0 art-group-get-by-name)) + ) + (format (clear *temp-string*) "skel-~S" arg0) + (let ((s4-1 (s3-0 s4-0 *temp-string* (the-as (pointer uint32) #f)))) + (if (and (nonzero? s4-1) (valid? s4-1 skeleton-group #f #f 0)) + (initialize-skeleton obj (the-as skeleton-group s4-1) (the-as pair 0)) + (go process-drawable-art-error arg0) + ) + ) + ) + (-> obj draw) + ) + +;; definition for method 16 of type process-drawable +(defmethod apply-alignment process-drawable ((obj process-drawable) (arg0 align-opts) (arg1 transformq) (arg2 vector)) + (with-pp + (when (logtest? arg0 (align-opts adjust-x-vel adjust-y-vel adjust-xz-vel)) + (let* ((s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> obj root quat))) + (s0-0 (matrix-transpose! (new 'stack-no-clear 'matrix) s3-0)) + (s2-0 (vector-matrix*! (new 'stack-no-clear 'vector) (-> *standard-dynamics* gravity) s0-0)) + (a1-5 (vector-matrix*! (new 'stack-no-clear 'vector) (-> obj root transv) s0-0)) + ) + (if (logtest? arg0 (align-opts no-gravity)) + (set-vector! s2-0 0.0 0.0 0.0 1.0) + ) + (when (logtest? arg0 (align-opts adjust-x-vel)) + (set! (-> a1-5 x) (+ (* (-> arg1 trans x) (-> arg2 x) (-> pp clock frames-per-second)) + (* (-> s2-0 x) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-xz-vel keep-other-velocities))) + (set! (-> a1-5 z) 0.0) + ) + ) + (if (and (logtest? arg0 (align-opts adjust-y-vel)) + (not (and (logtest? arg0 (align-opts ignore-y-if-zero)) (= (-> arg1 trans y) 0.0))) + ) + (set! (-> a1-5 y) (+ (* (-> arg1 trans y) (-> arg2 y) (-> pp clock frames-per-second)) + (* (-> s2-0 y) (-> pp clock seconds-per-frame)) + ) + ) + ) + (when (logtest? arg0 (align-opts adjust-xz-vel)) + (set! (-> a1-5 z) (+ (* (-> arg1 trans z) (-> arg2 z) (-> pp clock frames-per-second)) + (* (-> s2-0 z) (-> pp clock seconds-per-frame)) + ) + ) + (if (not (logtest? arg0 (align-opts adjust-x-vel keep-other-velocities))) + (set! (-> a1-5 x) 0.0) + ) + ) + (vector-matrix*! (-> obj root transv) a1-5 s3-0) + ) + ) + (if (logtest? arg0 (align-opts adjust-quat)) + (quaternion-normalize! (quaternion*! (-> obj root quat) (-> obj root quat) (-> arg1 quat))) + ) + (-> obj root) + ) + ) + +;; definition for function ja-done? +(defbehavior ja-done? process-drawable ((arg0 int)) + (let ((v1-2 (-> self skel root-channel arg0))) + (cond + ((zero? (-> self skel active-channels)) + #t + ) + ((= (-> v1-2 num-func) num-func-seek!) + (= (-> v1-2 frame-num) (-> v1-2 param 0)) + ) + ((= (-> v1-2 num-func) num-func-interp-play!) + (= (the int (-> v1-2 frame-num)) (+ (-> v1-2 frame-group frames num-frames) -1)) + ) + (else + #t + ) + ) + ) + ) + +;; definition for function ja-min? +(defbehavior ja-min? process-drawable ((arg0 int)) + (= (-> self skel root-channel arg0 frame-num) 0.0) + ) + +;; definition for function ja-max? +(defbehavior ja-max? process-drawable ((arg0 int)) + (let ((v1-2 (-> self skel root-channel arg0))) + (>= (-> v1-2 frame-num) (the float (+ (-> v1-2 frame-group frames num-frames) -1))) + ) + ) + +;; definition for function ja-num-frames +;; WARN: Return type mismatch uint vs int. +(defbehavior ja-num-frames process-drawable ((arg0 int)) + (the-as int (+ (-> self skel root-channel arg0 frame-group frames num-frames) -1)) + ) + +;; definition for function ja-frame-num +(defbehavior ja-frame-num process-drawable ((arg0 int)) + (-> self skel root-channel arg0 frame-num) + ) + +;; definition for function ja-aframe-num +(defbehavior ja-aframe-num process-drawable ((arg0 int)) + (let* ((a0-2 (-> self skel root-channel arg0)) + (v1-2 (-> a0-2 frame-group)) + ) + (if (and v1-2 (nonzero? v1-2)) + (+ (* (-> a0-2 frame-num) (-> v1-2 artist-step)) (-> v1-2 artist-base)) + 0.0 + ) + ) + ) + +;; definition for function ja-aframe +(defbehavior ja-aframe process-drawable ((arg0 float) (arg1 int)) + (let ((v1-3 (-> self skel root-channel arg1 frame-group))) + (if (and v1-3 (nonzero? v1-3)) + (/ (- arg0 (-> v1-3 artist-base)) (-> v1-3 artist-step)) + arg0 + ) + ) + ) + +;; definition for function ja-speed +(defbehavior ja-speed process-drawable ((arg0 int)) + (-> self skel root-channel arg0 frame-group speed) + ) + +;; definition for function ja-step +(defbehavior ja-step process-drawable ((arg0 int)) + (-> self skel root-channel arg0 frame-group artist-step) + ) + +;; definition for function ja-channel-set! +(defbehavior ja-channel-set! process-drawable ((arg0 int)) + (let ((s5-0 (-> self skel))) + (when (nonzero? (-> s5-0 float-channels)) + (if (>= arg0 (the-as int (-> s5-0 active-channels))) + (qmem-copy->! + (the-as pointer (-> s5-0 channel arg0)) + (the-as pointer (-> s5-0 channel (-> s5-0 active-channels))) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + (qmem-copy<-! + (the-as pointer (-> s5-0 channel arg0)) + (the-as pointer (-> s5-0 channel (-> s5-0 active-channels))) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + ) + ) + (set! (-> s5-0 active-channels) (the-as uint arg0)) + (set! (-> s5-0 root-channel) (-> s5-0 channel)) + (set! (-> s5-0 blend-index) (the-as uint -1)) + (dotimes (v1-19 arg0) + (set! (-> s5-0 root-channel v1-19 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-19 group-sub-index) v1-19) + (set! (-> s5-0 root-channel v1-19 command) (if (zero? v1-19) + (joint-control-command push) + (joint-control-command blend) + ) + ) + (set! (-> s5-0 root-channel v1-19 frame-interp 0) 0.0) + (set! (-> s5-0 root-channel v1-19 frame-interp 1) 0.0) + (set! (-> s5-0 root-channel v1-19 frame-num) 0.0) + (set! (-> s5-0 root-channel v1-19 frame-group) #f) + (set! (-> s5-0 root-channel v1-19 num-func) num-func-none) + (set! (-> s5-0 root-channel v1-19 group-size) arg0) + ) + ) + arg0 + ) + +;; definition for function ja-channel-push! +(defbehavior ja-channel-push! process-drawable ((arg0 int) (arg1 time-frame)) + (let ((s5-0 (-> self skel))) + (cond + ((or (zero? (-> s5-0 active-channels)) + (zero? arg1) + (when (>= (+ (-> s5-0 active-channels) (-> s5-0 float-channels) arg0) (-> s5-0 allocated-length)) + (format + 0 + "WARNING: ~A could not do (ja-channel-push! ~D) because it has ~D/~D channels.~%" + self + arg0 + (+ (-> s5-0 active-channels) (-> s5-0 float-channels)) + (-> s5-0 allocated-length) + ) + #t + ) + ) + (ja-channel-set! arg0) + ) + (else + (when (not (-> s5-0 root-channel 0 frame-group)) + (let ((s3-0 (/ (- (the-as int (-> s5-0 root-channel)) (the-as uint (the-as int (-> s5-0 channel)))) 64))) + (if (nonzero? (-> s5-0 float-channels)) + (qmem-copy<-! + (the-as pointer (-> s5-0 channel s3-0)) + (the-as pointer (-> s5-0 channel (-> s5-0 active-channels))) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + ) + (set! (-> s5-0 active-channels) (the-as uint s3-0)) + ) + (if (zero? (-> s5-0 active-channels)) + (return (ja-channel-set! arg0)) + ) + ) + (let ((s3-1 (-> s5-0 active-channels))) + (if (nonzero? (-> s5-0 float-channels)) + (qmem-copy->! + (the-as pointer (-> s5-0 channel (+ arg0 1 s3-1))) + (the-as pointer (-> s5-0 channel s3-1)) + (the-as int (* (-> s5-0 float-channels) 64)) + ) + ) + (set! (-> s5-0 root-channel) (the-as (inline-array joint-control-channel) (-> s5-0 channel s3-1))) + ) + (set! (-> s5-0 active-channels) (the-as uint (+ arg0 1 (-> s5-0 active-channels)))) + (dotimes (v1-38 arg0) + (set! (-> s5-0 root-channel v1-38 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> s5-0 root-channel v1-38 group-sub-index) v1-38) + (set! (-> s5-0 root-channel v1-38 command) (if (zero? v1-38) + (joint-control-command push) + (joint-control-command blend) + ) + ) + (set! (-> s5-0 root-channel v1-38 frame-interp 0) 0.0) + (set! (-> s5-0 root-channel v1-38 frame-interp 1) 0.0) + (set! (-> s5-0 root-channel v1-38 frame-num) 0.0) + (set! (-> s5-0 root-channel v1-38 frame-group) #f) + (set! (-> s5-0 root-channel v1-38 num-func) num-func-none) + (set! (-> s5-0 root-channel v1-38 group-size) arg0) + ) + (let ((v1-42 (-> s5-0 root-channel arg0))) + (set! (-> v1-42 eval-time) (the-as uint 0)) + (set! (-> v1-42 group-sub-index) arg0) + (set! (-> s5-0 blend-index) (+ (-> s5-0 active-channels) -1)) + (set! (-> v1-42 frame-interp 0) 0.0) + (set! (-> v1-42 frame-interp 1) 0.0) + (set! (-> v1-42 frame-num) 0.0) + (set! (-> v1-42 frame-group) #f) + (set! (-> v1-42 group-size) arg0) + (set! (-> v1-42 param 0) (/ 5.0 (+ 5.0 (the float arg1)))) + (set! (-> v1-42 num-func) num-func-blend-in!) + (cond + ((= arg0 1) + (set! (-> v1-42 command) (joint-control-command stack1)) + (set! (-> s5-0 root-channel 0 command) (joint-control-command push1)) + ) + (else + (set! (-> v1-42 command) (joint-control-command stack)) + ) + ) + ) + arg0 + ) + ) + ) + ) + +;; definition for function ja-channel-float! +(defbehavior ja-channel-float! process-drawable ((arg0 art-joint-anim) (arg1 float) (arg2 float) (arg3 float)) + (cond + ((>= (+ (-> self skel active-channels) (-> self skel float-channels)) (-> self skel allocated-length)) + (format + 0 + "WARNING: ~A could not do (ja-channel-float! ~D) because it has ~D/~D channels.~%" + self + 1 + (+ (-> self skel active-channels) (-> self skel float-channels)) + (-> self skel allocated-length) + ) + (the-as joint-control-channel #f) + ) + (else + (let ((v0-1 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels))))) + (+! (-> self skel float-channels) 1) + (set! (-> v0-1 eval-time) (the-as uint (-> self clock frame-counter))) + (set! (-> v0-1 group-sub-index) 0) + (set! (-> v0-1 command) (joint-control-command float)) + (set! (-> v0-1 frame-interp 0) arg2) + (set! (-> v0-1 frame-interp 1) arg3) + (set! (-> v0-1 frame-num) arg1) + (set! (-> v0-1 frame-group) arg0) + (set! (-> v0-1 num-func) num-func-none) + (set! (-> v0-1 group-size) 1) + (set! (-> v0-1 dist) 0.0) + v0-1 + ) + ) + ) + ) + +;; definition for function joint-control-reset! +;; WARN: Return type mismatch uint vs none. +(defbehavior joint-control-reset! process-drawable ((arg0 joint-control) (arg1 joint-control-channel)) + (let* ((v1-2 (the-as object (- (the-as int arg1) (the-as uint (* (-> arg1 group-size) 64))))) + (s5-0 (/ (- (the-as int v1-2) (the-as uint (the-as int (-> arg0 channel)))) 64)) + (s4-0 (/ (- (the-as int arg1) (the-as uint v1-2)) 64)) + ) + (when (> s5-0 0) + (if (= (-> (the-as joint-control-channel v1-2) command) (joint-control-command push1)) + (set! (-> (the-as joint-control-channel v1-2) command) (joint-control-command push)) + ) + (if (= (-> arg0 root-channel) (the-as joint-control-channel v1-2)) + (set! (-> arg0 root-channel) (-> arg0 channel)) + (set! (-> arg0 root-channel) + (the-as (inline-array joint-control-channel) (-> arg0 root-channel (- (+ s5-0 1)))) + ) + ) + (qmem-copy<-! + (the-as pointer (-> arg0 channel)) + (the-as pointer v1-2) + (the-as int (* (- (+ (-> arg0 active-channels) (-> arg0 float-channels)) (the-as uint s5-0)) 64)) + ) + (qmem-copy<-! + (the-as pointer (-> arg0 channel s4-0)) + (the-as pointer (+ (the-as uint (-> arg0 channel 1)) (* s4-0 64))) + (* (+ (- (- -1 s5-0) s4-0) (-> arg0 float-channels) (-> arg0 active-channels)) 64) + ) + (set! (-> arg0 active-channels) (- (-> arg0 active-channels) (the-as uint (+ s5-0 1)))) + ) + ) + (none) + ) + +;; definition for function ja-group-size +(defbehavior ja-group-size process-drawable () + (if (< (the-as int (-> self skel root-channel)) + (the-as int (-> self skel channel (-> self skel active-channels))) + ) + (-> self skel root-channel 0 group-size) + 0 + ) + ) + +;; definition for function ja-eval +(defbehavior ja-eval process-drawable () + (let ((gp-0 (-> self skel root-channel 0)) + (s5-0 (-> self skel channel (+ (-> self skel active-channels) (-> self skel float-channels)))) + (s4-0 (-> self clock frame-counter)) + ) + (while (< (the-as int gp-0) (the-as int s5-0)) + (cond + ((logtest? (-> gp-0 command) (joint-control-command joint-control-command-4)) + ) + (else + (if (!= (-> gp-0 eval-time) s4-0) + (joint-control-channel-eval gp-0) + ) + ) + ) + (&+! gp-0 64) + ) + ) + 0 + ) + +;; definition for function ja-blend-eval +(defbehavior ja-blend-eval process-drawable () + (let ((gp-0 (-> self skel root-channel)) + (s5-0 (the-as joint-control-channel (-> self skel channel))) + (s4-0 (-> self clock frame-counter)) + ) + (when (and (nonzero? (-> self skel active-channels)) (!= gp-0 s5-0)) + (while (< (the-as int s5-0) (the-as int gp-0)) + (cond + ((logtest? (-> s5-0 command) (joint-control-command joint-control-command-4)) + ) + (else + (if (!= (-> s5-0 eval-time) s4-0) + (joint-control-channel-eval s5-0) + ) + ) + ) + (&+! s5-0 64) + ) + ) + ) + 0 + ) + +;; definition for method 10 of type joint-control +;; WARN: Return type mismatch int vs none. +;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] +;; ERROR: Unsupported inline assembly instruction kind - [jr ra] +(defmethod update-anim-data joint-control ((obj joint-control)) + (local-vars (s7-0 none) (ra-0 int)) + (let ((s5-0 (+ (-> obj active-channels) (-> obj float-channels)))) + (dotimes (s4-0 (the-as int s5-0)) + (let ((s3-0 (-> obj channel s4-0))) + (case (-> s3-0 command) + (((joint-control-command stack) (joint-control-command stack1)) + ) + (else + (let ((s2-0 (-> s3-0 frame-group))) + (when (not (and s2-0 (nonzero? s2-0) (= (logand (the-as int s2-0) 7) 4) (= (-> s2-0 type) art-joint-anim))) + (go process-drawable-art-error "joint-anim") + (.lw ra-0 return-from-thread s7-0) + (.jr ra-0) + (nop!) + 0 + ) + (when (nonzero? (-> s2-0 frames flags)) + (cond + ((logtest? (-> s2-0 frames flags) 2) + (update-time-stamp *anim-manager* s2-0) + ) + ((logtest? (-> s2-0 frames flags) 1) + (decompress *anim-manager* s2-0) + ) + ) + ) + (set! (-> s3-0 frame-num) + (fmax 0.0 (fmin (-> s3-0 frame-num) (the float (+ (-> s2-0 frames num-frames) -1)))) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 19 of type process-drawable +;; WARN: Return type mismatch int vs none. +;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] +;; ERROR: Unsupported inline assembly instruction kind - [jr ra] +(defmethod evaluate-joint-control process-drawable ((obj process-drawable)) + (local-vars (s1-0 joint-control-channel) (s2-0 int) (s4-0 uint) (s7-0 none) (ra-0 int)) + (with-pp + (let ((gp-0 (-> obj skel))) + (let ((a0-1 (-> gp-0 top-anim))) + (b! (not a0-1) cfg-2 :delay (empty-form)) + (update a0-1) + ) + (until (= s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (label cfg-2) + (set! s4-0 (+ (-> gp-0 active-channels) (-> gp-0 float-channels))) + (let ((s3-0 (-> pp clock frame-counter))) + (b! (logtest? (-> obj draw status) (draw-control-status no-draw)) cfg-45 :delay (empty-form)) + (set! s2-0 0) + (b! #t cfg-30 :delay (nop!)) + (label cfg-4) + (set! s1-0 (-> gp-0 channel s2-0)) + (b! + (not (and (logtest? (-> s1-0 command) (joint-control-command thirty-two)) (!= (-> s1-0 eval-time) s3-0))) + cfg-10 + :delay (empty-form) + ) + ) + (joint-control-channel-eval s1-0) + ) + (label cfg-10) + (let ((v1-19 (-> s1-0 command))) + (b! (!= v1-19 (joint-control-command stack)) cfg-12 :delay (nop!)) + (b! #t cfg-29 :delay (nop!)) + (label cfg-12) + (cond + ((= v1-19 (joint-control-command stack1)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 0) (-> s1-0 frame-interp 0)) + (set! (-> gp-0 channel (+ s2-0 -1) frame-interp 1) (-> s1-0 frame-interp 1)) + ) + (else + (let ((s0-0 (-> s1-0 frame-group))) + (when (not (and s0-0 (nonzero? s0-0) (= (logand (the-as int s0-0) 7) 4) (= (-> s0-0 type) art-joint-anim))) + (go process-drawable-art-error "joint-anim") + (.lw ra-0 return-from-thread s7-0) + (.jr ra-0) + (nop!) + 0 + ) + (when (nonzero? (-> s0-0 frames flags)) + (cond + ((logtest? (-> s0-0 frames flags) 2) + (update-time-stamp *anim-manager* s0-0) + ) + ((logtest? (-> s0-0 frames flags) 1) + (decompress *anim-manager* s0-0) + ) + ) + ) + (set! (-> s1-0 frame-num) + (fmax 0.0 (fmin (-> s1-0 frame-num) (the float (+ (-> s0-0 frames num-frames) -1)))) + ) + ) + ) + ) + ) + (label cfg-29) + (+! s2-0 1) + (label cfg-30) + (b! (< s2-0 (the-as int s4-0)) cfg-4) + (dotimes (v1-56 (the-as int s4-0)) + (set! (-> gp-0 channel v1-56 frame-interp 0) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 0)))) + (set! (-> gp-0 channel v1-56 frame-interp 1) (fmax 0.0 (fmin 1.0 (-> gp-0 channel v1-56 frame-interp 1)))) + ) + (if (or (zero? s4-0) (or (not (-> gp-0 root-channel 0 frame-group)) (zero? (-> gp-0 active-channels)))) + (logior! (-> obj draw status) (draw-control-status no-draw-temp)) + ) + (if (logtest? (-> obj skel status) (joint-control-status blend-shape blend-shape-valid)) + (merc-blend-shape obj) + ) + (if (logtest? (-> obj skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim obj) + ) + (label cfg-45) + (let ((a0-26 (-> gp-0 effect))) + (if a0-26 + (effect-control-method-9 a0-26) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for function ja-post +;; WARN: Return type mismatch int vs none. +;; WARN: Function ja-post has a return type of none, but the expression builder found a return statement. +(defbehavior ja-post process-drawable () + (when (nonzero? (-> self draw)) + (let ((gp-1 (logtest? (-> self draw status) (draw-control-status uninited)))) + (logclear! (-> self draw status) (draw-control-status no-draw-temp uninited)) + (when (nonzero? (-> self skel)) + (evaluate-joint-control self) + (when (or (logtest? (-> self skel status) (joint-control-status sync-math)) gp-1) + (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) + (if (and gp-1 (type? (-> self root) collide-shape)) + (update-transforms (the-as collide-shape (-> self root))) + ) + (return #f) + ) + ) + ) + (let ((v1-23 *matrix-engine*)) + (set! (-> v1-23 (-> v1-23 length)) (process->handle self)) + (+! (-> v1-23 length) 1) + ) + ) + 0 + (none) + ) + +;; definition for method 9 of type joint-control +(defmethod current-cycle-distance joint-control ((obj joint-control)) + (cond + ((< (the-as int (-> obj root-channel)) (the-as int (-> obj channel (-> obj active-channels)))) + (let ((s4-0 (-> obj root-channel (-> obj root-channel 0 group-size))) + (s3-0 (the-as joint-control-channel (-> obj root-channel))) + (s5-0 (the-as (pointer float) (new 'stack-no-clear 'vector))) + ) + (while (< (the-as int s3-0) (the-as int s4-0)) + (case (-> s3-0 command) + (((joint-control-command push)) + (set! (-> s5-0 0) (-> s3-0 dist)) + (set! s5-0 (&-> s5-0 1)) + ) + (((joint-control-command blend) (joint-control-command push1) (joint-control-command float)) + (set! (-> s5-0 -1) (lerp (-> s5-0 -1) (-> s3-0 dist) (-> s3-0 frame-interp (-> obj active-frame-interp)))) + ) + (((joint-control-command stack)) + (set! (-> s5-0 -2) (lerp (-> s5-0 -2) (-> s5-0 -1) (-> s3-0 frame-interp (-> obj active-frame-interp)))) + (set! s5-0 (&-> s5-0 -1)) + ) + ) + (&+! s3-0 64) + ) + (-> s5-0 -1) + ) + ) + (else + 0.0 + ) + ) + ) + +;; definition for method 0 of type top-anim-joint-control +(defmethod new top-anim-joint-control ((allocation symbol) (type-to-make type) (arg0 process-drawable)) + (let ((gp-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> gp-0 process) (the-as (pointer process-drawable) (process->ppointer arg0))) + (set! (-> gp-0 interp-select 0) (the-as uint (-> arg0 skel interp-select 0))) + (set! (-> gp-0 interp-select 1) (the-as uint (-> arg0 skel interp-select 1))) + (set! (-> gp-0 base-anim-speed) 1.0) + (set! (-> gp-0 base-anim-blend) 0.1333333) + (set! (-> gp-0 frame-post-put-away) #f) + (reset gp-0) + gp-0 + ) + ) + +;; definition for method 9 of type top-anim-joint-control +;; WARN: Return type mismatch top-anim-joint-control vs none. +(defmethod reset top-anim-joint-control ((obj top-anim-joint-control)) + (let ((v0-0 obj)) + (set! (-> v0-0 interp) 0.0) + (set! (-> v0-0 frame-targ) #f) + (set! (-> v0-0 frame-group) #f) + (set! (-> v0-0 frame-group-push) #f) + (set! (-> v0-0 frame-num) 0.0) + (set! (-> v0-0 frame-start) 0.0) + (set! (-> v0-0 frame-blend) 0.0) + (set! (-> v0-0 frame-post-blend) 0.1333333) + (set! (-> v0-0 frame-post-end) 0.0) + (set! (-> v0-0 base-anim) #f) + (set! (-> v0-0 base-anim-speed) 1.0) + (set! (-> v0-0 base-anim-blend) 0.1333333) + ) + (none) + ) + +;; definition for method 11 of type top-anim-joint-control +(defmethod get-channel top-anim-joint-control ((obj top-anim-joint-control) (arg0 int)) + (case arg0 + ((1) + (case (-> obj process 0 skel float-channels) + ((2) + (-> obj process 0 skel channel (-> obj process 0 skel active-channels)) + ) + (else + (the-as joint-control-channel #f) + ) + ) + ) + (else + (case (-> obj process 0 skel float-channels) + ((1) + (-> obj process 0 skel channel (-> obj process 0 skel active-channels)) + ) + ((2) + (-> obj process 0 skel channel (+ (-> obj process 0 skel active-channels) 1)) + ) + (else + (the-as joint-control-channel #f) + ) + ) + ) + ) + ) + +;; definition for method 12 of type top-anim-joint-control +;; WARN: Return type mismatch int vs none. +(defmethod push-anim-to-targ top-anim-joint-control ((obj top-anim-joint-control) + (arg0 art-joint-anim) + (arg1 float) + (arg2 int) + (arg3 int) + (arg4 float) + (arg5 float) + (arg6 symbol) + ) + (with-pp + (when (!= (-> obj interp) 0.0) + (let ((v1-1 obj)) + (set! (-> v1-1 frame-targ) arg0) + (set! (-> v1-1 frame-speed) arg4) + (set! (-> v1-1 frame-start) (/ arg1 (-> arg0 artist-step))) + (set! (-> v1-1 frame-blend) (if (zero? arg2) + 0.0 + (/ 5.0 (+ 5.0 (the float arg2))) + ) + ) + (set! (-> v1-1 frame-post-blend) (if (zero? arg3) + 0.0 + (/ 5.0 (+ 5.0 (the float arg3))) + ) + ) + (set! (-> v1-1 frame-post-end) (/ arg5 (-> arg0 artist-step))) + (set! (-> v1-1 frame-push-time) (-> pp clock frame-counter)) + (set! (-> v1-1 frame-post-put-away) #f) + ) + (if arg6 + (sound-play-by-spec (the-as sound-spec arg6) (new-sound-id) (the-as vector #t)) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 10 of type top-anim-joint-control +;; WARN: Return type mismatch int vs none. +(defmethod update top-anim-joint-control ((obj top-anim-joint-control)) + (with-pp + (let* ((v1-0 (-> obj process)) + (pp (if v1-0 + (the-as process-drawable (-> v1-0 0 self)) + ) + ) + ) + (let ((s3-0 (get-channel obj 1)) + (s5-0 (get-channel obj 0)) + (s4-0 (-> obj base-anim)) + ) + (set! (-> obj frame-group-push) #f) + (cond + ((= (-> obj interp) 0.0) + (when s5-0 + (seek! (-> s5-0 frame-interp 1) 0.0 (* 8.0 (-> pp clock seconds-per-frame))) + (if s3-0 + (set! (-> s3-0 frame-interp 1) (fmin (-> s3-0 frame-interp 1) (-> s5-0 frame-interp 1))) + ) + (when (= (-> s5-0 frame-interp 1) 0.0) + (set! (-> obj frame-post-put-away) #f) + (when (= (-> obj interp) 0.0) + (joint-channel-float-delete! s5-0) + (set! (-> obj frame-group) #f) + (set! (-> obj frame-num) 0.0) + (set! (-> pp skel generate-frame-function) create-interpolated-joint-animation-frame) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + ) + ) + ) + ) + (else + (when (or (not s5-0) + (or (and (-> obj frame-targ) + (and (!= (-> obj frame-blend) 0.0) + (or (!= (-> s5-0 frame-group) (-> obj frame-targ)) (< (-> obj update-time) (-> obj frame-push-time))) + ) + ) + (and (not (-> obj frame-targ)) + (!= (-> s5-0 frame-group) s4-0) + (set! (-> obj frame-blend) (-> obj frame-post-blend)) + ) + ) + ) + (when s3-0 + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + (set! s5-0 (get-channel obj 0)) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + ) + (set! (-> pp skel generate-frame-function) create-interpolated2-joint-animation-frame) + (let ((s2-0 (the-as basic (-> obj frame-targ)))) + (set! s2-0 (cond + ((the-as art-joint-anim s2-0) + (empty) + s2-0 + ) + (else + s4-0 + ) + ) + ) + (set! s3-0 s5-0) + (if s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + ) + (cond + ((= s4-0 s2-0) + (let ((v1-30 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-30 + (set! (-> v1-30 param 0) 1.0) + (set! (-> v1-30 num-func) num-func-loop!) + v1-30 + ) + ) + ) + (when s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ((>= (-> obj frame-speed) 0.0) + (let ((v1-35 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 + (when v1-35 + (set! (-> v1-35 param 0) + (- (the float (+ (-> (the-as art-joint-anim s2-0) frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> v1-35 param 1) (-> obj frame-speed)) + (set! (-> v1-35 num-func) num-func-seek!) + v1-35 + ) + ) + ) + (if s5-0 + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) + ) + (else + (when s5-0 + (let ((v1-39 (ja-channel-float! (the-as art-joint-anim s2-0) 0.0 0.0 0.0))) + (set! s5-0 (when v1-39 + (set! (-> v1-39 param 0) 0.0) + (set! (-> v1-39 param 1) (fabs (-> obj frame-speed))) + (set! (-> v1-39 num-func) num-func-seek!) + v1-39 + ) + ) + ) + (when s5-0 + (set! (-> s5-0 frame-num) (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-start))) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + ) + ) + ) + ) + (when s5-0 + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) + (set! (-> obj frame-cur-blend) (-> obj frame-blend)) + ) + ) + (when s5-0 + (set! (-> pp skel interp-select 0) (the-as int (-> obj interp-select 0))) + (set! (-> pp skel interp-select 1) (the-as int (-> obj interp-select 1))) + (let ((f0-35 (cond + ((not (-> obj frame-targ)) + (-> obj base-anim-blend) + ) + (s3-0 + (-> obj frame-cur-blend) + ) + (else + 0.1333333 + ) + ) + ) + ) + (if (= f0-35 0.0) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + (seek! (-> s5-0 frame-interp 1) (-> obj interp) (* f0-35 (-> pp clock time-adjust-ratio))) + ) + ) + (when s3-0 + (set! (-> obj frame-group-push) (-> s3-0 frame-group)) + (set! (-> s3-0 frame-interp 1) (-> obj interp)) + (if (!= (-> s3-0 eval-time) (-> pp clock frame-counter)) + (joint-control-channel-eval s3-0) + ) + (when (= (-> s5-0 frame-interp 1) (-> obj interp)) + (joint-channel-float-delete! s3-0) + (set! (-> obj frame-group-push) #f) + (set! s5-0 (get-channel obj 0)) + (set! (-> s5-0 frame-interp 1) (-> obj interp)) + ) + ) + (let ((v1-70 (-> obj frame-targ))) + (cond + (v1-70 + (cond + ((= (-> s5-0 frame-group) v1-70) + (if (!= (-> s5-0 eval-time) (-> pp clock frame-counter)) + (joint-control-channel-eval s5-0) + ) + (when (= (-> s5-0 frame-num) (-> s5-0 param 0)) + (set! (-> obj frame-targ) #f) + (set! (-> obj frame-start) 0.0) + (cond + ((-> obj frame-post-put-away) + (set! (-> obj interp) 0.0) + (set! (-> obj frame-post-put-away) #f) + ) + ((!= (-> obj frame-post-blend) 0.0) + (set! (-> s5-0 param 0) (the float (+ (-> s5-0 frame-group frames num-frames) -1))) + ) + (else + (set! (-> s5-0 frame-num) 0.0) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) 1.0) + ) + ) + ) + ) + (else + (set! (-> s5-0 eval-time) (the-as uint (-> pp clock frame-counter))) + (set! (-> s5-0 frame-group) v1-70) + (set! (-> s5-0 frame-num) (if (< (-> obj frame-speed) 0.0) + (- (the float (+ (-> v1-70 frames num-frames) -1)) (-> obj frame-start)) + (set! (-> s5-0 frame-num) (-> obj frame-start)) + ) + ) + (set! (-> s5-0 num-func) num-func-seek!) + (if (>= (-> obj frame-speed) 0.0) + (set! (-> s5-0 param 0) + (- (the float (+ (-> s5-0 frame-group frames num-frames) -1)) (-> obj frame-post-end)) + ) + (set! (-> s5-0 param 0) 0.0) + ) + (set! (-> s5-0 param 1) (fabs (-> obj frame-speed))) + ) + ) + ) + (else + (when (!= (-> s5-0 frame-group) s4-0) + (set! (-> s5-0 frame-num) 0.0) + (set! (-> obj base-anim-speed) 1.0) + (set! (-> obj base-anim-blend) 0.1333333) + ) + (set! (-> s5-0 frame-group) (the-as art-joint-anim s4-0)) + (set! (-> s5-0 num-func) num-func-loop!) + (set! (-> s5-0 param 0) (-> obj base-anim-speed)) + (set! (-> obj frame-post-blend) 0.1333333) + ) + ) + ) + (set! (-> obj frame-group) (-> s5-0 frame-group)) + (set! (-> obj frame-num) (-> s5-0 frame-num)) + ) + ) + ) + ) + (set! (-> obj update-time) (-> pp clock frame-counter)) + ) + 0 + (none) + ) + ) + +;; definition for function sleep-code +;; WARN: new jak 2 until loop case, check carefully +(defbehavior sleep-code process-drawable () + (until #f + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + ) + #f + ) + +;; definition for function transform-and-sleep +;; WARN: Return type mismatch int vs none. +(defbehavior transform-and-sleep process-drawable () + (let ((gp-0 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-post) + (update-transforms (the-as collide-shape (-> self root))) + (set! (-> self skel status) gp-0) + ) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + (none) + ) + +;; definition for function transform-and-sleep-code +;; WARN: Return type mismatch int vs none. +(defbehavior transform-and-sleep-code process-drawable () + (let ((gp-0 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-post) + (update-transforms (the-as collide-shape (-> self root))) + (set! (-> self skel status) gp-0) + ) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + (none) + ) + +;; definition for function transform-post +(defbehavior transform-post process-drawable () + (ja-post) + (update-transforms (the-as collide-shape (-> self root))) + 0 + ) + +;; definition for function rider-trans +;; WARN: Return type mismatch int vs none. +(defbehavior rider-trans process-drawable () + (detect-riders! (the-as collide-shape (-> self root))) + 0 + (none) + ) + +;; definition for function rider-post +;; WARN: Return type mismatch int vs none. +(defbehavior rider-post process-drawable () + (ja-post) + (let ((gp-0 (the-as collide-shape (-> self root)))) + (update-transforms gp-0) + (pull-riders! gp-0) + (do-push-aways gp-0) + ) + 0 + (none) + ) + +;; definition for function pusher-post +(defbehavior pusher-post process-drawable () + (ja-post) + (let ((gp-0 (the-as collide-shape (-> self root)))) + (update-transforms gp-0) + (do-push-aways gp-0) + ) + 0 + ) + +;; definition for function process-drawable-delay-player +(defbehavior process-drawable-delay-player process-drawable ((arg0 time-frame)) + (while (and *target* (logtest? (-> *target* focus-status) (focus-status in-air))) + (suspend) + ) + (set! (-> self state-time) (-> self clock frame-counter)) + (process-grab? *target* #f) + (while (or (-> *setting-control* user-current talking) + (-> *setting-control* user-current spooling) + (-> *setting-control* user-current hint) + (-> *setting-control* user-current ambient) + ) + (suspend) + ) + (while (< (- (-> self clock frame-counter) (-> self state-time)) arg0) + (suspend) + ) + (process-release? *target*) + (suspend) + 0 + ) + +;; definition for function process-drawable-fuel-cell-handler +;; WARN: Return type mismatch entity-perm-status vs none. +(defbehavior process-drawable-fuel-cell-handler process-drawable ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('notify) + (case (-> arg3 param 0) + (('pickup) + (if (type? arg0 fuel-cell) + (process-entity-status! self (entity-perm-status dead) #t) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function process-drawable-birth-fuel-cell +;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior process-drawable-birth-fuel-cell process-drawable ((arg0 entity) (arg1 vector) (arg2 symbol)) + (let ((v1-0 arg0) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (if (not v1-0) + (set! v1-0 (-> self entity)) + ) + (if arg1 + (set! (-> gp-0 quad) (-> arg1 quad)) + (set! (-> gp-0 quad) (-> v1-0 extra trans quad)) + ) + (let ((s5-0 (-> v1-0 extra perm task)) + (s4-0 (new 'static 'fact-info)) + ) + (set! (-> s4-0 options) (actor-option)) + (if arg2 + (set! (-> s4-0 options) (actor-option auto-pickup)) + ) + (when (and (nonzero? s5-0) (not (task-complete? *game-info* (the-as game-task s5-0)))) + (label cfg-12) + (birth-pickup-at-point gp-0 (pickup-type fuel-cell) (the float s5-0) #f self s4-0) + (when (not (-> self child)) + (suspend) + (goto cfg-12) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function find-offending-process-focusable +;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. +;; WARN: Return type mismatch object vs process-focusable. +(defbehavior find-offending-process-focusable process-drawable ((arg0 process-tree) (arg1 attack-info)) + (let ((s5-0 (the-as object #f))) + (when (and arg1 (logtest? (-> arg1 mask) (attack-info-mask attacker))) + (let ((s4-0 (handle->process (-> arg1 attacker)))) + (set! s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + ) + (when (not (the-as process s5-0)) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'get-offending-focusable) + (set! s5-0 (send-event-function arg0 a1-3)) + ) + (when (not s5-0) + (label cfg-16) + (b! (not arg0) cfg-24 :delay (empty-form)) + (set! s5-0 (cond + ((type? arg0 process-focusable) + arg0 + ) + (else + (let ((v1-12 process-tree)) + (b! (= (-> arg0 type) v1-12) cfg-24 :delay (nop!)) + ) + (nop!) + (set! arg0 (ppointer->process (-> arg0 parent))) + (goto cfg-16) + s5-0 + ) + ) + ) + 0 + ) + ) + (label cfg-24) + (the-as process-focusable s5-0) + ) + ) + +;; this part is debug only +(when *debug-segment* +;; definition for symbol *valid-con*, type string +(define *valid-con* (new 'debug 'string #x4000 (the-as string #f))) + +) +;; definition (debug) for function process-drawable-valid? +(defun-debug process-drawable-valid? ((arg0 process-drawable)) + (let ((s5-0 #t)) + (clear *valid-con*) + (format *valid-con* "~%--- ~A -----------------------------~%" arg0) + (dotimes (s4-0 (-> arg0 node-list length)) + (let ((s3-0 (-> arg0 node-list data s4-0))) + (when (-> s3-0 geo) + (cond + ((valid? (-> s3-0 geo) drawable (the-as symbol "cspace geo") #t *valid-con*) + ) + (else + (format *valid-con* "ERROR: ~A has an invalid geo ~A~%" s3-0 (-> s3-0 geo)) + (set! s5-0 #f) + ) + ) + ) + ) + ) + (let ((s4-1 (+ (-> arg0 skel active-channels) (-> arg0 skel float-channels)))) + (when (< (-> arg0 skel allocated-length) s4-1) + (format + *valid-con* + "ERROR: ~~A has ~D joint channels, but only ~D are allowed~%" + arg0 + s4-1 + (-> arg0 skel allocated-length) + ) + (set! s5-0 #f) + ) + (dotimes (s3-1 (the-as int s4-1)) + (let ((s2-0 (-> arg0 skel channel s3-1))) + (cond + ((logtest? (-> s2-0 command) (joint-control-command joint-control-command-4)) + ) + ((valid? (-> s2-0 frame-group) art-joint-anim (the-as symbol "joint-control frame-group") #t *valid-con*) + (when (not (and (>= (the int (-> s2-0 frame-num)) 0) + (< (the int (-> s2-0 frame-num)) (the-as int (-> s2-0 frame-group frames num-frames))) + ) + ) + (format + *valid-con* + "ERROR: ~`joint-control-channel`P #~D has an invalid frame-num ~F/~D [0-~D]~%" + s2-0 + s3-1 + (-> s2-0 frame-num) + (the int (-> s2-0 frame-num)) + (+ (-> s2-0 frame-group frames num-frames) -1) + ) + (set! s5-0 #f) + ) + ) + (else + (format + *valid-con* + "ERROR: ~`joint-control-channel`P #~D has an invalid frame-group ~A~%" + s2-0 + s3-1 + (-> s2-0 frame-group) + ) + (set! s5-0 #f) + ) + ) + ) + ) + ) + (when (not s5-0) + (format *valid-con* "--------------------------------~%~%") + (format 0 "~S" *valid-con*) + ) + s5-0 + ) + ) + +;; failed to figure out what this is: +0 diff --git a/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc b/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc new file mode 100644 index 0000000000..f0f18610e6 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc @@ -0,0 +1,642 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function poly-find-nearest-edge +;; INFO: Used lq/sq +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 48 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 48 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 48 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 36 signed mismatch +;; WARN: Stack slot offset 48 signed mismatch +(defun poly-find-nearest-edge ((arg0 nav-poly) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) + "TODO- Not 100% sure here, but unused" + (local-vars (sv-32 vector) (sv-36 float) (sv-40 int) (sv-48 float) (sv-80 vector)) + (set! sv-32 (new 'stack-no-clear 'vector)) + (set! sv-36 (the-as float 4095996000.0)) + (set! sv-40 -1) + (set! sv-48 (the-as float 0.0)) + (dotimes (s2-0 3) + (let ((s0-0 (-> arg1 s2-0))) + (set! sv-80 (-> arg1 (mod (+ s2-0 1) 3))) + (let ((f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) + ) + 0.0 + (vector-normalize! s1-1 1.0) + (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) + (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) + (set! sv-36 f30-0) + (set! sv-40 s2-0) + (set! sv-48 f0-5) + ) + ) + ) + ) + ) + (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) + (set! (-> arg0 vertex1 quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) + arg0 + ) + +;; definition for function target-collision-low-coverage +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun target-collision-low-coverage ((arg0 control-info) + (arg1 collide-query) + (arg2 vector) + (arg3 (pointer uint32)) + (arg4 (pointer int64)) + (arg5 (pointer symbol)) + ) + (local-vars + (sv-16 vector) + (sv-20 (pointer uint32)) + (sv-24 (pointer int64)) + (sv-28 (pointer symbol)) + (sv-32 uint) + (sv-40 int) + (sv-48 symbol) + (sv-52 vector) + (sv-56 vector) + ) + (with-pp + (set! sv-16 arg2) + (set! sv-20 arg3) + (set! sv-24 arg4) + (set! sv-28 arg5) + (set! sv-32 (-> arg3 0)) + (set! sv-40 (-> arg4 0)) + (set! sv-48 (-> arg5 0)) + (set! sv-52 (-> arg0 unknown-vector26)) + (set! sv-56 (vector-cross! (-> arg0 unknown-vector-kjh1n23kj1n23) (-> arg0 poly-normal) sv-16)) + (vector-normalize! sv-56 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) + (set! sv-32 (logior sv-32 512)) + ) + (vector-cross! sv-52 sv-16 sv-56) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) + (vector-negate! sv-52 sv-52) + ) + (vector-normalize! sv-52 1.0) + (let ((s4-0 (new 'stack-no-clear 'collide-query))) + (let ((s3-0 (vector-flatten! (-> arg0 unknown-vector-lkjk12nj3n) sv-52 (-> arg0 dynam gravity-normal)))) + (let ((v1-19 s4-0)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (-> arg1 best-my-prim prim-core collide-with)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (vector-normalize! s3-0 1.0) + (if (< (vector-dot s3-0 sv-16) 0.0) + (vector-negate! s3-0 s3-0) + ) + (set! (-> arg0 unknown-float-kj1n23k1) 4095996000.0) + (set! (-> arg0 unknown-float-n234n23) 4095996000.0) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) s3-0 2867.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 4096.0) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 unknown-float-kj1n23k1) + (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> s4-0 best-other-tri intersect)) + ) + ) + (set! (-> arg0 unknown-float-kj1n23j) (the-as float (-> s4-0 best-other-tri pat))) + (set! (-> arg0 unknown-vector-l1jn23j quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) (-> arg0 dynam gravity-normal) 819.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) s3-0 -819.2) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 -4096.0) + ) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 unknown-float-n234n23) + (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) + ) + (set! (-> arg0 unknown-float-m32j45nhn) (the-as float (-> s4-0 best-other-tri pat))) + (set! (-> arg0 unknown-vector-kj1n23k quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + ) + (when (and (not (logtest? sv-32 512)) + (and (or (< (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 unknown-float-kj1n23k1)) + (= (shr (shl (the-as int (-> arg0 unknown-float-kj1n23j)) 54) 61) 1) + ) + (and (< (-> arg0 unknown-float-n234n23) (* 2.0 (-> arg1 best-my-prim local-sphere w))) + (or (zero? (shr (shl (the-as int (-> arg0 unknown-float-m32j45nhn)) 54) 61)) + (= (shr (shl (the-as int (-> arg0 unknown-float-m32j45nhn)) 54) 61) 3) + ) + ) + ) + ) + (set! sv-32 (logior sv-32 128)) + (set! (-> arg0 unknown-time-frame-kjh1n23hkjn) (-> pp clock frame-counter)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-time-frame08) (-> pp clock frame-counter)) + (let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector10))) + (f0-27 (if (logtest? sv-32 2) + (cos (- 16384.0 (acos (-> arg0 coverage)))) + (-> arg0 coverage) + ) + ) + (f1-11 (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-other-tri intersect)) + ) + ) + ) + (if (or (not (logtest? sv-32 32)) (< 0.5 f0-27)) + (set! sv-48 (the-as symbol #f)) + ) + (when (and (or (and (< f0-27 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 32) (< f0-27 0.3)) + (< f1-11 (* -0.25 (-> arg1 best-my-prim local-sphere w))) + ) + (>= (vector-dot sv-52 sv-16) -0.000001) + ) + (set! (-> arg0 surf) *edge-surface*) + (set! sv-32 (logior sv-32 1024)) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 32) + (set! sv-48 #t) + (set! sv-32 (logior sv-32 4096)) + ) + ) + ) + ) + (if (< (-> arg0 surface-angle) 0.0) + (set! sv-48 #t) + ) + (when sv-48 + (cond + ((and (or (or (= (-> arg0 poly-pat mode) (pat-mode ground)) (= (-> arg0 poly-pat mode) (pat-mode halfpipe))) + (and (logtest? sv-32 8) + (>= (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 unknown-float-kj1n23k1)) + (or (zero? (shr (shl (the-as int (-> arg0 unknown-float-kj1n23j)) 54) 61)) + (= (shr (shl (the-as int (-> arg0 unknown-float-kj1n23j)) 54) 61) 3) + ) + (< 0.3 (fabs (-> arg0 surface-angle))) + ) + ) + (zero? (logand sv-32 128)) + ) + (set! sv-32 (logior sv-32 64)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-time-frame08) (-> pp clock frame-counter)) + (set! sv-48 (the-as symbol #f)) + ) + (#t + (set! sv-32 (logior sv-32 64)) + (set! sv-40 (logior sv-40 128)) + (set! (-> arg0 unknown-time-frame08) (-> pp clock frame-counter)) + ) + ) + ) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48) + 0 + (none) + ) + ) + +;; definition for function target-collision-reaction +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs collide-status. +(defbehavior target-collision-reaction target ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-240 symbol)) + (set! sv-80 (new-stack-vector0)) + (set! sv-84 (new-stack-vector0)) + (let ((v1-2 (new 'stack-no-clear 'matrix))) + (dotimes (a0-1 2) + (set! (-> v1-2 vector a0-1 quad) (the-as uint128 0)) + ) + (set! sv-88 v1-2) + ) + (set! sv-96 0) + (set! sv-104 0) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-3) + ) + (set! sv-104 (logior sv-104 (react-to-pat! arg0 (-> arg1 best-other-tri pat)))) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! sv-104 (logior sv-104 1)) + ) + (if (logtest? (-> arg0 unknown-surface00 flags) (surface-flag air)) + (set! sv-104 (logior sv-104 32)) + ) + (let ((v1-24 (new 'stack-no-clear 'vector))) + (set! (-> v1-24 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) + ) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-other-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (set! sv-104 (logior sv-104 24)) + ) + (let ((v1-35 (-> sv-80 quad))) + (set! (-> sv-84 quad) v1-35) + ) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (the-as vector (-> sv-88 vector))) + (if (< (-> arg0 poly-angle) -0.2) + (set! sv-96 (logior sv-96 16)) + ) + (if (< (-> arg0 poly-angle) 0.0) + (set! sv-96 (logior sv-96 #x4000)) + ) + (if (!= (-> arg1 best-my-prim prim-id) 6) + (set! sv-104 (logior sv-104 #x8000)) + ) + (if (and (= (-> arg0 cur-pat mode) (pat-mode halfpipe)) (< (-> arg0 poly-angle) 0.75)) + (send-event (-> arg0 process) 'slide) + ) + (set! sv-240 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) + (if (and sv-240 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.4 (fabs (-> arg0 surface-angle))))) + (set! sv-240 (the-as symbol #f)) + ) + (if (and (logtest? sv-104 #x8000) (logtest? sv-104 32) (>= (-> arg0 poly-angle) 0.0) (not sv-240)) + (set! sv-240 #t) + ) + (if sv-240 + (set! sv-104 (logior sv-104 2)) + ) + (if (logtest? sv-104 8) + (target-collision-low-coverage + arg0 + arg1 + sv-84 + (the-as (pointer uint32) (& sv-104)) + (the-as (pointer int64) (& sv-96)) + (& sv-240) + ) + ) + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (set! (-> arg0 unknown-vector-kj1n231 quad) (-> arg0 transv quad)) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (set! (-> arg0 unknown-float21) (- (vector-dot (-> arg0 transv) sv-84))) + (set! sv-96 (logior sv-96 2048)) + (if (nonzero? (-> arg0 unknown-surface01 impact-hook)) + ((-> arg0 unknown-surface01 impact-hook) arg0 (the-as (pointer float) (-> sv-88 vector)) sv-84) + ) + (when (not sv-240) + (let ((f0-21 (- 1.0 (-> arg0 unknown-surface01 impact-fric)))) + (when (< f0-21 1.0) + (let ((v1-113 (new-stack-vector0)) + (f1-13 (vector-dot (-> arg0 dynam gravity-normal) (the-as vector (-> sv-88 vector)))) + ) + 0.0 + (vector-! + v1-113 + (the-as vector (-> sv-88 vector)) + (vector-float*! v1-113 (-> arg0 dynam gravity-normal) f1-13) + ) + (let* ((f2-2 (vector-length v1-113)) + (f3-0 f2-2) + ) + (if (< f1-13 0.0) + (set! f1-13 (* f1-13 f0-21)) + ) + (vector+! + (the-as vector (-> sv-88 vector)) + (vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f1-13) + (vector-float*! v1-113 v1-113 (/ f2-2 f3-0)) + ) + ) + ) + ) + ) + ) + ) + (set! sv-96 (logior sv-96 4)) + (cond + ((-> arg1 num-spheres) + (set! sv-96 (logior sv-96 32)) + (set! (-> arg0 unknown-vector001 quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 unknown-vector-kij1b231 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-handle00) + (process->handle (-> (the-as collide-shape-prim (-> arg1 num-spheres)) cshape process)) + ) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (set! sv-96 (logior sv-96 4096)) + ) + ) + (cond + (sv-240 + (set! sv-104 (logior sv-104 4)) + (set! sv-96 (logior sv-96 8)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 unknown-vector24 quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 unknown-vector-kj1hj2b3 quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector25 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-pat-surface00) (-> arg1 best-other-tri pat)) + (cond + ((and (logtest? (focus-status mech) (-> (the-as process-focusable (-> arg0 process)) focus-status)) + (logtest? sv-104 #x8000) + (logtest? sv-104 32) + (< 0.0 (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (< 0.0 (vector-dot (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal))) + ) + (set! (-> arg0 surf) *edge-surface*) + (set! sv-104 (logior #x10000 sv-104)) + (vector-flatten! arg2 (vector-negate! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal)) sv-84) + (vector-normalize! arg2 (vector-dot arg2 (the-as vector (-> sv-88 vector)))) + ) + (else + (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) + ) + ) + (cond + ((and (or (and (>= (-> arg1 best-my-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + ) + (< (- (-> self clock frame-counter) (-> arg0 unknown-time-frame05)) (seconds 0.3)) + ) + (logtest? sv-104 #x8000) + ) + (>= (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + 0.0 + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) (zero? (logand sv-104 32))) + ) + (set! sv-104 (logior sv-104 256)) + (set! sv-104 (logand -65 sv-104)) + (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-4 1.0) + (vector-float*! arg2 s3-4 (vector-dot (the-as vector (-> sv-88 vector)) s3-4)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (else + ) + ) + ) + (else + (set! sv-96 (logior sv-96 1)) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-my-prim prim-id) 6) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (if (and (logtest? (focus-status board) (-> (the-as process-focusable (-> arg0 process)) focus-status)) + (not (logtest? (focus-status halfpipe) (-> (the-as process-focusable (-> arg0 process)) focus-status))) + (!= (-> arg0 cur-pat mode) 3) + (!= (-> arg0 ground-pat mode) 3) + ) + (vector-reflect-flat-gravity! arg2 (the-as vector (-> sv-88 vector)) sv-84 (-> arg0 dynam gravity-normal)) + (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84) + ) + (vector+! arg2 arg2 sv-84) + (let ((f0-32 (-> arg0 unknown-surface01 slope-change-preserve))) + (when (< 0.0 f0-32) + (let ((v1-223 (new-stack-vector0))) + (let ((f1-25 (vector-dot (-> arg0 unknown-vector14) (the-as vector (-> sv-88 vector))))) + 0.0 + (vector-! v1-223 (the-as vector (-> sv-88 vector)) (vector-float*! v1-223 (-> arg0 unknown-vector14) f1-25)) + ) + (let ((f1-26 (vector-length v1-223))) + f1-26 + (let ((f1-27 f1-26) + (f2-5 (vector-length arg2)) + ) + (if (and (< 409.6 (fabs (- f2-5 f1-27))) (< f2-5 f1-27)) + (vector-normalize! arg2 (lerp-scale f2-5 f1-27 f0-32 0.0 1.0)) + ) + ) + ) + ) + ) + ) + (set! (-> arg0 grount-touch-point w) 0.0) + (when (not (logtest? sv-104 #x400f)) + (set! sv-96 (logior sv-96 2)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 unknown-vector22 quad) (-> sv-84 quad)) + (set! (-> arg0 unknown-float0000) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set! (-> arg0 unknown-time-frame05) (-> self clock frame-counter)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 unknown-vector-kjh1n23k1 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (set! sv-104 (logior sv-104 2048)) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (set! sv-96 (logior sv-96 1024)) + ) + ) + ) + ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)) + (when *debug-segment* + (+! (-> arg0 unknown-halfword00) 1) + (let ((v1-260 + (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-260 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-260 vector quad) (-> arg0 surface-normal quad)) + ) + (let ((v1-263 + (clear-record-tags! *history* (history-channel local-normal) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-263 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-263 vector quad) (-> arg0 local-normal quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 unknown-halfword00) (the-as uint 2)) + vector + quad + ) + (-> arg1 best-other-tri intersect quad) + ) + (let ((v1-269 + (clear-record-tags! *history* (history-channel transv-out) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-269 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-269 vector quad) (-> arg2 quad)) + ) + (let ((v1-272 + (clear-record-tags! *history* (history-channel transv-in) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-272 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-272 vector quad) (-> sv-88 vector 1 quad)) + ) + (let ((v1-275 (clear-record-tags! *history* (history-channel transv) (-> arg0 unknown-halfword00) (the-as uint 2))) + ) + (set! (-> v1-275 origin quad) (-> arg0 trans quad)) + (set! (-> v1-275 vector quad) (-> arg0 transv quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 unknown-halfword00) (the-as uint 2)) + vector + quad + ) + (-> arg0 trans quad) + ) + (let ((v1-281 (clear-record-tags! *history* (history-channel pat) (-> arg0 unknown-halfword00) (the-as uint 2)))) + (set! (-> v1-281 vector x) (the-as float (-> arg0 cur-pat))) + ) + (let ((v1-283 + (clear-record-tags! *history* (history-channel collide-status) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-283 collide-status) (-> arg0 status)) + (set! (-> v1-283 vector z) (the-as float (-> arg0 reaction-flag))) + ) + ) + (the-as collide-status sv-96) + ) + +;; definition for function target-collision-no-reaction +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) + (if (= (-> arg0 unknown-surface00 mode) 'air) + (logior! (-> arg0 reaction-flag) (cshape-reaction-flags csrf05)) + ) + (when *debug-segment* + (+! (-> arg0 unknown-halfword00) 1) + (let ((v1-9 + (clear-record-tags! *history* (history-channel transv-out) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-9 origin quad) (-> arg0 trans quad)) + (set! (-> v1-9 vector quad) (-> arg2 quad)) + ) + (let ((v1-12 + (clear-record-tags! *history* (history-channel transv-in) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-12 origin quad) (-> arg0 trans quad)) + (set! (-> v1-12 vector quad) (-> arg3 quad)) + ) + (let ((v1-15 (clear-record-tags! *history* (history-channel transv) (-> arg0 unknown-halfword00) (the-as uint 2)))) + (set! (-> v1-15 origin quad) (-> arg0 trans quad)) + (set! (-> v1-15 vector quad) (-> arg0 transv quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 unknown-halfword00) (the-as uint 2)) + vector + quad + ) + (-> arg0 trans quad) + ) + (let ((v1-21 + (clear-record-tags! *history* (history-channel collide-status) (-> arg0 unknown-halfword00) (the-as uint 2)) + ) + ) + (set! (-> v1-21 collide-status) (logior (-> arg0 status) (collide-status no-touch))) + (set! (-> v1-21 vector z) (the-as float (-> arg0 reaction-flag))) + ) + ) + 0 + (none) + ) + +;; definition for symbol *collide-edge-board-spec*, type collide-edge-spec +(define *collide-edge-board-spec* (new 'static 'collide-edge-spec + :split-dists (new 'static 'array float 2 1024.0 1433.6) + :outward-offset (new 'static 'vector :x 708.608 :y 13312.0 :w 1.0) + :flags (collide-edge-spec-flags find-adjacent-edge send-event) + :ignore-pat (new 'static 'pat-surface :noentity #x1 :nogrind #x1 :probe #x1) + :max-dist-sqrd-to-outward-pt 67108864.0 + :max-dir-cosa-delta -1.0 + :max-dir-cosa-player -2.0 + :touching-segment #f + :local-cache-fill-box (new 'static 'bounding-box + :min (new 'static 'vector :x -12288.0 :y -11059.2 :z -12288.0 :w 1.0) + :max (new 'static 'vector :x 12288.0 :y 16384.0 :z 12288.0 :w 1.0) + ) + :local-within-reach-box (new 'static 'bounding-box + :min (new 'static 'vector :x -11878.4 :y -2867.2 :z -11878.4 :w 1.0) + :max (new 'static 'vector :x 11878.4 :y 2867.2 :z 11878.4 :w 1.0) + ) + :local-player-spheres (new 'static 'inline-array sphere 12 + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x 2539.52 :y -819.2 :r 1433.6) + (new 'static 'sphere :x -737.28 :y 4096.0 :r 3072.0) + (new 'static 'sphere :x -737.28 :y 6553.6 :r 3072.0) + (new 'static 'sphere :x -737.28 :y 9420.8 :r 3072.0) + (new 'static 'sphere :x 1720.32 :y 3686.4 :r 2949.12) + (new 'static 'sphere :x 1720.32 :y 5734.4 :r 2949.12) + (new 'static 'sphere :x 1720.32 :y 8601.6 :r 2949.12) + ) + ) + ) + +;; definition for function rail-surface-touch +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior rail-surface-touch target () + (when (>= (- (-> self clock frame-counter) (-> self control unknown-time-frame02)) (seconds 0.2)) + (logclear! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags one send-event)) + (set! (-> *collide-edge-board-spec* touching-segment) #f) + (do-edge-grabs *target* *collide-cache* *collide-edge-board-spec*) + (logior! (-> *collide-edge-board-spec* flags) (collide-edge-spec-flags send-event)) + (let ((gp-0 *edge-grab-info*)) + (when (-> gp-0 found-edge?) + (vector-normalize! + (vector-! (-> self control unknown-vector34) (the-as vector (-> gp-0 world-vertex)) (-> gp-0 world-vertex 1)) + 1.0 + ) + (set! (-> self control unknown-vector36 quad) (-> gp-0 hanging-matrix vector 0 quad)) + (send-event + self + 'push-transv + (vector-float*! + (new 'stack-no-clear 'vector) + (-> self control unknown-vector36) + (seek + (vector-length (-> self control unknown-vector18)) + 40960.0 + (* 81920.0 (-> self clock seconds-per-frame)) + ) + ) + 90 + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function gravel-surface-touch +;; WARN: Return type mismatch int vs none. +(defun gravel-surface-touch () + 0 + (none) + ) diff --git a/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc b/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc index 0891cbb410..f92cbf361f 100644 --- a/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc @@ -3,45 +3,45 @@ ;; definition of type surface (deftype surface (basic) - ((name symbol :offset-assert 4) - (turnv float :offset-assert 8) - (turnvv float :offset-assert 12) - (tiltv float :offset-assert 16) - (tiltvv float :offset-assert 20) - (transv-max float :offset-assert 24) - (target-speed float :offset-assert 28) - (seek0 float :offset-assert 32) - (seek90 float :offset-assert 36) - (seek180 float :offset-assert 40) - (fric float :offset-assert 44) - (nonlin-fric-dist float :offset-assert 48) - (slip-factor float :offset-assert 52) - (slide-factor float :offset-assert 56) - (slope-up-factor float :offset-assert 60) - (slope-down-factor float :offset-assert 64) - (slope-slip-angle float :offset-assert 68) - (impact-fric float :offset-assert 72) - (bend-factor float :offset-assert 76) - (bend-speed float :offset-assert 80) - (alignv float :offset-assert 84) - (slope-up-traction float :offset-assert 88) - (align-speed float :offset-assert 92) - (slope-change-preserve float :offset-assert 96) - (turnvf float :offset-assert 100) - (turnvvf float :offset-assert 104) - (tiltvf float :offset-assert 108) - (tiltvvf float :offset-assert 112) - (vel-turn float :offset-assert 116) - (active-hook (function none) :offset 128) - (touch-hook (function none) :offset-assert 132) - (impact-hook function :offset-assert 136) - (mult-hook (function surface surface surface int none) :offset-assert 140) - (exit-hook function :offset-assert 144) - (mode symbol :offset-assert 148) - (flags surface-flag :offset-assert 152) - (data float 30 :offset 8) - (hook function 4 :offset 128) - (dataw uint32 2 :offset 148) + ((name symbol :offset-assert 4) + (turnv float :offset-assert 8) + (turnvv float :offset-assert 12) + (tiltv float :offset-assert 16) + (tiltvv float :offset-assert 20) + (transv-max float :offset-assert 24) + (target-speed float :offset-assert 28) + (seek0 float :offset-assert 32) + (seek90 float :offset-assert 36) + (seek180 float :offset-assert 40) + (fric float :offset-assert 44) + (nonlin-fric-dist float :offset-assert 48) + (slip-factor float :offset-assert 52) + (slide-factor float :offset-assert 56) + (slope-up-factor float :offset-assert 60) + (slope-down-factor float :offset-assert 64) + (slope-slip-angle float :offset-assert 68) + (impact-fric float :offset-assert 72) + (bend-factor float :offset-assert 76) + (bend-speed float :offset-assert 80) + (alignv float :offset-assert 84) + (slope-up-traction float :offset-assert 88) + (align-speed float :offset-assert 92) + (slope-change-preserve float :offset-assert 96) + (turnvf float :offset-assert 100) + (turnvvf float :offset-assert 104) + (tiltvf float :offset-assert 108) + (tiltvvf float :offset-assert 112) + (vel-turn float :offset-assert 116) + (active-hook (function none) :offset 128) + (touch-hook (function none) :offset 132) + (impact-hook (function control-info (pointer float) vector none) :offset 136) + (mult-hook (function surface surface surface int none) :offset-assert 140) + (exit-hook function :offset-assert 144) + (mode symbol :offset-assert 148) + (flags surface-flag :offset-assert 152) + (data float 30 :offset 8) + (hook function 4 :offset 128) + (dataw uint32 2 :offset 148) ) :method-count-assert 9 :size-assert #x9c diff --git a/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc new file mode 100644 index 0000000000..bf51ed14c8 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc @@ -0,0 +1,1885 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function target-land-anim +(defbehavior target-land-anim target () + (cond + ((using-gun? self) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + (-> self draw art-group data 277) + ) + (else + (-> self draw art-group data 278) + ) + ) + ) + (else + (let ((v1-9 (ja-group))) + (if (or (and v1-9 (= v1-9 (-> self draw art-group data 394))) + (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + ) + (-> self draw art-group data 395) + (-> self draw art-group data 24) + ) + ) + ) + ) + ) + +;; definition for function target-stance-anim +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior target-stance-anim target () + (let ((gp-0 22)) + (new 'stack 'ground-tween-info) + (let ((v1-4 (ja-group))) + (cond + ((and v1-4 (or (= v1-4 (-> self draw art-group data 94)) (= v1-4 (-> self draw art-group data 95)))) + (set! gp-0 45) + ) + ((let ((v1-11 (ja-group))) + (and v1-11 (= v1-11 (-> self draw art-group data 61))) + ) + ((lambda :behavior target + () + (cond + ((using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (-> self gun gun-type) + (((pickup-type eco-blue)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 285)) + 0.0 + 0 + 30 + 1.0 + 10.0 + #f + ) + ) + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 285)) + 0.0 + 0 + 30 + 1.0 + 6.0 + #f + ) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 62) :num! (seek! (ja-aframe 48.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 48.0 0))) + ) + (ja-channel-push! 1 (seconds 0.05)) + (let ((gp-2 (target-land-anim))) + (ja-no-eval :group! gp-2 + :num! (seek! (the float (+ (-> (the-as art-joint-anim gp-2) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 62) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 62)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 55.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-18 (ja-group))) + (and v1-18 + (or (= v1-18 (-> self draw art-group data 40)) + (= v1-18 (-> self draw art-group data 248)) + (= v1-18 (-> self draw art-group data 250)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control unknown-surface00) *attack-end-mods*) + (let* ((v1-3 (ja-group)) + (a1-0 (cond + ((and v1-3 (= v1-3 (-> self draw art-group data 248))) + (-> self draw art-group data 249) + ) + (else + (let ((v1-10 (ja-group))) + (cond + ((and v1-10 (= v1-10 (-> self draw art-group data 250))) + (-> self draw art-group data 251) + ) + ((rand-vu-percent? 0.3) + (-> self draw art-group data 42) + ) + (else + (-> self draw art-group data 41) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! a1-0 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-0) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (when (nonzero? (-> self gun track-target-hold-time)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) (-> self gun track-trans) (-> self control trans)) + (vector-y-quaternion! (new-stack-vector0) (-> self control dir-targ)) + ) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (goto cfg-23) + ) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (quaternion-copy! (-> self control dir-targ) (-> self control unknown-quaternion04)) + (label cfg-23) + (set! (-> self control unknown-surface00) *walk-mods*) + (let ((v1-57 (ja-group))) + (when (and (and v1-57 (= v1-57 (-> self draw art-group data 249))) + (and (using-gun? self) (= (-> self gun gun-type) (pickup-type eco-yellow))) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 270) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 270)) frames num-frames) -1))) + :frame-num (ja-aframe 5.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-25 (ja-group))) + (and v1-25 (= v1-25 (-> self draw art-group data 399))) + ) + (ja-no-eval :group! (-> self draw art-group data 400) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 400)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-55 (ja-group))) + (and v1-55 (= v1-55 (-> self draw art-group data 71))) + ) + (ja-no-eval :group! (-> self draw art-group data 72) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 72)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-85 (ja-group))) + (and v1-85 (= v1-85 (-> self draw art-group data 412))) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (ja-channel-push! 1 (seconds 0.07)) + (ja-no-eval :group! (-> self draw art-group data 396) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 396)) frames num-frames) -1))) + :frame-num (ja-aframe 15.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (set! gp-0 0) + ) + ((let ((v1-125 (ja-group))) + (and v1-125 + (or (= v1-125 (-> self draw art-group data 48)) + (= v1-125 (-> self draw art-group data 402)) + (= v1-125 (-> self draw art-group data 409)) + (= v1-125 (-> self draw art-group data 404)) + (= v1-125 (-> self draw art-group data 406)) + (= v1-125 (-> self draw art-group data 413)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self control unknown-float29) (-> self control unknown-float28)) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let* ((v1-5 (ja-group)) + (a1-0 (cond + ((and v1-5 (= v1-5 (-> self draw art-group data 402))) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 403) + ) + ((let ((v1-14 (ja-group))) + (and v1-14 (= v1-14 (-> self draw art-group data 409))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 410) + ) + ((let ((v1-23 (ja-group))) + (and v1-23 (= v1-23 (-> self draw art-group data 404))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 405) + ) + ((let ((v1-32 (ja-group))) + (and v1-32 (= v1-32 (-> self draw art-group data 406))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 407) + ) + (else + (let ((v1-41 (ja-group))) + (cond + ((and v1-41 (= v1-41 (-> self draw art-group data 413))) + (set! (-> self state-flags) (logior (state-flags lleg-still) (-> self state-flags))) + (-> self draw art-group data 414) + ) + ((rand-vu-percent? 0.3) + (-> self draw art-group data 50) + ) + (else + (-> self draw art-group data 49) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! a1-0 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-0) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (seek! (-> self control unknown-float29) 0.0 (-> self clock seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float29) 0.0) + (rot->dir-targ! (-> self control)) + (logclear! (-> self state-flags) (state-flags lleg-still rleg-still lleg-no-ik rleg-no-ik)) + (none) + ) + ) + ) + ((let ((v1-132 (ja-group))) + (and v1-132 (= v1-132 (-> self draw art-group data 273))) + ) + (set! (-> self control unknown-float29) (-> self control unknown-float28)) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let ((a1-18 (-> self draw art-group data 274))) + (ja-no-eval :group! a1-18 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-18) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (seek! (-> self control unknown-float29) 0.0 (-> self clock seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float29) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-166 (ja-group))) + (and v1-166 (= v1-166 (-> self draw art-group data 275))) + ) + (set! (-> self control unknown-float29) (-> self control unknown-float28)) + (set! (-> self control unknown-surface00) *walk-no-turn-mods*) + (let ((a1-21 (-> self draw art-group data 276))) + (ja-no-eval :group! a1-21 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-21) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (seek! (-> self control unknown-float29) 0.0 (-> self clock seconds-per-frame)) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-surface00) *walk-mods*) + (set! (-> self control unknown-float29) 0.0) + (rot->dir-targ! (-> self control)) + ) + ((let ((v1-200 (ja-group))) + (and (and v1-200 (or (= v1-200 (-> self draw art-group data 277)) (= v1-200 (-> self draw art-group data 278)))) + (not (using-gun? self)) + ) + ) + (set! gp-0 60) + ) + ((let ((v1-208 (ja-group))) + (and v1-208 (or (= v1-208 (-> self draw art-group data 20)) + (= v1-208 (-> self draw art-group data 21)) + (= v1-208 (-> self draw art-group data 302)) + (= v1-208 (-> self draw art-group data 59)) + (= v1-208 (-> self draw art-group data 282)) + ) + ) + ) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! gp-0 30) + ) + (else + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 19) + :num! (seek! 0.0 1.2) + :frame-num (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 19)) frames num-frames) -1)) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! 0.0 1.2)) + ) + (set! gp-0 12) + ) + ) + ) + ((let ((v1-240 (ja-group))) + (or (and (and v1-240 (or (= v1-240 (-> self draw art-group data 12)) (= v1-240 (-> self draw art-group data 392)))) + (begin (set! gp-0 45) (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp)))) + (not (using-gun? self)) + ) + (let ((v1-253 (ja-group))) + (and v1-253 (or (= v1-253 (-> self draw art-group data 17)) + (= v1-253 (-> self draw art-group data 18)) + (= v1-253 (-> self draw art-group data 43)) + (= v1-253 (-> self draw art-group data 44)) + ) + ) + ) + ) + ) + (cond + ((and (rand-vu-percent? 0.3) + (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! (-> self draw art-group data 6) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 6)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (let* ((v1-288 (ja-group)) + (f30-1 + (cond + ((and v1-288 (or (= v1-288 (-> self draw art-group data 12)) (= v1-288 (-> self draw art-group data 392)))) + (let ((f0-65 (+ 50.0 (* 0.8333333 (+ -25.0 (ja-aframe-num 0)))))) + (- f0-65 (* (the float (the int (/ f0-65 50.0))) 50.0)) + ) + ) + (else + 0.0 + ) + ) + ) + ) + (set! gp-0 45) + (ja-channel-push! 1 (the-as time-frame gp-0)) + (ja :group! (-> self draw art-group data 4) :num! (identity (ja-aframe f30-1 0))) + ) + (dotimes (s5-1 3) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja :num-func num-func-identity :frame-num 0.0) + ) + (ja-no-eval :group! (-> self draw art-group data 3) :num! (seek! (ja-aframe 82.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 82.0 0))) + ) + (when (not (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak)))) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (ja-aframe 142.0 0)) + :frame-num (ja-aframe 82.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 142.0 0))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1))) + :frame-num (ja-aframe 142.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ) + ((let ((v1-378 (ja-group))) + (and (and v1-378 (= v1-378 (-> self draw art-group data 12))) (>= (-> self control unknown-float05) 5734.4)) + ) + (set! gp-0 45) + ) + ) + ) + (if (and (using-gun? self) (-> self next-state) (= (-> self next-state name) 'target-stance)) + (go target-gun-stance) + ) + (let ((v1-395 (ja-group))) + (if (not (and (and v1-395 (= v1-395 (-> self draw art-group data 5))) (= (ja-group-size) 1))) + (ja-channel-push! 1 (the-as time-frame gp-0)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (ja :group! (-> self draw art-group data 396)) + (ja :group! (-> self draw art-group data 5)) + ) + (until #f + (suspend) + (ja :num! (loop!)) + (if (can-play-stance-amibent?) + (go target-stance-ambient) + ) + ) + #f + (none) + ) + +;; definition for function target-stance-push +;; WARN: Return type mismatch int vs none. +(defbehavior target-stance-push target ((arg0 int)) + (let ((v1-2 (ja-group))) + (cond + ((or (and (and v1-2 (= v1-2 (-> self draw art-group data 12))) + (< 0.5 (-> self skel root-channel 6 frame-interp (-> self skel active-frame-interp))) + ) + (let ((v1-14 (ja-group))) + (and v1-14 + (or (= v1-14 (-> self draw art-group data 17)) + (= v1-14 (-> self draw art-group data 18)) + (= v1-14 (-> self draw art-group data 43)) + (= v1-14 (-> self draw art-group data 44)) + ) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.15)) + (ja-no-eval :group! (-> self draw art-group data 4) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 4)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 3) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 3)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-push! arg0 (seconds 0.15)) + ) + ((let ((v1-68 (ja-group))) + (and (and v1-68 (or (= v1-68 (-> self draw art-group data 28)) + (= v1-68 (-> self draw art-group data 24)) + (= v1-68 (-> self draw art-group data 277)) + (= v1-68 (-> self draw art-group data 278)) + (= v1-68 (-> self draw art-group data 395)) + ) + ) + (not (ja-max? 0)) + ) + ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + (ja-channel-push! arg0 (seconds 0.075)) + ) + ((let ((v1-84 (ja-group))) + (not (and (and v1-84 (= v1-84 (-> self draw art-group data 5))) (= (ja-group-size) 1))) + ) + (ja-channel-push! arg0 (seconds 0.075)) + ) + ) + ) + (none) + ) + +;; definition for function target-falling-anim +;; INFO: Used lq/sq +(defbehavior target-falling-anim target ((arg0 int) (arg1 time-frame)) + (let ((v1-2 (ja-group))) + (cond + ((and v1-2 (or (= v1-2 (-> self draw art-group data 27)) + (= v1-2 (-> self draw art-group data 51)) + (= v1-2 (-> self draw art-group data 267)) + ) + ) + ) + ((let ((v1-8 (ja-group))) + (and v1-8 (or (= v1-8 (-> self draw art-group data 33)) (= v1-8 (-> self draw art-group data 34)))) + ) + (ja-channel-push! 1 (seconds 0.15)) + (ja-no-eval :group! (-> self draw art-group data 39) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 39)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-37 (ja-group))) + (and v1-37 (= v1-37 (-> self draw art-group data 39))) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-push! 1 (seconds 0.15)) + ) + (else + (let ((v1-52 (ja-group))) + (cond + ((and v1-52 (= v1-52 (-> self draw art-group data 61))) + (let ((s5-0 (-> self clock frame-counter))) + (while (or (= arg0 -1) (< (- (-> self clock frame-counter) s5-0) arg0)) + (when (>= (- (-> self clock frame-counter) s5-0) (seconds 0.01)) + (let ((v1-62 (ja-group))) + (when (not (and v1-62 (= v1-62 (-> self draw art-group data 27)))) + (ja-channel-push! 1 (seconds 0.1)) + (ja :group! (-> self draw art-group data 27) :num! min) + ) + ) + ) + (let ((v1-71 (new-stack-vector0)) + (f0-12 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-71 (-> self control transv) (vector-float*! v1-71 (-> self control dynam gravity-normal) f0-12)) + (let* ((f2-0 (vector-length v1-71)) + (f1-2 f2-0) + (f2-1 (* 0.9 f2-0)) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-12) + (vector-float*! v1-71 v1-71 (/ f2-1 f1-2)) + ) + ) + ) + (suspend) + (let ((v1-74 (ja-group))) + (if (and v1-74 (= v1-74 (-> self draw art-group data 27))) + (ja :num! (loop!)) + (ja :num! (seek!)) + ) + ) + ) + ) + (return #f) + ) + (else + (ja-channel-push! 1 arg1) + (ja :group! (-> self draw art-group data 27)) + (while (!= (-> self skel root-channel 0) (-> self skel channel)) + (suspend) + ) + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 27) :num! (loop!) :frame-num 0.0) + (let ((s5-1 (-> self clock frame-counter))) + (while (or (= arg0 -1) (and (< (- (-> self clock frame-counter) s5-1) arg0) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + ) + (suspend) + (ja :group! (-> self draw art-group data 27) :num! (loop!)) + ) + ) + #f + ) + +;; definition for function target-falling-anim-trans +;; WARN: Return type mismatch int vs none. +(defbehavior target-falling-anim-trans target () + (let ((v1-2 (ja-group))) + (cond + ((not (and v1-2 (or (= v1-2 (-> self draw art-group data 27)) + (= v1-2 (-> self draw art-group data 24)) + (= v1-2 (-> self draw art-group data 277)) + (= v1-2 (-> self draw art-group data 278)) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.33)) + (ja :group! (-> self draw art-group data 27)) + ) + ((and (logtest? (-> self control status) (collide-status on-surface)) + (let ((v1-15 (ja-group))) + (and (not (and v1-15 (= v1-15 (-> self draw art-group data 24)))) + (zero? (logand (-> self control status) (collide-status on-water))) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.02)) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim (target-land-anim))) + ) + ((let ((v1-23 (ja-group))) + (and v1-23 (= v1-23 (-> self draw art-group data 27))) + ) + (ja :num! (loop!)) + ) + ((let ((v1-33 (ja-group))) + (and v1-33 (or (= v1-33 (-> self draw art-group data 24)) + (= v1-33 (-> self draw art-group data 277)) + (= v1-33 (-> self draw art-group data 278)) + ) + ) + ) + (ja :num! (seek!)) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-walk-anim +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Stack slot offset 16 signed mismatch +;; WARN: Return type mismatch symbol vs none. +(defbehavior target-walk-anim target ((arg0 int)) + (local-vars (sv-16 float)) + (let ((f24-0 0.0) + (f26-0 (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control unknown-float05)))))) + (f30-0 0.0) + (f28-0 0.0) + (s5-0 #f) + ) + (let ((v1-6 (ja-group))) + (cond + ((and v1-6 (= v1-6 (-> self draw art-group data 22))) + (set! f26-0 1.0) + (ja-channel-push! 7 (seconds 0.05)) + ) + ((let ((v1-12 (ja-group))) + (and v1-12 (or (= v1-12 (-> self draw art-group data 59)) (= v1-12 (-> self draw art-group data 282)))) + ) + (ja-channel-push! 7 (seconds 0.075)) + (set! f26-0 1.0) + ) + ((let ((v1-19 (ja-group))) + (and v1-19 (= v1-19 (-> self draw art-group data 40))) + ) + ((lambda :behavior target + () + (let ((f30-0 (fmax 0.8 (fmin 1.0 (* 0.000048828126 (-> self control unknown-float05)))))) + (cond + ((and (rand-vu-percent? 0.3) (< 20480.0 (-> self control unknown-float05))) + (ja-no-eval :group! (-> self draw art-group data 42) :num! (seek! (ja-aframe 29.0 0) f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 29.0 0) f30-0)) + ) + (ja-no-eval :group! (-> self draw art-group data 44) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 44)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 41) :num! (seek! (ja-aframe 29.0 0) f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 29.0 0) f30-0)) + ) + (ja-no-eval :group! (-> self draw art-group data 43) + :num! (seek! + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 43)) frames num-frames) -1)) + f30-0 + ) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + (ja-channel-push! 7 (seconds 0.05)) + (none) + ) + ) + (set! f26-0 1.0) + (set! f24-0 30.0) + ) + ((let ((v1-27 (ja-group))) + (and v1-27 (or (= v1-27 (-> self draw art-group data 408)) (= v1-27 (-> self draw art-group data 411)))) + ) + (set! f26-0 1.0) + (ja-channel-push! 7 (seconds 0.3)) + ) + ((let ((v1-33 (ja-group))) + (and v1-33 (or (= v1-33 (-> self draw art-group data 48)) + (= v1-33 (-> self draw art-group data 49)) + (= v1-33 (-> self draw art-group data 273)) + (= v1-33 (-> self draw art-group data 275)) + (= v1-33 (-> self draw art-group data 403)) + (= v1-33 (-> self draw art-group data 410)) + (= v1-33 (-> self draw art-group data 405)) + (= v1-33 (-> self draw art-group data 407)) + (= v1-33 (-> self draw art-group data 414)) + ) + ) + ) + (set! f26-0 1.0) + (set! f24-0 30.0) + (ja-channel-push! 7 (seconds 0.15)) + ) + ((let ((v1-40 (ja-group))) + (and (and v1-40 (or (= v1-40 (-> self draw art-group data 12)) + (= v1-40 (-> self draw art-group data 261)) + (= v1-40 (-> self draw art-group data 392)) + ) + ) + (= (ja-group-size) 7) + ) + ) + (set! f24-0 (ja-aframe-num 0)) + (set! f26-0 (-> self control unknown-float002)) + (set! f30-0 (-> self control unknown-float-n12iuh3n1)) + (set! f28-0 (-> self control unknown-float-ki1jhbn23hj)) + ) + ((let ((v1-50 (ja-group))) + (and v1-50 (= v1-50 (-> self draw art-group data 108))) + ) + (set! f24-0 (ja-aframe-num 0)) + (ja-channel-push! 7 (seconds 0.1)) + ) + ((let ((v1-55 (ja-group))) + (and v1-55 (= v1-55 (-> self draw art-group data 94))) + ) + (set! f24-0 (ja-aframe-num 0)) + (ja-channel-push! 7 (seconds 0.05)) + ) + ((let ((v1-60 (ja-group))) + (and (or (and v1-60 + (or (= v1-60 (-> self draw art-group data 27)) + (= v1-60 (-> self draw art-group data 61)) + (= v1-60 (-> self draw art-group data 47)) + (= v1-60 (-> self draw art-group data 51)) + (= v1-60 (-> self draw art-group data 267)) + (= v1-60 (-> self draw art-group data 54)) + ) + ) + (let ((v1-66 (ja-group))) + (and (and v1-66 (or (= v1-66 (-> self draw art-group data 23)) (= v1-66 (-> self draw art-group data 394)))) + (< 30.0 (ja-aframe-num 0)) + ) + ) + ) + (< 12288.0 (-> self control unknown-float05)) + ) + ) + ((lambda :behavior target + () + (let ((gp-0 (ja-group)) + (f30-0 (-> self control ground-impact-vel)) + ) + (let ((v1-7 (ja-group))) + (if (and v1-7 (or (= v1-7 (-> self draw art-group data 61)) (= v1-7 (-> self draw art-group data 47)))) + (ja-channel-push! 1 (seconds 0.05)) + (ja-channel-set! 1) + ) + ) + (cond + ((< (if (= gp-0 (-> self draw art-group data 23)) + 77824.0 + 102400.0 + ) + f30-0 + ) + (ja-no-eval :group! (-> self draw art-group data 17) :num! (seek! (ja-aframe 3.0 0) 1.00001) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 1.00001)) + ) + ) + ((< (if (= gp-0 (-> self draw art-group data 23)) + 61440.0 + 102400.0 + ) + f30-0 + ) + (ja-no-eval :group! (-> self draw art-group data 17) + :num! (seek! (ja-aframe 3.0 0) 1.00001) + :frame-num (ja-aframe -1.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 3.0 0) 1.00001)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 18) :num! (seek! (ja-aframe 4.0 0) 1.00001) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 4.0 0) 1.00001)) + ) + ) + ) + ) + (when (using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (-> self gun gun-type) + (((pickup-type eco-blue)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 262)) + 16.0 + 90 + 60 + 1.0 + 0.0 + #f + ) + ) + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 299)) + 16.0 + 90 + 60 + 1.0 + 0.0 + #f + ) + ) + ) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max (/ (* (fmax 20480.0 (-> self control unknown-float05)) (-> self clock seconds-per-frame)) + (/ (-> *TARGET-bank* run-up-cycle-dist) (-> *TARGET-bank* run-cycle-length)) + ) + ) + ) + ) + (ja-channel-push! 7 (seconds 0.1)) + (none) + ) + ) + (set! f24-0 30.0) + (set! f26-0 1.0) + ) + ((let ((v1-78 (ja-group))) + (and v1-78 (or (= v1-78 (-> self draw art-group data 23)) (= v1-78 (-> self draw art-group data 394)))) + ) + (ja-channel-push! 7 (seconds 0.05)) + (set! s5-0 #t) + ) + (else + (let ((v1-84 (ja-group))) + (cond + ((and v1-84 (= v1-84 (-> self draw art-group data 71))) + (ja-channel-push! 7 (seconds 0.15)) + ) + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! f24-0 55.0) + (ja-channel-push! 7 (seconds 0.1)) + ) + (else + (ja-channel-push! 7 (seconds 0.05)) + ) + ) + ) + ) + ) + ) + (set! (-> self skel root-channel 3 command) (joint-control-command push)) + (set! (-> self skel root-channel 6 command) (joint-control-command stack)) + (ja :group! (-> self draw art-group data 12)) + (let ((f24-1 (ja-aframe f24-0 0))) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (let ((s4-0 (-> self skel root-channel 0))) + (let ((f0-3 0.0)) + (set! (-> s4-0 frame-interp 1) f0-3) + (set! (-> s4-0 frame-interp 0) f0-3) + ) + (set! (-> s4-0 dist) 12288.0) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> self draw art-group data 392)) + num-func-identity + ) + (set! (-> s4-0 frame-num) f24-1) + ) + ) + ((and (using-gun? self) + (or (= (-> self gun gun-type) (pickup-type eco-yellow)) (= (-> self gun gun-type) (pickup-type eco-blue))) + ) + (let ((s4-1 (-> self skel root-channel 0))) + (let ((f0-5 0.0)) + (set! (-> s4-1 frame-interp 1) f0-5) + (set! (-> s4-1 frame-interp 0) f0-5) + ) + (set! (-> s4-1 dist) 12288.0) + (joint-control-channel-group-eval! + s4-1 + (the-as art-joint-anim (-> self draw art-group data 261)) + num-func-identity + ) + (set! (-> s4-1 frame-num) f24-1) + ) + ) + (else + (let ((s4-2 (-> self skel root-channel 0))) + (let ((f0-7 0.0)) + (set! (-> s4-2 frame-interp 1) f0-7) + (set! (-> s4-2 frame-interp 0) f0-7) + ) + (set! (-> s4-2 dist) (-> *TARGET-bank* walk-cycle-dist)) + (joint-control-channel-group-eval! + s4-2 + (the-as art-joint-anim (-> self draw art-group data 12)) + num-func-identity + ) + (set! (-> s4-2 frame-num) f24-1) + ) + ) + ) + (let ((s4-3 (-> self skel root-channel 1))) + (let ((f0-9 0.0)) + (set! (-> s4-3 frame-interp 1) f0-9) + (set! (-> s4-3 frame-interp 0) f0-9) + ) + (set! (-> s4-3 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (joint-control-channel-group-eval! + s4-3 + (the-as art-joint-anim (-> self draw art-group data 14)) + num-func-identity + ) + (set! (-> s4-3 frame-num) f24-1) + ) + (let ((s4-4 (-> self skel root-channel 2))) + (let ((f0-11 0.0)) + (set! (-> s4-4 frame-interp 1) f0-11) + (set! (-> s4-4 frame-interp 0) f0-11) + ) + (set! (-> s4-4 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (joint-control-channel-group-eval! + s4-4 + (the-as art-joint-anim (-> self draw art-group data 16)) + num-func-identity + ) + (set! (-> s4-4 frame-num) f24-1) + ) + (let ((s4-5 (-> self skel root-channel 4))) + (let ((f0-13 0.0)) + (set! (-> s4-5 frame-interp 1) f0-13) + (set! (-> s4-5 frame-interp 0) f0-13) + ) + (set! (-> s4-5 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (joint-control-channel-group-eval! + s4-5 + (the-as art-joint-anim (-> self draw art-group data 9)) + num-func-identity + ) + (set! (-> s4-5 frame-num) f24-1) + ) + (let ((s4-6 (-> self skel root-channel 5))) + (let ((f0-15 0.0)) + (set! (-> s4-6 frame-interp 1) f0-15) + (set! (-> s4-6 frame-interp 0) f0-15) + ) + (set! (-> s4-6 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (joint-control-channel-group-eval! + s4-6 + (the-as art-joint-anim (-> self draw art-group data 11)) + num-func-identity + ) + (set! (-> s4-6 frame-num) f24-1) + ) + (cond + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (let ((s4-7 (-> self skel root-channel 3))) + (let ((f0-17 0.0)) + (set! (-> s4-7 frame-interp 1) f0-17) + (set! (-> s4-7 frame-interp 0) f0-17) + ) + (set! (-> s4-7 dist) 27033.6) + (joint-control-channel-group-eval! + s4-7 + (the-as art-joint-anim (-> self draw art-group data 393)) + num-func-identity + ) + (set! (-> s4-7 frame-num) f24-1) + ) + ) + ((using-gun? self) + (let ((s4-8 (-> self skel root-channel 3))) + (let ((f0-19 0.0)) + (set! (-> s4-8 frame-interp 1) f0-19) + (set! (-> s4-8 frame-interp 0) f0-19) + ) + (set! (-> s4-8 dist) (-> *TARGET-bank* run-cycle-dist)) + (joint-control-channel-group-eval! + s4-8 + (the-as art-joint-anim (-> self draw art-group data 299)) + num-func-identity + ) + (set! (-> s4-8 frame-num) f24-1) + ) + ) + (else + (let ((s4-9 (-> self skel root-channel 3))) + (let ((f0-21 0.0)) + (set! (-> s4-9 frame-interp 1) f0-21) + (set! (-> s4-9 frame-interp 0) f0-21) + ) + (set! (-> s4-9 dist) (-> *TARGET-bank* run-cycle-dist)) + (joint-control-channel-group-eval! + s4-9 + (the-as art-joint-anim (-> self draw art-group data 7)) + num-func-identity + ) + (set! (-> s4-9 frame-num) f24-1) + ) + ) + ) + ) + (let ((s4-10 (-> self clock frame-counter)) + (f24-2 + (if (and (using-gun? self) + (or (= (-> self gun gun-type) (pickup-type eco-yellow)) (= (-> self gun gun-type) (pickup-type eco-blue))) + ) + 0.0 + 1.0 + ) + ) + ) + (until (and (>= arg0 0) (>= (- (-> self clock frame-counter) s4-10) arg0)) + (let ((f20-0 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control unknown-float17))))) + (f22-1 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control unknown-float18))))) + ) + (set! sv-16 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control))))) + (set! f26-0 (seek + f26-0 + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control unknown-float05))))) + (* 2.0 (-> self clock seconds-per-frame)) + ) + ) + (if (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (set! f26-0 (seek + f26-0 + (lerp-scale f26-0 (* 0.7 f26-0) sv-16 1820.4445 3640.889) + (* 2.0 (-> self clock seconds-per-frame)) + ) + ) + ) + (cond + ((< 0.5 f26-0) + (let ((v1-206 (-> self skel effect))) + (set! (-> v1-206 channel-offset) 3) + ) + 0 + (logclear! (-> self state-flags) (state-flags lleg-no-ik rleg-no-ik)) + ) + (else + (let ((v1-211 (-> self skel effect))) + (set! (-> v1-211 channel-offset) 0) + ) + 0 + (set! (-> self state-flags) (logior (state-flags lleg-no-ik rleg-no-ik) (-> self state-flags))) + ) + ) + (let ((f0-37 (fabs (- f20-0 f30-0)))) + (set! f30-0 (seek f30-0 f20-0 (fmax 0.05 (fmin 0.2 (* 0.25 f0-37))))) + ) + (let ((f0-42 (fabs (- f22-1 f28-0)))) + (set! f28-0 (seek f28-0 f22-1 (fmax 0.05 (fmin 0.2 (* 0.25 f0-42))))) + ) + ) + (set! (-> self control unknown-float-n12iuh3n1) f30-0) + (set! (-> self control unknown-float-ki1jhbn23hj) f28-0) + (set! (-> self control unknown-float002) f26-0) + (cond + ((>= f30-0 0.0) + (let ((v1-228 (-> self skel root-channel 1))) + (let ((f0-48 (* (fabs f30-0) f24-2))) + (set! (-> v1-228 frame-interp 1) f0-48) + (set! (-> v1-228 frame-interp 0) f0-48) + ) + (set! (-> v1-228 dist) (-> *TARGET-bank* walk-up-cycle-dist)) + (set! (-> v1-228 frame-group) (the-as art-joint-anim (-> self draw art-group data 13))) + ) + (let ((v1-231 (-> self skel root-channel 4))) + (let ((f0-50 (fabs f30-0))) + (set! (-> v1-231 frame-interp 1) f0-50) + (set! (-> v1-231 frame-interp 0) f0-50) + ) + (set! (-> v1-231 dist) (-> *TARGET-bank* run-up-cycle-dist)) + (set! (-> v1-231 frame-group) (the-as art-joint-anim (-> self draw art-group data 8))) + ) + ) + (else + (let ((v1-234 (-> self skel root-channel 1))) + (let ((f0-53 (* (fabs f30-0) f24-2))) + (set! (-> v1-234 frame-interp 1) f0-53) + (set! (-> v1-234 frame-interp 0) f0-53) + ) + (set! (-> v1-234 dist) (-> *TARGET-bank* walk-down-cycle-dist)) + (set! (-> v1-234 frame-group) (the-as art-joint-anim (-> self draw art-group data 14))) + ) + (let ((v1-237 (-> self skel root-channel 4))) + (let ((f0-55 (fabs f30-0))) + (set! (-> v1-237 frame-interp 1) f0-55) + (set! (-> v1-237 frame-interp 0) f0-55) + ) + (set! (-> v1-237 dist) (-> *TARGET-bank* run-down-cycle-dist)) + (set! (-> v1-237 frame-group) (the-as art-joint-anim (-> self draw art-group data 9))) + ) + ) + ) + (cond + ((>= f28-0 0.0) + (let ((v1-240 (-> self skel root-channel 2))) + (let ((f0-59 (* (fabs f28-0) f24-2))) + (set! (-> v1-240 frame-interp 1) f0-59) + (set! (-> v1-240 frame-interp 0) f0-59) + ) + (set! (-> v1-240 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-240 frame-group) (the-as art-joint-anim (-> self draw art-group data 15))) + ) + (let ((v1-243 (-> self skel root-channel 5))) + (let ((f0-61 (fabs f28-0))) + (set! (-> v1-243 frame-interp 1) f0-61) + (set! (-> v1-243 frame-interp 0) f0-61) + ) + (set! (-> v1-243 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! (-> v1-243 frame-group) (the-as art-joint-anim (-> self draw art-group data 10))) + ) + ) + (else + (let ((v1-246 (-> self skel root-channel 2))) + (let ((f0-64 (* (fabs f28-0) f24-2))) + (set! (-> v1-246 frame-interp 1) f0-64) + (set! (-> v1-246 frame-interp 0) f0-64) + ) + (set! (-> v1-246 dist) (-> *TARGET-bank* walk-side-cycle-dist)) + (set! (-> v1-246 frame-group) (the-as art-joint-anim (-> self draw art-group data 16))) + ) + (let ((v1-249 (-> self skel root-channel 5))) + (let ((f0-66 (fabs f28-0))) + (set! (-> v1-249 frame-interp 1) f0-66) + (set! (-> v1-249 frame-interp 0) f0-66) + ) + (set! (-> v1-249 dist) (-> *TARGET-bank* run-side-cycle-dist)) + (set! (-> v1-249 frame-group) (the-as art-joint-anim (-> self draw art-group data 11))) + ) + ) + ) + (let ((v1-252 (-> self skel root-channel 6))) + (set! (-> v1-252 frame-interp 1) f26-0) + (set! (-> v1-252 frame-interp 0) f26-0) + ) + (let* ((f1-14 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) + (f0-70 (/ (-> self control unknown-float05) (* 60.0 (/ f1-14 (-> *TARGET-bank* run-cycle-length))))) + ) + (ja :num! (loop! f0-70)) + ) + (ja :chan 1 :num! (chan 0)) + (ja :chan 2 :num! (chan 0)) + (ja :chan 3 :num! (chan 0)) + (ja :chan 4 :num! (chan 0)) + (ja :chan 5 :num! (chan 0)) + (if (and s5-0 (!= (-> self skel root-channel 0) (-> self skel channel))) + (ja-blend-eval) + ) + (suspend) + ) + ) + ) + (none) + ) + +;; definition for function target-hit-ground-flop-anim +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-hit-ground-flop-anim target ((arg0 symbol) (arg1 symbol)) + (let ((f30-0 (if (= arg0 'swim) + 0.4 + 1.0 + ) + ) + ) + (if (using-gun? self) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 288)) + 0.0 + 0 + 30 + 1.0 + 0.0 + #f + ) + ) + (ja-channel-set! 1) + (let ((s5-0 (-> self skel root-channel 0))) + (set! (-> s5-0 frame-group) (the-as art-joint-anim (-> self draw art-group data 54))) + (set! (-> s5-0 param 0) + (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 54)) frames num-frames) -1)) + ) + (let ((f30-1 (seek f30-0 1.0 (* 0.5 (-> self clock seconds-per-frame))))) + (set! (-> s5-0 param 1) f30-1) + (set! (-> s5-0 frame-num) 0.0) + (joint-control-channel-group! s5-0 (the-as art-joint-anim (-> self draw art-group data 54)) num-func-seek!) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! + (-> self align) + (if arg1 + (align-opts adjust-y-vel) + (align-opts adjust-y-vel adjust-xz-vel) + ) + 1.0 + 1.0 + 1.5 + ) + (when (and (>= 25.0 (ja-aframe-num 0)) + (and (>= (ja-aframe-num 0) 21.0) + (and (-> self next-state) (= (-> self next-state name) 'target-flop-hit-ground)) + (!= (-> self tobot?) 'tobot) + (!= (-> self control unknown-spool-anim00) 'stuck) + ) + ) + (when (and (cpad-hold? (-> self control cpad number) x) (can-jump? #f) (!= (-> self control ground-pat event) 7)) + (let ((v1-55 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-55 (-> self control transv) (vector-float*! v1-55 (-> self control dynam gravity-normal) f0-8)) + ) + (let* ((f0-9 (vector-length v1-55)) + (f1-3 f0-9) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-55 v1-55 (/ f0-9 f1-3)) + ) + ) + ) + (set! (-> self gun surpress-time) (+ (-> self clock frame-counter) (seconds 0.4))) + (if (using-gun? self) + (go + target-high-jump + (-> *TARGET-bank* flop-jump-height-min) + (-> *TARGET-bank* flop-jump-height-max) + (if arg1 + 'flop + 'flop-forward + ) + ) + (go + target-duck-high-jump + (-> *TARGET-bank* flop-jump-height-min) + (-> *TARGET-bank* flop-jump-height-max) + (if arg1 + 'flop + 'flop-forward + ) + ) + ) + ) + ) + (suspend) + (let ((s5-1 (-> self skel root-channel 0))) + (set! (-> s5-1 param 0) (the float (+ (-> s5-1 frame-group frames num-frames) -1))) + (set! f30-1 (seek f30-1 1.0 (* 0.5 (-> self clock seconds-per-frame)))) + (set! (-> s5-1 param 1) f30-1) + (joint-control-channel-group-eval! s5-1 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-hit-ground-anim +(defbehavior target-hit-ground-anim target ((arg0 symbol) (arg1 symbol)) + (cond + ((logtest? (water-flags swimming) (-> self water flags)) + ) + ((let ((v1-5 (ja-group))) + (and v1-5 (or (= v1-5 (-> self draw art-group data 52)) + (= v1-5 (-> self draw art-group data 53)) + (= v1-5 (-> self draw art-group data 55)) + (= v1-5 (-> self draw art-group data 56)) + ) + ) + ) + (target-hit-ground-flop-anim arg0 arg1) + ) + ((and (= (-> self control ground-pat material) (pat-material ice)) + (< 16384.0 (-> self control unknown-float05)) + ) + ) + ((let ((v1-20 (ja-group))) + (or (and v1-20 (or (= v1-20 (-> self draw art-group data 27)) + (= v1-20 (-> self draw art-group data 394)) + (= v1-20 (-> self draw art-group data 58)) + ) + ) + (let ((v1-26 (ja-group))) + (and (and v1-26 (= v1-26 (-> self draw art-group data 23))) + (or (>= (ja-aframe-num 0) 38.0) + (and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + ) + ) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.02)) + (let ((a1-4 (target-land-anim))) + (ja-no-eval :group! a1-4 + :num! (seek! (the float (+ (-> (the-as art-joint-anim a1-4) frames num-frames) -1))) + :frame-num 0.0 + ) + ) + (until (ja-done? 0) + (let ((v1-46 (ja-group))) + (if (or (and (and v1-46 (or (= v1-46 (-> self draw art-group data 277)) (= v1-46 (-> self draw art-group data 278)))) + (not (using-gun? self)) + ) + (let ((v1-53 (ja-group))) + (and (and v1-53 (= v1-53 (-> self draw art-group data 24))) + (and (>= (ja-aframe-num 0) 60.0) (using-gun? self)) + ) + ) + ) + (goto cfg-78) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + (label cfg-78) + ) + ((let ((v1-70 (ja-group))) + (and (and v1-70 (or (= v1-70 (-> self draw art-group data 23)) (= v1-70 (-> self draw art-group data 394)))) + (>= (ja-aframe-num 0) 35.0) + (not (using-gun? self)) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-set! 1) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 50.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-128 (ja-group))) + (and v1-128 + (or (= v1-128 (-> self draw art-group data 23)) + (= v1-128 (-> self draw art-group data 30)) + (= v1-128 (-> self draw art-group data 394)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-set! 1) + (cond + ((using-gun? self) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (ja-aframe 41.0 0)) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 41.0 0))) + ) + (ja-no-eval :num! (seek! 0.0)) + (ja-channel-push! 1 (seconds 0.1)) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + (ja-no-eval :group! (-> self draw art-group data 277) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 277)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (if (not (using-gun? self)) + (goto cfg-19) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 278) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 278)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (if (not (using-gun? self)) + (goto cfg-19) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (label cfg-19) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) frames num-frames) -1))) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 50.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-134 (ja-group))) + (and v1-134 + (or (= v1-134 (-> self draw art-group data 66)) + (= v1-134 (-> self draw art-group data 65)) + (= v1-134 (-> self draw art-group data 67)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (let* ((v1-142 (ja-group)) + (f30-0 (if (and v1-142 (= v1-142 (-> self draw art-group data 67))) + 24576.0 + -24576.0 + ) + ) + ) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 28)) frames num-frames) -1))) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (set-forward-vel f30-0) + (suspend) + (ja :num! (seek!)) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 50.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-195 (ja-group))) + (and v1-195 + (or (= v1-195 (-> self draw art-group data 23)) + (= v1-195 (-> self draw art-group data 394)) + (= v1-195 (-> self draw art-group data 45)) + (= v1-195 (-> self draw art-group data 46)) + (= v1-195 (-> self draw art-group data 47)) + (= v1-195 (-> self draw art-group data 54)) + (= v1-195 (-> self draw art-group data 51)) + (= v1-195 (-> self draw art-group data 267)) + (= v1-195 (-> self draw art-group data 279)) + (= v1-195 (-> self draw art-group data 171)) + ) + ) + ) + ((lambda :behavior target + () + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.04)) + (cond + ((using-gun? self) + (ja-no-eval :group! (-> self draw art-group data 28) + :num! (seek! (ja-aframe 41.0 0)) + :frame-num (ja-aframe 38.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 41.0 0))) + ) + (ja-no-eval :num! (seek! 0.0)) + (ja-channel-push! 1 (seconds 0.1)) + (case (-> self gun gun-type) + (((pickup-type eco-red) (pickup-type eco-dark)) + (ja-no-eval :group! (-> self draw art-group data 277) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 277)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 278) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 278)) frames num-frames) -1))) + :frame-num (ja-aframe 64.0 0) + ) + (until (ja-done? 0) + (ja-blend-eval) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) + (ja-no-eval :group! (-> self draw art-group data 395) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 395)) frames num-frames) -1))) + :frame-num (ja-aframe 42.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-no-eval :group! (-> self draw art-group data 24) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 24)) frames num-frames) -1))) + :frame-num (ja-aframe 42.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + ) + ) + ((let ((v1-201 (ja-group))) + (and v1-201 (or (= v1-201 (-> self draw art-group data 321)) (= v1-201 (-> self draw art-group data 322)))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.04)) + (ja-no-eval :group! (-> self draw art-group data 323) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 323)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-232 (ja-group))) + (and v1-232 (or (= v1-232 (-> self draw art-group data 24)) + (= v1-232 (-> self draw art-group data 277)) + (= v1-232 (-> self draw art-group data 278)) + (= v1-232 (-> self draw art-group data 323)) + (= v1-232 (-> self draw art-group data 331)) + (= v1-232 (-> self draw art-group data 342)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (suspend) + (ja-eval) + ) + ) + ((let ((v1-248 (ja-group))) + (and v1-248 + (or (= v1-248 (-> self draw art-group data 328)) + (= v1-248 (-> self draw art-group data 330)) + (= v1-248 (-> self draw art-group data 348)) + ) + ) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (ja-channel-push! 1 (seconds 0.017)) + (ja-no-eval :group! (-> self draw art-group data 331) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 331)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ((let ((v1-279 (ja-group))) + (and v1-279 (or (= v1-279 (-> self draw art-group data 340)) (= v1-279 (-> self draw art-group data 341)))) + ) + (set! (-> self state-flags) (logior (state-flags lleg-still rleg-still) (-> self state-flags))) + (let ((v1-286 (ja-group))) + (if (and v1-286 (= v1-286 (-> self draw art-group data 341))) + (ja-channel-set! 1) + (ja-channel-push! 1 (seconds 0.04)) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 342) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 342)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + (none) + ) + +;; definition for function target-attack-air-anim +;; WARN: Return type mismatch symbol vs none. +(defbehavior target-attack-air-anim target () + (when (using-gun? self) + (set! (-> self gun top-anim-low-high) 0.0) + (case (-> self gun gun-type) + (((pickup-type eco-yellow)) + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 248)) + 0.0 + 30 + 30 + 0.6 + 0.0 + #f + ) + ) + (else + (push-anim-to-targ + (-> self skel top-anim) + (the-as art-joint-anim (-> self draw art-group data 248)) + 3.0 + 30 + 30 + 0.5 + 0.0 + #f + ) + ) + ) + ) + (set! (-> self control unknown-float41) 0.0) + (set! (-> self control unknown-float42) 0.0) + (ja-channel-push! 1 (seconds 0.075)) + (set! (-> self control unknown-sound-id01) (sound-play "spin-kick")) + (ja-no-eval :group! (-> self draw art-group data 45) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 45)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-quat) 1.0 1.0 1.0) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> self control unknown-sound-id01) (sound-play "spin-kick")) + (ja :group! (-> self draw art-group data 46) :num! min) + (let ((f30-0 -393216.0)) + (let ((f0-11 (target-height-above-ground)) + (f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + (while (not (or (and (< (fabs (/ f0-11 (* 0.0033333334 f1-1))) 150.0) (< f1-1 0.0)) + (>= (- (-> self clock frame-counter) (-> self state-time)) (seconds 1.7)) + ) + ) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (* f30-0 (-> self clock seconds-per-frame)) + ) + (suspend) + (ja :num! (loop!)) + (set! f0-11 (target-height-above-ground)) + (set! f1-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + ) + (ja-no-eval :group! (-> self draw art-group data 47) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 47)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (cond + ((< (ja-aframe-num 0) 32.0) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (* f30-0 (-> self clock seconds-per-frame)) + ) + ) + (else + (let ((f0-25 + (deg-diff + (quaternion-y-angle (-> self control quat-for-control)) + (quaternion-y-angle (-> self control dir-targ)) + ) + ) + ) + (quaternion-rotate-y! + (-> self control quat-for-control) + (-> self control quat-for-control) + (* -0.2 (fabs f0-25)) + ) + ) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + ) + (none) + ) + +;; definition for function target-edge-grab-anim +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior target-edge-grab-anim target () + (ja-channel-push! 1 (seconds 0.15)) + (ja :group! (-> self draw art-group data 35) :num! min) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (ja-channel-set! 1) + (until #f + (ja-no-eval :group! (-> self draw art-group data 33) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 33)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (can-play-stance-amibent?) + (suspend) + (ja :num! (seek!)) + ) + (+! (-> self anim-seed) 1) + (ja-no-eval :group! (-> self draw art-group data 34) + :num! (seek! (the float (+ (-> (the-as art-joint-anim (-> self draw art-group data 34)) frames num-frames) -1))) + :frame-num 0.0 + ) + (until (ja-done? 0) + (can-play-stance-amibent?) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc index 04ab2d6537..0ed84cd9d1 100644 --- a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc @@ -663,12 +663,7 @@ (none) ) :code (behavior ((arg0 symbol)) - (let ((gp-0 target-hit-ground-anim) - (s5-0 #f) - ) - (are-still?) - (gp-0 s5-0) - ) + (target-hit-ground-anim #f (are-still?)) (go target-carry-stance) (none) ) diff --git a/test/decompiler/reference/jak2/engine/target/target_REF.gc b/test/decompiler/reference/jak2/engine/target/target_REF.gc index e303f3d1d2..32f0a4a596 100644 --- a/test/decompiler/reference/jak2/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target_REF.gc @@ -2027,12 +2027,7 @@ (none) ) :code (behavior ((arg0 symbol)) - (let ((gp-0 target-hit-ground-anim) - (s5-0 #f) - ) - (are-still?) - (gp-0 s5-0) - ) + (target-hit-ground-anim #f (are-still?)) (go target-stance) (none) ) @@ -3814,12 +3809,7 @@ (none) ) :code (behavior ((arg0 symbol)) - (let ((gp-0 target-hit-ground-anim) - (s5-0 arg0) - ) - (are-still?) - (gp-0 s5-0) - ) + (target-hit-ground-anim arg0 (are-still?)) (go target-falling #f) (none) ) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 8432a712e5..4cbb293b37 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -201,9 +201,9 @@ "(method 11 grid-hash)", "(method 15 sphere-hash)", - - - "i-hopefully-will-never-exist-dont-add-anything-after-me-please" + // process-drawable - return from thread + "(method 19 process-drawable)", + "(method 10 joint-control)" ], "skip_compile_states": {