From c8653b2d51c929febf39d63ef771963bed491c6c Mon Sep 17 00:00:00 2001 From: Hat Kid <6624576+Hat-Kid@users.noreply.github.com> Date: Wed, 15 Apr 2026 02:29:58 +0200 Subject: [PATCH] jak2 ref --- .../reference/jak2/decompiler-macros.gc | 3 + .../reference/jak2/engine/ai/enemy_REF.gc | 42 +- .../jak2/engine/anim/joint-exploder_REF.gc | 107 +- .../jak2/engine/anim/joint-mod_REF.gc | 761 ++-- .../reference/jak2/engine/anim/joint_REF.gc | 136 +- .../jak2/engine/camera/cam-combiner_REF.gc | 5 +- .../jak2/engine/camera/cam-layout_REF.gc | 329 +- .../jak2/engine/camera/cam-master_REF.gc | 68 +- .../jak2/engine/camera/cam-states-dbg_REF.gc | 7 +- .../jak2/engine/camera/cam-states_REF.gc | 405 +- .../jak2/engine/camera/cam-update_REF.gc | 28 +- .../jak2/engine/camera/camera_REF.gc | 372 +- .../jak2/engine/collide/collide-cache_REF.gc | 28 +- .../engine/collide/collide-edge-grab_REF.gc | 34 +- .../engine/collide/collide-shape-rider_REF.gc | 24 +- .../jak2/engine/collide/collide-shape_REF.gc | 336 +- .../jak2/engine/collide/find-nearest_REF.gc | 22 +- .../jak2/engine/common_objs/basebutton_REF.gc | 6 +- .../engine/common_objs/blocking-plane_REF.gc | 16 +- .../engine/common_objs/collectables_REF.gc | 419 +- .../jak2/engine/common_objs/conveyor_REF.gc | 68 +- .../engine/common_objs/dark-eco-pool_REF.gc | 3 +- .../jak2/engine/common_objs/elevator_REF.gc | 80 +- .../engine/common_objs/generic-obs_REF.gc | 62 +- .../jak2/engine/common_objs/water-anim_REF.gc | 33 +- .../jak2/engine/common_objs/water-flow_REF.gc | 67 +- .../jak2/engine/common_objs/water_REF.gc | 77 +- .../jak2/engine/debug/debug-sphere_REF.gc | 54 +- .../reference/jak2/engine/debug/debug_REF.gc | 390 +- .../jak2/engine/debug/default-menu_REF.gc | 157 +- .../jak2/engine/debug/editable_REF.gc | 972 +++-- .../jak2/engine/debug/history_REF.gc | 450 ++- .../jak2/engine/debug/memory-usage_REF.gc | 409 +- .../reference/jak2/engine/debug/menu_REF.gc | 143 +- .../engine/debug/nav/mysql-nav-graph_REF.gc | 352 +- .../engine/debug/nav/nav-graph-editor_REF.gc | 247 +- .../reference/jak2/engine/debug/viewer_REF.gc | 40 +- .../jak2/engine/dma/dma-disasm_REF.gc | 564 ++- .../jak2/engine/draw/drawable_REF.gc | 537 ++- .../jak2/engine/entity/actor-link-h_REF.gc | 18 +- .../jak2/engine/entity/entity_REF.gc | 843 ++-- .../reference/jak2/engine/entity/res_REF.gc | 62 +- .../jak2/engine/game/effect-control_REF.gc | 179 +- .../reference/jak2/engine/game/fact-h_REF.gc | 87 +- .../jak2/engine/game/game-info_REF.gc | 511 ++- .../jak2/engine/game/game-save_REF.gc | 53 +- .../jak2/engine/game/task/task-arrow_REF.gc | 28 +- .../jak2/engine/geometry/cylinder_REF.gc | 154 +- .../jak2/engine/geometry/geometry_REF.gc | 81 +- .../jak2/engine/geometry/path-h_REF.gc | 16 +- .../reference/jak2/engine/geometry/vol_REF.gc | 235 +- .../gfx/background/tfrag/tfrag-methods_REF.gc | 224 +- .../jak2/engine/gfx/background/tie/tie_REF.gc | 38 +- .../jak2/engine/gfx/foreground/eye_REF.gc | 12 +- .../engine/gfx/foreground/lightning_REF.gc | 713 ++-- .../jak2/engine/gfx/foreground/ripple_REF.gc | 30 +- .../jak2/engine/gfx/math-camera_REF.gc | 27 +- .../jak2/engine/gfx/mood/mood-funcs2_REF.gc | 77 +- .../jak2/engine/gfx/mood/mood_REF.gc | 26 +- .../jak2/engine/gfx/ocean/ocean-mid_REF.gc | 78 +- .../jak2/engine/gfx/ocean/ocean-near_REF.gc | 6 +- .../engine/gfx/ocean/ocean-texture_REF.gc | 42 +- .../engine/gfx/ocean/ocean-transition_REF.gc | 296 +- .../jak2/engine/gfx/ocean/ocean_REF.gc | 550 +-- .../jak2/engine/gfx/shrub/shrubbery_REF.gc | 123 +- .../jak2/engine/gfx/sky/sky-tng_REF.gc | 47 +- .../particles/sparticle-launcher_REF.gc | 53 +- .../gfx/sprite/particles/sparticle_REF.gc | 69 +- .../engine/gfx/sprite/sprite-distort_REF.gc | 69 +- .../jak2/engine/gfx/sprite/sprite-glow_REF.gc | 36 +- .../jak2/engine/gfx/sprite/sprite_REF.gc | 2 +- .../gfx/texture/texture-anim-funcs_REF.gc | 6 +- .../engine/gfx/texture/texture-anim_REF.gc | 107 +- .../jak2/engine/gfx/texture/texture_REF.gc | 451 ++- .../reference/jak2/engine/level/level_REF.gc | 90 +- .../reference/jak2/engine/level/region_REF.gc | 208 +- .../reference/jak2/engine/load/decomp_REF.gc | 9 +- .../reference/jak2/engine/load/loader_REF.gc | 484 ++- .../reference/jak2/engine/math/euler_REF.gc | 22 +- .../reference/jak2/engine/math/math_REF.gc | 10 +- .../jak2/engine/math/quaternion_REF.gc | 25 +- .../jak2/engine/math/transformq_REF.gc | 78 +- .../jak2/engine/math/trigonometry_REF.gc | 15 +- .../jak2/engine/math/vector-h_REF.gc | 8 +- .../reference/jak2/engine/math/vector_REF.gc | 6 +- .../jak2/engine/nav/nav-control_REF.gc | 1734 ++++----- .../jak2/engine/nav/nav-enemy_REF.gc | 16 +- .../jak2/engine/nav/nav-mesh-h_REF.gc | 168 +- .../reference/jak2/engine/nav/nav-mesh_REF.gc | 898 ++--- .../jak2/engine/physics/chain-physics_REF.gc | 419 +- .../jak2/engine/physics/rigid-body_REF.gc | 106 +- .../jak2/engine/physics/trajectory_REF.gc | 19 +- .../process-drawable/process-drawable_REF.gc | 159 +- .../reference/jak2/engine/ps2/pad_REF.gc | 2 +- .../reference/jak2/engine/scene/scene_REF.gc | 91 +- .../reference/jak2/engine/sound/gsound_REF.gc | 184 +- .../reference/jak2/engine/sound/speech_REF.gc | 19 +- .../engine/spatial-hash/actor-hash_REF.gc | 75 +- .../engine/spatial-hash/collide-hash_REF.gc | 786 ++-- .../engine/spatial-hash/spatial-hash_REF.gc | 73 +- .../engine/target/board/board-states_REF.gc | 47 +- .../engine/target/board/target-board_REF.gc | 3 +- .../target/collide-reaction-target_REF.gc | 834 ++-- .../engine/target/gun/gun-dark-shot_REF.gc | 171 +- .../engine/target/gun/gun-red-shot_REF.gc | 24 +- .../engine/target/gun/gun-yellow-shot_REF.gc | 2 +- .../jak2/engine/target/logic-target_REF.gc | 187 +- .../jak2/engine/target/mech/grunt-mech_REF.gc | 57 +- .../engine/target/mech/mech-states_REF.gc | 38 +- .../jak2/engine/target/surface-h_REF.gc | 4 +- .../jak2/engine/target/target-anim_REF.gc | 24 +- .../jak2/engine/target/target-darkjak_REF.gc | 1484 ++++--- .../jak2/engine/target/target-death_REF.gc | 453 +-- .../jak2/engine/target/target-handler_REF.gc | 661 ++-- .../jak2/engine/target/target-part_REF.gc | 584 ++- .../jak2/engine/target/target-turret_REF.gc | 75 +- .../jak2/engine/target/target2_REF.gc | 96 +- .../reference/jak2/engine/ui/bigmap_REF.gc | 160 +- .../jak2/engine/ui/hud-classes_REF.gc | 42 +- .../reference/jak2/engine/ui/hud_REF.gc | 386 +- .../reference/jak2/engine/ui/minimap_REF.gc | 1088 +++--- .../engine/ui/progress/progress-draw_REF.gc | 3437 ++++++++--------- .../jak2/engine/ui/progress/progress_REF.gc | 57 +- .../reference/jak2/engine/ui/text_REF.gc | 429 +- .../reference/jak2/engine/util/profile_REF.gc | 15 +- .../jak2/engine/util/sync-info_REF.gc | 24 +- .../jak2/levels/atoll/ash1-course_REF.gc | 8 +- .../jak2/levels/atoll/atoll-obs_REF.gc | 34 +- .../jak2/levels/atoll/atoll-part_REF.gc | 2 +- .../reference/jak2/levels/atoll/juicer_REF.gc | 6 +- .../jak2/levels/atoll/sig0-course_REF.gc | 249 +- .../reference/jak2/levels/atoll/sniper_REF.gc | 4 +- .../jak2/levels/castle/castle-obs_REF.gc | 75 +- .../jak2/levels/city/bombbot/bombbot_REF.gc | 421 +- .../jak2/levels/city/common/height-map_REF.gc | 53 +- .../jak2/levels/city/common/nav-graph_REF.gc | 158 +- .../levels/city/common/pilot-states_REF.gc | 39 +- .../jak2/levels/city/common/trail_REF.gc | 106 +- .../jak2/levels/city/ctywide-obs_REF.gc | 340 +- .../jak2/levels/city/ctywide-part_REF.gc | 2 +- .../jak2/levels/city/ctywide-tasks_REF.gc | 16 +- .../city/kiddogescort/crocesc-states_REF.gc | 32 +- .../levels/city/kiddogescort/crocesc_REF.gc | 8 +- .../city/kiddogescort/hal4-course_REF.gc | 42 +- .../city/kiddogescort/kidesc-states_REF.gc | 69 +- .../levels/city/kiddogescort/kidesc_REF.gc | 8 +- .../city/meet-brutter/meet-brutter_REF.gc | 117 +- .../levels/city/onintent/onin-game_REF.gc | 50 +- .../levels/city/package/delivery-task_REF.gc | 88 +- .../levels/city/port/race/errol-chal_REF.gc | 76 +- .../levels/city/sack/collection-task_REF.gc | 16 +- .../jak2/levels/city/shuttle/shuttle_REF.gc | 107 +- .../city/traffic/citizen/citizen_REF.gc | 92 +- .../city/traffic/citizen/civilian_REF.gc | 216 +- .../levels/city/traffic/citizen/guard_REF.gc | 187 +- .../traffic/citizen/metalhead-grunt_REF.gc | 28 +- .../traffic/citizen/metalhead-predator_REF.gc | 38 +- .../levels/city/traffic/traffic-engine_REF.gc | 719 ++-- .../traffic/vehicle/vehicle-control_REF.gc | 65 +- .../traffic/vehicle/vehicle-effects_REF.gc | 153 +- .../city/traffic/vehicle/vehicle-guard_REF.gc | 19 +- .../traffic/vehicle/vehicle-physics_REF.gc | 193 +- .../traffic/vehicle/vehicle-states_REF.gc | 30 +- .../city/traffic/vehicle/vehicle-util_REF.gc | 349 +- .../city/traffic/vehicle/vehicle_REF.gc | 105 +- .../levels/city/vinroom/vinroom-part_REF.gc | 2 +- .../levels/common/ai/ashelin/ash-shot_REF.gc | 2 +- .../jak2/levels/common/ai/ashelin/ash_REF.gc | 19 +- .../jak2/levels/common/ai/bot-h_REF.gc | 72 +- .../jak2/levels/common/ai/bot_REF.gc | 53 +- .../jak2/levels/common/ai/sig/sig-shot_REF.gc | 2 +- .../jak2/levels/common/ai/sig/sig_REF.gc | 24 +- .../jak2/levels/common/battle_REF.gc | 104 +- .../jak2/levels/common/elec-gate_REF.gc | 123 +- .../jak2/levels/common/enemy/centurion_REF.gc | 61 +- .../levels/common/enemy/fodder/fodder_REF.gc | 68 +- .../jak2/levels/common/enemy/grunt_REF.gc | 28 +- .../enemy/guards/crimson-guard-level_REF.gc | 275 +- .../enemy/guards/guard-conversation_REF.gc | 6 +- .../jak2/levels/common/enemy/hopper_REF.gc | 40 +- .../enemy/hover/crimson-guard-hover_REF.gc | 183 +- .../enemy/hover/hover-enemy-battle_REF.gc | 6 +- .../common/enemy/hover/hover-enemy_REF.gc | 4 +- .../common/enemy/hover/hover-formation_REF.gc | 58 +- .../enemy/hover/hover-nav-control_REF.gc | 242 +- .../common/enemy/hover/hover-nav-edit_REF.gc | 27 +- .../levels/common/enemy/hover/wasp_REF.gc | 183 +- .../jak2/levels/common/enemy/metalmonk_REF.gc | 14 +- .../common/entities/fort-floor-spike_REF.gc | 122 +- .../levels/common/entities/gun-buoy_REF.gc | 25 +- .../levels/common/entities/spydroid_REF.gc | 154 +- .../jak2/levels/common/race/race-hud_REF.gc | 59 +- .../levels/common/race/race-manager_REF.gc | 105 +- .../levels/common/race/vehicle-racer_REF.gc | 76 +- .../jak2/levels/consite/consite-scenes_REF.gc | 47 +- .../jak2/levels/demo/demo-obs_REF.gc | 43 +- .../jak2/levels/dig/dig-digger_REF.gc | 111 +- .../reference/jak2/levels/dig/dig-obs_REF.gc | 6 +- .../reference/jak2/levels/dig/dig3-obs_REF.gc | 6 +- .../jak2/levels/drill/drill-obs2_REF.gc | 6 +- .../jak2/levels/drill/drill-obs_REF.gc | 77 +- .../jak2/levels/drill/drill-spool_REF.gc | 28 +- .../reference/jak2/levels/forest/fish_REF.gc | 542 ++- .../jak2/levels/forest/pegasus_REF.gc | 55 +- .../jak2/levels/forest/predator_REF.gc | 44 +- .../levels/fortress/dump/fordumpa-obs_REF.gc | 6 +- .../levels/fortress/dump/fordumpb-obs_REF.gc | 6 +- .../fortress/dump/fort-robotank-turret_REF.gc | 9 +- .../levels/fortress/dump/fort-robotank_REF.gc | 22 +- .../levels/fortress/prison/prison-obs_REF.gc | 122 +- .../fortress/rescue/forresca-obs_REF.gc | 6 +- .../fortress/rescue/forrescb-obs_REF.gc | 59 +- .../jak2/levels/gungame/gun-dummy_REF.gc | 2 +- .../jak2/levels/gungame/gungame-obs_REF.gc | 37 +- .../reference/jak2/levels/hiphog/whack_REF.gc | 71 +- .../jak2/levels/intro/intro-scenes_REF.gc | 47 +- .../jak2/levels/mountain/mountain-obs_REF.gc | 476 ++- .../levels/mountain/mountain-scenes_REF.gc | 72 +- .../jak2/levels/mountain/rhino_REF.gc | 100 +- .../levels/nest/boss/metalkor-extras_REF.gc | 175 +- .../levels/nest/boss/metalkor-setup_REF.gc | 123 +- .../levels/nest/boss/metalkor-states_REF.gc | 234 +- .../jak2/levels/nest/boss/nestb-scenes_REF.gc | 47 +- .../jak2/levels/nest/flying-spider_REF.gc | 6 +- .../reference/jak2/levels/nest/mammoth_REF.gc | 59 +- .../reference/jak2/levels/nest/mantis_REF.gc | 6 +- .../levels/palace/boss/squid-extras_REF.gc | 8 +- .../levels/palace/boss/squid-setup_REF.gc | 1043 +++-- .../levels/palace/boss/squid-states_REF.gc | 150 +- .../levels/palace/cable/palcab-obs_REF.gc | 25 +- .../jak2/levels/ruins/pillar-collapse_REF.gc | 42 +- .../jak2/levels/ruins/rapid-gunner_REF.gc | 6 +- .../jak2/levels/ruins/ruins-obs_REF.gc | 10 +- .../jak2/levels/sewer/hosehead-fake_REF.gc | 8 +- .../jak2/levels/sewer/hosehead_REF.gc | 137 +- .../jak2/levels/sewer/sewer-obs2_REF.gc | 41 +- .../jak2/levels/sewer/sewer-obs_REF.gc | 6 +- .../jak2/levels/sewer/sewer-scenes_REF.gc | 72 +- .../levels/stadium/skate/skatea-obs_REF.gc | 6 +- .../jak2/levels/stadium/stadium-obs_REF.gc | 306 +- .../jak2/levels/strip/chaincrate_REF.gc | 6 +- .../jak2/levels/strip/strip-obs_REF.gc | 146 +- .../jak2/levels/title/title-obs_REF.gc | 119 +- .../jak2/levels/tomb/tomb-obs_REF.gc | 100 +- .../jak2/levels/tomb/tomb-water_REF.gc | 121 +- .../jak2/levels/tomb/widow-baron_REF.gc | 46 +- .../jak2/levels/tomb/widow-extras_REF.gc | 34 +- .../jak2/levels/tomb/widow-more-extras_REF.gc | 7 +- .../jak2/levels/under/centipede_REF.gc | 19 +- .../jak2/levels/under/jellyfish_REF.gc | 11 +- .../jak2/levels/under/sig5-course_REF.gc | 39 +- .../jak2/levels/under/under-laser_REF.gc | 6 +- .../jak2/levels/under/under-obs_REF.gc | 16 +- .../levels/under/under-shoot-block_REF.gc | 103 +- .../jak2/levels/under/under-sig-obs_REF.gc | 24 +- .../jak2/levels/under/underb-master_REF.gc | 6 +- 256 files changed, 18768 insertions(+), 22290 deletions(-) diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 2e4ea26fa7..3155704bb2 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -1772,6 +1772,9 @@ ) ) +(defmacro square (x) + `(* ,x ,x) + ) (import "goal_src/jak2/engine/data/tpages.gc") (import "goal_src/jak2/engine/data/textures.gc") \ No newline at end of file diff --git a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc index 3e455f4947..c34dda49ad 100644 --- a/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/enemy_REF.gc @@ -1029,7 +1029,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy-behaviour-and-stats! ((this enemy) (arg0 enemy-info)) "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" - (local-vars (sv-16 res-tag)) (when (coin-flip? this) (let ((a0-2 (-> this node-list data 2))) (set! (-> a0-2 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) @@ -1096,8 +1095,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec a1-5)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-49 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-49)) @@ -1606,7 +1606,7 @@ (defmethod general-event-handler ((this enemy) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy @TODO - unsure if there is a pattern for the events and this should have a more specific name" - (local-vars (s5-5 rgbaf) (sv-432 process) (sv-448 event-message-block)) + (local-vars (s5-5 rgbaf)) (cond ((= arg2 'track) (and (nonzero? (-> this hit-points)) @@ -1669,14 +1669,12 @@ ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) (not (logtest? (-> this focus-status) (focus-status grabbed))) ) - (let* ((s1-0 this) - (s0-0 (method-of-object s1-0 set-incoming-attack-info)) - ) - (set! sv-432 arg0) - (set! sv-448 arg3) - (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3))) - (s0-0 s1-0 sv-432 sv-448 a3-3 (the-as attack-info s2-0)) - ) + (set-incoming-attack-info + this + arg0 + arg3 + (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3) + (the-as attack-info s2-0) ) (send-event (ppointer->process (-> this parent)) 'child-hit) 0 @@ -3067,11 +3065,7 @@ ) (((knocked-type knocked-type-5)) (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-26 1.0) - (f2-0 61440.0) - (f1-3 (fmin f1-2 (* f2-0 f2-0))) - (f2-3 61440.0) - (f30-5 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) + (f30-5 (* (- 1.0 (/ (fmin f1-2 (square 61440.0)) (square 61440.0))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-red-vxz-lo) (-> s5-0 knocked-red-vxz-hi) f30-5)) (set! (-> arg0 y) (lerp (-> s5-0 knocked-red-vy-lo) (-> s5-0 knocked-red-vy-hi) f30-5)) @@ -3079,11 +3073,7 @@ ) (((knocked-type knocked-type-6)) (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - (f0-34 1.0) - (f2-6 122880.0) - (f1-6 (fmin f1-5 (* f2-6 f2-6))) - (f2-9 122880.0) - (f30-7 (* (- f0-34 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) + (f30-7 (* (- 1.0 (/ (fmin f1-5 (square 122880.0)) (square 122880.0))) (rnd-float-range this 0.8 1.0))) ) (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-blue-vxz-lo) (-> s5-0 knocked-blue-vxz-hi) f30-7)) (cond @@ -3196,12 +3186,8 @@ (or (>= (-> arg0 on-surface-count) 3) (and (logtest? (-> gp-0 status) (collide-status on-ground)) (>= 16384.0 (-> gp-0 transv y))) (and (>= (-> arg0 move-count) 3) - (let ((f0-1 40.96)) - (>= (* f0-1 f0-1) (vector-vector-distance-squared (-> gp-0 trans-old) (-> gp-0 trans-old-old))) - ) - (let ((f0-4 40.96)) - (>= (* f0-4 f0-4) (vector-vector-distance-squared (-> gp-0 trans-old-old) (-> gp-0 trans-old-old-old))) - ) + (>= (square 40.96) (vector-vector-distance-squared (-> gp-0 trans-old) (-> gp-0 trans-old-old))) + (>= (square 40.96) (vector-vector-distance-squared (-> gp-0 trans-old-old) (-> gp-0 trans-old-old-old))) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc index 8df317472b..f603cce525 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-exploder_REF.gc @@ -362,15 +362,6 @@ ;; definition for method 28 of type joint-exploder ;; INFO: Used lq/sq (defmethod adjust-bbox-for-limits-along-axis ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) - (local-vars - (sv-16 int) - (sv-32 int) - (sv-48 joint-exploder-joint) - (sv-64 int) - (sv-80 joint-exploder-joint) - (sv-96 int) - (sv-112 joint-exploder-joint) - ) (let ((s5-0 (the-as joint-exploder-list #f))) (let ((v1-0 1)) (until (= v1-0 5) @@ -394,22 +385,23 @@ ) ) (set! (-> arg0 bbox-valid?) #f) - (let ((s2-0 (-> this joints))) - (set! sv-32 (-> arg0 head)) - (let ((s1-0 0) - (s0-0 0) - ) - (let ((v1-7 arg1)) - (cond - ((zero? v1-7) - (let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x))))) - (while (>= sv-32 0) - (set! sv-48 (-> s2-0 joint sv-32)) + (let ((s2-0 (-> this joints)) + (sv-32 (-> arg0 head)) + (s1-0 0) + (s0-0 0) + ) + (let ((v1-7 arg1)) + (cond + ((zero? v1-7) + (let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x))))) + (while (>= sv-32 0) + (let ((sv-48 (-> s2-0 joint sv-32))) (cond ((>= (-> sv-48 mat trans x) f30-0) - (set! sv-16 (remove-joint-from-list this arg0 sv-32)) - (add-joint-to-list this s5-0 sv-32) - (set! sv-32 sv-16) + (let ((sv-16 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this s5-0 sv-32) + (set! sv-32 sv-16) + ) (update-bbox-for-joint this s5-0 sv-48) (+! s0-0 1) ) @@ -422,15 +414,17 @@ ) ) ) - ((= v1-7 1) - (let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y))))) - (while (>= sv-32 0) - (set! sv-80 (-> s2-0 joint sv-32)) + ) + ((= v1-7 1) + (let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y))))) + (while (>= sv-32 0) + (let ((sv-80 (-> s2-0 joint sv-32))) (cond ((>= (-> sv-80 mat trans y) f30-1) - (set! sv-64 (remove-joint-from-list this arg0 sv-32)) - (add-joint-to-list this s5-0 sv-32) - (set! sv-32 sv-64) + (let ((sv-64 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this s5-0 sv-32) + (set! sv-32 sv-64) + ) (update-bbox-for-joint this s5-0 sv-80) (+! s0-0 1) ) @@ -443,15 +437,17 @@ ) ) ) - ((= v1-7 2) - (let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z))))) - (while (>= sv-32 0) - (set! sv-112 (-> s2-0 joint sv-32)) + ) + ((= v1-7 2) + (let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z))))) + (while (>= sv-32 0) + (let ((sv-112 (-> s2-0 joint sv-32))) (cond ((>= (-> sv-112 mat trans z) f30-2) - (set! sv-96 (remove-joint-from-list this arg0 sv-32)) - (add-joint-to-list this s5-0 sv-32) - (set! sv-32 sv-96) + (let ((sv-96 (remove-joint-from-list this arg0 sv-32))) + (add-joint-to-list this s5-0 sv-32) + (set! sv-32 sv-96) + ) (update-bbox-for-joint this s5-0 sv-112) (+! s0-0 1) ) @@ -464,19 +460,19 @@ ) ) ) - ) - ) - (cond - ((zero? s0-0) - (final-adjust this arg0 arg1) - ) - ((zero? s1-0) - (if (not (-> s5-0 probeless?)) - (final-adjust this s5-0 arg1) - ) ) ) ) + (cond + ((zero? s0-0) + (final-adjust this arg0 arg1) + ) + ((zero? s1-0) + (if (not (-> s5-0 probeless?)) + (final-adjust this s5-0 arg1) + ) + ) + ) ) s5-0 ) @@ -486,14 +482,13 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs int. (defmethod final-adjust ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) - (local-vars (sv-48 int) (sv-64 (inline-array joint-exploder-list)) (sv-80 joint-exploder-joint)) (set! (-> arg0 bbox-valid?) #f) (let ((s3-0 (-> this joints)) (s2-0 (-> arg0 head)) ) (while (>= s2-0 0) - (set! sv-80 (-> s3-0 joint s2-0)) - (let ((s1-0 (new 'stack-no-clear 'bounding-box)) + (let ((sv-80 (-> s3-0 joint s2-0)) + (s1-0 (new 'stack-no-clear 'bounding-box)) (s0-0 (-> arg0 bbox-valid?)) ) (set! (-> s1-0 min quad) (-> arg0 bbox min quad)) @@ -514,11 +509,13 @@ ) ) (when v1-8 - (set! sv-48 (remove-joint-from-list this arg0 s2-0)) - (set! sv-64 (-> this lists)) - (add-joint-to-list this (-> sv-64 0) s2-0) - (set! s2-0 sv-48) - (update-bbox-for-joint this (-> sv-64 0) sv-80) + (let ((sv-48 (remove-joint-from-list this arg0 s2-0)) + (sv-64 (-> this lists)) + ) + (add-joint-to-list this (-> sv-64 0) s2-0) + (set! s2-0 sv-48) + (update-bbox-for-joint this (-> sv-64 0) sv-80) + ) (set! (-> arg0 bbox-valid?) s0-0) (set! (-> arg0 bbox min quad) (-> s1-0 min quad)) (set! (-> arg0 bbox max quad) (-> s1-0 max quad)) diff --git a/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc index fb8683038e..230e0502ad 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint-mod_REF.gc @@ -9,22 +9,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defbehavior joint-mod-ik-callback process ((arg0 cspace) (arg1 transformq)) - (local-vars - (f0-24 float) - (sv-736 vector) - (sv-752 vector) - (sv-768 vector) - (sv-784 vector) - (sv-800 (function quaternion vector vector quaternion)) - (sv-816 quaternion) - (sv-832 vector) - (sv-848 vector) - (sv-864 vector) - (sv-880 vector) - (sv-896 vector) - (sv-912 quaternion) - (sv-928 quaternion) - ) + (local-vars (f0-24 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -88,9 +73,9 @@ (set! (-> a2-1 quad 2) a1-4) (set! (-> a2-1 trans quad) a3-3) ) - (set! sv-752 (new 'stack-no-clear 'vector)) - (set! sv-736 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (let ((sv-752 (new 'stack-no-clear 'vector)) + (sv-736 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s3-1 (new 'stack-no-clear 'vector)) ) @@ -136,142 +121,124 @@ ) ) ) - (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-736 sv-752))) - (set! sv-784 (new 'stack-no-clear 'vector)) + (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) sv-736 sv-752)) + (sv-784 (new 'stack-no-clear 'vector)) + ) (.lvf vf4 (&-> s0-0 quad)) (.lvf vf5 (&-> sv-736 quad)) (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-784 quad) vf6) - (set! sv-832 (new 'stack-no-clear 'vector)) - (let ((v1-49 sv-752)) - (.lvf vf4 (&-> s0-0 quad)) - (.lvf vf5 (&-> v1-49 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-832 quad) vf6) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (.lvf vf4 (&-> s1-0 quad)) - (.lvf vf5 (&-> sv-752 quad)) + (let ((sv-832 (new 'stack-no-clear 'vector))) + (let ((v1-49 sv-752)) + (.lvf vf4 (&-> s0-0 quad)) + (.lvf vf5 (&-> v1-49 quad)) + ) (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> s0-1 quad) vf6) - (set! sv-928 (new 'stack-no-clear 'quaternion)) - (let ((s1-1 (new 'stack-no-clear 'quaternion))) - (let ((f26-0 (vector-length s2-3)) - (f24-0 (vector-length sv-784)) - (f30-1 (vector-length s0-1)) + (.svf (&-> sv-832 quad) vf6) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (.lvf vf4 (&-> s1-0 quad)) + (.lvf vf5 (&-> sv-752 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> s0-1 quad) vf6) + (let ((sv-928 (new 'stack-no-clear 'quaternion)) + (s1-1 (new 'stack-no-clear 'quaternion)) ) - (set! sv-768 (new 'stack-no-clear 'vector)) - (let* ((f28-0 (vector-vector-angle-safe s2-3 sv-784)) - (f0-17 (fmax -1.0 (fmin 1.0 (/ (- (- (* f30-1 f30-1) (* f26-0 f26-0)) (* f24-0 f24-0)) (* 2.0 f24-0 f26-0))))) - (f26-1 (acos f0-17)) - ) - (cond - ((= f28-0 0.0) - (set! (-> sv-768 quad) (-> s4-1 vector (-> gp-0 elbow-rotation-axis) quad)) - (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) - (vector-negate! sv-768 sv-768) - (set! f26-1 (- f26-1)) - ) - (set! (-> s3-1 quad) (-> s4-1 vector (-> gp-0 elbow-pole-vector-axis) quad)) - (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) - (vector-negate! s3-1 s3-1) + (let ((f26-0 (vector-length s2-3)) + (f24-0 (vector-length sv-784)) + (f30-1 (vector-length s0-1)) + ) + (let* ((sv-768 (new 'stack-no-clear 'vector)) + (f28-0 (vector-vector-angle-safe s2-3 sv-784)) + (f0-17 (fmax -1.0 (fmin 1.0 (/ (- (- (square f30-1) (square f26-0)) (square f24-0)) (* 2.0 f24-0 f26-0))))) + (f26-1 (acos f0-17)) ) - ) - (else - (vector-cross! sv-768 s2-3 sv-784) - (vector-! - s3-1 - s2-3 - (vector-float*! (new 'stack-no-clear 'vector) sv-832 (/ (vector-dot sv-832 s2-3) (vector-dot sv-832 sv-832))) - ) - ) - ) - (vector-normalize! s3-1 1.0) - (vector-normalize! sv-768 1.0) - (let ((t9-14 quaternion-vector-angle!) - (a0-44 sv-928) - (a2-5 (- f26-1 f28-0)) - ) - (t9-14 a0-44 sv-768 a2-5) - ) - ) - (vector-orient-by-quat! sv-784 sv-784 sv-928) - (let ((v1-74 sv-832)) - (let ((a0-46 s2-3)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-46 quad)) - ) - (.lvf vf5 (&-> sv-784 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-74 quad) vf6) - ) - (set! sv-800 quaternion-from-two-vectors!) - (set! sv-816 s1-1) - (let ((t9-16 vector-normalize-copy!) - (a0-48 (new 'stack-no-clear 'vector)) - (a2-7 1.0) - ) - (set! sv-848 (t9-16 a0-48 sv-832 a2-7)) - ) - (let ((a2-9 (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0))) - (sv-800 sv-816 sv-848 a2-9) - ) - (vector-orient-by-quat! s2-3 s2-3 s1-1) - (set! sv-864 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-3 1.0)) - (let* ((v1-76 (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0)) - (f0-23 (-> sv-864 x)) - (f1-16 (-> sv-864 y)) - (f2-6 (-> sv-864 z)) - (f3-5 (-> v1-76 x)) - (f4-0 (-> v1-76 y)) - (f5-0 (-> v1-76 z)) + (cond + ((= f28-0 0.0) + (set! (-> sv-768 quad) (-> s4-1 vector (-> gp-0 elbow-rotation-axis) quad)) + (when (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-rot-neg)) + (vector-negate! sv-768 sv-768) + (set! f26-1 (- f26-1)) + ) + (set! (-> s3-1 quad) (-> s4-1 vector (-> gp-0 elbow-pole-vector-axis) quad)) + (if (logtest? (-> gp-0 flags) (joint-mod-ik-flags elbow-trans-neg)) + (vector-negate! s3-1 s3-1) + ) ) - (.mula.s f0-23 f3-5) - (.madda.s f1-16 f4-0) - (.madd.s f0-24 f2-6 f5-0) - ) - (let ((f0-26 (fabs f0-24))) - (if (< 0.98 f0-26) - (vector-orient-by-quat! s2-3 s3-1 s1-1) + (else + (vector-cross! sv-768 s2-3 sv-784) + (vector-! + s3-1 + s2-3 + (vector-float*! (new 'stack-no-clear 'vector) sv-832 (/ (vector-dot sv-832 s2-3) (vector-dot sv-832 sv-832))) + ) + ) ) + (vector-normalize! s3-1 1.0) + (vector-normalize! sv-768 1.0) + (quaternion-vector-angle! sv-928 sv-768 (- f26-1 f28-0)) + ) + (vector-orient-by-quat! sv-784 sv-784 sv-928) + (let ((v1-74 sv-832)) + (let ((a0-46 s2-3)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-46 quad)) + ) + (.lvf vf5 (&-> sv-784 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-74 quad) vf6) + ) + (quaternion-from-two-vectors! + s1-1 + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-832 1.0) + (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0) + ) + (vector-orient-by-quat! s2-3 s2-3 s1-1) + (let* ((sv-864 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-3 1.0)) + (v1-76 (vector-normalize-copy! (new 'stack-no-clear 'vector) s0-1 1.0)) + ) + (set! f0-24 (vector-dot sv-864 v1-76)) + ) + (let ((f0-26 (fabs f0-24))) + (if (< 0.98 f0-26) + (vector-orient-by-quat! s2-3 s3-1 s1-1) + ) + ) + (let ((sv-880 (new 'stack-no-clear 'vector)) + (sv-896 (new 'stack-no-clear 'vector)) + ) + (new 'stack-no-clear 'vector) + (square f30-1) + (let ((sv-912 (new 'stack-no-clear 'quaternion))) + (vector-flatten! sv-880 s2-3 s0-1) + (vector-flatten! sv-896 s3-1 s0-1) + (vector-normalize! sv-880 1.0) + (vector-normalize! sv-896 1.0) + (quaternion-from-two-vectors! sv-912 sv-880 sv-896) + (quaternion*! s1-1 sv-912 s1-1) + ) + ) + ) + (quaternion-pseudo-slerp! sv-928 *unity-quaternion* sv-928 (-> gp-0 blend)) + (quaternion-pseudo-slerp! s1-1 *unity-quaternion* s1-1 (-> gp-0 blend)) + (let ((a2-20 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-928)) + (gp-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-1 quad) (-> s4-1 trans quad)) + (matrix*! s4-1 s4-1 a2-20) + (set! (-> s4-1 trans quad) (-> gp-1 quad)) + ) + (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) s1-1)) + (a2-21 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) + (gp-2 (new 'stack-no-clear 'matrix)) + ) + (set! (-> gp-2 quad 0) (-> s5-0 trans quad)) + (matrix*! s4-1 s4-1 a2-21) + (matrix*! s5-0 s5-0 s3-2) + (set! (-> s5-0 trans quad) (-> gp-2 quad 0)) ) - (set! sv-880 (new 'stack-no-clear 'vector)) - (set! sv-896 (new 'stack-no-clear 'vector)) - (new 'stack-no-clear 'vector) - (* f30-1 f30-1) - ) - (set! sv-912 (new 'stack-no-clear 'quaternion)) - (vector-flatten! sv-880 s2-3 s0-1) - (vector-flatten! sv-896 s3-1 s0-1) - (vector-normalize! sv-880 1.0) - (vector-normalize! sv-896 1.0) - (quaternion-from-two-vectors! sv-912 sv-880 sv-896) - (let ((t9-28 quaternion*!) - (a0-63 s1-1) - (a2-17 s1-1) - ) - (t9-28 a0-63 sv-912 a2-17) - ) - (quaternion-pseudo-slerp! sv-928 *unity-quaternion* sv-928 (-> gp-0 blend)) - (quaternion-pseudo-slerp! s1-1 *unity-quaternion* s1-1 (-> gp-0 blend)) - (let ((a2-20 (quaternion->matrix (new 'stack-no-clear 'matrix) sv-928)) - (gp-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> gp-1 quad) (-> s4-1 trans quad)) - (matrix*! s4-1 s4-1 a2-20) - (set! (-> s4-1 trans quad) (-> gp-1 quad)) - ) - (let ((s3-2 (quaternion->matrix (new 'stack-no-clear 'matrix) s1-1)) - (a2-21 (matrix-4x4-inverse! (new 'stack-no-clear 'matrix) s5-0)) - (gp-2 (new 'stack-no-clear 'matrix)) - ) - (set! (-> gp-2 quad 0) (-> s5-0 trans quad)) - (matrix*! s4-1 s4-1 a2-21) - (matrix*! s5-0 s5-0 s3-2) - (set! (-> s5-0 trans quad) (-> gp-2 quad 0)) ) ) ) @@ -328,149 +295,145 @@ ;; definition for function real-joint-mod-gun-look-at-handler ;; WARN: Return type mismatch int vs none. (defbehavior real-joint-mod-gun-look-at-handler process ((arg0 cspace) (arg1 transformq)) - (local-vars - (sv-16 joint-mod) - (sv-64 vector) - (sv-96 quaternion) - (sv-160 vector) - (sv-164 vector) - (sv-168 vector) - (sv-172 symbol) - ) - (set! sv-16 (the-as joint-mod (-> arg0 param1))) - (vector*! (-> arg1 scale) (-> arg1 scale) (-> sv-16 scale)) - (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s5-0 (-> arg0 bone transform))) - (let ((s4-0 (matrix->quat s5-0 (new 'stack-no-clear 'quaternion)))) - (set! sv-64 (matrix->trans s5-0 (new 'stack-no-clear 'vector))) - (quaternion-rotate-y! s4-0 s4-0 (-> sv-16 twist z)) - (set! sv-96 (quaternion-copy! (new 'stack-no-clear 'quaternion) s4-0)) - (when (!= (-> sv-16 flex-blend) 0.0) - (set! sv-160 (vector-y-quaternion! (new 'stack-no-clear 'vector) sv-96)) - (set! sv-164 (vector-z-quaternion! (new 'stack-no-clear 'vector) sv-96)) - (set! sv-168 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> sv-16 target) sv-64) 1.0)) - (set! sv-172 (the-as symbol #f)) - (let* ((f30-0 (vector-y-angle sv-164)) - (a0-14 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 sv-160)) - (f0-2 (vector-y-angle a0-14)) - (f0-3 (deg-diff f30-0 f0-2)) - (f30-1 (* f0-3 (-> sv-16 blend))) - ) - (let ((f28-0 (fmax (fmin f30-1 (-> sv-16 twist-max y)) (- (-> sv-16 twist-max y))))) - (if (or (!= f30-1 f28-0) (= (-> sv-16 blend) 0.0)) - (logclear! (-> sv-16 track-mode) (track-mode lock-on)) - ) - (cond - ((or (< (-> sv-16 ignore-angle) (fabs f0-3)) - (< (-> sv-16 twist-max w) (vector-vector-distance (-> sv-16 target) sv-64)) - ) - (set! f30-1 0.0) - (set! f28-0 0.0) - (set! sv-172 #t) - ) - ((< 5461.3335 (fabs (deg-diff f30-1 f28-0))) - (set! (-> sv-16 blend) 0.0001) - ) - ((< 182.04445 (fabs (deg-diff f30-1 f28-0))) - (logclear! (-> sv-16 track-mode) (track-mode track-x)) - ) - ) - (if (or (and (logtest? (-> sv-16 track-mode) (track-mode track-y)) (= f30-1 f28-0)) - (< (-> sv-16 twist-max y) (fabs (-> sv-16 twist y))) - ) - (set! (-> sv-16 twist y) - (deg-seek (-> sv-16 twist y) f28-0 (* (fabs (deg-diff f28-0 (-> sv-16 twist y))) - (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) - 1.0 - (-> sv-16 twist-speed-y) - ) - (-> self clock time-adjust-ratio) - ) - ) - ) - ) + (let ((sv-16 (the-as joint-mod (-> arg0 param1)))) + (vector*! (-> arg1 scale) (-> arg1 scale) (-> sv-16 scale)) + (cspace<-parented-transformq-joint! arg0 arg1) + (let ((s5-0 (-> arg0 bone transform))) + (let ((s4-0 (matrix->quat s5-0 (new 'stack-no-clear 'quaternion))) + (sv-64 (matrix->trans s5-0 (new 'stack-no-clear 'vector))) ) - (if (and (< (fabs (deg-diff f30-1 (-> sv-16 twist y))) 728.1778) (and (not sv-172) (!= (-> sv-16 blend) 0.0))) - (logior! (-> sv-16 track-mode) (track-mode lock-on)) - ) - ) - (quaternion-rotate-local-y! sv-96 sv-96 (-> sv-16 twist y)) - (let* ((s3-1 (vector-x-quaternion! (new 'stack-no-clear 'vector) sv-96)) - (f30-2 (vector-x-angle sv-164)) - (s3-2 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 s3-1)) - (f0-24 (vector-x-angle s3-2)) - (f30-3 (fmax - (fmin (* (- (deg-diff f30-2 f0-24)) (-> sv-16 blend)) (-> sv-16 twist-max x)) - (- (-> sv-16 twist-max x)) - ) + (quaternion-rotate-y! s4-0 s4-0 (-> sv-16 twist z)) + (let ((sv-96 (quaternion-copy! (new 'stack-no-clear 'quaternion) s4-0))) + (when (!= (-> sv-16 flex-blend) 0.0) + (let ((sv-160 (vector-y-quaternion! (new 'stack-no-clear 'vector) sv-96)) + (sv-164 (vector-z-quaternion! (new 'stack-no-clear 'vector) sv-96)) + (sv-168 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> sv-16 target) sv-64) 1.0)) + ) + (let* ((sv-172 (the-as symbol #f)) + (f30-0 (vector-y-angle sv-164)) + (a0-14 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 sv-160)) + (f0-2 (vector-y-angle a0-14)) + (f0-3 (deg-diff f30-0 f0-2)) + (f30-1 (* f0-3 (-> sv-16 blend))) + ) + (let ((f28-0 (fmax (fmin f30-1 (-> sv-16 twist-max y)) (- (-> sv-16 twist-max y))))) + (if (or (!= f30-1 f28-0) (= (-> sv-16 blend) 0.0)) + (logclear! (-> sv-16 track-mode) (track-mode lock-on)) + ) + (cond + ((or (< (-> sv-16 ignore-angle) (fabs f0-3)) + (< (-> sv-16 twist-max w) (vector-vector-distance (-> sv-16 target) sv-64)) + ) + (set! f30-1 0.0) + (set! f28-0 0.0) + (set! sv-172 #t) + ) + ((< 5461.3335 (fabs (deg-diff f30-1 f28-0))) + (set! (-> sv-16 blend) 0.0001) + ) + ((< 182.04445 (fabs (deg-diff f30-1 f28-0))) + (logclear! (-> sv-16 track-mode) (track-mode track-x)) + ) + ) + (if (or (and (logtest? (-> sv-16 track-mode) (track-mode track-y)) (= f30-1 f28-0)) + (< (-> sv-16 twist-max y) (fabs (-> sv-16 twist y))) + ) + (set! (-> sv-16 twist y) + (deg-seek (-> sv-16 twist y) f28-0 (* (fabs (deg-diff f28-0 (-> sv-16 twist y))) + (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) + 1.0 + (-> sv-16 twist-speed-y) + ) + (-> self clock time-adjust-ratio) + ) + ) + ) ) - ) - (if (or (< (vector-dot s3-2 sv-164) 0.1) - (< (-> sv-16 twist-max z) (vector-vector-distance (-> sv-16 target) sv-64)) ) - (set! f30-3 0.0) - ) - (if (or (logtest? (-> sv-16 track-mode) (track-mode track-x)) - (< (-> sv-16 twist-max x) (fabs (-> sv-16 twist x))) - ) - (set! (-> sv-16 twist x) - (deg-seek (-> sv-16 twist x) f30-3 (* (fabs (deg-diff f30-3 (-> sv-16 twist x))) - (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) - 1.0 - (-> sv-16 twist-speed-x) - ) - (-> self clock time-adjust-ratio) - ) + (if (and (< (fabs (deg-diff f30-1 (-> sv-16 twist y))) 728.1778) (and (not sv-172) (!= (-> sv-16 blend) 0.0))) + (logior! (-> sv-16 track-mode) (track-mode lock-on)) + ) + ) + (quaternion-rotate-local-y! sv-96 sv-96 (-> sv-16 twist y)) + (let* ((s3-1 (vector-x-quaternion! (new 'stack-no-clear 'vector) sv-96)) + (f30-2 (vector-x-angle sv-164)) + (s3-2 (vector-flatten! (new 'stack-no-clear 'vector) sv-168 s3-1)) + (f0-24 (vector-x-angle s3-2)) + (f30-3 (fmax + (fmin (* (- (deg-diff f30-2 f0-24)) (-> sv-16 blend)) (-> sv-16 twist-max x)) + (- (-> sv-16 twist-max x)) ) + ) + ) + (if (or (< (vector-dot s3-2 sv-164) 0.1) + (< (-> sv-16 twist-max z) (vector-vector-distance (-> sv-16 target) sv-64)) + ) + (set! f30-3 0.0) ) + (if (or (logtest? (-> sv-16 track-mode) (track-mode track-x)) + (< (-> sv-16 twist-max x) (fabs (-> sv-16 twist x))) + ) + (set! (-> sv-16 twist x) + (deg-seek (-> sv-16 twist x) f30-3 (* (fabs (deg-diff f30-3 (-> sv-16 twist x))) + (if (logtest? (-> sv-16 track-mode) (track-mode lock-on)) + 1.0 + (-> sv-16 twist-speed-x) + ) + (-> self clock time-adjust-ratio) + ) + ) + ) + ) + ) + ) + (quaternion-rotate-x! sv-96 sv-96 (-> sv-16 twist x)) + (quaternion-normalize! (quaternion*! sv-96 sv-96 (-> sv-16 quat))) + ) + (let ((a1-27 (quaternion-slerp! (new 'stack-no-clear 'quaternion) s4-0 sv-96 (-> sv-16 flex-blend)))) + (matrix<-quat s5-0 a1-27) + ) + ) + ) + (let ((f30-4 (-> sv-16 trans x)) + (s4-1 (-> s5-0 vector 1)) + (v1-97 (vector<-matrix! (new 'stack-no-clear 'vector) s5-0)) + ) + (let ((f0-43 (- f30-4 (-> v1-97 y)))) + (if (< 614.4 (fabs f0-43)) + (+! (-> sv-16 trans z) (* 8.0 f0-43)) ) ) - (quaternion-rotate-x! sv-96 sv-96 (-> sv-16 twist x)) - (quaternion-normalize! (quaternion*! sv-96 sv-96 (-> sv-16 quat))) - ) - (let ((a1-27 (quaternion-slerp! (new 'stack-no-clear 'quaternion) s4-0 sv-96 (-> sv-16 flex-blend)))) - (matrix<-quat s5-0 a1-27) - ) - ) - (let ((f30-4 (-> sv-16 trans x)) - (s4-1 (-> s5-0 vector 1)) - (v1-97 (vector<-matrix! (new 'stack-no-clear 'vector) s5-0)) - ) - (let ((f0-43 (- f30-4 (-> v1-97 y)))) - (if (< 614.4 (fabs f0-43)) - (+! (-> sv-16 trans z) (* 8.0 f0-43)) + (+! (-> sv-16 trans z) (* -260.0 (seconds-per-frame) (-> sv-16 trans y))) + (let ((f0-48 (-> sv-16 trans y))) + (+! (-> sv-16 trans y) (* (-> sv-16 trans z) (seconds-per-frame))) + (set! (-> sv-16 trans y) (* 0.95 (-> sv-16 trans y))) + (when (< (* f0-48 (-> sv-16 trans y)) 0.0) + (set! (-> sv-16 trans y) 0.0) + (set! (-> sv-16 trans z) 0.0) ) - ) - (+! (-> sv-16 trans z) (* -260.0 (seconds-per-frame) (-> sv-16 trans y))) - (let ((f0-48 (-> sv-16 trans y))) - (+! (-> sv-16 trans y) (* (-> sv-16 trans z) (seconds-per-frame))) - (set! (-> sv-16 trans y) (* 0.95 (-> sv-16 trans y))) - (when (< (* f0-48 (-> sv-16 trans y)) 0.0) - (set! (-> sv-16 trans y) 0.0) - (set! (-> sv-16 trans z) 0.0) + ) + (cond + ((< 409.6 (-> sv-16 trans y)) + (set! (-> sv-16 trans y) 409.6) + (set! (-> sv-16 trans z) 0.0) + ) + ((< (-> sv-16 trans y) -409.6) + (set! (-> sv-16 trans y) -409.6) + (set! (-> sv-16 trans z) 0.0) + ) + ) + (set! (-> sv-16 trans x) (-> v1-97 y)) + (let ((f0-60 (* (-> sv-16 trans y) (-> sv-16 flex-blend)))) + (if (!= f0-60 0.0) + (vector+float*! (-> s5-0 trans) v1-97 s4-1 f0-60) + ) ) ) - (cond - ((< 409.6 (-> sv-16 trans y)) - (set! (-> sv-16 trans y) 409.6) - (set! (-> sv-16 trans z) 0.0) - ) - ((< (-> sv-16 trans y) -409.6) - (set! (-> sv-16 trans y) -409.6) - (set! (-> sv-16 trans z) 0.0) - ) - ) - (set! (-> sv-16 trans x) (-> v1-97 y)) - (let ((f0-60 (* (-> sv-16 trans y) (-> sv-16 flex-blend)))) - (if (!= f0-60 0.0) - (vector+float*! (-> s5-0 trans) v1-97 s4-1 f0-60) - ) - ) ) + (if (-> sv-16 parented-scale?) + (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) + ) ) - (if (-> sv-16 parented-scale?) - (set-vector! (-> arg0 bone scale) 1.0 1.0 1.0 1.0) - ) 0 (none) ) @@ -791,20 +754,19 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defbehavior joint-mod-look-at-handler process ((arg0 cspace) (arg1 transformq)) - (local-vars (f0-1 float) (sv-80 symbol) (sv-144 vector) (sv-160 vector) (sv-176 float)) + (local-vars (f0-1 float)) (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s1-0 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) - ) - (s2-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) - (s3-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 nose)) 1.0)) - (s0-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 ear)) 1.0)) - ) - (set! sv-144 (vector-normalize! + (let* ((s1-0 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> gp-0 process node-list data 0 bone transform vector 1) + 1.0 + ) + ) + (s2-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + (s3-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 nose)) 1.0)) + (s0-0 (vector-normalize! (-> arg0 bone transform vector (-> gp-0 ear)) 1.0)) + (sv-144 (vector-normalize! (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 bone transform vector (-> gp-0 up)) @@ -812,21 +774,13 @@ ) 1.0 ) + ) + (s2-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) s2-0) 1.0)) + ) + (let ((sv-160 (-> gp-0 process node-list data (-> gp-0 base-joint) bone transform vector (-> gp-0 base-nose))) + (sv-80 (the-as symbol #f)) ) - (let ((s2-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) s2-0) 1.0))) - (set! sv-160 (-> gp-0 process node-list data (-> gp-0 base-joint) bone transform vector (-> gp-0 base-nose))) - (set! sv-80 (the-as symbol #f)) - (let ((f0-0 (-> sv-144 x)) - (f1-0 (-> sv-144 y)) - (f2-0 (-> sv-144 z)) - (f3-0 (-> s0-0 x)) - (f4-0 (-> s0-0 y)) - (f5-0 (-> s0-0 z)) - ) - (.mula.s f0-0 f3-0) - (.madda.s f1-0 f4-0) - (.madd.s f0-1 f2-0 f5-0) - ) + (set! f0-1 (vector-dot sv-144 s0-0)) (if (< f0-1 0.0) (set! sv-80 #t) ) @@ -856,15 +810,13 @@ (mode-set! gp-0 (joint-mod-mode rotate2)) ) ) - (let ((s1-2 deg-seek) - (s0-2 (-> gp-0 twist y)) - ) - (set! sv-176 f30-2) - (let ((a2-3 (* (fabs (deg-diff f30-2 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio))) + (set! (-> gp-0 twist y) + (deg-seek + (-> gp-0 twist y) + f30-2 + (* (fabs (deg-diff f30-2 (-> gp-0 twist y))) (-> gp-0 twist-speed-y) (-> self clock time-adjust-ratio)) ) - (set! (-> gp-0 twist y) (s1-2 s0-2 sv-176 a2-3)) - ) - ) + ) ) ) 0.0 @@ -887,34 +839,34 @@ ) ) ) - (let* ((s1-3 - (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) - 1.0 - ) - ) - (f30-3 (vector-x-angle s3-0)) - (s2-2 (vector-flatten! (new-stack-vector0) s2-1 s1-3)) - (f0-26 (vector-x-angle s2-2)) - (f0-32 - (fmax - (fmin (* (- (deg-diff f30-3 f0-26)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) - ) + ) + (let* ((s1-3 + (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0 ) ) - (if (< (vector-dot s2-2 s3-0) 0.1) - (set! f0-32 0.0) - ) - (set! (-> gp-0 twist x) - (deg-seek - (-> gp-0 twist x) - f0-32 - (* (fabs (deg-diff f0-32 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) - ) + (f30-3 (vector-x-angle s3-0)) + (s2-2 (vector-flatten! (new-stack-vector0) s2-1 s1-3)) + (f0-26 (vector-x-angle s2-2)) + (f0-32 + (fmax + (fmin (* (- (deg-diff f30-3 f0-26)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) + ) + ) + (if (< (vector-dot s2-2 s3-0) 0.1) + (set! f0-32 0.0) + ) + (set! (-> gp-0 twist x) + (deg-seek + (-> gp-0 twist x) + f0-32 + (* (fabs (deg-diff f0-32 (-> gp-0 twist x))) (-> gp-0 twist-speed-x) (-> self clock time-adjust-ratio)) ) - ) + ) ) ) (let ((v1-60 (-> gp-0 ear))) @@ -974,13 +926,9 @@ (matrix-transpose! s4-0 s4-0) (set-vector! (-> s4-0 trans) 0.0 0.0 0.0 1.0) (vector-matrix*! s2-0 s1-0 s4-0) - (let* ((t9-8 asin) - (f0-8 (-> s2-0 x)) - (f0-10 (* f0-8 f0-8)) - (f1-0 (-> s2-0 y)) - (f28-0 (t9-8 (sqrtf (+ f0-10 (* f1-0 f1-0))))) - (f30-0 (atan (-> s2-0 y) (-> s2-0 x))) - ) + (let ((f28-0 (asin (sqrtf (+ (square (-> s2-0 x)) (square (-> s2-0 y)))))) + (f30-0 (atan (-> s2-0 y) (-> s2-0 x))) + ) (if (< (-> s2-0 z) 0.0) (set! f28-0 (- 32768.0 f28-0)) ) @@ -1011,11 +959,9 @@ ) ) ) - (let* ((f0-38 (sin f30-0)) - (f26-0 (* f0-38 f0-38)) - (f0-40 (cos f30-0)) - (f0-42 (* f0-40 f0-40)) - ) + (let ((f26-0 (square (sin f30-0))) + (f0-42 (square (cos f30-0))) + ) 32768.0 (let ((f0-44 (cond ((< 16384.0 f30-0) @@ -1040,13 +986,7 @@ ) (let ((f28-1 (cos f28-0))) (set-vector! s2-0 (cos f30-0) (sin f30-0) 0.0 1.0) - (let ((t9-15 vector-normalize!) - (a0-19 s2-0) - (f0-52 1.0) - (f1-22 f28-1) - ) - (t9-15 a0-19 (sqrtf (- f0-52 (* f1-22 f1-22)))) - ) + (vector-normalize! s2-0 (sqrtf (- 1.0 (square f28-1)))) (set! (-> s2-0 z) f28-1) ) ) @@ -1089,75 +1029,76 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior joint-mod-world-look-at-handler process ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector)) (let ((gp-0 (the-as joint-mod (-> arg0 param1)))) (let ((s5-0 (-> arg0 bone transform))) (cspace<-parented-transformq-joint! arg0 arg1) - (set! sv-48 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (-> gp-0 process node-list data 0 bone transform vector 1) - 1.0 - ) + (let ((sv-48 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (-> gp-0 process node-list data 0 bone transform vector 1) + 1.0 + ) + ) + (sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0)) + (sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 trans)) 1.0)) ) - (set! sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0)) - (set! sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 trans)) 1.0)) - (let* ((f30-0 (vector-y-angle sv-52)) - (a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) - (f0-0 (vector-y-angle a0-7)) - (f0-1 (deg-diff f30-0 f0-0)) - ) - (if (< (-> gp-0 ignore-angle) (fabs f0-1)) - (set! f0-1 0.0) - ) - (let ((f0-5 - (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) - ) + (let* ((f30-0 (vector-y-angle sv-52)) + (a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48)) + (f0-0 (vector-y-angle a0-7)) + (f0-1 (deg-diff f30-0 f0-0)) + ) + (if (< (-> gp-0 ignore-angle) (fabs f0-1)) + (set! f0-1 0.0) ) - (set! (-> gp-0 twist y) (deg-seek - (-> gp-0 twist y) - f0-5 - (* (fmax 1.0 (* (fabs (deg-diff f0-5 (-> gp-0 twist y))) (-> gp-0 twist-speed-y))) + (let ((f0-5 + (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y))) + ) + ) + (set! (-> gp-0 twist y) (deg-seek + (-> gp-0 twist y) + f0-5 + (* (fmax 1.0 (* (fabs (deg-diff f0-5 (-> gp-0 twist y))) (-> gp-0 twist-speed-y))) + (-> self clock time-adjust-ratio) + ) + ) + ) + ) + ) + (when (!= (-> gp-0 twist y) 0.0) + (let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y))) + (s4-2 (-> s5-0 trans quad)) + ) + (matrix*! s5-0 s5-0 a2-3) + (set! (-> s5-0 trans quad) s4-2) + ) + ) + (let* ((s4-3 (vector-normalize-copy! + (new 'stack-no-clear 'vector) + (the-as vector (-> gp-0 process node-list data 0 bone transform)) + 1.0 + ) + ) + (f30-2 (vector-x-angle sv-52)) + (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) + (f0-15 (vector-x-angle s4-4)) + (f0-21 (fmax + (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) + (- (-> gp-0 twist-max x)) + ) + ) + ) + (if (< (vector-dot s4-4 sv-52) 0.1) + (set! f0-21 0.0) + ) + (set! (-> gp-0 twist x) (deg-seek + (-> gp-0 twist x) + f0-21 + (* (fmax 1.0 (* (fabs (deg-diff f0-21 (-> gp-0 twist x))) (-> gp-0 twist-speed-x))) (-> self clock time-adjust-ratio) ) ) ) ) ) - (when (!= (-> gp-0 twist y) 0.0) - (let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y))) - (s4-2 (-> s5-0 trans quad)) - ) - (matrix*! s5-0 s5-0 a2-3) - (set! (-> s5-0 trans quad) s4-2) - ) - ) - (let* ((s4-3 (vector-normalize-copy! - (new 'stack-no-clear 'vector) - (the-as vector (-> gp-0 process node-list data 0 bone transform)) - 1.0 - ) - ) - (f30-2 (vector-x-angle sv-52)) - (s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3)) - (f0-15 (vector-x-angle s4-4)) - (f0-21 (fmax - (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x)) - (- (-> gp-0 twist-max x)) - ) - ) - ) - (if (< (vector-dot s4-4 sv-52) 0.1) - (set! f0-21 0.0) - ) - (set! (-> gp-0 twist x) (deg-seek - (-> gp-0 twist x) - f0-21 - (* (fmax 1.0 (* (fabs (deg-diff f0-21 (-> gp-0 twist x))) (-> gp-0 twist-speed-x))) - (-> self clock time-adjust-ratio) - ) - ) - ) - ) (when (!= (-> gp-0 twist x) 0.0) (let* ((v1-25 (-> gp-0 ear)) (a1-17 ((cond diff --git a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc index 72e0eb5f26..a843436cb6 100644 --- a/test/decompiler/reference/jak2/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/joint_REF.gc @@ -733,84 +733,76 @@ (seed int) (prefix string) ) - (local-vars - (sv-16 int) - (sv-24 symbol) - (sv-32 int) - (sv-40 int) - (sv-48 joint-control-channel) - (sv-52 basic) - (sv-56 object) - (sv-60 basic) - (sv-64 art-joint-anim) - (sv-80 string) - ) - (set! sv-16 (+ (length (-> parent-art-group name)) 1)) - (set! sv-24 #t) - (set! sv-32 seed) - (set! sv-40 2) - (while (and (< sv-40 (-> dst-art-group length)) - (or (not (-> dst-art-group data sv-40)) (!= (-> dst-art-group data sv-40 type) art-joint-anim)) - ) - (set! sv-40 (+ sv-40 1)) - ) - (dotimes (s2-1 (the-as int (+ (-> jc active-channels) (-> jc float-channels)))) - (set! sv-48 (-> jc channel s2-1)) - (set! sv-52 (the-as basic #f)) - (when (-> sv-48 frame-group) - (format (clear *temp-string*) "~S~G" prefix (&+ (-> sv-48 frame-group name data) sv-16)) - (when (not (null? remap-list)) - (set! sv-56 (nassoc *temp-string* remap-list)) - (when sv-56 - (let* ((s1-1 sv-32) - (a0-8 sv-56) - (v1-36 (mod s1-1 (+ ((method-of-type (rtype-of a0-8) length) a0-8) -1))) - ) - (set! sv-60 (the-as basic (ref sv-56 (+ v1-36 1)))) - ) - (cond - ((= (-> sv-60 type) string) - (format (clear *temp-string*) "~S" sv-60) - ) - ((= (-> sv-60 type) function) - (set! sv-52 sv-60) - (let ((s1-3 format) - (s0-0 (clear *temp-string*)) - ) - (set! sv-80 "~S") - (let ((a2-4 ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 0))) - (s1-3 s0-0 sv-80 a2-4) - ) - ) - ) - ) - ) + (let ((sv-16 (+ (length (-> parent-art-group name)) 1)) + (sv-24 #t) ) - (set! sv-64 (get-art-by-name dst-art-group *temp-string* art-joint-anim)) - (cond - (sv-64 - (let* ((v1-46 (-> sv-48 frame-group)) - (f0-2 (+ (* (-> sv-48 frame-num) (-> v1-46 artist-step)) (-> v1-46 artist-base))) - ) - (set! (-> sv-48 frame-group) sv-64) - (set! (-> sv-48 frame-num) (/ (- f0-2 (-> sv-64 artist-base)) (-> sv-64 artist-step))) - ) - (set! (-> sv-48 frame-num) - (fmax 0.0 (fmin (-> sv-48 frame-num) (the float (+ (-> sv-64 frames num-frames) -1)))) - ) - (if sv-52 - ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 1) - ) + (let ((sv-32 seed) + (sv-40 2) ) - (else - (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> dst-art-group data sv-40))) - (set! (-> sv-48 frame-num) 0.0) - (set! sv-24 (the-as symbol #f)) + (while (and (< sv-40 (-> dst-art-group length)) + (or (not (-> dst-art-group data sv-40)) (!= (-> dst-art-group data sv-40 type) art-joint-anim)) + ) + (+! sv-40 1) + ) + (dotimes (s2-1 (the-as int (+ (-> jc active-channels) (-> jc float-channels)))) + (let ((sv-48 (-> jc channel s2-1)) + (sv-52 (the-as basic #f)) + ) + (when (-> sv-48 frame-group) + (format (clear *temp-string*) "~S~G" prefix (&+ (-> sv-48 frame-group name data) sv-16)) + (when (not (null? remap-list)) + (let ((sv-56 (nassoc *temp-string* remap-list))) + (when sv-56 + (let* ((a0-8 sv-56) + (v1-36 (mod sv-32 (+ ((method-of-type (rtype-of a0-8) length) a0-8) -1))) + (sv-60 (the-as basic (ref sv-56 (+ v1-36 1)))) + ) + (cond + ((= (-> sv-60 type) string) + (format (clear *temp-string*) "~S" sv-60) + ) + ((= (-> sv-60 type) function) + (set! sv-52 sv-60) + (format + (clear *temp-string*) + "~S" + ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 0) + ) + ) + ) + ) + ) + ) + ) + (let ((sv-64 (get-art-by-name dst-art-group *temp-string* art-joint-anim))) + (cond + (sv-64 + (let* ((v1-46 (-> sv-48 frame-group)) + (f0-2 (+ (* (-> sv-48 frame-num) (-> v1-46 artist-step)) (-> v1-46 artist-base))) + ) + (set! (-> sv-48 frame-group) sv-64) + (set! (-> sv-48 frame-num) (/ (- f0-2 (-> sv-64 artist-base)) (-> sv-64 artist-step))) + ) + (set! (-> sv-48 frame-num) + (fmax 0.0 (fmin (-> sv-48 frame-num) (the float (+ (-> sv-64 frames num-frames) -1)))) + ) + (if sv-52 + ((the-as (function joint-control joint-control-channel int object) sv-52) jc sv-48 1) + ) + ) + (else + (set! (-> sv-48 frame-group) (the-as art-joint-anim (-> dst-art-group data sv-40))) + (set! (-> sv-48 frame-num) 0.0) + (set! sv-24 (the-as symbol #f)) + ) + ) + ) + ) ) ) ) + sv-24 ) - sv-24 ) ;; definition for function flatten-joint-control-to-spr diff --git a/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc index 2438d4f783..50b05ae466 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc @@ -4,9 +4,8 @@ ;; definition for function cam-helper-temp ;; INFO: Used lq/sq (defbehavior cam-helper-temp camera-combiner ((arg0 (pointer camera-slave)) (arg1 (pointer camera-slave)) (arg2 float)) - (local-vars (sv-144 cam-rotation-tracker)) - (set! sv-144 (-> arg0 0 tracking)) - (let ((s1-0 (-> arg0 0 trans)) + (let ((sv-144 (-> arg0 0 tracking)) + (s1-0 (-> arg0 0 trans)) (gp-0 (-> arg1 0 tracking)) (s0-0 (-> arg1 0 trans)) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc index 48b2a55f8b..c438d481b7 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-layout_REF.gc @@ -328,35 +328,21 @@ ;; WARN: Stack slot offset 164 signed mismatch ;; WARN: new jak 2 until loop case, check carefully (defbehavior cam-layout-entity-volume-info-create cam-layout ((arg0 entity-camera) (arg1 symbol)) - (local-vars - (sv-16 res-tag) - (sv-160 vector) - (sv-164 number) - (sv-168 int) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 vector) - (sv-256 int) - (sv-272 int) - (sv-288 int) - ) (let ((s4-0 0)) (until #f - (set! sv-16 (new 'static 'res-tag)) - (let ((s3-0 (the-as (inline-array vector) ((method-of-type res-lump get-property-data) - arg0 - arg1 - 'exact - (the float s4-0) - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (s3-0 (the-as (inline-array vector) ((method-of-type res-lump get-property-data) + arg0 + arg1 + 'exact + (the float s4-0) + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (cond (s3-0 (when (>= *volume-descriptor-current* 100) @@ -372,121 +358,137 @@ (set! *volume-descriptor-current* (+ *volume-descriptor-current* 1)) (+! (-> self num-volumes) 1) (dotimes (s1-0 (the-as int (-> sv-16 elt-count))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! (-> sv-192 quad) (the-as uint128 0)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! (-> sv-208 quad) (the-as uint128 0)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! (-> sv-224 quad) (the-as uint128 0)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! (-> sv-240 quad) (the-as uint128 0)) - 0.0 - 0.0 - 0.0 - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((s0-0 (new-stack-vector0))) - (set! sv-256 0) - (set! sv-272 0) - (while (< sv-272 (the-as int (-> sv-16 elt-count))) - (when (!= s1-0 sv-272) - (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) - (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) - (vector-normalize! sv-208 1.0) - (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) - (vector-normalize! sv-224 1.0) - (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) - (when (!= f0-6 409600000.0) - (vector+float*! sv-240 sv-192 sv-224 f0-6) - (set! sv-160 (new-stack-vector0)) - (set! sv-164 0.0) - (set! sv-168 0) - (set! sv-176 (new-stack-vector0)) - (set! (-> sv-160 quad) (-> sv-240 quad)) - (set! sv-288 0) - (while (< sv-288 (the-as int (-> sv-16 elt-count))) - (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) - (let ((f0-8 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) - (cond - ((= f0-8 409600000.0) - ) - ((zero? sv-168) - (vector+float*! sv-160 sv-160 sv-208 f0-8) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-164 8192000.0) - (set! sv-168 1) - ) - ((begin (vector-float*! sv-240 sv-208 f0-8) (>= (vector-dot sv-240 sv-176) 0.0)) - ) - ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) - (when (< (fabs f0-8) (fabs (the-as float sv-164))) - (set! sv-164 f0-8) - (set! sv-168 (+ sv-168 1)) - ) - ) - (else - (vector+float*! sv-160 sv-160 sv-208 f0-8) - (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) - (set! sv-168 (+ sv-168 1)) - (if (< (fabs f0-8) (fabs (the-as float sv-164))) - (set! sv-164 (- (the-as float sv-164) f0-8)) - (set! sv-164 0.0) + (let ((sv-192 (new 'stack-no-clear 'vector))) + (set! (-> sv-192 quad) (the-as uint128 0)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (set! (-> sv-208 quad) (the-as uint128 0)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (set! (-> sv-224 quad) (the-as uint128 0)) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (set! (-> sv-240 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s0-0 (new-stack-vector0)) + (sv-256 0) + ) + (let ((sv-272 0)) + (while (< sv-272 (the-as int (-> sv-16 elt-count))) + (when (!= s1-0 sv-272) + (vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w)) + (vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0)) + (vector-normalize! sv-208 1.0) + (vector-cross! sv-224 sv-208 (-> s3-0 sv-272)) + (vector-normalize! sv-224 1.0) + (let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224))) + (when (!= f0-6 409600000.0) + (vector+float*! sv-240 sv-192 sv-224 f0-6) + (let ((sv-160 (new-stack-vector0)) + (sv-164 0.0) + (sv-168 0) + ) + (let ((sv-176 (new-stack-vector0))) + (set! (-> sv-160 quad) (-> sv-240 quad)) + (let ((sv-288 0)) + (while (< sv-288 (the-as int (-> sv-16 elt-count))) + (when (and (!= sv-288 s1-0) (!= sv-288 sv-272)) + (let ((f0-8 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208))) + (cond + ((= f0-8 409600000.0) + ) + ((zero? sv-168) + (vector+float*! sv-160 sv-160 sv-208 f0-8) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (set! sv-164 8192000.0) + (set! sv-168 1) + ) + ((begin (vector-float*! sv-240 sv-208 f0-8) (>= (vector-dot sv-240 sv-176) 0.0)) + ) + ((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) + (when (< (fabs f0-8) (fabs (the-as float sv-164))) + (set! sv-164 f0-8) + (+! sv-168 1) + ) + ) + (else + (vector+float*! sv-160 sv-160 sv-208 f0-8) + (set! (-> sv-176 quad) (-> s3-0 sv-288 quad)) + (+! sv-168 1) + (set! sv-164 (cond + ((< (fabs f0-8) (fabs (the-as float sv-164))) + (set! sv-164 (- (the-as float sv-164) f0-8)) + sv-164 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-288 1) + ) + ) ) + (cond + ((zero? sv-168) + ) + ((= (the-as float sv-164) 0.0) + ) + (else + (dotimes (v1-91 (the-as int (-> sv-16 elt-count))) + (when (and (!= v1-91 s1-0) (!= v1-91 sv-272)) + (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-91)) (-> s3-0 v1-91 w))) + (goto cfg-47) + ) + ) + ) + (vector+float*! sv-240 sv-160 sv-208 (the-as float sv-164)) + (cond + ((>= *volume-point-current* 999) + (format 0 "ERROR : camera editing out of volume points~%") + ) + (else + (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) + (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) + (set! *volume-point-current* (+ *volume-point-current* 2)) + (+! (-> s2-0 point-count) 2) + ) + ) + (vector+! s0-0 s0-0 sv-160) + (vector+! s0-0 s0-0 sv-240) + (+! sv-256 2) + sv-256 + ) + ) + ) ) ) ) + (label cfg-47) + (+! sv-272 1) ) - (set! sv-288 (+ sv-288 1)) ) - (cond - ((zero? sv-168) - ) - ((= (the-as float sv-164) 0.0) - ) - (else - (dotimes (v1-91 (the-as int (-> sv-16 elt-count))) - (when (and (!= v1-91 s1-0) (!= v1-91 sv-272)) - (if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-91)) (-> s3-0 v1-91 w))) - (goto cfg-47) - ) - ) + (when (nonzero? sv-256) + (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) + (cond + ((>= *volume-normal-current* 599) + (format 0 "ERROR : camera editing out of volume normals~%") + ) + (else + (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) + (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) + (set! *volume-normal-current* (+ *volume-normal-current* 2)) + (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) ) - (vector+float*! sv-240 sv-160 sv-208 (the-as float sv-164)) - (cond - ((>= *volume-point-current* 999) - (format 0 "ERROR : camera editing out of volume points~%") - ) - (else - (set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad)) - (set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad)) - (set! *volume-point-current* (+ *volume-point-current* 2)) - (+! (-> s2-0 point-count) 2) - ) - ) - (vector+! s0-0 s0-0 sv-160) - (vector+! s0-0 s0-0 sv-240) - (set! sv-256 (+ sv-256 2)) - sv-256 ) ) ) ) ) - (label cfg-47) - (set! sv-272 (+ sv-272 1)) - ) - (when (nonzero? sv-256) - (vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256))) - (cond - ((>= *volume-normal-current* 599) - (format 0 "ERROR : camera editing out of volume normals~%") - ) - (else - (set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad)) - (set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad)) - (set! *volume-normal-current* (+ *volume-normal-current* 2)) - (set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)) - ) - ) ) ) ) @@ -995,7 +997,7 @@ ;; definition for function clmf-pos-rot ;; INFO: Used lq/sq (defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol)) - (local-vars (s2-0 structure) (s3-1 vector) (sv-192 matrix)) + (local-vars (s2-0 structure) (s3-1 vector)) (cam-layout-print 16 *camera-layout-message-ypos* "x/z pos: left stick, down: l1, up: r1") (set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 14)) (when (and arg1 (nonzero? arg1)) @@ -1065,35 +1067,35 @@ ) ) ) - (let ((s1-1 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'matrix)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (if (not s3-1) - (return #f) - ) - (clmf-input s5-0 s4-0 0) - (vector+float*! s3-1 s3-1 s4-0 409.6) - (cond - ((not arg1) - (the-as quaternion #f) - ) - ((zero? arg1) - (the-as quaternion #f) - ) - (else - (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) - (vector-float*! s5-0 s5-0 100.0) - (matrix-rotate-x! s1-1 (- (-> s5-0 x))) - (matrix*! sv-192 s1-1 sv-192) - (matrix-rotate-y! s1-1 (-> s5-0 y)) - (matrix*! sv-192 sv-192 s1-1) - (matrix-rotate-z! s1-1 (- (-> s5-0 z))) - (matrix*! sv-192 s1-1 sv-192) - (matrix->quaternion (the-as quaternion s0-1) sv-192) - (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) - (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) - (quaternion-normalize! (the-as quaternion s2-0)) - ) + (let ((s1-1 (new 'stack-no-clear 'matrix)) + (sv-192 (new 'stack-no-clear 'matrix)) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (if (not s3-1) + (return #f) + ) + (clmf-input s5-0 s4-0 0) + (vector+float*! s3-1 s3-1 s4-0 409.6) + (cond + ((not arg1) + (the-as quaternion #f) + ) + ((zero? arg1) + (the-as quaternion #f) + ) + (else + (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192) + (vector-float*! s5-0 s5-0 100.0) + (matrix-rotate-x! s1-1 (- (-> s5-0 x))) + (matrix*! sv-192 s1-1 sv-192) + (matrix-rotate-y! s1-1 (-> s5-0 y)) + (matrix*! sv-192 sv-192 s1-1) + (matrix-rotate-z! s1-1 (- (-> s5-0 z))) + (matrix*! sv-192 s1-1 sv-192) + (matrix->quaternion (the-as quaternion s0-1) sv-192) + (quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect))) + (quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0)) + (quaternion-normalize! (the-as quaternion s2-0)) ) ) ) @@ -2526,10 +2528,11 @@ ;; definition for function clmf-cam-string ;; INFO: Used lq/sq (defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol)) - (local-vars (r0-0 uint128) (v1-5 uint128) (sv-16 int)) + (local-vars (r0-0 uint128) (v1-5 uint128)) (format arg0 ":") - (set! sv-16 0) - (let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when s5-1 (let ((s4-0 0)) (while (begin diff --git a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc index ade2ccb6a2..d6c4b4e28d 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc @@ -347,16 +347,7 @@ ;; definition for function master-choose-entity ;; INFO: Used lq/sq (defbehavior master-choose-entity camera-master ((arg0 cam-setting-data)) - (local-vars - (v1-22 symbol) - (sv-96 res-tag) - (sv-112 process) - (sv-128 (pointer process)) - (sv-144 int) - (sv-160 string) - (sv-176 string) - (sv-192 uint) - ) + (local-vars (v1-22 symbol) (sv-128 (pointer process))) (let ((s5-0 (entity-by-name (-> arg0 entity-name)))) (set! (-> arg0 real-entity-name) #f) (when s5-0 @@ -373,8 +364,9 @@ (format 0 "ERROR : camera entity '~S' didn't produce a state~%" (res-lump-struct s5-0 'name structure)) ) ) - (set! sv-96 (new 'static 'res-tag)) - (let ((s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (& sv-96)))) + (let* ((sv-96 (new 'static 'res-tag)) + (s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (& sv-96))) + ) (when s4-1 (let* ((s1-1 (get-process *camera-dead-pool* camera-slave #x4000)) (s3-1 (when s1-1 @@ -402,22 +394,21 @@ (let ((s1-2 (cam-state-from-entity s0-0))) (cond (s1-2 - (set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000)) - (set! v1-22 (when sv-112 - (set! sv-128 (the-as (pointer process) v1-22)) - (let ((t9-14 (method-of-type camera-slave activate))) - (t9-14 - (the-as camera-slave sv-112) - *camera* - (symbol->string (-> camera-slave symbol)) - (the-as pointer #x70004000) - ) + (let ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000))) + (set! v1-22 (when sv-112 + (set! sv-128 (the-as (pointer process) v1-22)) + ((method-of-type camera-slave activate) + (the-as camera-slave sv-112) + *camera* + (symbol->string (-> camera-slave symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process sv-112 cam-slave-init s1-2 s0-0) + (set! sv-128 (-> sv-112 ppointer)) + v1-22 ) - (run-now-in-process sv-112 cam-slave-init s1-2 s0-0) - (set! sv-128 (-> sv-112 ppointer)) - v1-22 - ) - ) + ) + ) (cond (sv-128 (setup-slave-for-hopefull (the-as camera-slave (ppointer->process sv-128))) @@ -444,26 +435,21 @@ ) ) (else - (let ((s1-5 format)) - (set! sv-144 0) - (set! sv-160 "ERROR : alternate camera region '~S' didn't produce a state~%") - (let ((a2-14 (res-lump-struct s0-0 'name structure))) - (s1-5 sv-144 sv-160 a2-14) - ) + (format + 0 + "ERROR : alternate camera region '~S' didn't produce a state~%" + (res-lump-struct s0-0 'name structure) ) ) ) ) ) (else - (let ((s1-7 format) - (s0-1 0) - ) - (set! sv-176 "ERROR : alternate '~S' not found for '~S'~%") - (set! sv-192 (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))) - (let ((a3-8 (res-lump-struct s5-0 'name structure))) - (s1-7 s0-1 sv-176 sv-192 a3-8) - ) + (format + 0 + "ERROR : alternate '~S' not found for '~S'~%" + (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4)))) + (res-lump-struct s5-0 'name structure) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc index 90e4eb5514..b0f90fcd85 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc @@ -130,12 +130,7 @@ (#f (let* ((f28-0 (* (/ f30-0 100) (-> v1-0 x))) (f26-0 (* (/ f30-0 100) (-> v1-0 y))) - (f0-5 f28-0) - (f0-7 (* f0-5 f0-5)) - (f1-2 f26-0) - (f0-8 (+ f0-7 (* f1-2 f1-2))) - (f1-5 f30-0) - (f22-0 (- (sqrtf (+ f0-8 (* f1-5 f1-5))) f30-0)) + (f22-0 (- (sqrtf (+ (square f28-0) (square f26-0) (square f30-0))) f30-0)) (f24-0 (atan f26-0 f30-0)) (f0-12 (atan (- f28-0) f30-0)) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc index 87a28982ea..004b1d37d8 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc @@ -1510,86 +1510,83 @@ (arg5 vector) (arg6 float) ) - (local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int)) - (set! sv-128 arg3) - (let ((gp-0 arg4)) - (set! sv-144 arg5) - (let ((s4-0 arg6)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s5-0 (new 'stack-no-clear 'matrix))) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (s0-0 #f) - ) - (set! sv-208 0) - (while (< sv-208 4) - (cond - ((= sv-208 3) - (vector-! sv-160 sv-144 (-> self string-trans)) - (set! (-> s5-0 vector sv-208 z) 0.0) - ) - (else - (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) - (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) - (vector-! sv-160 (-> arg0 0 vertex sv-208) (-> self string-trans)) - ) - ) - (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) - (vector-cross! sv-176 sv-160 arg2) - (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) - (cond - ((< (* f28-0 f30-0) 0.0) - (set! s0-0 #t) - ) - ((!= f28-0 0.0) - (set! f30-0 f28-0) - ) - ) - (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) - (cond - ((= sv-208 3) - (vector-! sv-192 sv-144 (-> self string-trans)) - (vector-flatten! sv-192 sv-192 arg1) - ) - (else - (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) - ) - ) - (if (< f28-0 0.0) - (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) - (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) - ) - ) - (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) - (set! sv-208 (+ sv-208 1)) - ) - (cond - ((and s0-0 (!= (the-as int s4-0) -859915232)) - (dotimes (s4-1 4) - (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) - ) - #f - ) - ((< (-> s5-0 trans y) 0.0) - (dotimes (s4-2 4) - (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) - (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) - (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) - ) - ) - #f - ) - (else - (dotimes (s4-3 4) - (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) - (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) - ) - ) - #f - ) + (let ((sv-128 arg3) + (gp-0 arg4) + (sv-144 arg5) + (s4-0 arg6) + (sv-160 (new 'stack-no-clear 'vector)) + (sv-176 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'matrix)) + (sv-192 (new 'stack-no-clear 'vector)) + (f30-0 0.0) + (s0-0 #f) + ) + (let ((sv-208 0)) + (while (< sv-208 4) + (cond + ((= sv-208 3) + (vector-! sv-160 sv-144 (-> self string-trans)) + (set! (-> s5-0 vector sv-208 z) 0.0) + ) + (else + (vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208)) + (set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down))) + (vector-! sv-160 (-> arg0 0 vertex sv-208) (-> self string-trans)) ) ) + (vector-flatten! sv-160 sv-160 (-> *camera* local-down)) + (vector-cross! sv-176 sv-160 arg2) + (let ((f28-0 (vector-dot sv-176 (-> *camera* local-down)))) + (cond + ((< (* f28-0 f30-0) 0.0) + (set! s0-0 #t) + ) + ((!= f28-0 0.0) + (set! f30-0 f28-0) + ) + ) + (set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2)) + (cond + ((= sv-208 3) + (vector-! sv-192 sv-144 (-> self string-trans)) + (vector-flatten! sv-192 sv-192 arg1) + ) + (else + (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x)) + ) + ) + (if (< f28-0 0.0) + (set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192))) + (set! (-> s5-0 vector sv-208 y) (vector-length sv-192)) + ) + ) + (set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x))) + (+! sv-208 1) + ) + ) + (cond + ((and s0-0 (!= (the-as int s4-0) -859915232)) + (dotimes (s4-1 4) + (dist-info-append (-> gp-0 straddle) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))) + ) + #f + ) + ((< (-> s5-0 trans y) 0.0) + (dotimes (s4-2 4) + (when (>= (-> s5-0 trans y) (-> s5-0 vector s4-2 y)) + (set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y))) + (dist-info-append (-> gp-0 ccw) (the-as vector (+ (the-as uint s5-0) (* s4-2 16)))) + ) + ) + #f + ) + (else + (dotimes (s4-3 4) + (if (>= (-> s5-0 vector s4-3 y) (-> s5-0 trans y)) + (dist-info-append (-> gp-0 cw) (the-as vector (+ (the-as uint s5-0) (* s4-3 16)))) + ) + ) + #f ) ) ) @@ -1805,151 +1802,129 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f3, f6] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f2, f4, f7] (defbehavior cam-los-collide camera-slave ((arg0 vector) (arg1 vector) (arg2 collide-los-result) (arg3 pat-surface)) - (local-vars - (s1-3 int) - (s2-2 int) - (f2-1 float) - (sv-768 pat-surface) - (sv-784 vector) - (sv-800 vector) - (sv-816 tracking-point) - (sv-832 vector) - ) - (set! sv-768 arg3) - (dist-info-init (-> arg2 cw)) - (dist-info-init (-> arg2 ccw)) - (dist-info-init (-> arg2 straddle)) - (let ((s1-0 (new 'stack-no-clear 'collide-query)) - (s4-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (vector-normalize-copy! s2-0 arg1 1.0) - (vector-flatten! s4-0 arg1 (-> *camera* local-down)) - (let ((s0-0 *collide-cache*) - (f26-0 (vector-length arg1)) - (f30-0 (vector-normalize-ret-len! s4-0 1.0)) + (local-vars (s1-3 int) (s2-2 int) (f2-1 float)) + (let ((sv-768 arg3)) + (dist-info-init (-> arg2 cw)) + (dist-info-init (-> arg2 ccw)) + (dist-info-init (-> arg2 straddle)) + (let ((s1-0 (new 'stack-no-clear 'collide-query)) + (s4-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) ) - (set! (-> s1-0 start-pos quad) (-> arg0 quad)) - (set! (-> s1-0 move-dist quad) (-> arg1 quad)) - (let ((v1-5 s1-0)) - (set! (-> v1-5 radius) (-> *CAM_STRING-bank* los-coll-rad)) - (set! (-> v1-5 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) - (set! (-> v1-5 ignore-process0) #f) - (set! (-> v1-5 ignore-process1) #f) - (set! (-> v1-5 ignore-pat) sv-768) - (set! (-> v1-5 action-mask) (collide-action solid)) - ) - (fill-using-line-sphere s0-0 s1-0) - (let ((s1-1 (the-as object (-> s0-0 tris))) - (f28-0 (/ 2048.0 f26-0)) - (f26-1 (/ (+ -8192.0 f26-0) f26-0)) + (vector-normalize-copy! s2-0 arg1 1.0) + (vector-flatten! s4-0 arg1 (-> *camera* local-down)) + (let ((s0-0 *collide-cache*) + (f26-0 (vector-length arg1)) + (f30-0 (vector-normalize-ret-len! s4-0 1.0)) ) - (if (< f26-1 0.0) - (set! f26-1 0.0) - ) - (if (< 1.0 f28-0) - (set! f28-0 1.0) - ) - (countdown (s0-1 (-> s0-0 num-tris)) - (set! sv-800 (new 'stack-no-clear 'vector)) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((f0-7 (moving-sphere-triangle-intersect - arg0 - arg1 - (-> *CAM_STRING-bank* los-coll-rad) - (-> (the-as (inline-array collide-cache-tri) s1-1) 0) - sv-800 - sv-784 - ) - ) - ) - (cond - ((or (< f0-7 0.0) (< 1.0 f0-7)) - ) - ((let ((f1-2 0.0)) - (let* ((v1-23 arg1) - (f2-0 (-> v1-23 x)) - (f3-0 (-> v1-23 y)) - (f4-0 (-> v1-23 z)) - (f5-0 (-> sv-784 x)) - (f6-0 (-> sv-784 y)) - (f7-0 (-> sv-784 z)) - ) - (.mula.s f2-0 f5-0) - (.madda.s f3-0 f6-0) - (.madd.s f2-1 f4-0 f7-0) - ) - (< f1-2 f2-1) - ) - (when (< f28-0 f0-7) - (let* ((t1-1 (new 'stack-no-clear 'vector)) - (t0-1 (new 'stack-no-clear 'vector)) - (f24-0 (moving-sphere-triangle-intersect - arg0 - arg1 - (-> *CAM_STRING-bank* los-coll-rad2) - (-> (the-as (inline-array collide-cache-tri) s1-1) 0) - t0-1 - t1-1 - ) - ) - ) - (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-0) - (when *debug-segment* - (cond - ((= (the-as int f24-0) -859915232) - (let ((t9-10 cam-debug-add-los-tri) - (a0-20 s1-1) - (a2-6 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))) - ) - (t9-10 (the-as (inline-array collide-cache-tri) a0-20) sv-800 a2-6) - ) - ) - (else - (cam-debug-add-los-tri - (the-as (inline-array collide-cache-tri) s1-1) + (set! (-> s1-0 start-pos quad) (-> arg0 quad)) + (set! (-> s1-0 move-dist quad) (-> arg1 quad)) + (let ((v1-5 s1-0)) + (set! (-> v1-5 radius) (-> *CAM_STRING-bank* los-coll-rad)) + (set! (-> v1-5 collide-with) (collide-spec backgnd obstacle hit-by-others-list camera-blocker pusher)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) sv-768) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (fill-using-line-sphere s0-0 s1-0) + (let ((s1-1 (the-as object (-> s0-0 tris))) + (f28-0 (/ 2048.0 f26-0)) + (f26-1 (/ (+ -8192.0 f26-0) f26-0)) + ) + (if (< f26-1 0.0) + (set! f26-1 0.0) + ) + (if (< 1.0 f28-0) + (set! f28-0 1.0) + ) + (countdown (s0-1 (-> s0-0 num-tris)) + (let* ((sv-800 (new 'stack-no-clear 'vector)) + (sv-784 (new 'stack-no-clear 'vector)) + (f0-7 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) sv-800 - (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) + sv-784 ) ) + ) + (cond + ((or (< f0-7 0.0) (< 1.0 f0-7)) + ) + ((let ((f1-2 0.0)) + (let* ((v1-23 arg1)) + (set! f2-1 (vector-dot v1-23 sv-784)) + ) + (< f1-2 f2-1) + ) + (when (< f28-0 f0-7) + (let* ((t1-1 (new 'stack-no-clear 'vector)) + (t0-1 (new 'stack-no-clear 'vector)) + (f24-0 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) + t0-1 + t1-1 + ) + ) + ) + (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-0) + (when *debug-segment* + (if (= (the-as int f24-0) -859915232) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80)) + ) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)) + ) + ) ) ) ) ) - ) - ((< f0-7 f26-1) - (let* ((t1-3 (new 'stack-no-clear 'vector)) - (t0-3 (new 'stack-no-clear 'vector)) - (f24-1 (moving-sphere-triangle-intersect - arg0 - arg1 - (-> *CAM_STRING-bank* los-coll-rad2) - (-> (the-as (inline-array collide-cache-tri) s1-1) 0) - t0-3 - t1-3 + ((< f0-7 f26-1) + (let* ((t1-3 (new 'stack-no-clear 'vector)) + (t0-3 (new 'stack-no-clear 'vector)) + (f24-1 (moving-sphere-triangle-intersect + arg0 + arg1 + (-> *CAM_STRING-bank* los-coll-rad2) + (-> (the-as (inline-array collide-cache-tri) s1-1) 0) + t0-3 + t1-3 + ) ) - ) - ) - (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-1) - (when *debug-segment* - (if (= (the-as int f24-1) -859915232) - (cam-debug-add-los-tri - (the-as (inline-array collide-cache-tri) s1-1) - sv-800 - (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80)) + ) + (los-cw-ccw (the-as (inline-array collide-cache-tri) s1-1) s2-0 s4-0 f30-0 arg2 sv-800 f24-1) + (when *debug-segment* + (if (= (the-as int f24-1) -859915232) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :y (the-as float #x80) :w (the-as float #x80)) + ) + (cam-debug-add-los-tri + (the-as (inline-array collide-cache-tri) s1-1) + sv-800 + (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80)) + ) ) - (cam-debug-add-los-tri - (the-as (inline-array collide-cache-tri) s1-1) - sv-800 - (new 'static 'vector :z (the-as float #x80) :w (the-as float #x80)) - ) - ) + ) ) ) - ) + ) ) + (set! s1-1 (-> (the-as (inline-array collide-cache-tri) s1-1) 1)) ) - (set! s1-1 (-> (the-as (inline-array collide-cache-tri) s1-1) 1)) ) ) ) @@ -2025,13 +2000,13 @@ (set! s1-3 -134250495) (while (and (!= s2-2 -134250495) (begin - (let ((s0-3 cam-los-spline-collide)) - (set! sv-816 (-> (the-as (inline-array tracking-spline) (-> *camera* target-spline)) 0 point s2-2)) - (set! sv-832 arg0) - (let ((a2-21 (camera-master-method-16 *camera* #t))) - (set! f30-1 (s0-3 (-> sv-816 position) sv-832 (the-as pat-surface a2-21))) - ) - ) + (set! f30-1 + (cam-los-spline-collide + (-> (the-as (inline-array tracking-spline) (-> *camera* target-spline)) 0 point s2-2 position) + arg0 + (the-as pat-surface (camera-master-method-16 *camera* #t)) + ) + ) (< f30-1 0.0) ) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc index 12c2d2d256..e730ff817a 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-update_REF.gc @@ -25,7 +25,6 @@ ;; definition for function update-view-planes ;; INFO: Used lq/sq (defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float) (arg3 matrix)) - (local-vars (sv-240 vector)) (when (not *artist-fix-frustum*) (let ((s5-0 (new 'stack 'view-frustum))) (let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d))) @@ -62,22 +61,17 @@ (s0-0 (new-stack-vector0)) ) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (set! (-> sv-240 quad) (the-as uint128 0)) - (let ((v1-15 (-> arg3 trans quad))) - (set! (-> sv-240 quad) v1-15) - ) - (vector-! s2-1 (-> s5-0 yon-top-left) sv-240) - (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) - (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) - (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) - (plane-from-points arg1 s2-1 s1-0 sv-240 0) - (plane-from-points arg1 s0-0 s3-1 sv-240 1) - (plane-from-points arg1 s3-1 s2-1 sv-240 2) - (let ((t9-20 plane-from-points) - (t0-3 3) - ) - (t9-20 arg1 s1-0 s0-0 sv-240 t0-3) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (set! (-> sv-240 quad) (the-as uint128 0)) + (set! (-> sv-240 quad) (-> arg3 trans quad)) + (vector-! s2-1 (-> s5-0 yon-top-left) sv-240) + (vector-! s3-1 (-> s5-0 yon-top-right) sv-240) + (vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240) + (vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240) + (plane-from-points arg1 s2-1 s1-0 sv-240 0) + (plane-from-points arg1 s0-0 s3-1 sv-240 1) + (plane-from-points arg1 s3-1 s2-1 sv-240 2) + (plane-from-points arg1 s1-0 s0-0 sv-240 3) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/camera/camera_REF.gc b/test/decompiler/reference/jak2/engine/camera/camera_REF.gc index 11b98adfa0..32ad812a36 100644 --- a/test/decompiler/reference/jak2/engine/camera/camera_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/camera_REF.gc @@ -303,9 +303,7 @@ ;; definition for function fourth-power (defun fourth-power ((arg0 float)) - (let ((f0-2 (* arg0 arg0))) - (* f0-2 f0-2) - ) + (square (square arg0)) ) ;; definition for function third-power @@ -323,19 +321,10 @@ 0.0 ) ((>= 0.5 arg0) - (let ((f0-3 0.5) - (f1-4 (* 2.0 arg0)) - ) - (* f0-3 (* f1-4 f1-4)) - ) + (* 0.5 (square (* 2.0 arg0))) ) (else - (let ((f0-5 1.0) - (f1-7 0.5) - (f2-2 (* 2.0 (- 1.0 arg0))) - ) - (- f0-5 (* f1-7 (* f2-2 f2-2))) - ) + (- 1.0 (* 0.5 (square (* 2.0 (- 1.0 arg0))))) ) ) ) @@ -376,19 +365,12 @@ ;; definition for method 9 of type cam-index ;; INFO: Used lq/sq (defmethod cam-index-method-9 ((this cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve)) - (local-vars (sv-32 (function _varargs_ object))) (format (clear *cam-res-string*) "~S-flags" arg0) (set! (-> this flags) (the-as cam-index-options (cam-slave-get-flags arg1 (string->symbol *cam-res-string*)))) (let ((s3-2 (res-lump-data arg1 arg0 pointer)) (s0-1 (method-of-type res-lump get-property-struct)) ) - (set! sv-32 format) - (let ((a0-7 (clear *res-key-string*)) - (a1-4 "~S~S") - (a3-2 '-offset) - ) - (sv-32 a0-7 a1-4 arg0 a3-2) - ) + (format (clear *res-key-string*) "~S~S" arg0 '-offset) (let ((v0-8 (s0-1 arg1 (string->symbol *res-key-string*) @@ -1201,7 +1183,6 @@ ;; ERROR: Stack slot load at 144 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 (defun cam-calc-follow! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 symbol)) - (local-vars (sv-128 (function float float float float)) (sv-144 float) (sv-160 float)) (with-pp (cond (arg2 @@ -1232,11 +1213,13 @@ (vector-flatten! s0-0 s0-0 (-> *camera* local-down)) (vector-normalize! s0-0 1.0) (vector-float*! s2-0 (-> *camera* tgt-face-mat vector 2) 32768.0) - (set! sv-128 lerp-clamp) - (set! sv-144 (the-as float 0.7)) - (set! sv-160 (the-as float 0.4)) - (let* ((a2-3 (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0)))) - (f30-1 (sv-128 sv-144 sv-160 a2-3)) + (let* ((f30-1 + (lerp-clamp + (the-as float 0.7) + (the-as float 0.4) + (parameter-ease-sin-clamp (* 0.00081380206 (+ -409.6 f30-0))) + ) + ) (f0-7 (acos (vector-dot s0-0 s1-0))) (f28-0 (fmax 1820.4445 f0-7)) ) @@ -1254,10 +1237,7 @@ ((< (-> *camera* ease-t) 1.0) ) ((< (-> arg0 follow-blend) 1.0) - (let* ((f0-21 (-> arg0 follow-blend)) - (f0-22 (* f0-21 f0-21)) - (f0-23 (* f0-22 f0-22)) - ) + (let ((f0-23 (square (square (-> arg0 follow-blend))))) (vector-! s2-0 s2-0 (-> arg0 follow-off)) (vector-float*! s2-0 s2-0 f0-23) ) @@ -1305,10 +1285,10 @@ 1.0 ) (else - (let* ((f0-33 (* f0-32 f0-32)) + (let* ((f0-33 (square f0-32)) (f0-34 (- 1.0 f0-33)) ) - (* f0-34 (* f0-34 f0-34)) + (* f0-34 (square f0-34)) ) ) ) @@ -1470,7 +1450,6 @@ ;; definition for function vector-into-frustum-nosmooth! ;; INFO: Used lq/sq (defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float)) - (local-vars (sv-112 (inline-array vector)) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) @@ -1491,17 +1470,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 vector 1)) (vector-normalize! s3-0 1.0) (let ((f28-0 (vector-dot s3-0 (-> arg0 vector 0)))) - (set! sv-128 s2-0) - (set! sv-112 (-> arg0 vector)) - (let ((f0-7 (* 0.8 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-112 0 quad)) - (let ((v1-11 f0-7)) - (.mov vf2 v1-11) + (let ((sv-128 s2-0)) + (let ((sv-112 (-> arg0 vector)) + (f0-7 (* 0.8 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-112 0 quad)) + (let ((v1-11 f0-7)) + (.mov vf2 v1-11) + ) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-128 quad) vf1) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-128 quad) vf1) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 f26-0) (vector--float*! s2-0 s2-0 (-> arg0 vector 0) 6144.0) @@ -1524,17 +1505,19 @@ (vector-flatten! s3-0 s3-0 (-> arg0 vector 0)) (vector-normalize! s3-0 1.0) (let ((f28-1 (vector-dot s3-0 (-> arg0 vector 1)))) - (set! sv-160 s2-0) - (set! sv-144 (-> arg0 vector 1)) - (let ((f0-16 (* 0.525 (tan (/ arg2 2))))) - (.lvf vf1 (&-> sv-144 quad)) - (let ((v1-32 f0-16)) - (.mov vf2 v1-32) + (let ((sv-160 s2-0)) + (let ((sv-144 (-> arg0 vector 1)) + (f0-16 (* 0.525 (tan (/ arg2 2)))) + ) + (.lvf vf1 (&-> sv-144 quad)) + (let ((v1-32 f0-16)) + (.mov vf2 v1-32) + ) ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-160 quad) vf1) ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-160 quad) vf1) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-18 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1550,12 +1533,7 @@ (vector-flatten! s3-0 s3-0 (-> arg0 vector 0)) (vector-normalize! s3-0 1.0) (let ((f28-2 (vector-dot s3-0 (-> arg0 vector 1)))) - (let ((s0-1 s2-0)) - (set! sv-176 (-> arg0 vector 1)) - (let ((f0-26 (* 0.525 (tan (/ arg2 2))))) - (vector-float*! s0-1 sv-176 f0-26) - ) - ) + (vector-float*! s2-0 (-> arg0 vector 1) (* 0.525 (tan (/ arg2 2)))) (vector+! s2-0 s2-0 (-> arg0 vector 2)) (vector-normalize! s2-0 1.0) (let ((f0-28 (vector-dot s2-0 (-> arg0 vector 1)))) @@ -1597,15 +1575,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 cam-slave-options-u32) (arg3 float) (arg4 symbol)) - (local-vars - (f0-9 float) - (sv-208 vector) - (sv-224 vector) - (sv-240 matrix) - (sv-256 (function matrix vector float vector)) - (sv-272 matrix) - (sv-288 vector) - ) + (local-vars (f0-9 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1621,22 +1591,23 @@ (let ((f30-0 (-> arg0 tilt-adjust value))) (cond ((< 0.0001 (-> arg0 point-of-interest-blend value)) - (set! sv-208 (new 'stack-no-clear 'vector)) - 0.0 - (vector-! s0-0 (-> arg0 follow-pt) arg1) - (let ((f28-0 (vector-length s0-0))) - (vector-! sv-208 (-> *camera* settings point-of-interest) arg1) - (vector-normalize! sv-208 (* f28-0 (-> arg0 point-of-interest-blend value))) - (let ((v1-12 s0-0)) - (let ((a0-10 s0-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-10 quad)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + 0.0 + (vector-! s0-0 (-> arg0 follow-pt) arg1) + (let ((f28-0 (vector-length s0-0))) + (vector-! sv-208 (-> *camera* settings point-of-interest) arg1) + (vector-normalize! sv-208 (* f28-0 (-> arg0 point-of-interest-blend value))) + (let ((v1-12 s0-0)) + (let ((a0-10 s0-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-10 quad)) + ) + (.lvf vf5 (&-> sv-208 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-12 quad) vf6) ) - (.lvf vf5 (&-> sv-208 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-12 quad) vf6) + (vector-normalize! s0-0 f28-0) ) - (vector-normalize! s0-0 f28-0) ) (vector-! (-> arg0 looking-interesting) (-> *camera* settings point-of-interest) (-> arg0 follow-pt)) (vector+float*! @@ -1656,47 +1627,35 @@ (when (!= f30-0 0.0) 0.0 0.0 - (set! sv-240 (new 'stack-no-clear 'matrix)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (vector-normalize-copy! sv-224 s0-0 1.0) - (let* ((v1-25 (-> *camera* local-down)) - (f0-8 (-> sv-224 x)) - (f1-1 (-> sv-224 y)) - (f2-0 (-> sv-224 z)) - (f3-0 (-> v1-25 x)) - (f4-0 (-> v1-25 y)) - (f5-0 (-> v1-25 z)) - ) - (.mula.s f0-8 f3-0) - (.madda.s f1-1 f4-0) - (.madd.s f0-9 f2-0 f5-0) - ) - (let* ((f28-1 f0-9) - (f0-11 (acos (fabs f28-1))) - ) - (cond - ((< 0.0 f30-0) - (set! f30-0 (if (< 0.0 f28-1) - (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-11))) - (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11)))) - ) - ) - ) - ((< f30-0 0.0) - (set! f30-0 (if (< 0.0 f28-1) - (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11))))) - (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-11)))) - ) - ) - ) - ) - ) - (matrix-rotate-x! sv-240 f30-0) - (let ((t9-6 matrix*!) - (a0-28 s1-0) - (a2-3 s1-0) + (let ((sv-240 (new 'stack-no-clear 'matrix))) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (vector-normalize-copy! sv-224 s0-0 1.0) + (let* ((v1-25 (-> *camera* local-down))) + (set! f0-9 (vector-dot sv-224 v1-25)) ) - (t9-6 a0-28 sv-240 a2-3) + ) + (let* ((f28-1 f0-9) + (f0-11 (acos (fabs f28-1))) + ) + (cond + ((< 0.0 f30-0) + (set! f30-0 (if (< 0.0 f28-1) + (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-11))) + (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11)))) + ) + ) + ) + ((< f30-0 0.0) + (set! f30-0 (if (< 0.0 f28-1) + (fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-11))))) + (fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-11)))) + ) + ) + ) + ) + ) + (matrix-rotate-x! sv-240 f30-0) + (matrix*! s1-0 sv-240 s1-0) ) ) ) @@ -1709,12 +1668,7 @@ (set! (-> arg0 underwater-blend target) 0.0) ) ) - (set! sv-256 vector-into-frustum-nosmooth!) - (set! sv-272 s1-0) - (set! sv-288 arg1) - (let ((a2-5 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value)))) - (sv-256 sv-272 sv-288 a2-5) - ) + (vector-into-frustum-nosmooth! s1-0 arg1 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value))) (cond (arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s0-0 s1-0) @@ -1782,97 +1736,71 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun v-slrp2! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector) (arg5 float)) - (local-vars - (f0-10 float) - (f28-0 float) - (f30-0 float) - (sv-144 float) - (sv-160 vector) - (sv-176 matrix) - (sv-192 vector) - ) - (set! sv-144 arg5) - (let ((s0-0 (new-stack-vector0))) - (set! sv-160 (new 'stack-no-clear 'vector)) + (local-vars (f0-10 float) (f28-0 float) (f30-0 float)) + (let ((sv-144 arg5) + (s0-0 (new-stack-vector0)) + (sv-160 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-160 quad) (the-as uint128 0)) 1.0 1.0 (let ((s3-0 (new-stack-vector0))) 0.0 1.0 - (set! sv-176 (new 'stack-no-clear 'matrix)) - (set! (-> sv-176 quad 0) (the-as uint128 0)) - (set! (-> sv-176 quad 1) (the-as uint128 0)) - (set! (-> sv-176 quad 2) (the-as uint128 0)) - (set! (-> sv-176 trans quad) (the-as uint128 0)) - (cond - ((< 1.0 arg3) - (set! arg3 1.0) - ) - ((< arg3 0.0) - (set! arg3 0.0) - ) - ) - (cond - (arg4 - (vector-flatten! s0-0 arg1 arg4) - (vector-flatten! sv-160 arg2 arg4) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) - (let ((f26-0 (vector-dot arg4 s3-0))) - (vector-normalize-copy! s3-0 arg4 1.0) - (if (< f26-0 0.0) - (vector-negate! s3-0 s3-0) - ) + (let ((sv-176 (new 'stack-no-clear 'matrix))) + (set! (-> sv-176 quad 0) (the-as uint128 0)) + (set! (-> sv-176 quad 1) (the-as uint128 0)) + (set! (-> sv-176 quad 2) (the-as uint128 0)) + (set! (-> sv-176 trans quad) (the-as uint128 0)) + (cond + ((< 1.0 arg3) + (set! arg3 1.0) + ) + ((< arg3 0.0) + (set! arg3 0.0) + ) + ) + (cond + (arg4 + (vector-flatten! s0-0 arg1 arg4) + (vector-flatten! sv-160 arg2 arg4) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0) + (let ((f26-0 (vector-dot arg4 s3-0))) + (vector-normalize-copy! s3-0 arg4 1.0) + (if (< f26-0 0.0) + (vector-negate! s3-0 s3-0) + ) + ) + ) + (else + (set! (-> s0-0 quad) (-> arg1 quad)) + (set! (-> sv-160 quad) (-> arg2 quad)) + (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) + (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) + (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) ) ) - (else - (set! (-> s0-0 quad) (-> arg1 quad)) - (set! (-> sv-160 quad) (-> arg2 quad)) - (set! f30-0 (vector-normalize-ret-len! s0-0 1.0)) - (set! f28-0 (vector-normalize-ret-len! sv-160 1.0)) - (vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0) - ) - ) - (let ((t9-10 acos)) - (let* ((v1-22 s0-0) - (f0-9 (-> v1-22 x)) - (f1-2 (-> v1-22 y)) - (f2-0 (-> v1-22 z)) - (f3-0 (-> sv-160 x)) - (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z)) - ) - (.mula.s f0-9 f3-0) - (.madda.s f1-2 f4-0) - (.madd.s f0-10 f2-0 f5-0) - ) - (let* ((f1-3 (t9-10 f0-10)) - (f0-12 (* arg3 f1-3)) - ) - (when (< sv-144 f0-12) - (set! f0-12 sv-144) - (set! arg3 (/ sv-144 f1-3)) + (let ((t9-10 acos)) + (let* ((v1-22 s0-0)) + (set! f0-10 (vector-dot v1-22 sv-160)) ) - (let* ((f0-13 (cos f0-12)) - (t9-12 matrix-axis-sin-cos!) - (a0-20 sv-176) - (a1-13 s3-0) - (f1-5 1.0) - (f2-3 f0-13) + (let* ((f1-3 (t9-10 f0-10)) + (f0-12 (* arg3 f1-3)) ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13) + (when (< sv-144 f0-12) + (set! f0-12 sv-144) + (set! arg3 (/ sv-144 f1-3)) + ) + (let ((f0-13 (cos f0-12))) + (matrix-axis-sin-cos! sv-176 s3-0 (sqrtf (- 1.0 (square f0-13))) f0-13) + ) ) ) + (vector-matrix*! arg0 s0-0 sv-176) ) - (vector-matrix*! arg0 s0-0 sv-176) - (let ((s0-1 vector-normalize!)) - (set! sv-192 arg0) - (let ((a1-16 (lerp f30-0 f28-0 arg3))) - (s0-1 sv-192 a1-16) - ) - ) + (vector-normalize! arg0 (lerp f30-0 f28-0 arg3)) (when arg4 (vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0)) (vector+float*! arg0 arg0 s3-0 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))) @@ -1901,10 +1829,11 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defun v-slrp3! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (f0-7 float) (f26-0 float) (f28-0 float) (sv-144 float) (sv-160 vector)) - (set! sv-144 arg4) - (let ((s1-0 (new-stack-vector0))) - (set! sv-160 (new 'stack-no-clear 'vector)) + (local-vars (f0-7 float) (f26-0 float) (f28-0 float)) + (let ((sv-144 arg4) + (s1-0 (new-stack-vector0)) + (sv-160 (new 'stack-no-clear 'vector)) + ) (set! (-> sv-160 quad) (the-as uint128 0)) 0.0 0.0 @@ -1936,31 +1865,16 @@ ) ) (let ((t9-10 acos)) - (let* ((v1-10 s1-0) - (f0-6 (-> v1-10 x)) - (f1-0 (-> v1-10 y)) - (f2-0 (-> v1-10 z)) - (f3-0 (-> sv-160 x)) - (f4-0 (-> sv-160 y)) - (f5-0 (-> sv-160 z)) - ) - (.mula.s f0-6 f3-0) - (.madda.s f1-0 f4-0) - (.madd.s f0-7 f2-0 f5-0) + (let* ((v1-10 s1-0)) + (set! f0-7 (vector-dot v1-10 sv-160)) ) (let ((f0-8 (t9-10 f0-7))) (when (< sv-144 f0-8) (set! f30-0 (/ sv-144 f0-8)) (set! f0-8 sv-144) ) - (let* ((f0-9 (cos f0-8)) - (t9-12 matrix-axis-sin-cos!) - (a0-20 s0-0) - (a1-13 s3-0) - (f1-3 1.0) - (f2-1 f0-9) - ) - (t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9) + (let ((f0-9 (cos f0-8))) + (matrix-axis-sin-cos! s0-0 s3-0 (sqrtf (- 1.0 (square f0-9))) f0-9) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-cache_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-cache_REF.gc index fbc7eaafa9..8fda9b5168 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-cache_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-cache_REF.gc @@ -653,14 +653,12 @@ ) (vector+float*! (-> s3-0 vector 0) (-> arg0 start-pos) (-> arg0 move-dist) f0-6) ) - (let ((f0-7 (vector-vector-distance-squared (-> s3-0 vector 0) (-> s0-0 world-sphere))) - (f1-5 (+ (-> arg0 radius) (-> s0-0 world-sphere w))) - ) - (when (< f0-7 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-0)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< (vector-vector-distance-squared (-> s3-0 vector 0) (-> s0-0 world-sphere)) + (square (+ (-> arg0 radius) (-> s0-0 world-sphere w))) + ) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-0)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -689,14 +687,12 @@ ) (vector+float*! (-> s3-0 vector 0) (-> arg0 start-pos) (-> arg0 move-dist) f0-11) ) - (let ((f0-12 (vector-vector-distance-squared (-> s3-0 vector 0) (-> s0-1 world-sphere))) - (f1-11 (+ (-> arg0 radius) (-> s0-1 world-sphere w))) - ) - (when (< f0-12 (* f1-11 f1-11)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-1)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< (vector-vector-distance-squared (-> s3-0 vector 0) (-> s0-1 world-sphere)) + (square (+ (-> arg0 radius) (-> s0-1 world-sphere w))) + ) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape s1-1)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) 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 9af2accb53..6265f41c40 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 @@ -150,7 +150,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs symbol. (defmethod check-grab-for-collisions ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info)) - (local-vars (sv-656 vector) (sv-672 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -184,19 +183,21 @@ (return (the-as symbol #f)) ) ) - (set! sv-672 s0-0) - (set! sv-656 (-> arg0 center-pt)) - (let ((v0-2 (vector-negate! (new 'stack-no-clear 'vector) (-> s2-0 edge-vec-norm)))) - (let ((v1-8 1105.92)) - (.mov vf7 v1-8) + (let ((sv-672 s0-0)) + (let ((sv-656 (-> arg0 center-pt))) + (let ((v0-2 (vector-negate! (new 'stack-no-clear 'vector) (-> s2-0 edge-vec-norm)))) + (let ((v1-8 1105.92)) + (.mov vf7 v1-8) + ) + (.lvf vf5 (&-> v0-2 quad)) + ) + (.lvf vf4 (&-> sv-656 quad)) ) - (.lvf vf5 (&-> v0-2 quad)) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-672 quad) vf6) ) - (.lvf vf4 (&-> sv-656 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-672 quad) vf6) (let ((f0-3 (get-best-hand-point this (-> arg1 left-hand-hold) s0-0 (the-as int s4-0)))) (if (< 491.52 f0-3) (return (the-as symbol #f)) @@ -599,7 +600,6 @@ ;; definition for method 10 of type collide-edge-work ;; INFO: Used lq/sq (defmethod debug-draw-edges ((this collide-edge-work)) - (local-vars (sv-32 (function _varargs_ object))) (let ((gp-0 0)) (dotimes (s4-0 (the-as int (-> this num-edges))) (let* ((v1-3 (-> this edges s4-0)) @@ -636,13 +636,7 @@ (s1-0 #t) (s0-0 318) ) - (set! sv-32 format) - (let ((a0-10 (clear *temp-string*)) - (a1-4 "~D") - (a2-2 s4-0) - ) - (sv-32 a0-10 a1-4 a2-2) - ) + (format (clear *temp-string*) "~D" s4-0) (s2-0 s1-0 (the-as bucket-id s0-0) *temp-string* s3-0 (font-color white) (the-as vector2h #f)) ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc index b37b582ff0..e854cfa719 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape-rider_REF.gc @@ -190,14 +190,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> s4-0 prim-core world-sphere w))) - ) - (when (< f0-0 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> s4-0 prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -231,14 +227,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> s4-0 prim-core world-sphere w))) - ) - (when (< f0-1 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (-> s4-0 prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc index a490faceb5..56fe7b7dea 100644 --- a/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/collide-shape_REF.gc @@ -597,7 +597,6 @@ ;; definition for function find-ground-point ;; INFO: Used lq/sq (defun find-ground-point ((arg0 control-info) (arg1 vector) (arg2 float) (arg3 float)) - (local-vars (sv-560 int)) (let* ((f0-0 819.2) (v1-1 (-> arg0 transv)) (f30-0 (if (< f0-0 (sqrtf (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))))) @@ -637,51 +636,50 @@ ) ) ) + (sv-560 0) + (f26-0 arg3) ) - (set! sv-560 0) - (let ((f26-0 arg3)) - (set-vector! (-> s1-0 move-dist) 0.0 0.0 arg3 1.0) - (vector-rotate-y! (-> s1-0 move-dist) (-> s1-0 move-dist) f28-0) - (if (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) - (set! f26-0 (+ -6144.0 (vector-vector-xz-distance s2-0 (-> s1-0 best-other-tri intersect)))) + (set-vector! (-> s1-0 move-dist) 0.0 0.0 arg3 1.0) + (vector-rotate-y! (-> s1-0 move-dist) (-> s1-0 move-dist) f28-0) + (if (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) + (set! f26-0 (+ -6144.0 (vector-vector-xz-distance s2-0 (-> s1-0 best-other-tri intersect)))) + ) + (let ((f24-0 arg2)) + (while (>= f26-0 f24-0) + (set-vector! (-> s1-0 start-pos) 0.0 0.0 f24-0 1.0) + (vector-rotate-y! (-> s1-0 start-pos) (-> s1-0 start-pos) f28-0) + (vector+! (-> s1-0 start-pos) s2-0 (-> s1-0 start-pos)) + (set! (-> s1-0 start-pos y) (+ 20480.0 (-> s2-0 y))) + (set-vector! (-> s1-0 move-dist) 0.0 -61440.0 0.0 1.0) + (let ((v1-33 s1-0)) + (set! (-> v1-33 radius) 10240.0) + (set! (-> v1-33 collide-with) (-> arg0 root-prim prim-core collide-with)) + (set! (-> v1-33 ignore-process0) (-> arg0 process)) + (set! (-> v1-33 ignore-process1) #f) + (set! (-> v1-33 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-33 action-mask) (collide-action solid)) ) - (let ((f24-0 arg2)) - (while (>= f26-0 f24-0) - (set-vector! (-> s1-0 start-pos) 0.0 0.0 f24-0 1.0) - (vector-rotate-y! (-> s1-0 start-pos) (-> s1-0 start-pos) f28-0) - (vector+! (-> s1-0 start-pos) s2-0 (-> s1-0 start-pos)) - (set! (-> s1-0 start-pos y) (+ 20480.0 (-> s2-0 y))) - (set-vector! (-> s1-0 move-dist) 0.0 -61440.0 0.0 1.0) - (let ((v1-33 s1-0)) - (set! (-> v1-33 radius) 10240.0) - (set! (-> v1-33 collide-with) (-> arg0 root-prim prim-core collide-with)) - (set! (-> v1-33 ignore-process0) (-> arg0 process)) - (set! (-> v1-33 ignore-process1) #f) - (set! (-> v1-33 ignore-pat) (-> arg0 pat-ignore-mask)) - (set! (-> v1-33 action-mask) (collide-action solid)) + (when (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) + (cond + ((and (or (= (-> s1-0 best-other-tri pat mode) (pat-mode ground)) + (= (-> s1-0 best-other-tri pat mode) (pat-mode halfpipe)) + ) + (and (= (-> s1-0 best-other-tri pat event) (pat-event none)) (< 0.7 (-> s1-0 best-other-tri normal y))) + ) + (set! (-> arg1 quad) (-> s1-0 best-other-tri intersect quad)) + (+! sv-560 1) + (if (>= sv-560 2) + (return arg1) + ) + ) + ((and (= (-> s1-0 best-other-tri pat mode) (pat-mode wall)) + (< (+ 4096.0 (-> s2-0 y)) (-> s1-0 best-other-tri intersect y)) + ) + (goto cfg-38) + ) ) - (when (>= (probe-using-line-sphere *collide-cache* s1-0) 0.0) - (cond - ((and (or (= (-> s1-0 best-other-tri pat mode) (pat-mode ground)) - (= (-> s1-0 best-other-tri pat mode) (pat-mode halfpipe)) - ) - (and (= (-> s1-0 best-other-tri pat event) (pat-event none)) (< 0.7 (-> s1-0 best-other-tri normal y))) - ) - (set! (-> arg1 quad) (-> s1-0 best-other-tri intersect quad)) - (set! sv-560 (+ sv-560 1)) - (if (>= sv-560 2) - (return arg1) - ) - ) - ((and (= (-> s1-0 best-other-tri pat mode) (pat-mode wall)) - (< (+ 4096.0 (-> s2-0 y)) (-> s1-0 best-other-tri intersect y)) - ) - (goto cfg-38) - ) - ) - ) - (set! f24-0 (+ 4096.0 f24-0)) ) + (set! f24-0 (+ 4096.0 f24-0)) ) ) ) @@ -877,73 +875,73 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun cshape-reaction-update-state ((arg0 control-info) (arg1 collide-query) (arg2 vector)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 collide-status) (sv-96 symbol)) - (set! sv-48 (new-stack-vector0)) - (set! sv-52 (new-stack-vector0)) - (set! sv-56 (collide-status)) - (let ((a1-1 (new 'stack-no-clear 'vector))) - (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) - (move-by-vector! arg0 a1-1) - ) - (react-to-pat! arg0 (-> arg1 best-other-tri pat)) - (vector-! sv-48 (-> arg1 best-my-prim prim-core world-sphere) (-> arg1 best-other-tri intersect)) - (cond - ((and (= (-> arg1 best-dist) 0.0) - (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) - ) - (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) - (set! (-> arg0 coverage) 0.0) - ) - (else - (set! (-> sv-48 w) 1.0) - (vector-normalize! sv-48 1.0) - (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-48 sv-48 (-> arg1 best-other-tri normal)) + (let ((sv-48 (new-stack-vector0)) + (sv-52 (new-stack-vector0)) + (sv-56 (collide-status)) + ) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-1) + ) + (react-to-pat! arg0 (-> arg1 best-other-tri pat)) + (vector-! sv-48 (-> arg1 best-my-prim prim-core world-sphere) (-> arg1 best-other-tri intersect)) + (cond + ((and (= (-> arg1 best-dist) 0.0) + (< (vector-length sv-48) (+ -40.96 (-> arg1 best-my-prim prim-core world-sphere w))) + ) + (set! (-> sv-48 quad) (-> arg1 best-other-tri normal quad)) + (set! (-> arg0 coverage) 0.0) + ) + (else + (set! (-> sv-48 w) 1.0) (vector-normalize! sv-48 1.0) + (set! (-> arg0 coverage) (vector-dot sv-48 (-> arg1 best-other-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-48 sv-48 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-48 1.0) + ) ) ) + (set! (-> sv-52 quad) (-> sv-48 quad)) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-52 arg2) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-56 (collide-status touch-ceiling)) + ) + (let ((sv-96 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (logior! sv-56 (collide-status touch-surface)) + (if (-> arg1 num-spheres) + (logior! sv-56 (collide-status touch-actor)) + ) + (cond + (sv-96 + (logior! sv-56 (collide-status touch-wall)) + (set! (-> arg0 cur-pat mode) 1) + ) + (else + (logior! sv-56 (collide-status on-surface)) + (set! (-> arg0 local-normal quad) (-> sv-52 quad)) + ) + ) + (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) + (logior! sv-56 (collide-status on-ground)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + ) + ) + ) + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (logior! sv-56 (collide-status impact-surface)) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + ) + (logior! (-> arg0 status) sv-56) ) - (let ((v1-25 (-> sv-48 quad))) - (set! (-> sv-52 quad) v1-25) - ) - (if (= (-> arg1 best-dist) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-52 6.0)) - ) - (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-52 arg2) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-56 (logior sv-56 (collide-status touch-ceiling))) - ) - (set! sv-96 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (set! sv-56 (logior sv-56 (collide-status touch-surface))) - (if (-> arg1 num-spheres) - (set! sv-56 (logior sv-56 (collide-status touch-actor))) - ) - (cond - (sv-96 - (set! sv-56 (logior sv-56 (collide-status touch-wall))) - (set! (-> arg0 cur-pat mode) 1) - ) - (else - (set! sv-56 (logior sv-56 (collide-status on-surface))) - (set! (-> arg0 local-normal quad) (-> sv-52 quad)) - ) - ) - (when (and (not sv-96) (>= (-> arg0 coverage) 0.9)) - (set! sv-56 (logior sv-56 (collide-status on-ground))) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (when (!= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) - ) - ) - (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) - (set! sv-56 (logior sv-56 (collide-status impact-surface))) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - ) - (logior! (-> arg0 status) sv-56) 0 (none) ) @@ -1006,7 +1004,6 @@ ;; definition for method 66 of type collide-shape-moving ;; INFO: Used lq/sq (defmethod step-collison! ((this collide-shape-moving) (arg0 vector) (arg1 vector) (arg2 float) (arg3 int)) - (local-vars (sv-592 int)) (let ((s5-0 (new 'stack 'collide-query)) (s2-0 (new 'stack-no-clear 'vector)) ) @@ -1018,10 +1015,10 @@ (let* ((s1-1 (-> this root-prim)) (v1-5 *collide-cache*) (s0-0 (the-as collide-cache-prim (-> v1-5 prims))) + (sv-592 (-> v1-5 num-prims)) ) - (set! sv-592 (-> v1-5 num-prims)) (while (nonzero? sv-592) - (set! sv-592 (+ sv-592 -1)) + (+! sv-592 -1) (when (logtest? (-> s1-1 prim-core collide-with) (-> s0-0 prim-core collide-as)) (if (>= (the-as int (-> s0-0 prim-core prim-type)) 0) (collide-with-collide-cache-prim-mesh s1-1 s5-0 s0-0) @@ -1701,22 +1698,23 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod move-to-ground ((this collide-shape-moving) (arg0 float) (arg1 float) (arg2 symbol) (arg3 collide-spec)) - (local-vars (sv-576 profile-segment) (sv-592 int)) (when *debug-segment* (let ((s1-0 (-> *display* frames (-> *display* on-screen) profile-array data 0)) (v1-7 'collide) (s0-0 *profile-collide-color*) ) (when (and *dproc* *debug-segment*) - (set! sv-576 (-> s1-0 data (-> s1-0 count))) - (set! sv-592 (-> s1-0 base-time)) - (set! (-> sv-576 name) v1-7) - (set! (-> sv-576 start-time) - (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint sv-592))) - ) - (set! (-> sv-576 depth) (the-as uint (-> s1-0 depth))) - (set! (-> sv-576 color) s0-0) - (set! (-> s1-0 segment (-> s1-0 depth)) sv-576) + (let ((sv-576 (-> s1-0 data (-> s1-0 count)))) + (let ((sv-592 (-> s1-0 base-time))) + (set! (-> sv-576 name) v1-7) + (set! (-> sv-576 start-time) + (the-as int (- (timer-count (the-as timer-bank #x10000800)) (the-as uint sv-592))) + ) + ) + (set! (-> sv-576 depth) (the-as uint (-> s1-0 depth))) + (set! (-> sv-576 color) s0-0) + (set! (-> s1-0 segment (-> s1-0 depth)) sv-576) + ) (+! (-> s1-0 count) 1) (+! (-> s1-0 depth) 1) (set! (-> s1-0 max-depth) (max (-> s1-0 max-depth) (-> s1-0 depth))) @@ -2386,14 +2384,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> this root-prim prim-core world-sphere w))) - ) - (when (< f0-0 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> this root-prim prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -2427,14 +2421,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-15 world-sphere w) (-> this root-prim prim-core world-sphere w))) - ) - (when (< f0-1 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-15 world-sphere w) (-> this root-prim prim-core world-sphere w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -2568,11 +2558,7 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-3 world-sphere w) (-> s3-0 prim-core world-sphere w))) - ) - (b! (>= f0-0 (* f1-1 f1-1)) cfg-8 :delay #f) - ) + (b! (>= a2-5 (square (+ (-> a1-3 world-sphere w) (-> s3-0 prim-core world-sphere w)))) cfg-8 :delay #f) ) ) (b! (>= *actor-list-length* 256) cfg-8 :delay #f) @@ -2609,11 +2595,7 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-15 world-sphere w) (-> s3-0 prim-core world-sphere w))) - ) - (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) - ) + (b! (>= a2-12 (square (+ (-> a1-15 world-sphere w) (-> s3-0 prim-core world-sphere w)))) cfg-17 :delay #f) ) ) (b! (>= *actor-list-length* 256) cfg-17 :delay #f) @@ -2925,7 +2907,6 @@ ;; definition for method 50 of type collide-shape ;; INFO: Used lq/sq (defmethod send-shoves ((this collide-shape) (arg0 process) (arg1 touching-shapes-entry) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (sv-144 process) (sv-160 collide-shape-prim) (sv-176 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2933,51 +2914,48 @@ ) (init-vf0-vector) (when arg1 - (let ((s0-0 (-> arg1 head))) - (set! sv-144 arg0) - (let ((gp-0 (if (type? sv-144 process-focusable) - sv-144 - ) - ) - ) - (when (and s0-0 gp-0) - (while s0-0 - (set! sv-160 (get-touched-prim s0-0 this arg1)) + (let ((s0-0 (-> arg1 head)) + (gp-0 (the-as process (as-type arg0 process-focusable))) + ) + (when (and s0-0 gp-0) + (while s0-0 + (let ((sv-160 (get-touched-prim s0-0 this arg1))) (get-touched-prim s0-0 (-> (the-as process-focusable gp-0) root) arg1) (when (logtest? (-> sv-160 prim-core action) (collide-action no-standon)) - (let ((v1-12 (get-middle-of-bsphere-overlap s0-0 (new 'stack-no-clear 'vector)))) - (set! sv-176 (new 'stack-no-clear 'vector)) + (let ((v1-12 (get-middle-of-bsphere-overlap s0-0 (new 'stack-no-clear 'vector))) + (sv-176 (new 'stack-no-clear 'vector)) + ) (let ((a0-7 (-> sv-160 prim-core))) (.lvf vf4 (&-> v1-12 quad)) (.lvf vf5 (&-> a0-7 world-sphere quad)) ) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - (vector-normalize! sv-176 1.0) - (when (and (< arg2 (-> sv-176 y)) (and (not (focus-test? (the-as process-focusable gp-0) dead hit board mech)) - (< (-> (the-as process-focusable gp-0) root transv y) 4.096) - ) - ) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (set! (-> s2-1 quad) (-> (the-as process-focusable gp-0) root transv quad)) - (let* ((v1-26 (-> (the-as process-focusable gp-0) root transv)) - (f30-0 (sqrtf (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z))))) - ) - (if (= f30-0 0.0) - (set! (-> s2-1 quad) (-> (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat)) quad)) - ) - (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + (vector-normalize! sv-176 1.0) + (when (and (< arg2 (-> sv-176 y)) (and (not (focus-test? (the-as process-focusable gp-0) dead hit board mech)) + (< (-> (the-as process-focusable gp-0) root transv y) 4.096) + ) + ) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 quad) (-> (the-as process-focusable gp-0) root transv quad)) + (let* ((v1-26 (-> (the-as process-focusable gp-0) root transv)) + (f30-0 (sqrtf (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z))))) + ) + (if (= f30-0 0.0) + (set! (-> s2-1 quad) (-> (vector-z-quaternion! s2-1 (-> (the-as process-focusable gp-0) root quat)) quad)) + ) + (vector-xz-normalize! s2-1 (fmax f30-0 arg4)) + ) + (set! (-> s2-1 y) arg3) + (send-event gp-0 'shove arg1 (static-attack-info ((id (new-attack-id)) (vector s2-1) (angle 'jump)))) ) - (set! (-> s2-1 y) arg3) - (send-event gp-0 'shove arg1 (static-attack-info ((id (new-attack-id)) (vector s2-1) (angle 'jump)))) + (return #t) ) - (return #t) ) ) - (set! s0-0 (-> s0-0 next)) ) + (set! s0-0 (-> s0-0 next)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc b/test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc index f096edfb5c..f68ced0722 100644 --- a/test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc +++ b/test/decompiler/reference/jak2/engine/collide/find-nearest_REF.gc @@ -358,12 +358,6 @@ (arg6 vector) (arg7 float) ) - (local-vars - (sv-704 (function float float float)) - (sv-720 float) - (sv-736 (function float float float)) - (sv-752 float) - ) (with-pp (let ((gp-0 *search-info*)) (set! (-> gp-0 match) #f) @@ -409,11 +403,7 @@ (let* ((s0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) s2-1 (-> gp-0 point)) 1.0)) (f28-0 (cond ((logtest? (-> gp-0 mask) (search-info-flag prefer-xz)) - (set! sv-704 deg-diff) - (set! sv-720 (vector-y-angle (-> gp-0 rot-base))) - (let ((a1-7 (vector-y-angle s0-0))) - (fabs (sv-704 sv-720 a1-7)) - ) + (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s0-0))) ) ((logtest? (-> gp-0 mask) (search-info-flag prefer-angle)) (- -9999.0 (vector-dot s0-0 (-> gp-0 rot-base))) @@ -447,15 +437,9 @@ ) ) ((logtest? (-> gp-0 mask) (search-info-flag cull-xz)) - (let ((f26-3 (-> gp-0 rot-range))) - (set! sv-736 deg-diff) - (set! sv-752 (vector-y-angle (-> gp-0 rot-base))) - (let ((a1-10 (vector-y-angle s0-0))) - (if (< f26-3 (fabs (sv-736 sv-752 a1-10))) - (goto cfg-89) - ) + (if (< (-> gp-0 rot-range) (fabs (deg-diff (vector-y-angle (-> gp-0 rot-base)) (vector-y-angle s0-0)))) + (goto cfg-89) ) - ) ) ) (when (logtest? (-> gp-0 mask) (search-info-flag back-point)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc index 6b90c81115..1840578048 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc @@ -432,7 +432,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (reset! this) (set! (-> this button-id) -1) (let ((v1-4 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) @@ -447,8 +446,9 @@ (logclear! (-> this button-status) (button-status pressed)) ) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-15 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-15)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc index 066805ca3c..26efe135a4 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc @@ -134,16 +134,12 @@ (vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 0) (-> s1-0 vector 1)) (vector-normalize! (-> s1-0 vector 2) 1.0) (matrix->quaternion (-> s2-1 quat) s1-0) - (let ((v1-20 (-> this root root-prim local-sphere))) - (set! (-> v1-20 x) 0.0) - (set! (-> v1-20 y) (* 0.00024414062 (/ height 2))) - (set! (-> v1-20 z) 0.0) - (let ((f0-17 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 height) - ) - (set! (-> v1-20 w) (* f0-17 (sqrtf (+ f1-7 (* f2-2 f2-2))))) - ) + (set-vector! + (-> this root root-prim local-sphere) + 0.0 + (* 0.00024414062 (/ height 2)) + 0.0 + (* 0.5 (sqrtf (+ (square f30-1) (square height)))) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc index 7423c3e33e..b7bdf61c71 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/collectables_REF.gc @@ -2695,182 +2695,269 @@ ;; WARN: Stack slot offset 36 signed mismatch ;; WARN: Stack slot offset 36 signed mismatch (defbehavior birth-pickup-at-point process ((arg0 vector) (arg1 pickup-type) (arg2 float) (arg3 symbol) (arg4 process-tree) (arg5 fact-info)) - (local-vars (sv-32 vector) (sv-36 float) (sv-40 (pointer process)) (sv-48 int) (sv-56 fact-info) (sv-64 int)) - (set! sv-32 (new-stack-vector0)) - (set! sv-36 (res-lump-float - (if (and arg5 (nonzero? (-> arg5 process))) - (-> arg5 process entity) + (let ((sv-32 (new-stack-vector0)) + (sv-36 (res-lump-float + (if (and arg5 (nonzero? (-> arg5 process))) + (-> arg5 process entity) + ) + 'pickup-radius + :default (cond + ((= arg1 (pickup-type buzzer)) + 0.0 ) - 'pickup-radius - :default (cond - ((= arg1 (pickup-type buzzer)) - 0.0 + ((= arg2 1.0) + 409.6 + ) + (else + 8192.0 + ) ) - ((= arg2 1.0) - 409.6 + ) + ) + (sv-40 (the-as (pointer process) #f)) + ) + (let ((sv-48 (the int arg2)) + (sv-56 (new 'static 'fact-info)) + ) + (set! (-> sv-56 options) (actor-option)) + (if arg5 + (mem-copy! (&-> sv-56 type) (&-> arg5 type) 40) + ) + (set! (-> sv-56 pickup-type) arg1) + (set! (-> sv-56 pickup-spawn-amount) 1.0) + (while (> sv-48 0) + (+! sv-48 -1) + (when arg3 + (set-vector! sv-32 0.0 57001.605 sv-36 1.0) + (vector-rotate-around-y! sv-32 sv-32 (/ (* 65536.0 (the float sv-48)) arg2)) + ) + (let ((v1-23 arg1)) + (set! sv-40 + (cond + ((= v1-23 (pickup-type eco-yellow)) + (process-spawn eco-yellow :init initialize-eco-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) ) (else - 8192.0 + (cond + ((= v1-23 (pickup-type eco-red)) + (let ((s1-2 (get-process *pickup-dead-pool* eco-red #x4000))) + (set! sv-40 + (when s1-2 + (let ((t9-7 (method-of-type eco-red activate))) + (t9-7 (the-as eco-red s1-2) arg4 (symbol->string (-> eco-red symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-2 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-2 ppointer) + ) + ) + ) + ) + ((= v1-23 (pickup-type eco-blue)) + (let ((s1-3 (get-process *pickup-dead-pool* eco-blue #x4000))) + (set! sv-40 + (when s1-3 + (let ((t9-10 (method-of-type eco-blue activate))) + (t9-10 (the-as eco-blue s1-3) arg4 (symbol->string (-> eco-blue symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-3 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-3 ppointer) + ) + ) + ) + ) + ((= v1-23 (pickup-type eco-green)) + (let ((s1-4 (get-process *pickup-dead-pool* eco-green #x4000))) + (set! sv-40 + (when s1-4 + (let ((t9-13 (method-of-type eco-green activate))) + (t9-13 (the-as eco-green s1-4) arg4 (symbol->string (-> eco-green symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-4 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-4 ppointer) + ) + ) + ) + ) + ((= v1-23 (pickup-type health)) + (set! (-> sv-56 pickup-spawn-amount) arg2) + (let ((s1-5 (get-process *pickup-dead-pool* health #x4000))) + (set! sv-40 + (when s1-5 + (let ((t9-16 (method-of-type health activate))) + (t9-16 (the-as health s1-5) arg4 (symbol->string (-> health symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-5 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-5 ppointer) + ) + ) + ) + (set! sv-48 0) + 0 + ) + ((or (= v1-23 (pickup-type eco-pill-green)) (= v1-23 (pickup-type eco-pill-dark))) + (let ((s1-6 (get-process *pickup-dead-pool* eco-pill #x4000))) + (set! sv-40 + (when s1-6 + (let ((t9-19 (method-of-type eco-pill activate))) + (t9-19 (the-as eco-pill s1-6) arg4 (symbol->string (-> eco-pill symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-6 initialize-eco-by-other arg0 sv-32 sv-56) + (-> s1-6 ppointer) + ) + ) + ) + ) + ((or (= v1-23 (pickup-type ammo-yellow)) + (= v1-23 (pickup-type ammo-red)) + (= v1-23 (pickup-type ammo-blue)) + (= v1-23 (pickup-type ammo-dark)) + (= v1-23 (pickup-type shield)) + ) + (let* ((v1-56 arg1) + (sv-64 (cond + ((= v1-56 (pickup-type ammo-red)) + 5 + ) + ((= v1-56 (pickup-type ammo-dark)) + 1 + ) + (else + 10 + ) + ) + ) + ) + (set! (-> sv-56 pickup-spawn-amount) (the float sv-64)) + (let ((s1-7 (get-process *pickup-dead-pool* ammo-collectable #x4000))) + (set! sv-40 (when s1-7 + (let ((t9-22 (method-of-type ammo-collectable activate))) + (t9-22 + (the-as ammo-collectable s1-7) + arg4 + (symbol->string (-> ammo-collectable symbol)) + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s1-7 initialize-ammo-by-other arg0 sv-32 sv-56) + (-> s1-7 ppointer) + ) + ) + ) + (set! sv-48 (- sv-48 (+ sv-64 -1))) + ) + ) + ((or (= v1-23 (pickup-type gun-yellow)) + (= v1-23 (pickup-type gun-red)) + (= v1-23 (pickup-type gun-blue)) + (= v1-23 (pickup-type gun-dark)) + (= v1-23 (pickup-type board)) + ) + (let ((s1-8 (get-process *pickup-dead-pool* upgrade-collectable #x4000))) + (set! sv-40 (when s1-8 + (let ((t9-25 (method-of-type upgrade-collectable activate))) + (t9-25 + (the-as upgrade-collectable s1-8) + arg4 + (symbol->string (-> upgrade-collectable symbol)) + (the-as pointer #x70004000) + ) + ) + (run-now-in-process s1-8 initialize-upgrade-by-other arg0 sv-32 sv-56 (-> self entity)) + (-> s1-8 ppointer) + ) + ) + ) + (set! sv-48 0) + 0 + ) + ((= v1-23 (pickup-type trick-point)) + (set! (-> sv-56 pickup-spawn-amount) arg2) + (let ((s1-9 (get-process *pickup-dead-pool* trick-point #x4000))) + (set! sv-40 + (when s1-9 + (let ((t9-28 (method-of-type trick-point activate))) + (t9-28 (the-as trick-point s1-9) arg4 (symbol->string (-> trick-point symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-9 initialize-ammo-by-other arg0 sv-32 sv-56) + (-> s1-9 ppointer) + ) + ) + ) + (set! sv-48 0) + 0 + ) + ((= v1-23 (pickup-type money)) + (let ((s1-10 (get-process *pickup-dead-pool* money #x4000))) + (set! sv-40 + (when s1-10 + (let ((t9-31 (method-of-type money activate))) + (t9-31 (the-as money s1-10) arg4 (symbol->string (-> money symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-10 money-init-by-other arg0 sv-32 sv-56 (-> self entity)) + (-> s1-10 ppointer) + ) + ) + ) + ) + ((= v1-23 (pickup-type trick-point)) + (let ((s1-11 (get-process *pickup-dead-pool* money #x4000))) + (set! sv-40 + (when s1-11 + (let ((t9-34 (method-of-type money activate))) + (t9-34 (the-as money s1-11) arg4 (symbol->string (-> money symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-11 money-init-by-other arg0 sv-32 sv-56 (-> self entity)) + (-> s1-11 ppointer) + ) + ) + ) + ) + ((= v1-23 (pickup-type gem)) + (if (>= (-> *game-info* live-gem-count) 20) + (return (the-as (pointer process) #f)) + ) + (let ((s1-12 (get-process *pickup-dead-pool* gem #x4000))) + (set! sv-40 (when s1-12 + (let ((t9-37 (method-of-type gem activate))) + (t9-37 (the-as gem s1-12) arg4 (symbol->string (-> gem symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-12 money-init-by-other arg0 sv-32 sv-56 (-> self entity)) + (-> s1-12 ppointer) + ) + ) + ) + ) + ((= v1-23 (pickup-type skill)) + (when (>= arg2 (-> *FACT-bank* super-skill-inc)) + (set! (-> sv-56 pickup-spawn-amount) arg2) + (set! sv-48 0) + 0 + ) + (let ((s1-13 (get-process *pickup-dead-pool* skill #x4000))) + (set! sv-40 + (when s1-13 + (let ((t9-40 (method-of-type skill activate))) + (t9-40 (the-as skill s1-13) arg4 (symbol->string (-> skill symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s1-13 money-init-by-other arg0 sv-32 sv-56 (-> self entity)) + (-> s1-13 ppointer) + ) + ) + ) + ) + (else + (format 0 "ERROR: unknown type of eco ~d~%" arg1) + ) + ) + sv-40 ) ) ) - ) - (set! sv-40 (the-as (pointer process) #f)) - (set! sv-48 (the int arg2)) - (set! sv-56 (new 'static 'fact-info)) - (set! (-> sv-56 options) (actor-option)) - (if arg5 - (mem-copy! (&-> sv-56 type) (&-> arg5 type) 40) - ) - (set! (-> sv-56 pickup-type) arg1) - (set! (-> sv-56 pickup-spawn-amount) 1.0) - (while (> sv-48 0) - (set! sv-48 (+ sv-48 -1)) - (when arg3 - (set-vector! sv-32 0.0 57001.605 sv-36 1.0) - (vector-rotate-around-y! sv-32 sv-32 (/ (* 65536.0 (the float sv-48)) arg2)) - ) - (case arg1 - (((pickup-type eco-yellow)) - (set! sv-40 - (process-spawn eco-yellow :init initialize-eco-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) - ) - ) - (((pickup-type eco-red)) - (set! sv-40 - (process-spawn eco-red :init initialize-eco-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) - ) - ) - (((pickup-type eco-blue)) - (set! sv-40 - (process-spawn eco-blue :init initialize-eco-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) - ) - ) - (((pickup-type eco-green)) - (set! sv-40 - (process-spawn eco-green :init initialize-eco-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) - ) - ) - (((pickup-type health)) - (set! (-> sv-56 pickup-spawn-amount) arg2) - (set! sv-40 - (process-spawn health :init initialize-eco-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) - ) - (set! sv-48 0) - 0 - ) - (((pickup-type eco-pill-green) (pickup-type eco-pill-dark)) - (set! sv-40 - (process-spawn eco-pill :init initialize-eco-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) - ) - ) - (((pickup-type ammo-yellow) - (pickup-type ammo-red) - (pickup-type ammo-blue) - (pickup-type ammo-dark) - (pickup-type shield) - ) - (let ((v1-56 arg1)) - (set! sv-64 (cond - ((= v1-56 (pickup-type ammo-red)) - 5 - ) - ((= v1-56 (pickup-type ammo-dark)) - 1 - ) - (else - 10 - ) - ) - ) - ) - (set! (-> sv-56 pickup-spawn-amount) (the float sv-64)) - (set! sv-40 (process-spawn - ammo-collectable - :init initialize-ammo-by-other - arg0 - sv-32 - sv-56 - :from *pickup-dead-pool* - :to arg4 - ) - ) - (set! sv-48 (- sv-48 (+ sv-64 -1))) - ) - (((pickup-type gun-yellow) - (pickup-type gun-red) - (pickup-type gun-blue) - (pickup-type gun-dark) - (pickup-type board) - ) - (set! sv-40 (process-spawn - upgrade-collectable - :init initialize-upgrade-by-other - arg0 - sv-32 - sv-56 - (-> self entity) - :from *pickup-dead-pool* - :to arg4 - ) - ) - (set! sv-48 0) - 0 - ) - (((pickup-type trick-point)) - (set! (-> sv-56 pickup-spawn-amount) arg2) - (set! sv-40 - (process-spawn trick-point :init initialize-ammo-by-other arg0 sv-32 sv-56 :from *pickup-dead-pool* :to arg4) - ) - (set! sv-48 0) - 0 - ) - (((pickup-type money)) - (set! sv-40 (process-spawn money arg0 sv-32 sv-56 (-> self entity) :from *pickup-dead-pool* :to arg4)) - ) - (((pickup-type trick-point)) - (set! sv-40 (process-spawn money arg0 sv-32 sv-56 (-> self entity) :from *pickup-dead-pool* :to arg4)) - ) - (((pickup-type gem)) - (if (>= (-> *game-info* live-gem-count) 20) - (return (the-as (pointer process) #f)) - ) - (set! sv-40 (process-spawn - gem - :init money-init-by-other - arg0 - sv-32 - sv-56 - (-> self entity) - :from *pickup-dead-pool* - :to arg4 - ) - ) - ) - (((pickup-type skill)) - (when (>= arg2 (-> *FACT-bank* super-skill-inc)) - (set! (-> sv-56 pickup-spawn-amount) arg2) - (set! sv-48 0) - 0 - ) - (set! sv-40 (process-spawn - skill - :init money-init-by-other - arg0 - sv-32 - sv-56 - (-> self entity) - :from *pickup-dead-pool* - :to arg4 - ) - ) - ) - (else - (format 0 "ERROR: unknown type of eco ~d~%" arg1) + ) ) ) + sv-40 ) - sv-40 ) ;; definition for method 9 of type fact-info diff --git a/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc index 4df7f9367c..824939b7a5 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/conveyor_REF.gc @@ -122,19 +122,18 @@ ;; WARN: Return type mismatch int vs none. (defmethod init! ((this conveyor)) "Initializes defaults for things like the `speed` and `belt-radius`" - (local-vars (tag res-tag)) (set! (-> this speed) 24576.0) (set! (-> this belt-radius) 11878.4) (set! (-> this pull-y-threshold) 10240.0) (set! (-> this speed-mult-array) #f) (set! (-> this speed-mult-array-len) 0) - (let ((entity (-> this entity))) - (set! tag (new 'static 'res-tag)) - (let ((scale-factor (res-lump-data entity 'scale-factor pointer :tag-ptr (& tag)))) - (when scale-factor - (set! (-> this speed-mult-array) (the-as (array float) scale-factor)) - (set! (-> this speed-mult-array-len) (the-as int (-> tag elt-count))) - ) + (let* ((entity (-> this entity)) + (tag (new 'static 'res-tag)) + (scale-factor (res-lump-data entity 'scale-factor pointer :tag-ptr (& tag))) + ) + (when scale-factor + (set! (-> this speed-mult-array) (the-as (array float) scale-factor)) + (set! (-> this speed-mult-array-len) (the-as int (-> tag elt-count))) ) ) 0 @@ -251,11 +250,7 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> this collide-bounds r))) - ) - (b! (>= f0-0 (* f1-1 f1-1)) cfg-8 :delay #f) - ) + (b! (>= a2-5 (square (+ (-> a1-2 world-sphere w) (-> this collide-bounds r)))) cfg-8 :delay #f) ) (when (< *actor-list-length* 256) (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) @@ -292,11 +287,7 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> this collide-bounds r))) - ) - (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) - ) + (b! (>= a2-12 (square (+ (-> a1-14 world-sphere w) (-> this collide-bounds r)))) cfg-17 :delay #f) ) (when (< *actor-list-length* 256) (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) @@ -352,7 +343,6 @@ ;; INFO: Used lq/sq (defmethod conveyor-method-21 ((this conveyor)) "TODO - quite dense, has to do with the conveyor sections and the path they are associated with" - (local-vars (sv-32 conveyor-section) (sv-48 conveyor-section)) (let* ((s5-0 (-> this path)) (s4-0 (-> s5-0 curve num-cverts)) (s3-0 (new 'stack-no-clear 'vector)) @@ -362,26 +352,28 @@ (set! (-> this collide-bounds quad) (the-as uint128 0)) (get-point-in-path! s5-0 s3-0 0.0 'exact) (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (let ((s1-0 (+ s4-0 -1))) - (set! sv-32 (the-as conveyor-section #f)) - (dotimes (s0-0 s1-0) - (set! sv-48 (-> s2-0 data s0-0)) - (set! (-> sv-48 start quad) (-> s3-0 quad)) - (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'exact) - (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) - (vector-normalize! (-> sv-48 pull-dir) 1.0) - (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) - (set! (-> sv-48 trailing y) 0.0) - (vector-normalize! (-> sv-48 trailing) 1.0) - (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) - (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) - (when (the-as vector sv-32) - (vector+! (&+ (the-as vector sv-32) 16) (&+ (the-as vector sv-32) 16) (the-as vector (-> sv-48 trailing))) - (vector-normalize! (&+ (the-as vector sv-32) 16) 1.0) - (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (&+ (the-as vector sv-32) 16)))) + (let ((s1-0 (+ s4-0 -1)) + (sv-32 (the-as conveyor-section #f)) + ) + (dotimes (s0-0 s1-0) + (let ((sv-48 (-> s2-0 data s0-0))) + (set! (-> sv-48 start quad) (-> s3-0 quad)) + (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'exact) + (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) + (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) + (vector-normalize! (-> sv-48 pull-dir) 1.0) + (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) + (set! (-> sv-48 trailing y) 0.0) + (vector-normalize! (-> sv-48 trailing) 1.0) + (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) + (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) + (when (the-as vector sv-32) + (vector+! (&+ (the-as vector sv-32) 16) (&+ (the-as vector sv-32) 16) (the-as vector (-> sv-48 trailing))) + (vector-normalize! (&+ (the-as vector sv-32) 16) 1.0) + (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (&+ (the-as vector sv-32) 16)))) + ) + (set! sv-32 sv-48) ) - (set! sv-32 sv-48) sv-32 ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc index cf884d6db6..075d95f7b4 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/dark-eco-pool_REF.gc @@ -319,8 +319,7 @@ ) (let* ((gp-0 (-> self draw ripple)) (f0-1 (the float (logand (current-time) #xffff))) - (f0-6 (cos (the float (sar (shl (the int (* 5.0 f0-1)) 48) 48)))) - (f0-7 (* f0-6 f0-6)) + (f0-7 (square (cos (the float (sar (shl (the int (* 5.0 f0-1)) 48) 48))))) (f0-9 (fmax -1.0 (fmin 1.0 f0-7))) ) (set! (-> gp-0 global-scale) (* 4096.0 (* 3.0 (+ 1.0 f0-9)))) diff --git a/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc index f221a742b1..e793425830 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/elevator_REF.gc @@ -257,7 +257,7 @@ (let* ((step step-amount) (f4-0 (- 1.0 step-amount)) (f3-0 (/ step (- 1.0 f4-0))) - (f2-1 (* step step)) + (f2-1 (square step)) (f1-6 (+ (* 2.0 step (- f4-0 step)) f2-1)) (f1-7 (+ (* (- 1.0 f4-0) (- 1.0 f4-0) f3-0) f1-6)) ) @@ -269,9 +269,7 @@ (+ (* 2.0 step (- value step)) f2-1) ) (else - (let ((f0-7 (- 1.0 value))) - (- f1-7 (* f0-7 f0-7 f3-0)) - ) + (- f1-7 (* (square (- 1.0 value)) f3-0)) ) ) f1-7 @@ -418,29 +416,27 @@ @param arg2 TODO @param arg3 TODO @returns [[#t]] if a point in the path was found" - (local-vars (path-point vector)) (let ((elev-params (-> this params)) (smallest-dist 0.0) (point-idx-tracker -1.0) ) (dotimes (path-vertex-idx (-> this path curve num-cverts)) - (set! path-point - (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-vertex-idx) 'interp) + (let ((path-point + (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float path-vertex-idx) 'interp) + ) ) - (when (and (or (not arg2) (< (vector-vector-xz-distance path-point arg0) (-> elev-params xz-threshold))) - (or (not arg3) - (< (fabs (- (-> path-point y) (-> arg0 y))) (-> elev-params y-threshold)) - (and (= path-vertex-idx (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> path-point y))) - (and (= path-vertex-idx (the int (-> this bottom-top 1))) (< (-> path-point y) (-> arg0 y))) - ) - ) - (let* ((t9-2 vector-vector-distance) - (a1-3 arg0) - (dist (t9-2 path-point a1-3)) - ) - (when (or (= point-idx-tracker -1.0) (< dist smallest-dist)) - (set! smallest-dist dist) - (set! point-idx-tracker (the float path-vertex-idx)) + (when (and (or (not arg2) (< (vector-vector-xz-distance path-point arg0) (-> elev-params xz-threshold))) + (or (not arg3) + (< (fabs (- (-> path-point y) (-> arg0 y))) (-> elev-params y-threshold)) + (and (= path-vertex-idx (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> path-point y))) + (and (= path-vertex-idx (the int (-> this bottom-top 1))) (< (-> path-point y) (-> arg0 y))) + ) + ) + (let ((dist (vector-vector-distance path-point arg0))) + (when (or (= point-idx-tracker -1.0) (< dist smallest-dist)) + (set! smallest-dist dist) + (set! point-idx-tracker (the float path-vertex-idx)) + ) ) ) ) @@ -481,7 +477,6 @@ "If the [[*target*]] is in a valid state and there is a point to transition to in the elevator's path do so. @see [[elevator::47]]" - (local-vars (zero float)) (let ((target *target*)) (when (and target (not (logtest? (focus-status dead inactive in-air grabbed edge-grab pole pilot-riding pilot teleporting) @@ -489,12 +484,13 @@ ) ) ) - (set! zero (the-as float 0.0)) - (when (and (find-closest-point-in-path! this (get-trans target 0) (& zero) #t #t) (!= (-> this move-pos 1) zero)) - (set! (-> this move-pos 0) (-> this move-pos 1)) - (set! (-> this move-pos 1) zero) - (logior! (-> this elevator-status) (elevator-status moving)) - (go (method-of-object this running)) + (let ((zero (the-as float 0.0))) + (when (and (find-closest-point-in-path! this (get-trans target 0) (& zero) #t #t) (!= (-> this move-pos 1) zero)) + (set! (-> this move-pos 0) (-> this move-pos 1)) + (set! (-> this move-pos 1) zero) + (logior! (-> this elevator-status) (elevator-status moving)) + (go (method-of-object this running)) + ) ) ) ) @@ -822,7 +818,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) (init-plat-collision! this) (process-drawable-from-entity! this entity) (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) @@ -860,19 +855,22 @@ ) ) ) - (set! sv-32 (the-as float 0.0)) - (set! sv-36 (-> this path)) - (set! sv-40 (the-as target (as-type *target* process-focusable))) - (if (not (and sv-40 - (logtest? (-> this params flags) (elevator-flags elevator-flags-4)) - (find-closest-point-in-path! this (get-trans sv-40 0) (& sv-32) #f #t) - ) - ) - (set! sv-32 (-> this params start-pos)) + (let ((sv-32 (the-as float 0.0)) + (sv-36 (-> this path)) + ) + (let ((sv-40 (the-as target (as-type *target* process-focusable)))) + (if (not (and sv-40 + (logtest? (-> this params flags) (elevator-flags elevator-flags-4)) + (find-closest-point-in-path! this (get-trans sv-40 0) (& sv-32) #f #t) + ) + ) + (set! sv-32 (-> this params start-pos)) + ) ) - (set! (-> this move-pos 0) sv-32) - (set! (-> this move-pos 1) sv-32) - (get-point-in-path! sv-36 (-> this basetrans) sv-32 'interp) + (set! (-> this move-pos 0) sv-32) + (set! (-> this move-pos 1) sv-32) + (get-point-in-path! sv-36 (-> this basetrans) sv-32 'interp) + ) (set! (-> this root pause-adjust-distance) (+ 122880.0 (-> this params xz-threshold) (total-distance (-> this path))) ) 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 597a73b342..09d437deb0 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 @@ -12,10 +12,10 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs (pointer sparticle-launch-group). (defun entity-lookup-part-group ((arg0 entity-actor) (arg1 (pointer string)) (arg2 symbol)) - (local-vars (sv-16 res-tag)) (let ((gp-0 (the-as object #f))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-0 (res-lump-data arg0 arg2 pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-0 (res-lump-data arg0 arg2 pointer :tag-ptr (& sv-16))) + ) (if (not s4-0) (go process-drawable-art-error (the-as string #f)) ) @@ -2048,7 +2048,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 string)) (stack-size-set! (-> this main-thread) 128) (logior! (-> this mask) (process-mask ambient)) (set! (-> this clock) (-> *display* part-clock)) @@ -2062,44 +2061,45 @@ ) ) (set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans))) - (set! sv-16 "#f") - (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) - (when (-> this mode) - (let ((a0-15 (-> this mode 0))) - (when (and (nonzero? a0-15) (= (-> a0-15 type) sparticle-launch-group)) - (cond - ((logtest? (-> a0-15 flags) (sp-group-flag unk-8)) - (countdown (v1-27 (-> a0-15 length)) - (let* ((a1-8 (-> a0-15 launcher v1-27)) - (a3-2 (-> *part-id-table* (-> a1-8 launcher))) - ) - (when (nonzero? a3-2) - (let ((a2-7 (-> this level part-engine))) - (when (and a2-7 (< (-> a2-7 length) (-> a2-7 allocated-length))) - (let ((t0-7 (-> a2-7 data (-> a2-7 length)))) - (set! (-> t0-7 next1) (the-as connectable a3-2)) - (set! (-> t0-7 prev1) (the-as connectable (-> a1-8 hour-mask))) - (set! (-> (the-as vector (&-> t0-7 param0)) quad) (-> this root trans quad)) - (set! (-> t0-7 param3) (the-as int (-> a1-8 fade-after))) + (let ((sv-16 "#f")) + (set! (-> this mode) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + (when (-> this mode) + (let ((a0-15 (-> this mode 0))) + (when (and (nonzero? a0-15) (= (-> a0-15 type) sparticle-launch-group)) + (cond + ((logtest? (-> a0-15 flags) (sp-group-flag unk-8)) + (countdown (v1-27 (-> a0-15 length)) + (let* ((a1-8 (-> a0-15 launcher v1-27)) + (a3-2 (-> *part-id-table* (-> a1-8 launcher))) + ) + (when (nonzero? a3-2) + (let ((a2-7 (-> this level part-engine))) + (when (and a2-7 (< (-> a2-7 length) (-> a2-7 allocated-length))) + (let ((t0-7 (-> a2-7 data (-> a2-7 length)))) + (set! (-> t0-7 next1) (the-as connectable a3-2)) + (set! (-> t0-7 prev1) (the-as connectable (-> a1-8 hour-mask))) + (set! (-> (the-as vector (&-> t0-7 param0)) quad) (-> this root trans quad)) + (set! (-> t0-7 param3) (the-as int (-> a1-8 fade-after))) + ) + (+! (-> a2-7 length) 1) ) - (+! (-> a2-7 length) 1) ) ) ) ) + (process-entity-status! this (entity-perm-status dead) #t) + (deactivate this) ) - (process-entity-status! this (entity-perm-status dead) #t) - (deactivate this) - ) - (else - (set! (-> this part) (create-launch-control a0-15 this)) - (go (method-of-object this active)) + (else + (set! (-> this part) (create-launch-control a0-15 this)) + (go (method-of-object this active)) + ) ) ) ) ) + (go process-drawable-art-error sv-16) ) - (go process-drawable-art-error sv-16) (none) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc index 71eb755077..ca8278af91 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc @@ -525,14 +525,14 @@ ;; WARN: Return type mismatch quaternion vs none. (defmethod offset! ((this water-anim)) "Offset a [[water-anim]]'s `trans` and `quat` by the lump data in `entity`." - (local-vars (sv-16 res-tag)) (set! (-> this play-ambient-sound?) #t) (set! (-> this visible) #t) (set! (-> this look) (res-lump-value (-> this entity) 'look int :default (the-as uint128 -1) :time -1000000000.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (& sv-16))) + ) (when v1-4 (+! (-> this root trans x) (-> v1-4 x)) (+! (-> this root trans y) (-> v1-4 y)) @@ -593,7 +593,6 @@ ;; WARN: Return type mismatch water-flags vs none. (defmethod water-anim-init! ((this water-anim)) "Initialize a [[water-anim]]." - (local-vars (sv-16 res-tag)) (set! (-> this attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) (-> this entity) 'attack-event @@ -617,19 +616,19 @@ (set! (-> this attack-id) a0-7) ) (set! (-> this target) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) - (-> this entity) - 'water-height - 'exact - -1000000000.0 - (the-as pointer #f) - (& sv-16) - *res-static-buf* - ) - ) - ) - ) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) + (-> this entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) (when v1-10 (set! (-> this water-height) (-> v1-10 0)) (set! (-> this wade-height) (-> v1-10 1)) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water-flow_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water-flow_REF.gc index 7c7dfc7fa7..868d5f7e6a 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water-flow_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water-flow_REF.gc @@ -247,14 +247,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-0 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> this collide-bounds r))) - ) - (when (< f0-0 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> this collide-bounds r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -292,11 +288,7 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-1 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> this collide-bounds r))) - ) - (b! (>= f0-1 (* f1-5 f1-5)) cfg-17 :delay #f) - ) + (b! (>= a2-12 (square (+ (-> a1-14 world-sphere w) (-> this collide-bounds r)))) cfg-17 :delay #f) ) ) (b! (>= *actor-list-length* 256) cfg-17 :delay #f) @@ -358,7 +350,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod setup ((this flow-control)) - (local-vars (sv-32 flow-section) (sv-48 flow-section)) (let* ((s5-0 (-> this path)) (s4-0 (-> s5-0 curve num-cverts)) (s3-0 (new 'stack-no-clear 'vector)) @@ -368,30 +359,32 @@ (set! (-> this collide-bounds quad) (the-as uint128 0)) (get-point-in-path! s5-0 s3-0 0.0 'interp) (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (let ((s1-0 (+ s4-0 -1))) - (set! sv-32 (the-as flow-section #f)) - (dotimes (s0-0 s1-0) - (set! sv-48 (-> s2-0 data s0-0)) - (set! (-> sv-48 start quad) (-> s3-0 quad)) - (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'interp) - (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) - (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) - (vector-normalize! (-> sv-48 pull-dir) 1.0) - (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) - (set! (-> sv-48 trailing y) 0.0) - (vector-normalize! (-> sv-48 trailing) 1.0) - (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) - (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) - (when sv-32 - (vector+! - (the-as vector (-> sv-32 trailing)) - (the-as vector (-> sv-32 trailing)) - (the-as vector (-> sv-48 trailing)) - ) - (vector-normalize! (-> sv-32 trailing) 1.0) - (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (the-as vector (-> sv-32 trailing))))) + (let ((s1-0 (+ s4-0 -1)) + (sv-32 (the-as flow-section #f)) + ) + (dotimes (s0-0 s1-0) + (let ((sv-48 (-> s2-0 data s0-0))) + (set! (-> sv-48 start quad) (-> s3-0 quad)) + (get-point-in-path! s5-0 s3-0 (the float (+ s0-0 1)) 'interp) + (vector+! (the-as vector (-> this collide-bounds)) (the-as vector (-> this collide-bounds)) s3-0) + (vector-! (-> sv-48 pull-dir) s3-0 (-> sv-48 start)) + (vector-normalize! (-> sv-48 pull-dir) 1.0) + (set! (-> sv-48 trailing quad) (-> sv-48 pull-dir quad)) + (set! (-> sv-48 trailing y) 0.0) + (vector-normalize! (-> sv-48 trailing) 1.0) + (set-vector! (-> sv-48 radial-dir) (- (-> sv-48 trailing z)) 0.0 (-> sv-48 trailing x) 1.0) + (set! (-> sv-48 trailing w) (- (vector-dot s3-0 (the-as vector (-> sv-48 trailing))))) + (when sv-32 + (vector+! + (the-as vector (-> sv-32 trailing)) + (the-as vector (-> sv-32 trailing)) + (the-as vector (-> sv-48 trailing)) + ) + (vector-normalize! (-> sv-32 trailing) 1.0) + (set! (-> sv-32 trailing w) (- (vector-dot (-> sv-48 start) (the-as vector (-> sv-32 trailing))))) + ) + (set! sv-32 sv-48) ) - (set! sv-32 sv-48) sv-32 ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc index 9fd5dfb415..79e3e887ef 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc @@ -699,11 +699,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod water-control-method-10 ((this water-control)) - (local-vars - (sv-272 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-288 vector) - (sv-304 entity-actor) - ) (with-pp (let ((s4-0 (-> this flags)) (s5-0 (new 'stack-no-clear 'water-info)) @@ -805,37 +800,18 @@ (when (and (not (handle->process (-> this ripple))) (>= (+ (current-time) (seconds -1.5)) (-> this enter-water-time)) ) - (let* ((s1-0 (get-process *default-dead-pool* manipy #x4000)) - (s2-0 - (when s1-0 - (let ((t9-6 (method-of-type manipy activate))) - (t9-6 (the-as manipy s1-0) (-> this process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-1 run-function-in-process) - (s0-0 s1-0) - ) - (set! sv-272 manipy-init) - (set! sv-288 s3-0) - (set! sv-304 (-> this process entity)) - (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) - (t1-0 #f) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s2-1) - s0-0 - sv-272 - sv-288 - sv-304 - t0-0 - t1-0 - t2-0 - ) - ) - ) - (-> s1-0 ppointer) - ) - ) - ) + (let ((s2-0 (process-spawn + manipy + :init manipy-init + s3-0 + (-> this process entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to (-> this process) + ) + ) + ) (set! (-> this ripple) (ppointer->handle s2-0)) (when s2-0 (send-event (ppointer->process s2-0) 'anim-mode 'loop) @@ -1548,7 +1524,6 @@ ;; INFO: Used lq/sq (defmethod water-info-init! ((this collide-shape) (arg0 water-info) (arg1 collide-action)) "Initialize a [[water-info]] with the currently loaded regions." - (local-vars (sv-80 int)) (let ((s3-0 (new 'stack 'water-info))) (set! (-> s3-0 flags) (water-flags)) (set! (-> s3-0 handle) (the-as handle #f)) @@ -1563,21 +1538,21 @@ (when (= (-> v1-8 status) 'active) (let ((s1-0 (-> v1-8 bsp region-trees))) (when (nonzero? s1-0) - (let ((s0-0 (-> s1-0 length))) - (set! sv-80 0) - (let ((a0-10 (-> s1-0 sv-80))) - (while (< sv-80 s0-0) - (if (= (-> a0-10 name) 'water) - (collect-regions - a0-10 - (the-as sphere (-> (the-as region-prim-area #x70000000) pos)) - 0 - (-> (the-as region-prim-area #x70000000) region-prim-list) - ) + (let* ((s0-0 (-> s1-0 length)) + (sv-80 0) + (a0-10 (-> s1-0 sv-80)) + ) + (while (< sv-80 s0-0) + (if (= (-> a0-10 name) 'water) + (collect-regions + a0-10 + (the-as sphere (-> (the-as region-prim-area #x70000000) pos)) + 0 + (-> (the-as region-prim-area #x70000000) region-prim-list) ) - (set! sv-80 (+ sv-80 1)) - (set! a0-10 (-> s1-0 sv-80)) - ) + ) + (+! sv-80 1) + (set! a0-10 (-> s1-0 sv-80)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/debug-sphere_REF.gc b/test/decompiler/reference/jak2/engine/debug/debug-sphere_REF.gc index 4f37303f10..e2ce725db7 100644 --- a/test/decompiler/reference/jak2/engine/debug/debug-sphere_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/debug-sphere_REF.gc @@ -4,7 +4,6 @@ ;; definition for function make-debug-sphere-table ;; INFO: Used lq/sq (defun make-debug-sphere-table ((points vector-array) (h-lines float) (v-lines float)) - (local-vars (next-hz vector) (next-vt vector) (h-line int)) (let ((offset (new-stack-vector0)) (scale 1.0) (num-points 0) @@ -14,27 +13,29 @@ (let ((f28-0 (* scale (sin (* (the float v-line) (/ 32768.0 v-lines))))) (f26-0 (* scale (sin (* (the float (+ v-line 1)) (/ 32768.0 v-lines))))) (current (new-stack-vector0)) + (next-hz (new 'stack-no-clear 'vector)) ) - (set! next-hz (new 'stack-no-clear 'vector)) (set! (-> next-hz quad) (the-as uint128 0)) - (set! next-vt (new 'stack-no-clear 'vector)) - (set! (-> next-vt quad) (the-as uint128 0)) - (set! (-> current y) (+ (-> offset y) (* (cos (* (the float v-line) (/ 32768.0 v-lines))) scale))) - (set! (-> next-hz y) (-> current y)) - (set! (-> next-vt y) (+ (-> offset y) (* (cos (* (the float (+ v-line 1)) (/ 32768.0 v-lines))) scale))) - (set! h-line 0) - (while (< h-line (the int h-lines)) - (set! (-> current x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) - (set! (-> current z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) - (set! (-> next-hz x) (+ (-> offset x) (* (cos (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) - (set! (-> next-hz z) (+ (-> offset z) (* (sin (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) - (set! (-> next-vt x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) - (set! (-> next-vt z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) - (set! (-> points data num-points quad) (-> current quad)) - (set! (-> points data (+ num-points 1) quad) (-> next-hz quad)) - (set! (-> points data (+ num-points 2) quad) (-> next-vt quad)) - (+! num-points 3) - (set! h-line (+ h-line 1)) + (let ((next-vt (new 'stack-no-clear 'vector))) + (set! (-> next-vt quad) (the-as uint128 0)) + (set! (-> current y) (+ (-> offset y) (* (cos (* (the float v-line) (/ 32768.0 v-lines))) scale))) + (set! (-> next-hz y) (-> current y)) + (set! (-> next-vt y) (+ (-> offset y) (* (cos (* (the float (+ v-line 1)) (/ 32768.0 v-lines))) scale))) + (let ((h-line 0)) + (while (< h-line (the int h-lines)) + (set! (-> current x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) + (set! (-> current z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f28-0))) + (set! (-> next-hz x) (+ (-> offset x) (* (cos (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) + (set! (-> next-hz z) (+ (-> offset z) (* (sin (* (the float (+ h-line 1)) (/ 65536.0 h-lines))) f28-0))) + (set! (-> next-vt x) (+ (-> offset x) (* (cos (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) + (set! (-> next-vt z) (+ (-> offset z) (* (sin (* (the float h-line) (/ 65536.0 h-lines))) f26-0))) + (set! (-> points data num-points quad) (-> current quad)) + (set! (-> points data (+ num-points 1) quad) (-> next-hz quad)) + (set! (-> points data (+ num-points 2) quad) (-> next-vt quad)) + (+! num-points 3) + (+! h-line 1) + ) + ) ) ) ) @@ -53,7 +54,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun add-debug-sphere-from-table ((bucket bucket-id) (position vector) (radius meters) (color rgba) (table-idx int)) - (local-vars (sphere-points vector-array) (point-3 vector)) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) @@ -68,12 +68,12 @@ ) ) ) - (set! sphere-points (-> *debug-sphere-table* table-idx)) - (set! point-3 (the-as vector (new-stack-vector0))) - (let ((point-1 (new-stack-vector0)) - (point-2 (new-stack-vector0)) - (points (-> sphere-points data)) - ) + (let* ((sphere-points (-> *debug-sphere-table* table-idx)) + (point-3 (the-as vector (new-stack-vector0))) + (point-1 (new-stack-vector0)) + (point-2 (new-stack-vector0)) + (points (-> sphere-points data)) + ) (.lvf vf1 (&-> position quad)) (.mov vf2 radius) (countdown (s4-1 (/ (-> sphere-points length) 3)) diff --git a/test/decompiler/reference/jak2/engine/debug/debug_REF.gc b/test/decompiler/reference/jak2/engine/debug/debug_REF.gc index 3db7e00446..4c59eec902 100644 --- a/test/decompiler/reference/jak2/engine/debug/debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/debug_REF.gc @@ -156,9 +156,8 @@ ;; definition (debug) for function internal-draw-debug-line ;; INFO: Used lq/sq (defun-debug internal-draw-debug-line ((bucket bucket-id) (start vector) (end vector) (start-color rgba) (mode symbol) (end-color rgba)) - (local-vars (var-end vector) (sv-128 vector) (sv-144 vector)) - (set! var-end end) - (let ((var-start-color start-color) + (let ((var-end end) + (var-start-color start-color) (var-mode mode) (var-end-color end-color) ) @@ -183,9 +182,9 @@ ) (let ((s4-0 (new 'stack 'vector4w-2)) (s3-0 (new 'stack 'vector4w-2)) + (sv-128 (new 'stack-no-clear 'vector)) + (sv-144 (new 'stack-no-clear 'vector)) ) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-144 (new 'stack-no-clear 'vector)) (when (debug-line-clip? sv-128 sv-144 start var-end) (set! (-> sv-128 w) 1.0) (set! (-> sv-144 w) 1.0) @@ -345,10 +344,9 @@ ;; definition (debug) for function add-debug-flat-triangle ;; INFO: Used lq/sq (defun-debug add-debug-flat-triangle ((enable symbol) (bucket bucket-id) (p0 vector) (p1 vector) (p2 vector) (color rgba)) - (local-vars (sv-160 vector) (sv-176 vector)) - (set! sv-160 p0) - (set! sv-176 p1) - (let ((s0-0 p2) + (let ((sv-160 p0) + (sv-176 p1) + (s0-0 p2) (s3-0 color) ) (if (not enable) @@ -1039,73 +1037,61 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Return type mismatch int vs none. (defun-debug add-debug-line-sphere ((enable symbol) (bucket bucket-id) (position vector) (forward vector) (arg4 float) (color rgba)) - (local-vars - (var-bucket bucket-id) - (var-position vector) - (var-forward vector) - (var-arg4 float) - (var-color rgba) - (mat matrix) - (forward-length float) - ) (b! (not enable) cfg-8 :delay (nop!)) - (set! var-bucket bucket) - (set! var-position position) - (set! var-forward forward) - (set! var-arg4 arg4) - (set! var-color color) - (set! mat (new 'stack-no-clear 'matrix)) - (set! forward-length (vector-length var-forward)) - (let ((mat-forward (new 'stack-no-clear 'vector)) - (mat-down (new 'stack-no-clear 'vector)) - ) - (vector-normalize-copy! mat-forward var-forward 1.0) - (vector-reset! mat-down) - (let* ((f0-2 (-> mat-forward y)) - (f0-4 (* f0-2 f0-2)) - (f1-0 (-> mat-forward z)) - ) - (if (< f0-4 (* f1-0 f1-0)) + (let* ((var-bucket bucket) + (var-position position) + (var-forward forward) + (var-arg4 arg4) + (var-color color) + (mat (new 'stack-no-clear 'matrix)) + (forward-length (vector-length var-forward)) + ) + (let ((mat-forward (new 'stack-no-clear 'vector)) + (mat-down (new 'stack-no-clear 'vector)) + ) + (vector-normalize-copy! mat-forward var-forward 1.0) + (vector-reset! mat-down) + (if (< (square (-> mat-forward y)) (square (-> mat-forward z))) (set! (-> mat-down y) -1.0) (set! (-> mat-down z) -1.0) ) + (forward-down->inv-matrix mat mat-forward mat-down) ) - (forward-down->inv-matrix mat mat-forward mat-down) - ) - (set! (-> mat trans quad) (-> var-position quad)) - (set! (-> mat trans w) 1.0) - (let ((gp-1 (new 'static 'inline-array vector 3 - (new 'static 'vector :y 0.5877 :z 0.951 :w 0.951) - (new 'static 'vector :x 0.5877 :z -0.5877 :w -0.951) - (new 'static 'vector :x -0.951 :y -0.5878) + (set! (-> mat trans quad) (-> var-position quad)) + (set! (-> mat trans w) 1.0) + (let ((gp-1 (new 'static 'inline-array vector 3 + (new 'static 'vector :y 0.5877 :z 0.951 :w 0.951) + (new 'static 'vector :x 0.5877 :z -0.5877 :w -0.951) + (new 'static 'vector :x -0.951 :y -0.5878) + ) ) - ) - (s5-1 (new 'static 'inline-array vector 3 - (new 'static 'vector :x 1.0 :y 0.809 :z 0.3089 :w -0.3088) - (new 'static 'vector :x -0.809 :y -1.0 :z -0.809 :w -0.309) - (new 'static 'vector :x 0.3089 :y 0.8089) + (s5-1 (new 'static 'inline-array vector 3 + (new 'static 'vector :x 1.0 :y 0.809 :z 0.3089 :w -0.3088) + (new 'static 'vector :x -0.809 :y -1.0 :z -0.809 :w -0.309) + (new 'static 'vector :x 0.3089 :y 0.8089) + ) ) - ) - (s4-0 (new 'stack-no-clear 'vector)) - (s3-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - ) - (set! (-> s1-0 z) 0.0) - (set! (-> s1-0 w) 1.0) - (set! (-> s1-0 x) (* var-arg4 (-> s5-1 2 y))) - (set! (-> s1-0 y) (* var-arg4 (-> gp-1 2 y))) - (vector-matrix*! s3-0 s1-0 mat) - (dotimes (i 10) - (set! (-> s4-0 quad) (-> s3-0 quad)) - (set! (-> s1-0 x) (* var-arg4 (-> (&-> s5-1 0 data i) 0))) - (set! (-> s1-0 y) (* var-arg4 (-> (&-> gp-1 0 data i) 0))) + (s4-0 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s1-0 z) 0.0) + (set! (-> s1-0 w) 1.0) + (set! (-> s1-0 x) (* var-arg4 (-> s5-1 2 y))) + (set! (-> s1-0 y) (* var-arg4 (-> gp-1 2 y))) (vector-matrix*! s3-0 s1-0 mat) - (add-debug-line #t var-bucket s4-0 s3-0 var-color #f (the-as rgba -1)) - (vector+float*! s2-0 s3-0 (-> mat vector 2) forward-length) - (add-debug-line #t var-bucket s3-0 s2-0 var-color #f (the-as rgba -1)) - (vector+float*! s4-0 s4-0 (-> mat vector 2) forward-length) - (add-debug-line #t var-bucket s4-0 s2-0 var-color #f (the-as rgba -1)) + (dotimes (i 10) + (set! (-> s4-0 quad) (-> s3-0 quad)) + (set! (-> s1-0 x) (* var-arg4 (-> (&-> s5-1 0 data i) 0))) + (set! (-> s1-0 y) (* var-arg4 (-> (&-> gp-1 0 data i) 0))) + (vector-matrix*! s3-0 s1-0 mat) + (add-debug-line #t var-bucket s4-0 s3-0 var-color #f (the-as rgba -1)) + (vector+float*! s2-0 s3-0 (-> mat vector 2) forward-length) + (add-debug-line #t var-bucket s3-0 s2-0 var-color #f (the-as rgba -1)) + (vector+float*! s4-0 s4-0 (-> mat vector 2) forward-length) + (add-debug-line #t var-bucket s4-0 s2-0 var-color #f (the-as rgba -1)) + ) ) ) (label cfg-8) @@ -1117,27 +1103,28 @@ ;; INFO: Used lq/sq (defun-debug add-debug-circle ((enable symbol) (bucket bucket-id) (position vector) (radius float) (color rgba) (orientation matrix)) "note: you may pass #f for orientation" - (local-vars (i int) (sv-64 vector) (sv-80 vector)) (if (not enable) (return #f) ) (let ((angle 0.0) (line-start (new-stack-vector0)) (line-end (new-stack-vector0)) + (i 0) ) - (set! i 0) (while (< i 12) - (set! sv-64 line-start) - (set! (-> sv-64 x) (* radius (cos angle))) - (set! (-> sv-64 y) 0.0) - (set! (-> sv-64 z) (* radius (sin angle))) - (set! (-> sv-64 w) 1.0) + (let ((sv-64 line-start)) + (set! (-> sv-64 x) (* radius (cos angle))) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) (* radius (sin angle))) + (set! (-> sv-64 w) 1.0) + ) (set! angle (+ 5461.3335 angle)) - (set! sv-80 line-end) - (set! (-> sv-80 x) (* radius (cos angle))) - (set! (-> sv-80 y) 0.0) - (set! (-> sv-80 z) (* radius (sin angle))) - (set! (-> sv-80 w) 1.0) + (let ((sv-80 line-end)) + (set! (-> sv-80 x) (* radius (cos angle))) + (set! (-> sv-80 y) 0.0) + (set! (-> sv-80 z) (* radius (sin angle))) + (set! (-> sv-80 w) 1.0) + ) (when orientation (vector-matrix*! line-start line-start orientation) (vector-matrix*! line-end line-end orientation) @@ -1145,7 +1132,7 @@ (vector+! line-start line-start position) (vector+! line-end line-end position) (add-debug-line #t bucket line-start line-end color #f (the-as rgba -1)) - (set! i (+ i 1)) + (+! i 1) ) ) #f @@ -1230,9 +1217,8 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 (defun-debug add-debug-yrot-vector ((enable symbol) (bucket bucket-id) (position vector) (angle float) (line-length float) (color rgba)) - (local-vars (var-angle float)) - (set! var-angle angle) - (let ((var-line-length line-length) + (let ((var-angle angle) + (var-line-length line-length) (var-color color) ) (if (not enable) @@ -1264,44 +1250,48 @@ (orientation matrix) ) "note: you may pass #f for orientation" - (local-vars (line-start vector) (line-end vector) (i int) (sv-96 vector) (sv-112 vector)) (if (not enable) (return #f) ) - (let ((angle start-angle)) - (set! line-start (new 'stack-no-clear 'vector)) + (let ((angle start-angle) + (line-start (new 'stack-no-clear 'vector)) + ) (set! (-> line-start quad) (the-as uint128 0)) - (set! line-end (new 'stack-no-clear 'vector)) - (set! (-> line-end quad) (the-as uint128 0)) - (set! i 0) - (while (< i 12) - (set! sv-96 line-start) - (set! (-> sv-96 x) (* radius (sin angle))) - (set! (-> sv-96 y) 0.0) - (set! (-> sv-96 z) (* radius (cos angle))) - (set! (-> sv-96 w) 1.0) - (+! angle (the float (/ (the int (- end-angle start-angle)) 12))) - (set! sv-112 line-end) - (set! (-> sv-112 x) (* radius (sin angle))) - (set! (-> sv-112 y) 0.0) - (set! (-> sv-112 z) (* radius (cos angle))) - (set! (-> sv-112 w) 1.0) - (when orientation - (vector-matrix*! line-start line-start orientation) - (vector-matrix*! line-end line-end orientation) + (let ((line-end (new 'stack-no-clear 'vector))) + (set! (-> line-end quad) (the-as uint128 0)) + (let ((i 0)) + (while (< i 12) + (let ((sv-96 line-start)) + (set! (-> sv-96 x) (* radius (sin angle))) + (set! (-> sv-96 y) 0.0) + (set! (-> sv-96 z) (* radius (cos angle))) + (set! (-> sv-96 w) 1.0) + ) + (+! angle (the float (/ (the int (- end-angle start-angle)) 12))) + (let ((sv-112 line-end)) + (set! (-> sv-112 x) (* radius (sin angle))) + (set! (-> sv-112 y) 0.0) + (set! (-> sv-112 z) (* radius (cos angle))) + (set! (-> sv-112 w) 1.0) + ) + (when orientation + (vector-matrix*! line-start line-start orientation) + (vector-matrix*! line-end line-end orientation) + ) + (vector+! line-start line-start position) + (vector+! line-end line-end position) + (add-debug-line #t bucket line-start line-end color #f (the-as rgba -1)) + (cond + ((zero? i) + (add-debug-line #t bucket line-start position color #f (the-as rgba -1)) + ) + ((= i 11) + (add-debug-line #t bucket line-end position color #f (the-as rgba -1)) + ) + ) + (+! i 1) + ) ) - (vector+! line-start line-start position) - (vector+! line-end line-end position) - (add-debug-line #t bucket line-start line-end color #f (the-as rgba -1)) - (cond - ((zero? i) - (add-debug-line #t bucket line-start position color #f (the-as rgba -1)) - ) - ((= i 11) - (add-debug-line #t bucket line-end position color #f (the-as rgba -1)) - ) - ) - (set! i (+ i 1)) ) ) #f @@ -1317,21 +1307,23 @@ (num-knots int) (color rgba) ) - (local-vars (p1 vector) (iterations int) (i int)) (if (not enable) (return #f) ) - (let ((p0 (new-stack-vector0))) - (set! p1 (new 'stack-no-clear 'vector)) + (let ((p0 (new-stack-vector0)) + (p1 (new 'stack-no-clear 'vector)) + ) (set! (-> p1 quad) (the-as uint128 0)) - (set! iterations (* num-cverts 4)) - (curve-evaluate! p1 (-> knots 0) cverts num-cverts knots num-knots) - (set! i 0) - (while (< i iterations) - (set! (-> p0 quad) (-> p1 quad)) - (curve-evaluate! p1 (/ (the float (+ i 1)) (the float iterations)) cverts num-cverts knots num-knots) - (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) - (set! i (+ i 1)) + (let ((iterations (* num-cverts 4))) + (curve-evaluate! p1 (-> knots 0) cverts num-cverts knots num-knots) + (let ((i 0)) + (while (< i iterations) + (set! (-> p0 quad) (-> p1 quad)) + (curve-evaluate! p1 (/ (the float (+ i 1)) (the float iterations)) cverts num-cverts knots num-knots) + (add-debug-line #t bucket p0 p1 color #f (the-as rgba -1)) + (+! i 1) + ) + ) ) ) #f @@ -1363,48 +1355,26 @@ (y-override float) (highlight int) ) - (local-vars - (sv-32 (function symbol bucket-id string vector font-color vector2h symbol)) - (sv-48 symbol) - (sv-64 bucket-id) - (sv-80 (function _varargs_ object)) - (position vector) - ) (when enable (dotimes (i num-points) - (set! position (new 'stack-no-clear 'vector)) - (set! (-> position quad) (the-as uint128 0)) - (set! (-> position quad) (-> points i quad)) - (if (!= y-override 0.0) - (set! (-> position y) y-override) + (let ((position (new 'stack-no-clear 'vector))) + (set! (-> position quad) (the-as uint128 0)) + (set! (-> position quad) (-> points i quad)) + (if (!= y-override 0.0) + (set! (-> position y) y-override) + ) + (let ((sv-32 add-debug-text-3d) + (sv-48 #t) + (sv-64 bucket) + ) + (format (clear *temp-string*) "~d" i) + (sv-32 sv-48 sv-64 *temp-string* position (font-color white) (the-as vector2h #f)) ) - (set! sv-32 add-debug-text-3d) - (set! sv-48 #t) - (set! sv-64 bucket) - (set! sv-80 format) - (let ((a0-5 (clear *temp-string*)) - (a1-1 "~d") - (a2-1 i) - ) - (sv-80 a0-5 a1-1 a2-1) - ) - (let ((a2-2 *temp-string*) - (a3-1 position) - (t0-1 1) - (t1-1 #f) - ) - (sv-32 sv-48 sv-64 a2-2 a3-1 (the-as font-color t0-1) (the-as vector2h t1-1)) - ) - (let ((t9-3 add-debug-x) - (a0-7 #t) - (a1-3 bucket) - (a3-2 (if (= i highlight) - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) - color - ) - ) - ) - (t9-3 a0-7 a1-3 position a3-2) + (add-debug-x #t bucket position (if (= i highlight) + (the-as rgba (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80)) + (the-as rgba color) + ) + ) ) ) ) @@ -1416,10 +1386,9 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Stack slot offset 32 signed mismatch (defun-debug debug-percent-bar ((enable symbol) (bucket bucket-id) (x int) (y int) (percentage float) (color rgba) (width int) (height int)) - (local-vars (sv-16 int) (sv-32 float)) - (set! sv-16 y) - (set! sv-32 percentage) - (let ((s2-0 color) + (let ((sv-16 y) + (sv-32 percentage) + (s2-0 color) (s1-0 width) (s3-0 height) ) @@ -1867,44 +1836,51 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function add-debug-bound has a return type of none, but the expression builder found a return statement. (defun-debug add-debug-bound ((buf bucket-id) (pts (inline-array vector)) (c0 int) (c1 rgba) (flash rgba) (arg5 int)) - (local-vars (sv-16 pointer) (sv-32 int)) - (set! sv-32 arg5) - (if (< c0 3) - (return 0) + (let ((sv-32 arg5)) + (if (< c0 3) + (return 0) + ) + (case sv-32 + ((1) + (set! sv-32 (cond + ((logtest? (-> *display* real-frame-clock integral-frame-counter) 4) + (set! sv-32 1) + sv-32 + ) + (else + 0 + ) + ) + ) + sv-32 + ) ) - (case sv-32 - ((1) - (if (logtest? (-> *display* real-frame-clock integral-frame-counter) 4) - (set! sv-32 1) - (set! sv-32 0) - ) - sv-32 - ) - ) - (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) - buf - ) - (dma-buffer-add-gs-set s4-0 - (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) - (test-1 (new 'static 'gs-test - :ate #x1 - :atst (gs-atest greater-equal) - :aref #x26 - :zte #x1 - :ztst (gs-ztest greater-equal) + (with-dma-buffer-add-bucket ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + buf + ) + (dma-buffer-add-gs-set s4-0 + (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24))) + (test-1 (new 'static 'gs-test + :ate #x1 + :atst (gs-atest greater-equal) + :aref #x26 + :zte #x1 + :ztst (gs-ztest greater-equal) + ) ) - ) - (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) - ) - (set! sv-16 (-> s4-0 base)) - (&+! (-> s4-0 base) 16) - (add-boundary-shader (new 'static 'texture-id :index #x3 :page #x70c) s4-0) - (add-debug-bound-internal s4-0 pts c0 c1 flash sv-32) - (close-sky-buffer s4-0) - (let ((v1-25 (/ (the-as int (+ (- -16 (the-as int sv-16)) (the-as int (-> s4-0 base)))) 16))) - (set! (-> (the-as dma-packet sv-16) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-25)) - (set! (-> (the-as dma-packet sv-16) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet sv-16) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-25)) + (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) + ) + (let ((sv-16 (-> s4-0 base))) + (&+! (-> s4-0 base) 16) + (add-boundary-shader (new 'static 'texture-id :index #x3 :page #x70c) s4-0) + (add-debug-bound-internal s4-0 pts c0 c1 flash sv-32) + (close-sky-buffer s4-0) + (let ((v1-25 (/ (the-as int (+ (- -16 (the-as int sv-16)) (the-as int (-> s4-0 base)))) 16))) + (set! (-> (the-as dma-packet sv-16) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc v1-25)) + (set! (-> (the-as dma-packet sv-16) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet sv-16) vif1) (new 'static 'vif-tag :cmd (vif-cmd direct) :msk #x1 :imm v1-25)) + ) + ) ) ) 0 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 c1524e44cf..47ce31eee8 100644 --- a/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/default-menu_REF.gc @@ -2732,20 +2732,6 @@ ;; definition for function debug-menu-make-continue-sub-menu ;; INFO: Used lq/sq (defun debug-menu-make-continue-sub-menu ((arg0 game-info) (arg1 symbol)) - (local-vars - (sv-16 (function symbol type object object pair)) - (sv-32 symbol) - (sv-48 type) - (sv-64 symbol) - (sv-80 (function symbol type object object pair)) - (sv-96 symbol) - (sv-112 type) - (sv-128 string) - (sv-144 (function symbol type object object pair)) - (sv-160 symbol) - (sv-176 type) - (sv-192 string) - ) (let ((s4-0 *level-load-list*) (s5-0 '()) ) @@ -2757,34 +2743,20 @@ (let ((v1-2 (car s3-0)) (a0-5 arg1) ) - (when (if (= a0-5 'test) - (logtest? (continue-flags test) (-> (the-as continue-point v1-2) flags)) - #t - ) - (let ((s2-0 (method-of-type pair new)) - (s1-0 'global) - (s0-0 pair) + (if (if (= a0-5 'test) + (logtest? (continue-flags test) (-> (the-as continue-point v1-2) flags)) + #t ) - (set! sv-16 (method-of-type pair new)) - (set! sv-32 'global) - (set! sv-48 pair) - (set! sv-64 'flag) - (set! sv-80 (method-of-type pair new)) - (set! sv-96 'global) - (set! sv-112 pair) - (set! sv-128 (-> (the-as continue-point v1-2) name)) - (set! sv-144 (method-of-type pair new)) - (set! sv-160 'global) - (set! sv-176 pair) - (set! sv-192 (-> (the-as continue-point v1-2) name)) - (let* ((a3-1 (cons 'dm-current-continue '())) - (a3-2 (sv-144 sv-160 sv-176 sv-192 a3-1)) - (a3-3 (sv-80 sv-96 sv-112 sv-128 a3-2)) - ) - (set! s5-0 (s2-0 s1-0 s0-0 (sv-16 sv-32 sv-48 sv-64 a3-3) s5-0)) - ) + (set! s5-0 (cons + (cons 'flag (cons + (-> (the-as continue-point v1-2) name) + (cons (-> (the-as continue-point v1-2) name) (cons 'dm-current-continue '())) + ) + ) + s5-0 + ) + ) ) - ) ) (set! s3-0 (cdr s3-0)) ) @@ -2810,50 +2782,16 @@ ;; INFO: Used lq/sq (defun debug-menu-make-task-sub-menu ((arg0 symbol)) "TODO - need to know more about game-info" - (local-vars - (sv-16 (function symbol type object object pair)) - (sv-32 symbol) - (sv-48 type) - (sv-64 symbol) - (sv-80 (function symbol type object object pair)) - (sv-96 symbol) - (sv-112 type) - (sv-128 string) - (sv-144 (function symbol type object object pair)) - (sv-160 symbol) - (sv-176 type) - (sv-192 int) - ) (let ((gp-0 '())) (let ((s4-0 (-> *game-info* sub-task-list))) (countdown (s3-0 (-> s4-0 length)) (when (nonzero? s3-0) (let ((v1-4 (-> s4-0 s3-0))) - (when (= (-> v1-4 level) arg0) - (let ((s2-0 (method-of-type pair new)) - (s1-0 'global) - (s0-0 pair) - ) - (set! sv-16 (method-of-type pair new)) - (set! sv-32 'global) - (set! sv-48 pair) - (set! sv-64 'flag) - (set! sv-80 (method-of-type pair new)) - (set! sv-96 'global) - (set! sv-112 pair) - (set! sv-128 (-> v1-4 name)) - (set! sv-144 (method-of-type pair new)) - (set! sv-160 'global) - (set! sv-176 pair) - (set! sv-192 (* s3-0 8)) - (let* ((a3-1 (cons 'dm-task-menu-pick-func '())) - (a3-2 (sv-144 sv-160 sv-176 sv-192 a3-1)) - (a3-3 (sv-80 sv-96 sv-112 sv-128 a3-2)) - ) - (set! gp-0 (s2-0 s1-0 s0-0 (sv-16 sv-32 sv-48 sv-64 a3-3) gp-0)) - ) + (if (= (-> v1-4 level) arg0) + (set! gp-0 + (cons (cons 'flag (cons (-> v1-4 name) (cons (* s3-0 8) (cons 'dm-task-menu-pick-func '())))) gp-0) + ) ) - ) ) ) ) @@ -2865,7 +2803,6 @@ ;; definition for function debug-menu-make-task-menu ;; INFO: Used lq/sq (defun debug-menu-make-task-menu ((arg0 debug-menu-context)) - (local-vars (sv-16 debug-menu-context)) (let* ((s5-0 (new 'debug 'debug-menu arg0 "Task menu")) (s4-0 (new 'debug 'debug-menu-item-submenu "Task" s5-0)) ) @@ -2894,14 +2831,9 @@ (a0-3 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s2-0 debug-menu-append-item) - (s1-0 s5-0) - (s0-0 debug-menu-make-from-template) - ) - (set! sv-16 arg0) - (let ((a1-2 (debug-menu-make-task-sub-menu (the-as symbol a0-3)))) - (s2-0 s1-0 (s0-0 sv-16 a1-2)) - ) + (debug-menu-append-item + s5-0 + (debug-menu-make-from-template arg0 (debug-menu-make-task-sub-menu (the-as symbol a0-3))) ) (set! s3-0 (cdr s3-0)) (set! a0-3 (car s3-0)) @@ -3012,47 +2944,12 @@ ;; definition for function debug-menu-make-play-menu ;; INFO: Used lq/sq (defun debug-menu-make-play-menu ((arg0 debug-menu-context)) - (local-vars - (sv-16 symbol) - (sv-32 type) - (sv-48 symbol) - (sv-64 (function symbol type object object pair)) - (sv-80 symbol) - (sv-96 type) - (sv-112 string) - (sv-128 (function symbol type object object pair)) - (sv-144 symbol) - (sv-160 type) - (sv-176 int) - ) (let ((gp-0 '())) (countdown (s4-0 (-> *game-info* play-list length)) (let ((v1-4 (-> *game-info* play-list s4-0))) - (when (-> v1-4 play-continue) - (let ((s3-0 (method-of-type pair new)) - (s2-0 'global) - (s1-0 pair) - (s0-0 (method-of-type pair new)) - ) - (set! sv-16 'global) - (set! sv-32 pair) - (set! sv-48 'function) - (set! sv-64 (method-of-type pair new)) - (set! sv-80 'global) - (set! sv-96 pair) - (set! sv-112 (-> v1-4 name)) - (set! sv-128 (method-of-type pair new)) - (set! sv-144 'global) - (set! sv-160 pair) - (set! sv-176 (* s4-0 8)) - (let* ((a3-1 (cons 'dm-play-task '())) - (a3-2 (sv-128 sv-144 sv-160 sv-176 a3-1)) - (a3-3 (sv-64 sv-80 sv-96 sv-112 a3-2)) - ) - (set! gp-0 (s3-0 s2-0 s1-0 (s0-0 sv-16 sv-32 sv-48 a3-3) gp-0)) - ) + (if (-> v1-4 play-continue) + (set! gp-0 (cons (cons 'function (cons (-> v1-4 name) (cons (* s4-0 8) (cons 'dm-play-task '())))) gp-0)) ) - ) ) ) (debug-menu-make-from-template arg0 (cons 'menu (cons "Play" gp-0))) @@ -3137,7 +3034,6 @@ ;; definition for function debug-menu-context-make-default-menus ;; INFO: Used lq/sq (defun debug-menu-context-make-default-menus ((arg0 debug-menu-context)) - (local-vars (sv-16 debug-menu-context)) (let ((s5-0 (new 'debug 'debug-menu arg0 "Main menu"))) (debug-menu-context-set-root-menu arg0 s5-0) (debug-menu-append-item @@ -3555,14 +3451,9 @@ (a1-7 (car s3-2)) ) (while (not (null? s3-2)) - (let ((s2-0 debug-menu-append-item) - (s1-0 s4-2) - (s0-0 debug-menu-make-from-template) - ) - (set! sv-16 arg0) - (let ((a1-8 (debug-menu-make-continue-sub-menu *game-info* (the-as symbol a1-7)))) - (s2-0 s1-0 (s0-0 sv-16 a1-8)) - ) + (debug-menu-append-item + s4-2 + (debug-menu-make-from-template arg0 (debug-menu-make-continue-sub-menu *game-info* (the-as symbol a1-7))) ) (set! s3-2 (cdr s3-2)) (set! a1-7 (car s3-2)) diff --git a/test/decompiler/reference/jak2/engine/debug/editable_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc index 29127d8367..b08163e7bc 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable_REF.gc @@ -34,7 +34,6 @@ ;; definition for method 10 of type editable-region ;; INFO: Used lq/sq (defmethod editable-region-method-10 ((this editable-region) (arg0 int)) - (local-vars (sv-16 string) (sv-32 string)) (when (nonzero? (-> this id)) (let ((s5-0 (clear *temp-string*))) (format s5-0 "delete from region_sphere where region_id=~D" (-> this id)) @@ -55,28 +54,10 @@ (clear s5-0) (format s5-0 "delete from region_point where region_face_id in (") (dotimes (s2-0 (-> s3-0 len)) - (cond - ((zero? s2-0) - (let ((s1-0 format) - (s0-0 s5-0) - ) - (set! sv-16 "~D") - (let ((a2-4 (string->int (-> s3-0 data s2-0)))) - (s1-0 s0-0 sv-16 a2-4) - ) - ) - ) - (else - (let ((s1-1 format) - (s0-1 s5-0) - ) - (set! sv-32 ",~D") - (let ((a2-5 (string->int (-> s3-0 data s2-0)))) - (s1-1 s0-1 sv-32 a2-5) - ) - ) + (if (zero? s2-0) + (format s5-0 "~D" (string->int (-> s3-0 data s2-0))) + (format s5-0 ",~D" (string->int (-> s3-0 data s2-0))) ) - ) ) (format s5-0 ")") (let ((a2-6 (sql-query s5-0))) @@ -303,52 +284,52 @@ ;; definition for method 11 of type editable-region ;; WARN: Return type mismatch int vs none. (defmethod editable-region-method-11 ((this editable-region) (arg0 vector) (arg1 int)) - (local-vars (sv-32 vector2h)) - (set! sv-32 (new 'stack 'vector2h)) - (add-debug-x #t (bucket-id debug-no-zbuf1) arg0 (new 'static 'rgba :r #xff :g #xff :a #x80)) - (let ((s3-0 add-debug-text-3d) - (s2-0 #t) - (s1-0 318) - ) - (format (clear *temp-string*) "region-~D~%" (-> this id)) - (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* arg0 (font-color white) sv-32) - ) - (+! (-> sv-32 y) 8) - (when (>= arg1 1) - (let ((s4-1 (-> this on-enter))) - (when s4-1 - (let ((s3-1 add-debug-text-3d) - (s2-1 #t) - (s1-1 318) - ) - (format (clear *temp-string*) "(on-enter ~S)" s4-1) - (s3-1 s2-1 (the-as bucket-id s1-1) *temp-string* arg0 (font-color white) sv-32) + (let ((sv-32 (new 'stack 'vector2h))) + (add-debug-x #t (bucket-id debug-no-zbuf1) arg0 (new 'static 'rgba :r #xff :g #xff :a #x80)) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 318) ) - (+! (-> sv-32 y) 8) - ) + (format (clear *temp-string*) "region-~D~%" (-> this id)) + (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* arg0 (font-color white) sv-32) ) - (let ((s4-2 (-> this on-inside))) - (when s4-2 - (let ((s3-2 add-debug-text-3d) - (s2-2 #t) - (s1-2 318) - ) - (format (clear *temp-string*) "(on-inside ~S)" s4-2) - (s3-2 s2-2 (the-as bucket-id s1-2) *temp-string* arg0 (font-color white) sv-32) + (+! (-> sv-32 y) 8) + (when (>= arg1 1) + (let ((s4-1 (-> this on-enter))) + (when s4-1 + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 318) + ) + (format (clear *temp-string*) "(on-enter ~S)" s4-1) + (s3-1 s2-1 (the-as bucket-id s1-1) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) ) - (+! (-> sv-32 y) 8) ) - ) - (let ((s5-1 (-> this on-exit))) - (when s5-1 - (let ((s4-3 add-debug-text-3d) - (s3-3 #t) - (s2-3 318) - ) - (format (clear *temp-string*) "(on-exit ~S)" s5-1) - (s4-3 s3-3 (the-as bucket-id s2-3) *temp-string* arg0 (font-color white) sv-32) + (let ((s4-2 (-> this on-inside))) + (when s4-2 + (let ((s3-2 add-debug-text-3d) + (s2-2 #t) + (s1-2 318) + ) + (format (clear *temp-string*) "(on-inside ~S)" s4-2) + (s3-2 s2-2 (the-as bucket-id s1-2) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((s5-1 (-> this on-exit))) + (when s5-1 + (let ((s4-3 add-debug-text-3d) + (s3-3 #t) + (s2-3 318) + ) + (format (clear *temp-string*) "(on-exit ~S)" s5-1) + (s4-3 s3-3 (the-as bucket-id s2-3) *temp-string* arg0 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) ) - (+! (-> sv-32 y) 8) ) ) ) @@ -552,10 +533,10 @@ ;; definition for method 20 of type editable ;; WARN: Return type mismatch int vs none. (defmethod editable-method-20 ((this editable) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars (sv-48 vector) (sv-52 vector)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (let ((s4-0 (edit-get-trans this))) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + (s4-0 (edit-get-trans this)) + ) (reverse-transform-point! sv-48 s4-0 arg2 arg0) (reverse-transform-point! sv-52 s4-0 arg2 arg1) (vector-! arg3 sv-52 sv-48) @@ -1469,18 +1450,6 @@ ;; WARN: Stack slot offset 292 signed mismatch ;; WARN: Return type mismatch int vs symbol. (defmethod editable-method-29 ((this editable-face) (arg0 editable-filter)) - (local-vars - (sv-208 (inline-array vector)) - (sv-216 int) - (sv-288 array) - (sv-292 int) - (sv-296 int) - (sv-368 matrix) - (sv-372 editable-point) - (sv-376 float) - (sv-380 symbol) - (sv-400 float) - ) (if (or (logtest? arg0 (editable-filter water-command)) (logtest? (-> this flags) (editable-flag mark))) (return (the-as symbol #f)) ) @@ -1506,22 +1475,24 @@ (dotimes (a0-12 6) (set! (-> v1-15 a0-12 quad) (the-as uint128 0)) ) - (set! sv-208 v1-15) - ) - (set! sv-216 0) - (dotimes (s2-2 s4-0) - (when (not (logtest? (-> this vertex s2-2 flags) (editable-flag selected))) - (set! (-> sv-208 sv-216 quad) (-> (edit-get-trans (-> this vertex s2-2)) quad)) - (set! sv-216 (+ sv-216 1)) + (let ((sv-208 v1-15)) + (let ((sv-216 0)) + (dotimes (s2-2 s4-0) + (when (not (logtest? (-> this vertex s2-2 flags) (editable-flag selected))) + (set! (-> sv-208 sv-216 quad) (-> (edit-get-trans (-> this vertex s2-2)) quad)) + (+! sv-216 1) + ) + ) + (dotimes (s2-3 s4-0) + (when (logtest? (-> this vertex s2-3 flags) (editable-flag selected)) + (set! (-> sv-208 sv-216 quad) (-> (edit-get-trans (-> this vertex s2-3)) quad)) + (+! sv-216 1) + ) + ) + ) + (normal-of-plane (-> this normal) (-> sv-208 0) (-> sv-208 1) (-> sv-208 2)) ) ) - (dotimes (s2-3 s4-0) - (when (logtest? (-> this vertex s2-3 flags) (editable-flag selected)) - (set! (-> sv-208 sv-216 quad) (-> (edit-get-trans (-> this vertex s2-3)) quad)) - (set! sv-216 (+ sv-216 1)) - ) - ) - (normal-of-plane (-> this normal) (-> sv-208 0) (-> sv-208 1) (-> sv-208 2)) (set! (-> this center quad) (-> (edit-get-trans this) quad)) ) ) @@ -1551,66 +1522,69 @@ ) ) ) - (set! sv-288 - ((method-of-type array new) - (the-as symbol (new 'stack-no-clear 'array 'editable-point 6)) - array - editable-point - 6 - ) + (let ((sv-288 ((method-of-type array new) + (the-as symbol (new 'stack-no-clear 'array 'editable-point 6)) + array + editable-point + 6 + ) + ) + (sv-292 (+ (-> this length) -1)) + (sv-296 1) ) - (set! sv-292 (+ (-> this length) -1)) - (set! sv-296 1) - (editable-face-method-31 this (-> this normal)) - (dotimes (v1-85 sv-292) - (set! (-> (the-as (array editable-point) sv-288) v1-85) (-> this vertex (+ v1-85 1))) - ) - (set! sv-368 (new-stack-matrix0)) - (set! sv-372 (the-as editable-point #f)) - (set! sv-376 (the-as float 0.0)) - (set! sv-380 #t) - (vector-normalize! - (vector-! (-> sv-368 vector 2) (edit-get-trans this) (edit-get-trans (-> this vertex 0))) - 1.0 - ) - (vector-normalize! (editable-face-method-31 this (-> sv-368 vector 1)) 1.0) - (vector-normalize! (vector-cross! (-> sv-368 vector 0) (-> sv-368 vector 2) (-> sv-368 vector 1)) 1.0) - (set! (-> sv-368 trans quad) (-> (edit-get-trans (-> this vertex 0)) quad)) - (set! (-> sv-368 trans w) 1.0) - (matrix-4x4-inverse! sv-368 sv-368) - (while (< sv-296 (-> this length)) - (set! sv-372 (the-as editable-point #f)) - (dotimes (s5-4 sv-292) - (when (-> (the-as (array editable-point) sv-288) s5-4) - (let* ((a1-27 (edit-get-trans (-> (the-as (array editable-point) sv-288) s5-4))) - (a0-48 (vector-matrix*! (new 'stack-no-clear 'vector) a1-27 sv-368)) - ) - (set! sv-400 (vector-y-angle a0-48)) + (editable-face-method-31 this (-> this normal)) + (dotimes (v1-85 sv-292) + (set! (-> (the-as (array editable-point) sv-288) v1-85) (-> this vertex (+ v1-85 1))) + ) + (let ((sv-368 (new-stack-matrix0)) + (sv-372 (the-as editable-point #f)) + (sv-376 (the-as float 0.0)) + (sv-380 #t) ) - (cond - (sv-380 - (when (or (not sv-372) (< sv-376 sv-400)) - (set! sv-372 (-> (the-as (array editable-point) sv-288) s5-4)) - (set! sv-376 sv-400) - ) - ) - (else - (when (or (not sv-372) (< sv-400 sv-376)) - (set! sv-372 (-> (the-as (array editable-point) sv-288) s5-4)) - (set! sv-376 sv-400) + (vector-normalize! + (vector-! (-> sv-368 vector 2) (edit-get-trans this) (edit-get-trans (-> this vertex 0))) + 1.0 + ) + (vector-normalize! (editable-face-method-31 this (-> sv-368 vector 1)) 1.0) + (vector-normalize! (vector-cross! (-> sv-368 vector 0) (-> sv-368 vector 2) (-> sv-368 vector 1)) 1.0) + (set! (-> sv-368 trans quad) (-> (edit-get-trans (-> this vertex 0)) quad)) + (set! (-> sv-368 trans w) 1.0) + (matrix-4x4-inverse! sv-368 sv-368) + (while (< sv-296 (-> this length)) + (set! sv-372 (the-as editable-point #f)) + (dotimes (s5-4 sv-292) + (when (-> (the-as (array editable-point) sv-288) s5-4) + (let* ((a1-27 (edit-get-trans (-> (the-as (array editable-point) sv-288) s5-4))) + (a0-48 (vector-matrix*! (new 'stack-no-clear 'vector) a1-27 sv-368)) + (sv-400 (vector-y-angle a0-48)) + ) + (cond + (sv-380 + (when (or (not sv-372) (< sv-376 sv-400)) + (set! sv-372 (-> (the-as (array editable-point) sv-288) s5-4)) + (set! sv-376 sv-400) + ) + ) + (else + (when (or (not sv-372) (< sv-400 sv-376)) + (set! sv-372 (-> (the-as (array editable-point) sv-288) s5-4)) + (set! sv-376 sv-400) + ) + ) + ) ) ) ) + (set! (-> this vertex sv-296) sv-372) + (dotimes (v1-137 sv-292) + (if (= sv-372 (-> (the-as (array editable-point) sv-288) v1-137)) + (set! (-> (the-as (array editable-point) sv-288) v1-137) #f) + ) + ) + (+! sv-296 1) + (set! sv-380 (not sv-380)) ) ) - (set! (-> this vertex sv-296) sv-372) - (dotimes (v1-137 sv-292) - (if (= sv-372 (-> (the-as (array editable-point) sv-288) v1-137)) - (set! (-> (the-as (array editable-point) sv-288) v1-137) #f) - ) - ) - (set! sv-296 (+ sv-296 1)) - (set! sv-380 (not sv-380)) ) (if (< (vector-dot (-> this normal) (editable-face-method-31 this (new 'stack-no-clear 'vector))) 0.0) (logxor! (-> this flags) (editable-flag orient)) @@ -1627,60 +1601,60 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod editable-method-10 ((this editable-face)) - (local-vars (sv-112 int)) (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 6))) (dotimes (v1-0 6) (set! (-> gp-0 v1-0 quad) (the-as uint128 0)) ) - (set! sv-112 (editable-face-method-30 this gp-0)) - (when (>= sv-112 3) - (let ((s1-0 (editable-face-method-31 this (new 'stack-no-clear 'vector)))) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (edit-get-trans this) - s1-0 - (meters 2) - (new 'static 'rgba :r #xff :g #xff :a #x80) + (let ((sv-112 (editable-face-method-30 this gp-0))) + (when (>= sv-112 3) + (let ((s1-0 (editable-face-method-31 this (new 'stack-no-clear 'vector)))) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (edit-get-trans this) + s1-0 + (meters 2) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) ) - ) - (when (logtest? (-> this flags) (editable-flag selected)) - (dotimes (s4-1 sv-112) - (let ((s3-1 add-debug-text-3d) - (s2-1 #t) - (s1-1 318) - ) - (format (clear *temp-string*) "~D" s4-1) - (s3-1 - s2-1 - (the-as bucket-id s1-1) - *temp-string* - (-> gp-0 s4-1) - (if (logtest? (-> this flags) (editable-flag orient)) - (font-color yellow) - (font-color white) + (when (logtest? (-> this flags) (editable-flag selected)) + (dotimes (s4-1 sv-112) + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 318) ) - (the-as vector2h #f) + (format (clear *temp-string*) "~D" s4-1) + (s3-1 + s2-1 + (the-as bucket-id s1-1) + *temp-string* + (-> gp-0 s4-1) + (if (logtest? (-> this flags) (editable-flag orient)) + (font-color yellow) + (font-color white) + ) + (the-as vector2h #f) + ) ) ) ) - ) - (add-debug-bound - (bucket-id debug2) - gp-0 - sv-112 - (if (logtest? (-> this flags) (editable-flag orient)) - (new 'static 'rgba :r #xff :a #x80) - (new 'static 'rgba :r #xff :g #xff :a #x80) - ) - (if (not (logtest? (-> this flags) (editable-flag orient))) - (new 'static 'rgba :r #xff :a #x80) - (new 'static 'rgba :r #xff :g #xff :a #x80) - ) - (if (logtest? (-> this flags) (editable-flag selected)) - 1 - 0 - ) + (add-debug-bound + (bucket-id debug2) + gp-0 + sv-112 + (if (logtest? (-> this flags) (editable-flag orient)) + (new 'static 'rgba :r #xff :a #x80) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (if (not (logtest? (-> this flags) (editable-flag orient))) + (new 'static 'rgba :r #xff :a #x80) + (new 'static 'rgba :r #xff :g #xff :a #x80) + ) + (if (logtest? (-> this flags) (editable-flag selected)) + 1 + 0 + ) + ) ) ) ) @@ -2122,35 +2096,6 @@ ;; WARN: Return type mismatch symbol vs none. ;; WARN: Function (method 12 editable-array) has a return type of none, but the expression builder found a return statement. (defmethod editable-array-method-12 ((this editable-array) (arg0 editable-array)) - (local-vars - (sv-16 sql-result) - (sv-20 sql-result) - (sv-24 sql-result) - (sv-28 sql-result) - (sv-32 sql-result) - (sv-36 editable-region) - (sv-40 float) - (sv-44 float) - (sv-64 int) - (sv-72 int) - (sv-80 editable-plane) - (sv-84 string) - (sv-112 vector) - (sv-120 int) - (sv-128 editable-point) - (sv-136 int) - (sv-144 int) - (sv-152 editable-face) - (sv-156 string) - (sv-176 vector) - (sv-180 editable) - (sv-184 int) - (sv-192 int) - (sv-200 editable-point) - (sv-208 int) - (sv-216 sql-result) - (sv-240 sql-result) - ) (format #t "sql: load from level ~A~%" arg0) (set! (-> *editable-sample-region* level) (the-as string arg0)) (set! (-> *editable-light-region* level) (the-as string arg0)) @@ -2164,17 +2109,18 @@ "select translate_x,translate_y,translate_z,level_info_id from level_info where name='~S'" arg0 ) - (set! sv-16 (s4-0 *temp-string*)) - ) - (when (and (= (-> sv-16 error) 'select) (>= (-> sv-16 len) 3)) - (set-vector! - (-> this level-offset) - (* 4096.0 (string->float (-> sv-16 data 0))) - (* 4096.0 (string->float (-> sv-16 data 1))) - (* 4096.0 (string->float (-> sv-16 data 2))) - 1.0 + (let ((sv-16 (s4-0 *temp-string*))) + (when (and (= (-> sv-16 error) 'select) (>= (-> sv-16 len) 3)) + (set-vector! + (-> this level-offset) + (* 4096.0 (string->float (-> sv-16 data 0))) + (* 4096.0 (string->float (-> sv-16 data 1))) + (* 4096.0 (string->float (-> sv-16 data 2))) + 1.0 + ) + (set! (-> this level-info-id) (the-as uint (string->int (-> sv-16 data 3)))) + ) ) - (set! (-> this level-info-id) (the-as uint (string->int (-> sv-16 data 3)))) ) (let ((s4-2 sql-query)) (format @@ -2182,228 +2128,250 @@ "select region_id,level_name,tree,on_enter,on_exit,on_inside from region where level_name='~S'" arg0 ) - (set! sv-20 (s4-2 *temp-string*)) - ) - (if (!= (-> sv-20 error) 'select) - (return #f) - ) - (format #t "sql: read region ~D~%" (/ (-> sv-20 len) 6)) - (let ((s4-3 sql-query)) - (format - (clear *temp-string*) - "select region_face.region_id,region_face_id,kind,flags,radius from region,region_face where level_name='~S' and region.region_id=region_face.region_id" - arg0 - ) - (set! sv-24 (s4-3 *temp-string*)) - ) - (if (!= (-> sv-24 error) 'select) - (return #f) - ) - (format #t "sql: read face ~D~%" (/ (-> sv-24 len) 5)) - (let ((s4-4 sql-query)) - (format - (clear *temp-string*) - "select region_face.region_face_id,idx,x,y,z from region,region_face,region_point where level_name='~S' and region.region_id=region_face.region_id and region_face.region_face_id=region_point.region_face_id" - arg0 - ) - (set! sv-28 (s4-4 *temp-string*)) - ) - (if (!= (-> sv-28 error) 'select) - (return #f) - ) - (format #t "sql: read point ~D~%" (/ (-> sv-28 len) 5)) - (let ((s4-5 sql-query)) - (format - (clear *temp-string*) - "select region_sphere.region_id,x,y,z,r from region,region_sphere where level_name='~S' and region.region_id=region_sphere.region_id" - arg0 - ) - (set! sv-32 (s4-5 *temp-string*)) - ) - (if (!= (-> sv-32 error) 'select) - (return #f) - ) - (format #t "sql: read sphere ~D~%" (/ (-> sv-32 len) 5)) - (let ((s5-1 0)) - (while (< s5-1 (-> sv-20 len)) - (set! sv-36 (new 'debug 'editable-region)) - (set! sv-40 (the-as float 4095996000.0)) - (set! sv-44 (the-as float -4095996000.0)) - (set! (-> sv-36 id) (the-as uint (string->int (-> sv-20 data s5-1)))) - (set! (-> sv-36 level) (the-as string (string->symbol (-> sv-20 data (+ s5-1 1))))) - (set! (-> sv-36 tree) (string->symbol (-> sv-20 data (+ s5-1 2)))) - (set! (-> sv-36 on-enter) (if (string= (-> sv-20 data (+ s5-1 3)) "") - (the-as string #f) - (-> sv-20 data (+ s5-1 3)) - ) - ) - (set! (-> sv-36 on-exit) (if (string= (-> sv-20 data (+ s5-1 4)) "") - (the-as string #f) - (-> sv-20 data (+ s5-1 4)) - ) - ) - (set! (-> sv-36 on-inside) (if (string= (-> sv-20 data (+ s5-1 5)) "") - (the-as string #f) - (-> sv-20 data (+ s5-1 5)) - ) - ) - (let* ((v1-75 (-> this length)) - (a0-54 0) - (a1-17 (-> this data a0-54)) - ) - (while (< a0-54 v1-75) - (if (and a1-17 (-> a1-17 region) (= (-> a1-17 region id) (-> sv-36 id))) - (set! (-> this data a0-54) #f) - ) - (+! a0-54 1) - (set! a1-17 (-> this data a0-54)) + (let ((sv-20 (s4-2 *temp-string*))) + (if (!= (-> sv-20 error) 'select) + (return #f) ) - ) - (let ((s4-6 0)) - (while (< s4-6 (-> sv-32 len)) - (when (= (-> sv-36 id) (string->int (-> sv-32 data s4-6))) - (let ((s3-5 (editable-array-method-11 this))) - (when (>= s3-5 0) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (set! (-> s2-1 x) (string->float (-> sv-32 data (+ s4-6 1)))) - (set! (-> s2-1 y) (string->float (-> sv-32 data (+ s4-6 2)))) - (set! (-> s2-1 z) (string->float (-> sv-32 data (+ s4-6 3)))) - (set! (-> s2-1 w) 1.0) - (vector+! s2-1 s2-1 (-> this level-offset)) - (let ((s2-2 (new 'debug 'editable-sphere s2-1 2048.0 sv-36))) - (set! (-> s2-2 radius) (string->float (-> sv-32 data (+ s4-6 4)))) - (set! (-> this data s3-5) s2-2) + (format #t "sql: read region ~D~%" (/ (-> sv-20 len) 6)) + (let ((s4-3 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_id,region_face_id,kind,flags,radius from region,region_face where level_name='~S' and region.region_id=region_face.region_id" + arg0 + ) + (let ((sv-24 (s4-3 *temp-string*))) + (if (!= (-> sv-24 error) 'select) + (return #f) + ) + (format #t "sql: read face ~D~%" (/ (-> sv-24 len) 5)) + (let ((s4-4 sql-query)) + (format + (clear *temp-string*) + "select region_face.region_face_id,idx,x,y,z from region,region_face,region_point where level_name='~S' and region.region_id=region_face.region_id and region_face.region_face_id=region_point.region_face_id" + arg0 + ) + (let ((sv-28 (s4-4 *temp-string*))) + (if (!= (-> sv-28 error) 'select) + (return #f) + ) + (format #t "sql: read point ~D~%" (/ (-> sv-28 len) 5)) + (let ((s4-5 sql-query)) + (format + (clear *temp-string*) + "select region_sphere.region_id,x,y,z,r from region,region_sphere where level_name='~S' and region.region_id=region_sphere.region_id" + arg0 + ) + (let ((sv-32 (s4-5 *temp-string*))) + (if (!= (-> sv-32 error) 'select) + (return #f) + ) + (format #t "sql: read sphere ~D~%" (/ (-> sv-32 len) 5)) + (let ((s5-1 0)) + (while (< s5-1 (-> sv-20 len)) + (let ((sv-36 (new 'debug 'editable-region))) + (let ((sv-40 (the-as float 4095996000.0)) + (sv-44 (the-as float -4095996000.0)) + ) + (set! (-> sv-36 id) (the-as uint (string->int (-> sv-20 data s5-1)))) + (set! (-> sv-36 level) (the-as string (string->symbol (-> sv-20 data (+ s5-1 1))))) + (set! (-> sv-36 tree) (string->symbol (-> sv-20 data (+ s5-1 2)))) + (set! (-> sv-36 on-enter) (if (string= (-> sv-20 data (+ s5-1 3)) "") + (the-as string #f) + (-> sv-20 data (+ s5-1 3)) + ) + ) + (set! (-> sv-36 on-exit) (if (string= (-> sv-20 data (+ s5-1 4)) "") + (the-as string #f) + (-> sv-20 data (+ s5-1 4)) + ) + ) + (set! (-> sv-36 on-inside) (if (string= (-> sv-20 data (+ s5-1 5)) "") + (the-as string #f) + (-> sv-20 data (+ s5-1 5)) + ) + ) + (let* ((v1-75 (-> this length)) + (a0-54 0) + (a1-17 (-> this data a0-54)) + ) + (while (< a0-54 v1-75) + (if (and a1-17 (-> a1-17 region) (= (-> a1-17 region id) (-> sv-36 id))) + (set! (-> this data a0-54) #f) + ) + (+! a0-54 1) + (set! a1-17 (-> this data a0-54)) + ) + ) + (let ((s4-6 0)) + (while (< s4-6 (-> sv-32 len)) + (when (= (-> sv-36 id) (string->int (-> sv-32 data s4-6))) + (let ((s3-5 (editable-array-method-11 this))) + (when (>= s3-5 0) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (set! (-> s2-1 x) (string->float (-> sv-32 data (+ s4-6 1)))) + (set! (-> s2-1 y) (string->float (-> sv-32 data (+ s4-6 2)))) + (set! (-> s2-1 z) (string->float (-> sv-32 data (+ s4-6 3)))) + (set! (-> s2-1 w) 1.0) + (vector+! s2-1 s2-1 (-> this level-offset)) + (let ((s2-2 (new 'debug 'editable-sphere s2-1 2048.0 sv-36))) + (set! (-> s2-2 radius) (string->float (-> sv-32 data (+ s4-6 4)))) + (set! (-> this data s3-5) s2-2) + ) + ) + ) + ) + ) + (+! s4-6 5) + ) + ) + (let ((sv-64 0)) + (while (< sv-64 (-> sv-24 len)) + (when (= (-> sv-36 id) (string->int (-> sv-24 data sv-64))) + (cond + ((string= (-> sv-24 data (+ sv-64 2)) "plane") + (let ((sv-72 (editable-array-method-11 this)) + (sv-80 (new 'debug 'editable-plane sv-36)) + (sv-84 (-> sv-24 data (+ sv-64 1))) + ) + (when (>= sv-72 0) + (set! (-> this data sv-72) sv-80) + (set! (-> sv-80 radius) (string->float (-> sv-24 data (+ sv-64 4)))) + (countdown (s4-7 (/ (-> sv-28 len) 5)) + (when (string= (-> (the-as sql-result (+ (* 20 s4-7) (the-as int sv-28))) data 0) sv-84) + (let ((s3-6 (new 'stack-no-clear 'vector))) + (set! (-> s3-6 x) (string->float (-> sv-28 data (+ (* 5 s4-7) 2)))) + (set! (-> s3-6 y) (string->float (-> sv-28 data (+ (* 5 s4-7) 3)))) + (set! (-> s3-6 z) (string->float (-> sv-28 data (+ (* 5 s4-7) 4)))) + (set! (-> s3-6 w) 1.0) + (let ((sv-112 s3-6)) + (vector+! sv-112 sv-112 (-> this level-offset)) + (let ((sv-120 (editable-array-method-11 this))) + (when (>= sv-120 0) + (let ((sv-128 (new 'debug 'editable-point sv-112 sv-36))) + (let ((sv-136 (string->int (-> sv-28 data (+ (* 5 s4-7) 1))))) + (set! (-> this data sv-120) sv-128) + (set! (-> sv-80 vertex sv-136) sv-128) + (set! (-> sv-80 length) (max (-> sv-80 length) (+ sv-136 1))) + ) + (set! (-> sv-128 owner) (cons sv-80 (-> sv-128 owner))) + ) + ) + ) + ) + ) + ) + ) + (editable-method-28 sv-80 (editable-filter load)) + (editable-method-29 sv-80 (editable-filter load)) + ) + ) + ) + ((string= (-> sv-24 data (+ sv-64 2)) "face") + (let ((sv-144 (editable-array-method-11 this)) + (sv-152 (new 'debug 'editable-face sv-36)) + (sv-156 (-> sv-24 data (+ sv-64 1))) + ) + (when (>= sv-144 0) + (set! (-> this data sv-144) sv-152) + (if (string= (-> sv-24 data (+ sv-64 3)) "orient") + (logior! (-> sv-152 flags) (editable-flag orient)) + ) + (let ((s4-8 (/ (-> sv-28 len) 5))) + (while (begin (label cfg-78) (nonzero? s4-8)) + (+! s4-8 -1) + (when (string= (-> (the-as sql-result (+ (* 20 s4-8) (the-as int sv-28))) data 0) sv-156) + (let ((s3-7 (new 'stack-no-clear 'vector))) + (set! (-> s3-7 x) (string->float (-> sv-28 data (+ (* 5 s4-8) 2)))) + (set! (-> s3-7 y) (string->float (-> sv-28 data (+ (* 5 s4-8) 3)))) + (set! (-> s3-7 z) (string->float (-> sv-28 data (+ (* 5 s4-8) 4)))) + (set! (-> s3-7 w) 1.0) + (let ((sv-176 s3-7)) + (vector+! sv-176 sv-176 (-> this level-offset)) + (let* ((s3-8 (-> this length)) + (s2-3 0) + (s1-0 (-> this data s2-3)) + ) + (while (< s2-3 s3-8) + (when (and s1-0 (= (-> s1-0 region) sv-36) (type? s1-0 editable-point)) + (when (vector= (-> (the-as editable-point s1-0) trans) sv-176) + (let ((sv-180 s1-0)) + (let ((sv-184 (string->int (-> sv-28 data (+ (* 5 s4-8) 1))))) + (set! (-> sv-152 vertex sv-184) (the-as editable-point sv-180)) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-184 1))) + ) + (set! (-> sv-180 owner) (cons sv-152 (-> sv-180 owner))) + ) + (goto cfg-78) + ) + ) + (+! s2-3 1) + (set! s1-0 (-> this data s2-3)) + ) + ) + (if (< (-> sv-176 y) sv-40) + (set! sv-40 (-> sv-176 y)) + ) + (if (< sv-44 (-> sv-176 y)) + (set! sv-44 (the-as float (-> sv-176 y))) + ) + (let ((sv-192 (editable-array-method-11 this))) + (when (>= sv-192 0) + (let ((sv-200 (new 'debug 'editable-point sv-176 sv-36))) + (let ((sv-208 (string->int (-> sv-28 data (+ (* 5 s4-8) 1))))) + (set! (-> this data sv-192) sv-200) + (set! (-> sv-152 vertex sv-208) sv-200) + (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-208 1))) + ) + (set! (-> sv-200 owner) (cons sv-152 (-> sv-200 owner))) + ) + ) + ) + ) + ) + ) + ) + ) + (editable-method-28 sv-152 (editable-filter load)) + (editable-method-29 sv-152 (editable-filter load)) + ) + ) + ) + ) + ) + (+! sv-64 5) + ) + ) + (let* ((v1-293 (-> this length)) + (a0-158 0) + (a1-57 (-> this data a0-158)) + ) + (while (< a0-158 v1-293) + (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) + (let ((a2-29 (-> (the-as editable-point a1-57) trans))) + (if (= (-> a2-29 y) sv-40) + (logior! (-> a1-57 flags) (editable-flag bot-set)) + ) + (if (= (-> a2-29 y) sv-44) + (logior! (-> a1-57 flags) (editable-flag top-set)) + ) + ) + ) + (+! a0-158 1) + (set! a1-57 (-> this data a0-158)) + ) + ) + ) + (set! (-> sv-36 changed) #f) + ) + (+! s5-1 6) + ) ) ) ) ) ) - (+! s4-6 5) ) ) - (set! sv-64 0) - (while (< sv-64 (-> sv-24 len)) - (when (= (-> sv-36 id) (string->int (-> sv-24 data sv-64))) - (cond - ((string= (-> sv-24 data (+ sv-64 2)) "plane") - (set! sv-72 (editable-array-method-11 this)) - (set! sv-80 (new 'debug 'editable-plane sv-36)) - (set! sv-84 (-> sv-24 data (+ sv-64 1))) - (when (>= sv-72 0) - (set! (-> this data sv-72) sv-80) - (set! (-> sv-80 radius) (string->float (-> sv-24 data (+ sv-64 4)))) - (countdown (s4-7 (/ (-> sv-28 len) 5)) - (when (string= (-> (the-as sql-result (+ (* 20 s4-7) (the-as int sv-28))) data 0) sv-84) - (let ((s3-6 (new 'stack-no-clear 'vector))) - (set! (-> s3-6 x) (string->float (-> sv-28 data (+ (* 5 s4-7) 2)))) - (set! (-> s3-6 y) (string->float (-> sv-28 data (+ (* 5 s4-7) 3)))) - (set! (-> s3-6 z) (string->float (-> sv-28 data (+ (* 5 s4-7) 4)))) - (set! (-> s3-6 w) 1.0) - (set! sv-112 s3-6) - ) - (vector+! sv-112 sv-112 (-> this level-offset)) - (set! sv-120 (editable-array-method-11 this)) - (when (>= sv-120 0) - (set! sv-128 (new 'debug 'editable-point sv-112 sv-36)) - (set! sv-136 (string->int (-> sv-28 data (+ (* 5 s4-7) 1)))) - (set! (-> this data sv-120) sv-128) - (set! (-> sv-80 vertex sv-136) sv-128) - (set! (-> sv-80 length) (max (-> sv-80 length) (+ sv-136 1))) - (set! (-> sv-128 owner) (cons sv-80 (-> sv-128 owner))) - ) - ) - ) - (editable-method-28 sv-80 (editable-filter load)) - (editable-method-29 sv-80 (editable-filter load)) - ) - ) - ((string= (-> sv-24 data (+ sv-64 2)) "face") - (set! sv-144 (editable-array-method-11 this)) - (set! sv-152 (new 'debug 'editable-face sv-36)) - (set! sv-156 (-> sv-24 data (+ sv-64 1))) - (when (>= sv-144 0) - (set! (-> this data sv-144) sv-152) - (if (string= (-> sv-24 data (+ sv-64 3)) "orient") - (logior! (-> sv-152 flags) (editable-flag orient)) - ) - (let ((s4-8 (/ (-> sv-28 len) 5))) - (while (begin (label cfg-78) (nonzero? s4-8)) - (+! s4-8 -1) - (when (string= (-> (the-as sql-result (+ (* 20 s4-8) (the-as int sv-28))) data 0) sv-156) - (let ((s3-7 (new 'stack-no-clear 'vector))) - (set! (-> s3-7 x) (string->float (-> sv-28 data (+ (* 5 s4-8) 2)))) - (set! (-> s3-7 y) (string->float (-> sv-28 data (+ (* 5 s4-8) 3)))) - (set! (-> s3-7 z) (string->float (-> sv-28 data (+ (* 5 s4-8) 4)))) - (set! (-> s3-7 w) 1.0) - (set! sv-176 s3-7) - ) - (vector+! sv-176 sv-176 (-> this level-offset)) - (let* ((s3-8 (-> this length)) - (s2-3 0) - (s1-0 (-> this data s2-3)) - ) - (while (< s2-3 s3-8) - (when (and s1-0 (= (-> s1-0 region) sv-36) (type? s1-0 editable-point)) - (when (vector= (-> (the-as editable-point s1-0) trans) sv-176) - (set! sv-180 s1-0) - (set! sv-184 (string->int (-> sv-28 data (+ (* 5 s4-8) 1)))) - (set! (-> sv-152 vertex sv-184) (the-as editable-point sv-180)) - (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-184 1))) - (set! (-> sv-180 owner) (cons sv-152 (-> sv-180 owner))) - (goto cfg-78) - ) - ) - (+! s2-3 1) - (set! s1-0 (-> this data s2-3)) - ) - ) - (if (< (-> sv-176 y) sv-40) - (set! sv-40 (-> sv-176 y)) - ) - (if (< sv-44 (-> sv-176 y)) - (set! sv-44 (the-as float (-> sv-176 y))) - ) - (set! sv-192 (editable-array-method-11 this)) - (when (>= sv-192 0) - (set! sv-200 (new 'debug 'editable-point sv-176 sv-36)) - (set! sv-208 (string->int (-> sv-28 data (+ (* 5 s4-8) 1)))) - (set! (-> this data sv-192) sv-200) - (set! (-> sv-152 vertex sv-208) sv-200) - (set! (-> sv-152 length) (max (-> sv-152 length) (+ sv-208 1))) - (set! (-> sv-200 owner) (cons sv-152 (-> sv-200 owner))) - ) - ) - ) - ) - (editable-method-28 sv-152 (editable-filter load)) - (editable-method-29 sv-152 (editable-filter load)) - ) - ) - ) - ) - (set! sv-64 (+ sv-64 5)) - ) - (let* ((v1-293 (-> this length)) - (a0-158 0) - (a1-57 (-> this data a0-158)) - ) - (while (< a0-158 v1-293) - (when (and a1-57 (= (-> a1-57 region) sv-36) (= (-> a1-57 type) editable-point)) - (let ((a2-29 (-> (the-as editable-point a1-57) trans))) - (if (= (-> a2-29 y) sv-40) - (logior! (-> a1-57 flags) (editable-flag bot-set)) - ) - (if (= (-> a2-29 y) sv-44) - (logior! (-> a1-57 flags) (editable-flag top-set)) - ) - ) - ) - (+! a0-158 1) - (set! a1-57 (-> this data a0-158)) - ) - ) - (set! (-> sv-36 changed) #f) - (+! s5-1 6) ) ) (let ((s5-2 sql-query)) @@ -2412,26 +2380,27 @@ "select x,y,z from sample_point where level_info_id='~D' and source='manual'" (-> this level-info-id) ) - (set! sv-216 (s5-2 *temp-string*)) - ) - (if (!= (-> sv-216 error) 'select) - (return #f) - ) - (let ((s5-3 0)) - (while (< s5-3 (-> sv-216 len)) - (let ((s4-10 (editable-array-method-11 this))) - (when (>= s4-10 0) - (let ((s3-9 (new 'stack-no-clear 'vector))) - (set! (-> s3-9 x) (* 4096.0 (string->float (-> sv-216 data s5-3)))) - (set! (-> s3-9 y) (* 4096.0 (string->float (-> sv-216 data (+ s5-3 1))))) - (set! (-> s3-9 z) (* 4096.0 (string->float (-> sv-216 data (+ s5-3 2))))) - (set! (-> s3-9 w) 1.0) - (vector+! s3-9 s3-9 (-> this level-offset)) - (set! (-> this data s4-10) (new 'debug 'editable-sample s3-9 *editable-sample-region*)) + (let ((sv-216 (s5-2 *temp-string*))) + (if (!= (-> sv-216 error) 'select) + (return #f) + ) + (let ((s5-3 0)) + (while (< s5-3 (-> sv-216 len)) + (let ((s4-10 (editable-array-method-11 this))) + (when (>= s4-10 0) + (let ((s3-9 (new 'stack-no-clear 'vector))) + (set! (-> s3-9 x) (* 4096.0 (string->float (-> sv-216 data s5-3)))) + (set! (-> s3-9 y) (* 4096.0 (string->float (-> sv-216 data (+ s5-3 1))))) + (set! (-> s3-9 z) (* 4096.0 (string->float (-> sv-216 data (+ s5-3 2))))) + (set! (-> s3-9 w) 1.0) + (vector+! s3-9 s3-9 (-> this level-offset)) + (set! (-> this data s4-10) (new 'debug 'editable-sample s3-9 *editable-sample-region*)) + ) + ) ) + (+! s5-3 3) ) ) - (+! s5-3 3) ) ) (set! (-> *editable-sample-region* changed) #f) @@ -2441,52 +2410,53 @@ "select light_id,name,pos_x,pos_y,pos_z,r,dir_x,dir_y,dir_z,color0_r,color0_g,color0_b,color0_a,decay_start,ambient_point_ratio,brightness from light where level_name='~S'" (-> this level) ) - (set! sv-240 (s5-4 *temp-string*)) - ) - (format #t "sql: read light ~D~%" (/ (-> sv-240 len) 16)) - (if (!= (-> sv-240 error) 'select) - (return #f) - ) - (let ((s5-5 0)) - (while (< s5-5 (-> sv-240 len)) - (let ((s3-10 (editable-array-method-11 this))) - (when (>= s3-10 0) - (let ((s4-12 (new 'stack-no-clear 'vector))) - (set! (-> s4-12 x) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 2))))) - (set! (-> s4-12 y) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 3))))) - (set! (-> s4-12 z) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 4))))) - (set! (-> s4-12 w) 1.0) - (vector+! s4-12 s4-12 (-> this level-offset)) - (let ((s4-13 (new 'debug 'editable-light s4-12 2048.0 *editable-light-region*))) - (set! (-> this data s3-10) s4-13) - (set! (-> s4-13 id) (the-as uint (string->int (-> sv-240 data s5-5)))) - (set! (-> s4-13 name) (-> sv-240 data (+ s5-5 1))) - (set! (-> s4-13 radius) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 5))))) - (set-vector! - (-> s4-13 direction) - (string->float (-> sv-240 data (+ s5-5 6))) - (string->float (-> sv-240 data (+ s5-5 7))) - (string->float (-> sv-240 data (+ s5-5 8))) - 1.0 - ) - (if (and (= (-> s4-13 direction x) 0.0) (= (-> s4-13 direction y) 0.0) (= (-> s4-13 direction z) 0.0)) - (set! (-> s4-13 direction w) 0.0) + (let ((sv-240 (s5-4 *temp-string*))) + (format #t "sql: read light ~D~%" (/ (-> sv-240 len) 16)) + (if (!= (-> sv-240 error) 'select) + (return #f) + ) + (let ((s5-5 0)) + (while (< s5-5 (-> sv-240 len)) + (let ((s3-10 (editable-array-method-11 this))) + (when (>= s3-10 0) + (let ((s4-12 (new 'stack-no-clear 'vector))) + (set! (-> s4-12 x) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 2))))) + (set! (-> s4-12 y) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 3))))) + (set! (-> s4-12 z) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 4))))) + (set! (-> s4-12 w) 1.0) + (vector+! s4-12 s4-12 (-> this level-offset)) + (let ((s4-13 (new 'debug 'editable-light s4-12 2048.0 *editable-light-region*))) + (set! (-> this data s3-10) s4-13) + (set! (-> s4-13 id) (the-as uint (string->int (-> sv-240 data s5-5)))) + (set! (-> s4-13 name) (-> sv-240 data (+ s5-5 1))) + (set! (-> s4-13 radius) (* 4096.0 (string->float (-> sv-240 data (+ s5-5 5))))) + (set-vector! + (-> s4-13 direction) + (string->float (-> sv-240 data (+ s5-5 6))) + (string->float (-> sv-240 data (+ s5-5 7))) + (string->float (-> sv-240 data (+ s5-5 8))) + 1.0 + ) + (if (and (= (-> s4-13 direction x) 0.0) (= (-> s4-13 direction y) 0.0) (= (-> s4-13 direction z) 0.0)) + (set! (-> s4-13 direction w) 0.0) + ) + (set-vector! + (-> s4-13 color) + (string->float (-> sv-240 data (+ s5-5 9))) + (string->float (-> sv-240 data (+ s5-5 10))) + (string->float (-> sv-240 data (+ s5-5 11))) + (string->float (-> sv-240 data (+ s5-5 12))) + ) + (set! (-> s4-13 decay-start) (string->float (-> sv-240 data (+ s5-5 13)))) + (set! (-> s4-13 ambient-point-ratio) (string->float (-> sv-240 data (+ s5-5 14)))) + (set! (-> s4-13 brightness) (string->float (-> sv-240 data (+ s5-5 15)))) ) - (set-vector! - (-> s4-13 color) - (string->float (-> sv-240 data (+ s5-5 9))) - (string->float (-> sv-240 data (+ s5-5 10))) - (string->float (-> sv-240 data (+ s5-5 11))) - (string->float (-> sv-240 data (+ s5-5 12))) ) - (set! (-> s4-13 decay-start) (string->float (-> sv-240 data (+ s5-5 13)))) - (set! (-> s4-13 ambient-point-ratio) (string->float (-> sv-240 data (+ s5-5 14)))) - (set! (-> s4-13 brightness) (string->float (-> sv-240 data (+ s5-5 15)))) ) ) + (+! s5-5 16) ) ) - (+! s5-5 16) ) ) (set! (-> *editable-light-region* changed) #f) diff --git a/test/decompiler/reference/jak2/engine/debug/history_REF.gc b/test/decompiler/reference/jak2/engine/debug/history_REF.gc index 7cfa1e29ac..9266a849f1 100644 --- a/test/decompiler/reference/jak2/engine/debug/history_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/history_REF.gc @@ -462,150 +462,143 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: new jak 2 until loop case, check carefully (defun history-print ((arg0 history-iterator)) - (local-vars - (sv-16 object) - (sv-24 int) - (sv-32 int) - (sv-40 history-elt) - (sv-48 time-frame) - (sv-56 uint) - (sv-64 collide-status) - (sv-72 float) - (sv-80 string) - (sv-96 string) - ) - (set! sv-16 (-> arg0 out)) - (set! sv-24 -1) - (set! sv-32 0) - (until #f - (set! sv-40 (update-entries! arg0)) - (if (not sv-40) - (goto cfg-71) + (let ((sv-16 (-> arg0 out)) + (sv-24 -1) + (sv-32 0) ) - (when (logtest? (-> arg0 channel-mask) (ash 1 (-> sv-40 channel))) - (set! sv-48 (frame-counter-delta arg0 sv-40)) - (set! sv-56 (-> sv-40 record-id)) - (cond - ((!= sv-24 sv-48) - (set! sv-24 (the-as int sv-48)) - (set! sv-32 (the-as int sv-56)) - (format sv-16 "~3D ~4X " sv-48 (-> sv-40 record-id)) - ) - ((!= sv-32 sv-56) - (set! sv-32 (the-as int sv-56)) - (format sv-16 " ~4X " (-> sv-40 record-id)) - ) - (else - (format sv-16 " ") - ) - ) - (let ((v1-22 (-> sv-40 channel))) - (cond - ((or (= v1-22 (history-channel trans)) - (or (= v1-22 (history-channel transv)) - (= v1-22 (history-channel transv-in)) - (= v1-22 (history-channel transv-out)) - (= v1-22 (history-channel intersect)) + (until #f + (let ((sv-40 (update-entries! arg0))) + (if (not sv-40) + (goto cfg-71) + ) + (when (logtest? (-> arg0 channel-mask) (ash 1 (-> sv-40 channel))) + (let ((sv-48 (frame-counter-delta arg0 sv-40)) + (sv-56 (-> sv-40 record-id)) + ) + (cond + ((!= sv-24 sv-48) + (set! sv-24 (the-as int sv-48)) + (set! sv-32 (the-as int sv-56)) + (format sv-16 "~3D ~4X " sv-48 (-> sv-40 record-id)) + ) + ((!= sv-32 sv-56) + (set! sv-32 (the-as int sv-56)) + (format sv-16 " ~4X " (-> sv-40 record-id)) + ) + (else + (format sv-16 " ") + ) + ) + ) + (let ((v1-22 (-> sv-40 channel))) + (cond + ((or (= v1-22 (history-channel trans)) + (or (= v1-22 (history-channel transv)) + (= v1-22 (history-channel transv-in)) + (= v1-22 (history-channel transv-out)) + (= v1-22 (history-channel intersect)) + ) ) + (format + sv-16 + "~-15S: ~14Mm ~14Mm ~14Mm~%" + (history-channel->string (-> sv-40 channel)) + (-> sv-40 vector x) + (-> sv-40 vector y) + (-> sv-40 vector z) + ) ) - (format - sv-16 - "~-15S: ~14Mm ~14Mm ~14Mm~%" - (history-channel->string (-> sv-40 channel)) - (-> sv-40 vector x) - (-> sv-40 vector y) - (-> sv-40 vector z) - ) - ) - ((or (= v1-22 (history-channel local-normal)) (= v1-22 (history-channel surface-normal))) - (format - sv-16 - "~-15S: ~14f ~14f ~14f~%" - (history-channel->string (-> sv-40 channel)) - (-> sv-40 vector x) - (-> sv-40 vector y) - (-> sv-40 vector z) - ) - ) - ((= v1-22 (history-channel pat)) - (let* ((s2-0 (-> sv-40 vector x)) - (s5-2 format) - (s4-2 sv-16) - (s3-2 "~-15S: #x~6X mode:~-8S material:~-10S event:~S~%") - (s1-0 (history-channel->string (-> sv-40 channel))) - (s0-0 s2-0) - ) - (set! sv-80 (pat-mode->string (the-as pat-surface s2-0))) - (set! sv-96 (pat-material->string (the-as pat-surface s2-0))) - (let ((t2-0 (pat-event->string (the-as pat-surface s2-0)))) - (s5-2 s4-2 s3-2 s1-0 s0-0 sv-80 sv-96 t2-0) + ((or (= v1-22 (history-channel local-normal)) (= v1-22 (history-channel surface-normal))) + (format + sv-16 + "~-15S: ~14f ~14f ~14f~%" + (history-channel->string (-> sv-40 channel)) + (-> sv-40 vector x) + (-> sv-40 vector y) + (-> sv-40 vector z) + ) ) - ) - ) - ((= v1-22 (history-channel collide-status)) - (set! sv-64 (-> sv-40 collide-status)) - (set! sv-72 (-> sv-40 vector z)) - (format sv-16 "~-15S: #x~6X " (history-channel->string (-> sv-40 channel)) sv-64) - (let ((s5-4 sv-64)) - (if (= (logand s5-4 (collide-status touch-background)) (collide-status touch-background)) - (format sv-16 "touch-background ") + ((= v1-22 (history-channel pat)) + (let ((s2-0 (-> sv-40 vector x))) + (format + sv-16 + "~-15S: #x~6X mode:~-8S material:~-10S event:~S~%" + (history-channel->string (-> sv-40 channel)) + s2-0 + (pat-mode->string (the-as pat-surface s2-0)) + (pat-material->string (the-as pat-surface s2-0)) + (pat-event->string (the-as pat-surface s2-0)) + ) ) - (if (= (logand s5-4 (collide-status on-special-surface)) (collide-status on-special-surface)) - (format sv-16 "on-special-surface ") + ) + ((= v1-22 (history-channel collide-status)) + (let ((sv-64 (-> sv-40 collide-status)) + (sv-72 (-> sv-40 vector z)) + ) + (format sv-16 "~-15S: #x~6X " (history-channel->string (-> sv-40 channel)) sv-64) + (let ((s5-4 sv-64)) + (if (= (logand s5-4 (collide-status touch-background)) (collide-status touch-background)) + (format sv-16 "touch-background ") + ) + (if (= (logand s5-4 (collide-status on-special-surface)) (collide-status on-special-surface)) + (format sv-16 "on-special-surface ") + ) + (if (= (logand s5-4 (collide-status touch-wall)) (collide-status touch-wall)) + (format sv-16 "touch-wall ") + ) + (if (= (logand s5-4 (collide-status on-surface)) (collide-status on-surface)) + (format sv-16 "on-surface ") + ) + (if (= (logand s5-4 (collide-status impact-surface)) (collide-status impact-surface)) + (format sv-16 "impact-surface ") + ) + (if (= (logand s5-4 (collide-status touch-ceiling)) (collide-status touch-ceiling)) + (format sv-16 "touch-ceiling ") + ) + (if (= (logand s5-4 (collide-status on-ground)) (collide-status on-ground)) + (format sv-16 "on-ground ") + ) + (if (= (logand s5-4 (collide-status glance)) (collide-status glance)) + (format sv-16 "glance ") + ) + (if (= (logand s5-4 (collide-status blocked)) (collide-status blocked)) + (format sv-16 "blocked ") + ) + (if (= (logand s5-4 (collide-status touch-edge)) (collide-status touch-edge)) + (format sv-16 "touch-edge ") + ) + (if (= (logand s5-4 (collide-status touch-ceiling-sticky)) (collide-status touch-ceiling-sticky)) + (format sv-16 "touch-ceiling-sticky ") + ) + (if (= (logand s5-4 (collide-status on-water)) (collide-status on-water)) + (format sv-16 "on-water ") + ) + (if (= (logand s5-4 (collide-status touch-actor)) (collide-status touch-actor)) + (format sv-16 "touch-actor ") + ) + (if (= (logand (collide-status probe-hit) s5-4) (collide-status probe-hit)) + (format sv-16 "probe-hit ") + ) + (if (= (logand s5-4 (collide-status stuck)) (collide-status stuck)) + (format sv-16 "stuck ") + ) + (if (= (logand s5-4 (collide-status no-touch)) (collide-status no-touch)) + (format sv-16 "no-touch ") + ) + (if (= (logand s5-4 (collide-status touch-surface)) (collide-status touch-surface)) + (format sv-16 "touch-surface ") + ) + ) + (format sv-16 " #x~6X~%" sv-72) ) - (if (= (logand s5-4 (collide-status touch-wall)) (collide-status touch-wall)) - (format sv-16 "touch-wall ") + ) + ((= v1-22 (history-channel friction)) + (let ((f30-0 (-> sv-40 vector x))) + (format sv-16 "~-15S: ~f~%" (history-channel->string (-> sv-40 channel)) f30-0) ) - (if (= (logand s5-4 (collide-status on-surface)) (collide-status on-surface)) - (format sv-16 "on-surface ") - ) - (if (= (logand s5-4 (collide-status impact-surface)) (collide-status impact-surface)) - (format sv-16 "impact-surface ") - ) - (if (= (logand s5-4 (collide-status touch-ceiling)) (collide-status touch-ceiling)) - (format sv-16 "touch-ceiling ") - ) - (if (= (logand s5-4 (collide-status on-ground)) (collide-status on-ground)) - (format sv-16 "on-ground ") - ) - (if (= (logand s5-4 (collide-status glance)) (collide-status glance)) - (format sv-16 "glance ") - ) - (if (= (logand s5-4 (collide-status blocked)) (collide-status blocked)) - (format sv-16 "blocked ") - ) - (if (= (logand s5-4 (collide-status touch-edge)) (collide-status touch-edge)) - (format sv-16 "touch-edge ") - ) - (if (= (logand s5-4 (collide-status touch-ceiling-sticky)) (collide-status touch-ceiling-sticky)) - (format sv-16 "touch-ceiling-sticky ") - ) - (if (= (logand s5-4 (collide-status on-water)) (collide-status on-water)) - (format sv-16 "on-water ") - ) - (if (= (logand s5-4 (collide-status touch-actor)) (collide-status touch-actor)) - (format sv-16 "touch-actor ") - ) - (if (= (logand (collide-status probe-hit) s5-4) (collide-status probe-hit)) - (format sv-16 "probe-hit ") - ) - (if (= (logand s5-4 (collide-status stuck)) (collide-status stuck)) - (format sv-16 "stuck ") - ) - (if (= (logand s5-4 (collide-status no-touch)) (collide-status no-touch)) - (format sv-16 "no-touch ") - ) - (if (= (logand s5-4 (collide-status touch-surface)) (collide-status touch-surface)) - (format sv-16 "touch-surface ") - ) - ) - (format sv-16 " #x~6X~%" sv-72) - ) - ((= v1-22 (history-channel friction)) - (let ((f30-0 (-> sv-40 vector x))) - (format sv-16 "~-15S: ~f~%" (history-channel->string (-> sv-40 channel)) f30-0) - ) - ) + ) + ) + ) ) ) ) @@ -620,113 +613,114 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: new jak 2 until loop case, check carefully (defun history-draw ((arg0 history-iterator)) - (local-vars (sv-16 vector) (sv-20 vector) (sv-24 pat-surface)) - (set! sv-16 (the-as vector #f)) - (set! sv-20 (the-as vector #f)) - (set! sv-24 (new 'static 'pat-surface)) - (until #f - (let ((s5-0 (update-entries! arg0))) - (if (not s5-0) - (goto cfg-34) - ) - (when (logtest? (-> arg0 channel-mask) (ash 1 (-> s5-0 channel))) - (let* ((f0-0 (get-age arg0 s5-0)) - (v1-8 (the int (lerp 4.0 128.0 f0-0))) - ) - (case (-> s5-0 channel) - (((history-channel trans)) - (if sv-16 - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - sv-16 - (-> s5-0 vector) - (the-as rgba (logior #xffff00 (shl v1-8 24))) - #f - (the-as rgba -1) - ) - (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffff00 (shl v1-8 24)))) + (let ((sv-16 (the-as vector #f)) + (sv-20 (the-as vector #f)) + (sv-24 (new 'static 'pat-surface)) + ) + (until #f + (let ((s5-0 (update-entries! arg0))) + (if (not s5-0) + (goto cfg-34) + ) + (when (logtest? (-> arg0 channel-mask) (ash 1 (-> s5-0 channel))) + (let* ((f0-0 (get-age arg0 s5-0)) + (v1-8 (the int (lerp 4.0 128.0 f0-0))) ) - (set! sv-16 (-> s5-0 vector)) - ) - (((history-channel intersect)) - (if sv-20 - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - sv-20 - (-> s5-0 vector) - (the-as rgba (logior #xffffff (shl v1-8 24))) - #f - (the-as rgba -1) - ) - (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffffff (shl v1-8 24)))) - ) - (set! sv-20 (-> s5-0 vector)) - ) - (((history-channel transv)) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 origin) - (-> s5-0 vector) - (meters 0.000024414063) - (the-as rgba (logior (shl v1-8 24) #xff00)) - ) - ) - (((history-channel transv-in)) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 origin) - (-> s5-0 vector) - (meters 0.000024414063) - (the-as rgba (logior #x408040 (shl v1-8 24))) - ) - ) - (((history-channel transv-out)) - (add-debug-vector - #t - (bucket-id debug-no-zbuf1) - (-> s5-0 origin) - (-> s5-0 vector) - (meters 0.000024414063) - (the-as rgba (logior #x404080 (shl v1-8 24))) - ) - ) - (((history-channel local-normal) (history-channel surface-normal)) - (let ((t1-7 - (logand (the-as uint (-> *pat-mode-info* (-> sv-24 mode) hilite-color)) (the-as uint #xffffffff00ffffff)) + (case (-> s5-0 channel) + (((history-channel trans)) + (if sv-16 + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + sv-16 + (-> s5-0 vector) + (the-as rgba (logior #xffff00 (shl v1-8 24))) + #f + (the-as rgba -1) ) + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffff00 (shl v1-8 24)))) ) + (set! sv-16 (-> s5-0 vector)) + ) + (((history-channel intersect)) + (if sv-20 + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + sv-20 + (-> s5-0 vector) + (the-as rgba (logior #xffffff (shl v1-8 24))) + #f + (the-as rgba -1) + ) + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 vector) (the-as rgba (logior #xffffff (shl v1-8 24)))) + ) + (set! sv-20 (-> s5-0 vector)) + ) + (((history-channel transv)) (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 origin) (-> s5-0 vector) - (meters 1) - (the-as rgba (logior t1-7 (shl v1-8 24))) + (meters 0.000024414063) + (the-as rgba (logior (shl v1-8 24) #xff00)) ) ) - ) - (((history-channel pat)) - (set! sv-24 (the-as pat-surface (-> s5-0 vector x))) - ) - (((history-channel friction)) - (let ((f0-3 (-> s5-0 vector x)) - (a3-10 (new 'stack-no-clear 'vector)) - ) - (set-vector! a3-10 0.0 (* -8192.0 f0-3) 0.0 1.0) + (((history-channel transv-in)) (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 origin) - a3-10 - (meters 0.00024414062) - (the-as rgba (logior #xffffff (shl v1-8 24))) + (-> s5-0 vector) + (meters 0.000024414063) + (the-as rgba (logior #x408040 (shl v1-8 24))) ) ) - ) + (((history-channel transv-out)) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 origin) + (-> s5-0 vector) + (meters 0.000024414063) + (the-as rgba (logior #x404080 (shl v1-8 24))) + ) + ) + (((history-channel local-normal) (history-channel surface-normal)) + (let ((t1-7 + (logand (the-as uint (-> *pat-mode-info* (-> sv-24 mode) hilite-color)) (the-as uint #xffffffff00ffffff)) + ) + ) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 origin) + (-> s5-0 vector) + (meters 1) + (the-as rgba (logior t1-7 (shl v1-8 24))) + ) + ) + ) + (((history-channel pat)) + (set! sv-24 (the-as pat-surface (-> s5-0 vector x))) + ) + (((history-channel friction)) + (let ((f0-3 (-> s5-0 vector x)) + (a3-10 (new 'stack-no-clear 'vector)) + ) + (set-vector! a3-10 0.0 (* -8192.0 f0-3) 0.0 1.0) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 origin) + a3-10 + (meters 0.00024414062) + (the-as rgba (logior #xffffff (shl v1-8 24))) + ) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/memory-usage_REF.gc b/test/decompiler/reference/jak2/engine/debug/memory-usage_REF.gc index 7018b29984..e3fa401dd9 100644 --- a/test/decompiler/reference/jak2/engine/debug/memory-usage_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/memory-usage_REF.gc @@ -314,7 +314,6 @@ ;; definition for method 11 of type memory-usage-block ;; INFO: Used lq/sq (defmethod print-mem-usage ((this memory-usage-block) (level level) (fmt-dest object)) - (local-vars (sv-16 object) (sv-32 string) (sv-48 int)) (let ((s3-0 (&- (-> level heap current) (the-as uint (-> level heap base))))) (let ((v1-2 (+ (-> this data 61 total) (-> this data 62 total)))) (< #x10000 v1-2) @@ -351,218 +350,210 @@ (if (< (the-as int s2-0) s3-0) (format fmt-dest "~3L") ) - (let ((s0-0 format)) - (set! sv-16 fmt-dest) - (set! sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") - (let ((s4-1 (-> level name)) - (s3-1 (sar s3-0 10)) - (s2-1 (shr s2-0 10)) - ) - (set! sv-48 (sar (memory-used *nk-dead-pool*) 10)) - (let ((t2-0 (sar (memory-total *nk-dead-pool*) 10)) - (t9-4 s0-0) - (a0-22 sv-16) - (a1-8 sv-32) - (a2-1 s4-1) - (a3-0 s3-1) - (t0-0 s2-1) - (t1-0 sv-48) - ) - (t9-4 a0-22 a1-8 a2-1 a3-0 t0-0 t1-0 t2-0) - (format fmt-dest "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10)) - (when *stats-memory-short* - (let ((s3-2 (if (cpad-hold? 1 l3) - #t - fmt-dest - ) + (let* ((s0-0 format) + (sv-16 fmt-dest) + (sv-32 "~0K~10,'-S--~5,'-DK-of-~5,'-DK--~5,'-DK-of-~5,'-DK--") + (s4-1 (-> level name)) + (s3-1 (sar s3-0 10)) + (s2-1 (shr s2-0 10)) + (sv-48 (sar (memory-used *nk-dead-pool*) 10)) + (t2-0 (sar (memory-total *nk-dead-pool*) 10)) + (t0-0 s2-1) + (t1-0 sv-48) + ) + (s0-0 sv-16 sv-32 s4-1 s3-1 t0-0 t1-0 t2-0) + (format fmt-dest "~5,'-DK/~5,'-DK--~%" (shr s1-0 10) (sar *max-dma* 10)) + (when *stats-memory-short* + (let ((s3-2 (if (cpad-hold? 1 l3) + #t + fmt-dest ) - (s4-2 format) - (s2-2 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") - (s1-1 (sar (memory-used *nk-dead-pool*) 10)) - (s0-1 (sar (memory-total *nk-dead-pool*) 10)) - ) - (set! t0-0 (compact-time *nk-dead-pool*)) - (set! t1-0 (the-as int (-> *nk-dead-pool* compact-count))) - (set! t2-0 (the-as int (-> *nk-dead-pool* compact-count-targ))) - (s4-2 s3-2 s2-2 s1-1 s0-1 t0-0 (the-as uint t1-0) (the-as uint t2-0)) - ) - ) - (when (not *stats-memory-short*) - (set! (-> *dma-mem-usage* data 87 total) - (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) - ) - (let ((t9-11 format) - (a0-31 fmt-dest) - (a1-11 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") - (a2-6 (sar (+ (-> this data 58 total) (-> this data 59 total) (-> this data 60 total)) 10)) - (a3-3 (sar (-> *dma-mem-usage* data 87 total) 10)) - ) - (t9-11 a0-31 a1-11 a2-6 a3-3 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) - (format - fmt-dest - " bsp-leaf-vis ~192H~5DK~%" - (sar (+ (-> this data 61 total) (-> this data 62 total)) 10) - (the-as none a3-3) - ) - (format fmt-dest " level-code ~192H~5DK~%" (sar (-> this data 65 total) 10) (the-as none a3-3)) - ) - (format - fmt-dest - " tfrag ~192H~5DK ~280Htfragment~456H~5DK~%" - (sar - (+ (-> this data 1 total) - (-> this data 2 total) - (-> this data 3 total) - (-> this data 4 total) - (-> this data 5 total) - (-> this data 6 total) - (-> this data 7 total) - (-> this data 8 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 1 total) 10) - ) - (format - fmt-dest - " tie-proto ~192H~5DK ~280Hsky~456H~5DK~%" - (sar - (+ (-> this data 9 total) - (-> this data 10 total) - (-> this data 11 total) - (-> this data 12 total) - (-> this data 13 total) - (-> this data 14 total) - (-> this data 16 total) - (-> this data 17 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 88 total) 10) - ) - (format - fmt-dest - " tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%" - (sar (+ (-> this data 18 total) (-> this data 20 total) (-> this data 21 total) (-> this data 22 total)) 10) - (sar (-> *dma-mem-usage* data 9 total) 10) - ) - (format - fmt-dest - " shrub-proto ~192H~5DK ~280Htie-scissor~456H~5DK~%" - (sar - (+ (-> this data 25 total) - (-> this data 26 total) - (-> this data 27 total) - (-> this data 28 total) - (-> this data 29 total) - (-> this data 30 total) - (-> this data 31 total) - (-> this data 32 total) - (-> this data 33 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 15 total) 10) - ) - (format - fmt-dest - " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" - (sar (-> this data 34 total) 10) - (sar (-> *dma-mem-usage* data 27 total) 10) - ) - (format - fmt-dest - " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" - (sar - (+ (-> this data 50 total) - (-> this data 51 total) - (-> this data 52 total) - (-> this data 53 total) - (-> this data 54 total) - (-> this data 55 total) - (-> this data 56 total) - (-> this data 57 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 17 total) 10) - ) - (format - fmt-dest - " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%" - (sar - (+ (-> this data 35 total) - (-> this data 36 total) - (-> this data 37 total) - (-> this data 38 total) - (-> this data 39 total) - (-> this data 40 total) - (-> this data 41 total) - (-> this data 42 total) - (-> this data 73 total) - (-> this data 74 total) - (-> this data 75 total) - (-> this data 76 total) - (-> this data 78 total) - (-> this data 81 total) - (-> this data 80 total) - (-> this data 111 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 35 total) 10) - ) - (format - fmt-dest - " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" - (sar - (+ (-> this data 67 total) - (-> this data 68 total) - (-> this data 69 total) - (-> this data 70 total) - (-> this data 71 total) - (-> this data 77 total) - (-> this data 79 total) - (-> this data 72 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 89 total) 10) - ) - (format - fmt-dest - " textures ~192H~5DK ~280Htextures~456H~5DK~%" - (sar (-> this data 82 total) 10) - (sar (-> *dma-mem-usage* data 82 total) 10) - ) - (format fmt-dest " entity ~192H~5DK~%" (sar - (+ (-> this data 66 total) - (-> this data 43 total) - (-> this data 44 total) - (-> this data 45 total) - (-> this data 49 total) - (-> this data 48 total) - (-> this data 46 total) - (-> this data 47 total) - ) - 10 - ) ) - (format - fmt-dest - " misc ~192H~5DK ~280Hsprite~456H~5DK~%" - (sar - (+ (-> this data 0 total) - (-> this data 63 total) - (-> this data 64 total) - (-> this data 83 total) - (-> this data 84 total) - ) - 10 - ) - (sar (-> *dma-mem-usage* data 85 total) 10) + (s4-2 format) + (s2-2 "heap-~5,'-DK/~5,'-DK----~D---~D/~D~%") + (s1-1 (sar (memory-used *nk-dead-pool*) 10)) + (s0-1 (sar (memory-total *nk-dead-pool*) 10)) ) + (set! t0-0 (compact-time *nk-dead-pool*)) + (set! t1-0 (the-as int (-> *nk-dead-pool* compact-count))) + (set! t2-0 (the-as int (-> *nk-dead-pool* compact-count-targ))) + (s4-2 s3-2 s2-2 s1-1 s0-1 t0-0 (the-as uint t1-0) (the-as uint t2-0)) + ) + ) + (when (not *stats-memory-short*) + (set! (-> *dma-mem-usage* data 87 total) + (* (dma-buffer-length (-> *display* frames (-> *display* last-screen) debug-buf)) 16) + ) + (let ((t9-11 format) + (a0-31 fmt-dest) + (a1-11 " bsp ~192H~5DK ~280Hdebug~456H~5DK~%") + (a2-6 (sar (+ (-> this data 58 total) (-> this data 59 total) (-> this data 60 total)) 10)) + (a3-3 (sar (-> *dma-mem-usage* data 87 total) 10)) + ) + (t9-11 a0-31 a1-11 a2-6 a3-3 (the-as none t0-0) (the-as none t1-0) (the-as none t2-0)) + (format + fmt-dest + " bsp-leaf-vis ~192H~5DK~%" + (sar (+ (-> this data 61 total) (-> this data 62 total)) 10) + (the-as none a3-3) ) + (format fmt-dest " level-code ~192H~5DK~%" (sar (-> this data 65 total) 10) (the-as none a3-3)) + ) + (format + fmt-dest + " tfrag ~192H~5DK ~280Htfragment~456H~5DK~%" + (sar + (+ (-> this data 1 total) + (-> this data 2 total) + (-> this data 3 total) + (-> this data 4 total) + (-> this data 5 total) + (-> this data 6 total) + (-> this data 7 total) + (-> this data 8 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 1 total) 10) + ) + (format + fmt-dest + " tie-proto ~192H~5DK ~280Hsky~456H~5DK~%" + (sar + (+ (-> this data 9 total) + (-> this data 10 total) + (-> this data 11 total) + (-> this data 12 total) + (-> this data 13 total) + (-> this data 14 total) + (-> this data 16 total) + (-> this data 17 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 88 total) 10) + ) + (format + fmt-dest + " tie-instance ~192H~5DK ~280Htie-fragment~456H~5DK~%" + (sar (+ (-> this data 18 total) (-> this data 20 total) (-> this data 21 total) (-> this data 22 total)) 10) + (sar (-> *dma-mem-usage* data 9 total) 10) + ) + (format + fmt-dest + " shrub-proto ~192H~5DK ~280Htie-scissor~456H~5DK~%" + (sar + (+ (-> this data 25 total) + (-> this data 26 total) + (-> this data 27 total) + (-> this data 28 total) + (-> this data 29 total) + (-> this data 30 total) + (-> this data 31 total) + (-> this data 32 total) + (-> this data 33 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 15 total) 10) + ) + (format + fmt-dest + " shrub-instance ~192H~5DK ~280Hshrubbery~456H~5DK~%" + (sar (-> this data 34 total) 10) + (sar (-> *dma-mem-usage* data 27 total) 10) + ) + (format + fmt-dest + " collision ~192H~5DK ~280Htie-generic~456H~5DK~%" + (sar + (+ (-> this data 50 total) + (-> this data 51 total) + (-> this data 52 total) + (-> this data 53 total) + (-> this data 54 total) + (-> this data 55 total) + (-> this data 56 total) + (-> this data 57 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 17 total) 10) + ) + (format + fmt-dest + " pris-geo ~192H~5DK ~280Hpris-fragment~456H~5DK~%" + (sar + (+ (-> this data 35 total) + (-> this data 36 total) + (-> this data 37 total) + (-> this data 38 total) + (-> this data 39 total) + (-> this data 40 total) + (-> this data 41 total) + (-> this data 42 total) + (-> this data 73 total) + (-> this data 74 total) + (-> this data 75 total) + (-> this data 76 total) + (-> this data 78 total) + (-> this data 81 total) + (-> this data 80 total) + (-> this data 111 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 35 total) 10) + ) + (format + fmt-dest + " pris-anim ~192H~5DK ~280Hpris-generic~456H~5DK~%" + (sar + (+ (-> this data 67 total) + (-> this data 68 total) + (-> this data 69 total) + (-> this data 70 total) + (-> this data 71 total) + (-> this data 77 total) + (-> this data 79 total) + (-> this data 72 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 89 total) 10) + ) + (format + fmt-dest + " textures ~192H~5DK ~280Htextures~456H~5DK~%" + (sar (-> this data 82 total) 10) + (sar (-> *dma-mem-usage* data 82 total) 10) + ) + (format fmt-dest " entity ~192H~5DK~%" (sar + (+ (-> this data 66 total) + (-> this data 43 total) + (-> this data 44 total) + (-> this data 45 total) + (-> this data 49 total) + (-> this data 48 total) + (-> this data 46 total) + (-> this data 47 total) + ) + 10 + ) + ) + (format + fmt-dest + " misc ~192H~5DK ~280Hsprite~456H~5DK~%" + (sar + (+ (-> this data 0 total) + (-> this data 63 total) + (-> this data 64 total) + (-> this data 83 total) + (-> this data 84 total) + ) + 10 + ) + (sar (-> *dma-mem-usage* data 85 total) 10) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/menu_REF.gc b/test/decompiler/reference/jak2/engine/debug/menu_REF.gc index b669e821f3..a74f154067 100644 --- a/test/decompiler/reference/jak2/engine/debug/menu_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/menu_REF.gc @@ -682,18 +682,7 @@ ;; ERROR: Stack slot load at 96 mismatch: defined as size 4, got size 16 ;; ERROR: Stack slot load at 128 mismatch: defined as size 4, got size 16 (defun debug-menu-make-from-template ((arg0 debug-menu-context) (arg1 pair)) - (local-vars - (s4-0 debug-menu-node) - (sv-16 object) - (sv-32 (function object int int)) - (sv-48 int) - (sv-64 (function object int int)) - (sv-80 (function object float float)) - (sv-96 float) - (sv-112 (function object float float)) - (sv-128 float) - (sv-144 (function object int int)) - ) + (local-vars (s4-0 debug-menu-node)) (when (or (not arg1) (null? arg1)) (set! s4-0 (the-as debug-menu-node #f)) (goto cfg-39) @@ -768,79 +757,44 @@ ) ) ((or (= s5-0 'int-var) (= s5-0 'int-var-gat1) (= s5-0 'hex-var)) - (set! s4-0 (new - 'debug - 'debug-menu-item-var - (the-as string s4-1) - (the-as int (car (cdr (cdr arg1)))) - (the-as int (ref arg1 4)) - ) - ) - (let ((s3-4 debug-menu-item-var-make-int) - (s2-3 (the-as debug-menu-item-var s4-0)) - (s1-3 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s0-2 (command-get-int (ref arg1 5) 0)) - ) - (set! sv-16 (ref arg1 6)) - (set! sv-32 command-get-int) - (let ((a0-24 (ref arg1 7)) - (a1-18 0) + (set! s4-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s4-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) ) - (set! sv-48 (sv-32 a0-24 a1-18)) - ) - (set! sv-64 command-get-int) - (let* ((a0-26 (ref arg1 8)) - (a1-20 0) - (t1-0 (sv-64 a0-26 a1-20)) - (t2-0 (= s5-0 'hex-var)) - ) - (s3-4 s2-3 (the-as (function int debug-menu-msg int int int) s1-3) s0-2 (the-as symbol sv-16) sv-48 t1-0 t2-0) - ) + ) + (debug-menu-item-var-make-int + (the-as debug-menu-item-var s4-0) + (the-as (function int debug-menu-msg int int int) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (command-get-int (ref arg1 5) 0) + (the-as symbol (ref arg1 6)) + (command-get-int (ref arg1 7) 0) + (command-get-int (ref arg1 8) 0) + (= s5-0 'hex-var) ) s4-0 ) ((= s5-0 'float-var) - (set! s4-0 (new - 'debug - 'debug-menu-item-var - (the-as string s4-1) - (the-as int (car (cdr (cdr arg1)))) - (the-as int (ref arg1 4)) - ) - ) - (let ((s5-5 debug-menu-item-var-make-float) - (s3-6 (the-as debug-menu-item-var s4-0)) - (s2-5 (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) - (s1-6 (command-get-float (ref arg1 5) 0.0)) - (s0-3 (ref arg1 6)) - ) - (set! sv-80 command-get-float) - (let ((a0-35 (ref arg1 7)) - (a1-28 0.0) + (set! s4-0 + (new + 'debug + 'debug-menu-item-var + (the-as string s4-1) + (the-as int (car (cdr (cdr arg1)))) + (the-as int (ref arg1 4)) ) - (set! sv-96 (sv-80 a0-35 a1-28)) - ) - (set! sv-112 command-get-float) - (let ((a0-37 (ref arg1 8)) - (a1-30 0.0) - ) - (set! sv-128 (sv-112 a0-37 a1-30)) - ) - (set! sv-144 command-get-int) - (let* ((a0-39 (ref arg1 9)) - (a1-32 0) - (t2-1 (sv-144 a0-39 a1-32)) - ) - (s5-5 - s3-6 - (the-as (function int debug-menu-msg float float float) s2-5) - s1-6 - (the-as symbol s0-3) - sv-96 - sv-128 - t2-1 ) - ) + (debug-menu-item-var-make-float + (the-as debug-menu-item-var s4-0) + (the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1)))))) + (command-get-float (ref arg1 5) 0.0) + (the-as symbol (ref arg1 6)) + (command-get-float (ref arg1 7) 0.0) + (command-get-float (ref arg1 8) 0.0) + (command-get-int (ref arg1 9) 0) ) s4-0 ) @@ -1071,7 +1025,6 @@ ;; definition for function debug-menu-render ;; INFO: Used lq/sq (defun debug-menu-render ((arg0 debug-menu) (arg1 int) (arg2 int) (arg3 debug-menu-node) (arg4 int)) - (local-vars (sv-16 dma-buffer) (sv-32 pointer)) (let ((v1-0 0)) (let* ((a0-1 (-> arg0 items)) (a1-1 (car a0-1)) @@ -1108,21 +1061,23 @@ ) ) (set-origin! (-> arg0 context font) s3-1 s2-1) - (set! sv-16 (-> *display* frames (-> *display* on-screen) debug-buf)) - (set! sv-32 (-> sv-16 base)) - (draw-string ">" sv-16 (-> arg0 context font)) - (let ((a3-3 (-> sv-16 base))) - (let ((v1-32 (the-as object (-> sv-16 base)))) - (set! (-> (the-as dma-packet v1-32) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-32) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-32) vif1) (new 'static 'vif-tag)) - (set! (-> sv-16 base) (&+ (the-as pointer v1-32) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug3) - sv-32 - (the-as (pointer dma-tag) a3-3) + (let* ((sv-16 (-> *display* frames (-> *display* on-screen) debug-buf)) + (sv-32 (-> sv-16 base)) + ) + (draw-string ">" sv-16 (-> arg0 context font)) + (let ((a3-3 (-> sv-16 base))) + (let ((v1-32 (the-as object (-> sv-16 base)))) + (set! (-> (the-as dma-packet v1-32) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-32) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-32) vif1) (new 'static 'vif-tag)) + (set! (-> sv-16 base) (&+ (the-as pointer v1-32) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id debug3) + sv-32 + (the-as (pointer dma-tag) a3-3) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc b/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc index b932133a38..fa3dc0c392 100644 --- a/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/nav/mysql-nav-graph_REF.gc @@ -809,7 +809,6 @@ ;; WARN: new jak 2 until loop case, check carefully (defmethod init-from-sql! ((this mysql-nav-graph) (arg0 string) (arg1 string)) "Query the database and initialize the [[mysql-nav-graph]] and all it's related components" - (local-vars (sv-16 string) (sv-32 int) (sv-48 int) (sv-64 int)) (set! (-> this node-array length) 0) (set! (-> this edge-array length) 0) (set! (-> this visnode-array length) 0) @@ -857,35 +856,36 @@ (set! (-> nav-node angle) (* 182.04445 (string->float (-> s2-1 data (+ s1-0 5))))) (set! (-> nav-node radius) (* 4096.0 (string->float (-> s2-1 data (+ s1-0 6))))) (set! (-> nav-node nav_node_flag) (nav-node-flag)) - (set! sv-16 (new 'global 'string 0 (-> s2-1 data (+ s1-0 7)))) - (copy-string<-string sv-16 (-> s2-1 data (+ s1-0 7))) - (until #f - (cond - ((string-prefix= "visited" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag visited)) - ) - ((string-prefix= "blocked" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag blocked)) - ) - ((string-prefix= "pedestrian" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag pedestrian)) - ) - ((string-prefix= "selected" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag selected)) - ) - ((string-prefix= "hidden" sv-16) - (logior! (-> nav-node nav_node_flag) (nav-node-flag hidden)) - ) - (else - #t - (goto cfg-27) - ) - ) - (let ((a1-16 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) - (if (= (-> a1-16 0) 44) - (set! a1-16 (&-> a1-16 1)) + (let ((sv-16 (new 'global 'string 0 (-> s2-1 data (+ s1-0 7))))) + (copy-string<-string sv-16 (-> s2-1 data (+ s1-0 7))) + (until #f + (cond + ((string-prefix= "visited" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag visited)) + ) + ((string-prefix= "blocked" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag blocked)) + ) + ((string-prefix= "pedestrian" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag pedestrian)) + ) + ((string-prefix= "selected" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag selected)) + ) + ((string-prefix= "hidden" sv-16) + (logior! (-> nav-node nav_node_flag) (nav-node-flag hidden)) + ) + (else + #t + (goto cfg-27) ) - (string-suck-up! sv-16 a1-16) + ) + (let ((a1-16 (string-skip-to-char (-> sv-16 data) (the-as uint 44)))) + (if (= (-> a1-16 0) 44) + (set! a1-16 (&-> a1-16 1)) + ) + (string-suck-up! sv-16 a1-16) + ) ) ) #f @@ -929,155 +929,155 @@ (let ((s2-2 0)) (while (< s2-2 (-> s3-3 len)) (when (= (string->int (-> s3-3 data (+ s2-2 11))) (-> this nav_graph_id)) - (let ((s0-2 (string->int (-> s3-3 data (+ s2-2 1))))) - (set! sv-32 (string->int (-> s3-3 data (+ s2-2 2)))) - (set! sv-48 (indexof-nav-node this s0-2)) - (set! sv-64 (indexof-nav-node this sv-32)) - (let ((nav-edge (-> this edge-array data (-> this edge-array length)))) - (when (and (!= sv-48 -1) (!= sv-64 -1)) - (set! (-> nav-edge nav_graph_id) (-> this nav_graph_id)) - (set! (-> nav-edge nav_edge_id) (the-as uint (string->int (-> s3-3 data s2-2)))) - (set! (-> nav-edge nav_node_id_1) (the-as uint s0-2)) - (set! (-> nav-edge nav_node_id_2) (the-as uint sv-32)) - (set! (-> nav-edge mysql-save-flag) (mysql-save-flag)) - (set! (-> nav-edge runtime-id) (the-as uint (-> this edge-array length))) - (set! (-> nav-edge runtime-node-id-1) sv-48) - (set! (-> nav-edge runtime-node-id-2) sv-64) - (let ((s0-3 (-> s3-3 data (+ s2-2 3)))) - (cond - ((string= "default" s0-3) - (set! (-> nav-edge directionality) (nav-directionality default)) - 0 - ) - ((string= "directed" s0-3) - (set! (-> nav-edge directionality) (nav-directionality directed)) - ) - ((string= "bi_directional" s0-3) - (set! (-> nav-edge directionality) (nav-directionality bi_directional)) - ) - ) + (let* ((s0-2 (string->int (-> s3-3 data (+ s2-2 1)))) + (sv-32 (string->int (-> s3-3 data (+ s2-2 2)))) + (sv-48 (indexof-nav-node this s0-2)) + (sv-64 (indexof-nav-node this sv-32)) + (nav-edge (-> this edge-array data (-> this edge-array length))) + ) + (when (and (!= sv-48 -1) (!= sv-64 -1)) + (set! (-> nav-edge nav_graph_id) (-> this nav_graph_id)) + (set! (-> nav-edge nav_edge_id) (the-as uint (string->int (-> s3-3 data s2-2)))) + (set! (-> nav-edge nav_node_id_1) (the-as uint s0-2)) + (set! (-> nav-edge nav_node_id_2) (the-as uint sv-32)) + (set! (-> nav-edge mysql-save-flag) (mysql-save-flag)) + (set! (-> nav-edge runtime-id) (the-as uint (-> this edge-array length))) + (set! (-> nav-edge runtime-node-id-1) sv-48) + (set! (-> nav-edge runtime-node-id-2) sv-64) + (let ((s0-3 (-> s3-3 data (+ s2-2 3)))) + (cond + ((string= "default" s0-3) + (set! (-> nav-edge directionality) (nav-directionality default)) + 0 + ) + ((string= "directed" s0-3) + (set! (-> nav-edge directionality) (nav-directionality directed)) + ) + ((string= "bi_directional" s0-3) + (set! (-> nav-edge directionality) (nav-directionality bi_directional)) + ) ) - (set! (-> nav-edge speed_limit) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 4))))) - (set! (-> nav-edge density) (string->float (-> s3-3 data (+ s2-2 5)))) - (set! (-> nav-edge traffic_edge_flag) 0) - (let ((s0-4 (new 'global 'string 0 (-> s3-3 data (+ s2-2 6))))) - (copy-string<-string s0-4 (-> s3-3 data (+ s2-2 6))) - (until #f - (cond - ((string-prefix= "pedestrian" s0-4) - (logior! (-> nav-edge traffic_edge_flag) 1) - ) - (else - #t - (goto cfg-58) - ) - ) - (let ((a1-30 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) - (if (= (-> a1-30 0) 44) - (set! a1-30 (&-> a1-30 1)) - ) - (string-suck-up! s0-4 a1-30) - ) - ) - ) - #f - (label cfg-58) - (set! (-> nav-edge nav_clock_mask) (nav-clock-mask)) - (let ((s0-5 (new 'global 'string 0 (-> s3-3 data (+ s2-2 7))))) - (copy-string<-string s0-5 (-> s3-3 data (+ s2-2 7))) - (until #f - (cond - ((string-prefix= "phase-1a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1a)) - ) - ((string-prefix= "phase-1" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1)) - ) - ((string-prefix= "phase-2a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2a)) - ) - ((string-prefix= "phase-2" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2)) - ) - ((string-prefix= "phase-3a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3a)) - ) - ((string-prefix= "phase-3" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3)) - ) - ((string-prefix= "phase-4a" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4a)) - ) - ((string-prefix= "phase-4" s0-5) - (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4)) - ) - (else - #t - (goto cfg-80) - ) - ) - (let ((a1-42 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) - (if (= (-> a1-42 0) 44) - (set! a1-42 (&-> a1-42 1)) - ) - (string-suck-up! s0-5 a1-42) - ) - ) - ) - #f - (label cfg-80) - (let ((s0-6 (-> s3-3 data (+ s2-2 8)))) - (cond - ((string= "no-clock" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type no-clock)) - 0 - ) - ((string= "clock2" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type clock2)) - ) - ((string= "clock3" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type clock3)) - ) - ((string= "clock4" s0-6) - (set! (-> nav-edge nav_clock_type) (nav-clock-type clock4)) - ) - ) - ) - (set! (-> nav-edge width) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 9))))) - (set! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag)) - (let ((s0-7 (new 'global 'string 0 (-> s3-3 data (+ s2-2 10))))) - (copy-string<-string s0-7 (-> s3-3 data (+ s2-2 10))) - (until #f - (cond - ((string-prefix= "pass-red" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-red)) - ) - ((string-prefix= "pass-green" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-green)) - ) - ((string-prefix= "pass-yellow" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-yellow)) - ) - ((string-prefix= "pass-blue" s0-7) - (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-blue)) - ) - (else - #t - (goto cfg-102) - ) - ) - (let ((a1-54 (string-skip-to-char (-> s0-7 data) (the-as uint 44)))) - (if (= (-> a1-54 0) 44) - (set! a1-54 (&-> a1-54 1)) - ) - (string-suck-up! s0-7 a1-54) - ) - ) - ) - #f - (label cfg-102) - (+! (-> this edge-array length) 1) ) + (set! (-> nav-edge speed_limit) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 4))))) + (set! (-> nav-edge density) (string->float (-> s3-3 data (+ s2-2 5)))) + (set! (-> nav-edge traffic_edge_flag) 0) + (let ((s0-4 (new 'global 'string 0 (-> s3-3 data (+ s2-2 6))))) + (copy-string<-string s0-4 (-> s3-3 data (+ s2-2 6))) + (until #f + (cond + ((string-prefix= "pedestrian" s0-4) + (logior! (-> nav-edge traffic_edge_flag) 1) + ) + (else + #t + (goto cfg-58) + ) + ) + (let ((a1-30 (string-skip-to-char (-> s0-4 data) (the-as uint 44)))) + (if (= (-> a1-30 0) 44) + (set! a1-30 (&-> a1-30 1)) + ) + (string-suck-up! s0-4 a1-30) + ) + ) + ) + #f + (label cfg-58) + (set! (-> nav-edge nav_clock_mask) (nav-clock-mask)) + (let ((s0-5 (new 'global 'string 0 (-> s3-3 data (+ s2-2 7))))) + (copy-string<-string s0-5 (-> s3-3 data (+ s2-2 7))) + (until #f + (cond + ((string-prefix= "phase-1a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1a)) + ) + ((string-prefix= "phase-1" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-1)) + ) + ((string-prefix= "phase-2a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2a)) + ) + ((string-prefix= "phase-2" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-2)) + ) + ((string-prefix= "phase-3a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3a)) + ) + ((string-prefix= "phase-3" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-3)) + ) + ((string-prefix= "phase-4a" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4a)) + ) + ((string-prefix= "phase-4" s0-5) + (logior! (-> nav-edge nav_clock_mask) (nav-clock-mask phase-4)) + ) + (else + #t + (goto cfg-80) + ) + ) + (let ((a1-42 (string-skip-to-char (-> s0-5 data) (the-as uint 44)))) + (if (= (-> a1-42 0) 44) + (set! a1-42 (&-> a1-42 1)) + ) + (string-suck-up! s0-5 a1-42) + ) + ) + ) + #f + (label cfg-80) + (let ((s0-6 (-> s3-3 data (+ s2-2 8)))) + (cond + ((string= "no-clock" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type no-clock)) + 0 + ) + ((string= "clock2" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type clock2)) + ) + ((string= "clock3" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type clock3)) + ) + ((string= "clock4" s0-6) + (set! (-> nav-edge nav_clock_type) (nav-clock-type clock4)) + ) + ) + ) + (set! (-> nav-edge width) (* 4096.0 (string->float (-> s3-3 data (+ s2-2 9))))) + (set! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag)) + (let ((s0-7 (new 'global 'string 0 (-> s3-3 data (+ s2-2 10))))) + (copy-string<-string s0-7 (-> s3-3 data (+ s2-2 10))) + (until #f + (cond + ((string-prefix= "pass-red" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-red)) + ) + ((string-prefix= "pass-green" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-green)) + ) + ((string-prefix= "pass-yellow" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-yellow)) + ) + ((string-prefix= "pass-blue" s0-7) + (logior! (-> nav-edge minimap_edge_flag) (nav-minimap-edge-flag pass-blue)) + ) + (else + #t + (goto cfg-102) + ) + ) + (let ((a1-54 (string-skip-to-char (-> s0-7 data) (the-as uint 44)))) + (if (= (-> a1-54 0) 44) + (set! a1-54 (&-> a1-54 1)) + ) + (string-suck-up! s0-7 a1-54) + ) + ) + ) + #f + (label cfg-102) + (+! (-> this edge-array length) 1) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/nav/nav-graph-editor_REF.gc b/test/decompiler/reference/jak2/engine/debug/nav/nav-graph-editor_REF.gc index cfddb3a125..d6b21f6b75 100644 --- a/test/decompiler/reference/jak2/engine/debug/nav/nav-graph-editor_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/nav/nav-graph-editor_REF.gc @@ -499,7 +499,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod nav-graph-editor-method-28 ((this nav-graph-editor)) - (local-vars (sv-144 int) (sv-160 (function _varargs_ object))) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -520,11 +519,7 @@ (set! (-> v1-8 w) (-> s2-0 radius)) ) (set! (-> s2-0 cam-dist) (vector-vector-distance-squared s3-0 (camera-pos))) - (let ((f0-6 (-> s2-0 cam-dist)) - (f1-0 (-> this clipping-dist)) - ) - (set! (-> s2-0 visible) (< f0-6 (* f1-0 f1-0))) - ) + (set! (-> s2-0 visible) (< (-> s2-0 cam-dist) (square (-> this clipping-dist)))) (if (or (and (-> this vehicle-edit-mode) (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian))) (and (not (-> this vehicle-edit-mode)) (not (logtest? (-> s2-0 nav_node_flag) (nav-node-flag pedestrian)))) ) @@ -559,48 +554,46 @@ (add-debug-x #t (bucket-id debug2) s3-0 *color-red*) (let ((s1-1 add-debug-text-3d) (s0-1 #t) + (sv-144 324) ) - (set! sv-144 324) - (set! sv-160 format) - (let ((a0-16 (clear *temp-string*)) - (a1-8 "~D") - (a2-6 (-> s2-0 nav_mesh_id)) + (format (clear *temp-string*) "~D" (-> s2-0 nav_mesh_id)) + (let ((a2-7 *temp-string*) + (a3-2 s3-0) + (v1-24 (-> s2-0 level_name)) ) - (sv-160 a0-16 a1-8 a2-6) - ) - (let* ((a2-7 *temp-string*) - (a3-2 s3-0) - (v1-24 (-> s2-0 level_name)) - (t0-1 (cond - ((= v1-24 'ctyport) - 3 - ) - ((= v1-24 'ctyinda) - 4 - ) - ((= v1-24 'ctyindb) - 5 - ) - ((= v1-24 'ctypal) - 6 - ) - ((= v1-24 'ctysluma) - 7 - ) - ((= v1-24 'ctyslumb) - 8 - ) - ((= v1-24 'ctyslumc) - 9 - ) - (else - 1 - ) - ) - ) - (t1-0 #f) + (s1-1 + s0-1 + (the-as bucket-id sv-144) + a2-7 + a3-2 + (cond + ((= v1-24 'ctyport) + (font-color red) ) - (s1-1 s0-1 (the-as bucket-id sv-144) a2-7 a3-2 (the-as font-color t0-1) (the-as vector2h t1-0)) + ((= v1-24 'ctyinda) + (font-color orange) + ) + ((= v1-24 'ctyindb) + (font-color yellow) + ) + ((= v1-24 'ctypal) + (font-color green) + ) + ((= v1-24 'ctysluma) + (font-color blue) + ) + ((= v1-24 'ctyslumb) + (font-color cyan) + ) + ((= v1-24 'ctyslumc) + (font-color pink) + ) + (else + (font-color white) + ) + ) + (the-as vector2h #f) + ) ) ) (let ((s1-2 (new 'stack-no-clear 'vector))) @@ -1077,7 +1070,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod nav-graph-editor-method-43 ((this nav-graph-editor)) - (local-vars (sv-128 vector) (sv-144 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1111,9 +1103,9 @@ ) (let ((f30-0 0.0) (s0-1 ray-cylinder-intersect) + (sv-128 (-> this mouse-pos)) + (sv-144 (new 'stack-no-clear 'vector)) ) - (set! sv-128 (-> this mouse-pos)) - (set! sv-144 (new 'stack-no-clear 'vector)) (let ((v1-18 (-> this mouse-hit-pick)) (a0-13 (-> this mouse-pos)) ) @@ -1123,18 +1115,21 @@ (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-144 quad) vf6) - (let ((a3-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 1.0)) - (t0-0 1024.0) - (t1-0 (vector-length s2-0)) - (t2-0 s3-0) - ) - (when (< f30-0 (s0-1 sv-128 sv-144 s1-0 a3-3 t0-0 t1-0 t2-0)) - (let ((f0-1 (vector-vector-distance s3-0 (-> this mouse-pos)))) - (when (or (= (-> this selected-index) -1) (< f0-1 (-> this selected-dist))) - (set! (-> this selected-index) s4-0) - (set! (-> this selected-dist) f0-1) - (set! (-> this selected-node-edge?) #f) - ) + (when (< f30-0 (s0-1 + sv-128 + sv-144 + s1-0 + (vector-normalize-copy! (new 'stack-no-clear 'vector) s2-0 1.0) + 1024.0 + (vector-length s2-0) + s3-0 + ) + ) + (let ((f0-1 (vector-vector-distance s3-0 (-> this mouse-pos)))) + (when (or (= (-> this selected-index) -1) (< f0-1 (-> this selected-dist))) + (set! (-> this selected-index) s4-0) + (set! (-> this selected-dist) f0-1) + (set! (-> this selected-node-edge?) #f) ) ) ) @@ -2235,16 +2230,6 @@ ;; definition for function smooth-nav-graph ;; INFO: Used lq/sq (defun smooth-nav-graph ((arg0 string)) - (local-vars - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 mysql-nav-edge) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2257,52 +2242,54 @@ (s2-0 (new-stack-vector0)) (s0-0 (new-stack-vector0)) (s1-0 (new-stack-vector0)) + (sv-96 0) + (sv-112 0) ) - (set! sv-96 0) - (set! sv-112 0) (when (and (not (logtest? (-> s3-0 mysql-save-flag) (mysql-save-flag delete))) (= (-> s3-0 level_name) arg0)) - (set! sv-128 0) - (while (< sv-128 (-> s5-0 edge-array length)) - (set! sv-144 (-> s5-0 edge-array data sv-128)) - (when (not (logtest? (-> sv-144 mysql-save-flag) (mysql-save-flag delete))) - (when (= (-> sv-144 runtime-node-id-1) s4-0) - (let ((v1-27 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) - (a1-3 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) - ) - (set! sv-176 s1-0) - (set! sv-160 s1-0) - (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-3 position) (-> v1-27 position)) 1.0)) + (let ((sv-128 0)) + (while (< sv-128 (-> s5-0 edge-array length)) + (let ((sv-144 (-> s5-0 edge-array data sv-128))) + (when (not (logtest? (-> sv-144 mysql-save-flag) (mysql-save-flag delete))) + (when (= (-> sv-144 runtime-node-id-1) s4-0) + (let ((v1-27 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-3 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + (sv-176 s1-0) + ) + (let ((sv-160 s1-0) + (v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-3 position) (-> v1-27 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> v0-0 quad)) ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-160 quad)) - (.lvf vf5 (&-> v0-0 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-176 quad) vf6) + ) + (+! sv-112 1) + sv-112 + ) + (when (= (-> sv-144 runtime-node-id-2) s4-0) + (let ((v1-40 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) + (a1-9 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) + (sv-208 s0-0) + ) + (let ((sv-192 s0-0) + (v0-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-9 position) (-> v1-40 position)) 1.0)) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-192 quad)) + (.lvf vf5 (&-> v0-1 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-208 quad) vf6) + ) + (+! sv-96 1) + sv-96 ) ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-176 quad) vf6) - (set! sv-112 (+ sv-112 1)) - sv-112 - ) - (when (= (-> sv-144 runtime-node-id-2) s4-0) - (let ((v1-40 (-> s5-0 node-array data (-> sv-144 runtime-node-id-1))) - (a1-9 (-> s5-0 node-array data (-> sv-144 runtime-node-id-2))) - ) - (set! sv-208 s0-0) - (set! sv-192 s0-0) - (let ((v0-1 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> a1-9 position) (-> v1-40 position)) 1.0)) - ) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-192 quad)) - (.lvf vf5 (&-> v0-1 quad)) - ) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-208 quad) vf6) - (set! sv-96 (+ sv-96 1)) - sv-96 ) + (+! sv-128 1) ) - (set! sv-128 (+ sv-128 1)) ) (cond ((and (>= sv-112 2) (= sv-96 1)) @@ -2350,7 +2337,6 @@ ;; definition for function update-width ;; INFO: Used lq/sq (defun update-width ((arg0 string)) - (local-vars (sv-16 (array entity-nav-mesh)) (sv-32 int) (sv-48 uint) (sv-64 entity-nav-mesh)) (let ((s5-0 (-> (ppointer->process *nav-graph-editor*) nav-graph))) (dotimes (s4-0 (-> s5-0 edge-array length)) (let ((s3-0 (-> s5-0 edge-array data s4-0))) @@ -2368,32 +2354,31 @@ (dotimes (s0-0 (-> *level* length)) (let ((v1-25 (-> *level* level s0-0))) (when (= (-> v1-25 status) 'active) - (set! sv-16 (-> v1-25 bsp nav-meshes)) - (when (nonzero? sv-16) - (set! sv-32 0) - (while (< sv-32 (-> sv-16 length)) - (set! sv-64 (-> sv-16 sv-32)) - (set! sv-48 (-> sv-64 aid)) - (let ((v1-36 (if (type? sv-64 entity-nav-mesh) - sv-64 - ) - ) - ) - (when (and v1-36 (= sv-48 (-> s2-0 nav_mesh_id))) - (let* ((f0-0 (nav-mesh-method-35 (-> v1-36 nav-mesh) (-> s2-0 position) (-> s1-0 position) 16384.0)) - (f0-1 (+ -409.6 f0-0)) + (let ((sv-16 (-> v1-25 bsp nav-meshes))) + (when (nonzero? sv-16) + (let ((sv-32 0)) + (while (< sv-32 (-> sv-16 length)) + (let* ((sv-64 (-> sv-16 sv-32)) + (sv-48 (-> sv-64 aid)) + (v1-36 (as-type sv-64 entity-nav-mesh)) ) - (when (and (< 0.0 f0-1) (!= f0-1 (-> s3-0 width))) - (set! (-> s3-0 width) f0-1) - (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) - ) - (if (>= 0.0 f0-1) - (format #t "!!!! edge ~D ~D outside nav-mesh~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + (when (and v1-36 (= sv-48 (-> s2-0 nav_mesh_id))) + (let* ((f0-0 (nav-mesh-method-35 (-> v1-36 nav-mesh) (-> s2-0 position) (-> s1-0 position) 16384.0)) + (f0-1 (+ -409.6 f0-0)) + ) + (when (and (< 0.0 f0-1) (!= f0-1 (-> s3-0 width))) + (set! (-> s3-0 width) f0-1) + (logior! (-> s3-0 mysql-save-flag) (mysql-save-flag update)) + ) + (if (>= 0.0 f0-1) + (format #t "!!!! edge ~D ~D outside nav-mesh~%" (-> s2-0 nav_node_id) (-> s1-0 nav_node_id)) + ) ) + ) ) + (+! sv-32 1) ) ) - (set! sv-32 (+ sv-32 1)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/debug/viewer_REF.gc b/test/decompiler/reference/jak2/engine/debug/viewer_REF.gc index 66e76f961c..cd2b9cbe7c 100644 --- a/test/decompiler/reference/jak2/engine/debug/viewer_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/viewer_REF.gc @@ -251,31 +251,29 @@ ;; definition for function add-a-bunch ;; INFO: Used lq/sq (defun add-a-bunch ((arg0 string) (arg1 int) (arg2 int) (arg3 float) (arg4 process-tree) (arg5 entity-actor)) - (local-vars (sv-32 int) (sv-48 process) (sv-64 vector)) (dotimes (s0-0 arg1) - (set! sv-32 0) - (while (< sv-32 arg2) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! (-> sv-64 quad) (the-as uint128 0)) - (position-in-front-of-camera! sv-64 40960.0 4096.0) - (+! (-> sv-64 x) (the float (* (- s0-0 (/ arg1 2)) (the int arg3)))) - (+! (-> sv-64 z) (the float (* (- sv-32 (/ arg2 2)) (the int arg3)))) - (set! sv-48 (get-process *default-dead-pool* viewer #x4000)) - (when sv-48 - (let ((t9-2 (method-of-type viewer activate))) - (t9-2 (the-as viewer sv-48) arg4 (symbol->string (-> viewer symbol)) (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-7 sv-48) - (a1-4 init-viewer-for-other) - (a2-6 arg0) - (t0-1 arg5) + (let ((sv-32 0)) + (while (< sv-32 arg2) + (let ((sv-64 (new 'stack-no-clear 'vector))) + (set! (-> sv-64 quad) (the-as uint128 0)) + (position-in-front-of-camera! sv-64 40960.0 4096.0) + (+! (-> sv-64 x) (the float (* (- s0-0 (/ arg1 2)) (the int arg3)))) + (+! (-> sv-64 z) (the float (* (- sv-32 (/ arg2 2)) (the int arg3)))) + (let ((sv-48 (get-process *default-dead-pool* viewer #x4000))) + (when sv-48 + ((method-of-type viewer activate) + (the-as viewer sv-48) + arg4 + (symbol->string (-> viewer symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process sv-48 init-viewer-for-other arg0 sv-64 arg5) + (-> sv-48 ppointer) ) - ((the-as (function object object object object object none) t9-3) a0-7 a1-4 a2-6 sv-64 t0-1) + ) ) - (-> sv-48 ppointer) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) ) #f diff --git a/test/decompiler/reference/jak2/engine/dma/dma-disasm_REF.gc b/test/decompiler/reference/jak2/engine/dma/dma-disasm_REF.gc index 92e30ed7b5..55446892a3 100644 --- a/test/decompiler/reference/jak2/engine/dma/dma-disasm_REF.gc +++ b/test/decompiler/reference/jak2/engine/dma/dma-disasm_REF.gc @@ -310,130 +310,133 @@ ;; INFO: Used lq/sq (defun disasm-vif-tag ((arg0 (pointer vif-tag)) (arg1 int) (arg2 symbol) (arg3 symbol)) "Disassemble vif tag, and possibly the associated data." - (local-vars (sv-16 vif-cmd) (sv-32 (pointer vif-tag)) (sv-48 int) (sv-64 vif-unpack-imm)) (let ((gp-0 0)) (while (< gp-0 (* arg1 4)) (let ((s0-0 4)) (let ((s1-0 (-> arg0 0))) (format arg2 " #x~X:" arg0) (dotimes (v1-0 (-> *vif-disasm-table* length)) - (set! sv-16 (-> s1-0 cmd)) - (when (= (logand sv-16 (-> *vif-disasm-table* v1-0 mask)) (-> *vif-disasm-table* v1-0 tag)) - (let ((a0-12 (-> *vif-disasm-table* v1-0 print))) - (cond - ((zero? a0-12) - (format arg2 " (~s :irq ~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq)) - ) - ((= a0-12 1) - (format - arg2 - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> *vif-disasm-table* v1-0 string2) - (-> s1-0 imm) + (let ((sv-16 (-> s1-0 cmd))) + (when (= (logand sv-16 (-> *vif-disasm-table* v1-0 mask)) (-> *vif-disasm-table* v1-0 tag)) + (let ((a0-12 (-> *vif-disasm-table* v1-0 print))) + (cond + ((zero? a0-12) + (format arg2 " (~s :irq ~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq)) ) - ) - ((= a0-12 2) - (let ((t1-1 (-> s1-0 imm))) + ((= a0-12 1) (format arg2 - " (~s :irq ~D :wl ~D :cl ~D)~%" + " (~s :irq ~D :~s #x~X)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq) - (shr (shl (the-as int t1-1) 48) 56) - (shr (shl (the-as int t1-1) 56) 56) + (-> *vif-disasm-table* v1-0 string2) + (-> s1-0 imm) ) ) - ) - ((= a0-12 3) - (set! s0-0 8) - (format - arg2 - " (~s :irq ~D :~s #x~X)~%" - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> *vif-disasm-table* v1-0 string2) - (-> arg0 1) - ) - ) - ((= a0-12 4) - (set! s0-0 20) - (format - arg2 - " (~s :irq ~D :~s " - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> *vif-disasm-table* v1-0 string2) - ) - (format arg2 "#x~X #x~X #x~X #x~X)~%" (-> arg0 1) (-> arg0 2) (-> arg0 3) (-> arg0 4)) - ) - ((= a0-12 5) - (format - arg2 - " (~s :irq ~D :instructions #x~D :addr #x~X)~%" - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> s1-0 num) - (-> s1-0 imm) - ) - ) - ((= a0-12 6) - (if (-> s1-0 imm) - (set! s0-0 #x100000) - (set! s0-0 (the-as int (* (-> s1-0 imm) 16))) - ) - (format arg2 " (~s :irq ~D :qwc #x~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq) (-> s1-0 imm)) - (set! sv-32 (&-> arg0 1)) - (set! sv-48 0) - (while (< sv-48 (the-as int (-> s1-0 imm))) - (format - arg2 - " #x~X: #x~8x #x~8x #x~8x #x~8x~%" - (+ (+ (* sv-48 16) 4) (the-as int arg0)) - (-> sv-32 (* sv-48 4)) - (-> sv-32 (+ (* sv-48 4) 1)) - (-> sv-32 (+ (* sv-48 4) 2)) - (-> sv-32 (+ (* sv-48 4) 3)) - ) - (set! sv-48 (+ sv-48 1)) - ) - #f - ) - ((= a0-12 7) - (set! s0-0 (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* v1-0 val) (-> s1-0 num)) 3)) 4))) - (set! sv-64 (the-as vif-unpack-imm (-> s1-0 imm))) - (format - arg2 - " (~s :irq ~D :num ~D :addr #x~X " - (-> *vif-disasm-table* v1-0 string1) - (-> s1-0 irq) - (-> s1-0 num) - (-> sv-64 addr) - ) - (format - arg2 - ":msk ~D :flg ~D :usn ~D [skip ~d])~%" - (-> s1-0 msk) - (-> sv-64 flg) - (-> sv-64 usn) - (the-as uint s0-0) - ) - (if arg3 - (disasm-vif-details + ((= a0-12 2) + (let ((t1-1 (-> s1-0 imm))) + (format arg2 - (the-as (pointer uint8) arg0) - (logand sv-16 (vif-cmd cmd-mask)) - (the-as int (-> s1-0 num)) + " (~s :irq ~D :wl ~D :cl ~D)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (shr (shl (the-as int t1-1) 48) 56) + (shr (shl (the-as int t1-1) 56) 56) ) ) - ) - ((= a0-12 8) - (format arg2 " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) - ) + ) + ((= a0-12 3) + (set! s0-0 8) + (format + arg2 + " (~s :irq ~D :~s #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + (-> arg0 1) + ) + ) + ((= a0-12 4) + (set! s0-0 20) + (format + arg2 + " (~s :irq ~D :~s " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> *vif-disasm-table* v1-0 string2) + ) + (format arg2 "#x~X #x~X #x~X #x~X)~%" (-> arg0 1) (-> arg0 2) (-> arg0 3) (-> arg0 4)) + ) + ((= a0-12 5) + (format + arg2 + " (~s :irq ~D :instructions #x~D :addr #x~X)~%" + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (-> s1-0 imm) + ) + ) + ((= a0-12 6) + (if (-> s1-0 imm) + (set! s0-0 #x100000) + (set! s0-0 (the-as int (* (-> s1-0 imm) 16))) + ) + (format arg2 " (~s :irq ~D :qwc #x~D)~%" (-> *vif-disasm-table* v1-0 string1) (-> s1-0 irq) (-> s1-0 imm)) + (let ((sv-32 (&-> arg0 1)) + (sv-48 0) + ) + (while (< sv-48 (the-as int (-> s1-0 imm))) + (format + arg2 + " #x~X: #x~8x #x~8x #x~8x #x~8x~%" + (+ (+ (* sv-48 16) 4) (the-as int arg0)) + (-> sv-32 (* sv-48 4)) + (-> sv-32 (+ (* sv-48 4) 1)) + (-> sv-32 (+ (* sv-48 4) 2)) + (-> sv-32 (+ (* sv-48 4) 3)) + ) + (+! sv-48 1) + ) + ) + #f + ) + ((= a0-12 7) + (set! s0-0 (the-as int (+ (logand -4 (+ (* (-> *vif-disasm-table* v1-0 val) (-> s1-0 num)) 3)) 4))) + (let ((sv-64 (the-as vif-unpack-imm (-> s1-0 imm)))) + (format + arg2 + " (~s :irq ~D :num ~D :addr #x~X " + (-> *vif-disasm-table* v1-0 string1) + (-> s1-0 irq) + (-> s1-0 num) + (-> sv-64 addr) + ) + (format + arg2 + ":msk ~D :flg ~D :usn ~D [skip ~d])~%" + (-> s1-0 msk) + (-> sv-64 flg) + (-> sv-64 usn) + (the-as uint s0-0) + ) + ) + (if arg3 + (disasm-vif-details + arg2 + (the-as (pointer uint8) arg0) + (logand sv-16 (vif-cmd cmd-mask)) + (the-as int (-> s1-0 num)) + ) + ) + ) + ((= a0-12 8) + (format arg2 " (*unknown* vif-tag #x~X)~%" (-> s1-0 cmd)) + ) + ) ) + (set! v1-0 (-> *vif-disasm-table* length)) ) - (set! v1-0 (-> *vif-disasm-table* length)) ) ) ) @@ -516,17 +519,8 @@ If mode is #t, print vif tags too. If mode is 'details, also print data unpacked by vif-tags. If verbose is #t, print out the addresses of each tag, and total size statistics. If expected size is negative, it is ignored. Otherwise, only disassemble this much dma data." - (local-vars - (sv-16 object) - (sv-32 dma-packet) - (sv-48 int) - (sv-64 object) - (sv-80 object) - (sv-96 int) - (sv-112 dma-tag) - ) - (set! sv-32 arg0) - (let ((s2-0 arg1) + (let ((sv-32 arg0) + (s2-0 arg1) (s3-0 arg2) (gp-0 arg3) (s1-0 arg4) @@ -538,185 +532,187 @@ (let ((s4-0 0) (s5-0 0) ) - (set! sv-16 0) - (set! sv-48 0) - (set! sv-64 0) - (set! sv-80 1) - (set! sv-96 -1) - (set! sv-112 (new 'static 'dma-tag)) - (while (not s0-0) - (let ((t9-1 valid?) - (a0-2 sv-32) - (a1-2 #f) - (a2-2 "dma-list tag pointer") + (let ((sv-16 0) + (sv-48 0) + (sv-64 0) + (sv-80 1) + (sv-96 -1) + (sv-112 (new 'static 'dma-tag)) + ) + (while (not s0-0) + (let ((t9-1 valid?) + (a0-2 sv-32) + (a1-2 #f) + (a2-2 "dma-list tag pointer") + ) + (cond + ((not (t9-1 a0-2 (the-as type a1-2) a2-2 #t gp-0)) + (format gp-0 "ERROR: dma-list tag pointer invalid~%") + (set! s0-0 'error) + ) + (else + (set! sv-112 (-> sv-32 dma)) + (when (not (or (zero? s5-0) (let ((t9-3 valid?) + (a0-4 sv-16) + (a1-4 #f) + ) + (set! a2-2 "dma-list data pointer") + (t9-3 a0-4 (the-as type a1-4) a2-2 #t gp-0) + ) + ) + ) + (format gp-0 "ERROR: dma-list data pointer invalid~%") + (set! s0-0 'error) + ) + (when (logtest? (the-as dma-tag #x3ff0000) sv-112) + (format gp-0 "ERROR: dma tag has data in reserved bits ~X~%" (the-as none a2-2)) + (set! s0-0 'error) + ) + ) ) + ) + (when (or s3-0 (= s0-0 'error)) + (format gp-0 "#x~8x: " sv-32) + (cond + ((zero? sv-96) + (format gp-0 " ") + ) + ((= sv-96 1) + (format gp-0 " ") + ) + ) + (disasm-dma-tag sv-112 gp-0) + ) (cond - ((not (t9-1 a0-2 (the-as type a1-2) a2-2 #t gp-0)) - (format gp-0 "ERROR: dma-list tag pointer invalid~%") - (set! s0-0 'error) - ) - (else - (set! sv-112 (-> sv-32 dma)) - (when (not (or (zero? s5-0) (let ((t9-3 valid?) - (a0-4 sv-16) - (a1-4 #f) - ) - (set! a2-2 "dma-list data pointer") - (t9-3 a0-4 (the-as type a1-4) a2-2 #t gp-0) - ) - ) - ) - (format gp-0 "ERROR: dma-list data pointer invalid~%") - (set! s0-0 'error) - ) - (when (logtest? (the-as dma-tag #x3ff0000) sv-112) - (format gp-0 "ERROR: dma tag has data in reserved bits ~X~%" (the-as none a2-2)) - (set! s0-0 'error) - ) + (s0-0 ) - ) - ) - (when (or s3-0 (= s0-0 'error)) - (format gp-0 "#x~8x: " sv-32) - (cond - ((zero? sv-96) - (format gp-0 " ") - ) - ((= sv-96 1) - (format gp-0 " ") - ) - ) - (disasm-dma-tag sv-112 gp-0) - ) - (cond - (s0-0 - ) - ((or (= (-> sv-112 id) (dma-tag-id ref)) (= (-> sv-112 id) (dma-tag-id refs)) (zero? (-> sv-112 id))) - (set! sv-16 (-> sv-112 addr)) - (set! sv-48 (the-as int (-> sv-112 qwc))) - (when s2-0 - (let ((v0-10 (disasm-vif-tag (&-> sv-32 vif0) 2 gp-0 (= s2-0 'details)))) - (disasm-vif-tag - (the-as (pointer vif-tag) (+ sv-16 v0-10)) - (the-as int (- (* sv-48 4) (the-as uint (/ v0-10 4)))) - gp-0 - (= s2-0 'details) + ((or (= (-> sv-112 id) (dma-tag-id ref)) (= (-> sv-112 id) (dma-tag-id refs)) (zero? (-> sv-112 id))) + (set! sv-16 (-> sv-112 addr)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (when s2-0 + (let ((v0-10 (disasm-vif-tag (&-> sv-32 vif0) 2 gp-0 (= s2-0 'details)))) + (disasm-vif-tag + (the-as (pointer vif-tag) (+ (the-as uint sv-16) v0-10)) + (the-as int (- (* (the-as uint sv-48) 4) (the-as uint (/ v0-10 4)))) + gp-0 + (= s2-0 'details) + ) ) ) - ) - (set! sv-32 (the-as dma-packet (&-> (the-as (pointer uint64) sv-32) 2))) - (if (= (-> sv-112 id) (dma-tag-id refe)) - (set! s0-0 #t) - ) - ) - ((= (-> sv-112 id) (dma-tag-id cnt)) - (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) - (set! sv-48 (the-as int (-> sv-112 qwc))) - (if s2-0 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) - (the-as int (+ (* sv-48 4) 2)) - gp-0 - (= s2-0 'details) - ) - ) - (set! sv-32 (the-as dma-packet (+ (the-as uint sv-32) (* (+ sv-48 1) 16)))) - sv-32 - ) - ((= (-> sv-112 id) (dma-tag-id next)) - (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) - (set! sv-48 (the-as int (-> sv-112 qwc))) - (if s2-0 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) - (the-as int (+ (* sv-48 4) 2)) - gp-0 - (= s2-0 'details) - ) - ) - (when (= sv-32 (-> sv-112 addr)) - (format gp-0 "ERROR: next tag creates infinite loop.~%") - (set! s0-0 'error) - ) - (set! sv-32 (the-as dma-packet (-> sv-112 addr))) - sv-32 - ) - ((= (-> sv-112 id) (dma-tag-id call)) - (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) - (set! sv-48 (the-as int (-> sv-112 qwc))) - (if s2-0 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) - (the-as int (+ (* sv-48 4) 2)) - gp-0 - (= s2-0 'details) - ) - ) - (set! sv-32 (the-as dma-packet (-> sv-112 addr))) - (set! sv-96 (+ sv-96 1)) - (cond - ((zero? sv-96) - (set! sv-64 (&+ sv-16 sv-48)) - (the-as (pointer uint64) sv-64) - ) - (else - (set! sv-80 (&+ sv-16 sv-48)) - (the-as (pointer uint64) sv-80) - ) - ) - ) - ((= (-> sv-112 id) (dma-tag-id ret)) - (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) - (set! sv-48 (the-as int (-> sv-112 qwc))) - (if s2-0 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) - (the-as int (+ (* sv-48 4) 2)) - gp-0 - (= s2-0 'details) - ) - ) - (let ((v1-123 sv-96)) - (cond - ((zero? v1-123) - (set! sv-32 (the-as dma-packet sv-64)) - sv-32 - ) - ((= v1-123 1) - (set! sv-32 (the-as dma-packet sv-80)) - sv-32 - ) - (else + (set! sv-32 (the-as dma-packet (&-> (the-as (pointer uint64) sv-32) 2))) + (if (= (-> sv-112 id) (dma-tag-id refe)) (set! s0-0 #t) ) - ) ) - (set! sv-96 (+ sv-96 -1)) - sv-96 - ) - ((= (-> sv-112 id) (dma-tag-id end)) - (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) - (set! sv-48 (the-as int (-> sv-112 qwc))) - (set! s0-0 #t) - (if s2-0 - (disasm-vif-tag - (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) - (the-as int (+ (* sv-48 4) 2)) - gp-0 - (= s2-0 'details) + ((= (-> sv-112 id) (dma-tag-id cnt)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* (the-as uint sv-48) 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (set! sv-32 (the-as dma-packet (+ (the-as uint sv-32) (* (+ (the-as uint sv-48) 1) 16)))) + sv-32 + ) + ((= (-> sv-112 id) (dma-tag-id next)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* (the-as uint sv-48) 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (when (= sv-32 (-> sv-112 addr)) + (format gp-0 "ERROR: next tag creates infinite loop.~%") + (set! s0-0 'error) + ) + (set! sv-32 (the-as dma-packet (-> sv-112 addr))) + sv-32 + ) + ((= (-> sv-112 id) (dma-tag-id call)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* (the-as uint sv-48) 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (set! sv-32 (the-as dma-packet (-> sv-112 addr))) + (+! sv-96 1) + (cond + ((zero? sv-96) + (set! sv-64 (&+ (the-as (pointer uint64) sv-16) (the-as uint sv-48))) + (the-as (pointer uint64) (the-as (pointer uint64) sv-64)) + ) + (else + (set! sv-80 (&+ (the-as (pointer uint64) sv-16) (the-as uint sv-48))) + (the-as (pointer uint64) (the-as (pointer uint64) sv-80)) ) ) - ) - (else - (format gp-0 "ERROR: Unknown DMA TAG command.~%") - (set! s0-0 'error) + ) + ((= (-> sv-112 id) (dma-tag-id ret)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* (the-as uint sv-48) 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + (let ((v1-123 sv-96)) + (cond + ((zero? v1-123) + (set! sv-32 (the-as dma-packet sv-64)) + sv-32 + ) + ((= v1-123 1) + (set! sv-32 (the-as dma-packet sv-80)) + sv-32 + ) + (else + (set! s0-0 #t) + ) + ) + ) + (+! sv-96 -1) + sv-96 + ) + ((= (-> sv-112 id) (dma-tag-id end)) + (set! sv-16 (&-> (the-as (pointer uint64) sv-32) 2)) + (set! sv-48 (the-as int (-> sv-112 qwc))) + (set! s0-0 #t) + (if s2-0 + (disasm-vif-tag + (the-as (pointer vif-tag) (&-> (the-as (pointer uint64) sv-32) 1)) + (the-as int (+ (* (the-as uint sv-48) 4) 2)) + gp-0 + (= s2-0 'details) + ) + ) + ) + (else + (format gp-0 "ERROR: Unknown DMA TAG command.~%") + (set! s0-0 'error) + ) ) + (+! s4-0 sv-48) + (+! s5-0 1) + (if (and (>= s1-0 0) (>= s5-0 s1-0)) + (set! s0-0 #t) + ) ) - (+! s4-0 sv-48) - (+! s5-0 1) - (if (and (>= s1-0 0) (>= s5-0 s1-0)) - (set! s0-0 #t) - ) ) (when (or s3-0 (= s0-0 'error)) (format gp-0 "NOTICE: Total tags: ~d~%" s5-0) diff --git a/test/decompiler/reference/jak2/engine/draw/drawable_REF.gc b/test/decompiler/reference/jak2/engine/draw/drawable_REF.gc index f65513767f..95f70f37e7 100644 --- a/test/decompiler/reference/jak2/engine/draw/drawable_REF.gc +++ b/test/decompiler/reference/jak2/engine/draw/drawable_REF.gc @@ -398,7 +398,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun-debug print-prototype-list () - (local-vars (sv-16 (function prototype-bucket-shrub memory-usage-block int prototype-bucket-shrub))) (dotimes (gp-0 (-> *level* length)) (let ((s5-0 (-> *level* level gp-0))) (when (= (-> s5-0 status) 'active) @@ -418,14 +417,7 @@ (mem-usage (-> s1-0 geometry s0-0) *instance-mem-usage* 0) ) ) - (let ((s0-1 s1-0)) - (set! sv-16 (method-of-object s0-1 mem-usage)) - (let ((a1-4 (reset! *instance-mem-usage*)) - (a2-2 0) - ) - (sv-16 s0-1 a1-4 a2-2) - ) - ) + (mem-usage s1-0 (reset! *instance-mem-usage*) 0) (let ((v1-29 (calculate-total *instance-mem-usage*))) (format #t @@ -503,17 +495,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defun-debug draw-instance-info ((arg0 string)) - (local-vars - (sv-16 uint) - (sv-32 uint) - (sv-48 uint) - (sv-64 int) - (sv-80 int) - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 int) - ) (when (and *display-instance-info* *edit-instance*) (let ((s5-0 (find-instance-by-name *edit-instance*))) (when s5-0 @@ -624,30 +605,32 @@ (s2-2 (+ (-> (the-as prototype-bucket-shrub s5-0) count 1) (-> (the-as prototype-bucket-shrub s5-0) count 2))) ) (dotimes (s0-1 (-> s1-2 length)) - (set! sv-16 (shrub-num-tris (-> s1-2 data s0-1))) - (set! sv-32 (-> s1-2 data s0-1 header data 2)) - (set! sv-48 (-> s1-2 data s0-1 header data 0)) - (format - arg0 - "~5D ~4D ~5D ~6f ~D~%" - s0-1 - sv-16 - sv-32 - (/ (* 2.0 (the float sv-16)) (the float (- sv-32 sv-16))) - sv-48 - ) - (+! s3-2 sv-16) - (+! s4-3 sv-32) - (set! f30-0 - (+ 29.0 - (* 5.5 (the float (- sv-32 sv-16))) - (* 22.0 (the float sv-48)) - (* 8.0 (the float sv-32)) - (* 53.0 (the float (/ (+ s2-2 9) (the-as uint 10)))) - (* (the float s2-2) (+ 15.0 (* 5.0 (the float sv-48)) (* 13.5 (the float sv-32)))) - f30-0 - ) + (let ((sv-16 (shrub-num-tris (-> s1-2 data s0-1))) + (sv-32 (-> s1-2 data s0-1 header data 2)) + (sv-48 (-> s1-2 data s0-1 header data 0)) ) + (format + arg0 + "~5D ~4D ~5D ~6f ~D~%" + s0-1 + sv-16 + sv-32 + (/ (* 2.0 (the float sv-16)) (the float (- sv-32 sv-16))) + sv-48 + ) + (+! s3-2 sv-16) + (+! s4-3 sv-32) + (set! f30-0 + (+ 29.0 + (* 5.5 (the float (- sv-32 sv-16))) + (* 22.0 (the float sv-48)) + (* 8.0 (the float sv-32)) + (* 53.0 (the float (/ (+ s2-2 9) (the-as uint 10)))) + (* (the float s2-2) (+ 15.0 (* 5.0 (the float sv-48)) (* 13.5 (the float sv-32)))) + f30-0 + ) + ) + ) ) (format arg0 @@ -662,56 +645,53 @@ ) ) ((= s2-1 instance-tie) - (set! sv-144 0) - (let ((s1-3 0) + (let ((sv-144 0) + (s1-3 0) (s0-2 0) (s2-3 0) ) (format arg0 "~%level visible frags tris dverts strlen tex ttris~%") - (set! sv-64 1) - (set! sv-80 3) - (while (>= sv-80 sv-64) - (let ((v1-100 (-> (the-as prototype-bucket-tie s5-0) tie-geom sv-64))) - (set! sv-96 0) - (set! sv-112 0) - (set! sv-128 0) - (dotimes (a0-36 (-> v1-100 length)) - (set! sv-96 (+ sv-96 (-> v1-100 data a0-36 debug num-tris))) - (set! sv-112 (+ sv-112 (-> v1-100 data a0-36 debug num-dverts))) - (set! sv-128 (+ sv-128 (-> v1-100 data a0-36 tex-count))) + (let ((sv-64 1) + (sv-80 3) ) - (set! sv-144 (+ sv-144 (-> (the-as prototype-bucket-tie s5-0) count sv-64))) - (format - arg0 - "~5D ~7D ~5D ~5D" - sv-64 - (-> (the-as prototype-bucket-tie s5-0) count sv-64) - (-> v1-100 length) - sv-96 + (while (>= sv-80 sv-64) + (let ((v1-100 (-> (the-as prototype-bucket-tie s5-0) tie-geom sv-64)) + (sv-96 0) + (sv-112 0) + (sv-128 0) + ) + (dotimes (a0-36 (-> v1-100 length)) + (+! sv-96 (-> v1-100 data a0-36 debug num-tris)) + (+! sv-112 (-> v1-100 data a0-36 debug num-dverts)) + (+! sv-128 (-> v1-100 data a0-36 tex-count)) + ) + (+! sv-144 (-> (the-as prototype-bucket-tie s5-0) count sv-64)) + (format + arg0 + "~5D ~7D ~5D ~5D" + sv-64 + (-> (the-as prototype-bucket-tie s5-0) count sv-64) + (-> v1-100 length) + sv-96 + ) + (format + arg0 + " ~5D ~6f ~3D ~5D~%" + sv-112 + (/ (* 2.0 (the float sv-96)) (the float (- sv-112 sv-96))) + sv-128 + (* (the-as uint sv-96) (-> (the-as prototype-bucket-tie s5-0) count sv-64)) + ) + (+! s1-3 (* (the-as uint sv-96) (-> (the-as prototype-bucket-tie s5-0) count sv-64))) + (+! s0-2 (* (the-as uint sv-112) (-> (the-as prototype-bucket-tie s5-0) count sv-64))) + (+! s3-2 sv-96) + (+! s4-3 sv-112) + (+! s2-3 sv-128) ) + (+! sv-64 1) ) - (format - arg0 - " ~5D ~6f ~3D ~5D~%" - sv-112 - (/ (* 2.0 (the float sv-96)) (the float (- sv-112 sv-96))) - sv-128 - (* (the-as uint sv-96) (-> (the-as prototype-bucket-tie s5-0) count sv-64)) - ) - (+! s1-3 (* (the-as uint sv-96) (-> (the-as prototype-bucket-tie s5-0) count sv-64))) - (+! s0-2 (* (the-as uint sv-112) (-> (the-as prototype-bucket-tie s5-0) count sv-64))) - (+! s3-2 sv-96) - (+! s4-3 sv-112) - (+! s2-3 sv-128) - (set! sv-64 (+ sv-64 1)) - ) - (let ((t9-20 format) - (a0-52 arg0) - (a1-28 "total ~7D/~3D ~5D") - (a3-12 (-> s5-0 in-level)) - ) - (t9-20 a0-52 a1-28 sv-144 a3-12 s3-2) ) + (format arg0 "total ~7D/~3D ~5D" sv-144 (-> s5-0 in-level) s3-2) (format arg0 " ~5D ~6f ~3D ~5D~%" @@ -786,20 +766,7 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function dma-add-process-drawable has a return type of none, but the expression builder found a return statement. (defun dma-add-process-drawable ((pd process-drawable) (dc draw-control) (flag symbol) (dma-buf dma-buffer)) - (local-vars - (a0-82 int) - (a0-84 int) - (a3-11 uint128) - (sv-16 process-drawable) - (tod time-of-day-context) - (shadow-mask uint) - (lev-idx-for-mood uint) - (my-origin vector) - (lev-mood mood-context) - (light-result-bucket light-hash-bucket) - (index-ptr pointer) - (index-index int) - ) + (local-vars (a0-82 int) (a0-84 int) (a3-11 uint128)) (with-pp (rlet ((acc :class vf) (Q :class vf) @@ -827,62 +794,62 @@ (vf6 :class vf) ) (init-vf0-vector) - (set! sv-16 pd) - (let* ((v1-1 (-> *perf-stats* data 50)) - (a0-1 (-> v1-1 ctrl)) - ) - (+! (-> v1-1 count) 1) - (b! (zero? a0-1) cfg-2 :delay (nop!)) - (.mtc0 Perf 0) - (.sync.l) - (.sync.p) - (.mtpc pcr0 0) - (.mtpc pcr1 0) - (.sync.l) - (.sync.p) - (.mtc0 Perf a0-1) - ) - (.sync.l) - (.sync.p) - (label cfg-2) - 0 - (when (-> *blit-displays-work* menu-mode) - (if (not (logtest? (-> dc status) (draw-control-status hud))) - (return #f) - ) - ) - (logclear! (-> dc status) (draw-control-status on-screen)) - (when (not (logtest? (-> dc status) (draw-control-status no-draw no-draw-temp uninited))) - (let ((fg-bounds (-> (the-as foreground-work #x70000000) bounds)) - (fg-lights (-> (the-as foreground-work #x70000000) lights)) - ) - (set! tod *time-of-day-context*) - (.lvf vf16 (&-> dc origin quad)) - (.svf (&-> fg-bounds quad) vf16) - (when (sphere-in-view-frustum? fg-bounds) - (cond - ((logtest? (-> dc global-effect) (draw-control-global-effect title-light)) - (when (not (-> tod title-updated)) - (set! (-> tod title-updated) #t) - (let ((s1-0 (-> *math-camera* inv-camera-rot)) - (a1-3 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - ) - (set-vector! a1-3 0.612 0.5 -0.612 0.0) - (set-vector! s2-0 -0.696 0.174 0.696 0.0) - (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-3 s1-0) - (vector-matrix*! (-> tod title-light-group dir1 direction) s2-0 s1-0) - ) - ) - (vu-lights<-light-group! fg-lights (-> tod title-light-group)) + (let ((sv-16 pd)) + (let* ((v1-1 (-> *perf-stats* data 50)) + (a0-1 (-> v1-1 ctrl)) ) - (else - (set! shadow-mask (-> dc shadow-mask)) - (let ((shadow-mask-not (lognot shadow-mask))) - (set! lev-idx-for-mood (-> dc level-index)) - (let ((light-idx (-> dc light-index)) - (lg (new 'stack-no-clear 'light-group)) - ) + (+! (-> v1-1 count) 1) + (b! (zero? a0-1) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-1) + ) + (.sync.l) + (.sync.p) + (label cfg-2) + 0 + (when (-> *blit-displays-work* menu-mode) + (if (not (logtest? (-> dc status) (draw-control-status hud))) + (return #f) + ) + ) + (logclear! (-> dc status) (draw-control-status on-screen)) + (when (not (logtest? (-> dc status) (draw-control-status no-draw no-draw-temp uninited))) + (let ((fg-bounds (-> (the-as foreground-work #x70000000) bounds)) + (fg-lights (-> (the-as foreground-work #x70000000) lights)) + (tod *time-of-day-context*) + ) + (.lvf vf16 (&-> dc origin quad)) + (.svf (&-> fg-bounds quad) vf16) + (when (sphere-in-view-frustum? fg-bounds) + (cond + ((logtest? (-> dc global-effect) (draw-control-global-effect title-light)) + (when (not (-> tod title-updated)) + (set! (-> tod title-updated) #t) + (let ((s1-0 (-> *math-camera* inv-camera-rot)) + (a1-3 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + ) + (set-vector! a1-3 0.612 0.5 -0.612 0.0) + (set-vector! s2-0 -0.696 0.174 0.696 0.0) + (vector-matrix*! (the-as vector (-> tod title-light-group)) a1-3 s1-0) + (vector-matrix*! (-> tod title-light-group dir1 direction) s2-0 s1-0) + ) + ) + (vu-lights<-light-group! fg-lights (-> tod title-light-group)) + ) + (else + (let* ((shadow-mask (-> dc shadow-mask)) + (shadow-mask-not (lognot shadow-mask)) + (lev-idx-for-mood (-> dc level-index)) + (light-idx (-> dc light-index)) + (lg (new 'stack-no-clear 'light-group)) + ) (if (and (>= lev-idx-for-mood (the-as uint 6)) (< light-idx (the-as uint 20))) (+! light-idx 20) ) @@ -931,29 +898,32 @@ (dotimes (fg-light-lev-idx (-> *level* length)) (let ((lev (-> *level* level fg-light-lev-idx))) (when (= (-> lev status) 'active) - (let ((light-hash (-> lev light-hash))) - (set! my-origin (-> dc origin)) - (set! lev-mood (-> lev mood-context)) + (let ((light-hash (-> lev light-hash)) + (my-origin (-> dc origin)) + (lev-mood (-> lev mood-context)) + ) (when (nonzero? light-hash) (let ((light-lookup-result (light-hash-get-bucket-index light-hash (-> dc origin)))) (when (!= light-lookup-result -1) - (set! light-result-bucket (-> light-hash bucket-array light-lookup-result)) - (set! index-ptr (+ (+ (-> light-result-bucket index) 0) (the-as uint (-> light-hash index-array)))) - (set! index-index 0) - (while (< index-index (the-as int (-> light-result-bucket count))) - (let* ((light-sphere (-> light-hash light-sphere-array (-> (the-as (pointer uint8) (&+ index-ptr index-index))))) - (palette-idx (-> light-sphere palette-index)) - (interp (if (= palette-idx -1) - 1.0 - (-> lev-mood times palette-idx w) - ) - ) - ) - (if (!= (* (-> light-sphere brightness) interp) 0.0) - (add-light-sphere-to-light-group lg light-sphere my-origin lev-mood) - ) + (let* ((light-result-bucket (-> light-hash bucket-array light-lookup-result)) + (index-ptr (+ (+ (-> light-result-bucket index) 0) (the-as uint (-> light-hash index-array)))) + (index-index 0) + ) + (while (< index-index (the-as int (-> light-result-bucket count))) + (let* ((light-sphere (-> light-hash light-sphere-array (-> (the-as (pointer uint8) (&+ index-ptr index-index))))) + (palette-idx (-> light-sphere palette-index)) + (interp (if (= palette-idx -1) + 1.0 + (-> lev-mood times palette-idx w) + ) + ) + ) + (if (!= (* (-> light-sphere brightness) interp) 0.0) + (add-light-sphere-to-light-group lg light-sphere my-origin lev-mood) + ) + ) + (+! index-index 1) ) - (set! index-index (+ index-index 1)) ) ) ) @@ -985,12 +955,7 @@ (.svf (&-> target-shadow-dir quad) vf1) (vector-normalize! target-shadow-dir -1.0) (when (< (- (-> target-shadow-dir y)) 0.9063) - (let* ((f0-16 0.4226) - (f1-6 (-> target-shadow-dir x)) - (f1-8 (* f1-6 f1-6)) - (f2-0 (-> target-shadow-dir z)) - (f0-17 (/ f0-16 (sqrtf (+ f1-8 (* f2-0 f2-0))))) - ) + (let ((f0-17 (/ 0.4226 (sqrtf (+ (square (-> target-shadow-dir x)) (square (-> target-shadow-dir z))))))) (set! (-> target-shadow-dir x) (* (-> target-shadow-dir x) f0-17)) (set! (-> target-shadow-dir y) -0.9063) (set! (-> target-shadow-dir z) (* (-> target-shadow-dir z) f0-17)) @@ -1006,128 +971,128 @@ ) ) ) - ) - (.lvf vf28 (&-> dc color-mult quad)) - (.lvf vf29 (&-> dc color-emissive quad)) - (.lvf vf2 (&-> fg-lights color 0 quad)) - (.lvf vf3 (&-> fg-lights color 1 quad)) - (.lvf vf4 (&-> fg-lights color 2 quad)) - (.lvf vf5 (&-> fg-lights ambient quad)) - (.mul.vf vf5 vf5 vf28) - (.mul.vf vf2 vf2 vf28) - (.mul.vf vf3 vf3 vf28) - (.mul.vf vf4 vf4 vf28) - (.add.vf vf5 vf5 vf29) - (.svf (&-> fg-lights color 0 quad) vf2) - (.svf (&-> fg-lights color 1 quad) vf3) - (.svf (&-> fg-lights color 2 quad) vf4) - (.svf (&-> fg-lights ambient quad) vf5) - (let ((at-0 *math-camera*)) - (.lvf vf16 (&-> at-0 plane 0 quad)) - (.lvf vf17 (&-> at-0 plane 1 quad)) - (.lvf vf18 (&-> at-0 plane 2 quad)) - (.lvf vf19 (&-> at-0 plane 3 quad)) - (.lvf vf20 (&-> at-0 guard-plane 0 quad)) - (.lvf vf21 (&-> at-0 guard-plane 1 quad)) - (.lvf vf22 (&-> at-0 guard-plane 2 quad)) - (.lvf vf23 (&-> at-0 guard-plane 3 quad)) - (.lvf vf24 (&-> at-0 camera-rot quad 0)) - (.lvf vf25 (&-> at-0 camera-rot quad 1)) - (.lvf vf26 (&-> at-0 camera-rot quad 2)) - (.lvf vf27 (&-> at-0 camera-rot trans quad)) - ) - (let ((fg-dist (-> (the-as foreground-work #x70000000) distance))) - (.lvf vf15 (&-> fg-bounds quad)) - (.mul.w.vf acc vf27 vf0) - (.add.mul.x.vf acc vf24 vf15 acc) - (.add.mul.y.vf acc vf25 vf15 acc) - (.add.mul.z.vf.xyz vf15 vf26 vf15 acc) - (.mul.vf vf28 vf15 vf15) - (.max.w.vf vf29 vf0 vf0) - (.add.y.vf acc vf28 vf28) - (.add.mul.z.vf.x vf28 vf29 vf28 acc) - (.sqrt.vf Q vf28 :ftf #b0) - (.sub.w.vf.w vf28 vf0 vf15) - (.wait.vf) - (.add.vf.w vf15 vf28 Q) - (.svf (&-> fg-dist quad) vf15) - (when (< 0.0 (+ (-> fg-dist z) (-> dc bounds w))) - (let ((lod-idx 0)) - (let ((dist-w (-> fg-dist w))) - (set! (-> dc distance) dist-w) - (when (nonzero? (-> dc lod-set max-lod)) - (cond - ((>= (-> dc force-lod) 0) - (set! lod-idx (-> dc force-lod)) - (if (< (-> dc lod-set lod (-> dc lod-set max-lod) dist) dist-w) - (return #f) - ) - ) - (else - (while (and (< lod-idx (-> dc lod-set max-lod)) (< (-> dc lod-set lod lod-idx dist) dist-w)) - (+! lod-idx 1) + (.lvf vf28 (&-> dc color-mult quad)) + (.lvf vf29 (&-> dc color-emissive quad)) + (.lvf vf2 (&-> fg-lights color 0 quad)) + (.lvf vf3 (&-> fg-lights color 1 quad)) + (.lvf vf4 (&-> fg-lights color 2 quad)) + (.lvf vf5 (&-> fg-lights ambient quad)) + (.mul.vf vf5 vf5 vf28) + (.mul.vf vf2 vf2 vf28) + (.mul.vf vf3 vf3 vf28) + (.mul.vf vf4 vf4 vf28) + (.add.vf vf5 vf5 vf29) + (.svf (&-> fg-lights color 0 quad) vf2) + (.svf (&-> fg-lights color 1 quad) vf3) + (.svf (&-> fg-lights color 2 quad) vf4) + (.svf (&-> fg-lights ambient quad) vf5) + (let ((at-0 *math-camera*)) + (.lvf vf16 (&-> at-0 plane 0 quad)) + (.lvf vf17 (&-> at-0 plane 1 quad)) + (.lvf vf18 (&-> at-0 plane 2 quad)) + (.lvf vf19 (&-> at-0 plane 3 quad)) + (.lvf vf20 (&-> at-0 guard-plane 0 quad)) + (.lvf vf21 (&-> at-0 guard-plane 1 quad)) + (.lvf vf22 (&-> at-0 guard-plane 2 quad)) + (.lvf vf23 (&-> at-0 guard-plane 3 quad)) + (.lvf vf24 (&-> at-0 camera-rot quad 0)) + (.lvf vf25 (&-> at-0 camera-rot quad 1)) + (.lvf vf26 (&-> at-0 camera-rot quad 2)) + (.lvf vf27 (&-> at-0 camera-rot trans quad)) + ) + (let ((fg-dist (-> (the-as foreground-work #x70000000) distance))) + (.lvf vf15 (&-> fg-bounds quad)) + (.mul.w.vf acc vf27 vf0) + (.add.mul.x.vf acc vf24 vf15 acc) + (.add.mul.y.vf acc vf25 vf15 acc) + (.add.mul.z.vf.xyz vf15 vf26 vf15 acc) + (.mul.vf vf28 vf15 vf15) + (.max.w.vf vf29 vf0 vf0) + (.add.y.vf acc vf28 vf28) + (.add.mul.z.vf.x vf28 vf29 vf28 acc) + (.sqrt.vf Q vf28 :ftf #b0) + (.sub.w.vf.w vf28 vf0 vf15) + (.wait.vf) + (.add.vf.w vf15 vf28 Q) + (.svf (&-> fg-dist quad) vf15) + (when (< 0.0 (+ (-> fg-dist z) (-> dc bounds w))) + (let ((lod-idx 0)) + (let ((dist-w (-> fg-dist w))) + (set! (-> dc distance) dist-w) + (when (nonzero? (-> dc lod-set max-lod)) + (cond + ((>= (-> dc force-lod) 0) + (set! lod-idx (-> dc force-lod)) + (if (< (-> dc lod-set lod (-> dc lod-set max-lod) dist) dist-w) + (return #f) + ) + ) + (else + (while (and (< lod-idx (-> dc lod-set max-lod)) (< (-> dc lod-set lod lod-idx dist) dist-w)) + (+! lod-idx 1) + ) ) ) ) - ) - (if (and (< (-> dc lod-set lod lod-idx dist) dist-w) (< (-> dc force-lod) 0)) - (return #f) - ) - (let ((src-lev (-> *level* level (-> dc level-index))) - (corrected-dist (* dist-w (-> *math-camera* fov-correction-factor))) - (tex-use (-> dc mgeo header texture-usage-group)) + (if (and (< (-> dc lod-set lod lod-idx dist) dist-w) (< (-> dc force-lod) 0)) + (return #f) ) - (dotimes (use-fg-idx 7) - (let ((use-idx (+ use-fg-idx 11))) - (if (not (logtest? (-> dc status) (draw-control-status no-closest-distance))) - (set! (-> src-lev closest-object-array use-idx) (fmin (-> src-lev closest-object-array use-idx) dist-w)) - ) - ) - (let ((tex-lod (cond - ((>= corrected-dist (-> tex-use data use-fg-idx data 0 dist)) - 0 - ) - ((>= corrected-dist (-> tex-use data use-fg-idx data 1 dist)) - 1 - ) - (else - 2 + (let ((src-lev (-> *level* level (-> dc level-index))) + (corrected-dist (* dist-w (-> *math-camera* fov-correction-factor))) + (tex-use (-> dc mgeo header texture-usage-group)) + ) + (dotimes (use-fg-idx 7) + (let ((use-idx (+ use-fg-idx 11))) + (if (not (logtest? (-> dc status) (draw-control-status no-closest-distance))) + (set! (-> src-lev closest-object-array use-idx) (fmin (-> src-lev closest-object-array use-idx) dist-w)) + ) + ) + (let ((tex-lod (cond + ((>= corrected-dist (-> tex-use data use-fg-idx data 0 dist)) + 0 + ) + ((>= corrected-dist (-> tex-use data use-fg-idx data 1 dist)) + 1 + ) + (else + 2 + ) ) ) - ) - (a2-23 (+ use-fg-idx 11)) - ) - (let ((a3-10 (-> src-lev texture-mask a2-23 mask quad)) - (t0-3 (-> (the-as (pointer uint128) (+ (the-as uint tex-use) (* 48 use-fg-idx) (* tex-lod 16))) 0)) + (a2-23 (+ use-fg-idx 11)) ) - (.por a3-11 a3-10 t0-3) + (let ((a3-10 (-> src-lev texture-mask a2-23 mask quad)) + (t0-3 (-> (the-as (pointer uint128) (+ (the-as uint tex-use) (* 48 use-fg-idx) (* tex-lod 16))) 0)) + ) + (.por a3-11 a3-10 t0-3) + ) + (set! (-> src-lev texture-mask a2-23 mask quad) a3-11) ) - (set! (-> src-lev texture-mask a2-23 mask quad) a3-11) ) ) + (if (or (guard-band-cull fg-bounds) (< dist-w (* 1.2 (-> *math-camera* d)))) + (logior! (-> dc status) (draw-control-status close-to-screen)) + (logclear! (-> dc status) (draw-control-status close-to-screen)) + ) + (logior! (-> dc status) (draw-control-status on-screen)) + (if (logtest? (-> dc status) (draw-control-status no-draw-bounds no-draw-bounds2)) + (return #f) + ) + (set! (-> pp clock) (-> sv-16 clock)) + (if (or (= lod-idx (-> dc cur-lod)) (logtest? (-> dc status) (draw-control-status lod-set))) + (foreground-draw dc dma-buf dist-w) + ) ) - (if (or (guard-band-cull fg-bounds) (< dist-w (* 1.2 (-> *math-camera* d)))) - (logior! (-> dc status) (draw-control-status close-to-screen)) - (logclear! (-> dc status) (draw-control-status close-to-screen)) + (when (and (< lod-idx (-> dc cur-lod)) (logtest? (-> dc status) (draw-control-status math-skel))) + (let ((v1-159 *matrix-engine*)) + (set! (-> v1-159 (-> v1-159 length)) (process->handle sv-16)) + (+! (-> v1-159 length) 1) ) - (logior! (-> dc status) (draw-control-status on-screen)) - (if (logtest? (-> dc status) (draw-control-status no-draw-bounds no-draw-bounds2)) - (return #f) - ) - (set! (-> pp clock) (-> sv-16 clock)) - (if (or (= lod-idx (-> dc cur-lod)) (logtest? (-> dc status) (draw-control-status lod-set))) - (foreground-draw dc dma-buf dist-w) - ) - ) - (when (and (< lod-idx (-> dc cur-lod)) (logtest? (-> dc status) (draw-control-status math-skel))) - (let ((v1-159 *matrix-engine*)) - (set! (-> v1-159 (-> v1-159 length)) (process->handle sv-16)) - (+! (-> v1-159 length) 1) ) + (lod-set! dc lod-idx) ) - (lod-set! dc lod-idx) + (logior! (-> dc status) (draw-control-status lod-set)) ) - (logior! (-> dc status) (draw-control-status lod-set)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/entity/actor-link-h_REF.gc b/test/decompiler/reference/jak2/engine/entity/actor-link-h_REF.gc index 3549c6f5bf..7dfddaaf1e 100644 --- a/test/decompiler/reference/jak2/engine/entity/actor-link-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/actor-link-h_REF.gc @@ -6,9 +6,9 @@ ;; WARN: Return type mismatch entity vs entity-actor. (defun entity-actor-lookup ((arg0 res-lump) (arg1 symbol) (arg2 int)) "Given an entity (the res-lump), look up a reference to another entity and return that entity." - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16))) + ) (the-as entity-actor (when (and v1-1 (< arg2 (the-as int (-> sv-16 elt-count)))) @@ -27,12 +27,12 @@ (defun entity-actor-count ((arg0 res-lump) (arg1 symbol)) "Get the number of entities that this res references under the name. This works on more than just next/prev." - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (if (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16)) - (the-as int (-> sv-16 elt-count)) - 0 - ) + (let ((sv-16 (new 'static 'res-tag))) + (if (res-lump-data arg0 arg1 pointer :tag-ptr (& sv-16)) + (the-as int (-> sv-16 elt-count)) + 0 + ) + ) ) ;; definition of type actor-link-info diff --git a/test/decompiler/reference/jak2/engine/entity/entity_REF.gc b/test/decompiler/reference/jak2/engine/entity/entity_REF.gc index 9969ea466d..fa395a9a38 100644 --- a/test/decompiler/reference/jak2/engine/entity/entity_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/entity_REF.gc @@ -878,28 +878,28 @@ ;; definition for method 25 of type level-group ;; WARN: Return type mismatch int vs none. (defmethod update-vis-volumes ((this level-group)) - (local-vars (sv-16 pointer) (sv-20 pointer) (sv-24 pointer) (sv-28 process)) (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) (when (= (-> v1-3 status) 'active) (let ((s4-0 (-> v1-3 bsp level entity))) (dotimes (s3-0 (-> s4-0 length)) - (let ((s2-0 (-> s4-0 data s3-0 entity))) - (set! sv-16 (res-lump-data s2-0 'visvol pointer)) - (set! sv-20 (&+ sv-16 0)) - (set! sv-24 (&+ sv-16 16)) - (set! sv-28 (the-as process (as-type (-> s2-0 extra process) process-drawable))) - ) - (when sv-28 - (update-actor-vis-box (the-as process-drawable sv-28) (the-as vector sv-20) (the-as vector sv-24)) - (let ((s2-2 (-> sv-28 child))) - (while s2-2 - (update-actor-vis-box - (the-as process-drawable (the-as process-tree (as-type (-> s2-2 0) process-drawable))) - (the-as vector sv-20) - (the-as vector sv-24) + (let* ((s2-0 (-> s4-0 data s3-0 entity)) + (sv-16 (res-lump-data s2-0 'visvol pointer)) + (sv-20 (&+ sv-16 0)) + (sv-24 (&+ sv-16 16)) + (sv-28 (the-as process (as-type (-> s2-0 extra process) process-drawable))) + ) + (when sv-28 + (update-actor-vis-box (the-as process-drawable sv-28) (the-as vector sv-20) (the-as vector sv-24)) + (let ((s2-2 (-> sv-28 child))) + (while s2-2 + (update-actor-vis-box + (the-as process-drawable (the-as process-tree (as-type (-> s2-2 0) process-drawable))) + (the-as vector sv-20) + (the-as vector sv-24) + ) + (set! s2-2 (-> s2-2 0 brother)) ) - (set! s2-2 (-> s2-2 0 brother)) ) ) ) @@ -965,93 +965,87 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod update-vis-volumes-from-nav-mesh ((this level-group)) - (local-vars - (sv-16 pointer) - (sv-20 vector) - (sv-24 vector) - (sv-28 float) - (sv-32 float) - (sv-36 vector) - (sv-40 entity) - (sv-48 res-tag) - (sv-96 vector) - (sv-112 vector) - ) (dotimes (s5-0 (-> this length)) (let ((v1-3 (-> this level s5-0))) (when (= (-> v1-3 status) 'active) (let ((s4-0 (-> v1-3 bsp level entity))) (dotimes (s3-0 (-> s4-0 length)) - (let ((s2-0 (-> s4-0 data s3-0 entity))) - (set! sv-16 (res-lump-data s2-0 'visvol pointer)) - (set! sv-20 (the-as vector (&+ sv-16 0))) - (set! sv-24 (the-as vector (&+ sv-16 16))) - (set! sv-28 (the-as float -12288.0)) - (set! sv-32 (the-as float 12288.0)) - (set! sv-36 (-> s2-0 extra trans)) - (set! sv-40 s2-0) - (let ((v0-1 (entity-actor-lookup s2-0 'nav-mesh-actor 0))) - (if v0-1 - (set! sv-40 v0-1) + (let* ((s2-0 (-> s4-0 data s3-0 entity)) + (sv-16 (res-lump-data s2-0 'visvol pointer)) + (sv-20 (the-as vector (&+ sv-16 0))) + (sv-24 (the-as vector (&+ sv-16 16))) + (sv-28 (the-as float -12288.0)) + (sv-32 (the-as float 12288.0)) + ) + (let ((sv-36 (-> s2-0 extra trans)) + (sv-40 s2-0) ) - ) - ) - (cond - ((type? sv-40 entity-actor) - (let ((v0-3 (res-lump-value sv-40 'enemy-options uint128 :time -1000000000.0))) - (cond - ((logtest? #x80000 v0-3) - (set! (-> sv-20 quad) (-> sv-36 quad)) - (set! (-> sv-24 quad) (-> sv-36 quad)) - (set! sv-28 (the-as float 409.6)) - (set! sv-32 (the-as float 409.6)) - ) - ((string-prefix= "battle" (res-lump-struct sv-40 'name string)) - (set! (-> sv-20 quad) (-> sv-36 quad)) - (set! (-> sv-24 quad) (-> sv-36 quad)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v0-6 (res-lump-data sv-40 'actor-groups pointer :tag-ptr (& sv-48)))) - (when (and v0-6 (nonzero? (-> sv-48 elt-count))) - (let* ((s2-2 (-> (the-as (pointer actor-group) v0-6) 0)) - (s1-1 (-> s2-2 length)) + (let ((v0-1 (entity-actor-lookup s2-0 'nav-mesh-actor 0))) + (if v0-1 + (set! sv-40 v0-1) + ) + ) + (cond + ((type? sv-40 entity-actor) + (let ((v0-3 (res-lump-value sv-40 'enemy-options uint128 :time -1000000000.0))) + (cond + ((logtest? #x80000 v0-3) + (set! (-> sv-20 quad) (-> sv-36 quad)) + (set! (-> sv-24 quad) (-> sv-36 quad)) + (set! sv-28 (the-as float 409.6)) + (set! sv-32 (the-as float 409.6)) + ) + ((string-prefix= "battle" (res-lump-struct sv-40 'name string)) + (set! (-> sv-20 quad) (-> sv-36 quad)) + (set! (-> sv-24 quad) (-> sv-36 quad)) + (let* ((sv-48 (new 'static 'res-tag)) + (v0-6 (res-lump-data sv-40 'actor-groups pointer :tag-ptr (& sv-48))) ) - (dotimes (s0-0 s1-1) - (let* ((a0-24 (-> s2-2 data s0-0 actor)) - (a0-25 (nav-mesh-from-res-tag a0-24 'nav-mesh-actor 0)) + (when (and v0-6 (nonzero? (-> sv-48 elt-count))) + (let* ((s2-2 (-> (the-as (pointer actor-group) v0-6) 0)) + (s1-1 (-> s2-2 length)) ) - (when a0-25 - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (compute-bounding-box-from-vertices a0-25 sv-96 sv-112) - (expand-bounding-box sv-20 sv-24 sv-96 sv-112) + (dotimes (s0-0 s1-1) + (let* ((a0-24 (-> s2-2 data s0-0 actor)) + (a0-25 (nav-mesh-from-res-tag a0-24 'nav-mesh-actor 0)) + ) + (when a0-25 + (let ((sv-96 (new 'stack-no-clear 'vector)) + (sv-112 (new 'stack-no-clear 'vector)) + ) + (compute-bounding-box-from-vertices a0-25 sv-96 sv-112) + (expand-bounding-box sv-20 sv-24 sv-96 sv-112) + ) + ) + ) ) ) ) ) ) - ) - ) - (else - (let ((a0-28 (nav-mesh-from-res-tag sv-40 'nav-mesh-actor 0))) - (if a0-28 - (compute-bounding-box-from-vertices a0-28 sv-20 sv-24) + (else + (let ((a0-28 (nav-mesh-from-res-tag sv-40 'nav-mesh-actor 0))) + (if a0-28 + (compute-bounding-box-from-vertices a0-28 sv-20 sv-24) + ) ) + ) ) ) ) - ) - ) - (else - (set! (-> sv-20 quad) (-> sv-36 quad)) - (set! (-> sv-24 quad) (-> sv-36 quad)) + (else + (set! (-> sv-20 quad) (-> sv-36 quad)) + (set! (-> sv-24 quad) (-> sv-36 quad)) + ) + ) ) + (+! (-> sv-20 x) sv-28) + (+! (-> sv-20 y) sv-28) + (+! (-> sv-20 z) sv-28) + (+! (-> sv-24 x) sv-32) + (+! (-> sv-24 y) sv-32) + (+! (-> sv-24 z) sv-32) ) - (+! (-> sv-20 x) sv-28) - (+! (-> sv-20 y) sv-28) - (+! (-> sv-20 z) sv-28) - (+! (-> sv-24 x) sv-32) - (+! (-> sv-24 y) sv-32) - (+! (-> sv-24 z) sv-32) ) ) ) @@ -1071,17 +1065,6 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod print-volume-sizes ((this level-group)) - (local-vars - (sv-16 pointer) - (sv-20 float) - (sv-24 vector) - (sv-28 type) - (sv-32 vector) - (sv-36 vector) - (sv-48 int) - (sv-64 entity) - (sv-80 structure) - ) (let ((s5-0 0)) (dotimes (v1-0 (-> this length)) (let ((a0-4 (-> this level v1-0))) @@ -1099,18 +1082,21 @@ (dotimes (s1-0 (-> this length)) (let ((v1-7 (-> this level s1-0))) (when (= (-> v1-7 status) 'active) - (let ((s0-0 (-> v1-7 entity))) - (set! sv-48 (-> s0-0 length)) + (let* ((s0-0 (-> v1-7 entity)) + (sv-48 (-> s0-0 length)) + ) (while (nonzero? sv-48) - (set! sv-48 (+ sv-48 -1)) - (set! sv-64 (-> s0-0 data sv-48 entity)) - (set! sv-80 (res-lump-struct sv-64 'name structure)) - (when (and (or (not s4-0) (string>? (the-as string sv-80) (the-as string s4-0))) - (or (not s2-0) (string s0-0 data sv-48 entity)) + (sv-80 (res-lump-struct sv-64 'name structure)) + ) + (when (and (or (not s4-0) (string>? (the-as string sv-80) (the-as string s4-0))) + (or (not s2-0) (string (the-as entity-actor s3-0) extra trans)) - (set! sv-28 (if (type? (the-as entity-actor s3-0) entity-actor) - (-> (the-as entity-actor s3-0) etype) - (the-as type #f) - ) + (let ((sv-16 (res-lump-data s3-0 'visvol pointer)) + (sv-20 (res-lump-float s3-0 'vis-dist :default 409600.0)) + (sv-24 (-> (the-as entity-actor s3-0) extra trans)) ) - (set! sv-32 (the-as vector (&+ sv-16 0))) - (set! sv-36 (the-as vector (&+ sv-16 16))) - (format #t "actor-vis ~S ~6,,1M " (res-lump-struct s3-0 'name structure) sv-20) - (format - #t - "~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M~%" - (- (-> sv-32 x) (-> sv-24 x)) - (- (-> sv-32 y) (-> sv-24 y)) - (- (-> sv-32 z) (-> sv-24 z)) - (- (-> sv-36 x) (-> sv-24 x)) - (- (-> sv-36 y) (-> sv-24 y)) - (- (-> sv-36 z) (-> sv-24 z)) + (let ((sv-28 (if (type? (the-as entity-actor s3-0) entity-actor) + (-> (the-as entity-actor s3-0) etype) + (the-as type #f) + ) + ) + ) + ) + (let ((sv-32 (the-as vector (&+ sv-16 0))) + (sv-36 (the-as vector (&+ sv-16 16))) + ) + (format #t "actor-vis ~S ~6,,1M " (res-lump-struct s3-0 'name structure) sv-20) + (format + #t + "~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M ~6,,1M~%" + (- (-> sv-32 x) (-> sv-24 x)) + (- (-> sv-32 y) (-> sv-24 y)) + (- (-> sv-32 z) (-> sv-24 z)) + (- (-> sv-36 x) (-> sv-24 x)) + (- (-> sv-36 y) (-> sv-24 y)) + (- (-> sv-36 z) (-> sv-24 z)) + ) + ) ) ) ) @@ -1243,7 +1235,6 @@ ;; definition (debug) for function draw-actor-marks ;; WARN: Return type mismatch int vs none. (defun-debug draw-actor-marks ((arg0 process)) - (local-vars (sv-16 entity-actor) (sv-20 (pointer int32))) (b! (not (and (or (type? arg0 process-drawable) (= (-> arg0 type) part-tracker) (type? arg0 part-spawner)) (nonzero? (-> (the-as part-spawner arg0) root)) @@ -1280,81 +1271,83 @@ (-> (the-as process-drawable arg0) root trans) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) ) - (set! sv-16 (-> (the-as process-drawable arg0) entity)) - (cond - ((and sv-16 (= (-> sv-16 extra process) (the-as process-drawable arg0))) - (add-debug-text-3d - #t - (bucket-id debug-no-zbuf1) - (res-lump-struct sv-16 'name string) - (-> (the-as process-drawable arg0) root trans) - (if (logtest? (-> sv-16 extra perm status) (entity-perm-status bit-0 error)) - (font-color red) - (font-color white) - ) - (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) - ) - (set! sv-20 (res-lump-data sv-16 'eco-info (pointer int32) :time 0.0)) - (when sv-20 - (let ((s5-1 add-debug-text-3d) - (s4-1 #t) - (s3-1 318) + (let ((sv-16 (-> (the-as process-drawable arg0) entity))) + (cond + ((and sv-16 (= (-> sv-16 extra process) (the-as process-drawable arg0))) + (add-debug-text-3d + #t + (bucket-id debug-no-zbuf1) + (res-lump-struct sv-16 'name string) + (-> (the-as process-drawable arg0) root trans) + (if (logtest? (-> sv-16 extra perm status) (entity-perm-status bit-0 error)) + (font-color red) + (font-color white) + ) + (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) + ) + (let ((sv-20 (res-lump-data sv-16 'eco-info (pointer int32) :time 0.0))) + (when sv-20 + (let ((s5-1 add-debug-text-3d) + (s4-1 #t) + (s3-1 318) + ) + (format (clear *temp-string*) "~S ~D~%" (pickup-type->string (the-as pickup-type (-> sv-20 0))) (-> sv-20 1)) + (s5-1 + s4-1 + (the-as bucket-id s3-1) + *temp-string* + (-> (the-as process-drawable arg0) root trans) + (font-color white) + (new 'static 'vector2h :data (new 'static 'array int16 2 0 24)) + ) ) - (format (clear *temp-string*) "~S ~D~%" (pickup-type->string (the-as pickup-type (-> sv-20 0))) (-> sv-20 1)) - (s5-1 - s4-1 - (the-as bucket-id s3-1) - *temp-string* - (-> (the-as process-drawable arg0) root trans) - (font-color white) - (new 'static 'vector2h :data (new 'static 'array int16 2 0 24)) ) ) - ) - (let ((v1-49 (res-lump-struct sv-16 'art-name structure))) - (if (and v1-49 (logtest? (the-as int v1-49) 1)) - (add-debug-text-3d - #t - (bucket-id debug-no-zbuf1) - (symbol->string v1-49) - (-> (the-as process-drawable arg0) root trans) - (font-color white) - (new 'static 'vector2h :data (new 'static 'array int16 2 0 24)) - ) - ) - ) - (when *display-actor-vis* - (let ((v1-54 (res-lump-data sv-16 'visvol pointer)) - (a1-14 (-> sv-16 extra vis-id)) - ) - (if v1-54 - (add-debug-box + (let ((v1-49 (res-lump-struct sv-16 'art-name structure))) + (if (and v1-49 (logtest? (the-as int v1-49) 1)) + (add-debug-text-3d #t (bucket-id debug-no-zbuf1) - (the-as vector (&+ v1-54 0)) - (the-as vector (&+ v1-54 16)) - (if (is-object-visible? (-> sv-16 extra level) a1-14) - (new 'static 'rgba :g #x80 :b #x80 :a #x80) - (new 'static 'rgba :r #x80 :b #x80 :a #x80) - ) + (symbol->string v1-49) + (-> (the-as process-drawable arg0) root trans) + (font-color white) + (new 'static 'vector2h :data (new 'static 'array int16 2 0 24)) ) ) ) + (when *display-actor-vis* + (let ((v1-54 (res-lump-data sv-16 'visvol pointer)) + (a1-14 (-> sv-16 extra vis-id)) + ) + (if v1-54 + (add-debug-box + #t + (bucket-id debug-no-zbuf1) + (the-as vector (&+ v1-54 0)) + (the-as vector (&+ v1-54 16)) + (if (is-object-visible? (-> sv-16 extra level) a1-14) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :b #x80 :a #x80) + ) + ) + ) + ) + ) ) - ) - (else - (let ((s5-3 add-debug-text-3d) - (s4-3 #t) - (s3-3 318) + (else + (let ((s5-3 add-debug-text-3d) + (s4-3 #t) + (s3-3 318) + ) + (format (clear *temp-string*) "pid ~d" (-> (the-as process-drawable arg0) pid)) + (s5-3 + s4-3 + (the-as bucket-id s3-3) + *temp-string* + (-> (the-as process-drawable arg0) root trans) + (font-color green) + (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) ) - (format (clear *temp-string*) "pid ~d" (-> (the-as process-drawable arg0) pid)) - (s5-3 - s4-3 - (the-as bucket-id s3-3) - *temp-string* - (-> (the-as process-drawable arg0) root trans) - (font-color green) - (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) ) ) ) @@ -1379,17 +1372,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod debug-draw-actors ((this level-group) (arg0 symbol)) - (local-vars - (sv-16 symbol) - (sv-20 vector) - (sv-32 int) - (sv-48 (function symbol bucket-id vector vector rgba symbol)) - (sv-64 symbol) - (sv-80 int) - (sv-96 pointer) - (sv-112 pointer) - (sv-128 int) - ) (let ((s4-0 *debug-actor-info*)) (set! (-> s4-0 process) #f) (if (zero? (-> s4-0 handle pid)) @@ -1407,43 +1389,45 @@ ) (set! *debug-actor* (-> s4-0 process)) ) - (set! sv-16 arg0) - (when (and sv-16 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) - (cond - ((= sv-16 'process) - (let ((s5-1 draw-actor-marks)) - (iterate-process-tree *pusher-pool* s5-1 *null-kernel-context*) - (iterate-process-tree *entity-pool* s5-1 *null-kernel-context*) + (let ((sv-16 arg0)) + (when (and sv-16 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress)))) + (cond + ((= sv-16 'process) + (let ((s5-1 draw-actor-marks)) + (iterate-process-tree *pusher-pool* s5-1 *null-kernel-context*) + (iterate-process-tree *entity-pool* s5-1 *null-kernel-context*) + ) ) - ) - (else - (dotimes (s5-2 (-> this length)) - (let ((v1-25 (-> this level s5-2))) - (when (= (-> v1-25 status) 'active) - (let ((s4-1 (-> v1-25 bsp level entity))) - (dotimes (s3-0 (-> s4-1 length)) - (let ((s2-0 (-> s4-1 data s3-0 entity))) - (set! sv-20 (-> s2-0 extra trans)) - (when (or (= sv-16 'full) (-> s2-0 extra process)) - (add-debug-x #t (bucket-id debug-no-zbuf1) sv-20 (if (-> s2-0 extra process) - (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) - (new 'static 'rgba :r #xff :a #x80) - ) - ) - (let ((s1-0 add-debug-text-3d) - (s0-0 #t) - ) - (set! sv-32 318) - (let ((a2-4 (res-lump-struct s2-0 'name structure)) - (a3-2 sv-20) - (t0-1 (if (logtest? (-> s2-0 extra perm status) (entity-perm-status bit-0 error)) - 1 - 5 - ) - ) - (t1-1 (new 'static 'vector2h :data (new 'static 'array int16 2 0 8))) + (else + (dotimes (s5-2 (-> this length)) + (let ((v1-25 (-> this level s5-2))) + (when (= (-> v1-25 status) 'active) + (let ((s4-1 (-> v1-25 bsp level entity))) + (dotimes (s3-0 (-> s4-1 length)) + (let* ((s2-0 (-> s4-1 data s3-0 entity)) + (sv-20 (-> s2-0 extra trans)) + ) + (when (or (= sv-16 'full) (-> s2-0 extra process)) + (add-debug-x #t (bucket-id debug-no-zbuf1) sv-20 (if (-> s2-0 extra process) + (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) + (new 'static 'rgba :r #xff :a #x80) + ) + ) + (let ((s1-0 add-debug-text-3d) + (s0-0 #t) + (sv-32 318) ) - (s1-0 s0-0 (the-as bucket-id sv-32) (the-as string a2-4) a3-2 (the-as font-color t0-1) t1-1) + (s1-0 + s0-0 + (the-as bucket-id sv-32) + (res-lump-struct s2-0 'name string) + sv-20 + (if (logtest? (-> s2-0 extra perm status) (entity-perm-status bit-0 error)) + (font-color white) + (font-color yellow) + ) + (new 'static 'vector2h :data (new 'static 'array int16 2 0 8)) + ) ) ) ) @@ -1468,18 +1452,22 @@ (a1-10 (-> s0-1 extra vis-id)) ) (when (and v0-6 (or (= s5-3 #t) (= s5-3 'box))) - (set! sv-48 add-debug-box) - (set! sv-64 #t) - (set! sv-80 318) - (set! sv-96 (&+ v0-6 0)) - (set! sv-112 (&+ v0-6 16)) - (let ((t0-3 (if (is-object-visible? s3-1 a1-10) - (the-as uint #x80808000) - (the-as uint #x80800080) - ) - ) + (let ((sv-48 add-debug-box) + (sv-64 #t) + (sv-80 318) + (sv-96 (&+ v0-6 0)) + (sv-112 (&+ v0-6 16)) ) - (sv-48 sv-64 (the-as bucket-id sv-80) (the-as vector sv-96) (the-as vector sv-112) (the-as rgba t0-3)) + (sv-48 + sv-64 + (the-as bucket-id sv-80) + (the-as vector sv-96) + (the-as vector sv-112) + (if (is-object-visible? s3-1 a1-10) + (new 'static 'rgba :g #x80 :b #x80 :a #x80) + (new 'static 'rgba :r #x80 :b #x80 :a #x80) + ) + ) ) ) ) @@ -1721,16 +1709,16 @@ (s1-3 (-> s4-8 bsp region-trees s2-4)) ) (while (< s2-4 s3-5) - (let ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length))) - (set! sv-128 0) - (let ((a0-117 (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128))) - (while (< sv-128 s0-4) - (debug-draw-region a0-117 0) - (set! sv-128 (+ sv-128 1)) - (set! a0-117 - (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128) - ) - ) + (let* ((s0-4 (-> s1-3 data2 (+ (-> s1-3 length) -1) length)) + (sv-128 0) + (a0-117 (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128)) + ) + (while (< sv-128 s0-4) + (debug-draw-region a0-117 0) + (+! sv-128 1) + (set! a0-117 + (-> (the-as drawable-inline-array-region-prim (-> s1-3 data2 (+ (-> s1-3 length) -1))) data sv-128) + ) ) ) (+! s2-4 1) @@ -1830,7 +1818,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 s5, Count] ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defmethod birth ((this bsp-header)) - (local-vars (v1-74 int) (s5-0 int) (sv-16 int)) + (local-vars (v1-74 int) (s5-0 int)) (.mfc0 s5-0 Count) (let ((a2-0 (if (nonzero? (-> this actors)) (-> this actors length) @@ -1878,13 +1866,14 @@ (when (= (-> s2-0 status) 'active) (when (nonzero? (-> s2-0 bsp actor-groups)) (countdown (s1-0 (-> s2-0 bsp actor-groups length)) - (let ((s0-0 (-> s2-0 bsp actor-groups s1-0))) - (set! sv-16 0) + (let ((s0-0 (-> s2-0 bsp actor-groups s1-0)) + (sv-16 0) + ) (while (< sv-16 (-> s0-0 length)) (if (not (-> s0-0 data sv-16 actor)) (set! (-> s0-0 data sv-16 actor) (entity-by-aid (-> s0-0 data sv-16 id))) ) - (set! sv-16 (+ sv-16 1)) + (+! sv-16 1) ) ) ) @@ -2278,15 +2267,6 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 17 level-group) has a return type of none, but the expression builder found a return statement. (defmethod actors-update ((this level-group)) - (local-vars - (sv-16 vector) - (sv-24 int) - (sv-32 task-mask) - (sv-48 entity-links) - (sv-64 string) - (sv-80 string) - (sv-96 float) - ) (when *compact-actors* (if (and (= *compact-actors* 'debug) (= (-> *nk-dead-pool* alive-list prev) (-> *nk-dead-pool* first-gap))) (churn *nk-dead-pool* 1) @@ -2317,152 +2297,154 @@ ) ) (when *spawn-actors* - (set! sv-16 (if (movie?) - (math-camera-pos) - (camera-pos) - ) + (let ((sv-16 (if (movie?) + (math-camera-pos) + (camera-pos) + ) + ) + (sv-24 0) ) - (set! sv-24 0) - (dotimes (s5-2 (-> this length)) - (let ((s4-1 (-> this level s5-2))) - (when (= (-> s4-1 status) 'active) - (set! sv-32 (-> s4-1 task-mask)) - (cond - ((= (-> s4-1 display?) 'special) - (let* ((s4-2 (-> s4-1 entity)) - (s3-1 (-> s4-2 length)) - ) - (dotimes (s2-0 s3-1) - (let ((v1-54 (-> s4-2 data s2-0))) - (cond - ((and (logtest? (-> v1-54 kill-mask) (task-mask special)) (not (logtest? (-> v1-54 kill-mask) sv-32))) - (when (not (or (-> v1-54 process) (logtest? (-> v1-54 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-54 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return #f) - ) + (dotimes (s5-2 (-> this length)) + (let ((s4-1 (-> this level s5-2))) + (when (= (-> s4-1 status) 'active) + (let ((sv-32 (-> s4-1 task-mask))) + (cond + ((= (-> s4-1 display?) 'special) + (let* ((s4-2 (-> s4-1 entity)) + (s3-1 (-> s4-2 length)) ) - ) - (else - (if (and (-> v1-54 process) - (not (logtest? (-> v1-54 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> v1-54 process mask) (process-mask no-kill))) + (dotimes (s2-0 s3-1) + (let ((v1-54 (-> s4-2 data s2-0))) + (cond + ((and (logtest? (-> v1-54 kill-mask) (task-mask special)) (not (logtest? (-> v1-54 kill-mask) sv-32))) + (when (not (or (-> v1-54 process) (logtest? (-> v1-54 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-54 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) ) - (kill! (-> v1-54 entity)) - ) - ) - ) - ) - ) - ) - ) - ((= (-> s4-1 display?) 'actor) - (let* ((s4-3 (-> s4-1 entity)) - (s3-2 (-> s4-3 length)) - ) - (dotimes (s2-1 s3-2) - (let ((v1-67 (-> s4-3 data s2-1))) - (cond - ((not (logtest? (-> v1-67 kill-mask) sv-32)) - (when (not (or (-> v1-67 process) (logtest? (-> v1-67 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> v1-67 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return #f) ) - ) - ) - (else - (if (and (-> v1-67 process) - (not (logtest? (-> v1-67 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> v1-67 process mask) (process-mask no-kill))) - ) - (kill! (-> v1-67 entity)) - ) - ) - ) - ) - ) - ) - ) - ((not *vis-actors*) - (let* ((s4-4 (-> s4-1 entity)) - (s3-3 (-> s4-4 length)) - ) - (dotimes (s2-2 s3-3) - (let ((s1-0 (-> s4-4 data s2-2))) - (cond - ((and (< (vector-vector-distance (-> s1-0 trans) sv-16) (-> *ACTOR-bank* birth-dist)) - (not (logtest? (-> s1-0 perm status) (entity-perm-status bit-9 bit-10))) - (not (logtest? (-> s1-0 kill-mask) sv-32)) - ) - (when (not (or (-> s1-0 process) (logtest? (-> s1-0 perm status) (entity-perm-status bit-0 dead)))) - (birth! (-> s1-0 entity)) - (set! sv-24 (+ sv-24 1)) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return #f) - ) - ) - ) - (else - (if (and (-> s1-0 process) - (not (logtest? (-> s1-0 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> s1-0 process mask) (process-mask no-kill))) - ) - (kill! (-> s1-0 entity)) - ) - ) - ) - ) - ) - ) - ) - (*vis-actors* - (when (not (and (-> s4-1 vis-info 0) (-> s4-1 all-visible?))) - (let* ((s3-4 (-> s4-1 entity)) - (s2-3 (-> s3-4 length)) - (s0-0 #f) - ) - (dotimes (s1-1 s2-3) - (set! sv-48 (-> s3-4 data s1-1)) - (cond - ((and (is-object-visible? s4-1 (-> sv-48 vis-id)) - (not (logtest? (-> sv-48 perm status) (entity-perm-status bit-9 bit-10))) - (not (logtest? (-> sv-48 kill-mask) sv-32)) - (or (-> s4-1 vis-info 0) (< (vector-vector-distance (-> sv-48 trans) sv-16) (-> sv-48 vis-dist))) - ) - (when (not (or (-> sv-48 process) (logtest? (-> sv-48 perm status) (entity-perm-status bit-0 dead)) s0-0)) - (birth! (-> sv-48 entity)) - (set! sv-24 (+ sv-24 1)) - (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) - (when *debug-segment* - (let ((s0-1 format)) - (set! sv-64 *stdcon*) - (set! sv-80 "low actor memory, no birth triggered!!! ~,,0fK/~,,0fK~%") - (set! sv-96 (* 0.0009765625 (the float (memory-free *nk-dead-pool*)))) - (let ((a3-2 (* 0.0009765625 (the float (memory-total *nk-dead-pool*))))) - (s0-1 sv-64 sv-80 sv-96 a3-2) - ) + ) + (else + (if (and (-> v1-54 process) + (not (logtest? (-> v1-54 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> v1-54 process mask) (process-mask no-kill))) + ) + (kill! (-> v1-54 entity)) ) - ) - (set! s0-0 #t) ) ) ) - (else - (when (and (-> sv-48 process) - (not (logtest? (-> sv-48 perm status) (entity-perm-status no-kill))) - (not (logtest? (-> sv-48 process mask) (process-mask no-kill))) - ) - (kill! (-> sv-48 entity)) - (set! sv-24 (+ sv-24 1)) + ) + ) + ) + ((= (-> s4-1 display?) 'actor) + (let* ((s4-3 (-> s4-1 entity)) + (s3-2 (-> s4-3 length)) + ) + (dotimes (s2-1 s3-2) + (let ((v1-67 (-> s4-3 data s2-1))) + (cond + ((not (logtest? (-> v1-67 kill-mask) sv-32)) + (when (not (or (-> v1-67 process) (logtest? (-> v1-67 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> v1-67 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) + ) + ) ) + (else + (if (and (-> v1-67 process) + (not (logtest? (-> v1-67 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> v1-67 process mask) (process-mask no-kill))) + ) + (kill! (-> v1-67 entity)) + ) + ) + ) + ) + ) + ) + ) + ((not *vis-actors*) + (let* ((s4-4 (-> s4-1 entity)) + (s3-3 (-> s4-4 length)) + ) + (dotimes (s2-2 s3-3) + (let ((s1-0 (-> s4-4 data s2-2))) + (cond + ((and (< (vector-vector-distance (-> s1-0 trans) sv-16) (-> *ACTOR-bank* birth-dist)) + (not (logtest? (-> s1-0 perm status) (entity-perm-status bit-9 bit-10))) + (not (logtest? (-> s1-0 kill-mask) sv-32)) + ) + (when (not (or (-> s1-0 process) (logtest? (-> s1-0 perm status) (entity-perm-status bit-0 dead)))) + (birth! (-> s1-0 entity)) + (+! sv-24 1) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) + ) + ) + ) + (else + (if (and (-> s1-0 process) + (not (logtest? (-> s1-0 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> s1-0 process mask) (process-mask no-kill))) + ) + (kill! (-> s1-0 entity)) + ) + ) + ) + ) + ) + ) + ) + (*vis-actors* + (when (not (and (-> s4-1 vis-info 0) (-> s4-1 all-visible?))) + (let* ((s3-4 (-> s4-1 entity)) + (s2-3 (-> s3-4 length)) + (s0-0 #f) + ) + (dotimes (s1-1 s2-3) + (let ((sv-48 (-> s3-4 data s1-1))) + (cond + ((and (is-object-visible? s4-1 (-> sv-48 vis-id)) + (not (logtest? (-> sv-48 perm status) (entity-perm-status bit-9 bit-10))) + (not (logtest? (-> sv-48 kill-mask) sv-32)) + (or (-> s4-1 vis-info 0) (< (vector-vector-distance (-> sv-48 trans) sv-16) (-> sv-48 vis-dist))) + ) + (when (not (or (-> sv-48 process) (logtest? (-> sv-48 perm status) (entity-perm-status bit-0 dead)) s0-0)) + (birth! (-> sv-48 entity)) + (+! sv-24 1) + (when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1) + (if *debug-segment* + (format + *stdcon* + "low actor memory, no birth triggered!!! ~,,0fK/~,,0fK~%" + (* 0.0009765625 (the float (memory-free *nk-dead-pool*))) + (* 0.0009765625 (the float (memory-total *nk-dead-pool*))) + ) + ) + (set! s0-0 #t) + ) + ) + ) + (else + (when (and (-> sv-48 process) + (not (logtest? (-> sv-48 perm status) (entity-perm-status no-kill))) + (not (logtest? (-> sv-48 process mask) (process-mask no-kill))) + ) + (kill! (-> sv-48 entity)) + (+! sv-24 1) + ) + ) + ) + ) + (if (>= sv-24 (-> *ACTOR-bank* birth-max)) + (return #f) + ) ) ) - (if (>= sv-24 (-> *ACTOR-bank* birth-max)) - (return #f) - ) ) ) ) @@ -2610,15 +2592,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun-debug dump-entity-remap ((arg0 object) (arg1 object)) - (local-vars - (sv-16 symbol) - (sv-32 string) - (sv-48 symbol) - (sv-64 string) - (sv-80 symbol) - (sv-96 string) - (sv-112 string) - ) (format #t "~%(:eval (remap-entity-list '(") (dotimes (s4-0 (-> *level* length)) (let ((s3-0 (-> *level* level s4-0))) @@ -2627,14 +2600,8 @@ (let ((s2-0 (-> s3-0 bsp actors))) (when (nonzero? s2-0) (dotimes (s1-0 (-> s2-0 length)) - (let ((a0-4 (-> s2-0 data s1-0 actor)) - (s0-0 format) - ) - (set! sv-16 #t) - (set! sv-32 "~A ") - (let ((a2-1 (res-lump-struct a0-4 'name structure))) - (s0-0 sv-16 sv-32 a2-1) - ) + (let ((a0-4 (-> s2-0 data s1-0 actor))) + (format #t "~A " (res-lump-struct a0-4 'name structure)) ) ) ) @@ -2642,14 +2609,8 @@ (let ((s2-1 (-> s3-0 bsp nav-meshes))) (when (nonzero? s2-1) (dotimes (s1-1 (-> s2-1 length)) - (let ((a0-6 (-> s2-1 s1-1)) - (s0-1 format) - ) - (set! sv-48 #t) - (set! sv-64 "~A ") - (let ((a2-3 (res-lump-struct a0-6 'name structure))) - (s0-1 sv-48 sv-64 a2-3) - ) + (let ((a0-6 (-> s2-1 s1-1))) + (format #t "~A " (res-lump-struct a0-6 'name structure)) ) ) ) @@ -2657,14 +2618,8 @@ (let ((s2-2 (-> s3-0 bsp race-meshes))) (when (nonzero? s2-2) (dotimes (s1-2 (-> s2-2 length)) - (let ((a0-8 (-> s2-2 s1-2)) - (s0-2 format) - ) - (set! sv-80 #t) - (set! sv-96 "~A ") - (let ((a2-5 (res-lump-struct a0-8 'name structure))) - (s0-2 sv-80 sv-96 a2-5) - ) + (let ((a0-8 (-> s2-2 s1-2))) + (format #t "~A " (res-lump-struct a0-8 'name structure)) ) ) ) @@ -2672,14 +2627,8 @@ (let ((s3-1 (-> s3-0 bsp cameras))) (when (nonzero? s3-1) (dotimes (s2-3 (-> s3-1 length)) - (let ((a0-10 (-> s3-1 s2-3)) - (s1-3 format) - (s0-3 #t) - ) - (set! sv-112 "~A ") - (let ((a2-7 (res-lump-struct a0-10 'name structure))) - (s1-3 s0-3 sv-112 a2-7) - ) + (let ((a0-10 (-> s3-1 s2-3))) + (format #t "~A " (res-lump-struct a0-10 'name structure)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/entity/res_REF.gc b/test/decompiler/reference/jak2/engine/entity/res_REF.gc index b4322fbc94..502b84ac7c 100644 --- a/test/decompiler/reference/jak2/engine/entity/res_REF.gc +++ b/test/decompiler/reference/jak2/engine/entity/res_REF.gc @@ -774,9 +774,8 @@ ;; definition for method 18 of type res-lump (defmethod add-32bit-data! ((this res-lump) (arg0 res-tag) (arg1 object)) "Add a single 32-bit value using [[add-data!]]." - (local-vars (sv-16 object)) - (set! sv-16 arg1) - (let* ((v1-0 arg0) + (let* ((sv-16 arg1) + (v1-0 arg0) (a1-4 (copy-and-set-field v1-0 inlined? 1)) ) (add-data! this a1-4 (& sv-16)) @@ -788,20 +787,19 @@ (defmethod get-curve-data! ((this res-lump) (arg0 curve) (arg1 symbol) (arg2 symbol) (arg3 float)) "Read curve data and write it to curve-target. Return #t if both control points and knots data was succesfully read, #f otherwise." - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s5-0 #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-2 ((method-of-object this get-property-data) - this - arg1 - 'exact - arg3 - (the-as pointer #f) - (& sv-16) - *res-static-buf* + (let* ((sv-16 (new 'static 'res-tag)) + (a0-2 ((method-of-object this get-property-data) + this + arg1 + 'exact + arg3 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) ) - ) - ) + ) (when a0-2 (set! (-> arg0 cverts) (the-as (inline-array vector) a0-2)) (set! (-> arg0 num-cverts) (the-as int (-> sv-16 elt-count))) @@ -814,18 +812,18 @@ ) (set! (-> arg0 num-cverts) 256) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((a0-6 ((method-of-object this get-property-data) - this - arg2 - 'exact - arg3 - (the-as pointer #f) - (& sv-32) - *res-static-buf* + (let* ((sv-32 (new 'static 'res-tag)) + (a0-6 ((method-of-object this get-property-data) + this + arg2 + 'exact + arg3 + (the-as pointer #f) + (& sv-32) + *res-static-buf* + ) ) - ) - ) + ) (when a0-6 (set! (-> arg0 knots) (the-as (pointer float) a0-6)) (set! (-> arg0 num-knots) (the-as int (-> sv-32 elt-count))) @@ -848,7 +846,6 @@ ;; WARN: Using new Jak 2 rtype-of ;; WARN: Using new Jak 2 rtype-of (defmethod mem-usage ((this res-lump) (usage memory-usage-block) (flags int)) - (local-vars (sv-16 int)) (let ((s3-0 48) (s2-0 "res") ) @@ -908,12 +905,13 @@ (+! (-> usage data s3-0 used) v1-68) (+! (-> usage data s3-0 total) (logand -16 (+ v1-68 15))) ) - (set! sv-16 0) - (while (< sv-16 (-> (the-as array s0-0) length)) - (let ((a0-63 (-> (the-as (array object) s0-0) sv-16))) - ((method-of-type (rtype-of a0-63) mem-usage) a0-63 usage flags) + (let ((sv-16 0)) + (while (< sv-16 (-> (the-as array s0-0) length)) + (let ((a0-63 (-> (the-as (array object) s0-0) sv-16))) + ((method-of-type (rtype-of a0-63) mem-usage) a0-63 usage flags) + ) + (+! sv-16 1) ) - (set! sv-16 (+ sv-16 1)) ) ) (else diff --git a/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc index 66109cf892..815b5722c2 100644 --- a/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/effect-control_REF.gc @@ -274,21 +274,6 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function (method 10 effect-control) has a return type of none, but the expression builder found a return statement. (defmethod do-effect ((this 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) - ) (cond ((logtest? (-> this flags) (effect-control-flag ecf2)) (return #f) @@ -411,16 +396,15 @@ (let ((s2-1 run-function-in-process) (s1-0 s4-1) (s0-0 part-tracker-init) + (sv-320 0) + (sv-336 (the-as symbol #f)) + (sv-352 (the-as symbol #f)) + (sv-368 (the-as symbol #f)) + (sv-400 *launch-matrix*) ) - (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) (-> this process node-list data s5-0)) quad))) - (set! (-> sv-384 quad) v1-55) - ) + (set! (-> sv-400 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) quad) + ) ((the-as (function object object object object object object object object none) s2-1) s1-0 s0-0 @@ -517,16 +501,15 @@ (let ((s2-3 run-function-in-process) (s1-3 s4-3) (s0-3 part-tracker-init) + (sv-416 0) + (sv-432 (the-as symbol #f)) + (sv-448 (the-as symbol #f)) + (sv-464 (the-as symbol #f)) + (sv-496 *launch-matrix*) ) - (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) (-> this process node-list data s5-0)) quad))) - (set! (-> sv-480 quad) v1-95) - ) + (set! (-> sv-496 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0)) quad) + ) ((the-as (function object object object object object object object object none) s2-3) s1-3 s0-3 @@ -582,17 +565,16 @@ (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 this) - (s1-4 (method-of-object s2-5 play-effect-sound)) - (s0-4 (-> (the-as death-info s3-0) sound)) - ) - (set! sv-512 (-> this 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) + (if (-> (the-as death-info s3-0) sound) + (play-effect-sound + this + (-> (the-as death-info s3-0) sound) + arg1 + s5-0 + (-> this res) + (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound))) ) ) - ) (send-event (-> this process) 'death-start (the-as death-info s3-0)) ) ) @@ -610,26 +592,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod do-effect-for-surface ((this 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 @@ -907,18 +869,14 @@ ) ) (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) (-> this process node-list data arg2)) quad))) - (set! (-> sv-96 quad) v1-63) - ) - (let ((a3-6 #f) - (t0-1 #f) - (t1-1 1.0) + (let ((sv-64 sp-launch-particles-var) + (sv-80 *sp-particle-system-2d*) + (sv-112 *launch-matrix*) ) - (sv-64 sv-80 s0-0 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + (set! (-> sv-112 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (sv-64 sv-80 s0-0 sv-112 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -961,18 +919,14 @@ ) ) (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) (-> this process node-list data arg2)) quad))) - (set! (-> sv-160 quad) v1-79) - ) - (let ((a3-7 #f) - (t0-2 #f) - (t1-2 1.0) + (let ((sv-128 sp-launch-particles-var) + (sv-144 *sp-particle-system-2d*) + (sv-176 *launch-matrix*) ) - (sv-128 sv-144 s0-1 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + (set! (-> sv-176 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (sv-128 sv-144 s0-1 sv-176 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -1015,18 +969,14 @@ ) ) (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) (-> this process node-list data arg2)) quad))) - (set! (-> sv-224 quad) v1-96) - ) - (let ((a3-8 #f) - (t0-3 #f) - (t1-3 1.0) + (let ((sv-192 sp-launch-particles-var) + (sv-208 *sp-particle-system-2d*) + (sv-240 *launch-matrix*) ) - (sv-192 sv-208 s0-2 sv-240 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + (set! (-> sv-240 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (sv-192 sv-208 s0-2 sv-240 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -1043,9 +993,8 @@ ;; definition for method 12 of type effect-control ;; INFO: Used lq/sq (defmethod play-effect-sound ((this 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))) - (set! sv-144 arg3) - (let ((s0-0 arg4) + (let ((sv-144 arg3) + (s0-0 arg4) (gp-0 (the-as object (new 'stack 'sound-spec))) (s5-0 (if (< arg2 0) (the-as vector #f) @@ -1057,15 +1006,17 @@ (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)) + (let* ((sv-112 (new 'static 'res-tag)) + (a1-6 ((method-of-type res-lump get-property-data) + (the-as res-lump sv-144) + 'effect-param + 'exact + arg1 + (the-as pointer #f) + (& sv-112) + *res-static-buf* + ) + ) ) (when a1-6 (effect-param->sound-spec @@ -1090,22 +1041,16 @@ ) ) (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)) - ) - ) + (< (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))) (vector-vector-distance (ear-trans 0) s5-0)) ) (= (-> (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))) + (let ((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 " diff --git a/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc b/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc index 3c8aa355fb..b341f5426d 100644 --- a/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/fact-h_REF.gc @@ -1327,51 +1327,53 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs fact-info. (defmethod new fact-info ((allocation symbol) (type-to-make type) (arg0 process) (arg1 pickup-type) (arg2 float)) - (local-vars (sv-16 fact-info) (sv-20 res-lump) (sv-24 task-mask)) - (set! sv-16 (object-new allocation type-to-make (the-as int (-> type-to-make size)))) - (set! sv-20 (the-as res-lump (-> arg0 entity))) - (set! sv-24 (process-task-mask arg0)) - (when (zero? sv-16) - (go process-drawable-art-error "memory") - (return (the-as fact-info 0)) - ) - (set! (-> sv-16 process) arg0) - (set! (-> sv-16 pickup-type) arg1) - (set! (-> sv-16 pickup-amount) arg2) - (let ((s4-1 (-> (lookup-tag-idx sv-20 'eco-info 'base -1000000000.0) lo))) - (when (>= (the-as int s4-1) 0) - (let ((s3-0 (the-as int s4-1)) - (s2-0 (-> sv-20 tag s4-1)) - ) - 0 - (while (= (-> s2-0 name) (-> sv-20 tag s4-1 name)) - (let ((v1-17 (make-property-data sv-20 0.0 (the-as res-tag-pair s3-0) (the-as pointer #f))) - (a0-7 (the int (-> s2-0 key-frame))) - ) - (when (or (< a0-7 0) (and (-> arg0 entity) (logtest? sv-24 (ash 1 a0-7)))) - (when v1-17 - (let ((a0-15 (-> s2-0 elt-count))) - (set! (-> sv-16 pickup-type) (the-as pickup-type (-> (the-as (pointer int32) v1-17)))) - (set! (-> sv-16 pickup-amount) (if (< (the-as uint 1) a0-15) - (the float (-> (the-as (pointer int32) v1-17) 1)) - arg2 - ) - ) + (let ((sv-16 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (let ((sv-20 (the-as res-lump (-> arg0 entity)))) + (let ((sv-24 (process-task-mask arg0))) + (when (zero? sv-16) + (go process-drawable-art-error "memory") + (return (the-as fact-info 0)) + ) + (set! (-> sv-16 process) arg0) + (set! (-> sv-16 pickup-type) arg1) + (set! (-> sv-16 pickup-amount) arg2) + (let ((s4-1 (-> (lookup-tag-idx sv-20 'eco-info 'base -1000000000.0) lo))) + (when (>= (the-as int s4-1) 0) + (let ((s3-0 (the-as int s4-1)) + (s2-0 (-> sv-20 tag s4-1)) ) + 0 + (while (= (-> s2-0 name) (-> sv-20 tag s4-1 name)) + (let ((v1-17 (make-property-data sv-20 0.0 (the-as res-tag-pair s3-0) (the-as pointer #f))) + (a0-7 (the int (-> s2-0 key-frame))) + ) + (when (or (< a0-7 0) (and (-> arg0 entity) (logtest? sv-24 (ash 1 a0-7)))) + (when v1-17 + (let ((a0-15 (-> s2-0 elt-count))) + (set! (-> sv-16 pickup-type) (the-as pickup-type (-> (the-as (pointer int32) v1-17)))) + (set! (-> sv-16 pickup-amount) (if (< (the-as uint 1) a0-15) + (the float (-> (the-as (pointer int32) v1-17) 1)) + arg2 + ) + ) + ) + ) + ) + ) + (+! s3-0 1) + (set! s2-0 (-> sv-20 tag s3-0)) ) ) ) - (+! s3-0 1) - (set! s2-0 (-> sv-20 tag s3-0)) ) ) + (set! (-> sv-16 options) (res-lump-value sv-20 'options actor-option :time -1000000000.0)) + (if (logtest? (-> sv-16 options) (actor-option fade-out respawn-delay)) + (set! (-> sv-16 fade-time) (the-as time-frame (the int (* 300.0 (res-lump-float sv-20 'timeout))))) + ) ) + (the-as fact-info sv-16) ) - (set! (-> sv-16 options) (res-lump-value sv-20 'options actor-option :time -1000000000.0)) - (if (logtest? (-> sv-16 options) (actor-option fade-out respawn-delay)) - (set! (-> sv-16 fade-time) (the-as time-frame (the int (* 300.0 (res-lump-float sv-20 'timeout))))) - ) - (the-as fact-info sv-16) ) ;; definition for method 11 of type fact-info @@ -1409,7 +1411,6 @@ (arg2 pickup-type) (arg3 float) ) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((gp-0 (the-as fact-info-enemy ((method-of-type fact-info new) allocation type-to-make arg0 arg2 arg3)))) (let ((s5-0 (the-as res-lump (-> gp-0 process entity)))) (set! (-> gp-0 speed) (res-lump-float s5-0 'speed :default 1.0)) @@ -1421,8 +1422,9 @@ (set! (-> gp-0 cam-notice-dist) (res-lump-float s5-0 'cam-notice-dist :default -4096.0)) (set! (-> gp-0 enemy-options) (res-lump-value s5-0 'enemy-options enemy-option :time -1000000000.0)) (let ((s4-1 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-11 (res-lump-data s5-0 'trigger pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-11 (res-lump-data s5-0 'trigger pointer :tag-ptr (& sv-16))) + ) (when v1-11 (logior! (-> gp-0 enemy-options) (enemy-option has-trigger)) (let ((a0-13 0)) @@ -1445,8 +1447,9 @@ ) ) (when (logtest? s4-1 2) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-20 (res-lump-data s5-0 'trig-ag pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-20 (res-lump-data s5-0 'trig-ag pointer :tag-ptr (& sv-32))) + ) (if (and v1-20 (nonzero? (-> sv-32 elt-count))) (set! (-> gp-0 trig-actor-group) (the-as (pointer actor-group) v1-20)) (clear-mask-bits gp-0 2) diff --git a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc index 2b0bd850d2..013cd08295 100644 --- a/test/decompiler/reference/jak2/engine/game/game-info_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-info_REF.gc @@ -299,66 +299,22 @@ ;; definition for method 9 of type game-info ;; INFO: Used lq/sq -;; ERROR: Expression building failed: In (method 9 game-info): Expression pass could not find the set-to-run function. Found t9-31 instead. Make sure there are no casts on this function. (defmethod initialize! ((this game-info) (arg0 symbol) (arg1 game-save) (arg2 string)) - (local-vars - (v0-17 object) - (v0-29 process-tree) - (v0-30 continue-point) - (v0-31 none) - (v0-32 game-info) - (v1-0 symbol) - (v1-16 symbol) - (v1-135 symbol) - (v1-154 process) - (v1-157 (pointer process)) - (v1-158 type) - (v1-159 int) - (v1-160 (pointer string)) - (v1-161 symbol) - (v1-162 type) - (v1-163 process) - (a0-95 process) - (a0-96 game-info) - (a0-97 cpu-thread) - (a0-99 int) - (a0-100 symbol) - (a1-47 process-tree) - (a1-48 (function symbol symbol continue-point game-save none :behavior process)) - (a2-11 type) - (a2-12 symbol) - (a2-13 string) - (a2-14 symbol) - (a3-4 int) - (a3-5 symbol) - (t0-3 continue-point) - (t1-3 game-save) - (s0-1 (function symbol symbol continue-point game-save none :behavior process)) - (s1-2 cpu-thread) - (s2-2 function) - (s3-2 process) - (s4-1 level-load-info) - (t9-29 (function process process-tree basic pointer process-tree)) - (t9-30 (function game-info continue-point)) - (t9-31 function) - (t9-32 (function symbol none)) - (sv-96 game-task-node-info) - (sv-112 symbol) - ) - (cond - ((or (= v1-0 'dead) (= v1-0 'life)) + (local-vars (v0-3 int)) + (case arg0 + (('dead 'life) (+! (-> this total-deaths) 1) (+! (-> this continue-deaths) 1) (+! (-> this task-deaths) 1) (when *target* - (set! s4-1 (-> *target* current-level info)) - (set! (-> this deaths-per-level (-> s4-1 task-level)) - (the-as uint (seekl (the-as int (-> this deaths-per-level (-> s4-1 task-level))) 255 1)) - ) + (let ((s4-1 (-> *target* current-level info))) + (set! (-> this deaths-per-level (-> s4-1 task-level)) + (the-as uint (seekl (the-as int (-> this deaths-per-level (-> s4-1 task-level))) 255 1)) + ) + ) ) - (set! v1-16 (-> this mode)) - (cond - ((= v1-16 'play) + (case (-> this mode) + (('play) (set! arg0 'life) ) (else @@ -367,89 +323,248 @@ ) ) ) - ((= v1-0 'try) + (('try) (+! (-> this total-trys) 1) ) ) - (cond - ((= v1-135 'movie) - (task-node-reset arg0) - (update-task-masks arg0) - ) - ((= v1-135 'debug) - (reset-actors arg0) - (if arg1 - (load-game this arg1) - ) - ) - ((= v1-135 'play) - (when (begin - (if v1-154 - (-> v1-154 ppointer) - ) - (when s3-2 - (set! v1-158 process) - (set! t9-29 (method-of-type process activate)) - (set! a0-95 s3-2) - (set! a1-47 *default-pool*) - (set! v1-159 #xff37) - (set! a2-11 process) - (set! a2-12 (-> process symbol)) - (set! v1-160 (sym->str-ptr (-> process symbol))) - (set! a2-13 (symbol->string (-> process symbol))) - (set! a3-4 #x70004000) - (call! a0-95 a1-47 a2-13 a3-4) - (set! s2-2 set-to-run) - (set! s1-2 (-> s3-2 main-thread)) - (set! s0-1 (lambda :behavior process - ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) - (set! (-> self mask) (process-mask)) - (stop arg0) - (reset-actors arg1) - (close! (-> *game-info* sub-task-list (game-task-node fortress-escape-start)) 'event) - (set-continue! *game-info* arg2 #f) - (when arg3 - (load-game *game-info* arg3) - (set! arg2 (get-current-continue-forced *game-info*)) - (reset-actors 'life) - (send-event (handle->process (-> *game-info* auto-save-proc)) 'done) - ) - (suspend) - (start arg0 arg2) - (none) - ) + (case arg0 + (('dead 'life 'try) + (let ((s2-0 (level-get-target-inside *level*))) + (when s2-0 + (let ((s1-0 (-> *game-info* sub-task-list))) + (dotimes (s0-0 (-> s1-0 length)) + (when (nonzero? s0-0) + (let ((sv-96 (-> s1-0 s0-0))) + (if (open? sv-96) + (set! v0-3 (when (and (= (-> s2-0 info taskname) (-> sv-96 level)) + (and (or (not (-> sv-96 info)) (handle->process (-> sv-96 info manager))) + (>= (- (-> *display* game-clock frame-counter) (-> this death-time)) (seconds 2)) + ) + ) + (format #t "death count inc for ~S~%" (-> sv-96 name)) + (set! v0-3 (seekl (the-as int (-> sv-96 death-count)) #xffff 1)) + (set! (-> sv-96 death-count) (the-as uint v0-3)) + v0-3 + ) + ) ) - (set! v1-161 (-> this mode)) - (set! sv-112 v1-161) - (set! a0-96 this) - (set! v1-162 (-> a0-96 type)) - (set! t9-30 (method-of-object a0-96 get-current-continue-forced)) - (set! v0-30 (get-current-continue-forced this)) - (set! t0-3 v0-30) - (set! t1-3 arg1) - (set! t9-31 s2-2) - (set! a0-97 s1-2) - (set! a1-48 s0-1) - (set! a2-14 sv-112) - (set! a3-5 arg0) - (call! a0-97 a1-48 a2-14 a3-5 t0-3 t1-3) - (set! v1-157 (-> s3-2 ppointer)) + ) ) - v1-157 ) - (set! v1-163 (-> v1-157 0)) - (set! (-> v1-163 mask) (the-as process-mask 0)) - (set! a0-99 0) + ) + ) ) - (set! t9-32 set-master-mode) - (set! a0-100 'game) - (set! v0-17 (call! a0-100)) + (set! (-> this death-time) (-> *display* game-clock frame-counter)) ) ) - (set! v1-164 v0-17) + (kill-current-talker (the-as symbol '()) '() 'die) + (case arg0 + (('game) + (+! (-> this task-counter) 1) + (reset! (-> *display* total-game-clock)) + (set! (-> this features) (game-feature sidekick)) + (set! (-> this debug-features) (game-feature)) + (set! (-> this secrets) (game-secrets)) + (set! (-> this purchase-secrets) (game-secrets)) + (set-continue! + this + (cond + (arg2 + (empty) + arg2 + ) + ((demo?) + "demo-start" + ) + (*debug-segment* + "game-start" + ) + (else + "title-start" + ) + ) + #f + ) + (set! (-> this auto-save-count) 0) + (set! (-> *setting-control* user-default auto-save) #f) + (set! (-> this money) 0.0) + (set! (-> this money-total) 0.0) + (set! (-> this fuel) 0.0) + (set! (-> this buzzer-total) 0.0) + (set! (-> this eco-pill-dark) 0.0) + (set! (-> this eco-pill-dark-total) 0.0) + (set! (-> this gem) 0.0) + (set! (-> this gem-total) 0.0) + (set! (-> this skill) 0.0) + (set! (-> this skill-total) 0.0) + (set! (-> this karma) 0.0) + (set! (-> this perm-list length) 0) + (dotimes (v1-69 (-> this unknown-pad6 allocated-length)) + (set! (-> this unknown-pad6 v1-69) (the-as uint 0)) + ) + (set! (-> this death-movie-tick) (rand-vu-int-count 10)) + (set! (-> this gun-type) (pickup-type eco-red)) + (set! (-> this gun-ammo 0) (-> *FACT-bank* ammo-yellow-start)) + (set! (-> this gun-ammo 1) (-> *FACT-bank* ammo-red-start)) + (set! (-> this gun-ammo 2) (-> *FACT-bank* ammo-blue-start)) + (set! (-> this gun-ammo 3) (-> *FACT-bank* ammo-dark-start)) + (set! (-> this shield) 100.0) + (set! (-> this score) 0.0) + (set! (-> this score-owner) (the-as handle #f)) + (set! (-> this goal) 0.0) + (set! (-> this miss) 0.0) + (set! (-> this miss-max) 0.0) + (set! (-> this timer) 0) + (set! (-> this timer-flash) #f) + (set! (-> this timer-owner) (the-as handle #f)) + (set! (-> this counter) 0.0) + (set! (-> this counter-flash) #f) + (set! (-> this wanted-flash) #f) + (set! (-> this distance) 0.0) + (set! (-> this attack-id) (the-as uint 2)) + (set! (-> this total-trys) 0) + (set! (-> this total-deaths) 0) + (set! (-> this continue-deaths) 0) + (set! (-> this task-deaths) 0) + (set! (-> this death-pos length) 0) + (set! (-> this game-start-time) (-> *display* game-clock frame-counter)) + (set! (-> this task-pickup-time) (-> *display* game-clock frame-counter)) + (set! (-> this continue-time) (-> *display* game-clock frame-counter)) + (set! (-> this death-time) (-> *display* game-clock frame-counter)) + (set! (-> this hit-time) (-> *display* game-clock frame-counter)) + (dotimes (v1-95 110) + (set! (-> this unknown-array1 0) 0) + (set! (-> this task-close-times 0) 0) + (nop!) + ) + (dotimes (v1-98 32) + (set! (-> this money-per-level v1-98) (the-as uint 0)) + (set! (-> this deaths-per-level v1-98) (the-as uint 0)) + (set! (-> this task-enter-times v1-98) 0) + (set! (-> this task-in-times v1-98) 0) + (set! (-> this level-opened v1-98) (the-as uint 0)) + (nop!) + ) + (let ((v1-102 (-> *game-info* sub-task-list))) + (dotimes (a0-41 (-> v1-102 length)) + (when (nonzero? a0-41) + (let ((a1-16 (-> v1-102 a0-41))) + (set! (-> a1-16 death-count) (the-as uint 0)) + (set! (-> a1-16 gem-count) (the-as uint 0)) + (set! (-> a1-16 skill-count) (the-as uint 0)) + (set! (-> a1-16 close-time) 0) + ) + 0 + ) + ) + ) + (dotimes (v1-105 (-> this game-score length)) + (set! (-> this game-score v1-105) 0.0) + ) + (dotimes (s3-1 19) + (case s3-1 + ((4 5 6 7 10 11 12 13 15 14 16 17 18) + (let ((v1-112 (get-game-score-ref this s3-1)) + (a0-62 (-> *highscore-info-array* s3-1)) + ) + (set! (-> v1-112 0) (-> a0-62 gold-score)) + (set! (-> v1-112 1) (-> a0-62 silver-score)) + (set! (-> v1-112 2) (-> a0-62 bronze-score)) + ) + ) + ) + ) + (initialize *bigmap*) + ) + ) + (case arg0 + (('game 'try 'life) + (case (-> this mode) + (('play) + (set! *display-profile* #f) + (set! *display-entity-errors* #f) + ) + ) + (set! (-> this life-max) (-> *GAME-bank* life-max-default)) + (set! (-> this life) (-> *GAME-bank* life-start-default)) + (set! (-> this gun-ammo 0) + (fmax (-> this gun-ammo 0) (* (you-suck-scale *game-info* #f) (-> *FACT-bank* ammo-yellow-start))) + ) + (set! (-> this gun-ammo 1) + (fmax (-> this gun-ammo 1) (* (you-suck-scale *game-info* #f) (-> *FACT-bank* ammo-red-start))) + ) + (set! (-> this gun-ammo 2) + (fmax (-> this gun-ammo 2) (* (you-suck-scale *game-info* #f) (-> *FACT-bank* ammo-blue-start))) + ) + (set! (-> this gun-ammo 3) + (fmax (-> this gun-ammo 3) (* (you-suck-scale *game-info* #f) (-> *FACT-bank* ammo-dark-start))) + ) + ) + ) + (let ((v1-135 (-> this mode))) + (cond + ((= v1-135 'movie) + (task-node-reset arg0) + (update-task-masks arg0) + ) + ((= v1-135 'debug) + (reset-actors arg0) + (if arg1 + (load-game this arg1) + ) + ) + ((= v1-135 'play) + (when *target* + (set-setting *setting-control* *target* 'allow-pause #f 0 0) + (set-setting *setting-control* *target* 'allow-progress #f 0 0) + (set-setting *setting-control* *target* 'allow-continue #f 0 0) + (apply-settings *setting-control*) + ) + (send-event (handle->process (-> *game-info* auto-save-proc)) 'die) + (set! (-> *setting-control* user-default border-mode) #f) + (set! (-> *setting-control* user-default region-mode) #f) + (apply-settings *setting-control*) + (set! *spawn-actors* #f) + (set-blackout-frames (seconds 0.1)) + (send-event *target* 'reset) + (let ((v1-157 (process-spawn-function + process + (lambda :behavior process + ((arg0 symbol) (arg1 symbol) (arg2 continue-point) (arg3 game-save)) + (set! (-> self mask) (process-mask)) + (stop arg0) + (reset-actors arg1) + (close! (-> *game-info* sub-task-list (game-task-node fortress-escape-start)) 'event) + (set-continue! *game-info* arg2 #f) + (when arg3 + (load-game *game-info* arg3) + (set! arg2 (get-current-continue-forced *game-info*)) + (reset-actors 'life) + (send-event (handle->process (-> *game-info* auto-save-proc)) 'done) + ) + (suspend) + (start arg0 arg2) + (none) + ) + (-> this mode) + arg0 + (get-current-continue-forced this) + arg1 + :from *4k-dead-pool* + ) + ) + ) + (when v1-157 + (set! (-> v1-157 0 mask) (process-mask)) + 0 + ) + ) + (set-master-mode 'game) + ) + ) + ) (label cfg-131) - (set! v0-32 this) - (ret-value v0-32) + this ) ;; definition for method 10 of type game-info @@ -1285,18 +1400,7 @@ ;; definition for method 18 of type game-info ;; INFO: Used lq/sq (defmethod debug-inspect ((this game-info) (arg0 symbol)) - (local-vars - (sv-16 int) - (sv-24 int) - (sv-32 int) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 string) - (sv-80 string) - (sv-96 string) - (sv-112 string) - ) + (local-vars (sv-96 string) (sv-112 string)) (inspect this) (when (or (not arg0) (= arg0 'game-task)) (format #t "~Tgame-task:~%") @@ -1307,48 +1411,50 @@ ) (while (>= (the-as uint s3-0) (the-as uint s4-0)) (when (task-complete? this (the-as game-task s4-0)) - (set! sv-16 0) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (let ((game-subtasks (-> *game-info* sub-task-list))) - (dotimes (i (-> game-subtasks length)) - (when (nonzero? i) - (let ((subtasks (-> game-subtasks i))) - (when (= (-> subtasks task) s4-0) - (when (zero? sv-24) - (set! sv-24 (the-as int (-> subtasks close-time))) - (set! sv-16 (the-as int (-> subtasks close-time))) - ) - (when (logtest? (-> subtasks flags) (game-task-node-flag closed)) - (set! sv-32 (the-as int (-> subtasks close-time))) - (set! sv-40 (the-as int (-> subtasks gem-count))) - (set! sv-48 (the-as int (-> subtasks skill-count))) - ) - (set! sv-56 (+ sv-56 (-> subtasks death-count))) - (if (logtest? (-> subtasks flags) (game-task-node-flag close-task)) - (goto cfg-19) + (let ((sv-16 0) + (sv-24 0) + (sv-32 0) + (sv-40 0) + (sv-48 0) + (sv-56 0) + ) + (let ((game-subtasks (-> *game-info* sub-task-list))) + (dotimes (i (-> game-subtasks length)) + (when (nonzero? i) + (let ((subtasks (-> game-subtasks i))) + (when (= (-> subtasks task) s4-0) + (when (zero? sv-24) + (set! sv-24 (the-as int (-> subtasks close-time))) + (set! sv-16 (the-as int (-> subtasks close-time))) ) + (when (logtest? (-> subtasks flags) (game-task-node-flag closed)) + (set! sv-32 (the-as int (-> subtasks close-time))) + (set! sv-40 (the-as int (-> subtasks gem-count))) + (set! sv-48 (the-as int (-> subtasks skill-count))) + ) + (+! sv-56 (-> subtasks death-count)) + (if (logtest? (-> subtasks flags) (game-task-node-flag close-task)) + (goto cfg-19) + ) + ) ) ) ) ) - ) - (label cfg-19) - (if (nonzero? (-> this task-close-times s4-0)) - (set! sv-24 (max sv-24 (-> this task-close-times s4-0))) + (label cfg-19) + (if (nonzero? (-> this task-close-times s4-0)) + (set! sv-24 (max sv-24 (-> this task-close-times s4-0))) + ) + (format + #t + "~T~T~-32S ~6,,1f min ~6,,1f min ~3d ~3d ~3d~%" + (game-task->string (the-as game-task s4-0)) + (* 0.000055555556 (the float (- sv-24 sv-16))) + (* 0.000055555556 (the float (- sv-32 sv-24))) + sv-56 + sv-40 + sv-48 ) - (format - #t - "~T~T~-32S ~6,,1f min ~6,,1f min ~3d ~3d ~3d~%" - (game-task->string (the-as game-task s4-0)) - (* 0.000055555556 (the float (- sv-24 sv-16))) - (* 0.000055555556 (the float (- sv-32 sv-24))) - sv-56 - sv-40 - sv-48 ) ) (+! s4-0 1) @@ -1359,30 +1465,37 @@ (let ((s4-1 (-> *game-info* sub-task-list))) (dotimes (s3-1 (-> s4-1 length)) (when (nonzero? s3-1) - (let ((s2-1 (-> s4-1 s3-1)) - (s1-1 format) - (s0-1 #t) - ) - (set! sv-64 "~-55S ~-16S ~S ~A~%") - (set! sv-80 (-> s2-1 name)) - (cond - ((logtest? (-> s2-1 flags) (game-task-node-flag closed)) - (set! sv-96 "closed") - ) - ((open? s2-1) - (set! sv-96 "open") - ) - (else - (set! sv-96 "inactive") - ) - ) - (if (task-complete? *game-info* (-> s2-1 task)) - (set! sv-112 "res") - (set! sv-112 " ") - ) - (let ((t1-1 (lookup-text! *common-text* (-> s2-1 description) #f))) - (s1-1 s0-1 sv-64 sv-80 sv-96 sv-112 t1-1) - ) + (let* ((s2-1 (-> s4-1 s3-1)) + (s1-1 format) + (s0-1 #t) + (sv-64 "~-55S ~-16S ~S ~A~%") + (sv-80 (-> s2-1 name)) + ) + (set! sv-96 (cond + ((logtest? (-> s2-1 flags) (game-task-node-flag closed)) + (set! sv-96 "closed") + sv-96 + ) + ((open? s2-1) + (set! sv-96 "open") + sv-96 + ) + (else + "inactive" + ) + ) + ) + (set! sv-112 (cond + ((task-complete? *game-info* (-> s2-1 task)) + (set! sv-112 "res") + sv-112 + ) + (else + " " + ) + ) + ) + (s1-1 s0-1 sv-64 sv-80 sv-96 sv-112 (lookup-text! *common-text* (-> s2-1 description) #f)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/game/game-save_REF.gc b/test/decompiler/reference/jak2/engine/game/game-save_REF.gc index c99cb78c99..f2cf7b8cde 100644 --- a/test/decompiler/reference/jak2/engine/game/game-save_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-save_REF.gc @@ -359,7 +359,6 @@ ;; definition for method 11 of type game-save ;; INFO: Used lq/sq (defmethod debug-inspect ((this game-save) (arg0 symbol)) - (local-vars (sv-16 int) (sv-32 string) (sv-48 string)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tversion: ~D~%" (-> this version)) (format #t "~Tallocated-length: ~D~%" (-> this allocated-length)) @@ -385,19 +384,15 @@ (s3-0 0) ) (while (< (the-as int s4-0) (the-as int (&-> this tag 0 user-int8 (-> this length)))) - (let ((s2-0 format) - (s1-0 #t) - (s0-0 "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f ") - ) - (set! sv-16 s3-0) - (let ((a3-2 (game-save-elt->string (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) - (t0-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) - (t1-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size)) - (t2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64)) - (t3-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0)) - ) - (s2-0 s1-0 s0-0 sv-16 a3-2 t0-1 t1-1 t2-1 t3-0) - ) + (format + #t + "~T [~3D] ~-32S [~3D/~3D] ~12D ~8f " + s3-0 + (game-save-elt->string (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type)) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count) + (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-size) + (-> (the-as (inline-array game-save-tag) s4-0) 0 user-uint64) + (-> (the-as (inline-array game-save-tag) s4-0) 0 user-float0) ) (let ((v1-0 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type))) (if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue))) @@ -409,31 +404,21 @@ (case (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-type) (((game-save-elt node-death-count) (game-save-elt node-skill-count) (game-save-elt node-gem-count)) (dotimes (s2-1 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) - (let ((s1-1 format) - (s0-1 #t) - ) - (set! sv-32 " ~-32S: ~D~%") - (let ((a2-15 (game-task-node->string (the-as game-task-node s2-1))) - (a3-3 (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1)) - ) - (s1-1 s0-1 sv-32 a2-15 a3-3) - ) + (format + #t + " ~-32S: ~D~%" + (game-task-node->string (the-as game-task-node s2-1)) + (-> (the-as (inline-array game-save-tag) s4-0) 1 user-uint16 s2-1) ) ) ) (((game-save-elt node-close-time)) (dotimes (s2-2 (-> (the-as (inline-array game-save-tag) s4-0) 0 elt-count)) - (let ((s1-2 format) - (s0-2 #t) - ) - (set! sv-48 " ~-32S: ~D~%") - (let ((a2-16 (game-task-node->string (the-as game-task-node s2-2))) - (a3-4 - (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-2 8)))) - ) - ) - (s1-2 s0-2 sv-48 a2-16 a3-4) - ) + (format + #t + " ~-32S: ~D~%" + (game-task-node->string (the-as game-task-node s2-2)) + (-> (the-as (pointer uint64) (+ (the-as uint (-> (the-as (inline-array game-save-tag) s4-0) 1)) (* s2-2 8)))) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/game/task/task-arrow_REF.gc b/test/decompiler/reference/jak2/engine/game/task/task-arrow_REF.gc index 32c6169f92..97942a8c77 100644 --- a/test/decompiler/reference/jak2/engine/game/task/task-arrow_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/task/task-arrow_REF.gc @@ -169,16 +169,14 @@ or collectable items on the ground (jetboard / weapon upgrades / etc)" (when (< (-> this rod-of-god-scale) 0.0) (set! (-> this rod-of-god-scale) 0.0) (set! (-> this moving) #f) - (let ((f0-15 81920.0)) - (cond - ((< (* f0-15 f0-15) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) - (kill-callback (-> *minimap* engine) (-> this minimap)) - (set! (-> this root trans quad) (-> this pos quad)) - (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) - ) - (else - (set! (-> this root trans quad) (-> this pos quad)) - ) + (cond + ((< (square 81920.0) (vector-vector-xz-distance-squared (-> this pos) (-> this root trans))) + (kill-callback (-> *minimap* engine) (-> this minimap)) + (set! (-> this root trans quad) (-> this pos quad)) + (set! (-> this minimap) (add-icon! *minimap* this (-> this map-icon) (the-as int #f) (the-as vector #t) 0)) + ) + (else + (set! (-> this root trans quad) (-> this pos quad)) ) ) ) @@ -227,12 +225,10 @@ or collectable items on the ground (jetboard / weapon upgrades / etc)" (if (logtest? (-> self flags) (task-arrow-flags task-arrow-flag-03)) (task-arrow-method-23 self (-> self pos)) ) - (let ((f0-0 4096.0)) - (when (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> self pos) (-> self root trans))) - (set! v0-2 #t) - (set! (-> self moving) (the-as symbol v0-2)) - v0-2 - ) + (when (< (square 4096.0) (vector-vector-xz-distance-squared (-> self pos) (-> self root trans))) + (set! v0-2 #t) + (set! (-> self moving) (the-as symbol v0-2)) + v0-2 ) ) (('leave) diff --git a/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc b/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc index 0103011d55..2185ee3b5d 100644 --- a/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc +++ b/test/decompiler/reference/jak2/engine/geometry/cylinder_REF.gc @@ -50,21 +50,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod debug-draw ((this cylinder) (arg0 vector4w)) - (local-vars - (sv-896 matrix) - (sv-912 vector) - (sv-928 vector) - (sv-944 vector) - (sv-960 vector) - (sv-976 vector) - (sv-992 vector) - (sv-1008 vector) - (sv-1024 vector) - (sv-1040 vector) - (sv-1056 vector) - (sv-1072 vector) - (sv-1088 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -89,76 +74,85 @@ (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-axis-angle! s3-0 (-> this axis) 4096.0) - (set! sv-896 (new 'stack-no-clear 'matrix)) - (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) - (let ((v1-6 (-> s3-0 trans))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-896 quad 0)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-6 quad) vf6) + (let ((sv-896 (new 'stack-no-clear 'matrix))) + (vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0) + (let ((v1-6 (-> s3-0 trans))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-896 quad 0)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-6 quad) vf6) + ) ) (dotimes (v1-7 8) (vector+! (-> s5-0 vert (+ v1-7 8)) (-> this origin) s1-0) (vector+float*! (-> s5-0 vert (+ v1-7 8)) (-> s5-0 vert (+ v1-7 8)) s0-0 (the float v1-7)) ) (dotimes (s0-1 8) - (set! sv-944 (-> s5-0 vert s0-1)) - (set! sv-912 (-> this origin)) - (set! sv-928 s1-0) - (let ((f0-8 (cos (* 2048.0 (the float (- 7 s0-1)))))) - (.lvf vf2 (&-> sv-928 quad)) - (.lvf vf1 (&-> sv-912 quad)) - (let ((v1-19 f0-8)) - (.mov vf3 v1-19) + (let ((sv-944 (-> s5-0 vert s0-1))) + (let ((sv-912 (-> this origin)) + (sv-928 s1-0) + (f0-8 (cos (* 2048.0 (the float (- 7 s0-1))))) + ) + (.lvf vf2 (&-> sv-928 quad)) + (.lvf vf1 (&-> sv-912 quad)) + (let ((v1-19 f0-8)) + (.mov vf3 v1-19) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-944 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-944 quad) vf4) - (set! sv-992 (-> s5-0 vert s0-1)) - (set! sv-960 (-> s5-0 vert s0-1)) - (set! sv-976 (-> this axis)) - (let ((f0-13 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))))) - (.lvf vf2 (&-> sv-976 quad)) - (.lvf vf1 (&-> sv-960 quad)) - (let ((v1-33 f0-13)) - (.mov vf3 v1-33) + (let ((sv-992 (-> s5-0 vert s0-1))) + (let ((sv-960 (-> s5-0 vert s0-1)) + (sv-976 (-> this axis)) + (f0-13 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1)))))) + ) + (.lvf vf2 (&-> sv-976 quad)) + (.lvf vf1 (&-> sv-960 quad)) + (let ((v1-33 f0-13)) + (.mov vf3 v1-33) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-992 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-992 quad) vf4) - (set! sv-1040 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1008 (-> this origin)) - (set! sv-1024 s1-0) - (let ((f0-16 (cos (* 2048.0 (the float s0-1))))) - (.lvf vf2 (&-> sv-1024 quad)) - (.lvf vf1 (&-> sv-1008 quad)) - (let ((v1-43 f0-16)) - (.mov vf3 v1-43) + (let ((sv-1040 (-> s5-0 vert (+ s0-1 16)))) + (let ((sv-1008 (-> this origin)) + (sv-1024 s1-0) + (f0-16 (cos (* 2048.0 (the float s0-1)))) + ) + (.lvf vf2 (&-> sv-1024 quad)) + (.lvf vf1 (&-> sv-1008 quad)) + (let ((v1-43 f0-16)) + (.mov vf3 v1-43) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1040 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1040 quad) vf4) - (set! sv-1088 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1056 (-> s5-0 vert (+ s0-1 16))) - (set! sv-1072 (-> this axis)) - (let ((f0-21 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1))))))) - (.lvf vf2 (&-> sv-1072 quad)) - (.lvf vf1 (&-> sv-1056 quad)) - (let ((v1-57 f0-21)) - (.mov vf3 v1-57) + (let ((sv-1088 (-> s5-0 vert (+ s0-1 16)))) + (let ((sv-1056 (-> s5-0 vert (+ s0-1 16))) + (sv-1072 (-> this axis)) + (f0-21 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1)))))) + ) + (.lvf vf2 (&-> sv-1072 quad)) + (.lvf vf1 (&-> sv-1056 quad)) + (let ((v1-57 f0-21)) + (.mov vf3 v1-57) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1088 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1088 quad) vf4) ) (dotimes (s2-1 16) (dotimes (s1-1 24) @@ -255,7 +249,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod debug-draw ((this cylinder-flat) (arg0 vector4w)) - (local-vars (sv-448 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -276,14 +269,15 @@ (s3-0 (new 'stack-no-clear 'matrix)) ) (matrix-axis-angle! s3-0 (-> this axis) 4096.0) - (set! sv-448 (new 'stack-no-clear 'vector)) - (vector-matrix*! sv-448 (-> this origin) s3-0) - (let ((v1-6 (-> s3-0 trans))) - (.lvf vf4 (&-> (-> this origin) quad)) - (.lvf vf5 (&-> sv-448 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-6 quad) vf6) + (let ((sv-448 (new 'stack-no-clear 'vector))) + (vector-matrix*! sv-448 (-> this origin) s3-0) + (let ((v1-6 (-> s3-0 trans))) + (.lvf vf4 (&-> (-> this origin) quad)) + (.lvf vf5 (&-> sv-448 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-6 quad) vf6) + ) ) (dotimes (v1-7 8) (vector+! (-> s5-0 vert (+ v1-7 1)) (-> this origin) s1-0) diff --git a/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc b/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc index 7b16653234..8ccd05e349 100644 --- a/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc +++ b/test/decompiler/reference/jak2/engine/geometry/geometry_REF.gc @@ -265,11 +265,7 @@ ) ) ) - (let ((f0-6 (vector-vector-distance-squared s5-0 arg0)) - (f1-4 (-> arg0 w)) - ) - (< f0-6 (* f1-4 f1-4)) - ) + (< (vector-vector-distance-squared s5-0 arg0) (square (-> arg0 w))) ) ) @@ -531,9 +527,7 @@ "Create a rotation matrix representing the rotation between two vectors." (let* ((a1-3 (vector-normalize! (vector-cross! (new-stack-vector0) arg2 arg1) 1.0)) (f0-1 (vector-dot arg1 arg2)) - (f1-0 1.0) - (f2-0 f0-1) - (f1-2 (sqrtf (- f1-0 (* f2-0 f2-0)))) + (f1-2 (sqrtf (- 1.0 (square f0-1)))) ) (matrix-axis-sin-cos! arg0 a1-3 f1-2 f0-1) ) @@ -548,21 +542,10 @@ (f30-0 (vector-dot arg1 arg2)) (f28-0 (cos arg3)) ) - (cond - ((< f30-0 f28-0) - (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f28-0) - ) - (else - (let ((t9-5 matrix-axis-sin-cos!) - (a0-6 arg0) - (a1-4 s4-1) - (f0-1 1.0) - (f1-0 f30-0) - ) - (t9-5 a0-6 a1-4 (sqrtf (- f0-1 (* f1-0 f1-0))) f30-0) - ) + (if (< f30-0 f28-0) + (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f28-0) + (matrix-axis-sin-cos! arg0 s4-1 (sqrtf (- 1.0 (square f30-0))) f30-0) ) - ) ) ) @@ -616,21 +599,10 @@ (f30-0 (cos arg3)) (f0-2 (+ 1.0 (* (+ -1.0 f28-0) arg4))) ) - (cond - ((< f0-2 f30-0) - (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f30-0) - ) - (else - (let ((t9-5 matrix-axis-sin-cos!) - (a0-6 arg0) - (a1-4 s4-1) - (f1-3 1.0) - (f2-1 f0-2) - ) - (t9-5 a0-6 a1-4 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-2) - ) + (if (< f0-2 f30-0) + (matrix-axis-sin-cos! arg0 s4-1 (sin arg3) f30-0) + (matrix-axis-sin-cos! arg0 s4-1 (sqrtf (- 1.0 (square f0-2))) f0-2) ) - ) ) ) @@ -646,13 +618,8 @@ (matrix-identity! arg0) ) (else - (let* ((f0-4 (cos (* arg3 (acos f0-1)))) - (t9-5 matrix-axis-sin-cos!) - (a0-6 arg0) - (f1-1 1.0) - (f2-1 f0-4) - ) - (t9-5 a0-6 gp-1 (sqrtf (- f1-1 (* f2-1 f2-1))) f0-4) + (let ((f0-4 (cos (* arg3 (acos f0-1))))) + (matrix-axis-sin-cos! arg0 gp-1 (sqrtf (- 1.0 (square f0-4))) f0-4) ) ) ) @@ -770,7 +737,6 @@ ;; INFO: Used lq/sq (defun vector-vector-deg-slerp! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector)) "Unused. No clue what this does." - (local-vars (sv-112 (function float float float float))) (cond ((>= 0.0 arg3) (set! (-> arg0 quad) (-> arg1 quad)) @@ -784,15 +750,11 @@ (s0-1 (forward-up->quaternion (new 'stack-no-clear 'quaternion) s0-0 arg4)) (a2-5 (forward-up->quaternion (new 'stack-no-clear 'quaternion) s1-0 arg4)) (a1-6 (quaternion-slerp! (new 'stack-no-clear 'quaternion) s0-1 a2-5 arg3)) - (s2-1 vector-normalize-copy!) - (s1-1 arg0) - (s0-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) a1-6)) ) - (set! sv-112 lerp) - (let ((s3-1 (vector-length arg1)) - (a1-7 (vector-length arg2)) - ) - (s2-1 s1-1 s0-2 (sv-112 s3-1 a1-7 arg3)) + (vector-normalize-copy! + arg0 + (vector-z-quaternion! (new 'stack-no-clear 'vector) a1-6) + (lerp (vector-length arg1) (vector-length arg2) arg3) ) ) ) @@ -1124,7 +1086,7 @@ (f8-0 (fabs f2-1)) ) (nop!) - (let ((f7-1 (* f1-1 f1-1))) + (let ((f7-1 (square f1-1))) (nop!) (let ((f6-2 (- f6-1 f8-0))) (b! (nonzero? a0-1) cfg-2 :delay (set! f8-1 (*.s f2-1 f2-1))) @@ -1141,14 +1103,14 @@ (f12-0 (* f6-3 f0-1)) (f10-0 (* f0-1 f2-1)) (f11-0 (* f3-0 f2-1)) - (f9-0 (* f0-1 f0-1)) + (f9-0 (square f0-1)) (f12-1 (* f12-0 f3-0)) ) (.mula.s f3-0 f3-0) (.madda.s f4-0 f4-0) (.msub.s f3-1 f5-0 f5-0) (let* ((f5-1 (* f12-1 f1-2)) - (f12-2 (* f1-2 f1-2)) + (f12-2 (square f1-2)) (f11-1 (* f11-0 f1-2)) (f10-1 (* f10-0 f12-2)) (f8-2 (* f8-1 f12-2)) @@ -1212,14 +1174,14 @@ (f12-3 (* f6-6 f0-1)) (f10-3 (* f0-1 f1-1)) (f11-2 (* f4-0 f1-1)) - (f9-2 (* f0-1 f0-1)) + (f9-2 (square f0-1)) (f12-4 (* f12-3 f4-0)) ) (.mula.s f4-0 f4-0) (.madda.s f3-0 f3-0) (.msub.s f4-5 f5-0 f5-0) (let* ((f5-11 (* f12-4 f2-5)) - (f12-5 (* f2-5 f2-5)) + (f12-5 (square f2-5)) (f11-3 (* f11-2 f2-5)) (f10-4 (* f10-3 f12-5)) (f7-5 (* f7-1 f12-5)) @@ -1676,9 +1638,8 @@ ;; WARN: Stack slot offset 48 signed mismatch (defun curve-closest-point ((arg0 curve) (arg1 vector) (arg2 float) (arg3 float) (arg4 int) (arg5 float)) "Get the input value for the point on the curve. Approximate! And is O(n_knots)." - (local-vars (sv-48 float)) - (set! sv-48 arg3) - (let ((s3-0 arg4) + (let ((sv-48 arg3) + (s3-0 arg4) (gp-0 arg5) (f30-0 (curve-length arg0)) (s2-0 (new 'stack-no-clear 'vector)) diff --git a/test/decompiler/reference/jak2/engine/geometry/path-h_REF.gc b/test/decompiler/reference/jak2/engine/geometry/path-h_REF.gc index 19ee8e7ddb..7ee4ac7862 100644 --- a/test/decompiler/reference/jak2/engine/geometry/path-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/geometry/path-h_REF.gc @@ -96,9 +96,9 @@ These path-controls are typically allocated on a process heap." (must-exist symbol) ) "Allocate a new path-control, set up the curve to point to the specified lump data." - (local-vars (v0-3 object) (sv-16 res-tag) (sv-32 float)) - (set! sv-32 lump-time) - (let ((s0-0 lump-actor) + (local-vars (v0-3 object)) + (let ((sv-32 lump-time) + (s0-0 lump-actor) (s1-0 must-exist) ) (if (not s0-0) @@ -112,14 +112,8 @@ These path-controls are typically allocated on a process heap." ) ) (let ((s2-0 (the-as object 0))) - (set! sv-16 (new 'static 'res-tag)) - (let* ((t9-1 (method-of-type res-lump get-property-data)) - (a1-2 lump-name) - (a2-2 'interp) - (t0-1 #f) - (t1-1 (the-as (pointer res-tag) (& sv-16))) - (t2-1 *res-static-buf*) - (s0-1 (t9-1 s0-0 a1-2 a2-2 sv-32 (the-as pointer t0-1) t1-1 t2-1)) + (let* ((sv-16 (new 'static 'res-tag)) + (s0-1 (res-lump-data s0-0 lump-name pointer :tag-ptr (& sv-16) :time sv-32)) ) (cond (s0-1 diff --git a/test/decompiler/reference/jak2/engine/geometry/vol_REF.gc b/test/decompiler/reference/jak2/engine/geometry/vol_REF.gc index b0b7f08020..13234796f5 100644 --- a/test/decompiler/reference/jak2/engine/geometry/vol_REF.gc +++ b/test/decompiler/reference/jak2/engine/geometry/vol_REF.gc @@ -45,140 +45,143 @@ ;; WARN: Stack slot offset 148 signed mismatch ;; WARN: Stack slot offset 148 signed mismatch (defmethod plane-volume-method-9 ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array)) - (local-vars - (sv-144 vector) - (sv-148 number) - (sv-152 int) - (sv-160 vector) - (sv-176 vector) - (sv-192 vector) - (sv-208 vector) - (sv-224 vector) - (sv-240 int) - (sv-256 int) - ) (set! (-> this volume-type) arg0) (set! (-> this point-count) 0) (set! (-> this first-point) (the-as (pointer vector) (-> arg1 data (-> arg1 length)))) (set! (-> this normal-count) 0) (set! (-> this first-normal) (the-as (pointer vector) (-> arg2 data (-> arg2 length)))) (dotimes (s3-0 (-> this num-planes)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (set! (-> sv-176 quad) (the-as uint128 0)) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! (-> sv-192 quad) (the-as uint128 0)) - (set! sv-208 (new 'stack-no-clear 'vector)) - (set! (-> sv-208 quad) (the-as uint128 0)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (set! (-> sv-224 quad) (the-as uint128 0)) - 0.0 - 0.0 - 0.0 - (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) - (let ((s1-0 (new-stack-vector0)) - (s0-0 0) - (s2-0 (-> this plane)) - ) - (set! sv-240 0) - (while (< sv-240 (-> this num-planes)) - (when (!= s3-0 sv-240) - (vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w)) - (vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0))) - (vector-normalize! sv-192 1.0) - (vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240))) - (vector-normalize! sv-208 1.0) - (let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208))) - (when (!= f0-4 409600000.0) - (vector+float*! sv-224 sv-176 sv-208 f0-4) - (set! sv-144 (new-stack-vector0)) - (set! sv-148 0.0) - (set! sv-152 0) - (set! sv-160 (new-stack-vector0)) - (set! (-> sv-144 quad) (-> sv-224 quad)) - (set! sv-256 0) - (while (< sv-256 (-> this num-planes)) - (when (and (!= sv-256 s3-0) (!= sv-256 sv-240)) - (let ((f0-6 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) - (cond - ((= f0-6 409600000.0) - ) - ((zero? sv-152) - (vector+float*! sv-144 sv-144 sv-192 f0-6) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-148 8192000.0) - (set! sv-152 1) - ) - ((begin (vector-float*! sv-224 sv-192 f0-6) (>= (vector-dot sv-224 sv-160) 0.0)) - ) - ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) - (when (< (fabs f0-6) (fabs (the-as float sv-148))) - (set! sv-148 f0-6) - (set! sv-152 (+ sv-152 1)) - ) - ) - (else - (vector+float*! sv-144 sv-144 sv-192 f0-6) - (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) - (set! sv-152 (+ sv-152 1)) - (if (< (fabs f0-6) (fabs (the-as float sv-148))) - (set! sv-148 (- (the-as float sv-148) f0-6)) - (set! sv-148 0.0) + (let ((sv-176 (new 'stack-no-clear 'vector))) + (set! (-> sv-176 quad) (the-as uint128 0)) + (let ((sv-192 (new 'stack-no-clear 'vector))) + (set! (-> sv-192 quad) (the-as uint128 0)) + (let ((sv-208 (new 'stack-no-clear 'vector))) + (set! (-> sv-208 quad) (the-as uint128 0)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (set! (-> sv-224 quad) (the-as uint128 0)) + 0.0 + 0.0 + 0.0 + (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) + (let ((s1-0 (new-stack-vector0)) + (s0-0 0) + (s2-0 (-> this plane)) + ) + (let ((sv-240 0)) + (while (< sv-240 (-> this num-planes)) + (when (!= s3-0 sv-240) + (vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w)) + (vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0))) + (vector-normalize! sv-192 1.0) + (vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240))) + (vector-normalize! sv-208 1.0) + (let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208))) + (when (!= f0-4 409600000.0) + (vector+float*! sv-224 sv-176 sv-208 f0-4) + (let ((sv-144 (new-stack-vector0)) + (sv-148 0.0) + (sv-152 0) + ) + (let ((sv-160 (new-stack-vector0))) + (set! (-> sv-144 quad) (-> sv-224 quad)) + (let ((sv-256 0)) + (while (< sv-256 (-> this num-planes)) + (when (and (!= sv-256 s3-0) (!= sv-256 sv-240)) + (let ((f0-6 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192))) + (cond + ((= f0-6 409600000.0) + ) + ((zero? sv-152) + (vector+float*! sv-144 sv-144 sv-192 f0-6) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (set! sv-148 8192000.0) + (set! sv-152 1) + ) + ((begin (vector-float*! sv-224 sv-192 f0-6) (>= (vector-dot sv-224 sv-160) 0.0)) + ) + ((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0) + (when (< (fabs f0-6) (fabs (the-as float sv-148))) + (set! sv-148 f0-6) + (+! sv-152 1) + ) + ) + (else + (vector+float*! sv-144 sv-144 sv-192 f0-6) + (set! (-> sv-160 quad) (-> s2-0 sv-256 quad)) + (+! sv-152 1) + (set! sv-148 (cond + ((< (fabs f0-6) (fabs (the-as float sv-148))) + (set! sv-148 (- (the-as float sv-148) f0-6)) + sv-148 + ) + (else + 0.0 + ) + ) + ) + ) + ) + ) + ) + (+! sv-256 1) + ) + ) ) + (cond + ((zero? sv-152) + ) + ((= (the-as float sv-148) 0.0) + ) + (else + (dotimes (v1-79 (-> this num-planes)) + (when (and (!= v1-79 s3-0) (!= v1-79 sv-240)) + (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-79))) (-> s2-0 v1-79 w))) + (goto cfg-42) + ) + ) + ) + (vector+float*! sv-224 sv-144 sv-192 (the-as float sv-148)) + (cond + ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume points~%" this) + ) + (else + (set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad)) + (set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad)) + (+! (-> arg1 length) 2) + (+! (-> this point-count) 2) + ) + ) + (vector+! s1-0 s1-0 sv-144) + (vector+! s1-0 s1-0 sv-224) + (+! s0-0 2) + ) + ) + ) ) ) ) + (label cfg-42) + (+! sv-240 1) ) - (set! sv-256 (+ sv-256 1)) ) - (cond - ((zero? sv-152) - ) - ((= (the-as float sv-148) 0.0) - ) - (else - (dotimes (v1-79 (-> this num-planes)) - (when (and (!= v1-79 s3-0) (!= v1-79 sv-240)) - (if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-79))) (-> s2-0 v1-79 w))) - (goto cfg-42) - ) - ) + (when (nonzero? s0-0) + (vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0))) + (cond + ((< (-> arg2 allocated-length) (+ (-> arg2 length) 2)) + (format 0 "ERROR : vol-control #x~X out of volume normals~%" this) + ) + (else + (set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad)) + (set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad)) + (+! (-> arg2 length) 2) + (set! (-> this normal-count) (+ (-> this normal-count) 2)) ) - (vector+float*! sv-224 sv-144 sv-192 (the-as float sv-148)) - (cond - ((< (-> arg1 allocated-length) (+ (-> arg1 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume points~%" this) - ) - (else - (set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad)) - (set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad)) - (+! (-> arg1 length) 2) - (+! (-> this point-count) 2) - ) - ) - (vector+! s1-0 s1-0 sv-144) - (vector+! s1-0 s1-0 sv-224) - (+! s0-0 2) ) ) ) ) ) - (label cfg-42) - (set! sv-240 (+ sv-240 1)) - ) - (when (nonzero? s0-0) - (vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0))) - (cond - ((< (-> arg2 allocated-length) (+ (-> arg2 length) 2)) - (format 0 "ERROR : vol-control #x~X out of volume normals~%" this) - ) - (else - (set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad)) - (set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad)) - (+! (-> arg2 length) 2) - (set! (-> this normal-count) (+ (-> this normal-count) 2)) - ) - ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/background/tfrag/tfrag-methods_REF.gc b/test/decompiler/reference/jak2/engine/gfx/background/tfrag/tfrag-methods_REF.gc index d8badaff36..3e76e3b540 100644 --- a/test/decompiler/reference/jak2/engine/gfx/background/tfrag/tfrag-methods_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/background/tfrag/tfrag-methods_REF.gc @@ -29,7 +29,6 @@ ;; definition for function draw-drawable-tree-tfrag ;; WARN: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag ((arg0 drawable-tree-tfrag)) - (local-vars (sv-16 int)) (when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask tfrag)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -53,126 +52,125 @@ (let* ((v1-14 (-> arg0 arrays s5-0)) (s4-1 (&+ v1-14 32)) (s3-0 (-> v1-14 length)) + (sv-16 (+ (/ (-> s4-1 id) 8) #x38a0 #x70000000)) + (s5-1 (-> *display* frames (-> *display* on-screen) global-buf base)) ) - (set! sv-16 (+ (/ (-> s4-1 id) 8) #x38a0 #x70000000)) - (let ((s5-1 (-> *display* frames (-> *display* on-screen) global-buf base))) - (let* ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (s2-0 (-> s1-0 base)) - ) - (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) - (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) - (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp tfrag-closest))) - (set! (-> *tfrag-work* last-call) (the-as uint 0)) - (draw-inline-array-tfrag (the-as pointer sv-16) s4-1 s3-0 s1-0) - (set! (-> *level* draw-level *draw-index* tfrag-last-calls 0) (the-as int (-> *tfrag-work* last-call))) - (update-wait-stats - (-> *perf-stats* data 42) - (the-as uint 0) - (-> *tfrag-work* wait-to-spr) - (-> *tfrag-work* wait-from-spr) + (let* ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (s2-0 (-> s1-0 base)) + ) + (set! (-> *tfrag-work* wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* texture-dists) (the-as uint (-> *level* draw-level *draw-index* bsp tfrag-closest))) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag (the-as pointer sv-16) s4-1 s3-0 s1-0) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 0) (the-as int (-> *tfrag-work* last-call))) + (update-wait-stats + (-> *perf-stats* data 42) + (the-as uint 0) + (-> *tfrag-work* wait-to-spr) + (-> *tfrag-work* wait-from-spr) + ) + (let ((a3-3 (-> s1-0 base))) + (let ((v1-46 (the-as dma-packet (-> s1-0 base)))) + (set! (-> v1-46 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-46 vif0) (new 'static 'vif-tag)) + (set! (-> v1-46 vif1) (new 'static 'vif-tag)) + (set! (-> s1-0 base) (the-as pointer (&+ v1-46 16))) ) - (let ((a3-3 (-> s1-0 base))) - (let ((v1-46 (the-as dma-packet (-> s1-0 base)))) - (set! (-> v1-46 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-46 vif0) (new 'static 'vif-tag)) - (set! (-> v1-46 vif1) (new 'static 'vif-tag)) - (set! (-> s1-0 base) (the-as pointer (&+ v1-46 16))) - ) - (let ((t9-3 dma-bucket-insert-tag) - (a0-22 (-> *display* frames (-> *display* on-screen) bucket-group)) - (v1-53 *draw-index*) - ) - (t9-3 - a0-22 - (cond - ((zero? v1-53) - (bucket-id tfrag-l0-tfrag) - ) - ((= v1-53 1) - (bucket-id tfrag-l1-tfrag) - ) - ((= v1-53 2) - (bucket-id tfrag-l2-tfrag) - ) - ((= v1-53 3) - (bucket-id tfrag-l3-tfrag) - ) - ((= v1-53 4) - (bucket-id tfrag-l4-tfrag) - ) - (else - (bucket-id tfrag-l5-tfrag) - ) - ) - s2-0 - (the-as (pointer dma-tag) a3-3) + (let ((t9-3 dma-bucket-insert-tag) + (a0-22 (-> *display* frames (-> *display* on-screen) bucket-group)) + (v1-53 *draw-index*) ) + (t9-3 + a0-22 + (cond + ((zero? v1-53) + (bucket-id tfrag-l0-tfrag) + ) + ((= v1-53 1) + (bucket-id tfrag-l1-tfrag) + ) + ((= v1-53 2) + (bucket-id tfrag-l2-tfrag) + ) + ((= v1-53 3) + (bucket-id tfrag-l3-tfrag) + ) + ((= v1-53 4) + (bucket-id tfrag-l4-tfrag) + ) + (else + (bucket-id tfrag-l5-tfrag) + ) + ) + s2-0 + (the-as (pointer dma-tag) a3-3) ) ) ) - (let* ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (s2-1 (-> s1-1 base)) - ) - (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) - (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) - (set! (-> *tfrag-work* last-call) (the-as uint 0)) - (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s4-1 s3-0 s1-1) - (set! (-> *level* draw-level *draw-index* tfrag-last-calls 1) (the-as int (-> *tfrag-work* last-call))) - (update-wait-stats - (-> *perf-stats* data 43) - (the-as uint 0) - (-> *tfrag-work* near-wait-to-spr) - (-> *tfrag-work* near-wait-from-spr) + ) + (let* ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (s2-1 (-> s1-1 base)) + ) + (set! (-> *tfrag-work* near-wait-to-spr) (the-as uint 0)) + (set! (-> *tfrag-work* near-wait-from-spr) (the-as uint 0)) + (set! (-> *tfrag-work* last-call) (the-as uint 0)) + (draw-inline-array-tfrag-scissor (the-as pointer sv-16) s4-1 s3-0 s1-1) + (set! (-> *level* draw-level *draw-index* tfrag-last-calls 1) (the-as int (-> *tfrag-work* last-call))) + (update-wait-stats + (-> *perf-stats* data 43) + (the-as uint 0) + (-> *tfrag-work* near-wait-to-spr) + (-> *tfrag-work* near-wait-from-spr) + ) + (let ((a3-6 (-> s1-1 base))) + (let ((v1-70 (the-as dma-packet (-> s1-1 base)))) + (set! (-> v1-70 dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> v1-70 vif0) (new 'static 'vif-tag)) + (set! (-> v1-70 vif1) (new 'static 'vif-tag)) + (set! (-> s1-1 base) (the-as pointer (&+ v1-70 16))) ) - (let ((a3-6 (-> s1-1 base))) - (let ((v1-70 (the-as dma-packet (-> s1-1 base)))) - (set! (-> v1-70 dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> v1-70 vif0) (new 'static 'vif-tag)) - (set! (-> v1-70 vif1) (new 'static 'vif-tag)) - (set! (-> s1-1 base) (the-as pointer (&+ v1-70 16))) - ) - (let ((t9-6 dma-bucket-insert-tag) - (a0-32 (-> *display* frames (-> *display* on-screen) bucket-group)) - (v1-77 *draw-index*) - ) - (t9-6 - a0-32 - (cond - ((zero? v1-77) - (bucket-id tfrag-s-l0-tfrag) - ) - ((= v1-77 1) - (bucket-id tfrag-s-l1-tfrag) - ) - ((= v1-77 2) - (bucket-id tfrag-s-l2-tfrag) - ) - ((= v1-77 3) - (bucket-id tfrag-s-l3-tfrag) - ) - ((= v1-77 4) - (bucket-id tfrag-s-l4-tfrag) - ) - (else - (bucket-id tfrag-s-l5-tfrag) - ) - ) - s2-1 - (the-as (pointer dma-tag) a3-6) + (let ((t9-6 dma-bucket-insert-tag) + (a0-32 (-> *display* frames (-> *display* on-screen) bucket-group)) + (v1-77 *draw-index*) ) + (t9-6 + a0-32 + (cond + ((zero? v1-77) + (bucket-id tfrag-s-l0-tfrag) + ) + ((= v1-77 1) + (bucket-id tfrag-s-l1-tfrag) + ) + ((= v1-77 2) + (bucket-id tfrag-s-l2-tfrag) + ) + ((= v1-77 3) + (bucket-id tfrag-s-l3-tfrag) + ) + ((= v1-77 4) + (bucket-id tfrag-s-l4-tfrag) + ) + (else + (bucket-id tfrag-s-l5-tfrag) + ) + ) + s2-1 + (the-as (pointer dma-tag) a3-6) ) ) ) - (let ((v1-78 *dma-mem-usage*)) - (when (nonzero? v1-78) - (set! (-> v1-78 length) (max 2 (-> v1-78 length))) - (set! (-> v1-78 data 1 name) "tfragment") - (+! (-> v1-78 data 1 count) 1) - (+! (-> v1-78 data 1 used) - (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) - ) - (set! (-> v1-78 data 1 total) (-> v1-78 data 1 used)) - ) + ) + (let ((v1-78 *dma-mem-usage*)) + (when (nonzero? v1-78) + (set! (-> v1-78 length) (max 2 (-> v1-78 length))) + (set! (-> v1-78 data 1 name) "tfragment") + (+! (-> v1-78 data 1 count) 1) + (+! (-> v1-78 data 1 used) + (&- (-> *display* frames (-> *display* on-screen) global-buf base) (the-as uint s5-1)) + ) + (set! (-> v1-78 data 1 total) (-> v1-78 data 1 used)) ) ) ) @@ -184,7 +182,6 @@ ;; definition for function draw-drawable-tree-tfrag-trans ;; WARN: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag-trans ((arg0 drawable-tree-tfrag)) - (local-vars (sv-16 int)) (when (logtest? (vu1-renderer-mask tfrag-trans) (-> *display* vu1-enable-user)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -208,8 +205,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (+ (/ (-> s5-1 id) 8) #x38a0 #x70000000)) ) - (set! sv-16 (+ (/ (-> s5-1 id) 8) #x38a0 #x70000000)) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) (s3-0 (-> s2-0 base)) ) @@ -326,7 +323,6 @@ ;; definition for function draw-drawable-tree-tfrag-water ;; WARN: Return type mismatch drawable-tree-tfrag vs none. (defun draw-drawable-tree-tfrag-water ((arg0 drawable-tree-tfrag)) - (local-vars (sv-16 int)) (when (logtest? (vu1-renderer-mask tfrag-water) (-> *display* vu1-enable-user)) (let ((s5-0 (+ (-> arg0 length) -1))) (when (nonzero? s5-0) @@ -350,8 +346,8 @@ (let* ((v1-13 (-> arg0 arrays s5-0)) (s5-1 (&+ v1-13 32)) (s4-1 (-> v1-13 length)) + (sv-16 (+ (/ (-> s5-1 id) 8) #x38a0 #x70000000)) ) - (set! sv-16 (+ (/ (-> s5-1 id) 8) #x38a0 #x70000000)) (let* ((s2-0 (-> *display* frames (-> *display* on-screen) global-buf)) (s3-0 (-> s2-0 base)) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/background/tie/tie_REF.gc b/test/decompiler/reference/jak2/engine/gfx/background/tie/tie_REF.gc index 32dd341ece..6647ee03f0 100644 --- a/test/decompiler/reference/jak2/engine/gfx/background/tie/tie_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/background/tie/tie_REF.gc @@ -630,22 +630,18 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun-debug tie-ints () - (local-vars (sv-16 uint)) (let ((gp-0 (+ #x3da0 #x1100c000))) (dotimes (s5-0 16) (if (< s5-0 10) (format 0 " ") ) - (let ((s4-0 format) - (s3-0 0) - (s2-0 "vi~d: ~6d #x~4,'0X ~s~%") - (s1-0 s5-0) - (s0-0 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) - ) - (set! sv-16 (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0)) - (let ((t1-0 (tie-int-reg s5-0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) - ) + (format + 0 + "vi~d: ~6d #x~4,'0X ~s~%" + s5-0 + (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0) + (-> (the-as (pointer uint32) (+ gp-0 (* (* s5-0 4) 4))) 0) + (tie-int-reg s5-0) ) ) ) @@ -656,7 +652,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun-debug tie-floats () - (local-vars (sv-16 uint) (sv-32 uint)) (let ((gp-0 (the-as (pointer uint32) (+ #x3da0 #x1100c000)))) (dotimes (s5-0 32) (if (< s5-0 10) @@ -671,17 +666,14 @@ (-> gp-0 (+ (* s5-0 4) 2)) (-> gp-0 (+ (* s5-0 4) 3)) ) - (let ((s4-0 format) - (s3-0 0) - (s2-0 "~F ~F ~F ~F ~s~%") - (s1-0 (-> gp-0 (* s5-0 4))) - (s0-0 (-> gp-0 (+ (* s5-0 4) 1))) - ) - (set! sv-16 (-> gp-0 (+ (* s5-0 4) 2))) - (set! sv-32 (-> gp-0 (+ (* s5-0 4) 3))) - (let ((t2-1 (tie-float-reg s5-0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 sv-32 t2-1) - ) + (format + 0 + "~F ~F ~F ~F ~s~%" + (-> gp-0 (* s5-0 4)) + (-> gp-0 (+ (* s5-0 4) 1)) + (-> gp-0 (+ (* s5-0 4) 2)) + (-> gp-0 (+ (* s5-0 4) 3)) + (tie-float-reg s5-0) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/foreground/eye_REF.gc b/test/decompiler/reference/jak2/engine/gfx/foreground/eye_REF.gc index 91c01a4e91..e0fdd6b31b 100644 --- a/test/decompiler/reference/jak2/engine/gfx/foreground/eye_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/foreground/eye_REF.gc @@ -70,7 +70,6 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch (defun render-eyes-32 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 32) (s3-0 (+ (* arg2 32) 32)) (s2-0 (* arg2 32)) @@ -78,8 +77,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -294,7 +293,6 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch (defun render-eyes-32-different ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 32) (s3-0 (+ (* arg2 32) 32)) (s2-0 (* arg2 32)) @@ -302,8 +300,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 16)) (* 32.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 48)) (* 32.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 16)) (* 32.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -575,7 +573,6 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch (defun render-eyes-64 ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 64) (s3-0 (+ (* arg2 64) 64)) (s2-0 (* arg2 64)) @@ -583,8 +580,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) @@ -799,7 +796,6 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch (defun render-eyes-64-different ((arg0 dma-buffer) (arg1 eye-control) (arg2 int)) - (local-vars (sv-16 float)) (let ((s4-0 64) (s3-0 (+ (* arg2 64) 64)) (s2-0 (* arg2 64)) @@ -807,8 +803,8 @@ (let ((f28-0 (* 16.0 (+ (the float (+ s4-0 32)) (* 64.0 (-> arg1 left x))))) (f26-0 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 left y))))) (f30-0 (* 16.0 (+ (the float (+ s4-0 96)) (* 64.0 (-> arg1 right x))))) + (sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) ) - (set! sv-16 (* 16.0 (+ (the float (+ s3-0 32)) (* 64.0 (-> arg1 right y))))) (let ((s1-0 (-> arg1 shaders 0))) (let ((v1-14 (the-as object (-> arg0 base)))) (set! (-> (the-as dma-gif-packet v1-14) dma-vif quad) (-> *eye-work* adgif-tmpl dma-vif quad)) diff --git a/test/decompiler/reference/jak2/engine/gfx/foreground/lightning_REF.gc b/test/decompiler/reference/jak2/engine/gfx/foreground/lightning_REF.gc index 2d430e0ae8..1aaf13b143 100644 --- a/test/decompiler/reference/jak2/engine/gfx/foreground/lightning_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/foreground/lightning_REF.gc @@ -37,12 +37,12 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun lightning-fractal-gen ((arg0 (inline-array vector)) (arg1 int) (arg2 int) (arg3 float) (arg4 lightning-spec)) - (local-vars (sv-16 vector) (sv-32 vector)) (when (< 1 (- arg2 arg1)) (let ((s1-0 (/ (+ arg1 arg2) 2))) - (set! sv-16 (-> arg0 arg1)) - (set! sv-32 (-> arg0 arg2)) - (let ((s0-0 (-> arg0 s1-0))) + (let ((sv-16 (-> arg0 arg1)) + (sv-32 (-> arg0 arg2)) + (s0-0 (-> arg0 s1-0)) + ) (let* ((f30-0 (* 0.5 (+ (-> sv-16 x) (-> sv-32 x)))) (f28-0 arg3) (f26-0 -0.5) @@ -80,7 +80,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun lightning-uniform-gen ((arg0 (inline-array vector)) (arg1 int) (arg2 int) (arg3 float) (arg4 lightning-spec)) - (local-vars (sv-32 vector)) (let ((s4-0 (-> arg0 arg1)) (s3-0 (-> arg0 arg2)) (f30-0 (/ 1.0 (the float (- arg2 arg1)))) @@ -91,29 +90,30 @@ ) (while (>= s0-0 s1-0) (vector-lerp! (-> arg0 s1-0) s4-0 s3-0 f28-0) - (set! sv-32 s2-0) - (let* ((f26-0 0.4) - (f24-0 -0.5) - (v1-7 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-8 (the-as number (logior #x3f800000 v1-7))) - ) - (set! (-> sv-32 x) (* f26-0 (+ f24-0 (+ -1.0 (the-as float v1-8))) arg3)) + (let ((sv-32 s2-0)) + (let* ((f26-0 0.4) + (f24-0 -0.5) + (v1-7 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-8 (the-as number (logior #x3f800000 v1-7))) + ) + (set! (-> sv-32 x) (* f26-0 (+ f24-0 (+ -1.0 (the-as float v1-8))) arg3)) + ) + (let* ((f26-1 0.4) + (f24-1 -0.5) + (v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-14 (the-as number (logior #x3f800000 v1-13))) + ) + (set! (-> sv-32 y) (* f26-1 (+ f24-1 (+ -1.0 (the-as float v1-14))) arg3)) + ) + (let* ((f26-2 0.4) + (f24-2 -0.5) + (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-20 (the-as number (logior #x3f800000 v1-19))) + ) + (set! (-> sv-32 z) (* f26-2 (+ f24-2 (+ -1.0 (the-as float v1-20))) arg3)) + ) + (set! (-> sv-32 w) 1.0) ) - (let* ((f26-1 0.4) - (f24-1 -0.5) - (v1-13 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-14 (the-as number (logior #x3f800000 v1-13))) - ) - (set! (-> sv-32 y) (* f26-1 (+ f24-1 (+ -1.0 (the-as float v1-14))) arg3)) - ) - (let* ((f26-2 0.4) - (f24-2 -0.5) - (v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-20 (the-as number (logior #x3f800000 v1-19))) - ) - (set! (-> sv-32 z) (* f26-2 (+ f24-2 (+ -1.0 (the-as float v1-20))) arg3)) - ) - (set! (-> sv-32 w) 1.0) (vector+! (-> arg0 s1-0) (-> arg0 s1-0) s2-0) (+! f28-0 f30-0) (+! s1-0 1) @@ -167,7 +167,6 @@ (arg4 float) (arg5 lightning-spec) ) - (local-vars (sv-80 vector) (sv-96 vector) (sv-112 vector) (sv-128 vector) (sv-144 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -176,78 +175,83 @@ (init-vf0-vector) (when (< 1 (- arg3 arg2)) (let ((s0-0 (/ (+ arg2 arg3) 2))) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((v1-5 (-> arg0 arg2)) - (a0-3 (-> arg1 arg2)) - ) - (.lvf vf4 (&-> v1-5 quad)) - (.lvf vf5 (&-> a0-3 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - (set! sv-112 (new 'stack-no-clear 'vector)) - (let ((v1-9 (-> arg0 arg3)) - (a0-5 (-> arg1 arg3)) - ) - (.lvf vf4 (&-> v1-9 quad)) - (.lvf vf5 (&-> a0-5 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-112 quad) vf6) - (set! sv-144 (new 'stack-no-clear 'vector)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-80 sv-144) - (let* ((f30-0 arg4) - (f28-0 -0.5) - (v1-15 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-16 (the-as number (logior #x3f800000 v1-15))) - ) - (set! (-> sv-80 x) (* f30-0 (+ f28-0 (+ -1.0 (the-as float v1-16))))) - ) - (let* ((f30-1 arg4) - (f28-1 -0.5) - (v1-20 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-21 (the-as number (logior #x3f800000 v1-20))) - ) - (set! (-> sv-80 y) (* f30-1 (+ f28-1 (+ -1.0 (the-as float v1-21))))) - ) - (let* ((f30-2 arg4) - (f28-2 -0.5) - (v1-25 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-26 (the-as number (logior #x3f800000 v1-25))) - ) - (set! (-> sv-80 z) (* f30-2 (+ f28-2 (+ -1.0 (the-as float v1-26))))) - ) - (set! (-> sv-80 w) 1.0) - (let ((v1-31 sv-128) - (a0-15 sv-128) - ) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (let ((v1-5 (-> arg0 arg2)) + (a0-3 (-> arg1 arg2)) + ) + (.lvf vf4 (&-> v1-5 quad)) + (.lvf vf5 (&-> a0-3 quad)) + ) (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-96 quad)) - (.lvf vf5 (&-> sv-112 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> a0-15 quad) vf6) - (vector-float*! v1-31 a0-15 0.5) - ) - (let ((v1-33 sv-144)) - (let ((a0-16 sv-144)) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) + (let ((sv-112 (new 'stack-no-clear 'vector))) + (let ((v1-9 (-> arg0 arg3)) + (a0-5 (-> arg1 arg3)) + ) + (.lvf vf4 (&-> v1-9 quad)) + (.lvf vf5 (&-> a0-5 quad)) + ) (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-16 quad)) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-112 quad) vf6) + (let ((sv-144 (new 'stack-no-clear 'vector))) + (let ((sv-128 (new 'stack-no-clear 'vector))) + (let ((sv-80 sv-144)) + (let* ((f30-0 arg4) + (f28-0 -0.5) + (v1-15 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-16 (the-as number (logior #x3f800000 v1-15))) + ) + (set! (-> sv-80 x) (* f30-0 (+ f28-0 (+ -1.0 (the-as float v1-16))))) + ) + (let* ((f30-1 arg4) + (f28-1 -0.5) + (v1-20 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-21 (the-as number (logior #x3f800000 v1-20))) + ) + (set! (-> sv-80 y) (* f30-1 (+ f28-1 (+ -1.0 (the-as float v1-21))))) + ) + (let* ((f30-2 arg4) + (f28-2 -0.5) + (v1-25 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-26 (the-as number (logior #x3f800000 v1-25))) + ) + (set! (-> sv-80 z) (* f30-2 (+ f28-2 (+ -1.0 (the-as float v1-26))))) + ) + (set! (-> sv-80 w) 1.0) + ) + (let ((v1-31 sv-128) + (a0-15 sv-128) + ) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-96 quad)) + (.lvf vf5 (&-> sv-112 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> a0-15 quad) vf6) + (vector-float*! v1-31 a0-15 0.5) + ) + (let ((v1-33 sv-144)) + (let ((a0-16 sv-144)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-16 quad)) + ) + (.lvf vf5 (&-> sv-128 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-33 quad) vf6) + ) + ) + (let ((v1-35 (-> arg0 s0-0))) + (let ((a0-19 (-> arg1 s0-0))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-19 quad)) + ) + (.lvf vf5 (&-> sv-144 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-35 quad) vf6) + ) + ) ) - (.lvf vf5 (&-> sv-128 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-33 quad) vf6) - ) - (let ((v1-35 (-> arg0 s0-0))) - (let ((a0-19 (-> arg1 s0-0))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-19 quad)) - ) - (.lvf vf5 (&-> sv-144 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-35 quad) vf6) ) (lightning-trail-fractal-gen arg0 arg1 arg2 s0-0 (* arg4 (-> arg5 reduction)) arg5) (lightning-trail-fractal-gen arg0 arg1 s0-0 arg3 (* arg4 (-> arg5 reduction)) arg5) @@ -347,7 +351,7 @@ ;; definition for function lightning-fade (defbehavior lightning-fade process ((arg0 lightning-control)) - (local-vars (v0-1 int) (sv-16 rgba)) + (local-vars (v0-1 int)) (let ((f0-0 (-> arg0 spec fade-time))) (-> arg0 process 0 clock) (cond @@ -356,8 +360,8 @@ (let ((gp-0 (-> arg0 state))) (let* ((s5-0 (-> arg0 spec)) (f30-0 (fmax 0.0 (fmin 1.0 (* (- 1.0 (/ (-> gp-0 counter) f0-0)) (-> s5-0 fade-start-factor))))) + (sv-16 (-> s5-0 fade-to-color)) ) - (set! sv-16 (-> s5-0 fade-to-color)) (set! (-> gp-0 start-color) (rgba-lerp sv-16 (-> s5-0 start-color) (the-as rgba f30-0))) (set! v0-1 (the-as int (rgba-lerp sv-16 (-> s5-0 end-color) (the-as rgba f30-0)))) ) @@ -391,24 +395,16 @@ ;; definition for function lightning-update ;; INFO: Used lq/sq (defun lightning-update ((arg0 lightning-control)) - (local-vars - (sv-16 lightning-spec) - (sv-20 vector-array) - (sv-24 vector-array) - (sv-28 vector-array) - (sv-32 symbol) - (sv-36 clock) - ) (let* ((gp-0 (-> arg0 state points-to-draw)) (s4-0 (+ gp-0 -1)) (s5-0 (-> arg0 state)) + (sv-16 (-> arg0 spec)) + (sv-20 (-> s5-0 line)) + (sv-24 (-> s5-0 meet)) + (sv-28 (-> s5-0 path)) + (sv-32 (= (-> s5-0 mode) (lightning-mode lm1))) + (sv-36 (-> arg0 process 0 clock)) ) - (set! sv-16 (-> arg0 spec)) - (set! sv-20 (-> s5-0 line)) - (set! sv-24 (-> s5-0 meet)) - (set! sv-28 (-> s5-0 path)) - (set! sv-32 (= (-> s5-0 mode) (lightning-mode lm1))) - (set! sv-36 (-> arg0 process 0 clock)) (when (not (or (= (-> sv-36 time-adjust-ratio) 0.0) (< gp-0 2))) (when (logtest? (-> sv-16 flags) (lightning-spec-flags size-from-adjust-dist)) (let ((f1-1 (vector-vector-distance (-> sv-24 data 0) (-> sv-24 data s4-0)))) @@ -499,22 +495,7 @@ ;; WARN: Stack slot offset 28 signed mismatch ;; WARN: Stack slot offset 28 signed mismatch (defun lightning-draw ((arg0 dma-buffer) (arg1 lightning-control) (arg2 lightning-globals)) - (local-vars - (sv-16 math-camera) - (sv-20 (inline-array gcf-vertex)) - (sv-24 lightning-spec) - (sv-28 float) - (sv-32 texture) - (sv-48 vector-array) - (sv-64 int) - (sv-80 int) - (sv-96 int) - (sv-112 int) - (sv-128 int) - (sv-144 int) - (sv-160 int) - (sv-176 gcf-control) - ) + (local-vars (sv-128 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -528,255 +509,269 @@ (vf9 :class vf) ) (init-vf0-vector) - (set! sv-16 *math-camera*) - (set! sv-20 (the-as (inline-array gcf-vertex) *gsf-buffer*)) - (let* ((s3-0 (-> arg1 state points-to-draw)) + (let* ((sv-16 *math-camera*) + (sv-20 (the-as (inline-array gcf-vertex) *gsf-buffer*)) + (s3-0 (-> arg1 state points-to-draw)) (s2-0 (+ s3-0 -1)) (s1-0 *lightning-gcf*) (s0-0 (-> sv-16 camera-rot)) + (sv-32 (lookup-texture-by-id (-> arg1 spec texture))) + (sv-48 (-> arg1 state line)) + (sv-24 (-> arg1 spec)) ) - (set! sv-32 (lookup-texture-by-id (-> arg1 spec texture))) - (set! sv-48 (-> arg1 state line)) - (set! sv-24 (-> arg1 spec)) (when (< 1 s3-0) - (set! sv-64 0) - (while (< sv-64 2) - (set! sv-28 (/ 1.0 (the float s2-0))) - (cond - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf0)) - (set! sv-80 0) - (while (< sv-80 (* s3-0 2)) - (cond - ((not (logtest? sv-80 1)) - (gs-packed-rgba-lerp! - (-> sv-20 sv-80 clr) - (-> arg1 state start-color) - (-> arg1 state end-color) - (* (the float (/ sv-80 2)) sv-28) - ) - (let ((v1-25 (-> sv-20 sv-80))) - (set! (-> v1-25 tex x) 0) - (set! (-> v1-25 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-25 tex z) 4096) - (set! (-> v1-25 tex w) 0) - ) - ) - (else - (gs-packed-rgba-lerp! - (-> sv-20 sv-80 clr) - (-> arg1 state start-color) - (-> arg1 state end-color) - (* (the float (/ sv-80 2)) sv-28) - ) - (let ((v1-35 (-> sv-20 sv-80))) - (set! (-> v1-35 tex x) 4096) - (set! (-> v1-35 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) - (set! (-> v1-35 tex z) 4096) - (set! (-> v1-35 tex w) 0) + (let ((sv-64 0)) + (while (< sv-64 2) + (let ((sv-28 (/ 1.0 (the float s2-0)))) + (cond + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf0)) + (let ((sv-80 0)) + (while (< sv-80 (* s3-0 2)) + (cond + ((not (logtest? sv-80 1)) + (gs-packed-rgba-lerp! + (-> sv-20 sv-80 clr) + (-> arg1 state start-color) + (-> arg1 state end-color) + (* (the float (/ sv-80 2)) sv-28) + ) + (let ((v1-25 (-> sv-20 sv-80))) + (set! (-> v1-25 tex x) 0) + (set! (-> v1-25 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-25 tex z) 4096) + (set! (-> v1-25 tex w) 0) + ) + ) + (else + (gs-packed-rgba-lerp! + (-> sv-20 sv-80 clr) + (-> arg1 state start-color) + (-> arg1 state end-color) + (* (the float (/ sv-80 2)) sv-28) + ) + (let ((v1-35 (-> sv-20 sv-80))) + (set! (-> v1-35 tex x) 4096) + (set! (-> v1-35 tex y) (* (/ 4096 s3-0) (/ sv-80 2))) + (set! (-> v1-35 tex z) 4096) + (set! (-> v1-35 tex w) 0) + ) + ) + ) + (+! sv-80 1) ) ) ) - (set! sv-80 (+ sv-80 1)) - ) - ) - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) - (dotimes (v1-45 (* s3-0 2)) - (cond - ((not (logtest? v1-45 1)) - (let ((a0-26 (-> sv-20 v1-45))) - (set! (-> a0-26 tex x) 0) - (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) - (set! (-> a0-26 tex z) 4096) - (set! (-> a0-26 tex w) 0) - ) - ) - (else - (let ((a0-30 (-> sv-20 v1-45))) - (set! (-> a0-30 tex x) 4096) - (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) - (set! (-> a0-30 tex z) 4096) - (set! (-> a0-30 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf1)) + (dotimes (v1-45 (* s3-0 2)) + (cond + ((not (logtest? v1-45 1)) + (let ((a0-26 (-> sv-20 v1-45))) + (set! (-> a0-26 tex x) 0) + (set! (-> a0-26 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) + (set! (-> a0-26 tex z) 4096) + (set! (-> a0-26 tex w) 0) + ) + ) + (else + (let ((a0-30 (-> sv-20 v1-45))) + (set! (-> a0-30 tex x) 4096) + (set! (-> a0-30 tex y) (* (/ 4096 s3-0) (/ v1-45 2))) + (set! (-> a0-30 tex z) 4096) + (set! (-> a0-30 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-48 (* s2-0 2)) + (set! (-> sv-20 v1-48 clr x) (the-as int (-> arg1 state start-color r))) + (set! (-> sv-20 v1-48 clr y) (the-as int (-> arg1 state start-color g))) + (set! (-> sv-20 v1-48 clr z) (the-as int (-> arg1 state start-color b))) + (set! (-> sv-20 v1-48 clr w) (the-as int (-> arg1 state start-color a))) + ) + (dotimes (v1-51 2) + (let ((a0-45 (+ v1-51 (* s2-0 2)))) + (set! (-> sv-20 a0-45 clr x) (the-as int (-> arg1 state end-color r))) + (set! (-> sv-20 a0-45 clr y) (the-as int (-> arg1 state end-color g))) + (set! (-> sv-20 a0-45 clr z) (the-as int (-> arg1 state end-color b))) + (set! (-> sv-20 a0-45 clr w) (the-as int (-> arg1 state end-color a))) ) ) ) - ) - (dotimes (v1-48 (* s2-0 2)) - (set! (-> sv-20 v1-48 clr x) (the-as int (-> arg1 state start-color r))) - (set! (-> sv-20 v1-48 clr y) (the-as int (-> arg1 state start-color g))) - (set! (-> sv-20 v1-48 clr z) (the-as int (-> arg1 state start-color b))) - (set! (-> sv-20 v1-48 clr w) (the-as int (-> arg1 state start-color a))) - ) - (dotimes (v1-51 2) - (let ((a0-45 (+ v1-51 (* s2-0 2)))) - (set! (-> sv-20 a0-45 clr x) (the-as int (-> arg1 state end-color r))) - (set! (-> sv-20 a0-45 clr y) (the-as int (-> arg1 state end-color g))) - (set! (-> sv-20 a0-45 clr z) (the-as int (-> arg1 state end-color b))) - (set! (-> sv-20 a0-45 clr w) (the-as int (-> arg1 state end-color a))) - ) - ) - ) - ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf2)) - (dotimes (v1-58 (* s3-0 2)) - (cond - ((not (logtest? v1-58 1)) - (let ((a0-52 (-> sv-20 v1-58))) - (set! (-> a0-52 tex x) 0) - (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) - (set! (-> a0-52 tex z) 4096) - (set! (-> a0-52 tex w) 0) - ) - ) - (else - (let ((a0-56 (-> sv-20 v1-58))) - (set! (-> a0-56 tex x) 4096) - (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) - (set! (-> a0-56 tex z) 4096) - (set! (-> a0-56 tex w) 0) + ((logtest? (-> sv-24 flags) (lightning-spec-flags lsf2)) + (dotimes (v1-58 (* s3-0 2)) + (cond + ((not (logtest? v1-58 1)) + (let ((a0-52 (-> sv-20 v1-58))) + (set! (-> a0-52 tex x) 0) + (set! (-> a0-52 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) + (set! (-> a0-52 tex z) 4096) + (set! (-> a0-52 tex w) 0) + ) + ) + (else + (let ((a0-56 (-> sv-20 v1-58))) + (set! (-> a0-56 tex x) 4096) + (set! (-> a0-56 tex y) (* (/ 4096 s3-0) (/ v1-58 2))) + (set! (-> a0-56 tex z) 4096) + (set! (-> a0-56 tex w) 0) + ) + ) + ) + ) + (dotimes (v1-61 (* (+ s3-0 -2) 2)) + (let ((a0-58 (+ v1-61 2))) + (set! (-> sv-20 a0-58 clr x) (the-as int (-> arg1 state start-color r))) + (set! (-> sv-20 a0-58 clr y) (the-as int (-> arg1 state start-color g))) + (set! (-> sv-20 a0-58 clr z) (the-as int (-> arg1 state start-color b))) + (set! (-> sv-20 a0-58 clr w) (the-as int (-> arg1 state start-color a))) + ) + ) + (dotimes (v1-64 2) + (let ((a0-63 v1-64)) + (set! (-> sv-20 a0-63 clr x) (the-as int (-> arg1 state end-color r))) + (set! (-> sv-20 a0-63 clr y) (the-as int (-> arg1 state end-color g))) + (set! (-> sv-20 a0-63 clr z) (the-as int (-> arg1 state end-color b))) + (set! (-> sv-20 a0-63 clr w) (the-as int (-> arg1 state end-color a))) + ) + ) + (dotimes (v1-67 2) + (let ((a0-67 (+ v1-67 (* s2-0 2)))) + (set! (-> sv-20 a0-67 clr x) (the-as int (-> arg1 state end-color r))) + (set! (-> sv-20 a0-67 clr y) (the-as int (-> arg1 state end-color g))) + (set! (-> sv-20 a0-67 clr z) (the-as int (-> arg1 state end-color b))) + (set! (-> sv-20 a0-67 clr w) (the-as int (-> arg1 state end-color a))) ) ) ) - ) - (dotimes (v1-61 (* (+ s3-0 -2) 2)) - (let ((a0-58 (+ v1-61 2))) - (set! (-> sv-20 a0-58 clr x) (the-as int (-> arg1 state start-color r))) - (set! (-> sv-20 a0-58 clr y) (the-as int (-> arg1 state start-color g))) - (set! (-> sv-20 a0-58 clr z) (the-as int (-> arg1 state start-color b))) - (set! (-> sv-20 a0-58 clr w) (the-as int (-> arg1 state start-color a))) - ) - ) - (dotimes (v1-64 2) - (let ((a0-63 v1-64)) - (set! (-> sv-20 a0-63 clr x) (the-as int (-> arg1 state end-color r))) - (set! (-> sv-20 a0-63 clr y) (the-as int (-> arg1 state end-color g))) - (set! (-> sv-20 a0-63 clr z) (the-as int (-> arg1 state end-color b))) - (set! (-> sv-20 a0-63 clr w) (the-as int (-> arg1 state end-color a))) - ) - ) - (dotimes (v1-67 2) - (let ((a0-67 (+ v1-67 (* s2-0 2)))) - (set! (-> sv-20 a0-67 clr x) (the-as int (-> arg1 state end-color r))) - (set! (-> sv-20 a0-67 clr y) (the-as int (-> arg1 state end-color g))) - (set! (-> sv-20 a0-67 clr z) (the-as int (-> arg1 state end-color b))) - (set! (-> sv-20 a0-67 clr w) (the-as int (-> arg1 state end-color a))) - ) - ) - ) - ) - (let ((f0-8 (-> sv-24 radius)) - (f1-4 0.5) - (v1-73 (the-as object (&-> (the-as (inline-array vector) sv-48) 0 w))) - (a0-71 (the-as object (-> sv-20 0))) - (a1-82 (the-as object (-> sv-20 1))) ) - 1 - (.lvf vf1 (&-> s0-0 quad 0)) - (.lvf vf2 (&-> s0-0 quad 1)) - (.lvf vf3 (&-> s0-0 quad 2)) - (.lvf vf4 (&-> s0-0 trans quad)) - (let ((a2-44 f0-8)) - (.mov vf8 a2-44) ) - (let ((a2-45 f1-4)) - (.mov vf17 a2-45) - ) - (.add.x.vf.y vf17 vf0 vf8) - (.add.w.vf.z vf17 vf0 vf0) - (.add.w.vf.z vf17 vf17 vf0) - (dotimes (a2-46 s3-0) - (.lvf vf8 (&-> (the-as (inline-array vector) v1-73) 0 quad)) - (.mul.w.vf.xyz acc vf4 vf0) - (.add.mul.x.vf.xyz acc vf1 vf8 acc) - (.add.mul.y.vf.xyz acc vf2 vf8 acc) - (.add.mul.z.vf.xyz vf8 vf3 vf8 acc) - (.add.x.vf vf6 vf8 vf0) - (b! (zero? sv-64) cfg-44 :delay (.add.x.vf vf7 vf8 vf0)) - (.add.y.vf.y vf6 vf6 vf17) - (b! #t cfg-45 :delay (.sub.y.vf.y vf7 vf7 vf17)) - (label cfg-44) - (.add.y.vf.x vf6 vf6 vf17) - (.sub.y.vf.x vf7 vf7 vf17) - (label cfg-45) - (.svf (&-> (the-as (pointer uint128) a1-82) 2) vf6) - (.svf (&-> (the-as (pointer uint128) a0-71) 2) vf7) - (set! a1-82 (&+ (the-as pointer a1-82) 96)) - (set! a0-71 (&+ (the-as pointer a0-71) 96)) - (.add.x.vf vf9 vf8 vf0) - (set! v1-73 (-> (the-as (inline-array vector) v1-73) 1)) - ) - ) - (set! sv-96 s2-0) - (set! sv-112 0) - (while (> sv-96 0) - (if (< 40 sv-96) - (set! sv-128 40) - (set! sv-128 sv-96) + (let ((f0-8 (-> sv-24 radius)) + (f1-4 0.5) + (v1-73 (the-as object (&-> (the-as (inline-array vector) sv-48) 0 w))) + (a0-71 (the-as object (-> sv-20 0))) + (a1-82 (the-as object (-> sv-20 1))) + ) + 1 + (.lvf vf1 (&-> s0-0 quad 0)) + (.lvf vf2 (&-> s0-0 quad 1)) + (.lvf vf3 (&-> s0-0 quad 2)) + (.lvf vf4 (&-> s0-0 trans quad)) + (let ((a2-44 f0-8)) + (.mov vf8 a2-44) ) - (set! sv-144 (+ sv-128 1)) - (set! sv-160 12) - (let* ((v1-83 arg0) - (a0-73 (the-as object (-> v1-83 base))) - ) - (set! (-> (the-as dma-packet a0-73) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc sv-160)) - (set! (-> (the-as dma-packet a0-73) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-73) vif1) - (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 gcf-buf) 54) 54) :num sv-160) - ) - (set! (-> v1-83 base) (the-as pointer (&+ (the-as dma-packet a0-73) 16))) - ) - (set! sv-176 (the-as gcf-control (-> arg0 base))) - (let* ((v1-86 (-> sv-176 matrix)) - (a3-31 (-> sv-16 perspective)) - (a0-76 (-> a3-31 quad 0)) - (a1-88 (-> a3-31 quad 1)) - (a2-58 (-> a3-31 quad 2)) - (a3-32 (-> a3-31 trans quad)) - ) - (set! (-> v1-86 quad 0) a0-76) - (set! (-> v1-86 quad 1) a1-88) - (set! (-> v1-86 quad 2) a2-58) - (set! (-> v1-86 trans quad) a3-32) - ) - (quad-copy! (the-as pointer (-> sv-176 giftag)) (the-as pointer (-> s1-0 giftag)) 3) - (set! (-> sv-176 giftag num-strips) (the-as uint 1)) - (set! (-> sv-176 num-dps) (the-as uint (* sv-144 2))) - (set! (-> sv-176 kick-offset) (the-as uint 0)) - (adgif-shader<-texture-simple! (-> sv-176 shader 0 shader) sv-32) - (adgif-shader-update! (-> sv-176 shader 0 shader) sv-32) - (set! (-> sv-176 shader 0 shader alpha) (new 'static 'gs-alpha :b #x2 :d #x1 :fix #x80)) - (set! (-> sv-176 shader 0 shader tex0 tfx) 0) - (set! (-> sv-176 shader 0 pos) (the-as uint 0)) - (set! (-> sv-176 shader 0 num) (the-as uint (+ #x8000 (* sv-144 2)))) - (&+! (-> arg0 base) (* sv-160 16)) - (let* ((v1-104 arg0) - (a0-90 (the-as object (-> v1-104 base))) - ) - (set! (-> (the-as dma-packet a0-90) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 6 sv-144))) - (set! (-> (the-as dma-packet a0-90) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-90) vif1) - (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 vtx-buf) 54) 54) :num (* 6 sv-144)) - ) - (set! (-> v1-104 base) (the-as pointer (&+ (the-as dma-packet a0-90) 16))) - ) - (quad-copy! (-> arg0 base) (the-as pointer (-> sv-20 sv-112)) (* 6 sv-144)) - (&+! (-> arg0 base) (* 96 sv-144)) - (let* ((v1-109 arg0) - (a0-95 (the-as object (-> v1-109 base))) - ) - (set! (-> (the-as dma-packet a0-95) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) - (set! (-> (the-as dma-packet a0-95) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-95) vif1) (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1)) - (set! (-> v1-109 base) (the-as pointer (&+ (the-as dma-packet a0-95) 16))) - ) - (set! (-> arg2 gcf-buf) (- 1704 (the-as int (-> arg2 gcf-buf)))) - (+! (-> arg2 vtx-buf) 279) - (if (< (the-as uint 567) (-> arg2 vtx-buf)) - (set! (-> arg2 vtx-buf) (the-as uint 9)) + (let ((a2-45 f1-4)) + (.mov vf17 a2-45) ) - (set! sv-96 (- sv-96 sv-128)) - (set! sv-112 (+ sv-112 (* sv-128 2))) - sv-112 + (.add.x.vf.y vf17 vf0 vf8) + (.add.w.vf.z vf17 vf0 vf0) + (.add.w.vf.z vf17 vf17 vf0) + (dotimes (a2-46 s3-0) + (.lvf vf8 (&-> (the-as (inline-array vector) v1-73) 0 quad)) + (.mul.w.vf.xyz acc vf4 vf0) + (.add.mul.x.vf.xyz acc vf1 vf8 acc) + (.add.mul.y.vf.xyz acc vf2 vf8 acc) + (.add.mul.z.vf.xyz vf8 vf3 vf8 acc) + (.add.x.vf vf6 vf8 vf0) + (b! (zero? sv-64) cfg-44 :delay (.add.x.vf vf7 vf8 vf0)) + (.add.y.vf.y vf6 vf6 vf17) + (b! #t cfg-45 :delay (.sub.y.vf.y vf7 vf7 vf17)) + (label cfg-44) + (.add.y.vf.x vf6 vf6 vf17) + (.sub.y.vf.x vf7 vf7 vf17) + (label cfg-45) + (.svf (&-> (the-as (pointer uint128) a1-82) 2) vf6) + (.svf (&-> (the-as (pointer uint128) a0-71) 2) vf7) + (set! a1-82 (&+ (the-as pointer a1-82) 96)) + (set! a0-71 (&+ (the-as pointer a0-71) 96)) + (.add.x.vf vf9 vf8 vf0) + (set! v1-73 (-> (the-as (inline-array vector) v1-73) 1)) + ) + ) + (let ((sv-96 s2-0) + (sv-112 0) + ) + (while (> sv-96 0) + (set! sv-128 (cond + ((< 40 sv-96) + (set! sv-128 40) + sv-128 + ) + (else + sv-96 + ) + ) + ) + (let ((sv-144 (+ sv-128 1))) + (let ((sv-160 12)) + (let* ((v1-83 arg0) + (a0-73 (the-as object (-> v1-83 base))) + ) + (set! (-> (the-as dma-packet a0-73) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc sv-160)) + (set! (-> (the-as dma-packet a0-73) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-73) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 gcf-buf) 54) 54) :num sv-160) + ) + (set! (-> v1-83 base) (the-as pointer (&+ (the-as dma-packet a0-73) 16))) + ) + (let ((sv-176 (the-as gcf-control (-> arg0 base)))) + (let* ((v1-86 (-> sv-176 matrix)) + (a3-31 (-> sv-16 perspective)) + (a0-76 (-> a3-31 quad 0)) + (a1-88 (-> a3-31 quad 1)) + (a2-58 (-> a3-31 quad 2)) + (a3-32 (-> a3-31 trans quad)) + ) + (set! (-> v1-86 quad 0) a0-76) + (set! (-> v1-86 quad 1) a1-88) + (set! (-> v1-86 quad 2) a2-58) + (set! (-> v1-86 trans quad) a3-32) + ) + (quad-copy! (the-as pointer (-> sv-176 giftag)) (the-as pointer (-> s1-0 giftag)) 3) + (set! (-> sv-176 giftag num-strips) (the-as uint 1)) + (set! (-> sv-176 num-dps) (the-as uint (* sv-144 2))) + (set! (-> sv-176 kick-offset) (the-as uint 0)) + (adgif-shader<-texture-simple! (-> sv-176 shader 0 shader) sv-32) + (adgif-shader-update! (-> sv-176 shader 0 shader) sv-32) + (set! (-> sv-176 shader 0 shader alpha) (new 'static 'gs-alpha :b #x2 :d #x1 :fix #x80)) + (set! (-> sv-176 shader 0 shader tex0 tfx) 0) + (set! (-> sv-176 shader 0 pos) (the-as uint 0)) + (set! (-> sv-176 shader 0 num) (the-as uint (+ #x8000 (* sv-144 2)))) + ) + (&+! (-> arg0 base) (* sv-160 16)) + ) + (let* ((v1-104 arg0) + (a0-90 (the-as object (-> v1-104 base))) + ) + (set! (-> (the-as dma-packet a0-90) dma) (new 'static 'dma-tag :id (dma-tag-id cnt) :qwc (* 6 sv-144))) + (set! (-> (the-as dma-packet a0-90) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-90) vif1) + (new 'static 'vif-tag :cmd (vif-cmd unpack-v4-32) :imm (shr (shl (-> arg2 vtx-buf) 54) 54) :num (* 6 sv-144)) + ) + (set! (-> v1-104 base) (the-as pointer (&+ (the-as dma-packet a0-90) 16))) + ) + (quad-copy! (-> arg0 base) (the-as pointer (-> sv-20 sv-112)) (* 6 sv-144)) + (&+! (-> arg0 base) (* 96 sv-144)) + ) + (let* ((v1-109 arg0) + (a0-95 (the-as object (-> v1-109 base))) + ) + (set! (-> (the-as dma-packet a0-95) dma) (new 'static 'dma-tag :id (dma-tag-id cnt))) + (set! (-> (the-as dma-packet a0-95) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet a0-95) vif1) (new 'static 'vif-tag :imm #x6 :cmd (vif-cmd mscal) :msk #x1)) + (set! (-> v1-109 base) (the-as pointer (&+ (the-as dma-packet a0-95) 16))) + ) + (set! (-> arg2 gcf-buf) (- 1704 (the-as int (-> arg2 gcf-buf)))) + (+! (-> arg2 vtx-buf) 279) + (if (< (the-as uint 567) (-> arg2 vtx-buf)) + (set! (-> arg2 vtx-buf) (the-as uint 9)) + ) + (set! sv-96 (- sv-96 sv-128)) + (+! sv-112 (* sv-128 2)) + sv-112 + ) + ) + (+! sv-64 1) ) - (set! sv-64 (+ sv-64 1)) ) #f ) diff --git a/test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc b/test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc index c5936e941e..cb094ce636 100644 --- a/test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/foreground/ripple_REF.gc @@ -183,9 +183,9 @@ ;; definition for function ripple-find-height (defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector)) - (local-vars (sv-16 draw-control) (sv-32 float) (sv-48 float)) - (let ((f30-0 (-> arg0 root trans y))) - (set! sv-16 (-> arg0 draw)) + (let ((f30-0 (-> arg0 root trans y)) + (sv-16 (-> arg0 draw)) + ) (if (or (zero? sv-16) (not (-> sv-16 ripple))) (return f30-0) ) @@ -219,20 +219,18 @@ (let* ((f22-1 (the float (the int f28-1))) (f24-1 (the float (the int f26-1))) (f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1)) + (sv-32 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) + (sv-48 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) + (f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) + (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-32 f20-0)))) + (f1-9 (+ sv-48 (* (- f28-1 f22-1) (- f1-6 sv-48)))) + (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) + (f0-23 (-> gp-0 faded-scale)) ) - (set! sv-32 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1)) - (set! sv-48 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1))) - (let* ((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1))) - (f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-32 f20-0)))) - (f1-9 (+ sv-48 (* (- f28-1 f22-1) (- f1-6 sv-48)))) - (f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22)))) - (f0-23 (-> gp-0 faded-scale)) - ) - (if (< f0-23 0.0) - (set! f0-23 (-> gp-0 global-scale)) - ) - (+ f30-0 (* (/ f1-12 128) f0-23)) - ) + (if (< f0-23 0.0) + (set! f0-23 (-> gp-0 global-scale)) + ) + (+ f30-0 (* (/ f1-12 128) f0-23)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc b/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc index a9d08c29d5..c25b47707b 100644 --- a/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/math-camera_REF.gc @@ -54,7 +54,6 @@ Without this corrector, the fogginess of the world would change as the FOV chang (defun update-math-camera ((arg0 math-camera) (arg1 symbol) (arg2 symbol) (arg3 float)) "Compute some one-time camera constants. These should only change when changing aspect ratio." - (local-vars (sv-16 float)) (set! (-> arg0 x-ratio) (tan (/ arg3 2))) (if (= arg2 'aspect4x3) (set! (-> arg0 y-ratio) (* 0.75 (-> arg0 x-ratio))) @@ -64,26 +63,24 @@ Without this corrector, the fogginess of the world would change as the FOV chang (f0-7 (-> arg0 y-ratio)) (v1-6 (-> arg0 cull-info)) ) - (/ (+ 1.0 (* 4.0 f1-3 f1-3)) (+ 1.0 (* f1-3 f1-3))) - (let ((f2-5 (/ (+ 1.0 (* 4.0 f0-7 f0-7)) (+ 1.0 (* f0-7 f0-7))))) + (/ (+ 1.0 (* 4.0 f1-3 f1-3)) (+ 1.0 (square f1-3))) + (let ((f2-5 (/ (+ 1.0 (* 4.0 f0-7 f0-7)) (+ 1.0 (square f0-7))))) (set! (-> v1-6 x-fact) (/ (+ 1.0 (* 4.0 f1-3 f1-3)) (* f1-3 (sqrtf (+ 1.0 (* 16.0 f1-3 f1-3)))))) (set! (-> v1-6 y-fact) (/ (+ 1.0 (* 4.0 f0-7 f0-7)) (* f0-7 (sqrtf (+ 1.0 (* 16.0 f0-7 f0-7)))))) (set! (-> v1-6 z-fact) (sqrtf (+ (* (+ -4.0 f2-5) (+ -4.0 f2-5) f0-7 f0-7) (* (+ -1.0 f2-5) (+ -1.0 f2-5))))) ) - (let* ((f2-11 (* f1-3 (-> arg0 d))) - (f1-5 (* f0-7 (-> arg0 d))) - (f0-10 (+ (* f2-11 f2-11) (* f1-5 f1-5))) - (f1-8 (-> arg0 d)) - ) - (set! (-> v1-6 cam-radius) (sqrtf (+ f0-10 (* f1-8 f1-8)))) + (let ((f2-11 (* f1-3 (-> arg0 d))) + (f1-5 (* f0-7 (-> arg0 d))) + ) + (set! (-> v1-6 cam-radius) (sqrtf (+ (square f2-11) (square f1-5) (square (-> arg0 d))))) ) (let* ((f1-12 (* (-> arg0 d) (-> arg0 x-ratio))) (f0-14 (-> arg0 d)) (f2-13 (* 4.0 f1-12)) (f3-21 (-> arg0 d)) ) - (let ((f4-21 (/ 1.0 (sqrtf (+ (* f1-12 f1-12) (* f0-14 f0-14))))) - (f5-11 (/ 1.0 (sqrtf (+ (* f2-13 f2-13) (* f3-21 f3-21))))) + (let ((f4-21 (/ 1.0 (sqrtf (+ (square f1-12) (square f0-14))))) + (f5-11 (/ 1.0 (sqrtf (+ (square f2-13) (square f3-21))))) ) (set! (-> v1-6 xz-dir-ax) (* f1-12 f4-21)) (set! (-> v1-6 xz-dir-az) (* f0-14 f4-21)) @@ -97,8 +94,8 @@ Without this corrector, the fogginess of the world would change as the FOV chang (f2-15 (* 4.0 f1-15)) (f3-22 (-> arg0 d)) ) - (let ((f4-26 (/ 1.0 (sqrtf (+ (* f1-15 f1-15) (* f0-18 f0-18))))) - (f5-16 (/ 1.0 (sqrtf (+ (* f2-15 f2-15) (* f3-22 f3-22))))) + (let ((f4-26 (/ 1.0 (sqrtf (+ (square f1-15) (square f0-18))))) + (f5-16 (/ 1.0 (sqrtf (+ (square f2-15) (square f3-22))))) ) (set! (-> v1-6 yz-dir-ay) (* f1-15 f4-26)) (set! (-> v1-6 yz-dir-az) (* f0-18 f4-26)) @@ -157,12 +154,12 @@ Without this corrector, the fogginess of the world would change as the FOV chang (a0-36 (-> *screen-shot-work* size)) (f0-34 (the float a0-36)) (f20-0 (/ (the float (mod v1-32 a0-36)) f0-34)) + (sv-16 (/ (the float (/ v1-32 a0-36)) f0-34)) ) - (set! sv-16 (/ (the float (/ v1-32 a0-36)) f0-34)) (format 0 "~f ~f~%" f20-0 sv-16) (set! (-> arg0 hvdf-off x) (- f24-0 f20-0)) + (set! (-> arg0 hvdf-off y) (- f26-0 sv-16)) ) - (set! (-> arg0 hvdf-off y) (- f26-0 sv-16)) ) ) (set! (-> arg0 hvdf-off z) f22-0) diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc index b0d22686eb..3533bc3b70 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/mood-funcs2_REF.gc @@ -2313,7 +2313,6 @@ ;; definition for function update-under-lights ;; INFO: Used lq/sq (defun update-under-lights ((arg0 mood-context)) - (local-vars (sv-80 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2346,28 +2345,27 @@ (s5-0 (-> arg0 light-group 3)) (gp-1 (-> arg0 light-group 4)) ) - (let ((s1-0 (new 'static 'vector :x 0.8645 :z -0.5294))) - (set! sv-80 (new 'static 'vector :x -2.0 :z 1950.0)) - (let ((v0-1 (target-pos 0)) - (s0-0 (new 'stack-no-clear 'vector)) - ) - (let ((v1-10 s0-0)) - (.lvf vf4 (&-> v0-1 quad)) - (.lvf vf5 (&-> sv-80 quad)) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-10 quad) vf6) + (let ((s1-0 (new 'static 'vector :x 0.8645 :z -0.5294)) + (sv-80 (new 'static 'vector :x -2.0 :z 1950.0)) + (v0-1 (target-pos 0)) + (s0-0 (new 'stack-no-clear 'vector)) ) - (vector-normalize! s0-0 1.0) - (cond - ((>= (vector-dot s1-0 s0-0) 0.0) - (set-vector! (-> s2-0 0 dir0 color) 0.6 0.5 0.7 1.0) - (set-vector! (-> s2-0 0 ambi color) 0.3 0.3 0.3 1.0) - ) - (else - (set-vector! (-> s2-0 0 dir0 color) 0.2 0.2 0.4 1.0) - (set-vector! (-> s2-0 0 ambi color) 0.2 0.2 0.2 1.0) - ) + (let ((v1-10 s0-0)) + (.lvf vf4 (&-> v0-1 quad)) + (.lvf vf5 (&-> sv-80 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-10 quad) vf6) + ) + (vector-normalize! s0-0 1.0) + (cond + ((>= (vector-dot s1-0 s0-0) 0.0) + (set-vector! (-> s2-0 0 dir0 color) 0.6 0.5 0.7 1.0) + (set-vector! (-> s2-0 0 ambi color) 0.3 0.3 0.3 1.0) + ) + (else + (set-vector! (-> s2-0 0 dir0 color) 0.2 0.2 0.4 1.0) + (set-vector! (-> s2-0 0 ambi color) 0.2 0.2 0.2 1.0) ) ) ) @@ -2750,7 +2748,6 @@ ;; ERROR: Stack slot load at 32 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defbehavior update-mood-dig1 time-of-day-proc ((arg0 mood-context)) - (local-vars (sv-16 float) (sv-32 float)) (update-mood-interior arg0) (update-dig1-lights arg0) (cond @@ -2761,31 +2758,15 @@ (let ((gp-0 (the-as dig1-states (-> arg0 state)))) (set! (-> arg0 times 0 w) 1.0) (set! (-> arg0 times 1 w) 1.0) - (let ((s4-0 update-mood-pulse) - (s3-0 arg0) - (s2-0 2) - (s1-0 0) - (s0-0 0.85) - ) - (set! sv-16 0.15) - (let ((t1-0 (* 182.04445 (seconds-per-frame) (rand-vu-float-range 60.0 200.0))) - (t2-0 0.0) - ) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0 t2-0) - ) - ) - (let ((s4-1 update-mood-pulse) - (s3-1 arg0) - (s2-1 3) - (s1-1 4) - (s0-1 0.85) - ) - (set! sv-32 0.15) - (let ((t1-1 (* 182.04445 (seconds-per-frame) (rand-vu-float-range 120.0 180.0))) - (t2-1 16384.0) - ) - (s4-1 s3-1 s2-1 s1-1 s0-1 sv-32 t1-1 t2-1) - ) + (update-mood-pulse arg0 2 0 0.85 0.15 (* 182.04445 (seconds-per-frame) (rand-vu-float-range 60.0 200.0)) 0.0) + (update-mood-pulse + arg0 + 3 + 4 + 0.85 + 0.15 + (* 182.04445 (seconds-per-frame) (rand-vu-float-range 120.0 180.0)) + 16384.0 ) (set! (-> arg0 times 6 w) 1.0) (if (not (task-node-closed? (game-task-node dig-knock-down-resolution))) diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc index 8cf69b0eee..db606a08c3 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/mood_REF.gc @@ -427,7 +427,7 @@ ;; definition for function update-mood-exterior ;; INFO: Used lq/sq (defun update-mood-exterior ((arg0 mood-context-core3) (arg1 mood-table) (arg2 float) (arg3 int)) - (local-vars (v0-1 object) (sv-32 mood-color) (sv-48 mood-color) (sv-64 vector)) + (local-vars (v0-1 object)) (cond ((< (the-as uint 8) (the-as uint (-> *time-of-day-context* mode))) (palette-select-special arg0) @@ -475,18 +475,18 @@ (mem-copy! (the-as pointer (-> arg0 current-fog)) (the-as pointer (-> arg1 mood-fog-table data s3-0)) 48) ) (else - (set! sv-32 (-> arg1 mood-color-table data s3-0)) - (set! sv-48 (-> arg1 mood-color-table data s2-0)) - (let ((s1-0 (-> arg0 times))) - (set! sv-64 (-> arg0 times 1)) - (let ((s0-0 (-> arg0 light-group))) - (vector4-lerp! (-> s1-0 0) (-> sv-32 amb-color) (-> sv-48 amb-color) f30-0) - (vector4-lerp! sv-64 (-> sv-32 lgt-color) (-> sv-48 lgt-color) f30-0) - (set! (-> arg0 times 2 quad) (-> sv-64 quad)) - (set! (-> arg0 times 3 quad) (-> sv-64 quad)) - (set! (-> arg0 times 4 quad) (-> sv-64 quad)) - (set! (-> s0-0 0 ambi color quad) (-> s1-0 0 quad)) - ) + (let ((sv-32 (-> arg1 mood-color-table data s3-0)) + (sv-48 (-> arg1 mood-color-table data s2-0)) + (s1-0 (-> arg0 times)) + (sv-64 (-> arg0 times 1)) + (s0-0 (-> arg0 light-group)) + ) + (vector4-lerp! (-> s1-0 0) (-> sv-32 amb-color) (-> sv-48 amb-color) f30-0) + (vector4-lerp! sv-64 (-> sv-32 lgt-color) (-> sv-48 lgt-color) f30-0) + (set! (-> arg0 times 2 quad) (-> sv-64 quad)) + (set! (-> arg0 times 3 quad) (-> sv-64 quad)) + (set! (-> arg0 times 4 quad) (-> sv-64 quad)) + (set! (-> s0-0 0 ambi color quad) (-> s1-0 0 quad)) ) (vector4-lerp! (-> arg0 current-sky-color) diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-mid_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-mid_REF.gc index 8fcc1e091e..d6bb200e82 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-mid_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-mid_REF.gc @@ -545,9 +545,8 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod ocean-mid-add-upload ((this ocean) (arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 float)) - (local-vars (sv-32 int)) - (set! sv-32 arg1) - (let ((s0-0 arg2) + (let ((sv-32 arg1) + (s0-0 arg2) (s1-0 arg3) (s4-0 arg4) (s2-0 arg5) @@ -1023,42 +1022,43 @@ ;; definition for method 58 of type ocean ;; WARN: Return type mismatch int vs none. (defmethod draw-ocean-mid-seams ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) (ocean-seams-add-constants this arg0) - (set! sv-32 (-> this mid-minx)) - (set! sv-33 (-> this mid-maxx)) - (set! sv-34 (-> this mid-minz)) - (set! sv-35 (-> this mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> this start-corner y)) - (set! (-> sv-36 r) 278045.7) - (let ((s4-0 sv-34) - (s3-0 sv-35) + (let ((sv-32 (-> this mid-minx)) + (sv-33 (-> this mid-maxx)) + (sv-34 (-> this mid-minz)) + (sv-35 (-> this mid-maxz)) + (sv-36 (new 'stack 'sphere)) ) - (while (>= s3-0 s4-0) - (let ((s2-0 sv-32) - (s1-0 sv-33) - ) - (while (>= s1-0 s2-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) - (when (sphere-cull sv-36) - (cond - ((= s4-0 sv-34) - (ocean-mid-add-upload-top this arg0 s4-0 s2-0) - ) - ((= s4-0 sv-35) - (ocean-mid-add-upload-bottom this arg0 s4-0 s2-0) - ) - (else - (ocean-mid-add-upload-middle this arg0 s4-0 s2-0) + (set! (-> sv-36 y) (-> this start-corner y)) + (set! (-> sv-36 r) 278045.7) + (let ((s4-0 sv-34) + (s3-0 sv-35) + ) + (while (>= s3-0 s4-0) + (let ((s2-0 sv-32) + (s1-0 sv-33) + ) + (while (>= s1-0 s2-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) + (when (sphere-cull sv-36) + (cond + ((= s4-0 sv-34) + (ocean-mid-add-upload-top this arg0 s4-0 s2-0) + ) + ((= s4-0 sv-35) + (ocean-mid-add-upload-bottom this arg0 s4-0 s2-0) + ) + (else + (ocean-mid-add-upload-middle this arg0 s4-0 s2-0) + ) ) ) + (+! s2-0 1) ) - (+! s2-0 1) ) + (+! s4-0 1) ) - (+! s4-0 1) ) ) (dotimes (v1-29 36) @@ -1074,7 +1074,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-ocean-mid ((this ocean) (arg0 dma-buffer)) - (local-vars (v1-8 float) (v1-9 float) (sv-32 int)) + (local-vars (v1-8 float) (v1-9 float)) (rlet ((vf16 :class vf) (vf17 :class vf) (vf18 :class vf) @@ -1131,22 +1131,14 @@ (dotimes (s2-0 6) (let* ((s1-0 (+ (* 6 s3-0) s2-0)) (s0-0 (-> this ocean-spheres spheres s1-0)) + (sv-32 (-> (the-as (pointer int16) (+ (* s1-0 2) (the-as int (-> this ocean-mid-indices)))))) ) - (set! sv-32 (-> (the-as (pointer int16) (+ (* s1-0 2) (the-as int (-> this ocean-mid-indices)))))) (when (sphere-cull s0-0) (cond ((< sv-32 0) ) ((let ((f30-0 (- (vector-vector-distance s0-0 s4-0) (-> s0-0 r)))) - (let ((a0-16 this) - (t9-5 (method-of-type ocean ocean-mid-add-upload)) - (a1-8 arg0) - (a2-2 s3-0) - (a3-0 s2-0) - (t2-0 f30-0) - ) - (t9-5 a0-16 a1-8 a2-2 a3-0 sv-32 s1-0 t2-0) - ) + (ocean-mid-add-upload this arg0 s3-0 s2-0 sv-32 s1-0 f30-0) (< f30-0 786432.0) ) (ocean-mid-add-call this arg0 73) diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-near_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-near_REF.gc index 7414aa3d49..67b87e978c 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-near_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-near_REF.gc @@ -665,7 +665,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-ocean-near ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-16 uint)) (dma-buffer-add-gs-set arg0 (test-1 (new 'static 'gs-test :ate #x1 :afail #x1 :zte #x1 :ztst (gs-ztest greater-equal))) ) @@ -688,8 +687,9 @@ ) (when (and (< s4-0 s3-0) (< s2-0 s1-0)) (while (>= s1-0 s2-0) - (let ((s0-0 s4-0)) - (set! sv-16 s3-0) + (let ((s0-0 s4-0) + (sv-16 s3-0) + ) (while (>= sv-16 s0-0) (when (ocean-trans-camera-masks-bit? this s2-0 s0-0) (let* ((a1-16 (- (shr s0-0 2) (-> this mid-minx))) diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-texture_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-texture_REF.gc index e832bf6e3e..64824f7395 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-texture_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-texture_REF.gc @@ -634,7 +634,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-85 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 vector4w) (sv-64 vector4w)) (dma-buffer-add-gs-set arg0 (alpha-1 (new 'static 'gs-alpha :b #x2 :d #x1))) (let ((v1-3 (-> arg0 base))) (set! (-> (the-as (pointer uint128) v1-3)) (-> this haze-tmpl dma-vif quad)) @@ -648,9 +647,10 @@ (s4-0 (-> arg0 base)) ) (dotimes (s1-0 16) - (let ((s0-0 (the-as object (-> arg0 base)))) - (set! sv-48 (-> this haze-verts (* s1-0 2))) - (set! sv-64 (-> this haze-verts (+ (* s1-0 2) 1))) + (let ((s0-0 (the-as object (-> arg0 base))) + (sv-48 (-> this haze-verts (* s1-0 2))) + (sv-64 (-> this haze-verts (+ (* s1-0 2) 1))) + ) (let ((f0-1 (+ -1024.0 (the float (-> sv-48 x)))) (f1-3 (+ -1024.0 (the float (-> sv-48 y)))) (v1-22 s2-0) @@ -787,7 +787,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-88 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 vector) (sv-64 uint) (sv-80 vector) (sv-96 vector) (sv-112 vector)) (dma-buffer-add-gs-set arg0 (test-1 (new 'static 'gs-test :ate #x1 @@ -841,34 +840,23 @@ (vector-float*! (-> s2-2 ambi-color) (-> s2-2 ambi-color) 0.25) (vector-float*! (-> s2-2 ambi-color-lower) (-> s2-2 ambi-color-lower) 0.25) (dotimes (s1-0 36) - (let ((v1-36 (-> this cloud-verts s1-0))) - (set! sv-80 (-> this cloud-nrms s1-0)) - (let ((s0-0 (-> this cloud-col0 s1-0))) - (set! sv-48 (-> this cloud-col1 s1-0)) - (set! sv-112 (-> this cloud-st0 s1-0)) - (set! sv-96 (-> this cloud-st1 s1-0)) - (set! sv-64 (-> this cloud-alpha s1-0)) + (let ((v1-36 (-> this cloud-verts s1-0)) + (sv-80 (-> this cloud-nrms s1-0)) + (s0-0 (-> this cloud-col0 s1-0)) + (sv-48 (-> this cloud-col1 s1-0)) + (sv-112 (-> this cloud-st0 s1-0)) + (sv-96 (-> this cloud-st1 s1-0)) + ) + (let ((sv-64 (-> this cloud-alpha s1-0))) (set! (-> s4-1 x) (* 0.140625 (+ -1024.0 (the float (-> v1-36 x))))) (set! (-> s4-1 z) (* 0.140625 (+ -1024.0 (the float (-> v1-36 z))))) (vector-negate! s3-1 sv-80) - (let ((a0-41 this) - (t9-3 (method-of-type ocean ocean-method-86)) - (a1-19 s0-0) - (a3-0 (-> s2-2 sun0-color)) - (t0-0 (-> s2-2 ambi-color)) - ) - (t9-3 a0-41 a1-19 sv-80 a3-0 t0-0) - ) + (ocean-method-86 this s0-0 sv-80 (-> s2-2 sun0-color) (-> s2-2 ambi-color)) (ocean-method-86 this sv-48 s3-1 (-> s2-2 sun0-color-lower) (-> s2-2 ambi-color-lower)) (set! (-> s0-0 w) (the-as float sv-64)) + (set! (-> sv-48 w) (the-as float sv-64)) ) - ) - (set! (-> sv-48 w) (the-as float sv-64)) - (let ((a0-44 this) - (t9-5 (method-of-type ocean ocean-method-87)) - (a3-2 s4-1) - ) - (t9-5 a0-44 sv-96 sv-112 a3-2) + (ocean-method-87 this sv-96 sv-112 s4-1) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-transition_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-transition_REF.gc index 76490cce42..cf05773d3c 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-transition_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean-transition_REF.gc @@ -494,21 +494,22 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod ocean-make-trans-camera-masks ((this ocean) (arg0 uint) (arg1 uint) (arg2 uint) (arg3 uint)) - (local-vars (sv-48 ocean-trans-mask) (sv-52 vector) (sv-56 vector) (sv-60 vector)) - (set! sv-48 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* arg2 4) arg3)))) - (set! sv-52 (-> *math-camera* trans)) - (set! sv-56 (new-stack-vector0)) - (set! sv-60 (new-stack-vector0)) - (set! (-> sv-56 x) (+ (-> this start-corner x) (* 393216.0 (the float arg1)))) - (set! (-> sv-56 y) (-> this start-corner y)) - (set! (-> sv-56 z) (+ (-> this start-corner z) (* 393216.0 (the float arg0)))) - (set! (-> sv-56 w) 1.0) - (dotimes (s5-0 4) - (dotimes (s4-0 4) - (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s4-0))) (-> sv-52 x))) - (set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y))) - (set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float s5-0))) (-> sv-52 z))) - (ocean-transition-check this sv-48 s4-0 s5-0 sv-56) + (let ((sv-48 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* arg2 4) arg3)))) + (sv-52 (-> *math-camera* trans)) + (sv-56 (new-stack-vector0)) + (sv-60 (new-stack-vector0)) + ) + (set! (-> sv-56 x) (+ (-> this start-corner x) (* 393216.0 (the float arg1)))) + (set! (-> sv-56 y) (-> this start-corner y)) + (set! (-> sv-56 z) (+ (-> this start-corner z) (* 393216.0 (the float arg0)))) + (set! (-> sv-56 w) 1.0) + (dotimes (s5-0 4) + (dotimes (s4-0 4) + (set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s4-0))) (-> sv-52 x))) + (set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y))) + (set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float s5-0))) (-> sv-52 z))) + (ocean-transition-check this sv-48 s4-0 s5-0 sv-56) + ) ) ) 0 @@ -644,34 +645,35 @@ ;; definition for method 38 of type ocean ;; WARN: Return type mismatch int vs none. (defmethod draw-ocean-transition-seams ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere)) - (set! sv-32 (-> this near-minx)) - (set! sv-33 (-> this near-maxx)) - (set! sv-34 (-> this near-minz)) - (set! sv-35 (-> this near-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> this start-corner y)) - (set! (-> sv-36 r) 69511.42) - (when (and (< sv-32 sv-33) (< sv-34 sv-35)) - (let ((s4-0 sv-34) - (s3-0 sv-35) - ) - (while (>= s3-0 s4-0) - (let ((s2-0 sv-32) - (s1-0 sv-33) - ) - (while (>= s1-0 s2-0) - (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s2-0)) (-> this start-corner x))) - (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s4-0)) (-> this start-corner z))) - (when (sphere-cull sv-36) - (if (not (ocean-trans-camera-masks-bit? this s4-0 s2-0)) - (ocean-trans-add-upload this arg0 s4-0 s2-0) - ) - ) - (+! s2-0 1) + (let ((sv-32 (-> this near-minx)) + (sv-33 (-> this near-maxx)) + (sv-34 (-> this near-minz)) + (sv-35 (-> this near-maxz)) + (sv-36 (new 'stack 'sphere)) + ) + (set! (-> sv-36 y) (-> this start-corner y)) + (set! (-> sv-36 r) 69511.42) + (when (and (< sv-32 sv-33) (< sv-34 sv-35)) + (let ((s4-0 sv-34) + (s3-0 sv-35) ) + (while (>= s3-0 s4-0) + (let ((s2-0 sv-32) + (s1-0 sv-33) + ) + (while (>= s1-0 s2-0) + (set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s2-0)) (-> this start-corner x))) + (set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s4-0)) (-> this start-corner z))) + (when (sphere-cull sv-36) + (if (not (ocean-trans-camera-masks-bit? this s4-0 s2-0)) + (ocean-trans-add-upload this arg0 s4-0 s2-0) + ) + ) + (+! s2-0 1) + ) + ) + (+! s4-0 1) ) - (+! s4-0 1) ) ) ) @@ -722,16 +724,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-ocean-transition ((this ocean) (arg0 dma-buffer)) - (local-vars - (sv-32 uint) - (sv-33 uint) - (sv-34 uint) - (sv-35 uint) - (sv-36 sphere) - (sv-40 ocean-trans-mask) - (sv-44 uint) - (sv-48 int) - ) (dotimes (v1-0 16) (set! (-> this trans-camera-masks v1-0) (the-as ocean-trans-mask 0)) (set! (-> this near-mask-indices v1-0) (the-as uint -1)) @@ -739,125 +731,131 @@ (dotimes (v1-3 64) (set! (-> this trans-mask-ptrs v1-3) (the-as pointer #f)) ) - (set! sv-32 (-> this mid-minx)) - (set! sv-33 (-> this mid-maxx)) - (set! sv-34 (-> this mid-minz)) - (set! sv-35 (-> this mid-maxz)) - (set! sv-36 (new 'stack 'sphere)) - (set! (-> sv-36 y) (-> this start-corner y)) - (set! (-> sv-36 r) 278045.7) - (let ((s4-0 sv-34) - (s3-0 sv-35) + (let ((sv-32 (-> this mid-minx)) + (sv-33 (-> this mid-maxx)) + (sv-34 (-> this mid-minz)) + (sv-35 (-> this mid-maxz)) ) - (while (>= s3-0 s4-0) - (let ((s2-0 sv-32) - (s1-0 sv-33) + (let ((sv-36 (new 'stack 'sphere))) + (set! (-> sv-36 y) (-> this start-corner y)) + (set! (-> sv-36 r) 278045.7) + (let ((s4-0 sv-34) + (s3-0 sv-35) ) - (while (>= s1-0 s2-0) - (when (not (ocean-mid-mask-ptrs-bit? this s4-0 s2-0)) - (when (ocean-mid-camera-masks-bit? this s4-0 s2-0) - (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) - (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) - (if (sphere-cull sv-36) - (ocean-make-trans-camera-masks this s4-0 s2-0 (- s4-0 sv-34) (- s2-0 sv-32)) - ) - ) - ) - (+! s2-0 1) - ) - ) - (+! s4-0 1) - ) - ) - (let ((a2-3 192) - (a1-7 0) - (a0-11 192) - (v1-33 0) - ) - (let ((a3-1 sv-34) - (t0-1 sv-35) - ) - (while (>= t0-1 a3-1) - (let ((t1-0 sv-32) - (t2-0 sv-33) - ) - (while (>= t2-0 t1-0) - (set! sv-40 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32))))) - (when (nonzero? (-> sv-40 word)) - (dotimes (t3-10 4) - (let ((t4-4 (-> sv-40 mask t3-10))) - (when (nonzero? t4-4) - (let ((t5-2 (+ (* a3-1 4) t3-10))) - (if (< t5-2 (the-as uint a0-11)) - (set! a0-11 (the-as int t5-2)) - ) - (if (< (the-as uint v1-33) t5-2) - (set! v1-33 (the-as int t5-2)) - ) + (while (>= s3-0 s4-0) + (let ((s2-0 sv-32) + (s1-0 sv-33) + ) + (while (>= s1-0 s2-0) + (when (not (ocean-mid-mask-ptrs-bit? this s4-0 s2-0)) + (when (ocean-mid-camera-masks-bit? this s4-0 s2-0) + (set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s2-0)) (-> this start-corner x))) + (set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s4-0)) (-> this start-corner z))) + (if (sphere-cull sv-36) + (ocean-make-trans-camera-masks this s4-0 s2-0 (- s4-0 sv-34) (- s2-0 sv-32)) ) - (dotimes (t5-3 4) - (when (logtest? t4-4 (ash 1 t5-3)) - (let ((t6-9 (+ (* t1-0 4) t5-3))) - (if (< t6-9 (the-as uint a2-3)) - (set! a2-3 (the-as int t6-9)) - ) - (if (< (the-as uint a1-7) t6-9) - (set! a1-7 (the-as int t6-9)) - ) - ) - ) - ) - ) ) ) + (+! s2-0 1) ) - (+! t1-0 1) ) + (+! s4-0 1) ) - (+! a3-1 1) ) ) - (set! (-> this near-minx) (the-as uint (+ a2-3 -1))) - (set! (-> this near-maxx) (the-as uint (+ a1-7 1))) - (set! (-> this near-minz) (the-as uint (+ a0-11 -1))) - (set! (-> this near-maxz) (the-as uint (+ v1-33 1))) - ) - (dotimes (v1-35 16) - (set! (-> this trans-temp-masks v1-35) (the-as uint (-> this trans-camera-masks v1-35))) - ) - (let ((s4-1 sv-34) - (s3-1 sv-35) - ) - (while (>= s3-1 s4-1) - (let ((s2-1 sv-32) - (s1-1 sv-33) + (let ((a2-3 192) + (a1-7 0) + (a0-11 192) + (v1-33 0) + ) + (let ((a3-1 sv-34) + (t0-1 sv-35) ) - (while (>= s1-1 s2-1) - (when (not (ocean-mid-mask-ptrs-bit? this s4-1 s2-1)) - (when (ocean-mid-camera-masks-bit? this s4-1 s2-1) - (let ((v1-46 (-> this ocean-trans-indices data (+ (* (the-as uint 48) s4-1) s2-1)))) - (when (>= (-> v1-46 parent) 0) - (set! sv-44 (+ (* (- s4-1 sv-34) 4) (- s2-1 sv-32))) - (set! (-> this near-mask-indices sv-44) (the-as uint (-> v1-46 child))) - (let ((s0-0 (-> this ocean-mid-masks data (-> v1-46 parent)))) - (set! sv-48 0) - (while (< sv-48 4) - (let ((t0-2 (-> s0-0 mask sv-48))) - (if (!= t0-2 255) - (ocean-trans-add-upload-strip this arg0 s4-1 s2-1 (the-as int t0-2) (the-as int sv-44) sv-48) + (while (>= t0-1 a3-1) + (let ((t1-0 sv-32) + (t2-0 sv-33) + ) + (while (>= t2-0 t1-0) + (let ((sv-40 (the-as ocean-trans-mask (&-> this trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)))))) + (when (nonzero? (-> sv-40 word)) + (dotimes (t3-10 4) + (let ((t4-4 (-> sv-40 mask t3-10))) + (when (nonzero? t4-4) + (let ((t5-2 (+ (* a3-1 4) t3-10))) + (if (< t5-2 (the-as uint a0-11)) + (set! a0-11 (the-as int t5-2)) + ) + (if (< (the-as uint v1-33) t5-2) + (set! v1-33 (the-as int t5-2)) + ) + ) + (dotimes (t5-3 4) + (when (logtest? t4-4 (ash 1 t5-3)) + (let ((t6-9 (+ (* t1-0 4) t5-3))) + (if (< t6-9 (the-as uint a2-3)) + (set! a2-3 (the-as int t6-9)) + ) + (if (< (the-as uint a1-7) t6-9) + (set! a1-7 (the-as int t6-9)) + ) + ) ) + ) + ) + ) + ) + ) + ) + (+! t1-0 1) + ) + ) + (+! a3-1 1) + ) + ) + (set! (-> this near-minx) (the-as uint (+ a2-3 -1))) + (set! (-> this near-maxx) (the-as uint (+ a1-7 1))) + (set! (-> this near-minz) (the-as uint (+ a0-11 -1))) + (set! (-> this near-maxz) (the-as uint (+ v1-33 1))) + ) + (dotimes (v1-35 16) + (set! (-> this trans-temp-masks v1-35) (the-as uint (-> this trans-camera-masks v1-35))) + ) + (let ((s4-1 sv-34) + (s3-1 sv-35) + ) + (while (>= s3-1 s4-1) + (let ((s2-1 sv-32) + (s1-1 sv-33) + ) + (while (>= s1-1 s2-1) + (when (not (ocean-mid-mask-ptrs-bit? this s4-1 s2-1)) + (when (ocean-mid-camera-masks-bit? this s4-1 s2-1) + (let ((v1-46 (-> this ocean-trans-indices data (+ (* (the-as uint 48) s4-1) s2-1)))) + (when (>= (-> v1-46 parent) 0) + (let ((sv-44 (+ (* (- s4-1 sv-34) 4) (- s2-1 sv-32)))) + (set! (-> this near-mask-indices sv-44) (the-as uint (-> v1-46 child))) + (let ((s0-0 (-> this ocean-mid-masks data (-> v1-46 parent))) + (sv-48 0) + ) + (while (< sv-48 4) + (let ((t0-2 (-> s0-0 mask sv-48))) + (if (!= t0-2 255) + (ocean-trans-add-upload-strip this arg0 s4-1 s2-1 (the-as int t0-2) (the-as int sv-44) sv-48) + ) + ) + (+! sv-48 1) + ) ) - (set! sv-48 (+ sv-48 1)) ) ) ) ) ) + (+! s2-1 1) ) - (+! s2-1 1) ) + (+! s4-1 1) ) - (+! s4-1 1) ) ) (ocean-mid-add-call-flush this arg0 (the-as uint 41)) diff --git a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean_REF.gc b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean_REF.gc index 2a6ce41ecb..b6b33ab71b 100644 --- a/test/decompiler/reference/jak2/engine/gfx/ocean/ocean_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/ocean/ocean_REF.gc @@ -158,7 +158,6 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-60 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) (let ((vertices (the-as (inline-array ocean-vertex) (+ #x70000000 0)))) (let ((f0-0 (-> this start-corner z))) (let ((f1-1 (+ -5898240.0 f0-0))) @@ -172,79 +171,81 @@ (set! (-> vertices 1 pos w) 0.5) (set! (-> vertices 2 pos w) 1.0) (set! (-> vertices 3 pos w) 1.0) - (set! sv-48 (-> this start-corner x)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (-> s3-0 colors)) - (dotimes (s1-0 48) - (let ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48))) - (let ((f1-6 (+ 393216.0 f0-8))) - (set! (-> vertices 0 pos x) f0-8) - (set! (-> vertices 1 pos x) f1-6) - (set! (-> vertices 2 pos x) f1-6) + (let ((sv-48 (-> this start-corner x)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (-> s3-0 colors)) + (dotimes (s1-0 48) + (let ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48))) + (let ((f1-6 (+ 393216.0 f0-8))) + (set! (-> vertices 0 pos x) f0-8) + (set! (-> vertices 1 pos x) f1-6) + (set! (-> vertices 2 pos x) f1-6) + ) + (set! (-> vertices 3 pos x) f0-8) ) - (set! (-> vertices 3 pos x) f0-8) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 1) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-56 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-52 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 1) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-56 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-52 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let ((f0-10 (+ -5898240.0 (-> this start-corner z)))) - (let ((f1-9 (+ -5898240.0 f0-10))) - (set! (-> vertices 0 pos z) f1-9) - (set! (-> vertices 1 pos z) f1-9) + (label cfg-9) + (let ((f0-10 (+ -5898240.0 (-> this start-corner z)))) + (let ((f1-9 (+ -5898240.0 f0-10))) + (set! (-> vertices 0 pos z) f1-9) + (set! (-> vertices 1 pos z) f1-9) + ) + (set! (-> vertices 2 pos z) f0-10) + (set! (-> vertices 3 pos z) f0-10) ) - (set! (-> vertices 2 pos z) f0-10) - (set! (-> vertices 3 pos z) f0-10) - ) - (set! (-> vertices 0 pos w) 0.0) - (set! (-> vertices 1 pos w) 0.0) - (set! (-> vertices 2 pos w) 0.5) - (set! (-> vertices 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (-> s3-1 colors)) - (dotimes (s1-1 48) - (let ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48))) - (let ((f1-14 (+ 393216.0 f0-17))) - (set! (-> vertices 0 pos x) f0-17) - (set! (-> vertices 1 pos x) f1-14) - (set! (-> vertices 2 pos x) f1-14) + (set! (-> vertices 0 pos w) 0.0) + (set! (-> vertices 1 pos w) 0.0) + (set! (-> vertices 2 pos w) 0.5) + (set! (-> vertices 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (-> s3-1 colors)) + (dotimes (s1-1 48) + (let ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48))) + (let ((f1-14 (+ 393216.0 f0-17))) + (set! (-> vertices 0 pos x) f0-17) + (set! (-> vertices 1 pos x) f1-14) + (set! (-> vertices 2 pos x) f1-14) + ) + (set! (-> vertices 3 pos x) f0-17) ) - (set! (-> vertices 3 pos x) f0-17) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 1) 4))) - (add-colors! this (-> vertices 0 col) (-> vertices 0)) - (add-colors! this (-> vertices 1 col) (-> vertices 1)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-52 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 1) 4))) + (add-colors! this (-> vertices 0 col) (-> vertices 0)) + (add-colors! this (-> vertices 1 col) (-> vertices 1)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-52 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -272,7 +273,6 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-61 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) (let ((vertices (the-as (inline-array ocean-vertex) (+ #x70000000 0)))) (let* ((f0-1 (+ 18874368.0 (-> this start-corner z))) (f1-2 (+ 5898240.0 f0-1)) @@ -286,79 +286,81 @@ (set! (-> vertices 1 pos w) 1.0) (set! (-> vertices 2 pos w) 0.5) (set! (-> vertices 3 pos w) 0.5) - (set! sv-48 (-> this start-corner x)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (&-> s3-0 colors 2444)) - (dotimes (s1-0 48) - (let ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48))) - (let ((f1-7 (+ 393216.0 f0-9))) - (set! (-> vertices 0 pos x) f0-9) - (set! (-> vertices 1 pos x) f1-7) - (set! (-> vertices 2 pos x) f1-7) + (let ((sv-48 (-> this start-corner x)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (&-> s3-0 colors 2444)) + (dotimes (s1-0 48) + (let ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48))) + (let ((f1-7 (+ 393216.0 f0-9))) + (set! (-> vertices 0 pos x) f0-9) + (set! (-> vertices 1 pos x) f1-7) + (set! (-> vertices 2 pos x) f1-7) + ) + (set! (-> vertices 3 pos x) f0-9) ) - (set! (-> vertices 3 pos x) f0-9) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-56 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-52 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ s1-0 2445) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-56 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-52 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let* ((f0-11 (+ 24772608.0 (-> this start-corner z))) - (f1-10 (+ 5898240.0 f0-11)) - ) - (set! (-> vertices 0 pos z) f0-11) - (set! (-> vertices 1 pos z) f0-11) - (set! (-> vertices 2 pos z) f1-10) - (set! (-> vertices 3 pos z) f1-10) - ) - (set! (-> vertices 0 pos w) 0.5) - (set! (-> vertices 1 pos w) 0.5) - (set! (-> vertices 2 pos w) 0.0) - (set! (-> vertices 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (&-> s3-1 colors 2444)) - (dotimes (s1-1 48) - (let ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48))) - (let ((f1-15 (+ 393216.0 f0-18))) - (set! (-> vertices 0 pos x) f0-18) - (set! (-> vertices 1 pos x) f1-15) - (set! (-> vertices 2 pos x) f1-15) - ) - (set! (-> vertices 3 pos x) f0-18) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-56 quad)) - (add-colors! this (-> vertices 2 col) (-> vertices 2)) - (add-colors! this (-> vertices 3 col) (-> vertices 3)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) + (label cfg-9) + (let* ((f0-11 (+ 24772608.0 (-> this start-corner z))) + (f1-10 (+ 5898240.0 f0-11)) ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> vertices 0 pos z) f0-11) + (set! (-> vertices 1 pos z) f0-11) + (set! (-> vertices 2 pos z) f1-10) + (set! (-> vertices 3 pos z) f1-10) + ) + (set! (-> vertices 0 pos w) 0.5) + (set! (-> vertices 1 pos w) 0.5) + (set! (-> vertices 2 pos w) 0.0) + (set! (-> vertices 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (&-> s3-1 colors 2444)) + (dotimes (s1-1 48) + (let ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48))) + (let ((f1-15 (+ 393216.0 f0-18))) + (set! (-> vertices 0 pos x) f0-18) + (set! (-> vertices 1 pos x) f1-15) + (set! (-> vertices 2 pos x) f1-15) + ) + (set! (-> vertices 3 pos x) f0-18) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ s1-1 2445) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-56 quad)) + (add-colors! this (-> vertices 2 col) (-> vertices 2)) + (add-colors! this (-> vertices 3 col) (-> vertices 3)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -386,7 +388,6 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-62 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) (let ((vertices (the-as (inline-array ocean-vertex) (+ #x70000000 0)))) (let* ((f0-0 (-> this start-corner x)) (f1-1 (+ -5898240.0 f0-0)) @@ -400,79 +401,81 @@ (set! (-> vertices 1 pos w) 1.0) (set! (-> vertices 2 pos w) 1.0) (set! (-> vertices 3 pos w) 0.5) - (set! sv-48 (-> this start-corner z)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (-> s3-0 colors)) - (dotimes (s1-0 48) - (let* ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48)) - (f1-6 (+ 393216.0 f0-8)) - ) - (set! (-> vertices 0 pos z) f0-8) - (set! (-> vertices 1 pos z) f0-8) - (set! (-> vertices 2 pos z) f1-6) - (set! (-> vertices 3 pos z) f1-6) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* 208 (+ s1-0 1)))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-52 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-56 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (let ((sv-48 (-> this start-corner z)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (-> s3-0 colors)) + (dotimes (s1-0 48) + (let* ((f0-8 (+ (* 393216.0 (the float s1-0)) sv-48)) + (f1-6 (+ 393216.0 f0-8)) + ) + (set! (-> vertices 0 pos z) f0-8) + (set! (-> vertices 1 pos z) f0-8) + (set! (-> vertices 2 pos z) f1-6) + (set! (-> vertices 3 pos z) f1-6) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* 208 (+ s1-0 1)))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-52 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-56 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let* ((f0-10 (+ -5898240.0 (-> this start-corner x))) - (f1-9 (+ -5898240.0 f0-10)) - ) - (set! (-> vertices 0 pos x) f1-9) - (set! (-> vertices 1 pos x) f0-10) - (set! (-> vertices 2 pos x) f0-10) - (set! (-> vertices 3 pos x) f1-9) - ) - (set! (-> vertices 0 pos w) 0.0) - (set! (-> vertices 1 pos w) 0.5) - (set! (-> vertices 2 pos w) 0.5) - (set! (-> vertices 3 pos w) 0.0) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (-> s3-1 colors)) - (dotimes (s1-1 48) - (let* ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48)) - (f1-14 (+ 393216.0 f0-17)) - ) - (set! (-> vertices 0 pos z) f0-17) - (set! (-> vertices 1 pos z) f0-17) - (set! (-> vertices 2 pos z) f1-14) - (set! (-> vertices 3 pos z) f1-14) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* 208 (+ s1-1 1)))) - (add-colors! this (-> vertices 0 col) (-> vertices 0)) - (set! (-> vertices 1 col quad) (-> sv-52 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (add-colors! this (-> vertices 3 col) (-> vertices 3)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) + (label cfg-9) + (let* ((f0-10 (+ -5898240.0 (-> this start-corner x))) + (f1-9 (+ -5898240.0 f0-10)) ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> vertices 0 pos x) f1-9) + (set! (-> vertices 1 pos x) f0-10) + (set! (-> vertices 2 pos x) f0-10) + (set! (-> vertices 3 pos x) f1-9) + ) + (set! (-> vertices 0 pos w) 0.0) + (set! (-> vertices 1 pos w) 0.5) + (set! (-> vertices 2 pos w) 0.5) + (set! (-> vertices 3 pos w) 0.0) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (-> s3-1 colors)) + (dotimes (s1-1 48) + (let* ((f0-17 (+ (* 393216.0 (the float s1-1)) sv-48)) + (f1-14 (+ 393216.0 f0-17)) + ) + (set! (-> vertices 0 pos z) f0-17) + (set! (-> vertices 1 pos z) f0-17) + (set! (-> vertices 2 pos z) f1-14) + (set! (-> vertices 3 pos z) f1-14) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* 208 (+ s1-1 1)))) + (add-colors! this (-> vertices 0 col) (-> vertices 0)) + (set! (-> vertices 1 col quad) (-> sv-52 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (add-colors! this (-> vertices 3 col) (-> vertices 3)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) @@ -500,7 +503,6 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod ocean-method-63 ((this ocean) (arg0 dma-buffer)) - (local-vars (sv-48 float) (sv-52 vector) (sv-56 vector)) (let ((vertices (the-as (inline-array ocean-vertex) (+ #x70000000 0)))) (let ((f0-1 (+ 18874368.0 (-> this start-corner x)))) (let ((f1-2 (+ 5898240.0 f0-1))) @@ -514,79 +516,81 @@ (set! (-> vertices 1 pos w) 0.5) (set! (-> vertices 2 pos w) 0.5) (set! (-> vertices 3 pos w) 1.0) - (set! sv-48 (-> this start-corner z)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (new 'stack-no-clear 'vector)) - (let ((s3-0 (-> this ocean-colors))) - (let ((s2-0 #f)) - (rgba-to-vector! this sv-52 (&-> s3-0 colors 47)) - (dotimes (s1-0 48) - (let* ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48)) - (f1-7 (+ 393216.0 f0-9)) - ) - (set! (-> vertices 0 pos z) f0-9) - (set! (-> vertices 1 pos z) f0-9) - (set! (-> vertices 2 pos z) f1-7) - (set! (-> vertices 3 pos z) f1-7) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (set! (-> vertices 1 col quad) (-> sv-52 quad)) - (set! (-> vertices 2 col quad) (-> sv-56 quad)) - (set! (-> vertices 3 col quad) (-> sv-56 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-0 #t) - ) - (else - (if s2-0 - (goto cfg-9) - ) + (let ((sv-48 (-> this start-corner z)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (-> this ocean-colors))) + (let ((s2-0 #f)) + (rgba-to-vector! this sv-52 (&-> s3-0 colors 47)) + (dotimes (s1-0 48) + (let* ((f0-9 (+ (* 393216.0 (the float s1-0)) sv-48)) + (f1-7 (+ 393216.0 f0-9)) + ) + (set! (-> vertices 0 pos z) f0-9) + (set! (-> vertices 1 pos z) f0-9) + (set! (-> vertices 2 pos z) f1-7) + (set! (-> vertices 3 pos z) f1-7) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-0 colors) (* (+ (* 52 (+ s1-0 1)) 47) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (set! (-> vertices 1 col quad) (-> sv-52 quad)) + (set! (-> vertices 2 col quad) (-> sv-56 quad)) + (set! (-> vertices 3 col quad) (-> sv-56 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-0 #t) + ) + (else + (if s2-0 + (goto cfg-9) + ) + ) ) ) ) ) - ) - (label cfg-9) - (let ((f0-11 (+ 24772608.0 (-> this start-corner x)))) - (let ((f1-10 (+ 5898240.0 f0-11))) - (set! (-> vertices 0 pos x) f0-11) - (set! (-> vertices 1 pos x) f1-10) - (set! (-> vertices 2 pos x) f1-10) + (label cfg-9) + (let ((f0-11 (+ 24772608.0 (-> this start-corner x)))) + (let ((f1-10 (+ 5898240.0 f0-11))) + (set! (-> vertices 0 pos x) f0-11) + (set! (-> vertices 1 pos x) f1-10) + (set! (-> vertices 2 pos x) f1-10) + ) + (set! (-> vertices 3 pos x) f0-11) ) - (set! (-> vertices 3 pos x) f0-11) - ) - (set! (-> vertices 0 pos w) 0.5) - (set! (-> vertices 1 pos w) 0.0) - (set! (-> vertices 2 pos w) 0.0) - (set! (-> vertices 3 pos w) 0.5) - (let ((s3-1 (-> this ocean-colors))) - (let ((s2-1 #f)) - (rgba-to-vector! this sv-52 (&-> s3-1 colors 47)) - (dotimes (s1-1 48) - (let* ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48)) - (f1-15 (+ 393216.0 f0-18)) - ) - (set! (-> vertices 0 pos z) f0-18) - (set! (-> vertices 1 pos z) f0-18) - (set! (-> vertices 2 pos z) f1-15) - (set! (-> vertices 3 pos z) f1-15) - ) - (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4))) - (set! (-> vertices 0 col quad) (-> sv-52 quad)) - (add-colors! this (-> vertices 1 col) (-> vertices 1)) - (add-colors! this (-> vertices 2 col) (-> vertices 2)) - (set! (-> vertices 3 col quad) (-> sv-56 quad)) - (set! (-> sv-52 quad) (-> sv-56 quad)) - (cond - ((render-ocean-quad vertices arg0) - (set! s2-1 #t) - ) - (else - (if s2-1 - (goto cfg-18) - ) + (set! (-> vertices 0 pos w) 0.5) + (set! (-> vertices 1 pos w) 0.0) + (set! (-> vertices 2 pos w) 0.0) + (set! (-> vertices 3 pos w) 0.5) + (let ((s3-1 (-> this ocean-colors))) + (let ((s2-1 #f)) + (rgba-to-vector! this sv-52 (&-> s3-1 colors 47)) + (dotimes (s1-1 48) + (let* ((f0-18 (+ (* 393216.0 (the float s1-1)) sv-48)) + (f1-15 (+ 393216.0 f0-18)) + ) + (set! (-> vertices 0 pos z) f0-18) + (set! (-> vertices 1 pos z) f0-18) + (set! (-> vertices 2 pos z) f1-15) + (set! (-> vertices 3 pos z) f1-15) + ) + (rgba-to-vector! this sv-56 (&+ (-> s3-1 colors) (* (+ (* 52 (+ s1-1 1)) 47) 4))) + (set! (-> vertices 0 col quad) (-> sv-52 quad)) + (add-colors! this (-> vertices 1 col) (-> vertices 1)) + (add-colors! this (-> vertices 2 col) (-> vertices 2)) + (set! (-> vertices 3 col quad) (-> sv-56 quad)) + (set! (-> sv-52 quad) (-> sv-56 quad)) + (cond + ((render-ocean-quad vertices arg0) + (set! s2-1 #t) + ) + (else + (if s2-1 + (goto cfg-18) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc b/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc index 7faabc916b..2a535ef258 100644 --- a/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/shrub/shrubbery_REF.gc @@ -435,16 +435,7 @@ ;; INFO: Used lq/sq ;; ERROR: Failed load: (set! a2-26 (l.d (+ a0-26 96))) at op 223 (defun draw-prototype-inline-array-shrub ((proto-array-len int) (proto-array (inline-array prototype-bucket-shrub))) - (local-vars - (sv-16 drawable) - (sv-32 uint) - (sv-48 int) - (sv-64 drawable) - (sv-80 int) - (sv-96 uint) - (sv-112 drawable) - (sv-128 int) - ) + (local-vars (sv-16 drawable) (sv-48 int)) (let ((v1-0 (the-as prototype-bucket-shrub proto-array)) (a0-6 (-> *display* frames (-> *display* on-screen) global-buf)) ) @@ -661,36 +652,51 @@ (let ((s1-0 (the-as object proto-array))) (countdown (s0-0 proto-array-len) (when (nonzero? (-> (the-as prototype-bucket-shrub s1-0) count 1)) - (if (logtest? (-> (the-as prototype-bucket-shrub s1-0) flags) (prototype-flags tpage-alpha)) - (set! sv-16 (-> (the-as prototype-bucket-shrub s1-0) geometry 2)) - (set! sv-16 (-> (the-as prototype-bucket-shrub s1-0) geometry 1)) - ) - (set! sv-32 (-> (the-as prototype-bucket-shrub s1-0) next 1)) - (if (logtest? (-> (the-as prototype-bucket-shrub s1-0) flags) (prototype-flags tpage-alpha)) - (set! sv-48 #x51001) - (set! sv-48 #x5026b) - ) - (set! sv-64 (&+ sv-16 32)) - (set! sv-80 0) - (while (< sv-80 (-> (the-as drawable-group sv-16) length)) - (shrub-upload-model - (the-as shrubbery sv-64) - s2-2 - (the-as int (-> *instance-shrub-work* start-bank (-> (the-as prototype-bucket-shrub s1-0) mod-count 1))) - ) - (if (zero? sv-80) - (dma-buffer-add-gs-set s2-2 (test-1 sv-48)) + (set! sv-16 (cond + ((logtest? (-> (the-as prototype-bucket-shrub s1-0) flags) (prototype-flags tpage-alpha)) + (set! sv-16 (-> (the-as prototype-bucket-shrub s1-0) geometry 2)) + sv-16 + ) + (else + (-> (the-as prototype-bucket-shrub s1-0) geometry 1) + ) + ) + ) + (let ((sv-32 (-> (the-as prototype-bucket-shrub s1-0) next 1))) + (set! sv-48 (cond + ((logtest? (-> (the-as prototype-bucket-shrub s1-0) flags) (prototype-flags tpage-alpha)) + (set! sv-48 #x51001) + sv-48 + ) + (else + #x5026b + ) + ) + ) + (let ((sv-64 (&+ sv-16 32)) + (sv-80 0) + ) + (while (< sv-80 (-> (the-as drawable-group sv-16) length)) + (shrub-upload-model + (the-as shrubbery sv-64) + s2-2 + (the-as int (-> *instance-shrub-work* start-bank (-> (the-as prototype-bucket-shrub s1-0) mod-count 1))) + ) + (if (zero? sv-80) + (dma-buffer-add-gs-set s2-2 (test-1 sv-48)) + ) + (let* ((v1-97 s2-2) + (a0-42 (-> v1-97 base)) + ) + (set! (-> (the-as (pointer uint64) a0-42)) (logior #x50000000 (shr (shl sv-32 33) 1))) + (s.w! (+ a0-42 8) 0) + (s.w! (+ a0-42 12) 0) + (set! (-> v1-97 base) (&+ a0-42 16)) + ) + (&+! sv-64 32) + (+! sv-80 1) ) - (let* ((v1-97 s2-2) - (a0-42 (-> v1-97 base)) - ) - (set! (-> (the-as (pointer uint64) a0-42)) (logior #x50000000 (shr (shl sv-32 33) 1))) - (s.w! (+ a0-42 8) 0) - (s.w! (+ a0-42 12) 0) - (set! (-> v1-97 base) (&+ a0-42 16)) ) - (set! sv-64 (&+ sv-64 32)) - (set! sv-80 (+ sv-80 1)) ) ) (set! s1-0 (&+ (the-as prototype-bucket-shrub s1-0) 112)) @@ -765,27 +771,28 @@ (let ((s1-1 (the-as object proto-array))) (countdown (s0-1 proto-array-len) (when (nonzero? (-> (the-as prototype-bucket-shrub s1-1) count 2)) - (let ((v1-132 (-> (the-as prototype-bucket-shrub s1-1) geometry 2))) - (set! sv-96 (-> (the-as prototype-bucket-shrub s1-1) next 2)) - (set! sv-112 (&+ v1-132 32)) - (set! sv-128 (-> (the-as drawable-group v1-132) length)) - ) - (while (nonzero? sv-128) - (set! sv-128 (+ sv-128 -1)) - (shrub-upload-model - (the-as shrubbery sv-112) - s2-3 - (the-as int (-> *instance-shrub-work* start-bank (-> (the-as prototype-bucket-shrub s1-1) mod-count 2))) + (let* ((v1-132 (-> (the-as prototype-bucket-shrub s1-1) geometry 2)) + (sv-96 (-> (the-as prototype-bucket-shrub s1-1) next 2)) + (sv-112 (&+ v1-132 32)) + (sv-128 (-> (the-as drawable-group v1-132) length)) + ) + (while (nonzero? sv-128) + (+! sv-128 -1) + (shrub-upload-model + (the-as shrubbery sv-112) + s2-3 + (the-as int (-> *instance-shrub-work* start-bank (-> (the-as prototype-bucket-shrub s1-1) mod-count 2))) + ) + (let* ((v1-138 s2-3) + (a0-58 (-> v1-138 base)) + ) + (set! (-> (the-as (pointer uint64) a0-58)) (logior #x50000000 (shr (shl sv-96 33) 1))) + (s.w! (+ a0-58 8) 0) + (s.w! (+ a0-58 12) 0) + (set! (-> v1-138 base) (&+ a0-58 16)) + ) + (&+! sv-112 32) ) - (let* ((v1-138 s2-3) - (a0-58 (-> v1-138 base)) - ) - (set! (-> (the-as (pointer uint64) a0-58)) (logior #x50000000 (shr (shl sv-96 33) 1))) - (s.w! (+ a0-58 8) 0) - (s.w! (+ a0-58 12) 0) - (set! (-> v1-138 base) (&+ a0-58 16)) - ) - (set! sv-112 (&+ sv-112 32)) ) ) (set! s1-1 (&+ (the-as prototype-bucket-shrub s1-1) 112)) diff --git a/test/decompiler/reference/jak2/engine/gfx/sky/sky-tng_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sky/sky-tng_REF.gc index 0d71ad23ef..c68a905d90 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sky/sky-tng_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sky/sky-tng_REF.gc @@ -305,7 +305,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-clouds ((this sky-work) (arg0 dma-buffer)) - (local-vars (v1-19 float) (sv-16 cloud-vert-array) (sv-20 (inline-array sky-vertex)) (sv-32 int)) + (local-vars (v1-19 float)) (rlet ((vf23 :class vf) (vf27 :class vf) ) @@ -343,13 +343,15 @@ (set-tex-offset (the-as int (-> this off-s)) (the-as int (-> this off-t))) (let ((s4-1 (the-as object (-> arg0 base)))) (&+! (-> arg0 base) 16) - (set! sv-16 *cloud-vert-array*) - (set! sv-20 *cloud-poly*) - (dotimes (s3-1 9) - (dotimes (s2-2 9) - (let ((s1-0 (+ (* 10 s3-1) s2-2))) - (set! sv-32 (+ (* 9 s3-1) s2-2)) - (let ((s0-0 (+ s2-2 81 (* 9 s3-1)))) + (let ((sv-16 *cloud-vert-array*) + (sv-20 *cloud-poly*) + ) + (dotimes (s3-1 9) + (dotimes (s2-2 9) + (let ((s1-0 (+ (* 10 s3-1) s2-2)) + (sv-32 (+ (* 9 s3-1) s2-2)) + (s0-0 (+ s2-2 81 (* 9 s3-1))) + ) (cloud-vtx1-to-sky this (-> sv-20 (* sv-32 4)) (-> sv-16 data s1-0)) (cloud-vtx1-to-sky this (-> sv-20 (+ (* sv-32 4) 1)) (-> sv-16 data (+ s1-0 1))) (cloud-vtx1-to-sky this (-> sv-20 (+ (* sv-32 4) 2)) (-> sv-16 data (+ s1-0 11))) @@ -361,9 +363,9 @@ ) ) ) - ) - (dotimes (s5-1 162) - (render-sky-quad (the-as (inline-array sky-vertex) (-> sv-20 (* s5-1 4))) arg0) + (dotimes (s5-1 162) + (render-sky-quad (the-as (inline-array sky-vertex) (-> sv-20 (* s5-1 4))) arg0) + ) ) (close-sky-buffer arg0) (let ((v1-81 (/ (the-as int (+ (- -16 (the-as int s4-1)) (the-as int (-> arg0 base)))) 16))) @@ -469,23 +471,24 @@ ;; definition for method 27 of type sky-work ;; WARN: Return type mismatch int vs none. (defmethod draw-haze ((this sky-work) (arg0 dma-buffer)) - (local-vars (sv-16 haze-vert-array) (sv-20 (inline-array sky-vertex))) (rlet ((vf27 :class vf)) (dma-buffer-add-gs-set arg0 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1))) (init-regs-for-large-polygon-draw this) (.lvf vf27 (&-> this giftag-haze quad)) (let ((s4-0 (the-as object (-> arg0 base)))) (&+! (-> arg0 base) 16) - (set! sv-16 *haze-vert-array*) - (set! sv-20 *haze-poly*) - (dotimes (s3-0 35) - (haze-vtx-to-sky this (-> sv-20 (* s3-0 4)) (-> sv-20 (+ (* s3-0 4) 1)) (-> sv-16 data s3-0)) - (haze-vtx-to-sky this (-> sv-20 (+ (* s3-0 4) 3)) (-> sv-20 (+ (* s3-0 4) 2)) (-> sv-16 data (+ s3-0 1))) - ) - (haze-vtx-to-sky this (-> sv-20 140) (-> sv-20 141) (-> sv-16 data 35)) - (haze-vtx-to-sky this (-> sv-20 143) (-> sv-20 142) (-> sv-16 data 0)) - (dotimes (s5-1 36) - (render-sky-quad (the-as (inline-array sky-vertex) (-> sv-20 (* s5-1 4))) arg0) + (let ((sv-16 *haze-vert-array*) + (sv-20 *haze-poly*) + ) + (dotimes (s3-0 35) + (haze-vtx-to-sky this (-> sv-20 (* s3-0 4)) (-> sv-20 (+ (* s3-0 4) 1)) (-> sv-16 data s3-0)) + (haze-vtx-to-sky this (-> sv-20 (+ (* s3-0 4) 3)) (-> sv-20 (+ (* s3-0 4) 2)) (-> sv-16 data (+ s3-0 1))) + ) + (haze-vtx-to-sky this (-> sv-20 140) (-> sv-20 141) (-> sv-16 data 35)) + (haze-vtx-to-sky this (-> sv-20 143) (-> sv-20 142) (-> sv-16 data 0)) + (dotimes (s5-1 36) + (render-sky-quad (the-as (inline-array sky-vertex) (-> sv-20 (* s5-1 4))) arg0) + ) ) (close-sky-buffer arg0) (let ((v1-41 (/ (the-as int (+ (- -16 (the-as int s4-0)) (the-as int (-> arg0 base)))) 16))) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc index 5032352e3a..185b6b55a9 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle-launcher_REF.gc @@ -650,7 +650,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f2-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (quaternion->matrix s5-0 a1-1) ) @@ -957,7 +957,7 @@ (set! (-> v1-0 x) f0-0) (set! (-> v1-0 y) f1-0) (set! (-> v1-0 z) f2-0) - (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (set! (-> arg3 qx-qy-qz-sy x) 0.0) (set! (-> arg3 qx-qy-qz-sy y) 0.0) @@ -1469,7 +1469,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun execute-part-engine () - (local-vars (sv-96 sparticle-launcher) (sv-104 int)) (let ((gp-0 *sp-particle-system-2d*)) (let* ((s5-0 *part-engine*) (s4-0 *part-id-table*) @@ -1486,28 +1485,30 @@ (when (and (logtest? (-> a1-0 status) (draw-control-status on-screen)) (< (-> a1-0 distance) (-> (the-as vector s0-0) w)) ) - (set! sv-96 (-> s4-0 (-> (the-as connection v1-1) param2))) - (set! sv-104 (the-as int (-> (the-as connection v1-1) param0))) - (when (nonzero? sv-96) - (let ((a1-8 (-> a0-2 node-list data sv-104))) - (let* ((v1-7 s3-0) - (t0-0 (-> a1-8 bone transform)) - (a0-5 (-> t0-0 quad 0)) - (a2-2 (-> t0-0 quad 1)) - (a3-0 (-> t0-0 quad 2)) - (t0-1 (-> t0-0 trans quad)) - ) - (set! (-> v1-7 quad 0) a0-5) - (set! (-> v1-7 quad 1) a2-2) - (set! (-> v1-7 quad 2) a3-0) - (set! (-> v1-7 trans quad) t0-1) + (let ((sv-96 (-> s4-0 (-> (the-as connection v1-1) param2))) + (sv-104 (the-as int (-> (the-as connection v1-1) param0))) ) - (vector<-cspace! (-> s3-0 trans) a1-8) + (when (nonzero? sv-96) + (let ((a1-8 (-> a0-2 node-list data sv-104))) + (let* ((v1-7 s3-0) + (t0-0 (-> a1-8 bone transform)) + (a0-5 (-> t0-0 quad 0)) + (a2-2 (-> t0-0 quad 1)) + (a3-0 (-> t0-0 quad 2)) + (t0-1 (-> t0-0 trans quad)) + ) + (set! (-> v1-7 quad 0) a0-5) + (set! (-> v1-7 quad 1) a2-2) + (set! (-> v1-7 quad 2) a3-0) + (set! (-> v1-7 trans quad) t0-1) + ) + (vector<-cspace! (-> s3-0 trans) a1-8) + ) + (set! (-> s2-0 quad) (-> (the-as vector s0-0) quad)) + (set! (-> s2-0 w) 1.0) + (vector-matrix*! (-> s3-0 trans) s2-0 s3-0) + (launch-particles :system gp-0 sv-96 s3-0 :origin-is-matrix #t) ) - (set! (-> s2-0 quad) (-> (the-as vector s0-0) quad)) - (set! (-> s2-0 w) 1.0) - (vector-matrix*! (-> s3-0 trans) s2-0 s3-0) - (launch-particles :system gp-0 sv-96 s3-0 :origin-is-matrix #t) ) ) ) @@ -1662,7 +1663,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f2-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (quaternion-rotate-y! s4-0 s4-0 (-> s5-0 sprite flag-rot-sy z)) (let ((v1-4 arg2)) @@ -1721,7 +1722,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f2-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (let ((a1-1 (new-stack-vector0))) (set! (-> a1-1 y) (-> s5-0 sprite flag-rot-sy z)) @@ -2118,7 +2119,7 @@ (set! (-> arg2 qx-qy-qz-sy z) (+ -16384.0 (atan f30-0 f28-0))) (let ((f0-17 (-> arg1 omega))) (if (!= f0-17 0.0) - (set! (-> arg2 x-y-z-sx w) (* (sqrtf (+ (* f30-0 f30-0) (* f28-0 f28-0))) + (set! (-> arg2 x-y-z-sx w) (* (sqrtf (+ (square f30-0) (square f28-0))) f0-17 (lerp-scale 3.0 0.25 (/ 1.0 (the float (-> s5-0 z))) 0.000001 0.00000014285715) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc index 1a2485256f..3108932cac 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/particles/sparticle_REF.gc @@ -361,41 +361,28 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun sp-process-block ((arg0 sparticle-system) (arg1 int) (arg2 sprite-array-2d) (arg3 int)) - (local-vars (sv-16 int) (sv-32 int) (sv-48 int) (sv-64 int)) - (let ((s3-0 208) - (s2-0 (* 144 arg3)) - (s5-0 (* 48 arg3)) - ) - (set! sv-32 (* 80 arg3)) - (let ((s1-0 (+ s3-0 s2-0))) - (set! sv-16 (+ s1-0 s5-0)) + (let* ((s3-0 208) + (s2-0 (* 144 arg3)) + (s5-0 (* 48 arg3)) + (sv-32 (* 80 arg3)) + (s1-0 (+ s3-0 s2-0)) + ) + (let ((sv-16 (+ s1-0 s5-0))) (sp-copy-to-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) (sp-copy-to-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) - (let ((t9-2 sp-copy-to-spr) - (a1-7 (-> arg0 adgifdata-table arg1)) - ) - (t9-2 sv-16 (the-as pointer a1-7) sv-32) - ) - (set! sv-48 (+ #x70000000 s3-0)) - (set! sv-64 (+ #x70000000 s1-0)) - (let ((t1-0 (paused?))) - (cond - ((-> arg0 is-3d) - (let ((t9-4 sp-process-block-3d) - (a0-6 arg0) - (a3-1 arg1) - ) - (t9-4 a0-6 sv-48 sv-64 a3-1 arg3 t1-0) - ) - ) - (else - (sp-process-block-2d arg0 sv-48 sv-64 arg1 arg3 t1-0) - ) - ) - ) - (sp-copy-from-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) - (sp-copy-from-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) + (sp-copy-to-spr sv-16 (the-as pointer (-> arg0 adgifdata-table arg1)) sv-32) ) + (let ((sv-48 (+ #x70000000 s3-0)) + (sv-64 (+ #x70000000 s1-0)) + (t1-0 (paused?)) + ) + (if (-> arg0 is-3d) + (sp-process-block-3d arg0 sv-48 sv-64 arg1 arg3 t1-0) + (sp-process-block-2d arg0 sv-48 sv-64 arg1 arg3 t1-0) + ) + ) + (sp-copy-from-spr s3-0 (the-as pointer (-> arg0 cpuinfo-table arg1)) s2-0) + (sp-copy-from-spr s1-0 (&+ (-> arg0 vecdata-table) (* 48 arg1)) s5-0) ) 0 (none) @@ -443,7 +430,6 @@ (arg1 (function sparticle-system sparticle-cpuinfo none)) (arg2 sparticle-system) ) - (local-vars (sv-16 int)) (let ((s3-0 (the-as object (-> arg2 cpuinfo-table 0))) (s2-0 (&+ (-> arg2 vecdata-table) 0)) (s1-0 (+ (-> arg2 blocks 0) (-> arg2 blocks 1))) @@ -451,14 +437,15 @@ (dotimes (s0-0 s1-0) (cond ((!= (-> arg2 alloc-table s0-0) -1) - (set! sv-16 0) - (while (< sv-16 64) - (if (and (nonzero? (-> (the-as sparticle-cpuinfo s3-0) valid)) (= (-> (the-as sparticle-cpuinfo s3-0) key) arg0)) - (arg1 arg2 (the-as sparticle-cpuinfo s3-0)) - ) - (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 1)) - (&+! s2-0 48) - (set! sv-16 (+ sv-16 1)) + (let ((sv-16 0)) + (while (< sv-16 64) + (if (and (nonzero? (-> (the-as sparticle-cpuinfo s3-0) valid)) (= (-> (the-as sparticle-cpuinfo s3-0) key) arg0)) + (arg1 arg2 (the-as sparticle-cpuinfo s3-0)) + ) + (set! s3-0 (-> (the-as (inline-array sparticle-cpuinfo) s3-0) 1)) + (&+! s2-0 48) + (+! sv-16 1) + ) ) ) (else diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc index 053679d386..923c154926 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-distort_REF.gc @@ -154,15 +154,7 @@ ;; ERROR: Inline assembly instruction marked with TODO - [TODO.VCLIP] ;; ERROR: Unsupported inline assembly instruction kind - [cfc2.i v1, Clipping] (defun sprite-draw-distorters ((dma-buff dma-buffer)) - (local-vars - (v1-15 float) - (v1-21 float) - (clip-result int) - (v1-63 float) - (sprite sprite-vec-data-2d) - (dma-st-flag pointer) - (dma-color pointer) - ) + (local-vars (v1-15 float) (v1-21 float) (clip-result int) (v1-63 float)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -189,10 +181,11 @@ (dotimes (i num-entries) (let ((aux-elem (-> s3-0 data i))) (when (= (-> aux-elem aux-type) (sprite-aux-type distort)) - (set! sprite (-> aux-elem vec-data)) - (let ((dma-position (the-as object (-> dma-buff base)))) - (set! dma-st-flag (&+ (the-as pointer dma-position) 16)) - (set! dma-color (&+ (the-as pointer dma-position) 32)) + (let* ((sprite (-> aux-elem vec-data)) + (dma-position (the-as object (-> dma-buff base))) + (dma-st-flag (&+ (the-as pointer dma-position) 16)) + (dma-color (&+ (the-as pointer dma-position) 32)) + ) (cond ((= (the-as int (-> sprite flag-rot-sy y)) 1) (.lvf vf3 (&-> *math-camera* sprite-2d quad 0)) @@ -232,32 +225,32 @@ (set! (-> (the-as vector dma-position) w) 255.0) (set! (-> (the-as vector dma-st-flag) x) (* 0.001953125 (+ -1792.0 (-> (the-as vector dma-position) x)))) (set! (-> (the-as vector dma-st-flag) y) (* 0.001953125 (+ -1840.0 (-> (the-as vector dma-position) y)))) - ) - (set! (-> (the-as vector dma-st-flag) z) 1.0) - (when (or (< (the-as int (-> sprite flag-rot-sy x)) 3) (< 11 (the-as int (-> sprite flag-rot-sy x)))) - (format 0 "Turns = ~D!!!~%" (-> sprite flag-rot-sy x)) - (set! (-> sprite flag-rot-sy x) (the-as float #xb)) - ) - (set! (-> (the-as (pointer int32) dma-st-flag) 3) (the-as int (-> sprite flag-rot-sy x))) - (let* ((f1-4 (- (-> *math-camera* perspective vector 1 y))) - (f2-2 (-> (the-as vector dma-st-flag) y)) - (f4-0 (+ f2-2 (* (-> (the-as vector dma-color) x) f1-4))) - (f3-0 256.0) - (f0-9 (-> (the-as vector dma-color) x)) - ) - (if (< 416.0 f4-0) - (set! f3-0 (/ (- 416.0 f2-2) f1-4)) + (set! (-> (the-as vector dma-st-flag) z) 1.0) + (when (or (< (the-as int (-> sprite flag-rot-sy x)) 3) (< 11 (the-as int (-> sprite flag-rot-sy x)))) + (format 0 "Turns = ~D!!!~%" (-> sprite flag-rot-sy x)) + (set! (-> sprite flag-rot-sy x) (the-as float #xb)) + ) + (set! (-> (the-as (pointer int32) dma-st-flag) 3) (the-as int (-> sprite flag-rot-sy x))) + (let* ((f1-4 (- (-> *math-camera* perspective vector 1 y))) + (f2-2 (-> (the-as vector dma-st-flag) y)) + (f4-0 (+ f2-2 (* (-> (the-as vector dma-color) x) f1-4))) + (f3-0 256.0) + (f0-9 (-> (the-as vector dma-color) x)) + ) + (if (< 416.0 f4-0) + (set! f3-0 (/ (- 416.0 f2-2) f1-4)) + ) + (if (< 128.0 f3-0) + (set! f3-0 128.0) + ) + (when (< f3-0 f0-9) + (let ((v1-61 (/ f3-0 f0-9))) + (.mov vf1 v1-61) + ) + (.mul.x.vf vf2 vf2 vf1) + (.svf (&-> (the-as vector dma-color) quad) vf2) + (.mov v1-63 vf2) ) - (if (< 128.0 f3-0) - (set! f3-0 128.0) - ) - (when (< f3-0 f0-9) - (let ((v1-61 (/ f3-0 f0-9))) - (.mov vf1 v1-61) - ) - (.mul.x.vf vf2 vf2 vf1) - (.svf (&-> (the-as vector dma-color) quad) vf2) - (.mov v1-63 vf2) ) ) (&+! (-> dma-buff base) 48) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-glow_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-glow_REF.gc index be92888460..af0e7a252f 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-glow_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite-glow_REF.gc @@ -728,24 +728,26 @@ ;; definition for method 10 of type simple-sprite-system ;; WARN: Return type mismatch int vs none. (defmethod draw-all-sprites! ((this simple-sprite-system) (arg0 dma-buffer)) - (local-vars (sv-528 sprite-glow-dma-packet-data) (sv-532 (pointer texture-id)) (sv-536 pointer)) (b! (zero? (-> this count)) cfg-13 :delay (nop!)) - (set! sv-528 *sprite-glow-dma-packet-data*) - (set! sv-532 (new 'stack-no-clear 'array 'texture-id 128)) - (set! sv-536 (-> arg0 base)) - (dotimes (v1-5 (-> this count)) - (set! (-> sv-532 v1-5) (-> this data v1-5 tex-id)) - ) - (countdown (s4-0 (-> this count)) - (let ((s3-0 (-> sv-532 s4-0))) - (when (nonzero? s3-0) - (let ((s2-0 (add-shader-to-dma arg0))) - (adgif-shader<-texture-simple! s2-0 (lookup-texture-by-id s3-0)) - (countdown (s1-1 (+ s4-0 1)) - (when (= s3-0 (-> sv-532 s1-1)) - (set! (-> sv-532 s1-1) (new 'static 'texture-id)) - (let ((a2-1 (-> this data s1-1))) - (sprite-glow-add-simple-sprite arg0 sv-528 a2-1 (the-as pointer s2-0)) + (let ((sv-528 *sprite-glow-dma-packet-data*) + (sv-532 (new 'stack-no-clear 'array 'texture-id 128)) + ) + (let ((sv-536 (-> arg0 base))) + ) + (dotimes (v1-5 (-> this count)) + (set! (-> sv-532 v1-5) (-> this data v1-5 tex-id)) + ) + (countdown (s4-0 (-> this count)) + (let ((s3-0 (-> sv-532 s4-0))) + (when (nonzero? s3-0) + (let ((s2-0 (add-shader-to-dma arg0))) + (adgif-shader<-texture-simple! s2-0 (lookup-texture-by-id s3-0)) + (countdown (s1-1 (+ s4-0 1)) + (when (= s3-0 (-> sv-532 s1-1)) + (set! (-> sv-532 s1-1) (new 'static 'texture-id)) + (let ((a2-1 (-> this data s1-1))) + (sprite-glow-add-simple-sprite arg0 sv-528 a2-1 (the-as pointer s2-0)) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc index 6e3e49351b..afcfff7ee7 100644 --- a/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/sprite/sprite_REF.gc @@ -515,7 +515,7 @@ (set! (-> out x) f0-0) (set! (-> out y) f1-0) (set! (-> out z) f2-0) - (set! (-> out w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> out w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) out ) diff --git a/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-funcs_REF.gc b/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-funcs_REF.gc index 96bb14657f..28d482fe93 100644 --- a/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-funcs_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim-funcs_REF.gc @@ -121,7 +121,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs int. (defun real-fog-texture-anim-func ((arg0 dma-buffer) (arg1 texture-anim)) - (local-vars (sv-48 int)) (let ((s4-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) (s1-0 *fog-texture-work*) @@ -132,8 +131,9 @@ (set! (-> s2-0 a0-1) v1-1) ) ) - (set! sv-48 0) - (let ((s0-0 0)) + (let ((sv-48 0) + (s0-0 0) + ) (let ((f0-0 40955904.0) (f1-0 -40955904.0) ) diff --git a/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim_REF.gc b/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim_REF.gc index 60452cdb5e..74d7341fb3 100644 --- a/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/texture/texture-anim_REF.gc @@ -211,7 +211,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch pointer vs none. (defun texture-anim-layer-draw ((dma-buf dma-buffer) (width int) (height int) (layer texture-anim-layer)) - (local-vars (v1-27 float) (sv-224 matrix) (sv-228 matrix) (sv-232 matrix) (sv-236 matrix)) + (local-vars (v1-27 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -236,44 +236,46 @@ (let ((s4-0 (the-as (pointer uint128) (-> dma-buf base)))) (set! (-> s4-0 0) (-> *texture-anim-work* draw-tmpl dma-vif quad)) (set! (-> s4-0 1) (-> *texture-anim-work* draw-tmpl quad 1)) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! sv-232 (new 'stack-no-clear 'matrix)) - (let ((v1-7 (new 'stack-no-clear 'matrix))) + (let ((sv-224 (new 'stack-no-clear 'matrix)) + (sv-228 (new 'stack-no-clear 'matrix)) + (sv-232 (new 'stack-no-clear 'matrix)) + (v1-7 (new 'stack-no-clear 'matrix)) + ) (set! (-> v1-7 quad 0) (the-as uint128 0)) - (set! sv-236 v1-7) - ) - (let ((s3-0 *texture-anim-work*)) - (.lvf vf1 (&-> s3-0 const quad)) - (.lvf vf2 (&-> layer interpolated-color quad)) - (.mul.x.vf vf2 vf2 vf1) - (.ftoi.vf vf2 vf2) - (.svf (&-> s4-0 2) vf2) - (matrix-rotate-z! sv-224 (-> layer interpolated-rot x)) - (set! (-> sv-236 vector 0 x) (* (-> layer interpolated-scale-offset x) (the float width))) - (set! (-> sv-236 vector 0 y) (* (-> layer interpolated-scale-offset y) (the float height))) - (matrix-scale! sv-232 (the-as vector sv-236)) - (matrix*! sv-224 sv-232 sv-224) - (set! (-> sv-224 trans x) (+ 2048.0 (* (-> layer interpolated-scale-offset z) (the float width)))) - (set! (-> sv-224 trans y) (+ 2048.0 (* (-> layer interpolated-scale-offset w) (the float height)))) - (set! (-> sv-224 trans z) 1048575.94) - (matrix-rotate-z! sv-228 (-> layer interpolated-rot y)) - (set! (-> sv-236 vector 0 x) (-> layer interpolated-st-scale-offset x)) - (set! (-> sv-236 vector 0 y) (-> layer interpolated-st-scale-offset y)) - (matrix-scale! sv-232 (the-as vector sv-236)) - (matrix*! sv-228 sv-232 sv-228) - (set! (-> sv-228 trans x) (-> layer interpolated-st-scale-offset z)) - (set! (-> sv-228 trans y) (-> layer interpolated-st-scale-offset w)) - (.lvf vf11 (&-> sv-224 quad 0)) - (.lvf vf12 (&-> sv-224 quad 1)) - (.lvf vf14 (&-> sv-224 trans quad)) - (.lvf vf15 (&-> sv-228 quad 0)) - (.lvf vf16 (&-> sv-228 quad 1)) - (.lvf vf18 (&-> sv-228 trans quad)) - (.lvf vf7 (&-> s3-0 corner0 quad)) - (.lvf vf8 (&-> s3-0 corner1 quad)) - (.lvf vf9 (&-> s3-0 corner2 quad)) - (.lvf vf10 (&-> s3-0 corner3 quad)) + (let ((sv-236 v1-7) + (s3-0 *texture-anim-work*) + ) + (.lvf vf1 (&-> s3-0 const quad)) + (.lvf vf2 (&-> layer interpolated-color quad)) + (.mul.x.vf vf2 vf2 vf1) + (.ftoi.vf vf2 vf2) + (.svf (&-> s4-0 2) vf2) + (matrix-rotate-z! sv-224 (-> layer interpolated-rot x)) + (set! (-> sv-236 vector 0 x) (* (-> layer interpolated-scale-offset x) (the float width))) + (set! (-> sv-236 vector 0 y) (* (-> layer interpolated-scale-offset y) (the float height))) + (matrix-scale! sv-232 (the-as vector sv-236)) + (matrix*! sv-224 sv-232 sv-224) + (set! (-> sv-224 trans x) (+ 2048.0 (* (-> layer interpolated-scale-offset z) (the float width)))) + (set! (-> sv-224 trans y) (+ 2048.0 (* (-> layer interpolated-scale-offset w) (the float height)))) + (set! (-> sv-224 trans z) 1048575.94) + (matrix-rotate-z! sv-228 (-> layer interpolated-rot y)) + (set! (-> sv-236 vector 0 x) (-> layer interpolated-st-scale-offset x)) + (set! (-> sv-236 vector 0 y) (-> layer interpolated-st-scale-offset y)) + (matrix-scale! sv-232 (the-as vector sv-236)) + (matrix*! sv-228 sv-232 sv-228) + (set! (-> sv-228 trans x) (-> layer interpolated-st-scale-offset z)) + (set! (-> sv-228 trans y) (-> layer interpolated-st-scale-offset w)) + (.lvf vf11 (&-> sv-224 quad 0)) + (.lvf vf12 (&-> sv-224 quad 1)) + (.lvf vf14 (&-> sv-224 trans quad)) + (.lvf vf15 (&-> sv-228 quad 0)) + (.lvf vf16 (&-> sv-228 quad 1)) + (.lvf vf18 (&-> sv-228 trans quad)) + (.lvf vf7 (&-> s3-0 corner0 quad)) + (.lvf vf8 (&-> s3-0 corner1 quad)) + (.lvf vf9 (&-> s3-0 corner2 quad)) + (.lvf vf10 (&-> s3-0 corner3 quad)) + ) ) (.lvf vf19 (&-> layer interpolated-qs quad)) (.mul.x.vf acc vf11 vf7) @@ -487,7 +489,7 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: Function update-texture-anim has a return type of none, but the expression builder found a return statement. (defun update-texture-anim ((bucket bucket-id) (anim-array texture-anim-array)) - (local-vars (tex-height int) (fbp-for-tex uint) (layer-idx int)) + (local-vars (fbp-for-tex uint)) (if (-> *blit-displays-work* menu-mode) (return #f) ) @@ -500,8 +502,9 @@ ) (when dest-tex 0 - (let ((tex-width (-> dest-tex w))) - (set! tex-height (-> dest-tex h)) + (let ((tex-width (-> dest-tex w)) + (tex-height (-> dest-tex h)) + ) (cond ((or (= (-> dest-tex psm) (gs-psm ct32)) (= (-> dest-tex psm) (gs-psm mt8h))) (set! fbp-for-tex (shr (-> dest-tex dest 0) 5)) @@ -556,12 +559,13 @@ (set! (-> *texture-pool* ids (+ v1-32 a1-43)) (the-as uint 0)) ) ) - (set! layer-idx 0) - (while (< layer-idx (the-as int (-> anim num-layers))) - (let ((layer (-> anim data layer-idx))) - ((-> layer func) dma-buf fbp-for-tex tex-width tex-height layer (-> anim frame-time)) + (let ((layer-idx 0)) + (while (< layer-idx (the-as int (-> anim num-layers))) + (let ((layer (-> anim data layer-idx))) + ((-> layer func) dma-buf fbp-for-tex tex-width tex-height layer (-> anim frame-time)) + ) + (+! layer-idx 1) ) - (set! layer-idx (+ layer-idx 1)) ) ) (if (-> anim func) @@ -963,9 +967,7 @@ (set! v1-10 128) ) (else - (let* ((f0-9 (sin (* 128.0 (fmin 128.0 (* (the float (- s3-0 s5-0)) f30-0))))) - (f0-11 (* f0-9 f0-9)) - ) + (let ((f0-11 (square (sin (* 128.0 (fmin 128.0 (* (the float (- s3-0 s5-0)) f30-0))))))) (set! v1-10 (the int (* 128.0 f0-11))) ) ) @@ -1247,7 +1249,7 @@ ;; definition for method 9 of type texture-anim ;; INFO: Used lq/sq (defmethod init-textures! ((this texture-anim)) - (local-vars (a3-3 uint128) (sv-16 texture-page)) + (local-vars (a3-3 uint128)) (if (logtest? (the-as int (-> this func)) 1) (set! (-> this func) (the-as (function dma-buffer texture-anim int) (-> (the-as symbol (-> this func)) value)) @@ -1260,8 +1262,9 @@ ) ) (when (-> this tex-name) - (set! sv-16 (the-as texture-page #f)) - (let ((a0-3 (lookup-level-texture-by-name (-> this tex-name) (-> *level* loading-level) (& sv-16)))) + (let* ((sv-16 (the-as texture-page #f)) + (a0-3 (lookup-level-texture-by-name (-> this tex-name) (-> *level* loading-level) (& sv-16))) + ) (set! (-> this tex) a0-3) (when (and a0-3 sv-16) 0 diff --git a/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc b/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc index be05d087e8..9a9ede6c1d 100644 --- a/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/texture/texture_REF.gc @@ -756,14 +756,6 @@ This is the old Jak 1 background texture uploading system, which had this near/far concept for different mip levels. By jak 2, the background system switched to masks and uses the -pris variant of this function." - (local-vars - (data-ptr pointer) - (vram-ptr uint) - (tpage-num-chunks int) - (chunks-pending int) - (first-chunk int) - (tpage-id uint) - ) (if (not tpage) (return 0) ) @@ -771,69 +763,74 @@ (with-dma-buffer-add-bucket ((dma-buf (-> *display* frames (-> *display* on-screen) global-buf)) bucket ) - (set! data-ptr (-> tpage segment 0 block-data)) - (set! vram-ptr (shr (-> tpage segment 0 dest) 12)) - (set! tpage-num-chunks (the-as int (-> tpage segment 0 size))) - (set! chunks-pending 0) - (set! first-chunk 0) - (set! tpage-id (-> tpage id)) - (case mode - (((tex-upload-mode none)) - (return 0) - ) - (((tex-upload-mode seg0)) - ) - (((tex-upload-mode seg0-1)) - (set! tpage-num-chunks (the-as int (+ tpage-num-chunks (-> tpage segment 1 size)))) - ) - (((tex-upload-mode seg0-1-2)) - (set! tpage-num-chunks (the-as int (-> tpage size))) - ) - (((tex-upload-mode seg2)) - (set! data-ptr (-> tpage segment 2 block-data)) - (set! vram-ptr (shr (-> tpage segment 2 dest) 12)) - (set! tpage-num-chunks (the-as int (-> tpage segment 2 size))) - ) - ) - (set! tpage-num-chunks (shr (min (the-as int (-> dest-seg size)) (the-as int (+ tpage-num-chunks 4095))) 12)) - (dotimes (s1-0 tpage-num-chunks) - (let ((v1-28 (+ vram-ptr s1-0))) - (cond - ((zero? chunks-pending) - (when (!= (-> pool ids v1-28) tpage-id) - (set! first-chunk s1-0) - (set! (-> pool ids v1-28) tpage-id) - (set! chunks-pending (+ chunks-pending 1)) - ) + (let ((data-ptr (-> tpage segment 0 block-data)) + (vram-ptr (shr (-> tpage segment 0 dest) 12)) + (tpage-num-chunks (the-as int (-> tpage segment 0 size))) + (chunks-pending 0) + (first-chunk 0) + ) + (let ((tpage-id (-> tpage id))) + (case mode + (((tex-upload-mode none)) + (return 0) ) - ((= (-> pool ids v1-28) tpage-id) - (upload-vram-data - dma-buf - (the-as int (* (+ vram-ptr first-chunk) 64)) - (&+ data-ptr (shl first-chunk 14)) - (* chunks-pending 32) - 128 - ) - (+! num-chunks chunks-pending) - (set! chunks-pending 0) - 0 + (((tex-upload-mode seg0)) ) - (else - (set! (-> pool ids v1-28) tpage-id) - (set! chunks-pending (+ chunks-pending 1)) + (((tex-upload-mode seg0-1)) + (set! tpage-num-chunks (the-as int (+ (the-as uint tpage-num-chunks) (-> tpage segment 1 size)))) + ) + (((tex-upload-mode seg0-1-2)) + (set! tpage-num-chunks (the-as int (-> tpage size))) + ) + (((tex-upload-mode seg2)) + (set! data-ptr (-> tpage segment 2 block-data)) + (set! vram-ptr (shr (-> tpage segment 2 dest) 12)) + (set! tpage-num-chunks (the-as int (-> tpage segment 2 size))) + ) + ) + (set! tpage-num-chunks + (shr (min (the-as int (-> dest-seg size)) (the-as int (+ (the-as uint tpage-num-chunks) 4095))) 12) + ) + (dotimes (s1-0 tpage-num-chunks) + (let ((v1-28 (+ vram-ptr s1-0))) + (cond + ((zero? chunks-pending) + (when (!= (-> pool ids v1-28) tpage-id) + (set! first-chunk s1-0) + (set! (-> pool ids v1-28) tpage-id) + (+! chunks-pending 1) + ) + ) + ((= (-> pool ids v1-28) tpage-id) + (upload-vram-data + dma-buf + (the-as int (* (+ vram-ptr first-chunk) 64)) + (&+ data-ptr (shl first-chunk 14)) + (* chunks-pending 32) + 128 + ) + (+! num-chunks chunks-pending) + (set! chunks-pending 0) + 0 + ) + (else + (set! (-> pool ids v1-28) tpage-id) + (+! chunks-pending 1) + ) + ) ) ) ) - ) - (when (nonzero? chunks-pending) - (upload-vram-data - dma-buf - (the-as int (* (+ vram-ptr first-chunk) 64)) - (&+ data-ptr (shl first-chunk 14)) - (* chunks-pending 32) - 128 + (when (nonzero? chunks-pending) + (upload-vram-data + dma-buf + (the-as int (* (+ vram-ptr first-chunk) 64)) + (&+ data-ptr (shl first-chunk 14)) + (* chunks-pending 32) + 128 + ) + (+! num-chunks chunks-pending) ) - (+! num-chunks chunks-pending) ) (dma-buffer-add-gs-set dma-buf (texflush 1)) ) @@ -907,15 +904,6 @@ This lets us skip uploading entire textures, or mip levels that won't need. (side note: this optimization is what causes many of the texturing issues in pcsx2, where the ps2 and pcsx2 disagree on the mip level to use.)" - (local-vars - (data-ptr pointer) - (vram-ptr uint) - (tpage-num-chunks int) - (chunks-pending int) - (first-chunk int) - (tpage-id uint) - (should-upload symbol) - ) (if (not tpage) (return 0) ) @@ -923,54 +911,59 @@ (with-dma-buffer-add-bucket ((dma-buf (-> *display* frames (-> *display* on-screen) global-buf)) bucket ) - (set! data-ptr (-> tpage segment 0 block-data)) - (set! vram-ptr (shr (-> tpage segment 0 dest) 12)) - (set! tpage-num-chunks (the-as int (-> tpage size))) - (set! chunks-pending 0) - (set! first-chunk 0) - (set! tpage-id (-> tpage id)) - (set! tpage-num-chunks (shr (min (the-as int (-> dest-seg size)) (the-as int (+ tpage-num-chunks 4095))) 12)) - (dotimes (chunk-idx tpage-num-chunks) - (let ((chunk-dest (+ vram-ptr chunk-idx))) - (let ((mask-work (-> arg4 (/ chunk-idx 32)))) - (set! should-upload (logtest? mask-work (ash 1 (logand chunk-idx 31)))) + (let ((data-ptr (-> tpage segment 0 block-data)) + (vram-ptr (shr (-> tpage segment 0 dest) 12)) + (tpage-num-chunks (the-as int (-> tpage size))) + (chunks-pending 0) + (first-chunk 0) ) - (cond - ((zero? chunks-pending) - (when (and (!= (-> pool ids chunk-dest) tpage-id) should-upload) - (set! first-chunk chunk-idx) - (set! (-> pool ids chunk-dest) tpage-id) - (set! chunks-pending (+ chunks-pending 1)) - ) - ) - ((or (= (-> pool ids chunk-dest) tpage-id) (not should-upload)) - (upload-vram-data - dma-buf - (the-as int (* (+ vram-ptr first-chunk) 64)) - (&+ data-ptr (shl first-chunk 14)) - (* chunks-pending 32) - 128 - ) - (+! total-chunks-uploaded chunks-pending) - (set! chunks-pending 0) - 0 - ) - (else - (set! (-> pool ids chunk-dest) tpage-id) - (set! chunks-pending (+ chunks-pending 1)) + (let ((tpage-id (-> tpage id))) + (set! tpage-num-chunks + (shr (min (the-as int (-> dest-seg size)) (the-as int (+ (the-as uint tpage-num-chunks) 4095))) 12) + ) + (dotimes (chunk-idx tpage-num-chunks) + (let* ((chunk-dest (+ vram-ptr chunk-idx)) + (mask-work (-> arg4 (/ chunk-idx 32))) + (should-upload (logtest? mask-work (ash 1 (logand chunk-idx 31)))) + ) + (cond + ((zero? chunks-pending) + (when (and (!= (-> pool ids chunk-dest) tpage-id) should-upload) + (set! first-chunk chunk-idx) + (set! (-> pool ids chunk-dest) tpage-id) + (+! chunks-pending 1) + ) + ) + ((or (= (-> pool ids chunk-dest) tpage-id) (not should-upload)) + (upload-vram-data + dma-buf + (the-as int (* (+ vram-ptr first-chunk) 64)) + (&+ data-ptr (shl first-chunk 14)) + (* chunks-pending 32) + 128 + ) + (+! total-chunks-uploaded chunks-pending) + (set! chunks-pending 0) + 0 + ) + (else + (set! (-> pool ids chunk-dest) tpage-id) + (+! chunks-pending 1) + ) + ) ) ) ) - ) - (when (nonzero? chunks-pending) - (upload-vram-data - dma-buf - (the-as int (* (+ vram-ptr first-chunk) 64)) - (&+ data-ptr (shl first-chunk 14)) - (* chunks-pending 32) - 128 + (when (nonzero? chunks-pending) + (upload-vram-data + dma-buf + (the-as int (* (+ vram-ptr first-chunk) 64)) + (&+ data-ptr (shl first-chunk 14)) + (* chunks-pending 32) + 128 + ) + (+! total-chunks-uploaded chunks-pending) ) - (+! total-chunks-uploaded chunks-pending) ) (dma-buffer-add-gs-set dma-buf (texflush 1)) ) @@ -1494,9 +1487,8 @@ ;; definition for method 12 of type texture-page (defmethod add-to-dma-buffer ((page texture-page) (buf dma-buffer) (mode tex-upload-mode)) "Add upload DMA to a DMA buffer. Wrapper for upload-vram-data." - (local-vars (sv-16 int)) - (let ((v1-0 mode)) - (set! sv-16 (cond + (let* ((v1-0 mode) + (sv-16 (cond ((= v1-0 (tex-upload-mode none)) 0 ) @@ -1510,16 +1502,17 @@ (the-as int (-> page segment (the-as int mode) size)) ) ) - ) - ) - (let* ((v1-7 (max 0 (the-as int mode))) - (a3-4 (* (/ (+ (/ sv-16 64) 63) 64) 32)) - (t1-0 (shr (-> page segment v1-7 dest) 6)) - (a2-10 (-> page segment v1-7 block-data)) + ) ) - (upload-vram-data buf (the-as int t1-0) a2-10 a3-4 128) + (let* ((v1-7 (max 0 (the-as int mode))) + (a3-4 (* (/ (+ (/ sv-16 64) 63) 64) 32)) + (t1-0 (shr (-> page segment v1-7 dest) 6)) + (a2-10 (-> page segment v1-7 block-data)) + ) + (upload-vram-data buf (the-as int t1-0) a2-10 a3-4 128) + ) + sv-16 ) - sv-16 ) ;; definition for function texture-relocate @@ -1616,88 +1609,86 @@ "Set up the font texture. In normal use, the font texture is allocated, and currently uploaded to, the common segment. This function copies that to the unused upper 8-bits of the depth buffer, and sets up the font renderer to point to that address." - (local-vars (sv-16 int) (sv-20 int)) - (let ((s3-0 (-> this font-palette))) - (set! sv-16 (-> this cur)) - (set! sv-20 (/ s3-0 64)) - (let ((s5-0 - (texture-page-login (new 'static 'texture-id :index #x1 :page #xc04) texture-page-default-allocate global) - ) - ) - (if (and s5-0 (-> s5-0 page)) - (set! sv-16 (the-as int (-> s5-0 page segment 0 dest))) - ) - (let ((s4-0 *txt-dma-list*)) - (let ((v1-6 s4-0)) - (set! (-> v1-6 base) (-> v1-6 data)) - (set! (-> v1-6 end) (&-> v1-6 data-buffer (-> v1-6 allocated-length))) - ) - (let ((s2-0 (lookup-texture-by-id (new 'static 'texture-id :index #x1 :page #xc04))) - (s1-0 #xc2000) - (s0-0 36) - ) - (set! (-> s2-0 h) 320) - (texture-relocate s4-0 s2-0 s1-0 (the-as gs-psm s0-0) s3-0) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-0-tmpl)) s2-0 s1-0 s0-0 sv-20) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-2-tmpl)) s2-0 s1-0 s0-0 sv-20) - ) - (let ((s3-1 (lookup-texture-by-id (new 'static 'texture-id :page #xc04))) - (s2-1 #xc2000) - (s1-1 44) - ) - (set! (-> s3-1 h) 320) - (texture-relocate s4-0 s3-1 s2-1 (the-as gs-psm s1-1) -1) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-1-tmpl)) s3-1 s2-1 s1-1 sv-20) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-3-tmpl)) s3-1 s2-1 s1-1 sv-20) - ) - (let ((s3-2 (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #xc04))) - (s2-2 #x90000) - (s1-2 36) - ) - (set! (-> s3-2 h) 800) - (texture-relocate s4-0 s3-2 s2-2 (the-as gs-psm s1-2) -1) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-0-tmpl)) s3-2 s2-2 s1-2 sv-20) - ) - (let ((s3-3 (lookup-texture-by-id (new 'static 'texture-id :index #x2 :page #xc04))) - (s2-3 #x90000) - (s1-3 44) - ) - (set! (-> s3-3 h) 800) - (texture-relocate s4-0 s3-3 s2-3 (the-as gs-psm s1-3) -1) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-1-tmpl)) s3-3 s2-3 s1-3 sv-20) - ) - (let ((s3-4 (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc04))) - (s2-4 #x5e000) - (s1-4 36) - ) - (set! (-> s3-4 h) 800) - (texture-relocate s4-0 s3-4 s2-4 (the-as gs-psm s1-4) -1) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-2-tmpl)) s3-4 s2-4 s1-4 sv-20) - ) - (let ((s3-5 (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xc04))) - (s2-5 #x5e000) - (s1-5 44) - ) - (set! (-> s3-5 h) 800) - (texture-relocate s4-0 s3-5 s2-5 (the-as gs-psm s1-5) -1) - (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-3-tmpl)) s3-5 s2-5 s1-5 sv-20) - ) - (dma-buffer-add-gs-set s4-0 (texflush 1)) - (let* ((v1-31 s4-0) - (a0-32 (the-as object (-> v1-31 base))) - ) - (set! (-> (the-as dma-packet a0-32) dma) (new 'static 'dma-tag :id (dma-tag-id end))) - (set! (-> (the-as (pointer int64) a0-32) 1) 0) - (set! (-> v1-31 base) (&+ (the-as pointer a0-32) 16)) - ) - (dma-buffer-send-chain (the-as dma-bank-source #x10009000) s4-0) + (let* ((s3-0 (-> this font-palette)) + (sv-16 (-> this cur)) + (sv-20 (/ s3-0 64)) + (s5-0 + (texture-page-login (new 'static 'texture-id :index #x1 :page #xc04) texture-page-default-allocate global) + ) + ) + (if (and s5-0 (-> s5-0 page)) + (set! sv-16 (the-as int (-> s5-0 page segment 0 dest))) ) - (dma-sync (the-as pointer #x10009000) 0 0) - (if (and s5-0 (-> s5-0 page) (= (-> this cur) (+ sv-16 (-> s5-0 page size)))) - (set! (-> this cur) sv-16) - (format 0 "ERROR: could not resize texture pool to remove gamefont.~%") - ) + (let ((s4-0 *txt-dma-list*)) + (let ((v1-6 s4-0)) + (set! (-> v1-6 base) (-> v1-6 data)) + (set! (-> v1-6 end) (&-> v1-6 data-buffer (-> v1-6 allocated-length))) + ) + (let ((s2-0 (lookup-texture-by-id (new 'static 'texture-id :index #x1 :page #xc04))) + (s1-0 #xc2000) + (s0-0 36) + ) + (set! (-> s2-0 h) 320) + (texture-relocate s4-0 s2-0 s1-0 (the-as gs-psm s0-0) s3-0) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-0-tmpl)) s2-0 s1-0 s0-0 sv-20) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-2-tmpl)) s2-0 s1-0 s0-0 sv-20) + ) + (let ((s3-1 (lookup-texture-by-id (new 'static 'texture-id :page #xc04))) + (s2-1 #xc2000) + (s1-1 44) + ) + (set! (-> s3-1 h) 320) + (texture-relocate s4-0 s3-1 s2-1 (the-as gs-psm s1-1) -1) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-1-tmpl)) s3-1 s2-1 s1-1 sv-20) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* small-font-3-tmpl)) s3-1 s2-1 s1-1 sv-20) + ) + (let ((s3-2 (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #xc04))) + (s2-2 #x90000) + (s1-2 36) + ) + (set! (-> s3-2 h) 800) + (texture-relocate s4-0 s3-2 s2-2 (the-as gs-psm s1-2) -1) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-0-tmpl)) s3-2 s2-2 s1-2 sv-20) + ) + (let ((s3-3 (lookup-texture-by-id (new 'static 'texture-id :index #x2 :page #xc04))) + (s2-3 #x90000) + (s1-3 44) + ) + (set! (-> s3-3 h) 800) + (texture-relocate s4-0 s3-3 s2-3 (the-as gs-psm s1-3) -1) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-1-tmpl)) s3-3 s2-3 s1-3 sv-20) + ) + (let ((s3-4 (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc04))) + (s2-4 #x5e000) + (s1-4 36) + ) + (set! (-> s3-4 h) 800) + (texture-relocate s4-0 s3-4 s2-4 (the-as gs-psm s1-4) -1) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-2-tmpl)) s3-4 s2-4 s1-4 sv-20) + ) + (let ((s3-5 (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xc04))) + (s2-5 #x5e000) + (s1-5 44) + ) + (set! (-> s3-5 h) 800) + (texture-relocate s4-0 s3-5 s2-5 (the-as gs-psm s1-5) -1) + (font-set-tex0 (the-as (pointer gs-tex0) (-> *font-work* large-font-3-tmpl)) s3-5 s2-5 s1-5 sv-20) + ) + (dma-buffer-add-gs-set s4-0 (texflush 1)) + (let* ((v1-31 s4-0) + (a0-32 (the-as object (-> v1-31 base))) + ) + (set! (-> (the-as dma-packet a0-32) dma) (new 'static 'dma-tag :id (dma-tag-id end))) + (set! (-> (the-as (pointer int64) a0-32) 1) 0) + (set! (-> v1-31 base) (&+ (the-as pointer a0-32) 16)) + ) + (dma-buffer-send-chain (the-as dma-bank-source #x10009000) s4-0) ) + (dma-sync (the-as pointer #x10009000) 0 0) + (if (and s5-0 (-> s5-0 page) (= (-> this cur) (+ sv-16 (-> s5-0 page size)))) + (set! (-> this cur) sv-16) + (format 0 "ERROR: could not resize texture pool to remove gamefont.~%") + ) ) 0 (none) @@ -1887,18 +1878,18 @@ ;; definition for function lookup-texture-by-name (defun lookup-texture-by-name ((tex-name string) (page-name string) (page-out (pointer texture-page))) "Get a loaded texture by name. Slow." - (local-vars (sv-16 texture-page-dir)) - (set! sv-16 *texture-page-dir*) - (dotimes (s3-0 (-> sv-16 length)) - (let ((s2-0 (-> sv-16 entries s3-0 page))) - (when (and s2-0 (or (not page-name) (string= (-> s2-0 name) page-name))) - (dotimes (s1-0 (-> s2-0 length)) - (let ((s0-0 (-> s2-0 data s1-0))) - (when (and s0-0 (string= (-> s0-0 name) tex-name)) - (if page-out - (set! (-> page-out 0) s2-0) - ) - (return s0-0) + (let ((sv-16 *texture-page-dir*)) + (dotimes (s3-0 (-> sv-16 length)) + (let ((s2-0 (-> sv-16 entries s3-0 page))) + (when (and s2-0 (or (not page-name) (string= (-> s2-0 name) page-name))) + (dotimes (s1-0 (-> s2-0 length)) + (let ((s0-0 (-> s2-0 data s1-0))) + (when (and s0-0 (string= (-> s0-0 name) tex-name)) + (if page-out + (set! (-> page-out 0) s2-0) + ) + (return s0-0) + ) ) ) ) @@ -1912,16 +1903,16 @@ ;; WARN: Return type mismatch int vs texture-id. (defun lookup-texture-id-by-name ((tex-name string) (page-name string)) "Get the ID of a loaded texture by name. Slow." - (local-vars (sv-16 texture-page-dir)) - (set! sv-16 *texture-page-dir*) - (dotimes (gp-0 (-> sv-16 length)) - (let ((s3-0 (-> sv-16 entries gp-0 page))) - (when (and s3-0 (or (not page-name) (string= (-> s3-0 name) page-name))) - (dotimes (s2-0 (-> s3-0 length)) - (let ((v1-7 (-> s3-0 data s2-0))) - (if (and v1-7 (string= (-> v1-7 name) tex-name)) - (return (new 'static 'texture-id :page gp-0 :index s2-0)) - ) + (let ((sv-16 *texture-page-dir*)) + (dotimes (gp-0 (-> sv-16 length)) + (let ((s3-0 (-> sv-16 entries gp-0 page))) + (when (and s3-0 (or (not page-name) (string= (-> s3-0 name) page-name))) + (dotimes (s2-0 (-> s3-0 length)) + (let ((v1-7 (-> s3-0 data s2-0))) + (if (and v1-7 (string= (-> v1-7 name) tex-name)) + (return (new 'static 'texture-id :page gp-0 :index s2-0)) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/level/level_REF.gc b/test/decompiler/reference/jak2/engine/level/level_REF.gc index 653d722a9f..63e6457db0 100644 --- a/test/decompiler/reference/jak2/engine/level/level_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/level_REF.gc @@ -369,7 +369,6 @@ ;; definition for method 17 of type level (defmethod load-continue ((this level)) - (local-vars (sv-16 symbol)) (when (-> this linking) (when (nonzero? (link-resume)) (set! (-> this linking) #f) @@ -415,8 +414,9 @@ ) (case (-> this status) (('loading) - (set! sv-16 (the-as symbol #f)) - (let ((s5-0 (dgo-load-get-next (& sv-16)))) + (let* ((sv-16 (the-as symbol #f)) + (s5-0 (dgo-load-get-next (& sv-16))) + ) (when s5-0 (set! (-> this load-buffer-last) (the-as uint s5-0)) (+! (-> *level* load-size) (-> (the-as (pointer uint32) s5-0))) @@ -827,14 +827,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defun level-update-after-load ((lev level) (lstate login-state)) - (local-vars - (current-time int) - (end-time int) - (start-time int) - (sv-16 int) - (proto prototype-bucket-tie) - (geom-idx int) - ) + (local-vars (current-time int) (end-time int) (start-time int)) (set! *level-index* (-> lev index)) 0 (let ((drawable-trees (-> lev bsp drawable-trees))) @@ -921,41 +914,44 @@ (let ((proto-array (-> (the-as drawable-tree-instance-tie current-array) prototypes prototype-array-tie))) (let ((protos (-> (the-as drawable-tree-instance-tie current-array) prototypes))) (when (< login-state-pos (-> proto-array length)) - (set! sv-16 0) - (while (< sv-16 10) - (when (< login-state-pos (-> proto-array length)) - (set! proto (-> proto-array array-data (the-as uint login-state-pos))) - (+! (-> protos prototype-max-qwc) 32) - (cond - ((logtest? (-> proto flags) (prototype-flags tpage-alpha)) - (set! *texture-masks* (-> *level* level *level-index* bsp alpha-masks data (-> proto texture-masks-index))) - ) - ((logtest? (-> proto flags) (prototype-flags tpage-water)) - (set! *texture-masks* (-> *level* level *level-index* bsp water-masks data (-> proto texture-masks-index))) - ) - (else - (set! *texture-masks* (-> *level* level *level-index* bsp tfrag-masks data (-> proto texture-masks-index))) - ) - ) - (when (and *debug-segment* (-> *screen-shot-work* highres-enable)) - (dotimes (v1-105 4) - (+! (-> proto dists data v1-105) 40960000.0) - (set! (-> proto rdists data v1-105) (/ 1.0 (-> proto dists data v1-105))) - ) - ) - (set! geom-idx 0) - (while (< geom-idx 4) - (let ((geom (-> proto tie-geom geom-idx))) - (when (nonzero? geom) - (+! (-> protos prototype-max-qwc) (* 7 (-> geom length))) - (login geom) + (let ((sv-16 0)) + (while (< sv-16 10) + (when (< login-state-pos (-> proto-array length)) + (let ((proto (-> proto-array array-data (the-as uint login-state-pos)))) + (+! (-> protos prototype-max-qwc) 32) + (cond + ((logtest? (-> proto flags) (prototype-flags tpage-alpha)) + (set! *texture-masks* (-> *level* level *level-index* bsp alpha-masks data (-> proto texture-masks-index))) + ) + ((logtest? (-> proto flags) (prototype-flags tpage-water)) + (set! *texture-masks* (-> *level* level *level-index* bsp water-masks data (-> proto texture-masks-index))) + ) + (else + (set! *texture-masks* (-> *level* level *level-index* bsp tfrag-masks data (-> proto texture-masks-index))) + ) + ) + (when (and *debug-segment* (-> *screen-shot-work* highres-enable)) + (dotimes (v1-105 4) + (+! (-> proto dists data v1-105) 40960000.0) + (set! (-> proto rdists data v1-105) (/ 1.0 (-> proto dists data v1-105))) + ) + ) + (let ((geom-idx 0)) + (while (< geom-idx 4) + (let ((geom (-> proto tie-geom geom-idx))) + (when (nonzero? geom) + (+! (-> protos prototype-max-qwc) (* 7 (-> geom length))) + (login geom) + ) + ) + (+! geom-idx 1) + ) ) ) - (set! geom-idx (+ geom-idx 1)) + (set! login-state-pos (the-as int (+ (the-as uint login-state-pos) 1))) ) - (set! login-state-pos (the-as int (+ (the-as uint login-state-pos) 1))) + (+! sv-16 1) ) - (set! sv-16 (+ sv-16 1)) ) (set! (-> lstate pos) (the-as uint login-state-pos)) ) @@ -1100,7 +1096,6 @@ ;; definition for method 25 of type level ;; INFO: Used lq/sq (defmethod birth ((this level)) - (local-vars (sv-96 int)) (case (-> this status) (('loaded) (let ((s5-0 loading-level) @@ -1142,10 +1137,11 @@ (assign-draw-indices *level*) (let ((s0-0 (-> this bsp nav-meshes))) (when (nonzero? s0-0) - (set! sv-96 0) - (while (< sv-96 (-> s0-0 length)) - (birth! (-> s0-0 sv-96)) - (set! sv-96 (+ sv-96 1)) + (let ((sv-96 0)) + (while (< sv-96 (-> s0-0 length)) + (birth! (-> s0-0 sv-96)) + (+! sv-96 1) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/level/region_REF.gc b/test/decompiler/reference/jak2/engine/level/region_REF.gc index 3abc7cd57b..0be1901121 100644 --- a/test/decompiler/reference/jak2/engine/level/region_REF.gc +++ b/test/decompiler/reference/jak2/engine/level/region_REF.gc @@ -91,53 +91,54 @@ ;; definition for method 17 of type drawable-region-prim ;; WARN: Return type mismatch int vs none. (defmethod debug-draw-region ((this drawable-region-prim) (arg0 int)) - (local-vars (sv-32 vector2h) (sv-36 vector)) - (set! sv-32 (new 'stack 'vector2h)) - (set! sv-36 (-> this bsphere)) - (add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (new 'static 'rgba :r #xff :g #xff :a #x80)) - (when (nonzero? (-> this region)) - (let ((s5-0 add-debug-text-3d) - (s4-0 #t) - (s3-0 318) - ) - (format (clear *temp-string*) "region-~D~%" (-> this region id)) - (s5-0 s4-0 (the-as bucket-id s3-0) *temp-string* sv-36 (font-color white) sv-32) - ) - (+! (-> sv-32 y) 8) - (let ((s5-1 (-> this region on-enter))) - (when s5-1 - (let ((s4-1 add-debug-text-3d) - (s3-1 #t) - (s2-1 318) - ) - (format (clear *temp-string*) "(on-enter ~S)" s5-1) - (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* sv-36 (font-color white) sv-32) - ) - (+! (-> sv-32 y) 8) + (let ((sv-32 (new 'stack 'vector2h)) + (sv-36 (-> this bsphere)) ) - ) - (let ((s5-2 (-> this region on-inside))) - (when s5-2 - (let ((s4-2 add-debug-text-3d) - (s3-2 #t) - (s2-2 318) - ) - (format (clear *temp-string*) "(on-inside ~S)" s5-2) - (s4-2 s3-2 (the-as bucket-id s2-2) *temp-string* sv-36 (font-color white) sv-32) - ) - (+! (-> sv-32 y) 8) + (add-debug-x #t (bucket-id debug-no-zbuf1) sv-36 (new 'static 'rgba :r #xff :g #xff :a #x80)) + (when (nonzero? (-> this region)) + (let ((s5-0 add-debug-text-3d) + (s4-0 #t) + (s3-0 318) + ) + (format (clear *temp-string*) "region-~D~%" (-> this region id)) + (s5-0 s4-0 (the-as bucket-id s3-0) *temp-string* sv-36 (font-color white) sv-32) ) - ) - (let ((gp-1 (-> this region on-exit))) - (when gp-1 - (let ((s5-3 add-debug-text-3d) - (s4-3 #t) - (s3-3 318) - ) - (format (clear *temp-string*) "(on-exit ~S)" gp-1) - (s5-3 s4-3 (the-as bucket-id s3-3) *temp-string* sv-36 (font-color white) sv-32) + (+! (-> sv-32 y) 8) + (let ((s5-1 (-> this region on-enter))) + (when s5-1 + (let ((s4-1 add-debug-text-3d) + (s3-1 #t) + (s2-1 318) + ) + (format (clear *temp-string*) "(on-enter ~S)" s5-1) + (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* sv-36 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((s5-2 (-> this region on-inside))) + (when s5-2 + (let ((s4-2 add-debug-text-3d) + (s3-2 #t) + (s2-2 318) + ) + (format (clear *temp-string*) "(on-inside ~S)" s5-2) + (s4-2 s3-2 (the-as bucket-id s2-2) *temp-string* sv-36 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) + ) + ) + (let ((gp-1 (-> this region on-exit))) + (when gp-1 + (let ((s5-3 add-debug-text-3d) + (s4-3 #t) + (s3-3 318) + ) + (format (clear *temp-string*) "(on-exit ~S)" gp-1) + (s5-3 s4-3 (the-as bucket-id s3-3) *temp-string* sv-36 (font-color white) sv-32) + ) + (+! (-> sv-32 y) 8) ) - (+! (-> sv-32 y) 8) ) ) ) @@ -337,7 +338,6 @@ ;; definition for method 18 of type drawable-region-face (defmethod track-region ((this drawable-region-face) (arg0 region-prim-area)) "TODO" - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 object)) (-> this region) (let* ((s4-0 (-> this data)) (v1-1 (-> s4-0 normal)) @@ -346,46 +346,24 @@ ) (when (!= a0-3 s3-0) (when (nonzero? (-> s4-0 num-points)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (the-as (inline-array vector) (-> s4-0 points))) - (ray-plane-intersect - sv-48 - sv-52 - (-> arg0 pos) - (-> arg0 ray) - (-> (the-as (inline-array vector) sv-56) 0) - (-> (the-as (inline-array vector) sv-56) 1) - (-> (the-as (inline-array vector) sv-56) 2) - ) - (let ((s4-1 (-> s4-0 num-points)) - (s2-0 0) - (s1-0 (vector-negate! (new 'stack-no-clear 'vector) sv-52)) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + (sv-56 (-> s4-0 points)) ) - (while (< (+ s2-0 2) (the-as int s4-1)) - (if (the-as - (inline-array vector) - (or (point-in-triangle-cross - sv-48 - sv-52 - (-> (the-as (inline-array vector) sv-56) 0) - (-> (the-as (inline-array vector) sv-56) 1) - (-> (the-as (inline-array vector) sv-56) 2) - ) - (the-as (inline-array vector) (point-in-triangle-cross - sv-48 - s1-0 - (-> (the-as (inline-array vector) sv-56) 0) - (-> (the-as (inline-array vector) sv-56) 1) - (-> (the-as (inline-array vector) sv-56) 2) - ) - ) - ) - ) - (goto cfg-17) + (ray-plane-intersect sv-48 sv-52 (-> arg0 pos) (-> arg0 ray) (-> sv-56 0) (-> sv-56 1) (-> sv-56 2)) + (let ((s4-1 (-> s4-0 num-points)) + (s2-0 0) + (s1-0 (vector-negate! (new 'stack-no-clear 'vector) sv-52)) ) - (+! s2-0 1) - (set! sv-56 (-> (the-as (inline-array vector) sv-56) 1)) + (while (< (+ s2-0 2) (the-as int s4-1)) + (if (or (point-in-triangle-cross sv-48 sv-52 (-> sv-56 0) (-> sv-56 1) (-> sv-56 2)) + (point-in-triangle-cross sv-48 s1-0 (-> sv-56 0) (-> sv-56 1) (-> sv-56 2)) + ) + (goto cfg-17) + ) + (+! s2-0 1) + (set! sv-56 (the-as (inline-array vector) (-> sv-56 1))) + ) ) ) (set! s3-0 s3-0) @@ -487,7 +465,6 @@ ;; WARN: Return type mismatch int vs symbol. (defmethod point-in-region-debug! ((this region) (arg0 vector)) "Debug check to see if point is in region. This is not efficient, since it has to find the parent geometry of this region." - (local-vars (sv-16 int) (sv-32 int)) (sphere<-vector+r! (the-as sphere (-> (the-as region-prim-area #x70000000) pos)) arg0 0.0) (dotimes (s5-0 (-> *level* length)) (let ((s4-0 (-> *level* level s5-0))) @@ -498,9 +475,10 @@ (s1-0 (-> s4-0 bsp region-trees s2-0)) ) (while (< s2-0 s3-0) - (let ((s0-0 (-> s1-0 data2 (+ (-> s1-0 length) -1) length))) - (set! sv-16 0) - (set! sv-32 (+ (+ (* sv-16 32) 32) (the-as int (-> s1-0 data2 (+ (-> s1-0 length) -1))))) + (let* ((s0-0 (-> s1-0 data2 (+ (-> s1-0 length) -1) length)) + (sv-16 0) + (sv-32 (+ (+ (* sv-16 32) 32) (the-as int (-> s1-0 data2 (+ (-> s1-0 length) -1))))) + ) (while (< sv-16 s0-0) (if (and (= (-> (the-as drawable-region-prim sv-32) region) this) (within-area? @@ -510,7 +488,7 @@ ) (return (the-as symbol sv-32)) ) - (set! sv-16 (+ sv-16 1)) + (+! sv-16 1) (set! sv-32 (+ (+ (* sv-16 32) 32) (the-as int (-> s1-0 data2 (+ (-> s1-0 length) -1))))) ) ) @@ -553,33 +531,33 @@ ;; definition for function region-tree-execute ;; WARN: Return type mismatch int vs none. (defun region-tree-execute ((arg0 symbol) (arg1 vector) (arg2 vector)) - (local-vars (sv-32 vector)) - (set! sv-32 (vector-average! (new 'stack-no-clear 'vector) arg1 arg2)) - (set! (-> sv-32 w) (* 0.5 (vector-vector-distance arg1 arg2))) - (set! (-> (the-as region-prim-area #x70000000) region-prim-list num-items) 0) - (set! (-> (the-as region-prim-area #x70000000) region-enter-count) 0) - (set! (-> (the-as region-prim-area #x70000000) region-exit-count) 0) - (set! (-> (the-as region-prim-area #x70000000) region-inside-count) 0) - (set! (-> (the-as region-prim-area #x70000000) region-start-count) 0) - (sphere<-vector+r! (the-as sphere (+ 1296 #x70000000)) arg1 0.0) - (sphere<-vector+r! (the-as sphere (+ 1312 #x70000000)) arg2 0.0) - (vector-! (the-as vector (+ 1328 #x70000000)) arg2 arg1) - (vector-! (the-as vector (+ 1344 #x70000000)) arg1 arg2) - (dotimes (s5-1 (-> *level* length)) - (let ((v1-17 (-> *level* level s5-1))) - (when (= (-> v1-17 status) 'active) - (let ((s4-1 (-> v1-17 bsp region-trees))) - (when (nonzero? s4-1) - (let* ((s3-0 (-> s4-1 length)) - (s2-0 0) - (a0-14 (-> s4-1 s2-0)) - ) - (while (< s2-0 s3-0) - (if (= (-> a0-14 name) arg0) - (collect-regions a0-14 (the-as sphere sv-32) 0 (the-as region-prim-list (+ #x70000000 0))) - ) - (+! s2-0 1) - (set! a0-14 (-> s4-1 s2-0)) + (let ((sv-32 (vector-average! (new 'stack-no-clear 'vector) arg1 arg2))) + (set! (-> sv-32 w) (* 0.5 (vector-vector-distance arg1 arg2))) + (set! (-> (the-as region-prim-area #x70000000) region-prim-list num-items) 0) + (set! (-> (the-as region-prim-area #x70000000) region-enter-count) 0) + (set! (-> (the-as region-prim-area #x70000000) region-exit-count) 0) + (set! (-> (the-as region-prim-area #x70000000) region-inside-count) 0) + (set! (-> (the-as region-prim-area #x70000000) region-start-count) 0) + (sphere<-vector+r! (the-as sphere (+ 1296 #x70000000)) arg1 0.0) + (sphere<-vector+r! (the-as sphere (+ 1312 #x70000000)) arg2 0.0) + (vector-! (the-as vector (+ 1328 #x70000000)) arg2 arg1) + (vector-! (the-as vector (+ 1344 #x70000000)) arg1 arg2) + (dotimes (s5-1 (-> *level* length)) + (let ((v1-17 (-> *level* level s5-1))) + (when (= (-> v1-17 status) 'active) + (let ((s4-1 (-> v1-17 bsp region-trees))) + (when (nonzero? s4-1) + (let* ((s3-0 (-> s4-1 length)) + (s2-0 0) + (a0-14 (-> s4-1 s2-0)) + ) + (while (< s2-0 s3-0) + (if (= (-> a0-14 name) arg0) + (collect-regions a0-14 (the-as sphere sv-32) 0 (the-as region-prim-list (+ #x70000000 0))) + ) + (+! s2-0 1) + (set! a0-14 (-> s4-1 s2-0)) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/load/decomp_REF.gc b/test/decompiler/reference/jak2/engine/load/decomp_REF.gc index cff24b4c86..a06ea447bc 100644 --- a/test/decompiler/reference/jak2/engine/load/decomp_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/decomp_REF.gc @@ -257,7 +257,7 @@ ;; definition for method 16 of type level ;; INFO: Used lq/sq (defmethod update-vis! ((this level) (vis-info level-vis-info) (unused uint) (in-bsp-vis-string (pointer uint8))) - (local-vars (t0-3 uint128) (extra-vis-length int) (extra-vis-dest (pointer int8))) + (local-vars (t0-3 uint128)) (let* ((cam-leaf-idx (-> vis-info from-bsp current-leaf-idx)) (curr-vis-string-offset (-> vis-info current-vis-string)) (desired-vis-string-offset (-> vis-info vis-string cam-leaf-idx)) @@ -347,9 +347,10 @@ (set! (-> (the-as (pointer int128) (&+ spad-start (* a0-23 16)))) 0) ) ) - (set! extra-vis-length (-> this bsp extra-vis-list-length)) - (set! extra-vis-dest (&+ spad-start (- list-len extra-vis-length))) - (let ((extra-vis-in (unpack-vis (-> this bsp drawable-trees) spad-start (the-as (pointer int8) vis-buf)))) + (let* ((extra-vis-length (-> this bsp extra-vis-list-length)) + (extra-vis-dest (&+ spad-start (- list-len extra-vis-length))) + (extra-vis-in (unpack-vis (-> this bsp drawable-trees) spad-start (the-as (pointer int8) vis-buf))) + ) (dotimes (extra-vis-idx extra-vis-length) (let ((vis-byte (-> extra-vis-in 0))) (set! extra-vis-in (&-> extra-vis-in 1)) diff --git a/test/decompiler/reference/jak2/engine/load/loader_REF.gc b/test/decompiler/reference/jak2/engine/load/loader_REF.gc index bbbf2cc221..4fdb74b7a8 100644 --- a/test/decompiler/reference/jak2/engine/load/loader_REF.gc +++ b/test/decompiler/reference/jak2/engine/load/loader_REF.gc @@ -16,22 +16,18 @@ ;; definition for method 3 of type load-dir ;; INFO: Used lq/sq (defmethod inspect ((this load-dir)) - (local-vars (sv-16 basic)) (format #t "[~8x] ~A~%" this (-> this type)) (format #t "~Tlevel: ~A~%" (-> this lev)) (format #t "~Tallocated-length: ~D~%" (-> this string-array allocated-length)) (format #t "~Tlength: ~D~%" (-> this string-array length)) (dotimes (s5-0 (-> this string-array length)) - (let ((s4-0 format) - (s3-0 #t) - (s2-0 "~T [~D] ~S ~A (~D bytes)~%") - (s1-0 s5-0) - (s0-0 (-> this string-array s5-0)) - ) - (set! sv-16 (-> this data-array s5-0)) - (let ((t1-0 (mem-size (-> this data-array s5-0) #f 0))) - (s4-0 s3-0 s2-0 s1-0 s0-0 sv-16 t1-0) - ) + (format + #t + "~T [~D] ~S ~A (~D bytes)~%" + s5-0 + (-> this string-array s5-0) + (-> this data-array s5-0) + (mem-size (-> this data-array s5-0) #f 0) ) ) this @@ -837,7 +833,7 @@ ;; definition for function ja-play-spooled-anim (defbehavior ja-play-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 art-joint-anim) (arg3 (function process-drawable symbol))) - (local-vars (v0-59 int) (sv-176 int)) + (local-vars (v0-59 int)) (let ((s2-0 arg2) (s1-0 arg3) (gp-0 (new 'stack 'spooler-block arg2 arg3)) @@ -1063,65 +1059,66 @@ (let* ((f30-0 (* 0.05859375 (-> s5-8 speed))) (f28-0 (+ (-> gp-0 part-audio-start) (/ (the float (+ (-> s5-8 frames num-frames) -1)) f30-0))) ) - (set! sv-176 (current-str-pos (-> gp-0 sid))) - (set-time! (-> gp-0 good-time)) - (until (>= (the float v0-59) f28-0) - (if (= (-> self skel root-channel 0) (-> self skel channel)) - (logior! (-> self skel status) (joint-control-status valid-spooled-frame)) - ) - (if (or ((-> gp-0 break-func) self) - (and (<= sv-176 0) (time-elapsed? (-> gp-0 good-time) (seconds 4))) - (and (< 300 (-> gp-0 good-count)) (<= sv-176 0)) - ) - (goto cfg-130) - ) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - (-> gp-0 anim name) - (-> gp-0 part) - -20.0 - (-> gp-0 sid) - ) - (if (< (+ (-> gp-0 part) 1) (-> gp-0 anim parts)) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - (-> gp-0 anim name) - (+ (-> gp-0 part) 1) - -10.0 - (-> gp-0 sid) + (let ((sv-176 (current-str-pos (-> gp-0 sid)))) + (set-time! (-> gp-0 good-time)) + (until (>= (the float v0-59) f28-0) + (if (= (-> self skel root-channel 0) (-> self skel channel)) + (logior! (-> self skel status) (joint-control-status valid-spooled-frame)) ) - (logclear! (-> self skel status) (joint-control-status spooling-not-last-block)) + (if (or ((-> gp-0 break-func) self) + (and (<= sv-176 0) (time-elapsed? (-> gp-0 good-time) (seconds 4))) + (and (< 300 (-> gp-0 good-count)) (<= sv-176 0)) + ) + (goto cfg-130) + ) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> gp-0 anim name) + (-> gp-0 part) + -20.0 + (-> gp-0 sid) ) - (execute-commands-up-to *load-state* (ja-aframe-num 0)) - (cond - ((and (< (-> gp-0 old-pos) sv-176) (< -1 sv-176)) - (+! (-> gp-0 good-count) (- (current-time) (-> self clock old-frame-counter))) - (set-time! (-> gp-0 good-time)) - ) - (else - 0 + (if (< (+ (-> gp-0 part) 1) (-> gp-0 anim parts)) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (-> gp-0 anim name) + (+ (-> gp-0 part) 1) + -10.0 + (-> gp-0 sid) + ) + (logclear! (-> self skel status) (joint-control-status spooling-not-last-block)) + ) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + (cond + ((and (< (-> gp-0 old-pos) sv-176) (< -1 sv-176)) + (+! (-> gp-0 good-count) (- (current-time) (-> self clock old-frame-counter))) + (set-time! (-> gp-0 good-time)) + ) + (else + 0 + ) ) + (set! (-> gp-0 old-pos) sv-176) + (set-time! (-> gp-0 old-time)) + (suspend) + (let* ((f26-0 (* (- (the float (current-str-pos (-> gp-0 sid))) (-> gp-0 part-audio-start)) f30-0)) + (f0-16 (if (str-id-is-playing? (the-as int (-> gp-0 sid))) + (fmax 0.0 (fmin f26-0 (the float (+ (-> (ja-group) frames num-frames) -1)))) + (fmax 0.0 (fmin (ja-frame-num 0) (the float (+ (-> (ja-group) frames num-frames) -1)))) + ) + ) + ) + (ja-no-eval :num! (seek!) :frame-num f0-16) + ) + (set! v0-59 (current-str-pos (-> gp-0 sid))) + (set! sv-176 v0-59) ) - (set! (-> gp-0 old-pos) sv-176) - (set-time! (-> gp-0 old-time)) - (suspend) - (let* ((f26-0 (* (- (the float (current-str-pos (-> gp-0 sid))) (-> gp-0 part-audio-start)) f30-0)) - (f0-16 (if (str-id-is-playing? (the-as int (-> gp-0 sid))) - (fmax 0.0 (fmin f26-0 (the float (+ (-> (ja-group) frames num-frames) -1)))) - (fmax 0.0 (fmin (ja-frame-num 0) (the float (+ (-> (ja-group) frames num-frames) -1)))) - ) - ) - ) - (ja-no-eval :num! (seek!) :frame-num f0-16) - ) - (set! v0-59 (current-str-pos (-> gp-0 sid))) - (set! sv-176 v0-59) ) (set! (-> gp-0 part-audio-start) f28-0) ) @@ -1642,7 +1639,6 @@ ;; definition for method 19 of type gui-control ;; INFO: Used lq/sq (defmethod handle-command-list ((this gui-control) (arg0 gui-channel) (arg1 gui-connection)) - (local-vars (sv-16 int) (sv-32 int) (sv-48 int)) (let ((gp-0 #t)) (cond ((or (not (gui-control-method-18 this arg0)) (< (-> *display* base-clock frame-counter) (-> this times arg0))) @@ -1658,8 +1654,9 @@ ) (case a2-1 (((gui-channel hud)) - (let ((s0-0 80)) - (set! sv-16 90) + (let ((s0-0 80) + (sv-16 90) + ) (while (>= (the-as uint sv-16) (the-as uint s0-0)) (if (not (handle-command this arg0 (the-as gui-channel s0-0) (the-as symbol s1-0) arg1)) (set! gp-0 #f) @@ -1669,8 +1666,9 @@ ) ) (((gui-channel screen)) - (let ((s0-1 66)) - (set! sv-32 70) + (let ((s0-1 66) + (sv-32 70) + ) (while (>= (the-as uint sv-32) (the-as uint s0-1)) (if (not (handle-command this arg0 (the-as gui-channel s0-1) (the-as symbol s1-0) arg1)) (set! gp-0 #f) @@ -1680,8 +1678,9 @@ ) ) (((gui-channel voice)) - (let ((s0-2 18)) - (set! sv-48 32) + (let ((s0-2 18) + (sv-48 32) + ) (while (>= (the-as uint sv-48) (the-as uint s0-2)) (if (not (handle-command this arg0 (the-as gui-channel s0-2) (the-as symbol s1-0) arg1)) (set! gp-0 #f) @@ -1852,39 +1851,41 @@ (arg5 (function gui-connection symbol)) (arg6 process) ) - (local-vars (sv-16 gui-action) (sv-17 gui-action) (sv-20 string) (sv-24 (function gui-connection symbol))) - (set! sv-16 arg0) - (set! sv-17 arg3) - (set! sv-20 arg4) - (set! sv-24 arg5) - (let ((s1-0 (the-as gui-connection (-> this engine alive-list next0)))) - (-> this engine) - (let ((s0-0 (-> s1-0 next0))) - (while (!= s1-0 (-> this engine alive-list-end)) - (when (and (or (= arg1 1) (= arg1 (-> s1-0 id))) - (or (= arg2 (gui-channel none)) (= arg2 (-> s1-0 channel))) - (or (= sv-17 (gui-action none)) (= sv-17 (-> s1-0 action))) - (or (not sv-20) (string= sv-20 (-> s1-0 name))) - (or (not arg5) (arg5 s1-0)) - (or (not arg6) (= arg6 (get-process s1-0))) - ) - (cond - ((and (= sv-16 (gui-action hide)) (!= (-> this ids (-> s1-0 channel)) (-> s1-0 id))) - (set! (-> s1-0 action) (gui-action hidden)) - ) - ((and (= sv-16 (gui-action play)) (= (-> s1-0 action) (gui-action playing))) - ) - (else - (set! (-> s1-0 action) sv-16) - (if (and (= sv-16 'play) (handle-command-list this (-> s1-0 channel) s1-0)) - (channel-id-set! this s1-0 (-> s1-0 id)) - ) + (let ((sv-16 arg0) + (sv-17 arg3) + (sv-20 arg4) + ) + (let ((sv-24 arg5)) + ) + (let ((s1-0 (the-as gui-connection (-> this engine alive-list next0)))) + (-> this engine) + (let ((s0-0 (-> s1-0 next0))) + (while (!= s1-0 (-> this engine alive-list-end)) + (when (and (or (= arg1 1) (= arg1 (-> s1-0 id))) + (or (= arg2 (gui-channel none)) (= arg2 (-> s1-0 channel))) + (or (= sv-17 (gui-action none)) (= sv-17 (-> s1-0 action))) + (or (not sv-20) (string= sv-20 (-> s1-0 name))) + (or (not arg5) (arg5 s1-0)) + (or (not arg6) (= arg6 (get-process s1-0))) + ) + (cond + ((and (= sv-16 (gui-action hide)) (!= (-> this ids (-> s1-0 channel)) (-> s1-0 id))) + (set! (-> s1-0 action) (gui-action hidden)) + ) + ((and (= sv-16 (gui-action play)) (= (-> s1-0 action) (gui-action playing))) + ) + (else + (set! (-> s1-0 action) sv-16) + (if (and (= sv-16 'play) (handle-command-list this (-> s1-0 channel) s1-0)) + (channel-id-set! this s1-0 (-> s1-0 id)) + ) + ) ) ) + (set! s1-0 (the-as gui-connection s0-0)) + (-> this engine) + (set! s0-0 (-> s0-0 next0)) ) - (set! s1-0 (the-as gui-connection s0-0)) - (-> this engine) - (set! s0-0 (-> s0-0 next0)) ) ) ) @@ -1902,68 +1903,66 @@ (arg4 float) (arg5 time-frame) ) - (local-vars - (sv-16 int) - (sv-20 gui-connection) - (sv-32 gui-connection) - (sv-48 gui-connection) - (sv-64 gui-connection) - (sv-80 int) - ) - (set! sv-32 (the-as gui-connection #f)) - (set! sv-48 (the-as gui-connection (-> this engine alive-list next0))) - (-> this engine) - (set! sv-64 (the-as gui-connection (-> sv-48 next0))) - (while (!= sv-48 (-> this engine alive-list-end)) - (when (and (= arg1 (-> (the-as gui-connection sv-48) channel)) - (string= arg3 (-> (the-as gui-connection sv-48) name)) - (= (get-process sv-48) arg0) - ) - (set! sv-32 (the-as gui-connection sv-48)) - (goto cfg-12) - ) - (set! sv-48 (the-as gui-connection sv-64)) - (-> this engine) - (set! sv-64 (the-as gui-connection (-> sv-64 next0))) - ) - (label cfg-12) - (when (not sv-32) - (set! sv-16 0) - (set! sv-80 32) - (while (nonzero? sv-80) - (set! sv-80 (+ sv-80 -1)) - (set! sv-20 (-> this connections sv-80)) - (if (and (nonzero? (-> sv-20 id)) - (= arg1 (-> sv-20 channel)) - (string= arg3 (-> sv-20 name)) - (>= (-> sv-20 priority) -1.0) - ) - (set! sv-16 (the-as int (-> sv-20 id))) - ) - ) - (if (zero? sv-16) - (set! sv-16 (the-as int (new-sound-id))) - ) - (set! sv-32 (the-as gui-connection (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16))) - sv-32 - ) - (the-as sound-id (cond - (sv-32 - (set! (-> sv-32 priority) arg4) - (set! (-> sv-32 channel) arg1) - (set! (-> sv-32 action) arg2) - (set! (-> sv-32 param2) (the-as int arg3)) - (set! (-> sv-32 hold-time) arg5) - (set! (-> sv-32 flags) (gui-connection-flags gcf0)) - (set! (-> sv-32 fade) (the-as uint 0)) - (the-as int (-> (the-as gui-connection sv-32) id)) - ) - (else - (format 0 "ERROR: could not connection ~A to gui engine.~%" arg0) - 0 - ) + (let ((sv-32 (the-as gui-connection #f))) + (let ((sv-48 (the-as gui-connection (-> this engine alive-list next0)))) + (-> this engine) + (let ((sv-64 (the-as gui-connection (-> sv-48 next0)))) + (while (!= sv-48 (-> this engine alive-list-end)) + (when (and (= arg1 (-> (the-as gui-connection sv-48) channel)) + (string= arg3 (-> (the-as gui-connection sv-48) name)) + (= (get-process sv-48) arg0) ) + (set! sv-32 (the-as gui-connection sv-48)) + (goto cfg-12) + ) + (set! sv-48 (the-as gui-connection sv-64)) + (-> this engine) + (set! sv-64 (the-as gui-connection (-> sv-64 next0))) ) + ) + ) + (label cfg-12) + (when (not sv-32) + (let ((sv-16 0)) + (let ((sv-80 32)) + (while (nonzero? sv-80) + (+! sv-80 -1) + (let ((sv-20 (-> this connections sv-80))) + (if (and (nonzero? (-> sv-20 id)) + (= arg1 (-> sv-20 channel)) + (string= arg3 (-> sv-20 name)) + (>= (-> sv-20 priority) -1.0) + ) + (set! sv-16 (the-as int (-> sv-20 id))) + ) + ) + ) + ) + (if (zero? sv-16) + (set! sv-16 (the-as int (new-sound-id))) + ) + (set! sv-32 (the-as gui-connection (add-connection (-> this engine) arg0 arg4 0 arg3 sv-16))) + ) + sv-32 + ) + (the-as sound-id (cond + (sv-32 + (set! (-> sv-32 priority) arg4) + (set! (-> sv-32 channel) arg1) + (set! (-> sv-32 action) arg2) + (set! (-> sv-32 param2) (the-as int arg3)) + (set! (-> sv-32 hold-time) arg5) + (set! (-> sv-32 flags) (gui-connection-flags gcf0)) + (set! (-> sv-32 fade) (the-as uint 0)) + (the-as int (-> (the-as gui-connection sv-32) id)) + ) + (else + (format 0 "ERROR: could not connection ~A to gui engine.~%" arg0) + 0 + ) + ) + ) + ) ) ;; definition for method 10 of type gui-control @@ -1998,90 +1997,87 @@ (arg5 float) (arg6 sound-id) ) - (local-vars - (sv-16 gui-connection) - (sv-20 int) - (sv-24 gui-connection) - (sv-28 process-drawable) - (sv-32 int) - (sv-48 sound-id) - ) - (set! sv-48 arg6) - (set! sv-16 (the-as gui-connection #f)) - (set! sv-20 0) - (set! sv-32 32) - (while (nonzero? sv-32) - (set! sv-32 (+ sv-32 -1)) - (set! sv-24 (-> this connections sv-32)) - (when (and (nonzero? (-> sv-24 id)) - (= arg1 (-> sv-24 channel)) - (let ((v1-14 (handle->process (-> sv-24 handle)))) - (and (or (= v1-14 arg0) (= (-> arg0 type) scene-player) (and v1-14 (= (-> v1-14 type) scene-player))) - (and (string= arg3 (-> sv-24 name)) (= arg4 (-> sv-24 anim-part))) - ) - ) - ) - (when (< (-> sv-24 priority) arg5) - (set! (-> sv-24 time-stamp) (-> this update-time)) - (return (the-as sound-id (-> sv-24 id))) + (let ((sv-48 arg6) + (sv-16 (the-as gui-connection #f)) + (sv-20 0) ) - (set! sv-16 sv-24) - (goto cfg-44) - ) - ) - (countdown (v1-33 32) - (let ((a0-15 (-> this connections v1-33))) - (when (or (zero? (-> a0-15 id)) (not (handle->process (-> a0-15 handle)))) - (set! sv-16 a0-15) - (set! (-> sv-16 param3) 0) - (set! (-> sv-16 flags) (gui-connection-flags)) - (goto cfg-44) - ) - ) - ) - (label cfg-44) - (the-as sound-id (cond - (sv-16 - (when (zero? (-> (the-as gui-connection sv-16) id)) - (when (zero? sv-20) - (let ((v1-46 (lookup-gui-connection this arg0 arg1 arg3 (new 'static 'sound-id)))) - (if v1-46 - (set! sv-20 (the-as int (-> v1-46 id))) - ) - ) - ) - (if (zero? sv-20) - (set! sv-20 (the-as int sv-48)) - ) - (set! (-> sv-16 param3) (if (nonzero? sv-20) - sv-20 - (the-as int (new-sound-id)) - ) - ) - ) - (when (= arg5 -99.0) - (set! sv-28 (as-type arg0 process-drawable)) - (set! arg5 (if sv-28 - (vector-vector-distance (target-pos 0) (-> sv-28 root trans)) - -1.0 - ) - ) - ) - (set! (-> sv-16 time-stamp) (-> this update-time)) - (set! (-> sv-16 handle) (process->handle arg0)) - (set! (-> sv-16 priority) arg5) - (set! (-> sv-16 channel) arg1) - (set! (-> sv-16 action) arg2) - (set! (-> sv-16 anim-part) (the-as uint arg4)) - (set! (-> sv-16 param2) (the-as int arg3)) - (set! (-> sv-16 fade) (the-as uint 0)) - (the-as int (-> (the-as gui-connection sv-16) id)) - ) - (else - 0 + (let ((sv-32 32)) + (while (nonzero? sv-32) + (+! sv-32 -1) + (let ((sv-24 (-> this connections sv-32))) + (when (and (nonzero? (-> sv-24 id)) + (= arg1 (-> sv-24 channel)) + (let ((v1-14 (handle->process (-> sv-24 handle)))) + (and (or (= v1-14 arg0) (= (-> arg0 type) scene-player) (and v1-14 (= (-> v1-14 type) scene-player))) + (and (string= arg3 (-> sv-24 name)) (= arg4 (-> sv-24 anim-part))) + ) ) ) + (when (< (-> sv-24 priority) arg5) + (set! (-> sv-24 time-stamp) (-> this update-time)) + (return (the-as sound-id (-> sv-24 id))) + ) + (set! sv-16 sv-24) + (goto cfg-44) + ) ) + ) + ) + (countdown (v1-33 32) + (let ((a0-15 (-> this connections v1-33))) + (when (or (zero? (-> a0-15 id)) (not (handle->process (-> a0-15 handle)))) + (set! sv-16 a0-15) + (set! (-> sv-16 param3) 0) + (set! (-> sv-16 flags) (gui-connection-flags)) + (goto cfg-44) + ) + ) + ) + (label cfg-44) + (the-as sound-id (cond + (sv-16 + (when (zero? (-> (the-as gui-connection sv-16) id)) + (when (zero? sv-20) + (let ((v1-46 (lookup-gui-connection this arg0 arg1 arg3 (new 'static 'sound-id)))) + (if v1-46 + (set! sv-20 (the-as int (-> v1-46 id))) + ) + ) + ) + (if (zero? sv-20) + (set! sv-20 (the-as int sv-48)) + ) + (set! (-> sv-16 param3) (if (nonzero? sv-20) + sv-20 + (the-as int (new-sound-id)) + ) + ) + ) + (when (= arg5 -99.0) + (let ((sv-28 (as-type arg0 process-drawable))) + (set! arg5 (if sv-28 + (vector-vector-distance (target-pos 0) (-> sv-28 root trans)) + -1.0 + ) + ) + ) + ) + (set! (-> sv-16 time-stamp) (-> this update-time)) + (set! (-> sv-16 handle) (process->handle arg0)) + (set! (-> sv-16 priority) arg5) + (set! (-> sv-16 channel) arg1) + (set! (-> sv-16 action) arg2) + (set! (-> sv-16 anim-part) (the-as uint arg4)) + (set! (-> sv-16 param2) (the-as int arg3)) + (set! (-> sv-16 fade) (the-as uint 0)) + (the-as int (-> (the-as gui-connection sv-16) id)) + ) + (else + 0 + ) + ) + ) + ) ) ;; definition for method 21 of type gui-control diff --git a/test/decompiler/reference/jak2/engine/math/euler_REF.gc b/test/decompiler/reference/jak2/engine/math/euler_REF.gc index b316429222..9c44466ebf 100644 --- a/test/decompiler/reference/jak2/engine/math/euler_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/euler_REF.gc @@ -108,11 +108,12 @@ ) (cond ((= (logand (/ arg2 2) 1) 1) - (let* ((f0-0 (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))))) - (f0-2 (* f0-0 f0-0)) - (f1-0 (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))))) - (f30-0 (sqrtf (+ f0-2 (* f1-0 f1-0)))) - ) + (let ((f30-0 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s2-0 4) (* s3-0 16)) (the-as int arg1))))) + (square (-> (the-as (pointer float) (+ (+ (* s1-0 4) (* s3-0 16)) (the-as int arg1))))) + ) + ) + ) + ) (cond ((< 0.00000000001 f30-0) (set! (-> arg0 x) (atan @@ -140,11 +141,12 @@ ) ) (else - (let* ((f0-21 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))))) - (f0-23 (* f0-21 f0-21)) - (f1-3 (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))))) - (f30-1 (sqrtf (+ f0-23 (* f1-3 f1-3)))) - ) + (let ((f30-1 (sqrtf (+ (square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s3-0 16)) (the-as int arg1))))) + (square (-> (the-as (pointer float) (+ (+ (* s3-0 4) (* s2-0 16)) (the-as int arg1))))) + ) + ) + ) + ) (cond ((< 0.00000000001 f30-1) (set! (-> arg0 x) diff --git a/test/decompiler/reference/jak2/engine/math/math_REF.gc b/test/decompiler/reference/jak2/engine/math/math_REF.gc index 42ba656aa1..d0abeeb5bc 100644 --- a/test/decompiler/reference/jak2/engine/math/math_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/math_REF.gc @@ -640,11 +640,11 @@ ) ) (dotimes (v1-3 6) - (set! f0-1 (- (the-as float f0-1) - (/ (- (* (the-as float (* (the-as float f0-1) (the-as float f0-1))) (the-as float f0-1)) arg0) - (* 3.0 (the-as float f0-1) (the-as float f0-1)) - ) - ) + (set! f0-1 + (- (the-as float f0-1) (/ (- (* (the-as float (square (the-as float f0-1))) (the-as float f0-1)) arg0) + (* 3.0 (the-as float f0-1) (the-as float f0-1)) + ) + ) ) ) (the-as float f0-1) diff --git a/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc b/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc index e81108224c..9a5285b03e 100644 --- a/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/quaternion_REF.gc @@ -48,12 +48,9 @@ ;; definition for function vector-angle<-quaternion! (defun vector-angle<-quaternion! ((arg0 vector) (arg1 quaternion)) "Convert the quaternion arg1 to axis-angle form and store in arg0 (angle goes in w)" - (let* ((f0-0 1.0) - (f1-0 1.0) - (f2-0 (-> arg1 w)) - (f30-0 (/ f0-0 (sqrtf (- f1-0 (* f2-0 f2-0))))) - (f0-3 (* 2.0 (acos-rad (-> arg1 w)))) - ) + (let ((f30-0 (/ 1.0 (sqrtf (- 1.0 (square (-> arg1 w)))))) + (f0-3 (* 2.0 (acos-rad (-> arg1 w)))) + ) (set! (-> arg0 x) (* (-> arg1 x) f30-0)) (set! (-> arg0 y) (* (-> arg1 y) f30-0)) (set! (-> arg0 z) (* (-> arg1 z) f30-0)) @@ -599,11 +596,7 @@ ;; definition for function quaternion-vector-len (defun quaternion-vector-len ((arg0 quaternion)) "Assuming quaternion is normalized, get the length of the xyz part." - (let ((f0-0 1.0) - (f1-0 (-> arg0 w)) - ) - (sqrtf (- f0-0 (* f1-0 f1-0))) - ) + (sqrtf (- 1.0 (square (-> arg0 w)))) ) ;; definition for function quaternion-log! @@ -689,9 +682,7 @@ (quaternion-normalize! arg0) ) (else - (let* ((f1-4 1.0) - (f2-1 f0-0) - (f1-6 (sqrtf (- f1-4 (* f2-1 f2-1)))) + (let* ((f1-6 (sqrtf (- 1.0 (square f0-0)))) (f0-6 (/ (- f1-6 f0-0) (+ f1-6 f0-0))) (f28-0 (/ 1.0 f1-6)) ) @@ -767,10 +758,8 @@ (quaternion-negate! s3-0 s3-0) ) (quaternion-! s5-0 s3-0 arg1) - (let ((f0-1 (quaternion-norm2 s5-0)) - (f1-1 arg3) - ) - (if (< (* f1-1 f1-1) f0-1) + (let ((f0-1 (quaternion-norm2 s5-0))) + (if (< (square arg3) f0-1) (quaternion-float*! s5-0 s5-0 (/ arg3 (sqrtf f0-1))) ) ) diff --git a/test/decompiler/reference/jak2/engine/math/transformq_REF.gc b/test/decompiler/reference/jak2/engine/math/transformq_REF.gc index 366f03189a..64c2046335 100644 --- a/test/decompiler/reference/jak2/engine/math/transformq_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/transformq_REF.gc @@ -156,63 +156,47 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod rotate-toward-orientation! ((this trsqv) (arg0 quaternion) (arg1 float) (arg2 float) (arg3 int) (arg4 int) (arg5 float)) - (local-vars - (f0-4 float) - (sv-192 (function quaternion vector vector float int quaternion)) - (sv-208 quaternion) - (sv-224 vector) - (sv-240 int) - (sv-256 vector) - (sv-272 vector) - ) - (set! sv-240 arg4) - (let ((s2-0 arg5) + (local-vars (f0-4 float)) + (let ((sv-240 arg4) + (s2-0 arg5) (s5-0 (get-quaternion this)) ) (let ((gp-0 (new 'stack-no-clear 'quaternion))) (when (< 0.0 arg2) - (set! sv-192 quaternion-from-two-vectors-smooth!) - (set! sv-208 gp-0) - (set! sv-224 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0)) - (let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0))) - (sv-192 sv-208 sv-224 a2-1 arg2 sv-240) + (quaternion-from-two-vectors-smooth! + gp-0 + (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0) + (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0) + arg2 + sv-240 ) (quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0)) ) (when (< 0.0 arg1) - (set! sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0)) - (let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0))) - (set! sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0)) - (let ((s0-1 (new 'stack-no-clear 'matrix))) - (vector-flatten! s1-2 s1-2 sv-256) - (vector-flatten! sv-272 sv-272 sv-256) - (vector-normalize! s1-2 1.0) - (vector-normalize! sv-272 1.0) - (cond - ((!= s2-0 0.0) - (let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272)) - (f0-3 (-> sv-256 x)) - (f1-3 (-> sv-256 y)) - (f2-0 (-> sv-256 z)) - (f3-0 (-> v1-5 x)) - (f4-0 (-> v1-5 y)) - (f5-0 (-> v1-5 z)) - ) - (.mula.s f0-3 f3-0) - (.madda.s f1-3 f4-0) - (.madd.s f0-4 f2-0 f5-0) - ) - (if (< (* f0-4 s2-0) 0.0) - (matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3) - (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) - ) - ) - (else - (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) - ) + (let ((sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0)) + (s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0)) + (sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0)) + (s0-1 (new 'stack-no-clear 'matrix)) + ) + (vector-flatten! s1-2 s1-2 sv-256) + (vector-flatten! sv-272 sv-272 sv-256) + (vector-normalize! s1-2 1.0) + (vector-normalize! sv-272 1.0) + (cond + ((!= s2-0 0.0) + (let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272))) + (set! f0-4 (vector-dot sv-256 v1-5)) + ) + (if (< (* f0-4 s2-0) 0.0) + (matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3) + (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) + ) + ) + (else + (matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3) ) - (matrix->quaternion gp-0 s0-1) ) + (matrix->quaternion gp-0 s0-1) ) (quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0)) ) diff --git a/test/decompiler/reference/jak2/engine/math/trigonometry_REF.gc b/test/decompiler/reference/jak2/engine/math/trigonometry_REF.gc index 03d112e732..846b4ba6eb 100644 --- a/test/decompiler/reference/jak2/engine/math/trigonometry_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/trigonometry_REF.gc @@ -167,7 +167,7 @@ (let ((f2-0 (* 0.000095873795 (the float (sar (shl (the int arg0) 48) 48))))) f2-0 (let* ((f1-4 (* 0.999998 f2-0)) - (f0-3 (* f2-0 f2-0)) + (f0-3 (square f2-0)) (f2-1 (* f2-0 f0-3)) (f1-5 (+ f1-4 (* -0.16666014 f2-1))) (f2-2 (* f2-1 f0-3)) @@ -522,10 +522,7 @@ 16383.996 ) (else - (let* ((f0-6 1.0) - (f1-2 arg0) - (f0-8 (sqrtf (- f0-6 (* f1-2 f1-2)))) - ) + (let ((f0-8 (sqrtf (- 1.0 (square arg0))))) (atan0 arg0 f0-8) ) ) @@ -551,18 +548,14 @@ "Inverse cosine, radians." (cond ((>= arg0 0.0) - (let* ((f0-1 1.0) - (f1-1 arg0) - (f0-3 (sqrtf (- f0-1 (* f1-1 f1-1)))) + (let* ((f0-3 (sqrtf (- 1.0 (square arg0)))) (f0-5 (/ (- f0-3 arg0) (+ f0-3 arg0))) ) (atan-series-rad f0-5) ) ) (else - (let* ((f0-6 1.0) - (f1-6 arg0) - (f0-8 (sqrtf (- f0-6 (* f1-6 f1-6)))) + (let* ((f0-8 (sqrtf (- 1.0 (square arg0)))) (f0-10 (/ (+ f0-8 arg0) (- f0-8 arg0))) ) (- 3.1415925 (atan-series-rad f0-10)) diff --git a/test/decompiler/reference/jak2/engine/math/vector-h_REF.gc b/test/decompiler/reference/jak2/engine/math/vector-h_REF.gc index 3e438c1e5d..2e16de744e 100644 --- a/test/decompiler/reference/jak2/engine/math/vector-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/vector-h_REF.gc @@ -1071,16 +1071,12 @@ ;; definition for function vector-length< (defun vector-length< ((arg0 vector) (arg1 float)) - (let ((f0-0 (vector-length-squared arg0)) - (f1-0 arg1) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-length-squared arg0) (square arg1)) ) ;; definition for function vector-length> (defun vector-length> ((arg0 vector) (arg1 float)) - (< (* arg1 arg1) (vector-length-squared arg0)) + (< (square arg1) (vector-length-squared arg0)) ) ;; definition for symbol *zero-vector*, type vector diff --git a/test/decompiler/reference/jak2/engine/math/vector_REF.gc b/test/decompiler/reference/jak2/engine/math/vector_REF.gc index 15e302eb69..2dddd91098 100644 --- a/test/decompiler/reference/jak2/engine/math/vector_REF.gc +++ b/test/decompiler/reference/jak2/engine/math/vector_REF.gc @@ -366,7 +366,7 @@ (when (or (!= f0-1 0.0) (!= f2-1 0.0)) (let* ((f1-5 (* f0-1 arg3)) (f0-3 (* f2-1 arg3)) - (f2-4 (sqrtf (+ (* f1-5 f1-5) (* f0-3 f0-3)))) + (f2-4 (sqrtf (+ (square f1-5) (square f0-3)))) ) (cond ((>= arg2 f2-4) @@ -398,7 +398,7 @@ (when (or (!= f0-1 0.0) (!= f2-1 0.0)) (let* ((f1-5 (* f0-1 arg3)) (f0-3 (* f2-1 arg3)) - (f2-4 (sqrtf (+ (* f1-5 f1-5) (* f0-3 f0-3)))) + (f2-4 (sqrtf (+ (square f1-5) (square f0-3)))) ) (cond ((>= arg2 f2-4) @@ -432,7 +432,7 @@ (let* ((f2-6 (* f0-1 arg3)) (f1-3 (* f1-2 arg3)) (f0-4 (* f3-1 arg3)) - (f3-5 (sqrtf (+ (* f2-6 f2-6) (* f1-3 f1-3) (* f0-4 f0-4)))) + (f3-5 (sqrtf (+ (square f2-6) (square f1-3) (square f0-4)))) ) (cond ((>= arg2 f3-5) diff --git a/test/decompiler/reference/jak2/engine/nav/nav-control_REF.gc b/test/decompiler/reference/jak2/engine/nav/nav-control_REF.gc index d64290229b..566f378fb6 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-control_REF.gc @@ -9,11 +9,12 @@ ;; definition for function debug-nav-validate-current-poly (defun debug-nav-validate-current-poly ((arg0 nav-mesh) (arg1 nav-poly) (arg2 vector)) - (local-vars (sv-32 vector) (sv-36 float)) (when (not (point-in-poly? arg0 arg1 arg2)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (project-point-into-poly-2d arg0 arg1 sv-32 arg2) - (set! sv-36 (vector-vector-xz-distance arg2 sv-32)) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (project-point-into-poly-2d arg0 arg1 sv-32 arg2) + (let ((sv-36 (vector-vector-xz-distance arg2 sv-32))) + ) + ) #f ) ) @@ -282,50 +283,51 @@ ;; definition for method 9 of type nav-control ;; WARN: Return type mismatch int vs none. (defmethod debug-draw ((this nav-control)) - (local-vars (sv-32 nav-mesh) (sv-36 vector)) (when (display-marks? this) (debug-draw (-> this state mesh)) - (set! sv-32 (-> this state mesh)) - (set! sv-36 (new 'stack-no-clear 'vector)) - (if (logtest? (-> this shape nav-flags) (nav-flags has-root-sphere)) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - (-> this root-nav-sphere) - (-> this root-nav-sphere w) - (new 'static 'rgba :g #xff :b #xff :a #x20) - ) - ) - (if (logtest? (-> this shape nav-flags) (nav-flags has-extra-sphere)) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - (-> this extra-nav-sphere) - (-> this extra-nav-sphere w) - (new 'static 'rgba :g #xff :b #xff :a #x20) - ) - ) - (dotimes (s5-0 (-> this sphere-count)) - (let ((v1-19 (-> this state mesh work debug sphere-array s5-0))) - (vector+! sv-36 (-> sv-32 bounds) (the-as vector v1-19)) - (add-debug-sphere - #t - (bucket-id debug-no-zbuf1) - sv-36 - (- (-> v1-19 r) (-> this shape nav-radius)) - (new 'static 'rgba :g #xff :b #xff :a #x20) - ) - ) - ) - (dotimes (s5-1 (the-as int (-> sv-32 static-sphere-count))) - (let ((s4-0 (-> sv-32 static-sphere s5-1))) - (add-debug-sphere #t (bucket-id debug2) s4-0 (-> s4-0 r) *color-blue*) - (let ((s3-0 add-debug-text-3d) - (s2-0 #t) - (s1-0 318) + (let ((sv-32 (-> this state mesh))) + (let ((sv-36 (new 'stack-no-clear 'vector))) + (if (logtest? (-> this shape nav-flags) (nav-flags has-root-sphere)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> this root-nav-sphere) + (-> this root-nav-sphere w) + (new 'static 'rgba :g #xff :b #xff :a #x20) ) - (format (clear *temp-string*) "~D" s5-1) - (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* s4-0 (font-color cyan) (the-as vector2h #f)) + ) + (if (logtest? (-> this shape nav-flags) (nav-flags has-extra-sphere)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + (-> this extra-nav-sphere) + (-> this extra-nav-sphere w) + (new 'static 'rgba :g #xff :b #xff :a #x20) + ) + ) + (dotimes (s5-0 (-> this sphere-count)) + (let ((v1-19 (-> this state mesh work debug sphere-array s5-0))) + (vector+! sv-36 (-> sv-32 bounds) (the-as vector v1-19)) + (add-debug-sphere + #t + (bucket-id debug-no-zbuf1) + sv-36 + (- (-> v1-19 r) (-> this shape nav-radius)) + (new 'static 'rgba :g #xff :b #xff :a #x20) + ) + ) + ) + ) + (dotimes (s5-1 (the-as int (-> sv-32 static-sphere-count))) + (let ((s4-0 (-> sv-32 static-sphere s5-1))) + (add-debug-sphere #t (bucket-id debug2) s4-0 (-> s4-0 r) *color-blue*) + (let ((s3-0 add-debug-text-3d) + (s2-0 #t) + (s1-0 318) + ) + (format (clear *temp-string*) "~D" s5-1) + (s3-0 s2-0 (the-as bucket-id s1-0) *temp-string* s4-0 (font-color cyan) (the-as vector2h #f)) + ) ) ) ) @@ -418,10 +420,7 @@ (let ((f1-0 a2-4) (f0-1 (+ (-> sphere r) (-> nav shape nav-radius))) ) - (when (and (< 0.0 f1-0) (let ((f2-3 (+ f0-1 (-> nav nav-cull-radius)))) - (< f1-0 (* f2-3 f2-3)) - ) - ) + (when (and (< 0.0 f1-0) (< f1-0 (square (+ f0-1 (-> nav nav-cull-radius))))) (vector-! (the-as vector v1-3) (the-as vector sphere) (-> nav state mesh bounds)) (set! (-> v1-3 r) f0-1) (+! (-> nav sphere-count) 1) @@ -464,10 +463,7 @@ (let ((f1-0 t0-4) (f0-2 (+ (-> arg2 r) (-> v1-4 shape nav-radius))) ) - (when (and (< 0.0 f1-0) (let ((f2-3 (+ f0-2 (-> v1-4 nav-cull-radius)))) - (< f1-0 (* f2-3 f2-3)) - ) - ) + (when (and (< 0.0 f1-0) (< f1-0 (square (+ f0-2 (-> v1-4 nav-cull-radius))))) (vector-! (the-as vector a3-5) (the-as vector arg2) (-> v1-4 state mesh bounds)) (set! (-> a3-5 r) f0-2) (+! (-> v1-4 sphere-count) 1) @@ -498,10 +494,7 @@ (let ((f1-1 a2-6) (f0-4 (+ (-> a0-1 w) (-> v1-9 shape nav-radius))) ) - (when (and (< 0.0 f1-1) (let ((f2-9 (+ f0-4 (-> v1-9 nav-cull-radius)))) - (< f1-1 (* f2-9 f2-9)) - ) - ) + (when (and (< 0.0 f1-1) (< f1-1 (square (+ f0-4 (-> v1-9 nav-cull-radius))))) (vector-! (the-as vector a1-5) a0-1 (-> v1-9 state mesh bounds)) (set! (-> a1-5 r) f0-4) (+! (-> v1-9 sphere-count) 1) @@ -661,10 +654,7 @@ (let* ((f0-5 (-> arg1 w)) (f1-1 (vector-dot t0-0 t1-0)) (f0-6 (fmin f0-5 f1-1)) - (f2-0 f1-1) - (f2-2 (* f2-0 f2-0)) - (f3-0 f0-6) - (f2-4 (sqrtf (- f2-2 (* f3-0 f3-0)))) + (f2-4 (sqrtf (- (square f1-1) (square f0-6)))) (f3-4 (/ 1.0 f1-1)) (f1-3 (* f2-4 f3-4)) (f0-7 (* f0-6 f3-4)) @@ -712,19 +702,13 @@ (let ((f2-7 (+ (* (-> arg1 x) f1-1) (* (-> arg1 z) f0-2)))) (cond ((< f2-7 0.0) - (let ((f0-5 (+ (* f1-1 f1-1) (* f0-2 f0-2))) - (f1-4 (-> arg3 w)) - ) - (< f0-5 (* f1-4 f1-4)) - ) + (< (+ (square f1-1) (square f0-2)) (square (-> arg3 w))) ) ((< arg2 f2-7) - (let* ((f0-8 (- (-> arg3 x) (+ (-> arg0 x) (* (-> arg1 x) arg2)))) - (f1-10 (- (-> arg3 z) (+ (-> arg0 z) (* (-> arg1 z) arg2)))) - (f0-11 (+ (* f0-8 f0-8) (* f1-10 f1-10))) - (f1-13 (-> arg3 w)) - ) - (< f0-11 (* f1-13 f1-13)) + (let ((f0-8 (- (-> arg3 x) (+ (-> arg0 x) (* (-> arg1 x) arg2)))) + (f1-10 (- (-> arg3 z) (+ (-> arg0 z) (* (-> arg1 z) arg2)))) + ) + (< (+ (square f0-8) (square f1-10)) (square (-> arg3 w))) ) ) (else @@ -757,19 +741,13 @@ (let ((f3-7 (+ (* (-> t3-1 x) f2-1) (* (-> t3-1 z) f1-2)))) (cond ((< f3-7 0.0) - (let ((f0-5 (+ (* f2-1 f2-1) (* f1-2 f1-2))) - (f1-5 (-> t2-6 w)) - ) - (< f0-5 (* f1-5 f1-5)) - ) + (< (+ (square f2-1) (square f1-2)) (square (-> t2-6 w))) ) ((< f0-2 f3-7) - (let* ((f1-9 (- (-> t2-6 x) (+ (-> t4-0 x) (* (-> t3-1 x) f0-2)))) - (f2-5 (- (-> t2-6 z) (+ (-> t4-0 z) (* (-> t3-1 z) f0-2)))) - (f0-10 (+ (* f1-9 f1-9) (* f2-5 f2-5))) - (f1-12 (-> t2-6 w)) - ) - (< f0-10 (* f1-12 f1-12)) + (let ((f1-9 (- (-> t2-6 x) (+ (-> t4-0 x) (* (-> t3-1 x) f0-2)))) + (f2-5 (- (-> t2-6 z) (+ (-> t4-0 z) (* (-> t3-1 z) f0-2)))) + ) + (< (+ (square f1-9) (square f2-5)) (square (-> t2-6 w))) ) ) (else @@ -851,9 +829,7 @@ (set! (-> s5-0 initial-ignore-mask) (the-as uint 0)) (set! (-> s5-0 i-inside-sphere) -1) (set! (-> s5-0 inside-sphere-dist) 0.0) - (let ((f0-10 65536.0)) - (set! (-> arg0 closest-sphere-dist2) (* f0-10 f0-10)) - ) + (set! (-> arg0 closest-sphere-dist2) (square 65536.0)) (dotimes (v1-10 (-> this sphere-count)) (let ((a0-13 (-> this sphere-array v1-10))) (let ((a1-2 (-> arg0 current-pos)) @@ -867,12 +843,9 @@ (.add.z.vf.x vf1 vf1 vf1) (.mov a1-3 vf1) (set! (-> s5-0 dist2) a1-3) - (let ((f0-14 (-> arg0 closest-sphere-dist2)) - (f1-0 (-> s5-0 dist2)) - (f2-0 (-> a0-13 r)) + (set! (-> arg0 closest-sphere-dist2) + (fmin (-> arg0 closest-sphere-dist2) (- (-> s5-0 dist2) (square (-> a0-13 r)))) ) - (set! (-> arg0 closest-sphere-dist2) (fmin f0-14 (- f1-0 (* f2-0 f2-0)))) - ) (when (< (-> arg0 closest-sphere-dist2) 0.0) (vector-! (-> s5-0 temp-dir 0) (-> arg0 current-pos) (the-as vector a0-13)) (set! (-> s5-0 temp-dir 0 y) 0.0) @@ -1143,9 +1116,7 @@ (set! (-> s5-0 best-dir-angle 0) 0.0) (set! (-> s5-0 best-dir-angle 1) 0.0) (set! (-> s5-0 initial-ignore-mask) (the-as uint 0)) - (let ((f0-9 65536.0)) - (set! (-> arg0 closest-sphere-dist2) (* f0-9 f0-9)) - ) + (set! (-> arg0 closest-sphere-dist2) (square 65536.0)) (dotimes (v1-9 (-> this sphere-count)) (let ((a0-13 (-> this sphere-array v1-9))) (let ((a1-2 (-> arg0 current-pos)) @@ -1159,12 +1130,9 @@ (.add.z.vf.x vf1 vf1 vf1) (.mov a1-3 vf1) (set! (-> s5-0 dist2) a1-3) - (let ((f0-13 (-> arg0 closest-sphere-dist2)) - (f1-0 (-> s5-0 dist2)) - (f2-0 (-> a0-13 r)) + (set! (-> arg0 closest-sphere-dist2) + (fmin (-> arg0 closest-sphere-dist2) (- (-> s5-0 dist2) (square (-> a0-13 r)))) ) - (set! (-> arg0 closest-sphere-dist2) (fmin f0-13 (- f1-0 (* f2-0 f2-0)))) - ) (when (< (-> arg0 closest-sphere-dist2) 0.0) (vector-! (-> s5-0 temp-dir 0) (-> arg0 current-pos) (the-as vector a0-13)) (set! (-> s5-0 temp-dir 0 y) 0.0) @@ -1333,33 +1301,7 @@ ;; WARN: Stack slot offset 168 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod clamp-vector-to-mesh-no-gaps ((this nav-mesh) (arg0 vector) (arg1 nav-poly) (arg2 vector) (arg3 clamp-travel-vector-to-mesh-return-info)) - (local-vars - (v1-12 symbol) - (sv-112 nav-ray) - (sv-116 vector) - (sv-120 symbol) - (sv-124 nav-mesh-work) - (sv-128 int) - (sv-136 int) - (sv-144 nav-mesh-work) - (sv-148 nav-poly) - (sv-152 uint) - (sv-156 (pointer int8)) - (sv-160 (pointer int8)) - (sv-164 float) - (sv-168 float) - (sv-172 vector) - (sv-176 vector) - (sv-180 float) - (sv-184 float) - (sv-188 uint) - (sv-192 vector) - (sv-196 vector) - (sv-200 float) - (sv-204 float) - (sv-208 float) - (sv-212 float) - ) + (local-vars (v1-12 symbol)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -1370,180 +1312,193 @@ (init-vf0-vector) (set! (-> arg3 found-boundary) #f) (set! (-> arg3 gap-poly) #f) - (set! sv-112 (new 'stack-no-clear 'nav-ray)) - (set! sv-116 (new 'stack-no-clear 'vector)) - (set! sv-120 (the-as symbol #f)) - (set! sv-124 (-> this work)) - (vector-! sv-116 arg0 (-> this bounds)) - (set! (-> sv-112 current-poly) arg1) - (set! (-> sv-112 current-pos quad) (-> sv-116 quad)) - (vector+! (-> sv-112 dest-pos) sv-116 arg2) - (let* ((t2-0 this) - (v1-11 (-> sv-112 dest-pos)) - (a1-4 (-> arg1 vertex-count)) - (a2-1 (-> arg1 vertex)) - (t1-4 (-> t2-0 work vert0-table)) - (t2-2 (-> t2-0 work vert1-table)) - ) - (dotimes (t3-0 (the-as int a1-4)) - (let* ((t4-3 (-> a2-1 (-> t1-4 t3-0))) - (t5-3 (-> a2-1 (-> t2-2 t3-0))) - (f0-1 (- (-> t4-3 z) (-> t5-3 z))) - (f1-2 (- (-> t5-3 x) (-> t4-3 x))) - (f2-2 (- (-> v1-11 x) (-> t4-3 x))) - (f3-2 (- (-> v1-11 z) (-> t4-3 z))) - (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + (let ((sv-112 (new 'stack-no-clear 'nav-ray)) + (sv-116 (new 'stack-no-clear 'vector)) + ) + (let ((sv-120 (the-as symbol #f))) + ) + (let ((sv-124 (-> this work))) + (vector-! sv-116 arg0 (-> this bounds)) + (set! (-> sv-112 current-poly) arg1) + (set! (-> sv-112 current-pos quad) (-> sv-116 quad)) + (vector+! (-> sv-112 dest-pos) sv-116 arg2) + (let* ((t2-0 this) + (v1-11 (-> sv-112 dest-pos)) + (a1-4 (-> arg1 vertex-count)) + (a2-1 (-> arg1 vertex)) + (t1-4 (-> t2-0 work vert0-table)) + (t2-2 (-> t2-0 work vert1-table)) ) - (when (< 0.0 f0-3) - (set! v1-12 #f) - (goto cfg-7) + (dotimes (t3-0 (the-as int a1-4)) + (let* ((t4-3 (-> a2-1 (-> t1-4 t3-0))) + (t5-3 (-> a2-1 (-> t2-2 t3-0))) + (f0-1 (- (-> t4-3 z) (-> t5-3 z))) + (f1-2 (- (-> t5-3 x) (-> t4-3 x))) + (f2-2 (- (-> v1-11 x) (-> t4-3 x))) + (f3-2 (- (-> v1-11 z) (-> t4-3 z))) + (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + ) + (when (< 0.0 f0-3) + (set! v1-12 #f) + (goto cfg-7) + ) + ) ) ) - ) - ) - (set! v1-12 #t) - (label cfg-7) - (b! v1-12 cfg-41 :delay (nop!)) - (set! sv-128 0) - (let ((v1-16 sv-112)) - (vector-! (-> v1-16 dir) (-> v1-16 dest-pos) (-> v1-16 current-pos)) - (set! (-> v1-16 dir y) 0.0) - (let ((a1-6 (-> v1-16 dir))) - (let ((f0-5 1.0)) - (.lvf vf1 (&-> a1-6 quad)) - (.mul.vf.xyz vf2 vf1 vf1) - (let ((a2-4 f0-5)) - (.mov vf3 a2-4) + (set! v1-12 #t) + (label cfg-7) + (b! v1-12 cfg-41 :delay (nop!)) + (let ((sv-128 0)) + (let ((v1-16 sv-112)) + (vector-! (-> v1-16 dir) (-> v1-16 dest-pos) (-> v1-16 current-pos)) + (set! (-> v1-16 dir y) 0.0) + (let ((a1-6 (-> v1-16 dir))) + (let ((f0-5 1.0)) + (.lvf vf1 (&-> a1-6 quad)) + (.mul.vf.xyz vf2 vf1 vf1) + (let ((a2-4 f0-5)) + (.mov vf3 a2-4) + ) + ) + (.mul.x.vf.w acc vf0 vf2) + (.add.mul.y.vf.w acc vf0 vf2 acc) + (.add.mul.z.vf.w vf2 vf0 vf2 acc) + (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) + (.wait.vf) + (.mul.vf.xyz vf1 vf1 Q) + (.nop.vf) + (.nop.vf) + (.nop.vf) + (.svf (&-> a1-6 quad) vf1) + ) + (set! (-> v1-16 next-poly) #f) + (set! (-> v1-16 len) 0.0) + (set! (-> v1-16 last-edge) -1) + (set! (-> v1-16 terminated) #f) + (set! (-> v1-16 reached-dest) #f) + (set! (-> v1-16 hit-boundary) #f) + (set! (-> v1-16 hit-gap) #f) + (set! (-> v1-16 ignore) (the-as uint 3)) ) - ) - (.mul.x.vf.w acc vf0 vf2) - (.add.mul.y.vf.w acc vf0 vf2 acc) - (.add.mul.z.vf.w vf2 vf0 vf2 acc) - (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) - (.wait.vf) - (.mul.vf.xyz vf1 vf1 Q) - (.nop.vf) - (.nop.vf) - (.nop.vf) - (.svf (&-> a1-6 quad) vf1) - ) - (set! (-> v1-16 next-poly) #f) - (set! (-> v1-16 len) 0.0) - (set! (-> v1-16 last-edge) -1) - (set! (-> v1-16 terminated) #f) - (set! (-> v1-16 reached-dest) #f) - (set! (-> v1-16 hit-boundary) #f) - (set! (-> v1-16 hit-gap) #f) - (set! (-> v1-16 ignore) (the-as uint 3)) - ) - 0 - (until (or (>= sv-128 15) (-> sv-112 terminated)) - (set! sv-128 (+ sv-128 1)) - (let ((a1-9 this) - (v1-20 sv-112) - ) - (set! sv-136 -1) - (set! sv-144 (-> a1-9 work)) - (set! sv-148 (-> v1-20 current-poly)) - (set! sv-152 (-> v1-20 current-poly vertex-count)) - (set! sv-156 (-> a1-9 work vert0-table)) - (set! sv-160 (-> a1-9 work vert1-table)) - (set! sv-164 (- (-> v1-20 dest-pos x) (-> v1-20 current-pos x))) - (set! sv-168 (- (-> v1-20 dest-pos z) (-> v1-20 current-pos z))) - (dotimes (a2-14 (the-as int sv-152)) - (set! sv-172 (-> sv-148 vertex (-> sv-156 a2-14))) - (set! sv-176 (-> sv-148 vertex (-> sv-160 a2-14))) - (set! sv-180 (- (-> sv-172 z) (-> sv-176 z))) - (set! sv-184 (- (-> sv-176 x) (-> sv-172 x))) - (let ((f0-17 (+ (* sv-164 sv-180) (* sv-168 sv-184)))) - (when (< 0.0 f0-17) - (let ((f1-15 (+ (* sv-180 (- (-> sv-172 x) (-> v1-20 current-pos x))) - (* sv-184 (- (-> sv-172 z) (-> v1-20 current-pos z))) - ) - ) + 0 + (until (or (>= sv-128 15) (-> sv-112 terminated)) + (+! sv-128 1) + (let ((a1-9 this) + (v1-20 sv-112) + (sv-136 -1) + ) + (let ((sv-144 (-> a1-9 work))) + ) + (let ((sv-148 (-> v1-20 current-poly)) + (sv-152 (-> v1-20 current-poly vertex-count)) + (sv-156 (-> a1-9 work vert0-table)) + (sv-160 (-> a1-9 work vert1-table)) + (sv-164 (- (-> v1-20 dest-pos x) (-> v1-20 current-pos x))) + (sv-168 (- (-> v1-20 dest-pos z) (-> v1-20 current-pos z))) ) - (when (< f1-15 f0-17) - (set! sv-136 a2-14) - (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) - (set! sv-164 (* sv-164 f0-19)) - (set! sv-168 (* sv-168 f0-19)) + (dotimes (a2-14 (the-as int sv-152)) + (let* ((sv-172 (-> sv-148 vertex (-> sv-156 a2-14))) + (sv-176 (-> sv-148 vertex (-> sv-160 a2-14))) + (sv-180 (- (-> sv-172 z) (-> sv-176 z))) + (sv-184 (- (-> sv-176 x) (-> sv-172 x))) + (f0-17 (+ (* sv-164 sv-180) (* sv-168 sv-184))) + ) + (when (< 0.0 f0-17) + (let ((f1-15 (+ (* sv-180 (- (-> sv-172 x) (-> v1-20 current-pos x))) + (* sv-184 (- (-> sv-172 z) (-> v1-20 current-pos z))) + ) + ) + ) + (when (< f1-15 f0-17) + (set! sv-136 a2-14) + (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) + (set! sv-164 (* sv-164 f0-19)) + (set! sv-168 (* sv-168 f0-19)) + ) + ) + ) + ) + ) + ) + (let ((f0-23 (+ (* sv-164 (-> v1-20 dir x)) (* sv-168 (-> v1-20 dir z))))) + (+! (-> v1-20 len) f0-23) + ) + 0 + (set! (-> v1-20 next-poly) #f) + (cond + ((= sv-136 -1) + (set! (-> v1-20 current-pos quad) (-> v1-20 dest-pos quad)) + (set! (-> v1-20 reached-dest) #t) + (set! (-> v1-20 terminated) #t) + ) + (else + (+! (-> v1-20 current-pos x) sv-164) + (+! (-> v1-20 current-pos z) sv-168) + (let ((sv-188 (-> sv-148 adj-poly sv-136))) + (if (!= sv-188 255) + (set! (-> v1-20 next-poly) (-> a1-9 poly-array sv-188)) + ) + ) + (cond + ((and (-> v1-20 next-poly) (not (logtest? (-> v1-20 next-poly pat) (-> v1-20 ignore)))) + (set! (-> v1-20 current-poly) (-> v1-20 next-poly)) + ) + (else + (set! (-> v1-20 last-edge) sv-136) + (if (-> v1-20 next-poly) + (set! (-> v1-20 hit-gap) #t) + (set! (-> v1-20 hit-boundary) #t) + ) + (set! (-> v1-20 terminated) #t) + ) + ) ) ) ) ) + 0 ) ) - (let ((f0-23 (+ (* sv-164 (-> v1-20 dir x)) (* sv-168 (-> v1-20 dir z))))) - (+! (-> v1-20 len) f0-23) - ) - 0 - (set! (-> v1-20 next-poly) #f) (cond - ((= sv-136 -1) - (set! (-> v1-20 current-pos quad) (-> v1-20 dest-pos quad)) - (set! (-> v1-20 reached-dest) #t) - (set! (-> v1-20 terminated) #t) + ((or (-> sv-112 hit-boundary) (-> sv-112 hit-gap)) + (let ((sv-192 (-> sv-112 current-poly vertex (-> sv-124 vert0-table (-> sv-112 last-edge)))) + (sv-196 (-> sv-112 current-poly vertex (-> sv-124 vert1-table (-> sv-112 last-edge)))) + ) + (let ((sv-200 (- (-> sv-192 z) (-> sv-196 z))) + (sv-204 (- (-> sv-196 x) (-> sv-192 x))) + ) + (let ((sv-208 (-> arg2 x))) + ) + (let ((sv-212 (-> arg2 z))) + ) + (let* ((f0-39 (sqrtf (+ (square sv-200) (square sv-204)))) + (f0-41 (/ 1.0 f0-39)) + ) + (set! sv-200 (* sv-200 f0-41)) + (set! sv-204 (* sv-204 f0-41)) + ) + (set! (-> arg3 found-boundary) #t) + (vector+! (-> arg3 intersection) (-> sv-112 current-pos) (-> this bounds)) + (set! (-> arg3 boundary-normal x) sv-200) + (set! (-> arg3 boundary-normal y) 0.0) + (set! (-> arg3 boundary-normal z) sv-204) + ) + (set! (-> arg3 poly) (-> sv-112 current-poly)) + (set! (-> arg3 edge) (-> sv-112 last-edge)) + (vector+! (-> arg3 vert-0) sv-192 (-> this bounds)) + (vector+! (-> arg3 vert-1) sv-196 (-> this bounds)) + ) + (set! (-> sv-112 dest-pos quad) (-> sv-112 current-pos quad)) + (if (-> sv-112 hit-gap) + (set! (-> arg3 gap-poly) (-> sv-112 next-poly)) + ) ) (else - (+! (-> v1-20 current-pos x) sv-164) - (+! (-> v1-20 current-pos z) sv-168) - (set! sv-188 (-> sv-148 adj-poly sv-136)) - (if (!= sv-188 255) - (set! (-> v1-20 next-poly) (-> a1-9 poly-array sv-188)) - ) - (cond - ((and (-> v1-20 next-poly) (not (logtest? (-> v1-20 next-poly pat) (-> v1-20 ignore)))) - (set! (-> v1-20 current-poly) (-> v1-20 next-poly)) - ) - (else - (set! (-> v1-20 last-edge) sv-136) - (if (-> v1-20 next-poly) - (set! (-> v1-20 hit-gap) #t) - (set! (-> v1-20 hit-boundary) #t) - ) - (set! (-> v1-20 terminated) #t) - ) - ) ) ) ) - 0 + (vector-! arg2 (-> sv-112 current-pos) sv-116) ) - (cond - ((or (-> sv-112 hit-boundary) (-> sv-112 hit-gap)) - (set! sv-192 (-> sv-112 current-poly vertex (-> sv-124 vert0-table (-> sv-112 last-edge)))) - (set! sv-196 (-> sv-112 current-poly vertex (-> sv-124 vert1-table (-> sv-112 last-edge)))) - (set! sv-200 (- (-> sv-192 z) (-> sv-196 z))) - (set! sv-204 (- (-> sv-196 x) (-> sv-192 x))) - (set! sv-208 (-> arg2 x)) - (set! sv-212 (-> arg2 z)) - (let* ((f0-35 sv-200) - (f0-37 (* f0-35 f0-35)) - (f1-27 sv-204) - (f0-39 (sqrtf (+ f0-37 (* f1-27 f1-27)))) - (f0-41 (/ 1.0 f0-39)) - ) - (set! sv-200 (* sv-200 f0-41)) - (set! sv-204 (* sv-204 f0-41)) - ) - (set! (-> arg3 found-boundary) #t) - (vector+! (-> arg3 intersection) (-> sv-112 current-pos) (-> this bounds)) - (set! (-> arg3 boundary-normal x) sv-200) - (set! (-> arg3 boundary-normal y) 0.0) - (set! (-> arg3 boundary-normal z) sv-204) - (set! (-> arg3 poly) (-> sv-112 current-poly)) - (set! (-> arg3 edge) (-> sv-112 last-edge)) - (vector+! (-> arg3 vert-0) sv-192 (-> this bounds)) - (vector+! (-> arg3 vert-1) sv-196 (-> this bounds)) - (set! (-> sv-112 dest-pos quad) (-> sv-112 current-pos quad)) - (if (-> sv-112 hit-gap) - (set! (-> arg3 gap-poly) (-> sv-112 next-poly)) - ) - ) - (else - ) - ) - (vector-! arg2 (-> sv-112 current-pos) sv-116) 0 (label cfg-41) 0 @@ -1555,15 +1510,14 @@ ;; WARN: Return type mismatch object vs none. ;; WARN: Function (method 21 nav-mesh) has a return type of none, but the expression builder found a return statement. (defmethod find-adjacent-bounds-one ((this nav-mesh) (arg0 vector) (arg1 nav-poly) (arg2 int) (arg3 int)) - (local-vars (sv-16 nav-poly)) (if (zero? arg3) (set! arg2 (the-as int (mod (the-as uint (+ arg2 1)) (-> arg1 vertex-count)))) ) - (set! sv-16 arg1) - (let ((s2-0 (-> sv-16 vertex arg2)) - (s3-0 sv-16) - (s1-0 100) - ) + (let* ((sv-16 arg1) + (s2-0 (-> sv-16 vertex arg2)) + (s3-0 sv-16) + (s1-0 100) + ) (while (begin (label cfg-21) (nonzero? s1-0)) (+! s1-0 -1) (if (nonzero? arg3) @@ -1791,34 +1745,7 @@ (arg4 symbol) (arg5 clamp-travel-vector-to-mesh-return-info) ) - (local-vars - (v1-11 symbol) - (v1-22 symbol) - (sv-96 nav-ray) - (sv-100 symbol) - (sv-104 int) - (sv-112 nav-mesh-work) - (sv-120 int) - (sv-128 int) - (sv-136 nav-mesh-work) - (sv-140 nav-poly) - (sv-144 uint) - (sv-148 (pointer int8)) - (sv-152 (pointer int8)) - (sv-156 float) - (sv-160 float) - (sv-164 vector) - (sv-168 vector) - (sv-172 float) - (sv-176 float) - (sv-180 uint) - (sv-184 vector) - (sv-188 vector) - (sv-192 float) - (sv-196 float) - (sv-200 float) - (sv-204 float) - ) + (local-vars (v1-11 symbol) (v1-22 symbol)) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -1831,203 +1758,218 @@ (set! (-> arg5 found-boundary) #f) (set! (-> arg5 gap-poly) #f) ) - (set! sv-96 (new 'stack-no-clear 'nav-ray)) - (set! sv-100 (the-as symbol #f)) - (set! sv-104 0) - (set! sv-112 (-> this work)) - (set! (-> sv-96 current-poly) arg1) - (set! (-> sv-96 current-pos quad) (-> arg0 quad)) - (vector+! (-> sv-96 dest-pos) arg0 arg2) - (let* ((t6-0 this) - (t4-2 arg1) - (v1-10 (-> sv-96 dest-pos)) - (t3-3 (-> t4-2 vertex-count)) - (t4-3 (-> t4-2 vertex)) - (t5-1 (-> t6-0 work vert0-table)) - (t6-2 (-> t6-0 work vert1-table)) - ) - (dotimes (t7-0 (the-as int t3-3)) - (let* ((t8-3 (-> t4-3 (-> t5-1 t7-0))) - (t9-3 (-> t4-3 (-> t6-2 t7-0))) - (f0-1 (- (-> t8-3 z) (-> t9-3 z))) - (f1-2 (- (-> t9-3 x) (-> t8-3 x))) - (f2-2 (- (-> v1-10 x) (-> t8-3 x))) - (f3-2 (- (-> v1-10 z) (-> t8-3 z))) - (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + (let ((sv-96 (new 'stack-no-clear 'nav-ray))) + (let ((sv-100 (the-as symbol #f)) + (sv-104 0) + (sv-112 (-> this work)) + ) + (set! (-> sv-96 current-poly) arg1) + (set! (-> sv-96 current-pos quad) (-> arg0 quad)) + (vector+! (-> sv-96 dest-pos) arg0 arg2) + (let* ((t6-0 this) + (t4-2 arg1) + (v1-10 (-> sv-96 dest-pos)) + (t3-3 (-> t4-2 vertex-count)) + (t4-3 (-> t4-2 vertex)) + (t5-1 (-> t6-0 work vert0-table)) + (t6-2 (-> t6-0 work vert1-table)) ) - (when (< 0.0 f0-3) - (set! v1-11 #f) - (goto cfg-9) - ) - ) - ) - ) - (set! v1-11 #t) - (label cfg-9) - (b! v1-11 cfg-62 :delay (nop!)) - (until sv-100 - (set! sv-120 0) - (let ((v1-15 sv-96)) - (vector-! (-> v1-15 dir) (-> v1-15 dest-pos) (-> v1-15 current-pos)) - (set! (-> v1-15 dir y) 0.0) - (let ((t3-5 (-> v1-15 dir))) - (let ((f0-5 1.0)) - (.lvf vf1 (&-> t3-5 quad)) - (.mul.vf.xyz vf2 vf1 vf1) - (let ((t4-6 f0-5)) - (.mov vf3 t4-6) + (dotimes (t7-0 (the-as int t3-3)) + (let* ((t8-3 (-> t4-3 (-> t5-1 t7-0))) + (t9-3 (-> t4-3 (-> t6-2 t7-0))) + (f0-1 (- (-> t8-3 z) (-> t9-3 z))) + (f1-2 (- (-> t9-3 x) (-> t8-3 x))) + (f2-2 (- (-> v1-10 x) (-> t8-3 x))) + (f3-2 (- (-> v1-10 z) (-> t8-3 z))) + (f0-3 (+ (* f2-2 f0-1) (* f3-2 f1-2))) + ) + (when (< 0.0 f0-3) + (set! v1-11 #f) + (goto cfg-9) + ) ) ) - (.mul.x.vf.w acc vf0 vf2) - (.add.mul.y.vf.w acc vf0 vf2 acc) - (.add.mul.z.vf.w vf2 vf0 vf2 acc) - (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) - (.wait.vf) - (.mul.vf.xyz vf1 vf1 Q) - (.nop.vf) - (.nop.vf) - (.nop.vf) - (.svf (&-> t3-5 quad) vf1) ) - (set! (-> v1-15 next-poly) #f) - (set! (-> v1-15 len) 0.0) - (set! (-> v1-15 last-edge) -1) - (set! (-> v1-15 terminated) #f) - (set! (-> v1-15 reached-dest) #f) - (set! (-> v1-15 hit-boundary) #f) - (set! (-> v1-15 hit-gap) #f) - (set! (-> v1-15 ignore) (the-as uint 3)) - ) - 0 - (until v1-22 - (set! sv-120 (+ sv-120 1)) - (let ((t3-8 this) - (v1-19 sv-96) + (set! v1-11 #t) + (label cfg-9) + (b! v1-11 cfg-62 :delay (nop!)) + (until sv-100 + (let ((sv-120 0)) + (let ((v1-15 sv-96)) + (vector-! (-> v1-15 dir) (-> v1-15 dest-pos) (-> v1-15 current-pos)) + (set! (-> v1-15 dir y) 0.0) + (let ((t3-5 (-> v1-15 dir))) + (let ((f0-5 1.0)) + (.lvf vf1 (&-> t3-5 quad)) + (.mul.vf.xyz vf2 vf1 vf1) + (let ((t4-6 f0-5)) + (.mov vf3 t4-6) + ) + ) + (.mul.x.vf.w acc vf0 vf2) + (.add.mul.y.vf.w acc vf0 vf2 acc) + (.add.mul.z.vf.w vf2 vf0 vf2 acc) + (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) + (.wait.vf) + (.mul.vf.xyz vf1 vf1 Q) + (.nop.vf) + (.nop.vf) + (.nop.vf) + (.svf (&-> t3-5 quad) vf1) + ) + (set! (-> v1-15 next-poly) #f) + (set! (-> v1-15 len) 0.0) + (set! (-> v1-15 last-edge) -1) + (set! (-> v1-15 terminated) #f) + (set! (-> v1-15 reached-dest) #f) + (set! (-> v1-15 hit-boundary) #f) + (set! (-> v1-15 hit-gap) #f) + (set! (-> v1-15 ignore) (the-as uint 3)) ) - (set! sv-128 -1) - (set! sv-136 (-> t3-8 work)) - (set! sv-140 (-> v1-19 current-poly)) - (set! sv-144 (-> v1-19 current-poly vertex-count)) - (set! sv-148 (-> t3-8 work vert0-table)) - (set! sv-152 (-> t3-8 work vert1-table)) - (set! sv-156 (- (-> v1-19 dest-pos x) (-> v1-19 current-pos x))) - (set! sv-160 (- (-> v1-19 dest-pos z) (-> v1-19 current-pos z))) - (dotimes (t4-16 (the-as int sv-144)) - (set! sv-164 (-> sv-140 vertex (-> sv-148 t4-16))) - (set! sv-168 (-> sv-140 vertex (-> sv-152 t4-16))) - (set! sv-172 (- (-> sv-164 z) (-> sv-168 z))) - (set! sv-176 (- (-> sv-168 x) (-> sv-164 x))) - (let ((f0-17 (+ (* sv-156 sv-172) (* sv-160 sv-176)))) - (when (< 0.0 f0-17) - (let ((f1-15 (+ (* sv-172 (- (-> sv-164 x) (-> v1-19 current-pos x))) - (* sv-176 (- (-> sv-164 z) (-> v1-19 current-pos z))) - ) - ) + 0 + (until v1-22 + (+! sv-120 1) + (let ((t3-8 this) + (v1-19 sv-96) + (sv-128 -1) + ) + (let ((sv-136 (-> t3-8 work))) + ) + (let ((sv-140 (-> v1-19 current-poly)) + (sv-144 (-> v1-19 current-poly vertex-count)) + (sv-148 (-> t3-8 work vert0-table)) + (sv-152 (-> t3-8 work vert1-table)) + (sv-156 (- (-> v1-19 dest-pos x) (-> v1-19 current-pos x))) + (sv-160 (- (-> v1-19 dest-pos z) (-> v1-19 current-pos z))) ) - (when (< f1-15 f0-17) - (set! sv-128 t4-16) - (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) - (set! sv-156 (* sv-156 f0-19)) - (set! sv-160 (* sv-160 f0-19)) + (dotimes (t4-16 (the-as int sv-144)) + (let* ((sv-164 (-> sv-140 vertex (-> sv-148 t4-16))) + (sv-168 (-> sv-140 vertex (-> sv-152 t4-16))) + (sv-172 (- (-> sv-164 z) (-> sv-168 z))) + (sv-176 (- (-> sv-168 x) (-> sv-164 x))) + (f0-17 (+ (* sv-156 sv-172) (* sv-160 sv-176))) + ) + (when (< 0.0 f0-17) + (let ((f1-15 + (+ (* sv-172 (- (-> sv-164 x) (-> v1-19 current-pos x))) + (* sv-176 (- (-> sv-164 z) (-> v1-19 current-pos z))) + ) + ) + ) + (when (< f1-15 f0-17) + (set! sv-128 t4-16) + (let ((f0-19 (fmax 0.0 (/ f1-15 f0-17)))) + (set! sv-156 (* sv-156 f0-19)) + (set! sv-160 (* sv-160 f0-19)) + ) + ) + ) + ) + ) + ) + (let ((f0-23 (+ (* sv-156 (-> v1-19 dir x)) (* sv-160 (-> v1-19 dir z))))) + (+! (-> v1-19 len) f0-23) + ) + 0 + (set! (-> v1-19 next-poly) #f) + (cond + ((= sv-128 -1) + (set! (-> v1-19 current-pos quad) (-> v1-19 dest-pos quad)) + (set! (-> v1-19 reached-dest) #t) + (set! (-> v1-19 terminated) #t) + ) + (else + (+! (-> v1-19 current-pos x) sv-156) + (+! (-> v1-19 current-pos z) sv-160) + (let ((sv-180 (-> sv-140 adj-poly sv-128))) + (if (!= sv-180 255) + (set! (-> v1-19 next-poly) (-> t3-8 poly-array sv-180)) + ) + ) + (cond + ((and (-> v1-19 next-poly) (not (logtest? (-> v1-19 next-poly pat) (-> v1-19 ignore)))) + (set! (-> v1-19 current-poly) (-> v1-19 next-poly)) + ) + (else + (set! (-> v1-19 last-edge) sv-128) + (if (-> v1-19 next-poly) + (set! (-> v1-19 hit-gap) #t) + (set! (-> v1-19 hit-boundary) #t) + ) + (set! (-> v1-19 terminated) #t) + ) + ) ) ) ) ) + 0 + (set! v1-22 (or (>= sv-120 15) (or (>= (-> sv-96 len) (fmax 20480.0 arg3)) (-> sv-96 terminated)))) ) ) - (let ((f0-23 (+ (* sv-156 (-> v1-19 dir x)) (* sv-160 (-> v1-19 dir z))))) - (+! (-> v1-19 len) f0-23) - ) - 0 - (set! (-> v1-19 next-poly) #f) - (cond - ((= sv-128 -1) - (set! (-> v1-19 current-pos quad) (-> v1-19 dest-pos quad)) - (set! (-> v1-19 reached-dest) #t) - (set! (-> v1-19 terminated) #t) - ) - (else - (+! (-> v1-19 current-pos x) sv-156) - (+! (-> v1-19 current-pos z) sv-160) - (set! sv-180 (-> sv-140 adj-poly sv-128)) - (if (!= sv-180 255) - (set! (-> v1-19 next-poly) (-> t3-8 poly-array sv-180)) - ) - (cond - ((and (-> v1-19 next-poly) (not (logtest? (-> v1-19 next-poly pat) (-> v1-19 ignore)))) - (set! (-> v1-19 current-poly) (-> v1-19 next-poly)) - ) - (else - (set! (-> v1-19 last-edge) sv-128) - (if (-> v1-19 next-poly) - (set! (-> v1-19 hit-gap) #t) - (set! (-> v1-19 hit-boundary) #t) - ) - (set! (-> v1-19 terminated) #t) + (set! sv-100 + (cond + ((and (-> sv-96 hit-boundary) (and (< (-> sv-96 len) arg3) (!= (-> sv-96 last-edge) -1) (< sv-104 1))) + (+! sv-104 1) + (let* ((sv-184 (-> arg1 vertex (-> sv-112 vert0-table (-> sv-96 last-edge)))) + (sv-188 (-> arg1 vertex (-> sv-112 vert1-table (-> sv-96 last-edge)))) + (sv-192 (- (-> sv-184 z) (-> sv-188 z))) + (sv-196 (- (-> sv-188 x) (-> sv-184 x))) + (sv-200 (-> arg2 x)) + (sv-204 (-> arg2 z)) + ) + (let* ((f0-41 (sqrtf (+ (square sv-192) (square sv-196)))) + (f0-43 (/ 1.0 f0-41)) + ) + (set! sv-192 (* sv-192 f0-43)) + (set! sv-196 (* sv-196 f0-43)) + ) + (when arg5 + (set! (-> arg5 found-boundary) #t) + (vector+! (-> arg5 intersection) (-> sv-96 current-pos) (-> this bounds)) + (set! (-> arg5 boundary-normal x) sv-192) + (set! (-> arg5 boundary-normal y) 0.0) + (set! (-> arg5 boundary-normal z) sv-196) + (set! (-> arg5 poly) (-> sv-96 current-poly)) + (set! (-> arg5 edge) (-> sv-96 last-edge)) + (vector+! (-> arg5 vert-0) sv-184 (-> this bounds)) + (vector+! (-> arg5 vert-1) sv-188 (-> this bounds)) + ) + (set! (-> sv-96 dest-pos quad) (-> sv-96 current-pos quad)) + (set! sv-100 (cond + (arg4 + (let ((f0-49 (* 1.01 (+ (* sv-192 sv-200) (* sv-196 sv-204))))) + (set! sv-200 (- sv-200 (* sv-192 f0-49))) + (set! sv-204 (- sv-204 (* sv-196 f0-49))) + ) + (+! (-> sv-96 dest-pos x) sv-200) + (+! (-> sv-96 dest-pos z) sv-204) + sv-100 + ) + (else + #t + ) + ) + ) + ) + sv-100 + ) + ((-> sv-96 hit-gap) + (if arg5 + (set! (-> arg5 gap-poly) (-> sv-96 next-poly)) + ) + (set! sv-100 #t) + sv-100 + ) + (else + #t + ) ) ) - ) - ) - ) - 0 - (set! v1-22 (or (>= sv-120 15) (or (>= (-> sv-96 len) (fmax 20480.0 arg3)) (-> sv-96 terminated)))) - ) - (cond - ((and (-> sv-96 hit-boundary) (and (< (-> sv-96 len) arg3) (!= (-> sv-96 last-edge) -1) (< sv-104 1))) - (set! sv-104 (+ sv-104 1)) - (set! sv-184 (-> arg1 vertex (-> sv-112 vert0-table (-> sv-96 last-edge)))) - (set! sv-188 (-> arg1 vertex (-> sv-112 vert1-table (-> sv-96 last-edge)))) - (set! sv-192 (- (-> sv-184 z) (-> sv-188 z))) - (set! sv-196 (- (-> sv-188 x) (-> sv-184 x))) - (set! sv-200 (-> arg2 x)) - (set! sv-204 (-> arg2 z)) - (let* ((f0-37 sv-192) - (f0-39 (* f0-37 f0-37)) - (f1-30 sv-196) - (f0-41 (sqrtf (+ f0-39 (* f1-30 f1-30)))) - (f0-43 (/ 1.0 f0-41)) - ) - (set! sv-192 (* sv-192 f0-43)) - (set! sv-196 (* sv-196 f0-43)) - ) - (when arg5 - (set! (-> arg5 found-boundary) #t) - (vector+! (-> arg5 intersection) (-> sv-96 current-pos) (-> this bounds)) - (set! (-> arg5 boundary-normal x) sv-192) - (set! (-> arg5 boundary-normal y) 0.0) - (set! (-> arg5 boundary-normal z) sv-196) - (set! (-> arg5 poly) (-> sv-96 current-poly)) - (set! (-> arg5 edge) (-> sv-96 last-edge)) - (vector+! (-> arg5 vert-0) sv-184 (-> this bounds)) - (vector+! (-> arg5 vert-1) sv-188 (-> this bounds)) - ) - (set! (-> sv-96 dest-pos quad) (-> sv-96 current-pos quad)) - (cond - (arg4 - (let ((f0-49 (* 1.01 (+ (* sv-192 sv-200) (* sv-196 sv-204))))) - (set! sv-200 (- sv-200 (* sv-192 f0-49))) - (set! sv-204 (- sv-204 (* sv-196 f0-49))) - ) - (+! (-> sv-96 dest-pos x) sv-200) - (+! (-> sv-96 dest-pos z) sv-204) - ) - (else - (set! sv-100 #t) - ) - ) - ) - ((-> sv-96 hit-gap) - (if arg5 - (set! (-> arg5 gap-poly) (-> sv-96 next-poly)) - ) - (set! sv-100 #t) - ) - (else - (set! sv-100 #t) ) ) + (vector-! arg2 (-> sv-96 current-pos) arg0) ) - (vector-! arg2 (-> sv-96 current-pos) arg0) 0 (label cfg-62) 0 @@ -2478,9 +2420,9 @@ ;; definition for method 12 of type nav-control (defmethod cloest-point-on-mesh ((this nav-control) (arg0 vector) (arg1 vector) (arg2 nav-poly)) - (local-vars (sv-16 vector)) - (set! sv-16 arg0) - (let ((gp-0 (new 'stack-no-clear 'nav-find-poly-parms))) + (let ((sv-16 arg0) + (gp-0 (new 'stack-no-clear 'nav-find-poly-parms)) + ) (set! (-> gp-0 poly) arg2) (vector-! (-> gp-0 point) arg1 (-> this state mesh bounds)) (when (or (not (-> gp-0 poly)) (not (point-in-poly? (-> this state mesh) (-> gp-0 poly) (-> gp-0 point)))) @@ -2525,9 +2467,7 @@ (vf2 :class vf) (vf3 :class vf) ) - (let* ((f0-0 arg3) - (f0-2 (* f0-0 f0-0)) - ) + (let ((f0-2 (square arg3))) (let ((v1-1 arg0) (t0-0 arg1) ) @@ -2553,10 +2493,7 @@ (when (not v0-0) (let* ((f0-4 (- (-> arg2 x) (-> arg1 x))) (f1-4 (- (-> arg2 z) (-> arg1 z))) - (f2-2 f0-4) - (f2-4 (* f2-2 f2-2)) - (f3-0 f1-4) - (f2-6 (sqrtf (+ f2-4 (* f3-0 f3-0)))) + (f2-6 (sqrtf (+ (square f0-4) (square f1-4)))) (f3-3 f2-6) (f3-5 (/ 1.0 f3-3)) (f5-0 (* f3-5 (- f1-4))) @@ -2566,7 +2503,7 @@ ) (when (>= arg3 (fabs (+ (* f3-7 f5-0) (* f4-4 f6-0)))) (let ((f0-6 (+ (* f3-7 f0-4) (* f4-4 f1-4)))) - (set! v0-0 (and (>= f0-6 0.0) (>= (* f2-6 f2-6) f0-6))) + (set! v0-0 (and (>= f0-6 0.0) (>= (square f2-6) f0-6))) ) ) ) @@ -2582,13 +2519,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod navigate-using-route-portals ((this nav-state)) - (local-vars - (v1-117 float) - (sv-112 vector) - (sv-116 nav-route-portal) - (sv-120 (inline-array vector)) - (sv-124 symbol) - ) + (local-vars (v1-117 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -2596,159 +2527,157 @@ ) (init-vf0-vector) (set! (-> this virtual-current-poly) (-> this current-poly)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-116 (new 'stack-no-clear 'nav-route-portal)) - (set! sv-120 (new 'stack-no-clear 'inline-array 'vector 2)) - (set! sv-124 (the-as symbol #f)) - (vector-! (-> this current-pos-local) (-> this current-pos) (-> this mesh bounds)) - (set! (-> this virtual-current-pos-local quad) (-> this current-pos-local quad)) - (set! (-> sv-116 next-poly) #f) - (when (not (logtest? (-> this flags) (nav-state-flag directional-mode))) - (let ((s5-0 (new 'stack-no-clear 'vector))) - (let ((s4-0 (new 'stack-no-clear 'nav-find-poly-parms))) - (vector-! s5-0 (-> this target-post) (-> this mesh bounds)) - (when (or (logtest? (-> this flags) (nav-state-flag target-poly-dirty)) (not (-> this target-poly))) - (set! (-> s4-0 point quad) (-> s5-0 quad)) - (set! (-> s4-0 y-threshold) (-> this nav nearest-y-threshold)) - (set! (-> s4-0 ignore) (the-as uint 3)) - (find-nearest-poly-to-point-local (-> this mesh) s4-0) - (set! (-> this target-poly) (-> s4-0 poly)) - (if (not (-> this target-poly)) - (set! (-> this target-poly) (-> this current-poly)) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (sv-116 (new 'stack-no-clear 'nav-route-portal)) + (sv-120 (new 'stack-no-clear 'inline-array 'vector 2)) + (sv-124 (the-as symbol #f)) + ) + (vector-! (-> this current-pos-local) (-> this current-pos) (-> this mesh bounds)) + (set! (-> this virtual-current-pos-local quad) (-> this current-pos-local quad)) + (set! (-> sv-116 next-poly) #f) + (when (not (logtest? (-> this flags) (nav-state-flag directional-mode))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((s4-0 (new 'stack-no-clear 'nav-find-poly-parms))) + (vector-! s5-0 (-> this target-post) (-> this mesh bounds)) + (when (or (logtest? (-> this flags) (nav-state-flag target-poly-dirty)) (not (-> this target-poly))) + (set! (-> s4-0 point quad) (-> s5-0 quad)) + (set! (-> s4-0 y-threshold) (-> this nav nearest-y-threshold)) + (set! (-> s4-0 ignore) (the-as uint 3)) + (find-nearest-poly-to-point-local (-> this mesh) s4-0) + (set! (-> this target-poly) (-> s4-0 poly)) + (if (not (-> this target-poly)) + (set! (-> this target-poly) (-> this current-poly)) + ) + (logclear! (-> this flags) (nav-state-flag target-poly-dirty)) + ) + ) + (project-point-into-poly-2d (-> this mesh) (-> this target-poly) sv-112 s5-0) + ) + (set! (-> sv-112 y) (-> this current-pos-local y)) + (vector-! (-> this travel) sv-112 (-> this current-pos-local)) + (set! (-> this travel y) 0.0) + (let ((v1-32 (-> this travel))) + (if (< (+ (* (-> v1-32 x) (-> v1-32 x)) (* (-> v1-32 z) (-> v1-32 z))) (square 4096.0)) + (logior! (-> this flags) (nav-state-flag at-target)) + ) + ) + (get-route-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-116) + ) + (cond + ((not (-> sv-116 next-poly)) + (set! (-> this next-poly) #f) + ) + (else + (set! (-> this next-poly) (-> sv-116 next-poly)) + (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) + (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) + (set! sv-124 #t) + (while (and sv-124 (-> sv-116 next-poly) (test-xz-point-on-line-segment? + (-> this current-pos-local) + (the-as vector (-> sv-116 vertex)) + (-> sv-116 vertex 1) + 409.59998 + ) + ) + (when #t + #t + (vector-segment-distance-point! + (-> this current-pos-local) + (the-as vector (-> sv-116 vertex)) + (-> sv-116 vertex 1) + (-> this virtual-current-pos-local) ) - (logclear! (-> this flags) (nav-state-flag target-poly-dirty)) - ) - ) - (project-point-into-poly-2d (-> this mesh) (-> this target-poly) sv-112 s5-0) - ) - (set! (-> sv-112 y) (-> this current-pos-local y)) - (vector-! (-> this travel) sv-112 (-> this current-pos-local)) - (set! (-> this travel y) 0.0) - (let* ((v1-32 (-> this travel)) - (f0-6 (+ (* (-> v1-32 x) (-> v1-32 x)) (* (-> v1-32 z) (-> v1-32 z)))) - (f1-3 4096.0) - ) - (if (< f0-6 (* f1-3 f1-3)) - (logior! (-> this flags) (nav-state-flag at-target)) - ) - ) - (get-route-portal (-> this mesh) (-> this current-poly) (-> this target-poly) sv-116) - ) - (cond - ((not (-> sv-116 next-poly)) - (set! (-> this next-poly) #f) - ) - (else - (set! (-> this next-poly) (-> sv-116 next-poly)) - (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) - (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) - (set! sv-124 #t) - (while (and sv-124 (-> sv-116 next-poly) (test-xz-point-on-line-segment? - (-> this current-pos-local) - (the-as vector (-> sv-116 vertex)) - (-> sv-116 vertex 1) - 409.59998 - ) - ) - (when #t - #t - (vector-segment-distance-point! - (-> this current-pos-local) - (the-as vector (-> sv-116 vertex)) - (-> sv-116 vertex 1) - (-> this virtual-current-pos-local) + (vector-! (-> this travel) sv-112 (-> this virtual-current-pos-local)) + (set! (-> this travel y) 0.0) + 0 ) - (vector-! (-> this travel) sv-112 (-> this virtual-current-pos-local)) - (set! (-> this travel y) 0.0) - 0 - ) - (set! (-> this virtual-current-poly) (-> sv-116 next-poly)) - (cond - ((get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) sv-116) - (set! (-> this next-poly) (-> sv-116 next-poly)) - (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) - (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) - 0 - ) - (else - (set! (-> this next-poly) #f) - (set! sv-124 (the-as symbol #f)) + (set! (-> this virtual-current-poly) (-> sv-116 next-poly)) + (cond + ((get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) sv-116) + (set! (-> this next-poly) (-> sv-116 next-poly)) + (set! (-> sv-120 0 quad) (-> sv-116 vertex 0 quad)) + (set! (-> sv-120 1 quad) (-> sv-116 vertex 1 quad)) + 0 + ) + (else + (set! (-> this next-poly) #f) + (set! sv-124 (the-as symbol #f)) + ) ) ) ) ) - ) - (when sv-124 - (let ((s5-1 (new 'stack-no-clear 'matrix))) - (vector-! (-> s5-1 vector 0) (-> sv-120 1) (-> sv-120 0)) - (vector-normalize! (-> s5-1 vector 0) 409.6) - (vector+! (-> sv-120 0) (-> sv-120 0) (-> s5-1 vector 0)) - (vector-! (-> sv-120 1) (-> sv-120 1) (-> s5-1 vector 0)) - ) - (when (not (ray-ccw-line-segment-intersection? - (-> this virtual-current-pos-local) - (-> this travel) - (-> sv-120 0) - (-> sv-120 1) + (when sv-124 + (let ((s5-1 (new 'stack-no-clear 'matrix))) + (vector-! (-> s5-1 vector 0) (-> sv-120 1) (-> sv-120 0)) + (vector-normalize! (-> s5-1 vector 0) 409.6) + (vector+! (-> sv-120 0) (-> sv-120 0) (-> s5-1 vector 0)) + (vector-! (-> sv-120 1) (-> sv-120 1) (-> s5-1 vector 0)) + ) + (when (not (ray-ccw-line-segment-intersection? + (-> this virtual-current-pos-local) + (-> this travel) + (-> sv-120 0) + (-> sv-120 1) + ) ) - ) - (let ((s5-2 -1)) - (let* ((f0-8 (cos 8192.0)) - (f0-10 (* f0-8 f0-8)) - (v1-93 (new 'stack-no-clear 'vector)) - (a0-39 (-> this travel)) - (f1-9 (+ (* (-> a0-39 x) (-> a0-39 x)) (* (-> a0-39 z) (-> a0-39 z)))) - ) - (countdown (a0-41 2) - (vector-! v1-93 (-> sv-120 a0-41) (-> this virtual-current-pos-local)) - (let ((f2-5 (vector-dot (-> this travel) v1-93))) - (when (< 0.0 f2-5) - (let* ((f2-7 (* f2-5 f2-5)) - (a1-26 v1-93) - (f2-8 (/ f2-7 (* f1-9 (+ (* (-> a1-26 x) (-> a1-26 x)) (* (-> a1-26 z) (-> a1-26 z)))))) - ) - (when (< f0-10 f2-8) - (set! f0-10 f2-8) - (set! s5-2 a0-41) + (let ((s5-2 -1)) + (let* ((f0-10 (square (cos 8192.0))) + (v1-93 (new 'stack-no-clear 'vector)) + (a0-39 (-> this travel)) + (f1-9 (+ (* (-> a0-39 x) (-> a0-39 x)) (* (-> a0-39 z) (-> a0-39 z)))) + ) + (countdown (a0-41 2) + (vector-! v1-93 (-> sv-120 a0-41) (-> this virtual-current-pos-local)) + (let ((f2-5 (vector-dot (-> this travel) v1-93))) + (when (< 0.0 f2-5) + (let* ((f2-7 (square f2-5)) + (a1-26 v1-93) + (f2-8 (/ f2-7 (* f1-9 (+ (* (-> a1-26 x) (-> a1-26 x)) (* (-> a1-26 z) (-> a1-26 z)))))) + ) + (when (< f0-10 f2-8) + (set! f0-10 f2-8) + (set! s5-2 a0-41) + ) ) ) ) ) ) - ) - (when (= s5-2 -1) - (let ((f30-0 (the-as float #x7f800000)) - (s3-0 (new 'stack-no-clear 'nav-route-portal)) - (s4-1 (new 'stack-no-clear 'vector)) + (when (= s5-2 -1) + (let ((f30-0 (the-as float #x7f800000)) + (s3-0 (new 'stack-no-clear 'nav-route-portal)) + (s4-1 (new 'stack-no-clear 'vector)) + ) + (get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) s3-0) + (cond + ((-> s3-0 next-poly) + (vector+! s4-1 (the-as vector (-> s3-0 vertex)) (the-as vector (-> s3-0 vertex 1))) + (vector-float*! s4-1 s4-1 0.5) + ) + (else + (set! (-> s4-1 quad) (-> sv-112 quad)) + ) ) - (get-route-portal (-> this mesh) (-> sv-116 next-poly) (-> this target-poly) s3-0) - (cond - ((-> s3-0 next-poly) - (vector+! s4-1 (the-as vector (-> s3-0 vertex)) (the-as vector (-> s3-0 vertex 1))) - (vector-float*! s4-1 s4-1 0.5) - ) - (else - (set! (-> s4-1 quad) (-> sv-112 quad)) - ) - ) - (countdown (s3-1 2) - (let* ((s2-0 (-> sv-120 s3-1)) - (f0-13 (+ (vector-vector-xz-distance-squared (-> this virtual-current-pos-local) s2-0) - (vector-vector-xz-distance-squared s4-1 s2-0) - ) - ) - ) - (when (< f0-13 f30-0) - (set! f30-0 f0-13) - (set! s5-2 s3-1) + (countdown (s3-1 2) + (let* ((s2-0 (-> sv-120 s3-1)) + (f0-13 (+ (vector-vector-xz-distance-squared (-> this virtual-current-pos-local) s2-0) + (vector-vector-xz-distance-squared s4-1 s2-0) + ) + ) + ) + (when (< f0-13 f30-0) + (set! f30-0 f0-13) + (set! s5-2 s3-1) + ) ) ) ) ) + (vector-! (-> this travel) (-> sv-120 s5-2) (-> this virtual-current-pos-local)) ) - (vector-! (-> this travel) (-> sv-120 s5-2) (-> this virtual-current-pos-local)) + (set! (-> this travel y) 0.0) ) - (set! (-> this travel y) 0.0) ) ) (.lvf vf1 (&-> (-> this travel) quad)) @@ -2758,10 +2687,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-117 vf1) - (let ((f0-15 v1-117) - (f1-10 (-> this nav nav-cull-radius)) - ) - (if (< (* f1-10 f1-10) f0-15) + (let ((f0-15 v1-117)) + (if (< (square (-> this nav nav-cull-radius)) f0-15) (vector-float*! (-> this travel) (-> this travel) (/ (-> this nav nav-cull-radius) (sqrtf f0-15))) ) ) @@ -2846,21 +2773,6 @@ ;; WARN: Stack slot offset 128 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod navigate-using-best-dir-use-existing-avoid-spheres ((this nav-state) (arg0 nav-avoid-spheres-params)) - (local-vars - (sv-96 int) - (sv-104 nav-mesh-work) - (sv-108 nav-poly) - (sv-112 uint) - (sv-116 (pointer int8)) - (sv-120 (pointer int8)) - (sv-124 float) - (sv-128 float) - (sv-132 vector) - (sv-136 vector) - (sv-140 float) - (sv-144 float) - (sv-148 uint) - ) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -2871,13 +2783,9 @@ (init-vf0-vector) (when (-> arg0 avoiding-sphere?) (logior! (-> this flags) (nav-state-flag avoiding-sphere)) - (let ((f0-0 (-> arg0 closest-sphere-dist2)) - (f1-0 512.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (logior! (-> this flags) (nav-state-flag touching-sphere)) - ) - ) + (if (< (-> arg0 closest-sphere-dist2) (square 512.0)) + (logior! (-> this flags) (nav-state-flag touching-sphere)) + ) (set! (-> this travel quad) (-> arg0 out-travel 0 quad)) (let ((v1-10 (new 'stack-no-clear 'nav-ray))) (set! (-> v1-10 current-pos quad) (-> this virtual-current-pos-local quad)) @@ -2920,66 +2828,71 @@ (+! a2-5 1) (let ((t0-6 (-> this mesh)) (a3-5 v1-10) + (sv-96 -1) ) - (set! sv-96 -1) - (set! sv-104 (-> t0-6 work)) - (set! sv-108 (-> a3-5 current-poly)) - (set! sv-112 (-> a3-5 current-poly vertex-count)) - (set! sv-116 (-> t0-6 work vert0-table)) - (set! sv-120 (-> t0-6 work vert1-table)) - (set! sv-124 (- (-> a3-5 dest-pos x) (-> a3-5 current-pos x))) - (set! sv-128 (- (-> a3-5 dest-pos z) (-> a3-5 current-pos z))) - (dotimes (t1-12 (the-as int sv-112)) - (set! sv-132 (-> sv-108 vertex (-> sv-116 t1-12))) - (set! sv-136 (-> sv-108 vertex (-> sv-120 t1-12))) - (set! sv-140 (- (-> sv-132 z) (-> sv-136 z))) - (set! sv-144 (- (-> sv-136 x) (-> sv-132 x))) - (let ((f0-14 (+ (* sv-124 sv-140) (* sv-128 sv-144)))) - (when (< 0.0 f0-14) - (let ((f1-13 - (+ (* sv-140 (- (-> sv-132 x) (-> a3-5 current-pos x))) (* sv-144 (- (-> sv-132 z) (-> a3-5 current-pos z)))) + (let ((sv-104 (-> t0-6 work))) + ) + (let ((sv-108 (-> a3-5 current-poly)) + (sv-112 (-> a3-5 current-poly vertex-count)) + (sv-116 (-> t0-6 work vert0-table)) + (sv-120 (-> t0-6 work vert1-table)) + (sv-124 (- (-> a3-5 dest-pos x) (-> a3-5 current-pos x))) + (sv-128 (- (-> a3-5 dest-pos z) (-> a3-5 current-pos z))) + ) + (dotimes (t1-12 (the-as int sv-112)) + (let* ((sv-132 (-> sv-108 vertex (-> sv-116 t1-12))) + (sv-136 (-> sv-108 vertex (-> sv-120 t1-12))) + (sv-140 (- (-> sv-132 z) (-> sv-136 z))) + (sv-144 (- (-> sv-136 x) (-> sv-132 x))) + (f0-14 (+ (* sv-124 sv-140) (* sv-128 sv-144))) + ) + (when (< 0.0 f0-14) + (let ((f1-13 + (+ (* sv-140 (- (-> sv-132 x) (-> a3-5 current-pos x))) (* sv-144 (- (-> sv-132 z) (-> a3-5 current-pos z)))) + ) + ) + (when (< f1-13 f0-14) + (set! sv-96 t1-12) + (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) + (set! sv-124 (* sv-124 f0-16)) + (set! sv-128 (* sv-128 f0-16)) ) - ) - (when (< f1-13 f0-14) - (set! sv-96 t1-12) - (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) - (set! sv-124 (* sv-124 f0-16)) - (set! sv-128 (* sv-128 f0-16)) ) ) ) ) ) - ) - (let ((f0-20 (+ (* sv-124 (-> a3-5 dir x)) (* sv-128 (-> a3-5 dir z))))) - (+! (-> a3-5 len) f0-20) - ) - 0 - (set! (-> a3-5 next-poly) #f) - (cond - ((= sv-96 -1) - (set! (-> a3-5 current-pos quad) (-> a3-5 dest-pos quad)) - (set! (-> a3-5 reached-dest) #t) - (set! (-> a3-5 terminated) #t) - ) - (else - (+! (-> a3-5 current-pos x) sv-124) - (+! (-> a3-5 current-pos z) sv-128) - (set! sv-148 (-> sv-108 adj-poly sv-96)) - (if (!= sv-148 255) - (set! (-> a3-5 next-poly) (-> t0-6 poly-array sv-148)) - ) - (cond - ((and (-> a3-5 next-poly) (not (logtest? (-> a3-5 next-poly pat) (-> a3-5 ignore)))) - (set! (-> a3-5 current-poly) (-> a3-5 next-poly)) - ) - (else - (set! (-> a3-5 last-edge) sv-96) - (if (-> a3-5 next-poly) - (set! (-> a3-5 hit-gap) #t) - (set! (-> a3-5 hit-boundary) #t) + (let ((f0-20 (+ (* sv-124 (-> a3-5 dir x)) (* sv-128 (-> a3-5 dir z))))) + (+! (-> a3-5 len) f0-20) + ) + 0 + (set! (-> a3-5 next-poly) #f) + (cond + ((= sv-96 -1) + (set! (-> a3-5 current-pos quad) (-> a3-5 dest-pos quad)) + (set! (-> a3-5 reached-dest) #t) + (set! (-> a3-5 terminated) #t) + ) + (else + (+! (-> a3-5 current-pos x) sv-124) + (+! (-> a3-5 current-pos z) sv-128) + (let ((sv-148 (-> sv-108 adj-poly sv-96))) + (if (!= sv-148 255) + (set! (-> a3-5 next-poly) (-> t0-6 poly-array sv-148)) ) - (set! (-> a3-5 terminated) #t) + ) + (cond + ((and (-> a3-5 next-poly) (not (logtest? (-> a3-5 next-poly pat) (-> a3-5 ignore)))) + (set! (-> a3-5 current-poly) (-> a3-5 next-poly)) + ) + (else + (set! (-> a3-5 last-edge) sv-96) + (if (-> a3-5 next-poly) + (set! (-> a3-5 hit-gap) #t) + (set! (-> a3-5 hit-boundary) #t) + ) + (set! (-> a3-5 terminated) #t) + ) ) ) ) @@ -3080,21 +2993,6 @@ ;; WARN: Stack slot offset 224 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod navigate-using-best-dir-recompute-avoid-spheres-1 ((this nav-state)) - (local-vars - (sv-192 int) - (sv-200 nav-mesh-work) - (sv-204 nav-poly) - (sv-208 uint) - (sv-212 (pointer int8)) - (sv-216 (pointer int8)) - (sv-220 float) - (sv-224 float) - (sv-228 vector) - (sv-232 vector) - (sv-236 float) - (sv-240 float) - (sv-244 uint) - ) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -3116,13 +3014,9 @@ (avoid-spheres-1! (-> this nav) s5-0) (when (-> s5-0 avoiding-sphere?) (logior! (-> this flags) (nav-state-flag avoiding-sphere)) - (let ((f0-0 (-> s5-0 closest-sphere-dist2)) - (f1-0 512.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (logior! (-> this flags) (nav-state-flag touching-sphere)) - ) - ) + (if (< (-> s5-0 closest-sphere-dist2) (square 512.0)) + (logior! (-> this flags) (nav-state-flag touching-sphere)) + ) (set! (-> this travel quad) (-> s5-0 out-travel 0 quad)) (let ((v1-15 (new 'stack-no-clear 'nav-ray))) (set! (-> v1-15 current-pos quad) (-> this virtual-current-pos-local quad)) @@ -3165,66 +3059,71 @@ (+! a0-15 1) (let ((a2-6 (-> this mesh)) (a1-6 v1-15) + (sv-192 -1) ) - (set! sv-192 -1) - (set! sv-200 (-> a2-6 work)) - (set! sv-204 (-> a1-6 current-poly)) - (set! sv-208 (-> a1-6 current-poly vertex-count)) - (set! sv-212 (-> a2-6 work vert0-table)) - (set! sv-216 (-> a2-6 work vert1-table)) - (set! sv-220 (- (-> a1-6 dest-pos x) (-> a1-6 current-pos x))) - (set! sv-224 (- (-> a1-6 dest-pos z) (-> a1-6 current-pos z))) - (dotimes (a3-12 (the-as int sv-208)) - (set! sv-228 (-> sv-204 vertex (-> sv-212 a3-12))) - (set! sv-232 (-> sv-204 vertex (-> sv-216 a3-12))) - (set! sv-236 (- (-> sv-228 z) (-> sv-232 z))) - (set! sv-240 (- (-> sv-232 x) (-> sv-228 x))) - (let ((f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240)))) - (when (< 0.0 f0-14) - (let ((f1-13 - (+ (* sv-236 (- (-> sv-228 x) (-> a1-6 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a1-6 current-pos z)))) + (let ((sv-200 (-> a2-6 work))) + ) + (let ((sv-204 (-> a1-6 current-poly)) + (sv-208 (-> a1-6 current-poly vertex-count)) + (sv-212 (-> a2-6 work vert0-table)) + (sv-216 (-> a2-6 work vert1-table)) + (sv-220 (- (-> a1-6 dest-pos x) (-> a1-6 current-pos x))) + (sv-224 (- (-> a1-6 dest-pos z) (-> a1-6 current-pos z))) + ) + (dotimes (a3-12 (the-as int sv-208)) + (let* ((sv-228 (-> sv-204 vertex (-> sv-212 a3-12))) + (sv-232 (-> sv-204 vertex (-> sv-216 a3-12))) + (sv-236 (- (-> sv-228 z) (-> sv-232 z))) + (sv-240 (- (-> sv-232 x) (-> sv-228 x))) + (f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240))) + ) + (when (< 0.0 f0-14) + (let ((f1-13 + (+ (* sv-236 (- (-> sv-228 x) (-> a1-6 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a1-6 current-pos z)))) + ) + ) + (when (< f1-13 f0-14) + (set! sv-192 a3-12) + (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) + (set! sv-220 (* sv-220 f0-16)) + (set! sv-224 (* sv-224 f0-16)) ) - ) - (when (< f1-13 f0-14) - (set! sv-192 a3-12) - (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) - (set! sv-220 (* sv-220 f0-16)) - (set! sv-224 (* sv-224 f0-16)) ) ) ) ) ) - ) - (let ((f0-20 (+ (* sv-220 (-> a1-6 dir x)) (* sv-224 (-> a1-6 dir z))))) - (+! (-> a1-6 len) f0-20) - ) - 0 - (set! (-> a1-6 next-poly) #f) - (cond - ((= sv-192 -1) - (set! (-> a1-6 current-pos quad) (-> a1-6 dest-pos quad)) - (set! (-> a1-6 reached-dest) #t) - (set! (-> a1-6 terminated) #t) - ) - (else - (+! (-> a1-6 current-pos x) sv-220) - (+! (-> a1-6 current-pos z) sv-224) - (set! sv-244 (-> sv-204 adj-poly sv-192)) - (if (!= sv-244 255) - (set! (-> a1-6 next-poly) (-> a2-6 poly-array sv-244)) - ) - (cond - ((and (-> a1-6 next-poly) (not (logtest? (-> a1-6 next-poly pat) (-> a1-6 ignore)))) - (set! (-> a1-6 current-poly) (-> a1-6 next-poly)) - ) - (else - (set! (-> a1-6 last-edge) sv-192) - (if (-> a1-6 next-poly) - (set! (-> a1-6 hit-gap) #t) - (set! (-> a1-6 hit-boundary) #t) + (let ((f0-20 (+ (* sv-220 (-> a1-6 dir x)) (* sv-224 (-> a1-6 dir z))))) + (+! (-> a1-6 len) f0-20) + ) + 0 + (set! (-> a1-6 next-poly) #f) + (cond + ((= sv-192 -1) + (set! (-> a1-6 current-pos quad) (-> a1-6 dest-pos quad)) + (set! (-> a1-6 reached-dest) #t) + (set! (-> a1-6 terminated) #t) + ) + (else + (+! (-> a1-6 current-pos x) sv-220) + (+! (-> a1-6 current-pos z) sv-224) + (let ((sv-244 (-> sv-204 adj-poly sv-192))) + (if (!= sv-244 255) + (set! (-> a1-6 next-poly) (-> a2-6 poly-array sv-244)) ) - (set! (-> a1-6 terminated) #t) + ) + (cond + ((and (-> a1-6 next-poly) (not (logtest? (-> a1-6 next-poly pat) (-> a1-6 ignore)))) + (set! (-> a1-6 current-poly) (-> a1-6 next-poly)) + ) + (else + (set! (-> a1-6 last-edge) sv-192) + (if (-> a1-6 next-poly) + (set! (-> a1-6 hit-gap) #t) + (set! (-> a1-6 hit-boundary) #t) + ) + (set! (-> a1-6 terminated) #t) + ) ) ) ) @@ -3286,10 +3185,9 @@ (cond ((logtest? (-> this nav flags) (nav-control-flag limit-rotation-rate)) (let ((s5-0 (nav-state-method-39 this))) - (let* ((f0-1 40.96) - (f0-3 (* f0-1 f0-1)) - (v1-8 (-> this travel)) - ) + (let ((f0-3 (square 40.96)) + (v1-8 (-> this travel)) + ) (when (< f0-3 (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z)))) (set! (-> this heading quad) (-> this travel quad)) (set! (-> this heading y) 0.0) @@ -3333,10 +3231,9 @@ ) ) (else - (let* ((f0-8 40.96) - (f0-10 (* f0-8 f0-8)) - (v1-26 (-> this travel)) - ) + (let ((f0-10 (square 40.96)) + (v1-26 (-> this travel)) + ) (when (< f0-10 (+ (* (-> v1-26 x) (-> v1-26 x)) (* (-> v1-26 z) (-> v1-26 z)))) (set! (-> this heading quad) (-> this travel quad)) (set! (-> this heading y) 0.0) @@ -3389,11 +3286,8 @@ ) (when (-> s5-0 gap-poly) (set! (-> this next-poly) (-> s5-0 gap-poly)) - (let* ((v1-12 (-> this travel)) - (f0-4 (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z)))) - (f1-3 1024.0) - ) - (if (< f0-4 (* f1-3 f1-3)) + (let ((v1-12 (-> this travel))) + (if (< (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))) (square 1024.0)) (logior! (-> this flags) (nav-state-flag at-gap)) ) ) @@ -3415,7 +3309,6 @@ ;; WARN: Stack slot offset 56 signed mismatch ;; WARN: Stack slot offset 56 signed mismatch (defmethod plan-over-pat1-polys-using-route ((this nav-state) (arg0 nav-gap-info)) - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) (let ((a1-1 (-> this next-poly))) (when (logtest? (-> a1-1 pat) 1) (while (and a1-1 (logtest? (-> a1-1 pat) 1)) @@ -3426,23 +3319,22 @@ (-> this mesh) (let ((s3-0 (-> arg0 poly)) (s4-0 (-> arg0 dest)) + (s2-0 (-> this current-pos-local)) + (sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) ) - (let ((s2-0 (-> this current-pos-local))) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 10000000000000000000000000000000000000.0) - (let* ((s1-0 (-> s3-0 vertex-count)) - (v1-13 (the-as int (+ s1-0 -1))) - ) - (dotimes (s0-0 (the-as int s1-0)) - (let ((f0-1 (vector-segment-distance-point! s2-0 (-> s3-0 vertex v1-13) (-> s3-0 vertex s0-0) sv-48))) - (when (< f0-1 sv-56) - (set! sv-56 f0-1) - (set! (-> sv-52 quad) (-> sv-48 quad)) - ) + (let* ((sv-56 10000000000000000000000000000000000000.0) + (s1-0 (-> s3-0 vertex-count)) + (v1-13 (the-as int (+ s1-0 -1))) + ) + (dotimes (s0-0 (the-as int s1-0)) + (let ((f0-1 (vector-segment-distance-point! s2-0 (-> s3-0 vertex v1-13) (-> s3-0 vertex s0-0) sv-48))) + (when (< f0-1 sv-56) + (set! sv-56 f0-1) + (set! (-> sv-52 quad) (-> sv-48 quad)) ) - (set! v1-13 s0-0) ) + (set! v1-13 s0-0) ) ) (set! (-> s4-0 quad) (-> sv-52 quad)) @@ -3569,7 +3461,6 @@ ;; WARN: Stack slot offset 204 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod compute-travel-speed ((this nav-state)) - (local-vars (sv-192 float) (sv-196 float) (sv-200 float) (sv-204 float) (sv-224 vector)) (let ((s5-0 this)) (let ((s4-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info))) (clamp-vector-to-mesh-cross-gaps @@ -3586,11 +3477,8 @@ ) (when (-> s4-0 gap-poly) (set! (-> s5-0 next-poly) (-> s4-0 gap-poly)) - (let* ((v1-12 (-> s5-0 travel)) - (f0-4 (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z)))) - (f1-3 1024.0) - ) - (if (< f0-4 (* f1-3 f1-3)) + (let ((v1-12 (-> s5-0 travel))) + (if (< (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))) (square 1024.0)) (logior! (-> s5-0 flags) (nav-state-flag at-gap)) ) ) @@ -3605,17 +3493,19 @@ 0 (cond ((logtest? (-> this nav flags) (nav-control-flag use-momentum)) - (set! sv-192 (-> this nav target-speed)) - (if (not (logtest? (-> this nav flags) (nav-control-flag momentum-ignore-heading))) - (set! sv-192 (* sv-192 (fmax 0.0 (vector-dot (-> this heading) (-> this target-dir))))) - ) - (set! sv-196 (- sv-192 (-> this speed))) - (set! sv-200 (* (-> this nav sec-per-frame) (-> this nav acceleration))) - (set! sv-204 (fmin sv-200 (fabs sv-196))) - (if (< sv-196 0.0) - (set! (-> this speed) (- (-> this speed) sv-204)) - (+! (-> this speed) sv-204) + (let ((sv-192 (-> this nav target-speed))) + (if (not (logtest? (-> this nav flags) (nav-control-flag momentum-ignore-heading))) + (set! sv-192 (* (the-as meters sv-192) (fmax 0.0 (vector-dot (-> this heading) (-> this target-dir))))) + ) + (let* ((sv-196 (- sv-192 (-> this speed))) + (sv-204 (fmin (* (-> this nav sec-per-frame) (-> this nav acceleration)) (fabs sv-196))) + ) + (if (< sv-196 0.0) + (set! (-> this speed) (- (-> this speed) sv-204)) + (+! (-> this speed) sv-204) + ) ) + ) ) (else (set! (-> this speed) (-> this nav target-speed)) @@ -3623,16 +3513,16 @@ ) (let* ((f0-22 (/ (vector-length (-> this travel)) (-> this nav sec-per-frame))) (f1-18 (fmin (* (-> this nav speed-scale) (-> this speed)) f0-22)) + (sv-224 (new 'stack-no-clear 'vector)) ) - (set! sv-224 (new 'stack-no-clear 'vector)) (when (< f0-22 (-> this speed)) (set! (-> this prev-speed) (-> this speed)) (set! (-> this speed) (/ f0-22 (-> this nav speed-scale))) ) (vector-normalize-copy! sv-224 (-> this travel) f1-18) + (set! (-> this velocity x) (-> sv-224 x)) + (set! (-> this velocity z) (-> sv-224 z)) ) - (set! (-> this velocity x) (-> sv-224 x)) - (set! (-> this velocity z) (-> sv-224 z)) 0 (none) ) @@ -3832,21 +3722,6 @@ ;; WARN: Stack slot offset 224 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod navigate-using-best-dir-recompute-avoid-spheres-2 ((this nav-state)) - (local-vars - (sv-192 int) - (sv-200 nav-mesh-work) - (sv-204 nav-poly) - (sv-208 uint) - (sv-212 (pointer int8)) - (sv-216 (pointer int8)) - (sv-220 float) - (sv-224 float) - (sv-228 vector) - (sv-232 vector) - (sv-236 float) - (sv-240 float) - (sv-244 uint) - ) (rlet ((acc :class vf) (Q :class vf) (vf0 :class vf) @@ -3869,13 +3744,9 @@ (let ((v1-5 this)) (when (-> s5-0 avoiding-sphere?) (logior! (-> v1-5 flags) (nav-state-flag avoiding-sphere)) - (let ((f0-0 (-> s5-0 closest-sphere-dist2)) - (f1-0 512.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (logior! (-> v1-5 flags) (nav-state-flag touching-sphere)) - ) - ) + (if (< (-> s5-0 closest-sphere-dist2) (square 512.0)) + (logior! (-> v1-5 flags) (nav-state-flag touching-sphere)) + ) (set! (-> v1-5 travel quad) (-> s5-0 out-travel 0 quad)) (let ((a0-20 (new 'stack-no-clear 'nav-ray))) (set! (-> a0-20 current-pos quad) (-> v1-5 virtual-current-pos-local quad)) @@ -3918,66 +3789,71 @@ (+! a1-6 1) (let ((a3-6 (-> v1-5 mesh)) (a2-5 a0-20) + (sv-192 -1) ) - (set! sv-192 -1) - (set! sv-200 (-> a3-6 work)) - (set! sv-204 (-> a2-5 current-poly)) - (set! sv-208 (-> a2-5 current-poly vertex-count)) - (set! sv-212 (-> a3-6 work vert0-table)) - (set! sv-216 (-> a3-6 work vert1-table)) - (set! sv-220 (- (-> a2-5 dest-pos x) (-> a2-5 current-pos x))) - (set! sv-224 (- (-> a2-5 dest-pos z) (-> a2-5 current-pos z))) - (dotimes (t0-12 (the-as int sv-208)) - (set! sv-228 (-> sv-204 vertex (-> sv-212 t0-12))) - (set! sv-232 (-> sv-204 vertex (-> sv-216 t0-12))) - (set! sv-236 (- (-> sv-228 z) (-> sv-232 z))) - (set! sv-240 (- (-> sv-232 x) (-> sv-228 x))) - (let ((f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240)))) - (when (< 0.0 f0-14) - (let ((f1-13 - (+ (* sv-236 (- (-> sv-228 x) (-> a2-5 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a2-5 current-pos z)))) + (let ((sv-200 (-> a3-6 work))) + ) + (let ((sv-204 (-> a2-5 current-poly)) + (sv-208 (-> a2-5 current-poly vertex-count)) + (sv-212 (-> a3-6 work vert0-table)) + (sv-216 (-> a3-6 work vert1-table)) + (sv-220 (- (-> a2-5 dest-pos x) (-> a2-5 current-pos x))) + (sv-224 (- (-> a2-5 dest-pos z) (-> a2-5 current-pos z))) + ) + (dotimes (t0-12 (the-as int sv-208)) + (let* ((sv-228 (-> sv-204 vertex (-> sv-212 t0-12))) + (sv-232 (-> sv-204 vertex (-> sv-216 t0-12))) + (sv-236 (- (-> sv-228 z) (-> sv-232 z))) + (sv-240 (- (-> sv-232 x) (-> sv-228 x))) + (f0-14 (+ (* sv-220 sv-236) (* sv-224 sv-240))) + ) + (when (< 0.0 f0-14) + (let ((f1-13 + (+ (* sv-236 (- (-> sv-228 x) (-> a2-5 current-pos x))) (* sv-240 (- (-> sv-228 z) (-> a2-5 current-pos z)))) + ) + ) + (when (< f1-13 f0-14) + (set! sv-192 t0-12) + (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) + (set! sv-220 (* sv-220 f0-16)) + (set! sv-224 (* sv-224 f0-16)) ) - ) - (when (< f1-13 f0-14) - (set! sv-192 t0-12) - (let ((f0-16 (fmax 0.0 (/ f1-13 f0-14)))) - (set! sv-220 (* sv-220 f0-16)) - (set! sv-224 (* sv-224 f0-16)) ) ) ) ) ) - ) - (let ((f0-20 (+ (* sv-220 (-> a2-5 dir x)) (* sv-224 (-> a2-5 dir z))))) - (+! (-> a2-5 len) f0-20) - ) - 0 - (set! (-> a2-5 next-poly) #f) - (cond - ((= sv-192 -1) - (set! (-> a2-5 current-pos quad) (-> a2-5 dest-pos quad)) - (set! (-> a2-5 reached-dest) #t) - (set! (-> a2-5 terminated) #t) - ) - (else - (+! (-> a2-5 current-pos x) sv-220) - (+! (-> a2-5 current-pos z) sv-224) - (set! sv-244 (-> sv-204 adj-poly sv-192)) - (if (!= sv-244 255) - (set! (-> a2-5 next-poly) (-> a3-6 poly-array sv-244)) - ) - (cond - ((and (-> a2-5 next-poly) (not (logtest? (-> a2-5 next-poly pat) (-> a2-5 ignore)))) - (set! (-> a2-5 current-poly) (-> a2-5 next-poly)) - ) - (else - (set! (-> a2-5 last-edge) sv-192) - (if (-> a2-5 next-poly) - (set! (-> a2-5 hit-gap) #t) - (set! (-> a2-5 hit-boundary) #t) + (let ((f0-20 (+ (* sv-220 (-> a2-5 dir x)) (* sv-224 (-> a2-5 dir z))))) + (+! (-> a2-5 len) f0-20) + ) + 0 + (set! (-> a2-5 next-poly) #f) + (cond + ((= sv-192 -1) + (set! (-> a2-5 current-pos quad) (-> a2-5 dest-pos quad)) + (set! (-> a2-5 reached-dest) #t) + (set! (-> a2-5 terminated) #t) + ) + (else + (+! (-> a2-5 current-pos x) sv-220) + (+! (-> a2-5 current-pos z) sv-224) + (let ((sv-244 (-> sv-204 adj-poly sv-192))) + (if (!= sv-244 255) + (set! (-> a2-5 next-poly) (-> a3-6 poly-array sv-244)) ) - (set! (-> a2-5 terminated) #t) + ) + (cond + ((and (-> a2-5 next-poly) (not (logtest? (-> a2-5 next-poly pat) (-> a2-5 ignore)))) + (set! (-> a2-5 current-poly) (-> a2-5 next-poly)) + ) + (else + (set! (-> a2-5 last-edge) sv-192) + (if (-> a2-5 next-poly) + (set! (-> a2-5 hit-gap) #t) + (set! (-> a2-5 hit-boundary) #t) + ) + (set! (-> a2-5 terminated) #t) + ) ) ) ) @@ -4039,8 +3915,7 @@ (.mov v1-11 vf1) (let ((f30-0 v1-11)) (vector-normalize! (-> s5-0 right-dir) 2.0) - (let* ((f0-4 (+ (-> this nav root-nav-sphere w) (-> s3-0 r))) - (f1-1 (* f0-4 f0-4)) + (let* ((f1-1 (square (+ (-> this nav root-nav-sphere w) (-> s3-0 r)))) (f0-7 (fmax 0.0 (/ (- f1-1 f30-0) f1-1))) ) (vector-float*! (-> s5-0 right-dir) (-> s5-0 right-dir) (* 81920.0 f0-7)) @@ -4060,10 +3935,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-25 vf1) - (let ((f0-11 v1-25) - (f1-4 (-> this nav target-speed)) - ) - (if (< (* f1-4 f1-4) f0-11) + (let ((f0-11 v1-25)) + (if (< (square (-> this nav target-speed)) f0-11) (vector-float*! (-> this velocity) (-> this velocity) (/ (-> this nav target-speed) (sqrtf f0-11))) ) ) @@ -4099,10 +3972,9 @@ (set! (-> this next-poly) (-> s5-0 gap-poly)) ) ) - (let* ((f0-1 40.96) - (f0-3 (* f0-1 f0-1)) - (v1-9 (-> this travel)) - ) + (let ((f0-3 (square 40.96)) + (v1-9 (-> this travel)) + ) (when (< f0-3 (+ (* (-> v1-9 x) (-> v1-9 x)) (* (-> v1-9 z) (-> v1-9 z)))) (set! (-> this heading quad) (-> this travel quad)) (set! (-> this heading y) 0.0) diff --git a/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc b/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc index 84e33733f9..c92c13040f 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-enemy_REF.gc @@ -110,9 +110,7 @@ ) (else (if (or (not (cloest-point-on-mesh (-> s3-0 nav) s4-0 (-> gp-0 trans) (the-as nav-poly #f))) - (let ((f0-0 32768.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared s4-0 (-> gp-0 trans))) - ) + (< (square 32768.0) (vector-vector-xz-distance-squared s4-0 (-> gp-0 trans))) ) (return #t) ) @@ -982,10 +980,8 @@ (a0-2 (-> this fact)) ) (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) - (let* ((f30-0 (-> this enemy-info notice-nav-radius)) - (f0-1 f30-0) - ) - (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (let ((f30-0 (-> this enemy-info notice-nav-radius))) + (or (>= (square f30-0) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (is-in-mesh? (-> this nav) arg1 f30-0) ) ) @@ -1142,7 +1138,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy-behaviour-and-stats! ((this nav-enemy) (arg0 nav-enemy-info)) "Initializes a bunch of enemy fields related to how they should react, how many hitpoints they should have, etc" - (local-vars (sv-16 res-tag)) (when (coin-flip? this) (let ((a0-2 (-> this node-list data 2))) (set! (-> a0-2 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) @@ -1244,8 +1239,9 @@ ) (reset-to-collide-spec (-> this focus) (the-as collide-spec a1-9)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-82 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-82 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-82 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-82)) diff --git a/test/decompiler/reference/jak2/engine/nav/nav-mesh-h_REF.gc b/test/decompiler/reference/jak2/engine/nav/nav-mesh-h_REF.gc index a711a11215..c6127ad065 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-mesh-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-mesh-h_REF.gc @@ -649,24 +649,25 @@ and declared out of order (cannot use forward declared structures in inline arra ;; WARN: Return type mismatch vector vs none. (defmethod closest-point-on-boundary ((this nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector)) "Find the point on the polygon edge that is closest to the query point." - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (the-as float 10000000000000000000000000000000000000.0)) - (let* ((s3-0 (-> arg0 vertex-count)) - (v1-3 (the-as int (+ s3-0 -1))) - ) - (dotimes (s2-0 (the-as int s3-0)) - (let ((f0-1 (vector-segment-distance-point! arg2 (-> arg0 vertex v1-3) (-> arg0 vertex s2-0) sv-48))) - (when (< f0-1 sv-56) - (set! sv-56 f0-1) - (set! (-> sv-52 quad) (-> sv-48 quad)) - ) + (let ((sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + ) + (let* ((sv-56 (the-as float 10000000000000000000000000000000000000.0)) + (s3-0 (-> arg0 vertex-count)) + (v1-3 (the-as int (+ s3-0 -1))) + ) + (dotimes (s2-0 (the-as int s3-0)) + (let ((f0-1 (vector-segment-distance-point! arg2 (-> arg0 vertex v1-3) (-> arg0 vertex s2-0) sv-48))) + (when (< f0-1 sv-56) + (set! sv-56 f0-1) + (set! (-> sv-52 quad) (-> sv-48 quad)) + ) + ) + (set! v1-3 s2-0) ) - (set! v1-3 s2-0) ) + (set! (-> arg1 quad) (-> sv-52 quad)) ) - (set! (-> arg1 quad) (-> sv-52 quad)) (none) ) @@ -679,17 +680,17 @@ and declared out of order (cannot use forward declared structures in inline arra ;; WARN: Return type mismatch vector vs none. (defmethod project-point-into-poly-2d ((this nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector)) "Find the point in the polygon closest to the query point." - (local-vars (sv-48 vector) (sv-52 vector) (sv-56 float)) (cond ((point-in-poly? this arg0 arg2) (set! (-> arg1 quad) (-> arg2 quad)) ) (else - (let ((s5-1 arg1)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (set! sv-52 (new 'stack-no-clear 'vector)) - (set! sv-56 (the-as float 10000000000000000000000000000000000000.0)) - (let* ((s2-0 (-> arg0 vertex-count)) + (let ((s5-1 arg1) + (sv-48 (new 'stack-no-clear 'vector)) + (sv-52 (new 'stack-no-clear 'vector)) + ) + (let* ((sv-56 (the-as float 10000000000000000000000000000000000000.0)) + (s2-0 (-> arg0 vertex-count)) (v1-6 (the-as int (+ s2-0 -1))) ) (dotimes (s1-0 (the-as int s2-0)) @@ -761,81 +762,72 @@ and declared out of order (cannot use forward declared structures in inline arra ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod move-along-nav-ray! ((this nav-mesh) (ray nav-ray)) - (local-vars - (next-poly-idx int) - (work nav-mesh-work) - (current-poly nav-poly) - (current-poly-vtx-count uint) - (v0-table (pointer int8)) - (v1-table (pointer int8)) - (delta-x float) - (delta-z float) - (adj-vtx-0 vector) - (adj-vtx-1 vector) - (adj-edge-dz float) - (adj-edge-minus-dx float) - (sv-68 uint) - ) - (set! next-poly-idx -1) - (set! work (-> this work)) - (set! current-poly (-> ray current-poly)) - (set! current-poly-vtx-count (-> ray current-poly vertex-count)) - (set! v0-table (-> this work vert0-table)) - (set! v1-table (-> this work vert1-table)) - (set! delta-x (- (-> ray dest-pos x) (-> ray current-pos x))) - (set! delta-z (- (-> ray dest-pos z) (-> ray current-pos z))) - (dotimes (i (the-as int current-poly-vtx-count)) - (set! adj-vtx-0 (-> current-poly vertex (-> v0-table i))) - (set! adj-vtx-1 (-> current-poly vertex (-> v1-table i))) - (set! adj-edge-dz (- (-> adj-vtx-0 z) (-> adj-vtx-1 z))) - (set! adj-edge-minus-dx (- (-> adj-vtx-1 x) (-> adj-vtx-0 x))) - (let ((heading-dot (+ (* delta-x adj-edge-dz) (* delta-z adj-edge-minus-dx)))) - (when (< 0.0 heading-dot) - (let ((f1-10 (+ (* adj-edge-dz (- (-> adj-vtx-0 x) (-> ray current-pos x))) - (* adj-edge-minus-dx (- (-> adj-vtx-0 z) (-> ray current-pos z))) - ) - ) - ) - (when (< f1-10 heading-dot) - (set! next-poly-idx i) - (let ((f0-12 (fmax 0.0 (/ f1-10 heading-dot)))) - (set! delta-x (* delta-x f0-12)) - (set! delta-z (* delta-z f0-12)) + (let ((next-poly-idx -1)) + (let ((work (-> this work))) + ) + (let ((current-poly (-> ray current-poly)) + (current-poly-vtx-count (-> ray current-poly vertex-count)) + (v0-table (-> this work vert0-table)) + (v1-table (-> this work vert1-table)) + (delta-x (- (-> ray dest-pos x) (-> ray current-pos x))) + (delta-z (- (-> ray dest-pos z) (-> ray current-pos z))) + ) + (dotimes (i (the-as int current-poly-vtx-count)) + (let* ((adj-vtx-0 (-> current-poly vertex (-> v0-table i))) + (adj-vtx-1 (-> current-poly vertex (-> v1-table i))) + (adj-edge-dz (- (-> adj-vtx-0 z) (-> adj-vtx-1 z))) + (adj-edge-minus-dx (- (-> adj-vtx-1 x) (-> adj-vtx-0 x))) + (heading-dot (+ (* delta-x adj-edge-dz) (* delta-z adj-edge-minus-dx))) + ) + (when (< 0.0 heading-dot) + (let ((f1-10 (+ (* adj-edge-dz (- (-> adj-vtx-0 x) (-> ray current-pos x))) + (* adj-edge-minus-dx (- (-> adj-vtx-0 z) (-> ray current-pos z))) + ) + ) + ) + (when (< f1-10 heading-dot) + (set! next-poly-idx i) + (let ((f0-12 (fmax 0.0 (/ f1-10 heading-dot)))) + (set! delta-x (* delta-x f0-12)) + (set! delta-z (* delta-z f0-12)) + ) + ) ) ) ) ) - ) - ) - (let ((f0-16 (+ (* delta-x (-> ray dir x)) (* delta-z (-> ray dir z))))) - (+! (-> ray len) f0-16) - ) - 0 - (set! (-> ray next-poly) #f) - (cond - ((= next-poly-idx -1) - (set! (-> ray current-pos quad) (-> ray dest-pos quad)) - (set! (-> ray reached-dest) #t) - (set! (-> ray terminated) #t) - ) - (else - (+! (-> ray current-pos x) delta-x) - (+! (-> ray current-pos z) delta-z) - (set! sv-68 (-> current-poly adj-poly next-poly-idx)) - (if (!= sv-68 255) - (set! (-> ray next-poly) (-> this poly-array sv-68)) - ) + (let ((f0-16 (+ (* delta-x (-> ray dir x)) (* delta-z (-> ray dir z))))) + (+! (-> ray len) f0-16) + ) + 0 + (set! (-> ray next-poly) #f) (cond - ((and (-> ray next-poly) (not (logtest? (-> ray next-poly pat) (-> ray ignore)))) - (set! (-> ray current-poly) (-> ray next-poly)) + ((= next-poly-idx -1) + (set! (-> ray current-pos quad) (-> ray dest-pos quad)) + (set! (-> ray reached-dest) #t) + (set! (-> ray terminated) #t) ) (else - (set! (-> ray last-edge) next-poly-idx) - (if (-> ray next-poly) - (set! (-> ray hit-gap) #t) - (set! (-> ray hit-boundary) #t) + (+! (-> ray current-pos x) delta-x) + (+! (-> ray current-pos z) delta-z) + (let ((sv-68 (-> current-poly adj-poly next-poly-idx))) + (if (!= sv-68 255) + (set! (-> ray next-poly) (-> this poly-array sv-68)) + ) + ) + (cond + ((and (-> ray next-poly) (not (logtest? (-> ray next-poly pat) (-> ray ignore)))) + (set! (-> ray current-poly) (-> ray next-poly)) + ) + (else + (set! (-> ray last-edge) next-poly-idx) + (if (-> ray next-poly) + (set! (-> ray hit-gap) #t) + (set! (-> ray hit-boundary) #t) + ) + (set! (-> ray terminated) #t) ) - (set! (-> ray terminated) #t) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/nav/nav-mesh_REF.gc b/test/decompiler/reference/jak2/engine/nav/nav-mesh_REF.gc index 3fdd3951ed..506d2d4da5 100644 --- a/test/decompiler/reference/jak2/engine/nav/nav-mesh_REF.gc +++ b/test/decompiler/reference/jak2/engine/nav/nav-mesh_REF.gc @@ -505,12 +505,12 @@ ;; definition for method 32 of type entity-actor ;; INFO: Used lq/sq (defmethod project-point-to-nav-mesh ((this entity-actor) (arg0 vector) (arg1 vector) (arg2 nav-poly) (arg3 float)) - (local-vars (sv-16 vector)) (let ((gp-0 (nav-mesh-from-res-tag this 'nav-mesh-actor 0))) (cond (gp-0 - (set! sv-16 arg0) - (let ((s5-1 (new 'stack-no-clear 'nav-find-poly-parms))) + (let ((sv-16 arg0) + (s5-1 (new 'stack-no-clear 'nav-find-poly-parms)) + ) (set! (-> s5-1 poly) arg2) (vector-! (-> s5-1 point) arg1 (-> gp-0 bounds)) (when (or (not (-> s5-1 poly)) (not (point-in-poly? gp-0 (-> s5-1 poly) (-> s5-1 point)))) @@ -821,11 +821,11 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-from-entity ((this nav-mesh) (arg0 entity-nav-mesh)) "Initialize this mesh from an entity." - (local-vars (sv-16 res-tag)) (set! (-> this entity) arg0) (set! (-> this work) *nav-mesh-work*) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data arg0 'nav-mesh-sphere pointer :tag-ptr (& sv-16))) + ) (when v1-2 (set! (-> this static-sphere-count) (-> sv-16 elt-count)) (set! (-> this static-sphere) (the-as (inline-array sphere) v1-2)) @@ -1290,13 +1290,12 @@ ;; definition for method 19 of type nav-engine ;; WARN: Return type mismatch int vs none. (defmethod do-callbacks ((this nav-engine) (arg0 nav-engine-spr-buffer)) - (local-vars (sv-16 nav-callback-info)) (with-pp (dotimes (s4-0 (-> arg0 nav-count)) (let* ((a1-1 (-> arg0 spr-addr s4-0)) (a0-3 (-> a1-1 process)) + (sv-16 (-> a1-1 callback-info)) ) - (set! sv-16 (-> a1-1 callback-info)) (when a0-3 (set! (-> a1-1 state nav) a1-1) (when (and (logtest? (-> a1-1 flags) (nav-control-flag kernel-run)) sv-16) @@ -1332,28 +1331,15 @@ ;; definition for method 15 of type nav-engine ;; WARN: Return type mismatch int vs none. (defmethod update-nav-controls-pipelined-in-spr ((this nav-engine)) - (local-vars - (v1-33 int) - (v1-45 int) - (v1-66 int) - (a0-14 int) - (a0-19 int) - (a0-26 int) - (sv-16 symbol) - (sv-24 int) - (sv-32 int) - (sv-40 uint) - (sv-44 (inline-array nav-control)) - (sv-48 nav-engine-spr-buffer) - ) + (local-vars (v1-33 int) (v1-45 int) (v1-66 int) (a0-14 int) (a0-19 int) (a0-26 int)) (flush-cache 0) (set! (-> this max-pass-count) 3) - (set! sv-16 (the-as symbol #f)) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 (-> this nav-mesh-addr nav-control-count)) - (set! sv-44 (-> this nav-mesh-addr nav-control-array)) - (let ((s5-0 2) + (let ((sv-16 (the-as symbol #f)) + (sv-24 0) + (sv-32 0) + (sv-40 (-> this nav-mesh-addr nav-control-count)) + (sv-44 (-> this nav-mesh-addr nav-control-array)) + (s5-0 2) (s3-0 1) (s4-0 0) ) @@ -1373,10 +1359,10 @@ (upload-nav-to-spr this s2-0) (dma-sync (the-as pointer #x1000d400) 0 0) ) - (set! sv-32 (+ sv-32 (-> s2-0 nav-count))) + (+! sv-32 (-> s2-0 nav-count)) (when (>= sv-32 (the-as int sv-40)) (set! sv-32 0) - (set! sv-24 (+ sv-24 1)) + (+! sv-24 1) (if (= sv-24 (-> this max-pass-count)) (set! (-> s2-0 done) 1) ) @@ -1405,15 +1391,16 @@ (move-if-not-zero v1-45 0 a0-19 v1-44) ) (set! s4-0 v1-45) - (set! sv-48 (-> this work-buf-array s3-0)) - (when (> (-> sv-48 nav-count) 0) - (if (zero? (-> sv-48 i-pass)) - (reloc-ptrs-to-spad this sv-48) - ) - (do-callbacks this sv-48) - (if (= (-> sv-48 i-pass) (+ (-> this max-pass-count) -1)) - (reloc-ptrs-to-mem this sv-48) - ) + (let ((sv-48 (-> this work-buf-array s3-0))) + (when (> (-> sv-48 nav-count) 0) + (if (zero? (-> sv-48 i-pass)) + (reloc-ptrs-to-spad this sv-48) + ) + (do-callbacks this sv-48) + (if (= (-> sv-48 i-pass) (+ (-> this max-pass-count) -1)) + (reloc-ptrs-to-mem this sv-48) + ) + ) ) (let ((v1-65 (+ s3-0 1))) (let ((a0-25 2)) @@ -1523,75 +1510,76 @@ ;; definition for method 9 of type nav-mesh ;; WARN: Return type mismatch int vs none. (defmethod debug-draw ((this nav-mesh)) - (local-vars (sv-32 vector) (sv-36 int)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 16) - (add-debug-sphere - (logtest? sv-36 4) - (bucket-id debug2) - (-> this bounds) - (-> this bounds w) - (new 'static 'rgba :r #xff :g #xff :a #x20) - ) - (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this bounds) *x-vector* (meters 1) *color-red*) - (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this bounds) *z-vector* (meters 1) *color-blue*) - (when (logtest? sv-36 16) - (dotimes (s5-0 (the-as int (-> this static-sphere-count))) - (add-debug-sphere - #t - (bucket-id debug2) - (-> this static-sphere s5-0) - (-> this static-sphere s5-0 r) - *color-light-blue* + (let ((sv-32 (new 'stack-no-clear 'vector)) + (sv-36 16) ) - (let ((s4-0 add-debug-text-3d) - (s3-0 #t) - (s2-0 318) - ) - (format (clear *temp-string*) "~D" s5-0) - (s4-0 - s3-0 - (the-as bucket-id s2-0) - *temp-string* + (add-debug-sphere + (logtest? sv-36 4) + (bucket-id debug2) + (-> this bounds) + (-> this bounds w) + (new 'static 'rgba :r #xff :g #xff :a #x20) + ) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this bounds) *x-vector* (meters 1) *color-red*) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> this bounds) *z-vector* (meters 1) *color-blue*) + (when (logtest? sv-36 16) + (dotimes (s5-0 (the-as int (-> this static-sphere-count))) + (add-debug-sphere + #t + (bucket-id debug2) (-> this static-sphere s5-0) - (font-color cyan) - (the-as vector2h #f) + (-> this static-sphere s5-0 r) + *color-light-blue* + ) + (let ((s4-0 add-debug-text-3d) + (s3-0 #t) + (s2-0 318) + ) + (format (clear *temp-string*) "~D" s5-0) + (s4-0 + s3-0 + (the-as bucket-id s2-0) + *temp-string* + (-> this static-sphere s5-0) + (font-color cyan) + (the-as vector2h #f) + ) ) ) - ) - (dotimes (s5-1 (the-as int (-> this poly-count))) - (let ((s4-1 (-> this poly-array s5-1))) - (debug-draw-poly this s4-1 (cond - ((logtest? (-> s4-1 pat) 1) - *color-black* - ) - ((logtest? (-> s4-1 pat) 2) - *color-gray* - ) - ((logtest? (-> s4-1 pat) 4) - (if (-> this link-array (-> s4-1 link) dest-mesh) - *color-green* - *color-light-red* - ) - ) - (else - *color-cyan* + (dotimes (s5-1 (the-as int (-> this poly-count))) + (let ((s4-1 (-> this poly-array s5-1))) + (debug-draw-poly this s4-1 (cond + ((logtest? (-> s4-1 pat) 1) + *color-black* + ) + ((logtest? (-> s4-1 pat) 2) + *color-gray* + ) + ((logtest? (-> s4-1 pat) 4) + (if (-> this link-array (-> s4-1 link) dest-mesh) + *color-green* + *color-light-red* + ) + ) + (else + *color-cyan* + ) ) - ) - ) - (when (logtest? sv-36 32) - (let ((s3-1 add-debug-text-3d) - (s2-1 #t) - (s1-1 318) + ) + (when (logtest? sv-36 32) + (let ((s3-1 add-debug-text-3d) + (s2-1 #t) + (s1-1 318) + ) + (format (clear *temp-string*) "~D" (-> s4-1 id)) + (s3-1 + s2-1 + (the-as bucket-id s1-1) + *temp-string* + (poly-centroid this s4-1 sv-32) + (font-color cyan) + (the-as vector2h #f) ) - (format (clear *temp-string*) "~D" (-> s4-1 id)) - (s3-1 - s2-1 - (the-as bucket-id s1-1) - *temp-string* - (poly-centroid this s4-1 sv-32) - (font-color cyan) - (the-as vector2h #f) ) ) ) @@ -1682,7 +1670,7 @@ ;; definition for method 42 of type nav-mesh (defmethod find-poly-containing-point-local ((this nav-mesh) (arg0 nav-find-poly-parms)) - (local-vars (v1-6 symbol) (v1-15 int) (a0-3 symbol) (sv-16 nav-poly)) + (local-vars (v1-6 symbol) (v1-15 int) (a0-3 symbol)) (let ((s4-0 (search-for-point (-> this poly-hash) (-> arg0 point))) (s3-0 (-> this poly-hash bucket-size)) (s2-0 0) @@ -1696,21 +1684,22 @@ (nop!) (b! (zero? v1-2) cfg-16 :delay (nop!)) ) - (set! sv-16 (-> this poly-array s1-0)) - (let ((v1-5 sv-16) - (f0-0 (-> arg0 point y)) - (f1-0 (-> arg0 y-threshold)) - ) - (b! (>= (+ (-> v1-5 vertex3 w) f1-0) f0-0) cfg-5 :delay (set! a0-3 #t)) - (set! a0-3 #f) - (label cfg-5) - (set! v1-6 (and a0-3 (begin (b! (>= f0-0 (- (-> v1-5 vertex2 w) f1-0)) cfg-9 :delay (set! v1-6 #t)) #f))) - ) - (label cfg-9) - (when (and v1-6 (not (logtest? (-> sv-16 pat) (-> arg0 ignore)))) - (if (point-in-poly? this sv-16 (-> arg0 point)) - (return sv-16) - ) + (let ((sv-16 (-> this poly-array s1-0))) + (let ((v1-5 sv-16) + (f0-0 (-> arg0 point y)) + (f1-0 (-> arg0 y-threshold)) + ) + (b! (>= (+ (-> v1-5 vertex3 w) f1-0) f0-0) cfg-5 :delay (set! a0-3 #t)) + (set! a0-3 #f) + (label cfg-5) + (set! v1-6 (and a0-3 (begin (b! (>= f0-0 (- (-> v1-5 vertex2 w) f1-0)) cfg-9 :delay (set! v1-6 #t)) #f))) + ) + (label cfg-9) + (when (and v1-6 (not (logtest? (-> sv-16 pat) (-> arg0 ignore)))) + (if (point-in-poly? this sv-16 (-> arg0 point)) + (return sv-16) + ) + ) ) (label cfg-16) (set! s0-0 (/ (the-as int s0-0) 2)) @@ -1735,18 +1724,17 @@ ;; WARN: Stack slot offset 24 signed mismatch ;; WARN: Stack slot offset 16 signed mismatch (defmethod is-in-mesh-local? ((this nav-mesh) (arg0 vector) (arg1 float) (arg2 float)) - (local-vars (v1-3 float) (sv-16 float) (sv-20 vector) (sv-24 float)) + (local-vars (v1-3 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-16 arg2) - (set! sv-20 arg0) - (set! sv-24 arg1) - (let* ((f0-3 (+ sv-24 (-> this bounds w))) - (f0-5 (* f0-3 f0-3)) + (let* ((sv-16 arg2) + (sv-20 arg0) + (sv-24 arg1) + (f0-5 (square (+ sv-24 (-> this bounds w)))) ) (.lvf vf1 (&-> sv-20 quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -1768,11 +1756,7 @@ (else (let ((s4-0 (new 'stack-no-clear 'vector))) (project-point-into-poly-2d this (-> s5-0 poly) s4-0 sv-20) - (let ((f0-7 (vector-vector-xz-distance-squared s4-0 sv-20)) - (f1-2 sv-24) - ) - (< f0-7 (* f1-2 f1-2)) - ) + (< (vector-vector-xz-distance-squared s4-0 sv-20) (square sv-24)) ) ) ) @@ -1955,30 +1939,16 @@ ) (b! (>= 0.0 f7-1) cfg-9 :delay #f) (+! v1-0 1) - (let* ((f8-2 f5-0) - (f8-4 (* f8-2 f8-2)) - (f9-0 f6-0) - (f8-5 (+ f8-4 (* f9-0 f9-0))) - ) - (let* ((f9-3 arg2) - (f9-6 (* f8-5 (* f9-3 f9-3))) - (f10-0 f7-1) - ) - (b! (< f9-6 (* f10-0 f10-0)) cfg-13) - ) + (let ((f8-5 (+ (square f5-0) (square f6-0)))) + (b! (< (* f8-5 (square arg2)) (square f7-1)) cfg-13) (let ((f5-2 (+ (* f5-0 f4-2) (* f6-0 f3-4)))) arg2 (b! (>= f5-2 0.0) cfg-5) - (let ((f3-8 (sqrtf (+ (* f4-2 f4-2) (* f3-4 f3-4))))) + (let ((f3-8 (sqrtf (+ (square f4-2) (square f3-4))))) (b! #t cfg-8 :delay (nop!)) (label cfg-5) (b! (>= f8-5 f5-2) cfg-7) - (let* ((f3-10 (- f1-0 (-> t1-6 x))) - (f3-12 (* f3-10 f3-10)) - (f4-6 (- f2-0 (-> t1-6 z))) - ) - (set! f3-8 (sqrtf (+ f3-12 (* f4-6 f4-6)))) - ) + (set! f3-8 (sqrtf (+ (square (- f1-0 (-> t1-6 x))) (square (- f2-0 (-> t1-6 z)))))) (b! #t cfg-8 :delay (nop!)) (label cfg-7) (set! f0-0 (/ f7-1 (sqrtf f8-5))) @@ -2024,118 +1994,113 @@ ;; WARN: Stack slot offset 52 signed mismatch ;; WARN: Stack slot offset 28 signed mismatch (defmethod find-nearest-poly-to-point-local ((this nav-mesh) (arg0 nav-find-poly-parms)) - (local-vars - (v1-16 int) - (v1-34 int) - (sv-16 nav-poly) - (sv-20 (pointer uint8)) - (sv-24 nav-poly) - (sv-28 float) - (sv-32 int) - (sv-40 int) - (sv-48 nav-poly) - (sv-52 float) - ) - (set! sv-16 (the-as nav-poly #f)) - (set! sv-20 (search-for-sphere (-> this poly-hash) (-> arg0 point) 12288.0)) - (set! (-> arg0 point-inside?) #f) - (let ((s4-0 (-> this poly-hash bucket-size)) - (s3-0 sv-20) - (s2-0 0) - ) - (nop!) - (label cfg-1) - (let ((s1-0 (* s2-0 8)) - (s0-0 (-> s3-0 0)) - ) - (b! (zero? s0-0) cfg-17 :delay (nop!)) - (let ((v1-3 (logand s0-0 1))) + (local-vars (v1-16 int) (v1-34 int)) + (let ((sv-16 (the-as nav-poly #f))) + (let ((sv-20 (search-for-sphere (-> this poly-hash) (-> arg0 point) 12288.0))) + (set! (-> arg0 point-inside?) #f) + (let ((s4-0 (-> this poly-hash bucket-size)) + (s3-0 sv-20) + (s2-0 0) + ) (nop!) - (b! (zero? v1-3) cfg-16 :delay (nop!)) - ) - (set! sv-24 (-> this poly-array s1-0)) - (let ((v1-6 sv-24) - (f0-0 (-> arg0 point y)) - (f1-0 (-> arg0 y-threshold)) - ) - (b! - (not (and (and (>= (+ (-> v1-6 vertex3 w) f1-0) f0-0) (>= f0-0 (- (-> v1-6 vertex2 w) f1-0))) - (not (logtest? (-> sv-24 pat) (-> arg0 ignore))) - ) - ) - cfg-16 - :delay (empty-form) - ) - ) - (b! (not (point-in-poly? this sv-24 (-> arg0 point))) cfg-16 :delay (empty-form)) - (set! (-> arg0 point-inside?) #t) - (set! (-> arg0 dist) 0.0) - (set! sv-16 sv-24) - (b! #t cfg-38 :delay (nop!)) - (nop!) - (label cfg-16) - (set! s0-0 (/ (the-as int s0-0) 2)) - (nop!) - (b! (nonzero? s0-0) cfg-2 :delay (set! s1-0 (+ s1-0 1))) - ) - (label cfg-17) - (+! s2-0 1) - (set! s3-0 (&-> s3-0 1)) - (set-on-less-than v1-16 s2-0 s4-0) - ) - (nop!) - (b! (nonzero? v1-16) cfg-1 :delay (nop!)) - (set! sv-28 (the-as float 10000000000000000000000000000000000000.0)) - (set! sv-32 0) - (set! sv-40 0) - (let ((s4-1 (-> this poly-hash bucket-size)) - (s3-1 sv-20) - (s2-1 0) - ) - (until (zero? v1-34) - (let ((s1-1 (* s2-1 8)) - (s0-1 (-> s3-1 0)) - ) - (b! (zero? s0-1) cfg-34 :delay (nop!)) - (let ((v1-19 (logand s0-1 1))) - (nop!) - (b! (zero? v1-19) cfg-33 :delay (nop!)) - ) - (set! sv-48 (-> this poly-array s1-1)) - (let ((v1-22 sv-48) - (f0-3 (-> arg0 point y)) - (f1-2 (-> arg0 y-threshold)) + (label cfg-1) + (let ((s1-0 (* s2-0 8)) + (s0-0 (-> s3-0 0)) ) - (when (and (and (>= (+ (-> v1-22 vertex3 w) f1-2) f0-3) (>= f0-3 (- (-> v1-22 vertex2 w) f1-2))) - (not (logtest? (-> sv-48 pat) (-> arg0 ignore))) + (b! (zero? s0-0) cfg-17 :delay (nop!)) + (let ((v1-3 (logand s0-0 1))) + (nop!) + (b! (zero? v1-3) cfg-16 :delay (nop!)) + ) + (let ((sv-24 (-> this poly-array s1-0))) + (let ((v1-6 sv-24) + (f0-0 (-> arg0 point y)) + (f1-0 (-> arg0 y-threshold)) + ) + (b! + (not (and (and (>= (+ (-> v1-6 vertex3 w) f1-0) f0-0) (>= f0-0 (- (-> v1-6 vertex2 w) f1-0))) + (not (logtest? (-> sv-24 pat) (-> arg0 ignore))) + ) ) - (set! sv-40 (+ sv-40 1)) - (set! sv-52 (point-poly-distance-min (-> this work) (the-as nav-poly (-> arg0 point)) sv-28 sv-48)) - (when (< sv-52 sv-28) - (set! sv-28 sv-52) - (set! sv-16 sv-48) - (nop!) + cfg-16 + :delay (empty-form) + ) ) + (b! (not (point-in-poly? this sv-24 (-> arg0 point))) cfg-16 :delay (empty-form)) + (set! (-> arg0 point-inside?) #t) + (set! (-> arg0 dist) 0.0) + (set! sv-16 sv-24) + ) + (b! #t cfg-38 :delay (nop!)) + (nop!) + (label cfg-16) + (set! s0-0 (/ (the-as int s0-0) 2)) + (nop!) + (b! (nonzero? s0-0) cfg-2 :delay (set! s1-0 (+ s1-0 1))) + ) + (label cfg-17) + (+! s2-0 1) + (set! s3-0 (&-> s3-0 1)) + (set-on-less-than v1-16 s2-0 s4-0) + ) + (nop!) + (b! (nonzero? v1-16) cfg-1 :delay (nop!)) + (let ((sv-28 (the-as float 10000000000000000000000000000000000000.0))) + (let ((sv-32 0)) + ) + (let ((sv-40 0) + (s4-1 (-> this poly-hash bucket-size)) + (s3-1 sv-20) + (s2-1 0) + ) + (until (zero? v1-34) + (let ((s1-1 (* s2-1 8)) + (s0-1 (-> s3-1 0)) + ) + (b! (zero? s0-1) cfg-34 :delay (nop!)) + (let ((v1-19 (logand s0-1 1))) + (nop!) + (b! (zero? v1-19) cfg-33 :delay (nop!)) + ) + (let* ((sv-48 (-> this poly-array s1-1)) + (v1-22 sv-48) + (f0-3 (-> arg0 point y)) + (f1-2 (-> arg0 y-threshold)) + ) + (when (and (and (>= (+ (-> v1-22 vertex3 w) f1-2) f0-3) (>= f0-3 (- (-> v1-22 vertex2 w) f1-2))) + (not (logtest? (-> sv-48 pat) (-> arg0 ignore))) + ) + (+! sv-40 1) + (let ((sv-52 (point-poly-distance-min (-> this work) (the-as nav-poly (-> arg0 point)) sv-28 sv-48))) + (when (< sv-52 sv-28) + (set! sv-28 sv-52) + (set! sv-16 sv-48) + (nop!) + ) + ) + ) + ) + (label cfg-33) + (set! s0-1 (/ (the-as int s0-1) 2)) + (nop!) + (b! (nonzero? s0-1) cfg-20 :delay (set! s1-1 (+ s1-1 1))) + ) + (label cfg-34) + (+! s2-1 1) + (set! s3-1 (&-> s3-1 1)) + (set-on-less-than v1-34 s2-1 s4-1) + (nop!) ) ) - (label cfg-33) - (set! s0-1 (/ (the-as int s0-1) 2)) - (nop!) - (b! (nonzero? s0-1) cfg-20 :delay (set! s1-1 (+ s1-1 1))) + (if (not sv-16) + (set! sv-16 (-> this poly-array 0)) + ) + (set! (-> arg0 dist) sv-28) ) - (label cfg-34) - (+! s2-1 1) - (set! s3-1 (&-> s3-1 1)) - (set-on-less-than v1-34 s2-1 s4-1) - (nop!) ) + (label cfg-38) + (set! (-> arg0 poly) sv-16) ) - (if (not sv-16) - (set! sv-16 (-> this poly-array 0)) - ) - (set! (-> arg0 dist) sv-28) - (label cfg-38) - (set! (-> arg0 poly) sv-16) arg0 ) @@ -2257,17 +2222,6 @@ ;; definition for method 15 of type nav-mesh ;; WARN: Return type mismatch int vs none. (defmethod initialize-mesh! ((this nav-mesh)) - (local-vars - (sv-32 vector) - (sv-36 uint) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 symbol) - (sv-68 (inline-array vector)) - (sv-72 vector) - (sv-76 vector) - ) (with-pp (rlet ((acc :class vf) (Q :class vf) @@ -2277,77 +2231,81 @@ (vf3 :class vf) ) (init-vf0-vector) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 (-> this poly-count)) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 0) - (set! sv-64 (the-as symbol #f)) - (countdown (s5-0 sv-36) - (let ((v1-3 (-> this poly-array s5-0))) - (if (logtest? (-> v1-3 pat) 1) - (set! sv-56 (+ sv-56 1)) - ) - (set! sv-68 (-> v1-3 vertex)) - (set! sv-72 (-> v1-3 vertex1)) - (set! sv-76 (-> v1-3 vertex2)) - ) - (vector-3pt-cross! sv-32 (-> sv-68 0) sv-72 sv-76) - (cond - ((= (vector-length sv-32) 0.0) - (set! sv-40 (+ sv-40 1)) - ) - (else - (let ((v1-9 sv-32)) - (let ((f0-1 1.0)) - (.lvf vf1 (&-> v1-9 quad)) - (.mul.vf.xyz vf2 vf1 vf1) - (let ((a0-11 f0-1)) - (.mov vf3 a0-11) + (let ((sv-32 (new 'stack-no-clear 'vector)) + (sv-36 (-> this poly-count)) + (sv-40 0) + (sv-48 0) + (sv-56 0) + (sv-64 (the-as symbol #f)) + ) + (countdown (s5-0 sv-36) + (let ((v1-3 (-> this poly-array s5-0))) + (if (logtest? (-> v1-3 pat) 1) + (+! sv-56 1) + ) + (let ((sv-68 (-> v1-3 vertex)) + (sv-72 (-> v1-3 vertex1)) + (sv-76 (-> v1-3 vertex2)) ) - ) - (.mul.x.vf.w acc vf0 vf2) - (.add.mul.y.vf.w acc vf0 vf2 acc) - (.add.mul.z.vf.w vf2 vf0 vf2 acc) - (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) - (.wait.vf) - (.mul.vf.xyz vf1 vf1 Q) - (.nop.vf) - (.nop.vf) - (.nop.vf) - (.svf (&-> v1-9 quad) vf1) + (vector-3pt-cross! sv-32 (-> sv-68 0) sv-72 sv-76) ) - (if (>= 0.0 (-> sv-32 y)) - (set! sv-48 (+ sv-48 1)) + ) + (cond + ((= (vector-length sv-32) 0.0) + (+! sv-40 1) + ) + (else + (let ((v1-9 sv-32)) + (let ((f0-1 1.0)) + (.lvf vf1 (&-> v1-9 quad)) + (.mul.vf.xyz vf2 vf1 vf1) + (let ((a0-11 f0-1)) + (.mov vf3 a0-11) + ) + ) + (.mul.x.vf.w acc vf0 vf2) + (.add.mul.y.vf.w acc vf0 vf2 acc) + (.add.mul.z.vf.w vf2 vf0 vf2 acc) + (.isqrt.vf Q vf3 vf2 :fsf #b0 :ftf #b11) + (.wait.vf) + (.mul.vf.xyz vf1 vf1 Q) + (.nop.vf) + (.nop.vf) + (.nop.vf) + (.svf (&-> v1-9 quad) vf1) ) + (if (>= 0.0 (-> sv-32 y)) + (+! sv-48 1) + ) + ) ) ) - ) - (when (zero? sv-36) - (format #t "WARNING: nav-mesh has no triangles. ") - (set! sv-64 #t) - ) - (when (> sv-40 0) - (format #t "WARNING: nav-mesh has ~D triangles with zero area (out of ~D triangles). " sv-40 sv-36) - (set! sv-64 #t) - ) - (when (> sv-48 0) - (format #t "WARNING: nav-mesh has ~D triangles with inverted normals (out of ~D triangles). " sv-48 sv-36) - (set! sv-64 #t) - ) - (when (< (the-as uint 255) sv-36) - (format #t "WARNING: nav-mesh has ~D triangles (only up to ~D are allowed). " sv-36 255) - (set! sv-64 #t) - ) - (when (= sv-56 sv-36) - (format #t "WARNING: nav-mesh only contains gap triangles (~D triangles total). " sv-36) - (set! sv-64 #t) - ) - (when sv-64 - (if pp - (format #t "current process is ~A~%" (-> pp name)) - (format #t "(no current process).~%") - ) + (when (zero? sv-36) + (format #t "WARNING: nav-mesh has no triangles. ") + (set! sv-64 #t) + ) + (when (> sv-40 0) + (format #t "WARNING: nav-mesh has ~D triangles with zero area (out of ~D triangles). " sv-40 sv-36) + (set! sv-64 #t) + ) + (when (> sv-48 0) + (format #t "WARNING: nav-mesh has ~D triangles with inverted normals (out of ~D triangles). " sv-48 sv-36) + (set! sv-64 #t) + ) + (when (< (the-as uint 255) sv-36) + (format #t "WARNING: nav-mesh has ~D triangles (only up to ~D are allowed). " sv-36 255) + (set! sv-64 #t) + ) + (when (= sv-56 sv-36) + (format #t "WARNING: nav-mesh only contains gap triangles (~D triangles total). " sv-36) + (set! sv-64 #t) + ) + (when sv-64 + (if pp + (format #t "current process is ~A~%" (-> pp name)) + (format #t "(no current process).~%") + ) + ) ) 0 (none) @@ -2405,72 +2363,69 @@ ;; definition for method 38 of type nav-mesh ;; INFO: Used lq/sq (defmethod nav-mesh-method-38 ((this nav-mesh) (arg0 nav-poly) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 (pointer nav-poly))) - (local-vars - (s1-0 vector) - (sv-16 int) - (sv-24 nav-mesh-work) - (sv-28 uint) - (sv-32 (pointer int8)) - (sv-36 (pointer int8)) - (sv-40 vector) - (sv-44 vector) - ) - (set! sv-16 -1) - (set! sv-24 (-> this work)) - (set! sv-28 (-> arg0 vertex-count)) - (set! sv-32 (-> sv-24 vert0-table)) - (set! sv-36 (-> sv-24 vert1-table)) - (set! (-> arg2 quad) (-> arg3 quad)) - (dotimes (v1-8 (the-as int sv-28)) - (set! sv-40 (-> arg0 vertex (-> sv-32 v1-8))) - (set! sv-44 (-> arg0 vertex (-> sv-36 v1-8))) - (let* ((f0-1 (- (-> sv-40 z) (-> sv-44 z))) - (f1-2 (- (-> sv-44 x) (-> sv-40 x))) - (f2-4 (+ (* f0-1 (- (-> sv-40 x) (-> arg1 x))) (* f1-2 (- (-> sv-40 z) (-> arg1 z))))) - (f0-3 (+ (* (-> arg2 x) f0-1) (* (-> arg2 z) f1-2))) - ) - (when (< f2-4 f0-3) - (set! sv-16 v1-8) - (let ((f0-4 (/ f2-4 f0-3))) - (set! (-> arg2 x) (* (-> arg2 x) f0-4)) - (set! (-> arg2 z) (* (-> arg2 z) f0-4)) + (local-vars (s1-0 vector)) + (let* ((sv-16 -1) + (sv-24 (-> this work)) + (sv-28 (-> arg0 vertex-count)) + (sv-32 (-> sv-24 vert0-table)) + (sv-36 (-> sv-24 vert1-table)) + ) + (set! (-> arg2 quad) (-> arg3 quad)) + (dotimes (v1-8 (the-as int sv-28)) + (let* ((sv-40 (-> arg0 vertex (-> sv-32 v1-8))) + (sv-44 (-> arg0 vertex (-> sv-36 v1-8))) + (f0-1 (- (-> sv-40 z) (-> sv-44 z))) + (f1-2 (- (-> sv-44 x) (-> sv-40 x))) + (f2-4 (+ (* f0-1 (- (-> sv-40 x) (-> arg1 x))) (* f1-2 (- (-> sv-40 z) (-> arg1 z))))) + (f0-3 (+ (* (-> arg2 x) f0-1) (* (-> arg2 z) f1-2))) + ) + (when (< f2-4 f0-3) + (set! sv-16 v1-8) + (let ((f0-4 (/ f2-4 f0-3))) + (set! (-> arg2 x) (* (-> arg2 x) f0-4)) + (set! (-> arg2 z) (* (-> arg2 z) f0-4)) + ) ) ) ) - ) - (when arg4 - (cond - ((= sv-16 -1) - (set! (-> arg4 0) #f) - ) - (else - (while (!= sv-16 -1) - (let ((v1-16 (-> arg0 adj-poly sv-16))) - (cond - ((!= v1-16 255) - (set! (-> arg4 0) (-> this poly-array v1-16)) - (set! sv-16 -1) - ) - ((let ((a1-1 (-> arg0 vertex (-> sv-32 sv-16)))) - (set! s1-0 (-> arg0 vertex (-> sv-36 sv-16))) - (< (vector-vector-xz-distance arg1 a1-1) (-> this work nav-poly-min-dist)) - ) - (set! sv-16 (+ sv-16 -1)) - (if (< sv-16 0) - (set! sv-16 (the-as int (+ sv-28 -1))) - ) - ) - ((< (vector-vector-xz-distance arg1 s1-0) (-> this work nav-poly-min-dist)) - (set! sv-16 (+ sv-16 1)) - (when (>= sv-16 (the-as int sv-28)) - (set! sv-16 0) - 0 - ) - ) - (else - (set! (-> arg4 0) #f) - (set! sv-16 -1) - ) + (when arg4 + (cond + ((= sv-16 -1) + (set! (-> arg4 0) #f) + ) + (else + (while (!= sv-16 -1) + (let ((v1-16 (-> arg0 adj-poly sv-16))) + (set! sv-16 (cond + ((!= v1-16 255) + (set! (-> arg4 0) (-> this poly-array v1-16)) + (set! sv-16 -1) + sv-16 + ) + ((let ((a1-1 (-> arg0 vertex (-> sv-32 sv-16)))) + (set! s1-0 (-> arg0 vertex (-> sv-36 sv-16))) + (< (vector-vector-xz-distance arg1 a1-1) (-> this work nav-poly-min-dist)) + ) + (+! sv-16 -1) + (if (< sv-16 0) + (set! sv-16 (the-as int (+ sv-28 -1))) + ) + sv-16 + ) + ((< (vector-vector-xz-distance arg1 s1-0) (-> this work nav-poly-min-dist)) + (+! sv-16 1) + (when (>= sv-16 (the-as int sv-28)) + (set! sv-16 0) + 0 + ) + sv-16 + ) + (else + (set! (-> arg4 0) #f) + -1 + ) + ) + ) ) ) ) @@ -2610,43 +2565,43 @@ ;; WARN: Stack slot offset 72 signed mismatch ;; WARN: Stack slot offset 72 signed mismatch (defun find-nearest-nav-mesh ((arg0 vector) (arg1 float)) - (local-vars (v1-15 float) (sv-64 nav-find-poly-parms) (sv-68 nav-mesh) (sv-72 float) (sv-76 vector)) + (local-vars (v1-15 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-64 (new 'stack-no-clear 'nav-find-poly-parms)) - (set! sv-68 (the-as nav-mesh #f)) - (set! sv-72 arg1) - (set! sv-76 arg0) - (set! (-> sv-64 ignore) (the-as uint 7)) - (dotimes (gp-0 (-> *level* length)) - (let ((v1-5 (-> *level* level gp-0))) - (when (= (-> v1-5 status) 'active) - (let ((s5-0 (-> v1-5 bsp nav-meshes))) - (when (nonzero? s5-0) - (dotimes (s4-0 (-> s5-0 length)) - (let ((s3-0 (-> s5-0 s4-0 nav-mesh))) - (when s3-0 - (vector-! (-> sv-64 point) sv-76 (-> s3-0 bounds)) - (.lvf vf1 (&-> (-> sv-64 point) quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-15 vf1) - (let ((f0-1 v1-15) - (f1-0 (-> s3-0 bounds w)) - ) - (when (< f0-1 (* f1-0 f1-0)) - (set! (-> sv-64 y-threshold) (-> s3-0 nearest-y-threshold)) - (find-nearest-poly-to-point-local s3-0 sv-64) - (when (>= sv-72 (-> sv-64 dist)) - (set! sv-72 (-> sv-64 dist)) - (set! sv-68 s3-0) + (let ((sv-64 (new 'stack-no-clear 'nav-find-poly-parms)) + (sv-68 (the-as nav-mesh #f)) + ) + (let ((sv-72 arg1) + (sv-76 arg0) + ) + (set! (-> sv-64 ignore) (the-as uint 7)) + (dotimes (gp-0 (-> *level* length)) + (let ((v1-5 (-> *level* level gp-0))) + (when (= (-> v1-5 status) 'active) + (let ((s5-0 (-> v1-5 bsp nav-meshes))) + (when (nonzero? s5-0) + (dotimes (s4-0 (-> s5-0 length)) + (let ((s3-0 (-> s5-0 s4-0 nav-mesh))) + (when s3-0 + (vector-! (-> sv-64 point) sv-76 (-> s3-0 bounds)) + (.lvf vf1 (&-> (-> sv-64 point) quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-15 vf1) + (when (< v1-15 (square (-> s3-0 bounds w))) + (set! (-> sv-64 y-threshold) (-> s3-0 nearest-y-threshold)) + (find-nearest-poly-to-point-local s3-0 sv-64) + (when (>= sv-72 (-> sv-64 dist)) + (set! sv-72 (-> sv-64 dist)) + (set! sv-68 s3-0) + ) ) ) ) @@ -2657,16 +2612,16 @@ ) ) ) + sv-68 ) - sv-68 ) ) ;; definition for method 10 of type nav-mesh (defmethod nav-mesh-method-10 ((this nav-mesh) (arg0 vector) (arg1 vector) (arg2 nav-poly)) - (local-vars (sv-16 vector)) - (set! sv-16 arg0) - (let ((gp-0 (new 'stack-no-clear 'nav-find-poly-parms))) + (let ((sv-16 arg0) + (gp-0 (new 'stack-no-clear 'nav-find-poly-parms)) + ) (set! (-> gp-0 poly) arg2) (vector-! (-> gp-0 point) arg1 (-> this bounds)) (when (or (not (-> gp-0 poly)) (not (point-in-poly? this (-> gp-0 poly) (-> gp-0 point)))) @@ -2716,60 +2671,61 @@ ;; definition for method 34 of type nav-mesh ;; INFO: Used lq/sq (defmethod nav-mesh-method-34 ((this nav-mesh) (arg0 vector) (arg1 vector) (arg2 float)) - (local-vars (v1-8 symbol) (v1-13 int) (a1-2 symbol) (sv-80 vector) (sv-84 (pointer uint8))) + (local-vars (v1-8 symbol) (v1-13 int) (a1-2 symbol)) (let ((gp-0 (new 'stack-no-clear 'nav-poly))) - (set! sv-80 arg0) - (set! (-> gp-0 vertex3 y) (the-as float #x7f800000)) - (set! (-> gp-0 vertex3 x) arg2) - (set! (-> gp-0 vertex1 quad) (-> arg1 quad)) - (set! sv-84 (search-for-sphere (-> this poly-hash) (-> gp-0 vertex1) (-> gp-0 vertex3 x))) - (let ((s4-0 (-> this poly-hash bucket-size)) - (s3-0 sv-84) - (s2-0 0) - ) - (until (zero? v1-13) - (let ((s1-0 (* s2-0 8)) - (s0-0 (-> s3-0 0)) - ) - (b! (zero? s0-0) cfg-14 :delay (nop!)) - (let ((v1-5 (logand s0-0 1))) - (nop!) - (b! (zero? v1-5) cfg-13 :delay (nop!)) - ) - (let ((a0-5 (-> this poly-array s1-0))) - (let ((v1-7 a0-5) - (f0-3 (-> gp-0 vertex1 y)) - (f1-0 (-> this nearest-y-threshold)) - ) - (b! (>= (+ (-> v1-7 vertex3 w) f1-0) f0-3) cfg-5 :delay (set! a1-2 #t)) - (set! a1-2 #f) - (label cfg-5) - (set! v1-8 (and a1-2 (begin (b! (>= f0-3 (- (-> v1-7 vertex2 w) f1-0)) cfg-9 :delay (set! v1-8 #t)) #f))) - ) - (label cfg-9) - (if v1-8 - (set! (-> gp-0 vertex3 z) (point-to-poly-boundary a0-5 (-> gp-0 vertex2) (-> gp-0 vertex1))) + (let ((sv-80 arg0)) + (set! (-> gp-0 vertex3 y) (the-as float #x7f800000)) + (set! (-> gp-0 vertex3 x) arg2) + (set! (-> gp-0 vertex1 quad) (-> arg1 quad)) + (let* ((sv-84 (search-for-sphere (-> this poly-hash) (-> gp-0 vertex1) (-> gp-0 vertex3 x))) + (s4-0 (-> this poly-hash bucket-size)) + (s3-0 sv-84) + (s2-0 0) + ) + (until (zero? v1-13) + (let ((s1-0 (* s2-0 8)) + (s0-0 (-> s3-0 0)) ) - ) - (when (< (-> gp-0 vertex3 z) (-> gp-0 vertex3 y)) - (set! (-> gp-0 vertex3 y) (-> gp-0 vertex3 z)) - (set! (-> gp-0 vertex 0 quad) (-> gp-0 vertex2 quad)) + (b! (zero? s0-0) cfg-14 :delay (nop!)) + (let ((v1-5 (logand s0-0 1))) + (nop!) + (b! (zero? v1-5) cfg-13 :delay (nop!)) + ) + (let ((a0-5 (-> this poly-array s1-0))) + (let ((v1-7 a0-5) + (f0-3 (-> gp-0 vertex1 y)) + (f1-0 (-> this nearest-y-threshold)) + ) + (b! (>= (+ (-> v1-7 vertex3 w) f1-0) f0-3) cfg-5 :delay (set! a1-2 #t)) + (set! a1-2 #f) + (label cfg-5) + (set! v1-8 (and a1-2 (begin (b! (>= f0-3 (- (-> v1-7 vertex2 w) f1-0)) cfg-9 :delay (set! v1-8 #t)) #f))) + ) + (label cfg-9) + (if v1-8 + (set! (-> gp-0 vertex3 z) (point-to-poly-boundary a0-5 (-> gp-0 vertex2) (-> gp-0 vertex1))) + ) + ) + (when (< (-> gp-0 vertex3 z) (-> gp-0 vertex3 y)) + (set! (-> gp-0 vertex3 y) (-> gp-0 vertex3 z)) + (set! (-> gp-0 vertex 0 quad) (-> gp-0 vertex2 quad)) + (nop!) + ) + (label cfg-13) + (set! s0-0 (/ (the-as int s0-0) 2)) (nop!) + (b! (nonzero? s0-0) cfg-2 :delay (set! s1-0 (+ s1-0 1))) ) - (label cfg-13) - (set! s0-0 (/ (the-as int s0-0) 2)) + (label cfg-14) + (+! s2-0 1) + (set! s3-0 (&-> s3-0 1)) + (set-on-less-than v1-13 s2-0 s4-0) (nop!) - (b! (nonzero? s0-0) cfg-2 :delay (set! s1-0 (+ s1-0 1))) ) - (label cfg-14) - (+! s2-0 1) - (set! s3-0 (&-> s3-0 1)) - (set-on-less-than v1-13 s2-0 s4-0) - (nop!) ) + 0 + (set! (-> sv-80 quad) (-> gp-0 vertex 0 quad)) ) - 0 - (set! (-> sv-80 quad) (-> gp-0 vertex 0 quad)) (-> gp-0 vertex3 y) ) ) diff --git a/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc b/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc index f90fc24b30..d9acb7f13d 100644 --- a/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/chain-physics_REF.gc @@ -80,27 +80,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod update ((this chain-physics) (arg0 process-drawable)) - (local-vars - (v1-78 float) - (f0-11 float) - (sv-272 chain-physics-joint) - (sv-288 vector) - (sv-304 vector) - (sv-320 (function vector float vector)) - (sv-336 vector) - (sv-352 vector) - (sv-368 vector) - (sv-384 vector) - (sv-400 vector) - (sv-416 vector) - (sv-432 vector) - (sv-448 (inline-array vector)) - (sv-464 (inline-array vector)) - (sv-480 (inline-array vector)) - (sv-496 vector) - (sv-512 (inline-array vector)) - (sv-528 vector) - ) + (local-vars (v1-78 float) (f0-11 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -143,209 +123,214 @@ ) ) (dotimes (s0-0 (the-as int (-> this num-joints))) - (set! sv-272 (-> this chain-joints s0-0)) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-27 (-> sv-272 position quad))) - (set! (-> sv-528 quad) v1-27) - ) - (set! (-> sv-272 joint-mod flex-blend) f30-0) - (if (-> this negate-y) - (vector-negate! s1-0 s1-0) - ) - (set! sv-288 (new 'stack-no-clear 'vector)) - (apply-gravity this sv-288 s0-0 arg0) - (let ((v1-34 sv-528)) - (let ((a0-10 sv-528)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-10 quad)) - ) - (.lvf vf5 (&-> sv-288 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-34 quad) vf6) - ) - (when (< s0-0 (the-as int (+ (-> this root-joint-index) -1))) - (set! sv-304 (new 'stack-no-clear 'vector)) - (chain-physics-method-14 this sv-304 s0-0) - (let ((v1-40 sv-528)) - (let ((a0-13 sv-528)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-13 quad)) + (let ((sv-272 (-> this chain-joints s0-0)) + (sv-528 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> sv-304 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-40 quad) vf6) - ) - ) - (clamp-length this sv-528 s3-0 s0-0 arg0) - (set! sv-400 (new 'stack-no-clear 'vector)) - (let ((v1-43 sv-528) - (a0-16 s3-0) - ) - (.lvf vf4 (&-> v1-43 quad)) - (.lvf vf5 (&-> a0-16 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-400 quad) vf6) - (let ((f28-1 (vector-normalize-ret-len! sv-400 1.0)) - (f24-0 (vector-dot sv-400 s1-0)) - (f26-0 (chain-physics-method-16 this s0-0)) - ) - (when (< f24-0 (cos f26-0)) - (vector--float*! sv-400 sv-400 s1-0 f24-0) - (set! sv-320 vector-normalize!) - (set! sv-336 sv-400) - (let ((a1-17 (sin f26-0))) - (sv-320 sv-336 a1-17) - ) - (set! sv-384 sv-400) - (set! sv-352 sv-400) - (set! sv-368 s1-0) - (let ((f0-6 (cos f26-0))) - (.lvf vf2 (&-> sv-368 quad)) - (.lvf vf1 (&-> sv-352 quad)) - (let ((v1-55 f0-6)) - (.mov vf3 v1-55) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-384 quad) vf4) - (vector+float*! sv-528 s3-0 sv-400 f28-1) - ) - ) - (chain-physics-method-17 this sv-528 s0-0) - (set! sv-432 (new 'stack-no-clear 'vector)) - (let ((v1-61 s3-0) - (a0-27 sv-528) - ) - (.lvf vf4 (&-> v1-61 quad)) - (.lvf vf5 (&-> a0-27 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-432 quad) vf6) - (vector-normalize-ret-len! sv-432 1.0) - (set! sv-416 (new 'stack-no-clear 'vector)) - (let ((v1-64 sv-528) - (a0-30 (-> sv-272 position)) - ) - (.lvf vf4 (&-> v1-64 quad)) - (.lvf vf5 (&-> a0-30 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-416 quad) vf6) - (let ((f28-2 (vector-dot sv-432 sv-416))) - (vector--float*! sv-416 sv-416 sv-432 f28-2) - (cond - ((< f28-2 0.0) - (set! f0-11 (* f28-2 (-> this compress-vel-parallel))) - (vector-float*! sv-416 sv-416 (-> this compress-vel)) - ) - (else - (set! f0-11 (* f28-2 (-> this stretch-vel-parallel))) - (vector-float*! sv-416 sv-416 (-> this stretch-vel)) - ) - ) - ) - (let ((v1-73 (-> sv-272 velocity))) - (.lvf vf2 (&-> sv-432 quad)) - (.lvf vf1 (&-> sv-416 quad)) - (let ((a0-37 f0-11)) - (.mov vf3 a0-37) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> v1-73 quad) vf4) - ) - (vector+! sv-528 (-> sv-272 position) (-> sv-272 velocity)) - (let ((a2-9 (vector-! (new 'stack-no-clear 'vector) s3-0 sv-528))) - (.lvf vf1 (&-> a2-9 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-78 vf1) - (let* ((f0-13 v1-78) - (f1-6 (* (-> this maximum-stretch) (-> this joint-length))) - (f2-3 f1-6) - ) - (if (< (* f2-3 f2-3) f0-13) - (vector--float*! sv-528 s3-0 a2-9 (/ f1-6 (sqrtf f0-13))) - ) - ) - ) - (set! (-> sv-272 position quad) (-> sv-528 quad)) - (if (-> sv-272 joint-mod) - (set! (-> sv-272 joint-mod trans quad) (-> sv-528 quad)) - ) - (when (< s0-0 (the-as int (-> this num-joints))) - (vector-! (-> s4-0 vector 1) sv-528 s3-0) - (vector-normalize! (-> s4-0 vector 1) 1.0) + (set! (-> sv-528 quad) (-> sv-272 position quad)) + (set! (-> sv-272 joint-mod flex-blend) f30-0) (if (-> this negate-y) - (vector-negate! (-> s4-0 vector 1) (-> s4-0 vector 1)) + (vector-negate! s1-0 s1-0) ) - (vector-cross! (-> s4-0 vector 0) (-> s4-0 vector 1) s2-0) - (vector-normalize! (-> s4-0 vector 0) 1.0) - (set! sv-496 (new 'stack-no-clear 'vector)) - (let ((v1-97 (-> sv-272 old-x)) - (a0-51 (-> s4-0 vector)) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (apply-gravity this sv-288 s0-0 arg0) + (let ((v1-34 sv-528)) + (let ((a0-10 sv-528)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-10 quad)) ) - (.lvf vf1 (&-> v1-97 quad)) - (.lvf vf2 (&-> a0-51 0 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-496 quad) vf3) - (vector-flatten! sv-496 (-> sv-272 old-x) (-> s4-0 vector 1)) - (vector-normalize! sv-496 1.0) - (cond - ((< (vector-dot (-> s4-0 vector 0) sv-496) (cos (-> this axial-slop))) - (vector-cross! sv-496 sv-496 (-> s4-0 vector 0)) - (vector-cross! sv-496 (-> s4-0 vector 0) sv-496) - (vector-normalize! sv-496 1.0) - (set! sv-464 (-> s4-0 vector)) - (set! sv-448 (-> s4-0 vector)) - (let ((f0-20 (cos (-> this axial-slop)))) - (.lvf vf1 (&-> sv-448 0 quad)) - (let ((v1-107 f0-20)) - (.mov vf2 v1-107) - ) - ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-464 0 quad) vf1) - (set! sv-512 (-> s4-0 vector)) - (set! sv-480 (-> s4-0 vector)) - (let ((f0-22 (sin (-> this axial-slop)))) - (.lvf vf2 (&-> sv-496 quad)) - (.lvf vf1 (&-> sv-480 0 quad)) - (let ((v1-113 f0-22)) - (.mov vf3 v1-113) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-512 0 quad) vf4) - (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) - ) - (else - (set! (-> s4-0 vector 0 quad) (-> sv-496 quad)) - (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) + (.lvf vf5 (&-> sv-288 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-34 quad) vf6) ) ) - (vector-cross! (-> s4-0 vector 2) (-> s4-0 vector 0) (-> s4-0 vector 1)) - (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) - (set! (-> s1-0 quad) (-> s4-0 vector 1 quad)) - (set! (-> s2-0 quad) (-> s4-0 vector 2 quad)) - 0 + (when (< s0-0 (the-as int (+ (-> this root-joint-index) -1))) + (let ((sv-304 (new 'stack-no-clear 'vector))) + (chain-physics-method-14 this sv-304 s0-0) + (let ((v1-40 sv-528)) + (let ((a0-13 sv-528)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-13 quad)) + ) + (.lvf vf5 (&-> sv-304 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-40 quad) vf6) + ) + ) + ) + (clamp-length this sv-528 s3-0 s0-0 arg0) + (let ((sv-400 (new 'stack-no-clear 'vector))) + (let ((v1-43 sv-528) + (a0-16 s3-0) + ) + (.lvf vf4 (&-> v1-43 quad)) + (.lvf vf5 (&-> a0-16 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-400 quad) vf6) + (let ((f28-1 (vector-normalize-ret-len! sv-400 1.0)) + (f24-0 (vector-dot sv-400 s1-0)) + (f26-0 (chain-physics-method-16 this s0-0)) + ) + (when (< f24-0 (cos f26-0)) + (vector--float*! sv-400 sv-400 s1-0 f24-0) + (vector-normalize! sv-400 (sin f26-0)) + (let ((sv-384 sv-400)) + (let ((sv-352 sv-400) + (sv-368 s1-0) + (f0-6 (cos f26-0)) + ) + (.lvf vf2 (&-> sv-368 quad)) + (.lvf vf1 (&-> sv-352 quad)) + (let ((v1-55 f0-6)) + (.mov vf3 v1-55) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-384 quad) vf4) + ) + (vector+float*! sv-528 s3-0 sv-400 f28-1) + ) + ) + ) + (chain-physics-method-17 this sv-528 s0-0) + (let ((sv-432 (new 'stack-no-clear 'vector))) + (let ((a0-27 sv-528)) + (.lvf vf4 (&-> s3-0 quad)) + (.lvf vf5 (&-> a0-27 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-432 quad) vf6) + (vector-normalize-ret-len! sv-432 1.0) + (let ((sv-416 (new 'stack-no-clear 'vector))) + (let ((v1-64 sv-528) + (a0-30 (-> sv-272 position)) + ) + (.lvf vf4 (&-> v1-64 quad)) + (.lvf vf5 (&-> a0-30 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-416 quad) vf6) + (let ((f28-2 (vector-dot sv-432 sv-416))) + (vector--float*! sv-416 sv-416 sv-432 f28-2) + (cond + ((< f28-2 0.0) + (set! f0-11 (* f28-2 (-> this compress-vel-parallel))) + (vector-float*! sv-416 sv-416 (-> this compress-vel)) + ) + (else + (set! f0-11 (* f28-2 (-> this stretch-vel-parallel))) + (vector-float*! sv-416 sv-416 (-> this stretch-vel)) + ) + ) + ) + (let ((v1-73 (-> sv-272 velocity))) + (.lvf vf2 (&-> sv-432 quad)) + (.lvf vf1 (&-> sv-416 quad)) + (let ((a0-37 f0-11)) + (.mov vf3 a0-37) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> v1-73 quad) vf4) + ) + ) + ) + (vector+! sv-528 (-> sv-272 position) (-> sv-272 velocity)) + (let ((a2-9 (vector-! (new 'stack-no-clear 'vector) s3-0 sv-528))) + (.lvf vf1 (&-> a2-9 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-78 vf1) + (let ((f0-13 v1-78) + (f1-6 (* (-> this maximum-stretch) (-> this joint-length))) + ) + (if (< (square f1-6) f0-13) + (vector--float*! sv-528 s3-0 a2-9 (/ f1-6 (sqrtf f0-13))) + ) + ) + ) + (set! (-> sv-272 position quad) (-> sv-528 quad)) + (if (-> sv-272 joint-mod) + (set! (-> sv-272 joint-mod trans quad) (-> sv-528 quad)) + ) + (when (< s0-0 (the-as int (-> this num-joints))) + (vector-! (-> s4-0 vector 1) sv-528 s3-0) + (vector-normalize! (-> s4-0 vector 1) 1.0) + (if (-> this negate-y) + (vector-negate! (-> s4-0 vector 1) (-> s4-0 vector 1)) + ) + (vector-cross! (-> s4-0 vector 0) (-> s4-0 vector 1) s2-0) + (vector-normalize! (-> s4-0 vector 0) 1.0) + (let ((sv-496 (new 'stack-no-clear 'vector))) + (let ((v1-97 (-> sv-272 old-x)) + (a0-51 (-> s4-0 vector)) + ) + (.lvf vf1 (&-> v1-97 quad)) + (.lvf vf2 (&-> a0-51 0 quad)) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-496 quad) vf3) + (vector-flatten! sv-496 (-> sv-272 old-x) (-> s4-0 vector 1)) + (vector-normalize! sv-496 1.0) + (cond + ((< (vector-dot (-> s4-0 vector 0) sv-496) (cos (-> this axial-slop))) + (vector-cross! sv-496 sv-496 (-> s4-0 vector 0)) + (vector-cross! sv-496 (-> s4-0 vector 0) sv-496) + (vector-normalize! sv-496 1.0) + (let ((sv-464 (-> s4-0 vector))) + (let ((sv-448 (-> s4-0 vector)) + (f0-20 (cos (-> this axial-slop))) + ) + (.lvf vf1 (&-> sv-448 0 quad)) + (let ((v1-107 f0-20)) + (.mov vf2 v1-107) + ) + ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-464 0 quad) vf1) + ) + (let ((sv-512 (-> s4-0 vector))) + (let ((sv-480 (-> s4-0 vector)) + (f0-22 (sin (-> this axial-slop))) + ) + (.lvf vf2 (&-> sv-496 quad)) + (.lvf vf1 (&-> sv-480 0 quad)) + (let ((v1-113 f0-22)) + (.mov vf3 v1-113) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-512 0 quad) vf4) + ) + (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) + ) + (else + (set! (-> s4-0 vector 0 quad) (-> sv-496 quad)) + (set! (-> sv-272 old-x quad) (-> s4-0 vector 0 quad)) + ) + ) + ) + (vector-cross! (-> s4-0 vector 2) (-> s4-0 vector 0) (-> s4-0 vector 1)) + (matrix->quaternion (-> sv-272 joint-mod quat) s4-0) + (set! (-> s1-0 quad) (-> s4-0 vector 1 quad)) + (set! (-> s2-0 quad) (-> s4-0 vector 2 quad)) + 0 + ) + (set! (-> s3-0 quad) (-> sv-528 quad)) ) - (set! (-> s3-0 quad) (-> sv-528 quad)) 0 ) ) diff --git a/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc b/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc index f884333dd2..7dcb7e713f 100644 --- a/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/rigid-body_REF.gc @@ -52,16 +52,9 @@ (matrix-identity! (-> this inertial-tensor)) (matrix-identity! (-> this inv-inertial-tensor)) (let ((f0-4 (/ f24-0 12))) - (let* ((f1-1 f30-0) - (f1-3 (* f1-1 f1-1)) - (f2-0 f26-0) - ) - (set! (-> this inertial-tensor vector 0 x) (* f0-4 (+ f1-3 (* f2-0 f2-0)))) - ) - (let ((f1-6 f28-0)) - (set! (-> this inertial-tensor vector 1 y) (* f0-4 (+ (* f1-6 f1-6) (* f26-0 f26-0)))) - ) - (set! (-> this inertial-tensor vector 2 z) (* f0-4 (+ (* f28-0 f28-0) (* f30-0 f30-0)))) + (set! (-> this inertial-tensor vector 0 x) (* f0-4 (+ (square f30-0) (square f26-0)))) + (set! (-> this inertial-tensor vector 1 y) (* f0-4 (+ (square f28-0) (square f26-0)))) + (set! (-> this inertial-tensor vector 2 z) (* f0-4 (+ (square f28-0) (square f30-0)))) ) ) (let ((f0-6 (-> this inertial-tensor vector 0 x))) @@ -225,8 +218,7 @@ (.svf (&-> a2-1 quad) vf6) ) (let* ((f0-3 (* 500000000.0 (-> this info mass))) - (f1-1 f0-3) - (f1-3 (* f1-1 f1-1)) + (f1-3 (square f0-3)) ) (.lvf vf1 (&-> (-> this ang-momentum) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -663,16 +655,6 @@ ;; WARN: Stack slot offset 632 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-method-15 ((this rigid-body) (arg0 collide-shape-moving) (arg1 float)) - (local-vars - (sv-576 vector) - (sv-624 vector) - (sv-628 vector) - (sv-632 float) - (sv-704 vector) - (sv-708 vector) - (sv-712 vector) - (sv-716 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -704,46 +686,52 @@ (b! #t cfg-9 :delay (nop!)) (label cfg-3) (rigid-body-method-14 this (* f30-0 arg1 f28-0)) - (set! sv-576 (new 'stack-no-clear 'vector)) - (set! sv-624 (new 'stack-no-clear 'vector)) - (set! sv-628 (new 'stack-no-clear 'vector)) - (vector-! sv-576 (-> this position) (-> s3-0 best-other-tri intersect)) - (vector-normalize! sv-576 1.0) - (set! sv-632 (vector-dot sv-576 (-> this lin-momentum))) - (when (< sv-632 0.0) - (vector-float*! sv-624 sv-576 sv-632) - (vector-! sv-628 (-> this lin-momentum) sv-624) - (vector-float*! sv-628 sv-628 (- 1.0 (-> s4-0 friction-factor))) - (vector-float*! sv-624 sv-624 (- (-> s4-0 bounce-factor))) - (vector+! (-> this lin-momentum) sv-628 sv-624) - (vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> s4-0 inv-mass)) - ) - (b! (>= f28-0 0.0001) cfg-7 :delay #f) - (vector+float*! (-> this position) (-> this position) sv-576 409.6) - (label cfg-7) - (set! sv-704 (new 'stack-no-clear 'vector)) - (set! sv-708 (new 'stack-no-clear 'vector)) - (set! sv-712 (new 'stack-no-clear 'vector)) - (set! sv-716 (new 'stack-no-clear 'vector)) - (vector-! sv-704 (-> s3-0 best-other-tri intersect) (-> this position)) - (rigid-body-method-22 this (-> s3-0 best-other-tri intersect) sv-708) - (vector+float*! sv-708 sv-708 sv-576 (- (vector-dot sv-708 sv-576))) - (vector-float*! sv-712 sv-708 (* -1.0 (-> s4-0 mass) (-> s4-0 friction-factor))) - (vector-cross! sv-716 sv-704 sv-712) - (let ((a1-20 (-> this ang-momentum))) - (let ((v1-46 (-> this ang-momentum))) - (let ((a0-27 sv-716)) - (let ((a2-6 1.0)) - (.mov vf7 a2-6) + (let ((sv-576 (new 'stack-no-clear 'vector))) + (let ((sv-624 (new 'stack-no-clear 'vector)) + (sv-628 (new 'stack-no-clear 'vector)) + ) + (vector-! sv-576 (-> this position) (-> s3-0 best-other-tri intersect)) + (vector-normalize! sv-576 1.0) + (let ((sv-632 (vector-dot sv-576 (-> this lin-momentum)))) + (when (< sv-632 0.0) + (vector-float*! sv-624 sv-576 sv-632) + (vector-! sv-628 (-> this lin-momentum) sv-624) + (vector-float*! sv-628 sv-628 (- 1.0 (-> s4-0 friction-factor))) + (vector-float*! sv-624 sv-624 (- (-> s4-0 bounce-factor))) + (vector+! (-> this lin-momentum) sv-628 sv-624) + (vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> s4-0 inv-mass)) ) - (.lvf vf5 (&-> a0-27 quad)) ) - (.lvf vf4 (&-> v1-46 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-20 quad) vf6) + (b! (>= f28-0 0.0001) cfg-7 :delay #f) + (vector+float*! (-> this position) (-> this position) sv-576 409.6) + (label cfg-7) + (let ((sv-704 (new 'stack-no-clear 'vector)) + (sv-708 (new 'stack-no-clear 'vector)) + (sv-712 (new 'stack-no-clear 'vector)) + (sv-716 (new 'stack-no-clear 'vector)) + ) + (vector-! sv-704 (-> s3-0 best-other-tri intersect) (-> this position)) + (rigid-body-method-22 this (-> s3-0 best-other-tri intersect) sv-708) + (vector+float*! sv-708 sv-708 sv-576 (- (vector-dot sv-708 sv-576))) + (vector-float*! sv-712 sv-708 (* -1.0 (-> s4-0 mass) (-> s4-0 friction-factor))) + (vector-cross! sv-716 sv-704 sv-712) + (let ((a1-20 (-> this ang-momentum))) + (let ((v1-46 (-> this ang-momentum))) + (let ((a0-27 sv-716)) + (let ((a2-6 1.0)) + (.mov vf7 a2-6) + ) + (.lvf vf5 (&-> a0-27 quad)) + ) + (.lvf vf4 (&-> v1-46 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-20 quad) vf6) + ) + ) ) (vector-rotate*! (-> this ang-velocity) (-> this ang-momentum) (-> this inv-i-world)) (set! f30-0 (* f30-0 (- 1.0 f28-0))) diff --git a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc index 8903e7b828..9bfce98901 100644 --- a/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc +++ b/test/decompiler/reference/jak2/engine/physics/trajectory_REF.gc @@ -50,10 +50,9 @@ ;; definition for method 14 of type trajectory ;; WARN: Return type mismatch int vs none. (defmethod setup-from-to-y-vel! ((this trajectory) (arg0 vector) (arg1 vector) (arg2 float) (arg3 float)) - (let* ((f0-0 arg2) - (f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3))) - (f0-3 900.0) - ) + (let ((f1-3 (- (square arg2) (* 2.0 (- (-> arg0 y) (-> arg1 y)) arg3))) + (f0-3 900.0) + ) (when (>= f1-3 0.0) (let ((f0-4 (sqrtf f1-3))) (set! f0-3 (fmax (/ (- (- arg2) f0-4) arg3) (/ (+ (- arg2) f0-4) arg3))) @@ -88,13 +87,7 @@ (let ((f0-1 (- (-> arg1 y) (-> arg0 y)))) (cond ((= f0-1 0.0) - (let ((t9-0 (method-of-type trajectory setup-from-to-duration!)) - (v1-2 arg2) - (f0-3 (* -8.0 arg3)) - (f1-3 arg2) - ) - (t9-0 this arg0 arg1 v1-2 (/ f0-3 (* f1-3 f1-3))) - ) + (setup-from-to-duration! this arg0 arg1 arg2 (/ (* -8.0 arg3) (square arg2))) (return 0) ) ((and (< 0.0 f0-1) (< 0.0 arg3) (< arg3 f0-1)) @@ -105,9 +98,7 @@ ) ) (let* ((f1-14 (/ (- arg3 f0-1) arg3)) - (f0-6 -2.0) - (f1-18 (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14))))) - (f0-8 (* f0-6 (* f1-18 f1-18) arg3)) + (f0-8 (* -2.0 (square (/ (- 1.0 f1-14) (- arg2 (* arg2 (sqrtf f1-14))))) arg3)) ) (setup-from-to-duration! this arg0 arg1 arg2 f0-8) ) 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 a3a3204e1a..e9b1e48d3a 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 @@ -106,7 +106,6 @@ ;; INFO: Used lq/sq ;; WARN: Using new Jak 2 rtype-of (defun-debug cspace-inspect-tree ((arg0 process-drawable) (arg1 cspace) (arg2 int) (arg3 int) (arg4 object)) - (local-vars (sv-16 string) (sv-32 int) (sv-48 int)) (if (and (= arg4 'mesh) (zero? *debug-vertex-stats*)) (set! *debug-vertex-stats* (new 'debug 'debug-vertex-stats)) ) @@ -132,15 +131,12 @@ #f ) ((= v1-11 'mesh) - (let ((s1-0 format) - (s0-0 #t) - ) - (set! sv-16 " ~D/~D/~F") - (set! sv-32 (drawable-frag-count (-> arg1 geo))) - (set! sv-48 (drawable-tri-count (-> arg1 geo))) - (let ((t0-2 (drawable-vertex-ratio (-> arg1 geo) *debug-vertex-stats*))) - (s1-0 s0-0 sv-16 sv-32 sv-48 t0-2) - ) + (format + #t + " ~D/~D/~F" + (drawable-frag-count (-> arg1 geo)) + (drawable-tri-count (-> arg1 geo)) + (drawable-vertex-ratio (-> arg1 geo) *debug-vertex-stats*) ) ) ) @@ -255,7 +251,6 @@ ;; definition for method 9 of type lod-set ;; INFO: Used lq/sq (defmethod setup-lods! ((this lod-set) (arg0 skeleton-group) (arg1 art-group) (arg2 entity)) - (local-vars (sv-16 res-tag)) (let ((v1-0 (-> arg1 length)) (s3-0 (-> arg0 max-lod)) ) @@ -278,13 +273,13 @@ (set! (-> this lod s3-0 dist) (res-lump-float arg2 'vis-dist :default 4095996000.0)) ) ) - (let ((v1-14 (-> arg1 data (-> arg0 jgeo)))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data (-> v1-14 extra) 'lod-dist pointer :tag-ptr (& sv-16)))) - (when v1-15 - (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) - (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-15 (* a0-6 4))))) - ) + (let* ((v1-14 (-> arg1 data (-> arg0 jgeo))) + (sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data (-> v1-14 extra) 'lod-dist pointer :tag-ptr (& sv-16))) + ) + (when v1-15 + (dotimes (a0-6 (the-as int (-> sv-16 elt-count))) + (set! (-> this lod a0-6 dist) (-> (the-as (pointer float) (&+ v1-15 (* a0-6 4))))) ) ) ) @@ -476,12 +471,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun draw-joint-axes ((arg0 process-drawable)) - (local-vars - (sv-64 (function symbol bucket-id vector vector meters rgba symbol)) - (sv-80 symbol) - (sv-96 int) - (sv-112 vector) - ) (let ((s5-0 (new 'stack-no-clear 'vector2h)) (s4-0 (shl #x8000 16)) (s3-0 (new 'stack-no-clear 'vector)) @@ -494,17 +483,19 @@ (let ((s1-0 (-> arg0 node-list data s2-0 bone transform))) (vector<-cspace! s3-0 (-> arg0 node-list data s2-0)) (dotimes (s0-0 3) - (set! sv-64 add-debug-vector) - (set! sv-80 #t) - (set! sv-96 318) - (set! sv-112 s3-0) - (let ((a3-0 - (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (+ (the-as uint s1-0) (* s0-0 16))) 1.0) - ) - (t0-0 #x444ccccd) - (t1-0 (logior (ash 255 (* s0-0 8)) s4-0)) + (let ((sv-64 add-debug-vector) + (sv-80 #t) + (sv-96 318) + (sv-112 s3-0) ) - (sv-64 sv-80 (the-as bucket-id sv-96) sv-112 a3-0 (the-as meters t0-0) (the-as rgba t1-0)) + (sv-64 + sv-80 + (the-as bucket-id sv-96) + sv-112 + (vector-normalize-copy! (new 'stack-no-clear 'vector) (the-as vector (+ (the-as uint s1-0) (* s0-0 16))) 1.0) + (meters 0.2) + (the-as rgba (logior (ash 255 (* s0-0 8)) s4-0)) + ) ) ) ) @@ -629,7 +620,7 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; WARN: Stack slot offset 20 signed mismatch (defun skeleton-group->draw-control ((arg0 process-drawable) (arg1 skeleton-group) (arg2 (pointer cspace-array))) - (local-vars (s2-0 draw-control) (sv-16 art-element) (sv-20 int)) + (local-vars (s2-0 draw-control)) (let ((s3-0 (if (= (-> arg1 texture-level) 6) (-> *level* default-level) (-> arg0 level) @@ -642,61 +633,63 @@ (set! s2-0 (the-as draw-control #f)) (goto cfg-50) ) - (set! sv-16 (-> s1-0 data (-> arg1 jgeo))) - (set! sv-20 (-> s1-0 length)) - (when (or (< (-> arg1 jgeo) 0) (>= (-> arg1 jgeo) sv-20) (not sv-16) (!= (-> sv-16 type) art-joint-geo)) - (go process-drawable-art-error "joint-geo") - (set! s2-0 (the-as draw-control #f)) - (goto cfg-50) - ) - (set! s2-0 (new 'process 'draw-control arg0 (the-as symbol sv-16))) - (let ((v1-24 s2-0)) - (set! (-> v1-24 status) (draw-control-status uninited)) - (set! (-> v1-24 art-group) s1-0) - (set! (-> v1-24 jgeo) (the-as art-joint-geo sv-16)) - (set! (-> v1-24 force-lod) -1) - (set! (-> v1-24 cur-lod) -1) - (set! (-> v1-24 shadow) #f) - (set! (-> v1-24 shadow-ctrl) #f) - (set! (-> v1-24 data-format) (draw-control-data-format merc)) - (set! (-> v1-24 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) - (set! (-> v1-24 color-emissive quad) (-> (new 'static 'vector) quad)) - (set! (-> v1-24 longest-edge) (-> arg1 longest-edge)) - (set! (-> v1-24 origin-joint-index) (the-as uint (-> arg1 origin-joint-index))) - (set! (-> v1-24 shadow-joint-index) (the-as uint (-> arg1 shadow-joint-index))) - ) - (set! (-> s2-0 bounds quad) (-> arg1 bounds quad)) - (let ((v1-26 (-> arg1 shadow))) - (when (and (> v1-26 0) (< v1-26 sv-20)) - (let ((s0-0 (-> s1-0 data v1-26))) - (if (and (not (logtest? (the-as int (res-lump-value (-> arg0 entity) 'options uint128 :time -1000000000.0)) 8192)) - (= (-> s0-0 type) shadow-geo) - ) - (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + (let ((sv-16 (-> s1-0 data (-> arg1 jgeo)))) + (let ((sv-20 (-> s1-0 length))) + (when (or (< (-> arg1 jgeo) 0) (>= (-> arg1 jgeo) sv-20) (not sv-16) (!= (-> sv-16 type) art-joint-geo)) + (go process-drawable-art-error "joint-geo") + (set! s2-0 (the-as draw-control #f)) + (goto cfg-50) + ) + (set! s2-0 (new 'process 'draw-control arg0 (the-as symbol sv-16))) + (let ((v1-24 s2-0)) + (set! (-> v1-24 status) (draw-control-status uninited)) + (set! (-> v1-24 art-group) s1-0) + (set! (-> v1-24 jgeo) (the-as art-joint-geo sv-16)) + (set! (-> v1-24 force-lod) -1) + (set! (-> v1-24 cur-lod) -1) + (set! (-> v1-24 shadow) #f) + (set! (-> v1-24 shadow-ctrl) #f) + (set! (-> v1-24 data-format) (draw-control-data-format merc)) + (set! (-> v1-24 color-mult quad) (-> (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) quad)) + (set! (-> v1-24 color-emissive quad) (-> (new 'static 'vector) quad)) + (set! (-> v1-24 longest-edge) (-> arg1 longest-edge)) + (set! (-> v1-24 origin-joint-index) (the-as uint (-> arg1 origin-joint-index))) + (set! (-> v1-24 shadow-joint-index) (the-as uint (-> arg1 shadow-joint-index))) + ) + (set! (-> s2-0 bounds quad) (-> arg1 bounds quad)) + (let ((v1-26 (-> arg1 shadow))) + (when (and (> v1-26 0) (< v1-26 sv-20)) + (let ((s0-0 (-> s1-0 data v1-26))) + (if (and (not (logtest? (the-as int (res-lump-value (-> arg0 entity) 'options uint128 :time -1000000000.0)) 8192)) + (= (-> s0-0 type) shadow-geo) + ) + (set! (-> s2-0 shadow) (the-as shadow-geo s0-0)) + ) ) + ) ) ) - ) - (if (not (setup-lods! (-> s2-0 lod-set) arg1 s1-0 (-> arg0 entity))) - (go process-drawable-art-error "mesh") + (if (not (setup-lods! (-> s2-0 lod-set) arg1 s1-0 (-> arg0 entity))) + (go process-drawable-art-error "mesh") + ) + (let ((v1-41 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) + ) + (case (if (= (-> arg1 texture-level) 6) + 6 + (-> s3-0 index) + ) + ((6) + (set! v1-41 (-> arg1 sort)) + ) + ) + (set! (-> s2-0 default-texture-page) (the-as uint v1-41)) ) - ) - (let ((v1-41 (res-lump-value (-> sv-16 extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)) - ) - (case (if (= (-> arg1 texture-level) 6) - 6 - (-> s3-0 index) - ) - ((6) - (set! v1-41 (-> arg1 sort)) - ) + (set! (-> s2-0 level-index) (the-as uint (-> s3-0 index))) + (set! (-> s2-0 dma-add-func) (the-as (function process-drawable draw-control symbol object none) nothing)) + (set! (-> arg2 0) (setup-cspace-and-add s2-0 (the-as art-joint-geo sv-16) 'process)) ) - (set! (-> s2-0 default-texture-page) (the-as uint v1-41)) ) - (set! (-> s2-0 level-index) (the-as uint (-> s3-0 index))) ) - (set! (-> s2-0 dma-add-func) (the-as (function process-drawable draw-control symbol object none) nothing)) - (set! (-> arg2 0) (setup-cspace-and-add s2-0 (the-as art-joint-geo sv-16) 'process)) (set! (-> s2-0 dma-add-func) dma-add-process-drawable) (set! (-> s2-0 shadow-mask) (res-lump-value (-> arg0 entity) 'shadow-mask uint :time -1000000000.0)) (set! (-> s2-0 shadow-values) (res-lump-value (-> arg0 entity) 'shadow-values uint :time -1000000000.0)) diff --git a/test/decompiler/reference/jak2/engine/ps2/pad_REF.gc b/test/decompiler/reference/jak2/engine/ps2/pad_REF.gc index f4e7098bb8..e945274a99 100644 --- a/test/decompiler/reference/jak2/engine/ps2/pad_REF.gc +++ b/test/decompiler/reference/jak2/engine/ps2/pad_REF.gc @@ -495,7 +495,7 @@ It's 32 bytes + type tag (ignored by C kernel)." (f28-0 (* 0.0078125 (the float (- 127 (the-as int (-> pad lefty)))))) ) (set! (-> pad stick0-dir) (atan (- f30-0) f28-0)) - (set! (-> pad stick0-speed) (fmin 1.0 (sqrtf (+ (* f30-0 f30-0) (* f28-0 f28-0))))) + (set! (-> pad stick0-speed) (fmin 1.0 (sqrtf (+ (square f30-0) (square f28-0))))) ) (if (< (-> pad stick0-speed) 0.3) (set! (-> pad stick0-speed) 0.0) diff --git a/test/decompiler/reference/jak2/engine/scene/scene_REF.gc b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc index eb0b5ff474..2c28ec3b45 100644 --- a/test/decompiler/reference/jak2/engine/scene/scene_REF.gc +++ b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc @@ -183,7 +183,7 @@ ;; definition for method 9 of type scene-actor ;; INFO: Used lq/sq (defmethod scene-actor-method-9 ((this scene-actor) (arg0 scene-player)) - (local-vars (s4-0 (pointer process)) (sv-96 process) (sv-112 process)) + (local-vars (s4-0 (pointer process))) (let ((s1-0 (if (-> this level) (level-get *level* (-> this level)) (-> *level* default-level) @@ -223,26 +223,26 @@ ) ) ) - (set! sv-96 (get-process *default-dead-pool* manipy #x4000)) - (set! s4-0 (when sv-96 - (let ((t9-7 (method-of-type manipy activate))) - (t9-7 (the-as manipy sv-96) arg0 (-> this name) (the-as pointer #x70004000)) - ) - (run-now-in-process - sv-96 - manipy-init - (-> arg0 root trans) - s1-1 - s2-0 - #f - (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) - 1 - 0 - ) - ) - (-> sv-96 ppointer) - ) - ) + (let ((sv-96 (get-process *default-dead-pool* manipy #x4000))) + (set! s4-0 + (when sv-96 + ((method-of-type manipy activate) (the-as manipy sv-96) arg0 (-> this name) (the-as pointer #x70004000)) + (run-now-in-process + sv-96 + manipy-init + (-> arg0 root trans) + s1-1 + s2-0 + #f + (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) + 1 + 0 + ) + ) + (-> sv-96 ppointer) + ) + ) + ) (set! (-> arg0 level) s0-0) (send-event (ppointer->process s4-0) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-0) 'blend-shape #t) @@ -300,16 +300,19 @@ ) ) (when (and s4-0 (logtest? (-> this flags) 2)) - (set! sv-112 (get-process *default-dead-pool* manipy #x4000)) - (let ((s0-1 (when sv-112 - (let ((t9-24 (method-of-type manipy activate))) - (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> this name) (the-as pointer #x70004000)) + (let* ((sv-112 (get-process *default-dead-pool* manipy #x4000)) + (s0-1 (when sv-112 + ((method-of-type manipy activate) + (the-as manipy sv-112) + (ppointer->process s4-0) + (-> this name) + (the-as pointer #x70004000) ) - (run-now-in-process sv-112 manipy-init (-> arg0 root trans) s1-1 s2-0 #f 0) - (-> sv-112 ppointer) - ) - ) - ) + (run-now-in-process sv-112 manipy-init (-> arg0 root trans) s1-1 s2-0 #f 0) + (-> sv-112 ppointer) + ) + ) + ) (send-event (ppointer->process s0-1) 'mirror #t) (send-event (ppointer->process s0-1) 'anim-mode 'mirror) (if (nonzero? (-> this light-index)) @@ -741,15 +744,13 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch pointer vs none. (defun draw-subtitle-image ((arg0 subtitle-image) (arg1 font-context)) - (local-vars (sv-16 pointer) (sv-32 int)) - (let ((gp-0 (-> arg0 width)) - (s5-0 (-> arg0 height)) - ) - (let ((s4-0 (-> *display* frames (-> *display* on-screen) global-buf))) - (set! sv-16 (-> s4-0 base)) - (unpack-comp-rle (the-as (pointer int8) sv-16) (the-as (pointer int8) (-> arg0 data))) - (&+! (-> s4-0 base) (logand -16 (+ (shr (* gp-0 s5-0) 1) 15))) - ) + (let* ((gp-0 (-> arg0 width)) + (s5-0 (-> arg0 height)) + (s4-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-16 (-> s4-0 base)) + ) + (unpack-comp-rle (the-as (pointer int8) sv-16) (the-as (pointer int8) (-> arg0 data))) + (&+! (-> s4-0 base) (logand -16 (+ (shr (* gp-0 s5-0) 1) 15))) (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) (bucket-id subtitle) ) @@ -761,16 +762,10 @@ (trxreg (new 'static 'gs-trxreg :rrw gp-0 :rrh s5-0)) (trxdir (new 'static 'gs-trxdir)) ) - (let ((t9-2 dma-buffer-add-ref-texture) - (a0-13 s3-0) - (a2-8 gp-0) - (a3-1 s5-0) - (t0-1 s0-0) + (dma-buffer-add-ref-texture s3-0 sv-16 (the-as int gp-0) (the-as int s5-0) (the-as gs-psm s0-0)) + (let ((sv-32 (+ (log2 (the-as int (+ gp-0 -1))) 1)) + (v1-17 (+ (log2 (the-as int (+ s5-0 -1))) 1)) ) - (t9-2 a0-13 sv-16 (the-as int a2-8) (the-as int a3-1) (the-as gs-psm t0-1)) - ) - (set! sv-32 (+ (log2 (the-as int (+ gp-0 -1))) 1)) - (let ((v1-17 (+ (log2 (the-as int (+ s5-0 -1))) 1))) (dma-buffer-add-gs-set s3-0 (test-1 (new 'static 'gs-test :ate #x1 :afail #x3 :zte #x1 :ztst (gs-ztest always))) (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) diff --git a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc index bc2d4100fe..1a0eed8023 100644 --- a/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc +++ b/test/decompiler/reference/jak2/engine/sound/gsound_REF.gc @@ -717,9 +717,9 @@ "Send play rpc to play a sound! Last arg can by a symbol with value [[#t]], in which case it will pull `trans` [[vector]] off the current [[process-drawable]] otherwise, an explicit [[vector]] can be provided" - (local-vars (sv-16 sound-group)) - (set! sv-16 arg5) - (let ((s4-0 arg6)) + (let ((sv-16 arg5) + (s4-0 arg6) + ) (when *sound-player-enable* (let ((s5-0 (the-as sound-rpc-play (get-sound-buffer-entry)))) (set! (-> s5-0 command) (sound-command play)) @@ -892,105 +892,99 @@ ;; WARN: Return type mismatch object vs ambient-sound. (defmethod new ambient-sound ((allocation symbol) (type-to-make type) (arg0 basic) (arg1 vector)) "Set up ambient-sound. Can use an entity-actor (grabs from lump), sound-spec, or name as a string." - (local-vars - (sv-16 sound-spec) - (sv-32 sound-name) - (sv-48 (pointer float)) - (sv-52 pointer) - (sv-56 int) - (sv-64 res-tag) - ) - (set! sv-16 (the-as sound-spec #f)) - (set! sv-32 (the-as sound-name 0)) - (set! sv-48 (the-as (pointer float) #f)) - (set! sv-52 (the-as pointer #f)) - (set! sv-56 0) - (case (-> arg0 type) - ((entity-actor) - (let ((v1-2 - ((method-of-type res-lump get-property-struct) - (the-as res-lump arg0) - 'effect-name - 'exact - 0.0 - (the-as structure #f) - (the-as (pointer res-tag) #f) - *res-static-buf* - ) - ) - ) - (when v1-2 - (set! sv-32 (string->sound-name (symbol->string v1-2))) - (set! sv-48 (res-lump-data (the-as res-lump arg0) 'cycle-speed (pointer float))) - (set! sv-16 *ambient-spec*) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-7 - ((method-of-type res-lump get-property-data) - (the-as res-lump arg0) - 'effect-param - 'exact - 0.0 - (the-as pointer #f) - (& sv-64) - *res-static-buf* - ) - ) + (let ((sv-16 (the-as sound-spec #f)) + (sv-32 (the-as sound-name 0)) + (sv-48 (the-as (pointer float) #f)) + (sv-52 (the-as pointer #f)) + (sv-56 0) + ) + (case (-> arg0 type) + ((entity-actor) + (let ((v1-2 + ((method-of-type res-lump get-property-struct) + (the-as res-lump arg0) + 'effect-name + 'exact + 0.0 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (when v1-2 + (set! sv-32 (string->sound-name (symbol->string v1-2))) + (set! sv-48 (res-lump-data (the-as res-lump arg0) 'cycle-speed (pointer float))) + (set! sv-16 *ambient-spec*) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-7 + ((method-of-type res-lump get-property-data) + (the-as res-lump arg0) + 'effect-param + 'exact + 0.0 + (the-as pointer #f) + (& sv-64) + *res-static-buf* + ) + ) + ) + (when v1-7 + (set! sv-52 v1-7) + (set! sv-56 (the-as int (-> sv-64 elt-count))) ) - (when v1-7 - (set! sv-52 v1-7) - (set! sv-56 (the-as int (-> sv-64 elt-count))) ) ) ) ) - ) - ((sound-spec) - (set! sv-16 (the-as sound-spec arg0)) - ) - ((string) - (set! sv-32 (string->sound-name (the-as string arg0))) - ) - (else - (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" arg0) - ) - ) - (the-as - ambient-sound - (cond - ((or sv-16 (nonzero? sv-32)) - (let ((s5-1 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size)))))) - (set! (-> (the-as ambient-sound s5-1) spec) sv-16) - (set! (-> (the-as ambient-sound s5-1) name) sv-32) - (set! (-> (the-as ambient-sound s5-1) playing-id) (new-sound-id)) - (set! (-> (the-as ambient-sound s5-1) params) (the-as (pointer float) sv-52)) - (set! (-> (the-as ambient-sound s5-1) param-count) sv-56) - (set! (-> (the-as ambient-sound s5-1) entity) #f) - (set! (-> (the-as ambient-sound s5-1) sound-count) 1) - (set! (-> (the-as ambient-sound s5-1) volume) 1024) - (set! (-> (the-as ambient-sound s5-1) pitch) 0) - (when (and sv-16 (!= sv-16 *ambient-spec*)) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) - (set! (-> (the-as ambient-sound s5-1) volume) (-> (the-as sound-spec sv-16) volume)) - ) - (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) - (set! (-> (the-as ambient-sound s5-1) pitch) (-> (the-as sound-spec sv-16) pitch-mod)) - ) - ) - (cond - (sv-48 - (set! (-> (the-as ambient-sound s5-1) time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) - (set! (-> (the-as ambient-sound s5-1) time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) - ) - (else - (set! (-> (the-as ambient-sound s5-1) time-base) -1) - ) - ) - (set! (-> (the-as ambient-sound s5-1) trans quad) (-> arg1 quad)) - s5-1 - ) + ((sound-spec) + (set! sv-16 (the-as sound-spec arg0)) + ) + ((string) + (set! sv-32 (string->sound-name (the-as string arg0))) ) (else - 0 + (format 0 "ERROR: ambient sound was told to play an unknown ~A.~%" arg0) + ) + ) + (the-as + ambient-sound + (cond + ((or sv-16 (nonzero? sv-32)) + (let ((s5-1 (the-as object (object-new allocation type-to-make (the-as int (-> type-to-make size)))))) + (set! (-> (the-as ambient-sound s5-1) spec) sv-16) + (set! (-> (the-as ambient-sound s5-1) name) sv-32) + (set! (-> (the-as ambient-sound s5-1) playing-id) (new-sound-id)) + (set! (-> (the-as ambient-sound s5-1) params) (the-as (pointer float) sv-52)) + (set! (-> (the-as ambient-sound s5-1) param-count) sv-56) + (set! (-> (the-as ambient-sound s5-1) entity) #f) + (set! (-> (the-as ambient-sound s5-1) sound-count) 1) + (set! (-> (the-as ambient-sound s5-1) volume) 1024) + (set! (-> (the-as ambient-sound s5-1) pitch) 0) + (when (and sv-16 (!= sv-16 *ambient-spec*)) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask volume)) + (set! (-> (the-as ambient-sound s5-1) volume) (-> (the-as sound-spec sv-16) volume)) + ) + (if (logtest? (-> (the-as sound-spec sv-16) mask) (sound-mask pitch)) + (set! (-> (the-as ambient-sound s5-1) pitch) (-> (the-as sound-spec sv-16) pitch-mod)) + ) + ) + (cond + (sv-48 + (set! (-> (the-as ambient-sound s5-1) time-base) (the-as time-frame (the int (* 300.0 (-> sv-48 0))))) + (set! (-> (the-as ambient-sound s5-1) time-random) (the-as time-frame (the int (* 300.0 (-> sv-48 1))))) + ) + (else + (set! (-> (the-as ambient-sound s5-1) time-base) -1) + ) + ) + (set! (-> (the-as ambient-sound s5-1) trans quad) (-> arg1 quad)) + s5-1 + ) + ) + (else + 0 + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/sound/speech_REF.gc b/test/decompiler/reference/jak2/engine/sound/speech_REF.gc index 5bc5026365..1d64bd7cd5 100644 --- a/test/decompiler/reference/jak2/engine/sound/speech_REF.gc +++ b/test/decompiler/reference/jak2/engine/sound/speech_REF.gc @@ -43,11 +43,9 @@ ) (if (or (< (the-as time-frame (-> s5-1 request-timeout)) a0-8) (or (not v1-20) - (let ((f0-0 245760.0)) - (< (* f0-0 f0-0) - (vector-vector-distance-squared (-> this target-pos) (-> (the-as process-drawable v1-20) root trans)) - ) - ) + (< (square 245760.0) + (vector-vector-distance-squared (-> this target-pos) (-> (the-as process-drawable v1-20) root trans)) + ) ) ) (speech-channel-method-12 this) @@ -183,14 +181,9 @@ ;; definition for method 9 of type speech-channel ;; WARN: Return type mismatch int vs none. (defmethod speech-channel-method-9 ((this speech-channel) (arg0 process-drawable) (arg1 speech-type)) - (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> this target-pos))) - (f1-0 245760.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let* ((f1-3 -1.0) - (f2-0 409600.0) - (f0-2 (+ (* f0-0 (/ f1-3 (* f2-0 f2-0))) (the float (-> this speech-table arg1 priority)))) - ) + (let ((f0-0 (vector-vector-distance-squared (-> arg0 root trans) (-> this target-pos)))) + (when (< f0-0 (square 245760.0)) + (let ((f0-2 (+ (* f0-0 (/ -1.0 (square 409600.0))) (the float (-> this speech-table arg1 priority))))) (when (< (-> this request priority) f0-2) (set! (-> this request priority) f0-2) (set! (-> this request handle) (process->handle arg0)) diff --git a/test/decompiler/reference/jak2/engine/spatial-hash/actor-hash_REF.gc b/test/decompiler/reference/jak2/engine/spatial-hash/actor-hash_REF.gc index 99e550b38c..78d9fa9e2c 100644 --- a/test/decompiler/reference/jak2/engine/spatial-hash/actor-hash_REF.gc +++ b/test/decompiler/reference/jak2/engine/spatial-hash/actor-hash_REF.gc @@ -98,7 +98,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod hash-actors ((this actor-hash-buckets)) - (local-vars (sv-16 hash-object-info) (sv-32 collide-prim-core) (sv-48 collide-shape) (sv-64 hash-object-info)) (set! (-> this hash) *actor-hash*) (set! (-> this list) *collide-hit-by-others-list*) (clear-objects! (-> this hash)) @@ -117,11 +116,12 @@ (set! s2-0 (cond ((< s2-0 (-> s3-0 max-object-count)) - (let ((a0-7 (-> s3-0 sphere-array s2-0))) - (set! sv-16 (-> s3-0 object-array s2-0)) + (let ((a0-7 (-> s3-0 sphere-array s2-0)) + (sv-16 (-> s3-0 object-array s2-0)) + ) (mem-copy! (the-as pointer a0-7) (the-as pointer s1-0) 16) + (set! (-> sv-16 object) s0-0) ) - (set! (-> sv-16 object) s0-0) (dotimes (v1-12 3) (set! (-> s3-0 box-min v1-12) (fmin (-> s3-0 box-min v1-12) (- (-> s1-0 world-sphere data v1-12) (-> s1-0 world-sphere w))) @@ -158,20 +158,15 @@ (while (!= v1-25 (-> this list alive-list-end)) (let* ((s4-1 (the-as collide-shape (-> (the-as connection v1-25) param1))) (f0-4 (vector-vector-distance-squared (-> this tpos) (-> s4-1 trans))) - (f1-4 102400.0) ) (cond - ((< f0-4 (* f1-4 f1-4)) + ((< f0-4 (square 102400.0)) ((method-of-type actor-hash-bucket add-actor-cshape) (-> this data 0) s4-1) ) - ((let ((f1-7 204800.0)) - (< f0-4 (* f1-7 f1-7)) - ) + ((< f0-4 (square 204800.0)) (add-actor-cshape (-> this data 1) s4-1) ) - ((let ((f1-10 307200.0)) - (< f0-4 (* f1-10 f1-10)) - ) + ((< f0-4 (square 307200.0)) (add-actor-cshape (-> this data 2) s4-1) ) (else @@ -188,38 +183,38 @@ (dotimes (s5-3 4) (let ((s4-2 (-> this data s5-3))) (countdown (s3-1 (-> s4-2 length)) - (let ((s2-1 (-> s4-2 data s3-1 cshape)) - (s1-1 (-> this hash)) - ) - (set! sv-32 (-> s2-1 root-prim prim-core)) - (set! sv-48 s2-1) - (let ((s0-1 (-> s1-1 object-count))) - (set! s0-1 - (cond - ((< s0-1 (-> s1-1 max-object-count)) - (let ((a0-40 (-> s1-1 sphere-array s0-1))) - (set! sv-64 (-> s1-1 object-array s0-1)) - (mem-copy! (the-as pointer a0-40) (the-as pointer sv-32) 16) - ) + (let* ((s2-1 (-> s4-2 data s3-1 cshape)) + (s1-1 (-> this hash)) + (sv-32 (-> s2-1 root-prim prim-core)) + (sv-48 s2-1) + (s0-1 (-> s1-1 object-count)) + ) + (set! s0-1 + (cond + ((< s0-1 (-> s1-1 max-object-count)) + (let ((a0-40 (-> s1-1 sphere-array s0-1)) + (sv-64 (-> s1-1 object-array s0-1)) + ) + (mem-copy! (the-as pointer a0-40) (the-as pointer sv-32) 16) (set! (-> sv-64 object) sv-48) - (dotimes (v1-53 3) - (set! (-> s1-1 box-min v1-53) - (fmin (-> s1-1 box-min v1-53) (- (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) - ) - (set! (-> s1-1 box-max v1-53) - (fmax (-> s1-1 box-max v1-53) (+ (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) - ) - ) - (+! (-> s1-1 object-count) 1) - s0-1 ) - (else - -1 - ) + (dotimes (v1-53 3) + (set! (-> s1-1 box-min v1-53) + (fmin (-> s1-1 box-min v1-53) (- (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) + ) + (set! (-> s1-1 box-max v1-53) + (fmax (-> s1-1 box-max v1-53) (+ (-> sv-32 world-sphere data v1-53) (-> sv-32 world-sphere w))) + ) + ) + (+! (-> s1-1 object-count) 1) + s0-1 + ) + (else + -1 ) ) - (set! (-> s2-1 actor-hash-index) s0-1) - ) + ) + (set! (-> s2-1 actor-hash-index) s0-1) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/spatial-hash/collide-hash_REF.gc b/test/decompiler/reference/jak2/engine/spatial-hash/collide-hash_REF.gc index dac28cd16e..80d9c87577 100644 --- a/test/decompiler/reference/jak2/engine/spatial-hash/collide-hash_REF.gc +++ b/test/decompiler/reference/jak2/engine/spatial-hash/collide-hash_REF.gc @@ -113,9 +113,6 @@ (a1-3 uint128) (a2-3 uint128) (a2-4 uint128) - (sv-16 int) - (sv-20 collide-list) - (sv-640 int) ) (rlet ((acc :class vf) (vf0 :class vf) @@ -137,214 +134,217 @@ (vf9 :class vf) ) (init-vf0-vector) - (set! sv-16 (-> arg1 num-items)) - (set! sv-20 arg1) - (dotimes (s4-0 sv-16) - (let ((s3-0 (-> sv-20 items s4-0 mesh))) - (cond - ((= (-> s3-0 type) instance-tie) - (let* ((v1-4 s3-0) - (s1-0 (-> v1-4 bucket-ptr)) - ) - (when (not (or (logtest? (-> s1-0 flags) (prototype-flags no-collide)) - (logtest? (-> v1-4 flags) (instance-flags no-collide)) - ) - ) - (if *collide-list-boxes* - (add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :a #x80)) - ) - (let ((s0-0 (new 'stack-no-clear 'matrix)) - (s2-0 (new 'stack-no-clear 'collide-query)) + (let ((sv-16 (-> arg1 num-items)) + (sv-20 arg1) + ) + (dotimes (s4-0 sv-16) + (let ((s3-0 (-> sv-20 items s4-0 mesh))) + (cond + ((= (-> s3-0 type) instance-tie) + (let* ((v1-4 s3-0) + (s1-0 (-> v1-4 bucket-ptr)) + ) + (when (not (or (logtest? (-> s1-0 flags) (prototype-flags no-collide)) + (logtest? (-> v1-4 flags) (instance-flags no-collide)) + ) + ) + (if *collide-list-boxes* + (add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :a #x80)) ) - (mem-copy! (the-as pointer s2-0) (the-as pointer arg2) 540) - (nop!) - (nop!) - (let ((v1-11 (the-as uint128 (-> s3-0 origin vector4h 3 long)))) + (let ((s0-0 (new 'stack-no-clear 'matrix)) + (s2-0 (new 'stack-no-clear 'collide-query)) + ) + (mem-copy! (the-as pointer s2-0) (the-as pointer arg2) 540) (nop!) - (let ((a2-2 (the-as uint128 (-> s3-0 origin vector4h 0 long)))) - (.pextlh v1-12 v1-11 0) - (let ((a0-9 (the-as uint128 (-> s3-0 origin vector4h 1 long)))) - (.pw.sra a1-3 v1-12 10) - (let ((v1-13 (the-as uint128 (-> s3-0 origin vector4h 2 long)))) - (.pextlh a2-3 a2-2 0) - (nop!) - (.pw.sra a2-4 a2-3 16) - (nop!) - (.pextlh a0-10 a0-9 0) - (.mov vf4 a1-3) - (.pw.sra a0-11 a0-10 16) - (.mov vf1 a2-4) - (.pextlh v1-14 v1-13 0) + (nop!) + (let ((v1-11 (the-as uint128 (-> s3-0 origin vector4h 3 long)))) + (nop!) + (let ((a2-2 (the-as uint128 (-> s3-0 origin vector4h 0 long)))) + (.pextlh v1-12 v1-11 0) + (let ((a0-9 (the-as uint128 (-> s3-0 origin vector4h 1 long)))) + (.pw.sra a1-3 v1-12 10) + (let ((v1-13 (the-as uint128 (-> s3-0 origin vector4h 2 long)))) + (.pextlh a2-3 a2-2 0) + (nop!) + (.pw.sra a2-4 a2-3 16) + (nop!) + (.pextlh a0-10 a0-9 0) + (.mov vf4 a1-3) + (.pw.sra a0-11 a0-10 16) + (.mov vf1 a2-4) + (.pextlh v1-14 v1-13 0) + ) ) ) ) - ) - (.mov vf2 a0-11) - (.pw.sra v1-15 v1-14 16) - (.lvf vf5 (&-> s3-0 bsphere quad)) - (nop!) - (.mov vf3 v1-15) - (.itof.vf vf4 vf4) - (nop!) - (vitof12.xyzw vf1 vf1) - (nop!) - (vitof12.xyzw vf2 vf2) - (nop!) - (vitof12.xyzw vf3 vf3) - (nop!) - (.add.vf.xyz vf4 vf4 vf5) - (nop!) - (nop!) - (.svf (&-> s2-0 instance-mat quad 0) vf1) - (nop!) - (.svf (&-> s2-0 instance-mat quad 1) vf2) - (nop!) - (.svf (&-> s2-0 instance-mat quad 2) vf3) - (nop!) - (.svf (&-> s2-0 instance-mat trans quad) vf4) - (matrix-4x4-inverse! s0-0 (-> s2-0 instance-mat)) - (nop!) - (nop!) - (.lvf vf7 (&-> arg2 bbox min quad)) - (nop!) - (.lvf vf14 (&-> arg2 bbox max quad)) - (nop!) - (.lvf vf1 (&-> s0-0 quad 0)) - (nop!) - (.lvf vf2 (&-> s0-0 quad 1)) - (nop!) - (.lvf vf3 (&-> s0-0 quad 2)) - (nop!) - (.lvf vf4 (&-> s0-0 trans quad)) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf7 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf7 acc) - (nop!) - (.add.mul.z.vf vf8 vf3 vf14 acc) - (nop!) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf7 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf14 acc) - (nop!) - (.add.mul.z.vf vf9 vf3 vf7 acc) - (nop!) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf7 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf14 acc) - (nop!) - (.add.mul.z.vf vf10 vf3 vf14 acc) - (nop!) - (.min.vf vf5 vf8 vf9) - (nop!) - (.max.vf vf6 vf8 vf9) - (nop!) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf14 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf7 acc) - (nop!) - (.add.mul.z.vf vf11 vf3 vf7 acc) - (nop!) - (.min.vf vf5 vf5 vf10) - (nop!) - (.max.vf vf6 vf6 vf10) - (nop!) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf14 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf7 acc) - (nop!) - (.add.mul.z.vf vf12 vf3 vf14 acc) - (nop!) - (.min.vf vf5 vf5 vf11) - (nop!) - (.max.vf vf6 vf6 vf11) - (nop!) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf14 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf14 acc) - (nop!) - (.add.mul.z.vf vf13 vf3 vf7 acc) - (nop!) - (.min.vf vf5 vf5 vf12) - (nop!) - (.max.vf vf6 vf6 vf12) - (nop!) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf14 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf14 acc) - (nop!) - (.add.mul.z.vf vf14 vf3 vf14 acc) - (nop!) - (.min.vf vf5 vf5 vf13) - (nop!) - (.max.vf vf6 vf6 vf13) - (nop!) - (.mul.w.vf acc vf4 vf0) - (nop!) - (.add.mul.x.vf acc vf1 vf7 acc) - (nop!) - (.add.mul.y.vf acc vf2 vf7 acc) - (nop!) - (.add.mul.z.vf vf7 vf3 vf7 acc) - (nop!) - (.min.vf vf5 vf5 vf14) - (nop!) - (.max.vf vf6 vf6 vf14) - (nop!) - (.min.vf vf5 vf5 vf7) - (nop!) - (.max.vf vf6 vf6 vf7) - (nop!) - (.ftoi.vf vf16 vf5) - (nop!) - (.ftoi.vf vf17 vf6) - (nop!) - (nop!) - (.svf (&-> s2-0 bbox min quad) vf5) - (nop!) - (.svf (&-> s2-0 bbox max quad) vf6) - (nop!) - (.svf (&-> s2-0 bbox4w min quad) vf16) - (nop!) - (.svf (&-> s2-0 bbox4w max quad) vf17) - (let ((s1-1 (-> s1-0 collide-hash-fragment-array))) - (set! sv-640 (-> s1-1 length)) - (set! (-> s2-0 instance-ptr) s3-0) - (dotimes (s3-1 sv-640) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) - (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) - (fill-bg-using-box-new arg0 (-> s1-1 fragments s3-1) s2-0) - (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) + (.mov vf2 a0-11) + (.pw.sra v1-15 v1-14 16) + (.lvf vf5 (&-> s3-0 bsphere quad)) + (nop!) + (.mov vf3 v1-15) + (.itof.vf vf4 vf4) + (nop!) + (vitof12.xyzw vf1 vf1) + (nop!) + (vitof12.xyzw vf2 vf2) + (nop!) + (vitof12.xyzw vf3 vf3) + (nop!) + (.add.vf.xyz vf4 vf4 vf5) + (nop!) + (nop!) + (.svf (&-> s2-0 instance-mat quad 0) vf1) + (nop!) + (.svf (&-> s2-0 instance-mat quad 1) vf2) + (nop!) + (.svf (&-> s2-0 instance-mat quad 2) vf3) + (nop!) + (.svf (&-> s2-0 instance-mat trans quad) vf4) + (matrix-4x4-inverse! s0-0 (-> s2-0 instance-mat)) + (nop!) + (nop!) + (.lvf vf7 (&-> arg2 bbox min quad)) + (nop!) + (.lvf vf14 (&-> arg2 bbox max quad)) + (nop!) + (.lvf vf1 (&-> s0-0 quad 0)) + (nop!) + (.lvf vf2 (&-> s0-0 quad 1)) + (nop!) + (.lvf vf3 (&-> s0-0 quad 2)) + (nop!) + (.lvf vf4 (&-> s0-0 trans quad)) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf7 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf7 acc) + (nop!) + (.add.mul.z.vf vf8 vf3 vf14 acc) + (nop!) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf7 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf14 acc) + (nop!) + (.add.mul.z.vf vf9 vf3 vf7 acc) + (nop!) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf7 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf14 acc) + (nop!) + (.add.mul.z.vf vf10 vf3 vf14 acc) + (nop!) + (.min.vf vf5 vf8 vf9) + (nop!) + (.max.vf vf6 vf8 vf9) + (nop!) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf14 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf7 acc) + (nop!) + (.add.mul.z.vf vf11 vf3 vf7 acc) + (nop!) + (.min.vf vf5 vf5 vf10) + (nop!) + (.max.vf vf6 vf6 vf10) + (nop!) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf14 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf7 acc) + (nop!) + (.add.mul.z.vf vf12 vf3 vf14 acc) + (nop!) + (.min.vf vf5 vf5 vf11) + (nop!) + (.max.vf vf6 vf6 vf11) + (nop!) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf14 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf14 acc) + (nop!) + (.add.mul.z.vf vf13 vf3 vf7 acc) + (nop!) + (.min.vf vf5 vf5 vf12) + (nop!) + (.max.vf vf6 vf6 vf12) + (nop!) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf14 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf14 acc) + (nop!) + (.add.mul.z.vf vf14 vf3 vf14 acc) + (nop!) + (.min.vf vf5 vf5 vf13) + (nop!) + (.max.vf vf6 vf6 vf13) + (nop!) + (.mul.w.vf acc vf4 vf0) + (nop!) + (.add.mul.x.vf acc vf1 vf7 acc) + (nop!) + (.add.mul.y.vf acc vf2 vf7 acc) + (nop!) + (.add.mul.z.vf vf7 vf3 vf7 acc) + (nop!) + (.min.vf vf5 vf5 vf14) + (nop!) + (.max.vf vf6 vf6 vf14) + (nop!) + (.min.vf vf5 vf5 vf7) + (nop!) + (.max.vf vf6 vf6 vf7) + (nop!) + (.ftoi.vf vf16 vf5) + (nop!) + (.ftoi.vf vf17 vf6) + (nop!) + (nop!) + (.svf (&-> s2-0 bbox min quad) vf5) + (nop!) + (.svf (&-> s2-0 bbox max quad) vf6) + (nop!) + (.svf (&-> s2-0 bbox4w min quad) vf16) + (nop!) + (.svf (&-> s2-0 bbox4w max quad) vf17) + (let* ((s1-1 (-> s1-0 collide-hash-fragment-array)) + (sv-640 (-> s1-1 length)) + ) + (set! (-> s2-0 instance-ptr) s3-0) + (dotimes (s3-1 sv-640) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) + (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) + (fill-bg-using-box-new arg0 (-> s1-1 fragments s3-1) s2-0) + (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) + ) ) ) ) ) ) - ) - (else - (if *collide-list-boxes* - (add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) - ) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) - (set! (-> arg2 instance-ptr) #f) - (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) - (fill-bg-using-box-new arg0 s3-0 arg2) - (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) + (else + (if *collide-list-boxes* + (add-collide-debug-box (-> s3-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) + (set! (-> arg2 instance-ptr) #f) + (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) + (fill-bg-using-box-new arg0 s3-0 arg2) + (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) + ) ) ) ) @@ -380,8 +380,6 @@ (a1-3 uint128) (a2-3 uint128) (a2-4 uint128) - (sv-16 int) - (sv-640 int) ) (rlet ((acc :class vf) (vf0 :class vf) @@ -398,211 +396,213 @@ (vf9 :class vf) ) (init-vf0-vector) - (set! sv-16 (-> arg1 num-items)) - (dotimes (s3-0 sv-16) - (let ((s2-0 (-> arg1 items s3-0 mesh))) - (cond - ((= (-> s2-0 type) instance-tie) - (let ((v1-4 s2-0)) - (when (not (or (logtest? (-> v1-4 bucket-ptr flags) (prototype-flags no-collide)) - (logtest? (-> v1-4 flags) (instance-flags no-collide)) - ) - ) - (if *collide-list-boxes* - (add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :a #x80)) - ) - (let ((s0-0 (new 'stack-no-clear 'matrix)) - (s1-0 (new 'stack-no-clear 'collide-query)) + (let ((sv-16 (-> arg1 num-items))) + (dotimes (s3-0 sv-16) + (let ((s2-0 (-> arg1 items s3-0 mesh))) + (cond + ((= (-> s2-0 type) instance-tie) + (let ((v1-4 s2-0)) + (when (not (or (logtest? (-> v1-4 bucket-ptr flags) (prototype-flags no-collide)) + (logtest? (-> v1-4 flags) (instance-flags no-collide)) + ) + ) + (if *collide-list-boxes* + (add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :a #x80)) ) - (mem-copy! (the-as pointer s1-0) (the-as pointer arg2) 540) - (nop!) - (let ((v1-11 (the-as uint128 (-> s2-0 origin vector4h 3 long)))) + (let ((s0-0 (new 'stack-no-clear 'matrix)) + (s1-0 (new 'stack-no-clear 'collide-query)) + ) + (mem-copy! (the-as pointer s1-0) (the-as pointer arg2) 540) (nop!) - (let ((a2-2 (the-as uint128 (-> s2-0 origin vector4h 0 long)))) - (.pextlh v1-12 v1-11 0) - (let ((a0-9 (the-as uint128 (-> s2-0 origin vector4h 1 long)))) - (.pw.sra a1-3 v1-12 10) - (let ((v1-13 (the-as uint128 (-> s2-0 origin vector4h 2 long)))) - (.pextlh a2-3 a2-2 0) - (nop!) - (.pw.sra a2-4 a2-3 16) - (nop!) - (.pextlh a0-10 a0-9 0) - (.mov vf4 a1-3) - (.pw.sra a0-11 a0-10 16) - (.mov vf1 a2-4) - (.pextlh v1-14 v1-13 0) + (let ((v1-11 (the-as uint128 (-> s2-0 origin vector4h 3 long)))) + (nop!) + (let ((a2-2 (the-as uint128 (-> s2-0 origin vector4h 0 long)))) + (.pextlh v1-12 v1-11 0) + (let ((a0-9 (the-as uint128 (-> s2-0 origin vector4h 1 long)))) + (.pw.sra a1-3 v1-12 10) + (let ((v1-13 (the-as uint128 (-> s2-0 origin vector4h 2 long)))) + (.pextlh a2-3 a2-2 0) + (nop!) + (.pw.sra a2-4 a2-3 16) + (nop!) + (.pextlh a0-10 a0-9 0) + (.mov vf4 a1-3) + (.pw.sra a0-11 a0-10 16) + (.mov vf1 a2-4) + (.pextlh v1-14 v1-13 0) + ) ) ) ) - ) - (.mov vf2 a0-11) - (.pw.sra v1-15 v1-14 16) - (.lvf vf5 (&-> s2-0 bsphere quad)) - (nop!) - (.mov vf3 v1-15) - (.itof.vf vf4 vf4) - (nop!) - (vitof12.xyzw vf1 vf1) - (nop!) - (vitof12.xyzw vf2 vf2) - (nop!) - (vitof12.xyzw vf3 vf3) - (nop!) - (.add.vf.xyz vf4 vf4 vf5) - (nop!) - (nop!) - (.svf (&-> s1-0 instance-mat quad 0) vf1) - (nop!) - (.svf (&-> s1-0 instance-mat quad 1) vf2) - (nop!) - (.svf (&-> s1-0 instance-mat quad 2) vf3) - (nop!) - (.svf (&-> s1-0 instance-mat trans quad) vf4) - (matrix-4x4-inverse! s0-0 (-> s1-0 instance-mat)) - (nop!) - (nop!) - (.lvf vf7 (&-> arg2 start-pos quad)) - (nop!) - (.lvf vf8 (&-> arg2 move-dist quad)) - (nop!) - (.lvf vf1 (&-> s0-0 quad 0)) - (nop!) - (.lvf vf2 (&-> s0-0 quad 1)) - (nop!) - (.lvf vf3 (&-> s0-0 quad 2)) - (nop!) - (.lvf vf4 (&-> s0-0 trans quad)) - (.add.vf vf8 vf7 vf8) - (let ((v1-16 (-> s2-0 rmin-scale))) - (.mul.x.vf acc vf1 vf7) - (let ((f2-0 (-> arg2 radius))) - (.add.mul.y.vf acc vf2 vf7 acc) - (.sll v1-17 v1-16 16) - (.add.mul.z.vf acc vf3 vf7 acc) - (let ((f1-0 (the-as float v1-17))) - (.add.mul.w.vf vf7 vf4 vf0 acc) - (nop!) - (.mul.x.vf acc vf1 vf8) - (let ((f2-1 (* f2-0 f1-0))) - (.add.mul.y.vf acc vf2 vf8 acc) + (.mov vf2 a0-11) + (.pw.sra v1-15 v1-14 16) + (.lvf vf5 (&-> s2-0 bsphere quad)) + (nop!) + (.mov vf3 v1-15) + (.itof.vf vf4 vf4) + (nop!) + (vitof12.xyzw vf1 vf1) + (nop!) + (vitof12.xyzw vf2 vf2) + (nop!) + (vitof12.xyzw vf3 vf3) + (nop!) + (.add.vf.xyz vf4 vf4 vf5) + (nop!) + (nop!) + (.svf (&-> s1-0 instance-mat quad 0) vf1) + (nop!) + (.svf (&-> s1-0 instance-mat quad 1) vf2) + (nop!) + (.svf (&-> s1-0 instance-mat quad 2) vf3) + (nop!) + (.svf (&-> s1-0 instance-mat trans quad) vf4) + (matrix-4x4-inverse! s0-0 (-> s1-0 instance-mat)) + (nop!) + (nop!) + (.lvf vf7 (&-> arg2 start-pos quad)) + (nop!) + (.lvf vf8 (&-> arg2 move-dist quad)) + (nop!) + (.lvf vf1 (&-> s0-0 quad 0)) + (nop!) + (.lvf vf2 (&-> s0-0 quad 1)) + (nop!) + (.lvf vf3 (&-> s0-0 quad 2)) + (nop!) + (.lvf vf4 (&-> s0-0 trans quad)) + (.add.vf vf8 vf7 vf8) + (let ((v1-16 (-> s2-0 rmin-scale))) + (.mul.x.vf acc vf1 vf7) + (let ((f2-0 (-> arg2 radius))) + (.add.mul.y.vf acc vf2 vf7 acc) + (.sll v1-17 v1-16 16) + (.add.mul.z.vf acc vf3 vf7 acc) + (let ((f1-0 (the-as float v1-17))) + (.add.mul.w.vf vf7 vf4 vf0 acc) (nop!) - (.add.mul.z.vf acc vf3 vf8 acc) - (nop!) - (.add.mul.w.vf vf8 vf4 vf0 acc) - (nop!) - (nop!) - (.svf (&-> s1-0 start-pos quad) vf7) - (.min.vf vf5 vf7 vf8) - (set! (-> s1-0 radius) f2-1) + (.mul.x.vf acc vf1 vf8) + (let ((f2-1 (* f2-0 f1-0))) + (.add.mul.y.vf acc vf2 vf8 acc) + (nop!) + (.add.mul.z.vf acc vf3 vf8 acc) + (nop!) + (.add.mul.w.vf vf8 vf4 vf0 acc) + (nop!) + (nop!) + (.svf (&-> s1-0 start-pos quad) vf7) + (.min.vf vf5 vf7 vf8) + (set! (-> s1-0 radius) f2-1) + ) ) ) ) - ) - (.max.vf vf6 vf7 vf8) - (nop!) - (nop!) - (.lvf vf9 (&-> s1-0 exit-planes 0 quad)) - (.sub.vf vf8 vf8 vf7) - (nop!) - (.sub.w.vf vf5 vf5 vf9) - (nop!) - (.add.w.vf vf6 vf6 vf9) - (nop!) - (nop!) - (.svf (&-> s1-0 move-dist quad) vf8) - (.ftoi.vf vf10 vf5) - (nop!) - (.ftoi.vf vf11 vf6) - (nop!) - (nop!) - (.svf (&-> s1-0 bbox min quad) vf5) - (nop!) - (.svf (&-> s1-0 bbox max quad) vf6) - (nop!) - (.svf (&-> s1-0 bbox4w min quad) vf10) - (nop!) - (.svf (&-> s1-0 bbox4w max quad) vf11) - (set! (-> s1-0 rlength x) (if (= (-> s1-0 move-dist x) 0.0) - 0.0 - (/ 1.0 (-> s1-0 move-dist x)) - ) + (.max.vf vf6 vf7 vf8) + (nop!) + (nop!) + (.lvf vf9 (&-> s1-0 exit-planes 0 quad)) + (.sub.vf vf8 vf8 vf7) + (nop!) + (.sub.w.vf vf5 vf5 vf9) + (nop!) + (.add.w.vf vf6 vf6 vf9) + (nop!) + (nop!) + (.svf (&-> s1-0 move-dist quad) vf8) + (.ftoi.vf vf10 vf5) + (nop!) + (.ftoi.vf vf11 vf6) + (nop!) + (nop!) + (.svf (&-> s1-0 bbox min quad) vf5) + (nop!) + (.svf (&-> s1-0 bbox max quad) vf6) + (nop!) + (.svf (&-> s1-0 bbox4w min quad) vf10) + (nop!) + (.svf (&-> s1-0 bbox4w max quad) vf11) + (set! (-> s1-0 rlength x) (if (= (-> s1-0 move-dist x) 0.0) + 0.0 + (/ 1.0 (-> s1-0 move-dist x)) + ) + ) + (set! (-> s1-0 rlength y) (if (= (-> s1-0 move-dist y) 0.0) + 0.0 + (/ 1.0 (-> s1-0 move-dist y)) + ) + ) + (set! (-> s1-0 rlength z) (if (= (-> s1-0 move-dist z) 0.0) + 0.0 + (/ 1.0 (-> s1-0 move-dist z)) + ) + ) + (let ((f0-12 1.0)) + (.lvf vf1 (&-> (-> s1-0 move-dist) quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-26 vf1) + (set! (-> s1-0 rlength w) (/ f0-12 v1-26)) + ) + (set! (-> s1-0 exit-planes 0 x) (if (< 0.0 (-> s1-0 move-dist x)) + 0.0 + 100000000000000000000000000000000000000.0 + ) + ) + (set! (-> s1-0 exit-planes 0 y) (if (< 0.0 (-> s1-0 move-dist y)) + 0.0 + 100000000000000000000000000000000000000.0 + ) + ) + (set! (-> s1-0 exit-planes 0 z) (if (< 0.0 (-> s1-0 move-dist z)) + 0.0 + 100000000000000000000000000000000000000.0 + ) + ) + (set! (-> s1-0 exit-planes 1 x) (if (< (-> s1-0 move-dist x) 0.0) + 0.0 + 100000000000000000000000000000000000000.0 + ) + ) + (set! (-> s1-0 exit-planes 1 y) (if (< (-> s1-0 move-dist y) 0.0) + 0.0 + 100000000000000000000000000000000000000.0 + ) + ) + (set! (-> s1-0 exit-planes 1 z) (if (< (-> s1-0 move-dist z) 0.0) + 0.0 + 100000000000000000000000000000000000000.0 + ) + ) + (let* ((s0-1 (-> s2-0 bucket-ptr collide-hash-fragment-array)) + (sv-640 (-> s0-1 length)) + ) + (set! (-> s1-0 instance-ptr) s2-0) + (dotimes (s2-1 sv-640) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) + (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) + (fill-bg-using-line-sphere-new arg0 (-> s0-1 fragments s2-1) s1-0) + (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) ) - (set! (-> s1-0 rlength y) (if (= (-> s1-0 move-dist y) 0.0) - 0.0 - (/ 1.0 (-> s1-0 move-dist y)) - ) - ) - (set! (-> s1-0 rlength z) (if (= (-> s1-0 move-dist z) 0.0) - 0.0 - (/ 1.0 (-> s1-0 move-dist z)) - ) - ) - (let ((f0-12 1.0)) - (.lvf vf1 (&-> (-> s1-0 move-dist) quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-26 vf1) - (set! (-> s1-0 rlength w) (/ f0-12 v1-26)) - ) - (set! (-> s1-0 exit-planes 0 x) (if (< 0.0 (-> s1-0 move-dist x)) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> s1-0 exit-planes 0 y) (if (< 0.0 (-> s1-0 move-dist y)) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> s1-0 exit-planes 0 z) (if (< 0.0 (-> s1-0 move-dist z)) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> s1-0 exit-planes 1 x) (if (< (-> s1-0 move-dist x) 0.0) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> s1-0 exit-planes 1 y) (if (< (-> s1-0 move-dist y) 0.0) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (set! (-> s1-0 exit-planes 1 z) (if (< (-> s1-0 move-dist z) 0.0) - 0.0 - 100000000000000000000000000000000000000.0 - ) - ) - (let ((s0-1 (-> s2-0 bucket-ptr collide-hash-fragment-array))) - (set! sv-640 (-> s0-1 length)) - (set! (-> s1-0 instance-ptr) s2-0) - (dotimes (s2-1 sv-640) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) - (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) - (fill-bg-using-line-sphere-new arg0 (-> s0-1 fragments s2-1) s1-0) - (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) ) ) ) ) ) - ) - (else - (if *collide-list-boxes* - (add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) - ) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) - (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) - (set! (-> arg2 instance-ptr) #f) - (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) - (fill-bg-using-line-sphere-new arg0 s2-0 arg2) - (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) + (else + (if *collide-list-boxes* + (add-collide-debug-box (-> s2-0 bsphere) (new 'static 'rgba :r #xff :g #xff :a #x80)) + ) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 0) (the-as uint128 0)) + (set! (-> (the-as collide-hash-scratch #x70000000) collidable-bits 1) (the-as uint128 0)) + (set! (-> arg2 instance-ptr) #f) + (set! (-> (the-as collide-hash-scratch #x70000000) tris) (the-as uint 0)) + (fill-bg-using-line-sphere-new arg0 s2-0 arg2) + (+! (-> *collide-stats* tris) (-> (the-as collide-hash-scratch #x70000000) tris)) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash_REF.gc b/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash_REF.gc index 50b96159bb..52a78532e4 100644 --- a/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash_REF.gc +++ b/test/decompiler/reference/jak2/engine/spatial-hash/spatial-hash_REF.gc @@ -568,44 +568,45 @@ ;; definition (debug) for function draw-grid ;; WARN: Return type mismatch int vs none. (defun-debug draw-grid ((arg0 vector) (arg1 vector) (arg2 (pointer int8)) (arg3 rgba)) - (local-vars (sv-64 vector) (sv-68 vector) (sv-72 vector)) - (set! sv-64 (new 'stack-no-clear 'vector)) - (set! sv-68 (new 'stack-no-clear 'vector)) - (set! sv-72 (new 'stack-no-clear 'vector)) - (dotimes (v1-3 3) - (set! (-> sv-64 data v1-3) (/ (- (-> arg1 data v1-3) (-> arg0 data v1-3)) (the float (-> arg2 v1-3)))) - ) - (set! (-> sv-68 x) (-> arg0 x)) - (set! (-> sv-72 x) (-> arg1 x)) - (dotimes (s2-0 (+ (-> arg2 1) 1)) - (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-0) (-> sv-64 y)))) - (set! (-> sv-72 y) (-> sv-68 y)) - (dotimes (s1-0 (+ (-> arg2 2) 1)) - (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s1-0) (-> sv-64 z)))) - (set! (-> sv-72 z) (-> sv-68 z)) - (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + (let ((sv-64 (new 'stack-no-clear 'vector)) + (sv-68 (new 'stack-no-clear 'vector)) + (sv-72 (new 'stack-no-clear 'vector)) + ) + (dotimes (v1-3 3) + (set! (-> sv-64 data v1-3) (/ (- (-> arg1 data v1-3) (-> arg0 data v1-3)) (the float (-> arg2 v1-3)))) ) - ) - (set! (-> sv-68 z) (-> arg0 z)) - (set! (-> sv-72 z) (-> arg1 z)) - (dotimes (s2-1 (+ (-> arg2 1) 1)) - (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-1) (-> sv-64 y)))) - (set! (-> sv-72 y) (-> sv-68 y)) - (dotimes (s1-1 (+ (-> arg2 0) 1)) - (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s1-1) (-> sv-64 x)))) + (set! (-> sv-68 x) (-> arg0 x)) + (set! (-> sv-72 x) (-> arg1 x)) + (dotimes (s2-0 (+ (-> arg2 1) 1)) + (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-0) (-> sv-64 y)))) + (set! (-> sv-72 y) (-> sv-68 y)) + (dotimes (s1-0 (+ (-> arg2 2) 1)) + (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s1-0) (-> sv-64 z)))) + (set! (-> sv-72 z) (-> sv-68 z)) + (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) + ) + (set! (-> sv-68 z) (-> arg0 z)) + (set! (-> sv-72 z) (-> arg1 z)) + (dotimes (s2-1 (+ (-> arg2 1) 1)) + (set! (-> sv-68 y) (+ (-> arg0 y) (* (the float s2-1) (-> sv-64 y)))) + (set! (-> sv-72 y) (-> sv-68 y)) + (dotimes (s1-1 (+ (-> arg2 0) 1)) + (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s1-1) (-> sv-64 x)))) + (set! (-> sv-72 x) (-> sv-68 x)) + (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) + ) + (set! (-> sv-68 y) (-> arg0 y)) + (set! (-> sv-72 y) (-> arg1 y)) + (dotimes (s3-1 (+ (-> arg2 0) 1)) + (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s3-1) (-> sv-64 x)))) (set! (-> sv-72 x) (-> sv-68 x)) - (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) - ) - ) - (set! (-> sv-68 y) (-> arg0 y)) - (set! (-> sv-72 y) (-> arg1 y)) - (dotimes (s3-1 (+ (-> arg2 0) 1)) - (set! (-> sv-68 x) (+ (-> arg0 x) (* (the float s3-1) (-> sv-64 x)))) - (set! (-> sv-72 x) (-> sv-68 x)) - (dotimes (s2-2 (+ (-> arg2 2) 1)) - (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s2-2) (-> sv-64 z)))) - (set! (-> sv-72 z) (-> sv-68 z)) - (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + (dotimes (s2-2 (+ (-> arg2 2) 1)) + (set! (-> sv-68 z) (+ (-> arg0 z) (* (the float s2-2) (-> sv-64 z)))) + (set! (-> sv-72 z) (-> sv-68 z)) + (add-debug-line #t (bucket-id debug2) sv-68 sv-72 arg3 #f (the-as rgba -1)) + ) ) ) 0 diff --git a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc index 888f0fab06..f2f775753a 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc @@ -811,10 +811,6 @@ (target-board-handler proc argc message block) ) :enter (behavior ((arg0 meters) (arg1 meters) (arg2 symbol)) - (local-vars - (sv-144 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-160 entity-actor) - ) (if (= arg2 'hit) (set! arg2 #f) ) @@ -845,36 +841,19 @@ (set! (-> s3-2 quad) (-> self control trans quad)) (+! (-> s3-2 y) 2048.0) (part-tracker-spawn :to self :group group-board-quick-jump :mat-joint s3-2) - (let* ((s1-1 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 - (when s1-1 - (let ((t9-8 (method-of-type manipy activate))) - (t9-8 (the-as manipy s1-1) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-1 s1-1) - ) - (set! sv-144 manipy-init) - (set! sv-160 (-> self entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-1 #f) - (t2-1 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-1 - sv-144 - s3-2 - sv-160 - t0-2 - t1-1 - t2-1 - ) - ) - ) - (-> s1-1 ppointer) - ) - ) - ) + (let ((s2-2 + (process-spawn + manipy + :init manipy-init + s3-2 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (when s2-2 (quaternion-copy! (-> (the-as board (-> s2-2 0)) root quat) (-> self control quat-for-control)) (send-event (ppointer->process s2-2) 'anim-mode 'play1) diff --git a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc index 77c3227c58..ba736fcc7f 100644 --- a/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/target-board_REF.gc @@ -1990,7 +1990,6 @@ ;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. ;; INFO: Used lq/sq (defbehavior target-board-compute-edge target () - (local-vars (sv-768 int)) (let ((s4-0 *edge-grab-info*) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -2204,8 +2203,8 @@ ) (s3-8 (new 'stack-no-clear 'collide-query)) (f26-1 81920.0) + (sv-768 8) ) - (set! sv-768 8) (let ((v1-234 s3-8)) (set! (-> v1-234 radius) 1228.8) (set! (-> v1-234 collide-with) diff --git a/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc b/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc index 3c97778190..60ef863aca 100644 --- a/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/collide-reaction-target_REF.gc @@ -17,31 +17,32 @@ ;; WARN: Stack slot offset 48 signed mismatch (defun poly-find-nearest-edge ((arg0 nav-poly) (arg1 (inline-array vector)) (arg2 vector) (arg3 vector)) "TODO- Not 100% sure here, but unused" - (local-vars (sv-32 vector) (sv-36 float) (sv-40 int) (sv-48 float) (sv-80 vector)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 (the-as float 4095996000.0)) - (set! sv-40 -1) - (set! sv-48 (the-as float 0.0)) - (dotimes (s2-0 3) - (let ((s0-0 (-> arg1 s2-0))) - (set! sv-80 (-> arg1 (mod (+ s2-0 1) 3))) - (let ((f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) - (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) - ) - 0.0 - (vector-normalize! s1-1 1.0) - (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) - (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) - (set! sv-36 f30-0) - (set! sv-40 s2-0) - (set! sv-48 f0-5) + (let ((sv-32 (new 'stack-no-clear 'vector)) + (sv-36 (the-as float 4095996000.0)) + (sv-40 -1) + ) + (let ((sv-48 (the-as float 0.0))) + (dotimes (s2-0 3) + (let* ((s0-0 (-> arg1 s2-0)) + (sv-80 (-> arg1 (mod (+ s2-0 1) 3))) + (f30-0 (vector-line-distance-point! arg2 s0-0 sv-80 sv-32)) + (s1-1 (vector-! (new 'stack-no-clear 'vector) sv-80 s0-0)) + ) + 0.0 + (vector-normalize! s1-1 1.0) + (let ((f0-5 (fabs (vector-dot arg3 s1-1)))) + (when (or (< f30-0 sv-36) (and (= f30-0 sv-36) (< sv-48 f0-5))) + (set! sv-36 f30-0) + (set! sv-40 s2-0) + (set! sv-48 f0-5) + ) ) ) ) ) + (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) + (set! (-> arg0 vertex1 quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) ) - (set! (-> arg0 vertex 0 quad) (-> arg1 sv-40 quad)) - (set! (-> arg0 vertex1 quad) (-> arg1 (mod (+ sv-40 1) 3) quad)) arg0 ) @@ -55,158 +56,152 @@ (arg4 (pointer collide-status)) (arg5 (pointer symbol)) ) - (local-vars - (contact-normal vector) - (sv-20 (pointer cshape-reaction-flags)) - (sv-24 (pointer collide-status)) - (sv-28 (pointer symbol)) - (sv-32 cshape-reaction-flags) - (sv-40 collide-status) - (sv-48 symbol) - (tangent vector) - (overhang-nrm vector) - ) - (set! contact-normal arg2) - (set! sv-20 arg3) - (set! sv-24 arg4) - (set! sv-28 arg5) - (set! sv-32 (-> arg3 0)) - (set! sv-40 (-> arg4 0)) - (set! sv-48 (-> arg5 0)) - (set! tangent (-> arg0 low-coverage-tangent)) - (set! overhang-nrm - (vector-cross! (-> arg0 low-coverage-overhang-plane-normal) (-> arg0 poly-normal) contact-normal) + (let ((contact-normal arg2) + (sv-20 arg3) + (sv-24 arg4) + (sv-28 arg5) + (sv-32 (-> arg3 0)) + (sv-40 (-> arg4 0)) + (sv-48 (-> arg5 0)) ) - (vector-normalize! overhang-nrm 1.0) - (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) overhang-nrm)) 0.866) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf09))) - ) - (vector-cross! tangent contact-normal overhang-nrm) - (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) tangent)) - (vector-negate! tangent tangent) - ) - (vector-normalize! tangent 1.0) - (let ((s4-0 (new 'stack-no-clear 'collide-query))) - (let ((s3-0 (vector-flatten! (-> arg0 low-coverage-tangent-xz) tangent (-> arg0 dynam gravity-normal)))) - (let ((v1-19 s4-0)) - (set! (-> v1-19 radius) 409.6) - (set! (-> v1-19 collide-with) (-> arg1 best-my-prim prim-core collide-with)) - (set! (-> v1-19 ignore-process0) #f) - (set! (-> v1-19 ignore-process1) #f) - (set! (-> v1-19 ignore-pat) (-> arg0 pat-ignore-mask)) - (set! (-> v1-19 action-mask) (collide-action solid)) - ) - (vector-normalize! s3-0 1.0) - (if (< (vector-dot s3-0 contact-normal) 0.0) - (vector-negate! s3-0 s3-0) - ) - (set! (-> arg0 low-coverage-slope-to-next1) 4095996000.0) - (set! (-> arg0 low-coverage-dist-to-next2) 4095996000.0) - (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) s3-0 2867.2) - (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) - (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 4096.0) - (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) - (set! (-> arg0 low-coverage-slope-to-next1) - (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> s4-0 best-other-tri intersect)) - ) + (let ((tangent (-> arg0 low-coverage-tangent))) + (let ((overhang-nrm + (vector-cross! (-> arg0 low-coverage-overhang-plane-normal) (-> arg0 poly-normal) contact-normal) ) - (set! (-> arg0 low-coverage-pat-next1) (-> s4-0 best-other-tri pat)) - (set! (-> arg0 low-coverage-norm-of-next1 quad) (-> s4-0 best-other-tri normal quad)) - 0 - ) - (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) (-> arg0 dynam gravity-normal) 819.2) - (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) - (vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) s3-0 -819.2) - (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 -4096.0) - ) - (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) - (set! (-> arg0 low-coverage-dist-to-next2) - (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) ) - (set! (-> arg0 low-coverage-pat-next2) (-> s4-0 best-other-tri pat)) - (set! (-> arg0 low-coverage-norm-of-next2 quad) (-> s4-0 best-other-tri normal quad)) - 0 - ) - ) - (when (and (not (logtest? sv-32 (cshape-reaction-flags csrf09))) - (and (or (< (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) - (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode wall)) - ) - (and (< (-> arg0 low-coverage-dist-to-next2) (* 2.0 (-> arg1 best-my-prim local-sphere w))) - (or (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode ground)) - (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode halfpipe)) + (vector-normalize! overhang-nrm 1.0) + (if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) overhang-nrm)) 0.866) + (logior! sv-32 (cshape-reaction-flags csrf09)) + ) + (vector-cross! tangent contact-normal overhang-nrm) + ) + (if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) tangent)) + (vector-negate! tangent tangent) + ) + (vector-normalize! tangent 1.0) + (let ((s4-0 (new 'stack-no-clear 'collide-query))) + (let ((s3-0 (vector-flatten! (-> arg0 low-coverage-tangent-xz) tangent (-> arg0 dynam gravity-normal)))) + (let ((v1-19 s4-0)) + (set! (-> v1-19 radius) 409.6) + (set! (-> v1-19 collide-with) (-> arg1 best-my-prim prim-core collide-with)) + (set! (-> v1-19 ignore-process0) #f) + (set! (-> v1-19 ignore-process1) #f) + (set! (-> v1-19 ignore-pat) (-> arg0 pat-ignore-mask)) + (set! (-> v1-19 action-mask) (collide-action solid)) + ) + (vector-normalize! s3-0 1.0) + (if (< (vector-dot s3-0 contact-normal) 0.0) + (vector-negate! s3-0 s3-0) + ) + (set! (-> arg0 low-coverage-slope-to-next1) 4095996000.0) + (set! (-> arg0 low-coverage-dist-to-next2) 4095996000.0) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) s3-0 2867.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 4096.0) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 low-coverage-slope-to-next1) + (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> s4-0 best-other-tri intersect)) + ) + ) + (set! (-> arg0 low-coverage-pat-next1) (-> s4-0 best-other-tri pat)) + (set! (-> arg0 low-coverage-norm-of-next1 quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + (vector+float*! (-> s4-0 start-pos) (-> arg1 best-other-tri intersect) (-> arg0 dynam gravity-normal) 819.2) + (vector-normalize-copy! (-> s4-0 move-dist) (-> arg0 dynam gravity-normal) -20480.0) + (vector+float*! (-> s4-0 start-pos) (-> s4-0 start-pos) s3-0 -819.2) + (vector+float*! (-> s4-0 move-dist) (-> s4-0 move-dist) s3-0 -4096.0) + ) + (when (>= (probe-using-line-sphere *collide-cache* s4-0) 0.0) + (set! (-> arg0 low-coverage-dist-to-next2) + (vector-vector-distance (-> s4-0 start-pos) (-> s4-0 best-other-tri intersect)) + ) + (set! (-> arg0 low-coverage-pat-next2) (-> s4-0 best-other-tri pat)) + (set! (-> arg0 low-coverage-norm-of-next2 quad) (-> s4-0 best-other-tri normal quad)) + 0 + ) + ) + (when (and (not (logtest? sv-32 (cshape-reaction-flags csrf09))) + (and (or (< (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) + (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode wall)) + ) + (and (< (-> arg0 low-coverage-dist-to-next2) (* 2.0 (-> arg1 best-my-prim local-sphere w))) + (or (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode ground)) + (= (-> arg0 low-coverage-pat-next2 mode) (pat-mode halfpipe)) + ) ) + ) + ) + (logior! sv-32 (cshape-reaction-flags csrf07)) + (set-time! (-> arg0 time-of-last-lc-touch-edge)) + (logior! sv-40 (collide-status touch-edge)) + (set-time! (-> arg0 time-of-last-lc)) + (let ((f30-0 (vector-dot tangent (-> arg0 turn-to-target))) + (f0-27 (if (logtest? sv-32 (cshape-reaction-flags csrf01)) + (cos (- 16384.0 (acos (-> arg0 coverage)))) + (-> arg0 coverage) + ) + ) + (f1-11 (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-other-tri intersect)) + ) + ) + ) + (if (or (not (logtest? sv-32 (cshape-reaction-flags csrf05))) (< 0.5 f0-27)) + (set! sv-48 (the-as symbol #f)) + ) + (when (and (or (and (< f0-27 0.95) (>= f30-0 0.0)) + (and (logtest? sv-32 (cshape-reaction-flags csrf05)) (< f0-27 0.3)) + (< f1-11 (/ (-> arg1 best-my-prim local-sphere w) -4)) + ) + (>= (vector-dot tangent contact-normal) -0.000001) + ) + (set! (-> arg0 surf) *edge-surface*) + (logior! sv-32 (cshape-reaction-flags csrf10)) + (set! sv-48 (the-as symbol #f)) + (when (logtest? sv-32 (cshape-reaction-flags csrf05)) + (set! sv-48 #t) + (logior! sv-32 (cshape-reaction-flags csrf12)) + ) + ) + ) + ) + ) + (if (< (-> arg0 surface-angle) 0.0) + (set! sv-48 #t) + ) + (when sv-48 + (cond + ((and (or (or (= (-> arg0 poly-pat mode) (pat-mode ground)) (= (-> arg0 poly-pat mode) (pat-mode halfpipe))) + (and (logtest? sv-32 (cshape-reaction-flags csrf03)) + (>= (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) + (or (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode ground)) + (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode halfpipe)) + ) + (< 0.3 (fabs (-> arg0 surface-angle))) ) ) - ) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf07))) - (set-time! (-> arg0 time-of-last-lc-touch-edge)) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set-time! (-> arg0 time-of-last-lc)) - (let ((f30-0 (vector-dot tangent (-> arg0 turn-to-target))) - (f0-27 (if (logtest? sv-32 (cshape-reaction-flags csrf01)) - (cos (- 16384.0 (acos (-> arg0 coverage)))) - (-> arg0 coverage) - ) - ) - (f1-11 (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-other-tri intersect)) - ) - ) - ) - (if (or (not (logtest? sv-32 (cshape-reaction-flags csrf05))) (< 0.5 f0-27)) - (set! sv-48 (the-as symbol #f)) - ) - (when (and (or (and (< f0-27 0.95) (>= f30-0 0.0)) - (and (logtest? sv-32 (cshape-reaction-flags csrf05)) (< f0-27 0.3)) - (< f1-11 (/ (-> arg1 best-my-prim local-sphere w) -4)) - ) - (>= (vector-dot tangent contact-normal) -0.000001) - ) - (set! (-> arg0 surf) *edge-surface*) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf10))) - (set! sv-48 (the-as symbol #f)) - (when (logtest? sv-32 (cshape-reaction-flags csrf05)) - (set! sv-48 #t) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf12))) + (not (logtest? sv-32 (cshape-reaction-flags csrf07))) + ) + (logior! sv-32 (cshape-reaction-flags csrf06)) + (logior! sv-40 (collide-status touch-edge)) + (set-time! (-> arg0 time-of-last-lc)) + (set! sv-48 (the-as symbol #f)) + ) + (#t + (logior! sv-32 (cshape-reaction-flags csrf06)) + (logior! sv-40 (collide-status touch-edge)) + (set-time! (-> arg0 time-of-last-lc)) ) ) ) + (set! (-> sv-24 0) sv-40) + (set! (-> sv-20 0) sv-32) + (set! (-> sv-28 0) sv-48) ) - (if (< (-> arg0 surface-angle) 0.0) - (set! sv-48 #t) - ) - (when sv-48 - (cond - ((and (or (or (= (-> arg0 poly-pat mode) (pat-mode ground)) (= (-> arg0 poly-pat mode) (pat-mode halfpipe))) - (and (logtest? sv-32 (cshape-reaction-flags csrf03)) - (>= (* 1.25 (-> arg1 best-my-prim local-sphere w)) (-> arg0 low-coverage-slope-to-next1)) - (or (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode ground)) - (= (-> arg0 low-coverage-pat-next1 mode) (pat-mode halfpipe)) - ) - (< 0.3 (fabs (-> arg0 surface-angle))) - ) - ) - (not (logtest? sv-32 (cshape-reaction-flags csrf07))) - ) - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf06))) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set-time! (-> arg0 time-of-last-lc)) - (set! sv-48 (the-as symbol #f)) - ) - (#t - (set! sv-32 (logior sv-32 (cshape-reaction-flags csrf06))) - (set! sv-40 (logior sv-40 (collide-status touch-edge))) - (set-time! (-> arg0 time-of-last-lc)) - ) - ) - ) - (set! (-> sv-24 0) sv-40) - (set! (-> sv-20 0) sv-32) - (set! (-> sv-28 0) sv-48) 0 (none) ) @@ -214,291 +209,286 @@ ;; definition for function target-collision-reaction ;; INFO: Used lq/sq (defbehavior target-collision-reaction target ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) - (local-vars - (sv-80 vector) - (sv-84 vector) - (sv-88 matrix) - (sv-96 collide-status) - (sv-104 cshape-reaction-flags) - (sv-240 symbol) - ) - (set! sv-80 (new-stack-vector0)) - (set! sv-84 (new-stack-vector0)) - (let ((v1-2 (new 'stack-no-clear 'matrix))) + (let ((sv-80 (new-stack-vector0)) + (sv-84 (new-stack-vector0)) + (v1-2 (new 'stack-no-clear 'matrix)) + ) (dotimes (a0-1 2) (set! (-> v1-2 quad a0-1) (the-as uint128 0)) ) - (set! sv-88 v1-2) - ) - (set! sv-96 (collide-status)) - (set! sv-104 (cshape-reaction-flags)) - (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) - (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (vector-float*! a1-3 (-> arg1 move-dist) (-> arg1 best-dist)) - (move-by-vector! arg0 a1-3) - ) - (set! sv-104 (logior sv-104 (react-to-pat! arg0 (-> arg1 best-other-tri pat)))) - (if (= (-> arg0 poly-pat mode) (pat-mode wall)) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf00))) - ) - (if (logtest? (-> arg0 mod-surface flags) (surface-flag air)) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf05))) - ) - (let ((v1-24 (new 'stack-no-clear 'vector))) - (set! (-> v1-24 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) - (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) - ) - (vector-normalize! sv-80 1.0) - (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-other-tri normal))) - (when (< (-> arg0 coverage) 0.0) - (set! (-> arg0 coverage) 0.0) - (vector-flatten! sv-80 sv-80 (-> arg1 best-other-tri normal)) - (vector-normalize! sv-80 1.0) - ) - (if (< (-> arg0 coverage) 0.9999) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf03 csrf04))) - ) - (let ((v1-35 (-> sv-80 quad))) - (set! (-> sv-84 quad) v1-35) - ) - (if (= (-> arg1 best-dist) 0.0) - (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) - ) - (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) - (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0)) - (if (< (-> arg0 poly-angle) -0.2) - (set! sv-96 (logior sv-96 (collide-status touch-ceiling))) - ) - (if (< (-> arg0 poly-angle) 0.0) - (set! sv-96 (logior sv-96 (collide-status touch-ceiling-sticky))) - ) - (if (!= (-> arg1 best-my-prim prim-id) 6) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf15))) - ) - (if (and (= (-> arg0 cur-pat mode) (pat-mode halfpipe)) (< (-> arg0 poly-angle) 0.75)) - (send-event (-> arg0 process) 'slide) - ) - (set! sv-240 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))) - (if (and sv-240 (and (= (-> arg0 mod-surface mode) 'dive) (< 0.4 (fabs (-> arg0 surface-angle))))) - (set! sv-240 (the-as symbol #f)) - ) - (if (and (logtest? sv-104 (cshape-reaction-flags csrf15)) - (logtest? sv-104 (cshape-reaction-flags csrf05)) - (>= (-> arg0 poly-angle) 0.0) - (not sv-240) - ) - (set! sv-240 #t) - ) - (if sv-240 - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf01))) - ) - (if (logtest? sv-104 (cshape-reaction-flags csrf03)) - (target-collision-low-coverage arg0 arg1 sv-84 (& sv-104) (& sv-96) (& sv-240)) - ) - (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) - (set! (-> arg0 transv-on-last-impact quad) (-> arg0 transv quad)) - (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) - (set! (-> arg0 normal-impact-vel) (- (vector-dot (-> arg0 transv) sv-84))) - (set! sv-96 (logior sv-96 (collide-status impact-surface))) - (if (nonzero? (-> arg0 current-surface impact-hook)) - ((-> arg0 current-surface impact-hook) arg0 (&-> sv-88 vector 0 x) sv-84) - ) - (when (not sv-240) - (let ((f0-21 (- 1.0 (-> arg0 current-surface impact-fric)))) - (when (< f0-21 1.0) - (let ((v1-113 (new-stack-vector0)) - (f1-13 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))) - ) - 0.0 - (vector-! v1-113 (-> sv-88 vector 0) (vector-float*! v1-113 (-> arg0 dynam gravity-normal) f1-13)) - (let* ((f2-2 (vector-length v1-113)) - (f3-0 f2-2) - ) - (if (< f1-13 0.0) - (set! f1-13 (* f1-13 f0-21)) - ) - (vector+! - (-> sv-88 vector 0) - (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f1-13) - (vector-float*! v1-113 v1-113 (/ f2-2 f3-0)) - ) - ) + (let ((sv-88 v1-2) + (sv-96 (collide-status)) + ) + (let ((sv-104 (cshape-reaction-flags))) + (set! (-> sv-88 vector 0 quad) (-> arg3 quad)) + (set! (-> sv-88 vector 1 quad) (-> arg3 quad)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (vector-float*! a1-3 (-> arg1 move-dist) (-> arg1 best-dist)) + (move-by-vector! arg0 a1-3) + ) + (logior! sv-104 (react-to-pat! arg0 (-> arg1 best-other-tri pat))) + (if (= (-> arg0 poly-pat mode) (pat-mode wall)) + (logior! sv-104 (cshape-reaction-flags csrf00)) ) + (if (logtest? (-> arg0 mod-surface flags) (surface-flag air)) + (logior! sv-104 (cshape-reaction-flags csrf05)) + ) + (let ((v1-24 (new 'stack-no-clear 'vector))) + (set! (-> v1-24 quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (vector-! sv-80 v1-24 (-> arg1 best-other-tri intersect)) ) - ) - ) - ) - (set! sv-96 (logior sv-96 (collide-status touch-surface))) - (cond - ((-> arg1 num-spheres) - (set! sv-96 (logior sv-96 (collide-status touch-actor))) - (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> arg0 actor-contact-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 actor-contact-handle) - (process->handle (-> (the-as collide-shape-prim (-> arg1 num-spheres)) cshape process)) - ) - ) - ((= (-> arg0 poly-pat material) (pat-material waterbottom)) - ) - (else - (set! sv-96 (logior sv-96 (collide-status touch-background))) - ) - ) - (cond - (sv-240 - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf02))) - (set! sv-96 (logior sv-96 (collide-status touch-wall))) - (set! (-> arg0 cur-pat mode) 1) - (set! (-> arg0 wall-contact-pt quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> arg0 wall-contact-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 wall-contact-normal quad) (-> sv-84 quad)) - (set! (-> arg0 wall-contact-pat) (-> arg1 best-other-tri pat)) - (cond - ((and (focus-test? (the-as process-focusable (-> arg0 process)) mech) - (logtest? sv-104 (cshape-reaction-flags csrf15)) - (logtest? sv-104 (cshape-reaction-flags csrf05)) - (< 0.0 (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (< 0.0 (vector-dot (-> sv-88 vector 0) (-> arg0 dynam gravity-normal))) + (vector-normalize! sv-80 1.0) + (set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-other-tri normal))) + (when (< (-> arg0 coverage) 0.0) + (set! (-> arg0 coverage) 0.0) + (vector-flatten! sv-80 sv-80 (-> arg1 best-other-tri normal)) + (vector-normalize! sv-80 1.0) + ) + (if (< (-> arg0 coverage) 0.9999) + (logior! sv-104 (cshape-reaction-flags csrf03 csrf04)) + ) + (set! (-> sv-84 quad) (-> sv-80 quad)) + (if (= (-> arg1 best-dist) 0.0) + (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)) + ) + (set! (-> arg0 poly-normal quad) (-> arg1 best-other-tri normal quad)) + (collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0)) + (if (< (-> arg0 poly-angle) -0.2) + (logior! sv-96 (collide-status touch-ceiling)) + ) + (if (< (-> arg0 poly-angle) 0.0) + (logior! sv-96 (collide-status touch-ceiling-sticky)) + ) + (if (!= (-> arg1 best-my-prim prim-id) 6) + (logior! sv-104 (cshape-reaction-flags csrf15)) + ) + (if (and (= (-> arg0 cur-pat mode) (pat-mode halfpipe)) (< (-> arg0 poly-angle) 0.75)) + (send-event (-> arg0 process) 'slide) + ) + (let ((sv-240 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))) + (if (and sv-240 (and (= (-> arg0 mod-surface mode) 'dive) (< 0.4 (fabs (-> arg0 surface-angle))))) + (set! sv-240 (the-as symbol #f)) ) - (set! (-> arg0 surf) *edge-surface*) - (set! sv-104 (logior (cshape-reaction-flags csrf16) sv-104)) - (vector-flatten! arg2 (vector-negate! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal)) sv-84) - (vector-normalize! arg2 (vector-dot arg2 (-> sv-88 vector 0))) - ) - (else - (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) - ) - ) - (cond - ((and (or (and (>= (-> arg1 best-my-prim local-sphere w) - (vector-dot - (-> arg0 ground-poly-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) - ) + (if (and (logtest? sv-104 (cshape-reaction-flags csrf15)) + (logtest? sv-104 (cshape-reaction-flags csrf05)) + (>= (-> arg0 poly-angle) 0.0) + (not sv-240) + ) + (set! sv-240 #t) + ) + (if sv-240 + (logior! sv-104 (cshape-reaction-flags csrf01)) + ) + (if (logtest? sv-104 (cshape-reaction-flags csrf03)) + (target-collision-low-coverage arg0 arg1 sv-84 (& sv-104) (& sv-96) (& sv-240)) + ) + (when (not (logtest? (-> arg0 prev-status) (collide-status on-surface))) + (set! (-> arg0 transv-on-last-impact quad) (-> arg0 transv quad)) + (set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))) + (set! (-> arg0 normal-impact-vel) (- (vector-dot (-> arg0 transv) sv-84))) + (logior! sv-96 (collide-status impact-surface)) + (if (nonzero? (-> arg0 current-surface impact-hook)) + ((-> arg0 current-surface impact-hook) arg0 (&-> sv-88 vector 0 x) sv-84) + ) + (when (not sv-240) + (let ((f0-21 (- 1.0 (-> arg0 current-surface impact-fric)))) + (when (< f0-21 1.0) + (let ((v1-113 (new-stack-vector0)) + (f1-13 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))) + ) + 0.0 + (vector-! v1-113 (-> sv-88 vector 0) (vector-float*! v1-113 (-> arg0 dynam gravity-normal) f1-13)) + (let* ((f2-2 (vector-length v1-113)) + (f3-0 f2-2) ) - (not (time-elapsed? (-> arg0 list-time-on-ground) (seconds 0.3))) - ) - (logtest? sv-104 (cshape-reaction-flags csrf15)) - ) - (>= (vector-dot - (-> arg0 dynam gravity-normal) - (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + (if (< f1-13 0.0) + (set! f1-13 (* f1-13 f0-21)) + ) + (vector+! + (-> sv-88 vector 0) + (vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f1-13) + (vector-float*! v1-113 v1-113 (/ f2-2 f3-0)) + ) + ) ) - 0.0 ) - (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) - (not (logtest? sv-104 (cshape-reaction-flags csrf05))) + ) + ) + ) + (logior! sv-96 (collide-status touch-surface)) + (cond + ((-> arg1 num-spheres) + (logior! sv-96 (collide-status touch-actor)) + (set! (-> arg0 actor-contact-pt quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 actor-contact-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 actor-contact-handle) + (process->handle (-> (the-as collide-shape-prim (-> arg1 num-spheres)) cshape process)) ) + ) + ((= (-> arg0 poly-pat material) (pat-material waterbottom)) + ) + (else + (logior! sv-96 (collide-status touch-background)) ) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf08))) - (set! sv-104 (logclear sv-104 (cshape-reaction-flags csrf06))) - (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) - (vector-normalize! s3-4 1.0) - (vector-float*! arg2 s3-4 (vector-dot (-> sv-88 vector 0) s3-4)) - ) - (vector+! arg2 arg2 (-> arg0 poly-normal)) - ) - (else - ) - ) - ) - (else - (set! sv-96 (logior sv-96 (collide-status on-surface))) - (set! (-> arg0 cur-pat mode) 0) - (if (= (-> arg1 best-my-prim prim-id) 6) - (set! (-> arg0 local-normal quad) (-> sv-84 quad)) - ) - (if (and (focus-test? (the-as process-focusable (-> arg0 process)) board) - (not (focus-test? (the-as process-focusable (-> arg0 process)) halfpipe)) - (!= (-> arg0 cur-pat mode) 3) - (!= (-> arg0 ground-pat mode) 3) - ) - (vector-reflect-flat-gravity! arg2 (-> sv-88 vector 0) sv-84 (-> arg0 dynam gravity-normal)) - (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) - ) - (vector+! arg2 arg2 sv-84) - (let ((f0-32 (-> arg0 current-surface slope-change-preserve))) - (when (< 0.0 f0-32) - (let ((v1-223 (new-stack-vector0))) - (let ((f1-25 (vector-dot (-> arg0 pre-collide-local-normal) (-> sv-88 vector 0)))) - 0.0 - (vector-! v1-223 (-> sv-88 vector 0) (vector-float*! v1-223 (-> arg0 pre-collide-local-normal) f1-25)) + ) + (cond + (sv-240 + (logior! sv-104 (cshape-reaction-flags csrf02)) + (logior! sv-96 (collide-status touch-wall)) + (set! (-> arg0 cur-pat mode) 1) + (set! (-> arg0 wall-contact-pt quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 wall-contact-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 wall-contact-normal quad) (-> sv-84 quad)) + (set! (-> arg0 wall-contact-pat) (-> arg1 best-other-tri pat)) + (cond + ((and (focus-test? (the-as process-focusable (-> arg0 process)) mech) + (logtest? sv-104 (cshape-reaction-flags csrf15)) + (logtest? sv-104 (cshape-reaction-flags csrf05)) + (< 0.0 (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (< 0.0 (vector-dot (-> sv-88 vector 0) (-> arg0 dynam gravity-normal))) + ) + (set! (-> arg0 surf) *edge-surface*) + (logior! sv-104 (cshape-reaction-flags csrf16)) + (vector-flatten! arg2 (vector-negate! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal)) sv-84) + (vector-normalize! arg2 (vector-dot arg2 (-> sv-88 vector 0))) + ) + (else + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + ) + ) + (cond + ((and (or (and (>= (-> arg1 best-my-prim local-sphere w) + (vector-dot + (-> arg0 ground-poly-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + ) + (not (time-elapsed? (-> arg0 list-time-on-ground) (seconds 0.3))) + ) + (logtest? sv-104 (cshape-reaction-flags csrf15)) + ) + (>= (vector-dot + (-> arg0 dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> arg1 best-other-tri intersect) (-> arg0 grount-touch-point)) + ) + 0.0 + ) + (and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2)) + (not (logtest? sv-104 (cshape-reaction-flags csrf05))) + ) + ) + (logior! sv-104 (cshape-reaction-flags csrf08)) + (logclear! sv-104 (cshape-reaction-flags csrf06)) + (let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal)))) + (vector-normalize! s3-4 1.0) + (vector-float*! arg2 s3-4 (vector-dot (-> sv-88 vector 0) s3-4)) + ) + (vector+! arg2 arg2 (-> arg0 poly-normal)) + ) + (else + ) + ) ) - (let ((f1-26 (vector-length v1-223))) - f1-26 - (let ((f1-27 f1-26) - (f2-5 (vector-length arg2)) + (else + (logior! sv-96 (collide-status on-surface)) + (set! (-> arg0 cur-pat mode) 0) + (if (= (-> arg1 best-my-prim prim-id) 6) + (set! (-> arg0 local-normal quad) (-> sv-84 quad)) + ) + (if (and (focus-test? (the-as process-focusable (-> arg0 process)) board) + (not (focus-test? (the-as process-focusable (-> arg0 process)) halfpipe)) + (!= (-> arg0 cur-pat mode) 3) + (!= (-> arg0 ground-pat mode) 3) + ) + (vector-reflect-flat-gravity! arg2 (-> sv-88 vector 0) sv-84 (-> arg0 dynam gravity-normal)) + (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84) + ) + (vector+! arg2 arg2 sv-84) + (let ((f0-32 (-> arg0 current-surface slope-change-preserve))) + (when (< 0.0 f0-32) + (let ((v1-223 (new-stack-vector0))) + (let ((f1-25 (vector-dot (-> arg0 pre-collide-local-normal) (-> sv-88 vector 0)))) + 0.0 + (vector-! v1-223 (-> sv-88 vector 0) (vector-float*! v1-223 (-> arg0 pre-collide-local-normal) f1-25)) + ) + (let ((f1-26 (vector-length v1-223))) + f1-26 + (let ((f1-27 f1-26) + (f2-5 (vector-length arg2)) + ) + (if (and (< 409.6 (fabs (- f2-5 f1-27))) (< f2-5 f1-27)) + (vector-normalize! arg2 (lerp-scale f2-5 f1-27 f0-32 0.0 1.0)) + ) + ) + ) ) - (if (and (< 409.6 (fabs (- f2-5 f1-27))) (< f2-5 f1-27)) - (vector-normalize! arg2 (lerp-scale f2-5 f1-27 f0-32 0.0 1.0)) + ) + ) + (set! (-> arg0 grount-touch-point w) 0.0) + (when (not (logtest? sv-104 (cshape-reaction-flags csrf00 csrf01 csrf02 csrf03 csrf14))) + (logior! sv-96 (collide-status on-ground)) + (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) + (set! (-> arg0 ground-contact-normal quad) (-> sv-84 quad)) + (set! (-> arg0 ground-local-norm-dot-grav) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) + (set-time! (-> arg0 list-time-on-ground)) + (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) + (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> arg0 ground-contact-sphere-center quad) (-> arg1 best-my-prim prim-core world-sphere quad)) + (logior! sv-104 (cshape-reaction-flags csrf11)) + (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) + (logior! sv-96 (collide-status on-water)) ) ) ) ) ) + (logior! (-> arg0 status) sv-96) + (set! (-> arg0 reaction-flag) sv-104) ) - (set! (-> arg0 grount-touch-point w) 0.0) - (when (not (logtest? sv-104 (cshape-reaction-flags csrf00 csrf01 csrf02 csrf03 csrf14))) - (set! sv-96 (logior sv-96 (collide-status on-ground))) - (set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad)) - (set! (-> arg0 ground-contact-normal quad) (-> sv-84 quad)) - (set! (-> arg0 ground-local-norm-dot-grav) (vector-dot sv-84 (-> arg0 dynam gravity-normal))) - (set-time! (-> arg0 list-time-on-ground)) - (set! (-> arg0 ground-pat) (-> arg0 poly-pat)) - (set! (-> arg0 grount-touch-point quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> arg0 ground-contact-sphere-center quad) (-> arg1 best-my-prim prim-core world-sphere quad)) - (set! sv-104 (logior sv-104 (cshape-reaction-flags csrf11))) - (if (= (-> arg0 poly-pat material) (pat-material waterbottom)) - (set! sv-96 (logior sv-96 (collide-status on-water))) - ) - ) - ) - ) - (logior! (-> arg0 status) sv-96) - (set! (-> arg0 reaction-flag) sv-104) - (when *debug-segment* - (+! (-> arg0 history-idx) 1) - (let ((v1-260 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) - ) - (set! (-> v1-260 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-260 vector quad) (-> arg0 surface-normal quad)) - ) - (let ((v1-263 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-263 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-263 vector quad) (-> arg0 local-normal quad)) - ) - (set! (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) - vector - quad + (when *debug-segment* + (+! (-> arg0 history-idx) 1) + (let ((v1-260 (clear-record-tags! *history* (history-channel surface-normal) (-> arg0 history-idx) (the-as uint 2))) ) - (-> arg1 best-other-tri intersect quad) + (set! (-> v1-260 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-260 vector quad) (-> arg0 surface-normal quad)) ) - (let ((v1-269 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-269 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-269 vector quad) (-> arg2 quad)) - ) - (let ((v1-272 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-272 origin quad) (-> arg1 best-other-tri intersect quad)) - (set! (-> v1-272 vector quad) (-> sv-88 vector 1 quad)) - ) - (let ((v1-275 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-275 origin quad) (-> arg0 trans quad)) - (set! (-> v1-275 vector quad) (-> arg0 transv quad)) - ) - (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector quad) - (-> arg0 trans quad) + (let ((v1-263 (clear-record-tags! *history* (history-channel local-normal) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-263 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-263 vector quad) (-> arg0 local-normal quad)) ) - (let ((v1-281 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) - (set! (-> v1-281 vector x) (the-as float (-> arg0 cur-pat))) - ) - (let ((v1-283 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) + (set! (-> (clear-record-tags! *history* (history-channel intersect) (-> arg0 history-idx) (the-as uint 2)) + vector + quad + ) + (-> arg1 best-other-tri intersect quad) + ) + (let ((v1-269 (clear-record-tags! *history* (history-channel transv-out) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-269 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-269 vector quad) (-> arg2 quad)) ) - (set! (-> v1-283 collide-status) (-> arg0 status)) - (set! (-> v1-283 vector z) (the-as float (-> arg0 reaction-flag))) + (let ((v1-272 (clear-record-tags! *history* (history-channel transv-in) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-272 origin quad) (-> arg1 best-other-tri intersect quad)) + (set! (-> v1-272 vector quad) (-> sv-88 vector 1 quad)) + ) + (let ((v1-275 (clear-record-tags! *history* (history-channel transv) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-275 origin quad) (-> arg0 trans quad)) + (set! (-> v1-275 vector quad) (-> arg0 transv quad)) + ) + (set! (-> (clear-record-tags! *history* (history-channel trans) (-> arg0 history-idx) (the-as uint 2)) vector quad) + (-> arg0 trans quad) + ) + (let ((v1-281 (clear-record-tags! *history* (history-channel pat) (-> arg0 history-idx) (the-as uint 2)))) + (set! (-> v1-281 vector x) (the-as float (-> arg0 cur-pat))) + ) + (let ((v1-283 (clear-record-tags! *history* (history-channel collide-status) (-> arg0 history-idx) (the-as uint 2))) + ) + (set! (-> v1-283 collide-status) (-> arg0 status)) + (set! (-> v1-283 vector z) (the-as float (-> arg0 reaction-flag))) + ) + ) + sv-96 ) ) - sv-96 ) ;; definition for function target-collision-no-reaction diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc index d90108581e..1eb4e68a9c 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-dark-shot_REF.gc @@ -406,89 +406,65 @@ (arg5 sparticle-launcher) (arg6 sparticle-launcher) ) - (local-vars (sv-16 process) (sv-32 matrix) (sv-48 process-focusable)) - (set! sv-48 arg0) - (let ((s0-0 arg1)) - (set! sv-32 arg2) - (let ((gp-0 arg4) - (s2-0 arg5) - (s3-0 arg6) - (s4-0 (get-trans sv-48 3)) - (s5-0 (get-trans s0-0 3)) - ) - (set! sv-16 (get-process *default-dead-pool* lightning-tracker #x4000)) - (let ((s1-0 (when sv-16 - (let ((t9-3 (method-of-type lightning-tracker activate))) - (t9-3 - (the-as lightning-tracker sv-16) - s0-0 - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((t9-4 run-function-in-process) - (a0-5 sv-16) - (a1-7 lightning-tracker-init) - (a3-2 0) - (t0-1 lightning-probe-callback) - (t2-1 256) - (t3-0 256) - ) - ((the-as (function object object object object object object object object none) t9-4) - a0-5 - a1-7 - sv-32 - a3-2 - t0-1 - sv-48 - t2-1 - t3-0 - ) - ) - (-> sv-16 ppointer) - ) + (let* ((sv-48 arg0) + (s0-0 arg1) + (sv-32 arg2) + (gp-0 arg4) + (s2-0 arg5) + (s3-0 arg6) + (s4-0 (get-trans sv-48 3)) + (s5-0 (get-trans s0-0 3)) + (sv-16 (get-process *default-dead-pool* lightning-tracker #x4000)) + (s1-0 (when sv-16 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-16) + s0-0 + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) ) + (run-now-in-process sv-16 lightning-tracker-init sv-32 0 lightning-probe-callback sv-48 256 256) + (-> sv-16 ppointer) + ) + ) + ) + (when s2-0 + (let ((t9-5 sp-launch-particles-var) + (a0-6 *sp-particle-system-2d*) + (a2-4 *launch-matrix*) ) - (when s2-0 - (let ((t9-5 sp-launch-particles-var) - (a0-6 *sp-particle-system-2d*) - (a2-4 *launch-matrix*) - ) - (set! (-> a2-4 trans quad) (-> s4-0 quad)) - (t9-5 a0-6 s2-0 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> a2-4 trans quad) (-> s4-0 quad)) + (t9-5 a0-6 s2-0 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (when s3-0 + (let ((t9-6 sp-launch-particles-var) + (a0-7 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) ) - ) - (when s3-0 - (let ((t9-6 sp-launch-particles-var) - (a0-7 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (set! (-> a2-5 trans quad) (-> s4-0 quad)) - (t9-6 a0-7 s3-0 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> a2-5 trans quad) (-> s4-0 quad)) + (t9-6 a0-7 s3-0 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (when (and gp-0 s1-0) + (let ((v1-15 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) + (if v1-15 + (set! (-> v1-15 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s1-0 0)) duration))) ) - ) - (when (and gp-0 s1-0) - (let ((v1-15 (get-field-spec-by-id gp-0 (sp-field-id spt-timer)))) - (if v1-15 - (set! (-> v1-15 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s1-0 0)) duration))) - ) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-12 *sp-particle-system-2d*) + (a1-15 gp-0) + (a2-6 *launch-matrix*) ) - (let ((t9-8 sp-launch-particles-var) - (a0-12 *sp-particle-system-2d*) - (a1-15 gp-0) - (a2-6 *launch-matrix*) - ) - (set! (-> a2-6 trans quad) (-> s4-0 quad)) - (t9-8 a0-12 a1-15 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (set! (-> a2-6 trans quad) (-> s4-0 quad)) + (t9-8 a0-12 a1-15 a2-6 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-9 sp-launch-particles-var) + (a0-13 *sp-particle-system-2d*) + (a2-7 *launch-matrix*) ) - (let ((t9-9 sp-launch-particles-var) - (a0-13 *sp-particle-system-2d*) - (a2-7 *launch-matrix*) - ) - (set! (-> a2-7 trans quad) (-> s5-0 quad)) - (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - ) + (set! (-> a2-7 trans quad) (-> s5-0 quad)) + (t9-9 a0-13 gp-0 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) ) ) @@ -581,14 +557,6 @@ (defstate impact (gun-dark-shot) :virtual #t :code (behavior () - (local-vars - (sv-256 collide-shape) - (sv-272 process-drawable) - (sv-288 vector) - (sv-304 process-drawable) - (sv-320 process-drawable) - (sv-336 process-drawable) - ) (if (not (time-elapsed? (-> self spawn-time) (seconds 0.1))) (send-event (ppointer->process (-> self parent)) 'release) ) @@ -657,13 +625,9 @@ (s5-1 #t) ) (countdown (s2-0 gp-2) - (set! sv-256 (-> s3-0 s2-0)) - (set! sv-272 (-> sv-256 process)) - (let ((s0-0 (if (type? sv-272 process-focusable) - sv-272 - ) - ) - ) + (let* ((sv-256 (-> s3-0 s2-0)) + (s0-0 (the-as process-drawable (as-type (-> sv-256 process) process-focusable))) + ) (cond ((and (nonzero? (-> sv-256 root-prim prim-core collide-as)) s0-0 @@ -671,23 +635,12 @@ (not (focus-test? (the-as process-focusable s0-0) disable dead ignore)) (not (logtest? (process-mask no-track) (-> s0-0 mask))) ) - (set! sv-288 (get-trans (the-as process-focusable s0-0) 3)) - (let ((f28-0 (- (vector-vector-distance (-> self root trans) sv-288) (-> sv-288 w)))) - (set! sv-304 s0-0) - (if (and (not (if (type? sv-304 crate) - sv-304 - ) - ) - (begin (set! sv-320 s0-0) (not (if (type? sv-320 market-object) - sv-320 - ) - ) - ) - (begin (set! sv-336 s0-0) (not (if (type? sv-336 fruit-stand) - sv-336 - ) - ) - ) + (let* ((sv-288 (get-trans (the-as process-focusable s0-0) 3)) + (f28-0 (- (vector-vector-distance (-> self root trans) sv-288) (-> sv-288 w))) + ) + (if (and (not (the-as process-drawable (as-type s0-0 crate))) + (not (the-as process-drawable (as-type s0-0 market-object))) + (not (the-as process-drawable (as-type s0-0 fruit-stand))) ) (set! s5-1 #f) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc index 21193e14d3..482e781ebe 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc @@ -280,14 +280,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-1 (+ (-> a1-5 world-sphere w) (-> s5-0 w))) - ) - (when (< f0-2 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-7)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-5 world-sphere w) (-> s5-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-7)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -321,14 +317,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-5 (+ (-> a1-17 world-sphere w) (-> s5-0 w))) - ) - (when (< f0-3 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-10)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-17 world-sphere w) (-> s5-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-10)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc index 03218ed4c9..8f8f37dcd0 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-yellow-shot_REF.gc @@ -133,7 +133,7 @@ ) (let ((f0-6 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) (when (< 0.0 f0-6) - (let ((f0-7 (* f0-6 f0-6)) + (let ((f0-7 (square f0-6)) (f30-2 (-> *part-id-table* 225 init-specs 8 initial-valuef)) (f28-2 (-> *part-id-table* 225 init-specs 8 random-rangef)) ) diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index 602edc51d0..6febccd945 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -119,72 +119,41 @@ ;; definition (debug) for function target-print-stats ;; INFO: Used lq/sq (defun-debug target-print-stats ((arg0 target) (arg1 symbol)) - (local-vars - (sv-64 int) - (sv-72 int) - (sv-80 art-joint-anim-manager) - (sv-96 string) - (sv-112 string) - (sv-128 string) - (sv-144 string) - (sv-160 string) - (sv-176 string) - (sv-192 string) - (sv-208 string) - (sv-224 string) - (sv-240 string) - (sv-256 string) - (sv-272 string) - (sv-288 string) - (sv-304 string) - ) (with-pp (let ((s5-0 pp)) (set! pp arg0) (when (and *display-ground-stats* arg0) - (let ((s3-0 format) - (s2-0 arg1) - (s1-0 "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%") - (s0-0 (-> arg0 control poly-pat)) - ) - (set! sv-96 (pat-mode->string (-> arg0 control poly-pat))) - (set! sv-112 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-0 (pat-event->string (-> arg0 control poly-pat)))) - (s3-0 s2-0 s1-0 s0-0 sv-96 sv-112 t1-0) - ) + (format + arg1 + "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control poly-pat) + (pat-mode->string (-> arg0 control poly-pat)) + (pat-material->string (-> arg0 control poly-pat)) + (pat-event->string (-> arg0 control poly-pat)) ) - (let ((s3-1 format) - (s2-1 arg1) - (s1-1 "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%") - (s0-1 (-> arg0 control ground-pat)) - ) - (set! sv-128 (pat-mode->string (-> arg0 control ground-pat))) - (set! sv-144 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-1 (pat-event->string (-> arg0 control ground-pat)))) - (s3-1 s2-1 s1-1 s0-1 sv-128 sv-144 t1-1) - ) + (format + arg1 + "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control ground-pat) + (pat-mode->string (-> arg0 control ground-pat)) + (pat-material->string (-> arg0 control ground-pat)) + (pat-event->string (-> arg0 control ground-pat)) ) - (let ((s3-2 format) - (s2-2 arg1) - (s1-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%") - (s0-2 (-> arg0 control wall-contact-pat)) - ) - (set! sv-160 (pat-mode->string (-> arg0 control wall-contact-pat))) - (set! sv-176 (pat-material->string (-> arg0 control wall-contact-pat))) - (let ((t1-2 (pat-event->string (-> arg0 control wall-contact-pat)))) - (s3-2 s2-2 s1-2 s0-2 sv-160 sv-176 t1-2) - ) + (format + arg1 + "~0kwall:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control wall-contact-pat) + (pat-mode->string (-> arg0 control wall-contact-pat)) + (pat-material->string (-> arg0 control wall-contact-pat)) + (pat-event->string (-> arg0 control wall-contact-pat)) ) - (let ((s3-3 format) - (s2-3 arg1) - (s1-3 "~0kgspt:~6X mode:~-8S material:~-10S event:~S~%") - (s0-3 (-> arg0 control gspot-pat-surfce)) - ) - (set! sv-192 (pat-mode->string (-> arg0 control gspot-pat-surfce))) - (set! sv-208 (pat-material->string (-> arg0 control gspot-pat-surfce))) - (let ((t1-3 (pat-event->string (-> arg0 control gspot-pat-surfce)))) - (s3-3 s2-3 s1-3 s0-3 sv-192 sv-208 t1-3) - ) + (format + arg1 + "~0kgspt:~6X mode:~-8S material:~-10S event:~S~%" + (-> arg0 control gspot-pat-surfce) + (pat-mode->string (-> arg0 control gspot-pat-surfce)) + (pat-material->string (-> arg0 control gspot-pat-surfce)) + (pat-event->string (-> arg0 control gspot-pat-surfce)) ) ) (when (and *stats-target* arg0) @@ -395,38 +364,29 @@ (let ((v1-160 (-> arg0 control trans))) (format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-160 x) (-> v1-160 y) (-> v1-160 z)) ) - (let ((s3-5 format) - (s2-4 arg1) - (s1-4 "~0kpol:~X/~S/~S/~S~%") - (s0-4 (-> arg0 control poly-pat)) - ) - (set! sv-224 (pat-mode->string (-> arg0 control poly-pat))) - (set! sv-240 (pat-material->string (-> arg0 control poly-pat))) - (let ((t1-10 (pat-event->string (-> arg0 control poly-pat)))) - (s3-5 s2-4 s1-4 s0-4 sv-224 sv-240 t1-10) - ) + (format + arg1 + "~0kpol:~X/~S/~S/~S~%" + (-> arg0 control poly-pat) + (pat-mode->string (-> arg0 control poly-pat)) + (pat-material->string (-> arg0 control poly-pat)) + (pat-event->string (-> arg0 control poly-pat)) ) - (let ((s3-6 format) - (s2-5 arg1) - (s1-5 "~0kcur:~X/~S/~S/~S ") - (s0-5 (-> arg0 control cur-pat)) - ) - (set! sv-256 (pat-mode->string (-> arg0 control cur-pat))) - (set! sv-272 (pat-material->string (-> arg0 control cur-pat))) - (let ((t1-11 (pat-event->string (-> arg0 control cur-pat)))) - (s3-6 s2-5 s1-5 s0-5 sv-256 sv-272 t1-11) - ) + (format + arg1 + "~0kcur:~X/~S/~S/~S " + (-> arg0 control cur-pat) + (pat-mode->string (-> arg0 control cur-pat)) + (pat-material->string (-> arg0 control cur-pat)) + (pat-event->string (-> arg0 control cur-pat)) ) - (let ((s3-7 format) - (s2-6 arg1) - (s1-6 "~0kgnd:~X/~S/~S/~S~%") - (s0-6 (-> arg0 control ground-pat)) - ) - (set! sv-288 (pat-mode->string (-> arg0 control ground-pat))) - (set! sv-304 (pat-material->string (-> arg0 control ground-pat))) - (let ((t1-12 (pat-event->string (-> arg0 control ground-pat)))) - (s3-7 s2-6 s1-6 s0-6 sv-288 sv-304 t1-12) - ) + (format + arg1 + "~0kgnd:~X/~S/~S/~S~%" + (-> arg0 control ground-pat) + (pat-mode->string (-> arg0 control ground-pat)) + (pat-material->string (-> arg0 control ground-pat)) + (pat-event->string (-> arg0 control ground-pat)) ) (let ((t9-74 format) (a0-129 arg1) @@ -477,22 +437,24 @@ (-> arg0 control bend-target) (-> arg0 control bend-speed) ) - (set! sv-64 0) - (set! sv-72 0) - (set! sv-80 *anim-manager*) - (countdown (s3-8 (-> sv-80 free-index)) - (when (= (-> sv-80 slot s3-8 time-stamp) (-> *display* base-clock frame-counter)) - (set! sv-72 (+ sv-72 1)) - (set! sv-64 (+ sv-64 (used-bytes-for-slot sv-80 s3-8))) + (let ((sv-64 0) + (sv-72 0) + (sv-80 *anim-manager*) + ) + (countdown (s3-8 (-> sv-80 free-index)) + (when (= (-> sv-80 slot s3-8 time-stamp) (-> *display* base-clock frame-counter)) + (+! sv-72 1) + (+! sv-64 (used-bytes-for-slot sv-80 s3-8)) + ) + ) + (format + arg1 + "anim cache ~d anims ~dK total, ~d ~dK active~%" + (-> sv-80 free-index) + (sar (&- (-> sv-80 kheap current) (the-as uint (-> sv-80 kheap base))) 10) + sv-72 + (sar sv-64 10) ) - ) - (format - arg1 - "anim cache ~d anims ~dK total, ~d ~dK active~%" - (-> sv-80 free-index) - (sar (&- (-> sv-80 kheap current) (the-as uint (-> sv-80 kheap base))) 10) - sv-72 - (sar sv-64 10) ) (debug-print-channels (-> arg0 skel) arg1) ) @@ -3091,7 +3053,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod init-target ((this target) (arg0 continue-point) (arg1 symbol)) - (local-vars (s1-0 int) (s2-0 int) (s3-0 int) (s4-0 int) (sv-16 collide-shape-prim-group)) + (local-vars (s1-0 int) (s2-0 int) (s3-0 int) (s4-0 int)) (set! (-> this tobot?) arg1) (set! (-> this tobot-recorder) #f) (set! (-> this mode-cache) #f) @@ -3125,13 +3087,14 @@ (set! (-> s0-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s0-0 reaction) target-collision-reaction) (set! (-> s0-0 no-reaction) target-collision-no-reaction) - (set! sv-16 (new 'process 'collide-shape-prim-group s0-0 (the-as uint 9) 1)) - (set! (-> s0-0 total-prims) (the-as uint 10)) - (set! (-> sv-16 prim-core action) (collide-action solid can-ride)) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 4096.0) - (set! (-> s0-0 root-prim) sv-16) - (set! (-> sv-16 prim-core collide-as) (the-as collide-spec s4-0)) - (set! (-> sv-16 prim-core collide-with) (the-as collide-spec s3-0)) + (let ((sv-16 (new 'process 'collide-shape-prim-group s0-0 (the-as uint 9) 1))) + (set! (-> s0-0 total-prims) (the-as uint 10)) + (set! (-> sv-16 prim-core action) (collide-action solid can-ride)) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s0-0 root-prim) sv-16) + (set! (-> sv-16 prim-core collide-as) (the-as collide-spec s4-0)) + (set! (-> sv-16 prim-core collide-with) (the-as collide-spec s3-0)) + ) (let ((v0-9 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 6)))) (set! (-> v0-9 prim-core action) (collide-action solid can-ride)) (set-vector! (-> v0-9 local-sphere) 0.0 0.0 0.0 4096.0) diff --git a/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc b/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc index b011dc3b0b..4b100f6dec 100644 --- a/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech/grunt-mech_REF.gc @@ -244,7 +244,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod grunt-mech-method-193 ((this grunt-mech)) - (local-vars (f0-3 float) (sv-592 vector)) + (local-vars (f0-3 float)) (let ((s4-0 *grunt-mech-info*)) (grunt-mech-info-method-10 s4-0) (let ((gp-0 -1)) @@ -254,25 +254,16 @@ (countdown (s2-0 4) (let ((s1-0 (-> s4-0 holds s2-0))) (when (grunt-mech-info-method-9 s4-0 s2-0 this #t) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-592 (new 'stack-no-clear 'vector)) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-592 (new 'stack-no-clear 'vector)) + ) (set! (-> s0-0 quad) (-> s1-0 world-mat vector 2 quad)) (set! (-> s0-0 y) 0.0) (vector-normalize! s0-0 1.0) (vector-! sv-592 (-> s1-0 world-mat trans) (-> this root trans)) (set! (-> sv-592 y) 0.0) (vector-normalize! sv-592 1.0) - (let ((f0-2 (-> sv-592 x)) - (f1-0 (-> sv-592 y)) - (f2-0 (-> sv-592 z)) - (f3-0 (-> s0-0 x)) - (f4-0 (-> s0-0 y)) - (f5-0 (-> s0-0 z)) - ) - (.mula.s f0-2 f3-0) - (.madda.s f1-0 f4-0) - (.madd.s f0-3 f2-0 f5-0) - ) + (set! f0-3 (vector-dot sv-592 s0-0)) ) (when (>= f0-3 0.0) (let ((f0-5 (vector-vector-distance-squared (-> s1-0 world-mat trans) s3-0))) @@ -349,10 +340,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let ((f0-0 v1-5) - (f1-0 28672.0) - ) - (when (>= (* f1-0 f1-0) f0-0) + (let ((f0-0 v1-5)) + (when (>= (square 28672.0) f0-0) (let ((a1-3 (grunt-mech-method-193 this))) (cond ((= a1-3 -1) @@ -483,22 +472,18 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-13 vf1) - (let ((f0-3 v1-13) - (f1-1 14336.0) - ) - (when (>= f0-3 (* f1-1 f1-1)) - (let ((a1-3 (new 'stack-no-clear 'vector))) - (set! (-> a1-3 quad) (-> s5-0 out-travel 0 quad)) - (set! (-> a1-3 w) (-> this nav-radius-backup)) - (when (not (add-root-sphere-to-hash! (-> this nav) a1-3 #x80068)) - (let ((s4-1 (new 'stack-no-clear 'vector))) - (vector+! s4-1 (-> this root trans) (-> s5-0 out-travel 0)) - (let ((s5-1 (new 'stack-no-clear 'collide-query))) - (when (enemy-above-ground? this s5-1 s4-1 (the-as collide-spec (-> this gnd-collide)) 4096.0 122880.0 1024.0) - (set! (-> s4-1 y) (-> s5-1 best-other-tri intersect y)) - (set! (-> this dismount-dest quad) (-> s4-1 quad)) - #t - ) + (when (>= v1-13 (square 14336.0)) + (let ((a1-3 (new 'stack-no-clear 'vector))) + (set! (-> a1-3 quad) (-> s5-0 out-travel 0 quad)) + (set! (-> a1-3 w) (-> this nav-radius-backup)) + (when (not (add-root-sphere-to-hash! (-> this nav) a1-3 #x80068)) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (vector+! s4-1 (-> this root trans) (-> s5-0 out-travel 0)) + (let ((s5-1 (new 'stack-no-clear 'collide-query))) + (when (enemy-above-ground? this s5-1 s4-1 (the-as collide-spec (-> this gnd-collide)) 4096.0 122880.0 1024.0) + (set! (-> s4-1 y) (-> s5-1 best-other-tri intersect y)) + (set! (-> this dismount-dest quad) (-> s4-1 quad)) + #t ) ) ) @@ -559,9 +544,7 @@ (label cfg-16) (let ((a0-15 (-> this root trans))) (if (or (>= 0.0 (- (-> a0-15 y) (-> this dismount-dest y))) - (let ((f0-4 40960.0)) - (< (* f0-4 f0-4) (vector-vector-xz-distance-squared a0-15 (-> this dismount-dest))) - ) + (< (square 40960.0) (vector-vector-xz-distance-squared a0-15 (-> this dismount-dest))) ) (return #t) ) diff --git a/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc b/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc index 5b73190dbe..880f622ade 100644 --- a/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc @@ -317,7 +317,6 @@ ;; definition for function target-mech-punch-pick ;; INFO: Used lq/sq (defbehavior target-mech-punch-pick target ((arg0 symbol)) - (local-vars (sv-64 float)) (combo-tracker-method-12 (-> self control unknown-combo-tracker00) *null-vector* @@ -340,28 +339,25 @@ ) (when a0-4 (let ((s3-0 (get-trans a0-4 3))) - (let ((s0-0 (-> self control)) - (s1-0 s3-0) - (s2-0 deg-diff) - ) - (set! sv-64 (y-angle s0-0)) - (let* ((a1-4 (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) - (f0-0 (s2-0 sv-64 a1-4)) + (let* ((s0-0 (-> self control)) + (s1-0 s3-0) + (f0-0 + (deg-diff (y-angle s0-0) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s0-0 trans)))) ) - (cond - ((< (+ 12288.0 (-> s4-0 y)) (-> s3-0 y)) - (set! (-> self mech walk-anim-leg) 3) ) - ((>= f0-0 5461.3335) - (set! (-> self mech walk-anim-leg) 0) - 0 - ) - ((>= -5461.3335 f0-0) - (set! (-> self mech walk-anim-leg) 1) - ) - (else - (set! (-> self mech walk-anim-leg) 2) - ) + (cond + ((< (+ 12288.0 (-> s4-0 y)) (-> s3-0 y)) + (set! (-> self mech walk-anim-leg) 3) + ) + ((>= f0-0 5461.3335) + (set! (-> self mech walk-anim-leg) 0) + 0 + ) + ((>= -5461.3335 f0-0) + (set! (-> self mech walk-anim-leg) 1) + ) + (else + (set! (-> self mech walk-anim-leg) 2) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc b/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc index 3472804086..902f36a5a8 100644 --- a/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/surface-h_REF.gc @@ -196,14 +196,14 @@ on impact, during touch, on exit, etc." ;; definition for function calc-terminal2-vel (defun calc-terminal2-vel ((arg0 float) (arg1 float) (arg2 float) (arg3 float)) (let ((f0-4 (sqrtf (/ (- (/ arg0 60) arg1) arg2)))) - (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4)))) + (- f0-4 (+ arg1 (* arg2 (square f0-4)))) ) ) ;; definition for function calc-terminal4-vel (defun calc-terminal4-vel ((arg0 float) (arg1 float) (arg2 float)) (let ((f0-5 (sqrtf (sqrtf (/ (- (/ arg0 60) arg1) arg2))))) - (- f0-5 (+ arg1 (* arg2 (* f0-5 f0-5 f0-5 f0-5)))) + (- f0-5 (+ arg1 (* arg2 (* (square f0-5) f0-5 f0-5)))) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc index 5ef8c403bc..9f60d762a6 100644 --- a/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc @@ -650,7 +650,6 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Return type mismatch symbol vs none. (defbehavior target-walk-anim target ((arg0 int)) - (local-vars (sv-16 float)) (let ((f24-0 0.0) (f26-0 (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control ctrl-xz-vel)))))) (f30-0 0.0) @@ -1002,18 +1001,19 @@ (let ((f20-0 (fmax -1.0 (fmin 1.0 (* 2.0 (-> self control local-slope-z))))) (f22-1 (fmax -1.0 (fmin 1.0 (* 1.6 (-> self control local-slope-x))))) ) - (set! sv-16 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control))))) - (set! f26-0 (seek - f26-0 - (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control ctrl-xz-vel))))) - (* 2.0 (seconds-per-frame)) - ) + (let ((sv-16 (fabs (deg-diff (quaternion-y-angle (-> self control dir-targ)) (y-angle (-> self control)))))) + (set! f26-0 (seek + f26-0 + (fmax 0.0 (fmin 1.0 (* 0.000048828126 (+ -16384.0 (-> self control ctrl-xz-vel))))) + (* 2.0 (seconds-per-frame)) + ) + ) + (if (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (set! f26-0 + (seek f26-0 (lerp-scale f26-0 (* 0.7 f26-0) sv-16 1820.4445 3640.889) (* 2.0 (seconds-per-frame))) + ) ) - (if (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (set! f26-0 - (seek f26-0 (lerp-scale f26-0 (* 0.7 f26-0) sv-16 1820.4445 3640.889) (* 2.0 (seconds-per-frame))) - ) - ) + ) (cond ((< 0.5 f26-0) (let ((v1-206 (-> self skel effect))) 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 75808831a9..4d5a85e9f3 100644 --- a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -590,16 +590,6 @@ ) :trans (-> target-running-attack trans) :code (behavior () - (local-vars - (sv-16 float) - (sv-20 float) - (sv-24 int) - (sv-32 int) - (sv-40 int) - (sv-48 float) - (sv-56 handle) - (sv-64 int) - ) (set-setting! 'rapid-tracking #f 0.0 0) ((lambda :behavior target () @@ -644,276 +634,278 @@ ) ) ) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 1.0) - (set! sv-24 0) - (set! sv-32 0) - (set! sv-40 0) - (set! sv-48 1.0) - (set! sv-56 (the-as handle #f)) - (set! sv-64 0) - (until (ja-done? 0) - (if (and (cpad-pressed? (-> self control cpad number) square) - (not (logtest? (-> self state-flags) (state-flags prevent-jump prevent-attack))) - (not (logtest? (-> self control current-surface flags) (surface-flag no-attack))) - (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage active)) - ) - (< sv-32 2) - ) - (set! sv-40 (the-as int (current-time))) + (let ((sv-16 (the-as float 0.0)) + (sv-20 1.0) + (sv-24 0) + (sv-32 0) + (sv-40 0) + (sv-48 1.0) + (sv-56 (the-as handle #f)) + (sv-64 0) ) - (when (time-elapsed? (the-as time-frame sv-40) (seconds 0.5)) - (set! sv-40 0) - 0 - ) - (if (and (nonzero? sv-40) - (< (- (the float (+ (-> (ja-group) frames num-frames) -1)) (/ 2.0 (-> (ja-group) artist-step))) - (ja-frame-num 0) - ) - ) - ((lambda :behavior target - ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) - (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 - (-> self control unknown-combo-tracker00) - (-> self control send-attack-dest) - (-> self control trans) - 24576.0 - (-> self control c-R-w vector 2) - 65536.0 - ) - ) - ) - ) - (when #t - (+! (-> arg1 0) 1) - (if s4-0 - (combo-tracker-method-12 - (-> self control unknown-combo-tracker00) - (-> self control trans) - (get-trans s4-0 3) - s4-0 - (current-time) - ) - ) - (target-start-attack) - (target-danger-set! 'punch #f) - (let ((v1-18 (ja-group))) - (cond - ((and v1-18 (or (= v1-18 jakb-darkjak-attack-combo1-ja) (= v1-18 jakb-darkjak-attack-combo1b-ja))) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-darkjak-attack-combo2-ja :num! (seek!)) + (until (ja-done? 0) + (if (and (cpad-pressed? (-> self control cpad number) square) + (not (logtest? (-> self state-flags) (state-flags prevent-jump prevent-attack))) + (not (logtest? (-> self control current-surface flags) (surface-flag no-attack))) + (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage active)) ) - (else - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-darkjak-attack-combo3c-ja :num! (seek!)) - ) - ) - ) - (initialize (-> self control impact-ctrl) self 22 3276.8 (-> self control root-prim prim-core collide-with)) - (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) + (< sv-32 2) ) - ) - (set! (-> arg2 0) (the-as uint 0)) - 0 - (none) - ) - (& sv-16) - (the-as (pointer uint64) (& sv-32)) - (the-as (pointer uint64) (& sv-40)) - ) - ) - (compute-alignment! (-> self align)) - (when (not (ja-min? 0)) - (cond - ((and (>= (ja-frame-num 0) 20.0) - (and (and (not (logtest? (-> self control status) (collide-status on-surface))) - (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *TARGET-bank* ground-timeout))) - (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) - ) - (time-elapsed? (-> self control sliding-start-time) (seconds 0.04)) - ) - ) - (go target-falling #f) - ) - ((and (nonzero? sv-32) - (>= sv-16 -40960.0) - (let ((v1-84 (ja-group))) - (not (and (and v1-84 (= v1-84 jakb-darkjak-attack-combo3-ja)) (>= (ja-aframe-num 0) 77.0))) - ) - (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo) - ) - (let ((gp-0 (the-as - process - (as-type (handle->process (-> self control unknown-combo-tracker00 target)) process-focusable) - ) - ) - ) - (let ((s5-1 (get-trans (the-as process-focusable gp-0) 3))) - (when (and (< 2048.0 (vector-vector-distance (-> self control trans) s5-1)) - (or (and (= gp-0 (handle->process sv-56)) (not (time-elapsed? (the-as time-frame sv-64) (seconds 0.1)))) - (time-elapsed? (the-as time-frame sv-64) (seconds 1)) - ) - ) - (forward-up-nopitch->quaternion - (-> self control dir-targ) - (vector-! (new 'stack-no-clear 'vector) s5-1 (-> self control trans)) - (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) - ) - (let ((v1-125 - (point-tracker-method-11 - (-> self control unknown-combo-tracker00) - (new 'stack-no-clear 'vector) - (-> self control trans) - s5-1 - (* 0.009107469 (the float (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)))) - ) - ) - ) - (set! sv-16 (fmin 163840.0 (sqrtf (+ (* (-> v1-125 x) (-> v1-125 x)) (* (-> v1-125 z) (-> v1-125 z)))))) - ) - (set-forward-vel sv-16) - ) - ) - (when (!= gp-0 (handle->process sv-56)) - (set! sv-56 (process->handle gp-0)) - (set! sv-64 (the-as int (current-time))) - ) - ) - ) - ((< sv-16 0.0) - (set! sv-16 (seek sv-16 -0.04096 (* 491520.0 (seconds-per-frame)))) - (set-forward-vel sv-16) - ) - ((and (nonzero? (-> self control unknown-time-frame18)) - (time-elapsed? (-> self control unknown-time-frame18) (seconds 0.04)) - ) - (set-forward-vel 0.0) - ) - ((and (not (cpad-hold? (-> self control cpad number) square)) - (zero? sv-32) - (time-elapsed? (-> self control unknown-combo-tracker00 move-start-time) (seconds 0.2)) - ) - (if (= (-> self control ground-pat material) (pat-material ice)) - (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) - (set-forward-vel (* 0.8 (-> self control ctrl-xz-vel))) - ) - ) - ((ja-done? 0) - (set-forward-vel sv-16) - ) - (else - (set! sv-16 - (* (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second) sv-20) - ) - (set-forward-vel sv-16) + (set! sv-40 (the-as int (current-time))) ) + (when (time-elapsed? (the-as time-frame sv-40) (seconds 0.5)) + (set! sv-40 0) + 0 ) - ) - (let ((gp-1 (new-stack-vector0))) - (vector-matrix*! gp-1 (-> self control transv) (-> self control w-R-c)) - (set! (-> gp-1 y) 0.0) - (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control c-R-w)) - ) - (when (!= (the-as float (-> self control unknown-word04)) 0.0) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (set! sv-16 (the-as float (-> self control unknown-word04))) - (set! (-> self control unknown-word04) (the-as uint 0.0)) - ) - (when (and (>= sv-16 0.0) - (let ((gp-2 (ja-group)) - (f30-2 (ja-aframe-num 0)) - ) - (if (or (and (= gp-2 jakb-darkjak-attack-combo1-ja) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo1b-ja) - (>= f30-2 11.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1b-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo2-ja) - (>= f30-2 49.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo2-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo3-ja) - (or (and (>= f30-2 62.0) (>= 77.0 f30-2)) - (and (>= f30-2 82.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) - ) - ) - (and (= gp-2 jakb-darkjak-attack-combo3c-ja) - (>= f30-2 62.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3c-ja) frames num-frames) -1)) - (ja-frame-num 0) - ) - ) + (if (and (nonzero? sv-40) + (< (- (the float (+ (-> (ja-group) frames num-frames) -1)) (/ 2.0 (-> (ja-group) artist-step))) + (ja-frame-num 0) + ) + ) + ((lambda :behavior target + ((arg0 (pointer float)) (arg1 (pointer uint64)) (arg2 (pointer uint64))) + (let ((s4-0 (the-as process-focusable (combo-tracker-method-13 + (-> self control unknown-combo-tracker00) + (-> self control send-attack-dest) + (-> self control trans) + 24576.0 + (-> self control c-R-w vector 2) + 65536.0 + ) + ) ) - #t + ) + (when #t + (+! (-> arg1 0) 1) + (if s4-0 + (combo-tracker-method-12 + (-> self control unknown-combo-tracker00) + (-> self control trans) + (get-trans s4-0 3) + s4-0 + (current-time) + ) ) + (target-start-attack) + (target-danger-set! 'punch #f) + (let ((v1-18 (ja-group))) + (cond + ((and v1-18 (or (= v1-18 jakb-darkjak-attack-combo1-ja) (= v1-18 jakb-darkjak-attack-combo1b-ja))) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-darkjak-attack-combo2-ja :num! (seek!)) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-darkjak-attack-combo3c-ja :num! (seek!)) + ) + ) + ) + (initialize (-> self control impact-ctrl) self 22 3276.8 (-> self control root-prim prim-core collide-with)) + (set! (-> arg0 0) (fmax 0.0 (-> arg0 0))) ) ) - (let ((gp-3 (new 'stack-no-clear 'collide-query))) - (when (and (>= (impact-control-method-11 - (-> self control impact-ctrl) - gp-3 - (the-as process #f) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) - ) - 0.0 - ) - (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control impact-ctrl dir))) - ) - (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) - (part-tracker-spawn :to self :group group-punch-hit :mat-joint (-> gp-3 best-other-tri intersect)) - (let ((imp-sound (static-sound-name "djak-punch-hit"))) - (play-effect-sound - (-> self skel effect) - 'punch - -1.0 - (-> self control impact-ctrl joint) - (the-as basic #f) - imp-sound + (set! (-> arg2 0) (the-as uint 0)) + 0 + (none) + ) + (& sv-16) + (the-as (pointer uint64) (& sv-32)) + (the-as (pointer uint64) (& sv-40)) + ) + ) + (compute-alignment! (-> self align)) + (when (not (ja-min? 0)) + (cond + ((and (>= (ja-frame-num 0) 20.0) + (and (and (not (logtest? (-> self control status) (collide-status on-surface))) + (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *TARGET-bank* ground-timeout))) + (>= 0.0 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (>= (target-height-above-ground) (-> *TARGET-bank* fall-height)) + ) + (time-elapsed? (-> self control sliding-start-time) (seconds 0.04)) + ) ) - ) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (set! sv-16 (the-as float -61440.0)) + (go target-falling #f) + ) + ((and (nonzero? sv-32) + (>= sv-16 -40960.0) + (let ((v1-84 (ja-group))) + (not (and (and v1-84 (= v1-84 jakb-darkjak-attack-combo3-ja)) (>= (ja-aframe-num 0) 77.0))) + ) + (send-event (handle->process (-> self control unknown-combo-tracker00 target)) 'combo) + ) + (let ((gp-0 (the-as + process + (as-type (handle->process (-> self control unknown-combo-tracker00 target)) process-focusable) + ) + ) + ) + (let ((s5-1 (get-trans (the-as process-focusable gp-0) 3))) + (when (and (< 2048.0 (vector-vector-distance (-> self control trans) s5-1)) + (or (and (= gp-0 (handle->process sv-56)) (not (time-elapsed? (the-as time-frame sv-64) (seconds 0.1)))) + (time-elapsed? (the-as time-frame sv-64) (seconds 1)) + ) + ) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) s5-1 (-> self control trans)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) + ) + (let ((v1-125 + (point-tracker-method-11 + (-> self control unknown-combo-tracker00) + (new 'stack-no-clear 'vector) + (-> self control trans) + s5-1 + (* 0.009107469 (the float (- (current-time) (-> self control unknown-combo-tracker00 move-start-time)))) + ) + ) + ) + (set! sv-16 (fmin 163840.0 (sqrtf (+ (* (-> v1-125 x) (-> v1-125 x)) (* (-> v1-125 z) (-> v1-125 z)))))) + ) + (set-forward-vel sv-16) + ) + ) + (when (!= gp-0 (handle->process sv-56)) + (set! sv-56 (process->handle gp-0)) + (set! sv-64 (the-as int (current-time))) + ) + ) + ) + ((< sv-16 0.0) + (set! sv-16 (seek sv-16 -0.04096 (* 491520.0 (seconds-per-frame)))) + (set-forward-vel sv-16) + ) + ((and (nonzero? (-> self control unknown-time-frame18)) + (time-elapsed? (-> self control unknown-time-frame18) (seconds 0.04)) + ) + (set-forward-vel 0.0) + ) + ((and (not (cpad-hold? (-> self control cpad number) square)) + (zero? sv-32) + (time-elapsed? (-> self control unknown-combo-tracker00 move-start-time) (seconds 0.2)) + ) + (if (= (-> self control ground-pat material) (pat-material ice)) + (set-forward-vel (fmax 32768.0 (* 0.8 (-> self control ctrl-xz-vel)))) + (set-forward-vel (* 0.8 (-> self control ctrl-xz-vel))) + ) + ) + ((ja-done? 0) + (set-forward-vel sv-16) + ) + (else + (set! sv-16 + (* (target-align-vel-z-adjust (-> self align delta trans z)) (-> self clock frames-per-second) sv-20) + ) + (set-forward-vel sv-16) ) ) ) - ) - (let ((gp-4 (ja-group)) - (f0-53 (ja-aframe-num 0)) - ) - (if (and (= gp-4 jakb-darkjak-attack-combo3-ja) - (>= f0-53 80.0) - (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) - (ja-frame-num 0) + (let ((gp-1 (new-stack-vector0))) + (vector-matrix*! gp-1 (-> self control transv) (-> self control w-R-c)) + (set! (-> gp-1 y) 0.0) + (vector-matrix*! (-> self control align-xz-vel) gp-1 (-> self control c-R-w)) + ) + (when (!= (the-as float (-> self control unknown-word04)) 0.0) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float (-> self control unknown-word04))) + (set! (-> self control unknown-word04) (the-as uint 0.0)) + ) + (when (and (>= sv-16 0.0) + (let ((gp-2 (ja-group)) + (f30-2 (ja-aframe-num 0)) + ) + (if (or (and (= gp-2 jakb-darkjak-attack-combo1-ja) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo1b-ja) + (>= f30-2 11.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo1b-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo2-ja) + (>= f30-2 49.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo2-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo3-ja) + (or (and (>= f30-2 62.0) (>= 77.0 f30-2)) + (and (>= f30-2 82.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + ) + (and (= gp-2 jakb-darkjak-attack-combo3c-ja) + (>= f30-2 62.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3c-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + ) + #t + ) ) - ) - (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.6 1.0) + ) + (let ((gp-3 (new 'stack-no-clear 'collide-query))) + (when (and (>= (impact-control-method-11 + (-> self control impact-ctrl) + gp-3 + (the-as process #f) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + 0.0 + ) + (>= 0.0 (vector-dot (-> gp-3 best-other-tri normal) (-> self control impact-ctrl dir))) + ) + (when (= (-> gp-3 best-other-tri pat mode) (pat-mode wall)) + (part-tracker-spawn :to self :group group-punch-hit :mat-joint (-> gp-3 best-other-tri intersect)) + (let ((imp-sound (static-sound-name "djak-punch-hit"))) + (play-effect-sound + (-> self skel effect) + 'punch + -1.0 + (-> self control impact-ctrl joint) + (the-as basic #f) + imp-sound + ) + ) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (set! sv-16 (the-as float -61440.0)) + ) + ) ) + ) + (let ((gp-4 (ja-group)) + (f0-53 (ja-aframe-num 0)) + ) + (if (and (= gp-4 jakb-darkjak-attack-combo3-ja) + (>= f0-53 80.0) + (>= (the float (+ (-> (the-as art-joint-anim jakb-darkjak-attack-combo3-ja) frames num-frames) -1)) + (ja-frame-num 0) + ) + ) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.6 1.0) + ) + ) + (suspend) + (ja :num! (seek! max (* (-> self control current-surface align-speed) (the-as float sv-48)))) + (if (time-elapsed? (-> self state-time) (seconds 0.1)) + (set! (-> *run-attack-mods* turnvv) 0.0) + ) + (if (< 2 sv-24) + (set! sv-20 (* sv-20 (fmin 1.0 (-> self control zx-vel-frac)))) + ) + (+! sv-24 1) ) - (suspend) - (ja :num! (seek! max (* (-> self control current-surface align-speed) (the-as float sv-48)))) - (if (time-elapsed? (-> self state-time) (seconds 0.1)) - (set! (-> *run-attack-mods* turnvv) 0.0) - ) - (if (< 2 sv-24) - (set! sv-20 (* sv-20 (fmin 1.0 (-> self control zx-vel-frac)))) - ) - (set! sv-24 (+ sv-24 1)) ) (if (and (not (logtest? (-> self control status) (collide-status on-surface))) (time-elapsed? (-> self control last-time-on-surface) (the-as time-frame (-> *TARGET-bank* ground-timeout))) @@ -1054,124 +1046,227 @@ (update-clock! (-> self darkjak) 4) ) :code (behavior () - (local-vars - (v1-100 symbol) - (sv-16 float) - (sv-20 float) - (sv-80 vector) - (sv-84 (function vector :behavior target)) - ) + (local-vars (v1-100 symbol)) (set! (-> self darkjak stage) (-> self darkjak want-stage)) (set! (-> self neck flex-blend) 0.0) (set! (-> self control mod-surface) *roll-flip-mods*) (set! (-> self alt-cam-pos quad) (-> self control trans quad)) - (set! sv-16 (the-as float 0.0)) - (set! sv-20 1.0) - (ja-channel-push! 1 (seconds 0.15)) - (when (jump-hit-ground-stuck?) - (ja-no-eval :group! jakb-darkjak-bomb-pre-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (set! (-> self alt-cam-pos x) (-> self control trans x)) - (set! (-> self alt-cam-pos z) (-> self control trans z)) - (set-forward-vel (* 0.85 (-> self control ctrl-xz-vel))) - (suspend) - (ja :num! (seek!)) + (let ((sv-16 (the-as float 0.0)) + (sv-20 1.0) + ) + (ja-channel-push! 1 (seconds 0.15)) + (when (jump-hit-ground-stuck?) + (ja-no-eval :group! jakb-darkjak-bomb-pre-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.85 (-> self control ctrl-xz-vel))) + (suspend) + (ja :num! (seek!)) + ) ) - ) - (set-setting! 'music-volume 'rel 0.0 0) - (set-setting! 'sfx-volume 'rel 0.0 0) - (set-setting! 'ambient-volume 'rel 0.0 0) - (ja-no-eval :group! jakb-darkjak-bomb-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (compute-alignment! (-> self align)) - (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) - (set! (-> self alt-cam-pos x) (-> self control trans x)) - (set! (-> self alt-cam-pos z) (-> self control trans z)) - (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel))) - (suspend) - (ja :num! (seek!)) - ) - (ja-no-eval :group! jakb-darkjak-bomb-loop-ja :num! (seek!) :frame-num 0.0) - (let ((f30-0 (the float (target-time-to-ground)))) - (until v1-100 + (set-setting! 'music-volume 'rel 0.0 0) + (set-setting! 'sfx-volume 'rel 0.0 0) + (set-setting! 'ambient-volume 'rel 0.0 0) + (ja-no-eval :group! jakb-darkjak-bomb-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (compute-alignment! (-> self align)) + (align! (-> self align) (align-opts adjust-y-vel) 1.0 1.0 1.0) (set! (-> self alt-cam-pos x) (-> self control trans x)) (set! (-> self alt-cam-pos z) (-> self control trans z)) (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel))) - (let ((v1-92 (new-stack-vector0)) - (f0-35 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + (suspend) + (ja :num! (seek!)) + ) + (ja-no-eval :group! jakb-darkjak-bomb-loop-ja :num! (seek!) :frame-num 0.0) + (let ((f30-0 (the float (target-time-to-ground)))) + (until v1-100 + (set! (-> self alt-cam-pos x) (-> self control trans x)) + (set! (-> self alt-cam-pos z) (-> self control trans z)) + (set-forward-vel (* 0.98 (-> self control ctrl-xz-vel))) + (let ((v1-92 (new-stack-vector0)) + (f0-35 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-92 (-> self control transv) (vector-float*! v1-92 (-> self control dynam gravity-normal) f0-35)) + (let* ((f1-5 (vector-length v1-92)) + (f2-0 f1-5) + (f0-36 (+ f0-35 (* -491520.0 (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-36) + (vector-float*! v1-92 v1-92 (/ f1-5 f2-0)) + ) + ) + ) + (suspend) + (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) + (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (collide-status on-surface)))) + ) + ) + (logclear! (-> self state-flags) (state-flags sf6)) + (while (not (jump-hit-ground-stuck?)) + (let ((v1-105 (new-stack-vector0)) + (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) ) 0.0 - (vector-! v1-92 (-> self control transv) (vector-float*! v1-92 (-> self control dynam gravity-normal) f0-35)) - (let* ((f1-5 (vector-length v1-92)) - (f2-0 f1-5) - (f0-36 (+ f0-35 (* -491520.0 (seconds-per-frame)))) + (vector-! + v1-105 + (-> self control transv) + (vector-float*! v1-105 (-> self control dynam gravity-normal) f0-42) + ) + (let* ((f1-8 (vector-length v1-105)) + (f2-1 f1-8) + (f0-43 (+ f0-42 (* -491520.0 (seconds-per-frame)))) ) (vector+! (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-36) - (vector-float*! v1-92 v1-92 (/ f1-5 f2-0)) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-43) + (vector-float*! v1-105 v1-105 (/ f1-8 f2-1)) ) ) ) + (ja :num! (seek! (ja-aframe 33.0 0))) (suspend) - (ja :num! (seek! max (lerp-scale 1.5 0.3 f30-0 30.0 210.0))) - (set! v1-100 (or (ja-done? 0) (logtest? (-> self control status) (collide-status on-surface)))) ) - ) - (logclear! (-> self state-flags) (state-flags sf6)) - (while (not (jump-hit-ground-stuck?)) - (let ((v1-105 (new-stack-vector0)) - (f0-42 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - ) - 0.0 - (vector-! - v1-105 - (-> self control transv) - (vector-float*! v1-105 (-> self control dynam gravity-normal) f0-42) - ) - (let* ((f1-8 (vector-length v1-105)) - (f2-1 f1-8) - (f0-43 (+ f0-42 (* -491520.0 (seconds-per-frame)))) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-43) - (vector-float*! v1-105 v1-105 (/ f1-8 f2-1)) + (set-forward-vel 0.0) + (ja-no-eval :group! jakb-darkjak-bomb-land-ja :num! (seek! (ja-aframe 35.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 35.0 0))) + ) + (set-action! + *gui-control* + (gui-action play) + (-> self control unknown-sound-id00) + (gui-channel none) + (gui-action none) + (the-as string #f) + (the-as (function gui-connection symbol) #f) + (the-as process #f) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + (target-start-attack) + (target-danger-set! 'bomb #f) + (let ((sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)))) + (let ((sv-84 (lambda :behavior target + () + (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) + (cond + ((>= 10.0 (ja-aframe-num 0)) + (let ((v0-1 (the-as vector (-> self draw color-emissive)))) + (set! (-> (the-as rgbaf v0-1) x) 1.0) + (set! (-> (the-as rgbaf v0-1) y) 1.0) + (set! (-> (the-as rgbaf v0-1) z) 1.0) + (set! (-> (the-as rgbaf v0-1) w) 1.0) + v0-1 + ) + ) + ((>= 20.0 (ja-aframe-num 0)) + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) + ) + ) + (else + (vector-lerp! + (-> self draw color-emissive) + (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :w 1.0) + (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) + ) + ) + ) + ) + ) + ) + (if (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage giant)) + ) + (set! (-> sv-80 y) (* 0.5 (+ (-> self control trans y) (-> self control root-prim prim-core world-sphere y)))) + (set! (-> sv-80 y) (-> self control root-prim prim-core world-sphere y)) + ) + (part-tracker-spawn :to *entity-pool* :group group-darkjak-bomb :mat-joint sv-80) + (let ((gp-5 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) + (when gp-5 + (send-event (ppointer->process gp-5) 'anim-mode 'play1) + (send-event (ppointer->process gp-5) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-5 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event (ppointer->process gp-5) 'trans-hook sv-84) + ) ) ) - ) - (ja :num! (seek! (ja-aframe 33.0 0))) - (suspend) - ) - (set-forward-vel 0.0) - (ja-no-eval :group! jakb-darkjak-bomb-land-ja :num! (seek! (ja-aframe 35.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (suspend) - (ja :num! (seek! (ja-aframe 35.0 0))) - ) - (set-action! - *gui-control* - (gui-action play) - (-> self control unknown-sound-id00) - (gui-channel none) - (gui-action none) - (the-as string #f) - (the-as (function gui-connection symbol) #f) - (the-as process #f) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) - (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) - (target-start-attack) - (target-danger-set! 'bomb #f) - (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand))) - (set! sv-84 (lambda :behavior target + (let ((gp-7 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) + (when gp-7 + (send-event (ppointer->process gp-7) 'anim-mode 'play1) + (send-event (ppointer->process gp-7) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-7 0)) root scale) sv-20 1.0 sv-20 1.0) + ) + ) + (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (when (and (focus-test? self dark) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) + ) + (let ((gp-10 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) + (when gp-10 + (send-event (ppointer->process gp-10) 'anim-mode 'play1) + (send-event (ppointer->process gp-10) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-10 0)) root scale) sv-20 1.0 sv-20 1.0) + (send-event + (ppointer->process gp-10) + 'trans-hook + (lambda :behavior target () (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) (cond ((>= 10.0 (ja-aframe-num 0)) (let ((v0-1 (the-as vector (-> self draw color-emissive)))) - (set! (-> (the-as rgbaf v0-1) x) 1.0) - (set! (-> (the-as rgbaf v0-1) y) 1.0) + (set! (-> (the-as rgbaf v0-1) x) 0.5) + (set! (-> (the-as rgbaf v0-1) y) 0.25) (set! (-> (the-as rgbaf v0-1) z) 1.0) (set! (-> (the-as rgbaf v0-1) w) 1.0) v0-1 @@ -1180,164 +1275,60 @@ ((>= 20.0 (ja-aframe-num 0)) (vector-lerp! (-> self draw color-emissive) - (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.5 :y 0.25 :z 1.0 :w 1.0) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) ) ) (else (vector-lerp! (-> self draw color-emissive) - (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) + (new 'static 'vector :x 0.25 :z 1.0 :w 1.0) (new 'static 'vector :w 1.0) (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) ) ) ) ) - ) - (if (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage giant)) - ) - (set! (-> sv-80 y) (* 0.5 (+ (-> self control trans y) (-> self control root-prim prim-core world-sphere y)))) - (set! (-> sv-80 y) (-> self control root-prim prim-core world-sphere y)) - ) - (part-tracker-spawn :to *entity-pool* :group group-darkjak-bomb :mat-joint sv-80) - (let ((gp-5 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) ) - ) - (when gp-5 - (send-event (ppointer->process gp-5) 'anim-mode 'play1) - (send-event (ppointer->process gp-5) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-5 0)) root scale) sv-20 1.0 sv-20 1.0) - (send-event (ppointer->process gp-5) 'trans-hook sv-84) - ) - ) - (let ((gp-7 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) - ) - ) - (when gp-7 - (send-event (ppointer->process gp-7) 'anim-mode 'play1) - (send-event (ppointer->process gp-7) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-7 0)) root scale) sv-20 1.0 sv-20 1.0) - ) - ) - (ja-no-eval :num! (seek! (ja-aframe 38.0 0))) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) - (set-forward-vel 0.0) - (suspend) - (ja-eval) - ) - (when (and (focus-test? self dark) - (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) - ) - (let ((gp-10 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) - ) + ) ) - (when gp-10 - (send-event (ppointer->process gp-10) 'anim-mode 'play1) - (send-event (ppointer->process gp-10) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-10 0)) root scale) sv-20 1.0 sv-20 1.0) - (send-event - (ppointer->process gp-10) - 'trans-hook - (lambda :behavior target - () - (set-vector! (-> self draw color-mult) 0.0 0.0 0.0 1.0) - (cond - ((>= 10.0 (ja-aframe-num 0)) - (let ((v0-1 (the-as vector (-> self draw color-emissive)))) - (set! (-> (the-as rgbaf v0-1) x) 0.5) - (set! (-> (the-as rgbaf v0-1) y) 0.25) - (set! (-> (the-as rgbaf v0-1) z) 1.0) - (set! (-> (the-as rgbaf v0-1) w) 1.0) - v0-1 - ) - ) - ((>= 20.0 (ja-aframe-num 0)) - (vector-lerp! - (-> self draw color-emissive) - (new 'static 'vector :x 0.5 :z 1.0 :w 1.0) - (new 'static 'vector :x 0.5 :y 0.25 :z 1.0 :w 1.0) - (lerp-scale 0.0 1.0 (ja-aframe-num 0) 10.0 20.0) - ) - ) - (else - (vector-lerp! - (-> self draw color-emissive) - (new 'static 'vector :x 0.25 :z 1.0 :w 1.0) - (new 'static 'vector :w 1.0) - (lerp-scale 0.0 1.0 (ja-aframe-num 0) 20.0 30.0) - ) - ) + (let ((gp-12 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) ) + (when gp-12 + (send-event (ppointer->process gp-12) 'anim-mode 'play1) + (send-event (ppointer->process gp-12) 'anim "idle") + (set-vector! (-> (the-as process-drawable (-> gp-12 0)) root scale) sv-20 0.5 sv-20 1.0) ) ) ) ) - (let ((gp-12 (process-spawn - manipy - :init manipy-init - sv-80 - (-> self entity) - (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) - #f - 0 - :to self - ) - ) - ) - (when gp-12 - (send-event (ppointer->process gp-12) 'anim-mode 'play1) - (send-event (ppointer->process gp-12) 'anim "idle") - (set-vector! (-> (the-as process-drawable (-> gp-12 0)) root scale) sv-20 0.5 sv-20 1.0) - ) + (ja-no-eval :num! (seek!)) + (while (not (ja-done? 0)) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (set-forward-vel 0.0) + (suspend) + (ja-eval) + ) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + (remove-setting! 'ambient-volume) + (ja-no-eval :group! jakb-darkjak-bomb-end-ja :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) + (suspend) + (ja :num! (seek! (ja-aframe 90.0 0))) ) - ) - (ja-no-eval :num! (seek!)) - (while (not (ja-done? 0)) - (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) - (set-forward-vel 0.0) - (suspend) - (ja-eval) - ) - (remove-setting! 'music-volume) - (remove-setting! 'sfx-volume) - (remove-setting! 'ambient-volume) - (ja-no-eval :group! jakb-darkjak-bomb-end-ja :num! (seek! (ja-aframe 90.0 0)) :frame-num 0.0) - (until (ja-done? 0) - (target-darkjak-bomb-collide (the-as float (& sv-16)) sv-20) - (suspend) - (ja :num! (seek! (ja-aframe 90.0 0))) ) (logior! (-> self control status) (collide-status on-surface on-ground touch-surface)) (send-event (handle->process (-> self notify)) 'notify 'attack 16) @@ -1372,7 +1363,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior target-bomb1-fire-shot target ((arg0 (pointer handle)) (arg1 int) (arg2 int) (arg3 int)) - (local-vars (sv-128 target) (sv-144 int) (sv-160 vector) (sv-176 vector) (sv-192 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1433,19 +1423,21 @@ (s2-0 (-> *lightning-spec-id-table* 10)) (s1-0 0) (s0-0 lightning-probe-callback) + (sv-128 self) + (sv-144 3) + (sv-192 (new 'stack-no-clear 'vector)) ) - (set! sv-128 self) - (set! sv-144 3) - (set! sv-192 (new 'stack-no-clear 'vector)) - (set! sv-160 (-> self control trans)) - (set! sv-176 (new 'stack-no-clear 'vector)) - (set! (-> sv-176 x) (rand-vu-float-range -40960.0 40960.0)) - (set! (-> sv-176 y) (rand-vu-float-range -8192.0 8192.0)) - (set! (-> sv-176 z) (rand-vu-float-range -40960.0 40960.0)) - (set! (-> sv-176 w) 1.0) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-160 quad)) - (.lvf vf5 (&-> sv-176 quad)) + (let ((sv-160 (-> self control trans)) + (sv-176 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-176 x) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 y) (rand-vu-float-range -8192.0 8192.0)) + (set! (-> sv-176 z) (rand-vu-float-range -40960.0 40960.0)) + (set! (-> sv-176 w) 1.0) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-160 quad)) + (.lvf vf5 (&-> sv-176 quad)) + ) (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-192 quad) vf6) ((the-as (function object object object object object object object object none) s5-1) @@ -1487,20 +1479,6 @@ (update-clock! (-> self darkjak) 8) ) :code (behavior ((arg0 float) (arg1 float)) - (local-vars - (sv-32 (array collide-shape)) - (sv-40 int) - (sv-48 int) - (sv-56 sphere) - (sv-60 (pointer handle)) - (sv-64 int) - (sv-72 time-frame) - (sv-80 time-frame) - (sv-88 float) - (sv-92 number) - (sv-96 time-frame) - (sv-104 uint) - ) (logior! (-> self state-flags) (state-flags sf4)) (set! (-> self neck flex-blend) 0.0) (set-setting! 'music-volume 'rel 0.0 0) @@ -1532,244 +1510,250 @@ (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) (let ((gp-0 (-> self post-hook))) (set! (-> self post-hook) target-no-move-post) - (set! sv-32 (-> self focus-search)) - (set! sv-40 0) - (set! sv-48 0) - (set! sv-56 (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main)))) - (set! sv-60 - (new 'static 'array handle 128 - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) - (new 'static 'handle) + (let ((sv-32 (-> self focus-search)) + (sv-40 0) + (sv-48 0) + (sv-56 (the-as sphere (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg main)))) + (sv-60 + (new 'static 'array handle 128 + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + (new 'static 'handle) + ) ) ) - (set! (-> sv-56 r) - (if (and (focus-test? self dark) - (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) - ) - 614400.0 - 327680.0 - ) - ) - (set! sv-40 (fill-actor-list-for-sphere *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) - (set! (-> sv-32 length) sv-40) - (countdown (s5-0 sv-40) - (let ((v1-53 (the-as process-drawable (as-type (-> sv-32 s5-0 process) process-focusable)))) - (when (and v1-53 (logtest? (process-mask enemy guard vehicle) (-> v1-53 mask))) - (set! (-> sv-60 sv-48) (process->handle v1-53)) - (set! sv-48 (+ sv-48 1)) - (if (< 128 sv-48) - (set! sv-48 128) - ) + (set! (-> sv-56 r) + (if (and (focus-test? self dark) + (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) (darkjak-stage giant))) + ) + 614400.0 + 327680.0 + ) + ) + (set! sv-40 (fill-actor-list-for-sphere *actor-hash* sv-56 (-> sv-32 data) (-> sv-32 allocated-length))) + (set! (-> sv-32 length) sv-40) + (countdown (s5-0 sv-40) + (let ((v1-53 (the-as process-drawable (as-type (-> sv-32 s5-0 process) process-focusable)))) + (when (and v1-53 (logtest? (process-mask enemy guard vehicle) (-> v1-53 mask))) + (set! (-> sv-60 sv-48) (process->handle v1-53)) + (+! sv-48 1) + (if (< 128 sv-48) + (set! sv-48 128) + ) + ) ) ) - ) - (set! (-> self control mod-surface) (new 'static 'surface - :name 'uppercut - :turnv 524288.0 - :tiltv 32768.0 - :tiltvv 262144.0 - :transv-max 32768.0 - :target-speed 32768.0 - :fric 0.2 - :nonlin-fric-dist 1.0 - :slip-factor 1.0 - :slide-factor 1.0 - :slope-up-factor 1.0 - :slope-down-factor 1.0 - :slope-slip-angle 1.0 - :impact-fric 1.0 - :bend-factor 1.0 - :bend-speed 1.0 - :alignv 1.0 - :slope-up-traction 1.0 - :align-speed 1.0 - :turnvf 15.0 - :tiltvf 150.0 - :tiltvvf 15.0 - :mode 'air - :flags (surface-flag air attack spin gun-off laser-hide) - ) + (set! (-> self control mod-surface) (new 'static 'surface + :name 'uppercut + :turnv 524288.0 + :tiltv 32768.0 + :tiltvv 262144.0 + :transv-max 32768.0 + :target-speed 32768.0 + :fric 0.2 + :nonlin-fric-dist 1.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :turnvf 15.0 + :tiltvf 150.0 + :tiltvvf 15.0 + :mode 'air + :flags (surface-flag air attack spin gun-off laser-hide) + ) + ) + (let ((sv-64 0) + (sv-72 (current-time)) + (sv-80 (current-time)) + (sv-88 (the-as float 0.0)) + (sv-92 0.0) + ) + (let ((sv-96 (current-time))) ) - (set! sv-64 0) - (set! sv-72 (current-time)) - (set! sv-80 (current-time)) - (set! sv-88 (the-as float 0.0)) - (set! sv-92 0.0) - (set! sv-96 (current-time)) - (let* ((v1-70 (-> self game)) - (a0-33 (+ (-> v1-70 attack-id) 1)) - ) - (set! (-> v1-70 attack-id) a0-33) - (set! sv-104 a0-33) - ) - (ja-channel-push! 2 (seconds 0.05)) - (ja :group! jakb-darkjak-attack-ice-loop-ja) - (ja :chan 1 :group! jakb-darkjak-attack-ice-loop2-ja) - (while (or (< sv-64 sv-48) (not (time-elapsed? sv-80 (seconds 1.5)))) - (let ((v1-77 (new-stack-vector0))) - (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! v1-77 (-> self control transv) (vector-float*! v1-77 (-> self control dynam gravity-normal) f0-8)) - ) - (let* ((f0-9 (vector-length v1-77)) - (f1-3 f0-9) - (f2-0 0.0) + (let* ((v1-70 (-> self game)) + (a0-33 (+ (-> v1-70 attack-id) 1)) ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-77 v1-77 (/ f0-9 f1-3)) + (set! (-> v1-70 attack-id) a0-33) + (let ((sv-104 a0-33)) + (ja-channel-push! 2 (seconds 0.05)) + (ja :group! jakb-darkjak-attack-ice-loop-ja) + (ja :chan 1 :group! jakb-darkjak-attack-ice-loop2-ja) + (while (or (< sv-64 sv-48) (not (time-elapsed? sv-80 (seconds 1.5)))) + (let ((v1-77 (new-stack-vector0))) + (let ((f0-8 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-77 (-> self control transv) (vector-float*! v1-77 (-> self control dynam gravity-normal) f0-8)) + ) + (let* ((f0-9 (vector-length v1-77)) + (f1-3 f0-9) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-77 v1-77 (/ f0-9 f1-3)) + ) + ) + ) + (set! (-> self darkjak clock-vel) -4.0) + (set! (-> self darkjak clock-on) #t) + (send-event *camera* 'joystick -0.25 1.0) + (when (time-elapsed? sv-72 (seconds 0.1)) + (set! sv-72 (current-time)) + (target-bomb1-fire-shot sv-60 sv-64 sv-48 (the-as int sv-104)) + (+! sv-64 1) + (if (time-elapsed? (-> self state-time) (seconds 1)) + (set! sv-92 1.0) + ) + ) + (set! sv-88 (seek sv-88 (the-as float sv-92) (* 6.0 (seconds-per-frame)))) + (ja :num! (loop!)) + (let ((a0-60 (-> self skel root-channel 1))) + (let ((f0-17 sv-88)) + (set! (-> a0-60 frame-interp 1) f0-17) + (set! (-> a0-60 frame-interp 0) f0-17) + ) + (set! (-> a0-60 param 0) 0.0) + (joint-control-channel-group-eval! a0-60 (the-as art-joint-anim #f) num-func-chan) + ) + (suspend) + ) ) ) ) - (set! (-> self darkjak clock-vel) -4.0) - (set! (-> self darkjak clock-on) #t) - (send-event *camera* 'joystick -0.25 1.0) - (when (time-elapsed? sv-72 (seconds 0.1)) - (set! sv-72 (current-time)) - (target-bomb1-fire-shot sv-60 sv-64 sv-48 (the-as int sv-104)) - (set! sv-64 (+ sv-64 1)) - (if (time-elapsed? (-> self state-time) (seconds 1)) - (set! sv-92 1.0) - ) - ) - (set! sv-88 (seek sv-88 (the-as float sv-92) (* 6.0 (seconds-per-frame)))) - (ja :num! (loop!)) - (let ((a0-60 (-> self skel root-channel 1))) - (let ((f0-17 sv-88)) - (set! (-> a0-60 frame-interp 1) f0-17) - (set! (-> a0-60 frame-interp 0) f0-17) - ) - (set! (-> a0-60 param 0) 0.0) - (joint-control-channel-group-eval! a0-60 (the-as art-joint-anim #f) num-func-chan) - ) - (suspend) ) 0 (set! (-> self post-hook) gp-0) diff --git a/test/decompiler/reference/jak2/engine/target/target-death_REF.gc b/test/decompiler/reference/jak2/engine/target/target-death_REF.gc index 01001db8b3..224398f6c3 100644 --- a/test/decompiler/reference/jak2/engine/target/target-death_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-death_REF.gc @@ -920,258 +920,259 @@ ) ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (local-vars (sv-32 attack-info) (sv-36 vector)) (logclear! (-> self water flags) (water-flags jump-out)) (set-time! (-> self state-time)) (set! (-> self neck flex-blend) 0.0) - (set! sv-32 (-> self attack-info)) - (set! sv-36 (new 'stack-no-clear 'vector)) - (let ((v1-7 sv-32)) - (set! (-> v1-7 attacker) (the-as handle #f)) - (set! (-> v1-7 mode) 'generic) - (set! (-> v1-7 shove-back) 6144.0) - (set! (-> v1-7 shove-up) 4915.2) - (set! (-> v1-7 angle) #f) - (set! (-> v1-7 trans quad) (-> self control trans quad)) - (set! (-> v1-7 control) 0.0) - (set! (-> v1-7 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) - (set! (-> v1-7 damage) (-> *FACT-bank* health-default-inc)) - ) - (case arg0 - (('shove) - (let ((v1-10 sv-32)) - (set! (-> v1-10 shove-back) (-> *TARGET-bank* smack-surface-dist)) - (set! (-> v1-10 shove-up) (-> *TARGET-bank* smack-surface-height)) - (set! (-> v1-10 angle) 'shove) - ) - ) - ) - (combine! sv-32 arg1 self) - (when (not (logtest? (-> sv-32 mask) (attack-mask vector))) - (vector-z-quaternion! (-> sv-32 vector) (-> self control quat-for-control)) - (vector-xz-normalize! (-> sv-32 vector) (- (fabs (-> sv-32 shove-back)))) - (set! (-> sv-32 vector y) (-> sv-32 shove-up)) - ) - (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) - (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) - (if (< (- (-> self fact health) (-> sv-32 damage)) 1.0) - (set! (-> sv-32 damage) (+ -1.0 (-> self fact health))) + (let ((sv-32 (-> self attack-info))) + (let ((sv-36 (new 'stack-no-clear 'vector))) + (let ((v1-7 sv-32)) + (set! (-> v1-7 attacker) (the-as handle #f)) + (set! (-> v1-7 mode) 'generic) + (set! (-> v1-7 shove-back) 6144.0) + (set! (-> v1-7 shove-up) 4915.2) + (set! (-> v1-7 angle) #f) + (set! (-> v1-7 trans quad) (-> self control trans quad)) + (set! (-> v1-7 control) 0.0) + (set! (-> v1-7 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) + (set! (-> v1-7 damage) (-> *FACT-bank* health-default-inc)) ) - ) - (set! (-> sv-36 quad) (-> sv-32 vector quad)) - (let ((f0-20 (vector-dot - (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-36 1.0) - (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) - ) - ) - ) - (if (not (-> self attack-info angle)) - (set! (-> self attack-info angle) (if (>= 0.0 f0-20) - 'front - 'back - ) - ) - ) - ) - (cond - ((= arg0 'attack) - (send-event (handle->process (-> self notify)) 'notify 'hit (-> sv-32 mode)) - (logior! (-> self focus-status) (focus-status hit)) - (set-time! (-> self game hit-time)) - (case (-> sv-32 mode) - (('endlessfall) - (cond - ((= (-> self game mode) 'debug) - (let ((gp-1 (new-stack-vector0))) - (set! (-> gp-1 quad) (-> self control last-trans-on-ground quad)) - (ja-channel-set! 0) - (suspend-for (seconds 1) - ) - (move-to-point! (-> self control) gp-1) - ) - (set! (-> self control camera-pos quad) (-> self control trans quad)) - (send-event *camera* 'teleport) - (go target-stance) + (case arg0 + (('shove) + (let ((v1-10 sv-32)) + (set! (-> v1-10 shove-back) (-> *TARGET-bank* smack-surface-dist)) + (set! (-> v1-10 shove-up) (-> *TARGET-bank* smack-surface-height)) + (set! (-> v1-10 angle) 'shove) ) - (else - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (go target-death (-> sv-32 mode)) - ) - ) + ) ) - (('lava 'melt) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (part-tracker-spawn :to *entity-pool* :group group-lava-death :mat-joint (-> self control trans)) - (set! (-> sv-32 angle) 'lava) - (set! (-> sv-32 shove-up) 20480.0) + (combine! sv-32 arg1 self) + (when (not (logtest? (-> sv-32 mask) (attack-mask vector))) + (vector-z-quaternion! (-> sv-32 vector) (-> self control quat-for-control)) + (vector-xz-normalize! (-> sv-32 vector) (- (fabs (-> sv-32 shove-back)))) + (set! (-> sv-32 vector y) (-> sv-32 shove-up)) ) - (('drown-death - 'sharkey - 'dark-eco-pool - 'instant-death - 'crush - 'death - 'grenade - 'bot - 'turret - 'centipede - 'big-explosion - ) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (if (= (-> self game mode) 'play) - (go target-death (-> sv-32 mode)) + (when (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (set! (-> sv-32 damage) (fmax 1.0 (ceil (/ (-> sv-32 damage) 2)))) + (if (< (- (-> self fact health) (-> sv-32 damage)) 1.0) + (set! (-> sv-32 damage) (+ -1.0 (-> self fact health))) ) ) - (('explode) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) - ) - (('smush) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (go target-hit-ground-hard (-> *TARGET-bank* fall-far)) - ) - (('shock 'shock-red 'shock-green) - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - (let* ((v1-123 (-> sv-32 mode)) - (gp-3 (cond - ((= v1-123 'shock-red) - group-lightning-red-glow - ) - ((= v1-123 'shock-green) - group-lightning-green-glow - ) - (else - group-lightning-glow - ) - ) + (set! (-> sv-36 quad) (-> sv-32 vector quad)) + (let ((f0-20 (vector-dot + (vector-normalize-copy! (new 'stack-no-clear 'vector) sv-36 1.0) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat-for-control)) ) + ) + ) + (if (not (-> self attack-info angle)) + (set! (-> self attack-info angle) (if (>= 0.0 f0-20) + 'front + 'back + ) + ) + ) + ) + (cond + ((= arg0 'attack) + (send-event (handle->process (-> self notify)) 'notify 'hit (-> sv-32 mode)) + (logior! (-> self focus-status) (focus-status hit)) + (set-time! (-> self game hit-time)) + (case (-> sv-32 mode) + (('endlessfall) + (cond + ((= (-> self game mode) 'debug) + (let ((gp-1 (new-stack-vector0))) + (set! (-> gp-1 quad) (-> self control last-trans-on-ground quad)) + (ja-channel-set! 0) + (suspend-for (seconds 1) + ) + (move-to-point! (-> self control) gp-1) + ) + (set! (-> self control camera-pos quad) (-> self control trans quad)) + (send-event *camera* 'teleport) + (go target-stance) ) - (process-spawn part-tracker :init part-tracker-init gp-3 300 #f #f self 6 :to self) - ) - (let ((gp-4 (-> self post-hook))) - (set! (-> self control mod-surface) *turn-around-mods*) - (set! (-> self post-hook) target-no-stick-post) - (if (using-gun? self) - (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim jakb-gun-hit-elec-ja) 0.0 30 0 1.0 0.0 #f) - ) - (let ((v1-141 (new-stack-vector0))) - (let ((f0-31 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) - 0.0 - (vector-! - v1-141 - (-> self control transv) - (vector-float*! v1-141 (-> self control dynam gravity-normal) f0-31) - ) - ) - (let* ((f0-32 (vector-length v1-141)) - (f1-7 f0-32) - (f2-0 0.0) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) - (vector-float*! v1-141 v1-141 (/ f0-32 f1-7)) + (else + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-death (-> sv-32 mode)) ) ) ) - (ja-channel-push! 1 (seconds 0.1)) - (ja-no-eval :group! jakb-hit-elec-ja :num! (seek!) :frame-num 0.0) - (until (ja-done? 0) - (let ((v1-157 (new-stack-vector0)) - (f0-39 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) - ) - 0.0 - (vector-! - v1-157 - (-> self control transv) - (vector-float*! v1-157 (-> self control dynam gravity-normal) f0-39) - ) - (let* ((f1-10 (vector-length v1-157)) - (f2-1 f1-10) - (f0-40 (+ f0-39 (* 286720.0 (seconds-per-frame)))) - ) - (vector+! - (-> self control transv) - (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-40) - (vector-float*! v1-157 v1-157 (/ f1-10 f2-1)) - ) - ) + (('lava 'melt) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (part-tracker-spawn :to *entity-pool* :group group-lava-death :mat-joint (-> self control trans)) + (set! (-> sv-32 angle) 'lava) + (set! (-> sv-32 shove-up) 20480.0) + ) + (('drown-death + 'sharkey + 'dark-eco-pool + 'instant-death + 'crush + 'death + 'grenade + 'bot + 'turret + 'centipede + 'big-explosion ) - (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.03)) - (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) - (send-event self 'color-effect 'shock (seconds 0.2)) - (case (-> sv-32 mode) - (('shock-red) - (process-drawable-shock-effect - self - (-> *lightning-spec-id-table* 3) - lightning-probe-callback - (the-as sparticle-launcher #f) - 0 - 0 - 40960.0 + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (if (= (-> self game mode) 'play) + (go target-death (-> sv-32 mode)) + ) + ) + (('explode) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) + ) + (('smush) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (go target-hit-ground-hard (-> *TARGET-bank* fall-far)) + ) + (('shock 'shock-red 'shock-green) + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + (let* ((v1-123 (-> sv-32 mode)) + (gp-3 (cond + ((= v1-123 'shock-red) + group-lightning-red-glow + ) + ((= v1-123 'shock-green) + group-lightning-green-glow + ) + (else + group-lightning-glow + ) + ) + ) ) - ) - (('shock-green) - (process-drawable-shock-effect - self - (-> *lightning-spec-id-table* 4) - lightning-probe-callback - (the-as sparticle-launcher #f) - 0 - 0 - 40960.0 - ) - ) - (else - (process-drawable-shock-effect - self - (-> *lightning-spec-id-table* 1) - lightning-probe-callback - (-> *part-id-table* 166) - 0 - 0 - 40960.0 + (process-spawn part-tracker :init part-tracker-init gp-3 300 #f #f self 6 :to self) + ) + (let ((gp-4 (-> self post-hook))) + (set! (-> self control mod-surface) *turn-around-mods*) + (set! (-> self post-hook) target-no-stick-post) + (if (using-gun? self) + (push-anim-to-targ (-> self skel top-anim) (the-as art-joint-anim jakb-gun-hit-elec-ja) 0.0 30 0 1.0 0.0 #f) + ) + (let ((v1-141 (new-stack-vector0))) + (let ((f0-31 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! + v1-141 + (-> self control transv) + (vector-float*! v1-141 (-> self control dynam gravity-normal) f0-31) + ) + ) + (let* ((f0-32 (vector-length v1-141)) + (f1-7 f0-32) + (f2-0 0.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-0) + (vector-float*! v1-141 v1-141 (/ f0-32 f1-7)) ) ) ) + (ja-channel-push! 1 (seconds 0.1)) + (ja-no-eval :group! jakb-hit-elec-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (let ((v1-157 (new-stack-vector0)) + (f0-39 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! + v1-157 + (-> self control transv) + (vector-float*! v1-157 (-> self control dynam gravity-normal) f0-39) + ) + (let* ((f1-10 (vector-length v1-157)) + (f2-1 f1-10) + (f0-40 (+ f0-39 (* 286720.0 (seconds-per-frame)))) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-40) + (vector-float*! v1-157 v1-157 (/ f1-10 f2-1)) + ) + ) + ) + (when (>= (- (-> *display* game-clock frame-counter) (-> self shock-effect-time)) (seconds 0.03)) + (set! (-> self shock-effect-time) (-> *display* game-clock frame-counter)) + (send-event self 'color-effect 'shock (seconds 0.2)) + (case (-> sv-32 mode) + (('shock-red) + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 3) + lightning-probe-callback + (the-as sparticle-launcher #f) + 0 + 0 + 40960.0 + ) + ) + (('shock-green) + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 4) + lightning-probe-callback + (the-as sparticle-launcher #f) + 0 + 0 + 40960.0 + ) + ) + (else + (process-drawable-shock-effect + self + (-> *lightning-spec-id-table* 1) + lightning-probe-callback + (-> *part-id-table* 166) + 0 + 0 + 40960.0 + ) + ) + ) + ) + (suspend) + (ja :num! (seek!)) + ) + (set! (-> sv-32 angle) 'back) + (set! (-> self post-hook) gp-4) ) - (suspend) - (ja :num! (seek!)) ) - (set! (-> sv-32 angle) 'back) - (set! (-> self post-hook) gp-4) + (else + (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) + ) + ) + (target-hit-effect sv-32) + ) + (else + (case (-> sv-32 mode) + (('burn 'burnup) + (sound-play "get-burned") + ) + ) ) ) - (else - (pickup-collectable! (-> self fact) (pickup-type health) (- (-> sv-32 damage)) (the-as handle #f)) - ) - ) - (target-hit-effect sv-32) - ) - (else - (case (-> sv-32 mode) - (('burn 'burnup) - (sound-play "get-burned") - ) + (when (and (= (-> self game mode) 'play) (and (>= 0.0 (-> self fact health)) (using-gun? self))) + (send-event (ppointer->process (-> self gun gun)) 'die) + (target-gun-end-mode #f) ) + (set! (-> self control mod-surface) *smack-mods*) + (target-hit-setup-anim sv-32) + (target-hit-move sv-32 (target-hit-orient sv-32 sv-36) target-falling-anim-trans 1.0) ) + (if (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) + (go target-darkjak-get-off) + ) + (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) + (go target-death (-> sv-32 mode)) + ) ) - (when (and (= (-> self game mode) 'play) (and (>= 0.0 (-> self fact health)) (using-gun? self))) - (send-event (ppointer->process (-> self gun gun)) 'die) - (target-gun-end-mode #f) - ) - (set! (-> self control mod-surface) *smack-mods*) - (target-hit-setup-anim sv-32) - (target-hit-move sv-32 (target-hit-orient sv-32 sv-36) target-falling-anim-trans 1.0) - (if (and (and (focus-test? self dark) (nonzero? (-> self darkjak))) (>= 1.0 (-> self fact health))) - (go target-darkjak-get-off) - ) - (if (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health))) - (go target-death (-> sv-32 mode)) - ) (go target-hit-ground #f) ) :post target-post diff --git a/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc index 8aeb9d8d85..76d33e9987 100644 --- a/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-handler_REF.gc @@ -187,444 +187,275 @@ ;; WARN: Stack slot offset 96 signed mismatch ;; WARN: Stack slot offset 96 signed mismatch (defbehavior target-send-attack target ((arg0 process) (arg1 symbol) (arg2 touching-shapes-entry) (arg3 int) (arg4 int) (arg5 penetrate)) - (local-vars - (sv-96 symbol) - (sv-100 touching-prims-entry) - (sv-128 touching-prims-entry) - (sv-176 touching-prims-entry) - (sv-224 penetrate) - (sv-240 int) - (sv-256 symbol) - (sv-272 symbol) - (sv-288 symbol) - (sv-304 vector) - (sv-320 matrix) - (sv-336 int) - (sv-352 symbol) - (sv-368 symbol) - (sv-384 symbol) - (sv-400 vector) - (sv-416 matrix) - (sv-432 int) - (sv-448 symbol) - (sv-464 symbol) - (sv-480 symbol) - (sv-496 vector) - (sv-512 matrix) - (sv-528 int) - (sv-544 symbol) - (sv-560 symbol) - (sv-576 symbol) - (sv-592 vector) - (sv-608 matrix) - (sv-624 int) - (sv-640 symbol) - (sv-656 symbol) - (sv-672 symbol) - (sv-688 vector) - (sv-704 matrix) - ) - (set! sv-224 arg5) - (let* ((s4-0 (the-as process (as-type arg0 process-focusable))) + (let* ((sv-224 arg5) + (s4-0 (the-as process (as-type arg0 process-focusable))) (s3-1 (and s4-0 (focus-test? (the-as process-focusable s4-0) dead hit))) + (a1-2 (new 'stack-no-clear 'event-message-block)) ) - (set! sv-96 + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (the-as uint arg2)) + (set! (-> a1-2 param 1) (the-as - symbol - (send-event - arg0 - 'attack - arg2 - (static-attack-info ((id (the-as uint arg3)) (mode arg1) (count (the-as uint arg4)) (penetrate-using sv-224))) - ) + uint + (static-attack-info ((id (the-as uint arg3)) (mode arg1) (count (the-as uint arg4)) (penetrate-using sv-224))) ) ) - (when sv-96 - (set! (-> self control send-attack-dest) (process->handle arg0)) - (set-time! (-> self control send-attack-time)) - (send-event self 'hit arg1 arg0 arg2) - (set! arg0 (and (and (focus-test? self dark) - (nonzero? (-> self darkjak)) - (logtest? (-> self darkjak stage) (darkjak-stage active)) - ) - arg0 - ) - ) - (when (the-as object arg0) - (when (and s4-0 (not s3-1) (-> self control danger-mode) (not (logtest? (-> s4-0 mask) (process-mask dark-effect)))) - (logior! (-> s4-0 mask) (process-mask dark-effect)) - (process-spawn-function - process - (lambda :behavior target - ((arg0 handle)) - (local-vars (sv-112 vector) (sv-128 matrix)) - (let ((gp-0 (-> self parent))) - (let ((s4-0 0) - (s3-0 (current-time)) - ) - (set! (-> self clock) (-> gp-0 0 clock)) - (while (let ((v1-48 gp-0)) - (and (or (focus-test? - (the-as process-focusable (if v1-48 - (the-as process-focusable (-> v1-48 0 self)) - ) - ) - dead - hit - ) - (let ((v1-53 gp-0)) - (and (-> (the-as process-focusable (if v1-53 - (the-as process-focusable (-> v1-53 0 self)) - ) - ) - next-state - ) - (let ((v1-56 gp-0)) - (= (-> (the-as process-focusable (if v1-56 - (the-as process-focusable (-> v1-56 0 self)) - ) - ) - next-state - name - ) - 'knocked + (let ((sv-96 (the-as symbol (send-event-function arg0 a1-2)))) + (when sv-96 + (set! (-> self control send-attack-dest) (process->handle arg0)) + (set-time! (-> self control send-attack-time)) + (send-event self 'hit arg1 arg0 arg2) + (set! arg0 (and (and (focus-test? self dark) + (nonzero? (-> self darkjak)) + (logtest? (-> self darkjak stage) (darkjak-stage active)) + ) + arg0 + ) + ) + (when (the-as object arg0) + (when (and s4-0 (not s3-1) (-> self control danger-mode) (not (logtest? (-> s4-0 mask) (process-mask dark-effect)))) + (logior! (-> s4-0 mask) (process-mask dark-effect)) + (process-spawn-function + process + (lambda :behavior target + ((arg0 handle)) + (let ((gp-0 (-> self parent))) + (let ((s4-0 0) + (s3-0 (current-time)) + ) + (set! (-> self clock) (-> gp-0 0 clock)) + (while (let ((v1-48 gp-0)) + (and (or (focus-test? + (the-as process-focusable (if v1-48 + (the-as process-focusable (-> v1-48 0 self)) + ) ) - ) - ) - ) - ) - (not (time-elapsed? s3-0 (seconds 15))) - (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) - ) - ) - ) - (let ((s2-0 sp-launch-particles-var) - (s1-0 *sp-particle-system-2d*) - (s0-0 (-> *part-id-table* 178)) - ) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-9 (-> (process-drawable-random-point! - (the-as process-drawable (ppointer->process gp-0)) - (new 'stack-no-clear 'vector) + dead + hit + ) + (let ((v1-53 gp-0)) + (and (-> (the-as process-focusable (if v1-53 + (the-as process-focusable (-> v1-53 0 self)) + ) + ) + next-state + ) + (let ((v1-56 gp-0)) + (= (-> (the-as process-focusable (if v1-56 + (the-as process-focusable (-> v1-56 0 self)) + ) + ) + next-state + name + ) + 'knocked + ) + ) + ) ) - quad ) + (not (time-elapsed? s3-0 (seconds 15))) + (not (logtest? (-> (the-as process-focusable (-> gp-0 0)) draw status) (draw-control-status no-draw no-draw-temp)) + ) ) + ) + (let ((s2-0 sp-launch-particles-var) + (s1-0 *sp-particle-system-2d*) + (s0-0 (-> *part-id-table* 178)) + (sv-128 *launch-matrix*) ) - (set! (-> sv-112 quad) v1-9) + (let ((sv-112 (-> sv-128 trans))) + (set! (-> sv-112 quad) (-> (process-drawable-random-point! + (the-as process-drawable (ppointer->process gp-0)) + (new 'stack-no-clear 'vector) + ) + quad + ) + ) + ) + (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (let ((a3-0 #f) - (t0-0 #f) - (t1-0 1.0) - ) - (s2-0 s1-0 s0-0 sv-128 (the-as sparticle-launch-state a3-0) (the-as sparticle-launch-control t0-0) t1-0) - ) - ) - (send-event (ppointer->process gp-0) 'color-effect 'dark (seconds 0.2)) - (when (time-elapsed? (the-as time-frame s4-0) (seconds 0.05)) - (set! s4-0 (the-as int (current-time))) - (cond - ((and (not (time-elapsed? s3-0 (seconds 0.5))) (handle->process arg0)) - (process-drawable2-shock-effect - (the-as process-drawable (handle->process arg0)) - (the-as process-drawable (ppointer->process gp-0)) - (-> *lightning-spec-id-table* 9) - lightning-probe-callback - (-> *part-id-table* 179) + (send-event (ppointer->process gp-0) 'color-effect 'dark (seconds 0.2)) + (when (time-elapsed? (the-as time-frame s4-0) (seconds 0.05)) + (set! s4-0 (the-as int (current-time))) + (cond + ((and (not (time-elapsed? s3-0 (seconds 0.5))) (handle->process arg0)) + (process-drawable2-shock-effect + (the-as process-drawable (handle->process arg0)) + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + ) ) - ) - (else - (send-event (handle->process arg0) 'color-effect 'shock (seconds 0.2)) - (process-drawable-shock-effect - (the-as process-drawable (ppointer->process gp-0)) - (-> *lightning-spec-id-table* 9) - lightning-probe-callback - (-> *part-id-table* 179) - 0 - 0 - 40960.0 + (else + (send-event (handle->process arg0) 'color-effect 'shock (seconds 0.2)) + (process-drawable-shock-effect + (the-as process-drawable (ppointer->process gp-0)) + (-> *lightning-spec-id-table* 9) + lightning-probe-callback + (-> *part-id-table* 179) + 0 + 0 + 40960.0 + ) ) ) ) + (suspend) ) - (suspend) + ) + (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) + (send-event (ppointer->process gp-0) 'color-effect #f 0) + ) + (none) + ) + (process->handle self) + :to s4-0 + ) + ) + ) + (let ((v1-37 arg1)) + (cond + ((or (= v1-37 'spin) (= v1-37 'spin-air) (= v1-37 'board-spin)) + (let ((sv-100 (prims-touching? arg2 (-> self control) (the-as uint 256)))) + (if sv-100 + (part-tracker-spawn + :to self + :group group-spin-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-100 (-> self control) arg2) + ) + (do-effect (-> self skel effect) 'group-spin-hit -1.0 38) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (cond + ((= arg1 'board-spin) + (static-sound-name "board-impact") + ) + ((using-gun? self) + (static-sound-name "gun-spin-hit") + ) + (else + (static-sound-name "spin-hit") + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) + ) + ((or (= v1-37 'punch) (= v1-37 'mech-punch)) + (when arg2 + (let ((sv-128 (prims-touching? arg2 (-> self control) (the-as uint 256)))) + (cond + (sv-128 + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + ) + ) + ((let ((v0-20 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-128 v0-20) + v0-20 + ) + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) + ) + ) + ) + ) + ) + (case arg1 + (('mech-punch) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "mech-punch-hit")) + ) + (else + (let ((t1-6 (if (using-gun? self) + (static-sound-name "gun-punch-hit") + (static-sound-name "punch-hit") + ) + ) + ) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) t1-6) + ) + ) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flip) + (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) + ) + ((= v1-37 'uppercut) + (let ((sv-176 (prims-touching? arg2 (-> self control) (the-as uint 256)))) + (cond + (sv-176 + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) + ) + ) + ((let ((v0-34 (prims-touching? arg2 (-> self control) (the-as uint 128)))) + (set! sv-176 v0-34) + v0-34 + ) + (part-tracker-spawn + :to self + :group group-punch-hit + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) ) ) - (logclear! (-> gp-0 0 mask) (process-mask dark-effect)) - (send-event (ppointer->process gp-0) 'color-effect #f 0) - ) - (none) - ) - (process->handle self) - :to s4-0 + ) + ) + (do-effect (-> self skel effect) 'group-uppercut-hit -1.0 22) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "uppercut-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((or (= v1-37 'flop) (= v1-37 'flop-down)) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 22) + (do-effect (-> self skel effect) 'group-flop-hit -1.0 18) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "flop-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + ) + ((= v1-37 'flut-attack) + (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "punch-hit")) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) + ) + ((= v1-37 'darkjak) + (set-time! (-> self darkjak attack-time)) + (let* ((v1-160 *game-info*) + (a0-102 (+ (-> v1-160 attack-id) 1)) + ) + (set! (-> v1-160 attack-id) a0-102) + (set! (-> self darkjak attack-id) a0-102) + a0-102 + ) + ) ) ) ) - (let ((v1-37 arg1)) - (cond - ((or (= v1-37 'spin) (= v1-37 'spin-air) (= v1-37 'board-spin)) - (set! sv-100 (prims-touching? arg2 (-> self control) (the-as uint 256))) - (cond - (sv-100 - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-8 (method-of-type part-tracker activate))) - (t9-8 (the-as part-tracker s4-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-4 run-function-in-process) - (s2-1 s4-1) - (s1-1 part-tracker-init) - (s0-1 group-spin-hit) - ) - (set! sv-240 0) - (set! sv-256 (the-as symbol #f)) - (set! sv-272 (the-as symbol #f)) - (set! sv-288 (the-as symbol #f)) - (set! sv-320 *launch-matrix*) - (set! sv-304 (-> sv-320 trans)) - (let ((v1-50 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-100 (-> self control) arg2) quad))) - (set! (-> sv-304 quad) v1-50) - ) - ((the-as (function object object object object object object object object none) s3-4) - s2-1 - s1-1 - s0-1 - sv-240 - sv-256 - sv-272 - sv-288 - sv-320 - ) - ) - (-> s4-1 ppointer) - ) - ) - ) - (else - (do-effect (-> self skel effect) 'group-spin-hit -1.0 38) - ) - ) - (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (cond - ((= arg1 'board-spin) - (static-sound-name "board-impact") - ) - ((using-gun? self) - (static-sound-name "gun-spin-hit") - ) - (else - (static-sound-name "spin-hit") - ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)) - ) - ((or (= v1-37 'punch) (= v1-37 'mech-punch)) - (when arg2 - (set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 256))) - (cond - (sv-128 - (let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-3 - (let ((t9-17 (method-of-type part-tracker activate))) - (t9-17 (the-as part-tracker s4-3) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-6 run-function-in-process) - (s2-3 s4-3) - (s1-3 part-tracker-init) - (s0-3 group-punch-hit) - ) - (set! sv-336 0) - (set! sv-352 (the-as symbol #f)) - (set! sv-368 (the-as symbol #f)) - (set! sv-384 (the-as symbol #f)) - (set! sv-416 *launch-matrix*) - (set! sv-400 (-> sv-416 trans)) - (let ((v1-77 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) - (set! (-> sv-400 quad) v1-77) - ) - ((the-as (function object object object object object object object object none) s3-6) - s2-3 - s1-3 - s0-3 - sv-336 - sv-352 - sv-368 - sv-384 - sv-416 - ) - ) - (-> s4-3 ppointer) - ) - ) - ) - ((let ((v0-20 (prims-touching? arg2 (-> self control) (the-as uint 128)))) - (set! sv-128 v0-20) - v0-20 - ) - (let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-4 - (let ((t9-22 (method-of-type part-tracker activate))) - (t9-22 (the-as part-tracker s4-4) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-7 run-function-in-process) - (s2-4 s4-4) - (s1-4 part-tracker-init) - (s0-4 group-punch-hit) - ) - (set! sv-432 0) - (set! sv-448 (the-as symbol #f)) - (set! sv-464 (the-as symbol #f)) - (set! sv-480 (the-as symbol #f)) - (set! sv-512 *launch-matrix*) - (set! sv-496 (-> sv-512 trans)) - (let ((v1-91 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2) quad))) - (set! (-> sv-496 quad) v1-91) - ) - ((the-as (function object object object object object object object object none) s3-7) - s2-4 - s1-4 - s0-4 - sv-432 - sv-448 - sv-464 - sv-480 - sv-512 - ) - ) - (-> s4-4 ppointer) - ) - ) - ) - ) - ) - (case arg1 - (('mech-punch) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "mech-punch-hit")) - ) - (else - (let ((t1-6 (if (using-gun? self) - (static-sound-name "gun-punch-hit") - (static-sound-name "punch-hit") - ) - ) - ) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) t1-6) - ) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-37 'flip) - (play-effect-sound (-> self skel effect) arg1 -1.0 38 (the-as basic #f) (static-sound-name "punch-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)) - ) - ((= v1-37 'uppercut) - (set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 256))) - (cond - (sv-176 - (let ((s4-5 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-5 - (let ((t9-33 (method-of-type part-tracker activate))) - (t9-33 (the-as part-tracker s4-5) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-8 run-function-in-process) - (s2-5 s4-5) - (s1-5 part-tracker-init) - (s0-5 group-punch-hit) - ) - (set! sv-528 0) - (set! sv-544 (the-as symbol #f)) - (set! sv-560 (the-as symbol #f)) - (set! sv-576 (the-as symbol #f)) - (set! sv-608 *launch-matrix*) - (set! sv-592 (-> sv-608 trans)) - (let ((v1-123 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) - (set! (-> sv-592 quad) v1-123) - ) - ((the-as (function object object object object object object object object none) s3-8) - s2-5 - s1-5 - s0-5 - sv-528 - sv-544 - sv-560 - sv-576 - sv-608 - ) - ) - (-> s4-5 ppointer) - ) - ) - ) - ((let ((v0-34 (prims-touching? arg2 (-> self control) (the-as uint 128)))) - (set! sv-176 v0-34) - v0-34 - ) - (let ((s4-6 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-6 - (let ((t9-38 (method-of-type part-tracker activate))) - (t9-38 (the-as part-tracker s4-6) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-9 run-function-in-process) - (s2-6 s4-6) - (s1-6 part-tracker-init) - (s0-6 group-punch-hit) - ) - (set! sv-624 0) - (set! sv-640 (the-as symbol #f)) - (set! sv-656 (the-as symbol #f)) - (set! sv-672 (the-as symbol #f)) - (set! sv-704 *launch-matrix*) - (set! sv-688 (-> sv-704 trans)) - (let ((v1-137 (-> (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2) quad))) - (set! (-> sv-688 quad) v1-137) - ) - ((the-as (function object object object object object object object object none) s3-9) - s2-6 - s1-6 - s0-6 - sv-624 - sv-640 - sv-656 - sv-672 - sv-704 - ) - ) - (-> s4-6 ppointer) - ) - ) - ) - ) - (do-effect (-> self skel effect) 'group-uppercut-hit -1.0 22) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "uppercut-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((or (= v1-37 'flop) (= v1-37 'flop-down)) - (do-effect (-> self skel effect) 'group-flop-hit -1.0 22) - (do-effect (-> self skel effect) 'group-flop-hit -1.0 18) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "flop-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) - ) - ((= v1-37 'flut-attack) - (play-effect-sound (-> self skel effect) arg1 -1.0 22 (the-as basic #f) (static-sound-name "punch-hit")) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.2)) - ) - ((= v1-37 'darkjak) - (set-time! (-> self darkjak attack-time)) - (let* ((v1-160 *game-info*) - (a0-102 (+ (-> v1-160 attack-id) 1)) - ) - (set! (-> v1-160 attack-id) a0-102) - (set! (-> self darkjak attack-id) a0-102) - a0-102 - ) - ) - ) - ) + sv-96 ) ) - sv-96 ) ;; definition for function target-generic-event-handler diff --git a/test/decompiler/reference/jak2/engine/target/target-part_REF.gc b/test/decompiler/reference/jak2/engine/target/target-part_REF.gc index 341194b8cd..5f2bd02752 100644 --- a/test/decompiler/reference/jak2/engine/target/target-part_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-part_REF.gc @@ -102,47 +102,48 @@ ;; definition for function birth-func-target-orient ;; WARN: Return type mismatch int vs none. (defun birth-func-target-orient ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo)) - (local-vars (v1-10 float) (v1-11 float) (sv-16 target)) + (local-vars (v1-10 float) (v1-11 float)) (rlet ((vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-16 *target*) - (when sv-16 - (let ((s3-0 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (let ((s5-0 (new 'stack-no-clear 'quaternion))) - (let ((s2-0 (-> sv-16 control local-normal))) - (set! (-> s3-0 x) (-> s2-0 z)) - (set! (-> s3-0 y) 0.0) - (set! (-> s3-0 z) (- (-> s2-0 x))) - (vector-normalize! s3-0 1.0) - (quaternion-vector-angle! s5-0 s3-0 (acos (-> s2-0 y))) - ) - (let ((s3-1 (new 'stack-no-clear 'quaternion))) - (quaternion-vector-angle! s3-1 *up-vector* (+ 32768.0 (-> arg1 user-float) (y-angle (-> sv-16 control)))) - (quaternion-normalize! (quaternion*! s5-0 s5-0 s3-1)) - ) - (cond - ((< (-> s5-0 w) 0.0) - (.lvf vf1 (&-> arg2 conerot quad)) - (.lvf vf2 (&-> s5-0 quad)) - (.sub.vf.xyz vf1 vf0 vf2) - (.svf (&-> arg2 conerot quad) vf1) - (.mov v1-10 vf1) - ) - (else - (.lvf vf1 (&-> arg2 conerot quad)) - (.lvf vf2 (&-> s5-0 quad)) - (.add.vf.xyz vf1 vf0 vf2) - (.svf (&-> arg2 conerot quad) vf1) - (.mov v1-11 vf1) + (let ((sv-16 *target*)) + (when sv-16 + (let ((s3-0 (new 'stack-no-clear 'vector))) + (new 'stack-no-clear 'vector) + (let ((s5-0 (new 'stack-no-clear 'quaternion))) + (let ((s2-0 (-> sv-16 control local-normal))) + (set! (-> s3-0 x) (-> s2-0 z)) + (set! (-> s3-0 y) 0.0) + (set! (-> s3-0 z) (- (-> s2-0 x))) + (vector-normalize! s3-0 1.0) + (quaternion-vector-angle! s5-0 s3-0 (acos (-> s2-0 y))) + ) + (let ((s3-1 (new 'stack-no-clear 'quaternion))) + (quaternion-vector-angle! s3-1 *up-vector* (+ 32768.0 (-> arg1 user-float) (y-angle (-> sv-16 control)))) + (quaternion-normalize! (quaternion*! s5-0 s5-0 s3-1)) + ) + (cond + ((< (-> s5-0 w) 0.0) + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-0 quad)) + (.sub.vf.xyz vf1 vf0 vf2) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-10 vf1) + ) + (else + (.lvf vf1 (&-> arg2 conerot quad)) + (.lvf vf2 (&-> s5-0 quad)) + (.add.vf.xyz vf1 vf0 vf2) + (.svf (&-> arg2 conerot quad) vf1) + (.mov v1-11 vf1) + ) ) ) ) + 0 ) - 0 ) (none) ) @@ -2605,101 +2606,107 @@ (arg5 int) (arg6 float) ) - (local-vars - (sv-624 (pointer lightning-tracker)) - (sv-640 float) - (sv-656 int) - (sv-672 matrix) - (sv-688 collide-query) - (sv-704 symbol) - (sv-720 vector) - (sv-736 int) - (sv-752 lightning-tracker) - ) - (set! sv-640 arg6) - (let ((s5-0 *lightning-probe-vars*)) - (if (= arg4 256) - (set! sv-656 arg4) - (set! sv-656 (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2))) + (local-vars (sv-656 int)) + (let ((sv-640 arg6) + (s5-0 *lightning-probe-vars*) ) - (set! sv-672 (new 'stack-no-clear 'matrix)) - (set! sv-688 (new 'stack-no-clear 'collide-query)) - (set! sv-704 (the-as symbol #f)) - (when (nonzero? arg4) - (set! sv-656 arg4) - sv-656 - ) - (if (= arg4 256) - (set! (-> sv-688 start-pos quad) (-> arg0 root trans quad)) - (vector<-cspace! (-> sv-688 start-pos) (-> arg0 node-list data sv-656)) - ) - (set! sv-720 (-> sv-688 move-dist)) - (set! (-> sv-720 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-720 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-720 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-720 w) 1.0) - (matrix-rotate-zyx! sv-672 (-> sv-688 move-dist)) - (set! sv-736 6) - (while (nonzero? sv-736) - (set! sv-736 (+ sv-736 -1)) - (vector-rotate*! (-> sv-688 move-dist) (-> s5-0 probe-dirs sv-736) sv-672) - (vector-normalize! (-> sv-688 move-dist) sv-640) - (let ((v1-29 sv-688)) - (set! (-> v1-29 radius) 409.6) - (set! (-> v1-29 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) - (set! (-> v1-29 ignore-process0) arg0) - (set! (-> v1-29 ignore-process1) #f) - (set! (-> v1-29 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-29 action-mask) (collide-action solid)) - ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-688) 0.0) - (set-time! (-> s5-0 last-valid-time)) - (set! (-> s5-0 src-joint-index) (the-as uint sv-656)) - (set! (-> s5-0 end-pos quad) (-> sv-688 best-other-tri intersect quad)) - (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) - (set! sv-704 #t) - (goto cfg-15) - ) - ) - ) - (label cfg-15) - (when sv-704 - (set! sv-752 (the-as lightning-tracker (get-process *default-dead-pool* lightning-tracker #x4000))) - (set! sv-624 - (when sv-752 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 sv-752 arg0 (symbol->string (-> lightning-tracker symbol)) (the-as pointer #x70004000)) - ) - (run-now-in-process - sv-752 - lightning-tracker-init - arg1 - arg5 - arg2 - arg0 - (if (= arg4 256) - (-> arg0 root trans) - (-> s5-0 src-joint-index) + (set! sv-656 (cond + ((= arg4 256) + (set! sv-656 arg4) + sv-656 ) - (-> s5-0 end-pos) - ) - (-> sv-752 ppointer) + (else + (rand-vu-int-range 3 (/ (+ (-> arg0 node-list length) -1) 2)) + ) + ) + ) + (let ((sv-672 (new 'stack-no-clear 'matrix)) + (sv-688 (new 'stack-no-clear 'collide-query)) + (sv-704 (the-as symbol #f)) + ) + (when (nonzero? arg4) + (set! sv-656 arg4) + sv-656 + ) + (if (= arg4 256) + (set! (-> sv-688 start-pos quad) (-> arg0 root trans quad)) + (vector<-cspace! (-> sv-688 start-pos) (-> arg0 node-list data sv-656)) + ) + (let ((sv-720 (-> sv-688 move-dist))) + (set! (-> sv-720 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-720 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-720 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-720 w) 1.0) + ) + (matrix-rotate-zyx! sv-672 (-> sv-688 move-dist)) + (let ((sv-736 6)) + (while (nonzero? sv-736) + (+! sv-736 -1) + (vector-rotate*! (-> sv-688 move-dist) (-> s5-0 probe-dirs sv-736) sv-672) + (vector-normalize! (-> sv-688 move-dist) sv-640) + (let ((v1-29 sv-688)) + (set! (-> v1-29 radius) 409.6) + (set! (-> v1-29 collide-with) (collide-spec backgnd crate obstacle hit-by-others-list pusher)) + (set! (-> v1-29 ignore-process0) arg0) + (set! (-> v1-29 ignore-process1) #f) + (set! (-> v1-29 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-29 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* sv-688) 0.0) + (set-time! (-> s5-0 last-valid-time)) + (set! (-> s5-0 src-joint-index) (the-as uint sv-656)) + (set! (-> s5-0 end-pos quad) (-> sv-688 best-other-tri intersect quad)) + (when (< 8192.0 (vector-vector-distance (-> s5-0 end-pos) (-> sv-688 start-pos))) + (set! sv-704 #t) + (goto cfg-15) ) ) - (when sv-624 - (set! (-> sv-624 0 user-time 0) 0) - (when arg3 - (let ((v1-62 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) - (if v1-62 - (set! (-> v1-62 initial-valuef) (the-as float (-> sv-624 0 duration))) + ) + ) + (label cfg-15) + (when sv-704 + (let* ((sv-752 (get-process *default-dead-pool* lightning-tracker #x4000)) + (sv-624 (the-as (pointer lightning-tracker) (when sv-752 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-752) + arg0 + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process + sv-752 + lightning-tracker-init + arg1 + arg5 + arg2 + arg0 + (if (= arg4 256) + (-> arg0 root trans) + (-> s5-0 src-joint-index) + ) + (-> s5-0 end-pos) + ) + (-> sv-752 ppointer) + ) + ) + ) + ) + (when sv-624 + (set! (-> sv-624 0 user-time 0) 0) + (when arg3 + (let ((v1-62 (get-field-spec-by-id arg3 (sp-field-id spt-timer)))) + (if v1-62 + (set! (-> v1-62 initial-valuef) (the-as float (-> sv-624 0 duration))) + ) ) - ) - (let ((t9-14 sp-launch-particles-var) - (a0-29 *sp-particle-system-2d*) - (a2-7 *launch-matrix*) + (let ((t9-14 sp-launch-particles-var) + (a0-29 *sp-particle-system-2d*) + (a2-7 *launch-matrix*) + ) + (set! (-> a2-7 trans quad) (-> s5-0 end-pos quad)) + (t9-14 a0-29 arg3 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (set! (-> a2-7 trans quad) (-> s5-0 end-pos quad)) - (t9-14 a0-29 arg3 a2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -2720,46 +2727,44 @@ (arg3 (function lightning-tracker none)) (arg4 sparticle-launcher) ) - (local-vars (sv-16 int) (sv-64 vector) (sv-68 vector) (sv-72 (pointer lightning-tracker))) (when (and (nonzero? (-> arg0 skel)) (nonzero? (-> arg1 skel))) (let* ((v1-7 (-> arg0 draw lod-set lod (-> arg0 draw lod-set max-lod) geo num-joints)) (s0-0 (-> arg1 draw lod-set lod (-> arg1 draw lod-set max-lod) geo num-joints)) (s1-0 (rand-vu-int-range 3 (+ v1-7 -1))) - ) - (set! sv-16 (rand-vu-int-range 3 (+ s0-0 -1))) - (set! sv-64 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s1-0))) - (set! sv-68 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 node-list data sv-16))) - (let ((s0-1 (the-as lightning-tracker (get-process *default-dead-pool* lightning-tracker #x4000)))) - (set! sv-72 (when s0-1 - (let ((t9-5 (method-of-type lightning-tracker activate))) - (t9-5 s0-1 arg1 (symbol->string (-> lightning-tracker symbol)) (the-as pointer #x70004000)) - ) - (run-now-in-process s0-1 lightning-tracker-init arg2 0 arg3 arg0 s1-0 sv-16) - (-> s0-1 ppointer) + (sv-16 (rand-vu-int-range 3 (+ s0-0 -1))) + (sv-64 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s1-0))) + (sv-68 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 node-list data sv-16))) + (s0-1 (the-as lightning-tracker (get-process *default-dead-pool* lightning-tracker #x4000))) + (sv-72 (when s0-1 + (let ((t9-5 (method-of-type lightning-tracker activate))) + (t9-5 s0-1 arg1 (symbol->string (-> lightning-tracker symbol)) (the-as pointer #x70004000)) ) + (run-now-in-process s0-1 lightning-tracker-init arg2 0 arg3 arg0 s1-0 sv-16) + (-> s0-1 ppointer) + ) + ) + ) + (when (and arg4 sv-72) + (let ((v1-21 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) + (if v1-21 + (set! (-> v1-21 initial-valuef) (the-as float (-> sv-72 0 duration))) ) - ) - ) - (when (and arg4 sv-72) - (let ((v1-21 (get-field-spec-by-id arg4 (sp-field-id spt-timer)))) - (if v1-21 - (set! (-> v1-21 initial-valuef) (the-as float (-> sv-72 0 duration))) - ) - ) - (let ((t9-8 sp-launch-particles-var) - (a0-20 *sp-particle-system-2d*) - (a1-16 arg4) - (a2-4 *launch-matrix*) - ) - (set! (-> a2-4 trans quad) (-> sv-64 quad)) - (t9-8 a0-20 a1-16 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - (let ((t9-9 sp-launch-particles-var) - (a0-21 *sp-particle-system-2d*) - (a2-5 *launch-matrix*) - ) - (set! (-> a2-5 trans quad) (-> sv-68 quad)) - (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-8 sp-launch-particles-var) + (a0-20 *sp-particle-system-2d*) + (a1-16 arg4) + (a2-4 *launch-matrix*) + ) + (set! (-> a2-4 trans quad) (-> sv-64 quad)) + (t9-8 a0-20 a1-16 a2-4 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-9 sp-launch-particles-var) + (a0-21 *sp-particle-system-2d*) + (a2-5 *launch-matrix*) + ) + (set! (-> a2-5 trans quad) (-> sv-68 quad)) + (t9-9 a0-21 arg4 a2-5 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -2802,23 +2807,6 @@ (arg5 int) (arg6 int) ) - (local-vars - (sv-416 int) - (sv-432 vector) - (sv-448 vector) - (sv-464 vector) - (sv-480 quaternion) - (sv-496 vector) - (sv-512 matrix) - (sv-528 vector) - (sv-544 vector) - (sv-560 process) - (sv-576 int) - (sv-592 (function lightning-control int vector none)) - (sv-608 lightning-control) - (sv-624 int) - (sv-640 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2827,145 +2815,148 @@ (vf7 :class vf) ) (init-vf0-vector) - (let ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo num-joints))) - (set! sv-416 (rand-vu-int-range 4 (+ s1-0 -1))) - (let ((s1-1 (rand-vu-int-range 4 (+ s1-0 -1)))) - (when (!= arg5 -1) - (set! sv-416 arg5) - sv-416 + (let* ((s1-0 (-> arg0 draw lod-set lod (-> arg0 draw cur-lod) geo num-joints)) + (sv-416 (rand-vu-int-range 4 (+ s1-0 -1))) + (s1-1 (rand-vu-int-range 4 (+ s1-0 -1))) + ) + (when (!= arg5 -1) + (set! sv-416 arg5) + sv-416 + ) + (if (!= arg6 -1) + (set! s1-1 arg6) ) - (if (!= arg6 -1) - (set! s1-1 arg6) + (-> arg0 node-list data sv-416) + (let ((s0-1 (-> arg0 node-list data sv-416)) + (a0-9 (-> arg0 node-list data s1-1)) + (v1-18 #t) ) - (-> arg0 node-list data sv-416) - (let ((s0-1 (-> arg0 node-list data sv-416)) - (a0-9 (-> arg0 node-list data s1-1)) - (v1-18 #t) - ) - (until #f - (let ((a1-3 a0-9)) - (until #f - (cond - ((and (-> a1-3 joint) (>= (-> a1-3 joint number) 2)) - (when (= s0-1 a1-3) - #t - (goto cfg-24) - ) - (set! a1-3 (-> a1-3 parent)) + (until #f + (let ((a1-3 a0-9)) + (until #f + (cond + ((and (-> a1-3 joint) (>= (-> a1-3 joint number) 2)) + (when (= s0-1 a1-3) + #t + (goto cfg-24) ) - (else - (set! s0-1 (-> s0-1 parent)) - (when (or (not (-> s0-1 joint)) (< (-> s0-1 joint number) 2)) - (set! v1-18 #f) - (goto cfg-24) - ) - (goto cfg-23) + (set! a1-3 (-> a1-3 parent)) + ) + (else + (set! s0-1 (-> s0-1 parent)) + (when (or (not (-> s0-1 joint)) (< (-> s0-1 joint number) 2)) + (set! v1-18 #f) + (goto cfg-24) ) + (goto cfg-23) ) ) ) - #f - (label cfg-23) ) #f - (label cfg-24) - (when v1-18 - (let ((s5-1 (the-as (array cspace) (new 'stack 'boxed-array cspace 32)))) - (let ((v1-21 0)) - (set! (-> s5-1 length) 0) - (let ((a1-12 (-> arg0 node-list data sv-416)) - (a0-19 (-> arg0 node-list data s1-1)) - ) + (label cfg-23) + ) + #f + (label cfg-24) + (when v1-18 + (let ((s5-1 (the-as (array cspace) (new 'stack 'boxed-array cspace 32)))) + (let ((v1-21 0)) + (set! (-> s5-1 length) 0) + (let ((a1-12 (-> arg0 node-list data sv-416)) + (a0-19 (-> arg0 node-list data s1-1)) + ) + (set! (-> s5-1 (-> s5-1 length)) a1-12) + (+! (-> s5-1 length) 1) + (while (!= a1-12 s0-1) + (set! a1-12 (-> a1-12 parent)) (set! (-> s5-1 (-> s5-1 length)) a1-12) (+! (-> s5-1 length) 1) - (while (!= a1-12 s0-1) - (set! a1-12 (-> a1-12 parent)) - (set! (-> s5-1 (-> s5-1 length)) a1-12) - (+! (-> s5-1 length) 1) - ) - (while (!= a0-19 s0-1) - (set! a0-19 (-> a0-19 parent)) - (+! (-> s5-1 length) 1) - ) ) - (let ((a0-23 (-> arg0 node-list data s1-1))) - (while (!= a0-23 s0-1) - (let ((a1-18 (-> a0-23 parent))) - (+! v1-21 1) - (set! (-> s5-1 (- (-> s5-1 length) v1-21)) a0-23) - (set! a0-23 a1-18) - ) + (while (!= a0-19 s0-1) + (set! a0-19 (-> a0-19 parent)) + (+! (-> s5-1 length) 1) + ) + ) + (let ((a0-23 (-> arg0 node-list data s1-1))) + (while (!= a0-23 s0-1) + (let ((a1-18 (-> a0-23 parent))) + (+! v1-21 1) + (set! (-> s5-1 (- (-> s5-1 length) v1-21)) a0-23) + (set! a0-23 a1-18) ) ) ) - (when (< 2 (-> s5-1 length)) - (let ((s1-2 (new 'stack-no-clear 'vector))) - (set! sv-512 (new 'stack-no-clear 'matrix)) - (let ((s0-2 (new 'stack-no-clear 'vector))) - (set! sv-432 (new 'stack-no-clear 'vector)) - (set! sv-448 (new 'stack-no-clear 'vector)) - (set! sv-464 (new 'stack-no-clear 'vector)) - (set! sv-480 (new 'stack-no-clear 'quaternion)) - (set! sv-496 s1-2) - (set! (-> sv-496 x) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-496 y) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-496 z) (rand-vu-float-range 0.0 65536.0)) - (set! (-> sv-496 w) 1.0) - (matrix-rotate-zyx! sv-512 s1-2) - (vector-rotate*! sv-448 *up-vector* sv-512) - (vector<-cspace! sv-432 (-> s5-1 0)) - (set! sv-544 s0-2) - (set! sv-528 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 0))) - (let ((v0-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 1)))) - (.lvf vf4 (&-> sv-528 quad)) - (.lvf vf5 (&-> v0-10 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-544 quad) vf6) - (vector-normalize! s0-2 1.0) - (set! sv-560 (get-process *default-dead-pool* lightning-tracker #x4000)) - (let ((a0-35 (when sv-560 - (let ((t9-13 (method-of-type lightning-tracker activate))) - (t9-13 - (the-as lightning-tracker sv-560) - arg0 - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (run-now-in-process sv-560 lightning-tracker-init arg1 0 arg2 arg0 #f #f) - (-> sv-560 ppointer) - ) + ) + (when (< 2 (-> s5-1 length)) + (let ((s1-2 (new 'stack-no-clear 'vector)) + (sv-512 (new 'stack-no-clear 'matrix)) + (s0-2 (new 'stack-no-clear 'vector)) + (sv-432 (new 'stack-no-clear 'vector)) + (sv-448 (new 'stack-no-clear 'vector)) + (sv-464 (new 'stack-no-clear 'vector)) + (sv-480 (new 'stack-no-clear 'quaternion)) + ) + (let ((sv-496 s1-2)) + (set! (-> sv-496 x) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-496 y) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-496 z) (rand-vu-float-range 0.0 65536.0)) + (set! (-> sv-496 w) 1.0) + ) + (matrix-rotate-zyx! sv-512 s1-2) + (vector-rotate*! sv-448 *up-vector* sv-512) + (vector<-cspace! sv-432 (-> s5-1 0)) + (let ((sv-544 s0-2)) + (let ((sv-528 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 0))) + (v0-10 (vector<-cspace! (new 'stack-no-clear 'vector) (-> s5-1 1))) + ) + (.lvf vf4 (&-> sv-528 quad)) + (.lvf vf5 (&-> v0-10 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-544 quad) vf6) + ) + (vector-normalize! s0-2 1.0) + (let* ((sv-560 (get-process *default-dead-pool* lightning-tracker #x4000)) + (a0-35 (when sv-560 + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-560) + arg0 + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) ) - ) - (when a0-35 - (set! (-> (the-as lightning-tracker (-> a0-35 0)) user-time 0) 0) - (let ((s4-1 (-> (the-as lightning-tracker (-> a0-35 0)) lightning)) - (s3-1 (new 'stack-no-clear 'vector)) - (s2-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> s4-1 state points-to-draw) 0) - (let ((a1-32 s3-1)) - (let ((v1-46 sv-432)) - (let ((a0-38 sv-448)) - (let ((a2-32 arg4)) - (.mov vf7 a2-32) - ) - (.lvf vf5 (&-> a0-38 quad)) + (run-now-in-process sv-560 lightning-tracker-init arg1 0 arg2 arg0 #f #f) + (-> sv-560 ppointer) ) - (.lvf vf4 (&-> v1-46 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-32 quad) vf6) + ) + (when a0-35 + (set! (-> (the-as lightning-tracker (-> a0-35 0)) user-time 0) 0) + (let ((s4-1 (-> (the-as lightning-tracker (-> a0-35 0)) lightning)) + (s3-1 (new 'stack-no-clear 'vector)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s4-1 state points-to-draw) 0) + (let ((a1-32 s3-1)) + (let ((v1-46 sv-432)) + (let ((a0-38 sv-448)) + (let ((a2-32 arg4)) + (.mov vf7 a2-32) + ) + (.lvf vf5 (&-> a0-38 quad)) ) - (set-point! s4-1 (-> s4-1 state points-to-draw) s3-1) - (+! (-> s4-1 state points-to-draw) 1) - (set! sv-576 0) - (while (< sv-576 (+ (-> s5-1 length) -1)) - (set! sv-640 (new 'stack-no-clear 'vector)) + (.lvf vf4 (&-> v1-46 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-32 quad) vf6) + ) + (set-point! s4-1 (-> s4-1 state points-to-draw) s3-1) + (+! (-> s4-1 state points-to-draw) 1) + (let ((sv-576 0)) + (while (< sv-576 (+ (-> s5-1 length) -1)) + (let ((sv-640 (new 'stack-no-clear 'vector))) (vector<-cspace! sv-640 (-> s5-1 (+ sv-576 1))) (vector-! sv-464 sv-640 sv-432) (vector-normalize! sv-464 1.0) @@ -2987,12 +2978,7 @@ (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> a1-40 quad) vf6) ) - (set! sv-608 s4-1) - (set! sv-592 (method-of-object sv-608 set-point!)) - (set! sv-624 (-> s4-1 state points-to-draw)) - (let ((a2-38 (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1))) - (sv-592 sv-608 sv-624 a2-38) - ) + (set-point! s4-1 (-> s4-1 state points-to-draw) (vector-average! (new 'stack-no-clear 'vector) s2-1 s3-1)) (+! (-> s4-1 state points-to-draw) 1) (set-point! s4-1 (-> s4-1 state points-to-draw) s2-1) (+! (-> s4-1 state points-to-draw) 1) @@ -3000,8 +2986,8 @@ (set! (-> s0-2 quad) (-> (the-as (pointer uint128) sv-464) 0)) (set! (-> sv-448 quad) (-> s1-2 quad)) (set! (-> sv-432 quad) (-> sv-640 quad)) - (set! sv-576 (+ sv-576 1)) ) + (+! sv-576 1) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc b/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc index e213b0c3d8..6b12e44c76 100644 --- a/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-turret_REF.gc @@ -1808,7 +1808,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod turret-init! ((this base-turret) (arg0 entity-actor) (arg1 matrix)) - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 512) (let ((s3-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-others)))) (set! (-> s3-0 dynam) (copy *standard-dynamics* 'process)) @@ -1867,8 +1866,9 @@ (set! (-> this hud) (the-as handle #f)) (base-turret-method-43 this) (set! (-> this alt-actor) (the-as symbol (entity-actor-lookup (-> this entity) 'alt-actor 0))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-49 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-49)) @@ -1941,7 +1941,6 @@ ;; definition for method 41 of type base-turret ;; INFO: Used lq/sq (defmethod base-turret-method-41 ((this base-turret) (arg0 vector)) - (local-vars (sv-592 int)) (let* ((s3-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this init-quat))) (s1-0 (-> this root trans)) (s5-0 (new 'stack-no-clear 'vector)) @@ -1951,27 +1950,28 @@ ) (set! (-> s3-0 y) 0.0) (vector-xz-normalize! s3-0 -18432.0) - (set! sv-592 0) - (while (< sv-592 s0-0) - (vector+! s5-0 s1-0 s3-0) - (vector-rotate-y! s3-0 s3-0 f30-0) - (set! (-> s2-0 start-pos quad) (-> s5-0 quad)) - (set-vector! (-> s2-0 move-dist) 0.0 -24576.0 0.0 0.0) - (+! (-> s2-0 start-pos y) 2048.0) - (let ((v1-9 s2-0)) - (set! (-> v1-9 radius) 409.6) - (set! (-> v1-9 collide-with) (collide-spec backgnd)) - (set! (-> v1-9 ignore-process0) this) - (set! (-> v1-9 ignore-process1) #f) - (set! (-> v1-9 ignore-pat) (-> this root pat-ignore-mask)) - (set! (-> v1-9 action-mask) (collide-action solid)) + (let ((sv-592 0)) + (while (< sv-592 s0-0) + (vector+! s5-0 s1-0 s3-0) + (vector-rotate-y! s3-0 s3-0 f30-0) + (set! (-> s2-0 start-pos quad) (-> s5-0 quad)) + (set-vector! (-> s2-0 move-dist) 0.0 -24576.0 0.0 0.0) + (+! (-> s2-0 start-pos y) 2048.0) + (let ((v1-9 s2-0)) + (set! (-> v1-9 radius) 409.6) + (set! (-> v1-9 collide-with) (collide-spec backgnd)) + (set! (-> v1-9 ignore-process0) this) + (set! (-> v1-9 ignore-process1) #f) + (set! (-> v1-9 ignore-pat) (-> this root pat-ignore-mask)) + (set! (-> v1-9 action-mask) (collide-action solid)) + ) + (when (>= (fill-and-probe-using-line-sphere *collide-cache* s2-0) 0.0) + (set! (-> s5-0 y) (+ 4096.0 (-> s2-0 best-other-tri intersect y))) + (set! (-> arg0 quad) (-> s5-0 quad)) + (return #t) + ) + (+! sv-592 1) ) - (when (>= (fill-and-probe-using-line-sphere *collide-cache* s2-0) 0.0) - (set! (-> s5-0 y) (+ 4096.0 (-> s2-0 best-other-tri intersect y))) - (set! (-> arg0 quad) (-> s5-0 quad)) - (return #t) - ) - (set! sv-592 (+ sv-592 1)) ) ) #f @@ -2035,7 +2035,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod base-turret-method-45 ((this base-turret) (arg0 object) (arg1 symbol)) - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -2058,20 +2057,22 @@ (s1-0 (new 'stack-no-clear 'vector)) (s2-1 (new 'stack-no-clear 'vector)) ) - (set! sv-144 s0-0) - (set! sv-112 s0-0) - (set! sv-128 s5-0) - (let ((f0-2 (+ 20480.0 (base-turret-method-42 this s0-0 s5-0 819200.0)))) - (.lvf vf2 (&-> sv-128 quad)) - (.lvf vf1 (&-> sv-112 quad)) - (let ((v1-25 f0-2)) - (.mov vf3 v1-25) + (let ((sv-144 s0-0)) + (let ((sv-112 s0-0) + (sv-128 s5-0) + (f0-2 (+ 20480.0 (base-turret-method-42 this s0-0 s5-0 819200.0))) + ) + (.lvf vf2 (&-> sv-128 quad)) + (.lvf vf1 (&-> sv-112 quad)) + (let ((v1-25 f0-2)) + (.mov vf3 v1-25) + ) ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-144 quad) vf4) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-144 quad) vf4) (vector-! s1-0 s0-0 s4-1) (vector-! s2-1 s0-0 s3-1) (vector-normalize! s1-0 1.0) diff --git a/test/decompiler/reference/jak2/engine/target/target2_REF.gc b/test/decompiler/reference/jak2/engine/target/target2_REF.gc index 122e4209cd..24aa303e6e 100644 --- a/test/decompiler/reference/jak2/engine/target/target2_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target2_REF.gc @@ -1344,63 +1344,65 @@ process (lambda :behavior target ((arg0 vector) (arg1 time-frame) (arg2 float)) - (local-vars (sv-32 time-frame) (sv-40 vector) (sv-44 symbol)) - (set! sv-32 (current-time)) - (let ((v1-2 (new-stack-vector0))) + (let ((sv-32 (current-time)) + (v1-2 (new-stack-vector0)) + ) (set! (-> v1-2 quad) (-> arg0 quad)) - (set! sv-40 v1-2) - ) - (set! sv-44 #t) - (until (time-elapsed? sv-32 arg1) - (let ((s4-0 (ppointer->process (-> self parent)))) - (cond - ((and sv-44 - (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control last-trans-any-surf y)) arg2) - ) - (vector-xz-normalize! (-> (the-as target s4-0) control transv) 0.0) - (when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0) - (let ((v1-15 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) - (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -2867.2 (fmin 2867.2 (-> v1-15 x))))) - (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-15 z))))) - ) - ) - ) - (else - (if sv-44 - (set! sv-32 (current-time)) - ) - (set! sv-44 (the-as symbol #f)) - (when (and (-> (the-as target s4-0) next-state) - (let ((v1-25 (-> (the-as target s4-0) next-state name))) - (or (= v1-25 'target-duck-high-jump-jump) (= v1-25 'target-falling)) - ) - ) - (let ((v1-28 (-> (the-as target s4-0) control trans)) - (s3-0 (-> (the-as target s4-0) control transv)) + (let ((sv-40 v1-2) + (sv-44 #t) + ) + (until (time-elapsed? sv-32 arg1) + (let ((s4-0 (ppointer->process (-> self parent)))) + (cond + ((and sv-44 + (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control last-trans-any-surf y)) arg2) ) - (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-28 x))) - (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-28 z))) - (let* ((v1-29 s3-0) - (f30-0 (sqrtf (+ (* (-> v1-29 x) (-> v1-29 x)) (* (-> v1-29 z) (-> v1-29 z))))) - ) - (if (< 122880.0 f30-0) - (vector-xz-normalize! s3-0 122880.0) - ) - (if (< 4096.0 f30-0) - (forward-up-nopitch->quaternion - (-> (the-as target s4-0) control dir-targ) - (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0) - (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)) + (vector-xz-normalize! (-> (the-as target s4-0) control transv) 0.0) + (when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0) + (let ((v1-15 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40))) + (set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -2867.2 (fmin 2867.2 (-> v1-15 x))))) + (set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-15 z))))) + ) + ) + ) + (else + (if sv-44 + (set! sv-32 (current-time)) + ) + (set! sv-44 (the-as symbol #f)) + (when (and (-> (the-as target s4-0) next-state) + (let ((v1-25 (-> (the-as target s4-0) next-state name))) + (or (= v1-25 'target-duck-high-jump-jump) (= v1-25 'target-falling)) + ) + ) + (let ((v1-28 (-> (the-as target s4-0) control trans)) + (s3-0 (-> (the-as target s4-0) control transv)) ) + (set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-28 x))) + (set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-28 z))) + (let* ((v1-29 s3-0) + (f30-0 (sqrtf (+ (* (-> v1-29 x) (-> v1-29 x)) (* (-> v1-29 z) (-> v1-29 z))))) + ) + (if (< 122880.0 f30-0) + (vector-xz-normalize! s3-0 122880.0) + ) + (if (< 4096.0 f30-0) + (forward-up-nopitch->quaternion + (-> (the-as target s4-0) control dir-targ) + (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat)) + ) + ) ) + ) ) ) ) ) + (suspend) + 0 ) ) - (suspend) - 0 ) (none) ) diff --git a/test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc b/test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc index d7cdf35c7a..b694e95479 100644 --- a/test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/bigmap_REF.gc @@ -234,14 +234,14 @@ ;; definition for method 22 of type bigmap ;; WARN: Return type mismatch int vs none. (defmethod texture-upload-dma ((this bigmap) (arg0 dma-buffer) (arg1 (pointer uint32)) (arg2 int) (arg3 int) (arg4 int) (arg5 gs-psm)) - (local-vars (sv-16 int)) - (set! sv-16 arg2) - (dma-buffer-add-gs-set arg0 - (bitbltbuf (new 'static 'gs-bitbltbuf :dpsm (the-as int arg5) :dbp sv-16 :dbw (/ arg3 64))) - (trxpos (new 'static 'gs-trxpos)) - (trxreg (new 'static 'gs-trxreg :rrw arg3 :rrh arg4)) - (trxdir (new 'static 'gs-trxdir)) - ) + (let ((sv-16 arg2)) + (dma-buffer-add-gs-set arg0 + (bitbltbuf (new 'static 'gs-bitbltbuf :dpsm (the-as int arg5) :dbp sv-16 :dbw (/ arg3 64))) + (trxpos (new 'static 'gs-trxpos)) + (trxreg (new 'static 'gs-trxreg :rrw arg3 :rrh arg4)) + (trxdir (new 'static 'gs-trxdir)) + ) + ) (dma-buffer-add-ref-texture arg0 arg1 arg3 arg4 arg5) 0 (none) @@ -542,14 +542,12 @@ ) ) (else - (let* ((f0-1 (* 131072.0 (-> this offset w))) - (f30-0 (* f0-1 f0-1)) + (let* ((f30-0 (square (* 131072.0 (-> this offset w)))) (s4-2 (the int (* 131072.0 (-> this offset w)))) (s5-2 (- s4-2)) ) (while (>= s4-2 s5-2) - (let* ((f0-7 (the float s5-2)) - (s2-0 (the int (sqrtf (- f30-0 (* f0-7 f0-7))))) + (let* ((s2-0 (the int (sqrtf (- f30-0 (square (the float s5-2)))))) (s3-1 (- s2-0)) ) (while (>= s2-0 s3-1) @@ -580,7 +578,6 @@ ;; definition for method 11 of type bigmap ;; INFO: Used lq/sq (defmethod draw ((this bigmap) (arg0 int) (arg1 int) (arg2 int) (arg3 int)) - (local-vars (sv-96 pointer) (sv-100 texture) (sv-104 matrix) (sv-112 int)) (when (and (= (file-status (-> this bigmap-image) "world-map" (the-as int (-> this load-index))) 'active) (not (-> this loading-flag)) ) @@ -655,80 +652,75 @@ (vector-xz-normalize! s3-3 -1.0) (set! (-> s3-3 y) 0.0) (set! (-> s3-3 w) 0.0) - (set! sv-96 (-> s4-2 base)) - (set! sv-100 (get-texture map-target-marker common)) - (set! sv-104 (new 'stack-no-clear 'matrix)) - (set! sv-112 (the int (* 56.0 f30-0))) - (when sv-100 - (set-pos! this (target-pos 0)) - (if (-> *blit-displays-work* horizontal-flip-flag) - (set! f30-0 (- f30-0)) + (let ((sv-96 (-> s4-2 base)) + (sv-100 (get-texture map-target-marker common)) + (sv-104 (new 'stack-no-clear 'matrix)) ) - (set-vector! (-> (the-as matrix sv-104) vector 0) (* (-> s3-3 z) f30-0) 0.0 (- (-> s3-3 x)) 0.0) - (set-vector! (-> (the-as matrix sv-104) vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> (the-as matrix sv-104) vector 2) (* (-> s3-3 x) f30-0) 0.0 (-> s3-3 z) 1.0) - (set-vector! - (-> (the-as matrix sv-104) trans) - (+ (the float (-> this x0)) (* 2.0 f30-0 (the float (-> this pos x)))) - 0.0 - (- (the float (+ (* (-> this pos y) 2) 1840)) (-> this scroll y)) - 1.0 + (let ((sv-112 (the int (* 56.0 f30-0)))) ) - (set-vector! (-> this corner 0) 0.0 0.0 -7.0 1.0) - (set-vector! (-> this corner 1) 7.0 0.0 0.0 1.0) - (set-vector! (-> this corner 2) -7.0 0.0 0.0 1.0) - (set-vector! (-> this corner 3) 0.0 0.0 7.0 1.0) - (vector-matrix*! (-> this corner 0) (-> this corner 0) sv-104) - (vector-matrix*! (-> this corner 1) (-> this corner 1) sv-104) - (vector-matrix*! (-> this corner 2) (-> this corner 2) sv-104) - (vector-matrix*! (-> this corner 3) (-> this corner 3) sv-104) - (let ((v1-101 (-> this adgif-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-96)) v1-101) + (when sv-100 + (set-pos! this (target-pos 0)) + (if (-> *blit-displays-work* horizontal-flip-flag) + (set! f30-0 (- f30-0)) + ) + (set-vector! (-> (the-as matrix sv-104) vector 0) (* (-> s3-3 z) f30-0) 0.0 (- (-> s3-3 x)) 0.0) + (set-vector! (-> (the-as matrix sv-104) vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> (the-as matrix sv-104) vector 2) (* (-> s3-3 x) f30-0) 0.0 (-> s3-3 z) 1.0) + (set-vector! + (-> (the-as matrix sv-104) trans) + (+ (the float (-> this x0)) (* 2.0 f30-0 (the float (-> this pos x)))) + 0.0 + (- (the float (+ (* (-> this pos y) 2) 1840)) (-> this scroll y)) + 1.0 + ) + (set-vector! (-> this corner 0) 0.0 0.0 -7.0 1.0) + (set-vector! (-> this corner 1) 7.0 0.0 0.0 1.0) + (set-vector! (-> this corner 2) -7.0 0.0 0.0 1.0) + (set-vector! (-> this corner 3) 0.0 0.0 7.0 1.0) + (vector-matrix*! (-> this corner 0) (-> this corner 0) sv-104) + (vector-matrix*! (-> this corner 1) (-> this corner 1) sv-104) + (vector-matrix*! (-> this corner 2) (-> this corner 2) sv-104) + (vector-matrix*! (-> this corner 3) (-> this corner 3) sv-104) + (set! (-> (the-as (pointer uint128) sv-96)) (-> this adgif-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-96) 1) (-> this adgif-tmpl quad 1)) + (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-96 32)) sv-100) + (set! (-> (the-as (pointer uint128) sv-96) 7) (-> this draw-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-96) 8) (-> this draw-tmpl quad 1)) + (set-vector! (the-as vector4w (&+ sv-96 144)) 0 255 255 128) + (set-vector! (the-as vector4w (&+ sv-96 160)) 0 0 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 176)) + (the int (* 16.0 (-> this corner 0 x))) + (the int (* 16.0 (-> this corner 0 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 192)) 256 0 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 208)) + (the int (* 16.0 (-> this corner 1 x))) + (the int (* 16.0 (-> this corner 1 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 224)) 0 256 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 240)) + (the int (* 16.0 (-> this corner 2 x))) + (the int (* 16.0 (-> this corner 2 z))) + #xffffff + 0 + ) + (set-vector! (the-as vector4w (&+ sv-96 256)) 256 256 0 0) + (set-vector! + (the-as vector4w (&+ sv-96 272)) + (the int (* 16.0 (-> this corner 3 x))) + (the int (* 16.0 (-> this corner 3 z))) + #xffffff + 0 + ) + (&+! (-> s4-2 base) 288) ) - (let ((v1-102 (-> this adgif-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-96) 1) v1-102) - ) - (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-96 32)) sv-100) - (let ((v1-104 (-> this draw-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-96) 7) v1-104) - ) - (let ((v1-105 (-> this draw-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-96) 8) v1-105) - ) - (set-vector! (the-as vector4w (&+ sv-96 144)) 0 255 255 128) - (set-vector! (the-as vector4w (&+ sv-96 160)) 0 0 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 176)) - (the int (* 16.0 (-> this corner 0 x))) - (the int (* 16.0 (-> this corner 0 z))) - #xffffff - 0 - ) - (set-vector! (the-as vector4w (&+ sv-96 192)) 256 0 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 208)) - (the int (* 16.0 (-> this corner 1 x))) - (the int (* 16.0 (-> this corner 1 z))) - #xffffff - 0 - ) - (set-vector! (the-as vector4w (&+ sv-96 224)) 0 256 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 240)) - (the int (* 16.0 (-> this corner 2 x))) - (the int (* 16.0 (-> this corner 2 z))) - #xffffff - 0 - ) - (set-vector! (the-as vector4w (&+ sv-96 256)) 256 256 0 0) - (set-vector! - (the-as vector4w (&+ sv-96 272)) - (the int (* 16.0 (-> this corner 3 x))) - (the int (* 16.0 (-> this corner 3 z))) - #xffffff - 0 - ) - (&+! (-> s4-2 base) 288) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/ui/hud-classes_REF.gc b/test/decompiler/reference/jak2/engine/ui/hud-classes_REF.gc index abdb132d82..b62c1f6de9 100644 --- a/test/decompiler/reference/jak2/engine/ui/hud-classes_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/hud-classes_REF.gc @@ -897,7 +897,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw ((this hud-gun)) - (local-vars (s3-0 int) (sv-16 int) (sv-32 dma-buffer)) + (local-vars (s3-0 int)) (let ((s4-0 0) (s5-0 0) ) @@ -982,25 +982,27 @@ (if (and (zero? s0-0) (nonzero? (-> this values 1 current))) (set! s0-0 s2-0) ) - (set! sv-32 (-> *display* frames (-> *display* on-screen) global-buf)) - (let ((s1-0 (-> sv-32 base))) - (set! sv-16 0) - (while (< sv-16 s2-0) - (if (= sv-16 s0-0) - (set! (-> this sprites 6 tex) (get-texture hud-gun-empty-shell-01 level-default-minimap)) - ) - (draw (-> this sprites 6) sv-32 (-> this level)) - (+! (-> this sprites 6 pos y) -5) - (if (= sv-16 (+ (/ s2-0 2) -1)) - (set-as-offset-from! (-> this sprites 6) (-> this sprites 0 pos) (+ s4-0 -83) (+ (if (= s2-0 20) - 98 - 73 - ) - s5-0 - ) - ) - ) - (set! sv-16 (+ sv-16 1)) + (let* ((sv-32 (-> *display* frames (-> *display* on-screen) global-buf)) + (s1-0 (-> sv-32 base)) + ) + (let ((sv-16 0)) + (while (< sv-16 s2-0) + (if (= sv-16 s0-0) + (set! (-> this sprites 6 tex) (get-texture hud-gun-empty-shell-01 level-default-minimap)) + ) + (draw (-> this sprites 6) sv-32 (-> this level)) + (+! (-> this sprites 6 pos y) -5) + (if (= sv-16 (+ (/ s2-0 2) -1)) + (set-as-offset-from! (-> this sprites 6) (-> this sprites 0 pos) (+ s4-0 -83) (+ (if (= s2-0 20) + 98 + 73 + ) + s5-0 + ) + ) + ) + (+! sv-16 1) + ) ) (let ((a3-5 (-> sv-32 base))) (let ((v1-67 (the-as dma-packet (-> sv-32 base)))) diff --git a/test/decompiler/reference/jak2/engine/ui/hud_REF.gc b/test/decompiler/reference/jak2/engine/ui/hud_REF.gc index 1cee353ee0..cdd729a1ec 100644 --- a/test/decompiler/reference/jak2/engine/ui/hud_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/hud_REF.gc @@ -487,209 +487,205 @@ (t2-1 int) (t3-0 int) (t6-0 int) - (sv-16 level) - (sv-32 hud-sprite-work) ) - (set! sv-16 arg1) - (let ((s1-0 arg2) + (let ((sv-16 arg1) + (s1-0 arg2) (s2-0 arg3) (s3-0 arg4) (s4-0 arg5) + (sv-32 *hud-sprite-work*) + (s0-0 (-> this tex)) + (f28-0 0.0) + (f30-0 1.0) ) - (set! sv-32 *hud-sprite-work*) - (let ((s0-0 (-> this tex)) - (f28-0 0.0) - (f30-0 1.0) - ) - (when (!= (-> this angle) 0.0) - (set! f28-0 (sin (-> this angle))) - (set! f30-0 (cos (-> this angle))) + (when (!= (-> this angle) 0.0) + (set! f28-0 (sin (-> this angle))) + (set! f30-0 (cos (-> this angle))) + ) + (when s0-0 + (let ((v1-6 (-> sv-16 texture-mask 8 mask quad)) + (a0-3 (-> s0-0 masks data 0 mask quad)) + ) + (.por v1-7 v1-6 a0-3) ) - (when s0-0 - (let ((v1-6 (-> sv-16 texture-mask 8 mask quad)) - (a0-3 (-> s0-0 masks data 0 mask quad)) - ) - (.por v1-7 v1-6 a0-3) + (set! (-> sv-16 texture-mask 8 mask quad) v1-7) + (let ((v1-8 (-> arg0 base))) + (set! (-> (the-as (pointer uint128) v1-8)) (-> sv-32 adgif-tmpl dma-vif quad)) + (let ((a0-8 (-> sv-32 adgif-tmpl quad 1))) + (s.q! (+ v1-8 16) a0-8) ) - (set! (-> sv-16 texture-mask 8 mask quad) v1-7) - (let ((v1-8 (-> arg0 base))) - (set! (-> (the-as (pointer uint128) v1-8)) (-> sv-32 adgif-tmpl dma-vif quad)) - (let ((a0-8 (-> sv-32 adgif-tmpl quad 1))) - (s.q! (+ v1-8 16) a0-8) - ) - (adgif-shader<-texture-simple! (the-as adgif-shader (&+ v1-8 32)) s0-0) - ) - (&+! (-> arg0 base) 112) - (let ((v1-11 (-> arg0 base)) - (t1-1 (the int (* f30-0 (the float s1-0) (-> this scale-x) (-> *video-params* relative-x-scale)))) - (t0-1 (the int (* -1.0 (-> this scale-x) (the float s1-0) f28-0))) - (t5-0 (the int (* f28-0 (the float s2-0) (-> this scale-y) (-> *video-params* relative-x-scale)))) - (t4-0 (the int (* f30-0 (the float s2-0) (-> this scale-y)))) - (a0-14 (if (nonzero? (-> this pos z)) - (-> this pos z) - #xffffff - ) - ) - ) - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - (cond - ((logtest? (-> this flags) 4) - (set! a3-1 (+ (-> this pos x) 1792)) - (set! t2-1 (+ (-> this pos y) 1840)) - (set! a1-14 (- a3-1 t1-1)) - (set! a2-1 (- t2-1 t0-1)) - (set! t3-0 (+ (- a3-1 t1-1) t5-0)) - (set! t6-0 (+ (- t2-1 t0-1) t4-0)) - (set! t1-3 (+ a3-1 t5-0)) - (set! t0-3 (+ t2-1 t4-0)) - ) - ((logtest? (-> this flags) 8) - (set! a1-14 (+ (- 1792 (the int (* 0.5 (the float (+ t1-1 t5-0))))) (-> this pos x))) - (set! a2-1 (+ (- 1840 (the int (* 0.5 (the float (+ t0-1 t4-0))))) (-> this pos y))) - (set! a3-1 (+ (the int (* 0.5 (the float (+ t1-1 t5-0)))) 1792 (-> this pos x))) - (set! t2-1 (+ (- 1840 (the int (* 0.5 (the float (+ t0-1 t4-0))))) (-> this pos y))) - (set! t3-0 (+ (- 1792 (the int (* 0.5 (the float (+ t1-1 t5-0))))) (-> this pos x))) - (set! t6-0 (+ (the int (* 0.5 (the float (+ t0-1 t4-0)))) 1840 (-> this pos y))) - (set! t1-3 (+ (the int (* 0.5 (the float (+ t1-1 t5-0)))) 1792 (-> this pos x))) - (set! t0-3 (+ (the int (* 0.5 (the float (+ t0-1 t4-0)))) 1840 (-> this pos y))) - ) - (else - (set! a1-14 (+ (-> this pos x) 1792)) - (set! a2-1 (+ (-> this pos y) 1840)) - (set! a3-1 (+ a1-14 t1-1)) - (set! t2-1 (+ a2-1 t0-1)) - (set! t3-0 (+ a1-14 t5-0)) - (set! t6-0 (+ a2-1 t4-0)) - (set! t1-3 (+ a1-14 t1-1 t5-0)) - (set! t0-3 (+ a2-1 t0-1 t4-0)) - ) - ) - (set! (-> (the-as (pointer uint128) v1-11)) (-> sv-32 draw-tmpl dma-vif quad)) - (let ((t4-8 (-> sv-32 draw-tmpl quad 1))) - (s.q! (+ v1-11 16) t4-8) - ) - (let ((t4-9 (-> this color quad))) - (s.q! (+ v1-11 32) t4-9) - ) - (let ((t4-10 (-> this color quad))) - (s.q! (+ v1-11 80) t4-10) - ) - (let ((t4-11 (-> this color quad))) - (s.q! (+ v1-11 128) t4-11) - ) - (let ((t4-12 (-> this color quad))) - (s.q! (+ v1-11 176) t4-12) - ) - (let* ((t5-3 (-> s0-0 w)) - (t4-13 (-> s0-0 h)) - (f1-27 (/ (the float s1-0) (the float t5-3))) - (f2-2 (/ (the float s2-0) (the float t4-13))) - (f0-55 (* (the float s3-0) f1-27)) - (f3-2 (the-as number (* (the float s4-0) f2-2))) - (f1-28 (+ f0-55 f1-27)) - (f2-3 (+ (the-as float f3-2) f2-2)) - ) - (when (logtest? (-> this flags) 1) - (let ((f4-0 f0-55)) - (set! f0-55 f1-28) - (set! f1-28 f4-0) - ) - ) - (when (logtest? (-> this flags) 2) - (set! f2-3 (the-as float f3-2)) - (set! f3-2 (gpr->fpr t5-3)) - ) - (let ((t4-22 (&+ v1-11 48))) - (set! (-> (the-as (pointer float) t4-22)) f0-55) - (s.f! (+ t4-22 4) f3-2) - (let ((f4-1 1.0)) - (s.f! (+ t4-22 8) f4-1) - ) - (let ((f4-2 0.0)) - (s.f! (+ t4-22 12) f4-2) - ) - ) - (let ((t4-23 (&+ v1-11 96))) - (set! (-> (the-as (pointer float) t4-23)) f1-28) - (s.f! (+ t4-23 4) f3-2) - (let ((f3-3 1.0)) - (s.f! (+ t4-23 8) f3-3) - ) - (let ((f3-4 0.0)) - (s.f! (+ t4-23 12) f3-4) - ) - ) - (let ((t4-24 (&+ v1-11 144))) - (set! (-> (the-as (pointer float) t4-24)) f0-55) - (s.f! (+ t4-24 4) f2-3) - (let ((f0-56 1.0)) - (s.f! (+ t4-24 8) f0-56) - ) - (let ((f0-57 0.0)) - (s.f! (+ t4-24 12) f0-57) - ) - ) - (let ((t4-25 (&+ v1-11 192))) - (set! (-> (the-as (pointer float) t4-25)) f1-28) - (s.f! (+ t4-25 4) f2-3) - (let ((f0-58 1.0)) - (s.f! (+ t4-25 8) f0-58) - ) - (let ((f0-59 0.0)) - (s.f! (+ t4-25 12) f0-59) - ) - ) - ) - (let ((t4-26 (&+ v1-11 64))) - (set! (-> (the-as (pointer int32) t4-26)) (* a1-14 16)) - (let ((a1-21 (* a2-1 16))) - (s.w! (+ t4-26 4) a1-21) - ) - (s.w! (+ t4-26 8) a0-14) - (let ((a1-22 #x10000)) - (s.w! (+ t4-26 12) a1-22) - ) - ) - (let ((a1-23 (&+ v1-11 112))) - (set! (-> (the-as (pointer int32) a1-23)) (* a3-1 16)) - (let ((a2-10 (* t2-1 16))) - (s.w! (+ a1-23 4) a2-10) - ) - (s.w! (+ a1-23 8) a0-14) - (let ((a2-11 #x10000)) - (s.w! (+ a1-23 12) a2-11) - ) - ) - (let ((a1-24 (&+ v1-11 160))) - (set! (-> (the-as (pointer int32) a1-24)) (* t3-0 16)) - (let ((a2-13 (* t6-0 16))) - (s.w! (+ a1-24 4) a2-13) - ) - (s.w! (+ a1-24 8) a0-14) - (let ((a2-14 #x10000)) - (s.w! (+ a1-24 12) a2-14) - ) - ) - (let ((v1-12 (&+ v1-11 208))) - (set! (-> (the-as (pointer int32) v1-12)) (* t1-3 16)) - (let ((a1-26 (* t0-3 16))) - (s.w! (+ v1-12 4) a1-26) - ) - (s.w! (+ v1-12 8) a0-14) - (let ((a0-15 #x10000)) - (s.w! (+ v1-12 12) a0-15) - ) - ) - ) - (&+! (-> arg0 base) 224) + (adgif-shader<-texture-simple! (the-as adgif-shader (&+ v1-8 32)) s0-0) ) + (&+! (-> arg0 base) 112) + (let ((v1-11 (-> arg0 base)) + (t1-1 (the int (* f30-0 (the float s1-0) (-> this scale-x) (-> *video-params* relative-x-scale)))) + (t0-1 (the int (* -1.0 (-> this scale-x) (the float s1-0) f28-0))) + (t5-0 (the int (* f28-0 (the float s2-0) (-> this scale-y) (-> *video-params* relative-x-scale)))) + (t4-0 (the int (* f30-0 (the float s2-0) (-> this scale-y)))) + (a0-14 (if (nonzero? (-> this pos z)) + (-> this pos z) + #xffffff + ) + ) + ) + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + (cond + ((logtest? (-> this flags) 4) + (set! a3-1 (+ (-> this pos x) 1792)) + (set! t2-1 (+ (-> this pos y) 1840)) + (set! a1-14 (- a3-1 t1-1)) + (set! a2-1 (- t2-1 t0-1)) + (set! t3-0 (+ (- a3-1 t1-1) t5-0)) + (set! t6-0 (+ (- t2-1 t0-1) t4-0)) + (set! t1-3 (+ a3-1 t5-0)) + (set! t0-3 (+ t2-1 t4-0)) + ) + ((logtest? (-> this flags) 8) + (set! a1-14 (+ (- 1792 (the int (* 0.5 (the float (+ t1-1 t5-0))))) (-> this pos x))) + (set! a2-1 (+ (- 1840 (the int (* 0.5 (the float (+ t0-1 t4-0))))) (-> this pos y))) + (set! a3-1 (+ (the int (* 0.5 (the float (+ t1-1 t5-0)))) 1792 (-> this pos x))) + (set! t2-1 (+ (- 1840 (the int (* 0.5 (the float (+ t0-1 t4-0))))) (-> this pos y))) + (set! t3-0 (+ (- 1792 (the int (* 0.5 (the float (+ t1-1 t5-0))))) (-> this pos x))) + (set! t6-0 (+ (the int (* 0.5 (the float (+ t0-1 t4-0)))) 1840 (-> this pos y))) + (set! t1-3 (+ (the int (* 0.5 (the float (+ t1-1 t5-0)))) 1792 (-> this pos x))) + (set! t0-3 (+ (the int (* 0.5 (the float (+ t0-1 t4-0)))) 1840 (-> this pos y))) + ) + (else + (set! a1-14 (+ (-> this pos x) 1792)) + (set! a2-1 (+ (-> this pos y) 1840)) + (set! a3-1 (+ a1-14 t1-1)) + (set! t2-1 (+ a2-1 t0-1)) + (set! t3-0 (+ a1-14 t5-0)) + (set! t6-0 (+ a2-1 t4-0)) + (set! t1-3 (+ a1-14 t1-1 t5-0)) + (set! t0-3 (+ a2-1 t0-1 t4-0)) + ) + ) + (set! (-> (the-as (pointer uint128) v1-11)) (-> sv-32 draw-tmpl dma-vif quad)) + (let ((t4-8 (-> sv-32 draw-tmpl quad 1))) + (s.q! (+ v1-11 16) t4-8) + ) + (let ((t4-9 (-> this color quad))) + (s.q! (+ v1-11 32) t4-9) + ) + (let ((t4-10 (-> this color quad))) + (s.q! (+ v1-11 80) t4-10) + ) + (let ((t4-11 (-> this color quad))) + (s.q! (+ v1-11 128) t4-11) + ) + (let ((t4-12 (-> this color quad))) + (s.q! (+ v1-11 176) t4-12) + ) + (let* ((t5-3 (-> s0-0 w)) + (t4-13 (-> s0-0 h)) + (f1-27 (/ (the float s1-0) (the float t5-3))) + (f2-2 (/ (the float s2-0) (the float t4-13))) + (f0-55 (* (the float s3-0) f1-27)) + (f3-2 (the-as number (* (the float s4-0) f2-2))) + (f1-28 (+ f0-55 f1-27)) + (f2-3 (+ (the-as float f3-2) f2-2)) + ) + (when (logtest? (-> this flags) 1) + (let ((f4-0 f0-55)) + (set! f0-55 f1-28) + (set! f1-28 f4-0) + ) + ) + (when (logtest? (-> this flags) 2) + (set! f2-3 (the-as float f3-2)) + (set! f3-2 (gpr->fpr t5-3)) + ) + (let ((t4-22 (&+ v1-11 48))) + (set! (-> (the-as (pointer float) t4-22)) f0-55) + (s.f! (+ t4-22 4) f3-2) + (let ((f4-1 1.0)) + (s.f! (+ t4-22 8) f4-1) + ) + (let ((f4-2 0.0)) + (s.f! (+ t4-22 12) f4-2) + ) + ) + (let ((t4-23 (&+ v1-11 96))) + (set! (-> (the-as (pointer float) t4-23)) f1-28) + (s.f! (+ t4-23 4) f3-2) + (let ((f3-3 1.0)) + (s.f! (+ t4-23 8) f3-3) + ) + (let ((f3-4 0.0)) + (s.f! (+ t4-23 12) f3-4) + ) + ) + (let ((t4-24 (&+ v1-11 144))) + (set! (-> (the-as (pointer float) t4-24)) f0-55) + (s.f! (+ t4-24 4) f2-3) + (let ((f0-56 1.0)) + (s.f! (+ t4-24 8) f0-56) + ) + (let ((f0-57 0.0)) + (s.f! (+ t4-24 12) f0-57) + ) + ) + (let ((t4-25 (&+ v1-11 192))) + (set! (-> (the-as (pointer float) t4-25)) f1-28) + (s.f! (+ t4-25 4) f2-3) + (let ((f0-58 1.0)) + (s.f! (+ t4-25 8) f0-58) + ) + (let ((f0-59 0.0)) + (s.f! (+ t4-25 12) f0-59) + ) + ) + ) + (let ((t4-26 (&+ v1-11 64))) + (set! (-> (the-as (pointer int32) t4-26)) (* a1-14 16)) + (let ((a1-21 (* a2-1 16))) + (s.w! (+ t4-26 4) a1-21) + ) + (s.w! (+ t4-26 8) a0-14) + (let ((a1-22 #x10000)) + (s.w! (+ t4-26 12) a1-22) + ) + ) + (let ((a1-23 (&+ v1-11 112))) + (set! (-> (the-as (pointer int32) a1-23)) (* a3-1 16)) + (let ((a2-10 (* t2-1 16))) + (s.w! (+ a1-23 4) a2-10) + ) + (s.w! (+ a1-23 8) a0-14) + (let ((a2-11 #x10000)) + (s.w! (+ a1-23 12) a2-11) + ) + ) + (let ((a1-24 (&+ v1-11 160))) + (set! (-> (the-as (pointer int32) a1-24)) (* t3-0 16)) + (let ((a2-13 (* t6-0 16))) + (s.w! (+ a1-24 4) a2-13) + ) + (s.w! (+ a1-24 8) a0-14) + (let ((a2-14 #x10000)) + (s.w! (+ a1-24 12) a2-14) + ) + ) + (let ((v1-12 (&+ v1-11 208))) + (set! (-> (the-as (pointer int32) v1-12)) (* t1-3 16)) + (let ((a1-26 (* t0-3 16))) + (s.w! (+ v1-12 4) a1-26) + ) + (s.w! (+ v1-12 8) a0-14) + (let ((a0-15 #x10000)) + (s.w! (+ v1-12 12) a0-15) + ) + ) + ) + (&+! (-> arg0 base) 224) ) ) 0 diff --git a/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc b/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc index 6c125cd64c..43911e5d38 100644 --- a/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/minimap_REF.gc @@ -1301,20 +1301,20 @@ ;; definition for function lookup-minimap-texture-by-name ;; INFO: Used lq/sq (defun lookup-minimap-texture-by-name ((arg0 string) (arg1 string) (arg2 (pointer texture-page))) - (local-vars (sv-16 texture-page)) (dotimes (s3-0 7) (let ((s2-0 (-> *level* level s3-0))) (when (or (= (-> s2-0 status) 'active) (= (-> s2-0 status) 'reserved)) - (set! sv-16 (-> s2-0 texture-page 8)) - (when (and sv-16 (or (not arg1) (string= (-> sv-16 name) arg1))) - (dotimes (s1-0 (-> sv-16 length)) - (let ((s0-0 (-> sv-16 data s1-0))) - (when (and s0-0 (string= (-> s0-0 name) arg0)) - (if arg2 - (set! (-> arg2 0) sv-16) - ) - (set! (-> s2-0 texture-mask 8 mask quad) (-> s0-0 masks data 0 mask quad)) - (return s0-0) + (let ((sv-16 (-> s2-0 texture-page 8))) + (when (and sv-16 (or (not arg1) (string= (-> sv-16 name) arg1))) + (dotimes (s1-0 (-> sv-16 length)) + (let ((s0-0 (-> sv-16 data s1-0))) + (when (and s0-0 (string= (-> s0-0 name) arg0)) + (if arg2 + (set! (-> arg2 0) sv-16) + ) + (set! (-> s2-0 texture-mask 8 mask quad) (-> s0-0 masks data 0 mask quad)) + (return s0-0) + ) ) ) ) @@ -1410,114 +1410,105 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch pointer vs none. (defmethod draw-racer-2 ((this minimap) (arg0 minimap-draw-work) (arg1 connection-minimap)) - (local-vars - (sv-16 process) - (sv-20 dma-buffer) - (sv-208 pointer) - (sv-212 vector) - (sv-216 vector) - (sv-220 matrix) - (sv-224 matrix) - (sv-228 matrix) - ) - (set! sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) - (set! sv-20 (-> arg0 buf)) - (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) - (set! sv-208 (-> sv-20 base)) - (set! sv-212 (new 'stack-no-clear 'vector)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-220 (new 'stack-no-clear 'matrix)) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! (-> sv-216 quad) (-> (matrix-world->local #f #f) vector 2 quad)) - (set! (-> sv-216 y) 0.0) - (vector-normalize! sv-216 1.0) - (vector-z-quaternion! (the-as vector sv-220) (-> (the-as process-drawable sv-16) root quat)) - (vector-xz-normalize! (the-as vector sv-220) 1.0) - (set! (-> sv-220 vector 0 y) 0.0) - (set! (-> sv-220 vector 0 w) 0.0) - (vector-! sv-212 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) - (let ((f0-4 (/ (-> sv-212 x) (* 16384.0 (-> this offset y)))) - (f1-3 (/ (-> sv-212 z) (* 16384.0 (-> this offset y)))) + (let ((sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) + (sv-20 (-> arg0 buf)) + ) + (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) + (let ((sv-208 (-> sv-20 base))) + (let ((sv-212 (new 'stack-no-clear 'vector)) + (sv-216 (new 'stack-no-clear 'vector)) + (sv-220 (new 'stack-no-clear 'matrix)) + (sv-224 (new 'stack-no-clear 'matrix)) + (sv-228 (new 'stack-no-clear 'matrix)) + ) + (set! (-> sv-216 quad) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-216 y) 0.0) + (vector-normalize! sv-216 1.0) + (vector-z-quaternion! (the-as vector sv-220) (-> (the-as process-drawable sv-16) root quat)) + (vector-xz-normalize! (the-as vector sv-220) 1.0) + (set! (-> sv-220 vector 0 y) 0.0) + (set! (-> sv-220 vector 0 w) 0.0) + (vector-! sv-212 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) + (let ((f0-4 (/ (-> sv-212 x) (* 16384.0 (-> this offset y)))) + (f1-3 (/ (-> sv-212 z) (* 16384.0 (-> this offset y)))) + ) + (set-vector! (-> sv-224 vector 0) (-> sv-216 z) 0.0 (- (-> sv-216 x)) 0.0) + (set-vector! (-> sv-224 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-224 vector 2) (-> sv-216 x) 0.0 (-> sv-216 z) 0.0) + (set-vector! (-> sv-224 trans) 164.0 0.0 164.0 1.0) + (set-vector! (-> sv-228 vector 0) (-> sv-220 vector 0 z) 0.0 (- (-> sv-220 vector 0 x)) 0.0) + (set-vector! (-> sv-228 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-228 vector 2) (-> sv-220 vector 0 x) 0.0 (-> sv-220 vector 0 z) 0.0) + (set-vector! (-> sv-228 trans) f0-4 0.0 f1-3 1.0) + ) + (matrix*! sv-228 sv-228 sv-224) + (let ((f0-7 7.0)) + (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-7) 1.0) + (set-vector! (-> arg0 corner 1) f0-7 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 2) (- f0-7) 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-7 1.0) + ) + (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-228) + (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-228) + (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-228) + (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-228) ) - (set-vector! (-> sv-224 vector 0) (-> sv-216 z) 0.0 (- (-> sv-216 x)) 0.0) - (set-vector! (-> sv-224 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-224 vector 2) (-> sv-216 x) 0.0 (-> sv-216 z) 0.0) - (set-vector! (-> sv-224 trans) 164.0 0.0 164.0 1.0) - (set-vector! (-> sv-228 vector 0) (-> sv-220 vector 0 z) 0.0 (- (-> sv-220 vector 0 x)) 0.0) - (set-vector! (-> sv-228 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-228 vector 2) (-> sv-220 vector 0 x) 0.0 (-> sv-220 vector 0 z) 0.0) - (set-vector! (-> sv-228 trans) f0-4 0.0 f1-3 1.0) - ) - (matrix*! sv-228 sv-228 sv-224) - (let ((f0-7 7.0)) - (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-7) 1.0) - (set-vector! (-> arg0 corner 1) f0-7 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 2) (- f0-7) 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-7 1.0) - ) - (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-228) - (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-228) - (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-228) - (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-228) - (let* ((a0-38 (-> arg1 class color)) - (a0-45 (copy-and-set-field a0-38 r (shr (* (-> a0-38 r) (the-as uint (-> this color x))) 7))) - (a0-52 (copy-and-set-field a0-45 g (shr (* (-> a0-45 g) (the-as uint (-> this color y))) 7))) - (v1-57 - (copy-and-set-field - (copy-and-set-field a0-52 b (shr (* (-> a0-52 b) (the-as uint (-> this color z))) 7)) - a - (the int (* 128.0 (-> arg1 alpha))) + (let* ((a0-38 (-> arg1 class color)) + (a0-45 (copy-and-set-field a0-38 r (shr (* (-> a0-38 r) (the-as uint (-> this color x))) 7))) + (a0-52 (copy-and-set-field a0-45 g (shr (* (-> a0-45 g) (the-as uint (-> this color y))) 7))) + (v1-57 + (copy-and-set-field + (copy-and-set-field a0-52 b (shr (* (-> a0-52 b) (the-as uint (-> this color z))) 7)) + a + (the int (* 128.0 (-> arg1 alpha))) + ) + ) ) - ) - ) - (let ((a0-64 (-> this draw4-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208)) a0-64) - ) - (let ((a0-65 (-> this draw4-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 1) a0-65) - ) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 2) - (the-as int (-> v1-57 r)) - (the-as int (-> v1-57 g)) - (the-as int (-> v1-57 b)) - (the-as int (-> v1-57 a)) + (set! (-> (the-as (pointer uint128) sv-208)) (-> this draw4-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-208) 1) (-> this draw4-tmpl quad 1)) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 2) + (the-as int (-> v1-57 r)) + (the-as int (-> v1-57 g)) + (the-as int (-> v1-57 b)) + (the-as int (-> v1-57 a)) + ) + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 3) 0.0 0.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 4) + (the int (* 16.0 (-> arg0 corner 0 x))) + (the int (* 16.0 (-> arg0 corner 0 z))) + #xffffff + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 5) 1.0 0.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 6) + (the int (* 16.0 (-> arg0 corner 1 x))) + (the int (* 16.0 (-> arg0 corner 1 z))) + #xffffff + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 7) 0.0 1.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 8) + (the int (* 16.0 (-> arg0 corner 2 x))) + (the int (* 16.0 (-> arg0 corner 2 z))) + #xffffff + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 9) 1.0 1.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 10) + (the int (* 16.0 (-> arg0 corner 3 x))) + (the int (* 16.0 (-> arg0 corner 3 z))) + #xffffff + 0 + ) ) + (&+! (-> sv-20 base) 176) ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 3) 0.0 0.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 4) - (the int (* 16.0 (-> arg0 corner 0 x))) - (the int (* 16.0 (-> arg0 corner 0 z))) - #xffffff - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 5) 1.0 0.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 6) - (the int (* 16.0 (-> arg0 corner 1 x))) - (the int (* 16.0 (-> arg0 corner 1 z))) - #xffffff - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 7) 0.0 1.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 8) - (the int (* 16.0 (-> arg0 corner 2 x))) - (the int (* 16.0 (-> arg0 corner 2 z))) - #xffffff - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 9) 1.0 1.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 10) - (the int (* 16.0 (-> arg0 corner 3 x))) - (the int (* 16.0 (-> arg0 corner 3 z))) - #xffffff - 0 - ) - (&+! (-> sv-20 base) 176) ) (none) ) @@ -1532,118 +1523,110 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; WARN: Return type mismatch pointer vs none. (defmethod draw-racer-1 ((this minimap) (arg0 minimap-draw-work) (arg1 connection-minimap) (arg2 float) (arg3 float) (arg4 float)) - (local-vars - (sv-16 process) - (sv-20 float) - (sv-24 dma-buffer) - (sv-128 pointer) - (sv-132 vector) - (sv-136 vector) - (sv-140 matrix) - ) - (set! sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) - (set! sv-20 (-> *video-params* relative-x-scale)) - (set! sv-24 (-> arg0 buf)) - (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) - (set! sv-128 (-> sv-24 base)) - (set! sv-132 (new 'stack-no-clear 'vector)) - (set! sv-136 (new 'stack-no-clear 'vector)) - (set! sv-140 (new 'stack-no-clear 'matrix)) - (vector-z-quaternion! sv-136 (-> (the-as process-drawable sv-16) root quat)) - (vector-xz-normalize! sv-136 -1.0) - (set! (-> sv-136 y) 0.0) - (set! (-> sv-136 w) 0.0) - (vector-! sv-132 (-> (the-as process-drawable sv-16) root trans) (-> this race-corner)) - (cond - ((-> *blit-displays-work* horizontal-flip-flag) - (let ((f0-4 (+ arg3 (* (- 128.0 (/ (-> sv-132 x) arg2)) sv-20))) - (f1-4 (+ arg4 (/ (-> sv-132 z) arg2))) - ) - (set-vector! (-> sv-140 vector 0) (-> sv-136 z) 0.0 (-> sv-136 x) 0.0) - (set-vector! (-> sv-140 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-140 vector 2) (- (-> sv-136 x)) 0.0 (-> sv-136 z) 0.0) - (set-vector! (-> sv-140 trans) f0-4 0.0 f1-4 1.0) - ) - ) - (else - (let ((f0-8 (+ arg3 (* (/ (-> sv-132 x) arg2) sv-20))) - (f1-9 (+ arg4 (/ (-> sv-132 z) arg2))) - ) - (set-vector! (-> sv-140 vector 0) (-> sv-136 z) 0.0 (- (-> sv-136 x)) 0.0) - (set-vector! (-> sv-140 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-140 vector 2) (-> sv-136 x) 0.0 (-> sv-136 z) 0.0) - (set-vector! (-> sv-140 trans) f0-8 0.0 f1-9 1.0) - ) + (let ((sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) + (sv-20 (-> *video-params* relative-x-scale)) + (sv-24 (-> arg0 buf)) ) - ) - (let ((f0-11 7.0)) - (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-11) 1.0) - (set-vector! (-> arg0 corner 1) f0-11 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 2) (- f0-11) 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-11 1.0) - ) - (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-140) - (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-140) - (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-140) - (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-140) - (let* ((a0-32 (-> arg1 class color)) - (a0-39 (copy-and-set-field a0-32 r (shr (* (-> a0-32 r) (the-as uint (-> this color x))) 7))) - (a0-46 (copy-and-set-field a0-39 g (shr (* (-> a0-39 g) (the-as uint (-> this color y))) 7))) - (v1-59 - (copy-and-set-field - (copy-and-set-field a0-46 b (shr (* (-> a0-46 b) (the-as uint (-> this color z))) 7)) - a - (the int (* 128.0 (-> arg1 alpha))) + (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) + (let ((sv-128 (-> sv-24 base))) + (let ((sv-132 (new 'stack-no-clear 'vector)) + (sv-136 (new 'stack-no-clear 'vector)) + (sv-140 (new 'stack-no-clear 'matrix)) + ) + (vector-z-quaternion! sv-136 (-> (the-as process-drawable sv-16) root quat)) + (vector-xz-normalize! sv-136 -1.0) + (set! (-> sv-136 y) 0.0) + (set! (-> sv-136 w) 0.0) + (vector-! sv-132 (-> (the-as process-drawable sv-16) root trans) (-> this race-corner)) + (cond + ((-> *blit-displays-work* horizontal-flip-flag) + (let ((f0-4 (+ arg3 (* (- 128.0 (/ (-> sv-132 x) arg2)) sv-20))) + (f1-4 (+ arg4 (/ (-> sv-132 z) arg2))) + ) + (set-vector! (-> sv-140 vector 0) (-> sv-136 z) 0.0 (-> sv-136 x) 0.0) + (set-vector! (-> sv-140 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-140 vector 2) (- (-> sv-136 x)) 0.0 (-> sv-136 z) 0.0) + (set-vector! (-> sv-140 trans) f0-4 0.0 f1-4 1.0) ) ) - ) - (let ((a0-58 (-> this draw4-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-128)) a0-58) - ) - (let ((a0-59 (-> this draw4-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-128) 1) a0-59) - ) - (set-vector! - (-> (the-as (inline-array vector4w) sv-128) 2) - (the-as int (-> v1-59 r)) - (the-as int (-> v1-59 g)) - (the-as int (-> v1-59 b)) - (the-as int (-> v1-59 a)) + (else + (let ((f0-8 (+ arg3 (* (/ (-> sv-132 x) arg2) sv-20))) + (f1-9 (+ arg4 (/ (-> sv-132 z) arg2))) + ) + (set-vector! (-> sv-140 vector 0) (-> sv-136 z) 0.0 (- (-> sv-136 x)) 0.0) + (set-vector! (-> sv-140 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-140 vector 2) (-> sv-136 x) 0.0 (-> sv-136 z) 0.0) + (set-vector! (-> sv-140 trans) f0-8 0.0 f1-9 1.0) + ) + ) + ) + (let ((f0-11 7.0)) + (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-11) 1.0) + (set-vector! (-> arg0 corner 1) f0-11 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 2) (- f0-11) 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-11 1.0) + ) + (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-140) + (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-140) + (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-140) + (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-140) + ) + (let* ((a0-32 (-> arg1 class color)) + (a0-39 (copy-and-set-field a0-32 r (shr (* (-> a0-32 r) (the-as uint (-> this color x))) 7))) + (a0-46 (copy-and-set-field a0-39 g (shr (* (-> a0-39 g) (the-as uint (-> this color y))) 7))) + (v1-59 + (copy-and-set-field + (copy-and-set-field a0-46 b (shr (* (-> a0-46 b) (the-as uint (-> this color z))) 7)) + a + (the int (* 128.0 (-> arg1 alpha))) + ) + ) + ) + (set! (-> (the-as (pointer uint128) sv-128)) (-> this draw4-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-128) 1) (-> this draw4-tmpl quad 1)) + (set-vector! + (-> (the-as (inline-array vector4w) sv-128) 2) + (the-as int (-> v1-59 r)) + (the-as int (-> v1-59 g)) + (the-as int (-> v1-59 b)) + (the-as int (-> v1-59 a)) + ) + ) + (set-vector! (-> (the-as (inline-array vector) sv-128) 3) 0.0 0.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-128) 4) + (the int (* 16.0 (-> arg0 corner 0 x))) + (the int (* 16.0 (-> arg0 corner 0 z))) + #xffffff + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-128) 5) 1.0 0.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-128) 6) + (the int (* 16.0 (-> arg0 corner 1 x))) + (the int (* 16.0 (-> arg0 corner 1 z))) + #xffffff + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-128) 7) 0.0 1.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-128) 8) + (the int (* 16.0 (-> arg0 corner 2 x))) + (the int (* 16.0 (-> arg0 corner 2 z))) + #xffffff + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-128) 9) 1.0 1.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-128) 10) + (the int (* 16.0 (-> arg0 corner 3 x))) + (the int (* 16.0 (-> arg0 corner 3 z))) + #xffffff + 0 + ) ) + (&+! (-> sv-24 base) 176) ) - (set-vector! (-> (the-as (inline-array vector) sv-128) 3) 0.0 0.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-128) 4) - (the int (* 16.0 (-> arg0 corner 0 x))) - (the int (* 16.0 (-> arg0 corner 0 z))) - #xffffff - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-128) 5) 1.0 0.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-128) 6) - (the int (* 16.0 (-> arg0 corner 1 x))) - (the int (* 16.0 (-> arg0 corner 1 z))) - #xffffff - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-128) 7) 0.0 1.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-128) 8) - (the int (* 16.0 (-> arg0 corner 2 x))) - (the int (* 16.0 (-> arg0 corner 2 z))) - #xffffff - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-128) 9) 1.0 1.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-128) 10) - (the int (* 16.0 (-> arg0 corner 3 x))) - (the int (* 16.0 (-> arg0 corner 3 z))) - #xffffff - 0 - ) - (&+! (-> sv-24 base) 176) ) (none) ) @@ -1652,146 +1635,131 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch pointer vs none. (defmethod draw-frustum-1 ((this minimap) (arg0 minimap-draw-work) (arg1 connection-minimap)) - (local-vars - (sv-16 process) - (sv-20 dma-buffer) - (sv-208 pointer) - (sv-212 texture) - (sv-216 vector) - (sv-220 vector) - (sv-224 matrix) - (sv-228 matrix) - (sv-232 matrix) - ) (rlet ((vf1 :class vf) (vf2 :class vf) (vf3 :class vf) (vf4 :class vf) (vf5 :class vf) ) - (set! sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) - (set! sv-20 (-> arg0 buf)) - (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) - (set! sv-208 (-> sv-20 base)) - (set! sv-212 (get-texture map-guard-frustum ctywide-minimap)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-220 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! sv-232 (new 'stack-no-clear 'matrix)) - (when sv-212 - (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) vector 2 quad)) - (set! (-> sv-220 y) 0.0) - (vector-normalize! sv-220 1.0) - (vector-z-quaternion! (the-as vector sv-224) (-> (the-as process-drawable sv-16) root quat)) - (vector-xz-normalize! (the-as vector sv-224) 1.0) - (set! (-> sv-224 vector 0 y) 0.0) - (set! (-> sv-224 vector 0 w) 0.0) - (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) - (let ((f0-4 (/ (-> sv-216 x) (* 16384.0 (-> this offset y)))) - (f1-3 (/ (-> sv-216 z) (* 16384.0 (-> this offset y)))) - ) - (set-vector! (-> sv-228 vector 0) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) - (set-vector! (-> sv-228 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-228 vector 2) (-> sv-220 x) 0.0 (-> sv-220 z) 0.0) - (set-vector! (-> sv-228 trans) 164.0 0.0 164.0 1.0) - (set-vector! (-> sv-232 vector 0) (-> sv-224 vector 0 z) 0.0 (- (-> sv-224 vector 0 x)) 0.0) - (set-vector! (-> sv-232 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-232 vector 2) (-> sv-224 vector 0 x) 0.0 (-> sv-224 vector 0 z) 0.0) - (set-vector! (-> sv-232 trans) f0-4 0.0 f1-3 1.0) + (let ((sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) + (sv-20 (-> arg0 buf)) ) - (matrix*! sv-232 sv-232 sv-228) - (let ((f0-8 (/ -10.0 (-> this offset y)))) - (set-vector! (-> arg0 corner 0) 0.0 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 1) (- f0-8) 0.0 f0-8 1.0) - (set-vector! (-> arg0 corner 2) f0-8 0.0 f0-8 1.0) - (set-vector! (-> arg0 corner 3) 0.0 0.0 (* 2.0 f0-8) 1.0) - ) - (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-232) - (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-232) - (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-232) - (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-232) - (let ((a0-40 (new 'stack-no-clear 'vector)) - (v1-49 (new 'stack-no-clear 'vector)) + (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) + (let ((sv-208 (-> sv-20 base)) + (sv-212 (get-texture map-guard-frustum ctywide-minimap)) + (sv-216 (new 'stack-no-clear 'vector)) + (sv-220 (new 'stack-no-clear 'vector)) + (sv-224 (new 'stack-no-clear 'matrix)) + (sv-228 (new 'stack-no-clear 'matrix)) + (sv-232 (new 'stack-no-clear 'matrix)) ) - (.lvf vf1 (&-> arg0 corner 0 quad)) - (.lvf vf2 (&-> arg0 corner 1 quad)) - (.lvf vf3 (&-> arg0 corner 2 quad)) - (.lvf vf4 (&-> arg0 corner 3 quad)) - (.min.vf vf5 vf1 vf2) - (.min.vf vf5 vf5 vf3) - (.min.vf vf5 vf5 vf4) - (.max.vf vf5 vf1 vf2) - (.max.vf vf5 vf5 vf3) - (.max.vf vf5 vf5 vf4) - (.svf (&-> a0-40 quad) vf5) - (.svf (&-> v1-49 quad) vf5) - (when (and (< (-> a0-40 x) 228.0) (< (-> a0-40 z) 228.0) (< 100.0 (-> v1-49 x)) (< 100.0 (-> v1-49 z))) - (let* ((a0-46 (-> arg1 class color)) - (a0-53 (copy-and-set-field a0-46 r (shr (* (-> a0-46 r) (the-as uint (-> this color x))) 7))) - (a0-60 (copy-and-set-field a0-53 g (shr (* (-> a0-53 g) (the-as uint (-> this color y))) 7))) - (s4-1 - (copy-and-set-field - (copy-and-set-field a0-60 b (shr (* (-> a0-60 b) (the-as uint (-> this color z))) 7)) - a - (the int (* 128.0 (-> this frustum-alpha) (-> arg1 alpha))) + (when sv-212 + (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-220 y) 0.0) + (vector-normalize! sv-220 1.0) + (vector-z-quaternion! (the-as vector sv-224) (-> (the-as process-drawable sv-16) root quat)) + (vector-xz-normalize! (the-as vector sv-224) 1.0) + (set! (-> sv-224 vector 0 y) 0.0) + (set! (-> sv-224 vector 0 w) 0.0) + (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) + (let ((f0-4 (/ (-> sv-216 x) (* 16384.0 (-> this offset y)))) + (f1-3 (/ (-> sv-216 z) (* 16384.0 (-> this offset y)))) + ) + (set-vector! (-> sv-228 vector 0) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) + (set-vector! (-> sv-228 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-228 vector 2) (-> sv-220 x) 0.0 (-> sv-220 z) 0.0) + (set-vector! (-> sv-228 trans) 164.0 0.0 164.0 1.0) + (set-vector! (-> sv-232 vector 0) (-> sv-224 vector 0 z) 0.0 (- (-> sv-224 vector 0 x)) 0.0) + (set-vector! (-> sv-232 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-232 vector 2) (-> sv-224 vector 0 x) 0.0 (-> sv-224 vector 0 z) 0.0) + (set-vector! (-> sv-232 trans) f0-4 0.0 f1-3 1.0) + ) + (matrix*! sv-232 sv-232 sv-228) + (let ((f0-8 (/ -10.0 (-> this offset y)))) + (set-vector! (-> arg0 corner 0) 0.0 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 1) (- f0-8) 0.0 f0-8 1.0) + (set-vector! (-> arg0 corner 2) f0-8 0.0 f0-8 1.0) + (set-vector! (-> arg0 corner 3) 0.0 0.0 (* 2.0 f0-8) 1.0) + ) + (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-232) + (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-232) + (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-232) + (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-232) + (let ((a0-40 (new 'stack-no-clear 'vector)) + (v1-49 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> arg0 corner 0 quad)) + (.lvf vf2 (&-> arg0 corner 1 quad)) + (.lvf vf3 (&-> arg0 corner 2 quad)) + (.lvf vf4 (&-> arg0 corner 3 quad)) + (.min.vf vf5 vf1 vf2) + (.min.vf vf5 vf5 vf3) + (.min.vf vf5 vf5 vf4) + (.max.vf vf5 vf1 vf2) + (.max.vf vf5 vf5 vf3) + (.max.vf vf5 vf5 vf4) + (.svf (&-> a0-40 quad) vf5) + (.svf (&-> v1-49 quad) vf5) + (when (and (< (-> a0-40 x) 228.0) (< (-> a0-40 z) 228.0) (< 100.0 (-> v1-49 x)) (< 100.0 (-> v1-49 z))) + (let* ((a0-46 (-> arg1 class color)) + (a0-53 (copy-and-set-field a0-46 r (shr (* (-> a0-46 r) (the-as uint (-> this color x))) 7))) + (a0-60 (copy-and-set-field a0-53 g (shr (* (-> a0-53 g) (the-as uint (-> this color y))) 7))) + (s4-1 + (copy-and-set-field + (copy-and-set-field a0-60 b (shr (* (-> a0-60 b) (the-as uint (-> this color z))) 7)) + a + (the int (* 128.0 (-> this frustum-alpha) (-> arg1 alpha))) + ) + ) ) - ) - ) - (let ((v1-60 (-> this adgif-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208)) v1-60) - ) - (let ((v1-61 (-> this adgif-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 1) v1-61) - ) - (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-208 32)) sv-212) - (let ((v1-63 (-> this draw4-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208) 7) v1-63) - ) - (let ((v1-64 (-> this draw4-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 8) v1-64) - ) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 9) - (the-as int (-> s4-1 r)) - (the-as int (-> s4-1 g)) - (the-as int (-> s4-1 b)) - (the-as int (-> s4-1 a)) + (set! (-> (the-as (pointer uint128) sv-208)) (-> this adgif-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-208) 1) (-> this adgif-tmpl quad 1)) + (adgif-shader<-texture-simple! (the-as adgif-shader (&+ sv-208 32)) sv-212) + (set! (-> (the-as (pointer uint128) sv-208) 7) (-> this draw4-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-208) 8) (-> this draw4-tmpl quad 1)) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 9) + (the-as int (-> s4-1 r)) + (the-as int (-> s4-1 g)) + (the-as int (-> s4-1 b)) + (the-as int (-> s4-1 a)) + ) + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 10) 0.0 0.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 11) + (the int (* 16.0 (-> arg0 corner 0 x))) + (the int (* 16.0 (-> arg0 corner 0 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 12) 1.0 0.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 13) + (the int (* 16.0 (-> arg0 corner 1 x))) + (the int (* 16.0 (-> arg0 corner 1 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 14) 0.0 1.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 15) + (the int (* 16.0 (-> arg0 corner 2 x))) + (the int (* 16.0 (-> arg0 corner 2 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector) sv-208) 16) 1.0 1.0 1.0 0.0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 17) + (the int (* 16.0 (-> arg0 corner 3 x))) + (the int (* 16.0 (-> arg0 corner 3 z))) + 0 + 0 + ) + (&+! (-> sv-20 base) 288) ) ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 10) 0.0 0.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 11) - (the int (* 16.0 (-> arg0 corner 0 x))) - (the int (* 16.0 (-> arg0 corner 0 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 12) 1.0 0.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 13) - (the int (* 16.0 (-> arg0 corner 1 x))) - (the int (* 16.0 (-> arg0 corner 1 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 14) 0.0 1.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 15) - (the int (* 16.0 (-> arg0 corner 2 x))) - (the int (* 16.0 (-> arg0 corner 2 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector) sv-208) 16) 1.0 1.0 1.0 0.0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 17) - (the int (* 16.0 (-> arg0 corner 3 x))) - (the int (* 16.0 (-> arg0 corner 3 z))) - 0 - 0 - ) - (&+! (-> sv-20 base) 288) ) ) ) @@ -1804,123 +1772,112 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch pointer vs none. (defmethod draw-frustum-2 ((this minimap) (arg0 minimap-draw-work) (arg1 connection-minimap)) - (local-vars - (sv-16 process) - (sv-20 dma-buffer) - (sv-208 pointer) - (sv-212 texture) - (sv-216 vector) - (sv-220 vector) - (sv-224 matrix) - (sv-228 matrix) - (sv-232 matrix) - ) - (set! sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) - (set! sv-20 (-> arg0 buf)) - (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) - (set! sv-208 (-> sv-20 base)) - (set! sv-212 (get-texture map-guard-frustum ctywide-minimap)) - (set! sv-216 (new 'stack-no-clear 'vector)) - (set! sv-220 (new 'stack-no-clear 'vector)) - (set! sv-224 (new 'stack-no-clear 'matrix)) - (set! sv-228 (new 'stack-no-clear 'matrix)) - (set! sv-232 (new 'stack-no-clear 'matrix)) - (when sv-212 - (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) vector 2 quad)) - (set! (-> sv-220 y) 0.0) - (vector-normalize! sv-220 1.0) - (vector-z-quaternion! (the-as vector sv-224) (-> (the-as process-drawable sv-16) root quat)) - (vector-xz-normalize! (the-as vector sv-224) 1.0) - (set! (-> sv-224 vector 0 y) 0.0) - (set! (-> sv-224 vector 0 w) 0.0) - (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) - (let ((f0-4 (/ (-> sv-216 x) (* 16384.0 (-> this offset y)))) - (f1-3 (/ (-> sv-216 z) (* 16384.0 (-> this offset y)))) + (let ((sv-16 (the-as process (as-type (handle->process (-> arg1 handle)) process-drawable))) + (sv-20 (-> arg0 buf)) + ) + (when (and sv-16 (nonzero? (-> (the-as process-drawable sv-16) root))) + (let ((sv-208 (-> sv-20 base)) + (sv-212 (get-texture map-guard-frustum ctywide-minimap)) + (sv-216 (new 'stack-no-clear 'vector)) + (sv-220 (new 'stack-no-clear 'vector)) + (sv-224 (new 'stack-no-clear 'matrix)) + (sv-228 (new 'stack-no-clear 'matrix)) + (sv-232 (new 'stack-no-clear 'matrix)) ) - (set-vector! (-> sv-228 vector 0) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) - (set-vector! (-> sv-228 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-228 vector 2) (-> sv-220 x) 0.0 (-> sv-220 z) 0.0) - (set-vector! (-> sv-228 trans) 164.0 0.0 164.0 1.0) - (set-vector! (-> sv-232 vector 0) (-> sv-224 vector 0 z) 0.0 (- (-> sv-224 vector 0 x)) 0.0) - (set-vector! (-> sv-232 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> sv-232 vector 2) (-> sv-224 vector 0 x) 0.0 (-> sv-224 vector 0 z) 0.0) - (set-vector! (-> sv-232 trans) f0-4 0.0 f1-3 1.0) - ) - (matrix*! sv-232 sv-232 sv-228) - (let ((f0-7 12.0)) - (set-vector! (-> arg0 corner 0) (- f0-7) 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 1) 0.0 0.0 f0-7 1.0) - (set-vector! (-> arg0 corner 2) 0.0 0.0 (- f0-7) 1.0) - (set-vector! (-> arg0 corner 3) f0-7 0.0 0.0 1.0) - ) - (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-232) - (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-232) - (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-232) - (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-232) - (let* ((a3-0 (-> arg1 class color)) - (a2-6 (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8)) - (a1-12 (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8)) - (v1-54 (+ a2-6 304)) - (a0-43 (+ a1-12 304)) - ) - (let* ((t0-2 (copy-and-set-field a3-0 r (shr (* (-> a3-0 r) (the-as uint (-> this color x))) 7))) - (t0-9 (copy-and-set-field t0-2 g (shr (* (-> t0-2 g) (the-as uint (-> this color y))) 7))) - (a3-13 - (copy-and-set-field - (copy-and-set-field t0-9 b (shr (* (-> t0-9 b) (the-as uint (-> this color z))) 7)) - a - (the int (* 128.0 (-> arg1 alpha))) - ) + (when sv-212 + (set! (-> sv-220 quad) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-220 y) 0.0) + (vector-normalize! sv-220 1.0) + (vector-z-quaternion! (the-as vector sv-224) (-> (the-as process-drawable sv-16) root quat)) + (vector-xz-normalize! (the-as vector sv-224) 1.0) + (set! (-> sv-224 vector 0 y) 0.0) + (set! (-> sv-224 vector 0 w) 0.0) + (vector-! sv-216 (target-pos 0) (-> (the-as process-drawable sv-16) root trans)) + (let ((f0-4 (/ (-> sv-216 x) (* 16384.0 (-> this offset y)))) + (f1-3 (/ (-> sv-216 z) (* 16384.0 (-> this offset y)))) + ) + (set-vector! (-> sv-228 vector 0) (-> sv-220 z) 0.0 (- (-> sv-220 x)) 0.0) + (set-vector! (-> sv-228 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-228 vector 2) (-> sv-220 x) 0.0 (-> sv-220 z) 0.0) + (set-vector! (-> sv-228 trans) 164.0 0.0 164.0 1.0) + (set-vector! (-> sv-232 vector 0) (-> sv-224 vector 0 z) 0.0 (- (-> sv-224 vector 0 x)) 0.0) + (set-vector! (-> sv-232 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> sv-232 vector 2) (-> sv-224 vector 0 x) 0.0 (-> sv-224 vector 0 z) 0.0) + (set-vector! (-> sv-232 trans) f0-4 0.0 f1-3 1.0) + ) + (matrix*! sv-232 sv-232 sv-228) + (let ((f0-7 12.0)) + (set-vector! (-> arg0 corner 0) (- f0-7) 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 1) 0.0 0.0 f0-7 1.0) + (set-vector! (-> arg0 corner 2) 0.0 0.0 (- f0-7) 1.0) + (set-vector! (-> arg0 corner 3) f0-7 0.0 0.0 1.0) + ) + (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) sv-232) + (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) sv-232) + (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) sv-232) + (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) sv-232) + (let* ((a3-0 (-> arg1 class color)) + (a2-6 (+ (* (the-as uint 320) (-> arg1 class icon-xy x)) 8)) + (a1-12 (+ (* (the-as uint 320) (-> arg1 class icon-xy y)) 8)) + (v1-54 (+ a2-6 304)) + (a0-43 (+ a1-12 304)) ) - ) - (let ((t0-21 (-> this draw3-tmpl dma-vif quad))) - (set! (-> (the-as (pointer uint128) sv-208)) t0-21) - ) - (let ((t0-22 (-> this draw3-tmpl quad 1))) - (set! (-> (the-as (pointer uint128) sv-208) 1) t0-22) + (let* ((t0-2 (copy-and-set-field a3-0 r (shr (* (-> a3-0 r) (the-as uint (-> this color x))) 7))) + (t0-9 (copy-and-set-field t0-2 g (shr (* (-> t0-2 g) (the-as uint (-> this color y))) 7))) + (a3-13 + (copy-and-set-field + (copy-and-set-field t0-9 b (shr (* (-> t0-9 b) (the-as uint (-> this color z))) 7)) + a + (the int (* 128.0 (-> arg1 alpha))) + ) + ) + ) + (set! (-> (the-as (pointer uint128) sv-208)) (-> this draw3-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) sv-208) 1) (-> this draw3-tmpl quad 1)) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 2) + (the-as int (-> a3-13 r)) + (the-as int (-> a3-13 g)) + (the-as int (-> a3-13 b)) + (the-as int (-> a3-13 a)) + ) + ) + (set-vector! (-> (the-as (inline-array vector4w) sv-208) 3) a2-6 a1-12 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 4) + (the int (* 16.0 (-> arg0 corner 0 x))) + (the int (* 16.0 (-> arg0 corner 0 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector4w) sv-208) 5) a2-6 a0-43 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 6) + (the int (* 16.0 (-> arg0 corner 1 x))) + (the int (* 16.0 (-> arg0 corner 1 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector4w) sv-208) 7) v1-54 a1-12 0 0) + (set-vector! + (-> (the-as (inline-array vector4w) sv-208) 8) + (the int (* 16.0 (-> arg0 corner 2 x))) + (the int (* 16.0 (-> arg0 corner 2 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector4w) sv-208) 9) v1-54 a0-43 0 0) ) (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 2) - (the-as int (-> a3-13 r)) - (the-as int (-> a3-13 g)) - (the-as int (-> a3-13 b)) - (the-as int (-> a3-13 a)) + (-> (the-as (inline-array vector4w) sv-208) 10) + (the int (* 16.0 (-> arg0 corner 3 x))) + (the int (* 16.0 (-> arg0 corner 3 z))) + 0 + 0 ) + (&+! (-> sv-20 base) 176) ) - (set-vector! (-> (the-as (inline-array vector4w) sv-208) 3) a2-6 a1-12 0 0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 4) - (the int (* 16.0 (-> arg0 corner 0 x))) - (the int (* 16.0 (-> arg0 corner 0 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector4w) sv-208) 5) a2-6 a0-43 0 0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 6) - (the int (* 16.0 (-> arg0 corner 1 x))) - (the int (* 16.0 (-> arg0 corner 1 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector4w) sv-208) 7) v1-54 a1-12 0 0) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 8) - (the int (* 16.0 (-> arg0 corner 2 x))) - (the int (* 16.0 (-> arg0 corner 2 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector4w) sv-208) 9) v1-54 a0-43 0 0) ) - (set-vector! - (-> (the-as (inline-array vector4w) sv-208) 10) - (the int (* 16.0 (-> arg0 corner 3 x))) - (the int (* 16.0 (-> arg0 corner 3 z))) - 0 - 0 - ) - (&+! (-> sv-20 base) 176) ) ) (none) @@ -2095,7 +2052,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod sub-draw-1-2 ((this minimap) (arg0 minimap-draw-work)) - (local-vars (a3-4 int) (t0-4 int) (sv-48 vector) (sv-52 matrix) (sv-56 vector)) + (local-vars (a3-4 int) (t0-4 int)) (let ((s5-0 (-> arg0 buf))) (reset-display-gs-state *display* s5-0) (dma-buffer-add-gs-set s5-0 @@ -2163,114 +2120,117 @@ (dma-buffer-add-gs-set s5-0 (test-1 (new 'static 'gs-test :ate #x1 :atst (gs-atest greater) :zte #x1 :ztst (gs-ztest always))) ) - (set! sv-48 (new-stack-vector0)) + (let ((sv-48 (new-stack-vector0))) + ) (let ((v1-29 (new 'stack-no-clear 'matrix))) (set! (-> v1-29 quad 0) (the-as uint128 0)) - (set! sv-52 v1-29) - ) - (set! sv-56 (target-pos 0)) - (set! (-> sv-52 quad 0) (-> (matrix-world->local #f #f) vector 2 quad)) - (set! (-> sv-52 vector 0 y) 0.0) - (vector-normalize! (the-as vector sv-52) 1.0) - (cond - ((-> *blit-displays-work* horizontal-flip-flag) - (let ((v1-35 (-> arg0 mat))) - (set! (-> v1-35 vector 0 x) (* (-> sv-52 vector 0 z) (- f30-0))) - (set! (-> v1-35 vector 0 y) 0.0) - (set! (-> v1-35 vector 0 z) (- (-> sv-52 vector 0 x))) - (set! (-> v1-35 vector 0 w) 0.0) - ) - (set-vector! (-> arg0 mat vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> arg0 mat vector 2) (* (-> sv-52 vector 0 x) (- f30-0)) 0.0 (-> sv-52 vector 0 z) 0.0) - (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) - ) - (else - (let ((v1-39 (-> arg0 mat))) - (set! (-> v1-39 vector 0 x) (* (-> sv-52 vector 0 z) f30-0)) - (set! (-> v1-39 vector 0 y) 0.0) - (set! (-> v1-39 vector 0 z) (- (-> sv-52 vector 0 x))) - (set! (-> v1-39 vector 0 w) 0.0) + (let ((sv-52 v1-29)) + (let ((sv-56 (target-pos 0))) ) - (set-vector! (-> arg0 mat vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> arg0 mat vector 2) (* (-> sv-52 vector 0 x) f30-0) 0.0 (-> sv-52 vector 0 z) 0.0) - (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) - ) - ) - (let ((v1-44 (the int (* 56.0 f30-0)))) - (if (-> arg0 justify-right) - (set! (-> arg0 mat trans x) (the float (+ (- 1792 v1-44) (-> arg0 draw-pos x)))) - (set! (-> arg0 mat trans x) (the float (+ v1-44 1792 (-> arg0 draw-pos x)))) - ) - ) - (when *target* - (vector-z-quaternion! (the-as vector sv-52) (-> *target* control quat)) - (vector-xz-normalize! (the-as vector sv-52) 1.0) - (set! (-> sv-52 vector 0 y) 0.0) - (set! (-> sv-52 vector 0 w) 0.0) - (vector-matrix*! (the-as vector sv-52) (the-as vector sv-52) (-> arg0 mat)) - (let ((s3-2 (the-as object (-> s5-0 base))) - (s2-1 (get-texture map-target-marker common)) - (s1-2 (new 'stack-no-clear 'matrix)) - (v1-57 (the int (* 56.0 f30-0))) - ) - (when s2-1 - (set-vector! (-> s1-2 vector 0) (* (-> sv-52 vector 0 z) f30-0) 0.0 (- (-> sv-52 vector 0 x)) 0.0) - (set-vector! (-> s1-2 vector 1) 0.0 1.0 0.0 0.0) - (set-vector! (-> s1-2 vector 2) (* (-> sv-52 vector 0 x) f30-0) 0.0 (-> sv-52 vector 0 z) 1.0) - (set-vector! (-> s1-2 trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) - (if (-> arg0 justify-right) - (set! (-> s1-2 trans x) (the float (+ (- 1792 v1-57) (-> arg0 draw-pos x)))) - (set! (-> s1-2 trans x) (the float (+ v1-57 1792 (-> arg0 draw-pos x)))) + (set! (-> sv-52 quad 0) (-> (matrix-world->local #f #f) vector 2 quad)) + (set! (-> sv-52 vector 0 y) 0.0) + (vector-normalize! (the-as vector sv-52) 1.0) + (cond + ((-> *blit-displays-work* horizontal-flip-flag) + (let ((v1-35 (-> arg0 mat))) + (set! (-> v1-35 vector 0 x) (* (-> sv-52 vector 0 z) (- f30-0))) + (set! (-> v1-35 vector 0 y) 0.0) + (set! (-> v1-35 vector 0 z) (- (-> sv-52 vector 0 x))) + (set! (-> v1-35 vector 0 w) 0.0) + ) + (set-vector! (-> arg0 mat vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> arg0 mat vector 2) (* (-> sv-52 vector 0 x) (- f30-0)) 0.0 (-> sv-52 vector 0 z) 0.0) + (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) + ) + (else + (let ((v1-39 (-> arg0 mat))) + (set! (-> v1-39 vector 0 x) (* (-> sv-52 vector 0 z) f30-0)) + (set! (-> v1-39 vector 0 y) 0.0) + (set! (-> v1-39 vector 0 z) (- (-> sv-52 vector 0 x))) + (set! (-> v1-39 vector 0 w) 0.0) ) - (let ((f0-80 7.0)) - (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-80) 1.0) - (set-vector! (-> arg0 corner 1) f0-80 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 2) (- f0-80) 0.0 0.0 1.0) - (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-80 1.0) + (set-vector! (-> arg0 mat vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> arg0 mat vector 2) (* (-> sv-52 vector 0 x) f30-0) 0.0 (-> sv-52 vector 0 z) 0.0) + (set-vector! (-> arg0 mat trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) ) - (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) s1-2) - (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) s1-2) - (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) s1-2) - (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) s1-2) - (set! (-> (the-as (pointer uint128) s3-2)) (-> this adgif-tmpl dma-vif quad)) - (set! (-> (the-as (pointer uint128) s3-2) 1) (-> this adgif-tmpl quad 1)) - (adgif-shader<-texture-simple! (the-as adgif-shader (&-> (the-as (pointer uint128) s3-2) 2)) s2-1) - (set! (-> (the-as (pointer uint128) s3-2) 7) (-> this draw-tmpl dma-vif quad)) - (set! (-> (the-as (pointer uint128) s3-2) 8) (-> this draw-tmpl quad 1)) - (set-vector! (-> (the-as (inline-array vector4w) s3-2) 9) 0 255 255 128) - (set-vector! (-> (the-as (inline-array vector4w) s3-2) 10) 0 0 #xffffff 0) - (set-vector! - (-> (the-as (inline-array vector4w) s3-2) 11) - (the int (* 16.0 (-> arg0 corner 0 x))) - (the int (* 16.0 (-> arg0 corner 0 z))) - 0 - 0 + ) + (let ((v1-44 (the int (* 56.0 f30-0)))) + (if (-> arg0 justify-right) + (set! (-> arg0 mat trans x) (the float (+ (- 1792 v1-44) (-> arg0 draw-pos x)))) + (set! (-> arg0 mat trans x) (the float (+ v1-44 1792 (-> arg0 draw-pos x)))) + ) + ) + (when *target* + (vector-z-quaternion! (the-as vector sv-52) (-> *target* control quat)) + (vector-xz-normalize! (the-as vector sv-52) 1.0) + (set! (-> sv-52 vector 0 y) 0.0) + (set! (-> sv-52 vector 0 w) 0.0) + (vector-matrix*! (the-as vector sv-52) (the-as vector sv-52) (-> arg0 mat)) + (let ((s3-2 (the-as object (-> s5-0 base))) + (s2-1 (get-texture map-target-marker common)) + (s1-2 (new 'stack-no-clear 'matrix)) + (v1-57 (the int (* 56.0 f30-0))) + ) + (when s2-1 + (set-vector! (-> s1-2 vector 0) (* (-> sv-52 vector 0 z) f30-0) 0.0 (- (-> sv-52 vector 0 x)) 0.0) + (set-vector! (-> s1-2 vector 1) 0.0 1.0 0.0 0.0) + (set-vector! (-> s1-2 vector 2) (* (-> sv-52 vector 0 x) f30-0) 0.0 (-> sv-52 vector 0 z) 1.0) + (set-vector! (-> s1-2 trans) 0.0 0.0 (the float (+ (-> arg0 draw-pos y) 1896)) 1.0) + (if (-> arg0 justify-right) + (set! (-> s1-2 trans x) (the float (+ (- 1792 v1-57) (-> arg0 draw-pos x)))) + (set! (-> s1-2 trans x) (the float (+ v1-57 1792 (-> arg0 draw-pos x)))) + ) + (let ((f0-80 7.0)) + (set-vector! (-> arg0 corner 0) 0.0 0.0 (- f0-80) 1.0) + (set-vector! (-> arg0 corner 1) f0-80 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 2) (- f0-80) 0.0 0.0 1.0) + (set-vector! (-> arg0 corner 3) 0.0 0.0 f0-80 1.0) + ) + (vector-matrix*! (-> arg0 corner 0) (-> arg0 corner 0) s1-2) + (vector-matrix*! (-> arg0 corner 1) (-> arg0 corner 1) s1-2) + (vector-matrix*! (-> arg0 corner 2) (-> arg0 corner 2) s1-2) + (vector-matrix*! (-> arg0 corner 3) (-> arg0 corner 3) s1-2) + (set! (-> (the-as (pointer uint128) s3-2)) (-> this adgif-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) s3-2) 1) (-> this adgif-tmpl quad 1)) + (adgif-shader<-texture-simple! (the-as adgif-shader (&-> (the-as (pointer uint128) s3-2) 2)) s2-1) + (set! (-> (the-as (pointer uint128) s3-2) 7) (-> this draw-tmpl dma-vif quad)) + (set! (-> (the-as (pointer uint128) s3-2) 8) (-> this draw-tmpl quad 1)) + (set-vector! (-> (the-as (inline-array vector4w) s3-2) 9) 0 255 255 128) + (set-vector! (-> (the-as (inline-array vector4w) s3-2) 10) 0 0 #xffffff 0) + (set-vector! + (-> (the-as (inline-array vector4w) s3-2) 11) + (the int (* 16.0 (-> arg0 corner 0 x))) + (the int (* 16.0 (-> arg0 corner 0 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector4w) s3-2) 12) 256 0 #xffffff 0) + (set-vector! + (-> (the-as (inline-array vector4w) s3-2) 13) + (the int (* 16.0 (-> arg0 corner 1 x))) + (the int (* 16.0 (-> arg0 corner 1 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector4w) s3-2) 14) 0 256 #xffffff 0) + (set-vector! + (-> (the-as (inline-array vector4w) s3-2) 15) + (the int (* 16.0 (-> arg0 corner 2 x))) + (the int (* 16.0 (-> arg0 corner 2 z))) + 0 + 0 + ) + (set-vector! (-> (the-as (inline-array vector4w) s3-2) 16) 256 256 #xffffff 0) + (set-vector! + (-> (the-as (inline-array vector4w) s3-2) 17) + (the int (* 16.0 (-> arg0 corner 3 x))) + (the int (* 16.0 (-> arg0 corner 3 z))) + 0 + 0 + ) + (&+! (-> s5-0 base) 288) + ) ) - (set-vector! (-> (the-as (inline-array vector4w) s3-2) 12) 256 0 #xffffff 0) - (set-vector! - (-> (the-as (inline-array vector4w) s3-2) 13) - (the int (* 16.0 (-> arg0 corner 1 x))) - (the int (* 16.0 (-> arg0 corner 1 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector4w) s3-2) 14) 0 256 #xffffff 0) - (set-vector! - (-> (the-as (inline-array vector4w) s3-2) 15) - (the int (* 16.0 (-> arg0 corner 2 x))) - (the int (* 16.0 (-> arg0 corner 2 z))) - 0 - 0 - ) - (set-vector! (-> (the-as (inline-array vector4w) s3-2) 16) 256 256 #xffffff 0) - (set-vector! - (-> (the-as (inline-array vector4w) s3-2) 17) - (the int (* 16.0 (-> arg0 corner 3 x))) - (the int (* 16.0 (-> arg0 corner 3 z))) - 0 - 0 - ) - (&+! (-> s5-0 base) 288) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc b/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc index f31e625043..6e6b8de4e2 100644 --- a/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/progress/progress-draw_REF.gc @@ -128,7 +128,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun draw-previous-next ((arg0 menu-highscores-option) (arg1 font-context) (arg2 symbol)) - (local-vars (sv-16 string) (sv-32 int)) (let ((s3-0 370)) (case (get-aspect-ratio) (('aspect4x3) @@ -154,15 +153,7 @@ (set-scale! arg1 0.6) (when (or (> (-> arg0 page-index) 0) arg2) (let ((s2-1 print-game-text)) - (let ((s1-0 format) - (s0-0 (clear *temp-string*)) - ) - (set! sv-16 "~C~S") - (set! sv-32 163) - (let ((a3-0 (lookup-text! *common-text* (text-id progress-next) #f))) - (s1-0 s0-0 sv-16 sv-32 a3-0) - ) - ) + (format (clear *temp-string*) "~C~S" 163 (lookup-text! *common-text* (text-id progress-next) #f)) (s2-1 *temp-string* arg1 #f 44 (bucket-id progress)) ) ) @@ -636,7 +627,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-on-off-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars (a0-8 string) (sv-16 string)) + (local-vars (a0-8 string)) (let ((s3-0 (if arg3 (&-> *progress-state* on-off-choice) (-> this value-to-modify) @@ -678,16 +669,13 @@ (let ((s2-3 format) (s1-2 (clear *temp-string*)) (s0-2 "~S: ~S") + (sv-16 (lookup-text! *common-text* (-> this name) #f)) ) - (set! sv-16 (lookup-text! *common-text* (-> this name) #f)) - (let ((a3-4 (if (-> s3-0 0) - (lookup-text! *common-text* (text-id progress-on) #f) - (lookup-text! *common-text* (text-id progress-off) #f) - ) - ) + (s2-3 s1-2 s0-2 sv-16 (if (-> s3-0 0) + (lookup-text! *common-text* (text-id progress-on) #f) + (lookup-text! *common-text* (text-id progress-off) #f) + ) ) - (s2-3 s1-2 s0-2 sv-16 a3-4) - ) ) *temp-string* ) @@ -1562,25 +1550,16 @@ ;; definition for function draw-decoration ;; INFO: Used lq/sq (defun draw-decoration ((arg0 menu-option) (arg1 font-context) (arg2 float) (arg3 text-id) (arg4 symbol) (arg5 float)) - (local-vars - (sv-16 symbol) - (sv-32 float) - (sv-48 int) - (sv-64 int) - (sv-80 (function string font-context symbol int bucket-id float)) - (sv-96 text-id) - ) - (set! sv-96 arg3) - (set! sv-16 arg4) - (set! sv-32 arg5) - (let ((gp-0 70) + (let ((sv-96 arg3) + (sv-16 arg4) + (sv-32 arg5) + (gp-0 70) (s5-0 120) + (sv-48 87) + (s3-0 375) + (s2-0 210) ) - (set! sv-48 87) - (let ((s3-0 375) - (s2-0 210) - ) - (set! sv-64 0) + (let ((sv-64 0)) (cond ((not sv-16) (case (get-aspect-ratio) @@ -1621,7 +1600,7 @@ ) ) ) - (set-scale! arg1 sv-32) + (set! (-> arg1 scale) sv-32) (set! (-> arg1 origin y) (the float sv-48)) (set! (-> arg1 height) 50.0) (let ((a0-1 arg1)) @@ -1630,18 +1609,7 @@ (let ((a0-2 arg1)) (set! (-> a0-2 flags) (font-flags kerning middle large)) ) - (set! sv-80 print-game-text) - (let* ((a0-3 *common-text*) - (t9-2 (method-of-object a0-3 lookup-text!)) - (a2-1 #f) - (a0-4 (t9-2 a0-3 sv-96 a2-1)) - (a1-2 arg1) - (a2-2 #f) - (a3-1 44) - (t0-1 320) - ) - (sv-80 a0-4 a1-2 a2-2 a3-1 (the-as bucket-id t0-1)) - ) + (print-game-text (lookup-text! *common-text* sv-96 #f) arg1 #f 44 (bucket-id progress)) (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 arg2))) (draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s3-0)) (the float s5-0) (the float s5-0)) (when sv-16 @@ -1654,17 +1622,17 @@ (the float (+ s5-0 s2-0)) ) ) - (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id particles) - ) - (draw-sprite2d-xy - s0-1 - gp-0 - s5-0 - s3-0 - s2-0 - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 arg2))) - ) + ) + (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) + (draw-sprite2d-xy + s0-1 + gp-0 + s5-0 + s3-0 + s2-0 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 arg2))) ) ) ) @@ -1673,71 +1641,57 @@ ;; definition for function draw-missions-decoration ;; INFO: Used lq/sq (defun draw-missions-decoration ((arg0 menu-missions-option) (arg1 font-context) (arg2 float) (arg3 text-id)) - (local-vars - (sv-16 int) - (sv-32 (function string font-context symbol int bucket-id float)) - (sv-48 font-context) - ) - (set! sv-48 arg1) - (let ((s2-0 arg2) + (let ((sv-48 arg1) + (s2-0 arg2) (s0-0 arg3) (gp-0 70) (s5-0 120) + (sv-16 87) + (s4-0 375) + (s3-0 210) ) - (set! sv-16 87) - (let ((s4-0 375) - (s3-0 210) - ) - (case (get-aspect-ratio) - (('aspect4x3) - (set! gp-0 70) - (set! s5-0 130) - (set! sv-16 85) - (set! s4-0 375) - (set! s3-0 175) - ) - (('aspect16x9) - (set! gp-0 79) - (set! s5-0 130) - (set! sv-16 68) - (set! s4-0 356) - (set! s3-0 175) - ) - ) - (set-scale! sv-48 0.95) - (set! (-> sv-48 height) 50.0) - (set! (-> sv-48 origin y) (the float sv-16)) - (let ((a0-2 sv-48)) - (set! (-> a0-2 color) (font-color progress)) - ) - (set! sv-32 print-game-text) - (let ((a0-4 (lookup-text! *common-text* s0-0 #f)) - (a2-2 #f) - (a3-1 44) - (t0-0 320) - ) - (sv-32 a0-4 sv-48 a2-2 a3-1 (the-as bucket-id t0-0)) - ) - (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 s2-0))) - (draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s4-0)) (the float s5-0) (the float s5-0)) - (draw-savegame-box - arg0 - (the float gp-0) - (the float (+ gp-0 s4-0)) - (the float (+ s5-0 s3-0)) - (the float (+ s5-0 s3-0)) - ) - (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id particles) - ) - (draw-sprite2d-xy - s0-1 - gp-0 - s5-0 - s4-0 - s3-0 - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 s2-0))) - ) + (case (get-aspect-ratio) + (('aspect4x3) + (set! gp-0 70) + (set! s5-0 130) + (set! sv-16 85) + (set! s4-0 375) + (set! s3-0 175) + ) + (('aspect16x9) + (set! gp-0 79) + (set! s5-0 130) + (set! sv-16 68) + (set! s4-0 356) + (set! s3-0 175) + ) + ) + (set-scale! sv-48 0.95) + (set! (-> sv-48 height) 50.0) + (set! (-> sv-48 origin y) (the float sv-16)) + (let ((a0-2 sv-48)) + (set! (-> a0-2 color) (font-color progress)) + ) + (print-game-text (lookup-text! *common-text* s0-0 #f) sv-48 #f 44 (bucket-id progress)) + (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 s2-0))) + (draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s4-0)) (the float s5-0) (the float s5-0)) + (draw-savegame-box + arg0 + (the float gp-0) + (the float (+ gp-0 s4-0)) + (the float (+ s5-0 s3-0)) + (the float (+ s5-0 s3-0)) + ) + (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) + (draw-sprite2d-xy + s0-1 + gp-0 + s5-0 + s4-0 + s3-0 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 s2-0))) ) ) ) @@ -1746,86 +1700,66 @@ ;; definition for function draw-sound-options-decoration ;; INFO: Used lq/sq (defun draw-sound-options-decoration ((arg0 menu-slider-option) (arg1 font-context) (arg2 float) (arg3 text-id) (arg4 symbol)) - (local-vars - (sv-16 font-context) - (sv-32 int) - (sv-48 (function string font-context symbol int bucket-id float)) - (sv-64 text-id) - ) - (set! sv-16 arg1) - (let ((s2-0 arg2)) - (set! sv-64 arg3) - (let ((s0-0 arg4) - (gp-0 70) - (s5-0 120) - ) - (set! sv-32 87) - (let ((s4-0 375) - (s3-0 210) - ) - (case (get-aspect-ratio) - (('aspect4x3) - (set! gp-0 70) - (set! s5-0 120) - (set! sv-32 83) - (set! s4-0 375) - (set! s3-0 208) - ) - (('aspect16x9) - (set! gp-0 79) - (set! s5-0 118) - (set! sv-32 68) - (set! s4-0 356) - (set! s3-0 244) - ) - ) - (set-scale! sv-16 0.95) - (set! (-> sv-16 origin y) (the float sv-32)) - (set! (-> sv-16 height) 50.0) - (let ((a0-2 sv-16)) - (set! (-> a0-2 color) (font-color progress)) - ) - (set! (-> sv-16 origin x) 80.0) - (let ((a0-3 sv-16)) - (set! (-> a0-3 flags) (font-flags kerning middle large)) - ) - (set! sv-48 print-game-text) - (let* ((a0-4 *common-text*) - (t9-1 (method-of-object a0-4 lookup-text!)) - (a2-1 #f) - (a0-5 (t9-1 a0-4 sv-64 a2-1)) - (a1-2 sv-16) - (a2-2 #f) - (a3-1 44) - (t0-1 320) - ) - (sv-48 a0-5 a1-2 a2-2 a3-1 (the-as bucket-id t0-1)) - ) - (set! (-> sv-16 origin x) (the float (+ gp-0 65))) - (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 s2-0))) - (draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s4-0)) (the float s5-0) (the float s5-0)) - (if s0-0 - (draw-savegame-box - arg0 - (the float gp-0) - (the float (+ gp-0 s4-0)) - (the float (+ s5-0 s3-0)) - (the float (+ s5-0 s3-0)) - ) - ) - (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id particles) - ) - (draw-sprite2d-xy - s0-1 - gp-0 - s5-0 - s4-0 - s3-0 - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 s2-0))) - ) + (let ((sv-16 arg1) + (s2-0 arg2) + (sv-64 arg3) + (s0-0 arg4) + (gp-0 70) + (s5-0 120) + (sv-32 87) + (s4-0 375) + (s3-0 210) + ) + (case (get-aspect-ratio) + (('aspect4x3) + (set! gp-0 70) + (set! s5-0 120) + (set! sv-32 83) + (set! s4-0 375) + (set! s3-0 208) + ) + (('aspect16x9) + (set! gp-0 79) + (set! s5-0 118) + (set! sv-32 68) + (set! s4-0 356) + (set! s3-0 244) + ) + ) + (set-scale! sv-16 0.95) + (set! (-> sv-16 origin y) (the float sv-32)) + (set! (-> sv-16 height) 50.0) + (let ((a0-2 sv-16)) + (set! (-> a0-2 color) (font-color progress)) + ) + (set! (-> sv-16 origin x) 80.0) + (let ((a0-3 sv-16)) + (set! (-> a0-3 flags) (font-flags kerning middle large)) + ) + (print-game-text (lookup-text! *common-text* sv-64 #f) sv-16 #f 44 (bucket-id progress)) + (set! (-> sv-16 origin x) (the float (+ gp-0 65))) + (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 s2-0))) + (draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s4-0)) (the float s5-0) (the float s5-0)) + (if s0-0 + (draw-savegame-box + arg0 + (the float gp-0) + (the float (+ gp-0 s4-0)) + (the float (+ s5-0 s3-0)) + (the float (+ s5-0 s3-0)) ) ) + (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) + (draw-sprite2d-xy + s0-1 + gp-0 + s5-0 + s4-0 + s3-0 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 s2-0))) + ) ) ) ) @@ -1833,20 +1767,15 @@ ;; definition for function draw-decoration-secrets ;; INFO: Used lq/sq (defun draw-decoration-secrets ((arg0 menu-option) (arg1 font-context) (arg2 float) (arg3 text-id)) - (local-vars - (sv-16 int) - (sv-32 (function string font-context symbol int bucket-id float)) - (sv-48 font-context) - ) - (set! sv-48 arg1) - (let ((s2-0 arg2) + (let ((sv-48 arg1) + (s2-0 arg2) (s0-0 arg3) (gp-0 70) (s5-0 110) ) 120 - (set! sv-16 87) - (let ((s4-0 375) + (let ((sv-16 87) + (s4-0 375) (s3-0 210) ) (case (get-aspect-ratio) @@ -1872,14 +1801,7 @@ (let ((a0-2 sv-48)) (set! (-> a0-2 color) (font-color progress)) ) - (set! sv-32 print-game-text) - (let ((a0-4 (lookup-text! *common-text* s0-0 #f)) - (a2-2 #f) - (a3-1 44) - (t0-0 320) - ) - (sv-32 a0-4 sv-48 a2-2 a3-1 (the-as bucket-id t0-0)) - ) + (print-game-text (lookup-text! *common-text* s0-0 #f) sv-48 #f 44 (bucket-id progress)) (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 s2-0))) (draw-savegame-box arg0 (the float gp-0) (the float (+ gp-0 s4-0)) (the float s5-0) (the float s5-0)) (draw-savegame-box @@ -1908,92 +1830,74 @@ ;; definition for function draw-decoration-load-save ;; INFO: Used lq/sq (defun draw-decoration-load-save ((arg0 menu-option) (arg1 font-context) (arg2 float) (arg3 text-id)) - (local-vars - (sv-16 int) - (sv-32 int) - (sv-48 (function string font-context symbol int bucket-id float)) - (sv-64 text-id) - (sv-80 font-context) - ) - (set! sv-80 arg1) - (let ((s4-0 arg2)) - (set! sv-64 arg3) - (let ((s0-0 70) - (gp-0 120) - (s5-0 120) + (let ((sv-80 arg1) + (s4-0 arg2) + (sv-64 arg3) + (s0-0 70) + (gp-0 120) + (s5-0 120) + ) + 120 + (let ((sv-16 87) + (sv-32 375) + (s3-0 200) + (s2-0 210) ) - 120 - (set! sv-16 87) - (set! sv-32 375) - (let ((s3-0 200) - (s2-0 210) - ) - (case (get-aspect-ratio) - (('aspect4x3) - (set! s0-0 69) - (set! gp-0 245) - (set! s5-0 110) - (set! sv-16 80) - (set! sv-32 375) - (set! s3-0 200) - (set! s2-0 218) - ) - (('aspect16x9) - (set! s0-0 79) - (set! gp-0 245) - (set! s5-0 110) - (set! sv-16 80) - (set! sv-32 355) - (set! s3-0 190) - (set! s2-0 248) - ) + (case (get-aspect-ratio) + (('aspect4x3) + (set! s0-0 69) + (set! gp-0 245) + (set! s5-0 110) + (set! sv-16 80) + (set! sv-32 375) + (set! s3-0 200) + (set! s2-0 218) + ) + (('aspect16x9) + (set! s0-0 79) + (set! gp-0 245) + (set! s5-0 110) + (set! sv-16 80) + (set! sv-32 355) + (set! s3-0 190) + (set! s2-0 248) + ) + ) + (set-scale! sv-80 0.65) + (if (or (= (-> *setting-control* user-default language) (language-enum french)) + (= (-> *setting-control* user-default language) (language-enum spanish)) + (= (-> *setting-control* user-default language) (language-enum italian)) + ) + (set-scale! sv-80 0.5) ) - (set-scale! sv-80 0.65) - (if (or (= (-> *setting-control* user-default language) (language-enum french)) - (= (-> *setting-control* user-default language) (language-enum spanish)) - (= (-> *setting-control* user-default language) (language-enum italian)) - ) - (set-scale! sv-80 0.5) - ) - (set! (-> sv-80 origin y) (the float sv-16)) - (set! (-> sv-80 origin x) (the float s0-0)) - (let ((a0-6 sv-80)) - (set! (-> a0-6 flags) (font-flags kerning middle large)) - ) - (let ((a0-7 sv-80)) - (set! (-> a0-7 color) (font-color progress)) - ) - (set! sv-48 print-game-text) - (let* ((a0-8 *common-text*) - (t9-1 (method-of-object a0-8 lookup-text!)) - (a2-1 #f) - (a0-9 (t9-1 a0-8 sv-64 a2-1)) - (a2-2 #f) - (a3-1 44) - (t0-0 320) - ) - (sv-48 a0-9 sv-80 a2-2 a3-1 (the-as bucket-id t0-0)) - ) - (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 s4-0))) - (draw-savegame-box arg0 (the float s0-0) (the float (+ s0-0 sv-32)) (the float s5-0) (the float s5-0)) - (draw-savegame-box - arg0 - (the float (+ s0-0 sv-32)) - (the float (+ s0-0 sv-32)) - (the float s5-0) - (the float s5-0) - ) - (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id particles) - ) - (draw-sprite2d-xy - s0-1 - gp-0 - s5-0 - s3-0 - s2-0 - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 s4-0))) - ) + (set! (-> sv-80 origin y) (the float sv-16)) + (set! (-> sv-80 origin x) (the float s0-0)) + (let ((a0-6 sv-80)) + (set! (-> a0-6 flags) (font-flags kerning middle large)) + ) + (let ((a0-7 sv-80)) + (set! (-> a0-7 color) (font-color progress)) + ) + (print-game-text (lookup-text! *common-text* sv-64 #f) sv-80 #f 44 (bucket-id progress)) + (set-vector! (-> arg0 box 0 color) 64 128 128 (the int (* 128.0 s4-0))) + (draw-savegame-box arg0 (the float s0-0) (the float (+ s0-0 sv-32)) (the float s5-0) (the float s5-0)) + (draw-savegame-box + arg0 + (the float (+ s0-0 sv-32)) + (the float (+ s0-0 sv-32)) + (the float s5-0) + (the float s5-0) + ) + (with-dma-buffer-add-bucket ((s0-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) + (draw-sprite2d-xy + s0-1 + gp-0 + s5-0 + s3-0 + s2-0 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 s4-0))) ) ) ) @@ -2094,419 +1998,399 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-memcard-slot-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (v0-74 pointer) - (sv-16 float) - (sv-20 int) - (sv-24 float) - (sv-28 float) - (sv-32 float) - (sv-36 float) - (sv-40 int) - (sv-48 int) - (sv-56 int) - (sv-64 int) - (sv-72 int) - (sv-80 int) - (sv-88 int) - (sv-96 string) - (sv-112 int) - ) - (set! sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) - (set! sv-20 (-> arg0 option-index)) - (set! sv-24 (-> arg1 origin x)) - (set! sv-28 (-> arg1 origin y)) - (set! sv-32 (-> arg1 width)) - (set! sv-36 (-> arg1 height)) - (set! sv-40 (if (= (get-aspect-ratio) 'aspect4x3) - 300 - 305 - ) - ) - (set! sv-48 (if (= (get-aspect-ratio) 'aspect4x3) - 140 - 140 - ) - ) - (set! sv-56 (if (= (get-aspect-ratio) 'aspect4x3) - 64 - 48 - ) - ) - (set! sv-64 69) - (set! sv-72 110) - (set! sv-80 176) - (set! sv-88 54) - (if (< sv-16 0.0) - (set! sv-16 (the-as float 0.0)) - ) - (set! (-> arg1 alpha) sv-16) - (set! v0-74 - (cond - ((not (-> *bigmap* progress-minimap)) - (draw-busy-loading arg1) - v0-74 - ) - (else - (let ((s2-3 arg1)) - (set! (-> s2-3 color) (if (= arg2 sv-20) - (the-as font-color (the-as int (progress-selected 0))) - (font-color progress) - ) - ) - ) - (cond - ((= *save-options-title* (-> arg0 current-options)) - (set! (-> arg1 origin y) 80.0) - (set! (-> arg1 height) 52.0) - (+! (-> arg1 origin y) (the float (* 42 (+ arg2 1)))) - (+! (-> arg1 origin x) -100.0) + (local-vars (v0-74 pointer)) + (let ((sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) + (sv-20 (-> arg0 option-index)) + (sv-24 (-> arg1 origin x)) + (sv-28 (-> arg1 origin y)) + (sv-32 (-> arg1 width)) + (sv-36 (-> arg1 height)) + (sv-40 (if (= (get-aspect-ratio) 'aspect4x3) + 300 + 305 + ) ) - (else - (case (get-aspect-ratio) - (('aspect16x9) - (set! (-> arg1 origin y) 74.0) - (set! (-> arg1 height) 42.0) - (+! (-> arg1 origin y) (the float (* 60 (+ arg2 1)))) - (+! (-> arg1 origin x) -90.0) + (sv-48 (if (= (get-aspect-ratio) 'aspect4x3) + 140 + 140 ) - (('aspect4x3) - (set! (-> arg1 origin y) 74.0) - (set! (-> arg1 height) 42.0) - (+! (-> arg1 origin y) (the float (* 54 (+ arg2 1)))) - (+! (-> arg1 origin x) -90.0) + ) + (sv-56 (if (= (get-aspect-ratio) 'aspect4x3) + 64 + 48 ) + ) + (sv-64 69) + (sv-72 110) + (sv-80 176) + (sv-88 54) + ) + (if (< sv-16 0.0) + (set! sv-16 (the-as float 0.0)) + ) + (set! (-> arg1 alpha) sv-16) + (set! v0-74 + (cond + ((not (-> *bigmap* progress-minimap)) + (draw-busy-loading arg1) + v0-74 + ) + (else + (let ((s2-3 arg1)) + (set! (-> s2-3 color) (if (= arg2 sv-20) + (the-as font-color (the-as int (progress-selected 0))) + (font-color progress) + ) + ) + ) + (cond + ((= *save-options-title* (-> arg0 current-options)) + (set! (-> arg1 origin y) 80.0) + (set! (-> arg1 height) 52.0) + (+! (-> arg1 origin y) (the float (* 42 (+ arg2 1)))) + (+! (-> arg1 origin x) -100.0) + ) + (else + (case (get-aspect-ratio) + (('aspect16x9) + (set! (-> arg1 origin y) 74.0) + (set! (-> arg1 height) 42.0) + (+! (-> arg1 origin y) (the float (* 60 (+ arg2 1)))) + (+! (-> arg1 origin x) -90.0) + ) + (('aspect4x3) + (set! (-> arg1 origin y) 74.0) + (set! (-> arg1 height) 42.0) + (+! (-> arg1 origin y) (the float (* 54 (+ arg2 1)))) + (+! (-> arg1 origin x) -90.0) + ) + ) ) ) - ) - (set-vector! (-> this box 0 color) 64 128 128 (the int (* 128.0 sv-16))) - (when (= arg2 sv-20) - (cond - ((!= *save-options-title* (-> arg0 current-options)) - (case (get-aspect-ratio) - (('aspect16x9) - (set! sv-64 79) - (set! sv-72 110) - (set! sv-80 166) - (set! sv-88 62) - ) - ) - (draw-savegame-box - this - (the float sv-64) - (the float (+ sv-64 sv-80)) - (the float (+ sv-72 (* sv-88 arg2))) - (the float (+ sv-72 (* sv-88 arg2))) - ) - (when (!= arg2 3) + (set-vector! (-> this box 0 color) 64 128 128 (the int (* 128.0 sv-16))) + (when (= arg2 sv-20) + (cond + ((!= *save-options-title* (-> arg0 current-options)) + (case (get-aspect-ratio) + (('aspect16x9) + (set! sv-64 79) + (set! sv-72 110) + (set! sv-80 166) + (set! sv-88 62) + ) + ) (draw-savegame-box this (the float sv-64) (the float (+ sv-64 sv-80)) - (the float (+ sv-72 sv-88 (* sv-88 arg2))) - (the float (+ sv-72 sv-88 (* sv-88 arg2))) + (the float (+ sv-72 (* sv-88 arg2))) + (the float (+ sv-72 (* sv-88 arg2))) ) - (draw-savegame-box - this - (the float (+ sv-64 sv-80)) - (the float (+ sv-64 sv-80)) - (the float (+ sv-72 sv-88 (* sv-88 arg2))) - (the float (+ (* sv-88 4) 2 sv-72)) - ) - ) - (draw-savegame-box - this - (the float (+ sv-64 sv-80)) - (the float (+ sv-64 sv-80)) - (the float sv-72) - (the float (+ sv-72 (* sv-88 arg2))) - ) - (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id particles) - ) - (draw-sprite2d-xy - s1-0 - sv-64 - (+ sv-72 (* sv-88 arg2)) - sv-80 - sv-88 - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 sv-16))) - ) - ) - ) - ((= *save-options-title* (-> arg0 current-options)) - (set! sv-88 42) - (let ((v0-13 (get-aspect-ratio))) - (when (= v0-13 'aspect16x9) - (set! sv-64 79) - (set! sv-72 110) - (set! sv-80 166) - (set! sv-88 42) + (when (!= arg2 3) + (draw-savegame-box + this + (the float sv-64) + (the float (+ sv-64 sv-80)) + (the float (+ sv-72 sv-88 (* sv-88 arg2))) + (the float (+ sv-72 sv-88 (* sv-88 arg2))) + ) (draw-savegame-box this (the float (+ sv-64 sv-80)) (the float (+ sv-64 sv-80)) (the float (+ sv-72 sv-88 (* sv-88 arg2))) - (the float (+ sv-72 (* 6 sv-88))) + (the float (+ (* sv-88 4) 2 sv-72)) + ) + ) + (draw-savegame-box + this + (the float (+ sv-64 sv-80)) + (the float (+ sv-64 sv-80)) + (the float sv-72) + (the float (+ sv-72 (* sv-88 arg2))) + ) + (with-dma-buffer-add-bucket ((s1-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) + (draw-sprite2d-xy + s1-0 + sv-64 + (+ sv-72 (* sv-88 arg2)) + sv-80 + sv-88 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 sv-16))) ) ) ) - (draw-savegame-box - this - (the float sv-64) - (the float (+ sv-64 sv-80)) - (the float (+ sv-72 (* sv-88 arg2))) - (the float (+ sv-72 (* sv-88 arg2))) - ) - (when (!= arg2 4) + ((= *save-options-title* (-> arg0 current-options)) + (set! sv-88 42) + (let ((v0-13 (get-aspect-ratio))) + (when (= v0-13 'aspect16x9) + (set! sv-64 79) + (set! sv-72 110) + (set! sv-80 166) + (set! sv-88 42) + (draw-savegame-box + this + (the float (+ sv-64 sv-80)) + (the float (+ sv-64 sv-80)) + (the float (+ sv-72 sv-88 (* sv-88 arg2))) + (the float (+ sv-72 (* 6 sv-88))) + ) + ) + ) (draw-savegame-box this (the float sv-64) (the float (+ sv-64 sv-80)) - (the float (+ sv-72 sv-88 (* sv-88 arg2))) - (the float (+ sv-72 sv-88 (* sv-88 arg2))) + (the float (+ sv-72 (* sv-88 arg2))) + (the float (+ sv-72 (* sv-88 arg2))) + ) + (when (!= arg2 4) + (draw-savegame-box + this + (the float sv-64) + (the float (+ sv-64 sv-80)) + (the float (+ sv-72 sv-88 (* sv-88 arg2))) + (the float (+ sv-72 sv-88 (* sv-88 arg2))) + ) + (draw-savegame-box + this + (the float (+ sv-64 sv-80)) + (the float (+ sv-64 sv-80)) + (the float (+ sv-72 sv-88 (* sv-88 arg2))) + (the float (+ (* 5 sv-88) 2 sv-72)) + ) ) (draw-savegame-box this (the float (+ sv-64 sv-80)) (the float (+ sv-64 sv-80)) - (the float (+ sv-72 sv-88 (* sv-88 arg2))) - (the float (+ (* 5 sv-88) 2 sv-72)) + (the float sv-72) + (the float (+ sv-72 (* sv-88 arg2))) ) - ) - (draw-savegame-box - this - (the float (+ sv-64 sv-80)) - (the float (+ sv-64 sv-80)) - (the float sv-72) - (the float (+ sv-72 (* sv-88 arg2))) - ) - (with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id particles) - ) - (draw-sprite2d-xy - s1-1 - sv-64 - (+ sv-72 (* sv-88 arg2)) - sv-80 - sv-88 - (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 sv-16))) - ) - ) - ) - ) - ) - (cond - ((and *progress-save-info* - (= (-> *progress-save-info* formatted) 1) - (= (-> *progress-save-info* inited) 1) - (= (-> *progress-save-info* file arg2 present) 1) - ) - (if (= arg2 sv-20) - (set-scale! arg1 0.8) - (set-scale! arg1 0.6) - ) - (let ((a0-40 arg1)) - (set! (-> a0-40 flags) (font-flags kerning large)) - ) - (+! (-> arg1 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3) - 100 - 105 - ) - ) - ) - (let ((s2-7 print-game-text)) - (let ((s1-2 format) - (s0-0 (clear *temp-string*)) + (with-dma-buffer-add-bucket ((s1-1 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id particles) + ) + (draw-sprite2d-xy + s1-1 + sv-64 + (+ sv-72 (* sv-88 arg2)) + sv-80 + sv-88 + (new 'static 'rgba :r #x40 :g #x40 :b #x40 :a (the int (* 64.0 sv-16))) ) - (set! sv-96 "~S ~D") - (let ((a2-28 (lookup-text! *common-text* (text-id progress-unknown-game) #f)) - (a3-33 (+ arg2 1)) - ) - (s1-2 s0-0 sv-96 a2-28 a3-33) ) ) - (s2-7 *temp-string* arg1 #f 44 (bucket-id progress)) - ) - (let ((a0-45 arg1)) - (set! (-> a0-45 color) (font-color progress)) - ) - (set! (-> arg1 origin x) 250.0) - (set! (-> arg1 origin y) 110.0) - (set! (-> arg1 width) 170.0) - (set! (-> arg1 height) 190.0) - (let ((s2-8 (-> *progress-save-info* file arg2 level-index))) - (when (= arg2 sv-20) - (let ((v1-199 (-> this sprites 0 color2))) - (set! (-> v1-199 0) 128) - (set! (-> v1-199 1) 128) - (set! (-> v1-199 2) 128) - (set! (-> v1-199 3) (the int (* 128.0 sv-16))) + ) + ) + (cond + ((and *progress-save-info* + (= (-> *progress-save-info* formatted) 1) + (= (-> *progress-save-info* inited) 1) + (= (-> *progress-save-info* file arg2 present) 1) + ) + (if (= arg2 sv-20) + (set-scale! arg1 0.8) + (set-scale! arg1 0.6) ) - (let ((v1-200 (-> this sprites 1 color2))) - (set! (-> v1-200 0) 128) - (set! (-> v1-200 1) 128) - (set! (-> v1-200 2) 128) - (set! (-> v1-200 3) (the int (* 128.0 sv-16))) + (let ((a0-40 arg1)) + (set! (-> a0-40 flags) (font-flags kerning large)) + ) + (+! (-> arg1 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3) + 100 + 105 + ) + ) ) - (set! (-> this sprites 1 pos z) #xffffff) - (set! (-> this sprites 1 pos w) 1) - (set! (-> this sprites 1 tex) (lookup-texture-by-id (get-level-icon-id-01 s2-8))) - (set! (-> this sprites 1 scale-x) 1.0) - (set! (-> this sprites 1 scale-y) 1.0) - (set-hud-piece-position! (-> this sprites 1) sv-40 sv-48) - (let ((v1-205 (-> this sprites 2 color2))) - (set! (-> v1-205 0) 128) - (set! (-> v1-205 1) 128) - (set! (-> v1-205 2) 128) - (set! (-> v1-205 3) (the int (* 128.0 sv-16))) + (let ((s2-7 print-game-text)) + (format + (clear *temp-string*) + "~S ~D" + (lookup-text! *common-text* (text-id progress-unknown-game) #f) + (+ arg2 1) ) - (set! (-> this sprites 2 pos z) #xffffff) - (set! (-> this sprites 2 pos w) 1) - (set! (-> this sprites 2 tex) (lookup-texture-by-id (get-level-icon-id-02 s2-8))) - (set! (-> this sprites 2 scale-x) 1.0) - (set! (-> this sprites 2 scale-y) 1.0) - (set-hud-piece-position! (-> this sprites 2) (+ sv-40 sv-56) sv-48) - (let ((v1-211 (-> this sprites 3 color2))) - (set! (-> v1-211 0) 128) - (set! (-> v1-211 1) 128) - (set! (-> v1-211 2) 128) - (set! (-> v1-211 3) (the int (* 128.0 sv-16))) - ) - (set! (-> this sprites 3 pos z) #xffffff) - (set! (-> this sprites 3 pos w) 1) - (set! (-> this sprites 3 tex) (lookup-texture-by-id (get-level-icon-id-03 s2-8))) - (set! (-> this sprites 3 scale-x) 1.0) - (set! (-> this sprites 3 scale-y) 1.0) - (set-hud-piece-position! (-> this sprites 3) sv-40 (+ sv-48 64)) - (let ((v1-217 (-> this sprites 4 color2))) - (set! (-> v1-217 0) 128) - (set! (-> v1-217 1) 128) - (set! (-> v1-217 2) 128) - (set! (-> v1-217 3) (the int (* 128.0 sv-16))) - ) - (set! (-> this sprites 4 pos z) #xffffff) - (set! (-> this sprites 4 pos w) 1) - (set! (-> this sprites 4 tex) (lookup-texture-by-id (get-level-icon-id-04 s2-8))) - (set! (-> this sprites 4 scale-x) 1.0) - (set! (-> this sprites 4 scale-y) 1.0) - (set-hud-piece-position! (-> this sprites 4) (+ sv-40 sv-56) (+ sv-48 64)) - (with-dma-buffer-add-bucket ((s1-7 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id progress) - ) - (draw (-> this sprites 1) s1-7 (-> *level* default-level)) - (draw (-> this sprites 2) s1-7 (-> *level* default-level)) - (draw (-> this sprites 3) s1-7 (-> *level* default-level)) - (draw (-> this sprites 4) s1-7 (-> *level* default-level)) - ) - (set-scale! arg1 0.6) - (set! (-> arg1 origin x) 265.0) - (set! (-> arg1 origin y) 263.0) - (set! (-> arg1 width) 170.0) - (set! (-> arg1 height) 52.0) - (set! (-> this sprites 0 scale-x) 0.7) - (set! (-> this sprites 0 scale-y) 0.7) - (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #xc93))) - (set-hud-piece-position! (-> this sprites 0) 265 263) - (with-dma-buffer-add-bucket ((s1-8 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id progress) - ) - ((method-of-type hud-sprite draw) (-> this sprites 0) s1-8 (-> *level* default-level)) - ) - (+! (-> arg1 origin y) 1.0) - (+! (-> arg1 origin x) 28.0) - (let* ((v1-272 (-> *progress-save-info* file arg2 game-time0)) - (v1-273 (logior (shl (-> *progress-save-info* file arg2 game-time1) 32) v1-272)) - (s2-11 (/ (the-as int v1-273) #x107ac0)) - ) - (set! sv-112 (/ (mod (the-as int v1-273) #x107ac0) #x4650)) - (let ((s1-9 print-game-text)) + (s2-7 *temp-string* arg1 #f 44 (bucket-id progress)) + ) + (let ((a0-45 arg1)) + (set! (-> a0-45 color) (font-color progress)) + ) + (set! (-> arg1 origin x) 250.0) + (set! (-> arg1 origin y) 110.0) + (set! (-> arg1 width) 170.0) + (set! (-> arg1 height) 190.0) + (let ((s2-8 (-> *progress-save-info* file arg2 level-index))) + (when (= arg2 sv-20) + (let ((v1-199 (-> this sprites 0 color2))) + (set! (-> v1-199 0) 128) + (set! (-> v1-199 1) 128) + (set! (-> v1-199 2) 128) + (set! (-> v1-199 3) (the int (* 128.0 sv-16))) + ) + (let ((v1-200 (-> this sprites 1 color2))) + (set! (-> v1-200 0) 128) + (set! (-> v1-200 1) 128) + (set! (-> v1-200 2) 128) + (set! (-> v1-200 3) (the int (* 128.0 sv-16))) + ) + (set! (-> this sprites 1 pos z) #xffffff) + (set! (-> this sprites 1 pos w) 1) + (set! (-> this sprites 1 tex) (lookup-texture-by-id (get-level-icon-id-01 s2-8))) + (set! (-> this sprites 1 scale-x) 1.0) + (set! (-> this sprites 1 scale-y) 1.0) + (set-hud-piece-position! (-> this sprites 1) sv-40 sv-48) + (let ((v1-205 (-> this sprites 2 color2))) + (set! (-> v1-205 0) 128) + (set! (-> v1-205 1) 128) + (set! (-> v1-205 2) 128) + (set! (-> v1-205 3) (the int (* 128.0 sv-16))) + ) + (set! (-> this sprites 2 pos z) #xffffff) + (set! (-> this sprites 2 pos w) 1) + (set! (-> this sprites 2 tex) (lookup-texture-by-id (get-level-icon-id-02 s2-8))) + (set! (-> this sprites 2 scale-x) 1.0) + (set! (-> this sprites 2 scale-y) 1.0) + (set-hud-piece-position! (-> this sprites 2) (+ sv-40 sv-56) sv-48) + (let ((v1-211 (-> this sprites 3 color2))) + (set! (-> v1-211 0) 128) + (set! (-> v1-211 1) 128) + (set! (-> v1-211 2) 128) + (set! (-> v1-211 3) (the int (* 128.0 sv-16))) + ) + (set! (-> this sprites 3 pos z) #xffffff) + (set! (-> this sprites 3 pos w) 1) + (set! (-> this sprites 3 tex) (lookup-texture-by-id (get-level-icon-id-03 s2-8))) + (set! (-> this sprites 3 scale-x) 1.0) + (set! (-> this sprites 3 scale-y) 1.0) + (set-hud-piece-position! (-> this sprites 3) sv-40 (+ sv-48 64)) + (let ((v1-217 (-> this sprites 4 color2))) + (set! (-> v1-217 0) 128) + (set! (-> v1-217 1) 128) + (set! (-> v1-217 2) 128) + (set! (-> v1-217 3) (the int (* 128.0 sv-16))) + ) + (set! (-> this sprites 4 pos z) #xffffff) + (set! (-> this sprites 4 pos w) 1) + (set! (-> this sprites 4 tex) (lookup-texture-by-id (get-level-icon-id-04 s2-8))) + (set! (-> this sprites 4 scale-x) 1.0) + (set! (-> this sprites 4 scale-y) 1.0) + (set-hud-piece-position! (-> this sprites 4) (+ sv-40 sv-56) (+ sv-48 64)) + (with-dma-buffer-add-bucket ((s1-7 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id progress) + ) + (draw (-> this sprites 1) s1-7 (-> *level* default-level)) + (draw (-> this sprites 2) s1-7 (-> *level* default-level)) + (draw (-> this sprites 3) s1-7 (-> *level* default-level)) + (draw (-> this sprites 4) s1-7 (-> *level* default-level)) + ) + (set-scale! arg1 0.6) + (set! (-> arg1 origin x) 265.0) + (set! (-> arg1 origin y) 263.0) + (set! (-> arg1 width) 170.0) + (set! (-> arg1 height) 52.0) + (set! (-> this sprites 0 scale-x) 0.7) + (set! (-> this sprites 0 scale-y) 0.7) + (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x4 :page #xc93))) + (set-hud-piece-position! (-> this sprites 0) 265 263) + (with-dma-buffer-add-bucket ((s1-8 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id progress) + ) + ((method-of-type hud-sprite draw) (-> this sprites 0) s1-8 (-> *level* default-level)) + ) + (+! (-> arg1 origin y) 1.0) + (+! (-> arg1 origin x) 28.0) + (let* ((v1-272 (-> *progress-save-info* file arg2 game-time0)) + (v1-273 (logior (shl (-> *progress-save-info* file arg2 game-time1) 32) v1-272)) + (s2-11 (/ (the-as int v1-273) #x107ac0)) + (sv-112 (/ (mod (the-as int v1-273) #x107ac0) #x4650)) + (s1-9 print-game-text) + ) (format (clear *temp-string*) "~2,'0D:~2,'0D" s2-11 sv-112) (s1-9 *temp-string* arg1 #f 44 (bucket-id progress)) ) - ) - (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x6 :page #xc93))) - (set-hud-piece-position! (-> this sprites 0) 368 263) - (with-dma-buffer-add-bucket ((s1-10 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id progress) - ) - ((method-of-type hud-sprite draw) (-> this sprites 0) s1-10 (-> *level* default-level)) - ) - (+! (-> arg1 origin x) 100.0) - (let ((s2-13 print-game-text)) - (format (clear *temp-string*) "~D%" (the int (-> *progress-save-info* file arg2 completion-percentage))) - (s2-13 *temp-string* arg1 #f 44 (bucket-id progress)) - ) - (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc93))) - (set-hud-piece-position! (-> this sprites 0) 368 289) - (with-dma-buffer-add-bucket ((s1-12 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id progress) - ) - ((method-of-type hud-sprite draw) (-> this sprites 0) s1-12 (-> *level* default-level)) - ) - (+! (-> arg1 origin y) 28.0) - (let ((s2-15 print-game-text)) - (format (clear *temp-string*) "~D" (the int (-> *progress-save-info* file arg2 skill-count))) - (s2-15 *temp-string* arg1 #f 44 (bucket-id progress)) - ) - (set! (-> this sprites 0 scale-x) 0.6) - (set! (-> this sprites 0 scale-y) 0.6) - (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x82 :page #xc93))) - (set-hud-piece-position! (-> this sprites 0) 253 290) - (with-dma-buffer-add-bucket ((s1-14 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id progress) - ) - ((method-of-type hud-sprite draw) (-> this sprites 0) s1-14 (-> *level* default-level)) - ) - (+! (-> arg1 origin x) -100.0) - (let ((s2-17 print-game-text)) - (format (clear *temp-string*) "~D" (the int (-> *progress-save-info* file arg2 gem-count))) - (s2-17 *temp-string* arg1 #f 44 (bucket-id progress)) + (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x6 :page #xc93))) + (set-hud-piece-position! (-> this sprites 0) 368 263) + (with-dma-buffer-add-bucket ((s1-10 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id progress) + ) + ((method-of-type hud-sprite draw) (-> this sprites 0) s1-10 (-> *level* default-level)) + ) + (+! (-> arg1 origin x) 100.0) + (let ((s2-13 print-game-text)) + (format (clear *temp-string*) "~D%" (the int (-> *progress-save-info* file arg2 completion-percentage))) + (s2-13 *temp-string* arg1 #f 44 (bucket-id progress)) + ) + (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc93))) + (set-hud-piece-position! (-> this sprites 0) 368 289) + (with-dma-buffer-add-bucket ((s1-12 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id progress) + ) + ((method-of-type hud-sprite draw) (-> this sprites 0) s1-12 (-> *level* default-level)) + ) + (+! (-> arg1 origin y) 28.0) + (let ((s2-15 print-game-text)) + (format (clear *temp-string*) "~D" (the int (-> *progress-save-info* file arg2 skill-count))) + (s2-15 *temp-string* arg1 #f 44 (bucket-id progress)) + ) + (set! (-> this sprites 0 scale-x) 0.6) + (set! (-> this sprites 0 scale-y) 0.6) + (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x82 :page #xc93))) + (set-hud-piece-position! (-> this sprites 0) 253 290) + (with-dma-buffer-add-bucket ((s1-14 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id progress) + ) + ((method-of-type hud-sprite draw) (-> this sprites 0) s1-14 (-> *level* default-level)) + ) + (+! (-> arg1 origin x) -100.0) + (let ((s2-17 print-game-text)) + (format (clear *temp-string*) "~D" (the int (-> *progress-save-info* file arg2 gem-count))) + (s2-17 *temp-string* arg1 #f 44 (bucket-id progress)) + ) ) ) ) - ) - ((and *progress-save-info* - (= (-> *progress-save-info* formatted) 1) - (= (-> *progress-save-info* inited) 1) - (zero? (-> *progress-save-info* file arg2 present)) - ) - (if (= arg2 sv-20) - (set-scale! arg1 0.8) - (set-scale! arg1 0.6) + ((and *progress-save-info* + (= (-> *progress-save-info* formatted) 1) + (= (-> *progress-save-info* inited) 1) + (zero? (-> *progress-save-info* file arg2 present)) + ) + (if (= arg2 sv-20) + (set-scale! arg1 0.8) + (set-scale! arg1 0.6) + ) + (let ((a0-150 arg1)) + (set! (-> a0-150 flags) (font-flags kerning large)) ) - (let ((a0-150 arg1)) - (set! (-> a0-150 flags) (font-flags kerning large)) - ) - (+! (-> arg1 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3) - 100 - 105 - ) - ) + (+! (-> arg1 origin x) (the float (if (= (get-aspect-ratio) 'aspect4x3) + 100 + 105 + ) + ) + ) + (print-game-text + (lookup-text! *common-text* (text-id progress-slot-empty) #f) + arg1 + #f + 44 + (bucket-id progress) ) - (print-game-text - (lookup-text! *common-text* (text-id progress-slot-empty) #f) - arg1 - #f - 44 - (bucket-id progress) ) - ) - ) - (set! (-> arg1 origin x) sv-24) - (set! (-> arg1 origin y) sv-28) - (set! (-> arg1 width) sv-32) - (set! (-> arg1 height) sv-36) - (if (zero? arg2) - (draw-decoration-load-save this arg1 sv-16 (if (= (-> arg0 current) 'select-load) - (text-id progress-select-file-to-load) - (text-id progress-select-file-to-save) - ) - ) ) + (set! (-> arg1 origin x) sv-24) + (set! (-> arg1 origin y) sv-28) + (set! (-> arg1 width) sv-32) + (set! (-> arg1 height) sv-36) + (if (zero? arg2) + (draw-decoration-load-save this arg1 sv-16 (if (= (-> arg0 current) 'select-load) + (text-id progress-select-file-to-load) + (text-id progress-select-file-to-save) + ) + ) + ) + ) ) ) - ) + ) 0 (none) ) @@ -3400,22 +3284,14 @@ ;; WARN: Return type mismatch int vs none. ;; WARN: disable def twice: 147. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod draw-option ((this menu-select-start-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-48 int) - (sv-64 int) - (sv-80 game-task-info) - (sv-96 font-context) - (sv-112 (function string font-context symbol int bucket-id float)) - (sv-128 hud-box) - ) (let* ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) (s3-0 (-> this task-index)) (s2-0 0) (s1-0 50) (f28-0 (* (-> arg0 sliding-height) (the float s1-0))) (s0-0 97) + (sv-128 (new 'stack 'hud-box)) ) - (set! sv-128 (new 'stack 'hud-box)) (if (< f30-0 0.0) (set! f30-0 0.0) ) @@ -3470,81 +3346,73 @@ ) (while (< s2-0 8) (when (>= s3-0 0) - (set! sv-48 -1) - (set! sv-64 0) - (while (and (< sv-64 (-> *game-info* play-list length)) (!= sv-48 s3-0)) - (let* ((v1-39 (-> *game-info* play-list sv-64)) - (a0-22 (-> arg0 current)) - (a0-24 (cond - ((= a0-22 'select-pre-start) - (or (-> v1-39 play-continue) (-> v1-39 pre-play-continue)) - ) - ((= a0-22 'select-kiosk-start) - (-> v1-39 kiosk-play-continue) - ) - (else - (-> v1-39 play-continue) + (let ((sv-48 -1) + (sv-64 0) + ) + (while (and (< sv-64 (-> *game-info* play-list length)) (!= sv-48 s3-0)) + (let* ((v1-39 (-> *game-info* play-list sv-64)) + (a0-22 (-> arg0 current)) + (a0-24 (cond + ((= a0-22 'select-pre-start) + (or (-> v1-39 play-continue) (-> v1-39 pre-play-continue)) + ) + ((= a0-22 'select-kiosk-start) + (-> v1-39 kiosk-play-continue) + ) + (else + (-> v1-39 play-continue) + ) ) ) - ) + ) + (when (and a0-24 (lookup-text! *common-text* (-> v1-39 text-name) #t)) + (+! sv-48 1) + sv-48 + ) + ) + (when (!= sv-48 s3-0) + (+! sv-64 1) + sv-64 + ) + ) + (when (!= sv-64 (-> *game-info* play-list length)) + (let ((sv-80 (-> *game-info* play-list sv-64))) + (cond + ((zero? s2-0) + (set! (-> this real-task-index) sv-64) + (let ((sv-96 arg1)) + (set! (-> sv-96 color) (progress-selected 0)) + ) + (draw-highlight (+ s0-0 47) 50 f30-0) ) - (when (and a0-24 (lookup-text! *common-text* (-> v1-39 text-name) #t)) - (set! sv-48 (+ sv-48 1)) - sv-48 - ) - ) - (when (!= sv-48 s3-0) - (set! sv-64 (+ sv-64 1)) - sv-64 - ) - ) - (when (!= sv-64 (-> *game-info* play-list length)) - (set! sv-80 (-> *game-info* play-list sv-64)) - (cond - ((zero? s2-0) - (set! (-> this real-task-index) sv-64) - (set! sv-96 arg1) - (set! (-> sv-96 color) (progress-selected 0)) - (draw-highlight (+ s0-0 47) 50 f30-0) - ) - (else - (let ((a0-35 arg1)) - (set! (-> a0-35 color) (font-color progress)) - ) - ) - ) - (cond - ((and (= (-> *setting-control* user-default language) (language-enum german)) - (= (text-id progress-missions-stadium-board1) (-> sv-80 text-name)) + (else + (let ((a0-35 arg1)) + (set! (-> a0-35 color) (font-color progress)) + ) ) - (set-scale! arg1 0.45) - ) - ((and (= (-> *setting-control* user-default language) (language-enum german)) (!= 454 (-> sv-80 text-name))) - (set-scale! arg1 0.5) - ) - ) - (set-height! arg1 s1-0) - (+! s0-0 s1-0) - (set! (-> arg1 origin y) (the float (+ s0-0 (the int f28-0)))) - (set! sv-112 print-game-text) - (let ((a0-46 (lookup-text! *common-text* (-> sv-80 text-name) #f)) - (a1-12 arg1) - (a2-7 #f) - (a3-2 44) - (t0-3 320) ) - (sv-112 a0-46 a1-12 a2-7 a3-2 (the-as bucket-id t0-3)) + (cond + ((and (= (-> *setting-control* user-default language) (language-enum german)) + (= (text-id progress-missions-stadium-board1) (-> sv-80 text-name)) + ) + (set-scale! arg1 0.45) + ) + ((and (= (-> *setting-control* user-default language) (language-enum german)) (!= 454 (-> sv-80 text-name))) + (set-scale! arg1 0.5) + ) + ) + (set-height! arg1 s1-0) + (+! s0-0 s1-0) + (set! (-> arg1 origin y) (the float (+ s0-0 (the int f28-0)))) + (print-game-text (lookup-text! *common-text* (-> sv-80 text-name) #f) arg1 #f 44 (bucket-id progress)) + ) ) ) ) (+! s3-0 1) (+! s2-0 1) ) - ) - (let ((t9-10 end-scissor-level) - (a1-13 1.0) - ) - (t9-10 sv-128 a1-13) + (end-scissor-level sv-128 1.0) ) (draw-scene-up-down arg1) 0 @@ -3555,20 +3423,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-select-scene-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-48 int) - (sv-64 (function string font-context symbol int bucket-id float)) - (sv-80 (function string font-context symbol int bucket-id float)) - (sv-96 (function _varargs_ object)) - (sv-112 string) - (sv-128 (function string font-context symbol int bucket-id float)) - (sv-144 (function _varargs_ object)) - (sv-160 string) - (sv-176 (function string font-context symbol int bucket-id float)) - (sv-192 font-context) - (sv-208 font-context) - (sv-224 (function string font-context symbol int bucket-id float)) - ) (let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) (s4-0 (-> this task-index)) (s3-0 0) @@ -3615,59 +3469,36 @@ ) (begin-scissor-scene s1-0) (set-scale! arg1 0.5) - (set! sv-48 0) - (while (< sv-48 s4-0) - (set! sv-64 print-game-text) - (let ((a0-4 (lookup-text! *common-text* (-> s2-0 sv-48 text) #f)) - (a1-16 arg1) - (a2-4 #t) - (a3-3 44) - (t0-3 320) + (let ((sv-48 0)) + (while (< sv-48 s4-0) + (+! f28-0 + (print-game-text (lookup-text! *common-text* (-> s2-0 sv-48 text) #f) arg1 #t 44 (bucket-id progress)) ) - (+! f28-0 (sv-64 a0-4 a1-16 a2-4 a3-3 (the-as bucket-id t0-3))) + (+! sv-48 1) ) - (set! sv-48 (+ sv-48 1)) ) (let ((s0-1 (- s0-0 (the int f28-0))) (f28-1 (cond ((< (-> arg0 sliding-height) 0.0) - (set! sv-112 (lookup-text! *common-text* (-> s2-0 s4-0 text) #f)) - 0.0 - (set! sv-80 print-game-text) - (set! sv-96 format) - (let ((a0-7 (clear *temp-string*)) - (a1-18 "~S") + (let ((sv-112 (lookup-text! *common-text* (-> s2-0 s4-0 text) #f))) + 0.0 + (let ((sv-80 print-game-text)) + (format (clear *temp-string*) "~S" sv-112) + (let ((f0-16 (sv-80 *temp-string* arg1 #t 44 (bucket-id progress)))) + (* (-> arg0 sliding-height) f0-16) ) - (sv-96 a0-7 a1-18 sv-112) - ) - (let* ((a0-8 *temp-string*) - (a1-19 arg1) - (a2-7 #t) - (a3-4 44) - (t0-4 320) - (f0-16 (sv-80 a0-8 a1-19 a2-7 a3-4 (the-as bucket-id t0-4))) - ) - (* (-> arg0 sliding-height) f0-16) + ) ) ) (else - (set! sv-160 (lookup-text! *common-text* (-> s2-0 (+ s4-0 -1) text) #f)) - 0.0 - (set! sv-128 print-game-text) - (set! sv-144 format) - (let ((a0-11 (clear *temp-string*)) - (a1-21 "~S") + (let ((sv-160 (lookup-text! *common-text* (-> s2-0 (+ s4-0 -1) text) #f))) + 0.0 + (let ((sv-128 print-game-text)) + (format (clear *temp-string*) "~S" sv-160) + (let ((f0-18 (sv-128 *temp-string* arg1 #t 44 (bucket-id progress)))) + (* (-> arg0 sliding-height) f0-18) ) - (sv-144 a0-11 a1-21 sv-160) - ) - (let* ((a0-12 *temp-string*) - (a1-22 arg1) - (a2-10 #t) - (a3-5 44) - (t0-5 320) - (f0-18 (sv-128 a0-12 a1-22 a2-10 a3-5 (the-as bucket-id t0-5))) - ) - (* (-> arg0 sliding-height) f0-18) + ) ) ) ) @@ -3675,24 +3506,20 @@ ) (set! (-> arg1 origin y) (the float (+ s0-1 (the int f28-1)))) (while (< s3-0 (length s2-0)) - (set! sv-176 print-game-text) - (let* ((a0-14 (lookup-text! *common-text* (-> s2-0 s3-0 text) #f)) - (a1-24 arg1) - (a2-12 #t) - (a3-6 44) - (t0-6 320) - (f26-0 (sv-176 a0-14 a1-24 a2-12 a3-6 (the-as bucket-id t0-6))) - ) + (let ((f26-0 (print-game-text (lookup-text! *common-text* (-> s2-0 s3-0 text) #f) arg1 #t 44 (bucket-id progress))) + ) (set! (-> arg1 flags) (font-flags kerning large)) (cond ((and (< s3-0 s4-0) (!= (-> arg0 sliding-height) 0.0)) - (set! sv-192 arg1) - (set! (-> sv-192 color) (progress-selected 0)) + (let ((sv-192 arg1)) + (set! (-> sv-192 color) (progress-selected 0)) + ) (draw-highlight (+ (the int f26-0) -2 s0-1) (the int f26-0) f30-0) ) ((or (and (= s3-0 s4-0) (= (fabs (-> arg0 sliding-height)) 0.0)) (zero? s3-0)) - (set! sv-208 arg1) - (set! (-> sv-208 color) (progress-selected 0)) + (let ((sv-208 arg1)) + (set! (-> sv-208 color) (progress-selected 0)) + ) (draw-highlight (+ s0-1 -2) (the int f26-0) f30-0) ) (else @@ -3702,15 +3529,11 @@ ) ) ) - (set! sv-224 print-game-text) - (let ((a0-23 (lookup-text! *common-text* (-> s2-0 s3-0 text) #f)) - (a1-28 arg1) - (a2-16 #f) - (a3-7 44) - (t0-7 320) - ) - (+! s0-1 (the int (sv-224 a0-23 a1-28 a2-16 a3-7 (the-as bucket-id t0-7)))) - ) + (+! s0-1 + (the int + (print-game-text (lookup-text! *common-text* (-> s2-0 s3-0 text) #f) arg1 #f 44 (bucket-id progress)) + ) + ) (set! (-> arg1 origin y) (the float (+ s0-1 (the int f28-1)))) (+! s3-0 1) ) @@ -3947,252 +3770,249 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-missions-option) (progress progress) (font-ctx font-context) (arg3 int) (arg4 symbol)) - (local-vars - (f0-50 float) - (font-alpha float) - (task-info-idx int) - (game-task-idx int) - (sv-32 int) - (sv-40 int) - (num-task-info int) - (default-y-origin-4x3 int) - (sv-256 float) - (line-height float) - (inprogress-task-info game-task-node-info) - (completed-task-info game-task-node-info) - (found-closed-task? symbol) - (hud-bounds hud-box) - (font-y-pos float) - (font-scale float) - ) - (set! font-alpha (* 2.0 (- 0.5 (-> progress menu-transition)))) - (set! task-info-idx 1) - (set! game-task-idx 0) - (set! sv-32 0) - (set! sv-40 0) - (set! num-task-info 0) - (set! default-y-origin-4x3 95) - (set! sv-256 (* 395.0 (-> progress sliding))) - (set! line-height (* 44.0 (-> progress sliding-height))) - (set! inprogress-task-info (new 'stack 'game-task-node-info)) - (set! completed-task-info (new 'stack 'game-task-node-info)) - (set! found-closed-task? #t) - (set! hud-bounds (new 'stack-no-clear 'hud-box)) - (set! font-y-pos (-> font-ctx origin y)) - (set! font-scale (-> font-ctx scale)) - (set! (-> *progress-state* current-task-index) (length (-> *game-info* sub-task-list))) - (set! (-> *progress-state* current-line-index) -1) - (set! (-> *progress-state* current-task) (the-as uint -1)) - (set! (-> *progress-state* first-closed-line-index) -1) - (set! (-> *progress-state* extra-text-state) -1) - (set! (-> *progress-state* num-open-tasks-found) 0) - (set! (-> *progress-state* num-closed-tasks-found) 0) - (if (< font-alpha 0.0) - (set! font-alpha (the-as float 0.0)) - ) - (set! (-> font-ctx alpha) font-alpha) - (set! (-> *game-info* mission-list 0) inprogress-task-info) - (set! (-> inprogress-task-info description) (text-id progress-missions-in-progress)) - (set! (-> completed-task-info description) (text-id progress-missions-completed)) - (while (< game-task-idx (length (-> *game-info* sub-task-list))) - (let ((task-info (find-mission-text-at-index game-task-idx)) - (game-task-info-array (-> *game-info* mission-list)) - ) - (when (!= task-info #f) - (when (and (logtest? (-> task-info flags) (game-task-node-flag closed)) found-closed-task?) - (set! found-closed-task? (the-as symbol #f)) - (set! (-> game-task-info-array task-info-idx) completed-task-info) - (set! task-info-idx (+ task-info-idx 1)) - ) - (set! (-> game-task-info-array task-info-idx) task-info) - (set! task-info-idx (+ task-info-idx 1)) + (local-vars (f0-50 float)) + (let ((font-alpha (* 2.0 (- 0.5 (-> progress menu-transition)))) + (task-info-idx 1) + (game-task-idx 0) ) + (let ((sv-32 0)) ) - (set! game-task-idx (+ game-task-idx 1)) - ) - (set! num-task-info task-info-idx) - (set! (-> *progress-state* total-num-tasks) task-info-idx) - (sort-task-node-result num-task-info) - (let ((font-ctx-1 font-ctx)) - (set! (-> font-ctx-1 width) 395.0) - ) - (set! (-> font-ctx origin x) 60.0) - (set! (-> font-ctx origin y) 80.0) - (let ((font-ctx-2 font-ctx)) - (set! (-> font-ctx-2 color) (font-color progress)) - ) - (let ((page-idx (-> this page-index))) - (cond - ((zero? page-idx) - (draw-missions-decoration this font-ctx font-alpha (text-id progress-root-missions)) - ) - ((= page-idx 1) - (draw-missions-decoration this font-ctx font-alpha (text-id progress-root-missions)) - ) + (let ((sv-40 0)) ) - ) - (begin-scissor-missions hud-bounds) - (let ((font-ctx-3 font-ctx)) - (set! (-> font-ctx-3 flags) (font-flags kerning large)) - ) - (+! (-> font-ctx origin x) 20.0) - (case (get-aspect-ratio) - (('aspect16x9) - (set! (-> font-ctx origin y) 80.0) - ) - (('aspect4x3) - (set! (-> font-ctx origin y) (the float default-y-origin-4x3)) - ) - ) - (set-scale! font-ctx font-scale) - (when (zero? (-> this page-index)) - (set! game-task-idx (-> this task-line-index)) - (set! task-info-idx 0) - (let ((y-offset (+ default-y-origin-4x3 44))) - (set! default-y-origin-4x3 y-offset) - (set! (-> font-ctx origin y) (the float (+ y-offset (the int line-height)))) - ) - (set! (-> font-ctx width) 340.0) - (set! (-> font-ctx height) 44.0) - (when (!= line-height 0.0) - (set! (-> *progress-state* missions-total-spacing) 0.0) - (dotimes (game-task-idx-2 game-task-idx) - (let* ((game-task-info-2 (-> *game-info* mission-list game-task-idx-2)) - (task-text-id - (if (and (logtest? (-> game-task-info-2 flags) (game-task-node-flag closed)) - (task-complete? *game-info* (-> game-task-info-2 task)) - ) - (-> *game-info* play-list (-> game-task-info-2 task) text-name) - (-> game-task-info-2 description) - ) - ) - (line-text (lookup-text! *common-text* task-text-id #f)) - (line-padding 3.0) - (print-game-text-fn print-game-text) - ) - (format (clear *temp-string*) "~S" line-text) - (set! (-> *progress-state* missions-total-spacing) - (+ line-padding - (print-game-text-fn *temp-string* font-ctx #t 44 (bucket-id progress)) - (-> *progress-state* missions-total-spacing) - ) - ) + (let ((num-task-info 0) + (default-y-origin-4x3 95) ) + (let ((sv-256 (* 395.0 (-> progress sliding)))) ) - ) - (set! default-y-origin-4x3 (- default-y-origin-4x3 (the int (-> *progress-state* missions-total-spacing)))) - (cond - ((< (-> progress sliding-height) 0.0) - (let* ((game-task-info-3 (-> *game-info* mission-list game-task-idx)) - (task-text-id-2 (if (and (logtest? (-> game-task-info-3 flags) (game-task-node-flag closed)) - (task-complete? *game-info* (-> game-task-info-3 task)) - ) - (-> *game-info* play-list (-> game-task-info-3 task) text-name) - (-> game-task-info-3 description) - ) - ) - (line-text-2 (lookup-text! *common-text* task-text-id-2 #f)) + (let ((line-height (* 44.0 (-> progress sliding-height))) + (inprogress-task-info (new 'stack 'game-task-node-info)) + (completed-task-info (new 'stack 'game-task-node-info)) + (found-closed-task? #t) + (hud-bounds (new 'stack-no-clear 'hud-box)) + ) + (let ((font-y-pos (-> font-ctx origin y))) + ) + (let ((font-scale (-> font-ctx scale))) + (set! (-> *progress-state* current-task-index) (length (-> *game-info* sub-task-list))) + (set! (-> *progress-state* current-line-index) -1) + (set! (-> *progress-state* current-task) (the-as uint -1)) + (set! (-> *progress-state* first-closed-line-index) -1) + (set! (-> *progress-state* extra-text-state) -1) + (set! (-> *progress-state* num-open-tasks-found) 0) + (set! (-> *progress-state* num-closed-tasks-found) 0) + (if (< font-alpha 0.0) + (set! font-alpha (the-as float 0.0)) ) - 0.0 - (let ((line-padding-2 3.0) - (print-game-text-fn-2 print-game-text) - ) - (format (clear *temp-string*) "~S" line-text-2) - (let ((f0-36 (+ line-padding-2 (print-game-text-fn-2 *temp-string* font-ctx #t 44 (bucket-id progress))))) - (set! line-height (* (-> progress sliding-height) f0-36)) - ) - ) - ) - ) - (else - (let* ((s4-4 (-> *game-info* mission-list (+ game-task-idx -1))) - (a1-27 - (if (and (logtest? (-> s4-4 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-4 task))) - (-> *game-info* play-list (-> s4-4 task) text-name) - (-> s4-4 description) - ) - ) - (s4-5 (lookup-text! *common-text* a1-27 #f)) - ) - 0.0 - (let ((f30-2 3.0) - (s3-4 print-game-text) + (set! (-> font-ctx alpha) font-alpha) + (set! (-> *game-info* mission-list 0) inprogress-task-info) + (set! (-> inprogress-task-info description) (text-id progress-missions-in-progress)) + (set! (-> completed-task-info description) (text-id progress-missions-completed)) + (while (< game-task-idx (length (-> *game-info* sub-task-list))) + (let ((task-info (find-mission-text-at-index game-task-idx)) + (game-task-info-array (-> *game-info* mission-list)) + ) + (when (!= task-info #f) + (when (and (logtest? (-> task-info flags) (game-task-node-flag closed)) found-closed-task?) + (set! found-closed-task? (the-as symbol #f)) + (set! (-> game-task-info-array task-info-idx) completed-task-info) + (+! task-info-idx 1) + ) + (set! (-> game-task-info-array task-info-idx) task-info) + (+! task-info-idx 1) ) - (format (clear *temp-string*) "~S" s4-5) - (let ((f0-40 (+ f30-2 (s3-4 *temp-string* font-ctx #t 44 (bucket-id progress))))) - (set! line-height (* (-> progress sliding-height) f0-40)) + ) + (+! game-task-idx 1) + ) + (set! num-task-info task-info-idx) + (set! (-> *progress-state* total-num-tasks) task-info-idx) + (sort-task-node-result num-task-info) + (let ((font-ctx-1 font-ctx)) + (set! (-> font-ctx-1 width) 395.0) + ) + (set! (-> font-ctx origin x) 60.0) + (set! (-> font-ctx origin y) 80.0) + (let ((font-ctx-2 font-ctx)) + (set! (-> font-ctx-2 color) (font-color progress)) + ) + (let ((page-idx (-> this page-index))) + (cond + ((zero? page-idx) + (draw-missions-decoration this font-ctx font-alpha (text-id progress-root-missions)) + ) + ((= page-idx 1) + (draw-missions-decoration this font-ctx font-alpha (text-id progress-root-missions)) + ) ) ) - ) - ) - ) - (set! (-> font-ctx origin y) (the float (+ default-y-origin-4x3 (the int line-height)))) - (while (and (< task-info-idx num-task-info) (< task-info-idx (+ game-task-idx 10))) - (let* ((s4-6 (-> *game-info* mission-list task-info-idx)) - (s3-5 - (if (and (logtest? (-> s4-6 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-6 task))) - (-> *game-info* play-list (-> s4-6 task) text-name) - (-> s4-6 description) - ) - ) - (s5-1 (lookup-text! *common-text* s3-5 #f)) + (begin-scissor-missions hud-bounds) + (let ((font-ctx-3 font-ctx)) + (set! (-> font-ctx-3 flags) (font-flags kerning large)) + ) + (+! (-> font-ctx origin x) 20.0) + (case (get-aspect-ratio) + (('aspect16x9) + (set! (-> font-ctx origin y) 80.0) ) - 0.0 - (set! f0-50 - (cond - ((>= task-info-idx (+ game-task-idx -1)) - (when (and (!= s3-5 381) (!= s3-5 380)) - (let ((s3-6 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! - *common-text* - (if (logtest? (-> s4-6 flags) (game-task-node-flag closed)) - (text-id progress-missions-icon-completed) - (text-id progress-missions-icon-todo) - ) - #f - ) - ) - (s3-6 *temp-string* font-ctx #f 44 (bucket-id progress)) - ) - ) - (+! (-> font-ctx origin x) 20.0) - (let ((f30-3 3.0) - (s4-7 print-game-text) + (('aspect4x3) + (set! (-> font-ctx origin y) (the float default-y-origin-4x3)) + ) + ) + (set! (-> font-ctx scale) font-scale) + ) + (when (zero? (-> this page-index)) + (set! game-task-idx (-> this task-line-index)) + (set! task-info-idx 0) + (let ((y-offset (+ default-y-origin-4x3 44))) + (set! default-y-origin-4x3 y-offset) + (set! (-> font-ctx origin y) (the float (+ y-offset (the int line-height)))) + ) + (set! (-> font-ctx width) 340.0) + (set! (-> font-ctx height) 44.0) + (when (!= line-height 0.0) + (set! (-> *progress-state* missions-total-spacing) 0.0) + (dotimes (game-task-idx-2 game-task-idx) + (let* ((game-task-info-2 (-> *game-info* mission-list game-task-idx-2)) + (task-text-id + (if (and (logtest? (-> game-task-info-2 flags) (game-task-node-flag closed)) + (task-complete? *game-info* (-> game-task-info-2 task)) + ) + (-> *game-info* play-list (-> game-task-info-2 task) text-name) + (-> game-task-info-2 description) + ) ) - (format (clear *temp-string*) "~S" s5-1) - (set! f0-50 (+ f30-3 (s4-7 *temp-string* font-ctx #f 44 (bucket-id progress)))) + (line-text (lookup-text! *common-text* task-text-id #f)) + (line-padding 3.0) + (print-game-text-fn print-game-text) + ) + (format (clear *temp-string*) "~S" line-text) + (set! (-> *progress-state* missions-total-spacing) + (+ line-padding + (print-game-text-fn *temp-string* font-ctx #t 44 (bucket-id progress)) + (-> *progress-state* missions-total-spacing) + ) + ) + ) + ) + ) + (set! default-y-origin-4x3 (- default-y-origin-4x3 (the int (-> *progress-state* missions-total-spacing)))) + (set! line-height + (cond + ((< (-> progress sliding-height) 0.0) + (let* ((game-task-info-3 (-> *game-info* mission-list game-task-idx)) + (task-text-id-2 (if (and (logtest? (-> game-task-info-3 flags) (game-task-node-flag closed)) + (task-complete? *game-info* (-> game-task-info-3 task)) + ) + (-> *game-info* play-list (-> game-task-info-3 task) text-name) + (-> game-task-info-3 description) + ) + ) + (line-text-2 (lookup-text! *common-text* task-text-id-2 #f)) + ) + 0.0 + (let ((line-padding-2 3.0) + (print-game-text-fn-2 print-game-text) + ) + (format (clear *temp-string*) "~S" line-text-2) + (let ((f0-36 (+ line-padding-2 (print-game-text-fn-2 *temp-string* font-ctx #t 44 (bucket-id progress))))) + (set! line-height (* (-> progress sliding-height) f0-36)) + ) + ) + ) + line-height ) - (+! (-> font-ctx origin x) -20.0) - f0-50 - ) - (else - (let ((f30-4 3.0) - (s4-8 print-game-text) + (else + (let* ((s4-4 (-> *game-info* mission-list (+ game-task-idx -1))) + (a1-27 + (if (and (logtest? (-> s4-4 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-4 task))) + (-> *game-info* play-list (-> s4-4 task) text-name) + (-> s4-4 description) + ) + ) + (s4-5 (lookup-text! *common-text* a1-27 #f)) + ) + 0.0 + (let ((f30-2 3.0) + (s3-4 print-game-text) + ) + (format (clear *temp-string*) "~S" s4-5) + (let ((f0-40 (+ f30-2 (s3-4 *temp-string* font-ctx #t 44 (bucket-id progress))))) + (* (-> progress sliding-height) f0-40) + ) ) - (format (clear *temp-string*) "~S" s5-1) - (+ f30-4 (s4-8 *temp-string* font-ctx #t 44 (bucket-id progress))) + ) ) ) ) + (set! (-> font-ctx origin y) (the float (+ default-y-origin-4x3 (the int line-height)))) + (while (and (< task-info-idx num-task-info) (< task-info-idx (+ game-task-idx 10))) + (let* ((s4-6 (-> *game-info* mission-list task-info-idx)) + (s3-5 + (if (and (logtest? (-> s4-6 flags) (game-task-node-flag closed)) (task-complete? *game-info* (-> s4-6 task))) + (-> *game-info* play-list (-> s4-6 task) text-name) + (-> s4-6 description) + ) + ) + (s5-1 (lookup-text! *common-text* s3-5 #f)) + ) + 0.0 + (set! f0-50 + (cond + ((>= task-info-idx (+ game-task-idx -1)) + (when (and (!= s3-5 381) (!= s3-5 380)) + (let ((s3-6 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! + *common-text* + (if (logtest? (-> s4-6 flags) (game-task-node-flag closed)) + (text-id progress-missions-icon-completed) + (text-id progress-missions-icon-todo) + ) + #f + ) + ) + (s3-6 *temp-string* font-ctx #f 44 (bucket-id progress)) + ) + ) + (+! (-> font-ctx origin x) 20.0) + (let ((f30-3 3.0) + (s4-7 print-game-text) + ) + (format (clear *temp-string*) "~S" s5-1) + (set! f0-50 (+ f30-3 (s4-7 *temp-string* font-ctx #f 44 (bucket-id progress)))) + ) + (+! (-> font-ctx origin x) -20.0) + f0-50 + ) + (else + (let ((f30-4 3.0) + (s4-8 print-game-text) + ) + (format (clear *temp-string*) "~S" s5-1) + (+ f30-4 (s4-8 *temp-string* font-ctx #t 44 (bucket-id progress))) + ) + ) + ) + ) + ) + (let ((v1-142 (+ default-y-origin-4x3 (the int f0-50)))) + (set! default-y-origin-4x3 v1-142) + (set! (-> font-ctx origin y) (the float (+ v1-142 (the int line-height)))) + ) + (+! task-info-idx 1) + ) + (if (zero? (-> *progress-state* total-num-tasks)) + (print-game-text + (lookup-text! *common-text* (text-id progress-missions-none) #f) + font-ctx + #f + 44 + (bucket-id progress) + ) ) - ) - (let ((v1-142 (+ default-y-origin-4x3 (the int f0-50)))) - (set! default-y-origin-4x3 v1-142) - (set! (-> font-ctx origin y) (the float (+ v1-142 (the int line-height)))) - ) - (set! task-info-idx (+ task-info-idx 1)) - ) - (if (zero? (-> *progress-state* total-num-tasks)) - (print-game-text - (lookup-text! *common-text* (text-id progress-missions-none) #f) - font-ctx - #f - 44 - (bucket-id progress) ) + (end-scissor-missions hud-bounds 1.0) ) + ) ) - (end-scissor-missions hud-bounds 1.0) (draw-missions-up-down font-ctx) 0 (none) @@ -4647,199 +4467,183 @@ ;; WARN: Stack slot offset 108 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-secret-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (sv-16 float) - (sv-20 symbol) - (sv-24 int) - (sv-32 float) - (sv-36 float) - (sv-40 symbol) - (sv-44 int) - (sv-48 progress) - (sv-96 int) - (sv-104 int) - (sv-108 float) - (sv-112 int) - (sv-116 int) - (sv-120 hud-box) - (sv-128 int) - ) - (set! sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) - (set! sv-20 (logtest? (-> *game-info* secrets) (game-secrets hero-mode))) - (set! sv-24 (the int (-> *game-info* skill-total))) - (set! sv-32 395.0) - (set! sv-36 25.0) - (set! sv-40 arg3) - (set! sv-44 arg2) - (set! sv-48 arg0) - (set! sv-96 (if (not sv-20) - 0 - (-> this num-items) - ) + (let ((sv-16 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) + (sv-20 (logtest? (-> *game-info* secrets) (game-secrets hero-mode))) + (sv-24 (the int (-> *game-info* skill-total))) + (sv-32 395.0) + (sv-36 25.0) + (sv-40 arg3) ) - (set! sv-104 (if (not sv-20) - (-> this num-items) - (+ (-> this num-items) (-> this num-hero-items)) - ) - ) - (set! sv-108 (* (-> sv-48 sliding) sv-36)) - (set! sv-112 (-> this item-index)) - (set! sv-116 (-> this prev-item-index)) - (set! sv-120 (new 'stack-no-clear 'hud-box)) - (set! sv-128 205) - (if (< sv-16 0.0) - (set! sv-16 (the-as float 0.0)) + (let ((sv-44 arg2)) ) - (cond - ((or (not (-> *bigmap* progress-minimap)) (< (-> this item-index) sv-96) (< sv-104 (-> this item-index))) - (draw-busy-loading arg1) - ) - (else - (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc93))) - (set! (-> this sprites 0 flags) (the-as uint 4)) - (set! (-> this sprites 0 scale-x) 0.64) - (set! (-> this sprites 0 scale-y) 0.64) - (let ((v1-32 (-> this sprites 0 color2))) - (set! (-> v1-32 0) 128) - (set! (-> v1-32 1) 128) - (set! (-> v1-32 2) 128) - (set! (-> v1-32 3) (the int (* 128.0 sv-16))) - ) - (set! (-> this sprites 0 pos z) #xffffff) - (set! (-> this sprites 0 pos w) 0) - (set-hud-piece-position! (-> this sprites 0) 100 128) - (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) - (bucket-id progress) - ) - ((method-of-type hud-sprite draw) (-> this sprites 0) s3-0 (-> *level* default-level)) - ) - (set! (-> arg1 alpha) sv-16) - (let ((a0-21 arg1)) - (set! (-> a0-21 flags) (font-flags kerning middle large)) - ) - (let ((a0-22 arg1)) - (set! (-> a0-22 color) (font-color progress)) - ) - (set! (-> arg1 origin x) 59.0) - (let ((v1-54 arg1)) - (set! (-> v1-54 width) sv-32) - ) - (let ((v1-55 arg1)) - (set! (-> v1-55 height) sv-36) - ) - (set-scale! arg1 1.0) - (set! (-> arg1 origin y) 82.0) - (let ((t9-5 draw-decoration-secrets) - (a0-24 this) - (a1-4 arg1) - (a2-4 sv-16) - (a3-2 339) - ) - (t9-5 a0-24 a1-4 a2-4 (the-as text-id a3-2)) - ) - (set-scale! arg1 0.45) - (if (or (= (-> *setting-control* user-default language) (language-enum japanese)) - (= (-> *setting-control* user-default language) (language-enum korean)) - ) - (set-scale! arg1 0.53) + (let* ((sv-48 arg0) + (sv-96 (if (not sv-20) + 0 + (-> this num-items) + ) + ) + (sv-104 (if (not sv-20) + (-> this num-items) + (+ (-> this num-items) (-> this num-hero-items)) + ) + ) + (sv-108 (* (-> sv-48 sliding) sv-36)) + (sv-112 (-> this item-index)) + (sv-116 (-> this prev-item-index)) + (sv-120 (new 'stack-no-clear 'hud-box)) + (sv-128 205) + ) + (if (< sv-16 0.0) + (set! sv-16 (the-as float 0.0)) ) - (case (get-aspect-ratio) - (('aspect4x3) - (set-height! arg1 185) - (set! (-> arg1 origin y) 133.0) - ) - (('aspect16x9) - (set-height! arg1 185) - (set! (-> arg1 origin y) 133.0) - ) - ) - (let ((a0-34 arg1)) - (set! (-> a0-34 flags) (font-flags kerning large)) - ) - (set! (-> arg1 origin x) 100.0) - (let ((s4-1 print-game-text)) - (format - (clear *temp-string*) - "x~D ~S" - sv-24 - (lookup-text! *common-text* (text-id progress-secrets-orb-label) #f) - ) - (s4-1 *temp-string* arg1 #f 44 (bucket-id progress)) - ) - (set! (-> arg1 origin x) 100.0) - (begin-scissor-secret sv-120 sv-48) - (case (get-aspect-ratio) - (('aspect16x9) - (set! sv-128 195) - ) - ) (cond - (sv-40 - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 25 sv-128))) - (draw-secret-list (-> this secret-items sv-112) sv-48 arg1 1 sv-40 sv-108) - ) - ((>= (- sv-112 sv-116) 0) - (when (>= (+ sv-112 -3) sv-96) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) -50 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 -3)) sv-48 arg1 0 sv-40 sv-108) - ) - (when (>= (+ sv-112 -2) sv-96) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) -25 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 -2)) sv-48 arg1 0 sv-40 sv-108) - ) - (set! (-> arg1 origin y) (the float (+ sv-128 (the int sv-108)))) - (when (>= (+ sv-112 -1) sv-96) - (draw-highlight (+ sv-128 22) 22 sv-16) - (draw-secret-list (-> this secret-items (+ sv-112 -1)) sv-48 arg1 0 sv-40 sv-108) - ) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 25 sv-128))) - (draw-highlight (+ sv-128 22) 22 sv-16) - (draw-secret-list (-> this secret-items sv-112) sv-48 arg1 1 sv-40 sv-108) - (when (< (+ sv-112 1) sv-104) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 50 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 1)) sv-48 arg1 0 sv-40 sv-108) - ) - (when (< (+ sv-112 2) sv-104) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 75 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 2)) sv-48 arg1 0 sv-40 sv-108) - ) - (when (< (+ sv-112 3) sv-104) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 100 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 3)) sv-48 arg1 0 sv-40 sv-108) - ) + ((or (not (-> *bigmap* progress-minimap)) (< (-> this item-index) sv-96) (< sv-104 (-> this item-index))) + (draw-busy-loading arg1) ) (else - (when (>= (+ sv-112 -2) sv-96) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) -25 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 -2)) sv-48 arg1 0 sv-40 sv-108) + (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x5 :page #xc93))) + (set! (-> this sprites 0 flags) (the-as uint 4)) + (set! (-> this sprites 0 scale-x) 0.64) + (set! (-> this sprites 0 scale-y) 0.64) + (let ((v1-32 (-> this sprites 0 color2))) + (set! (-> v1-32 0) 128) + (set! (-> v1-32 1) 128) + (set! (-> v1-32 2) 128) + (set! (-> v1-32 3) (the int (* 128.0 sv-16))) ) - (set! (-> arg1 origin y) (the float (+ sv-128 (the int sv-108)))) - (if (>= (+ sv-112 -1) sv-96) - (draw-secret-list (-> this secret-items (+ sv-112 -1)) sv-48 arg1 0 sv-40 sv-108) + (set! (-> this sprites 0 pos z) #xffffff) + (set! (-> this sprites 0 pos w) 0) + (set-hud-piece-position! (-> this sprites 0) 100 128) + (with-dma-buffer-add-bucket ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf)) + (bucket-id progress) + ) + ((method-of-type hud-sprite draw) (-> this sprites 0) s3-0 (-> *level* default-level)) + ) + (set! (-> arg1 alpha) sv-16) + (let ((a0-21 arg1)) + (set! (-> a0-21 flags) (font-flags kerning middle large)) + ) + (let ((a0-22 arg1)) + (set! (-> a0-22 color) (font-color progress)) + ) + (set! (-> arg1 origin x) 59.0) + (set! (-> arg1 width) sv-32) + (set! (-> arg1 height) sv-36) + (set-scale! arg1 1.0) + (set! (-> arg1 origin y) 82.0) + (let ((t9-5 draw-decoration-secrets) + (a0-24 this) + (a1-4 arg1) + (a2-4 sv-16) + (a3-2 339) + ) + (t9-5 a0-24 a1-4 a2-4 (the-as text-id a3-2)) + ) + (set-scale! arg1 0.45) + (if (or (= (-> *setting-control* user-default language) (language-enum japanese)) + (= (-> *setting-control* user-default language) (language-enum korean)) + ) + (set-scale! arg1 0.53) ) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 25 sv-128))) - (draw-highlight (+ sv-128 22) 22 sv-16) - (draw-secret-list (-> this secret-items sv-112) sv-48 arg1 1 sv-40 sv-108) - (when (< (+ sv-112 1) sv-104) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 50 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 1)) sv-48 arg1 0 sv-40 sv-108) + (case (get-aspect-ratio) + (('aspect4x3) + (set-height! arg1 185) + (set! (-> arg1 origin y) 133.0) + ) + (('aspect16x9) + (set-height! arg1 185) + (set! (-> arg1 origin y) 133.0) + ) ) - (when (< (+ sv-112 2) sv-104) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 75 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 2)) sv-48 arg1 0 sv-40 sv-108) + (let ((a0-34 arg1)) + (set! (-> a0-34 flags) (font-flags kerning large)) ) - (when (< (+ sv-112 3) sv-104) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 100 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 3)) sv-48 arg1 0 sv-40 sv-108) + (set! (-> arg1 origin x) 100.0) + (let ((s4-1 print-game-text)) + (format + (clear *temp-string*) + "x~D ~S" + sv-24 + (lookup-text! *common-text* (text-id progress-secrets-orb-label) #f) + ) + (s4-1 *temp-string* arg1 #f 44 (bucket-id progress)) ) - (when (< (+ sv-112 4) sv-104) - (set! (-> arg1 origin y) (the float (+ (the int sv-108) 125 sv-128))) - (draw-secret-list (-> this secret-items (+ sv-112 4)) sv-48 arg1 0 sv-40 sv-108) + (set! (-> arg1 origin x) 100.0) + (begin-scissor-secret sv-120 sv-48) + (case (get-aspect-ratio) + (('aspect16x9) + (set! sv-128 195) + ) ) + (cond + (sv-40 + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 25 sv-128))) + (draw-secret-list (-> this secret-items sv-112) sv-48 arg1 1 sv-40 sv-108) + ) + ((>= (- sv-112 sv-116) 0) + (when (>= (+ sv-112 -3) sv-96) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) -50 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 -3)) sv-48 arg1 0 sv-40 sv-108) + ) + (when (>= (+ sv-112 -2) sv-96) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) -25 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 -2)) sv-48 arg1 0 sv-40 sv-108) + ) + (set! (-> arg1 origin y) (the float (+ sv-128 (the int sv-108)))) + (when (>= (+ sv-112 -1) sv-96) + (draw-highlight (+ sv-128 22) 22 sv-16) + (draw-secret-list (-> this secret-items (+ sv-112 -1)) sv-48 arg1 0 sv-40 sv-108) + ) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 25 sv-128))) + (draw-highlight (+ sv-128 22) 22 sv-16) + (draw-secret-list (-> this secret-items sv-112) sv-48 arg1 1 sv-40 sv-108) + (when (< (+ sv-112 1) sv-104) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 50 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 1)) sv-48 arg1 0 sv-40 sv-108) + ) + (when (< (+ sv-112 2) sv-104) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 75 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 2)) sv-48 arg1 0 sv-40 sv-108) + ) + (when (< (+ sv-112 3) sv-104) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 100 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 3)) sv-48 arg1 0 sv-40 sv-108) + ) + ) + (else + (when (>= (+ sv-112 -2) sv-96) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) -25 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 -2)) sv-48 arg1 0 sv-40 sv-108) + ) + (set! (-> arg1 origin y) (the float (+ sv-128 (the int sv-108)))) + (if (>= (+ sv-112 -1) sv-96) + (draw-secret-list (-> this secret-items (+ sv-112 -1)) sv-48 arg1 0 sv-40 sv-108) + ) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 25 sv-128))) + (draw-highlight (+ sv-128 22) 22 sv-16) + (draw-secret-list (-> this secret-items sv-112) sv-48 arg1 1 sv-40 sv-108) + (when (< (+ sv-112 1) sv-104) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 50 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 1)) sv-48 arg1 0 sv-40 sv-108) + ) + (when (< (+ sv-112 2) sv-104) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 75 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 2)) sv-48 arg1 0 sv-40 sv-108) + ) + (when (< (+ sv-112 3) sv-104) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 100 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 3)) sv-48 arg1 0 sv-40 sv-108) + ) + (when (< (+ sv-112 4) sv-104) + (set! (-> arg1 origin y) (the float (+ (the int sv-108) 125 sv-128))) + (draw-secret-list (-> this secret-items (+ sv-112 4)) sv-48 arg1 0 sv-40 sv-108) + ) + ) + ) + (end-scissor-secret sv-120 1.0) + (draw-up-down arg1) ) ) - (end-scissor-secret sv-120 1.0) - (draw-up-down arg1) ) ) 0 @@ -5045,181 +4849,183 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; WARN: Stack slot offset 20 signed mismatch (defun print-highscore ((arg0 print-highscore-obj)) - (local-vars (sv-16 font-context) (sv-20 float) (sv-24 int) (sv-32 int) (sv-40 print-highscore-obj)) - (set! sv-16 (-> arg0 context)) - (set! sv-20 (-> arg0 interp)) - (set! sv-24 50) - (set! sv-32 (if (= (get-aspect-ratio) 'aspect4x3) - 320 - 300 - ) + (let ((sv-16 (-> arg0 context)) + (sv-20 (-> arg0 interp)) + (sv-24 50) + (sv-32 (if (= (get-aspect-ratio) 'aspect4x3) + 320 + 300 + ) + ) ) - (set! sv-40 arg0) - (let ((a0-1 sv-16)) - (set! (-> a0-1 flags) (font-flags kerning large)) - ) - (+! (-> sv-16 origin x) (the float sv-24)) - (let ((v1-8 (-> sv-40 place))) - (cond - ((zero? v1-8) - (let ((gp-1 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-1st) #f)) - (gp-1 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 112) - 174 - 0.25 - (-> sv-40 local-scale) + (let ((sv-40 arg0)) + (let ((a0-1 sv-16)) + (set! (-> a0-1 flags) (font-flags kerning large)) + ) + (+! (-> sv-16 origin x) (the float sv-24)) + (let ((v1-8 (-> sv-40 place))) + (cond + ((zero? v1-8) + (let ((gp-1 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-1st) #f)) + (gp-1 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 112) + 174 + 0.25 + (-> sv-40 local-scale) + ) + ) ) - ) - ((= v1-8 1) - (set-scale! sv-16 0.5) - (+! (-> sv-16 origin y) 23.0) - (let ((gp-3 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-2nd) #f)) - (gp-3 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 111) - 197 - 0.22 - (-> sv-40 local-scale) + ((= v1-8 1) + (set-scale! sv-16 0.5) + (+! (-> sv-16 origin y) 23.0) + (let ((gp-3 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-2nd) #f)) + (gp-3 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 111) + 197 + 0.22 + (-> sv-40 local-scale) + ) + ) ) - ) - ((= v1-8 2) - (set-scale! sv-16 0.4) - (+! (-> sv-16 origin y) 20.0) - (let ((gp-5 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-3rd) #f)) - (gp-5 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 110) - 217 - 0.2 - (-> sv-40 local-scale) + ((= v1-8 2) + (set-scale! sv-16 0.4) + (+! (-> sv-16 origin y) 20.0) + (let ((gp-5 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-3rd) #f)) + (gp-5 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 110) + 217 + 0.2 + (-> sv-40 local-scale) + ) + ) ) - ) - ((= v1-8 3) - (set-scale! sv-16 0.3) - (+! (-> sv-16 origin y) 15.0) - (let ((gp-7 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-4th) #f)) - (gp-7 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 109) - 232 - 0.15 - (-> sv-40 local-scale) + ((= v1-8 3) + (set-scale! sv-16 0.3) + (+! (-> sv-16 origin y) 15.0) + (let ((gp-7 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-4th) #f)) + (gp-7 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 109) + 232 + 0.15 + (-> sv-40 local-scale) + ) + ) ) - ) - ((= v1-8 4) - (+! (-> sv-16 origin y) 12.0) - (let ((gp-9 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-5th) #f)) - (gp-9 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 109) - 244 - 0.15 - (-> sv-40 local-scale) + ((= v1-8 4) + (+! (-> sv-16 origin y) 12.0) + (let ((gp-9 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-5th) #f)) + (gp-9 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 109) + 244 + 0.15 + (-> sv-40 local-scale) + ) + ) ) - ) - ((= v1-8 5) - (+! (-> sv-16 origin y) 12.0) - (let ((gp-11 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-6th) #f)) - (gp-11 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 109) - 256 - 0.15 - (-> sv-40 local-scale) + ((= v1-8 5) + (+! (-> sv-16 origin y) 12.0) + (let ((gp-11 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-6th) #f)) + (gp-11 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 109) + 256 + 0.15 + (-> sv-40 local-scale) + ) + ) ) - ) - ((= v1-8 6) - (+! (-> sv-16 origin y) 12.0) - (let ((gp-13 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-7th) #f)) - (gp-13 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 109) - 268 - 0.15 - (-> sv-40 local-scale) + ((= v1-8 6) + (+! (-> sv-16 origin y) 12.0) + (let ((gp-13 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-7th) #f)) + (gp-13 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 109) + 268 + 0.15 + (-> sv-40 local-scale) + ) + ) ) - ) - ((= v1-8 7) - (+! (-> sv-16 origin y) 12.0) - (let ((gp-15 print-game-text)) - (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-8th) #f)) - (gp-15 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - (if (not (-> sv-40 previous)) - (draw-highscore-cup - (-> sv-40 self) - (eval-highscore sv-40) - (+ (the int sv-20) 109) - 280 - 0.15 - (-> sv-40 local-scale) + ((= v1-8 7) + (+! (-> sv-16 origin y) 12.0) + (let ((gp-15 print-game-text)) + (format (clear *temp-string*) "~S" (lookup-text! *common-text* (text-id progress-highscores-8th) #f)) + (gp-15 *temp-string* sv-16 #f 44 (bucket-id progress)) ) + (if (not (-> sv-40 previous)) + (draw-highscore-cup + (-> sv-40 self) + (eval-highscore sv-40) + (+ (the int sv-20) 109) + 280 + 0.15 + (-> sv-40 local-scale) + ) + ) ) - ) + ) + ) + (+! (-> sv-16 origin x) (the float sv-32)) + (let ((a0-67 sv-16)) + (set! (-> a0-67 flags) (font-flags kerning right large)) + ) + (cond + ((-> sv-40 game-score) + (let ((gp-17 print-game-text)) + (format (clear *temp-string*) "~D" (the int (-> sv-40 score))) + (gp-17 *temp-string* sv-16 #f 44 (bucket-id progress)) + ) + ) + (else + (print-game-text (str-print-time (-> sv-40 score)) sv-16 #f 44 (bucket-id progress)) + ) + ) ) - ) - (+! (-> sv-16 origin x) (the float sv-32)) - (let ((a0-67 sv-16)) - (set! (-> a0-67 flags) (font-flags kerning right large)) - ) - (cond - ((-> sv-40 game-score) - (let ((gp-17 print-game-text)) - (format (clear *temp-string*) "~D" (the int (-> sv-40 score))) - (gp-17 *temp-string* sv-16 #f 44 (bucket-id progress)) - ) - ) - (else - (print-game-text (str-print-time (-> sv-40 score)) sv-16 #f 44 (bucket-id progress)) + (let ((a0-73 sv-16)) + (set! (-> a0-73 flags) (font-flags kerning large)) ) + (set! (-> sv-16 origin x) (- (-> sv-16 origin x) (the float (+ sv-24 sv-32)))) ) - (let ((a0-73 sv-16)) - (set! (-> a0-73 flags) (font-flags kerning large)) - ) - (set! (-> sv-16 origin x) (- (-> sv-16 origin x) (the float (+ sv-24 sv-32)))) ) ;; definition for function get-highscore-text @@ -5813,262 +5619,247 @@ (option-index int) (selected? symbol) ) - (local-vars - (sv-96 float) - (sv-100 float) - (sv-104 float) - (sv-108 float) - (sv-112 hud-box) - (sv-116 print-highscore-obj) - (sv-120 float) - (sv-124 float) - (sv-128 symbol) - (sv-132 int) - (sv-136 progress) - (sv-140 font-context) - (sv-144 menu-highscores-option) - ) - (set! sv-96 (* 2.0 (- 0.5 (-> progress menu-transition)))) - (set! sv-100 0.22) - (set! sv-104 395.0) - (set! sv-108 (-> font-ctx origin x)) - (set! sv-112 (new 'stack-no-clear 'hud-box)) - (set! sv-116 (new 'stack 'print-highscore-obj)) - (set! sv-120 (* (-> progress sliding) sv-104)) - (set! sv-124 (* (-> progress sliding-off) (-> this slide-dir) sv-104)) - (set! sv-128 selected?) - (set! sv-132 option-index) - (set! sv-136 progress) - (set! sv-140 font-ctx) - (set! sv-144 this) - (if (< sv-96 0.0) - (set! sv-96 (the-as float 0.0)) + (let* ((sv-96 (* 2.0 (- 0.5 (-> progress menu-transition)))) + (sv-100 0.22) + (sv-104 395.0) + (sv-108 (-> font-ctx origin x)) + (sv-112 (new 'stack-no-clear 'hud-box)) + (sv-116 (new 'stack 'print-highscore-obj)) + (sv-120 (* (-> progress sliding) sv-104)) + (sv-124 (* (-> progress sliding-off) (-> this slide-dir) sv-104)) + ) + (let ((sv-128 selected?)) ) - (cond - ((not (-> *bigmap* progress-minimap)) - (draw-busy-loading sv-140) - ) - (else - (set! (-> sv-140 alpha) sv-96) - (set-scale! sv-140 1.0) - (let ((a0-4 sv-140)) - (set! (-> a0-4 flags) (font-flags kerning middle large)) - ) - (let ((a0-5 sv-140)) - (set! (-> a0-5 color) (font-color progress)) - ) - (set! (-> sv-140 origin x) 59.0) - (set! (-> sv-140 origin y) 78.0) - (let ((v1-23 sv-140)) - (set! (-> v1-23 width) sv-104) - ) - (let ((v1-24 sv-140)) - (set! (-> v1-24 height) 215.0) - ) - (begin-scissor sv-112 sv-136) - (set! (-> sv-144 sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xc93))) - (set! (-> sv-144 sprites 0 flags) (the-as uint 4)) - (set! (-> sv-144 sprites 0 scale-x) sv-100) - (set! (-> sv-144 sprites 0 scale-y) sv-100) - (let ((v1-33 (-> sv-144 sprites 0 color2))) - (set! (-> v1-33 0) 128) - (set! (-> v1-33 1) 128) - (set! (-> v1-33 2) 128) - (set! (-> v1-33 3) (the int (* 128.0 sv-96))) - ) - (set! (-> sv-144 sprites 0 pos z) #xfffff0) - (set! (-> sv-144 sprites 0 pos w) 0) - (if (= (-> *setting-control* user-default language) (language-enum spanish)) - (draw-decoration sv-144 sv-140 sv-96 (text-id progress-root-highscores) #t 0.8) - (draw-decoration sv-144 sv-140 sv-96 (text-id progress-root-highscores) #t 0.95) + (let ((sv-132 option-index)) + ) + (let ((sv-136 progress) + (sv-140 font-ctx) + (sv-144 this) ) - (set-scale! sv-140 0.6) - (let ((v1-40 sv-140)) - (set! (-> v1-40 height) 185.0) - ) - (+! (-> sv-140 origin y) 46.0) - (set! (-> sv-140 origin x) 65.0) - (set-width! sv-140 367) - (let ((a0-23 sv-140)) - (set! (-> a0-23 flags) (font-flags kerning large)) - ) - (let ((a0-24 sv-140)) - (set! (-> a0-24 color) (font-color progress-force-selected)) - ) - (set! (-> sv-140 origin x) (+ 20.0 sv-120 (-> sv-140 origin x))) - (set-scale! sv-140 0.75) - (if (= (-> *setting-control* user-default language) (language-enum german)) - (set-scale! sv-140 0.69) + (if (< sv-96 0.0) + (set! sv-96 (the-as float 0.0)) ) - (if (= (-> *setting-control* user-default language) (language-enum french)) - (set-scale! sv-140 0.72) - ) - (if (= (-> *setting-control* user-default language) (language-enum spanish)) - (set-scale! sv-140 0.65) - ) - (let ((gp-1 print-game-text)) - (format - (clear *temp-string*) - "~S" - (lookup-text! *common-text* (get-highscore-text (-> sv-144 page-index)) #f) - ) - (gp-1 *temp-string* sv-140 #f 44 (bucket-id progress)) - ) - (+! (-> sv-140 origin y) 25.0) - (set-scale! sv-140 0.6) - (if (or (= (-> *setting-control* user-default language) (language-enum french)) - (= (-> *setting-control* user-default language) (language-enum spanish)) - ) - (set-scale! sv-140 0.58) - ) - (let ((gp-2 print-game-text)) - (format - (clear *temp-string*) - "~S" - (lookup-text! *common-text* (get-highscore-text-sub (-> sv-144 page-index)) #f) - ) - (gp-2 *temp-string* sv-140 #f 44 (bucket-id progress)) - ) - (set! (-> sv-140 origin x) (- (-> sv-140 origin x) (+ 20.0 sv-120))) - (+! (-> sv-140 origin y) 25.0) - (draw-highscore-icon - sv-144 - (get-highscore-icon (-> sv-144 page-index)) - (the int (+ (the float (get-highscore-icon-xoffset (-> sv-144 page-index))) sv-120)) - (get-highscore-icon-yoffset (-> sv-144 page-index)) - (get-highscore-icon-scale (-> sv-144 page-index)) - ) - (set! sv-108 (-> sv-140 origin x)) - (let ((a0-54 sv-140)) - (set! (-> a0-54 color) (font-color progress)) - ) - (+! (-> sv-140 origin x) sv-120) - (set-scale! sv-140 0.6) - (let ((gp-5 (get-game-score-ref *game-info* (get-highscore-score (-> sv-144 page-index))))) - (set! (-> sv-116 index) (-> sv-144 page-index)) - (set! (-> sv-116 previous) #f) - (set! (-> sv-116 self) sv-144) - (case (get-highscore-type (-> sv-144 page-index)) - (('game) - (set! (-> sv-116 game-score) #t) - ) - (('race) - (set! (-> sv-116 game-score) #f) - ) - ) - (set! (-> sv-116 context) sv-140) - (set! (-> sv-116 local-scale) sv-96) - (set! (-> sv-116 interp) sv-120) - (dotimes (s5-5 8) - (set! (-> sv-116 place) s5-5) - (set! (-> sv-116 score) (-> gp-5 s5-5)) - (print-highscore sv-116) - ) - ) - (set! (-> sv-140 origin x) sv-108) - (set-scale! sv-140 0.6) - (set! (-> sv-140 origin x) 59.0) - (set! (-> sv-140 origin y) 78.0) - (let ((v1-125 sv-140)) - (set! (-> v1-125 width) sv-104) - ) - (let ((v1-126 sv-140)) - (set! (-> v1-126 height) 215.0) - ) - (set-scale! sv-140 0.5) - (let ((v1-128 sv-140)) - (set! (-> v1-128 height) 185.0) - ) - (+! (-> sv-140 origin y) 46.0) - (set! (-> sv-140 origin x) 80.0) - (set! (-> sv-144 sprites 0 pos z) #xffffff) - (let ((v1-135 sv-140)) - (set! (-> v1-135 width) sv-104) - ) - (let ((a0-74 sv-140)) - (set! (-> a0-74 flags) (font-flags kerning large)) - ) - (let ((a0-75 sv-140)) - (set! (-> a0-75 color) (font-color progress-force-selected)) - ) - (set! (-> sv-140 origin x) (+ 20.0 sv-124 (-> sv-140 origin x))) - (set-scale! sv-140 0.75) - (if (= (-> *setting-control* user-default language) (language-enum german)) - (set-scale! sv-140 0.69) - ) - (if (= (-> *setting-control* user-default language) (language-enum french)) - (set-scale! sv-140 0.72) - ) - (if (= (-> *setting-control* user-default language) (language-enum spanish)) - (set-scale! sv-140 0.65) - ) - (let ((gp-6 print-game-text)) - (format - (clear *temp-string*) - "~S" - (lookup-text! *common-text* (get-highscore-text (-> sv-144 prev-page-index)) #f) - ) - (gp-6 *temp-string* sv-140 #f 44 (bucket-id progress)) - ) - (+! (-> sv-140 origin y) 25.0) - (set-scale! sv-140 0.6) - (if (or (= (-> *setting-control* user-default language) (language-enum french)) - (= (-> *setting-control* user-default language) (language-enum spanish)) - ) - (set-scale! sv-140 0.58) - ) - (let ((gp-7 print-game-text)) - (format - (clear *temp-string*) - "~S" - (lookup-text! *common-text* (get-highscore-text-sub (-> sv-144 prev-page-index)) #f) - ) - (gp-7 *temp-string* sv-140 #f 44 (bucket-id progress)) - ) - (set! (-> sv-140 origin x) (- (-> sv-140 origin x) (+ 20.0 sv-124))) - (+! (-> sv-140 origin y) 25.0) - (draw-highscore-icon - sv-144 - (get-highscore-icon (-> sv-144 prev-page-index)) - (the int (+ (the float (get-highscore-icon-xoffset (-> sv-144 page-index))) sv-124)) - (get-highscore-icon-yoffset (-> sv-144 page-index)) - (get-highscore-icon-scale (-> sv-144 page-index)) - ) - (set! sv-108 (-> sv-140 origin x)) - (let ((a0-105 sv-140)) - (set! (-> a0-105 color) (font-color progress)) - ) - (+! (-> sv-140 origin x) sv-124) - (set-scale! sv-140 0.6) - (when (< 1 (get-num-highscores)) - (let ((gp-11 (get-game-score-ref *game-info* (get-highscore-score (-> sv-144 prev-page-index))))) - (set! (-> sv-116 index) (-> sv-144 prev-page-index)) - (set! (-> sv-116 previous) #t) - (set! (-> sv-116 self) sv-144) - (case (get-highscore-type (-> sv-144 prev-page-index)) - (('game) - (set! (-> sv-116 game-score) #t) - ) - (('race) - (set! (-> sv-116 game-score) #f) - ) + (cond + ((not (-> *bigmap* progress-minimap)) + (draw-busy-loading sv-140) + ) + (else + (set! (-> sv-140 alpha) sv-96) + (set-scale! sv-140 1.0) + (let ((a0-4 sv-140)) + (set! (-> a0-4 flags) (font-flags kerning middle large)) ) - (set! (-> sv-116 context) sv-140) - (set! (-> sv-116 local-scale) sv-96) - (set! (-> sv-116 interp) sv-120) - (dotimes (s5-10 8) - (set! (-> sv-116 place) s5-10) - (set! (-> sv-116 score) (-> gp-11 s5-10)) - (print-highscore sv-116) + (let ((a0-5 sv-140)) + (set! (-> a0-5 color) (font-color progress)) ) + (set! (-> sv-140 origin x) 59.0) + (set! (-> sv-140 origin y) 78.0) + (set! (-> sv-140 width) sv-104) + (let ((v1-24 sv-140)) + (set! (-> v1-24 height) 215.0) + ) + (begin-scissor sv-112 sv-136) + (set! (-> sv-144 sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #x3 :page #xc93))) + (set! (-> sv-144 sprites 0 flags) (the-as uint 4)) + (set! (-> sv-144 sprites 0 scale-x) sv-100) + (set! (-> sv-144 sprites 0 scale-y) sv-100) + (let ((v1-33 (-> sv-144 sprites 0 color2))) + (set! (-> v1-33 0) 128) + (set! (-> v1-33 1) 128) + (set! (-> v1-33 2) 128) + (set! (-> v1-33 3) (the int (* 128.0 sv-96))) + ) + (set! (-> sv-144 sprites 0 pos z) #xfffff0) + (set! (-> sv-144 sprites 0 pos w) 0) + (if (= (-> *setting-control* user-default language) (language-enum spanish)) + (draw-decoration sv-144 sv-140 sv-96 (text-id progress-root-highscores) #t 0.8) + (draw-decoration sv-144 sv-140 sv-96 (text-id progress-root-highscores) #t 0.95) + ) + (set-scale! sv-140 0.6) + (let ((v1-40 sv-140)) + (set! (-> v1-40 height) 185.0) + ) + (+! (-> sv-140 origin y) 46.0) + (set! (-> sv-140 origin x) 65.0) + (set-width! sv-140 367) + (let ((a0-23 sv-140)) + (set! (-> a0-23 flags) (font-flags kerning large)) + ) + (let ((a0-24 sv-140)) + (set! (-> a0-24 color) (font-color progress-force-selected)) + ) + (set! (-> sv-140 origin x) (+ 20.0 sv-120 (-> sv-140 origin x))) + (set-scale! sv-140 0.75) + (if (= (-> *setting-control* user-default language) (language-enum german)) + (set-scale! sv-140 0.69) + ) + (if (= (-> *setting-control* user-default language) (language-enum french)) + (set-scale! sv-140 0.72) + ) + (if (= (-> *setting-control* user-default language) (language-enum spanish)) + (set-scale! sv-140 0.65) + ) + (let ((gp-1 print-game-text)) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (get-highscore-text (-> sv-144 page-index)) #f) + ) + (gp-1 *temp-string* sv-140 #f 44 (bucket-id progress)) + ) + (+! (-> sv-140 origin y) 25.0) + (set-scale! sv-140 0.6) + (if (or (= (-> *setting-control* user-default language) (language-enum french)) + (= (-> *setting-control* user-default language) (language-enum spanish)) + ) + (set-scale! sv-140 0.58) + ) + (let ((gp-2 print-game-text)) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (get-highscore-text-sub (-> sv-144 page-index)) #f) + ) + (gp-2 *temp-string* sv-140 #f 44 (bucket-id progress)) + ) + (set! (-> sv-140 origin x) (- (-> sv-140 origin x) (+ 20.0 sv-120))) + (+! (-> sv-140 origin y) 25.0) + (draw-highscore-icon + sv-144 + (get-highscore-icon (-> sv-144 page-index)) + (the int (+ (the float (get-highscore-icon-xoffset (-> sv-144 page-index))) sv-120)) + (get-highscore-icon-yoffset (-> sv-144 page-index)) + (get-highscore-icon-scale (-> sv-144 page-index)) + ) + (set! sv-108 (-> sv-140 origin x)) + (let ((a0-54 sv-140)) + (set! (-> a0-54 color) (font-color progress)) + ) + (+! (-> sv-140 origin x) sv-120) + (set-scale! sv-140 0.6) + (let ((gp-5 (get-game-score-ref *game-info* (get-highscore-score (-> sv-144 page-index))))) + (set! (-> sv-116 index) (-> sv-144 page-index)) + (set! (-> sv-116 previous) #f) + (set! (-> sv-116 self) sv-144) + (case (get-highscore-type (-> sv-144 page-index)) + (('game) + (set! (-> sv-116 game-score) #t) + ) + (('race) + (set! (-> sv-116 game-score) #f) + ) + ) + (set! (-> sv-116 context) sv-140) + (set! (-> sv-116 local-scale) sv-96) + (set! (-> sv-116 interp) sv-120) + (dotimes (s5-5 8) + (set! (-> sv-116 place) s5-5) + (set! (-> sv-116 score) (-> gp-5 s5-5)) + (print-highscore sv-116) + ) + ) + (set! (-> sv-140 origin x) sv-108) + (set-scale! sv-140 0.6) + (set! (-> sv-140 origin x) 59.0) + (set! (-> sv-140 origin y) 78.0) + (set! (-> sv-140 width) sv-104) + (let ((v1-126 sv-140)) + (set! (-> v1-126 height) 215.0) + ) + (set-scale! sv-140 0.5) + (let ((v1-128 sv-140)) + (set! (-> v1-128 height) 185.0) + ) + (+! (-> sv-140 origin y) 46.0) + (set! (-> sv-140 origin x) 80.0) + (set! (-> sv-144 sprites 0 pos z) #xffffff) + (set! (-> sv-140 width) sv-104) + (let ((a0-74 sv-140)) + (set! (-> a0-74 flags) (font-flags kerning large)) + ) + (let ((a0-75 sv-140)) + (set! (-> a0-75 color) (font-color progress-force-selected)) + ) + (set! (-> sv-140 origin x) (+ 20.0 sv-124 (-> sv-140 origin x))) + (set-scale! sv-140 0.75) + (if (= (-> *setting-control* user-default language) (language-enum german)) + (set-scale! sv-140 0.69) + ) + (if (= (-> *setting-control* user-default language) (language-enum french)) + (set-scale! sv-140 0.72) + ) + (if (= (-> *setting-control* user-default language) (language-enum spanish)) + (set-scale! sv-140 0.65) + ) + (let ((gp-6 print-game-text)) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (get-highscore-text (-> sv-144 prev-page-index)) #f) + ) + (gp-6 *temp-string* sv-140 #f 44 (bucket-id progress)) + ) + (+! (-> sv-140 origin y) 25.0) + (set-scale! sv-140 0.6) + (if (or (= (-> *setting-control* user-default language) (language-enum french)) + (= (-> *setting-control* user-default language) (language-enum spanish)) + ) + (set-scale! sv-140 0.58) + ) + (let ((gp-7 print-game-text)) + (format + (clear *temp-string*) + "~S" + (lookup-text! *common-text* (get-highscore-text-sub (-> sv-144 prev-page-index)) #f) + ) + (gp-7 *temp-string* sv-140 #f 44 (bucket-id progress)) + ) + (set! (-> sv-140 origin x) (- (-> sv-140 origin x) (+ 20.0 sv-124))) + (+! (-> sv-140 origin y) 25.0) + (draw-highscore-icon + sv-144 + (get-highscore-icon (-> sv-144 prev-page-index)) + (the int (+ (the float (get-highscore-icon-xoffset (-> sv-144 page-index))) sv-124)) + (get-highscore-icon-yoffset (-> sv-144 page-index)) + (get-highscore-icon-scale (-> sv-144 page-index)) + ) + (set! sv-108 (-> sv-140 origin x)) + (let ((a0-105 sv-140)) + (set! (-> a0-105 color) (font-color progress)) + ) + (+! (-> sv-140 origin x) sv-124) + (set-scale! sv-140 0.6) + (when (< 1 (get-num-highscores)) + (let ((gp-11 (get-game-score-ref *game-info* (get-highscore-score (-> sv-144 prev-page-index))))) + (set! (-> sv-116 index) (-> sv-144 prev-page-index)) + (set! (-> sv-116 previous) #t) + (set! (-> sv-116 self) sv-144) + (case (get-highscore-type (-> sv-144 prev-page-index)) + (('game) + (set! (-> sv-116 game-score) #t) + ) + (('race) + (set! (-> sv-116 game-score) #f) + ) + ) + (set! (-> sv-116 context) sv-140) + (set! (-> sv-116 local-scale) sv-96) + (set! (-> sv-116 interp) sv-120) + (dotimes (s5-10 8) + (set! (-> sv-116 place) s5-10) + (set! (-> sv-116 score) (-> gp-11 s5-10)) + (print-highscore sv-116) + ) + ) + (set! (-> sv-140 origin x) sv-108) + (set-scale! sv-140 0.6) + ) + (if (< 1 (get-num-highscores)) + (draw-previous-next sv-144 sv-140 #t) + ) + (end-scissor sv-112 1.0) ) - (set! (-> sv-140 origin x) sv-108) - (set-scale! sv-140 0.6) ) - (if (< 1 (get-num-highscores)) - (draw-previous-next sv-144 sv-140 #t) - ) - (end-scissor sv-112 1.0) ) ) 0 @@ -6994,121 +6785,93 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-slider-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars - (v0-42 pointer) - (sv-16 progress) - (sv-32 symbol) - (sv-48 int) - (sv-64 int) - (sv-80 int) - (sv-96 int) - (sv-112 int) - (sv-128 pointer) - (sv-144 (function string font-context symbol int bucket-id float)) - (sv-160 uint) - (sv-176 dma-buffer) - (sv-192 pointer) - (sv-208 pointer) - (sv-224 (function string font-context symbol int bucket-id float)) - (sv-240 uint) - (sv-256 dma-buffer) - (sv-272 pointer) - ) - (set! sv-16 arg0) - (let ((s5-0 arg1) - (gp-0 arg2) + (local-vars (v0-42 pointer)) + (let* ((sv-16 arg0) + (s5-0 arg1) + (gp-0 arg2) + (sv-32 arg3) + (f30-0 (* 2.0 (- 0.5 (-> sv-16 menu-transition)))) + (sv-48 128) + (s1-0 sv-48) + (s0-0 9) + (s2-0 157) + (f28-0 2.0) + (s3-0 252) + (sv-64 20) + (sv-80 0) + (sv-96 112) + (sv-112 127) + ) + (if (< f30-0 0.0) + (set! f30-0 0.0) ) - (set! sv-32 arg3) - (let ((f30-0 (* 2.0 (- 0.5 (-> sv-16 menu-transition))))) - (set! sv-48 128) - (let ((s1-0 sv-48) - (s0-0 9) - (s2-0 157) - (f28-0 2.0) - (s3-0 252) - ) - (set! sv-64 20) - (set! sv-80 0) - (set! sv-96 112) - (set! sv-112 127) - (if (< f30-0 0.0) - (set! f30-0 0.0) - ) - (set! (-> s5-0 alpha) f30-0) - (set! v0-42 - (cond - ((not (-> *bigmap* progress-minimap)) - (draw-busy-loading s5-0) - v0-42 + (set! (-> s5-0 alpha) f30-0) + (set! v0-42 + (cond + ((not (-> *bigmap* progress-minimap)) + (draw-busy-loading s5-0) + v0-42 + ) + (else + (set-scale! s5-0 0.6) + (+! (-> s5-0 origin y) 20.0) + (case (get-aspect-ratio) + (('aspect4x3) + (set! s2-0 157) + (let ((v1-17 gp-0)) + (cond + ((zero? v1-17) + (+! (-> s5-0 origin y) -24.0) + (+! s2-0 -9) + ) + ((= v1-17 1) + (+! (-> s5-0 origin y) -9.0) + (+! s2-0 43) + ) + ((= v1-17 2) + (+! (-> s5-0 origin y) 6.0) + (+! s2-0 96) + ) + ) + ) ) - (else - (set-scale! s5-0 0.6) - (+! (-> s5-0 origin y) 20.0) - (case (get-aspect-ratio) - (('aspect4x3) - (set! s2-0 157) - (let ((v1-17 gp-0)) - (cond - ((zero? v1-17) - (+! (-> s5-0 origin y) -24.0) - (+! s2-0 -9) - ) - ((= v1-17 1) - (+! (-> s5-0 origin y) -9.0) - (+! s2-0 43) - ) - ((= v1-17 2) - (+! (-> s5-0 origin y) 6.0) - (+! s2-0 96) - ) - ) - ) + (('aspect16x9) + (set! s2-0 172) + (set! f28-0 2.62) + (set! s0-0 5) + (set! s3-0 250) + (let ((v1-28 gp-0)) + (cond + ((zero? v1-28) + (+! (-> s5-0 origin y) -20.0) + (+! s2-0 -20) + ) + ((= v1-28 1) + (+! (-> s5-0 origin y) 2.0) + (+! s2-0 40) + ) + ((= v1-28 2) + (+! (-> s5-0 origin y) 30.0) + (+! s2-0 105) + ) ) - (('aspect16x9) - (set! s2-0 172) - (set! f28-0 2.62) - (set! s0-0 5) - (set! s3-0 250) - (let ((v1-28 gp-0)) - (cond - ((zero? v1-28) - (+! (-> s5-0 origin y) -20.0) - (+! s2-0 -20) - ) - ((= v1-28 1) - (+! (-> s5-0 origin y) 2.0) - (+! s2-0 40) - ) - ((= v1-28 2) - (+! (-> s5-0 origin y) 30.0) - (+! s2-0 105) - ) - ) - ) - ) - ) - (let ((a0-11 s5-0)) - (set! (-> a0-11 flags) (font-flags kerning large)) - ) - (set! (-> s5-0 origin x) (the float sv-48)) - (cond - (sv-32 - (set! sv-128 (-> this value-to-modify)) - (+! (-> s5-0 origin y) -8.0) - (let ((a0-12 s5-0)) - (set! (-> a0-12 color) (font-color progress-force-selected)) - ) - (draw-highlight (the int (+ -2.0 (-> s5-0 origin y))) 52 f30-0) - (set! sv-144 print-game-text) - (let ((a0-15 (lookup-text! *common-text* (-> this name) #f)) - (a1-3 s5-0) - (a2-3 #f) - (a3-1 44) - (t0-1 320) - ) - (sv-144 a0-15 a1-3 a2-3 a3-1 (the-as bucket-id t0-1)) - ) - (set! sv-160 + ) + ) + ) + (let ((a0-11 s5-0)) + (set! (-> a0-11 flags) (font-flags kerning large)) + ) + (set! (-> s5-0 origin x) (the float sv-48)) + (cond + (sv-32 + (let ((sv-128 (-> this value-to-modify))) + (+! (-> s5-0 origin y) -8.0) + (let ((a0-12 s5-0)) + (set! (-> a0-12 color) (font-color progress-force-selected)) + ) + (draw-highlight (the int (+ -2.0 (-> s5-0 origin y))) 52 f30-0) + (print-game-text (lookup-text! *common-text* (-> this name) #f) s5-0 #f 44 (bucket-id progress)) + (let ((sv-160 (logior (logand (logior (logand (logior (logand (logior (logand (the-as uint #x8000ffff) -256) (shr (shl (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-128)))) 56) 56) ) @@ -7125,6 +6888,7 @@ (shr (shl (the int (* 128.0 f30-0)) 56) 32) ) ) + ) (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #xb :page #xc93))) (set! (-> this sprites 0 scale-x) f28-0) (set! (-> this sprites 0 scale-y) 0.7) @@ -7177,67 +6941,63 @@ ) (set-hud-piece-position! (-> this sprites 2) (- s1-0 sv-64) (+ s2-0 -4)) (set-hud-piece-position! (-> this sprites 3) (+ sv-64 242 s1-0) (+ s2-0 -4)) - (set! sv-176 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-192 (-> sv-176 base)) - ((method-of-type hud-sprite draw) (-> this sprites 0) sv-176 (-> *level* default-level)) - (draw-sprite2d-xy - sv-176 - (+ s1-0 s0-0 (the int (* 230.0 (-> (the-as (pointer float) sv-128))))) - (+ s2-0 7) - (- 240 (the int (* 230.0 (-> (the-as (pointer float) sv-128))))) - 9 - (the-as rgba sv-160) - ) - (draw (-> this sprites 1) sv-176 (-> *level* default-level)) - (draw (-> this sprites 2) sv-176 (-> *level* default-level)) - (draw (-> this sprites 3) sv-176 (-> *level* default-level)) - (let ((a3-6 (-> sv-176 base))) - (let ((v1-100 (the-as object (-> sv-176 base)))) - (set! (-> (the-as dma-packet v1-100) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-100) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-100) vif1) (new 'static 'vif-tag)) - (set! (-> sv-176 base) (&+ (the-as pointer v1-100) 16)) + (let* ((sv-176 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-192 (-> sv-176 base)) + ) + ((method-of-type hud-sprite draw) (-> this sprites 0) sv-176 (-> *level* default-level)) + (draw-sprite2d-xy + sv-176 + (+ s1-0 s0-0 (the int (* 230.0 (-> (the-as (pointer float) sv-128))))) + (+ s2-0 7) + (- 240 (the int (* 230.0 (-> (the-as (pointer float) sv-128))))) + 9 + (the-as rgba sv-160) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id progress) - sv-192 - (the-as (pointer dma-tag) a3-6) + (draw (-> this sprites 1) sv-176 (-> *level* default-level)) + (draw (-> this sprites 2) sv-176 (-> *level* default-level)) + (draw (-> this sprites 3) sv-176 (-> *level* default-level)) + (let ((a3-6 (-> sv-176 base))) + (let ((v1-100 (the-as object (-> sv-176 base)))) + (set! (-> (the-as dma-packet v1-100) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-100) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-100) vif1) (new 'static 'vif-tag)) + (set! (-> sv-176 base) (&+ (the-as pointer v1-100) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id progress) + sv-192 + (the-as (pointer dma-tag) a3-6) + ) ) ) - (+! (-> s5-0 origin x) (the float s3-0)) - (let ((a0-71 s5-0)) - (set! (-> a0-71 flags) (font-flags kerning right large)) - ) - (let ((s3-1 print-game-text)) - (format (clear *temp-string*) "~D%" (the int (* 100.0 (-> (the-as (pointer float) sv-128))))) - (s3-1 *temp-string* s5-0 #f 44 (bucket-id progress)) - ) - (let ((a0-75 s5-0)) - (set! (-> a0-75 flags) (font-flags kerning large)) - ) ) - (else - (set! sv-208 (-> this value-to-modify)) - (+! (-> s5-0 origin y) -8.0) - (if (or (= (-> *setting-control* user-default language) (language-enum german)) - (= (-> *setting-control* user-default language) (language-enum french)) - ) - (set-scale! s5-0 0.56) - ) - (if (= (-> sv-16 option-index) gp-0) - (draw-highlight (the int (+ -2.0 (-> s5-0 origin y))) 24 f30-0) - ) - (set! sv-224 print-game-text) - (let ((a0-81 (lookup-text! *common-text* (-> this name) #f)) - (a1-21 s5-0) - (a2-18 #f) - (a3-8 44) - (t0-4 320) + (+! (-> s5-0 origin x) (the float s3-0)) + (let ((a0-71 s5-0)) + (set! (-> a0-71 flags) (font-flags kerning right large)) + ) + (let ((s3-1 print-game-text)) + (format (clear *temp-string*) "~D%" (the int (* 100.0 (-> (the-as (pointer float) sv-128))))) + (s3-1 *temp-string* s5-0 #f 44 (bucket-id progress)) + ) + ) + (let ((a0-75 s5-0)) + (set! (-> a0-75 flags) (font-flags kerning large)) + ) + ) + (else + (let ((sv-208 (-> this value-to-modify))) + (+! (-> s5-0 origin y) -8.0) + (if (or (= (-> *setting-control* user-default language) (language-enum german)) + (= (-> *setting-control* user-default language) (language-enum french)) ) - (sv-224 a0-81 a1-21 a2-18 a3-8 (the-as bucket-id t0-4)) + (set-scale! s5-0 0.56) ) - (set! sv-240 + (if (= (-> sv-16 option-index) gp-0) + (draw-highlight (the int (+ -2.0 (-> s5-0 origin y))) 24 f30-0) + ) + (print-game-text (lookup-text! *common-text* (-> this name) #f) s5-0 #f 44 (bucket-id progress)) + (let ((sv-240 (logior (logand (logior (logand (logior (logand (logior (logand (the-as uint #x8000ffff) -256) (shr (shl (the int (* 0.0 f30-0 (-> (the-as (pointer float) sv-208)))) 56) 56) ) @@ -7254,6 +7014,7 @@ (shr (shl (the int (* 128.0 f30-0)) 56) 32) ) ) + ) (set! (-> this sprites 0 tex) (lookup-texture-by-id (new 'static 'texture-id :index #xb :page #xc93))) (set! (-> this sprites 0 scale-x) f28-0) (set! (-> this sprites 0 scale-y) 0.7) @@ -7306,55 +7067,57 @@ ) (set-hud-piece-position! (-> this sprites 2) (- s1-0 sv-64) (+ s2-0 -4)) (set-hud-piece-position! (-> this sprites 3) (+ sv-64 242 s1-0) (+ s2-0 -4)) - (set! sv-256 (-> *display* frames (-> *display* on-screen) global-buf)) - (set! sv-272 (-> sv-256 base)) - ((method-of-type hud-sprite draw) (-> this sprites 0) sv-256 (-> *level* default-level)) - (draw-sprite2d-xy - sv-256 - (+ s1-0 s0-0 (the int (* 230.0 (-> (the-as (pointer float) sv-208))))) - (+ s2-0 7) - (- 240 (the int (* 230.0 (-> (the-as (pointer float) sv-208))))) - 9 - (the-as rgba sv-240) - ) - (draw (-> this sprites 1) sv-256 (-> *level* default-level)) - (draw (-> this sprites 2) sv-256 (-> *level* default-level)) - (draw (-> this sprites 3) sv-256 (-> *level* default-level)) - (let ((a3-13 (-> sv-256 base))) - (let ((v1-183 (the-as object (-> sv-256 base)))) - (set! (-> (the-as dma-packet v1-183) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet v1-183) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet v1-183) vif1) (new 'static 'vif-tag)) - (set! (-> sv-256 base) (&+ (the-as pointer v1-183) 16)) + (let* ((sv-256 (-> *display* frames (-> *display* on-screen) global-buf)) + (sv-272 (-> sv-256 base)) + ) + ((method-of-type hud-sprite draw) (-> this sprites 0) sv-256 (-> *level* default-level)) + (draw-sprite2d-xy + sv-256 + (+ s1-0 s0-0 (the int (* 230.0 (-> (the-as (pointer float) sv-208))))) + (+ s2-0 7) + (- 240 (the int (* 230.0 (-> (the-as (pointer float) sv-208))))) + 9 + (the-as rgba sv-240) ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id progress) - sv-272 - (the-as (pointer dma-tag) a3-13) + (draw (-> this sprites 1) sv-256 (-> *level* default-level)) + (draw (-> this sprites 2) sv-256 (-> *level* default-level)) + (draw (-> this sprites 3) sv-256 (-> *level* default-level)) + (let ((a3-13 (-> sv-256 base))) + (let ((v1-183 (the-as object (-> sv-256 base)))) + (set! (-> (the-as dma-packet v1-183) dma) (new 'static 'dma-tag :id (dma-tag-id next))) + (set! (-> (the-as dma-packet v1-183) vif0) (new 'static 'vif-tag)) + (set! (-> (the-as dma-packet v1-183) vif1) (new 'static 'vif-tag)) + (set! (-> sv-256 base) (&+ (the-as pointer v1-183) 16)) + ) + (dma-bucket-insert-tag + (-> *display* frames (-> *display* on-screen) bucket-group) + (bucket-id progress) + sv-272 + (the-as (pointer dma-tag) a3-13) + ) ) ) - (+! (-> s5-0 origin x) (the float s3-0)) - (let ((a0-137 s5-0)) - (set! (-> a0-137 flags) (font-flags kerning right large)) - ) - (let ((s3-2 print-game-text)) - (format (clear *temp-string*) "~D%" (the int (* 100.0 (-> (the-as (pointer float) sv-208))))) - (s3-2 *temp-string* s5-0 #f 44 (bucket-id progress)) - ) - (let ((a0-141 s5-0)) - (set! (-> a0-141 flags) (font-flags kerning large)) - ) + ) + (+! (-> s5-0 origin x) (the float s3-0)) + (let ((a0-137 s5-0)) + (set! (-> a0-137 flags) (font-flags kerning right large)) + ) + (let ((s3-2 print-game-text)) + (format (clear *temp-string*) "~D%" (the int (* 100.0 (-> (the-as (pointer float) sv-208))))) + (s3-2 *temp-string* s5-0 #f 44 (bucket-id progress)) ) ) - (if (zero? gp-0) - (draw-sound-options-decoration this s5-0 f30-0 (text-id progress-root-sound-options) #f) - ) + (let ((a0-141 s5-0)) + (set! (-> a0-141 flags) (font-flags kerning large)) + ) ) ) + (if (zero? gp-0) + (draw-sound-options-decoration this s5-0 f30-0 (text-id progress-root-sound-options) #f) + ) ) - ) - ) + ) + ) ) 0 (none) @@ -7463,7 +7226,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-option ((this menu-sub-menu-option) (arg0 progress) (arg1 font-context) (arg2 int) (arg3 symbol)) - (local-vars (sv-16 dma-buffer)) (let ((f30-0 (* 2.0 (- 0.5 (-> arg0 menu-transition)))) (s2-0 (the int (+ -1.0 (-> arg1 origin y)))) (s1-0 22) @@ -7559,8 +7321,9 @@ (set! s2-4 110) (set! s3-1 166) (set! s1-1 42) - (set! sv-16 (-> *display* frames (-> *display* on-screen) global-buf)) - (let ((s0-2 (-> sv-16 base))) + (let* ((sv-16 (-> *display* frames (-> *display* on-screen) global-buf)) + (s0-2 (-> sv-16 base)) + ) (draw-sprite2d-xy sv-16 s4-1 diff --git a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc index 89cac31879..41e0bc228b 100644 --- a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc @@ -1405,18 +1405,17 @@ ;; WARN: Stack slot offset 148 signed mismatch ;; WARN: Return type mismatch int vs none. (defbehavior progress-post progress () - (local-vars (sv-144 font-context) (sv-148 int) (sv-152 hud-box) (sv-156 symbol)) (when (-> self current-options) - (let ((gp-0 (-> self current-options options)) - (s4-0 (-> self current-options y-center)) - (s5-0 (-> self current-options y-space)) - ) - (set! sv-144 - (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) - ) - (set! sv-148 (- s4-0 (/ (* s5-0 (length gp-0)) 2))) - (set! sv-152 (new 'stack-no-clear 'hud-box)) - (set! sv-156 (and (!= (-> self current) 'main) (or (= (-> self next) 'none) (> (-> self state-pos) 0)))) + (let* ((gp-0 (-> self current-options options)) + (s4-0 (-> self current-options y-center)) + (s5-0 (-> self current-options y-space)) + (sv-144 + (new 'stack 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning)) + ) + (sv-148 (- s4-0 (/ (* s5-0 (length gp-0)) 2))) + (sv-152 (new 'stack-no-clear 'hud-box)) + (sv-156 (and (!= (-> self current) 'main) (or (= (-> self next) 'none) (> (-> self state-pos) 0)))) + ) (if sv-156 (begin-scan sv-152 self) ) @@ -1448,22 +1447,28 @@ s4-1 (and (= (-> self menu-transition) 0.0) (-> self selected-option) (= s4-1 (-> self option-index))) ) - (if (!= (-> self current-options) *unlocked-secrets*) - (set! sv-148 (+ s5-0 7 sv-148)) - (set! sv-148 (+ sv-148 s5-0)) - ) + (set! sv-148 (cond + ((!= (-> self current-options) *unlocked-secrets*) + (+ s5-0 7 sv-148) + ) + (else + (+! sv-148 s5-0) + sv-148 + ) + ) + ) + ) + (when sv-156 + (set! (-> self scanlines-alpha) (seek-ease + (-> self scanlines-alpha) + (- 1.0 (-> self menu-transition)) + (/ (-> self clock time-adjust-ratio) 20) + 0.3 + (/ (-> self clock time-adjust-ratio) 1000) + ) + ) + (end-scan sv-152 (-> self scanlines-alpha)) ) - ) - (when sv-156 - (set! (-> self scanlines-alpha) (seek-ease - (-> self scanlines-alpha) - (- 1.0 (-> self menu-transition)) - (/ (-> self clock time-adjust-ratio) 20) - 0.3 - (/ (-> self clock time-adjust-ratio) 1000) - ) - ) - (end-scan sv-152 (-> self scanlines-alpha)) ) ) (when (and (< 0.8 (-> self anim-frame)) (or (= (-> self current) 'bigmap) (= (-> self next) 'bigmap))) diff --git a/test/decompiler/reference/jak2/engine/ui/text_REF.gc b/test/decompiler/reference/jak2/engine/ui/text_REF.gc index 5850173dd8..b1cf5a84fb 100644 --- a/test/decompiler/reference/jak2/engine/ui/text_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/text_REF.gc @@ -253,73 +253,75 @@ (defun load-game-text-info ((arg0 string) (arg1 (pointer object)) (arg2 kheap)) "Load text, if needed. txt-name is the group name, curr-text is the _symbol_ for the game-text-info, and heap is the heap to load to. The heap will be cleared." - (local-vars (v0-3 int) (sv-16 game-text-info) (sv-24 int) (sv-32 int) (sv-40 int)) - (set! sv-16 (the-as game-text-info (-> arg1 0))) - (set! sv-24 (the-as int (-> *setting-control* user-current language))) - (set! sv-32 0) - (set! sv-40 (&- (-> arg2 top) (the-as uint (-> arg2 base)))) - (if (and (= (scf-get-territory) 1) (= sv-24 (language-enum english)) (not (demo?))) - (set! sv-24 7) - ) - (when (or (= sv-16 #f) (!= (-> sv-16 language-id) sv-24) (not (string= (-> sv-16 group-name) arg0))) - (let ((v1-16 arg2)) - (set! (-> v1-16 current) (-> v1-16 base)) - ) - (b! #t cfg-17 :delay (nop!)) - (label cfg-16) - (set! v0-3 0) - (b! #t cfg-30 :delay (nop!)) - (label cfg-17) - (let ((s3-0 str-load)) - (format (clear *temp-string*) "~D~S.TXT" sv-24 arg0) - (b! - (not (s3-0 - *temp-string* - -1 - (logand -64 (&+ (-> arg2 current) 63)) - (&- (-> arg2 top) (the-as uint (-> arg2 current))) - ) - ) - cfg-16 - :delay (nop!) + (local-vars (v0-3 int)) + (let ((sv-16 (the-as game-text-info (-> arg1 0))) + (sv-24 (the-as int (-> *setting-control* user-current language))) + (sv-32 0) + (sv-40 (&- (-> arg2 top) (the-as uint (-> arg2 base)))) ) - ) - (label cfg-19) - (let ((v1-20 (str-load-status (the-as (pointer int32) (& sv-32))))) - (b! (!= v1-20 'error) cfg-22 :delay (empty-form)) - (format 0 "Error loading text~%") + (if (and (= (scf-get-territory) 1) (= (the-as language-enum sv-24) (language-enum english)) (not (demo?))) + (set! sv-24 7) + ) + (when (or (= sv-16 #f) (!= (-> sv-16 language-id) sv-24) (not (string= (-> sv-16 group-name) arg0))) + (let ((v1-16 arg2)) + (set! (-> v1-16 current) (-> v1-16 base)) + ) + (b! #t cfg-17 :delay (nop!)) + (label cfg-16) (set! v0-3 0) (b! #t cfg-30 :delay (nop!)) - (the-as none 0) - (b! #t cfg-27 :delay (nop!)) - (label cfg-22) - (cond - ((>= sv-32 (+ sv-40 -300)) - (format 0 "Game text heap overrun!~%") - (return 0) - ) - ((= v1-20 'busy) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (nop!) - (goto cfg-19) - ) - ) - ) - (label cfg-27) - (let ((s2-1 (logand -64 (&+ (-> arg2 current) 63)))) - (flush-cache 0) - (let ((s3-1 link)) + (label cfg-17) + (let ((s3-0 str-load)) (format (clear *temp-string*) "~D~S.TXT" sv-24 arg0) - (set! (-> arg1 0) (s3-1 s2-1 (-> *temp-string* data) sv-32 arg2 0)) + (b! + (not (s3-0 + *temp-string* + -1 + (logand -64 (&+ (-> arg2 current) 63)) + (&- (-> arg2 top) (the-as uint (-> arg2 current))) + ) + ) + cfg-16 + :delay (nop!) + ) ) + (label cfg-19) + (let ((v1-20 (str-load-status (the-as (pointer int32) (& sv-32))))) + (b! (!= v1-20 'error) cfg-22 :delay (empty-form)) + (format 0 "Error loading text~%") + (set! v0-3 0) + (b! #t cfg-30 :delay (nop!)) + (the-as none 0) + (b! #t cfg-27 :delay (nop!)) + (label cfg-22) + (cond + ((>= sv-32 (+ sv-40 -300)) + (format 0 "Game text heap overrun!~%") + (return 0) + ) + ((= v1-20 'busy) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (goto cfg-19) + ) + ) + ) + (label cfg-27) + (let ((s2-1 (logand -64 (&+ (-> arg2 current) 63)))) + (flush-cache 0) + (let ((s3-1 link)) + (format (clear *temp-string*) "~D~S.TXT" sv-24 arg0) + (set! (-> arg1 0) (s3-1 s2-1 (-> *temp-string* data) sv-32 arg2 0)) + ) + ) + (if (<= (the-as int (-> arg1 0)) 0) + (set! (-> arg1 0) (the-as object #f)) + ) ) - (if (<= (the-as int (-> arg1 0)) 0) - (set! (-> arg1 0) (the-as object #f)) - ) ) (set! v0-3 0) (label cfg-30) @@ -485,177 +487,170 @@ ;; WARN: Stack slot offset 56 signed mismatch (defun print-game-text ((arg0 string) (arg1 font-context) (arg2 symbol) (arg3 int) (arg4 bucket-id)) "Print text." - (local-vars - (sv-16 float) - (sv-20 float) - (sv-24 font-flags) - (sv-28 font-color) - (sv-32 (pointer uint8)) - (sv-36 float) - (sv-40 float) - (sv-44 float) - (sv-48 float) - (sv-52 float) - (sv-56 float) - (sv-64 int) - (sv-72 uint) - (sv-80 int) - (sv-88 int) - (sv-96 int) - (sv-104 uint) - (sv-108 symbol) - (sv-112 int) - (sv-120 int) - ) (cond ((< 0.1 (-> arg1 scale)) - (set! sv-16 (-> arg1 origin x)) - (set! sv-20 (-> arg1 origin y)) - (set! sv-24 (-> arg1 flags)) - (set! sv-28 (-> arg1 color)) - (when (logtest? (-> arg1 flags) (font-flags middle-vert)) - (logclear! (-> arg1 flags) (font-flags middle-vert)) - (+! (-> arg1 origin y) - (the float (the int (* 0.5 (- (-> arg1 height) (print-game-text arg0 arg1 #t 44 (bucket-id progress)))))) + (let ((sv-16 (-> arg1 origin x)) + (sv-20 (-> arg1 origin y)) + (sv-24 (-> arg1 flags)) + (sv-28 (-> arg1 color)) ) - ) - (set! sv-32 (-> arg0 data)) - (set! sv-36 (-> arg1 origin x)) - (set! sv-40 (-> arg1 origin x)) - (set! sv-44 (+ (-> arg1 origin x) (-> arg1 width))) - (set! sv-48 (+ (-> arg1 origin y) (-> arg1 height))) - (set! sv-52 (-> (get-string-length " " arg1) length)) - (set! sv-56 (* (if (logtest? (-> arg1 flags) (font-flags large)) - (the float arg3) - 28.0 - ) - (-> arg1 scale) + (when (logtest? (-> arg1 flags) (font-flags middle-vert)) + (logclear! (-> arg1 flags) (font-flags middle-vert)) + (+! (-> arg1 origin y) + (the float (the int (* 0.5 (- (-> arg1 height) (print-game-text arg0 arg1 #t 44 (bucket-id progress)))))) + ) + ) + (let ((sv-32 (-> arg0 data)) + (sv-36 (-> arg1 origin x)) + (sv-40 (-> arg1 origin x)) + (sv-44 (+ (-> arg1 origin x) (-> arg1 width))) + (sv-48 (+ (-> arg1 origin y) (-> arg1 height))) + (sv-52 (-> (get-string-length " " arg1) length)) + (sv-56 (* (if (logtest? (-> arg1 flags) (font-flags large)) + (the float arg3) + 28.0 + ) + (-> arg1 scale) + ) ) - ) - (set! sv-64 0) - (if (logtest? (-> arg1 flags) (font-flags middle)) - (+! (-> arg1 origin x) (/ (-> arg1 width) 2)) - ) - (set! sv-72 (-> sv-32 0)) - (set! sv-80 0) - (set! sv-88 0) - (set! sv-96 0) - (set! sv-104 (-> sv-32 1)) - (set! sv-108 (the-as symbol #f)) - (set! sv-112 0) - (set! sv-120 0) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (while (and (not (and (zero? sv-72) (zero? sv-80) (zero? sv-88))) (>= sv-48 (-> arg1 origin y))) - (set! sv-120 0) - (set! sv-32 (&-> sv-32 1)) - (set! sv-104 (-> sv-32 0)) - (set! sv-32 (&-> sv-32 -1)) - (cond - ((and (> sv-72 0) (< sv-72 (the-as uint 4))) - (set! (-> *game-text-word* data sv-80) sv-72) - (set! sv-80 (+ sv-80 1)) - (set! (-> *game-text-word* data sv-80) sv-104) - (set! sv-80 (+ sv-80 1)) - (set! sv-32 (&-> sv-32 1)) - ) - ((= sv-72 32) - (set! (-> *game-text-word* data sv-80) sv-72) - (set! sv-80 (+ sv-80 1)) - (set! sv-108 #t) - ) - ((zero? sv-72) - (if (nonzero? sv-80) - (set! sv-108 #t) - ) - (set! sv-112 (+ sv-112 1)) - ) - ((and (= sv-72 92) (= sv-104 92)) - (set! sv-32 (&-> sv-32 1)) - (if (nonzero? sv-80) - (set! sv-108 #t) - ) - (set! sv-112 (+ sv-112 1)) - ) - ((and (= sv-72 95) (= sv-104 95)) - (set! sv-32 (&-> sv-32 1)) - (set! (-> *game-text-word* data sv-80) (the-as uint 32)) - (set! sv-80 (+ sv-80 1)) - ) - (else - (set! (-> *game-text-word* data sv-80) sv-72) - (set! sv-80 (+ sv-80 1)) - ) - ) - (when sv-108 - (set! (-> *game-text-word* data sv-80) (the-as uint 0)) - (let ((f30-1 sv-36)) - (set! sv-120 (the int (the-as float (-> (get-string-length *game-text-word* arg1) length)))) - (let ((f0-26 (+ f30-1 (the float sv-120)))) - (if (= (-> *game-text-word* data (+ sv-80 -1)) 32) - (set! f0-26 (- f0-26 (the-as float sv-52))) + (sv-64 0) + ) + (if (logtest? (-> arg1 flags) (font-flags middle)) + (+! (-> arg1 origin x) (/ (-> arg1 width) 2)) + ) + (let ((sv-72 (-> sv-32 0)) + (sv-80 0) + (sv-88 0) + (sv-96 0) + (sv-104 (-> sv-32 1)) + (sv-108 (the-as symbol #f)) + (sv-112 0) + (sv-120 0) + ) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (while (and (not (and (zero? sv-72) (zero? sv-80) (zero? sv-88))) (>= sv-48 (-> arg1 origin y))) + (set! sv-120 0) + (set! sv-32 (&-> sv-32 1)) + (set! sv-104 (-> sv-32 0)) + (set! sv-32 (&-> sv-32 -1)) + (set! sv-108 (cond + ((and (> sv-72 0) (< sv-72 (the-as uint 4))) + (set! (-> *game-text-word* data sv-80) sv-72) + (+! sv-80 1) + (set! (-> *game-text-word* data sv-80) sv-104) + (+! sv-80 1) + (set! sv-32 (&-> sv-32 1)) + sv-108 + ) + ((= sv-72 32) + (set! (-> *game-text-word* data sv-80) sv-72) + (+! sv-80 1) + #t + ) + ((zero? sv-72) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (+! sv-112 1) + sv-108 + ) + ((and (= sv-72 92) (= sv-104 92)) + (set! sv-32 (&-> sv-32 1)) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (+! sv-112 1) + sv-108 + ) + (else + (cond + ((and (= sv-72 95) (= sv-104 95)) + (set! sv-32 (&-> sv-32 1)) + (set! (-> *game-text-word* data sv-80) (the-as uint 32)) + (+! sv-80 1) + ) + (else + (set! (-> *game-text-word* data sv-80) sv-72) + (+! sv-80 1) + ) + ) + sv-108 + ) + ) + ) + (when sv-108 + (set! (-> *game-text-word* data sv-80) (the-as uint 0)) + (let ((f30-1 sv-36)) + (set! sv-120 (the int (the-as float (-> (get-string-length *game-text-word* arg1) length)))) + (let ((f0-26 (+ f30-1 (the float sv-120)))) + (if (= (-> *game-text-word* data (+ sv-80 -1)) 32) + (set! f0-26 (- f0-26 (the-as float sv-52))) + ) + (cond + ((< sv-44 f0-26) + (+! sv-112 1) + ) + (else + (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) + (+! sv-88 sv-80) + (set! sv-80 0) + (+! sv-36 (the float sv-120)) + (set! sv-108 (the-as symbol #f)) + ) + ) + ) ) - (cond - ((< sv-44 f0-26) - (set! sv-112 (+ sv-112 1)) - ) - (else + ) + (while (> sv-112 0) + (let ((f30-2 (+ (-> arg1 origin y) sv-56))) + (when (and (>= sv-96 (the-as int (-> arg1 start-line))) #t) + (when (= (-> *game-text-line* data (+ sv-88 -1)) 32) + (set! (-> *game-text-line* data (+ sv-88 -1)) (the-as uint 0)) + 0 + ) + (if (nonzero? (-> *game-text-line* data 0)) + (+! sv-64 1) + ) + (when (not arg2) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + arg4 + ) + (draw-string *game-text-line* s2-1 arg1) + (set! (-> arg1 color) (-> *font-work* last-color)) + ) + ) + (set! (-> arg1 origin y) f30-2) + ) + ) + (+! sv-96 1) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (set! sv-88 0) + (+! sv-112 -1) + (set! sv-36 sv-40) + (when sv-108 (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) - (set! sv-88 (+ sv-88 sv-80)) + (+! sv-88 sv-80) (set! sv-80 0) - (set! sv-36 (+ sv-36 (the float sv-120))) (set! sv-108 (the-as symbol #f)) + (+! sv-36 (the float sv-120)) ) ) + (when (nonzero? sv-72) + (set! sv-32 (&-> sv-32 1)) + (set! sv-72 (-> sv-32 0)) + ) ) ) - ) - (while (> sv-112 0) - (let ((f30-2 (+ (-> arg1 origin y) sv-56))) - (when (and (>= sv-96 (the-as int (-> arg1 start-line))) #t) - (when (= (-> *game-text-line* data (+ sv-88 -1)) 32) - (set! (-> *game-text-line* data (+ sv-88 -1)) (the-as uint 0)) - 0 - ) - (if (nonzero? (-> *game-text-line* data 0)) - (set! sv-64 (+ sv-64 1)) - ) - (when (not arg2) - (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) - arg4 - ) - (draw-string *game-text-line* s2-1 arg1) - (set! (-> arg1 color) (-> *font-work* last-color)) - ) - ) - (set! (-> arg1 origin y) f30-2) + (set! (-> arg1 origin x) sv-16) + (set! (-> arg1 origin y) sv-20) + (set! (-> arg1 flags) sv-24) + (set! (-> arg1 color) sv-28) + (if (> sv-64 0) + (* sv-56 (the float sv-64)) + 0.0 ) - ) - (set! sv-96 (+ sv-96 1)) - (set! (-> *game-text-line* data 0) (the-as uint 0)) - (set! sv-88 0) - (set! sv-112 (+ sv-112 -1)) - (set! sv-36 sv-40) - (when sv-108 - (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) - (set! sv-88 (+ sv-88 sv-80)) - (set! sv-80 0) - (set! sv-108 (the-as symbol #f)) - (set! sv-36 (+ sv-36 (the float sv-120))) - ) - ) - (when (nonzero? sv-72) - (set! sv-32 (&-> sv-32 1)) - (set! sv-72 (-> sv-32 0)) ) ) - (set! (-> arg1 origin x) sv-16) - (set! (-> arg1 origin y) sv-20) - (set! (-> arg1 flags) sv-24) - (set! (-> arg1 color) sv-28) - (if (> sv-64 0) - (* sv-56 (the float sv-64)) - 0.0 - ) ) (else 0.0 diff --git a/test/decompiler/reference/jak2/engine/util/profile_REF.gc b/test/decompiler/reference/jak2/engine/util/profile_REF.gc index 8ccdf8430a..804a65174c 100644 --- a/test/decompiler/reference/jak2/engine/util/profile_REF.gc +++ b/test/decompiler/reference/jak2/engine/util/profile_REF.gc @@ -565,7 +565,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod draw-bars! ((this profile-array) (arg0 dma-buffer) (arg1 int)) "Generate DMA data for drawing the profile bars." - (local-vars (sv-16 (function _varargs_ object)) (sv-32 (function _varargs_ object))) (dma-buffer-add-gs-set arg0 (alpha-1 (new 'static 'gs-alpha :b #x1 :d #x1)) (zbuf-1 (new 'static 'gs-zbuf :zbp #x130 :psm (gs-psm ct24) :zmsk #x1)) @@ -643,12 +642,7 @@ (cond (*profile-ticks* (let ((s0-0 draw-string-xy)) - (set! sv-16 format) - (let ((a0-16 (clear *temp-string*)) - (a1-37 "~5D") - ) - (sv-16 a0-16 a1-37 s1-0) - ) + (format (clear *temp-string*) "~5D" s1-0) (s0-0 *temp-string* arg0 @@ -694,12 +688,7 @@ (cond (*profile-ticks* (let ((s0-2 draw-string-xy)) - (set! sv-32 format) - (let ((a0-26 (clear *temp-string*)) - (a1-45 "~5D") - ) - (sv-32 a0-26 a1-45 s1-2) - ) + (format (clear *temp-string*) "~5D" s1-2) (s0-2 *temp-string* arg0 diff --git a/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc b/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc index 492b12031e..136274cebe 100644 --- a/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc +++ b/test/decompiler/reference/jak2/engine/util/sync-info_REF.gc @@ -75,7 +75,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-linear) (arg0 sync-info-params)) "Set up a sync-info from params." - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-linear) (format 0 @@ -89,8 +88,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (the-as res-lump a0-3) 'sync pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (the-as res-lump a0-3) 'sync pointer :tag-ptr (& sv-16))) + ) (when v1-6 (set! s4-0 (the int (* 300.0 (-> (the-as (pointer float) v1-6))))) (set! f30-0 (-> (the-as (pointer float) v1-6) 1)) @@ -149,7 +149,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-eased) (arg0 sync-info-params)) "Set up a sync-info from params." - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-eased) (format 0 @@ -167,8 +166,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16))) + ) (when v1-6 (set! s5-0 (the int (* 300.0 (-> v1-6 0)))) (set! f22-0 (-> v1-6 1)) @@ -230,7 +230,7 @@ (let* ((f1-6 (- 1.0 f0-20)) (f0-21 f30-0) (f1-7 (+ f30-0 f1-6)) - (f2-3 (* f0-21 f0-21)) + (f2-3 (square f0-21)) (f3-3 (+ (* 2.0 f0-21 (- f1-7 f0-21)) f2-3)) (f4-3 (/ f0-21 (- 1.0 f1-7))) (f3-4 (+ (* (- 1.0 f1-7) (- 1.0 f1-7) f4-3) f3-3)) @@ -283,14 +283,14 @@ (f1-2 (-> this tlo)) (f0-8 (/ (cond ((< f0-3 f1-2) - (* f0-3 f0-3) + (square f0-3) ) ((< f0-3 (-> this thi)) (+ (* 2.0 f1-2 (- f0-3 f1-2)) (-> this ylo)) ) (else (let ((f1-5 (- 1.0 f0-3))) - (- (-> this yend) (* f1-5 f1-5 (-> this m2))) + (- (-> this yend) (* (square f1-5) (-> this m2))) ) ) ) @@ -324,7 +324,6 @@ ;; WARN: Return type mismatch float vs none. (defmethod initialize! ((this sync-paused) (arg0 sync-info-params)) "Set up a sync-info from params." - (local-vars (sv-16 res-tag)) (if (!= (-> arg0 sync-type) 'sync-paused) (format 0 @@ -340,8 +339,9 @@ ) (let ((a0-3 (-> arg0 entity))) (when a0-3 - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (the-as res-lump a0-3) 'sync (pointer float) :tag-ptr (& sv-16))) + ) (when v1-6 (set! s5-0 (the int (* 300.0 (-> v1-6 0)))) (set! f26-0 (-> v1-6 1)) diff --git a/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc b/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc index 43c51cdbb1..83091edb9c 100644 --- a/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/ash1-course_REF.gc @@ -105,11 +105,9 @@ (cond ((and (nonzero? (-> arg1 waypoint-time0)) (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 1)) - (let ((f0-0 143360.0)) - (and (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) - (= (-> s5-0 action) (game-task-action say)) - ) - ) + (and (>= (square 143360.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) + (= (-> s5-0 action) (game-task-action say)) + ) ) ) (process-entity-status! arg1 (entity-perm-status no-kill) #t) diff --git a/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc b/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc index 4ee7419d6c..7e7a9f039b 100644 --- a/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/atoll-obs_REF.gc @@ -149,7 +149,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) @@ -204,8 +203,9 @@ (let ((f28-0 -3.0) (f30-0 3.0) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data arg0 'move-range (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-40 (res-lump-data arg0 'move-range (pointer float) :tag-ptr (& sv-64))) + ) (when v1-40 (set! f28-0 (-> v1-40 0)) (set! f30-0 (-> v1-40 1)) @@ -332,7 +332,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec camera-blocker pusher)) @@ -364,14 +363,16 @@ (let ((f30-0 8192.0) (f28-0 0.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-25 (res-lump-data arg0 'rotspeed pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-25 (res-lump-data arg0 'rotspeed pointer :tag-ptr (& sv-16))) + ) (if v1-25 (set! f30-0 (-> (the-as (pointer float) v1-25))) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-27 (res-lump-data arg0 'rise-height pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-27 (res-lump-data arg0 'rise-height pointer :tag-ptr (& sv-32))) + ) (if v1-27 (set! f28-0 (-> (the-as (pointer float) v1-27))) ) @@ -505,7 +506,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) @@ -526,16 +526,18 @@ ) (process-drawable-from-entity! this arg0) (let ((s4-1 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data arg0 'trans-offset vector :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data arg0 'trans-offset vector :tag-ptr (& sv-16))) + ) (when v1-15 (+! (-> s4-1 trans x) (-> v1-15 x)) (+! (-> s4-1 trans y) (-> v1-15 y)) (+! (-> s4-1 trans z) (-> v1-15 z)) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data arg0 'scale-mult vector :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-17 (res-lump-data arg0 'scale-mult vector :tag-ptr (& sv-32))) + ) (when v1-17 (set! (-> s4-1 scale x) (* (-> s4-1 scale x) (-> v1-17 x))) (set! (-> s4-1 scale y) (* (-> s4-1 scale y) (-> v1-17 y))) @@ -696,7 +698,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) @@ -739,8 +740,9 @@ (let ((f28-0 4.0) (f30-0 0.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-29 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-29 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-29 (set! f28-0 (-> v1-29 0)) (set! f30-0 (-> v1-29 1)) diff --git a/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc b/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc index fa33f01c84..0dd5e56dda 100644 --- a/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/atoll-part_REF.gc @@ -326,7 +326,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f2-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (let ((a1-1 (new-stack-vector0))) (set! (-> a1-1 y) (-> v1-0 flag-rot-sy y)) diff --git a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc index a8112cd2ed..b249003c0b 100644 --- a/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/juicer_REF.gc @@ -768,11 +768,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) (go (method-of-object this knocked)) diff --git a/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc b/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc index 4949b95876..0c9d0bcbf6 100644 --- a/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/sig0-course_REF.gc @@ -716,9 +716,7 @@ (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (if (and (not (speech-playing? arg1 5)) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-1 73728.0)) - (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) - ) + (>= (square 73728.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) (play-speech arg1 5) ) @@ -762,13 +760,9 @@ :skip-to 15 :on-set (lambda ((arg0 sig-atoll)) (set! (-> arg0 sig-course liftcat-speech-index) 0) - (let ((f0-0 (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - (f1-0 98304.0) - ) - (if (>= f0-0 (* f1-0 f1-0)) - (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) - ) - ) + (if (>= (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans)) (square 98304.0)) + (logior! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) + ) (play-speech arg0 6) (let ((v1-10 (get-task-by-type (-> arg0 ai-ctrl) sigt-wait-spot arg0))) (set! (-> v1-10 bytes 5) 1) @@ -875,16 +869,12 @@ (outside-spot-radius? arg0 (the-as bot-spot #f) (the-as vector #f) #f) ) (logclear! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) - (let ((f0-0 98304.0)) - (if (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - (play-speech arg0 34) - ) - ) + (if (>= (square 98304.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) + (play-speech arg0 34) + ) ) ((and (logtest? (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) - (let ((f0-3 49152.0)) - (>= (* f0-3 f0-3) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - ) + (>= (square 49152.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) ) (logclear! (-> arg0 waypoint-bits) (waypoint-bits wabits-1)) (play-speech arg0 34) @@ -907,9 +897,7 @@ a1-7 ) ) - (let ((f0-6 98304.0)) - (>= (* f0-6 f0-6) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) - ) + (>= (square 98304.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 root trans))) ) (when (and (demo?) (time-elapsed? (-> arg0 waypoint-time0) (seconds 1)) @@ -979,27 +967,23 @@ (cond ((not (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-0))) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 81920.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 10) - (set-setting! 'entity-name "camera-68" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 81920.0) - (set! (-> arg1 too-far-fail-dist-delta) 225280.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 81920.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (logior! (-> arg1 waypoint-bits) (waypoint-bits wabits-0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 10) + (set-setting! 'entity-name "camera-68" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 81920.0) + (set! (-> arg1 too-far-fail-dist-delta) 225280.0) ) ) ) @@ -1407,26 +1391,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (play-speech arg1 15) - (reset-warn-time! arg1) - (set-setting! 'entity-name "camera-69" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 73728.0) - (set! (-> arg1 too-far-fail-dist-delta) 233472.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 73728.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (play-speech arg1 15) + (reset-warn-time! arg1) + (set-setting! 'entity-name "camera-69" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 73728.0) + (set! (-> arg1 too-far-fail-dist-delta) 233472.0) ) ) ) @@ -1529,9 +1509,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) @@ -1689,16 +1667,11 @@ (when (not (channel-active? arg1 (gui-channel none))) (let ((s5-0 (-> arg1 root trans)) (s4-0 (-> arg1 sig-course spots)) - (f0-0 163840.0) ) - (when (and (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared s5-0 (target-pos 0))) - (let ((f0-3 86016.0)) - (or (>= (* f0-3 f0-3) (vector-vector-xz-distance-squared s5-0 (-> s4-0 28 center))) - (let ((f0-6 102400.0)) - (>= (* f0-6 f0-6) (vector-vector-xz-distance-squared s5-0 (-> s4-0 29 center))) - ) - ) - ) + (when (and (>= (square 163840.0) (vector-vector-xz-distance-squared s5-0 (target-pos 0))) + (or (>= (square 86016.0) (vector-vector-xz-distance-squared s5-0 (-> s4-0 28 center))) + (>= (square 102400.0) (vector-vector-xz-distance-squared s5-0 (-> s4-0 29 center))) + ) ) (when (or (not (logtest? (-> arg1 waypoint-bits) (waypoint-bits wabits-1))) (time-elapsed? (-> arg1 waypoint-time0) (seconds 8)) @@ -1811,26 +1784,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 21) - (set-setting! 'entity-name "camera-70" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 61440.0) - (set! (-> arg1 too-far-fail-dist-delta) 245760.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 61440.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 21) + (set-setting! 'entity-name "camera-70" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 61440.0) + (set! (-> arg1 too-far-fail-dist-delta) 245760.0) ) ) ) @@ -1931,9 +1900,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) @@ -2158,26 +2125,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-2 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 73728.0) - ) - (cond - ((and (< f0-2 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 23) - (set-setting! 'entity-name "camera-71" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 73728.0) - (set! (-> arg1 too-far-fail-dist-delta) 233472.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 73728.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 23) + (set-setting! 'entity-name "camera-71" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 73728.0) + (set! (-> arg1 too-far-fail-dist-delta) 233472.0) ) ) ) @@ -2285,9 +2248,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) @@ -2737,11 +2698,9 @@ (when (and (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) (not (channel-active? arg1 (gui-channel none))) ) - (let ((f0-0 122880.0)) - (if (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (play-speech arg1 30) - ) - ) + (if (>= (square 122880.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) + (play-speech arg1 30) + ) (ai-task-control-method-12 (-> arg1 ai-ctrl) arg1) (go-to-waypoint! arg1 37 #f) (ai-task-control-method-10 (-> arg1 ai-ctrl) arg1) @@ -2784,26 +2743,22 @@ (cond ((zero? (-> arg1 waypoint-time0)) (when (outside-spot-radius? arg1 (the-as bot-spot #f) (the-as vector #f) #f) - (let ((f0-0 (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - (f1-0 61440.0) - ) - (cond - ((and (< f0-0 (* f1-0 f1-0)) - (not (channel-active? arg1 (gui-channel none))) - (process-grab? arg1 #t) - (process-grab? *target* #t) - ) - (set-time! (-> arg1 waypoint-time0)) - (process-grab? arg1 #f) - (process-grab? *target* #f) - (reset-warn-time! arg1) - (play-speech arg1 31) - (set-setting! 'entity-name "camera-72" 0.0 0) - ) - (else - (set! (-> arg1 too-far-warn-dist) 61440.0) - (set! (-> arg1 too-far-fail-dist-delta) 430080.0) - ) + (cond + ((and (< (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0)) (square 61440.0)) + (not (channel-active? arg1 (gui-channel none))) + (process-grab? arg1 #t) + (process-grab? *target* #t) + ) + (set-time! (-> arg1 waypoint-time0)) + (process-grab? arg1 #f) + (process-grab? *target* #f) + (reset-warn-time! arg1) + (play-speech arg1 31) + (set-setting! 'entity-name "camera-72" 0.0 0) + ) + (else + (set! (-> arg1 too-far-warn-dist) 61440.0) + (set! (-> arg1 too-far-fail-dist-delta) 430080.0) ) ) ) @@ -2920,9 +2875,7 @@ a1-2 ) (not (channel-active? arg1 (gui-channel none))) - (let ((f0-0 102400.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) - ) + (>= (square 102400.0) (vector-vector-xz-distance-squared (-> arg1 root trans) (target-pos 0))) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc index 6bb681ab43..5448c93a30 100644 --- a/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc +++ b/test/decompiler/reference/jak2/levels/atoll/sniper_REF.gc @@ -201,9 +201,7 @@ ;; definition for method 12 of type sniper (defmethod run-logic? ((this sniper)) "Should this process be run? Checked by execute-process-tree." - (let ((f0-0 573440.0)) - (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) - ) + (>= (square 573440.0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) ) ;; definition for method 129 of type sniper diff --git a/test/decompiler/reference/jak2/levels/castle/castle-obs_REF.gc b/test/decompiler/reference/jak2/levels/castle/castle-obs_REF.gc index 71ed0d9edf..98edc69672 100644 --- a/test/decompiler/reference/jak2/levels/castle/castle-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/castle/castle-obs_REF.gc @@ -65,7 +65,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (reset-root! this) (set! (-> this path) (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) @@ -76,8 +75,9 @@ (set! (-> this sound-id) (new-sound-id)) (set! (-> this target-speed) (-> this speed)) (conveyor-method-21 this) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-16 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-16)) @@ -324,7 +324,6 @@ ) :code sleep-code :post (behavior () - (local-vars (sv-608 symbol) (sv-624 symbol) (sv-640 (function vector cspace vector)) (sv-656 vector)) (when (and (logtest? (actor-option user17) (-> self fact options)) (not (-> self track-flag)) (< (-> self lightning-timer) (current-time)) @@ -348,42 +347,17 @@ (when (< 0.0 f0-5) (let ((s5-2 (vector+float*! (new 'stack-no-clear 'vector) (-> gp-0 start-pos) (-> gp-0 move-dist) f0-5)) (gp-1 45) - (s4-2 (get-process *default-dead-pool* lightning-tracker #x4000)) ) - (when s4-2 - (let ((t9-7 (method-of-type lightning-tracker activate))) - (t9-7 - (the-as lightning-tracker s4-2) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s3-2 run-function-in-process) - (s2-2 s4-2) - (s1-0 lightning-tracker-init) - (s0-0 (-> *lightning-spec-id-table* 27)) - ) - (set! sv-608 (the-as symbol #f)) - (set! sv-624 (the-as symbol #f)) - (set! sv-640 vector<-cspace!) - (set! sv-656 (new 'stack-no-clear 'vector)) - (let* ((a1-8 (-> self node-list data (+ (rand-vu-int-count 3) 4))) - (t2-0 (sv-640 sv-656 a1-8)) - ) - ((the-as (function object object object object object object object object none) s3-2) - s2-2 - s1-0 - s0-0 - gp-1 - sv-608 - sv-624 - t2-0 - s5-2 - ) - ) - ) - (-> s4-2 ppointer) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 27) + gp-1 + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (+ (rand-vu-int-count 3) 4))) + s5-2 + :to *entity-pool* ) ) (set! (-> self lightning-timer) (+ (current-time) (the int (* 300.0 (rand-vu-float-range 0.04 0.1))))) @@ -406,7 +380,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec enemy)) @@ -445,8 +418,9 @@ (get-point-in-path! (-> this path) (-> this red-pos) 0.0 'exact) (get-point-in-path! (-> this path) (-> this blue-pos) 1.0 'exact) (set! (-> this lightning-timer) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-27 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-27 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-27 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-27)) @@ -1632,7 +1606,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) (set! (-> s4-0 total-prims) (the-as uint 3)) @@ -1671,8 +1644,9 @@ (the-as pair 0) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-22 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-22 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-22)) @@ -2652,7 +2626,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -2682,8 +2655,9 @@ (set! (-> this spawn-max) 5) (set! (-> this spawn-total) -1) (set! (-> this last-guard) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-13 (res-lump-data arg0 'extra-id (pointer int32) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-13 (res-lump-data arg0 'extra-id (pointer int32) :tag-ptr (& sv-16))) + ) (when v1-13 (set! (-> this spawn-max) (-> v1-13 0)) (if (< (the-as uint 1) (-> sv-16 elt-count)) @@ -2695,8 +2669,9 @@ (set! (-> this anim-index) (res-lump-value (-> this entity) 'index int :default (the-as uint128 -1) :time -1000000000.0) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-17 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-17 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-17 (nonzero? (-> sv-32 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-17)) diff --git a/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc b/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc index 528ea16d4b..02f5d5b049 100644 --- a/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/bombbot/bombbot_REF.gc @@ -910,15 +910,7 @@ ;; ERROR: Stack slot load at 912 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-179 ((this bombbot)) - (local-vars - (at-0 int) - (sv-864 vector) - (sv-880 vector) - (sv-896 float) - (sv-912 float) - (sv-928 (function vector vector float)) - (sv-944 uint) - ) + (local-vars (at-0 int)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -976,19 +968,21 @@ ((>= f30-0 f28-0) (vector-orient-by-quat! s3-0 (-> s1-0 pos-offset) (-> this root quat)) (let ((f26-0 (- f30-0 f28-0))) - (set! sv-880 s0-0) - (set! sv-864 (new 'stack-no-clear 'vector)) - (set! (-> sv-864 x) 0.0) - (set! (-> sv-864 y) (sin (* (-> this y-angular-velocity) (-> pp clock frames-per-second)))) - (set! (-> sv-864 z) 0.0) - (set! (-> sv-864 w) 1.0) - (let ((v1-39 s3-0)) - (.lvf vf1 (&-> sv-864 quad)) - (.lvf vf2 (&-> v1-39 quad)) + (let ((sv-880 s0-0)) + (let ((sv-864 (new 'stack-no-clear 'vector))) + (set! (-> sv-864 x) 0.0) + (set! (-> sv-864 y) (sin (* (-> this y-angular-velocity) (-> pp clock frames-per-second)))) + (set! (-> sv-864 z) 0.0) + (set! (-> sv-864 w) 1.0) + (let ((v1-39 s3-0)) + (.lvf vf1 (&-> sv-864 quad)) + (.lvf vf2 (&-> v1-39 quad)) + ) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-880 quad) vf3) ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-880 quad) vf3) (let ((a1-5 s0-0) (v1-41 s0-0) (a0-11 (new 'stack-no-clear 'vector)) @@ -1133,35 +1127,21 @@ (when (-> s1-0 moving) (set! (-> s1-0 position quad) (-> s1-0 next-position quad)) (set! (-> s1-0 moving) #f) - (let ((s0-1 lerp-scale)) - (set! sv-896 (the-as float 819.2)) - (set! sv-912 (the-as float 0.0)) - (set! sv-928 vector-vector-distance) - (let* ((a0-34 (camera-pos)) - (a1-17 (-> s1-0 position)) - (a2-23 (sv-928 a0-34 a1-17)) - (a3-2 40960.0) - (t0-1 409600.0) - (f30-1 (s0-1 sv-896 sv-912 a2-23 a3-2 t0-1)) - ) - (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) - (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) - (part-tracker-spawn :to this :group group-land-poof-stn :mat-joint (-> s1-0 position)) - (when (or (zero? s4-0) (= s4-0 1)) - (let ((s0-3 sound-play-by-name)) - (set! sv-944 (make-u128 0 (the-as uint #x6b6c61772d6262))) - (let ((a1-23 (new-sound-id)) - (a2-30 1024) - (a3-6 0) - (t0-4 0) - (t1-3 1) - (t2-2 (-> s1-0 position)) - ) - (s0-3 (the-as sound-name sv-944) a1-23 a2-30 a3-6 t0-4 (the-as sound-group t1-3) t2-2) - ) - ) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.0012207031 f30-1))) (seconds 0.2)) - ) + (let ((f30-1 (lerp-scale + (the-as float 819.2) + (the-as float 0.0) + (vector-vector-distance (camera-pos) (-> s1-0 position)) + 40960.0 + 409600.0 + ) + ) + ) + (when (and (!= f30-1 0.0) (< 16384.0 (vector-length (-> s1-0 speed)))) + (activate! *camera-smush-control* f30-1 37 600 1.0 0.1 (-> pp clock)) + (part-tracker-spawn :to this :group group-land-poof-stn :mat-joint (-> s1-0 position)) + (when (or (zero? s4-0) (= s4-0 1)) + (sound-play "bb-walk" :position (-> s1-0 position)) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (* 0.0012207031 f30-1))) (seconds 0.2)) ) ) ) @@ -1241,7 +1221,6 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (local-vars (sv-16 sparticle-launcher) (sv-20 sparticle-launcher)) (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -1268,56 +1247,61 @@ (the-as (function object float none) (method-of-object this bombbot-method-183)) ) (bombbot-method-184 this) - (set! sv-16 (the-as sparticle-launcher #f)) - (set! sv-20 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) 30) - (set! sv-16 (-> *part-id-table* 778)) - (set! sv-20 (-> *part-id-table* 774)) - ) - ((< (-> this hit-points) 60) - (set! sv-16 (-> *part-id-table* 781)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-16 (-> *part-id-table* 783)) + (let ((sv-16 (the-as sparticle-launcher #f)) + (sv-20 (the-as sparticle-launcher #f)) + ) + (set! sv-16 (cond + ((< (-> this hit-points) 30) + (set! sv-16 (-> *part-id-table* 778)) + (set! sv-20 (-> *part-id-table* 774)) + sv-16 + ) + ((< (-> this hit-points) 60) + (-> *part-id-table* 781) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-16 (-> *part-id-table* 783)) + ) + sv-16 + ) + ) ) - ) - ) - (when sv-16 - (let ((gp-1 (-> this node-list data 4 bone transform)) - (s5-3 (new 'stack-no-clear 'vector)) - ) - (dotimes (s4-1 2) - (vector-matrix*! - s5-3 - (vector-rotate-around-y! (new 'stack-no-clear 'vector) (new 'static 'vector :z 6144.0 :w 1.0) (if (< s4-1 1) - 5461.3335 - 38229.332 - ) - ) - gp-1 - ) - (vector-! *particle-vel* s5-3 (matrix->trans gp-1 (new 'stack-no-clear 'vector))) - (+! (-> *particle-vel* y) 4096.0) - (vector-float*! *particle-vel* *particle-vel* 0.0033333334) - (when (and sv-20 (< (rand-vu) 0.005)) - (let ((t9-14 sp-launch-particles-var) - (a0-22 *sp-particle-system-2d*) - (a1-9 sv-16) - (a2-2 *launch-matrix*) - ) - (set! (-> a2-2 trans quad) (-> s5-3 quad)) - (t9-14 a0-22 a1-9 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + (when sv-16 + (let ((gp-1 (-> this node-list data 4 bone transform)) + (s5-3 (new 'stack-no-clear 'vector)) ) - ) - (let ((t9-15 sp-launch-particles-var) - (a0-23 *sp-particle-system-2d*) - (a1-10 sv-16) - (a2-3 *launch-matrix*) + (dotimes (s4-1 2) + (vector-matrix*! + s5-3 + (vector-rotate-around-y! (new 'stack-no-clear 'vector) (new 'static 'vector :z 6144.0 :w 1.0) (if (< s4-1 1) + 5461.3335 + 38229.332 + ) + ) + gp-1 + ) + (vector-! *particle-vel* s5-3 (matrix->trans gp-1 (new 'stack-no-clear 'vector))) + (+! (-> *particle-vel* y) 4096.0) + (vector-float*! *particle-vel* *particle-vel* 0.0033333334) + (when (and sv-20 (< (rand-vu) 0.005)) + (let ((t9-14 sp-launch-particles-var) + (a0-22 *sp-particle-system-2d*) + (a1-9 sv-16) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> s5-3 quad)) + (t9-14 a0-22 a1-9 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) ) - (set! (-> a2-3 trans quad) (-> s5-3 quad)) - (t9-15 a0-23 a1-10 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-15 sp-launch-particles-var) + (a0-23 *sp-particle-system-2d*) + (a1-10 sv-16) + (a2-3 *launch-matrix*) + ) + (set! (-> a2-3 trans quad) (-> s5-3 quad)) + (t9-15 a0-23 a1-10 a2-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) @@ -1525,7 +1509,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun bombbot-spread-lightning-lazer ((arg0 lightning-control) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars (sv-656 vector) (sv-672 vector) (sv-688 int) (sv-704 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1534,25 +1517,25 @@ (vf7 :class vf) ) (init-vf0-vector) - (set! sv-656 arg1) - (let ((s5-0 (new 'stack-no-clear 'vector))) + (let ((sv-656 arg1) + (s5-0 (new 'stack-no-clear 'vector)) + ) (set! (-> s5-0 quad) (-> sv-656 quad)) (let ((s4-0 (new 'stack-no-clear 'vector))) (set! (-> s4-0 quad) (-> arg2 quad)) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (set! sv-672 (new 'stack-no-clear 'vector)) - (let ((s2-0 (new 'stack-no-clear 'quaternion))) - (vector-length arg2) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! (-> s1-0 quad) (-> arg3 quad)) - (let ((s0-0 (new 'stack-no-clear 'collide-query)) - (f30-0 6144.0) - ) - (vector-normalize! s4-0 f30-0) - (let ((v1-9 (-> sv-656 quad))) - (set! (-> sv-672 quad) v1-9) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (sv-672 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'quaternion)) + ) + (vector-length arg2) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (set! (-> s1-0 quad) (-> arg3 quad)) + (let ((s0-0 (new 'stack-no-clear 'collide-query)) + (f30-0 6144.0) ) - (set! sv-688 0) + (vector-normalize! s4-0 f30-0) + (set! (-> sv-672 quad) (-> sv-656 quad)) + (let ((sv-688 0)) (while (< sv-688 15) (let ((v1-11 s0-0)) (set! (-> v1-11 radius) 6144.0) @@ -1648,11 +1631,12 @@ (+! (-> s3-0 z) (rand-vu-float-range -409.6 409.6)) (set-point! arg0 (-> arg0 state points-to-draw) s3-0) (+! (-> arg0 state points-to-draw) 1) - (set! sv-704 (-> s0-0 best-other-tri normal)) - (quaternion-from-two-vectors! s2-0 s1-0 sv-704) - (vector-orient-by-quat! s4-0 s4-0 s2-0) - (set! (-> s1-0 quad) (-> sv-704 quad)) - (vector-flatten! s4-0 s4-0 sv-704) + (let ((sv-704 (-> s0-0 best-other-tri normal))) + (quaternion-from-two-vectors! s2-0 s1-0 sv-704) + (vector-orient-by-quat! s4-0 s4-0 s2-0) + (set! (-> s1-0 quad) (-> sv-704 quad)) + (vector-flatten! s4-0 s4-0 sv-704) + ) (vector-normalize! s4-0 f30-0) ) (else @@ -1664,7 +1648,7 @@ ) ) ) - (set! sv-688 (+ sv-688 1)) + (+! sv-688 1) ) ) ) @@ -1680,19 +1664,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-182 ((this bombbot)) - (local-vars - (v1-28 symbol) - (sv-880 matrix) - (sv-896 (function vector vector quaternion vector)) - (sv-912 vector) - (sv-928 vector) - (sv-944 (function quaternion vector float quaternion)) - (sv-960 quaternion) - (sv-976 vector) - (sv-992 basic) - (sv-1008 process) - (sv-1024 (pointer process)) - ) + (local-vars (v1-28 symbol) (sv-1024 (pointer process))) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1701,8 +1673,9 @@ (vf7 :class vf) ) (init-vf0-vector) - (let ((s2-0 (handle->process (-> this focus handle)))) - (set! sv-880 (new 'stack-no-clear 'matrix)) + (let ((s2-0 (handle->process (-> this focus handle))) + (sv-880 (new 'stack-no-clear 'matrix)) + ) (let* ((a0-4 (-> this node-list data 6 bone transform)) (a2-0 (-> a0-4 quad 0)) (a1-1 (-> a0-4 quad 1)) @@ -1765,43 +1738,32 @@ (vector+! s1-0 (-> s3-0 start-pos) s5-0) (point-in-plane-<-point+normal! s0-0 s1-0 (-> s3-0 best-other-tri normal)) (vector-! s0-0 s0-0 s1-0) - (set! sv-896 vector-orient-by-quat!) - (set! sv-912 s0-0) - (set! sv-928 s0-0) - (set! sv-944 quaternion-vector-angle!) - (set! sv-960 (new 'stack-no-clear 'quaternion)) - (set! sv-976 (-> s3-0 best-other-tri normal)) - (let* ((a2-6 (rand-vu-float-range 0.0 65536.0)) - (a2-7 (sv-944 sv-960 sv-976 a2-6)) - ) - (sv-896 sv-912 sv-928 a2-7) - ) - (set! sv-992 (-> s3-0 best-other-tri collide-ptr)) - (let ((v1-25 (if (type? sv-992 collide-shape-prim) - sv-992 - ) - ) - ) + (vector-orient-by-quat! s0-0 s0-0 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (-> s3-0 best-other-tri normal) + (rand-vu-float-range 0.0 65536.0) + ) + ) + (let ((v1-25 (the-as basic (as-type (-> s3-0 best-other-tri collide-ptr) collide-shape-prim)))) (when v1-25 (cond ((logtest? (-> (the-as collide-shape-prim v1-25) prim-core collide-as) (collide-spec vehicle-sphere)) - (set! sv-1008 (get-process *default-dead-pool* lightning-tracker #x4000)) - (set! v1-28 - (when sv-1008 - (set! sv-1024 (the-as (pointer process) v1-28)) - (let ((t9-9 (method-of-type lightning-tracker activate))) - (t9-9 - (the-as lightning-tracker sv-1008) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) + (let ((sv-1008 (get-process *default-dead-pool* lightning-tracker #x4000))) + (set! v1-28 + (when sv-1008 + (set! sv-1024 (the-as (pointer process) v1-28)) + ((method-of-type lightning-tracker activate) + (the-as lightning-tracker sv-1008) + *entity-pool* + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) + ) + (run-now-in-process sv-1008 lightning-tracker-init (-> *lightning-spec-id-table* 13) 30 #f #f #f #f) + (set! sv-1024 (-> sv-1008 ppointer)) + v1-28 ) - (run-now-in-process sv-1008 lightning-tracker-init (-> *lightning-spec-id-table* 13) 30 #f #f #f #f) - (set! sv-1024 (-> sv-1008 ppointer)) - v1-28 ) - ) + ) (set-point! (-> (the-as lightning-tracker (-> sv-1024 0)) lightning) 0 s1-0) (set! (-> (the-as lightning-tracker (-> sv-1024 0)) offset0 quad) (-> s1-0 quad)) (set! (-> (the-as lightning-tracker (-> sv-1024 0)) lightning state points-to-draw) 1) @@ -2536,13 +2498,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun bombbot-callback ((arg0 cspace) (arg1 transformq)) - (local-vars - (sv-176 (function quaternion quaternion quaternion quaternion)) - (sv-192 quaternion) - (sv-208 quaternion) - (sv-224 vector) - (sv-240 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -2584,25 +2539,24 @@ (set! (-> s1-0 quad) (-> v1-3 pos-offset quad)) (set! (-> s1-0 y) (* -2.0 (-> v1-3 main-y))) (new 'stack-no-clear 'vector) - (set! sv-224 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> v1-3 pos-offset) 1.0)) - ) - (set! sv-240 (vector-normalize-copy! (new 'stack-no-clear 'vector) s1-0 1.0)) - (let ((f0-8 (vector-vector-angle-safe sv-224 sv-240))) - (when (!= f0-8 0.0) - (set! sv-176 quaternion*!) - (set! sv-192 s3-0) - (set! sv-208 s3-0) - (let ((t9-4 quaternion-vector-angle!) - (a0-14 (new 'stack-no-clear 'quaternion)) - (a1-8 (new 'stack-no-clear 'vector)) - ) - (.lvf vf1 (&-> sv-224 quad)) - (.lvf vf2 (&-> sv-240 quad)) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> a1-8 quad) vf3) - (let ((a2-5 (t9-4 a0-14 a1-8 f0-8))) - (sv-176 sv-192 sv-208 a2-5) + (let* ((sv-224 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> v1-3 pos-offset) 1.0)) + (sv-240 (vector-normalize-copy! (new 'stack-no-clear 'vector) s1-0 1.0)) + (f0-8 (vector-vector-angle-safe sv-224 sv-240)) + ) + (when (!= f0-8 0.0) + (let ((sv-176 quaternion*!) + (sv-192 s3-0) + (sv-208 s3-0) + (t9-4 quaternion-vector-angle!) + (a0-14 (new 'stack-no-clear 'quaternion)) + (a1-8 (new 'stack-no-clear 'vector)) + ) + (.lvf vf1 (&-> sv-224 quad)) + (.lvf vf2 (&-> sv-240 quad)) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> a1-8 quad) vf3) + (sv-176 sv-192 sv-208 (t9-4 a0-14 a1-8 f0-8)) ) ) ) @@ -2686,7 +2640,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun bombbot-gun-swivel-callback ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-128 vector) (sv-144 vector) (sv-160 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2694,34 +2647,35 @@ ) (init-vf0-vector) (cspace<-parented-transformq-joint! arg0 arg1) - (let ((s3-0 (the-as bombbot (-> arg0 param1)))) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((s4-0 (new 'stack-no-clear 'quaternion)) - (s0-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'stack-no-clear 'vector)) - (s2-0 (new 'stack-no-clear 'vector)) - (s5-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) - ) - (set! sv-144 sv-160) - (set! sv-128 (-> s3-0 target-pos)) - (let ((v0-2 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector)))) + (let ((s3-0 (the-as bombbot (-> arg0 param1))) + (sv-160 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'quaternion)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) + (s5-0 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + ) + (let ((sv-144 sv-160)) + (let ((sv-128 (-> s3-0 target-pos)) + (v0-2 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + ) (.lvf vf4 (&-> sv-128 quad)) (.lvf vf5 (&-> v0-2 quad)) ) (.mov.vf.w vf6 vf0) (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> sv-144 quad) vf6) - (rot-zxy-from-vector! s0-0 (-> arg0 bone transform vector 2)) - (rot-zxy-from-vector! s0-0 *z-vector*) - (rot-zxy-from-vector! s1-0 sv-160) - (set! (-> s2-0 x) (deg- (-> s1-0 x) (-> s0-0 x))) - (set! (-> s2-0 y) (deg- (-> s1-0 y) (-> s0-0 y))) - (set! (-> s2-0 y) (deg- (-> s1-0 y) 0.0)) - (set! (-> s3-0 angle-turret) (deg-seek (-> s3-0 angle-turret) (-> s2-0 y) (* 36408.89 (seconds-per-frame)))) - (quaternion-vector-angle! s4-0 *up-vector* (-> s3-0 angle-turret)) - (quaternion->matrix (-> arg0 bone transform) s4-0) - (set! (-> arg0 bone transform trans quad) (-> s5-0 quad)) ) + (rot-zxy-from-vector! s0-0 (-> arg0 bone transform vector 2)) + (rot-zxy-from-vector! s0-0 *z-vector*) + (rot-zxy-from-vector! s1-0 sv-160) + (set! (-> s2-0 x) (deg- (-> s1-0 x) (-> s0-0 x))) + (set! (-> s2-0 y) (deg- (-> s1-0 y) (-> s0-0 y))) + (set! (-> s2-0 y) (deg- (-> s1-0 y) 0.0)) + (set! (-> s3-0 angle-turret) (deg-seek (-> s3-0 angle-turret) (-> s2-0 y) (* 36408.89 (seconds-per-frame)))) + (quaternion-vector-angle! s4-0 *up-vector* (-> s3-0 angle-turret)) + (quaternion->matrix (-> arg0 bone transform) s4-0) + (set! (-> arg0 bone transform trans quad) (-> s5-0 quad)) ) 0 (none) @@ -2732,7 +2686,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun bombbot-gun-callback ((arg0 cspace) (arg1 transformq)) - (local-vars (sv-112 vector) (sv-128 vector)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2747,15 +2700,17 @@ (s1-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) ) - (set! sv-128 s0-0) - (set! sv-112 (-> s4-0 target-pos)) - (let ((v0-1 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector)))) - (.lvf vf4 (&-> sv-112 quad)) - (.lvf vf5 (&-> v0-1 quad)) + (let ((sv-128 s0-0)) + (let ((sv-112 (-> s4-0 target-pos)) + (v0-1 (matrix->trans (-> arg0 bone transform) (new 'stack-no-clear 'vector))) + ) + (.lvf vf4 (&-> sv-112 quad)) + (.lvf vf5 (&-> v0-1 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-128 quad) vf6) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-128 quad) vf6) (rot-zxy-from-vector! s2-0 (-> arg0 bone transform vector 2)) (rot-zxy-from-vector! s1-0 s0-0) (set! (-> s3-0 x) (fmax -2730.6667 (fmin 2730.6667 (deg- (-> s1-0 x) (-> s2-0 x))))) @@ -2816,7 +2771,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod bombbot-method-183 ((this bombbot)) - (local-vars (at-0 int) (sv-160 vector) (sv-176 vector)) + (local-vars (at-0 int)) (with-pp (rlet ((vf0 :class vf) (vf1 :class vf) @@ -2840,13 +2795,11 @@ (-> this rigidbody state matrix) ) ) + (sv-160 (new 'stack-no-clear 'vector)) ) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-22 (-> *bombbot-spring-setup* s5-0 wpos2 quad))) - (set! (-> sv-160 quad) v1-22) - ) - (set! sv-176 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) + (set! (-> sv-160 quad) (-> *bombbot-spring-setup* s5-0 wpos2 quad)) + (let ((sv-176 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s3-0 (new 'stack-no-clear 'vector)) @@ -2869,11 +2822,7 @@ (.sub.vf.xyz vf6 vf4 vf5) (.svf (&-> v1-36 quad) vf6) ) - (let ((a1-4 s1-0) - (v1-37 *null-vector*) - ) - (vector-! a1-4 sv-176 v1-37) - ) + (vector-! s1-0 sv-176 *null-vector*) (let ((f0-10 (vector-length s0-0))) (vector-float*! s2-0 s0-0 (/ 1.0 f0-10)) (let ((f0-12 (* 60.0 (+ -40.96 f0-10))) diff --git a/test/decompiler/reference/jak2/levels/city/common/height-map_REF.gc b/test/decompiler/reference/jak2/levels/city/common/height-map_REF.gc index b98b051bf9..15d9e786a6 100644 --- a/test/decompiler/reference/jak2/levels/city/common/height-map_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/height-map_REF.gc @@ -133,7 +133,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod debug-draw-mesh ((this xz-height-map) (arg0 vector)) - (local-vars (sv-80 int) (sv-96 int)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((s5-0 (new 'stack-no-clear 'matrix))) @@ -150,18 +149,19 @@ (let ((s0-0 s2-0)) (set! (-> s5-0 vector 0 x) (-> this x-offset)) (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) - (set! sv-80 (+ s4-0 -1)) - (while (nonzero? sv-80) - (set! sv-80 (+ sv-80 -1)) - (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) - (+! (-> s5-0 vector 0 x) f28-0) - (set! s0-0 (&-> s0-0 1)) - (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) - (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 0)) - (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) - ) - (add-debug-line #t (bucket-id debug2) (-> s5-0 vector 0) (-> s5-0 vector 1) *color-red* #f (the-as rgba -1)) - ) + (let ((sv-80 (+ s4-0 -1))) + (while (nonzero? sv-80) + (+! sv-80 -1) + (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) + (+! (-> s5-0 vector 0 x) f28-0) + (set! s0-0 (&-> s0-0 1)) + (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> s0-0 0)) (-> this y-scale)))) + (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 0)) + (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) + ) + (add-debug-line #t (bucket-id debug2) (-> s5-0 vector 0) (-> s5-0 vector 1) *color-red* #f (the-as rgba -1)) + ) + ) ) ) (+! (-> s5-0 vector 0 z) f30-0) @@ -176,20 +176,21 @@ (set! (-> s5-0 vector 0 y) (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1) 0)) (-> this y-scale))) ) - (set! sv-96 (+ s3-0 -1)) - (while (nonzero? sv-96) - (set! sv-96 (+ sv-96 -1)) - (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) - (+! (-> s5-0 vector 0 z) f30-0) - (&+! s0-1 s4-0) - (set! (-> s5-0 vector 0 y) - (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1))) (-> this y-scale))) + (let ((sv-96 (+ s3-0 -1))) + (while (nonzero? sv-96) + (+! sv-96 -1) + (set! (-> s5-0 vector 1 quad) (-> s5-0 vector 0 quad)) + (+! (-> s5-0 vector 0 z) f30-0) + (&+! s0-1 s4-0) + (set! (-> s5-0 vector 0 y) + (+ (-> this y-offset) (* (the float (-> (the-as (pointer int8) s0-1))) (-> this y-scale))) + ) + (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 0)) + (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) + ) + (add-debug-line #t (bucket-id debug2) (-> s5-0 vector 0) (-> s5-0 vector 1) *color-blue* #f (the-as rgba -1)) ) - (if (and (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 0)) - (point-in-bbox? (the-as bounding-box (-> s5-0 vector 2)) (-> s5-0 vector 1)) - ) - (add-debug-line #t (bucket-id debug2) (-> s5-0 vector 0) (-> s5-0 vector 1) *color-blue* #f (the-as rgba -1)) - ) + ) ) ) (+! (-> s5-0 vector 0 x) f28-0) diff --git a/test/decompiler/reference/jak2/levels/city/common/nav-graph_REF.gc b/test/decompiler/reference/jak2/levels/city/common/nav-graph_REF.gc index c5e01eba57..7fe7b578f2 100644 --- a/test/decompiler/reference/jak2/levels/city/common/nav-graph_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/nav-graph_REF.gc @@ -108,11 +108,7 @@ ) ) (when (and (not (logtest? (-> this flags) (nav-node-flag-byte hidden))) - (let ((f0-6 (vector-vector-distance-squared gp-0 (camera-pos))) - (f1-2 327680.0) - ) - (and (< f0-6 (* f1-2 f1-2)) (sphere-in-view-frustum? s4-0)) - ) + (and (< (vector-vector-distance-squared gp-0 (camera-pos)) (square 327680.0)) (sphere-in-view-frustum? s4-0)) ) (add-debug-x #t (bucket-id debug2) gp-0 *color-red*) (let ((s4-1 add-debug-text-3d) @@ -1014,10 +1010,9 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch nav-node vs none. (defmethod nav-graph-method-10 ((this nav-graph) (arg0 vector) (arg1 int)) - (let* ((gp-0 (the-as nav-node #f)) - (f0-0 409600000.0) - (f30-0 (* f0-0 f0-0)) - ) + (let ((gp-0 (the-as nav-node #f)) + (f30-0 (square 409600000.0)) + ) (dotimes (s2-0 (-> this node-count)) (let ((s1-0 (-> this node-array s2-0)) (a1-1 (new 'stack-no-clear 'vector)) @@ -1077,7 +1072,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod nav-graph-method-39 ((this nav-graph)) - (local-vars (sv-80 entity-nav-mesh) (sv-96 entity-nav-mesh)) (dotimes (s5-0 (-> this node-count)) (let ((s4-0 (-> this node-array s5-0)) (s3-0 (new 'stack-no-clear 'vector)) @@ -1095,24 +1089,20 @@ (let ((s1-0 (-> v1-8 bsp nav-meshes))) (when (nonzero? s1-0) (dotimes (s0-0 (-> s1-0 length)) - (set! sv-80 (-> s1-0 s0-0)) - (-> sv-80 aid) - (set! sv-96 sv-80) - (let ((v1-16 (if (type? sv-96 entity-nav-mesh) - sv-96 - ) - ) - ) - (when v1-16 - (let ((a0-10 (-> v1-16 nav-mesh)) - (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) - ) - (vector-! (-> a1-5 point) s3-0 (-> a0-10 bounds)) - (set! (-> a1-5 y-threshold) 40960.0) - (set! (-> a1-5 ignore) (the-as uint 2)) - (if (find-poly-containing-point-local a0-10 a1-5) - (set! (-> s4-0 nav-mesh-id) (-> sv-80 aid)) - ) + (let ((sv-80 (-> s1-0 s0-0))) + (-> sv-80 aid) + (let ((v1-16 (as-type sv-80 entity-nav-mesh))) + (when v1-16 + (let ((a0-10 (-> v1-16 nav-mesh)) + (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) + ) + (vector-! (-> a1-5 point) s3-0 (-> a0-10 bounds)) + (set! (-> a1-5 y-threshold) 40960.0) + (set! (-> a1-5 ignore) (the-as uint 2)) + (if (find-poly-containing-point-local a0-10 a1-5) + (set! (-> s4-0 nav-mesh-id) (-> sv-80 aid)) + ) + ) ) ) ) @@ -1313,18 +1303,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod from-editor ((this nav-graph) (arg0 mysql-nav-graph) (arg1 symbol)) - (local-vars - (v1-4 symbol) - (v1-6 symbol) - (v1-37 symbol) - (sv-16 int) - (sv-32 int) - (sv-48 mysql-nav-node) - (sv-64 nav-branch) - (sv-80 nav-graph-link) - (sv-96 nav-node) - (sv-112 int) - ) + (local-vars (v1-4 symbol) (v1-6 symbol) (v1-37 symbol)) (set! (-> this node-count) 0) (set! (-> this branch-count) 0) (set! (-> this link-count) 0) @@ -1343,8 +1322,9 @@ (set! v1-6 (not (logtest? (-> s0-0 mysql-save-flag) (mysql-save-flag delete)))) (label cfg-7) (b! (not v1-6) cfg-27 :delay (nop!)) - (set! sv-16 (temp-edge-size s0-0)) - (let ((s1-0 (debug-add-node this sv-16))) + (let* ((sv-16 (temp-edge-size s0-0)) + (s1-0 (debug-add-node this sv-16)) + ) (b! (not s1-0) cfg-36 :delay (nop!)) (set! (-> s1-0 id) (the-as uint (if arg1 (-> s0-0 level-node-index) @@ -1363,62 +1343,64 @@ (break!) 0 ) - (let ((s0-1 (the-as object (-> s0-0 temp-edge-list)))) - (set! sv-32 sv-16) + (let ((s0-1 (the-as object (-> s0-0 temp-edge-list))) + (sv-32 sv-16) + ) (b! #t cfg-25 :delay (nop!)) (label cfg-15) - (set! sv-32 (+ sv-32 -1)) - (set! sv-64 (-> this branch-array s5-0)) - (set-src-node sv-64 s1-0) - (set-speed-limit sv-64 (-> (the-as mysql-nav-edge s0-1) speed_limit)) - (set-density sv-64 (-> (the-as mysql-nav-edge s0-1) density)) - (set-width sv-64 (-> (the-as mysql-nav-edge s0-1) width)) - (set! (-> sv-64 clock-type) (the-as nav-branch-clock-type (-> (the-as mysql-nav-edge s0-1) nav_clock_type))) - (set! (-> sv-64 clock-mask) (the-as nav-branch-clock-mask (-> (the-as mysql-nav-edge s0-1) nav_clock_mask))) - (set! sv-48 (-> arg0 node-array data (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2))) - (let ((a0-23 (= arg1 #f))) - (b! a0-23 cfg-18 :likely-delay (set! v1-37 a0-23)) - ) - (set! v1-37 (= arg1 (-> sv-48 level_name))) - (label cfg-18) - (b! (not v1-37) cfg-23 :delay (nop!)) - (let ((t9-11 (method-of-type nav-branch set-dst-node)) - (a1-11 (-> this node-array (if arg1 - (-> sv-48 level-node-index) - (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2) - ) - ) - ) + (+! sv-32 -1) + (let ((sv-64 (-> this branch-array s5-0))) + (set-src-node sv-64 s1-0) + (set-speed-limit sv-64 (-> (the-as mysql-nav-edge s0-1) speed_limit)) + (set-density sv-64 (-> (the-as mysql-nav-edge s0-1) density)) + (set-width sv-64 (-> (the-as mysql-nav-edge s0-1) width)) + (set! (-> sv-64 clock-type) (the-as nav-branch-clock-type (-> (the-as mysql-nav-edge s0-1) nav_clock_type))) + (set! (-> sv-64 clock-mask) (the-as nav-branch-clock-mask (-> (the-as mysql-nav-edge s0-1) nav_clock_mask))) + (let ((sv-48 (-> arg0 node-array data (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2)))) + (let ((a0-23 (= arg1 #f))) + (b! a0-23 cfg-18 :likely-delay (set! v1-37 a0-23)) ) - (t9-11 sv-64 a1-11) + (set! v1-37 (= arg1 (-> sv-48 level_name))) + (label cfg-18) + (b! (not v1-37) cfg-23 :delay (nop!)) + (set-dst-node sv-64 (-> this node-array (if arg1 + (-> sv-48 level-node-index) + (-> (the-as mysql-nav-edge s0-1) runtime-node-id-2) + ) + ) + ) + (b! #t cfg-24 :delay (nop!)) + (label cfg-23) + (set-dst-node sv-64 (the-as nav-node #f)) + (let ((sv-112 (-> this link-count))) + (let ((sv-80 (-> this link-array sv-112))) + (set! (-> sv-80 dest-graph-id) (-> (lookup-level-info2 arg0 sv-48 #f) level-id)) + (set! (-> sv-80 src-branch-id) (the-as uint s5-0)) + (set! (-> sv-80 dest-node-id) (the-as uint (-> sv-48 level-node-index))) + (set! (-> sv-80 dest-graph) #f) + (let ((sv-96 (-> sv-80 dummy-node))) + (set! (-> sv-96 id) (the-as uint #xffff)) + (set! (-> sv-96 flags) (the-as nav-node-flag-byte (-> sv-48 nav_node_flag))) + (set-pos-xyz sv-96 (-> sv-48 position)) + (set-angle sv-96 (-> sv-48 angle)) + (set-radius sv-96 (-> sv-48 radius)) + (set! (-> sv-96 level) (-> sv-48 level_name)) + (set! (-> sv-96 nav-mesh-id) (-> sv-48 nav_mesh_id)) + ) + (set-dst-node sv-64 (-> sv-80 dummy-node)) + ) + (format #t "outputting link ~d~%" sv-112) + ) + ) ) - (b! #t cfg-24 :delay (nop!)) - (label cfg-23) - (set-dst-node sv-64 (the-as nav-node #f)) - (set! sv-112 (-> this link-count)) - (set! sv-80 (-> this link-array sv-112)) - (set! (-> sv-80 dest-graph-id) (-> (lookup-level-info2 arg0 sv-48 #f) level-id)) - (set! (-> sv-80 src-branch-id) (the-as uint s5-0)) - (set! (-> sv-80 dest-node-id) (the-as uint (-> sv-48 level-node-index))) - (set! (-> sv-80 dest-graph) #f) - (set! sv-96 (-> sv-80 dummy-node)) - (set! (-> sv-96 id) (the-as uint #xffff)) - (set! (-> sv-96 flags) (the-as nav-node-flag-byte (-> sv-48 nav_node_flag))) - (set-pos-xyz sv-96 (-> sv-48 position)) - (set-angle sv-96 (-> sv-48 angle)) - (set-radius sv-96 (-> sv-48 radius)) - (set! (-> sv-96 level) (-> sv-48 level_name)) - (set! (-> sv-96 nav-mesh-id) (-> sv-48 nav_mesh_id)) - (set-dst-node sv-64 (-> sv-80 dummy-node)) - (format #t "outputting link ~d~%" sv-112) (+! (-> this link-count) 1) (label cfg-24) (+! s5-0 1) (set! s0-1 (-> (the-as mysql-nav-edge s0-1) temp-next-edge)) + (label cfg-25) + (b! (nonzero? sv-32) cfg-15 :delay (nop!)) ) ) - (label cfg-25) - (b! (nonzero? sv-32) cfg-15 :delay (nop!)) (b! #t cfg-33 :delay (nop!)) (label cfg-27) (let ((v1-78 (the-as object (-> s0-0 temp-edge-list)))) diff --git a/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc b/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc index 03bb3d6085..7fb91dde52 100644 --- a/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc @@ -206,14 +206,7 @@ (let* ((v1-67 (-> gp-0 accel-array)) (f0-27 (+ (* (-> v1-67 0 x) (-> v1-67 0 x)) (* (-> v1-67 0 z) (-> v1-67 0 z)))) ) - (if (or (and (-> self pilot as-daxter?) (let ((f1-20 1024000.0)) - (< (* f1-20 f1-20) f0-27) - ) - ) - (let ((f1-23 2048000.0)) - (< (* f1-23 f1-23) f0-27) - ) - ) + (if (or (and (-> self pilot as-daxter?) (< (square 1024000.0) f0-27)) (< (square 2048000.0) f0-27)) (go target-pilot-impact) ) ) @@ -741,24 +734,24 @@ ((-> target-pilot-start exit)) ) :code (behavior ((arg0 symbol) (arg1 attack-info)) - (local-vars (sv-16 attack-info)) (set-time! (-> self state-time)) (set! (-> self neck flex-blend) 0.0) - (set! sv-16 (-> self attack-info)) - (let ((v1-4 sv-16)) - (set! (-> v1-4 attacker) (the-as handle #f)) - (set! (-> v1-4 mode) 'generic) - (set! (-> v1-4 shove-back) 6144.0) - (set! (-> v1-4 shove-up) 4915.2) - (set! (-> v1-4 angle) #f) - (set! (-> v1-4 trans quad) (-> self control trans quad)) - (set! (-> v1-4 control) 0.0) - (set! (-> v1-4 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) - (set! (-> v1-4 damage) (-> *FACT-bank* health-default-inc)) + (let ((sv-16 (-> self attack-info))) + (let ((v1-4 sv-16)) + (set! (-> v1-4 attacker) (the-as handle #f)) + (set! (-> v1-4 mode) 'generic) + (set! (-> v1-4 shove-back) 6144.0) + (set! (-> v1-4 shove-up) 4915.2) + (set! (-> v1-4 angle) #f) + (set! (-> v1-4 trans quad) (-> self control trans quad)) + (set! (-> v1-4 control) 0.0) + (set! (-> v1-4 invinc-time) (the-as time-frame (-> *TARGET-bank* hit-invulnerable-timeout))) + (set! (-> v1-4 damage) (-> *FACT-bank* health-default-inc)) + ) + (combine! sv-16 arg1 self) + (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) + (go target-pilot-death (-> sv-16 mode)) ) - (combine! sv-16 arg1 self) - (pickup-collectable! (-> self fact) (pickup-type health) -1000.0 (the-as handle #f)) - (go target-pilot-death (-> sv-16 mode)) ) :post target-no-stick-post ) diff --git a/test/decompiler/reference/jak2/levels/city/common/trail_REF.gc b/test/decompiler/reference/jak2/levels/city/common/trail_REF.gc index 4885d3e3fc..fda2589e11 100644 --- a/test/decompiler/reference/jak2/levels/city/common/trail_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/trail_REF.gc @@ -13,21 +13,10 @@ (set-vector! s4-0 (* 4096.0 (the float (-> a2-3 x))) 53248.0 (* 4096.0 (the float (-> a2-3 z))) 1.0) (set-vector! s3-0 (* 4096.0 (the float (-> v1-2 x))) 53248.0 (* 4096.0 (the float (-> v1-2 z))) 1.0) (vector-lerp! s5-0 s4-0 s3-0 0.5) - (let* ((s2-0 (math-camera-pos)) - (f0-12 (vector-vector-distance-squared s4-0 s2-0)) - (f1-8 819200.0) - ) - (when (or (< f0-12 (* f1-8 f1-8)) - (let ((f0-13 (vector-vector-distance-squared s3-0 s2-0)) - (f1-11 819200.0) - ) - (< f0-13 (* f1-11 f1-11)) - ) - (let ((f0-14 (vector-vector-distance-squared s5-0 s2-0)) - (f1-14 819200.0) - ) - (< f0-14 (* f1-14 f1-14)) - ) + (let ((s2-0 (math-camera-pos))) + (when (or (< (vector-vector-distance-squared s4-0 s2-0) (square 819200.0)) + (< (vector-vector-distance-squared s3-0 s2-0) (square 819200.0)) + (< (vector-vector-distance-squared s5-0 s2-0) (square 819200.0)) ) (add-debug-line #t (bucket-id debug2) s4-0 s3-0 *color-orange* #f (the-as rgba -1)) (let ((s4-1 add-debug-text-3d) @@ -53,18 +42,16 @@ (set-vector! s5-0 (* 4096.0 (the float (-> this x))) 53248.0 (* 4096.0 (the float (-> this z))) 1.0) (set! (-> s4-0 quad) (-> s5-0 quad)) (set! (-> s4-0 r) 4096.0) - (let ((f0-7 (vector-vector-distance-squared s5-0 (math-camera-pos))) - (f1-4 819200.0) - ) - (when (and (< f0-7 (* f1-4 f1-4)) (sphere-in-view-frustum? s4-0)) - (add-debug-x #t (bucket-id debug2) s5-0 *color-red*) - (let ((s4-1 add-debug-text-3d) - (s3-1 #t) - (s2-1 324) - ) - (format (clear *temp-string*) "~D" arg0) - (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* s5-0 (font-color cyan) (the-as vector2h #f)) - ) + (when (and (< (vector-vector-distance-squared s5-0 (math-camera-pos)) (square 819200.0)) + (sphere-in-view-frustum? s4-0) + ) + (add-debug-x #t (bucket-id debug2) s5-0 *color-red*) + (let ((s4-1 add-debug-text-3d) + (s3-1 #t) + (s2-1 324) + ) + (format (clear *temp-string*) "~D" arg0) + (s4-1 s3-1 (the-as bucket-id s2-1) *temp-string* s5-0 (font-color cyan) (the-as vector2h #f)) ) ) ) @@ -75,7 +62,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod debug-draw-cell ((this trail-graph) (arg0 int)) - (local-vars (sv-80 int) (sv-96 (function _varargs_ object))) (let* ((s5-0 (-> this conn-hash)) (s4-0 (-> s5-0 cell arg0)) (s3-0 (new 'stack-no-clear 'inline-array 'vector 2)) @@ -106,24 +92,10 @@ ) (let ((s1-0 add-debug-text-3d) (s0-0 #t) + (sv-80 324) ) - (set! sv-80 324) - (set! sv-96 format) - (let ((a0-20 (clear *temp-string*)) - (a1-5 "cell ~D (~D,~D)") - (a2-4 arg0) - (a3-4 (logand arg0 15)) - (t0-4 (/ arg0 16)) - ) - (sv-96 a0-20 a1-5 a2-4 a3-4 t0-4) - ) - (let ((a2-5 *temp-string*) - (a3-5 (-> s3-0 3)) - (t0-5 1) - (t1-4 #f) - ) - (s1-0 s0-0 (the-as bucket-id sv-80) a2-5 a3-5 (the-as font-color t0-5) (the-as vector2h t1-4)) - ) + (format (clear *temp-string*) "cell ~D (~D,~D)" arg0 (logand arg0 15) (/ arg0 16)) + (s1-0 s0-0 (the-as bucket-id sv-80) *temp-string* (-> s3-0 3) (font-color white) (the-as vector2h #f)) ) (countdown (s2-1 (-> s4-0 conn-count)) (let ((s1-1 (-> this conn (-> s5-0 conn-ids (+ s2-1 (-> s4-0 first-conn)))))) @@ -146,33 +118,33 @@ ;; INFO: Used lq/sq ;; WARN: new jak 2 until loop case, check carefully (defmethod debug-draw-path ((this trail-graph) (arg0 int) (arg1 (pointer uint16)) (arg2 vector) (arg3 vector) (arg4 rgba) (arg5 float)) - (local-vars (sv-48 int)) (let ((s0-0 (new 'stack-no-clear 'inline-array 'vector 2))) (set-vector! (-> s0-0 1) (+ (-> arg2 x) arg5) 53248.0 (+ (-> arg2 z) arg5) 1.0) - (set! sv-48 0) - (until #f - (set! (-> s0-0 0 quad) (-> s0-0 1 quad)) - (cond - ((< sv-48 arg0) - (let ((a0-7 (-> this node (-> arg1 sv-48)))) - (set-vector! - (-> s0-0 1) - (+ (* 4096.0 (the float (-> a0-7 x))) arg5) - 53248.0 - (+ (* 4096.0 (the float (-> a0-7 z))) arg5) - 1.0 + (let ((sv-48 0)) + (until #f + (set! (-> s0-0 0 quad) (-> s0-0 1 quad)) + (cond + ((< sv-48 arg0) + (let ((a0-7 (-> this node (-> arg1 sv-48)))) + (set-vector! + (-> s0-0 1) + (+ (* 4096.0 (the float (-> a0-7 x))) arg5) + 53248.0 + (+ (* 4096.0 (the float (-> a0-7 z))) arg5) + 1.0 + ) ) ) - ) - ((= sv-48 arg0) - (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) 53248.0 (+ (-> arg3 z) arg5) 1.0) - ) - (else - (return #f) + ((= sv-48 arg0) + (set-vector! (-> s0-0 1) (+ (-> arg3 x) arg5) 53248.0 (+ (-> arg3 z) arg5) 1.0) + ) + (else + (return #f) + ) ) + (add-debug-line #t (bucket-id debug2) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) + (+! sv-48 1) ) - (add-debug-line #t (bucket-id debug2) (-> s0-0 0) (-> s0-0 1) arg4 #f (the-as rgba -1)) - (set! sv-48 (+ sv-48 1)) ) ) #f @@ -707,7 +679,7 @@ (defmethod get-dist-score ((this trail-node) (arg0 vector)) (let* ((f0-1 (- (-> arg0 x) (* 4096.0 (the float (-> this x))))) (f1-3 (- (-> arg0 z) (* 4096.0 (the float (-> this z))))) - (f0-4 (sqrtf (+ (* f0-1 f0-1) (* f1-3 f1-3)))) + (f0-4 (sqrtf (+ (square f0-1) (square f1-3)))) ) (the uint (fmin 65535.0 (* 0.00024414062 (* 8.0 f0-4)))) ) diff --git a/test/decompiler/reference/jak2/levels/city/ctywide-obs_REF.gc b/test/decompiler/reference/jak2/levels/city/ctywide-obs_REF.gc index 0ca970e835..5ff4981bc3 100644 --- a/test/decompiler/reference/jak2/levels/city/ctywide-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/ctywide-obs_REF.gc @@ -213,14 +213,13 @@ (defmethod security-wall-method-24 ((this security-wall)) (let ((s4-0 *target*)) (when s4-0 - (let* ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> s4-0 control trans))) - (f30-0 (+ 40960.0 (-> this root root-prim local-sphere w))) - (f1-1 f30-0) - ) - (when (< f0-0 (* f1-1 f1-1)) + (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> s4-0 control trans))) + (f30-0 (+ 40960.0 (-> this root root-prim local-sphere w))) + ) + (when (< f0-0 (square f30-0)) (let ((s5-0 (new 'stack-no-clear 'inline-array 'vector 1))) (set! (-> s5-0 0 quad) (-> s4-0 control trans quad)) - (when (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) (* f30-0 f30-0)) + (when (< (vector-vector-distance-squared (-> this root trans) (-> this target-pos)) (square f30-0)) (let ((f0-3 (vector4-dot (-> this target-pos) (the-as vector (-> this plane)))) (f1-7 (vector4-dot (-> s5-0 0) (the-as vector (-> this plane)))) ) @@ -497,12 +496,7 @@ (set! (-> v0-8 x) 0.0) (set! (-> v0-8 y) (* 0.00024414062 (/ arg1 2))) (set! (-> v0-8 z) 0.0) - (let ((f0-20 0.5) - (f1-7 (* f30-1 f30-1)) - (f2-2 arg1) - ) - (set! (-> v0-8 w) (* f0-20 (sqrtf (+ f1-7 (* f2-2 f2-2))))) - ) + (set! (-> v0-8 w) (* 0.5 (sqrtf (+ (square f30-1) (square arg1))))) v0-8 ) ) @@ -1512,11 +1506,9 @@ (let ((gp-2 (handle->process (-> self focus handle)))) (when (and gp-2 (and *traffic-engine* - (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-2) 0) (-> self root trans))) - (f1-0 409600.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-2) 0) (-> self root trans)) + (square 409600.0) + ) (not (-> self destroyed)) ) ) @@ -1824,7 +1816,6 @@ ;; definition for method 35 of type cty-guard-turret ;; INFO: Used lq/sq (defmethod cty-guard-turret-method-35 ((this cty-guard-turret)) - (local-vars (sv-192 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1871,69 +1862,67 @@ ) (let ((s3-1 (vector-! (new 'stack-no-clear 'vector) s4-0 s0-0)) (s1-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (sv-192 (new 'stack-no-clear 'vector)) + (s2-0 (new 'stack-no-clear 'vector)) ) - (set! sv-192 (new 'stack-no-clear 'vector)) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (-> this node-list data 6 bone transform) - (-> this node-list data 7 bone transform) - (-> this node-list data 8 bone transform) - (vector-rotate90-around-y! sv-192 s3-1) - (set! (-> sv-192 y) 0.0) - (vector-normalize! sv-192 1.0) - (let* ((f26-0 (vector-vector-xz-distance-squared s0-0 s4-0)) - (f0-4 7389.184) - (f28-0 (* f0-4 f0-4)) - (t9-6 vector-vector-xz-distance-squared) - (a0-13 (new 'stack-no-clear 'vector)) - ) - (let ((v1-27 7389.184)) - (.mov vf7 v1-27) + (-> this node-list data 6 bone transform) + (-> this node-list data 7 bone transform) + (-> this node-list data 8 bone transform) + (vector-rotate90-around-y! sv-192 s3-1) + (set! (-> sv-192 y) 0.0) + (vector-normalize! sv-192 1.0) + (let ((f26-0 (vector-vector-xz-distance-squared s0-0 s4-0)) + (f28-0 (square 7389.184)) + (t9-6 vector-vector-xz-distance-squared) + (a0-13 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> sv-192 quad)) - (.lvf vf4 (&-> s0-0 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-13 quad) vf6) - (let* ((f2-0 (t9-6 a0-13 s4-0)) - (f28-1 (acos (fmax -1.0 (fmin 1.0 (/ (- (- f26-0 f28-0) f2-0) (* -2.0 (sqrtf f2-0) (sqrtf f28-0))))))) - ) - (let ((s0-1 (new 'stack-no-clear 'vector)) - (s4-1 (new 'stack-no-clear 'vector)) - ) - (if (< f28-1 11832.889) - (set! f28-1 11832.889) - ) - (rot-zxy-from-vector! s0-1 s1-0) - (rot-zxy-from-vector! s2-0 s3-1) - (set! (-> s4-1 x) (deg- (-> s2-0 x) (-> s0-1 x))) - (set! (-> s4-1 y) (deg- (-> s2-0 y) (-> s0-1 y))) - (cond - ((focus-test? (the-as process-focusable s5-0) pilot) - (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 36408.89 (seconds-per-frame)))) - (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) - ) - (else - (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 18204.445 (seconds-per-frame)))) - (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) - ) + (let ((v1-27 7389.184)) + (.mov vf7 v1-27) + ) + (.lvf vf5 (&-> sv-192 quad)) + (.lvf vf4 (&-> s0-0 quad)) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-13 quad) vf6) + (let* ((f2-0 (t9-6 a0-13 s4-0)) + (f28-1 (acos (fmax -1.0 (fmin 1.0 (/ (- (- f26-0 f28-0) f2-0) (* -2.0 (sqrtf f2-0) (sqrtf f28-0))))))) + ) + (let ((s0-1 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack-no-clear 'vector)) ) - (quaternion-axis-angle! (-> this jm-turret quat) 0.0 1.0 0.0 (-> this angle-turret)) - (when (= (+ (fabs (- (-> this angle-turret) (-> s4-1 y))) (fabs (- (-> this angle-guns) (-> s4-1 x)))) 0.0) - (set! (-> this next-time-shot) (+ (current-time) (seconds 1))) - (set! (-> this num-shots) (the-as uint 0)) - 0 + (if (< f28-1 11832.889) + (set! f28-1 11832.889) + ) + (rot-zxy-from-vector! s0-1 s1-0) + (rot-zxy-from-vector! s2-0 s3-1) + (set! (-> s4-1 x) (deg- (-> s2-0 x) (-> s0-1 x))) + (set! (-> s4-1 y) (deg- (-> s2-0 y) (-> s0-1 y))) + (cond + ((focus-test? (the-as process-focusable s5-0) pilot) + (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 36408.89 (seconds-per-frame)))) + (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) + ) + (else + (set! (-> this angle-turret) (deg-seek (-> this angle-turret) (-> s4-1 y) (* 18204.445 (seconds-per-frame)))) + (set! (-> this angle-guns) (deg-seek (-> this angle-guns) (-> s4-1 x) (* 7281.778 (seconds-per-frame)))) ) ) - (let ((s5-1 (new 'stack-no-clear 'quaternion))) - (let ((f0-42 (/ 45511.11 (/ f30-0 METER_LENGTH)))) - (quaternion-axis-angle! s5-1 1.0 0.0 0.0 (fmax (fmin (-> this angle-guns) f0-42) (- f0-42))) - ) - (quaternion*! - (-> this jm-gunsL quat) - (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (+ -16384.0 f28-1)) - s5-1 - ) + (quaternion-axis-angle! (-> this jm-turret quat) 0.0 1.0 0.0 (-> this angle-turret)) + (when (= (+ (fabs (- (-> this angle-turret) (-> s4-1 y))) (fabs (- (-> this angle-guns) (-> s4-1 x)))) 0.0) + (set! (-> this next-time-shot) (+ (current-time) (seconds 1))) + (set! (-> this num-shots) (the-as uint 0)) + 0 + ) + ) + (let ((s5-1 (new 'stack-no-clear 'quaternion))) + (let ((f0-42 (/ 45511.11 (/ f30-0 METER_LENGTH)))) + (quaternion-axis-angle! s5-1 1.0 0.0 0.0 (fmax (fmin (-> this angle-guns) f0-42) (- f0-42))) + ) + (quaternion*! + (-> this jm-gunsL quat) + (quaternion-axis-angle! (new 'stack-no-clear 'quaternion) 0.0 1.0 0.0 (+ -16384.0 f28-1)) + s5-1 ) ) ) @@ -1989,11 +1978,9 @@ (let ((gp-0 (handle->process (-> self focus handle)))) (cond ((and gp-0 - (let ((f0-5 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-0) 0) (-> self root trans))) - (f1-0 491520.0) - ) - (< f0-5 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable gp-0) 0) (-> self root trans)) + (square 491520.0) + ) ) (cond ((and (>= (-> self id) 0) (task-node-open? (game-task-node city-power-resolution))) @@ -2294,9 +2281,9 @@ (cond ((or (focus-test? (the-as vehicle s5-0) dead inactive) (not (logtest? (-> (the-as vehicle s5-0) flags) (rigid-body-object-flag waiting-for-player))) - (let ((f0-0 (-> this test-sphere r))) - (< (* f0-0 f0-0) (vector-vector-distance-squared (-> (the-as vehicle s5-0) root trans) (-> this test-sphere))) - ) + (< (square (-> this test-sphere r)) + (vector-vector-distance-squared (-> (the-as vehicle s5-0) root trans) (-> this test-sphere)) + ) ) (logclear! (-> (the-as vehicle s5-0) flags) (rigid-body-object-flag persistent)) (set! (-> this vehicle) (the-as handle #f)) @@ -2409,17 +2396,13 @@ (set-time! (-> self state-time)) (parking-spot-method-21 self) (when (not (-> self spawned)) - (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere))) - (f1-0 327680.0) - ) - (when (< (* f1-0 f1-0) f0-0) - (let ((f1-3 614400.0)) - (when (or (< (* f1-3 f1-3) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) - (let ((a1-1 (get-random-parking-spot-type *traffic-engine*))) - (if (!= a1-1 (traffic-type traffic-type-21)) - (parking-spot-method-23 self (the-as uint a1-1)) - ) - ) + (let ((f0-0 (vector-vector-distance-squared (camera-pos) (-> self test-sphere)))) + (when (< (square 327680.0) f0-0) + (when (or (< (square 614400.0) f0-0) (not (sphere-in-view-frustum? (-> self test-sphere)))) + (let ((a1-1 (get-random-parking-spot-type *traffic-engine*))) + (if (!= a1-1 (traffic-type traffic-type-21)) + (parking-spot-method-23 self (the-as uint a1-1)) + ) ) ) ) @@ -3178,7 +3161,6 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (local-vars (sv-272 vector) (sv-288 quaternion)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3190,19 +3172,16 @@ (when (!= (-> self time) -1.0) (let ((gp-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) - (let ((s5-0 gp-0) - (s4-0 (-> self root trans)) - (s3-0 vector-orient-by-quat!) - (s2-0 (new 'stack-no-clear 'vector)) - (s1-0 (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0)) - (s0-0 quaternion-rotate-local-y!) - ) - (set! sv-272 (new 'stack-no-clear 'vector)) - (set! sv-288 (-> self root quat)) - (let ((a2-0 (* 182.04445 (* 30.0 (sin (* 7281.778 (-> self time))))))) - (vector+! s5-0 s4-0 (s3-0 s2-0 s1-0 (s0-0 (the-as quaternion sv-272) sv-288 a2-0))) - ) - ) + (vector+! gp-0 (-> self root trans) (vector-orient-by-quat! + (new 'stack-no-clear 'vector) + (new 'static 'vector :y 16384.0 :z 40960.0 :w 1.0) + (quaternion-rotate-local-y! + (the-as quaternion (new 'stack-no-clear 'vector)) + (-> self root quat) + (* 182.04445 (* 30.0 (sin (* 7281.778 (-> self time))))) + ) + ) + ) (set! (-> *camera* slave 0 trans quad) (-> gp-0 quad)) (let ((t9-3 forward-down->inv-matrix) (a0-5 (-> *camera* slave 0 tracking)) @@ -3358,31 +3337,6 @@ (remove-setting! 'mode-name) ) :trans (behavior () - (local-vars - (sv-352 (function _varargs_ object)) - (sv-368 string) - (sv-384 (function string font-context symbol int bucket-id float)) - (sv-400 (function _varargs_ object)) - (sv-416 string) - (sv-432 (function string font-context symbol int bucket-id float)) - (sv-448 (function _varargs_ object)) - (sv-464 string) - (sv-480 (function string font-context symbol int bucket-id float)) - (sv-496 (function _varargs_ object)) - (sv-512 string) - (sv-528 (function string font-context symbol int bucket-id float)) - (sv-544 (function _varargs_ object)) - (sv-560 string) - (sv-576 (function string font-context symbol int bucket-id float)) - (sv-592 (function _varargs_ object)) - (sv-608 string) - (sv-624 (function string font-context symbol int bucket-id float)) - (sv-640 (function _varargs_ object)) - (sv-656 string) - (sv-672 (function string font-context symbol int bucket-id float)) - (sv-688 (function _varargs_ object)) - (sv-704 string) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3524,11 +3478,7 @@ (set! (-> a0-60 color) (font-color progress-old-yellow)) ) (let ((s0-0 print-game-text)) - (set! sv-352 format) - (set! sv-368 (clear *temp-string*)) - (let ((a1-5 (lookup-text! *common-text* (text-id select-event) #f))) - (sv-352 sv-368 a1-5) - ) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id select-event) #f)) (s0-0 *temp-string* s1-0 #f 44 (bucket-id progress)) ) (set-height! s1-0 s4-9) @@ -3549,115 +3499,45 @@ (let ((v1-59 s0-1)) (cond ((zero? v1-59) - (set! sv-384 print-game-text) - (set! sv-400 format) - (set! sv-416 (clear *temp-string*)) - (let ((a1-9 (lookup-text! *common-text* (text-id board-name) #f))) - (sv-400 sv-416 a1-9) - ) - (let ((a0-73 *temp-string*) - (a1-10 s1-0) - (a2-6 #f) - (a3-4 44) - (t0-4 320) - ) - (sv-384 a0-73 a1-10 a2-6 a3-4 (the-as bucket-id t0-4)) + (let ((sv-384 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id board-name) #f)) + (sv-384 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 1) - (set! sv-432 print-game-text) - (set! sv-448 format) - (set! sv-464 (clear *temp-string*)) - (let ((a1-12 (lookup-text! *common-text* (text-id race-class3) #f))) - (sv-448 sv-464 a1-12) - ) - (let ((a0-79 *temp-string*) - (a1-13 s1-0) - (a2-8 #f) - (a3-5 44) - (t0-5 320) - ) - (sv-432 a0-79 a1-13 a2-8 a3-5 (the-as bucket-id t0-5)) + (let ((sv-432 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id race-class3) #f)) + (sv-432 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 2) - (set! sv-480 print-game-text) - (set! sv-496 format) - (set! sv-512 (clear *temp-string*)) - (let ((a1-15 (lookup-text! *common-text* (text-id race-class2) #f))) - (sv-496 sv-512 a1-15) - ) - (let ((a0-85 *temp-string*) - (a1-16 s1-0) - (a2-10 #f) - (a3-6 44) - (t0-6 320) - ) - (sv-480 a0-85 a1-16 a2-10 a3-6 (the-as bucket-id t0-6)) + (let ((sv-480 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id race-class2) #f)) + (sv-480 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 3) - (set! sv-528 print-game-text) - (set! sv-544 format) - (set! sv-560 (clear *temp-string*)) - (let ((a1-18 (lookup-text! *common-text* (text-id race-class1) #f))) - (sv-544 sv-560 a1-18) - ) - (let ((a0-91 *temp-string*) - (a1-19 s1-0) - (a2-12 #f) - (a3-7 44) - (t0-7 320) - ) - (sv-528 a0-91 a1-19 a2-12 a3-7 (the-as bucket-id t0-7)) + (let ((sv-528 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id race-class1) #f)) + (sv-528 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 4) - (set! sv-576 print-game-text) - (set! sv-592 format) - (set! sv-608 (clear *temp-string*)) - (let ((a1-21 (lookup-text! *common-text* (text-id reverse-race-class3) #f))) - (sv-592 sv-608 a1-21) - ) - (let ((a0-97 *temp-string*) - (a1-22 s1-0) - (a2-14 #f) - (a3-8 44) - (t0-8 320) - ) - (sv-576 a0-97 a1-22 a2-14 a3-8 (the-as bucket-id t0-8)) + (let ((sv-576 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id reverse-race-class3) #f)) + (sv-576 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 5) - (set! sv-624 print-game-text) - (set! sv-640 format) - (set! sv-656 (clear *temp-string*)) - (let ((a1-24 (lookup-text! *common-text* (text-id reverse-race-class2) #f))) - (sv-640 sv-656 a1-24) - ) - (let ((a0-103 *temp-string*) - (a1-25 s1-0) - (a2-16 #f) - (a3-9 44) - (t0-9 320) - ) - (sv-624 a0-103 a1-25 a2-16 a3-9 (the-as bucket-id t0-9)) + (let ((sv-624 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id reverse-race-class2) #f)) + (sv-624 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ((= v1-59 6) - (set! sv-672 print-game-text) - (set! sv-688 format) - (set! sv-704 (clear *temp-string*)) - (let ((a1-27 (lookup-text! *common-text* (text-id reverse-race-class1) #f))) - (sv-688 sv-704 a1-27) - ) - (let ((a0-108 *temp-string*) - (a1-28 s1-0) - (a2-18 #f) - (a3-10 44) - (t0-10 320) - ) - (sv-672 a0-108 a1-28 a2-18 a3-10 (the-as bucket-id t0-10)) + (let ((sv-672 print-game-text)) + (format (clear *temp-string*) (lookup-text! *common-text* (text-id reverse-race-class1) #f)) + (sv-672 *temp-string* s1-0 #f 44 (bucket-id progress)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/ctywide-part_REF.gc b/test/decompiler/reference/jak2/levels/city/ctywide-part_REF.gc index f12c13320e..d22bd5c009 100644 --- a/test/decompiler/reference/jak2/levels/city/ctywide-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/ctywide-part_REF.gc @@ -331,7 +331,7 @@ (set! (-> s4-0 x) f0-0) (set! (-> s4-0 y) f1-0) (set! (-> s4-0 z) f2-0) - (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))) + (set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-0)) (square f0-0)))) ) (quaternion-rotate-y! s4-0 s4-0 (+ 8192.0 (-> s5-0 sprite flag-rot-sy z))) (let ((v1-5 arg2)) diff --git a/test/decompiler/reference/jak2/levels/city/ctywide-tasks_REF.gc b/test/decompiler/reference/jak2/levels/city/ctywide-tasks_REF.gc index cb32053b68..d8f642cedd 100644 --- a/test/decompiler/reference/jak2/levels/city/ctywide-tasks_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/ctywide-tasks_REF.gc @@ -429,10 +429,8 @@ (lambda :behavior task-manager () (check-time self) - (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos))) - (f1-0 49152.0) - ) - (if (>= (* f1-0 f1-0) f0-0) + (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos)))) + (if (>= (square 49152.0) f0-0) (go-virtual complete) ) ) @@ -451,9 +449,7 @@ (send-event *traffic-manager* 'set-target-level 1.0) (until (or v1-7 (and *target* (focus-test? *target* pilot))) (suspend) - (let ((f0-0 122880.0)) - (set! v1-7 (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) - ) + (set! v1-7 (< (square 122880.0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)))) ) (set-setting! 'airlock #f 0.0 0) (set-time! (-> self start-time)) @@ -812,10 +808,8 @@ (lambda :behavior task-manager () (check-time self) - (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos))) - (f1-0 49152.0) - ) - (if (>= (* f1-0 f1-0) f0-0) + (let ((f0-0 (vector-vector-distance-squared (target-pos 0) (-> self end-pos)))) + (if (>= (square 49152.0) f0-0) (go-virtual complete) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc index 14cae7af5f..4633ec188c 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc-states_REF.gc @@ -384,7 +384,6 @@ (check-vehicle-exit self) ) :code (behavior () - (local-vars (sv-128 float)) (ja-channel-push! 1 (seconds 0.1)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (ja-no-eval :group! crocadog-escort-jump-in-vehicle-ja @@ -408,27 +407,18 @@ (compute-seat-position (the-as vehicle s3-1) (-> gp-0 vector 0) (-> self vehicle-seat-index)) ) (vector-! (-> gp-0 vector 1) (-> gp-0 vector 0) s5-2) - (let ((s3-2 lerp-scale) - (s2-0 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-128 (ja-aframe 1.0 0)) - (let* ((t0-0 (ja-aframe 4.0 0)) - (f30-0 (s3-2 s2-0 s1-0 s0-0 sv-128 t0-0)) - ) - (quaternion-rotate-local-y! - (the-as quaternion (-> gp-0 vector 2)) - (the-as quaternion (-> gp-0 vector 2)) - (* f30-0 (if (zero? (-> self vehicle-seat-index)) - -16384.0 - 16384.0 - ) - ) - ) - (quaternion-slerp! (-> self root quat) s4-0 (the-as quaternion (-> gp-0 vector 2)) f30-0) - (vector+float*! (-> self root trans) s5-2 (-> gp-0 vector 1) f30-0) + (let ((f30-0 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 4.0 0)))) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 2)) + (the-as quaternion (-> gp-0 vector 2)) + (* f30-0 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) ) + (quaternion-slerp! (-> self root quat) s4-0 (the-as quaternion (-> gp-0 vector 2)) f30-0) + (vector+float*! (-> self root trans) s5-2 (-> gp-0 vector 1) f30-0) ) (suspend) (ja :num! (seek! (ja-aframe 5.0 0) 0.5)) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc index 9a783c6804..7e1f86c682 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/crocesc_REF.gc @@ -261,11 +261,9 @@ (let ((s3-2 (new 'stack-no-clear 'vector))) (do-navigation-to-destination (-> this nav state) (-> this root trans)) (when (cloest-point-on-mesh (-> this nav) s3-2 s4-0 (the-as nav-poly #f)) - (let ((f0-4 2048.0)) - (when (>= (* f0-4 f0-4) (vector-vector-xz-distance-squared s3-2 s4-0)) - (set! (-> arg0 quad) (-> s3-2 quad)) - #t - ) + (when (>= (square 2048.0) (vector-vector-xz-distance-squared s3-2 s4-0)) + (set! (-> arg0 quad) (-> s3-2 quad)) + #t ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc index e717dd2e3a..ec3bcd7a57 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/hal4-course_REF.gc @@ -214,15 +214,13 @@ ) ) ) - (when (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) - (let ((f0-0 245760.0)) - (and (< (* f0-0 f0-0) + (if (not (focus-test? (the-as process-focusable a0-5) pilot-riding pilot)) + (and (< (square 245760.0) (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-5) 0) (get-trans s5-0 0)) ) (>= (current-time) (-> this dont-fail-until)) ) ) - ) ) ) ) @@ -244,13 +242,11 @@ symbol (and a0-1 (and s5-1 - (let ((f0-0 409600.0)) - (and (< (* f0-0 f0-0) - (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (get-trans s5-1 0)) - ) - (>= (current-time) (-> this dont-fail-until)) - ) - ) + (and (< (square 409600.0) + (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (get-trans s5-1 0)) + ) + (>= (current-time) (-> this dont-fail-until)) + ) ) ) ) @@ -501,14 +497,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-2 (+ (-> a1-4 world-sphere w) (-> gp-0 vector 1 w))) - ) - (when (< f0-2 (* f1-2 f1-2)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-5)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-4 world-sphere w) (-> gp-0 vector 1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-5)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -542,14 +534,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-6 (+ (-> a1-16 world-sphere w) (-> gp-0 vector 1 w))) - ) - (when (< f0-3 (* f1-6 f1-6)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-16 world-sphere w) (-> gp-0 vector 1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc index f28da3256d..96940ce283 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc @@ -317,7 +317,6 @@ (check-vehicle-exit self) ) :code (behavior () - (local-vars (sv-112 float)) (ja-channel-push! 1 (seconds 0.1)) (let ((gp-0 (new 'stack-no-clear 'matrix))) (quaternion-copy! (the-as quaternion (-> gp-0 vector)) (-> self root quat)) @@ -353,32 +352,23 @@ (let ((s4-2 (handle->process (-> self vehicle-handle)))) (compute-seat-position (the-as vehicle s4-2) (-> gp-0 vector 2) (-> self vehicle-seat-index)) (vector-! (-> gp-0 trans) (-> gp-0 vector 2) s5-3) - (let ((s3-1 lerp-scale) - (s2-1 0.0) - (s1-1 1.0) - (s0-1 (ja-aframe-num 0)) - ) - (set! sv-112 (ja-aframe 1.0 0)) - (let* ((t0-1 (ja-aframe 8.0 0)) - (f30-1 (s3-1 s2-1 s1-1 s0-1 sv-112 t0-1)) - ) - (quaternion-rotate-local-y! - (the-as quaternion (-> gp-0 vector 1)) - (-> (the-as vehicle s4-2) root quat) - (* f30-1 (if (zero? (-> self vehicle-seat-index)) - -16384.0 - 16384.0 - ) - ) - ) - (quaternion-slerp! - (-> self root quat) - (the-as quaternion (-> gp-0 vector)) - (the-as quaternion (-> gp-0 vector 1)) - f30-1 - ) - (vector+float*! (-> self root trans) s5-3 (-> gp-0 trans) f30-1) + (let ((f30-1 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 8.0 0)))) + (quaternion-rotate-local-y! + (the-as quaternion (-> gp-0 vector 1)) + (-> (the-as vehicle s4-2) root quat) + (* f30-1 (if (zero? (-> self vehicle-seat-index)) + -16384.0 + 16384.0 + ) + ) ) + (quaternion-slerp! + (-> self root quat) + (the-as quaternion (-> gp-0 vector)) + (the-as quaternion (-> gp-0 vector 1)) + f30-1 + ) + (vector+float*! (-> self root trans) s5-3 (-> gp-0 trans) f30-1) ) ) (suspend) @@ -553,7 +543,6 @@ (check-vehicle-exit self) ) :code (behavior () - (local-vars (sv-80 float) (sv-96 float)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! kid-escort-jump-in-vehicle-ja :num! (seek! (ja-aframe 8.0 0) 0.25) @@ -604,17 +593,8 @@ (quaternion-identity! s4-3) (quaternion-rotate-y! s4-3 s4-3 f30-0) ) - (let ((s3-1 lerp-scale) - (s2-1 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-80 (ja-aframe 8.0 0)) - (let* ((t0-1 (ja-aframe 1.0 0)) - (f0-11 (s3-1 s2-1 s1-0 s0-0 sv-80 t0-1)) - ) - (quaternion-slerp! s4-3 s5-1 s4-3 f0-11) - ) + (let ((f0-11 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 8.0 0) (ja-aframe 1.0 0)))) + (quaternion-slerp! s4-3 s5-1 s4-3 f0-11) ) ) (want-exit-vehicle? self (-> self exit-vehicle-dest)) @@ -637,17 +617,8 @@ (new 'stack-no-clear 'vector) (let ((s4-4 (new 'stack-no-clear 'vector))) (vector-! s4-4 gp-4 (-> self exit-vehicle-dest)) - (let ((s3-2 lerp-scale) - (s2-2 0.0) - (s1-1 1.0) - (s0-1 (ja-aframe-num 0)) - ) - (set! sv-96 (ja-aframe 1.0 0)) - (let* ((t0-2 (ja-aframe 8.0 0)) - (f0-15 (s3-2 s2-2 s1-1 s0-1 sv-96 t0-2)) - ) - (vector+float*! (-> self root trans) (-> self exit-vehicle-dest) s4-4 f0-15) - ) + (let ((f0-15 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 8.0 0)))) + (vector+float*! (-> self root trans) (-> self exit-vehicle-dest) s4-4 f0-15) ) ) (suspend) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc index 0f386dbf12..5162e45455 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc_REF.gc @@ -672,11 +672,9 @@ (let ((s3-2 (new 'stack-no-clear 'vector))) (do-navigation-to-destination (-> this nav state) (-> this root trans)) (when (cloest-point-on-mesh (-> this nav) s3-2 s4-0 (the-as nav-poly #f)) - (let ((f0-4 2048.0)) - (when (>= (* f0-4 f0-4) (vector-vector-xz-distance-squared s3-2 s4-0)) - (set! (-> arg0 quad) (-> s3-2 quad)) - #t - ) + (when (>= (square 2048.0) (vector-vector-xz-distance-squared s3-2 s4-0)) + (set! (-> arg0 quad) (-> s3-2 quad)) + #t ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc b/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc index 88b435adca..f347ee0efb 100644 --- a/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/meet-brutter/meet-brutter_REF.gc @@ -953,7 +953,6 @@ (defstate board-vehicle (city-lurker) :virtual #t :code (behavior () - (local-vars (sv-128 float) (sv-144 float) (sv-160 float)) (let ((gp-0 0)) (case (-> (the-as vehicle (handle->process (-> self vehicle))) info object-type) ((11 12 13) @@ -993,18 +992,9 @@ (quaternion-copy! s2-0 (-> (the-as vehicle s1-0) root quat)) (compute-seat-position (the-as vehicle s1-0) s0-0 (-> self seat)) (vector-! s3-1 s0-0 s5-2) - (let ((s1-1 lerp-scale) - (s0-1 0.0) - ) - (set! sv-128 (the-as float 1.0)) - (set! sv-144 (ja-aframe-num 0)) - (set! sv-160 (ja-aframe 2.0 0)) - (let* ((t0-1 (ja-aframe 8.0 0)) - (f30-1 (s1-1 s0-1 sv-128 sv-144 sv-160 t0-1)) - ) - (quaternion-slerp! (-> self root quat) s4-0 s2-0 f30-1) - (vector+float*! (-> self root trans) s5-2 s3-1 f30-1) - ) + (let ((f30-1 (lerp-scale 0.0 (the-as float 1.0) (ja-aframe-num 0) (ja-aframe 2.0 0) (ja-aframe 8.0 0)))) + (quaternion-slerp! (-> self root quat) s4-0 s2-0 f30-1) + (vector+float*! (-> self root trans) s5-2 s3-1 f30-1) ) ) (suspend) @@ -1276,7 +1266,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float)) (let ((gp-0 0)) (case (-> (the-as vehicle (handle->process (-> self vehicle))) info object-type) ((11 12 13) @@ -1331,19 +1320,11 @@ (quaternion-copy! s4-2 (-> (the-as vehicle s3-1) root quat)) (compute-seat-position (the-as vehicle s3-1) s2-0 (-> self seat)) (vector-! gp-1 s2-0 s5-3) - (let ((s3-2 lerp-scale) - (s2-1 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-128 (ja-aframe 8.0 0)) - (let* ((t0-0 (ja-aframe 2.0 0)) - (f0-9 (s3-2 s2-1 s1-0 s0-0 sv-128 t0-0)) - (f30-0 (- 1.0 f0-9)) - ) - (quaternion-copy! (-> self root quat) s4-2) - (vector+float*! (-> self root trans) s5-3 gp-1 f30-0) - ) + (let* ((f0-9 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 8.0 0) (ja-aframe 2.0 0))) + (f30-0 (- 1.0 f0-9)) + ) + (quaternion-copy! (-> self root quat) s4-2) + (vector+float*! (-> self root trans) s5-3 gp-1 f30-0) ) ) (suspend) @@ -2589,24 +2570,17 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-163 vf1) - (let ((f0-2 v1-163) - (f1-0 32768.0) - ) - (when (and (< f0-2 (* f1-0 f1-0)) - (let ((f0-3 (vector-vector-distance-squared - (-> (the-as vehicle s3-3) root trans) - (-> (the-as city-lurker s4-2) root trans) - ) - ) - (f1-3 65536.0) - ) - (< f0-3 (* f1-3 f1-3)) - ) - (not gp-2) - ) - (set! gp-2 #t) - (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) - ) + (when (and (< v1-163 (square 32768.0)) + (< (vector-vector-distance-squared + (-> (the-as vehicle s3-3) root trans) + (-> (the-as city-lurker s4-2) root trans) + ) + (square 65536.0) + ) + (not gp-2) + ) + (set! gp-2 #t) + (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) ) ) ) @@ -2627,11 +2601,7 @@ (cond ((focus-test? (the-as city-lurker s4-2) pilot) (when (and s2-1 - (let ((f0-4 (vector-vector-distance-squared s3-4 (-> (the-as vehicle s2-1) root trans))) - (f1-6 114688.0) - ) - (< f0-4 (* f1-6 f1-6)) - ) + (< (vector-vector-distance-squared s3-4 (-> (the-as vehicle s2-1) root trans)) (square 114688.0)) (begin (.lvf vf1 (&-> (-> (the-as vehicle s2-1) root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -2640,11 +2610,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-205 vf1) - (let ((f0-5 v1-205) - (f1-9 421888.0) - ) - (< f0-5 (* f1-9 f1-9)) - ) + (< v1-205 (square 421888.0)) ) ) (set! (-> (the-as city-lurker s4-2) task-done?) #t) @@ -3172,24 +3138,17 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-178 vf1) - (let ((f0-2 v1-178) - (f1-0 32768.0) - ) - (when (and (< f0-2 (* f1-0 f1-0)) - (let ((f0-3 (vector-vector-distance-squared - (-> (the-as vehicle s3-3) root trans) - (-> (the-as city-lurker s4-2) root trans) - ) - ) - (f1-3 65536.0) - ) - (< f0-3 (* f1-3 f1-3)) - ) - (not gp-2) - ) - (set! gp-2 #t) - (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) - ) + (when (and (< v1-178 (square 32768.0)) + (< (vector-vector-distance-squared + (-> (the-as vehicle s3-3) root trans) + (-> (the-as city-lurker s4-2) root trans) + ) + (square 65536.0) + ) + (not gp-2) + ) + (set! gp-2 #t) + (send-event (the-as city-lurker s4-2) 'board-vehicle (the-as vehicle s3-3)) ) ) ) @@ -3225,11 +3184,7 @@ (cond ((focus-test? (the-as city-lurker s4-2) pilot) (when (and s2-2 - (let ((f0-5 (vector-vector-distance-squared s3-5 (-> (the-as vehicle s2-2) root trans))) - (f1-6 114688.0) - ) - (< f0-5 (* f1-6 f1-6)) - ) + (< (vector-vector-distance-squared s3-5 (-> (the-as vehicle s2-2) root trans)) (square 114688.0)) (begin (.lvf vf1 (&-> (-> (the-as vehicle s2-2) root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -3238,11 +3193,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-231 vf1) - (let ((f0-6 v1-231) - (f1-9 40960.0) - ) - (< f0-6 (* f1-9 f1-9)) - ) + (< v1-231 (square 40960.0)) ) ) (set! (-> (the-as city-lurker s4-2) task-done?) #t) diff --git a/test/decompiler/reference/jak2/levels/city/onintent/onin-game_REF.gc b/test/decompiler/reference/jak2/levels/city/onintent/onin-game_REF.gc index a03421db66..4b7b1ea1b5 100644 --- a/test/decompiler/reference/jak2/levels/city/onintent/onin-game_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/onintent/onin-game_REF.gc @@ -2228,15 +2228,7 @@ ;; ERROR: Stack slot load at 112 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod onin-game-method-25 ((this onin-game)) - (local-vars - (v0-18 int) - (sv-32 process) - (sv-48 (function vector int meters float float none :behavior onin-game-bubble)) - (sv-64 vector) - (sv-80 int) - (sv-96 meters) - (sv-112 float) - ) + (local-vars (v0-18 int)) (when (time-elapsed? (-> this game-start-time) (seconds 2)) (let ((s5-0 (-> this game (-> this wave)))) (when (time-elapsed? (the-as int (-> this wave-length)) (-> this wave-time)) @@ -2333,37 +2325,15 @@ ) (set! (-> this last-angle) f0-0) ) - (let ((s1-0 (get-process *default-dead-pool* onin-game-bubble #x4000))) - (when s1-0 - (let ((t9-31 (method-of-type onin-game-bubble activate))) - (t9-31 - (the-as onin-game-bubble s1-0) - this - (symbol->string (-> onin-game-bubble symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s0-0 run-function-in-process)) - (set! sv-32 s1-0) - (set! sv-48 onin-game-bubble-init) - (set! sv-64 s4-14) - (set! sv-80 (rand-vu-int-range 0 3)) - (set! sv-96 (-> s5-0 gravity)) - (set! sv-112 (-> this last-angle)) - (let ((t2-0 (rand-vu-float-range 4096.0 7372.8))) - ((the-as (function object object object object object object object none) s0-0) - sv-32 - sv-48 - sv-64 - sv-80 - sv-96 - sv-112 - t2-0 - ) - ) - ) - (-> s1-0 ppointer) - ) + (process-spawn + onin-game-bubble + :init onin-game-bubble-init + s4-14 + (rand-vu-int-range 0 3) + (-> s5-0 gravity) + (-> this last-angle) + (rand-vu-float-range 4096.0 7372.8) + :to this ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/package/delivery-task_REF.gc b/test/decompiler/reference/jak2/levels/city/package/delivery-task_REF.gc index cc340a69be..1ccceca0d8 100644 --- a/test/decompiler/reference/jak2/levels/city/package/delivery-task_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/package/delivery-task_REF.gc @@ -401,49 +401,49 @@ ) ) ) - (let ((f0-0 (vector-vector-distance-squared (-> (the-as process-drawable gp-0) root trans) (target-pos 0))) - (f1-0 12288.0) - ) - (cond - ((and (< f0-0 (* f1-0 f1-0)) *target* (focus-test? *target* pilot)) - (when (nonzero? (-> self sub-state)) - (send-event (handle->process (-> self arrow)) 'set-position (-> self end-pos)) - (send-event (handle->process (-> self arrow)) 'modify-flags 1 0) - (send-event (handle->process (-> self arrow)) 'map-icon 8) - (set! (-> self sub-state) (the-as uint 0)) - 0 - ) + (cond + ((and (< (vector-vector-distance-squared (-> (the-as process-drawable gp-0) root trans) (target-pos 0)) + (square 12288.0) + ) + *target* + (focus-test? *target* pilot) + ) + (when (nonzero? (-> self sub-state)) + (send-event (handle->process (-> self arrow)) 'set-position (-> self end-pos)) + (send-event (handle->process (-> self arrow)) 'modify-flags 1 0) + (send-event (handle->process (-> self arrow)) 'map-icon 8) + (set! (-> self sub-state) (the-as uint 0)) + 0 ) - (else - (let* ((v1-59 (new 'stack-no-clear 'inline-array 'vector 1)) - (f0-1 409.6) - (f0-3 (* f0-1 f0-1)) - ) - (.lvf vf1 (&-> (-> (the-as process-drawable gp-0) root transv) quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov a0-32 vf1) - (when (>= f0-3 a0-32) - (set! (-> v1-59 0 quad) (-> (the-as process-drawable gp-0) root trans quad)) - (+! (-> v1-59 0 y) -14336.0) - (send-event (handle->process (-> self arrow)) 'set-position (-> v1-59 0)) + ) + (else + (let ((v1-59 (new 'stack-no-clear 'inline-array 'vector 1)) + (f0-3 (square 409.6)) ) + (.lvf vf1 (&-> (-> (the-as process-drawable gp-0) root transv) quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov a0-32 vf1) + (when (>= f0-3 a0-32) + (set! (-> v1-59 0 quad) (-> (the-as process-drawable gp-0) root trans quad)) + (+! (-> v1-59 0 y) -14336.0) + (send-event (handle->process (-> self arrow)) 'set-position (-> v1-59 0)) ) - (when (!= (-> self sub-state) 1) - (send-event (handle->process (-> self arrow)) 'modify-flags 0 1) - (send-event (handle->process (-> self arrow)) 'map-icon 15) - (set! (-> self sub-state) (the-as uint 1)) - ) + ) + (when (!= (-> self sub-state) 1) + (send-event (handle->process (-> self arrow)) 'modify-flags 0 1) + (send-event (handle->process (-> self arrow)) 'map-icon 15) + (set! (-> self sub-state) (the-as uint 1)) ) ) ) (let ((f30-0 49152.0) (f0-6 (vector-vector-distance-squared (-> (the-as process-drawable gp-0) root trans) (-> self end-pos))) ) - (if (>= (* f30-0 f30-0) f0-6) + (if (>= (square f30-0) f0-6) (go-virtual complete) ) ) @@ -470,13 +470,11 @@ ) (while (not s5-0) (let ((v1-1 (handle->process (-> self slave 0)))) - (when v1-1 - (let ((f0-0 (vector-vector-distance-squared (-> (the-as process-drawable v1-1) root trans) gp-0)) - (f1-0 (-> gp-0 w)) - ) - (set! s5-0 (< f0-0 (* f1-0 f1-0))) + (if v1-1 + (set! s5-0 + (< (vector-vector-distance-squared (-> (the-as process-drawable v1-1) root trans) gp-0) (square (-> gp-0 w))) + ) ) - ) ) (suspend) ) @@ -515,13 +513,11 @@ ) (while (not s5-2) (let ((v1-48 (handle->process (-> self slave 0)))) - (when v1-48 - (let ((f0-1 (vector-vector-distance-squared (-> (the-as process-drawable v1-48) root trans) gp-2)) - (f1-3 (-> gp-2 w)) - ) - (set! s5-2 (< f0-1 (* f1-3 f1-3))) + (if v1-48 + (set! s5-2 + (< (vector-vector-distance-squared (-> (the-as process-drawable v1-48) root trans) gp-2) (square (-> gp-2 w))) + ) ) - ) ) (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc b/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc index bf4d0c8b06..d7a413246c 100644 --- a/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/port/race/errol-chal_REF.gc @@ -542,32 +542,22 @@ (defmethod vehicle-racer-method-154 ((this vehicle-city-racer)) (cond ((logtest? (-> this rbody state flags) (rigid-body-flag enable-physics)) - (let ((f0-0 368640.0)) - (if (or (< (* f0-0 f0-0) (-> this player-dist2)) - (let ((f0-3 102400.0)) - (and (< (* f0-3 f0-3) (-> this player-dist2)) - (not (logtest? (-> this draw status) (draw-control-status on-screen))) - ) - ) - ) - (rigid-body-object-method-39 this) - ) - ) + (if (or (< (square 368640.0) (-> this player-dist2)) + (and (< (square 102400.0) (-> this player-dist2)) + (not (logtest? (-> this draw status) (draw-control-status on-screen))) + ) + ) + (rigid-body-object-method-39 this) + ) ) (else - (let ((f0-6 (-> this player-dist2)) - (f1-2 348160.0) - ) - (if (and (< f0-6 (* f1-2 f1-2)) - (let ((f0-7 (-> this player-dist2)) - (f1-5 81920.0) - ) - (or (< f0-7 (* f1-5 f1-5)) (logtest? (-> this draw status) (draw-control-status on-screen))) + (if (and (< (-> this player-dist2) (square 348160.0)) + (or (< (-> this player-dist2) (square 81920.0)) + (logtest? (-> this draw status) (draw-control-status on-screen)) ) - ) - (rigid-body-object-method-38 this) - ) - ) + ) + (rigid-body-object-method-38 this) + ) ) ) 0 @@ -823,14 +813,13 @@ (set! (-> s4-1 normal w) 1.0) (let ((f30-0 (vector4-dot (-> self plane) (-> s4-1 local-pos))) (f28-0 (vector4-dot (-> self plane) (-> s4-1 normal))) - (f0-5 (fmax - (vector-vector-distance-squared (-> self root trans) (-> s4-1 local-pos)) - (vector-vector-distance-squared (-> self root trans) (-> s4-1 normal)) - ) - ) - (f1-0 40960.0) ) - (when (< f0-5 (* f1-0 f1-0)) + (when (< (fmax + (vector-vector-distance-squared (-> self root trans) (-> s4-1 local-pos)) + (vector-vector-distance-squared (-> self root trans) (-> s4-1 normal)) + ) + (square 40960.0) + ) (when (or (and (< f30-0 0.0) (>= f28-0 0.0)) (and (< f28-0 0.0) (>= f30-0 0.0))) (send-event proc 'turbo-ring (-> self boost)) (set-time! (-> self touch-time)) @@ -1283,11 +1272,8 @@ (set! (-> self max-count) (-> s5-0 length)) ) (set! (-> gp-0 0 quad) (-> (target-pos 0) quad)) - (let* ((s4-1 (new 'static 'vector :x 1305804.8 :y 102400.0 :z 3180544.0 :w 163840.0)) - (f0-0 (vector-vector-distance-squared s4-1 (-> gp-0 0))) - (f1-0 (-> s4-1 w)) - ) - (when (< f0-0 (* f1-0 f1-0)) + (let ((s4-1 (new 'static 'vector :x 1305804.8 :y 102400.0 :z 3180544.0 :w 163840.0))) + (when (< (vector-vector-distance-squared s4-1 (-> gp-0 0)) (square (-> s4-1 w))) (if (< (-> self count) 18) (go-virtual fail) ) @@ -1295,9 +1281,7 @@ ) (while (< (-> self count) (-> self max-count)) (let ((s4-2 (-> s5-0 (-> self count)))) - (let ((f0-1 (-> s4-2 dist))) - (b! (< (* f0-1 f0-1) (vector-vector-distance-squared (-> gp-0 0) (-> s4-2 pos))) cfg-11) - ) + (b! (< (square (-> s4-2 dist)) (vector-vector-distance-squared (-> gp-0 0) (-> s4-2 pos))) cfg-11) (if (turbo-ring-spawn self s4-2 (-> self count) #f) (+! (-> self count) 1) ) @@ -1319,11 +1303,9 @@ () (set-time! (-> self state-time)) (while (not (logtest? (-> *race-state* flags) (race-flags begun))) - (let ((f0-0 (-> self begin-pos w))) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) - (go-virtual fail) - ) - ) + (if (< (square (-> self begin-pos w)) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) + (go-virtual fail) + ) (suspend) ) (set-setting! 'exclusive-load 'lerlchal 0.0 0) @@ -1527,11 +1509,9 @@ () (set-time! (-> self state-time)) (while (not (logtest? (-> *race-state* flags) (race-flags begun))) - (let ((f0-0 (-> self begin-pos w))) - (if (< (* f0-0 f0-0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) - (go-virtual fail) - ) - ) + (if (< (square (-> self begin-pos w)) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) + (go-virtual fail) + ) (suspend) ) (none) diff --git a/test/decompiler/reference/jak2/levels/city/sack/collection-task_REF.gc b/test/decompiler/reference/jak2/levels/city/sack/collection-task_REF.gc index 6a6ccddea6..24d81e736d 100644 --- a/test/decompiler/reference/jak2/levels/city/sack/collection-task_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/sack/collection-task_REF.gc @@ -125,10 +125,8 @@ (set! (-> vec quad) (-> (the-as vehicle vehicle) root root-prim prim-core world-sphere quad)) ) ) - (let ((dist-from-target (vector-vector-distance-squared (-> self root trans) vec)) - (pickup-dist (+ 12288.0 (-> vec w))) - ) - (when (>= (* pickup-dist pickup-dist) dist-from-target) + (let ((dist-from-target (vector-vector-distance-squared (-> self root trans) vec))) + (when (>= (square (+ 12288.0 (-> vec w))) dist-from-target) (sound-play "skill-pickup") (+! (-> *game-info* counter) -1.0) (go-virtual die) @@ -352,13 +350,9 @@ (local-vars (moved-beyond-start? symbol)) (until (or moved-beyond-start? (and *target* (focus-test? *target* pilot))) (suspend) - (let ((min-start-distance 122880.0)) - (set! moved-beyond-start? - (< (* min-start-distance min-start-distance) - (vector-vector-distance-squared (-> self begin-pos) (target-pos 0)) - ) - ) - ) + (set! moved-beyond-start? + (< (square 122880.0) (vector-vector-distance-squared (-> self begin-pos) (target-pos 0))) + ) ) (set-setting! 'airlock #f 0.0 0) (set! (-> self count) 0) diff --git a/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc b/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc index 1438e92733..5ace6a7f98 100644 --- a/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/shuttle/shuttle_REF.gc @@ -435,7 +435,6 @@ ) ) :code (behavior () - (local-vars (sv-176 float) (sv-192 float) (sv-208 float)) (remove-rider (the-as vehicle (handle->process (-> self vehicle))) self) (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) (let ((gp-0 (new 'stack-no-clear 'vector)) @@ -467,22 +466,13 @@ ) (quaternion-copy! s4-2 (-> (the-as vehicle s3-1) root quat)) (compute-seat-position (the-as vehicle s3-1) (-> self root trans) (-> self seat)) - (let ((s3-2 lerp-scale) - (s2-0 0.0) - (s1-0 1.0) - (s0-0 (ja-aframe-num 0)) - ) - (set! sv-176 (ja-aframe 10.0 0)) - (let* ((t0-0 (ja-aframe 7.0 0)) - (f0-4 (s3-2 s2-0 s1-0 s0-0 sv-176 t0-0)) - ) - (quaternion-rotate-local-y! (-> self root quat) s4-2 (* f0-4 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - ) - ) + (let ((f0-4 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 10.0 0) (ja-aframe 7.0 0)))) + (quaternion-rotate-local-y! (-> self root quat) s4-2 (* f0-4 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) ) ) (suspend) @@ -516,30 +506,22 @@ ) (compute-seat-position (the-as vehicle a0-59) s2-1 (-> self seat)) (vector-! s4-6 s2-1 gp-0) - (let ((s2-2 lerp-scale) - (s1-1 0.0) - (s0-1 1.0) - ) - (set! sv-192 (ja-aframe-num 0)) - (set! sv-208 (ja-aframe 5.0 0)) - (let* ((t0-1 (ja-aframe 1.0 0)) - (f0-13 (s2-2 s1-1 s0-1 sv-192 sv-208 t0-1)) - (f30-0 (- 1.0 f0-13)) - ) - (quaternion-rotate-local-y! s3-4 s5-0 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - (let ((a1-39 (vector-y-quaternion! (new 'stack-no-clear 'vector) s3-4)) - (s2-3 (new 'stack-no-clear 'quaternion)) - ) - (quaternion-from-two-vectors! s2-3 a1-39 *up-vector*) - (quaternion*! s3-4 s2-3 s3-4) - ) - (quaternion-copy! (-> self root quat) s3-4) - (vector+float*! (-> self root trans) gp-0 s4-6 f30-0) + (let* ((f0-13 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 1.0 0))) + (f30-0 (- 1.0 f0-13)) + ) + (quaternion-rotate-local-y! s3-4 s5-0 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + (let ((a1-39 (vector-y-quaternion! (new 'stack-no-clear 'vector) s3-4)) + (s2-3 (new 'stack-no-clear 'quaternion)) + ) + (quaternion-from-two-vectors! s2-3 a1-39 *up-vector*) + (quaternion*! s3-4 s2-3 s3-4) ) + (quaternion-copy! (-> self root quat) s3-4) + (vector+float*! (-> self root trans) gp-0 s4-6 f30-0) ) ) (suspend) @@ -1077,7 +1059,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defun shuttle-update ((arg0 task-manager) (arg1 (array city-shuttle-info)) (arg2 uint)) - (local-vars (v1-263 float) (v1-377 float) (sv-336 quaternion)) + (local-vars (v1-263 float) (v1-377 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1296,22 +1278,15 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-263 vf1) - (let ((f0-1 v1-263) - (f1-1 32768.0) - ) - (if (and (< f0-1 (* f1-1 f1-1)) (let ((f0-2 (vector-vector-distance-squared - (-> (the-as vehicle s4-2) root trans) - (-> (the-as citizen-rebel s2-0) root trans) - ) - ) - (f1-4 65536.0) + (if (and (< v1-263 (square 32768.0)) (< (vector-vector-distance-squared + (-> (the-as vehicle s4-2) root trans) + (-> (the-as citizen-rebel s2-0) root trans) + ) + (square 65536.0) ) - (< f0-2 (* f1-4 f1-4)) - ) - ) - (send-event s2-0 'board-vehicle s4-2) - ) - ) + ) + (send-event s2-0 'board-vehicle s4-2) + ) ) ) ) @@ -1354,11 +1329,9 @@ (set! (-> s2-1 guard-type) (the-as uint 7)) (vector-reset! (-> s2-1 velocity)) (set! (-> s2-1 position quad) (-> arg1 s3-2 pos quad)) - (let ((s0-0 quaternion-copy!)) - (set! sv-336 (-> s2-1 rotation)) - (let ((a1-50 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *up-vector* 0.0))) - (s0-0 sv-336 a1-50) - ) + (quaternion-copy! + (-> s2-1 rotation) + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) *up-vector* 0.0) ) (logior! (-> s2-1 flags) (traffic-spawn-flags trsflags-00)) (set! (-> s2-1 id) (the-as uint 122)) @@ -1401,11 +1374,7 @@ (cond ((focus-test? (the-as process-focusable s4-3) pilot) (if (and s2-2 - (let ((f0-3 (vector-vector-distance-squared s5-1 (-> (the-as process-drawable s2-2) root trans))) - (f1-7 65536.0) - ) - (< f0-3 (* f1-7 f1-7)) - ) + (< (vector-vector-distance-squared s5-1 (-> (the-as process-drawable s2-2) root trans)) (square 65536.0)) (begin (.lvf vf1 (&-> (-> (the-as process-drawable s2-2) root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) @@ -1414,11 +1383,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-377 vf1) - (let ((f0-4 v1-377) - (f1-10 12288.0) - ) - (< f0-4 (* f1-10 f1-10)) - ) + (< v1-377 (square 12288.0)) ) ) (send-event s4-3 'exit-vehicle s5-1) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc index 38320fac16..084dbc2e49 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/citizen_REF.gc @@ -935,7 +935,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod citizen-method-190 ((this citizen) (arg0 vector)) - (local-vars (sv-288 nav-poly) (sv-304 clamp-travel-vector-to-mesh-return-info) (sv-320 vector)) (let ((s3-1 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) (the-as vector (-> this cp-sphere)))) (s4-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) @@ -952,54 +951,47 @@ (vector-*! s4-0 s3-1 s2-0 (vector-dot s3-1 s2-0)) (let ((f30-0 (- 1.0 (/ (vector-length s4-0) (vector-length (-> this cp-vec)))))) (vector+! s4-0 s4-0 (the-as vector (-> this cp-sphere))) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-320 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector))) - (set! sv-304 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) - (set! sv-288 (-> this nav state current-poly)) - (let ((f28-0 (+ (-> this cp-sphere r) (-> this nav-radius-backup)))) - (when sv-288 - (vector-normalize-copy! s0-0 s2-0 f28-0) - (vector-normalize-copy! sv-320 s2-0 (- f28-0)) - (clamp-vector-to-mesh-no-gaps (-> this nav) s4-0 sv-288 s0-0 sv-304) - (let ((a0-12 (-> this nav)) - (t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a1-10 s4-0) - (a3-3 sv-320) - ) - (t9-7 a0-12 a1-10 sv-288 a3-3 sv-304) - ) - (let* ((v1-22 s0-0) - (f0-11 (sqrtf (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z))))) - (v1-24 sv-320) - (f1-10 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) - ) - (cond - ((< 0.0 (vector-dot s2-0 s3-1)) - (if (< 4096.0 f0-11) - (set! (-> s1-0 quad) (-> s0-0 quad)) - (set! (-> s1-0 quad) (-> sv-320 quad)) - ) - ) - ((< 4096.0 f1-10) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-320 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (sv-288 (-> this nav state current-poly)) + (f28-0 (+ (-> this cp-sphere r) (-> this nav-radius-backup))) + ) + (when sv-288 + (vector-normalize-copy! s0-0 s2-0 f28-0) + (vector-normalize-copy! sv-320 s2-0 (- f28-0)) + (clamp-vector-to-mesh-no-gaps (-> this nav) s4-0 sv-288 s0-0 sv-304) + (clamp-vector-to-mesh-no-gaps (-> this nav) s4-0 sv-288 sv-320 sv-304) + (let* ((v1-22 s0-0) + (f0-11 (sqrtf (+ (* (-> v1-22 x) (-> v1-22 x)) (* (-> v1-22 z) (-> v1-22 z))))) + (v1-24 sv-320) + (f1-10 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) + ) + (cond + ((< 0.0 (vector-dot s2-0 s3-1)) + (if (< 4096.0 f0-11) + (set! (-> s1-0 quad) (-> s0-0 quad)) (set! (-> s1-0 quad) (-> sv-320 quad)) ) - (else - (set! (-> s1-0 quad) (-> s0-0 quad)) - ) - ) + ) + ((< 4096.0 f1-10) + (set! (-> s1-0 quad) (-> sv-320 quad)) + ) + (else + (set! (-> s1-0 quad) (-> s0-0 quad)) ) - (set! (-> arg0 quad) (-> s1-0 quad)) - (let ((a1-11 (new 'stack-no-clear 'vector))) - (set! (-> a1-11 quad) (-> this root trans quad)) - (set! (-> a1-11 y) 0.0) - (let ((f0-15 (- f28-0 (vector-vector-xz-distance s4-0 a1-11)))) - (if (< f0-15 0.0) - (set! f0-15 0.0) - ) - (vector-normalize! arg0 (* (-> this cp-factor) f0-15 f30-0)) + ) + ) + (set! (-> arg0 quad) (-> s1-0 quad)) + (let ((a1-11 (new 'stack-no-clear 'vector))) + (set! (-> a1-11 quad) (-> this root trans quad)) + (set! (-> a1-11 y) 0.0) + (let ((f0-15 (- f28-0 (vector-vector-xz-distance s4-0 a1-11)))) + (if (< f0-15 0.0) + (set! f0-15 0.0) ) - ) + (vector-normalize! arg0 (* (-> this cp-factor) f0-15 f30-0)) ) ) ) @@ -1528,11 +1520,11 @@ ) :post (behavior () (if (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point))) - (f1-0 16384.0) - ) - (or (< f0-0 (* f1-0 f1-0)) (logtest? (-> self nav state flags) (nav-state-flag at-target))) - ) + (or (< (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point)) + (square 16384.0) + ) + (logtest? (-> self nav state flags) (nav-state-flag at-target)) + ) ) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc index a0c4c00497..5574a8be81 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/civilian_REF.gc @@ -649,7 +649,6 @@ ;; definition for function civilian-avoid-danger-post ;; INFO: Used lq/sq (defbehavior civilian-avoid-danger-post civilian () - (local-vars (sv-352 nav-poly)) (let ((gp-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (the-as vector (-> self danger-pos))))) (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self controller turn-exit-point) (-> self root trans)))) (vector-! @@ -672,67 +671,60 @@ (s2-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (v1-6 (-> self nav)) + (a0-8 (-> self danger-pos)) + (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) ) - (let ((v1-6 (-> self nav)) - (a0-8 (-> self danger-pos)) - (a1-5 (new 'stack-no-clear 'nav-find-poly-parms)) - ) - (vector-! (-> a1-5 point) (the-as vector a0-8) (-> v1-6 state mesh bounds)) - (set! (-> a1-5 y-threshold) (-> v1-6 nearest-y-threshold)) - (set! (-> a1-5 ignore) (the-as uint 2)) - (set! sv-352 (find-poly-containing-point-local (-> v1-6 state mesh) a1-5)) - ) - (when sv-352 - (vector-normalize-copy! s3-0 s1-1 40960.0) - (clamp-vector-to-mesh-no-gaps (-> self nav) (-> self danger-pos) sv-352 s3-0 s0-0) - (vector-normalize-copy! s2-0 s1-1 -40960.0) - (let ((a0-14 (-> self nav)) - (t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a1-9 (-> self danger-pos)) - (a3-3 s2-0) - ) - (t9-7 a0-14 a1-9 sv-352 a3-3 s0-0) - ) - (let* ((v1-12 s3-0) - (f0-7 (sqrtf (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))))) - (v1-14 s2-0) - (f1-7 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) - ) - (cond - ((< 0.0 (vector-dot s1-1 gp-1)) - (if (< 8192.0 f0-7) - (set! (-> s4-0 quad) (-> s3-0 quad)) - (set! (-> s4-0 quad) (-> s2-0 quad)) + (vector-! (-> a1-5 point) (the-as vector a0-8) (-> v1-6 state mesh bounds)) + (set! (-> a1-5 y-threshold) (-> v1-6 nearest-y-threshold)) + (set! (-> a1-5 ignore) (the-as uint 2)) + (let ((sv-352 (find-poly-containing-point-local (-> v1-6 state mesh) a1-5))) + (when sv-352 + (vector-normalize-copy! s3-0 s1-1 40960.0) + (clamp-vector-to-mesh-no-gaps (-> self nav) (-> self danger-pos) sv-352 s3-0 s0-0) + (vector-normalize-copy! s2-0 s1-1 -40960.0) + (clamp-vector-to-mesh-no-gaps (-> self nav) (-> self danger-pos) sv-352 s2-0 s0-0) + (let* ((v1-12 s3-0) + (f0-7 (sqrtf (+ (* (-> v1-12 x) (-> v1-12 x)) (* (-> v1-12 z) (-> v1-12 z))))) + (v1-14 s2-0) + (f1-7 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) ) - ) - ((< 8192.0 f1-7) - (set! (-> s4-0 quad) (-> s2-0 quad)) - ) - (else - (set! (-> s4-0 quad) (-> s3-0 quad)) + (cond + ((< 0.0 (vector-dot s1-1 gp-1)) + (if (< 8192.0 f0-7) + (set! (-> s4-0 quad) (-> s3-0 quad)) + (set! (-> s4-0 quad) (-> s2-0 quad)) + ) + ) + ((< 8192.0 f1-7) + (set! (-> s4-0 quad) (-> s2-0 quad)) + ) + (else + (set! (-> s4-0 quad) (-> s3-0 quad)) + ) ) ) - ) - (let* ((v1-24 gp-1) - (f0-13 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) - ) - (let ((f1-12 0.8) - (v1-27 s5-1) - ) - (* f1-12 (sqrtf (+ (* (-> v1-27 x) (-> v1-27 x)) (* (-> v1-27 z) (-> v1-27 z))))) - ) - (let ((f0-15 (/ (- (-> self danger-pos r) f0-13) (-> self danger-pos r)))) - (if (< f0-15 0.0) - (set! f0-15 0.0) - ) - (if (< 0.8 f0-15) - (set! f0-15 0.8) - ) - (set! (-> gp-1 quad) (-> s4-0 quad)) - (vector-xz-normalize! gp-1 (* 16384.0 f0-15)) + (let* ((v1-24 gp-1) + (f0-13 (sqrtf (+ (* (-> v1-24 x) (-> v1-24 x)) (* (-> v1-24 z) (-> v1-24 z))))) + ) + (let ((f1-12 0.8) + (v1-27 s5-1) + ) + (* f1-12 (sqrtf (+ (* (-> v1-27 x) (-> v1-27 x)) (* (-> v1-27 z) (-> v1-27 z))))) + ) + (let ((f0-15 (/ (- (-> self danger-pos r) f0-13) (-> self danger-pos r)))) + (if (< f0-15 0.0) + (set! f0-15 0.0) + ) + (if (< 0.8 f0-15) + (set! f0-15 0.8) + ) + (set! (-> gp-1 quad) (-> s4-0 quad)) + (vector-xz-normalize! gp-1 (* 16384.0 f0-15)) + ) ) + (vector-xz-normalize! s5-1 16384.0) ) - (vector-xz-normalize! s5-1 16384.0) ) ) ) @@ -865,7 +857,6 @@ ;; definition for function civilian-clear-path-post ;; INFO: Used lq/sq (defbehavior civilian-clear-path-post civilian () - (local-vars (sv-304 nav-poly)) (let ((s5-1 (vector-! (new 'stack-no-clear 'vector) (-> self root trans) (the-as vector (-> self cp-sphere)))) (s1-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) @@ -882,41 +873,35 @@ (s2-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (sv-304 (-> self nav state current-poly)) + (f30-0 (+ 4096.0 (-> self cp-sphere r))) ) - (set! sv-304 (-> self nav state current-poly)) - (let ((f30-0 (+ 4096.0 (-> self cp-sphere r)))) - (when sv-304 - (vector-normalize-copy! s3-0 gp-0 f30-0) - (vector-normalize-copy! s2-0 gp-0 (- f30-0)) - (clamp-vector-to-mesh-no-gaps (-> self nav) s1-0 sv-304 s3-0 s0-0) - (let ((a0-12 (-> self nav)) - (t9-8 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a3-3 s2-0) - ) - (t9-8 a0-12 s1-0 sv-304 a3-3 s0-0) - ) - (let* ((v1-14 s3-0) - (f0-9 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) - (v1-16 s2-0) - (f1-8 (sqrtf (+ (* (-> v1-16 x) (-> v1-16 x)) (* (-> v1-16 z) (-> v1-16 z))))) + (when sv-304 + (vector-normalize-copy! s3-0 gp-0 f30-0) + (vector-normalize-copy! s2-0 gp-0 (- f30-0)) + (clamp-vector-to-mesh-no-gaps (-> self nav) s1-0 sv-304 s3-0 s0-0) + (clamp-vector-to-mesh-no-gaps (-> self nav) s1-0 sv-304 s2-0 s0-0) + (let* ((v1-14 s3-0) + (f0-9 (sqrtf (+ (* (-> v1-14 x) (-> v1-14 x)) (* (-> v1-14 z) (-> v1-14 z))))) + (v1-16 s2-0) + (f1-8 (sqrtf (+ (* (-> v1-16 x) (-> v1-16 x)) (* (-> v1-16 z) (-> v1-16 z))))) + ) + (cond + ((< 0.0 (vector-dot gp-0 s5-1)) + (if (< 4096.0 f0-9) + (set! (-> s4-0 quad) (-> s3-0 quad)) + (set! (-> s4-0 quad) (-> s2-0 quad)) ) - (cond - ((< 0.0 (vector-dot gp-0 s5-1)) - (if (< 4096.0 f0-9) - (set! (-> s4-0 quad) (-> s3-0 quad)) - (set! (-> s4-0 quad) (-> s2-0 quad)) - ) - ) - ((< 4096.0 f1-8) - (set! (-> s4-0 quad) (-> s2-0 quad)) - ) - (else - (set! (-> s4-0 quad) (-> s3-0 quad)) - ) + ) + ((< 4096.0 f1-8) + (set! (-> s4-0 quad) (-> s2-0 quad)) + ) + (else + (set! (-> s4-0 quad) (-> s3-0 quad)) ) ) - (set! (-> gp-0 quad) (-> s4-0 quad)) ) + (set! (-> gp-0 quad) (-> s4-0 quad)) ) ) (if *citizen-debug* @@ -1828,7 +1813,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float) (sv-144 float)) (ja-channel-push! 1 (seconds 0.1)) (ja-no-eval :group! (-> self draw art-group data (-> self info get-in-car-anim)) :num! min) (let ((f30-0 0.0)) @@ -1859,24 +1843,15 @@ (quaternion-copy! s3-0 (-> (the-as vehicle s2-0) root quat)) (compute-seat-position (the-as vehicle s2-0) s1-0 (-> self seat)) (vector-! s4-1 s1-0 gp-2) - (let ((s2-1 lerp-scale) - (s1-1 0.0) - (s0-0 1.0) - ) - (set! sv-128 (ja-aframe-num 0)) - (set! sv-144 (ja-aframe 1.0 0)) - (let* ((t0-1 (ja-aframe 5.0 0)) - (f30-1 (s2-1 s1-1 s0-0 sv-128 sv-144 t0-1)) - ) - (quaternion-rotate-local-y! s3-0 s3-0 (* f30-1 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - ) - (quaternion-slerp! (-> self root quat) s5-0 s3-0 f30-1) - (vector+float*! (-> self root trans) gp-2 s4-1 f30-1) - ) + (let ((f30-1 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 1.0 0) (ja-aframe 5.0 0)))) + (quaternion-rotate-local-y! s3-0 s3-0 (* f30-1 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + ) + (quaternion-slerp! (-> self root quat) s5-0 s3-0 f30-1) + (vector+float*! (-> self root trans) gp-2 s4-1 f30-1) ) ) (suspend) @@ -2046,7 +2021,6 @@ ) ) :code (behavior () - (local-vars (sv-128 float) (sv-144 float)) (ja-channel-push! 1 (seconds 0.1)) (remove-rider (the-as vehicle (handle->process (-> self vehicle))) self) (logclear! (-> self focus-status) (focus-status pilot-riding pilot)) @@ -2104,24 +2078,16 @@ ) (compute-seat-position (the-as vehicle a0-46) s2-1 (-> self seat)) (vector-! s4-3 s2-1 gp-3) - (let ((s2-2 lerp-scale) - (s1-1 0.0) - (s0-0 1.0) - ) - (set! sv-128 (ja-aframe-num 0)) - (set! sv-144 (ja-aframe 5.0 0)) - (let* ((t0-1 (ja-aframe 1.0 0)) - (f0-12 (s2-2 s1-1 s0-0 sv-128 sv-144 t0-1)) - (f30-0 (- 1.0 f0-12)) - ) - (quaternion-rotate-local-y! s3-2 s5-2 (if (zero? (-> self seat)) - -16384.0 - 16384.0 - ) - ) - (quaternion-copy! (-> self root quat) s3-2) - (vector+float*! (-> self root trans) gp-3 s4-3 f30-0) - ) + (let* ((f0-12 (lerp-scale 0.0 1.0 (ja-aframe-num 0) (ja-aframe 5.0 0) (ja-aframe 1.0 0))) + (f30-0 (- 1.0 f0-12)) + ) + (quaternion-rotate-local-y! s3-2 s5-2 (if (zero? (-> self seat)) + -16384.0 + 16384.0 + ) + ) + (quaternion-copy! (-> self root quat) s3-2) + (vector+float*! (-> self root trans) gp-3 s4-3 f30-0) ) ) (suspend) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc index 1ee2cb7593..b8aba9a6f0 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/guard_REF.gc @@ -415,14 +415,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod crimson-guard-method-218 ((this crimson-guard) (arg0 vector)) - (local-vars - (sv-240 vector) - (sv-256 (function vector vector vector)) - (sv-272 vector) - (sv-288 vector) - (sv-304 vector) - (sv-320 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -431,8 +423,9 @@ (vf7 :class vf) ) (init-vf0-vector) - (set! sv-240 arg0) - (let ((s0-0 (new 'stack-no-clear 'vector))) + (let ((sv-240 arg0) + (s0-0 (new 'stack-no-clear 'vector)) + ) (let ((v1-1 (-> this root trans))) (let ((a0-1 *y-vector*)) (let ((a1-2 8192.0)) @@ -446,9 +439,9 @@ (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> s0-0 quad) vf6) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-320 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -510,18 +503,15 @@ (.svf (&-> a1-8 quad) vf6) ) (vector-normalize! (vector-! sv-320 sv-240 s0-0) 1.0) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((v1-20 (-> sv-240 quad))) - (set! (-> sv-288 quad) v1-20) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (set! (-> sv-288 quad) (-> sv-240 quad)) + (vector+! sv-288 sv-288 (vector-rotate90-around-y! + (new 'stack-no-clear 'vector) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272) + ) + ) + (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) ) - (set! sv-256 vector-rotate90-around-y!) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let* ((a1-13 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272)) - (v0-5 (sv-256 sv-272 a1-13)) - ) - (vector+! sv-288 sv-288 v0-5) - ) - (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) (vector-z-quaternion! sv-304 (-> this root quat)) (rot-zxy-from-vector! s2-0 sv-304) (rot-zxy-from-vector! s1-0 sv-320) @@ -1782,11 +1772,9 @@ ) :post (behavior () (if (and (nonzero? (-> self controller branch)) - (let ((f0-0 (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point))) - (f1-0 16384.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (-> self root trans) (-> self controller turn-exit-point)) + (square 16384.0) + ) ) (vehicle-controller-method-14 (-> self controller) (the-as vehicle self)) ) @@ -2704,7 +2692,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defun spread-lightning-lazer ((arg0 lightning-control) (arg1 vector) (arg2 vector) (arg3 vector)) - (local-vars (sv-640 int) (sv-656 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2723,8 +2710,9 @@ (vector-length arg2) (let ((s1-0 (new 'stack-no-clear 'vector))) (set! (-> s1-0 quad) (-> arg3 quad)) - (let ((s0-0 (new 'stack-no-clear 'collide-query))) - (set! sv-640 0) + (let ((s0-0 (new 'stack-no-clear 'collide-query)) + (sv-640 0) + ) (while (< sv-640 6) (let ((v1-6 s0-0)) (set! (-> v1-6 radius) 2867.2) @@ -2822,11 +2810,12 @@ (+! (-> s3-0 z) (rand-vu-float-range -819.2 819.2)) (set-point! arg0 (-> arg0 state points-to-draw) s3-0) (+! (-> arg0 state points-to-draw) 1) - (set! sv-656 (-> s0-0 best-other-tri normal)) - (quaternion-from-two-vectors! s2-0 s1-0 sv-656) - (vector-orient-by-quat! s4-0 s4-0 s2-0) - (set! (-> s1-0 quad) (-> sv-656 quad)) - (vector-flatten! s4-0 s4-0 sv-656) + (let ((sv-656 (-> s0-0 best-other-tri normal))) + (quaternion-from-two-vectors! s2-0 s1-0 sv-656) + (vector-orient-by-quat! s4-0 s4-0 s2-0) + (set! (-> s1-0 quad) (-> sv-656 quad)) + (vector-flatten! s4-0 s4-0 sv-656) + ) ) (else (vector+! s5-0 s5-0 s4-0) @@ -2837,7 +2826,7 @@ ) ) ) - (set! sv-640 (+ sv-640 1)) + (+! sv-640 1) ) ) ) @@ -2852,7 +2841,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-method-222 ((this crimson-guard)) - (local-vars (sv-800 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2913,15 +2901,14 @@ (vector+! s5-0 s4-0 s1-0) (point-in-plane-<-point+normal! s2-1 s5-0 (-> s3-0 best-other-tri normal)) (vector-! s2-1 s2-1 s5-0) - (let ((s1-1 quaternion-vector-angle!) - (s0-0 (new 'stack-no-clear 'quaternion)) + (let ((a2-4 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (-> s3-0 best-other-tri normal) + (rand-vu-float-range 0.0 65536.0) + ) + ) ) - (set! sv-800 (-> s3-0 best-other-tri normal)) - (let* ((a2-3 (rand-vu-float-range 0.0 65536.0)) - (a2-4 (s1-1 s0-0 sv-800 a2-3)) - ) - (vector-orient-by-quat! s2-1 s2-1 a2-4) - ) + (vector-orient-by-quat! s2-1 s2-1 a2-4) ) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s4-0) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s5-0) @@ -3259,14 +3246,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod crimson-guard-method-224 ((this crimson-guard) (arg0 vector)) - (local-vars - (f0-8 float) - (sv-768 vector) - (sv-784 vector) - (sv-800 nav-control) - (sv-816 nav-poly) - (sv-832 vector) - ) + (local-vars (f0-8 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3281,8 +3261,8 @@ (dotimes (s3-0 2) (vector-normalize! s4-0 (* 4096.0 (+ 4.0 (* 2.0 (the float s3-0))))) (dotimes (s2-0 6) - (set! sv-768 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-768 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'collide-query)) ) (vector-rotate-around-y! sv-768 s4-0 (* 182.04445 (the float (+ (* 23 s2-0) -70)))) @@ -3311,57 +3291,52 @@ (vector-! (-> a1-7 point) a0-8 (-> v1-14 state mesh bounds)) (set! (-> a1-7 y-threshold) (-> v1-14 nearest-y-threshold)) (set! (-> a1-7 ignore) (the-as uint 2)) - (set! sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7)) - ) - (when sv-816 - (let* ((v1-18 s4-0) - (f0-7 (-> sv-768 x)) - (f1-4 (-> sv-768 y)) - (f2-2 (-> sv-768 z)) - (f3-2 (-> v1-18 x)) - (f4-0 (-> v1-18 y)) - (f5-0 (-> v1-18 z)) - ) - (.mula.s f0-7 f3-2) - (.madda.s f1-4 f4-0) - (.madd.s f0-8 f2-2 f5-0) - ) - (let ((f28-0 f0-8)) - (new 'stack-no-clear 'vector) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (set! (-> a1-8 quad) (-> s1-0 quad)) - (set! (-> a1-8 w) 8192.0) - (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) - (when (< f30-0 f28-0) - (set! f30-0 f28-0) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! sv-800 (-> this nav)) - (set! sv-832 sv-784) - (let* ((v1-29 s1-0) - (a0-18 (-> sv-800 state mesh)) - (t9-7 (method-of-object a0-18 project-point-onto-plane-of-poly-local)) - (a2-7 sv-832) - (t0-2 (vector-! (new 'stack-no-clear 'vector) v1-29 (-> sv-800 state mesh bounds))) - ) - (t9-7 a0-18 sv-816 a2-7 a3-3 t0-2) + (let ((sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7))) + (when sv-816 + (let* ((v1-18 s4-0)) + (set! f0-8 (vector-dot sv-768 v1-18)) + ) + (let ((f28-0 f0-8)) + (new 'stack-no-clear 'vector) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (set! (-> a1-8 quad) (-> s1-0 quad)) + (set! (-> a1-8 w) 8192.0) + (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) + (when (< f30-0 f28-0) + (set! f30-0 f28-0) + (let ((sv-784 (new 'stack-no-clear 'vector))) + (let ((a3-3 (new 'stack-no-clear 'vector)) + (sv-800 (-> this nav)) + (sv-832 sv-784) + ) + (let ((v1-29 s1-0)) + (project-point-onto-plane-of-poly-local + (-> sv-800 state mesh) + sv-816 + sv-832 + a3-3 + (vector-! (new 'stack-no-clear 'vector) v1-29 (-> sv-800 state mesh bounds)) + ) + ) + (let ((v1-30 sv-832)) + (let ((a0-21 (-> sv-800 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-832 quad)) + (.lvf vf5 (&-> a0-21 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-30 quad) vf6) + ) + ) + 0 + (set! (-> s1-0 y) (-> sv-784 y)) + ) + (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) + ) + (set! (-> arg0 quad) (-> s1-0 quad)) ) ) - (let ((v1-30 sv-832)) - (let ((a0-21 (-> sv-800 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-832 quad)) - (.lvf vf5 (&-> a0-21 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-30 quad) vf6) - ) - 0 - (set! (-> s1-0 y) (-> sv-784 y)) - (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) - ) - (set! (-> arg0 quad) (-> s1-0 quad)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc index 5cb60db98c..4a1ed3b56a 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-grunt_REF.gc @@ -307,11 +307,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) @@ -619,23 +615,18 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let* ((f30-0 v1-5) - (f0-0 arg0) - (f28-0 (* f0-0 f0-0)) - (f0-2 12288.0) - ) - (when (or (>= (* f0-2 f0-2) f30-0) (>= f28-0 f30-0)) + (let ((f30-0 v1-5) + (f28-0 (square arg0)) + ) + (when (or (>= (square 12288.0) f30-0) (>= f28-0 f30-0)) (let ((f26-0 (quaternion-y-angle (-> this root quat))) (f0-7 (atan (-> s4-0 x) (-> s4-0 z))) - (f1-0 1228.8) ) (cond - ((and (< (* f1-0 f1-0) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) + ((and (< (square 1228.8) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) (go (method-of-object this attack)) ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) + ((< f30-0 (square 12288.0)) (go (method-of-object this spin-attack)) ) ) @@ -664,10 +655,7 @@ (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) ) - (when (and a0-1 (let ((f0-0 65536.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans))) - ) - ) + (when (and a0-1 (>= (square 65536.0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans)))) (sound-play "grunt-warn") (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc index 9ffb2e02f2..7afec08e7f 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-predator_REF.gc @@ -704,7 +704,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod metalhead-predator-method-206 ((this metalhead-predator) (arg0 int) (arg1 float)) - (local-vars (sv-240 vector) (sv-256 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -736,23 +735,22 @@ (when s3-0 (seek! (-> this miss-amount) (* 0.2 (vector-length (-> (the-as process-drawable s3-0) root transv))) 4096.0) (set! (-> s2-0 quad) (-> (get-trans (the-as process-focusable s3-0) 3) quad)) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((v1-25 (-> s5-0 pos)) - (a0-18 s2-0) - ) - (.lvf vf4 (&-> v1-25 quad)) - (.lvf vf5 (&-> a0-18 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-240 quad) vf6) - (let* ((f0-5 (vector-length sv-240)) - (f0-6 (/ f0-5 (meters 130))) - ) - (set! sv-256 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) + (let ((sv-240 (new 'stack-no-clear 'vector))) + (let ((v1-25 (-> s5-0 pos)) + (a0-18 s2-0) ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-240 quad) vf6) + (let* ((f0-5 (vector-length sv-240)) + (f0-6 (/ f0-5 (meters 130))) + (sv-256 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) (let ((a0-19 s2-0)) (let ((v1-31 s2-0)) (let ((a1-6 (-> (the-as process-focusable s3-0) root transv))) @@ -776,11 +774,7 @@ (let ((a2-5 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-240 (-> this shoot-angle)))) (vector-orient-by-quat! sv-256 sv-256 a2-5) ) - (let* ((t9-9 quaternion-vector-angle!) - (a0-27 (new 'stack-no-clear 'quaternion)) - (a2-6 (-> this shoot-angle)) - (a2-7 (t9-9 a0-27 sv-240 a2-6)) - ) + (let ((a2-7 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-240 (-> this shoot-angle)))) (vector-orient-by-quat! s0-0 s0-0 a2-7) ) (let ((a0-29 s1-1)) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc index 022616641b..e0be045d97 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/traffic-engine_REF.gc @@ -592,13 +592,13 @@ ;; WARN: Return type mismatch int vs none. (defmethod activate-from-params ((this traffic-tracker) (arg0 traffic-object-spawn-params)) "Get a reserved process, and activate with the given params." - (local-vars (sv-16 handle)) (let ((gp-0 (-> arg0 object-type))) (set! (-> arg0 proc) #f) (let ((v1-2 (-> this traffic object-type-info-array gp-0))) (when (and (> (-> v1-2 inactive-count) 0) (> (-> v1-2 reserve-count) 0)) - (set! sv-16 (get-from-inactive-by-type this gp-0)) - (let ((s3-0 (handle->process sv-16))) + (let* ((sv-16 (get-from-inactive-by-type this gp-0)) + (s3-0 (handle->process sv-16)) + ) (when s3-0 (cond ((send-event s3-0 'traffic-activate arg0 (-> this traffic)) @@ -681,12 +681,12 @@ ;; WARN: Return type mismatch int vs none. (defmethod activate-by-handle ((this traffic-tracker) (arg0 traffic-object-spawn-params)) "Activate, using the handle in the params." - (local-vars (sv-16 handle)) (let ((gp-0 (-> arg0 object-type))) (set! (-> arg0 proc) #f) (when (> (-> this traffic object-type-info-array gp-0 inactive-count) 0) - (set! sv-16 (get-from-inactive-by-handle this gp-0 (-> arg0 handle))) - (let ((s3-0 (handle->process sv-16))) + (let* ((sv-16 (get-from-inactive-by-handle this gp-0 (-> arg0 handle))) + (s3-0 (handle->process sv-16)) + ) (when s3-0 (cond ((send-event s3-0 'traffic-activate arg0 (-> this traffic)) @@ -1155,7 +1155,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod debug-draw ((this traffic-level-data)) - (local-vars (sv-16 nav-node) (sv-20 nav-branch) (sv-80 nav-node) (sv-84 vector) (sv-88 vector) (sv-92 vector)) (when (and (nonzero? (-> this city-info)) (nonzero? (-> this city-info nav-graph))) (let ((s5-0 (-> this city-info nav-graph))) (let ((v1-6 (-> s5-0 node-array 0))) @@ -1174,51 +1173,56 @@ (debug-draw a0-4) ) ) - (set! sv-16 (-> s5-0 node-array 0)) - (countdown (gp-1 (-> s5-0 node-count)) - (when (logtest? (-> sv-16 flags) (nav-node-flag-byte visited)) - (debug-draw sv-16) - (dotimes (s5-1 (-> sv-16 branch-count)) - (set! sv-20 (-> sv-16 branch-array s5-1)) - (set! sv-80 (-> sv-20 dest-node)) - (set! sv-84 (new 'stack-no-clear 'vector)) - (set! sv-88 (new 'stack-no-clear 'vector)) - (set! sv-92 (new 'stack-no-clear 'vector)) - (let ((a1-7 sv-16) - (v1-35 sv-88) - ) - (set! (-> v1-35 quad) (-> a1-7 position quad)) - (set! (-> v1-35 w) 1.0) - ) - (let ((a1-10 sv-80) - (v1-36 sv-92) - ) - (set! (-> v1-36 quad) (-> a1-10 position quad)) - (set! (-> v1-36 w) 1.0) - ) - (vector-! sv-84 sv-92 sv-88) - (add-debug-vector #t (bucket-id debug2) sv-88 sv-84 (meters 0.00023193359) *color-light-green*) - (vector+float*! sv-84 sv-88 sv-84 0.5) - (let ((s4-1 add-debug-text-3d) - (s3-0 #t) - (s2-0 324) - ) - (format (clear *temp-string*) "~D" (-> sv-20 user-count)) - (s4-1 - s3-0 - (the-as bucket-id s2-0) - *temp-string* - sv-84 - (if (< (-> sv-20 user-count) (-> sv-20 max-user-count)) - (font-color yellow) - (font-color red) + (let ((sv-16 (-> s5-0 node-array 0))) + (countdown (gp-1 (-> s5-0 node-count)) + (when (logtest? (-> sv-16 flags) (nav-node-flag-byte visited)) + (debug-draw sv-16) + (dotimes (s5-1 (-> sv-16 branch-count)) + (let* ((sv-20 (-> sv-16 branch-array s5-1)) + (sv-80 (-> sv-20 dest-node)) + (sv-84 (new 'stack-no-clear 'vector)) + ) + (let ((sv-88 (new 'stack-no-clear 'vector))) + (let ((sv-92 (new 'stack-no-clear 'vector))) + (let ((a1-7 sv-16) + (v1-35 sv-88) + ) + (set! (-> v1-35 quad) (-> a1-7 position quad)) + (set! (-> v1-35 w) 1.0) + ) + (let ((a1-10 sv-80) + (v1-36 sv-92) + ) + (set! (-> v1-36 quad) (-> a1-10 position quad)) + (set! (-> v1-36 w) 1.0) + ) + (vector-! sv-84 sv-92 sv-88) ) - (the-as vector2h #f) + (add-debug-vector #t (bucket-id debug2) sv-88 sv-84 (meters 0.00023193359) *color-light-green*) + (vector+float*! sv-84 sv-88 sv-84 0.5) + ) + (let ((s4-1 add-debug-text-3d) + (s3-0 #t) + (s2-0 324) + ) + (format (clear *temp-string*) "~D" (-> sv-20 user-count)) + (s4-1 + s3-0 + (the-as bucket-id s2-0) + *temp-string* + sv-84 + (if (< (-> sv-20 user-count) (-> sv-20 max-user-count)) + (font-color yellow) + (font-color red) + ) + (the-as vector2h #f) + ) + ) ) ) ) + (&+! sv-16 32) ) - (set! sv-16 (&+ sv-16 32)) ) ) ) @@ -1435,10 +1439,9 @@ 0 ) ((and (logtest? (focus-status gun) s3-0) - (not (and (logtest? (focus-status pilot) s3-0) (let* ((v1-19 (-> s4-0 0 bbox max)) - (f0-6 40960.0) - (f0-8 (* f0-6 f0-6)) - ) + (not (and (logtest? (focus-status pilot) s3-0) (let ((v1-19 (-> s4-0 0 bbox max)) + (f0-8 (square 40960.0)) + ) (.lvf vf1 (&-> v1-19 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -1457,10 +1460,9 @@ ) ((logtest? (focus-status dangerous board pilot) s3-0) (vector-float*! (the-as vector (-> s4-0 0)) (-> s4-0 0 bbox max) 2.0) - (let* ((v1-31 (-> s4-0 0)) - (f0-11 20480.0) - (f0-13 (* f0-11 f0-11)) - ) + (let ((v1-31 (-> s4-0 0)) + (f0-13 (square 20480.0)) + ) (.lvf vf1 (&-> v1-31 bbox min quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -1637,7 +1639,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod update-traffic-amount ((this traffic-engine)) "kills inactive traffic and spawns more if needed." - (local-vars (sv-48 int) (sv-64 nav-segment)) (set! (-> this object-hash object-count) 0) (let* ((v1-1 (-> this object-hash)) (a0-6 (/ (+ (* (* (* (-> v1-1 dimension-array 0) (-> v1-1 dimension-array 1)) (-> v1-1 dimension-array 2)) @@ -1754,20 +1755,22 @@ (dotimes (s1-0 (the-as int (-> s4-2 active-cell-count))) (let ((s0-0 (-> s4-2 active-cell-list s1-0))) (when (and (logtest? (-> s0-0 flags) (ash 1 s3-3)) (not (logtest? (-> s0-0 flags) (vis-cell-flag suppress)))) - (set! sv-48 0) - (while (< sv-48 (-> s0-0 incoming-segment-count)) - (set! sv-64 (-> s0-0 segment-array sv-48)) - (when (= (-> sv-64 tracker-id) s3-3) - (when (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) - (let ((f0-3 (rand-vu))) - (when (< f0-3 f30-0) - (set! f30-0 f0-3) - (set! s2-0 sv-64) + (let ((sv-48 0)) + (while (< sv-48 (-> s0-0 incoming-segment-count)) + (let ((sv-64 (-> s0-0 segment-array sv-48))) + (when (= (-> sv-64 tracker-id) s3-3) + (when (not (logtest? (-> s4-2 city-info cell-array (-> sv-64 from-cell-id) flags) (ash 1 s3-3))) + (let ((f0-3 (rand-vu))) + (when (< f0-3 f30-0) + (set! f30-0 f0-3) + (set! s2-0 sv-64) + ) + ) ) ) ) + (+! sv-48 1) ) - (set! sv-48 (+ sv-48 1)) ) ) ) @@ -2237,13 +2240,6 @@ ;; WARN: Stack slot offset 216 signed mismatch ;; WARN: Stack slot offset 216 signed mismatch (defmethod traffic-engine-method-49 ((this traffic-engine) (los vector) (arg2 int) (target-status traffic-target-status)) - (local-vars - (guards (array crimson-guard)) - (guard-target-dists (array float)) - (guard-idx int) - (sv-208 int) - (sv-216 float) - ) (logclear! (-> target-status flags) (traffic-target-flag visible-now updated)) (cond ((= (-> this sync-mask-16) (ash 1 (logand arg2 15))) @@ -2286,70 +2282,74 @@ (when (not (update-guard-status-spots target-pos)) ) (when (update-guard-status-spots target-pos) - (set! guards (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) - (set! guard-target-dists (the-as (array float) (new 'stack 'boxed-array float 16))) - (set! guard-idx 0) - (dotimes (guard-count (the-as int (-> this vehicle-tracker-array active-object-count))) - (case (-> this vehicle-tracker-array active-object-type-list guard-count) - (((traffic-type crimson-guard-1)) - (let ((guard (handle->process (-> this vehicle-tracker-array active-object-list guard-count)))) - (when (and guard - (not (focus-test? (the-as process-focusable guard) dead inactive)) - (= (-> (the-as crimson-guard guard) traffic-target-status handle) (-> target-status handle)) - ) - (set! (-> guards guard-idx) (the-as crimson-guard guard)) - (set! (-> guard-target-dists guard-idx) - (vector-vector-distance (-> (the-as crimson-guard guard) root trans) target-pos) - ) - (set! guard-idx (+ guard-idx 1)) - (set! (-> (the-as crimson-guard guard) move-index) -1) + (let ((guards (the-as (array crimson-guard) (new 'stack 'boxed-array crimson-guard 16))) + (guard-target-dists (the-as (array float) (new 'stack 'boxed-array float 16))) + (guard-idx 0) + ) + (dotimes (guard-count (the-as int (-> this vehicle-tracker-array active-object-count))) + (case (-> this vehicle-tracker-array active-object-type-list guard-count) + (((traffic-type crimson-guard-1)) + (let ((guard (handle->process (-> this vehicle-tracker-array active-object-list guard-count)))) + (when (and guard + (not (focus-test? (the-as process-focusable guard) dead inactive)) + (= (-> (the-as crimson-guard guard) traffic-target-status handle) (-> target-status handle)) + ) + (set! (-> guards guard-idx) (the-as crimson-guard guard)) + (set! (-> guard-target-dists guard-idx) + (vector-vector-distance (-> (the-as crimson-guard guard) root trans) target-pos) + ) + (+! guard-idx 1) + (set! (-> (the-as crimson-guard guard) move-index) -1) + ) ) ) - ) + ) ) - ) - (let ((a0-35 #t)) - (while a0-35 - (set! a0-35 #f) - (dotimes (v1-77 (+ guard-idx -1)) - (when (< (-> guard-target-dists (+ v1-77 1)) (-> guard-target-dists v1-77)) - (let ((a0-38 (-> guards v1-77)) - (f0-2 (-> guard-target-dists v1-77)) - ) - (set! (-> guards v1-77) (-> guards (+ v1-77 1))) - (set! (-> guards (+ v1-77 1)) a0-38) - (set! (-> guard-target-dists v1-77) (-> guard-target-dists (+ v1-77 1))) - (set! (-> guard-target-dists (+ v1-77 1)) f0-2) + (let ((a0-35 #t)) + (while a0-35 + (set! a0-35 #f) + (dotimes (v1-77 (+ guard-idx -1)) + (when (< (-> guard-target-dists (+ v1-77 1)) (-> guard-target-dists v1-77)) + (let ((a0-38 (-> guards v1-77)) + (f0-2 (-> guard-target-dists v1-77)) + ) + (set! (-> guards v1-77) (-> guards (+ v1-77 1))) + (set! (-> guards (+ v1-77 1)) a0-38) + (set! (-> guard-target-dists v1-77) (-> guard-target-dists (+ v1-77 1))) + (set! (-> guard-target-dists (+ v1-77 1)) f0-2) + ) + (set! a0-35 #t) ) - (set! a0-35 #t) ) ) ) - ) - (dotimes (s4-1 guard-idx) - (let ((crimson-guard (-> (the-as (array crimson-guard) guards) s4-1))) - (when (= (-> crimson-guard move-index) -1) - (set! sv-208 -1) - (set! sv-216 (the-as float (gpr->fpr #x7f800000))) - (dotimes (s2-4 (-> *guard-target-spots* length)) - (when (= (-> *guard-status-spots* s2-4) 1) - (let* ((a0-53 (vector+! (new 'stack-no-clear 'vector) target-pos (-> *guard-target-spots* s2-4))) - (f0-4 (vector-vector-distance a0-53 (-> crimson-guard root trans))) - ) - (when (or (= sv-208 -1) (< f0-4 sv-216)) - (set! sv-208 s2-4) - (set! sv-216 f0-4) + (dotimes (s4-1 guard-idx) + (let ((crimson-guard (-> (the-as (array crimson-guard) guards) s4-1))) + (when (= (-> crimson-guard move-index) -1) + (let ((sv-208 -1)) + (let ((sv-216 (the-as float (gpr->fpr #x7f800000)))) + (dotimes (s2-4 (-> *guard-target-spots* length)) + (when (= (-> *guard-status-spots* s2-4) 1) + (let* ((a0-53 (vector+! (new 'stack-no-clear 'vector) target-pos (-> *guard-target-spots* s2-4))) + (f0-4 (vector-vector-distance a0-53 (-> crimson-guard root trans))) + ) + (when (or (= sv-208 -1) (< f0-4 sv-216)) + (set! sv-208 s2-4) + (set! sv-216 f0-4) + ) + ) + ) + ) + ) + (cond + ((!= sv-208 -1) + (set! (-> *guard-status-spots* sv-208) 0) + (vector+! (-> crimson-guard move-position) target-pos (-> *guard-target-spots* sv-208)) + ) + (else + (set! (-> crimson-guard move-position quad) (-> target-pos quad)) ) ) - ) - ) - (cond - ((!= sv-208 -1) - (set! (-> *guard-status-spots* sv-208) 0) - (vector+! (-> crimson-guard move-position) target-pos (-> *guard-target-spots* sv-208)) - ) - (else - (set! (-> crimson-guard move-position quad) (-> target-pos quad)) ) ) ) @@ -2713,11 +2713,10 @@ (dotimes (v1-0 6) (set! (-> this alert-state guard-type-info-array v1-0 count) 0) ) - (let* ((f0-0 122880.0) - (f0-2 (* f0-0 f0-0)) - (a0-3 (the-as vehicle #f)) - (v1-5 0) - ) + (let ((f0-2 (square 122880.0)) + (a0-3 (the-as vehicle #f)) + (v1-5 0) + ) (let ((a1-0 0)) (dotimes (a2-0 (the-as int (-> this citizen-tracker-array active-object-count))) (case (-> this citizen-tracker-array active-object-type-list a2-0) @@ -3437,54 +3436,47 @@ (arg2 traffic-find-segment-struct) (arg3 (function traffic-find-segment-struct nav-segment none)) ) - (local-vars - (sv-16 city-level-info) - (sv-20 vector) - (sv-24 int) - (sv-28 traffic-find-segment-struct) - (sv-32 (function traffic-find-segment-struct nav-segment none)) - (sv-80 vis-grid-box) - (sv-84 vis-grid-box) - ) - (set! sv-16 this) - (set! sv-20 arg0) - (set! sv-24 arg1) - (set! sv-28 arg2) - (set! sv-32 arg3) - (set! sv-80 (new 'stack-no-clear 'vis-grid-box)) - (set! sv-84 (new 'stack-no-clear 'vis-grid-box)) - (lookup-box-for-sphere (-> sv-16 grid-info) sv-80 sv-20) - (set! (-> sv-84 min y) (-> sv-80 min y)) - (countdown (gp-0 (+ (- 1 (-> sv-80 min y)) (-> sv-80 max y))) - (set! (-> sv-84 min z) (-> sv-80 min z)) - (countdown (s5-0 (+ (- 1 (-> sv-80 min z)) (-> sv-80 max z))) - (set! (-> sv-84 min x) (-> sv-80 min x)) - (countdown (s4-0 (+ (- 1 (-> sv-80 min x)) (-> sv-80 max x))) - (let* ((a0-17 sv-16) - (a2-2 sv-84) - (v1-18 - (-> a0-17 - cell-array - (+ (-> a2-2 min x) - (* (-> a2-2 min z) (-> a0-17 grid-info dimension-array 0)) - (* (* (-> a2-2 min y) (-> a0-17 grid-info dimension-array 0)) (-> a0-17 grid-info dimension-array 2)) - ) - ) - ) - (s3-0 (-> v1-18 segment-array 0)) - ) - (countdown (s2-0 (-> v1-18 segment-count)) - (if (and (= (-> s3-0 tracker-id) sv-24) (line-sphere-intersection? sv-20 (-> s3-0 vertex 0) (-> s3-0 vertex 1))) - (sv-32 sv-28 s3-0) - ) - (&+! s3-0 48) - ) - ) - (+! (-> sv-84 min x) 1) + (let ((sv-16 this) + (sv-20 arg0) + (sv-24 arg1) + (sv-28 arg2) + (sv-32 arg3) + (sv-80 (new 'stack-no-clear 'vis-grid-box)) + (sv-84 (new 'stack-no-clear 'vis-grid-box)) ) - (+! (-> sv-84 min z) 1) + (lookup-box-for-sphere (-> sv-16 grid-info) sv-80 sv-20) + (set! (-> sv-84 min y) (-> sv-80 min y)) + (countdown (gp-0 (+ (- 1 (-> sv-80 min y)) (-> sv-80 max y))) + (set! (-> sv-84 min z) (-> sv-80 min z)) + (countdown (s5-0 (+ (- 1 (-> sv-80 min z)) (-> sv-80 max z))) + (set! (-> sv-84 min x) (-> sv-80 min x)) + (countdown (s4-0 (+ (- 1 (-> sv-80 min x)) (-> sv-80 max x))) + (let* ((a0-17 sv-16) + (a2-2 sv-84) + (v1-18 + (-> a0-17 + cell-array + (+ (-> a2-2 min x) + (* (-> a2-2 min z) (-> a0-17 grid-info dimension-array 0)) + (* (* (-> a2-2 min y) (-> a0-17 grid-info dimension-array 0)) (-> a0-17 grid-info dimension-array 2)) + ) + ) + ) + (s3-0 (-> v1-18 segment-array 0)) + ) + (countdown (s2-0 (-> v1-18 segment-count)) + (if (and (= (-> s3-0 tracker-id) sv-24) (line-sphere-intersection? sv-20 (-> s3-0 vertex 0) (-> s3-0 vertex 1))) + (sv-32 sv-28 s3-0) + ) + (&+! s3-0 48) + ) + ) + (+! (-> sv-84 min x) 1) + ) + (+! (-> sv-84 min z) 1) + ) + (+! (-> sv-84 min y) 1) ) - (+! (-> sv-84 min y) 1) ) 0 (none) @@ -3594,19 +3586,14 @@ ) (dotimes (s4-0 (the-as int (-> this city-info cell-count))) (let ((s3-0 (-> this city-info cell-array s4-0))) - (let ((f24-0 (vector-vector-distance-squared (-> s3-0 sphere) s5-0)) - (f0-1 (+ (-> s3-0 sphere r) f28-0)) - ) + (let ((f24-0 (vector-vector-distance-squared (-> s3-0 sphere) s5-0))) (cond - ((or (< (* f0-1 f0-1) f24-0) (let ((f0-5 (+ (-> s3-0 sphere r) f30-0))) - (and (< (* f0-5 f0-5) f24-0) (not (sphere-in-view-frustum? (-> s3-0 sphere)))) - ) + ((or (< (square (+ (-> s3-0 sphere r) f28-0)) f24-0) + (and (< (square (+ (-> s3-0 sphere r) f30-0)) f24-0) (not (sphere-in-view-frustum? (-> s3-0 sphere)))) ) (logclear! (-> s3-0 flags) (vis-cell-flag active-vehicle active-pedestrian)) ) - ((let ((f0-9 (+ (-> s3-0 sphere r) f26-0))) - (< (* f0-9 f0-9) f24-0) - ) + ((< (square (+ (-> s3-0 sphere r) f26-0)) f24-0) (let ((v1-17 (logior (-> s3-0 flags) (vis-cell-flag active-vehicle)))) (set! (-> s3-0 flags) (logclear v1-17 (vis-cell-flag active-pedestrian))) ) @@ -3845,13 +3832,10 @@ (if s3-0 (vector-float*! (-> s5-0 1) (-> s5-0 1) -1.0) ) - (let* ((f0-29 f30-0) - (f0-31 (* f0-29 f0-29)) - (f1-9 f28-0) - (f1-12 (sqrtf (fabs (- f0-31 (* f1-9 f1-9))))) + (let* ((f1-12 (sqrtf (fabs (- (square f30-0) (square f28-0))))) (f0-35 (/ (* f28-0 f1-12) f30-0)) ) - (let ((f1-15 (/ (* f1-12 f1-12) f30-0))) + (let ((f1-15 (/ (square f1-12) f30-0))) (set! (-> arg2 quad) (-> arg0 quad)) (let ((a1-13 arg2)) (let ((v1-26 arg2)) @@ -3903,11 +3887,10 @@ ;; WARN: Stack slot offset 48 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod city-level-info-method-18 ((this city-level-info)) - (local-vars (sv-48 int)) - (let ((gp-0 (new 'stack-no-clear 'bounding-box)) - (s5-0 (-> this nav-graph)) - ) - (set! sv-48 (-> s5-0 node-count)) + (let* ((gp-0 (new 'stack-no-clear 'bounding-box)) + (s5-0 (-> this nav-graph)) + (sv-48 (-> s5-0 node-count)) + ) (dotimes (s4-0 sv-48) (let ((s3-0 (-> s5-0 node-array s4-0))) (set-id-and-link-branches-back s3-0 (the-as uint s4-0)) @@ -3965,25 +3948,6 @@ ;; WARN: Stack slot offset 100 signed mismatch ;; WARN: Return type mismatch object vs symbol. (defmethod city-level-info-method-9 ((this city-level-info)) - (local-vars - (sv-96 (inline-array nav-node)) - (sv-100 int) - (sv-104 vis-ray) - (sv-112 int) - (sv-160 nav-node) - (sv-164 vector) - (sv-168 vector) - (sv-172 vis-cell) - (sv-176 int) - (sv-184 nav-branch) - (sv-240 nav-node) - (sv-244 vector) - (sv-248 vector) - (sv-252 vector) - (sv-256 nav-segment) - (sv-260 vis-cell) - (sv-264 int) - ) (set! (-> this cell-count) (the-as uint (* (* (-> this grid-info dimension-array 0) (-> this grid-info dimension-array 1)) (-> this grid-info dimension-array 2) @@ -3998,173 +3962,180 @@ (format 0 "segments not generates~%") (return (the-as symbol #t)) ) - (set! sv-96 (-> this nav-graph node-array)) - (set! sv-100 (-> this nav-graph node-count)) - (set! sv-104 (new 'stack-no-clear 'vis-ray)) - (set! sv-112 0) - (dotimes (s4-1 sv-100) - (let ((s3-0 (-> sv-96 s4-1))) - (dotimes (s2-0 (-> s3-0 branch-count)) - (let* ((a2-0 (-> s3-0 branch-array s2-0)) - (f0-1 0.0) - (v1-19 a2-0) - ) - (when (< f0-1 (* 0.0078125 (the float (-> v1-19 density)))) - (set! sv-160 (-> a2-0 dest-node)) - (set! sv-164 (new 'stack-no-clear 'vector)) - (set! sv-168 (new 'stack-no-clear 'vector)) - (set! sv-172 (the-as vis-cell #f)) - (set! sv-176 0) - (let ((a1-1 s3-0) - (v1-26 sv-168) - ) - (set! (-> v1-26 quad) (-> a1-1 position quad)) - (set! (-> v1-26 w) 1.0) - ) - (cond - ((logtest? (-> s3-0 flags) (nav-node-flag-byte pedestrian)) - (let ((a1-4 (-> a2-0 dest-node)) - (v1-29 sv-164) - ) - (set! (-> v1-29 quad) (-> a1-4 position quad)) - (set! (-> v1-29 w) 1.0) - ) - ) - (else - (city-level-info-method-12 this sv-168 a2-0 sv-164) - ) - ) - (init-vis-ray this sv-104 sv-168 sv-164) - (while (< 0.0 (-> sv-104 len)) - (set! sv-172 (-> sv-104 cell)) - (city-level-info-method-11 this sv-104) - (+! (-> sv-172 segment-count) 1) - (set! sv-112 (+ sv-112 1)) - (if (> sv-176 0) - (+! (-> sv-172 incoming-segment-count) 1) - ) - (set! sv-176 (+ sv-176 1)) - ) - ) - ) + (let ((sv-96 (-> this nav-graph node-array)) + (sv-100 (-> this nav-graph node-count)) + (sv-104 (new 'stack-no-clear 'vis-ray)) ) - ) - ) - (format 0 "~d segments were generated~%" sv-112) - (set! (-> this segment-array) (the-as (inline-array nav-segment) (malloc 'debug (* 48 sv-112)))) - (let ((v1-59 0)) - (dotimes (a0-20 (the-as int s5-0)) - (let ((a1-14 (-> this cell-array a0-20))) - (set! (-> a1-14 id) (the-as uint a0-20)) - (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) #f)) - (when (> (-> a1-14 segment-count) 0) - (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) (-> this segment-array v1-59))) - (dotimes (a2-8 (-> a1-14 segment-count)) - (let ((a3-5 (-> a1-14 segment-array a2-8))) - (set! (-> a3-5 id) (the-as uint v1-59)) - (set! (-> a3-5 cell-id) (the-as uint #xffff)) - ) - (+! v1-59 1) - ) - ) - (set! (-> a1-14 flags) (the-as vis-cell-flag (-> a1-14 segment-count))) - (set! (-> a1-14 segment-count) 0) - (set! (-> a1-14 incoming-segment-count) 0) - ) - 0 - ) - (set! (-> this segment-count) v1-59) - ) - ) - (dotimes (s5-1 sv-100) - (let ((s4-2 (-> sv-96 s5-1))) - (dotimes (s3-1 (-> s4-2 branch-count)) - (set! sv-184 (-> s4-2 branch-array s3-1)) - (let ((f0-5 0.0) - (v1-63 sv-184) - ) - (when (< f0-5 (* 0.0078125 (the float (-> v1-63 density)))) - (set! sv-240 (-> sv-184 dest-node)) - (set! sv-244 (new 'stack-no-clear 'vector)) - (set! sv-248 (new 'stack-no-clear 'vector)) - (set! sv-252 (new 'stack-no-clear 'vector)) - (set! sv-256 (the-as nav-segment #f)) - (set! sv-260 (the-as vis-cell #f)) - (set! sv-264 0) - (let ((a1-16 s4-2) - (v1-72 sv-244) - ) - (set! (-> v1-72 quad) (-> a1-16 position quad)) - (set! (-> v1-72 w) 1.0) - ) - (cond - ((logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) - (let ((a1-19 (-> sv-184 dest-node)) - (v1-76 sv-252) + (let ((sv-112 0)) + (dotimes (s4-1 sv-100) + (let ((s3-0 (-> sv-96 s4-1))) + (dotimes (s2-0 (-> s3-0 branch-count)) + (let* ((a2-0 (-> s3-0 branch-array s2-0)) + (f0-1 0.0) + (v1-19 a2-0) ) - (set! (-> v1-76 quad) (-> a1-19 position quad)) - (set! (-> v1-76 w) 1.0) - ) - ) - (else - (city-level-info-method-12 this sv-244 sv-184 sv-252) + (when (< f0-1 (* 0.0078125 (the float (-> v1-19 density)))) + (let ((sv-160 (-> a2-0 dest-node))) + ) + (let ((sv-164 (new 'stack-no-clear 'vector)) + (sv-168 (new 'stack-no-clear 'vector)) + (sv-172 (the-as vis-cell #f)) + (sv-176 0) + ) + (let ((a1-1 s3-0) + (v1-26 sv-168) + ) + (set! (-> v1-26 quad) (-> a1-1 position quad)) + (set! (-> v1-26 w) 1.0) + ) + (cond + ((logtest? (-> s3-0 flags) (nav-node-flag-byte pedestrian)) + (let ((a1-4 (-> a2-0 dest-node)) + (v1-29 sv-164) + ) + (set! (-> v1-29 quad) (-> a1-4 position quad)) + (set! (-> v1-29 w) 1.0) + ) + ) + (else + (city-level-info-method-12 this sv-168 a2-0 sv-164) + ) + ) + (init-vis-ray this sv-104 sv-168 sv-164) + (while (< 0.0 (-> sv-104 len)) + (set! sv-172 (-> sv-104 cell)) + (city-level-info-method-11 this sv-104) + (+! (-> sv-172 segment-count) 1) + (+! sv-112 1) + (if (> sv-176 0) + (+! (-> sv-172 incoming-segment-count) 1) + ) + (+! sv-176 1) + ) + ) + ) ) ) - (init-vis-ray this sv-104 sv-244 sv-252) - (while (< 0.0 (-> sv-104 len)) - (set! (-> sv-248 quad) (-> sv-104 pos quad)) - (set! sv-260 (-> sv-104 cell)) - (city-level-info-method-11 this sv-104) - (let ((a2-14 (-> sv-260 incoming-segment-count))) - (if (zero? sv-264) - (set! a2-14 - (+ (- -1 (-> sv-260 segment-count)) (-> sv-260 incoming-segment-count) (-> sv-260 alloc-segment-count)) - ) - ) - (when (or (< a2-14 0) (>= a2-14 (-> sv-260 alloc-segment-count))) - (format - 0 - "******************************************************** bad i-seg ~d ************************************************~%" - a2-14 - ) - (return (the-as symbol #f)) + ) + ) + (format 0 "~d segments were generated~%" sv-112) + (set! (-> this segment-array) (the-as (inline-array nav-segment) (malloc 'debug (* 48 sv-112)))) + ) + (let ((v1-59 0)) + (dotimes (a0-20 (the-as int s5-0)) + (let ((a1-14 (-> this cell-array a0-20))) + (set! (-> a1-14 id) (the-as uint a0-20)) + (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) #f)) + (when (> (-> a1-14 segment-count) 0) + (set! (-> a1-14 segment-array) (the-as (inline-array nav-segment) (-> this segment-array v1-59))) + (dotimes (a2-8 (-> a1-14 segment-count)) + (let ((a3-5 (-> a1-14 segment-array a2-8))) + (set! (-> a3-5 id) (the-as uint v1-59)) + (set! (-> a3-5 cell-id) (the-as uint #xffff)) ) - (let ((s2-1 (-> sv-260 segment-array a2-14))) - (set! (-> s2-1 vertex 0 quad) (-> sv-248 quad)) - (set! (-> s2-1 vertex 1 quad) (-> sv-104 pos quad)) - (set! (-> s2-1 length) (vector-vector-distance (-> s2-1 vertex 0) (-> s2-1 vertex 1))) - (let* ((f0-9 (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) - 24576.0 - 49152.0 - ) - ) - (f1-8 -1.0) - (f2-4 0.0001) - (v1-107 sv-184) - (f2-5 (fmax f2-4 (* 0.0078125 (the float (-> v1-107 density))))) - ) - (set! (-> s2-1 spawn-spacing) (* f0-9 (+ f1-8 (/ 1.0 f2-5)))) + (+! v1-59 1) + ) + ) + (set! (-> a1-14 flags) (the-as vis-cell-flag (-> a1-14 segment-count))) + (set! (-> a1-14 segment-count) 0) + (set! (-> a1-14 incoming-segment-count) 0) + ) + 0 + ) + (set! (-> this segment-count) v1-59) + ) + (dotimes (s5-1 sv-100) + (let ((s4-2 (-> sv-96 s5-1))) + (dotimes (s3-1 (-> s4-2 branch-count)) + (let* ((sv-184 (-> s4-2 branch-array s3-1)) + (v1-63 sv-184) + ) + (when (< 0.0 (* 0.0078125 (the float (-> v1-63 density)))) + (let ((sv-240 (-> sv-184 dest-node))) + ) + (let ((sv-244 (new 'stack-no-clear 'vector)) + (sv-248 (new 'stack-no-clear 'vector)) + (sv-252 (new 'stack-no-clear 'vector)) + (sv-256 (the-as nav-segment #f)) + (sv-260 (the-as vis-cell #f)) + (sv-264 0) + ) + (let ((a1-16 s4-2) + (v1-72 sv-244) + ) + (set! (-> v1-72 quad) (-> a1-16 position quad)) + (set! (-> v1-72 w) 1.0) ) - (set! (-> s2-1 cell-id) (-> sv-260 id)) - (set! (-> s2-1 branch) sv-184) - (set! (-> s2-1 from-cell-id) (the-as uint #xffff)) - (set! (-> s2-1 nav-mesh-id) (-> s4-2 nav-mesh-id)) - (set! (-> s2-1 tracker-id) 0) - (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) - (set! (-> s2-1 tracker-id) 1) + (cond + ((logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) + (let ((a1-19 (-> sv-184 dest-node)) + (v1-76 sv-252) + ) + (set! (-> v1-76 quad) (-> a1-19 position quad)) + (set! (-> v1-76 w) 1.0) + ) + ) + (else + (city-level-info-method-12 this sv-244 sv-184 sv-252) ) - (if sv-256 - (set! (-> s2-1 from-cell-id) (-> (the-as nav-segment sv-256) cell-id)) + ) + (init-vis-ray this sv-104 sv-244 sv-252) + (while (< 0.0 (-> sv-104 len)) + (set! (-> sv-248 quad) (-> sv-104 pos quad)) + (set! sv-260 (-> sv-104 cell)) + (city-level-info-method-11 this sv-104) + (let ((a2-14 (-> sv-260 incoming-segment-count))) + (if (zero? sv-264) + (set! a2-14 + (+ (- -1 (-> sv-260 segment-count)) (-> sv-260 incoming-segment-count) (-> sv-260 alloc-segment-count)) + ) + ) + (when (or (< a2-14 0) (>= a2-14 (-> sv-260 alloc-segment-count))) + (format + 0 + "******************************************************** bad i-seg ~d ************************************************~%" + a2-14 + ) + (return (the-as symbol #f)) + ) + (let ((s2-1 (-> sv-260 segment-array a2-14))) + (set! (-> s2-1 vertex 0 quad) (-> sv-248 quad)) + (set! (-> s2-1 vertex 1 quad) (-> sv-104 pos quad)) + (set! (-> s2-1 length) (vector-vector-distance (-> s2-1 vertex 0) (-> s2-1 vertex 1))) + (let* ((f0-9 (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) + 24576.0 + 49152.0 + ) + ) + (f1-8 -1.0) + (v1-107 sv-184) + (f2-5 (fmax 0.0001 (* 0.0078125 (the float (-> v1-107 density))))) + ) + (set! (-> s2-1 spawn-spacing) (* f0-9 (+ f1-8 (/ 1.0 f2-5)))) + ) + (set! (-> s2-1 cell-id) (-> sv-260 id)) + (set! (-> s2-1 branch) sv-184) + (set! (-> s2-1 from-cell-id) (the-as uint #xffff)) + (set! (-> s2-1 nav-mesh-id) (-> s4-2 nav-mesh-id)) + (set! (-> s2-1 tracker-id) 0) + (if (logtest? (-> s4-2 flags) (nav-node-flag-byte pedestrian)) + (set! (-> s2-1 tracker-id) 1) + ) + (if sv-256 + (set! (-> s2-1 from-cell-id) (-> (the-as nav-segment sv-256) cell-id)) + ) + (set! sv-256 s2-1) + ) ) - (set! sv-256 s2-1) + 0 + (+! (-> sv-260 segment-count) 1) + (if (> sv-264 0) + (+! (-> sv-260 incoming-segment-count) 1) + ) + (+! sv-264 1) + ) ) ) - 0 - (+! (-> sv-260 segment-count) 1) - (if (> sv-264 0) - (+! (-> sv-260 incoming-segment-count) 1) - ) - (set! sv-264 (+ sv-264 1)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-control_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-control_REF.gc index 551d45573f..cd79c5b5dd 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-control_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-control_REF.gc @@ -230,13 +230,10 @@ (if (logtest? (-> this flags) (vehicle-controller-flag left-turn)) (vector-float*! (-> s4-0 normal) (-> s4-0 normal) -1.0) ) - (let* ((f0-10 f30-0) - (f0-12 (* f0-10 f0-10)) - (f1-3 f28-0) - (f1-6 (sqrtf (- f0-12 (* f1-3 f1-3)))) + (let* ((f1-6 (sqrtf (- (square f30-0) (square f28-0)))) (f0-15 (/ (* f28-0 f1-6) f30-0)) ) - (let ((f1-9 (/ (* f1-6 f1-6) f30-0))) + (let ((f1-9 (/ (square f1-6) f30-0))) (set! (-> arg1 quad) (-> arg0 quad)) (let ((a1-5 arg1)) (let ((v1-12 arg1)) @@ -293,7 +290,7 @@ (if (< 0.0 f1-1) (set! f3-0 (fmax 0.0 (fmin (/ (- f2-1) f1-1) arg4))) ) - (+ f0-1 (* 2.0 f2-1 f3-0) (* f3-0 f3-0 f1-1)) + (+ f0-1 (* 2.0 f2-1 f3-0) (* (square f3-0) f1-1)) ) ) ) @@ -318,16 +315,7 @@ ;; WARN: Stack slot offset 20 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod vehicle-controller-method-18 ((this vehicle-controller) (arg0 vector) (arg1 vector) (arg2 vehicle) (arg3 float)) - (local-vars - (v1-24 float) - (v1-88 float) - (a0-35 float) - (a0-96 int) - (a0-98 int) - (sv-16 vector) - (sv-20 float) - (sv-24 float) - ) + (local-vars (v1-24 float) (v1-88 float) (a0-35 float) (a0-96 int) (a0-98 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -352,10 +340,11 @@ (.sync.p) (label cfg-2) 0 - (set! sv-16 arg0) - (set! sv-20 arg3) - (set! sv-24 (-> arg2 info info inv-mass)) - (let ((gp-0 (new 'stack-no-clear 'inline-array 'vector 16))) + (let ((sv-16 arg0) + (sv-20 arg3) + (sv-24 (-> arg2 info info inv-mass)) + (gp-0 (new 'stack-no-clear 'inline-array 'vector 16)) + ) (set! (-> gp-0 15 x) (+ (-> this target-speed) (-> this target-speed-offset))) (set! (-> gp-0 1 quad) (-> arg1 quad)) (set! (-> gp-0 0 quad) (-> arg2 root trans quad)) @@ -379,13 +368,9 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-24 vf1) - (let ((f2-2 v1-24) - (f3-1 (-> this max-turn-speed)) - ) - (if (>= (* f1-4 (- f2-2 (* f3-1 f3-1))) f0-5) - (set! (-> gp-0 15 x) (fmin (-> gp-0 15 x) (-> this max-turn-speed))) - ) - ) + (if (>= (* f1-4 (- v1-24 (square (-> this max-turn-speed)))) f0-5) + (set! (-> gp-0 15 x) (fmin (-> gp-0 15 x) (-> this max-turn-speed))) + ) ) ) ) @@ -419,11 +404,7 @@ (set! (-> gp-0 4 y) (-> gp-0 0 y)) (when (and (nonzero? (-> this traffic)) (not (logtest? (-> this flags) (vehicle-controller-flag ignore-others))) - (let ((f0-22 (-> arg2 camera-dist2)) - (f1-9 1228800.0) - ) - (< f0-22 (* f1-9 f1-9)) - ) + (< (-> arg2 camera-dist2) (square 1228800.0)) ) (let ((s3-1 (new 'stack-no-clear 'array 'collide-shape 12)) (f30-1 (-> arg2 root root-prim prim-core world-sphere w)) @@ -456,9 +437,7 @@ (let ((f1-12 a0-35)) (vector-float*! (-> gp-0 14) (-> gp-0 12) (/ 1.0 (sqrtf f1-12))) (when #t - (let* ((f0-28 (+ f30-1 (-> v1-70 root root-prim prim-core world-sphere w))) - (f28-0 (* f0-28 f0-28)) - ) + (let ((f28-0 (square (+ f30-1 (-> v1-70 root root-prim prim-core world-sphere w))))) (let ((f0-31 (fmax 0.0 (/ (- f28-0 f1-12) f28-0)))) (when (not (logtest? (-> v1-70 flags) (rigid-body-object-flag player-driving))) (when (and (< 0.0 sv-20) (< f1-12 f28-0)) @@ -505,18 +484,10 @@ (.mov v1-88 vf1) (let ((f0-39 v1-88)) (logclear! (-> this flags) (vehicle-controller-flag off-path)) - (let ((f1-23 4096.0)) - (when (< (* f1-23 f1-23) f0-39) - (logior! (-> this flags) (vehicle-controller-flag off-path)) - (let ((t9-8 vector-normalize!) - (a0-69 (-> gp-0 6)) - (f1-26 12288.0) - (f2-12 4096.0) - ) - (t9-8 a0-69 (fmin f1-26 (- f0-39 (* f2-12 f2-12)))) - ) - (vector+! (-> gp-0 2) (-> gp-0 2) (-> gp-0 6)) - ) + (when (< (square 4096.0) f0-39) + (logior! (-> this flags) (vehicle-controller-flag off-path)) + (vector-normalize! (-> gp-0 6) (fmin 12288.0 (- f0-39 (square 4096.0)))) + (vector+! (-> gp-0 2) (-> gp-0 2) (-> gp-0 6)) ) ) (vector+float*! (-> gp-0 6) (-> gp-0 1) (-> gp-0 5) (- (vector-dot (-> gp-0 5) (-> gp-0 1)))) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-effects_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-effects_REF.gc index 9e2fbad09d..3e9e172a94 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-effects_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-effects_REF.gc @@ -62,9 +62,7 @@ (set! (-> this engine-sound-factor) f30-0) (cond (#f - (let* ((f0-23 40960.0) - (f0-25 (* f0-23 f0-23)) - ) + (let ((f0-25 (square 40960.0))) (.lvf vf1 (&-> (-> this rbody state lin-velocity) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -316,7 +314,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-thrusters ((this vehicle)) - (local-vars (sv-272 sparticle-launcher) (sv-276 sparticle-launcher)) (when (= (-> this controller traffic sync-mask-32) (ash 1 (logand (-> this traffic-priority-id) 31))) (let ((f0-1 (+ (-> *time-of-day-context* time) (* 0.048387095 (the float (logand (-> this traffic-priority-id) 31)))) @@ -388,20 +385,16 @@ (set! (-> s4-0 color y) (rand-vu-float-range 192.0 255.0)) (set! (-> s4-0 color w) (* f30-1 (rand-vu-float-range 16.0 18.0))) (add! *simple-sprite-system* s4-0) - (let ((f0-21 (-> this camera-dist2)) - (f1-6 245760.0) - ) - (when (< f0-21 (* f1-6 f1-6)) - (let ((f0-22 3276.8)) - (set! (-> s4-0 position w) f0-22) - (set! (-> s4-0 size-y) f0-22) - ) - (set! (-> s4-0 fade-a) -0.00001356) - (set! (-> s4-0 fade-b) 2.3332994) - (set! (-> s4-0 color z) (rand-vu-float-range 128.0 160.0)) - (set! (-> s4-0 color w) (* f30-1 (rand-vu-float-range 32.0 36.0))) - (add! *simple-sprite-system* s4-0) + (when (< (-> this camera-dist2) (square 245760.0)) + (let ((f0-22 3276.8)) + (set! (-> s4-0 position w) f0-22) + (set! (-> s4-0 size-y) f0-22) ) + (set! (-> s4-0 fade-a) -0.00001356) + (set! (-> s4-0 fade-b) 2.3332994) + (set! (-> s4-0 color z) (rand-vu-float-range 128.0 160.0)) + (set! (-> s4-0 color w) (* f30-1 (rand-vu-float-range 32.0 36.0))) + (add! *simple-sprite-system* s4-0) ) ) ) @@ -443,10 +436,7 @@ (set! (-> *part-id-table* 776 init-specs 2 initial-valuef) (* 6.0 (+ 0.25 (-> this engine-power-factor)) (rand-vu)) ) - (let* ((f0-40 1.0) - (f1-15 (-> this engine-power-factor)) - (f0-41 (- f0-40 (* f1-15 f1-15))) - ) + (let ((f0-41 (- 1.0 (square (-> this engine-power-factor))))) (set! (-> *part-id-table* 776 init-specs 9 initial-valuef) (* 16.0 f0-41)) (set! (-> *part-id-table* 776 init-specs 9 random-rangef) (* 48.0 f0-41)) ) @@ -497,74 +487,79 @@ (set! (-> s5-0 0 trans y) f28-6) (set! (-> s5-0 0 trans z) (* f30-6 f26-0)) ) - (set! sv-272 (the-as sparticle-launcher #f)) - (set! sv-276 (the-as sparticle-launcher #f)) - (cond - ((< (-> this hit-points) 0.25) - (set! sv-272 (-> *part-id-table* 778)) - (set! sv-276 (-> *part-id-table* 774)) - ) - ((< (-> this hit-points) 0.5) - (set! sv-272 (-> *part-id-table* 781)) - ) - (else - (if (< (rand-vu) 0.05) - (set! sv-272 (-> *part-id-table* 783)) + (let ((sv-272 (the-as sparticle-launcher #f)) + (sv-276 (the-as sparticle-launcher #f)) + ) + (set! sv-272 (cond + ((< (-> this hit-points) 0.25) + (set! sv-272 (-> *part-id-table* 778)) + (set! sv-276 (-> *part-id-table* 774)) + sv-272 + ) + ((< (-> this hit-points) 0.5) + (-> *part-id-table* 781) + ) + (else + (if (< (rand-vu) 0.05) + (set! sv-272 (-> *part-id-table* 783)) + ) + sv-272 + ) + ) ) - ) - ) - (when sv-272 - (let ((s3-3 #f)) - (dotimes (s4-4 2) - (vector-rotate*! (-> s5-0 0 vector 2) (-> this info smoke-local-vel s4-4) (-> s5-0 1)) - (vector+! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> this rbody state lin-velocity)) - (vector+float*! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> s5-0 0 trans) (* 24576.0 (rand-vu))) - (let ((v1-152 (-> this info part-vel)) - (a0-54 (-> s5-0 0 vector 2)) - (f0-63 300.0) - ) - (vector-float*! v1-152 a0-54 (/ 1.0 f0-63)) - ) - (vector-matrix*! (the-as vector (-> s5-0 0)) (-> this info smoke-local-pos s4-4) (-> s5-0 1)) - (when (and sv-276 (< (rand-vu) 0.005)) - (let ((t9-37 sp-launch-particles-var) - (a0-56 (-> this info particle-system-2d)) - (a1-44 sv-276) - (a2-17 *launch-matrix*) + (when sv-272 + (let ((s3-3 #f)) + (dotimes (s4-4 2) + (vector-rotate*! (-> s5-0 0 vector 2) (-> this info smoke-local-vel s4-4) (-> s5-0 1)) + (vector+! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> this rbody state lin-velocity)) + (vector+float*! (-> s5-0 0 vector 2) (-> s5-0 0 vector 2) (-> s5-0 0 trans) (* 24576.0 (rand-vu))) + (let ((v1-152 (-> this info part-vel)) + (a0-54 (-> s5-0 0 vector 2)) + (f0-63 300.0) ) - (set! (-> a2-17 trans quad) (-> s5-0 0 quad 0)) - (t9-37 - (the-as sparticle-system a0-56) - a1-44 - a2-17 + (vector-float*! v1-152 a0-54 (/ 1.0 f0-63)) + ) + (vector-matrix*! (the-as vector (-> s5-0 0)) (-> this info smoke-local-pos s4-4) (-> s5-0 1)) + (when (and sv-276 (< (rand-vu) 0.005)) + (let ((t9-37 sp-launch-particles-var) + (a0-56 (-> this info particle-system-2d)) + (a1-44 sv-276) + (a2-17 *launch-matrix*) + ) + (set! (-> a2-17 trans quad) (-> s5-0 0 quad 0)) + (t9-37 + (the-as sparticle-system a0-56) + a1-44 + a2-17 + (the-as sparticle-launch-state #f) + (the-as sparticle-launch-control #f) + 1.0 + ) + ) + (set! s3-3 #t) + ) + (set! (-> sv-272 birthaccum) (the-as float (-> this smoke-part-accum s4-4))) + (let ((t9-38 sp-launch-particles-var) + (a0-57 (-> this info particle-system-2d)) + (a1-45 sv-272) + (a2-18 *launch-matrix*) + ) + (set! (-> a2-18 trans quad) (-> s5-0 0 quad 0)) + (t9-38 + (the-as sparticle-system a0-57) + a1-45 + a2-18 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0 ) ) - (set! s3-3 #t) + (set! (-> this smoke-part-accum s4-4) (the-as basic (-> sv-272 birthaccum))) ) - (set! (-> sv-272 birthaccum) (the-as float (-> this smoke-part-accum s4-4))) - (let ((t9-38 sp-launch-particles-var) - (a0-57 (-> this info particle-system-2d)) - (a1-45 sv-272) - (a2-18 *launch-matrix*) - ) - (set! (-> a2-18 trans quad) (-> s5-0 0 quad 0)) - (t9-38 - (the-as sparticle-system a0-57) - a1-45 - a2-18 - (the-as sparticle-launch-state #f) - (the-as sparticle-launch-control #f) - 1.0 + (if s3-3 + (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) ) - ) - (set! (-> this smoke-part-accum s4-4) (the-as basic (-> sv-272 birthaccum))) ) - (if s3-3 - (sound-play "damage-zaps" :id (-> this damage-zap-sound-id)) - ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc index f7ff59c473..89375588b3 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-guard_REF.gc @@ -792,10 +792,10 @@ (cond ((< -12288.0 (- (-> arg0 tpos y) (-> arg0 spos y))) (logior! (-> this controller flags) (vehicle-controller-flag ignore-others no-slowing-for-turns)) - (let* ((f0-9 (* 2.0 (-> this info max-xz-speed))) - (f1-8 (fmax 0.0 (vector-dot (-> arg0 sdir) (-> arg0 to-target-dir)))) - (f0-10 (* f0-9 (* f1-8 f1-8))) - ) + (let ((f0-10 + (* 2.0 (-> this info max-xz-speed) (square (fmax 0.0 (vector-dot (-> arg0 sdir) (-> arg0 to-target-dir))))) + ) + ) (+! (-> this controller target-speed) f0-10) ) ) @@ -1183,11 +1183,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-11 vf1) - (let ((f0-2 v1-11) - (f1-3 61440.0) - ) - (< f0-2 (* f1-3 f1-3)) - ) + (< v1-11 (square 61440.0)) ) (< (-> arg0 dist) 122880.0) ) @@ -1383,10 +1379,7 @@ (go-virtual hostile) ) (speech-control-method-12 *speech-control* self (speech-type speech-type-4)) - (if (or (time-elapsed? (-> self state-time) (seconds 8)) (let ((f0-0 409600.0)) - (< (* f0-0 f0-0) (-> self player-dist2)) - ) - ) + (if (or (time-elapsed? (-> self state-time) (seconds 8)) (< (square 409600.0) (-> self player-dist2))) (logclear! (-> self flags) (rigid-body-object-flag persistent alert)) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-physics_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-physics_REF.gc index bf9ec949c4..7308b370fd 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-physics_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-physics_REF.gc @@ -35,11 +35,8 @@ ) (rigid-body-method-22 (-> v1-18 state) (-> a1-1 0) a2-0) ) - (let* ((f0-7 (* 0.062831804 (fmin 200.0 (vector-length (-> s4-0 normal))) f30-0)) - (f1-8 (-> s0-0 world-sphere w)) - (f0-8 (* f0-7 (* f1-8 f1-8))) - (f1-11 4096.0) - (f1-13 (* f1-11 f1-11)) + (let* ((f0-8 (* 0.062831804 (fmin 200.0 (vector-length (-> s4-0 normal))) f30-0 (square (-> s0-0 world-sphere w)))) + (f1-13 (square 4096.0)) (f0-10 (fmin (* f0-8 (/ 1.0 f1-13)) (/ (-> this info info mass) (* 2.0 arg0 (the float s2-0))))) ) (vector-float*! (-> s4-0 local-pos 1) (-> s4-0 normal) (* -1.0 f0-10)) @@ -51,14 +48,17 @@ (rigid-body-method-18 (-> v1-34 state) (-> a1-3 0) a2-1) ) (vector-reset! (-> s4-0 local-pos 1)) - (let* ((f0-12 549018.94) - (f1-19 4096.0) - (f2-13 4096.0) - (f1-20 (* f1-19 (* f2-13 f2-13))) - (f0-16 (* f0-12 (/ 1.0 f1-20) (-> this info buoyancy-factor) f30-0 (-> s0-0 world-sphere w))) - (f1-25 (-> s0-0 world-sphere w)) - ) - (set! (-> s4-0 local-pos 1 y) (* f0-16 (* f1-25 f1-25))) + (let ((f0-12 549018.94) + (f1-20 (* 4096.0 (square 4096.0))) + ) + (set! (-> s4-0 local-pos 1 y) (* f0-12 + (/ 1.0 f1-20) + (-> this info buoyancy-factor) + f30-0 + (-> s0-0 world-sphere w) + (square (-> s0-0 world-sphere w)) + ) + ) ) ) ) @@ -209,14 +209,7 @@ ) (when (logtest? (-> this info flags) 1) (vector-float*! (-> arg1 tmp) (-> arg1 mat vector 1) -1.0) - (let ((t9-4 vector-lerp!) - (a0-7 (-> arg1 lift-dir)) - (a1-4 (-> arg1 lift-dir)) - (a2-3 (-> arg1 tmp)) - (f0-8 (-> arg1 speed-factor)) - ) - (t9-4 a0-7 a1-4 a2-3 (* f0-8 f0-8)) - ) + (vector-lerp! (-> arg1 lift-dir) (-> arg1 lift-dir) (-> arg1 tmp) (square (-> arg1 speed-factor))) (vector-normalize! (-> arg1 lift-dir) 1.0) ) (vector-float*! (-> s2-0 move-dist) (-> arg1 lift-dir) (the-as float f30-1)) @@ -537,7 +530,6 @@ ;; WARN: Stack slot offset 720 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod rigid-body-object-method-29 ((this vehicle) (arg0 float)) - (local-vars (sv-624 float) (sv-720 float) (sv-724 float)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((gp-0 (new 'stack-no-clear 'inline-array 'matrix 9)) @@ -548,41 +540,42 @@ (when (not (logtest? (-> this flags) (rigid-body-object-flag dead))) (vehicle-method-100 this arg0 (the-as vehicle-physics-work gp-0)) (when (>= 1 (-> this force-level)) - (set! sv-624 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (when (!= (-> s4-0 pitch-control-factor) 0.0) - (set! (-> gp-0 3 vector 2 quad) (-> gp-0 0 quad 0)) - (set! (-> gp-0 3 vector 2 y) 0.0) - (let ((f30-0 (vector-dot (-> gp-0 3 vector 2) (-> s5-0 state ang-velocity)))) - (dotimes (s1-0 (-> s4-0 lift-thruster-count)) - (let ((s0-0 (-> s4-0 lift-thruster-array s1-0))) - (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-0 local-pos) (-> gp-0 0)) - (vector-rotate*! (-> gp-0 1 trans) (-> s0-0 normal) (-> gp-0 0)) - (let* ((f0-5 -1.0) - (f1-2 1.0) - (f2-0 0.2) - (a0-9 (the-as number (-> s0-0 local-pos z))) - (a1-5 #xffffffff80000000) - (v1-16 #x3f800000) - (f0-7 - (* (fmax - f0-5 - (fmin - f1-2 - (* f2-0 (the-as float (logior (logand (the-as uint a0-9) a1-5) v1-16)) (-> s4-0 pitch-control-factor) f30-0) + (let ((sv-624 (* (-> s4-0 info mass) (-> s4-0 extra gravity)))) + (when (!= (-> s4-0 pitch-control-factor) 0.0) + (set! (-> gp-0 3 vector 2 quad) (-> gp-0 0 quad 0)) + (set! (-> gp-0 3 vector 2 y) 0.0) + (let ((f30-0 (vector-dot (-> gp-0 3 vector 2) (-> s5-0 state ang-velocity)))) + (dotimes (s1-0 (-> s4-0 lift-thruster-count)) + (let ((s0-0 (-> s4-0 lift-thruster-array s1-0))) + (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-0 local-pos) (-> gp-0 0)) + (vector-rotate*! (-> gp-0 1 trans) (-> s0-0 normal) (-> gp-0 0)) + (let* ((f0-5 -1.0) + (f1-2 1.0) + (f2-0 0.2) + (a0-9 (the-as number (-> s0-0 local-pos z))) + (a1-5 #xffffffff80000000) + (v1-16 #x3f800000) + (f0-7 + (* (fmax + f0-5 + (fmin + f1-2 + (* f2-0 (the-as float (logior (logand (the-as uint a0-9) a1-5) v1-16)) (-> s4-0 pitch-control-factor) f30-0) + ) ) + sv-624 ) - sv-624 - ) + ) ) - ) - (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f0-7)) - ) - ) - (let ((v1-21 s5-0) - (a1-7 (-> gp-0 1 vector 2)) - (a2-4 (-> gp-0 1)) + (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f0-7)) ) - (rigid-body-method-18 (-> v1-21 state) a1-7 (the-as vector a2-4)) + ) + (let ((v1-21 s5-0) + (a1-7 (-> gp-0 1 vector 2)) + (a2-4 (-> gp-0 1)) + ) + (rigid-body-method-18 (-> v1-21 state) a1-7 (the-as vector a2-4)) + ) ) ) ) @@ -597,46 +590,43 @@ (quaternion->matrix (the-as matrix (-> s1-1 1)) (the-as quaternion (-> s1-1 0))) (set! (-> gp-0 3 trans quad) (-> s1-1 2 quad)) ) - (let ((f0-14 (vector-dot (the-as vector (-> gp-0 0)) (-> gp-0 3 trans)))) - (set! sv-720 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) - (let ((f1-11 f0-14)) - (set! sv-724 - (+ (* f1-11 f1-11 f0-14) (* 0.075 (vector-dot (-> gp-0 0 vector 2) (-> s5-0 state ang-velocity)))) - ) - ) - ) - (dotimes (s1-2 (-> s4-0 roll-thruster-count)) - (let* ((s0-1 (-> s4-0 roll-thruster-array s1-2)) - (f0-17 0.0) - (f1-16 1.0) - (f2-7 -1.0) - (a0-19 (the-as number (-> s0-1 local-pos x))) - (a1-10 #xffffffff80000000) - (v1-44 #x3f800000) - (f30-1 - (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as uint a0-19) a1-10) v1-44)) sv-724))) + (let* ((f0-14 (vector-dot (the-as vector (-> gp-0 0)) (-> gp-0 3 trans))) + (sv-720 (* (-> s4-0 info mass) (-> s4-0 extra gravity))) + (sv-724 (+ (* (square f0-14) f0-14) (* 0.075 (vector-dot (-> gp-0 0 vector 2) (-> s5-0 state ang-velocity))))) + ) + (dotimes (s1-2 (-> s4-0 roll-thruster-count)) + (let* ((s0-1 (-> s4-0 roll-thruster-array s1-2)) + (f0-17 0.0) + (f1-16 1.0) + (f2-7 -1.0) + (a0-19 (the-as number (-> s0-1 local-pos x))) + (a1-10 #xffffffff80000000) + (v1-44 #x3f800000) + (f30-1 + (fmax f0-17 (fmin f1-16 (* f2-7 (the-as float (logior (logand (the-as uint a0-19) a1-10) v1-44)) sv-724))) + ) ) - ) - (when (< 0.0 f30-1) - (let ((f30-2 - (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) - (-> s4-0 roll-control-factor) - sv-720 - ) + (when (< 0.0 f30-1) + (let ((f30-2 + (* (+ f30-1 (+ (- (-> this power-fluctuation-factor)) (* 2.0 (rand-vu) (-> this power-fluctuation-factor)))) + (-> s4-0 roll-control-factor) + sv-720 + ) + ) ) - ) - (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) - (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-1 local-pos) (-> gp-0 0)) - (vector-rotate*! (-> gp-0 1 trans) (-> s0-1 normal) (-> gp-0 0)) - (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f30-2)) + (+! (-> this roll-thrust s1-2) (fmax 0.0 f30-2)) + (vector-matrix*! (-> gp-0 1 vector 2) (-> s0-1 local-pos) (-> gp-0 0)) + (vector-rotate*! (-> gp-0 1 trans) (-> s0-1 normal) (-> gp-0 0)) + (vector-float*! (the-as vector (-> gp-0 1)) (-> gp-0 1 trans) (* -1.0 f30-2)) + ) + (let ((v1-56 s5-0) + (a1-14 (-> gp-0 1 vector 2)) + (a2-8 (-> gp-0 1)) + ) + (rigid-body-method-18 (-> v1-56 state) a1-14 (the-as vector a2-8)) + ) + 0 ) - (let ((v1-56 s5-0) - (a1-14 (-> gp-0 1 vector 2)) - (a2-8 (-> gp-0 1)) - ) - (rigid-body-method-18 (-> v1-56 state) a1-14 (the-as vector a2-8)) - ) - 0 ) ) ) @@ -845,16 +835,21 @@ (vector-normalize! (-> gp-0 1 trans) 1.0) (let* ((v1-174 (-> s5-0 state lin-velocity)) (f0-90 (/ (sqrtf (+ (* (-> v1-174 x) (-> v1-174 x)) (* (-> v1-174 z) (-> v1-174 z)))) (-> s4-0 max-xz-speed))) - (v1-176 (-> gp-0 1)) - (a0-65 (-> gp-0 1 trans)) - (f1-67 -1.0) - (f2-29 (* (-> s4-0 speed-limiting-drag) (vector-dot (-> s5-0 state force) (-> gp-0 1 trans)))) - (f3-19 - (* (fabs (-> this engine-thrust)) (-> s4-0 speed-scrubbing-drag) (vector-length (-> s5-0 state lin-momentum))) - ) - (f4-6 (- 1.0 (fabs (vector-dot (-> s5-0 state matrix vector 2) (-> gp-0 1 trans))))) ) - (vector-float*! (the-as vector v1-176) a0-65 (* f1-67 (+ f2-29 (* f3-19 (* f4-6 f4-6))) (sqrtf f0-90))) + (vector-float*! + (the-as vector (-> gp-0 1)) + (-> gp-0 1 trans) + (* -1.0 + (+ (* (-> s4-0 speed-limiting-drag) (vector-dot (-> s5-0 state force) (-> gp-0 1 trans))) + (* (fabs (-> this engine-thrust)) + (-> s4-0 speed-scrubbing-drag) + (vector-length (-> s5-0 state lin-momentum)) + (square (- 1.0 (fabs (vector-dot (-> s5-0 state matrix vector 2) (-> gp-0 1 trans))))) + ) + ) + (sqrtf f0-90) + ) + ) ) (let ((a1-51 (-> gp-0 1))) (rigid-body-method-20 (-> s5-0 state) (the-as vector a1-51)) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-states_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-states_REF.gc index 077d951c09..a5e0989f21 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-states_REF.gc @@ -277,19 +277,14 @@ (set-time! (-> self state-time)) ) (else - (if (or (time-elapsed? (-> self state-time) (seconds 5)) (let ((f0-2 409600.0)) - (< (* f0-2 f0-2) (-> self camera-dist2)) - ) - ) + (if (or (time-elapsed? (-> self state-time) (seconds 5)) (< (square 409600.0) (-> self camera-dist2))) (go-virtual die) ) ) ) - (let ((f0-5 819200.0)) - (if (< (* f0-5 f0-5) (-> self camera-dist2)) - (go-virtual die) - ) - ) + (if (< (square 819200.0) (-> self camera-dist2)) + (go-virtual die) + ) (cond ((logtest? (-> self rbody state flags) (rigid-body-flag enable-physics)) (let ((gp-2 (new 'stack-no-clear 'rigid-body-info))) @@ -304,11 +299,12 @@ (vehicle-method-121 self) (set! (-> self rbody state info) (-> self info info)) (when (logtest? (-> self flags) (rigid-body-object-flag disturbed)) - (let* ((f0-14 (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) - (f0-17 (* f0-14 f0-14 (-> self camera-dist2))) - (f1-5 0.000016276043) - (f0-18 (* f0-17 (* f1-5 f1-5))) - ) + (let ((f0-18 (* (square (* 0.0033333334 (the float (- (current-time) (-> self disturbed-time))))) + (-> self camera-dist2) + (square 0.000016276043) + ) + ) + ) (.lvf vf1 (&-> (-> self rbody state ang-velocity) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -324,11 +320,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-53 vf1) - (let ((f1-9 v1-53) - (f2-0 614.4) - ) - (< f1-9 (* f0-18 (* f2-0 f2-0))) - ) + (< v1-53 (* f0-18 (square 614.4))) ) ) (logclear! (-> self flags) (rigid-body-object-flag disturbed)) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-util_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-util_REF.gc index 6d3906ace2..fee836e25a 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-util_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle-util_REF.gc @@ -229,187 +229,177 @@ ;; WARN: Return type mismatch int vs none. (defmethod check-player-get-on ((this vehicle)) (with-pp - (let ((f0-0 (-> this player-dist2)) - (f1-0 102400.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((s5-0 (new 'stack-no-clear 'mystery-vehicle-type))) - (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) - (if (logtest? (rigid-body-object-flag ai-driving) (-> this flags)) - (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) - ) - (set! (-> s5-0 matrices 0 vector 1 quad) (-> (target-pos 0) quad)) - (+! (-> s5-0 matrices 0 vector 1 y) 8192.0) - (let* ((v1-14 (-> s5-0 matrices 1)) - (a3-0 (-> this node-list data 0 bone transform)) - (a0-5 (-> a3-0 quad 0)) - (a1-0 (-> a3-0 quad 1)) - (a2-0 (-> a3-0 quad 2)) - (a3-1 (-> a3-0 trans quad)) - ) - (set! (-> v1-14 quad 0) a0-5) - (set! (-> v1-14 quad 1) a1-0) - (set! (-> v1-14 quad 2) a2-0) - (set! (-> v1-14 trans quad) a3-1) + (when (< (-> this player-dist2) (square 102400.0)) + (let ((s5-0 (new 'stack-no-clear 'mystery-vehicle-type))) + (set! (-> s5-0 floats 4) (+ 8192.0 (-> this root root-prim local-sphere w))) + (if (logtest? (rigid-body-object-flag ai-driving) (-> this flags)) + (set! (-> s5-0 floats 4) (* 1.5 (-> s5-0 floats 4))) ) - (set! (-> s5-0 matrices 0 vector 2 quad) (-> s5-0 matrices 1 trans quad)) - (set! (-> s5-0 floats 2) (- (-> s5-0 matrices 0 vector 1 y) (-> s5-0 matrices 0 vector 2 y))) - (let ((f0-9 (vector-vector-xz-distance-squared (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 0 vector 2))) - (f1-7 (-> s5-0 floats 4)) - ) - (when (and (< f0-9 (* f1-7 f1-7)) - (< -81920.0 (-> s5-0 floats 2)) - (< (-> s5-0 floats 2) 20480.0) - *target* - (not (focus-test? *target* dead grabbed in-head under-water pole flut tube pilot dark)) - (or (not (focus-test? *target* edge-grab)) - (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing)) - ) - (-> *setting-control* user-current pilot) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) (process->ppointer pp)) - (set! (-> a1-2 num-params) 1) - (set! (-> a1-2 message) 'query) - (set! (-> a1-2 param 0) (the-as uint 'mode)) - (let ((v1-37 (send-event-function *target* a1-2))) - (and (or (= v1-37 #f) (= v1-37 'board)) - (or (logtest? (-> this flags) (rigid-body-object-flag waiting-for-player)) - (-> *setting-control* user-current vehicle-hijacking) - ) - ) - ) - ) + (set! (-> s5-0 matrices 0 vector 1 quad) (-> (target-pos 0) quad)) + (+! (-> s5-0 matrices 0 vector 1 y) 8192.0) + (let* ((v1-14 (-> s5-0 matrices 1)) + (a3-0 (-> this node-list data 0 bone transform)) + (a0-5 (-> a3-0 quad 0)) + (a1-0 (-> a3-0 quad 1)) + (a2-0 (-> a3-0 quad 2)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-14 quad 0) a0-5) + (set! (-> v1-14 quad 1) a1-0) + (set! (-> v1-14 quad 2) a2-0) + (set! (-> v1-14 trans quad) a3-1) + ) + (set! (-> s5-0 matrices 0 vector 2 quad) (-> s5-0 matrices 1 trans quad)) + (set! (-> s5-0 floats 2) (- (-> s5-0 matrices 0 vector 1 y) (-> s5-0 matrices 0 vector 2 y))) + (when (and (< (vector-vector-xz-distance-squared (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 0 vector 2)) + (square (-> s5-0 floats 4)) + ) + (< -81920.0 (-> s5-0 floats 2)) + (< (-> s5-0 floats 2) 20480.0) + *target* + (not (focus-test? *target* dead grabbed in-head under-water pole flut tube pilot dark)) + (or (not (focus-test? *target* edge-grab)) + (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing)) ) - (let ((s2-0 #f) - (s4-1 #f) - (s3-0 #f) - ) - (let ((a2-2 (get-best-seat-for-vehicle this (-> s5-0 matrices 0 vector 1) 1 0))) - (when (!= a2-2 -1) - (compute-seat-position this (-> s5-0 matrices 0 vector 2) a2-2) - (vector+float*! - (-> s5-0 matrices 0 vector 2) - (-> s5-0 matrices 0 vector 2) - (-> s5-0 matrices 1 vector 1) - 4096.0 - ) - ) - ) - (set! (-> s5-0 floats 1) - (vector-vector-distance-squared (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) - ) - (let ((f0-14 (-> s5-0 floats 1)) - (f1-12 81920.0) - ) - (when (< f0-14 (* f1-12 f1-12)) - (set! (-> s5-0 cquery start-pos quad) (-> s5-0 matrices 0 vector 1 quad)) - (vector-! (-> s5-0 cquery move-dist) (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) - (let ((v1-54 (-> s5-0 cquery))) - (set! (-> v1-54 radius) 4096.0) - (set! (-> v1-54 collide-with) (collide-spec - backgnd - crate - civilian - enemy - obstacle - hit-by-player-list - hit-by-others-list - player-list - collectable - blocking-plane - tobot - pusher - vehicle-mesh - obstacle-for-jak - ) - ) - (set! (-> v1-54 ignore-process0) this) - (set! (-> v1-54 ignore-process1) #f) - (set! (-> v1-54 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> v1-54 action-mask) (collide-action solid)) - ) - (set! s2-0 (< (fill-and-probe-using-line-sphere *collide-cache* (-> s5-0 cquery)) 0.0)) - 0 - ) - ) - (when s2-0 - (when (and (or (< -14336.0 (-> s5-0 floats 2)) (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing))) - (not (logtest? (rigid-body-object-flag no-hijack) (-> this flags))) - ) - (set! s4-1 #t) - (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 (sqrtf (-> s5-0 floats 1))))) - ) - (when (and (not s4-1) - (and (< (-> s5-0 floats 2) -8192.0) (not (logtest? (-> *target* focus-status) (focus-status edge-grab)))) - ) - (matrix-4x4-inverse! (-> s5-0 matrices 2) (-> s5-0 matrices 1)) - (vector-matrix*! (the-as vector (-> s5-0 matrices)) (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 2)) - (set! (-> s5-0 floats 0) 81920.0) - (dotimes (s2-1 (-> this info grab-rail-count)) - (let ((s1-0 (-> this info grab-rail-array s2-1))) - (vector-! (-> s5-0 matrices 0 trans) (the-as vector (-> s5-0 matrices)) (-> s1-0 local-pos 0)) - (when #t - (let ((f30-0 (vector-segment-distance-point! - (the-as vector (-> s5-0 matrices)) - (-> s1-0 local-pos 0) - (-> s1-0 local-pos 1) - (-> s5-0 matrices 0 trans) - ) - ) + (-> *setting-control* user-current pilot) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer pp)) + (set! (-> a1-2 num-params) 1) + (set! (-> a1-2 message) 'query) + (set! (-> a1-2 param 0) (the-as uint 'mode)) + (let ((v1-37 (send-event-function *target* a1-2))) + (and (or (= v1-37 #f) (= v1-37 'board)) + (or (logtest? (-> this flags) (rigid-body-object-flag waiting-for-player)) + (-> *setting-control* user-current vehicle-hijacking) ) - (when (< f30-0 (-> s5-0 floats 0)) - (set! (-> s5-0 floats 0) f30-0) - (set! (-> s5-0 vectors 0 quad) (-> s5-0 matrices 0 trans quad)) - (vector-! (-> s5-0 vectors 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) - (vector-normalize! (-> s5-0 vectors 1) 1.0) - (set! s3-0 #t) - (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 f30-0))) - ) ) + ) + ) + ) + (let ((s2-0 #f) + (s4-1 #f) + (s3-0 #f) + ) + (let ((a2-2 (get-best-seat-for-vehicle this (-> s5-0 matrices 0 vector 1) 1 0))) + (when (!= a2-2 -1) + (compute-seat-position this (-> s5-0 matrices 0 vector 2) a2-2) + (vector+float*! + (-> s5-0 matrices 0 vector 2) + (-> s5-0 matrices 0 vector 2) + (-> s5-0 matrices 1 vector 1) + 4096.0 + ) + ) + ) + (set! (-> s5-0 floats 1) + (vector-vector-distance-squared (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) + ) + (when (< (-> s5-0 floats 1) (square 81920.0)) + (set! (-> s5-0 cquery start-pos quad) (-> s5-0 matrices 0 vector 1 quad)) + (vector-! (-> s5-0 cquery move-dist) (-> s5-0 matrices 0 vector 2) (-> s5-0 matrices 0 vector 1)) + (let ((v1-54 (-> s5-0 cquery))) + (set! (-> v1-54 radius) 4096.0) + (set! (-> v1-54 collide-with) (collide-spec + backgnd + crate + civilian + enemy + obstacle + hit-by-player-list + hit-by-others-list + player-list + collectable + blocking-plane + tobot + pusher + vehicle-mesh + obstacle-for-jak + ) + ) + (set! (-> v1-54 ignore-process0) this) + (set! (-> v1-54 ignore-process1) #f) + (set! (-> v1-54 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-54 action-mask) (collide-action solid)) + ) + (set! s2-0 (< (fill-and-probe-using-line-sphere *collide-cache* (-> s5-0 cquery)) 0.0)) + 0 + ) + (when s2-0 + (when (and (or (< -14336.0 (-> s5-0 floats 2)) (logtest? (-> this flags) (rigid-body-object-flag player-edge-grabbing))) + (not (logtest? (rigid-body-object-flag no-hijack) (-> this flags))) + ) + (set! s4-1 #t) + (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 (sqrtf (-> s5-0 floats 1))))) + ) + (when (and (not s4-1) + (and (< (-> s5-0 floats 2) -8192.0) (not (logtest? (-> *target* focus-status) (focus-status edge-grab)))) + ) + (matrix-4x4-inverse! (-> s5-0 matrices 2) (-> s5-0 matrices 1)) + (vector-matrix*! (the-as vector (-> s5-0 matrices)) (-> s5-0 matrices 0 vector 1) (-> s5-0 matrices 2)) + (set! (-> s5-0 floats 0) 81920.0) + (dotimes (s2-1 (-> this info grab-rail-count)) + (let ((s1-0 (-> this info grab-rail-array s2-1))) + (vector-! (-> s5-0 matrices 0 trans) (the-as vector (-> s5-0 matrices)) (-> s1-0 local-pos 0)) + (when #t + (let ((f30-0 (vector-segment-distance-point! + (the-as vector (-> s5-0 matrices)) + (-> s1-0 local-pos 0) + (-> s1-0 local-pos 1) + (-> s5-0 matrices 0 trans) + ) + ) + ) + (when (< f30-0 (-> s5-0 floats 0)) + (set! (-> s5-0 floats 0) f30-0) + (set! (-> s5-0 vectors 0 quad) (-> s5-0 matrices 0 trans quad)) + (vector-! (-> s5-0 vectors 1) (-> s1-0 local-pos 1) (-> s1-0 local-pos 0)) + (vector-normalize! (-> s5-0 vectors 1) 1.0) + (set! s3-0 #t) + (set! (-> s5-0 floats 3) (* (-> this hit-points) (/ 40960.0 f30-0))) ) ) - 0 ) ) - (set! s3-0 (or s4-1 s3-0)) - (when (and s3-0 (and (vehicle-hud-chooser-method-9 *vehicle-hud-chooser* (process->handle this) (-> s5-0 floats 3)) - (can-display-query? this (the-as string #f) (/ 1.0 (-> s5-0 floats 3))) - ) - ) - (let ((s3-1 - (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) - ) - ) - (set-width! s3-1 340) - (set-height! s3-1 80) - (set-scale! s3-1 0.9) - (set! (-> s3-1 flags) (font-flags shadow kerning large)) - (print-game-text - (lookup-text! *common-text* (text-id press-triangle-to-use) #f) - s3-1 - #f - 44 - (bucket-id progress) + 0 + ) + ) + (set! s3-0 (or s4-1 s3-0)) + (when (and s3-0 (and (vehicle-hud-chooser-method-9 *vehicle-hud-chooser* (process->handle this) (-> s5-0 floats 3)) + (can-display-query? this (the-as string #f) (/ 1.0 (-> s5-0 floats 3))) + ) + ) + (let ((s3-1 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) ) ) - (when (cpad-pressed? 0 triangle) - (cond - (s4-1 - (when (send-event *target* 'change-mode 'pilot this 0 #f) - (logior! (-> this flags) (rigid-body-object-flag player-driving)) - (logclear! (-> this flags) (rigid-body-object-flag ai-driving)) - (vehicle-method-87 this) - ) - ) - (else - (set! (-> s5-0 handles 0) (process->handle this)) - (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vectors)) 40) - (if (send-event *target* 'pilot-edge-grab *pilot-edge-grab-info*) - (format 0 "vehicle::check-player-get-on: (send-event *target* 'pilot-edge-grab self)~%") - ) - ) + (set-width! s3-1 340) + (set-height! s3-1 80) + (set-scale! s3-1 0.9) + (set! (-> s3-1 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id press-triangle-to-use) #f) + s3-1 + #f + 44 + (bucket-id progress) + ) + ) + (when (cpad-pressed? 0 triangle) + (cond + (s4-1 + (when (send-event *target* 'change-mode 'pilot this 0 #f) + (logior! (-> this flags) (rigid-body-object-flag player-driving)) + (logclear! (-> this flags) (rigid-body-object-flag ai-driving)) + (vehicle-method-87 this) ) ) + (else + (set! (-> s5-0 handles 0) (process->handle this)) + (mem-copy! (the-as pointer *pilot-edge-grab-info*) (the-as pointer (-> s5-0 vectors)) 40) + (if (send-event *target* 'pilot-edge-grab *pilot-edge-grab-info*) + (format 0 "vehicle::check-player-get-on: (send-event *target* 'pilot-edge-grab self)~%") + ) + ) ) ) ) @@ -1462,21 +1452,14 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-13 vf1) - (let ((f0-1 v1-13) - (f1-0 0.5) - ) - (if (< f0-1 (* f1-0 f1-0)) - (logclear! (-> this flags) (rigid-body-object-flag disturbed)) - ) - ) + (if (< v1-13 (square 0.5)) + (logclear! (-> this flags) (rigid-body-object-flag disturbed)) + ) ) ) (else (when (>= (-> this rbody state matrix vector 1 y) (cos 910.2222)) - (let* ((f0-3 (-> this camera-dist2)) - (f1-3 0.000024414063) - (f0-4 (* f0-3 (* f1-3 f1-3))) - ) + (let ((f0-4 (* (-> this camera-dist2) (square 0.000024414063)))) (.lvf vf1 (&-> (-> this rbody state ang-velocity) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -1492,11 +1475,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-30 vf1) - (let ((f1-7 v1-30) - (f2-0 614.4) - ) - (< f1-7 (* f0-4 (* f2-0 f2-0))) - ) + (< v1-30 (* f0-4 (square 614.4))) ) ) (logclear! (-> this flags) (rigid-body-object-flag disturbed)) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle_REF.gc index df7730882d..0afa74bf83 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/vehicle/vehicle_REF.gc @@ -181,10 +181,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-63 vf1) - (let ((f0-25 v1-63) - (f1-11 12288.0) - ) - (when (< (* f1-11 f1-11) f0-25) + (let ((f0-25 v1-63)) + (when (< (square 12288.0) f0-25) (set! (-> this scrape-sound-envelope) 1.0) (if (logtest? (-> this flags) (rigid-body-object-flag player-driving)) (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 255 (seconds 0.05)) @@ -344,11 +342,8 @@ 0.0 ) (else - (let* ((v1-25 (-> this rbody state lin-velocity)) - (f1-10 (+ (* (-> v1-25 x) (-> v1-25 x)) (* (-> v1-25 z) (-> v1-25 z)))) - (f2-8 8192.0) - ) - (if (< f1-10 (* f2-8 f2-8)) + (let ((v1-25 (-> this rbody state lin-velocity))) + (if (< (+ (* (-> v1-25 x) (-> v1-25 x)) (* (-> v1-25 z) (-> v1-25 z))) (square 8192.0)) (logior! (-> this flags) (rigid-body-object-flag reverse-gear)) ) ) @@ -474,9 +469,7 @@ ) (let ((f1-6 0.0)) (when (logtest? (rigid-body-object-flag ignition) (-> this flags)) - (let ((f0-23 (- 1.0 (* (rand-vu) (-> this power-fluctuation-factor))))) - (set! f1-6 (* f0-23 f0-23)) - ) + (set! f1-6 (square (- 1.0 (* (rand-vu) (-> this power-fluctuation-factor))))) (if (not (logtest? (-> this flags) (rigid-body-object-flag riding))) (set! f1-6 (/ f1-6 2)) ) @@ -675,18 +668,12 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-88 vf1) - (let ((f0-20 v1-88) - (f1-13 122880.0) - ) - (if (< f0-20 (* f1-13 f1-13)) - (disable-rapid-camera-tracking this) - ) - ) + (if (< v1-88 (square 122880.0)) + (disable-rapid-camera-tracking this) + ) ) (else - (let* ((f0-21 143360.0) - (f0-23 (* f0-21 f0-21)) - ) + (let ((f0-23 (square 143360.0))) (.lvf vf1 (&-> (-> this root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -909,24 +896,16 @@ ) (set! (-> this node-list data 0 bone transform trans quad) (-> this root trans quad)) (vehicle-method-119 this) - (let ((f0-1 (-> this player-dist2)) - (f1-0 245760.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (do-engine-sounds this) - ) - ) + (if (< (-> this player-dist2) (square 245760.0)) + (do-engine-sounds this) + ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) (if #t (draw-thrusters this) ) - (let ((f0-2 (-> this camera-dist2)) - (f1-3 245760.0) - ) - (if (< f0-2 (* f1-3 f1-3)) - (update-joint-mods this) - ) - ) + (if (< (-> this camera-dist2) (square 245760.0)) + (update-joint-mods this) + ) ) (vehicle-method-120 this) (let ((s5-0 (-> this root))) @@ -1100,27 +1079,18 @@ (label cfg-3) (b! (not v1-4) cfg-20 :delay (empty-form)) (let ((f0-3 (fmin (-> this player-dist2) (-> this camera-dist2)))) - (let ((f1-1 819200.0)) - (b! (>= (* f1-1 f1-1) f0-3) cfg-8) - ) - (let ((f1-4 819200.0)) - (if (< (* f1-4 f1-4) f0-3) - (vehicle-method-113 this) - ) - ) + (b! (>= (square 819200.0) f0-3) cfg-8) + (if (< (square 819200.0) f0-3) + (vehicle-method-113 this) + ) (b! #t cfg-19 :delay (nop!)) (label cfg-8) - (let ((f1-7 81920.0)) - (b! (>= (* f1-7 f1-7) f0-3) cfg-18) - ) + (b! (>= (square 81920.0) f0-3) cfg-18) (b! (not (logtest? (-> this draw status) (draw-control-status on-screen))) cfg-11 :delay (nop!)) (set-time! (-> this state-time)) (b! #t cfg-17 :delay (nop!)) (label cfg-11) - (if (or (time-elapsed? (-> this state-time) (seconds 10)) (let ((f1-10 409600.0)) - (< (* f1-10 f1-10) f0-3) - ) - ) + (if (or (time-elapsed? (-> this state-time) (seconds 10)) (< (square 409600.0) f0-3)) (vehicle-method-113 this) ) ) @@ -1267,15 +1237,11 @@ (label cfg-12) 0 (vehicle-method-104 this) - (let ((f0-9 (-> this player-dist2)) - (f1-8 245760.0) - ) - (when (< f0-9 (* f1-8 f1-8)) - (let ((f0-10 (vector-length (-> this root transv)))) - (seek! (-> this engine-power-factor) (/ f0-10 (meters 15)) (* 6.0 (seconds-per-frame))) - ) - (do-engine-sounds this) + (when (< (-> this player-dist2) (square 245760.0)) + (let ((f0-10 (vector-length (-> this root transv)))) + (seek! (-> this engine-power-factor) (/ f0-10 (meters 15)) (* 6.0 (seconds-per-frame))) ) + (do-engine-sounds this) ) (when (logtest? (-> this draw status) (draw-control-status on-screen)) (when #t @@ -1495,7 +1461,7 @@ ;; definition for method 47 of type vehicle ;; INFO: Used lq/sq (defmethod rigid-body-object-method-47 ((this vehicle) (arg0 process-drawable) (arg1 attack-info) (arg2 touching-shapes-entry) (arg3 penetrate)) - (local-vars (f0-2 float) (sv-96 vector)) + (local-vars (f0-2 float)) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -1509,16 +1475,17 @@ (set! (-> s5-0 vector 2 quad) (-> arg1 attacker-velocity quad)) ) ((as-type arg0 process-focusable) - (set! sv-96 (-> s5-0 vector 2)) - (let ((s0-1 (-> s5-0 vector)) - (v1-7 (get-trans (the-as process-focusable arg0) 3)) - ) - (.lvf vf4 (&-> s0-1 0 quad)) - (.lvf vf5 (&-> v1-7 quad)) + (let ((sv-96 (-> s5-0 vector 2))) + (let ((s0-1 (-> s5-0 vector)) + (v1-7 (get-trans (the-as process-focusable arg0) 3)) + ) + (.lvf vf4 (&-> s0-1 0 quad)) + (.lvf vf5 (&-> v1-7 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) ) (else (vector-! (-> s5-0 vector 2) (-> s5-0 vector 0) (-> arg0 root trans)) diff --git a/test/decompiler/reference/jak2/levels/city/vinroom/vinroom-part_REF.gc b/test/decompiler/reference/jak2/levels/city/vinroom/vinroom-part_REF.gc index 0fff064350..77b59fef2c 100644 --- a/test/decompiler/reference/jak2/levels/city/vinroom/vinroom-part_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/vinroom/vinroom-part_REF.gc @@ -2183,7 +2183,7 @@ (let ((v1-1 (-> arg4 sprite key))) (when (nonzero? v1-1) (let ((f0-2 (+ (- 24576.0 (-> arg2 x-y-z-sx y)) (-> v1-1 origin trans y)))) - (set! (-> arg1 radius) (sqrtf (- (* (-> arg1 radius) (-> arg1 radius)) (* f0-2 f0-2)))) + (set! (-> arg1 radius) (sqrtf (- (* (-> arg1 radius) (-> arg1 radius)) (square f0-2)))) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-shot_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-shot_REF.gc index 40e866f7b8..a57e8ff8b4 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-shot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash-shot_REF.gc @@ -323,7 +323,7 @@ (launch-particles (-> *part-id-table* 673) gp-0) (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) + (let ((f0-5 (square f0-4)) (f30-1 (-> *part-id-table* 674 init-specs 8 initial-valuef)) (f28-0 (-> *part-id-table* 674 init-specs 8 random-rangef)) ) diff --git a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc index ff4e8684ba..4565ecdabc 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/ashelin/ash_REF.gc @@ -1247,7 +1247,7 @@ ;; definition for method 236 of type ashelin ;; INFO: Used lq/sq (defmethod ashelin-method-236 ((this ashelin) (arg0 vector) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) - (local-vars (v1-23 float) (sv-272 vector)) + (local-vars (v1-23 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1273,11 +1273,12 @@ 0 (let ((s0-0 (new 'stack-no-clear 'nav-avoid-spheres-params))) (vector-! (-> s0-0 current-pos) (-> this root trans) (-> this nav state mesh bounds)) - (set! sv-272 (-> s0-0 travel)) - (set! (-> sv-272 x) (sin arg1)) - (set! (-> sv-272 y) 0.0) - (set! (-> sv-272 z) (cos arg1)) - (set! (-> sv-272 w) 1.0) + (let ((sv-272 (-> s0-0 travel))) + (set! (-> sv-272 x) (sin arg1)) + (set! (-> sv-272 y) 0.0) + (set! (-> sv-272 z) (cos arg1)) + (set! (-> sv-272 w) 1.0) + ) (vector-float*! (-> s0-0 travel) (-> s0-0 travel) arg3) (set! (-> s0-0 pref-dir quad) (-> s0-0 travel quad)) (avoid-spheres-1! (-> this nav) s0-0) @@ -1295,11 +1296,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-23 vf1) - (let ((f0-11 v1-23) - (f1-1 arg4) - ) - (>= f0-11 (* f1-1 f1-1)) - ) + (>= v1-23 (square arg4)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc index d3f505b932..48bfc703a4 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot-h_REF.gc @@ -806,50 +806,50 @@ ;; WARN: Stack slot offset 16 signed mismatch ;; WARN: new jak 2 until loop case, check carefully (defmethod bot-speech-list-method-9 ((this bot-speech-list-shuffle) (bot bot) (sp-info (inline-array bot-speech-info)) (sp-flags speech-flags)) - (local-vars (sv-16 int)) (let ((course-cookie (-> bot course retry-cookie))) (when (!= course-cookie (-> this retry-cookie)) (set! (-> this retry-cookie) (-> bot course retry-cookie)) (reset-index this #t) ) ) - (set! sv-16 (-> this last-local-index)) - (when (< sv-16 0) - (when (not (logtest? (-> this flags) 1)) - (logior! (-> this flags) 1) - (set! sp-flags (logior sp-flags (speech-flags sf02))) + (let ((sv-16 (-> this last-local-index))) + (when (< sv-16 0) + (when (not (logtest? (-> this flags) 1)) + (logior! (-> this flags) 1) + (set! sp-flags (logior sp-flags (speech-flags sf02))) + ) + (reset-index this #f) ) - (reset-index this #f) - ) - (let ((history-mask 0)) - (if (>= sv-16 0) - (set! history-mask (ash 1 sv-16)) - ) - (if (logtest? (-> this flags) 8) - (set! history-mask (logior history-mask (-> this history-mask))) - ) - (until #f - (when (and (= history-mask (-> this history-mask-full)) (logtest? (-> this flags) 8)) - (if (not (logtest? (-> this flags) 2)) - (return -1) + (let ((history-mask 0)) + (if (>= sv-16 0) + (set! history-mask (ash 1 sv-16)) + ) + (if (logtest? (-> this flags) 8) + (set! history-mask (logior history-mask (-> this history-mask))) + ) + (until #f + (when (and (= history-mask (-> this history-mask-full)) (logtest? (-> this flags) 8)) + (if (not (logtest? (-> this flags) 2)) + (return -1) + ) + (reset-index this #f) + (if (>= sv-16 0) + (set! history-mask (ash 1 sv-16)) + (set! history-mask 0) + ) + ) + (let* ((last-idx (rnd-bit bot (-> this speech-indexes length) history-mask)) + (speech-idx (-> this speech-indexes last-idx)) + (v1-47 (-> sp-info speech-idx flags)) + ) + (set! history-mask (logior history-mask (ash 1 last-idx))) + (when (and (not (logtest? sp-flags v1-47)) + (or (not (logtest? v1-47 (speech-flags sf11))) (not (speech-playing? bot speech-idx))) + ) + (set! (-> this last-local-index) last-idx) + (logior! (-> this history-mask) (ash 1 last-idx)) + (return speech-idx) ) - (reset-index this #f) - (if (>= sv-16 0) - (set! history-mask (ash 1 sv-16)) - (set! history-mask 0) - ) - ) - (let* ((last-idx (rnd-bit bot (-> this speech-indexes length) history-mask)) - (speech-idx (-> this speech-indexes last-idx)) - (v1-47 (-> sp-info speech-idx flags)) - ) - (set! history-mask (logior history-mask (ash 1 last-idx))) - (when (and (not (logtest? sp-flags v1-47)) - (or (not (logtest? v1-47 (speech-flags sf11))) (not (speech-playing? bot speech-idx))) - ) - (set! (-> this last-local-index) last-idx) - (logior! (-> this history-mask) (ash 1 last-idx)) - (return speech-idx) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc index 0dc3e7968f..9da7cb0c78 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/bot_REF.gc @@ -85,7 +85,7 @@ ;; definition for method 219 of type bot (defmethod player-blocking-spot? ((this bot) (spot bot-spot)) (let ((f0-0 (-> spot blocked-xz-dist))) - (and (!= f0-0 0.0) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> spot center)))) + (and (!= f0-0 0.0) (>= (square f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> spot center)))) ) ) @@ -207,14 +207,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-3 a2-5) - (f1-2 (+ (-> a1-2 world-sphere w) (the-as float (-> s5-0 param 3)))) - ) - (when (< f0-3 (* f1-2 f1-2)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (the-as float (-> s5-0 param 3))))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -248,14 +244,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-4 a2-12) - (f1-6 (+ (-> a1-14 world-sphere w) (the-as float (-> s5-0 param 3)))) - ) - (when (< f0-4 (* f1-6 f1-6)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (the-as float (-> s5-0 param 3))))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -586,14 +578,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-3 (+ (-> ccore world-sphere w) (-> sphere r))) - ) - (when (< f0-2 (* f1-3 f1-3)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> ccore world-sphere w) (-> sphere r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -627,14 +615,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-7 (+ (-> a1-14 world-sphere w) (-> sphere r))) - ) - (when (< f0-3 (* f1-7 f1-7)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (-> sphere r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1613,9 +1597,8 @@ (when *target* (let ((target-trans (-> *target* control trans)) (bot-root (-> this root)) - (f0-0 14336.0) ) - (when (>= (* f0-0 f0-0) (vector-vector-distance-squared (-> bot-root trans) target-trans)) + (when (>= (square 14336.0) (vector-vector-distance-squared (-> bot-root trans) target-trans)) (let ((v1-8 (-> *target* control transv))) (when (>= (sqrtf (+ (* (-> v1-8 x) (-> v1-8 x)) (* (-> v1-8 z) (-> v1-8 z)))) 2048.0) (if (logtest? (-> this nav state flags) (nav-state-flag avoiding-sphere)) diff --git a/test/decompiler/reference/jak2/levels/common/ai/sig/sig-shot_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/sig/sig-shot_REF.gc index 9d35fa2392..99f18a4334 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/sig/sig-shot_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/sig/sig-shot_REF.gc @@ -323,7 +323,7 @@ (launch-particles (-> *part-id-table* 653) gp-0) (let ((f0-4 (vector-dot s5-1 (-> (camera-matrix) vector 2)))) (when (< 0.0 f0-4) - (let ((f0-5 (* f0-4 f0-4)) + (let ((f0-5 (square f0-4)) (f30-1 (-> *part-id-table* 654 init-specs 8 initial-valuef)) (f28-0 (-> *part-id-table* 654 init-specs 8 random-rangef)) ) diff --git a/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc b/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc index 038616d2f9..bb0c39a5fd 100644 --- a/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/ai/sig/sig_REF.gc @@ -1347,14 +1347,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-7 vf1) - (let ((f0-4 a2-7) - (f1-3 (+ (-> a1-4 world-sphere w) (-> s5-0 r))) - ) - (when (< f0-4 (* f1-3 f1-3)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-7 (square (+ (-> a1-4 world-sphere w) (-> s5-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-8)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1388,14 +1384,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-14 vf1) - (let ((f0-5 a2-14) - (f1-7 (+ (-> a1-16 world-sphere w) (-> s5-0 r))) - ) - (when (< f0-5 (* f1-7 f1-7)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-11)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-14 (square (+ (-> a1-16 world-sphere w) (-> s5-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-11)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/battle_REF.gc b/test/decompiler/reference/jak2/levels/common/battle_REF.gc index ee7ff98044..52e6db2785 100644 --- a/test/decompiler/reference/jak2/levels/common/battle_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/battle_REF.gc @@ -922,7 +922,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw-battle-marks ((this battle)) - (local-vars (sv-16 string) (sv-32 string)) (let ((s4-0 (-> this root trans)) (s5-0 (the-as int (-> this max-count))) ) @@ -963,13 +962,7 @@ (s2-1 #t) (s1-1 318) ) - (let ((s0-1 format)) - (set! sv-16 (clear *temp-string*)) - (set! sv-32 "~%spawner~%~S") - (let ((a2-5 (res-lump-struct (-> s4-1 entity) 'name structure))) - (s0-1 sv-16 sv-32 a2-5) - ) - ) + (format (clear *temp-string*) "~%spawner~%~S" (res-lump-struct (-> s4-1 entity) 'name structure)) (s3-1 s2-1 (the-as bucket-id s1-1) @@ -1000,7 +993,7 @@ (set! (-> gp-0 quad) (-> arg0 attack-pos quad)) (set! (-> gp-0 w) f0-0) (let ((s5-0 (-> this info spawner-collide-with)) - (f30-0 (* f0-0 f0-0)) + (f30-0 (square f0-0)) ) (set! *actor-list-length* 0) (if (logtest? s5-0 (collide-spec hit-by-others-list)) @@ -1027,14 +1020,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-2 a2-5) - (f1-1 (+ (-> a1-5 world-sphere w) (-> gp-0 w))) - ) - (when (< f0-2 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-5 world-sphere w) (-> gp-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-3)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1068,14 +1057,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-3 a2-12) - (f1-5 (+ (-> a1-17 world-sphere w) (-> gp-0 w))) - ) - (when (< f0-3 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-17 world-sphere w) (-> gp-0 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1107,7 +1092,7 @@ (defmethod spawner-blocked? ((this battle) (arg0 battle-spawner)) (when (not (logtest? (-> this flags) (battle-flags no-spawner-block))) (let ((f0-0 (-> this info spawner-blocked-by-player-xz))) - (if (and (< 0.0 f0-0) (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 attack-pos)))) + (if (and (< 0.0 f0-0) (>= (square f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg0 attack-pos)))) (return #t) ) ) @@ -1730,13 +1715,13 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod initialize-spawner-breeds ((this battle) (arg0 battle-spawner) (arg1 entity-actor)) - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((s2-0 0) (s5-0 0) (s4-0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((s1-0 (res-lump-data arg1 'spawn-types (pointer type) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s1-0 (res-lump-data arg1 'spawn-types (pointer type) :tag-ptr (& sv-16))) + ) (dotimes (s0-0 2) (set! s2-0 0) (when s1-0 @@ -1769,8 +1754,9 @@ ) ) (else - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data arg1 'spawn-percs (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-18 (res-lump-data arg1 'spawn-percs (pointer float) :tag-ptr (& sv-32))) + ) (when v1-18 (let ((a0-16 (min (the-as int (-> sv-32 elt-count)) s4-0)) (a1-14 0) @@ -1872,9 +1858,10 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod initialize-enemy-lists ((this battle)) - (local-vars (v0-4 battle-ally-array) (sv-16 res-tag) (sv-32 entity)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v0-0 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (local-vars (v0-4 battle-ally-array)) + (let* ((sv-16 (new 'static 'res-tag)) + (v0-0 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (when (and v0-0 (nonzero? (-> sv-16 elt-count))) (let* ((s5-0 (-> (the-as (pointer actor-group) v0-0) 0)) (s4-0 (-> s5-0 length)) @@ -1884,33 +1871,34 @@ (s2-0 0) ) (dotimes (s0-0 s4-0) - (set! sv-32 (-> s5-0 data s0-0 actor)) - (when sv-32 - (let ((enm-option (res-lump-value sv-32 'enemy-options enemy-option :time -1000000000.0))) - (cond - ((logtest? (enemy-option spawner) enm-option) - (+! s1-0 1) - (cond - ((zero? s3-0) - 0 - ) - (else - (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) - (initialize-spawner this a1-2 (the-as entity-actor sv-32)) + (let ((sv-32 (-> s5-0 data s0-0 actor))) + (when sv-32 + (let ((enm-option (res-lump-value sv-32 'enemy-options enemy-option :time -1000000000.0))) + (cond + ((logtest? (enemy-option spawner) enm-option) + (+! s1-0 1) + (cond + ((zero? s3-0) + 0 + ) + (else + (let ((a1-2 (-> this spawners data (+ s1-0 -1)))) + (initialize-spawner this a1-2 (the-as entity-actor sv-32)) + ) ) ) ) - ) - (else - (when (not (logtest? (-> sv-32 extra perm status) (entity-perm-status dead))) - (+! s2-0 1) - (cond - ((zero? s3-0) - 0 - ) - (else - (let ((a1-3 (-> this allies data (+ s2-0 -1)))) - (initialize-ally this a1-3 (the-as entity-actor sv-32)) + (else + (when (not (logtest? (-> sv-32 extra perm status) (entity-perm-status dead))) + (+! s2-0 1) + (cond + ((zero? s3-0) + 0 + ) + (else + (let ((a1-3 (-> this allies data (+ s2-0 -1)))) + (initialize-ally this a1-3 (the-as entity-actor sv-32)) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc b/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc index 73f3dbfaca..7367bea2fc 100644 --- a/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc @@ -182,17 +182,16 @@ ;; definition for function elec-gate-post ;; INFO: Used lq/sq (defbehavior elec-gate-post elec-gate () - (local-vars (curr-bolt elec-gate-bolt) (curr-point int)) (let ((num-points (-> self params ring-spec num-points))) (dotimes (bolt-idx 5) - (set! curr-bolt (-> self l-bolt bolt-idx)) - (let ((s4-0 - (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) - ) - (s3-0 - (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) - ) - ) + (let* ((curr-bolt (-> self l-bolt bolt-idx)) + (s4-0 + (get-point-at-percent-along-path! (-> self path) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) + ) + (s3-0 + (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> curr-bolt pos) 'interp) + ) + ) (let ((a0-2 (-> curr-bolt bolt)) (v1-10 s4-0) ) @@ -211,13 +210,14 @@ (set! (-> s0-0 y) 0.0) (set! (-> s0-0 z) (-> curr-bolt ring-radius)) (set! (-> s0-0 w) 0.0) - (let ((f30-0 (* 65536.0 (/ 1.0 (the float (+ num-points -1)))))) - (set! curr-point 0) + (let ((f30-0 (* 65536.0 (/ 1.0 (the float (+ num-points -1))))) + (curr-point 0) + ) (while (< curr-point num-points) (set-point! s2-0 curr-point (vector+! (new 'stack-no-clear 'vector) s4-0 s0-0)) (set-point! s1-0 curr-point (vector+! (new 'stack-no-clear 'vector) s3-0 s0-0)) (vector-rotate-y! s0-0 s0-0 f30-0) - (set! curr-point (+ curr-point 1)) + (+! curr-point 1) ) ) ) @@ -398,19 +398,6 @@ ) ) :trans (behavior () - (local-vars - (sv-176 - (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker) - ) - (sv-192 lightning-spec) - (sv-208 int) - (sv-224 symbol) - (sv-240 symbol) - (sv-256 lightning-spec) - (sv-272 int) - (sv-288 symbol) - (sv-304 symbol) - ) (let ((proc-focus (the-as target (as-type *target* process-focusable)))) (when proc-focus (let ((focus-trans (get-trans proc-focus 0))) @@ -452,73 +439,27 @@ (get-point-at-percent-along-path! (-> self path-r) (new 'stack-no-clear 'vector) (-> s4-1 0 pos) 'interp) ) ) - (let ((s2-0 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s2-0 - (let ((t9-7 (method-of-type lightning-tracker activate))) - (t9-7 - (the-as lightning-tracker s2-0) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s1-0 run-function-in-process) - (s0-0 s2-0) - ) - (set! sv-176 lightning-tracker-init) - (set! sv-192 (-> self params bolt-spec)) - (set! sv-208 15) - (set! sv-224 (the-as symbol #f)) - (set! sv-240 (the-as symbol #f)) - (let ((t3-0 (get-trans proc-focus 3))) - ((the-as (function object object object object object object object object none) s1-0) - s0-0 - sv-176 - sv-192 - sv-208 - sv-224 - sv-240 - s3-2 - t3-0 - ) - ) - ) - (-> s2-0 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self params bolt-spec) + 15 + (the-as symbol #f) + (the-as symbol #f) + s3-2 + (get-trans proc-focus 3) + :to *entity-pool* ) - (let ((s3-3 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s3-3 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 - (the-as lightning-tracker s3-3) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s2-1 run-function-in-process) - (s1-1 s3-3) - (s0-1 lightning-tracker-init) - ) - (set! sv-256 (-> self params bolt-spec)) - (set! sv-272 15) - (set! sv-288 (the-as symbol #f)) - (set! sv-304 (the-as symbol #f)) - (let ((t3-1 (get-trans proc-focus 3))) - ((the-as (function object object object object object object object object none) s2-1) - s1-1 - s0-1 - sv-256 - sv-272 - sv-288 - sv-304 - s4-2 - t3-1 - ) - ) - ) - (-> s3-3 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self params bolt-spec) + 15 + (the-as symbol #f) + (the-as symbol #f) + s4-2 + (get-trans proc-focus 3) + :to *entity-pool* ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc index 7ecaeef189..16341e91bb 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/centurion_REF.gc @@ -603,7 +603,6 @@ ;; definition for method 181 of type centurion ;; INFO: Used lq/sq (defmethod centurion-method-181 ((this centurion) (arg0 vector)) - (local-vars (sv-224 vector) (sv-240 vector) (sv-256 vector)) (if (not (-> this joint-enable)) (return (the-as int #f)) ) @@ -626,21 +625,8 @@ (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) (let ((s2-2 (new 'stack-no-clear 'vector))) - (let ((s0-1 vector-rotate-around-y!)) - (set! sv-224 s4-1) - (set! sv-240 s1-0) - (let ((a2-1 (- (vector-y-angle s1-0)))) - (s0-1 sv-224 sv-240 a2-1) - ) - ) - (let ((s1-1 vector-rotate-around-y!) - (s0-2 s2-2) - ) - (set! sv-256 s3-0) - (let ((a2-2 (- (vector-y-angle s3-0)))) - (s1-1 s0-2 sv-256 a2-2) - ) - ) + (vector-rotate-around-y! s4-1 s1-0 (- (vector-y-angle s1-0))) + (vector-rotate-around-y! s2-2 s3-0 (- (vector-y-angle s3-0))) (let ((f0-9 (deg-diff (atan (-> s4-1 y) (-> s4-1 z)) (atan (-> s2-2 y) (-> s2-2 z))))) (set-vector! s4-1 f0-9 f30-0 0.0 1.0) ) @@ -1139,7 +1125,6 @@ ;; definition for method 182 of type centurion ;; INFO: Used lq/sq (defmethod centurion-method-182 ((this centurion) (arg0 vector)) - (local-vars (sv-96 int) (sv-112 int)) (when (nonzero? (-> this path)) (let ((s5-0 (-> this path)) (s4-0 (new 'stack-no-clear 'vector)) @@ -1149,27 +1134,29 @@ (s0-0 (new 'stack-no-clear 'vector)) ) (set! (-> s0-0 quad) (-> arg0 quad)) - (set! sv-96 0) - (let ((gp-0 0)) - (set! (-> s0-0 y) 0.0) - (set! sv-112 0) - (while (< sv-112 4) - (get-point-in-path! s5-0 s3-0 (the float sv-112) 'interp) - (get-point-in-path! s5-0 s2-0 (the float (+ sv-112 1)) 'interp) - (vector-! s1-0 s0-0 s3-0) - (vector-! s4-0 s2-0 s3-0) - (set! (-> s4-0 y) 0.0) - (vector-rotate90-around-y! s4-0 s4-0) - (cond - ((>= (vector-dot s1-0 s4-0) 0.0) - (+! gp-0 1) - ) - (else - (set! sv-96 (+ sv-96 1)) - sv-96 - ) + (let ((sv-96 0) + (gp-0 0) + ) + (set! (-> s0-0 y) 0.0) + (let ((sv-112 0)) + (while (< sv-112 4) + (get-point-in-path! s5-0 s3-0 (the float sv-112) 'interp) + (get-point-in-path! s5-0 s2-0 (the float (+ sv-112 1)) 'interp) + (vector-! s1-0 s0-0 s3-0) + (vector-! s4-0 s2-0 s3-0) + (set! (-> s4-0 y) 0.0) + (vector-rotate90-around-y! s4-0 s4-0) + (cond + ((>= (vector-dot s1-0 s4-0) 0.0) + (+! gp-0 1) + ) + (else + (+! sv-96 1) + sv-96 + ) + ) + (+! sv-112 1) ) - (set! sv-112 (+ sv-112 1)) ) (if (or (= sv-96 4) (= gp-0 4)) (return #t) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc index 04ee693dc2..b6288aaf37 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/fodder/fodder_REF.gc @@ -650,32 +650,30 @@ (when a0-2 (set! (-> self focus-pos quad) (-> (get-trans (the-as process-focusable a0-2) 0) quad)) (let ((f30-0 (vector-vector-xz-distance-squared (-> self focus-pos) (-> self root trans)))) - (let ((f0-0 24576.0)) - (when (and (< f30-0 (* f0-0 f0-0)) (zero? (-> self slow-timer))) - (let ((v1-20 (-> self nav))) - (set! (-> v1-20 target-speed) 0.0) + (when (and (< f30-0 (square 24576.0)) (zero? (-> self slow-timer))) + (let ((v1-20 (-> self nav))) + (set! (-> v1-20 target-speed) 0.0) + ) + 0 + (let ((v1-22 (-> self nav))) + (set! (-> v1-22 turning-acceleration) 0.0) + ) + 0 + (set-time! (-> self slow-timer)) + (ja-channel-push! 1 (seconds 0.08)) + (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim))) + (ja :num-func num-func-identity :frame-num 0.0) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) ) - 0 - (let ((v1-22 (-> self nav))) - (set! (-> v1-22 turning-acceleration) 0.0) - ) - 0 - (set-time! (-> self slow-timer)) - (ja-channel-push! 1 (seconds 0.08)) - (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim))) - (ja :num-func num-func-identity :frame-num 0.0) - (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) - (logior! (-> self focus-status) (focus-status dangerous)) - (logclear! (-> self focus-status) (focus-status dangerous)) + (let* ((v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-41 (the-as number (logior #x3f800000 v1-40))) + ) + (if (< (+ -1.0 (the-as float v1-41)) 0.5) + (set! (-> self attack-type) (the-as uint 1)) + (set! (-> self attack-type) (the-as uint 2)) ) - (let* ((v1-40 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) - (v1-41 (the-as number (logior #x3f800000 v1-40))) - ) - (if (< (+ -1.0 (the-as float v1-41)) 0.5) - (set! (-> self attack-type) (the-as uint 1)) - (set! (-> self attack-type) (the-as uint 2)) - ) - ) ) ) (when (and (nonzero? (-> self slow-timer)) @@ -781,20 +779,18 @@ ) ) (when (zero? (-> self attack-type)) - (let ((f0-20 20480.0)) - (when (and (< f30-0 (* f0-20 f0-20)) (time-elapsed? (-> self look-at-other-time) (seconds 0.125))) - (let ((v1-117 (ja-channel-float! (the-as art-joint-anim fodder-snap-ja) 0.0 0.0 0.0))) - (when v1-117 - (set! (-> self skel interp-select 0) #xe00010) - (set! (-> self skel interp-select 1) 0) - (set! (-> v1-117 param 0) 1.0) - (set! (-> v1-117 param 1) 1.0) - (set! (-> v1-117 param 2) 1.0) - (set! (-> v1-117 num-func) num-func-interp1-play!) - ) + (when (and (< f30-0 (square 20480.0)) (time-elapsed? (-> self look-at-other-time) (seconds 0.125))) + (let ((v1-117 (ja-channel-float! (the-as art-joint-anim fodder-snap-ja) 0.0 0.0 0.0))) + (when v1-117 + (set! (-> self skel interp-select 0) #xe00010) + (set! (-> self skel interp-select 1) 0) + (set! (-> v1-117 param 0) 1.0) + (set! (-> v1-117 param 1) 1.0) + (set! (-> v1-117 param 2) 1.0) + (set! (-> v1-117 num-func) num-func-interp1-play!) ) - (set-time! (-> self look-at-other-time)) ) + (set-time! (-> self look-at-other-time)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc index 1934b74588..742f73280c 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/grunt_REF.gc @@ -421,11 +421,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) @@ -754,23 +750,18 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let* ((f30-0 v1-5) - (f0-0 arg0) - (f28-0 (* f0-0 f0-0)) - (f0-2 12288.0) - ) - (when (or (>= (* f0-2 f0-2) f30-0) (>= f28-0 f30-0)) + (let ((f30-0 v1-5) + (f28-0 (square arg0)) + ) + (when (or (>= (square 12288.0) f30-0) (>= f28-0 f30-0)) (let ((f26-0 (quaternion-y-angle (-> this root quat))) (f0-7 (atan (-> s4-0 x) (-> s4-0 z))) - (f1-0 1228.8) ) (cond - ((and (< (* f1-0 f1-0) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) + ((and (< (square 1228.8) f30-0) (>= f28-0 f30-0) (>= 8192.0 (fabs (deg- f26-0 f0-7)))) (go (method-of-object this attack)) ) - ((let ((f0-10 12288.0)) - (< f30-0 (* f0-10 f0-10)) - ) + ((< f30-0 (square 12288.0)) (go (method-of-object this spin-attack)) ) ) @@ -799,10 +790,7 @@ (when (and (>= gp-0 (-> self next-warn-time)) (not (logtest? (-> self draw status) (draw-control-status on-screen))) ) - (when (and a0-1 (let ((f0-0 65536.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans))) - ) - ) + (when (and a0-1 (>= (square 65536.0) (vector-vector-xz-distance-squared (get-trans a0-1 0) (-> self root trans)))) (sound-play "grunt-warn") (set! (-> self next-warn-time) (+ gp-0 (rnd-int-range self 300 360))) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc index 2fc17038a0..33ae0cbf95 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/guards/crimson-guard-level_REF.gc @@ -1433,14 +1433,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod crimson-guard-level-method-196 ((this crimson-guard-level) (arg0 vector)) - (local-vars - (sv-240 vector) - (sv-256 (function vector vector vector)) - (sv-272 vector) - (sv-288 vector) - (sv-304 vector) - (sv-320 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1449,8 +1441,9 @@ (vf7 :class vf) ) (init-vf0-vector) - (set! sv-240 arg0) - (let ((s0-0 (new 'stack-no-clear 'vector))) + (let ((sv-240 arg0) + (s0-0 (new 'stack-no-clear 'vector)) + ) (let ((v1-1 (-> this root trans))) (let ((a0-1 *y-vector*)) (let ((a1-2 8192.0)) @@ -1464,9 +1457,9 @@ (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> s0-0 quad) vf6) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-320 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'vector)) (s5-0 (new 'stack-no-clear 'vector)) ) @@ -1528,18 +1521,15 @@ (.svf (&-> a1-8 quad) vf6) ) (vector-normalize! (vector-! sv-320 sv-240 s0-0) 1.0) - (set! sv-288 (new 'stack-no-clear 'vector)) - (let ((v1-20 (-> sv-240 quad))) - (set! (-> sv-288 quad) v1-20) + (let ((sv-288 (new 'stack-no-clear 'vector))) + (set! (-> sv-288 quad) (-> sv-240 quad)) + (vector+! sv-288 sv-288 (vector-rotate90-around-y! + (new 'stack-no-clear 'vector) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272) + ) + ) + (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) ) - (set! sv-256 vector-rotate90-around-y!) - (set! sv-272 (new 'stack-no-clear 'vector)) - (let* ((a1-13 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) sv-288 s0-0) -2998.272)) - (v0-5 (sv-256 sv-272 a1-13)) - ) - (vector+! sv-288 sv-288 v0-5) - ) - (vector-normalize! (vector-! sv-320 sv-288 s0-0) 1.0) (vector-z-quaternion! sv-304 (-> this root quat)) (rot-zxy-from-vector! s2-0 sv-304) (rot-zxy-from-vector! s1-0 sv-320) @@ -2292,7 +2282,6 @@ ;; definition for method 199 of type crimson-guard-level ;; INFO: Used lq/sq (defmethod crimson-guard-level-method-199 ((this crimson-guard-level) (arg0 vector) (arg1 vector) (arg2 vector) (arg3 float)) - (local-vars (sv-672 vector) (sv-688 vector) (sv-704 vector) (sv-720 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2342,29 +2331,31 @@ (let ((f0-5 (probe-using-line-sphere *collide-cache* s1-0))) (cond ((>= f0-5 0.0) - (set! sv-672 (new 'stack-no-clear 'vector)) - (let ((v1-16 (-> s1-0 start-pos))) - (let ((a0-20 (-> s1-0 move-dist))) - (let ((a1-4 f0-5)) - (.mov vf7 a1-4) + (let ((sv-672 (new 'stack-no-clear 'vector))) + (let ((v1-16 (-> s1-0 start-pos))) + (let ((a0-20 (-> s1-0 move-dist))) + (let ((a1-4 f0-5)) + (.mov vf7 a1-4) + ) + (.lvf vf5 (&-> a0-20 quad)) ) - (.lvf vf5 (&-> a0-20 quad)) + (.lvf vf4 (&-> v1-16 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-672 quad) vf6) + (let ((sv-688 (new 'stack-no-clear 'vector))) + (set! (-> s4-0 quad) (-> sv-672 quad)) + (+! (-> sv-672 x) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-672 y) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-672 z) (rand-vu-float-range -819.2 819.2)) + (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-672) + (+! (-> this l-control state points-to-draw) 1) + (quaternion-from-two-vectors! (the-as quaternion sv-688) s2-0 (-> s1-0 best-other-tri normal)) + (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-688)) ) - (.lvf vf4 (&-> v1-16 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-672 quad) vf6) - (set! sv-688 (new 'stack-no-clear 'vector)) - (set! (-> s4-0 quad) (-> sv-672 quad)) - (+! (-> sv-672 x) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-672 y) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-672 z) (rand-vu-float-range -819.2 819.2)) - (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-672) - (+! (-> this l-control state points-to-draw) 1) - (quaternion-from-two-vectors! (the-as quaternion sv-688) s2-0 (-> s1-0 best-other-tri normal)) - (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-688)) (set! (-> s2-0 quad) (-> s1-0 best-other-tri normal quad)) (vector-flatten! s3-0 s3-0 (-> s1-0 best-other-tri normal)) ) @@ -2390,44 +2381,46 @@ (let ((f0-14 (probe-using-line-sphere *collide-cache* s1-0))) (cond ((>= f0-14 0.0) - (set! sv-704 (new 'stack-no-clear 'vector)) - (let ((v1-37 (-> s1-0 start-pos))) - (let ((a0-38 (-> s1-0 move-dist))) - (let ((a1-17 f0-14)) - (.mov vf7 a1-17) - ) - (.lvf vf5 (&-> a0-38 quad)) - ) - (.lvf vf4 (&-> v1-37 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-704 quad) vf6) - (set! sv-720 (new 'stack-no-clear 'vector)) - (let ((a1-18 sv-704)) - (let ((v1-40 sv-704)) - (let ((a0-39 s2-0)) - (let ((a2-9 2048.0)) - (.mov vf7 a2-9) + (let ((sv-704 (new 'stack-no-clear 'vector))) + (let ((v1-37 (-> s1-0 start-pos))) + (let ((a0-38 (-> s1-0 move-dist))) + (let ((a1-17 f0-14)) + (.mov vf7 a1-17) ) - (.lvf vf5 (&-> a0-39 quad)) + (.lvf vf5 (&-> a0-38 quad)) ) - (.lvf vf4 (&-> v1-40 quad)) + (.lvf vf4 (&-> v1-37 quad)) ) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-18 quad) vf6) + (.svf (&-> sv-704 quad) vf6) + (let ((sv-720 (new 'stack-no-clear 'vector))) + (let ((a1-18 sv-704)) + (let ((v1-40 sv-704)) + (let ((a0-39 s2-0)) + (let ((a2-9 2048.0)) + (.mov vf7 a2-9) + ) + (.lvf vf5 (&-> a0-39 quad)) + ) + (.lvf vf4 (&-> v1-40 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-18 quad) vf6) + ) + (set! (-> s4-0 quad) (-> sv-704 quad)) + (+! (-> sv-704 x) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-704 y) (rand-vu-float-range -819.2 819.2)) + (+! (-> sv-704 z) (rand-vu-float-range -819.2 819.2)) + (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-704) + (+! (-> this l-control state points-to-draw) 1) + (quaternion-from-two-vectors! (the-as quaternion sv-720) s2-0 (-> s1-0 best-other-tri normal)) + (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-720)) + ) ) - (set! (-> s4-0 quad) (-> sv-704 quad)) - (+! (-> sv-704 x) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-704 y) (rand-vu-float-range -819.2 819.2)) - (+! (-> sv-704 z) (rand-vu-float-range -819.2 819.2)) - (set-point! (-> this l-control) (-> this l-control state points-to-draw) sv-704) - (+! (-> this l-control state points-to-draw) 1) - (quaternion-from-two-vectors! (the-as quaternion sv-720) s2-0 (-> s1-0 best-other-tri normal)) - (vector-orient-by-quat! s3-0 s3-0 (the-as quaternion sv-720)) (set! (-> s2-0 quad) (-> s1-0 best-other-tri normal quad)) (vector-flatten! s3-0 s3-0 (-> s1-0 best-other-tri normal)) ) @@ -2456,7 +2449,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defmethod crimson-guard-level-method-198 ((this crimson-guard-level)) - (local-vars (sv-784 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2519,15 +2511,14 @@ (vector+! s5-0 s4-0 s1-0) (point-in-plane-<-point+normal! s2-1 s5-0 (-> s3-0 best-other-tri normal)) (vector-! s2-1 s2-1 s5-0) - (let ((s1-1 quaternion-vector-angle!) - (s0-0 (new 'stack-no-clear 'quaternion)) + (let ((a2-4 (quaternion-vector-angle! + (new 'stack-no-clear 'quaternion) + (-> s3-0 best-other-tri normal) + (rand-vu-float-range 0.0 65536.0) + ) + ) ) - (set! sv-784 (-> s3-0 best-other-tri normal)) - (let* ((a2-3 (rand-vu-float-range 0.0 65536.0)) - (a2-4 (s1-1 s0-0 sv-784 a2-3)) - ) - (vector-orient-by-quat! s2-1 s2-1 a2-4) - ) + (vector-orient-by-quat! s2-1 s2-1 a2-4) ) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s4-0) (part-tracker-spawn :to this :group part-crimson-lightning-glow :mat-joint s5-0) @@ -3722,14 +3713,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] (defmethod crimson-guard-level-method-202 ((this crimson-guard-level) (arg0 vector)) - (local-vars - (f0-8 float) - (sv-768 vector) - (sv-784 vector) - (sv-800 nav-control) - (sv-816 nav-poly) - (sv-832 vector) - ) + (local-vars (f0-8 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -3744,8 +3728,8 @@ (dotimes (s3-0 2) (vector-normalize! s4-0 (* 4096.0 (+ 4.0 (* 2.0 (the float s3-0))))) (dotimes (s2-0 6) - (set! sv-768 (new 'stack-no-clear 'vector)) - (let ((s1-0 (new 'stack-no-clear 'vector)) + (let ((sv-768 (new 'stack-no-clear 'vector)) + (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack 'collide-query)) ) (vector-rotate-around-y! sv-768 s4-0 (* 182.04445 (the float (+ (* 23 s2-0) -70)))) @@ -3774,58 +3758,53 @@ (vector-! (-> a1-7 point) a0-8 (-> v1-14 state mesh bounds)) (set! (-> a1-7 y-threshold) (-> v1-14 nearest-y-threshold)) (set! (-> a1-7 ignore) (the-as uint 2)) - (set! sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7)) - ) - (when sv-816 - (let* ((v1-18 s4-0) - (f0-7 (-> sv-768 x)) - (f1-4 (-> sv-768 y)) - (f2-2 (-> sv-768 z)) - (f3-2 (-> v1-18 x)) - (f4-0 (-> v1-18 y)) - (f5-0 (-> v1-18 z)) - ) - (.mula.s f0-7 f3-2) - (.madda.s f1-4 f4-0) - (.madd.s f0-8 f2-2 f5-0) - ) - (let ((f28-0 f0-8)) - #t - (new 'stack-no-clear 'vector) - (let ((a1-8 (new 'stack-no-clear 'vector))) - (set! (-> a1-8 quad) (-> s1-0 quad)) - (set! (-> a1-8 w) 8192.0) - (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) - (when (< f30-0 f28-0) - (set! f30-0 f28-0) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! sv-800 (-> this nav)) - (set! sv-832 sv-784) - (let* ((v1-30 s1-0) - (a0-18 (-> sv-800 state mesh)) - (t9-7 (method-of-object a0-18 project-point-onto-plane-of-poly-local)) - (a2-7 sv-832) - (t0-2 (vector-! (new 'stack-no-clear 'vector) v1-30 (-> sv-800 state mesh bounds))) - ) - (t9-7 a0-18 sv-816 a2-7 a3-3 t0-2) + (let ((sv-816 (find-poly-containing-point-local (-> v1-14 state mesh) a1-7))) + (when sv-816 + (let* ((v1-18 s4-0)) + (set! f0-8 (vector-dot sv-768 v1-18)) + ) + (let ((f28-0 f0-8)) + #t + (new 'stack-no-clear 'vector) + (let ((a1-8 (new 'stack-no-clear 'vector))) + (set! (-> a1-8 quad) (-> s1-0 quad)) + (set! (-> a1-8 w) 8192.0) + (when (not (add-root-sphere-to-hash! (-> this nav) a1-8 32)) + (when (< f30-0 f28-0) + (set! f30-0 f28-0) + (let ((sv-784 (new 'stack-no-clear 'vector))) + (let ((a3-3 (new 'stack-no-clear 'vector)) + (sv-800 (-> this nav)) + (sv-832 sv-784) + ) + (let ((v1-30 s1-0)) + (project-point-onto-plane-of-poly-local + (-> sv-800 state mesh) + sv-816 + sv-832 + a3-3 + (vector-! (new 'stack-no-clear 'vector) v1-30 (-> sv-800 state mesh bounds)) + ) + ) + (let ((v1-31 sv-832)) + (let ((a0-21 (-> sv-800 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-832 quad)) + (.lvf vf5 (&-> a0-21 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-31 quad) vf6) + ) + ) + 0 + (set! (-> s1-0 y) (-> sv-784 y)) + ) + (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) + ) + (set! (-> arg0 quad) (-> s1-0 quad)) ) ) - (let ((v1-31 sv-832)) - (let ((a0-21 (-> sv-800 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-832 quad)) - (.lvf vf5 (&-> a0-21 quad)) - ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-31 quad) vf6) - ) - 0 - (set! (-> s1-0 y) (-> sv-784 y)) - (if (enemy-above-ground? this s0-0 s1-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s1-0 y) (-> s0-0 best-other-tri intersect y)) - ) - (set! (-> arg0 quad) (-> s1-0 quad)) ) ) ) @@ -4202,14 +4181,14 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this crimson-guard-level)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 int)) (let ((f0-0 (res-lump-float (-> this entity) 'rotoffset))) (if (!= f0-0 0.0) (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-0) ) ) - (set! sv-16 0) - (let ((v1-6 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (v1-6 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when v1-6 (+! (-> this root trans x) (-> v1-6 x)) (+! (-> this root trans y) (-> v1-6 y)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc index 73e6fddabb..7283748cfb 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc @@ -419,7 +419,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this triggered?) #f) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) @@ -440,8 +439,9 @@ (set! (-> this skip-mask) (the-as uint (lognot v1-2))) ) (let ((s5-1 (and (-> this entity) (logtest? (-> this entity extra perm status) (entity-perm-status bit-12))))) - (set! sv-16 (new 'static 'res-tag)) - (let ((s4-0 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s4-0 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (or (not s4-0) (zero? (-> sv-16 elt-count))) (go process-drawable-art-error "missing actors") ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc index 9601a658a4..ef2026912f 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hopper_REF.gc @@ -547,7 +547,6 @@ ;; definition for method 178 of type hopper ;; INFO: Used lq/sq (defmethod hopper-method-178 ((this hopper)) - (local-vars (sv-752 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -599,28 +598,29 @@ (when (not (add-root-sphere-to-hash! (-> this nav) a1-3 #x8006c)) (when (< (-> this best-score) f30-0) (set! (-> this best-score) f30-0) - (let ((s2-0 (new 'stack-no-clear 'vector))) - (set! sv-752 (new 'stack-no-clear 'vector)) - (let ((s3-1 (new 'stack 'collide-query))) - (let ((s0-0 (-> this nav)) - (s1-0 s2-0) - ) - (let* ((v1-21 s5-0) - (a0-10 (-> s0-0 state mesh)) - (t9-4 (method-of-object a0-10 project-point-onto-plane-of-poly-local)) - (a2-5 s1-0) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-21 (-> s0-0 state mesh bounds))) - ) - (t9-4 a0-10 s4-0 a2-5 sv-752 t0-1) - ) - (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) + (let ((s2-0 (new 'stack-no-clear 'vector)) + (sv-752 (new 'stack-no-clear 'vector)) + (s3-1 (new 'stack 'collide-query)) ) - 0 - (set! (-> s5-0 y) (-> s2-0 y)) - (if (enemy-above-ground? this s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s5-0 y) (-> s3-1 best-other-tri intersect y)) + (let ((s0-0 (-> this nav)) + (s1-0 s2-0) ) + (let ((v1-21 s5-0)) + (project-point-onto-plane-of-poly-local + (-> s0-0 state mesh) + s4-0 + s1-0 + sv-752 + (vector-! (new 'stack-no-clear 'vector) v1-21 (-> s0-0 state mesh bounds)) + ) + ) + (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) ) + 0 + (set! (-> s5-0 y) (-> s2-0 y)) + (if (enemy-above-ground? this s3-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s5-0 y) (-> s3-1 best-other-tri intersect y)) + ) ) (set! (-> this best-point quad) (-> s5-0 quad)) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc index 6182215519..8148c1a199 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/crimson-guard-hover_REF.gc @@ -752,13 +752,9 @@ :enter (behavior () (set-time! (-> self state-time)) (set! (-> self attack-miss-dist-curr) (-> self attack-miss-dist-min)) - (let ((f0-1 (vector-vector-distance-squared (-> self root trans) (-> self focus-pos))) - (f1-0 122880.0) - ) - (if (< f0-1 (* f1-0 f1-0)) - (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (-> self focus-pos)) (square 122880.0)) + (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) + ) (set! (-> self shots-fired) 0) 0 ) @@ -939,13 +935,9 @@ ) :code (behavior () (sound-play "hover-warn") - (let ((f0-0 (vector-vector-distance-squared (-> self root trans) (-> self focus-pos))) - (f1-0 122880.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (-> self focus-pos)) (square 122880.0)) + (speech-control-method-12 *speech-control* self (speech-type speech-type-9)) + ) (ja-channel-push! 1 (seconds 0.2)) (ja-no-eval :group! (-> self draw art-group data (-> self hover-info shoot-anim)) :num! (seek!) @@ -1132,11 +1124,9 @@ ) (when (> (-> this hit-points) 0) (let ((v1-23 (the-as process (as-type (handle->process (-> this incoming attacker-handle)) process-focusable)))) - (if (and *target* v1-23 (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-0 122880.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (if (and *target* + v1-23 + (< (vector-vector-distance-squared (-> this root trans) (-> this focus-pos)) (square 122880.0)) ) (speech-control-method-12 *speech-control* this (speech-type speech-type-11)) ) @@ -1151,11 +1141,7 @@ (when (= (the-as symbol a0-27) 'attack) (when (logtest? (-> (the-as process-focusable v1-31) mask) (process-mask target)) (if (and (focus-test? (the-as process-focusable v1-31) dead) - (let ((f0-1 (vector-vector-distance-squared (-> this root trans) (-> this focus-pos))) - (f1-3 122880.0) - ) - (< f0-1 (* f1-3 f1-3)) - ) + (< (vector-vector-distance-squared (-> this root trans) (-> this focus-pos)) (square 122880.0)) ) (speech-control-method-12 *speech-control* this (speech-type speech-type-10)) ) @@ -1217,7 +1203,7 @@ (set! v1-1 arg3) ) (let* ((f0-2 (- 1.0 arg1)) - (a2-2 (- 1.0 (* f0-2 f0-2 f0-2))) + (a2-2 (- 1.0 (* (square f0-2) f0-2))) (a3-7 (-> this skel root-channel arg0)) ) (let ((f0-6 (fabs a2-2))) @@ -1373,78 +1359,72 @@ (s4-0 (-> this main-joint-vel)) (gp-0 (lambda ((arg0 crimson-guard-hover) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 quaternion) (sv-224 vector)) - (set! sv-192 arg2) - (let ((s0-0 arg3)) - (set! sv-224 arg4) - (let ((s1-0 arg5) - (s3-0 arg6) - (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) - (s5-0 (new 'stack-no-clear 'matrix)) - (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) - ) - (set! sv-208 (new 'stack-no-clear 'quaternion)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! sv-208 a1-3 sv-192) - (quaternion->matrix s5-0 sv-208) - (set! (-> s2-1 quad) (-> arg0 root scale quad)) - (scale-matrix! s5-0 s2-1 s5-0) - (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) - (t9-6 vector-inv-orient-by-quat!) - (a0-10 (new 'stack-no-clear 'vector)) - (a2-4 (-> arg0 root quat)) - (v0-6 (t9-6 a0-10 sv-224 a2-4)) - (f30-0 (* 2867200.0 (seconds-per-frame))) - (f28-0 - (seek - (-> arg0 thrust s3-0) - (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) - (fmax 0.0 (-> v0-6 y)) - (fabs (/ (-> v0-6 z) 5)) - (fmax 0.0 (-> s1-1 y)) - ) - (/ f30-0 5) - ) - ) - ) - (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) - (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) - (f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) - (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) - ) - (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) - (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) - (f2-6 (fmin 1.0 (-> s2-1 x))) - (f0-14 (fmin 1.0 (-> s2-1 y))) + (let ((sv-192 arg2) + (s0-0 arg3) + (sv-224 arg4) + (s1-0 arg5) + (s3-0 arg6) + (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) + (s5-0 (new 'stack-no-clear 'matrix)) + (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) + (sv-208 (new 'stack-no-clear 'quaternion)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! sv-208 a1-3 sv-192) + (quaternion->matrix s5-0 sv-208) + (set! (-> s2-1 quad) (-> arg0 root scale quad)) + (scale-matrix! s5-0 s2-1 s5-0) + (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) + (v0-6 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) sv-224 (-> arg0 root quat))) + (f30-0 (* 2867200.0 (seconds-per-frame))) + (f28-0 + (seek + (-> arg0 thrust s3-0) + (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) + (fmax 0.0 (-> v0-6 y)) + (fabs (/ (-> v0-6 z) 5)) + (fmax 0.0 (-> s1-1 y)) ) - (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-14)) - (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-14)) - (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-14)) - (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-14)) - (set! (-> arg0 thrust s3-0) f28-0) - (let ((f0-15 (* f26-0 f0-14))) - (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-15 -2)) - ) - ) + (/ f30-0 5) + ) + ) + ) + (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) + (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) + (f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) + (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) ) - (set! (-> s5-0 trans quad) (-> s4-0 quad)) - (spawn-with-matrix (-> arg0 engine-part) s5-0) - (let ((f0-17 (lerp-scale 0.4 1.0 f28-0 1638.4 f30-0))) - (sound-play-by-name - (static-sound-name "hover-jets") - (-> arg0 sound-id) - (the int (* 1024.0 f0-17)) - 0 - 0 - (sound-group sfx) - #t + (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) + (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) + (f2-6 (fmin 1.0 (-> s2-1 x))) + (f0-14 (fmin 1.0 (-> s2-1 y))) ) + (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-14)) + (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-14)) + (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-14)) + (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-14)) + (set! (-> arg0 thrust s3-0) f28-0) + (let ((f0-15 (* f26-0 f0-14))) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-15 -2)) ) ) ) + (set! (-> s5-0 trans quad) (-> s4-0 quad)) + (spawn-with-matrix (-> arg0 engine-part) s5-0) + (let ((f0-17 (lerp-scale 0.4 1.0 f28-0 1638.4 f30-0))) + (sound-play-by-name + (static-sound-name "hover-jets") + (-> arg0 sound-id) + (the int (* 1024.0 f0-17)) + 0 + 0 + (sound-group sfx) + #t + ) + ) ) ) 0 @@ -1756,7 +1736,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this crimson-guard-hover)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-149 this) (init-enemy-behaviour-and-stats! this (hover-enemy-method-150 this)) (hover-enemy-method-155 this) @@ -1777,15 +1756,17 @@ (set! (-> this hips-jmod) (the-as joint-mod (new 'process 'joint-mod-rotate-local this 18 #t))) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-30 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-30 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-30 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-30 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-34 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-34 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-34 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-34 0)) @@ -1797,16 +1778,18 @@ ) ) ) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-40 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48)))) + (let* ((sv-48 (new 'static 'res-tag)) + (v1-40 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48))) + ) (set! (-> this attack-miss-dist-min) (if (and v1-40 (> (the-as int (-> sv-48 elt-count)) 0)) (-> v1-40 0) -40960.0 ) ) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) (set! (-> this attack-miss-dist-max) (if (and v1-43 (< 1 (the-as int (-> sv-64 elt-count)))) (-> v1-43 1) 40960.0 diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc index 49b94de027..7aff17c44a 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy-battle_REF.gc @@ -293,12 +293,12 @@ ;; WARN: Return type mismatch int vs none. (defmethod hover-enemy-manager-init! ((this hover-enemy-manager) (arg0 (array hover-enemy-battle-command))) "Initialize this [[hover-enemy-manager]]." - (local-vars (sv-16 res-tag)) (set! (-> this command-table) arg0) (set! (-> this path) (new 'process 'path-control this 'path 0.0 (-> this entity) #f)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-5 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-5 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-5 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-5)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc index c83391370b..1380024e2f 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-enemy_REF.gc @@ -43,9 +43,7 @@ ) (('update-formation) (let ((s5-1 (the-as object (-> arg3 param 0)))) - (let* ((f0-0 409.6) - (f0-2 (* f0-0 f0-0)) - ) + (let ((f0-2 (square 409.6))) (.lvf vf1 (&-> (vector-! (new 'stack-no-clear 'vector) (the-as vector s5-1) (-> this offset)) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc index 6d2516387d..94664c6956 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-formation_REF.gc @@ -202,7 +202,6 @@ (arg2 (function form-search-info float)) (arg3 form-search-info) ) - (local-vars (sv-80 int)) (let ((s2-0 (new 'stack-no-clear 'array 'int32 32))) (dotimes (v1-0 arg0) (set! (-> s2-0 v1-0) 0) @@ -216,16 +215,16 @@ 0 ) (else - (let ((s0-0 arg1)) - (set! sv-80 s1-0) - (let ((a1-1 (if (odd? s1-0) - (-> s2-0 s1-0) - 0 - ) - ) - (a2-1 arg3) + (let ((s0-0 arg1) + (sv-80 s1-0) + ) + (s0-0 + sv-80 + (if (odd? s1-0) + (-> s2-0 s1-0) + 0 ) - (s0-0 sv-80 a1-1 a2-1) + arg3 ) ) (+! (-> s2-0 s1-0) 1) @@ -666,7 +665,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-32 structure)) (set! (-> this path) (new 'process 'path-control this 'path 0.0 (-> this entity) #f)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) (let* ((s5-0 (method-of-type hover-formation-control new)) @@ -680,25 +678,29 @@ ) ) (s0-0 (res-lump-float (-> this entity) 'notice-dist :default 225280.0)) + (t9-3 (method-of-type res-lump get-property-struct)) + (a0-5 (-> this entity)) + (a1-4 'trans-offset) + (a2-3 'interp) + (a3-2 -1000000000.0) + (t0-2 (new 'stack-no-clear 'vector)) ) - (let ((t9-3 (method-of-type res-lump get-property-struct)) - (a0-5 (-> this entity)) - (a1-4 'trans-offset) - (a2-3 'interp) - (a3-2 -1000000000.0) - (t0-2 (new 'stack-no-clear 'vector)) + (set! (-> t0-2 x) 0.0) + (set! (-> t0-2 y) 20480.0) + (set! (-> t0-2 z) 61440.0) + (set! (-> t0-2 w) 1.0) + (set! (-> this formation) + (s5-0 + s4-0 + s3-0 + s2-0 + s1-0 + s0-0 + (the-as vector (t9-3 a0-5 a1-4 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*)) + (res-lump-float (-> this entity) 'rotoffset :default 5461.3335) + (the-as handle #f) + ) ) - (set! (-> t0-2 x) 0.0) - (set! (-> t0-2 y) 20480.0) - (set! (-> t0-2 z) 61440.0) - (set! (-> t0-2 w) 1.0) - (set! sv-32 (t9-3 a0-5 a1-4 a2-3 a3-2 t0-2 (the-as (pointer res-tag) #f) *res-static-buf*)) - ) - (let ((t2-4 (res-lump-float (-> this entity) 'rotoffset :default 5461.3335)) - (t3-0 #f) - ) - (set! (-> this formation) (s5-0 s4-0 s3-0 s2-0 s1-0 s0-0 (the-as vector sv-32) t2-4 (the-as handle t3-0))) - ) ) (set! (-> this formation-timer) (the-as uint (current-time))) (logclear! (-> this mask) (process-mask actor-pause)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc index d7eca02b5d..bd07b9c92f 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-control_REF.gc @@ -832,7 +832,6 @@ ;; definition for method 26 of type nav-network ;; INFO: Used lq/sq (defmethod nav-network-method-26 ((this nav-network) (arg0 vector) (arg1 process) (arg2 vector) (arg3 vector) (arg4 float)) - (local-vars (sv-48 vector) (sv-64 sphere)) (vector-reset! arg0) (let ((s1-0 (process->handle arg1)) (s2-0 0) @@ -841,17 +840,16 @@ (while v1-3 (let ((s0-0 (-> v1-3 next))) (when (!= (-> (the-as hover-nav-sphere v1-3) handle) s1-0) - (set! sv-64 (-> (the-as hover-nav-sphere v1-3) sphere)) - (set! sv-48 (new 'stack-no-clear 'vector)) - (vector-segment-distance-point! sv-64 arg2 arg3 sv-48) - (when (>= (+ arg4 (-> sv-64 r)) (vector-vector-distance sv-64 sv-48)) - (let* ((v1-8 (new 'stack-no-clear 'vector)) - (a0-6 arg2) - (v1-9 (vector-! v1-8 (the-as vector sv-64) a0-6)) - ) - (vector+! arg0 arg0 v1-9) + (let ((sv-64 (-> (the-as hover-nav-sphere v1-3) sphere)) + (sv-48 (new 'stack-no-clear 'vector)) + ) + (vector-segment-distance-point! sv-64 arg2 arg3 sv-48) + (when (>= (+ arg4 (-> sv-64 r)) (vector-vector-distance sv-64 sv-48)) + (let ((v1-9 (vector-! (new 'stack-no-clear 'vector) (the-as vector sv-64) arg2))) + (vector+! arg0 arg0 v1-9) + ) + (+! s2-0 1) ) - (+! s2-0 1) ) ) (set! v1-3 s0-0) @@ -1088,67 +1086,62 @@ ;; WARN: Stack slot offset 32 signed mismatch ;; WARN: Return type mismatch int vs none. (defmethod hover-nav-control-method-28 ((this hover-nav-control) (arg0 vector) (arg1 vector)) - (local-vars (v0-15 symbol) (sv-32 int) (sv-48 (function hover-nav-control vector vector int))) - (let ((s4-0 (-> this nav network)) - (s5-0 (-> this path-info)) - (s1-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 arg1) 1.0)) - ) - (set! sv-32 (hover-nav-control-method-27 this arg1 s1-0)) + (local-vars (v0-15 symbol)) + (let* ((s4-0 (-> this nav network)) + (s5-0 (-> this path-info)) + (s1-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 arg1) 1.0)) + (sv-32 (hover-nav-control-method-27 this arg1 s1-0)) + ) (set! v0-15 (cond (sv-32 (when (or (!= sv-32 (-> this curr-dest-pt)) (not (-> this path-info segment-list))) - (let ((s0-0 this)) - (set! sv-48 (method-of-object s0-0 hover-nav-control-method-27)) - (let* ((a2-2 (vector-negate! s1-0 s1-0)) - (s2-1 (sv-48 s0-0 arg0 a2-2)) - ) - (when s2-1 - (cond - ((= s2-1 sv-32) - (if *debug-hover* - (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-dark-blue*) - ) - (nav-network-method-22 (-> this nav) s5-0 (-> s4-0 sv-32 pos) arg1 -1 -1) - (nav-network-method-22 - (-> this nav) - s5-0 - (-> (hover-nav-control-method-17 this) world-sphere) - (-> s4-0 s2-1 pos) - -1 - -1 + (let ((s2-1 (hover-nav-control-method-27 this arg0 (vector-negate! s1-0 s1-0)))) + (when s2-1 + (cond + ((= s2-1 sv-32) + (if *debug-hover* + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-dark-blue*) ) + (nav-network-method-22 (-> this nav) s5-0 (-> s4-0 sv-32 pos) arg1 -1 -1) + (nav-network-method-22 + (-> this nav) + s5-0 + (-> (hover-nav-control-method-17 this) world-sphere) + (-> s4-0 s2-1 pos) + -1 + -1 ) - (else - (when *debug-hover* - (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 s2-1 pos) (meters 1) *color-green*) - (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-cyan*) - ) - (let* ((a0-14 (-> this nav)) - (t9-10 (method-of-object a0-14 nav-network-method-22)) - (a1-11 s5-0) - (a2-8 (-> s4-0 sv-32 pos)) - (a3-5 arg1) - (t0-5 -1) - ) - (t9-10 a0-14 a1-11 a2-8 a3-5 t0-5 -1) - (nav-network-method-24 (-> this nav) s5-0 s2-1 sv-32 t0-5) - ) - (nav-network-method-22 - (-> this nav) - s5-0 - (-> (hover-nav-control-method-17 this) world-sphere) - (-> s4-0 s2-1 pos) - -1 - -1 - ) + ) + (else + (when *debug-hover* + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 s2-1 pos) (meters 1) *color-green*) + (add-debug-sphere #t (bucket-id debug-no-zbuf1) (-> s4-0 sv-32 pos) (meters 1) *color-cyan*) + ) + (let* ((a0-14 (-> this nav)) + (t9-10 (method-of-object a0-14 nav-network-method-22)) + (a1-11 s5-0) + (a2-8 (-> s4-0 sv-32 pos)) + (a3-5 arg1) + (t0-5 -1) + ) + (t9-10 a0-14 a1-11 a2-8 a3-5 t0-5 -1) + (nav-network-method-24 (-> this nav) s5-0 s2-1 sv-32 t0-5) + ) + (nav-network-method-22 + (-> this nav) + s5-0 + (-> (hover-nav-control-method-17 this) world-sphere) + (-> s4-0 s2-1 pos) + -1 + -1 ) ) - (hover-nav-control-method-29 this (-> this root transv)) - (set! (-> s5-0 curr-segment) (-> s5-0 segment-list)) - (set! (-> s5-0 curr-u) (/ 16384.0 (-> s5-0 curr-segment dist))) - (set! (-> this curr-dest-pt) sv-32) ) + (hover-nav-control-method-29 this (-> this root transv)) + (set! (-> s5-0 curr-segment) (-> s5-0 segment-list)) + (set! (-> s5-0 curr-u) (/ 16384.0 (-> s5-0 curr-segment dist))) + (set! (-> this curr-dest-pt) sv-32) ) ) ) @@ -1317,20 +1310,21 @@ ;; definition for method 15 of type hover-nav-control ;; WARN: Return type mismatch vector vs none. (defmethod hover-nav-control-method-15 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-32 vector) (sv-36 collide-shape-moving)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (set! sv-36 (-> this root)) - (vector-inv-orient-by-quat! sv-32 (-> sv-36 transv) (-> sv-36 quat)) - (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-30 this))) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (let ((sv-36 (-> this root))) + (vector-inv-orient-by-quat! sv-32 (-> sv-36 transv) (-> sv-36 quat)) + ) + (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-30 this))) + ) (none) ) ;; definition for method 16 of type hover-nav-control (defmethod hover-nav-control-method-16 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-32 vector)) - (set! sv-32 (new 'stack-no-clear 'vector)) - (vector-inv-orient-by-quat! sv-32 (-> this transvv) (-> this root quat)) - (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-31 this))) + (let ((sv-32 (new 'stack-no-clear 'vector))) + (vector-inv-orient-by-quat! sv-32 (-> this transvv) (-> this root quat)) + (vector-float*! arg0 sv-32 (/ 1.0 (hover-nav-control-method-31 this))) + ) ) ;; definition for method 10 of type hover-nav-control @@ -1403,7 +1397,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod hover-nav-control-method-11 ((this hover-nav-control) (arg0 vector)) - (local-vars (sv-288 vector) (sv-304 vector) (sv-320 vector) (sv-336 vector) (sv-352 int)) (with-pp (when *debug-hover* (if arg0 @@ -1462,33 +1455,32 @@ (the-as vector (+ (the-as uint s1-2) 16)) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) ) - (let ((s0-0 (matrix*! (new 'stack-no-clear 'matrix) *hermite-matrix* (the-as matrix (+ (the-as uint s1-2) 16))))) - (set! sv-288 (new 'stack-no-clear 'vector)) - (set! sv-304 (new 'stack-no-clear 'vector)) - (set! sv-320 (new 'stack-no-clear 'vector)) - (set! sv-336 (new 'stack-no-clear 'vector)) - (let ((f30-0 0.0) - (f28-0 0.1) - ) - (set! sv-352 0) - (while (< sv-352 10) - (set-vector! sv-288 (* f30-0 f30-0 f30-0) (* f30-0 f30-0) f30-0 1.0) - (set-vector! sv-304 (* f28-0 f28-0 f28-0) (* f28-0 f28-0) f28-0 1.0) - (vector-matrix*! sv-320 sv-288 s0-0) - (vector-matrix*! sv-336 sv-304 s0-0) - (add-debug-line - #t - (bucket-id debug-no-zbuf1) - sv-320 - sv-336 - (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) - #f - (the-as rgba -1) - ) - (set! f30-0 (+ 0.1 f30-0)) - (set! f28-0 (+ 0.1 f28-0)) - (set! sv-352 (+ sv-352 1)) + (let ((s0-0 (matrix*! (new 'stack-no-clear 'matrix) *hermite-matrix* (the-as matrix (+ (the-as uint s1-2) 16)))) + (sv-288 (new 'stack-no-clear 'vector)) + (sv-304 (new 'stack-no-clear 'vector)) + (sv-320 (new 'stack-no-clear 'vector)) + (sv-336 (new 'stack-no-clear 'vector)) + (f30-0 0.0) + (f28-0 0.1) + (sv-352 0) ) + (while (< sv-352 10) + (set-vector! sv-288 (* (square f30-0) f30-0) (square f30-0) f30-0 1.0) + (set-vector! sv-304 (* (square f28-0) f28-0) (square f28-0) f28-0 1.0) + (vector-matrix*! sv-320 sv-288 s0-0) + (vector-matrix*! sv-336 sv-304 s0-0) + (add-debug-line + #t + (bucket-id debug-no-zbuf1) + sv-320 + sv-336 + (new 'static 'rgba :r #xff :g #xff :b #xff :a #x40) + #f + (the-as rgba -1) + ) + (set! f30-0 (+ 0.1 f30-0)) + (set! f28-0 (+ 0.1 f28-0)) + (+! sv-352 1) ) ) (set! s1-2 (-> s1-2 next)) @@ -1502,7 +1494,7 @@ (a2-11 (matrix*! (new 'stack-no-clear 'matrix) *hermite-matrix* (-> s2-1 curve-matrix))) (a1-12 (new 'stack-no-clear 'vector)) ) - (set-vector! a1-12 (* f30-1 f30-1 f30-1) (* f30-1 f30-1) f30-1 1.0) + (set-vector! a1-12 (* (square f30-1) f30-1) (square f30-1) f30-1 1.0) (vector-matrix*! s4-1 a1-12 a2-11) ) (if *debug-hover* @@ -1681,7 +1673,6 @@ ;; ERROR: Stack slot load at 160 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod hover-nav-control-method-13 ((this hover-nav-control)) - (local-vars (sv-112 float) (sv-128 float) (sv-144 float) (sv-160 float)) (let* ((s5-0 (-> this root)) (s3-0 (hover-nav-control-method-17 this)) (v1-2 (vector-! (new 'stack-no-clear 'vector) (-> s3-0 world-sphere) (-> s5-0 trans))) @@ -1690,36 +1681,29 @@ (when (not (logtest? (-> this flags) (hover-nav-flags honflags-0))) (let* ((s2-0 (-> this root transv)) (f30-0 (vector-length s2-0)) - (s1-0 lerp-scale) - (s0-0 0.0) - ) - (set! sv-112 (hover-nav-control-method-30 this)) - (set! sv-128 (* 2.0 f30-0)) - (set! sv-144 (the-as float 0.0)) - (let* ((t0-0 (hover-nav-control-method-30 this)) - (f0-4 (s1-0 s0-0 sv-112 sv-128 sv-144 t0-0)) - (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (-> s3-0 world-sphere) s2-0 (/ f0-4 f30-0))) - (s2-1 (nav-network-method-26 - (-> this nav) - (new 'stack-no-clear 'vector) - (-> this root process) - (-> s3-0 world-sphere) - t0-2 - (-> s3-0 world-sphere w) - ) + (f0-4 (lerp-scale + 0.0 + (hover-nav-control-method-30 this) + (* 2.0 f30-0) + (the-as float 0.0) + (hover-nav-control-method-30 this) ) - ) - (let ((f0-7 (vector-length s2-1)) - (s1-1 seek) - (s0-1 (-> this nav-collide-impulse-len)) - ) - (set! sv-160 f0-7) - (let ((a2-2 (* (hover-nav-control-method-31 this) (seconds-per-frame)))) - (set! (-> this nav-collide-impulse-len) (s1-1 s0-1 sv-160 a2-2)) - ) - ) - (vector-normalize-copy! (-> this nav-collide-impulse) s2-1 (- (-> this nav-collide-impulse-len))) + ) + (t0-2 (vector+float*! (new 'stack-no-clear 'vector) (-> s3-0 world-sphere) s2-0 (/ f0-4 f30-0))) + (s2-1 (nav-network-method-26 + (-> this nav) + (new 'stack-no-clear 'vector) + (-> this root process) + (-> s3-0 world-sphere) + t0-2 + (-> s3-0 world-sphere w) + ) + ) + ) + (let ((f0-7 (vector-length s2-1))) + (seek! (-> this nav-collide-impulse-len) f0-7 (* (hover-nav-control-method-31 this) (seconds-per-frame))) ) + (vector-normalize-copy! (-> this nav-collide-impulse) s2-1 (- (-> this nav-collide-impulse-len))) ) (if *debug-hover* (add-debug-vector diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-edit_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-edit_REF.gc index a70d9d971b..62f0b58b18 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-edit_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/hover-nav-edit_REF.gc @@ -120,16 +120,6 @@ ;; definition for function hover-nav-graph-output ;; INFO: Used lq/sq (defun hover-nav-graph-output () - (local-vars - (sv-16 int) - (sv-32 (function _varargs_ object)) - (sv-48 symbol) - (sv-64 string) - (sv-80 int) - (sv-96 (function _varargs_ object)) - (sv-112 symbol) - (sv-128 string) - ) (let ((v1-0 (get-nav-graph-editor))) (when v1-0 (let* ((gp-0 (-> v1-0 nav-graph)) @@ -150,27 +140,16 @@ (dotimes (s1-0 (-> gp-0 edge-array length)) (let* ((v1-11 (-> gp-0 edge-array data s1-0)) (s0-0 (-> v1-11 runtime-node-id-1)) + (sv-16 (-> v1-11 runtime-node-id-2)) ) - (set! sv-16 (-> v1-11 runtime-node-id-2)) (when (= s3-0 s0-0) (let ((a1-2 (+ (the-as uint (-> gp-0 node-array data 0 position)) (* 80 sv-16)))) - (set! sv-32 format) - (set! sv-48 #t) - (set! sv-64 "(~d ~m) ") - (set! sv-80 sv-16) - (let ((a3-1 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-2)))) - (sv-32 sv-48 sv-64 sv-80 a3-1) - ) + (format #t "(~d ~m) " sv-16 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-2))) ) ) (when (= s3-0 sv-16) (let ((a1-4 (+ (the-as uint (-> gp-0 node-array data 0 position)) (* 80 s0-0)))) - (set! sv-96 format) - (set! sv-112 #t) - (set! sv-128 "(~d ~m) ") - (let ((a3-2 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-4)))) - (sv-96 sv-112 sv-128 s0-0 a3-2) - ) + (format #t "(~d ~m) " s0-0 (vector-vector-distance (the-as vector s2-0) (the-as vector a1-4))) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc index c251f0f50e..17aa459fdb 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/hover/wasp_REF.gc @@ -1221,79 +1221,73 @@ (s4-0 (-> this main-joint-vel)) (gp-0 (lambda ((arg0 wasp) (arg1 cspace) (arg2 float) (arg3 float) (arg4 vector) (arg5 vector) (arg6 int)) - (local-vars (sv-192 float) (sv-208 quaternion) (sv-224 vector)) - (set! sv-192 arg2) - (let ((s0-0 arg3)) - (set! sv-224 arg4) - (let ((s1-0 arg5) - (s3-0 arg6) - (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) - (s5-0 (new 'stack-no-clear 'matrix)) - (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) - ) - (set! sv-208 (new 'stack-no-clear 'quaternion)) - (let ((s2-1 (new 'stack-no-clear 'vector))) - (-> arg0 scale) - (quaternion-rotate-local-z! sv-208 a1-3 sv-192) - (quaternion->matrix s5-0 sv-208) - (set! (-> s2-1 quad) (-> arg0 root scale quad)) - (scale-matrix! s5-0 s2-1 s5-0) - (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) - (t9-6 vector-inv-orient-by-quat!) - (a0-10 (new 'stack-no-clear 'vector)) - (a2-4 (-> arg0 root quat)) - (v0-6 (t9-6 a0-10 sv-224 a2-4)) - (f30-0 (* 2457600.0 (seconds-per-frame))) - (f28-0 - (seek - (-> arg0 thrust s3-0) - (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) - (fmax 0.0 (-> v0-6 y)) - (fabs (/ (-> v0-6 z) 5)) - (fmax 0.0 (-> s1-1 y)) - ) - (/ f30-0 5) - ) - ) + (let ((sv-192 arg2) + (s0-0 arg3) + (sv-224 arg4) + (s1-0 arg5) + (s3-0 arg6) + (s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) arg1)) + (s5-0 (new 'stack-no-clear 'matrix)) + (a1-3 (matrix-with-scale->quaternion (new 'stack-no-clear 'quaternion) (-> arg1 bone transform))) + (sv-208 (new 'stack-no-clear 'quaternion)) + (s2-1 (new 'stack-no-clear 'vector)) + ) + (-> arg0 scale) + (quaternion-rotate-local-z! sv-208 a1-3 sv-192) + (quaternion->matrix s5-0 sv-208) + (set! (-> s2-1 quad) (-> arg0 root scale quad)) + (scale-matrix! s5-0 s2-1 s5-0) + (let* ((s1-1 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) s1-0 (-> arg0 root quat))) + (v0-6 (vector-inv-orient-by-quat! (new 'stack-no-clear 'vector) sv-224 (-> arg0 root quat))) + (f30-0 (* 2457600.0 (seconds-per-frame))) + (f28-0 + (seek + (-> arg0 thrust s3-0) + (+ (* 0.4 (fmax 0.0 (* (-> v0-6 x) s0-0))) + (fmax 0.0 (-> v0-6 y)) + (fabs (/ (-> v0-6 z) 5)) + (fmax 0.0 (-> s1-1 y)) + ) + (/ f30-0 5) ) - (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) - (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) - ) - (lerp-scale 0.0 -4915.2 f28-0 1638.4 f30-0) - (let ((f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) - (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) - ) - (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) - (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) - (f2-6 (fmin 1.0 (-> s2-1 x))) - (f0-15 (fmin 1.0 (-> s2-1 y))) - ) - (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) - (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-15)) - (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) - (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-15)) - (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-15)) - (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-15)) - (set! (-> arg0 thrust s3-0) f28-0) - (let ((f0-16 (* f26-0 f0-15))) - (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-16 -2)) - ) + ) + ) + (let ((f20-0 (lerp-scale 819.2 4096.0 f28-0 1638.4 f30-0)) + (f26-0 (lerp-scale 4915.2 11468.8 f28-0 1638.4 f30-0)) + ) + (lerp-scale 0.0 -4915.2 f28-0 1638.4 f30-0) + (let ((f22-0 (lerp-scale 0.5 1.5 f28-0 1638.4 f30-0)) + (f24-0 (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0)) + ) + (lerp-scale 0.1 1.0 f28-0 1638.4 f30-0) + (let ((f1-10 (lerp-scale 0.02 0.6 f28-0 1638.4 f30-0)) + (f2-6 (fmin 1.0 (-> s2-1 x))) + (f0-15 (fmin 1.0 (-> s2-1 y))) ) + (set! (-> *part-id-table* 718 init-specs 4 initial-valuef) (* f20-0 f2-6)) + (set! (-> *part-id-table* 718 init-specs 5 initial-valuef) (* f26-0 f0-15)) + (set! (-> *part-id-table* 722 init-specs 3 initial-valuef) (* f22-0 f2-6)) + (set! (-> *part-id-table* 719 init-specs 1 initial-valuef) (* f24-0 f0-15)) + (set! (-> *part-id-table* 720 init-specs 1 initial-valuef) (* f1-10 f0-15)) + (set! (-> *part-id-table* 721 init-specs 0 initial-valuef) (* f24-0 f0-15)) + (set! (-> arg0 thrust s3-0) f28-0) + (let ((f0-16 (* f26-0 f0-15))) + (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-0 vector 1) (/ f0-16 -2)) ) ) - (set! (-> s5-0 trans quad) (-> s4-0 quad)) - (spawn-with-matrix (-> arg0 engine-part) s5-0) - (let ((f0-18 (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0))) - (sound-play-by-name - (static-sound-name "wasp-jets") - (-> arg0 sound-id) - (the int (* 1024.0 f0-18)) - 0 - 0 - (sound-group sfx) - (-> arg0 root trans) - ) - ) + ) + ) + (set! (-> s5-0 trans quad) (-> s4-0 quad)) + (spawn-with-matrix (-> arg0 engine-part) s5-0) + (let ((f0-18 (lerp-scale 0.75 1.0 f28-0 1638.4 f30-0))) + (sound-play-by-name + (static-sound-name "wasp-jets") + (-> arg0 sound-id) + (the int (* 1024.0 f0-18)) + 0 + 0 + (sound-group sfx) + (-> arg0 root trans) ) ) ) @@ -1511,7 +1505,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this wasp)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag) (sv-64 res-tag)) (hover-enemy-method-149 this) (init-enemy-behaviour-and-stats! this (hover-enemy-method-150 this)) (hover-enemy-method-155 this) @@ -1530,15 +1523,17 @@ (set! (-> this gun-x-angle-final) 0.0) (logclear! (-> this mask) (process-mask actor-pause)) (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (if (and v1-28 (= (-> sv-16 elt-count) 1)) (set! (-> this entity-group) (-> v1-28 0)) (set! (-> this entity-group) #f) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-32 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-32 (res-lump-data (-> this entity) 'timeout (pointer float) :tag-ptr (& sv-32))) + ) (cond ((and v1-32 (= (-> sv-32 elt-count) 2)) (set! (-> this attack-wait-min) (-> v1-32 0)) @@ -1550,27 +1545,27 @@ ) ) ) - (let ((f30-0 4096.0)) - (set! sv-48 (new 'static 'res-tag)) - (let ((v1-39 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48)))) - (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-39 (> (the-as int (-> sv-48 elt-count)) 0)) - (-> v1-39 0) - -1.0 - ) - ) - ) - ) + (let* ((f30-0 4096.0) + (sv-48 (new 'static 'res-tag)) + (v1-39 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-48))) + ) + (set! (-> this attack-miss-dist-min) (* f30-0 (if (and v1-39 (> (the-as int (-> sv-48 elt-count)) 0)) + (-> v1-39 0) + -1.0 + ) + ) + ) ) - (let ((f30-1 4096.0)) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64)))) - (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-43 (< 1 (the-as int (-> sv-64 elt-count)))) - (-> v1-43 1) - 1.0 - ) - ) - ) - ) + (let* ((f30-1 4096.0) + (sv-64 (new 'static 'res-tag)) + (v1-43 (res-lump-data (-> this entity) 'min-max (pointer float) :tag-ptr (& sv-64))) + ) + (set! (-> this attack-miss-dist-max) (* f30-1 (if (and v1-43 (< 1 (the-as int (-> sv-64 elt-count)))) + (-> v1-43 1) + 1.0 + ) + ) + ) ) (set! (-> this path) (new 'process 'path-control this 'intro 0.0 (-> this entity) #f)) (set! (-> this path-u) 0.0) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc index 915811702e..6450aae3e5 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/metalmonk_REF.gc @@ -463,11 +463,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) @@ -852,11 +848,9 @@ (let ((a0-1 (handle->process (-> self focus handle)))) (if (and a0-1 (and (time-elapsed? (-> self state-time) (seconds 0.05)) - (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans))) - (f1-0 14336.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans)) + (square 14336.0) + ) ) ) (react-to-focus self) diff --git a/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc index b35381526e..74011053c9 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/fort-floor-spike_REF.gc @@ -303,7 +303,6 @@ ;; INFO: Used lq/sq (defmethod init-spike-collision! ((this fort-floor-spike-a)) "Initializes the collision for the particular spike" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape-moving)) (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -321,24 +320,18 @@ (s2-0 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) - ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 s5-0) - (let ((a3-2 (command-get-int (car s2-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint (command-get-int (car s2-0) 0)) (the-as uint 0)) ) - (set! sv-16 (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s1-1 sv-16)) + (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) ) - (let ((s1-1 sv-16)) - (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) (set! s3-0 (cdr s3-0)) (set! s2-0 (car s3-0)) ) @@ -359,7 +352,6 @@ ;; INFO: Used lq/sq (defmethod init-periodic-animation! ((this fort-floor-spike-a)) "Initialzes the periodic animation of the spikes (exit and re-entry)" - (local-vars (sv-64 cspace)) (let ((s5-0 2) (s4-0 4) ) @@ -382,12 +374,13 @@ (s1-0 11) ) (dotimes (s0-0 (+ (- 1 s2-0) s1-0)) - (set! sv-64 (-> this node-list data (+ s2-0 s0-0))) - (vector<-cspace! (-> s3-0 s0-0) sv-64) - (set! (-> s3-0 s0-0 y) 0.0) - (set! (-> sv-64 param0) joint-mod-set-y-callback) - (set! (-> sv-64 param1) (the-as basic s3-0)) - (set! (-> sv-64 param2) (the-as basic s0-0)) + (let ((sv-64 (-> this node-list data (+ s2-0 s0-0)))) + (vector<-cspace! (-> s3-0 s0-0) sv-64) + (set! (-> s3-0 s0-0 y) 0.0) + (set! (-> sv-64 param0) joint-mod-set-y-callback) + (set! (-> sv-64 param1) (the-as basic s3-0)) + (set! (-> sv-64 param2) (the-as basic s0-0)) + ) ) ) (dotimes (s3-1 s5-0) @@ -460,7 +453,6 @@ ;; INFO: Used lq/sq (defmethod init-spike-collision! ((this fort-floor-spike-b)) "Initializes the collision for the particular spike" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape-moving)) (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s5-0 reaction) cshape-reaction-default) @@ -489,24 +481,18 @@ (s2-0 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) - ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 s5-0) - (let ((a3-2 (command-get-int (car s2-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint (command-get-int (car s2-0) 0)) (the-as uint 0)) ) - (set! sv-16 (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s1-1 sv-16)) + (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) ) - (let ((s1-1 sv-16)) - (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) (set! s3-0 (cdr s3-0)) (set! s2-0 (car s3-0)) ) @@ -527,7 +513,6 @@ ;; INFO: Used lq/sq (defmethod init-periodic-animation! ((this fort-floor-spike-b)) "Initialzes the periodic animation of the spikes (exit and re-entry)" - (local-vars (sv-64 cspace)) (let ((s5-0 2) (s4-0 5) ) @@ -552,12 +537,13 @@ (s1-0 13) ) (dotimes (s0-0 (+ (- 1 s2-0) s1-0)) - (set! sv-64 (-> this node-list data (+ s2-0 s0-0))) - (vector<-cspace! (-> s3-0 s0-0) sv-64) - (set! (-> s3-0 s0-0 y) 0.0) - (set! (-> sv-64 param0) joint-mod-set-y-callback) - (set! (-> sv-64 param1) (the-as basic s3-0)) - (set! (-> sv-64 param2) (the-as basic s0-0)) + (let ((sv-64 (-> this node-list data (+ s2-0 s0-0)))) + (vector<-cspace! (-> s3-0 s0-0) sv-64) + (set! (-> s3-0 s0-0 y) 0.0) + (set! (-> sv-64 param0) joint-mod-set-y-callback) + (set! (-> sv-64 param1) (the-as basic s3-0)) + (set! (-> sv-64 param2) (the-as basic s0-0)) + ) ) ) (dotimes (s3-1 s5-0) @@ -630,7 +616,6 @@ ;; INFO: Used lq/sq (defmethod init-spike-collision! ((this fort-floor-spike-c)) "Initializes the collision for the particular spike" - (local-vars (prim-mesh collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape-moving)) (let ((cshape-moving (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape-moving dynam) (copy *standard-dynamics* 'process)) (set! (-> cshape-moving reaction) cshape-reaction-default) @@ -664,24 +649,23 @@ (s2-0 (car s3-0)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) + (let ((prim-mesh (new + 'process + 'collide-shape-prim-mesh + cshape-moving + (the-as uint (command-get-int (car s2-0) 0)) + (the-as uint 0) + ) + ) ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 cshape-moving) - (let ((a3-2 (command-get-int (car s2-0) 0)) - (t0-1 0) - ) - (set! prim-mesh (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + (let ((s1-1 prim-mesh)) + (set! (-> s1-1 prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> prim-group prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) ) + (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) ) - (let ((s1-1 prim-mesh)) - (set! (-> s1-1 prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> prim-group prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (car (cdr s2-0)) 0)) - ) - (set-vector! (-> prim-mesh local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s2-0))) 0.0)) (set! s3-0 (cdr s3-0)) (set! s2-0 (car s3-0)) ) @@ -702,7 +686,6 @@ ;; INFO: Used lq/sq (defmethod init-periodic-animation! ((this fort-floor-spike-c)) "Initialzes the periodic animation of the spikes (exit and re-entry)" - (local-vars (sv-64 cspace)) (let ((s5-0 3) (s4-0 5) ) @@ -732,12 +715,13 @@ (s1-0 18) ) (dotimes (s0-0 (+ (- 1 s2-0) s1-0)) - (set! sv-64 (-> this node-list data (+ s2-0 s0-0))) - (vector<-cspace! (-> s3-0 s0-0) sv-64) - (set! (-> s3-0 s0-0 y) 0.0) - (set! (-> sv-64 param0) joint-mod-set-y-callback) - (set! (-> sv-64 param1) (the-as basic s3-0)) - (set! (-> sv-64 param2) (the-as basic s0-0)) + (let ((sv-64 (-> this node-list data (+ s2-0 s0-0)))) + (vector<-cspace! (-> s3-0 s0-0) sv-64) + (set! (-> s3-0 s0-0 y) 0.0) + (set! (-> sv-64 param0) joint-mod-set-y-callback) + (set! (-> sv-64 param1) (the-as basic s3-0)) + (set! (-> sv-64 param2) (the-as basic s0-0)) + ) ) ) (dotimes (s3-1 s5-0) diff --git a/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc index 464f9dfdc8..4fc0d3379b 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/gun-buoy_REF.gc @@ -467,7 +467,6 @@ (defstate ambush (gun-buoy) :virtual #t :enter (behavior () - (local-vars (sv-80 vector)) (let ((v1-0 self)) (set! (-> v1-0 enemy-flags) (the-as enemy-flag (logior (enemy-flag enemy-flag37) (-> v1-0 enemy-flags)))) ) @@ -492,14 +491,10 @@ (s5-0 (-> self offset-from-player)) ) (set! (-> s4-0 y) (fmax (-> s4-0 y) (-> s3-0 water height))) - (let ((s2-0 vector-xz-normalize-copy!) - (s1-0 s5-0) - (s0-0 vector-z-quaternion!) - ) - (set! sv-80 (new 'stack-no-clear 'vector)) - (let ((a1-7 (get-quat s3-0 2))) - (s2-0 s1-0 (s0-0 sv-80 a1-7) 81920.0) - ) + (vector-xz-normalize-copy! + s5-0 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (get-quat s3-0 2)) + 81920.0 ) (set! (-> s5-0 y) -819.2) (let ((s3-2 (vector+! (new 'stack-no-clear 'vector) s4-0 s5-0))) @@ -556,7 +551,7 @@ ) ) (let ((f30-0 (- 1.0 (fabs (/ (-> self y-offset) (meters 20)))))) - (let ((f0-7 (* f30-0 f30-0))) + (let ((f0-7 (square f30-0))) (set-vector! (-> self root scale) f30-0 f30-0 f30-0 1.0) (let ((t9-1 vector-lerp!) (a0-2 (-> self draw color-mult)) @@ -593,7 +588,7 @@ :post (behavior () (seek! (-> self y-offset) -81920.0 (* 49152.0 (seconds-per-frame))) (let ((f30-0 (- 1.0 (fabs (/ (-> self y-offset) (meters 20)))))) - (let ((f0-5 (* f30-0 f30-0))) + (let ((f0-5 (square f30-0))) (set-vector! (-> self root scale) f30-0 f30-0 f30-0 1.0) (let ((t9-1 vector-lerp!) (a0-2 (-> self draw color-mult)) @@ -1038,11 +1033,9 @@ (= (-> (the-as collide-shape-moving (-> v1-19 root)) ground-pat material) (pat-material waterbottom)) ) ) - (let ((f0-2 f30-1)) - (or (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> s4-0 trans) arg1)) - (is-in-mesh? (-> this nav) arg1 f30-1) - ) - ) + (or (>= (square f30-1) (vector-vector-xz-distance-squared (-> s4-0 trans) arg1)) + (is-in-mesh? (-> this nav) arg1 f30-1) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc b/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc index af4067ec0b..62c8421288 100644 --- a/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/entities/spydroid_REF.gc @@ -772,86 +772,94 @@ (defmethod general-event-handler ((this spydroid) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy @TODO - unsure if there is a pattern for the events and this should have a more specific name" - (local-vars (v1-6 vector) (sv-144 vector)) - (rlet ((vf0 :class vf) - (vf4 :class vf) - (vf5 :class vf) - (vf6 :class vf) - ) - (init-vf0-vector) - (case arg2 - (('touch 'bonk 'attack) - (set! sv-144 (the-as vector (send-event (ppointer->process (-> this parent)) 'widow-get-center))) - (let ((s0-0 (the-as process (as-type arg0 process-drawable)))) - (let ((v1-5 sv-144)) - (b! (not v1-5) cfg-15 :likely-delay (set! v1-6 sv-144)) + (local-vars (v1-6 vector)) + (with-pp + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) ) - (set! v1-6 (the-as vector s0-0)) - (label cfg-15) - (cond - (v1-6 - (let ((v1-9 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (set! (-> s1-1 x) (- (-> v1-9 z))) - (set! (-> s1-1 y) 0.0) - (set! (-> s1-1 z) (-> v1-9 x)) - (set! (-> s1-1 w) 1.0) - (let ((v1-12 - (vector-! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s0-0) root trans) (-> this root trans)) + (init-vf0-vector) + (case arg2 + (('touch 'bonk 'attack) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer pp)) + (set! (-> a1-3 num-params) 0) + (set! (-> a1-3 message) 'widow-get-center) + (let ((sv-144 (the-as vector (send-event-function (ppointer->process (-> this parent)) a1-3))) + (s0-0 (the-as process (as-type arg0 process-drawable))) + ) + (let ((v1-5 sv-144)) + (b! (not v1-5) cfg-15 :likely-delay (set! v1-6 sv-144)) + ) + (set! v1-6 (the-as vector s0-0)) + (label cfg-15) + (cond + (v1-6 + (let ((v1-9 (vector-! (new 'stack-no-clear 'vector) (-> this root trans) sv-144)) + (s1-1 (new 'stack-no-clear 'vector)) ) + (set! (-> s1-1 x) (- (-> v1-9 z))) + (set! (-> s1-1 y) 0.0) + (set! (-> s1-1 z) (-> v1-9 x)) + (set! (-> s1-1 w) 1.0) + (let ((v1-12 + (vector-! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s0-0) root trans) (-> this root trans)) + ) + ) + (set! (-> s1-1 y) 0.0) + (set! (-> v1-12 y) 0.0) + (if (< (vector-dot v1-12 s1-1) 0.0) + (vector-negate! s1-1 s1-1) + ) ) - (set! (-> s1-1 y) 0.0) - (set! (-> v1-12 y) 0.0) - (if (< (vector-dot v1-12 s1-1) 0.0) - (vector-negate! s1-1 s1-1) + (vector-normalize! s1-1 16384.0) + (vector+! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) + (vector-! s1-1 s1-1 sv-144) + (set! (-> s1-1 y) 0.0) + (vector-normalize! s1-1 204800.0) + (let ((v1-17 s1-1)) + (let ((a0-19 s1-1)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-19 quad)) + ) + (.lvf vf5 (&-> (the-as vector sv-144) quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-17 quad) vf6) ) - ) - (vector-normalize! s1-1 16384.0) - (vector+! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) - (vector-! s1-1 s1-1 sv-144) - (set! (-> s1-1 y) 0.0) - (vector-normalize! s1-1 204800.0) - (let ((v1-17 s1-1)) - (let ((a0-19 s1-1)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-19 quad)) + (vector-! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) + (set! (-> s1-1 y) 8192.0) + (send-event arg0 'attack #f (static-attack-info ((id (new-attack-id)) (mode 'shock) (vector s1-1)))) + ) + ) + (else + (send-event + arg0 + 'attack + #f + (static-attack-info ((id (new-attack-id)) (mode 'shock) (shove-up (meters 2)) (shove-back (meters 4)))) ) - (.lvf vf5 (&-> (the-as vector sv-144) quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-17 quad) vf6) ) - (vector-! s1-1 s1-1 (-> (the-as process-drawable s0-0) root trans)) - (set! (-> s1-1 y) 8192.0) - (send-event arg0 'attack #f (static-attack-info ((id (new-attack-id)) (mode 'shock) (vector s1-1)))) - ) - ) - (else - (send-event - arg0 - 'attack - #f - (static-attack-info ((id (new-attack-id)) (mode 'shock) (shove-up (meters 2)) (shove-back (meters 4)))) ) ) ) + (let ((v1-30 (the-as object (-> arg3 param 1)))) + (if (or (!= arg0 *target*) (and (= arg2 'attack) + (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-30) mask)) + (logtest? (penetrate dark-bomb) (-> (the-as attack-info v1-30) penetrate-using)) + ) + ) + ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) + ) + ) ) - (let ((v1-30 (the-as object (-> arg3 param 1)))) - (if (or (!= arg0 *target*) (and (= arg2 'attack) - (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-30) mask)) - (logtest? (penetrate dark-bomb) (-> (the-as attack-info v1-30) penetrate-using)) - ) - ) - ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) - ) + (('jump) + (set! (-> this floor) (-> (the-as vector (-> arg3 param 1)) y)) + ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) ) - ) - (('jump) - (set! (-> this floor) (-> (the-as vector (-> arg3 param 1)) y)) - ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) - ) - (else - ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) + (else + ((method-of-type nav-enemy general-event-handler) this arg0 arg1 arg2 arg3) + ) ) ) ) @@ -1069,11 +1077,9 @@ (let ((a0-1 (handle->process (-> self focus handle)))) (if (and (time-elapsed? (-> self state-time) (-> self reaction-time)) (and a0-1 - (let ((f0-0 (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans))) - (f1-0 16384.0) - ) - (< f0-0 (* f1-0 f1-0)) - ) + (< (vector-vector-xz-distance-squared (get-trans (the-as process-focusable a0-1) 0) (-> self root trans)) + (square 16384.0) + ) ) ) (go-virtual attack) diff --git a/test/decompiler/reference/jak2/levels/common/race/race-hud_REF.gc b/test/decompiler/reference/jak2/levels/common/race/race-hud_REF.gc index 58a8a3d1e0..b83f6083fe 100644 --- a/test/decompiler/reference/jak2/levels/common/race/race-hud_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/race/race-hud_REF.gc @@ -291,13 +291,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod draw ((this hud-race-final-stats)) - (local-vars - (s0-0 int) - (sv-112 (function string font-context symbol int bucket-id float)) - (sv-128 (function string font-context symbol int bucket-id float)) - (sv-144 string) - (sv-160 string) - ) + (local-vars (s0-0 int)) (let* ((v1-0 *race-state*) (s5-0 (-> v1-0 racer-array (-> v1-0 i-player))) ) @@ -333,14 +327,7 @@ (if (= (-> *setting-control* user-default language) (language-enum german)) (set-scale! s1-0 1.0) ) - (set! sv-112 print-game-text) - (let ((a0-20 (lookup-text! *common-text* (text-id race-you-win) #f)) - (a2-2 #f) - (a3-1 44) - (t0-1 320) - ) - (sv-112 a0-20 s1-0 a2-2 a3-1 (the-as bucket-id t0-1)) - ) + (print-game-text (lookup-text! *common-text* (text-id race-you-win) #f) s1-0 #f 44 (bucket-id progress)) ) (else (set! s0-0 80) @@ -348,15 +335,7 @@ (if (= (-> *setting-control* user-default language) (language-enum german)) (set-scale! s1-0 1.0) ) - (set! sv-128 print-game-text) - (let ((a0-26 (lookup-text! *common-text* (text-id race-you-lose) #f)) - (a1-5 s1-0) - (a2-4 #f) - (a3-2 44) - (t0-2 320) - ) - (sv-128 a0-26 a1-5 a2-4 a3-2 (the-as bucket-id t0-2)) - ) + (print-game-text (lookup-text! *common-text* (text-id race-you-lose) #f) s1-0 #f 44 (bucket-id progress)) ) ) ) @@ -366,16 +345,14 @@ 128 (the int (+ (- 188.0 (the float s0-0)) (* -100.0 (-> this offset)))) ) - (let ((s1-1 format)) - (set! sv-144 (clear (-> this strings 1 text))) - (let* ((a0-29 *common-text*) - (t9-7 (method-of-object a0-29 lookup-text!)) - (a1-7 375) - (a2-6 #f) - (a1-8 (t9-7 a0-29 (the-as text-id a1-7) a2-6)) - ) - (s1-1 sv-144 a1-8 (the-as none a2-6)) - ) + (let* ((s1-1 format) + (sv-144 (clear (-> this strings 1 text))) + (a0-29 *common-text*) + (t9-7 (method-of-object a0-29 lookup-text!)) + (a1-7 375) + (a2-6 #f) + ) + (s1-1 sv-144 (t9-7 a0-29 (the-as text-id a1-7) a2-6) (the-as none a2-6)) ) (set-hud-piece-position! (the-as hud-sprite (-> this strings 2 pos)) @@ -396,15 +373,11 @@ 5 (+ (* 28 s4-0) 40) ) - (let ((s1-3 format) - (s0-1 (clear (-> this strings s3-0 text))) - ) - (set! sv-160 "~S~D") - (let ((a2-10 (lookup-text! *common-text* (text-id race-lap) #f)) - (a3-4 (+ s4-0 1)) - ) - (s1-3 s0-1 sv-160 a2-10 a3-4) - ) + (format + (clear (-> this strings s3-0 text)) + "~S~D" + (lookup-text! *common-text* (text-id race-lap) #f) + (+ s4-0 1) ) (let ((s3-1 (+ s3-0 1))) (set! (-> this strings s3-1 scale) 0.5) diff --git a/test/decompiler/reference/jak2/levels/common/race/race-manager_REF.gc b/test/decompiler/reference/jak2/levels/common/race/race-manager_REF.gc index 61033e46b4..d81f09be56 100644 --- a/test/decompiler/reference/jak2/levels/common/race/race-manager_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/race/race-manager_REF.gc @@ -78,13 +78,9 @@ ) ) (vector-normalize! (-> this finish-dir) 1.0) - (let ((f0-18 (vector-vector-distance-squared (-> this start-sphere) (-> this finish-sphere))) - (f1-2 163840.0) - ) - (if (< f0-18 (* f1-2 f1-2)) - (logior! (-> gp-0 flags) (race-mesh-flags racemeshflag-0)) - ) - ) + (if (< (vector-vector-distance-squared (-> this start-sphere) (-> this finish-sphere)) (square 163840.0)) + (logior! (-> gp-0 flags) (race-mesh-flags racemeshflag-0)) + ) ) ) ) @@ -251,13 +247,11 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov a0-29 vf1) - (let ((f0-7 a0-29) - (f1-1 (-> arg0 info finish-sphere r)) - ) - (if (and (< f0-7 (* f1-1 f1-1)) (< 0.0 (vector-dot (the-as vector (&-> v1-39 x)) (-> arg0 info finish-dir)))) - (end-lap this arg0) - ) - ) + (if (and (< a0-29 (square (-> arg0 info finish-sphere r))) + (< 0.0 (vector-dot (the-as vector (&-> v1-39 x)) (-> arg0 info finish-dir))) + ) + (end-lap this arg0) + ) ) ) (else @@ -980,14 +974,7 @@ ;; WARN: Return type mismatch int vs none. ;; ERROR: Unsupported inline assembly instruction kind - [mfc0 v1, Count] (defmethod initialize-state ((this race-manager)) - (local-vars - (v1-0 int) - (sv-352 task-arrow-params) - (sv-368 (function process type traffic-object-spawn-params process-drawable)) - (sv-384 race-manager) - (sv-400 process-drawable) - (sv-416 int) - ) + (local-vars (v1-0 int) (sv-416 int)) (.mfc0 v1-0 Count) (rigid-body-queue-manager-spawn *race-rigid-body-queue* this) (let* ((gp-0 (-> this race-state)) @@ -1075,15 +1062,12 @@ (logtest? (-> s3-0 flags) (race-info-flags city-race)) ) ) - (set! sv-352 (new 'stack-no-clear 'task-arrow-params)) - (set! (-> sv-352 pos quad) (-> gp-0 info player-intro-pos quad)) - (quaternion-identity! (-> sv-352 quat)) - (set! (-> sv-352 flags) (task-arrow-flags)) - (set! (-> sv-352 map-icon) (the-as uint 15)) - (let ((t9-11 task-arrow-spawn) - (a1-17 this) - ) - (set! (-> gp-0 arrow) (process->handle (t9-11 sv-352 a1-17))) + (let ((sv-352 (new 'stack-no-clear 'task-arrow-params))) + (set! (-> sv-352 pos quad) (-> gp-0 info player-intro-pos quad)) + (quaternion-identity! (-> sv-352 quat)) + (set! (-> sv-352 flags) (task-arrow-flags)) + (set! (-> sv-352 map-icon) (the-as uint 15)) + (set! (-> gp-0 arrow) (process->handle (task-arrow-spawn sv-352 this))) ) (set! (-> s4-0 params position quad) (-> gp-0 info player-intro-pos quad)) (+! (-> s4-0 params position y) 12288.0) @@ -1106,40 +1090,27 @@ (logtest? (-> s1-0 flags) (racer-info-flags hide-in-scene)) ) ) - (set! sv-368 vehicle-spawn) - (set! sv-384 this) - (let ((a1-18 (type-from-race-vehicle-type (-> s1-0 vehicle))) - (a2-3 (-> s4-0 params)) - ) - (set! sv-400 (sv-368 sv-384 a1-18 a2-3)) - ) - (when sv-400 - (let ((a0-52 *minimap*) - (t9-14 (method-of-type minimap add-icon!)) - (a1-19 sv-400) - (a3-0 #f) - (t0-0 #t) - (t1-0 0) - ) - (t9-14 a0-52 a1-19 (the-as uint sv-416) (the-as int a3-0) (the-as vector t0-0) t1-0) - ) - (init-racer! s0-0 sv-400) - (set! (-> s0-0 rider) (-> s1-0 rider)) - (set! (-> s0-0 target-pos-offset) - (* (-> s3-0 ai-spread-factor) (+ (the float (-> s1-0 seek-offset)) (* -3.33 (-> gp-0 suck-factor)))) - ) - (when (and (= s2-1 (-> gp-0 i-player)) (logtest? (-> gp-0 flags) (race-flags pidax))) - (let ((v1-91 'pilot)) - (if (= (-> s1-0 rider) 1) - (set! v1-91 'pilot-daxter) + (let ((sv-400 (vehicle-spawn this (type-from-race-vehicle-type (-> s1-0 vehicle)) (-> s4-0 params)))) + (when sv-400 + (add-icon! *minimap* sv-400 (the-as uint sv-416) (the-as int #f) (the-as vector #t) 0) + (init-racer! s0-0 sv-400) + (set! (-> s0-0 rider) (-> s1-0 rider)) + (set! (-> s0-0 target-pos-offset) + (* (-> s3-0 ai-spread-factor) (+ (the float (-> s1-0 seek-offset)) (* -3.33 (-> gp-0 suck-factor)))) ) - (send-event *target* 'change-mode v1-91 sv-400 0 #t) + (when (and (= s2-1 (-> gp-0 i-player)) (logtest? (-> gp-0 flags) (race-flags pidax))) + (let ((v1-91 'pilot)) + (if (= (-> s1-0 rider) 1) + (set! v1-91 'pilot-daxter) + ) + (send-event *target* 'change-mode v1-91 sv-400 0 #t) + ) ) ) + (if (not sv-400) + (format 0 "failed to spawn racebike~%") + ) ) - (if (not sv-400) - (format 0 "failed to spawn racebike~%") - ) ) ) ) @@ -1156,7 +1127,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod save-score ((this race-manager) (arg0 float)) - (local-vars (sv-32 int)) (let* ((s5-0 (-> this race-state info score)) (s3-0 0) (s2-0 (-> *highscore-info-array* s5-0)) @@ -1167,12 +1137,13 @@ (dotimes (v1-5 4) (set! (-> s1-0 v1-5) 0) ) - (set! sv-32 0) - (while (< sv-32 8) - (let ((v1-13 (get-rank s2-0 (-> s0-0 sv-32)))) - (+! (-> s1-0 v1-13) 1) + (let ((sv-32 0)) + (while (< sv-32 8) + (let ((v1-13 (get-rank s2-0 (-> s0-0 sv-32)))) + (+! (-> s1-0 v1-13) 1) + ) + (+! sv-32 1) ) - (set! sv-32 (+ sv-32 1)) ) (dotimes (v1-20 4) (if (< 1 (-> s1-0 v1-20)) diff --git a/test/decompiler/reference/jak2/levels/common/race/vehicle-racer_REF.gc b/test/decompiler/reference/jak2/levels/common/race/vehicle-racer_REF.gc index 93efb2e735..f5baefa5c7 100644 --- a/test/decompiler/reference/jak2/levels/common/race/vehicle-racer_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/race/vehicle-racer_REF.gc @@ -243,12 +243,7 @@ ) (t9-2 a0-4 (the-as race-path-sample a1-11) a2-2 a3-1) (let* ((f1-0 (vector-vector-distance-squared (-> gp-0 steering-axis) (-> gp-0 mat trans))) - (f0-3 0.0) - (f2-0 32768.0) - (f1-1 (- (* f2-0 f2-0) f1-0)) - (f2-3 1.0) - (f3-0 32768.0) - (f26-2 (* f26-1 (fmax f0-3 (* f1-1 (/ f2-3 (* f3-0 f3-0)))))) + (f26-2 (* f26-1 (fmax 0.0 (* (- (square 32768.0) f1-0) (/ 1.0 (square 32768.0)))))) ) 0 (let* ((f0-5 (vector-vector-distance (-> gp-0 mat vector 2) (-> gp-0 velocity))) @@ -603,12 +598,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-18 vf1) - (let ((f0-6 v1-18) - (f1-5 1.0) - (f2-2 40960.0) - ) - (set! (-> this path-deviation) (* f0-6 (/ f1-5 (* f2-2 f2-2)))) - ) + (set! (-> this path-deviation) (* v1-18 (/ 1.0 (square 40960.0)))) (let ((a1-4 (-> s3-0 0 vector 2))) (let ((v1-22 (-> s3-0 0 vector 2))) (let ((a0-5 (-> s3-0 0 trans))) @@ -626,9 +616,7 @@ ) (vector-! (the-as vector (-> s3-0 0)) (-> s3-0 0 vector 2) (-> s4-0 state lin-velocity)) (vector-float*! (the-as vector (-> s3-0 0)) (the-as vector (-> s3-0 0)) 16.0) - (let* ((f0-10 (-> s3-0 1 vector 1 x)) - (f0-12 (* f0-10 f0-10)) - ) + (let ((f0-12 (square (-> s3-0 1 vector 1 x)))) (.lvf vf1 (&-> (-> s3-0 0) quad 0)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -770,11 +758,9 @@ (race-path-method-11 (-> s5-0 path) (the-as race-path-sample (-> s4-0 2 vector 1)) (-> s4-0 2 trans) f0-19) ) (vector-! (-> s4-0 0 trans) (-> s5-0 path-sample pos) (the-as vector (-> s4-0 0))) - (let* ((f0-20 (-> s4-0 3 vector 1 y)) - (f1-13 1.0) - (f2-4 40960.0) - (f1-14 (/ f1-13 (* f2-4 f2-4))) - ) + (let ((f0-20 (-> s4-0 3 vector 1 y)) + (f1-14 (/ 1.0 (square 40960.0))) + ) (.lvf vf1 (&-> (-> s4-0 0 trans) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -784,16 +770,9 @@ (.mov v1-35 vf1) (set! (-> s4-0 3 vector 1 y) (+ f0-20 (* f1-14 v1-35))) ) - (let ((f30-0 (-> s4-0 3 vector 1 y)) - (f0-22 1.0) - (f1-16 40960.0) - ) - (set! (-> s4-0 3 vector 1 y) - (+ f30-0 - (* (/ f0-22 (* f1-16 f1-16)) (vector-vector-distance-squared (-> s5-0 lin-velocity) (-> s4-0 0 vector 1))) - ) - ) - ) + (+! (-> s4-0 3 vector 1 y) + (* (/ 1.0 (square 40960.0)) (vector-vector-distance-squared (-> s5-0 lin-velocity) (-> s4-0 0 vector 1))) + ) (set! (-> this path-deviation) (-> s4-0 3 vector 1 y)) (let ((a1-6 (-> s4-0 0 vector 2))) (let ((v1-39 (-> s4-0 2 trans))) @@ -863,35 +842,24 @@ ((logtest? (-> this rbody state flags) (rigid-body-flag enable-physics)) (if (and (logtest? (-> this flags) (rigid-body-object-flag on-ground)) (not (logtest? (rigid-body-object-flag turbo-boost) (-> this flags))) - (let ((f0-0 368640.0)) - (or (< (* f0-0 f0-0) (-> this player-dist2)) - (let ((f0-3 102400.0)) - (and (< (* f0-3 f0-3) (-> this player-dist2)) - (not (logtest? (-> this draw status) (draw-control-status on-screen))) - ) - ) - ) - ) + (or (< (square 368640.0) (-> this player-dist2)) + (and (< (square 102400.0) (-> this player-dist2)) + (not (logtest? (-> this draw status) (draw-control-status on-screen))) + ) + ) ) (rigid-body-object-method-39 this) ) ) (else - (let ((f0-6 (-> this player-dist2)) - (f1-2 348160.0) - ) - (if (and (< f0-6 (* f1-2 f1-2)) (let ((f0-7 (-> this player-dist2)) - (f1-5 81920.0) - ) - (or (< f0-7 (* f1-5 f1-5)) - (logtest? (-> this draw status) (draw-control-status on-screen)) - (logtest? (rigid-body-object-flag turbo-boost) (-> this flags)) - ) - ) - ) - (rigid-body-object-method-38 this) - ) - ) + (if (and (< (-> this player-dist2) (square 348160.0)) + (or (< (-> this player-dist2) (square 81920.0)) + (logtest? (-> this draw status) (draw-control-status on-screen)) + (logtest? (rigid-body-object-flag turbo-boost) (-> this flags)) + ) + ) + (rigid-body-object-method-38 this) + ) ) ) 0 diff --git a/test/decompiler/reference/jak2/levels/consite/consite-scenes_REF.gc b/test/decompiler/reference/jak2/levels/consite/consite-scenes_REF.gc index b4721b56a2..db99694f38 100644 --- a/test/decompiler/reference/jak2/levels/consite/consite-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/consite/consite-scenes_REF.gc @@ -680,11 +680,6 @@ ;; WARN: Return type mismatch int vs none. (defun movie-consite-metalkor-shot-draw-impact ((arg0 scene-player) (arg1 vector) (arg2 vector)) "TODO - cutscenes/docs" - (local-vars - (sv-240 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-256 vector) - (sv-272 entity-actor) - ) (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg2 arg1) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -748,36 +743,18 @@ (matrix->quaternion gp-1 s2-0) ) (sound-play "nboss-shoot-hit") - (let* ((s1-2 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 (when s1-2 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s1-2) arg0 (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-1 s1-2) - ) - (set! sv-240 manipy-init) - (set! sv-256 s4-1) - (set! sv-272 (-> arg0 entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-1 - sv-240 - sv-256 - sv-272 - t0-2 - t1-2 - t2-2 - ) - ) - ) - (-> s1-2 ppointer) - ) - ) - ) + (let ((s2-2 (process-spawn + manipy + :init manipy-init + s4-1 + (-> arg0 entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to arg0 + ) + ) + ) (when s2-2 (send-event (ppointer->process s2-2) 'anim-mode 'play1) (send-event (ppointer->process s2-2) 'anim "idle") diff --git a/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc b/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc index 2d9a8a8f32..7b352610fb 100644 --- a/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/demo/demo-obs_REF.gc @@ -89,9 +89,9 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch time-frame vs none. (defun demo-plug-lightning ((arg0 process-drawable) (arg1 vector) (arg2 cspace)) - (local-vars (sv-32 cspace) (sv-48 int) (sv-64 symbol) (sv-80 int) (sv-96 vector)) - (set! sv-32 arg2) - (let ((s5-0 (get-process *default-dead-pool* lightning-tracker #x4000))) + (let ((sv-32 arg2) + (s5-0 (get-process *default-dead-pool* lightning-tracker #x4000)) + ) (when s5-0 (let ((t9-1 (method-of-type lightning-tracker activate))) (t9-1 @@ -105,11 +105,11 @@ (s2-0 s5-0) (s1-0 lightning-tracker-init) (s0-0 (-> *lightning-spec-id-table* 1)) + (sv-48 30) + (sv-64 (the-as symbol #f)) + (sv-80 (+ (-> sv-32 joint number) 1)) + (sv-96 (new 'stack-no-clear 'vector)) ) - (set! sv-48 30) - (set! sv-64 (the-as symbol #f)) - (set! sv-80 (+ (-> sv-32 joint number) 1)) - (set! sv-96 (new 'stack-no-clear 'vector)) (set! (-> sv-96 x) (+ (-> arg1 x) (rand-vu-float-range -4096.0 4096.0))) (set! (-> sv-96 y) (+ (-> arg1 y) (rand-vu-float-range -4096.0 4096.0))) (set! (-> sv-96 z) (+ (-> arg1 z) (rand-vu-float-range -4096.0 4096.0))) @@ -509,7 +509,6 @@ ;; WARN: Return type mismatch int vs object. ;; WARN: new jak 2 until loop case, check carefully (defbehavior demo-menu demo-control () - (local-vars (sv-112 font-context)) (sound-play "dmenu-hit") (let ((gp-1 (cond ((= *kernel-boot-message* 'demo-shared) @@ -548,20 +547,22 @@ (return (the-as object (-> self selected))) ) ) - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + ) ) - (set-width! sv-112 384) - (set-height! sv-112 50) - (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) - (set! (-> sv-112 scale) 0.7) - (dotimes (s5-4 (-> gp-1 length)) - (if (= (-> self selected) s5-4) - (set! (-> sv-112 color) (font-color progress-old-selected)) - (set! (-> sv-112 color) (font-color white)) - ) - (print-game-text (lookup-text! *common-text* (-> gp-1 s5-4) #f) sv-112 #f 44 (bucket-id progress)) - (+! (-> sv-112 origin y) 22.0) + (set-width! sv-112 384) + (set-height! sv-112 50) + (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) + (set! (-> sv-112 scale) 0.7) + (dotimes (s5-4 (-> gp-1 length)) + (if (= (-> self selected) s5-4) + (set! (-> sv-112 color) (font-color progress-old-selected)) + (set! (-> sv-112 color) (font-color white)) + ) + (print-game-text (lookup-text! *common-text* (-> gp-1 s5-4) #f) sv-112 #f 44 (bucket-id progress)) + (+! (-> sv-112 origin y) 22.0) + ) ) ) (suspend) diff --git a/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc index e4392393d0..e3e9720f18 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig-digger_REF.gc @@ -969,7 +969,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod dig-tether-method-24 ((this dig-tether)) - (local-vars (sv-144 dig-tether-chain) (sv-160 vector)) (update-with-delay! (-> this chain-offset-rand)) (update! (-> this chain-offset) (-> this chain-offset-rand value)) (let ((s5-0 (new 'stack-no-clear 'matrix)) @@ -992,55 +991,55 @@ (quaternion-copy! (-> this joint-one quat) (-> this root quat)) (set! (-> s3-0 quad) (-> s5-0 vector 1 quad)) (dotimes (s0-0 8) - (set! sv-144 (-> this chain-joints s0-0)) - (set! sv-160 (new 'stack-no-clear 'vector)) - (let ((v1-23 (-> sv-144 position quad))) - (set! (-> sv-160 quad) v1-23) - ) - (+! (-> sv-160 y) -2048.0) - (vector+float*! sv-160 sv-160 (-> s2-0 value) f28-0) - (set! f28-0 (fmin 1.0 (+ 0.2 f28-0))) - (when (< s0-0 7) - (vector+float*! - sv-160 - sv-160 - (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* 48 (+ s0-0 1)))) - f30-0 - ) - (set! f30-0 (fmin 0.9 (+ 0.2 f30-0))) - ) - (vector-! s1-0 sv-160 s4-0) - (vector-normalize! s1-0 12288.0) - (vector+! sv-160 s1-0 s4-0) - (vector-! s1-0 sv-160 (-> this digger-pos)) - (vector-flatten! s1-0 s1-0 (-> this digger-vertical)) - (let ((f0-6 (vector-normalize-ret-len! s1-0 1.0))) - (if (< f0-6 73728.0) - (vector+float*! sv-160 sv-160 s1-0 (- 73728.0 f0-6)) + (let ((sv-144 (-> this chain-joints s0-0)) + (sv-160 (new 'stack-no-clear 'vector)) ) - ) - (vector-! (-> sv-144 velocity) sv-160 (-> sv-144 position)) - (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) 0.75) - (let ((f0-9 (vector-length (-> sv-144 velocity)))) - (if (< 6144.0 f0-9) - (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) (/ 2048.0 f0-9)) + (set! (-> sv-160 quad) (-> sv-144 position quad)) + (+! (-> sv-160 y) -2048.0) + (vector+float*! sv-160 sv-160 (-> s2-0 value) f28-0) + (set! f28-0 (fmin 1.0 (+ 0.2 f28-0))) + (when (< s0-0 7) + (vector+float*! + sv-160 + sv-160 + (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* 48 (+ s0-0 1)))) + f30-0 ) - ) - (vector+! sv-160 (-> sv-144 position) (-> sv-144 velocity)) - (set! (-> sv-144 position quad) (-> sv-160 quad)) - (if (-> sv-144 joint-mod) - (set! (-> sv-144 joint-mod trans quad) (-> sv-160 quad)) + (set! f30-0 (fmin 0.9 (+ 0.2 f30-0))) ) - (when (< s0-0 7) - (vector-! (-> s5-0 vector 2) (-> this chain-joints (+ s0-0 1) position) sv-160) - (vector-normalize! (-> s5-0 vector 2) 1.0) - (vector-cross! (-> s5-0 vector 0) s3-0 (-> s5-0 vector 2)) - (vector-normalize! (-> s5-0 vector 0) 1.0) - (vector-cross! (-> s5-0 vector 1) (-> s5-0 vector 2) (-> s5-0 vector 0)) - (matrix->quaternion (-> sv-144 joint-mod quat) s5-0) - (set! (-> s3-0 quad) (-> s5-0 vector 1 quad)) + (vector-! s1-0 sv-160 s4-0) + (vector-normalize! s1-0 12288.0) + (vector+! sv-160 s1-0 s4-0) + (vector-! s1-0 sv-160 (-> this digger-pos)) + (vector-flatten! s1-0 s1-0 (-> this digger-vertical)) + (let ((f0-6 (vector-normalize-ret-len! s1-0 1.0))) + (if (< f0-6 73728.0) + (vector+float*! sv-160 sv-160 s1-0 (- 73728.0 f0-6)) + ) + ) + (vector-! (-> sv-144 velocity) sv-160 (-> sv-144 position)) + (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) 0.75) + (let ((f0-9 (vector-length (-> sv-144 velocity)))) + (if (< 6144.0 f0-9) + (vector-float*! (-> sv-144 velocity) (-> sv-144 velocity) (/ 2048.0 f0-9)) + ) + ) + (vector+! sv-160 (-> sv-144 position) (-> sv-144 velocity)) + (set! (-> sv-144 position quad) (-> sv-160 quad)) + (if (-> sv-144 joint-mod) + (set! (-> sv-144 joint-mod trans quad) (-> sv-160 quad)) + ) + (when (< s0-0 7) + (vector-! (-> s5-0 vector 2) (-> this chain-joints (+ s0-0 1) position) sv-160) + (vector-normalize! (-> s5-0 vector 2) 1.0) + (vector-cross! (-> s5-0 vector 0) s3-0 (-> s5-0 vector 2)) + (vector-normalize! (-> s5-0 vector 0) 1.0) + (vector-cross! (-> s5-0 vector 1) (-> s5-0 vector 2) (-> s5-0 vector 0)) + (matrix->quaternion (-> sv-144 joint-mod quat) s5-0) + (set! (-> s3-0 quad) (-> s5-0 vector 1 quad)) + ) + (set! (-> s4-0 quad) (-> sv-160 quad)) ) - (set! (-> s4-0 quad) (-> sv-160 quad)) ) ) ) @@ -1421,16 +1420,12 @@ (set! (-> self hud-counter) (the-as handle #f)) ) :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (ear-trans 0) (-> self root trans))) - (f1-0 1228800.0) - ) - (when (< f0-0 (* f1-0 f1-0)) - (let ((gp-1 (new 'stack-no-clear 'vector))) - (vector<-cspace! gp-1 (joint-node dig-digger-lod0-jg smoke1)) - (sound-play "digger-motor" :id (-> self motor-sound) :position gp-1) - ) - (sound-play "digger-bit" :id (-> self bit-sound) :position (-> self root trans)) + (when (< (vector-vector-distance-squared (ear-trans 0) (-> self root trans)) (square 1228800.0)) + (let ((gp-1 (new 'stack-no-clear 'vector))) + (vector<-cspace! gp-1 (joint-node dig-digger-lod0-jg smoke1)) + (sound-play "digger-motor" :id (-> self motor-sound) :position gp-1) ) + (sound-play "digger-bit" :id (-> self bit-sound) :position (-> self root trans)) ) (ja :num! (loop!)) (update-with-delay! (-> self vertical-rand)) @@ -1530,7 +1525,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) @@ -1633,8 +1627,9 @@ ) (set! (-> this draw light-index) (the-as uint 1)) (logior! (-> this skel status) (joint-control-status sync-math)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-46 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-46 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-46 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-46)) diff --git a/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc index 3cfd05bad0..4ff1aac418 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig-obs_REF.gc @@ -735,7 +735,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this hud-handle) (the-as handle #f)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) @@ -764,8 +763,9 @@ ) (set! (-> this pressed-count) 0) (set! (-> this total-buttons) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-19 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-19 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-19 (nonzero? (-> sv-16 elt-count))) (let ((s5-2 (-> v1-19 0))) (countdown (s4-2 (-> s5-2 length)) diff --git a/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc b/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc index c507b86564..5ca072424a 100644 --- a/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/dig/dig3-obs_REF.gc @@ -346,7 +346,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 int)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle pusher)) @@ -375,8 +374,9 @@ (let ((f28-0 4.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-20 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (v1-20 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when v1-20 (set! f28-0 (-> v1-20 0)) (set! f30-0 (-> v1-20 1)) diff --git a/test/decompiler/reference/jak2/levels/drill/drill-obs2_REF.gc b/test/decompiler/reference/jak2/levels/drill/drill-obs2_REF.gc index 1975bed013..9fae86de17 100644 --- a/test/decompiler/reference/jak2/levels/drill/drill-obs2_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill/drill-obs2_REF.gc @@ -888,14 +888,14 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (init-collision! this) (process-drawable-from-entity! this arg0) (skel-init! this) (set! (-> this entity extra perm task) (game-task drill-eggs)) (set! (-> this notify-actor) (entity-actor-lookup (-> this entity) 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and v1-6 (= (-> sv-16 elt-count) 1)) (set! (-> this actor-group) (the-as actor-group (-> (the-as (pointer uint32) v1-6)))) (set! (-> this actor-group) #f) diff --git a/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc b/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc index f50b24086e..a75e187c4c 100644 --- a/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc @@ -424,7 +424,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior drill-elevator-shaft-init-by-other drill-elevator-shaft ((arg0 vector) (arg1 vector)) - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((s4-0 (new 'process 'collide-shape self (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 7) 0))) (set! (-> s4-0 total-prims) (the-as uint 8)) @@ -436,28 +435,29 @@ (s1-0 (-> (the-as pair s2-0) car)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) - (let ((a3-2 (command-get-int (-> (the-as pair s1-0) car) 0)) - (t0-1 0) + (let ((sv-16 + (new + 'process + 'collide-shape-prim-mesh + s4-0 + (the-as uint (command-get-int (-> (the-as pair s1-0) car) 0)) + (the-as uint 0) + ) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) + ) + (set-vector! + (-> sv-16 local-sphere) + 0.0 + 0.0 + 0.0 + (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) - ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) - ) - (set-vector! - (-> sv-16 local-sphere) - 0.0 - 0.0 - 0.0 - (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) (set! s2-0 (-> (the-as pair s2-0) cdr)) (set! s1-0 (-> (the-as pair s2-0) car)) @@ -648,7 +648,6 @@ "If the [[*target*]] is in a valid state and there is a point to transition to in the elevator's path do so. @see [[elevator::47]]" - (local-vars (sv-16 float)) (let ((a0-1 *target*)) (when (and a0-1 (not (logtest? (focus-status dead inactive in-air grabbed edge-grab pole pilot-riding pilot teleporting) @@ -656,15 +655,16 @@ ) ) ) - (set! sv-16 (the-as float 0.0)) - (when (and (find-closest-point-in-path! this (get-trans a0-1 0) (& sv-16) #t #t) - (!= (-> this move-pos 1) sv-16) - (= sv-16 (-> this bottom-top 0)) - ) - (set! (-> this move-pos 0) (-> this move-pos 1)) - (set! (-> this move-pos 1) sv-16) - (logior! (-> this elevator-status) (elevator-status moving)) - (go (method-of-object this running)) + (let ((sv-16 (the-as float 0.0))) + (when (and (find-closest-point-in-path! this (get-trans a0-1 0) (& sv-16) #t #t) + (!= (-> this move-pos 1) sv-16) + (= sv-16 (-> this bottom-top 0)) + ) + (set! (-> this move-pos 0) (-> this move-pos 1)) + (set! (-> this move-pos 1) sv-16) + (logior! (-> this elevator-status) (elevator-status moving)) + (go (method-of-object this running)) + ) ) ) ) @@ -1003,12 +1003,9 @@ (set! (-> this deadly-length) (vector-vector-distance (-> s4-1 vector 2) (-> s4-1 vector 0))) (let ((v1-39 (-> this root root-prim))) (vector-reset! (-> v1-39 local-sphere)) - (let* ((f0-14 (/ (-> this deadly-width) 2)) - (f0-16 (* f0-14 f0-14)) - (f1-7 (/ (-> this deadly-length) 2)) - ) - (set! (-> v1-39 local-sphere w) (sqrtf (+ f0-16 (* f1-7 f1-7)))) - ) + (set! (-> v1-39 local-sphere w) + (sqrtf (+ (square (/ (-> this deadly-width) 2)) (square (/ (-> this deadly-length) 2)))) + ) ) (set! (-> s5-1 0) (vector-length (vector-! (new 'stack-no-clear 'vector) (-> s4-1 vector 1) (-> s4-1 vector 0))) @@ -1653,7 +1650,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this firing?) #f) (set! (-> this hit-sound-id) (new 'static 'sound-id)) (set! (-> this root) (new 'process 'trsqv)) @@ -1665,8 +1661,9 @@ (f28-0 0.0) (f26-0 3.0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-8 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))) + ) (when v1-8 (set! f30-0 (-> v1-8 0)) (set! f28-0 (-> v1-8 1)) diff --git a/test/decompiler/reference/jak2/levels/drill/drill-spool_REF.gc b/test/decompiler/reference/jak2/levels/drill/drill-spool_REF.gc index 9cf9da9783..598f54f1cd 100644 --- a/test/decompiler/reference/jak2/levels/drill/drill-spool_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill/drill-spool_REF.gc @@ -859,7 +859,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (stack-size-set! (-> this main-thread) 512) (logior! (-> this mask) (process-mask collectable)) (let ((s3-0 ((method-of-type res-lump get-property-struct) @@ -915,8 +914,9 @@ (format (clear *temp-string*) "~S-idle" (-> this art-name)) (set! (-> s5-1 frame-group) (the-as art-joint-anim (s3-1 s4-1 *temp-string* (the-as type #f)))) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-35 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-35 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (cond ((and v1-35 (nonzero? (-> sv-16 elt-count))) (set! (-> this egg-group) (-> v1-35 0)) @@ -1062,7 +1062,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (stack-size-set! (-> this main-thread) 512) (logior! (-> this mask) (process-mask collectable)) (let ((s3-0 "drill-crane-break") @@ -1099,18 +1098,19 @@ (initialize-skeleton this (the-as skeleton-group s4-0) (the-as pair 0)) ) (set! (-> this draw force-lod) 1) - (let ((s4-1 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-28 (res-lump-data arg0 'scale-mult (pointer float) :tag-ptr (& sv-16)))) - (when v1-28 - (set! (-> s4-1 scale x) (* (-> s4-1 scale x) (-> v1-28 0))) - (set! (-> s4-1 scale y) (* (-> s4-1 scale y) (-> v1-28 1))) - (set! (-> s4-1 scale z) (* (-> s4-1 scale z) (-> v1-28 2))) - ) + (let* ((s4-1 (-> this root)) + (sv-16 (new 'static 'res-tag)) + (v1-28 (res-lump-data arg0 'scale-mult (pointer float) :tag-ptr (& sv-16))) + ) + (when v1-28 + (set! (-> s4-1 scale x) (* (-> s4-1 scale x) (-> v1-28 0))) + (set! (-> s4-1 scale y) (* (-> s4-1 scale y) (-> v1-28 1))) + (set! (-> s4-1 scale z) (* (-> s4-1 scale z) (-> v1-28 2))) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-30 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-30 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-30 (nonzero? (-> sv-32 elt-count))) (set! (-> this egg-group) (the-as actor-group (-> (the-as (pointer uint32) v1-30)))) diff --git a/test/decompiler/reference/jak2/levels/forest/fish_REF.gc b/test/decompiler/reference/jak2/levels/forest/fish_REF.gc index 2128a70120..0f2413d110 100644 --- a/test/decompiler/reference/jak2/levels/forest/fish_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/fish_REF.gc @@ -141,26 +141,6 @@ ) :code sleep-code :post (behavior () - (local-vars - (sv-448 (function vector vector float vector)) - (sv-464 vector) - (sv-480 vector) - (sv-496 vector) - (sv-512 vector) - (sv-528 vector) - (sv-544 vector) - (sv-560 vector) - (sv-576 vector) - (sv-592 vector) - (sv-608 vector) - (sv-624 int) - (sv-640 int) - (sv-656 fish) - (sv-672 vector) - (sv-688 vector) - (sv-704 vector) - (sv-720 nav-poly) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -179,290 +159,288 @@ ) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) - (set! sv-544 (new 'stack-no-clear 'vector)) - (new 'stack-no-clear 'vector) - (let ((s0-0 (new-stack-vector0))) - (set! (-> sv-544 quad) (-> s3-0 quad)) - (set! sv-448 vector-rotate-around-y!) - (set! sv-464 sv-544) - (set! sv-480 sv-544) - (let ((a2-0 (rand-vu-float-range 0.0 65536.0))) - (sv-448 sv-464 sv-480 a2-0) - ) - (vector-float*! sv-544 sv-544 0.5) - (cond - ((and *target* (< (-> (target-pos 0) y) 0.0)) - (set! sv-512 (new 'stack-no-clear 'vector)) - (set! sv-496 s2-0) - (let ((v0-4 (target-pos 0))) - (.lvf vf4 (&-> sv-496 quad)) - (.lvf vf5 (&-> v0-4 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-512 quad) vf6) - (let* ((v1-21 sv-512) - (f0-5 (+ (* (-> v1-21 x) (-> v1-21 x)) (* (-> v1-21 z) (-> v1-21 z)))) - (f1-4 16384.0) - ) - (cond - ((< f0-5 (* f1-4 f1-4)) - (set! (-> s1-0 max-speed) 40960.0) - (vector-normalize! sv-512 (* 4096.0 (/ 4096.0 f0-5))) - (let ((a0-9 (-> s1-0 avoid-d))) - (let ((v1-28 (-> s1-0 avoid-d))) - (let ((a1-6 100000.0)) - (.mov vf7 a1-6) - ) - (.lvf vf5 (&-> sv-512 quad)) - (.lvf vf4 (&-> v1-28 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-9 quad) vf6) - ) - #t - ) - ((let ((f1-9 81920.0)) - (< f0-5 (* f1-9 f1-9)) - ) - (set! (-> s1-0 max-speed) 16384.0) - ) - (else - (set! (-> s1-0 max-speed) 4096.0) - ) - ) - ) - ) - (else - (set! (-> s1-0 max-speed) 4096.0) - ) - ) - (set! sv-528 (new 'stack-no-clear 'vector)) - (let ((v1-39 s2-0)) - (let ((a0-10 sv-544)) - (let ((a1-9 -0.1)) - (.mov vf7 a1-9) - ) - (.lvf vf5 (&-> a0-10 quad)) - ) - (.lvf vf4 (&-> v1-39 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-528 quad) vf6) - (let ((v1-41 gp-0) - (a0-11 sv-528) - (a1-10 (new 'stack-no-clear 'nav-find-poly-parms)) - ) - (vector-! (-> a1-10 point) a0-11 (-> v1-41 state mesh bounds)) - (set! (-> a1-10 y-threshold) (-> v1-41 nearest-y-threshold)) - (set! (-> a1-10 ignore) (the-as uint 2)) - (set! sv-720 (find-poly-containing-point-local (-> v1-41 state mesh) a1-10)) - ) + (let ((sv-544 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) - (when sv-720 - (let ((a0-14 gp-0) - (t9-7 (method-of-type nav-control clamp-vector-to-mesh-no-gaps)) - (a2-3 sv-720) - (t0-0 s5-0) - ) - (t9-7 a0-14 sv-528 a2-3 sv-544 t0-0) - ) + (let ((s0-0 (new-stack-vector0))) + (set! (-> sv-544 quad) (-> s3-0 quad)) + (vector-rotate-around-y! sv-544 sv-544 (rand-vu-float-range 0.0 65536.0)) + (vector-float*! sv-544 sv-544 0.5) (cond - ((-> s5-0 found-boundary) - (let ((a1-12 (-> s1-0 border-f))) - (let ((v1-48 (-> s1-0 border-f))) - (let ((a0-15 (-> s5-0 boundary-normal))) - (let ((a2-5 -10000.0)) - (.mov vf7 a2-5) + ((and *target* (< (-> (target-pos 0) y) 0.0)) + (let ((sv-512 (new 'stack-no-clear 'vector))) + (let ((sv-496 s2-0) + (v0-4 (target-pos 0)) ) - (.lvf vf5 (&-> a0-15 quad)) - ) - (.lvf vf4 (&-> v1-48 quad)) + (.lvf vf4 (&-> sv-496 quad)) + (.lvf vf5 (&-> v0-4 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-512 quad) vf6) + (let* ((v1-21 sv-512) + (f0-5 (+ (* (-> v1-21 x) (-> v1-21 x)) (* (-> v1-21 z) (-> v1-21 z)))) + ) + (cond + ((< f0-5 (square 16384.0)) + (set! (-> s1-0 max-speed) 40960.0) + (vector-normalize! sv-512 (* 4096.0 (/ 4096.0 f0-5))) + (let ((a0-9 (-> s1-0 avoid-d))) + (let ((v1-28 (-> s1-0 avoid-d))) + (let ((a1-6 100000.0)) + (.mov vf7 a1-6) + ) + (.lvf vf5 (&-> sv-512 quad)) + (.lvf vf4 (&-> v1-28 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-9 quad) vf6) + ) + #t + ) + ((< f0-5 (square 81920.0)) + (set! (-> s1-0 max-speed) 16384.0) + ) + (else + (set! (-> s1-0 max-speed) 4096.0) + ) + ) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-12 quad) vf6) ) ) (else - (set! sv-608 (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0)) - (let ((a1-14 sv-608)) - (let ((v1-49 s2-0)) - (let ((a0-17 sv-608)) - (let ((a2-8 4096.0)) - (.mov vf7 a2-8) - ) - (.lvf vf5 (&-> a0-17 quad)) - ) - (.lvf vf4 (&-> v1-49 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-14 quad) vf6) - ) - (set! sv-592 sv-608) - (set! sv-560 sv-608) - (set! sv-576 (new 'stack-no-clear 'vector)) - (set! (-> sv-576 x) (cos (-> s1-0 wander))) - (set! (-> sv-576 y) 0.0) - (set! (-> sv-576 z) (sin (-> s1-0 wander))) - (set! (-> sv-576 w) 1.0) - (let ((v1-59 3276.8)) - (.mov vf7 v1-59) - ) - (.lvf vf5 (&-> sv-576 quad)) - (.lvf vf4 (&-> sv-560 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> sv-592 quad) vf6) - (vector-! sv-608 sv-608 s2-0) - (let ((a0-21 s0-0)) - (let ((v1-64 s0-0)) - (let ((a1-18 10.0)) - (.mov vf7 a1-18) - ) - (.lvf vf5 (&-> sv-608 quad)) - (.lvf vf4 (&-> v1-64 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-21 quad) vf6) - ) - (+! (-> s1-0 wander) (rand-vu-float-range -1820.4445 1820.4445)) + (set! (-> s1-0 max-speed) 4096.0) ) ) - ) - (set! sv-624 0) - (set! sv-688 (new 'stack-no-clear 'vector)) - (set! (-> sv-688 quad) (the-as uint128 0)) - (set! sv-704 (new 'stack-no-clear 'vector)) - (set! (-> sv-704 quad) (the-as uint128 0)) - (set! sv-640 0) - (while (< sv-640 12) - (when (!= sv-640 s4-0) - (set! sv-656 (-> self fishes sv-640)) - (set! sv-672 (new 'stack-no-clear 'vector)) - (let ((v1-78 s2-0) - (a0-25 (-> sv-656 pos)) + (let ((sv-528 (new 'stack-no-clear 'vector))) + (let ((v1-39 s2-0)) + (let ((a0-10 sv-544)) + (let ((a1-9 -0.1)) + (.mov vf7 a1-9) ) - (.lvf vf4 (&-> v1-78 quad)) - (.lvf vf5 (&-> a0-25 quad)) + (.lvf vf5 (&-> a0-10 quad)) + ) + (.lvf vf4 (&-> v1-39 quad)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-672 quad) vf6) - (let* ((v1-80 sv-672) - (f0-29 (+ (* (-> v1-80 x) (-> v1-80 x)) (* (-> v1-80 z) (-> v1-80 z)))) - (f1-15 4096.0) - ) - (when (< f0-29 (* f1-15 f1-15)) - (vector-normalize! sv-672 (* 4096.0 (/ 4096.0 f0-29))) - (let ((a0-27 s0-0)) - (let ((v1-87 s0-0)) - (let ((a1-24 100.0)) - (.mov vf7 a1-24) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-528 quad) vf6) + (let ((v1-41 gp-0) + (a0-11 sv-528) + (a1-10 (new 'stack-no-clear 'nav-find-poly-parms)) + ) + (vector-! (-> a1-10 point) a0-11 (-> v1-41 state mesh bounds)) + (set! (-> a1-10 y-threshold) (-> v1-41 nearest-y-threshold)) + (set! (-> a1-10 ignore) (the-as uint 2)) + (let ((sv-720 (find-poly-containing-point-local (-> v1-41 state mesh) a1-10))) + (new 'stack-no-clear 'vector) + (when sv-720 + (clamp-vector-to-mesh-no-gaps gp-0 sv-528 sv-720 sv-544 s5-0) + (cond + ((-> s5-0 found-boundary) + (let ((a1-12 (-> s1-0 border-f))) + (let ((v1-48 (-> s1-0 border-f))) + (let ((a0-15 (-> s5-0 boundary-normal))) + (let ((a2-5 -10000.0)) + (.mov vf7 a2-5) + ) + (.lvf vf5 (&-> a0-15 quad)) + ) + (.lvf vf4 (&-> v1-48 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-12 quad) vf6) + ) + ) + (else + (let ((sv-608 (vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 1.0))) + (let ((a1-14 sv-608)) + (let ((v1-49 s2-0)) + (let ((a0-17 sv-608)) + (let ((a2-8 4096.0)) + (.mov vf7 a2-8) + ) + (.lvf vf5 (&-> a0-17 quad)) + ) + (.lvf vf4 (&-> v1-49 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-14 quad) vf6) + ) + (let ((sv-592 sv-608)) + (let ((sv-560 sv-608)) + (let ((sv-576 (new 'stack-no-clear 'vector))) + (set! (-> sv-576 x) (cos (-> s1-0 wander))) + (set! (-> sv-576 y) 0.0) + (set! (-> sv-576 z) (sin (-> s1-0 wander))) + (set! (-> sv-576 w) 1.0) + (let ((v1-59 3276.8)) + (.mov vf7 v1-59) + ) + (.lvf vf5 (&-> sv-576 quad)) + ) + (.lvf vf4 (&-> sv-560 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> sv-592 quad) vf6) + ) + (vector-! sv-608 sv-608 s2-0) + (let ((a0-21 s0-0)) + (let ((v1-64 s0-0)) + (let ((a1-18 10.0)) + (.mov vf7 a1-18) + ) + (.lvf vf5 (&-> sv-608 quad)) + (.lvf vf4 (&-> v1-64 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-21 quad) vf6) + ) + ) + (+! (-> s1-0 wander) (rand-vu-float-range -1820.4445 1820.4445)) ) - (.lvf vf5 (&-> sv-672 quad)) - (.lvf vf4 (&-> v1-87 quad)) + ) + ) + (let ((sv-624 0) + (sv-688 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-688 quad) (the-as uint128 0)) + (let ((sv-704 (new 'stack-no-clear 'vector))) + (set! (-> sv-704 quad) (the-as uint128 0)) + (let ((sv-640 0)) + (while (< sv-640 12) + (when (!= sv-640 s4-0) + (let ((sv-656 (-> self fishes sv-640)) + (sv-672 (new 'stack-no-clear 'vector)) + ) + (let ((v1-78 s2-0) + (a0-25 (-> sv-656 pos)) + ) + (.lvf vf4 (&-> v1-78 quad)) + (.lvf vf5 (&-> a0-25 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-672 quad) vf6) + (let* ((v1-80 sv-672) + (f0-29 (+ (* (-> v1-80 x) (-> v1-80 x)) (* (-> v1-80 z) (-> v1-80 z)))) + ) + (when (< f0-29 (square 4096.0)) + (vector-normalize! sv-672 (* 4096.0 (/ 4096.0 f0-29))) + (let ((a0-27 s0-0)) + (let ((v1-87 s0-0)) + (let ((a1-24 100.0)) + (.mov vf7 a1-24) + ) + (.lvf vf5 (&-> sv-672 quad)) + (.lvf vf4 (&-> v1-87 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-27 quad) vf6) + ) + (vector+! sv-688 sv-688 (-> sv-656 pos)) + (vector+! sv-704 sv-704 (-> sv-656 vel)) + (+! sv-624 1) + sv-624 + ) + ) + ) + ) + (+! sv-640 1) + ) + ) + (when (nonzero? sv-624) + (vector-float*! sv-688 sv-688 (/ 1.0 (the float sv-624))) + (vector-! sv-688 sv-688 s2-0) + (let ((v1-104 sv-688)) + (vector-normalize! + sv-688 + (* 4096.0 (/ 4096.0 (+ (* (-> v1-104 x) (-> v1-104 x)) (* (-> v1-104 z) (-> v1-104 z))))) + ) + ) + (let ((a0-36 s0-0)) + (let ((v1-106 s0-0)) + (let ((a1-36 100.0)) + (.mov vf7 a1-36) + ) + (.lvf vf5 (&-> sv-688 quad)) + (.lvf vf4 (&-> v1-106 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-36 quad) vf6) + ) + (vector-float*! sv-704 sv-704 (/ 1.0 (the float sv-624))) + (vector-! sv-704 sv-704 s3-0) + (let ((a0-39 s0-0)) + (let ((v1-110 s0-0)) + (let ((a1-43 5.0)) + (.mov vf7 a1-43) + ) + (.lvf vf5 (&-> sv-704 quad)) + (.lvf vf4 (&-> v1-110 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-39 quad) vf6) + ) + ) + ) + ) + (vector-float*! (-> s1-0 avoid-d) (-> s1-0 avoid-d) 0.95) + (vector-float*! (-> s1-0 border-f) (-> s1-0 border-f) 0.99) + (vector+! s0-0 s0-0 (-> s1-0 border-f)) + (vector+! s0-0 s0-0 (-> s1-0 avoid-d)) + (set! (-> s0-0 y) 0.0) + (let ((a0-44 s3-0)) + (let ((v1-117 s3-0)) + (let ((a1-52 (seconds-per-frame))) + (.mov vf7 a1-52) + ) + (.lvf vf5 (&-> s0-0 quad)) + (.lvf vf4 (&-> v1-117 quad)) ) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-27 quad) vf6) + (.svf (&-> a0-44 quad) vf6) ) - (vector+! sv-688 sv-688 (-> sv-656 pos)) - (vector+! sv-704 sv-704 (-> sv-656 vel)) - (set! sv-624 (+ sv-624 1)) - sv-624 + (vector-float*! s3-0 s3-0 0.8) + (let ((a1-54 s2-0)) + (let ((v1-120 s2-0)) + (let ((a0-46 s3-0)) + (let ((a2-10 (seconds-per-frame))) + (.mov vf7 a2-10) + ) + (.lvf vf5 (&-> a0-46 quad)) + ) + (.lvf vf4 (&-> v1-120 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-54 quad) vf6) + ) + (cloest-point-on-mesh (-> self nav) s2-0 s2-0 sv-720) ) ) ) - (set! sv-640 (+ sv-640 1)) - ) - (when (nonzero? sv-624) - (vector-float*! sv-688 sv-688 (/ 1.0 (the float sv-624))) - (vector-! sv-688 sv-688 s2-0) - (let ((t9-13 vector-normalize!) - (a0-35 sv-688) - (f0-35 4096.0) - (f1-21 4096.0) - (v1-104 sv-688) - ) - (t9-13 a0-35 (* f0-35 (/ f1-21 (+ (* (-> v1-104 x) (-> v1-104 x)) (* (-> v1-104 z) (-> v1-104 z)))))) - ) - (let ((a0-36 s0-0)) - (let ((v1-106 s0-0)) - (let ((a1-36 100.0)) - (.mov vf7 a1-36) - ) - (.lvf vf5 (&-> sv-688 quad)) - (.lvf vf4 (&-> v1-106 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-36 quad) vf6) - ) - (vector-float*! sv-704 sv-704 (/ 1.0 (the float sv-624))) - (vector-! sv-704 sv-704 s3-0) - (let ((a0-39 s0-0)) - (let ((v1-110 s0-0)) - (let ((a1-43 5.0)) - (.mov vf7 a1-43) - ) - (.lvf vf5 (&-> sv-704 quad)) - (.lvf vf4 (&-> v1-110 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-39 quad) vf6) - ) - ) - (vector-float*! (-> s1-0 avoid-d) (-> s1-0 avoid-d) 0.95) - (vector-float*! (-> s1-0 border-f) (-> s1-0 border-f) 0.99) - (vector+! s0-0 s0-0 (-> s1-0 border-f)) - (vector+! s0-0 s0-0 (-> s1-0 avoid-d)) - (set! (-> s0-0 y) 0.0) - (let ((a0-44 s3-0)) - (let ((v1-117 s3-0)) - (let ((a1-52 (seconds-per-frame))) - (.mov vf7 a1-52) - ) - (.lvf vf5 (&-> s0-0 quad)) - (.lvf vf4 (&-> v1-117 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-44 quad) vf6) ) ) - (vector-float*! s3-0 s3-0 0.8) - (let ((a1-54 s2-0)) - (let ((v1-120 s2-0)) - (let ((a0-46 s3-0)) - (let ((a2-10 (seconds-per-frame))) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a0-46 quad)) - ) - (.lvf vf4 (&-> v1-120 quad)) - ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-54 quad) vf6) - ) - (cloest-point-on-mesh (-> self nav) s2-0 s2-0 sv-720) (set! (-> s2-0 y) -1638.4) (let ((v1-124 (handle->process (-> s1-0 handle)))) (when v1-124 diff --git a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc index b4e170323d..76caac8a78 100644 --- a/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/pegasus_REF.gc @@ -197,12 +197,10 @@ ;; definition for method 12 of type pegasus (defmethod run-logic? ((this pegasus)) "Calls [[process-tree::12]] if we are considered in-range of the [[pegasus]], otherwise returns [[#t]]" - (let ((min-distance 491520.0)) - (if (< (* min-distance min-distance) (vector-vector-distance-squared (-> this root trans) (camera-pos))) - ((method-of-type enemy run-logic?) this) - #t - ) - ) + (if (< (square 491520.0) (vector-vector-distance-squared (-> this root trans) (camera-pos))) + ((method-of-type enemy run-logic?) this) + #t + ) ) ;; definition for method 137 of type pegasus @@ -221,13 +219,9 @@ (-> target gun fire-dir-out) (vector-length inaccuracy-dir) ) - (let ((inaccuracy-mag (vector-vector-distance-squared inaccuracy-vec (-> this root trans))) - (threshold 20480.0) - ) - (if (< inaccuracy-mag (* threshold threshold)) - (set-time! (-> this targetted-timer)) - ) - ) + (if (< (vector-vector-distance-squared inaccuracy-vec (-> this root trans)) (square 20480.0)) + (set-time! (-> this targetted-timer)) + ) ) ) ) @@ -1346,7 +1340,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this pegasus)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (tag res-tag)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-pegasus" (the-as (pointer uint32) #f))) @@ -1373,11 +1366,11 @@ (set! (-> this path-info path-info-idx path-data) curve) (logior! (-> curve flags) (path-control-flag display draw-line draw-point)) ) - (set! tag (new 'static 'res-tag)) - (let ((data - (res-lump-data (-> this entity) 'path-connection pointer :tag-ptr (& tag) :time (the float path-info-idx)) - ) - ) + (let* ((tag (new 'static 'res-tag)) + (data + (res-lump-data (-> this entity) 'path-connection pointer :tag-ptr (& tag) :time (the float path-info-idx)) + ) + ) (cond (data (set! (-> this path-info path-info-idx num-data) (the-as int (-> tag elt-count))) @@ -1463,23 +1456,23 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (local-vars (data int)) (set-time! (-> self start-time)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-pegasus :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) - (set! data (-> self data-int32 1)) - (when (-> self actor-group 0) - (dotimes (actor-group (the-as int (-> self actor-group 0 0))) - (let ((actor (-> (&+ (-> self actor-group 0) (* actor-group 8)) 3))) - (if (and actor (logtest? (-> actor extra perm status) (entity-perm-status subtask-complete))) - (set! data (+ data -1)) - ) + (let ((data (-> self data-int32 1))) + (when (-> self actor-group 0) + (dotimes (actor-group (the-as int (-> self actor-group 0 0))) + (let ((actor (-> (&+ (-> self actor-group 0) (* actor-group 8)) 3))) + (if (and actor (logtest? (-> actor extra perm status) (entity-perm-status subtask-complete))) + (+! data -1) + ) + ) ) ) - ) - (let ((_data data)) - (set! (-> self data-int32 0) _data) - (set! (-> *game-info* counter) (the float _data)) + (let ((_data data)) + (set! (-> self data-int32 0) _data) + (set! (-> *game-info* counter) (the float _data)) + ) ) (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc index a4465a84a6..e5e5e61ad9 100644 --- a/test/decompiler/reference/jak2/levels/forest/predator_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/predator_REF.gc @@ -719,7 +719,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod predator-method-184 ((this predator) (arg0 int) (arg1 float)) - (local-vars (sv-224 vector) (sv-240 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -751,23 +750,22 @@ (when s2-0 (seek! (-> this miss-amount) (* 0.5 (vector-length (-> (the-as process-focusable s2-0) root transv))) 4096.0) (set! (-> s3-0 quad) (-> (get-trans (the-as process-focusable s2-0) 3) quad)) - (set! sv-224 (new 'stack-no-clear 'vector)) - (let ((v1-24 (-> s5-0 pos)) - (a0-18 s3-0) - ) - (.lvf vf4 (&-> v1-24 quad)) - (.lvf vf5 (&-> a0-18 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-224 quad) vf6) - (let* ((f0-5 (vector-length sv-224)) - (f0-6 (/ f0-5 (meters 130))) - ) - (set! sv-240 (new 'stack-no-clear 'vector)) - (let ((s0-0 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) + (let ((sv-224 (new 'stack-no-clear 'vector))) + (let ((v1-24 (-> s5-0 pos)) + (a0-18 s3-0) ) + (.lvf vf4 (&-> v1-24 quad)) + (.lvf vf5 (&-> a0-18 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-224 quad) vf6) + (let* ((f0-5 (vector-length sv-224)) + (f0-6 (/ f0-5 (meters 130))) + (sv-240 (new 'stack-no-clear 'vector)) + (s0-0 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) + ) (let ((a0-19 s3-0)) (let ((v1-30 s3-0)) (let ((a1-6 (-> (the-as process-focusable s2-0) root transv))) @@ -791,11 +789,7 @@ (let ((a2-5 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-224 (-> this shoot-angle)))) (vector-orient-by-quat! sv-240 sv-240 a2-5) ) - (let* ((t9-9 quaternion-vector-angle!) - (a0-27 (new 'stack-no-clear 'quaternion)) - (a2-6 (-> this shoot-angle)) - (a2-7 (t9-9 a0-27 sv-224 a2-6)) - ) + (let ((a2-7 (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) sv-224 (-> this shoot-angle)))) (vector-orient-by-quat! s0-0 s0-0 a2-7) ) (let ((a0-29 s1-1)) @@ -1714,7 +1708,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1734,8 +1727,9 @@ (logclear! (-> a0-4 flags) (predator-node-flag taken)) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-6)) diff --git a/test/decompiler/reference/jak2/levels/fortress/dump/fordumpa-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/dump/fordumpa-obs_REF.gc index b93dc5c9f6..24c48c1414 100644 --- a/test/decompiler/reference/jak2/levels/fortress/dump/fordumpa-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/dump/fordumpa-obs_REF.gc @@ -211,7 +211,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -237,8 +236,9 @@ ) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) (set! (-> this tank-actor) (entity-actor-lookup arg0 'alt-actor 1)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-11 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-11 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-11 (nonzero? (-> sv-16 elt-count))) (set! (-> this switch-group) (the-as (pointer actor-group) v1-11)) diff --git a/test/decompiler/reference/jak2/levels/fortress/dump/fordumpb-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/dump/fordumpb-obs_REF.gc index c484411d97..208888e596 100644 --- a/test/decompiler/reference/jak2/levels/fortress/dump/fordumpb-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/dump/fordumpb-obs_REF.gc @@ -359,7 +359,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 int)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -373,8 +372,9 @@ (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) (let ((s3-1 1200)) 0.0 - (set! sv-64 0) - (let ((v1-7 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64))))) + (let* ((sv-64 0) + (v1-7 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64)))) + ) (when v1-7 (set! s3-1 (the int (* 300.0 (-> v1-7 0)))) (-> v1-7 1) diff --git a/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank-turret_REF.gc b/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank-turret_REF.gc index 76393f3a25..a861640c0f 100644 --- a/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank-turret_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank-turret_REF.gc @@ -989,7 +989,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch (pointer process) vs none. (defmethod fort-robotank-turret-method-33 ((this fort-robotank-turret)) - (local-vars (sv-144 vector) (sv-160 vector)) (let ((s3-0 (new 'stack-no-clear 'inline-array 'vector 2)) (s5-0 (new 'stack-no-clear 'inline-array 'vector 4)) ) @@ -1005,13 +1004,7 @@ (let ((f30-0 (* 0.5 (vector-length (vector-! (new 'stack-no-clear 'vector) (-> s3-0 1) (-> s3-0 0)))))) (let ((f28-0 (fmax 81920.0 (+ 12288.0 (vector-length (vector-! (new 'stack-no-clear 'vector) s1-0 (-> s3-0 0))))))) (vector-normalize-copy! s4-0 (-> this node-list data (-> this gun-joint-l s2-0) bone transform vector 2) 1.0) - (let ((s0-0 vector-rotate-y!)) - (set! sv-144 s4-0) - (set! sv-160 s4-0) - (let ((a2-1 (- 16384.0 (acos (/ f30-0 f28-0))))) - (s0-0 sv-144 sv-160 a2-1) - ) - ) + (vector-rotate-y! s4-0 s4-0 (- 16384.0 (acos (/ f30-0 f28-0)))) (set! (-> s5-0 0 quad) (-> s3-0 0 quad)) (vector+float*! (-> s5-0 1) (-> s5-0 0) s4-0 512000.0) (set! (-> this shot-range) (fmin 204800.0 f28-0)) diff --git a/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank_REF.gc b/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank_REF.gc index 0a668391e9..bcd463668d 100644 --- a/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/dump/fort-robotank_REF.gc @@ -643,11 +643,6 @@ ;; definition for method 26 of type fort-robotank ;; INFO: Used lq/sq (defmethod fort-robotank-method-26 ((this fort-robotank) (arg0 int) (arg1 float) (arg2 float)) - (local-vars - (sv-96 fort-robotank-segment-event) - (sv-112 (function process-tree event-message-block object)) - (sv-128 event-message-block) - ) (with-pp (let* ((s4-0 (* 0.00001 (the float (the int (+ 0.5 (* 100000.0 arg1)))))) (s3-0 (* 0.00001 (the float (the int (+ 0.5 (* 100000.0 arg2)))))) @@ -655,18 +650,17 @@ (s1-0 (-> s2-0 event-tbl)) ) (dotimes (s0-0 (-> s2-0 event-count)) - (set! sv-96 (-> s1-0 s0-0)) - (let ((f0-4 (-> sv-96 pos-norm))) + (let* ((sv-96 (-> s1-0 s0-0)) + (f0-4 (-> sv-96 pos-norm)) + ) (when (and (= (-> sv-96 source) arg0) (>= s4-0 f0-4) (< s3-0 f0-4)) (case (-> sv-96 event-type) (('send-event) - (set! sv-128 (new 'stack-no-clear 'event-message-block)) - (set! (-> sv-128 from) (process->ppointer pp)) - (set! (-> sv-128 num-params) 0) - (set! (-> sv-128 message) (the-as symbol (-> sv-96 param-obj))) - (set! sv-112 send-event-function) - (let ((a0-11 (process-by-ename (-> sv-96 actor)))) - (sv-112 a0-11 sv-128) + (let ((sv-128 (new 'stack-no-clear 'event-message-block))) + (set! (-> sv-128 from) (process->ppointer pp)) + (set! (-> sv-128 num-params) 0) + (set! (-> sv-128 message) (the-as symbol (-> sv-96 param-obj))) + (send-event-function (process-by-ename (-> sv-96 actor)) sv-128) ) ) (('code) diff --git a/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc index 32f1a8f755..f91ed8c196 100644 --- a/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/prison/prison-obs_REF.gc @@ -52,7 +52,6 @@ ;; definition for function dark-lightning-handler ;; INFO: Used lq/sq (defbehavior dark-lightning-handler process-drawable ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-112 sparticle-launcher) (sv-160 vector) (sv-164 vector) (sv-176 lightning-spec)) (let ((s3-0 (new 'static 'vector4w :x -1)) (s4-0 (new 'static 'vector4w :x -1)) (s5-0 (command-get-process "jak-highres-prison" *target*)) @@ -98,38 +97,17 @@ (set! (-> s4-0 x) v1-38) (let ((s4-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data 8))) (s5-2 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s5-0) node-list data 5))) - (s3-3 (get-process *default-dead-pool* lightning-tracker #x4000)) ) - (when s3-3 - (let ((t9-17 (method-of-type lightning-tracker activate))) - (t9-17 - (the-as lightning-tracker s3-3) - self - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s2-2 run-function-in-process) - (s1-2 s3-3) - (s0-1 lightning-tracker-init) - ) - (set! sv-176 (-> *lightning-spec-id-table* 19)) - (let ((a3-4 (the int (* 300.0 (rand-vu-float-range 1.0 2.0)))) - (t0-1 lightning-probe-callback) - ) - ((the-as (function object object object object object object object object none) s2-2) - s1-2 - s0-1 - sv-176 - a3-4 - t0-1 - gp-2 - s4-2 - s5-2 - ) - ) - ) - (-> s3-3 ppointer) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 19) + (the int (* 300.0 (rand-vu-float-range 1.0 2.0))) + lightning-probe-callback + gp-2 + s4-2 + s5-2 + :to self ) ) ) @@ -147,51 +125,51 @@ (s1-3 (-> s5-3 length)) (s0-2 (rand-vu-int-range-exclude 0 (+ v1-52 -1) (-> s3-0 x))) (s1-4 (rand-vu-int-range-exclude 0 (+ s1-3 -1) (-> s4-0 x))) + (sv-112 (-> *part-id-table* 179)) ) - (set! sv-112 (-> *part-id-table* 179)) (set! (-> s3-0 x) s0-2) (set! (-> s4-0 x) s1-4) - (set! sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> s2-3 s0-2)))) - (set! sv-164 (vector<-cspace! - (new 'stack-no-clear 'vector) - (-> (the-as process-drawable gp-3) node-list data (-> s5-3 s1-4)) + (let* ((sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> s2-3 s0-2)))) + (sv-164 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable gp-3) node-list data (-> s5-3 s1-4)) + ) ) - ) - ) - (let ((s4-3 (process-spawn - lightning-tracker - :init lightning-tracker-init - (-> *lightning-spec-id-table* 19) - (the int (* 300.0 (rand-vu-float-range 1.0 2.0))) - lightning-probe-callback - self - sv-160 - sv-164 - :to gp-3 - ) + (s4-3 (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 19) + (the int (* 300.0 (rand-vu-float-range 1.0 2.0))) + lightning-probe-callback + self + sv-160 + sv-164 + :to gp-3 + ) + ) + ) + (when (and sv-112 s4-3) + (let ((v1-74 (get-field-spec-by-id sv-112 (sp-field-id spt-timer)))) + (if v1-74 + (set! (-> v1-74 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s4-3 0)) duration))) ) - ) - (when (and sv-112 s4-3) - (let ((v1-74 (get-field-spec-by-id sv-112 (sp-field-id spt-timer)))) - (if v1-74 - (set! (-> v1-74 initial-valuef) (the-as float (-> (the-as lightning-tracker (-> s4-3 0)) duration))) - ) - ) - (let ((t9-30 sp-launch-particles-var) - (a0-35 *sp-particle-system-2d*) - (a1-37 sv-112) - (a2-19 *launch-matrix*) - ) - (set! (-> a2-19 trans quad) (-> sv-160 quad)) - (t9-30 a0-35 a1-37 a2-19 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) - ) - (let ((t9-31 sp-launch-particles-var) - (a0-36 *sp-particle-system-2d*) - (a1-38 sv-112) - (a2-20 *launch-matrix*) - ) - (set! (-> a2-20 trans quad) (-> sv-164 quad)) - (t9-31 a0-36 a1-38 a2-20 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-30 sp-launch-particles-var) + (a0-35 *sp-particle-system-2d*) + (a1-37 sv-112) + (a2-19 *launch-matrix*) + ) + (set! (-> a2-19 trans quad) (-> sv-160 quad)) + (t9-30 a0-35 a1-37 a2-19 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (let ((t9-31 sp-launch-particles-var) + (a0-36 *sp-particle-system-2d*) + (a1-38 sv-112) + (a2-20 *launch-matrix*) + ) + (set! (-> a2-20 trans quad) (-> sv-164 quad)) + (t9-31 a0-36 a1-38 a2-20 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc index fceb62d45e..5c012186dd 100644 --- a/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/rescue/forresca-obs_REF.gc @@ -435,13 +435,13 @@ ;; WARN: Return type mismatch int vs none. (defmethod set-palette! ((this elec-lock-gate)) "Sets the [[elec-gate]]'s `palette-id` appropriately" - (local-vars (sv-16 res-tag)) (let ((t9-0 (method-of-type fort-elec-gate set-palette!))) (t9-0 this) ) (logclear! (-> this mask) (process-mask actor-pause)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-4 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-4 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-4 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-4)) diff --git a/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc b/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc index 69aeb1c9a2..123cf1153b 100644 --- a/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/fortress/rescue/forrescb-obs_REF.gc @@ -222,12 +222,6 @@ ) :code sleep-code :post (behavior () - (local-vars - (sv-1696 - (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker) - ) - (sv-1712 lightning-spec) - ) (let ((a1-0 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-0 from) (process->ppointer self)) (set! (-> a1-0 num-params) 2) @@ -252,11 +246,11 @@ (gp-1 (vector-cross! (new 'stack-no-clear 'vector) v0-4 *up-vector*)) (s5-0 (-> self l-bolt)) (f30-0 90112.0) - (f0-6 (* f30-0 f30-0)) + (f0-6 (square f30-0)) (s4-1 (vector-! (new 'stack-no-clear 'vector) s2-0 s3-0)) (f1-4 (* 0.5 (vector-length s4-1))) ) - (let ((f2-2 (* f1-4 f1-4))) + (let ((f2-2 (square f1-4))) (vector-float*! s4-1 s4-1 0.5) (vector+! s4-1 s3-0 s4-1) (+! (-> s4-1 y) (sqrtf (- f0-6 f2-2))) @@ -324,39 +318,16 @@ (let ((s3-3 (as-type (-> s3-2 best-other-tri collide-ptr) collide-shape-prim-sphere))) (when s3-3 (sound-play "laser-hit") - (let ((s2-4 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s2-4 - (let ((t9-19 (method-of-type lightning-tracker activate))) - (t9-19 - (the-as lightning-tracker s2-4) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s1-3 run-function-in-process) - (s0-0 s2-4) - ) - (set! sv-1696 lightning-tracker-init) - (set! sv-1712 (-> self l-spec)) - (let ((a3-3 (the int (* 3.0 (rand-vu-float-range 5.0 11.0)))) - (t0-2 #f) - (t1-2 #f) - ) - ((the-as (function object object object object object object object object none) s1-3) - s0-0 - sv-1696 - sv-1712 - a3-3 - t0-2 - t1-2 - s5-2 - s4-2 - ) - ) - ) - (-> s2-4 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> self l-spec) + (the int (* 3.0 (rand-vu-float-range 5.0 11.0))) + #f + #f + s5-2 + s4-2 + :to *entity-pool* ) (let ((v1-68 (vector-reset! (new 'stack-no-clear 'vector)))) (send-event @@ -584,13 +555,13 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 int)) (quaternion-copy! (-> this init-quat) (-> arg0 quat)) (let ((s5-0 (new 'stack-no-clear 'sync-info-params))) (let ((s3-0 1200)) 0.0 - (set! sv-64 0) - (let ((v1-1 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64))))) + (let* ((sv-64 0) + (v1-1 (res-lump-data arg0 'sync (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-64)))) + ) (when v1-1 (set! s3-0 (the int (* 300.0 (-> v1-1 0)))) (-> v1-1 1) diff --git a/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc b/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc index 3b5d863fbd..48ecd859d5 100644 --- a/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc +++ b/test/decompiler/reference/jak2/levels/gungame/gun-dummy_REF.gc @@ -2182,7 +2182,7 @@ (set! f28-2 (+ (* -2.0 f28-2 f28-2 f28-2) (* 3.0 f28-2 f28-2))) ) ((= v1-87 2) - (set! f28-2 (* f28-2 f28-2 f28-2)) + (set! f28-2 (* (square f28-2) f28-2)) ) ((= v1-87 3) (sin (* 16384.0 f28-2)) diff --git a/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc b/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc index 461f1c5b3a..c41449536b 100644 --- a/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/gungame/gungame-obs_REF.gc @@ -2005,7 +2005,7 @@ ;; definition for method 22 of type training-manager ;; INFO: Used lq/sq (defmethod training-manager-method-22 ((this training-manager) (arg0 symbol)) - (local-vars (v1-28 symbol) (a0-18 symbol) (sv-48 process) (sv-64 process) (sv-80 process)) + (local-vars (v1-28 symbol) (a0-18 symbol) (sv-64 process) (sv-80 process)) (let ((s4-0 (new 'static 'fact-info :pickup-type (pickup-type ammo-red) :pickup-spawn-amount 20.0)) (s3-0 (new 'stack-no-clear 'vector)) (s2-0 (new 'stack-no-clear 'sphere)) @@ -2028,17 +2028,20 @@ ) ) (when (and s1-0 (not (handle->process (-> this entrance-crates s0-0)))) - (set! sv-48 (get-process *default-dead-pool* crate #x4000)) - (let ((v1-21 - (when sv-48 - (let ((t9-4 (method-of-type crate activate))) - (t9-4 (the-as crate sv-48) *entity-pool* (symbol->string (-> crate symbol)) (the-as pointer #x70004000)) + (let* ((sv-48 (get-process *default-dead-pool* crate #x4000)) + (v1-21 + (when sv-48 + ((method-of-type crate activate) + (the-as crate sv-48) + *entity-pool* + (symbol->string (-> crate symbol)) + (the-as pointer #x70004000) ) - (run-now-in-process sv-48 crate-init-by-other #f s3-0 'wood s4-0) - (-> sv-48 ppointer) - ) - ) - ) + (run-now-in-process sv-48 crate-init-by-other #f s3-0 'wood s4-0) + (-> sv-48 ppointer) + ) + ) + ) (set! a0-18 (when v1-21 (set! sv-64 (the-as process a0-18)) (set! sv-64 (-> v1-21 0 self)) @@ -2057,11 +2060,7 @@ *up-vector* (+ -4551.1113 (-> *entrance-gungame-crates-pos* s0-0 pos w)) ) - (set! (-> this entrance-crates s0-0) (ppointer->handle (if sv-80 - (-> sv-80 ppointer) - ) - ) - ) + (set! (-> this entrance-crates s0-0) (process->handle sv-80)) ) ) ) @@ -2200,10 +2199,10 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set-setting! 'darkjak #f 0.0 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-3 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-3 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-3)) diff --git a/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc b/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc index e6cb086151..d4c2501721 100644 --- a/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc +++ b/test/decompiler/reference/jak2/levels/hiphog/whack_REF.gc @@ -2248,14 +2248,6 @@ ) ) :code (behavior ((arg0 symbol)) - (local-vars - (sv-48 whack-a-metal) - (sv-64 (function vector cspace vector)) - (sv-80 vector) - (sv-96 vector) - (sv-112 (function vector cspace vector)) - (sv-128 vector) - ) (let ((gp-0 (cond ((>= (-> self air-attack-count) 10) daxter-highres-mole-idle-tired-ja @@ -2276,50 +2268,25 @@ (ja-no-eval :group! daxter-highres-mole-shock-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (when (rand-vu-percent? 0.2) - (let* ((gp-2 (get-process *default-dead-pool* lightning-tracker #x4000)) - (v1-26 (when gp-2 - (let ((t9-6 (method-of-type lightning-tracker activate))) - (t9-6 - (the-as lightning-tracker gp-2) - self - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-1 run-function-in-process) - (s4-0 gp-2) - (s3-0 lightning-tracker-init) - (s2-0 (-> *lightning-spec-id-table* 21)) - (s1-0 0) - (s0-0 lightning-probe-callback) - ) - (set! sv-48 self) - (set! sv-64 vector<-cspace!) - (set! sv-80 (new 'stack-no-clear 'vector)) - (let ((a1-8 (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1))))) - (set! sv-96 (sv-64 sv-80 a1-8)) - ) - (set! sv-112 vector<-cspace!) - (set! sv-128 (new 'stack-no-clear 'vector)) - (let* ((a1-10 (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) - (t3-0 (sv-112 sv-128 a1-10)) - ) - ((the-as (function object object object object object object object object none) s5-1) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-48 - sv-96 - t3-0 - ) - ) - ) - (-> gp-2 ppointer) - ) - ) - ) + (let ((v1-26 (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 21) + 0 + lightning-probe-callback + self + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + ) + (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> self node-list data (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + ) + :to self + ) + ) + ) (when v1-26 (set! (-> (the-as lightning-tracker (-> v1-26 0)) user-time 0) 0) 0 diff --git a/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc b/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc index 60fecdffec..a4c8e2009b 100644 --- a/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/intro/intro-scenes_REF.gc @@ -3620,43 +3620,18 @@ "particleman" 'eval ,(lambda () - (local-vars (sv-48 symbol) (sv-64 symbol) (sv-80 vector)) (with-pp - (let ((gp-0 (the-as target (command-get-process "particleman" *target*))) - (s5-0 (get-process *default-dead-pool* lightning-tracker #x4000)) - ) - (when s5-0 - (let ((t9-2 (method-of-type lightning-tracker activate))) - (t9-2 - (the-as lightning-tracker s5-0) - pp - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s4-0 run-function-in-process) - (s3-0 s5-0) - (s2-0 lightning-tracker-init) - (s1-0 (-> *lightning-spec-id-table* 1)) - (s0-0 30) - ) - (set! sv-48 (the-as symbol #f)) - (set! sv-64 (the-as symbol #f)) - (set! sv-80 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 5))) - (let ((t3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 6)))) - ((the-as (function object object object object object object object object none) s4-0) - s3-0 - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - sv-80 - t3-0 - ) - ) - ) - (-> s5-0 ppointer) + (let ((gp-0 (the-as target (command-get-process "particleman" *target*)))) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 1) + 30 + (the-as symbol #f) + (the-as symbol #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 5)) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> gp-0 node-list data 6)) + :to pp ) ) ) diff --git a/test/decompiler/reference/jak2/levels/mountain/mountain-obs_REF.gc b/test/decompiler/reference/jak2/levels/mountain/mountain-obs_REF.gc index 04f08a790a..76bfdc8262 100644 --- a/test/decompiler/reference/jak2/levels/mountain/mountain-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/mountain/mountain-obs_REF.gc @@ -464,7 +464,6 @@ ;; definition for method 26 of type mtn-dice ;; INFO: Used lq/sq (defmethod mtn-dice-method-26 ((this mtn-dice) (arg0 process-focusable) (arg1 touching-shapes-entry)) - (local-vars (sv-96 vector) (sv-112 vector) (sv-128 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -479,92 +478,89 @@ (f30-0 -0.71) (s2-0 (the-as touching-prims-entry #f)) ) - (let ((s0-0 vector-z-quaternion!)) - (set! sv-96 s3-1) - (let ((a1-3 (get-quat arg0 2))) - (s0-0 sv-96 a1-3) - ) - ) + (vector-z-quaternion! s3-1 (get-quat arg0 2)) (let ((s1-1 (-> arg1 head))) (while s1-1 (let ((v1-4 (get-touched-prim s1-1 (-> this root) arg1))) (-> v1-4 cshape) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! (-> sv-128 quad) (the-as uint128 0)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (let ((s0-1 (new 'stack-no-clear 'vector))) - (new 'stack-no-clear 'vector) - (when (>= (-> this face-status (-> v1-4 prim-id)) 0) - (set! (-> sv-128 quad) (-> this face-matrix (-> v1-4 prim-id) quad 0)) - (set! (-> sv-128 w) (- (vector-dot (-> this face-matrix (-> v1-4 prim-id) trans) sv-128))) - (set! (-> sv-112 quad) (-> this face-matrix (-> v1-4 prim-id) trans quad)) - (let ((f0-4 (vector4-dot sv-128 (-> s4-0 trans))) - (f28-0 (vector-dot sv-128 s3-1)) - ) - (when (< f0-4 0.0) - (let ((a2-2 s0-1)) - (let ((a0-28 sv-112)) - (let ((a1-18 sv-128)) - (let ((a3-1 -8192.0)) - (.mov vf7 a3-1) - ) - (.lvf vf5 (&-> a1-18 quad)) - ) - (.lvf vf4 (&-> a0-28 quad)) + (let ((sv-128 (new 'stack-no-clear 'vector))) + (set! (-> sv-128 quad) (the-as uint128 0)) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (s0-1 (new 'stack-no-clear 'vector)) + ) + (new 'stack-no-clear 'vector) + (when (>= (-> this face-status (-> v1-4 prim-id)) 0) + (set! (-> sv-128 quad) (-> this face-matrix (-> v1-4 prim-id) quad 0)) + (set! (-> sv-128 w) (- (vector-dot (-> this face-matrix (-> v1-4 prim-id) trans) sv-128))) + (set! (-> sv-112 quad) (-> this face-matrix (-> v1-4 prim-id) trans quad)) + (let ((f0-4 (vector4-dot sv-128 (-> s4-0 trans))) + (f28-0 (vector-dot sv-128 s3-1)) ) + (when (< f0-4 0.0) + (let ((a2-2 s0-1)) + (let ((a0-28 sv-112)) + (let ((a1-18 sv-128)) + (let ((a3-1 -8192.0)) + (.mov vf7 a3-1) + ) + (.lvf vf5 (&-> a1-18 quad)) + ) + (.lvf vf4 (&-> a0-28 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a2-2 quad) vf6) + ) + (let* ((a0-30 (the int (/ (-> s0-1 x) METER_LENGTH))) + (a1-20 (the int (/ (-> s0-1 z) METER_LENGTH))) + (a0-32 (/ (- *dice-offset-x* a0-30) -4)) + ) + (if (not (logtest? (-> *dice-blocked-array* (/ (- *dice-offset-z* a1-20) -4)) (ash 1 (- 15 a0-32)))) + (set! f28-0 -2.0) + ) + ) + (let ((a0-40 sv-112)) + (let ((v1-8 (-> this face-matrix (-> v1-4 prim-id) trans))) + (let ((a1-26 sv-128)) + (let ((a2-10 16384.0)) + (.mov vf7 a2-10) + ) + (.lvf vf5 (&-> a1-26 quad)) + ) + (.lvf vf4 (&-> v1-8 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a0-40 quad) vf6) + ) + (vector-negate-in-place! sv-128) + (set! f28-0 (- f28-0)) + (if (!= (-> this free-face) 5) + (set! f28-0 1.0) + ) + ) + (let ((v1-13 s0-1)) + (let ((a0-44 -8192.0)) + (.mov vf7 a0-44) + ) + (.lvf vf5 (&-> sv-128 quad)) + (.lvf vf4 (&-> sv-112 quad)) (.add.x.vf.w vf6 vf0 vf0) (.mul.x.vf.xyz acc vf5 vf7) (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a2-2 quad) vf6) + (.svf (&-> v1-13 quad) vf6) ) - (let* ((a0-30 (the int (/ (-> s0-1 x) METER_LENGTH))) - (a1-20 (the int (/ (-> s0-1 z) METER_LENGTH))) - (a0-32 (/ (- *dice-offset-x* a0-30) -4)) + (let* ((v1-15 (the int (/ (-> s0-1 x) METER_LENGTH))) + (a0-48 (the int (/ (-> s0-1 z) METER_LENGTH))) + (v1-17 (/ (- *dice-offset-x* v1-15) -4)) + (a1-31 (/ (- *dice-offset-z* a0-48) -4)) ) - (if (not (logtest? (-> *dice-blocked-array* (/ (- *dice-offset-z* a1-20) -4)) (ash 1 (- 15 a0-32)))) - (set! f28-0 -2.0) - ) - ) - (let ((a0-40 sv-112)) - (let ((v1-8 (-> this face-matrix (-> v1-4 prim-id) trans))) - (let ((a1-26 sv-128)) - (let ((a2-10 16384.0)) - (.mov vf7 a2-10) - ) - (.lvf vf5 (&-> a1-26 quad)) - ) - (.lvf vf4 (&-> v1-8 quad)) + (when (and (< f28-0 f30-0) (not (logtest? (-> *dice-world-array* a1-31) (ash 1 (- 15 v1-17))))) + (set! f30-0 f28-0) + (set! s2-0 s1-1) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a0-40 quad) vf6) - ) - (vector-negate-in-place! sv-128) - (set! f28-0 (- f28-0)) - (if (!= (-> this free-face) 5) - (set! f28-0 1.0) - ) - ) - (let ((v1-13 s0-1)) - (let ((a0-44 -8192.0)) - (.mov vf7 a0-44) - ) - (.lvf vf5 (&-> sv-128 quad)) - (.lvf vf4 (&-> sv-112 quad)) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> v1-13 quad) vf6) - ) - (let* ((v1-15 (the int (/ (-> s0-1 x) METER_LENGTH))) - (a0-48 (the int (/ (-> s0-1 z) METER_LENGTH))) - (v1-17 (/ (- *dice-offset-x* v1-15) -4)) - (a1-31 (/ (- *dice-offset-z* a0-48) -4)) - ) - (when (and (< f28-0 f30-0) (not (logtest? (-> *dice-world-array* a1-31) (ash 1 (- 15 v1-17))))) - (set! f30-0 f28-0) - (set! s2-0 s1-1) ) ) ) @@ -766,7 +762,6 @@ (defstate idle (mtn-dice) :virtual #t :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) - (local-vars (sv-192 vector)) (cond ((= message 'print-info) (dotimes (gp-1 6) @@ -832,14 +827,9 @@ 409.6 ) (when s4-1 - (let ((s0-1 (new 'stack-no-clear 'vector))) - (set! sv-192 *dice-last-safe-position*) - (let* ((v1-42 (get-trans s4-1 0)) - (s0-2 (vector-! s0-1 sv-192 v1-42)) - ) - (vector-float*! s0-2 s0-2 0.5) - (send-event proc 'shove (-> block param 0) (static-attack-info ((id (new-attack-id)) (vector s0-2)))) - ) + (let ((s0-2 (vector-! (new 'stack-no-clear 'vector) *dice-last-safe-position* (get-trans s4-1 0)))) + (vector-float*! s0-2 s0-2 0.5) + (send-event proc 'shove (-> block param 0) (static-attack-info ((id (new-attack-id)) (vector s0-2)))) ) ) ) @@ -1076,19 +1066,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun dice-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) - (local-vars - (sv-544 int) - (sv-560 vector) - (sv-576 vector) - (sv-592 vector) - (sv-608 vector) - (sv-624 vector) - (sv-640 vector) - (sv-656 matrix) - (sv-672 matrix) - (sv-688 vector) - (sv-704 vector) - ) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1119,25 +1096,24 @@ (set! (-> v1-9 quad 2) a2-1) (set! (-> v1-9 trans quad) a3-1) ) - (let ((v1-12 (the int (+ 2.0 (/ (-> s1-0 trans x) METER_LENGTH)))) - (a0-14 (the int (+ 2.0 (/ (-> s1-0 trans z) METER_LENGTH)))) - ) - (set! sv-544 (/ (- *dice-offset-x* v1-12) -4)) - (let ((s0-0 (/ (- *dice-offset-z* a0-14) -4))) - (when (and (= (-> gp-0 face-status s2-0) -1) (= (-> gp-0 active) 1)) - (when (and (= (-> gp-0 active) 1) (not (logtest? (-> *dice-blocked-array* s0-0) (ash 1 (- 15 sv-544))))) - (when (> *dice-back-way-num* 0) - (set! (-> *dice-last-safe-position* quad) (-> *dice-back-way* (+ *dice-back-way-num* -1) quad)) - (+! (-> *dice-last-safe-position* y) 8192.0) - ) - (when (not (dice-wrong-way?)) - (set! (-> *dice-back-way* *dice-back-way-num* quad) (-> s1-0 trans quad)) - (set! *dice-back-way-num* (+ *dice-back-way-num* 1)) - ) - (set! (-> *dice-blocked-array* s0-0) - (the-as uint (logior (ash 1 (- 15 sv-544)) (-> *dice-blocked-array* s0-0))) - ) + (let* ((v1-12 (the int (+ 2.0 (/ (-> s1-0 trans x) METER_LENGTH)))) + (a0-14 (the int (+ 2.0 (/ (-> s1-0 trans z) METER_LENGTH)))) + (sv-544 (/ (- *dice-offset-x* v1-12) -4)) + (s0-0 (/ (- *dice-offset-z* a0-14) -4)) + ) + (when (and (= (-> gp-0 face-status s2-0) -1) (= (-> gp-0 active) 1)) + (when (and (= (-> gp-0 active) 1) (not (logtest? (-> *dice-blocked-array* s0-0) (ash 1 (- 15 sv-544))))) + (when (> *dice-back-way-num* 0) + (set! (-> *dice-last-safe-position* quad) (-> *dice-back-way* (+ *dice-back-way-num* -1) quad)) + (+! (-> *dice-last-safe-position* y) 8192.0) ) + (when (not (dice-wrong-way?)) + (set! (-> *dice-back-way* *dice-back-way-num* quad) (-> s1-0 trans quad)) + (set! *dice-back-way-num* (+ *dice-back-way-num* 1)) + ) + (set! (-> *dice-blocked-array* s0-0) + (the-as uint (logior (ash 1 (- 15 sv-544)) (-> *dice-blocked-array* s0-0))) + ) ) ) ) @@ -1176,61 +1152,66 @@ ) ) (when s0-1 - (set! sv-560 (new 'stack-no-clear 'vector)) - (set! sv-576 (new 'stack-no-clear 'vector)) - (set! sv-608 (new 'stack-no-clear 'vector)) - (set! sv-592 (new 'stack-no-clear 'vector)) - (set! sv-672 (new 'stack-no-clear 'matrix)) - (set! sv-640 (new 'stack-no-clear 'vector)) - (let ((a1-15 sv-560)) - (let ((v1-79 (-> s1-0 trans))) - (let ((a0-50 (-> s1-0 vector))) - (let ((a2-7 8192.0)) - (.mov vf7 a2-7) + (let ((sv-560 (new 'stack-no-clear 'vector))) + (let ((sv-576 (new 'stack-no-clear 'vector)) + (sv-608 (new 'stack-no-clear 'vector)) + (sv-592 (new 'stack-no-clear 'vector)) + (sv-672 (new 'stack-no-clear 'matrix)) + (sv-640 (new 'stack-no-clear 'vector)) ) - (.lvf vf5 (&-> a0-50 0 quad)) + (let ((a1-15 sv-560)) + (let ((v1-79 (-> s1-0 trans))) + (let ((a0-50 (-> s1-0 vector))) + (let ((a2-7 8192.0)) + (.mov vf7 a2-7) + ) + (.lvf vf5 (&-> a0-50 0 quad)) + ) + (.lvf vf4 (&-> v1-79 quad)) + ) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-15 quad) vf6) + ) + (set! (-> sv-640 quad) (-> sv-560 quad)) + (set! (-> sv-576 quad) (-> sv-560 quad)) + (+! (-> sv-576 x) 8192.0) + (set! (-> sv-608 quad) (-> sv-560 quad)) + (+! (-> sv-608 z) 8192.0) + (set! (-> sv-560 y) (get-ripple-height s0-1 sv-560)) + (set! (-> sv-576 y) (get-ripple-height s0-1 sv-576)) + (set! (-> sv-608 y) (get-ripple-height s0-1 sv-608)) + (vector-! sv-576 sv-576 sv-560) + (vector-! sv-608 sv-608 sv-560) + (set! (-> sv-576 y) (/ (-> sv-576 y) 2)) + (set! (-> sv-608 y) (/ (-> sv-608 y) 2)) + (set! (-> sv-576 w) 0.0) + (set! (-> sv-592 w) 0.0) + (set! (-> sv-608 w) 0.0) + (vector-normalize! sv-576 1.0) + (vector-normalize! sv-608 1.0) + (vector-cross! sv-592 sv-608 sv-576) + (vector-normalize! sv-592 1.0) + (vector-cross! sv-608 sv-576 sv-592) + (vector-normalize! sv-608 1.0) + (matrix-identity! sv-672) + (set! (-> sv-672 vector 0 quad) (-> sv-576 quad)) + (set! (-> sv-672 vector 1 quad) (-> sv-592 quad)) + (set! (-> sv-672 vector 2 quad) (-> sv-608 quad)) + (let ((sv-624 (new 'stack-no-clear 'vector)) + (sv-656 (new 'stack-no-clear 'matrix)) + (sv-688 (new 'stack-no-clear 'vector)) + ) + (vector-negate! sv-624 sv-640) + (matrix-translate! sv-656 sv-624) + (matrix<-trans sv-672 sv-640) + (matrix*! (the-as matrix sv-688) sv-656 sv-672) + (matrix*! s1-0 s1-0 (the-as matrix sv-688)) ) - (.lvf vf4 (&-> v1-79 quad)) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-15 quad) vf6) + (+! (-> s1-0 trans y) (* 0.5 (- (-> sv-560 y) (-> s0-1 water-height)))) ) - (set! (-> sv-640 quad) (-> sv-560 quad)) - (set! (-> sv-576 quad) (-> sv-560 quad)) - (+! (-> sv-576 x) 8192.0) - (set! (-> sv-608 quad) (-> sv-560 quad)) - (+! (-> sv-608 z) 8192.0) - (set! (-> sv-560 y) (get-ripple-height s0-1 sv-560)) - (set! (-> sv-576 y) (get-ripple-height s0-1 sv-576)) - (set! (-> sv-608 y) (get-ripple-height s0-1 sv-608)) - (vector-! sv-576 sv-576 sv-560) - (vector-! sv-608 sv-608 sv-560) - (set! (-> sv-576 y) (/ (-> sv-576 y) 2)) - (set! (-> sv-608 y) (/ (-> sv-608 y) 2)) - (set! (-> sv-576 w) 0.0) - (set! (-> sv-592 w) 0.0) - (set! (-> sv-608 w) 0.0) - (vector-normalize! sv-576 1.0) - (vector-normalize! sv-608 1.0) - (vector-cross! sv-592 sv-608 sv-576) - (vector-normalize! sv-592 1.0) - (vector-cross! sv-608 sv-576 sv-592) - (vector-normalize! sv-608 1.0) - (matrix-identity! sv-672) - (set! (-> sv-672 vector 0 quad) (-> sv-576 quad)) - (set! (-> sv-672 vector 1 quad) (-> sv-592 quad)) - (set! (-> sv-672 vector 2 quad) (-> sv-608 quad)) - (set! sv-624 (new 'stack-no-clear 'vector)) - (set! sv-656 (new 'stack-no-clear 'matrix)) - (set! sv-688 (new 'stack-no-clear 'vector)) - (vector-negate! sv-624 sv-640) - (matrix-translate! sv-656 sv-624) - (matrix<-trans sv-672 sv-640) - (matrix*! (the-as matrix sv-688) sv-656 sv-672) - (matrix*! s1-0 s1-0 (the-as matrix sv-688)) - (+! (-> s1-0 trans y) (* 0.5 (- (-> sv-560 y) (-> s0-1 water-height)))) (+! (-> s1-0 trans y) 8192.0) (set! (-> s4-0 x) (fmin (-> s4-0 x) (-> s1-0 trans x))) (set! (-> s4-0 y) (fmin (-> s4-0 y) (-> s1-0 trans y))) @@ -1243,31 +1224,25 @@ ) (let ((s0-2 (new 'stack-no-clear 'vector))) (set! (-> s0-2 quad) (-> s1-0 vector 0 quad)) - (set! sv-704 (new 'stack-no-clear 'vector)) - (let ((v1-125 (-> s1-0 trans quad))) - (set! (-> sv-704 quad) v1-125) - ) - (let ((a1-36 sv-704)) - (let ((v1-126 sv-704)) - (let ((a0-81 s0-2)) - (let ((a2-11 8192.0)) - (.mov vf7 a2-11) + (let ((sv-704 (new 'stack-no-clear 'vector))) + (set! (-> sv-704 quad) (-> s1-0 trans quad)) + (let ((a1-36 sv-704)) + (let ((v1-126 sv-704)) + (let ((a0-81 s0-2)) + (let ((a2-11 8192.0)) + (.mov vf7 a2-11) + ) + (.lvf vf5 (&-> a0-81 quad)) ) - (.lvf vf5 (&-> a0-81 quad)) + (.lvf vf4 (&-> v1-126 quad)) ) - (.lvf vf4 (&-> v1-126 quad)) + (.add.x.vf.w vf6 vf0 vf0) + (.mul.x.vf.xyz acc vf5 vf7) + (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) + (.svf (&-> a1-36 quad) vf6) ) - (.add.x.vf.w vf6 vf0 vf0) - (.mul.x.vf.xyz acc vf5 vf7) - (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) - (.svf (&-> a1-36 quad) vf6) - ) - (let ((f30-0 0.0) - (s1-1 (new 'stack-no-clear 'vector)) - (v0-14 (camera-pos)) - ) (cond - ((< f30-0 (vector-dot s0-2 (vector-! s1-1 sv-704 v0-14))) + ((< 0.0 (vector-dot s0-2 (vector-! (new 'stack-no-clear 'vector) sv-704 (camera-pos)))) (let ((v1-129 s2-0)) (cond ((zero? v1-129) @@ -2426,7 +2401,6 @@ #f ) :post (behavior () - (local-vars (sv-16 vector-array) (sv-20 vector) (sv-48 float) (sv-52 symbol)) (transform-post) (if (= (-> *setting-control* user-current music) 'mountain) (seek! (-> self volume) 0.6 (* 0.2 (seconds-per-frame))) @@ -2441,53 +2415,57 @@ (sound-group sfx) (-> self draw origin) ) - (set! sv-16 (-> self rock-data)) - (set! sv-20 (target-pos 0)) - (dotimes (gp-0 (-> self node-list length)) - (let* ((a1-3 (-> self node-list data gp-0)) - (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) a1-3)) - ) - (+! (-> s5-0 y) -4096.0) - (set! sv-48 (* (- (-> s5-0 y) (-> sv-16 data gp-0 x)) (-> self clock frames-per-second))) - (set! sv-52 (the-as symbol #f)) - (when (and (< (-> sv-16 data gp-0 y) -24576.0) (< (* 0.45 (-> sv-16 data gp-0 y)) sv-48)) - (set! sv-52 #t) - (let ((f30-0 (vector-vector-distance sv-20 s5-0))) - (when (< f30-0 204800.0) - (part-tracker-spawn :to *entity-pool* :group group-aval-rock-hit :mat-joint s5-0) - (when (= (-> sv-16 data gp-0 w) 0.0) - (sound-play-by-name - (static-sound-name "mtn-boulder") - (new-sound-id) - (the int - (* 1024.0 (* (lerp-scale 0.3 1.0 (fabs (- (-> sv-16 data gp-0 y) sv-48)) 0.0 40960.0) (-> self volume))) - ) - 0 - 0 - (sound-group sfx) - s5-0 - ) - (set! (-> sv-16 data gp-0 w) 20.0) - ) - ) - (when (< f30-0 122880.0) - (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (- 1.0 (/ f30-0 (meters 30))))) (seconds 0.2)) - (activate! - *camera-smush-control* - (lerp-scale 1638.4 0.0 f30-0 0.0 122880.0) - 15 - 75 - 1.0 - 0.9 - (-> *display* camera-clock) - ) - ) - ) + (let ((sv-16 (-> self rock-data)) + (sv-20 (target-pos 0)) ) - (set! (-> sv-16 data gp-0 y) sv-48) - (set! (-> sv-16 data gp-0 x) (-> s5-0 y)) + (dotimes (gp-0 (-> self node-list length)) + (let* ((a1-3 (-> self node-list data gp-0)) + (s5-0 (vector<-cspace! (new 'stack-no-clear 'vector) a1-3)) + ) + (+! (-> s5-0 y) -4096.0) + (let ((sv-48 (* (- (-> s5-0 y) (-> sv-16 data gp-0 x)) (-> self clock frames-per-second)))) + (let ((sv-52 (the-as symbol #f))) + (when (and (< (-> sv-16 data gp-0 y) -24576.0) (< (* 0.45 (-> sv-16 data gp-0 y)) sv-48)) + (set! sv-52 #t) + (let ((f30-0 (vector-vector-distance sv-20 s5-0))) + (when (< f30-0 204800.0) + (part-tracker-spawn :to *entity-pool* :group group-aval-rock-hit :mat-joint s5-0) + (when (= (-> sv-16 data gp-0 w) 0.0) + (sound-play-by-name + (static-sound-name "mtn-boulder") + (new-sound-id) + (the int + (* 1024.0 (* (lerp-scale 0.3 1.0 (fabs (- (-> sv-16 data gp-0 y) sv-48)) 0.0 40960.0) (-> self volume))) + ) + 0 + 0 + (sound-group sfx) + s5-0 + ) + (set! (-> sv-16 data gp-0 w) 20.0) + ) + ) + (when (< f30-0 122880.0) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 (the int (* 255.0 (- 1.0 (/ f30-0 (meters 30))))) (seconds 0.2)) + (activate! + *camera-smush-control* + (lerp-scale 1638.4 0.0 f30-0 0.0 122880.0) + 15 + 75 + 1.0 + 0.9 + (-> *display* camera-clock) + ) + ) + ) + ) + ) + (set! (-> sv-16 data gp-0 y) sv-48) + ) + (set! (-> sv-16 data gp-0 x) (-> s5-0 y)) + ) + (seek! (-> sv-16 data gp-0 w) 0.0 1.0) ) - (seek! (-> sv-16 data gp-0 w) 0.0 1.0) ) ) ) @@ -2502,7 +2480,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-sphere) (sv-48 collide-shape-prim-sphere) (sv-64 vector)) (stack-size-set! (-> this main-thread) 512) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (set! (-> s4-0 penetrated-by) (penetrate)) @@ -2570,19 +2547,22 @@ (s0-0 (car s1-0)) ) (while (not (null? s1-0)) - (set! sv-16 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0))) - (set! sv-48 sv-16) - (set! (-> sv-48 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> sv-48 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> sv-48 prim-core action) (-> s3-0 prim-core action)) - (set! (-> sv-48 transform-index) (command-get-int (car s0-0) 0)) - (set! (-> sv-48 prim-id) (the-as uint s2-0)) - (+! s2-0 1) - (set! sv-64 (-> sv-16 local-sphere)) - (set! (-> sv-64 x) 0.0) - (set! (-> sv-64 y) 0.0) - (set! (-> sv-64 z) 0.0) - (set! (-> sv-64 w) (command-get-float (car (cdr s0-0)) 0.0)) + (let ((sv-16 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (let ((sv-48 sv-16)) + (set! (-> sv-48 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> sv-48 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> sv-48 prim-core action) (-> s3-0 prim-core action)) + (set! (-> sv-48 transform-index) (command-get-int (car s0-0) 0)) + (set! (-> sv-48 prim-id) (the-as uint s2-0)) + ) + (+! s2-0 1) + (let ((sv-64 (-> sv-16 local-sphere))) + (set! (-> sv-64 x) 0.0) + (set! (-> sv-64 y) 0.0) + (set! (-> sv-64 z) 0.0) + (set! (-> sv-64 w) (command-get-float (car (cdr s0-0)) 0.0)) + ) + ) (set! s1-0 (cdr s1-0)) (set! s0-0 (car s1-0)) ) diff --git a/test/decompiler/reference/jak2/levels/mountain/mountain-scenes_REF.gc b/test/decompiler/reference/jak2/levels/mountain/mountain-scenes_REF.gc index 3fc00c4865..4bf2907787 100644 --- a/test/decompiler/reference/jak2/levels/mountain/mountain-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/mountain/mountain-scenes_REF.gc @@ -3326,7 +3326,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((cshape (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 3) 0))) (set! (-> cshape total-prims) (the-as uint 4)) @@ -3341,23 +3340,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((_prim-mesh sv-16)) - (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) - (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) @@ -3421,7 +3415,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((cshape (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 17) 0))) (set! (-> cshape total-prims) (the-as uint 18)) @@ -3454,23 +3447,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((_prim-mesh sv-16)) - (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) - (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) @@ -3534,7 +3522,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((cshape (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((prim-group (new 'process 'collide-shape-prim-group cshape (the-as uint 24) 0))) (set! (-> cshape total-prims) (the-as uint 25)) @@ -3574,23 +3561,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((_prim-mesh sv-16)) + (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) + (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((_prim-mesh sv-16)) - (set! (-> _prim-mesh prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> _prim-mesh prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> _prim-mesh prim-core action) (-> prim-group prim-core action)) - (set! (-> _prim-mesh transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) diff --git a/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc b/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc index 9b09c95cd2..098b72abb2 100644 --- a/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc +++ b/test/decompiler/reference/jak2/levels/mountain/rhino_REF.gc @@ -625,20 +625,6 @@ (defmethod general-event-handler ((this rhino) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) "Handles various events for the enemy @TODO - unsure if there is a pattern for the events and this should have a more specific name" - (local-vars - (sv-96 int) - (sv-112 symbol) - (sv-128 symbol) - (sv-144 symbol) - (sv-160 vector) - (sv-176 matrix) - (sv-192 int) - (sv-208 symbol) - (sv-224 symbol) - (sv-240 symbol) - (sv-256 vector) - (sv-272 matrix) - ) (case arg2 (('charge) (if (-> this wall) @@ -714,78 +700,24 @@ ) (('event-slide-poof) (let ((s5-2 (-> arg3 param 1))) - (cond - ((= (-> this root ground-pat material) (pat-material grass)) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-1 - (let ((t9-14 (method-of-type part-tracker activate))) - (t9-14 (the-as part-tracker s4-1) this (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-1 run-function-in-process) - (s2-1 s4-1) - (s1-0 part-tracker-init) - (s0-0 group-rhino-slide-poof-grs) - ) - (set! sv-96 0) - (set! sv-112 (the-as symbol #f)) - (set! sv-128 (the-as symbol #f)) - (set! sv-144 (the-as symbol #f)) - (set! sv-176 *launch-matrix*) - (set! sv-160 (-> sv-176 trans)) - (let ((v1-52 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) quad))) - (set! (-> sv-160 quad) v1-52) - ) - ((the-as (function object object object object object object object object none) s3-1) - s2-1 - s1-0 - s0-0 - sv-96 - sv-112 - sv-128 - sv-144 - sv-176 - ) - ) - (-> s4-1 ppointer) - ) - ) - ) - (else - (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when s4-2 - (let ((t9-18 (method-of-type part-tracker activate))) - (t9-18 (the-as part-tracker s4-2) this (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s2-2 s4-2) - (s1-1 part-tracker-init) - (s0-1 group-rhino-slide-poof-pmt) - ) - (set! sv-192 0) - (set! sv-208 (the-as symbol #f)) - (set! sv-224 (the-as symbol #f)) - (set! sv-240 (the-as symbol #f)) - (set! sv-272 *launch-matrix*) - (set! sv-256 (-> sv-272 trans)) - (let ((v1-64 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) quad))) - (set! (-> sv-256 quad) v1-64) - ) - ((the-as (function object object object object object object object object none) s3-2) - s2-2 - s1-1 - s0-1 - sv-192 - sv-208 - sv-224 - sv-240 - sv-272 - ) - ) - (-> s4-2 ppointer) - ) + (if (= (-> this root ground-pat material) (pat-material grass)) + (part-tracker-spawn + :to this + :group group-rhino-slide-poof-grs + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) + ) + (part-tracker-spawn + :to this + :group group-rhino-slide-poof-pmt + :callback (the-as symbol #f) + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data s5-2)) ) ) - ) ) ) (('interesting) diff --git a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc index 42e951411c..6cfe16f82b 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-extras_REF.gc @@ -127,40 +127,34 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-5 vf1) - (let ((f0-0 v1-5) - (f1-0 409.6) + (cond + ((< v1-5 (square 409.6)) + (go-virtual idle) + ) + ((time-elapsed? (-> self state-time) (seconds 4)) + (go-virtual hatch) + ) + (else + (vector-v++! + (-> self root transv) + (compute-acc-due-to-gravity (the-as collide-shape-moving (-> self root)) (new-stack-vector0) 1.0) ) - (cond - ((< f0-0 (* f1-0 f1-0)) - (go-virtual idle) - ) - ((time-elapsed? (-> self state-time) (seconds 4)) - (go-virtual hatch) - ) - (else - (vector-v++! - (-> self root transv) - (compute-acc-due-to-gravity (the-as collide-shape-moving (-> self root)) (new-stack-vector0) 1.0) - ) - (let ((a2-1 (new 'stack-no-clear 'collide-query))) - (set! (-> a2-1 collide-with) (collide-spec backgnd enemy obstacle hit-by-others-list pusher)) - (set! (-> a2-1 ignore-process0) self) - (set! (-> a2-1 ignore-process1) #f) - (set! (-> a2-1 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) - (set! (-> a2-1 action-mask) (collide-action solid)) - (fill-cache-integrate-and-collide - (the-as collide-shape-moving (-> self root)) - (-> (the-as collide-shape-moving (-> self root)) transv) - a2-1 - (meters 0) - ) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-1 collide-with) (collide-spec backgnd enemy obstacle hit-by-others-list pusher)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide + (the-as collide-shape-moving (-> self root)) + (-> (the-as collide-shape-moving (-> self root)) transv) + a2-1 + (meters 0) ) ) ) ) - (let* ((f0-1 81920.0) - (f0-3 (* f0-1 f0-1)) - ) + (let ((f0-3 (square 81920.0))) (.lvf vf1 (&-> gp-0 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -169,9 +163,7 @@ (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-27 vf1) (cond - ((and (< f0-3 v1-27) (let* ((f0-4 81920.0) - (f0-6 (* f0-4 f0-4)) - ) + ((and (< f0-3 v1-27) (let ((f0-6 (square 81920.0))) (.lvf vf1 (&-> (-> self root transv) quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -296,11 +288,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod spawn-shell-particles ((this metalkor-shot)) "TODO - confirm" - (local-vars - (sv-224 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-240 vector) - (sv-256 entity-actor) - ) (let* ((s4-0 (-> this root)) (v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this tail-pos) (-> s4-0 trans)) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) @@ -365,37 +352,17 @@ (matrix->quaternion gp-1 s2-0) ) (sound-play "nboss-shoot-hit") - (let* ((s1-1 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 - (when s1-1 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s1-1) *default-pool* (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-0 s1-1) - ) - (set! sv-224 manipy-init) - (set! sv-240 s4-2) - (set! sv-256 (-> this entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-0 - sv-224 - sv-240 - sv-256 - t0-2 - t1-2 - t2-2 - ) - ) - ) - (-> s1-1 ppointer) - ) - ) - ) + (let ((s2-2 (process-spawn + manipy + :init manipy-init + s4-2 + (-> this entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + ) + ) + ) (when s2-2 (send-event (ppointer->process s2-2) 'anim-mode 'play1) (send-event (ppointer->process s2-2) 'anim "idle") @@ -525,7 +492,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior metalkor-update-ik metalkor-legs () - (local-vars (sv-736 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -628,22 +594,15 @@ ) ) ((method-of-type cam-float-seeker update!) (-> self foot-locks s4-0 lock) 0.0) - (cond - ((-> self foot-locks s4-0 initialized) - (let ((s2-1 vector-lerp!) - (s1-0 s3-0) - (s0-0 s3-0) - ) - (set! sv-736 (the-as vector (+ (the-as uint (-> self foot-locks 0 old-position)) (* s4-0 64)))) - (let ((a3-6 (parameter-ease-sin-clamp (-> self foot-locks s4-0 lock value)))) - (s2-1 s1-0 s0-0 sv-736 a3-6) - ) - ) - ) - (else + (if (-> self foot-locks s4-0 initialized) + (vector-lerp! + s3-0 + s3-0 + (the-as vector (+ (the-as uint (-> self foot-locks 0 old-position)) (* s4-0 64))) + (parameter-ease-sin-clamp (-> self foot-locks s4-0 lock value)) + ) (set! (-> self foot-locks s4-0 initialized) #t) ) - ) (handle-copy! (-> self joint-ik s4-0) s3-0) (set! (-> (the-as (pointer uint128) (+ (the-as uint (-> self foot-locks 0 old-position)) (* s4-0 64)))) (-> s3-0 quad) @@ -1188,11 +1147,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-26 vf1) - (let ((f0-7 v1-26) - (f1-5 409.6) - ) - (< f0-7 (* f1-5 f1-5)) - ) + (< v1-26 (square 409.6)) ) ) (+! s3-0 1) @@ -2217,49 +2172,17 @@ (process-spawn metalkor-rays (-> self root trans) (-> self root quat) :to self) ) :trans (behavior () - (local-vars (sv-384 symbol) (sv-400 symbol) (sv-416 vector) (sv-432 matrix)) (let ((f30-0 (ja-aframe-num 0))) (ja :num! (seek!)) (when (and (< f30-0 40.0) (>= (ja-aframe-num 0) 40.0)) (send-event (ppointer->process (-> self parent)) 'exploding) (activate! *camera-smush-control* 1638.4 37 210 1.0 0.995 (-> self clock)) - (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-0 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 - (the-as part-tracker gp-0) - *entity-pool* - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-0) - (s3-0 part-tracker-init) - (s2-0 group-metalkor-explode) - (s1-0 0) - (s0-0 #f) - ) - (set! sv-384 (the-as symbol #f)) - (set! sv-400 (the-as symbol #f)) - (set! sv-432 *launch-matrix*) - (set! sv-416 (-> sv-432 trans)) - (let ((v1-27 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node metalkor-explode-lod0-jg head)) quad))) - (set! (-> sv-416 quad) v1-27) - ) - ((the-as (function object object object object object object object object none) s5-0) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-384 - sv-400 - sv-432 - ) - ) - (-> gp-0 ppointer) - ) + (part-tracker-spawn + :to *entity-pool* + :group group-metalkor-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node metalkor-explode-lod0-jg head)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc index 69ce22a9bd..15ea9eb5f0 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-setup_REF.gc @@ -1292,85 +1292,66 @@ ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f2, f5] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f1, f3, f6] (defbehavior metalkor-egg-reaction metalkor-egg ((arg0 control-info) (arg1 collide-query) (arg2 vector) (arg3 vector)) - (local-vars (v1-11 float) (f1-1 float) (sv-16 vector) (sv-32 float) (sv-48 float) (sv-64 float)) + (local-vars (v1-11 float) (f1-1 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) (vf2 :class vf) ) (init-vf0-vector) - (set! sv-16 arg3) - (cshape-reaction-update-state arg0 arg1 sv-16) - (let ((s5-0 (-> arg0 process))) - (cond - ((time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.05)) - (let ((t9-1 vector--float*!) - (a0-3 arg2) - (a1-1 sv-16) - (a2-2 (-> arg0 surface-normal)) - (f0-0 1.01) - ) - (let* ((v1-4 (-> arg0 surface-normal)) - (f1-0 (-> sv-16 x)) - (f2-0 (-> sv-16 y)) - (f3-0 (-> sv-16 z)) - (f4-0 (-> v1-4 x)) - (f5-0 (-> v1-4 y)) - (f6-0 (-> v1-4 z)) - ) - (.mula.s f1-0 f4-0) - (.madda.s f2-0 f5-0) - (.madd.s f1-1 f3-0 f6-0) - ) - (t9-1 a0-3 a1-1 a2-2 (* f0-0 f1-1)) - ) - (let ((s3-0 arg2) - (s2-0 arg2) - (s1-0 lerp-scale) - (s0-0 0.94) - ) - (set! sv-32 (the-as float 1.0)) - (set! sv-48 (-> arg0 surface-normal y)) - (set! sv-64 (cos 5461.3335)) - (let ((t0-0 (cos 16384.0))) - (vector-float*! s3-0 s2-0 (s1-0 s0-0 sv-32 sv-48 sv-64 t0-0)) - ) - ) - ) - (else - (vector--float*! - arg2 - sv-16 - (-> arg0 surface-normal) - (* (vector-dot sv-16 (-> arg0 surface-normal)) (rand-vu-float-range 1.2 1.4)) - ) - ) - ) - (.lvf vf1 (&-> arg2 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-11 vf1) - (let ((f0-10 v1-11) - (f1-3 409.6) - ) + (let ((sv-16 arg3)) + (cshape-reaction-update-state arg0 arg1 sv-16) + (let ((s5-0 (-> arg0 process))) (cond - ((< f0-10 (* f1-3 f1-3)) - (set! (-> arg2 quad) (the-as uint128 0)) - 0 - ) - ((let ((f1-6 4096.0)) - (and (< (* f1-6 f1-6) f0-10) (time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.2))) + ((time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.05)) + (let ((t9-1 vector--float*!) + (a0-3 arg2) + (a1-1 sv-16) + (a2-2 (-> arg0 surface-normal)) + (f0-0 1.01) + ) + (let* ((v1-4 (-> arg0 surface-normal))) + (set! f1-1 (vector-dot sv-16 v1-4)) + ) + (t9-1 a0-3 a1-1 a2-2 (* f0-0 f1-1)) + ) + (vector-float*! + arg2 + arg2 + (lerp-scale 0.94 (the-as float 1.0) (-> arg0 surface-normal y) (cos 5461.3335) (cos 16384.0)) ) - (vector-float*! arg2 arg2 (/ 4096.0 (sqrtf f0-10))) ) + (else + (vector--float*! + arg2 + sv-16 + (-> arg0 surface-normal) + (* (vector-dot sv-16 (-> arg0 surface-normal)) (rand-vu-float-range 1.2 1.4)) + ) + ) ) + (.lvf vf1 (&-> arg2 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-11 vf1) + (let ((f0-10 v1-11)) + (cond + ((< f0-10 (square 409.6)) + (set! (-> arg2 quad) (the-as uint128 0)) + 0 + ) + ((and (< (square 4096.0) f0-10) (time-elapsed? (-> (the-as metalkor-egg s5-0) sticky-time) (seconds 0.2))) + (vector-float*! arg2 arg2 (/ 4096.0 (sqrtf f0-10))) + ) + ) + ) + (if (< (-> arg0 surface-normal y) 1.0) + (set! (-> (the-as metalkor-egg s5-0) last-hit-normal quad) (-> arg0 surface-normal quad)) + ) ) - (if (< (-> arg0 surface-normal y) 1.0) - (set! (-> (the-as metalkor-egg s5-0) last-hit-normal quad) (-> arg0 surface-normal quad)) - ) ) (-> arg0 status) ) @@ -1945,7 +1926,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) @@ -2035,8 +2015,9 @@ (set! (-> this live-wasps) 0) (set! (-> this flitter-gem-tracker) (the-as handle #f)) (set! (-> this wasp-gem-tracker) (the-as handle #f)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-47 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-47 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-47 (> (-> sv-16 elt-count) 0)) (let ((v1-48 (-> v1-47 0))) (when (>= (-> v1-48 length) 1) diff --git a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc index 5902bbfe61..aac8ecbf12 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc @@ -212,9 +212,9 @@ ;; WARN: Check prologue - tricky store of r0 ;; INFO: Used lq/sq (defun metalkor-get-ring ((arg0 metalkor)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> arg0 entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> arg0 entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint 2) (-> sv-16 elt-count))) (let ((v1-2 (-> v1-1 2))) (if (>= (-> v1-2 length) 1) @@ -1514,10 +1514,7 @@ (matrix->quaternion (-> self root quat) gp-0) (quaternion-normalize! (-> self root quat)) (let ((f0-1 (vector-dot (-> gp-0 vector 1) (new 'static 'vector :y 1.0)))) - (let* ((f1-0 1.0) - (f2-0 f0-1) - (f1-2 (sqrtf (- f1-0 (* f2-0 f2-0)))) - ) + (let ((f1-2 (sqrtf (- 1.0 (square f0-1))))) (vector+float*! (-> self root trans) (-> self hit-ring-trans) (-> self hit-ring-offset) (* 73728.0 f1-2)) ) (+! (-> self root trans y) (* 73728.0 (- 1.0 f0-1))) @@ -1662,16 +1659,12 @@ (* 3072.0 (-> self flying-speed value)) 0.5 ) - (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (-> self hit-ring-trans))) - (f1-1 4096.0) - ) + (let ((f0-4 (vector-vector-distance-squared (-> self root trans) (-> self hit-ring-trans)))) (cond - ((< f0-4 (* f1-1 f1-1)) + ((< f0-4 (square 4096.0)) (go-virtual explode) ) - ((let ((f1-4 40960.0)) - (< f0-4 (* f1-4 f1-4)) - ) + ((< f0-4 (square 40960.0)) (set! (-> self ring-cam-pos target) 1.0) ) ) @@ -1682,13 +1675,9 @@ (set! (-> gp-1 quad) (-> self entity trans quad)) (+! (-> gp-1 y) -61440.0) (vector-seek-3d-smooth! (-> self root trans) gp-1 (* 3072.0 (-> self flying-speed value)) 0.5) - (let ((f0-10 (vector-vector-distance-squared (-> self root trans) gp-1)) - (f1-9 12288.0) - ) - (when (< f0-10 (* f1-9 f1-9)) - (set! (-> self been-to-entity) #t) - (set-setting! 'entity-name "camera-271" 0.0 0) - ) + (when (< (vector-vector-distance-squared (-> self root trans) gp-1) (square 12288.0)) + (set! (-> self been-to-entity) #t) + (set-setting! 'entity-name "camera-271" 0.0 0) ) ) ) @@ -1941,7 +1930,7 @@ ;; WARN: Return type mismatch object vs none. ;; WARN: Function metalkor-walk-the-walk has a return type of none, but the expression builder found a return statement. (defbehavior metalkor-walk-the-walk metalkor ((arg0 float) (arg1 symbol)) - (local-vars (v1-32 float) (v1-38 float) (v1-80 float) (sv-864 vector)) + (local-vars (v1-32 float) (v1-38 float) (v1-80 float)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1958,120 +1947,113 @@ ) (let ((s5-0 (new 'stack-no-clear 'vector))) (set! (-> s5-0 quad) (-> self root trans quad)) - (set! sv-864 (target-pos 0)) - (metalkor-face-to-vector sv-864 546.13336 0.005) - (when (and (nonzero? (-> self previous-flat-travel-long-timer)) - (>= (+ (current-time) (seconds -1.2)) (-> self previous-flat-travel-long-timer)) - ) - (set! (-> self previous-flat-travel-long-timer) 0) - (set! (-> self previous-flat-travel-timer) 0) - 0 - ) - (let ((s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (let ((s3-0 (new 'stack-no-clear 'vector))) - (let ((f30-0 (* 4096.0 (/ (-> self clock time-adjust-ratio) 4))) - (s1-0 #f) - ) - (set! (-> s3-0 quad) (-> self root trans quad)) - (vector-! s4-0 s3-0 sv-864) - (set! (-> s4-0 y) 0.0) - (let* ((f0-5 arg0) - (f0-7 (* f0-5 f0-5)) + (let ((sv-864 (target-pos 0))) + (metalkor-face-to-vector sv-864 546.13336 0.005) + (when (and (nonzero? (-> self previous-flat-travel-long-timer)) + (>= (+ (current-time) (seconds -1.2)) (-> self previous-flat-travel-long-timer)) ) + (set! (-> self previous-flat-travel-long-timer) 0) + (set! (-> self previous-flat-travel-timer) 0) + 0 + ) + (let ((s2-0 (new 'stack-no-clear 'clamp-travel-vector-to-mesh-return-info)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (let ((f30-0 (* 4096.0 (/ (-> self clock time-adjust-ratio) 4))) + (s1-0 #f) + ) + (set! (-> s3-0 quad) (-> self root trans quad)) + (vector-! s4-0 s3-0 sv-864) + (set! (-> s4-0 y) 0.0) + (let ((f0-7 (square arg0))) + (.lvf vf1 (&-> s4-0 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-32 vf1) + (if (< f0-7 v1-32) + (set! s1-0 #t) + ) + ) + (vector-normalize! s4-0 arg0) + (let ((v1-35 s4-0)) + (let ((a0-15 s4-0)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-15 quad)) + ) + (.lvf vf5 (&-> sv-864 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-35 quad) vf6) + ) + (vector-! s4-0 s4-0 s3-0) + (set! (-> s4-0 y) 0.0) (.lvf vf1 (&-> s4-0 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) (.mul.x.vf.x acc vf2 vf1) (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-32 vf1) - (if (< f0-7 v1-32) - (set! s1-0 #t) - ) - ) - (vector-normalize! s4-0 arg0) - (let ((v1-35 s4-0)) - (let ((a0-15 s4-0)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-15 quad)) + (.mov v1-38 vf1) + (let ((f0-9 v1-38)) + (if (< (square f30-0) f0-9) + (vector-float*! s4-0 s4-0 (/ f30-0 (sqrtf f0-9))) + ) ) - (.lvf vf5 (&-> sv-864 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-35 quad) vf6) - ) - (vector-! s4-0 s4-0 s3-0) - (set! (-> s4-0 y) 0.0) - (.lvf vf1 (&-> s4-0 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-38 vf1) - (let ((f0-9 v1-38) - (f1-3 f30-0) - ) - (if (< (* f1-3 f1-3) f0-9) - (vector-float*! s4-0 s4-0 (/ f30-0 (sqrtf f0-9))) - ) - ) - (set! (-> s2-0 poly) (-> self current-nav-poly)) - (dotimes (s0-1 5) - (let ((f30-1 (vector-length s4-0))) - (clamp-vector-to-mesh-no-gaps (-> self nav state mesh) s3-0 (-> s2-0 poly) s4-0 s2-0) - (cond - ((-> s2-0 found-boundary) - (set-normals-from-adjacent-bounds (-> self nav state mesh) s2-0) - (let ((f28-0 (vector-length s4-0))) - (vector-flatten! s4-0 s4-0 (-> s2-0 boundary-normal)) - (let ((f0-12 (- f30-1 f28-0))) - (vector-normalize! s4-0 f0-12) - ) - ) - (if (and (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer)) - (< (vector-dot s4-0 (-> self previous-flat-travel)) 0.0) - ) - (vector-negate! s4-0 s4-0) - ) - (set! (-> s3-0 x) (-> s2-0 intersection x)) - (set! (-> s3-0 z) (-> s2-0 intersection z)) - (vector-! s3-0 s3-0 (-> s2-0 boundary-normal)) - (when (or s1-0 (> s0-1 0) (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer))) - (set! (-> self previous-flat-travel quad) (-> s4-0 quad)) - (set-time! (-> self previous-flat-travel-timer)) - (if (zero? (-> self previous-flat-travel-long-timer)) - (set-time! (-> self previous-flat-travel-long-timer)) + (set! (-> s2-0 poly) (-> self current-nav-poly)) + (dotimes (s0-1 5) + (let ((f30-1 (vector-length s4-0))) + (clamp-vector-to-mesh-no-gaps (-> self nav state mesh) s3-0 (-> s2-0 poly) s4-0 s2-0) + (cond + ((-> s2-0 found-boundary) + (set-normals-from-adjacent-bounds (-> self nav state mesh) s2-0) + (let ((f28-0 (vector-length s4-0))) + (vector-flatten! s4-0 s4-0 (-> s2-0 boundary-normal)) + (let ((f0-12 (- f30-1 f28-0))) + (vector-normalize! s4-0 f0-12) ) + ) + (if (and (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer)) + (< (vector-dot s4-0 (-> self previous-flat-travel)) 0.0) + ) + (vector-negate! s4-0 s4-0) + ) + (set! (-> s3-0 x) (-> s2-0 intersection x)) + (set! (-> s3-0 z) (-> s2-0 intersection z)) + (vector-! s3-0 s3-0 (-> s2-0 boundary-normal)) + (when (or s1-0 (> s0-1 0) (< (+ (current-time) (seconds -0.1)) (-> self previous-flat-travel-timer))) + (set! (-> self previous-flat-travel quad) (-> s4-0 quad)) + (set-time! (-> self previous-flat-travel-timer)) + (if (zero? (-> self previous-flat-travel-long-timer)) + (set-time! (-> self previous-flat-travel-long-timer)) + ) + ) ) - ) - (else - (goto cfg-43) + (else + (goto cfg-43) + ) ) ) ) ) + (label cfg-43) + (vector+! s4-0 s3-0 s4-0) ) - (label cfg-43) - (vector+! s4-0 s3-0 s4-0) - ) - (vector-! s4-0 s4-0 (-> self root trans)) - (.lvf vf1 (&-> s4-0 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-80 vf1) - (let ((f0-17 v1-80) - (f1-7 40.96) - ) - (if (< f0-17 (* f1-7 f1-7)) + (vector-! s4-0 s4-0 (-> self root trans)) + (.lvf vf1 (&-> s4-0 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-80 vf1) + (if (< v1-80 (square 40.96)) (vector-reset! s4-0) ) + (vector+! (-> self root trans) (-> self root trans) s4-0) ) - (vector+! (-> self root trans) (-> self root trans) s4-0) ) (set! (-> self current-nav-poly) (cloest-point-on-mesh (-> self nav) (-> self root trans) (-> self root trans) (-> self current-nav-poly)) @@ -2231,9 +2213,7 @@ ((time-elapsed? (-> self state-time) (seconds 4)) (go-virtual chase-target) ) - ((let ((f0-0 57344.0)) - (< (* f0-0 f0-0) (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0))) - ) + ((< (square 57344.0) (vector-vector-xz-distance-squared (-> self root trans) (target-pos 0))) ) ((or (< (-> self last-close-attack) -1) (and (< (-> self last-close-attack) 2) @@ -2452,7 +2432,6 @@ (metalkor-ja-float-stop (the-as art-joint-anim metalkor-hang-pre-shot-ja)) ) :trans (behavior () - (local-vars (sv-16 res-tag)) (let ((v1-0 7500)) (if (and (-> self in-wave) (= (-> self stage) 1)) (set! v1-0 3000) @@ -2474,8 +2453,9 @@ (set-time! (-> self wasp-timer)) (dotimes (gp-0 3) (when (not (handle->process (-> self wasps gp-0))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-31 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-31 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-31 (< (the-as uint 1) (-> sv-16 elt-count))) (let ((v1-32 (-> v1-31 1))) (+! (-> self last-wasp-launched) 1) @@ -2734,10 +2714,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-72 vf1) - (let ((f0-14 v1-72) - (f1-2 1024.0) - ) - (if (< (* f1-2 f1-2) f0-14) + (let ((f0-14 v1-72)) + (if (< (square 1024.0) f0-14) (vector-float*! s5-1 s5-1 (/ 1024.0 (sqrtf f0-14))) ) ) diff --git a/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc index 83a85a7b79..5fa31d7508 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/nestb-scenes_REF.gc @@ -457,11 +457,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defun movie-nest-metalkor-shot-draw-impact ((arg0 scene-player) (arg1 vector) (arg2 vector)) - (local-vars - (sv-240 (function vector entity-actor skeleton-group vector object none :behavior manipy)) - (sv-256 vector) - (sv-272 entity-actor) - ) (let ((v0-0 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg2 arg1) 2048.0)) (gp-0 (new 'stack-no-clear 'vector)) ) @@ -525,36 +520,18 @@ (matrix->quaternion gp-1 s2-0) ) (sound-play "nboss-shoot-hit") - (let* ((s1-2 (get-process *default-dead-pool* manipy #x4000)) - (s2-2 (when s1-2 - (let ((t9-10 (method-of-type manipy activate))) - (t9-10 (the-as manipy s1-2) arg0 (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s2-3 run-function-in-process) - (s0-1 s1-2) - ) - (set! sv-240 manipy-init) - (set! sv-256 s4-1) - (set! sv-272 (-> arg0 entity)) - (let ((t0-2 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-2 #f) - (t2-2 0) - ) - ((the-as (function object object object object object object object none) s2-3) - s0-1 - sv-240 - sv-256 - sv-272 - t0-2 - t1-2 - t2-2 - ) - ) - ) - (-> s1-2 ppointer) - ) - ) - ) + (let ((s2-2 (process-spawn + manipy + :init manipy-init + s4-1 + (-> arg0 entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to arg0 + ) + ) + ) (when s2-2 (send-event (ppointer->process s2-2) 'anim-mode 'play1) (send-event (ppointer->process s2-2) 'anim "idle") diff --git a/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc b/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc index 188112c92f..bb4ef48a0e 100644 --- a/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/flying-spider_REF.gc @@ -597,11 +597,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) diff --git a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc index 104fbef39b..cb8acf64de 100644 --- a/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mammoth_REF.gc @@ -1157,7 +1157,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior mammoth-update-ik mammoth () - (local-vars (sv-688 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1176,11 +1175,9 @@ (-> s3-0 shoulder-matrix-no-ik) (let ((v1-5 (-> s3-0 elbow-matrix-no-ik)) (s0-0 (new 'stack-no-clear 'vector)) + (sv-688 (new 'stack-no-clear 'vector)) ) - (set! sv-688 (new 'stack-no-clear 'vector)) - (let ((a0-2 (-> *y-vector* quad))) - (set! (-> sv-688 quad) a0-2) - ) + (set! (-> sv-688 quad) (-> *y-vector* quad)) (let ((s2-0 (new 'stack-no-clear 'vector))) (new 'stack-no-clear 'vector) (new 'stack-no-clear 'vector) @@ -1242,11 +1239,7 @@ (.add.mul.w.vf.xyz vf6 vf4 vf0 acc) (.svf (&-> a1-9 quad) vf6) ) - (let ((v1-15 (-> gp-0 move-dist)) - (f0-16 -40960.0) - ) - (vector-float*! v1-15 sv-688 f0-16) - ) + (vector-float*! (-> gp-0 move-dist) sv-688 -40960.0) (let ((v1-17 gp-0)) (set! (-> v1-17 radius) 4.096) (set! (-> v1-17 collide-with) (-> gp-0 collide-with)) @@ -1427,7 +1420,6 @@ - tracks when the enemy was last drawn - looks at the target and handles attacking @TODO Not extremely well understood yet" - (local-vars (sv-752 lightning-spec) (sv-768 int) (sv-784 symbol) (sv-800 mammoth)) (let ((t9-0 (method-of-type nav-enemy common-post))) (t9-0 this) ) @@ -1521,41 +1513,16 @@ ) ) (label cfg-60) - (let ((s2-2 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s2-2 - (let ((t9-11 (method-of-type lightning-tracker activate))) - (t9-11 - (the-as lightning-tracker s2-2) - s5-2 - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-3 run-function-in-process) - (s1-1 s2-2) - (s0-3 lightning-tracker-init) - ) - (set! sv-752 (-> *lightning-spec-id-table* 1)) - (set! sv-768 600) - (set! sv-784 (the-as symbol #f)) - (set! sv-800 this) - (let ((t2-0 (-> (the-as (pointer int32) (&+ s4-2 (* (rnd-int-count this s3-2) 4))))) - (t3-0 6) - ) - ((the-as (function object object object object object object object object none) s5-3) - s1-1 - s0-3 - sv-752 - sv-768 - sv-784 - sv-800 - t2-0 - t3-0 - ) - ) - ) - (-> s2-2 ppointer) - ) + (process-spawn + lightning-tracker + :init lightning-tracker-init + (-> *lightning-spec-id-table* 1) + 600 + (the-as symbol #f) + this + (-> (the-as (pointer int32) (&+ s4-2 (* (rnd-int-count this s3-2) 4)))) + 6 + :to s5-2 ) ) (set! (-> this lightning-attack-timer) diff --git a/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc b/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc index e1c6e90761..5164d5f7ab 100644 --- a/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/mantis_REF.gc @@ -1233,11 +1233,7 @@ ) ) (zero? (rnd-int-count this 3)) - (let ((f0-0 (vector-vector-distance-squared (-> this root trans) (target-pos 0))) - (f1-0 32768.0) - ) - (>= f0-0 (* f1-0 f1-0)) - ) + (>= (vector-vector-distance-squared (-> this root trans) (target-pos 0)) (square 32768.0)) ) (kill-prefer-falling this) ) diff --git a/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc b/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc index 9a33968bc2..26e7801394 100644 --- a/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/boss/squid-extras_REF.gc @@ -156,7 +156,7 @@ s5-0 (* (lerp-scale 1.0 0.0 f28-0 (* 1.5 f30-0) 1.0) (lerp-scale 0.0 20480.0 f28-0 0.0 0.06)) ) - (let ((f28-1 (* f28-0 f28-0))) + (let ((f28-1 (square f28-0))) (let ((s4-1 (new 'stack-no-clear 'vector))) (compute-trans-at-time (-> arg0 traj) f28-1 s4-1) (vector+! s5-0 s5-0 s4-1) @@ -400,11 +400,7 @@ (spawn (-> self part) a1-2) ) (when (or (time-elapsed? (-> self state-time) (-> self duration)) - (let ((f0-3 (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans))) - (f1-1 12288.0) - ) - (< f0-3 (* f1-1 f1-1)) - ) + (< (vector-vector-xz-distance-squared (target-pos 0) (-> self root trans)) (square 12288.0)) ) (let ((gp-1 (new 'stack-no-clear 'explosion-init-params))) (set! (-> gp-1 spawn-point quad) (-> self root trans quad)) diff --git a/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc b/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc index e4e6c56bd3..b6d3a450ad 100644 --- a/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/boss/squid-setup_REF.gc @@ -852,40 +852,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod squid-tentacle-method-23 ((this squid-tentacle)) - (local-vars - (v1-134 float) - (v1-162 float) - (f0-51 float) - (sv-1456 squid-tentacle-chain) - (sv-1472 vector) - (sv-1488 vector) - (sv-1504 vector) - (sv-1520 vector) - (sv-1536 (function vector float vector)) - (sv-1552 vector) - (sv-1568 vector) - (sv-1584 vector) - (sv-1600 vector) - (sv-1616 vector) - (sv-1632 vector) - (sv-1648 (function vector float vector)) - (sv-1664 vector) - (sv-1680 vector) - (sv-1696 vector) - (sv-1712 vector) - (sv-1728 vector) - (sv-1744 collide-query) - (sv-1760 int) - (sv-1776 vector) - (sv-1792 vector) - (sv-1808 vector) - (sv-1824 (inline-array vector)) - (sv-1840 (inline-array vector)) - (sv-1856 (inline-array vector)) - (sv-1872 vector) - (sv-1888 (inline-array vector)) - (sv-1904 vector) - ) + (local-vars (v1-134 float) (v1-162 float) (f0-51 float)) (with-pp (rlet ((acc :class vf) (vf0 :class vf) @@ -927,368 +894,370 @@ (set! (-> this num-bg-collisions) 0) (set! (-> this max-movement) 0.0) (dotimes (s0-0 11) - (set! sv-1456 (-> this chain-joints s0-0)) - (set! sv-1904 (new 'stack-no-clear 'vector)) - (let ((v1-19 (-> sv-1456 position quad))) - (set! (-> sv-1904 quad) v1-19) - ) - (cond - ((-> this wrap) - (+! (-> sv-1904 y) -409.6) - (set! sv-1472 (new 'stack-no-clear 'vector)) - (let ((v1-25 sv-1904) - (a0-10 (-> this center)) + (let ((sv-1456 (-> this chain-joints s0-0)) + (sv-1904 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-1904 quad) (-> sv-1456 position quad)) + (cond + ((-> this wrap) + (+! (-> sv-1904 y) -409.6) + (let ((sv-1472 (new 'stack-no-clear 'vector))) + (let ((v1-25 sv-1904) + (a0-10 (-> this center)) + ) + (.lvf vf4 (&-> v1-25 quad)) + (.lvf vf5 (&-> a0-10 quad)) ) - (.lvf vf4 (&-> v1-25 quad)) - (.lvf vf5 (&-> a0-10 quad)) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1472 quad) vf6) + (set! (-> sv-1472 y) 0.0) + (vector-normalize! sv-1472 409.6) + (+! (-> sv-1904 x) (-> sv-1472 z)) + (set! (-> sv-1904 z) (- (-> sv-1904 z) (-> sv-1472 x))) + ) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1472 quad) vf6) - (set! (-> sv-1472 y) 0.0) - (vector-normalize! sv-1472 409.6) - (+! (-> sv-1904 x) (-> sv-1472 z)) - (set! (-> sv-1904 z) (- (-> sv-1904 z) (-> sv-1472 x))) - ) - (else - (set! sv-1520 sv-1904) - (set! sv-1488 sv-1904) - (set! sv-1504 (-> this gravity)) - (let ((f0-14 (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.2 (lerp-scale 0.38 0.18 (the float s0-0) 0.0 5.0)))) + (else + (let ((sv-1520 sv-1904)) + (let ((sv-1488 sv-1904) + (sv-1504 (-> this gravity)) + (f0-14 (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.2 (lerp-scale 0.38 0.18 (the float s0-0) 0.0 5.0)))) + ) + (.lvf vf2 (&-> sv-1504 quad)) + (.lvf vf1 (&-> sv-1488 quad)) + (let ((v1-43 f0-14)) + (.mov vf3 v1-43) + ) ) - (.lvf vf2 (&-> sv-1504 quad)) - (.lvf vf1 (&-> sv-1488 quad)) - (let ((v1-43 f0-14)) - (.mov vf3 v1-43) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1520 quad) vf4) ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1520 quad) vf4) - (when (-> this avoid-center) - (vector-! s1-0 (-> sv-1456 position) (-> this center)) - (set! sv-1536 vector-normalize!) - (set! sv-1552 s1-0) - (let ((a1-13 (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.0 (lerp-scale 0.4 0.6 (the float s0-0) 0.0 8.0))))) - (sv-1536 sv-1552 a1-13) - ) - (vector+! sv-1904 sv-1904 s1-0) - ) - ) - ) - (when (< s0-0 10) - (set! sv-1600 sv-1904) - (set! sv-1568 sv-1904) - (set! sv-1584 (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* (+ s0-0 1) 64)))) - (let ((f0-24 (fmin 0.9 (lerp-scale 0.2 1.0 (the float s0-0) 0.0 4.0)))) - (.lvf vf2 (&-> sv-1584 quad)) - (.lvf vf1 (&-> sv-1568 quad)) - (let ((v1-60 f0-24)) - (.mov vf3 v1-60) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1600 quad) vf4) - ) - (vector-! s1-0 sv-1904 s4-1) - (if (= s0-0 10) - (vector-normalize! s1-0 7102.464) - (vector-normalize! s1-0 4096.0) - ) - (vector+! sv-1904 s1-0 s4-1) - (let ((v0-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 3)))) - (set! sv-1616 (new 'stack-no-clear 'vector)) - (+! (-> v0-15 y) 31744.0) - (vector-! sv-1616 sv-1904 v0-15) - ) - (let ((f0-27 (vector-normalize-ret-len! sv-1616 1.0))) - (when (< f0-27 32768.0) - (vector+float*! sv-1904 sv-1904 sv-1616 (- 32768.0 f0-27)) - (vector-normalize-copy! - sv-1616 - (-> this node-list data 3 bone transform vector 2) - (* 2048.0 (-> pp clock time-adjust-ratio)) - ) - (let ((v1-77 sv-1904)) - (let ((a0-31 sv-1904)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-31 quad)) - ) - (.lvf vf5 (&-> sv-1616 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-77 quad) vf6) - ) - ) - ) - (set! sv-1632 (new 'stack-no-clear 'vector)) - (let ((v1-79 sv-1904) - (a0-33 (-> this center)) - ) - (.lvf vf4 (&-> v1-79 quad)) - (.lvf vf5 (&-> a0-33 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1632 quad) vf6) - (set! (-> sv-1632 y) 0.0) - (let ((f0-32 (vector-normalize-ret-len! sv-1632 1.0))) - (when (< f0-32 4096.0) - (let ((v1-84 sv-1904) - (a0-35 sv-1904) - (f0-33 (- 4096.0 f0-32)) + (when (-> this avoid-center) + (vector-! s1-0 (-> sv-1456 position) (-> this center)) + (vector-normalize! + s1-0 + (* 4096.0 (-> pp clock time-adjust-ratio) (fmax 0.0 (lerp-scale 0.4 0.6 (the float s0-0) 0.0 8.0))) ) - (vector+float*! v1-84 a0-35 sv-1632 f0-33) - ) - ) - ) - (set! sv-1728 (new 'stack-no-clear 'vector)) - (let ((v1-87 sv-1904) - (a0-36 s4-1) - ) - (.lvf vf4 (&-> v1-87 quad)) - (.lvf vf5 (&-> a0-36 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1728 quad) vf6) - (let ((f30-3 (vector-normalize-ret-len! sv-1728 1.0)) - (f28-2 (vector-dot sv-1728 s2-0)) - (f26-0 (lerp-scale 5461.3335 10922.667 (the float s0-0) 0.0 8.0)) - ) - (when (< f28-2 (cos f26-0)) - (vector--float*! sv-1728 sv-1728 s2-0 f28-2) - (set! sv-1648 vector-normalize!) - (set! sv-1664 sv-1728) - (let ((a1-34 (sin f26-0))) - (sv-1648 sv-1664 a1-34) - ) - (set! sv-1712 sv-1728) - (set! sv-1680 sv-1728) - (set! sv-1696 s2-0) - (let ((f0-38 (cos f26-0))) - (.lvf vf2 (&-> sv-1696 quad)) - (.lvf vf1 (&-> sv-1680 quad)) - (let ((v1-98 f0-38)) - (.mov vf3 v1-98) + (vector+! sv-1904 sv-1904 s1-0) ) ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1712 quad) vf4) - (vector+float*! sv-1904 s4-1 sv-1728 f30-3) ) - ) - (set! sv-1744 (new 'stack-no-clear 'collide-query)) - (set! sv-1776 (new 'stack-no-clear 'vector)) - (let ((v1-104 sv-1904) - (a0-47 (-> sv-1456 position)) + (when (< s0-0 10) + (let ((sv-1600 sv-1904)) + (let ((sv-1568 sv-1904) + (sv-1584 (the-as vector (+ (the-as uint (-> this chain-joints 0 velocity)) (* (+ s0-0 1) 64)))) + (f0-24 (fmin 0.9 (lerp-scale 0.2 1.0 (the float s0-0) 0.0 4.0))) + ) + (.lvf vf2 (&-> sv-1584 quad)) + (.lvf vf1 (&-> sv-1568 quad)) + (let ((v1-60 f0-24)) + (.mov vf3 v1-60) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1600 quad) vf4) ) - (.lvf vf4 (&-> v1-104 quad)) - (.lvf vf5 (&-> a0-47 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1776 quad) vf6) - (set! sv-1760 0) - (set! (-> sv-1904 quad) (-> sv-1456 position quad)) - (until (or (< 6 sv-1760) - (begin - (.lvf vf1 (&-> sv-1776 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-134 vf1) - (let ((f0-46 v1-134) - (f1-16 409.6) + ) + (vector-! s1-0 sv-1904 s4-1) + (if (= s0-0 10) + (vector-normalize! s1-0 7102.464) + (vector-normalize! s1-0 4096.0) + ) + (vector+! sv-1904 s1-0 s4-1) + (let ((v0-15 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data 3))) + (sv-1616 (new 'stack-no-clear 'vector)) + ) + (+! (-> v0-15 y) 31744.0) + (vector-! sv-1616 sv-1904 v0-15) + (let ((f0-27 (vector-normalize-ret-len! sv-1616 1.0))) + (when (< f0-27 32768.0) + (vector+float*! sv-1904 sv-1904 sv-1616 (- 32768.0 f0-27)) + (vector-normalize-copy! + sv-1616 + (-> this node-list data 3 bone transform vector 2) + (* 2048.0 (-> pp clock time-adjust-ratio)) + ) + (let ((v1-77 sv-1904)) + (let ((a0-31 sv-1904)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-31 quad)) + ) + (.lvf vf5 (&-> sv-1616 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-77 quad) vf6) + ) + ) + ) + ) + (let ((sv-1632 (new 'stack-no-clear 'vector))) + (let ((v1-79 sv-1904) + (a0-33 (-> this center)) + ) + (.lvf vf4 (&-> v1-79 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1632 quad) vf6) + (set! (-> sv-1632 y) 0.0) + (let ((f0-32 (vector-normalize-ret-len! sv-1632 1.0))) + (if (< f0-32 4096.0) + (vector+float*! sv-1904 sv-1904 sv-1632 (- 4096.0 f0-32)) + ) + ) + ) + (let ((sv-1728 (new 'stack-no-clear 'vector))) + (let ((v1-87 sv-1904) + (a0-36 s4-1) + ) + (.lvf vf4 (&-> v1-87 quad)) + (.lvf vf5 (&-> a0-36 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1728 quad) vf6) + (let ((f30-3 (vector-normalize-ret-len! sv-1728 1.0)) + (f28-2 (vector-dot sv-1728 s2-0)) + (f26-0 (lerp-scale 5461.3335 10922.667 (the float s0-0) 0.0 8.0)) + ) + (when (< f28-2 (cos f26-0)) + (vector--float*! sv-1728 sv-1728 s2-0 f28-2) + (vector-normalize! sv-1728 (sin f26-0)) + (let ((sv-1712 sv-1728)) + (let ((sv-1680 sv-1728) + (sv-1696 s2-0) + (f0-38 (cos f26-0)) + ) + (.lvf vf2 (&-> sv-1696 quad)) + (.lvf vf1 (&-> sv-1680 quad)) + (let ((v1-98 f0-38)) + (.mov vf3 v1-98) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1712 quad) vf4) + ) + (vector+float*! sv-1904 s4-1 sv-1728 f30-3) + ) + ) + ) + (let ((sv-1744 (new 'stack-no-clear 'collide-query)) + (sv-1776 (new 'stack-no-clear 'vector)) + ) + (let ((v1-104 sv-1904) + (a0-47 (-> sv-1456 position)) + ) + (.lvf vf4 (&-> v1-104 quad)) + (.lvf vf5 (&-> a0-47 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1776 quad) vf6) + (let ((sv-1760 0)) + (set! (-> sv-1904 quad) (-> sv-1456 position quad)) + (until (or (< 6 sv-1760) + (begin + (.lvf vf1 (&-> sv-1776 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-134 vf1) + (< v1-134 (square 409.6)) ) - (< f0-46 (* f1-16 f1-16)) + ) + (+! sv-1760 1) + (set! (-> sv-1744 start-pos quad) (-> sv-1904 quad)) + (set! (-> sv-1744 move-dist quad) (-> sv-1776 quad)) + (let ((v1-114 sv-1744)) + (set! (-> v1-114 radius) 4096.0) + (set! (-> v1-114 collide-with) (collide-spec player-list special-obstacle)) + (set! (-> v1-114 ignore-process0) this) + (set! (-> v1-114 ignore-process1) #f) + (set! (-> v1-114 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) + ) + (set! (-> v1-114 action-mask) (collide-action solid)) + ) + (set! (-> sv-1744 num-spheres) (the-as uint #f)) + (let ((f0-40 (probe-using-line-sphere *collide-cache* sv-1744))) + (cond + ((>= f0-40 0.0) + (let ((f0-41 (fmin 1.0 f0-40))) + (vector+float*! sv-1904 sv-1904 sv-1776 f0-41) + (vector-float*! sv-1776 sv-1776 (- 1.0 f0-41)) + ) + (let ((f0-44 (vector-dot sv-1776 (-> sv-1744 best-other-tri normal)))) + (vector--float*! sv-1776 sv-1776 (-> sv-1744 best-other-tri normal) (* 1.2 f0-44)) ) ) - ) - (set! sv-1760 (+ sv-1760 1)) - (set! (-> sv-1744 start-pos quad) (-> sv-1904 quad)) - (set! (-> sv-1744 move-dist quad) (-> sv-1776 quad)) - (let ((v1-114 sv-1744)) - (set! (-> v1-114 radius) 4096.0) - (set! (-> v1-114 collide-with) (collide-spec player-list special-obstacle)) - (set! (-> v1-114 ignore-process0) this) - (set! (-> v1-114 ignore-process1) #f) - (set! (-> v1-114 ignore-pat) - (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1) - ) - (set! (-> v1-114 action-mask) (collide-action solid)) - ) - (set! (-> sv-1744 num-spheres) (the-as uint #f)) - (let ((f0-40 (probe-using-line-sphere *collide-cache* sv-1744))) - (cond - ((>= f0-40 0.0) - (let ((f0-41 (fmin 1.0 f0-40))) - (vector+float*! sv-1904 sv-1904 sv-1776 f0-41) - (vector-float*! sv-1776 sv-1776 (- 1.0 f0-41)) - ) - (let ((f0-44 (vector-dot sv-1776 (-> sv-1744 best-other-tri normal)))) - (vector--float*! sv-1776 sv-1776 (-> sv-1744 best-other-tri normal) (* 1.2 f0-44)) - ) - ) - (else - (let ((v1-128 sv-1904)) - (let ((a0-64 sv-1904)) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> a0-64 quad)) - ) - (.lvf vf5 (&-> sv-1776 quad)) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-128 quad) vf6) - ) - (goto cfg-27) - ) - ) - ) - ) - (label cfg-27) - (if (< 1 sv-1760) - (+! (-> this num-bg-collisions) 1) - ) - (set! sv-1808 (new 'stack-no-clear 'vector)) - (let ((v1-143 s4-1) - (a0-69 sv-1904) - ) - (.lvf vf4 (&-> v1-143 quad)) - (.lvf vf5 (&-> a0-69 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1808 quad) vf6) - (vector-normalize-ret-len! sv-1808 1.0) - (set! sv-1792 (new 'stack-no-clear 'vector)) - (let ((v1-146 sv-1904) - (a0-72 (-> sv-1456 position)) - ) - (.lvf vf4 (&-> v1-146 quad)) - (.lvf vf5 (&-> a0-72 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-1792 quad) vf6) - (let ((f30-4 (vector-dot sv-1808 sv-1792))) - (vector--float*! sv-1792 sv-1792 sv-1808 f30-4) - (cond - ((< f30-4 0.0) - (set! f0-51 (* 0.75 f30-4)) - (vector-float*! sv-1792 sv-1792 0.85) - ) - (else - (set! f0-51 (* 0.8 f30-4)) - (vector-float*! sv-1792 sv-1792 (-> this stretch-vel)) - ) - ) - ) - (let ((v1-157 (-> sv-1456 velocity))) - (.lvf vf2 (&-> sv-1808 quad)) - (.lvf vf1 (&-> sv-1792 quad)) - (let ((a0-79 f0-51)) - (.mov vf3 a0-79) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> v1-157 quad) vf4) - ) - (vector+! sv-1904 (-> sv-1456 position) (-> sv-1456 velocity)) - (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) s4-1 sv-1904))) - (.lvf vf1 (&-> a2-14 quad)) - (.add.w.vf.x vf2 vf0 vf0) - (.mul.vf vf1 vf1 vf1) - (.mul.x.vf.x acc vf2 vf1) - (.add.mul.y.vf.x acc vf2 vf1 acc) - (.add.mul.z.vf.x vf1 vf2 vf1 acc) - (.mov v1-162 vf1) - (let* ((f0-53 v1-162) - (f1-21 (if (= s0-0 10) - 9830.4 - 6144.0 - ) + (else + (let ((v1-128 sv-1904)) + (let ((a0-64 sv-1904)) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> a0-64 quad)) + ) + (.lvf vf5 (&-> sv-1776 quad)) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-128 quad) vf6) ) - (f2-0 f1-21) - ) - (if (< (* f2-0 f2-0) f0-53) - (vector--float*! sv-1904 s4-1 a2-14 (/ f1-21 (sqrtf f0-53))) + (goto cfg-27) + ) + ) + ) ) - ) - ) - (set! (-> this max-movement) - (fmax (vector-vector-distance (-> sv-1456 position) sv-1904) (-> this max-movement)) - ) - (set! (-> sv-1456 position quad) (-> sv-1904 quad)) - (if (-> sv-1456 joint-mod) - (set! (-> sv-1456 joint-mod trans quad) (-> sv-1904 quad)) - ) - (when (< s0-0 11) - (vector-! (-> s5-1 vector 1) sv-1904 s4-1) - (vector-normalize! (-> s5-1 vector 1) 1.0) - (vector-cross! (-> s5-1 vector 0) (-> s5-1 vector 1) s3-1) - (vector-normalize! (-> s5-1 vector 0) 1.0) - (set! sv-1872 (new 'stack-no-clear 'vector)) - (let ((v1-182 (-> sv-1456 old-x)) - (a0-93 (-> s5-1 vector)) - ) - (.lvf vf1 (&-> v1-182 quad)) - (.lvf vf2 (&-> a0-93 0 quad)) - ) - (.outer.product.a.vf acc vf1 vf2) - (.outer.product.b.vf vf3 vf2 vf1 acc) - (.svf (&-> sv-1872 quad) vf3) - (vector-flatten! sv-1872 (-> sv-1456 old-x) (-> s5-1 vector 1)) - (vector-normalize! sv-1872 1.0) - (cond - ((< (vector-dot (-> s5-1 vector 0) sv-1872) (cos 3640.889)) - (vector-cross! sv-1872 sv-1872 (-> s5-1 vector 0)) - (vector-cross! sv-1872 (-> s5-1 vector 0) sv-1872) - (vector-normalize! sv-1872 1.0) - (set! sv-1840 (-> s5-1 vector)) - (set! sv-1824 (-> s5-1 vector)) - (let ((f0-60 (cos 3640.889))) - (.lvf vf1 (&-> sv-1824 0 quad)) - (let ((v1-192 f0-60)) - (.mov vf2 v1-192) - ) - ) - (.add.x.vf.w vf1 vf0 vf0) - (.mul.x.vf.xyz vf1 vf1 vf2) - (.svf (&-> sv-1840 0 quad) vf1) - (set! sv-1888 (-> s5-1 vector)) - (set! sv-1856 (-> s5-1 vector)) - (let ((f0-61 (sin 3640.889))) - (.lvf vf2 (&-> sv-1872 quad)) - (.lvf vf1 (&-> sv-1856 0 quad)) - (let ((v1-198 f0-61)) - (.mov vf3 v1-198) - ) - ) - (.add.x.vf.w vf4 vf0 vf0) - (.mul.x.vf acc vf2 vf3) - (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) - (.svf (&-> sv-1888 0 quad) vf4) - (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) - ) - (else - (set! (-> s5-1 vector 0 quad) (-> sv-1872 quad)) - (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) + (label cfg-27) + (if (< 1 sv-1760) + (+! (-> this num-bg-collisions) 1) + ) ) ) - (vector-cross! (-> s5-1 vector 2) (-> s5-1 vector 0) (-> s5-1 vector 1)) - (matrix->quaternion (-> sv-1456 joint-mod quat) s5-1) - (set! (-> s2-0 quad) (-> s5-1 vector 1 quad)) - (set! (-> s3-1 quad) (-> s5-1 vector 2 quad)) - 0 + (let ((sv-1808 (new 'stack-no-clear 'vector))) + (let ((a0-69 sv-1904)) + (.lvf vf4 (&-> s4-1 quad)) + (.lvf vf5 (&-> a0-69 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1808 quad) vf6) + (vector-normalize-ret-len! sv-1808 1.0) + (let ((sv-1792 (new 'stack-no-clear 'vector))) + (let ((v1-146 sv-1904) + (a0-72 (-> sv-1456 position)) + ) + (.lvf vf4 (&-> v1-146 quad)) + (.lvf vf5 (&-> a0-72 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-1792 quad) vf6) + (let ((f30-4 (vector-dot sv-1808 sv-1792))) + (vector--float*! sv-1792 sv-1792 sv-1808 f30-4) + (cond + ((< f30-4 0.0) + (set! f0-51 (* 0.75 f30-4)) + (vector-float*! sv-1792 sv-1792 0.85) + ) + (else + (set! f0-51 (* 0.8 f30-4)) + (vector-float*! sv-1792 sv-1792 (-> this stretch-vel)) + ) + ) + ) + (let ((v1-157 (-> sv-1456 velocity))) + (.lvf vf2 (&-> sv-1808 quad)) + (.lvf vf1 (&-> sv-1792 quad)) + (let ((a0-79 f0-51)) + (.mov vf3 a0-79) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> v1-157 quad) vf4) + ) + ) + ) + (vector+! sv-1904 (-> sv-1456 position) (-> sv-1456 velocity)) + (let ((a2-14 (vector-! (new 'stack-no-clear 'vector) s4-1 sv-1904))) + (.lvf vf1 (&-> a2-14 quad)) + (.add.w.vf.x vf2 vf0 vf0) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf.x acc vf2 vf1) + (.add.mul.y.vf.x acc vf2 vf1 acc) + (.add.mul.z.vf.x vf1 vf2 vf1 acc) + (.mov v1-162 vf1) + (let ((f0-53 v1-162) + (f1-21 (if (= s0-0 10) + 9830.4 + 6144.0 + ) + ) + ) + (if (< (square f1-21) f0-53) + (vector--float*! sv-1904 s4-1 a2-14 (/ f1-21 (sqrtf f0-53))) + ) + ) + ) + (set! (-> this max-movement) + (fmax (vector-vector-distance (-> sv-1456 position) sv-1904) (-> this max-movement)) + ) + (set! (-> sv-1456 position quad) (-> sv-1904 quad)) + (if (-> sv-1456 joint-mod) + (set! (-> sv-1456 joint-mod trans quad) (-> sv-1904 quad)) + ) + (when (< s0-0 11) + (vector-! (-> s5-1 vector 1) sv-1904 s4-1) + (vector-normalize! (-> s5-1 vector 1) 1.0) + (vector-cross! (-> s5-1 vector 0) (-> s5-1 vector 1) s3-1) + (vector-normalize! (-> s5-1 vector 0) 1.0) + (let ((sv-1872 (new 'stack-no-clear 'vector))) + (let ((v1-182 (-> sv-1456 old-x)) + (a0-93 (-> s5-1 vector)) + ) + (.lvf vf1 (&-> v1-182 quad)) + (.lvf vf2 (&-> a0-93 0 quad)) + ) + (.outer.product.a.vf acc vf1 vf2) + (.outer.product.b.vf vf3 vf2 vf1 acc) + (.svf (&-> sv-1872 quad) vf3) + (vector-flatten! sv-1872 (-> sv-1456 old-x) (-> s5-1 vector 1)) + (vector-normalize! sv-1872 1.0) + (cond + ((< (vector-dot (-> s5-1 vector 0) sv-1872) (cos 3640.889)) + (vector-cross! sv-1872 sv-1872 (-> s5-1 vector 0)) + (vector-cross! sv-1872 (-> s5-1 vector 0) sv-1872) + (vector-normalize! sv-1872 1.0) + (let ((sv-1840 (-> s5-1 vector))) + (let ((sv-1824 (-> s5-1 vector)) + (f0-60 (cos 3640.889)) + ) + (.lvf vf1 (&-> sv-1824 0 quad)) + (let ((v1-192 f0-60)) + (.mov vf2 v1-192) + ) + ) + (.add.x.vf.w vf1 vf0 vf0) + (.mul.x.vf.xyz vf1 vf1 vf2) + (.svf (&-> sv-1840 0 quad) vf1) + ) + (let ((sv-1888 (-> s5-1 vector))) + (let ((sv-1856 (-> s5-1 vector)) + (f0-61 (sin 3640.889)) + ) + (.lvf vf2 (&-> sv-1872 quad)) + (.lvf vf1 (&-> sv-1856 0 quad)) + (let ((v1-198 f0-61)) + (.mov vf3 v1-198) + ) + ) + (.add.x.vf.w vf4 vf0 vf0) + (.mul.x.vf acc vf2 vf3) + (.add.mul.w.vf.xyz vf4 vf1 vf0 acc) + (.svf (&-> sv-1888 0 quad) vf4) + ) + (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) + ) + (else + (set! (-> s5-1 vector 0 quad) (-> sv-1872 quad)) + (set! (-> sv-1456 old-x quad) (-> s5-1 vector 0 quad)) + ) + ) + ) + (vector-cross! (-> s5-1 vector 2) (-> s5-1 vector 0) (-> s5-1 vector 1)) + (matrix->quaternion (-> sv-1456 joint-mod quat) s5-1) + (set! (-> s2-0 quad) (-> s5-1 vector 1 quad)) + (set! (-> s3-1 quad) (-> s5-1 vector 2 quad)) + 0 + ) + (set! (-> s4-1 quad) (-> sv-1904 quad)) ) - (set! (-> s4-1 quad) (-> sv-1904 quad)) 0 ) ) @@ -1484,89 +1453,27 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch (pointer process) vs none. (defbehavior squid-check-hit-points squid () - (local-vars - (sv-48 symbol) - (sv-64 symbol) - (sv-80 vector) - (sv-96 matrix) - (sv-112 symbol) - (sv-128 symbol) - (sv-144 vector) - (sv-160 matrix) - ) (when (zero? (-> self hit-points)) (set! (-> self shield-hit-points) 0.0) (cond ((zero? (-> self stage)) (setup-masks (-> self draw) 320 160) - (let ((gp-0 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-0 - (let ((t9-2 (method-of-type part-tracker activate))) - (t9-2 (the-as part-tracker gp-0) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-0) - (s3-0 part-tracker-init) - (s2-0 group-squid-grenade-explode) - (s1-0 0) - (s0-0 #f) - ) - (set! sv-48 (the-as symbol #f)) - (set! sv-64 (the-as symbol #f)) - (set! sv-96 *launch-matrix*) - (set! sv-80 (-> sv-96 trans)) - (let ((v1-13 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunL)) quad))) - (set! (-> sv-80 quad) v1-13) - ) - ((the-as (function object object object object object object object object none) s5-0) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - sv-96 - ) - ) - (-> gp-0 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-grenade-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunL)) ) ) ((= (-> self stage) 1) (setup-masks (-> self draw) 5120 2590) - (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-1 - (let ((t9-7 (method-of-type part-tracker activate))) - (t9-7 (the-as part-tracker gp-1) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-1 run-function-in-process) - (s4-1 gp-1) - (s3-1 part-tracker-init) - (s2-1 group-squid-grenade-explode) - (s1-1 0) - (s0-1 #f) - ) - (set! sv-112 (the-as symbol #f)) - (set! sv-128 (the-as symbol #f)) - (set! sv-160 *launch-matrix*) - (set! sv-144 (-> sv-160 trans)) - (let ((v1-25 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podL)) quad))) - (set! (-> sv-144 quad) v1-25) - ) - ((the-as (function object object object object object object object object none) s5-1) - s4-1 - s3-1 - s2-1 - s1-1 - s0-1 - sv-112 - sv-128 - sv-160 - ) - ) - (-> gp-1 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-grenade-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podL)) ) ) ) @@ -1577,7 +1484,6 @@ ;; definition for function squid-handler ;; INFO: Used lq/sq (defbehavior squid-handler squid ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (sv-16 res-tag)) (case arg2 (('plane) (set! (-> self max-plane) (max (-> self max-plane) (the-as int (-> arg3 param 0)))) @@ -1591,8 +1497,9 @@ ) ) (when (nonzero? s5-1) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-9 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-9 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-9 (< (the-as uint s5-1) (-> sv-16 elt-count))) (let ((gp-1 (-> v1-9 s5-1))) (dotimes (s5-2 (-> gp-1 length)) @@ -2144,17 +2051,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod move-to-spot ((this squid) (arg0 vector) (arg1 symbol)) - (local-vars - (sv-656 vector) - (sv-672 vector) - (sv-688 matrix) - (sv-704 clamp-travel-vector-to-mesh-return-info) - (sv-720 int) - (sv-736 nav-control) - (sv-752 vector) - (sv-768 nav-control) - (sv-784 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2167,27 +2063,27 @@ ) (let ((s1-0 (new 'stack-no-clear 'vector)) (f30-0 0.0) + (sv-656 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) + (s0-0 0) + (sv-672 (squid-method-42 this (new 'stack-no-clear 'vector))) ) - (set! sv-656 (new 'stack-no-clear 'vector)) - (let ((s3-0 (new 'stack-no-clear 'vector)) - (s0-0 0) - ) - (set! sv-672 (squid-method-42 this (new 'stack-no-clear 'vector))) - (+! (-> sv-672 y) 8192.0) - (set! (-> s3-0 quad) (-> arg0 quad)) - (set! (-> s3-0 y) (-> this nav state mesh bounds y)) - (set! (-> this current-nav-poly) (cloest-point-on-mesh (-> this nav) s3-0 s3-0 (-> this current-nav-poly))) - (cond - ((-> this current-nav-poly) - (vector-! sv-656 (-> this nav state mesh bounds) s3-0) - (set! (-> sv-656 y) 0.0) - (vector-normalize! sv-656 614400.0) - (let ((a2-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) -19114.668))) - (vector-matrix*! sv-656 sv-656 a2-2) - ) - (set! sv-688 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 2730.6667)) - (set! sv-704 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) - (set! sv-720 0) + (+! (-> sv-672 y) 8192.0) + (set! (-> s3-0 quad) (-> arg0 quad)) + (set! (-> s3-0 y) (-> this nav state mesh bounds y)) + (set! (-> this current-nav-poly) (cloest-point-on-mesh (-> this nav) s3-0 s3-0 (-> this current-nav-poly))) + (cond + ((-> this current-nav-poly) + (vector-! sv-656 (-> this nav state mesh bounds) s3-0) + (set! (-> sv-656 y) 0.0) + (vector-normalize! sv-656 614400.0) + (let ((a2-2 (matrix-rotate-y! (new 'stack-no-clear 'matrix) -19114.668))) + (vector-matrix*! sv-656 sv-656 a2-2) + ) + (let ((sv-688 (matrix-rotate-y! (new 'stack-no-clear 'matrix) 2730.6667)) + (sv-704 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) + (sv-720 0) + ) (while (< sv-720 13) (vector-matrix*! sv-656 sv-656 sv-688) (set! (-> s5-0 s0-0 quad) (-> sv-656 quad)) @@ -2206,47 +2102,39 @@ (cond ((not (-> sv-704 found-boundary)) ) - ((let ((f0-6 (vector-vector-distance-squared sv-672 (-> s5-0 s0-0))) - (f1-2 102400.0) - ) - (< f0-6 (* f1-2 f1-2)) - ) + ((< (vector-vector-distance-squared sv-672 (-> s5-0 s0-0)) (square 102400.0)) ) ((not (squid-method-44 this (-> s5-0 s0-0) sv-672)) ) - ((let ((f0-7 (vector-vector-distance-squared s3-0 (-> s5-0 s0-0))) - (f1-5 81920.0) - ) - (< f0-7 (* f1-5 f1-5)) - ) + ((< (vector-vector-distance-squared s3-0 (-> s5-0 s0-0)) (square 81920.0)) (let ((f28-0 (vector-vector-distance-squared s3-0 (-> s5-0 s0-0)))) (new 'stack-no-clear 'vector) (when (< f30-0 f28-0) (set! (-> s1-0 quad) (-> s5-0 s0-0 quad)) (when (-> sv-704 poly) - (let ((a3-2 (new 'stack-no-clear 'vector))) - (set! sv-736 (-> this nav)) - (let ((a1-15 (-> sv-704 poly))) - (set! sv-752 s1-0) - (let ((v1-53 (-> s5-0 s0-0))) - (project-point-onto-plane-of-poly-local - (-> sv-736 state mesh) - a1-15 - sv-752 - a3-2 - (vector-! (new 'stack-no-clear 'vector) v1-53 (-> sv-736 state mesh bounds)) - ) + (let ((a3-2 (new 'stack-no-clear 'vector)) + (sv-736 (-> this nav)) + (a1-15 (-> sv-704 poly)) + (sv-752 s1-0) + ) + (let ((v1-53 (-> s5-0 s0-0))) + (project-point-onto-plane-of-poly-local + (-> sv-736 state mesh) + a1-15 + sv-752 + a3-2 + (vector-! (new 'stack-no-clear 'vector) v1-53 (-> sv-736 state mesh bounds)) ) ) - ) - (let ((v1-54 sv-752)) - (let ((a0-33 (-> sv-736 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-752 quad)) - (.lvf vf5 (&-> a0-33 quad)) + (let ((v1-54 sv-752)) + (let ((a0-33 (-> sv-736 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-752 quad)) + (.lvf vf5 (&-> a0-33 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-54 quad) vf6) ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-54 quad) vf6) ) 0 (+! (-> s1-0 y) 32768.0) @@ -2257,29 +2145,29 @@ ) (else (when (-> sv-704 poly) - (let ((a3-3 (new 'stack-no-clear 'vector))) - (set! sv-768 (-> this nav)) - (let ((a1-17 (-> sv-704 poly))) - (set! sv-784 (-> s5-0 s0-0)) - (let ((v1-67 (-> s5-0 s0-0))) - (project-point-onto-plane-of-poly-local - (-> sv-768 state mesh) - a1-17 - sv-784 - a3-3 - (vector-! (new 'stack-no-clear 'vector) v1-67 (-> sv-768 state mesh bounds)) - ) + (let ((a3-3 (new 'stack-no-clear 'vector)) + (sv-768 (-> this nav)) + (a1-17 (-> sv-704 poly)) + (sv-784 (-> s5-0 s0-0)) + ) + (let ((v1-67 (-> s5-0 s0-0))) + (project-point-onto-plane-of-poly-local + (-> sv-768 state mesh) + a1-17 + sv-784 + a3-3 + (vector-! (new 'stack-no-clear 'vector) v1-67 (-> sv-768 state mesh bounds)) ) ) - ) - (let ((v1-68 sv-784)) - (let ((a0-38 (-> sv-768 state mesh bounds))) - (.mov.vf.w vf6 vf0) - (.lvf vf4 (&-> sv-784 quad)) - (.lvf vf5 (&-> a0-38 quad)) + (let ((v1-68 sv-784)) + (let ((a0-38 (-> sv-768 state mesh bounds))) + (.mov.vf.w vf6 vf0) + (.lvf vf4 (&-> sv-784 quad)) + (.lvf vf5 (&-> a0-38 quad)) + ) + (.add.vf.xyz vf6 vf4 vf5) + (.svf (&-> v1-68 quad) vf6) ) - (.add.vf.xyz vf6 vf4 vf5) - (.svf (&-> v1-68 quad) vf6) ) 0 (+! (-> s5-0 s0-0 y) 32768.0) @@ -2287,26 +2175,26 @@ (+! s0-0 1) ) ) - (set! sv-720 (+ sv-720 1)) - ) - (when arg1 - (cond - ((and (zero? s0-0) (!= f30-0 0.0)) - (set! (-> s5-0 0 quad) (-> s1-0 quad)) - ) - ((zero? s0-0) - ) - (else - (set! (-> s5-0 0 quad) (-> s5-0 (rand-vu-int-count s0-0) quad)) - ) - ) - (set! (-> s3-0 y) (-> arg0 y)) - (set-traj-towards-vec this arg0 s3-0 (-> s5-0 0)) + (+! sv-720 1) ) ) - (else - (format 0 "~A bad current poly~%" (-> this name)) - ) + (when arg1 + (cond + ((and (zero? s0-0) (!= f30-0 0.0)) + (set! (-> s5-0 0 quad) (-> s1-0 quad)) + ) + ((zero? s0-0) + ) + (else + (set! (-> s5-0 0 quad) (-> s5-0 (rand-vu-int-count s0-0) quad)) + ) + ) + (set! (-> s3-0 y) (-> arg0 y)) + (set-traj-towards-vec this arg0 s3-0 (-> s5-0 0)) + ) + ) + (else + (format 0 "~A bad current poly~%" (-> this name)) ) ) ) @@ -2567,13 +2455,7 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch float vs none. (defmethod squid-post ((this squid)) - (local-vars - (v0-33 object) - (s5-9 int) - (sv-496 - (function skeleton-group int joint-exploder-tuning joint-exploder-static-params none :behavior joint-exploder) - ) - ) + (local-vars (v0-33 object) (s5-9 int)) (with-pp (if (= (-> this stage) 2) (script-eval '(want-anim "palace-boss-res")) @@ -2586,9 +2468,7 @@ (cloest-point-on-mesh (-> this nav) (-> this trans) (-> this trans) (-> this current-nav-poly)) ) (set! (-> this trans y) (-> s5-0 y)) - (let ((f0-2 409.6)) - (set! (-> this mesh-forced) (< (* f0-2 f0-2) (vector-vector-distance-squared (-> this trans) s5-0))) - ) + (set! (-> this mesh-forced) (< (square 409.6) (vector-vector-distance-squared (-> this trans) s5-0))) ) ) (setup-part-engine this #f) @@ -2832,33 +2712,16 @@ ) (dotimes (s3-4 6) (let ((s1-2 (handle->process (-> this tentacles s3-4)))) - (when s1-2 - (let ((s2-2 (get-process *default-dead-pool* joint-exploder #x4000))) - (when s2-2 - (let ((t9-67 (method-of-type joint-exploder activate))) - (t9-67 - (the-as joint-exploder s2-2) - s1-2 - (symbol->string (-> joint-exploder symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s1-3 run-function-in-process) - (s0-1 s2-2) - ) - (set! sv-496 joint-exploder-init-by-other) - (let ((a2-30 (art-group-get-by-name *level* "skel-squid-tentacle-shield" (the-as (pointer uint32) #f))) - (a3-14 67) - (t0-11 s4-10) - (t1-8 *squid-tentacle-shield-exploder-params*) - ) - ((the-as (function object object object object object object none) s1-3) s0-1 sv-496 a2-30 a3-14 t0-11 t1-8) - ) - ) - (-> s2-2 ppointer) + (if s1-2 + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-squid-tentacle-shield" (the-as (pointer uint32) #f)) + 67 + s4-10 + *squid-tentacle-shield-exploder-params* + :to s1-2 ) ) - ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc b/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc index d7d21ca4ec..c45cb76a4d 100644 --- a/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/boss/squid-states_REF.gc @@ -251,9 +251,9 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defbehavior go-through-wall squid () - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint (-> self stage)) (-> sv-16 elt-count))) (let ((gp-0 (-> v1-1 (-> self stage)))) (dotimes (s5-0 (-> gp-0 length)) @@ -532,20 +532,6 @@ ) ) :trans (behavior () - (local-vars - (sv-80 symbol) - (sv-96 symbol) - (sv-112 vector) - (sv-128 matrix) - (sv-144 symbol) - (sv-160 symbol) - (sv-176 vector) - (sv-192 matrix) - (sv-208 symbol) - (sv-224 symbol) - (sv-240 vector) - (sv-256 matrix) - ) (quaternion-rotate-y! (-> self quat) (-> self quat) 5461.3335) (vector-lerp! (-> self trans) @@ -563,109 +549,31 @@ (cond ((zero? (-> self stage)) (setup-masks (-> self draw) 320 160) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-4 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker gp-4) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-3 run-function-in-process) - (s4-1 gp-4) - (s3-1 part-tracker-init) - (s2-0 group-squid-whirlwind-explode) - (s1-0 0) - (s0-0 #f) - ) - (set! sv-80 (the-as symbol #f)) - (set! sv-96 (the-as symbol #f)) - (set! sv-128 *launch-matrix*) - (set! sv-112 (-> sv-128 trans)) - (let ((v1-33 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunR)) quad))) - (set! (-> sv-112 quad) v1-33) - ) - ((the-as (function object object object object object object object object none) s5-3) - s4-1 - s3-1 - s2-0 - s1-0 - s0-0 - sv-80 - sv-96 - sv-128 - ) - ) - (-> gp-4 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-whirlwind-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg gunR)) ) ) ((= (-> self stage) 1) (setup-masks (-> self draw) 5120 2590) - (let ((gp-5 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-5 - (let ((t9-16 (method-of-type part-tracker activate))) - (t9-16 (the-as part-tracker gp-5) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-4 run-function-in-process) - (s4-2 gp-5) - (s3-2 part-tracker-init) - (s2-1 group-squid-whirlwind-explode) - (s1-1 0) - (s0-1 #f) - ) - (set! sv-144 (the-as symbol #f)) - (set! sv-160 (the-as symbol #f)) - (set! sv-192 *launch-matrix*) - (set! sv-176 (-> sv-192 trans)) - (let ((v1-47 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) quad))) - (set! (-> sv-176 quad) v1-47) - ) - ((the-as (function object object object object object object object object none) s5-4) - s4-2 - s3-2 - s2-1 - s1-1 - s0-1 - sv-144 - sv-160 - sv-192 - ) - ) - (-> gp-5 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-whirlwind-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) ) ) (else - (let ((gp-6 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-6 - (let ((t9-20 (method-of-type part-tracker activate))) - (t9-20 (the-as part-tracker gp-6) self (symbol->string (-> part-tracker symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-5 run-function-in-process) - (s4-3 gp-6) - (s3-3 part-tracker-init) - (s2-2 group-squid-whirlwind-explode) - (s1-2 0) - (s0-2 #f) - ) - (set! sv-208 (the-as symbol #f)) - (set! sv-224 (the-as symbol #f)) - (set! sv-256 *launch-matrix*) - (set! sv-240 (-> sv-256 trans)) - (let ((v1-59 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) quad))) - (set! (-> sv-240 quad) v1-59) - ) - ((the-as (function object object object object object object object object none) s5-5) - s4-3 - s3-3 - s2-2 - s1-2 - s0-2 - sv-208 - sv-224 - sv-256 - ) - ) - (-> gp-6 ppointer) - ) + (part-tracker-spawn + :to self + :group group-squid-whirlwind-explode + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node squid-lod0-jg podR)) ) ) ) @@ -989,11 +897,7 @@ (s2-0 (new 'stack 'clamp-travel-vector-to-mesh-return-info)) ) (if (and (time-elapsed? (-> self state-time) (seconds 0.017)) - (let ((f0-8 (vector-vector-xz-distance-squared (-> self traj-dest) (-> self trans))) - (f1-1 8192.0) - ) - (< f0-8 (* f1-1 f1-1)) - ) + (< (vector-vector-xz-distance-squared (-> self traj-dest) (-> self trans)) (square 8192.0)) ) (go-virtual fly-to-shoot-spot) ) @@ -1674,18 +1578,14 @@ ) (else (when (task-node-closed? (game-task-node palace-boss-introduction)) - (let ((f0-2 (vector-vector-xz-distance-squared (-> self trans) (target-pos 0))) - (f1-1 217088.0) - ) + (let ((f0-2 (vector-vector-xz-distance-squared (-> self trans) (target-pos 0)))) (cond - ((< f0-2 (* f1-1 f1-1)) + ((< f0-2 (square 217088.0)) (set! (-> self allowed-rotate-to-vector-angle) 32768.0) (squid-method-43 self (squid-method-42 self (new 'stack-no-clear 'vector)) 32585.955 0.999) (go-virtual idle) ) - ((let ((f1-4 286720.0)) - (< f0-2 (* f1-4 f1-4)) - ) + ((< f0-2 (square 286720.0)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc b/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc index 8c95a20db4..5af4f7f08c 100644 --- a/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/palace/cable/palcab-obs_REF.gc @@ -153,7 +153,6 @@ ) :code sleep-code :post (behavior () - (local-vars (sv-112 vector) (sv-128 vector) (sv-144 lightning-control)) (let ((v1-0 (-> self root)) (f30-0 4369.067) (f28-0 (* (-> self rotate-speed) (seconds-per-frame))) @@ -179,16 +178,18 @@ (set-vector! s2-0 0.0 (-> s0-0 dist) 0.0 1.0) (vector-orient-by-quat! s2-0 s2-0 s1-0) (vector+! s2-0 s2-0 (-> self root trans)) - (set! sv-112 (new 'stack-no-clear 'vector)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (set! sv-144 (-> s0-0 lightning)) - (set-vector! sv-112 (-> s0-0 radius) 0.0 0.0 0.0) - (quaternion-rotate-local-z! s1-0 s1-0 (-> s0-0 local-z-rotate)) - (dotimes (s0-1 16) - (vector-orient-by-quat! sv-128 sv-112 s1-0) - (vector*! sv-128 sv-128 gp-0) - (set-point! sv-144 s0-1 (vector+! (new 'stack-no-clear 'vector) s2-0 sv-128)) - (quaternion-rotate-local-y! s1-0 s1-0 f30-0) + (let ((sv-112 (new 'stack-no-clear 'vector)) + (sv-128 (new 'stack-no-clear 'vector)) + (sv-144 (-> s0-0 lightning)) + ) + (set-vector! sv-112 (-> s0-0 radius) 0.0 0.0 0.0) + (quaternion-rotate-local-z! s1-0 s1-0 (-> s0-0 local-z-rotate)) + (dotimes (s0-1 16) + (vector-orient-by-quat! sv-128 sv-112 s1-0) + (vector*! sv-128 sv-128 gp-0) + (set-point! sv-144 s0-1 (vector+! (new 'stack-no-clear 'vector) s2-0 sv-128)) + (quaternion-rotate-local-y! s1-0 s1-0 f30-0) + ) ) ) ) @@ -855,7 +856,7 @@ (let* ((f0-10 (the float (sar (shl (the int (quaternion-z-angle (-> self root quat))) 48) 48))) (f0-12 (fabs (cos f0-10))) ) - (set-palcab-turret-flash! (* f30-0 (* f0-12 f0-12 f0-12))) + (set-palcab-turret-flash! (* f30-0 (* (square f0-12) f0-12))) ) ) (let ((f30-2 (+ 32768.0 (the float (sar (shl (the int (quaternion-z-angle (-> self root quat))) 48) 48))))) diff --git a/test/decompiler/reference/jak2/levels/ruins/pillar-collapse_REF.gc b/test/decompiler/reference/jak2/levels/ruins/pillar-collapse_REF.gc index f119ffce5b..183afeafdc 100644 --- a/test/decompiler/reference/jak2/levels/ruins/pillar-collapse_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/pillar-collapse_REF.gc @@ -223,7 +223,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape-moving)) (stack-size-set! (-> this main-thread) 512) (logior! (-> this mask) (process-mask collectable)) (dotimes (v1-3 3) @@ -282,28 +281,29 @@ (s1-0 (-> (the-as pair s2-0) car)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) - (let ((a3-2 (command-get-int (-> (the-as pair s1-0) car) 0)) - (t0-1 0) + (let ((sv-16 + (new + 'process + 'collide-shape-prim-mesh + s4-0 + (the-as uint (command-get-int (-> (the-as pair s1-0) car) 0)) + (the-as uint 0) + ) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) + ) + (set-vector! + (-> sv-16 local-sphere) + 0.0 + 0.0 + 0.0 + (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) - ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s1-0) cdr)) car) 0)) - ) - (set-vector! - (-> sv-16 local-sphere) - 0.0 - 0.0 - 0.0 - (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s1-0) cdr)) cdr)) car) 0.0) ) (set! s2-0 (-> (the-as pair s2-0) cdr)) (set! s1-0 (-> (the-as pair s2-0) car)) diff --git a/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc b/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc index e776f21e25..92faf1fe4e 100644 --- a/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/rapid-gunner_REF.gc @@ -1471,7 +1471,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this rapid-gunner)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-48 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1514,8 +1513,9 @@ (logclear! (-> this status-flags) (rapid-gunner-flags ragflags-0)) (logior! (-> this status-flags) (rapid-gunner-flags ragflags-1)) (let ((f30-0 3640.889)) - (set! sv-48 0) - (let ((v1-22 (res-lump-data (-> this entity) 'spinup-angle pointer :tag-ptr (the-as (pointer res-tag) (& sv-48))))) + (let* ((sv-48 0) + (v1-22 (res-lump-data (-> this entity) 'spinup-angle pointer :tag-ptr (the-as (pointer res-tag) (& sv-48)))) + ) (if v1-22 (set! f30-0 (-> (the-as (pointer float) v1-22))) ) diff --git a/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc b/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc index fded9fa35b..3ec72fac2a 100644 --- a/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/ruins/ruins-obs_REF.gc @@ -181,13 +181,9 @@ (defstate idle (beam) :virtual #t :trans (behavior () - (let ((f0-0 (vector-vector-distance-squared (-> self root trans) (camera-pos))) - (f1-0 102400.0) - ) - (if (< f0-0 (* f1-0 f1-0)) - (go-virtual collapse) - ) - ) + (if (< (vector-vector-distance-squared (-> self root trans) (camera-pos)) (square 102400.0)) + (go-virtual collapse) + ) ) :code sleep-code ) diff --git a/test/decompiler/reference/jak2/levels/sewer/hosehead-fake_REF.gc b/test/decompiler/reference/jak2/levels/sewer/hosehead-fake_REF.gc index a755d5b97f..3c58eedca8 100644 --- a/test/decompiler/reference/jak2/levels/sewer/hosehead-fake_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/hosehead-fake_REF.gc @@ -288,11 +288,9 @@ :event hosehead-fake-event-handler :trans (behavior () (vector-seek-3d-smooth! (-> self root trans) (-> self walk-dest) (* 24576.0 (seconds-per-frame)) 0.8) - (let ((f0-2 409.6)) - (if (>= (* f0-2 f0-2) (vector-vector-distance-squared (-> self root trans) (-> self walk-dest))) - (go-virtual idle) - ) - ) + (if (>= (square 409.6) (vector-vector-distance-squared (-> self root trans) (-> self walk-dest))) + (go-virtual idle) + ) ) :code (behavior () (ja-channel-push! 1 (seconds 0.1)) diff --git a/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc b/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc index f5b403d5a7..1190fa02be 100644 --- a/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/hosehead_REF.gc @@ -1221,14 +1221,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-7 vf1) - (let ((f0-4 a2-7) - (f1-1 (+ (-> a1-5 world-sphere w) (-> gp-1 w))) - ) - (when (< f0-4 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-7 (square (+ (-> a1-5 world-sphere w) (-> gp-1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1262,14 +1258,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-14 vf1) - (let ((f0-5 a2-14) - (f1-5 (+ (-> a1-17 world-sphere w) (-> gp-1 w))) - ) - (when (< f0-5 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-14 (square (+ (-> a1-17 world-sphere w) (-> gp-1 w)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -1287,16 +1279,15 @@ (when (logtest? (-> v1-30 root-prim prim-core collide-as) (collide-spec jak bot enemy hit-by-others-list player-list) ) - (let ((f0-6 (if (= (-> v1-30 process type) target) - 28672.0 - 20480.0 + (if (>= (square (if (= (-> v1-30 process type) target) + 28672.0 + 20480.0 + ) ) - ) - ) - (if (>= (* f0-6 f0-6) (vector-vector-xz-distance-squared gp-1 (-> v1-30 trans))) - (return #f) - ) - ) + (vector-vector-xz-distance-squared gp-1 (-> v1-30 trans)) + ) + (return #f) + ) ) ) ) @@ -1507,7 +1498,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod hosehead-method-196 ((this hosehead)) - (local-vars (sv-768 nav-control) (sv-784 vector) (sv-800 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1557,18 +1547,21 @@ (when (not (add-root-sphere-to-hash! (-> this nav) a1-5 32)) (when (< f30-0 f28-0) (set! f30-0 f28-0) - (let ((s0-0 (new 'stack-no-clear 'vector))) - (set! sv-784 (new 'stack-no-clear 'vector)) - (let ((s1-1 (new 'stack 'collide-query))) - (set! sv-768 (-> this nav)) - (set! sv-800 s0-0) - (let* ((v1-22 s3-0) - (a0-14 (-> sv-768 state mesh)) - (t9-5 (method-of-object a0-14 project-point-onto-plane-of-poly-local)) - (a2-6 sv-800) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-22 (-> sv-768 state mesh bounds))) - ) - (t9-5 a0-14 s2-0 a2-6 sv-784 t0-1) + (let ((s0-0 (new 'stack-no-clear 'vector)) + (sv-784 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack 'collide-query)) + ) + (let ((sv-768 (-> this nav)) + (sv-800 s0-0) + ) + (let ((v1-22 s3-0)) + (project-point-onto-plane-of-poly-local + (-> sv-768 state mesh) + s2-0 + sv-800 + sv-784 + (vector-! (new 'stack-no-clear 'vector) v1-22 (-> sv-768 state mesh bounds)) + ) ) (let ((v1-23 sv-800)) (let ((a0-17 (-> sv-768 state mesh bounds))) @@ -1579,12 +1572,12 @@ (.add.vf.xyz vf6 vf4 vf5) (.svf (&-> v1-23 quad) vf6) ) - 0 - (set! (-> s3-0 y) (-> s0-0 y)) - (if (enemy-above-ground? this s1-1 s3-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s3-0 y) (-> s1-1 best-other-tri intersect y)) - ) ) + 0 + (set! (-> s3-0 y) (-> s0-0 y)) + (if (enemy-above-ground? this s1-1 s3-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s3-0 y) (-> s1-1 best-other-tri intersect y)) + ) ) (set! (-> this jump-point quad) (-> s3-0 quad)) ) @@ -1606,7 +1599,6 @@ :virtual #t :event enemy-event-handler :enter (behavior () - (local-vars (sv-688 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1660,28 +1652,29 @@ (let ((s2-0 (find-poly-containing-point-local (-> v1-16 state mesh) a1-4))) (set! (-> self jump-point quad) (-> s5-0 quad)) (when s2-0 - (let ((s3-0 (new 'stack-no-clear 'vector))) - (set! sv-688 (new 'stack-no-clear 'vector)) - (let ((s4-1 (new 'stack 'collide-query))) - (let ((s0-0 (-> self nav)) - (s1-0 s3-0) - ) - (let* ((v1-22 s5-0) - (a0-15 (-> s0-0 state mesh)) - (t9-5 (method-of-object a0-15 project-point-onto-plane-of-poly-local)) - (a2-2 s1-0) - (t0-1 (vector-! (new 'stack-no-clear 'vector) v1-22 (-> s0-0 state mesh bounds))) - ) - (t9-5 a0-15 s2-0 a2-2 sv-688 t0-1) + (let ((s3-0 (new 'stack-no-clear 'vector)) + (sv-688 (new 'stack-no-clear 'vector)) + (s4-1 (new 'stack 'collide-query)) + ) + (let ((s0-0 (-> self nav)) + (s1-0 s3-0) + ) + (let ((v1-22 s5-0)) + (project-point-onto-plane-of-poly-local + (-> s0-0 state mesh) + s2-0 + s1-0 + sv-688 + (vector-! (new 'stack-no-clear 'vector) v1-22 (-> s0-0 state mesh bounds)) ) - (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) - ) - 0 - (set! (-> s5-0 y) (-> s3-0 y)) - (when (enemy-above-ground? self s4-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) - (set! (-> s5-0 y) (-> s4-1 best-other-tri intersect y)) - (set! gp-0 #t) ) + (vector+! s1-0 s1-0 (-> s0-0 state mesh bounds)) + ) + 0 + (set! (-> s5-0 y) (-> s3-0 y)) + (when (enemy-above-ground? self s4-1 s5-0 (collide-spec backgnd) 8192.0 81920.0 1024.0) + (set! (-> s5-0 y) (-> s4-1 best-other-tri intersect y)) + (set! gp-0 #t) ) ) (set! (-> self jump-point quad) (-> s5-0 quad)) @@ -2077,9 +2070,8 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defmethod hosehead-method-187 ((this hosehead) (arg0 vector)) - (local-vars (sv-128 vector)) - (set! sv-128 (new 'stack-no-clear 'vector)) - (let ((s3-0 (new 'stack-no-clear 'vector)) + (let ((sv-128 (new 'stack-no-clear 'vector)) + (s3-0 (new 'stack-no-clear 'vector)) (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack-no-clear 'vector)) (s4-0 (new 'stack-no-clear 'vector)) @@ -2335,7 +2327,6 @@ ;; WARN: Return type mismatch int vs none. (defmethod init-enemy! ((this hosehead)) "Common method called to initialize the enemy, typically sets up default field values and calls ancillary helper methods" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (stack-size-set! (-> this main-thread) 256) (set! (-> this on-stop-sentry) #f) (initialize-skeleton @@ -2343,8 +2334,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-hosehead" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-5 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a0-5 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when a0-5 (let ((v1-7 (-> this root))) (+! (-> v1-7 trans x) (-> a0-5 0)) @@ -2399,8 +2391,9 @@ (idle-control-method-9 (-> this idle-anim-player) *hosehead-idle-wall*) (idle-control-method-9 (-> this idle-anim-player) *hosehead-idle-ground*) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-49 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-49 (nonzero? (-> sv-32 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-49)) diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc index 53450e4d45..a90fb907e8 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-obs2_REF.gc @@ -366,7 +366,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (tag-1 res-tag) (tag-2 res-tag)) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) (set! (-> cshape reaction) cshape-reaction-default) @@ -398,13 +397,15 @@ (set! (-> this spin) 0.0) (set! (-> this spin-rate) 0.0) (set! (-> this joint) (new 'process 'joint-mod-rotate-local this 4 #f)) - (set! tag-1 (new 'static 'res-tag)) - (set! (-> this actor-group) - (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& tag-1)) - ) - (set! (-> this actor-group-count) (the-as int (-> tag-1 elt-count))) - (set! tag-2 (new 'static 'res-tag)) - (let ((data (res-lump-data (-> this entity) 'extra-float-param pointer :tag-ptr (& tag-2)))) + (let ((tag-1 (new 'static 'res-tag))) + (set! (-> this actor-group) + (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& tag-1)) + ) + (set! (-> this actor-group-count) (the-as int (-> tag-1 elt-count))) + ) + (let* ((tag-2 (new 'static 'res-tag)) + (data (res-lump-data (-> this entity) 'extra-float-param pointer :tag-ptr (& tag-2))) + ) (if (and data (nonzero? (-> tag-2 elt-count))) (set! (-> this water-height) (-> (the-as (pointer float) data))) (set! (-> this water-height) 0.0) @@ -785,7 +786,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape-moving)) (stack-size-set! (-> this main-thread) 512) (let ((cshape (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) (set! (-> cshape dynam) (copy *standard-dynamics* 'process)) @@ -822,23 +822,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((_prim-mesh (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 cshape) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh cshape (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (_prim-mesh sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> prim-group prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> prim-group prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> prim-group prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> prim-group prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> prim-group prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> prim-group prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc index 9d6c75594e..c4b996d8f8 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-obs_REF.gc @@ -1039,7 +1039,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (tag res-tag)) (init-switch-collision! this) (process-drawable-from-entity! this entity) (initialize-skeleton @@ -1048,8 +1047,9 @@ (the-as pair 0) ) (process-entity-status! this (entity-perm-status no-kill) #t) - (set! tag (new 'static 'res-tag)) - (let ((data (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& tag)))) + (let* ((tag (new 'static 'res-tag)) + (data (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& tag))) + ) (cond ((and data (nonzero? (-> tag elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) data)) diff --git a/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc b/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc index f2951301f2..8c4b6253a9 100644 --- a/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc +++ b/test/decompiler/reference/jak2/levels/sewer/sewer-scenes_REF.gc @@ -1326,7 +1326,6 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (local-vars (sv-96 int) (sv-100 float) (sv-104 vector)) (set-time! (-> self start-time)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-gunturret :init hud-init-by-other :to self))) (while (> (-> self data-int32 0) 0) @@ -1337,45 +1336,48 @@ ) (deactivate self) ) - (set! sv-96 (-> self data-int32 1)) - (set! sv-100 4095996000.0) - (set! sv-104 (target-pos 0)) - (when (-> self actor-group 0) - (dotimes (gp-2 (the-as int (-> self actor-group 0 0))) - (let ((s5-0 (-> (&+ (-> self actor-group 0) (* gp-2 8)) 3))) - (let ((f0-1 (vector-vector-distance sv-104 (-> s5-0 extra trans)))) - (if (< f0-1 sv-100) - (set! sv-100 f0-1) + (let ((sv-96 (-> self data-int32 1)) + (sv-100 4095996000.0) + ) + (let ((sv-104 (target-pos 0))) + (when (-> self actor-group 0) + (dotimes (gp-2 (the-as int (-> self actor-group 0 0))) + (let ((s5-0 (-> (&+ (-> self actor-group 0) (* gp-2 8)) 3))) + (let ((f0-1 (vector-vector-distance sv-104 (-> s5-0 extra trans)))) + (if (< f0-1 sv-100) + (set! sv-100 f0-1) + ) ) - ) - (if (and s5-0 (logtest? (-> s5-0 extra perm status) (entity-perm-status dead))) - (set! sv-96 (+ sv-96 -1)) + (if (and s5-0 (logtest? (-> s5-0 extra perm status) (entity-perm-status dead))) + (+! sv-96 -1) + ) ) + ) ) ) - ) - (when (< sv-96 (-> self data-int32 0)) - (case sv-96 - ((3) - (talker-spawn-func (-> *talker-speech* 462) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((2) - (talker-spawn-func (-> *talker-speech* 463) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((1) - (talker-spawn-func (-> *talker-speech* 464) *entity-pool* (target-pos 0) (the-as region #f)) - ) + (when (< sv-96 (-> self data-int32 0)) + (case sv-96 + ((3) + (talker-spawn-func (-> *talker-speech* 462) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((2) + (talker-spawn-func (-> *talker-speech* 463) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((1) + (talker-spawn-func (-> *talker-speech* 464) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + ) + (let ((v1-51 sv-96)) + (set! (-> self data-int32 0) v1-51) + (set! (-> *game-info* counter) (the float v1-51)) + ) + (when (and (= (-> self data-int32 1) sv-96) + (and (< sv-100 122880.0) (time-elapsed? (-> self beep-time) (seconds 40))) + ) + (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) + (set-time! (-> self beep-time)) ) - ) - (let ((v1-51 sv-96)) - (set! (-> self data-int32 0) v1-51) - (set! (-> *game-info* counter) (the float v1-51)) - ) - (when (and (= (-> self data-int32 1) sv-96) - (and (< sv-100 122880.0) (time-elapsed? (-> self beep-time) (seconds 40))) - ) - (talker-spawn-func (-> *talker-speech* 53) *entity-pool* (target-pos 0) (the-as region #f)) - (set-time! (-> self beep-time)) ) (suspend) ) diff --git a/test/decompiler/reference/jak2/levels/stadium/skate/skatea-obs_REF.gc b/test/decompiler/reference/jak2/levels/stadium/skate/skatea-obs_REF.gc index 73d7aea282..6199fa5912 100644 --- a/test/decompiler/reference/jak2/levels/stadium/skate/skatea-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/stadium/skate/skatea-obs_REF.gc @@ -1337,9 +1337,9 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-1 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-1)) diff --git a/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc b/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc index 8f92b2d494..58ca55069b 100644 --- a/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc @@ -220,7 +220,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 symbol) (sv-48 type) (sv-64 collide-shape)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 8) 0))) (set! (-> s4-0 total-prims) (the-as uint 9)) @@ -235,23 +234,18 @@ (s1-0 (car s2-0)) ) (while (not (null? s2-0)) - (let ((s0-0 (method-of-type collide-shape-prim-mesh new))) - (set! sv-32 'process) - (set! sv-48 collide-shape-prim-mesh) - (set! sv-64 s4-0) - (let ((a3-2 (command-get-int (car s1-0) 0)) - (t0-1 0) + (let ((sv-16 + (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint (command-get-int (car s1-0) 0)) (the-as uint 0)) ) - (set! sv-16 (s0-0 sv-32 sv-48 sv-64 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s0-1 sv-16)) + (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) + (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) + (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) + (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) ) + (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) ) - (let ((s0-1 sv-16)) - (set! (-> s0-1 prim-core collide-as) (-> s3-0 prim-core collide-as)) - (set! (-> s0-1 prim-core collide-with) (-> s3-0 prim-core collide-with)) - (set! (-> s0-1 prim-core action) (-> s3-0 prim-core action)) - (set! (-> s0-1 transform-index) (command-get-int (car (cdr s1-0)) 0)) - ) - (set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 (command-get-float (car (cdr (cdr s1-0))) 0.0)) (set! s2-0 (cdr s2-0)) (set! s1-0 (car s2-0)) ) @@ -480,7 +474,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch int vs none. (defbehavior rift-rider-travel-post rift-rider () - (local-vars (sv-736 rift-rider) (sv-752 rift-rider) (sv-768 vector)) (if (not (-> self escort-actor 0)) (set! (-> self escort-actor 0) (entity-actor-lookup (-> self entity) 'alt-actor 0)) ) @@ -524,15 +517,16 @@ (target-pos 0) (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> gp-0 quat))) (f30-0 0.0) - (s3-0 (lambda ((arg0 rift-rider) (arg1 vector) (arg2 vector) (arg3 vector)) - (let ((f0-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) arg2 arg1) arg3))) - (if (< f0-1 0.0) - (- f0-1) - 0.0 - ) + (s3-0 + (lambda ((arg0 rift-rider) (arg1 vector) (arg2 vector) (arg3 vector)) + (let ((f0-1 (vector-dot (vector-! (new 'stack-no-clear 'vector) arg2 arg1) arg3))) + (if (< f0-1 0.0) + (- f0-1) + 0.0 ) - ) ) + ) + ) ) (let ((s0-0 (new 'stack-no-clear 'vector)) (v1-13 0) @@ -554,48 +548,40 @@ ) ) (when s1-0 - (let ((s0-1 s3-0)) - (set! sv-736 self) - (let ((a1-11 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-11 from) (process->ppointer self)) - (set! (-> a1-11 num-params) 2) - (set! (-> a1-11 message) 'get-position) - (set! (-> a1-11 param 0) (the-as uint 'left)) - (set! (-> a1-11 param 1) (the-as uint (new 'stack-no-clear 'vector))) - (let ((a1-12 (send-event-function self a1-11)) - (a3-0 s4-0) - ) - (+! f30-0 (s0-1 sv-736 (the-as vector a1-12) (the-as vector s1-0) a3-0)) + (let ((s0-1 s3-0) + (sv-736 self) + ) + (+! f30-0 + (s0-1 + sv-736 + (the-as vector (send-event self 'get-position 'left (new 'stack-no-clear 'vector))) + (the-as vector s1-0) + s4-0 + ) ) - ) ) ) (when s2-0 (let ((s1-1 s3-0) (s0-2 self) ) - (+! f30-0 (s1-1 - s0-2 - (the-as vector (send-event self 'get-position 'right (new 'stack-no-clear 'vector))) - (the-as vector s2-0) - s4-0 - ) + (+! f30-0 + (s1-1 + s0-2 + (the-as vector (send-event self 'get-position 'right (new 'stack-no-clear 'vector))) + (the-as vector s2-0) + s4-0 + ) ) ) ) (seek! (-> self speed) (fmin 12288.0 (+ 2048.0 (vector-length s5-0))) (* 4096.0 (seconds-per-frame))) (set! (-> self speed) (* (-> self speed) (lerp-scale 1.0 0.0 f30-0 24576.0 49152.0))) - (let ((f30-1 (-> self speed)) - (s2-1 lerp-scale) - (s1-2 1.0) - (s0-3 0.0) + (set! (-> self speed) + (* (-> self speed) + (lerp-scale 1.0 0.0 (s3-0 self (-> self root trans) (target-pos 0) s4-0) 143360.0 245760.0) + ) ) - (set! sv-752 self) - (set! sv-768 (-> self root trans)) - (let ((a2-11 (target-pos 0))) - (set! (-> self speed) (* f30-1 (s2-1 s1-2 s0-3 (s3-0 sv-752 sv-768 a2-11 s4-0) 143360.0 245760.0))) - ) - ) ) ) ) @@ -2508,14 +2494,6 @@ ;; definition for method 29 of type stad-force-field ;; INFO: Used lq/sq (defmethod stad-force-field-method-29 ((this stad-force-field) (arg0 touching-shapes-entry)) - (local-vars - (sv-256 entity-actor) - (sv-272 collide-tri-result) - (sv-288 (function vector vector vector vector)) - (sv-304 vector) - (sv-320 vector) - (sv-336 vector) - ) (rlet ((vf0 :class vf) (vf4 :class vf) (vf5 :class vf) @@ -2531,36 +2509,18 @@ (if (handle->process (-> this ripple)) (deactivate (-> this ripple process 0)) ) - (let* ((s3-0 (get-process *default-dead-pool* manipy #x4000)) - (s4-0 (when s3-0 - (let ((t9-3 (method-of-type manipy activate))) - (t9-3 (the-as manipy s3-0) this (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-1 run-function-in-process) - (s2-0 s3-0) - (s1-0 manipy-init) - (s0-0 (-> this root trans)) - ) - (set! sv-256 (-> this entity)) - (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) - (t1-0 #f) - (t2-0 0) - ) - ((the-as (function object object object object object object object none) s4-1) - s2-0 - s1-0 - s0-0 - sv-256 - t0-0 - t1-0 - t2-0 - ) - ) - ) - (-> s3-0 ppointer) - ) - ) - ) + (let ((s4-0 (process-spawn + manipy + :init manipy-init + (-> this root trans) + (-> this entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to this + ) + ) + ) 0.0 0.0 0.0 @@ -2574,94 +2534,94 @@ (let ((s2-1 (-> arg0 head))) (while s2-1 (get-touched-prim s2-1 (-> this root) arg0) - (set! sv-272 (get-touched-tri s2-1 (-> this root) arg0)) - (when sv-272 - (quaternion-look-at! (-> (the-as process-drawable (-> s4-0 0)) root quat) (-> sv-272 normal) *up-vector*) - (set! (-> this plane quad) (-> sv-272 normal quad)) - (set! (-> this plane w) (- (vector-dot (-> sv-272 normal) (-> sv-272 vertex 0)))) - (let ((f30-0 (the-as float #x7f800000)) - (f28-0 (the-as float #xff800000)) - (s0-1 (new 'stack-no-clear 'vector)) - (s1-1 (new 'stack-no-clear 'vector)) - ) - (set! sv-336 (new 'stack-no-clear 'vector)) - (set! (-> s1-1 quad) (-> sv-272 vertex 0 quad)) - (vector+! s1-1 s1-1 (-> sv-272 vertex 1)) - (vector+! s1-1 s1-1 (-> sv-272 vertex 2)) - (vector-float*! s1-1 s1-1 0.33333334) - (set! sv-288 vector-flatten!) - (set! sv-304 sv-336) - (set! sv-320 (new 'stack-no-clear 'vector)) - (let ((v0-14 (target-pos 0)) - (v1-75 s1-1) + (let ((sv-272 (get-touched-tri s2-1 (-> this root) arg0))) + (when sv-272 + (quaternion-look-at! (-> (the-as process-drawable (-> s4-0 0)) root quat) (-> sv-272 normal) *up-vector*) + (set! (-> this plane quad) (-> sv-272 normal quad)) + (set! (-> this plane w) (- (vector-dot (-> sv-272 normal) (-> sv-272 vertex 0)))) + (let ((f30-0 (the-as float #x7f800000)) + (f28-0 (the-as float #xff800000)) + (s0-1 (new 'stack-no-clear 'vector)) + (s1-1 (new 'stack-no-clear 'vector)) ) - (.lvf vf4 (&-> v0-14 quad)) - (.lvf vf5 (&-> v1-75 quad)) - ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-320 quad) vf6) - (let ((a2-9 (-> sv-272 normal))) - (sv-288 sv-304 sv-320 a2-9) - ) - (vector+! sv-336 s1-1 sv-336) - (vector-inv-orient-by-quat! - s0-1 - (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 0) s1-1) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - ) - (if (< (-> s0-1 x) f30-0) - (set! f30-0 (-> s0-1 x)) - ) - (if (< f28-0 (-> s0-1 x)) - (set! f28-0 (-> s0-1 x)) - ) - (vector-inv-orient-by-quat! - s0-1 - (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 1) s1-1) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - ) - (if (< (-> s0-1 x) f30-0) - (set! f30-0 (-> s0-1 x)) - ) - (if (< f28-0 (-> s0-1 x)) - (set! f28-0 (-> s0-1 x)) - ) - (vector-inv-orient-by-quat! - s0-1 - (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 2) s1-1) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - ) - (if (< (-> s0-1 x) f30-0) - (set! f30-0 (-> s0-1 x)) - ) - (if (< f28-0 (-> s0-1 x)) - (set! f28-0 (-> s0-1 x)) - ) - (let ((t9-17 vector-inv-orient-by-quat!) - (a0-49 s0-1) - (a1-27 (new 'stack-no-clear 'vector)) - (v1-103 s1-1) + (let ((sv-336 (new 'stack-no-clear 'vector))) + (set! (-> s1-1 quad) (-> sv-272 vertex 0 quad)) + (vector+! s1-1 s1-1 (-> sv-272 vertex 1)) + (vector+! s1-1 s1-1 (-> sv-272 vertex 2)) + (vector-float*! s1-1 s1-1 0.33333334) + (let ((sv-288 vector-flatten!) + (sv-304 sv-336) + (sv-320 (new 'stack-no-clear 'vector)) + ) + (let ((v0-14 (target-pos 0)) + (v1-75 s1-1) + ) + (.lvf vf4 (&-> v0-14 quad)) + (.lvf vf5 (&-> v1-75 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-320 quad) vf6) + (sv-288 sv-304 sv-320 (-> sv-272 normal)) ) - (t9-17 a0-49 (vector-! a1-27 sv-336 v1-103) (-> (the-as process-drawable (-> s4-0 0)) root quat)) + (vector+! sv-336 s1-1 sv-336) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 0) s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + (if (< (-> s0-1 x) f30-0) + (set! f30-0 (-> s0-1 x)) + ) + (if (< f28-0 (-> s0-1 x)) + (set! f28-0 (-> s0-1 x)) + ) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 1) s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + (if (< (-> s0-1 x) f30-0) + (set! f30-0 (-> s0-1 x)) + ) + (if (< f28-0 (-> s0-1 x)) + (set! f28-0 (-> s0-1 x)) + ) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) (-> sv-272 vertex 2) s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + (if (< (-> s0-1 x) f30-0) + (set! f30-0 (-> s0-1 x)) + ) + (if (< f28-0 (-> s0-1 x)) + (set! f28-0 (-> s0-1 x)) + ) + (vector-inv-orient-by-quat! + s0-1 + (vector-! (new 'stack-no-clear 'vector) sv-336 s1-1) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + ) + ) + (let* ((f0-17 (-> s0-1 x)) + (f28-1 (fmin f28-0 (+ 16384.0 f0-17))) + (f30-1 (fmax f30-0 (+ -16384.0 f0-17))) + ) + (set! (-> s0-1 x) (* 0.5 (+ f30-1 f28-1))) + (vector-orient-by-quat! s0-1 s0-1 (-> (the-as process-drawable (-> s4-0 0)) root quat)) + (vector+! s1-1 s1-1 s0-1) + (set! (-> (the-as process-drawable (-> s4-0 0)) root trans quad) (-> s1-1 quad)) + (set! (-> (the-as process-drawable (-> s4-0 0)) root trans y) (-> (target-pos 0) y)) + (set-vector! s3-1 (* 0.000061035156 (- f28-1 f30-1)) 4.0 4.0 1.0) + ) ) - (let* ((f0-17 (-> s0-1 x)) - (f28-1 (fmin f28-0 (+ 16384.0 f0-17))) - (f30-1 (fmax f30-0 (+ -16384.0 f0-17))) - ) - (set! (-> s0-1 x) (* 0.5 (+ f30-1 f28-1))) - (vector-orient-by-quat! s0-1 s0-1 (-> (the-as process-drawable (-> s4-0 0)) root quat)) - (vector+! s1-1 s1-1 s0-1) - (set! (-> (the-as process-drawable (-> s4-0 0)) root trans quad) (-> s1-1 quad)) - (set! (-> (the-as process-drawable (-> s4-0 0)) root trans y) (-> (target-pos 0) y)) - (set-vector! s3-1 (* 0.000061035156 (- f28-1 f30-1)) 4.0 4.0 1.0) + (quaternion-rotate-local-x! + (-> (the-as process-drawable (-> s4-0 0)) root quat) + (-> (the-as process-drawable (-> s4-0 0)) root quat) + -16384.0 ) ) - (quaternion-rotate-local-x! - (-> (the-as process-drawable (-> s4-0 0)) root quat) - (-> (the-as process-drawable (-> s4-0 0)) root quat) - -16384.0 - ) ) (set! s2-1 (-> s2-1 next)) ) diff --git a/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc b/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc index 5544deb6fb..f87597c9cc 100644 --- a/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc +++ b/test/decompiler/reference/jak2/levels/strip/chaincrate_REF.gc @@ -369,7 +369,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 int)) (set! (-> this root) (new 'process 'trsqv)) (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0)) (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) @@ -377,8 +376,9 @@ (f26-0 131072.0) (f30-0 0.0) ) - (set! sv-16 0) - (let ((v1-8 (res-lump-data arg0 'speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16))))) + (let* ((sv-16 0) + (v1-8 (res-lump-data arg0 'speed (pointer float) :tag-ptr (the-as (pointer res-tag) (& sv-16)))) + ) (when v1-8 (set! f28-0 (-> v1-8 0)) (set! f26-0 (-> v1-8 1)) diff --git a/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc b/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc index 97737ed7d8..79c37e100f 100644 --- a/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/strip/strip-obs_REF.gc @@ -167,7 +167,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 res-tag)) (set-vector! (-> this shove-vec) 0.0 12288.0 24576.0 1.0) (set! (-> this no-collision-timer) (the-as uint 0)) (let* ((v1-1 *game-info*) @@ -180,8 +179,9 @@ (s3-0 1200) (f30-0 0.0) ) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-3 (res-lump-data arg0 'sync (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-3 (res-lump-data arg0 'sync (pointer float) :tag-ptr (& sv-64))) + ) (when v1-3 (set! s3-0 (the int (* 300.0 (-> v1-3 0)))) (set! f30-0 (-> v1-3 1)) @@ -268,7 +268,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 string)) (let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) (set! (-> s4-0 reaction) cshape-reaction-default) @@ -313,8 +312,9 @@ (t9-9 this arg0) ) (quaternion-copy! (-> this start-quat) (-> this root quat)) - (set! sv-16 "#f") - (let ((a0-24 (entity-lookup-part-group arg0 (& sv-16) 'art-name))) + (let* ((sv-16 "#f") + (a0-24 (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + ) (when a0-24 (let ((a0-25 (-> a0-24 0))) (if (and (nonzero? a0-25) (= (-> a0-25 type) sparticle-launch-group)) @@ -1496,7 +1496,6 @@ TASK_MANAGER_CODE_HOOK (lambda :behavior task-manager () - (local-vars (sv-16 object)) (set-time! (-> self start-time)) (set! (-> self total-time) (seconds 120)) (set! (-> self hud-timer) (ppointer->handle (process-spawn hud-timer :init hud-init-by-other :to *target*))) @@ -1510,73 +1509,74 @@ ) (set! (-> *game-info* timer) (the-as time-frame v1-18)) ) - (set! sv-16 (-> self actor-group 0 0)) - (when (-> self actor-group 0) - (dotimes (v1-23 (the-as int (-> self actor-group 0 0))) - (let ((a1-8 (-> (&+ (-> self actor-group 0) (* v1-23 8)) 3))) - (if (and a1-8 (logtest? (-> a1-8 extra perm status) (entity-perm-status subtask-complete))) - (set! sv-16 (&+ (the-as (pointer entity-actor) sv-16) -1)) + (let ((sv-16 (the-as (pointer entity-actor) (-> self actor-group 0 0)))) + (when (-> self actor-group 0) + (dotimes (v1-23 (the-as int (-> self actor-group 0 0))) + (let ((a1-8 (-> (&+ (-> self actor-group 0) (* v1-23 8)) 3))) + (if (and a1-8 (logtest? (-> a1-8 extra perm status) (entity-perm-status subtask-complete))) + (&+! sv-16 -1) + ) + ) + ) + ) + (when (!= sv-16 (-> self count)) + (case sv-16 + ((5) + (talker-spawn-func (-> *talker-speech* 198) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((4) + (talker-spawn-func (-> *talker-speech* 199) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((3) + (talker-spawn-func (-> *talker-speech* 200) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((2) + (talker-spawn-func (-> *talker-speech* 201) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((1) + (talker-spawn-func (-> *talker-speech* 202) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + (set! (-> self count) (the-as int sv-16)) + ) + (cond + ((and (>= (current-time) (+ #x80e8 (-> self start-time))) + (< (-> self state-time) (+ #x80e8 (-> self start-time))) ) + (talker-spawn-func (-> *talker-speech* 197) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((and (>= (current-time) (+ (-> self start-time) (seconds 90))) + (< (-> self state-time) (+ (-> self start-time) (seconds 90))) + ) + (talker-spawn-func (-> *talker-speech* 196) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ((and (>= (current-time) (+ (-> self start-time) (seconds 60))) + (< (-> self state-time) (+ (-> self start-time) (seconds 60))) + ) + (talker-spawn-func (-> *talker-speech* 195) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + (set-time! (-> self state-time)) + (set! (-> *game-info* counter) (the float (the-as int sv-16))) + (if (>= 1 (the-as int sv-16)) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + "ecowells-victory" + 0 + -1.0 + (new 'static 'sound-id) + ) ) - ) - ) - (when (!= sv-16 (-> self count)) - (case sv-16 - ((5) - (talker-spawn-func (-> *talker-speech* 198) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((4) - (talker-spawn-func (-> *talker-speech* 199) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((3) - (talker-spawn-func (-> *talker-speech* 200) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((2) - (talker-spawn-func (-> *talker-speech* 201) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((1) - (talker-spawn-func (-> *talker-speech* 202) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - (set! (-> self count) (the-as int sv-16)) - ) - (cond - ((and (>= (current-time) (+ #x80e8 (-> self start-time))) - (< (-> self state-time) (+ #x80e8 (-> self start-time))) - ) - (talker-spawn-func (-> *talker-speech* 197) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((and (>= (current-time) (+ (-> self start-time) (seconds 90))) - (< (-> self state-time) (+ (-> self start-time) (seconds 90))) - ) - (talker-spawn-func (-> *talker-speech* 196) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ((and (>= (current-time) (+ (-> self start-time) (seconds 60))) - (< (-> self state-time) (+ (-> self start-time) (seconds 60))) - ) - (talker-spawn-func (-> *talker-speech* 195) *entity-pool* (target-pos 0) (the-as region #f)) - ) - ) - (set-time! (-> self state-time)) - (set! (-> *game-info* counter) (the float (the-as int sv-16))) - (if (>= 1 (the-as int sv-16)) - (gui-control-method-12 - *gui-control* - self - (gui-channel art-load) - (gui-action queue) - "ecowells-victory" - 0 - -1.0 - (new 'static 'sound-id) + (if (not *target*) + (go-virtual fail) ) - ) - (if (not *target*) - (go-virtual fail) - ) - (if (zero? sv-16) - (go-virtual complete) - ) + (if (zero? sv-16) + (go-virtual complete) + ) + ) (suspend) ) (the-as entity-actor (go-virtual fail)) @@ -1824,3 +1824,7 @@ 0 (none) ) + + + + diff --git a/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc b/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc index 758bf1c336..8c044d50b4 100644 --- a/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/title/title-obs_REF.gc @@ -96,50 +96,50 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch time-frame vs none. (defun title-plug-lightning ((arg0 process-drawable) (arg1 vector) (arg2 cspace)) - (local-vars (sv-32 cspace) (sv-48 int) (sv-64 symbol) (sv-80 int) (sv-96 vector)) - (set! sv-32 arg2) - (when (< (-> *setting-control* user-current movie-skip-frame) 0.0) - (let ((s5-0 (get-process *default-dead-pool* lightning-tracker #x4000))) - (when s5-0 - (let ((t9-1 (method-of-type lightning-tracker activate))) - (t9-1 - (the-as lightning-tracker s5-0) - *entity-pool* - (symbol->string (-> lightning-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s3-0 run-function-in-process) - (s2-0 s5-0) - (s1-0 lightning-tracker-init) - (s0-0 (-> *lightning-spec-id-table* 1)) + (let ((sv-32 arg2)) + (when (< (-> *setting-control* user-current movie-skip-frame) 0.0) + (let ((s5-0 (get-process *default-dead-pool* lightning-tracker #x4000))) + (when s5-0 + (let ((t9-1 (method-of-type lightning-tracker activate))) + (t9-1 + (the-as lightning-tracker s5-0) + *entity-pool* + (symbol->string (-> lightning-tracker symbol)) + (the-as pointer #x70004000) ) - (set! sv-48 30) - (set! sv-64 (the-as symbol #f)) - (set! sv-80 (+ (-> sv-32 joint number) 1)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (set! (-> sv-96 x) (+ (-> arg1 x) (rand-vu-float-range -4096.0 4096.0))) - (set! (-> sv-96 y) (+ (-> arg1 y) (rand-vu-float-range -4096.0 4096.0))) - (set! (-> sv-96 z) (+ (-> arg1 z) (rand-vu-float-range -4096.0 4096.0))) - (set! (-> sv-96 w) 1.0) - ((the-as (function object object object object object object object object none) s3-0) - s2-0 - s1-0 - s0-0 - sv-48 - sv-64 - arg0 - sv-80 - sv-96 - ) + ) + (let ((s3-0 run-function-in-process) + (s2-0 s5-0) + (s1-0 lightning-tracker-init) + (s0-0 (-> *lightning-spec-id-table* 1)) + (sv-48 30) + (sv-64 (the-as symbol #f)) + (sv-80 (+ (-> sv-32 joint number) 1)) + (sv-96 (new 'stack-no-clear 'vector)) + ) + (set! (-> sv-96 x) (+ (-> arg1 x) (rand-vu-float-range -4096.0 4096.0))) + (set! (-> sv-96 y) (+ (-> arg1 y) (rand-vu-float-range -4096.0 4096.0))) + (set! (-> sv-96 z) (+ (-> arg1 z) (rand-vu-float-range -4096.0 4096.0))) + (set! (-> sv-96 w) 1.0) + ((the-as (function object object object object object object object object none) s3-0) + s2-0 + s1-0 + s0-0 + sv-48 + sv-64 + arg0 + sv-80 + sv-96 + ) + ) + (-> s5-0 ppointer) ) - (-> s5-0 ppointer) ) - ) - (let ((v1-21 (handle->process (-> *game-info* controller 0)))) - (if v1-21 - (set! (-> (the-as title-control v1-21) spark-time) (-> *display* base-clock frame-counter)) - ) + (let ((v1-21 (handle->process (-> *game-info* controller 0)))) + (if v1-21 + (set! (-> (the-as title-control v1-21) spark-time) (-> *display* base-clock frame-counter)) + ) + ) ) ) (none) @@ -526,7 +526,6 @@ ;; WARN: Return type mismatch int vs object. ;; WARN: new jak 2 until loop case, check carefully (defbehavior title-menu title-control () - (local-vars (sv-112 font-context)) (sound-play "dmenu-hit") (let ((gp-1 (new 'static 'boxed-array :type uint32 #x132))) (until #f @@ -550,26 +549,28 @@ ) ) (when (< (mod (current-time) 300) 210) - (set! sv-112 - (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + (let ((sv-112 + (new 'stack 'font-context *font-default-matrix* 64 312 0.0 (font-color default) (font-flags shadow kerning)) + ) ) - (set-width! sv-112 384) - (set-height! sv-112 50) - (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) - (set! (-> sv-112 scale) 0.7) - (dotimes (s5-4 (-> gp-1 length)) - (if (= (-> self selected) s5-4) - (set! (-> sv-112 color) (font-color progress-old-selected)) - (set! (-> sv-112 color) (font-color white)) + (set-width! sv-112 384) + (set-height! sv-112 50) + (set! (-> sv-112 flags) (font-flags shadow kerning middle middle-vert large)) + (set! (-> sv-112 scale) 0.7) + (dotimes (s5-4 (-> gp-1 length)) + (if (= (-> self selected) s5-4) + (set! (-> sv-112 color) (font-color progress-old-selected)) + (set! (-> sv-112 color) (font-color white)) + ) + (print-game-text + (lookup-text! *common-text* (the-as text-id (-> gp-1 s5-4)) #f) + sv-112 + #f + 44 + (bucket-id progress) ) - (print-game-text - (lookup-text! *common-text* (the-as text-id (-> gp-1 s5-4)) #f) - sv-112 - #f - 44 - (bucket-id progress) + (+! (-> sv-112 origin y) 22.0) ) - (+! (-> sv-112 origin y) 22.0) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/tomb/tomb-obs_REF.gc b/test/decompiler/reference/jak2/levels/tomb/tomb-obs_REF.gc index 6d9dbc12d5..124bc23ee0 100644 --- a/test/decompiler/reference/jak2/levels/tomb/tomb-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/tomb-obs_REF.gc @@ -272,7 +272,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch object vs none. (defbehavior tomb-stair-block-spikes-init-by-other tomb-stair-block-spikes ((arg0 vector)) - (local-vars (sv-16 collide-shape-prim-mesh) (sv-32 type) (sv-48 collide-shape)) (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 1) 0))) (set! (-> s5-0 total-prims) (the-as uint 2)) @@ -287,29 +286,29 @@ (s2-0 (-> (the-as pair s3-0) car)) ) (while (not (null? s3-0)) - (let ((s1-0 (method-of-type collide-shape-prim-mesh new)) - (s0-0 'process) - ) - (set! sv-32 collide-shape-prim-mesh) - (set! sv-48 s5-0) - (let ((a3-2 (command-get-int (-> (the-as pair s2-0) car) 0)) - (t0-1 0) + (let ((sv-16 + (new + 'process + 'collide-shape-prim-mesh + s5-0 + (the-as uint (command-get-int (-> (the-as pair s2-0) car) 0)) + (the-as uint 0) + ) ) - (set! sv-16 (s1-0 s0-0 sv-32 sv-48 (the-as uint a3-2) (the-as uint t0-1))) + ) + (let ((s1-1 sv-16)) + (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) + (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) + (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) + (set! (-> s1-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s2-0) cdr)) car) 0)) + ) + (set-vector! + (-> sv-16 local-sphere) + 0.0 + 0.0 + 0.0 + (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) 0.0) ) - ) - (let ((s1-1 sv-16)) - (set! (-> s1-1 prim-core collide-as) (-> s4-0 prim-core collide-as)) - (set! (-> s1-1 prim-core collide-with) (-> s4-0 prim-core collide-with)) - (set! (-> s1-1 prim-core action) (-> s4-0 prim-core action)) - (set! (-> s1-1 transform-index) (command-get-int (-> (the-as pair (-> (the-as pair s2-0) cdr)) car) 0)) - ) - (set-vector! - (-> sv-16 local-sphere) - 0.0 - 0.0 - 0.0 - (command-get-float (-> (the-as pair (-> (the-as pair (-> (the-as pair s2-0) cdr)) cdr)) car) 0.0) ) (set! s3-0 (-> (the-as pair s3-0) cdr)) (set! s2-0 (-> (the-as pair s3-0) car)) @@ -409,9 +408,9 @@ ;; definition for function lift-pool ;; INFO: Used lq/sq (defbehavior lift-pool tomb-stair-block ((arg0 int)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint arg0) (-> sv-16 elt-count)) (-> v1-1 arg0) (> (-> v1-1 0 length) 0)) (let ((a1-2 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-2 from) (process->ppointer self)) @@ -436,9 +435,9 @@ ;; definition for function drop-pool ;; INFO: Used lq/sq (defbehavior drop-pool tomb-stair-block ((arg0 int)) - (local-vars (sv-16 res-tag)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-1 (< (the-as uint arg0) (-> sv-16 elt-count)) (-> v1-1 arg0) (> (-> v1-1 0 length) 0)) (let ((a0-12 (new 'stack-no-clear 'vector))) (set! (-> a0-12 quad) (-> v1-1 arg0 data 0 actor trans quad)) @@ -722,14 +721,14 @@ ) ) :enter (behavior () - (local-vars (sv-16 res-tag)) (ja-channel-push! 1 (seconds 2)) (ja :group! tomb-stair-block-straight-ja :num! min) (set! (-> self rise-sound) (add-process *gui-control* self (gui-channel jak) (gui-action queue) "tombplta" -99.0 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (gp-1 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and gp-1 (< (the-as uint 2) (-> sv-16 elt-count)) (-> gp-1 2)) (dotimes (s5-0 (-> gp-1 2 length)) (let ((a1-4 (new 'stack-no-clear 'event-message-block))) @@ -768,10 +767,10 @@ (defstate wait-for-pools (tomb-stair-block) :virtual #t :trans (behavior () - (local-vars (sv-16 res-tag)) (let ((gp-0 #t)) - (set! sv-16 (new 'static 'res-tag)) - (let ((s5-0 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (s5-0 (res-lump-data (-> self entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when s5-0 (dotimes (s4-0 (min 2 (the-as int (-> sv-16 elt-count)))) (dotimes (s3-0 (-> s5-0 s4-0 length)) @@ -1966,7 +1965,6 @@ (set-time! (-> self state-time)) ) :code (behavior () - (local-vars (sv-96 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -1990,8 +1988,8 @@ (until #f (let ((s3-0 tomb-sphinx-draw-beam) (s2-0 s5-1) + (sv-96 s4-0) ) - (set! sv-96 s4-0) (let ((s1-0 s5-1)) (let ((s0-1 (vector-! (new 'stack-no-clear 'vector) gp-2 s5-1))) (let ((v1-13 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 300.0))) @@ -2027,7 +2025,6 @@ (set-time! (-> self state-time)) ) :code (behavior () - (local-vars (sv-96 vector) (sv-112 vector)) (rlet ((acc :class vf) (vf0 :class vf) (vf4 :class vf) @@ -2067,23 +2064,24 @@ (until #f (let ((s2-0 tomb-sphinx-draw-beam) (s1-0 s5-0) + (sv-112 s3-0) ) - (set! sv-112 s3-0) (let ((s0-0 gp-1)) - (set! sv-96 (new 'stack-no-clear 'vector)) - (let ((v1-10 gp-1) - (a0-3 s4-0) - ) - (.lvf vf4 (&-> v1-10 quad)) - (.lvf vf5 (&-> a0-3 quad)) + (let ((sv-96 (new 'stack-no-clear 'vector))) + (let ((v1-10 gp-1) + (a0-3 s4-0) + ) + (.lvf vf4 (&-> v1-10 quad)) + (.lvf vf5 (&-> a0-3 quad)) + ) + (.mov.vf.w vf6 vf0) + (.sub.vf.xyz vf6 vf4 vf5) + (.svf (&-> sv-96 quad) vf6) + (let ((v1-15 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 930.0))) + (.mov vf7 v1-15) + ) + (.lvf vf5 (&-> sv-96 quad)) ) - (.mov.vf.w vf6 vf0) - (.sub.vf.xyz vf6 vf4 vf5) - (.svf (&-> sv-96 quad) vf6) - (let ((v1-15 (lerp-scale 0.0 1.0 (the float (- (current-time) (-> self state-time))) 0.0 930.0))) - (.mov vf7 v1-15) - ) - (.lvf vf5 (&-> sv-96 quad)) (.lvf vf4 (&-> s0-0 quad)) ) (.add.x.vf.w vf6 vf0 vf0) diff --git a/test/decompiler/reference/jak2/levels/tomb/tomb-water_REF.gc b/test/decompiler/reference/jak2/levels/tomb/tomb-water_REF.gc index 36cd1e65fe..0d7ee16b25 100644 --- a/test/decompiler/reference/jak2/levels/tomb/tomb-water_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/tomb-water_REF.gc @@ -325,7 +325,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) (set! (-> s4-0 total-prims) (the-as uint 3)) @@ -371,8 +370,9 @@ ) (set! (-> this offset-index) 0) (set! (-> this key-index) 0) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-33 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-33)) @@ -964,14 +964,6 @@ :virtual #t :event tomb-plat-simon-handler :enter (behavior () - (local-vars - (sv-96 target) - (sv-128 vector) - (sv-136 int) - (sv-144 int) - (sv-160 int) - (sv-176 (function vector vector float)) - ) (set-time! (-> self state-time)) (set! (-> self plat-idx) 0) (dotimes (gp-0 (-> self plat-count)) @@ -979,62 +971,46 @@ (send-event (handle->process (-> self plat gp-0)) 'die-unmaskable) ) ) - (set! sv-96 (the-as target (as-type *target* process-focusable))) - (dotimes (gp-2 (-> self plat-count)) - (set! sv-128 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (the float gp-2) 'exact)) - (set! sv-136 -1) - (dotimes (v1-20 (+ (-> self plat-seq-count) -1)) - (if (= gp-2 (-> self plat-seq v1-20)) - (set! sv-136 (the-as int (-> self plat-seq (+ v1-20 1)))) + (let ((sv-96 (the-as target (as-type *target* process-focusable)))) + (dotimes (gp-2 (-> self plat-count)) + (let ((sv-128 (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (the float gp-2) 'exact)) + (sv-136 -1) + ) + (dotimes (v1-20 (+ (-> self plat-seq-count) -1)) + (if (= gp-2 (-> self plat-seq v1-20)) + (set! sv-136 (the-as int (-> self plat-seq (+ v1-20 1)))) + ) ) - ) - (let ((v1-26 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 x))))) - (a0-21 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 z))))) - ) - (set! sv-144 (logand (logior (logand v1-26 1) (* a0-21 2)) 3)) - ) - (let* ((s5-0 (get-process *default-dead-pool* tomb-simon-block #x4000)) - (s4-0 (when s5-0 - (let ((t9-4 (method-of-type tomb-simon-block activate))) - (t9-4 - (the-as tomb-simon-block s5-0) - self - (symbol->string (-> tomb-simon-block symbol)) - (the-as pointer #x70004000) + (let* ((v1-26 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 x))))) + (a0-21 (the int (* 0.000061035156 (+ 40960000.0 (-> sv-128 z))))) + (sv-144 (logand (logior (logand v1-26 1) (* a0-21 2)) 3)) + (s5-0 (get-process *default-dead-pool* tomb-simon-block #x4000)) + (s4-0 (when s5-0 + (let ((t9-4 (method-of-type tomb-simon-block activate))) + (t9-4 + (the-as tomb-simon-block s5-0) + self + (symbol->string (-> tomb-simon-block symbol)) + (the-as pointer #x70004000) + ) + ) + (run-now-in-process + s5-0 + tomb-simon-block-init-by-other + sv-128 + gp-2 + sv-136 + (the int (* 0.00012207031 (vector-vector-xz-distance (get-trans sv-96 0) sv-128))) + sv-144 + ) + (-> s5-0 ppointer) ) ) - (let ((s4-1 run-function-in-process) - (s3-0 s5-0) - (s2-0 tomb-simon-block-init-by-other) - (s1-0 sv-128) - (s0-0 gp-2) - ) - (set! sv-160 sv-136) - (let ((f30-0 0.00012207031)) - (set! sv-176 vector-vector-xz-distance) - (let* ((a0-26 (get-trans sv-96 0)) - (a1-9 sv-128) - (t1-0 (the int (* f30-0 (sv-176 a0-26 a1-9)))) - (t2-0 sv-144) - ) - ((the-as (function object object object object object object object none) s4-1) - s3-0 - s2-0 - s1-0 - s0-0 - sv-160 - t1-0 - t2-0 - ) - ) - ) - ) - (-> s5-0 ppointer) - ) - ) - ) - (send-event (ppointer->process s4-0) 'reparent) - (set! (-> self plat gp-2) (ppointer->handle s4-0)) + ) + (send-event (ppointer->process s4-0) 'reparent) + (set! (-> self plat gp-2) (ppointer->handle s4-0)) + ) + ) ) ) ) @@ -1127,13 +1103,13 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (change-parent this *pusher-pool*) (set! (-> this notify-actor) (entity-actor-lookup arg0 'alt-actor 0)) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-2 (res-lump-data (-> this entity) 'plat-seq pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-2 (res-lump-data (-> this entity) 'plat-seq pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-2 (nonzero? (-> sv-16 elt-count))) (set! (-> this plat-seq-count) (the-as int (-> sv-16 elt-count))) @@ -2155,7 +2131,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag) (sv-32 res-tag)) (with-pp (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) @@ -2201,8 +2176,9 @@ (set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-26 (res-lump-data (-> this entity) 'vibe-pattern pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-26 (res-lump-data (-> this entity) 'vibe-pattern pointer :tag-ptr (& sv-16))) + ) (cond ((and v1-26 (nonzero? (-> sv-16 elt-count))) (set! (-> this pat-tbl) (the-as (pointer int32) v1-26)) @@ -2215,8 +2191,9 @@ ) ) ) - (set! sv-32 (new 'static 'res-tag)) - (let ((v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32)))) + (let* ((sv-32 (new 'static 'res-tag)) + (v1-33 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-32))) + ) (cond ((and v1-33 (nonzero? (-> sv-32 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) v1-33)) diff --git a/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc b/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc index 09543072a5..a9ac22f509 100644 --- a/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/widow-baron_REF.gc @@ -1129,7 +1129,7 @@ ;; definition for function widow-handler ;; INFO: Used lq/sq (defbehavior widow-handler widow ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-0 object) (sv-224 symbol) (sv-240 symbol) (sv-256 vector) (sv-272 matrix)) + (local-vars (v0-0 object)) (case arg2 (('attack) (let ((v1-1 (the-as object (-> arg3 param 1)))) @@ -1139,43 +1139,13 @@ ) (set! (-> self last-attack-id) (-> (the-as attack-info v1-1) id)) (send-event self 'bomb-hit (target-pos 0) 4) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000))) - (when gp-2 - (let ((t9-3 (method-of-type part-tracker activate))) - (t9-3 - (the-as part-tracker gp-2) - *entity-pool* - (symbol->string (-> part-tracker symbol)) - (the-as pointer #x70004000) - ) - ) - (let ((s5-0 run-function-in-process) - (s4-0 gp-2) - (s3-0 part-tracker-init) - (s2-0 group-spydroid-explode) - (s1-0 600) - (s0-0 #f) - ) - (set! sv-224 (the-as symbol #f)) - (set! sv-240 (the-as symbol #f)) - (set! sv-272 *launch-matrix*) - (set! sv-256 (-> sv-272 trans)) - (let ((v1-16 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node widow-lod0-jg Lwrist)) quad))) - (set! (-> sv-256 quad) v1-16) - ) - ((the-as (function object object object object object object object object none) s5-0) - s4-0 - s3-0 - s2-0 - s1-0 - s0-0 - sv-224 - sv-240 - sv-272 - ) - ) - (-> gp-2 ppointer) - ) + (part-tracker-spawn + :to *entity-pool* + :group group-spydroid-explode + :duration 600 + :userdata (the-as symbol #f) + :target (the-as symbol #f) + :mat-joint (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node widow-lod0-jg Lwrist)) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/tomb/widow-extras_REF.gc b/test/decompiler/reference/jak2/levels/tomb/widow-extras_REF.gc index a0b5c930cd..b152c02927 100644 --- a/test/decompiler/reference/jak2/levels/tomb/widow-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/widow-extras_REF.gc @@ -621,30 +621,11 @@ ;; ERROR: Stack slot load at 64 mismatch: defined as size 4, got size 16 ;; WARN: Return type mismatch int vs none. (defmethod widow-bomb-method-34 ((this widow-bomb)) - (local-vars (sv-48 float) (sv-64 float)) (let ((s5-0 (new 'stack-no-clear 'quaternion)) (gp-0 (new 'stack-no-clear 'quaternion)) ) - (let ((s3-0 quaternion-set!) - (s2-0 s5-0) - (s1-0 (sin (/ (-> this x-rotate) 2))) - (s0-0 0.0) - ) - (set! sv-48 (the-as float 0.0)) - (let ((t0-0 (cos (/ (-> this x-rotate) 2)))) - (s3-0 s2-0 s1-0 s0-0 sv-48 t0-0) - ) - ) - (let ((s3-1 quaternion-set!) - (s2-1 gp-0) - (s1-1 0.0) - (s0-1 (sin (/ (-> this y-rotate) 2))) - ) - (set! sv-64 (the-as float 0.0)) - (let ((t0-1 (cos (/ (-> this y-rotate) 2)))) - (s3-1 s2-1 s1-1 s0-1 sv-64 t0-1) - ) - ) + (quaternion-set! s5-0 (sin (/ (-> this x-rotate) 2)) 0.0 (the-as float 0.0) (cos (/ (-> this x-rotate) 2))) + (quaternion-set! gp-0 0.0 (sin (/ (-> this y-rotate) 2)) (the-as float 0.0) (cos (/ (-> this y-rotate) 2))) (quaternion-normalize! (quaternion*! (-> this spin-jm quat) gp-0 s5-0)) ) 0 @@ -688,9 +669,7 @@ ) (set! (-> gp-0 y) (-> s4-1 y)) (vector-! s5-1 s4-1 gp-0) - (let* ((f0-6 f28-0) - (f0-8 (* f0-6 f0-6)) - ) + (let ((f0-8 (square f28-0))) (.lvf vf1 (&-> s5-1 quad)) (.add.w.vf.x vf2 vf0 vf0) (.mul.vf vf1 vf1 vf1) @@ -883,11 +862,8 @@ (defstate explode (widow-bomb) :virtual #t :enter (behavior () - (let* ((a0-1 (target-pos 0)) - (f0-0 (vector-vector-distance-squared a0-1 (-> self root trans))) - (f1-0 16384.0) - ) - (if (< f0-0 (* f1-0 f1-0)) + (let ((a0-1 (target-pos 0))) + (if (< (vector-vector-distance-squared a0-1 (-> self root trans)) (square 16384.0)) (send-event *target* 'attack diff --git a/test/decompiler/reference/jak2/levels/tomb/widow-more-extras_REF.gc b/test/decompiler/reference/jak2/levels/tomb/widow-more-extras_REF.gc index 547a7c33bf..2464e4ae4e 100644 --- a/test/decompiler/reference/jak2/levels/tomb/widow-more-extras_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/widow-more-extras_REF.gc @@ -151,7 +151,6 @@ (set! (-> self sound-floor) 81920.0) ) :trans (behavior () - (local-vars (sv-16 float)) (+! (-> self root trans y) (* (-> self y-velocity) (-> self clock time-adjust-ratio))) (set! (-> self y-velocity) (fmax -3686.4 (- (-> self y-velocity) (* 204.8 (-> self clock time-adjust-ratio)))) @@ -173,8 +172,8 @@ (f24-0 (-> *part-id-table* 3266 init-specs 7 initial-valuef)) (f22-0 (-> *part-id-table* 3266 init-specs 7 random-rangef)) (f20-0 (-> *part-id-table* 3266 init-specs 8 initial-valuef)) + (sv-16 (-> *part-id-table* 3266 init-specs 8 random-rangef)) ) - (set! sv-16 (-> *part-id-table* 3266 init-specs 8 random-rangef)) (set! (-> *part-id-table* 3266 init-specs 6 initial-valuef) (* (-> *part-id-table* 3266 init-specs 6 initial-valuef) f30-1) ) @@ -199,9 +198,9 @@ (set! (-> *part-id-table* 3266 init-specs 7 initial-valuef) f24-0) (set! (-> *part-id-table* 3266 init-specs 7 random-rangef) f22-0) (set! (-> *part-id-table* 3266 init-specs 8 initial-valuef) f20-0) + (set! (-> *part-id-table* 3266 init-specs 8 random-rangef) sv-16) + sv-16 ) - (set! (-> *part-id-table* 3266 init-specs 8 random-rangef) sv-16) - sv-16 ) (set-vector! (-> self draw color-mult) f30-1 f30-1 f30-1 1.0) ) diff --git a/test/decompiler/reference/jak2/levels/under/centipede_REF.gc b/test/decompiler/reference/jak2/levels/under/centipede_REF.gc index ee5b41dee5..35f376f693 100644 --- a/test/decompiler/reference/jak2/levels/under/centipede_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/centipede_REF.gc @@ -581,10 +581,8 @@ (a0-2 (-> this fact)) ) (when (and (< f0-0 (+ f1-0 (-> a0-2 notice-top))) (< (- f1-0 (-> a0-2 notice-bottom)) f0-0)) - (let* ((f30-0 (-> this enemy-info notice-nav-radius)) - (f0-1 f30-0) - ) - (or (>= (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) + (let ((f30-0 (-> this enemy-info notice-nav-radius))) + (or (>= (square f30-0) (vector-vector-xz-distance-squared (-> v1-4 trans) arg1)) (is-in-mesh? (-> this nav) arg1 f30-0) ) ) @@ -613,9 +611,8 @@ (when targ (let* ((targ-pos (get-trans targ 0)) (y-off (- (-> targ-pos y) (-> this root trans y))) - (dist 28672.0) ) - (and (>= (* dist dist) (vector-vector-xz-distance-squared (-> this root trans) targ-pos)) + (and (>= (square 28672.0) (vector-vector-xz-distance-squared (-> this root trans) targ-pos)) (or (>= y-off -12288.0) (or (>= 24576.0 y-off) (focus-test? targ edge-grab))) ) ) @@ -720,11 +717,9 @@ (vector+! s3-0 s3-0 (-> s2-0 state mesh bounds)) ) 0 - (let ((f0-2 1024.0)) - (if (>= (* f0-2 f0-2) (vector-vector-xz-distance-squared (-> s4-0 best-other-tri intersect) (-> s5-0 trans))) - (set! (-> s5-0 gspot-pos y) (-> s4-0 best-other-tri intersect y)) - ) - ) + (if (>= (square 1024.0) (vector-vector-xz-distance-squared (-> s4-0 best-other-tri intersect) (-> s5-0 trans))) + (set! (-> s5-0 gspot-pos y) (-> s4-0 best-other-tri intersect y)) + ) ) ) ) @@ -1185,7 +1180,7 @@ (let* ((v1-5 (- (current-time) (-> self state-time))) (f1-2 (* 0.00952381 (the float v1-5))) ) - (quaternion-slerp! (-> self root quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (* f1-2 f1-2))) + (quaternion-slerp! (-> self root quat) (-> self src-quat) (-> self dest-quat) (- 1.0 (square f1-2))) ) (centipede-method-188 self) (suspend) diff --git a/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc b/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc index 0e20aa4133..50a7fd31c7 100644 --- a/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/jellyfish_REF.gc @@ -145,11 +145,7 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov v1-26 vf1) - (let ((f0-7 v1-26) - (f1-5 409.6) - ) - (< f0-7 (* f1-5 f1-5)) - ) + (< v1-26 (square 409.6)) ) ) (+! s3-0 1) @@ -1032,7 +1028,6 @@ ;; definition for method 162 of type jellyfish ;; INFO: Used lq/sq (defmethod jellyfish-method-162 ((this jellyfish)) - (local-vars (sv-624 int)) (rlet ((acc :class vf) (vf0 :class vf) (vf1 :class vf) @@ -1056,8 +1051,8 @@ (s1-0 (new 'stack-no-clear 'vector)) (s0-0 (new 'stack-no-clear 'collide-query)) (f26-0 40960.0) + (sv-624 0) ) - (set! sv-624 0) (while (< sv-624 (the int f28-1)) (let ((a2-1 s2-0)) (let ((v1-9 s5-0) @@ -1094,7 +1089,7 @@ (set! f30-0 (fmax 0.0 (+ -40960.0 f30-0))) (+! s3-2 (the int (fmin 40960.0 f30-0))) (set! f26-0 (+ -4915.2 f26-0)) - (set! sv-624 (+ sv-624 1)) + (+! sv-624 1) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc b/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc index e67b77d33a..1830362ae1 100644 --- a/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/sig5-course_REF.gc @@ -201,10 +201,7 @@ ;; WARN: disable def twice: 39. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. (defmethod sig-under-method-262 ((this sig-under) (arg0 symbol)) (when (or (logtest? (-> this bot-task-bits) (bot-task-bits botbits-1)) - (and arg0 (let ((f0-0 81920.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) - ) - ) + (and arg0 (>= (square 81920.0) (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans)))) ) (cond ((speech-playing? this 7) @@ -263,14 +260,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-5 vf1) - (let ((f0-1 a2-5) - (f1-1 (+ (-> a1-2 world-sphere w) (-> gp-0 r))) - ) - (when (< f0-1 (* f1-1 f1-1)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-5 (square (+ (-> a1-2 world-sphere w) (-> gp-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-6)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -304,14 +297,10 @@ (.add.y.vf.x vf1 vf1 vf1) (.add.z.vf.x vf1 vf1 vf1) (.mov a2-12 vf1) - (let ((f0-2 a2-12) - (f1-5 (+ (-> a1-14 world-sphere w) (-> gp-0 r))) - ) - (when (< f0-2 (* f1-5 f1-5)) - (when (< *actor-list-length* 256) - (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) - (set! *actor-list-length* (+ *actor-list-length* 1)) - ) + (when (< a2-12 (square (+ (-> a1-14 world-sphere w) (-> gp-0 r)))) + (when (< *actor-list-length* 256) + (set! (-> *actor-list* *actor-list-length*) (the-as collide-shape a0-9)) + (set! *actor-list-length* (+ *actor-list-length* 1)) ) ) ) @@ -356,7 +345,7 @@ (set! f2-1 (+ 2048.0 f2-1)) ) (if (and (>= f0-6 -2048.0) (>= f1-3 f0-6)) - (>= (* f2-1 f2-1) (vector-vector-xz-distance-squared arg1 (-> this root trans))) + (>= (square f2-1) (vector-vector-xz-distance-squared arg1 (-> this root trans))) ) ) ) @@ -1447,9 +1436,7 @@ (set! (-> s5-0 y) 0.0) (set! (-> s5-0 w) 1.0) (when (and (>= (vector4-dot (the-as vector (-> arg1 test-plane)) s5-0) 0.0) - (let ((f0-4 81920.0)) - (>= (* f0-4 f0-4) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 sig5-course spots 24 center))) - ) + (>= (square 81920.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 sig5-course spots 24 center))) ) (set! v1-14 #t) (goto cfg-21) @@ -1569,9 +1556,7 @@ (sig-under-method-263 arg1) (when (and (time-elapsed? (-> arg1 waypoint-time0) (seconds 4)) (sig-method-257 arg1) - (let ((f0-0 61440.0)) - (>= (* f0-0 f0-0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) - ) + (>= (square 61440.0) (vector-vector-xz-distance-squared (target-pos 0) (-> arg1 root trans))) ) (set! (-> arg1 enemy-flags) (the-as enemy-flag (logclear (-> arg1 enemy-flags) (enemy-flag jump-check-blocked))) diff --git a/test/decompiler/reference/jak2/levels/under/under-laser_REF.gc b/test/decompiler/reference/jak2/levels/under/under-laser_REF.gc index 72612d1001..e4d5deb888 100644 --- a/test/decompiler/reference/jak2/levels/under/under-laser_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/under-laser_REF.gc @@ -437,7 +437,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-64 res-tag)) (set! (-> this root) (the-as collide-shape-moving (new 'process 'trsqv))) (process-drawable-from-entity! this arg0) (logclear! (-> this mask) (process-mask actor-pause)) @@ -470,8 +469,9 @@ (set! (-> this clock) (-> *display* user0-clock)) (let ((s5-1 (-> this root))) (set-vector! (-> s5-1 scale) 1.25 1.25 1.25 1.0) - (set! sv-64 (new 'static 'res-tag)) - (let ((v1-22 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-64)))) + (let* ((sv-64 (new 'static 'res-tag)) + (v1-22 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-64))) + ) (when v1-22 (+! (-> s5-1 trans x) (-> v1-22 0)) (+! (-> s5-1 trans y) (-> v1-22 1)) diff --git a/test/decompiler/reference/jak2/levels/under/under-obs_REF.gc b/test/decompiler/reference/jak2/levels/under/under-obs_REF.gc index 3543ca4ef9..b869b8bc32 100644 --- a/test/decompiler/reference/jak2/levels/under/under-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/under-obs_REF.gc @@ -365,9 +365,7 @@ (when a0-4 (let ((a0-5 (get-trans a0-4 0))) (when (and (>= (- (-> a0-5 y) (-> self root trans y)) -6144.0) - (let ((f0-18 11264.0)) - (>= (* f0-18 f0-18) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) - ) + (>= (square 11264.0) (vector-vector-xz-distance-squared a0-5 (-> self root trans))) ) (if (time-elapsed? (-> self last-recharge-time) (seconds 1)) (sound-play "oxygen-recharge") @@ -652,7 +650,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> s3-0 prim-core collide-as) (collide-spec obstacle camera-blocker pusher)) @@ -673,8 +670,9 @@ ) (process-drawable-from-entity! this arg0) (-> this root) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-16 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-16 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-16 (+! (-> this root trans x) (-> v1-16 0)) (+! (-> this root trans y) (-> v1-16 1)) @@ -1479,10 +1477,8 @@ (.add.mul.y.vf.x acc vf2 vf1 acc) (.add.mul.z.vf.x vf1 vf2 vf1 acc) (.mov a0-8 vf1) - (let ((f0-9 a0-8) - (f1-4 28672.0) - ) - (if (< (* f1-4 f1-4) f0-9) + (let ((f0-9 a0-8)) + (if (< (square 28672.0) f0-9) (vector-float*! v1-21 v1-21 (/ 28672.0 (sqrtf f0-9))) ) ) diff --git a/test/decompiler/reference/jak2/levels/under/under-shoot-block_REF.gc b/test/decompiler/reference/jak2/levels/under/under-shoot-block_REF.gc index c6814b23e0..41d250f619 100644 --- a/test/decompiler/reference/jak2/levels/under/under-shoot-block_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/under-shoot-block_REF.gc @@ -2051,17 +2051,6 @@ ;; INFO: Used lq/sq ;; WARN: Return type mismatch symbol vs none. (defmethod under-shoot-block-method-27 ((this under-shoot-block) (arg0 symbol)) - (local-vars - (sv-16 process) - (sv-32 (function int int symbol (pointer process) none :behavior under-block)) - (sv-48 int) - (sv-64 process) - (sv-80 (function int int symbol (pointer process) none :behavior under-block)) - (sv-96 int) - (sv-112 process) - (sv-128 (function int int symbol (pointer process) none :behavior under-block)) - (sv-144 int) - ) (let ((s4-0 (-> this puzzle))) (set! (-> s4-0 prev-special-attack-id) (the-as uint 0)) (set! (-> s4-0 slot-mask) (the-as uint 0)) @@ -2097,16 +2086,19 @@ (let ((t9-2 (method-of-type under-block activate))) (t9-2 (the-as under-block s1-0) this (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) ) - (let ((s0-0 run-function-in-process)) - (set! sv-16 s1-0) - (set! sv-32 under-block-init-by-other) - (set! sv-48 s3-0) - (let ((a3-1 (under-shoot-block-method-28 this)) - (t0-0 'beaten) - (t1-0 (process->ppointer this)) - ) - ((the-as (function object object object object object object none) s0-0) sv-16 sv-32 sv-48 a3-1 t0-0 t1-0) - ) + (let ((s0-0 run-function-in-process) + (sv-16 s1-0) + (sv-32 under-block-init-by-other) + (sv-48 s3-0) + ) + ((the-as (function object object object object object object none) s0-0) + sv-16 + sv-32 + sv-48 + (under-shoot-block-method-28 this) + 'beaten + (process->ppointer this) + ) ) (-> s1-0 ppointer) ) @@ -2123,16 +2115,19 @@ (let ((t9-6 (method-of-type under-block activate))) (t9-6 (the-as under-block s1-1) this (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) ) - (let ((s0-1 run-function-in-process)) - (set! sv-64 s1-1) - (set! sv-80 under-block-init-by-other) - (set! sv-96 s3-0) - (let ((a3-3 (under-shoot-block-method-28 this)) - (t0-1 'idle) - (t1-1 (process->ppointer this)) - ) - ((the-as (function object object object object object object none) s0-1) sv-64 sv-80 sv-96 a3-3 t0-1 t1-1) - ) + (let ((s0-1 run-function-in-process) + (sv-64 s1-1) + (sv-80 under-block-init-by-other) + (sv-96 s3-0) + ) + ((the-as (function object object object object object object none) s0-1) + sv-64 + sv-80 + sv-96 + (under-shoot-block-method-28 this) + 'idle + (process->ppointer this) + ) ) (-> s1-1 ppointer) ) @@ -2146,16 +2141,19 @@ (let ((t9-10 (method-of-type under-block activate))) (t9-10 (the-as under-block s1-2) this (symbol->string (-> under-block symbol)) (the-as pointer #x70004000)) ) - (let ((s0-2 run-function-in-process)) - (set! sv-112 s1-2) - (set! sv-128 under-block-init-by-other) - (set! sv-144 s3-0) - (let ((a3-5 (under-shoot-block-method-28 this)) - (t0-2 'waiting) - (t1-2 (process->ppointer this)) - ) - ((the-as (function object object object object object object none) s0-2) sv-112 sv-128 sv-144 a3-5 t0-2 t1-2) - ) + (let ((s0-2 run-function-in-process) + (sv-112 s1-2) + (sv-128 under-block-init-by-other) + (sv-144 s3-0) + ) + ((the-as (function object object object object object object none) s0-2) + sv-112 + sv-128 + sv-144 + (under-shoot-block-method-28 this) + 'waiting + (process->ppointer this) + ) ) (-> s1-2 ppointer) ) @@ -2205,7 +2203,6 @@ :virtual #t :event under-shoot-block-event-handler :trans (behavior () - (local-vars (sv-96 int)) (let ((gp-0 (-> self puzzle))) (if (= (-> gp-0 slot-mask) (-> gp-0 slot-mask-full)) (go-virtual victory-locked) @@ -2225,14 +2222,16 @@ (let ((s2-0 run-function-in-process) (s1-0 s3-0) (s0-0 under-block-init-by-other) + (sv-96 s5-0) ) - (set! sv-96 s5-0) - (let ((a3-1 (under-shoot-block-method-28 self)) - (t0-0 'follow) - (t1-0 (process->ppointer self)) - ) - ((the-as (function object object object object object object none) s2-0) s1-0 s0-0 sv-96 a3-1 t0-0 t1-0) - ) + ((the-as (function object object object object object object none) s2-0) + s1-0 + s0-0 + sv-96 + (under-shoot-block-method-28 self) + 'follow + (process->ppointer self) + ) ) (-> s3-0 ppointer) ) @@ -2350,15 +2349,15 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this root) (new 'process 'trsqv)) (process-drawable-from-entity! this arg0) (let ((s5-1 (res-lump-value (-> this entity) 'extra-id uint128 :default (the-as uint128 -1) :time -1000000000.0))) (if (or (< (the-as int s5-1) 0) (>= (the-as int s5-1) (-> *under-block-puzzles* length))) (go process-drawable-art-error "bad puzzle id") ) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a0-7 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and a0-7 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) a0-7)) (set! (-> this actor-group) (the-as (pointer actor-group) #f)) diff --git a/test/decompiler/reference/jak2/levels/under/under-sig-obs_REF.gc b/test/decompiler/reference/jak2/levels/under/under-sig-obs_REF.gc index 5b53bc7a13..11a25ed8b2 100644 --- a/test/decompiler/reference/jak2/levels/under/under-sig-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/under-sig-obs_REF.gc @@ -679,7 +679,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((v1-2 (new 'process 'collide-shape-prim-mesh s4-0 (the-as uint 0) (the-as uint 0)))) (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) @@ -710,8 +709,9 @@ ) ) (let ((s4-4 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-15 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-15 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-15 (+! (-> this root trans x) (-> v1-15 0)) (+! (-> this root trans y) (-> v1-15 1)) @@ -818,7 +818,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this bridge-id) (res-lump-value (-> this entity) 'extra-id int :time -1000000000.0)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) @@ -861,8 +860,9 @@ ) ) (let ((s4-4 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-24 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-24 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-24 (+! (-> this root trans x) (-> v1-24 0)) (+! (-> this root trans y) (-> v1-24 1)) @@ -966,7 +966,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (let ((s4-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) (let ((s3-0 (new 'process 'collide-shape-prim-group s4-0 (the-as uint 2) 0))) (set! (-> s4-0 total-prims) (the-as uint 3)) @@ -1002,8 +1001,9 @@ (the-as skeleton-group (art-group-get-by-name *level* "skel-under-int-door" (the-as (pointer uint32) #f))) (the-as pair 0) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-18 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-18 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16))) + ) (when (and v1-18 (nonzero? (-> sv-16 elt-count))) (let ((a0-25 (-> v1-18 0 data 0 actor))) (if (and a0-25 (logtest? (-> a0-25 extra perm status) (entity-perm-status subtask-complete))) @@ -1135,7 +1135,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (init-plat-collision! this) (process-drawable-from-entity! this arg0) (initialize-skeleton @@ -1145,8 +1144,9 @@ ) (stop-bouncing! this) (let ((s5-1 (-> this root))) - (set! sv-16 (new 'static 'res-tag)) - (let ((v1-8 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (v1-8 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))) + ) (when v1-8 (+! (-> s5-1 trans x) (-> v1-8 0)) (+! (-> s5-1 trans y) (-> v1-8 1)) diff --git a/test/decompiler/reference/jak2/levels/under/underb-master_REF.gc b/test/decompiler/reference/jak2/levels/under/underb-master_REF.gc index d7c45ea057..1b1c7c15e0 100644 --- a/test/decompiler/reference/jak2/levels/under/underb-master_REF.gc +++ b/test/decompiler/reference/jak2/levels/under/underb-master_REF.gc @@ -1130,7 +1130,6 @@ - collision information - loading the skeleton group / bones - sounds" - (local-vars (sv-16 res-tag)) (set! (-> this which-reminder?) #f) (set! (-> this spooled-sound-id) (new 'static 'sound-id)) (set! (-> this root) (new 'process 'trsqv)) @@ -1145,8 +1144,9 @@ ) ) ) - (set! sv-16 (new 'static 'res-tag)) - (let ((a0-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16)))) + (let* ((sv-16 (new 'static 'res-tag)) + (a0-6 (res-lump-data (-> this entity) 'actor-groups pointer :tag-ptr (& sv-16))) + ) (if (and a0-6 (nonzero? (-> sv-16 elt-count))) (set! (-> this actor-group) (the-as (pointer actor-group) a0-6)) (set! (-> this actor-group) (the-as (pointer actor-group) #f))