From 7a1a64acba9cf2672e4263c9b5b3ed8a332cc3c8 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Mon, 21 Nov 2022 20:25:20 -0500 Subject: [PATCH] target code bugfixes (#2034) --- decompiler/IR2/FormExpressionAnalysis.cpp | 67 +- decompiler/analysis/atomic_op_builder.cpp | 22 + decompiler/config/jak2/all-types.gc | 182 +-- decompiler/config/jak2/hacks.jsonc | 4 - decompiler/config/jak2/inputs.jsonc | 5 +- decompiler/config/jak2/stack_structures.jsonc | 5 +- decompiler/config/jak2/type_casts.jsonc | 40 +- decompiler/config/jak2_ntsc_v1.jsonc | 4 +- decompiler/types2/ForwardProp.cpp | 2 + .../opengl_renderer/OpenGLRenderer.cpp | 10 + game/graphics/opengl_renderer/buckets.h | 6 + goal_src/jak2/dgos/engine.gd | 1 + goal_src/jak2/dgos/game.gd | 1 + goal_src/jak2/engine/collide/collide-debug.gc | 311 +++++ .../engine/collide/collide-edge-grab-h.gc | 2 +- .../jak2/engine/collide/collide-edge-grab.gc | 9 +- .../jak2/engine/common_objs/generic-obs.gc | 2 +- goal_src/jak2/engine/common_objs/powerups.gc | 1218 ++++++++++++++++- goal_src/jak2/engine/common_objs/water.gc | 14 +- goal_src/jak2/engine/draw/drawable.gc | 15 + goal_src/jak2/engine/game/effect-control-h.gc | 22 +- goal_src/jak2/engine/game/effect-control.gc | 1200 ++++++++++++++++ goal_src/jak2/engine/game/main-h.gc | 95 +- goal_src/jak2/engine/game/settings.gc | 3 +- goal_src/jak2/engine/gfx/foreground/eye.gc | 2 +- .../jak2/engine/gfx/merc/merc-blend-shape.gc | 2 +- .../sprite/particles/sparticle-launcher.gc | 1 - goal_src/jak2/engine/level/level.gc | 15 +- .../process-drawable/process-drawable.gc | 14 +- goal_src/jak2/engine/sound/gsound-h.gc | 8 +- goal_src/jak2/engine/sound/gsound.gc | 14 +- goal_src/jak2/engine/target/sidekick.gc | 16 +- goal_src/jak2/engine/target/target-darkjak.gc | 72 +- goal_src/jak2/game.gp | 22 + .../jak2/engine/collide/collide-debug_REF.gc | 314 +++++ .../engine/collide/collide-edge-grab-h_REF.gc | 2 +- .../engine/collide/collide-edge-grab_REF.gc | 12 +- .../engine/common_objs/generic-obs_REF.gc | 2 +- .../jak2/engine/common_objs/powerups_REF.gc | 1217 ++++++++++++++++ .../jak2/engine/debug/default-menu_REF.gc | 2 +- .../jak2/engine/game/effect-control-h_REF.gc | 6 +- .../jak2/engine/game/effect-control_REF.gc | 1194 ++++++++++++++++ .../reference/jak2/engine/game/main-h_REF.gc | 26 +- .../process-drawable/process-drawable_REF.gc | 13 +- .../reference/jak2/engine/sound/gsound_REF.gc | 7 +- .../jak2/engine/target/sidekick_REF.gc | 2 +- .../jak2/engine/target/target-darkjak_REF.gc | 65 +- 47 files changed, 5957 insertions(+), 311 deletions(-) create mode 100644 goal_src/jak2/engine/game/effect-control.gc create mode 100644 test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc create mode 100644 test/decompiler/reference/jak2/engine/game/effect-control_REF.gc diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index 21ecca96b5..5d34690336 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -717,6 +717,31 @@ void LoadSourceElement::update_from_stack(const Env& env, result->push_back(this); } +namespace { +FormElement* label_to_form_element(const Env& env, const SimpleAtom& atom, FormPool& pool) { + auto lab = env.file->labels.at(atom.label()); + if (env.file->is_string(lab.target_segment, lab.offset)) { + auto str = env.file->get_goal_string(lab.target_segment, lab.offset / 4 - 1, false); + return pool.alloc_element(str); + } else { + // look for a label hint: + const auto& hint = env.file->label_db->lookup(lab.name); + if (!hint.known) { + throw std::runtime_error( + fmt::format("Label {} was unknown in FormExpressionAnalysis.", hint.name)); + } + if (hint.is_value) { + return nullptr; + } + if (hint.result_type.base_type() == "function") { + return nullptr; + } else { + return pool.alloc_element(lab, hint); + } + } +} +} // namespace + void SimpleExpressionElement::update_from_stack_identity(const Env& env, FormPool& pool, FormStack& stack, @@ -729,30 +754,13 @@ void SimpleExpressionElement::update_from_stack_identity(const Env& env, result->push_back(x); } } else if (arg.is_static_addr()) { - auto lab = env.file->labels.at(arg.label()); - if (env.file->is_string(lab.target_segment, lab.offset)) { - auto str = env.file->get_goal_string(lab.target_segment, lab.offset / 4 - 1, false); - result->push_back(pool.alloc_element(str)); + auto as_label_form_element = label_to_form_element(env, arg, pool); + if (as_label_form_element) { + result->push_back(as_label_form_element); } else { - // look for a label hint: - const auto& hint = env.file->label_db->lookup(lab.name); - if (!hint.known) { - throw std::runtime_error( - fmt::format("Label {} was unknown in FormExpressionAnalysis.", hint.name)); - } - if (hint.is_value) { - result->push_back(this); - return; - } - if (hint.result_type.base_type() == "function") { - result->push_back(this); - return; - } else { - result->push_back(pool.alloc_element(lab, hint)); - return; - } + result->push_back(this); } - + return; } else if (arg.is_sym_ptr() || arg.is_sym_val() || arg.is_int() || arg.is_empty_list() || arg.is_sym_val_ptr()) { result->push_back(this); @@ -1035,8 +1043,21 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env, args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, env, pool, stack, allow_side_effects); } else { + // arg1 might be a label. + // do arg0 like a normal var args = pop_to_forms({m_expr.get_arg(0).var()}, env, pool, stack, allow_side_effects); - args.push_back(pool.form(m_expr.get_arg(1))); + + // then try to simplify the label + if (m_expr.get_arg(1).is_label()) { + auto as_lab = label_to_form_element(env, m_expr.get_arg(1), pool); + if (as_lab) { + args.push_back(pool.alloc_single_form(nullptr, as_lab)); + } else { + args.push_back(pool.form(m_expr.get_arg(1))); + } + } else { + args.push_back(pool.form(m_expr.get_arg(1))); + } } bool arg0_ptr = is_ptr_or_child(env, m_my_idx, m_expr.get_arg(0).var(), true); diff --git a/decompiler/analysis/atomic_op_builder.cpp b/decompiler/analysis/atomic_op_builder.cpp index 725b11ec82..3f76496a32 100644 --- a/decompiler/analysis/atomic_op_builder.cpp +++ b/decompiler/analysis/atomic_op_builder.cpp @@ -1098,6 +1098,28 @@ std::unique_ptr convert_daddiu_2(const Instruction& i0, return std::make_unique(make_dst_var(dest, idx), IR2_Condition(kind, make_src_atom(src, idx)), idx); } + + // daddiu v1, v1, L152 + // daddu v1, v1, fp + if (i1.kind == InstructionKind::DADDU && i0.get_src(1).is_label()) { + auto dest = i0.get_src(0).get_reg(); + if (!i0.get_src(0).is_reg(dest)) { + return nullptr; + } + if (!i1.get_src(0).is_reg(dest)) { + return nullptr; + } + if (!i1.get_src(0).is_reg(dest)) { + return nullptr; + } + if (!i1.get_src(1).is_reg(rfp())) { + return nullptr; + } + auto stat = SimpleAtom::make_static_address(i0.get_src(1).get_label()); + auto expr = SimpleExpression(SimpleExpression::Kind::ADD, make_src_atom(dest, idx), stat); + return std::make_unique(make_dst_var(dest, idx), expr, idx); + } + return nullptr; } diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 41ca21c8ef..80a3ff17e8 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -1888,6 +1888,9 @@ (sm-unk1) (sm-unk2) (reg0) + (reg1) + (reg2) + (unk) ) @@ -8106,6 +8109,9 @@ ;; main-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + + (deftype frame-stats (structure) ((field-time time-frame 2 :offset-assert 0) ;; guessed by decompiler (field int32 :offset-assert 16) @@ -8135,6 +8141,76 @@ ) ) +(defenum collide-spec + :bitfield #t + :type uint32 + + (backgnd 0) ;; 1 + (jak 1) ;; 2 + (bot 2) ;; 4 + (crate 3) ;; 8 + (civilian 4) ;; 16 + (enemy 5) ;; 32 + (obstacle 6) ;; 64 + (vehicle-sphere 7) ;; 128 + (hit-by-player-list 8) ;; 256 + (hit-by-others-list 9) ;; 512 + (player-list 10) ;; 1024 + (water 11) ;; 2048 + (collectable 12) ;; 4096 + (blocking-plane 13) ;; 8192 + (projectile 14) ;; 16384 + (jak-vulnerable 15) ;; 32768 + (camera-blocker 16) ;; hi 1 + (notice-blue-eco-powerup 17) ;; hi 2 + (tobot 18) ;; hi 4 + (pusher 19) ;; hi 8 + (vehicle-mesh 20) ;; hi 16 + (bot-targetable 21) ;; hi 32 + (jak-vehicle 22) ;; hi 64 + (special-obstacle 23) ;; hi 128 + (mech-punch 24) ;; hi 256 + (obstacle-for-jak 25) ;; hi 512 + (vehicle-mesh-probeable 26) ;; hi 1024 + (unknown-27 27) + (unknown-28 28) + (unknown-29 29) + (unknown-30 30) + (unknown-31 31) + (unknown-32 32) + (unknown-33 33) + (unknown-34 34) + (unknown-35 35) + (unknown-36 36) + (unknown-37 37) + (unknown-38 38) + (unknown-39 39) + (unknown-40 40) + (unknown-41 41) + (unknown-42 42) + (unknown-43 43) + (unknown-44 44) + (unknown-45 45) + (unknown-46 46) + (unknown-47 47) + (unknown-48 48) + (unknown-49 49) + (unknown-50 50) + (unknown-51 51) + (unknown-52 52) + (unknown-53 53) + (unknown-54 54) + (unknown-55 55) + (unknown-56 56) + (unknown-57 57) + (unknown-58 58) + (unknown-59 59) + (unknown-60 60) + (unknown-61 61) + (unknown-62 62) + (unknown-63 63) + ) + (deftype col-rend (basic) ((draw? symbol :offset-assert 4) (outline? symbol :offset-assert 8) @@ -8142,7 +8218,7 @@ (show-normals? symbol :offset-assert 16) (ghost-hidden? symbol :offset-assert 20) (show-only uint32 :offset-assert 24) - (cspec uint32 :offset-assert 28) + (cspec collide-spec :offset-assert 28) (track uint8 :offset-assert 32) (bbox-radius float :offset-assert 36) (bbox-center vector :inline :offset-assert 48) @@ -8152,7 +8228,7 @@ :size-assert #x44 :flag-assert #xa00000044 (:methods - (col-rend-method-9 () none 9) + (col-rend-method-9 (_type_) none 9) ) ) @@ -15859,75 +15935,6 @@ (declare-type collide-shape-moving collide-shape) (declare-type touching-list structure) -(defenum collide-spec - :bitfield #t - :type uint32 - - (backgnd 0) ;; 1 - (jak 1) ;; 2 - (bot 2) ;; 4 - (crate 3) ;; 8 - (civilian 4) ;; 16 - (enemy 5) ;; 32 - (obstacle 6) ;; 64 - (vehicle-sphere 7) ;; 128 - (hit-by-player-list 8) ;; 256 - (hit-by-others-list 9) ;; 512 - (player-list 10) ;; 1024 - (water 11) ;; 2048 - (collectable 12) ;; 4096 - (blocking-plane 13) ;; 8192 - (projectile 14) ;; 16384 - (jak-vulnerable 15) ;; 32768 - (camera-blocker 16) ;; hi 1 - (notice-blue-eco-powerup 17) ;; hi 2 - (tobot 18) ;; hi 4 - (pusher 19) ;; hi 8 - (vehicle-mesh 20) ;; hi 16 - (bot-targetable 21) ;; hi 32 - (jak-vehicle 22) ;; hi 64 - (special-obstacle 23) ;; hi 128 - (mech-punch 24) ;; hi 256 - (obstacle-for-jak 25) ;; hi 512 - (vehicle-mesh-probeable 26) ;; hi 1024 - (unknown-27 27) - (unknown-28 28) - (unknown-29 29) - (unknown-30 30) - (unknown-31 31) - (unknown-32 32) - (unknown-33 33) - (unknown-34 34) - (unknown-35 35) - (unknown-36 36) - (unknown-37 37) - (unknown-38 38) - (unknown-39 39) - (unknown-40 40) - (unknown-41 41) - (unknown-42 42) - (unknown-43 43) - (unknown-44 44) - (unknown-45 45) - (unknown-46 46) - (unknown-47 47) - (unknown-48 48) - (unknown-49 49) - (unknown-50 50) - (unknown-51 51) - (unknown-52 52) - (unknown-53 53) - (unknown-54 54) - (unknown-55 55) - (unknown-56 56) - (unknown-57 57) - (unknown-58 58) - (unknown-59 59) - (unknown-60 60) - (unknown-61 61) - (unknown-62 62) - (unknown-63 63) - ) (defenum collide-action :bitfield #t @@ -17359,7 +17366,7 @@ (find-grabbable-tris (_type_) none 17) ;; (should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 17) (should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 18) (find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol 19) - (check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) none 20) + (check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol 20) ) ) @@ -17514,6 +17521,13 @@ ) ) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; effect-control ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + + +(define-extern *footstep-surface* pat-surface) +(define-extern sound-name-with-material (function string pat-surface string sound-name)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; effect-control-h ;; @@ -17571,12 +17585,12 @@ :flag-assert #xf00000024 (:methods (new (symbol type process-drawable) _type_ 0) - (effect-control-method-9 (_type_) none 9) ;; (TODO-RENAME-9 (_type_) none 9) + (update-effects (_type_) none 9) ;; (TODO-RENAME-9 (_type_) none 9) (do-effect (_type_ symbol float int) none 10) ;; (dummy-10 (_type_ symbol float int) object 10) - (effect-control-method-11 () none 11) ;; (dummy-11 (_type_ symbol float int basic pat-surface) none 11) + (do-effect-for-surface (_type_ symbol float int basic pat-surface) none 11) ;; (dummy-11 (_type_ symbol float int basic pat-surface) none 11) (play-effect-sound (_type_ symbol float int basic sound-name) int 12) ;; (dummy-12 (_type_ symbol float int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) - (effect-control-method-14 () none 14) ;; (TODO-RENAME-14 (_type_ float float float) none 14) + (play-effects-from-res-lump (_type_ float float float) none 14) ;; (TODO-RENAME-14 (_type_ float float float) none 14) ) ) @@ -22951,7 +22965,7 @@ ;; ghost function (define-extern *debug-effect-control* symbol) -(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec)) +(define-extern effect-param->sound-spec (function sound-spec (pointer float) int process-focusable sound-spec)) (deftype engine-sound-pers (engine-pers) () @@ -28870,7 +28884,7 @@ (define-extern want-to-darkjak? (function symbol :behavior target)) (define-extern *darkjak-trans-mods* surface) (define-extern target-darkjak-end-mode (function none :behavior target)) -(define-extern target-darkjak-process (function object object object object object object float none :behavior target)) ;; only arg6 used +(define-extern target-darkjak-process (function none :behavior target)) ;; only arg6 used (define-extern target-darkjak-get-on (state int target)) (define-extern target-darkjak-get-off (state target)) (define-extern target-darkjak-running-attack (state target)) @@ -29471,7 +29485,7 @@ (define-extern prototype-bucket-type (function prototype-bucket type)) (define-extern prototype-bucket-recalc-fields (function prototype-bucket prototype-bucket)) (define-extern print-prototype-list (function none)) -;; (define-extern draw-instance-info function) ;; (function string none) +(define-extern draw-instance-info (function string none)) ;; (define-extern set-shadow-by-name function) ;; (define-extern get-shadow-by-name function) ;; (define-extern teleport-camera-by-name function) @@ -29480,8 +29494,8 @@ ;; (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)) (define-extern foreground-engine-execute (function engine display-frame none)) -;; (define-extern main-debug-hook function) ;; (function none) -;; (define-extern *debug-hook* object) ;; (function none) +(define-extern main-debug-hook (function none)) +;(define-extern *debug-hook* (function none)) (define-extern *add-sphere* symbol) (define-extern *generic-effect-mode* int) (define-extern foreground-initialize-engines (function none)) @@ -29617,19 +29631,17 @@ ;; collide-debug ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype col-rend-filter (structure) - ((show-pat-set uint32 :offset-assert 0) - (show-pat-clear uint32 :offset-assert 4) + ((show-pat-set pat-surface :offset-assert 0) + (show-pat-clear pat-surface :offset-assert 4) (event-mask uint32 :offset-assert 8) ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -;; (define-extern col-rend-draw function) +(define-extern col-rend-draw (function col-rend col-rend-filter none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; relocate ;; diff --git a/decompiler/config/jak2/hacks.jsonc b/decompiler/config/jak2/hacks.jsonc index be0f70024c..40de08bb33 100644 --- a/decompiler/config/jak2/hacks.jsonc +++ b/decompiler/config/jak2/hacks.jsonc @@ -109,10 +109,6 @@ // CFG failed "draw-inline-array-instance-shrub", - "target-land-effect", - "(method 12 effect-control)", - "(method 11 effect-control)", - "(method 10 effect-control)", "(method 10 bigmap)", "(method 9 editable-region)", // condition branch assert hit "(anon-function 10 meet-brutter)", diff --git a/decompiler/config/jak2/inputs.jsonc b/decompiler/config/jak2/inputs.jsonc index 504afde705..13318e59c1 100644 --- a/decompiler/config/jak2/inputs.jsonc +++ b/decompiler/config/jak2/inputs.jsonc @@ -56,7 +56,7 @@ // "DGO/SWB.DGO", // "DGO/LPOWER.DGO", // "DGO/FOB.DGO", - // "DGO/CIB.DGO", + "DGO/CIB.DGO", // "DGO/LSHUTTLE.DGO", // "DGO/LJAKDAX.DGO", // "DGO/FORDUMPC.DGO", @@ -189,6 +189,7 @@ "CTA.DGO", "CWI.DGO", "LWIDEA.DGO", - "VI1.DGO" + "VI1.DGO", + "CIB.DGO" ] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index 4d3cb78a84..eef96e87cb 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -1199,5 +1199,8 @@ [304, "quaternion"], [384, "vector"] ], - "(method 20 collide-cache)": [[16, "matrix"]] + "(method 20 collide-cache)": [[16, "matrix"]], + "col-rend-draw": [ + [16, "matrix"] + ] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 535a82a2a3..44b21e31d6 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -3248,11 +3248,8 @@ [97, "v1", "fact-info-target"] ], "cloud-track": [ - [32, "s1", "handle"], - [45, "s2", "handle"], - [81, "s1", "handle"], - [83, "s2", "handle"], - [107, "s2", "handle"] + [[19, 83], "s1", "handle"], + [[29, 116], "s2", "handle"] ], "(code target-darkjak-bomb1)": [ [408, "v1", "art-joint-anim"], @@ -4682,7 +4679,7 @@ "(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 14 draw-control)": [[13, "v1", "process-drawable"], [[58, 64], "t9", "(function object object object none)"]], "(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"]], @@ -4950,5 +4947,36 @@ [51, "s1", "collide-shape"], [114, "v1", "connection"], [115, "s1", "collide-shape"] + ], + "(method 9 collide-cache)": [ + //[[28, 56], "gp", "collide-shape-prim"], + [33, "gp", "collide-cache-prim"], + [35, "gp", "collide-shape-prim"], + [[50, 56], "gp", "collide-cache-prim"], + [36, "v1", "collide-shape-prim-sphere"], + [[4, 26], "gp", "collide-cache-tri"] + ], + "col-rend-draw": [ + [[161, 217], "s5", "collide-cache-prim"], + [164, "v1", "collide-shape-prim-sphere"], + [[14, 152], "s3", "collide-cache-tri"] + ], + "effect-param->sound-spec": [ + [178, "v1", "collide-shape-moving"] + ], + "(method 10 effect-control)": [ + [128, "v1", "collide-shape-moving"], + [183, "s3", "(pointer object)"], + [187, "s3", "basic"], + [340, "s3", "basic"], + [390, "s3", "basic"], + [462, "s3", "basic"], + [483, "s3", "basic"], + [[497, 575], "s3", "death-info"] + ], + "(method 12 effect-control)": [ + [99, "gp", "(pointer int8)"], + ["_stack_", 112, "res-tag"] ] + } diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index 24ef896027..1ce7b08952 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -7,8 +7,8 @@ // if you want to filter to only some object names. // it will make the decompiler much faster. - "allowed_objects": ["editable-player"], - "banned_objects": ["effect-control", "ctywide-scenes", "texture-anim-tables", "traffic-engine"], + "allowed_objects": [], + "banned_objects": ["ctywide-scenes", "texture-anim-tables", "traffic-engine"], //////////////////////////// // CODE ANALYSIS OPTIONS diff --git a/decompiler/types2/ForwardProp.cpp b/decompiler/types2/ForwardProp.cpp index 21dede9c20..904bf7089c 100644 --- a/decompiler/types2/ForwardProp.cpp +++ b/decompiler/types2/ForwardProp.cpp @@ -212,6 +212,8 @@ std::optional try_get_type_of_atom(const types2::TypeState& type_state, case SimpleAtom::Kind::INTEGER_CONSTANT: { return TP_Type::make_from_integer(atom.get_int()); } break; + case SimpleAtom::Kind::STATIC_ADDRESS: + return try_get_type_of_label(atom.label(), env); default: ASSERT_MSG(false, fmt::format("unknown kind in try_get_type_of_atom: {}", atom.to_string(env))); diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index e393b8e915..67a7148ec2 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -107,6 +107,11 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { init_bucket_renderer("tie-l1-tfrag", BucketCategory::TIE, BucketId::TIE_L1_TFRAG, 1); // 30 // 40 + init_bucket_renderer("tex-l3-tfrag", BucketCategory::TEX, + BucketId::TEX_L3_TFRAG); + init_bucket_renderer("tfrag-l3-tfrag", BucketCategory::TFRAG, BucketId::TFRAG_L3_TFRAG, + std::vector{tfrag3::TFragmentTreeKind::NORMAL}, false, 3); + init_bucket_renderer("tie-l3-tfrag", BucketCategory::TIE, BucketId::TIE_L3_TFRAG, 3); // 50 // 60 // 70 @@ -119,6 +124,9 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { init_bucket_renderer("shrub-l1-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L1_SHRUB); // 90 // 100 + init_bucket_renderer("tex-l3-shrub", BucketCategory::TEX, + BucketId::TEX_L3_SHRUB); + init_bucket_renderer("shrub-l3-shrub", BucketCategory::SHRUB, BucketId::SHRUB_L3_SHRUB); // 110 // 120 init_bucket_renderer("tex-l0-alpha", BucketCategory::TEX, @@ -143,6 +151,8 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { // 200 init_bucket_renderer("tex-l2-pris", BucketCategory::TEX, BucketId::TEX_L2_PRIS); + init_bucket_renderer("tex-l3-pris", BucketCategory::TEX, + BucketId::TEX_L3_PRIS); // 210 // 220 init_bucket_renderer("tex-lcom-pris", BucketCategory::TEX, diff --git a/game/graphics/opengl_renderer/buckets.h b/game/graphics/opengl_renderer/buckets.h index 61c676fab4..74fe88f4aa 100644 --- a/game/graphics/opengl_renderer/buckets.h +++ b/game/graphics/opengl_renderer/buckets.h @@ -90,16 +90,22 @@ enum class BucketId { TEX_L1_TFRAG = 18, TFRAG_L1_TFRAG = 19, TIE_L1_TFRAG = 20, + TEX_L3_TFRAG = 40, + TFRAG_L3_TFRAG = 41, + TIE_L3_TFRAG = 42, TEX_L0_SHRUB = 73, SHRUB_L0_SHRUB = 74, TEX_L1_SHRUB = 82, SHRUB_L1_SHRUB = 83, + TEX_L3_SHRUB = 100, + SHRUB_L3_SHRUB = 101, TEX_L0_ALPHA = 127, TFRAG_T_L0_ALPHA = 128, TEX_LCOM_TFRAG = 187, TEX_LCOM_SHRUB = 191, TEX_L0_PRIS = 196, TEX_L2_PRIS = 204, + TEX_L3_PRIS = 208, TEX_LCOM_PRIS = 220, TEX_L0_WATER = 252, TFRAG_W_L0_WATER = 255, diff --git a/goal_src/jak2/dgos/engine.gd b/goal_src/jak2/dgos/engine.gd index f6f6814181..e4b696d0a0 100644 --- a/goal_src/jak2/dgos/engine.gd +++ b/goal_src/jak2/dgos/engine.gd @@ -289,6 +289,7 @@ ("collide-reaction-target.o" "collide-reaction-target") ("logic-target.o" "logic-target") ("sidekick.o" "sidekick") + ("effect-control.o" "effect-control") ("voicebox.o" "voicebox") ("collectables-part.o" "collectables-part") ("debug-part.o" "debug-part") diff --git a/goal_src/jak2/dgos/game.gd b/goal_src/jak2/dgos/game.gd index 0dc2fc3b51..54f77fe1b9 100644 --- a/goal_src/jak2/dgos/game.gd +++ b/goal_src/jak2/dgos/game.gd @@ -289,6 +289,7 @@ ("collide-reaction-target.o" "collide-reaction-target") ("logic-target.o" "logic-target") ("sidekick.o" "sidekick") + ("effect-control.o" "effect-control") ("voicebox.o" "voicebox") ("collectables-part.o" "collectables-part") ("debug-part.o" "debug-part") diff --git a/goal_src/jak2/engine/collide/collide-debug.gc b/goal_src/jak2/engine/collide/collide-debug.gc index 472fb7fb4e..24c7172641 100644 --- a/goal_src/jak2/engine/collide/collide-debug.gc +++ b/goal_src/jak2/engine/collide/collide-debug.gc @@ -7,3 +7,314 @@ ;; DECOMP BEGINS +(declare-file (debug)) + +(when *debug-segment* +;; definition for method 9 of type collide-cache +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw collide-cache ((obj collide-cache)) + (let ((gp-0 (the-as object (-> obj tris)))) + (countdown (s4-0 (-> obj num-tris)) + (let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> (the-as collide-cache-tri gp-0) pat mode) color) a 64))) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-tri gp-0) vertex)) + (-> (the-as collide-cache-tri gp-0) vertex 1) + (-> (the-as collide-cache-tri gp-0) vertex 2) + t1-0 + ) + ) + (set! gp-0 (&+ (the-as collide-cache-tri gp-0) 64)) + ) + ) + (let ((gp-1 (the-as object (-> obj prims)))) + (countdown (s5-1 (-> obj num-prims)) + (when (= (-> (the-as collide-cache-prim gp-1) prim-core prim-type) (prim-type sphere)) + (let ((t0-1 + (copy-and-set-field + (-> *pat-mode-info* + (-> (the-as collide-shape-prim-sphere (-> (the-as collide-shape-prim gp-1) prim-core action)) pat mode) + color + ) + a + 64 + ) + ) + ) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-prim gp-1) prim-core)) + (-> (the-as collide-cache-prim gp-1) prim-core world-sphere w) + t0-1 + ) + ) + ) + (set! gp-1 (&+ (the-as collide-cache-prim gp-1) 48)) + ) + ) + (print-collide-cache-tri-count) + 0 + (none) + ) + +;; definition of type col-rend-filter +(deftype col-rend-filter (structure) + ((show-pat-set pat-surface :offset-assert 0) + (show-pat-clear pat-surface :offset-assert 4) + (event-mask uint32 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type col-rend-filter +(defmethod inspect col-rend-filter ((obj col-rend-filter)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'col-rend-filter) + (format #t "~1Tshow-pat-set: ~D~%" (-> obj show-pat-set)) + (format #t "~1Tshow-pat-clear: ~D~%" (-> obj show-pat-clear)) + (format #t "~1Tevent-mask: ~D~%" (-> obj event-mask)) + (label cfg-4) + obj + ) + +;; definition for function col-rend-draw +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defun col-rend-draw ((arg0 col-rend) (arg1 col-rend-filter)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (set! (-> s4-0 vector 0 quad) (-> (math-camera-matrix) vector 2 quad)) + (vector-normalize! (the-as vector (-> s4-0 vector)) 1.0) + (let ((s3-1 (the-as collide-cache-tri (-> *collide-cache* tris)))) + (countdown (s2-0 (-> *collide-cache* num-tris)) + (vector-3pt-cross! (-> s4-0 vector 1) (the-as vector (-> s3-1 vertex)) (-> s3-1 vertex 1) (-> s3-1 vertex 2)) + (vector-normalize! (-> s4-0 vector 1) 1.0) + (when (or (-> arg0 show-back-faces?) (>= 0.0 (vector-dot (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1)))) + (let ((v1-9 (-> s3-1 pat))) + (cond + ((and (or (zero? (-> arg1 show-pat-set)) (logtest? v1-9 (-> arg1 show-pat-set))) + (or (zero? (-> arg1 show-pat-clear)) (zero? (logand v1-9 (-> arg1 show-pat-clear)))) + (or (zero? (-> arg1 event-mask)) (logtest? (-> arg1 event-mask) (ash 1 (-> v1-9 event)))) + ) + (let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-9 mode) color) a 64))) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + t1-0 + ) + ) + (if (-> arg0 outline?) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + (new 'static 'rgba :r #x10 :g #x10 :b #x10 :a #x80) + ) + ) + (when (-> arg0 show-normals?) + (vector+! (-> s4-0 vector 2) (the-as vector (-> s3-1 vertex)) (-> s3-1 vertex 1)) + (vector+! (-> s4-0 vector 2) (-> s4-0 vector 2) (-> s3-1 vertex 2)) + (vector-float/! (-> s4-0 vector 2) (-> s4-0 vector 2) 3.0) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 vector 2) + (-> s4-0 vector 1) + (meters 0.75) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + ) + ((-> arg0 ghost-hidden?) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + (new 'static 'rgba :r #x20 :g #x20 :b #x20 :a #x20) + ) + (if (-> arg0 outline?) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + (new 'static 'rgba :r #x10 :g #x10 :b #x10 :a #x10) + ) + ) + ) + ) + ) + ) + (&+! s3-1 64) + ) + ) + ) + (let ((s5-1 (the-as object (-> *collide-cache* prims)))) + (countdown (s4-1 (-> *collide-cache* num-prims)) + (when (= (-> (the-as collide-cache-prim s5-1) prim-core prim-type) (prim-type sphere)) + (let ((v1-37 (-> (the-as collide-shape-prim-sphere (-> (the-as collide-cache-prim s5-1) prim)) pat))) + (when (and (or (zero? (-> arg1 show-pat-set)) (logtest? v1-37 (-> arg1 show-pat-set))) + (or (zero? (-> arg1 show-pat-clear)) (zero? (logand v1-37 (-> arg1 show-pat-clear)))) + (or (zero? (-> arg1 event-mask)) (logtest? (-> arg1 event-mask) (ash 1 (-> v1-37 event)))) + ) + (let ((t0-5 (copy-and-set-field (-> *pat-mode-info* (-> v1-37 mode) color) a 64))) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-prim s5-1) prim-core)) + (-> (the-as collide-cache-prim s5-1) prim-core world-sphere w) + t0-5 + ) + ) + ) + ) + ) + (set! s5-1 (&+ (the-as collide-cache-prim s5-1) 48)) + ) + ) + (none) + ) + +;; definition for method 9 of type col-rend +;; INFO: Used lq/sq +(defmethod col-rend-method-9 col-rend ((obj col-rend)) + (with-pp + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((f30-0 (-> obj bbox-radius))) + (let ((v1-0 (-> obj track))) + (cond + ((zero? v1-0) + (set! (-> obj bbox-center quad) (-> (target-pos 0) quad)) + (+! (-> obj bbox-center y) (* 0.7 f30-0)) + ) + ((= v1-0 1) + (position-in-front-of-camera! (-> obj bbox-center) (+ (-> obj camera-to-bbox-dist) (-> obj bbox-radius)) 0.0) + ) + ) + ) + (set! (-> s5-0 bbox min quad) (-> obj bbox-center quad)) + (set! (-> s5-0 bbox min x) (- (-> s5-0 bbox min x) f30-0)) + (set! (-> s5-0 bbox min y) (- (-> s5-0 bbox min y) f30-0)) + (set! (-> s5-0 bbox min z) (- (-> s5-0 bbox min z) f30-0)) + (set! (-> s5-0 bbox max quad) (-> obj bbox-center quad)) + (+! (-> s5-0 bbox max x) f30-0) + (+! (-> s5-0 bbox max y) f30-0) + (+! (-> s5-0 bbox max z) f30-0) + ) + (let ((v1-9 -1)) + (let ((a0-9 (-> obj cspec))) + (if (not (logtest? a0-9 (collide-spec crate))) + (set! v1-9 (logxor v1-9 1)) + ) + (if (not (logtest? a0-9 (collide-spec civilian))) + (set! v1-9 (logxor v1-9 64)) + ) + (if (not (logtest? a0-9 (collide-spec enemy))) + (set! v1-9 (logxor #x80000 v1-9)) + ) + (if (not (logtest? a0-9 (collide-spec obstacle))) + (set! v1-9 (logxor v1-9 2)) + ) + (if (not (logtest? a0-9 (collide-spec vehicle-sphere))) + (set! v1-9 (logand #x80743 v1-9)) + ) + ) + (set! (-> s5-0 collide-with) (the-as collide-spec v1-9)) + ) + (set! (-> s5-0 ignore-pat) (new 'static 'pat-surface)) + (set! (-> s5-0 ignore-process0) #f) + (set! (-> s5-0 ignore-process1) #f) + (add-debug-box + #t + (bucket-id debug2) + (the-as vector (-> s5-0 bbox)) + (-> s5-0 bbox max) + (if (logtest? (-> pp clock frame-counter) 128) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x20) + (new 'static 'rgba :a #x20) + ) + ) + (fill-using-bounding-box *collide-cache* s5-0) + ) + (let ((s5-1 (-> obj show-only)) + (a1-17 (new 'stack 'col-rend-filter)) + ) + (when (nonzero? s5-1) + (cond + ((logtest? s5-1 8) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :noboard #x1)) + ) + ((logtest? s5-1 16) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + ) + ((logtest? s5-1 32) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + (set! (-> a1-17 show-pat-set) (new 'static 'pat-surface :nojak #x1)) + ) + (else + (if (logtest? s5-1 8192) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nolineofsight #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 1024) + (set! (-> a1-17 show-pat-set noentity) 1) + ) + (if (logtest? s5-1 64) + (set! (-> a1-17 show-pat-set noboard) 1) + ) + (if (logtest? s5-1 2048) + (set! (-> a1-17 show-pat-set nogrind) 1) + ) + (if (logtest? s5-1 128) + (set! (-> a1-17 show-pat-set nocamera) 1) + ) + (if (logtest? s5-1 4096) + (set! (-> a1-17 show-pat-set nojak) 1) + ) + (if (logtest? s5-1 256) + (set! (-> a1-17 show-pat-set noedge) 1) + ) + (if (logtest? s5-1 #x8000) + (set! (-> a1-17 show-pat-set nopilot) 1) + ) + (if (logtest? s5-1 512) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 #x4000) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nomech #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x10000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noproj #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x40000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :probe #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x20000 s5-1) + (logior! (-> a1-17 event-mask) 64) + ) + ) + ) + ) + (col-rend-draw obj a1-17) + ) + (none) + ) + ) + +) + + + diff --git a/goal_src/jak2/engine/collide/collide-edge-grab-h.gc b/goal_src/jak2/engine/collide/collide-edge-grab-h.gc index 4169a1d21b..3a468d58e7 100644 --- a/goal_src/jak2/engine/collide/collide-edge-grab-h.gc +++ b/goal_src/jak2/engine/collide/collide-edge-grab-h.gc @@ -170,7 +170,7 @@ (find-grabbable-tris (_type_) none 17) (should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 18) (find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol 19) - (check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) none 20) + (check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol 20) ) ) diff --git a/goal_src/jak2/engine/collide/collide-edge-grab.gc b/goal_src/jak2/engine/collide/collide-edge-grab.gc index b5d5ff687f..88100ae581 100644 --- a/goal_src/jak2/engine/collide/collide-edge-grab.gc +++ b/goal_src/jak2/engine/collide/collide-edge-grab.gc @@ -160,7 +160,7 @@ ) (let ((f0-1 (get-best-hand-point obj (-> arg1 right-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-1) - (return #f) + (return (the-as symbol #f)) ) ) (set! sv-672 s0-0) @@ -178,7 +178,7 @@ (.svf (&-> sv-672 quad) vf6) (let ((f0-3 (get-best-hand-point obj (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-3) - (return #f) + (return (the-as symbol #f)) ) ) ) @@ -228,7 +228,7 @@ (set! (-> v1-28 action-mask) (collide-action solid)) ) (if (probe-using-spheres (-> obj ccache) a1-12) - (return #f) + (return (the-as symbol #f)) ) ) (set! (-> arg1 status) (the-as uint 0)) @@ -260,8 +260,7 @@ ) ) ) - 0 - (none) + (the-as symbol 0) ) ) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index 343259f3c0..82f467098e 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -105,7 +105,7 @@ (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) (let ((a0-22 (-> self skel effect))) (if a0-22 - (effect-control-method-9 a0-22) + (update-effects a0-22) ) ) (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) diff --git a/goal_src/jak2/engine/common_objs/powerups.gc b/goal_src/jak2/engine/common_objs/powerups.gc index c248d4f854..5d4c57df0d 100644 --- a/goal_src/jak2/engine/common_objs/powerups.gc +++ b/goal_src/jak2/engine/common_objs/powerups.gc @@ -7,9 +7,1217 @@ ;; DECOMP BEGINS -(defbehavior target-powerup-process target () - (none)) - -(defbehavior target-land-effect target () +;; definition for function cloud-track +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior cloud-track process ((arg0 process-tree) + (arg1 process-tree) + (arg2 (function vector none)) + (arg3 time-frame) + (arg4 time-frame) + (arg5 time-frame) + ) + (change-parent self arg0) + (let ((s1-1 (process->handle arg0)) + (s2-1 (process->handle arg1)) + ) + (let ((s0-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s0-0) (+ arg3 arg4)) + (let ((v1-8 (or (not (handle->process s1-1)) (not (handle->process s2-1))))) + (if v1-8 + (deactivate self) + ) + ) + (let* ((f0-1 + (fmax + 0.0 + (fmin 1.0 (/ (- (the float (- (-> self clock frame-counter) s0-0)) (the float arg3)) (the float arg4))) + ) + ) + (a0-18 (process-drawable-pair-random-point! + (the-as process-drawable (-> s1-1 process 0)) + (the-as process-drawable (-> s2-1 process 0)) + (new-stack-vector0) + f0-1 + ) + ) + ) + (arg2 a0-18) + ) + (suspend) + ) + ) + (cond + ((zero? arg5) + (until #f + (suspend) + ) + #f + ) + (else + (let ((s4-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s4-1) arg5) + (let ((a0-21 (process-drawable-random-point! (the-as process-drawable (-> s2-1 process 0)) (new-stack-vector0)))) + (arg2 a0-21) + ) + (suspend) + ) + ) + ) + ) + ) (none) - ) \ No newline at end of file + ) + +;; failed to figure out what this is: +(defpart 539 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 192.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0666667) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 540 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 192.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0666667) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 541 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9b :page #xb)) + (sp-rnd-flt spt-num 1.0 3.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 90) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 542) + ) + ) + +;; failed to figure out what this is: +(defpart 543 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9b :page #xb)) + (sp-rnd-flt spt-num 0.0 3.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 1.5) 1.0) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 91) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 542) + ) + ) + +;; failed to figure out what this is: +(defpart 542 + :init-specs ((sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-fade-r -1.0) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -2.0) + ) + ) + +;; failed to figure out what this is: +(defpart 544 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.15) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 32.0) + (sp-rnd-flt spt-g 32.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 64.0 128.0 1.0) + (sp-flt spt-scalevel-x (meters -0.00033333333)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.2) + (sp-flt spt-accel-y -0.06826667) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-blue-hit-ground-effect + :id 123 + :duration (seconds 0.017) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 545) (sp-item 546) (sp-item 547 :flags (is-3d)) (sp-item 548) (sp-item 549 :flags (is-3d))) + ) + +;; failed to figure out what this is: +(defpart 548 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 32.0) + (sp-flt spt-y (meters 0.5)) + (sp-rnd-flt spt-scale-x (meters 1) (meters 3) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-int spt-a 0 63 1.0) + (sp-flt spt-vel-y (meters 0.093333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 550) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 550 + :init-specs ((sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-int spt-a 0 63 1.0) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 550) + ) + ) + +;; failed to figure out what this is: +(defpart 549 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0.5)) + (sp-flt spt-scale-x (meters 0)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 96.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters 0.21333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 120) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 60) + (sp-launcher-by-id spt-next-launcher 551) + ) + ) + +;; failed to figure out what this is: +(defpart 551 + :init-specs ((sp-flt spt-fade-a -2.1333334)) + ) + +;; failed to figure out what this is: +(defpart 547 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x26 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0.5)) + (sp-flt spt-scale-x (meters 0)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters 0.22666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.7111111) + (sp-int spt-timer 90) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 552) + ) + ) + +;; failed to figure out what this is: +(defpart 552 + :init-specs ((sp-flt spt-fade-a -1.4222223)) + ) + +;; failed to figure out what this is: +(defpart 545 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 32.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0) + (sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.16) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12) + (sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 546 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 12.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 16.0 16.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.10666667) (meters 0.053333335) 1.0) + (sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.21333334) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12) + (sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 553 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 92.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 554 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 92.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 555 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-rnd-flt spt-num 0.5 2.0 1.0) + (sp-flt spt-y (meters -0.05)) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 100.0 28.0 1.0) + (sp-rnd-flt spt-g 64.0 64.0 1.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0023333333) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -0.024242423) + (sp-rnd-flt spt-accel-y -0.40960002 -1.2288 1.0) + (sp-flt spt-friction 0.93) + (sp-int-plain-rnd spt-timer 30 209 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 556) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 556 + :init-specs ((sp-flt spt-fade-r 0.0)) + ) + +;; failed to figure out what this is: +(defpart 557 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 558 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 559 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-rnd-flt spt-num 0.5 2.0 1.0) + (sp-flt spt-y (meters -0.05)) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 100.0 28.0 1.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0023333333) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -0.024242423) + (sp-rnd-flt spt-accel-y -0.40960002 -1.2288 1.0) + (sp-flt spt-friction 0.93) + (sp-int-plain-rnd spt-timer 30 209 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 560) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 560 + :init-specs ((sp-flt spt-fade-r 0.0)) + ) + +;; failed to figure out what this is: +(defpart 561 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 92.0 32.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 562 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 92.0 32.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 563 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-rnd-flt spt-num 0.5 2.0 1.0) + (sp-flt spt-y (meters -0.05)) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 100.0 28.0 1.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0023333333) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -0.024242423) + (sp-rnd-flt spt-accel-y -0.40960002 -1.2288 1.0) + (sp-flt spt-friction 0.93) + (sp-int-plain-rnd spt-timer 30 209 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 564) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 564 + :init-specs ((sp-flt spt-fade-g 0.0)) + ) + +;; definition for function eco-blue-glow +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun eco-blue-glow ((arg0 vector)) + (let ((t9-0 sp-launch-particles-var) + (a0-1 *sp-particle-system-2d*) + (a1-0 (-> *part-id-table* 539)) + (a2-0 *launch-matrix*) + ) + (set! (-> a2-0 trans quad) (-> arg0 quad)) + (t9-0 a0-1 a1-0 a2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (rand-vu-percent? 0.5) + (let ((t9-2 sp-launch-particles-var) + (a0-3 *sp-particle-system-2d*) + (a1-1 (-> *part-id-table* 541)) + (a2-1 *launch-matrix*) + ) + (set! (-> a2-1 trans quad) (-> arg0 quad)) + (t9-2 a0-3 a1-1 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + 0 + (none) + ) + +;; definition for function target-eco-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-eco-process target () + (when (and (!= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 0.0) + (>= (- (-> *display* game-clock frame-counter) + (-> (the-as fact-info-target (-> self fact-override)) eco-pickup-time) + ) + (-> (the-as fact-info-target (-> self fact-override)) eco-timeout) + ) + ) + (set! (-> (the-as fact-info-target (-> self fact-override)) eco-level) 0.0) + (set! (-> (the-as fact-info-target (-> self fact-override)) eco-timeout) 0) + (logclear! (-> self state-flags) (state-flags sf4)) + (send-event self 'reset-collide) + (stop! (-> self sound)) + ) + (if (logtest? (-> self game secrets) (game-secrets endless-dark)) + (set! (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) + ) + (when (and (< 0.0 (-> (the-as fact-info-target (-> self fact-override)) eco-level)) + (not (logtest? (-> self focus-status) (focus-status in-head))) + (not (logtest? (-> self draw status) (draw-control-status no-draw no-draw-temp))) + (not (movie?)) + (rand-vu-percent? (lerp-scale + 0.0 + 1.0 + (the float (- (-> (the-as fact-info-target (-> self fact-override)) eco-timeout) + (- (-> *display* game-clock frame-counter) + (-> (the-as fact-info-target (-> self fact-override)) eco-pickup-time) + ) + ) + ) + 0.0 + 900.0 + ) + ) + ) + (case (-> (the-as fact-info-target (-> self fact-override)) eco-type) + ((1) + (change-sound! (-> self sound) (static-sound-name "yel-eco-jak")) + (let ((s1-0 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-1 sp-launch-particles-var) + (s5-0 *sp-particle-system-2d*) + (s4-0 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 553 + 554 + ) + ) + ) + (s2-0 *launch-matrix*) + ) + (set! (-> s2-0 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-0)) quad) + ) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-2 2) + (let ((v1-53 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-1 sp-launch-particles-var) + (s4-1 *sp-particle-system-2d*) + (s3-1 (-> *part-id-table* 555)) + (s1-1 *launch-matrix*) + ) + (set! (-> s1-1 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-53)) quad) + ) + (s5-1 s4-1 s3-1 s1-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((2) + (target-danger-set! (-> self control danger-mode) 'eco-red) + (update-transforms (-> self control)) + (let ((a1-13 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-13 options) (overlaps-others-options)) + (set! (-> a1-13 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-13 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-13) + ) + (target-danger-set! (-> self control danger-mode) #f) + (update-transforms (-> self control)) + (change-sound! (-> self sound) (static-sound-name "red-eco-jak")) + (let ((s1-2 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-3 sp-launch-particles-var) + (s5-2 *sp-particle-system-2d*) + (s4-2 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 557 + 558 + ) + ) + ) + (s2-2 *launch-matrix*) + ) + (set! (-> s2-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-2)) quad) + ) + (gp-3 s5-2 s4-2 s2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-4 2) + (let ((v1-86 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-3 sp-launch-particles-var) + (s4-3 *sp-particle-system-2d*) + (s3-3 (-> *part-id-table* 559)) + (s1-3 *launch-matrix*) + ) + (set! (-> s1-3 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-86)) quad) + ) + (s5-3 s4-3 s3-3 s1-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((3) + (change-sound! (-> self sound) (static-sound-name "blue-eco-jak")) + (let ((v1-99 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (cond + ((and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + (set! (-> *part-id-table* 543 init-specs 4 initial-valuef) 0.0) + (set! (-> *part-id-table* 543 init-specs 4 random-rangef) 65536.0) + ) + (else + (set! (-> *part-id-table* 543 init-specs 4 initial-valuef) 40960.0) + (set! (-> *part-id-table* 543 init-specs 4 random-rangef) 16384.0) + ) + ) + (let ((gp-5 sp-launch-particles-var) + (s5-4 *sp-particle-system-2d*) + (s4-4 (-> *part-id-table* 543)) + (s2-4 *launch-matrix*) + ) + (set! (-> s2-4 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-99)) quad) + ) + (gp-5 s5-4 s4-4 s2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((gp-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (let ((s5-5 sp-launch-particles-var) + (s4-5 *sp-particle-system-2d*) + (s3-5 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 539 + 540 + ) + ) + ) + (s1-4 *launch-matrix*) + ) + (set! (-> s1-4 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) quad) + ) + (s5-5 s4-5 s3-5 s1-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (rand-vu-percent? 0.5) + (let ((s5-6 sp-launch-particles-var) + (s4-6 *sp-particle-system-2d*) + (s3-6 (-> *part-id-table* 541)) + (s1-5 *launch-matrix*) + ) + (set! (-> s1-5 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) quad) + ) + (s5-6 s4-6 s3-6 s1-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (let ((v1-123 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-7 sp-launch-particles-var) + (s5-7 *sp-particle-system-2d*) + (s4-7 (-> *part-id-table* 544)) + (s2-7 *launch-matrix*) + ) + (set! (-> s2-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-123)) quad) + ) + (gp-7 s5-7 s4-7 s2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 1 (seconds 0.1)) + ) + ((5) + (change-sound! (-> self sound) (static-sound-name "green-eco-jak")) + (let ((s1-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-8 sp-launch-particles-var) + (s5-8 *sp-particle-system-2d*) + (s4-8 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 561 + 562 + ) + ) + ) + (s2-8 *launch-matrix*) + ) + (set! (-> s2-8 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-6)) quad) + ) + (gp-8 s5-8 s4-8 s2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-9 2) + (let ((v1-147 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-9 sp-launch-particles-var) + (s4-9 *sp-particle-system-2d*) + (s3-9 (-> *part-id-table* 563)) + (s1-7 *launch-matrix*) + ) + (set! (-> s1-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-147)) quad) + ) + (s5-9 s4-9 s3-9 s1-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + (update-trans! (-> self sound) (-> self control trans)) + (update! (-> self sound)) + ) + 0 + (none) + ) + +;; definition for function target-color-effect-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-color-effect-process target () + (when (and (-> self color-effect) (>= (- (-> self clock frame-counter) (-> self color-effect-start-time)) + (the-as time-frame (-> self color-effect-duration)) + ) + ) + (set! (-> self color-effect) #f) + (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) + (set! (-> self draw color-emissive quad) (the-as uint128 0)) + ) + (case (-> self color-effect) + (('shock) + (let ((f0-4 (rand-vu-float-range 0.5 2.0))) + (set-vector! (-> self draw color-mult) f0-4 f0-4 (+ 0.5 f0-4) 1.0) + ) + ) + (('eco-pill-dark) + (let ((f30-0 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-0) (lerp 0.0 0.0 f30-0) (lerp 0.0 0.3 f30-0) 1.0) + ) + ) + (('ammo-yellow) + (let ((f30-1 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-1) (lerp 1.0 1.0 f30-1) (lerp 1.0 0.0 f30-1) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-1) (lerp 0.0 0.3 f30-1) (lerp 0.0 0.0 f30-1) 1.0) + ) + ) + (('ammo-red) + (let ((f30-2 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-2) (lerp 1.0 0.6 f30-2) (lerp 1.0 0.6 f30-2) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-2) (lerp 0.0 0.0 f30-2) (lerp 0.0 0.0 f30-2) 1.0) + ) + ) + (('ammo-blue) + (let ((f30-3 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.6 f30-3) (lerp 1.0 0.8 f30-3) (lerp 1.0 1.0 f30-3) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-3) (lerp 0.0 0.1 f30-3) (lerp 0.0 0.3 f30-3) 1.0) + ) + ) + (('ammo-dark) + (let ((f30-4 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-4) (lerp 1.0 0.7 f30-4) (lerp 1.0 0.8 f30-4) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.2 f30-4) (lerp 0.0 0.0 f30-4) (lerp 0.0 0.1 f30-4) 1.0) + ) + ) + (('health) + (let ((f30-5 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.5 f30-5) (lerp 1.0 1.0 f30-5) (lerp 1.0 0.5 f30-5) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-5) (lerp 0.0 0.5 f30-5) (lerp 0.0 0.0 f30-5) 1.0) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-powerup-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-powerup-process target () + (let ((f30-0 (-> self control collision-spheres 0 prim-core world-sphere w))) + (if (logtest? (focus-status board) (-> self focus-status)) + (set! (-> self control collision-spheres 0 prim-core world-sphere w) + (+ 4096.0 (-> self control collision-spheres 0 prim-core world-sphere w)) + ) + ) + (water-control-method-10 (-> self water)) + (set! (-> self control collision-spheres 0 prim-core world-sphere w) f30-0) + ) + (if (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + (set! (-> self control unknown-time-frame26) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame27) (-> self clock frame-counter)) + ) + (cond + ((and (= (-> self control ground-pat material) (pat-material ice)) + (and (>= (-> self control ctrl-xz-vel) 204.8) + (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.05)) + ) + ) + (let ((gp-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 38)))) + (when (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-0 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (let ((t9-3 sp-launch-particles-var) + (a0-15 *sp-particle-system-3d*) + (a1-2 (-> *part-id-table* 165)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> gp-0 quad)) + (t9-3 a0-15 a1-2 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (let ((gp-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 31)))) + (when (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (let ((t9-6 sp-launch-particles-var) + (a0-19 *sp-particle-system-3d*) + (a1-5 (-> *part-id-table* 165)) + (a2-5 *launch-matrix*) + ) + (set! (-> a2-5 trans quad) (-> gp-1 quad)) + (t9-6 a0-19 a1-5 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (let ((f0-10 (lerp-scale 0.8 1.0 (-> self control ctrl-xz-vel) 0.0 81920.0))) + (let ((v1-64 (ja-group))) + (if (not (and v1-64 (= v1-64 (-> self draw art-group data 110)))) + (set! f0-10 (* 0.8 f0-10)) + ) + ) + (seek! (-> self control unknown-float45) f0-10 (-> self clock seconds-per-frame)) + ) + (let ((f30-1 (-> self control unknown-float45)) + (f0-14 (lerp-scale -0.3 0.3 (-> self control ctrl-xz-vel) 0.0 81920.0)) + ) + (sound-play-by-name + (static-sound-name "ice-loop") + (-> self control unknown-sound-id04) + (the int (* 1024.0 f30-1)) + (the int (* 1524.0 f0-14)) + 0 + (sound-group sfx) + (-> self control trans) + ) + ) + ) + ((< 0.0 (-> self control unknown-float45)) + (set! (-> self control unknown-float45) 0.0) + (let ((v1-85 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-85 command) (sound-command set-param)) + (set! (-> v1-85 id) (-> self control unknown-sound-id04)) + (set! (-> v1-85 params volume) -4) + (set! (-> v1-85 auto-time) 48) + (set! (-> v1-85 auto-from) 2) + (set! (-> v1-85 params mask) (the-as uint 17)) + (-> v1-85 id) + ) + ) + ) + (target-darkjak-process) + (when (nonzero? (-> (the-as fact-info-target (-> self fact-override)) trick-point-duration)) + (when (>= (- (-> *display* game-clock frame-counter) + (-> (the-as fact-info-target (-> self fact-override)) trick-point-start-time) + ) + (-> (the-as fact-info-target (-> self fact-override)) trick-point-duration) + ) + (format + #t + "------------> ~,,f total points~%" + (-> (the-as fact-info-target (-> self fact-override)) trick-point) + ) + (send-event + (handle->process (-> self notify)) + 'notify + 'trick-judge + (-> (the-as fact-info-target (-> self fact-override)) trick-point) + ) + (reset! (-> self fact-override) 'trick-judge) + ) + ) + (cond + ((logtest? (-> self game features) (game-feature unk-game-feature-01)) + (cond + ((< (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) + (set-setting! 'bg-a 'abs #x3e99999a 0) + (set-setting! 'bg-r 'abs #x3f800000 0) + (update-rates! (-> *display* entity-clock) 0.0) + (if (zero? (mod (the-as int (-> *display* base-clock integral-frame-counter)) 60)) + (sound-play "stopwatch") + ) + ) + ((nonzero? (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) + (remove-setting! 'bg-a) + (remove-setting! 'bg-r) + (update-rates! (-> *display* entity-clock) 1.0) + (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) 0) + 0 + ) + ((cpad-pressed? (-> self control cpad number) r1) + (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) + (+ (-> self clock frame-counter) (seconds 5)) + ) + ) + ) + ) + ((logtest? (-> self game features) (game-feature unk-game-feature-03)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio #x3f800000) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 60.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 2.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 2.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 2.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + ) + ) + ) + ((logtest? (-> self game features) (game-feature unk-game-feature-05)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio #x3f800000) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 0.3 (* 30.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 0.5 (* 30.0 (-> self clock seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 1.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 1.0 (* 30.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 30.0 (-> self clock seconds-per-frame))) + ) + ) + ) + ) + ) + (target-eco-process) + (target-color-effect-process) + (let ((a0-89 (-> self current-level))) + (case (if a0-89 + (-> a0-89 info taskname) + ) + (('sewer 'forest) + (let ((f30-2 (-> self board camera-interp))) + (cond + ((logtest? (focus-status board) (-> self focus-status)) + (seek! (-> self board camera-interp) 1.0 (* 0.1 (-> self clock seconds-per-frame))) + ) + ((< (-> self control ctrl-xz-vel) 2048.0) + ) + (else + (seek! (-> self board camera-interp) 0.0 (* 0.1 (-> self clock seconds-per-frame))) + ) + ) + (let ((f28-0 (-> self board camera-interp))) + (when (!= f28-0 f30-2) + (cond + ((= f28-0 0.0) + (remove-setting! 'fov) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-length) + ) + (else + (set-setting! 'fov 'rel (lerp-scale 1.0 1.32 f28-0 0.0 1.0) 0) + (set-setting! 'string-min-length 'rel (lerp-scale 1.0 0.6 f28-0 0.0 1.0) 0) + (set-setting! 'string-max-length 'rel (lerp-scale 1.0 0.6 f28-0 0.0 1.0) 0) + ) + ) + ) + ) + ) + ) + ) + ) + (logclear! (-> self focus-status) (focus-status super)) + (if (or (logtest? (-> self focus-status) (focus-status dead hit)) + (logtest? (state-flags sf2 tinvul1 sf5 tinvul2) (-> self state-flags)) + (-> *setting-control* user-current ignore-target) + ) + (logior! (-> self focus-status) (focus-status ignore)) + (logclear! (-> self focus-status) (focus-status ignore)) + ) + (cond + ((or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + (and (logtest? (focus-status board) (-> self focus-status)) + (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + ) + ) + (logior! (-> self focus-status) (focus-status in-air)) + (if (logtest? (surface-flag super) (-> self control current-surface flags)) + (set! (-> self focus-status) (logior (focus-status super) (-> self focus-status))) + ) + ) + (else + (logclear! (-> self focus-status) (focus-status in-air)) + ) + ) + (if (using-gun? self) + (set! (-> self focus-status) (logior (focus-status gun) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status gun)) + ) + (if (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + (logior! (-> self focus-status) (focus-status touch-water)) + (logclear! (-> self focus-status) (focus-status touch-water)) + ) + (if (logtest? (-> self control status) (collide-status on-water)) + (logior! (-> self focus-status) (focus-status on-water)) + (logclear! (-> self focus-status) (focus-status on-water)) + ) + (if (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + (logior! (-> self focus-status) (focus-status under-water)) + (logclear! (-> self focus-status) (focus-status under-water)) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set! (-> self focus-status) (logior (focus-status ice) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status ice)) + ) + (if (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.1)) + (set! (-> self focus-status) (logior (focus-status shooting) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status shooting)) + ) + 0 + (none) + ) + +;; definition for function target-powerup-effect +;; WARN: Return type mismatch int vs none. +(defbehavior target-powerup-effect target ((arg0 symbol)) + (case arg0 + (('eco-blue) + (let ((v1-4 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (eco-blue-glow (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-4))) + ) + ) + ) + 0 + (none) + ) + +;; definition for function process-contact-action +;; WARN: Return type mismatch int vs none. +(defbehavior process-contact-action target ((arg0 process)) + (when (logtest? (-> *game-info* features) (game-feature unk-game-feature-01)) + (if arg0 + (set! (-> self clock) (-> arg0 clock)) + (set! (-> self clock) (-> *display* base-clock)) + ) + ) + 0 + (none) + ) + + + + diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index 689e9b3b4d..50c1ebb9be 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -1624,9 +1624,9 @@ (set! (-> arg0 flags) (water-flags)) (set! (-> arg0 handle) (the-as handle #f)) (set! (-> s3-0 extra-flags) (the-as uint 0)) - (set! (-> (the-as region-prim-area #x70000000) region-prim-list num-items) 0) - (set! (-> (the-as region-prim-area #x70000000) region-inside-count) 0) - (set! (-> (the-as region-prim-area #x70000000) pos quad) (-> obj root-prim prim-core world-sphere quad)) + (set! (-> (scratchpad-object region-prim-area) region-prim-list num-items) 0) + (set! (-> (scratchpad-object region-prim-area) region-inside-count) 0) + (set! (-> (scratchpad-object region-prim-area) pos quad) (-> obj root-prim prim-core world-sphere quad)) (dotimes (s2-0 (-> *level* length)) (let ((v1-8 (-> *level* level s2-0))) (when (= (-> v1-8 status) 'active) @@ -1639,9 +1639,9 @@ (if (= (-> a0-10 name) 'water) (collect-regions a0-10 - (the-as sphere (-> (the-as region-prim-area #x70000000) pos)) + (the-as sphere (-> (scratchpad-object region-prim-area) pos)) 0 - (-> (the-as region-prim-area #x70000000) region-prim-list) + (-> (scratchpad-object region-prim-area) region-prim-list) ) ) (set! sv-80 (+ sv-80 1)) @@ -1654,8 +1654,8 @@ ) ) ) - (countdown (s2-1 (-> (the-as region-prim-area #x70000000) region-prim-list num-items)) - (water-info<-region s3-0 (-> (the-as region-prim-area #x70000000) region-prim-list items s2-1) obj arg1) + (countdown (s2-1 (-> (scratchpad-object region-prim-area) region-prim-list num-items)) + (water-info<-region s3-0 (-> (scratchpad-object region-prim-area) region-prim-list items s2-1) obj arg1) (when (and (logtest? (-> s3-0 flags) (water-flags active)) (logtest? (water-flags touch-water) (-> s3-0 flags)) (zero? (logand (-> s3-0 extra-flags) 1)) diff --git a/goal_src/jak2/engine/draw/drawable.gc b/goal_src/jak2/engine/draw/drawable.gc index 7946f83613..f6c4e433b9 100644 --- a/goal_src/jak2/engine/draw/drawable.gc +++ b/goal_src/jak2/engine/draw/drawable.gc @@ -274,6 +274,21 @@ (defun find-instance-by-name ((a0-0 string)) (the prototype-bucket #f)) +(defun main-debug-hook () + (when (not (or (= *master-mode* 'menu) (= *master-mode* 'progress))) + (let ((a0-3 *col-rend*)) + (if (-> a0-3 draw?) + (col-rend-method-9 a0-3) + ) + ) + (execute-connections *debug-engine* #f) + ;(draw-instance-info *stdcon*) + ) + (none) + ) + +(define *debug-hook* (cons main-debug-hook '())) + (defun real-main-draw-hook () (local-vars (a0-96 int) (a0-98 int)) (with-pp diff --git a/goal_src/jak2/engine/game/effect-control-h.gc b/goal_src/jak2/engine/game/effect-control-h.gc index 024e37fe7b..ea2aa10514 100644 --- a/goal_src/jak2/engine/game/effect-control-h.gc +++ b/goal_src/jak2/engine/game/effect-control-h.gc @@ -45,26 +45,26 @@ ;; DECOMP BEGINS (deftype effect-control (basic) - ((process process-drawable :offset-assert 4) - (flags effect-control-flag :offset-assert 8) - (last-frame-group art-joint-anim :offset-assert 12) - (last-frame-num float :offset-assert 16) - (channel-offset int32 :offset-assert 20) - (res res-lump :offset-assert 24) - (name (pointer res-tag) :offset-assert 28) - (param uint32 :offset-assert 32) + ((process process-drawable :offset-assert 4) + (flags effect-control-flag :offset-assert 8) + (last-frame-group art-joint-anim :offset-assert 12) + (last-frame-num float :offset-assert 16) + (channel-offset int32 :offset-assert 20) + (res res-lump :offset-assert 24) + (name (pointer res-tag) :offset-assert 28) + (param uint32 :offset-assert 32) ) :method-count-assert 15 :size-assert #x24 :flag-assert #xf00000024 (:methods (new (symbol type process-drawable) _type_ 0) - (effect-control-method-9 (_type_) none 9) + (update-effects (_type_) none 9) (do-effect (_type_ symbol float int) none 10) - (effect-control-method-11 () none 11) + (do-effect-for-surface (_type_ symbol float int basic pat-surface) none 11) (play-effect-sound (_type_ symbol float int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) - (effect-control-method-14 () none 14) + (play-effects-from-res-lump (_type_ float float float) none 14) ) ) diff --git a/goal_src/jak2/engine/game/effect-control.gc b/goal_src/jak2/engine/game/effect-control.gc new file mode 100644 index 0000000000..dfee597779 --- /dev/null +++ b/goal_src/jak2/engine/game/effect-control.gc @@ -0,0 +1,1200 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *footstep-surface*, type pat-surface +(define *footstep-surface* (new 'static 'pat-surface :material (pat-material grass))) + +;; definition for symbol *debug-effect-control*, type symbol +(define *debug-effect-control* #f) + +;; definition for function sound-name-with-material +(defun sound-name-with-material ((arg0 string) (arg1 pat-surface) (arg2 string)) + (format + (clear *temp-string*) + "~S-~S~S" + arg0 + (-> (new 'static 'boxed-array :type string + "unk" + "ice" + "qsd" + "wtr" + "tar" + "san" + "wod" + "grs" + "pmt" + "snw" + "dsn" + "unk" + "lav" + "cwd" + "grv" + "drt" + "mtl" + "str" + "pmt" + "swm" + "unk" + "mtl" + "neu" + "stn" + "cmt" + "car" + "gmt" + "smt" + "hwd" + ) + (-> arg1 material) + ) + arg2 + ) + (string->sound-name *temp-string*) + ) + +;; definition for function effect-param->sound-spec +(defun effect-param->sound-spec ((arg0 sound-spec) (arg1 (pointer float)) (arg2 int) (arg3 process-focusable)) + (while (> arg2 0) + (case (the int (-> arg1 0)) + ((3) + (logior! (-> arg0 mask) (sound-mask volume)) + (set! (-> arg0 volume) (the int (* 1024.0 (-> arg1 1)))) + ) + ((4) + (logior! (-> arg0 mask) (sound-mask volume)) + (+! (-> arg0 volume) (the int (* 1024.0 (* (-> arg1 1) (rand-vu))))) + ) + ((5) + (logior! (-> arg0 mask) (sound-mask pitch)) + (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) + ) + ((6) + (logior! (-> arg0 mask) (sound-mask pitch)) + (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) + ) + ((9) + (logior! (-> arg0 mask) (sound-mask bend)) + (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) + ) + ((10) + (logior! (-> arg0 mask) (sound-mask bend)) + (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) + ) + ((11) + (logior! (-> arg0 mask) (sound-mask fo-min)) + (set! (-> arg0 fo-min) (the int (-> arg1 1))) + ) + ((12) + (logior! (-> arg0 mask) (sound-mask fo-max)) + (set! (-> arg0 fo-max) (the int (-> arg1 1))) + ) + ((13) + (logior! (-> arg0 mask) (sound-mask fo-curve)) + (set! (-> arg0 fo-curve) (the int (-> arg1 1))) + ) + ((19) + (set! (-> arg0 priority) (the int (-> arg1 1))) + ) + ((25) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (-> *footstep-surface* material))) + (let* ((s2-3 arg3) + (v1-33 (if (type? s2-3 process-focusable) + s2-3 + ) + ) + ) + (when v1-33 + (cond + ((logtest? (-> v1-33 focus-status) (focus-status in-air)) + (set! (-> arg0 reg 0) (the-as uint 126)) + ) + ((logtest? (-> v1-33 focus-status) (focus-status touch-water)) + (set! (-> arg0 reg 0) (the-as uint 127)) + ) + (else + (let* ((s2-4 (-> v1-33 root-override)) + (v1-34 (if (type? s2-4 collide-shape-moving) + s2-4 + ) + ) + ) + (if v1-34 + (set! (-> arg0 reg 0) (the-as uint (-> (the-as collide-shape-moving v1-34) ground-pat material))) + ) + ) + ) + ) + ) + ) + ) + ((21) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (the int (-> arg1 1)))) + ) + ((22) + (logior! (-> arg0 mask) (sound-mask reg1)) + (set! (-> arg0 reg 1) (the-as uint (the int (-> arg1 1)))) + ) + ((23) + (logior! (-> arg0 mask) (sound-mask reg2)) + (set! (-> arg0 reg 2) (the-as uint (the int (-> arg1 1)))) + ) + ) + (+! arg2 -2) + (set! arg1 (&-> arg1 2)) + ) + arg0 + ) + +;; definition for method 9 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod update-effects effect-control ((obj effect-control)) + (let* ((a0-1 (-> obj process skel)) + (v1-3 (if (< (the-as uint (-> obj channel-offset)) (-> a0-1 active-channels)) + (-> a0-1 root-channel (-> obj channel-offset)) + (the-as joint-control-channel #f) + ) + ) + ) + (cond + ((and v1-3 (-> v1-3 frame-group)) + (let* ((s5-0 (-> v1-3 frame-group)) + (f30-0 (+ (* (-> v1-3 frame-num) (-> s5-0 artist-step)) (-> s5-0 artist-base))) + ) + (let ((a0-3 (-> a0-1 root-channel 0 num-func))) + (cond + ((!= s5-0 (-> obj last-frame-group)) + (set! (-> obj res) (-> s5-0 extra)) + (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo))) + (set! (-> obj name) (if (>= (the-as int v1-6) 0) + (&-> (-> s5-0 extra tag) v1-6) + (the-as (pointer res-tag) #f) + ) + ) + ) + (if (and (-> obj name) (= (-> obj name 0 key-frame) -1000000000.0)) + (set! (-> obj name) (&-> (-> obj name) 1)) + ) + (play-effects-from-res-lump obj f30-0 f30-0 f30-0) + ) + ((or (not (-> obj name)) (= f30-0 (-> obj last-frame-num))) + ) + (else + (let ((f28-0 (-> obj last-frame-num)) + (f26-0 f30-0) + ) + (cond + ((= a0-3 num-func-seek!) + (let ((f0-6 (+ (* (-> v1-3 param 0) (-> s5-0 artist-step)) (-> s5-0 artist-base)))) + (cond + ((< f26-0 f28-0) + (if (>= f28-0 f0-6) + (play-effects-from-res-lump obj f26-0 f28-0 f30-0) + ) + ) + (else + (if (>= f0-6 f28-0) + (play-effects-from-res-lump obj f28-0 f26-0 f30-0) + ) + ) + ) + ) + ) + ((or (= a0-3 num-func-loop!) (= a0-3 num-func-loop-speedless!)) + (cond + ((>= (-> v1-3 param 0) 0.0) + (cond + ((< f26-0 f28-0) + (play-effects-from-res-lump obj f28-0 9999999.0 f30-0) + (play-effects-from-res-lump obj -100000000.0 f26-0 9999999.0) + ) + (else + (play-effects-from-res-lump obj f28-0 f26-0 f30-0) + ) + ) + ) + ((< f28-0 f26-0) + (play-effects-from-res-lump obj f26-0 9999999.0 f30-0) + (play-effects-from-res-lump obj -100000000.0 f28-0 9999999.0) + ) + (else + (play-effects-from-res-lump obj f26-0 f28-0 f30-0) + ) + ) + ) + ((= a0-3 num-func-+!) + (if (>= (-> v1-3 param 0) 0.0) + (play-effects-from-res-lump obj f28-0 f26-0 f30-0) + (play-effects-from-res-lump obj f26-0 f28-0 f30-0) + ) + ) + ((= a0-3 num-func-identity) + (play-effects-from-res-lump obj f30-0 f30-0 f30-0) + ) + ) + ) + ) + ) + ) + (set! (-> obj last-frame-group) s5-0) + (set! (-> obj last-frame-num) f30-0) + ) + ) + (else + (set! (-> obj last-frame-group) #f) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod play-effects-from-res-lump effect-control ((obj effect-control) (arg0 float) (arg1 float) (arg2 float)) + ;; note: this check was added. I believe in the original game name could be false, and then the + ;; effect-name check below would fail. This did not cause a crash on original hardware because + ;; misaligned 16-byte loads silently align. This causes a crash in opengoal, so we skip it manually. + ;; (also happened in jak 1) + (when (-> obj name) + (let ((s2-0 (-> obj name))) + (while (= (-> s2-0 0 name) 'effect-name) + (let ((f0-0 (-> s2-0 0 key-frame))) + (when (or (and (< f0-0 arg1) (< arg0 f0-0)) (= f0-0 arg2)) + (let* ((a0-1 obj) + (t9-0 (method-of-object a0-1 do-effect)) + (v1-7 (-> obj res)) + (a1-1 (-> s2-0 0)) + ) + (t9-0 + a0-1 + (the-as symbol (-> (the-as (pointer uint32) (&+ (-> v1-7 data-base) (-> a1-1 data-offset))))) + f0-0 + -1 + ) + ) + ) + ) + (set! s2-0 (&-> s2-0 1)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 10 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 257] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 317] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 337] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 459] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 480] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 579] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 598] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 303] +;; WARN: Function (method 10 effect-control) has a return type of none, but the expression builder found a return statement. +(defmethod do-effect effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int)) + (local-vars + (sv-320 int) + (sv-336 symbol) + (sv-352 symbol) + (sv-368 symbol) + (sv-384 vector) + (sv-400 matrix) + (sv-416 int) + (sv-432 symbol) + (sv-448 symbol) + (sv-464 symbol) + (sv-480 vector) + (sv-496 matrix) + (sv-512 res-lump) + ) + (with-pp + (cond + ((logtest? (-> obj flags) (effect-control-flag ecf2)) + (return #f) + ) + ((= arg0 'script) + (let ((gp-1 + (get-property-struct + (-> obj res) + 'effect-script + 'exact + arg1 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair gp-1) + ) + ) + (return #f) + ) + ) + (let ((s3-0 (-> arg0 value)) + (s5-0 (cond + ((< arg2 0) + (let ((v0-5 (get-property-value + (-> obj res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (zero? v0-5) + 0 + (the-as int (+ v0-5 1)) + ) + ) + ) + (else + (empty) + arg2 + ) + ) + ) + ) + (when (logtest? (-> obj flags) (effect-control-flag ecf0)) + (if (send-event (-> obj process) 'effect-control arg0 arg1 s5-0) + (return 0) + ) + ) + (let ((v1-23 (symbol->string arg0))) + (cond + ((and (= (-> v1-23 data 0) 101) + (= (-> v1-23 data 1) 102) + (= (-> v1-23 data 2) 102) + (= (-> v1-23 data 3) 101) + (= (-> v1-23 data 4) 99) + (= (-> v1-23 data 5) 116) + (= (-> v1-23 data 6) 45) + ) + (let* ((s3-1 (-> obj process root)) + (v1-27 (if (type? s3-1 collide-shape-moving) + s3-1 + ) + ) + (t1-2 (if v1-27 + (-> (the-as collide-shape-moving v1-27) ground-pat) + *footstep-surface* + ) + ) + ) + (do-effect-for-surface obj arg0 arg1 s5-0 (-> obj res) t1-2) + ) + ) + ((let ((v1-31 (symbol->string arg0))) + (and (= (-> v1-31 data 0) 103) + (= (-> v1-31 data 1) 114) + (= (-> v1-31 data 2) 111) + (= (-> v1-31 data 3) 117) + (= (-> v1-31 data 4) 112) + (= (-> v1-31 data 5) 45) + ) + ) + (set! s3-0 (cond + ((zero? s3-0) + (let ((v0-10 (lookup-part-group-pointer-by-name (symbol->string arg0)))) + (when v0-10 + (set! (-> arg0 value) v0-10) + (set! s3-0 (-> v0-10 0)) + ) + ) + s3-0 + ) + (else + (-> (the-as (pointer object) s3-0) 0) + ) + ) + ) + (when (and (nonzero? s3-0) (= (-> (the-as basic s3-0) type) sparticle-launch-group)) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 + (the-as part-tracker s4-1) + (-> obj process) + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((s2-1 run-function-in-process) + (s1-0 s4-1) + (s0-0 part-tracker-init) + ) + (set! sv-320 0) + (set! sv-336 (the-as symbol #f)) + (set! sv-352 (the-as symbol #f)) + (set! sv-368 (the-as symbol #f)) + (set! sv-400 *launch-matrix*) + (set! sv-384 (-> sv-400 trans)) + (let ((v1-55 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-384 quad) v1-55) + ) + ((the-as (function object object object object object object object object none) s2-1) + s1-0 + s0-0 + s3-0 + sv-320 + sv-336 + sv-352 + sv-368 + sv-400 + ) + ) + (-> s4-1 ppointer) + ) + ) + ) + ) + ((let ((v1-58 (symbol->string arg0))) + (and (= (-> v1-58 data 0) 101) + (= (-> v1-58 data 1) 118) + (= (-> v1-58 data 2) 101) + (= (-> v1-58 data 3) 110) + (= (-> v1-58 data 4) 116) + (= (-> v1-58 data 5) 45) + ) + ) + (send-event (-> obj process) arg0 arg1 s5-0) + ) + ((= arg0 'camera-shake) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((zero? s3-0) + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (if *debug-effect-control* + (format + #t + "(~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (format + #t + "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + (let ((s4-2 sp-launch-particles-var) + (s2-2 *sp-particle-system-2d*) + (s0-2 *launch-matrix*) + ) + (set! (-> s0-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad) + ) + (s4-2 + s2-2 + (the-as sparticle-launcher s3-0) + s0-2 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launch-group) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-23 (method-of-type part-tracker activate))) + (t9-23 + (the-as part-tracker s4-3) + (-> obj process) + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((s2-3 run-function-in-process) + (s1-3 s4-3) + (s0-3 part-tracker-init) + ) + (set! sv-416 0) + (set! sv-432 (the-as symbol #f)) + (set! sv-448 (the-as symbol #f)) + (set! sv-464 (the-as symbol #f)) + (set! sv-496 *launch-matrix*) + (set! sv-480 (-> sv-496 trans)) + (let ((v1-95 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-480 quad) v1-95) + ) + ((the-as (function object object object object object object object object none) s2-3) + s1-3 + s0-3 + s3-0 + sv-416 + sv-432 + sv-448 + sv-464 + sv-496 + ) + ) + (-> s4-3 ppointer) + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sound-spec) + (sound-play-by-spec + (the-as sound-spec s3-0) + (new-sound-id) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) + ) + ) + ((= (-> (the-as basic s3-0) type) death-info) + (when (and (logtest? (-> obj flags) (effect-control-flag ecf1)) (zero? (-> obj process draw death-timer))) + (let ((v1-106 (-> obj process draw))) + (let ((a1-51 (-> (the-as death-info s3-0) vertex-skip)) + (a0-77 + (max + 2 + (the-as int (/ (-> (the-as death-info s3-0) timer) (the-as uint (the int (-> *display* time-factor))))) + ) + ) + ) + (when (= (-> *setting-control* user-current video-mode) 'pal) + (if (< (the-as uint 1) a1-51) + (set! a1-51 (/ (the-as uint (* (the-as uint 50) a1-51)) (the-as uint 60))) + ) + ) + (let ((a2-37 (-> *display* frames (-> *display* last-screen) run-time))) + (cond + ((< (seconds 30) a2-37) + (set! a1-51 (* a1-51 4)) + ) + ((< (seconds 23.335) a2-37) + (set! a1-51 (* a1-51 2)) + ) + ) + ) + (set! (-> v1-106 death-vertex-skip) a1-51) + (set! (-> v1-106 death-effect) (-> (the-as death-info s3-0) effect)) + (set! (-> v1-106 death-timer) (the-as uint (+ a0-77 1))) + ) + (set! (-> v1-106 death-timer-org) (-> v1-106 death-timer)) + (set! (-> v1-106 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) + ) + (when (-> (the-as death-info s3-0) sound) + (let* ((s2-5 obj) + (s1-4 (method-of-object s2-5 play-effect-sound)) + (s0-4 (-> (the-as death-info s3-0) sound)) + ) + (set! sv-512 (-> obj res)) + (let ((t1-12 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) + (s1-4 s2-5 s0-4 arg1 s5-0 sv-512 t1-12) + ) + ) + ) + (send-event (-> obj process) 'death-start (the-as death-info s3-0)) + ) + ) + (else + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 11 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod do-effect-for-surface effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) + (local-vars + (sv-64 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-80 sparticle-system) + (sv-96 vector) + (sv-112 matrix) + (sv-128 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-144 sparticle-system) + (sv-160 vector) + (sv-176 matrix) + (sv-192 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-208 sparticle-system) + (sv-224 vector) + (sv-240 matrix) + ) + (let ((s1-0 (the-as sound-name #f))) + (-> *display* frames (-> *display* last-screen) run-time) + (case arg0 + (('effect-walk-step-left) + (set! s1-0 (sound-name-with-material "walk" arg4 "1")) + ) + (('effect-run-step-left) + (set! s1-0 (sound-name-with-material "run" arg4 "1")) + ) + (('effect-mech-step-left) + (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) + ) + (('effect-walk-step-right) + (set! s1-0 (sound-name-with-material "walk" arg4 "2")) + ) + (('effect-run-step-right) + (set! s1-0 (sound-name-with-material "run" arg4 "2")) + ) + (('effect-mech-step-right) + (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) + ) + (('effect-roll) + (set! s1-0 (sound-name-with-material "roll" arg4 "")) + ) + (('effect-slide) + (set! s1-0 (sound-name-with-material "slide" arg4 "")) + ) + (('effect-land) + (set! s1-0 (sound-name-with-material "land" arg4 "")) + ) + (('effect-zoom-land) + (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) + ) + (('effect-zoom-hit) + (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) + ) + (('effect-flut-land) + (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) + ) + (('effect-land-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-land-poof-unk + 'group-land-poof-ice + 'group-land-poof-qsd + 'group-land-poof-wtr + 'group-land-poof-tar + 'group-land-poof-san + 'group-land-poof-wod + 'group-land-poof-grs + 'group-land-poof-pmt + 'group-land-poof-snw + 'group-land-poof-dsn + 'group-land-poof-unk + 'group-land-poof-lav + 'group-land-poof-cwd + 'group-land-poof-grv + 'group-land-poof-drt + 'group-land-poof-mtl + 'group-land-poof-str + 'group-land-poof-pmt + 'group-land-poof-swm + 'group-land-poof-unk + 'group-land-poof-mtl + 'group-land-poof-neu + 'group-land-poof-stn + 'group-land-poof-cmt + 'group-land-poof-car + 'group-land-poof-gmt + 'group-land-poof-smt + 'group-land-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-run-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-run-poof-unk + 'group-run-poof-ice + 'group-run-poof-qsd + 'group-run-poof-wtr + 'group-run-poof-tar + 'group-run-poof-san + 'group-run-poof-wod + 'group-run-poof-grs + 'group-run-poof-pmt + 'group-run-poof-snw + 'group-run-poof-dsn + 'group-run-poof-unk + 'group-run-poof-lav + 'group-run-poof-cwd + 'group-run-poof-grv + 'group-run-poof-drt + 'group-run-poof-mtl + 'group-run-poof-str + 'group-run-poof-pmt + 'group-run-poof-swm + 'group-run-poof-unk + 'group-run-poof-mtl + 'group-run-poof-neu + 'group-run-poof-stn + 'group-run-poof-cmt + 'group-run-poof-car + 'group-run-poof-gmt + 'group-run-poof-smt + 'group-run-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-just-footprint) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-just-footprint-unk + 'group-just-footprint-ice + 'group-just-footprint-qsd + 'group-just-footprint-wtr + 'group-just-footprint-tar + 'group-just-footprint-san + 'group-just-footprint-wod + 'group-just-footprint-grs + 'group-just-footprint-pmt + 'group-just-footprint-snw + 'group-just-footprint-dsn + 'group-just-footprint-unk + 'group-just-footprint-lav + 'group-just-footprint-cwd + 'group-just-footprint-grv + 'group-just-footprint-drt + 'group-just-footprint-mtl + 'group-just-footprint-str + 'group-just-footprint-pmt + 'group-just-footprint-swm + 'group-just-footprint-unk + 'group-just-footprint-mtl + 'group-just-footprint-neu + 'group-just-footprint-stn + 'group-just-footprint-cmt + 'group-just-footprint-car + 'group-just-footprint-gmt + 'group-just-footprint-smt + 'group-just-footprint-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-just-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-just-poof-unk + 'group-just-poof-ice + 'group-just-poof-qsd + 'group-just-poof-wtr + 'group-just-poof-tar + 'group-just-poof-san + 'group-just-poof-wod + 'group-just-poof-grs + 'group-just-poof-pmt + 'group-just-poof-snw + 'group-just-poof-dsn + 'group-just-poof-unk + 'group-just-poof-lav + 'group-just-poof-cwd + 'group-just-poof-grv + 'group-just-poof-drt + 'group-just-poof-mtl + 'group-just-poof-str + 'group-just-poof-pmt + 'group-just-poof-swm + 'group-just-poof-unk + 'group-just-poof-mtl + 'group-just-poof-neu + 'group-just-poof-stn + 'group-just-poof-cmt + 'group-just-poof-car + 'group-just-poof-gmt + 'group-just-poof-smt + 'group-just-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-slide-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-slide-poof-unk + 'group-slide-poof-ice + 'group-slide-poof-qsd + 'group-slide-poof-wtr + 'group-slide-poof-tar + 'group-slide-poof-san + 'group-slide-poof-wod + 'group-slide-poof-grs + 'group-slide-poof-pmt + 'group-slide-poof-snw + 'group-slide-poof-dsn + 'group-slide-poof-unk + 'group-slide-poof-lav + 'group-slide-poof-cwd + 'group-slide-poof-grv + 'group-slide-poof-drt + 'group-slide-poof-mtl + 'group-slide-poof-str + 'group-slide-poof-pmt + 'group-slide-poof-swm + 'group-slide-poof-unk + 'group-slide-poof-mtl + 'group-slide-poof-neu + 'group-slide-poof-stn + 'group-slide-poof-cmt + 'group-slide-poof-car + 'group-slide-poof-gmt + 'group-slide-poof-smt + 'group-slide-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-droppings) + (let ((s0-0 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x97 + #x1b7 + #x1b8 + #x1b9 + #x1ba + #x82 + #x94 + #x84 + #x1bb + #x85 + #x1bc + #x97 + #x1bd + #x96 + #x1be + #x83 + #x1bf + #x1c0 + #x1bb + #x1c1 + #x97 + #x1bf + #x1c2 + #x95 + #x1c3 + #x1c4 + #x1c5 + #x1c6 + #x1c7 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-0) + (set! sv-64 sp-launch-particles-var) + (set! sv-80 *sp-particle-system-2d*) + (set! sv-112 *launch-matrix*) + (set! sv-96 (-> sv-112 trans)) + (let ((v1-63 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) quad))) + (set! (-> sv-96 quad) v1-63) + ) + (let ((a3-6 #f) + (t0-1 #f) + (t1-1 1.0) + ) + (sv-64 sv-80 s0-0 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + ) + ) + ) + ) + (('effect-jump-droppings) + (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x1c8 + #x1c9 + #x1ca + #x1cb + #x1cc + #x90 + #x1cd + #x93 + #x1ce + #x92 + #x1cf + #x1c8 + #x1d0 + #x1d1 + #x1d2 + #x91 + #x1d3 + #x1d4 + #x1ce + #x1d5 + #x1c8 + #x1d3 + #x1d6 + #x1d7 + #x1d8 + #x1d9 + #x1da + #x1db + #x1dc + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-1) + (set! sv-128 sp-launch-particles-var) + (set! sv-144 *sp-particle-system-2d*) + (set! sv-176 *launch-matrix*) + (set! sv-160 (-> sv-176 trans)) + (let ((v1-79 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) quad))) + (set! (-> sv-160 quad) v1-79) + ) + (let ((a3-7 #f) + (t0-2 #f) + (t1-2 1.0) + ) + (sv-128 sv-144 s0-1 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + ) + ) + ) + ) + (('effect-board-poof) + (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x1dd + #x1de + #x1df + #x1e0 + #x1e1 + #x1e2 + #x1e3 + #x1e4 + #x1e5 + #x1e6 + #x1e7 + #x1dd + #x1e8 + #x1e9 + #x1ea + #x1eb + #x1ec + #x1ed + #x1e5 + #x1ee + #x1dd + #x1ec + #x1ef + #x1b3 + #x1f0 + #x1f1 + #x1f2 + #x1f3 + #x1f4 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-2) + (set! sv-192 sp-launch-particles-var) + (set! sv-208 *sp-particle-system-2d*) + (set! sv-240 *launch-matrix*) + (set! sv-224 (-> sv-240 trans)) + (let ((v1-96 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) quad))) + (set! (-> sv-224 quad) v1-96) + ) + (let ((a3-8 #f) + (t0-3 #f) + (t1-3 1.0) + ) + (sv-192 sv-208 s0-2 sv-240 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + ) + ) + ) + ) + ) + (if s1-0 + (play-effect-sound obj arg0 arg1 arg2 arg3 s1-0) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type effect-control +;; INFO: Used lq/sq +(defmethod play-effect-sound effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) + (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) + (with-pp + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (the-as object (new 'stack 'sound-spec))) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) + ) + ) + ) + (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) + (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) + (set! (-> (the-as sound-spec gp-0) volume) 1024) + (set! sv-112 (new 'static 'res-tag)) + (let* ((t9-2 (method-of-type res-lump get-property-data)) + (a1-5 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer res-tag) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + ) + (when a1-6 + (effect-param->sound-spec + (the-as sound-spec gp-0) + (the-as (pointer float) a1-6) + (the-as int (-> sv-112 elt-count)) + (the-as process-focusable (-> obj process)) + ) + (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) + (return 0) + ) + ) + ) + (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) + (when (!= f0-0 0.0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) + (let ((f0-1 (* 2.0 f0-0))) + (set! (-> (the-as sound-spec gp-0) pitch-mod) + (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) + ) + ) + ) + ) + (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) + (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-8 (ear-trans 0)) + (a1-7 s5-0) + ) + (< f30-0 (sv-160 a0-8 a1-7)) + ) + ) + ) + (= (-> (the-as (pointer int8) gp-0) 9) 126) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " + (-> pp clock frame-counter) + (-> obj process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) + (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) + ) + ) + (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) + ) + 0 + ) + ) + +;; definition for function target-land-effect +;; WARN: Return type mismatch int vs none. +(defbehavior target-land-effect target () + (cond + ((logtest? (-> self focus-status) (focus-status flut)) + (do-effect (-> self skel effect) 'effect-land-poof -1.0 -1) + (do-effect (-> self skel effect) 'effect-flut-land -1.0 -1) + ) + ((logtest? (focus-status pilot) (-> self focus-status)) + (sound-play-by-name + (sound-name-with-material "zoom-land" (-> self control ground-pat) "") + (new-sound-id) + (the int (* 1024.0 (* 0.000016276043 (-> self control ground-impact-vel)))) + 0 + 0 + (sound-group sfx) + #t + ) + ) + ((logtest? (water-flags touch-water) (-> self water flags)) + (do-effect (-> self skel effect) 'effect-land-water -1.0 -1) + ) + (else + (do-effect (-> self skel effect) 'effect-land-poof -1.0 -1) + (do-effect (-> self skel effect) 'effect-land -1.0 -1) + ) + ) + 0 + (none) + ) + + + + diff --git a/goal_src/jak2/engine/game/main-h.gc b/goal_src/jak2/engine/game/main-h.gc index 5f7bfc1f52..da3a26e949 100644 --- a/goal_src/jak2/engine/game/main-h.gc +++ b/goal_src/jak2/engine/game/main-h.gc @@ -279,28 +279,99 @@ ) ) +(defenum collide-spec + :bitfield #t + :type uint32 + + (backgnd 0) ;; 1 + (jak 1) ;; 2 + (bot 2) ;; 4 + (crate 3) ;; 8 + (civilian 4) ;; 16 + (enemy 5) ;; 32 + (obstacle 6) ;; 64 + (vehicle-sphere 7) ;; 128 + (hit-by-player-list 8) ;; 256 + (hit-by-others-list 9) ;; 512 + (player-list 10) ;; 1024 + (water 11) ;; 2048 + (collectable 12) ;; 4096 + (blocking-plane 13) ;; 8192 + (projectile 14) ;; 16384 + (jak-vulnerable 15) ;; 32768 + (camera-blocker 16) ;; hi 1 + (notice-blue-eco-powerup 17) ;; hi 2 + (tobot 18) ;; hi 4 + (pusher 19) ;; hi 8 + (vehicle-mesh 20) ;; hi 16 + (bot-targetable 21) ;; hi 32 + (jak-vehicle 22) ;; hi 64 + (special-obstacle 23) ;; hi 128 + (mech-punch 24) ;; hi 256 + (obstacle-for-jak 25) ;; hi 512 + (vehicle-mesh-probeable 26) ;; hi 1024 + (unknown-27 27) + (unknown-28 28) + (unknown-29 29) + (unknown-30 30) + (unknown-31 31) + (unknown-32 32) + (unknown-33 33) + (unknown-34 34) + (unknown-35 35) + (unknown-36 36) + (unknown-37 37) + (unknown-38 38) + (unknown-39 39) + (unknown-40 40) + (unknown-41 41) + (unknown-42 42) + (unknown-43 43) + (unknown-44 44) + (unknown-45 45) + (unknown-46 46) + (unknown-47 47) + (unknown-48 48) + (unknown-49 49) + (unknown-50 50) + (unknown-51 51) + (unknown-52 52) + (unknown-53 53) + (unknown-54 54) + (unknown-55 55) + (unknown-56 56) + (unknown-57 57) + (unknown-58 58) + (unknown-59 59) + (unknown-60 60) + (unknown-61 61) + (unknown-62 62) + (unknown-63 63) + ) + ;; collision renderer settings. (deftype col-rend (basic) - ((draw? symbol :offset-assert 4) - (outline? symbol :offset-assert 8) - (show-back-faces? symbol :offset-assert 12) - (show-normals? symbol :offset-assert 16) - (ghost-hidden? symbol :offset-assert 20) - (show-only uint32 :offset-assert 24) - (cspec uint32 :offset-assert 28) - (track uint8 :offset-assert 32) - (bbox-radius float :offset-assert 36) - (bbox-center vector :inline :offset-assert 48) - (camera-to-bbox-dist float :offset-assert 64) + ((draw? symbol :offset-assert 4) + (outline? symbol :offset-assert 8) + (show-back-faces? symbol :offset-assert 12) + (show-normals? symbol :offset-assert 16) + (ghost-hidden? symbol :offset-assert 20) + (show-only uint32 :offset-assert 24) + (cspec collide-spec :offset-assert 28) + (track uint8 :offset-assert 32) + (bbox-radius float :offset-assert 36) + (bbox-center vector :inline :offset-assert 48) + (camera-to-bbox-dist float :offset-assert 64) ) :method-count-assert 10 :size-assert #x44 :flag-assert #xa00000044 (:methods - (col-rend-method-9 () none 9) + (col-rend-method-9 (_type_) none 9) ) ) + (define *col-rend* (new 'static 'col-rend :draw? #f :outline? #t diff --git a/goal_src/jak2/engine/game/settings.gc b/goal_src/jak2/engine/game/settings.gc index 2ce06bc7ed..64255f924e 100644 --- a/goal_src/jak2/engine/game/settings.gc +++ b/goal_src/jak2/engine/game/settings.gc @@ -898,8 +898,7 @@ ) (defmethod apply-settings setting-control ((obj setting-control)) - ;; (speech-control-method-11 *speech-control*) - (format #t "skip *speech-control* method 11 in apply-settings~%") + (speech-control-method-11 *speech-control*) (let ((s5-0 (-> obj user-current))) (let ((s4-0 (-> obj user-target))) (mem-copy! (the-as pointer s4-0) (the-as pointer (-> obj user-default)) 528) diff --git a/goal_src/jak2/engine/gfx/foreground/eye.gc b/goal_src/jak2/engine/gfx/foreground/eye.gc index 225d0c9fc4..e367d0756f 100644 --- a/goal_src/jak2/engine/gfx/foreground/eye.gc +++ b/goal_src/jak2/engine/gfx/foreground/eye.gc @@ -16,6 +16,6 @@ ) (defun merc-eye-anim ((arg0 process-drawable)) - (format *stdcon* "no eyes for you ~A~%" arg0) + ;; (format *stdcon* "no eyes for you ~A~%" arg0) (none) ) \ No newline at end of file diff --git a/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc b/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc index a291270246..27f536a499 100644 --- a/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc +++ b/goal_src/jak2/engine/gfx/merc/merc-blend-shape.gc @@ -8,6 +8,6 @@ ;; DECOMP BEGINS (defun merc-blend-shape ((obj process-drawable)) - (format *stdcon* "no mbs for you ~A~%" obj) + ;; (format *stdcon* "no mbs for you ~A~%" obj) (the object #f) ) \ No newline at end of file diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc index bf4534dcaa..faedee7ffa 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher.gc @@ -795,7 +795,6 @@ ;; WARN: Return type mismatch object vs sparticle-launch-control. (defmethod create-launch-control sparticle-launch-group ((obj sparticle-launch-group) (arg0 process)) - (format 0 "create launch control: ~A ~D~%" arg0 (-> obj length)) (let ((gp-0 (the-as object (new 'process 'sparticle-launch-control (-> obj length))))) (when (zero? (the-as sparticle-launch-control gp-0)) (go process-drawable-art-error "memory") diff --git a/goal_src/jak2/engine/level/level.gc b/goal_src/jak2/engine/level/level.gc index 2bc0e8ff4f..a1c4f8b9b0 100644 --- a/goal_src/jak2/engine/level/level.gc +++ b/goal_src/jak2/engine/level/level.gc @@ -2222,10 +2222,9 @@ ) (start-debug "PLAY: starting dproc~%") (on #t) - (format 0 "SKIP: initialize game info~%") - ; (if arg1 - ; (initialize! *game-info* 'game (the-as game-save #f) (the-as string #f)) - ; ) + (if arg1 + (initialize! *game-info* 'game (the-as game-save #f) (the-as string #f)) + ) (kmemclose) (kmemclose) 0 @@ -2664,10 +2663,10 @@ (local-vars (v1-101 symbol)) (camera-pos) (new 'static 'boxed-array :type symbol :length 0 :allocated-length 6) - ;; (update *setting-control*) + (update *setting-control*) ;; (update *gui-control* #t) - ;; (update *art-control* #t) - ;; (clear-rec *art-control*) + (update *art-control* #t) + (clear-rec *art-control*) (dotimes (s5-0 6) (load-continue (-> obj level s5-0)) ) @@ -2683,7 +2682,6 @@ ) (update! *load-state*) - #| (dotimes (s5-2 (-> obj length)) (let ((s4-1 (-> obj level s5-2))) (when (= (-> s4-1 status) 'active) @@ -2745,7 +2743,6 @@ ) ) ) - |# (dotimes (v1-88 (-> obj length)) (let ((a0-48 (-> obj level v1-88))) (when (= (-> a0-48 status) 'active) diff --git a/goal_src/jak2/engine/process-drawable/process-drawable.gc b/goal_src/jak2/engine/process-drawable/process-drawable.gc index a4b9cab168..20059cb515 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable.gc @@ -407,16 +407,11 @@ ) (dotimes (s1-1 1) (let* ((v1-20 (-> arg0 data s1-1)) - (t9-3 (-> v1-20 param0)) + (t9-3 (the-as function (-> 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)) + (if (the-as (function cspace matrix none) t9-3) + ((the-as (function object object object none) t9-3) v1-20 (-> v1-20 param1) (-> v1-20 param2)) ) - ) ) ) (dotimes (s1-2 2) @@ -1314,8 +1309,7 @@ (label cfg-45) (let ((a0-26 (-> gp-0 effect))) (if a0-26 - (format 0 "skip effect control~%") - ;(effect-control-method-9 a0-26) + (update-effects a0-26) ) ) ) diff --git a/goal_src/jak2/engine/sound/gsound-h.gc b/goal_src/jak2/engine/sound/gsound-h.gc index e35027639e..01d473b137 100644 --- a/goal_src/jak2/engine/sound/gsound-h.gc +++ b/goal_src/jak2/engine/sound/gsound-h.gc @@ -5,6 +5,9 @@ ;; name in dgo: gsound-h ;; dgos: ENGINE, GAME +(declare-type process-drawable process) +(declare-type process-focusable process-drawable) + (defenum sound-command :type uint16 (iop-store 0) ;; sound-rpc-bank-cmd @@ -88,6 +91,9 @@ (sm-unk1) (sm-unk2) (reg0) + (reg1) + (reg2) + (unk) ) (defenum stream-status @@ -179,7 +185,7 @@ ;; ghost function (define-extern *debug-effect-control* symbol) (declare-type sound-spec basic) -(define-extern effect-param->sound-spec (function sound-spec (pointer float) int sound-spec)) +(define-extern effect-param->sound-spec (function sound-spec (pointer float) int process-focusable sound-spec)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/sound/gsound.gc b/goal_src/jak2/engine/sound/gsound.gc index ffdf466eaa..271bc688b9 100644 --- a/goal_src/jak2/engine/sound/gsound.gc +++ b/goal_src/jak2/engine/sound/gsound.gc @@ -691,13 +691,9 @@ (set! (-> s5-1 sound-name) (-> obj name)) (set! (-> s5-1 fo-max) (-> obj falloff-far)) (set! (-> s5-1 mask) (sound-mask)) - (when (-> obj params) - ;; ADDED - the function after this has been removed in jak 2, and calling it will crash. - (format 0 "bad case in update! ambient-sound~%") - (return (the-as int #f)) - pp - (effect-param->sound-spec s5-1 (-> obj params) (-> obj param-count)) - ) + (if (-> obj params) + (effect-param->sound-spec s5-1 (-> obj params) (-> obj param-count) (the-as process-focusable pp)) + ) ) (let ((v1-23 (-> s5-1 fo-max))) (if (and (nonzero? v1-23) (< (* 4096.0 (the float v1-23)) (vector-vector-distance (ear-trans 0) (-> obj trans)))) @@ -734,7 +730,7 @@ (-> obj pitch) 0 (sound-group sfx) - (the-as symbol (-> obj trans)) + (-> obj trans) ) ) ) @@ -748,7 +744,7 @@ (-> obj pitch) 0 (sound-group sfx) - (the-as symbol (-> obj trans)) + (-> obj trans) ) ) (set! (-> obj play-time) diff --git a/goal_src/jak2/engine/target/sidekick.gc b/goal_src/jak2/engine/target/sidekick.gc index 281b6fcf59..c8cb15a79d 100644 --- a/goal_src/jak2/engine/target/sidekick.gc +++ b/goal_src/jak2/engine/target/sidekick.gc @@ -10,22 +10,24 @@ ;; DECOMP BEGINS -(defskelgroup skel-sidekick daxter daxter-lod0-jg -1 - ((daxter-lod0-mg (meters 999999))) +;; failed to figure out what this is: +(defskelgroup skel-sidekick daxter 0 -1 + ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) :longest-edge (meters 1) - :shadow daxter-shadow-mg + :shadow 3 :texture-level 6 :sort 1 :origin-joint-index 6 :shadow-joint-index 6 ) -(defskelgroup skel-sidekick-highres daxter-highres daxter-highres-lod0-jg -1 - ((daxter-highres-lod0-mg (meters 999999))) +;; failed to figure out what this is: +(defskelgroup skel-sidekick-highres daxter-highres 0 -1 + ((1 (meters 999999))) :bounds (static-spherem 0 0 0 3) :longest-edge (meters 1) - :shadow daxter-highres-shadow-mg + :shadow 2 :sort 1 :origin-joint-index 6 :shadow-joint-index 6 @@ -447,7 +449,7 @@ ) (let ((a0-53 (-> self skel effect))) (if a0-53 - (effect-control-method-9 a0-53) + (update-effects a0-53) ) ) (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) diff --git a/goal_src/jak2/engine/target/target-darkjak.gc b/goal_src/jak2/engine/target/target-darkjak.gc index 11f761c46c..64cd36088f 100644 --- a/goal_src/jak2/engine/target/target-darkjak.gc +++ b/goal_src/jak2/engine/target/target-darkjak.gc @@ -103,19 +103,23 @@ (none) ) -(defbehavior target-darkjak-process target ((arg0 object) (arg1 object) (arg2 object) (arg3 object) (arg4 object) (arg5 object) (arg6 float)) - (local-vars (gp-0 vector)) +;; definition for function target-darkjak-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; ERROR: Function may read a register that is not set: t2 +(defbehavior target-darkjak-process target () + (local-vars (t2-0 none) (gp-0 vector)) (cond ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) - (let ((a1-1 'eco-red)) - (target-danger-set! (-> self control danger-mode) a1-1) + (let ((a1-0 'eco-red)) + (target-danger-set! (-> self control danger-mode) a1-0) ) (update-transforms (-> self control)) - (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-2 options) (overlaps-others-options)) - (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) - (set! (-> a1-2 tlist) *touching-list*) - (find-overlapping-shapes (-> self control) a1-2) + (let ((a1-1 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-1 options) (overlaps-others-options)) + (set! (-> a1-1 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-1 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-1) ) (target-danger-set! (-> self control danger-mode) #f) (update-transforms (-> self control)) @@ -143,12 +147,12 @@ (f26-0 (lerp-scale 1.0 (* 0.20000002 (+ 5.0 (-> self darkjak-giant-interp))) f30-0 0.0 1.0)) ) (set-vector! (-> self control scale) f28-0 f28-0 f28-0 1.0) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! (-> a3-3 x) f26-0) - (set! (-> a3-3 y) 1.0) - (set! (-> a3-3 z) f26-0) - (set! (-> a3-3 w) 1.0) - (trs-set! (-> self upper-body) (the-as vector #f) (the-as quaternion #f) a3-3) + (let ((a3-2 (new 'stack-no-clear 'vector))) + (set! (-> a3-2 x) f26-0) + (set! (-> a3-2 y) 1.0) + (set! (-> a3-2 z) f26-0) + (set! (-> a3-2 w) 1.0) + (trs-set! (-> self upper-body) (the-as vector #f) (the-as quaternion #f) a3-2) ) (let ((f26-1 (* 1.1 f26-0))) (cond @@ -185,19 +189,21 @@ ) ) (trs-set! (-> self neck) (the-as vector #f) (the-as quaternion #f) gp-0) - (let* ((a0-44 (-> self horns)) - (t9-14 (method-of-object a0-44 trs-set!)) - (a1-12 #f) - (a2-9 #f) - (a3-8 (new 'stack-no-clear 'vector)) + (let* ((a0-43 (-> self horns)) + (t9-14 (method-of-object a0-43 trs-set!)) + (a1-11 #f) + (a2-8 #f) + (a3-7 (new 'stack-no-clear 'vector)) ) - (set! (-> a3-8 x) f30-0) - (set! (-> a3-8 y) f30-0) - (set! (-> a3-8 z) f30-0) - (set! (-> a3-8 w) 1.0) - (t9-14 a0-44 (the-as vector a1-12) (the-as quaternion a2-9) a3-8) + (set! (-> a3-7 x) f30-0) + (set! (-> a3-7 y) f30-0) + (set! (-> a3-7 z) f30-0) + (set! (-> a3-7 w) 1.0) + (t9-14 a0-43 (the-as vector a1-11) (the-as quaternion a2-8) a3-7) + ) + (when (nonzero? set-darkjak-texture-morph!) + (set-darkjak-texture-morph! f30-0) ) - (set-darkjak-texture-morph! f30-0) (cond ((and (= f30-0 0.0) (< (- (-> self clock frame-counter) (-> self teleport-time)) (seconds 0.5))) (set! (-> self skel override 0) 0.00001) @@ -230,11 +236,11 @@ (s2-0 *launch-matrix*) ) (set! (-> s2-0 trans quad) (-> (process-drawable-random-point! self (new 'stack-no-clear 'vector)) quad)) - (let ((a3-9 #f) - (t0-6 #f) - (t1-1 1.0) + (let ((a3-8 #f) + (t0-5 #f) + (t1-0 1.0) ) - (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state a3-9) (the-as sparticle-launch-control t0-6) t1-1) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-5) t1-0) (cond ((rand-vu-percent? 0.25) (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02)) @@ -244,9 +250,9 @@ (-> *lightning-spec-id-table* 8) lightning-probe-callback (-> *part-id-table* 179) - (the-as int t0-6) - (the-as int t1-1) - arg6 + (the-as int t0-5) + (the-as int t1-0) + (the-as float t2-0) ) ) ) diff --git a/goal_src/jak2/game.gp b/goal_src/jak2/game.gp index a018a9c1a4..5fe89f84fb 100644 --- a/goal_src/jak2/game.gp +++ b/goal_src/jak2/game.gp @@ -504,6 +504,7 @@ "target/collide-reaction-target.gc" "target/logic-target.gc" "target/sidekick.gc" + "game/effect-control.gc" "common_objs/voicebox.gc" "common_objs/collectables-part.gc" "debug/debug-part.gc" @@ -837,6 +838,27 @@ "ctysluma-vis" ) +;;;;;;;;;;;;;;;;;;;;; +;; CITY INDUSTRIAL B +;;;;;;;;;;;;;;;;;;;;; + +(cgo "CIB.DGO" "cib.gd") + +(goal-src-sequence + "levels/city/industrial/" + :deps ("$OUT/obj/los-control.o") + "ctyindb-part.gc" + "ctyindb-obs.gc" + ) + +(copy-textures 1565 1577 1601 1614 1642) + +(copy-gos + "com-airlock-outer-ag" + "ctyindb-vis" +) + + ;;;;;;;;;;;;;;;;;;;;; ;; VILLAGE 1 ;;;;;;;;;;;;;;;;;;;;; diff --git a/test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc new file mode 100644 index 0000000000..da3b864fea --- /dev/null +++ b/test/decompiler/reference/jak2/engine/collide/collide-debug_REF.gc @@ -0,0 +1,314 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) +(when *debug-segment* +;; definition for method 9 of type collide-cache +;; WARN: Return type mismatch int vs none. +(defmethod debug-draw collide-cache ((obj collide-cache)) + (let ((gp-0 (the-as object (-> obj tris)))) + (countdown (s4-0 (-> obj num-tris)) + (let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> (the-as collide-cache-tri gp-0) pat mode) color) a 64))) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-tri gp-0) vertex)) + (-> (the-as collide-cache-tri gp-0) vertex 1) + (-> (the-as collide-cache-tri gp-0) vertex 2) + t1-0 + ) + ) + (set! gp-0 (&+ (the-as collide-cache-tri gp-0) 64)) + ) + ) + (let ((gp-1 (the-as object (-> obj prims)))) + (countdown (s5-1 (-> obj num-prims)) + (when (= (-> (the-as collide-cache-prim gp-1) prim-core prim-type) (prim-type sphere)) + (let ((t0-1 + (copy-and-set-field + (-> *pat-mode-info* + (-> (the-as collide-shape-prim-sphere (-> (the-as collide-shape-prim gp-1) prim-core action)) pat mode) + color + ) + a + 64 + ) + ) + ) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-prim gp-1) prim-core)) + (-> (the-as collide-cache-prim gp-1) prim-core world-sphere w) + t0-1 + ) + ) + ) + (set! gp-1 (&+ (the-as collide-cache-prim gp-1) 48)) + ) + ) + (print-collide-cache-tri-count) + 0 + (none) + ) + +;; definition of type col-rend-filter +(deftype col-rend-filter (structure) + ((show-pat-set pat-surface :offset-assert 0) + (show-pat-clear pat-surface :offset-assert 4) + (event-mask uint32 :offset-assert 8) + ) + :method-count-assert 9 + :size-assert #xc + :flag-assert #x90000000c + ) + +;; definition for method 3 of type col-rend-filter +(defmethod inspect col-rend-filter ((obj col-rend-filter)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" obj 'col-rend-filter) + (format #t "~1Tshow-pat-set: ~D~%" (-> obj show-pat-set)) + (format #t "~1Tshow-pat-clear: ~D~%" (-> obj show-pat-clear)) + (format #t "~1Tevent-mask: ~D~%" (-> obj event-mask)) + (label cfg-4) + obj + ) + +;; definition for function col-rend-draw +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defun col-rend-draw ((arg0 col-rend) (arg1 col-rend-filter)) + (let ((s4-0 (new 'stack-no-clear 'matrix))) + (set! (-> s4-0 vector 0 quad) (-> (math-camera-matrix) vector 2 quad)) + (vector-normalize! (the-as vector (-> s4-0 vector)) 1.0) + (let ((s3-1 (the-as collide-cache-tri (-> *collide-cache* tris)))) + (countdown (s2-0 (-> *collide-cache* num-tris)) + (vector-3pt-cross! (-> s4-0 vector 1) (the-as vector (-> s3-1 vertex)) (-> s3-1 vertex 1) (-> s3-1 vertex 2)) + (vector-normalize! (-> s4-0 vector 1) 1.0) + (when (or (-> arg0 show-back-faces?) (>= 0.0 (vector-dot (the-as vector (-> s4-0 vector)) (-> s4-0 vector 1)))) + (let ((v1-9 (-> s3-1 pat))) + (cond + ((and (or (zero? (-> arg1 show-pat-set)) (logtest? v1-9 (-> arg1 show-pat-set))) + (or (zero? (-> arg1 show-pat-clear)) (zero? (logand v1-9 (-> arg1 show-pat-clear)))) + (or (zero? (-> arg1 event-mask)) (logtest? (-> arg1 event-mask) (ash 1 (-> v1-9 event)))) + ) + (let ((t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-9 mode) color) a 64))) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + t1-0 + ) + ) + (if (-> arg0 outline?) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + (new 'static 'rgba :r #x10 :g #x10 :b #x10 :a #x80) + ) + ) + (when (-> arg0 show-normals?) + (vector+! (-> s4-0 vector 2) (the-as vector (-> s3-1 vertex)) (-> s3-1 vertex 1)) + (vector+! (-> s4-0 vector 2) (-> s4-0 vector 2) (-> s3-1 vertex 2)) + (vector-float/! (-> s4-0 vector 2) (-> s4-0 vector 2) 3.0) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s4-0 vector 2) + (-> s4-0 vector 1) + (meters 0.75) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x80) + ) + ) + ) + ((-> arg0 ghost-hidden?) + (add-debug-flat-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + (new 'static 'rgba :r #x20 :g #x20 :b #x20 :a #x20) + ) + (if (-> arg0 outline?) + (add-debug-outline-triangle + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> s3-1 vertex)) + (-> s3-1 vertex 1) + (-> s3-1 vertex 2) + (new 'static 'rgba :r #x10 :g #x10 :b #x10 :a #x10) + ) + ) + ) + ) + ) + ) + (&+! s3-1 64) + ) + ) + ) + (let ((s5-1 (the-as object (-> *collide-cache* prims)))) + (countdown (s4-1 (-> *collide-cache* num-prims)) + (when (= (-> (the-as collide-cache-prim s5-1) prim-core prim-type) (prim-type sphere)) + (let ((v1-37 (-> (the-as collide-shape-prim-sphere (-> (the-as collide-cache-prim s5-1) prim)) pat))) + (when (and (or (zero? (-> arg1 show-pat-set)) (logtest? v1-37 (-> arg1 show-pat-set))) + (or (zero? (-> arg1 show-pat-clear)) (zero? (logand v1-37 (-> arg1 show-pat-clear)))) + (or (zero? (-> arg1 event-mask)) (logtest? (-> arg1 event-mask) (ash 1 (-> v1-37 event)))) + ) + (let ((t0-5 (copy-and-set-field (-> *pat-mode-info* (-> v1-37 mode) color) a 64))) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (the-as vector (-> (the-as collide-cache-prim s5-1) prim-core)) + (-> (the-as collide-cache-prim s5-1) prim-core world-sphere w) + t0-5 + ) + ) + ) + ) + ) + (set! s5-1 (&+ (the-as collide-cache-prim s5-1) 48)) + ) + ) + (none) + ) + +;; definition for method 9 of type col-rend +;; INFO: Used lq/sq +(defmethod col-rend-method-9 col-rend ((obj col-rend)) + (with-pp + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (let ((f30-0 (-> obj bbox-radius))) + (let ((v1-0 (-> obj track))) + (cond + ((zero? v1-0) + (set! (-> obj bbox-center quad) (-> (target-pos 0) quad)) + (+! (-> obj bbox-center y) (* 0.7 f30-0)) + ) + ((= v1-0 1) + (position-in-front-of-camera! (-> obj bbox-center) (+ (-> obj camera-to-bbox-dist) (-> obj bbox-radius)) 0.0) + ) + ) + ) + (set! (-> s5-0 bbox min quad) (-> obj bbox-center quad)) + (set! (-> s5-0 bbox min x) (- (-> s5-0 bbox min x) f30-0)) + (set! (-> s5-0 bbox min y) (- (-> s5-0 bbox min y) f30-0)) + (set! (-> s5-0 bbox min z) (- (-> s5-0 bbox min z) f30-0)) + (set! (-> s5-0 bbox max quad) (-> obj bbox-center quad)) + (+! (-> s5-0 bbox max x) f30-0) + (+! (-> s5-0 bbox max y) f30-0) + (+! (-> s5-0 bbox max z) f30-0) + ) + (let ((v1-9 -1)) + (let ((a0-9 (-> obj cspec))) + (if (not (logtest? a0-9 (collide-spec crate))) + (set! v1-9 (logxor v1-9 1)) + ) + (if (not (logtest? a0-9 (collide-spec civilian))) + (set! v1-9 (logxor v1-9 64)) + ) + (if (not (logtest? a0-9 (collide-spec enemy))) + (set! v1-9 (logxor #x80000 v1-9)) + ) + (if (not (logtest? a0-9 (collide-spec obstacle))) + (set! v1-9 (logxor v1-9 2)) + ) + (if (not (logtest? a0-9 (collide-spec vehicle-sphere))) + (set! v1-9 (logand #x80743 v1-9)) + ) + ) + (set! (-> s5-0 collide-with) (the-as collide-spec v1-9)) + ) + (set! (-> s5-0 ignore-pat) (new 'static 'pat-surface)) + (set! (-> s5-0 ignore-process0) #f) + (set! (-> s5-0 ignore-process1) #f) + (add-debug-box + #t + (bucket-id debug2) + (the-as vector (-> s5-0 bbox)) + (-> s5-0 bbox max) + (if (logtest? (-> pp clock frame-counter) 128) + (new 'static 'rgba :r #x80 :g #x80 :b #x80 :a #x20) + (new 'static 'rgba :a #x20) + ) + ) + (fill-using-bounding-box *collide-cache* s5-0) + ) + (let ((s5-1 (-> obj show-only)) + (a1-17 (new 'stack 'col-rend-filter)) + ) + (when (nonzero? s5-1) + (cond + ((logtest? s5-1 8) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :noboard #x1)) + ) + ((logtest? s5-1 16) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + ) + ((logtest? s5-1 32) + (set! (-> a1-17 show-pat-clear) (new 'static 'pat-surface :nogrind #x1)) + (set! (-> a1-17 show-pat-set) (new 'static 'pat-surface :nojak #x1)) + ) + (else + (if (logtest? s5-1 8192) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nolineofsight #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 1024) + (set! (-> a1-17 show-pat-set noentity) 1) + ) + (if (logtest? s5-1 64) + (set! (-> a1-17 show-pat-set noboard) 1) + ) + (if (logtest? s5-1 2048) + (set! (-> a1-17 show-pat-set nogrind) 1) + ) + (if (logtest? s5-1 128) + (set! (-> a1-17 show-pat-set nocamera) 1) + ) + (if (logtest? s5-1 4096) + (set! (-> a1-17 show-pat-set nojak) 1) + ) + (if (logtest? s5-1 256) + (set! (-> a1-17 show-pat-set noedge) 1) + ) + (if (logtest? s5-1 #x8000) + (set! (-> a1-17 show-pat-set nopilot) 1) + ) + (if (logtest? s5-1 512) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? s5-1 #x4000) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :nomech #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x10000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :noproj #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x40000 s5-1) + (set! (-> a1-17 show-pat-set) (logior (new 'static 'pat-surface :probe #x1) (-> a1-17 show-pat-set))) + ) + (if (logtest? #x20000 s5-1) + (logior! (-> a1-17 event-mask) 64) + ) + ) + ) + ) + (col-rend-draw obj a1-17) + ) + (none) + ) + ) + +) + + + diff --git a/test/decompiler/reference/jak2/engine/collide/collide-edge-grab-h_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-edge-grab-h_REF.gc index a362ddd6b4..0685712568 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-edge-grab-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-edge-grab-h_REF.gc @@ -290,7 +290,7 @@ (find-grabbable-tris (_type_) none 17) (should-add-to-list? (_type_ collide-edge-hold-item collide-edge-edge) symbol 18) (find-best-grab! (_type_ collide-edge-hold-list edge-grab-info) symbol 19) - (check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) none 20) + (check-grab-for-collisions (_type_ collide-edge-hold-item edge-grab-info) symbol 20) ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc index 803b6a9c5e..9bde64a66f 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-edge-grab_REF.gc @@ -149,8 +149,7 @@ ;; definition for method 20 of type collide-edge-work ;; INFO: Used lq/sq -;; WARN: Return type mismatch int vs none. -;; WARN: Function (method 20 collide-edge-work) has a return type of none, but the expression builder found a return statement. +;; WARN: Return type mismatch int vs symbol. (defmethod check-grab-for-collisions collide-edge-work ((obj collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info)) (local-vars (sv-656 vector) (sv-672 vector)) (rlet ((acc :class vf) @@ -183,7 +182,7 @@ ) (let ((f0-1 (get-best-hand-point obj (-> arg1 right-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-1) - (return #f) + (return (the-as symbol #f)) ) ) (set! sv-672 s0-0) @@ -201,7 +200,7 @@ (.svf (&-> sv-672 quad) vf6) (let ((f0-3 (get-best-hand-point obj (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-3) - (return #f) + (return (the-as symbol #f)) ) ) ) @@ -251,7 +250,7 @@ (set! (-> v1-28 action-mask) (collide-action solid)) ) (if (probe-using-spheres (-> obj ccache) a1-12) - (return #f) + (return (the-as symbol #f)) ) ) (set! (-> arg1 status) (the-as uint 0)) @@ -283,8 +282,7 @@ ) ) ) - 0 - (none) + (the-as symbol 0) ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc index ac92eb214e..43a048af08 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc @@ -97,7 +97,7 @@ (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) (let ((a0-22 (-> self skel effect))) (if a0-22 - (effect-control-method-9 a0-22) + (update-effects a0-22) ) ) (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc new file mode 100644 index 0000000000..7a14a28619 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/common_objs/powerups_REF.gc @@ -0,0 +1,1217 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function cloud-track +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior cloud-track process ((arg0 process-tree) + (arg1 process-tree) + (arg2 (function vector none)) + (arg3 time-frame) + (arg4 time-frame) + (arg5 time-frame) + ) + (change-parent self arg0) + (let ((s1-1 (process->handle arg0)) + (s2-1 (process->handle arg1)) + ) + (let ((s0-0 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s0-0) (+ arg3 arg4)) + (let ((v1-8 (or (not (handle->process s1-1)) (not (handle->process s2-1))))) + (if v1-8 + (deactivate self) + ) + ) + (let* ((f0-1 + (fmax + 0.0 + (fmin 1.0 (/ (- (the float (- (-> self clock frame-counter) s0-0)) (the float arg3)) (the float arg4))) + ) + ) + (a0-18 (process-drawable-pair-random-point! + (the-as process-drawable (-> s1-1 process 0)) + (the-as process-drawable (-> s2-1 process 0)) + (new-stack-vector0) + f0-1 + ) + ) + ) + (arg2 a0-18) + ) + (suspend) + ) + ) + (cond + ((zero? arg5) + (until #f + (suspend) + ) + #f + ) + (else + (let ((s4-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) s4-1) arg5) + (let ((a0-21 (process-drawable-random-point! (the-as process-drawable (-> s2-1 process 0)) (new-stack-vector0)))) + (arg2 a0-21) + ) + (suspend) + ) + ) + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defpart 539 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 192.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0666667) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 540 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 192.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0666667) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 541 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9b :page #xb)) + (sp-rnd-flt spt-num 1.0 3.0 1.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 1.5) 1.0) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-b 128.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 90) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 542) + ) + ) + +;; failed to figure out what this is: +(defpart 543 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x9b :page #xb)) + (sp-rnd-flt spt-num 0.0 3.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 1.5) 1.0) + (sp-int spt-rot-x 4) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.2) (meters 0.1) 1.0) + (sp-flt spt-r 128.0) + (sp-flt spt-g 128.0) + (sp-flt spt-b 255.0) + (sp-flt spt-a 128.0) + (sp-flt spt-fade-a -1.6) + (sp-int spt-timer 91) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 10) + (sp-launcher-by-id spt-next-launcher 542) + ) + ) + +;; failed to figure out what this is: +(defpart 542 + :init-specs ((sp-flt spt-r 64.0) + (sp-flt spt-g 64.0) + (sp-flt spt-fade-r -1.0) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -2.0) + ) + ) + +;; failed to figure out what this is: +(defpart 544 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-scale-x (meters 0.1) (meters 0.15) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 32.0) + (sp-rnd-flt spt-g 32.0 64.0 1.0) + (sp-rnd-flt spt-b 192.0 64.0 1.0) + (sp-rnd-flt spt-a 64.0 128.0 1.0) + (sp-flt spt-scalevel-x (meters -0.00033333333)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.2) + (sp-flt spt-accel-y -0.06826667) + (sp-int spt-timer 450) + (sp-cpuinfo-flags sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-blue-hit-ground-effect + :id 123 + :duration (seconds 0.017) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 545) (sp-item 546) (sp-item 547 :flags (is-3d)) (sp-item 548) (sp-item 549 :flags (is-3d))) + ) + +;; failed to figure out what this is: +(defpart 548 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-flt spt-num 32.0) + (sp-flt spt-y (meters 0.5)) + (sp-rnd-flt spt-scale-x (meters 1) (meters 3) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-int spt-a 0 63 1.0) + (sp-flt spt-vel-y (meters 0.093333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 550) + (sp-flt spt-conerot-x (degrees 90.0)) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 550 + :init-specs ((sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-int spt-a 0 63 1.0) + (sp-int-plain-rnd spt-next-time 20 19 1) + (sp-launcher-by-id spt-next-launcher 550) + ) + ) + +;; failed to figure out what this is: +(defpart 549 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2c :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0.5)) + (sp-flt spt-scale-x (meters 0)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 96.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters 0.21333334)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-int spt-timer 120) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 60) + (sp-launcher-by-id spt-next-launcher 551) + ) + ) + +;; failed to figure out what this is: +(defpart 551 + :init-specs ((sp-flt spt-fade-a -2.1333334)) + ) + +;; failed to figure out what this is: +(defpart 547 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x26 :page #xc)) + (sp-flt spt-num 1.0) + (sp-flt spt-y (meters 0.5)) + (sp-flt spt-scale-x (meters 0)) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 32.0 32.0 1.0) + (sp-flt spt-scalevel-x (meters 0.22666667)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.7111111) + (sp-int spt-timer 90) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 552) + ) + ) + +;; failed to figure out what this is: +(defpart 552 + :init-specs ((sp-flt spt-fade-a -1.4222223)) + ) + +;; failed to figure out what this is: +(defpart 545 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 32.0) + (sp-rnd-flt spt-scale-x (meters 1) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 16.0 32.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.053333335) (meters 0.026666667) 1.0) + (sp-flt spt-scalevel-x (meters 0.0033333334)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.16) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 300) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12) + (sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 546 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 12.0) + (sp-rnd-flt spt-scale-x (meters 0.5) (meters 0.25) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 192.0 63.0 1.0) + (sp-rnd-flt spt-a 16.0 16.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.10666667) (meters 0.053333335) 1.0) + (sp-flt spt-scalevel-x (meters 0.0016666667)) + (sp-rnd-flt spt-rotvel-z (degrees -0.2) (degrees 0.4) 1.0) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-a -0.21333334) + (sp-flt spt-accel-y -1.3653333) + (sp-flt spt-friction 0.95) + (sp-int spt-timer 150) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-12) + (sp-rnd-flt spt-conerot-x (degrees 60.0) (degrees 30.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 553 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 92.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 554 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 92.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 555 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-rnd-flt spt-num 0.5 2.0 1.0) + (sp-flt spt-y (meters -0.05)) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 100.0 28.0 1.0) + (sp-rnd-flt spt-g 64.0 64.0 1.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0023333333) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -0.024242423) + (sp-rnd-flt spt-accel-y -0.40960002 -1.2288 1.0) + (sp-flt spt-friction 0.93) + (sp-int-plain-rnd spt-timer 30 209 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 556) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 556 + :init-specs ((sp-flt spt-fade-r 0.0)) + ) + +;; failed to figure out what this is: +(defpart 557 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 558 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 92.0 32.0 1.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 559 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-rnd-flt spt-num 0.5 2.0 1.0) + (sp-flt spt-y (meters -0.05)) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 100.0 28.0 1.0) + (sp-flt spt-g 0.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0023333333) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -0.024242423) + (sp-rnd-flt spt-accel-y -0.40960002 -1.2288 1.0) + (sp-flt spt-friction 0.93) + (sp-int-plain-rnd spt-timer 30 209 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 560) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 560 + :init-specs ((sp-flt spt-fade-r 0.0)) + ) + +;; failed to figure out what this is: +(defpart 561 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x29 :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 92.0 32.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 562 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-rnd-flt spt-num 1.0 1.0 1.0) + (sp-rnd-flt spt-scale-x (meters 1.5) (meters 0.4) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 92.0 32.0 1.0) + (sp-flt spt-b 0.0) + (sp-flt spt-a 64.0) + (sp-flt spt-fade-a -1.0) + (sp-int spt-timer 60) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 563 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-rnd-flt spt-num 0.5 2.0 1.0) + (sp-flt spt-y (meters -0.05)) + (sp-rnd-flt spt-scale-x (meters 0.2) (meters 0.1) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-flt spt-r 0.0) + (sp-rnd-flt spt-g 100.0 28.0 1.0) + (sp-flt spt-b 0.0) + (sp-rnd-flt spt-a 64.0 64.0 1.0) + (sp-rnd-flt spt-vel-y (meters 0.0023333333) (meters 0.0016666667) 1.0) + (sp-flt spt-scalevel-x (meters -0.00083333335)) + (sp-copy-from-other spt-scalevel-y -4) + (sp-flt spt-fade-g -0.4) + (sp-flt spt-fade-a -0.024242423) + (sp-rnd-flt spt-accel-y -0.40960002 -1.2288 1.0) + (sp-flt spt-friction 0.93) + (sp-int-plain-rnd spt-timer 30 209 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 90) + (sp-launcher-by-id spt-next-launcher 564) + (sp-rnd-flt spt-conerot-x (degrees 0.0) (degrees 180.0) 1.0) + (sp-rnd-flt spt-conerot-y (degrees 0.0) (degrees 360.0) 1.0) + (sp-flt spt-conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 564 + :init-specs ((sp-flt spt-fade-g 0.0)) + ) + +;; definition for function eco-blue-glow +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun eco-blue-glow ((arg0 vector)) + (let ((t9-0 sp-launch-particles-var) + (a0-1 *sp-particle-system-2d*) + (a1-0 (-> *part-id-table* 539)) + (a2-0 *launch-matrix*) + ) + (set! (-> a2-0 trans quad) (-> arg0 quad)) + (t9-0 a0-1 a1-0 a2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (rand-vu-percent? 0.5) + (let ((t9-2 sp-launch-particles-var) + (a0-3 *sp-particle-system-2d*) + (a1-1 (-> *part-id-table* 541)) + (a2-1 *launch-matrix*) + ) + (set! (-> a2-1 trans quad) (-> arg0 quad)) + (t9-2 a0-3 a1-1 a2-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + 0 + (none) + ) + +;; definition for function target-eco-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-eco-process target () + (when (and (!= (-> (the-as fact-info-target (-> self fact-override)) eco-level) 0.0) + (>= (- (-> *display* game-clock frame-counter) + (-> (the-as fact-info-target (-> self fact-override)) eco-pickup-time) + ) + (-> (the-as fact-info-target (-> self fact-override)) eco-timeout) + ) + ) + (set! (-> (the-as fact-info-target (-> self fact-override)) eco-level) 0.0) + (set! (-> (the-as fact-info-target (-> self fact-override)) eco-timeout) 0) + (logclear! (-> self state-flags) (state-flags sf4)) + (send-event self 'reset-collide) + (stop! (-> self sound)) + ) + (if (logtest? (-> self game secrets) (game-secrets endless-dark)) + (set! (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) + ) + (when (and (< 0.0 (-> (the-as fact-info-target (-> self fact-override)) eco-level)) + (not (logtest? (-> self focus-status) (focus-status in-head))) + (not (logtest? (-> self draw status) (draw-control-status no-draw no-draw-temp))) + (not (movie?)) + (rand-vu-percent? (lerp-scale + 0.0 + 1.0 + (the float (- (-> (the-as fact-info-target (-> self fact-override)) eco-timeout) + (- (-> *display* game-clock frame-counter) + (-> (the-as fact-info-target (-> self fact-override)) eco-pickup-time) + ) + ) + ) + 0.0 + 900.0 + ) + ) + ) + (case (-> (the-as fact-info-target (-> self fact-override)) eco-type) + ((1) + (change-sound! (-> self sound) (static-sound-name "yel-eco-jak")) + (let ((s1-0 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-1 sp-launch-particles-var) + (s5-0 *sp-particle-system-2d*) + (s4-0 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 553 + 554 + ) + ) + ) + (s2-0 *launch-matrix*) + ) + (set! (-> s2-0 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-0)) quad) + ) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-2 2) + (let ((v1-53 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-1 sp-launch-particles-var) + (s4-1 *sp-particle-system-2d*) + (s3-1 (-> *part-id-table* 555)) + (s1-1 *launch-matrix*) + ) + (set! (-> s1-1 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-53)) quad) + ) + (s5-1 s4-1 s3-1 s1-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((2) + (target-danger-set! (-> self control danger-mode) 'eco-red) + (update-transforms (-> self control)) + (let ((a1-13 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-13 options) (overlaps-others-options)) + (set! (-> a1-13 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-13 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-13) + ) + (target-danger-set! (-> self control danger-mode) #f) + (update-transforms (-> self control)) + (change-sound! (-> self sound) (static-sound-name "red-eco-jak")) + (let ((s1-2 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-3 sp-launch-particles-var) + (s5-2 *sp-particle-system-2d*) + (s4-2 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 557 + 558 + ) + ) + ) + (s2-2 *launch-matrix*) + ) + (set! (-> s2-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-2)) quad) + ) + (gp-3 s5-2 s4-2 s2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-4 2) + (let ((v1-86 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-3 sp-launch-particles-var) + (s4-3 *sp-particle-system-2d*) + (s3-3 (-> *part-id-table* 559)) + (s1-3 *launch-matrix*) + ) + (set! (-> s1-3 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-86)) quad) + ) + (s5-3 s4-3 s3-3 s1-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((3) + (change-sound! (-> self sound) (static-sound-name "blue-eco-jak")) + (let ((v1-99 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (cond + ((and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + (set! (-> *part-id-table* 543 init-specs 4 initial-valuef) 0.0) + (set! (-> *part-id-table* 543 init-specs 4 random-rangef) 65536.0) + ) + (else + (set! (-> *part-id-table* 543 init-specs 4 initial-valuef) 40960.0) + (set! (-> *part-id-table* 543 init-specs 4 random-rangef) 16384.0) + ) + ) + (let ((gp-5 sp-launch-particles-var) + (s5-4 *sp-particle-system-2d*) + (s4-4 (-> *part-id-table* 543)) + (s2-4 *launch-matrix*) + ) + (set! (-> s2-4 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-99)) quad) + ) + (gp-5 s5-4 s4-4 s2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (let ((gp-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (let ((s5-5 sp-launch-particles-var) + (s4-5 *sp-particle-system-2d*) + (s3-5 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 539 + 540 + ) + ) + ) + (s1-4 *launch-matrix*) + ) + (set! (-> s1-4 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) quad) + ) + (s5-5 s4-5 s3-5 s1-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (when (rand-vu-percent? 0.5) + (let ((s5-6 sp-launch-particles-var) + (s4-6 *sp-particle-system-2d*) + (s3-6 (-> *part-id-table* 541)) + (s1-5 *launch-matrix*) + ) + (set! (-> s1-5 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) quad) + ) + (s5-6 s4-6 s3-6 s1-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (let ((v1-123 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-7 sp-launch-particles-var) + (s5-7 *sp-particle-system-2d*) + (s4-7 (-> *part-id-table* 544)) + (s2-7 *launch-matrix*) + ) + (set! (-> s2-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-123)) quad) + ) + (gp-7 s5-7 s4-7 s2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 1 (seconds 0.1)) + ) + ((5) + (change-sound! (-> self sound) (static-sound-name "green-eco-jak")) + (let ((s1-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-8 sp-launch-particles-var) + (s5-8 *sp-particle-system-2d*) + (s4-8 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 561 + 562 + ) + ) + ) + (s2-8 *launch-matrix*) + ) + (set! (-> s2-8 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-6)) quad) + ) + (gp-8 s5-8 s4-8 s2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-9 2) + (let ((v1-147 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-9 sp-launch-particles-var) + (s4-9 *sp-particle-system-2d*) + (s3-9 (-> *part-id-table* 563)) + (s1-7 *launch-matrix*) + ) + (set! (-> s1-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-147)) quad) + ) + (s5-9 s4-9 s3-9 s1-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + (update-trans! (-> self sound) (-> self control trans)) + (update! (-> self sound)) + ) + 0 + (none) + ) + +;; definition for function target-color-effect-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-color-effect-process target () + (when (and (-> self color-effect) (>= (- (-> self clock frame-counter) (-> self color-effect-start-time)) + (the-as time-frame (-> self color-effect-duration)) + ) + ) + (set! (-> self color-effect) #f) + (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) + (set! (-> self draw color-emissive quad) (the-as uint128 0)) + ) + (case (-> self color-effect) + (('shock) + (let ((f0-4 (rand-vu-float-range 0.5 2.0))) + (set-vector! (-> self draw color-mult) f0-4 f0-4 (+ 0.5 f0-4) 1.0) + ) + ) + (('eco-pill-dark) + (let ((f30-0 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-0) (lerp 0.0 0.0 f30-0) (lerp 0.0 0.3 f30-0) 1.0) + ) + ) + (('ammo-yellow) + (let ((f30-1 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-1) (lerp 1.0 1.0 f30-1) (lerp 1.0 0.0 f30-1) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-1) (lerp 0.0 0.3 f30-1) (lerp 0.0 0.0 f30-1) 1.0) + ) + ) + (('ammo-red) + (let ((f30-2 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-2) (lerp 1.0 0.6 f30-2) (lerp 1.0 0.6 f30-2) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-2) (lerp 0.0 0.0 f30-2) (lerp 0.0 0.0 f30-2) 1.0) + ) + ) + (('ammo-blue) + (let ((f30-3 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.6 f30-3) (lerp 1.0 0.8 f30-3) (lerp 1.0 1.0 f30-3) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-3) (lerp 0.0 0.1 f30-3) (lerp 0.0 0.3 f30-3) 1.0) + ) + ) + (('ammo-dark) + (let ((f30-4 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-4) (lerp 1.0 0.7 f30-4) (lerp 1.0 0.8 f30-4) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.2 f30-4) (lerp 0.0 0.0 f30-4) (lerp 0.0 0.1 f30-4) 1.0) + ) + ) + (('health) + (let ((f30-5 (lerp-scale + 1.0 + 0.0 + (the float (- (-> self clock frame-counter) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.5 f30-5) (lerp 1.0 1.0 f30-5) (lerp 1.0 0.5 f30-5) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-5) (lerp 0.0 0.5 f30-5) (lerp 0.0 0.0 f30-5) 1.0) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-powerup-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-powerup-process target () + (let ((f30-0 (-> self control collision-spheres 0 prim-core world-sphere w))) + (if (logtest? (focus-status board) (-> self focus-status)) + (set! (-> self control collision-spheres 0 prim-core world-sphere w) + (+ 4096.0 (-> self control collision-spheres 0 prim-core world-sphere w)) + ) + ) + (water-control-method-10 (-> self water)) + (set! (-> self control collision-spheres 0 prim-core world-sphere w) f30-0) + ) + (if (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + (set! (-> self control unknown-time-frame26) (-> self clock frame-counter)) + (set! (-> self control unknown-time-frame27) (-> self clock frame-counter)) + ) + (cond + ((and (= (-> self control ground-pat material) (pat-material ice)) + (and (>= (-> self control ctrl-xz-vel) 204.8) + (< (- (-> self clock frame-counter) (-> self control last-time-on-surface)) (seconds 0.05)) + ) + ) + (let ((gp-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 38)))) + (when (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-0 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (let ((t9-3 sp-launch-particles-var) + (a0-15 *sp-particle-system-3d*) + (a1-2 (-> *part-id-table* 165)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> gp-0 quad)) + (t9-3 a0-15 a1-2 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (let ((gp-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 31)))) + (when (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (let ((t9-6 sp-launch-particles-var) + (a0-19 *sp-particle-system-3d*) + (a1-5 (-> *part-id-table* 165)) + (a2-5 *launch-matrix*) + ) + (set! (-> a2-5 trans quad) (-> gp-1 quad)) + (t9-6 a0-19 a1-5 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + (let ((f0-10 (lerp-scale 0.8 1.0 (-> self control ctrl-xz-vel) 0.0 81920.0))) + (let ((v1-64 (ja-group))) + (if (not (and v1-64 (= v1-64 (-> self draw art-group data 110)))) + (set! f0-10 (* 0.8 f0-10)) + ) + ) + (seek! (-> self control unknown-float45) f0-10 (-> self clock seconds-per-frame)) + ) + (let ((f30-1 (-> self control unknown-float45)) + (f0-14 (lerp-scale -0.3 0.3 (-> self control ctrl-xz-vel) 0.0 81920.0)) + ) + (sound-play-by-name + (static-sound-name "ice-loop") + (-> self control unknown-sound-id04) + (the int (* 1024.0 f30-1)) + (the int (* 1524.0 f0-14)) + 0 + (sound-group sfx) + (-> self control trans) + ) + ) + ) + ((< 0.0 (-> self control unknown-float45)) + (set! (-> self control unknown-float45) 0.0) + (let ((v1-85 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-85 command) (sound-command set-param)) + (set! (-> v1-85 id) (-> self control unknown-sound-id04)) + (set! (-> v1-85 params volume) -4) + (set! (-> v1-85 auto-time) 48) + (set! (-> v1-85 auto-from) 2) + (set! (-> v1-85 params mask) (the-as uint 17)) + (-> v1-85 id) + ) + ) + ) + (target-darkjak-process) + (when (nonzero? (-> (the-as fact-info-target (-> self fact-override)) trick-point-duration)) + (when (>= (- (-> *display* game-clock frame-counter) + (-> (the-as fact-info-target (-> self fact-override)) trick-point-start-time) + ) + (-> (the-as fact-info-target (-> self fact-override)) trick-point-duration) + ) + (format + #t + "------------> ~,,f total points~%" + (-> (the-as fact-info-target (-> self fact-override)) trick-point) + ) + (send-event + (handle->process (-> self notify)) + 'notify + 'trick-judge + (-> (the-as fact-info-target (-> self fact-override)) trick-point) + ) + (reset! (-> self fact-override) 'trick-judge) + ) + ) + (cond + ((logtest? (-> self game features) (game-feature unk-game-feature-01)) + (cond + ((< (-> self clock frame-counter) (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) + (set-setting! 'bg-a 'abs #x3e99999a 0) + (set-setting! 'bg-r 'abs #x3f800000 0) + (update-rates! (-> *display* entity-clock) 0.0) + (if (zero? (mod (the-as int (-> *display* base-clock integral-frame-counter)) 60)) + (sound-play "stopwatch") + ) + ) + ((nonzero? (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout)) + (remove-setting! 'bg-a) + (remove-setting! 'bg-r) + (update-rates! (-> *display* entity-clock) 1.0) + (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) 0) + 0 + ) + ((cpad-pressed? (-> self control cpad number) r1) + (set! (-> (the-as fact-info-target (-> self fact-override)) stop-time-timeout) + (+ (-> self clock frame-counter) (seconds 5)) + ) + ) + ) + ) + ((logtest? (-> self game features) (game-feature unk-game-feature-03)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio #x3f800000) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 60.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 2.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 2.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 2.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 120.0 (-> self clock seconds-per-frame))) + ) + ) + ) + ) + ((logtest? (-> self game features) (game-feature unk-game-feature-05)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio #x3f800000) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 0.3 (* 30.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 0.5 (* 30.0 (-> self clock seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 1.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 1.0 (* 30.0 (-> self clock seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 30.0 (-> self clock seconds-per-frame))) + ) + ) + ) + ) + ) + (target-eco-process) + (target-color-effect-process) + (let ((a0-89 (-> self current-level))) + (case (if a0-89 + (-> a0-89 info taskname) + ) + (('sewer 'forest) + (let ((f30-2 (-> self board camera-interp))) + (cond + ((logtest? (focus-status board) (-> self focus-status)) + (seek! (-> self board camera-interp) 1.0 (* 0.1 (-> self clock seconds-per-frame))) + ) + ((< (-> self control ctrl-xz-vel) 2048.0) + ) + (else + (seek! (-> self board camera-interp) 0.0 (* 0.1 (-> self clock seconds-per-frame))) + ) + ) + (let ((f28-0 (-> self board camera-interp))) + (when (!= f28-0 f30-2) + (cond + ((= f28-0 0.0) + (remove-setting! 'fov) + (remove-setting! 'string-max-length) + (remove-setting! 'string-min-length) + ) + (else + (set-setting! 'fov 'rel (lerp-scale 1.0 1.32 f28-0 0.0 1.0) 0) + (set-setting! 'string-min-length 'rel (lerp-scale 1.0 0.6 f28-0 0.0 1.0) 0) + (set-setting! 'string-max-length 'rel (lerp-scale 1.0 0.6 f28-0 0.0 1.0) 0) + ) + ) + ) + ) + ) + ) + ) + ) + (logclear! (-> self focus-status) (focus-status super)) + (if (or (logtest? (-> self focus-status) (focus-status dead hit)) + (logtest? (state-flags sf2 tinvul1 sf5 tinvul2) (-> self state-flags)) + (-> *setting-control* user-current ignore-target) + ) + (logior! (-> self focus-status) (focus-status ignore)) + (logclear! (-> self focus-status) (focus-status ignore)) + ) + (cond + ((or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (zero? (logand (-> self control status) (collide-status on-surface))) + ) + (and (logtest? (focus-status board) (-> self focus-status)) + (< (- (-> self clock frame-counter) (-> self board unknown-time-frame00)) (seconds 0.1)) + ) + ) + (logior! (-> self focus-status) (focus-status in-air)) + (if (logtest? (surface-flag super) (-> self control current-surface flags)) + (set! (-> self focus-status) (logior (focus-status super) (-> self focus-status))) + ) + ) + (else + (logclear! (-> self focus-status) (focus-status in-air)) + ) + ) + (if (using-gun? self) + (set! (-> self focus-status) (logior (focus-status gun) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status gun)) + ) + (if (or (logtest? (water-flags touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + (logior! (-> self focus-status) (focus-status touch-water)) + (logclear! (-> self focus-status) (focus-status touch-water)) + ) + (if (logtest? (-> self control status) (collide-status on-water)) + (logior! (-> self focus-status) (focus-status on-water)) + (logclear! (-> self focus-status) (focus-status on-water)) + ) + (if (and (logtest? (-> self water flags) (water-flags under-water)) + (zero? (logand (-> self water flags) (water-flags swim-ground))) + ) + (logior! (-> self focus-status) (focus-status under-water)) + (logclear! (-> self focus-status) (focus-status under-water)) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set! (-> self focus-status) (logior (focus-status ice) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status ice)) + ) + (if (< (- (-> self clock frame-counter) (-> self gun fire-time)) (seconds 0.1)) + (set! (-> self focus-status) (logior (focus-status shooting) (-> self focus-status))) + (logclear! (-> self focus-status) (focus-status shooting)) + ) + 0 + (none) + ) + +;; definition for function target-powerup-effect +;; WARN: Return type mismatch int vs none. +(defbehavior target-powerup-effect target ((arg0 symbol)) + (case arg0 + (('eco-blue) + (let ((v1-4 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (eco-blue-glow (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-4))) + ) + ) + ) + 0 + (none) + ) + +;; definition for function process-contact-action +;; WARN: Return type mismatch int vs none. +(defbehavior process-contact-action target ((arg0 process)) + (when (logtest? (-> *game-info* features) (game-feature unk-game-feature-01)) + (if arg0 + (set! (-> self clock) (-> arg0 clock)) + (set! (-> self clock) (-> *display* base-clock)) + ) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc index 73238eafe8..6488c59cc5 100644 --- a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc @@ -478,7 +478,7 @@ (defun dm-col-rend-cspec-toggle ((arg0 uint) (arg1 debug-menu-msg)) (let ((v1-0 *col-rend*)) (if (= arg1 (debug-menu-msg press)) - (logxor! (-> v1-0 cspec) arg0) + (logxor! (-> v1-0 cspec) (the-as uint arg0)) ) (logtest? (-> v1-0 cspec) arg0) ) diff --git a/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc b/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc index c45dbe71b0..05665ba37a 100644 --- a/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/effect-control-h_REF.gc @@ -17,12 +17,12 @@ :flag-assert #xf00000024 (:methods (new (symbol type process-drawable) _type_ 0) - (effect-control-method-9 (_type_) none 9) + (update-effects (_type_) none 9) (do-effect (_type_ symbol float int) none 10) - (effect-control-method-11 () none 11) + (do-effect-for-surface (_type_ symbol float int basic pat-surface) none 11) (play-effect-sound (_type_ symbol float int basic sound-name) int 12) (set-channel-offset! (_type_ int) none 13) - (effect-control-method-14 () none 14) + (play-effects-from-res-lump (_type_ float float float) none 14) ) ) diff --git a/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc new file mode 100644 index 0000000000..6c22d12d8c --- /dev/null +++ b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc @@ -0,0 +1,1194 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *footstep-surface*, type pat-surface +(define *footstep-surface* (new 'static 'pat-surface :material (pat-material grass))) + +;; definition for symbol *debug-effect-control*, type symbol +(define *debug-effect-control* #f) + +;; definition for function sound-name-with-material +(defun sound-name-with-material ((arg0 string) (arg1 pat-surface) (arg2 string)) + (format + (clear *temp-string*) + "~S-~S~S" + arg0 + (-> (new 'static 'boxed-array :type string + "unk" + "ice" + "qsd" + "wtr" + "tar" + "san" + "wod" + "grs" + "pmt" + "snw" + "dsn" + "unk" + "lav" + "cwd" + "grv" + "drt" + "mtl" + "str" + "pmt" + "swm" + "unk" + "mtl" + "neu" + "stn" + "cmt" + "car" + "gmt" + "smt" + "hwd" + ) + (-> arg1 material) + ) + arg2 + ) + (string->sound-name *temp-string*) + ) + +;; definition for function effect-param->sound-spec +(defun effect-param->sound-spec ((arg0 sound-spec) (arg1 (pointer float)) (arg2 int) (arg3 process-focusable)) + (while (> arg2 0) + (case (the int (-> arg1 0)) + ((3) + (logior! (-> arg0 mask) (sound-mask volume)) + (set! (-> arg0 volume) (the int (* 1024.0 (-> arg1 1)))) + ) + ((4) + (logior! (-> arg0 mask) (sound-mask volume)) + (+! (-> arg0 volume) (the int (* 1024.0 (* (-> arg1 1) (rand-vu))))) + ) + ((5) + (logior! (-> arg0 mask) (sound-mask pitch)) + (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) + ) + ((6) + (logior! (-> arg0 mask) (sound-mask pitch)) + (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) + ) + ((9) + (logior! (-> arg0 mask) (sound-mask bend)) + (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) + ) + ((10) + (logior! (-> arg0 mask) (sound-mask bend)) + (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) + ) + ((11) + (logior! (-> arg0 mask) (sound-mask fo-min)) + (set! (-> arg0 fo-min) (the int (-> arg1 1))) + ) + ((12) + (logior! (-> arg0 mask) (sound-mask fo-max)) + (set! (-> arg0 fo-max) (the int (-> arg1 1))) + ) + ((13) + (logior! (-> arg0 mask) (sound-mask fo-curve)) + (set! (-> arg0 fo-curve) (the int (-> arg1 1))) + ) + ((19) + (set! (-> arg0 priority) (the int (-> arg1 1))) + ) + ((25) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (-> *footstep-surface* material))) + (let* ((s2-3 arg3) + (v1-33 (if (type? s2-3 process-focusable) + s2-3 + ) + ) + ) + (when v1-33 + (cond + ((logtest? (-> v1-33 focus-status) (focus-status in-air)) + (set! (-> arg0 reg 0) (the-as uint 126)) + ) + ((logtest? (-> v1-33 focus-status) (focus-status touch-water)) + (set! (-> arg0 reg 0) (the-as uint 127)) + ) + (else + (let* ((s2-4 (-> v1-33 root-override)) + (v1-34 (if (type? s2-4 collide-shape-moving) + s2-4 + ) + ) + ) + (if v1-34 + (set! (-> arg0 reg 0) (the-as uint (-> (the-as collide-shape-moving v1-34) ground-pat material))) + ) + ) + ) + ) + ) + ) + ) + ((21) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (the int (-> arg1 1)))) + ) + ((22) + (logior! (-> arg0 mask) (sound-mask reg1)) + (set! (-> arg0 reg 1) (the-as uint (the int (-> arg1 1)))) + ) + ((23) + (logior! (-> arg0 mask) (sound-mask reg2)) + (set! (-> arg0 reg 2) (the-as uint (the int (-> arg1 1)))) + ) + ) + (+! arg2 -2) + (set! arg1 (&-> arg1 2)) + ) + arg0 + ) + +;; definition for method 9 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod update-effects effect-control ((obj effect-control)) + (let* ((a0-1 (-> obj process skel)) + (v1-3 (if (< (the-as uint (-> obj channel-offset)) (-> a0-1 active-channels)) + (-> a0-1 root-channel (-> obj channel-offset)) + (the-as joint-control-channel #f) + ) + ) + ) + (cond + ((and v1-3 (-> v1-3 frame-group)) + (let* ((s5-0 (-> v1-3 frame-group)) + (f30-0 (+ (* (-> v1-3 frame-num) (-> s5-0 artist-step)) (-> s5-0 artist-base))) + ) + (let ((a0-3 (-> a0-1 root-channel 0 num-func))) + (cond + ((!= s5-0 (-> obj last-frame-group)) + (set! (-> obj res) (-> s5-0 extra)) + (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo))) + (set! (-> obj name) (if (>= (the-as int v1-6) 0) + (&-> (-> s5-0 extra tag) v1-6) + (the-as (pointer res-tag) #f) + ) + ) + ) + (if (and (-> obj name) (= (-> obj name 0 key-frame) -1000000000.0)) + (set! (-> obj name) (&-> (-> obj name) 1)) + ) + (play-effects-from-res-lump obj f30-0 f30-0 f30-0) + ) + ((or (not (-> obj name)) (= f30-0 (-> obj last-frame-num))) + ) + (else + (let ((f28-0 (-> obj last-frame-num)) + (f26-0 f30-0) + ) + (cond + ((= a0-3 num-func-seek!) + (let ((f0-6 (+ (* (-> v1-3 param 0) (-> s5-0 artist-step)) (-> s5-0 artist-base)))) + (cond + ((< f26-0 f28-0) + (if (>= f28-0 f0-6) + (play-effects-from-res-lump obj f26-0 f28-0 f30-0) + ) + ) + (else + (if (>= f0-6 f28-0) + (play-effects-from-res-lump obj f28-0 f26-0 f30-0) + ) + ) + ) + ) + ) + ((or (= a0-3 num-func-loop!) (= a0-3 num-func-loop-speedless!)) + (cond + ((>= (-> v1-3 param 0) 0.0) + (cond + ((< f26-0 f28-0) + (play-effects-from-res-lump obj f28-0 9999999.0 f30-0) + (play-effects-from-res-lump obj -100000000.0 f26-0 9999999.0) + ) + (else + (play-effects-from-res-lump obj f28-0 f26-0 f30-0) + ) + ) + ) + ((< f28-0 f26-0) + (play-effects-from-res-lump obj f26-0 9999999.0 f30-0) + (play-effects-from-res-lump obj -100000000.0 f28-0 9999999.0) + ) + (else + (play-effects-from-res-lump obj f26-0 f28-0 f30-0) + ) + ) + ) + ((= a0-3 num-func-+!) + (if (>= (-> v1-3 param 0) 0.0) + (play-effects-from-res-lump obj f28-0 f26-0 f30-0) + (play-effects-from-res-lump obj f26-0 f28-0 f30-0) + ) + ) + ((= a0-3 num-func-identity) + (play-effects-from-res-lump obj f30-0 f30-0 f30-0) + ) + ) + ) + ) + ) + ) + (set! (-> obj last-frame-group) s5-0) + (set! (-> obj last-frame-num) f30-0) + ) + ) + (else + (set! (-> obj last-frame-group) #f) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod play-effects-from-res-lump effect-control ((obj effect-control) (arg0 float) (arg1 float) (arg2 float)) + (let ((s2-0 (-> obj name))) + (while (= (-> s2-0 0 name) 'effect-name) + (let ((f0-0 (-> s2-0 0 key-frame))) + (when (or (and (< f0-0 arg1) (< arg0 f0-0)) (= f0-0 arg2)) + (let* ((a0-1 obj) + (t9-0 (method-of-object a0-1 do-effect)) + (v1-7 (-> obj res)) + (a1-1 (-> s2-0 0)) + ) + (t9-0 + a0-1 + (the-as symbol (-> (the-as (pointer uint32) (&+ (-> v1-7 data-base) (-> a1-1 data-offset))))) + f0-0 + -1 + ) + ) + ) + ) + (set! s2-0 (&-> s2-0 1)) + ) + ) + 0 + (none) + ) + +;; definition for method 10 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 257] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 317] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 337] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 459] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 480] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 579] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 598] +;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 303] +;; WARN: Function (method 10 effect-control) has a return type of none, but the expression builder found a return statement. +(defmethod do-effect effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int)) + (local-vars + (sv-320 int) + (sv-336 symbol) + (sv-352 symbol) + (sv-368 symbol) + (sv-384 vector) + (sv-400 matrix) + (sv-416 int) + (sv-432 symbol) + (sv-448 symbol) + (sv-464 symbol) + (sv-480 vector) + (sv-496 matrix) + (sv-512 res-lump) + ) + (with-pp + (cond + ((logtest? (-> obj flags) (effect-control-flag ecf2)) + (return #f) + ) + ((= arg0 'script) + (let ((gp-1 + (get-property-struct + (-> obj res) + 'effect-script + 'exact + arg1 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (eval! + (new 'stack 'script-context (the-as basic (process->ppointer pp)) pp (the-as vector #f)) + (the-as pair gp-1) + ) + ) + (return #f) + ) + ) + (let ((s3-0 (-> arg0 value)) + (s5-0 (cond + ((< arg2 0) + (let ((v0-5 (get-property-value + (-> obj res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (zero? v0-5) + 0 + (the-as int (+ v0-5 1)) + ) + ) + ) + (else + (empty) + arg2 + ) + ) + ) + ) + (when (logtest? (-> obj flags) (effect-control-flag ecf0)) + (if (send-event (-> obj process) 'effect-control arg0 arg1 s5-0) + (return 0) + ) + ) + (let ((v1-23 (symbol->string arg0))) + (cond + ((and (= (-> v1-23 data 0) 101) + (= (-> v1-23 data 1) 102) + (= (-> v1-23 data 2) 102) + (= (-> v1-23 data 3) 101) + (= (-> v1-23 data 4) 99) + (= (-> v1-23 data 5) 116) + (= (-> v1-23 data 6) 45) + ) + (let* ((s3-1 (-> obj process root)) + (v1-27 (if (type? s3-1 collide-shape-moving) + s3-1 + ) + ) + (t1-2 (if v1-27 + (-> (the-as collide-shape-moving v1-27) ground-pat) + *footstep-surface* + ) + ) + ) + (do-effect-for-surface obj arg0 arg1 s5-0 (-> obj res) t1-2) + ) + ) + ((let ((v1-31 (symbol->string arg0))) + (and (= (-> v1-31 data 0) 103) + (= (-> v1-31 data 1) 114) + (= (-> v1-31 data 2) 111) + (= (-> v1-31 data 3) 117) + (= (-> v1-31 data 4) 112) + (= (-> v1-31 data 5) 45) + ) + ) + (set! s3-0 (cond + ((zero? s3-0) + (let ((v0-10 (lookup-part-group-pointer-by-name (symbol->string arg0)))) + (when v0-10 + (set! (-> arg0 value) v0-10) + (set! s3-0 (-> v0-10 0)) + ) + ) + s3-0 + ) + (else + (-> (the-as (pointer object) s3-0) 0) + ) + ) + ) + (when (and (nonzero? s3-0) (= (-> (the-as basic s3-0) type) sparticle-launch-group)) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-1 + (let ((t9-10 (method-of-type part-tracker activate))) + (t9-10 + (the-as part-tracker s4-1) + (-> obj process) + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((s2-1 run-function-in-process) + (s1-0 s4-1) + (s0-0 part-tracker-init) + ) + (set! sv-320 0) + (set! sv-336 (the-as symbol #f)) + (set! sv-352 (the-as symbol #f)) + (set! sv-368 (the-as symbol #f)) + (set! sv-400 *launch-matrix*) + (set! sv-384 (-> sv-400 trans)) + (let ((v1-55 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-384 quad) v1-55) + ) + ((the-as (function object object object object object object object object none) s2-1) + s1-0 + s0-0 + s3-0 + sv-320 + sv-336 + sv-352 + sv-368 + sv-400 + ) + ) + (-> s4-1 ppointer) + ) + ) + ) + ) + ((let ((v1-58 (symbol->string arg0))) + (and (= (-> v1-58 data 0) 101) + (= (-> v1-58 data 1) 118) + (= (-> v1-58 data 2) 101) + (= (-> v1-58 data 3) 110) + (= (-> v1-58 data 4) 116) + (= (-> v1-58 data 5) 45) + ) + ) + (send-event (-> obj process) arg0 arg1 s5-0) + ) + ((= arg0 'camera-shake) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((zero? s3-0) + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launcher) + (if *debug-effect-control* + (format + #t + "(~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (format + #t + "-----> (~5D) effect part ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + (let ((s4-2 sp-launch-particles-var) + (s2-2 *sp-particle-system-2d*) + (s0-2 *launch-matrix*) + ) + (set! (-> s0-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad) + ) + (s4-2 + s2-2 + (the-as sparticle-launcher s3-0) + s0-2 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sparticle-launch-group) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (-> pp clock frame-counter) + (-> obj process name) + arg0 + arg1 + s5-0 + ) + ) + (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) + (when s4-3 + (let ((t9-23 (method-of-type part-tracker activate))) + (t9-23 + (the-as part-tracker s4-3) + (-> obj process) + (symbol->string (-> part-tracker symbol)) + (the-as pointer #x70004000) + ) + ) + (let ((s2-3 run-function-in-process) + (s1-3 s4-3) + (s0-3 part-tracker-init) + ) + (set! sv-416 0) + (set! sv-432 (the-as symbol #f)) + (set! sv-448 (the-as symbol #f)) + (set! sv-464 (the-as symbol #f)) + (set! sv-496 *launch-matrix*) + (set! sv-480 (-> sv-496 trans)) + (let ((v1-95 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) quad))) + (set! (-> sv-480 quad) v1-95) + ) + ((the-as (function object object object object object object object object none) s2-3) + s1-3 + s0-3 + s3-0 + sv-416 + sv-432 + sv-448 + sv-464 + sv-496 + ) + ) + (-> s4-3 ppointer) + ) + ) + ) + ((= (-> (the-as basic s3-0) type) sound-spec) + (sound-play-by-spec + (the-as sound-spec s3-0) + (new-sound-id) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data s5-0)) + ) + ) + ((= (-> (the-as basic s3-0) type) death-info) + (when (and (logtest? (-> obj flags) (effect-control-flag ecf1)) (zero? (-> obj process draw death-timer))) + (let ((v1-106 (-> obj process draw))) + (let ((a1-51 (-> (the-as death-info s3-0) vertex-skip)) + (a0-77 + (max + 2 + (the-as int (/ (-> (the-as death-info s3-0) timer) (the-as uint (the int (-> *display* time-factor))))) + ) + ) + ) + (when (= (-> *setting-control* user-current video-mode) 'pal) + (if (< (the-as uint 1) a1-51) + (set! a1-51 (/ (the-as uint (* (the-as uint 50) a1-51)) (the-as uint 60))) + ) + ) + (let ((a2-37 (-> *display* frames (-> *display* last-screen) run-time))) + (cond + ((< (seconds 30) a2-37) + (set! a1-51 (* a1-51 4)) + ) + ((< (seconds 23.335) a2-37) + (set! a1-51 (* a1-51 2)) + ) + ) + ) + (set! (-> v1-106 death-vertex-skip) a1-51) + (set! (-> v1-106 death-effect) (-> (the-as death-info s3-0) effect)) + (set! (-> v1-106 death-timer) (the-as uint (+ a0-77 1))) + ) + (set! (-> v1-106 death-timer-org) (-> v1-106 death-timer)) + (set! (-> v1-106 death-draw-overlap) (-> (the-as death-info s3-0) overlap)) + ) + (when (-> (the-as death-info s3-0) sound) + (let* ((s2-5 obj) + (s1-4 (method-of-object s2-5 play-effect-sound)) + (s0-4 (-> (the-as death-info s3-0) sound)) + ) + (set! sv-512 (-> obj res)) + (let ((t1-12 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))))) + (s1-4 s2-5 s0-4 arg1 s5-0 sv-512 t1-12) + ) + ) + ) + (send-event (-> obj process) 'death-start (the-as death-info s3-0)) + ) + ) + (else + (play-effect-sound obj arg0 arg1 s5-0 (-> obj res) (string->sound-name (symbol->string arg0))) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 11 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod do-effect-for-surface effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) + (local-vars + (sv-64 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-80 sparticle-system) + (sv-96 vector) + (sv-112 matrix) + (sv-128 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-144 sparticle-system) + (sv-160 vector) + (sv-176 matrix) + (sv-192 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-208 sparticle-system) + (sv-224 vector) + (sv-240 matrix) + ) + (let ((s1-0 (the-as sound-name #f))) + (-> *display* frames (-> *display* last-screen) run-time) + (case arg0 + (('effect-walk-step-left) + (set! s1-0 (sound-name-with-material "walk" arg4 "1")) + ) + (('effect-run-step-left) + (set! s1-0 (sound-name-with-material "run" arg4 "1")) + ) + (('effect-mech-step-left) + (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) + ) + (('effect-walk-step-right) + (set! s1-0 (sound-name-with-material "walk" arg4 "2")) + ) + (('effect-run-step-right) + (set! s1-0 (sound-name-with-material "run" arg4 "2")) + ) + (('effect-mech-step-right) + (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) + ) + (('effect-roll) + (set! s1-0 (sound-name-with-material "roll" arg4 "")) + ) + (('effect-slide) + (set! s1-0 (sound-name-with-material "slide" arg4 "")) + ) + (('effect-land) + (set! s1-0 (sound-name-with-material "land" arg4 "")) + ) + (('effect-zoom-land) + (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) + ) + (('effect-zoom-hit) + (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) + ) + (('effect-flut-land) + (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) + ) + (('effect-land-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-land-poof-unk + 'group-land-poof-ice + 'group-land-poof-qsd + 'group-land-poof-wtr + 'group-land-poof-tar + 'group-land-poof-san + 'group-land-poof-wod + 'group-land-poof-grs + 'group-land-poof-pmt + 'group-land-poof-snw + 'group-land-poof-dsn + 'group-land-poof-unk + 'group-land-poof-lav + 'group-land-poof-cwd + 'group-land-poof-grv + 'group-land-poof-drt + 'group-land-poof-mtl + 'group-land-poof-str + 'group-land-poof-pmt + 'group-land-poof-swm + 'group-land-poof-unk + 'group-land-poof-mtl + 'group-land-poof-neu + 'group-land-poof-stn + 'group-land-poof-cmt + 'group-land-poof-car + 'group-land-poof-gmt + 'group-land-poof-smt + 'group-land-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-run-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-run-poof-unk + 'group-run-poof-ice + 'group-run-poof-qsd + 'group-run-poof-wtr + 'group-run-poof-tar + 'group-run-poof-san + 'group-run-poof-wod + 'group-run-poof-grs + 'group-run-poof-pmt + 'group-run-poof-snw + 'group-run-poof-dsn + 'group-run-poof-unk + 'group-run-poof-lav + 'group-run-poof-cwd + 'group-run-poof-grv + 'group-run-poof-drt + 'group-run-poof-mtl + 'group-run-poof-str + 'group-run-poof-pmt + 'group-run-poof-swm + 'group-run-poof-unk + 'group-run-poof-mtl + 'group-run-poof-neu + 'group-run-poof-stn + 'group-run-poof-cmt + 'group-run-poof-car + 'group-run-poof-gmt + 'group-run-poof-smt + 'group-run-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-just-footprint) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-just-footprint-unk + 'group-just-footprint-ice + 'group-just-footprint-qsd + 'group-just-footprint-wtr + 'group-just-footprint-tar + 'group-just-footprint-san + 'group-just-footprint-wod + 'group-just-footprint-grs + 'group-just-footprint-pmt + 'group-just-footprint-snw + 'group-just-footprint-dsn + 'group-just-footprint-unk + 'group-just-footprint-lav + 'group-just-footprint-cwd + 'group-just-footprint-grv + 'group-just-footprint-drt + 'group-just-footprint-mtl + 'group-just-footprint-str + 'group-just-footprint-pmt + 'group-just-footprint-swm + 'group-just-footprint-unk + 'group-just-footprint-mtl + 'group-just-footprint-neu + 'group-just-footprint-stn + 'group-just-footprint-cmt + 'group-just-footprint-car + 'group-just-footprint-gmt + 'group-just-footprint-smt + 'group-just-footprint-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-just-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-just-poof-unk + 'group-just-poof-ice + 'group-just-poof-qsd + 'group-just-poof-wtr + 'group-just-poof-tar + 'group-just-poof-san + 'group-just-poof-wod + 'group-just-poof-grs + 'group-just-poof-pmt + 'group-just-poof-snw + 'group-just-poof-dsn + 'group-just-poof-unk + 'group-just-poof-lav + 'group-just-poof-cwd + 'group-just-poof-grv + 'group-just-poof-drt + 'group-just-poof-mtl + 'group-just-poof-str + 'group-just-poof-pmt + 'group-just-poof-swm + 'group-just-poof-unk + 'group-just-poof-mtl + 'group-just-poof-neu + 'group-just-poof-stn + 'group-just-poof-cmt + 'group-just-poof-car + 'group-just-poof-gmt + 'group-just-poof-smt + 'group-just-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-slide-poof) + (do-effect + obj + (-> (new 'static 'boxed-array :type symbol + 'group-slide-poof-unk + 'group-slide-poof-ice + 'group-slide-poof-qsd + 'group-slide-poof-wtr + 'group-slide-poof-tar + 'group-slide-poof-san + 'group-slide-poof-wod + 'group-slide-poof-grs + 'group-slide-poof-pmt + 'group-slide-poof-snw + 'group-slide-poof-dsn + 'group-slide-poof-unk + 'group-slide-poof-lav + 'group-slide-poof-cwd + 'group-slide-poof-grv + 'group-slide-poof-drt + 'group-slide-poof-mtl + 'group-slide-poof-str + 'group-slide-poof-pmt + 'group-slide-poof-swm + 'group-slide-poof-unk + 'group-slide-poof-mtl + 'group-slide-poof-neu + 'group-slide-poof-stn + 'group-slide-poof-cmt + 'group-slide-poof-car + 'group-slide-poof-gmt + 'group-slide-poof-smt + 'group-slide-poof-hwd + ) + (-> arg4 material) + ) + arg1 + -1 + ) + ) + (('effect-droppings) + (let ((s0-0 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x97 + #x1b7 + #x1b8 + #x1b9 + #x1ba + #x82 + #x94 + #x84 + #x1bb + #x85 + #x1bc + #x97 + #x1bd + #x96 + #x1be + #x83 + #x1bf + #x1c0 + #x1bb + #x1c1 + #x97 + #x1bf + #x1c2 + #x95 + #x1c3 + #x1c4 + #x1c5 + #x1c6 + #x1c7 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-0) + (set! sv-64 sp-launch-particles-var) + (set! sv-80 *sp-particle-system-2d*) + (set! sv-112 *launch-matrix*) + (set! sv-96 (-> sv-112 trans)) + (let ((v1-63 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) quad))) + (set! (-> sv-96 quad) v1-63) + ) + (let ((a3-6 #f) + (t0-1 #f) + (t1-1 1.0) + ) + (sv-64 sv-80 s0-0 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + ) + ) + ) + ) + (('effect-jump-droppings) + (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x1c8 + #x1c9 + #x1ca + #x1cb + #x1cc + #x90 + #x1cd + #x93 + #x1ce + #x92 + #x1cf + #x1c8 + #x1d0 + #x1d1 + #x1d2 + #x91 + #x1d3 + #x1d4 + #x1ce + #x1d5 + #x1c8 + #x1d3 + #x1d6 + #x1d7 + #x1d8 + #x1d9 + #x1da + #x1db + #x1dc + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-1) + (set! sv-128 sp-launch-particles-var) + (set! sv-144 *sp-particle-system-2d*) + (set! sv-176 *launch-matrix*) + (set! sv-160 (-> sv-176 trans)) + (let ((v1-79 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) quad))) + (set! (-> sv-160 quad) v1-79) + ) + (let ((a3-7 #f) + (t0-2 #f) + (t1-2 1.0) + ) + (sv-128 sv-144 s0-1 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + ) + ) + ) + ) + (('effect-board-poof) + (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x1dd + #x1de + #x1df + #x1e0 + #x1e1 + #x1e2 + #x1e3 + #x1e4 + #x1e5 + #x1e6 + #x1e7 + #x1dd + #x1e8 + #x1e9 + #x1ea + #x1eb + #x1ec + #x1ed + #x1e5 + #x1ee + #x1dd + #x1ec + #x1ef + #x1b3 + #x1f0 + #x1f1 + #x1f2 + #x1f3 + #x1f4 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-2) + (set! sv-192 sp-launch-particles-var) + (set! sv-208 *sp-particle-system-2d*) + (set! sv-240 *launch-matrix*) + (set! sv-224 (-> sv-240 trans)) + (let ((v1-96 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) quad))) + (set! (-> sv-224 quad) v1-96) + ) + (let ((a3-8 #f) + (t0-3 #f) + (t1-3 1.0) + ) + (sv-192 sv-208 s0-2 sv-240 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + ) + ) + ) + ) + ) + (if s1-0 + (play-effect-sound obj arg0 arg1 arg2 arg3 s1-0) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type effect-control +;; INFO: Used lq/sq +(defmethod play-effect-sound effect-control ((obj effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) + (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) + (with-pp + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (the-as object (new 'stack 'sound-spec))) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> obj process node-list data arg2)) + ) + ) + ) + (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) + (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) + (set! (-> (the-as sound-spec gp-0) volume) 1024) + (set! sv-112 (new 'static 'res-tag)) + (let* ((t9-2 (method-of-type res-lump get-property-data)) + (a1-5 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer res-tag) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + ) + (when a1-6 + (effect-param->sound-spec + (the-as sound-spec gp-0) + (the-as (pointer float) a1-6) + (the-as int (-> sv-112 elt-count)) + (the-as process-focusable (-> obj process)) + ) + (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) + (return 0) + ) + ) + ) + (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) + (when (!= f0-0 0.0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) + (let ((f0-1 (* 2.0 f0-0))) + (set! (-> (the-as sound-spec gp-0) pitch-mod) + (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) + ) + ) + ) + ) + (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) + (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-8 (ear-trans 0)) + (a1-7 s5-0) + ) + (< f30-0 (sv-160 a0-8 a1-7)) + ) + ) + ) + (= (-> (the-as (pointer int8) gp-0) 9) 126) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~A (~S) frame ~F joint ~D " + (-> pp clock frame-counter) + (-> obj process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) + (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) + ) + ) + (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) + ) + 0 + ) + ) + +;; definition for function target-land-effect +;; WARN: Return type mismatch int vs none. +(defbehavior target-land-effect target () + (cond + ((logtest? (-> self focus-status) (focus-status flut)) + (do-effect (-> self skel effect) 'effect-land-poof -1.0 -1) + (do-effect (-> self skel effect) 'effect-flut-land -1.0 -1) + ) + ((logtest? (focus-status pilot) (-> self focus-status)) + (sound-play-by-name + (sound-name-with-material "zoom-land" (-> self control ground-pat) "") + (new-sound-id) + (the int (* 1024.0 (* 0.000016276043 (-> self control ground-impact-vel)))) + 0 + 0 + (sound-group sfx) + #t + ) + ) + ((logtest? (water-flags touch-water) (-> self water flags)) + (do-effect (-> self skel effect) 'effect-land-water -1.0 -1) + ) + (else + (do-effect (-> self skel effect) 'effect-land-poof -1.0 -1) + (do-effect (-> self skel effect) 'effect-land -1.0 -1) + ) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/game/main-h_REF.gc b/test/decompiler/reference/jak2/engine/game/main-h_REF.gc index 1772b4b39b..2282b870c3 100644 --- a/test/decompiler/reference/jak2/engine/game/main-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/main-h_REF.gc @@ -406,23 +406,23 @@ ;; definition of type col-rend (deftype col-rend (basic) - ((draw? symbol :offset-assert 4) - (outline? symbol :offset-assert 8) - (show-back-faces? symbol :offset-assert 12) - (show-normals? symbol :offset-assert 16) - (ghost-hidden? symbol :offset-assert 20) - (show-only uint32 :offset-assert 24) - (cspec uint32 :offset-assert 28) - (track uint8 :offset-assert 32) - (bbox-radius float :offset-assert 36) - (bbox-center vector :inline :offset-assert 48) - (camera-to-bbox-dist float :offset-assert 64) + ((draw? symbol :offset-assert 4) + (outline? symbol :offset-assert 8) + (show-back-faces? symbol :offset-assert 12) + (show-normals? symbol :offset-assert 16) + (ghost-hidden? symbol :offset-assert 20) + (show-only uint32 :offset-assert 24) + (cspec collide-spec :offset-assert 28) + (track uint8 :offset-assert 32) + (bbox-radius float :offset-assert 36) + (bbox-center vector :inline :offset-assert 48) + (camera-to-bbox-dist float :offset-assert 64) ) :method-count-assert 10 :size-assert #x44 :flag-assert #xa00000044 (:methods - (col-rend-method-9 () none 9) + (col-rend-method-9 (_type_) none 9) ) ) @@ -455,7 +455,7 @@ :show-back-faces? #t :show-normals? #f :ghost-hidden? #t - :cspec #x38 + :cspec (collide-spec crate civilian enemy) :track #x1 :bbox-radius 24576.0 :camera-to-bbox-dist 65536.0 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 index 261fda909c..2ee789e803 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc @@ -394,16 +394,11 @@ ) (dotimes (s1-1 1) (let* ((v1-20 (-> arg0 data s1-1)) - (t9-3 (-> v1-20 param0)) + (t9-3 (the-as function (-> 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)) + (if (the-as (function cspace matrix none) t9-3) + ((the-as (function object object object none) t9-3) v1-20 (-> v1-20 param1) (-> v1-20 param2)) ) - ) ) ) (dotimes (s1-2 2) @@ -1339,7 +1334,7 @@ (label cfg-45) (let ((a0-26 (-> gp-0 effect))) (if a0-26 - (effect-control-method-9 a0-26) + (update-effects a0-26) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc index 939ce71ddb..a306a996bf 100644 --- a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc @@ -981,10 +981,9 @@ (set! (-> s5-1 sound-name) (-> obj name)) (set! (-> s5-1 fo-max) (-> obj falloff-far)) (set! (-> s5-1 mask) (sound-mask)) - (when (-> obj params) - pp - (effect-param->sound-spec s5-1 (-> obj params) (-> obj param-count)) - ) + (if (-> obj params) + (effect-param->sound-spec s5-1 (-> obj params) (-> obj param-count) (the-as process-focusable pp)) + ) ) (let ((v1-23 (-> s5-1 fo-max))) (if (and (nonzero? v1-23) (< (* 4096.0 (the float v1-23)) (vector-vector-distance (ear-trans 0) (-> obj trans)))) diff --git a/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc index 4fa4e722ac..6a5fb31b39 100644 --- a/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc @@ -445,7 +445,7 @@ ) (let ((a0-53 (-> self skel effect))) (if a0-53 - (effect-control-method-9 a0-53) + (update-effects a0-53) ) ) (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) diff --git a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc index 8b3e629a33..675efaf505 100644 --- a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -100,19 +100,20 @@ ;; definition for function target-darkjak-process ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. -(defbehavior target-darkjak-process target ((arg0 object) (arg1 object) (arg2 object) (arg3 object) (arg4 object) (arg5 object) (arg6 float)) - (local-vars (gp-0 vector)) +;; ERROR: Function may read a register that is not set: t2 +(defbehavior target-darkjak-process target () + (local-vars (t2-0 none) (gp-0 vector)) (cond ((and (logtest? (focus-status dark) (-> self focus-status)) (nonzero? (-> self darkjak))) - (let ((a1-1 'eco-red)) - (target-danger-set! (-> self control danger-mode) a1-1) + (let ((a1-0 'eco-red)) + (target-danger-set! (-> self control danger-mode) a1-0) ) (update-transforms (-> self control)) - (let ((a1-2 (new 'stack-no-clear 'overlaps-others-params))) - (set! (-> a1-2 options) (overlaps-others-options)) - (set! (-> a1-2 collide-with-filter) (the-as collide-spec -1)) - (set! (-> a1-2 tlist) *touching-list*) - (find-overlapping-shapes (-> self control) a1-2) + (let ((a1-1 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-1 options) (overlaps-others-options)) + (set! (-> a1-1 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-1 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-1) ) (target-danger-set! (-> self control danger-mode) #f) (update-transforms (-> self control)) @@ -140,12 +141,12 @@ (f26-0 (lerp-scale 1.0 (* 0.20000002 (+ 5.0 (-> self darkjak-giant-interp))) f30-0 0.0 1.0)) ) (set-vector! (-> self control scale) f28-0 f28-0 f28-0 1.0) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! (-> a3-3 x) f26-0) - (set! (-> a3-3 y) 1.0) - (set! (-> a3-3 z) f26-0) - (set! (-> a3-3 w) 1.0) - (trs-set! (-> self upper-body) (the-as vector #f) (the-as quaternion #f) a3-3) + (let ((a3-2 (new 'stack-no-clear 'vector))) + (set! (-> a3-2 x) f26-0) + (set! (-> a3-2 y) 1.0) + (set! (-> a3-2 z) f26-0) + (set! (-> a3-2 w) 1.0) + (trs-set! (-> self upper-body) (the-as vector #f) (the-as quaternion #f) a3-2) ) (let ((f26-1 (* 1.1 f26-0))) (cond @@ -182,17 +183,17 @@ ) ) (trs-set! (-> self neck) (the-as vector #f) (the-as quaternion #f) gp-0) - (let* ((a0-44 (-> self horns)) - (t9-14 (method-of-object a0-44 trs-set!)) - (a1-12 #f) - (a2-9 #f) - (a3-8 (new 'stack-no-clear 'vector)) + (let* ((a0-43 (-> self horns)) + (t9-14 (method-of-object a0-43 trs-set!)) + (a1-11 #f) + (a2-8 #f) + (a3-7 (new 'stack-no-clear 'vector)) ) - (set! (-> a3-8 x) f30-0) - (set! (-> a3-8 y) f30-0) - (set! (-> a3-8 z) f30-0) - (set! (-> a3-8 w) 1.0) - (t9-14 a0-44 (the-as vector a1-12) (the-as quaternion a2-9) a3-8) + (set! (-> a3-7 x) f30-0) + (set! (-> a3-7 y) f30-0) + (set! (-> a3-7 z) f30-0) + (set! (-> a3-7 w) 1.0) + (t9-14 a0-43 (the-as vector a1-11) (the-as quaternion a2-8) a3-7) ) (set-darkjak-texture-morph! f30-0) (cond @@ -227,11 +228,11 @@ (s2-0 *launch-matrix*) ) (set! (-> s2-0 trans quad) (-> (process-drawable-random-point! self (new 'stack-no-clear 'vector)) quad)) - (let ((a3-9 #f) - (t0-6 #f) - (t1-1 1.0) + (let ((a3-8 #f) + (t0-5 #f) + (t1-0 1.0) ) - (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state a3-9) (the-as sparticle-launch-control t0-6) t1-1) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-5) t1-0) (cond ((rand-vu-percent? 0.25) (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.02)) @@ -241,9 +242,9 @@ (-> *lightning-spec-id-table* 8) lightning-probe-callback (-> *part-id-table* 179) - (the-as int t0-6) - (the-as int t1-1) - arg6 + (the-as int t0-5) + (the-as int t1-0) + (the-as float t2-0) ) ) )